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