{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "day-picker", "title": "Day Picker", "description": "A custom day picker component with smooth animations.", "dependencies": [ "motion", "@hugeicons/core-free-icons", "@hugeicons/react", "clsx", "tailwind-merge" ], "files": [ { "path": "registry/default/example/day-picker.tsx", "content": "\"use client\";\r\nimport {\r\n Tick02Icon,\r\n CodeIcon,\r\n UnfoldMoreIcon,\r\n} from \"@hugeicons/core-free-icons\";\r\nimport { HugeiconsIcon } from \"@hugeicons/react\";\r\nimport { useState } from \"react\";\r\nimport { cn } from \"@/lib/utils\";\r\nimport { AnimatePresence, motion } from \"motion/react\";\r\n\r\nconst days = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\r\ntype options = \"Daily\" | \"Weekly\" | \"Monthly\" | \"Yearly\";\r\n// Change Here\r\nconst options: options[] = [\"Daily\", \"Weekly\", \"Monthly\", \"Yearly\"];\r\n\r\nconst springTransition = {\r\n type: \"spring\",\r\n damping: 30,\r\n stiffness: 400,\r\n mass: 1,\r\n} as const;\r\n\r\nexport default function TwentyThreeFour() {\r\n const [day, setDay] = useState(1);\r\n const [option, setOption] = useState(\"Daily\");\r\n const [isOptionOpen, setisOptionOpen] = useState(false);\r\n const [isSelectorOpen, setIsSelectorOpen] = useState(true);\r\n\r\n return (\r\n
\r\n \r\n
\r\n \r\n Frequency\r\n \r\n {isOptionOpen ? (\r\n
\r\n \r\n \r\n\r\n
\r\n {options.map((op) => {\r\n return (\r\n {\r\n setOption(op);\r\n setIsSelectorOpen(true);\r\n }}\r\n className={cn(\r\n \"px-2 cursor-pointer py-1 rounded-[24px] text-muted-foreground relative transition-colors duration-300\",\r\n option === op && \"text-foreground\"\r\n )}\r\n >\r\n {option === op && (\r\n \r\n )}\r\n {op}\r\n \r\n );\r\n })}\r\n
\r\n \r\n \r\n {\r\n setisOptionOpen(false);\r\n setIsSelectorOpen(false);\r\n }}\r\n initial={{\r\n filter: \"blur(1px)\",\r\n opacity: 0.6,\r\n }}\r\n animate={{\r\n filter: \"blur(0px)\",\r\n opacity: 1,\r\n }}\r\n exit={{\r\n filter: \"blur(1px)\",\r\n opacity: 0.6,\r\n }}\r\n transition={springTransition}\r\n style={{ borderRadius: 24 }}\r\n className=\"bg-primary px-[10px] justify-center text-primary-foreground flex h-full items-center cursor-pointer\"\r\n >\r\n \r\n \r\n \r\n
\r\n ) : (\r\n setisOptionOpen(true)}\r\n className=\"rounded-full w-fit px-0 p-0 relative flex gap-0 items-center cursor-pointer\"\r\n >\r\n \r\n \r\n {option === \"Weekly\" ? option + \", \" + days[day] : option}\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n )}\r\n
\r\n \r\n {isSelectorOpen && option === \"Weekly\" && (\r\n \r\n {days.map((d, index) => {\r\n return (\r\n setDay(index)}\r\n className={cn(\r\n \"px-2 py-1 rounded-3xl relative transition-colors duration-300 cursor-pointer\",\r\n index === day\r\n ? \"text-foreground\"\r\n : \"text-muted-foreground\"\r\n )}\r\n >\r\n {d}\r\n {index === day && (\r\n \r\n )}\r\n \r\n );\r\n })}\r\n \r\n )}\r\n \r\n \r\n
\r\n );\r\n}\r\n", "type": "registry:component" } ], "type": "registry:component" }