@mortenbrudvik/waveui 0.8.0 → 0.10.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.
- package/README.md +634 -167
- package/dist/components/data-display/InfoButton.cjs +2 -0
- package/dist/components/data-display/InfoButton.cjs.map +1 -0
- package/dist/components/data-display/InfoButton.mjs +173 -0
- package/dist/components/data-display/InfoButton.mjs.map +1 -0
- package/dist/components/data-display/InfoLabel.cjs +1 -1
- package/dist/components/data-display/InfoLabel.cjs.map +1 -1
- package/dist/components/data-display/InfoLabel.mjs +39 -96
- package/dist/components/data-display/InfoLabel.mjs.map +1 -1
- package/dist/components/input/Calendar.cjs +2 -0
- package/dist/components/input/Calendar.cjs.map +1 -0
- package/dist/components/input/Calendar.mjs +352 -0
- package/dist/components/input/Calendar.mjs.map +1 -0
- package/dist/components/input/Calendar.views.cjs +2 -0
- package/dist/components/input/Calendar.views.cjs.map +1 -0
- package/dist/components/input/Calendar.views.mjs +194 -0
- package/dist/components/input/Calendar.views.mjs.map +1 -0
- package/dist/components/input/Checkbox.cjs +1 -1
- package/dist/components/input/Checkbox.cjs.map +1 -1
- package/dist/components/input/Checkbox.mjs +91 -75
- package/dist/components/input/Checkbox.mjs.map +1 -1
- package/dist/components/input/ColorArea.cjs +1 -1
- package/dist/components/input/ColorArea.cjs.map +1 -1
- package/dist/components/input/ColorArea.mjs +18 -18
- package/dist/components/input/ColorArea.mjs.map +1 -1
- package/dist/components/input/ColorPicker.parts.cjs +1 -1
- package/dist/components/input/ColorPicker.parts.cjs.map +1 -1
- package/dist/components/input/ColorPicker.parts.mjs +1 -1
- package/dist/components/input/ColorPicker.parts.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.cjs +1 -1
- package/dist/components/input/Combobox.expand.cjs.map +1 -1
- package/dist/components/input/Combobox.expand.mjs +20 -20
- package/dist/components/input/Combobox.expand.mjs.map +1 -1
- package/dist/components/input/Combobox.mjs +219 -138
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/Combobox.text.cjs +2 -0
- package/dist/components/input/Combobox.text.cjs.map +1 -0
- package/dist/components/input/Combobox.text.mjs +24 -0
- package/dist/components/input/Combobox.text.mjs.map +1 -0
- package/dist/components/input/DatePicker.cjs +1 -1
- package/dist/components/input/DatePicker.cjs.map +1 -1
- package/dist/components/input/DatePicker.mjs +205 -286
- package/dist/components/input/DatePicker.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +137 -105
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Field.cjs +1 -1
- package/dist/components/input/Field.cjs.map +1 -1
- package/dist/components/input/Field.mjs +99 -66
- package/dist/components/input/Field.mjs.map +1 -1
- package/dist/components/input/Input.cjs +1 -1
- package/dist/components/input/Input.cjs.map +1 -1
- package/dist/components/input/Input.mjs +79 -55
- package/dist/components/input/Input.mjs.map +1 -1
- package/dist/components/input/Label.cjs +1 -1
- package/dist/components/input/Label.cjs.map +1 -1
- package/dist/components/input/Label.mjs +19 -13
- package/dist/components/input/Label.mjs.map +1 -1
- package/dist/components/input/Listbox.cjs +2 -0
- package/dist/components/input/Listbox.cjs.map +1 -0
- package/dist/components/input/Listbox.mjs +134 -0
- package/dist/components/input/Listbox.mjs.map +1 -0
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +158 -97
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/Rating.cjs +1 -1
- package/dist/components/input/Rating.cjs.map +1 -1
- package/dist/components/input/Rating.item.cjs +2 -0
- package/dist/components/input/Rating.item.cjs.map +1 -0
- package/dist/components/input/Rating.item.mjs +255 -0
- package/dist/components/input/Rating.item.mjs.map +1 -0
- package/dist/components/input/Rating.mjs +150 -151
- package/dist/components/input/Rating.mjs.map +1 -1
- package/dist/components/input/SearchBox.cjs +1 -1
- package/dist/components/input/SearchBox.cjs.map +1 -1
- package/dist/components/input/SearchBox.mjs +146 -115
- package/dist/components/input/SearchBox.mjs.map +1 -1
- package/dist/components/input/Select.cjs +1 -1
- package/dist/components/input/Select.cjs.map +1 -1
- package/dist/components/input/Select.mjs +34 -25
- package/dist/components/input/Select.mjs.map +1 -1
- package/dist/components/input/Slider.cjs +1 -1
- package/dist/components/input/Slider.cjs.map +1 -1
- package/dist/components/input/Slider.mjs +77 -54
- package/dist/components/input/Slider.mjs.map +1 -1
- package/dist/components/input/SpinButton.cjs +1 -1
- package/dist/components/input/SpinButton.cjs.map +1 -1
- package/dist/components/input/SpinButton.mjs +198 -96
- package/dist/components/input/SpinButton.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.cjs +1 -1
- package/dist/components/input/SwatchPicker.cjs.map +1 -1
- package/dist/components/input/SwatchPicker.context.cjs +2 -0
- package/dist/components/input/SwatchPicker.context.cjs.map +1 -0
- package/dist/components/input/SwatchPicker.context.mjs +35 -0
- package/dist/components/input/SwatchPicker.context.mjs.map +1 -0
- package/dist/components/input/SwatchPicker.mjs +131 -103
- package/dist/components/input/SwatchPicker.mjs.map +1 -1
- package/dist/components/input/SwatchPicker.swatches.cjs +2 -0
- package/dist/components/input/SwatchPicker.swatches.cjs.map +1 -0
- package/dist/components/input/SwatchPicker.swatches.mjs +207 -0
- package/dist/components/input/SwatchPicker.swatches.mjs.map +1 -0
- package/dist/components/input/Switch.cjs +1 -1
- package/dist/components/input/Switch.cjs.map +1 -1
- package/dist/components/input/Switch.mjs +71 -55
- package/dist/components/input/Switch.mjs.map +1 -1
- package/dist/components/input/TagPicker.cjs +1 -1
- package/dist/components/input/TagPicker.cjs.map +1 -1
- package/dist/components/input/TagPicker.mjs +154 -123
- package/dist/components/input/TagPicker.mjs.map +1 -1
- package/dist/components/input/Textarea.cjs +1 -1
- package/dist/components/input/Textarea.cjs.map +1 -1
- package/dist/components/input/Textarea.mjs +28 -21
- package/dist/components/input/Textarea.mjs.map +1 -1
- package/dist/components/input/TimePicker.cjs +1 -1
- package/dist/components/input/TimePicker.cjs.map +1 -1
- package/dist/components/input/TimePicker.mjs +204 -199
- package/dist/components/input/TimePicker.mjs.map +1 -1
- package/dist/components/input/dateUtils.cjs +1 -1
- package/dist/components/input/dateUtils.cjs.map +1 -1
- package/dist/components/input/dateUtils.mjs +114 -96
- package/dist/components/input/dateUtils.mjs.map +1 -1
- package/dist/components/input/fieldLabel.cjs +2 -0
- package/dist/components/input/fieldLabel.cjs.map +1 -0
- package/dist/components/input/fieldLabel.mjs +17 -0
- package/dist/components/input/fieldLabel.mjs.map +1 -0
- package/dist/components/input/inputLook.cjs +2 -0
- package/dist/components/input/inputLook.cjs.map +1 -0
- package/dist/components/input/inputLook.mjs +28 -0
- package/dist/components/input/inputLook.mjs.map +1 -0
- package/dist/components/input/pickerLabels.cjs +2 -0
- package/dist/components/input/pickerLabels.cjs.map +1 -0
- package/dist/components/input/pickerLabels.mjs +16 -0
- package/dist/components/input/pickerLabels.mjs.map +1 -0
- package/dist/components/input/pickerStyles.cjs +1 -1
- package/dist/components/input/pickerStyles.cjs.map +1 -1
- package/dist/components/input/pickerStyles.mjs +42 -4
- package/dist/components/input/pickerStyles.mjs.map +1 -1
- package/dist/components/input/pickerValues.cjs +2 -0
- package/dist/components/input/pickerValues.cjs.map +1 -0
- package/dist/components/input/pickerValues.mjs +24 -0
- package/dist/components/input/pickerValues.mjs.map +1 -0
- package/dist/components/navigation/Menu.popover.cjs +1 -1
- package/dist/components/navigation/Menu.popover.cjs.map +1 -1
- package/dist/components/navigation/Menu.popover.mjs +10 -10
- package/dist/components/navigation/Menu.root.cjs +1 -1
- package/dist/components/navigation/Menu.root.cjs.map +1 -1
- package/dist/components/navigation/Menu.root.mjs +10 -10
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +203 -208
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/Popover.shared.cjs +1 -1
- package/dist/components/overlays/Popover.shared.cjs.map +1 -1
- package/dist/components/overlays/Popover.shared.mjs +82 -77
- package/dist/components/overlays/Popover.shared.mjs.map +1 -1
- package/dist/components/provider/WaveProvider.cjs +1 -1
- package/dist/components/provider/WaveProvider.cjs.map +1 -1
- package/dist/components/provider/WaveProvider.mjs +25 -19
- package/dist/components/provider/WaveProvider.mjs.map +1 -1
- package/dist/components/table/useGridNavigation.cjs +1 -1
- package/dist/components/table/useGridNavigation.cjs.map +1 -1
- package/dist/components/table/useGridNavigation.mjs +67 -70
- package/dist/components/table/useGridNavigation.mjs.map +1 -1
- package/dist/hooks/useActiveDescendant.cjs +2 -0
- package/dist/hooks/useActiveDescendant.cjs.map +1 -0
- package/dist/hooks/useActiveDescendant.mjs +56 -0
- package/dist/hooks/useActiveDescendant.mjs.map +1 -0
- package/dist/hooks/useFieldControl.cjs.map +1 -1
- package/dist/hooks/useFieldControl.mjs.map +1 -1
- package/dist/hooks/useListbox.cjs +1 -1
- package/dist/hooks/useListbox.cjs.map +1 -1
- package/dist/hooks/useListbox.mjs +250 -210
- package/dist/hooks/useListbox.mjs.map +1 -1
- package/dist/hooks/useRovingGrid.cjs +2 -0
- package/dist/hooks/useRovingGrid.cjs.map +1 -0
- package/dist/hooks/useRovingGrid.mjs +69 -0
- package/dist/hooks/useRovingGrid.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2901 -203
- package/dist/index.d.ts +2901 -203
- package/dist/index.mjs +107 -99
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +111 -67
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/date.cjs +2 -0
- package/dist/lib/date.cjs.map +1 -0
- package/dist/lib/date.mjs +44 -0
- package/dist/lib/date.mjs.map +1 -0
- package/dist/lib/focus.cjs +1 -1
- package/dist/lib/focus.cjs.map +1 -1
- package/dist/lib/focus.mjs +5 -2
- package/dist/lib/focus.mjs.map +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/lib/styles.cjs +1 -1
- package/dist/lib/styles.cjs.map +1 -1
- package/dist/lib/styles.mjs +21 -4
- package/dist/lib/styles.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/styles/tokens.css +13 -0
|
@@ -3,339 +3,258 @@ import { cn as e } from "../../lib/cn.mjs";
|
|
|
3
3
|
import { warnDeprecated as t, warnOnce as n } from "../../lib/dev.mjs";
|
|
4
4
|
import { composeEventHandlers as r } from "../../lib/composeEventHandlers.mjs";
|
|
5
5
|
import { datePickerClassNames as i } from "../../lib/classNames.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { FOCUSABLE_SELECTOR as
|
|
10
|
-
import { useMergedRefs as
|
|
11
|
-
import { useIsClient as
|
|
12
|
-
import {
|
|
13
|
-
import { useFieldContext as
|
|
14
|
-
import { useDismiss as
|
|
15
|
-
import { Portal as
|
|
16
|
-
import { disabledStyles as
|
|
17
|
-
import { CalendarIcon as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
6
|
+
import { isSameDay as ee, startOfDay as a } from "../../lib/date.mjs";
|
|
7
|
+
import { useControllable as o } from "../../hooks/useControllable.mjs";
|
|
8
|
+
import { useId as s } from "../../hooks/useId.mjs";
|
|
9
|
+
import { FOCUSABLE_SELECTOR as te } from "../../lib/focus.mjs";
|
|
10
|
+
import { useMergedRefs as ne } from "../../hooks/useMergedRefs.mjs";
|
|
11
|
+
import { useIsClient as re } from "../../hooks/useIsClient.mjs";
|
|
12
|
+
import { joinIds as ie } from "../../lib/aria.mjs";
|
|
13
|
+
import { useFieldContext as ae, useFieldControl as oe } from "../../hooks/useFieldControl.mjs";
|
|
14
|
+
import { useDismiss as se } from "../../hooks/useDismiss.mjs";
|
|
15
|
+
import { Portal as ce } from "../portal/Portal.mjs";
|
|
16
|
+
import { disabledStyles as le, focusRing as ue, inputAppearanceClasses as de, inputFocus as fe, inputHeightClasses as pe, inputPaddingClasses as me, inputTextClasses as he } from "../../lib/styles.mjs";
|
|
17
|
+
import { CalendarIcon as ge, DismissIcon as _e } from "../../lib/icons.mjs";
|
|
18
|
+
import { useInputLook as ve } from "./inputLook.mjs";
|
|
19
|
+
import { isInvalidLook as ye } from "./Input.mjs";
|
|
20
|
+
import { useFormReset as be } from "../../hooks/useFormReset.mjs";
|
|
21
|
+
import { HiddenInput as xe } from "../internal/HiddenInput.mjs";
|
|
22
|
+
import { pickerButtonOffset as c, pickerEndPadding as Se, pickerGlyphSize as l, pickerIconButtonClasses as u } from "./pickerStyles.mjs";
|
|
23
|
+
import { usePopupPosition as Ce } from "../../hooks/usePopupPosition.mjs";
|
|
24
|
+
import { formatDate as we, formatISODate as d, getLocaleDateFormat as Te, isDateInRange as Ee, isValidLocaleTag as De, parseDate as Oe } from "./dateUtils.mjs";
|
|
25
|
+
import { useFocusTrap as ke } from "../../hooks/useFocusTrap.mjs";
|
|
26
|
+
import { useRestoreFocus as Ae } from "../../hooks/useRestoreFocus.mjs";
|
|
27
|
+
import { CalendarView as je } from "./Calendar.mjs";
|
|
28
|
+
import * as f from "react";
|
|
29
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
30
|
+
import { flushSync as Me } from "react-dom";
|
|
28
31
|
//#region src/components/input/DatePicker.tsx
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
32
|
+
var Ne = (e) => e ? `Enter a date in the format ${e}.` : "Enter a valid date.", Pe = (e, t) => e !== void 0 && t !== void 0 ? `Enter a date between ${e} and ${t}.` : e === void 0 ? `Enter a date on or before ${t}.` : `Enter a date on or after ${e}.`, Fe = {
|
|
33
|
+
header: i.header,
|
|
34
|
+
previousMonthButton: i.previousMonthButton,
|
|
35
|
+
heading: i.heading,
|
|
36
|
+
headingButton: i.headingButton,
|
|
37
|
+
nextMonthButton: i.nextMonthButton,
|
|
38
|
+
grid: i.grid,
|
|
39
|
+
weekday: i.weekday,
|
|
40
|
+
day: i.day,
|
|
41
|
+
month: i.month,
|
|
42
|
+
year: i.year,
|
|
43
|
+
weekNumberHeader: i.weekNumberHeader,
|
|
44
|
+
weekNumber: i.weekNumber,
|
|
45
|
+
markedDot: i.markedDot,
|
|
46
|
+
footer: i.footer,
|
|
47
|
+
todayButton: i.todayButton,
|
|
48
|
+
closeButton: i.closeButton
|
|
49
|
+
}, h = (h) => {
|
|
50
|
+
let { value: Ie, defaultValue: Le, onValueChange: Re, onChange: g, formatDate: _, parseDate: v, locale: y, minDate: b, maxDate: x, disabledDates: S, placeholder: ze = "Select a date", disabled: C = !1, size: Be, appearance: Ve, readOnly: w, clearable: He = !1, firstDayOfWeek: Ue = 0, today: We, initialVisibleDate: Ge, showMonthPicker: Ke, showWeekNumbers: qe, firstWeekOfYear: Je, showGoToToday: Ye, showCloseButton: Xe = !1, markedDates: Ze, renderDay: Qe, dayLabel: $e, open: T, defaultOpen: et, onOpenChange: tt, onInvalidInput: nt, labels: E, name: rt, form: it, required: at, autoComplete: ot = "off", autoCapitalize: st, autoCorrect: ct, enterKeyHint: lt, inputMode: ut, spellCheck: dt, autoFocus: ft, tabIndex: pt, id: mt, "aria-label": ht, "aria-labelledby": gt, "aria-describedby": _t, "aria-invalid": vt, "aria-required": yt, "aria-errormessage": bt, "aria-details": xt, onFocus: St, onBlur: Ct, onKeyDown: wt, onKeyUp: Tt, controlRef: Et, className: Dt, ref: Ot, ...kt } = h;
|
|
51
|
+
g !== void 0 && t("DatePicker", "onChange", "onValueChange");
|
|
52
|
+
let { size: D, appearance: O } = ve(Be, Ve), k = _ !== void 0, A = v !== void 0;
|
|
53
|
+
f.useEffect(() => {
|
|
54
|
+
k && !A && n("DatePicker:formatDate-without-parseDate", "DatePicker: `formatDate` is set without `parseDate`. Typed dates are parsed with the default parser for `locale` (its numeric format or yyyy-mm-dd), which may not read your format; pass `parseDate` as the inverse of `formatDate`.");
|
|
55
|
+
}, [k, A]), f.useEffect(() => {
|
|
56
|
+
y !== void 0 && !De(y) && n(`DatePicker:invalid-locale:${y}`, `DatePicker: \`locale\` "${y}" is not a valid BCP 47 language tag (use hyphens, as in "en-US"). The runtime default locale formats and parses the dates instead, so the server and the browser may render different text.`);
|
|
57
|
+
}, [y]);
|
|
58
|
+
let [j, At] = o(Ie, Le ?? null, (e) => {
|
|
59
|
+
Re?.(e), g?.(e);
|
|
60
|
+
}), M = !C && !w, [N, P] = o(T, (et ?? !1) && M, tt), jt = re(), F = N && M && jt, Mt = T !== void 0;
|
|
61
|
+
f.useEffect(() => {
|
|
62
|
+
!M && N && !Mt && P(!1);
|
|
49
63
|
}, [
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
M,
|
|
65
|
+
N,
|
|
52
66
|
Mt,
|
|
53
|
-
|
|
67
|
+
P
|
|
54
68
|
]);
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
let
|
|
58
|
-
|
|
59
|
-
let
|
|
60
|
-
let t = e ?
|
|
61
|
-
(t ?
|
|
62
|
-
},
|
|
63
|
-
if (!e.trim()) return
|
|
64
|
-
let t =
|
|
65
|
-
if (!t || Number.isNaN(t.getTime()) ? n = "unparseable" :
|
|
69
|
+
let I = (e) => _ ? _(e) : we(e, y), Nt = (e) => v ? v(e) : Oe(e, y), [L, R] = f.useState(null), [z, B] = f.useState(null), [Pt, Ft] = f.useState(M);
|
|
70
|
+
Pt !== M && (Ft(M), M || (R(null), B(null)));
|
|
71
|
+
let V = j ? d(j) : "", [It, Lt] = f.useState(V);
|
|
72
|
+
It !== V && (Lt(V), z !== null && (R(null), B(null)));
|
|
73
|
+
let H = (e) => {
|
|
74
|
+
let t = e ? a(e) : null;
|
|
75
|
+
(t ? ee(t, j) : j === null) || At(t), R(null), B(null);
|
|
76
|
+
}, U = (e) => {
|
|
77
|
+
if (!e.trim()) return H(null), !0;
|
|
78
|
+
let t = Nt(e), n = null;
|
|
79
|
+
if (!t || Number.isNaN(t.getTime()) ? n = "unparseable" : Ee(t, b, x) ? S?.(a(t)) && (n = "disabled") : n = "out-of-range", n || !t) {
|
|
66
80
|
let t = n ?? "unparseable";
|
|
67
|
-
return
|
|
81
|
+
return B(t), nt?.(e, t), !1;
|
|
68
82
|
}
|
|
69
|
-
return
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
let
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
let t = c(B, e), n = l(c(q, e), x, S);
|
|
77
|
-
V(t), H(f(n, t) ? n : null);
|
|
78
|
-
}, Xt = (e) => {
|
|
79
|
-
d(e, q) || H(e);
|
|
80
|
-
}, Zt = !!x && s(B, -1) < p(x), Qt = !!S && c(B, 1) > p(S), $t = m.useMemo(() => je(b, T), [b, T]), Y = m.useRef(null), X = m.useRef(null), Z = m.useRef(null), en = m.useRef(null), Q = m.useRef(null), [tn, nn] = m.useState(null), rn = re(Tt, Y), an = o("datepicker-dialog"), on = o("datepicker-heading"), sn = o("datepicker-grid"), cn = o("datepicker-error"), ln = (e) => {
|
|
81
|
-
Q.current = e, j(!1);
|
|
82
|
-
}, { layerId: un } = ue({
|
|
83
|
-
open: M,
|
|
83
|
+
return H(t), !0;
|
|
84
|
+
}, [W, G] = f.useState(!1);
|
|
85
|
+
W && !F && G(!1);
|
|
86
|
+
let K = f.useRef(null), q = f.useRef(null), J = f.useRef(null), Y = f.useRef(null), [Rt, zt] = f.useState(null), Bt = ne(Et, K), Vt = s("datepicker-dialog"), Ht = s("datepicker-heading"), X = s("datepicker-error"), Z = (e) => {
|
|
87
|
+
Y.current = e, P(!1);
|
|
88
|
+
}, { layerId: Ut } = se({
|
|
89
|
+
open: F,
|
|
84
90
|
onDismiss: (e, t) => {
|
|
85
|
-
let n = e === "outside-press" && t.target instanceof Element ? t.target.closest(
|
|
86
|
-
|
|
91
|
+
let n = e === "outside-press" && t.target instanceof Element ? t.target.closest(te) : null;
|
|
92
|
+
Z(n ?? (W ? K.current : null));
|
|
87
93
|
},
|
|
88
|
-
refs: [
|
|
89
|
-
anchorRef:
|
|
94
|
+
refs: [J, q],
|
|
95
|
+
anchorRef: q,
|
|
90
96
|
kind: "modal"
|
|
91
|
-
}), { setReference:
|
|
92
|
-
open:
|
|
97
|
+
}), { setReference: Wt, setFloating: Gt, floatingProps: Kt } = Ce({
|
|
98
|
+
open: F,
|
|
93
99
|
side: "bottom",
|
|
94
100
|
align: "start"
|
|
95
|
-
}),
|
|
96
|
-
|
|
97
|
-
enabled:
|
|
98
|
-
layerId:
|
|
99
|
-
initialFocus: () =>
|
|
100
|
-
}),
|
|
101
|
-
enabled:
|
|
102
|
-
container:
|
|
103
|
-
triggerRef:
|
|
104
|
-
finalFocusRef:
|
|
101
|
+
}), qt = ne(J, zt, Gt);
|
|
102
|
+
ke(Rt, {
|
|
103
|
+
enabled: F,
|
|
104
|
+
layerId: Ut,
|
|
105
|
+
initialFocus: () => J.current?.querySelector("[data-wave-calendar-grid] button[tabindex=\"0\"]") ?? null
|
|
106
|
+
}), Ae({
|
|
107
|
+
enabled: F,
|
|
108
|
+
container: Rt,
|
|
109
|
+
triggerRef: q,
|
|
110
|
+
finalFocusRef: Y,
|
|
105
111
|
onlyIfFocusInside: !0
|
|
106
|
-
}),
|
|
107
|
-
|
|
108
|
-
}, [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
"
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}), Cn = r(St, () => {
|
|
130
|
-
k && N !== null && F === null && z(N);
|
|
131
|
-
}), wn = () => {
|
|
132
|
-
k && (Q.current = null, W(!1), j(!M));
|
|
133
|
-
}, Tn = () => {
|
|
134
|
-
k && (R(null), Y.current?.focus());
|
|
135
|
-
}, En = (e) => {
|
|
112
|
+
}), f.useLayoutEffect(() => {
|
|
113
|
+
F && (Y.current = null);
|
|
114
|
+
}, [F]);
|
|
115
|
+
let Jt = ae(), Yt = (at ?? Jt?.required ?? !1) && !w, Xt = z !== null && !Jt?.hasErrorMessage, Zt = oe({
|
|
116
|
+
id: mt,
|
|
117
|
+
"aria-label": ht,
|
|
118
|
+
"aria-labelledby": gt,
|
|
119
|
+
"aria-describedby": ie(_t, Xt ? X : void 0),
|
|
120
|
+
"aria-invalid": z !== null || vt,
|
|
121
|
+
"aria-required": yt ?? at
|
|
122
|
+
}), Qt = ye(!1, Zt["aria-invalid"]);
|
|
123
|
+
be(K, () => H(Le ?? null), it);
|
|
124
|
+
let Q = He && !w && j !== null, $t = (e) => {
|
|
125
|
+
M && (R(e.target.value), B(null));
|
|
126
|
+
}, en = r(wt, (e) => {
|
|
127
|
+
M && !e.nativeEvent.isComposing && (e.key === "Enter" && L !== null ? (e.preventDefault(), U(L)) : e.key === "Tab" && !e.shiftKey && Q && L !== null && !L.trim() ? Me(() => U(L)) : e.key === "ArrowDown" && e.altKey && !F && (e.preventDefault(), L !== null && z === null && U(L), G(!0), P(!0)));
|
|
128
|
+
}), tn = r(Ct, () => {
|
|
129
|
+
M && L !== null && z === null && U(L);
|
|
130
|
+
}), nn = () => {
|
|
131
|
+
M && (Y.current = null, G(!1), P(!F));
|
|
132
|
+
}, rn = () => {
|
|
133
|
+
M && (H(null), K.current?.focus());
|
|
134
|
+
}, an = (e) => {
|
|
136
135
|
e.preventDefault();
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
},
|
|
140
|
-
e.key !== "Escape" || e.defaultPrevented || e.nativeEvent.isComposing || (e.preventDefault(),
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
orientation: "horizontal",
|
|
149
|
-
dir: te(e.currentTarget)
|
|
150
|
-
});
|
|
151
|
-
n = s(q, t === "next" ? 1 : -1);
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
case "ArrowDown":
|
|
155
|
-
n = s(q, 7);
|
|
156
|
-
break;
|
|
157
|
-
case "ArrowUp":
|
|
158
|
-
n = s(q, -7);
|
|
159
|
-
break;
|
|
160
|
-
case "PageDown":
|
|
161
|
-
n = c(q, e.shiftKey ? 12 : 1);
|
|
162
|
-
break;
|
|
163
|
-
case "PageUp":
|
|
164
|
-
n = c(q, e.shiftKey ? -12 : -1);
|
|
165
|
-
break;
|
|
166
|
-
case "Home":
|
|
167
|
-
n = s(q, -t);
|
|
168
|
-
break;
|
|
169
|
-
case "End":
|
|
170
|
-
n = s(q, 6 - t);
|
|
171
|
-
break;
|
|
172
|
-
default: return;
|
|
173
|
-
}
|
|
174
|
-
e.preventDefault(), Jt(n);
|
|
175
|
-
}, An = N ?? (O ? Nt(O) : ""), $ = "";
|
|
176
|
-
return F === "unparseable" ? $ = (E?.invalidDate ?? ze)(D ? void 0 : Ae(b).pattern) : F === "out-of-range" && (x || S) ? $ = (E?.outOfRange ?? Be)(x ? Nt(p(x)) : void 0, S ? Nt(p(S)) : void 0) : F === "disabled" && ($ = E?.unavailableDate ?? "This date is not available."), /* @__PURE__ */ g("div", {
|
|
177
|
-
...Ot,
|
|
178
|
-
ref: Dt,
|
|
179
|
-
className: e(i.root, "relative inline-flex flex-col", Et),
|
|
136
|
+
}, on = (e) => {
|
|
137
|
+
M && (H(e), Z(K.current));
|
|
138
|
+
}, sn = () => Z(W ? K.current : null), cn = (e) => {
|
|
139
|
+
e.key !== "Escape" || e.defaultPrevented || e.nativeEvent.isComposing || (e.preventDefault(), sn());
|
|
140
|
+
}, ln = L ?? (j ? I(j) : ""), $ = "";
|
|
141
|
+
return z === "unparseable" ? $ = (E?.invalidDate ?? Ne)(A ? void 0 : Te(y).pattern) : z === "out-of-range" && (b || x) ? $ = (E?.outOfRange ?? Pe)(b ? I(a(b)) : void 0, x ? I(a(x)) : void 0) : z === "disabled" && ($ = E?.unavailableDate ?? "This date is not available."), /* @__PURE__ */ m("div", {
|
|
142
|
+
"data-size": D,
|
|
143
|
+
"data-appearance": O,
|
|
144
|
+
...kt,
|
|
145
|
+
ref: Ot,
|
|
146
|
+
className: e(i.root, "relative inline-flex flex-col", Dt),
|
|
180
147
|
children: [
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
ref:
|
|
148
|
+
/* @__PURE__ */ m("div", {
|
|
149
|
+
ref: Wt,
|
|
183
150
|
className: "relative flex items-center",
|
|
184
151
|
children: [
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
-
ref:
|
|
152
|
+
/* @__PURE__ */ p("input", {
|
|
153
|
+
ref: Bt,
|
|
187
154
|
type: "text",
|
|
188
|
-
...
|
|
189
|
-
"aria-errormessage":
|
|
190
|
-
"aria-details":
|
|
191
|
-
value:
|
|
192
|
-
onChange:
|
|
193
|
-
onFocus:
|
|
194
|
-
onBlur:
|
|
195
|
-
onKeyDown:
|
|
196
|
-
onKeyUp:
|
|
197
|
-
placeholder:
|
|
155
|
+
...Zt,
|
|
156
|
+
"aria-errormessage": bt,
|
|
157
|
+
"aria-details": xt,
|
|
158
|
+
value: ln,
|
|
159
|
+
onChange: $t,
|
|
160
|
+
onFocus: St,
|
|
161
|
+
onBlur: tn,
|
|
162
|
+
onKeyDown: en,
|
|
163
|
+
onKeyUp: Tt,
|
|
164
|
+
placeholder: ze,
|
|
198
165
|
disabled: C,
|
|
199
166
|
readOnly: w,
|
|
200
|
-
autoComplete:
|
|
201
|
-
autoCapitalize:
|
|
202
|
-
autoCorrect:
|
|
203
|
-
enterKeyHint:
|
|
204
|
-
inputMode:
|
|
205
|
-
spellCheck:
|
|
206
|
-
autoFocus:
|
|
207
|
-
tabIndex:
|
|
208
|
-
className: e(i.input, he, "
|
|
167
|
+
autoComplete: ot,
|
|
168
|
+
autoCapitalize: st,
|
|
169
|
+
autoCorrect: ct,
|
|
170
|
+
enterKeyHint: lt,
|
|
171
|
+
inputMode: ut,
|
|
172
|
+
spellCheck: dt,
|
|
173
|
+
autoFocus: ft,
|
|
174
|
+
tabIndex: pt,
|
|
175
|
+
className: e(i.input, pe[D], "w-full", me[D], he[D], de[O], "text-foreground placeholder:text-muted-foreground", fe, le, Qt && "border-destructive", Se(Q ? 2 : 1, D))
|
|
209
176
|
}),
|
|
210
|
-
|
|
177
|
+
Q && /* @__PURE__ */ p("button", {
|
|
211
178
|
type: "button",
|
|
212
179
|
"aria-label": E?.clear ?? "Clear date",
|
|
213
180
|
disabled: C,
|
|
214
|
-
onMouseDown:
|
|
215
|
-
onClick:
|
|
216
|
-
className: e(i.clearButton,
|
|
217
|
-
children: /* @__PURE__ */
|
|
181
|
+
onMouseDown: an,
|
|
182
|
+
onClick: rn,
|
|
183
|
+
className: e(i.clearButton, u(D, O), c(D, 2), "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", "disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100"),
|
|
184
|
+
children: /* @__PURE__ */ p(_e, { size: l(D, "icon") })
|
|
218
185
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
ref:
|
|
186
|
+
/* @__PURE__ */ p("button", {
|
|
187
|
+
ref: q,
|
|
221
188
|
type: "button",
|
|
222
189
|
"aria-label": E?.openCalendar ?? "Open calendar",
|
|
223
190
|
"aria-haspopup": "dialog",
|
|
224
|
-
"aria-expanded":
|
|
225
|
-
"aria-controls":
|
|
191
|
+
"aria-expanded": F,
|
|
192
|
+
"aria-controls": F ? Vt : void 0,
|
|
226
193
|
disabled: C || w,
|
|
227
|
-
onClick:
|
|
228
|
-
className: e(i.openCalendarButton,
|
|
229
|
-
children: /* @__PURE__ */
|
|
194
|
+
onClick: nn,
|
|
195
|
+
className: e(i.openCalendarButton, u(D, O), c(D, 1), ue, le),
|
|
196
|
+
children: /* @__PURE__ */ p(ge, { size: l(D, "icon") })
|
|
230
197
|
})
|
|
231
198
|
]
|
|
232
199
|
}),
|
|
233
|
-
|
|
234
|
-
id:
|
|
200
|
+
Xt && /* @__PURE__ */ p("p", {
|
|
201
|
+
id: X,
|
|
235
202
|
role: "alert",
|
|
236
203
|
className: e(i.errorMessage, "mt-1 text-caption-1 text-error"),
|
|
237
204
|
children: $
|
|
238
205
|
}),
|
|
239
|
-
/* @__PURE__ */
|
|
240
|
-
name:
|
|
241
|
-
form:
|
|
206
|
+
/* @__PURE__ */ p(xe, {
|
|
207
|
+
name: rt,
|
|
208
|
+
form: it,
|
|
242
209
|
disabled: C,
|
|
243
|
-
value:
|
|
210
|
+
value: j ? d(j) : "",
|
|
244
211
|
type: "text",
|
|
245
|
-
required:
|
|
246
|
-
onInvalid: () =>
|
|
212
|
+
required: Yt,
|
|
213
|
+
onInvalid: () => K.current?.focus()
|
|
247
214
|
}),
|
|
248
|
-
|
|
249
|
-
layerId:
|
|
250
|
-
children: /* @__PURE__ */
|
|
251
|
-
ref:
|
|
252
|
-
id:
|
|
215
|
+
F && /* @__PURE__ */ p(ce, {
|
|
216
|
+
layerId: Ut,
|
|
217
|
+
children: /* @__PURE__ */ p("div", {
|
|
218
|
+
ref: qt,
|
|
219
|
+
id: Vt,
|
|
253
220
|
role: "dialog",
|
|
254
221
|
"aria-modal": "true",
|
|
255
|
-
"aria-labelledby":
|
|
256
|
-
...
|
|
222
|
+
"aria-labelledby": Ht,
|
|
223
|
+
...Kt,
|
|
257
224
|
"data-state": "open",
|
|
258
|
-
onKeyDown:
|
|
225
|
+
onKeyDown: cn,
|
|
259
226
|
className: e(i.surface, "rounded-md border border-border bg-background p-3 text-foreground shadow-16"),
|
|
260
|
-
children:
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
className: e(i.nextMonthButton, He, "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", "disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100"),
|
|
285
|
-
children: /* @__PURE__ */ h(ye, { className: "wave-rtl:-scale-x-100" })
|
|
286
|
-
})
|
|
287
|
-
]
|
|
288
|
-
}), /* @__PURE__ */ g("table", {
|
|
289
|
-
ref: Z,
|
|
290
|
-
id: sn,
|
|
291
|
-
role: "grid",
|
|
292
|
-
"aria-labelledby": on,
|
|
293
|
-
onKeyDown: kn,
|
|
294
|
-
className: e(i.grid, "border-collapse"),
|
|
295
|
-
children: [/* @__PURE__ */ h("thead", { children: /* @__PURE__ */ h("tr", { children: $t.map((t) => /* @__PURE__ */ g("th", {
|
|
296
|
-
scope: "col",
|
|
297
|
-
abbr: t.long,
|
|
298
|
-
"aria-label": t.long,
|
|
299
|
-
className: e(i.weekday, "h-8 w-8 text-center text-caption-1 font-normal text-muted-foreground"),
|
|
300
|
-
children: [/* @__PURE__ */ h("span", {
|
|
301
|
-
"aria-hidden": "true",
|
|
302
|
-
children: t.short
|
|
303
|
-
}), /* @__PURE__ */ h("span", {
|
|
304
|
-
className: "sr-only",
|
|
305
|
-
children: t.long
|
|
306
|
-
})]
|
|
307
|
-
}, t.long)) }) }), /* @__PURE__ */ h("tbody", { children: G.map((t, n) => /* @__PURE__ */ h("tr", { children: t.map((t, n) => {
|
|
308
|
-
let r = u(t), a = d(t, O), o = d(t, Bt), ee = r === J, te = zt(t);
|
|
309
|
-
return /* @__PURE__ */ h("td", {
|
|
310
|
-
role: "gridcell",
|
|
311
|
-
"aria-selected": a,
|
|
312
|
-
className: "p-0",
|
|
313
|
-
children: /* @__PURE__ */ h("button", {
|
|
314
|
-
type: "button",
|
|
315
|
-
tabIndex: ee ? 0 : -1,
|
|
316
|
-
"aria-label": Ee(t, b),
|
|
317
|
-
"aria-pressed": a || void 0,
|
|
318
|
-
"aria-current": o ? "date" : void 0,
|
|
319
|
-
...ae(te),
|
|
320
|
-
"data-date": r,
|
|
321
|
-
"data-selected": a ? "" : void 0,
|
|
322
|
-
"data-today": o ? "" : void 0,
|
|
323
|
-
"data-outside": f(t, B) ? void 0 : "",
|
|
324
|
-
onFocus: () => Xt(t),
|
|
325
|
-
onClick: () => Dn(t),
|
|
326
|
-
className: e(i.day, Ue, "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", "disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:focus-visible:opacity-100", a && me.selectedLeaf),
|
|
327
|
-
children: De(t, b)
|
|
328
|
-
})
|
|
329
|
-
}, n);
|
|
330
|
-
}) }, n)) })]
|
|
331
|
-
})]
|
|
227
|
+
children: /* @__PURE__ */ p(je, {
|
|
228
|
+
value: j,
|
|
229
|
+
onPick: on,
|
|
230
|
+
minDate: b,
|
|
231
|
+
maxDate: x,
|
|
232
|
+
disabledDates: S,
|
|
233
|
+
firstDayOfWeek: Ue,
|
|
234
|
+
locale: y,
|
|
235
|
+
today: We,
|
|
236
|
+
initialVisibleDate: Ge,
|
|
237
|
+
showMonthPicker: Ke,
|
|
238
|
+
showWeekNumbers: qe,
|
|
239
|
+
firstWeekOfYear: Je,
|
|
240
|
+
showGoToToday: Ye,
|
|
241
|
+
markedDates: Ze,
|
|
242
|
+
renderDay: Qe,
|
|
243
|
+
dayLabel: $e,
|
|
244
|
+
onClose: Xe ? sn : void 0,
|
|
245
|
+
closeLabel: E?.close,
|
|
246
|
+
labels: E,
|
|
247
|
+
headingAs: "h2",
|
|
248
|
+
headingId: Ht,
|
|
249
|
+
partClassNames: Fe
|
|
250
|
+
})
|
|
332
251
|
})
|
|
333
252
|
})
|
|
334
253
|
]
|
|
335
254
|
});
|
|
336
255
|
};
|
|
337
|
-
|
|
256
|
+
h.displayName = "DatePicker";
|
|
338
257
|
//#endregion
|
|
339
|
-
export {
|
|
258
|
+
export { h as DatePicker };
|
|
340
259
|
|
|
341
260
|
//# sourceMappingURL=DatePicker.mjs.map
|