@revealui/presentation 0.2.0 → 0.3.2

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 (134) hide show
  1. package/README.md +146 -42
  2. package/dist/Text-BWMs9_wn.js +196 -0
  3. package/dist/Text-BWMs9_wn.js.map +1 -0
  4. package/dist/client.d.ts +3 -1
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/client.js +89 -2938
  7. package/dist/client.js.map +1 -1
  8. package/dist/components/BuiltWithRevealUI.d.ts +13 -0
  9. package/dist/components/BuiltWithRevealUI.d.ts.map +1 -0
  10. package/dist/components/Button.d.ts +3 -1
  11. package/dist/components/Button.d.ts.map +1 -1
  12. package/dist/components/Card.d.ts +18 -6
  13. package/dist/components/Card.d.ts.map +1 -1
  14. package/dist/components/Checkbox.d.ts +6 -3
  15. package/dist/components/Checkbox.d.ts.map +1 -1
  16. package/dist/components/FormLabel.d.ts +5 -1
  17. package/dist/components/FormLabel.d.ts.map +1 -1
  18. package/dist/components/Input.d.ts +4 -2
  19. package/dist/components/Input.d.ts.map +1 -1
  20. package/dist/components/Label.d.ts +7 -2
  21. package/dist/components/Label.d.ts.map +1 -1
  22. package/dist/components/Pagination.d.ts +12 -23
  23. package/dist/components/Pagination.d.ts.map +1 -1
  24. package/dist/components/Select.d.ts +36 -13
  25. package/dist/components/Select.d.ts.map +1 -1
  26. package/dist/components/Textarea.d.ts +4 -2
  27. package/dist/components/Textarea.d.ts.map +1 -1
  28. package/dist/components/accordion.d.ts.map +1 -1
  29. package/dist/components/alert.d.ts.map +1 -1
  30. package/dist/components/auth-layout.d.ts +7 -2
  31. package/dist/components/auth-layout.d.ts.map +1 -1
  32. package/dist/components/avatar-group.d.ts.map +1 -1
  33. package/dist/components/avatar.d.ts +6 -5
  34. package/dist/components/avatar.d.ts.map +1 -1
  35. package/dist/components/badge.d.ts +5 -5
  36. package/dist/components/badge.d.ts.map +1 -1
  37. package/dist/components/breadcrumb.d.ts.map +1 -1
  38. package/dist/components/button-headless.d.ts +2 -1
  39. package/dist/components/button-headless.d.ts.map +1 -1
  40. package/dist/components/callout.d.ts.map +1 -1
  41. package/dist/components/checkbox-headless.d.ts.map +1 -1
  42. package/dist/components/code-block.d.ts.map +1 -1
  43. package/dist/components/combobox.d.ts.map +1 -1
  44. package/dist/components/dialog.d.ts.map +1 -1
  45. package/dist/components/drawer.d.ts.map +1 -1
  46. package/dist/components/dropdown.d.ts.map +1 -1
  47. package/dist/components/empty-state.d.ts.map +1 -1
  48. package/dist/components/fieldset.d.ts.map +1 -1
  49. package/dist/components/form-field.d.ts +23 -0
  50. package/dist/components/form-field.d.ts.map +1 -0
  51. package/dist/components/heading.d.ts.map +1 -1
  52. package/dist/components/index.d.ts +20 -1
  53. package/dist/components/index.d.ts.map +1 -1
  54. package/dist/components/input-headless.d.ts +5 -3
  55. package/dist/components/input-headless.d.ts.map +1 -1
  56. package/dist/components/kbd.d.ts.map +1 -1
  57. package/dist/components/link.d.ts +3 -2
  58. package/dist/components/link.d.ts.map +1 -1
  59. package/dist/components/listbox.d.ts.map +1 -1
  60. package/dist/components/navbar.d.ts +5 -5
  61. package/dist/components/navbar.d.ts.map +1 -1
  62. package/dist/components/pricing-table.d.ts +23 -0
  63. package/dist/components/pricing-table.d.ts.map +1 -0
  64. package/dist/components/progress.d.ts.map +1 -1
  65. package/dist/components/radio.d.ts.map +1 -1
  66. package/dist/components/rating.d.ts.map +1 -1
  67. package/dist/components/select-headless.d.ts +5 -2
  68. package/dist/components/select-headless.d.ts.map +1 -1
  69. package/dist/components/sidebar-layout.d.ts.map +1 -1
  70. package/dist/components/sidebar.d.ts +5 -5
  71. package/dist/components/sidebar.d.ts.map +1 -1
  72. package/dist/components/skeleton.d.ts.map +1 -1
  73. package/dist/components/slider.d.ts.map +1 -1
  74. package/dist/components/stacked-layout.d.ts.map +1 -1
  75. package/dist/components/stat.d.ts.map +1 -1
  76. package/dist/components/stepper.d.ts.map +1 -1
  77. package/dist/components/switch.d.ts.map +1 -1
  78. package/dist/components/table.d.ts.map +1 -1
  79. package/dist/components/tabs.d.ts.map +1 -1
  80. package/dist/components/text.d.ts.map +1 -1
  81. package/dist/components/textarea-headless.d.ts +5 -2
  82. package/dist/components/textarea-headless.d.ts.map +1 -1
  83. package/dist/components/timeline.d.ts.map +1 -1
  84. package/dist/components/toast.d.ts.map +1 -1
  85. package/dist/components/tooltip.d.ts +7 -5
  86. package/dist/components/tooltip.d.ts.map +1 -1
  87. package/dist/hooks/index.d.ts.map +1 -1
  88. package/dist/hooks/use-click-outside.d.ts.map +1 -1
  89. package/dist/hooks/use-close-context.d.ts.map +1 -1
  90. package/dist/hooks/use-controllable-state.d.ts.map +1 -1
  91. package/dist/hooks/use-data-interactive.d.ts.map +1 -1
  92. package/dist/hooks/use-field-context.d.ts.map +1 -1
  93. package/dist/hooks/use-focus-trap.d.ts.map +1 -1
  94. package/dist/hooks/use-layout-animation.d.ts.map +1 -1
  95. package/dist/hooks/use-popover.d.ts.map +1 -1
  96. package/dist/hooks/use-roving-tabindex.d.ts.map +1 -1
  97. package/dist/hooks/use-toggle.d.ts.map +1 -1
  98. package/dist/hooks/use-transition.d.ts.map +1 -1
  99. package/dist/hooks/use-type-ahead.d.ts.map +1 -1
  100. package/dist/index.d.ts +1 -0
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +67 -85
  103. package/dist/index.js.map +1 -1
  104. package/dist/primitives/Box.d.ts +3 -1
  105. package/dist/primitives/Box.d.ts.map +1 -1
  106. package/dist/primitives/Flex.d.ts +3 -1
  107. package/dist/primitives/Flex.d.ts.map +1 -1
  108. package/dist/primitives/Grid.d.ts +3 -1
  109. package/dist/primitives/Grid.d.ts.map +1 -1
  110. package/dist/primitives/Heading.d.ts +3 -1
  111. package/dist/primitives/Heading.d.ts.map +1 -1
  112. package/dist/primitives/Slot.d.ts +3 -1
  113. package/dist/primitives/Slot.d.ts.map +1 -1
  114. package/dist/primitives/Text.d.ts +3 -1
  115. package/dist/primitives/Text.d.ts.map +1 -1
  116. package/dist/primitives/index.d.ts.map +1 -1
  117. package/dist/server.d.ts +6 -1
  118. package/dist/server.d.ts.map +1 -1
  119. package/dist/server.js +3 -32
  120. package/dist/skeleton-Bb51IWbG.js +520 -0
  121. package/dist/skeleton-Bb51IWbG.js.map +1 -0
  122. package/dist/tokens.css +265 -0
  123. package/dist/tooltip-DZGP3hO_.js +3893 -0
  124. package/dist/tooltip-DZGP3hO_.js.map +1 -0
  125. package/dist/utils/cn.d.ts.map +1 -1
  126. package/dist/utils/index.d.ts.map +1 -1
  127. package/package.json +16 -12
  128. package/dist/Box-DDhRNK02.js +0 -45
  129. package/dist/Box-DDhRNK02.js.map +0 -1
  130. package/dist/Text-BIym7IhD.js +0 -425
  131. package/dist/Text-BIym7IhD.js.map +0 -1
  132. package/dist/server.js.map +0 -1
  133. package/dist/tooltip-oH4lAnkn.js +0 -2277
  134. package/dist/tooltip-oH4lAnkn.js.map +0 -1
package/dist/client.js CHANGED
@@ -1,2951 +1,102 @@
1
1
  "use client";
2
- import { _ as useTransition, $ as useScrollLock, a0 as useFocusTrap, a1 as useEscapeKey, a2 as useDataInteractive, a3 as Link, Y as TouchTarget, a4 as useControllableState, c as Button, a5 as useFieldDescriptionProps, a6 as useFieldErrorProps, a7 as FieldProvider, a8 as useFieldLabelProps, a9 as useToggle } from "./tooltip-oH4lAnkn.js";
3
- import { A, a, aa, b, B, C, d, e, f, g, h, i, D, j, k, l, E, I, m, K, n, P, R, S, o, p, q, r, s, t, u, v, w, x, y, z, F, G, H, J, L, T, M, N, O, Q, U, V, W, X, Z } from "./tooltip-oH4lAnkn.js";
4
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
5
- import { a as clsx } from "./Box-DDhRNK02.js";
6
- import { useRef, useId, useCallback, forwardRef, useEffect, useState, createContext, useContext, useMemo, Children, isValidElement, useLayoutEffect } from "react";
7
- import { createPortal } from "react-dom";
8
- function Text({ className, ...props }) {
9
- return /* @__PURE__ */ jsx(
10
- "p",
11
- {
12
- "data-slot": "text",
13
- ...props,
14
- className: clsx(className, "text-base/6 text-zinc-500 sm:text-sm/6 dark:text-zinc-400")
15
- }
16
- );
17
- }
18
- const sizes$1 = {
19
- xs: "sm:max-w-xs",
20
- sm: "sm:max-w-sm",
21
- md: "sm:max-w-md",
22
- lg: "sm:max-w-lg",
23
- xl: "sm:max-w-xl",
24
- "2xl": "sm:max-w-2xl",
25
- "3xl": "sm:max-w-3xl",
26
- "4xl": "sm:max-w-4xl",
27
- "5xl": "sm:max-w-5xl"
28
- };
29
- function Alert({
30
- size = "md",
31
- className,
32
- children,
33
- open,
34
- onClose
35
- }) {
36
- const panelRef = useRef(null);
37
- const titleId = useId();
38
- const backdrop = useTransition(open);
39
- const panel = useTransition(open);
40
- useScrollLock(open);
41
- useFocusTrap(panelRef, open);
42
- useEscapeKey(onClose, open);
43
- const handleBackdropClick = useCallback(
44
- (e2) => {
45
- if (e2.target === e2.currentTarget) {
46
- onClose();
47
- }
48
- },
49
- [onClose]
50
- );
51
- if (!(backdrop.mounted || panel.mounted)) return null;
52
- return createPortal(
53
- /* @__PURE__ */ jsxs("div", { role: "alertdialog", "aria-modal": "true", "aria-labelledby": titleId, children: [
54
- backdrop.mounted && /* @__PURE__ */ jsx(
55
- "div",
56
- {
57
- ref: backdrop.nodeRef,
58
- ...backdrop.transitionProps,
59
- className: "fixed inset-0 flex w-screen justify-center overflow-y-auto bg-zinc-950/15 px-2 py-2 transition duration-100 focus:outline-0 data-closed:opacity-0 data-enter:ease-out data-leave:ease-in sm:px-6 sm:py-8 lg:px-8 lg:py-16 dark:bg-zinc-950/50"
60
- }
61
- ),
62
- panel.mounted && /* @__PURE__ */ jsx(
63
- "div",
64
- {
65
- className: "fixed inset-0 w-screen overflow-y-auto pt-6 sm:pt-0",
66
- onClick: handleBackdropClick,
67
- children: /* @__PURE__ */ jsx(
68
- "div",
69
- {
70
- className: "grid min-h-full grid-rows-[1fr_auto_1fr] justify-items-center p-8 sm:grid-rows-[1fr_auto_3fr] sm:p-4",
71
- onClick: handleBackdropClick,
72
- children: /* @__PURE__ */ jsx(
73
- "div",
74
- {
75
- ref: (node) => {
76
- panelRef.current = node;
77
- panel.nodeRef.current = node;
78
- },
79
- ...panel.transitionProps,
80
- className: clsx(
81
- className,
82
- sizes$1[size],
83
- "row-start-2 w-full rounded-2xl bg-white p-8 shadow-lg ring-1 ring-zinc-950/10 sm:rounded-2xl sm:p-6 dark:bg-zinc-900 dark:ring-white/10 forced-colors:outline",
84
- "transition duration-100 will-change-transform data-closed:opacity-0 data-enter:ease-out data-closed:data-enter:scale-95 data-leave:ease-in"
85
- ),
86
- children
87
- }
88
- )
89
- }
90
- )
91
- }
92
- )
93
- ] }),
94
- document.body
95
- );
96
- }
97
- function AlertTitle({
98
- className,
99
- ...props
100
- }) {
101
- return /* @__PURE__ */ jsx(
102
- "h2",
103
- {
104
- ...props,
105
- className: clsx(
106
- className,
107
- "text-center text-base/6 font-semibold text-balance text-zinc-950 sm:text-left sm:text-sm/6 sm:text-wrap dark:text-white"
108
- )
109
- }
110
- );
111
- }
112
- function AlertDescription({
113
- className,
114
- ...props
115
- }) {
116
- return /* @__PURE__ */ jsx(Text, { ...props, className: clsx(className, "mt-2 text-center text-pretty sm:text-left") });
117
- }
118
- function AlertBody({ className, ...props }) {
119
- return /* @__PURE__ */ jsx("div", { ...props, className: clsx(className, "mt-4") });
120
- }
121
- function AlertActions({ className, ...props }) {
122
- return /* @__PURE__ */ jsx(
123
- "div",
124
- {
125
- ...props,
126
- className: clsx(
127
- className,
128
- "mt-6 flex flex-col-reverse items-center justify-end gap-3 *:w-full sm:mt-4 sm:flex-row sm:*:w-auto"
129
- )
130
- }
131
- );
132
- }
133
- const colors$1 = {
134
- red: "bg-red-500/15 text-red-700 group-data-hover:bg-red-500/25 dark:bg-red-500/10 dark:text-red-400 dark:group-data-hover:bg-red-500/20",
135
- orange: "bg-orange-500/15 text-orange-700 group-data-hover:bg-orange-500/25 dark:bg-orange-500/10 dark:text-orange-400 dark:group-data-hover:bg-orange-500/20",
136
- amber: "bg-amber-400/20 text-amber-700 group-data-hover:bg-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400 dark:group-data-hover:bg-amber-400/15",
137
- yellow: "bg-yellow-400/20 text-yellow-700 group-data-hover:bg-yellow-400/30 dark:bg-yellow-400/10 dark:text-yellow-300 dark:group-data-hover:bg-yellow-400/15",
138
- lime: "bg-lime-400/20 text-lime-700 group-data-hover:bg-lime-400/30 dark:bg-lime-400/10 dark:text-lime-300 dark:group-data-hover:bg-lime-400/15",
139
- green: "bg-green-500/15 text-green-700 group-data-hover:bg-green-500/25 dark:bg-green-500/10 dark:text-green-400 dark:group-data-hover:bg-green-500/20",
140
- emerald: "bg-emerald-500/15 text-emerald-700 group-data-hover:bg-emerald-500/25 dark:bg-emerald-500/10 dark:text-emerald-400 dark:group-data-hover:bg-emerald-500/20",
141
- teal: "bg-teal-500/15 text-teal-700 group-data-hover:bg-teal-500/25 dark:bg-teal-500/10 dark:text-teal-300 dark:group-data-hover:bg-teal-500/20",
142
- cyan: "bg-cyan-400/20 text-cyan-700 group-data-hover:bg-cyan-400/30 dark:bg-cyan-400/10 dark:text-cyan-300 dark:group-data-hover:bg-cyan-400/15",
143
- sky: "bg-sky-500/15 text-sky-700 group-data-hover:bg-sky-500/25 dark:bg-sky-500/10 dark:text-sky-300 dark:group-data-hover:bg-sky-500/20",
144
- blue: "bg-blue-500/15 text-blue-700 group-data-hover:bg-blue-500/25 dark:text-blue-400 dark:group-data-hover:bg-blue-500/25",
145
- indigo: "bg-indigo-500/15 text-indigo-700 group-data-hover:bg-indigo-500/25 dark:text-indigo-400 dark:group-data-hover:bg-indigo-500/20",
146
- violet: "bg-violet-500/15 text-violet-700 group-data-hover:bg-violet-500/25 dark:text-violet-400 dark:group-data-hover:bg-violet-500/20",
147
- purple: "bg-purple-500/15 text-purple-700 group-data-hover:bg-purple-500/25 dark:text-purple-400 dark:group-data-hover:bg-purple-500/20",
148
- fuchsia: "bg-fuchsia-400/15 text-fuchsia-700 group-data-hover:bg-fuchsia-400/25 dark:bg-fuchsia-400/10 dark:text-fuchsia-400 dark:group-data-hover:bg-fuchsia-400/20",
149
- pink: "bg-pink-400/15 text-pink-700 group-data-hover:bg-pink-400/25 dark:bg-pink-400/10 dark:text-pink-400 dark:group-data-hover:bg-pink-400/20",
150
- rose: "bg-rose-400/15 text-rose-700 group-data-hover:bg-rose-400/25 dark:bg-rose-400/10 dark:text-rose-400 dark:group-data-hover:bg-rose-400/20",
151
- zinc: "bg-zinc-600/10 text-zinc-700 group-data-hover:bg-zinc-600/20 dark:bg-white/5 dark:text-zinc-400 dark:group-data-hover:bg-white/10"
152
- };
153
- function Badge({
154
- color = "zinc",
155
- className,
156
- ...props
157
- }) {
158
- return /* @__PURE__ */ jsx(
159
- "span",
160
- {
161
- ...props,
162
- className: clsx(
163
- className,
164
- "inline-flex items-center gap-x-1.5 rounded-md px-1.5 py-0.5 text-sm/5 font-medium sm:text-xs/5 forced-colors:outline",
165
- colors$1[color]
166
- )
167
- }
168
- );
169
- }
170
- forwardRef(function BadgeButton2({
171
- color = "zinc",
172
- className,
173
- children,
174
- ...props
175
- }, ref) {
176
- const disabled = "disabled" in props ? props.disabled : false;
177
- const interactiveProps = useDataInteractive({ disabled: disabled ?? false });
178
- const classes = clsx(
179
- className,
180
- "group relative inline-flex rounded-md focus:not-data-focus:outline-hidden data-focus:outline-2 data-focus:outline-offset-2 data-focus:outline-blue-500"
181
- );
182
- return typeof props.href === "string" ? /* @__PURE__ */ jsx(Link, { ...props, className: classes, ref, children: /* @__PURE__ */ jsx(TouchTarget, { children: /* @__PURE__ */ jsx(Badge, { color, children }) }) }) : /* @__PURE__ */ jsx(
183
- "button",
184
- {
185
- type: "button",
186
- ...props,
187
- ...interactiveProps,
188
- className: classes,
189
- ref,
190
- children: /* @__PURE__ */ jsx(TouchTarget, { children: /* @__PURE__ */ jsx(Badge, { color, children }) })
191
- }
192
- );
193
- });
194
- function useClickOutside(refs, onClickOutside, enabled = true) {
195
- const callbackRef = useRef(onClickOutside);
196
- callbackRef.current = onClickOutside;
197
- useEffect(() => {
198
- if (!enabled) return;
199
- function handlePointerDown(e2) {
200
- const target = e2.target;
201
- const refArray = Array.isArray(refs) ? refs : [refs];
202
- const isOutside = refArray.every((ref) => !ref.current?.contains(target));
203
- if (isOutside) {
204
- callbackRef.current();
205
- }
206
- }
207
- document.addEventListener("pointerdown", handlePointerDown, true);
208
- return () => document.removeEventListener("pointerdown", handlePointerDown, true);
209
- }, [refs, enabled]);
210
- }
211
- function computePosition(trigger, popover, anchor, gap, padding) {
212
- const triggerRect = trigger.getBoundingClientRect();
213
- const popoverRect = popover.getBoundingClientRect();
214
- const viewportHeight = window.innerHeight;
215
- const viewportWidth = window.innerWidth;
216
- let top;
217
- let left;
218
- let maxHeight;
219
- const isTop = anchor.startsWith("top");
220
- const spaceBelow = viewportHeight - triggerRect.bottom - gap - padding;
221
- const spaceAbove = triggerRect.top - gap - padding;
222
- if (anchor === "selection start") {
223
- top = triggerRect.top;
224
- maxHeight = viewportHeight - top - padding;
225
- } else if (isTop) {
226
- top = triggerRect.top - popoverRect.height - gap;
227
- maxHeight = spaceAbove;
228
- if (top < padding && spaceBelow > spaceAbove) {
229
- top = triggerRect.bottom + gap;
230
- maxHeight = spaceBelow;
231
- }
232
- } else {
233
- top = triggerRect.bottom + gap;
234
- maxHeight = spaceBelow;
235
- if (top + popoverRect.height > viewportHeight - padding && spaceAbove > spaceBelow) {
236
- top = triggerRect.top - popoverRect.height - gap;
237
- maxHeight = spaceAbove;
238
- }
239
- }
240
- const isEnd = anchor.endsWith("end");
241
- const isStart = anchor.endsWith("start");
242
- if (isEnd) {
243
- left = triggerRect.right - popoverRect.width;
244
- } else if (isStart || anchor === "selection start") {
245
- left = triggerRect.left;
246
- } else {
247
- left = triggerRect.left + (triggerRect.width - popoverRect.width) / 2;
248
- }
249
- left = Math.max(padding, Math.min(left, viewportWidth - popoverRect.width - padding));
250
- top = Math.max(padding, top);
251
- return { top, left, maxHeight: Math.max(100, maxHeight) };
252
- }
253
- function usePopover({
254
- open,
255
- anchor = "bottom",
256
- gap = 8,
257
- padding = 4
258
- }) {
259
- const triggerRef = useRef(null);
260
- const popoverRef = useRef(null);
261
- const [position, setPosition] = useState({
262
- top: 0,
263
- left: 0,
264
- maxHeight: 300
265
- });
266
- const updatePosition = useCallback(() => {
267
- if (!(triggerRef.current && popoverRef.current && open)) return;
268
- const pos = computePosition(triggerRef.current, popoverRef.current, anchor, gap, padding);
269
- setPosition(pos);
270
- }, [open, anchor, gap, padding]);
271
- useEffect(() => {
272
- if (!open) return;
273
- requestAnimationFrame(updatePosition);
274
- window.addEventListener("scroll", updatePosition, true);
275
- window.addEventListener("resize", updatePosition);
276
- return () => {
277
- window.removeEventListener("scroll", updatePosition, true);
278
- window.removeEventListener("resize", updatePosition);
279
- };
280
- }, [open, updatePosition]);
281
- return {
282
- triggerRef,
283
- popoverRef,
284
- position,
285
- popoverProps: {
286
- style: {
287
- position: "fixed",
288
- top: position.top,
289
- left: position.left,
290
- maxHeight: position.maxHeight,
291
- zIndex: 50
292
- }
293
- }
294
- };
295
- }
296
- const ComboboxContext = createContext(null);
297
- function useComboboxContext() {
298
- const ctx = useContext(ComboboxContext);
299
- if (!ctx) {
300
- throw new Error("Combobox compound components must be used within <Combobox>");
301
- }
302
- return ctx;
303
- }
304
- function Combobox({
305
- options,
306
- displayValue,
307
- filter,
308
- anchor = "bottom",
309
- className,
310
- placeholder,
311
- autoFocus,
312
- "aria-label": ariaLabel,
313
- children,
314
- value: controlledValue,
315
- defaultValue,
316
- onChange,
317
- disabled = false,
318
- name
319
- }) {
320
- const [selectedValue, setSelectedValue] = useControllableState({
321
- value: controlledValue,
322
- defaultValue: defaultValue ?? null,
323
- onChange
324
- });
325
- const [query, setQuery] = useState("");
326
- const [isOpen, setIsOpen] = useState(false);
327
- const [activeIndex, setActiveIndex] = useState(-1);
328
- const inputRef = useRef(null);
329
- const controlRef = useRef(null);
330
- const listboxId = useId();
331
- const filteredOptions = query === "" ? options : options.filter(
332
- (option) => filter ? filter(option, query) : displayValue(option)?.toLowerCase().includes(query.toLowerCase())
333
- );
334
- const { triggerRef, popoverRef, popoverProps } = usePopover({
335
- open: isOpen,
336
- anchor,
337
- gap: 8,
338
- padding: 16
339
- });
340
- useEffect(() => {
341
- if (controlRef.current) {
342
- triggerRef.current = controlRef.current;
343
- }
344
- }, [triggerRef]);
345
- const { mounted, nodeRef: transitionRef, transitionProps } = useTransition(isOpen);
346
- useClickOutside(
347
- [controlRef, popoverRef],
348
- () => {
349
- if (isOpen) close();
350
- },
351
- isOpen
352
- );
353
- useEscapeKey(() => {
354
- if (isOpen) close();
355
- }, isOpen);
356
- const open = useCallback(() => {
357
- if (disabled) return;
358
- setIsOpen(true);
359
- setActiveIndex(-1);
360
- }, [disabled]);
361
- const close = useCallback(() => {
362
- setIsOpen(false);
363
- setQuery("");
364
- setActiveIndex(-1);
365
- }, []);
366
- const select = useCallback(
367
- (value) => {
368
- setSelectedValue(value);
369
- close();
370
- requestAnimationFrame(() => {
371
- inputRef.current?.focus();
372
- });
373
- },
374
- [setSelectedValue, close]
375
- );
376
- const handleInputKeyDown = useCallback(
377
- (e2) => {
378
- switch (e2.key) {
379
- case "ArrowDown": {
380
- e2.preventDefault();
381
- if (!isOpen) {
382
- open();
383
- } else {
384
- setActiveIndex((prev) => prev < filteredOptions.length - 1 ? prev + 1 : 0);
385
- }
386
- break;
387
- }
388
- case "ArrowUp": {
389
- e2.preventDefault();
390
- if (!isOpen) {
391
- open();
392
- } else {
393
- setActiveIndex((prev) => prev > 0 ? prev - 1 : filteredOptions.length - 1);
394
- }
395
- break;
396
- }
397
- case "Home": {
398
- if (isOpen) {
399
- e2.preventDefault();
400
- setActiveIndex(0);
401
- }
402
- break;
403
- }
404
- case "End": {
405
- if (isOpen) {
406
- e2.preventDefault();
407
- setActiveIndex(filteredOptions.length - 1);
408
- }
409
- break;
410
- }
411
- case "Enter": {
412
- e2.preventDefault();
413
- if (isOpen && activeIndex >= 0 && activeIndex < filteredOptions.length) {
414
- select(filteredOptions[activeIndex]);
415
- }
416
- break;
417
- }
418
- case "Tab": {
419
- if (isOpen) {
420
- close();
421
- }
422
- break;
423
- }
424
- }
425
- },
426
- [isOpen, open, close, select, activeIndex, filteredOptions]
427
- );
428
- useEffect(() => {
429
- if (!isOpen || activeIndex < 0) return;
430
- const listbox = popoverRef.current;
431
- if (!listbox) return;
432
- const activeOption = listbox.querySelector(`[data-combobox-option-index="${activeIndex}"]`);
433
- if (activeOption) {
434
- activeOption.scrollIntoView({ block: "nearest" });
435
- }
436
- }, [activeIndex, isOpen, popoverRef]);
437
- const contextValue = {
438
- selectedValue,
439
- activeIndex,
440
- filteredOptions,
441
- select,
442
- setActiveIndex
443
- };
444
- return /* @__PURE__ */ jsxs(ComboboxContext.Provider, { value: contextValue, children: [
445
- /* @__PURE__ */ jsxs(
446
- "span",
447
- {
448
- ref: controlRef,
449
- "data-slot": "control",
450
- ...disabled ? { "data-disabled": "" } : {},
451
- className: clsx([
452
- className,
453
- "relative block w-full",
454
- "before:absolute before:inset-px before:rounded-[calc(var(--radius-lg)-1px)] before:bg-white before:shadow-sm",
455
- "dark:before:hidden",
456
- "after:pointer-events-none after:absolute after:inset-0 after:rounded-lg after:ring-transparent after:ring-inset sm:focus-within:after:ring-2 sm:focus-within:after:ring-blue-500",
457
- "has-data-disabled:opacity-50 has-data-disabled:before:bg-zinc-950/5 has-data-disabled:before:shadow-none",
458
- "has-data-invalid:before:shadow-red-500/10"
459
- ]),
460
- children: [
461
- /* @__PURE__ */ jsx(
462
- "input",
463
- {
464
- ref: inputRef,
465
- autoFocus,
466
- "data-slot": "control",
467
- role: "combobox",
468
- "aria-label": ariaLabel,
469
- "aria-expanded": isOpen,
470
- "aria-controls": listboxId,
471
- "aria-activedescendant": isOpen && activeIndex >= 0 ? `${listboxId}-option-${activeIndex}` : void 0,
472
- "aria-autocomplete": "list",
473
- "aria-haspopup": "listbox",
474
- disabled,
475
- name,
476
- value: isOpen ? query : displayValue(selectedValue) ?? "",
477
- onChange: (e2) => {
478
- setQuery(e2.target.value);
479
- if (!isOpen) open();
480
- setActiveIndex(-1);
481
- },
482
- onFocus: () => {
483
- if (!isOpen) open();
484
- },
485
- onKeyDown: handleInputKeyDown,
486
- placeholder,
487
- ...disabled ? { "data-disabled": "" } : {},
488
- className: clsx([
489
- className,
490
- "relative block w-full appearance-none rounded-lg py-[calc(--spacing(2.5)-1px)] sm:py-[calc(--spacing(1.5)-1px)]",
491
- "pr-[calc(--spacing(10)-1px)] pl-[calc(--spacing(3.5)-1px)] sm:pr-[calc(--spacing(9)-1px)] sm:pl-[calc(--spacing(3)-1px)]",
492
- "text-base/6 text-zinc-950 placeholder:text-zinc-500 sm:text-sm/6 dark:text-white",
493
- "border border-zinc-950/10 data-hover:border-zinc-950/20 dark:border-white/10 dark:data-hover:border-white/20",
494
- "bg-transparent dark:bg-white/5",
495
- "focus:outline-hidden",
496
- "data-invalid:border-red-500 data-invalid:data-hover:border-red-500 dark:data-invalid:border-red-500 dark:data-invalid:data-hover:border-red-500",
497
- "data-disabled:border-zinc-950/20 dark:data-disabled:border-white/15 dark:data-disabled:bg-white/2.5 dark:data-hover:data-disabled:border-white/15",
498
- "dark:scheme-dark"
499
- ])
500
- }
501
- ),
502
- /* @__PURE__ */ jsx(
503
- "button",
504
- {
505
- type: "button",
506
- tabIndex: -1,
507
- "aria-label": "Toggle options",
508
- disabled,
509
- onClick: () => {
510
- if (isOpen) {
511
- close();
512
- } else {
513
- open();
514
- inputRef.current?.focus();
515
- }
516
- },
517
- className: "group absolute inset-y-0 right-0 flex items-center px-2",
518
- ...disabled ? { "data-disabled": "" } : {},
519
- children: /* @__PURE__ */ jsxs(
520
- "svg",
521
- {
522
- className: "size-5 stroke-zinc-500 group-data-disabled:stroke-zinc-600 group-data-hover:stroke-zinc-700 sm:size-4 dark:stroke-zinc-400 dark:group-data-hover:stroke-zinc-300 forced-colors:stroke-[CanvasText]",
523
- viewBox: "0 0 16 16",
524
- "aria-hidden": "true",
525
- fill: "none",
526
- children: [
527
- /* @__PURE__ */ jsx(
528
- "path",
529
- {
530
- d: "M5.75 10.75L8 13L10.25 10.75",
531
- strokeWidth: 1.5,
532
- strokeLinecap: "round",
533
- strokeLinejoin: "round"
534
- }
535
- ),
536
- /* @__PURE__ */ jsx(
537
- "path",
538
- {
539
- d: "M10.25 5.25L8 3L5.75 5.25",
540
- strokeWidth: 1.5,
541
- strokeLinecap: "round",
542
- strokeLinejoin: "round"
543
- }
544
- )
545
- ]
546
- }
547
- )
548
- }
549
- )
550
- ]
551
- }
552
- ),
553
- mounted && createPortal(
554
- /* @__PURE__ */ jsx(
555
- "div",
556
- {
557
- ref: (node) => {
558
- popoverRef.current = node;
559
- transitionRef.current = node;
560
- },
561
- role: "listbox",
562
- id: listboxId,
563
- ...popoverProps,
564
- ...transitionProps,
565
- className: clsx(
566
- "[--anchor-gap:--spacing(2)] [--anchor-padding:--spacing(4)] sm:data-[anchor~=start]:[--anchor-offset:-4px]",
567
- "isolate min-w-[calc(var(--input-width)+8px)] scroll-py-1 rounded-xl p-1 select-none empty:invisible",
568
- "outline outline-transparent focus:outline-hidden",
569
- "overflow-y-scroll overscroll-contain",
570
- "bg-white/75 backdrop-blur-xl dark:bg-zinc-800/75",
571
- "shadow-lg ring-1 ring-zinc-950/10 dark:ring-white/10 dark:ring-inset",
572
- "transition-opacity duration-100 ease-in data-closed:data-leave:opacity-0 data-transition:pointer-events-none"
573
- ),
574
- style: {
575
- ...popoverProps.style,
576
- minWidth: controlRef.current?.offsetWidth
577
- },
578
- children: filteredOptions.map(
579
- (option, index) => option == null ? null : (
580
- // biome-ignore lint/suspicious/noArrayIndexKey: filtered options have no stable ID
581
- /* @__PURE__ */ jsx(ComboboxOptionIndexProvider, { index, children: children(option) }, index)
582
- )
583
- )
584
- }
585
- ),
586
- document.body
587
- )
588
- ] });
589
- }
590
- const ComboboxOptionIndexContext = createContext(-1);
591
- function ComboboxOptionIndexProvider({
592
- index,
593
- children
594
- }) {
595
- return /* @__PURE__ */ jsx(ComboboxOptionIndexContext.Provider, { value: index, children });
596
- }
597
- function ComboboxOption({
598
- children,
599
- className,
600
- value,
601
- disabled = false
602
- }) {
603
- const { selectedValue, activeIndex, select, setActiveIndex } = useComboboxContext();
604
- const index = useContext(ComboboxOptionIndexContext);
605
- const isSelected = selectedValue === value;
606
- const isActive = activeIndex === index;
607
- const sharedClasses = clsx(
608
- "flex min-w-0 items-center",
609
- "*:data-[slot=icon]:size-5 *:data-[slot=icon]:shrink-0 sm:*:data-[slot=icon]:size-4",
610
- "*:data-[slot=icon]:text-zinc-500 group-data-focus/option:*:data-[slot=icon]:text-white dark:*:data-[slot=icon]:text-zinc-400",
611
- "forced-colors:*:data-[slot=icon]:text-[CanvasText] forced-colors:group-data-focus/option:*:data-[slot=icon]:text-[Canvas]",
612
- "*:data-[slot=avatar]:-mx-0.5 *:data-[slot=avatar]:size-6 sm:*:data-[slot=avatar]:size-5"
613
- );
614
- return (
615
- // biome-ignore lint/a11y/useFocusableInteractive: focus managed by roving tabindex
616
- /* @__PURE__ */ jsxs(
617
- "div",
618
- {
619
- role: "option",
620
- "aria-selected": isSelected,
621
- "aria-disabled": disabled,
622
- "data-combobox-option-index": index,
623
- ...isActive ? { "data-focus": "" } : {},
624
- ...isSelected ? { "data-selected": "" } : {},
625
- ...disabled ? { "data-disabled": "" } : {},
626
- onPointerEnter: () => {
627
- if (!disabled) setActiveIndex(index);
628
- },
629
- onPointerLeave: () => {
630
- setActiveIndex(-1);
631
- },
632
- onClick: () => {
633
- if (!disabled) select(value);
634
- },
635
- className: clsx(
636
- "group/option grid w-full cursor-default grid-cols-[1fr_--spacing(5)] items-baseline gap-x-2 rounded-lg py-2.5 pr-2 pl-3.5 sm:grid-cols-[1fr_--spacing(4)] sm:py-1.5 sm:pr-2 sm:pl-3",
637
- "text-base/6 text-zinc-950 sm:text-sm/6 dark:text-white forced-colors:text-[CanvasText]",
638
- "outline-hidden data-focus:bg-blue-500 data-focus:text-white",
639
- "forced-color-adjust-none forced-colors:data-focus:bg-[Highlight] forced-colors:data-focus:text-[HighlightText]",
640
- "data-disabled:opacity-50"
641
- ),
642
- children: [
643
- /* @__PURE__ */ jsx("span", { className: clsx(className, sharedClasses), children }),
644
- /* @__PURE__ */ jsx(
645
- "svg",
646
- {
647
- className: "relative col-start-2 hidden size-5 self-center stroke-current group-data-selected/option:inline sm:size-4",
648
- viewBox: "0 0 16 16",
649
- fill: "none",
650
- "aria-hidden": "true",
651
- children: /* @__PURE__ */ jsx("path", { d: "M4 8.5l3 3L12 4", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" })
652
- }
653
- )
654
- ]
655
- }
656
- )
657
- );
658
- }
659
- function ComboboxLabel({ className, ...props }) {
660
- return /* @__PURE__ */ jsx(
661
- "span",
662
- {
663
- ...props,
664
- className: clsx(className, "ml-2.5 truncate first:ml-0 sm:ml-2 sm:first:ml-0")
665
- }
666
- );
667
- }
668
- function ComboboxDescription({
669
- className,
670
- children,
671
- ...props
672
- }) {
673
- return /* @__PURE__ */ jsx(
674
- "span",
675
- {
676
- ...props,
677
- className: clsx(
678
- className,
679
- "flex flex-1 overflow-hidden text-zinc-500 group-data-focus/option:text-white before:w-2 before:min-w-0 before:shrink dark:text-zinc-400"
680
- ),
681
- children: /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children })
682
- }
683
- );
684
- }
685
- function DescriptionList({ className, ...props }) {
686
- return /* @__PURE__ */ jsx(
687
- "dl",
688
- {
689
- ...props,
690
- className: clsx(
691
- className,
692
- "grid grid-cols-1 text-base/6 sm:grid-cols-[min(50%,--spacing(80))_auto] sm:text-sm/6"
693
- )
694
- }
695
- );
696
- }
697
- function DescriptionTerm({ className, ...props }) {
698
- return /* @__PURE__ */ jsx(
699
- "dt",
700
- {
701
- ...props,
702
- className: clsx(
703
- className,
704
- "col-start-1 border-t border-zinc-950/5 pt-3 text-zinc-500 first:border-none sm:border-t sm:border-zinc-950/5 sm:py-3 dark:border-white/5 dark:text-zinc-400 sm:dark:border-white/5"
705
- )
706
- }
707
- );
708
- }
709
- function DescriptionDetails({ className, ...props }) {
710
- return /* @__PURE__ */ jsx(
711
- "dd",
712
- {
713
- ...props,
714
- className: clsx(
715
- className,
716
- "pt-1 pb-3 text-zinc-950 sm:border-t sm:border-zinc-950/5 sm:py-3 sm:nth-2:border-none dark:text-white dark:sm:border-white/5"
717
- )
718
- }
719
- );
720
- }
721
- const sizes = {
722
- xs: "sm:max-w-xs",
723
- sm: "sm:max-w-sm",
724
- md: "sm:max-w-md",
725
- lg: "sm:max-w-lg",
726
- xl: "sm:max-w-xl",
727
- "2xl": "sm:max-w-2xl",
728
- "3xl": "sm:max-w-3xl",
729
- "4xl": "sm:max-w-4xl",
730
- "5xl": "sm:max-w-5xl"
731
- };
732
- function Dialog({
733
- size = "lg",
734
- className,
735
- children,
736
- open,
737
- onClose
738
- }) {
739
- const panelRef = useRef(null);
740
- const titleId = useId();
741
- const backdrop = useTransition(open);
742
- const panel = useTransition(open);
743
- useScrollLock(open);
744
- useFocusTrap(panelRef, open);
745
- useEscapeKey(onClose, open);
746
- const handleBackdropClick = useCallback(
747
- (e2) => {
748
- if (e2.target === e2.currentTarget) {
749
- onClose();
750
- }
751
- },
752
- [onClose]
753
- );
754
- if (!(backdrop.mounted || panel.mounted)) return null;
755
- return createPortal(
756
- /* @__PURE__ */ jsxs("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, children: [
757
- backdrop.mounted && /* @__PURE__ */ jsx(
758
- "div",
759
- {
760
- ref: backdrop.nodeRef,
761
- ...backdrop.transitionProps,
762
- className: "fixed inset-0 flex w-screen justify-center overflow-y-auto bg-zinc-950/25 px-2 py-2 transition duration-100 focus:outline-0 data-closed:opacity-0 data-enter:ease-out data-leave:ease-in sm:px-6 sm:py-8 lg:px-8 lg:py-16 dark:bg-zinc-950/50"
763
- }
764
- ),
765
- panel.mounted && /* @__PURE__ */ jsx(
766
- "div",
767
- {
768
- className: "fixed inset-0 w-screen overflow-y-auto pt-6 sm:pt-0",
769
- onClick: handleBackdropClick,
770
- children: /* @__PURE__ */ jsx(
771
- "div",
772
- {
773
- className: "grid min-h-full grid-rows-[1fr_auto] justify-items-center sm:grid-rows-[1fr_auto_3fr] sm:p-4",
774
- onClick: handleBackdropClick,
775
- children: /* @__PURE__ */ jsx(
776
- "div",
777
- {
778
- ref: (node) => {
779
- panelRef.current = node;
780
- panel.nodeRef.current = node;
781
- },
782
- ...panel.transitionProps,
783
- className: clsx(
784
- className,
785
- sizes[size],
786
- "row-start-2 w-full min-w-0 rounded-t-3xl bg-white p-(--gutter) shadow-lg ring-1 ring-zinc-950/10 [--gutter:--spacing(8)] sm:mb-auto sm:rounded-2xl dark:bg-zinc-900 dark:ring-white/10 forced-colors:outline",
787
- "transition duration-100 will-change-transform data-closed:translate-y-12 data-closed:opacity-0 data-enter:ease-out data-leave:ease-in sm:data-closed:translate-y-0 sm:data-closed:data-enter:scale-95"
788
- ),
789
- children
790
- }
791
- )
792
- }
793
- )
794
- }
795
- )
796
- ] }),
797
- document.body
798
- );
799
- }
800
- function DialogTitle({
801
- className,
802
- ...props
803
- }) {
804
- return /* @__PURE__ */ jsx(
805
- "h2",
806
- {
807
- ...props,
808
- className: clsx(
809
- className,
810
- "text-lg/6 font-semibold text-balance text-zinc-950 sm:text-base/6 dark:text-white"
811
- )
812
- }
813
- );
814
- }
815
- function DialogDescription({
816
- className,
817
- ...props
818
- }) {
819
- return /* @__PURE__ */ jsx(Text, { ...props, className: clsx(className, "mt-2 text-pretty") });
820
- }
821
- function DialogBody({ className, ...props }) {
822
- return /* @__PURE__ */ jsx("div", { ...props, className: clsx(className, "mt-6") });
823
- }
824
- function DialogActions({ className, ...props }) {
825
- return /* @__PURE__ */ jsx(
826
- "div",
827
- {
828
- ...props,
829
- className: clsx(
830
- className,
831
- "mt-8 flex flex-col-reverse items-center justify-end gap-3 *:w-full sm:flex-row sm:*:w-auto"
832
- )
833
- }
834
- );
835
- }
836
- function Divider({
837
- soft = false,
838
- className,
839
- ...props
840
- }) {
841
- return /* @__PURE__ */ jsx(
842
- "hr",
843
- {
844
- ...props,
845
- className: clsx(
846
- className,
847
- "w-full border-t",
848
- soft && "border-zinc-950/5 dark:border-white/5",
849
- !soft && "border-zinc-950/10 dark:border-white/10"
850
- )
851
- }
852
- );
853
- }
854
- function useRovingTabindex({
855
- itemCount,
856
- initialIndex = -1,
857
- orientation = "vertical",
858
- loop = true,
859
- onActiveChange
860
- }) {
861
- const [activeIndex, setActiveIndexState] = useState(initialIndex);
862
- const itemRefs = useRef(/* @__PURE__ */ new Map());
863
- const onActiveChangeRef = useRef(onActiveChange);
864
- onActiveChangeRef.current = onActiveChange;
865
- const setActiveIndex = useCallback((index) => {
866
- setActiveIndexState(index);
867
- onActiveChangeRef.current?.(index);
868
- const el = itemRefs.current.get(index);
869
- el?.focus();
870
- }, []);
871
- const moveFocus = useCallback(
872
- (direction) => {
873
- if (itemCount === 0) return;
874
- let next = activeIndex + direction;
875
- if (loop) {
876
- if (next < 0) next = itemCount - 1;
877
- else if (next >= itemCount) next = 0;
878
- } else {
879
- next = Math.max(0, Math.min(itemCount - 1, next));
880
- }
881
- const el = itemRefs.current.get(next);
882
- if (el?.hasAttribute("data-disabled")) {
883
- const nextNext = next + direction;
884
- if (nextNext >= 0 && nextNext < itemCount) {
885
- setActiveIndex(nextNext);
886
- return;
887
- }
888
- }
889
- setActiveIndex(next);
890
- },
891
- [activeIndex, itemCount, loop, setActiveIndex]
892
- );
893
- const onKeyDown = useCallback(
894
- (e2) => {
895
- const prevKey = orientation === "vertical" ? "ArrowUp" : "ArrowLeft";
896
- const nextKey = orientation === "vertical" ? "ArrowDown" : "ArrowRight";
897
- switch (e2.key) {
898
- case prevKey:
899
- e2.preventDefault();
900
- moveFocus(-1);
901
- break;
902
- case nextKey:
903
- e2.preventDefault();
904
- moveFocus(1);
905
- break;
906
- case "Home":
907
- e2.preventDefault();
908
- setActiveIndex(0);
909
- break;
910
- case "End":
911
- e2.preventDefault();
912
- setActiveIndex(itemCount - 1);
913
- break;
914
- }
915
- },
916
- [moveFocus, setActiveIndex, itemCount, orientation]
917
- );
918
- const getItemProps = useCallback(
919
- (index) => ({
920
- tabIndex: index === activeIndex ? 0 : -1,
921
- "data-focus": index === activeIndex ? "" : void 0,
922
- ref: (el) => {
923
- if (el) {
924
- itemRefs.current.set(index, el);
925
- } else {
926
- itemRefs.current.delete(index);
927
- }
928
- },
929
- onPointerEnter: () => setActiveIndex(index),
930
- onClick: () => setActiveIndex(index)
931
- }),
932
- [activeIndex, setActiveIndex]
933
- );
934
- return {
935
- activeIndex,
936
- setActiveIndex,
937
- containerProps: {
938
- role: orientation === "vertical" ? "listbox" : "group",
939
- onKeyDown
940
- },
941
- getItemProps
942
- };
943
- }
944
- function useTypeAhead({
945
- getItemText,
946
- itemCount,
947
- onMatch,
948
- timeout = 350
949
- }) {
950
- const searchBuffer = useRef("");
951
- const timeoutRef = useRef(void 0);
952
- const onKeyDown = useCallback(
953
- (e2) => {
954
- if (e2.key.length !== 1 || e2.ctrlKey || e2.metaKey || e2.altKey) return;
955
- if (timeoutRef.current) {
956
- clearTimeout(timeoutRef.current);
957
- }
958
- searchBuffer.current += e2.key.toLowerCase();
959
- timeoutRef.current = setTimeout(() => {
960
- searchBuffer.current = "";
961
- }, timeout);
962
- const query = searchBuffer.current;
963
- for (let i2 = 0; i2 < itemCount; i2++) {
964
- const text = getItemText(i2).toLowerCase();
965
- if (text.startsWith(query)) {
966
- onMatch(i2);
967
- return;
968
- }
969
- }
970
- },
971
- [getItemText, itemCount, onMatch, timeout]
972
- );
973
- return { onKeyDown };
974
- }
975
- const DropdownContext = createContext(null);
976
- function useDropdownContext() {
977
- const ctx = useContext(DropdownContext);
978
- if (!ctx) {
979
- throw new Error("Dropdown compound components must be used within <Dropdown>");
980
- }
981
- return ctx;
982
- }
983
- const DropdownItemContext = createContext(null);
984
- function Dropdown({
985
- children,
986
- ...props
987
- }) {
988
- const [open, setOpen] = useState(false);
989
- const triggerRef = useRef(null);
990
- const close = useCallback(() => {
991
- setOpen(false);
992
- triggerRef.current?.focus();
993
- }, []);
994
- const value = useMemo(() => ({ open, setOpen, close, triggerRef }), [open, close]);
995
- return /* @__PURE__ */ jsx(DropdownContext.Provider, { value, children: /* @__PURE__ */ jsx("div", { ...props, children }) });
996
- }
997
- function DropdownButton({
998
- as,
999
- className,
1000
- ...props
1001
- }) {
1002
- const { open, setOpen, triggerRef } = useDropdownContext();
1003
- const interactiveProps = useDataInteractive();
1004
- const Component = as ?? Button;
1005
- const handleClick = useCallback(() => {
1006
- setOpen(!open);
1007
- }, [open, setOpen]);
1008
- const handleKeyDown = useCallback(
1009
- (e2) => {
1010
- if (e2.key === "ArrowDown" || e2.key === "Enter" || e2.key === " ") {
1011
- e2.preventDefault();
1012
- setOpen(true);
1013
- }
1014
- },
1015
- [setOpen]
1016
- );
1017
- return /* @__PURE__ */ jsx(
1018
- Component,
1019
- {
1020
- ref: triggerRef,
1021
- ...interactiveProps,
1022
- ...props,
1023
- className,
1024
- "aria-haspopup": "menu",
1025
- "aria-expanded": open,
1026
- onClick: handleClick,
1027
- onKeyDown: handleKeyDown
1028
- }
1029
- );
1030
- }
1031
- function DropdownMenu({
1032
- anchor = "bottom",
1033
- className,
1034
- children,
1035
- ...props
1036
- }) {
1037
- const { open, close, triggerRef } = useDropdownContext();
1038
- const { mounted, nodeRef, transitionProps } = useTransition(open);
1039
- const popover = usePopover({
1040
- open,
1041
- anchor,
1042
- gap: 8,
1043
- padding: 4
1044
- });
1045
- const menuRef = useRef(null);
1046
- const combinedRef = useCallback(
1047
- (el) => {
1048
- menuRef.current = el;
1049
- popover.popoverRef.current = el;
1050
- nodeRef.current = el;
1051
- },
1052
- [popover.popoverRef, nodeRef]
1053
- );
1054
- popover.triggerRef.current = triggerRef.current;
1055
- useClickOutside([triggerRef, menuRef], close, open);
1056
- useEscapeKey(close, open);
1057
- const itemElements = useRef([]);
1058
- const [itemCount, setItemCount] = useState(0);
1059
- const register = useCallback((el) => {
1060
- if (!itemElements.current.includes(el)) {
1061
- itemElements.current.push(el);
1062
- setItemCount(itemElements.current.length);
1063
- }
1064
- return itemElements.current.indexOf(el);
1065
- }, []);
1066
- const unregister = useCallback((el) => {
1067
- const idx = itemElements.current.indexOf(el);
1068
- if (idx !== -1) {
1069
- itemElements.current.splice(idx, 1);
1070
- setItemCount(itemElements.current.length);
1071
- }
1072
- }, []);
1073
- const roving = useRovingTabindex({
1074
- itemCount,
1075
- initialIndex: -1,
1076
- orientation: "vertical",
1077
- loop: true
1078
- });
1079
- const typeAhead = useTypeAhead({
1080
- getItemText: (index) => itemElements.current[index]?.textContent ?? "",
1081
- itemCount,
1082
- onMatch: (index) => roving.setActiveIndex(index)
1083
- });
1084
- const handleKeyDown = useCallback(
1085
- (e2) => {
1086
- roving.containerProps.onKeyDown(e2);
1087
- typeAhead.onKeyDown(e2);
1088
- if (e2.key === "Enter" || e2.key === " ") {
1089
- e2.preventDefault();
1090
- const activeEl = itemElements.current[roving.activeIndex];
1091
- if (activeEl) {
1092
- activeEl.click();
1093
- }
1094
- }
1095
- },
1096
- [roving, typeAhead]
1097
- );
1098
- const itemContextValue = useMemo(
1099
- () => ({
1100
- register,
1101
- unregister,
1102
- getItemProps: roving.getItemProps
1103
- }),
1104
- [register, unregister, roving.getItemProps]
1105
- );
1106
- if (!mounted) return null;
1107
- return createPortal(
1108
- /* @__PURE__ */ jsx(DropdownItemContext.Provider, { value: itemContextValue, children: /* @__PURE__ */ jsx(
1109
- "div",
1110
- {
1111
- ref: combinedRef,
1112
- ...transitionProps,
1113
- ...props,
1114
- role: "menu",
1115
- "aria-orientation": "vertical",
1116
- style: popover.popoverProps.style,
1117
- onKeyDown: handleKeyDown,
1118
- className: clsx(
1119
- className,
1120
- // Anchor positioning
1121
- "[--anchor-gap:--spacing(2)] [--anchor-padding:--spacing(1)] data-[anchor~=end]:[--anchor-offset:6px] data-[anchor~=start]:[--anchor-offset:-6px] sm:data-[anchor~=end]:[--anchor-offset:4px] sm:data-[anchor~=start]:[--anchor-offset:-4px]",
1122
- // Base styles
1123
- "isolate w-max rounded-xl p-1",
1124
- // Invisible border that is only visible in `forced-colors` mode for accessibility purposes
1125
- "outline outline-transparent focus:outline-hidden",
1126
- // Handle scrolling when menu won't fit in viewport
1127
- "overflow-y-auto",
1128
- // Popover background
1129
- "bg-white/75 backdrop-blur-xl dark:bg-zinc-800/75",
1130
- // Shadows
1131
- "shadow-lg ring-1 ring-zinc-950/10 dark:ring-white/10 dark:ring-inset",
1132
- // Define grid at the menu level if subgrid is supported
1133
- "supports-[grid-template-columns:subgrid]:grid supports-[grid-template-columns:subgrid]:grid-cols-[auto_1fr_1.5rem_0.5rem_auto]",
1134
- // Transitions
1135
- "transition data-leave:duration-100 data-leave:ease-in data-closed:data-leave:opacity-0"
1136
- ),
1137
- children
1138
- }
1139
- ) }),
1140
- document.body
1141
- );
1142
- }
1143
- function DropdownItem({
1144
- className,
1145
- ...props
1146
- }) {
1147
- const { close } = useDropdownContext();
1148
- const itemCtx = useContext(DropdownItemContext);
1149
- const interactiveProps = useDataInteractive({
1150
- disabled: "disabled" in props ? props.disabled ?? false : false
1151
- });
1152
- const elRef = useRef(null);
1153
- const indexRef = useRef(-1);
1154
- const setRef = useCallback(
1155
- (el) => {
1156
- if (el && itemCtx) {
1157
- elRef.current = el;
1158
- indexRef.current = itemCtx.register(el);
1159
- } else if (!el && elRef.current && itemCtx) {
1160
- itemCtx.unregister(elRef.current);
1161
- elRef.current = null;
1162
- indexRef.current = -1;
1163
- }
1164
- },
1165
- [itemCtx]
1166
- );
1167
- const rovingProps = itemCtx && indexRef.current >= 0 ? itemCtx.getItemProps(indexRef.current) : {
1168
- tabIndex: -1,
1169
- "data-focus": void 0,
1170
- ref: () => {
1171
- },
1172
- onPointerEnter: () => {
1173
- },
1174
- onClick: () => {
1175
- }
1176
- };
1177
- const propsDisabled = "disabled" in props ? props.disabled : false;
1178
- const propsOnClick = "onClick" in props && typeof props.onClick === "function" ? props.onClick : void 0;
1179
- const handleClick = useCallback(
1180
- (e2) => {
1181
- if (propsDisabled) return;
1182
- rovingProps.onClick();
1183
- propsOnClick?.(e2);
1184
- close();
1185
- },
1186
- [close, propsDisabled, propsOnClick, rovingProps]
1187
- );
1188
- const classes = clsx(
1189
- className,
1190
- // Base styles
1191
- "group cursor-default rounded-lg px-3.5 py-2.5 focus:outline-hidden sm:px-3 sm:py-1.5",
1192
- // Text styles
1193
- "text-left text-base/6 text-zinc-950 sm:text-sm/6 dark:text-white forced-colors:text-[CanvasText]",
1194
- // Focus
1195
- "data-focus:bg-blue-500 data-focus:text-white",
1196
- // Disabled state
1197
- "data-disabled:opacity-50",
1198
- // Forced colors mode
1199
- "forced-color-adjust-none forced-colors:data-focus:bg-[Highlight] forced-colors:data-focus:text-[HighlightText] forced-colors:data-focus:*:data-[slot=icon]:text-[HighlightText]",
1200
- // Use subgrid when available but fallback to an explicit grid layout if not
1201
- "col-span-full grid grid-cols-[auto_1fr_1.5rem_0.5rem_auto] items-center supports-[grid-template-columns:subgrid]:grid-cols-subgrid",
1202
- // Icons
1203
- "*:data-[slot=icon]:col-start-1 *:data-[slot=icon]:row-start-1 *:data-[slot=icon]:mr-2.5 *:data-[slot=icon]:-ml-0.5 *:data-[slot=icon]:size-5 sm:*:data-[slot=icon]:mr-2 sm:*:data-[slot=icon]:size-4",
1204
- "*:data-[slot=icon]:text-zinc-500 data-focus:*:data-[slot=icon]:text-white dark:*:data-[slot=icon]:text-zinc-400 dark:data-focus:*:data-[slot=icon]:text-white",
1205
- // Avatar
1206
- "*:data-[slot=avatar]:mr-2.5 *:data-[slot=avatar]:-ml-1 *:data-[slot=avatar]:size-6 sm:*:data-[slot=avatar]:mr-2 sm:*:data-[slot=avatar]:size-5"
1207
- );
1208
- if (typeof props.href === "string") {
1209
- const { href, children: children2, ...linkProps } = props;
1210
- return /* @__PURE__ */ jsx(
1211
- Link,
1212
- {
1213
- ref: setRef,
1214
- role: "menuitem",
1215
- href,
1216
- ...linkProps,
1217
- ...interactiveProps,
1218
- tabIndex: rovingProps.tabIndex,
1219
- "data-focus": rovingProps["data-focus"],
1220
- onPointerEnter: rovingProps.onPointerEnter,
1221
- onClick: handleClick,
1222
- className: classes,
1223
- children: children2
1224
- }
1225
- );
1226
- }
1227
- const {
1228
- disabled,
1229
- children,
1230
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1231
- onClick: _onClick,
1232
- ...buttonProps
1233
- } = props;
1234
- return /* @__PURE__ */ jsx(
1235
- "button",
1236
- {
1237
- ref: setRef,
1238
- role: "menuitem",
1239
- type: "button",
1240
- disabled,
1241
- ...buttonProps,
1242
- ...interactiveProps,
1243
- tabIndex: rovingProps.tabIndex,
1244
- "data-focus": rovingProps["data-focus"],
1245
- onPointerEnter: rovingProps.onPointerEnter,
1246
- onClick: handleClick,
1247
- className: classes,
1248
- children
1249
- }
1250
- );
1251
- }
1252
- function DropdownHeader({ className, ...props }) {
1253
- return /* @__PURE__ */ jsx("div", { ...props, className: clsx(className, "col-span-5 px-3.5 pt-2.5 pb-1 sm:px-3") });
1254
- }
1255
- function DropdownSection({
1256
- className,
1257
- ...props
1258
- }) {
1259
- return /* @__PURE__ */ jsx(
1260
- "div",
1261
- {
1262
- role: "group",
1263
- ...props,
1264
- className: clsx(
1265
- className,
1266
- // Define grid at the section level instead of the item level if subgrid is supported
1267
- "col-span-full supports-[grid-template-columns:subgrid]:grid supports-[grid-template-columns:subgrid]:grid-cols-[auto_1fr_1.5rem_0.5rem_auto]"
1268
- )
1269
- }
1270
- );
1271
- }
1272
- function DropdownHeading({
1273
- className,
1274
- ...props
1275
- }) {
1276
- return /* @__PURE__ */ jsx(
1277
- "div",
1278
- {
1279
- role: "presentation",
1280
- ...props,
1281
- className: clsx(
1282
- className,
1283
- "col-span-full grid grid-cols-[1fr_auto] gap-x-12 px-3.5 pt-2 pb-1 text-sm/5 font-medium text-zinc-500 sm:px-3 sm:text-xs/5 dark:text-zinc-400"
1284
- )
1285
- }
1286
- );
1287
- }
1288
- function DropdownDivider({
1289
- className,
1290
- ...props
1291
- }) {
1292
- return /* @__PURE__ */ jsx(
1293
- "hr",
1294
- {
1295
- ...props,
1296
- className: clsx(
1297
- className,
1298
- "col-span-full mx-3.5 my-1 h-px border-0 bg-zinc-950/5 sm:mx-3 dark:bg-white/10 forced-colors:bg-[CanvasText]"
1299
- )
1300
- }
1301
- );
1302
- }
1303
- function DropdownLabel({ className, ...props }) {
1304
- return /* @__PURE__ */ jsx("div", { ...props, "data-slot": "label", className: clsx(className, "col-start-2 row-start-1") });
1305
- }
1306
- function DropdownDescription({
1307
- className,
1308
- ...props
1309
- }) {
1310
- return /* @__PURE__ */ jsx(
1311
- "span",
1312
- {
1313
- "data-slot": "description",
1314
- ...props,
1315
- className: clsx(
1316
- className,
1317
- "col-span-2 col-start-2 row-start-2 text-sm/5 text-zinc-500 group-data-focus:text-white sm:text-xs/5 dark:text-zinc-400 forced-colors:group-data-focus:text-[HighlightText]"
1318
- )
1319
- }
1320
- );
1321
- }
1322
- function DropdownShortcut({
1323
- keys,
1324
- className,
1325
- ...props
1326
- }) {
1327
- return /* @__PURE__ */ jsx("kbd", { ...props, className: clsx(className, "col-start-5 row-start-1 flex justify-self-end"), children: (Array.isArray(keys) ? keys : keys.split("")).map((char, index) => {
1328
- return /* @__PURE__ */ jsx(
1329
- "kbd",
1330
- {
1331
- className: clsx([
1332
- "min-w-[2ch] text-center font-sans text-zinc-400 capitalize group-data-focus:text-white forced-colors:group-data-focus:text-[HighlightText]",
1333
- // Make sure key names that are longer than one character (like "Tab") have extra space
1334
- index > 0 && char.length > 1 && "pl-1"
1335
- ]),
1336
- children: char
1337
- },
1338
- `${char}-${index}`
1339
- );
1340
- }) });
1341
- }
1342
- function Fieldset({
1343
- className,
1344
- disabled,
1345
- ...props
1346
- }) {
1347
- return /* @__PURE__ */ jsx(
1348
- "fieldset",
1349
- {
1350
- disabled,
1351
- ...props,
1352
- className: clsx(className, "*:data-[slot=text]:mt-1 [&>*+[data-slot=control]]:mt-6")
1353
- }
1354
- );
1355
- }
1356
- function Legend({
1357
- className,
1358
- ...props
1359
- }) {
1360
- return /* @__PURE__ */ jsx(
1361
- "legend",
1362
- {
1363
- "data-slot": "legend",
1364
- ...props,
1365
- className: clsx(
1366
- className,
1367
- "text-base/6 font-semibold text-zinc-950 data-disabled:opacity-50 sm:text-sm/6 dark:text-white"
1368
- )
1369
- }
1370
- );
1371
- }
1372
- function FieldGroup({ className, ...props }) {
1373
- return /* @__PURE__ */ jsx("div", { "data-slot": "control", ...props, className: clsx(className, "space-y-8") });
1374
- }
1375
- function Field({
1376
- className,
1377
- disabled,
1378
- ...props
1379
- }) {
1380
- return /* @__PURE__ */ jsx(FieldProvider, { disabled, children: /* @__PURE__ */ jsx(
1381
- "div",
1382
- {
1383
- ...props,
1384
- "data-disabled": disabled ? "" : void 0,
1385
- className: clsx(
1386
- className,
1387
- "[&>[data-slot=label]+[data-slot=control]]:mt-3",
1388
- "[&>[data-slot=label]+[data-slot=description]]:mt-1",
1389
- "[&>[data-slot=description]+[data-slot=control]]:mt-3",
1390
- "[&>[data-slot=control]+[data-slot=description]]:mt-3",
1391
- "[&>[data-slot=control]+[data-slot=error]]:mt-3",
1392
- "*:data-[slot=label]:font-medium"
1393
- )
1394
- }
1395
- ) });
1396
- }
1397
- function Label({
1398
- className,
1399
- ...props
1400
- }) {
1401
- const fieldLabelProps = useFieldLabelProps();
1402
- return (
1403
- // biome-ignore lint/a11y/noLabelWithoutControl: htmlFor provided via useFieldLabelProps hook
1404
- /* @__PURE__ */ jsx(
1405
- "label",
1406
- {
1407
- "data-slot": "label",
1408
- ...fieldLabelProps,
1409
- ...props,
1410
- className: clsx(
1411
- className,
1412
- "text-base/6 text-zinc-950 select-none data-disabled:opacity-50 sm:text-sm/6 dark:text-white"
1413
- )
1414
- }
1415
- )
1416
- );
1417
- }
1418
- function Description({
1419
- className,
1420
- ...props
1421
- }) {
1422
- const fieldDescriptionProps = useFieldDescriptionProps();
1423
- return /* @__PURE__ */ jsx(
1424
- "p",
1425
- {
1426
- "data-slot": "description",
1427
- ...fieldDescriptionProps,
1428
- ...props,
1429
- className: clsx(
1430
- className,
1431
- "text-base/6 text-zinc-500 data-disabled:opacity-50 sm:text-sm/6 dark:text-zinc-400"
1432
- )
1433
- }
1434
- );
1435
- }
1436
- function ErrorMessage({
1437
- className,
1438
- ...props
1439
- }) {
1440
- const fieldErrorProps = useFieldErrorProps();
1441
- return /* @__PURE__ */ jsx(
1442
- "p",
1443
- {
1444
- "data-slot": "error",
1445
- ...fieldErrorProps,
1446
- ...props,
1447
- className: clsx(
1448
- className,
1449
- "text-base/6 text-red-600 data-disabled:opacity-50 sm:text-sm/6 dark:text-red-500"
1450
- )
1451
- }
1452
- );
1453
- }
2
+ "use client";
3
+ import { a as PricingTable, b as clsx, c as PaginationEllipsis, d as PaginationNext, f as PaginationPrevious, l as PaginationItem, m as Breadcrumb, n as SkeletonCard, o as Pagination, p as EmptyState, r as SkeletonText, s as PaginationContent, t as Skeleton, u as PaginationLink } from "./skeleton-Bb51IWbG.js";
4
+ import { $ as NavbarSpacer, $t as CheckboxGroup, An as Accordion, B as SelectSeparator, Bt as DialogTitle, C as SidebarFooter, Cn as Text, Ct as DropdownHeading, D as SidebarLabel, Dt as DropdownSection, E as SidebarItem, Et as DropdownMenu, F as SelectGroup, Ft as Divider, G as RadioField, Gt as ComboboxDescription, H as SelectValue, Ht as DescriptionList, I as SelectItem, It as Dialog, J as Navbar, K as RadioGroup, Kt as ComboboxLabel, L as SelectLabel, Lt as DialogActions, M as Select, Mt as DrawerBody, N as Select$1, Nt as DrawerFooter, O as SidebarSection, Ot as DropdownShortcut, P as SelectContent, Pt as DrawerHeader, Q as NavbarSection, Qt as CheckboxField, R as SelectScrollDownButton, Rt as DialogBody, S as SidebarDivider, Sn as AlertTitle, St as DropdownHeader, T as SidebarHeading, Tt as DropdownLabel, U as Rating, Ut as DescriptionTerm, V as SelectTrigger, Vt as DescriptionDetails, W as Radio, Wt as Combobox, X as NavbarItem, Xt as CodeBlock, Y as NavbarDivider, Z as NavbarLabel, Zt as Checkbox, _ as StackedLayout, _n as TouchTarget, _t as Legend, a as TimelineItem, at as ListboxLabel, b as Sidebar, bn as AlertBody, bt as DropdownDescription, c as TabList, cn as Callout, ct as KbdShortcut, d as Switch, dn as Badge, dt as Description, f as SwitchField, ft as ErrorMessage, g as StatGroup, gn as Button, gt as Label, h as Stat, ht as Fieldset, i as Timeline, it as ListboxDescription, jn as AccordionItem, jt as Drawer, k as SidebarSpacer, l as TabPanel, ln as Checkbox$1, lt as Input, m as Stepper, mn as Avatar, mt as FieldGroup, n as ToastProvider, o as Textarea, ot as ListboxOption, p as SwitchGroup, pn as AvatarGroup, pt as Field, q as Progress, qt as ComboboxOption, r as useToast, rt as Listbox, s as Tab, st as Kbd, t as Tooltip, u as Tabs, un as CheckboxIndicator, ut as InputGroup, v as Slider, vn as Alert, vt as Dropdown, w as SidebarHeader, wn as Link, wt as DropdownItem, x as SidebarBody, xn as AlertDescription, xt as DropdownDivider, y as SidebarLayout, yn as AlertActions, yt as DropdownButton, z as SelectScrollUpButton, zt as DialogDescription } from "./tooltip-DZGP3hO_.js";
5
+ import { createContext, use, useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/heading.tsx
1454
8
  function Heading({ className, level = 1, ...props }) {
1455
- const Element = `h${level}`;
1456
- return /* @__PURE__ */ jsx(
1457
- Element,
1458
- {
1459
- ...props,
1460
- className: clsx(
1461
- className,
1462
- "text-2xl/8 font-semibold text-zinc-950 sm:text-xl/8 dark:text-white"
1463
- )
1464
- }
1465
- );
1466
- }
1467
- const ListboxContext = createContext(null);
1468
- function useListboxContext() {
1469
- const ctx = useContext(ListboxContext);
1470
- if (!ctx) {
1471
- throw new Error("Listbox compound components must be used within <Listbox>");
1472
- }
1473
- return ctx;
1474
- }
1475
- function countOptions(children) {
1476
- let count = 0;
1477
- Children.forEach(children, (child) => {
1478
- if (!isValidElement(child)) return;
1479
- if (child.type === ListboxOption) {
1480
- count++;
1481
- }
1482
- });
1483
- return count;
1484
- }
1485
- const OptionIndexContext = createContext(-1);
1486
- function OptionIndexProvider({ children }) {
1487
- let index = 0;
1488
- return /* @__PURE__ */ jsx(Fragment, { children: Children.map(children, (child) => {
1489
- if (!isValidElement(child)) return child;
1490
- if (child.type === ListboxOption) {
1491
- const currentIndex = index++;
1492
- return /* @__PURE__ */ jsx(OptionIndexContext.Provider, { value: currentIndex, children: child });
1493
- }
1494
- return child;
1495
- }) });
1496
- }
1497
- function Listbox({
1498
- className,
1499
- placeholder,
1500
- autoFocus,
1501
- "aria-label": ariaLabel,
1502
- children: options,
1503
- value: controlledValue,
1504
- defaultValue,
1505
- onChange,
1506
- disabled = false,
1507
- name
1508
- }) {
1509
- const [value, setValue] = useControllableState({
1510
- value: controlledValue,
1511
- defaultValue,
1512
- onChange
1513
- });
1514
- const [open, setOpen] = useState(false);
1515
- const [activeIndex, setActiveIndex] = useState(-1);
1516
- const [optionCount, setOptionCount] = useState(0);
1517
- const buttonId = useId();
1518
- const listId = useId();
1519
- const optionMapRef = useRef(/* @__PURE__ */ new Map());
1520
- const registerOption = useCallback((index, optValue, element) => {
1521
- optionMapRef.current.set(index, { value: optValue, element });
1522
- }, []);
1523
- useEffect(() => {
1524
- setOptionCount(countOptions(options));
1525
- }, [options]);
1526
- const { triggerRef, popoverRef, popoverProps } = usePopover({
1527
- open,
1528
- anchor: "selection start",
1529
- gap: 0,
1530
- padding: 16
1531
- });
1532
- const { mounted, nodeRef, transitionProps } = useTransition(open);
1533
- useClickOutside([triggerRef, popoverRef], () => setOpen(false), open);
1534
- useEscapeKey(() => {
1535
- setOpen(false);
1536
- triggerRef.current?.focus();
1537
- }, open);
1538
- const selectActiveOption = useCallback(() => {
1539
- const entry = optionMapRef.current.get(activeIndex);
1540
- if (entry) {
1541
- setValue(entry.value);
1542
- setOpen(false);
1543
- triggerRef.current?.focus();
1544
- }
1545
- }, [activeIndex, setValue, triggerRef]);
1546
- const handleOptionsKeyDown = useCallback(
1547
- (e2) => {
1548
- switch (e2.key) {
1549
- case "ArrowDown": {
1550
- e2.preventDefault();
1551
- setActiveIndex((prev) => {
1552
- const next = prev + 1;
1553
- return next >= optionCount ? 0 : next;
1554
- });
1555
- break;
1556
- }
1557
- case "ArrowUp": {
1558
- e2.preventDefault();
1559
- setActiveIndex((prev) => {
1560
- const next = prev - 1;
1561
- return next < 0 ? optionCount - 1 : next;
1562
- });
1563
- break;
1564
- }
1565
- case "Home": {
1566
- e2.preventDefault();
1567
- setActiveIndex(0);
1568
- break;
1569
- }
1570
- case "End": {
1571
- e2.preventDefault();
1572
- setActiveIndex(optionCount - 1);
1573
- break;
1574
- }
1575
- case "Enter":
1576
- case " ": {
1577
- e2.preventDefault();
1578
- selectActiveOption();
1579
- break;
1580
- }
1581
- }
1582
- },
1583
- [optionCount, selectActiveOption]
1584
- );
1585
- useEffect(() => {
1586
- if (!open || activeIndex < 0) return;
1587
- const entry = optionMapRef.current.get(activeIndex);
1588
- entry?.element?.scrollIntoView({ block: "nearest" });
1589
- }, [activeIndex, open]);
1590
- useEffect(() => {
1591
- if (open) {
1592
- let selectedIdx = -1;
1593
- for (const [idx, entry] of optionMapRef.current.entries()) {
1594
- if (entry.value === value) {
1595
- selectedIdx = idx;
1596
- break;
1597
- }
1598
- }
1599
- setActiveIndex(selectedIdx >= 0 ? selectedIdx : 0);
1600
- }
1601
- }, [open, value]);
1602
- useEffect(() => {
1603
- if (mounted && popoverRef.current) {
1604
- popoverRef.current.focus({ preventScroll: true });
1605
- }
1606
- }, [mounted, popoverRef]);
1607
- const selectedContent = useMemo(() => {
1608
- let matched = null;
1609
- Children.forEach(options, (child) => {
1610
- if (!isValidElement(child)) return;
1611
- if (child.type === ListboxOption && child.props.value === value) {
1612
- matched = child.props.children;
1613
- }
1614
- });
1615
- return matched;
1616
- }, [options, value]);
1617
- const ctx = useMemo(
1618
- () => ({
1619
- value,
1620
- setValue,
1621
- open,
1622
- setOpen,
1623
- disabled,
1624
- activeIndex,
1625
- setActiveIndex,
1626
- registerOption,
1627
- optionCount,
1628
- buttonId,
1629
- listId
1630
- }),
1631
- [value, setValue, open, disabled, activeIndex, registerOption, optionCount, buttonId, listId]
1632
- );
1633
- const handleButtonClick = useCallback(() => {
1634
- if (!disabled) {
1635
- setOpen((prev) => !prev);
1636
- }
1637
- }, [disabled]);
1638
- const handleButtonKeyDown = useCallback(
1639
- (e2) => {
1640
- if (disabled) return;
1641
- if (e2.key === "ArrowDown" || e2.key === "ArrowUp" || e2.key === "Enter" || e2.key === " ") {
1642
- e2.preventDefault();
1643
- setOpen(true);
1644
- }
1645
- },
1646
- [disabled]
1647
- );
1648
- const selectedSharedClasses = clsx(
1649
- "flex min-w-0 items-center",
1650
- "*:data-[slot=icon]:size-5 *:data-[slot=icon]:shrink-0 sm:*:data-[slot=icon]:size-4",
1651
- "*:data-[slot=icon]:text-zinc-500 group-data-focus/option:*:data-[slot=icon]:text-white dark:*:data-[slot=icon]:text-zinc-400",
1652
- "forced-colors:*:data-[slot=icon]:text-[CanvasText] forced-colors:group-data-focus/option:*:data-[slot=icon]:text-[Canvas]",
1653
- "*:data-[slot=avatar]:-mx-0.5 *:data-[slot=avatar]:size-6 sm:*:data-[slot=avatar]:size-5"
1654
- );
1655
- const displayContent = selectedContent != null ? /* @__PURE__ */ jsx("span", { className: selectedSharedClasses, children: selectedContent }) : placeholder ? /* @__PURE__ */ jsx("span", { className: "block truncate text-zinc-500", children: placeholder }) : null;
1656
- return /* @__PURE__ */ jsxs(ListboxContext.Provider, { value: ctx, children: [
1657
- name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: String(value ?? "") }),
1658
- /* @__PURE__ */ jsxs(
1659
- "button",
1660
- {
1661
- ref: triggerRef,
1662
- id: buttonId,
1663
- type: "button",
1664
- role: "combobox",
1665
- "aria-expanded": open,
1666
- "aria-haspopup": "listbox",
1667
- "aria-controls": open ? listId : void 0,
1668
- "aria-label": ariaLabel,
1669
- "aria-disabled": disabled || void 0,
1670
- "data-slot": "control",
1671
- "data-disabled": disabled ? "" : void 0,
1672
- "data-active": open ? "" : void 0,
1673
- autoFocus,
1674
- disabled,
1675
- onClick: handleButtonClick,
1676
- onKeyDown: handleButtonKeyDown,
1677
- className: clsx([
1678
- className,
1679
- "group relative block w-full",
1680
- "before:absolute before:inset-px before:rounded-[calc(var(--radius-lg)-1px)] before:bg-white before:shadow-sm",
1681
- "dark:before:hidden",
1682
- "focus:outline-hidden",
1683
- "after:pointer-events-none after:absolute after:inset-0 after:rounded-lg after:ring-transparent after:ring-inset data-focus:after:ring-2 data-focus:after:ring-blue-500",
1684
- "data-disabled:opacity-50 data-disabled:before:bg-zinc-950/5 data-disabled:before:shadow-none"
1685
- ]),
1686
- children: [
1687
- /* @__PURE__ */ jsx(
1688
- "span",
1689
- {
1690
- className: clsx([
1691
- "relative block w-full appearance-none rounded-lg py-[calc(--spacing(2.5)-1px)] sm:py-[calc(--spacing(1.5)-1px)]",
1692
- "min-h-11 sm:min-h-9",
1693
- "pr-[calc(--spacing(7)-1px)] pl-[calc(--spacing(3.5)-1px)] sm:pl-[calc(--spacing(3)-1px)]",
1694
- "text-left text-base/6 text-zinc-950 placeholder:text-zinc-500 sm:text-sm/6 dark:text-white forced-colors:text-[CanvasText]",
1695
- "border border-zinc-950/10 group-data-active:border-zinc-950/20 group-data-hover:border-zinc-950/20 dark:border-white/10 dark:group-data-active:border-white/20 dark:group-data-hover:border-white/20",
1696
- "bg-transparent dark:bg-white/5",
1697
- "group-data-invalid:border-red-500 group-data-hover:group-data-invalid:border-red-500 dark:group-data-invalid:border-red-600 dark:data-hover:group-data-invalid:border-red-600",
1698
- "group-data-disabled:border-zinc-950/20 group-data-disabled:opacity-100 dark:group-data-disabled:border-white/15 dark:group-data-disabled:bg-white/2.5 dark:group-data-disabled:data-hover:border-white/15"
1699
- ]),
1700
- children: displayContent
1701
- }
1702
- ),
1703
- /* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2", children: /* @__PURE__ */ jsxs(
1704
- "svg",
1705
- {
1706
- className: "size-5 stroke-zinc-500 group-data-disabled:stroke-zinc-600 sm:size-4 dark:stroke-zinc-400 forced-colors:stroke-[CanvasText]",
1707
- viewBox: "0 0 16 16",
1708
- "aria-hidden": "true",
1709
- fill: "none",
1710
- children: [
1711
- /* @__PURE__ */ jsx(
1712
- "path",
1713
- {
1714
- d: "M5.75 10.75L8 13L10.25 10.75",
1715
- strokeWidth: 1.5,
1716
- strokeLinecap: "round",
1717
- strokeLinejoin: "round"
1718
- }
1719
- ),
1720
- /* @__PURE__ */ jsx(
1721
- "path",
1722
- {
1723
- d: "M10.25 5.25L8 3L5.75 5.25",
1724
- strokeWidth: 1.5,
1725
- strokeLinecap: "round",
1726
- strokeLinejoin: "round"
1727
- }
1728
- )
1729
- ]
1730
- }
1731
- ) })
1732
- ]
1733
- }
1734
- ),
1735
- mounted && createPortal(
1736
- /* @__PURE__ */ jsx(
1737
- "div",
1738
- {
1739
- ref: (node) => {
1740
- popoverRef.current = node;
1741
- nodeRef.current = node;
1742
- },
1743
- ...popoverProps,
1744
- ...transitionProps,
1745
- id: listId,
1746
- role: "listbox",
1747
- "aria-labelledby": buttonId,
1748
- tabIndex: -1,
1749
- onKeyDown: handleOptionsKeyDown,
1750
- className: clsx(
1751
- "[--anchor-offset:-1.625rem] [--anchor-padding:--spacing(4)] sm:[--anchor-offset:-1.375rem]",
1752
- "isolate w-max min-w-[calc(var(--button-width)+1.75rem)] scroll-py-1 rounded-xl p-1 select-none",
1753
- "outline outline-transparent focus:outline-hidden",
1754
- "overflow-y-scroll overscroll-contain",
1755
- "bg-white/75 backdrop-blur-xl dark:bg-zinc-800/75",
1756
- "shadow-lg ring-1 ring-zinc-950/10 dark:ring-white/10 dark:ring-inset",
1757
- "transition-opacity duration-100 ease-in data-closed:data-leave:opacity-0 data-transition:pointer-events-none"
1758
- ),
1759
- style: {
1760
- ...popoverProps.style,
1761
- minWidth: triggerRef.current ? `${triggerRef.current.getBoundingClientRect().width + 28}px` : void 0
1762
- },
1763
- children: /* @__PURE__ */ jsx(OptionIndexProvider, { children: options })
1764
- }
1765
- ),
1766
- document.body
1767
- )
1768
- ] });
1769
- }
1770
- function ListboxOption({
1771
- children,
1772
- className,
1773
- value: optionValue,
1774
- disabled: optionDisabled = false
1775
- }) {
1776
- const ctx = useListboxContext();
1777
- const index = useContext(OptionIndexContext);
1778
- const optionRef = useRef(null);
1779
- const isSelected = ctx.value === optionValue;
1780
- const isFocused = ctx.activeIndex === index;
1781
- useEffect(() => {
1782
- ctx.registerOption(index, optionValue, optionRef.current);
1783
- }, [index, optionValue, ctx.registerOption, ctx]);
1784
- const sharedClasses = clsx(
1785
- "flex min-w-0 items-center",
1786
- "*:data-[slot=icon]:size-5 *:data-[slot=icon]:shrink-0 sm:*:data-[slot=icon]:size-4",
1787
- "*:data-[slot=icon]:text-zinc-500 group-data-focus/option:*:data-[slot=icon]:text-white dark:*:data-[slot=icon]:text-zinc-400",
1788
- "forced-colors:*:data-[slot=icon]:text-[CanvasText] forced-colors:group-data-focus/option:*:data-[slot=icon]:text-[Canvas]",
1789
- "*:data-[slot=avatar]:-mx-0.5 *:data-[slot=avatar]:size-6 sm:*:data-[slot=avatar]:size-5"
1790
- );
1791
- const handleClick = useCallback(() => {
1792
- if (optionDisabled) return;
1793
- ctx.setValue(optionValue);
1794
- ctx.setOpen(false);
1795
- }, [optionDisabled, ctx.setValue, ctx.setOpen, optionValue, ctx]);
1796
- const handlePointerEnter = useCallback(() => {
1797
- if (!optionDisabled) {
1798
- ctx.setActiveIndex(index);
1799
- }
1800
- }, [optionDisabled, ctx.setActiveIndex, index, ctx]);
1801
- return /* @__PURE__ */ jsxs(
1802
- "div",
1803
- {
1804
- ref: optionRef,
1805
- role: "option",
1806
- "aria-selected": isSelected,
1807
- "aria-disabled": optionDisabled || void 0,
1808
- "data-selected": isSelected ? "" : void 0,
1809
- "data-focus": isFocused ? "" : void 0,
1810
- "data-disabled": optionDisabled ? "" : void 0,
1811
- onClick: handleClick,
1812
- onPointerEnter: handlePointerEnter,
1813
- tabIndex: -1,
1814
- className: clsx(
1815
- "group/option grid cursor-default grid-cols-[--spacing(5)_1fr] items-baseline gap-x-2 rounded-lg py-2.5 pr-3.5 pl-2 sm:grid-cols-[--spacing(4)_1fr] sm:py-1.5 sm:pr-3 sm:pl-1.5",
1816
- "text-base/6 text-zinc-950 sm:text-sm/6 dark:text-white forced-colors:text-[CanvasText]",
1817
- "outline-hidden data-focus:bg-blue-500 data-focus:text-white",
1818
- "forced-color-adjust-none forced-colors:data-focus:bg-[Highlight] forced-colors:data-focus:text-[HighlightText]",
1819
- "data-disabled:opacity-50"
1820
- ),
1821
- children: [
1822
- /* @__PURE__ */ jsx(
1823
- "svg",
1824
- {
1825
- className: "relative hidden size-5 self-center stroke-current group-data-selected/option:inline sm:size-4",
1826
- viewBox: "0 0 16 16",
1827
- fill: "none",
1828
- "aria-hidden": "true",
1829
- children: /* @__PURE__ */ jsx("path", { d: "M4 8.5l3 3L12 4", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" })
1830
- }
1831
- ),
1832
- /* @__PURE__ */ jsx("span", { className: clsx(className, sharedClasses, "col-start-2"), children })
1833
- ]
1834
- }
1835
- );
1836
- }
1837
- function ListboxLabel({ className, ...props }) {
1838
- return /* @__PURE__ */ jsx(
1839
- "span",
1840
- {
1841
- ...props,
1842
- className: clsx(className, "ml-2.5 truncate first:ml-0 sm:ml-2 sm:first:ml-0")
1843
- }
1844
- );
1845
- }
1846
- function ListboxDescription({
1847
- className,
1848
- children,
1849
- ...props
1850
- }) {
1851
- return /* @__PURE__ */ jsx(
1852
- "span",
1853
- {
1854
- ...props,
1855
- className: clsx(
1856
- className,
1857
- "flex flex-1 overflow-hidden text-zinc-500 group-data-focus/option:text-white before:w-2 before:min-w-0 before:shrink dark:text-zinc-400"
1858
- ),
1859
- children: /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children })
1860
- }
1861
- );
1862
- }
1863
- const LayoutGroupContext = createContext(null);
1864
- function LayoutGroup({ children }) {
1865
- const rectsRef = useRef(/* @__PURE__ */ new Map());
1866
- return /* @__PURE__ */ jsx(LayoutGroupContext, { value: rectsRef, children });
1867
- }
1868
- const LAYOUT_EASING = "cubic-bezier(0.25, 0.8, 0.25, 1)";
1869
- const LAYOUT_DURATION = 350;
1870
- function useLayoutAnimation(layoutId) {
1871
- const ref = useRef(null);
1872
- const rectsCtx = useContext(LayoutGroupContext);
1873
- useLayoutEffect(() => {
1874
- const el = ref.current;
1875
- const rects = rectsCtx?.current;
1876
- if (!(el && rects)) return;
1877
- const prevRect = rects.get(layoutId);
1878
- const currentRect = el.getBoundingClientRect();
1879
- rects.set(layoutId, currentRect);
1880
- if (prevRect) {
1881
- const deltaX = prevRect.left - currentRect.left;
1882
- const deltaY = prevRect.top - currentRect.top;
1883
- if (Math.abs(deltaX) > 0.5 || Math.abs(deltaY) > 0.5) {
1884
- el.animate(
1885
- [{ transform: `translate(${deltaX}px, ${deltaY}px)` }, { transform: "translate(0, 0)" }],
1886
- {
1887
- duration: LAYOUT_DURATION,
1888
- easing: LAYOUT_EASING,
1889
- fill: "none"
1890
- }
1891
- );
1892
- }
1893
- }
1894
- return () => {
1895
- if (el) {
1896
- rects.set(layoutId, el.getBoundingClientRect());
1897
- }
1898
- };
1899
- });
1900
- return ref;
1901
- }
1902
- function LayoutIndicator({ layoutId, ...props }) {
1903
- const ref = useLayoutAnimation(layoutId);
1904
- return /* @__PURE__ */ jsx("span", { ref, ...props });
1905
- }
1906
- function Navbar({ className, ...props }) {
1907
- return /* @__PURE__ */ jsx("nav", { ...props, className: clsx(className, "flex flex-1 items-center gap-4 py-2.5") });
1908
- }
1909
- function NavbarDivider({ className, ...props }) {
1910
- return /* @__PURE__ */ jsx(
1911
- "div",
1912
- {
1913
- "aria-hidden": "true",
1914
- ...props,
1915
- className: clsx(className, "h-6 w-px bg-zinc-950/10 dark:bg-white/10")
1916
- }
1917
- );
1918
- }
1919
- function NavbarSection({ className, ...props }) {
1920
- const id = useId();
1921
- return /* @__PURE__ */ jsx(LayoutGroup, { id, children: /* @__PURE__ */ jsx("div", { ...props, className: clsx(className, "flex items-center gap-3") }) });
1922
- }
1923
- function NavbarSpacer({ className, ...props }) {
1924
- return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", ...props, className: clsx(className, "-ml-4 flex-1") });
1925
- }
1926
- const NavbarItem = forwardRef(function NavbarItem2({
1927
- current,
1928
- className,
1929
- children,
1930
- ...props
1931
- }, ref) {
1932
- const disabled = "disabled" in props ? props.disabled : false;
1933
- const interactiveProps = useDataInteractive({ disabled: disabled ?? false });
1934
- const classes = clsx(
1935
- // Base
1936
- "relative flex min-w-0 items-center gap-3 rounded-lg p-2 text-left text-base/6 font-medium text-zinc-950 sm:text-sm/5",
1937
- // Leading icon/icon-only
1938
- "*:data-[slot=icon]:size-6 *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:fill-zinc-500 sm:*:data-[slot=icon]:size-5",
1939
- // Trailing icon (down chevron or similar)
1940
- "*:not-nth-2:last:data-[slot=icon]:ml-auto *:not-nth-2:last:data-[slot=icon]:size-5 sm:*:not-nth-2:last:data-[slot=icon]:size-4",
1941
- // Avatar
1942
- "*:data-[slot=avatar]:-m-0.5 *:data-[slot=avatar]:size-7 *:data-[slot=avatar]:[--avatar-radius:var(--radius-md)] sm:*:data-[slot=avatar]:size-6",
1943
- // Hover
1944
- "data-hover:bg-zinc-950/5 data-hover:*:data-[slot=icon]:fill-zinc-950",
1945
- // Active
1946
- "data-active:bg-zinc-950/5 data-active:*:data-[slot=icon]:fill-zinc-950",
1947
- // Dark mode
1948
- "dark:text-white dark:*:data-[slot=icon]:fill-zinc-400",
1949
- "dark:data-hover:bg-white/5 dark:data-hover:*:data-[slot=icon]:fill-white",
1950
- "dark:data-active:bg-white/5 dark:data-active:*:data-[slot=icon]:fill-white"
1951
- );
1952
- return /* @__PURE__ */ jsxs("span", { className: clsx(className, "relative"), children: [
1953
- current && /* @__PURE__ */ jsx(
1954
- LayoutIndicator,
1955
- {
1956
- layoutId: "current-indicator",
1957
- className: "absolute inset-x-2 -bottom-2.5 h-0.5 rounded-full bg-zinc-950 dark:bg-white"
1958
- }
1959
- ),
1960
- typeof props.href === "string" ? /* @__PURE__ */ jsx(
1961
- Link,
1962
- {
1963
- ...props,
1964
- className: classes,
1965
- "data-current": current ? "true" : void 0,
1966
- ref,
1967
- children: /* @__PURE__ */ jsx(TouchTarget, { children })
1968
- }
1969
- ) : /* @__PURE__ */ jsx(
1970
- "button",
1971
- {
1972
- type: "button",
1973
- ...props,
1974
- ...interactiveProps,
1975
- className: clsx("cursor-default", classes),
1976
- "data-current": current ? "true" : void 0,
1977
- ref,
1978
- children: /* @__PURE__ */ jsx(TouchTarget, { children })
1979
- }
1980
- )
1981
- ] });
1982
- });
1983
- function NavbarLabel({ className, ...props }) {
1984
- return /* @__PURE__ */ jsx("span", { ...props, className: clsx(className, "truncate") });
1985
- }
1986
- const RadioGroupContext = createContext(null);
1987
- function useRadioGroupContext() {
1988
- const ctx = useContext(RadioGroupContext);
1989
- if (!ctx) throw new Error("Radio must be used within a RadioGroup");
1990
- return ctx;
1991
- }
1992
- function RadioGroup({
1993
- className,
1994
- value: controlledValue,
1995
- defaultValue,
1996
- onChange,
1997
- disabled = false,
1998
- name,
1999
- children,
2000
- ...props
2001
- }) {
2002
- const [value, setValue] = useControllableState({
2003
- value: controlledValue,
2004
- defaultValue: defaultValue ?? "",
2005
- onChange
2006
- });
2007
- const handleKeyDown = useCallback(
2008
- (e2) => {
2009
- const radios = Array.from(
2010
- e2.currentTarget.querySelectorAll('[role="radio"]:not([data-disabled])')
2011
- );
2012
- if (radios.length === 0) return;
2013
- const currentIndex = radios.indexOf(document.activeElement);
2014
- let nextIndex = currentIndex;
2015
- switch (e2.key) {
2016
- case "ArrowDown":
2017
- case "ArrowRight":
2018
- e2.preventDefault();
2019
- nextIndex = currentIndex + 1 >= radios.length ? 0 : currentIndex + 1;
2020
- break;
2021
- case "ArrowUp":
2022
- case "ArrowLeft":
2023
- e2.preventDefault();
2024
- nextIndex = currentIndex - 1 < 0 ? radios.length - 1 : currentIndex - 1;
2025
- break;
2026
- case "Home":
2027
- e2.preventDefault();
2028
- nextIndex = 0;
2029
- break;
2030
- case "End":
2031
- e2.preventDefault();
2032
- nextIndex = radios.length - 1;
2033
- break;
2034
- default:
2035
- return;
2036
- }
2037
- const nextRadio = radios[nextIndex];
2038
- if (!nextRadio) return;
2039
- nextRadio.focus();
2040
- const radioValue = nextRadio.getAttribute("data-value");
2041
- if (radioValue != null) {
2042
- setValue(radioValue);
2043
- }
2044
- },
2045
- [setValue]
2046
- );
2047
- return /* @__PURE__ */ jsx(RadioGroupContext, { value: { value, onChange: setValue, disabled, name }, children: /* @__PURE__ */ jsx(
2048
- "div",
2049
- {
2050
- role: "radiogroup",
2051
- "data-slot": "control",
2052
- onKeyDown: handleKeyDown,
2053
- ...props,
2054
- className: clsx(
2055
- className,
2056
- // Basic groups
2057
- "space-y-3 **:data-[slot=label]:font-normal",
2058
- // With descriptions
2059
- "has-data-[slot=description]:space-y-6 has-data-[slot=description]:**:data-[slot=label]:font-medium"
2060
- ),
2061
- children
2062
- }
2063
- ) });
2064
- }
2065
- function RadioField({
2066
- className,
2067
- disabled,
2068
- ...props
2069
- }) {
2070
- return /* @__PURE__ */ jsx(FieldProvider, { disabled, children: /* @__PURE__ */ jsx(
2071
- "div",
2072
- {
2073
- "data-slot": "field",
2074
- "data-disabled": disabled ? "" : void 0,
2075
- ...props,
2076
- className: clsx(
2077
- className,
2078
- // Base layout
2079
- "grid grid-cols-[1.125rem_1fr] gap-x-4 gap-y-1 sm:grid-cols-[1rem_1fr]",
2080
- // Control layout
2081
- "*:data-[slot=control]:col-start-1 *:data-[slot=control]:row-start-1 *:data-[slot=control]:mt-0.75 sm:*:data-[slot=control]:mt-1",
2082
- // Label layout
2083
- "*:data-[slot=label]:col-start-2 *:data-[slot=label]:row-start-1",
2084
- // Description layout
2085
- "*:data-[slot=description]:col-start-2 *:data-[slot=description]:row-start-2",
2086
- // With description
2087
- "has-data-[slot=description]:**:data-[slot=label]:font-medium"
2088
- )
2089
- }
2090
- ) });
2091
- }
2092
- const base = [
2093
- // Basic layout
2094
- "relative isolate flex size-4.75 shrink-0 rounded-full sm:size-4.25",
2095
- // Background color + shadow applied to inset pseudo element, so shadow blends with border in light mode
2096
- "before:absolute before:inset-0 before:-z-10 before:rounded-full before:bg-white before:shadow-sm",
2097
- // Background color when checked
2098
- "group-data-checked:before:bg-(--radio-checked-bg)",
2099
- // Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
2100
- "dark:before:hidden",
2101
- // Background color applied to control in dark mode
2102
- "dark:bg-white/5 dark:group-data-checked:bg-(--radio-checked-bg)",
2103
- // Border
2104
- "border border-zinc-950/15 group-data-checked:border-transparent group-data-hover:group-data-checked:border-transparent group-data-hover:border-zinc-950/30 group-data-checked:bg-(--radio-checked-border)",
2105
- "dark:border-white/15 dark:group-data-checked:border-white/5 dark:group-data-hover:group-data-checked:border-white/5 dark:group-data-hover:border-white/30",
2106
- // Inner highlight shadow
2107
- "after:absolute after:inset-0 after:rounded-full after:shadow-[inset_0_1px_--theme(--color-white/15%)]",
2108
- "dark:after:-inset-px dark:after:hidden dark:after:rounded-full dark:group-data-checked:after:block",
2109
- // Indicator color (light mode)
2110
- "[--radio-indicator:transparent] group-data-checked:[--radio-indicator:var(--radio-checked-indicator)] group-data-hover:group-data-checked:[--radio-indicator:var(--radio-checked-indicator)] group-data-hover:[--radio-indicator:var(--color-zinc-900)]/10",
2111
- // Indicator color (dark mode)
2112
- "dark:group-data-hover:group-data-checked:[--radio-indicator:var(--radio-checked-indicator)] dark:group-data-hover:[--radio-indicator:var(--color-zinc-700)]",
2113
- // Focus ring
2114
- "group-data-focus:outline group-data-focus:outline-2 group-data-focus:outline-offset-2 group-data-focus:outline-blue-500",
2115
- // Disabled state
2116
- "group-data-disabled:opacity-50",
2117
- "group-data-disabled:border-zinc-950/25 group-data-disabled:bg-zinc-950/5 group-data-disabled:[--radio-checked-indicator:var(--color-zinc-950)]/50 group-data-disabled:before:bg-transparent",
2118
- "dark:group-data-disabled:border-white/20 dark:group-data-disabled:bg-white/2.5 dark:group-data-disabled:[--radio-checked-indicator:var(--color-white)]/50 dark:group-data-checked:group-data-disabled:after:hidden"
2119
- ];
2120
- const radioColors = {
2121
- "dark/zinc": [
2122
- "[--radio-checked-bg:var(--color-zinc-900)] [--radio-checked-border:var(--color-zinc-950)]/90 [--radio-checked-indicator:var(--color-white)]",
2123
- "dark:[--radio-checked-bg:var(--color-zinc-600)]"
2124
- ],
2125
- "dark/white": [
2126
- "[--radio-checked-bg:var(--color-zinc-900)] [--radio-checked-border:var(--color-zinc-950)]/90 [--radio-checked-indicator:var(--color-white)]",
2127
- "dark:[--radio-checked-bg:var(--color-white)] dark:[--radio-checked-border:var(--color-zinc-950)]/15 dark:[--radio-checked-indicator:var(--color-zinc-900)]"
2128
- ],
2129
- white: "[--radio-checked-bg:var(--color-white)] [--radio-checked-border:var(--color-zinc-950)]/15 [--radio-checked-indicator:var(--color-zinc-900)]",
2130
- dark: "[--radio-checked-bg:var(--color-zinc-900)] [--radio-checked-border:var(--color-zinc-950)]/90 [--radio-checked-indicator:var(--color-white)]",
2131
- zinc: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-zinc-600)] [--radio-checked-border:var(--color-zinc-700)]/90",
2132
- red: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-red-600)] [--radio-checked-border:var(--color-red-700)]/90",
2133
- orange: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-orange-500)] [--radio-checked-border:var(--color-orange-600)]/90",
2134
- amber: "[--radio-checked-bg:var(--color-amber-400)] [--radio-checked-border:var(--color-amber-500)]/80 [--radio-checked-indicator:var(--color-amber-950)]",
2135
- yellow: "[--radio-checked-bg:var(--color-yellow-300)] [--radio-checked-border:var(--color-yellow-400)]/80 [--radio-checked-indicator:var(--color-yellow-950)]",
2136
- lime: "[--radio-checked-bg:var(--color-lime-300)] [--radio-checked-border:var(--color-lime-400)]/80 [--radio-checked-indicator:var(--color-lime-950)]",
2137
- green: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-green-600)] [--radio-checked-border:var(--color-green-700)]/90",
2138
- emerald: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-emerald-600)] [--radio-checked-border:var(--color-emerald-700)]/90",
2139
- teal: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-teal-600)] [--radio-checked-border:var(--color-teal-700)]/90",
2140
- cyan: "[--radio-checked-bg:var(--color-cyan-300)] [--radio-checked-border:var(--color-cyan-400)]/80 [--radio-checked-indicator:var(--color-cyan-950)]",
2141
- sky: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-sky-500)] [--radio-checked-border:var(--color-sky-600)]/80",
2142
- blue: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-blue-600)] [--radio-checked-border:var(--color-blue-700)]/90",
2143
- indigo: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-indigo-500)] [--radio-checked-border:var(--color-indigo-600)]/90",
2144
- violet: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-violet-500)] [--radio-checked-border:var(--color-violet-600)]/90",
2145
- purple: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-purple-500)] [--radio-checked-border:var(--color-purple-600)]/90",
2146
- fuchsia: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-fuchsia-500)] [--radio-checked-border:var(--color-fuchsia-600)]/90",
2147
- pink: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-pink-500)] [--radio-checked-border:var(--color-pink-600)]/90",
2148
- rose: "[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-rose-500)] [--radio-checked-border:var(--color-rose-600)]/90"
2149
- };
2150
- function Radio({
2151
- color = "dark/zinc",
2152
- className,
2153
- value,
2154
- disabled: localDisabled,
2155
- ...props
2156
- }) {
2157
- const group = useRadioGroupContext();
2158
- const disabled = localDisabled || group.disabled;
2159
- const checked = group.value === value;
2160
- const interactiveProps = useDataInteractive({ disabled });
2161
- const handleClick = useCallback(() => {
2162
- if (!disabled) {
2163
- group.onChange(value);
2164
- }
2165
- }, [disabled, group, value]);
2166
- return /* @__PURE__ */ jsxs(
2167
- "span",
2168
- {
2169
- role: "radio",
2170
- "data-slot": "control",
2171
- "aria-checked": checked,
2172
- "data-checked": checked ? "" : void 0,
2173
- "data-disabled": disabled ? "" : void 0,
2174
- "data-value": value,
2175
- tabIndex: checked ? 0 : -1,
2176
- onClick: handleClick,
2177
- ...interactiveProps,
2178
- ...props,
2179
- className: clsx(className, "group inline-flex focus:outline-hidden"),
2180
- children: [
2181
- group.name && checked && /* @__PURE__ */ jsx("input", { type: "hidden", name: group.name, value }),
2182
- /* @__PURE__ */ jsx("span", { className: clsx([base, radioColors[color]]), children: /* @__PURE__ */ jsx(
2183
- "span",
2184
- {
2185
- className: clsx(
2186
- "size-full rounded-full border-[4.5px] border-transparent bg-(--radio-indicator) bg-clip-padding",
2187
- // Forced colors mode
2188
- "forced-colors:border-[Canvas] forced-colors:group-data-checked:border-[Highlight]"
2189
- )
2190
- }
2191
- ) })
2192
- ]
2193
- }
2194
- );
2195
- }
2196
- const CloseContext = createContext(null);
2197
- function useCloseContext() {
2198
- return useContext(CloseContext);
2199
- }
2200
- function Sidebar({ className, ...props }) {
2201
- return /* @__PURE__ */ jsx("nav", { ...props, className: clsx(className, "flex h-full min-h-0 flex-col") });
2202
- }
2203
- function SidebarHeader({ className, ...props }) {
2204
- return /* @__PURE__ */ jsx(
2205
- "div",
2206
- {
2207
- ...props,
2208
- className: clsx(
2209
- className,
2210
- "flex flex-col border-b border-zinc-950/5 p-4 dark:border-white/5 [&>[data-slot=section]+[data-slot=section]]:mt-2.5"
2211
- )
2212
- }
2213
- );
2214
- }
2215
- function SidebarBody({ className, ...props }) {
2216
- return /* @__PURE__ */ jsx(
2217
- "div",
2218
- {
2219
- ...props,
2220
- className: clsx(
2221
- className,
2222
- "flex flex-1 flex-col overflow-y-auto p-4 [&>[data-slot=section]+[data-slot=section]]:mt-8"
2223
- )
2224
- }
2225
- );
2226
- }
2227
- function SidebarFooter({ className, ...props }) {
2228
- return /* @__PURE__ */ jsx(
2229
- "div",
2230
- {
2231
- ...props,
2232
- className: clsx(
2233
- className,
2234
- "flex flex-col border-t border-zinc-950/5 p-4 dark:border-white/5 [&>[data-slot=section]+[data-slot=section]]:mt-2.5"
2235
- )
2236
- }
2237
- );
2238
- }
2239
- function SidebarSection({ className, ...props }) {
2240
- const id = useId();
2241
- return /* @__PURE__ */ jsx(LayoutGroup, { id, children: /* @__PURE__ */ jsx("div", { ...props, "data-slot": "section", className: clsx(className, "flex flex-col gap-0.5") }) });
2242
- }
2243
- function SidebarDivider({ className, ...props }) {
2244
- return /* @__PURE__ */ jsx(
2245
- "hr",
2246
- {
2247
- ...props,
2248
- className: clsx(className, "my-4 border-t border-zinc-950/5 lg:-mx-4 dark:border-white/5")
2249
- }
2250
- );
2251
- }
2252
- function SidebarSpacer({ className, ...props }) {
2253
- return /* @__PURE__ */ jsx("div", { "aria-hidden": "true", ...props, className: clsx(className, "mt-8 flex-1") });
2254
- }
2255
- function SidebarHeading({ className, ...props }) {
2256
- return /* @__PURE__ */ jsx(
2257
- "h3",
2258
- {
2259
- ...props,
2260
- className: clsx(
2261
- className,
2262
- "mb-1 px-2 text-xs/6 font-medium text-zinc-500 dark:text-zinc-400"
2263
- )
2264
- }
2265
- );
2266
- }
2267
- const SidebarItem = forwardRef(function SidebarItem2({
2268
- current,
2269
- className,
2270
- children,
2271
- ...props
2272
- }, ref) {
2273
- const disabled = "disabled" in props ? props.disabled : false;
2274
- const interactiveProps = useDataInteractive({ disabled: disabled ?? false });
2275
- const closeFn = useCloseContext();
2276
- const propsOnClick = "onClick" in props ? props.onClick : void 0;
2277
- const handleLinkClick = useCallback(
2278
- (e2) => {
2279
- propsOnClick?.(e2);
2280
- closeFn?.();
2281
- },
2282
- [propsOnClick, closeFn]
2283
- );
2284
- const classes = clsx(
2285
- // Base
2286
- "flex w-full items-center gap-3 rounded-lg px-2 py-2.5 text-left text-base/6 font-medium text-zinc-950 sm:py-2 sm:text-sm/5",
2287
- // Leading icon/icon-only
2288
- "*:data-[slot=icon]:size-6 *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:fill-zinc-500 sm:*:data-[slot=icon]:size-5",
2289
- // Trailing icon (down chevron or similar)
2290
- "*:last:data-[slot=icon]:ml-auto *:last:data-[slot=icon]:size-5 sm:*:last:data-[slot=icon]:size-4",
2291
- // Avatar
2292
- "*:data-[slot=avatar]:-m-0.5 *:data-[slot=avatar]:size-7 sm:*:data-[slot=avatar]:size-6",
2293
- // Hover
2294
- "data-hover:bg-zinc-950/5 data-hover:*:data-[slot=icon]:fill-zinc-950",
2295
- // Active
2296
- "data-active:bg-zinc-950/5 data-active:*:data-[slot=icon]:fill-zinc-950",
2297
- // Current
2298
- "data-current:*:data-[slot=icon]:fill-zinc-950",
2299
- // Dark mode
2300
- "dark:text-white dark:*:data-[slot=icon]:fill-zinc-400",
2301
- "dark:data-hover:bg-white/5 dark:data-hover:*:data-[slot=icon]:fill-white",
2302
- "dark:data-active:bg-white/5 dark:data-active:*:data-[slot=icon]:fill-white",
2303
- "dark:data-current:*:data-[slot=icon]:fill-white"
2304
- );
2305
- return /* @__PURE__ */ jsxs("span", { className: clsx(className, "relative"), children: [
2306
- current && /* @__PURE__ */ jsx(
2307
- LayoutIndicator,
2308
- {
2309
- layoutId: "current-indicator",
2310
- className: "absolute inset-y-2 -left-4 w-0.5 rounded-full bg-zinc-950 dark:bg-white"
2311
- }
2312
- ),
2313
- typeof props.href === "string" ? /* @__PURE__ */ jsx(
2314
- Link,
2315
- {
2316
- ...props,
2317
- className: classes,
2318
- "data-current": current ? "true" : void 0,
2319
- ref,
2320
- onClick: handleLinkClick,
2321
- children: /* @__PURE__ */ jsx(TouchTarget, { children })
2322
- }
2323
- ) : /* @__PURE__ */ jsx(
2324
- "button",
2325
- {
2326
- type: "button",
2327
- ...props,
2328
- ...interactiveProps,
2329
- className: clsx("cursor-default", classes),
2330
- "data-current": current ? "true" : void 0,
2331
- ref,
2332
- children: /* @__PURE__ */ jsx(TouchTarget, { children })
2333
- }
2334
- )
2335
- ] });
9
+ return /* @__PURE__ */ jsx(`h${level}`, {
10
+ ...props,
11
+ className: clsx(className, "text-2xl/8 font-semibold text-zinc-950 sm:text-xl/8 dark:text-white")
12
+ });
13
+ }
14
+ //#endregion
15
+ //#region src/components/table.tsx
16
+ var TableContext = createContext({
17
+ bleed: false,
18
+ dense: false,
19
+ grid: false,
20
+ striped: false
2336
21
  });
2337
- function SidebarLabel({ className, ...props }) {
2338
- return /* @__PURE__ */ jsx("span", { ...props, className: clsx(className, "truncate") });
2339
- }
2340
- function OpenMenuIcon$1() {
2341
- return /* @__PURE__ */ jsx("svg", { "data-slot": "icon", viewBox: "0 0 20 20", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2 6.75C2 6.33579 2.33579 6 2.75 6H17.25C17.6642 6 18 6.33579 18 6.75C18 7.16421 17.6642 7.5 17.25 7.5H2.75C2.33579 7.5 2 7.16421 2 6.75ZM2 13.25C2 12.8358 2.33579 12.5 2.75 12.5H17.25C17.6642 12.5 18 12.8358 18 13.25C18 13.6642 17.6642 14 17.25 14H2.75C2.33579 14 2 13.6642 2 13.25Z" }) });
2342
- }
2343
- function CloseMenuIcon$1() {
2344
- return /* @__PURE__ */ jsx("svg", { "data-slot": "icon", viewBox: "0 0 20 20", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" }) });
2345
- }
2346
- function MobileSidebar$1({
2347
- open,
2348
- close,
2349
- children
2350
- }) {
2351
- const panelRef = useRef(null);
2352
- const backdrop = useTransition(open);
2353
- const panel = useTransition(open);
2354
- useScrollLock(open);
2355
- useFocusTrap(panelRef, open);
2356
- useEscapeKey(close, open);
2357
- const handleBackdropClick = useCallback(
2358
- (e2) => {
2359
- if (e2.target === e2.currentTarget) {
2360
- close();
2361
- }
2362
- },
2363
- [close]
2364
- );
2365
- if (!(backdrop.mounted || panel.mounted)) return null;
2366
- return createPortal(
2367
- /* @__PURE__ */ jsx(CloseContext.Provider, { value: close, children: /* @__PURE__ */ jsxs("div", { role: "dialog", "aria-modal": "true", className: "lg:hidden", children: [
2368
- backdrop.mounted && /* @__PURE__ */ jsx(
2369
- "div",
2370
- {
2371
- ref: backdrop.nodeRef,
2372
- ...backdrop.transitionProps,
2373
- onClick: handleBackdropClick,
2374
- className: "fixed inset-0 bg-black/30 transition data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in"
2375
- }
2376
- ),
2377
- panel.mounted && /* @__PURE__ */ jsx(
2378
- "div",
2379
- {
2380
- ref: (node) => {
2381
- panelRef.current = node;
2382
- panel.nodeRef.current = node;
2383
- },
2384
- ...panel.transitionProps,
2385
- className: "fixed inset-y-0 w-full max-w-80 p-2 transition duration-300 ease-in-out data-closed:-translate-x-full",
2386
- children: /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col rounded-lg bg-white shadow-xs ring-1 ring-zinc-950/5 dark:bg-zinc-900 dark:ring-white/10", children: [
2387
- /* @__PURE__ */ jsx("div", { className: "-mb-3 px-4 pt-3", children: /* @__PURE__ */ jsx(NavbarItem, { onClick: close, "aria-label": "Close navigation", children: /* @__PURE__ */ jsx(CloseMenuIcon$1, {}) }) }),
2388
- children
2389
- ] })
2390
- }
2391
- )
2392
- ] }) }),
2393
- document.body
2394
- );
2395
- }
2396
- function SidebarLayout({
2397
- navbar,
2398
- sidebar,
2399
- children
2400
- }) {
2401
- const [showSidebar, setShowSidebar] = useState(false);
2402
- return /* @__PURE__ */ jsxs("div", { className: "relative isolate flex min-h-svh w-full bg-white max-lg:flex-col lg:bg-zinc-100 dark:bg-zinc-900 dark:lg:bg-zinc-950", children: [
2403
- /* @__PURE__ */ jsx("div", { className: "fixed inset-y-0 left-0 w-64 max-lg:hidden", children: sidebar }),
2404
- /* @__PURE__ */ jsx(MobileSidebar$1, { open: showSidebar, close: () => setShowSidebar(false), children: sidebar }),
2405
- /* @__PURE__ */ jsxs("header", { className: "flex items-center px-4 lg:hidden", children: [
2406
- /* @__PURE__ */ jsx("div", { className: "py-2.5", children: /* @__PURE__ */ jsx(NavbarItem, { onClick: () => setShowSidebar(true), "aria-label": "Open navigation", children: /* @__PURE__ */ jsx(OpenMenuIcon$1, {}) }) }),
2407
- /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: navbar })
2408
- ] }),
2409
- /* @__PURE__ */ jsx("main", { className: "flex flex-1 flex-col pb-2 lg:min-w-0 lg:pt-2 lg:pr-2 lg:pl-64", children: /* @__PURE__ */ jsx("div", { className: "grow p-6 lg:rounded-lg lg:bg-white lg:p-10 lg:shadow-xs lg:ring-1 lg:ring-zinc-950/5 dark:lg:bg-zinc-900 dark:lg:ring-white/10", children: /* @__PURE__ */ jsx("div", { className: "mx-auto max-w-6xl", children }) }) })
2410
- ] });
2411
- }
2412
- function OpenMenuIcon() {
2413
- return /* @__PURE__ */ jsx("svg", { "data-slot": "icon", viewBox: "0 0 20 20", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2 6.75C2 6.33579 2.33579 6 2.75 6H17.25C17.6642 6 18 6.33579 18 6.75C18 7.16421 17.6642 7.5 17.25 7.5H2.75C2.33579 7.5 2 7.16421 2 6.75ZM2 13.25C2 12.8358 2.33579 12.5 2.75 12.5H17.25C17.6642 12.5 18 12.8358 18 13.25C18 13.6642 17.6642 14 17.25 14H2.75C2.33579 14 2 13.6642 2 13.25Z" }) });
2414
- }
2415
- function CloseMenuIcon() {
2416
- return /* @__PURE__ */ jsx("svg", { "data-slot": "icon", viewBox: "0 0 20 20", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" }) });
2417
- }
2418
- function MobileSidebar({
2419
- open,
2420
- close,
2421
- children
2422
- }) {
2423
- const panelRef = useRef(null);
2424
- const backdrop = useTransition(open);
2425
- const panel = useTransition(open);
2426
- useScrollLock(open);
2427
- useFocusTrap(panelRef, open);
2428
- useEscapeKey(close, open);
2429
- const handleBackdropClick = useCallback(
2430
- (e2) => {
2431
- if (e2.target === e2.currentTarget) {
2432
- close();
2433
- }
2434
- },
2435
- [close]
2436
- );
2437
- if (!(backdrop.mounted || panel.mounted)) return null;
2438
- return createPortal(
2439
- /* @__PURE__ */ jsx(CloseContext.Provider, { value: close, children: /* @__PURE__ */ jsxs("div", { role: "dialog", "aria-modal": "true", className: "lg:hidden", children: [
2440
- backdrop.mounted && /* @__PURE__ */ jsx(
2441
- "div",
2442
- {
2443
- ref: backdrop.nodeRef,
2444
- ...backdrop.transitionProps,
2445
- onClick: handleBackdropClick,
2446
- className: "fixed inset-0 bg-black/30 transition data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in"
2447
- }
2448
- ),
2449
- panel.mounted && /* @__PURE__ */ jsx(
2450
- "div",
2451
- {
2452
- ref: (node) => {
2453
- panelRef.current = node;
2454
- panel.nodeRef.current = node;
2455
- },
2456
- ...panel.transitionProps,
2457
- className: "fixed inset-y-0 w-full max-w-80 p-2 transition duration-300 ease-in-out data-closed:-translate-x-full",
2458
- children: /* @__PURE__ */ jsxs("div", { className: "flex h-full flex-col rounded-lg bg-white shadow-xs ring-1 ring-zinc-950/5 dark:bg-zinc-900 dark:ring-white/10", children: [
2459
- /* @__PURE__ */ jsx("div", { className: "-mb-3 px-4 pt-3", children: /* @__PURE__ */ jsx(NavbarItem, { onClick: close, "aria-label": "Close navigation", children: /* @__PURE__ */ jsx(CloseMenuIcon, {}) }) }),
2460
- children
2461
- ] })
2462
- }
2463
- )
2464
- ] }) }),
2465
- document.body
2466
- );
2467
- }
2468
- function StackedLayout({
2469
- navbar,
2470
- sidebar,
2471
- children
2472
- }) {
2473
- const [showSidebar, setShowSidebar] = useState(false);
2474
- return /* @__PURE__ */ jsxs("div", { className: "relative isolate flex min-h-svh w-full flex-col bg-white lg:bg-zinc-100 dark:bg-zinc-900 dark:lg:bg-zinc-950", children: [
2475
- /* @__PURE__ */ jsx(MobileSidebar, { open: showSidebar, close: () => setShowSidebar(false), children: sidebar }),
2476
- /* @__PURE__ */ jsxs("header", { className: "flex items-center px-4", children: [
2477
- /* @__PURE__ */ jsx("div", { className: "py-2.5 lg:hidden", children: /* @__PURE__ */ jsx(NavbarItem, { onClick: () => setShowSidebar(true), "aria-label": "Open navigation", children: /* @__PURE__ */ jsx(OpenMenuIcon, {}) }) }),
2478
- /* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: navbar })
2479
- ] }),
2480
- /* @__PURE__ */ jsx("main", { className: "flex flex-1 flex-col pb-2 lg:px-2", children: /* @__PURE__ */ jsx("div", { className: "grow p-6 lg:rounded-lg lg:bg-white lg:p-10 lg:shadow-xs lg:ring-1 lg:ring-zinc-950/5 dark:lg:bg-zinc-900 dark:lg:ring-white/10", children: /* @__PURE__ */ jsx("div", { className: "mx-auto max-w-6xl", children }) }) })
2481
- ] });
2482
- }
2483
- function SwitchGroup({ className, ...props }) {
2484
- return /* @__PURE__ */ jsx(
2485
- "div",
2486
- {
2487
- "data-slot": "control",
2488
- ...props,
2489
- className: clsx(
2490
- className,
2491
- // Basic groups
2492
- "space-y-3 **:data-[slot=label]:font-normal",
2493
- // With descriptions
2494
- "has-data-[slot=description]:space-y-6 has-data-[slot=description]:**:data-[slot=label]:font-medium"
2495
- )
2496
- }
2497
- );
2498
- }
2499
- function SwitchField({
2500
- className,
2501
- disabled,
2502
- ...props
2503
- }) {
2504
- return /* @__PURE__ */ jsx(FieldProvider, { disabled, children: /* @__PURE__ */ jsx(
2505
- "div",
2506
- {
2507
- "data-slot": "field",
2508
- "data-disabled": disabled ? "" : void 0,
2509
- ...props,
2510
- className: clsx(
2511
- className,
2512
- // Base layout
2513
- "grid grid-cols-[1fr_auto] gap-x-8 gap-y-1 sm:grid-cols-[1fr_auto]",
2514
- // Control layout
2515
- "*:data-[slot=control]:col-start-2 *:data-[slot=control]:self-start sm:*:data-[slot=control]:mt-0.5",
2516
- // Label layout
2517
- "*:data-[slot=label]:col-start-1 *:data-[slot=label]:row-start-1",
2518
- // Description layout
2519
- "*:data-[slot=description]:col-start-1 *:data-[slot=description]:row-start-2",
2520
- // With description
2521
- "has-data-[slot=description]:**:data-[slot=label]:font-medium"
2522
- )
2523
- }
2524
- ) });
2525
- }
2526
- const colors = {
2527
- "dark/zinc": [
2528
- "[--switch-bg-ring:var(--color-zinc-950)]/90 [--switch-bg:var(--color-zinc-900)] dark:[--switch-bg-ring:transparent] dark:[--switch-bg:var(--color-white)]/25",
2529
- "[--switch-ring:var(--color-zinc-950)]/90 [--switch-shadow:var(--color-black)]/10 [--switch:white] dark:[--switch-ring:var(--color-zinc-700)]/90"
2530
- ],
2531
- "dark/white": [
2532
- "[--switch-bg-ring:var(--color-zinc-950)]/90 [--switch-bg:var(--color-zinc-900)] dark:[--switch-bg-ring:transparent] dark:[--switch-bg:var(--color-white)]",
2533
- "[--switch-ring:var(--color-zinc-950)]/90 [--switch-shadow:var(--color-black)]/10 [--switch:white] dark:[--switch-ring:transparent] dark:[--switch:var(--color-zinc-900)]"
2534
- ],
2535
- dark: [
2536
- "[--switch-bg-ring:var(--color-zinc-950)]/90 [--switch-bg:var(--color-zinc-900)] dark:[--switch-bg-ring:var(--color-white)]/15",
2537
- "[--switch-ring:var(--color-zinc-950)]/90 [--switch-shadow:var(--color-black)]/10 [--switch:white]"
2538
- ],
2539
- zinc: [
2540
- "[--switch-bg-ring:var(--color-zinc-700)]/90 [--switch-bg:var(--color-zinc-600)] dark:[--switch-bg-ring:transparent]",
2541
- "[--switch-shadow:var(--color-black)]/10 [--switch:white] [--switch-ring:var(--color-zinc-700)]/90"
2542
- ],
2543
- white: [
2544
- "[--switch-bg-ring:var(--color-black)]/15 [--switch-bg:white] dark:[--switch-bg-ring:transparent]",
2545
- "[--switch-shadow:var(--color-black)]/10 [--switch-ring:transparent] [--switch:var(--color-zinc-950)]"
2546
- ],
2547
- red: [
2548
- "[--switch-bg-ring:var(--color-red-700)]/90 [--switch-bg:var(--color-red-600)] dark:[--switch-bg-ring:transparent]",
2549
- "[--switch:white] [--switch-ring:var(--color-red-700)]/90 [--switch-shadow:var(--color-red-900)]/20"
2550
- ],
2551
- orange: [
2552
- "[--switch-bg-ring:var(--color-orange-600)]/90 [--switch-bg:var(--color-orange-500)] dark:[--switch-bg-ring:transparent]",
2553
- "[--switch:white] [--switch-ring:var(--color-orange-600)]/90 [--switch-shadow:var(--color-orange-900)]/20"
2554
- ],
2555
- amber: [
2556
- "[--switch-bg-ring:var(--color-amber-500)]/80 [--switch-bg:var(--color-amber-400)] dark:[--switch-bg-ring:transparent]",
2557
- "[--switch-ring:transparent] [--switch-shadow:transparent] [--switch:var(--color-amber-950)]"
2558
- ],
2559
- yellow: [
2560
- "[--switch-bg-ring:var(--color-yellow-400)]/80 [--switch-bg:var(--color-yellow-300)] dark:[--switch-bg-ring:transparent]",
2561
- "[--switch-ring:transparent] [--switch-shadow:transparent] [--switch:var(--color-yellow-950)]"
2562
- ],
2563
- lime: [
2564
- "[--switch-bg-ring:var(--color-lime-400)]/80 [--switch-bg:var(--color-lime-300)] dark:[--switch-bg-ring:transparent]",
2565
- "[--switch-ring:transparent] [--switch-shadow:transparent] [--switch:var(--color-lime-950)]"
2566
- ],
2567
- green: [
2568
- "[--switch-bg-ring:var(--color-green-700)]/90 [--switch-bg:var(--color-green-600)] dark:[--switch-bg-ring:transparent]",
2569
- "[--switch:white] [--switch-ring:var(--color-green-700)]/90 [--switch-shadow:var(--color-green-900)]/20"
2570
- ],
2571
- emerald: [
2572
- "[--switch-bg-ring:var(--color-emerald-600)]/90 [--switch-bg:var(--color-emerald-500)] dark:[--switch-bg-ring:transparent]",
2573
- "[--switch:white] [--switch-ring:var(--color-emerald-600)]/90 [--switch-shadow:var(--color-emerald-900)]/20"
2574
- ],
2575
- teal: [
2576
- "[--switch-bg-ring:var(--color-teal-700)]/90 [--switch-bg:var(--color-teal-600)] dark:[--switch-bg-ring:transparent]",
2577
- "[--switch:white] [--switch-ring:var(--color-teal-700)]/90 [--switch-shadow:var(--color-teal-900)]/20"
2578
- ],
2579
- cyan: [
2580
- "[--switch-bg-ring:var(--color-cyan-400)]/80 [--switch-bg:var(--color-cyan-300)] dark:[--switch-bg-ring:transparent]",
2581
- "[--switch-ring:transparent] [--switch-shadow:transparent] [--switch:var(--color-cyan-950)]"
2582
- ],
2583
- sky: [
2584
- "[--switch-bg-ring:var(--color-sky-600)]/80 [--switch-bg:var(--color-sky-500)] dark:[--switch-bg-ring:transparent]",
2585
- "[--switch:white] [--switch-ring:var(--color-sky-600)]/80 [--switch-shadow:var(--color-sky-900)]/20"
2586
- ],
2587
- blue: [
2588
- "[--switch-bg-ring:var(--color-blue-700)]/90 [--switch-bg:var(--color-blue-600)] dark:[--switch-bg-ring:transparent]",
2589
- "[--switch:white] [--switch-ring:var(--color-blue-700)]/90 [--switch-shadow:var(--color-blue-900)]/20"
2590
- ],
2591
- indigo: [
2592
- "[--switch-bg-ring:var(--color-indigo-600)]/90 [--switch-bg:var(--color-indigo-500)] dark:[--switch-bg-ring:transparent]",
2593
- "[--switch:white] [--switch-ring:var(--color-indigo-600)]/90 [--switch-shadow:var(--color-indigo-900)]/20"
2594
- ],
2595
- violet: [
2596
- "[--switch-bg-ring:var(--color-violet-600)]/90 [--switch-bg:var(--color-violet-500)] dark:[--switch-bg-ring:transparent]",
2597
- "[--switch:white] [--switch-ring:var(--color-violet-600)]/90 [--switch-shadow:var(--color-violet-900)]/20"
2598
- ],
2599
- purple: [
2600
- "[--switch-bg-ring:var(--color-purple-600)]/90 [--switch-bg:var(--color-purple-500)] dark:[--switch-bg-ring:transparent]",
2601
- "[--switch:white] [--switch-ring:var(--color-purple-600)]/90 [--switch-shadow:var(--color-purple-900)]/20"
2602
- ],
2603
- fuchsia: [
2604
- "[--switch-bg-ring:var(--color-fuchsia-600)]/90 [--switch-bg:var(--color-fuchsia-500)] dark:[--switch-bg-ring:transparent]",
2605
- "[--switch:white] [--switch-ring:var(--color-fuchsia-600)]/90 [--switch-shadow:var(--color-fuchsia-900)]/20"
2606
- ],
2607
- pink: [
2608
- "[--switch-bg-ring:var(--color-pink-600)]/90 [--switch-bg:var(--color-pink-500)] dark:[--switch-bg-ring:transparent]",
2609
- "[--switch:white] [--switch-ring:var(--color-pink-600)]/90 [--switch-shadow:var(--color-pink-900)]/20"
2610
- ],
2611
- rose: [
2612
- "[--switch-bg-ring:var(--color-rose-600)]/90 [--switch-bg:var(--color-rose-500)] dark:[--switch-bg-ring:transparent]",
2613
- "[--switch:white] [--switch-ring:var(--color-rose-600)]/90 [--switch-shadow:var(--color-rose-900)]/20"
2614
- ]
2615
- };
2616
- function Switch({
2617
- color = "dark/zinc",
2618
- className,
2619
- checked: controlledChecked,
2620
- defaultChecked,
2621
- onChange,
2622
- disabled,
2623
- name,
2624
- value,
2625
- ...props
2626
- }) {
2627
- const { checked, toggleProps } = useToggle({
2628
- checked: controlledChecked,
2629
- defaultChecked,
2630
- onChange,
2631
- disabled
2632
- });
2633
- const interactiveProps = useDataInteractive({ disabled });
2634
- return /* @__PURE__ */ jsxs(
2635
- "button",
2636
- {
2637
- type: "button",
2638
- role: "switch",
2639
- "data-slot": "control",
2640
- "aria-checked": checked,
2641
- "data-checked": checked ? "" : void 0,
2642
- "data-disabled": disabled ? "" : void 0,
2643
- disabled,
2644
- onClick: toggleProps.onClick,
2645
- onKeyDown: toggleProps.onKeyDown,
2646
- ...interactiveProps,
2647
- ...props,
2648
- className: clsx(
2649
- className,
2650
- // Base styles
2651
- "group relative isolate inline-flex h-6 w-10 cursor-default rounded-full p-[3px] sm:h-5 sm:w-8",
2652
- // Transitions
2653
- "transition duration-0 ease-in-out data-changing:duration-200",
2654
- // Outline and background color in forced-colors mode so switch is still visible
2655
- "forced-colors:outline forced-colors:[--switch-bg:Highlight] dark:forced-colors:[--switch-bg:Highlight]",
2656
- // Unchecked
2657
- "bg-zinc-200 ring-1 ring-black/5 ring-inset dark:bg-white/5 dark:ring-white/15",
2658
- // Checked
2659
- "data-checked:bg-(--switch-bg) data-checked:ring-(--switch-bg-ring) dark:data-checked:bg-(--switch-bg) dark:data-checked:ring-(--switch-bg-ring)",
2660
- // Focus
2661
- "focus:not-data-focus:outline-hidden data-focus:outline-2 data-focus:outline-offset-2 data-focus:outline-blue-500",
2662
- // Hover
2663
- "data-hover:ring-black/15 data-hover:data-checked:ring-(--switch-bg-ring)",
2664
- "dark:data-hover:ring-white/25 dark:data-hover:data-checked:ring-(--switch-bg-ring)",
2665
- // Disabled
2666
- "data-disabled:bg-zinc-200 data-disabled:opacity-50 data-disabled:data-checked:bg-zinc-200 data-disabled:data-checked:ring-black/5",
2667
- "dark:data-disabled:bg-white/15 dark:data-disabled:data-checked:bg-white/15 dark:data-disabled:data-checked:ring-white/15",
2668
- // Color specific styles
2669
- colors[color]
2670
- ),
2671
- children: [
2672
- name && /* @__PURE__ */ jsx("input", { type: "hidden", name, value: checked ? value ?? "on" : "" }),
2673
- /* @__PURE__ */ jsx(
2674
- "span",
2675
- {
2676
- "aria-hidden": "true",
2677
- className: clsx(
2678
- // Basic layout
2679
- "pointer-events-none relative inline-block size-4.5 rounded-full sm:size-3.5",
2680
- // Transition
2681
- "translate-x-0 transition duration-200 ease-in-out",
2682
- // Invisible border so the switch is still visible in forced-colors mode
2683
- "border border-transparent",
2684
- // Unchecked
2685
- "bg-white shadow-sm ring-1 ring-black/5",
2686
- // Checked
2687
- "group-data-checked:bg-(--switch) group-data-checked:shadow-(--switch-shadow) group-data-checked:ring-(--switch-ring)",
2688
- "group-data-checked:translate-x-4 sm:group-data-checked:translate-x-3",
2689
- // Disabled
2690
- "group-data-checked:group-data-disabled:bg-white group-data-checked:group-data-disabled:shadow-sm group-data-checked:group-data-disabled:ring-black/5"
2691
- )
2692
- }
2693
- )
2694
- ]
2695
- }
2696
- );
2697
- }
2698
- const TableContext = createContext({
2699
- bleed: false,
2700
- dense: false,
2701
- grid: false,
2702
- striped: false
2703
- });
2704
- function Table({
2705
- bleed = false,
2706
- dense = false,
2707
- grid = false,
2708
- striped = false,
2709
- className,
2710
- children,
2711
- ...props
2712
- }) {
2713
- return /* @__PURE__ */ jsx(
2714
- TableContext.Provider,
2715
- {
2716
- value: { bleed, dense, grid, striped },
2717
- children: /* @__PURE__ */ jsx("div", { className: "flow-root", children: /* @__PURE__ */ jsx(
2718
- "div",
2719
- {
2720
- ...props,
2721
- className: clsx(className, "-mx-(--gutter) overflow-x-auto whitespace-nowrap"),
2722
- children: /* @__PURE__ */ jsx(
2723
- "div",
2724
- {
2725
- className: clsx("inline-block min-w-full align-middle", !bleed && "sm:px-(--gutter)"),
2726
- children: /* @__PURE__ */ jsx("table", { className: "min-w-full text-left text-sm/6 text-zinc-950 dark:text-white", children })
2727
- }
2728
- )
2729
- }
2730
- ) })
2731
- }
2732
- );
22
+ function Table({ bleed = false, dense = false, grid = false, striped = false, className, children, ...props }) {
23
+ return /* @__PURE__ */ jsx(TableContext.Provider, {
24
+ value: {
25
+ bleed,
26
+ dense,
27
+ grid,
28
+ striped
29
+ },
30
+ children: /* @__PURE__ */ jsx("div", {
31
+ className: "flow-root",
32
+ children: /* @__PURE__ */ jsx("div", {
33
+ ...props,
34
+ className: clsx(className, "-mx-(--gutter) overflow-x-auto whitespace-nowrap"),
35
+ children: /* @__PURE__ */ jsx("div", {
36
+ className: clsx("inline-block min-w-full align-middle", !bleed && "sm:px-(--gutter)"),
37
+ children: /* @__PURE__ */ jsx("table", {
38
+ className: "min-w-full text-left text-sm/6 text-zinc-950 dark:text-white",
39
+ children
40
+ })
41
+ })
42
+ })
43
+ })
44
+ });
2733
45
  }
2734
46
  function TableHead({ className, ...props }) {
2735
- return /* @__PURE__ */ jsx("thead", { ...props, className: clsx(className, "text-zinc-500 dark:text-zinc-400") });
47
+ return /* @__PURE__ */ jsx("thead", {
48
+ ...props,
49
+ className: clsx(className, "text-zinc-500 dark:text-zinc-400")
50
+ });
2736
51
  }
2737
52
  function TableBody(props) {
2738
- return /* @__PURE__ */ jsx("tbody", { ...props });
53
+ return /* @__PURE__ */ jsx("tbody", { ...props });
2739
54
  }
2740
- const TableRowContext = createContext({
2741
- href: void 0,
2742
- target: void 0,
2743
- title: void 0
55
+ var TableRowContext = createContext({
56
+ href: void 0,
57
+ target: void 0,
58
+ title: void 0
2744
59
  });
2745
- function TableRow({
2746
- href,
2747
- target,
2748
- title,
2749
- className,
2750
- ...props
2751
- }) {
2752
- const { striped } = useContext(TableContext);
2753
- return /* @__PURE__ */ jsx(
2754
- TableRowContext.Provider,
2755
- {
2756
- value: { href, target, title },
2757
- children: /* @__PURE__ */ jsx(
2758
- "tr",
2759
- {
2760
- ...props,
2761
- className: clsx(
2762
- className,
2763
- href && "has-[[data-row-link][data-focus]]:outline-2 has-[[data-row-link][data-focus]]:-outline-offset-2 has-[[data-row-link][data-focus]]:outline-blue-500 dark:focus-within:bg-white/2.5",
2764
- striped && "even:bg-zinc-950/2.5 dark:even:bg-white/2.5",
2765
- href && striped && "hover:bg-zinc-950/5 dark:hover:bg-white/5",
2766
- href && !striped && "hover:bg-zinc-950/2.5 dark:hover:bg-white/2.5"
2767
- )
2768
- }
2769
- )
2770
- }
2771
- );
60
+ function TableRow({ href, target, title, className, ...props }) {
61
+ const { striped } = use(TableContext);
62
+ return /* @__PURE__ */ jsx(TableRowContext.Provider, {
63
+ value: {
64
+ href,
65
+ target,
66
+ title
67
+ },
68
+ children: /* @__PURE__ */ jsx("tr", {
69
+ ...props,
70
+ className: clsx(className, href && "has-[[data-row-link][data-focus]]:outline-2 has-[[data-row-link][data-focus]]:-outline-offset-2 has-[[data-row-link][data-focus]]:outline-blue-500 dark:focus-within:bg-white/2.5", striped && "even:bg-zinc-950/2.5 dark:even:bg-white/2.5", href && striped && "hover:bg-zinc-950/5 dark:hover:bg-white/5", href && !striped && "hover:bg-zinc-950/2.5 dark:hover:bg-white/2.5")
71
+ })
72
+ });
2772
73
  }
2773
74
  function TableHeader({ className, ...props }) {
2774
- const { bleed, grid } = useContext(TableContext);
2775
- return /* @__PURE__ */ jsx(
2776
- "th",
2777
- {
2778
- ...props,
2779
- className: clsx(
2780
- className,
2781
- "border-b border-b-zinc-950/10 px-4 py-2 font-medium first:pl-(--gutter,--spacing(2)) last:pr-(--gutter,--spacing(2)) dark:border-b-white/10",
2782
- grid && "border-l border-l-zinc-950/5 first:border-l-0 dark:border-l-white/5",
2783
- !bleed && "sm:first:pl-1 sm:last:pr-1"
2784
- )
2785
- }
2786
- );
75
+ const { bleed, grid } = use(TableContext);
76
+ return /* @__PURE__ */ jsx("th", {
77
+ ...props,
78
+ className: clsx(className, "border-b border-b-zinc-950/10 px-4 py-2 font-medium first:pl-(--gutter,--spacing(2)) last:pr-(--gutter,--spacing(2)) dark:border-b-white/10", grid && "border-l border-l-zinc-950/5 first:border-l-0 dark:border-l-white/5", !bleed && "sm:first:pl-1 sm:last:pr-1")
79
+ });
2787
80
  }
2788
81
  function TableCell({ className, children, ...props }) {
2789
- const { bleed, dense, grid, striped } = useContext(TableContext);
2790
- const { href, target, title } = useContext(TableRowContext);
2791
- const [cellRef, setCellRef] = useState(null);
2792
- return /* @__PURE__ */ jsxs(
2793
- "td",
2794
- {
2795
- ref: href ? setCellRef : void 0,
2796
- ...props,
2797
- className: clsx(
2798
- className,
2799
- "relative px-4 first:pl-(--gutter,--spacing(2)) last:pr-(--gutter,--spacing(2))",
2800
- !striped && "border-b border-zinc-950/5 dark:border-white/5",
2801
- grid && "border-l border-l-zinc-950/5 first:border-l-0 dark:border-l-white/5",
2802
- dense ? "py-2.5" : "py-4",
2803
- !bleed && "sm:first:pl-1 sm:last:pr-1"
2804
- ),
2805
- children: [
2806
- href && /* @__PURE__ */ jsx(
2807
- Link,
2808
- {
2809
- "data-row-link": true,
2810
- href,
2811
- target,
2812
- "aria-label": title,
2813
- tabIndex: cellRef?.previousElementSibling === null ? 0 : -1,
2814
- className: "absolute inset-0 focus:outline-hidden"
2815
- }
2816
- ),
2817
- children
2818
- ]
2819
- }
2820
- );
2821
- }
2822
- export {
2823
- A as Accordion,
2824
- a as AccordionItem,
2825
- Alert,
2826
- AlertActions,
2827
- AlertBody,
2828
- AlertDescription,
2829
- AlertTitle,
2830
- aa as Avatar,
2831
- b as AvatarGroup,
2832
- Badge,
2833
- B as Breadcrumb,
2834
- Button,
2835
- C as Callout,
2836
- d as Checkbox,
2837
- e as CheckboxCVA,
2838
- f as CheckboxField,
2839
- g as CheckboxGroup,
2840
- h as CheckboxIndicator,
2841
- i as CodeBlock,
2842
- Combobox,
2843
- ComboboxDescription,
2844
- ComboboxLabel,
2845
- ComboboxOption,
2846
- Description,
2847
- DescriptionDetails,
2848
- DescriptionList,
2849
- DescriptionTerm,
2850
- Dialog,
2851
- DialogActions,
2852
- DialogBody,
2853
- DialogDescription,
2854
- DialogTitle,
2855
- Divider,
2856
- D as Drawer,
2857
- j as DrawerBody,
2858
- k as DrawerFooter,
2859
- l as DrawerHeader,
2860
- Dropdown,
2861
- DropdownButton,
2862
- DropdownDescription,
2863
- DropdownDivider,
2864
- DropdownHeader,
2865
- DropdownHeading,
2866
- DropdownItem,
2867
- DropdownLabel,
2868
- DropdownMenu,
2869
- DropdownSection,
2870
- DropdownShortcut,
2871
- E as EmptyState,
2872
- ErrorMessage,
2873
- Field,
2874
- FieldGroup,
2875
- Fieldset,
2876
- Label as FieldsetLabel,
2877
- Heading,
2878
- I as Input,
2879
- m as InputGroup,
2880
- K as Kbd,
2881
- n as KbdShortcut,
2882
- Legend,
2883
- Link,
2884
- Listbox,
2885
- ListboxDescription,
2886
- ListboxLabel,
2887
- ListboxOption,
2888
- Navbar,
2889
- NavbarDivider,
2890
- NavbarItem,
2891
- NavbarLabel,
2892
- NavbarSection,
2893
- NavbarSpacer,
2894
- P as Progress,
2895
- Radio,
2896
- RadioField,
2897
- RadioGroup,
2898
- R as Rating,
2899
- S as Select,
2900
- o as SelectCVA,
2901
- p as SelectContent,
2902
- q as SelectGroup,
2903
- r as SelectItem,
2904
- s as SelectLabel,
2905
- t as SelectScrollDownButton,
2906
- u as SelectScrollUpButton,
2907
- v as SelectSeparator,
2908
- w as SelectTrigger,
2909
- x as SelectValue,
2910
- Sidebar,
2911
- SidebarBody,
2912
- SidebarDivider,
2913
- SidebarFooter,
2914
- SidebarHeader,
2915
- SidebarHeading,
2916
- SidebarItem,
2917
- SidebarLabel,
2918
- SidebarLayout,
2919
- SidebarSection,
2920
- SidebarSpacer,
2921
- y as Skeleton,
2922
- z as SkeletonCard,
2923
- F as SkeletonText,
2924
- G as Slider,
2925
- StackedLayout,
2926
- H as Stat,
2927
- J as StatGroup,
2928
- L as Stepper,
2929
- Switch,
2930
- SwitchField,
2931
- SwitchGroup,
2932
- T as Tab,
2933
- M as TabList,
2934
- N as TabPanel,
2935
- Table,
2936
- TableBody,
2937
- TableCell,
2938
- TableHead,
2939
- TableHeader,
2940
- TableRow,
2941
- O as Tabs,
2942
- Text,
2943
- Q as Textarea,
2944
- U as Timeline,
2945
- V as TimelineItem,
2946
- W as ToastProvider,
2947
- X as Tooltip,
2948
- TouchTarget,
2949
- Z as useToast
2950
- };
2951
- //# sourceMappingURL=client.js.map
82
+ const { bleed, dense, grid, striped } = use(TableContext);
83
+ const { href, target, title } = use(TableRowContext);
84
+ const [cellRef, setCellRef] = useState(null);
85
+ return /* @__PURE__ */ jsxs("td", {
86
+ ref: href ? setCellRef : void 0,
87
+ ...props,
88
+ className: clsx(className, "relative px-4 first:pl-(--gutter,--spacing(2)) last:pr-(--gutter,--spacing(2))", !striped && "border-b border-zinc-950/5 dark:border-white/5", grid && "border-l border-l-zinc-950/5 first:border-l-0 dark:border-l-white/5", dense ? "py-2.5" : "py-4", !bleed && "sm:first:pl-1 sm:last:pr-1"),
89
+ children: [href && /* @__PURE__ */ jsx(Link, {
90
+ "data-row-link": true,
91
+ href,
92
+ target,
93
+ "aria-label": title,
94
+ tabIndex: cellRef?.previousElementSibling === null ? 0 : -1,
95
+ className: "absolute inset-0 focus:outline-hidden"
96
+ }), children]
97
+ });
98
+ }
99
+ //#endregion
100
+ export { Accordion, AccordionItem, Alert, AlertActions, AlertBody, AlertDescription, AlertTitle, Avatar, AvatarGroup, Badge, Breadcrumb, Button, Callout, Checkbox, Checkbox$1 as CheckboxCVA, CheckboxField, CheckboxGroup, CheckboxIndicator, CodeBlock, Combobox, ComboboxDescription, ComboboxLabel, ComboboxOption, Description, DescriptionDetails, DescriptionList, DescriptionTerm, Dialog, DialogActions, DialogBody, DialogDescription, DialogTitle, Divider, Drawer, DrawerBody, DrawerFooter, DrawerHeader, Dropdown, DropdownButton, DropdownDescription, DropdownDivider, DropdownHeader, DropdownHeading, DropdownItem, DropdownLabel, DropdownMenu, DropdownSection, DropdownShortcut, EmptyState, ErrorMessage, Field, FieldGroup, Fieldset, Label as FieldsetLabel, Heading, Input, InputGroup, Kbd, KbdShortcut, Legend, Link, Listbox, ListboxDescription, ListboxLabel, ListboxOption, Navbar, NavbarDivider, NavbarItem, NavbarLabel, NavbarSection, NavbarSpacer, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PricingTable, Progress, Radio, RadioField, RadioGroup, Rating, Select, Select$1 as SelectCVA, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sidebar, SidebarBody, SidebarDivider, SidebarFooter, SidebarHeader, SidebarHeading, SidebarItem, SidebarLabel, SidebarLayout, SidebarSection, SidebarSpacer, Skeleton, SkeletonCard, SkeletonText, Slider, StackedLayout, Stat, StatGroup, Stepper, Switch, SwitchField, SwitchGroup, Tab, TabList, TabPanel, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Tabs, Text, Textarea, Timeline, TimelineItem, ToastProvider, Tooltip, TouchTarget, useToast };
101
+
102
+ //# sourceMappingURL=client.js.map