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