@betterinternship/components 3.0.3 → 3.1.0

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 (67) hide show
  1. package/dist/components/animated-shiny-text.js +12 -0
  2. package/dist/components/animated-shiny-text.js.map +1 -0
  3. package/dist/components/autocomplete.js +335 -0
  4. package/dist/components/autocomplete.js.map +1 -0
  5. package/dist/components/carousel.js +126 -0
  6. package/dist/components/carousel.js.map +1 -0
  7. package/dist/components/chip-select.js +22 -0
  8. package/dist/components/chip-select.js.map +1 -0
  9. package/dist/components/collapsible.js +45 -0
  10. package/dist/components/collapsible.js.map +1 -0
  11. package/dist/components/context-menu.js +37 -0
  12. package/dist/components/context-menu.js.map +1 -0
  13. package/dist/components/dialog.js +10 -10
  14. package/dist/components/dialog.js.map +1 -1
  15. package/dist/components/dot-matrix.js +163 -0
  16. package/dist/components/dot-matrix.js.map +1 -0
  17. package/dist/components/dropdown.js +262 -0
  18. package/dist/components/dropdown.js.map +1 -0
  19. package/dist/components/error.js +19 -0
  20. package/dist/components/error.js.map +1 -0
  21. package/dist/components/fab.js +9 -0
  22. package/dist/components/fab.js.map +1 -0
  23. package/dist/components/form.js +71 -0
  24. package/dist/components/form.js.map +1 -0
  25. package/dist/components/hover-card.js +13 -0
  26. package/dist/components/hover-card.js.map +1 -0
  27. package/dist/components/input-otp.js +24 -0
  28. package/dist/components/input-otp.js.map +1 -0
  29. package/dist/components/magnetic-button.js +32 -0
  30. package/dist/components/magnetic-button.js.map +1 -0
  31. package/dist/components/messages.js +9 -0
  32. package/dist/components/messages.js.map +1 -0
  33. package/dist/components/mobile-sheet-portal.js +17 -0
  34. package/dist/components/mobile-sheet-portal.js.map +1 -0
  35. package/dist/components/paginator.js +44 -0
  36. package/dist/components/paginator.js.map +1 -0
  37. package/dist/components/progress.js +11 -0
  38. package/dist/components/progress.js.map +1 -0
  39. package/dist/components/sheet.d.ts +1 -1
  40. package/dist/components/sheet.js +40 -0
  41. package/dist/components/sheet.js.map +1 -0
  42. package/dist/components/slider.js +11 -0
  43. package/dist/components/slider.js.map +1 -0
  44. package/dist/components/sonner-toast.js +78 -0
  45. package/dist/components/sonner-toast.js.map +1 -0
  46. package/dist/components/timeline.js +16 -0
  47. package/dist/components/timeline.js.map +1 -0
  48. package/dist/components/toggle.js +15 -0
  49. package/dist/components/toggle.js.map +1 -0
  50. package/dist/hooks/use-detect-click-outside.js +29 -0
  51. package/dist/hooks/use-detect-click-outside.js.map +1 -0
  52. package/dist/hooks/use-resource-table.js +284 -0
  53. package/dist/hooks/use-resource-table.js.map +1 -0
  54. package/dist/index.d.ts +33 -0
  55. package/dist/index.js +31 -0
  56. package/dist/index.js.map +1 -1
  57. package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +1670 -0
  58. package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js.map +1 -0
  59. package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +38 -0
  60. package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js.map +1 -0
  61. package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +39 -0
  62. package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js.map +1 -0
  63. package/dist/node_modules/input-otp/dist/index.js +25 -0
  64. package/dist/node_modules/input-otp/dist/index.js.map +1 -0
  65. package/dist/node_modules/react-hook-form/dist/index.esm.js +706 -0
  66. package/dist/node_modules/react-hook-form/dist/index.esm.js.map +1 -0
  67. package/package.json +37 -2
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import { ChevronDown } from 'lucide-react';
5
+ import { cn } from '../utils.js';
6
+
7
+ const CollapsibleContext = React.createContext(null);
8
+ function useCollapsible() {
9
+ const context = React.useContext(CollapsibleContext);
10
+ if (!context)
11
+ throw new Error("Collapsible parts must be used inside Collapsible");
12
+ return context;
13
+ }
14
+ function Collapsible({ open: controlledOpen, defaultOpen = false, onOpenChange, className, children, title, divider = false, ...props }) {
15
+ const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
16
+ const open = controlledOpen ?? uncontrolledOpen;
17
+ const toggle = () => {
18
+ const next = !open;
19
+ if (controlledOpen === undefined)
20
+ setUncontrolledOpen(next);
21
+ onOpenChange?.(next);
22
+ };
23
+ return jsx(CollapsibleContext.Provider, { value: { open, toggle }, children: jsx("div", { className: cn("w-full overflow-hidden rounded-control-lg border border-input bg-background", className), "data-state": open ? "open" : "closed", ...props, children: title !== undefined ? jsxs(Fragment, { children: [jsxs(CollapsibleTrigger, { className: "flex w-full items-center justify-between gap-2 p-4 text-left text-sm font-semibold transition-colors duration-state hover:bg-muted motion-reduce:transition-none focus-visible:outline-3 focus-visible:-outline-offset-4 focus-visible:outline-landing-blue", children: [jsx("span", { children: title }), jsx(ChevronDown, { "aria-hidden": "true", className: cn("h-5 w-5 shrink-0 transition-transform duration-state ease-landing-out motion-reduce:transition-none", open && "rotate-180") })] }), jsx(CollapsibleContent, { divider: divider, children: jsx("div", { className: "px-4 pb-4 pt-4", children: children }) })] }) : children }) });
24
+ }
25
+ function CollapsibleTrigger({ asChild, className, children, onClick, ...props }) {
26
+ const { open, toggle } = useCollapsible();
27
+ const handleClick = (event) => { onClick?.(event); if (!event.defaultPrevented)
28
+ toggle(); };
29
+ if (asChild && React.isValidElement(children)) {
30
+ return React.cloneElement(children, {
31
+ ...props,
32
+ 'aria-expanded': open,
33
+ 'data-state': open ? 'open' : 'closed',
34
+ onClick: handleClick,
35
+ });
36
+ }
37
+ return jsx("button", { type: "button", ...props, "aria-expanded": open, "data-state": open ? "open" : "closed", className: className, onClick: handleClick, children: children });
38
+ }
39
+ function CollapsibleContent({ className, children, divider = false, style, ...props }) {
40
+ const { open } = useCollapsible();
41
+ return jsx("div", { className: cn("grid transition-[grid-template-rows] duration-state ease-landing-out motion-reduce:transition-none", divider && open && "border-t border-border", className), style: { gridTemplateRows: open ? "1fr" : "0fr", ...style }, "aria-hidden": !open, inert: !open, ...props, children: jsx("div", { className: "min-h-0 overflow-hidden", children: jsx("div", { className: cn("origin-top transition-[opacity,transform,filter] duration-state ease-landing-out motion-reduce:transform-none motion-reduce:filter-none motion-reduce:transition-none", open ? "scale-100 opacity-100 blur-none" : "scale-[0.98] opacity-0 blur-sm"), children: children }) }) });
42
+ }
43
+
44
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger };
45
+ //# sourceMappingURL=collapsible.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collapsible.js","sources":["../../src/components/collapsible.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { cn } from \"@/utils\";\n\ntype ContextValue = { open: boolean; toggle: () => void };\nconst CollapsibleContext = React.createContext<ContextValue | null>(null);\n\nfunction useCollapsible() {\n const context = React.useContext(CollapsibleContext);\n if (!context) throw new Error(\"Collapsible parts must be used inside Collapsible\");\n return context;\n}\n\nfunction Collapsible({ open: controlledOpen, defaultOpen = false, onOpenChange, className, children, title, divider = false, ...props }: {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n className?: string;\n children: React.ReactNode;\n /** Optional heading for the ready-to-use collapsible panel. */\n title?: string;\n divider?: boolean;\n} & React.HTMLAttributes<HTMLDivElement>) {\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\n const open = controlledOpen ?? uncontrolledOpen;\n const toggle = () => {\n const next = !open;\n if (controlledOpen === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n };\n\n return <CollapsibleContext.Provider value={{ open, toggle }}>\n <div className={cn(\"w-full overflow-hidden rounded-control-lg border border-input bg-background\", className)} data-state={open ? \"open\" : \"closed\"} {...props}>\n {title !== undefined ? <>\n <CollapsibleTrigger className=\"flex w-full items-center justify-between gap-2 p-4 text-left text-sm font-semibold transition-colors duration-state hover:bg-muted motion-reduce:transition-none focus-visible:outline-3 focus-visible:-outline-offset-4 focus-visible:outline-landing-blue\">\n <span>{title}</span>\n <ChevronDown aria-hidden=\"true\" className={cn(\"h-5 w-5 shrink-0 transition-transform duration-state ease-landing-out motion-reduce:transition-none\", open && \"rotate-180\")} />\n </CollapsibleTrigger>\n <CollapsibleContent divider={divider}>\n <div className=\"px-4 pb-4 pt-4\">{children}</div>\n </CollapsibleContent>\n </> : children}\n </div>\n </CollapsibleContext.Provider>;\n}\n\nfunction CollapsibleTrigger({ asChild, className, children, onClick, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement> & { asChild?: boolean }) {\n const { open, toggle } = useCollapsible();\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => { onClick?.(event); if (!event.defaultPrevented) toggle(); };\n if (asChild && React.isValidElement(children)) {\n return React.cloneElement(children as React.ReactElement<any>, {\n ...props,\n 'aria-expanded': open,\n 'data-state': open ? 'open' : 'closed',\n onClick: handleClick,\n });\n }\n return <button type=\"button\" {...props} aria-expanded={open} data-state={open ? \"open\" : \"closed\"} className={className} onClick={handleClick}>{children}</button>;\n}\n\nfunction CollapsibleContent({ className, children, divider = false, style, ...props }: React.HTMLAttributes<HTMLDivElement> & { divider?: boolean }) {\n const { open } = useCollapsible();\n return <div className={cn(\"grid transition-[grid-template-rows] duration-state ease-landing-out motion-reduce:transition-none\", divider && open && \"border-t border-border\", className)} style={{ gridTemplateRows: open ? \"1fr\" : \"0fr\", ...style }} aria-hidden={!open} inert={!open} {...props}>\n <div className=\"min-h-0 overflow-hidden\">\n <div className={cn(\n \"origin-top transition-[opacity,transform,filter] duration-state ease-landing-out motion-reduce:transform-none motion-reduce:filter-none motion-reduce:transition-none\",\n open ? \"scale-100 opacity-100 blur-none\" : \"scale-[0.98] opacity-0 blur-sm\",\n )}>{children}</div>\n </div>\n </div>;\n}\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n"],"names":[],"mappings":";;;;;;AAOA;AAEA;;AAEE;AAAc;AACd;AACF;AAEA;AAUE;AACA;;AAEE;;;AAEA;AACF;;AAeF;AAEA;;AAEE;AAAqH;;AAEnH;AACE;AACA;;AAEA;AACD;;AAEH;AACF;AAEA;AACE;AACA;AAQF;;"}
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
5
+ import { ChevronRight, Check, Circle } from 'lucide-react';
6
+ import { cn } from '../utils.js';
7
+
8
+ const ContextMenu = ContextMenuPrimitive.Root;
9
+ const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
10
+ const ContextMenuGroup = ContextMenuPrimitive.Group;
11
+ const ContextMenuPortal = ContextMenuPrimitive.Portal;
12
+ const ContextMenuSub = ContextMenuPrimitive.Sub;
13
+ const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;
14
+ const ContextMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => (jsxs(ContextMenuPrimitive.SubTrigger, { ref: ref, className: cn("flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground", inset && "pl-8", className), ...props, children: [children, jsx(ChevronRight, { className: "ml-auto h-4 w-4" })] })));
15
+ ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
16
+ const ContextMenuSubContent = React.forwardRef(({ className, ...props }, ref) => (jsx(ContextMenuPrimitive.SubContent, { ref: ref, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-1 text-popover-foreground shadow-card data-[state=open]:animate-in motion-reduce:animate-none 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", className), ...props })));
17
+ ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
18
+ const ContextMenuContent = React.forwardRef(({ className, ...props }, ref) => (jsx(ContextMenuPrimitive.Portal, { children: jsx(ContextMenuPrimitive.Content, { ref: ref, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-1 text-popover-foreground shadow-card animate-in motion-reduce:animate-none fade-in-80 data-[state=open]:animate-in motion-reduce:animate-none 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", className), ...props }) })));
19
+ ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
20
+ const ContextMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (jsx(ContextMenuPrimitive.Item, { ref: ref, className: cn("relative flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", inset && "pl-8", className), ...props })));
21
+ ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
22
+ const ContextMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => (jsxs(ContextMenuPrimitive.CheckboxItem, { ref: ref, className: cn("relative flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), checked: checked, ...props, children: [jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: jsx(ContextMenuPrimitive.ItemIndicator, { children: jsx(Check, { className: "h-4 w-4" }) }) }), children] })));
23
+ ContextMenuCheckboxItem.displayName =
24
+ ContextMenuPrimitive.CheckboxItem.displayName;
25
+ const ContextMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => (jsxs(ContextMenuPrimitive.RadioItem, { ref: ref, className: cn("relative flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), ...props, children: [jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: jsx(ContextMenuPrimitive.ItemIndicator, { children: jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }), children] })));
26
+ ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
27
+ const ContextMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => (jsx(ContextMenuPrimitive.Label, { ref: ref, className: cn("px-2 py-1.5 text-sm font-semibold text-foreground", inset && "pl-8", className), ...props })));
28
+ ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
29
+ const ContextMenuSeparator = React.forwardRef(({ className, ...props }, ref) => (jsx(ContextMenuPrimitive.Separator, { ref: ref, className: cn("-mx-1 my-1 h-px bg-border", className), ...props })));
30
+ ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
31
+ const ContextMenuShortcut = ({ className, ...props }) => {
32
+ return (jsx("span", { className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className), ...props }));
33
+ };
34
+ ContextMenuShortcut.displayName = "ContextMenuShortcut";
35
+
36
+ export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger };
37
+ //# sourceMappingURL=context-menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-menu.js","sources":["../../src/components/context-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as ContextMenuPrimitive from \"@radix-ui/react-context-menu\";\nimport { Check, ChevronRight, Circle } from \"lucide-react\";\n\nimport { cn } from \"@/utils\";\n\nconst ContextMenu = ContextMenuPrimitive.Root;\n\nconst ContextMenuTrigger = ContextMenuPrimitive.Trigger;\n\nconst ContextMenuGroup = ContextMenuPrimitive.Group;\n\nconst ContextMenuPortal = ContextMenuPrimitive.Portal;\n\nconst ContextMenuSub = ContextMenuPrimitive.Sub;\n\nconst ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup;\n\nconst ContextMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <ContextMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground\",\n inset && \"pl-8\",\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto h-4 w-4\" />\n </ContextMenuPrimitive.SubTrigger>\n));\nContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;\n\nconst ContextMenuSubContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-1 text-popover-foreground shadow-card data-[state=open]:animate-in motion-reduce:animate-none 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\",\n className,\n )}\n {...props}\n />\n));\nContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;\n\nconst ContextMenuContent = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Portal>\n <ContextMenuPrimitive.Content\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-control-lg border border-border bg-popover p-1 text-popover-foreground shadow-card animate-in motion-reduce:animate-none fade-in-80 data-[state=open]:animate-in motion-reduce:animate-none 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\",\n className,\n )}\n {...props}\n />\n </ContextMenuPrimitive.Portal>\n));\nContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;\n\nconst ContextMenuItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-8\",\n className,\n )}\n {...props}\n />\n));\nContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;\n\nconst ContextMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <ContextMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"relative flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.CheckboxItem>\n));\nContextMenuCheckboxItem.displayName =\n ContextMenuPrimitive.CheckboxItem.displayName;\n\nconst ContextMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <ContextMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-pointer select-none items-center pointer-coarse:min-h-11 rounded-control-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <ContextMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </ContextMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </ContextMenuPrimitive.RadioItem>\n));\nContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;\n\nconst ContextMenuLabel = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <ContextMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"px-2 py-1.5 text-sm font-semibold text-foreground\",\n inset && \"pl-8\",\n className,\n )}\n {...props}\n />\n));\nContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;\n\nconst ContextMenuSeparator = React.forwardRef<\n React.ElementRef<typeof ContextMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <ContextMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-border\", className)}\n {...props}\n />\n));\nContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;\n\nconst ContextMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n};\nContextMenuShortcut.displayName = \"ContextMenuShortcut\";\n\nexport {\n ContextMenu,\n ContextMenuTrigger,\n ContextMenuContent,\n ContextMenuItem,\n ContextMenuCheckboxItem,\n ContextMenuRadioItem,\n ContextMenuLabel,\n ContextMenuSeparator,\n ContextMenuShortcut,\n ContextMenuGroup,\n ContextMenuPortal,\n ContextMenuSub,\n ContextMenuSubContent,\n ContextMenuSubTrigger,\n ContextMenuRadioGroup,\n};\n"],"names":[],"mappings":";;;;;;;AAQA;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AAmBA;AAEA;AAaA;AAEA;AAeA;AAEA;AAgBA;AAEA;AAqBA;AACE;AAEF;AAoBA;AAEA;AAgBA;AAEA;AAUA;AAEA;AAIE;AASF;AACA;;"}
@@ -1,25 +1,25 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import * as DialogPrimitive from '@radix-ui/react-dialog';
2
+ import * as SheetPrimitive from '@radix-ui/react-dialog';
3
3
  import { XIcon } from 'lucide-react';
4
4
  import { cn } from '../utils.js';
5
5
 
6
6
  function Dialog({ ...props }) {
7
- return jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
7
+ return jsx(SheetPrimitive.Root, { "data-slot": "dialog", ...props });
8
8
  }
9
9
  function DialogTrigger({ ...props }) {
10
- return jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
10
+ return jsx(SheetPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
11
11
  }
12
12
  function DialogPortal({ ...props }) {
13
- return jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
13
+ return jsx(SheetPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
14
14
  }
15
15
  function DialogClose({ ...props }) {
16
- return jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
16
+ return jsx(SheetPrimitive.Close, { "data-slot": "dialog-close", ...props });
17
17
  }
18
18
  function DialogOverlay({ className, ...props }) {
19
- return (jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn('data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/30', className), ...props }));
19
+ return (jsx(SheetPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn('data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/30', className), ...props }));
20
20
  }
21
21
  function DialogContent({ className, children, showCloseButton = true, ...props }) {
22
- return (jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [jsx(DialogOverlay, {}), jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", className: cn('bg-background data-[state=open]:animate-in motion-reduce:animate-none 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 max-h-[calc(100dvh-2rem)] overflow-y-auto rounded-card border border-border p-6 shadow-card duration-interactive ease-out-strong sm:max-w-lg', className), ...props, children: [children, showCloseButton && (jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", className: "absolute right-4 top-4 flex size-11 items-center justify-center rounded-control-lg text-muted-foreground transition-colors duration-state hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none motion-reduce:transition-none [&_svg]:size-4", children: [jsx(XIcon, {}), jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
22
+ return (jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [jsx(DialogOverlay, {}), jsxs(SheetPrimitive.Content, { "data-slot": "dialog-content", className: cn('bg-background data-[state=open]:animate-in motion-reduce:animate-none 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 max-h-[calc(100dvh-2rem)] overflow-y-auto rounded-card border border-border p-6 shadow-card duration-interactive ease-out-strong sm:max-w-lg', className), ...props, children: [children, showCloseButton && (jsxs(SheetPrimitive.Close, { "data-slot": "dialog-close", className: "absolute right-4 top-4 flex size-11 items-center justify-center rounded-control-lg text-muted-foreground transition-colors duration-state hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none motion-reduce:transition-none [&_svg]:size-4", children: [jsx(XIcon, {}), jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
23
23
  }
24
24
  function DialogHeader({ className, divider = false, ...props }) {
25
25
  return (jsx("div", { "data-slot": "dialog-header", className: cn('flex flex-col gap-2 pr-10 text-left', divider && 'border-b border-border pb-4', className), ...props }));
@@ -31,13 +31,13 @@ function DialogDivider({ className, ...props }) {
31
31
  return (jsx("div", { "data-slot": "dialog-divider", role: "separator", className: cn('h-px w-full bg-border', className), ...props }));
32
32
  }
33
33
  function DialogTitle({ className, ...props }) {
34
- return (jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", className: cn('text-xl leading-snug font-semibold', className), ...props }));
34
+ return (jsx(SheetPrimitive.Title, { "data-slot": "dialog-title", className: cn('text-xl leading-snug font-semibold', className), ...props }));
35
35
  }
36
36
  function DialogDescription({ className, ...props }) {
37
- return (jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn('text-muted-foreground text-sm', className), ...props }));
37
+ return (jsx(SheetPrimitive.Description, { "data-slot": "dialog-description", className: cn('text-muted-foreground text-sm', className), ...props }));
38
38
  }
39
39
  function DialogBottomSheet({ className, children, showCloseButton = true, ...props }) {
40
- return (jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [jsx(DialogOverlay, {}), jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", className: cn('bg-background data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom fixed bottom-0 left-0 right-0 z-50 w-full max-h-[90dvh] overflow-y-auto rounded-t-card border-t border-border p-6 pb-[max(1.5rem,env(safe-area-inset-bottom))] shadow-card duration-interactive ease-out-strong', className), ...props, children: [children, showCloseButton && (jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", className: "absolute right-4 top-4 flex size-11 items-center justify-center rounded-control-lg text-muted-foreground transition-colors duration-state hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none motion-reduce:transition-none [&_svg]:size-4", children: [jsx(XIcon, {}), jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
40
+ return (jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [jsx(DialogOverlay, {}), jsxs(SheetPrimitive.Content, { "data-slot": "dialog-content", className: cn('bg-background data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom fixed bottom-0 left-0 right-0 z-50 w-full max-h-[90dvh] overflow-y-auto rounded-t-card border-t border-border p-6 pb-[max(1.5rem,env(safe-area-inset-bottom))] shadow-card duration-interactive ease-out-strong', className), ...props, children: [children, showCloseButton && (jsxs(SheetPrimitive.Close, { "data-slot": "dialog-close", className: "absolute right-4 top-4 flex size-11 items-center justify-center rounded-control-lg text-muted-foreground transition-colors duration-state hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none motion-reduce:transition-none [&_svg]:size-4", children: [jsx(XIcon, {}), jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
41
41
  }
42
42
 
43
43
  export { Dialog, DialogBottomSheet, DialogClose, DialogContent, DialogDescription, DialogDivider, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.js","sources":["../../src/components/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { XIcon } from 'lucide-react';\n\nimport { cn } from '@/utils';\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n 'data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/30',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n}) {\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'bg-background data-[state=open]:animate-in motion-reduce:animate-none 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 max-h-[calc(100dvh-2rem)] overflow-y-auto rounded-card border border-border p-6 shadow-card duration-interactive ease-out-strong sm:max-w-lg',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"absolute right-4 top-4 flex size-11 items-center justify-center rounded-control-lg text-muted-foreground transition-colors duration-state hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none motion-reduce:transition-none [&_svg]:size-4\"\n >\n <XIcon />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, divider = false, ...props }: React.ComponentProps<'div'> & { divider?: boolean }) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('flex flex-col gap-2 pr-10 text-left', divider && 'border-b border-border pb-4', className)}\n {...props}\n />\n );\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DialogDivider({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-divider\"\n role=\"separator\"\n className={cn('h-px w-full bg-border', className)}\n {...props}\n />\n );\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-xl leading-snug font-semibold', className)}\n {...props}\n />\n );\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction DialogBottomSheet({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n}) {\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'bg-background data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom fixed bottom-0 left-0 right-0 z-50 w-full max-h-[90dvh] overflow-y-auto rounded-t-card border-t border-border p-6 pb-[max(1.5rem,env(safe-area-inset-bottom))] shadow-card duration-interactive ease-out-strong',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"absolute right-4 top-4 flex size-11 items-center justify-center rounded-control-lg text-muted-foreground transition-colors duration-state hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none motion-reduce:transition-none [&_svg]:size-4\"\n >\n <XIcon />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nexport {\n Dialog,\n DialogBottomSheet,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogDivider,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n"],"names":["_jsx","_jsxs"],"mappings":"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"}
1
+ {"version":3,"file":"dialog.js","sources":["../../src/components/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { XIcon } from 'lucide-react';\n\nimport { cn } from '@/utils';\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n 'data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/30',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n}) {\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'bg-background data-[state=open]:animate-in motion-reduce:animate-none 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 max-h-[calc(100dvh-2rem)] overflow-y-auto rounded-card border border-border p-6 shadow-card duration-interactive ease-out-strong sm:max-w-lg',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"absolute right-4 top-4 flex size-11 items-center justify-center rounded-control-lg text-muted-foreground transition-colors duration-state hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none motion-reduce:transition-none [&_svg]:size-4\"\n >\n <XIcon />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, divider = false, ...props }: React.ComponentProps<'div'> & { divider?: boolean }) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('flex flex-col gap-2 pr-10 text-left', divider && 'border-b border-border pb-4', className)}\n {...props}\n />\n );\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DialogDivider({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-divider\"\n role=\"separator\"\n className={cn('h-px w-full bg-border', className)}\n {...props}\n />\n );\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-xl leading-snug font-semibold', className)}\n {...props}\n />\n );\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction DialogBottomSheet({\n className,\n children,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n}) {\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'bg-background data-[state=open]:animate-in motion-reduce:animate-none data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom fixed bottom-0 left-0 right-0 z-50 w-full max-h-[90dvh] overflow-y-auto rounded-t-card border-t border-border p-6 pb-[max(1.5rem,env(safe-area-inset-bottom))] shadow-card duration-interactive ease-out-strong',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"absolute right-4 top-4 flex size-11 items-center justify-center rounded-control-lg text-muted-foreground transition-colors duration-state hover:bg-accent hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none motion-reduce:transition-none [&_svg]:size-4\"\n >\n <XIcon />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nexport {\n Dialog,\n DialogBottomSheet,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogDivider,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n"],"names":["_jsx","DialogPrimitive","_jsxs"],"mappings":"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"}
@@ -0,0 +1,163 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useRef, useEffect } from 'react';
4
+ import { cn } from '../utils.js';
5
+
6
+ /** Pitch between dots and the margin around the grid, in CSS px. */
7
+ const STEP = 11;
8
+ const EDGE = 10;
9
+ /** Halftone sizing: dots swell under the drifting blobs and shrink between them. */
10
+ const MIN_RADIUS = 0.8;
11
+ const MAX_RADIUS = STEP * 0.36;
12
+ /** Opacity range; the floor keeps the whole lattice faintly visible. */
13
+ const MIN_ALPHA = 0.16;
14
+ const MAX_ALPHA = 0.75;
15
+ /** A fixed permutation so every instance shows the same, stable field. */
16
+ const PERM = (() => {
17
+ const table = Array.from({ length: 256 }, (_, i) => i);
18
+ let seed = 7;
19
+ for (let i = 255; i > 0; i--) {
20
+ seed = (seed * 16807) % 2147483647;
21
+ const j = seed % (i + 1);
22
+ [table[i], table[j]] = [table[j], table[i]];
23
+ }
24
+ return Uint8Array.from([...table, ...table]);
25
+ })();
26
+ const fade = (t) => t * t * t * (t * (t * 6 - 15) + 10);
27
+ /** 2D Perlin noise, roughly in [-0.7, 0.7]: smooth, organic, never striped. */
28
+ function noise(x, y) {
29
+ const xi = Math.floor(x);
30
+ const yi = Math.floor(y);
31
+ const xf = x - xi;
32
+ const yf = y - yi;
33
+ const X = xi & 255;
34
+ const Y = yi & 255;
35
+ const grad = (hash, dx, dy) => {
36
+ const h = hash & 7;
37
+ const u = h < 4 ? dx : dy;
38
+ const v = h < 4 ? dy : dx;
39
+ return (h & 1 ? -u : u) + (h & 2 ? -2 * v : 2 * v) * 0.5;
40
+ };
41
+ const aa = PERM[PERM[X] + Y];
42
+ const ab = PERM[PERM[X] + Y + 1];
43
+ const ba = PERM[PERM[X + 1] + Y];
44
+ const bb = PERM[PERM[X + 1] + Y + 1];
45
+ const u = fade(xf);
46
+ const v = fade(yf);
47
+ const top = grad(aa, xf, yf) + u * (grad(ba, xf - 1, yf) - grad(aa, xf, yf));
48
+ const bottom = grad(ab, xf, yf - 1) + u * (grad(bb, xf - 1, yf - 1) - grad(ab, xf, yf - 1));
49
+ return top + v * (bottom - top);
50
+ }
51
+ /**
52
+ * A decorative "still being generated" surface: a halftone lattice of dots
53
+ * tinted with a theme color. Two layers of smooth noise drift in different
54
+ * directions, so soft blobs of larger, stronger dots swell, merge and fade
55
+ * across the grid.
56
+ *
57
+ * It fills its nearest positioned parent, animates only while on screen and
58
+ * shows a still frame when the user prefers reduced motion.
59
+ */
60
+ function DotMatrix({ className, fade: fadeEdges = true, speed = 1 }) {
61
+ const ref = useRef(null);
62
+ useEffect(() => {
63
+ const canvas = ref.current;
64
+ const context = canvas?.getContext("2d");
65
+ if (!canvas || !context)
66
+ return;
67
+ const motion = window.matchMedia("(prefers-reduced-motion: reduce)");
68
+ const dpr = Math.min(2, window.devicePixelRatio || 1);
69
+ let xs = [];
70
+ let ys = [];
71
+ let width = 0;
72
+ let height = 0;
73
+ let frame = 0;
74
+ let visible = false;
75
+ const still = () => motion.matches || speed <= 0;
76
+ const build = () => {
77
+ width = canvas.clientWidth;
78
+ height = canvas.clientHeight;
79
+ canvas.width = Math.max(1, Math.round(width * dpr));
80
+ canvas.height = Math.max(1, Math.round(height * dpr));
81
+ context.setTransform(dpr, 0, 0, dpr, 0, 0);
82
+ const columns = Math.max(1, Math.floor((width - EDGE * 2) / STEP) + 1);
83
+ const rows = Math.max(1, Math.floor((height - EDGE * 2) / STEP) + 1);
84
+ const left = (width - (columns - 1) * STEP) / 2;
85
+ const top = (height - (rows - 1) * STEP) / 2;
86
+ xs = Array.from({ length: columns }, (_, i) => left + i * STEP);
87
+ ys = Array.from({ length: rows }, (_, i) => top + i * STEP);
88
+ };
89
+ const paint = (time) => {
90
+ if (!xs.length)
91
+ return;
92
+ // Resolve the token color every frame so theme changes apply at once.
93
+ context.fillStyle = getComputedStyle(canvas).color;
94
+ const t = (time / 1000) * speed;
95
+ context.clearRect(0, 0, width, height);
96
+ for (const y of ys) {
97
+ for (const x of xs) {
98
+ // Broad, slow blobs plus a finer layer drifting the other way,
99
+ // so shapes morph instead of sliding across as a fixed pattern.
100
+ const broad = noise(x * 0.012 + t * 0.18, y * 0.012 - t * 0.12);
101
+ const fine = noise(x * 0.03 - t * 0.3 + 40, y * 0.03 + t * 0.22);
102
+ const field = Math.min(1, Math.max(0, 0.5 + 1.1 * (0.72 * broad + 0.28 * fine)));
103
+ const level = field * field * (3 - 2 * field);
104
+ context.globalAlpha = MIN_ALPHA + (MAX_ALPHA - MIN_ALPHA) * level;
105
+ context.beginPath();
106
+ context.arc(x, y, MIN_RADIUS + (MAX_RADIUS - MIN_RADIUS) * level, 0, Math.PI * 2);
107
+ context.fill();
108
+ }
109
+ }
110
+ context.globalAlpha = 1;
111
+ };
112
+ const loop = (time) => {
113
+ paint(time);
114
+ frame = requestAnimationFrame(loop);
115
+ };
116
+ const stop = () => {
117
+ cancelAnimationFrame(frame);
118
+ frame = 0;
119
+ };
120
+ const start = () => {
121
+ if (!xs.length || width !== canvas.clientWidth || height !== canvas.clientHeight)
122
+ build();
123
+ paint(performance.now());
124
+ if (still() || frame)
125
+ return;
126
+ frame = requestAnimationFrame(loop);
127
+ };
128
+ // Only animate while on screen; off-screen instances hold their last frame.
129
+ const seen = new IntersectionObserver(([entry]) => {
130
+ visible = entry.isIntersecting;
131
+ if (visible)
132
+ start();
133
+ else
134
+ stop();
135
+ }, { rootMargin: "80px" });
136
+ seen.observe(canvas);
137
+ const resized = new ResizeObserver(() => {
138
+ if (!xs.length)
139
+ return;
140
+ build();
141
+ paint(performance.now());
142
+ });
143
+ resized.observe(canvas);
144
+ // Follow reduced-motion changes made while mounted.
145
+ const motionChanged = () => {
146
+ stop();
147
+ if (visible)
148
+ start();
149
+ };
150
+ motion.addEventListener("change", motionChanged);
151
+ return () => {
152
+ stop();
153
+ seen.disconnect();
154
+ resized.disconnect();
155
+ motion.removeEventListener("change", motionChanged);
156
+ };
157
+ }, [speed]);
158
+ return (jsx("canvas", { ref: ref, "aria-hidden": true, "data-slot": "dot-matrix", className: cn("pointer-events-none absolute inset-0 size-full text-primary", fadeEdges &&
159
+ "[mask-image:radial-gradient(ellipse_at_center,black_55%,transparent_100%)]", className) }));
160
+ }
161
+
162
+ export { DotMatrix };
163
+ //# sourceMappingURL=dot-matrix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dot-matrix.js","sources":["../../src/components/dot-matrix.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef } from \"react\";\nimport { cn } from \"@/utils\";\n\n/** Pitch between dots and the margin around the grid, in CSS px. */\nconst STEP = 11;\nconst EDGE = 10;\n\n/** Halftone sizing: dots swell under the drifting blobs and shrink between them. */\nconst MIN_RADIUS = 0.8;\nconst MAX_RADIUS = STEP * 0.36;\n\n/** Opacity range; the floor keeps the whole lattice faintly visible. */\nconst MIN_ALPHA = 0.16;\nconst MAX_ALPHA = 0.75;\n\n/** A fixed permutation so every instance shows the same, stable field. */\nconst PERM = (() => {\n const table = Array.from({ length: 256 }, (_, i) => i);\n let seed = 7;\n for (let i = 255; i > 0; i--) {\n seed = (seed * 16807) % 2147483647;\n const j = seed % (i + 1);\n [table[i], table[j]] = [table[j], table[i]];\n }\n return Uint8Array.from([...table, ...table]);\n})();\n\nconst fade = (t: number) => t * t * t * (t * (t * 6 - 15) + 10);\n\n/** 2D Perlin noise, roughly in [-0.7, 0.7]: smooth, organic, never striped. */\nfunction noise(x: number, y: number) {\n const xi = Math.floor(x);\n const yi = Math.floor(y);\n const xf = x - xi;\n const yf = y - yi;\n const X = xi & 255;\n const Y = yi & 255;\n const grad = (hash: number, dx: number, dy: number) => {\n const h = hash & 7;\n const u = h < 4 ? dx : dy;\n const v = h < 4 ? dy : dx;\n return (h & 1 ? -u : u) + (h & 2 ? -2 * v : 2 * v) * 0.5;\n };\n const aa = PERM[PERM[X] + Y];\n const ab = PERM[PERM[X] + Y + 1];\n const ba = PERM[PERM[X + 1] + Y];\n const bb = PERM[PERM[X + 1] + Y + 1];\n const u = fade(xf);\n const v = fade(yf);\n const top = grad(aa, xf, yf) + u * (grad(ba, xf - 1, yf) - grad(aa, xf, yf));\n const bottom =\n grad(ab, xf, yf - 1) + u * (grad(bb, xf - 1, yf - 1) - grad(ab, xf, yf - 1));\n return top + v * (bottom - top);\n}\n\nexport interface DotMatrixProps {\n /**\n * Dot color comes from `currentColor`, so tint with a text token:\n * `text-primary` (default), `text-secondary-foreground`, `text-muted-foreground`.\n */\n className?: string;\n /** Softly fade the lattice into the surrounding surface. Defaults to true. */\n fade?: boolean;\n /** Animation speed multiplier. 1 is the calm default; 0 holds a still frame. */\n speed?: number;\n}\n\n/**\n * A decorative \"still being generated\" surface: a halftone lattice of dots\n * tinted with a theme color. Two layers of smooth noise drift in different\n * directions, so soft blobs of larger, stronger dots swell, merge and fade\n * across the grid.\n *\n * It fills its nearest positioned parent, animates only while on screen and\n * shows a still frame when the user prefers reduced motion.\n */\nexport function DotMatrix({ className, fade: fadeEdges = true, speed = 1 }: DotMatrixProps) {\n const ref = useRef<HTMLCanvasElement>(null);\n\n useEffect(() => {\n const canvas = ref.current;\n const context = canvas?.getContext(\"2d\");\n if (!canvas || !context) return;\n\n const motion = window.matchMedia(\"(prefers-reduced-motion: reduce)\");\n const dpr = Math.min(2, window.devicePixelRatio || 1);\n let xs: number[] = [];\n let ys: number[] = [];\n let width = 0;\n let height = 0;\n let frame = 0;\n let visible = false;\n\n const still = () => motion.matches || speed <= 0;\n\n const build = () => {\n width = canvas.clientWidth;\n height = canvas.clientHeight;\n canvas.width = Math.max(1, Math.round(width * dpr));\n canvas.height = Math.max(1, Math.round(height * dpr));\n context.setTransform(dpr, 0, 0, dpr, 0, 0);\n\n const columns = Math.max(1, Math.floor((width - EDGE * 2) / STEP) + 1);\n const rows = Math.max(1, Math.floor((height - EDGE * 2) / STEP) + 1);\n const left = (width - (columns - 1) * STEP) / 2;\n const top = (height - (rows - 1) * STEP) / 2;\n xs = Array.from({ length: columns }, (_, i) => left + i * STEP);\n ys = Array.from({ length: rows }, (_, i) => top + i * STEP);\n };\n\n const paint = (time: number) => {\n if (!xs.length) return;\n // Resolve the token color every frame so theme changes apply at once.\n context.fillStyle = getComputedStyle(canvas).color;\n const t = (time / 1000) * speed;\n context.clearRect(0, 0, width, height);\n for (const y of ys) {\n for (const x of xs) {\n // Broad, slow blobs plus a finer layer drifting the other way,\n // so shapes morph instead of sliding across as a fixed pattern.\n const broad = noise(x * 0.012 + t * 0.18, y * 0.012 - t * 0.12);\n const fine = noise(x * 0.03 - t * 0.3 + 40, y * 0.03 + t * 0.22);\n const field = Math.min(1, Math.max(0, 0.5 + 1.1 * (0.72 * broad + 0.28 * fine)));\n const level = field * field * (3 - 2 * field);\n context.globalAlpha = MIN_ALPHA + (MAX_ALPHA - MIN_ALPHA) * level;\n context.beginPath();\n context.arc(x, y, MIN_RADIUS + (MAX_RADIUS - MIN_RADIUS) * level, 0, Math.PI * 2);\n context.fill();\n }\n }\n context.globalAlpha = 1;\n };\n\n const loop = (time: number) => {\n paint(time);\n frame = requestAnimationFrame(loop);\n };\n\n const stop = () => {\n cancelAnimationFrame(frame);\n frame = 0;\n };\n\n const start = () => {\n if (!xs.length || width !== canvas.clientWidth || height !== canvas.clientHeight) build();\n paint(performance.now());\n if (still() || frame) return;\n frame = requestAnimationFrame(loop);\n };\n\n // Only animate while on screen; off-screen instances hold their last frame.\n const seen = new IntersectionObserver(\n ([entry]) => {\n visible = entry.isIntersecting;\n if (visible) start();\n else stop();\n },\n { rootMargin: \"80px\" },\n );\n seen.observe(canvas);\n\n const resized = new ResizeObserver(() => {\n if (!xs.length) return;\n build();\n paint(performance.now());\n });\n resized.observe(canvas);\n\n // Follow reduced-motion changes made while mounted.\n const motionChanged = () => {\n stop();\n if (visible) start();\n };\n motion.addEventListener(\"change\", motionChanged);\n\n return () => {\n stop();\n seen.disconnect();\n resized.disconnect();\n motion.removeEventListener(\"change\", motionChanged);\n };\n }, [speed]);\n\n return (\n <canvas\n ref={ref}\n aria-hidden\n data-slot=\"dot-matrix\"\n className={cn(\n \"pointer-events-none absolute inset-0 size-full text-primary\",\n fadeEdges &&\n \"[mask-image:radial-gradient(ellipse_at_center,black_55%,transparent_100%)]\",\n className,\n )}\n />\n );\n}\n"],"names":[],"mappings":";;;;;AAKA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;;;AAGE;;;;;AAKA;AACF;AAEA;AAEA;AACA;;;AAGE;AACA;AACA;AACA;;AAEE;AACA;AACA;AACA;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGF;AAcA;;;;;;;;AAQG;AACG;AACJ;;AAGE;;AAEA;;;AAGA;;;;;;;AAQA;;AAGE;AACA;AACA;AACA;AACA;;;AAIA;AACA;;;AAGF;AAEA;;;;;;;AAME;AACE;;;;;AAKE;AACA;AACA;;;;;;AAMJ;AACF;AAEA;;AAEE;AACF;;;;AAKA;;AAGE;AAAkF;AAClF;;;AAEA;AACF;;;AAKI;AACA;AAAa;;AACR;AACP;AAGF;AAEA;;;AAEE;AACA;AACF;AACA;;;AAIE;AACA;AAAa;AACf;AACA;AAEA;AACE;;;AAGA;AACF;AACF;AAEA;AAQQ;AAKV;;"}