@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,262 @@
1
+ "use client";
2
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
+ import { Button } from './button.js';
4
+ import { useMobile } from '../hooks/use-mobile.js';
5
+ import { useMobileSheetViewport } from '../hooks/use-mobile-sheet-viewport.js';
6
+ import { MobileSheetPortal } from './mobile-sheet-portal.js';
7
+ import { cn } from '../utils.js';
8
+ import { fieldTriggerClassName } from '../hooks/use-field-focus.js';
9
+ import { ChevronDown, X } from 'lucide-react';
10
+ import { useRouter } from 'next/navigation';
11
+ import { createContext, useState, useContext, useRef, useCallback, useEffect, Children } from 'react';
12
+ import { useDetectClickOutside } from '../hooks/use-detect-click-outside.js';
13
+
14
+ const DropdownGroupContext = createContext({});
15
+ const DropdownOption = ({ children }) => {
16
+ return jsx(Fragment, { children: children });
17
+ };
18
+ /**
19
+ * Creates a standard button dropdowns must use with mobile optimization.
20
+ * Not meant to be used elsewhere.
21
+ *
22
+ * @component
23
+ */
24
+ const DropdownOptionButton = ({ children, set_is_open, size = "xs", }) => {
25
+ const router = useRouter();
26
+ const is_mobile = useMobile();
27
+ const [scrolling, setScrolling] = useState(false);
28
+ const dropdown_button_ref = useRef({});
29
+ const handleClick = useCallback((e) => {
30
+ e.stopPropagation();
31
+ set_is_open(false);
32
+ children.props.on_click && children.props.on_click();
33
+ children.props.href && router.push(children.props.href);
34
+ }, [children.props, router, set_is_open]);
35
+ const onTouchStart = (e) => {
36
+ e.stopPropagation();
37
+ setScrolling(true);
38
+ };
39
+ const onTouchEnd = (e) => {
40
+ e.stopPropagation();
41
+ setScrolling(false);
42
+ };
43
+ useEffect(() => {
44
+ const dropdown_button = dropdown_button_ref.current;
45
+ if (!dropdown_button)
46
+ return;
47
+ // Attach passive touchstart handler
48
+ dropdown_button.addEventListener("touchstart", onTouchStart, {
49
+ passive: true,
50
+ });
51
+ dropdown_button.addEventListener("touchend", onTouchEnd, {
52
+ passive: true,
53
+ });
54
+ // Cleanup on unmount
55
+ return () => {
56
+ dropdown_button.removeEventListener("touchstart", onTouchStart);
57
+ dropdown_button.removeEventListener("touchend", onTouchEnd);
58
+ };
59
+ }, [onTouchStart]);
60
+ return (jsx("button", {
61
+ // @ts-ignore
62
+ ref: dropdown_button_ref, className: cn("w-full cursor-pointer text-left px-4 py-2 text-muted-foreground hover:bg-muted transition-colors flex items-center gap-2", is_mobile ? "min-h-12 py-3 active:bg-muted touch-manipulation" : "", `text-${size}`, children.props.highlighted ? "bg-primary-tint" : ""), onClick: (e) => !scrolling && handleClick(e), children: jsx("div", { className: "w-full", children: children }) }));
63
+ };
64
+ /**
65
+ * This component creates a context provider for dropdowns inside it to use.
66
+ * The dropdowns inside can modify the active dropdown when they're clicked.
67
+ * This way, only one dropdown in the group is active at a time.
68
+ *
69
+ * @component
70
+ */
71
+ const DropdownGroup = ({ children }) => {
72
+ const [activeDropdown, setActiveDropdown] = useState("");
73
+ const group_dropdown_context = {
74
+ activeDropdown,
75
+ setActiveDropdown,
76
+ };
77
+ return (jsx(DropdownGroupContext, { value: group_dropdown_context, children: children }));
78
+ };
79
+ /**
80
+ * This represents a single dropdown inside the group with mobile optimization.
81
+ * Inherits the provided context (if there is none, that's fine).
82
+ *
83
+ * @component
84
+ */
85
+ const GroupableRadioDropdown = ({ name, options, onChange, disabled, defaultValue = null, size = "sm", className = "", fallback = "Select option", }) => {
86
+ const isMobile = useMobile();
87
+ const { activeDropdown, setActiveDropdown } = useContext(DropdownGroupContext);
88
+ const [isOpen, setIsOpen] = useState(false);
89
+ const sheetViewport = useMobileSheetViewport(isOpen && isMobile);
90
+ const [value, setValue] = useState(defaultValue);
91
+ const ref = useDetectClickOutside({ onTriggered: () => setIsOpen(false) });
92
+ const triggerRef = useRef(null);
93
+ const sheetRef = useRef(null);
94
+ const sheetCloseRef = useRef(null);
95
+ const useSheet = isOpen && isMobile;
96
+ const closeSheet = useCallback(() => {
97
+ setIsOpen(false);
98
+ triggerRef.current?.focus();
99
+ }, []);
100
+ // While the mobile sheet is open: lock page scroll and move focus into it.
101
+ useEffect(() => {
102
+ if (!useSheet)
103
+ return;
104
+ const overflow = document.body.style.overflow;
105
+ document.body.style.overflow = "hidden";
106
+ const frame = window.requestAnimationFrame(() => sheetCloseRef.current?.focus());
107
+ return () => {
108
+ window.cancelAnimationFrame(frame);
109
+ document.body.style.overflow = overflow;
110
+ };
111
+ }, [useSheet]);
112
+ // Just so it's not stuck at the first default when the default changes
113
+ useEffect(() => {
114
+ setValue(defaultValue);
115
+ }, [defaultValue]);
116
+ /**
117
+ * Activates dropdown
118
+ */
119
+ const handleClick = useCallback((e) => {
120
+ e.stopPropagation();
121
+ setIsOpen(!isOpen);
122
+ setActiveDropdown(name);
123
+ }, [isOpen, name, setActiveDropdown]);
124
+ /**
125
+ * Changes dropdown value
126
+ */
127
+ const handleChange = useCallback((option) => {
128
+ setValue(option);
129
+ onChange(option);
130
+ setIsOpen(false);
131
+ }, [onChange]);
132
+ // Check if it's still the active dropdown
133
+ useEffect(() => {
134
+ if (activeDropdown !== name)
135
+ setIsOpen(false);
136
+ }, [activeDropdown, name]);
137
+ const selected = value || value === 0 ? options.find((o) => o.id === value) : undefined;
138
+ return (jsxs("div", { className: cn("relative w-full max-w-svw min-w-0", className), ref: ref, children: [jsxs(Button, { ref: triggerRef, type: "button", variant: "outline", disabled: disabled, size: size, onClick: handleClick, onTouchEnd: (e) => e.stopPropagation(), "aria-haspopup": "listbox", "aria-expanded": isOpen, className: cn("w-full max-w-full min-w-0", "h-auto py-1", fieldTriggerClassName, "flex items-center justify-between gap-2"), children: [jsx("span", { className: "flex-1 min-w-0 text-left pr-2 leading-relaxed", children: selected ? (jsx("span", { className: "block whitespace-normal wrap-break-word", children: selected.name })) : (jsx("span", { className: "text-muted-foreground/40 font-normal", children: fallback })) }), jsx(ChevronDown, { className: cn("shrink-0 w-4 h-4 text-muted-foreground transition-transform duration-interactive ease-out-strong motion-reduce:transition-none", isOpen ? "rotate-180" : "") })] }), isOpen && (jsxs(MobileSheetPortal, { enabled: isMobile, children: [isMobile && (jsx("button", { type: "button", "aria-label": "Close options", tabIndex: -1, className: "fixed inset-0 z-[1090] bg-black/25 backdrop-blur-[1px]", onClick: closeSheet })), jsxs("div", { ref: isMobile ? sheetRef : undefined, role: isMobile ? "dialog" : undefined, "aria-modal": isMobile ? true : undefined, "aria-label": isMobile ? fallback : undefined, onKeyDown: isMobile
139
+ ? (event) => {
140
+ if (event.key === "Escape") {
141
+ event.preventDefault();
142
+ closeSheet();
143
+ }
144
+ if (event.key !== "Tab")
145
+ return;
146
+ const focusable = sheetRef.current?.querySelectorAll("button:not([disabled]):not([tabindex='-1'])");
147
+ if (!focusable?.length)
148
+ return;
149
+ const first = focusable[0];
150
+ const last = focusable[focusable.length - 1];
151
+ if (event.shiftKey && document.activeElement === first) {
152
+ event.preventDefault();
153
+ last.focus();
154
+ }
155
+ else if (!event.shiftKey &&
156
+ document.activeElement === last) {
157
+ event.preventDefault();
158
+ first.focus();
159
+ }
160
+ }
161
+ : undefined, className: cn("border border-border bg-background shadow-card", isMobile
162
+ ? "fixed left-0 right-0 z-[1100] flex flex-col overflow-hidden rounded-t-control-lg border-b-0 pb-[max(0.75rem,env(safe-area-inset-bottom))]"
163
+ : "absolute left-0 right-0 top-full z-[9999] mt-1 max-w-full overflow-hidden rounded-control-lg"), style: isMobile
164
+ ? {
165
+ bottom: sheetViewport?.bottom ?? 0,
166
+ maxHeight: sheetViewport
167
+ ? Math.min(sheetViewport.height, 640)
168
+ : "80dvh",
169
+ }
170
+ : undefined, children: [isMobile && (jsxs("div", { className: "flex shrink-0 items-center justify-between gap-4 px-4 pb-2 pt-4", children: [jsx("h2", { className: "text-base font-semibold text-foreground", children: fallback }), jsx("button", { ref: sheetCloseRef, type: "button", "aria-label": "Close options", className: "-mr-3 flex h-11 w-11 shrink-0 cursor-pointer items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted", onClick: closeSheet, children: jsx(X, { className: "h-5 w-5", "aria-hidden": "true" }) })] })), jsx("div", { role: "listbox", className: cn("relative overflow-y-auto overscroll-contain touch-pan-y [-webkit-overflow-scrolling:touch] [scrollbar-width:thin] [scrollbar-color:var(--color-border-hover)_var(--muted)]", isMobile ? "min-h-0 flex-1" : "max-h-[400px]"), children: options.map((option, index) => (jsx(DropdownOptionButton, { set_is_open: setIsOpen, size: size, children: jsx(DropdownOption, { highlighted: value === option.id, on_click: () => handleChange(option.id), children: jsx("span", { className: "block whitespace-normal wrap-break-word pr-2", children: option.name }) }) }, index))) })] })] }))] }));
171
+ };
172
+ /**
173
+ * This creates a dropdown menu for navigating with improved mobile support.
174
+ *
175
+ * @component
176
+ */
177
+ const GroupableNavDropdown = ({ display, content, children, className = "", showArrow = true, }) => {
178
+ const is_mobile = useMobile();
179
+ const [is_open, set_is_open] = useState(false);
180
+ const dropdownRef = useRef(null);
181
+ const buttonRef = useRef(null);
182
+ const touchStartRef = useRef(null);
183
+ // Close dropdown handler
184
+ const closeDropdown = useCallback(() => {
185
+ set_is_open(false);
186
+ }, []);
187
+ // Handle clicks outside dropdown
188
+ useEffect(() => {
189
+ const handleClickOutside = (event) => {
190
+ if (!is_mobile &&
191
+ dropdownRef.current &&
192
+ !dropdownRef.current.contains(event.target) &&
193
+ buttonRef.current &&
194
+ !buttonRef.current.contains(event.target)) {
195
+ closeDropdown();
196
+ }
197
+ };
198
+ if (is_open && !is_mobile) {
199
+ document.addEventListener("mousedown", handleClickOutside);
200
+ return () => document.removeEventListener("mousedown", handleClickOutside);
201
+ }
202
+ }, [is_open, is_mobile, closeDropdown]);
203
+ // Mobile touch handlers
204
+ const handleTouchStart = useCallback((e) => {
205
+ if (!is_mobile || !is_open)
206
+ return;
207
+ const touch = e.touches[0];
208
+ touchStartRef.current = {
209
+ x: touch.clientX,
210
+ y: touch.clientY,
211
+ target: e.target,
212
+ };
213
+ }, [is_mobile, is_open]);
214
+ const handleTouchEnd = useCallback((e) => {
215
+ if (!is_mobile || !is_open || !touchStartRef.current)
216
+ return;
217
+ const touch = e.changedTouches[0];
218
+ const startTouch = touchStartRef.current;
219
+ // Calculate touch movement
220
+ const deltaX = Math.abs(touch.clientX - startTouch.x);
221
+ const deltaY = Math.abs(touch.clientY - startTouch.y);
222
+ const isSwipe = deltaX > 10 || deltaY > 10;
223
+ // Check if touch is outside dropdown area
224
+ const target = e.target;
225
+ const isOutsideDropdown = dropdownRef.current &&
226
+ !dropdownRef.current.contains(target) &&
227
+ buttonRef.current &&
228
+ !buttonRef.current.contains(target);
229
+ // Close if touch ended outside and wasn't a swipe
230
+ if (!isSwipe && isOutsideDropdown) {
231
+ closeDropdown();
232
+ }
233
+ touchStartRef.current = null;
234
+ }, [is_mobile, is_open, closeDropdown]);
235
+ // Set up mobile touch listeners
236
+ useEffect(() => {
237
+ if (is_mobile && is_open) {
238
+ document.addEventListener("touchstart", handleTouchStart);
239
+ document.addEventListener("touchend", handleTouchEnd);
240
+ return () => {
241
+ document.removeEventListener("touchstart", handleTouchStart);
242
+ document.removeEventListener("touchend", handleTouchEnd);
243
+ };
244
+ }
245
+ }, [is_mobile, is_open, handleTouchStart, handleTouchEnd]);
246
+ // Prevent event propagation for dropdown content
247
+ const handleDropdownInteraction = useCallback((e) => {
248
+ e.stopPropagation();
249
+ }, []);
250
+ // Toggle dropdown
251
+ const handleButtonClick = useCallback((e) => {
252
+ e.stopPropagation();
253
+ set_is_open(!is_open);
254
+ }, [is_open]);
255
+ return (jsxs("div", { className: cn("relative z-[100]", className), ref: dropdownRef, children: [jsxs(Button, { ref: buttonRef, type: "button", variant: "ghost", className: "relative flex items-center gap-2 h-12 px-3 z-[1000]", onClick: handleButtonClick, onTouchEnd: (e) => e.stopPropagation(), children: [display, showArrow && (jsx(ChevronDown, { className: cn("w-4 h-4 text-muted-foreground transition-transform", is_open ? "rotate-180" : "") }))] }), is_open && (jsx("div", { className: cn("absolute right-0 mt-2 bg-background border border-border rounded-control-lg overflow-hidden shadow-card z-[1000]", is_mobile ? "w-56" : "w-48", // Slightly wider on mobile for better touch targets
256
+ className), onClick: handleDropdownInteraction, onTouchStart: handleDropdownInteraction, onTouchEnd: handleDropdownInteraction, children: jsxs("div", { className: cn("relative z-[1000] max-h-64 overflow-y-auto overscroll-contain [scrollbar-width:thin] [scrollbar-color:var(--color-border-hover)_var(--muted)]", is_mobile ? "max-h-80" : "max-h-64"), children: [content, Children.map(children, (child, index) => {
257
+ return (jsx(DropdownOptionButton, { set_is_open: set_is_open, children: child ? child : jsx(Fragment, {}) }, index));
258
+ })] }) }))] }));
259
+ };
260
+
261
+ export { DropdownGroup, DropdownOption, GroupableNavDropdown, GroupableRadioDropdown };
262
+ //# sourceMappingURL=dropdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dropdown.js","sources":["../../src/components/dropdown.tsx"],"sourcesContent":["'use client';\n\n/**\n * @ Author: BetterInternship\n * @ Create Time: 2025-06-14 23:30:09\n * @ Modified time: 2025-10-31 18:13:16\n * @ Description:\n *\n * Stateful dropdown group component.\n */\n\nimport { Button } from \"./button\";\nimport { useMobile } from \"@/hooks/use-mobile\";\nimport { useMobileSheetViewport } from \"@/hooks/use-mobile-sheet-viewport\";\nimport { MobileSheetPortal } from \"./mobile-sheet-portal\";\nimport { cn } from \"@/utils\";\nimport { fieldTriggerClassName } from \"@/hooks/use-field-focus\";\nimport { ChevronDown, X } from \"lucide-react\";\nimport { useRouter } from \"next/navigation\";\nimport React, {\n Children,\n createContext,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { useDetectClickOutside } from '@/hooks/use-detect-click-outside';\n\n/**\n * The group context interface.\n * What's available in the group context to other components.\n */\ninterface IDropdownGroupContext {\n activeDropdown: string;\n setActiveDropdown: (dropdown: string) => void;\n}\nconst DropdownGroupContext = createContext<IDropdownGroupContext>(\n {} as IDropdownGroupContext,\n);\n\n/**\n * A wrapper around the contents of a dropdown option.\n *\n * @component\n */\ntype IDropdownOptionProps = {\n children?: React.ReactNode;\n highlighted?: boolean;\n disabled?: boolean;\n href?: string;\n on_click?: () => void;\n};\nexport const DropdownOption = ({ children }: IDropdownOptionProps) => {\n return <>{children}</>;\n};\n\n/**\n * Creates a standard button dropdowns must use with mobile optimization.\n * Not meant to be used elsewhere.\n *\n * @component\n */\nconst DropdownOptionButton = ({\n children,\n set_is_open,\n size = \"xs\",\n}: {\n children: React.ReactElement<IDropdownOptionProps>;\n set_is_open: (is_open: boolean) => void;\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\";\n}) => {\n const router = useRouter();\n const is_mobile = useMobile();\n const [scrolling, setScrolling] = useState(false);\n const dropdown_button_ref = useRef<HTMLInputElement>({} as HTMLInputElement);\n\n const handleClick = useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n set_is_open(false);\n children.props.on_click && children.props.on_click();\n children.props.href && router.push(children.props.href);\n },\n [children.props, router, set_is_open],\n );\n\n const onTouchStart = (e: any) => {\n e.stopPropagation();\n setScrolling(true);\n };\n\n const onTouchEnd = (e: any) => {\n e.stopPropagation();\n setScrolling(false);\n };\n\n useEffect(() => {\n const dropdown_button = dropdown_button_ref.current;\n if (!dropdown_button) return;\n\n // Attach passive touchstart handler\n dropdown_button.addEventListener(\"touchstart\", onTouchStart, {\n passive: true,\n });\n\n dropdown_button.addEventListener(\"touchend\", onTouchEnd, {\n passive: true,\n });\n\n // Cleanup on unmount\n return () => {\n dropdown_button.removeEventListener(\"touchstart\", onTouchStart);\n dropdown_button.removeEventListener(\"touchend\", onTouchEnd);\n };\n }, [onTouchStart]);\n\n return (\n <button\n // @ts-ignore\n ref={dropdown_button_ref}\n className={cn(\n \"w-full cursor-pointer text-left px-4 py-2 text-muted-foreground hover:bg-muted transition-colors flex items-center gap-2\",\n is_mobile ? \"min-h-12 py-3 active:bg-muted touch-manipulation\" : \"\",\n `text-${size}`,\n children.props.highlighted ? \"bg-primary-tint\" : \"\",\n )}\n onClick={(e) => !scrolling && handleClick(e)}\n >\n <div className=\"w-full\">{children}</div>\n </button>\n );\n};\n\n/**\n * This component creates a context provider for dropdowns inside it to use.\n * The dropdowns inside can modify the active dropdown when they're clicked.\n * This way, only one dropdown in the group is active at a time.\n *\n * @component\n */\nexport const DropdownGroup = ({ children }: { children: React.ReactNode }) => {\n const [activeDropdown, setActiveDropdown] = useState(\"\");\n const group_dropdown_context: IDropdownGroupContext = {\n activeDropdown,\n setActiveDropdown,\n };\n\n return (\n <DropdownGroupContext value={group_dropdown_context}>\n {children}\n </DropdownGroupContext>\n );\n};\n\ninterface IRadioDropdownOption<ID> {\n id: ID;\n name: string;\n}\n\n/**\n * This represents a single dropdown inside the group with mobile optimization.\n * Inherits the provided context (if there is none, that's fine).\n *\n * @component\n */\nexport const GroupableRadioDropdown = <ID extends number | string>({\n name,\n options,\n onChange,\n disabled,\n defaultValue = null,\n size = \"sm\",\n className = \"\",\n fallback = \"Select option\",\n}: {\n name: string;\n options: IRadioDropdownOption<ID>[];\n onChange: (option: ID) => void;\n defaultValue?: ID | ID[] | null;\n disabled?: boolean | undefined;\n size?: \"xs\" | \"sm\" | \"md\" | \"lg\";\n className?: string;\n fallback?: string;\n}) => {\n const isMobile = useMobile();\n const { activeDropdown, setActiveDropdown } =\n useContext(DropdownGroupContext);\n const [isOpen, setIsOpen] = useState(false);\n const sheetViewport = useMobileSheetViewport(isOpen && isMobile);\n const [value, setValue] = useState(defaultValue);\n const ref = useDetectClickOutside({ onTriggered: () => setIsOpen(false) });\n const triggerRef = useRef<HTMLButtonElement>(null);\n const sheetRef = useRef<HTMLDivElement>(null);\n const sheetCloseRef = useRef<HTMLButtonElement>(null);\n const useSheet = isOpen && isMobile;\n\n const closeSheet = useCallback(() => {\n setIsOpen(false);\n triggerRef.current?.focus();\n }, []);\n\n // While the mobile sheet is open: lock page scroll and move focus into it.\n useEffect(() => {\n if (!useSheet) return;\n const overflow = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n const frame = window.requestAnimationFrame(() =>\n sheetCloseRef.current?.focus(),\n );\n return () => {\n window.cancelAnimationFrame(frame);\n document.body.style.overflow = overflow;\n };\n }, [useSheet]);\n\n // Just so it's not stuck at the first default when the default changes\n useEffect(() => {\n setValue(defaultValue);\n }, [defaultValue]);\n\n /**\n * Activates dropdown\n */\n const handleClick = useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n setIsOpen(!isOpen);\n setActiveDropdown(name);\n },\n [isOpen, name, setActiveDropdown],\n );\n\n /**\n * Changes dropdown value\n */\n const handleChange = useCallback(\n (option: ID) => {\n setValue(option);\n onChange(option);\n setIsOpen(false);\n },\n [onChange],\n );\n\n // Check if it's still the active dropdown\n useEffect(() => {\n if (activeDropdown !== name) setIsOpen(false);\n }, [activeDropdown, name]);\n\n const selected =\n value || value === 0 ? options.find((o) => o.id === value) : undefined;\n\n return (\n <div\n className={cn(\"relative w-full max-w-svw min-w-0\", className)}\n ref={ref}\n >\n <Button\n ref={triggerRef}\n type=\"button\"\n variant=\"outline\"\n disabled={disabled}\n size={size}\n onClick={handleClick}\n onTouchEnd={(e) => e.stopPropagation()}\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n className={cn(\n \"w-full max-w-full min-w-0\",\n \"h-auto py-1\",\n fieldTriggerClassName,\n \"flex items-center justify-between gap-2\",\n )}\n >\n {/* shrinkable text container */}\n <span className=\"flex-1 min-w-0 text-left pr-2 leading-relaxed\">\n {selected ? (\n <span className=\"block whitespace-normal wrap-break-word\">\n {selected.name}\n </span>\n ) : (\n <span className=\"text-muted-foreground/40 font-normal\">\n {fallback}\n </span>\n )}\n </span>\n\n <ChevronDown\n className={cn(\n \"shrink-0 w-4 h-4 text-muted-foreground transition-transform duration-interactive ease-out-strong motion-reduce:transition-none\",\n isOpen ? \"rotate-180\" : \"\",\n )}\n />\n </Button>\n\n {isOpen && (\n <MobileSheetPortal enabled={isMobile}>\n {isMobile && (\n <button\n type=\"button\"\n aria-label=\"Close options\"\n tabIndex={-1}\n className=\"fixed inset-0 z-[1090] bg-black/25 backdrop-blur-[1px]\"\n onClick={closeSheet}\n />\n )}\n <div\n ref={isMobile ? sheetRef : undefined}\n role={isMobile ? \"dialog\" : undefined}\n aria-modal={isMobile ? true : undefined}\n aria-label={isMobile ? fallback : undefined}\n onKeyDown={\n isMobile\n ? (event) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n closeSheet();\n }\n if (event.key !== \"Tab\") return;\n const focusable =\n sheetRef.current?.querySelectorAll<HTMLElement>(\n \"button:not([disabled]):not([tabindex='-1'])\",\n );\n if (!focusable?.length) return;\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (event.shiftKey && document.activeElement === first) {\n event.preventDefault();\n last.focus();\n } else if (\n !event.shiftKey &&\n document.activeElement === last\n ) {\n event.preventDefault();\n first.focus();\n }\n }\n : undefined\n }\n className={cn(\n \"border border-border bg-background shadow-card\",\n isMobile\n ? \"fixed left-0 right-0 z-[1100] flex flex-col overflow-hidden rounded-t-control-lg border-b-0 pb-[max(0.75rem,env(safe-area-inset-bottom))]\"\n : \"absolute left-0 right-0 top-full z-[9999] mt-1 max-w-full overflow-hidden rounded-control-lg\",\n )}\n style={\n isMobile\n ? {\n bottom: sheetViewport?.bottom ?? 0,\n maxHeight: sheetViewport\n ? Math.min(sheetViewport.height, 640)\n : \"80dvh\",\n }\n : undefined\n }\n >\n {isMobile && (\n <div className=\"flex shrink-0 items-center justify-between gap-4 px-4 pb-2 pt-4\">\n <h2 className=\"text-base font-semibold text-foreground\">\n {fallback}\n </h2>\n <button\n ref={sheetCloseRef}\n type=\"button\"\n aria-label=\"Close options\"\n className=\"-mr-3 flex h-11 w-11 shrink-0 cursor-pointer items-center justify-center rounded-control-lg text-muted-foreground hover:bg-muted\"\n onClick={closeSheet}\n >\n <X className=\"h-5 w-5\" aria-hidden=\"true\" />\n </button>\n </div>\n )}\n <div\n role=\"listbox\"\n className={cn(\n \"relative overflow-y-auto overscroll-contain touch-pan-y [-webkit-overflow-scrolling:touch] [scrollbar-width:thin] [scrollbar-color:var(--color-border-hover)_var(--muted)]\",\n isMobile ? \"min-h-0 flex-1\" : \"max-h-[400px]\",\n )}\n >\n {options.map((option, index) => (\n <DropdownOptionButton\n key={index}\n set_is_open={setIsOpen}\n size={size}\n >\n <DropdownOption\n highlighted={value === option.id}\n on_click={() => handleChange(option.id)}\n >\n <span className=\"block whitespace-normal wrap-break-word pr-2\">\n {option.name}\n </span>\n </DropdownOption>\n </DropdownOptionButton>\n ))}\n </div>\n </div>\n </MobileSheetPortal>\n )}\n </div>\n );\n};\n\n/**\n * This creates a dropdown menu for navigating with improved mobile support.\n *\n * @component\n */\nexport const GroupableNavDropdown = ({\n display,\n content,\n children,\n className = \"\",\n showArrow = true,\n}: {\n display?: React.ReactNode;\n content?: React.ReactNode;\n children?:\n | React.ReactElement<IDropdownOptionProps>\n | React.ReactElement<IDropdownOptionProps>[];\n className?: string;\n showArrow?: boolean;\n}) => {\n const is_mobile = useMobile();\n const [is_open, set_is_open] = useState(false);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const touchStartRef = useRef<{\n x: number;\n y: number;\n target: EventTarget | null;\n } | null>(null);\n\n // Close dropdown handler\n const closeDropdown = useCallback(() => {\n set_is_open(false);\n }, []);\n\n // Handle clicks outside dropdown\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (\n !is_mobile &&\n dropdownRef.current &&\n !dropdownRef.current.contains(event.target as Node) &&\n buttonRef.current &&\n !buttonRef.current.contains(event.target as Node)\n ) {\n closeDropdown();\n }\n };\n\n if (is_open && !is_mobile) {\n document.addEventListener(\"mousedown\", handleClickOutside);\n return () =>\n document.removeEventListener(\"mousedown\", handleClickOutside);\n }\n }, [is_open, is_mobile, closeDropdown]);\n\n // Mobile touch handlers\n const handleTouchStart = useCallback(\n (e: TouchEvent) => {\n if (!is_mobile || !is_open) return;\n\n const touch = e.touches[0];\n touchStartRef.current = {\n x: touch.clientX,\n y: touch.clientY,\n target: e.target,\n };\n },\n [is_mobile, is_open],\n );\n\n const handleTouchEnd = useCallback(\n (e: TouchEvent) => {\n if (!is_mobile || !is_open || !touchStartRef.current) return;\n\n const touch = e.changedTouches[0];\n const startTouch = touchStartRef.current;\n\n // Calculate touch movement\n const deltaX = Math.abs(touch.clientX - startTouch.x);\n const deltaY = Math.abs(touch.clientY - startTouch.y);\n const isSwipe = deltaX > 10 || deltaY > 10;\n\n // Check if touch is outside dropdown area\n const target = e.target as Element;\n const isOutsideDropdown =\n dropdownRef.current &&\n !dropdownRef.current.contains(target) &&\n buttonRef.current &&\n !buttonRef.current.contains(target);\n\n // Close if touch ended outside and wasn't a swipe\n if (!isSwipe && isOutsideDropdown) {\n closeDropdown();\n }\n\n touchStartRef.current = null;\n },\n [is_mobile, is_open, closeDropdown],\n );\n\n // Set up mobile touch listeners\n useEffect(() => {\n if (is_mobile && is_open) {\n document.addEventListener(\"touchstart\", handleTouchStart);\n document.addEventListener(\"touchend\", handleTouchEnd);\n\n return () => {\n document.removeEventListener(\"touchstart\", handleTouchStart);\n document.removeEventListener(\"touchend\", handleTouchEnd);\n };\n }\n }, [is_mobile, is_open, handleTouchStart, handleTouchEnd]);\n\n // Prevent event propagation for dropdown content\n const handleDropdownInteraction = useCallback(\n (e: React.MouseEvent | React.TouchEvent) => {\n e.stopPropagation();\n },\n [],\n );\n\n // Toggle dropdown\n const handleButtonClick = useCallback(\n (e: React.MouseEvent) => {\n e.stopPropagation();\n set_is_open(!is_open);\n },\n [is_open],\n );\n\n return (\n <div className={cn(\"relative z-[100]\", className)} ref={dropdownRef}>\n <Button\n ref={buttonRef}\n type=\"button\"\n variant=\"ghost\"\n className=\"relative flex items-center gap-2 h-12 px-3 z-[1000]\"\n onClick={handleButtonClick}\n onTouchEnd={(e) => e.stopPropagation()}\n >\n {display}\n {showArrow && (\n <ChevronDown\n className={cn(\n \"w-4 h-4 text-muted-foreground transition-transform\",\n is_open ? \"rotate-180\" : \"\",\n )}\n />\n )}\n </Button>\n\n {is_open && (\n <div\n className={cn(\n \"absolute right-0 mt-2 bg-background border border-border rounded-control-lg overflow-hidden shadow-card z-[1000]\",\n is_mobile ? \"w-56\" : \"w-48\", // Slightly wider on mobile for better touch targets\n className,\n )}\n onClick={handleDropdownInteraction}\n onTouchStart={handleDropdownInteraction}\n onTouchEnd={handleDropdownInteraction}\n >\n <div\n className={cn(\n \"relative z-[1000] max-h-64 overflow-y-auto overscroll-contain [scrollbar-width:thin] [scrollbar-color:var(--color-border-hover)_var(--muted)]\",\n is_mobile ? \"max-h-80\" : \"max-h-64\",\n )}\n >\n {content}\n\n {Children.map(children, (child, index) => {\n return (\n <DropdownOptionButton key={index} set_is_open={set_is_open}>\n {child ? child : <></>}\n </DropdownOptionButton>\n );\n })}\n </div>\n </div>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAsCA;;;AAkBA;AAEA;;;;;AAKG;AACH;AASE;AACA;;AAEA;AAEA;;;;AAKI;;AAKJ;;;AAGA;AAEA;;;AAGA;;AAGE;AACA;;;AAGA;AACE;AACD;AAED;AACE;AACD;;AAGD;AACE;AACA;AACF;AACF;AAEA;;AAGI;AAYN;AAEA;;;;;;AAMG;;;AAGD;;;;;AAUF;AAOA;;;;;AAKG;AACI;AAmBL;;;;;AAMA;AACA;AACA;AACA;AACA;AAEA;;AAEE;;;;AAKA;;;;AAGA;AAGA;AACE;;AAEF;AACF;;;;AAKA;AAEA;;AAEG;AACH;;AAGI;;;AAMJ;;AAEG;AACH;;;;AAKE;;;;;AAOF;AAEA;;AAgEc;AACI;;AAEE;;AAEF;;;;;AAMA;;;;;;;AAOE;;;;;;AAWN;AACA;AAIA;AACI;AACA;;AAEE;AACH;AACH;AAgDhB;AAEA;;;;AAIG;;AAgBD;;AAEA;AACA;AACA;;AAOA;;;;;AAME;AACE;AAEE;;AAEA;;AAGA;;AAEJ;AAEA;AACE;;;;;AAOJ;AAEI;;;;;;;;AAQF;AAIF;;;;AAKI;;AAGA;AACA;;;AAIA;AACA;AAEE;AACA;;;AAIF;AACE;;AAGF;;;;AAOF;AACE;AACA;AAEA;AACE;AACA;AACF;;;;AAKJ;;;;AAQA;;AAGI;AACF;;;;AAkDQ;AAMZ;;"}
@@ -0,0 +1,19 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { CircleAlert, RotateCw } from 'lucide-react';
3
+ import { cn } from '../utils.js';
4
+ import { Card } from './card.js';
5
+ import { Button } from './button.js';
6
+
7
+ function ErrorGraphic() {
8
+ return jsx("img", { src: "/error-exclamation-sprite.png", alt: "", className: "h-32 w-auto object-contain motion-safe:animate-error-bob motion-reduce:animate-none" });
9
+ }
10
+ const PageError = ({ title, description, image = false, flush = false, topAlign = false, onRetry, }) => {
11
+ return (jsx("div", { role: "alert", className: cn("animate-in fade-in-0 duration-interactive ease-out-strong motion-reduce:animate-none", flush ? "h-full" : "px-4 py-16"), children: jsxs(Card, { className: cn("m-auto gap-0 px-6 py-8", flush
12
+ ? cn("h-full w-full items-start text-left", topAlign ? "justify-start" : "justify-center")
13
+ : "max-w-md items-center text-center"), children: [jsx("span", { "aria-hidden": "true", className: cn("mb-4 flex items-center justify-center text-destructive", image
14
+ ? "h-40 w-32"
15
+ : "size-12 rounded-full bg-destructive/10"), children: image ? jsx(ErrorGraphic, {}) : jsx(CircleAlert, { className: "size-6" }) }), jsx("h3", { className: "text-lg font-semibold text-foreground", children: title }), jsx("p", { className: "mt-2 text-base leading-relaxed text-muted-foreground", children: description }), onRetry && (jsxs(Button, { variant: "outline", className: "mt-6", onClick: onRetry, children: [jsx(RotateCw, { className: "size-4", "aria-hidden": "true" }), "Retry"] }))] }) }));
16
+ };
17
+
18
+ export { PageError };
19
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sources":["../../src/components/error.tsx"],"sourcesContent":["import { CircleAlert, RotateCw } from \"lucide-react\";\nimport { cn } from \"@/utils\";\nimport { Card } from \"./card\";\nimport { Button } from \"./button\";\n\nfunction ErrorGraphic() {\n return <img src=\"/error-exclamation-sprite.png\" alt=\"\" className=\"h-32 w-auto object-contain motion-safe:animate-error-bob motion-reduce:animate-none\" />;\n}\n\nexport const PageError = ({\n title,\n description,\n image = false,\n flush = false,\n topAlign = false,\n onRetry,\n}: {\n title: string;\n description: string;\n // Shows /error.png beneath the text.\n image?: boolean;\n // Card fills its container edge-to-edge instead of capping at max-w-md\n // with breathing room around it.\n flush?: boolean;\n // Aligns content to the top of the card instead of vertically centering\n // it (flush mode only).\n topAlign?: boolean;\n // Shows a \"Retry\" button that calls this when clicked.\n onRetry?: () => void;\n}) => {\n return (\n <div\n role=\"alert\"\n className={cn(\n \"animate-in fade-in-0 duration-interactive ease-out-strong motion-reduce:animate-none\",\n flush ? \"h-full\" : \"px-4 py-16\",\n )}\n >\n <Card\n className={cn(\n \"m-auto gap-0 px-6 py-8\",\n flush\n ? cn(\n \"h-full w-full items-start text-left\",\n topAlign ? \"justify-start\" : \"justify-center\",\n )\n : \"max-w-md items-center text-center\",\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n \"mb-4 flex items-center justify-center text-destructive\",\n image\n ? \"h-40 w-32\"\n : \"size-12 rounded-full bg-destructive/10\",\n )}\n >\n {image ? <ErrorGraphic /> : <CircleAlert className=\"size-6\" />}\n </span>\n <h3 className=\"text-lg font-semibold text-foreground\">{title}</h3>\n <p className=\"mt-2 text-base leading-relaxed text-muted-foreground\">\n {description}\n </p>\n {onRetry && (\n <Button variant=\"outline\" className=\"mt-6\" onClick={onRetry}>\n <RotateCw className=\"size-4\" aria-hidden=\"true\" />\n Retry\n </Button>\n )}\n </Card>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;AAKA,SAAS,YAAY,GAAA;AACnB,IAAA,OAAOA,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAC,+BAA+B,EAAC,GAAG,EAAC,EAAE,EAAC,SAAS,EAAC,qFAAqF,GAAG;AAC3J;AAEO,MAAM,SAAS,GAAG,CAAC,EACxB,KAAK,EACL,WAAW,EACX,KAAK,GAAG,KAAK,EACb,KAAK,GAAG,KAAK,EACb,QAAQ,GAAG,KAAK,EAChB,OAAO,GAcR,KAAI;AACH,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EACE,IAAI,EAAC,OAAO,EACZ,SAAS,EAAE,EAAE,CACX,sFAAsF,EACtF,KAAK,GAAG,QAAQ,GAAG,YAAY,CAChC,YAEDC,IAAA,CAAC,IAAI,EAAA,EACH,SAAS,EAAE,EAAE,CACX,wBAAwB,EACxB;AACE,kBAAE,EAAE,CACA,qCAAqC,EACrC,QAAQ,GAAG,eAAe,GAAG,gBAAgB;AAEjD,kBAAE,mCAAmC,CACxC,EAAA,QAAA,EAAA,CAEDD,GAAA,CAAA,MAAA,EAAA,EAAA,aAAA,EACc,MAAM,EAClB,SAAS,EAAE,EAAE,CACX,wDAAwD,EACxD;AACE,0BAAE;AACF,0BAAE,wCAAwC,CAC7C,EAAA,QAAA,EAEA,KAAK,GAAGA,GAAA,CAAC,YAAY,EAAA,EAAA,CAAG,GAAGA,GAAA,CAAC,WAAW,EAAA,EAAC,SAAS,EAAC,QAAQ,EAAA,CAAG,EAAA,CACzD,EACPA,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAC,uCAAuC,YAAE,KAAK,EAAA,CAAM,EAClEA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,sDAAsD,EAAA,QAAA,EAChE,WAAW,EAAA,CACV,EACH,OAAO,KACNC,IAAA,CAAC,MAAM,EAAA,EAAC,OAAO,EAAC,SAAS,EAAC,SAAS,EAAC,MAAM,EAAC,OAAO,EAAE,OAAO,EAAA,QAAA,EAAA,CACzDD,GAAA,CAAC,QAAQ,EAAA,EAAC,SAAS,EAAC,QAAQ,EAAA,aAAA,EAAa,MAAM,GAAG,EAAA,OAAA,CAAA,EAAA,CAE3C,CACV,CAAA,EAAA,CACI,EAAA,CACH;AAEV;;;;"}
@@ -0,0 +1,9 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { Button } from './button.js';
3
+
4
+ const FloatingActionButton = ({ onClick, children }) => {
5
+ return (jsx(Button, { onClick: onClick, className: "fixed bottom-4 right-4 z-50 rounded-full bg-primary p-4 text-primary-foreground shadow-lg transition-[background-color,box-shadow,transform] duration-interactive ease-out-strong hover:bg-primary-hover hover:shadow-interactive motion-safe:pointer-fine:hover:-translate-y-0.5 motion-safe:active:translate-y-0 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary motion-reduce:transition-none", children: children }));
6
+ };
7
+
8
+ export { FloatingActionButton };
9
+ //# sourceMappingURL=fab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fab.js","sources":["../../src/components/fab.tsx"],"sourcesContent":["import { Button } from \"@/components/button\";\n\nconst FloatingActionButton = ({ onClick, children }: { onClick: () => void; children: React.ReactNode }) => {\n return (\n <Button\n onClick={onClick}\n className=\"fixed bottom-4 right-4 z-50 rounded-full bg-primary p-4 text-primary-foreground shadow-lg transition-[background-color,box-shadow,transform] duration-interactive ease-out-strong hover:bg-primary-hover hover:shadow-interactive motion-safe:pointer-fine:hover:-translate-y-0.5 motion-safe:active:translate-y-0 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary motion-reduce:transition-none\"\n >\n {children}\n </Button>\n );\n}\n\nexport { FloatingActionButton };\n"],"names":["_jsx"],"mappings":";;;AAEA,MAAM,oBAAoB,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAsD,KAAI;AACzG,IAAA,QACEA,GAAA,CAAC,MAAM,EAAA,EACL,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,yZAAyZ,EAAA,QAAA,EAEla,QAAQ,EAAA,CACF;AAEb;;;;"}
@@ -0,0 +1,71 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import { Slot } from '@radix-ui/react-slot';
5
+ import { useFormContext, FormProvider, Controller } from '../node_modules/react-hook-form/dist/index.esm.js';
6
+ import { cn } from '../utils.js';
7
+ import { Label } from './label.js';
8
+
9
+ const Form = FormProvider;
10
+ const FormFieldContext = React.createContext({});
11
+ const FormField = ({ ...props }) => {
12
+ return (jsx(FormFieldContext.Provider, { value: { name: props.name }, children: jsx(Controller, { ...props }) }));
13
+ };
14
+ const useFormField = () => {
15
+ const fieldContext = React.useContext(FormFieldContext);
16
+ const itemContext = React.useContext(FormItemContext);
17
+ const { getFieldState, formState } = useFormContext();
18
+ const fieldState = getFieldState(fieldContext.name, formState);
19
+ if (!fieldContext) {
20
+ throw new Error("useFormField should be used within <FormField>");
21
+ }
22
+ const { id } = itemContext;
23
+ return {
24
+ id,
25
+ name: fieldContext.name,
26
+ formItemId: `${id}-form-item`,
27
+ formDescriptionId: `${id}-form-item-description`,
28
+ formMessageId: `${id}-form-item-message`,
29
+ ...fieldState,
30
+ };
31
+ };
32
+ const FormItemContext = React.createContext({});
33
+ const FormItem = React.forwardRef(({ className, ...props }, ref) => {
34
+ const id = React.useId();
35
+ return (jsx(FormItemContext.Provider, { value: { id }, children: jsx("div", { ref: ref, className: cn("space-y-field-label-gap", className), ...props }) }));
36
+ });
37
+ FormItem.displayName = "FormItem";
38
+ const FormLabel = React.forwardRef(({ className, required = false, children, ...props }, ref) => {
39
+ const { error, formItemId } = useFormField();
40
+ return (jsx(Label, { label: children, required: required, className: "mb-0", labelProps: {
41
+ ref,
42
+ htmlFor: formItemId,
43
+ ...props,
44
+ className: cn(error && 'text-destructive', className),
45
+ } }));
46
+ });
47
+ FormLabel.displayName = "FormLabel";
48
+ const FormControl = React.forwardRef(({ ...props }, ref) => {
49
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
50
+ return (jsx(Slot, { ref: ref, id: formItemId, "aria-describedby": !error
51
+ ? `${formDescriptionId}`
52
+ : `${formDescriptionId} ${formMessageId}`, "aria-invalid": !!error, ...props }));
53
+ });
54
+ FormControl.displayName = "FormControl";
55
+ const FormDescription = React.forwardRef(({ className, ...props }, ref) => {
56
+ const { formDescriptionId } = useFormField();
57
+ return (jsx("p", { ref: ref, id: formDescriptionId, className: cn("text-sm leading-normal text-muted-foreground", className), ...props }));
58
+ });
59
+ FormDescription.displayName = "FormDescription";
60
+ const FormMessage = React.forwardRef(({ className, children, ...props }, ref) => {
61
+ const { error, formMessageId } = useFormField();
62
+ const body = error ? String(error?.message) : children;
63
+ if (!body) {
64
+ return null;
65
+ }
66
+ return (jsx("p", { ref: ref, id: formMessageId, className: cn("text-sm leading-normal font-medium text-destructive", className), ...props, children: body }));
67
+ });
68
+ FormMessage.displayName = "FormMessage";
69
+
70
+ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
71
+ //# sourceMappingURL=form.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.js","sources":["../../src/components/form.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n Controller,\n ControllerProps,\n FieldPath,\n FieldValues,\n FormProvider,\n useFormContext,\n} from \"react-hook-form\";\n\nimport { cn } from \"@/utils\";\nimport { Label } from './label';\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>(\n {} as FormFieldContextValue,\n);\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\");\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>(\n {} as FormItemContextValue,\n);\n\nconst FormItem = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-field-label-gap\", className)} {...props} />\n </FormItemContext.Provider>\n );\n});\nFormItem.displayName = \"FormItem\";\n\nconst FormLabel = React.forwardRef<\n HTMLLabelElement,\n React.ComponentPropsWithoutRef<'label'> & { required?: boolean }\n>(({ className, required = false, children, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n label={children}\n required={required}\n className=\"mb-0\"\n labelProps={{\n ref,\n htmlFor: formItemId,\n ...props,\n className: cn(error && 'text-destructive', className),\n }}\n />\n );\n});\nFormLabel.displayName = \"FormLabel\";\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } =\n useFormField();\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={\n !error\n ? `${formDescriptionId}`\n : `${formDescriptionId} ${formMessageId}`\n }\n aria-invalid={!!error}\n {...props}\n />\n );\n});\nFormControl.displayName = \"FormControl\";\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm leading-normal text-muted-foreground\", className)}\n {...props}\n />\n );\n});\nFormDescription.displayName = \"FormDescription\";\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm leading-normal font-medium text-destructive\", className)}\n {...props}\n >\n {body}\n </p>\n );\n});\nFormMessage.displayName = \"FormMessage\";\n\nexport {\n useFormField,\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n};\n"],"names":[],"mappings":";;;;;;;;AAgBA;AASA;AAIA;;AAWA;AAEA;;;;;;AAQI;;AAGF;;;;;;;AAQE;;AAEJ;AAMA;AAIA;AAIE;AAEA;AAKF;AACA;AAEA;;AAME;;AAOM;AACA;;AAED;AAGP;AACA;AAEA;AAIE;AAGA;;AAOQ;AAMV;AACA;AAEA;AAIE;;AAUF;AACA;AAEA;;AAKE;;AAGE;;;AAaJ;AACA;;"}
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
5
+ import { cn } from '../utils.js';
6
+
7
+ const HoverCard = HoverCardPrimitive.Root;
8
+ const HoverCardTrigger = HoverCardPrimitive.Trigger;
9
+ const HoverCardContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => (jsx(HoverCardPrimitive.Portal, { children: jsx(HoverCardPrimitive.Content, { ref: ref, align: align, sideOffset: sideOffset, className: cn("z-50 w-64 max-w-[calc(100vw-2rem)] rounded-card border border-border bg-popover p-4 text-sm text-popover-foreground shadow-card outline-none 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 }) })));
10
+ HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
11
+
12
+ export { HoverCard, HoverCardContent, HoverCardTrigger };
13
+ //# sourceMappingURL=hover-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hover-card.js","sources":["../../src/components/hover-card.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as HoverCardPrimitive from \"@radix-ui/react-hover-card\";\n\nimport { cn } from \"@/utils\";\n\nconst HoverCard = HoverCardPrimitive.Root;\n\nconst HoverCardTrigger = HoverCardPrimitive.Trigger;\n\nconst HoverCardContent = React.forwardRef<\n React.ElementRef<typeof HoverCardPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>\n>(({ className, align = \"center\", sideOffset = 4, ...props }, ref) => (\n <HoverCardPrimitive.Portal>\n <HoverCardPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 w-64 max-w-[calc(100vw-2rem)] rounded-card border border-border bg-popover p-4 text-sm text-popover-foreground shadow-card outline-none 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 </HoverCardPrimitive.Portal>\n));\nHoverCardContent.displayName = HoverCardPrimitive.Content.displayName;\n\nexport { HoverCard, HoverCardTrigger, HoverCardContent };\n"],"names":[],"mappings":";;;;;;AAOA;AAEA;AAEA;AAiBA;;"}
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import * as React from 'react';
4
+ import { OTPInput as $t, OTPInputContext as Nt } from '../node_modules/input-otp/dist/index.js';
5
+ import { Dot } from 'lucide-react';
6
+ import { cn } from '../utils.js';
7
+
8
+ const InputOTPSizeContext = React.createContext('md');
9
+ const InputOTP = React.forwardRef(({ className, containerClassName, ...props }, ref) => (jsx($t, { ref: ref, containerClassName: cn("flex items-center gap-2 has-[:disabled]:opacity-50", containerClassName), className: cn("disabled:cursor-not-allowed", className), ...props })));
10
+ InputOTP.displayName = "InputOTP";
11
+ const InputOTPGroup = React.forwardRef(({ className, size = 'md', ...props }, ref) => (jsx(InputOTPSizeContext.Provider, { value: size, children: jsx("div", { ref: ref, className: cn("flex items-center", className), ...props }) })));
12
+ InputOTPGroup.displayName = "InputOTPGroup";
13
+ const InputOTPSlot = React.forwardRef(({ index, className, ...props }, ref) => {
14
+ const inputOTPContext = React.useContext(Nt);
15
+ const size = React.useContext(InputOTPSizeContext);
16
+ const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
17
+ return (jsxs("div", { ref: ref, className: cn("relative flex shrink-0 items-center justify-center border-y border-r border-input bg-background text-foreground transition-colors duration-interactive ease-out-strong motion-reduce:transition-none first:rounded-l-control-lg first:border-l last:rounded-r-control-lg", isActive && "z-10 bg-muted", size === 'md' && 'h-form-control min-h-form-control max-h-form-control w-form-control text-base', size === 'lg' && 'h-16 min-h-16 max-h-16 w-16 text-2xl', size === 'xl' && 'h-20 min-h-20 max-h-20 w-20 text-3xl', className), ...props, children: [char, hasFakeCaret && (jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: jsx("div", { className: "h-4 w-px animate-caret-blink bg-foreground duration-1000" }) }))] }));
18
+ });
19
+ InputOTPSlot.displayName = "InputOTPSlot";
20
+ const InputOTPSeparator = React.forwardRef(({ ...props }, ref) => (jsx("div", { ref: ref, role: "separator", ...props, children: jsx(Dot, {}) })));
21
+ InputOTPSeparator.displayName = "InputOTPSeparator";
22
+
23
+ export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
24
+ //# sourceMappingURL=input-otp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-otp.js","sources":["../../src/components/input-otp.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { OTPInput, OTPInputContext } from \"input-otp\";\nimport { Dot } from \"lucide-react\";\n\nimport { cn } from \"@/utils\";\n\nexport type InputOTPSize = 'md' | 'lg' | 'xl';\n\nconst InputOTPSizeContext = React.createContext<InputOTPSize>('md');\n\nconst InputOTP = React.forwardRef<\n React.ElementRef<typeof OTPInput>,\n React.ComponentPropsWithoutRef<typeof OTPInput>\n>(({ className, containerClassName, ...props }, ref) => (\n <OTPInput\n ref={ref}\n containerClassName={cn(\n \"flex items-center gap-2 has-[:disabled]:opacity-50\",\n containerClassName,\n )}\n className={cn(\"disabled:cursor-not-allowed\", className)}\n {...props}\n />\n));\nInputOTP.displayName = \"InputOTP\";\n\nconst InputOTPGroup = React.forwardRef<\n React.ElementRef<\"div\">,\n React.ComponentPropsWithoutRef<\"div\"> & { size?: InputOTPSize }\n>(({ className, size = 'md', ...props }, ref) => (\n <InputOTPSizeContext.Provider value={size}>\n <div ref={ref} className={cn(\"flex items-center\", className)} {...props} />\n </InputOTPSizeContext.Provider>\n));\nInputOTPGroup.displayName = \"InputOTPGroup\";\n\nconst InputOTPSlot = React.forwardRef<\n React.ElementRef<\"div\">,\n React.ComponentPropsWithoutRef<\"div\"> & { index: number }\n>(({ index, className, ...props }, ref) => {\n const inputOTPContext = React.useContext(OTPInputContext);\n const size = React.useContext(InputOTPSizeContext);\n const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];\n\n return (\n <div\n ref={ref}\n className={cn(\n \"relative flex shrink-0 items-center justify-center border-y border-r border-input bg-background text-foreground transition-colors duration-interactive ease-out-strong motion-reduce:transition-none first:rounded-l-control-lg first:border-l last:rounded-r-control-lg\",\n isActive && \"z-10 bg-muted\",\n size === 'md' && 'h-form-control min-h-form-control max-h-form-control w-form-control text-base',\n size === 'lg' && 'h-16 min-h-16 max-h-16 w-16 text-2xl',\n size === 'xl' && 'h-20 min-h-20 max-h-20 w-20 text-3xl',\n className,\n )}\n {...props}\n >\n {char}\n {hasFakeCaret && (\n <div className=\"pointer-events-none absolute inset-0 flex items-center justify-center\">\n <div className=\"h-4 w-px animate-caret-blink bg-foreground duration-1000\" />\n </div>\n )}\n </div>\n );\n});\nInputOTPSlot.displayName = \"InputOTPSlot\";\n\nconst InputOTPSeparator = React.forwardRef<\n React.ElementRef<\"div\">,\n React.ComponentPropsWithoutRef<\"div\">\n>(({ ...props }, ref) => (\n <div ref={ref} role=\"separator\" {...props}>\n <Dot />\n </div>\n));\nInputOTPSeparator.displayName = \"InputOTPSeparator\";\n\nexport { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };\n"],"names":[],"mappings":";;;;;;;AAUA;AAEA;AAcA;AAEA;AAQA;AAEA;;;AAME;;AAuBF;AACA;AAEA;AAQA;;"}
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useReducedMotion, motion } from 'framer-motion';
4
+ import { useRef, useState } from 'react';
5
+
6
+ function MagneticButton({ children, className = "", asChild = false, }) {
7
+ const prefersReduce = useReducedMotion();
8
+ const ref = useRef(null);
9
+ const [tx, setTx] = useState(0);
10
+ const [ty, setTy] = useState(0);
11
+ const max = 6; // px
12
+ function onMove(e) {
13
+ if (prefersReduce)
14
+ return;
15
+ const el = ref.current;
16
+ if (!el)
17
+ return;
18
+ const r = el.getBoundingClientRect();
19
+ const x = (e.clientX - r.left) / r.width - 0.5;
20
+ const y = (e.clientY - r.top) / r.height - 0.5;
21
+ setTx(x * max * 2);
22
+ setTy(y * max * 2);
23
+ }
24
+ function onLeave() {
25
+ setTx(0);
26
+ setTy(0);
27
+ }
28
+ return (jsx(motion.div, { ref: ref, onMouseMove: onMove, onMouseLeave: onLeave, animate: { x: tx, y: ty, rotate: tx * 0.3 }, transition: { type: "spring", stiffness: 200, damping: 15, mass: 0.3 }, className: className, children: children }));
29
+ }
30
+
31
+ export { MagneticButton as default };
32
+ //# sourceMappingURL=magnetic-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"magnetic-button.js","sources":["../../src/components/magnetic-button.tsx"],"sourcesContent":["'use client';\n\nimport { useReducedMotion, motion } from \"framer-motion\";\nimport { useRef, useState } from \"react\";\n\nexport default function MagneticButton({\n children,\n className = \"\",\n asChild = false,\n}: {\n children: React.ReactNode;\n className?: string;\n asChild?: boolean;\n}) {\n const prefersReduce = useReducedMotion();\n const ref = useRef<HTMLDivElement>(null);\n const [tx, setTx] = useState(0);\n const [ty, setTy] = useState(0);\n\n const max = 6; // px\n function onMove(e: React.MouseEvent) {\n if (prefersReduce) return;\n const el = ref.current;\n if (!el) return;\n const r = el.getBoundingClientRect();\n const x = (e.clientX - r.left) / r.width - 0.5;\n const y = (e.clientY - r.top) / r.height - 0.5;\n setTx(x * max * 2);\n setTy(y * max * 2);\n }\n function onLeave() {\n setTx(0);\n setTy(0);\n }\n\n return (\n <motion.div\n ref={ref}\n onMouseMove={onMove}\n onMouseLeave={onLeave}\n animate={{ x: tx, y: ty, rotate: tx * 0.3 }}\n transition={{ type: \"spring\", stiffness: 200, damping: 15, mass: 0.3 }}\n className={className}\n >\n {children}\n </motion.div>\n );\n}\n"],"names":[],"mappings":";;;;;AAKc;AASZ;AACA;;;AAIA;;AAEE;;AACA;AACA;;AACA;AACA;AACA;AACA;AACA;;AAEF;;;;AAKA;AAYF;;"}
@@ -0,0 +1,9 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { Card } from './card.js';
3
+
4
+ const Message = ({ message, them, self, prevSelf, }) => {
5
+ return !self ? (jsxs("div", { className: "flex flex-col max-w-[80%]", children: [prevSelf && (jsx("div", { className: "text-xs pl-1 pb-1 text-muted-foreground", children: them })), jsx(Card, { className: "py-2 px-4 break-all text-sm w-fit", children: message })] })) : (jsxs("div", { className: "flex flex-col items-end max-w-[80%] ml-auto", children: [!prevSelf && (jsx("div", { className: "text-right text-xs pr-1 pb-1 text-muted-foreground", children: "You" })), jsx(Card, { className: "py-2 px-4 text-sm break-all bg-primary text-white text-wrap", children: message })] }));
6
+ };
7
+
8
+ export { Message };
9
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sources":["../../src/components/messages.tsx"],"sourcesContent":["import { Card } from \"./card\";\n\nexport const Message = ({\n message,\n them,\n self,\n prevSelf,\n}: {\n message: string;\n them: string;\n self: boolean;\n prevSelf: boolean;\n}) => {\n return !self ? (\n <div className=\"flex flex-col max-w-[80%]\">\n {prevSelf && (\n <div className=\"text-xs pl-1 pb-1 text-muted-foreground\">{them}</div>\n )}\n <Card className=\"py-2 px-4 break-all text-sm w-fit\">\n {message}\n </Card>\n </div>\n ) : (\n <div className=\"flex flex-col items-end max-w-[80%] ml-auto\">\n {!prevSelf && (\n <div className=\"text-right text-xs pr-1 pb-1 text-muted-foreground\">You</div>\n )}\n <Card className=\"py-2 px-4 text-sm break-all bg-primary text-white text-wrap\">\n {message}\n </Card>\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;;AAEO,MAAM,OAAO,GAAG,CAAC,EACtB,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,QAAQ,GAMT,KAAI;AACH,IAAA,OAAO,CAAC,IAAI,IACVA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,2BAA2B,EAAA,QAAA,EAAA,CACvC,QAAQ,KACPC,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,yCAAyC,EAAA,QAAA,EAAE,IAAI,EAAA,CAAO,CACtE,EACDA,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,mCAAmC,YAChD,OAAO,EAAA,CACH,CAAA,EAAA,CACH,KAEND,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,6CAA6C,EAAA,QAAA,EAAA,CACzD,CAAC,QAAQ,KACRC,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,oDAAoD,EAAA,QAAA,EAAA,KAAA,EAAA,CAAU,CAC9E,EACDA,GAAA,CAAC,IAAI,EAAA,EAAC,SAAS,EAAC,6DAA6D,EAAA,QAAA,EAC1E,OAAO,EAAA,CACH,CAAA,EAAA,CACH,CACP;AACH;;;;"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { jsx, Fragment } from 'react/jsx-runtime';
3
+ import { createPortal } from 'react-dom';
4
+
5
+ /**
6
+ * Renders a mobile selection sheet at the end of the document so accordions
7
+ * and animated panels can't clip it. Interactions inside are kept from reaching
8
+ * the document's outside-click handlers, which would otherwise close it.
9
+ */
10
+ function MobileSheetPortal({ enabled, children, }) {
11
+ if (!enabled)
12
+ return jsx(Fragment, { children: children });
13
+ return createPortal(jsx("div", { onClick: (event) => event.stopPropagation(), onTouchStart: (event) => event.stopPropagation(), children: children }), document.body);
14
+ }
15
+
16
+ export { MobileSheetPortal };
17
+ //# sourceMappingURL=mobile-sheet-portal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mobile-sheet-portal.js","sources":["../../src/components/mobile-sheet-portal.tsx"],"sourcesContent":["\"use client\";\n\nimport { createPortal } from \"react-dom\";\n\n/**\n * Renders a mobile selection sheet at the end of the document so accordions\n * and animated panels can't clip it. Interactions inside are kept from reaching\n * the document's outside-click handlers, which would otherwise close it.\n */\nexport function MobileSheetPortal({\n enabled,\n children,\n}: {\n enabled: boolean;\n children: React.ReactNode;\n}) {\n if (!enabled) return <>{children}</>;\n\n return createPortal(\n <div\n onClick={(event) => event.stopPropagation()}\n onTouchStart={(event) => event.stopPropagation()}\n >\n {children}\n </div>,\n document.body,\n );\n}\n"],"names":[],"mappings":";;;;AAIA;;;;AAIG;;AAQD;;AAEA;AASF;;"}