@dimasbaguspm/versaur 0.0.60 → 0.0.62
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/js/forms/index.js +1 -1
- package/dist/js/{image-rectangle-CCvXv24a.js → image-rectangle-BwT5taeR.js} +694 -634
- package/dist/js/index.js +63 -61
- package/dist/js/layouts/index.js +1 -1
- package/dist/js/navigation/index.js +1 -1
- package/dist/js/overlays/index.js +2 -2
- package/dist/js/primitive/index.js +27 -25
- package/dist/js/{tabs-BQs53hHL.js → tabs-FDdFo4WV.js} +1 -1
- package/dist/js/{time-picker-input-Disd231b.js → time-picker-input-DMNSwm-p.js} +854 -642
- package/dist/js/tooltip-BGJUYNL0.js +625 -0
- package/dist/js/{top-bar-DMBbEIlR.js → top-bar-ChNgZEQx.js} +157 -187
- package/dist/types/forms/textarea-input/index.d.ts +1 -1
- package/dist/types/forms/textarea-input/textarea-input.atoms.d.ts +53 -0
- package/dist/types/forms/textarea-input/textarea-input.d.ts +1 -0
- package/dist/types/forms/textarea-input/types.d.ts +28 -0
- package/dist/types/forms/textarea-input/use-textarea-formatting.d.ts +21 -0
- package/dist/types/overlays/drawer/drawer.atoms.d.ts +2 -7
- package/dist/types/overlays/drawer/drawer.d.ts +1 -1
- package/dist/types/overlays/drawer/types.d.ts +1 -11
- package/dist/types/overlays/modal/modal.atoms.d.ts +1 -5
- package/dist/types/overlays/modal/types.d.ts +1 -2
- package/dist/types/primitive/formatted-text/formatted-text.d.ts +10 -0
- package/dist/types/primitive/formatted-text/index.d.ts +3 -0
- package/dist/types/primitive/formatted-text/types.d.ts +19 -0
- package/dist/types/primitive/heading/types.d.ts +9 -12
- package/dist/types/primitive/index.d.ts +1 -0
- package/dist/types/primitive/text/text.d.ts +6 -3
- package/dist/types/primitive/text/types.d.ts +10 -18
- package/dist/types/primitive/tile/tile.d.ts +7 -1
- package/dist/types/primitive/tile/types.d.ts +6 -1
- package/dist/utils/enforce-subpath-import.js +2 -0
- package/package.json +2 -1
- package/dist/js/tooltip-Dpx3TpR6.js +0 -693
|
@@ -0,0 +1,625 @@
|
|
|
1
|
+
import { j as r } from "./jsx-runtime-C5mzlN2N.js";
|
|
2
|
+
import T, { useState as k, useEffect as v, createContext as V, useContext as I, forwardRef as w, useRef as B, useMemo as E, useId as S, cloneElement as X } from "react";
|
|
3
|
+
import { c as b, a as g } from "./index-BDtz_hQY.js";
|
|
4
|
+
import { XIcon as R } from "lucide-react";
|
|
5
|
+
import { H, l as P, v as Z, p as q } from "./image-rectangle-BwT5taeR.js";
|
|
6
|
+
import "./snackbar-CTq4MLir.js";
|
|
7
|
+
import J from "react-dom";
|
|
8
|
+
function Q() {
|
|
9
|
+
if (typeof window > "u") return !1;
|
|
10
|
+
const t = window.navigator.userAgent, e = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
11
|
+
t
|
|
12
|
+
), o = /iPad|Android(?=.*Mobile)|Tablet/i.test(t), n = "ontouchstart" in window || navigator.maxTouchPoints > 0, a = window.innerWidth <= 1024;
|
|
13
|
+
return e || o || n && a;
|
|
14
|
+
}
|
|
15
|
+
function C() {
|
|
16
|
+
return typeof window < "u" && "navigator" in window && "virtualKeyboard" in navigator;
|
|
17
|
+
}
|
|
18
|
+
function Y() {
|
|
19
|
+
const [t, e] = k(!1), [o, n] = k(0), [a, s] = k(0), [l, c] = k(!1), [m, f] = k(!1);
|
|
20
|
+
return v(() => {
|
|
21
|
+
if (!Q()) {
|
|
22
|
+
c(!1);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
c(!0), f(C());
|
|
26
|
+
}, []), v(() => {
|
|
27
|
+
if (!l || !C())
|
|
28
|
+
return;
|
|
29
|
+
const d = navigator.virtualKeyboard, i = () => {
|
|
30
|
+
const { boundingRect: u } = d, p = u?.height || 0, h = u?.width || 0;
|
|
31
|
+
e(p > 0), n(p), s(h);
|
|
32
|
+
};
|
|
33
|
+
return i(), d.addEventListener("geometrychange", i), () => {
|
|
34
|
+
d.removeEventListener(
|
|
35
|
+
"geometrychange",
|
|
36
|
+
i
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
}, [l]), v(() => {
|
|
40
|
+
if (!l || C())
|
|
41
|
+
return;
|
|
42
|
+
const d = window.innerHeight;
|
|
43
|
+
let i;
|
|
44
|
+
const u = () => {
|
|
45
|
+
clearTimeout(i), i = setTimeout(() => {
|
|
46
|
+
const p = window.visualViewport?.height ?? window.innerHeight, h = d - p, j = h > 150;
|
|
47
|
+
e(j), n(j ? h : 0), s(j ? window.innerWidth : 0);
|
|
48
|
+
}, 100);
|
|
49
|
+
};
|
|
50
|
+
return "visualViewport" in window && window.visualViewport ? (window.visualViewport.addEventListener("resize", u), () => {
|
|
51
|
+
clearTimeout(i), window.visualViewport?.removeEventListener(
|
|
52
|
+
"resize",
|
|
53
|
+
u
|
|
54
|
+
);
|
|
55
|
+
}) : (window.addEventListener("resize", u), () => {
|
|
56
|
+
clearTimeout(i), window.removeEventListener("resize", u);
|
|
57
|
+
});
|
|
58
|
+
}, [l]), v(() => {
|
|
59
|
+
l || (e(!1), n(0), s(0));
|
|
60
|
+
}, [l]), {
|
|
61
|
+
isOpen: t,
|
|
62
|
+
height: o,
|
|
63
|
+
width: a,
|
|
64
|
+
isSupported: l,
|
|
65
|
+
usingNativeAPI: m
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const M = V(null);
|
|
69
|
+
function N() {
|
|
70
|
+
const t = I(M);
|
|
71
|
+
if (!t)
|
|
72
|
+
throw new Error(
|
|
73
|
+
"Drawer components must be used within a DrawerRoot component"
|
|
74
|
+
);
|
|
75
|
+
return t;
|
|
76
|
+
}
|
|
77
|
+
const O = b(
|
|
78
|
+
"fixed z-50 inset-y-0 m-0 border-0 p-0 bg-white shadow-xl flex flex-col max-w-full h-full max-h-screen outline-none overflow-hidden transition-[transform,opacity] duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] will-change-[transform,opacity] [transform:translateZ(0)] data-[state=open]:opacity-100 data-[state=open]:pointer-events-auto data-[state=closed]:opacity-0 data-[state=closed]:pointer-events-none data-[state=closed]:select-none [&::backdrop]:bg-foreground/30 [&::backdrop]:backdrop-blur-md [&::backdrop]:transition-opacity [&::backdrop]:duration-250 [&::backdrop]:ease-[cubic-bezier(0.22,1,0.36,1)]",
|
|
79
|
+
{
|
|
80
|
+
variants: {
|
|
81
|
+
position: {
|
|
82
|
+
left: "left-0 right-auto top-0 bottom-0 border-r border-border data-[state=open]:translate-x-0 data-[state=closed]:-translate-x-full",
|
|
83
|
+
right: "right-0 left-auto top-0 bottom-0 border-l border-border data-[state=open]:translate-x-0 data-[state=closed]:translate-x-full"
|
|
84
|
+
},
|
|
85
|
+
size: {
|
|
86
|
+
sm: "w-80",
|
|
87
|
+
md: "w-96",
|
|
88
|
+
lg: "w-[28rem]",
|
|
89
|
+
xl: "w-[32rem]",
|
|
90
|
+
"3/4": "w-[75vw]",
|
|
91
|
+
full: "w-full"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
defaultVariants: {
|
|
95
|
+
position: "right",
|
|
96
|
+
size: "md"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
), tt = b(
|
|
100
|
+
"flex justify-between items-center px-6 bg-white",
|
|
101
|
+
{
|
|
102
|
+
variants: {
|
|
103
|
+
tab: {
|
|
104
|
+
true: "pt-4 pb-2",
|
|
105
|
+
false: "border-b border-border py-4"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
defaultVariants: {
|
|
109
|
+
tab: !1
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
), et = b(
|
|
113
|
+
"flex-1 overflow-y-auto px-6 py-4 bg-white"
|
|
114
|
+
), ot = b(
|
|
115
|
+
"px-6 py-4 border-t border-border bg-white"
|
|
116
|
+
), z = T.forwardRef(
|
|
117
|
+
({ children: t, className: e, hasTab: o, ...n }, a) => /* @__PURE__ */ r.jsx(
|
|
118
|
+
"header",
|
|
119
|
+
{
|
|
120
|
+
ref: a,
|
|
121
|
+
className: g(
|
|
122
|
+
tt({ tab: !!o }),
|
|
123
|
+
e
|
|
124
|
+
),
|
|
125
|
+
...n,
|
|
126
|
+
children: t
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
);
|
|
130
|
+
z.displayName = "DrawerHeader";
|
|
131
|
+
const F = w(
|
|
132
|
+
(t, e) => {
|
|
133
|
+
const { titleId: o } = N();
|
|
134
|
+
return /* @__PURE__ */ r.jsx(H, { ...t, ref: e, as: "h5", id: o });
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
F.displayName = "DrawerTitle";
|
|
138
|
+
const L = w(({ onClick: t, ...e }, o) => {
|
|
139
|
+
const { onClose: n } = N(), a = (s) => {
|
|
140
|
+
n(), t?.(s);
|
|
141
|
+
};
|
|
142
|
+
return /* @__PURE__ */ r.jsx(
|
|
143
|
+
P,
|
|
144
|
+
{
|
|
145
|
+
"aria-label": "Close drawer",
|
|
146
|
+
...e,
|
|
147
|
+
onClick: a,
|
|
148
|
+
variant: "ghost",
|
|
149
|
+
size: "sm",
|
|
150
|
+
as: R,
|
|
151
|
+
ref: o
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
});
|
|
155
|
+
L.displayName = "DrawerCloseButton";
|
|
156
|
+
const A = w(
|
|
157
|
+
({ children: t, className: e, ...o }, n) => /* @__PURE__ */ r.jsx(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
ref: n,
|
|
161
|
+
className: g("[&>nav>div>ul]:px-6", e),
|
|
162
|
+
...o,
|
|
163
|
+
children: t
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
);
|
|
167
|
+
A.displayName = "DrawerTab";
|
|
168
|
+
const W = T.forwardRef(
|
|
169
|
+
({ children: t, className: e, ...o }, n) => {
|
|
170
|
+
const { descriptionId: a } = N();
|
|
171
|
+
return /* @__PURE__ */ r.jsx(
|
|
172
|
+
"main",
|
|
173
|
+
{
|
|
174
|
+
ref: n,
|
|
175
|
+
id: a,
|
|
176
|
+
className: g(et(), e),
|
|
177
|
+
...o,
|
|
178
|
+
children: t
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
W.displayName = "DrawerBody";
|
|
184
|
+
const K = T.forwardRef(
|
|
185
|
+
({ children: t, className: e, ...o }, n) => /* @__PURE__ */ r.jsx(
|
|
186
|
+
"footer",
|
|
187
|
+
{
|
|
188
|
+
ref: n,
|
|
189
|
+
className: g(ot(), e),
|
|
190
|
+
...o,
|
|
191
|
+
children: t
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
);
|
|
195
|
+
K.displayName = "DrawerFooter";
|
|
196
|
+
const D = ({
|
|
197
|
+
container: t,
|
|
198
|
+
children: e
|
|
199
|
+
}) => {
|
|
200
|
+
if (typeof window > "u" || typeof document > "u")
|
|
201
|
+
return /* @__PURE__ */ r.jsx(r.Fragment, { children: e });
|
|
202
|
+
const o = t ?? document.body;
|
|
203
|
+
return o ? J.createPortal(e, o) : /* @__PURE__ */ r.jsx(r.Fragment, { children: e });
|
|
204
|
+
}, _ = (t) => {
|
|
205
|
+
v(() => {
|
|
206
|
+
if (!t) return;
|
|
207
|
+
const e = document.body.style.overflow;
|
|
208
|
+
return document.body.style.overflow = "hidden", () => {
|
|
209
|
+
document.body.style.overflow = e;
|
|
210
|
+
};
|
|
211
|
+
}, [t]);
|
|
212
|
+
}, $ = ({ isOpen: t }) => {
|
|
213
|
+
const e = B(null), o = E(() => t ? "open" : "closed", [t]);
|
|
214
|
+
return v(() => {
|
|
215
|
+
const n = e.current;
|
|
216
|
+
n && (t && !n.open ? n.showModal() : !t && n.open && n.close());
|
|
217
|
+
}, [t]), {
|
|
218
|
+
dialogRef: e,
|
|
219
|
+
dataState: o
|
|
220
|
+
};
|
|
221
|
+
}, nt = ({
|
|
222
|
+
container: t,
|
|
223
|
+
children: e,
|
|
224
|
+
isOpen: o,
|
|
225
|
+
onClose: n,
|
|
226
|
+
position: a = "right",
|
|
227
|
+
size: s = "md",
|
|
228
|
+
disableOverlayClickToClose: l = !1,
|
|
229
|
+
disableEscapeKeyDown: c = !1,
|
|
230
|
+
className: m,
|
|
231
|
+
...f
|
|
232
|
+
}) => {
|
|
233
|
+
const d = S(), i = S(), { dialogRef: u, dataState: p } = $({ isOpen: o });
|
|
234
|
+
_(o);
|
|
235
|
+
const h = () => {
|
|
236
|
+
const y = u.current;
|
|
237
|
+
y?.open && y.close(), n();
|
|
238
|
+
}, x = (y) => {
|
|
239
|
+
y.preventDefault(), !c && h();
|
|
240
|
+
}, j = (y) => {
|
|
241
|
+
y.target === y.currentTarget && (l || h());
|
|
242
|
+
}, U = {
|
|
243
|
+
isOpen: o,
|
|
244
|
+
onClose: h,
|
|
245
|
+
position: a,
|
|
246
|
+
size: s,
|
|
247
|
+
disableOverlayClickToClose: l,
|
|
248
|
+
disableEscapeKeyDown: c,
|
|
249
|
+
titleId: d,
|
|
250
|
+
descriptionId: i
|
|
251
|
+
};
|
|
252
|
+
return /* @__PURE__ */ r.jsx(D, { container: t, children: /* @__PURE__ */ r.jsx(M.Provider, { value: U, children: /* @__PURE__ */ r.jsx(
|
|
253
|
+
"dialog",
|
|
254
|
+
{
|
|
255
|
+
ref: u,
|
|
256
|
+
role: "dialog",
|
|
257
|
+
"aria-modal": "true",
|
|
258
|
+
"aria-labelledby": d,
|
|
259
|
+
"aria-describedby": i,
|
|
260
|
+
"aria-hidden": !o,
|
|
261
|
+
"data-state": p,
|
|
262
|
+
onCancel: x,
|
|
263
|
+
onClick: j,
|
|
264
|
+
className: g(
|
|
265
|
+
O({
|
|
266
|
+
position: a,
|
|
267
|
+
size: s
|
|
268
|
+
}),
|
|
269
|
+
m
|
|
270
|
+
),
|
|
271
|
+
...f,
|
|
272
|
+
children: o && e
|
|
273
|
+
}
|
|
274
|
+
) }) });
|
|
275
|
+
}, Rt = Object.assign(nt, {
|
|
276
|
+
Header: z,
|
|
277
|
+
Title: F,
|
|
278
|
+
CloseButton: L,
|
|
279
|
+
Tab: A,
|
|
280
|
+
Body: W,
|
|
281
|
+
Footer: K
|
|
282
|
+
}), rt = V(null), at = w(
|
|
283
|
+
({ className: t, ...e }, o) => /* @__PURE__ */ r.jsx(
|
|
284
|
+
"div",
|
|
285
|
+
{
|
|
286
|
+
ref: o,
|
|
287
|
+
className: g("px-6 pt-6 pb-2 text-lg font-semibold", t),
|
|
288
|
+
...e
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
), st = w(
|
|
292
|
+
({ className: t, ...e }, o) => /* @__PURE__ */ r.jsx(
|
|
293
|
+
"div",
|
|
294
|
+
{
|
|
295
|
+
ref: o,
|
|
296
|
+
className: g("px-6 py-4 flex justify-end gap-2", t),
|
|
297
|
+
...e
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
), it = w(
|
|
301
|
+
({ className: t, ...e }, o) => /* @__PURE__ */ r.jsx("div", { ref: o, className: g("px-6 py-2", t), ...e })
|
|
302
|
+
), lt = b(
|
|
303
|
+
[
|
|
304
|
+
"fixed z-61 bg-white rounded-lg shadow-xl",
|
|
305
|
+
"flex flex-col",
|
|
306
|
+
"outline-none",
|
|
307
|
+
"transition-all duration-200 ease-in-out",
|
|
308
|
+
"data-[state=open]:opacity-100 data-[state=open]:pointer-events-auto data-[state=closed]:opacity-0 data-[state=closed]:pointer-events-none data-[state=closed]:select-none",
|
|
309
|
+
"[&::backdrop]:bg-foreground/30 [&::backdrop]:backdrop-blur-md [&::backdrop]:transition-opacity [&::backdrop]:duration-250 [&::backdrop]:ease-[cubic-bezier(0.22,1,0.36,1)]"
|
|
310
|
+
],
|
|
311
|
+
{
|
|
312
|
+
variants: {
|
|
313
|
+
size: {
|
|
314
|
+
sm: "w-[20rem] max-w-[90%]",
|
|
315
|
+
// 20rem, 320px
|
|
316
|
+
md: "w-[28rem] max-w-[90%]",
|
|
317
|
+
// 28rem, 448px
|
|
318
|
+
lg: "w-[36rem] max-w-[90%]",
|
|
319
|
+
// 36rem, 576px
|
|
320
|
+
"fit-content": "w-fit max-w-[90%]"
|
|
321
|
+
// Fit content, no max width
|
|
322
|
+
},
|
|
323
|
+
placement: {
|
|
324
|
+
top: "top-8 left-1/2 -translate-x-1/2",
|
|
325
|
+
center: "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
326
|
+
},
|
|
327
|
+
isOpen: {
|
|
328
|
+
true: "opacity-100 scale-100",
|
|
329
|
+
false: "opacity-0 scale-95 pointer-events-none"
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
defaultVariants: {
|
|
333
|
+
size: "md",
|
|
334
|
+
placement: "center",
|
|
335
|
+
isOpen: !1
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
), dt = ({
|
|
339
|
+
isOpen: t,
|
|
340
|
+
onClose: e,
|
|
341
|
+
size: o = "md",
|
|
342
|
+
placement: n = "center",
|
|
343
|
+
disableOverlayClickToClose: a = !1,
|
|
344
|
+
disableEscapeKeyDown: s = !1,
|
|
345
|
+
children: l,
|
|
346
|
+
container: c,
|
|
347
|
+
...m
|
|
348
|
+
}) => {
|
|
349
|
+
const { dialogRef: f, dataState: d } = $({ isOpen: t });
|
|
350
|
+
_(t);
|
|
351
|
+
const i = () => {
|
|
352
|
+
const x = f.current;
|
|
353
|
+
x?.open && x.close(), e();
|
|
354
|
+
}, u = (x) => {
|
|
355
|
+
x.preventDefault(), !s && i();
|
|
356
|
+
}, p = (x) => {
|
|
357
|
+
x.target === x.currentTarget && (a || i());
|
|
358
|
+
}, h = {
|
|
359
|
+
isOpen: t,
|
|
360
|
+
onClose: i,
|
|
361
|
+
size: o,
|
|
362
|
+
placement: n,
|
|
363
|
+
disableOverlayClickToClose: a,
|
|
364
|
+
disableEscapeKeyDown: s
|
|
365
|
+
};
|
|
366
|
+
return /* @__PURE__ */ r.jsx(D, { container: c, children: /* @__PURE__ */ r.jsx(rt.Provider, { value: h, children: /* @__PURE__ */ r.jsx(
|
|
367
|
+
"dialog",
|
|
368
|
+
{
|
|
369
|
+
ref: f,
|
|
370
|
+
role: "dialog",
|
|
371
|
+
"aria-modal": "true",
|
|
372
|
+
"aria-hidden": !t,
|
|
373
|
+
"data-state": d,
|
|
374
|
+
onCancel: u,
|
|
375
|
+
onClick: p,
|
|
376
|
+
className: g(
|
|
377
|
+
lt({ size: o, placement: n, isOpen: t }),
|
|
378
|
+
m.className
|
|
379
|
+
),
|
|
380
|
+
...m,
|
|
381
|
+
children: t && l
|
|
382
|
+
}
|
|
383
|
+
) }) });
|
|
384
|
+
}, Ht = Object.assign(dt, {
|
|
385
|
+
Header: at,
|
|
386
|
+
Body: it,
|
|
387
|
+
Footer: st
|
|
388
|
+
}), ct = b(
|
|
389
|
+
[
|
|
390
|
+
"fixed left-0 bottom-0 z-40 w-full max-h-[90dvh] bg-background rounded-t-xl shadow-lg border-t border-border rounded-lg",
|
|
391
|
+
"transition-transform duration-300 ease-in-out will-change-transform",
|
|
392
|
+
"overflow-hidden"
|
|
393
|
+
// Ensure content doesn't overflow when keyboard adjusts height
|
|
394
|
+
],
|
|
395
|
+
{
|
|
396
|
+
variants: {
|
|
397
|
+
open: {
|
|
398
|
+
true: "translate-y-0",
|
|
399
|
+
false: "translate-y-full"
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
defaultVariants: {
|
|
403
|
+
open: !1
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
), ut = b(
|
|
407
|
+
["fixed inset-0 z-40 duration-300"],
|
|
408
|
+
{
|
|
409
|
+
variants: {
|
|
410
|
+
open: {
|
|
411
|
+
true: "backdrop-blur-md bg-foreground/30",
|
|
412
|
+
false: "pointer-events-none"
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
defaultVariants: {
|
|
416
|
+
open: !1
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
), ft = b(
|
|
420
|
+
"p-4 pb-2 flex justify-between w-full"
|
|
421
|
+
), mt = b([
|
|
422
|
+
"p-4 py-2 flex-1 overflow-y-auto",
|
|
423
|
+
"scrollbar-thin scrollbar-track-transparent scrollbar-thumb-border"
|
|
424
|
+
]), pt = b("p-4 pt-2 flex-shrink-0"), G = V(null), ht = G.Provider, wt = () => {
|
|
425
|
+
const t = I(G);
|
|
426
|
+
if (!t)
|
|
427
|
+
throw new Error("useBottomSheet must be used within a BottomSheetProvider");
|
|
428
|
+
return t;
|
|
429
|
+
}, bt = w(function(e, o) {
|
|
430
|
+
return /* @__PURE__ */ r.jsx(H, { as: "h5", ref: o, ...e });
|
|
431
|
+
}), gt = w(function(e, o) {
|
|
432
|
+
const { onClose: n } = wt(), a = (s) => {
|
|
433
|
+
n(), e?.onClick?.(s);
|
|
434
|
+
};
|
|
435
|
+
return /* @__PURE__ */ r.jsx(
|
|
436
|
+
P,
|
|
437
|
+
{
|
|
438
|
+
ref: o,
|
|
439
|
+
variant: "ghost",
|
|
440
|
+
"aria-label": "Close",
|
|
441
|
+
as: R,
|
|
442
|
+
...e,
|
|
443
|
+
onClick: a
|
|
444
|
+
}
|
|
445
|
+
);
|
|
446
|
+
}), xt = w(({ className: t, ...e }, o) => /* @__PURE__ */ r.jsx(
|
|
447
|
+
"div",
|
|
448
|
+
{
|
|
449
|
+
ref: o,
|
|
450
|
+
className: ft({ className: t }),
|
|
451
|
+
...e
|
|
452
|
+
}
|
|
453
|
+
)), vt = w(
|
|
454
|
+
({ className: t, ...e }, o) => /* @__PURE__ */ r.jsx(
|
|
455
|
+
"div",
|
|
456
|
+
{
|
|
457
|
+
ref: o,
|
|
458
|
+
className: mt({ className: t }),
|
|
459
|
+
...e
|
|
460
|
+
}
|
|
461
|
+
)
|
|
462
|
+
), yt = w(({ className: t, ...e }, o) => /* @__PURE__ */ r.jsx(
|
|
463
|
+
"div",
|
|
464
|
+
{
|
|
465
|
+
ref: o,
|
|
466
|
+
className: pt({ className: t }),
|
|
467
|
+
...e
|
|
468
|
+
}
|
|
469
|
+
));
|
|
470
|
+
function kt(t, e, o) {
|
|
471
|
+
const n = B(null);
|
|
472
|
+
return v(() => {
|
|
473
|
+
n.current && n.current.focus();
|
|
474
|
+
}, []), v(() => {
|
|
475
|
+
const a = (s) => {
|
|
476
|
+
s.key === "Escape" && t && n.current && n.current.contains(document.activeElement) && !o && e();
|
|
477
|
+
};
|
|
478
|
+
return t && (document.addEventListener("keydown", a), document.body.style.overflow = "hidden"), () => {
|
|
479
|
+
document.removeEventListener("keydown", a), document.body.style.overflow = "unset";
|
|
480
|
+
};
|
|
481
|
+
}, [t, e, o, n]), n;
|
|
482
|
+
}
|
|
483
|
+
const jt = w(
|
|
484
|
+
({
|
|
485
|
+
isOpen: t,
|
|
486
|
+
children: e,
|
|
487
|
+
className: o,
|
|
488
|
+
onClose: n,
|
|
489
|
+
container: a,
|
|
490
|
+
disableOverlayClickToClose: s = !1,
|
|
491
|
+
...l
|
|
492
|
+
}, c) => {
|
|
493
|
+
const m = kt(t, n), {
|
|
494
|
+
isOpen: f,
|
|
495
|
+
height: d,
|
|
496
|
+
isSupported: i
|
|
497
|
+
} = Y(), u = E(() => !t || !i || !f ? {} : {
|
|
498
|
+
// Adjust bottom position to sit above the virtual keyboard
|
|
499
|
+
bottom: `${d}px`,
|
|
500
|
+
// Reduce max height to account for keyboard
|
|
501
|
+
maxHeight: `calc(90dvh - ${d}px)`,
|
|
502
|
+
// Ensure smooth transition
|
|
503
|
+
transition: "bottom 0.2s ease-in-out, max-height 0.2s ease-in-out"
|
|
504
|
+
}, [t, i, f, d]), p = () => {
|
|
505
|
+
s || n?.();
|
|
506
|
+
};
|
|
507
|
+
return /* @__PURE__ */ r.jsx(D, { container: a, children: /* @__PURE__ */ r.jsxs(ht, { value: { onClose: n }, children: [
|
|
508
|
+
/* @__PURE__ */ r.jsx(
|
|
509
|
+
"div",
|
|
510
|
+
{
|
|
511
|
+
className: ut({ open: t }),
|
|
512
|
+
"aria-hidden": "true",
|
|
513
|
+
onClick: p
|
|
514
|
+
}
|
|
515
|
+
),
|
|
516
|
+
/* @__PURE__ */ r.jsx(
|
|
517
|
+
"div",
|
|
518
|
+
{
|
|
519
|
+
ref: Z(c, m),
|
|
520
|
+
className: g(
|
|
521
|
+
ct({
|
|
522
|
+
open: t
|
|
523
|
+
}),
|
|
524
|
+
"flex flex-col",
|
|
525
|
+
// Add flex layout for proper header/body/footer arrangement
|
|
526
|
+
o
|
|
527
|
+
),
|
|
528
|
+
style: u,
|
|
529
|
+
role: "dialog",
|
|
530
|
+
"aria-modal": "true",
|
|
531
|
+
tabIndex: -1,
|
|
532
|
+
...l,
|
|
533
|
+
children: e
|
|
534
|
+
}
|
|
535
|
+
)
|
|
536
|
+
] }) });
|
|
537
|
+
}
|
|
538
|
+
), Pt = Object.assign(jt, {
|
|
539
|
+
Header: xt,
|
|
540
|
+
Title: bt,
|
|
541
|
+
CloseIcon: gt,
|
|
542
|
+
Body: vt,
|
|
543
|
+
Footer: yt
|
|
544
|
+
});
|
|
545
|
+
function Bt(t = "auto") {
|
|
546
|
+
const e = B(null), [o, n] = k("bottom");
|
|
547
|
+
return v(() => {
|
|
548
|
+
if (!open || t !== "auto" || !e.current) {
|
|
549
|
+
n(t === "auto" ? "bottom" : t);
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
const a = e.current.getBoundingClientRect(), s = window.innerWidth, l = window.innerHeight, c = {
|
|
553
|
+
top: a.top,
|
|
554
|
+
bottom: l - a.bottom,
|
|
555
|
+
left: a.left,
|
|
556
|
+
right: s - a.right
|
|
557
|
+
};
|
|
558
|
+
c.bottom > 64 ? n("bottom") : c.top > 64 ? n("top") : c.right > 128 ? n("right") : n("left");
|
|
559
|
+
}, [t, e]), { position: o, ref: e };
|
|
560
|
+
}
|
|
561
|
+
const Ct = b(
|
|
562
|
+
"absolute z-50 px-2 py-1 rounded bg-neutral pointer-events-auto transition-opacity duration-150 min-w-[max-content] max-w-sm whitespace-pre-line",
|
|
563
|
+
{
|
|
564
|
+
variants: {
|
|
565
|
+
position: {
|
|
566
|
+
top: "bottom-full left-1/2 -translate-x-1/2 mb-2",
|
|
567
|
+
bottom: "top-full left-1/2 -translate-x-1/2 mt-2",
|
|
568
|
+
left: "right-full top-1/2 -translate-y-1/2 mr-2",
|
|
569
|
+
right: "left-full top-1/2 -translate-y-1/2 ml-2",
|
|
570
|
+
auto: "top-full left-1/2 -translate-x-1/2 mt-2"
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
defaultVariants: {
|
|
574
|
+
position: "auto"
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
), Mt = ({
|
|
578
|
+
children: t,
|
|
579
|
+
content: e,
|
|
580
|
+
position: o = "auto",
|
|
581
|
+
popoverClassName: n,
|
|
582
|
+
delay: a,
|
|
583
|
+
...s
|
|
584
|
+
}) => {
|
|
585
|
+
const l = S(), [c, m] = k(!1), f = B(null), d = () => {
|
|
586
|
+
a ? f.current = setTimeout(() => m(!0), a) : m(!0);
|
|
587
|
+
}, i = () => {
|
|
588
|
+
f.current && clearTimeout(f.current), m(!1);
|
|
589
|
+
};
|
|
590
|
+
v(() => () => {
|
|
591
|
+
f.current && clearTimeout(f.current);
|
|
592
|
+
}, []);
|
|
593
|
+
const u = {
|
|
594
|
+
tabIndex: 0,
|
|
595
|
+
"aria-describedby": l,
|
|
596
|
+
onMouseEnter: d,
|
|
597
|
+
onFocus: d,
|
|
598
|
+
onMouseLeave: i,
|
|
599
|
+
onBlur: i,
|
|
600
|
+
...s
|
|
601
|
+
}, { ref: p, position: h } = Bt(o);
|
|
602
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "relative w-fit", ref: p, children: [
|
|
603
|
+
X(t, u),
|
|
604
|
+
/* @__PURE__ */ r.jsx(
|
|
605
|
+
"div",
|
|
606
|
+
{
|
|
607
|
+
id: l,
|
|
608
|
+
className: g(
|
|
609
|
+
Ct({ position: h }),
|
|
610
|
+
n,
|
|
611
|
+
!c && "opacity-0 pointer-events-none"
|
|
612
|
+
),
|
|
613
|
+
role: "tooltip",
|
|
614
|
+
"aria-hidden": !c,
|
|
615
|
+
children: /* @__PURE__ */ r.jsx(q, { as: "small", fontWeight: "normal", color: "black", children: e })
|
|
616
|
+
}
|
|
617
|
+
)
|
|
618
|
+
] });
|
|
619
|
+
};
|
|
620
|
+
export {
|
|
621
|
+
Pt as B,
|
|
622
|
+
Rt as D,
|
|
623
|
+
Ht as M,
|
|
624
|
+
Mt as T
|
|
625
|
+
};
|