@definable/ui 0.1.30 → 0.1.32
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.js +10 -10
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.ts +11 -10
- package/dist/components/button.js +56 -47
- package/dist/components/card.js +24 -24
- package/dist/components/command-menu.js +14 -14
- package/dist/components/command.d.ts +7 -7
- package/dist/components/command.js +5 -5
- package/dist/components/dialog.js +12 -12
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropzone.js +3 -3
- package/dist/components/image-cropper-modal.js +33 -33
- package/dist/components/image-cropper.js +35 -35
- package/dist/components/input.js +1 -1
- package/dist/components/loader.js +1 -1
- package/dist/components/modal.js +28 -28
- package/dist/components/picker.js +2 -2
- package/dist/components/select.js +4 -4
- package/dist/components/selection-bar.js +1 -1
- package/dist/components/sheet.js +28 -28
- package/dist/components/slider.js +5 -5
- package/dist/components/switch.js +1 -1
- package/dist/components/table-mobile.js +37 -37
- package/dist/components/table.js +32 -32
- package/dist/components/tabs.js +1 -1
- package/dist/components/textarea.js +6 -6
- package/dist/components/tooltip.js +5 -5
- package/dist/components/use-toast.js +3 -3
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -12,46 +12,46 @@ function O({
|
|
|
12
12
|
title: U = "Crop Your Image",
|
|
13
13
|
outputSize: h = 200
|
|
14
14
|
}) {
|
|
15
|
-
const [t, w] = x({ x: 0, y: 0, size: 100 }), [N, y] = x(!1), [
|
|
16
|
-
if (
|
|
17
|
-
const e =
|
|
18
|
-
let n,
|
|
19
|
-
a > 1 ? (n =
|
|
20
|
-
const l = Math.min(n,
|
|
15
|
+
const [t, w] = x({ x: 0, y: 0, size: 100 }), [N, y] = 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
|
+
if (p.current) {
|
|
17
|
+
const e = p.current, o = 400, a = e.naturalWidth / e.naturalHeight;
|
|
18
|
+
let n, i;
|
|
19
|
+
a > 1 ? (n = o, i = o / a) : (i = o, n = o * a), Y({ width: n, height: i });
|
|
20
|
+
const l = Math.min(n, i) * 0.6;
|
|
21
21
|
w({
|
|
22
22
|
x: (n - l) / 2,
|
|
23
|
-
y: (
|
|
23
|
+
y: (i - l) / 2,
|
|
24
24
|
size: l
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
}, []),
|
|
27
|
+
}, []), b = m((e, o) => {
|
|
28
28
|
e.preventDefault();
|
|
29
|
-
const a = e.currentTarget.getBoundingClientRect(), n = e.clientX - a.left,
|
|
30
|
-
if (
|
|
29
|
+
const a = e.currentTarget.getBoundingClientRect(), n = e.clientX - a.left, i = e.clientY - a.top;
|
|
30
|
+
if (o === "resize") {
|
|
31
31
|
z(!0);
|
|
32
|
-
const l = t.x + t.size / 2, u = t.y + t.size / 2, c = Math.sqrt((n - l) ** 2 + (
|
|
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
|
-
y(!0), X({ x: n - t.x, y:
|
|
35
|
+
y(!0), X({ x: n - t.x, y: i - t.y });
|
|
36
36
|
}, [t]), B = m((e) => {
|
|
37
|
-
if (!N && !
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
const
|
|
37
|
+
if (!N && !C) return;
|
|
38
|
+
const o = e.currentTarget.getBoundingClientRect(), a = e.clientX - o.left, n = e.clientY - o.top;
|
|
39
|
+
if (C) {
|
|
40
|
+
const i = t.x + t.size / 2, l = t.y + t.size / 2, u = Math.sqrt((a - i) ** 2 + (n - l) ** 2), c = Math.max(50, Math.min(Math.min(r.width, r.height), u * 2));
|
|
41
41
|
w({
|
|
42
|
-
x: Math.max(0, Math.min(r.width - c,
|
|
42
|
+
x: Math.max(0, Math.min(r.width - c, i - c / 2)),
|
|
43
43
|
y: Math.max(0, Math.min(r.height - c, l - c / 2)),
|
|
44
44
|
size: c
|
|
45
45
|
});
|
|
46
46
|
} else if (N) {
|
|
47
|
-
const
|
|
47
|
+
const i = a - k.x, l = n - k.y, u = r.width - t.size, c = r.height - t.size;
|
|
48
48
|
w((R) => ({
|
|
49
49
|
...R,
|
|
50
|
-
x: Math.max(0, Math.min(u,
|
|
50
|
+
x: Math.max(0, Math.min(u, i)),
|
|
51
51
|
y: Math.max(0, Math.min(c, l))
|
|
52
52
|
}));
|
|
53
53
|
}
|
|
54
|
-
}, [N,
|
|
54
|
+
}, [N, C, k, r, t]), $ = m(() => {
|
|
55
55
|
y(!1), z(!1);
|
|
56
56
|
}, []), H = m(() => {
|
|
57
57
|
if (r.width && r.height) {
|
|
@@ -63,13 +63,13 @@ function O({
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
}, [r]), W = m(() => {
|
|
66
|
-
if (!D.current || !
|
|
67
|
-
const e = D.current,
|
|
68
|
-
if (!
|
|
69
|
-
const a =
|
|
66
|
+
if (!D.current || !p.current) return;
|
|
67
|
+
const e = D.current, o = e.getContext("2d");
|
|
68
|
+
if (!o) return;
|
|
69
|
+
const a = p.current;
|
|
70
70
|
e.width = h, e.height = h;
|
|
71
|
-
const n = a.naturalWidth / r.width,
|
|
72
|
-
|
|
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(h / 2, h / 2, h / 2, 0, Math.PI * 2), o.clip(), o.drawImage(
|
|
73
73
|
a,
|
|
74
74
|
l,
|
|
75
75
|
u,
|
|
@@ -140,7 +140,7 @@ function O({
|
|
|
140
140
|
/* @__PURE__ */ s(
|
|
141
141
|
"img",
|
|
142
142
|
{
|
|
143
|
-
ref:
|
|
143
|
+
ref: p,
|
|
144
144
|
src: f,
|
|
145
145
|
alt: "Crop preview",
|
|
146
146
|
className: "block",
|
|
@@ -159,7 +159,7 @@ function O({
|
|
|
159
159
|
width: t.size,
|
|
160
160
|
height: t.size
|
|
161
161
|
},
|
|
162
|
-
onMouseDown: (e) =>
|
|
162
|
+
onMouseDown: (e) => b(e, "move"),
|
|
163
163
|
children: [
|
|
164
164
|
/* @__PURE__ */ s("div", { className: "w-full h-full rounded-full border-2 border-primary border-dashed" }),
|
|
165
165
|
/* @__PURE__ */ s(
|
|
@@ -167,7 +167,7 @@ function O({
|
|
|
167
167
|
{
|
|
168
168
|
className: "absolute w-5 h-5 bg-white border-2 border-primary rounded-full shadow-lg cursor-nw-resize -top-2.5 -right-2.5 hover:bg-primary hover:border-white transition-colors flex items-center justify-center",
|
|
169
169
|
onMouseDown: (e) => {
|
|
170
|
-
e.stopPropagation(),
|
|
170
|
+
e.stopPropagation(), b(e, "resize");
|
|
171
171
|
},
|
|
172
172
|
children: /* @__PURE__ */ s("div", { className: "w-1.5 h-1.5 bg-primary rounded-full hover:bg-white transition-colors" })
|
|
173
173
|
}
|
|
@@ -177,7 +177,7 @@ function O({
|
|
|
177
177
|
{
|
|
178
178
|
className: "absolute w-5 h-5 bg-white border-2 border-primary rounded-full shadow-lg cursor-ne-resize -bottom-2.5 -right-2.5 hover:bg-primary hover:border-white transition-colors flex items-center justify-center",
|
|
179
179
|
onMouseDown: (e) => {
|
|
180
|
-
e.stopPropagation(),
|
|
180
|
+
e.stopPropagation(), b(e, "resize");
|
|
181
181
|
},
|
|
182
182
|
children: /* @__PURE__ */ s("div", { className: "w-1.5 h-1.5 bg-primary rounded-full hover:bg-white transition-colors" })
|
|
183
183
|
}
|
|
@@ -187,7 +187,7 @@ function O({
|
|
|
187
187
|
{
|
|
188
188
|
className: "absolute w-5 h-5 bg-white border-2 border-primary rounded-full shadow-lg cursor-sw-resize -bottom-2.5 -left-2.5 hover:bg-primary hover:border-white transition-colors flex items-center justify-center",
|
|
189
189
|
onMouseDown: (e) => {
|
|
190
|
-
e.stopPropagation(),
|
|
190
|
+
e.stopPropagation(), b(e, "resize");
|
|
191
191
|
},
|
|
192
192
|
children: /* @__PURE__ */ s("div", { className: "w-1.5 h-1.5 bg-primary rounded-full hover:bg-white transition-colors" })
|
|
193
193
|
}
|
|
@@ -197,7 +197,7 @@ function O({
|
|
|
197
197
|
{
|
|
198
198
|
className: "absolute w-5 h-5 bg-white border-2 border-primary rounded-full shadow-lg cursor-se-resize -top-2.5 -left-2.5 hover:bg-primary hover:border-white transition-colors flex items-center justify-center",
|
|
199
199
|
onMouseDown: (e) => {
|
|
200
|
-
e.stopPropagation(),
|
|
200
|
+
e.stopPropagation(), b(e, "resize");
|
|
201
201
|
},
|
|
202
202
|
children: /* @__PURE__ */ s("div", { className: "w-1.5 h-1.5 bg-primary rounded-full hover:bg-white transition-colors" })
|
|
203
203
|
}
|
|
@@ -222,7 +222,7 @@ function O({
|
|
|
222
222
|
/* @__PURE__ */ s(
|
|
223
223
|
"div",
|
|
224
224
|
{
|
|
225
|
-
className: "rounded-full border-2 border-
|
|
225
|
+
className: "rounded-full border-2 border-light bg-secondary overflow-hidden mx-auto",
|
|
226
226
|
style: { width: 80, height: 80 },
|
|
227
227
|
children: /* @__PURE__ */ s(
|
|
228
228
|
"div",
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Button as
|
|
1
|
+
import { jsxs as o, Fragment as j, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h, useRef as S, useCallback as n } from "react";
|
|
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
9
|
onChange: a,
|
|
10
|
-
size:
|
|
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,
|
|
17
|
-
var
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
16
|
+
const [C, m] = h(!1), [N, s] = h(null), l = S(null), w = n((r) => {
|
|
17
|
+
var d;
|
|
18
|
+
const t = (d = r.target.files) == null ? void 0 : d[0];
|
|
19
|
+
if (t) {
|
|
20
20
|
const p = new FileReader();
|
|
21
|
-
p.onload = (
|
|
21
|
+
p.onload = (k) => {
|
|
22
22
|
var u;
|
|
23
|
-
const M = (u =
|
|
24
|
-
s(M),
|
|
25
|
-
}, p.readAsDataURL(
|
|
23
|
+
const M = (u = k.target) == null ? void 0 : u.result;
|
|
24
|
+
s(M), m(!0);
|
|
25
|
+
}, p.readAsDataURL(t);
|
|
26
26
|
}
|
|
27
27
|
r.target.value = "";
|
|
28
|
-
}, []), y =
|
|
28
|
+
}, []), y = n((r) => {
|
|
29
29
|
a(r), s(null);
|
|
30
|
-
}, [a]),
|
|
31
|
-
|
|
32
|
-
}, []),
|
|
30
|
+
}, [a]), I = n(() => {
|
|
31
|
+
m(!1), s(null), l.current && (l.current.value = "");
|
|
32
|
+
}, []), R = n(() => {
|
|
33
33
|
a(null);
|
|
34
34
|
}, [a]);
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
c ? /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ o(j, { children: [
|
|
36
|
+
/* @__PURE__ */ o("div", { className: E("space-y-3", g), children: [
|
|
37
|
+
c ? /* @__PURE__ */ o("div", { className: "flex flex-col items-center gap-3", children: [
|
|
38
38
|
/* @__PURE__ */ e(
|
|
39
39
|
"div",
|
|
40
40
|
{
|
|
41
|
-
className: "rounded-full border-2 border-
|
|
42
|
-
style: { width:
|
|
41
|
+
className: "rounded-full border-2 border-light overflow-hidden bg-secondary",
|
|
42
|
+
style: { width: i, height: i },
|
|
43
43
|
children: /* @__PURE__ */ e(
|
|
44
44
|
"img",
|
|
45
45
|
{
|
|
@@ -50,15 +50,15 @@ function Y({
|
|
|
50
50
|
)
|
|
51
51
|
}
|
|
52
52
|
),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
-
|
|
53
|
+
/* @__PURE__ */ o("div", { className: "flex gap-2", children: [
|
|
54
|
+
/* @__PURE__ */ o(
|
|
55
|
+
f,
|
|
56
56
|
{
|
|
57
57
|
variant: "outline",
|
|
58
58
|
size: "sm",
|
|
59
59
|
onClick: (r) => {
|
|
60
|
-
var
|
|
61
|
-
r.stopPropagation(), (
|
|
60
|
+
var t;
|
|
61
|
+
r.stopPropagation(), (t = l.current) == null || t.click();
|
|
62
62
|
},
|
|
63
63
|
children: [
|
|
64
64
|
/* @__PURE__ */ e(F, { className: "h-3 w-3 mr-1" }),
|
|
@@ -66,12 +66,12 @@ function Y({
|
|
|
66
66
|
]
|
|
67
67
|
}
|
|
68
68
|
),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
|
|
69
|
+
/* @__PURE__ */ o(
|
|
70
|
+
f,
|
|
71
71
|
{
|
|
72
72
|
variant: "outline",
|
|
73
73
|
size: "sm",
|
|
74
|
-
onClick:
|
|
74
|
+
onClick: R,
|
|
75
75
|
children: [
|
|
76
76
|
/* @__PURE__ */ e(O, { className: "h-3 w-3 mr-1" }),
|
|
77
77
|
"Remove"
|
|
@@ -79,20 +79,20 @@ function Y({
|
|
|
79
79
|
}
|
|
80
80
|
)
|
|
81
81
|
] })
|
|
82
|
-
] }) : /* @__PURE__ */
|
|
82
|
+
] }) : /* @__PURE__ */ o(
|
|
83
83
|
"button",
|
|
84
84
|
{
|
|
85
85
|
onClick: (r) => {
|
|
86
|
-
var
|
|
87
|
-
r.stopPropagation(), (
|
|
86
|
+
var t;
|
|
87
|
+
r.stopPropagation(), (t = l.current) == null || t.click();
|
|
88
88
|
},
|
|
89
|
-
className: "w-full border-2 border-dashed border-
|
|
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: [
|
|
91
91
|
/* @__PURE__ */ e(
|
|
92
92
|
"div",
|
|
93
93
|
{
|
|
94
94
|
className: "mx-auto rounded-full bg-primary/10 flex items-center justify-center group-hover:bg-primary/15 transition-colors mb-3",
|
|
95
|
-
style: { width: Math.min(
|
|
95
|
+
style: { width: Math.min(i / 2, 60), height: Math.min(i / 2, 60) },
|
|
96
96
|
children: /* @__PURE__ */ e(U, { className: "h-6 w-6 text-primary" })
|
|
97
97
|
}
|
|
98
98
|
),
|
|
@@ -116,7 +116,7 @@ function Y({
|
|
|
116
116
|
A,
|
|
117
117
|
{
|
|
118
118
|
isOpen: C,
|
|
119
|
-
onClose:
|
|
119
|
+
onClose: I,
|
|
120
120
|
imageSrc: N,
|
|
121
121
|
onCrop: y,
|
|
122
122
|
title: v,
|
package/dist/components/input.js
CHANGED
|
@@ -7,7 +7,7 @@ const l = n.forwardRef(
|
|
|
7
7
|
{
|
|
8
8
|
type: o,
|
|
9
9
|
className: a(
|
|
10
|
-
"h-10 w-full rounded-lg border-2 border-
|
|
10
|
+
"h-10 w-full rounded-lg border-2 border-light bg-secondary px-4 py-2 text-sm text-foreground outline-none transition-colors placeholder:text-muted-foreground focus:border-primary disabled:cursor-not-allowed disabled:opacity-50",
|
|
11
11
|
r
|
|
12
12
|
),
|
|
13
13
|
ref: t,
|
|
@@ -39,7 +39,7 @@ function h({
|
|
|
39
39
|
},
|
|
40
40
|
i
|
|
41
41
|
)) });
|
|
42
|
-
return s ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-
|
|
42
|
+
return s ? /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-secondary flex items-center justify-center z-[9999]", children: /* @__PURE__ */ r(
|
|
43
43
|
a.div,
|
|
44
44
|
{
|
|
45
45
|
className: "text-center",
|
package/dist/components/modal.js
CHANGED
|
@@ -30,55 +30,55 @@ function I({
|
|
|
30
30
|
onClose: i,
|
|
31
31
|
title: d,
|
|
32
32
|
description: a,
|
|
33
|
-
icon:
|
|
34
|
-
children:
|
|
35
|
-
footer:
|
|
33
|
+
icon: s,
|
|
34
|
+
children: x,
|
|
35
|
+
footer: n,
|
|
36
36
|
size: g = "md",
|
|
37
37
|
showClose: w = !0,
|
|
38
38
|
className: f,
|
|
39
|
-
isContentScrollable:
|
|
40
|
-
mainClassName:
|
|
41
|
-
contentClassName:
|
|
39
|
+
isContentScrollable: v = !0,
|
|
40
|
+
mainClassName: y,
|
|
41
|
+
contentClassName: N,
|
|
42
42
|
header: c,
|
|
43
|
-
headerClassName:
|
|
43
|
+
headerClassName: b,
|
|
44
44
|
zIndexClassName: k = "z-[50]",
|
|
45
45
|
mobileSheet: m
|
|
46
46
|
}) {
|
|
47
47
|
if (m != null && m.enable && r && window.innerWidth < 768) {
|
|
48
|
-
const { position:
|
|
48
|
+
const { position: h } = m;
|
|
49
49
|
return /* @__PURE__ */ e(
|
|
50
50
|
L,
|
|
51
51
|
{
|
|
52
52
|
isOpen: r,
|
|
53
53
|
onClose: i,
|
|
54
|
-
header: c || (d || a ||
|
|
55
|
-
|
|
54
|
+
header: c || (d || a || s ? /* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
|
|
55
|
+
s && /* @__PURE__ */ e("div", { className: "h-8 w-8 rounded-lg flex items-center justify-center", children: s }),
|
|
56
56
|
/* @__PURE__ */ t("div", { children: [
|
|
57
57
|
d && /* @__PURE__ */ e("h2", { className: "text-sm font-medium", children: d }),
|
|
58
58
|
a && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a })
|
|
59
59
|
] })
|
|
60
60
|
] }) : void 0),
|
|
61
|
-
footer: /* @__PURE__ */ e("div", { className: "flex gap-2 justify-end", children:
|
|
61
|
+
footer: /* @__PURE__ */ e("div", { className: "flex gap-2 justify-end", children: n }),
|
|
62
62
|
className: l(f, "w-full max-w-full"),
|
|
63
|
-
position:
|
|
64
|
-
headerClassName: l(
|
|
63
|
+
position: h || "bottom",
|
|
64
|
+
headerClassName: l(b, "w-full max-w-full"),
|
|
65
65
|
enableFullscreen: !1,
|
|
66
|
-
children:
|
|
66
|
+
children: x
|
|
67
67
|
}
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
|
-
const u = F((
|
|
71
|
-
|
|
70
|
+
const u = F((h) => {
|
|
71
|
+
h.key === "Escape" && r && i();
|
|
72
72
|
}, [r, i]);
|
|
73
73
|
H(() => (document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u)), [u]);
|
|
74
|
-
const o = d || a ||
|
|
74
|
+
const o = d || a || s || c, j = /* @__PURE__ */ e(E, { children: r && /* @__PURE__ */ e("div", { className: l("fixed inset-0 z-50 overflow-hidden", k), children: /* @__PURE__ */ t("div", { className: l("min-h-full flex items-center justify-center p-4", y), children: [
|
|
75
75
|
/* @__PURE__ */ e(
|
|
76
76
|
p.div,
|
|
77
77
|
{
|
|
78
78
|
initial: { opacity: 0 },
|
|
79
79
|
animate: { opacity: 1 },
|
|
80
80
|
exit: { opacity: 0 },
|
|
81
|
-
className: "fixed inset-0 bg-
|
|
81
|
+
className: "fixed inset-0 bg-secondary/80 backdrop-blur-sm",
|
|
82
82
|
onClick: i
|
|
83
83
|
}
|
|
84
84
|
),
|
|
@@ -90,14 +90,14 @@ function I({
|
|
|
90
90
|
exit: { opacity: 0, scale: 0.95 },
|
|
91
91
|
transition: { duration: 0.1, ease: "easeOut" },
|
|
92
92
|
className: l(
|
|
93
|
-
"relative transform rounded-lg bg-
|
|
93
|
+
"relative transform rounded-lg bg-secondary shadow-xl border border-light flex flex-col max-h-[85vh] overflow-hidden",
|
|
94
94
|
f
|
|
95
95
|
),
|
|
96
96
|
style: P(g),
|
|
97
97
|
children: [
|
|
98
|
-
o && /* @__PURE__ */ t("div", { className: "flex-shrink-0 rounded-t-lg bg-card flex items-center justify-between p-2 border-b border-
|
|
98
|
+
o && /* @__PURE__ */ t("div", { className: "flex-shrink-0 rounded-t-lg bg-card flex items-center justify-between p-2 border-b border-light", children: [
|
|
99
99
|
c || /* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
|
|
100
|
-
|
|
100
|
+
s && /* @__PURE__ */ e("div", { className: "h-8 w-8 rounded-lg flex items-center justify-center", children: s }),
|
|
101
101
|
/* @__PURE__ */ t("div", { children: [
|
|
102
102
|
d && /* @__PURE__ */ e("h2", { className: "text-sm font-small", children: d }),
|
|
103
103
|
a && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: a })
|
|
@@ -117,13 +117,13 @@ function I({
|
|
|
117
117
|
] }),
|
|
118
118
|
/* @__PURE__ */ e("div", { className: l(
|
|
119
119
|
"flex-1 min-h-0",
|
|
120
|
-
|
|
121
|
-
!
|
|
122
|
-
!
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
), children:
|
|
126
|
-
|
|
120
|
+
v ? "overflow-y-auto" : "",
|
|
121
|
+
!n && !o ? "rounded-lg" : "",
|
|
122
|
+
!n && o ? "rounded-b-lg" : "",
|
|
123
|
+
n && !o ? "rounded-t-lg" : "",
|
|
124
|
+
N
|
|
125
|
+
), children: x }),
|
|
126
|
+
n && /* @__PURE__ */ e("div", { className: "flex-shrink-0 flex items-center justify-end gap-2 px-4 py-3 border-t border-light bg-card rounded-b-lg", children: n })
|
|
127
127
|
]
|
|
128
128
|
}
|
|
129
129
|
)
|
|
@@ -28,7 +28,7 @@ function E({
|
|
|
28
28
|
"div",
|
|
29
29
|
{
|
|
30
30
|
className: l("cursor-pointer select-none", g),
|
|
31
|
-
children: f || /* @__PURE__ */ t("div", { className: "flex items-center justify-between p-3.5 bg-muted/20 hover:bg-muted/30 active:scale-[0.98] rounded-xl border border-
|
|
31
|
+
children: f || /* @__PURE__ */ t("div", { className: "flex items-center justify-between p-3.5 bg-muted/20 hover:bg-muted/30 active:scale-[0.98] rounded-xl border border-light transition-all group", children: [
|
|
32
32
|
/* @__PURE__ */ t("div", { className: "flex flex-col gap-0.5 text-left", children: [
|
|
33
33
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-black uppercase tracking-[0.2em] text-muted-foreground/45", children: n }),
|
|
34
34
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
@@ -45,7 +45,7 @@ function E({
|
|
|
45
45
|
) }),
|
|
46
46
|
/* @__PURE__ */ t(P, { children: [
|
|
47
47
|
/* @__PURE__ */ e(T, { children: /* @__PURE__ */ e(V, { children: n }) }),
|
|
48
|
-
/* @__PURE__ */ e("div", { className: "px-6 pt-0 space-y-5 pb-10", children: /* @__PURE__ */ t("div", { className: "relative h-[220px] bg-card
|
|
48
|
+
/* @__PURE__ */ e("div", { className: "px-6 pt-0 space-y-5 pb-10", children: /* @__PURE__ */ t("div", { className: "relative h-[220px] bg-card dark:bg-muted/10 rounded-[32px] overflow-hidden border border-light shadow-sm", children: [
|
|
49
49
|
/* @__PURE__ */ e("div", { className: "absolute left-4 right-4 top-1/2 -translate-y-1/2 h-[56px] bg-primary/[0.04] dark:bg-primary/10 border-y border-primary/10 rounded-2xl pointer-events-none z-10" }),
|
|
50
50
|
/* @__PURE__ */ e(
|
|
51
51
|
i,
|
|
@@ -9,7 +9,7 @@ const I = e.Root, E = e.Group, L = e.Value, R = a.forwardRef(({ className: o, ch
|
|
|
9
9
|
{
|
|
10
10
|
ref: n,
|
|
11
11
|
className: i(
|
|
12
|
-
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-
|
|
12
|
+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-secondary px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
13
13
|
o
|
|
14
14
|
),
|
|
15
15
|
...r,
|
|
@@ -21,7 +21,7 @@ const I = e.Root, E = e.Group, L = e.Value, R = a.forwardRef(({ className: o, ch
|
|
|
21
21
|
));
|
|
22
22
|
R.displayName = e.Trigger.displayName;
|
|
23
23
|
const g = a.forwardRef(({ className: o, children: s, position: r = "popper", searchable: n, onSearch: m, searchPlaceholder: p = "Search...", ...f }, d) => {
|
|
24
|
-
const [
|
|
24
|
+
const [y, b] = a.useState(""), u = a.useRef(null);
|
|
25
25
|
a.useEffect(() => {
|
|
26
26
|
n && u.current && setTimeout(() => {
|
|
27
27
|
var l;
|
|
@@ -29,7 +29,7 @@ const g = a.forwardRef(({ className: o, children: s, position: r = "popper", sea
|
|
|
29
29
|
}, 50);
|
|
30
30
|
}, [n]);
|
|
31
31
|
const w = (l) => {
|
|
32
|
-
|
|
32
|
+
b(l.target.value), m && m(l.target.value);
|
|
33
33
|
}, h = (l) => {
|
|
34
34
|
l.stopPropagation();
|
|
35
35
|
}, x = (l) => {
|
|
@@ -58,7 +58,7 @@ const g = a.forwardRef(({ className: o, children: s, position: r = "popper", sea
|
|
|
58
58
|
C,
|
|
59
59
|
{
|
|
60
60
|
ref: u,
|
|
61
|
-
value:
|
|
61
|
+
value: y,
|
|
62
62
|
onChange: w,
|
|
63
63
|
onClick: h,
|
|
64
64
|
onKeyDown: x,
|
|
@@ -17,7 +17,7 @@ function w({
|
|
|
17
17
|
initial: { y: 100, opacity: 0 },
|
|
18
18
|
animate: { y: 0, opacity: 1 },
|
|
19
19
|
exit: { y: 100, opacity: 0 },
|
|
20
|
-
className: "fixed bottom-4 left-1/2 -translate-x-1/2 w-fit bg-
|
|
20
|
+
className: "fixed bottom-4 left-1/2 -translate-x-1/2 w-fit bg-secondary rounded-lg border shadow-lg z-50",
|
|
21
21
|
children: /* @__PURE__ */ i("div", { className: "flex items-center gap-6 px-4 py-2", children: [
|
|
22
22
|
/* @__PURE__ */ i("div", { className: "flex items-center gap-2 text-sm font-medium", children: [
|
|
23
23
|
/* @__PURE__ */ e("span", { className: "bg-primary text-primary-foreground w-8 h-8 rounded-lg flex items-center justify-center", children: l }),
|
package/dist/components/sheet.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { jsxs as l, jsx as t, Fragment as R } from "react/jsx-runtime";
|
|
2
2
|
import { Minimize2 as B, Maximize2 as I, X as M } from "lucide-react";
|
|
3
|
-
import { Button as
|
|
3
|
+
import { Button as y } from "./button.js";
|
|
4
4
|
import { useState as X, useRef as q, useEffect as m } from "react";
|
|
5
5
|
import { cn as u } from "../lib/utils.js";
|
|
6
|
-
import { AnimatePresence as D, motion as
|
|
6
|
+
import { AnimatePresence as D, motion as g } from "framer-motion";
|
|
7
7
|
import { createPortal as G } from "react-dom";
|
|
8
8
|
let a = [];
|
|
9
9
|
function W({
|
|
10
10
|
isOpen: i,
|
|
11
11
|
onClose: s,
|
|
12
|
-
children:
|
|
12
|
+
children: b,
|
|
13
13
|
header: v,
|
|
14
14
|
footer: f,
|
|
15
15
|
className: N,
|
|
16
|
-
enableFullscreen:
|
|
16
|
+
enableFullscreen: w = !0,
|
|
17
17
|
position: c = "right",
|
|
18
|
-
headerClassName:
|
|
18
|
+
headerClassName: k = "",
|
|
19
19
|
disableOutsideClose: h = !1
|
|
20
20
|
}) {
|
|
21
|
-
const [
|
|
22
|
-
if (m(() => (i ? a.push(
|
|
23
|
-
a = a.filter((e) => e !==
|
|
21
|
+
const [r, P] = X(!1), n = q(null);
|
|
22
|
+
if (m(() => (i ? a.push(n) : a = a.filter((e) => e !== n), () => {
|
|
23
|
+
a = a.filter((e) => e !== n);
|
|
24
24
|
}), [i]), m(() => {
|
|
25
25
|
const e = (o) => {
|
|
26
26
|
var p;
|
|
@@ -28,14 +28,14 @@ function W({
|
|
|
28
28
|
const A = a.some(
|
|
29
29
|
(x) => x.current && x.current.contains(o.target)
|
|
30
30
|
), F = (p = o.target) == null ? void 0 : p.closest("[data-sheet-close]");
|
|
31
|
-
!A && !F &&
|
|
31
|
+
!A && !F && n.current && !n.current.contains(o.target) && s();
|
|
32
32
|
};
|
|
33
|
-
return i && !
|
|
33
|
+
return i && !r && document.addEventListener("mousedown", e), () => {
|
|
34
34
|
document.removeEventListener("mousedown", e);
|
|
35
35
|
};
|
|
36
|
-
}, [i,
|
|
36
|
+
}, [i, r, h]), m(() => {
|
|
37
37
|
const e = (o) => {
|
|
38
|
-
o.key === "Escape" && i && a[a.length - 1] ===
|
|
38
|
+
o.key === "Escape" && i && a[a.length - 1] === n && s();
|
|
39
39
|
};
|
|
40
40
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
41
41
|
}, [i]), !i) return null;
|
|
@@ -43,25 +43,25 @@ function W({
|
|
|
43
43
|
e.stopPropagation(), s();
|
|
44
44
|
}, z = /* @__PURE__ */ l("div", { className: "flex flex-col h-full", children: [
|
|
45
45
|
/* @__PURE__ */ l("div", { className: u(
|
|
46
|
-
"flex items-center bg-card justify-between py-4 px-4 h-header border-b border-
|
|
47
|
-
|
|
46
|
+
"flex items-center bg-card justify-between py-4 px-4 h-header border-b border-light",
|
|
47
|
+
k
|
|
48
48
|
), children: [
|
|
49
49
|
/* @__PURE__ */ t("div", { className: "text-sm font-medium", children: v }),
|
|
50
50
|
/* @__PURE__ */ l("div", { className: "flex items-center gap-1 ml-auto", children: [
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
w && /* @__PURE__ */ t(
|
|
52
|
+
y,
|
|
53
53
|
{
|
|
54
54
|
variant: "ghost",
|
|
55
55
|
size: "icon",
|
|
56
56
|
className: "h-7 w-7",
|
|
57
57
|
onClick: (e) => {
|
|
58
|
-
e.stopPropagation(), P(!
|
|
58
|
+
e.stopPropagation(), P(!r);
|
|
59
59
|
},
|
|
60
|
-
children:
|
|
60
|
+
children: r ? /* @__PURE__ */ t(B, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(I, { className: "h-3.5 w-3.5" })
|
|
61
61
|
}
|
|
62
62
|
),
|
|
63
63
|
/* @__PURE__ */ t(
|
|
64
|
-
|
|
64
|
+
y,
|
|
65
65
|
{
|
|
66
66
|
variant: "ghost",
|
|
67
67
|
size: "icon",
|
|
@@ -73,8 +73,8 @@ function W({
|
|
|
73
73
|
)
|
|
74
74
|
] })
|
|
75
75
|
] }),
|
|
76
|
-
/* @__PURE__ */ t("div", { className: "flex-1 overflow-auto", children:
|
|
77
|
-
f && /* @__PURE__ */ t("div", { className: "border-t border-
|
|
76
|
+
/* @__PURE__ */ t("div", { className: "flex-1 overflow-auto", children: b }),
|
|
77
|
+
f && /* @__PURE__ */ t("div", { className: "border-t border-light bg-card py-2 px-3", children: /* @__PURE__ */ t("div", { className: "text-sm", children: f }) })
|
|
78
78
|
] }), C = () => c === "left" ? {
|
|
79
79
|
initial: { x: -100, opacity: 0 },
|
|
80
80
|
animate: { x: 0, opacity: 1 },
|
|
@@ -87,9 +87,9 @@ function W({
|
|
|
87
87
|
initial: { x: 100, opacity: 0 },
|
|
88
88
|
animate: { x: 0, opacity: 1 },
|
|
89
89
|
exit: { x: 100, opacity: 0 }
|
|
90
|
-
}, L = () =>
|
|
90
|
+
}, L = () => r ? "inset-4 rounded-lg" : c === "left" ? "inset-y-0 left-0 border-r" : c === "bottom" ? "inset-x-0 bottom-0 border-t" : "inset-y-0 right-0 border-l", d = C(), S = L(), j = /* @__PURE__ */ t(D, { children: i && /* @__PURE__ */ l(R, { children: [
|
|
91
91
|
/* @__PURE__ */ t(
|
|
92
|
-
|
|
92
|
+
g.div,
|
|
93
93
|
{
|
|
94
94
|
initial: { opacity: 0 },
|
|
95
95
|
animate: { opacity: 1 },
|
|
@@ -98,15 +98,15 @@ function W({
|
|
|
98
98
|
e.stopPropagation(), s();
|
|
99
99
|
},
|
|
100
100
|
className: u(
|
|
101
|
-
"fixed inset-0 z-[100] bg-
|
|
102
|
-
|
|
101
|
+
"fixed inset-0 z-[100] bg-secondary/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
102
|
+
r ? "block" : "hidden"
|
|
103
103
|
)
|
|
104
104
|
}
|
|
105
105
|
),
|
|
106
106
|
/* @__PURE__ */ t(
|
|
107
|
-
|
|
107
|
+
g.div,
|
|
108
108
|
{
|
|
109
|
-
ref:
|
|
109
|
+
ref: n,
|
|
110
110
|
initial: d.initial,
|
|
111
111
|
animate: d.animate,
|
|
112
112
|
exit: d.exit,
|
|
@@ -115,7 +115,7 @@ function W({
|
|
|
115
115
|
ease: [0.32, 0.72, 0, 1]
|
|
116
116
|
},
|
|
117
117
|
className: u(
|
|
118
|
-
"fixed z-[100] bg-
|
|
118
|
+
"fixed z-[100] bg-secondary shadow-lg flex flex-col border-light",
|
|
119
119
|
S,
|
|
120
120
|
N
|
|
121
121
|
),
|