@dimasbaguspm/versaur 0.0.19 → 0.0.21

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.
Files changed (54) hide show
  1. package/README.md +22 -6
  2. package/dist/js/bottom-sheet-Eqduh3eY.js +495 -0
  3. package/dist/js/{selectable-multiple-input-CJXfqy1Z.js → bottom-sheet-input-DFGibm1I.js} +591 -476
  4. package/dist/js/forms/index.js +20 -17
  5. package/dist/js/{image-rectangle-CLU-GVtw.js → image-rectangle-C6cgL8R9.js} +354 -404
  6. package/dist/js/index.js +61 -53
  7. package/dist/js/layouts/index.js +5 -4
  8. package/dist/js/overlays/index.js +6 -4
  9. package/dist/js/primitive/index.js +15 -13
  10. package/dist/js/side-bar-BUACYQUo.js +397 -0
  11. package/dist/js/text-CRsIInRA.js +127 -0
  12. package/dist/js/tooltip-CDdl1U3A.js +148 -0
  13. package/dist/types/forms/bottom-sheet-input/bottom-sheet-input.d.ts +7 -0
  14. package/dist/types/forms/bottom-sheet-input/index.d.ts +2 -0
  15. package/dist/types/forms/bottom-sheet-input/types.d.ts +17 -0
  16. package/dist/types/forms/drawer-input/drawer-input.d.ts +6 -0
  17. package/dist/types/forms/drawer-input/index.d.ts +2 -0
  18. package/dist/types/forms/drawer-input/types.d.ts +18 -0
  19. package/dist/types/forms/index.d.ts +3 -0
  20. package/dist/types/forms/modal-input/index.d.ts +2 -0
  21. package/dist/types/forms/modal-input/modal-input.d.ts +6 -0
  22. package/dist/types/forms/modal-input/types.d.ts +18 -0
  23. package/dist/types/layouts/index.d.ts +1 -0
  24. package/dist/types/layouts/side-bar/index.d.ts +2 -0
  25. package/dist/types/layouts/side-bar/side-bar.atoms.d.ts +3 -0
  26. package/dist/types/layouts/side-bar/side-bar.d.ts +5 -0
  27. package/dist/types/layouts/side-bar/types.d.ts +42 -0
  28. package/dist/types/overlays/bottom-sheet/types.d.ts +2 -1
  29. package/dist/types/overlays/drawer/types.d.ts +2 -1
  30. package/dist/types/overlays/index.d.ts +1 -0
  31. package/dist/types/overlays/menu/menu.atoms.d.ts +5 -10
  32. package/dist/types/overlays/menu/menu.d.ts +2 -6
  33. package/dist/types/overlays/menu/types.d.ts +9 -14
  34. package/dist/types/overlays/menu/use-menu.d.ts +0 -1
  35. package/dist/types/overlays/modal/modal.d.ts +14 -5
  36. package/dist/types/overlays/modal/types.d.ts +7 -20
  37. package/dist/types/overlays/tooltip/index.d.ts +2 -0
  38. package/dist/types/overlays/tooltip/tooltip.d.ts +5 -0
  39. package/dist/types/overlays/tooltip/types.d.ts +33 -0
  40. package/dist/types/overlays/tooltip/use-tooltip-position.d.ts +8 -0
  41. package/dist/types/primitive/icon/types.d.ts +1 -1
  42. package/dist/types/primitive/index.d.ts +1 -0
  43. package/dist/types/primitive/no-results/index.d.ts +2 -0
  44. package/dist/types/primitive/no-results/no-results.d.ts +15 -0
  45. package/dist/types/primitive/no-results/types.d.ts +30 -0
  46. package/dist/types/primitive/table/table.atoms.d.ts +4 -6
  47. package/dist/types/primitive/table/table.d.ts +2 -1
  48. package/dist/types/primitive/table/types.d.ts +7 -4
  49. package/dist/utils/enforce-subpath-import.js +6 -0
  50. package/package.json +1 -1
  51. package/dist/js/bottom-sheet-BRv-oJL-.js +0 -646
  52. package/dist/js/form-layout-4ASWdXn8.js +0 -302
  53. package/dist/types/overlays/modal/use-escape-close.d.ts +0 -6
  54. package/dist/types/overlays/modal/use-focus-trap.d.ts +0 -6
@@ -1,646 +0,0 @@
1
- import { c as d, j as s, a as u } from "./index-DOdDlCoL.js";
2
- import y, { createContext as E, useContext as D, forwardRef as f, useCallback as M, useEffect as b, useId as z, useRef as w, useState as V } from "react";
3
- const N = E(null);
4
- function g() {
5
- const t = D(N);
6
- if (!t)
7
- throw new Error(
8
- "Drawer components must be used within a DrawerRoot component"
9
- );
10
- return t;
11
- }
12
- const R = d(
13
- "fixed inset-0 z-50 transition-opacity duration-300 bg-foreground/30 backdrop-blur-md",
14
- {
15
- variants: {
16
- state: {
17
- open: "opacity-100",
18
- closed: "opacity-0 pointer-events-none"
19
- }
20
- },
21
- defaultVariants: {
22
- state: "closed"
23
- }
24
- }
25
- ), S = d("fixed z-50 shadow-xl flex flex-col", {
26
- variants: {
27
- position: {
28
- left: "left-0 top-0 bottom-0 border-r",
29
- right: "right-0 top-0 bottom-0 border-l"
30
- },
31
- size: {
32
- sm: "w-80",
33
- md: "w-96",
34
- lg: "w-[28rem]",
35
- xl: "w-[32rem]",
36
- "3/4": "w-[75vw]",
37
- full: "w-full"
38
- },
39
- variant: {
40
- default: "bg-white border-border",
41
- glass: "bg-white/10 backdrop-blur-lg border-white/20"
42
- },
43
- transitionType: {
44
- slide: "transition-transform duration-300 ease-in-out",
45
- fade: "transition-opacity duration-300 ease-in-out"
46
- }
47
- },
48
- defaultVariants: {
49
- position: "right",
50
- size: "md",
51
- variant: "default",
52
- transitionType: "slide"
53
- }
54
- }), C = d("flex-shrink-0 px-6", {
55
- variants: {
56
- variant: {
57
- default: "bg-white",
58
- glass: "bg-transparent "
59
- },
60
- tab: {
61
- true: "pt-4 pb-2",
62
- false: "border-b border-border py-4 "
63
- }
64
- },
65
- defaultVariants: {
66
- variant: "default",
67
- tab: !1
68
- }
69
- }), F = d("flex-1 overflow-y-auto px-6 py-4", {
70
- variants: {
71
- variant: {
72
- default: "bg-white",
73
- glass: "bg-transparent"
74
- }
75
- },
76
- defaultVariants: {
77
- variant: "default"
78
- }
79
- }), I = d("flex-shrink-0 px-6 py-4 border-t", {
80
- variants: {
81
- variant: {
82
- default: "bg-white border-border",
83
- glass: "bg-transparent border-white/10"
84
- },
85
- responsiveFlex: {
86
- true: "flex flex-row gap-3 sm:justify-end [&>*]:sm:flex-grow-0 [&>*]:flex-grow",
87
- false: "flex gap-2"
88
- }
89
- },
90
- defaultVariants: {
91
- variant: "default",
92
- responsiveFlex: !0
93
- }
94
- }), T = y.forwardRef(({ className: t, ...e }, n) => {
95
- const { isOpen: r, onClose: o } = g(), a = () => {
96
- o();
97
- };
98
- return /* @__PURE__ */ s.jsx(
99
- "div",
100
- {
101
- ref: n,
102
- onClick: a,
103
- className: u(
104
- R({
105
- state: r ? "open" : "closed"
106
- }),
107
- t
108
- ),
109
- ...e
110
- }
111
- );
112
- }), L = y.forwardRef(
113
- ({ children: t, className: e, hasTab: n, ...r }, o) => {
114
- const { variant: a } = g();
115
- return /* @__PURE__ */ s.jsx(
116
- "div",
117
- {
118
- ref: o,
119
- className: u(
120
- C({ variant: a, tab: !!n }),
121
- e
122
- ),
123
- ...r,
124
- children: t
125
- }
126
- );
127
- }
128
- ), A = f(
129
- ({ children: t, className: e, ...n }, r) => /* @__PURE__ */ s.jsx("div", { ref: r, className: u("[&>div]:px-6", e), ...n, children: t })
130
- ), H = y.forwardRef(
131
- ({ children: t, className: e, ...n }, r) => {
132
- const { variant: o } = g();
133
- return /* @__PURE__ */ s.jsx(
134
- "div",
135
- {
136
- ref: r,
137
- className: u(F({ variant: o }), e),
138
- ...n,
139
- children: t
140
- }
141
- );
142
- }
143
- ), q = y.forwardRef(
144
- ({ children: t, className: e, responsiveFlex: n = !0, ...r }, o) => {
145
- const { variant: a } = g();
146
- return /* @__PURE__ */ s.jsx(
147
- "div",
148
- {
149
- ref: o,
150
- className: u(
151
- I({ variant: a, responsiveFlex: n }),
152
- e
153
- ),
154
- ...r,
155
- children: t
156
- }
157
- );
158
- }
159
- ), K = ({
160
- children: t,
161
- isOpen: e,
162
- onClose: n,
163
- position: r = "right",
164
- size: o = "md",
165
- variant: a = "default",
166
- transitionType: i = "slide",
167
- className: l,
168
- ...x
169
- }) => {
170
- const c = M(() => {
171
- n(!1);
172
- }, [n]), v = {
173
- isOpen: e,
174
- onClose: c,
175
- position: r,
176
- size: o,
177
- variant: a,
178
- transitionType: i
179
- };
180
- return b(() => {
181
- const m = (p) => {
182
- p.key === "Escape" && e && c();
183
- };
184
- return e && (document.addEventListener("keydown", m), document.body.style.overflow = "hidden"), () => {
185
- document.removeEventListener("keydown", m), document.body.style.overflow = "unset";
186
- };
187
- }, [e, c]), /* @__PURE__ */ s.jsx(N.Provider, { value: v, children: /* @__PURE__ */ s.jsxs(
188
- "div",
189
- {
190
- className: u(
191
- "fixed z-50 inset-0 pointer-events-none",
192
- e && "pointer-events-auto"
193
- ),
194
- children: [
195
- /* @__PURE__ */ s.jsx(T, {}),
196
- /* @__PURE__ */ s.jsx(
197
- "div",
198
- {
199
- role: e ? "dialog" : void 0,
200
- "aria-modal": e ? "true" : void 0,
201
- className: u(
202
- S({
203
- position: r,
204
- size: o,
205
- variant: a,
206
- transitionType: i
207
- }),
208
- i === "slide" ? [
209
- !e && r === "left" && "-translate-x-full",
210
- !e && r === "right" && "translate-x-full"
211
- ] : [
212
- "left-0 right-0 top-0 bottom-0",
213
- e ? "opacity-100" : "opacity-0 pointer-events-none"
214
- ],
215
- l
216
- ),
217
- ...x,
218
- children: e && t
219
- }
220
- )
221
- ]
222
- }
223
- ) });
224
- }, ye = Object.assign(K, {
225
- Header: L,
226
- Tab: A,
227
- Body: H,
228
- Footer: q
229
- }), B = E(null), k = () => {
230
- const t = D(B);
231
- if (!t)
232
- throw new Error("useMenuContext must be used within a Menu component");
233
- return t;
234
- }, _ = d(
235
- "z-30 min-w-40 bg-background text-black rounded-lg border border-border",
236
- {
237
- variants: {
238
- variant: {
239
- default: "",
240
- outline: "border bg-transparent"
241
- },
242
- size: {
243
- sm: "py-1.5 px-1",
244
- md: "py-2 px-1"
245
- }
246
- },
247
- defaultVariants: {
248
- variant: "default",
249
- size: "md"
250
- }
251
- }
252
- ), $ = d(
253
- "w-full text-left px-4 rounded-sm cursor-pointer transition-colors duration-150 select-none hover:bg-background-light outline-none border border-transparent focus-visible:border-primary-light disabled:opacity-50 disabled:cursor-not-allowed",
254
- {
255
- variants: {
256
- size: {
257
- sm: "text-sm py-1",
258
- md: "text-base py-1"
259
- }
260
- },
261
- defaultVariants: {
262
- size: "md"
263
- }
264
- }
265
- ), P = f(
266
- ({ children: t, ...e }, n) => {
267
- const { open: r, triggerRef: o } = k();
268
- return /* @__PURE__ */ s.jsx(
269
- "span",
270
- {
271
- ref: (a) => {
272
- o.current = a, typeof n == "function" ? n(a) : n && (n.current = a);
273
- },
274
- "aria-haspopup": "menu",
275
- "aria-expanded": r,
276
- "aria-controls": "menu-content",
277
- ...e,
278
- children: t
279
- }
280
- );
281
- }
282
- ), U = f(
283
- ({ children: t, className: e, ...n }, r) => {
284
- const { open: o, contentRef: a, triggerRef: i, size: l } = k(), x = z();
285
- let c = 0, v = 0;
286
- if (i.current) {
287
- const m = i.current.getBoundingClientRect();
288
- c = m.bottom + window.scrollY + 4, v = m.left + window.scrollX;
289
- }
290
- return /* @__PURE__ */ s.jsx(
291
- "div",
292
- {
293
- ref: (m) => {
294
- a.current = m, typeof r == "function" ? r(m) : r && (r.current = m);
295
- },
296
- id: `menu-content-${x}`,
297
- role: "menu",
298
- tabIndex: -1,
299
- "aria-hidden": !o,
300
- className: u(
301
- _({
302
- size: l
303
- }),
304
- "absolute z-50 transition-opacity duration-150 ease-out",
305
- o ? "opacity-100" : "opacity-0",
306
- e
307
- ),
308
- style: {
309
- minWidth: i.current?.offsetWidth,
310
- top: c,
311
- left: v
312
- },
313
- ...n,
314
- children: o && t
315
- }
316
- );
317
- }
318
- ), W = f(
319
- ({ children: t, disabled: e, className: n, ...r }, o) => {
320
- const { size: a } = k();
321
- return /* @__PURE__ */ s.jsx(
322
- "button",
323
- {
324
- ref: o,
325
- role: "menuitem",
326
- tabIndex: 0,
327
- disabled: e,
328
- "aria-disabled": e,
329
- className: u(
330
- $({
331
- size: a
332
- }),
333
- n
334
- ),
335
- ...r,
336
- children: t
337
- }
338
- );
339
- }
340
- );
341
- function X(t, e, n, r) {
342
- b(() => {
343
- if (!t) return;
344
- function o(a) {
345
- !e.current?.contains(a.target) && !n.current?.contains(a.target) && r();
346
- }
347
- return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
348
- }, [t, r, e, n]);
349
- }
350
- function Y(t, e) {
351
- b(() => {
352
- if (t && e.current) {
353
- const n = e.current.querySelectorAll('[role="menuitem"]');
354
- n.length && n[0].focus();
355
- }
356
- }, [t, e]);
357
- }
358
- function G(t, e, n, r) {
359
- b(() => {
360
- if (!t || !e.current) return;
361
- const o = e.current;
362
- function a(i) {
363
- const l = Array.from(
364
- o.querySelectorAll('[role="menuitem"]')
365
- ), x = document.activeElement, c = l.indexOf(x);
366
- i.key === "ArrowDown" ? (i.preventDefault(), l.length && l[(c + 1) % l.length].focus()) : i.key === "ArrowUp" ? (i.preventDefault(), l.length && l[(c - 1 + l.length) % l.length].focus()) : i.key === "Home" ? (i.preventDefault(), l.length && l[0].focus()) : i.key === "End" ? (i.preventDefault(), l.length && l[l.length - 1].focus()) : i.key === "Escape" && (i.preventDefault(), r(), n.current?.focus());
367
- }
368
- return o.addEventListener("keydown", a), () => o.removeEventListener("keydown", a);
369
- }, [t, r, e, n]);
370
- }
371
- const J = ({
372
- children: t,
373
- isOpen: e,
374
- onOutsideClick: n,
375
- size: r = "md"
376
- }) => {
377
- const o = w(null), a = w(null);
378
- return X(e, a, o, n), Y(e, a), G(e, a, o, n), /* @__PURE__ */ s.jsx(
379
- B.Provider,
380
- {
381
- value: { open: e, triggerRef: o, contentRef: a, size: r },
382
- children: t
383
- }
384
- );
385
- }, ge = Object.assign(J, {
386
- Trigger: P,
387
- Content: U,
388
- Item: W
389
- }), Q = f(
390
- ({ className: t, ...e }, n) => /* @__PURE__ */ s.jsx(
391
- "div",
392
- {
393
- ref: n,
394
- className: u("px-6 pt-6 pb-2 text-lg font-semibold", t),
395
- ...e
396
- }
397
- )
398
- ), Z = f(
399
- ({ className: t, ...e }, n) => /* @__PURE__ */ s.jsx(
400
- "div",
401
- {
402
- ref: n,
403
- className: u("px-6 py-4 flex justify-end gap-2", t),
404
- ...e
405
- }
406
- )
407
- ), O = f(
408
- ({ className: t, ...e }, n) => /* @__PURE__ */ s.jsx("div", { ref: n, className: u("px-6 py-2", t), ...e })
409
- ), ee = f(
410
- ({ onOverlayClick: t, ...e }, n) => /* @__PURE__ */ s.jsx(
411
- "div",
412
- {
413
- ref: n,
414
- role: "presentation",
415
- tabIndex: -1,
416
- "aria-modal": "true",
417
- onClick: t,
418
- ...e
419
- }
420
- )
421
- ), te = d(
422
- "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",
423
- {
424
- variants: {
425
- placement: {
426
- top: "items-start",
427
- center: "items-center"
428
- }
429
- },
430
- defaultVariants: {
431
- placement: "center"
432
- }
433
- }
434
- ), ne = d(
435
- [
436
- "bg-white rounded-lg shadow-xl relative",
437
- "flex flex-col",
438
- "outline-none",
439
- "mx-4",
440
- "transition-all duration-200 ease-in-out "
441
- ],
442
- {
443
- variants: {
444
- size: {
445
- sm: "w-[20rem] max-w-sm",
446
- // 20rem, 320px
447
- md: "w-[28rem] max-w-md",
448
- // 28rem, 448px
449
- lg: "w-[36rem] max-w-lg",
450
- // 36rem, 576px
451
- "fit-content": "w-fit max-w-full"
452
- // Fit content, no max width
453
- },
454
- placement: {
455
- top: "mt-4",
456
- center: ""
457
- }
458
- },
459
- defaultVariants: {
460
- size: "md",
461
- placement: "center"
462
- }
463
- }
464
- );
465
- function re(t, e) {
466
- b(() => {
467
- if (e && t.current) {
468
- const n = t.current.querySelectorAll(
469
- 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
470
- );
471
- n.length && n[0].focus();
472
- }
473
- }, [e, t]);
474
- }
475
- function oe(t, e) {
476
- b(() => {
477
- if (!t) return;
478
- const n = (r) => {
479
- r.key === "Escape" && e();
480
- };
481
- return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
482
- }, [t, e]);
483
- }
484
- const ae = 200, se = ({
485
- isOpen: t,
486
- onOpenChange: e,
487
- size: n = "md",
488
- placement: r = "center",
489
- children: o,
490
- disableOverlayClose: a,
491
- disableEscClose: i,
492
- ...l
493
- }) => {
494
- const x = w(null), c = w(null), [v, m] = V(t), [p, h] = V(!1);
495
- return b(() => {
496
- if (t)
497
- m(!0), h(!1), x.current = document.activeElement;
498
- else if (v) {
499
- h(!0);
500
- const j = setTimeout(() => {
501
- m(!1), h(!1), x.current && x.current.focus();
502
- }, ae);
503
- return () => clearTimeout(j);
504
- }
505
- }, [t]), oe(t && !i, () => {
506
- e && e(!1);
507
- }), re(c, t), /* @__PURE__ */ s.jsx(
508
- ee,
509
- {
510
- ref: c,
511
- className: `${te({ placement: r })} transition-opacity duration-200 ease-in-out ` + (t && !p ? "opacity-100" : "opacity-0 pointer-events-none"),
512
- onOverlayClick: (j) => {
513
- j.target === c.current && !a && e && e(!1);
514
- },
515
- placement: r,
516
- children: /* @__PURE__ */ s.jsx(
517
- "div",
518
- {
519
- className: `${ne({ size: n, placement: r })} transition-all duration-200 ease-in-out ` + (t && !p ? "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"),
520
- role: "dialog",
521
- ...l,
522
- tabIndex: 0,
523
- "aria-hidden": !t,
524
- children: o
525
- }
526
- )
527
- }
528
- );
529
- }, he = Object.assign(se, {
530
- Header: Q,
531
- Body: O,
532
- Footer: Z
533
- }), ie = d(
534
- [
535
- "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",
536
- "transition-transform duration-300 ease-in-out will-change-transform"
537
- ],
538
- {
539
- variants: {
540
- open: {
541
- true: "translate-y-0",
542
- false: "translate-y-full"
543
- }
544
- },
545
- defaultVariants: {
546
- open: !1
547
- }
548
- }
549
- ), le = d(
550
- ["fixed inset-0 z-40 duration-300"],
551
- {
552
- variants: {
553
- open: {
554
- true: "backdrop-blur-md bg-foreground/30",
555
- false: "pointer-events-none"
556
- }
557
- },
558
- defaultVariants: {
559
- open: !1
560
- }
561
- }
562
- ), de = d("px-4 pt-4 pb-2"), ce = d("px-4 py-2"), ue = d("px-4 pt-2 pb-4"), fe = f(function({ className: e, ...n }, r) {
563
- return /* @__PURE__ */ s.jsx(
564
- "h2",
565
- {
566
- ref: r,
567
- className: ["text-lg font-semibold text-foreground", e].filter(Boolean).join(" "),
568
- ...n
569
- }
570
- );
571
- }), me = f(({ className: t, ...e }, n) => /* @__PURE__ */ s.jsx(
572
- "div",
573
- {
574
- ref: n,
575
- className: de({ className: t }),
576
- ...e
577
- }
578
- )), xe = f(
579
- ({ className: t, ...e }, n) => /* @__PURE__ */ s.jsx(
580
- "div",
581
- {
582
- ref: n,
583
- className: ce({ className: t }),
584
- ...e
585
- }
586
- )
587
- ), be = f(({ className: t, ...e }, n) => /* @__PURE__ */ s.jsx(
588
- "div",
589
- {
590
- ref: n,
591
- className: ue({ className: t }),
592
- ...e
593
- }
594
- )), ve = f(
595
- ({ isOpen: t, children: e, className: n, onClose: r, ...o }, a) => {
596
- b(() => {
597
- const l = (x) => {
598
- x.key === "Escape" && t && r();
599
- };
600
- return t && (document.addEventListener("keydown", l), document.body.style.overflow = "hidden"), () => {
601
- document.removeEventListener("keydown", l), document.body.style.overflow = "unset";
602
- };
603
- }, [t, r]);
604
- const i = () => {
605
- r?.();
606
- };
607
- return /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
608
- /* @__PURE__ */ s.jsx(
609
- "div",
610
- {
611
- className: le({ open: t }),
612
- "aria-hidden": "true",
613
- onClick: i
614
- }
615
- ),
616
- /* @__PURE__ */ s.jsx(
617
- "div",
618
- {
619
- ref: a,
620
- className: u(
621
- ie({
622
- open: t
623
- }),
624
- n
625
- ),
626
- role: "dialog",
627
- "aria-modal": "true",
628
- tabIndex: -1,
629
- ...o,
630
- children: e
631
- }
632
- )
633
- ] });
634
- }
635
- ), je = Object.assign(ve, {
636
- Header: me,
637
- Title: fe,
638
- Body: xe,
639
- Footer: be
640
- });
641
- export {
642
- je as B,
643
- ye as D,
644
- ge as M,
645
- he as a
646
- };