@wirecore/wirelayer-react 0.8.0 → 0.9.0

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 (46) hide show
  1. package/dist/ContextMenu-GCeoPu8T.js +1523 -0
  2. package/dist/PasswordInput-CxZXGV2m.js +449 -0
  3. package/dist/{Select-C2CiPTCK.js → Select-CGyqfOm3.js} +65 -65
  4. package/dist/components/Avatar/Avatar.d.ts +3 -1
  5. package/dist/components/Avatar/Avatar.d.ts.map +1 -1
  6. package/dist/components/Card/Card.d.ts +3 -1
  7. package/dist/components/Card/Card.d.ts.map +1 -1
  8. package/dist/components/Code/Code.d.ts +11 -0
  9. package/dist/components/Code/Code.d.ts.map +1 -0
  10. package/dist/components/ContextMenu/ContextMenu.d.ts +4 -3
  11. package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
  12. package/dist/components/Dialog/Dialog.d.ts +7 -3
  13. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  14. package/dist/components/NativeSelect/NativeSelect.d.ts +9 -6
  15. package/dist/components/NativeSelect/NativeSelect.d.ts.map +1 -1
  16. package/dist/components/NumberInput/NumberInput.d.ts +11 -3
  17. package/dist/components/NumberInput/NumberInput.d.ts.map +1 -1
  18. package/dist/components/Progress/Progress.d.ts +5 -2
  19. package/dist/components/Progress/Progress.d.ts.map +1 -1
  20. package/dist/components/RadioGroup/RadioGroup.d.ts +12 -5
  21. package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  22. package/dist/components/SegmentedControl/SegmentedControl.d.ts +12 -4
  23. package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  24. package/dist/components/Select/Select.d.ts +11 -5
  25. package/dist/components/Select/Select.d.ts.map +1 -1
  26. package/dist/components/Stepper/Stepper.d.ts +3 -1
  27. package/dist/components/Stepper/Stepper.d.ts.map +1 -1
  28. package/dist/components/Tabs/Tabs.d.ts +11 -2
  29. package/dist/components/Tabs/Tabs.d.ts.map +1 -1
  30. package/dist/components/Wizard/Wizard.d.ts +11 -3
  31. package/dist/components/Wizard/Wizard.d.ts.map +1 -1
  32. package/dist/data-table.js +2 -2
  33. package/dist/hooks/index.d.ts +1 -1
  34. package/dist/hooks/index.d.ts.map +1 -1
  35. package/dist/hooks/media.d.ts +7 -0
  36. package/dist/hooks/media.d.ts.map +1 -1
  37. package/dist/index.d.ts +5 -3
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1931 -1898
  40. package/dist/pdf.js +2 -2
  41. package/dist/sources/Code.css +2 -0
  42. package/llms-full.txt +56 -13
  43. package/llms.txt +1 -0
  44. package/package.json +3 -3
  45. package/dist/ContextMenu-C6ZaMtqf.js +0 -1511
  46. package/dist/PasswordInput-dpeKVREo.js +0 -425
@@ -1,1511 +0,0 @@
1
- "use client";
2
- import { a as e, i as t, n } from "./RecipesProvider-0idafuGm.js";
3
- import { r, t as i } from "./InputStatus-hVzkU_4q.js";
4
- import { t as a } from "./Input-CtYSQznO.js";
5
- import { t as o } from "./Select-C2CiPTCK.js";
6
- import { t as s } from "./label-for-DYgV5EwH.js";
7
- import { a as c, c as l, n as u, o as d } from "./Highlight-43-H9459.js";
8
- import { SUBMENU_GUTTER as f, allListOptionsState as p, anchorBox as m, closeMenuOnPageEvents as h, controlIds as g, createLongPress as _, datePicker as v, defaultNumberFormat as ee, filterMenuEntries as y, fromWallIso as b, highlightFirstMenuItem as x, indexListOptions as S, insertIntoTextControl as C, isoWeekday as w, linkTarget as T, localeWeekInfo as E, menu as D, menuSearchKey as te, multiSelect as O, numberInput as k, numberInputKey as A, pageForSize as j, pagination as M, parseLocaleNumber as N, parsePastedDate as P, parsePastedRange as ne, pluralText as re, rowWeekNumber as F, setTextControlValue as I, skeleton as ie, textarea as L, textareaParts as ae, timeSlots as oe, timeZoneLabel as se, timeZoneLongLabel as ce, toNumberInputValue as le, toOverlayAnchor as ue, toWallIso as de, todayIso as R, toggleAllListOptions as z, zonedToInstant as fe } from "@wirecore/wirelayer-recipes";
9
- import { CalendarDays as pe, Check as me, ChevronDown as he, ChevronLeft as B, ChevronRight as V, ChevronUp as ge, ChevronsLeft as H, ChevronsRight as U, Circle as _e, LoaderCircle as ve, Minus as ye, Plus as be, X as xe } from "lucide-react";
10
- import { Fragment as Se, createContext as W, createElement as Ce, useContext as we, useEffect as Te, useId as Ee, useImperativeHandle as De, useLayoutEffect as Oe, useMemo as ke, useRef as G, useState as K } from "react";
11
- import { useFilter as Ae } from "@ark-ui/react/locale";
12
- import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
13
- import { Menu as X } from "@ark-ui/react/menu";
14
- import { Portal as je } from "@ark-ui/react/portal";
15
- import { Field as Me, useFieldContext as Ne } from "@ark-ui/react/field";
16
- import { Pagination as Z } from "@ark-ui/react/pagination";
17
- import { createListCollection as Pe } from "@ark-ui/react/collection";
18
- import { Select as Q } from "@ark-ui/react/select";
19
- import { DatePicker as $, useDatePickerContext as Fe } from "@ark-ui/react/date-picker";
20
- import { DateInput as Ie } from "@ark-ui/react/date-input";
21
- import { CalendarDateTime as Le, DateFormatter as Re, Time as ze, parseDate as Be, parseDateTime as Ve, toCalendarDateTime as He } from "@internationalized/date";
22
- import { NumberInput as Ue } from "@ark-ui/react/number-input";
23
- //#region src/overlay.ts
24
- var We = (e) => e && "current" in e ? e.current : e ?? null, Ge = typeof document > "u" ? Te : Oe;
25
- function Ke(e) {
26
- let [t, n] = K(e.defaultOpen ?? !1), [r, i] = K(null), a = e.open ?? t, o = r ?? We(e.anchor), s = G(null), c = G(!1);
27
- c.current = !!o;
28
- let l = G(a);
29
- Ge(() => {
30
- if (l.current !== a) {
31
- if (l.current = a, a) s.current = document.activeElement;
32
- else if (e.restoreFocus) {
33
- let e = s.current, t = () => {
34
- if (l.current) return;
35
- let t = document.activeElement;
36
- (!t || t === document.body || !t.isConnected || t.closest("[data-scope=menu]")) && e?.focus();
37
- };
38
- requestAnimationFrame(() => {
39
- t(), setTimeout(t, 50);
40
- });
41
- }
42
- }
43
- }, [a]);
44
- let u = (t) => {
45
- n(t), e.onOpenChange?.(t);
46
- }, d = (e) => {
47
- e && i(null), u(e);
48
- }, f = {
49
- open(e) {
50
- i(ue(e)), u(!0);
51
- },
52
- close: () => u(!1),
53
- toggle(e) {
54
- a ? f.close() : f.open(e);
55
- }
56
- };
57
- return De(e.ref, () => f), {
58
- isOpen: a,
59
- anchor: o,
60
- anchorPoint: o && !("getBoundingClientRect" in o) ? o : void 0,
61
- onOpenChange: d,
62
- handle: f,
63
- positioning: (e) => o ? "getBoundingClientRect" in o ? {
64
- ...e,
65
- getAnchorElement: () => o
66
- } : {
67
- ...e,
68
- getAnchorRect: () => m(o)
69
- } : e,
70
- finalFocusEl: () => c.current ? s.current : null
71
- };
72
- }
73
- //#endregion
74
- //#region src/components/Menu/Menu.tsx
75
- var qe = W(null);
76
- function Je(e) {
77
- let [t, n] = K({
78
- items: e.items,
79
- checked: {},
80
- radio: {}
81
- }), r = t.items === e.items ? t : {
82
- items: e.items,
83
- checked: {},
84
- radio: {}
85
- };
86
- return r !== t && n(r), {
87
- checked: (e) => r.checked[e.value] ?? e.checked ?? !1,
88
- setChecked: (t, i) => {
89
- n({
90
- ...r,
91
- checked: {
92
- ...r.checked,
93
- [t.value]: i
94
- }
95
- }), e.onCheckedChange?.(t.value, i);
96
- },
97
- radio: (e) => r.radio[e.name] ?? e.value,
98
- setRadio: (t, i) => {
99
- n({
100
- ...r,
101
- radio: {
102
- ...r.radio,
103
- [t.name]: i
104
- }
105
- }), e.onValueChange?.(t.name, i);
106
- },
107
- linkAs: e.linkAs ?? "a",
108
- renderItem: e.renderItem
109
- };
110
- }
111
- function Ye({ children: e, ...t }) {
112
- return /* @__PURE__ */ J(qe.Provider, {
113
- value: Je(t),
114
- children: e
115
- });
116
- }
117
- function Xe(e, t, n, { closeOnScroll: r = !1, closeOnResize: i = !1, closeOnBlur: a = !1, highlightFirst: o = !1 }) {
118
- let s = G(t);
119
- Te(() => {
120
- s.current = t;
121
- }), Te(() => {
122
- if (e && (r || i || a)) return h(() => s.current(), {
123
- scroll: r,
124
- resize: i,
125
- blur: a
126
- });
127
- }, [
128
- e,
129
- r,
130
- i,
131
- a
132
- ]);
133
- let [c, l] = K(null), [u, d] = K(e);
134
- return u !== e && (d(e), l(null)), Te(() => {
135
- if (!e || !o) return;
136
- let t = requestAnimationFrame(() => {
137
- n.current && x(n.current, { setHighlightedValue: (e) => l((t) => t ?? e) });
138
- });
139
- return () => cancelAnimationFrame(t);
140
- }, [
141
- e,
142
- o,
143
- n
144
- ]), o ? {
145
- highlightedValue: c,
146
- onHighlightChange: (e) => l(e.highlightedValue)
147
- } : {};
148
- }
149
- function Ze({ classes: t, items: r, onSelect: i, onCheckedChange: a, onValueChange: o, linkAs: s, renderItem: c, open: l, defaultOpen: u, onOpenChange: d, anchor: f, searchable: p, searchLabel: m, placement: h = "bottom-start", arrow: g, closeOnScroll: _, closeOnResize: v, closeOnBlur: ee, highlightFirst: b, ref: S, children: C }) {
150
- let w = n("menu", D, t)(), T = e(), E = Ke({
151
- open: l,
152
- defaultOpen: u,
153
- anchor: f,
154
- onOpenChange: d,
155
- ref: S,
156
- restoreFocus: !0
157
- }), [O, k] = K(""), [A, j] = K(), M = Ae({
158
- sensitivity: "base",
159
- usage: "sort"
160
- }), N = p && O ? y(r, (e) => M.contains(e, O)) : r, P = G(null), [ne, re] = K(E.isOpen);
161
- ne !== E.isOpen && (re(E.isOpen), k(""), j(void 0)), Te(() => {
162
- if (!E.isOpen || !p) return;
163
- let e = requestAnimationFrame(() => {
164
- e = requestAnimationFrame(() => P.current?.focus());
165
- });
166
- return () => cancelAnimationFrame(e);
167
- }, [E.isOpen, p]);
168
- let F = m ?? T.menu.search, I = G(null), ie = Xe(E.isOpen, E.handle.close, I, {
169
- closeOnScroll: _,
170
- closeOnResize: v,
171
- closeOnBlur: ee,
172
- highlightFirst: b
173
- });
174
- return /* @__PURE__ */ J(Ye, {
175
- items: r,
176
- linkAs: s,
177
- renderItem: c,
178
- onCheckedChange: a,
179
- onValueChange: o,
180
- children: /* @__PURE__ */ Y(X.Root, {
181
- open: E.isOpen,
182
- onOpenChange: (e) => E.onOpenChange(e.open),
183
- positioning: E.positioning({
184
- placement: h,
185
- gutter: g ? 10 : 8
186
- }),
187
- anchorPoint: E.anchorPoint,
188
- ...ie,
189
- lazyMount: !0,
190
- unmountOnExit: !0,
191
- onSelect: (e) => i?.(e.value),
192
- children: [C && /* @__PURE__ */ J(X.Trigger, {
193
- asChild: !0,
194
- children: C
195
- }), /* @__PURE__ */ J(je, { children: /* @__PURE__ */ J(X.Positioner, { children: /* @__PURE__ */ Y(X.Content, {
196
- ref: I,
197
- className: w.content(),
198
- children: [
199
- g && /* @__PURE__ */ J(X.Arrow, {
200
- className: w.arrow(),
201
- children: /* @__PURE__ */ J(X.ArrowTip, { className: w.arrowTip() })
202
- }),
203
- p && /* @__PURE__ */ J(X.Context, { children: (e) => /* @__PURE__ */ J("div", {
204
- role: "group",
205
- "aria-label": F,
206
- className: w.search(),
207
- children: /* @__PURE__ */ J("input", {
208
- ref: P,
209
- type: "text",
210
- autoComplete: "off",
211
- className: w.searchInput(),
212
- placeholder: F,
213
- "aria-label": F,
214
- "aria-activedescendant": A,
215
- onChange: (t) => {
216
- let n = t.currentTarget;
217
- k(n.value), requestAnimationFrame(() => j(x(n, e)));
218
- },
219
- onKeyDown: (t) => {
220
- let n = te(t.nativeEvent, e);
221
- n && j(n);
222
- }
223
- })
224
- }) }),
225
- /* @__PURE__ */ J($e, {
226
- entries: N,
227
- onSelect: i
228
- }),
229
- p && !N.length && /* @__PURE__ */ J("div", {
230
- role: "group",
231
- className: w.empty(),
232
- children: /* @__PURE__ */ J("span", {
233
- role: "status",
234
- children: T.common.noResults
235
- })
236
- })
237
- ]
238
- }) }) })]
239
- })
240
- });
241
- }
242
- function Qe({ item: e, shortcut: t }) {
243
- let r = we(qe), i = n("menu", D)();
244
- if (r?.renderItem) return r.renderItem(e);
245
- let a = e.icon;
246
- return /* @__PURE__ */ Y(q, { children: [
247
- a && /* @__PURE__ */ J(a, {
248
- className: i.icon(),
249
- "aria-hidden": "true"
250
- }),
251
- /* @__PURE__ */ J("span", {
252
- className: i.label(),
253
- children: e.label
254
- }),
255
- t && /* @__PURE__ */ J("span", {
256
- className: i.shortcut(),
257
- "aria-hidden": "true",
258
- children: t
259
- })
260
- ] });
261
- }
262
- function $e({ entries: e, onSelect: t }) {
263
- let r = n("menu", D), i = r(), a = we(qe);
264
- return e.map((e, n) => {
265
- if ("type" in e) return e.type === "separator" ? /* @__PURE__ */ J(X.Separator, { className: i.separator() }, `separator-${n}`) : e.type === "checkbox" ? /* @__PURE__ */ Y(X.CheckboxItem, {
266
- value: e.value,
267
- checked: a?.checked(e) ?? !!e.checked,
268
- onCheckedChange: (t) => a?.setChecked(e, t),
269
- disabled: e.disabled,
270
- closeOnSelect: e.closeOnSelect ?? !1,
271
- className: i.item(),
272
- children: [/* @__PURE__ */ J("span", {
273
- className: i.indicator(),
274
- children: /* @__PURE__ */ J(X.ItemIndicator, { children: /* @__PURE__ */ J(me, {
275
- className: i.indicatorIcon(),
276
- "aria-hidden": "true"
277
- }) })
278
- }), /* @__PURE__ */ J(Qe, { item: e })]
279
- }, e.value) : e.type === "radio" ? /* @__PURE__ */ Y(X.RadioItemGroup, {
280
- value: a?.radio(e),
281
- onValueChange: (t) => a?.setRadio(e, t.value),
282
- children: [e.label && /* @__PURE__ */ J(X.ItemGroupLabel, {
283
- className: i.groupLabel(),
284
- children: e.label
285
- }), e.items.map((e) => /* @__PURE__ */ Y(X.RadioItem, {
286
- value: e.value,
287
- disabled: e.disabled,
288
- closeOnSelect: e.closeOnSelect ?? !1,
289
- className: i.item(),
290
- children: [/* @__PURE__ */ J("span", {
291
- className: i.indicator(),
292
- children: /* @__PURE__ */ J(X.ItemIndicator, { children: /* @__PURE__ */ J(_e, {
293
- className: i.indicatorDot(),
294
- "aria-hidden": "true"
295
- }) })
296
- }), /* @__PURE__ */ J(Qe, { item: e })]
297
- }, e.value))]
298
- }, `radio-${e.name}`) : /* @__PURE__ */ Y(X.ItemGroup, { children: [/* @__PURE__ */ J(X.ItemGroupLabel, {
299
- className: i.groupLabel(),
300
- children: e.label
301
- }), /* @__PURE__ */ J($e, {
302
- entries: e.items,
303
- onSelect: t
304
- })] }, `group-${n}`);
305
- let o = e.icon;
306
- if (e.children) return /* @__PURE__ */ Y(X.Root, {
307
- positioning: {
308
- placement: "right-start",
309
- offset: { mainAxis: f }
310
- },
311
- onSelect: (e) => t?.(e.value),
312
- children: [/* @__PURE__ */ Y(X.TriggerItem, {
313
- className: i.item(),
314
- children: [
315
- o && /* @__PURE__ */ J(o, {
316
- className: i.icon(),
317
- "aria-hidden": "true"
318
- }),
319
- /* @__PURE__ */ J("span", {
320
- className: i.label(),
321
- children: e.label
322
- }),
323
- /* @__PURE__ */ J(V, {
324
- className: i.submenuIcon(),
325
- "aria-hidden": "true"
326
- })
327
- ]
328
- }), /* @__PURE__ */ J(je, { children: /* @__PURE__ */ J(X.Positioner, { children: /* @__PURE__ */ J(X.Content, {
329
- className: i.content(),
330
- children: /* @__PURE__ */ J($e, {
331
- entries: e.children,
332
- onSelect: t
333
- })
334
- }) }) })]
335
- }, e.value);
336
- if (e.href || e.to) {
337
- let t = a?.linkAs ?? "a";
338
- return /* @__PURE__ */ J(X.Item, {
339
- value: e.value,
340
- disabled: e.disabled,
341
- closeOnSelect: e.closeOnSelect,
342
- asChild: !0,
343
- children: /* @__PURE__ */ J(t, {
344
- ...T(e.href, e.to),
345
- className: r({ danger: e.danger }).item(),
346
- children: /* @__PURE__ */ J(Qe, {
347
- item: e,
348
- shortcut: e.shortcut
349
- })
350
- })
351
- }, e.value);
352
- }
353
- return /* @__PURE__ */ J(Se, { children: /* @__PURE__ */ J(X.Item, {
354
- value: e.value,
355
- disabled: e.disabled,
356
- closeOnSelect: e.closeOnSelect,
357
- className: r({ danger: e.danger }).item(),
358
- children: /* @__PURE__ */ J(Qe, {
359
- item: e,
360
- shortcut: e.shortcut
361
- })
362
- }) }, e.value);
363
- });
364
- }
365
- //#endregion
366
- //#region src/components/Textarea/Textarea.tsx
367
- function et({ classes: t, size: a, invalid: o = !1, success: s = !1, disabled: c = !1, autoResize: l = !1, minRows: u, maxRows: d, showCount: f = !1, loading: p = !1, clearable: m = !1, clearLabel: h, mono: g = !1, className: _, style: v, onInput: ee, onChange: y, ref: b, ...x }) {
368
- let S = n("textarea", L, t), C = n("textareaParts", ae, t), w = e(), T = Ne(), E = r(), D = o || !!T?.invalid, te = !D && (s || E.success), O = c || !!T?.disabled, k = !!x.readOnly || !!T?.readOnly, A = G(null);
369
- De(b, () => A.current, []);
370
- let j = x.maxLength && x.maxLength > 0 ? x.maxLength : void 0, M = f && j !== void 0, N = p || m || te, P = M || p || m, [ne, re] = K(() => String(x.defaultValue ?? "").length), F = x.value === void 0 ? ne : String(x.value ?? "").length, ie = () => {
371
- let e = A.current;
372
- if (!l || !e) return;
373
- e.style.height = "auto";
374
- let t = e.offsetHeight - e.clientHeight, n = e.scrollHeight + t;
375
- if (u || d) {
376
- let r = getComputedStyle(e), i = parseFloat(r.lineHeight) || parseFloat(r.fontSize) * 1.5, a = parseFloat(r.paddingTop) + parseFloat(r.paddingBottom) + t, o = d ? d * i + a : Infinity;
377
- e.style.overflowY = n > o ? "auto" : "", n = Math.min(Math.max(n, u ? u * i + a : 0), o);
378
- }
379
- e.style.height = `${n}px`;
380
- };
381
- Oe(ie);
382
- let oe = Ee(), [se, ce] = K(""), le = G(void 0);
383
- Te(() => () => clearTimeout(le.current), []);
384
- let ue = (e) => {
385
- M && (clearTimeout(le.current), le.current = setTimeout(() => ce(w.textarea.remaining(j - e, j)), 1e3));
386
- }, de = () => {
387
- let e = A.current;
388
- e && (I(e), e.focus());
389
- }, R = /* @__PURE__ */ J(Me.Textarea, {
390
- ...x,
391
- ref: A,
392
- rows: x.rows ?? u,
393
- className: S({
394
- size: a,
395
- invalid: D,
396
- success: te,
397
- disabled: O,
398
- autoResize: l,
399
- hasTrailing: P ? N : void 0,
400
- mono: g,
401
- class: P ? void 0 : _
402
- }),
403
- style: P ? void 0 : v,
404
- disabled: O || void 0,
405
- "aria-invalid": D || void 0,
406
- ...P ? {
407
- "aria-describedby": [
408
- T?.ariaDescribedby,
409
- M && oe,
410
- x["aria-describedby"]
411
- ].filter(Boolean).join(" ") || void 0,
412
- "aria-busy": p || void 0
413
- } : {},
414
- onInput: (e) => {
415
- ie(), ee?.(e);
416
- },
417
- onChange: (e) => {
418
- re(e.currentTarget.value.length), ue(e.currentTarget.value.length), y?.(e);
419
- }
420
- });
421
- if (!P) return R;
422
- let z = C();
423
- return /* @__PURE__ */ Y("div", {
424
- className: z.base({ class: _ }),
425
- style: v,
426
- children: [
427
- R,
428
- N && /* @__PURE__ */ J("div", {
429
- className: z.trailing(),
430
- children: /* @__PURE__ */ J(i, {
431
- loading: p,
432
- clear: m && F > 0 && !O && !k,
433
- clearLabel: h ?? w.field.clear,
434
- onClear: de,
435
- success: te,
436
- classes: {
437
- spinner: z.spinner(),
438
- clear: z.clear(),
439
- clearIcon: z.clearIcon(),
440
- statusIcon: z.statusIcon()
441
- }
442
- })
443
- }),
444
- M && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J("span", {
445
- id: oe,
446
- className: z.counter(),
447
- "aria-hidden": "true",
448
- children: w.textarea.counter(F, j)
449
- }), /* @__PURE__ */ J("span", {
450
- className: z.status(),
451
- role: "status",
452
- children: se
453
- })] })
454
- ]
455
- });
456
- }
457
- //#endregion
458
- //#region src/components/Pagination/Pagination.tsx
459
- function tt({ classes: t, count: r, pageSize: i = 10, onPageSizeChange: s, page: c, defaultPage: l, onPageChange: u, siblingCount: d = 1, boundaryCount: f, showSummary: p = !0, summary: m, pageSizes: h, jumper: g, variant: _ = "full", withEdges: v, hideSinglePage: ee, getPageHref: y, translations: b, className: x, ...S }) {
460
- let C = n("pagination", M, t)({ responsive: _ === "auto" }), w = e(), [T, E] = K(i), [D, te] = K(i);
461
- D !== i && (te(i), E(i));
462
- let O = (e) => ({
463
- start: Math.min((e - 1) * T + 1, r),
464
- end: Math.min(e * T, r),
465
- count: r
466
- });
467
- if (ee && r <= T) return null;
468
- let k = y ? "a" : "button", A = (e, t, n = !1) => Ce(k, {
469
- className: e,
470
- ...y && n ? {
471
- role: "link",
472
- "aria-disabled": "true"
473
- } : {}
474
- }, t), N = (e, t) => {
475
- if (!t || t === T) return;
476
- let n = j(e.page, T, t);
477
- E(t), s?.(t), requestAnimationFrame(() => e.setPage(n));
478
- }, P = (e, t) => {
479
- if (e.key !== "Enter") return;
480
- let n = e.currentTarget, r = Number.parseInt(n.value, 10);
481
- Number.isNaN(r) || (e.preventDefault(), t.setPage(Math.min(Math.max(r, 1), t.totalPages)), n.value = "");
482
- };
483
- return /* @__PURE__ */ J(Z.Root, {
484
- ...S,
485
- className: C.base({ class: x }),
486
- count: r,
487
- pageSize: T,
488
- page: c,
489
- defaultPage: l,
490
- onPageChange: (e) => u?.(e.page),
491
- siblingCount: d,
492
- boundaryCount: f,
493
- type: y ? "link" : "button",
494
- getPageUrl: y ? (e) => y(e.page) : void 0,
495
- translations: {
496
- ...w.pagination,
497
- ...b
498
- },
499
- children: /* @__PURE__ */ J(Z.Context, { children: (e) => /* @__PURE__ */ Y(q, { children: [
500
- p && /* @__PURE__ */ J("span", {
501
- className: C.summary(),
502
- "aria-live": "polite",
503
- children: (m ?? w.pagination.summary)(O(e.page))
504
- }),
505
- !!h?.length && /* @__PURE__ */ Y("div", {
506
- className: C.pageSize(),
507
- children: [/* @__PURE__ */ J("span", {
508
- "aria-hidden": "true",
509
- children: w.pagination.pageSize
510
- }), /* @__PURE__ */ J(o, {
511
- className: C.pageSizeSelect(),
512
- size: "sm",
513
- items: h.map((e) => ({
514
- value: e,
515
- label: String(e)
516
- })),
517
- value: T,
518
- "aria-label": w.pagination.pageSize,
519
- onValueChange: (t) => N(e, t)
520
- })]
521
- }),
522
- /* @__PURE__ */ Y("div", {
523
- className: C.list(),
524
- children: [
525
- v && /* @__PURE__ */ J(Z.FirstTrigger, {
526
- asChild: !0,
527
- children: A(C.trigger(), /* @__PURE__ */ J(H, {
528
- className: C.triggerIcon(),
529
- "aria-hidden": "true"
530
- }), e.page === 1)
531
- }),
532
- /* @__PURE__ */ J(Z.PrevTrigger, {
533
- asChild: !0,
534
- children: A(C.trigger(), /* @__PURE__ */ J(B, {
535
- className: C.triggerIcon(),
536
- "aria-hidden": "true"
537
- }), e.page === 1)
538
- }),
539
- _ !== "full" && /* @__PURE__ */ J("span", {
540
- className: C.compact(),
541
- children: w.pagination.compact(e.page, e.totalPages)
542
- }),
543
- _ !== "compact" && e.pages.map((e, t) => e.type === "page" ? /* @__PURE__ */ J(Z.Item, {
544
- ...e,
545
- asChild: !0,
546
- children: A(C.item(), e.value)
547
- }, t) : /* @__PURE__ */ J(Z.Ellipsis, {
548
- index: t,
549
- className: C.ellipsis(),
550
- "aria-hidden": "true",
551
- children: "…"
552
- }, t)),
553
- /* @__PURE__ */ J(Z.NextTrigger, {
554
- asChild: !0,
555
- children: A(C.trigger(), /* @__PURE__ */ J(V, {
556
- className: C.triggerIcon(),
557
- "aria-hidden": "true"
558
- }), e.page === e.totalPages)
559
- }),
560
- v && /* @__PURE__ */ J(Z.LastTrigger, {
561
- asChild: !0,
562
- children: A(C.trigger(), /* @__PURE__ */ J(U, {
563
- className: C.triggerIcon(),
564
- "aria-hidden": "true"
565
- }), e.page === e.totalPages)
566
- })
567
- ]
568
- }),
569
- g && /* @__PURE__ */ Y("div", {
570
- className: C.jumper(),
571
- children: [/* @__PURE__ */ J("span", {
572
- "aria-hidden": "true",
573
- children: w.pagination.jumper
574
- }), /* @__PURE__ */ J(a, {
575
- className: C.jumperInput(),
576
- size: "sm",
577
- inputMode: "numeric",
578
- autoComplete: "off",
579
- "aria-label": w.pagination.jumper,
580
- onKeyDown: (t) => P(t, e)
581
- })]
582
- })
583
- ] }) })
584
- });
585
- }
586
- //#endregion
587
- //#region src/components/Skeleton/Skeleton.tsx
588
- function nt({ classes: e, shape: t, width: r, height: i, className: a, style: o, ...s }) {
589
- let c = n("skeleton", ie, e);
590
- return /* @__PURE__ */ J("span", {
591
- "aria-hidden": "true",
592
- ...s,
593
- className: c({
594
- shape: t,
595
- class: a
596
- }),
597
- style: {
598
- width: r,
599
- height: i,
600
- ...o
601
- }
602
- });
603
- }
604
- //#endregion
605
- //#region src/components/DatePicker/dates.ts
606
- var rt = (e, t) => e ? e.toString().slice(0, t ? 16 : 10) : null;
607
- function it(e, t, n) {
608
- return t ? e.includes("T") ? Ve(e.slice(0, 16)) : Ve(`${e}T${n === "max" ? "23:59" : "00:00"}`) : Be(e.slice(0, 10));
609
- }
610
- function at(e, t, n, r) {
611
- let i = typeof e == "string" && !e.includes("T"), a = de(e, t && !i, n);
612
- return a ? it(a, t, r) : void 0;
613
- }
614
- var ot = (e, t, n, r) => b(rt(e, t), {
615
- valueType: n,
616
- timeZone: r,
617
- withTime: t
618
- }), st = (e, t, n) => de(e, t, n);
619
- function ct(e, t) {
620
- if (!e && !t?.length) return;
621
- let n = new Set(t?.map((e) => de(e, !1)));
622
- return (t) => {
623
- let r = rt(t, !1);
624
- return n.has(r) || !!e?.(r);
625
- };
626
- }
627
- function lt(e, t) {
628
- if ("hour" in e) return e;
629
- let n = t && "hour" in t ? new ze(t.hour, t.minute) : new ze();
630
- return He(e, n);
631
- }
632
- var ut = {
633
- year: 2e3,
634
- month: 1,
635
- day: 1
636
- };
637
- function dt(e) {
638
- let [t = 0, n = 0, r = 0] = e.split(":").map(Number);
639
- return new Le(ut.year, ut.month, ut.day, t, n, r);
640
- }
641
- var ft = (e) => String(e).padStart(2, "0"), pt = (e, t = !1) => e && "hour" in e ? `${ft(e.hour)}:${ft(e.minute)}${t ? `:${ft(e.second)}` : ""}` : null, mt = (e, t, n, r = !1) => oe(e, t, n, r);
642
- //#endregion
643
- //#region src/components/DatePicker/DatePickerBase.tsx
644
- function ht({ mode: t, dates: r, onChange: i, withTime: a, min: o, max: s, isDateUnavailable: c, locale: l, disabled: u, readOnly: d, invalid: f, required: p, name: m, label: h, ownId: g, placeholder: _, className: ee, style: y, period: b, classes: x, presets: S, size: C, hideClear: w, firstDayOfWeek: T, timeZone: D, showTimeZone: te, responsive: O, ...k }) {
645
- let A = n("datePicker", v, x)({ size: C }), j = e(), M = Ee(), N = Ne(), F = {
646
- disabled: u ?? N?.disabled,
647
- readOnly: d ?? N?.readOnly,
648
- invalid: f ?? N?.invalid,
649
- required: p ?? N?.required
650
- }, I = t === "range", ie = t === "multiple", L = I ? [0, 1] : [0], ae = [j.dateRange.start, j.dateRange.end], oe = N || g ? {
651
- ...N ? { label: (e) => I ? `${N.ids.label} ${M}r${e}` : N.ids.label } : {},
652
- ...g ? { segmentGroup: (e) => e === 0 ? g : void 0 } : {}
653
- } : void 0, le = (e) => N ? void 0 : I ? [h, ae[e]].filter(Boolean).join(", ") : h, ue = I ? {
654
- ...j.datePicker,
655
- clearTrigger: j.dateRange.clearTrigger
656
- } : j.datePicker, de = b ? new Re(l, b === "month" ? {
657
- month: "2-digit",
658
- year: "numeric"
659
- } : { year: "numeric" }) : void 0, R = T ?? E(l).firstDay, z;
660
- if (te && D) {
661
- let e = r[0], t = e ? fe(e.toString().slice(0, 16), D) : /* @__PURE__ */ new Date();
662
- z = {
663
- short: se(D, l, t),
664
- long: j.calendar.timeZone(ce(D, l, t))
665
- };
666
- }
667
- let me = [N?.ariaDescribedby, z ? `${M}tz` : void 0].filter(Boolean).join(" ") || void 0, he = (e) => L.every((t) => e.getSegments({ index: t }).every((e) => e.type === "literal" || e.isPlaceholder)), B = (e) => !!_ && he(e) && !e.focused, V = (e) => _ && he(e) ? [me, `${M}ph`].filter(Boolean).join(" ") : me, ge = (e) => i(a ? e.map((e, t) => lt(e, r[t])) : e), H = (e, t) => {
668
- if (b) return !1;
669
- if (I) {
670
- let t = ne(e, l, a);
671
- if (t) return i([it(t.start, a), it(t.end, a)]), !0;
672
- }
673
- let n = P(e, l, a);
674
- if (!n) return !1;
675
- let o = [...r];
676
- return o[t] = it(n, a), i(o.filter(Boolean)), !0;
677
- }, U = r.length ? r.length > 3 ? re(j.calendar.datesSelected, r.length, l) : r.map((e) => new Re(l, {
678
- day: "2-digit",
679
- month: "2-digit",
680
- year: "numeric",
681
- timeZone: "UTC"
682
- }).format(e.toDate("UTC"))).join(", ") : _ ?? j.calendar.noDates;
683
- return /* @__PURE__ */ Y($.Root, {
684
- className: A.base({ class: ee }),
685
- style: y,
686
- value: r,
687
- onValueChange: (e) => ge(e.value),
688
- selectionMode: t,
689
- min: o,
690
- max: s,
691
- isDateUnavailable: c,
692
- locale: l,
693
- startOfWeek: R,
694
- minView: b,
695
- defaultView: b,
696
- numOfMonths: k.numberOfMonths,
697
- timeZone: D,
698
- ...F,
699
- positioning: {
700
- placement: "bottom-start",
701
- gutter: 4
702
- },
703
- translations: ue,
704
- lazyMount: !0,
705
- unmountOnExit: !0,
706
- children: [/* @__PURE__ */ Y($.Control, {
707
- className: A.control(),
708
- children: [
709
- ie ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J("span", {
710
- id: `${M}v`,
711
- className: A.multiValue(),
712
- "data-placeholder": r.length ? void 0 : "",
713
- children: U
714
- }), m && r.map((e, t) => /* @__PURE__ */ J("input", {
715
- type: "hidden",
716
- name: `${m}[${t}]`,
717
- value: e.toString()
718
- }, e.toString()))] }) : /* @__PURE__ */ Y(Ie.Root, {
719
- className: A.dateInput(),
720
- ids: oe,
721
- value: r,
722
- onValueChange: (e) => i(e.value),
723
- selectionMode: I ? "range" : "single",
724
- granularity: a ? "minute" : "day",
725
- formatter: de,
726
- min: o,
727
- max: s,
728
- isDateUnavailable: c,
729
- locale: l,
730
- shouldForceLeadingZeros: !0,
731
- name: m,
732
- ...F,
733
- translations: j.dateInput,
734
- children: [/* @__PURE__ */ J(Ie.Context, { children: (e) => /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(Ie.Control, {
735
- className: A.dateControl(),
736
- "data-placeholder-shown": B(e) || void 0,
737
- children: L.map((t) => /* @__PURE__ */ Y(Se, { children: [
738
- t === 1 && /* @__PURE__ */ J("span", {
739
- className: A.rangeSeparator(),
740
- "aria-hidden": "true",
741
- children: "–"
742
- }),
743
- I && N && /* @__PURE__ */ J("span", {
744
- id: `${M}r${t}`,
745
- className: A.rangeLabel(),
746
- children: ae[t]
747
- }),
748
- /* @__PURE__ */ J(gt, {
749
- index: t,
750
- label: le(t),
751
- describedby: V(e),
752
- paste: b ? void 0 : H,
753
- size: C
754
- })
755
- ] }, t))
756
- }), _ && he(e) && /* @__PURE__ */ J("span", {
757
- id: `${M}ph`,
758
- className: A.placeholder(),
759
- "data-hidden": B(e) ? void 0 : "",
760
- onClick: () => e.focus(),
761
- children: _
762
- })] }) }), L.map((e) => /* @__PURE__ */ J(Ie.HiddenInput, { index: e }, e))]
763
- }),
764
- z && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J("span", {
765
- className: A.timeZone(),
766
- "aria-hidden": "true",
767
- children: z.short
768
- }), /* @__PURE__ */ J("span", {
769
- id: `${M}tz`,
770
- hidden: !0,
771
- children: z.long
772
- })] }),
773
- !w && /* @__PURE__ */ J($.ClearTrigger, {
774
- className: A.clear(),
775
- children: /* @__PURE__ */ J(xe, {
776
- className: A.clearIcon(),
777
- "aria-hidden": "true"
778
- })
779
- }),
780
- /* @__PURE__ */ J($.Trigger, {
781
- className: A.trigger(),
782
- ...ie ? { "aria-describedby": `${M}v` } : {},
783
- children: /* @__PURE__ */ J(pe, {
784
- className: A.triggerIcon(),
785
- "aria-hidden": "true"
786
- })
787
- })
788
- ]
789
- }), /* @__PURE__ */ J(vt, {
790
- presets: S,
791
- responsive: O,
792
- timeZone: D,
793
- ...k
794
- })]
795
- });
796
- }
797
- function gt({ index: t, label: r, describedby: i, paste: a, size: o }) {
798
- let s = n("datePicker", v)({ size: o }), c = e();
799
- return /* @__PURE__ */ J(Ie.SegmentGroup, {
800
- index: t,
801
- className: s.segments(),
802
- "aria-label": r,
803
- "aria-describedby": i,
804
- ...a ? { onPasteCapture: (e) => {
805
- a?.(e.clipboardData.getData("text/plain"), t) && (e.preventDefault(), e.stopPropagation());
806
- } } : {},
807
- children: /* @__PURE__ */ J(Ie.Context, { children: (e) => e.getSegments({ index: t }).map((e, t) => /* @__PURE__ */ J(Ie.Segment, {
808
- segment: e,
809
- className: s.segment(),
810
- "aria-label": c.dateSegments[e.type]
811
- }, t)) })
812
- });
813
- }
814
- function _t(e) {
815
- let [t, n] = K(!1);
816
- return Te(() => {
817
- if (!e || typeof window.matchMedia != "function") return;
818
- let t = window.matchMedia("(max-width: 639.98px)"), r = () => n(t.matches);
819
- return r(), t.addEventListener("change", r), () => t.removeEventListener("change", r);
820
- }, [e]), t;
821
- }
822
- function vt({ presets: e, responsive: t, ...r }) {
823
- let i = n("datePicker", v), a = i(), o = _t(t), s = (r.numberOfMonths ?? 1) > 1;
824
- return o ? /* @__PURE__ */ Y(je, { children: [/* @__PURE__ */ J($.Context, { children: (e) => e.open ? /* @__PURE__ */ J("div", {
825
- className: a.backdrop(),
826
- "aria-hidden": "true"
827
- }) : null }), /* @__PURE__ */ J("div", {
828
- className: a.sheet(),
829
- children: /* @__PURE__ */ J($.Content, {
830
- className: i({
831
- multiMonth: s,
832
- bottomSheet: !0
833
- }).content(),
834
- children: /* @__PURE__ */ J(bt, {
835
- presets: e,
836
- ...r
837
- })
838
- })
839
- })] }) : /* @__PURE__ */ J(je, { children: /* @__PURE__ */ J($.Positioner, { children: /* @__PURE__ */ J($.Content, {
840
- className: s ? i({ multiMonth: s }).content() : a.content(),
841
- children: /* @__PURE__ */ J(bt, {
842
- presets: e,
843
- ...r
844
- })
845
- }) }) });
846
- }
847
- var yt = (e, t) => typeof e == "string" ? t.rangePresets[e] ?? e : e.label;
848
- function bt({ presets: t, showWeekNumbers: r, numberOfMonths: i, showButtonBar: a, plainToday: o, hideOutsideDays: s, weekendDays: c, allowDeselect: l, timeZone: u, renderDay: d }) {
849
- let f = n("datePicker", v)(), p = e(), m = Math.max(1, Math.floor(i ?? 1)), h = {
850
- showWeekNumbers: r,
851
- plainToday: o,
852
- hideOutsideDays: s || m > 1,
853
- weekendDays: c,
854
- allowDeselect: l,
855
- renderDay: d
856
- }, g = (e) => Array.from({ length: m }, (t, n) => {
857
- let r = e.getOffset({ months: n }), i = e.visibleRange.start.add({ months: n });
858
- return {
859
- title: r.visibleRangeText.start,
860
- weeks: r.weeks,
861
- visibleRange: {
862
- start: i,
863
- end: i.add({ months: 1 }).subtract({ days: 1 })
864
- }
865
- };
866
- }), _ = (e) => {
867
- if (e.selectionMode === "single") return e.selectToday();
868
- let [t = 0, n = 1, r = 1] = R(u).split("-").map(Number);
869
- e.setFocusedValue(e.focusedValue.set({
870
- year: t,
871
- month: n,
872
- day: r
873
- }));
874
- };
875
- return /* @__PURE__ */ Y(q, { children: [
876
- /* @__PURE__ */ J($.View, {
877
- view: "day",
878
- children: /* @__PURE__ */ J($.Context, { children: (e) => /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(Tt, {}), m > 1 ? /* @__PURE__ */ J("div", {
879
- className: f.months(),
880
- children: g(e).map((e) => /* @__PURE__ */ Y("div", {
881
- className: f.month(),
882
- children: [/* @__PURE__ */ J("div", {
883
- className: f.monthTitle(),
884
- children: e.title
885
- }), /* @__PURE__ */ J(St, {
886
- weeks: e.weeks,
887
- visibleRange: e.visibleRange,
888
- ...h
889
- })]
890
- }, e.title))
891
- }) : /* @__PURE__ */ J(St, {
892
- weeks: e.weeks,
893
- ...h
894
- })] }) })
895
- }),
896
- /* @__PURE__ */ J($.View, {
897
- view: "month",
898
- children: /* @__PURE__ */ J($.Context, { children: (e) => /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(Tt, {}), /* @__PURE__ */ J($.Table, {
899
- className: f.table(),
900
- children: /* @__PURE__ */ J($.TableBody, { children: e.getMonthsGrid({
901
- columns: 4,
902
- format: "short"
903
- }).map((e) => /* @__PURE__ */ J($.TableRow, { children: e.map((e) => /* @__PURE__ */ J($.TableCell, {
904
- value: e.value,
905
- className: f.cell(),
906
- children: /* @__PURE__ */ J($.TableCellTrigger, {
907
- className: f.period(),
908
- children: e.label
909
- })
910
- }, e.value)) }, e[0]?.value)) })
911
- })] }) })
912
- }),
913
- /* @__PURE__ */ J($.View, {
914
- view: "year",
915
- children: /* @__PURE__ */ J($.Context, { children: (e) => /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(Tt, {}), /* @__PURE__ */ J($.Table, {
916
- className: f.table(),
917
- children: /* @__PURE__ */ J($.TableBody, { children: e.getYearsGrid({ columns: 4 }).map((e) => /* @__PURE__ */ J($.TableRow, { children: e.map((e) => /* @__PURE__ */ J($.TableCell, {
918
- value: e.value,
919
- className: f.cell(),
920
- children: /* @__PURE__ */ J($.TableCellTrigger, {
921
- className: f.period(),
922
- children: e.label
923
- })
924
- }, e.value)) }, e[0]?.value)) })
925
- })] }) })
926
- }),
927
- t?.length ? /* @__PURE__ */ J("div", {
928
- className: f.presets(),
929
- children: t.map((e) => /* @__PURE__ */ J($.PresetTrigger, {
930
- value: typeof e == "string" ? e : e.value,
931
- className: f.preset(),
932
- "aria-label": yt(e, p),
933
- children: yt(e, p)
934
- }, yt(e, p)))
935
- }) : null,
936
- a && /* @__PURE__ */ J($.Context, { children: (e) => /* @__PURE__ */ Y("div", {
937
- className: f.buttonBar(),
938
- children: [/* @__PURE__ */ J("button", {
939
- type: "button",
940
- className: f.buttonBarButton(),
941
- onClick: () => _(e),
942
- children: p.calendar.today
943
- }), /* @__PURE__ */ J("button", {
944
- type: "button",
945
- className: f.buttonBarButton(),
946
- disabled: !e.value.length,
947
- onClick: () => e.clearValue({ focus: !1 }),
948
- children: p.calendar.clear
949
- })]
950
- }) })
951
- ] });
952
- }
953
- var xt = (e) => e.toString().slice(0, 10);
954
- function St({ weeks: t, visibleRange: r, showWeekNumbers: i, plainToday: a, hideOutsideDays: o, weekendDays: s, allowDeselect: c, renderDay: l }) {
955
- let u = n("datePicker", v)({
956
- plainToday: a,
957
- hideOutsideDays: o
958
- }), d = e(), f = Fe(), p = (e) => F(e.map(xt)), m = (e) => !!r && (e.month !== r.start.month || e.year !== r.start.year), h = (e) => {
959
- let t = f.getDayTableCellState({
960
- value: e,
961
- visibleRange: r
962
- });
963
- return {
964
- day: e.day,
965
- today: t.today,
966
- selected: t.selected,
967
- outside: t.outsideRange,
968
- unavailable: t.unavailable || !!t.disabled,
969
- weekend: s ? s.includes(w(xt(e))) : t.weekend
970
- };
971
- }, g = (e, t) => {
972
- "key" in e && e.key !== "Enter" && e.key !== " " || f.selectionMode === "single" && f.getDayTableCellState({
973
- value: t,
974
- visibleRange: r
975
- }).selected && (e.preventDefault(), f.clearValue({ focus: !1 }));
976
- }, _ = (e) => ({
977
- ...s?.includes(w(xt(e))) ? { "data-weekend": "" } : {},
978
- ...c ? {
979
- onClickCapture: (t) => g(t, e),
980
- onKeyDownCapture: (t) => g(t, e)
981
- } : {}
982
- });
983
- return /* @__PURE__ */ Y($.Table, {
984
- className: u.table(),
985
- children: [/* @__PURE__ */ J($.TableHead, { children: /* @__PURE__ */ Y($.TableRow, { children: [i && /* @__PURE__ */ J("th", {
986
- scope: "col",
987
- className: u.weekNumberHeader(),
988
- children: /* @__PURE__ */ J("abbr", {
989
- title: d.datePicker.weekColumnHeader,
990
- children: d.datePicker.weekColumnShort
991
- })
992
- }), f.weekDays.map((e) => /* @__PURE__ */ J($.TableHeader, {
993
- className: u.columnHeader(),
994
- children: /* @__PURE__ */ J("abbr", {
995
- title: e.long,
996
- children: e.short
997
- })
998
- }, e.long))] }) }), /* @__PURE__ */ J($.TableBody, { children: t.map((e) => /* @__PURE__ */ Y($.TableRow, { children: [i && /* @__PURE__ */ J("th", {
999
- scope: "row",
1000
- className: u.weekNumber(),
1001
- "aria-label": d.datePicker.weekNumberCell(p(e)),
1002
- children: p(e)
1003
- }), e.map((e) => m(e) ? /* @__PURE__ */ J("td", { className: u.cell() }, e.toString()) : /* @__PURE__ */ J($.TableCell, {
1004
- value: e,
1005
- visibleRange: r,
1006
- className: u.cell(),
1007
- ..._(e),
1008
- children: /* @__PURE__ */ J($.TableCellTrigger, {
1009
- className: u.day(),
1010
- children: l ? /* @__PURE__ */ J("span", {
1011
- className: u.dayContent(),
1012
- children: l(xt(e), h(e))
1013
- }) : e.day
1014
- })
1015
- }, e.toString()))] }, e[0]?.toString())) })]
1016
- });
1017
- }
1018
- var Ct = {
1019
- day: "month",
1020
- month: "year",
1021
- year: void 0
1022
- }, wt = (e, t, n) => `${e}, ${n.datePicker.viewTrigger(t, Ct[t])}`;
1023
- function Tt() {
1024
- let t = n("datePicker", v)(), r = e();
1025
- return /* @__PURE__ */ Y($.ViewControl, {
1026
- className: t.header(),
1027
- children: [
1028
- /* @__PURE__ */ J($.PrevTrigger, {
1029
- className: t.nav(),
1030
- children: /* @__PURE__ */ J(B, {
1031
- className: t.navIcon(),
1032
- "aria-hidden": "true"
1033
- })
1034
- }),
1035
- /* @__PURE__ */ J($.Context, { children: (e) => /* @__PURE__ */ J($.ViewTrigger, {
1036
- className: t.viewTrigger(),
1037
- "aria-label": wt(e.numOfMonths > 1 && e.view === "day" ? e.visibleRangeText.formatted : e.visibleRangeText.start, e.view, r),
1038
- children: /* @__PURE__ */ J($.RangeText, {})
1039
- }) }),
1040
- /* @__PURE__ */ J($.NextTrigger, {
1041
- className: t.nav(),
1042
- children: /* @__PURE__ */ J(V, {
1043
- className: t.navIcon(),
1044
- "aria-hidden": "true"
1045
- })
1046
- })
1047
- ]
1048
- });
1049
- }
1050
- //#endregion
1051
- //#region src/components/DatePicker/DatePicker.tsx
1052
- function Et({ value: e, defaultValue: n, onValueChange: r, selectionMode: i = "single", valueType: a = "string", withTime: o = !1, min: c, max: l, isDateUnavailable: u, excludeDates: d, locale: f, "aria-label": p, id: m, clearable: h = !0, highlightToday: g = !0, ..._ }) {
1053
- s("DatePicker", m);
1054
- let v = t(), ee = f ?? v.locale, [y, b] = K(n ?? null), x = e === void 0 ? y : e, S = Array.isArray(x) ? x : x ? [x] : [], C = _.timeZone, w = (e) => e.map((e) => st(e, o, C)).join(), T = (e) => {
1055
- let t = e.map((e) => ot(e, o, a, C));
1056
- if (w(t) === w(S)) return;
1057
- let n = i === "multiple" ? t : t[0] ?? null;
1058
- b(n), r?.(n);
1059
- };
1060
- return /* @__PURE__ */ J(ht, {
1061
- ..._,
1062
- mode: i,
1063
- dates: S.map((e) => at(e, o, C)).filter((e) => !!e),
1064
- onChange: T,
1065
- withTime: o,
1066
- min: at(c, o, C, "min"),
1067
- max: at(l, o, C, "max"),
1068
- isDateUnavailable: ct(u, d),
1069
- locale: ee,
1070
- label: p,
1071
- ownId: m,
1072
- hideClear: !h,
1073
- plainToday: !g
1074
- });
1075
- }
1076
- //#endregion
1077
- //#region src/components/MultiSelect/MultiSelect.tsx
1078
- function Dt({ classes: t, items: r, value: i, defaultValue: a, onValueChange: o, placeholder: s, summary: f, maxShown: m = 2, disabled: h, invalid: _, required: v, name: ee, itemValue: y, itemLabel: b, itemDisabled: x, itemGroup: C, itemKeywords: w, valueKey: T, display: E = "text", checkboxes: D = !0, selectAll: te, max: k, clearable: A, loading: j, loadingText: M, size: N, filter: P, manualFilter: ne, onFilterChange: re, emptyText: F, hasMore: I, onLoadMore: ie, dataSource: L, minSearchLength: ae, pageSize: oe, renderItem: se, renderValue: ce, id: le, className: ue, style: de, onKeyDown: R, ...fe }) {
1079
- let pe = n("multiSelect", O, t), B = E === "chips", V = pe({
1080
- size: N,
1081
- clearable: A && !B
1082
- }), ge = Ne(), H = e(), U = H.select, _e = {
1083
- itemValue: y,
1084
- itemLabel: b,
1085
- itemDisabled: x,
1086
- itemGroup: C,
1087
- itemKeywords: w,
1088
- valueKey: T
1089
- }, [be, Se] = K(""), W = l({
1090
- items: r,
1091
- source: L,
1092
- accessors: _e,
1093
- pageSize: oe,
1094
- minSearchLength: ae
1095
- }), { options: Ce, visible: we, groups: De, ordered: Oe, firstFor: G } = c(W.items, _e, P && !ne && !L ? be : ""), Ae = ke(() => [...Ce, ...W.resolvedOptions], [Ce, W.resolvedOptions]), { selected: X, keys: Me, commit: Z } = d({
1096
- multiple: !0,
1097
- value: i,
1098
- defaultValue: a,
1099
- accessors: _e,
1100
- items: Ae,
1101
- onChange: o,
1102
- check: {
1103
- component: "MultiSelect",
1104
- ready: !L && !j && r.length > 0
1105
- }
1106
- }), $ = Me.join("\0");
1107
- Te(() => {
1108
- W.resolve(Me, Ae);
1109
- }, [$, L]);
1110
- let Fe = j || W.loading, Ie = k !== void 0 && X.length >= k, Le = Me.join("\n"), Re = ke(() => {
1111
- let e = new Set(Le.split("\n"));
1112
- return Pe({
1113
- items: Oe,
1114
- itemToString: (e) => e.label,
1115
- itemToValue: (e) => e.key,
1116
- isItemDisabled: (t) => t.disabled || Ie && !e.has(t.key)
1117
- });
1118
- }, [
1119
- Oe,
1120
- Ie,
1121
- Le
1122
- ]), ze = P || te, Be = Ee(), Ve = we.filter((e) => !e.disabled), He = p(X, Ve), [Ue, We] = K("");
1123
- function Ge(e) {
1124
- let t = k !== void 0 && e.length >= k && X.length < k;
1125
- Z(e), t && We(U.maxReached(k));
1126
- }
1127
- function Ke(e) {
1128
- Z(X.filter((t) => t.key !== e.key)), We(U.removed(e.label));
1129
- }
1130
- function qe(e) {
1131
- R?.(e);
1132
- let t = X.at(-1);
1133
- t && (B && e.key === "Backspace" ? (e.preventDefault(), Ke(t)) : A && (e.key === "Delete" || e.key === "Backspace") && (e.preventDefault(), Z([])));
1134
- }
1135
- function Je(e, t) {
1136
- Se(t), re?.(t), L && W.search(t);
1137
- let n = ne || L ? void 0 : G(t);
1138
- n && requestAnimationFrame(() => e.setHighlightValue(n.key));
1139
- }
1140
- let Ye = {
1141
- item: V.item(),
1142
- itemText: V.itemText(),
1143
- icon: V.icon(),
1144
- itemIndicator: V.itemIndicator(),
1145
- itemBody: V.itemBody(),
1146
- itemDescription: V.itemDescription(),
1147
- group: V.group(),
1148
- groupLabel: V.groupLabel(),
1149
- loading: V.loading(),
1150
- loadingIcon: V.loadingIcon(),
1151
- sentinel: V.sentinel(),
1152
- empty: V.empty(),
1153
- check: V.check(),
1154
- checkIcon: V.checkIcon()
1155
- }, Xe = /* @__PURE__ */ J(u, {
1156
- parts: Q,
1157
- groups: De,
1158
- classes: Ye,
1159
- checkbox: D,
1160
- loading: Fe,
1161
- loadingText: M ?? H.common.loading,
1162
- hasMore: I || W.hasMore,
1163
- onLoadMore: () => L ? W.loadMore() : ie?.(),
1164
- emptyText: F ?? W.emptyText ?? (be ? H.common.noResults : H.common.empty),
1165
- renderItem: se
1166
- }), Ze = X.length ? X.length > m ? (f ?? H.common.selectedCount)(X.length) : X.map((e) => e.label).join(", ") : s ?? H.common.placeholder;
1167
- return /* @__PURE__ */ Y(Q.Root, {
1168
- className: V.base({ class: ue }),
1169
- style: de,
1170
- collection: Re,
1171
- multiple: !0,
1172
- closeOnSelect: !1,
1173
- value: Me,
1174
- onValueChange: (e) => {
1175
- let t = S(Ae, e.items, X);
1176
- Ge(e.value.map((e) => t.get(e)).filter((e) => e !== void 0));
1177
- },
1178
- onOpenChange: (e) => {
1179
- e.open && W.open(), !e.open && be && (Se(""), re?.(""), L && W.search(""));
1180
- },
1181
- disabled: h,
1182
- invalid: _,
1183
- required: v,
1184
- name: ee,
1185
- positioning: {
1186
- sameWidth: !0,
1187
- gutter: 4
1188
- },
1189
- composite: !ze,
1190
- ...g(le, "trigger", {
1191
- label: ge?.ids.label,
1192
- hiddenSelect: ge?.ids.control
1193
- }),
1194
- lazyMount: !0,
1195
- unmountOnExit: !0,
1196
- children: [
1197
- /* @__PURE__ */ J(Q.Context, { children: (e) => /* @__PURE__ */ Y(Q.Control, {
1198
- ...B || A ? { className: B ? V.chipsControl() : V.control() } : {},
1199
- children: [
1200
- B && X.map((t) => /* @__PURE__ */ Y("span", {
1201
- className: V.chip(),
1202
- children: [/* @__PURE__ */ J("span", {
1203
- className: V.chipText(),
1204
- children: t.label
1205
- }), !e.disabled && /* @__PURE__ */ J("button", {
1206
- type: "button",
1207
- tabIndex: -1,
1208
- className: V.chipRemove(),
1209
- "aria-label": U.removeItem(t.label),
1210
- onClick: () => Ke(t),
1211
- children: /* @__PURE__ */ J(xe, {
1212
- className: V.chipRemoveIcon(),
1213
- "aria-hidden": "true"
1214
- })
1215
- })]
1216
- }, t.key)),
1217
- /* @__PURE__ */ Y(Q.Trigger, {
1218
- ...fe,
1219
- className: B ? V.chipsTrigger() : V.trigger(),
1220
- "aria-busy": j || void 0,
1221
- onKeyDown: qe,
1222
- children: [/* @__PURE__ */ J("span", {
1223
- className: V.value(),
1224
- "data-placeholder-shown": !X.length || void 0,
1225
- children: B ? X.length ? /* @__PURE__ */ J("span", {
1226
- className: V.hiddenValue(),
1227
- children: X.map((e) => e.label).join(", ")
1228
- }) : s ?? H.common.placeholder : ce && X.length ? ce(X.map((e) => e.item)) : Ze
1229
- }), /* @__PURE__ */ J(Q.Indicator, {
1230
- className: V.indicator(),
1231
- children: j ? /* @__PURE__ */ J(ve, {
1232
- className: V.spinner(),
1233
- "aria-hidden": "true"
1234
- }) : /* @__PURE__ */ J(he, {
1235
- className: V.indicatorIcon(),
1236
- "aria-hidden": "true"
1237
- })
1238
- })]
1239
- }),
1240
- A && X.length > 0 && !e.disabled && /* @__PURE__ */ J("button", {
1241
- type: "button",
1242
- tabIndex: -1,
1243
- className: B ? V.chipsClear() : V.clear(),
1244
- "aria-label": U.clear,
1245
- onClick: () => {
1246
- Z([]), e.focus();
1247
- },
1248
- children: /* @__PURE__ */ J(xe, {
1249
- className: V.clearIcon(),
1250
- "aria-hidden": "true"
1251
- })
1252
- })
1253
- ]
1254
- }) }),
1255
- (B || k !== void 0 || L) && /* @__PURE__ */ J("span", {
1256
- role: "status",
1257
- className: V.status(),
1258
- children: Ue || W.announcement
1259
- }),
1260
- /* @__PURE__ */ J(je, { children: /* @__PURE__ */ J(Q.Positioner, { children: /* @__PURE__ */ J(Q.Content, {
1261
- className: V.content(),
1262
- "aria-busy": Fe || void 0,
1263
- "aria-label": ze ? fe["aria-label"] : void 0,
1264
- children: ze ? /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y("div", {
1265
- className: V.header(),
1266
- children: [P && /* @__PURE__ */ J(Q.Context, { children: (e) => /* @__PURE__ */ J("input", {
1267
- type: "text",
1268
- role: "combobox",
1269
- autoComplete: "off",
1270
- "aria-autocomplete": "list",
1271
- "aria-expanded": "true",
1272
- "data-autofocus": "",
1273
- "aria-controls": Be,
1274
- "aria-activedescendant": e.highlightedItem ? e.getItemProps({ item: e.highlightedItem }).id : void 0,
1275
- "aria-label": U.filter,
1276
- placeholder: H.combobox.search,
1277
- value: be,
1278
- className: V.search(),
1279
- onChange: (t) => Je(e, t.target.value),
1280
- onKeyDown: (e) => {
1281
- [
1282
- " ",
1283
- "Home",
1284
- "End"
1285
- ].includes(e.key) && e.stopPropagation();
1286
- }
1287
- }) }), te && Ve.length > 0 && /* @__PURE__ */ Y("button", {
1288
- type: "button",
1289
- role: "checkbox",
1290
- "aria-checked": He,
1291
- className: V.selectAll(),
1292
- onClick: () => Ge(z(X, we, k)),
1293
- onKeyDown: (e) => {
1294
- (e.key === " " || e.key === "Enter") && e.stopPropagation();
1295
- },
1296
- children: [/* @__PURE__ */ J("span", {
1297
- className: V.check(),
1298
- "data-state": He === "mixed" ? "indeterminate" : He ? "checked" : "unchecked",
1299
- "aria-hidden": "true",
1300
- children: He === "mixed" ? /* @__PURE__ */ J(ye, { className: V.checkIcon() }) : He && /* @__PURE__ */ J(me, { className: V.checkIcon() })
1301
- }), U.selectAll]
1302
- })]
1303
- }), /* @__PURE__ */ J(Q.List, {
1304
- id: Be,
1305
- className: V.list(),
1306
- "data-autofocus": P ? void 0 : "",
1307
- children: Xe
1308
- })] }) : Xe
1309
- }) }) }),
1310
- /* @__PURE__ */ J(Q.HiddenSelect, {})
1311
- ]
1312
- });
1313
- }
1314
- //#endregion
1315
- //#region src/components/NumberInput/NumberInput.tsx
1316
- function Ot({ classes: a, value: o, defaultValue: s, onValueChange: c, min: l, max: u, step: d, formatOptions: f = ee, locale: p, size: m, invalid: h, success: _, disabled: v, readOnly: y, required: b, name: x, stepper: S = !0, stepperLayout: w = "inline", prefix: T, suffix: E, allowNegative: D = !0, allowDecimal: te = !0, decimals: O, clampBehavior: j = "blur", selectOnFocus: M = !1, loading: P = !1, clearable: ne = !1, clearLabel: re, id: F, className: ie, style: L, onKeyDown: ae, onPaste: oe, onFocus: se, ...ce }) {
1317
- let ue = n("numberInput", k, a), de = t(), R = p ?? de.locale, z = e(), fe = Ne(), pe = r(), me = !(h || fe?.invalid) && (!!_ || pe.success), B = ue({
1318
- size: m,
1319
- stacked: w === "stacked",
1320
- success: me
1321
- }), V = O === void 0 ? te ? f : {
1322
- ...f,
1323
- maximumFractionDigits: 0
1324
- } : {
1325
- ...f,
1326
- minimumFractionDigits: O,
1327
- maximumFractionDigits: O
1328
- }, H = D ? l : Math.max(l ?? 0, 0), [U, _e] = K(null), ve = o === void 0 ? void 0 : U && U.number === o ? U.text : le(o, R, V), xe = ve ?? U?.text ?? le(s, R, V) ?? "", Se = Ee(), W = Ee(), Ce = T || E ? [
1329
- fe?.ariaDescribedby,
1330
- T && Se,
1331
- E && W,
1332
- ce["aria-describedby"]
1333
- ].filter(Boolean).join(" ") : void 0, we = G(null), Te = () => {
1334
- let e = we.current?.querySelector("input");
1335
- e && (I(e), e.focus());
1336
- }, De = !!v || !!y || !!fe?.disabled || !!fe?.readOnly;
1337
- return /* @__PURE__ */ J(Ue.Root, {
1338
- className: B.base({ class: ie }),
1339
- style: L,
1340
- value: ve,
1341
- defaultValue: le(s, R, V),
1342
- ...g(F, "input", {
1343
- label: fe?.ids.label,
1344
- input: fe?.ids.control
1345
- }),
1346
- onValueChange: (e) => {
1347
- let t = Number.isNaN(e.valueAsNumber) ? null : e.valueAsNumber;
1348
- _e({
1349
- text: e.value,
1350
- number: t
1351
- }), c?.(t);
1352
- },
1353
- min: H,
1354
- max: u,
1355
- step: d,
1356
- formatOptions: V,
1357
- locale: R,
1358
- invalid: h,
1359
- disabled: v,
1360
- readOnly: y,
1361
- required: b,
1362
- name: x,
1363
- clampValueOnBlur: j !== "none",
1364
- allowOverflow: j !== "strict",
1365
- translations: z.numberInput,
1366
- children: /* @__PURE__ */ Y(Ue.Control, {
1367
- ref: we,
1368
- className: B.control(),
1369
- children: [
1370
- T && /* @__PURE__ */ J("span", {
1371
- id: Se,
1372
- className: B.prefix(),
1373
- children: T
1374
- }),
1375
- /* @__PURE__ */ J(Ue.Input, {
1376
- ...ce,
1377
- ...Ce ? { "aria-describedby": Ce } : {},
1378
- className: B.input(),
1379
- "aria-busy": P || void 0,
1380
- onKeyDown: (e) => {
1381
- if (ae?.(e), e.defaultPrevented || e.ctrlKey || e.metaKey || e.altKey) return;
1382
- let t = e.currentTarget, n = t.selectionStart ?? t.value.length, r = t.value.slice(0, n) + t.value.slice(t.selectionEnd ?? n), i = A(e.key, r, R, {
1383
- allowDecimal: te && O !== 0,
1384
- allowNegative: D
1385
- });
1386
- i && (e.preventDefault(), i !== "block" && C(t, i.insert));
1387
- },
1388
- onPaste: (e) => {
1389
- oe?.(e);
1390
- let t = e.currentTarget, n = (t.selectionStart ?? 0) === 0 && (t.selectionEnd ?? 0) === t.value.length, r = N(e.clipboardData.getData("text"), R);
1391
- !e.defaultPrevented && n && r !== null && (e.preventDefault(), I(t, le(r, R, V)));
1392
- },
1393
- onFocus: (e) => {
1394
- se?.(e);
1395
- let t = e.currentTarget;
1396
- M && requestAnimationFrame(() => t.select());
1397
- }
1398
- }),
1399
- (P || ne || me) && /* @__PURE__ */ J(i, {
1400
- loading: P,
1401
- clear: ne && !!xe && !De,
1402
- clearLabel: re ?? z.field.clear,
1403
- onClear: Te,
1404
- success: me,
1405
- classes: {
1406
- spinner: B.spinner(),
1407
- clear: B.clear(),
1408
- clearIcon: B.clearIcon(),
1409
- statusIcon: B.statusIcon()
1410
- }
1411
- }),
1412
- E && /* @__PURE__ */ J("span", {
1413
- id: W,
1414
- className: B.suffix(),
1415
- children: E
1416
- }),
1417
- S && w === "stacked" ? /* @__PURE__ */ Y("div", {
1418
- className: B.stepper(),
1419
- children: [/* @__PURE__ */ J(Ue.IncrementTrigger, {
1420
- className: B.button(),
1421
- children: /* @__PURE__ */ J(ge, {
1422
- className: B.buttonIcon(),
1423
- "aria-hidden": "true"
1424
- })
1425
- }), /* @__PURE__ */ J(Ue.DecrementTrigger, {
1426
- className: B.button(),
1427
- children: /* @__PURE__ */ J(he, {
1428
- className: B.buttonIcon(),
1429
- "aria-hidden": "true"
1430
- })
1431
- })]
1432
- }) : S && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J(Ue.DecrementTrigger, {
1433
- className: B.button(),
1434
- children: /* @__PURE__ */ J(ye, {
1435
- className: B.buttonIcon(),
1436
- "aria-hidden": "true"
1437
- })
1438
- }), /* @__PURE__ */ J(Ue.IncrementTrigger, {
1439
- className: B.button(),
1440
- children: /* @__PURE__ */ J(be, {
1441
- className: B.buttonIcon(),
1442
- "aria-hidden": "true"
1443
- })
1444
- })] })
1445
- ]
1446
- })
1447
- });
1448
- }
1449
- //#endregion
1450
- //#region src/components/ContextMenu/ContextMenu.tsx
1451
- function kt({ classes: e, items: t, label: r, onSelect: i, onCheckedChange: a, onValueChange: o, linkAs: s, renderItem: c, open: l, onOpenChange: u, onBeforeOpen: d, closeOnScroll: f, closeOnResize: p, closeOnBlur: m, highlightFirst: h, ref: g, children: v }) {
1452
- let ee = n("menu", D, e)(), y = Ke({
1453
- open: l,
1454
- anchor: void 0,
1455
- onOpenChange: u,
1456
- ref: g,
1457
- restoreFocus: !0
1458
- }), b = G(null), x = Xe(y.isOpen, y.handle.close, b, {
1459
- closeOnScroll: f,
1460
- closeOnResize: p,
1461
- closeOnBlur: m,
1462
- highlightFirst: h
1463
- }), S = G(null);
1464
- return Te(() => {
1465
- let e = S;
1466
- return () => e.current?.cancel();
1467
- }, []), /* @__PURE__ */ J(Ye, {
1468
- items: t,
1469
- linkAs: s,
1470
- renderItem: c,
1471
- onCheckedChange: a,
1472
- onValueChange: o,
1473
- children: /* @__PURE__ */ Y(X.Root, {
1474
- open: y.isOpen,
1475
- onOpenChange: (e) => y.onOpenChange(e.open),
1476
- positioning: y.positioning({}),
1477
- anchorPoint: y.anchorPoint,
1478
- ...x,
1479
- lazyMount: !0,
1480
- unmountOnExit: !0,
1481
- onSelect: (e) => i?.(e.value),
1482
- children: [/* @__PURE__ */ J(X.ContextTrigger, {
1483
- asChild: !0,
1484
- onPointerDown: (e) => {
1485
- let t = e.target;
1486
- S.current?.cancel(), S.current = _((e) => {
1487
- d?.(t), y.handle.open(e);
1488
- }), S.current.down(e);
1489
- },
1490
- onContextMenu: (e) => d?.(e.target),
1491
- onPointerMove: (e) => S.current?.move(e),
1492
- onPointerUp: () => S.current?.cancel(),
1493
- onPointerCancel: () => S.current?.cancel(),
1494
- children: v
1495
- }), /* @__PURE__ */ J(je, { children: /* @__PURE__ */ J(X.Positioner, { children: /* @__PURE__ */ J(X.Content, {
1496
- ref: b,
1497
- className: ee.content(),
1498
- ...r ? {
1499
- "aria-label": r,
1500
- "aria-labelledby": void 0
1501
- } : {},
1502
- children: /* @__PURE__ */ J($e, {
1503
- entries: t,
1504
- onSelect: i
1505
- })
1506
- }) }) })]
1507
- })
1508
- });
1509
- }
1510
- //#endregion
1511
- export { Ke as S, tt as _, bt as a, $e as b, at as c, mt as d, ot as f, nt as g, st as h, Et as i, it as l, ct as m, Ot as n, ht as o, pt as p, Dt as r, gt as s, kt as t, dt as u, et as v, Ye as x, Ze as y };