@yuno-payments/dashboard-design-system 2.9.3 → 2.9.5
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/molecules/select/search-select.js +152 -132
- package/dist/components/organisms/dialog/dialog.js +31 -30
- package/dist/components/organisms/sheet/sheet.js +17 -16
- package/dist/dashboard-design-system.css +1 -1
- package/dist/hooks/use-overlay-presence.d.ts +9 -0
- package/dist/hooks/use-overlay-presence.js +18 -0
- package/dist/index.css +1 -1
- package/dist/index.esm.min.js +5886 -5853
- package/dist/index.umd.min.js +14 -14
- package/dist/vendor/shadcn/date-picker.js +6 -6
- package/package.json +1 -1
- package/registry/components-registry.json +4 -4
|
@@ -1,125 +1,135 @@
|
|
|
1
|
-
import { j as
|
|
1
|
+
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
2
|
import * as l from "react";
|
|
3
|
-
import { cn as
|
|
4
|
-
import { FieldLabel as
|
|
3
|
+
import { cn as c, getDirection as A } from "../../../lib/utils.js";
|
|
4
|
+
import { FieldLabel as J } from "../../../vendor/shadcn/field.js";
|
|
5
5
|
import { Icon as b } from "../../atoms/icon/icon.js";
|
|
6
|
-
import { Combobox as
|
|
7
|
-
import { Command as
|
|
6
|
+
import { Combobox as M, ComboboxTrigger as P, ComboboxContent as Q } from "../../../vendor/shadcn/combobox.js";
|
|
7
|
+
import { Command as U, CommandInput as W, CommandList as X, CommandEmpty as Y, CommandGroup as Z, CommandItem as _ } from "../../../vendor/shadcn/command.js";
|
|
8
8
|
import { Typography as x } from "../../atoms/typography/typography.js";
|
|
9
|
-
const
|
|
9
|
+
const E = "__yuno_search_select_no_highlight__", $ = "end", ee = l.forwardRef(
|
|
10
10
|
({
|
|
11
11
|
label: j,
|
|
12
|
-
description:
|
|
12
|
+
description: C,
|
|
13
13
|
error: u,
|
|
14
|
-
optional:
|
|
14
|
+
optional: G = !1,
|
|
15
15
|
placeholder: k = "Select an option",
|
|
16
|
-
value:
|
|
17
|
-
defaultValue:
|
|
18
|
-
onChange:
|
|
16
|
+
value: s,
|
|
17
|
+
defaultValue: h,
|
|
18
|
+
onChange: p,
|
|
19
19
|
disabled: f = !1,
|
|
20
|
-
options:
|
|
20
|
+
options: o = [],
|
|
21
21
|
groups: i = [],
|
|
22
|
-
className:
|
|
22
|
+
className: I,
|
|
23
23
|
id: g,
|
|
24
|
-
searchPlaceholder:
|
|
25
|
-
maxHeight:
|
|
26
|
-
},
|
|
27
|
-
const [
|
|
28
|
-
|
|
24
|
+
searchPlaceholder: T = "Search",
|
|
25
|
+
maxHeight: V = 300
|
|
26
|
+
}, z) => {
|
|
27
|
+
const [r, N] = l.useState(!1), [S, v] = l.useState(""), [D, O] = l.useState(E), F = l.useCallback((e) => {
|
|
28
|
+
O(E), N(e);
|
|
29
|
+
}, []), d = i.length > 0, w = o.length > 0, H = l.useCallback(() => {
|
|
30
|
+
if (!s) return null;
|
|
29
31
|
if (d)
|
|
30
|
-
for (const
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
32
|
+
for (const e of i) {
|
|
33
|
+
const a = e.options.find((n) => n.value === s);
|
|
34
|
+
if (a) return a.label;
|
|
33
35
|
}
|
|
34
36
|
else if (w) {
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
+
const e = o.find((a) => a.value === s);
|
|
38
|
+
if (e) return e.label;
|
|
37
39
|
}
|
|
38
40
|
return null;
|
|
39
|
-
}, [
|
|
40
|
-
(
|
|
41
|
-
if (!
|
|
42
|
-
return { filteredOptions:
|
|
43
|
-
const
|
|
41
|
+
}, [s, i, o, d, w]), R = l.useCallback(
|
|
42
|
+
(e) => {
|
|
43
|
+
if (!e)
|
|
44
|
+
return { filteredOptions: o, filteredGroups: i };
|
|
45
|
+
const a = e.toLowerCase();
|
|
44
46
|
if (d) {
|
|
45
|
-
const
|
|
47
|
+
const n = i.map((m) => ({
|
|
46
48
|
...m,
|
|
47
49
|
options: m.options.filter(
|
|
48
|
-
(
|
|
50
|
+
(K) => K.label.toLowerCase().includes(a)
|
|
49
51
|
)
|
|
50
52
|
})).filter((m) => m.options.length > 0);
|
|
51
|
-
return { filteredOptions: [], filteredGroups:
|
|
53
|
+
return { filteredOptions: [], filteredGroups: n };
|
|
52
54
|
} else
|
|
53
|
-
return { filteredOptions:
|
|
54
|
-
(m) => m.label.toLowerCase().includes(
|
|
55
|
+
return { filteredOptions: o.filter(
|
|
56
|
+
(m) => m.label.toLowerCase().includes(a)
|
|
55
57
|
), filteredGroups: [] };
|
|
56
58
|
},
|
|
57
|
-
[
|
|
58
|
-
), { filteredOptions:
|
|
59
|
+
[o, i, d]
|
|
60
|
+
), { filteredOptions: q, filteredGroups: B } = R(S);
|
|
59
61
|
l.useEffect(() => {
|
|
60
|
-
|
|
62
|
+
r && setTimeout(() => {
|
|
61
63
|
document.querySelector(
|
|
62
64
|
'[data-slot="command-input"]'
|
|
63
65
|
)?.focus();
|
|
64
66
|
}, 0);
|
|
65
|
-
}, [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
}, [r]), l.useEffect(() => {
|
|
68
|
+
if (!r || !s) return;
|
|
69
|
+
const e = setTimeout(() => {
|
|
70
|
+
document.querySelector(
|
|
71
|
+
'[data-slot="command-list"] [data-selected-option="true"]'
|
|
72
|
+
)?.scrollIntoView({ block: $ });
|
|
73
|
+
}, 0);
|
|
74
|
+
return () => clearTimeout(e);
|
|
75
|
+
}, [r, s]), l.useEffect(() => {
|
|
76
|
+
r || v("");
|
|
77
|
+
}, [r]), l.useEffect(() => {
|
|
78
|
+
h && !s && p?.(h);
|
|
79
|
+
}, [h, s, p]);
|
|
80
|
+
const y = (e) => {
|
|
81
|
+
f || (p?.(e), N(!1));
|
|
82
|
+
}, L = H();
|
|
83
|
+
return /* @__PURE__ */ t.jsxs("div", { dir: A(), className: c("w-full", I), children: [
|
|
84
|
+
j && /* @__PURE__ */ t.jsxs("div", { className: "flex items-center gap-1 mb-2", children: [
|
|
85
|
+
/* @__PURE__ */ t.jsx(
|
|
86
|
+
J,
|
|
77
87
|
{
|
|
78
88
|
htmlFor: g,
|
|
79
|
-
className:
|
|
89
|
+
className: c(f && "text-muted-foreground"),
|
|
80
90
|
children: j
|
|
81
91
|
}
|
|
82
92
|
),
|
|
83
|
-
|
|
93
|
+
G && /* @__PURE__ */ t.jsx(x, { variant: "sm", className: "text-muted-foreground", children: "(Optional)" })
|
|
84
94
|
] }),
|
|
85
|
-
|
|
95
|
+
C && !u && /* @__PURE__ */ t.jsx(
|
|
86
96
|
x,
|
|
87
97
|
{
|
|
88
98
|
variant: "sm",
|
|
89
|
-
className:
|
|
99
|
+
className: c(
|
|
90
100
|
"text-muted-foreground mb-2",
|
|
91
101
|
f && "text-muted-"
|
|
92
102
|
),
|
|
93
|
-
children:
|
|
103
|
+
children: C
|
|
94
104
|
}
|
|
95
105
|
),
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ t.jsxs(M, { open: r, onOpenChange: F, children: [
|
|
107
|
+
/* @__PURE__ */ t.jsx(P, { asChild: !0, children: /* @__PURE__ */ t.jsxs(
|
|
98
108
|
"button",
|
|
99
109
|
{
|
|
100
|
-
ref:
|
|
110
|
+
ref: z,
|
|
101
111
|
id: g,
|
|
102
112
|
type: "button",
|
|
103
113
|
disabled: f,
|
|
104
114
|
role: "combobox",
|
|
105
|
-
"aria-expanded":
|
|
115
|
+
"aria-expanded": r,
|
|
106
116
|
"aria-haspopup": "listbox",
|
|
107
|
-
className:
|
|
117
|
+
className: c(
|
|
108
118
|
"flex h-9 w-full items-center justify-between gap-2 rounded-md border border-input bg-input 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:text-muted- shadow-xs [&>span]:min-w-0 [&>span]:truncate",
|
|
109
119
|
u && "border-destructive"
|
|
110
120
|
),
|
|
111
121
|
children: [
|
|
112
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ t.jsx(
|
|
113
123
|
"span",
|
|
114
124
|
{
|
|
115
|
-
className:
|
|
125
|
+
className: c(
|
|
116
126
|
"truncate",
|
|
117
|
-
!
|
|
127
|
+
!L && "text-muted-foreground"
|
|
118
128
|
),
|
|
119
|
-
children:
|
|
129
|
+
children: L || k
|
|
120
130
|
}
|
|
121
131
|
),
|
|
122
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ t.jsx(
|
|
123
133
|
b,
|
|
124
134
|
{
|
|
125
135
|
name: "CaretDown",
|
|
@@ -130,79 +140,89 @@ const X = l.forwardRef(
|
|
|
130
140
|
]
|
|
131
141
|
}
|
|
132
142
|
) }),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
/* @__PURE__ */ e.jsxs(Q, { style: { maxHeight: F }, children: [
|
|
143
|
-
/* @__PURE__ */ e.jsx(U, { children: /* @__PURE__ */ e.jsx(
|
|
144
|
-
x,
|
|
145
|
-
{
|
|
146
|
-
variant: "sm",
|
|
147
|
-
className: "text-muted-foreground py-6 text-center",
|
|
148
|
-
children: "No results found."
|
|
149
|
-
}
|
|
150
|
-
) }),
|
|
151
|
-
d ? q.map((s, n) => /* @__PURE__ */ e.jsxs(W, { children: [
|
|
152
|
-
s.label && /* @__PURE__ */ e.jsx("div", { className: "px-2 py-1.5 text-xs font-medium text-muted-foreground", children: s.label }),
|
|
153
|
-
s.options.map((t) => /* @__PURE__ */ e.jsxs(
|
|
154
|
-
G,
|
|
143
|
+
/* @__PURE__ */ t.jsx(Q, { className: "p-0", align: "start", children: /* @__PURE__ */ t.jsxs(
|
|
144
|
+
U,
|
|
145
|
+
{
|
|
146
|
+
shouldFilter: !1,
|
|
147
|
+
value: D,
|
|
148
|
+
onValueChange: O,
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ t.jsx(
|
|
151
|
+
W,
|
|
155
152
|
{
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
153
|
+
placeholder: T,
|
|
154
|
+
value: S,
|
|
155
|
+
onValueChange: v
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ t.jsxs(X, { style: { maxHeight: V }, children: [
|
|
159
|
+
/* @__PURE__ */ t.jsx(Y, { children: /* @__PURE__ */ t.jsx(
|
|
160
|
+
x,
|
|
161
|
+
{
|
|
162
|
+
variant: "sm",
|
|
163
|
+
className: "text-muted-foreground py-6 text-center",
|
|
164
|
+
children: "No results found."
|
|
165
|
+
}
|
|
166
|
+
) }),
|
|
167
|
+
d ? B.map((e, a) => /* @__PURE__ */ t.jsxs(Z, { children: [
|
|
168
|
+
e.label && /* @__PURE__ */ t.jsx("div", { className: "px-2 py-1.5 text-xs font-medium text-muted-foreground", children: e.label }),
|
|
169
|
+
e.options.map((n) => /* @__PURE__ */ t.jsxs(
|
|
170
|
+
_,
|
|
171
|
+
{
|
|
172
|
+
value: n.value,
|
|
173
|
+
onSelect: () => y(n.value),
|
|
174
|
+
"data-selected-option": s === n.value ? !0 : void 0,
|
|
175
|
+
className: c(
|
|
176
|
+
"cursor-pointer",
|
|
177
|
+
s === n.value && "bg-accent"
|
|
178
|
+
),
|
|
179
|
+
children: [
|
|
180
|
+
/* @__PURE__ */ t.jsxs("span", { className: "flex items-center", children: [
|
|
181
|
+
n.icon && /* @__PURE__ */ t.jsx("span", { className: "mr-2 inline-flex items-center", children: n.icon }),
|
|
182
|
+
n.label
|
|
183
|
+
] }),
|
|
184
|
+
s === n.value && /* @__PURE__ */ t.jsx(
|
|
185
|
+
b,
|
|
186
|
+
{
|
|
187
|
+
name: "Check",
|
|
188
|
+
size: "sm",
|
|
189
|
+
className: "ml-auto"
|
|
190
|
+
}
|
|
191
|
+
)
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
n.value
|
|
195
|
+
))
|
|
196
|
+
] }, a)) : q.map((e) => /* @__PURE__ */ t.jsxs(
|
|
197
|
+
_,
|
|
198
|
+
{
|
|
199
|
+
value: e.value,
|
|
200
|
+
onSelect: () => y(e.value),
|
|
201
|
+
"data-selected-option": s === e.value ? !0 : void 0,
|
|
202
|
+
className: c(
|
|
203
|
+
"cursor-pointer",
|
|
204
|
+
s === e.value && "bg-accent"
|
|
205
|
+
),
|
|
206
|
+
children: [
|
|
207
|
+
/* @__PURE__ */ t.jsxs("span", { className: "flex items-center", children: [
|
|
208
|
+
e.icon && /* @__PURE__ */ t.jsx("span", { className: "mr-2 inline-flex items-center", children: e.icon }),
|
|
209
|
+
e.label
|
|
210
|
+
] }),
|
|
211
|
+
s === e.value && /* @__PURE__ */ t.jsx(b, { name: "Check", size: "sm", className: "ml-auto" })
|
|
212
|
+
]
|
|
213
|
+
},
|
|
214
|
+
e.value
|
|
215
|
+
))
|
|
216
|
+
] })
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
) })
|
|
200
220
|
] }),
|
|
201
|
-
u && /* @__PURE__ */
|
|
221
|
+
u && /* @__PURE__ */ t.jsx(x, { variant: "sm", className: "text-destructive mt-2", children: u })
|
|
202
222
|
] });
|
|
203
223
|
}
|
|
204
224
|
);
|
|
205
|
-
|
|
225
|
+
ee.displayName = "SearchSelect";
|
|
206
226
|
export {
|
|
207
|
-
|
|
227
|
+
ee as SearchSelect
|
|
208
228
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { j as e } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as a from "react";
|
|
3
3
|
import { createPortal as F } from "react-dom";
|
|
4
|
-
import { cva as
|
|
4
|
+
import { cva as y } from "../../../node_modules/class-variance-authority/dist/index.js";
|
|
5
5
|
import { cn as d, normalizeDimension as w } from "../../../lib/utils.js";
|
|
6
|
-
import { useBodyScrollLock as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
6
|
+
import { useBodyScrollLock as O } from "../../../hooks/use-body-scroll-lock.js";
|
|
7
|
+
import { useOverlayPresence as P } from "../../../hooks/use-overlay-presence.js";
|
|
8
|
+
import { useEscapeKey as R } from "../../../hooks/use-escape-key.js";
|
|
9
|
+
import { DialogHeader as H } from "../../molecules/dialog-header/dialog-header.js";
|
|
10
|
+
import { DialogContent as I } from "../../molecules/dialog-content/dialog-content.js";
|
|
11
|
+
import { DialogFooter as K } from "../../molecules/dialog-footer/dialog-footer.js";
|
|
12
|
+
const W = y(
|
|
12
13
|
"fixed inset-0 flex items-center justify-center p-4",
|
|
13
14
|
{
|
|
14
15
|
variants: {
|
|
@@ -22,7 +23,7 @@ const P = p(
|
|
|
22
23
|
verticalAlign: "center"
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
),
|
|
26
|
+
), q = y(
|
|
26
27
|
"relative bg-background rounded-lg shadow-lg border border-border max-h-[90vh] overflow-hidden flex flex-col",
|
|
27
28
|
{
|
|
28
29
|
variants: {
|
|
@@ -38,15 +39,15 @@ const P = p(
|
|
|
38
39
|
size: "default"
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
),
|
|
42
|
+
), G = a.forwardRef(
|
|
42
43
|
({
|
|
43
|
-
className:
|
|
44
|
+
className: p,
|
|
44
45
|
verticalAlign: b,
|
|
45
46
|
title: h,
|
|
46
|
-
open:
|
|
47
|
+
open: i,
|
|
47
48
|
closeIcon: o,
|
|
48
49
|
buttons: j = [],
|
|
49
|
-
widthContainer:
|
|
50
|
+
widthContainer: r,
|
|
50
51
|
heightContainer: c,
|
|
51
52
|
backButtonAction: z,
|
|
52
53
|
showActions: N = !0,
|
|
@@ -56,27 +57,27 @@ const P = p(
|
|
|
56
57
|
headerClassName: S,
|
|
57
58
|
contentClassName: T,
|
|
58
59
|
footerClassName: V,
|
|
59
|
-
zIndex:
|
|
60
|
+
zIndex: l,
|
|
60
61
|
...A
|
|
61
62
|
}, C) => {
|
|
62
|
-
const [s, L] =
|
|
63
|
-
if (
|
|
63
|
+
const [s, L] = a.useState(!1), [n, u] = a.useState(i), [f, g] = a.useState(!1);
|
|
64
|
+
if (a.useEffect(() => {
|
|
64
65
|
const t = () => {
|
|
65
66
|
L(window.innerWidth <= 599);
|
|
66
67
|
};
|
|
67
68
|
return t(), window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
68
|
-
}, []),
|
|
69
|
+
}, []), a.useEffect(() => {
|
|
69
70
|
let t, m;
|
|
70
|
-
return
|
|
71
|
+
return i ? (u(!0), t = setTimeout(() => g(!0), 10)) : n && (g(!1), m = setTimeout(() => {
|
|
71
72
|
u(!1);
|
|
72
73
|
}, 600)), () => {
|
|
73
74
|
t && clearTimeout(t), m && clearTimeout(m);
|
|
74
75
|
};
|
|
75
|
-
}, [
|
|
76
|
+
}, [i, n]), O(i), P(i), R(i, o), !n) return null;
|
|
76
77
|
const M = {
|
|
77
|
-
width:
|
|
78
|
+
width: r && !s ? w(r) : void 0,
|
|
78
79
|
height: c && !s ? w(c) : void 0
|
|
79
|
-
}, x =
|
|
80
|
+
}, x = l !== void 0 ? { zIndex: l } : void 0, v = l === void 0 ? "z-dialog" : void 0, B = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
80
81
|
/* @__PURE__ */ e.jsx(
|
|
81
82
|
"div",
|
|
82
83
|
{
|
|
@@ -93,7 +94,7 @@ const P = p(
|
|
|
93
94
|
/* @__PURE__ */ e.jsx(
|
|
94
95
|
"div",
|
|
95
96
|
{
|
|
96
|
-
className: d(
|
|
97
|
+
className: d(W({ verticalAlign: b }), v),
|
|
97
98
|
style: x,
|
|
98
99
|
children: /* @__PURE__ */ e.jsxs(
|
|
99
100
|
"div",
|
|
@@ -101,13 +102,13 @@ const P = p(
|
|
|
101
102
|
ref: C,
|
|
102
103
|
className: d(
|
|
103
104
|
"yuno-dialog",
|
|
104
|
-
|
|
105
|
+
q({
|
|
105
106
|
size: s ? "fullscreen" : "default"
|
|
106
107
|
}),
|
|
107
108
|
"transition-all duration-600 ease-out",
|
|
108
109
|
f ? "opacity-100 scale-100 translate-y-0" : "opacity-0 scale-98 -translate-y-2",
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
r && !s && "max-w-none",
|
|
111
|
+
p
|
|
111
112
|
),
|
|
112
113
|
style: M,
|
|
113
114
|
role: "dialog",
|
|
@@ -115,7 +116,7 @@ const P = p(
|
|
|
115
116
|
...A,
|
|
116
117
|
children: [
|
|
117
118
|
D && /* @__PURE__ */ e.jsx(
|
|
118
|
-
|
|
119
|
+
H,
|
|
119
120
|
{
|
|
120
121
|
title: h,
|
|
121
122
|
onClose: o,
|
|
@@ -124,8 +125,8 @@ const P = p(
|
|
|
124
125
|
className: S
|
|
125
126
|
}
|
|
126
127
|
),
|
|
127
|
-
/* @__PURE__ */ e.jsx(
|
|
128
|
-
N && /* @__PURE__ */ e.jsx(
|
|
128
|
+
/* @__PURE__ */ e.jsx(I, { className: T, children: E }),
|
|
129
|
+
N && /* @__PURE__ */ e.jsx(K, { buttons: j, className: V })
|
|
129
130
|
]
|
|
130
131
|
}
|
|
131
132
|
)
|
|
@@ -135,7 +136,7 @@ const P = p(
|
|
|
135
136
|
return F(B, document.body);
|
|
136
137
|
}
|
|
137
138
|
);
|
|
138
|
-
|
|
139
|
+
G.displayName = "Dialog";
|
|
139
140
|
export {
|
|
140
|
-
|
|
141
|
+
G as Dialog
|
|
141
142
|
};
|
|
@@ -4,11 +4,12 @@ import { createPortal as H } from "react-dom";
|
|
|
4
4
|
import { cva as g } from "../../../node_modules/class-variance-authority/dist/index.js";
|
|
5
5
|
import { cn as r, normalizeDimension as p } from "../../../lib/utils.js";
|
|
6
6
|
import { useBodyScrollLock as M } from "../../../hooks/use-body-scroll-lock.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useOverlayPresence as R } from "../../../hooks/use-overlay-presence.js";
|
|
8
|
+
import { useEscapeKey as W } from "../../../hooks/use-escape-key.js";
|
|
9
|
+
import { Icon as D } from "../../atoms/icon/icon.js";
|
|
9
10
|
import { Button as x } from "../../atoms/button/button.js";
|
|
10
11
|
import { Typography as b } from "../../atoms/typography/typography.js";
|
|
11
|
-
const
|
|
12
|
+
const F = g(
|
|
12
13
|
"fixed z-sheet bg-background shadow-lg transition-transform duration-300 ease-in-out",
|
|
13
14
|
{
|
|
14
15
|
variants: {
|
|
@@ -38,7 +39,7 @@ const D = g(
|
|
|
38
39
|
isOpen: !1
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
),
|
|
42
|
+
), K = g(
|
|
42
43
|
"fixed inset-0 z-sheet bg-black/50 transition-opacity duration-300",
|
|
43
44
|
{
|
|
44
45
|
variants: {
|
|
@@ -51,7 +52,7 @@ const D = g(
|
|
|
51
52
|
isOpen: !1
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
),
|
|
55
|
+
), L = i.forwardRef(
|
|
55
56
|
({
|
|
56
57
|
className: y,
|
|
57
58
|
side: s = "right",
|
|
@@ -60,8 +61,8 @@ const D = g(
|
|
|
60
61
|
open: a,
|
|
61
62
|
onClose: n,
|
|
62
63
|
buttons: c = [],
|
|
63
|
-
width:
|
|
64
|
-
height:
|
|
64
|
+
width: v,
|
|
65
|
+
height: j,
|
|
65
66
|
showHeader: O = !0,
|
|
66
67
|
showFooter: N = !0,
|
|
67
68
|
children: w,
|
|
@@ -72,7 +73,7 @@ const D = g(
|
|
|
72
73
|
...V
|
|
73
74
|
}, E) => {
|
|
74
75
|
const [I, f] = i.useState(!1), [u, h] = i.useState(!1);
|
|
75
|
-
if (M(a), R(a, n), i.useEffect(() => {
|
|
76
|
+
if (M(a), R(a), W(a, n), i.useEffect(() => {
|
|
76
77
|
if (a) {
|
|
77
78
|
f(!0);
|
|
78
79
|
const t = setTimeout(() => h(!0), 10);
|
|
@@ -83,14 +84,14 @@ const D = g(
|
|
|
83
84
|
return () => clearTimeout(t);
|
|
84
85
|
}
|
|
85
86
|
}, [a]), !I) return null;
|
|
86
|
-
const
|
|
87
|
-
...
|
|
88
|
-
...
|
|
87
|
+
const m = p(v), d = p(j), A = {
|
|
88
|
+
...m && (s === "left" || s === "right") ? { width: m, maxWidth: m } : {},
|
|
89
|
+
...d && (s === "top" || s === "bottom") ? { height: d, maxHeight: d } : {}
|
|
89
90
|
}, B = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
90
91
|
/* @__PURE__ */ e.jsx(
|
|
91
92
|
"div",
|
|
92
93
|
{
|
|
93
|
-
className:
|
|
94
|
+
className: K({ isOpen: u }),
|
|
94
95
|
onClick: n,
|
|
95
96
|
"aria-hidden": "true"
|
|
96
97
|
}
|
|
@@ -99,7 +100,7 @@ const D = g(
|
|
|
99
100
|
"div",
|
|
100
101
|
{
|
|
101
102
|
ref: E,
|
|
102
|
-
className: r(
|
|
103
|
+
className: r(F({ side: s, isOpen: u }), y),
|
|
103
104
|
style: A,
|
|
104
105
|
role: "dialog",
|
|
105
106
|
"aria-modal": "true",
|
|
@@ -144,7 +145,7 @@ const D = g(
|
|
|
144
145
|
onClick: n,
|
|
145
146
|
"aria-label": "Close",
|
|
146
147
|
className: "h-6 w-6",
|
|
147
|
-
children: /* @__PURE__ */ e.jsx(
|
|
148
|
+
children: /* @__PURE__ */ e.jsx(D, { name: "X", size: "md" })
|
|
148
149
|
}
|
|
149
150
|
)
|
|
150
151
|
]
|
|
@@ -175,7 +176,7 @@ const D = g(
|
|
|
175
176
|
return H(B, document.body);
|
|
176
177
|
}
|
|
177
178
|
);
|
|
178
|
-
|
|
179
|
+
L.displayName = "Sheet";
|
|
179
180
|
export {
|
|
180
|
-
|
|
181
|
+
L as Sheet
|
|
181
182
|
};
|