{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "slot-picker-base",
  "type": "registry:component",
  "title": "Slot Picker (base)",
  "description": "Theme-ready base variant of A premium scheduling component for managing time slots with fluid spring animations and tactile toggles..",
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "files": [
    {
      "path": "components/watermelon/slot-picker.tsx",
      "type": "registry:component",
      "content": "import { useState } from 'react';\nimport { motion, AnimatePresence, LayoutGroup } from 'motion/react';\nimport { Plus, X } from 'lucide-react';\n\ninterface TimeSlot {\n    id: string;\n    from: string;\n    to: string;\n}\n\ninterface DayData {\n    id: string;\n    label: string;\n    enabled: boolean;\n    slots: TimeSlot[];\n}\n\ninterface SlotPickerProps {\n    days: DayData[];\n    onUpdate?: (days: DayData[]) => void;\n}\n\nconst springConfig = {\n    type: \"spring\",\n    stiffness: 500,\n    damping: 30,\n    mass: 1\n} as const;\n\nexport const SlotPicker = ({ days: initialDays, onUpdate }: SlotPickerProps) => {\n    const [days, setDays] = useState<DayData[]>(initialDays);\n\n\n    const updateSlotValue = (dayId: string, slotId: string, field: 'from' | 'to', value: string) => {\n        const newDays = days.map((day) => {\n            if (day.id === dayId) {\n                return {\n                    ...day,\n                    slots: day.slots.map((slot) =>\n                        slot.id === slotId ? { ...slot, [field]: value } : slot\n                    ),\n                };\n            }\n            return day;\n        });\n        setDays(newDays);\n        onUpdate?.(newDays);\n    };\n\n    const toggleDay = (id: string) => {\n        const newDays = days.map((day) => {\n            if (day.id === id) {\n                const enabled = !day.enabled;\n                const slots = enabled && day.slots.length === 0\n                    ? [{ id: Math.random().toString(), from: '7:00 AM', to: '8:00 AM' }]\n                    : day.slots;\n                return { ...day, enabled, slots };\n            }\n            return day;\n        });\n        setDays(newDays);\n        onUpdate?.(newDays);\n    };\n\n    const addSlot = (dayId: string) => {\n        const newDays = days.map((day) => {\n            if (day.id === dayId) {\n                return {\n                    ...day,\n                    slots: [...day.slots, { id: Math.random().toString(), from: '9:00 AM', to: '10:00 AM' }]\n                };\n            }\n            return day;\n        });\n        setDays(newDays);\n        onUpdate?.(newDays);\n    };\n\n    const removeSlot = (dayId: string, slotId: string) => {\n        const newDays = days.map((day) => {\n            if (day.id === dayId) {\n                const filteredSlots = day.slots.filter(s => s.id !== slotId);\n                return {\n                    ...day,\n                    slots: filteredSlots,\n                    enabled: filteredSlots.length > 0\n                };\n            }\n            return day;\n        });\n        setDays(newDays);\n        onUpdate?.(newDays);\n    };\n\n    return (\n        <div className=\"flex flex-col gap-4 w-xs sm:w-sm px-3 py-1.5 theme-injected font-sans\">\n            <LayoutGroup>\n                {days.map((day) => (\n                    <motion.div\n                        layout\n                        key={day.id}\n                        initial={false}\n                        transition={springConfig}\n                        className={`overflow-hidden rounded-3xl transition-colors duration-300 border-[1.6px] ${day.enabled\n                            ? 'bg-card border-border shadow-sm'\n                            : 'bg-muted border-transparent'\n                            }`}\n                    >\n                        {/* Header */}\n                        <motion.div layout transition={springConfig} className=\"flex items-center justify-between px-5 h-14\">\n                            <span className=\"font-sans text-[16px] font-semibold transition-colors text-foreground\">\n                                {day.label}\n                            </span>\n\n                            <button title='switch'\n                                onClick={() => toggleDay(day.id)}\n                                className={`relative w-12 h-7 rounded-full transition-colors shadow-sm duration-300 ${day.enabled ? 'bg-primary' : 'bg-input'}`}\n                            >\n                                <motion.div\n                                    layout\n                                    className=\"absolute top-1 left-1 w-5 h-5 bg-background rounded-full shadow-sm\"\n                                    animate={{ x: day.enabled ? 20 : 0 }}\n                                    transition={springConfig}\n                                />\n                            </button>\n                        </motion.div>\n\n                        {/* Slots Area */}\n                        <AnimatePresence>\n                            {day.enabled && (\n                                <motion.div\n                                    initial={{ height: 0, opacity: 0 }}\n                                    animate={{ height: 'auto', opacity: 1 }}\n                                    exit={{ height: 0, opacity: 0 }}\n                                    transition={springConfig}\n                                >\n                                    <div className=\"px-5 pb-5 flex flex-col gap-3\">\n                                        <AnimatePresence mode=\"popLayout\">\n                                            {day.slots.map((slot) => (\n                                                <motion.div\n                                                    key={slot.id}\n                                                    layout\n                                                    initial={{ opacity: 0, scale: 0.9, y: -10 }}\n                                                    animate={{ opacity: 1, scale: 1, y: 0 }}\n                                                    exit={{ opacity: 0, scale: 0.9, y: -10 }}\n                                                    transition={springConfig}\n                                                    className=\"flex items-center gap-2\"\n                                                >\n                                                    <div className=\"flex items-center gap-2 flex-1\">\n                                                        <span className=\"font-sans text-[13px] w-8 text-muted-foreground\">From</span>\n                                                        <input\n                                                            type=\"text\"\n                                                            value={slot.from}\n                                                            onChange={(e) => updateSlotValue(day.id, slot.id, 'from', e.target.value)}\n                                                            aria-label=\"Start time\"\n                                                            className=\"font-sans flex-1 w-24 border-[1.6px] rounded-md px-2 py-1 text-[14px] font-medium focus:outline-none uppercase transition-colors bg-input border-border text-foreground focus:border-ring\"\n                                                        />\n\n                                                        <span className=\"font-sans text-[13px] text-muted-foreground\">To</span>\n                                                        <input\n                                                            type=\"text\"\n                                                            value={slot.to}\n                                                            aria-label=\"End time\"\n                                                            onChange={(e) => updateSlotValue(day.id, slot.id, 'to', e.target.value)}\n                                                            className=\"font-sans flex-1 w-24 border-[1.6px] rounded-md px-2 py-1 text-[14px] font-medium focus:outline-none uppercase transition-colors bg-input border-border text-foreground focus:border-ring\"\n                                                        />\n                                                    </div>\n                                                    <button title='close'\n                                                        onClick={() => removeSlot(day.id, slot.id)}\n                                                        className=\"p-2 transition-colors duration-300 rounded-md text-muted-foreground bg-muted hover:bg-background hover:text-foreground\"\n                                                    >\n                                                        <X strokeWidth={2} size={18} />\n                                                    </button>\n                                                </motion.div>\n                                            ))}\n                                        </AnimatePresence>\n\n                                        <motion.button\n                                            layout\n                                            transition={springConfig}\n                                            onClick={() => addSlot(day.id)}\n                                            className=\"font-sans flex items-center justify-center gap-2.5 w-full py-1.5 mt-1 border-[1.2px] rounded-md text-[14px] font-semibold transition-colors duration-300 bg-muted border-border text-muted-foreground hover:bg-background hover:text-foreground\"\n                                        >\n                                            <Plus size={16} className=\"text-muted-foreground\" />\n                                            Add More\n                                        </motion.button>\n                                    </div>\n                                </motion.div>\n                            )}\n                        </AnimatePresence>\n                    </motion.div>\n                ))}\n            </LayoutGroup>\n        </div>\n    );\n};"
    }
  ]
}
