visits-style 2.2.0 → 2.2.2

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