visits-style 2.2.0 → 2.2.1

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 (41) hide show
  1. package/dist/components/Accordion/index.d.ts +17 -0
  2. package/dist/components/Dialog/DialogHeader.d.ts +7 -0
  3. package/dist/components/Dialog/index.d.ts +50 -0
  4. package/dist/components/Popover/index.d.ts +58 -0
  5. package/dist/components/Portal/index.d.ts +7 -0
  6. package/dist/components/Sheet/index.d.ts +33 -0
  7. package/dist/components/Toast/ToastFloat.d.ts +11 -0
  8. package/dist/components/Toast/ToastItem.d.ts +2 -0
  9. package/dist/components/Toast/index.d.ts +3 -0
  10. package/dist/components/Toast/observer.d.ts +28 -0
  11. package/dist/components/Toast/types.d.ts +62 -0
  12. package/dist/components/Tooltip/index.d.ts +43 -0
  13. package/dist/components/index.d.ts +11 -0
  14. package/dist/elements/Base.d.ts +14 -0
  15. package/dist/elements/Button/ButtonGroup.d.ts +2 -0
  16. package/dist/elements/Button/index.d.ts +9 -0
  17. package/dist/elements/Divider/index.d.ts +6 -0
  18. package/dist/elements/Progress/index.d.ts +11 -0
  19. package/dist/elements/Skeleton/index.d.ts +4 -0
  20. package/dist/elements/Spinner/index.d.ts +7 -0
  21. package/dist/elements/index.d.ts +7 -0
  22. package/dist/forms/Checkbox/index.d.ts +13 -0
  23. package/dist/forms/Field/FormField.d.ts +16 -0
  24. package/dist/forms/Field/FormLabel.d.ts +2 -0
  25. package/dist/forms/Field/InputField.d.ts +7 -0
  26. package/dist/forms/Input/index.d.ts +8 -0
  27. package/dist/forms/Radio/RadioGroup.d.ts +14 -0
  28. package/dist/forms/Radio/index.d.ts +10 -0
  29. package/dist/forms/Select/index.d.ts +49 -0
  30. package/dist/forms/Select/native.d.ts +11 -0
  31. package/dist/forms/Switch/index.d.ts +8 -0
  32. package/dist/forms/Textarea/index.d.ts +8 -0
  33. package/dist/forms/index.d.ts +9 -0
  34. package/dist/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
  35. package/dist/index.cjs.js +1 -1
  36. package/dist/index.d.ts +4 -476
  37. package/dist/index.es.js +985 -1016
  38. package/dist/utils/isClient.d.ts +2 -0
  39. package/dist/utils/merge.d.ts +4 -0
  40. package/dist/utils/stopPropagation.d.ts +2 -0
  41. package/package.json +6 -6
package/dist/index.es.js CHANGED
@@ -1,1019 +1,988 @@
1
- import U from "clsx";
2
- import { twMerge as be } from "tailwind-merge";
3
- import { jsx as i, jsxs as N, Fragment as ne } from "react/jsx-runtime";
4
- import { useMemo as k, createElement as re, Children as z, cloneElement as W, useLayoutEffect as oe, useEffect as L, useState as E, useRef as F, useCallback as B, useImperativeHandle as ie, forwardRef as se, startTransition as ge, createContext as me, useContext as he } from "react";
5
- import { useId as Z, useFloating as _, autoUpdate as le, shift as ae, flip as ue, offset as ce, useTransitionStyles as X, useInteractions as J, useClick as ye, FloatingOverlay as Q, useHover as xe, useClientPoint as we, useDismiss as ve } from "@floating-ui/react";
6
- import { createPortal as Ce } from "react-dom";
7
- function M(...e) {
8
- return e.length ? U(...e) : "";
9
- }
10
- function O(e, t) {
11
- return t ? be(e, t) : e;
12
- }
13
- function w({
14
- as: e,
15
- classList: t = [],
16
- className: r,
17
- ...n
18
- }) {
19
- const s = k(() => Array.isArray(t) ? t.length ? O(M(...t), r) : r : O(M(t), r), [t, r]);
20
- return re(e || "div", { className: s, ...n });
21
- }
22
- function ke(e) {
23
- return /* @__PURE__ */ i(w, { as: "label", classList: ["leading-none peer-disabled:opacity-70"], ...e });
24
- }
25
- function Ke({
26
- label: e,
27
- children: t,
28
- required: r,
29
- htmlFor: n,
30
- error: s,
31
- help: o,
32
- helpBefore: l,
33
- innerClass: u,
34
- ...c
35
- }) {
36
- const d = k(() => M(
37
- "font-medium",
38
- r ? 'after:content-["*"] after:text-danger after:text-sm after:pl-0.5' : ""
39
- ), [r]);
40
- return /* @__PURE__ */ N(w, { classList: "flex flex-col space-y-2", ...c, children: [
41
- e ? /* @__PURE__ */ i(ke, { className: d, htmlFor: n, children: e }) : null,
42
- o && l ? /* @__PURE__ */ i("p", { className: "text-xs text-muted pb-2", children: o }) : null,
43
- /* @__PURE__ */ i("div", { className: u, children: Ne(t, !!s) }),
44
- o && !l && !s ? /* @__PURE__ */ i("p", { className: "text-xs text-muted", children: o }) : null,
45
- s ? /* @__PURE__ */ i("p", { className: "text-xs text-danger", children: s }) : null
46
- ] });
47
- }
48
- function Ne(e, t) {
49
- const r = z.count(e);
50
- if (!r) return null;
51
- if (r === 1)
52
- return W(e, { error: t });
53
- const n = z.toArray(e);
54
- return n[0] = W(n[0], { error: t }), n;
55
- }
56
- function Ge({ error: e, customStyle: t, ...r }) {
57
- return /* @__PURE__ */ i(
58
- w,
59
- {
60
- classList: t ? void 0 : [
61
- "flex rounded-md border bg-background px-3 py-2 w-full [&_input]:placeholder:text-muted",
62
- "[&_input]:disabled:opacity-50 [&_input]:focus-visible:outline-none",
63
- e ? "border-danger hover:border-danger-fore" : "border-input"
64
- ],
65
- ...r
66
- }
67
- );
68
- }
69
- function Ue({ type: e, error: t, customStyle: r, ...n }) {
70
- return /* @__PURE__ */ i(
71
- w,
72
- {
73
- as: "input",
74
- type: e,
75
- classList: r ? void 0 : [
76
- "flex rounded-md border bg-background px-3 py-2 w-full placeholder:text-muted",
77
- "disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2",
78
- t ? "border-danger hover:border-danger-fore focus-visible:ring-danger" : "border-input not-disabled:hover:border-input-fore focus-visible:ring-ring",
79
- e === "file" ? "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground" : null
80
- ],
81
- ...n
82
- }
83
- );
84
- }
85
- function Je({ error: e, customStyle: t, ...r }) {
86
- return /* @__PURE__ */ i(
87
- w,
88
- {
89
- as: "textarea",
90
- classList: t ? void 0 : [
91
- "flex rounded-md border bg-background px-3 py-2 w-full",
92
- "disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",
93
- e ? "border-danger hover:border-danger-fore" : "border-input not-disabled:hover:border-input-fore"
94
- ],
95
- ...r
96
- }
97
- );
98
- }
99
- function Fe() {
100
- return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", viewBox: "0 0 30 30", children: /* @__PURE__ */ i("rect", { width: "20", height: "3", y: "13.5", x: "4.5", fill: "currentColor", stroke: "none", rx: "2" }) });
101
- }
102
- function Qe({
103
- checked: e,
104
- indeterminate: t,
105
- id: r,
106
- name: n,
107
- onChange: s,
108
- value: o,
109
- checkIcon: l,
110
- error: u,
111
- ...c
112
- }) {
113
- const d = () => {
114
- c.disabled || s?.(!e);
115
- };
116
- return /* @__PURE__ */ N(
117
- w,
118
- {
119
- as: "button",
120
- type: "button",
121
- role: "checkbox",
122
- id: r || n,
123
- classList: [
124
- "inline-flex justify-center items-center border w-4.5 h-4.5 rounded",
125
- "cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",
126
- {
127
- "border-danger hover:border-danger-fore": u,
128
- "bg-primary text-inverted disabled:text-text disabled:bg-input disabled:border-input": !u && e,
129
- "border-input not-disabled:hover:border-input-fore": !u && !e
130
- }
131
- ],
132
- onClick: d,
133
- "aria-checked": e,
134
- ...c,
135
- children: [
136
- e ? l : null,
137
- t && !e ? /* @__PURE__ */ i(Fe, {}) : null,
138
- /* @__PURE__ */ i(
139
- "input",
140
- {
141
- type: "checkbox",
142
- "aria-hidden": "true",
143
- name: n,
144
- checked: e,
145
- value: o,
146
- onChange: d,
147
- disabled: c.disabled,
148
- style: { position: "absolute", pointerEvents: "none", top: 0, left: 0, width: 1, height: 1, opacity: 0 }
149
- }
150
- )
151
- ]
152
- }
153
- );
154
- }
155
- const Ie = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", V = Ie ? oe : L;
156
- function H({ children: e, container: t, disabled: r }) {
157
- const [n, s] = E(null);
158
- return V(() => {
159
- if (!t) {
160
- let o = document.getElementById("visits-style-portals");
161
- return o || (o = document.createElement("div"), o.id = "visits-style-portals", document.body.appendChild(o)), s(o);
162
- }
163
- s(t);
164
- }, [t]), r || !n ? null : Ce(e, n);
165
- }
166
- function q(e) {
167
- e && (e.stopPropagation(), e.preventDefault());
168
- }
169
- const Ae = { open: 150, close: 75 };
170
- function Te({
171
- ref: e,
172
- position: t,
173
- label: r,
174
- children: n,
175
- disabled: s,
176
- offset: o = { x: 0, y: 6 },
177
- onOpen: l,
178
- onClose: u,
179
- onManualClose: c,
180
- timeout: d = Ae,
181
- customStyle: g,
182
- zIndex: m = 9996,
183
- role: v,
184
- ...C
185
- }) {
186
- const [p, a] = E(!1), x = Z(), b = F(l), h = F(u), { refs: y, floatingStyles: R, context: S } = _({
187
- nodeId: x,
188
- placement: t,
189
- middleware: [
190
- ae(),
191
- ue({ fallbackAxisSideDirection: "end" }),
192
- ce({ mainAxis: o.y, crossAxis: o.x })
193
- ],
194
- open: p,
195
- onOpenChange: (I) => {
196
- I ? b.current?.(y.reference.current, y.floating.current) : h.current?.(y.reference.current, y.floating.current), a(I);
197
- },
198
- whileElementsMounted: le
199
- }), { isMounted: Y, styles: D } = X(S, {
200
- duration: d,
201
- initial({ side: I }) {
202
- let P = "";
203
- return I === "top" ? P = "translateY(5%) scale(0.95)" : I === "bottom" ? P = "translateY(-5%) scale(0.95)" : I === "left" ? P = "translateX(5%) scale(0.95)" : P = "translateX(-5%) scale(0.95)", { opacity: 0, transform: P };
204
- }
205
- }), $ = B((I) => {
206
- if (q(I), c) return c();
207
- a(!1), h.current?.(y.reference.current, y.floating.current);
208
- }, [c]);
209
- L(() => {
210
- if (s && p) return a(!1);
211
- }, [s, p]), ie(e, () => ({
212
- open: () => {
213
- a(!0), b.current?.(y.reference.current, y.floating.current);
214
- },
215
- close: () => {
216
- a(!1), h.current?.(y.reference.current, y.floating.current);
217
- }
218
- // eslint-disable-next-line react-hooks/exhaustive-deps
219
- }), []);
220
- const { getFloatingProps: j, getReferenceProps: K } = J([
221
- ye(S, { enabled: !s })
222
- ]);
223
- return b.current = l, h.current = u, /* @__PURE__ */ N(ne, { children: [
224
- W(z.only(r), K({
225
- ref: y.setReference,
226
- tabIndex: 0,
227
- role: "button",
228
- "aria-expanded": p,
229
- disabled: s,
230
- onClick: q
231
- })),
232
- /* @__PURE__ */ i(H, { disabled: s || !Y, children: /* @__PURE__ */ i(
233
- Q,
234
- {
235
- "data-testid": "vs-popover-shadow",
236
- onClick: $,
237
- style: { zIndex: m },
238
- autoFocus: !0,
239
- children: /* @__PURE__ */ i("div", { role: v || "region", ref: y.setFloating, style: R, children: /* @__PURE__ */ i(
240
- Le,
241
- {
242
- customStyle: g,
243
- styles: D,
244
- ...j({ ...C, onClick: q }),
245
- children: n
246
- }
247
- ) })
248
- }
249
- ) })
250
- ] });
251
- }
252
- function Le({ customStyle: e, styles: t, style: r = {}, ...n }) {
253
- return /* @__PURE__ */ i(
254
- w,
255
- {
256
- classList: [
257
- "z-20 w-auto h-auto outline-none transition-transform ease-in-out",
258
- e ? null : "border border-accent rounded-md shadow-lg p-1 bg-background"
259
- ],
260
- style: { ...t, ...r },
261
- ...n
262
- }
263
- );
264
- }
265
- function Ve({
266
- className: e,
267
- placeholder: t = "",
268
- options: r = [],
269
- error: n,
270
- customStyle: s,
271
- disabled: o,
272
- value: l,
273
- maxHeight: u = 408,
274
- arrowIcon: c,
275
- closeIcon: d,
276
- checkIcon: g,
277
- onChange: m,
278
- onClear: v,
279
- renderItem: C,
280
- sectionLabelStyle: p,
281
- buttonAreaStyle: a,
282
- clearLabelText: x,
283
- optionStyle: b,
284
- ...h
285
- }) {
286
- const y = F(null), [R, S] = E(0), Y = k(() => Array.isArray(l), []), D = B((f) => {
287
- m?.(f), Y || y.current?.close();
288
- }, [m, Y]), $ = B((f) => Array.isArray(l) ? l.indexOf(f) > -1 : l === f, [l]), j = k(() => {
289
- const f = {}, T = r.filter((A) => typeof A != "string");
290
- for (let A = 0, G = T.length; A < G; A += 1) {
291
- const ee = T[A];
292
- f[`${ee.value}`] = ee.label;
293
- }
294
- return f;
295
- }, [r]), K = k(() => {
296
- if (!l) return t;
297
- if (Array.isArray(l)) {
298
- if (!l.length) return t;
299
- const f = [...l].sort(), T = [];
300
- for (let A = 0, G = f.length; A < G; A += 1)
301
- T[A] = j[`${f[A]}`] || "";
302
- return T.filter(Boolean).join(",") || t;
303
- }
304
- return j[`${l}`] || t;
305
- }, [t, l, j]), I = k(() => l == null ? !0 : Array.isArray(l) ? !l.length : !1, [l]), P = B((f, T) => C ? typeof f == "string" ? C(f, { index: T, selected: !1, onChange: () => {
306
- } }) : C(f, {
307
- index: T,
308
- selected: $(f.value),
309
- onChange: () => D(f.value)
310
- }) : typeof f == "string" ? /* @__PURE__ */ i(
311
- w,
312
- {
313
- as: "h5",
314
- classList: ["font-normal py-1 px-2 text-muted"],
315
- className: p,
316
- children: f
317
- },
318
- `optionheader-${T}`
319
- ) : /* @__PURE__ */ i(
320
- Me,
321
- {
322
- selected: $(f.value),
323
- onChange: D,
324
- checkIcon: g,
325
- className: b,
326
- ...f
327
- },
328
- f.label
329
- ), [C, D, $, p, b, g]);
330
- return /* @__PURE__ */ i(
331
- Te,
332
- {
333
- label: /* @__PURE__ */ N(
334
- w,
335
- {
336
- as: "button",
337
- type: "button",
338
- classList: s ? void 0 : [
339
- "flex items-center justify-between rounded-md border bg-background px-3 py-2 w-full overflow-hidden cursor-pointer",
340
- "disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",
341
- n ? "border-danger hover:border-danger-fore" : "border-input not-disabled:hover:border-input-fore"
342
- ],
343
- className: e,
344
- disabled: o,
345
- ...h,
346
- children: [
347
- /* @__PURE__ */ i(
348
- w,
349
- {
350
- as: "span",
351
- classList: [
352
- "overflow-hidden overflow-ellipsis whitespace-nowrap",
353
- I ? "text-muted" : "text-text"
354
- ],
355
- children: K
356
- }
357
- ),
358
- /* @__PURE__ */ N(w, { classList: "relative flex items-center space-x-2", className: a, children: [
359
- v && !I ? /* @__PURE__ */ i(
360
- "div",
361
- {
362
- tabIndex: -1,
363
- role: "button",
364
- className: "size-6 p-1.5 rounded hover:bg-accent cursor-pointer",
365
- "aria-label": x,
366
- onKeyDown: (f) => {
367
- f.key !== "Enter" && f.key !== "Space" || v();
368
- },
369
- onClick: (f) => {
370
- f.stopPropagation(), v();
371
- },
372
- children: d
373
- }
374
- ) : null,
375
- c
376
- ] })
377
- ]
378
- }
379
- ),
380
- ref: y,
381
- onOpen: (f) => S(f?.getBoundingClientRect().width || 0),
382
- disabled: o,
383
- children: /* @__PURE__ */ i(
384
- "ul",
385
- {
386
- className: "overflow-y-auto flex flex-col",
387
- role: "listbox",
388
- style: { minWidth: R, maxWidth: "calc(100vw - 3rem)", maxHeight: u },
389
- children: r.map(P)
390
- }
391
- )
392
- }
393
- );
394
- }
395
- function Me({
396
- className: e,
397
- value: t,
398
- label: r,
399
- selected: n,
400
- checkIcon: s,
401
- onChange: o
402
- }) {
403
- return /* @__PURE__ */ N(
404
- w,
405
- {
406
- as: "button",
407
- type: "button",
408
- role: "option",
409
- classList: "flex items-center w-full hover:bg-accent rounded p-1 cursor-pointer",
410
- className: e,
411
- "aria-selected": n,
412
- onClick: () => o?.(t),
413
- children: [
414
- n && s ? s : /* @__PURE__ */ i("div", { className: "w-5 h-1 mr-1" }),
415
- r
416
- ]
417
- }
418
- );
419
- }
420
- function et({ checked: e, className: t, id: r, name: n, onChange: s, value: o, error: l, ...u }) {
421
- const c = () => {
422
- u.disabled || s?.(!e);
423
- };
424
- return /* @__PURE__ */ N(
425
- w,
426
- {
427
- as: "button",
428
- type: "button",
429
- role: "radio",
430
- id: r || n,
431
- classList: [
432
- "relative inline-flex justify-center items-center border w-4.5 h-4.5 rounded-full",
433
- "cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed not-disabled:hover:border-input-fore",
434
- l ? "border-danger" : "border-input",
435
- e ? "[&_i]:bg-primary disabled:[&_i]:bg-text disabled:border-input" : ""
436
- ],
437
- className: t,
438
- onClick: c,
439
- "aria-checked": e,
440
- ...u,
441
- children: [
442
- /* @__PURE__ */ i(
443
- "i",
444
- {
445
- className: "block w-2.5 h-2.5 rounded-full transition-transform",
446
- style: { transform: e ? "" : "scale(0.8)", opacity: e ? 1 : 0 }
447
- }
448
- ),
449
- /* @__PURE__ */ i(
450
- "input",
451
- {
452
- type: "radio",
453
- "aria-hidden": "true",
454
- name: n,
455
- checked: e,
456
- value: o,
457
- onChange: c,
458
- disabled: u.disabled,
459
- style: { position: "absolute", pointerEvents: "none", top: 0, left: 0, width: 1, height: 1, opacity: 0 }
460
- }
461
- )
462
- ]
463
- }
464
- );
465
- }
466
- function tt({
467
- checked: e,
468
- onChange: t,
469
- value: r,
470
- id: n,
471
- name: s,
472
- error: o,
473
- ref: l,
474
- ...u
475
- }) {
476
- const c = () => {
477
- u.disabled || t?.(!e);
478
- };
479
- return /* @__PURE__ */ N(
480
- w,
481
- {
482
- as: "button",
483
- type: "button",
484
- role: "switch",
485
- id: n || s,
486
- classList: [
487
- "inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors",
488
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",
489
- "w-11",
490
- e ? "bg-primary disabled:bg-text" : "bg-input"
491
- ],
492
- onClick: c,
493
- "aria-checked": e,
494
- "aria-invalid": o,
495
- ...u,
496
- children: [
497
- /* @__PURE__ */ i(
498
- "span",
499
- {
500
- className: "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
501
- style: { transform: e ? "translateX(100%)" : "" }
502
- }
503
- ),
504
- /* @__PURE__ */ i(
505
- "input",
506
- {
507
- ref: l,
508
- type: "checkbox",
509
- "aria-hidden": "true",
510
- name: s,
511
- checked: e,
512
- value: r,
513
- onChange: c,
514
- disabled: u.disabled,
515
- style: { position: "absolute", pointerEvents: "none", top: 0, left: 0, width: 1, height: 1, opacity: 0 }
516
- }
517
- )
518
- ]
519
- }
520
- );
521
- }
522
- function nt({ header: e, show: t, children: r, timeout: n = 300, ...s }) {
523
- const o = F(null), l = F(0), u = F(0), c = F(!0);
524
- return L(() => {
525
- u.current = n;
526
- }, [n]), V(() => {
527
- if (!o.current) return;
528
- if (o.current.style.overflow = "hidden", o.current.style.opacity = "1", c.current) {
529
- c.current = !1, o.current.style.height = t ? "auto" : "0px", t ? window.requestAnimationFrame(() => {
530
- o.current && (l.current = o.current.offsetHeight);
531
- }) : (window.requestAnimationFrame(() => {
532
- o.current && (o.current.style.height = "auto", l.current = o.current.offsetHeight, o.current.style.height = "0px");
533
- }), o.current.style.opacity = "0");
534
- return;
535
- }
536
- t || (o.current.style.height = `${l.current}px`);
537
- const d = [];
538
- d[0] = window.requestAnimationFrame(() => {
539
- d[1] = window.requestAnimationFrame(() => {
540
- o.current && (o.current.style.height = `${t ? l.current : 0}px`, o.current.style.opacity = t ? "1" : "0");
541
- });
542
- });
543
- let g;
544
- const m = () => {
545
- o.current && (t ? (o.current.style.height = "auto", o.current.style.overflow = "", o.current.style.opacity = "", window.requestAnimationFrame(() => {
546
- o.current && (l.current = o.current.offsetHeight);
547
- })) : o.current.style.height = "0px");
548
- };
549
- return u.current === 0 ? m() : g = window.setTimeout(m, u.current), () => {
550
- d.forEach(window.cancelAnimationFrame), g && window.clearTimeout(g);
551
- };
552
- }, [t]), /* @__PURE__ */ N("div", { ...s, children: [
553
- e,
554
- /* @__PURE__ */ i(
555
- "div",
556
- {
557
- className: "transition-all ease-in-out overflow-hidden",
558
- role: "region",
559
- "aria-hidden": !t,
560
- ref: o,
561
- style: { transitionDuration: `${n}ms` },
562
- children: r
563
- }
564
- )
565
- ] });
566
- }
567
- const Re = se(({
568
- children: e,
569
- position: t = "bottom",
570
- label: r,
571
- className: n,
572
- timeout: s = 150,
573
- offset: o = { x: 0, y: 6 },
574
- clientPoint: l = !1,
575
- disabled: u
576
- }, c) => {
577
- const [d, g] = E(!1), m = Z(), { refs: v, floatingStyles: C, context: p } = _({
578
- nodeId: m,
579
- open: d,
580
- placement: t,
581
- middleware: [
582
- ae(),
583
- ue(),
584
- ce({ mainAxis: o.y, crossAxis: o.x })
585
- ],
586
- whileElementsMounted: u ? void 0 : le,
587
- onOpenChange: g
588
- }), { getReferenceProps: a, getFloatingProps: x } = J([
589
- xe(p, { enabled: !u }),
590
- we(p, { enabled: l })
591
- ]), { isMounted: b, styles: h } = X(p, {
592
- duration: s,
593
- initial: { opacity: 0, transform: "scale(0.8)" }
594
- });
595
- ie(c, () => ({
596
- floating: v.floating,
597
- reference: v.reference,
598
- open: () => g(!0),
599
- close: () => g(!1)
600
- })), L(() => {
601
- u && g(!1);
602
- }, [u]);
603
- const y = typeof e == "string" ? /* @__PURE__ */ i("span", { children: e }) : e;
604
- return /* @__PURE__ */ N(ne, { children: [
605
- W(z.only(y), {
606
- ref: v.setReference,
607
- ...a()
608
- }),
609
- /* @__PURE__ */ i(H, { disabled: u || !b, children: /* @__PURE__ */ i("div", { role: "tooltip", className: "z-9999", ref: v.setFloating, ...x({ style: C }), children: /* @__PURE__ */ i(de, { className: n, style: h, children: r }) }) })
610
- ] });
1
+ import e from "clsx";
2
+ import { twMerge as t } from "tailwind-merge";
3
+ import { Children as n, cloneElement as r, createContext as i, createElement as a, forwardRef as o, startTransition as s, useCallback as c, useContext as l, useEffect as u, useImperativeHandle as d, useLayoutEffect as f, useMemo as p, useRef as m, useState as h } from "react";
4
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
5
+ import { FloatingOverlay as y, autoUpdate as b, flip as x, offset as S, shift as C, useClick as w, useClientPoint as T, useDismiss as E, useFloating as D, useHover as O, useId as k, useInteractions as A, useTransitionStyles as j } from "@floating-ui/react";
6
+ import { createPortal as M } from "react-dom";
7
+ //#region src/utils/merge.ts
8
+ var N = e;
9
+ function P(e, n) {
10
+ return n ? t(e, n) : e;
11
+ }
12
+ //#endregion
13
+ //#region src/elements/Base.tsx
14
+ function F({ as: e, classList: t = [], className: n, override: r, ...i }) {
15
+ let o = p(() => r ? n : P(N(t), n), [
16
+ t,
17
+ n,
18
+ r
19
+ ]);
20
+ return a(e || "div", {
21
+ className: o,
22
+ ...i
23
+ });
24
+ }
25
+ //#endregion
26
+ //#region src/forms/Field/FormLabel.tsx
27
+ function I(e) {
28
+ return /* @__PURE__ */ _(F, {
29
+ as: "label",
30
+ classList: ["leading-none peer-disabled:opacity-70"],
31
+ ...e
32
+ });
33
+ }
34
+ //#endregion
35
+ //#region src/forms/Field/FormField.tsx
36
+ function L({ label: e, children: t, required: n, htmlFor: r, error: i, help: a, helpBefore: o, innerClass: s, ...c }) {
37
+ let l = p(() => N("font-medium", n ? "after:content-[\"*\"] after:text-danger after:text-sm after:pl-0.5" : ""), [n]);
38
+ return /* @__PURE__ */ v(F, {
39
+ classList: "flex flex-col space-y-2",
40
+ ...c,
41
+ children: [
42
+ e ? /* @__PURE__ */ _(I, {
43
+ className: l,
44
+ htmlFor: r,
45
+ children: e
46
+ }) : null,
47
+ a && o ? /* @__PURE__ */ _("p", {
48
+ className: "text-xs text-muted pb-2",
49
+ children: a
50
+ }) : null,
51
+ /* @__PURE__ */ _("div", {
52
+ className: s,
53
+ children: R(t, !!i)
54
+ }),
55
+ a && !o && !i ? /* @__PURE__ */ _("p", {
56
+ className: "text-xs text-muted",
57
+ children: a
58
+ }) : null,
59
+ i ? /* @__PURE__ */ _("p", {
60
+ className: "text-xs text-danger",
61
+ children: i
62
+ }) : null
63
+ ]
64
+ });
65
+ }
66
+ function R(e, t) {
67
+ let i = n.count(e);
68
+ if (!i) return null;
69
+ if (i === 1) return r(e, { error: t });
70
+ let a = n.toArray(e);
71
+ return a[0] = r(a[0], { error: t }), a;
72
+ }
73
+ //#endregion
74
+ //#region src/forms/Field/InputField.tsx
75
+ function z({ error: e, ...t }) {
76
+ return /* @__PURE__ */ _(F, {
77
+ as: "fieldset",
78
+ classList: [
79
+ "flex rounded-md border bg-background px-3 py-2 w-full [&_input]:placeholder:text-muted",
80
+ "[&_input]:disabled:opacity-50 [&_input]:focus-visible:outline-none",
81
+ e ? "border-danger hover:border-danger-fore" : "border-input"
82
+ ],
83
+ ...t
84
+ });
85
+ }
86
+ //#endregion
87
+ //#region src/forms/Input/index.tsx
88
+ function B({ type: e, error: t, ...n }) {
89
+ return /* @__PURE__ */ _(F, {
90
+ as: "input",
91
+ type: e,
92
+ classList: [
93
+ "flex rounded-md border bg-background px-3 py-2 w-full placeholder:text-muted",
94
+ "disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2",
95
+ t ? "border-danger hover:border-danger-fore focus-visible:ring-danger" : "border-input not-disabled:hover:border-input-fore focus-visible:ring-ring",
96
+ e === "file" ? "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground" : null
97
+ ],
98
+ ...n
99
+ });
100
+ }
101
+ //#endregion
102
+ //#region src/forms/Textarea/index.tsx
103
+ function V({ error: e, ...t }) {
104
+ return /* @__PURE__ */ _(F, {
105
+ as: "textarea",
106
+ classList: [
107
+ "flex rounded-md border bg-background px-3 py-2 w-full",
108
+ "disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",
109
+ e ? "border-danger hover:border-danger-fore" : "border-input not-disabled:hover:border-input-fore"
110
+ ],
111
+ ...t
112
+ });
113
+ }
114
+ //#endregion
115
+ //#region src/forms/Checkbox/index.tsx
116
+ function ee() {
117
+ return /* @__PURE__ */ _("svg", {
118
+ xmlns: "http://www.w3.org/2000/svg",
119
+ width: "30",
120
+ height: "30",
121
+ viewBox: "0 0 30 30",
122
+ children: /* @__PURE__ */ _("rect", {
123
+ width: "20",
124
+ height: "3",
125
+ y: "13.5",
126
+ x: "4.5",
127
+ fill: "currentColor",
128
+ stroke: "none",
129
+ rx: "2"
130
+ })
131
+ });
132
+ }
133
+ function H({ checked: e, indeterminate: t, id: n, name: r, onChange: i, value: a, checkIcon: o, error: s, ...c }) {
134
+ let l = () => {
135
+ c.disabled || i?.(!e);
136
+ };
137
+ return /* @__PURE__ */ v(F, {
138
+ as: "button",
139
+ type: "button",
140
+ role: "checkbox",
141
+ id: n || r,
142
+ classList: [
143
+ "inline-flex justify-center items-center border w-4.5 h-4.5 rounded",
144
+ "cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",
145
+ {
146
+ "border-danger hover:border-danger-fore": s,
147
+ "bg-primary text-inverted disabled:text-text disabled:bg-input disabled:border-input": !s && e,
148
+ "border-input not-disabled:hover:border-input-fore": !s && !e
149
+ }
150
+ ],
151
+ onClick: l,
152
+ "aria-checked": e,
153
+ ...c,
154
+ children: [
155
+ e ? o : null,
156
+ t && !e ? /* @__PURE__ */ _(ee, {}) : null,
157
+ /* @__PURE__ */ _("input", {
158
+ type: "checkbox",
159
+ "aria-hidden": "true",
160
+ name: r,
161
+ checked: e,
162
+ value: a,
163
+ onChange: l,
164
+ disabled: c.disabled,
165
+ style: {
166
+ position: "absolute",
167
+ pointerEvents: "none",
168
+ top: 0,
169
+ left: 0,
170
+ width: 1,
171
+ height: 1,
172
+ opacity: 0
173
+ }
174
+ })
175
+ ]
176
+ });
177
+ }
178
+ //#endregion
179
+ //#region src/hooks/useIsomorphicLayoutEffect.ts
180
+ var U = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? f : u;
181
+ //#endregion
182
+ //#region src/components/Portal/index.tsx
183
+ function W({ children: e, container: t, disabled: n }) {
184
+ let [r, i] = h(null);
185
+ return U(() => {
186
+ if (!t) {
187
+ let e = document.getElementById("visits-style-portals");
188
+ return e || (e = document.createElement("div"), e.id = "visits-style-portals", document.body.appendChild(e)), i(e);
189
+ }
190
+ i(t);
191
+ }, [t]), n || !r ? null : M(e, r);
192
+ }
193
+ //#endregion
194
+ //#region src/utils/stopPropagation.ts
195
+ function G(e) {
196
+ e && (e.stopPropagation(), e.preventDefault());
197
+ }
198
+ //#endregion
199
+ //#region src/components/Popover/index.tsx
200
+ var te = {
201
+ open: 150,
202
+ close: 75
203
+ };
204
+ function K({ ref: e, position: t, label: i, children: a, disabled: o, offset: s = {
205
+ x: 0,
206
+ y: 6
207
+ }, onOpen: l, onClose: f, onManualClose: p, timeout: T = te, override: E, zIndex: O = 9996, role: M, ...N }) {
208
+ let [P, F] = h(!1), I = k(), L = m(l), R = m(f), { refs: z, floatingStyles: B, context: V } = D({
209
+ nodeId: I,
210
+ placement: t,
211
+ middleware: [
212
+ C(),
213
+ x({ fallbackAxisSideDirection: "end" }),
214
+ S({
215
+ mainAxis: s.y,
216
+ crossAxis: s.x
217
+ })
218
+ ],
219
+ open: P,
220
+ onOpenChange: (e) => {
221
+ e ? L.current?.(z.reference.current, z.floating.current) : R.current?.(z.reference.current, z.floating.current), F(e);
222
+ },
223
+ whileElementsMounted: b
224
+ }), { isMounted: ee, styles: H } = j(V, {
225
+ duration: T,
226
+ initial({ side: e }) {
227
+ let t = "";
228
+ return t = e === "top" ? "translateY(5%) scale(0.95)" : e === "bottom" ? "translateY(-5%) scale(0.95)" : e === "left" ? "translateX(5%) scale(0.95)" : "translateX(-5%) scale(0.95)", {
229
+ opacity: 0,
230
+ transform: t
231
+ };
232
+ }
233
+ }), U = c((e) => {
234
+ if (G(e), p) return p();
235
+ F(!1), R.current?.(z.reference.current, z.floating.current);
236
+ }, [p]);
237
+ u(() => {
238
+ if (o && P) return F(!1);
239
+ }, [o, P]), d(e, () => ({
240
+ open: () => {
241
+ F(!0), L.current?.(z.reference.current, z.floating.current);
242
+ },
243
+ close: () => {
244
+ F(!1), R.current?.(z.reference.current, z.floating.current);
245
+ }
246
+ }), []);
247
+ let { getFloatingProps: K, getReferenceProps: q } = A([w(V, { enabled: !o })]);
248
+ return L.current = l, R.current = f, /* @__PURE__ */ v(g, { children: [r(n.only(i), q({
249
+ ref: z.setReference,
250
+ tabIndex: 0,
251
+ role: "button",
252
+ "aria-expanded": P,
253
+ disabled: o,
254
+ onClick: G
255
+ })), /* @__PURE__ */ _(W, {
256
+ disabled: o || !ee,
257
+ children: /* @__PURE__ */ _(y, {
258
+ "data-testid": "vs-popover-shadow",
259
+ onClick: U,
260
+ style: { zIndex: O },
261
+ autoFocus: !0,
262
+ children: /* @__PURE__ */ _("div", {
263
+ role: M || "region",
264
+ ref: z.setFloating,
265
+ style: B,
266
+ children: /* @__PURE__ */ _(ne, {
267
+ override: E,
268
+ styles: H,
269
+ ...K({
270
+ ...N,
271
+ onClick: G
272
+ }),
273
+ children: a
274
+ })
275
+ })
276
+ })
277
+ })] });
278
+ }
279
+ function ne({ override: e, styles: t, style: n = {}, ...r }) {
280
+ return /* @__PURE__ */ _(F, {
281
+ classList: ["z-20 w-auto h-auto outline-none transition-transform ease-in-out", e ? null : "border border-accent rounded-md shadow-lg p-1 bg-background"],
282
+ style: {
283
+ ...t,
284
+ ...n
285
+ },
286
+ ...r
287
+ });
288
+ }
289
+ //#endregion
290
+ //#region src/forms/Select/index.tsx
291
+ function q({ className: e, placeholder: t = "", options: n = [], error: r, disabled: i, value: a, maxHeight: o = 408, arrowIcon: s, closeIcon: l, checkIcon: u, onChange: d, onClear: f, renderItem: g, sectionLabelStyle: y, buttonAreaStyle: b, clearLabelText: x, optionStyle: S, ...C }) {
292
+ let w = m(null), [T, E] = h(0), D = p(() => Array.isArray(a), []), O = c((e) => {
293
+ d?.(e), D || w.current?.close();
294
+ }, [d, D]), k = c((e) => Array.isArray(a) ? a.indexOf(e) > -1 : a === e, [a]), A = p(() => {
295
+ let e = {}, t = n.filter((e) => typeof e != "string");
296
+ for (let n = 0, r = t.length; n < r; n += 1) {
297
+ let r = t[n];
298
+ e[`${r.value}`] = r.label;
299
+ }
300
+ return e;
301
+ }, [n]), j = p(() => {
302
+ if (!a) return t;
303
+ if (Array.isArray(a)) {
304
+ if (!a.length) return t;
305
+ let e = [...a].sort(), n = [];
306
+ for (let t = 0, r = e.length; t < r; t += 1) n[t] = A[`${e[t]}`] || "";
307
+ return n.filter(Boolean).join(",") || t;
308
+ }
309
+ return A[`${a}`] || t;
310
+ }, [
311
+ t,
312
+ a,
313
+ A
314
+ ]), M = p(() => a == null ? !0 : Array.isArray(a) ? !a.length : !1, [a]), N = c((e, t) => g ? typeof e == "string" ? g(e, {
315
+ index: t,
316
+ selected: !1,
317
+ onChange: () => {}
318
+ }) : g(e, {
319
+ index: t,
320
+ selected: k(e.value),
321
+ onChange: () => O(e.value)
322
+ }) : typeof e == "string" ? /* @__PURE__ */ _(F, {
323
+ as: "h5",
324
+ classList: ["font-normal py-1 px-2 text-muted"],
325
+ className: y,
326
+ children: e
327
+ }, `optionheader-${t}`) : /* @__PURE__ */ _(re, {
328
+ selected: k(e.value),
329
+ onChange: O,
330
+ checkIcon: u,
331
+ className: S,
332
+ ...e
333
+ }, e.label), [
334
+ g,
335
+ O,
336
+ k,
337
+ y,
338
+ S,
339
+ u
340
+ ]);
341
+ return /* @__PURE__ */ _(K, {
342
+ label: /* @__PURE__ */ v(F, {
343
+ as: "button",
344
+ type: "button",
345
+ classList: [
346
+ "flex items-center justify-between rounded-md border bg-background px-3 py-2 w-full overflow-hidden cursor-pointer",
347
+ "disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-ring",
348
+ r ? "border-danger hover:border-danger-fore" : "border-input not-disabled:hover:border-input-fore"
349
+ ],
350
+ className: e,
351
+ disabled: i,
352
+ ...C,
353
+ children: [/* @__PURE__ */ _(F, {
354
+ as: "span",
355
+ classList: ["overflow-hidden text-ellipsis whitespace-nowrap", M ? "text-muted" : "text-text"],
356
+ children: j
357
+ }), /* @__PURE__ */ v(F, {
358
+ classList: "relative flex items-center space-x-2",
359
+ className: b,
360
+ children: [f && !M ? /* @__PURE__ */ _("div", {
361
+ tabIndex: -1,
362
+ role: "button",
363
+ className: "size-6 p-1.5 rounded hover:bg-accent cursor-pointer",
364
+ "aria-label": x,
365
+ onKeyDown: (e) => {
366
+ (e.key === "Enter" || e.key === "Space") && f();
367
+ },
368
+ onClick: (e) => {
369
+ e.stopPropagation(), f();
370
+ },
371
+ children: l
372
+ }) : null, s]
373
+ })]
374
+ }),
375
+ ref: w,
376
+ onOpen: (e) => E(e?.getBoundingClientRect().width || 0),
377
+ disabled: i,
378
+ children: /* @__PURE__ */ _("ul", {
379
+ className: "overflow-y-auto flex flex-col",
380
+ role: "listbox",
381
+ style: {
382
+ minWidth: T,
383
+ maxWidth: "calc(100vw - 3rem)",
384
+ maxHeight: o
385
+ },
386
+ children: n.map(N)
387
+ })
388
+ });
389
+ }
390
+ function re({ className: e, value: t, label: n, selected: r, checkIcon: i, onChange: a }) {
391
+ return /* @__PURE__ */ v(F, {
392
+ as: "button",
393
+ type: "button",
394
+ role: "option",
395
+ classList: "flex items-center w-full hover:bg-accent rounded p-1 cursor-pointer",
396
+ className: e,
397
+ "aria-selected": r,
398
+ onClick: () => a?.(t),
399
+ children: [r && i ? i : /* @__PURE__ */ _("div", { className: "w-5 h-1 mr-1" }), n]
400
+ });
401
+ }
402
+ //#endregion
403
+ //#region src/forms/Radio/index.tsx
404
+ function ie({ checked: e, className: t, id: n, name: r, onChange: i, value: a, error: o, ...s }) {
405
+ let c = () => {
406
+ s.disabled || i?.(!e);
407
+ };
408
+ return /* @__PURE__ */ v(F, {
409
+ as: "button",
410
+ type: "button",
411
+ role: "radio",
412
+ id: n || r,
413
+ classList: [
414
+ "relative inline-flex justify-center items-center border w-4.5 h-4.5 rounded-full",
415
+ "cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed not-disabled:hover:border-input-fore",
416
+ o ? "border-danger" : "border-input",
417
+ e ? "[&_i]:bg-primary disabled:[&_i]:bg-text disabled:border-input" : ""
418
+ ],
419
+ className: t,
420
+ onClick: c,
421
+ "aria-checked": e,
422
+ ...s,
423
+ children: [/* @__PURE__ */ _("i", {
424
+ className: "block w-2.5 h-2.5 rounded-full transition-transform",
425
+ style: {
426
+ transform: e ? "" : "scale(0.8)",
427
+ opacity: +!!e
428
+ }
429
+ }), /* @__PURE__ */ _("input", {
430
+ type: "radio",
431
+ "aria-hidden": "true",
432
+ name: r,
433
+ checked: e,
434
+ value: a,
435
+ onChange: c,
436
+ disabled: s.disabled,
437
+ style: {
438
+ position: "absolute",
439
+ pointerEvents: "none",
440
+ top: 0,
441
+ left: 0,
442
+ width: 1,
443
+ height: 1,
444
+ opacity: 0
445
+ }
446
+ })]
447
+ });
448
+ }
449
+ //#endregion
450
+ //#region src/forms/Switch/index.tsx
451
+ function ae({ checked: e, onChange: t, value: n, id: r, name: i, error: a, ref: o, ...s }) {
452
+ let c = () => {
453
+ s.disabled || t?.(!e);
454
+ };
455
+ return /* @__PURE__ */ v(F, {
456
+ as: "button",
457
+ type: "button",
458
+ role: "switch",
459
+ id: r || i,
460
+ classList: [
461
+ "inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors",
462
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",
463
+ "w-11",
464
+ e ? "bg-primary disabled:bg-text" : "bg-input"
465
+ ],
466
+ onClick: c,
467
+ "aria-checked": e,
468
+ "aria-invalid": a,
469
+ ...s,
470
+ children: [/* @__PURE__ */ _("span", {
471
+ className: "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
472
+ style: { transform: e ? "translateX(100%)" : "" }
473
+ }), /* @__PURE__ */ _("input", {
474
+ ref: o,
475
+ type: "checkbox",
476
+ "aria-hidden": "true",
477
+ name: i,
478
+ checked: e,
479
+ value: n,
480
+ onChange: c,
481
+ disabled: s.disabled,
482
+ style: {
483
+ position: "absolute",
484
+ pointerEvents: "none",
485
+ top: 0,
486
+ left: 0,
487
+ width: 1,
488
+ height: 1,
489
+ opacity: 0
490
+ }
491
+ })]
492
+ });
493
+ }
494
+ //#endregion
495
+ //#region src/components/Accordion/index.tsx
496
+ function oe({ header: e, show: t, children: n, timeout: r = 300, ...i }) {
497
+ let a = m(null), o = m(0), s = m(0), c = m(!0);
498
+ return u(() => {
499
+ s.current = r;
500
+ }, [r]), U(() => {
501
+ if (!a.current) return;
502
+ if (a.current.style.overflow = "hidden", a.current.style.opacity = "1", c.current) {
503
+ c.current = !1, a.current.style.height = t ? "auto" : "0px", t ? window.requestAnimationFrame(() => {
504
+ a.current && (o.current = a.current.offsetHeight);
505
+ }) : (window.requestAnimationFrame(() => {
506
+ a.current && (a.current.style.height = "auto", o.current = a.current.offsetHeight, a.current.style.height = "0px");
507
+ }), a.current.style.opacity = "0");
508
+ return;
509
+ }
510
+ t || (a.current.style.height = `${o.current}px`);
511
+ let e = [];
512
+ e[0] = window.requestAnimationFrame(() => {
513
+ e[1] = window.requestAnimationFrame(() => {
514
+ a.current && (a.current.style.height = `${t ? o.current : 0}px`, a.current.style.opacity = t ? "1" : "0");
515
+ });
516
+ });
517
+ let n, r = () => {
518
+ a.current && (t ? (a.current.style.height = "auto", a.current.style.overflow = "", a.current.style.opacity = "", window.requestAnimationFrame(() => {
519
+ a.current && (o.current = a.current.offsetHeight);
520
+ })) : a.current.style.height = "0px");
521
+ };
522
+ return s.current === 0 ? r() : n = window.setTimeout(r, s.current), () => {
523
+ e.forEach(window.cancelAnimationFrame), n && window.clearTimeout(n);
524
+ };
525
+ }, [t]), /* @__PURE__ */ v("div", {
526
+ ...i,
527
+ children: [e, /* @__PURE__ */ _("div", {
528
+ className: "transition-all ease-in-out overflow-hidden",
529
+ role: "region",
530
+ "aria-hidden": !t,
531
+ ref: a,
532
+ style: { transitionDuration: `${r}ms` },
533
+ children: n
534
+ })]
535
+ });
536
+ }
537
+ //#endregion
538
+ //#region src/components/Tooltip/index.tsx
539
+ var J = o(({ children: e, position: t = "bottom", label: i, className: a, timeout: o = 150, offset: s = {
540
+ x: 0,
541
+ y: 6
542
+ }, clientPoint: c = !1, disabled: l }, f) => {
543
+ let [p, m] = h(!1), y = k(), { refs: w, floatingStyles: E, context: M } = D({
544
+ nodeId: y,
545
+ open: p,
546
+ placement: t,
547
+ middleware: [
548
+ C(),
549
+ x(),
550
+ S({
551
+ mainAxis: s.y,
552
+ crossAxis: s.x
553
+ })
554
+ ],
555
+ whileElementsMounted: l ? void 0 : b,
556
+ onOpenChange: m
557
+ }), { getReferenceProps: N, getFloatingProps: P } = A([O(M, { enabled: !l }), T(M, { enabled: c })]), { isMounted: F, styles: I } = j(M, {
558
+ duration: o,
559
+ initial: {
560
+ opacity: 0,
561
+ transform: "scale(0.8)"
562
+ }
563
+ });
564
+ d(f, () => ({
565
+ floating: w.floating,
566
+ reference: w.reference,
567
+ open: () => m(!0),
568
+ close: () => m(!1)
569
+ })), u(() => {
570
+ l && m(!1);
571
+ }, [l]);
572
+ let L = typeof e == "string" ? /* @__PURE__ */ _("span", { children: e }) : e;
573
+ return /* @__PURE__ */ v(g, { children: [r(n.only(L), {
574
+ ref: w.setReference,
575
+ ...N()
576
+ }), /* @__PURE__ */ _(W, {
577
+ disabled: l || !F,
578
+ children: /* @__PURE__ */ _("div", {
579
+ role: "tooltip",
580
+ className: "z-9999",
581
+ ref: w.setFloating,
582
+ ...P({ style: E }),
583
+ children: /* @__PURE__ */ _(Y, {
584
+ className: a,
585
+ style: I,
586
+ children: i
587
+ })
588
+ })
589
+ })] });
611
590
  });
612
- Re.displayName = "Tooltip";
613
- const de = se(({
614
- className: e,
615
- custom: t,
616
- ...r
617
- }, n) => {
618
- const s = k(() => O(M(
619
- "relative w-auto h-auto outline-none transition-transform ease-in-out whitespace-pre",
620
- t ? null : "border border-accent rounded shadow-md px-3 py-1 bg-background"
621
- ), e), [e, t]);
622
- return /* @__PURE__ */ i("div", { ref: n, className: s, ...r });
591
+ J.displayName = "Tooltip";
592
+ var Y = o(({ className: e, custom: t, ...n }, r) => {
593
+ let i = p(() => P(N("relative w-auto h-auto outline-none transition-transform ease-in-out whitespace-pre", t ? null : "border border-accent rounded shadow-md px-3 py-1 bg-background"), e), [e, t]);
594
+ return /* @__PURE__ */ _("div", {
595
+ ref: r,
596
+ className: i,
597
+ ...n
598
+ });
623
599
  });
624
- de.displayName = "TooltipContent";
625
- function Pe({ variant: e, size: t }) {
626
- return M(
627
- "inline-flex items-center justify-center whitespace-nowrap transition-colors rounded-md cursor-pointer",
628
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
629
- "disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-auto",
630
- {
631
- "bg-primary text-inverted hover:bg-primary-fore": !e || e === "primary",
632
- "bg-info text-inverted hover:bg-info-fore": e === "info",
633
- "bg-warn text-inverted hover:bg-warn-fore": e === "warn",
634
- "bg-danger text-inverted hover:bg-danger-fore": e === "danger",
635
- "hover:bg-accent": e === "ghost",
636
- "hover:underline": e === "link",
637
- "border border-input hover:bg-accent": e === "outline"
638
- },
639
- {
640
- "px-2 py-1": !t,
641
- "p-1.5": t === "icon"
642
- }
643
- );
644
- }
645
- function rt({ size: e, variant: t, className: r, ...n }) {
646
- const s = k(() => O(Pe({ size: e, variant: t }), r), [e, t, r]);
647
- return /* @__PURE__ */ i("button", { className: s, type: "button", ...n });
648
- }
649
- const Ee = { open: 150, close: 75 };
650
- function ot({
651
- open: e,
652
- children: t,
653
- timeout: r = Ee,
654
- padding: n = "0.85rem",
655
- verticalAlign: s = "center",
656
- closeOnOverlay: o,
657
- closeOnEsc: l,
658
- onExited: u,
659
- className: c,
660
- onOpenChange: d,
661
- size: g,
662
- ...m
663
- }) {
664
- const v = F(u), C = F(!1), p = Z(), { refs: a, context: x } = _({ open: e, onOpenChange: d, nodeId: p }), { getFloatingProps: b } = J([
665
- ve(x, {
666
- enabled: l,
667
- escapeKey: l,
668
- outsidePress: !1
669
- })
670
- ]), { isMounted: h, styles: y } = X(x, {
671
- duration: r,
672
- initial: { opacity: 0, transform: "scale(0.8)" }
673
- });
674
- L(() => {
675
- C.current !== h && (C.current = h, !h && v.current?.());
676
- }, [h]);
677
- const R = B(() => {
678
- o && d?.(!1);
679
- }, [d, o]);
680
- v.current = u;
681
- const S = k(() => M("grid bg-backdrop z-40 justify-items-center transition ease-in-out", {
682
- "place-items-start items-start": s === "start",
683
- "place-items-end": s === "end",
684
- "place-items-center": s === "center" || !s
685
- }), [s]);
686
- return /* @__PURE__ */ i(H, { disabled: !h, children: /* @__PURE__ */ i(
687
- Q,
688
- {
689
- className: S,
690
- "data-testid": "vs-dialog-overlay",
691
- onClick: R,
692
- style: { padding: n, opacity: y.opacity },
693
- lockScroll: !0,
694
- children: /* @__PURE__ */ i(
695
- Se,
696
- {
697
- ref: a.setFloating,
698
- className: c,
699
- role: "dialog",
700
- size: g,
701
- onClick: q,
702
- ...b({ ...m, style: y }),
703
- children: t
704
- }
705
- )
706
- }
707
- ) });
708
- }
709
- function Se({ size: e, ...t }) {
710
- return /* @__PURE__ */ i(
711
- w,
712
- {
713
- classList: [
714
- e ? "flex flex-col bg-background shadow-lg p-5 rounded" : null,
715
- {
716
- "w-full max-w-dialog-sm": e === "small",
717
- "w-full max-w-dialog-md": e === "medium",
718
- "w-full max-w-dialog-lg": e === "large"
719
- }
720
- ],
721
- ...t
722
- }
723
- );
724
- }
725
- const Be = { open: 250, close: 150 };
726
- function it({
727
- open: e,
728
- timeout: t = Be,
729
- onOpenChange: r,
730
- position: n = "right",
731
- overlay: s,
732
- onExited: o,
733
- onOpen: l,
734
- ...u
735
- }) {
736
- const c = Z(), d = F(!1), g = F(l), m = F(o), { refs: v, context: C } = _({ open: e, onOpenChange: r, nodeId: c }), { isMounted: p, styles: a } = X(C, {
737
- duration: t,
738
- initial() {
739
- let b = "translateX(75%)";
740
- return n === "left" ? b = "translateX(-75%)" : n === "top" ? b = "translateY(-75%)" : n === "bottom" && (b = "translateY(75%)"), { opacity: 0, transform: b };
741
- }
742
- });
743
- L(() => {
744
- if (d.current !== p) {
745
- if (d.current = p, p) {
746
- g.current?.();
747
- return;
748
- }
749
- m.current?.();
750
- }
751
- }, [p]);
752
- const x = k(() => M(
753
- "fixed transition-transform z-30",
754
- {
755
- "top-0 right-0 h-full max-h-screen": n === "right",
756
- "top-0 left-0 h-full max-h-screen": n === "left",
757
- "top-0 left-0 right-0 w-full max-w-screen": n === "top",
758
- "bottom-0 left-0 right-0 w-full max-w-screen": n === "bottom"
759
- }
760
- ), [n]);
761
- return m.current = o, g.current = l, /* @__PURE__ */ N(H, { disabled: !p, children: [
762
- s ? /* @__PURE__ */ i(
763
- Q,
764
- {
765
- className: "bg-backdrop",
766
- style: { opacity: a.opacity },
767
- onClick: () => r?.(!1)
768
- }
769
- ) : null,
770
- /* @__PURE__ */ i(
771
- "div",
772
- {
773
- ref: v.setFloating,
774
- className: x,
775
- role: "dialog",
776
- style: a,
777
- children: /* @__PURE__ */ i(De, { ...u })
778
- }
779
- )
780
- ] });
781
- }
782
- function De({ className: e, customStyle: t, ...r }) {
783
- const n = k(() => t ? e : O(M(
784
- "relative bg-background min-w-full min-h-full border border-input shadow-lg"
785
- ), e), [t, e]);
786
- return /* @__PURE__ */ i("div", { className: n, ...r });
787
- }
788
- function $e({ size: e = 20, label: t = "Loading...", ...r }) {
789
- return /* @__PURE__ */ N("div", { role: "status", ...r, children: [
790
- /* @__PURE__ */ N("svg", { "aria-hidden": "true", className: "text-accent animate-spin fill-primary", width: e, height: e, viewBox: "0 0 100 101", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
791
- /* @__PURE__ */ i("path", { d: "M100 50.6a50 50 0 1 1-100 0 50 50 0 0 1 100 0Zm-91 0a41 41 0 1 0 82 0 41 41 0 0 0-82 0Z", fill: "currentColor" }),
792
- /* @__PURE__ */ i("path", { d: "M94 39a4.2 4.2 0 0 0 3-5.4A50 50 0 0 0 41.7 1.3c-2.4.4-3.9 2.9-3.2 5.3a5 5 0 0 0 5.6 3.5A41 41 0 0 1 88 36 5 5 0 0 0 94 39Z", fill: "currentFill" })
793
- ] }),
794
- /* @__PURE__ */ i("span", { className: "sr-only", children: t })
795
- ] });
796
- }
797
- function je({ type: e, label: t, message: r }) {
798
- const { icons: n } = Xe();
799
- return /* @__PURE__ */ N("div", { className: "flex items-center px-4 py-3 w-80 text-sm bg-background border border-input rounded-lg shadow-md m-2", children: [
800
- e ? /* @__PURE__ */ N("figure", { className: "mr-2", children: [
801
- e === "success" && n?.success ? n.success : null,
802
- e === "info" && n?.info ? n.info : null,
803
- e === "error" && n?.error ? n.error : null,
804
- e === "warn" && n?.warn ? n.warn : null,
805
- e === "loading" ? /* @__PURE__ */ i($e, { size: 20 }) : null
806
- ] }) : null,
807
- /* @__PURE__ */ N("div", { className: "space-y-2", children: [
808
- /* @__PURE__ */ i("p", { className: "font-medium leading-none", children: t }),
809
- r ? /* @__PURE__ */ i("p", { children: r }) : null
810
- ] })
811
- ] });
812
- }
813
- function te() {
814
- }
815
- class Oe {
816
- /** システムで1つしか存在しない前提とする */
817
- notify = te;
818
- lastId = 0;
819
- /** internal use only */
820
- subscribe = (t) => (this.notify = t, () => {
821
- this.notify = te;
822
- });
823
- add = (t, r = {}) => {
824
- this.lastId += 1;
825
- const n = `${this.lastId}`;
826
- return this.notify({ id: n, type: "add", config: { id: n, label: t, ...r } }), n;
827
- };
828
- /** 表示中のtoastを修正します。promiseのロード状態を表示することなどに使います */
829
- update = (t, r) => {
830
- this.notify({ id: t, type: "update", config: r });
831
- };
832
- remove = (t) => {
833
- this.notify({ id: t, type: "remove" });
834
- };
835
- clear = () => {
836
- this.lastId = 0;
837
- };
838
- }
839
- const fe = new Oe();
840
- function _e({
841
- id: e,
842
- type: t,
843
- index: r,
844
- duration: n = 5e3,
845
- className: s,
846
- children: o,
847
- inverted: l,
848
- timeout: u = 250,
849
- max: c = 3
850
- }) {
851
- const d = F(!1), [g, m] = E(!1), { context: v, refs: C } = _({ open: g, onOpenChange: m, nodeId: e }), { isMounted: p, styles: a } = X(v, {
852
- duration: u,
853
- initial: { opacity: 0, transform: `translateY(${l ? "" : "-"}50%)` }
854
- });
855
- oe(() => {
856
- m(r <= c);
857
- }, [r, c]), L(() => {
858
- d.current !== p && (p || fe.remove(e), d.current = p);
859
- }, [p, e]), L(() => {
860
- if (!n) return;
861
- const h = window.setTimeout(() => m(!1), n);
862
- return () => window.clearTimeout(h);
863
- }, [n, e]);
864
- const x = B(() => {
865
- t !== "loading" && m(!1);
866
- }, [t]), b = k(() => U(
867
- "relative flex w-fit transition-transform ease-in-out cursor-pointer",
868
- s
869
- ), [s]);
870
- return p ? /* @__PURE__ */ i(
871
- "li",
872
- {
873
- role: "log",
874
- tabIndex: -1,
875
- ref: C.setFloating,
876
- className: b,
877
- style: a,
878
- onClick: x,
879
- children: o
880
- }
881
- ) : null;
882
- }
883
- const pe = me({});
884
- function Xe() {
885
- return he(pe);
886
- }
887
- function st({
888
- className: e,
889
- margin: t = 16,
890
- position: r = "top-left",
891
- max: n,
892
- ListItem: s = je,
893
- icons: o
894
- }) {
895
- const l = k(() => {
896
- const a = { position: "fixed" };
897
- return r.indexOf("top") > -1 ? a.top = t : r.indexOf("bottom") > -1 && (a.bottom = t), r.indexOf("left") > -1 ? (a.left = t, a.alignItems = "flex-start") : r.indexOf("right") > -1 ? (a.right = t, a.alignItems = "flex-end") : (a.left = "50%", a.alignItems = "center", a.transform = "translateX(-50%)"), a;
898
- }, [t, r]), u = k(() => U(
899
- "flex flex-col z-40 overflow-hidden",
900
- e
901
- ), [e]), c = k(() => r?.startsWith("bottom") || !1, [r]), d = F(/* @__PURE__ */ new Map()), [g, m] = E([]), v = E(0)[1];
902
- V(() => fe.subscribe((a) => {
903
- ge(() => {
904
- if (a.type === "add")
905
- d.current.set(a.id, a.config), m((x) => [...x, a.id]);
906
- else if (a.type === "remove") {
907
- if (!d.current.delete(a.id)) return;
908
- m((b) => {
909
- const h = new Set(b);
910
- return h.has(a.id) ? (h.delete(a.id), Array.from(h)) : b;
911
- });
912
- } else if (a.type === "update") {
913
- const x = d.current.get(a.id);
914
- if (!x) return;
915
- d.current.set(a.id, { ...x, ...a.config }), v((b) => b + 1);
916
- }
917
- });
918
- }), []);
919
- const C = k(() => ({ icons: o }), [o]), p = g.length;
920
- return /* @__PURE__ */ i(H, { children: /* @__PURE__ */ i("ol", { className: u, style: l, "aria-live": "polite", children: /* @__PURE__ */ i(pe.Provider, { value: C, children: g.map((a, x) => {
921
- const b = d.current.get(a);
922
- if (!b) return null;
923
- const { className: h, duration: y, ...R } = b;
924
- return /* @__PURE__ */ i(
925
- _e,
926
- {
927
- id: a,
928
- index: p - x,
929
- className: h,
930
- duration: y,
931
- inverted: c,
932
- max: n,
933
- children: re(s, R)
934
- },
935
- a
936
- );
937
- }) }) }) });
938
- }
939
- function lt(e) {
940
- return /* @__PURE__ */ i(w, { classList: "inline-block animate-pulse rounded-md bg-accent", ...e });
941
- }
942
- function at(e) {
943
- return /* @__PURE__ */ i(
944
- w,
945
- {
946
- role: "group",
947
- classList: [
948
- "flex items-center justify-center",
949
- "[&_button]:rounded-none **:first:rounded-bl **:first:rounded-tl **:last:rounded-br **:last:rounded-tr",
950
- "**:first:border-r-0 **:last:border-l-0"
951
- ],
952
- ...e
953
- }
954
- );
955
- }
956
- function ut({ value: e, max: t, ...r }) {
957
- const n = k(() => e ? Math.min(100, Math.round(e / t * 100)) : 0, [e, t]);
958
- return /* @__PURE__ */ i(
959
- w,
960
- {
961
- role: "progressbar",
962
- classList: "relative overflow-hidden rounded-full bg-primary",
963
- "aria-valuemax": t,
964
- "aria-valuemin": 0,
965
- ...r,
966
- children: /* @__PURE__ */ i(
967
- w,
968
- {
969
- className: "h-full w-full flex-1 bg-input transition-all origin-right",
970
- style: { transform: `translateX(${n}%)` }
971
- }
972
- )
973
- }
974
- );
975
- }
976
- function ct({ orientation: e = "horizontal", ...t }) {
977
- return /* @__PURE__ */ i(
978
- w,
979
- {
980
- as: "hr",
981
- role: "none",
982
- classList: [
983
- "border-0 p-0 shrink-0 bg-input",
984
- e === "horizontal" ? "h-px w-full" : "w-px h-full"
985
- ],
986
- ...t
987
- }
988
- );
989
- }
990
- export {
991
- nt as Accordion,
992
- w as Base,
993
- rt as Button,
994
- at as ButtonGroup,
995
- Qe as Checkbox,
996
- ot as Dialog,
997
- ct as Divider,
998
- Ke as FormField,
999
- ke as FormLabel,
1000
- Ue as Input,
1001
- Ge as InputField,
1002
- Te as Popover,
1003
- H as Portal,
1004
- ut as Progress,
1005
- et as Radio,
1006
- Ve as Select,
1007
- it as Sheet,
1008
- lt as Skeleton,
1009
- $e as Spinner,
1010
- tt as Switch,
1011
- Je as Textarea,
1012
- st as Toast,
1013
- je as ToastItem,
1014
- Re as Tooltip,
1015
- M as cn,
1016
- O as merge,
1017
- fe as toast,
1018
- Pe as varientButton
600
+ Y.displayName = "TooltipContent";
601
+ //#endregion
602
+ //#region src/elements/Button/index.tsx
603
+ function X({ variant: e, size: t }) {
604
+ return N("inline-flex items-center justify-center whitespace-nowrap transition-colors rounded-md cursor-pointer", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", "disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-auto", {
605
+ "bg-primary text-inverted hover:bg-primary-fore": !e || e === "primary",
606
+ "bg-info text-inverted hover:bg-info-fore": e === "info",
607
+ "bg-warn text-inverted hover:bg-warn-fore": e === "warn",
608
+ "bg-danger text-inverted hover:bg-danger-fore": e === "danger",
609
+ "hover:bg-accent": e === "ghost",
610
+ "hover:underline": e === "link",
611
+ "border border-input hover:bg-accent": e === "outline"
612
+ }, {
613
+ "px-2 py-1": !t,
614
+ "p-1.5": t === "icon"
615
+ });
616
+ }
617
+ function se({ size: e, variant: t, className: n, ...r }) {
618
+ let i = p(() => P(X({
619
+ size: e,
620
+ variant: t
621
+ }), n), [
622
+ e,
623
+ t,
624
+ n
625
+ ]);
626
+ return /* @__PURE__ */ _("button", {
627
+ className: i,
628
+ type: "button",
629
+ ...r
630
+ });
631
+ }
632
+ //#endregion
633
+ //#region src/components/Dialog/index.tsx
634
+ var ce = {
635
+ open: 150,
636
+ close: 75
637
+ };
638
+ function le({ open: e, children: t, timeout: n = ce, padding: r = "0.85rem", verticalAlign: i = "center", closeOnOverlay: a, closeOnEsc: o, onExited: s, className: l, onOpenChange: d, size: f, ...h }) {
639
+ let g = m(s), v = m(!1), b = k(), { refs: x, context: S } = D({
640
+ open: e,
641
+ onOpenChange: d,
642
+ nodeId: b
643
+ }), { getFloatingProps: C } = A([E(S, {
644
+ enabled: o,
645
+ escapeKey: o,
646
+ outsidePress: !1
647
+ })]), { isMounted: w, styles: T } = j(S, {
648
+ duration: n,
649
+ initial: {
650
+ opacity: 0,
651
+ transform: "scale(0.8)"
652
+ }
653
+ });
654
+ u(() => {
655
+ v.current !== w && (v.current = w, !w && g.current?.());
656
+ }, [w]);
657
+ let O = c(() => {
658
+ a && d?.(!1);
659
+ }, [d, a]);
660
+ g.current = s;
661
+ let M = p(() => N("grid bg-backdrop z-40 justify-items-center transition ease-in-out", {
662
+ "place-items-start items-start": i === "start",
663
+ "place-items-end": i === "end",
664
+ "place-items-center": i === "center" || !i
665
+ }), [i]);
666
+ return /* @__PURE__ */ _(W, {
667
+ disabled: !w,
668
+ children: /* @__PURE__ */ _(y, {
669
+ className: M,
670
+ "data-testid": "vs-dialog-overlay",
671
+ onClick: O,
672
+ style: {
673
+ padding: r,
674
+ opacity: T.opacity
675
+ },
676
+ lockScroll: !0,
677
+ children: /* @__PURE__ */ _(ue, {
678
+ ref: x.setFloating,
679
+ className: l,
680
+ role: "dialog",
681
+ size: f,
682
+ onClick: G,
683
+ ...C({
684
+ ...h,
685
+ style: T
686
+ }),
687
+ children: t
688
+ })
689
+ })
690
+ });
691
+ }
692
+ function ue({ size: e, ...t }) {
693
+ return /* @__PURE__ */ _(F, {
694
+ classList: [e ? "flex flex-col bg-background shadow-lg p-5 rounded" : null, {
695
+ "w-full max-w-dialog-sm": e === "small",
696
+ "w-full max-w-dialog-md": e === "medium",
697
+ "w-full max-w-dialog-lg": e === "large"
698
+ }],
699
+ ...t
700
+ });
701
+ }
702
+ //#endregion
703
+ //#region src/elements/Skeleton/index.tsx
704
+ function de(e) {
705
+ return /* @__PURE__ */ _(F, {
706
+ classList: "inline-block animate-pulse rounded-md bg-accent",
707
+ ...e
708
+ });
709
+ }
710
+ //#endregion
711
+ //#region src/elements/Button/ButtonGroup.tsx
712
+ function fe(e) {
713
+ return /* @__PURE__ */ _(F, {
714
+ role: "group",
715
+ classList: [
716
+ "flex items-center justify-center",
717
+ "[&_button]:rounded-none **:first:rounded-bl **:first:rounded-tl **:last:rounded-br **:last:rounded-tr",
718
+ "**:first:border-r-0 **:last:border-l-0"
719
+ ],
720
+ ...e
721
+ });
722
+ }
723
+ //#endregion
724
+ //#region src/elements/Spinner/index.tsx
725
+ function Z({ size: e = 20, label: t = "Loading...", ...n }) {
726
+ return /* @__PURE__ */ v("div", {
727
+ role: "status",
728
+ ...n,
729
+ children: [/* @__PURE__ */ v("svg", {
730
+ "aria-hidden": "true",
731
+ className: "text-accent animate-spin fill-primary",
732
+ width: e,
733
+ height: e,
734
+ viewBox: "0 0 100 101",
735
+ fill: "none",
736
+ xmlns: "http://www.w3.org/2000/svg",
737
+ children: [/* @__PURE__ */ _("path", {
738
+ d: "M100 50.6a50 50 0 1 1-100 0 50 50 0 0 1 100 0Zm-91 0a41 41 0 1 0 82 0 41 41 0 0 0-82 0Z",
739
+ fill: "currentColor"
740
+ }), /* @__PURE__ */ _("path", {
741
+ d: "M94 39a4.2 4.2 0 0 0 3-5.4A50 50 0 0 0 41.7 1.3c-2.4.4-3.9 2.9-3.2 5.3a5 5 0 0 0 5.6 3.5A41 41 0 0 1 88 36 5 5 0 0 0 94 39Z",
742
+ fill: "currentFill"
743
+ })]
744
+ }), /* @__PURE__ */ _("span", {
745
+ className: "sr-only",
746
+ children: t
747
+ })]
748
+ });
749
+ }
750
+ //#endregion
751
+ //#region src/elements/Progress/index.tsx
752
+ function pe({ value: e, max: t, ...n }) {
753
+ let r = p(() => e ? Math.min(100, Math.round(e / t * 100)) : 0, [e, t]);
754
+ return /* @__PURE__ */ _(F, {
755
+ role: "progressbar",
756
+ classList: "relative overflow-hidden rounded-full bg-primary",
757
+ "aria-valuemax": t,
758
+ "aria-valuemin": 0,
759
+ ...n,
760
+ children: /* @__PURE__ */ _(F, {
761
+ className: "h-full w-full flex-1 bg-input transition-all origin-right",
762
+ style: { transform: `translateX(${r}%)` }
763
+ })
764
+ });
765
+ }
766
+ //#endregion
767
+ //#region src/elements/Divider/index.tsx
768
+ function me({ orientation: e = "horizontal", ...t }) {
769
+ return /* @__PURE__ */ _(F, {
770
+ as: "hr",
771
+ role: "none",
772
+ classList: ["border-0 p-0 shrink-0 bg-input", e === "horizontal" ? "h-px w-full" : "w-px h-full"],
773
+ ...t
774
+ });
775
+ }
776
+ //#endregion
777
+ //#region src/components/Sheet/index.tsx
778
+ var he = {
779
+ open: 250,
780
+ close: 150
1019
781
  };
782
+ function ge({ open: e, timeout: t = he, onOpenChange: n, position: r = "right", overlay: i, onExited: a, onOpen: o, ...s }) {
783
+ let c = k(), l = m(!1), d = m(o), f = m(a), { refs: p, context: h } = D({
784
+ open: e,
785
+ onOpenChange: n,
786
+ nodeId: c
787
+ }), { isMounted: g, styles: b } = j(h, {
788
+ duration: t,
789
+ initial() {
790
+ let e = "translateX(75%)";
791
+ return r === "left" ? e = "translateX(-75%)" : r === "top" ? e = "translateY(-75%)" : r === "bottom" && (e = "translateY(75%)"), {
792
+ opacity: 0,
793
+ transform: e
794
+ };
795
+ }
796
+ });
797
+ return u(() => {
798
+ if (l.current !== g) {
799
+ if (l.current = g, g) {
800
+ d.current?.();
801
+ return;
802
+ }
803
+ f.current?.();
804
+ }
805
+ }, [g]), f.current = a, d.current = o, /* @__PURE__ */ v(W, {
806
+ disabled: !g,
807
+ children: [i ? /* @__PURE__ */ _(y, {
808
+ className: "bg-backdrop",
809
+ style: { opacity: b.opacity },
810
+ onClick: () => n?.(!1)
811
+ }) : null, /* @__PURE__ */ _(F, {
812
+ ref: p.setFloating,
813
+ role: "dialog",
814
+ classList: ["fixed transition-transform z-30", {
815
+ "top-0 right-0 h-full max-h-screen": r === "right",
816
+ "top-0 left-0 h-full max-h-screen": r === "left",
817
+ "top-0 left-0 right-0 w-full max-w-screen": r === "top",
818
+ "bottom-0 left-0 right-0 w-full max-w-screen": r === "bottom"
819
+ }],
820
+ style: b,
821
+ children: /* @__PURE__ */ _(_e, { ...s })
822
+ })]
823
+ });
824
+ }
825
+ function _e(e) {
826
+ return /* @__PURE__ */ _(F, {
827
+ classList: "relative bg-background min-w-full min-h-full border border-input shadow-lg",
828
+ ...e
829
+ });
830
+ }
831
+ //#endregion
832
+ //#region src/components/Toast/ToastItem.tsx
833
+ function Q({ type: e, label: t, message: n }) {
834
+ let { icons: r } = xe();
835
+ return /* @__PURE__ */ v("div", {
836
+ className: "flex items-center px-4 py-3 w-80 text-sm bg-background border border-input rounded-lg shadow-md m-2",
837
+ children: [e ? /* @__PURE__ */ v("figure", {
838
+ className: "mr-2",
839
+ children: [
840
+ e === "success" && r?.success ? r.success : null,
841
+ e === "info" && r?.info ? r.info : null,
842
+ e === "error" && r?.error ? r.error : null,
843
+ e === "warn" && r?.warn ? r.warn : null,
844
+ e === "loading" ? /* @__PURE__ */ _(Z, { size: 20 }) : null
845
+ ]
846
+ }) : null, /* @__PURE__ */ v("div", {
847
+ className: "space-y-2",
848
+ children: [/* @__PURE__ */ _("p", {
849
+ className: "font-medium leading-none",
850
+ children: t
851
+ }), n ? /* @__PURE__ */ _("p", { children: n }) : null]
852
+ })]
853
+ });
854
+ }
855
+ //#endregion
856
+ //#region src/components/Toast/observer.ts
857
+ function ve() {}
858
+ var $ = new class {
859
+ notify = ve;
860
+ lastId = 0;
861
+ subscribe = (e) => (this.notify = e, () => {
862
+ this.notify = ve;
863
+ });
864
+ add = (e, t = {}) => {
865
+ this.lastId += 1;
866
+ let n = `${this.lastId}`;
867
+ return this.notify({
868
+ id: n,
869
+ type: "add",
870
+ config: {
871
+ id: n,
872
+ label: e,
873
+ ...t
874
+ }
875
+ }), n;
876
+ };
877
+ update = (e, t) => {
878
+ this.notify({
879
+ id: e,
880
+ type: "update",
881
+ config: t
882
+ });
883
+ };
884
+ remove = (e) => {
885
+ this.notify({
886
+ id: e,
887
+ type: "remove"
888
+ });
889
+ };
890
+ clear = () => {
891
+ this.lastId = 0;
892
+ };
893
+ }();
894
+ //#endregion
895
+ //#region src/components/Toast/ToastFloat.tsx
896
+ function ye({ id: t, type: n, index: r, duration: i = 5e3, className: a, children: o, inverted: s, timeout: l = 250, max: d = 3 }) {
897
+ let g = m(!1), [v, y] = h(!1), { context: b, refs: x } = D({
898
+ open: v,
899
+ onOpenChange: y,
900
+ nodeId: t
901
+ }), { isMounted: S, styles: C } = j(b, {
902
+ duration: l,
903
+ initial: {
904
+ opacity: 0,
905
+ transform: `translateY(${s ? "" : "-"}50%)`
906
+ }
907
+ });
908
+ f(() => {
909
+ y(r <= d);
910
+ }, [r, d]), u(() => {
911
+ g.current !== S && (S || $.remove(t), g.current = S);
912
+ }, [S, t]), u(() => {
913
+ if (!i) return;
914
+ let e = window.setTimeout(() => y(!1), i);
915
+ return () => window.clearTimeout(e);
916
+ }, [i, t]);
917
+ let w = c(() => {
918
+ n !== "loading" && y(!1);
919
+ }, [n]), T = p(() => e("relative flex w-fit transition-transform ease-in-out cursor-pointer", a), [a]);
920
+ return S ? /* @__PURE__ */ _("li", {
921
+ role: "log",
922
+ tabIndex: -1,
923
+ ref: x.setFloating,
924
+ className: T,
925
+ style: C,
926
+ onClick: w,
927
+ children: o
928
+ }) : null;
929
+ }
930
+ //#endregion
931
+ //#region src/components/Toast/index.tsx
932
+ var be = i({});
933
+ function xe() {
934
+ return l(be);
935
+ }
936
+ function Se({ className: t, offset: n = {}, position: r = "top-left", max: i, ListItem: o = Q, icons: c }) {
937
+ let l = p(() => {
938
+ let e = {
939
+ position: "fixed",
940
+ ...n
941
+ };
942
+ return Object.keys(n).length || (r.indexOf("top") > -1 ? e.top = "16px" : r.indexOf("bottom") > -1 && (e.bottom = "16px"), r.indexOf("left") > -1 ? e.left = "16px" : r.indexOf("right") > -1 && (e.right = "16px")), r.indexOf("left") > -1 ? e.alignItems = "flex-start" : r.indexOf("right") > -1 ? e.alignItems = "flex-end" : (e.left = "50%", e.alignItems = "center", e.transform = "translateX(-50%)"), e;
943
+ }, [n, r]), u = p(() => e("flex flex-col z-40 overflow-hidden", t), [t]), d = p(() => r?.startsWith("bottom") || !1, [r]), f = m(/* @__PURE__ */ new Map()), [g, v] = h([]), y = h(0)[1];
944
+ U(() => $.subscribe((e) => {
945
+ s(() => {
946
+ if (e.type === "add") f.current.set(e.id, e.config), v((t) => [...t, e.id]);
947
+ else if (e.type === "remove") {
948
+ if (!f.current.delete(e.id)) return;
949
+ v((t) => {
950
+ let n = new Set(t);
951
+ return n.has(e.id) ? (n.delete(e.id), Array.from(n)) : t;
952
+ });
953
+ } else if (e.type === "update") {
954
+ let t = f.current.get(e.id);
955
+ if (!t) return;
956
+ f.current.set(e.id, {
957
+ ...t,
958
+ ...e.config
959
+ }), y((e) => e + 1);
960
+ }
961
+ });
962
+ }), []);
963
+ let b = p(() => ({ icons: c }), [c]), x = g.length;
964
+ return /* @__PURE__ */ _(W, { children: /* @__PURE__ */ _("ol", {
965
+ className: u,
966
+ style: l,
967
+ "aria-live": "polite",
968
+ children: /* @__PURE__ */ _(be.Provider, {
969
+ value: b,
970
+ children: g.map((e, t) => {
971
+ let n = f.current.get(e);
972
+ if (!n) return null;
973
+ let { className: r, duration: s, ...c } = n;
974
+ return /* @__PURE__ */ _(ye, {
975
+ id: e,
976
+ index: x - t,
977
+ className: r,
978
+ duration: s,
979
+ inverted: d,
980
+ max: i,
981
+ children: a(o, c)
982
+ }, e);
983
+ })
984
+ })
985
+ }) });
986
+ }
987
+ //#endregion
988
+ export { oe as Accordion, F as Base, se as Button, fe as ButtonGroup, H as Checkbox, le as Dialog, me as Divider, L as FormField, I as FormLabel, B as Input, z as InputField, K as Popover, W as Portal, pe as Progress, ie as Radio, q as Select, ge as Sheet, de as Skeleton, Z as Spinner, ae as Switch, V as Textarea, Se as Toast, Q as ToastItem, J as Tooltip, N as cn, P as merge, $ as toast, X as varientButton };