{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "family-signin-drawer",
  "type": "registry:block",
  "title": "Family Sign In Drawer",
  "files": [
    {
      "path": "components/uui/family-signin-drawer/drawer.tsx",
      "content": "'use client';\r\n\r\nimport * as React from 'react';\r\nimport { Drawer as DrawerPrimitive } from 'vaul';\r\n\r\nexport function cn(...inputs: (string | false | undefined | null)[]) {\r\n  return inputs.filter(Boolean).join(' ');\r\n}\r\n\r\nexport const Drawer = DrawerPrimitive.Root;\r\nexport const DrawerTrigger = DrawerPrimitive.Trigger;\r\nexport const DrawerClose = DrawerPrimitive.Close;\r\nexport const DrawerTitle = DrawerPrimitive.Title;\r\nexport const DrawerDescription = DrawerPrimitive.Description;\r\n\r\nexport function DrawerContent({ className, children, ...props }: React.ComponentProps<typeof DrawerPrimitive.Content>) {\r\n  return (\r\n    <DrawerPrimitive.Portal>\r\n      <DrawerPrimitive.Overlay\r\n        className={cn(\r\n          'bg-black/80 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50',\r\n          'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\r\n        )}\r\n      />\r\n      <DrawerPrimitive.Content\r\n        className={cn(\r\n          'bg-popover fixed z-50 flex h-auto flex-col outline-none',\r\n          'data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24',\r\n          'data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-[36px]',\r\n          'data-[vaul-drawer-direction=bottom]:md:mx-auto data-[vaul-drawer-direction=bottom]:md:w-full data-[vaul-drawer-direction=bottom]:md:max-w-[361px]',\r\n          'p-0 border-0',\r\n          'overflow-hidden',\r\n          className,\r\n        )}\r\n        {...props}\r\n      >\r\n        {children}\r\n      </DrawerPrimitive.Content>\r\n    </DrawerPrimitive.Portal>\r\n  );\r\n}\r\n",
      "type": "registry:block",
      "target": "@components/uui/family-signin-drawer/drawer.tsx"
    },
    {
      "path": "components/uui/family-signin-drawer/family-signin-drawer.tsx",
      "content": "'use client';\r\n\r\nimport * as React from 'react';\r\nimport { X, ArrowLeft, Mail, KeyRound, FingerprintIcon } from 'lucide-react';\r\nimport { motion, AnimatePresence } from 'motion/react';\r\nimport { Drawer, DrawerTrigger, DrawerClose, DrawerTitle, DrawerDescription, DrawerContent } from './drawer';\r\nimport { AnimatedTabs, AnimatedTabsList, AnimatedTabsTrigger, AnimatedTabsContent, useMeasure } from './tabs';\r\n\r\nexport function SignInDrawer({ children }: { children?: React.ReactNode }) {\r\n  const [open, setOpen] = React.useState(false);\r\n  const [step, setStep] = React.useState<'default' | 'passkey'>('default');\r\n  const [ref, bounds] = useMeasure<HTMLDivElement>();\r\n\r\n  const handleSignIn = () => setStep('passkey');\r\n  const handleBack = () => setStep('default');\r\n\r\n  const handleOpenChange = (v: boolean) => {\r\n    if (!v) {\r\n      setTimeout(() => setStep('default'), 300);\r\n    }\r\n    setOpen(v);\r\n  };\r\n\r\n  return (\r\n    <div className=\"h-svh flex items-center justify-center\">\r\n      <Drawer open={open} onOpenChange={handleOpenChange}>\r\n        <DrawerTrigger asChild>\r\n          {children || (\r\n            <button\r\n              type=\"button\"\r\n              className=\"inline-flex h-9 items-center justify-center gap-1.5 rounded-md bg-secondary px-2.5 text-sm font-medium text-secondary-foreground transition-all active:scale-95\"\r\n            >\r\n              Sign In\r\n            </button>\r\n          )}\r\n        </DrawerTrigger>\r\n        <DrawerContent>\r\n          <DrawerClose className=\"bg-muted text-foreground absolute right-6 top-5 z-10 flex h-8 w-8 items-center justify-center rounded-full transition-transform active:scale-75\">\r\n            <X className=\"size-5 opacity-75\" />\r\n          </DrawerClose>\r\n\r\n          <div className=\"flex items-center justify-between px-6 py-6 text-center text-xl font-semibold tracking-tight\">\r\n            {step === 'passkey' && (\r\n              <button\r\n                onClick={handleBack}\r\n                type=\"button\"\r\n                className=\"bg-muted text-foreground absolute left-6 top-5 z-10 flex h-8 w-8 items-center justify-center rounded-full transition-transform active:scale-75\"\r\n              >\r\n                <ArrowLeft className=\"size-5\" />\r\n              </button>\r\n            )}\r\n            <span className=\"flex-1 select-none text-center\">{step === 'default' ? 'Sign In' : 'Signing in'}</span>\r\n            {step === 'passkey' && <div className=\"w-8\" />}\r\n          </div>\r\n\r\n          <DrawerTitle className=\"sr-only\">Sign In</DrawerTitle>\r\n          <DrawerDescription className=\"sr-only\">Sign in to your account</DrawerDescription>\r\n\r\n          <motion.div\r\n            animate={{\r\n              height: bounds.height > 0 ? bounds.height : step === 'default' ? 380 : 320,\r\n            }}\r\n            transition={{ type: 'spring', bounce: 0, duration: 0.4 }}\r\n            className=\"overflow-hidden will-change-transform\"\r\n          >\r\n            <div ref={ref} className=\"px-6 pb-6\">\r\n              <AnimatePresence mode=\"popLayout\" initial={false}>\r\n                {step === 'default' ? (\r\n                  <motion.div\r\n                    key=\"default\"\r\n                    initial={{ opacity: 0, scale: 0.96 }}\r\n                    animate={{ opacity: 1, scale: 1 }}\r\n                    exit={{ opacity: 0, scale: 0.96 }}\r\n                    transition={{ type: 'spring', bounce: 0, duration: 0.3 }}\r\n                  >\r\n                    <AnimatedTabs defaultValue=\"email\">\r\n                      <AnimatedTabsList>\r\n                        <AnimatedTabsTrigger value=\"email\">\r\n                          <Mail className=\"size-4 mr-1.5\" />\r\n                          Email\r\n                        </AnimatedTabsTrigger>\r\n                        <AnimatedTabsTrigger value=\"passkey\">\r\n                          <KeyRound className=\"size-4 mr-1.5\" />\r\n                          Passkey\r\n                        </AnimatedTabsTrigger>\r\n                      </AnimatedTabsList>\r\n\r\n                      <AnimatedTabsContent value=\"email\" className=\"pt-6 pb-2\">\r\n                        <div className=\"space-y-4\">\r\n                          <div className=\"space-y-2\">\r\n                            <label htmlFor=\"signin-email\" className=\"sr-only\">\r\n                              Email\r\n                            </label>\r\n                            <input\r\n                              id=\"signin-email\"\r\n                              type=\"email\"\r\n                              placeholder=\"Email\"\r\n                              className=\"bg-muted border-transparent focus-visible:border-transparent focus-visible:ring-transparent flex h-12 w-full rounded-2xl border px-4 py-1 text-base outline-none transition-colors placeholder:text-muted-foreground disabled:opacity-50 md:text-sm\"\r\n                            />\r\n                          </div>\r\n                          <div className=\"space-y-2\">\r\n                            <label htmlFor=\"signin-password\" className=\"sr-only\">\r\n                              Password\r\n                            </label>\r\n                            <input\r\n                              id=\"signin-password\"\r\n                              type=\"password\"\r\n                              placeholder=\"Password\"\r\n                              className=\"bg-muted border-transparent focus-visible:border-transparent focus-visible:ring-transparent flex h-12 w-full rounded-2xl border px-4 py-1 text-base outline-none transition-colors placeholder:text-muted-foreground disabled:opacity-50 md:text-sm\"\r\n                            />\r\n                          </div>\r\n                          <button\r\n                            type=\"button\"\r\n                            onClick={handleSignIn}\r\n                            className=\"inline-flex h-12 w-full items-center justify-center gap-1.5 rounded-2xl bg-primary px-2.5 text-base font-medium text-primary-foreground transition-all active:scale-95\"\r\n                          >\r\n                            Sign In with Email\r\n                          </button>\r\n                          <button type=\"button\" className=\"w-full text-sm text-muted-foreground hover:text-foreground transition-colors\">\r\n                            Forgot password?\r\n                          </button>\r\n                        </div>\r\n                      </AnimatedTabsContent>\r\n\r\n                      <AnimatedTabsContent value=\"passkey\" className=\"pt-6 pb-2\">\r\n                        <div className=\"space-y-4\">\r\n                          <div className=\"flex items-center justify-center h-16\">\r\n                            <div className=\"p-3 bg-muted rounded-xl\">\r\n                              <FingerprintIcon className=\"size-12\" />\r\n                            </div>\r\n                          </div>\r\n                          <p className=\"text-sm text-muted-foreground text-center\">Sign in quickly with a passkey</p>\r\n                          <button\r\n                            type=\"button\"\r\n                            onClick={handleSignIn}\r\n                            className=\"inline-flex h-12 w-full items-center justify-center gap-1.5 rounded-2xl bg-primary px-2.5 text-base font-medium text-primary-foreground transition-all active:scale-95\"\r\n                          >\r\n                            Continue with Passkey\r\n                          </button>\r\n                        </div>\r\n                      </AnimatedTabsContent>\r\n                    </AnimatedTabs>\r\n                  </motion.div>\r\n                ) : (\r\n                  <motion.div\r\n                    key=\"passkey\"\r\n                    initial={{ opacity: 0, scale: 0.96 }}\r\n                    animate={{ opacity: 1, scale: 1 }}\r\n                    exit={{ opacity: 0, scale: 0.96 }}\r\n                    transition={{ type: 'spring', bounce: 0, duration: 0.3 }}\r\n                    className=\"space-y-6\"\r\n                  >\r\n                    <div className=\"flex items-center justify-center py-8\">\r\n                      <div className=\"relative flex items-center justify-center overflow-hidden rounded-[22px] p-0.5\">\r\n                        <motion.div\r\n                          className=\"absolute left-[-50%] top-[-50%] h-[200%] w-[200%] bg-[conic-gradient(from_0deg,transparent_0%,#4DAFFE_10%,#4DAFFE_25%,transparent_35%)]\"\r\n                          animate={{ rotate: 360 }}\r\n                          transition={{\r\n                            duration: 1.25,\r\n                            repeat: Infinity,\r\n                            ease: 'linear',\r\n                            repeatType: 'loop',\r\n                          }}\r\n                        />\r\n                        <div className=\"z-1 flex items-center justify-center rounded-[20px] p-1\">\r\n                          <div className=\"flex items-center justify-center rounded-2xl bg-muted p-1\">\r\n                            <div className=\"flex size-16 items-center justify-center rounded-xl\">\r\n                              <KeyRound className=\"size-8 text-foreground\" />\r\n                            </div>\r\n                          </div>\r\n                        </div>\r\n                      </div>\r\n                    </div>\r\n                  </motion.div>\r\n                )}\r\n              </AnimatePresence>\r\n            </div>\r\n          </motion.div>\r\n        </DrawerContent>\r\n      </Drawer>\r\n    </div>\r\n  );\r\n}\r\n",
      "type": "registry:block",
      "target": "@components/uui/family-signin-drawer/family-signin-drawer.tsx"
    },
    {
      "path": "components/uui/family-signin-drawer/tabs.tsx",
      "content": "'use client';\r\n\r\nimport * as React from 'react';\r\nimport { motion, AnimatePresence } from 'motion/react';\r\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\r\nimport { cn } from './drawer';\r\n\r\nexport function useMeasure<T extends HTMLElement>() {\r\n  const [node, setNode] = React.useState<T | null>(null);\r\n  const [size, setSize] = React.useState({ width: 0, height: 0 });\r\n\r\n  const ref = React.useCallback((el: T | null) => {\r\n    setNode(el);\r\n  }, []);\r\n\r\n  React.useEffect(() => {\r\n    if (!node) return;\r\n    const update = () => {\r\n      const { width, height } = node.getBoundingClientRect();\r\n      setSize({ width, height });\r\n    };\r\n    update();\r\n    const observer = new ResizeObserver(update);\r\n    observer.observe(node);\r\n    return () => observer.disconnect();\r\n  }, [node]);\r\n\r\n  return [ref, size] as const;\r\n}\r\n\r\nexport function AnimatedTabs({ defaultValue, children }: { defaultValue?: string; children?: React.ReactNode }) {\r\n  const [ref, bounds] = useMeasure<HTMLDivElement>();\r\n  const [mounted, setMounted] = React.useState(false);\r\n\r\n  React.useEffect(() => {\r\n    setMounted(true);\r\n  }, []);\r\n\r\n  const childArray = React.Children.toArray(children);\r\n  const list = childArray.find(\r\n    c => React.isValidElement(c) && (c.type as React.ComponentType)?.displayName === 'AnimatedTabsList',\r\n  );\r\n  const panels = childArray.filter(\r\n    c => React.isValidElement(c) && (c.type as React.ComponentType)?.displayName === 'AnimatedTabsContent',\r\n  );\r\n\r\n  return (\r\n    <TabsPrimitive.Root data-slot=\"tabs\" defaultValue={defaultValue} className=\"gap-2 group/tabs flex flex-col\">\r\n      {list}\r\n      {mounted && (\r\n        <motion.div\r\n          animate={{ height: bounds.height > 0 ? bounds.height : 300 }}\r\n          transition={{ type: 'spring', bounce: 0, duration: 0.4 }}\r\n          className=\"overflow-hidden will-change-transform\"\r\n        >\r\n          <div ref={ref}>{panels}</div>\r\n        </motion.div>\r\n      )}\r\n    </TabsPrimitive.Root>\r\n  );\r\n}\r\n\r\nexport function AnimatedTabsList({ className, children, ...props }: React.ComponentProps<typeof TabsPrimitive.List>) {\r\n  return (\r\n    <TabsPrimitive.List\r\n      data-slot=\"tabs-list\"\r\n      className={cn(\r\n        'inline-flex h-12 w-full items-center justify-center rounded-2xl bg-muted p-[3px] text-muted-foreground',\r\n        className,\r\n      )}\r\n      {...props}\r\n    >\r\n      {children}\r\n    </TabsPrimitive.List>\r\n  );\r\n}\r\nAnimatedTabsList.displayName = 'AnimatedTabsList';\r\n\r\nexport function AnimatedTabsTrigger({ value, children, className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {\r\n  return (\r\n    <TabsPrimitive.Trigger\r\n      value={value}\r\n      data-slot=\"tabs-trigger\"\r\n      className={cn(\r\n        'relative z-10 inline-flex h-[calc(100%-2px)] flex-1 items-center justify-center whitespace-nowrap rounded-xl px-3 py-1.5 text-sm font-medium transition-all',\r\n        'text-muted-foreground hover:text-foreground',\r\n        'data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm',\r\n        'focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50',\r\n        className,\r\n      )}\r\n      {...props}\r\n    >\r\n      {children}\r\n    </TabsPrimitive.Trigger>\r\n  );\r\n}\r\nAnimatedTabsTrigger.displayName = 'AnimatedTabsTrigger';\r\n\r\nexport function AnimatedTabsContent({ value, children, className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>) {\r\n  return (\r\n    <TabsPrimitive.Content\r\n      value={value}\r\n      data-slot=\"tabs-content\"\r\n      className={cn('text-sm outline-none', className)}\r\n      {...props}\r\n    >\r\n      <AnimatePresence mode=\"popLayout\" initial={false}>\r\n        <motion.div\r\n          key={value}\r\n          initial={{ opacity: 0, scale: 0.96 }}\r\n          animate={{ opacity: 1, scale: 1 }}\r\n          exit={{ opacity: 0, scale: 0.96 }}\r\n          transition={{ type: 'spring', bounce: 0, duration: 0.3 }}\r\n        >\r\n          {children}\r\n        </motion.div>\r\n      </AnimatePresence>\r\n    </TabsPrimitive.Content>\r\n  );\r\n}\r\nAnimatedTabsContent.displayName = 'AnimatedTabsContent';\r\n",
      "type": "registry:block",
      "target": "@components/uui/family-signin-drawer/tabs.tsx"
    }
  ],
  "dependencies": [
    "motion"
  ]
}