@dimasbaguspm/versaur 0.0.21 → 0.0.22

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.
@@ -1,495 +0,0 @@
1
- import { c as i, j as o, a as l } from "./index-DOdDlCoL.js";
2
- import m, { createContext as h, useContext as g, forwardRef as d, useRef as R, useEffect as w, useCallback as k } from "react";
3
- import C from "react-dom";
4
- const y = h(null);
5
- function D() {
6
- const t = g(y);
7
- if (!t)
8
- throw new Error(
9
- "Modal components must be used within a ModalRoot component"
10
- );
11
- return t;
12
- }
13
- const E = i(
14
- "fixed inset-0 z-60 transition-opacity duration-300 bg-foreground/30 backdrop-blur-md flex items-center justify-center transition-opacity duration-200 ease-in-out",
15
- {
16
- variants: {
17
- placement: {
18
- top: "items-start",
19
- center: "items-center"
20
- }
21
- },
22
- defaultVariants: {
23
- placement: "center"
24
- }
25
- }
26
- ), F = i(
27
- [
28
- "z-61 bg-white rounded-lg shadow-xl fixed",
29
- "flex flex-col",
30
- "outline-none",
31
- "mx-4",
32
- "transition-all duration-200 ease-in-out "
33
- ],
34
- {
35
- variants: {
36
- size: {
37
- sm: "w-[20rem] max-w-sm",
38
- // 20rem, 320px
39
- md: "w-[28rem] max-w-md",
40
- // 28rem, 448px
41
- lg: "w-[36rem] max-w-lg",
42
- // 36rem, 576px
43
- "fit-content": "w-fit max-w-full"
44
- // Fit content, no max width
45
- },
46
- placement: {
47
- top: "top-8 left-1/2 -translate-x-1/2",
48
- center: "top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
49
- },
50
- isOpen: {
51
- true: "opacity-100 scale-100",
52
- false: "opacity-0 scale-95 pointer-events-none"
53
- }
54
- },
55
- defaultVariants: {
56
- size: "md",
57
- placement: "center",
58
- isOpen: !1
59
- }
60
- }
61
- ), M = d(
62
- ({ className: t, ...a }, e) => /* @__PURE__ */ o.jsx(
63
- "div",
64
- {
65
- ref: e,
66
- className: l("px-6 pt-6 pb-2 text-lg font-semibold", t),
67
- ...a
68
- }
69
- )
70
- ), S = d(
71
- ({ className: t, ...a }, e) => /* @__PURE__ */ o.jsx(
72
- "div",
73
- {
74
- ref: e,
75
- className: l("px-6 py-4 flex justify-end gap-2", t),
76
- ...a
77
- }
78
- )
79
- ), z = d(
80
- ({ className: t, ...a }, e) => /* @__PURE__ */ o.jsx("div", { ref: e, className: l("px-6 py-2", t), ...a })
81
- ), H = d(
82
- (t, a) => {
83
- const { isOpen: e, placement: r, onClose: n } = D();
84
- return /* @__PURE__ */ o.jsx(
85
- "div",
86
- {
87
- ref: a,
88
- role: "presentation",
89
- tabIndex: -1,
90
- "aria-modal": "true",
91
- onClick: n,
92
- className: l(
93
- E({ placement: r }),
94
- e ? "opacity-100" : "opacity-0 pointer-events-none"
95
- ),
96
- ...t
97
- }
98
- );
99
- }
100
- );
101
- function p(t, a, e) {
102
- const r = R(null);
103
- return w(() => {
104
- r.current && r.current.focus();
105
- }, []), w(() => {
106
- const n = (s) => {
107
- s.key === "Escape" && t && r.current && r.current.contains(document.activeElement) && !e && a();
108
- };
109
- return t && (document.addEventListener("keydown", n), document.body.style.overflow = "hidden"), () => {
110
- document.removeEventListener("keydown", n), document.body.style.overflow = "unset";
111
- };
112
- }, [t, a, e, r]), r;
113
- }
114
- const b = ({
115
- container: t,
116
- children: a
117
- }) => {
118
- if (typeof window > "u" || typeof document > "u")
119
- return /* @__PURE__ */ o.jsx(o.Fragment, { children: a });
120
- const e = t ?? document.body;
121
- return e ? C.createPortal(a, e) : /* @__PURE__ */ o.jsx(o.Fragment, { children: a });
122
- }, I = ({
123
- isOpen: t,
124
- onClose: a,
125
- size: e = "md",
126
- placement: r = "center",
127
- children: n,
128
- container: s,
129
- ...u
130
- }) => {
131
- const c = {
132
- isOpen: t,
133
- onClose: a,
134
- size: e,
135
- placement: r
136
- }, f = p(t, a);
137
- return /* @__PURE__ */ o.jsx(b, { container: s, children: /* @__PURE__ */ o.jsx(y.Provider, { value: c, children: /* @__PURE__ */ o.jsxs(
138
- "div",
139
- {
140
- className: l(
141
- "fixed z-50 inset-0 pointer-events-none",
142
- t && "pointer-events-auto"
143
- ),
144
- children: [
145
- /* @__PURE__ */ o.jsx(H, {}),
146
- /* @__PURE__ */ o.jsx(
147
- "div",
148
- {
149
- ref: f,
150
- className: l(F({ size: e, placement: r, isOpen: t })),
151
- role: "dialog",
152
- tabIndex: -1,
153
- "aria-hidden": !t,
154
- ...u,
155
- children: n
156
- }
157
- )
158
- ]
159
- }
160
- ) }) });
161
- }, ie = Object.assign(I, {
162
- Header: M,
163
- Body: z,
164
- Footer: S
165
- }), j = h(null);
166
- function x() {
167
- const t = g(j);
168
- if (!t)
169
- throw new Error(
170
- "Drawer components must be used within a DrawerRoot component"
171
- );
172
- return t;
173
- }
174
- const T = i(
175
- "fixed inset-0 z-50 transition-opacity duration-300 bg-foreground/30 backdrop-blur-md",
176
- {
177
- variants: {
178
- state: {
179
- open: "opacity-100",
180
- closed: "opacity-0 pointer-events-none"
181
- }
182
- },
183
- defaultVariants: {
184
- state: "closed"
185
- }
186
- }
187
- ), P = i("fixed z-50 shadow-xl flex flex-col", {
188
- variants: {
189
- position: {
190
- left: "left-0 top-0 bottom-0 border-r",
191
- right: "right-0 top-0 bottom-0 border-l"
192
- },
193
- size: {
194
- sm: "w-80",
195
- md: "w-96",
196
- lg: "w-[28rem]",
197
- xl: "w-[32rem]",
198
- "3/4": "w-[75vw]",
199
- full: "w-full"
200
- },
201
- variant: {
202
- default: "bg-white border-border",
203
- glass: "bg-white/10 backdrop-blur-lg border-white/20"
204
- },
205
- transitionType: {
206
- slide: "transition-transform duration-300 ease-in-out",
207
- fade: "transition-opacity duration-300 ease-in-out"
208
- }
209
- },
210
- defaultVariants: {
211
- position: "right",
212
- size: "md",
213
- variant: "default",
214
- transitionType: "slide"
215
- }
216
- }), L = i("flex-shrink-0 px-6", {
217
- variants: {
218
- variant: {
219
- default: "bg-white",
220
- glass: "bg-transparent "
221
- },
222
- tab: {
223
- true: "pt-4 pb-2",
224
- false: "border-b border-border py-4 "
225
- }
226
- },
227
- defaultVariants: {
228
- variant: "default",
229
- tab: !1
230
- }
231
- }), _ = i("flex-1 overflow-y-auto px-6 py-4", {
232
- variants: {
233
- variant: {
234
- default: "bg-white",
235
- glass: "bg-transparent"
236
- }
237
- },
238
- defaultVariants: {
239
- variant: "default"
240
- }
241
- }), q = i("flex-shrink-0 px-6 py-4 border-t", {
242
- variants: {
243
- variant: {
244
- default: "bg-white border-border",
245
- glass: "bg-transparent border-white/10"
246
- },
247
- responsiveFlex: {
248
- true: "flex flex-row gap-3 sm:justify-end [&>*]:sm:flex-grow-0 [&>*]:flex-grow",
249
- false: "flex gap-2"
250
- }
251
- },
252
- defaultVariants: {
253
- variant: "default",
254
- responsiveFlex: !0
255
- }
256
- }), A = m.forwardRef(({ className: t, ...a }, e) => {
257
- const { isOpen: r, onClose: n } = x(), s = () => {
258
- n();
259
- };
260
- return /* @__PURE__ */ o.jsx(
261
- "div",
262
- {
263
- ref: e,
264
- onClick: s,
265
- className: l(
266
- T({
267
- state: r ? "open" : "closed"
268
- }),
269
- t
270
- ),
271
- ...a
272
- }
273
- );
274
- }), G = m.forwardRef(
275
- ({ children: t, className: a, hasTab: e, ...r }, n) => {
276
- const { variant: s } = x();
277
- return /* @__PURE__ */ o.jsx(
278
- "div",
279
- {
280
- ref: n,
281
- className: l(
282
- L({ variant: s, tab: !!e }),
283
- a
284
- ),
285
- ...r,
286
- children: t
287
- }
288
- );
289
- }
290
- ), J = d(
291
- ({ children: t, className: a, ...e }, r) => /* @__PURE__ */ o.jsx("div", { ref: r, className: l("[&>div]:px-6", a), ...e, children: t })
292
- ), K = m.forwardRef(
293
- ({ children: t, className: a, ...e }, r) => {
294
- const { variant: n } = x();
295
- return /* @__PURE__ */ o.jsx(
296
- "div",
297
- {
298
- ref: r,
299
- className: l(_({ variant: n }), a),
300
- ...e,
301
- children: t
302
- }
303
- );
304
- }
305
- ), Q = m.forwardRef(
306
- ({ children: t, className: a, responsiveFlex: e = !0, ...r }, n) => {
307
- const { variant: s } = x();
308
- return /* @__PURE__ */ o.jsx(
309
- "div",
310
- {
311
- ref: n,
312
- className: l(
313
- q({ variant: s, responsiveFlex: e }),
314
- a
315
- ),
316
- ...r,
317
- children: t
318
- }
319
- );
320
- }
321
- ), U = ({
322
- container: t,
323
- children: a,
324
- isOpen: e,
325
- onClose: r,
326
- position: n = "right",
327
- size: s = "md",
328
- variant: u = "default",
329
- transitionType: c = "slide",
330
- className: f,
331
- ...V
332
- }) => {
333
- const v = k(() => {
334
- r(!1);
335
- }, [r]), B = {
336
- isOpen: e,
337
- onClose: v,
338
- position: n,
339
- size: s,
340
- variant: u,
341
- transitionType: c
342
- }, N = p(e, v);
343
- return /* @__PURE__ */ o.jsx(b, { container: t, children: /* @__PURE__ */ o.jsx(j.Provider, { value: B, children: /* @__PURE__ */ o.jsxs(
344
- "div",
345
- {
346
- className: l(
347
- "fixed z-50 inset-0 pointer-events-none",
348
- e && "pointer-events-auto"
349
- ),
350
- children: [
351
- /* @__PURE__ */ o.jsx(A, {}),
352
- /* @__PURE__ */ o.jsx(
353
- "div",
354
- {
355
- ref: N,
356
- tabIndex: -1,
357
- role: e ? "dialog" : void 0,
358
- "aria-modal": e ? "true" : void 0,
359
- className: l(
360
- P({
361
- position: n,
362
- size: s,
363
- variant: u,
364
- transitionType: c
365
- }),
366
- c === "slide" ? [
367
- !e && n === "left" && "-translate-x-full",
368
- !e && n === "right" && "translate-x-full"
369
- ] : [
370
- "left-0 right-0 top-0 bottom-0",
371
- e ? "opacity-100" : "opacity-0 pointer-events-none"
372
- ],
373
- f
374
- ),
375
- ...V,
376
- children: e && a
377
- }
378
- )
379
- ]
380
- }
381
- ) }) });
382
- }, de = Object.assign(U, {
383
- Header: G,
384
- Tab: J,
385
- Body: K,
386
- Footer: Q
387
- }), W = i(
388
- [
389
- "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",
390
- "transition-transform duration-300 ease-in-out will-change-transform"
391
- ],
392
- {
393
- variants: {
394
- open: {
395
- true: "translate-y-0",
396
- false: "translate-y-full"
397
- }
398
- },
399
- defaultVariants: {
400
- open: !1
401
- }
402
- }
403
- ), X = i(
404
- ["fixed inset-0 z-40 duration-300"],
405
- {
406
- variants: {
407
- open: {
408
- true: "backdrop-blur-md bg-foreground/30",
409
- false: "pointer-events-none"
410
- }
411
- },
412
- defaultVariants: {
413
- open: !1
414
- }
415
- }
416
- ), Y = i("px-4 pt-4 pb-2"), Z = i("px-4 py-2"), $ = i("px-4 pt-2 pb-4"), O = d(function({ className: a, ...e }, r) {
417
- return /* @__PURE__ */ o.jsx(
418
- "h2",
419
- {
420
- ref: r,
421
- className: ["text-lg font-semibold text-foreground", a].filter(Boolean).join(" "),
422
- ...e
423
- }
424
- );
425
- }), ee = d(({ className: t, ...a }, e) => /* @__PURE__ */ o.jsx(
426
- "div",
427
- {
428
- ref: e,
429
- className: Y({ className: t }),
430
- ...a
431
- }
432
- )), te = d(
433
- ({ className: t, ...a }, e) => /* @__PURE__ */ o.jsx(
434
- "div",
435
- {
436
- ref: e,
437
- className: Z({ className: t }),
438
- ...a
439
- }
440
- )
441
- ), ae = d(({ className: t, ...a }, e) => /* @__PURE__ */ o.jsx(
442
- "div",
443
- {
444
- ref: e,
445
- className: $({ className: t }),
446
- ...a
447
- }
448
- )), oe = (...t) => (a) => {
449
- t.forEach((e) => {
450
- typeof e == "function" ? e(a) : e && "current" in e && (e.current = a);
451
- });
452
- }, re = d(
453
- ({ isOpen: t, children: a, className: e, onClose: r, container: n, ...s }, u) => {
454
- const c = p(t, r), f = () => {
455
- r?.();
456
- };
457
- return /* @__PURE__ */ o.jsxs(b, { container: n, children: [
458
- /* @__PURE__ */ o.jsx(
459
- "div",
460
- {
461
- className: X({ open: t }),
462
- "aria-hidden": "true",
463
- onClick: f
464
- }
465
- ),
466
- /* @__PURE__ */ o.jsx(
467
- "div",
468
- {
469
- ref: oe(u, c),
470
- className: l(
471
- W({
472
- open: t
473
- }),
474
- e
475
- ),
476
- role: "dialog",
477
- "aria-modal": "true",
478
- tabIndex: -1,
479
- ...s,
480
- children: a
481
- }
482
- )
483
- ] });
484
- }
485
- ), ce = Object.assign(re, {
486
- Header: ee,
487
- Title: O,
488
- Body: te,
489
- Footer: ae
490
- });
491
- export {
492
- ce as B,
493
- de as D,
494
- ie as M
495
- };