@pactor-app/ui 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-OH3U6PCM.js → chunk-BZSRLTQQ.js} +60 -66
- package/dist/{chunk-DMK6RSTK.js → chunk-D6G4J5XS.js} +18 -11
- package/dist/chunk-F3H23KYG.js +330 -0
- package/dist/chunk-FVZMNP5P.js +3222 -0
- package/dist/{chunk-SNFDI77B.js → chunk-GL7IO22L.js} +94 -5
- package/dist/chunk-TUXCPXPA.js +3085 -0
- package/dist/chunk-UR3I4WXQ.js +236 -0
- package/dist/components/index.cjs +5889 -546
- package/dist/components/index.d.cts +1477 -30
- package/dist/components/index.d.ts +1477 -30
- package/dist/components/index.js +124 -4
- package/dist/index.cjs +6194 -1083
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +126 -8
- package/dist/interaction/index.cjs +152 -77
- package/dist/interaction/index.d.cts +7 -5
- package/dist/interaction/index.d.ts +7 -5
- package/dist/interaction/index.js +2 -3
- package/dist/layout/index.cjs +217 -71
- package/dist/layout/index.js +3 -3
- package/dist/typography-DsGdDBc2.d.cts +24 -0
- package/dist/typography-DsGdDBc2.d.ts +24 -0
- package/dist/ui/index.cjs +2969 -172
- package/dist/ui/index.d.cts +416 -14
- package/dist/ui/index.d.ts +416 -14
- package/dist/ui/index.js +330 -126
- package/package.json +13 -5
- package/styles.css +1135 -20
- package/dist/chunk-57NRUZ5G.js +0 -95
- package/dist/chunk-OUTSIJMO.js +0 -442
- package/dist/chunk-QDTVOJ5P.js +0 -147
- package/dist/chunk-QWZ23QLS.js +0 -68
- package/dist/chunk-XGOTHOI6.js +0 -619
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Button,
|
|
2
3
|
Dialog,
|
|
3
4
|
DialogClose,
|
|
4
5
|
DialogContent,
|
|
5
6
|
DialogDescription,
|
|
6
7
|
DialogFooter,
|
|
7
8
|
DialogHeader,
|
|
8
|
-
DialogTitle
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
DialogTitle,
|
|
10
|
+
Drawer,
|
|
11
|
+
DrawerClose,
|
|
12
|
+
DrawerContent,
|
|
13
|
+
DrawerHeader,
|
|
14
|
+
DrawerTitle
|
|
15
|
+
} from "./chunk-F3H23KYG.js";
|
|
13
16
|
import {
|
|
14
17
|
cn
|
|
15
18
|
} from "./chunk-RQHJBTEU.js";
|
|
@@ -164,7 +167,7 @@ function registerInteractionActions(actions, manager, ui) {
|
|
|
164
167
|
);
|
|
165
168
|
}
|
|
166
169
|
const params = action.params ?? {};
|
|
167
|
-
const type = params["type"];
|
|
170
|
+
const type = params["messageType"] ?? params["type"];
|
|
168
171
|
const text = params["text"];
|
|
169
172
|
if (type === "success" || type === "error" || type === "warning") {
|
|
170
173
|
message[type](text);
|
|
@@ -182,6 +185,7 @@ function isRecord(value) {
|
|
|
182
185
|
}
|
|
183
186
|
|
|
184
187
|
// src/interaction/provider.tsx
|
|
188
|
+
import { useI18n } from "@pactor-app/runtime";
|
|
185
189
|
import { useEffect, useMemo, useState } from "react";
|
|
186
190
|
import { createPortal } from "react-dom";
|
|
187
191
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -198,6 +202,7 @@ function ShadcnInteractionProvider({
|
|
|
198
202
|
}) {
|
|
199
203
|
const [confirmState, setConfirmState] = useState(null);
|
|
200
204
|
const [toasts, setToasts] = useState([]);
|
|
205
|
+
const { t } = useI18n();
|
|
201
206
|
const { modal, message } = useMemo(() => {
|
|
202
207
|
const pushToast = (type, content) => {
|
|
203
208
|
const id = Date.now() + Math.random();
|
|
@@ -261,8 +266,8 @@ function ShadcnInteractionProvider({
|
|
|
261
266
|
)
|
|
262
267
|
] }),
|
|
263
268
|
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
264
|
-
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: handleCancel, children: "
|
|
265
|
-
/* @__PURE__ */ jsx(Button, { type: "button", onClick: handleOk, children: "
|
|
269
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", onClick: handleCancel, children: t("pactor.alertDialog.cancel") }),
|
|
270
|
+
/* @__PURE__ */ jsx(Button, { type: "button", onClick: handleOk, children: t("pactor.alertDialog.confirm") })
|
|
266
271
|
] })
|
|
267
272
|
] })
|
|
268
273
|
}
|
|
@@ -299,6 +304,7 @@ import { XIcon } from "lucide-react";
|
|
|
299
304
|
import {
|
|
300
305
|
createPageRuntime,
|
|
301
306
|
PageRuntimeView,
|
|
307
|
+
useI18n as useI18n2,
|
|
302
308
|
useRenderer
|
|
303
309
|
} from "@pactor-app/runtime";
|
|
304
310
|
import { useEffect as useEffect2, useState as useState2, useSyncExternalStore } from "react";
|
|
@@ -343,6 +349,7 @@ function OverlayEntryView({
|
|
|
343
349
|
renderer,
|
|
344
350
|
resolvePage
|
|
345
351
|
}) {
|
|
352
|
+
const { t } = useI18n2();
|
|
346
353
|
const handleCancel = () => manager.close(entry.id);
|
|
347
354
|
let body = null;
|
|
348
355
|
if (entry.content) {
|
|
@@ -390,7 +397,7 @@ function OverlayEntryView({
|
|
|
390
397
|
{
|
|
391
398
|
type: "button",
|
|
392
399
|
"data-slot": "overlay-modal-close",
|
|
393
|
-
"aria-label": "
|
|
400
|
+
"aria-label": t("pactor.overlay.close"),
|
|
394
401
|
className: "absolute top-4 right-4 cursor-pointer rounded-xs opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none",
|
|
395
402
|
children: /* @__PURE__ */ jsx2(XIcon, { className: "size-4" })
|
|
396
403
|
}
|
|
@@ -410,64 +417,51 @@ function ShadcnDrawerView({
|
|
|
410
417
|
onCancel,
|
|
411
418
|
children
|
|
412
419
|
}) {
|
|
413
|
-
|
|
414
|
-
const handleKeyDown = (event) => {
|
|
415
|
-
if (event.key === "Escape") {
|
|
416
|
-
onCancel();
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
420
|
-
return () => {
|
|
421
|
-
document.removeEventListener("keydown", handleKeyDown);
|
|
422
|
-
};
|
|
423
|
-
}, [onCancel]);
|
|
420
|
+
const { t } = useI18n2();
|
|
424
421
|
const panelStyle = entry.width === void 0 ? void 0 : { width: toCssWidth(entry.width) };
|
|
425
|
-
return /* @__PURE__ */
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
}
|
|
469
|
-
)
|
|
470
|
-
] });
|
|
422
|
+
return /* @__PURE__ */ jsx2(
|
|
423
|
+
Drawer,
|
|
424
|
+
{
|
|
425
|
+
direction: "right",
|
|
426
|
+
open: true,
|
|
427
|
+
onOpenChange: (open) => {
|
|
428
|
+
if (!open) {
|
|
429
|
+
onCancel();
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
children: /* @__PURE__ */ jsxs2(
|
|
433
|
+
DrawerContent,
|
|
434
|
+
{
|
|
435
|
+
"data-slot": "drawer-panel",
|
|
436
|
+
className: cn(entry.width !== void 0 && "sm:max-w-none"),
|
|
437
|
+
style: panelStyle,
|
|
438
|
+
children: [
|
|
439
|
+
/* @__PURE__ */ jsxs2(
|
|
440
|
+
DrawerHeader,
|
|
441
|
+
{
|
|
442
|
+
"data-slot": "drawer-header",
|
|
443
|
+
className: "flex flex-row items-center justify-between border-b border-border px-6 py-4",
|
|
444
|
+
children: [
|
|
445
|
+
/* @__PURE__ */ jsx2(DrawerTitle, { className: "text-lg", children: entry.title ?? "" }),
|
|
446
|
+
/* @__PURE__ */ jsx2(DrawerClose, { asChild: true, children: /* @__PURE__ */ jsx2(
|
|
447
|
+
"button",
|
|
448
|
+
{
|
|
449
|
+
type: "button",
|
|
450
|
+
"data-slot": "drawer-close",
|
|
451
|
+
"aria-label": t("pactor.overlay.close"),
|
|
452
|
+
className: "cursor-pointer rounded-xs opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none",
|
|
453
|
+
children: /* @__PURE__ */ jsx2(XIcon, { className: "size-4" })
|
|
454
|
+
}
|
|
455
|
+
) })
|
|
456
|
+
]
|
|
457
|
+
}
|
|
458
|
+
),
|
|
459
|
+
/* @__PURE__ */ jsx2("div", { "data-slot": "drawer-body", className: "flex-1 overflow-auto p-6", children })
|
|
460
|
+
]
|
|
461
|
+
}
|
|
462
|
+
)
|
|
463
|
+
}
|
|
464
|
+
);
|
|
471
465
|
}
|
|
472
466
|
function PageOverlayBody({
|
|
473
467
|
entry,
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Icon
|
|
3
|
+
} from "./chunk-UR3I4WXQ.js";
|
|
1
4
|
import {
|
|
2
5
|
Accordion,
|
|
3
6
|
AccordionContent,
|
|
4
7
|
AccordionItem,
|
|
5
8
|
AccordionTrigger,
|
|
6
|
-
Popover,
|
|
7
|
-
PopoverContent,
|
|
8
|
-
PopoverTrigger
|
|
9
|
-
} from "./chunk-SNFDI77B.js";
|
|
10
|
-
import {
|
|
11
9
|
Card,
|
|
12
10
|
CardContent,
|
|
13
11
|
CardHeader,
|
|
14
|
-
CardTitle
|
|
15
|
-
|
|
12
|
+
CardTitle,
|
|
13
|
+
Popover,
|
|
14
|
+
PopoverContent,
|
|
15
|
+
PopoverTrigger
|
|
16
|
+
} from "./chunk-GL7IO22L.js";
|
|
16
17
|
import {
|
|
17
18
|
cn
|
|
18
19
|
} from "./chunk-RQHJBTEU.js";
|
|
@@ -118,7 +119,7 @@ function navigateMenuItem(menu, bridge) {
|
|
|
118
119
|
}
|
|
119
120
|
bridge.push(menu.path);
|
|
120
121
|
}
|
|
121
|
-
var menuItemClass = "flex w-full cursor-pointer items-center rounded-md px-3 py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50";
|
|
122
|
+
var menuItemClass = "flex w-full cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-left text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50";
|
|
122
123
|
function CollapsedGroupFlyout({
|
|
123
124
|
menu,
|
|
124
125
|
registry,
|
|
@@ -258,7 +259,10 @@ function MenuTree({
|
|
|
258
259
|
className: cn(menuItemClass, "py-2 font-medium"),
|
|
259
260
|
disabled: menu.disabled,
|
|
260
261
|
title: menu.title,
|
|
261
|
-
children:
|
|
262
|
+
children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2", children: [
|
|
263
|
+
menu.icon ? /* @__PURE__ */ jsx(Icon, { name: menu.icon, size: "sm" }) : null,
|
|
264
|
+
menu.title
|
|
265
|
+
] })
|
|
262
266
|
}
|
|
263
267
|
),
|
|
264
268
|
/* @__PURE__ */ jsx(AccordionContent, { "data-slot": "menu-group-content", className: "pb-1", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5 pl-3", children: /* @__PURE__ */ jsx(
|
|
@@ -276,7 +280,7 @@ function MenuTree({
|
|
|
276
280
|
menu.id
|
|
277
281
|
);
|
|
278
282
|
}
|
|
279
|
-
return /* @__PURE__ */
|
|
283
|
+
return /* @__PURE__ */ jsxs(
|
|
280
284
|
"button",
|
|
281
285
|
{
|
|
282
286
|
type: "button",
|
|
@@ -289,7 +293,10 @@ function MenuTree({
|
|
|
289
293
|
disabled: menu.disabled,
|
|
290
294
|
title: menu.title,
|
|
291
295
|
onClick: () => navigateMenuItem(registry.findById(menu.id), bridge),
|
|
292
|
-
children:
|
|
296
|
+
children: [
|
|
297
|
+
menu.icon ? /* @__PURE__ */ jsx(Icon, { name: menu.icon, size: "sm" }) : null,
|
|
298
|
+
menu.title
|
|
299
|
+
]
|
|
293
300
|
},
|
|
294
301
|
menu.id
|
|
295
302
|
);
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-RQHJBTEU.js";
|
|
4
|
+
|
|
5
|
+
// src/ui/button.tsx
|
|
6
|
+
import { Button as ButtonPrimitive } from "@base-ui/react/button";
|
|
7
|
+
import { cva } from "class-variance-authority";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var buttonVariants = cva(
|
|
11
|
+
"inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium outline-none transition-colors focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
variant: {
|
|
15
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
16
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20",
|
|
17
|
+
outline: "border border-border bg-background hover:bg-accent hover:text-accent-foreground",
|
|
18
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
19
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
20
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default: "h-9 px-4 py-2",
|
|
24
|
+
sm: "h-8 gap-1.5 rounded-md px-3 text-xs",
|
|
25
|
+
lg: "h-10 rounded-md px-6",
|
|
26
|
+
icon: "size-9"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
variant: "default",
|
|
31
|
+
size: "default"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
function Button({
|
|
36
|
+
className,
|
|
37
|
+
variant,
|
|
38
|
+
size,
|
|
39
|
+
asChild = false,
|
|
40
|
+
children,
|
|
41
|
+
...props
|
|
42
|
+
}) {
|
|
43
|
+
if (asChild && React.isValidElement(children)) {
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
ButtonPrimitive,
|
|
46
|
+
{
|
|
47
|
+
"data-slot": "button",
|
|
48
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
49
|
+
render: children,
|
|
50
|
+
...props
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
ButtonPrimitive,
|
|
56
|
+
{
|
|
57
|
+
"data-slot": "button",
|
|
58
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
59
|
+
...props,
|
|
60
|
+
children
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// src/ui/dialog.tsx
|
|
66
|
+
import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
|
|
67
|
+
import { XIcon } from "lucide-react";
|
|
68
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
69
|
+
function Dialog({
|
|
70
|
+
...props
|
|
71
|
+
}) {
|
|
72
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
73
|
+
}
|
|
74
|
+
function DialogTrigger({
|
|
75
|
+
...props
|
|
76
|
+
}) {
|
|
77
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
78
|
+
}
|
|
79
|
+
function DialogPortal({
|
|
80
|
+
...props
|
|
81
|
+
}) {
|
|
82
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
83
|
+
}
|
|
84
|
+
function DialogClose({
|
|
85
|
+
...props
|
|
86
|
+
}) {
|
|
87
|
+
return /* @__PURE__ */ jsx2(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
88
|
+
}
|
|
89
|
+
function DialogOverlay({
|
|
90
|
+
className,
|
|
91
|
+
...props
|
|
92
|
+
}) {
|
|
93
|
+
return /* @__PURE__ */ jsx2(
|
|
94
|
+
DialogPrimitive.Backdrop,
|
|
95
|
+
{
|
|
96
|
+
"data-slot": "dialog-overlay",
|
|
97
|
+
className: cn(
|
|
98
|
+
"fixed inset-0 z-50 bg-black/50 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
|
|
99
|
+
className
|
|
100
|
+
),
|
|
101
|
+
...props
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
function DialogContent({
|
|
106
|
+
className,
|
|
107
|
+
children,
|
|
108
|
+
showCloseButton = true,
|
|
109
|
+
...props
|
|
110
|
+
}) {
|
|
111
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
112
|
+
/* @__PURE__ */ jsx2(DialogOverlay, {}),
|
|
113
|
+
/* @__PURE__ */ jsxs(
|
|
114
|
+
DialogPrimitive.Popup,
|
|
115
|
+
{
|
|
116
|
+
"data-slot": "dialog-content",
|
|
117
|
+
className: cn(
|
|
118
|
+
"fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border border-border bg-background p-6 shadow-lg duration-200 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 sm:max-w-lg",
|
|
119
|
+
className
|
|
120
|
+
),
|
|
121
|
+
...props,
|
|
122
|
+
children: [
|
|
123
|
+
children,
|
|
124
|
+
showCloseButton && /* @__PURE__ */ jsxs(
|
|
125
|
+
DialogPrimitive.Close,
|
|
126
|
+
{
|
|
127
|
+
"data-slot": "dialog-close",
|
|
128
|
+
render: /* @__PURE__ */ jsx2(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
type: "button",
|
|
132
|
+
className: "absolute top-4 right-4 cursor-pointer rounded-xs opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ jsx2(XIcon, {}),
|
|
137
|
+
/* @__PURE__ */ jsx2("span", { className: "sr-only", children: "Close" })
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
] });
|
|
145
|
+
}
|
|
146
|
+
function DialogHeader({ className, ...props }) {
|
|
147
|
+
return /* @__PURE__ */ jsx2(
|
|
148
|
+
"div",
|
|
149
|
+
{
|
|
150
|
+
"data-slot": "dialog-header",
|
|
151
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
152
|
+
...props
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
function DialogFooter({ className, ...props }) {
|
|
157
|
+
return /* @__PURE__ */ jsx2(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
"data-slot": "dialog-footer",
|
|
161
|
+
className: cn(
|
|
162
|
+
"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
|
|
163
|
+
className
|
|
164
|
+
),
|
|
165
|
+
...props
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
function DialogTitle({
|
|
170
|
+
className,
|
|
171
|
+
...props
|
|
172
|
+
}) {
|
|
173
|
+
return /* @__PURE__ */ jsx2(
|
|
174
|
+
DialogPrimitive.Title,
|
|
175
|
+
{
|
|
176
|
+
"data-slot": "dialog-title",
|
|
177
|
+
className: cn("text-lg leading-none font-semibold", className),
|
|
178
|
+
...props
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
function DialogDescription({
|
|
183
|
+
className,
|
|
184
|
+
...props
|
|
185
|
+
}) {
|
|
186
|
+
return /* @__PURE__ */ jsx2(
|
|
187
|
+
DialogPrimitive.Description,
|
|
188
|
+
{
|
|
189
|
+
"data-slot": "dialog-description",
|
|
190
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
191
|
+
...props
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// src/ui/drawer.tsx
|
|
197
|
+
import { Drawer as DrawerPrimitive } from "vaul";
|
|
198
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
199
|
+
function Drawer({
|
|
200
|
+
...props
|
|
201
|
+
}) {
|
|
202
|
+
return /* @__PURE__ */ jsx3(DrawerPrimitive.Root, { "data-slot": "drawer", ...props });
|
|
203
|
+
}
|
|
204
|
+
function DrawerTrigger({
|
|
205
|
+
...props
|
|
206
|
+
}) {
|
|
207
|
+
return /* @__PURE__ */ jsx3(DrawerPrimitive.Trigger, { "data-slot": "drawer-trigger", ...props });
|
|
208
|
+
}
|
|
209
|
+
function DrawerPortal({
|
|
210
|
+
...props
|
|
211
|
+
}) {
|
|
212
|
+
return /* @__PURE__ */ jsx3(DrawerPrimitive.Portal, { "data-slot": "drawer-portal", ...props });
|
|
213
|
+
}
|
|
214
|
+
function DrawerClose({
|
|
215
|
+
...props
|
|
216
|
+
}) {
|
|
217
|
+
return /* @__PURE__ */ jsx3(DrawerPrimitive.Close, { "data-slot": "drawer-close", ...props });
|
|
218
|
+
}
|
|
219
|
+
function DrawerOverlay({
|
|
220
|
+
className,
|
|
221
|
+
...props
|
|
222
|
+
}) {
|
|
223
|
+
return /* @__PURE__ */ jsx3(
|
|
224
|
+
DrawerPrimitive.Overlay,
|
|
225
|
+
{
|
|
226
|
+
"data-slot": "drawer-overlay",
|
|
227
|
+
className: cn("fixed inset-0 z-50 bg-black/50", className),
|
|
228
|
+
...props
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
function DrawerContent({
|
|
233
|
+
className,
|
|
234
|
+
children,
|
|
235
|
+
...props
|
|
236
|
+
}) {
|
|
237
|
+
return /* @__PURE__ */ jsxs2(DrawerPortal, { "data-slot": "drawer-portal", children: [
|
|
238
|
+
/* @__PURE__ */ jsx3(DrawerOverlay, {}),
|
|
239
|
+
/* @__PURE__ */ jsxs2(
|
|
240
|
+
DrawerPrimitive.Content,
|
|
241
|
+
{
|
|
242
|
+
"data-slot": "drawer-content",
|
|
243
|
+
className: cn(
|
|
244
|
+
"group/drawer-content fixed z-50 flex h-auto flex-col border-border bg-background",
|
|
245
|
+
"data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
|
|
246
|
+
"data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
|
|
247
|
+
"data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
|
|
248
|
+
"data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
|
|
249
|
+
className
|
|
250
|
+
),
|
|
251
|
+
...props,
|
|
252
|
+
children: [
|
|
253
|
+
/* @__PURE__ */ jsx3("div", { className: "mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }),
|
|
254
|
+
children
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
] });
|
|
259
|
+
}
|
|
260
|
+
function DrawerHeader({ className, ...props }) {
|
|
261
|
+
return /* @__PURE__ */ jsx3(
|
|
262
|
+
"div",
|
|
263
|
+
{
|
|
264
|
+
"data-slot": "drawer-header",
|
|
265
|
+
className: cn("flex flex-col gap-1.5 p-4", className),
|
|
266
|
+
...props
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
function DrawerFooter({ className, ...props }) {
|
|
271
|
+
return /* @__PURE__ */ jsx3(
|
|
272
|
+
"div",
|
|
273
|
+
{
|
|
274
|
+
"data-slot": "drawer-footer",
|
|
275
|
+
className: cn("mt-auto flex flex-col gap-2 p-4", className),
|
|
276
|
+
...props
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
function DrawerTitle({
|
|
281
|
+
className,
|
|
282
|
+
...props
|
|
283
|
+
}) {
|
|
284
|
+
return /* @__PURE__ */ jsx3(
|
|
285
|
+
DrawerPrimitive.Title,
|
|
286
|
+
{
|
|
287
|
+
"data-slot": "drawer-title",
|
|
288
|
+
className: cn("font-semibold text-foreground", className),
|
|
289
|
+
...props
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
function DrawerDescription({
|
|
294
|
+
className,
|
|
295
|
+
...props
|
|
296
|
+
}) {
|
|
297
|
+
return /* @__PURE__ */ jsx3(
|
|
298
|
+
DrawerPrimitive.Description,
|
|
299
|
+
{
|
|
300
|
+
"data-slot": "drawer-description",
|
|
301
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
302
|
+
...props
|
|
303
|
+
}
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export {
|
|
308
|
+
buttonVariants,
|
|
309
|
+
Button,
|
|
310
|
+
Dialog,
|
|
311
|
+
DialogTrigger,
|
|
312
|
+
DialogPortal,
|
|
313
|
+
DialogClose,
|
|
314
|
+
DialogOverlay,
|
|
315
|
+
DialogContent,
|
|
316
|
+
DialogHeader,
|
|
317
|
+
DialogFooter,
|
|
318
|
+
DialogTitle,
|
|
319
|
+
DialogDescription,
|
|
320
|
+
Drawer,
|
|
321
|
+
DrawerTrigger,
|
|
322
|
+
DrawerPortal,
|
|
323
|
+
DrawerClose,
|
|
324
|
+
DrawerOverlay,
|
|
325
|
+
DrawerContent,
|
|
326
|
+
DrawerHeader,
|
|
327
|
+
DrawerFooter,
|
|
328
|
+
DrawerTitle,
|
|
329
|
+
DrawerDescription
|
|
330
|
+
};
|