@definable/ui 0.1.32 → 0.1.36
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/components/alert-dialog.js +15 -15
- package/dist/components/alert.js +21 -21
- package/dist/components/avatar.js +7 -7
- package/dist/components/badge.js +10 -10
- package/dist/components/button.d.ts +1 -1
- package/dist/components/button.js +20 -18
- package/dist/components/calendar.js +26 -26
- package/dist/components/card.js +14 -14
- package/dist/components/carousel.js +39 -39
- package/dist/components/checkbox.js +7 -7
- package/dist/components/collapse.js +17 -17
- package/dist/components/command-menu.js +30 -30
- package/dist/components/command.js +52 -52
- package/dist/components/confirmation-modal.js +23 -23
- package/dist/components/context-menu.js +30 -30
- package/dist/components/dialog.js +32 -32
- package/dist/components/drawer.js +6 -6
- package/dist/components/dropdown-menu.js +16 -16
- package/dist/components/image-cropper-modal.js +27 -27
- package/dist/components/image-cropper.js +27 -27
- package/dist/components/input.js +9 -9
- package/dist/components/loader.js +3 -3
- package/dist/components/loading-placeholder.js +4 -4
- package/dist/components/mention.js +18 -18
- package/dist/components/modal.js +39 -39
- package/dist/components/picker.js +30 -30
- package/dist/components/popover.js +7 -7
- package/dist/components/progress.js +13 -13
- package/dist/components/radio-group.js +19 -19
- package/dist/components/scroll-area.js +20 -20
- package/dist/components/select.js +25 -25
- package/dist/components/selection-bar.js +17 -17
- package/dist/components/separator.js +8 -8
- package/dist/components/skeleton.js +8 -8
- package/dist/components/slider.js +11 -11
- package/dist/components/stepper.js +1 -1
- package/dist/components/switch.js +8 -8
- package/dist/components/table-empty.js +6 -6
- package/dist/components/table-mobile.js +45 -45
- package/dist/components/table.js +66 -66
- package/dist/components/tabs.js +16 -16
- package/dist/components/textarea.js +4 -4
- package/dist/components/use-toast.js +9 -9
- package/dist/icons/icons.d.ts +2 -0
- package/dist/icons/providers/byteplus.d.ts +2 -0
- package/dist/icons/providers/index.d.ts +2 -0
- package/dist/icons/providers/kling.d.ts +2 -0
- package/dist/index.js +285 -218
- package/dist/{stepper-modal-JXpOXOV2.js → stepper-modal-Bh6gsg8o.js} +79 -79
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsx as i, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "react";
|
|
3
3
|
import * as a from "@radix-ui/react-dialog";
|
|
4
4
|
import { cn as s } from "../lib/utils.js";
|
|
5
5
|
import { X as m } from "lucide-react";
|
|
6
6
|
import { motion as n, AnimatePresence as p } from "framer-motion";
|
|
7
|
-
const
|
|
7
|
+
const b = ({ ...e }) => /* @__PURE__ */ i(a.Root, { ...e }), C = a.Trigger, f = a.Portal, R = a.Close, c = r.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ i(
|
|
8
8
|
a.Overlay,
|
|
9
9
|
{
|
|
10
10
|
ref: t,
|
|
11
11
|
asChild: !0,
|
|
12
|
-
...
|
|
13
|
-
children: /* @__PURE__ */
|
|
12
|
+
...o,
|
|
13
|
+
children: /* @__PURE__ */ i(
|
|
14
14
|
n.div,
|
|
15
15
|
{
|
|
16
16
|
className: s(
|
|
@@ -26,15 +26,15 @@ const w = ({ ...e }) => /* @__PURE__ */ o(a.Root, { ...e }), C = a.Trigger, g =
|
|
|
26
26
|
}
|
|
27
27
|
));
|
|
28
28
|
c.displayName = a.Overlay.displayName;
|
|
29
|
-
const
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
29
|
+
const g = r.forwardRef(({ className: e, children: o, ...t }, d) => /* @__PURE__ */ i(f, { children: /* @__PURE__ */ l(p, { mode: "wait", children: [
|
|
30
|
+
/* @__PURE__ */ i(c, {}),
|
|
31
|
+
/* @__PURE__ */ i(
|
|
32
32
|
a.Content,
|
|
33
33
|
{
|
|
34
34
|
ref: d,
|
|
35
35
|
asChild: !0,
|
|
36
36
|
...t,
|
|
37
|
-
children: /* @__PURE__ */
|
|
37
|
+
children: /* @__PURE__ */ l(
|
|
38
38
|
n.div,
|
|
39
39
|
{
|
|
40
40
|
className: s(
|
|
@@ -46,10 +46,10 @@ const f = l.forwardRef(({ className: e, children: i, ...t }, d) => /* @__PURE__
|
|
|
46
46
|
exit: { opacity: 0, scale: 0.95, x: "-50%", y: "-50%" },
|
|
47
47
|
transition: { duration: 0.2 },
|
|
48
48
|
children: [
|
|
49
|
-
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
49
|
+
o,
|
|
50
|
+
/* @__PURE__ */ l(a.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white dark:ring-offset-[#1F1F20] transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-black/20 dark:focus:ring-white/20 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-hover data-[state=open]:text-tertiary", children: [
|
|
51
|
+
/* @__PURE__ */ i(m, { className: "h-4 w-4" }),
|
|
52
|
+
/* @__PURE__ */ i("span", { className: "sr-only", children: "Close" })
|
|
53
53
|
] })
|
|
54
54
|
]
|
|
55
55
|
}
|
|
@@ -57,36 +57,36 @@ const f = l.forwardRef(({ className: e, children: i, ...t }, d) => /* @__PURE__
|
|
|
57
57
|
}
|
|
58
58
|
)
|
|
59
59
|
] }) }));
|
|
60
|
-
|
|
60
|
+
g.displayName = a.Content.displayName;
|
|
61
61
|
const y = ({
|
|
62
62
|
className: e,
|
|
63
|
-
...
|
|
64
|
-
}) => /* @__PURE__ */
|
|
63
|
+
...o
|
|
64
|
+
}) => /* @__PURE__ */ i(
|
|
65
65
|
"div",
|
|
66
66
|
{
|
|
67
67
|
className: s(
|
|
68
68
|
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
69
69
|
e
|
|
70
70
|
),
|
|
71
|
-
...
|
|
71
|
+
...o
|
|
72
72
|
}
|
|
73
73
|
);
|
|
74
74
|
y.displayName = "DialogHeader";
|
|
75
75
|
const x = ({
|
|
76
76
|
className: e,
|
|
77
|
-
...
|
|
78
|
-
}) => /* @__PURE__ */
|
|
77
|
+
...o
|
|
78
|
+
}) => /* @__PURE__ */ i(
|
|
79
79
|
"div",
|
|
80
80
|
{
|
|
81
81
|
className: s(
|
|
82
82
|
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
83
83
|
e
|
|
84
84
|
),
|
|
85
|
-
...
|
|
85
|
+
...o
|
|
86
86
|
}
|
|
87
87
|
);
|
|
88
88
|
x.displayName = "DialogFooter";
|
|
89
|
-
const
|
|
89
|
+
const N = r.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ i(
|
|
90
90
|
a.Title,
|
|
91
91
|
{
|
|
92
92
|
ref: t,
|
|
@@ -94,28 +94,28 @@ const u = l.forwardRef(({ className: e, ...i }, t) => /* @__PURE__ */ o(
|
|
|
94
94
|
"text-lg font-semibold leading-none tracking-tight",
|
|
95
95
|
e
|
|
96
96
|
),
|
|
97
|
-
...
|
|
97
|
+
...o
|
|
98
98
|
}
|
|
99
99
|
));
|
|
100
|
-
|
|
101
|
-
const
|
|
100
|
+
N.displayName = a.Title.displayName;
|
|
101
|
+
const h = r.forwardRef(({ className: e, ...o }, t) => /* @__PURE__ */ i(
|
|
102
102
|
a.Description,
|
|
103
103
|
{
|
|
104
104
|
ref: t,
|
|
105
|
-
className: s("text-sm text-
|
|
106
|
-
...
|
|
105
|
+
className: s("text-sm text-tertiary", e),
|
|
106
|
+
...o
|
|
107
107
|
}
|
|
108
108
|
));
|
|
109
|
-
|
|
109
|
+
h.displayName = a.Description.displayName;
|
|
110
110
|
export {
|
|
111
|
-
|
|
111
|
+
b as Dialog,
|
|
112
112
|
R as DialogClose,
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
g as DialogContent,
|
|
114
|
+
h as DialogDescription,
|
|
115
115
|
x as DialogFooter,
|
|
116
116
|
y as DialogHeader,
|
|
117
117
|
c as DialogOverlay,
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
f as DialogPortal,
|
|
119
|
+
N as DialogTitle,
|
|
120
120
|
C as DialogTrigger
|
|
121
121
|
};
|
|
@@ -44,7 +44,7 @@ const n = ({
|
|
|
44
44
|
}
|
|
45
45
|
);
|
|
46
46
|
n.displayName = "Drawer";
|
|
47
|
-
const Y = e.Trigger,
|
|
47
|
+
const Y = e.Trigger, c = e.Portal, Z = e.Close, s = m.forwardRef(({ className: r, ...t }, a) => /* @__PURE__ */ o(
|
|
48
48
|
e.Overlay,
|
|
49
49
|
{
|
|
50
50
|
ref: a,
|
|
@@ -53,7 +53,7 @@ const Y = e.Trigger, d = e.Portal, Z = e.Close, s = m.forwardRef(({ className: r
|
|
|
53
53
|
}
|
|
54
54
|
));
|
|
55
55
|
s.displayName = e.Overlay.displayName;
|
|
56
|
-
const
|
|
56
|
+
const d = m.forwardRef(({ className: r, children: t, ...a }, l) => /* @__PURE__ */ p(c, { children: [
|
|
57
57
|
/* @__PURE__ */ o(s, {}),
|
|
58
58
|
/* @__PURE__ */ p(
|
|
59
59
|
e.Content,
|
|
@@ -71,7 +71,7 @@ const c = m.forwardRef(({ className: r, children: t, ...a }, l) => /* @__PURE__
|
|
|
71
71
|
}
|
|
72
72
|
)
|
|
73
73
|
] }));
|
|
74
|
-
|
|
74
|
+
d.displayName = "DrawerContent";
|
|
75
75
|
const f = ({
|
|
76
76
|
className: r,
|
|
77
77
|
...t
|
|
@@ -110,7 +110,7 @@ const x = m.forwardRef(({ className: r, ...t }, a) => /* @__PURE__ */ o(
|
|
|
110
110
|
e.Description,
|
|
111
111
|
{
|
|
112
112
|
ref: a,
|
|
113
|
-
className: i("text-sm text-
|
|
113
|
+
className: i("text-sm text-tertiary", r),
|
|
114
114
|
...t
|
|
115
115
|
}
|
|
116
116
|
));
|
|
@@ -118,12 +118,12 @@ x.displayName = e.Description.displayName;
|
|
|
118
118
|
export {
|
|
119
119
|
n as Drawer,
|
|
120
120
|
Z as DrawerClose,
|
|
121
|
-
|
|
121
|
+
d as DrawerContent,
|
|
122
122
|
x as DrawerDescription,
|
|
123
123
|
w as DrawerFooter,
|
|
124
124
|
f as DrawerHeader,
|
|
125
125
|
s as DrawerOverlay,
|
|
126
|
-
|
|
126
|
+
c as DrawerPortal,
|
|
127
127
|
D as DrawerTitle,
|
|
128
128
|
Y as DrawerTrigger
|
|
129
129
|
};
|
|
@@ -2,47 +2,47 @@ import { jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import * as a from "react";
|
|
3
3
|
import * as o from "@radix-ui/react-dropdown-menu";
|
|
4
4
|
import { cn as i } from "../lib/utils.js";
|
|
5
|
-
import { motion as
|
|
6
|
-
const w = o.Root, y = o.Trigger,
|
|
5
|
+
import { motion as m } from "framer-motion";
|
|
6
|
+
const w = o.Root, y = o.Trigger, x = o.Group, D = o.Separator, p = a.forwardRef(({ className: r, sideOffset: t = 4, children: n, ...d }, s) => /* @__PURE__ */ e(o.Portal, { children: /* @__PURE__ */ e(
|
|
7
7
|
o.Content,
|
|
8
8
|
{
|
|
9
9
|
ref: s,
|
|
10
|
-
sideOffset:
|
|
10
|
+
sideOffset: t,
|
|
11
11
|
...d,
|
|
12
12
|
children: /* @__PURE__ */ e(
|
|
13
|
-
|
|
13
|
+
m.div,
|
|
14
14
|
{
|
|
15
15
|
initial: { opacity: 0, scale: 0.95 },
|
|
16
16
|
animate: { opacity: 1, scale: 1 },
|
|
17
17
|
exit: { opacity: 0, scale: 0.95 },
|
|
18
18
|
transition: { duration: 0.2 },
|
|
19
19
|
className: i(
|
|
20
|
-
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-
|
|
21
|
-
|
|
20
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-card p-1 text-primary shadow-md",
|
|
21
|
+
r
|
|
22
22
|
),
|
|
23
23
|
children: n
|
|
24
24
|
}
|
|
25
25
|
)
|
|
26
26
|
}
|
|
27
27
|
) }));
|
|
28
|
-
|
|
29
|
-
const
|
|
28
|
+
p.displayName = o.Content.displayName;
|
|
29
|
+
const c = a.forwardRef(({ className: r, ...t }, n) => /* @__PURE__ */ e(
|
|
30
30
|
o.Item,
|
|
31
31
|
{
|
|
32
32
|
ref: n,
|
|
33
33
|
className: i(
|
|
34
|
-
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-
|
|
35
|
-
|
|
34
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-hover focus:text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
35
|
+
r
|
|
36
36
|
),
|
|
37
|
-
...
|
|
37
|
+
...t
|
|
38
38
|
}
|
|
39
39
|
));
|
|
40
|
-
|
|
40
|
+
c.displayName = o.Item.displayName;
|
|
41
41
|
export {
|
|
42
42
|
w as DropdownMenu,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
p as DropdownMenuContent,
|
|
44
|
+
x as DropdownMenuGroup,
|
|
45
|
+
c as DropdownMenuItem,
|
|
46
|
+
D as DropdownMenuSeparator,
|
|
47
47
|
y as DropdownMenuTrigger
|
|
48
48
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
1
|
+
import { jsx as s, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import { useState as x, useRef as L, useCallback as m, useEffect as E } from "react";
|
|
3
3
|
import { Button as P } from "./button.js";
|
|
4
4
|
import { Modal as q } from "./modal.js";
|
|
@@ -6,13 +6,13 @@ import { Label as T } from "./label.js";
|
|
|
6
6
|
import { RotateCcw as K, X as F, Check as G } from "lucide-react";
|
|
7
7
|
function O({
|
|
8
8
|
isOpen: g,
|
|
9
|
-
onClose:
|
|
9
|
+
onClose: y,
|
|
10
10
|
imageSrc: f,
|
|
11
11
|
onCrop: j,
|
|
12
12
|
title: U = "Crop Your Image",
|
|
13
|
-
outputSize:
|
|
13
|
+
outputSize: d = 200
|
|
14
14
|
}) {
|
|
15
|
-
const [t, w] = x({ x: 0, y: 0, size: 100 }), [N,
|
|
15
|
+
const [t, w] = x({ x: 0, y: 0, size: 100 }), [N, v] = x(!1), [C, z] = x(!1), [k, X] = x({ x: 0, y: 0 }), [r, Y] = x({ width: 0, height: 0 }), D = L(null), p = L(null), A = m(() => {
|
|
16
16
|
if (p.current) {
|
|
17
17
|
const e = p.current, o = 400, a = e.naturalWidth / e.naturalHeight;
|
|
18
18
|
let n, i;
|
|
@@ -32,7 +32,7 @@ function O({
|
|
|
32
32
|
const l = t.x + t.size / 2, u = t.y + t.size / 2, c = Math.sqrt((n - l) ** 2 + (i - u) ** 2);
|
|
33
33
|
X({ x: c, y: 0 });
|
|
34
34
|
} else
|
|
35
|
-
|
|
35
|
+
v(!0), X({ x: n - t.x, y: i - t.y });
|
|
36
36
|
}, [t]), B = m((e) => {
|
|
37
37
|
if (!N && !C) return;
|
|
38
38
|
const o = e.currentTarget.getBoundingClientRect(), a = e.clientX - o.left, n = e.clientY - o.top;
|
|
@@ -52,7 +52,7 @@ function O({
|
|
|
52
52
|
}));
|
|
53
53
|
}
|
|
54
54
|
}, [N, C, k, r, t]), $ = m(() => {
|
|
55
|
-
|
|
55
|
+
v(!1), z(!1);
|
|
56
56
|
}, []), H = m(() => {
|
|
57
57
|
if (r.width && r.height) {
|
|
58
58
|
const e = Math.min(r.width, r.height) * 0.6;
|
|
@@ -67,9 +67,9 @@ function O({
|
|
|
67
67
|
const e = D.current, o = e.getContext("2d");
|
|
68
68
|
if (!o) return;
|
|
69
69
|
const a = p.current;
|
|
70
|
-
e.width =
|
|
70
|
+
e.width = d, e.height = d;
|
|
71
71
|
const n = a.naturalWidth / r.width, i = a.naturalHeight / r.height, l = t.x * n, u = t.y * i, c = t.size * Math.min(n, i);
|
|
72
|
-
o.beginPath(), o.arc(
|
|
72
|
+
o.beginPath(), o.arc(d / 2, d / 2, d / 2, 0, Math.PI * 2), o.clip(), o.drawImage(
|
|
73
73
|
a,
|
|
74
74
|
l,
|
|
75
75
|
u,
|
|
@@ -77,21 +77,21 @@ function O({
|
|
|
77
77
|
c,
|
|
78
78
|
0,
|
|
79
79
|
0,
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
d,
|
|
81
|
+
d
|
|
82
82
|
);
|
|
83
83
|
const R = e.toDataURL("image/png");
|
|
84
|
-
j(R),
|
|
85
|
-
}, [t, r, j,
|
|
86
|
-
|
|
87
|
-
}, [
|
|
84
|
+
j(R), y();
|
|
85
|
+
}, [t, r, j, y, d]), M = m(() => {
|
|
86
|
+
v(!1), z(!1), w({ x: 0, y: 0, size: 100 }), y();
|
|
87
|
+
}, [y]), I = m((e) => {
|
|
88
88
|
e.key === "Escape" && g && (e.stopPropagation(), M());
|
|
89
89
|
}, [g, M]);
|
|
90
90
|
return E(() => {
|
|
91
91
|
if (g)
|
|
92
92
|
return document.addEventListener("keydown", I, !0), () => document.removeEventListener("keydown", I, !0);
|
|
93
93
|
}, [g, I]), E(() => {
|
|
94
|
-
g && f && (
|
|
94
|
+
g && f && (v(!1), z(!1), Y({ width: 0, height: 0 }));
|
|
95
95
|
}, [g, f]), f ? /* @__PURE__ */ s(
|
|
96
96
|
q,
|
|
97
97
|
{
|
|
@@ -100,8 +100,8 @@ function O({
|
|
|
100
100
|
title: U,
|
|
101
101
|
size: "2xl",
|
|
102
102
|
zIndexClassName: "z-[60]",
|
|
103
|
-
footer: /* @__PURE__ */
|
|
104
|
-
/* @__PURE__ */
|
|
103
|
+
footer: /* @__PURE__ */ h("div", { className: "flex items-center justify-between w-full", children: [
|
|
104
|
+
/* @__PURE__ */ h(
|
|
105
105
|
P,
|
|
106
106
|
{
|
|
107
107
|
variant: "ghost",
|
|
@@ -114,21 +114,21 @@ function O({
|
|
|
114
114
|
]
|
|
115
115
|
}
|
|
116
116
|
),
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ h("div", { className: "flex gap-3", children: [
|
|
118
|
+
/* @__PURE__ */ h(P, { variant: "outline", onClick: M, children: [
|
|
119
119
|
/* @__PURE__ */ s(F, { className: "h-4 w-4 mr-2" }),
|
|
120
120
|
"Cancel"
|
|
121
121
|
] }),
|
|
122
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ h(P, { onClick: W, children: [
|
|
123
123
|
/* @__PURE__ */ s(G, { className: "h-4 w-4 mr-2" }),
|
|
124
124
|
"Crop Image"
|
|
125
125
|
] })
|
|
126
126
|
] })
|
|
127
127
|
] }),
|
|
128
|
-
children: /* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */
|
|
130
|
-
/* @__PURE__ */ s("div", { className: "text-center", children: /* @__PURE__ */ s("p", { className: "text-sm text-
|
|
131
|
-
/* @__PURE__ */ s("div", { className: "flex justify-center", children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ h("div", { className: "p-6", children: [
|
|
129
|
+
/* @__PURE__ */ h("div", { className: "space-y-6", children: [
|
|
130
|
+
/* @__PURE__ */ s("div", { className: "text-center", children: /* @__PURE__ */ s("p", { className: "text-sm text-tertiary", children: "Drag the circle to move • Drag corners to resize • Click reset to center" }) }),
|
|
131
|
+
/* @__PURE__ */ s("div", { className: "flex justify-center", children: /* @__PURE__ */ h(
|
|
132
132
|
"div",
|
|
133
133
|
{
|
|
134
134
|
className: "relative bg-gray-100 rounded-xl overflow-hidden select-none border",
|
|
@@ -149,7 +149,7 @@ function O({
|
|
|
149
149
|
draggable: !1
|
|
150
150
|
}
|
|
151
151
|
),
|
|
152
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ h(
|
|
153
153
|
"div",
|
|
154
154
|
{
|
|
155
155
|
className: "absolute border-2 border-white rounded-full shadow-lg cursor-move",
|
|
@@ -217,8 +217,8 @@ function O({
|
|
|
217
217
|
]
|
|
218
218
|
}
|
|
219
219
|
) }),
|
|
220
|
-
/* @__PURE__ */ s("div", { className: "flex justify-center", children: /* @__PURE__ */
|
|
221
|
-
/* @__PURE__ */ s(T, { className: "text-xs font-medium text-
|
|
220
|
+
/* @__PURE__ */ s("div", { className: "flex justify-center", children: /* @__PURE__ */ h("div", { className: "text-center", children: [
|
|
221
|
+
/* @__PURE__ */ s(T, { className: "text-xs font-medium text-tertiary mb-2 block", children: "Preview" }),
|
|
222
222
|
/* @__PURE__ */ s(
|
|
223
223
|
"div",
|
|
224
224
|
{
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as h, useRef as S, useCallback as
|
|
1
|
+
import { jsxs as l, Fragment as j, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h, useRef as S, useCallback as s } from "react";
|
|
3
3
|
import { Button as f } from "./button.js";
|
|
4
4
|
import { RotateCw as F, X as O, Upload as U } from "lucide-react";
|
|
5
5
|
import { ImageCropperModal as A } from "./image-cropper-modal.js";
|
|
6
6
|
import { cn as E } from "../lib/utils.js";
|
|
7
7
|
function Y({
|
|
8
8
|
value: c,
|
|
9
|
-
onChange:
|
|
9
|
+
onChange: o,
|
|
10
10
|
size: i = 120,
|
|
11
11
|
className: g,
|
|
12
12
|
placeholder: b = "Upload Image",
|
|
13
13
|
title: v = "Crop Your Image",
|
|
14
14
|
outputSize: x = 200
|
|
15
15
|
}) {
|
|
16
|
-
const [C, m] = h(!1), [
|
|
16
|
+
const [C, m] = h(!1), [y, n] = h(null), a = S(null), N = s((r) => {
|
|
17
17
|
var d;
|
|
18
18
|
const t = (d = r.target.files) == null ? void 0 : d[0];
|
|
19
19
|
if (t) {
|
|
@@ -21,20 +21,20 @@ function Y({
|
|
|
21
21
|
p.onload = (k) => {
|
|
22
22
|
var u;
|
|
23
23
|
const M = (u = k.target) == null ? void 0 : u.result;
|
|
24
|
-
|
|
24
|
+
n(M), m(!0);
|
|
25
25
|
}, p.readAsDataURL(t);
|
|
26
26
|
}
|
|
27
27
|
r.target.value = "";
|
|
28
|
-
}, []),
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
m(!1),
|
|
32
|
-
}, []), R =
|
|
33
|
-
|
|
34
|
-
}, [
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
c ? /* @__PURE__ */
|
|
28
|
+
}, []), w = s((r) => {
|
|
29
|
+
o(r), n(null);
|
|
30
|
+
}, [o]), I = s(() => {
|
|
31
|
+
m(!1), n(null), a.current && (a.current.value = "");
|
|
32
|
+
}, []), R = s(() => {
|
|
33
|
+
o(null);
|
|
34
|
+
}, [o]);
|
|
35
|
+
return /* @__PURE__ */ l(j, { children: [
|
|
36
|
+
/* @__PURE__ */ l("div", { className: E("space-y-3", g), children: [
|
|
37
|
+
c ? /* @__PURE__ */ l("div", { className: "flex flex-col items-center gap-3", children: [
|
|
38
38
|
/* @__PURE__ */ e(
|
|
39
39
|
"div",
|
|
40
40
|
{
|
|
@@ -50,15 +50,15 @@ function Y({
|
|
|
50
50
|
)
|
|
51
51
|
}
|
|
52
52
|
),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ l("div", { className: "flex gap-2", children: [
|
|
54
|
+
/* @__PURE__ */ l(
|
|
55
55
|
f,
|
|
56
56
|
{
|
|
57
57
|
variant: "outline",
|
|
58
58
|
size: "sm",
|
|
59
59
|
onClick: (r) => {
|
|
60
60
|
var t;
|
|
61
|
-
r.stopPropagation(), (t =
|
|
61
|
+
r.stopPropagation(), (t = a.current) == null || t.click();
|
|
62
62
|
},
|
|
63
63
|
children: [
|
|
64
64
|
/* @__PURE__ */ e(F, { className: "h-3 w-3 mr-1" }),
|
|
@@ -66,7 +66,7 @@ function Y({
|
|
|
66
66
|
]
|
|
67
67
|
}
|
|
68
68
|
),
|
|
69
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ l(
|
|
70
70
|
f,
|
|
71
71
|
{
|
|
72
72
|
variant: "outline",
|
|
@@ -79,12 +79,12 @@ function Y({
|
|
|
79
79
|
}
|
|
80
80
|
)
|
|
81
81
|
] })
|
|
82
|
-
] }) : /* @__PURE__ */
|
|
82
|
+
] }) : /* @__PURE__ */ l(
|
|
83
83
|
"button",
|
|
84
84
|
{
|
|
85
85
|
onClick: (r) => {
|
|
86
86
|
var t;
|
|
87
|
-
r.stopPropagation(), (t =
|
|
87
|
+
r.stopPropagation(), (t = a.current) == null || t.click();
|
|
88
88
|
},
|
|
89
89
|
className: "w-full border-2 border-dashed border-light rounded-lg p-6 hover:border-primary/50 hover:bg-primary/2 transition-colors group",
|
|
90
90
|
children: [
|
|
@@ -96,18 +96,18 @@ function Y({
|
|
|
96
96
|
children: /* @__PURE__ */ e(U, { className: "h-6 w-6 text-primary" })
|
|
97
97
|
}
|
|
98
98
|
),
|
|
99
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-
|
|
100
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-
|
|
99
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-primary mb-1", children: b }),
|
|
100
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-tertiary", children: "Click to browse" })
|
|
101
101
|
]
|
|
102
102
|
}
|
|
103
103
|
),
|
|
104
104
|
/* @__PURE__ */ e(
|
|
105
105
|
"input",
|
|
106
106
|
{
|
|
107
|
-
ref:
|
|
107
|
+
ref: a,
|
|
108
108
|
type: "file",
|
|
109
109
|
accept: "image/*",
|
|
110
|
-
onChange:
|
|
110
|
+
onChange: N,
|
|
111
111
|
className: "hidden"
|
|
112
112
|
}
|
|
113
113
|
)
|
|
@@ -117,8 +117,8 @@ function Y({
|
|
|
117
117
|
{
|
|
118
118
|
isOpen: C,
|
|
119
119
|
onClose: I,
|
|
120
|
-
imageSrc:
|
|
121
|
-
onCrop:
|
|
120
|
+
imageSrc: y,
|
|
121
|
+
onCrop: w,
|
|
122
122
|
title: v,
|
|
123
123
|
outputSize: x
|
|
124
124
|
}
|
package/dist/components/input.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { cn as
|
|
4
|
-
const l =
|
|
5
|
-
({ className: r, type: o, ...
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { cn as d } from "../lib/utils.js";
|
|
4
|
+
const l = i.forwardRef(
|
|
5
|
+
({ className: r, type: o, ...t }, e) => /* @__PURE__ */ a(
|
|
6
6
|
"input",
|
|
7
7
|
{
|
|
8
8
|
type: o,
|
|
9
|
-
className:
|
|
10
|
-
"h-10 w-full rounded-lg border-2 border-light bg-secondary px-4 py-2 text-sm text-
|
|
9
|
+
className: d(
|
|
10
|
+
"h-10 w-full rounded-lg border-2 border-light bg-secondary px-4 py-2 text-sm text-primary outline-none transition-colors placeholder:text-tertiary focus:border-primary disabled:cursor-not-allowed disabled:opacity-50",
|
|
11
11
|
r
|
|
12
12
|
),
|
|
13
|
-
ref:
|
|
14
|
-
...
|
|
13
|
+
ref: e,
|
|
14
|
+
...t
|
|
15
15
|
}
|
|
16
16
|
)
|
|
17
17
|
);
|
|
@@ -16,7 +16,7 @@ function h({
|
|
|
16
16
|
sm: "gap-0.5",
|
|
17
17
|
md: "gap-1",
|
|
18
18
|
lg: "gap-1.5"
|
|
19
|
-
},
|
|
19
|
+
}, y = {
|
|
20
20
|
hidden: { opacity: 0, y: 20 },
|
|
21
21
|
visible: (i) => ({
|
|
22
22
|
opacity: 1,
|
|
@@ -32,7 +32,7 @@ function h({
|
|
|
32
32
|
a.div,
|
|
33
33
|
{
|
|
34
34
|
custom: i,
|
|
35
|
-
variants:
|
|
35
|
+
variants: y,
|
|
36
36
|
initial: "hidden",
|
|
37
37
|
animate: "visible",
|
|
38
38
|
className: `${o[n]} rounded-full ${m ? "bg-primary/80" : "bg-primary/60"}`
|
|
@@ -56,7 +56,7 @@ function h({
|
|
|
56
56
|
transition: { delay: 0.3, duration: 0.3 },
|
|
57
57
|
children: [
|
|
58
58
|
/* @__PURE__ */ e("h2", { className: "text-lg font-medium mb-2", children: c }),
|
|
59
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-
|
|
59
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-tertiary", children: d })
|
|
60
60
|
]
|
|
61
61
|
}
|
|
62
62
|
)
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as o, Fragment as a } from "react/jsx-runtime";
|
|
2
|
-
import { cn as
|
|
2
|
+
import { cn as f } from "../lib/utils.js";
|
|
3
3
|
function b({
|
|
4
4
|
className: t,
|
|
5
5
|
count: n = 1,
|
|
6
6
|
animate: e = !0,
|
|
7
7
|
variant: r = "shimmer"
|
|
8
8
|
}) {
|
|
9
|
-
return /* @__PURE__ */ o(a, { children: Array.from({ length: n }).map((
|
|
9
|
+
return /* @__PURE__ */ o(a, { children: Array.from({ length: n }).map((m, i) => /* @__PURE__ */ o(
|
|
10
10
|
"div",
|
|
11
11
|
{
|
|
12
|
-
className:
|
|
13
|
-
"relative overflow-hidden bg-
|
|
12
|
+
className: f(
|
|
13
|
+
"relative overflow-hidden bg-hover/30 rounded",
|
|
14
14
|
e && r === "shimmer" && "before:absolute before:inset-0 before:-translate-x-full before:animate-[shimmer_2s_infinite] before:bg-gradient-to-r before:from-transparent before:via-white/10 before:to-transparent",
|
|
15
15
|
e && r === "pulse" && "animate-pulse",
|
|
16
16
|
t
|