@arolariu/components 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/EXAMPLES.md +1035 -1035
  2. package/changelog.md +9 -0
  3. package/dist/components/ui/accordion.js.map +1 -1
  4. package/dist/components/ui/alert-dialog.js.map +1 -1
  5. package/dist/components/ui/alert.js.map +1 -1
  6. package/dist/components/ui/aspect-ratio.js.map +1 -1
  7. package/dist/components/ui/avatar.js.map +1 -1
  8. package/dist/components/ui/background-beams.js.map +1 -1
  9. package/dist/components/ui/badge.js.map +1 -1
  10. package/dist/components/ui/breadcrumb.js.map +1 -1
  11. package/dist/components/ui/bubble-background.js.map +1 -1
  12. package/dist/components/ui/button-group.js.map +1 -1
  13. package/dist/components/ui/button.js.map +1 -1
  14. package/dist/components/ui/calendar.js.map +1 -1
  15. package/dist/components/ui/card.js.map +1 -1
  16. package/dist/components/ui/carousel.js.map +1 -1
  17. package/dist/components/ui/chart.d.ts +19 -41
  18. package/dist/components/ui/chart.d.ts.map +1 -1
  19. package/dist/components/ui/chart.js +34 -35
  20. package/dist/components/ui/chart.js.map +1 -1
  21. package/dist/components/ui/checkbox.js +2 -2
  22. package/dist/components/ui/checkbox.js.map +1 -1
  23. package/dist/components/ui/collapsible.js.map +1 -1
  24. package/dist/components/ui/command.js.map +1 -1
  25. package/dist/components/ui/context-menu.js.map +1 -1
  26. package/dist/components/ui/counting-number.js.map +1 -1
  27. package/dist/components/ui/dialog.js.map +1 -1
  28. package/dist/components/ui/dot-background.js.map +1 -1
  29. package/dist/components/ui/drawer.js.map +1 -1
  30. package/dist/components/ui/dropdown-menu.js.map +1 -1
  31. package/dist/components/ui/dropdrawer.js.map +1 -1
  32. package/dist/components/ui/empty.js.map +1 -1
  33. package/dist/components/ui/field.js +1 -1
  34. package/dist/components/ui/field.js.map +1 -1
  35. package/dist/components/ui/fireworks-background.js.map +1 -1
  36. package/dist/components/ui/flip-button.js.map +1 -1
  37. package/dist/components/ui/form.d.ts.map +1 -1
  38. package/dist/components/ui/form.js +4 -3
  39. package/dist/components/ui/form.js.map +1 -1
  40. package/dist/components/ui/gradient-background.js.map +1 -1
  41. package/dist/components/ui/gradient-text.js.map +1 -1
  42. package/dist/components/ui/highlight-text.js.map +1 -1
  43. package/dist/components/ui/hole-background.js.map +1 -1
  44. package/dist/components/ui/hover-card.js.map +1 -1
  45. package/dist/components/ui/input-group.d.ts.map +1 -1
  46. package/dist/components/ui/input-group.js.map +1 -1
  47. package/dist/components/ui/input-otp.d.ts +2 -2
  48. package/dist/components/ui/input-otp.js.map +1 -1
  49. package/dist/components/ui/input.js.map +1 -1
  50. package/dist/components/ui/item.js.map +1 -1
  51. package/dist/components/ui/kbd.js.map +1 -1
  52. package/dist/components/ui/label.js.map +1 -1
  53. package/dist/components/ui/menubar.js.map +1 -1
  54. package/dist/components/ui/navigation-menu.js.map +1 -1
  55. package/dist/components/ui/pagination.js.map +1 -1
  56. package/dist/components/ui/popover.js.map +1 -1
  57. package/dist/components/ui/progress.js.map +1 -1
  58. package/dist/components/ui/radio-group.js.map +1 -1
  59. package/dist/components/ui/resizable.js.map +1 -1
  60. package/dist/components/ui/ripple-button.js.map +1 -1
  61. package/dist/components/ui/scratcher.js.map +1 -1
  62. package/dist/components/ui/scroll-area.js.map +1 -1
  63. package/dist/components/ui/select.js.map +1 -1
  64. package/dist/components/ui/separator.js.map +1 -1
  65. package/dist/components/ui/sheet.d.ts +1 -1
  66. package/dist/components/ui/sheet.js.map +1 -1
  67. package/dist/components/ui/sidebar.d.ts.map +1 -1
  68. package/dist/components/ui/sidebar.js.map +1 -1
  69. package/dist/components/ui/skeleton.js.map +1 -1
  70. package/dist/components/ui/slider.js.map +1 -1
  71. package/dist/components/ui/sonner.js.map +1 -1
  72. package/dist/components/ui/spinner.js.map +1 -1
  73. package/dist/components/ui/switch.js.map +1 -1
  74. package/dist/components/ui/table.d.ts.map +1 -1
  75. package/dist/components/ui/table.js.map +1 -1
  76. package/dist/components/ui/tabs.js.map +1 -1
  77. package/dist/components/ui/textarea.js.map +1 -1
  78. package/dist/components/ui/toggle-group.js.map +1 -1
  79. package/dist/components/ui/toggle.js.map +1 -1
  80. package/dist/components/ui/tooltip.js.map +1 -1
  81. package/dist/components/ui/typewriter.js +6 -2
  82. package/dist/components/ui/typewriter.js.map +1 -1
  83. package/dist/hooks/useIsMobile.js.map +1 -1
  84. package/dist/hooks/useWindowSize.js.map +1 -1
  85. package/dist/index.css +56 -1804
  86. package/dist/index.css.map +1 -1
  87. package/dist/lib/utilities.js.map +1 -1
  88. package/package.json +2 -15
  89. package/src/components/ui/chart.tsx +163 -162
  90. package/src/components/ui/checkbox.tsx +2 -2
  91. package/src/components/ui/field.tsx +1 -1
  92. package/src/components/ui/form.tsx +8 -4
  93. package/src/components/ui/input-group.tsx +2 -0
  94. package/src/components/ui/sidebar.tsx +2 -0
  95. package/src/components/ui/table.tsx +2 -0
  96. package/src/components/ui/typewriter.tsx +2 -2
  97. package/src/index.css +6 -6
  98. package/dist/components/ui/field.d.ts +0 -26
  99. package/dist/components/ui/field.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"components\\ui\\dropdown-menu.js","sources":["webpack://@arolariu/components/./src/components/ui/dropdown-menu.tsx"],"sourcesContent":["\r\n\r\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\r\nimport {Check, ChevronRight, Circle} from \"lucide-react\";\r\nimport * as React from \"react\";\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\nconst DropdownMenu = DropdownMenuPrimitive.Root;\r\n\r\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\r\n\r\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\r\n\r\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\r\n\r\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\r\n\r\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\r\n\r\nconst DropdownMenuSubTrigger = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\r\n inset?: boolean;\r\n }\r\n>(({className, inset, children, ...props}, ref) => (\r\n <DropdownMenuPrimitive.SubTrigger\r\n ref={ref}\r\n className={cn(\r\n \"flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none focus:bg-neutral-100 data-[state=open]:bg-neutral-100 dark:focus:bg-neutral-800 dark:data-[state=open]:bg-neutral-800 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\r\n inset && \"pl-8\",\r\n className,\r\n )}\r\n {...props}>\r\n {children}\r\n <ChevronRight className='ml-auto' />\r\n </DropdownMenuPrimitive.SubTrigger>\r\n));\r\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\r\n\r\nconst DropdownMenuSubContent = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\r\n>(({className, ...props}, ref) => (\r\n <DropdownMenuPrimitive.SubContent\r\n ref={ref}\r\n className={cn(\r\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-[--radix-dropdown-menu-content-transform-origin] overflow-hidden rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-lg dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n));\r\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\r\n\r\nconst DropdownMenuContent = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.Content>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\r\n>(({className, sideOffset = 4, ...props}, ref) => (\r\n <DropdownMenuPrimitive.Portal>\r\n <DropdownMenuPrimitive.Content\r\n ref={ref}\r\n sideOffset={sideOffset}\r\n className={cn(\r\n \"z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-md dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-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 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n </DropdownMenuPrimitive.Portal>\r\n));\r\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\r\n\r\nconst DropdownMenuItem = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.Item>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\r\n inset?: boolean;\r\n }\r\n>(({className, inset, ...props}, ref) => (\r\n <DropdownMenuPrimitive.Item\r\n ref={ref}\r\n className={cn(\r\n \"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none select-none focus:bg-neutral-100 focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50 [&>svg]:size-4 [&>svg]:shrink-0\",\r\n inset && \"pl-8\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n));\r\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\r\n\r\nconst DropdownMenuCheckboxItem = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\r\n>(({className, children, checked, ...props}, ref) => (\r\n <DropdownMenuPrimitive.CheckboxItem\r\n ref={ref}\r\n className={cn(\r\n \"relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm transition-colors outline-none select-none focus:bg-neutral-100 focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50\",\r\n className,\r\n )}\r\n checked={checked}\r\n {...props}>\r\n <span className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>\r\n <DropdownMenuPrimitive.ItemIndicator>\r\n <Check className='h-4 w-4' />\r\n </DropdownMenuPrimitive.ItemIndicator>\r\n </span>\r\n {children}\r\n </DropdownMenuPrimitive.CheckboxItem>\r\n));\r\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\r\n\r\nconst DropdownMenuRadioItem = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\r\n>(({className, children, ...props}, ref) => (\r\n <DropdownMenuPrimitive.RadioItem\r\n ref={ref}\r\n className={cn(\r\n \"relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm transition-colors outline-none select-none focus:bg-neutral-100 focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50\",\r\n className,\r\n )}\r\n {...props}>\r\n <span className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>\r\n <DropdownMenuPrimitive.ItemIndicator>\r\n <Circle className='h-2 w-2 fill-current' />\r\n </DropdownMenuPrimitive.ItemIndicator>\r\n </span>\r\n {children}\r\n </DropdownMenuPrimitive.RadioItem>\r\n));\r\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\r\n\r\nconst DropdownMenuLabel = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.Label>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\r\n inset?: boolean;\r\n }\r\n>(({className, inset, ...props}, ref) => (\r\n <DropdownMenuPrimitive.Label\r\n ref={ref}\r\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", inset && \"pl-8\", className)}\r\n {...props}\r\n />\r\n));\r\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\r\n\r\nconst DropdownMenuSeparator = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\r\n>(({className, ...props}, ref) => (\r\n <DropdownMenuPrimitive.Separator\r\n ref={ref}\r\n className={cn(\"-mx-1 my-1 h-px bg-neutral-100 dark:bg-neutral-800\", className)}\r\n {...props}\r\n />\r\n));\r\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\r\n\r\nconst DropdownMenuShortcut = ({className, ...props}: React.HTMLAttributes<HTMLSpanElement>) => {\r\n return (\r\n <span\r\n className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)}\r\n {...props}\r\n />\r\n );\r\n};\r\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\r\n\r\nexport {\r\n DropdownMenu,\r\n DropdownMenuCheckboxItem,\r\n DropdownMenuContent,\r\n DropdownMenuGroup,\r\n DropdownMenuItem,\r\n DropdownMenuLabel,\r\n DropdownMenuPortal,\r\n DropdownMenuRadioGroup,\r\n DropdownMenuRadioItem,\r\n DropdownMenuSeparator,\r\n DropdownMenuShortcut,\r\n DropdownMenuSub,\r\n DropdownMenuSubContent,\r\n DropdownMenuSubTrigger,\r\n DropdownMenuTrigger,\r\n};\r\n"],"names":["DropdownMenu","DropdownMenuPrimitive","DropdownMenuTrigger","DropdownMenuGroup","DropdownMenuPortal","DropdownMenuSub","DropdownMenuRadioGroup","DropdownMenuSubTrigger","React","className","inset","children","props","ref","cn","ChevronRight","DropdownMenuSubContent","DropdownMenuContent","sideOffset","DropdownMenuItem","DropdownMenuCheckboxItem","checked","Check","DropdownMenuRadioItem","Circle","DropdownMenuLabel","DropdownMenuSeparator","DropdownMenuShortcut"],"mappings":";;;;;;AAQA,MAAMA,eAAeC;AAErB,MAAMC,sBAAsBD;AAE5B,MAAME,oBAAoBF;AAE1B,MAAMG,qBAAqBH;AAE3B,MAAMI,kBAAkBJ;AAExB,MAAMK,yBAAyBL;AAE/B,MAAMM,yBAAyB,WAAzBA,GAAyBC,WAK7B,CAAC,EAACC,SAAS,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGC,OAAM,EAAEC,MAAAA,WAAAA,GACzC,KAACZ,YAAgC;QAC/B,KAAKY;QACL,WAAWC,GACT,oRACAJ,SAAS,QACTD;QAED,GAAGG,KAAK;;YACRD;0BACD,IAACI,cAAYA;gBAAC,WAAU;;;;AAG5BR,uBAAuB,WAAW,GAAGN,WAAAA,WAA4C;AAEjF,MAAMe,yBAAyB,WAAzBA,GAAyBR,WAG7B,CAAC,EAACC,SAAS,EAAE,GAAGG,OAAM,EAAEC,MAAAA,WAAAA,GACxB,IAACZ,YAAgC;QAC/B,KAAKY;QACL,WAAWC,GACT,4jBACAL;QAED,GAAGG,KAAK;;AAGbI,uBAAuB,WAAW,GAAGf,WAAAA,WAA4C;AAEjF,MAAMgB,sBAAsB,WAAtBA,GAAsBT,WAG1B,CAAC,EAACC,SAAS,EAAES,aAAa,CAAC,EAAE,GAAGN,OAAM,EAAEC,MAAAA,WAAAA,GACxC,IAACZ,QAA4B;kBAC3B,kBAACA,SAA6B;YAC5B,KAAKY;YACL,YAAYK;YACZ,WAAWJ,GACT,iQACA,4YACAL;YAED,GAAGG,K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AAGba,kBAAkB,WAAW,GAAGxB,MAAAA,WAAuC;AAEvE,MAAMyB,wBAAwB,WAAxBA,GAAwBlB,WAG5B,CAAC,EAACC,SAAS,EAAE,GAAGG,OAAM,EAAEC,MAAAA,WAAAA,GACxB,IAACZ,WAA+B;QAC9B,KAAKY;QACL,WAAWC,GAAG,sDAAsDL;QACnE,GAAGG,KAAK;;AAGbc,sBAAsB,WAAW,GAAGzB,UAAAA,WAA2C;AAE/E,MAAM0B,uBAAuB,CAAC,EAAClB,SAAS,EAAE,GAAGG,OAA6C,GACjF,WAAP,GACE,IAAC;QACC,WAAWE,GAAG,8CAA8CL;QAC3D,GAAGG,KAAK;;AAIfe,qBAAqB,WAAW,GAAG"}
1
+ {"version":3,"file":"components/ui/dropdown-menu.js","sources":["../../../src/components/ui/dropdown-menu.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\r\nimport {Check, ChevronRight, Circle} from \"lucide-react\";\r\nimport * as React from \"react\";\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\nconst DropdownMenu = DropdownMenuPrimitive.Root;\r\n\r\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\r\n\r\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\r\n\r\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\r\n\r\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\r\n\r\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\r\n\r\nconst DropdownMenuSubTrigger = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.SubTrigger>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\r\n inset?: boolean;\r\n }\r\n>(({className, inset, children, ...props}, ref) => (\r\n <DropdownMenuPrimitive.SubTrigger\r\n ref={ref}\r\n className={cn(\r\n \"flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none focus:bg-neutral-100 data-[state=open]:bg-neutral-100 dark:focus:bg-neutral-800 dark:data-[state=open]:bg-neutral-800 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\r\n inset && \"pl-8\",\r\n className,\r\n )}\r\n {...props}>\r\n {children}\r\n <ChevronRight className='ml-auto' />\r\n </DropdownMenuPrimitive.SubTrigger>\r\n));\r\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\r\n\r\nconst DropdownMenuSubContent = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.SubContent>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\r\n>(({className, ...props}, ref) => (\r\n <DropdownMenuPrimitive.SubContent\r\n ref={ref}\r\n className={cn(\r\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-[--radix-dropdown-menu-content-transform-origin] overflow-hidden rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-lg dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n));\r\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\r\n\r\nconst DropdownMenuContent = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.Content>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\r\n>(({className, sideOffset = 4, ...props}, ref) => (\r\n <DropdownMenuPrimitive.Portal>\r\n <DropdownMenuPrimitive.Content\r\n ref={ref}\r\n sideOffset={sideOffset}\r\n className={cn(\r\n \"z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-x-hidden overflow-y-auto rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-md dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-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 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n </DropdownMenuPrimitive.Portal>\r\n));\r\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\r\n\r\nconst DropdownMenuItem = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.Item>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\r\n inset?: boolean;\r\n }\r\n>(({className, inset, ...props}, ref) => (\r\n <DropdownMenuPrimitive.Item\r\n ref={ref}\r\n className={cn(\r\n \"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm transition-colors outline-none select-none focus:bg-neutral-100 focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50 [&>svg]:size-4 [&>svg]:shrink-0\",\r\n inset && \"pl-8\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n));\r\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\r\n\r\nconst DropdownMenuCheckboxItem = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.CheckboxItem>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\r\n>(({className, children, checked, ...props}, ref) => (\r\n <DropdownMenuPrimitive.CheckboxItem\r\n ref={ref}\r\n className={cn(\r\n \"relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm transition-colors outline-none select-none focus:bg-neutral-100 focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50\",\r\n className,\r\n )}\r\n checked={checked}\r\n {...props}>\r\n <span className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>\r\n <DropdownMenuPrimitive.ItemIndicator>\r\n <Check className='h-4 w-4' />\r\n </DropdownMenuPrimitive.ItemIndicator>\r\n </span>\r\n {children}\r\n </DropdownMenuPrimitive.CheckboxItem>\r\n));\r\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\r\n\r\nconst DropdownMenuRadioItem = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.RadioItem>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\r\n>(({className, children, ...props}, ref) => (\r\n <DropdownMenuPrimitive.RadioItem\r\n ref={ref}\r\n className={cn(\r\n \"relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm transition-colors outline-none select-none focus:bg-neutral-100 focus:text-neutral-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-neutral-800 dark:focus:text-neutral-50\",\r\n className,\r\n )}\r\n {...props}>\r\n <span className='absolute left-2 flex h-3.5 w-3.5 items-center justify-center'>\r\n <DropdownMenuPrimitive.ItemIndicator>\r\n <Circle className='h-2 w-2 fill-current' />\r\n </DropdownMenuPrimitive.ItemIndicator>\r\n </span>\r\n {children}\r\n </DropdownMenuPrimitive.RadioItem>\r\n));\r\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\r\n\r\nconst DropdownMenuLabel = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.Label>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\r\n inset?: boolean;\r\n }\r\n>(({className, inset, ...props}, ref) => (\r\n <DropdownMenuPrimitive.Label\r\n ref={ref}\r\n className={cn(\"px-2 py-1.5 text-sm font-semibold\", inset && \"pl-8\", className)}\r\n {...props}\r\n />\r\n));\r\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\r\n\r\nconst DropdownMenuSeparator = React.forwardRef<\r\n React.ComponentRef<typeof DropdownMenuPrimitive.Separator>,\r\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\r\n>(({className, ...props}, ref) => (\r\n <DropdownMenuPrimitive.Separator\r\n ref={ref}\r\n className={cn(\"-mx-1 my-1 h-px bg-neutral-100 dark:bg-neutral-800\", className)}\r\n {...props}\r\n />\r\n));\r\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\r\n\r\nconst DropdownMenuShortcut = ({className, ...props}: React.HTMLAttributes<HTMLSpanElement>) => {\r\n return (\r\n <span\r\n className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)}\r\n {...props}\r\n />\r\n );\r\n};\r\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\r\n\r\nexport {\r\n DropdownMenu,\r\n DropdownMenuCheckboxItem,\r\n DropdownMenuContent,\r\n DropdownMenuGroup,\r\n DropdownMenuItem,\r\n DropdownMenuLabel,\r\n DropdownMenuPortal,\r\n DropdownMenuRadioGroup,\r\n DropdownMenuRadioItem,\r\n DropdownMenuSeparator,\r\n DropdownMenuShortcut,\r\n DropdownMenuSub,\r\n DropdownMenuSubContent,\r\n DropdownMenuSubTrigger,\r\n DropdownMenuTrigger,\r\n};\r\n"],"names":["DropdownMenu","DropdownMenuPrimitive","DropdownMenuTrigger","DropdownMenuGroup","DropdownMenuPortal","DropdownMenuSub","DropdownMenuRadioGroup","DropdownMenuSubTrigger","React","className","inset","children","props","ref","cn","ChevronRight","DropdownMenuSubContent","DropdownMenuContent","sideOffset","DropdownMenuItem","DropdownMenuCheckboxItem","checked","Check","DropdownMenuRadioItem","Circle","DropdownMenuLabel","DropdownMenuSeparator","Dropd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AAM0B,uBAAuB,CAAC,EAAClB,SAAS,EAAE,GAAGG,OAA6C,GACjF,WAAP,GACE,IAAC;QACC,WAAWE,GAAG,8CAA8CL;QAC3D,GAAGG,KAAK;;AAIfe,qBAAqB,WAAW,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"components\\ui\\dropdrawer.js","sources":["webpack://@arolariu/components/./src/components/ui/dropdrawer.tsx"],"sourcesContent":["\r\n\r\n/* eslint-disable */\r\n\r\nimport {ChevronLeftIcon, ChevronRightIcon} from \"lucide-react\";\r\nimport {AnimatePresence, motion, Transition} from \"motion/react\";\r\nimport * as React from \"react\";\r\n\r\nimport {Drawer, DrawerClose, DrawerContent, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger} from \"@/components/ui/drawer\";\r\nimport {\r\n DropdownMenu,\r\n DropdownMenuContent,\r\n DropdownMenuItem,\r\n DropdownMenuLabel,\r\n DropdownMenuSeparator,\r\n DropdownMenuSub,\r\n DropdownMenuSubContent,\r\n DropdownMenuSubTrigger,\r\n DropdownMenuTrigger,\r\n} from \"@/components/ui/dropdown-menu\";\r\nimport {useIsMobile} from \"@/hooks/useIsMobile\";\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\nconst DropDrawerContext = React.createContext<{isMobile: boolean}>({\r\n isMobile: false,\r\n});\r\n\r\nconst useDropDrawerContext = () => {\r\n const context = React.useContext(DropDrawerContext);\r\n if (!context) {\r\n throw new Error(\"DropDrawer components cannot be rendered outside the Context\");\r\n }\r\n return context;\r\n};\r\n\r\nfunction DropDrawer({children, ...props}: React.ComponentProps<typeof Drawer> | React.ComponentProps<typeof DropdownMenu>) {\r\n const isMobile = useIsMobile();\r\n const DropdownComponent = isMobile ? Drawer : DropdownMenu;\r\n\r\n return (\r\n <DropDrawerContext.Provider value={{isMobile}}>\r\n <DropdownComponent\r\n data-slot='drop-drawer'\r\n {...(isMobile && {autoFocus: true})}\r\n {...props}>\r\n {children}\r\n </DropdownComponent>\r\n </DropDrawerContext.Provider>\r\n );\r\n}\r\n\r\nfunction DropDrawerTrigger({\r\n className,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof DrawerTrigger> | React.ComponentProps<typeof DropdownMenuTrigger>) {\r\n const {isMobile} = useDropDrawerContext();\r\n const TriggerComponent = isMobile ? DrawerTrigger : DropdownMenuTrigger;\r\n\r\n return (\r\n <TriggerComponent\r\n data-slot='drop-drawer-trigger'\r\n className={className}\r\n {...props}>\r\n {children}\r\n </TriggerComponent>\r\n );\r\n}\r\n\r\nfunction DropDrawerContent({\r\n className,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof DrawerContent> | React.ComponentProps<typeof DropdownMenuContent>) {\r\n const {isMobile} = useDropDrawerContext();\r\n const [activeSubmenu, setActiveSubmenu] = React.useState<string | null>(null);\r\n const [submenuTitle, setSubmenuTitle] = React.useState<string | null>(null);\r\n const [submenuStack, setSubmenuStack] = React.useState<{id: string; title: string}[]>([]);\r\n // Add animation direction state\r\n const [animationDirection, setAnimationDirection] = React.useState<\"forward\" | \"backward\">(\"forward\");\r\n\r\n // Create a ref to store submenu content by ID\r\n const submenuContentRef = React.useRef<Map<string, React.ReactNode[]>>(new Map());\r\n\r\n // Function to navigate to a submenu\r\n const navigateToSubmenu = React.useCallback((id: string, title: string) => {\r\n // Set animation direction to forward when navigating to a submenu\r\n setAnimationDirection(\"forward\");\r\n setActiveSubmenu(id);\r\n setSubmenuTitle(title);\r\n setSubmenuStack((prev) => [...prev, {id, title}]);\r\n }, []);\r\n\r\n // Function to go back to previous menu\r\n const goBack = React.useCallback(() => {\r\n // Set animation direction to backward when going back\r\n setAnimationDirection(\"backward\");\r\n\r\n if (submenuStack.length <= 1) {\r\n // If we're at the first level, go back to main menu\r\n setActiveSubmenu(null);\r\n setSubmenuTitle(null);\r\n setSubmenuStack([]);\r\n } else {\r\n // Go back to previous submenu\r\n const newStack = [...submenuStack];\r\n newStack.pop(); // Remove current\r\n const previous = newStack[newStack.length - 1];\r\n setActiveSubmenu(previous.id);\r\n setSubmenuTitle(previous.title);\r\n setSubmenuStack(newStack);\r\n }\r\n }, [submenuStack]);\r\n\r\n // Function to register submenu content\r\n const registerSubmenuContent = React.useCallback((id: string, content: React.ReactNode[]) => {\r\n submenuContentRef.current.set(id, content);\r\n }, []);\r\n\r\n // Function to extract submenu content\r\n const extractSubmenuContent = React.useCallback((elements: React.ReactNode, targetId: string): React.ReactNode[] => {\r\n const result: React.ReactNode[] = [];\r\n\r\n // Recursive function to search through all children\r\n const findSubmenuContent = (node: React.ReactNode) => {\r\n // Skip if not a valid element\r\n if (!React.isValidElement(node)) return;\r\n\r\n const element = node as React.ReactElement;\r\n // Use a more specific type to avoid 'any'\r\n const props = element.props as {\r\n id?: string;\r\n \"data-submenu-id\"?: string;\r\n children?: React.ReactNode;\r\n };\r\n\r\n // Check if this is a DropDrawerSub\r\n if (element.type === DropDrawerSub) {\r\n // Get all possible ID values\r\n const elementId = props.id;\r\n const dataSubmenuId = props[\"data-submenu-id\"];\r\n\r\n // If this is the submenu we're looking for\r\n if (elementId === targetId || dataSubmenuId === targetId) {\r\n // Find the SubContent within this Sub\r\n if (props.children) {\r\n React.Children.forEach(props.children, (child) => {\r\n if (React.isValidElement(child) && child.type === DropDrawerSubContent) {\r\n // Add all children of the SubContent to the result\r\n const subContentProps = child.props as {\r\n children?: React.ReactNode;\r\n };\r\n if (subContentProps.children) {\r\n React.Children.forEach(subContentProps.children, (contentChild) => {\r\n result.push(contentChild);\r\n });\r\n }\r\n }\r\n });\r\n }\r\n return; // Found what we needed, no need to search deeper\r\n }\r\n }\r\n\r\n // If this element has children, search through them\r\n if (props.children) {\r\n if (Array.isArray(props.children)) {\r\n props.children.forEach((child: React.ReactNode) => findSubmenuContent(child));\r\n } else {\r\n findSubmenuContent(props.children);\r\n }\r\n }\r\n };\r\n\r\n // Start the search from the root elements\r\n if (Array.isArray(elements)) {\r\n elements.forEach((child) => findSubmenuContent(child));\r\n } else {\r\n findSubmenuContent(elements);\r\n }\r\n\r\n return result;\r\n }, []);\r\n\r\n // Get submenu content (either from cache or extract it)\r\n const getSubmenuContent = React.useCallback(\r\n (id: string) => {\r\n // Check if we have the content in our ref\r\n const cachedContent = submenuContentRef.current.get(id || \"\");\r\n if (cachedContent && cachedContent.length > 0) {\r\n return cachedContent;\r\n }\r\n\r\n // If not in cache, extract it\r\n const submenuContent = extractSubmenuContent(children, id);\r\n\r\n if (submenuContent.length === 0) {\r\n return [];\r\n }\r\n\r\n // Store in cache for future use\r\n if (id) {\r\n submenuContentRef.current.set(id, submenuContent);\r\n }\r\n\r\n return submenuContent;\r\n },\r\n [children, extractSubmenuContent],\r\n );\r\n\r\n // Animation variants for Framer Motion\r\n const variants = {\r\n enter: (direction: \"forward\" | \"backward\") => ({\r\n x: direction === \"forward\" ? \"100%\" : \"-100%\",\r\n opacity: 0,\r\n }),\r\n center: {\r\n x: 0,\r\n opacity: 1,\r\n },\r\n exit: (direction: \"forward\" | \"backward\") => ({\r\n x: direction === \"forward\" ? \"-100%\" : \"100%\",\r\n opacity: 0,\r\n }),\r\n };\r\n\r\n // Animation transition\r\n const transition = {\r\n duration: 0.3,\r\n ease: [0.25, 0.1, 0.25, 1.0], // cubic-bezier easing\r\n } satisfies Transition;\r\n\r\n if (isMobile) {\r\n return (\r\n <SubmenuContext.Provider\r\n value={{\r\n activeSubmenu,\r\n setActiveSubmenu: (id) => {\r\n if (id === null) {\r\n setActiveSubmenu(null);\r\n setSubmenuTitle(null);\r\n setSubmenuStack([]);\r\n }\r\n },\r\n submenuTitle,\r\n setSubmenuTitle,\r\n navigateToSubmenu,\r\n registerSubmenuContent,\r\n }}>\r\n <DrawerContent\r\n data-slot='drop-drawer-content'\r\n className={cn(\"max-h-[90vh]\", className)}\r\n {...props}>\r\n {activeSubmenu ? (\r\n <>\r\n <DrawerHeader>\r\n <div className='flex items-center gap-2'>\r\n <button\r\n onClick={goBack}\r\n className='rounded-full p-1 hover:bg-neutral-100/50 dark:hover:bg-neutral-800/50'>\r\n <ChevronLeftIcon className='h-5 w-5' />\r\n </button>\r\n <DrawerTitle>{submenuTitle || \"Submenu\"}</DrawerTitle>\r\n </div>\r\n </DrawerHeader>\r\n <div className='relative max-h-[70vh] flex-1 overflow-y-auto'>\r\n {/* Use AnimatePresence to handle exit animations */}\r\n <AnimatePresence\r\n initial={false}\r\n mode='wait'\r\n custom={animationDirection}>\r\n <motion.div\r\n key={activeSubmenu || \"main\"}\r\n custom={animationDirection}\r\n variants={variants}\r\n initial='enter'\r\n animate='center'\r\n exit='exit'\r\n transition={transition}\r\n className='h-full w-full space-y-1.5 pb-6'>\r\n {activeSubmenu ? getSubmenuContent(activeSubmenu) : children}\r\n </motion.div>\r\n </AnimatePresence>\r\n </div>\r\n </>\r\n ) : (\r\n <>\r\n <DrawerHeader className='sr-only'>\r\n <DrawerTitle>Menu</DrawerTitle>\r\n </DrawerHeader>\r\n <div className='max-h-[70vh] overflow-y-auto'>\r\n <AnimatePresence\r\n initial={false}\r\n mode='wait'\r\n custom={animationDirection}>\r\n <motion.div\r\n key='main-menu'\r\n custom={animationDirection}\r\n variants={variants}\r\n initial='enter'\r\n animate='center'\r\n exit='exit'\r\n transition={transition}\r\n className='w-full space-y-1.5 pb-6'>\r\n {children}\r\n </motion.div>\r\n </AnimatePresence>\r\n </div>\r\n </>\r\n )}\r\n </DrawerContent>\r\n </SubmenuContext.Provider>\r\n );\r\n }\r\n\r\n return (\r\n <SubmenuContext.Provider\r\n value={{\r\n activeSubmenu,\r\n setActiveSubmenu,\r\n submenuTitle,\r\n setSubmenuTitle,\r\n registerSubmenuContent,\r\n }}>\r\n <DropdownMenuContent\r\n data-slot='drop-drawer-content'\r\n align='end'\r\n sideOffset={4}\r\n className={cn(\"max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[220px] overflow-y-auto\", className)}\r\n {...props}>\r\n {children}\r\n </DropdownMenuContent>\r\n </SubmenuContext.Provider>\r\n );\r\n}\r\n\r\nfunction DropDrawerItem({\r\n className,\r\n children,\r\n onSelect,\r\n onClick,\r\n icon,\r\n inset,\r\n disabled,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuItem> & {\r\n icon?: React.ReactNode;\r\n}) {\r\n const {isMobile} = useDropDrawerContext();\r\n\r\n // Define hooks outside of conditionals to follow React rules\r\n // Check if this item is inside a group by looking at parent elements\r\n const isInGroup = React.useCallback((element: HTMLElement | null): boolean => {\r\n if (!element) return false;\r\n\r\n // Check if any parent has a data-drop-drawer-group attribute\r\n let parent = element.parentElement;\r\n while (parent) {\r\n if (parent.hasAttribute(\"data-drop-drawer-group\")) {\r\n return true;\r\n }\r\n parent = parent.parentElement;\r\n }\r\n return false;\r\n }, []);\r\n\r\n // Create a ref to check if the item is in a group\r\n const itemRef = React.useRef<HTMLDivElement>(null);\r\n const [isInsideGroup, setIsInsideGroup] = React.useState(false);\r\n\r\n React.useEffect(() => {\r\n // Only run this effect in mobile mode\r\n if (!isMobile) return;\r\n\r\n // Use a short timeout to ensure the DOM is fully rendered\r\n const timer = setTimeout(() => {\r\n if (itemRef.current) {\r\n setIsInsideGroup(isInGroup(itemRef.current));\r\n }\r\n }, 0);\r\n\r\n return () => clearTimeout(timer);\r\n }, [isInGroup, isMobile]);\r\n\r\n if (isMobile) {\r\n const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {\r\n if (disabled) return;\r\n if (onClick) onClick(e);\r\n if (onSelect) onSelect(e as unknown as Event);\r\n };\r\n\r\n // Only wrap in DrawerClose if it's not a submenu item\r\n const content = (\r\n <div\r\n ref={itemRef}\r\n data-slot='drop-drawer-item'\r\n data-inset={inset}\r\n data-disabled={disabled}\r\n className={cn(\r\n \"flex cursor-pointer items-center justify-between px-4 py-4\",\r\n // Only apply margin, background and rounded corners if not in a group\r\n !isInsideGroup && \"mx-2 my-1.5 rounded-md bg-neutral-100 dark:bg-neutral-100 dark:bg-neutral-800 dark:dark:bg-neutral-800\",\r\n // For items in a group, don't add background but add more padding\r\n isInsideGroup && \"bg-transparent py-4\",\r\n inset && \"pl-8\",\r\n disabled && \"pointer-events-none opacity-50\",\r\n className,\r\n )}\r\n onClick={handleClick}\r\n aria-disabled={disabled}\r\n {...props}>\r\n <div className='flex items-center gap-2'>{children}</div>\r\n {icon && <div className='flex-shrink-0'>{icon}</div>}\r\n </div>\r\n );\r\n\r\n // Check if this is inside a submenu\r\n const isInSubmenu =\r\n (props as Record<string, unknown>)[\"data-parent-submenu-id\"] || (props as Record<string, unknown>)[\"data-parent-submenu\"];\r\n\r\n if (isInSubmenu) {\r\n return content;\r\n }\r\n\r\n return <DrawerClose asChild>{content}</DrawerClose>;\r\n }\r\n\r\n return (\r\n <DropdownMenuItem\r\n data-slot='drop-drawer-item'\r\n data-inset={inset}\r\n className={className}\r\n onSelect={onSelect}\r\n onClick={onClick as React.MouseEventHandler<HTMLDivElement>}\r\n inset={inset}\r\n disabled={disabled}\r\n {...props}>\r\n <div className='flex w-full items-center justify-between'>\r\n <div>{children}</div>\r\n {icon && <div>{icon}</div>}\r\n </div>\r\n </DropdownMenuItem>\r\n );\r\n}\r\n\r\nfunction DropDrawerSeparator({className, ...props}: React.ComponentProps<typeof DropdownMenuSeparator>) {\r\n const {isMobile} = useDropDrawerContext();\r\n\r\n // For mobile, render a simple divider\r\n if (isMobile) {\r\n return null;\r\n }\r\n\r\n // For desktop, use the standard dropdown separator\r\n return (\r\n <DropdownMenuSeparator\r\n data-slot='drop-drawer-separator'\r\n className={className}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DropDrawerLabel({\r\n className,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuLabel> | React.ComponentProps<typeof DrawerTitle>) {\r\n const {isMobile} = useDropDrawerContext();\r\n\r\n if (isMobile) {\r\n return (\r\n <DrawerHeader className='p-0'>\r\n <DrawerTitle\r\n data-slot='drop-drawer-label'\r\n className={cn(\"px-4 py-2 text-sm font-medium text-neutral-500 dark:text-neutral-400\", className)}\r\n {...props}>\r\n {children}\r\n </DrawerTitle>\r\n </DrawerHeader>\r\n );\r\n }\r\n\r\n return (\r\n <DropdownMenuLabel\r\n data-slot='drop-drawer-label'\r\n className={className}\r\n {...props}>\r\n {children}\r\n </DropdownMenuLabel>\r\n );\r\n}\r\n\r\nfunction DropDrawerFooter({className, children, ...props}: React.ComponentProps<typeof DrawerFooter> | React.ComponentProps<\"div\">) {\r\n const {isMobile} = useDropDrawerContext();\r\n\r\n if (isMobile) {\r\n return (\r\n <DrawerFooter\r\n data-slot='drop-drawer-footer'\r\n className={cn(\"p-4\", className)}\r\n {...props}>\r\n {children}\r\n </DrawerFooter>\r\n );\r\n }\r\n\r\n // No direct equivalent in DropdownMenu, so we'll just render a div\r\n return (\r\n <div\r\n data-slot='drop-drawer-footer'\r\n className={cn(\"p-2\", className)}\r\n {...props}>\r\n {children}\r\n </div>\r\n );\r\n}\r\n\r\nfunction DropDrawerGroup({\r\n className,\r\n children,\r\n ...props\r\n}: React.ComponentProps<\"div\"> & {\r\n children: React.ReactNode;\r\n}) {\r\n const {isMobile} = useDropDrawerContext();\r\n\r\n // Add separators between children on mobile\r\n const childrenWithSeparators = React.useMemo(() => {\r\n if (!isMobile) return children;\r\n\r\n const childArray = React.Children.toArray(children);\r\n\r\n // Filter out any existing separators\r\n const filteredChildren = childArray.filter((child) => React.isValidElement(child) && child.type !== DropDrawerSeparator);\r\n\r\n // Add separators between items\r\n return filteredChildren.flatMap((child, index) => {\r\n if (index === filteredChildren.length - 1) return [child];\r\n return [\r\n child,\r\n <div\r\n key={`separator-${index}`}\r\n className='h-px bg-neutral-200 dark:bg-neutral-800'\r\n aria-hidden='true'\r\n />,\r\n ];\r\n });\r\n }, [children, isMobile]);\r\n\r\n if (isMobile) {\r\n return (\r\n <div\r\n data-drop-drawer-group\r\n data-slot='drop-drawer-group'\r\n role='group'\r\n className={cn(\r\n \"mx-2 my-3 overflow-hidden rounded-xl bg-neutral-100 dark:bg-neutral-100 dark:bg-neutral-800 dark:dark:bg-neutral-800\",\r\n className,\r\n )}\r\n {...props}>\r\n {childrenWithSeparators}\r\n </div>\r\n );\r\n }\r\n\r\n // On desktop, use a div with proper role and attributes\r\n return (\r\n <div\r\n data-drop-drawer-group\r\n data-slot='drop-drawer-group'\r\n role='group'\r\n className={className}\r\n {...props}>\r\n {children}\r\n </div>\r\n );\r\n}\r\n\r\n// Context for managing submenu state on mobile\r\ninterface SubmenuContextType {\r\n activeSubmenu: string | null;\r\n setActiveSubmenu: (id: string | null) => void;\r\n submenuTitle: string | null;\r\n setSubmenuTitle: (title: string | null) => void;\r\n navigateToSubmenu?: (id: string, title: string) => void;\r\n registerSubmenuContent?: (id: string, content: React.ReactNode[]) => void;\r\n}\r\n\r\nconst SubmenuContext = React.createContext<SubmenuContextType>({\r\n activeSubmenu: null,\r\n setActiveSubmenu: () => {},\r\n submenuTitle: null,\r\n setSubmenuTitle: () => {},\r\n navigateToSubmenu: undefined,\r\n registerSubmenuContent: undefined,\r\n});\r\n\r\n// Submenu components\r\n// Counter for generating simple numeric IDs\r\nlet submenuIdCounter = 0;\r\n\r\nfunction DropDrawerSub({\r\n children,\r\n id,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuSub> & {\r\n id?: string;\r\n}) {\r\n const {isMobile} = useDropDrawerContext();\r\n const {registerSubmenuContent} = React.useContext(SubmenuContext);\r\n\r\n // Generate a simple numeric ID instead of using React.useId()\r\n const [generatedId] = React.useState(() => `submenu-${submenuIdCounter++}`);\r\n const submenuId = id || generatedId;\r\n\r\n // Extract submenu content to register with parent\r\n React.useEffect(() => {\r\n if (!registerSubmenuContent) return;\r\n\r\n // Find the SubContent within this Sub\r\n const contentItems: React.ReactNode[] = [];\r\n React.Children.forEach(children, (child) => {\r\n if (React.isValidElement(child) && child.type === DropDrawerSubContent) {\r\n // Add all children of the SubContent to the result\r\n React.Children.forEach((child.props as {children?: React.ReactNode}).children, (contentChild) => {\r\n contentItems.push(contentChild);\r\n });\r\n }\r\n });\r\n\r\n // Register the content with the parent\r\n if (contentItems.length > 0) {\r\n registerSubmenuContent(submenuId, contentItems);\r\n }\r\n }, [children, registerSubmenuContent, submenuId]);\r\n\r\n if (isMobile) {\r\n // For mobile, we'll use the context to manage submenu state\r\n // Process children to pass the submenu ID to the trigger and content\r\n const processedChildren = React.Children.map(children, (child) => {\r\n if (!React.isValidElement(child)) return child;\r\n\r\n if (child.type === DropDrawerSubTrigger) {\r\n return React.cloneElement(\r\n child as React.ReactElement,\r\n {\r\n ...(child.props as object),\r\n \"data-parent-submenu-id\": submenuId,\r\n \"data-submenu-id\": submenuId,\r\n // Use only data attributes, not custom props\r\n \"data-parent-submenu\": submenuId,\r\n } as React.HTMLAttributes<HTMLElement>,\r\n );\r\n }\r\n\r\n if (child.type === DropDrawerSubContent) {\r\n return React.cloneElement(\r\n child as React.ReactElement,\r\n {\r\n ...(child.props as object),\r\n \"data-parent-submenu-id\": submenuId,\r\n \"data-submenu-id\": submenuId,\r\n // Use only data attributes, not custom props\r\n \"data-parent-submenu\": submenuId,\r\n } as React.HTMLAttributes<HTMLElement>,\r\n );\r\n }\r\n\r\n return child;\r\n });\r\n\r\n return (\r\n <div\r\n data-slot='drop-drawer-sub'\r\n data-submenu-id={submenuId}\r\n id={submenuId}>\r\n {processedChildren}\r\n </div>\r\n );\r\n }\r\n\r\n // For desktop, pass the generated ID to the DropdownMenuSub\r\n return (\r\n <DropdownMenuSub\r\n data-slot='drop-drawer-sub'\r\n data-submenu-id={submenuId}\r\n // Don't pass id to DropdownMenuSub as it doesn't accept this prop\r\n {...props}>\r\n {children}\r\n </DropdownMenuSub>\r\n );\r\n}\r\n\r\nfunction DropDrawerSubTrigger({\r\n className,\r\n inset,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuSubTrigger> & {\r\n icon?: React.ReactNode;\r\n}) {\r\n const {isMobile} = useDropDrawerContext();\r\n const {navigateToSubmenu} = React.useContext(SubmenuContext);\r\n\r\n // Define hooks outside of conditionals to follow React rules\r\n // Check if this item is inside a group by looking at parent elements\r\n const isInGroup = React.useCallback((element: HTMLElement | null): boolean => {\r\n if (!element) return false;\r\n\r\n // Check if any parent has a data-drop-drawer-group attribute\r\n let parent = element.parentElement;\r\n while (parent) {\r\n if (parent.hasAttribute(\"data-drop-drawer-group\")) {\r\n return true;\r\n }\r\n parent = parent.parentElement;\r\n }\r\n return false;\r\n }, []);\r\n\r\n // Create a ref to check if the item is in a group\r\n const itemRef = React.useRef<HTMLDivElement>(null);\r\n const [isInsideGroup, setIsInsideGroup] = React.useState(false);\r\n\r\n React.useEffect(() => {\r\n // Only run this effect in mobile mode\r\n if (!isMobile) return;\r\n\r\n // Use a short timeout to ensure the DOM is fully rendered\r\n const timer = setTimeout(() => {\r\n if (itemRef.current) {\r\n setIsInsideGroup(isInGroup(itemRef.current));\r\n }\r\n }, 0);\r\n\r\n return () => clearTimeout(timer);\r\n }, [isInGroup, isMobile]);\r\n\r\n if (isMobile) {\r\n // Find the parent submenu ID\r\n const handleClick = (e: React.MouseEvent) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n // Get the closest parent with data-submenu-id attribute\r\n const element = e.currentTarget as HTMLElement;\r\n let submenuId: string | null = null;\r\n\r\n // First check if the element itself has the data attribute\r\n if (element.closest(\"[data-submenu-id]\")) {\r\n const closestElement = element.closest(\"[data-submenu-id]\");\r\n const id = closestElement?.getAttribute(\"data-submenu-id\");\r\n if (id) {\r\n submenuId = id;\r\n }\r\n }\r\n\r\n // If not found, try props\r\n if (!submenuId) {\r\n submenuId =\r\n ((props as Record<string, unknown>)[\"data-parent-submenu-id\"] as string)\r\n || ((props as Record<string, unknown>)[\"data-parent-submenu\"] as string);\r\n }\r\n\r\n if (!submenuId) {\r\n return;\r\n }\r\n\r\n // Get the title\r\n const title = typeof children === \"string\" ? children : \"Submenu\";\r\n\r\n // Navigate to the submenu\r\n if (navigateToSubmenu) {\r\n navigateToSubmenu(submenuId, title);\r\n }\r\n };\r\n\r\n // Combine onClick handlers\r\n const combinedOnClick = (e: React.MouseEvent) => {\r\n // Call the original onClick if provided\r\n const typedProps = props as Record<string, unknown>;\r\n if (typedProps[\"onClick\"]) {\r\n const originalOnClick = typedProps[\"onClick\"] as React.MouseEventHandler<HTMLDivElement>;\r\n originalOnClick(e as React.MouseEvent<HTMLDivElement>);\r\n }\r\n\r\n // Call our navigation handler\r\n handleClick(e);\r\n };\r\n\r\n // Remove onClick from props to avoid duplicate handlers\r\n const {...restProps} = props as Record<string, unknown>;\r\n\r\n // Don't wrap in DrawerClose for submenu triggers\r\n return (\r\n <div\r\n ref={itemRef}\r\n data-slot='drop-drawer-sub-trigger'\r\n data-inset={inset}\r\n className={cn(\r\n \"flex cursor-pointer items-center justify-between px-4 py-4\",\r\n // Only apply margin, background and rounded corners if not in a group\r\n !isInsideGroup && \"mx-2 my-1.5 rounded-md bg-neutral-100 dark:bg-neutral-100 dark:bg-neutral-800 dark:dark:bg-neutral-800\",\r\n // For items in a group, don't add background but add more padding\r\n isInsideGroup && \"bg-transparent py-4\",\r\n inset && \"pl-8\",\r\n className,\r\n )}\r\n onClick={combinedOnClick}\r\n {...restProps}>\r\n <div className='flex items-center gap-2'>{children}</div>\r\n <ChevronRightIcon className='h-5 w-5' />\r\n </div>\r\n );\r\n }\r\n\r\n return (\r\n <DropdownMenuSubTrigger\r\n data-slot='drop-drawer-sub-trigger'\r\n data-inset={inset}\r\n className={className}\r\n inset={inset}\r\n {...props}>\r\n {children}\r\n </DropdownMenuSubTrigger>\r\n );\r\n}\r\n\r\nfunction DropDrawerSubContent({className, sideOffset = 4, children, ...props}: React.ComponentProps<typeof DropdownMenuSubContent>) {\r\n const {isMobile} = useDropDrawerContext();\r\n\r\n if (isMobile) {\r\n // For mobile, we don't render the content directly\r\n // It will be rendered by the DropDrawerContent component when active\r\n return null;\r\n }\r\n\r\n return (\r\n <DropdownMenuSubContent\r\n data-slot='drop-drawer-sub-content'\r\n sideOffset={sideOffset}\r\n className={cn(\r\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border border-neutral-200 p-1 shadow-lg dark:border-neutral-800\",\r\n className,\r\n )}\r\n {...props}>\r\n {children}\r\n </DropdownMenuSubContent>\r\n );\r\n}\r\n\r\nexport {\r\n DropDrawer,\r\n DropDrawerContent,\r\n DropDrawerFooter,\r\n DropDrawerGroup,\r\n DropDrawerItem,\r\n DropDrawerLabel,\r\n DropDrawerSeparator,\r\n DropDrawerSub,\r\n DropDrawerSubContent,\r\n DropDrawerSubTrigger,\r\n DropDrawerTrigger,\r\n};\r\n"],"names":["DropDrawerContext","React","useDropDrawerContext","context","Error","DropDrawer","children","props","isMobile","useIsMobile","DropdownComponent","Drawer","DropdownMenu","DropDrawerTrigger","className","TriggerComponent","DrawerTrigger","DropdownMenuTrigger","DropDrawerContent","activeSubmenu","setActiveSubmenu","submenuTitle","setSubmenuTitle","submenuStack","setSubmenuStack","animationDirection","setAnimationDirection","submenuContentRef","Map","navigateToSubmenu","id","title","prev","goBack","newStack","previous","registerSubmenuContent","content","extractSubmenuContent","elements","targetId","result","findSubmenuContent","node","element","DropDrawerSub","elementId","dataSubmenuId","child","DropDrawerSubContent","subContentProps","contentChild","Array","getSubmenuContent","cachedContent","submenuContent","variants","direction","transition","SubmenuContext","DrawerContent","cn","DrawerHeader","ChevronLeftIcon","DrawerTitle","AnimatePresence","motion","DropdownMenuContent","DropDrawerItem","onSelect","onClick","icon","inset","disabled","isInGroup","parent","itemRef","isInsideGroup","setIsInsideGroup","timer","setTimeout","clearTimeout","handleClick","e","isInSubmenu","DrawerClose","DropdownMenuItem","DropDrawerSeparator","DropdownMenuSeparator","DropDrawerLabel","DropdownMenuLabel","DropDrawerFooter","DrawerFooter","DropDrawerGroup","childrenWithSeparators","childArray","filteredChildren","index","undefined","submenuIdCounter","generatedId","submenuId","contentItems","processedChildren","DropDrawerSubTrigger","DropdownMenuSub","closestElement","combinedOnClick","typedProps","originalOnClick","restProps","ChevronRightIcon","DropdownMenuSubTrigger","sideOffset","DropdownMenuSubContent"],"mappings":";;;;;;;;;AAuBA,MAAMA,oBAAo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F;YACR,GAAGG,SAAS;;8BACb,IAAC;oBAAI,WAAU;8BAA2BxG;;8BAC1C,IAACyG,kBAAgBA;oBAAC,WAAU;;;;IAGlC;IAEA,OAAO,WAAP,GACE,IAACC,wBAAsBA;QACrB,aAAU;QACV,cAAYxC;QACZ,WAAW1D;QACX,OAAO0D;QACN,GAAGjE,KAAK;kBACRD;;AAGP;AAEA,SAAS2C,qBAAqB,EAACnC,SAAS,EAAEmG,aAAa,CAAC,EAAE3G,QAAQ,EAAE,GAAGC,OAA2D;IAChI,MAAM,EAACC,QAAQ,EAAC,GAAGN;IAEnB,IAAIM,UAGF,OAAO;IAGT,OAAO,WAAP,GACE,IAAC0G,wBAAsBA;QACrB,aAAU;QACV,YAAYD;QACZ,WAAWpD,GACT,gHACA/C;QAED,GAAGP,KAAK;kBACRD;;AAGP"}
1
+ {"version":3,"file":"components/ui/dropdrawer.js","sources":["../../../src/components/ui/dropdrawer.tsx"],"sourcesContent":["\"use client\";\r\n\r\n/* eslint-disable */\r\n\r\nimport {ChevronLeftIcon, ChevronRightIcon} from \"lucide-react\";\r\nimport {AnimatePresence, motion, Transition} from \"motion/react\";\r\nimport * as React from \"react\";\r\n\r\nimport {Drawer, DrawerClose, DrawerContent, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger} from \"@/components/ui/drawer\";\r\nimport {\r\n DropdownMenu,\r\n DropdownMenuContent,\r\n DropdownMenuItem,\r\n DropdownMenuLabel,\r\n DropdownMenuSeparator,\r\n DropdownMenuSub,\r\n DropdownMenuSubContent,\r\n DropdownMenuSubTrigger,\r\n DropdownMenuTrigger,\r\n} from \"@/components/ui/dropdown-menu\";\r\nimport {useIsMobile} from \"@/hooks/useIsMobile\";\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\nconst DropDrawerContext = React.createContext<{isMobile: boolean}>({\r\n isMobile: false,\r\n});\r\n\r\nconst useDropDrawerContext = () => {\r\n const context = React.useContext(DropDrawerContext);\r\n if (!context) {\r\n throw new Error(\"DropDrawer components cannot be rendered outside the Context\");\r\n }\r\n return context;\r\n};\r\n\r\nfunction DropDrawer({children, ...props}: React.ComponentProps<typeof Drawer> | React.ComponentProps<typeof DropdownMenu>) {\r\n const isMobile = useIsMobile();\r\n const DropdownComponent = isMobile ? Drawer : DropdownMenu;\r\n\r\n return (\r\n <DropDrawerContext.Provider value={{isMobile}}>\r\n <DropdownComponent\r\n data-slot='drop-drawer'\r\n {...(isMobile && {autoFocus: true})}\r\n {...props}>\r\n {children}\r\n </DropdownComponent>\r\n </DropDrawerContext.Provider>\r\n );\r\n}\r\n\r\nfunction DropDrawerTrigger({\r\n className,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof DrawerTrigger> | React.ComponentProps<typeof DropdownMenuTrigger>) {\r\n const {isMobile} = useDropDrawerContext();\r\n const TriggerComponent = isMobile ? DrawerTrigger : DropdownMenuTrigger;\r\n\r\n return (\r\n <TriggerComponent\r\n data-slot='drop-drawer-trigger'\r\n className={className}\r\n {...props}>\r\n {children}\r\n </TriggerComponent>\r\n );\r\n}\r\n\r\nfunction DropDrawerContent({\r\n className,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof DrawerContent> | React.ComponentProps<typeof DropdownMenuContent>) {\r\n const {isMobile} = useDropDrawerContext();\r\n const [activeSubmenu, setActiveSubmenu] = React.useState<string | null>(null);\r\n const [submenuTitle, setSubmenuTitle] = React.useState<string | null>(null);\r\n const [submenuStack, setSubmenuStack] = React.useState<{id: string; title: string}[]>([]);\r\n // Add animation direction state\r\n const [animationDirection, setAnimationDirection] = React.useState<\"forward\" | \"backward\">(\"forward\");\r\n\r\n // Create a ref to store submenu content by ID\r\n const submenuContentRef = React.useRef<Map<string, React.ReactNode[]>>(new Map());\r\n\r\n // Function to navigate to a submenu\r\n const navigateToSubmenu = React.useCallback((id: string, title: string) => {\r\n // Set animation direction to forward when navigating to a submenu\r\n setAnimationDirection(\"forward\");\r\n setActiveSubmenu(id);\r\n setSubmenuTitle(title);\r\n setSubmenuStack((prev) => [...prev, {id, title}]);\r\n }, []);\r\n\r\n // Function to go back to previous menu\r\n const goBack = React.useCallback(() => {\r\n // Set animation direction to backward when going back\r\n setAnimationDirection(\"backward\");\r\n\r\n if (submenuStack.length <= 1) {\r\n // If we're at the first level, go back to main menu\r\n setActiveSubmenu(null);\r\n setSubmenuTitle(null);\r\n setSubmenuStack([]);\r\n } else {\r\n // Go back to previous submenu\r\n const newStack = [...submenuStack];\r\n newStack.pop(); // Remove current\r\n const previous = newStack[newStack.length - 1];\r\n setActiveSubmenu(previous.id);\r\n setSubmenuTitle(previous.title);\r\n setSubmenuStack(newStack);\r\n }\r\n }, [submenuStack]);\r\n\r\n // Function to register submenu content\r\n const registerSubmenuContent = React.useCallback((id: string, content: React.ReactNode[]) => {\r\n submenuContentRef.current.set(id, content);\r\n }, []);\r\n\r\n // Function to extract submenu content\r\n const extractSubmenuContent = React.useCallback((elements: React.ReactNode, targetId: string): React.ReactNode[] => {\r\n const result: React.ReactNode[] = [];\r\n\r\n // Recursive function to search through all children\r\n const findSubmenuContent = (node: React.ReactNode) => {\r\n // Skip if not a valid element\r\n if (!React.isValidElement(node)) return;\r\n\r\n const element = node as React.ReactElement;\r\n // Use a more specific type to avoid 'any'\r\n const props = element.props as {\r\n id?: string;\r\n \"data-submenu-id\"?: string;\r\n children?: React.ReactNode;\r\n };\r\n\r\n // Check if this is a DropDrawerSub\r\n if (element.type === DropDrawerSub) {\r\n // Get all possible ID values\r\n const elementId = props.id;\r\n const dataSubmenuId = props[\"data-submenu-id\"];\r\n\r\n // If this is the submenu we're looking for\r\n if (elementId === targetId || dataSubmenuId === targetId) {\r\n // Find the SubContent within this Sub\r\n if (props.children) {\r\n React.Children.forEach(props.children, (child) => {\r\n if (React.isValidElement(child) && child.type === DropDrawerSubContent) {\r\n // Add all children of the SubContent to the result\r\n const subContentProps = child.props as {\r\n children?: React.ReactNode;\r\n };\r\n if (subContentProps.children) {\r\n React.Children.forEach(subContentProps.children, (contentChild) => {\r\n result.push(contentChild);\r\n });\r\n }\r\n }\r\n });\r\n }\r\n return; // Found what we needed, no need to search deeper\r\n }\r\n }\r\n\r\n // If this element has children, search through them\r\n if (props.children) {\r\n if (Array.isArray(props.children)) {\r\n props.children.forEach((child: React.ReactNode) => findSubmenuContent(child));\r\n } else {\r\n findSubmenuContent(props.children);\r\n }\r\n }\r\n };\r\n\r\n // Start the search from the root elements\r\n if (Array.isArray(elements)) {\r\n elements.forEach((child) => findSubmenuContent(child));\r\n } else {\r\n findSubmenuContent(elements);\r\n }\r\n\r\n return result;\r\n }, []);\r\n\r\n // Get submenu content (either from cache or extract it)\r\n const getSubmenuContent = React.useCallback(\r\n (id: string) => {\r\n // Check if we have the content in our ref\r\n const cachedContent = submenuContentRef.current.get(id || \"\");\r\n if (cachedContent && cachedContent.length > 0) {\r\n return cachedContent;\r\n }\r\n\r\n // If not in cache, extract it\r\n const submenuContent = extractSubmenuContent(children, id);\r\n\r\n if (submenuContent.length === 0) {\r\n return [];\r\n }\r\n\r\n // Store in cache for future use\r\n if (id) {\r\n submenuContentRef.current.set(id, submenuContent);\r\n }\r\n\r\n return submenuContent;\r\n },\r\n [children, extractSubmenuContent],\r\n );\r\n\r\n // Animation variants for Framer Motion\r\n const variants = {\r\n enter: (direction: \"forward\" | \"backward\") => ({\r\n x: direction === \"forward\" ? \"100%\" : \"-100%\",\r\n opacity: 0,\r\n }),\r\n center: {\r\n x: 0,\r\n opacity: 1,\r\n },\r\n exit: (direction: \"forward\" | \"backward\") => ({\r\n x: direction === \"forward\" ? \"-100%\" : \"100%\",\r\n opacity: 0,\r\n }),\r\n };\r\n\r\n // Animation transition\r\n const transition = {\r\n duration: 0.3,\r\n ease: [0.25, 0.1, 0.25, 1.0], // cubic-bezier easing\r\n } satisfies Transition;\r\n\r\n if (isMobile) {\r\n return (\r\n <SubmenuContext.Provider\r\n value={{\r\n activeSubmenu,\r\n setActiveSubmenu: (id) => {\r\n if (id === null) {\r\n setActiveSubmenu(null);\r\n setSubmenuTitle(null);\r\n setSubmenuStack([]);\r\n }\r\n },\r\n submenuTitle,\r\n setSubmenuTitle,\r\n navigateToSubmenu,\r\n registerSubmenuContent,\r\n }}>\r\n <DrawerContent\r\n data-slot='drop-drawer-content'\r\n className={cn(\"max-h-[90vh]\", className)}\r\n {...props}>\r\n {activeSubmenu ? (\r\n <>\r\n <DrawerHeader>\r\n <div className='flex items-center gap-2'>\r\n <button\r\n onClick={goBack}\r\n className='rounded-full p-1 hover:bg-neutral-100/50 dark:hover:bg-neutral-800/50'>\r\n <ChevronLeftIcon className='h-5 w-5' />\r\n </button>\r\n <DrawerTitle>{submenuTitle || \"Submenu\"}</DrawerTitle>\r\n </div>\r\n </DrawerHeader>\r\n <div className='relative max-h-[70vh] flex-1 overflow-y-auto'>\r\n {/* Use AnimatePresence to handle exit animations */}\r\n <AnimatePresence\r\n initial={false}\r\n mode='wait'\r\n custom={animationDirection}>\r\n <motion.div\r\n key={activeSubmenu || \"main\"}\r\n custom={animationDirection}\r\n variants={variants}\r\n initial='enter'\r\n animate='center'\r\n exit='exit'\r\n transition={transition}\r\n className='h-full w-full space-y-1.5 pb-6'>\r\n {activeSubmenu ? getSubmenuContent(activeSubmenu) : children}\r\n </motion.div>\r\n </AnimatePresence>\r\n </div>\r\n </>\r\n ) : (\r\n <>\r\n <DrawerHeader className='sr-only'>\r\n <DrawerTitle>Menu</DrawerTitle>\r\n </DrawerHeader>\r\n <div className='max-h-[70vh] overflow-y-auto'>\r\n <AnimatePresence\r\n initial={false}\r\n mode='wait'\r\n custom={animationDirection}>\r\n <motion.div\r\n key='main-menu'\r\n custom={animationDirection}\r\n variants={variants}\r\n initial='enter'\r\n animate='center'\r\n exit='exit'\r\n transition={transition}\r\n className='w-full space-y-1.5 pb-6'>\r\n {children}\r\n </motion.div>\r\n </AnimatePresence>\r\n </div>\r\n </>\r\n )}\r\n </DrawerContent>\r\n </SubmenuContext.Provider>\r\n );\r\n }\r\n\r\n return (\r\n <SubmenuContext.Provider\r\n value={{\r\n activeSubmenu,\r\n setActiveSubmenu,\r\n submenuTitle,\r\n setSubmenuTitle,\r\n registerSubmenuContent,\r\n }}>\r\n <DropdownMenuContent\r\n data-slot='drop-drawer-content'\r\n align='end'\r\n sideOffset={4}\r\n className={cn(\"max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[220px] overflow-y-auto\", className)}\r\n {...props}>\r\n {children}\r\n </DropdownMenuContent>\r\n </SubmenuContext.Provider>\r\n );\r\n}\r\n\r\nfunction DropDrawerItem({\r\n className,\r\n children,\r\n onSelect,\r\n onClick,\r\n icon,\r\n inset,\r\n disabled,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuItem> & {\r\n icon?: React.ReactNode;\r\n}) {\r\n const {isMobile} = useDropDrawerContext();\r\n\r\n // Define hooks outside of conditionals to follow React rules\r\n // Check if this item is inside a group by looking at parent elements\r\n const isInGroup = React.useCallback((element: HTMLElement | null): boolean => {\r\n if (!element) return false;\r\n\r\n // Check if any parent has a data-drop-drawer-group attribute\r\n let parent = element.parentElement;\r\n while (parent) {\r\n if (parent.hasAttribute(\"data-drop-drawer-group\")) {\r\n return true;\r\n }\r\n parent = parent.parentElement;\r\n }\r\n return false;\r\n }, []);\r\n\r\n // Create a ref to check if the item is in a group\r\n const itemRef = React.useRef<HTMLDivElement>(null);\r\n const [isInsideGroup, setIsInsideGroup] = React.useState(false);\r\n\r\n React.useEffect(() => {\r\n // Only run this effect in mobile mode\r\n if (!isMobile) return;\r\n\r\n // Use a short timeout to ensure the DOM is fully rendered\r\n const timer = setTimeout(() => {\r\n if (itemRef.current) {\r\n setIsInsideGroup(isInGroup(itemRef.current));\r\n }\r\n }, 0);\r\n\r\n return () => clearTimeout(timer);\r\n }, [isInGroup, isMobile]);\r\n\r\n if (isMobile) {\r\n const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {\r\n if (disabled) return;\r\n if (onClick) onClick(e);\r\n if (onSelect) onSelect(e as unknown as Event);\r\n };\r\n\r\n // Only wrap in DrawerClose if it's not a submenu item\r\n const content = (\r\n <div\r\n ref={itemRef}\r\n data-slot='drop-drawer-item'\r\n data-inset={inset}\r\n data-disabled={disabled}\r\n className={cn(\r\n \"flex cursor-pointer items-center justify-between px-4 py-4\",\r\n // Only apply margin, background and rounded corners if not in a group\r\n !isInsideGroup && \"mx-2 my-1.5 rounded-md bg-neutral-100 dark:bg-neutral-100 dark:bg-neutral-800 dark:dark:bg-neutral-800\",\r\n // For items in a group, don't add background but add more padding\r\n isInsideGroup && \"bg-transparent py-4\",\r\n inset && \"pl-8\",\r\n disabled && \"pointer-events-none opacity-50\",\r\n className,\r\n )}\r\n onClick={handleClick}\r\n aria-disabled={disabled}\r\n {...props}>\r\n <div className='flex items-center gap-2'>{children}</div>\r\n {icon && <div className='flex-shrink-0'>{icon}</div>}\r\n </div>\r\n );\r\n\r\n // Check if this is inside a submenu\r\n const isInSubmenu =\r\n (props as Record<string, unknown>)[\"data-parent-submenu-id\"] || (props as Record<string, unknown>)[\"data-parent-submenu\"];\r\n\r\n if (isInSubmenu) {\r\n return content;\r\n }\r\n\r\n return <DrawerClose asChild>{content}</DrawerClose>;\r\n }\r\n\r\n return (\r\n <DropdownMenuItem\r\n data-slot='drop-drawer-item'\r\n data-inset={inset}\r\n className={className}\r\n onSelect={onSelect}\r\n onClick={onClick as React.MouseEventHandler<HTMLDivElement>}\r\n inset={inset}\r\n disabled={disabled}\r\n {...props}>\r\n <div className='flex w-full items-center justify-between'>\r\n <div>{children}</div>\r\n {icon && <div>{icon}</div>}\r\n </div>\r\n </DropdownMenuItem>\r\n );\r\n}\r\n\r\nfunction DropDrawerSeparator({className, ...props}: React.ComponentProps<typeof DropdownMenuSeparator>) {\r\n const {isMobile} = useDropDrawerContext();\r\n\r\n // For mobile, render a simple divider\r\n if (isMobile) {\r\n return null;\r\n }\r\n\r\n // For desktop, use the standard dropdown separator\r\n return (\r\n <DropdownMenuSeparator\r\n data-slot='drop-drawer-separator'\r\n className={className}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DropDrawerLabel({\r\n className,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuLabel> | React.ComponentProps<typeof DrawerTitle>) {\r\n const {isMobile} = useDropDrawerContext();\r\n\r\n if (isMobile) {\r\n return (\r\n <DrawerHeader className='p-0'>\r\n <DrawerTitle\r\n data-slot='drop-drawer-label'\r\n className={cn(\"px-4 py-2 text-sm font-medium text-neutral-500 dark:text-neutral-400\", className)}\r\n {...props}>\r\n {children}\r\n </DrawerTitle>\r\n </DrawerHeader>\r\n );\r\n }\r\n\r\n return (\r\n <DropdownMenuLabel\r\n data-slot='drop-drawer-label'\r\n className={className}\r\n {...props}>\r\n {children}\r\n </DropdownMenuLabel>\r\n );\r\n}\r\n\r\nfunction DropDrawerFooter({className, children, ...props}: React.ComponentProps<typeof DrawerFooter> | React.ComponentProps<\"div\">) {\r\n const {isMobile} = useDropDrawerContext();\r\n\r\n if (isMobile) {\r\n return (\r\n <DrawerFooter\r\n data-slot='drop-drawer-footer'\r\n className={cn(\"p-4\", className)}\r\n {...props}>\r\n {children}\r\n </DrawerFooter>\r\n );\r\n }\r\n\r\n // No direct equivalent in DropdownMenu, so we'll just render a div\r\n return (\r\n <div\r\n data-slot='drop-drawer-footer'\r\n className={cn(\"p-2\", className)}\r\n {...props}>\r\n {children}\r\n </div>\r\n );\r\n}\r\n\r\nfunction DropDrawerGroup({\r\n className,\r\n children,\r\n ...props\r\n}: React.ComponentProps<\"div\"> & {\r\n children: React.ReactNode;\r\n}) {\r\n const {isMobile} = useDropDrawerContext();\r\n\r\n // Add separators between children on mobile\r\n const childrenWithSeparators = React.useMemo(() => {\r\n if (!isMobile) return children;\r\n\r\n const childArray = React.Children.toArray(children);\r\n\r\n // Filter out any existing separators\r\n const filteredChildren = childArray.filter((child) => React.isValidElement(child) && child.type !== DropDrawerSeparator);\r\n\r\n // Add separators between items\r\n return filteredChildren.flatMap((child, index) => {\r\n if (index === filteredChildren.length - 1) return [child];\r\n return [\r\n child,\r\n <div\r\n key={`separator-${index}`}\r\n className='h-px bg-neutral-200 dark:bg-neutral-800'\r\n aria-hidden='true'\r\n />,\r\n ];\r\n });\r\n }, [children, isMobile]);\r\n\r\n if (isMobile) {\r\n return (\r\n <div\r\n data-drop-drawer-group\r\n data-slot='drop-drawer-group'\r\n role='group'\r\n className={cn(\r\n \"mx-2 my-3 overflow-hidden rounded-xl bg-neutral-100 dark:bg-neutral-100 dark:bg-neutral-800 dark:dark:bg-neutral-800\",\r\n className,\r\n )}\r\n {...props}>\r\n {childrenWithSeparators}\r\n </div>\r\n );\r\n }\r\n\r\n // On desktop, use a div with proper role and attributes\r\n return (\r\n <div\r\n data-drop-drawer-group\r\n data-slot='drop-drawer-group'\r\n role='group'\r\n className={className}\r\n {...props}>\r\n {children}\r\n </div>\r\n );\r\n}\r\n\r\n// Context for managing submenu state on mobile\r\ninterface SubmenuContextType {\r\n activeSubmenu: string | null;\r\n setActiveSubmenu: (id: string | null) => void;\r\n submenuTitle: string | null;\r\n setSubmenuTitle: (title: string | null) => void;\r\n navigateToSubmenu?: (id: string, title: string) => void;\r\n registerSubmenuContent?: (id: string, content: React.ReactNode[]) => void;\r\n}\r\n\r\nconst SubmenuContext = React.createContext<SubmenuContextType>({\r\n activeSubmenu: null,\r\n setActiveSubmenu: () => {},\r\n submenuTitle: null,\r\n setSubmenuTitle: () => {},\r\n navigateToSubmenu: undefined,\r\n registerSubmenuContent: undefined,\r\n});\r\n\r\n// Submenu components\r\n// Counter for generating simple numeric IDs\r\nlet submenuIdCounter = 0;\r\n\r\nfunction DropDrawerSub({\r\n children,\r\n id,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuSub> & {\r\n id?: string;\r\n}) {\r\n const {isMobile} = useDropDrawerContext();\r\n const {registerSubmenuContent} = React.useContext(SubmenuContext);\r\n\r\n // Generate a simple numeric ID instead of using React.useId()\r\n const [generatedId] = React.useState(() => `submenu-${submenuIdCounter++}`);\r\n const submenuId = id || generatedId;\r\n\r\n // Extract submenu content to register with parent\r\n React.useEffect(() => {\r\n if (!registerSubmenuContent) return;\r\n\r\n // Find the SubContent within this Sub\r\n const contentItems: React.ReactNode[] = [];\r\n React.Children.forEach(children, (child) => {\r\n if (React.isValidElement(child) && child.type === DropDrawerSubContent) {\r\n // Add all children of the SubContent to the result\r\n React.Children.forEach((child.props as {children?: React.ReactNode}).children, (contentChild) => {\r\n contentItems.push(contentChild);\r\n });\r\n }\r\n });\r\n\r\n // Register the content with the parent\r\n if (contentItems.length > 0) {\r\n registerSubmenuContent(submenuId, contentItems);\r\n }\r\n }, [children, registerSubmenuContent, submenuId]);\r\n\r\n if (isMobile) {\r\n // For mobile, we'll use the context to manage submenu state\r\n // Process children to pass the submenu ID to the trigger and content\r\n const processedChildren = React.Children.map(children, (child) => {\r\n if (!React.isValidElement(child)) return child;\r\n\r\n if (child.type === DropDrawerSubTrigger) {\r\n return React.cloneElement(\r\n child as React.ReactElement,\r\n {\r\n ...(child.props as object),\r\n \"data-parent-submenu-id\": submenuId,\r\n \"data-submenu-id\": submenuId,\r\n // Use only data attributes, not custom props\r\n \"data-parent-submenu\": submenuId,\r\n } as React.HTMLAttributes<HTMLElement>,\r\n );\r\n }\r\n\r\n if (child.type === DropDrawerSubContent) {\r\n return React.cloneElement(\r\n child as React.ReactElement,\r\n {\r\n ...(child.props as object),\r\n \"data-parent-submenu-id\": submenuId,\r\n \"data-submenu-id\": submenuId,\r\n // Use only data attributes, not custom props\r\n \"data-parent-submenu\": submenuId,\r\n } as React.HTMLAttributes<HTMLElement>,\r\n );\r\n }\r\n\r\n return child;\r\n });\r\n\r\n return (\r\n <div\r\n data-slot='drop-drawer-sub'\r\n data-submenu-id={submenuId}\r\n id={submenuId}>\r\n {processedChildren}\r\n </div>\r\n );\r\n }\r\n\r\n // For desktop, pass the generated ID to the DropdownMenuSub\r\n return (\r\n <DropdownMenuSub\r\n data-slot='drop-drawer-sub'\r\n data-submenu-id={submenuId}\r\n // Don't pass id to DropdownMenuSub as it doesn't accept this prop\r\n {...props}>\r\n {children}\r\n </DropdownMenuSub>\r\n );\r\n}\r\n\r\nfunction DropDrawerSubTrigger({\r\n className,\r\n inset,\r\n children,\r\n ...props\r\n}: React.ComponentProps<typeof DropdownMenuSubTrigger> & {\r\n icon?: React.ReactNode;\r\n}) {\r\n const {isMobile} = useDropDrawerContext();\r\n const {navigateToSubmenu} = React.useContext(SubmenuContext);\r\n\r\n // Define hooks outside of conditionals to follow React rules\r\n // Check if this item is inside a group by looking at parent elements\r\n const isInGroup = React.useCallback((element: HTMLElement | null): boolean => {\r\n if (!element) return false;\r\n\r\n // Check if any parent has a data-drop-drawer-group attribute\r\n let parent = element.parentElement;\r\n while (parent) {\r\n if (parent.hasAttribute(\"data-drop-drawer-group\")) {\r\n return true;\r\n }\r\n parent = parent.parentElement;\r\n }\r\n return false;\r\n }, []);\r\n\r\n // Create a ref to check if the item is in a group\r\n const itemRef = React.useRef<HTMLDivElement>(null);\r\n const [isInsideGroup, setIsInsideGroup] = React.useState(false);\r\n\r\n React.useEffect(() => {\r\n // Only run this effect in mobile mode\r\n if (!isMobile) return;\r\n\r\n // Use a short timeout to ensure the DOM is fully rendered\r\n const timer = setTimeout(() => {\r\n if (itemRef.current) {\r\n setIsInsideGroup(isInGroup(itemRef.current));\r\n }\r\n }, 0);\r\n\r\n return () => clearTimeout(timer);\r\n }, [isInGroup, isMobile]);\r\n\r\n if (isMobile) {\r\n // Find the parent submenu ID\r\n const handleClick = (e: React.MouseEvent) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n // Get the closest parent with data-submenu-id attribute\r\n const element = e.currentTarget as HTMLElement;\r\n let submenuId: string | null = null;\r\n\r\n // First check if the element itself has the data attribute\r\n if (element.closest(\"[data-submenu-id]\")) {\r\n const closestElement = element.closest(\"[data-submenu-id]\");\r\n const id = closestElement?.getAttribute(\"data-submenu-id\");\r\n if (id) {\r\n submenuId = id;\r\n }\r\n }\r\n\r\n // If not found, try props\r\n if (!submenuId) {\r\n submenuId =\r\n ((props as Record<string, unknown>)[\"data-parent-submenu-id\"] as string)\r\n || ((props as Record<string, unknown>)[\"data-parent-submenu\"] as string);\r\n }\r\n\r\n if (!submenuId) {\r\n return;\r\n }\r\n\r\n // Get the title\r\n const title = typeof children === \"string\" ? children : \"Submenu\";\r\n\r\n // Navigate to the submenu\r\n if (navigateToSubmenu) {\r\n navigateToSubmenu(submenuId, title);\r\n }\r\n };\r\n\r\n // Combine onClick handlers\r\n const combinedOnClick = (e: React.MouseEvent) => {\r\n // Call the original onClick if provided\r\n const typedProps = props as Record<string, unknown>;\r\n if (typedProps[\"onClick\"]) {\r\n const originalOnClick = typedProps[\"onClick\"] as React.MouseEventHandler<HTMLDivElement>;\r\n originalOnClick(e as React.MouseEvent<HTMLDivElement>);\r\n }\r\n\r\n // Call our navigation handler\r\n handleClick(e);\r\n };\r\n\r\n // Remove onClick from props to avoid duplicate handlers\r\n const {...restProps} = props as Record<string, unknown>;\r\n\r\n // Don't wrap in DrawerClose for submenu triggers\r\n return (\r\n <div\r\n ref={itemRef}\r\n data-slot='drop-drawer-sub-trigger'\r\n data-inset={inset}\r\n className={cn(\r\n \"flex cursor-pointer items-center justify-between px-4 py-4\",\r\n // Only apply margin, background and rounded corners if not in a group\r\n !isInsideGroup && \"mx-2 my-1.5 rounded-md bg-neutral-100 dark:bg-neutral-100 dark:bg-neutral-800 dark:dark:bg-neutral-800\",\r\n // For items in a group, don't add background but add more padding\r\n isInsideGroup && \"bg-transparent py-4\",\r\n inset && \"pl-8\",\r\n className,\r\n )}\r\n onClick={combinedOnClick}\r\n {...restProps}>\r\n <div className='flex items-center gap-2'>{children}</div>\r\n <ChevronRightIcon className='h-5 w-5' />\r\n </div>\r\n );\r\n }\r\n\r\n return (\r\n <DropdownMenuSubTrigger\r\n data-slot='drop-drawer-sub-trigger'\r\n data-inset={inset}\r\n className={className}\r\n inset={inset}\r\n {...props}>\r\n {children}\r\n </DropdownMenuSubTrigger>\r\n );\r\n}\r\n\r\nfunction DropDrawerSubContent({className, sideOffset = 4, children, ...props}: React.ComponentProps<typeof DropdownMenuSubContent>) {\r\n const {isMobile} = useDropDrawerContext();\r\n\r\n if (isMobile) {\r\n // For mobile, we don't render the content directly\r\n // It will be rendered by the DropDrawerContent component when active\r\n return null;\r\n }\r\n\r\n return (\r\n <DropdownMenuSubContent\r\n data-slot='drop-drawer-sub-content'\r\n sideOffset={sideOffset}\r\n className={cn(\r\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border border-neutral-200 p-1 shadow-lg dark:border-neutral-800\",\r\n className,\r\n )}\r\n {...props}>\r\n {children}\r\n </DropdownMenuSubContent>\r\n );\r\n}\r\n\r\nexport {\r\n DropDrawer,\r\n DropDrawerContent,\r\n DropDrawerFooter,\r\n DropDrawerGroup,\r\n DropDrawerItem,\r\n DropDrawerLabel,\r\n DropDrawerSeparator,\r\n DropDrawerSub,\r\n DropDrawerSubContent,\r\n DropDrawerSubTrigger,\r\n DropDrawerTrigger,\r\n};\r\n"],"names":["DropDrawerContext","React","useDropDrawerContext","context","Error","DropDrawer","children","props","isMobile","useIsMobile","DropdownComponent","Drawer","DropdownMenu","DropDrawerTrigger","className","TriggerComponent","DrawerTrigger","DropdownMenuTrigger","DropDrawerContent","activeSubmenu","setActiveSubmenu","submenuTitle","setSubmenuTitle","submenuStack","setSubmenuStack","animationDirection","setAnimationDirection","submenuContentRef","Map","navigateToSubmenu","id","title","prev","goBack","newStack","previous","registerSubmenuContent","content","extractSubmenuContent","elements","targetId","result","findSubmenuContent","node","element","DropDrawerSub","elementId","dataSubmenuId","child","DropDrawerSubContent","subContentProps","contentChild","Array","getSubmenuContent","cachedContent","submenuContent","variants","direction","transition","SubmenuContext","DrawerContent","cn","DrawerHeader","ChevronLeftIcon","DrawerTitle","AnimatePresence","motion","DropdownMenuContent","DropDrawerItem","onSelect","onClick","icon","inset","disabled","isInGroup","parent","itemRef","isInsideGroup","setIsInsideGroup","timer","setTimeout","clearTimeout","handleClick","e","isInSubmenu","DrawerClose","DropdownMenuItem","DropDrawerSeparator","DropdownMenuSeparator","DropDrawerLabel","DropdownMenuLabel","DropDrawerFooter","DrawerFooter","DropDrawerGroup","childrenWithSeparators","childArray","filteredChildren","index","undefined","submenuIdCounter","generatedId","submenuId","contentItems","processedChildren","DropDrawerSubTrigger","DropdownMenuSub","closestElement","combinedOnClick","typedProps","originalOnClick","restProps","ChevronRightIcon","DropdownMenuSubTrigger","sideOffset","DropdownMenuSubContent"],"mappings":";;;;;;;;;AAuBA,MAAMA,oBAAoB,WAApBA,GAAoBC,cAAyC;IACjE,UAAU;AACZ;AAEA,MAAMC,uBAAuB;IAC3B,MAAMC,UAAUF,WAAiBD;IACjC,IAAI,CAACG,SACH,MAAM,IAAIC,MAAM;IAElB,OAAOD;AACT;AAEA,SAASE,WAAW,EAACC,QAAQ,EAAE,GAAGC,OAAuF;IACvH,MAAMC,WAAWC;IACjB,MAAMC,oBAAoBF,WAAWG,SAASC;IAE9C,OAAO,WAAP,GACE,IAACZ,kBAAkB,QAAQ;QAAC,OAAO;YAACQ;QAAQ;kBAC1C,kBAACE,mBAAAA;YACC,aAAU;YACT,GAAIF,YAAY;gBAAC,WAAW;YAAI,CAAC;YACjC,GAAGD,KAAK;sBACRD;;;AAIT;AAEA,SAASO,kBAAkB,EACzBC,SAAS,EACTR,QAAQ,EACR,GAAGC,OAC2F;IAC9F,MAAM,EAACC,QAAQ,EAAC,GAAGN;IACnB,MAAMa,mBAAmBP,WAAWQ,gBAAgBC;IAEpD,OAAO,WAAP,GACE,IAACF,kBAAAA;QACC,aAAU;QACV,WAAWD;QACV,GAAGP,KAAK;kBACRD;;AAGP;AAEA,SAASY,kBAAkB,EACzBJ,SAAS,EACTR,QAAQ,EACR,GAAGC,OAC2F;IAC9F,MAAM,EAACC,QAAQ,EAAC,GAAGN;IACnB,MAAM,CAACiB,eAAeC,iBAAiB,GAAGnB,SAA8B;IACxE,MAAM,CAACoB,cAAcC,gBAAgB,GAAGrB,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QAGA,MAAM4E,kBAAkB,CAACxB;YAEvB,MAAMyB,aAAarG;YACnB,IAAIqG,UAAU,CAAC,UAAU,EAAE;gBACzB,MAAMC,kBAAkBD,UAAU,CAAC,UAAU;gBAC7CC,gBAAgB1B;YAClB;YAGAD,YAAYC;QACd;QAGA,MAAM,EAAC,GAAG2B,WAAU,GAAGvG;QAGvB,OAAO,WAAP,GACE,KAAC;YACC,KAAKqE;YACL,aAAU;YACV,cAAYJ;YACZ,WAAWX,GACT,8DAEA,CAACgB,iBAAiB,0GAElBA,iBAAiB,uBACjBL,SAAS,QACT1D;YAEF,SAAS6F;YACR,GAAGG,SAAS;;8BACb,IAAC;oBAAI,WAAU;8BAA2BxG;;8BAC1C,IAACyG,kBAAgBA;oBAAC,WAAU;;;;IAGlC;IAEA,OAAO,WAAP,GACE,IAACC,wBAAsBA;QACrB,aAAU;QACV,cAAYxC;QACZ,WAAW1D;QACX,OAAO0D;QACN,GAAGjE,KAAK;kBACRD;;AAGP;AAEA,SAAS2C,qBAAqB,EAACnC,SAAS,EAAEmG,aAAa,CAAC,EAAE3G,QAAQ,EAAE,GAAGC,OAA2D;IAChI,MAAM,EAACC,QAAQ,EAAC,GAAGN;IAEnB,IAAIM,UAGF,OAAO;IAGT,OAAO,WAAP,GACE,IAAC0G,wBAAsBA;QACrB,aAAU;QACV,YAAYD;QACZ,WAAWpD,GACT,gHACA/C;QAED,GAAGP,KAAK;kBACRD;;AAGP"}
@@ -1 +1 @@
1
- {"version":3,"file":"components\\ui\\empty.js","sources":["webpack://@arolariu/components/./src/components/ui/empty.tsx"],"sourcesContent":["\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\nimport {cva, type VariantProps} from \"class-variance-authority\";\r\nimport * as React from \"react\";\r\n\r\nfunction Empty({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='empty'\r\n className={cn(\r\n \"flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction EmptyHeader({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='empty-header'\r\n className={cn(\"flex max-w-sm flex-col items-center gap-2 text-center\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nconst emptyMediaVariants = cva(\"mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0\", {\r\n variants: {\r\n variant: {\r\n default: \"bg-transparent\",\r\n icon: \"bg-neutral-100 text-neutral-950 flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6 dark:bg-neutral-800 dark:text-neutral-50\",\r\n },\r\n },\r\n defaultVariants: {\r\n variant: \"default\",\r\n },\r\n});\r\n\r\nfunction EmptyMedia({className, variant = \"default\", ...props}: React.ComponentProps<\"div\"> & VariantProps<typeof emptyMediaVariants>) {\r\n return (\r\n <div\r\n data-slot='empty-icon'\r\n data-variant={variant}\r\n className={cn(emptyMediaVariants({variant, className}))}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction EmptyTitle({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='empty-title'\r\n className={cn(\"text-lg font-medium tracking-tight\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction EmptyDescription({className, ...props}: React.ComponentProps<\"p\">) {\r\n return (\r\n <div\r\n data-slot='empty-description'\r\n className={cn(\r\n \"text-sm/relaxed text-neutral-500 dark:text-neutral-400 [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-neutral-900 dark:[&>a:hover]:text-neutral-50\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction EmptyContent({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='empty-content'\r\n className={cn(\"flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nexport {Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle};\r\n"],"names":["Empty","className","props","cn","EmptyHeader","emptyMediaVariants","cva","EmptyMedia","variant","EmptyTitle","EmptyDescription","EmptyContent"],"mappings":";;;;;AAMA,SAASA,MAAM,EAACC,SAAS,EAAE,GAAGC,OAAmC;IAC/D,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GACT,gIACAF;QAED,GAAGC,KAAK;;AAGf;AAEA,SAASE,YAAY,EAACH,SAAS,EAAE,GAAGC,OAAmC;IACrE,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GAAG,yDAAyDF;QACtE,GAAGC,KAAK;;AAGf;AAEA,MAAMG,qBAAqBC,IAAI,+FAA+F;IAC5H,UAAU;QACR,SAAS;YACP,SAAS;YACT,MAAM;QACR;IACF;IACA,iBAAiB;QACf,SAAS;IACX;AACF;AAEA,SAASC,WAAW,EAACN,SAAS,EAAEO,UAAU,SAAS,EAAE,GAAGN,OAA6E;IACnI,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,gBAAcM;QACd,WAAWL,GAAGE,mBAAmB;YAACG;YAASP;QAAS;QACnD,GAAGC,KAAK;;AAGf;AAEA,SAASO,WAAW,EAACR,SAAS,EAAE,GAAGC,OAAmC;IACpE,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GAAG,sCAAsCF;QACnD,GAAGC,KAAK;;AAGf;AAEA,SAASQ,iBAAiB,EAACT,SAAS,EAAE,GAAGC,OAAiC;IACxE,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GACT,iKACAF;QAED,GAAGC,KAAK;;AAGf;AAEA,SAASS,aAAa,EAACV,SAAS,EAAE,GAAGC,OAAmC;IACtE,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GAAG,iFAAiFF;QAC9F,GAAGC,KAAK;;AAGf"}
1
+ {"version":3,"file":"components/ui/empty.js","sources":["../../../src/components/ui/empty.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\nimport {cva, type VariantProps} from \"class-variance-authority\";\r\nimport * as React from \"react\";\r\n\r\nfunction Empty({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='empty'\r\n className={cn(\r\n \"flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction EmptyHeader({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='empty-header'\r\n className={cn(\"flex max-w-sm flex-col items-center gap-2 text-center\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nconst emptyMediaVariants = cva(\"mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0\", {\r\n variants: {\r\n variant: {\r\n default: \"bg-transparent\",\r\n icon: \"bg-neutral-100 text-neutral-950 flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6 dark:bg-neutral-800 dark:text-neutral-50\",\r\n },\r\n },\r\n defaultVariants: {\r\n variant: \"default\",\r\n },\r\n});\r\n\r\nfunction EmptyMedia({className, variant = \"default\", ...props}: React.ComponentProps<\"div\"> & VariantProps<typeof emptyMediaVariants>) {\r\n return (\r\n <div\r\n data-slot='empty-icon'\r\n data-variant={variant}\r\n className={cn(emptyMediaVariants({variant, className}))}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction EmptyTitle({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='empty-title'\r\n className={cn(\"text-lg font-medium tracking-tight\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction EmptyDescription({className, ...props}: React.ComponentProps<\"p\">) {\r\n return (\r\n <div\r\n data-slot='empty-description'\r\n className={cn(\r\n \"text-sm/relaxed text-neutral-500 dark:text-neutral-400 [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-neutral-900 dark:[&>a:hover]:text-neutral-50\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction EmptyContent({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='empty-content'\r\n className={cn(\"flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nexport {Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle};\r\n"],"names":["Empty","className","props","cn","EmptyHeader","emptyMediaVariants","cva","EmptyMedia","variant","EmptyTitle","EmptyDescription","EmptyContent"],"mappings":";;;;;AAMA,SAASA,MAAM,EAACC,SAAS,EAAE,GAAGC,OAAmC;IAC/D,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GACT,gIACAF;QAED,GAAGC,KAAK;;AAGf;AAEA,SAASE,YAAY,EAACH,SAAS,EAAE,GAAGC,OAAmC;IACrE,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GAAG,yDAAyDF;QACtE,GAAGC,KAAK;;AAGf;AAEA,MAAMG,qBAAqBC,IAAI,+FAA+F;IAC5H,UAAU;QACR,SAAS;YACP,SAAS;YACT,MAAM;QACR;IACF;IACA,iBAAiB;QACf,SAAS;IACX;AACF;AAEA,SAASC,WAAW,EAACN,SAAS,EAAEO,UAAU,SAAS,EAAE,GAAGN,OAA6E;IACnI,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,gBAAcM;QACd,WAAWL,GAAGE,mBAAmB;YAACG;YAASP;QAAS;QACnD,GAAGC,KAAK;;AAGf;AAEA,SAASO,WAAW,EAACR,SAAS,EAAE,GAAGC,OAAmC;IACpE,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GAAG,sCAAsCF;QACnD,GAAGC,KAAK;;AAGf;AAEA,SAASQ,iBAAiB,EAACT,SAAS,EAAE,GAAGC,OAAiC;IACxE,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GACT,iKACAF;QAED,GAAGC,KAAK;;AAGf;AAEA,SAASS,aAAa,EAACV,SAAS,EAAE,GAAGC,OAAmC;IACtE,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GAAG,iFAAiFF;QAC9F,GAAGC,KAAK;;AAGf"}
@@ -98,7 +98,7 @@ function FieldSeparator({ children, className, ...props }) {
98
98
  /*#__PURE__*/ jsx(Separator, {
99
99
  className: "absolute inset-0 top-1/2"
100
100
  }),
101
- children && /*#__PURE__*/ jsx("span", {
101
+ Boolean(children) && /*#__PURE__*/ jsx("span", {
102
102
  className: "relative mx-auto block w-fit bg-white px-2 text-neutral-500 dark:bg-neutral-950 dark:text-neutral-400",
103
103
  "data-slot": "field-separator-content",
104
104
  children: children
@@ -1 +1 @@
1
- {"version":3,"file":"components\\ui\\field.js","sources":["webpack://@arolariu/components/./src/components/ui/field.tsx"],"sourcesContent":["\r\n\r\nimport {cva, type VariantProps} from \"class-variance-authority\";\r\nimport * as React from \"react\";\r\n\r\nimport {Label} from \"@/components/ui/label\";\r\nimport {Separator} from \"@/components/ui/separator\";\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\nfunction FieldSet({className, ...props}: React.ComponentProps<\"fieldset\">) {\r\n return (\r\n <fieldset\r\n data-slot='field-set'\r\n className={cn(\"flex flex-col gap-6\", \"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldLegend({className, variant = \"legend\", ...props}: React.ComponentProps<\"legend\"> & {variant?: \"legend\" | \"label\"}) {\r\n return (\r\n <legend\r\n data-slot='field-legend'\r\n data-variant={variant}\r\n className={cn(\"mb-3 font-medium\", \"data-[variant=legend]:text-base\", \"data-[variant=label]:text-sm\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldGroup({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='field-group'\r\n className={cn(\r\n \"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nconst fieldVariants = cva(\"group/field data-[invalid=true]:text-red-500 flex w-full gap-3 dark:data-[invalid=true]:text-red-900\", {\r\n variants: {\r\n orientation: {\r\n vertical: [\"flex-col [&>*]:w-full [&>.sr-only]:w-auto\"],\r\n horizontal: [\r\n \"flex-row items-center\",\r\n \"[&>[data-slot=field-label]]:flex-auto\",\r\n \"has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px has-[>[data-slot=field-content]]:items-start\",\r\n ],\r\n responsive: [\r\n \"@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto flex-col [&>*]:w-full [&>.sr-only]:w-auto\",\r\n \"@md/field-group:[&>[data-slot=field-label]]:flex-auto\",\r\n \"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\r\n ],\r\n },\r\n },\r\n defaultVariants: {\r\n orientation: \"vertical\",\r\n },\r\n});\r\n\r\nfunction Field({className, orientation = \"vertical\", ...props}: React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>) {\r\n return (\r\n <div\r\n role='group'\r\n data-slot='field'\r\n data-orientation={orientation}\r\n className={cn(fieldVariants({orientation}), className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldContent({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='field-content'\r\n className={cn(\"group/field-content flex flex-1 flex-col gap-1.5 leading-snug\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldLabel({className, ...props}: React.ComponentProps<typeof Label>) {\r\n return (\r\n <Label\r\n data-slot='field-label'\r\n className={cn(\r\n \"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50\",\r\n \"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4\",\r\n \"has-data-[state=checked]:border-neutral-900 has-data-[state=checked]:bg-neutral-900/5 dark:has-data-[state=checked]:border-neutral-50 dark:dark:has-data-[state=checked]:bg-neutral-50/10 dark:has-data-[state=checked]:bg-neutral-50/5 dark:has-data-[state=checked]:bg-neutral-900/10\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldTitle({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='field-label'\r\n className={cn(\r\n \"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldDescription({className, ...props}: React.ComponentProps<\"p\">) {\r\n return (\r\n <p\r\n data-slot='field-description'\r\n className={cn(\r\n \"text-sm leading-normal font-normal text-neutral-500 group-has-[[data-orientation=horizontal]]/field:text-balance dark:text-neutral-400\",\r\n \"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5\",\r\n \"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-neutral-900 dark:[&>a:hover]:text-neutral-50\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldSeparator({\r\n children,\r\n className,\r\n ...props\r\n}: React.ComponentProps<\"div\"> & {\r\n children?: React.ReactNode;\r\n}) {\r\n return (\r\n <div\r\n data-slot='field-separator'\r\n data-content={Boolean(children) || undefined}\r\n className={cn(\"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2\", className)}\r\n {...props}>\r\n <Separator className='absolute inset-0 top-1/2' />\r\n {children && (\r\n <span\r\n className='relative mx-auto block w-fit bg-white px-2 text-neutral-500 dark:bg-neutral-950 dark:text-neutral-400'\r\n data-slot='field-separator-content'>\r\n {children}\r\n </span>\r\n )}\r\n </div>\r\n );\r\n}\r\n\r\nfunction FieldError({\r\n className,\r\n children,\r\n errors,\r\n ...props\r\n}: React.ComponentProps<\"div\"> & {\r\n errors?: Array<{message?: string} | undefined>;\r\n}) {\r\n // eslint-disable-next-line sonarjs/function-return-type -- expected different return type.\r\n const content = React.useMemo(() => {\r\n if (children) {\r\n return children;\r\n }\r\n\r\n if (!errors) {\r\n return null;\r\n }\r\n\r\n if (errors?.length === 1 && errors[0]?.message) {\r\n return errors[0].message;\r\n }\r\n\r\n return (\r\n <ul className='ml-4 flex list-disc flex-col gap-1'>\r\n {errors.map((error, index) => error?.message && <li key={index}>{error.message}</li>)}\r\n </ul>\r\n );\r\n }, [children, errors]);\r\n\r\n if (!content) {\r\n return null;\r\n }\r\n\r\n return (\r\n <div\r\n role='alert'\r\n data-slot='field-error'\r\n className={cn(\"text-sm font-normal text-red-500 dark:text-red-900\", className)}\r\n {...props}>\r\n {content}\r\n </div>\r\n );\r\n}\r\n\r\nexport {Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle};\r\n"],"names":["FieldSet","className","props","cn","FieldLegend","variant","FieldGroup","fieldVariants","cva","Field","orientation","FieldContent","FieldLabel","Label","FieldTitle","FieldDescription","FieldSeparator","children","Boolean","undefined","Separator","FieldError","errors","content","React","error","index"],"mappings":";;;;;;;AASA,SAASA,SAAS,EAACC,SAAS,EAAE,GAAGC,OAAwC;IACvE,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GAAG,uBAAuB,gFAAgFF;QACpH,GAAGC,KAAK;;AAGf;AAEA,SAASE,YAAY,EAACH,SAAS,EAAEI,UA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ACC,aAAU;QACV,WAAWC,GACT,0IACA,gEACA,0GACAF;QAED,GAAGC,KAAK;;AAGf;AAEA,SAASc,eAAe,EACtBC,QAAQ,EACRhB,SAAS,EACT,GAAGC,OAGJ;IACC,OAAO,WAAP,GACE,KAAC;QACC,aAAU;QACV,gBAAcgB,QAAQD,aAAaE;QACnC,WAAWhB,GAAG,6EAA6EF;QAC1F,GAAGC,KAAK;;0BACT,IAACkB,WAASA;gBAAC,WAAU;;YACpBH,YAAY,WAAZA,GACC,IAAC;gBACC,WAAU;gBACV,aAAU;0BACTA;;;;AAKX;AAEA,SAASI,WAAW,EAClBpB,SAAS,EACTgB,QAAQ,EACRK,MAAM,EACN,GAAGpB,OAGJ;IAEC,MAAMqB,UAAUC,QAAc;QAC5B,IAAIP,UACF,OAAOA;QAGT,IAAI,CAACK,QACH,OAAO;QAGT,IAAIA,QAAQ,WAAW,KAAKA,MAAM,CAAC,EAAE,EAAE,SACrC,OAAOA,MAAM,CAAC,EAAE,CAAC,OAAO;QAG1B,OAAO,WAAP,GACE,IAAC;YAAG,WAAU;sBACXA,OAAO,GAAG,CAAC,CAACG,OAAOC,QAAUD,OAAO,WAAW,WAAX,GAAW,IAAC;8BAAgBA,MAAM,OAAO;mBAArBC;;IAG/D,GAAG;QAACT;QAAUK;KAAO;IAErB,IAAI,CAACC,SACH,OAAO;IAGT,OAAO,WAAP,GACE,IAAC;QACC,MAAK;QACL,aAAU;QACV,WAAWpB,GAAG,sDAAsDF;QACnE,GAAGC,KAAK;kBACRqB;;AAGP"}
1
+ {"version":3,"file":"components/ui/field.js","sources":["../../../src/components/ui/field.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {cva, type VariantProps} from \"class-variance-authority\";\r\nimport * as React from \"react\";\r\n\r\nimport {Label} from \"@/components/ui/label\";\r\nimport {Separator} from \"@/components/ui/separator\";\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\nfunction FieldSet({className, ...props}: React.ComponentProps<\"fieldset\">) {\r\n return (\r\n <fieldset\r\n data-slot='field-set'\r\n className={cn(\"flex flex-col gap-6\", \"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldLegend({className, variant = \"legend\", ...props}: React.ComponentProps<\"legend\"> & {variant?: \"legend\" | \"label\"}) {\r\n return (\r\n <legend\r\n data-slot='field-legend'\r\n data-variant={variant}\r\n className={cn(\"mb-3 font-medium\", \"data-[variant=legend]:text-base\", \"data-[variant=label]:text-sm\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldGroup({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='field-group'\r\n className={cn(\r\n \"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nconst fieldVariants = cva(\"group/field data-[invalid=true]:text-red-500 flex w-full gap-3 dark:data-[invalid=true]:text-red-900\", {\r\n variants: {\r\n orientation: {\r\n vertical: [\"flex-col [&>*]:w-full [&>.sr-only]:w-auto\"],\r\n horizontal: [\r\n \"flex-row items-center\",\r\n \"[&>[data-slot=field-label]]:flex-auto\",\r\n \"has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px has-[>[data-slot=field-content]]:items-start\",\r\n ],\r\n responsive: [\r\n \"@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto flex-col [&>*]:w-full [&>.sr-only]:w-auto\",\r\n \"@md/field-group:[&>[data-slot=field-label]]:flex-auto\",\r\n \"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px\",\r\n ],\r\n },\r\n },\r\n defaultVariants: {\r\n orientation: \"vertical\",\r\n },\r\n});\r\n\r\nfunction Field({className, orientation = \"vertical\", ...props}: React.ComponentProps<\"div\"> & VariantProps<typeof fieldVariants>) {\r\n return (\r\n <div\r\n role='group'\r\n data-slot='field'\r\n data-orientation={orientation}\r\n className={cn(fieldVariants({orientation}), className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldContent({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='field-content'\r\n className={cn(\"group/field-content flex flex-1 flex-col gap-1.5 leading-snug\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldLabel({className, ...props}: React.ComponentProps<typeof Label>) {\r\n return (\r\n <Label\r\n data-slot='field-label'\r\n className={cn(\r\n \"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50\",\r\n \"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4\",\r\n \"has-data-[state=checked]:border-neutral-900 has-data-[state=checked]:bg-neutral-900/5 dark:has-data-[state=checked]:border-neutral-50 dark:dark:has-data-[state=checked]:bg-neutral-50/10 dark:has-data-[state=checked]:bg-neutral-50/5 dark:has-data-[state=checked]:bg-neutral-900/10\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldTitle({className, ...props}: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot='field-label'\r\n className={cn(\r\n \"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldDescription({className, ...props}: React.ComponentProps<\"p\">) {\r\n return (\r\n <p\r\n data-slot='field-description'\r\n className={cn(\r\n \"text-sm leading-normal font-normal text-neutral-500 group-has-[[data-orientation=horizontal]]/field:text-balance dark:text-neutral-400\",\r\n \"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5\",\r\n \"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-neutral-900 dark:[&>a:hover]:text-neutral-50\",\r\n className,\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction FieldSeparator({\r\n children,\r\n className,\r\n ...props\r\n}: React.ComponentProps<\"div\"> & {\r\n children?: React.ReactNode;\r\n}) {\r\n return (\r\n <div\r\n data-slot='field-separator'\r\n data-content={Boolean(children) || undefined}\r\n className={cn(\"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2\", className)}\r\n {...props}>\r\n <Separator className='absolute inset-0 top-1/2' />\r\n {Boolean(children) && (\r\n <span\r\n className='relative mx-auto block w-fit bg-white px-2 text-neutral-500 dark:bg-neutral-950 dark:text-neutral-400'\r\n data-slot='field-separator-content'>\r\n {children}\r\n </span>\r\n )}\r\n </div>\r\n );\r\n}\r\n\r\nfunction FieldError({\r\n className,\r\n children,\r\n errors,\r\n ...props\r\n}: React.ComponentProps<\"div\"> & {\r\n errors?: Array<{message?: string} | undefined>;\r\n}) {\r\n // eslint-disable-next-line sonarjs/function-return-type -- expected different return type.\r\n const content = React.useMemo(() => {\r\n if (children) {\r\n return children;\r\n }\r\n\r\n if (!errors) {\r\n return null;\r\n }\r\n\r\n if (errors?.length === 1 && errors[0]?.message) {\r\n return errors[0].message;\r\n }\r\n\r\n return (\r\n <ul className='ml-4 flex list-disc flex-col gap-1'>\r\n {errors.map((error, index) => error?.message && <li key={index}>{error.message}</li>)}\r\n </ul>\r\n );\r\n }, [children, errors]);\r\n\r\n if (!content) {\r\n return null;\r\n }\r\n\r\n return (\r\n <div\r\n role='alert'\r\n data-slot='field-error'\r\n className={cn(\"text-sm font-normal text-red-500 dark:text-red-900\", className)}\r\n {...props}>\r\n {content}\r\n </div>\r\n );\r\n}\r\n\r\nexport {Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle};\r\n"],"names":["FieldSet","className","props","cn","FieldLegend","variant","FieldGroup","fieldVariants","cva","Field","orientation","FieldContent","FieldLabel","Label","FieldTitle","FieldDescription","FieldSeparator","children","Boolean","undefined","Separator","FieldError","errors","content","React","error","index"],"mappings":";;;;;;;AASA,SAASA,SAAS,EAACC,SAAS,EAAE,GAAGC,OAAwC;IACvE,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GAAG,uBAAuB,gFAAgFF;QACpH,GAAGC,KAAK;;AAGf;AAEA,SAASE,YAAY,EAACH,SAAS,EAAEI,UAAU,QAAQ,EAAE,GAAGH,OAAuE;IAC7H,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,gBAAcG;QACd,WAAWF,GAAG,oBAAoB,mCAAmC,gCAAgCF;QACpG,GAAGC,KAAK;;AAGf;AAEA,SAASI,WAAW,EAACL,SAAS,EAAE,GAAGC,OAAmC;IACpE,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GACT,0IACAF;QAED,GAAGC,KAAK;;AAGf;AAEA,MAAMK,gBAAgBC,IAAI,wGAAwG;IAChI,UAAU;QACR,aAAa;YACX,UAAU;gBAAC;aAA4C;YACvD,YAAY;gBACV;gBACA;gBACA;aACD;YACD,YAAY;gBACV;gBACA;gBACA;aACD;QACH;IACF;IACA,iBAAiB;QACf,aAAa;IACf;AACF;AAEA,SAASC,MAAM,EAACR,SAAS,EAAES,cAAc,UAAU,EAAE,GAAGR,OAAwE;IAC9H,OAAO,WAAP,GACE,IAAC;QACC,MAAK;QACL,aAAU;QACV,oBAAkBQ;QAClB,WAAWP,GAAGI,cAAc;YAACG;QAAW,IAAIT;QAC3C,GAAGC,KAAK;;AAGf;AAEA,SAASS,aAAa,EAACV,SAAS,EAAE,GAAGC,OAAmC;IACtE,OAAO,WAAP,GACE,IAAC;QACC,aAAU;QACV,WAAWC,GAAG,iEAAiEF;QAC9E,GAAGC,KAAK;;AAGf;AAEA,SAASU,WAAW,EAACX,SAAS,EAAE,GAAGC,OAA0C;IAC3E,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GAAG,sDAAsDF;QACnE,GAAGC,KAAK;kBACRqB;;AAGP"}
@@ -1 +1 @@
1
- {"version":3,"file":"components\\ui\\fireworks-background.js","sources":["webpack://@arolariu/components/./src/components/ui/fireworks-background.tsx"],"sourcesContent":["\r\n\r\nimport * as React from \"react\";\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\nconst rand = (min: number, max: number): number => Math.random() * (max - min) + min;\r\nconst randInt = (min: number, max: number): number => Math.floor(Math.random() * (max - min) + min);\r\nconst randColor = (): string => `hsl(${randInt(0, 360)}, 100%, 50%)`;\r\n\r\ninterface ParticleType {\r\n x: number;\r\n y: number;\r\n color: string;\r\n speed: number;\r\n direction: number;\r\n vx: number;\r\n vy: number;\r\n gravity: number;\r\n friction: number;\r\n alpha: number;\r\n decay: number;\r\n size: number;\r\n update: () => void;\r\n draw: (ctx: CanvasRenderingContext2D) => void;\r\n isAlive: () => boolean;\r\n}\r\n\r\nconst createParticle = (\r\n x: number,\r\n y: number,\r\n color: string,\r\n speed: number,\r\n direction: number,\r\n gravity: number,\r\n friction: number,\r\n size: number,\r\n): ParticleType => {\r\n const vx = Math.cos(direction) * speed;\r\n const vy = Math.sin(direction) * speed;\r\n const alpha = 1;\r\n const decay = rand(0.005, 0.02);\r\n\r\n return {\r\n x,\r\n y,\r\n color,\r\n speed,\r\n direction,\r\n vx,\r\n vy,\r\n gravity,\r\n friction,\r\n alpha,\r\n decay,\r\n size,\r\n update() {\r\n this.vx *= this.friction;\r\n this.vy *= this.friction;\r\n this.vy += this.gravity;\r\n this.x += this.vx;\r\n this.y += this.vy;\r\n this.alpha -= this.decay;\r\n },\r\n draw(ctx: CanvasRenderingContext2D) {\r\n ctx.save();\r\n ctx.globalAlpha = this.alpha;\r\n ctx.beginPath();\r\n ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);\r\n ctx.fillStyle = this.color;\r\n ctx.fill();\r\n ctx.restore();\r\n },\r\n isAlive() {\r\n return this.alpha > 0;\r\n },\r\n };\r\n};\r\n\r\ninterface FireworkType {\r\n x: number;\r\n y: number;\r\n targetY: number;\r\n color: string;\r\n speed: number;\r\n size: number;\r\n angle: number;\r\n vx: number;\r\n vy: number;\r\n trail: {x: number; y: number}[];\r\n trailLength: number;\r\n exploded: boolean;\r\n update: () => boolean;\r\n explode: () => void;\r\n draw: (ctx: CanvasRenderingContext2D) => void;\r\n}\r\n\r\nconst createFirework = (\r\n x: number,\r\n y: number,\r\n targetY: number,\r\n color: string,\r\n speed: number,\r\n size: number,\r\n particleSpeed: {min: number; max: number} | number,\r\n particleSize: {min: number; max: number} | number,\r\n onExplode: (particles: ParticleType[]) => void,\r\n): FireworkType => {\r\n const angle = -Math.PI / 2 + rand(-0.3, 0.3);\r\n const vx = Math.cos(angle) * speed;\r\n const vy = Math.sin(angle) * speed;\r\n const trail: {x: number; y: number}[] = [];\r\n const trailLength = randInt(10, 25);\r\n\r\n return {\r\n x,\r\n y,\r\n targetY,\r\n color,\r\n speed,\r\n size,\r\n angle,\r\n vx,\r\n vy,\r\n trail,\r\n trailLength,\r\n exploded: false,\r\n update() {\r\n this.trail.push({x: this.x, y: this.y});\r\n if (this.trail.length > this.trailLength) {\r\n this.trail.shift();\r\n }\r\n this.x += this.vx;\r\n this.y += this.vy;\r\n this.vy += 0.02;\r\n if (this.vy >= 0 || this.y <= this.targetY) {\r\n this.explode();\r\n return false;\r\n }\r\n return true;\r\n },\r\n explode() {\r\n const numParticles = randInt(50, 150);\r\n const particles: ParticleType[] = [];\r\n for (let i = 0; i < numParticles; i++) {\r\n const particleAngle = rand(0, Math.PI * 2);\r\n const localParticleSpeed = getValueByRange(particleSpeed);\r\n const localParticleSize = getValueByRange(particleSize);\r\n particles.push(createParticle(this.x, this.y, this.color, localParticleSpeed, particleAngle, 0.05, 0.98, localParticleSize));\r\n }\r\n onExplode(particles);\r\n },\r\n draw(ctx: CanvasRenderingContext2D) {\r\n ctx.save();\r\n ctx.beginPath();\r\n if (this.trail.length > 1) {\r\n ctx.moveTo(this.trail[0].x, this.trail[0].y);\r\n for (const point of this.trail) {\r\n ctx.lineTo(point.x, point.y);\r\n }\r\n } else {\r\n ctx.moveTo(this.x, this.y);\r\n ctx.lineTo(this.x, this.y);\r\n }\r\n ctx.strokeStyle = this.color;\r\n ctx.lineWidth = this.size;\r\n ctx.lineCap = \"round\";\r\n ctx.stroke();\r\n ctx.restore();\r\n },\r\n };\r\n};\r\n\r\nconst getValueByRange = (range: {min: number; max: number} | number): number => {\r\n if (typeof range === \"number\") {\r\n return range;\r\n }\r\n return rand(range.min, range.max);\r\n};\r\n\r\nconst getColor = (color: string | string[] | undefined): string => {\r\n if (Array.isArray(color)) {\r\n return color[randInt(0, color.length)];\r\n }\r\n return color ?? randColor();\r\n};\r\n\r\ninterface FireworksBackgroundProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"color\"> {\r\n canvasProps?: React.HTMLAttributes<HTMLCanvasElement>;\r\n population?: number;\r\n color?: string | string[];\r\n fireworkSpeed?: {min: number; max: number} | number;\r\n fireworkSize?: {min: number; max: number} | number;\r\n particleSpeed?: {min: number; max: number} | number;\r\n particleSize?: {min: number; max: number} | number;\r\n}\r\n\r\nconst FireworksBackground = React.forwardRef<HTMLDivElement, FireworksBackgroundProps>(\r\n (\r\n {\r\n className,\r\n canvasProps,\r\n population = 1,\r\n color,\r\n fireworkSpeed = {min: 4, max: 8},\r\n fireworkSize = {min: 2, max: 5},\r\n particleSpeed = {min: 2, max: 7},\r\n particleSize = {min: 1, max: 5},\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const canvasRef = React.useRef<HTMLCanvasElement>(null);\r\n const containerRef = React.useRef<HTMLDivElement>(null);\r\n React.useImperativeHandle(ref, () => containerRef.current as HTMLDivElement);\r\n\r\n React.useEffect(() => {\r\n const canvas = canvasRef.current;\r\n const container = containerRef.current;\r\n if (!canvas || !container) return;\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) return;\r\n\r\n let maxX = window.innerWidth;\r\n let ratio = container.offsetHeight / container.offsetWidth;\r\n let maxY = maxX * ratio;\r\n canvas.width = maxX;\r\n canvas.height = maxY;\r\n\r\n const setCanvasSize = () => {\r\n maxX = window.innerWidth;\r\n ratio = container.offsetHeight / container.offsetWidth;\r\n maxY = maxX * ratio;\r\n canvas.width = maxX;\r\n canvas.height = maxY;\r\n };\r\n window.addEventListener(\"resize\", setCanvasSize);\r\n\r\n const explosions: ParticleType[] = [];\r\n const fireworks: FireworkType[] = [];\r\n\r\n const handleExplosion = (particles: ParticleType[]) => {\r\n explosions.push(...particles);\r\n };\r\n\r\n const launchFirework = () => {\r\n const x = rand(maxX * 0.1, maxX * 0.9);\r\n const y = maxY;\r\n const targetY = rand(maxY * 0.1, maxY * 0.4);\r\n const fireworkColor = getColor(color);\r\n const speed = getValueByRange(fireworkSpeed);\r\n const size = getValueByRange(fireworkSize);\r\n fireworks.push(createFirework(x, y, targetY, fireworkColor, speed, size, particleSpeed, particleSize, handleExplosion));\r\n const timeout = rand(300, 800) / population;\r\n setTimeout(launchFirework, timeout);\r\n };\r\n\r\n launchFirework();\r\n\r\n // eslint-disable-next-line init-declarations -- firework animation id\r\n let animationFrameId: number;\r\n const animate = () => {\r\n ctx.clearRect(0, 0, maxX, maxY);\r\n\r\n for (let i = fireworks.length - 1; i >= 0; i--) {\r\n const firework = fireworks[i];\r\n if (firework.update()) {\r\n firework.draw(ctx);\r\n } else {\r\n fireworks.splice(i, 1);\r\n }\r\n }\r\n\r\n for (let i = explosions.length - 1; i >= 0; i--) {\r\n const particle = explosions[i];\r\n particle.update();\r\n if (particle.isAlive()) {\r\n particle.draw(ctx);\r\n } else {\r\n explosions.splice(i, 1);\r\n }\r\n }\r\n\r\n animationFrameId = requestAnimationFrame(animate);\r\n };\r\n\r\n animate();\r\n\r\n const handleClick = (event: MouseEvent) => {\r\n const x = event.clientX;\r\n const y = maxY;\r\n const targetY = event.clientY;\r\n const fireworkColor = getColor(color);\r\n const speed = getValueByRange(fireworkSpeed);\r\n const size = getValueByRange(fireworkSize);\r\n fireworks.push(createFirework(x, y, targetY, fireworkColor, speed, size, particleSpeed, particleSize, handleExplosion));\r\n };\r\n\r\n container.addEventListener(\"click\", handleClick);\r\n\r\n return () => {\r\n window.removeEventListener(\"resize\", setCanvasSize);\r\n container.removeEventListener(\"click\", handleClick);\r\n cancelAnimationFrame(animationFrameId);\r\n };\r\n }, [population, color, fireworkSpeed, fireworkSize, particleSpeed, particleSize]);\r\n\r\n return (\r\n <div\r\n ref={containerRef}\r\n className={cn(\"relative size-full overflow-hidden\", className)}\r\n {...props}>\r\n <canvas\r\n {...canvasProps}\r\n ref={canvasRef}\r\n className={cn(\"absolute inset-0 size-full\", canvasProps?.className)}\r\n />\r\n </div>\r\n );\r\n },\r\n);\r\n\r\nFireworksBackground.displayName = \"FireworksBackground\";\r\n\r\nexport {FireworksBackground, type FireworksBackgroundProps};\r\n"],"names":["rand","min","max","Math","randInt","randColor","createParticle","x","y","color","speed","direction","gravity","friction","size","vx","vy","alpha","decay","ctx","createFirework","targetY","particleSpeed","particleSize","onExplode","angle","trail","trailLength","numParticles","particles","i","particleAngle","localParticleSpeed","getValueByRange","localParticleSize","point","range","getColor","Array","FireworksBackground","React","className","canvasProps","population","fireworkSpeed","fireworkSize","props","ref","canvasRef","containerRef","canvas","container","maxX","window","ratio","maxY","setCanvasSize","explosions","fireworks","handleExplosion","launchFirework","fireworkColor","timeout","setTimeout","animationFrameId","animate","firework","particle","requestAnimationFrame","handleClick","event","cancelAnimationFrame","cn"],"mappings":";;;;AAMA,MAAMA,OAAO,CAACC,KAAaC,MAAwBC,KAAK,MAAM,KAAMD,CAAAA,MAAMD,GAAE,IAAKA;AACjF,MAAMG,UAAU,CAACH,KAAaC,MAAwBC,KAAK,KAAK,CAACA,KAAK,MAAM,KAAMD,CAAAA,MAAMD,GAAE,IAAKA;AAC/F,MAAMI,YAAY,IAAc,CAAC,IAAI,EAAED,QAAQ,GAAG,KAAK,YAAY,CAAC;AAoBpE,MAAME,iBAAiB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IoC,SAAS,MAAM,IACjBA,SAAS,IAAI,CAAC/C;qBAEduC,UAAU,MAAM,CAAC5B,GAAG;YAExB;YAEA,IAAK,IAAIA,IAAI2B,WAAW,MAAM,GAAG,GAAG3B,KAAK,GAAGA,IAAK;gBAC/C,MAAMqC,WAAWV,UAAU,CAAC3B,EAAE;gBAC9BqC,SAAS,MAAM;gBACf,IAAIA,SAAS,OAAO,IAClBA,SAAS,IAAI,CAAChD;qBAEdsC,WAAW,MAAM,CAAC3B,GAAG;YAEzB;YAEAkC,mBAAmBI,sBAAsBH;QAC3C;QAEAA;QAEA,MAAMI,cAAc,CAACC;YACnB,MAAM/D,IAAI+D,MAAM,OAAO;YACvB,MAAM9D,IAAI+C;YACV,MAAMlC,UAAUiD,MAAM,OAAO;YAC7B,MAAMT,gBAAgBxB,SAAS5B;YAC/B,MAAMC,QAAQuB,gBAAgBW;YAC9B,MAAM9B,OAAOmB,gBAAgBY;YAC7Ba,UAAU,IAAI,CAACtC,eAAeb,GAAGC,GAAGa,SAASwC,eAAenD,OAAOI,MAAMQ,eAAeC,cAAcoC;QACxG;QAEAR,UAAU,gBAAgB,CAAC,SAASkB;QAEpC,OAAO;YACLhB,OAAO,mBAAmB,CAAC,UAAUG;YACrCL,UAAU,mBAAmB,CAAC,SAASkB;YACvCE,qBAAqBP;QACvB;IACF,GAAG;QAACrB;QAAYlC;QAAOmC;QAAeC;QAAcvB;QAAeC;KAAa;IAEhF,OAAO,WAAP,GACE,IAAC;QACC,KAAK0B;QACL,WAAWuB,GAAG,sCAAsC/B;QACnD,GAAGK,KAAK;kBACT,kBAAC;YACE,GAAGJ,WAAW;YACf,KAAKM;YACL,WAAWwB,GAAG,8BAA8B9B,aAAa;;;AAIjE;AAGFH,oBAAoB,WAAW,GAAG"}
1
+ {"version":3,"file":"components/ui/fireworks-background.js","sources":["../../../src/components/ui/fireworks-background.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as React from \"react\";\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\nconst rand = (min: number, max: number): number => Math.random() * (max - min) + min;\r\nconst randInt = (min: number, max: number): number => Math.floor(Math.random() * (max - min) + min);\r\nconst randColor = (): string => `hsl(${randInt(0, 360)}, 100%, 50%)`;\r\n\r\ninterface ParticleType {\r\n x: number;\r\n y: number;\r\n color: string;\r\n speed: number;\r\n direction: number;\r\n vx: number;\r\n vy: number;\r\n gravity: number;\r\n friction: number;\r\n alpha: number;\r\n decay: number;\r\n size: number;\r\n update: () => void;\r\n draw: (ctx: CanvasRenderingContext2D) => void;\r\n isAlive: () => boolean;\r\n}\r\n\r\nconst createParticle = (\r\n x: number,\r\n y: number,\r\n color: string,\r\n speed: number,\r\n direction: number,\r\n gravity: number,\r\n friction: number,\r\n size: number,\r\n): ParticleType => {\r\n const vx = Math.cos(direction) * speed;\r\n const vy = Math.sin(direction) * speed;\r\n const alpha = 1;\r\n const decay = rand(0.005, 0.02);\r\n\r\n return {\r\n x,\r\n y,\r\n color,\r\n speed,\r\n direction,\r\n vx,\r\n vy,\r\n gravity,\r\n friction,\r\n alpha,\r\n decay,\r\n size,\r\n update() {\r\n this.vx *= this.friction;\r\n this.vy *= this.friction;\r\n this.vy += this.gravity;\r\n this.x += this.vx;\r\n this.y += this.vy;\r\n this.alpha -= this.decay;\r\n },\r\n draw(ctx: CanvasRenderingContext2D) {\r\n ctx.save();\r\n ctx.globalAlpha = this.alpha;\r\n ctx.beginPath();\r\n ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);\r\n ctx.fillStyle = this.color;\r\n ctx.fill();\r\n ctx.restore();\r\n },\r\n isAlive() {\r\n return this.alpha > 0;\r\n },\r\n };\r\n};\r\n\r\ninterface FireworkType {\r\n x: number;\r\n y: number;\r\n targetY: number;\r\n color: string;\r\n speed: number;\r\n size: number;\r\n angle: number;\r\n vx: number;\r\n vy: number;\r\n trail: {x: number; y: number}[];\r\n trailLength: number;\r\n exploded: boolean;\r\n update: () => boolean;\r\n explode: () => void;\r\n draw: (ctx: CanvasRenderingContext2D) => void;\r\n}\r\n\r\nconst createFirework = (\r\n x: number,\r\n y: number,\r\n targetY: number,\r\n color: string,\r\n speed: number,\r\n size: number,\r\n particleSpeed: {min: number; max: number} | number,\r\n particleSize: {min: number; max: number} | number,\r\n onExplode: (particles: ParticleType[]) => void,\r\n): FireworkType => {\r\n const angle = -Math.PI / 2 + rand(-0.3, 0.3);\r\n const vx = Math.cos(angle) * speed;\r\n const vy = Math.sin(angle) * speed;\r\n const trail: {x: number; y: number}[] = [];\r\n const trailLength = randInt(10, 25);\r\n\r\n return {\r\n x,\r\n y,\r\n targetY,\r\n color,\r\n speed,\r\n size,\r\n angle,\r\n vx,\r\n vy,\r\n trail,\r\n trailLength,\r\n exploded: false,\r\n update() {\r\n this.trail.push({x: this.x, y: this.y});\r\n if (this.trail.length > this.trailLength) {\r\n this.trail.shift();\r\n }\r\n this.x += this.vx;\r\n this.y += this.vy;\r\n this.vy += 0.02;\r\n if (this.vy >= 0 || this.y <= this.targetY) {\r\n this.explode();\r\n return false;\r\n }\r\n return true;\r\n },\r\n explode() {\r\n const numParticles = randInt(50, 150);\r\n const particles: ParticleType[] = [];\r\n for (let i = 0; i < numParticles; i++) {\r\n const particleAngle = rand(0, Math.PI * 2);\r\n const localParticleSpeed = getValueByRange(particleSpeed);\r\n const localParticleSize = getValueByRange(particleSize);\r\n particles.push(createParticle(this.x, this.y, this.color, localParticleSpeed, particleAngle, 0.05, 0.98, localParticleSize));\r\n }\r\n onExplode(particles);\r\n },\r\n draw(ctx: CanvasRenderingContext2D) {\r\n ctx.save();\r\n ctx.beginPath();\r\n if (this.trail.length > 1) {\r\n ctx.moveTo(this.trail[0].x, this.trail[0].y);\r\n for (const point of this.trail) {\r\n ctx.lineTo(point.x, point.y);\r\n }\r\n } else {\r\n ctx.moveTo(this.x, this.y);\r\n ctx.lineTo(this.x, this.y);\r\n }\r\n ctx.strokeStyle = this.color;\r\n ctx.lineWidth = this.size;\r\n ctx.lineCap = \"round\";\r\n ctx.stroke();\r\n ctx.restore();\r\n },\r\n };\r\n};\r\n\r\nconst getValueByRange = (range: {min: number; max: number} | number): number => {\r\n if (typeof range === \"number\") {\r\n return range;\r\n }\r\n return rand(range.min, range.max);\r\n};\r\n\r\nconst getColor = (color: string | string[] | undefined): string => {\r\n if (Array.isArray(color)) {\r\n return color[randInt(0, color.length)];\r\n }\r\n return color ?? randColor();\r\n};\r\n\r\ninterface FireworksBackgroundProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"color\"> {\r\n canvasProps?: React.HTMLAttributes<HTMLCanvasElement>;\r\n population?: number;\r\n color?: string | string[];\r\n fireworkSpeed?: {min: number; max: number} | number;\r\n fireworkSize?: {min: number; max: number} | number;\r\n particleSpeed?: {min: number; max: number} | number;\r\n particleSize?: {min: number; max: number} | number;\r\n}\r\n\r\nconst FireworksBackground = React.forwardRef<HTMLDivElement, FireworksBackgroundProps>(\r\n (\r\n {\r\n className,\r\n canvasProps,\r\n population = 1,\r\n color,\r\n fireworkSpeed = {min: 4, max: 8},\r\n fireworkSize = {min: 2, max: 5},\r\n particleSpeed = {min: 2, max: 7},\r\n particleSize = {min: 1, max: 5},\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const canvasRef = React.useRef<HTMLCanvasElement>(null);\r\n const containerRef = React.useRef<HTMLDivElement>(null);\r\n React.useImperativeHandle(ref, () => containerRef.current as HTMLDivElement);\r\n\r\n React.useEffect(() => {\r\n const canvas = canvasRef.current;\r\n const container = containerRef.current;\r\n if (!canvas || !container) return;\r\n const ctx = canvas.getContext(\"2d\");\r\n if (!ctx) return;\r\n\r\n let maxX = window.innerWidth;\r\n let ratio = container.offsetHeight / container.offsetWidth;\r\n let maxY = maxX * ratio;\r\n canvas.width = maxX;\r\n canvas.height = maxY;\r\n\r\n const setCanvasSize = () => {\r\n maxX = window.innerWidth;\r\n ratio = container.offsetHeight / container.offsetWidth;\r\n maxY = maxX * ratio;\r\n canvas.width = maxX;\r\n canvas.height = maxY;\r\n };\r\n window.addEventListener(\"resize\", setCanvasSize);\r\n\r\n const explosions: ParticleType[] = [];\r\n const fireworks: FireworkType[] = [];\r\n\r\n const handleExplosion = (particles: ParticleType[]) => {\r\n explosions.push(...particles);\r\n };\r\n\r\n const launchFirework = () => {\r\n const x = rand(maxX * 0.1, maxX * 0.9);\r\n const y = maxY;\r\n const targetY = rand(maxY * 0.1, maxY * 0.4);\r\n const fireworkColor = getColor(color);\r\n const speed = getValueByRange(fireworkSpeed);\r\n const size = getValueByRange(fireworkSize);\r\n fireworks.push(createFirework(x, y, targetY, fireworkColor, speed, size, particleSpeed, particleSize, handleExplosion));\r\n const timeout = rand(300, 800) / population;\r\n setTimeout(launchFirework, timeout);\r\n };\r\n\r\n launchFirework();\r\n\r\n // eslint-disable-next-line init-declarations -- firework animation id\r\n let animationFrameId: number;\r\n const animate = () => {\r\n ctx.clearRect(0, 0, maxX, maxY);\r\n\r\n for (let i = fireworks.length - 1; i >= 0; i--) {\r\n const firework = fireworks[i];\r\n if (firework.update()) {\r\n firework.draw(ctx);\r\n } else {\r\n fireworks.splice(i, 1);\r\n }\r\n }\r\n\r\n for (let i = explosions.length - 1; i >= 0; i--) {\r\n const particle = explosions[i];\r\n particle.update();\r\n if (particle.isAlive()) {\r\n particle.draw(ctx);\r\n } else {\r\n explosions.splice(i, 1);\r\n }\r\n }\r\n\r\n animationFrameId = requestAnimationFrame(animate);\r\n };\r\n\r\n animate();\r\n\r\n const handleClick = (event: MouseEvent) => {\r\n const x = event.clientX;\r\n const y = maxY;\r\n const targetY = event.clientY;\r\n const fireworkColor = getColor(color);\r\n const speed = getValueByRange(fireworkSpeed);\r\n const size = getValueByRange(fireworkSize);\r\n fireworks.push(createFirework(x, y, targetY, fireworkColor, speed, size, particleSpeed, particleSize, handleExplosion));\r\n };\r\n\r\n container.addEventListener(\"click\", handleClick);\r\n\r\n return () => {\r\n window.removeEventListener(\"resize\", setCanvasSize);\r\n container.removeEventListener(\"click\", handleClick);\r\n cancelAnimationFrame(animationFrameId);\r\n };\r\n }, [population, color, fireworkSpeed, fireworkSize, particleSpeed, particleSize]);\r\n\r\n return (\r\n <div\r\n ref={containerRef}\r\n className={cn(\"relative size-full overflow-hidden\", className)}\r\n {...props}>\r\n <canvas\r\n {...canvasProps}\r\n ref={canvasRef}\r\n className={cn(\"absolute inset-0 size-full\", canvasProps?.className)}\r\n />\r\n </div>\r\n );\r\n },\r\n);\r\n\r\nFireworksBackground.displayName = \"FireworksBackground\";\r\n\r\nexport {FireworksBackground, type FireworksBackgroundProps};\r\n"],"names":["rand","min","max","Math","randInt","randColor","createParticle","x","y","color","speed","direction","gravity","friction","size","vx","vy","alpha","decay","ctx","createFirework","targetY","particleSpeed","particleSize","onExplode","angle","trail","trailLength","numParticles","particles","i","particleAngle","localParticleSpeed","getValueByRange","localParticleSize","point","range","getColor","Array","FireworksBackground","React","className","canvasProps","population","fireworkSpeed","fireworkSize","props","ref","canvasRef","containerRef","canvas","container","maxX","window","ratio","maxY","setCanvasSize","explosions","fireworks","handleExplosion","launchFirework","fireworkColor","timeout","setTimeout","animationFrameId","animate","firework","particle","requestAnimationFrame","handleClick","event","cancelAnimationFrame","cn"],"mappings":";;;;AAMA,MAAMA,OAAO,CAACC,KAAaC,MAAwBC,KAAK,MAAM,KAAMD,CAAAA,MAAMD,GAAE,IAAKA;AACjF,MAAMG,UAAU,CAACH,KAAaC,MAAwBC,KAAK,KAAK,CAACA,KAAK,MAAM,KAAMD,CAAAA,MAAMD,GAAE,IAAKA;AAC/F,MAAMI,YAAY,IAAc,CAAC,IAAI,EAAED,QAAQ,GAAG,KAAK,YAAY,CAAC;AAoBpE,MAAME,iBAAiB,CACrBC,GACAC,GACAC,OACAC,OACAC,WACAC,SACAC,UACAC;IAEA,MAAMC,KAAKZ,KAAK,GAAG,CAACQ,aAAaD;IACjC,MAAMM,KAAKb,KAAK,GAAG,CAACQ,aAAaD;IACjC,MAAMO,QAAQ;IACd,MAAMC,QAAQlB,KAAK,OAAO;IAE1B,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K;gBAC/C,MAAMqC,WAAWV,UAAU,CAAC3B,EAAE;gBAC9BqC,SAAS,MAAM;gBACf,IAAIA,SAAS,OAAO,IAClBA,SAAS,IAAI,CAAChD;qBAEdsC,WAAW,MAAM,CAAC3B,GAAG;YAEzB;YAEAkC,mBAAmBI,sBAAsBH;QAC3C;QAEAA;QAEA,MAAMI,cAAc,CAACC;YACnB,MAAM/D,IAAI+D,MAAM,OAAO;YACvB,MAAM9D,IAAI+C;YACV,MAAMlC,UAAUiD,MAAM,OAAO;YAC7B,MAAMT,gBAAgBxB,SAAS5B;YAC/B,MAAMC,QAAQuB,gBAAgBW;YAC9B,MAAM9B,OAAOmB,gBAAgBY;YAC7Ba,UAAU,IAAI,CAACtC,eAAeb,GAAGC,GAAGa,SAASwC,eAAenD,OAAOI,MAAMQ,eAAeC,cAAcoC;QACxG;QAEAR,UAAU,gBAAgB,CAAC,SAASkB;QAEpC,OAAO;YACLhB,OAAO,mBAAmB,CAAC,UAAUG;YACrCL,UAAU,mBAAmB,CAAC,SAASkB;YACvCE,qBAAqBP;QACvB;IACF,GAAG;QAACrB;QAAYlC;QAAOmC;QAAeC;QAAcvB;QAAeC;KAAa;IAEhF,OAAO,WAAP,GACE,IAAC;QACC,KAAK0B;QACL,WAAWuB,GAAG,sCAAsC/B;QACnD,GAAGK,KAAK;kBACT,kBAAC;YACE,GAAGJ,WAAW;YACf,KAAKM;YACL,WAAWwB,GAAG,8BAA8B9B,aAAa;;;AAIjE;AAGFH,oBAAoB,WAAW,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"components\\ui\\flip-button.js","sources":["webpack://@arolariu/components/./src/components/ui/flip-button.tsx"],"sourcesContent":["\r\n\r\nimport {type HTMLMotionProps, type Transition, type Variant, motion} from \"motion/react\";\r\nimport * as React from \"react\";\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\ntype FlipDirection = \"top\" | \"bottom\" | \"left\" | \"righ\";\r\n\r\ninterface FlipButtonProps extends HTMLMotionProps<\"button\"> {\r\n frontText: string;\r\n backText: string;\r\n transition?: Transition;\r\n frontClassName?: string;\r\n backClassName?: string;\r\n from?: FlipDirection;\r\n}\r\n\r\nconst defaultSpanClassName = \"absolute inset-0 flex items-center justify-center rounded-lg\";\r\n\r\nconst FlipButton = React.forwardRef<HTMLButtonElement, FlipButtonProps>(\r\n (\r\n {\r\n frontText,\r\n backText,\r\n transition = {type: \"spring\", stiffness: 280, damping: 20},\r\n className,\r\n frontClassName,\r\n backClassName,\r\n from = \"top\",\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const isVertical = from === \"top\" || from === \"bottom\";\r\n const rotateAxis = isVertical ? \"rotateX\" : \"rotateY\";\r\n\r\n const frontOffset = from === \"top\" || from === \"left\" ? \"50%\" : \"-50%\";\r\n const backOffset = from === \"top\" || from === \"left\" ? \"-50%\" : \"50%\";\r\n\r\n const buildVariant = (opacity: number, rotation: number, offset: string | null = null): Variant => ({\r\n opacity,\r\n [rotateAxis]: rotation,\r\n ...(isVertical && offset !== null ? {y: offset} : {}),\r\n ...(!isVertical && offset !== null ? {x: offset} : {}),\r\n });\r\n\r\n const frontVariants = {\r\n initial: buildVariant(1, 0, \"0%\"),\r\n hover: buildVariant(0, 90, frontOffset),\r\n };\r\n\r\n const backVariants = {\r\n initial: buildVariant(0, 90, backOffset),\r\n hover: buildVariant(1, 0, \"0%\"),\r\n };\r\n\r\n return (\r\n <motion.button\r\n ref={ref}\r\n initial='initial'\r\n whileHover='hover'\r\n whileTap={{scale: 0.95}}\r\n className={cn(\r\n \"relative inline-block h-10 cursor-pointer px-4 py-2 text-sm font-medium perspective-[1000px] focus:outline-none\",\r\n className,\r\n )}\r\n {...props}>\r\n <motion.span\r\n variants={frontVariants}\r\n transition={transition}\r\n className={cn(defaultSpanClassName, \"bg-muted text-black dark:text-white\", frontClassName)}>\r\n {frontText}\r\n </motion.span>\r\n <motion.span\r\n variants={backVariants}\r\n transition={transition}\r\n className={cn(defaultSpanClassName, \"bg-primary text-primary-foreground\", backClassName)}>\r\n {backText}\r\n </motion.span>\r\n <span className='invisible'>{frontText}</span>\r\n </motion.button>\r\n );\r\n },\r\n);\r\n\r\nFlipButton.displayName = \"FlipButton\";\r\n\r\nexport {FlipButton, type FlipButtonProps, type FlipDirection};\r\n"],"names":["defaultSpanClassName","FlipButton","React","frontText","backText","transition","className","frontClassName","backClassName","from","props","ref","isVertical","rotateAxis","frontOffset","backOffset","buildVariant","opacity","rotation","offset","frontVariants","backVariants","motion","cn"],"mappings":";;;;;AAkBA,MAAMA,uBAAuB;AAE7B,MAAMC,aAAa,WAAbA,GAAaC,WACjB,CACE,EACEC,SAAS,EACTC,QAAQ,EACRC,aAAa;IAAC,MAAM;IAAU,WAAW;IAAK,SAAS;AAAE,CAAC,EAC1DC,SAAS,EACTC,cAAc,EACdC,aAAa,EACbC,OAAO,KAAK,EACZ,GAAGC,OACJ,EACDC;IAEA,MAAMC,aAAaH,UAAAA,QAAkBA,aAAAA;IACrC,MAAMI,aAAaD,aAAa,YAAY;IAE5C,MAAME,cAAcL,UAAAA,QAAkBA,WAAAA,OAAkB,QAAQ;IAChE,MAAMM,aAAaN,UAAAA,QAAkBA,WAAAA,OAAkB,SAAS;IAEhE,MAAMO,eAAe,CAACC,SAAiBC,UAAkBC,SAAwB,IAAI,GAAe;YAClGF;YACA,CAACJ,WAAW,EAAEK;YACd,GAAIN,cAAcO,SAAAA,SAAkB;gBAAC,GAAGA;YAAM,IAAI,CAAC,CAAC;YACpD,GAAI,CAACP,cAAcO,SAAAA,SAAkB;gBAAC,GAAGA;YAAM,IAAI,CAAC,CAAC;QACvD;IAEA,MAAMC,gBAAgB;QACpB,SAASJ,aAAa,GAAG,GAAG;QAC5B,OAAOA,aAAa,GAAG,IAAIF;IAC7B;IAEA,MAAMO,eAAe;QACnB,SAASL,aAAa,GAAG,IAAID;QAC7B,OAAOC,aAAa,GAAG,GAAG;IAC5B;IAEA,OAAO,WAAP,GACE,KAACM,OAAO,MAAM;QACZ,KAAKX;QACL,SAAQ;QACR,YAAW;QACX,UAAU;YAAC,OAAO;QAAI;QACtB,WAAWY,GACT,mHACAjB;QAED,GAAGI,KAAK;;0BACT,IAACY,OAAO,IAAI;gBACV,UAAUF;gBACV,YAAYf;gBACZ,WAAWkB,GAAGvB,sBAAsB,uCAAuCO;0BAC1EJ;;0BAEH,IAACmB,OAAO,IAAI;gBACV,UAAUD;gBACV,YAAYhB;gBACZ,WAAWkB,GAAGvB,sBAAsB,sCAAsCQ;0BACzEJ;;0BAEH,IAAC;gBAAK,WAAU;0BAAaD;;;;AAGnC;AAGFF,WAAW,WAAW,GAAG"}
1
+ {"version":3,"file":"components/ui/flip-button.js","sources":["../../../src/components/ui/flip-button.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {type HTMLMotionProps, type Transition, type Variant, motion} from \"motion/react\";\r\nimport * as React from \"react\";\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\ntype FlipDirection = \"top\" | \"bottom\" | \"left\" | \"righ\";\r\n\r\ninterface FlipButtonProps extends HTMLMotionProps<\"button\"> {\r\n frontText: string;\r\n backText: string;\r\n transition?: Transition;\r\n frontClassName?: string;\r\n backClassName?: string;\r\n from?: FlipDirection;\r\n}\r\n\r\nconst defaultSpanClassName = \"absolute inset-0 flex items-center justify-center rounded-lg\";\r\n\r\nconst FlipButton = React.forwardRef<HTMLButtonElement, FlipButtonProps>(\r\n (\r\n {\r\n frontText,\r\n backText,\r\n transition = {type: \"spring\", stiffness: 280, damping: 20},\r\n className,\r\n frontClassName,\r\n backClassName,\r\n from = \"top\",\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const isVertical = from === \"top\" || from === \"bottom\";\r\n const rotateAxis = isVertical ? \"rotateX\" : \"rotateY\";\r\n\r\n const frontOffset = from === \"top\" || from === \"left\" ? \"50%\" : \"-50%\";\r\n const backOffset = from === \"top\" || from === \"left\" ? \"-50%\" : \"50%\";\r\n\r\n const buildVariant = (opacity: number, rotation: number, offset: string | null = null): Variant => ({\r\n opacity,\r\n [rotateAxis]: rotation,\r\n ...(isVertical && offset !== null ? {y: offset} : {}),\r\n ...(!isVertical && offset !== null ? {x: offset} : {}),\r\n });\r\n\r\n const frontVariants = {\r\n initial: buildVariant(1, 0, \"0%\"),\r\n hover: buildVariant(0, 90, frontOffset),\r\n };\r\n\r\n const backVariants = {\r\n initial: buildVariant(0, 90, backOffset),\r\n hover: buildVariant(1, 0, \"0%\"),\r\n };\r\n\r\n return (\r\n <motion.button\r\n ref={ref}\r\n initial='initial'\r\n whileHover='hover'\r\n whileTap={{scale: 0.95}}\r\n className={cn(\r\n \"relative inline-block h-10 cursor-pointer px-4 py-2 text-sm font-medium perspective-[1000px] focus:outline-none\",\r\n className,\r\n )}\r\n {...props}>\r\n <motion.span\r\n variants={frontVariants}\r\n transition={transition}\r\n className={cn(defaultSpanClassName, \"bg-muted text-black dark:text-white\", frontClassName)}>\r\n {frontText}\r\n </motion.span>\r\n <motion.span\r\n variants={backVariants}\r\n transition={transition}\r\n className={cn(defaultSpanClassName, \"bg-primary text-primary-foreground\", backClassName)}>\r\n {backText}\r\n </motion.span>\r\n <span className='invisible'>{frontText}</span>\r\n </motion.button>\r\n );\r\n },\r\n);\r\n\r\nFlipButton.displayName = \"FlipButton\";\r\n\r\nexport {FlipButton, type FlipButtonProps, type FlipDirection};\r\n"],"names":["defaultSpanClassName","FlipButton","React","frontText","backText","transition","className","frontClassName","backClassName","from","props","ref","isVertical","rotateAxis","frontOffset","backOffset","buildVariant","opacity","rotation","offset","frontVariants","backVariants","motion","cn"],"mappings":";;;;;AAkBA,MAAMA,uBAAuB;AAE7B,MAAMC,aAAa,WAAbA,GAAaC,WACjB,CACE,EACEC,SAAS,EACTC,QAAQ,EACRC,aAAa;IAAC,MAAM;IAAU,WAAW;IAAK,SAAS;AAAE,CAAC,EAC1DC,SAAS,EACTC,cAAc,EACdC,aAAa,EACbC,OAAO,KAAK,EACZ,GAAGC,OACJ,EACDC;IAEA,MAAMC,aAAaH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M,YAAY;;;;;;;;;;;CAyBjB,CAAC;AAQF,QAAA,MAAM,QAAQ,6GAYZ,CAAC;AAGH,QAAA,MAAM,SAAS,yJAcb,CAAC;AAGH,QAAA,MAAM,WAAW,8JAYf,CAAC;AAGH,QAAA,MAAM,eAAe,yHAWnB,CAAC;AAGH,QAAA,MAAM,WAAW,yHAmBhB,CAAC;AAGF,OAAO,EAAC,IAAI,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAC,CAAC"}
@@ -6,7 +6,7 @@ import { Controller, FormProvider, useFormContext } from "react-hook-form";
6
6
  import { Label } from "./label.js";
7
7
  import { cn } from "../../lib/utilities.js";
8
8
  const Form = FormProvider;
9
- const FormFieldContext = /*#__PURE__*/ createContext({});
9
+ const FormFieldContext = /*#__PURE__*/ createContext(null);
10
10
  const FormField = ({ ...props })=>/*#__PURE__*/ jsx(FormFieldContext.Provider, {
11
11
  value: {
12
12
  name: props.name
@@ -19,8 +19,9 @@ const useFormField = ()=>{
19
19
  const fieldContext = useContext(FormFieldContext);
20
20
  const itemContext = useContext(FormItemContext);
21
21
  const { getFieldState, formState } = useFormContext();
22
- const fieldState = getFieldState(fieldContext.name, formState);
23
22
  if (!fieldContext) throw new Error("useFormField should be used within <FormField>");
23
+ if (!itemContext) throw new Error("useFormField should be used within <FormItem>");
24
+ const fieldState = getFieldState(fieldContext.name, formState);
24
25
  const { id } = itemContext;
25
26
  return {
26
27
  id,
@@ -31,7 +32,7 @@ const useFormField = ()=>{
31
32
  ...fieldState
32
33
  };
33
34
  };
34
- const FormItemContext = /*#__PURE__*/ createContext({});
35
+ const FormItemContext = /*#__PURE__*/ createContext(null);
35
36
  const FormItem = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>{
36
37
  const id = useId();
37
38
  return /*#__PURE__*/ jsx(FormItemContext.Provider, {
@@ -1 +1 @@
1
- {"version":3,"file":"components\\ui\\form.js","sources":["webpack://@arolariu/components/./src/components/ui/form.tsx"],"sourcesContent":["\r\n\r\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\r\nimport {Slot} from \"@radix-ui/react-slot\";\r\nimport * as React from \"react\";\r\nimport {Controller, FormProvider, useFormContext, type ControllerProps, type FieldPath, type FieldValues} from \"react-hook-form\";\r\n\r\nimport {Label} from \"@/components/ui/label\";\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\nconst Form = FormProvider;\r\n\r\ntype FormFieldContextValue<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\r\n> = {\r\n name: TName;\r\n};\r\n\r\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);\r\n\r\nconst FormField = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({\r\n ...props\r\n}: ControllerProps<TFieldValues, TName>) => {\r\n return (\r\n <FormFieldContext.Provider value={{name: props.name}}>\r\n <Controller {...props} />\r\n </FormFieldContext.Provider>\r\n );\r\n};\r\n\r\nconst useFormField = () => {\r\n const fieldContext = React.useContext(FormFieldContext);\r\n const itemContext = React.useContext(FormItemContext);\r\n const {getFieldState, formState} = useFormContext();\r\n\r\n const fieldState = getFieldState(fieldContext.name, formState);\r\n\r\n if (!fieldContext) {\r\n throw new Error(\"useFormField should be used within <FormField>\");\r\n }\r\n\r\n const {id} = itemContext;\r\n\r\n return {\r\n id,\r\n name: fieldContext.name,\r\n formItemId: `${id}-form-item`,\r\n formDescriptionId: `${id}-form-item-description`,\r\n formMessageId: `${id}-form-item-message`,\r\n ...fieldState,\r\n };\r\n};\r\n\r\ntype FormItemContextValue = {\r\n id: string;\r\n};\r\n\r\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);\r\n\r\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({className, ...props}, ref) => {\r\n const id = React.useId();\r\n\r\n return (\r\n <FormItemContext.Provider value={{id}}>\r\n <div\r\n ref={ref}\r\n className={cn(\"space-y-2\", className)}\r\n {...props}\r\n />\r\n </FormItemContext.Provider>\r\n );\r\n});\r\nFormItem.displayName = \"FormItem\";\r\n\r\nconst FormLabel = React.forwardRef<\r\n React.ComponentRef<typeof LabelPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\r\n>(({className, ...props}, ref) => {\r\n const {error, formItemId} = useFormField();\r\n\r\n return (\r\n <Label\r\n ref={ref}\r\n className={cn(error && \"text-red-500 dark:text-red-900\", className)}\r\n htmlFor={formItemId}\r\n {...props}\r\n />\r\n );\r\n});\r\nFormLabel.displayName = \"FormLabel\";\r\n\r\nconst FormControl = React.forwardRef<React.ComponentRef<typeof Slot>, React.ComponentPropsWithoutRef<typeof Slot>>(({...props}, ref) => {\r\n const {error, formItemId, formDescriptionId, formMessageId} = useFormField();\r\n\r\n return (\r\n <Slot\r\n ref={ref}\r\n id={formItemId}\r\n aria-describedby={error ? `${formDescriptionId} ${formMessageId}` : `${formDescriptionId}`}\r\n aria-invalid={Boolean(error)}\r\n {...props}\r\n />\r\n );\r\n});\r\nFormControl.displayName = \"FormControl\";\r\n\r\nconst FormDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(({className, ...props}, ref) => {\r\n const {formDescriptionId} = useFormField();\r\n\r\n return (\r\n <p\r\n ref={ref}\r\n id={formDescriptionId}\r\n className={cn(\"text-[0.8rem] text-neutral-500 dark:text-neutral-400\", className)}\r\n {...props}\r\n />\r\n );\r\n});\r\nFormDescription.displayName = \"FormDescription\";\r\n\r\nconst FormMessage = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(\r\n ({className, children, ...props}, ref) => {\r\n const {error, formMessageId} = useFormField();\r\n const body = error ? String(error?.message ?? \"\") : children;\r\n\r\n if (!body) {\r\n return null;\r\n }\r\n\r\n return (\r\n <p\r\n ref={ref}\r\n id={formMessageId}\r\n className={cn(\"text-[0.8rem] font-medium text-red-500 dark:text-red-900\", className)}\r\n {...props}>\r\n {body}\r\n </p>\r\n );\r\n },\r\n);\r\nFormMessage.displayName = \"FormMessage\";\r\n\r\nexport {Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField};\r\n"],"names":["Form","FormProvider","FormFieldContext","React","FormField","props","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","Error","id","FormItem","className","ref","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","Boolean","FormDescription","FormMessage","children","body","String"],"mappings":";;;;;;;AAUA,MAAMA,OAAOC;AASb,MAAMC,mBAAmB,WAAnBA,GAAmBC,cAA2C,CAAC;AAErE,MAAMC,YAAY,CAAkH,EAClI,GAAGC,OACkC,GAC9B,WAAP,GACE,IAACH,iBAAiB,QAAQ;QAAC,OAAO;YAAC,MAAMG,MAAM,IAAI;QAAA;kBACjD,kBAACC,YAAUA;YAAE,GAAGD,KAAK;;;AAK3B,MAAME,eAAe;IACnB,MAAMC,eAAeL,WAAiBD;IACtC,MAAMO,cAAcN,WAAiBO;IACrC,MAAM,EAACC,aAAa,EAAEC,SAAS,EAAC,GAAGC;IAEnC,MAAMC,aAAaH,cAAcH,aAAa,IAAI,EAAEI;IAEpD,IAAI,CAACJ,cACH,MAAM,IAAIO,MAAM;IAGlB,MAAM,EAACC,EAAE,EAAC,GAAGP;IAEb,OAAO;QACLO;QACA,MAAMR,aAAa,IAAI;QACvB,YAAY,GAAGQ,GAAG,UAAU,CAAC;QAC7B,mBAAmB,GAAGA,GAAG,sBAAsB,CAAC;QAChD,eAAe,GAAGA,GAAG,kBAAkB,CAAC;QACxC,GAAGF,UAAU;IACf;AACF;AAMA,MAAMJ,kBAAkB,WAAlBA,GAAkBP,cAA0C,CAAC;AAEnE,MAAMc,WAAW,WAAXA,GAAWd,WAAuE,CAAC,EAACe,SAAS,EAAE,GAAGb,OAAM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EAAEc;IAChC,MAAM,EAACG,KAAK,EAAEK,aAAa,EAAC,GAAGpB;IAC/B,MAAM0B,OAAOX,QAAQY,OAAOZ,OAAO,WAAW,MAAMU;IAEpD,IAAI,CAACC,MACH,OAAO;IAGT,OAAO,WAAP,GACE,IAAC;QACC,KAAKd;QACL,IAAIQ;QACJ,WAAWP,GAAG,4DAA4DF;QACzE,GAAGb,KAAK;kBACR4B;;AAGP;AAEFF,YAAY,WAAW,GAAG"}
1
+ {"version":3,"file":"components/ui/form.js","sources":["../../../src/components/ui/form.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\r\nimport {Slot} from \"@radix-ui/react-slot\";\r\nimport * as React from \"react\";\r\nimport {Controller, FormProvider, useFormContext, type ControllerProps, type FieldPath, type FieldValues} from \"react-hook-form\";\r\n\r\nimport {Label} from \"@/components/ui/label\";\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\nconst Form = FormProvider;\r\n\r\ntype FormFieldContextValue<\r\n TFieldValues extends FieldValues = FieldValues,\r\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\r\n> = {\r\n name: TName;\r\n};\r\n\r\nconst FormFieldContext = React.createContext<FormFieldContextValue | null>(null);\r\n\r\nconst FormField = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({\r\n ...props\r\n}: ControllerProps<TFieldValues, TName>) => {\r\n return (\r\n <FormFieldContext.Provider value={{name: props.name}}>\r\n <Controller {...props} />\r\n </FormFieldContext.Provider>\r\n );\r\n};\r\n\r\nconst useFormField = () => {\r\n const fieldContext = React.useContext(FormFieldContext);\r\n const itemContext = React.useContext(FormItemContext);\r\n const {getFieldState, formState} = useFormContext();\r\n\r\n if (!fieldContext) {\r\n throw new Error(\"useFormField should be used within <FormField>\");\r\n }\r\n\r\n if (!itemContext) {\r\n throw new Error(\"useFormField should be used within <FormItem>\");\r\n }\r\n\r\n const fieldState = getFieldState(fieldContext.name, formState);\r\n\r\n const {id} = itemContext;\r\n\r\n return {\r\n id,\r\n name: fieldContext.name,\r\n formItemId: `${id}-form-item`,\r\n formDescriptionId: `${id}-form-item-description`,\r\n formMessageId: `${id}-form-item-message`,\r\n ...fieldState,\r\n };\r\n};\r\n\r\ntype FormItemContextValue = {\r\n id: string;\r\n};\r\n\r\nconst FormItemContext = React.createContext<FormItemContextValue | null>(null);\r\n\r\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({className, ...props}, ref) => {\r\n const id = React.useId();\r\n\r\n return (\r\n <FormItemContext.Provider value={{id}}>\r\n <div\r\n ref={ref}\r\n className={cn(\"space-y-2\", className)}\r\n {...props}\r\n />\r\n </FormItemContext.Provider>\r\n );\r\n});\r\nFormItem.displayName = \"FormItem\";\r\n\r\nconst FormLabel = React.forwardRef<\r\n React.ComponentRef<typeof LabelPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\r\n>(({className, ...props}, ref) => {\r\n const {error, formItemId} = useFormField();\r\n\r\n return (\r\n <Label\r\n ref={ref}\r\n className={cn(error && \"text-red-500 dark:text-red-900\", className)}\r\n htmlFor={formItemId}\r\n {...props}\r\n />\r\n );\r\n});\r\nFormLabel.displayName = \"FormLabel\";\r\n\r\nconst FormControl = React.forwardRef<React.ComponentRef<typeof Slot>, React.ComponentPropsWithoutRef<typeof Slot>>(({...props}, ref) => {\r\n const {error, formItemId, formDescriptionId, formMessageId} = useFormField();\r\n\r\n return (\r\n <Slot\r\n ref={ref}\r\n id={formItemId}\r\n aria-describedby={error ? `${formDescriptionId} ${formMessageId}` : `${formDescriptionId}`}\r\n aria-invalid={Boolean(error)}\r\n {...props}\r\n />\r\n );\r\n});\r\nFormControl.displayName = \"FormControl\";\r\n\r\nconst FormDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(({className, ...props}, ref) => {\r\n const {formDescriptionId} = useFormField();\r\n\r\n return (\r\n <p\r\n ref={ref}\r\n id={formDescriptionId}\r\n className={cn(\"text-[0.8rem] text-neutral-500 dark:text-neutral-400\", className)}\r\n {...props}\r\n />\r\n );\r\n});\r\nFormDescription.displayName = \"FormDescription\";\r\n\r\nconst FormMessage = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(\r\n ({className, children, ...props}, ref) => {\r\n const {error, formMessageId} = useFormField();\r\n const body = error ? String(error?.message ?? \"\") : children;\r\n\r\n if (!body) {\r\n return null;\r\n }\r\n\r\n return (\r\n <p\r\n ref={ref}\r\n id={formMessageId}\r\n className={cn(\"text-[0.8rem] font-medium text-red-500 dark:text-red-900\", className)}\r\n {...props}>\r\n {body}\r\n </p>\r\n );\r\n },\r\n);\r\nFormMessage.displayName = \"FormMessage\";\r\n\r\nexport {Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField};\r\n"],"names":["Form","FormProvider","FormFieldContext","React","FormField","props","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","Error","fieldState","id","FormItem","className","ref","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","Boolean","FormDescription","FormMessage","children","body","String"],"mappings":";;;;;;;AAUA,MAAMA,OAAOC;AASb,MAAMC,mBAAmB,WAAnBA,GAAmBC,cAAkD;AAE3E,MAAMC,YAAY,CAAkH,EAClI,GAAGC,OACkC,GAC9B,WAAP,GACE,IAACH,iBAAiB,QAAQ;QAAC,OAAO;YAAC,MAAMG,MAAM,IAAI;QAAA;kBACjD,kBAACC,YAAUA;YAAE,GAAGD,KAAK;;;AAK3B,MAAME,eAAe;IACnB,MAAMC,eAAeL,WAAiBD;IACtC,MAAMO,cAAcN,WAAiBO;IACrC,MAAM,EAACC,aAAa,EAAEC,SAAS,EAAC,GAAGC;IAEnC,IAAI,CAACL,cACH,MAAM,IAAIM,MAAM;IAGlB,IAAI,CAACL,aACH,MAAM,IAAIK,MAAM;IAGlB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AAGf;AACAoB,YAAY,WAAW,GAAG;AAE1B,MAAMK,kBAAkB,WAAlBA,GAAkB3B,WAAmF,CAAC,EAACe,SAAS,EAAE,GAAGb,OAAM,EAAEc;IACjI,MAAM,EAACO,iBAAiB,EAAC,GAAGnB;IAE5B,OAAO,WAAP,GACE,IAAC;QACC,KAAKY;QACL,IAAIO;QACJ,WAAWN,GAAG,wDAAwDF;QACrE,GAAGb,KAAK;;AAGf;AACAyB,gBAAgB,WAAW,GAAG;AAE9B,MAAMC,cAAc,WAAdA,GAAc5B,WAClB,CAAC,EAACe,SAAS,EAAEc,QAAQ,EAAE,GAAG3B,OAAM,EAAEc;IAChC,MAAM,EAACG,KAAK,EAAEK,aAAa,EAAC,GAAGpB;IAC/B,MAAM0B,OAAOX,QAAQY,OAAOZ,OAAO,WAAW,MAAMU;IAEpD,IAAI,CAACC,MACH,OAAO;IAGT,OAAO,WAAP,GACE,IAAC;QACC,KAAKd;QACL,IAAIQ;QACJ,WAAWP,GAAG,4DAA4DF;QACzE,GAAGb,KAAK;kBACR4B;;AAGP;AAEFF,YAAY,WAAW,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"components\\ui\\gradient-background.js","sources":["webpack://@arolariu/components/./src/components/ui/gradient-background.tsx"],"sourcesContent":["\r\n\r\nimport {HTMLMotionProps, motion, type Transition} from \"motion/react\";\r\nimport * as React from \"react\";\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\ninterface GradientBackgroundProps extends HTMLMotionProps<\"div\"> {\r\n transition?: Transition;\r\n}\r\n\r\nconst GradientBackground = React.forwardRef<HTMLDivElement, GradientBackgroundProps>(\r\n ({className, transition = {duration: 15, ease: \"easeInOut\", repeat: Infinity}, ...props}, ref) => {\r\n return (\r\n <motion.div\r\n ref={ref}\r\n className={cn(\"size-full bg-gradient-to-br from-blue-500 via-purple-500 to-pink-500 bg-[length:400%_400%]\", className)}\r\n animate={{\r\n backgroundPosition: [\"0% 50%\", \"100% 50%\", \"0% 50%\"],\r\n }}\r\n transition={transition}\r\n {...props}\r\n />\r\n );\r\n },\r\n);\r\n\r\nGradientBackground.displayName = \"GradientBackground\";\r\n\r\nexport {GradientBackground, type GradientBackgroundProps};\r\n"],"names":["GradientBackground","React","className","transition","Infinity","props","ref","motion","cn"],"mappings":";;;;;AAWA,MAAMA,qBAAqB,WAArBA,GAAqBC,WACzB,CAAC,EAACC,SAAS,EAAEC,aAAa;IAAC,UAAU;IAAI,MAAM;IAAa,QAAQC;AAAQ,CAAC,EAAE,GAAGC,OAAM,EAAEC,MACjF,WAAP,GACE,IAACC,OAAO,GAAG;QACT,KAAKD;QACL,WAAWE,GAAG,8FAA8FN;QAC5G,SAAS;YACP,oBAAoB;gBAAC;gBAAU;gBAAY;aAAS;QACtD;QACA,YAAYC;QACX,GAAGE,KAAK;;AAMjBL,mBAAmB,WAAW,GAAG"}
1
+ {"version":3,"file":"components/ui/gradient-background.js","sources":["../../../src/components/ui/gradient-background.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {HTMLMotionProps, motion, type Transition} from \"motion/react\";\r\nimport * as React from \"react\";\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\ninterface GradientBackgroundProps extends HTMLMotionProps<\"div\"> {\r\n transition?: Transition;\r\n}\r\n\r\nconst GradientBackground = React.forwardRef<HTMLDivElement, GradientBackgroundProps>(\r\n ({className, transition = {duration: 15, ease: \"easeInOut\", repeat: Infinity}, ...props}, ref) => {\r\n return (\r\n <motion.div\r\n ref={ref}\r\n className={cn(\"size-full bg-gradient-to-br from-blue-500 via-purple-500 to-pink-500 bg-[length:400%_400%]\", className)}\r\n animate={{\r\n backgroundPosition: [\"0% 50%\", \"100% 50%\", \"0% 50%\"],\r\n }}\r\n transition={transition}\r\n {...props}\r\n />\r\n );\r\n },\r\n);\r\n\r\nGradientBackground.displayName = \"GradientBackground\";\r\n\r\nexport {GradientBackground, type GradientBackgroundProps};\r\n"],"names":["GradientBackground","React","className","transition","Infinity","props","ref","motion","cn"],"mappings":";;;;;AAWA,MAAMA,qBAAqB,WAArBA,GAAqBC,WACzB,CAAC,EAACC,SAAS,EAAEC,aAAa;IAAC,UAAU;IAAI,MAAM;IAAa,QAAQC;AAAQ,CAAC,EAAE,GAAGC,OAAM,EAAEC,MACjF,WAAP,GACE,IAACC,OAAO,GAAG;QACT,KAAKD;QACL,WAAWE,GAAG,8FAA8FN;QAC5G,SAAS;YACP,oBAAoB;gBAAC;gBAAU;gBAAY;aAAS;QACtD;QACA,YAAYC;QACX,GAAGE,KAAK;;AAMjBL,mBAAmB,WAAW,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"components\\ui\\gradient-text.js","sources":["webpack://@arolariu/components/./src/components/ui/gradient-text.tsx"],"sourcesContent":["\r\n\r\nimport {motion, type Transition} from \"motion/react\";\r\nimport * as React from \"react\";\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\ninterface GradientTextProps extends React.HTMLAttributes<HTMLSpanElement> {\r\n text: string;\r\n gradient?: string;\r\n neon?: boolean;\r\n transition?: Transition;\r\n}\r\n\r\nconst GradientText = React.forwardRef<HTMLSpanElement, GradientTextProps>(\r\n (\r\n {\r\n text,\r\n className,\r\n gradient = \"linear-gradient(90deg, #3b82f6 0%, #a855f7 20%, #ec4899 50%, #a855f7 80%, #3b82f6 100%)\",\r\n neon = false,\r\n transition = {duration: 50, repeat: Infinity, ease: \"linear\"},\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const baseStyle: React.CSSProperties = {\r\n backgroundImage: gradient,\r\n };\r\n\r\n return (\r\n <span\r\n ref={ref}\r\n className={cn(\"relative inline-block\", className)}\r\n {...props}>\r\n <motion.span\r\n className='m-0 bg-[length:700%_100%] bg-clip-text bg-[position:0%_0%] text-transparent'\r\n style={baseStyle}\r\n initial={{backgroundPosition: \"0% 0%\"}}\r\n animate={{backgroundPosition: \"500% 100%\"}}\r\n transition={transition}>\r\n {text}\r\n </motion.span>\r\n\r\n {Boolean(neon) && (\r\n <motion.span\r\n className='absolute top-0 left-0 m-0 bg-[length:700%_100%] bg-clip-text bg-[position:0%_0%] text-transparent mix-blend-plus-lighter blur-[8px]'\r\n style={baseStyle}\r\n initial={{backgroundPosition: \"0% 0%\"}}\r\n animate={{backgroundPosition: \"500% 100%\"}}\r\n transition={transition}>\r\n {text}\r\n </motion.span>\r\n )}\r\n </span>\r\n );\r\n },\r\n);\r\n\r\nGradientText.displayName = \"GradientText\";\r\n\r\nexport {GradientText, type GradientTextProps};\r\n"],"names":["GradientText","React","text","className","gradient","neon","transition","Infinity","props","ref","baseStyle","cn","motion","Boolean"],"mappings":";;;;;AAcA,MAAMA,eAAe,WAAfA,GAAeC,WACnB,CACE,EACEC,IAAI,EACJC,SAAS,EACTC,WAAW,yFAAyF,EACpGC,OAAO,KAAK,EACZC,aAAa;IAAC,UAAU;IAAI,QAAQC;IAAU,MAAM;AAAQ,CAAC,EAC7D,GAAGC,OACJ,EACDC;IAEA,MAAMC,YAAiC;QACrC,iBAAiBN;IACnB;IAEA,OAAO,WAAP,GACE,KAAC;QACC,KAAKK;QACL,WAAWE,GAAG,yBAAyBR;QACtC,GAAGK,KAAK;;0BACT,IAACI,OAAO,IAAI;gBACV,WAAU;gBACV,OAAOF;gBACP,SAAS;oBAAC,oBAAoB;gBAAO;gBACrC,SAAS;oBAAC,oBAAoB;gBAAW;gBACzC,YAAYJ;0BACXJ;;YAGFW,QAAQR,SAAS,WAATA,GACP,IAACO,OAAO,IAAI;gBACV,WAAU;gBACV,OAAOF;gBACP,SAAS;oBAAC,oBAAoB;gBAAO;gBACrC,SAAS;oBAAC,oBAAoB;gBAAW;gBACzC,YAAYJ;0BACXJ;;;;AAKX;AAGFF,aAAa,WAAW,GAAG"}
1
+ {"version":3,"file":"components/ui/gradient-text.js","sources":["../../../src/components/ui/gradient-text.tsx"],"sourcesContent":["\"use client\";\r\n\r\nimport {motion, type Transition} from \"motion/react\";\r\nimport * as React from \"react\";\r\n\r\nimport {cn} from \"@/lib/utilities\";\r\n\r\ninterface GradientTextProps extends React.HTMLAttributes<HTMLSpanElement> {\r\n text: string;\r\n gradient?: string;\r\n neon?: boolean;\r\n transition?: Transition;\r\n}\r\n\r\nconst GradientText = React.forwardRef<HTMLSpanElement, GradientTextProps>(\r\n (\r\n {\r\n text,\r\n className,\r\n gradient = \"linear-gradient(90deg, #3b82f6 0%, #a855f7 20%, #ec4899 50%, #a855f7 80%, #3b82f6 100%)\",\r\n neon = false,\r\n transition = {duration: 50, repeat: Infinity, ease: \"linear\"},\r\n ...props\r\n },\r\n ref,\r\n ) => {\r\n const baseStyle: React.CSSProperties = {\r\n backgroundImage: gradient,\r\n };\r\n\r\n return (\r\n <span\r\n ref={ref}\r\n className={cn(\"relative inline-block\", className)}\r\n {...props}>\r\n <motion.span\r\n className='m-0 bg-[length:700%_100%] bg-clip-text bg-[position:0%_0%] text-transparent'\r\n style={baseStyle}\r\n initial={{backgroundPosition: \"0% 0%\"}}\r\n animate={{backgroundPosition: \"500% 100%\"}}\r\n transition={transition}>\r\n {text}\r\n </motion.span>\r\n\r\n {Boolean(neon) && (\r\n <motion.span\r\n className='absolute top-0 left-0 m-0 bg-[length:700%_100%] bg-clip-text bg-[position:0%_0%] text-transparent mix-blend-plus-lighter blur-[8px]'\r\n style={baseStyle}\r\n initial={{backgroundPosition: \"0% 0%\"}}\r\n animate={{backgroundPosition: \"500% 100%\"}}\r\n transition={transition}>\r\n {text}\r\n </motion.span>\r\n )}\r\n </span>\r\n );\r\n },\r\n);\r\n\r\nGradientText.displayName = \"GradientText\";\r\n\r\nexport {GradientText, type GradientTextProps};\r\n"],"names":["GradientText","React","text","className","gradient","neon","transition","Infinity","props","ref","baseStyle","cn","motion","Boolean"],"mappings":";;;;;AAcA,MAAMA,eAAe,WAAfA,GAAeC,WACnB,CACE,EACEC,IAAI,EACJC,SAAS,EACTC,WAAW,yFAAyF,EACpGC,OAAO,KAAK,EACZC,aAAa;IAAC,UAAU;IAAI,QAAQC;IAAU,MAAM;AAAQ,CAAC,EAC7D,GAAGC,OACJ,EACDC;IAEA,MAAMC,YAAiC;QACrC,iBAAiBN;IACnB;IAEA,OAAO,WAAP,GACE,KAAC;QACC,KAAKK;QACL,WAAWE,GAAG,yBAAyBR;QACtC,GAAGK,KAAK;;0BACT,IAACI,OAAO,IAAI;gBACV,WAAU;gBACV,OAAOF;gBACP,SAAS;oBAAC,oBAAoB;gBAAO;gBACrC,SAAS;oBAAC,oBAAoB;gBAAW;gBACzC,YAAYJ;0BACXJ;;YAGFW,QAAQR,SAAS,WAATA,GACP,IAACO,OAAO,IAAI;gBACV,WAAU;gBACV,OAAOF;gBACP,SAAS;oBAAC,oBAAoB;gBAAO;gBACrC,SAAS;oBAAC,oBAAoB;gBAAW;gBACzC,YAAYJ;0BACXJ;;;;AAKX;AAGFF,aAAa,WAAW,GAAG"}