welcome-ui 0.0.0-dev.1759222868187 → 0.0.0-dev.1759252708223

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 (49) hide show
  1. package/dist/4CMBR7SL-DXQR7a9T.js +308 -0
  2. package/dist/{ASMQKSDT-CyLroRiC.js → ASMQKSDT-GE79MhKX.js} +12 -12
  3. package/dist/{AXB53BZF-DBGkYxAF.js → AXB53BZF-ClCOTGI-.js} +3 -3
  4. package/dist/Accordion.js +3 -3
  5. package/dist/{BYC7LY2E-sahp7oqU.js → BYC7LY2E-DeD1QoQl.js} +108 -108
  6. package/dist/Button.js +1 -1
  7. package/dist/Checkbox.js +1 -1
  8. package/dist/Drawer.js +4 -4
  9. package/dist/DropdownMenu.js +140 -139
  10. package/dist/FieldGroup.css +1 -0
  11. package/dist/FieldGroup.js +17 -0
  12. package/dist/ITI7HKP4-MlgGFEDr.js +187 -0
  13. package/dist/InputText.css +1 -1
  14. package/dist/InputText.js +34 -34
  15. package/dist/{JC64G2H7-oyI4lllS.js → JC64G2H7-jNBZrGfv.js} +126 -126
  16. package/dist/{KUU7WJ55-iyg84yrl.js → KUU7WJ55-CRa_letc.js} +1 -1
  17. package/dist/{LVA2YJMS-BmLXjKP9.js → LVA2YJMS-C6Bdr5Em.js} +35 -35
  18. package/dist/Label.js +13 -13
  19. package/dist/{MTZPJQMC-CEQxLFTu.js → MTZPJQMC-DgscjgO6.js} +2 -2
  20. package/dist/Modal.js +3 -3
  21. package/dist/{NLEBE274-BPGIVzin.js → NLEBE274-BlP1TDp5.js} +16 -16
  22. package/dist/{P2CTZE2T-CHi91Yb8.js → P2CTZE2T-DqsBJuIy.js} +32 -32
  23. package/dist/{P4IRICAX-CIAVAXlF.js → P4IRICAX-CvgWqpy0.js} +3 -3
  24. package/dist/Popover.js +3 -3
  25. package/dist/{QYJ6MIDR-DRpzeJNT.js → QYJ6MIDR-BWg_HLyh.js} +3 -3
  26. package/dist/Radio.css +1 -1
  27. package/dist/Radio.js +39 -38
  28. package/dist/RadioGroup.css +1 -0
  29. package/dist/RadioGroup.js +72 -0
  30. package/dist/RadioTab.js +1 -1
  31. package/dist/{SYRFVSLH-vrz7_KNH.js → SYRFVSLH-D5X1Ofws.js} +3 -3
  32. package/dist/Slider.css +1 -0
  33. package/dist/Slider.js +423 -0
  34. package/dist/Tabs.js +79 -78
  35. package/dist/Toggle.js +1 -1
  36. package/dist/Tooltip.js +31 -31
  37. package/dist/{VGCJ63VH-CV_AMRHp.js → VGCJ63VH-Bdd6jzVW.js} +31 -31
  38. package/dist/{X5NMLKT6-DqDJBMYO.js → X5NMLKT6-C7-nsL44.js} +2 -2
  39. package/dist/{YV4JVR4I-CvfP1OCB.js → YV4JVR4I-BN6SUVuh.js} +54 -54
  40. package/dist/types/components/FieldGroup/index.d.ts +1 -0
  41. package/dist/types/components/FieldGroup/types.d.ts +8 -0
  42. package/dist/types/components/Label/index.d.ts +1 -1
  43. package/dist/types/components/RadioGroup/index.d.ts +2 -0
  44. package/dist/types/components/RadioGroup/types.d.ts +17 -0
  45. package/dist/types/components/Slider/Range.d.ts +6 -0
  46. package/dist/types/components/Slider/index.d.ts +10 -0
  47. package/dist/types/components/Slider/types.d.ts +28 -0
  48. package/package.json +1 -1
  49. package/dist/ITI7HKP4-BwM8j6XI.js +0 -488
@@ -1,488 +0,0 @@
1
- "use client";
2
- import { t as ve, c as Y, s as $, i as Ie, g as ee, e as B, a as pe } from "./YV4JVR4I-CvfP1OCB.js";
3
- import { A as h, B as q, N as Se, C as T, O as ge, F as Ee, D as xe, t as ye, c as we, _ as ie, i as be, P as Pe, Q as Ce, E as te, R as O, S as he, T as _e, u as U, p as z, e as Fe, q as ae, v as Ae, b as ke, j as Be, d as ne, n as De, U as Ke, f as Le, a as Re } from "./LVA2YJMS-BmLXjKP9.js";
4
- import { C as Te, a as ue, b as Me, g as R, s as Oe, i as Q, f as ze, c as Ne } from "./P2CTZE2T-CHi91Yb8.js";
5
- import { P as We, a as Ue } from "./MTZPJQMC-CEQxLFTu.js";
6
- import { createContext as X, useRef as re, useEffect as ce, useState as Ve, useCallback as He } from "react";
7
- import { jsx as $e } from "react/jsx-runtime";
8
- function qe(e) {
9
- var s;
10
- const n = e.find((c) => !!c.element), t = [...e].reverse().find((c) => !!c.element);
11
- let i = (s = n == null ? void 0 : n.element) == null ? void 0 : s.parentElement;
12
- for (; i && (t != null && t.element); ) {
13
- if (t && i.contains(t.element))
14
- return i;
15
- i = i.parentElement;
16
- }
17
- return Ee(i).body;
18
- }
19
- function je(e) {
20
- return e == null ? void 0 : e.__unstablePrivateStore;
21
- }
22
- function Ge(e = {}) {
23
- var s;
24
- ve(e, e.store);
25
- const n = (s = e.store) == null ? void 0 : s.getState(), t = h(
26
- e.items,
27
- n == null ? void 0 : n.items,
28
- e.defaultItems,
29
- []
30
- ), i = new Map(t.map((a) => [a.id, a])), c = {
31
- items: t,
32
- renderedItems: h(n == null ? void 0 : n.renderedItems, [])
33
- }, l = je(e.store), u = Y(
34
- { items: t, renderedItems: c.renderedItems },
35
- l
36
- ), r = Y(c, e.store), P = (a) => {
37
- const f = ge(a, (m) => m.element);
38
- u.setState("renderedItems", f), r.setState("renderedItems", f);
39
- };
40
- $(r, () => Ie(u)), $(u, () => ee(u, ["items"], (a) => {
41
- r.setState("items", a.items);
42
- })), $(u, () => ee(u, ["renderedItems"], (a) => {
43
- let f = !0, m = requestAnimationFrame(() => {
44
- const { renderedItems: S } = r.getState();
45
- a.renderedItems !== S && P(a.renderedItems);
46
- });
47
- if (typeof IntersectionObserver != "function")
48
- return () => cancelAnimationFrame(m);
49
- const y = () => {
50
- if (f) {
51
- f = !1;
52
- return;
53
- }
54
- cancelAnimationFrame(m), m = requestAnimationFrame(() => P(a.renderedItems));
55
- }, K = qe(a.renderedItems), p = new IntersectionObserver(y, { root: K });
56
- for (const S of a.renderedItems)
57
- S.element && p.observe(S.element);
58
- return () => {
59
- cancelAnimationFrame(m), p.disconnect();
60
- };
61
- }));
62
- const v = (a, f, m = !1) => {
63
- let y;
64
- return f((p) => {
65
- const S = p.findIndex(({ id: w }) => w === a.id), _ = p.slice();
66
- if (S !== -1) {
67
- y = p[S];
68
- const w = T(T({}, y), a);
69
- _[S] = w, i.set(a.id, w);
70
- } else
71
- _.push(a), i.set(a.id, a);
72
- return _;
73
- }), () => {
74
- f((p) => {
75
- if (!y)
76
- return m && i.delete(a.id), p.filter(({ id: w }) => w !== a.id);
77
- const S = p.findIndex(({ id: w }) => w === a.id);
78
- if (S === -1) return p;
79
- const _ = p.slice();
80
- return _[S] = y, i.set(a.id, y), _;
81
- });
82
- };
83
- }, L = (a) => v(
84
- a,
85
- (f) => u.setState("items", f),
86
- !0
87
- );
88
- return q(T({}, r), {
89
- registerItem: L,
90
- renderItem: (a) => Se(
91
- L(a),
92
- v(
93
- a,
94
- (f) => u.setState("renderedItems", f)
95
- )
96
- ),
97
- item: (a) => {
98
- if (!a) return null;
99
- let f = i.get(a);
100
- if (!f) {
101
- const { items: m } = u.getState();
102
- f = m.find((y) => y.id === a), f && i.set(a, f);
103
- }
104
- return f || null;
105
- },
106
- // @ts-expect-error Internal
107
- __unstablePrivateStore: u
108
- });
109
- }
110
- function Qe(e, s, n) {
111
- return xe(s, [n.store]), B(e, n, "items", "setItems"), e;
112
- }
113
- function le(e) {
114
- const s = [];
115
- for (const n of e)
116
- s.push(...n);
117
- return s;
118
- }
119
- function J(e) {
120
- return e.slice().reverse();
121
- }
122
- var Ye = { id: null };
123
- function D(e, s) {
124
- return e.find((n) => s ? !n.disabled && n.id !== s : !n.disabled);
125
- }
126
- function Je(e, s) {
127
- return e.filter((n) => s ? !n.disabled && n.id !== s : !n.disabled);
128
- }
129
- function oe(e, s) {
130
- return e.filter((n) => n.rowId === s);
131
- }
132
- function Xe(e, s, n = !1) {
133
- const t = e.findIndex((i) => i.id === s);
134
- return [
135
- ...e.slice(t + 1),
136
- ...n ? [Ye] : [],
137
- ...e.slice(0, t)
138
- ];
139
- }
140
- function de(e) {
141
- const s = [];
142
- for (const n of e) {
143
- const t = s.find((i) => {
144
- var c;
145
- return ((c = i[0]) == null ? void 0 : c.rowId) === n.rowId;
146
- });
147
- t ? t.push(n) : s.push([n]);
148
- }
149
- return s;
150
- }
151
- function fe(e) {
152
- let s = 0;
153
- for (const { length: n } of e)
154
- n > s && (s = n);
155
- return s;
156
- }
157
- function Ze(e) {
158
- return {
159
- id: "__EMPTY_ITEM__",
160
- disabled: !0,
161
- rowId: e
162
- };
163
- }
164
- function et(e, s, n) {
165
- const t = fe(e);
166
- for (const i of e)
167
- for (let c = 0; c < t; c += 1) {
168
- const l = i[c];
169
- if (!l || n && l.disabled) {
170
- const r = c === 0 && n ? D(i) : i[c - 1];
171
- i[c] = r && s !== r.id && n ? r : Ze(r == null ? void 0 : r.rowId);
172
- }
173
- }
174
- return e;
175
- }
176
- function tt(e) {
177
- const s = de(e), n = fe(s), t = [];
178
- for (let i = 0; i < n; i += 1)
179
- for (const c of s) {
180
- const l = c[i];
181
- l && t.push(q(T({}, l), {
182
- // If there's no rowId, it means that it's not a grid composite, but
183
- // a single row instead. So, instead of verticalizing it, that is,
184
- // assigning a different rowId based on the column index, we keep it
185
- // undefined so they will be part of the same row. This is useful
186
- // when using up/down on one-dimensional composites.
187
- rowId: l.rowId ? `${i}` : void 0
188
- }));
189
- }
190
- return t;
191
- }
192
- function gt(e = {}) {
193
- var s;
194
- const n = (s = e.store) == null ? void 0 : s.getState(), t = Ge(e), i = h(
195
- e.activeId,
196
- n == null ? void 0 : n.activeId,
197
- e.defaultActiveId
198
- ), c = q(T({}, t.getState()), {
199
- id: h(
200
- e.id,
201
- n == null ? void 0 : n.id,
202
- `id-${Math.random().toString(36).slice(2, 8)}`
203
- ),
204
- activeId: i,
205
- baseElement: h(n == null ? void 0 : n.baseElement, null),
206
- includesBaseElement: h(
207
- e.includesBaseElement,
208
- n == null ? void 0 : n.includesBaseElement,
209
- i === null
210
- ),
211
- moves: h(n == null ? void 0 : n.moves, 0),
212
- orientation: h(
213
- e.orientation,
214
- n == null ? void 0 : n.orientation,
215
- "both"
216
- ),
217
- rtl: h(e.rtl, n == null ? void 0 : n.rtl, !1),
218
- virtualFocus: h(
219
- e.virtualFocus,
220
- n == null ? void 0 : n.virtualFocus,
221
- !1
222
- ),
223
- focusLoop: h(e.focusLoop, n == null ? void 0 : n.focusLoop, !1),
224
- focusWrap: h(e.focusWrap, n == null ? void 0 : n.focusWrap, !1),
225
- focusShift: h(e.focusShift, n == null ? void 0 : n.focusShift, !1)
226
- }), l = Y(c, t, e.store);
227
- $(
228
- l,
229
- () => pe(l, ["renderedItems", "activeId"], (r) => {
230
- l.setState("activeId", (P) => {
231
- var v;
232
- return P !== void 0 ? P : (v = D(r.renderedItems)) == null ? void 0 : v.id;
233
- });
234
- })
235
- );
236
- const u = (r = "next", P = {}) => {
237
- var v, L;
238
- const a = l.getState(), {
239
- skip: f = 0,
240
- activeId: m = a.activeId,
241
- focusShift: y = a.focusShift,
242
- focusLoop: K = a.focusLoop,
243
- focusWrap: p = a.focusWrap,
244
- includesBaseElement: S = a.includesBaseElement,
245
- renderedItems: _ = a.renderedItems,
246
- rtl: w = a.rtl
247
- } = P, F = r === "up" || r === "down", N = r === "next" || r === "down", j = N ? w && !F : !w || F, V = y && !f;
248
- let g = F ? le(
249
- et(de(_), m, V)
250
- ) : _;
251
- if (g = j ? J(g) : g, g = F ? tt(g) : g, m == null)
252
- return (v = D(g)) == null ? void 0 : v.id;
253
- const M = g.find((I) => I.id === m);
254
- if (!M)
255
- return (L = D(g)) == null ? void 0 : L.id;
256
- const H = g.some((I) => I.rowId), G = g.indexOf(M), o = g.slice(G + 1), d = oe(o, M.rowId);
257
- if (f) {
258
- const I = Je(d, m), b = I.slice(f)[0] || // If we can't find an item, just return the last one.
259
- I[I.length - 1];
260
- return b == null ? void 0 : b.id;
261
- }
262
- const E = K && (F ? K !== "horizontal" : K !== "vertical"), x = H && p && (F ? p !== "horizontal" : p !== "vertical"), C = N ? (!H || F) && E && S : F ? S : !1;
263
- if (E) {
264
- const I = x && !C ? g : oe(g, M.rowId), b = Xe(I, m, C), k = D(b, m);
265
- return k == null ? void 0 : k.id;
266
- }
267
- if (x) {
268
- const I = D(
269
- // We can use nextItems, which contains all the next items, including
270
- // items from other rows, to wrap between rows. However, if there is a
271
- // null item (the composite container), we'll only use the next items in
272
- // the row. So moving next from the last item will focus on the
273
- // composite container. On grid composites, horizontal navigation never
274
- // focuses on the composite container, only vertical.
275
- C ? d : o,
276
- m
277
- );
278
- return C ? (I == null ? void 0 : I.id) || null : I == null ? void 0 : I.id;
279
- }
280
- const A = D(d, m);
281
- return !A && C ? null : A == null ? void 0 : A.id;
282
- };
283
- return q(T(T({}, t), l), {
284
- setBaseElement: (r) => l.setState("baseElement", r),
285
- setActiveId: (r) => l.setState("activeId", r),
286
- move: (r) => {
287
- r !== void 0 && (l.setState("activeId", r), l.setState("moves", (P) => P + 1));
288
- },
289
- first: () => {
290
- var r;
291
- return (r = D(l.getState().renderedItems)) == null ? void 0 : r.id;
292
- },
293
- last: () => {
294
- var r;
295
- return (r = D(J(l.getState().renderedItems))) == null ? void 0 : r.id;
296
- },
297
- next: (r) => (r !== void 0 && typeof r == "number" && (r = { skip: r }), u("next", r)),
298
- previous: (r) => (r !== void 0 && typeof r == "number" && (r = { skip: r }), u("previous", r)),
299
- down: (r) => (r !== void 0 && typeof r == "number" && (r = { skip: r }), u("down", r)),
300
- up: (r) => (r !== void 0 && typeof r == "number" && (r = { skip: r }), u("up", r))
301
- });
302
- }
303
- function Et(e, s, n) {
304
- return e = Qe(e, s, n), B(e, n, "activeId", "setActiveId"), B(e, n, "includesBaseElement"), B(e, n, "virtualFocus"), B(e, n, "orientation"), B(e, n, "rtl"), B(e, n, "focusLoop"), B(e, n, "focusWrap"), B(e, n, "focusShift"), e;
305
- }
306
- X(
307
- void 0
308
- );
309
- var me = ye(
310
- [Ue, ue],
311
- [We, Te]
312
- ), xt = me.useContext, yt = me.useProviderContext;
313
- X(
314
- void 0
315
- );
316
- X(!1);
317
- var nt = "div";
318
- function rt(e) {
319
- return e.some((s) => !!s.rowId);
320
- }
321
- function ot(e) {
322
- const s = e.target;
323
- return s && !ae(s) ? !1 : e.key.length === 1 && !e.ctrlKey && !e.metaKey;
324
- }
325
- function st(e) {
326
- return e.key === "Shift" || e.key === "Control" || e.key === "Alt" || e.key === "Meta";
327
- }
328
- function se(e, s, n) {
329
- return U((t) => {
330
- var i;
331
- if (s == null || s(t), t.defaultPrevented || t.isPropagationStopped() || !z(t) || st(t) || ot(t)) return;
332
- const c = e.getState(), l = (i = R(e, c.activeId)) == null ? void 0 : i.element;
333
- if (!l) return;
334
- const u = t, { view: r } = u, P = ie(u, ["view"]), v = n == null ? void 0 : n.current;
335
- l !== v && l.focus(), Ke(l, t.type, P) || t.preventDefault(), t.currentTarget.contains(l) && t.stopPropagation();
336
- });
337
- }
338
- function it(e) {
339
- return ze(
340
- le(J(Ne(e)))
341
- );
342
- }
343
- function at(e) {
344
- const [s, n] = Ve(!1), t = He(() => n(!0), []), i = e.useState(
345
- (c) => R(e, c.activeId)
346
- );
347
- return ce(() => {
348
- const c = i == null ? void 0 : i.element;
349
- s && c && (n(!1), c.focus({ preventScroll: !0 }));
350
- }, [i, s]), t;
351
- }
352
- var ut = we(
353
- function(s) {
354
- var n = s, {
355
- store: t,
356
- composite: i = !0,
357
- focusOnMove: c = i,
358
- moveOnKeyPress: l = !0
359
- } = n, u = ie(n, [
360
- "store",
361
- "composite",
362
- "focusOnMove",
363
- "moveOnKeyPress"
364
- ]);
365
- const r = Me();
366
- t = t || r, be(
367
- t,
368
- process.env.NODE_ENV !== "production" && "Composite must receive a `store` prop or be wrapped in a CompositeProvider component."
369
- );
370
- const P = re(null), v = re(null), L = at(t), a = t.useState("moves"), [, f] = Pe(
371
- i ? t.setBaseElement : null
372
- );
373
- ce(() => {
374
- var o;
375
- if (!t || !a || !i || !c) return;
376
- const { activeId: d } = t.getState(), E = (o = R(t, d)) == null ? void 0 : o.element;
377
- E && Ce(E);
378
- }, [t, a, i, c]), te(() => {
379
- if (!t || !a || !i) return;
380
- const { baseElement: o, activeId: d } = t.getState();
381
- if (!(d === null) || !o) return;
382
- const x = v.current;
383
- v.current = null, x && O(x, { relatedTarget: o }), he(o) || o.focus();
384
- }, [t, a, i]);
385
- const m = t.useState("activeId"), y = t.useState("virtualFocus");
386
- te(() => {
387
- var o;
388
- if (!t || !i || !y) return;
389
- const d = v.current;
390
- if (v.current = null, !d) return;
391
- const x = ((o = R(t, m)) == null ? void 0 : o.element) || _e(d);
392
- x !== d && O(d, { relatedTarget: x });
393
- }, [t, m, y, i]);
394
- const K = se(
395
- t,
396
- u.onKeyDownCapture,
397
- v
398
- ), p = se(
399
- t,
400
- u.onKeyUpCapture,
401
- v
402
- ), S = u.onFocusCapture, _ = U((o) => {
403
- if (S == null || S(o), o.defaultPrevented || !t) return;
404
- const { virtualFocus: d } = t.getState();
405
- if (!d) return;
406
- const E = o.relatedTarget, x = Oe(o.currentTarget);
407
- z(o) && x && (o.stopPropagation(), v.current = E);
408
- }), w = u.onFocus, F = U((o) => {
409
- if (w == null || w(o), o.defaultPrevented || !i || !t) return;
410
- const { relatedTarget: d } = o, { virtualFocus: E } = t.getState();
411
- E ? z(o) && !Q(t, d) && queueMicrotask(L) : z(o) && t.setActiveId(null);
412
- }), N = u.onBlurCapture, j = U((o) => {
413
- var d;
414
- if (N == null || N(o), o.defaultPrevented || !t) return;
415
- const { virtualFocus: E, activeId: x } = t.getState();
416
- if (!E) return;
417
- const C = (d = R(t, x)) == null ? void 0 : d.element, A = o.relatedTarget, I = Q(t, A), b = v.current;
418
- v.current = null, z(o) && I ? (A === C ? b && b !== A && O(b, o) : C ? O(C, o) : b && O(b, o), o.stopPropagation()) : !Q(t, o.target) && C && O(C, o);
419
- }), V = u.onKeyDown, g = Fe(l), M = U((o) => {
420
- var d;
421
- if (V == null || V(o), o.defaultPrevented || !t || !z(o)) return;
422
- const { orientation: E, renderedItems: x, activeId: C } = t.getState(), A = R(t, C);
423
- if ((d = A == null ? void 0 : A.element) != null && d.isConnected) return;
424
- const I = E !== "horizontal", b = E !== "vertical", k = rt(x);
425
- if ((o.key === "ArrowLeft" || o.key === "ArrowRight" || o.key === "Home" || o.key === "End") && ae(o.currentTarget)) return;
426
- const Z = {
427
- ArrowUp: (k || I) && (() => {
428
- if (k) {
429
- const W = it(x);
430
- return W == null ? void 0 : W.id;
431
- }
432
- return t == null ? void 0 : t.last();
433
- }),
434
- ArrowRight: (k || b) && t.first,
435
- ArrowDown: (k || I) && t.first,
436
- ArrowLeft: (k || b) && t.last,
437
- Home: t.first,
438
- End: t.last,
439
- PageUp: t.first,
440
- PageDown: t.last
441
- }[o.key];
442
- if (Z) {
443
- const W = Z();
444
- if (W !== void 0) {
445
- if (!g(o)) return;
446
- o.preventDefault(), t.move(W);
447
- }
448
- }
449
- });
450
- u = Ae(
451
- u,
452
- (o) => /* @__PURE__ */ $e(ue, { value: t, children: o }),
453
- [t]
454
- );
455
- const H = t.useState((o) => {
456
- var d;
457
- if (t && i && o.virtualFocus)
458
- return (d = R(t, o.activeId)) == null ? void 0 : d.id;
459
- });
460
- u = ke(ne({
461
- "aria-activedescendant": H
462
- }, u), {
463
- ref: Be(P, f, u.ref),
464
- onKeyDownCapture: K,
465
- onKeyUpCapture: p,
466
- onFocusCapture: _,
467
- onFocus: F,
468
- onBlurCapture: j,
469
- onKeyDown: M
470
- });
471
- const G = t.useState(
472
- (o) => i && (o.virtualFocus || o.activeId === null)
473
- );
474
- return u = De(ne({ focusable: G }, u)), u;
475
- }
476
- );
477
- Le(function(s) {
478
- const n = ut(s);
479
- return Re(nt, n);
480
- });
481
- export {
482
- Ge as a,
483
- Et as b,
484
- gt as c,
485
- ut as d,
486
- yt as e,
487
- xt as u
488
- };