@wow-two-beta/ui 0.0.9 → 0.0.11
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.
- package/dist/chunk-52DFDWY3.js +678 -0
- package/dist/chunk-52DFDWY3.js.map +1 -0
- package/dist/{chunk-SBVWECJP.js → chunk-PFM3IQKM.js} +882 -6
- package/dist/chunk-PFM3IQKM.js.map +1 -0
- package/dist/{chunk-55Y2JOBV.js → chunk-VTLWHUMD.js} +3 -3
- package/dist/{chunk-55Y2JOBV.js.map → chunk-VTLWHUMD.js.map} +1 -1
- package/dist/{chunk-CZ6FQILQ.js → chunk-YANOG5YR.js} +21 -3
- package/dist/chunk-YANOG5YR.js.map +1 -0
- package/dist/{chunk-3KGYKBW6.js → chunk-ZTHJ5OTI.js} +3 -3
- package/dist/{chunk-3KGYKBW6.js.map → chunk-ZTHJ5OTI.js.map} +1 -1
- package/dist/display/index.js +2 -2
- package/dist/forms/_dateUtils.d.ts +36 -0
- package/dist/forms/_dateUtils.d.ts.map +1 -0
- package/dist/forms/calendar/Calendar.d.ts +21 -0
- package/dist/forms/calendar/Calendar.d.ts.map +1 -0
- package/dist/forms/calendar/index.d.ts +2 -0
- package/dist/forms/calendar/index.d.ts.map +1 -0
- package/dist/forms/dateField/DateField.d.ts +11 -0
- package/dist/forms/dateField/DateField.d.ts.map +1 -0
- package/dist/forms/dateField/index.d.ts +2 -0
- package/dist/forms/dateField/index.d.ts.map +1 -0
- package/dist/forms/datePicker/DatePicker.d.ts +17 -0
- package/dist/forms/datePicker/DatePicker.d.ts.map +1 -0
- package/dist/forms/datePicker/index.d.ts +2 -0
- package/dist/forms/datePicker/index.d.ts.map +1 -0
- package/dist/forms/dateRangePicker/DateRangePicker.d.ts +18 -0
- package/dist/forms/dateRangePicker/DateRangePicker.d.ts.map +1 -0
- package/dist/forms/dateRangePicker/index.d.ts +2 -0
- package/dist/forms/dateRangePicker/index.d.ts.map +1 -0
- package/dist/forms/index.d.ts +7 -0
- package/dist/forms/index.d.ts.map +1 -1
- package/dist/forms/index.js +2 -2
- package/dist/forms/rangeCalendar/RangeCalendar.d.ts +17 -0
- package/dist/forms/rangeCalendar/RangeCalendar.d.ts.map +1 -0
- package/dist/forms/rangeCalendar/index.d.ts +2 -0
- package/dist/forms/rangeCalendar/index.d.ts.map +1 -0
- package/dist/forms/timeField/TimeField.d.ts +13 -0
- package/dist/forms/timeField/TimeField.d.ts.map +1 -0
- package/dist/forms/timeField/index.d.ts +2 -0
- package/dist/forms/timeField/index.d.ts.map +1 -0
- package/dist/forms/timePicker/TimePicker.d.ts +16 -0
- package/dist/forms/timePicker/TimePicker.d.ts.map +1 -0
- package/dist/forms/timePicker/index.d.ts +2 -0
- package/dist/forms/timePicker/index.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/nav/index.js +2 -2
- package/dist/overlays/alertDialog/AlertDialog.d.ts +29 -0
- package/dist/overlays/alertDialog/AlertDialog.d.ts.map +1 -0
- package/dist/overlays/alertDialog/index.d.ts +2 -0
- package/dist/overlays/alertDialog/index.d.ts.map +1 -0
- package/dist/overlays/backdrop/Backdrop.d.ts +17 -0
- package/dist/overlays/backdrop/Backdrop.d.ts.map +1 -0
- package/dist/overlays/backdrop/index.d.ts +2 -0
- package/dist/overlays/backdrop/index.d.ts.map +1 -0
- package/dist/overlays/dialog/Dialog.d.ts +63 -0
- package/dist/overlays/dialog/Dialog.d.ts.map +1 -0
- package/dist/overlays/dialog/index.d.ts +2 -0
- package/dist/overlays/dialog/index.d.ts.map +1 -0
- package/dist/overlays/drawer/Drawer.d.ts +57 -0
- package/dist/overlays/drawer/Drawer.d.ts.map +1 -0
- package/dist/overlays/drawer/index.d.ts +2 -0
- package/dist/overlays/drawer/index.d.ts.map +1 -0
- package/dist/overlays/hoverCard/HoverCard.d.ts +37 -0
- package/dist/overlays/hoverCard/HoverCard.d.ts.map +1 -0
- package/dist/overlays/hoverCard/index.d.ts +2 -0
- package/dist/overlays/hoverCard/index.d.ts.map +1 -0
- package/dist/overlays/index.d.ts +7 -0
- package/dist/overlays/index.d.ts.map +1 -0
- package/dist/overlays/index.js +11 -0
- package/dist/overlays/index.js.map +1 -0
- package/dist/overlays/popover/Popover.d.ts +31 -0
- package/dist/overlays/popover/Popover.d.ts.map +1 -0
- package/dist/overlays/popover/index.d.ts +2 -0
- package/dist/overlays/popover/index.d.ts.map +1 -0
- package/dist/primitives/index.d.ts +1 -0
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +1 -1
- package/dist/primitives/overlayArrow/OverlayArrow.d.ts +19 -0
- package/dist/primitives/overlayArrow/OverlayArrow.d.ts.map +1 -0
- package/dist/primitives/overlayArrow/index.d.ts +2 -0
- package/dist/primitives/overlayArrow/index.d.ts.map +1 -0
- package/package.json +5 -1
- package/dist/chunk-CZ6FQILQ.js.map +0 -1
- package/dist/chunk-SBVWECJP.js.map +0 -1
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
import { Portal, ScrollLockProvider, DismissableLayer, AnchoredPositioner, OverlayArrow } from './chunk-YANOG5YR.js';
|
|
2
|
+
import { useControlled } from './chunk-4P2TFUVW.js';
|
|
3
|
+
import { Slot } from './chunk-33IOXQYO.js';
|
|
4
|
+
import { composeRefs } from './chunk-DN7WBRIV.js';
|
|
5
|
+
import { cn } from './chunk-KZ4VFY2T.js';
|
|
6
|
+
import { forwardRef, createContext, useContext, useRef, useId, useMemo, useCallback, isValidElement, cloneElement } from 'react';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
+
import { X } from 'lucide-react';
|
|
9
|
+
import { FocusScope } from '@radix-ui/react-focus-scope';
|
|
10
|
+
|
|
11
|
+
var Backdrop = forwardRef(function Backdrop2({ open = true, blur, pointerEvents = "auto", inline, className, style, ...rest }, ref) {
|
|
12
|
+
if (!open) return null;
|
|
13
|
+
const node = /* @__PURE__ */ jsx(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
ref,
|
|
17
|
+
"data-state": open ? "open" : "closed",
|
|
18
|
+
style: { pointerEvents, ...style },
|
|
19
|
+
className: cn(
|
|
20
|
+
"fixed inset-0 z-50 bg-black/50 animate-in fade-in-0",
|
|
21
|
+
blur && "backdrop-blur-sm",
|
|
22
|
+
className
|
|
23
|
+
),
|
|
24
|
+
...rest
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
return inline ? node : /* @__PURE__ */ jsx(Portal, { children: node });
|
|
28
|
+
});
|
|
29
|
+
var DialogContext = createContext(null);
|
|
30
|
+
function useDialogContext() {
|
|
31
|
+
const ctx = useContext(DialogContext);
|
|
32
|
+
if (!ctx) throw new Error("Dialog.* must be used inside <Dialog>");
|
|
33
|
+
return ctx;
|
|
34
|
+
}
|
|
35
|
+
function Dialog({
|
|
36
|
+
open: openProp,
|
|
37
|
+
defaultOpen = false,
|
|
38
|
+
onOpenChange,
|
|
39
|
+
dismissOnOutsideClick = true,
|
|
40
|
+
dismissOnEscape = true,
|
|
41
|
+
role = "dialog",
|
|
42
|
+
children
|
|
43
|
+
}) {
|
|
44
|
+
const [open, setOpen] = useControlled({
|
|
45
|
+
controlled: openProp,
|
|
46
|
+
default: defaultOpen,
|
|
47
|
+
onChange: onOpenChange
|
|
48
|
+
});
|
|
49
|
+
const triggerRef = useRef(null);
|
|
50
|
+
const titleId = useId();
|
|
51
|
+
const descriptionId = useId();
|
|
52
|
+
const ctx = useMemo(
|
|
53
|
+
() => ({
|
|
54
|
+
open,
|
|
55
|
+
setOpen,
|
|
56
|
+
triggerRef,
|
|
57
|
+
titleId,
|
|
58
|
+
descriptionId,
|
|
59
|
+
role,
|
|
60
|
+
dismissOnOutsideClick,
|
|
61
|
+
dismissOnEscape
|
|
62
|
+
}),
|
|
63
|
+
[open, setOpen, titleId, descriptionId, role, dismissOnOutsideClick, dismissOnEscape]
|
|
64
|
+
);
|
|
65
|
+
return /* @__PURE__ */ jsx(DialogContext.Provider, { value: ctx, children });
|
|
66
|
+
}
|
|
67
|
+
var DialogTrigger = forwardRef(
|
|
68
|
+
function DialogTrigger2({ asChild, onClick, children, ...rest }, forwardedRef) {
|
|
69
|
+
const ctx = useDialogContext();
|
|
70
|
+
const Component = asChild ? Slot : "button";
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
Component,
|
|
73
|
+
{
|
|
74
|
+
ref: composeRefs(forwardedRef, ctx.triggerRef),
|
|
75
|
+
type: "button",
|
|
76
|
+
"aria-haspopup": ctx.role === "alertdialog" ? "dialog" : "dialog",
|
|
77
|
+
"aria-expanded": ctx.open,
|
|
78
|
+
"data-state": ctx.open ? "open" : "closed",
|
|
79
|
+
onClick: (e) => {
|
|
80
|
+
onClick?.(e);
|
|
81
|
+
if (e.defaultPrevented) return;
|
|
82
|
+
ctx.setOpen(true);
|
|
83
|
+
},
|
|
84
|
+
...rest,
|
|
85
|
+
children
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
var DialogContent = forwardRef(
|
|
91
|
+
function DialogContent2({ hideBackdrop, blur, className, children, ...rest }, forwardedRef) {
|
|
92
|
+
const ctx = useDialogContext();
|
|
93
|
+
if (!ctx.open) return null;
|
|
94
|
+
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs(ScrollLockProvider, { children: [
|
|
95
|
+
!hideBackdrop && /* @__PURE__ */ jsx(
|
|
96
|
+
Backdrop,
|
|
97
|
+
{
|
|
98
|
+
inline: true,
|
|
99
|
+
blur,
|
|
100
|
+
onClick: () => {
|
|
101
|
+
if (ctx.dismissOnOutsideClick) ctx.setOpen(false);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-50 grid place-items-center overflow-y-auto p-4", children: /* @__PURE__ */ jsx(FocusScope, { asChild: true, trapped: true, loop: true, children: /* @__PURE__ */ jsx(
|
|
106
|
+
DismissableLayer,
|
|
107
|
+
{
|
|
108
|
+
disableEscape: !ctx.dismissOnEscape,
|
|
109
|
+
onEscape: () => ctx.setOpen(false),
|
|
110
|
+
disableOutsideClick: true,
|
|
111
|
+
children: /* @__PURE__ */ jsx(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
ref: forwardedRef,
|
|
115
|
+
role: ctx.role,
|
|
116
|
+
"aria-modal": "true",
|
|
117
|
+
"aria-labelledby": ctx.titleId,
|
|
118
|
+
"aria-describedby": ctx.descriptionId,
|
|
119
|
+
"data-state": "open",
|
|
120
|
+
className: cn(
|
|
121
|
+
"relative w-full max-w-lg rounded-lg border border-border bg-background p-6 shadow-lg outline-none animate-in fade-in-0 zoom-in-95",
|
|
122
|
+
className
|
|
123
|
+
),
|
|
124
|
+
...rest,
|
|
125
|
+
children
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
) }) })
|
|
130
|
+
] }) });
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
function DialogHeader({ className, children, ...rest }) {
|
|
134
|
+
return /* @__PURE__ */ jsx("div", { className: cn("mb-4 flex flex-col gap-1.5", className), ...rest, children });
|
|
135
|
+
}
|
|
136
|
+
function DialogTitle({ className, children, ...rest }) {
|
|
137
|
+
const ctx = useDialogContext();
|
|
138
|
+
return /* @__PURE__ */ jsx(
|
|
139
|
+
"h2",
|
|
140
|
+
{
|
|
141
|
+
id: ctx.titleId,
|
|
142
|
+
className: cn("text-lg font-semibold leading-none text-foreground", className),
|
|
143
|
+
...rest,
|
|
144
|
+
children
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
function DialogDescription({
|
|
149
|
+
className,
|
|
150
|
+
children,
|
|
151
|
+
...rest
|
|
152
|
+
}) {
|
|
153
|
+
const ctx = useDialogContext();
|
|
154
|
+
return /* @__PURE__ */ jsx("p", { id: ctx.descriptionId, className: cn("text-sm text-muted-foreground", className), ...rest, children });
|
|
155
|
+
}
|
|
156
|
+
function DialogBody({ className, children, ...rest }) {
|
|
157
|
+
return /* @__PURE__ */ jsx("div", { className: cn("text-sm text-foreground", className), ...rest, children });
|
|
158
|
+
}
|
|
159
|
+
function DialogFooter({ className, children, ...rest }) {
|
|
160
|
+
return /* @__PURE__ */ jsx(
|
|
161
|
+
"div",
|
|
162
|
+
{
|
|
163
|
+
className: cn(
|
|
164
|
+
"mt-6 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
165
|
+
className
|
|
166
|
+
),
|
|
167
|
+
...rest,
|
|
168
|
+
children
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
var DialogClose = forwardRef(function DialogClose2({ asChild, onClick, className, children, ...rest }, forwardedRef) {
|
|
173
|
+
const ctx = useDialogContext();
|
|
174
|
+
const Component = asChild ? Slot : "button";
|
|
175
|
+
return /* @__PURE__ */ jsx(
|
|
176
|
+
Component,
|
|
177
|
+
{
|
|
178
|
+
ref: forwardedRef,
|
|
179
|
+
type: "button",
|
|
180
|
+
"aria-label": children ? void 0 : "Close",
|
|
181
|
+
onClick: (e) => {
|
|
182
|
+
onClick?.(e);
|
|
183
|
+
if (e.defaultPrevented) return;
|
|
184
|
+
ctx.setOpen(false);
|
|
185
|
+
requestAnimationFrame(() => ctx.triggerRef.current?.focus());
|
|
186
|
+
},
|
|
187
|
+
className: asChild ? className : cn(
|
|
188
|
+
"absolute right-4 top-4 grid h-7 w-7 place-items-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
189
|
+
className
|
|
190
|
+
),
|
|
191
|
+
...rest,
|
|
192
|
+
children: children ?? /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
});
|
|
196
|
+
Dialog.Trigger = DialogTrigger;
|
|
197
|
+
Dialog.Content = DialogContent;
|
|
198
|
+
Dialog.Header = DialogHeader;
|
|
199
|
+
Dialog.Title = DialogTitle;
|
|
200
|
+
Dialog.Description = DialogDescription;
|
|
201
|
+
Dialog.Body = DialogBody;
|
|
202
|
+
Dialog.Footer = DialogFooter;
|
|
203
|
+
Dialog.Close = DialogClose;
|
|
204
|
+
function AlertDialog(props) {
|
|
205
|
+
return /* @__PURE__ */ jsx(Dialog, { ...props, role: "alertdialog", dismissOnOutsideClick: false });
|
|
206
|
+
}
|
|
207
|
+
var AlertDialogContent = forwardRef(
|
|
208
|
+
function AlertDialogContent2(props, ref) {
|
|
209
|
+
return /* @__PURE__ */ jsx(DialogContent, { ref, ...props });
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
var AlertDialogAction = forwardRef(
|
|
213
|
+
function AlertDialogAction2({ onAction, onClick, className, children, ...rest }, ref) {
|
|
214
|
+
return /* @__PURE__ */ jsx(
|
|
215
|
+
DialogClose,
|
|
216
|
+
{
|
|
217
|
+
ref,
|
|
218
|
+
onClick: (e) => {
|
|
219
|
+
onClick?.(e);
|
|
220
|
+
if (e.defaultPrevented) return;
|
|
221
|
+
onAction?.();
|
|
222
|
+
},
|
|
223
|
+
className: cn(
|
|
224
|
+
"inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
225
|
+
className
|
|
226
|
+
),
|
|
227
|
+
...rest,
|
|
228
|
+
children
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
var AlertDialogCancel = forwardRef(
|
|
234
|
+
function AlertDialogCancel2({ className, children, ...rest }, ref) {
|
|
235
|
+
return /* @__PURE__ */ jsx(
|
|
236
|
+
DialogClose,
|
|
237
|
+
{
|
|
238
|
+
ref,
|
|
239
|
+
className: cn(
|
|
240
|
+
"inline-flex h-9 items-center justify-center rounded-md border border-border bg-background px-4 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
241
|
+
className
|
|
242
|
+
),
|
|
243
|
+
...rest,
|
|
244
|
+
children
|
|
245
|
+
}
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
);
|
|
249
|
+
AlertDialog.Trigger = DialogTrigger;
|
|
250
|
+
AlertDialog.Content = AlertDialogContent;
|
|
251
|
+
AlertDialog.Header = DialogHeader;
|
|
252
|
+
AlertDialog.Title = DialogTitle;
|
|
253
|
+
AlertDialog.Description = DialogDescription;
|
|
254
|
+
AlertDialog.Body = DialogBody;
|
|
255
|
+
AlertDialog.Footer = DialogFooter;
|
|
256
|
+
AlertDialog.Action = AlertDialogAction;
|
|
257
|
+
AlertDialog.Cancel = AlertDialogCancel;
|
|
258
|
+
var DrawerContext = createContext(null);
|
|
259
|
+
function useDrawerContext() {
|
|
260
|
+
const ctx = useContext(DrawerContext);
|
|
261
|
+
if (!ctx) throw new Error("Drawer.* must be used inside <Drawer>");
|
|
262
|
+
return ctx;
|
|
263
|
+
}
|
|
264
|
+
function Drawer({
|
|
265
|
+
open: openProp,
|
|
266
|
+
defaultOpen = false,
|
|
267
|
+
onOpenChange,
|
|
268
|
+
side = "right",
|
|
269
|
+
dismissOnOutsideClick = true,
|
|
270
|
+
dismissOnEscape = true,
|
|
271
|
+
children
|
|
272
|
+
}) {
|
|
273
|
+
const [open, setOpen] = useControlled({
|
|
274
|
+
controlled: openProp,
|
|
275
|
+
default: defaultOpen,
|
|
276
|
+
onChange: onOpenChange
|
|
277
|
+
});
|
|
278
|
+
const triggerRef = useRef(null);
|
|
279
|
+
const titleId = useId();
|
|
280
|
+
const descriptionId = useId();
|
|
281
|
+
const ctx = useMemo(
|
|
282
|
+
() => ({
|
|
283
|
+
open,
|
|
284
|
+
setOpen,
|
|
285
|
+
triggerRef,
|
|
286
|
+
titleId,
|
|
287
|
+
descriptionId,
|
|
288
|
+
side,
|
|
289
|
+
dismissOnOutsideClick,
|
|
290
|
+
dismissOnEscape
|
|
291
|
+
}),
|
|
292
|
+
[open, setOpen, titleId, descriptionId, side, dismissOnOutsideClick, dismissOnEscape]
|
|
293
|
+
);
|
|
294
|
+
return /* @__PURE__ */ jsx(DrawerContext.Provider, { value: ctx, children });
|
|
295
|
+
}
|
|
296
|
+
var DrawerTrigger = forwardRef(
|
|
297
|
+
function DrawerTrigger2({ asChild, onClick, children, ...rest }, forwardedRef) {
|
|
298
|
+
const ctx = useDrawerContext();
|
|
299
|
+
const Component = asChild ? Slot : "button";
|
|
300
|
+
return /* @__PURE__ */ jsx(
|
|
301
|
+
Component,
|
|
302
|
+
{
|
|
303
|
+
ref: composeRefs(forwardedRef, ctx.triggerRef),
|
|
304
|
+
type: "button",
|
|
305
|
+
"aria-haspopup": "dialog",
|
|
306
|
+
"aria-expanded": ctx.open,
|
|
307
|
+
"data-state": ctx.open ? "open" : "closed",
|
|
308
|
+
onClick: (e) => {
|
|
309
|
+
onClick?.(e);
|
|
310
|
+
if (e.defaultPrevented) return;
|
|
311
|
+
ctx.setOpen(true);
|
|
312
|
+
},
|
|
313
|
+
...rest,
|
|
314
|
+
children
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
);
|
|
319
|
+
var SIDE_CLASSES = {
|
|
320
|
+
right: "inset-y-0 right-0 h-full w-full sm:max-w-sm border-l animate-in slide-in-from-right",
|
|
321
|
+
left: "inset-y-0 left-0 h-full w-full sm:max-w-sm border-r animate-in slide-in-from-left",
|
|
322
|
+
top: "inset-x-0 top-0 w-full max-h-[85vh] border-b animate-in slide-in-from-top",
|
|
323
|
+
bottom: "inset-x-0 bottom-0 w-full max-h-[85vh] border-t animate-in slide-in-from-bottom"
|
|
324
|
+
};
|
|
325
|
+
var DrawerContent = forwardRef(
|
|
326
|
+
function DrawerContent2({ hideBackdrop, blur, className, children, ...rest }, forwardedRef) {
|
|
327
|
+
const ctx = useDrawerContext();
|
|
328
|
+
if (!ctx.open) return null;
|
|
329
|
+
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs(ScrollLockProvider, { children: [
|
|
330
|
+
!hideBackdrop && /* @__PURE__ */ jsx(
|
|
331
|
+
Backdrop,
|
|
332
|
+
{
|
|
333
|
+
inline: true,
|
|
334
|
+
blur,
|
|
335
|
+
onClick: () => {
|
|
336
|
+
if (ctx.dismissOnOutsideClick) ctx.setOpen(false);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
),
|
|
340
|
+
/* @__PURE__ */ jsx(FocusScope, { asChild: true, trapped: true, loop: true, children: /* @__PURE__ */ jsx(
|
|
341
|
+
DismissableLayer,
|
|
342
|
+
{
|
|
343
|
+
disableEscape: !ctx.dismissOnEscape,
|
|
344
|
+
onEscape: () => ctx.setOpen(false),
|
|
345
|
+
disableOutsideClick: true,
|
|
346
|
+
children: /* @__PURE__ */ jsx(
|
|
347
|
+
"div",
|
|
348
|
+
{
|
|
349
|
+
ref: forwardedRef,
|
|
350
|
+
role: "dialog",
|
|
351
|
+
"aria-modal": "true",
|
|
352
|
+
"aria-labelledby": ctx.titleId,
|
|
353
|
+
"aria-describedby": ctx.descriptionId,
|
|
354
|
+
"data-state": "open",
|
|
355
|
+
"data-side": ctx.side,
|
|
356
|
+
className: cn(
|
|
357
|
+
"fixed z-50 flex flex-col gap-4 border-border bg-background p-6 shadow-lg outline-none",
|
|
358
|
+
SIDE_CLASSES[ctx.side],
|
|
359
|
+
className
|
|
360
|
+
),
|
|
361
|
+
...rest,
|
|
362
|
+
children
|
|
363
|
+
}
|
|
364
|
+
)
|
|
365
|
+
}
|
|
366
|
+
) })
|
|
367
|
+
] }) });
|
|
368
|
+
}
|
|
369
|
+
);
|
|
370
|
+
function DrawerHeader({ className, children, ...rest }) {
|
|
371
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-1.5", className), ...rest, children });
|
|
372
|
+
}
|
|
373
|
+
function DrawerTitle({
|
|
374
|
+
className,
|
|
375
|
+
children,
|
|
376
|
+
...rest
|
|
377
|
+
}) {
|
|
378
|
+
const ctx = useDrawerContext();
|
|
379
|
+
return /* @__PURE__ */ jsx(
|
|
380
|
+
"h2",
|
|
381
|
+
{
|
|
382
|
+
id: ctx.titleId,
|
|
383
|
+
className: cn("text-lg font-semibold leading-none text-foreground", className),
|
|
384
|
+
...rest,
|
|
385
|
+
children
|
|
386
|
+
}
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
function DrawerDescription({
|
|
390
|
+
className,
|
|
391
|
+
children,
|
|
392
|
+
...rest
|
|
393
|
+
}) {
|
|
394
|
+
const ctx = useDrawerContext();
|
|
395
|
+
return /* @__PURE__ */ jsx("p", { id: ctx.descriptionId, className: cn("text-sm text-muted-foreground", className), ...rest, children });
|
|
396
|
+
}
|
|
397
|
+
function DrawerBody({
|
|
398
|
+
className,
|
|
399
|
+
children,
|
|
400
|
+
...rest
|
|
401
|
+
}) {
|
|
402
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex-1 overflow-y-auto text-sm text-foreground", className), ...rest, children });
|
|
403
|
+
}
|
|
404
|
+
function DrawerFooter({
|
|
405
|
+
className,
|
|
406
|
+
children,
|
|
407
|
+
...rest
|
|
408
|
+
}) {
|
|
409
|
+
return /* @__PURE__ */ jsx(
|
|
410
|
+
"div",
|
|
411
|
+
{
|
|
412
|
+
className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
|
|
413
|
+
...rest,
|
|
414
|
+
children
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
var DrawerClose = forwardRef(function DrawerClose2({ asChild, onClick, className, children, ...rest }, forwardedRef) {
|
|
419
|
+
const ctx = useDrawerContext();
|
|
420
|
+
const Component = asChild ? Slot : "button";
|
|
421
|
+
return /* @__PURE__ */ jsx(
|
|
422
|
+
Component,
|
|
423
|
+
{
|
|
424
|
+
ref: forwardedRef,
|
|
425
|
+
type: "button",
|
|
426
|
+
"aria-label": children ? void 0 : "Close",
|
|
427
|
+
onClick: (e) => {
|
|
428
|
+
onClick?.(e);
|
|
429
|
+
if (e.defaultPrevented) return;
|
|
430
|
+
ctx.setOpen(false);
|
|
431
|
+
requestAnimationFrame(() => ctx.triggerRef.current?.focus());
|
|
432
|
+
},
|
|
433
|
+
className: asChild ? className : cn(
|
|
434
|
+
"absolute right-4 top-4 grid h-7 w-7 place-items-center rounded-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
435
|
+
className
|
|
436
|
+
),
|
|
437
|
+
...rest,
|
|
438
|
+
children: children ?? /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
439
|
+
}
|
|
440
|
+
);
|
|
441
|
+
});
|
|
442
|
+
Drawer.Trigger = DrawerTrigger;
|
|
443
|
+
Drawer.Content = DrawerContent;
|
|
444
|
+
Drawer.Header = DrawerHeader;
|
|
445
|
+
Drawer.Title = DrawerTitle;
|
|
446
|
+
Drawer.Description = DrawerDescription;
|
|
447
|
+
Drawer.Body = DrawerBody;
|
|
448
|
+
Drawer.Footer = DrawerFooter;
|
|
449
|
+
Drawer.Close = DrawerClose;
|
|
450
|
+
var PopoverContext = createContext(null);
|
|
451
|
+
function usePopoverContext() {
|
|
452
|
+
const ctx = useContext(PopoverContext);
|
|
453
|
+
if (!ctx) throw new Error("Popover.* must be used inside <Popover>");
|
|
454
|
+
return ctx;
|
|
455
|
+
}
|
|
456
|
+
function Popover({
|
|
457
|
+
open: openProp,
|
|
458
|
+
defaultOpen = false,
|
|
459
|
+
onOpenChange,
|
|
460
|
+
placement = "bottom",
|
|
461
|
+
offset = 8,
|
|
462
|
+
dismissOnOutsideClick = true,
|
|
463
|
+
dismissOnEscape = true,
|
|
464
|
+
children
|
|
465
|
+
}) {
|
|
466
|
+
const [open, setOpen] = useControlled({
|
|
467
|
+
controlled: openProp,
|
|
468
|
+
default: defaultOpen,
|
|
469
|
+
onChange: onOpenChange
|
|
470
|
+
});
|
|
471
|
+
const triggerRef = useRef(null);
|
|
472
|
+
const ctx = useMemo(
|
|
473
|
+
() => ({
|
|
474
|
+
open,
|
|
475
|
+
setOpen,
|
|
476
|
+
triggerRef,
|
|
477
|
+
placement,
|
|
478
|
+
offset,
|
|
479
|
+
dismissOnOutsideClick,
|
|
480
|
+
dismissOnEscape
|
|
481
|
+
}),
|
|
482
|
+
[open, setOpen, placement, offset, dismissOnOutsideClick, dismissOnEscape]
|
|
483
|
+
);
|
|
484
|
+
return /* @__PURE__ */ jsx(PopoverContext.Provider, { value: ctx, children });
|
|
485
|
+
}
|
|
486
|
+
var PopoverTrigger = forwardRef(
|
|
487
|
+
function PopoverTrigger2({ asChild, onClick, children, ...rest }, forwardedRef) {
|
|
488
|
+
const ctx = usePopoverContext();
|
|
489
|
+
const Component = asChild ? Slot : "button";
|
|
490
|
+
return /* @__PURE__ */ jsx(
|
|
491
|
+
Component,
|
|
492
|
+
{
|
|
493
|
+
ref: composeRefs(forwardedRef, ctx.triggerRef),
|
|
494
|
+
type: "button",
|
|
495
|
+
"aria-haspopup": "dialog",
|
|
496
|
+
"aria-expanded": ctx.open,
|
|
497
|
+
"data-state": ctx.open ? "open" : "closed",
|
|
498
|
+
onClick: (e) => {
|
|
499
|
+
onClick?.(e);
|
|
500
|
+
if (e.defaultPrevented) return;
|
|
501
|
+
ctx.setOpen(!ctx.open);
|
|
502
|
+
},
|
|
503
|
+
...rest,
|
|
504
|
+
children
|
|
505
|
+
}
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
);
|
|
509
|
+
var PopoverContent = forwardRef(
|
|
510
|
+
function PopoverContent2({ className, children, ...rest }, forwardedRef) {
|
|
511
|
+
const ctx = usePopoverContext();
|
|
512
|
+
if (!ctx.open) return null;
|
|
513
|
+
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
|
|
514
|
+
AnchoredPositioner,
|
|
515
|
+
{
|
|
516
|
+
anchor: ctx.triggerRef.current,
|
|
517
|
+
placement: ctx.placement,
|
|
518
|
+
offset: ctx.offset,
|
|
519
|
+
children: /* @__PURE__ */ jsx(FocusScope, { asChild: true, trapped: true, loop: true, children: /* @__PURE__ */ jsx(
|
|
520
|
+
DismissableLayer,
|
|
521
|
+
{
|
|
522
|
+
disableEscape: !ctx.dismissOnEscape,
|
|
523
|
+
onEscape: () => {
|
|
524
|
+
ctx.setOpen(false);
|
|
525
|
+
requestAnimationFrame(() => ctx.triggerRef.current?.focus());
|
|
526
|
+
},
|
|
527
|
+
disableOutsideClick: !ctx.dismissOnOutsideClick,
|
|
528
|
+
onOutsidePointerDown: (e) => {
|
|
529
|
+
if (ctx.triggerRef.current?.contains(e.target)) return;
|
|
530
|
+
ctx.setOpen(false);
|
|
531
|
+
},
|
|
532
|
+
children: /* @__PURE__ */ jsx(
|
|
533
|
+
"div",
|
|
534
|
+
{
|
|
535
|
+
ref: forwardedRef,
|
|
536
|
+
role: "dialog",
|
|
537
|
+
"data-state": "open",
|
|
538
|
+
className: cn(
|
|
539
|
+
"z-50 w-72 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md outline-none animate-in fade-in-0 zoom-in-95",
|
|
540
|
+
className
|
|
541
|
+
),
|
|
542
|
+
...rest,
|
|
543
|
+
children
|
|
544
|
+
}
|
|
545
|
+
)
|
|
546
|
+
}
|
|
547
|
+
) })
|
|
548
|
+
}
|
|
549
|
+
) });
|
|
550
|
+
}
|
|
551
|
+
);
|
|
552
|
+
function PopoverArrow({ className, ...rest }) {
|
|
553
|
+
return /* @__PURE__ */ jsx(OverlayArrow, { className: cn("text-popover", className), ...rest });
|
|
554
|
+
}
|
|
555
|
+
Popover.Trigger = PopoverTrigger;
|
|
556
|
+
Popover.Content = PopoverContent;
|
|
557
|
+
Popover.Arrow = PopoverArrow;
|
|
558
|
+
var HoverCardContext = createContext(null);
|
|
559
|
+
function useHoverCardContext() {
|
|
560
|
+
const ctx = useContext(HoverCardContext);
|
|
561
|
+
if (!ctx) throw new Error("HoverCard.* must be used inside <HoverCard>");
|
|
562
|
+
return ctx;
|
|
563
|
+
}
|
|
564
|
+
function HoverCard({
|
|
565
|
+
open: openProp,
|
|
566
|
+
defaultOpen = false,
|
|
567
|
+
onOpenChange,
|
|
568
|
+
openDelay = 700,
|
|
569
|
+
closeDelay = 300,
|
|
570
|
+
placement = "bottom",
|
|
571
|
+
offset = 8,
|
|
572
|
+
children
|
|
573
|
+
}) {
|
|
574
|
+
const [open, setOpen] = useControlled({
|
|
575
|
+
controlled: openProp,
|
|
576
|
+
default: defaultOpen,
|
|
577
|
+
onChange: onOpenChange
|
|
578
|
+
});
|
|
579
|
+
const triggerRef = useRef(null);
|
|
580
|
+
const openTimer = useRef(null);
|
|
581
|
+
const closeTimer = useRef(null);
|
|
582
|
+
const clear = useCallback(() => {
|
|
583
|
+
if (openTimer.current) clearTimeout(openTimer.current);
|
|
584
|
+
if (closeTimer.current) clearTimeout(closeTimer.current);
|
|
585
|
+
openTimer.current = null;
|
|
586
|
+
closeTimer.current = null;
|
|
587
|
+
}, []);
|
|
588
|
+
const show = useCallback(() => {
|
|
589
|
+
clear();
|
|
590
|
+
openTimer.current = setTimeout(() => setOpen(true), openDelay);
|
|
591
|
+
}, [clear, openDelay, setOpen]);
|
|
592
|
+
const hide = useCallback(() => {
|
|
593
|
+
clear();
|
|
594
|
+
closeTimer.current = setTimeout(() => setOpen(false), closeDelay);
|
|
595
|
+
}, [clear, closeDelay, setOpen]);
|
|
596
|
+
const cancelHide = useCallback(() => {
|
|
597
|
+
if (closeTimer.current) {
|
|
598
|
+
clearTimeout(closeTimer.current);
|
|
599
|
+
closeTimer.current = null;
|
|
600
|
+
}
|
|
601
|
+
}, []);
|
|
602
|
+
const ctx = useMemo(
|
|
603
|
+
() => ({ open, setOpen, triggerRef, show, hide, cancelHide, placement, offset }),
|
|
604
|
+
[open, setOpen, show, hide, cancelHide, placement, offset]
|
|
605
|
+
);
|
|
606
|
+
return /* @__PURE__ */ jsx(HoverCardContext.Provider, { value: ctx, children });
|
|
607
|
+
}
|
|
608
|
+
function HoverCardTrigger({ children }) {
|
|
609
|
+
const ctx = useHoverCardContext();
|
|
610
|
+
if (!isValidElement(children)) return children;
|
|
611
|
+
const trigger = children;
|
|
612
|
+
return cloneElement(trigger, {
|
|
613
|
+
ref: composeRefs((node) => {
|
|
614
|
+
ctx.triggerRef.current = node;
|
|
615
|
+
}, trigger.ref),
|
|
616
|
+
onPointerEnter: (e) => {
|
|
617
|
+
trigger.props.onPointerEnter?.(e);
|
|
618
|
+
ctx.show();
|
|
619
|
+
},
|
|
620
|
+
onPointerLeave: (e) => {
|
|
621
|
+
trigger.props.onPointerLeave?.(e);
|
|
622
|
+
ctx.hide();
|
|
623
|
+
},
|
|
624
|
+
onFocus: (e) => {
|
|
625
|
+
trigger.props.onFocus?.(e);
|
|
626
|
+
ctx.show();
|
|
627
|
+
},
|
|
628
|
+
onBlur: (e) => {
|
|
629
|
+
trigger.props.onBlur?.(e);
|
|
630
|
+
ctx.hide();
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
var HoverCardContent = forwardRef(
|
|
635
|
+
function HoverCardContent2({ className, children, onPointerEnter, onPointerLeave, ...rest }, forwardedRef) {
|
|
636
|
+
const ctx = useHoverCardContext();
|
|
637
|
+
if (!ctx.open) return null;
|
|
638
|
+
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
|
|
639
|
+
AnchoredPositioner,
|
|
640
|
+
{
|
|
641
|
+
anchor: ctx.triggerRef.current,
|
|
642
|
+
placement: ctx.placement,
|
|
643
|
+
offset: ctx.offset,
|
|
644
|
+
children: /* @__PURE__ */ jsx(
|
|
645
|
+
"div",
|
|
646
|
+
{
|
|
647
|
+
ref: forwardedRef,
|
|
648
|
+
"data-state": "open",
|
|
649
|
+
onPointerEnter: (e) => {
|
|
650
|
+
onPointerEnter?.(e);
|
|
651
|
+
ctx.cancelHide();
|
|
652
|
+
},
|
|
653
|
+
onPointerLeave: (e) => {
|
|
654
|
+
onPointerLeave?.(e);
|
|
655
|
+
ctx.hide();
|
|
656
|
+
},
|
|
657
|
+
className: cn(
|
|
658
|
+
"z-50 w-64 rounded-md border border-border bg-popover p-4 text-popover-foreground shadow-md outline-none animate-in fade-in-0 zoom-in-95",
|
|
659
|
+
className
|
|
660
|
+
),
|
|
661
|
+
...rest,
|
|
662
|
+
children
|
|
663
|
+
}
|
|
664
|
+
)
|
|
665
|
+
}
|
|
666
|
+
) });
|
|
667
|
+
}
|
|
668
|
+
);
|
|
669
|
+
function HoverCardArrow({ className, ...rest }) {
|
|
670
|
+
return /* @__PURE__ */ jsx(OverlayArrow, { className: cn("text-popover", className), ...rest });
|
|
671
|
+
}
|
|
672
|
+
HoverCard.Trigger = HoverCardTrigger;
|
|
673
|
+
HoverCard.Content = HoverCardContent;
|
|
674
|
+
HoverCard.Arrow = HoverCardArrow;
|
|
675
|
+
|
|
676
|
+
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, Backdrop, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, HoverCard, HoverCardArrow, HoverCardContent, HoverCardTrigger, Popover, PopoverArrow, PopoverContent, PopoverTrigger };
|
|
677
|
+
//# sourceMappingURL=chunk-52DFDWY3.js.map
|
|
678
|
+
//# sourceMappingURL=chunk-52DFDWY3.js.map
|