@mortenbrudvik/waveui 0.11.0 → 0.12.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 +97 -2
- package/dist/components/button/Link.cjs +1 -1
- package/dist/components/button/Link.cjs.map +1 -1
- package/dist/components/button/Link.mjs +4 -4
- package/dist/components/data-display/AvatarGroup.cjs +1 -1
- package/dist/components/data-display/AvatarGroup.cjs.map +1 -1
- package/dist/components/data-display/AvatarGroup.mjs +10 -10
- package/dist/components/data-display/InfoButton.cjs +1 -1
- package/dist/components/data-display/InfoButton.cjs.map +1 -1
- package/dist/components/data-display/InfoButton.mjs +12 -12
- package/dist/components/feedback/Toaster.cjs +1 -1
- package/dist/components/feedback/Toaster.cjs.map +1 -1
- package/dist/components/feedback/Toaster.mjs +235 -235
- package/dist/components/feedback/Toaster.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.mjs +176 -175
- 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 +188 -187
- 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 +41 -40
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.mjs +89 -87
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/input/TagPicker.root.cjs +1 -1
- package/dist/components/input/TagPicker.root.cjs.map +1 -1
- package/dist/components/input/TagPicker.root.mjs +136 -135
- package/dist/components/input/TagPicker.root.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 +156 -154
- package/dist/components/input/TimePicker.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 +137 -127
- package/dist/components/navigation/Menu.popover.mjs.map +1 -1
- 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 +4 -4
- package/dist/components/overlays/Dialog.cjs +1 -1
- package/dist/components/overlays/Dialog.cjs.map +1 -1
- package/dist/components/overlays/Dialog.mjs +123 -123
- package/dist/components/overlays/Dialog.mjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.cjs +1 -1
- package/dist/components/overlays/Drawer.panel.cjs.map +1 -1
- package/dist/components/overlays/Drawer.panel.mjs +12 -12
- package/dist/components/overlays/Drawer.panel.mjs.map +1 -1
- package/dist/components/overlays/Popover.cjs +1 -1
- package/dist/components/overlays/Popover.cjs.map +1 -1
- package/dist/components/overlays/Popover.mjs +173 -162
- package/dist/components/overlays/Popover.mjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.cjs +1 -1
- package/dist/components/overlays/TeachingPopover.cjs.map +1 -1
- package/dist/components/overlays/TeachingPopover.mjs +96 -91
- package/dist/components/overlays/TeachingPopover.mjs.map +1 -1
- package/dist/components/overlays/Tooltip.cjs +1 -1
- package/dist/components/overlays/Tooltip.cjs.map +1 -1
- package/dist/components/overlays/Tooltip.mjs +47 -47
- package/dist/components/overlays/Tooltip.mjs.map +1 -1
- package/dist/components/portal/Portal.cjs +1 -1
- package/dist/components/portal/Portal.cjs.map +1 -1
- package/dist/components/portal/Portal.mjs +5 -5
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.mjs +1 -1
- package/dist/hooks/useDismiss.cjs.map +1 -1
- package/dist/hooks/useDismiss.mjs.map +1 -1
- package/dist/hooks/useFocusTrap.cjs.map +1 -1
- package/dist/hooks/useFocusTrap.mjs.map +1 -1
- package/dist/hooks/useFocusVisible.cjs +2 -0
- package/dist/hooks/useFocusVisible.cjs.map +1 -0
- package/dist/hooks/useFocusVisible.mjs +49 -0
- package/dist/hooks/useFocusVisible.mjs.map +1 -0
- package/dist/hooks/useFocusableGroup.cjs +2 -0
- package/dist/hooks/useFocusableGroup.cjs.map +1 -0
- package/dist/hooks/useFocusableGroup.mjs +70 -0
- package/dist/hooks/useFocusableGroup.mjs.map +1 -0
- package/dist/hooks/useModalLayer.cjs +1 -1
- package/dist/hooks/useModalLayer.cjs.map +1 -1
- package/dist/hooks/useModalLayer.mjs +4 -4
- package/dist/hooks/useModalOpen.cjs +2 -0
- package/dist/hooks/useModalOpen.cjs.map +1 -0
- package/dist/hooks/useModalOpen.mjs +14 -0
- package/dist/hooks/useModalOpen.mjs.map +1 -0
- package/dist/hooks/usePopupPosition.cjs +1 -1
- package/dist/hooks/usePopupPosition.cjs.map +1 -1
- package/dist/hooks/usePopupPosition.mjs +82 -53
- package/dist/hooks/usePopupPosition.mjs.map +1 -1
- package/dist/hooks/useResolvedTarget.cjs +2 -0
- package/dist/hooks/useResolvedTarget.cjs.map +1 -0
- package/dist/hooks/useResolvedTarget.mjs +37 -0
- package/dist/hooks/useResolvedTarget.mjs.map +1 -0
- package/dist/hooks/useRovingGrid.cjs +1 -1
- package/dist/hooks/useRovingGrid.cjs.map +1 -1
- package/dist/hooks/useRovingGrid.mjs +8 -57
- package/dist/hooks/useRovingGrid.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +142 -107
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +814 -18
- package/dist/index.d.ts +814 -18
- package/dist/index.mjs +120 -108
- package/dist/lib/layers.cjs +1 -1
- package/dist/lib/layers.cjs.map +1 -1
- package/dist/lib/layers.mjs +112 -109
- package/dist/lib/layers.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -10,89 +10,89 @@ import { useIsClient as te } from "../../hooks/useIsClient.mjs";
|
|
|
10
10
|
import { joinIds as ne } from "../../lib/aria.mjs";
|
|
11
11
|
import { useFieldContext as re, useFieldControl as ie } from "../../hooks/useFieldControl.mjs";
|
|
12
12
|
import { ListboxContext as ae, useListbox as oe, useListboxOption as s } from "../../hooks/useListbox.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { disabledStyles as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import { generateTimeOptions as
|
|
13
|
+
import { resolvePositioning as se, usePopupPosition as ce } from "../../hooks/usePopupPosition.mjs";
|
|
14
|
+
import { useDismiss as le } from "../../hooks/useDismiss.mjs";
|
|
15
|
+
import { disabledStyles as ue, forcedColors as de, inputAppearanceClasses as fe, inputFocus as pe, inputHeightClasses as me, inputPaddingClasses as he, inputTextClasses as ge } from "../../lib/styles.mjs";
|
|
16
|
+
import { Portal as _e } from "../portal/Portal.mjs";
|
|
17
|
+
import { CheckIcon as c, DismissIcon as ve } from "../../lib/icons.mjs";
|
|
18
|
+
import { useInputLook as ye } from "./inputLook.mjs";
|
|
19
|
+
import { isInvalidLook as be } from "./Input.mjs";
|
|
20
|
+
import { useFormReset as xe } from "../../hooks/useFormReset.mjs";
|
|
21
|
+
import { HiddenInput as Se } from "../internal/HiddenInput.mjs";
|
|
22
|
+
import { pickerButtonOffset as Ce, pickerEndPadding as we, pickerGlyphSize as Te, pickerIconButtonClasses as Ee } from "./pickerStyles.mjs";
|
|
23
|
+
import { PickerExpandButton as De, showsExpandButton as Oe } from "./Combobox.expand.mjs";
|
|
24
|
+
import { generateTimeOptions as ke, minutesToTime as Ae, minutesToValue as l, normalizeTimeStep as je, timeToMinutes as u } from "./dateUtils.mjs";
|
|
25
25
|
import * as d from "react";
|
|
26
26
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
27
|
-
import { flushSync as
|
|
27
|
+
import { flushSync as Me } from "react-dom";
|
|
28
28
|
//#region src/components/input/TimePicker.tsx
|
|
29
|
-
var m = "flex cursor-pointer items-center gap-2 px-3 py-1.5 text-body-1 text-foreground hover:bg-subtle-hover data-[active]:bg-subtle-hover data-[active]:outline-2 data-[active]:outline-ring data-[active]:-outline-offset-2 data-[selected]:bg-subtle-selected data-[selected]:font-semibold",
|
|
29
|
+
var m = "flex cursor-pointer items-center gap-2 px-3 py-1.5 text-body-1 text-foreground hover:bg-subtle-hover data-[active]:bg-subtle-hover data-[active]:outline-2 data-[active]:outline-ring data-[active]:-outline-offset-2 data-[selected]:bg-subtle-selected data-[selected]:font-semibold", Ne = d.memo(function({ value: t, label: n }) {
|
|
30
30
|
let { selected: r, optionProps: a } = s({
|
|
31
31
|
value: t,
|
|
32
32
|
label: n
|
|
33
33
|
});
|
|
34
34
|
return /* @__PURE__ */ p("li", {
|
|
35
35
|
...a,
|
|
36
|
-
className: e(i.option, m, r &&
|
|
36
|
+
className: e(i.option, m, r && de.selectedContainer),
|
|
37
37
|
children: [/* @__PURE__ */ f("span", {
|
|
38
38
|
className: e(i.checkIcon, "flex h-4 w-4 shrink-0 items-center justify-center"),
|
|
39
39
|
children: r ? /* @__PURE__ */ f(c, { size: 12 }) : null
|
|
40
40
|
}), n]
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
|
-
|
|
44
|
-
var
|
|
43
|
+
Ne.displayName = "TimePickerOption";
|
|
44
|
+
var Pe = (e) => `Enter a time in the format ${e}.`, Fe = (e, t) => e !== void 0 && t !== void 0 ? `Enter a time between ${e} and ${t}.` : e === void 0 ? `Enter a time on or before ${t}.` : `Enter a time on or after ${e}.`;
|
|
45
45
|
function h(e, t) {
|
|
46
46
|
let n = u(e);
|
|
47
|
-
return Number.isNaN(n) ? e :
|
|
47
|
+
return Number.isNaN(n) ? e : Ae(n, t);
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function Ie(e, t) {
|
|
50
50
|
return e.label.toLowerCase().includes(t) || e.value.includes(t);
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function Le(e, t) {
|
|
53
53
|
return e.label.toLowerCase().startsWith(t) || e.value.startsWith(t);
|
|
54
54
|
}
|
|
55
55
|
var g = (s) => {
|
|
56
|
-
let { value:
|
|
56
|
+
let { value: de, defaultValue: c, onValueChange: Ae, onChange: m, format: g = "12h", step: _ = 30, minTime: v = "00:00", maxTime: y = "23:59", placeholder: Re = "Select a time", disabled: b = !1, size: ze, positioning: Be, appearance: Ve, readOnly: x, clearable: He = !1, expandIcon: Ue, open: We, defaultOpen: Ge, onOpenChange: Ke, onInvalidInput: qe, labels: S, name: Je, form: Ye, required: Xe, autoComplete: Ze = "off", autoCapitalize: Qe, autoCorrect: $e, maxLength: et, enterKeyHint: tt, inputMode: nt, spellCheck: rt, autoFocus: it, tabIndex: at, id: ot, "aria-label": C, "aria-labelledby": st, "aria-describedby": ct, "aria-invalid": lt, "aria-required": ut, "aria-errormessage": dt, "aria-details": ft, onFocus: pt, onBlur: mt, onKeyDown: ht, onKeyUp: gt, controlRef: _t, className: vt, ref: yt, ...bt } = s;
|
|
57
57
|
m !== void 0 && t("TimePicker", "onChange", "onValueChange");
|
|
58
|
-
let { size:
|
|
59
|
-
|
|
60
|
-
}),
|
|
58
|
+
let { size: w, appearance: T } = ye(ze, Ve), [E, xt] = a(de, c ?? "", (e) => {
|
|
59
|
+
Ae?.(e), m?.(e);
|
|
60
|
+
}), St = je(_).valid, D = u(v), O = u(y), k = !Number.isNaN(D) && !Number.isNaN(O) && D <= O, A = d.useMemo(() => ke(_, v, y, g), [
|
|
61
61
|
_,
|
|
62
62
|
v,
|
|
63
63
|
y,
|
|
64
64
|
g
|
|
65
65
|
]);
|
|
66
66
|
d.useEffect(() => {
|
|
67
|
-
|
|
68
|
-
}, [_,
|
|
67
|
+
St || n(`TimePicker:step:${String(_)}`, `TimePicker: \`step\` must be a positive number of minutes (received ${String(_)}); using 30.`);
|
|
68
|
+
}, [_, St]), d.useEffect(() => {
|
|
69
69
|
k || n(`TimePicker:bounds:${v}|${y}`, `TimePicker: \`minTime\`/\`maxTime\` must be times such as "09:00", "09:00:00" or "9:00 AM" with minTime <= maxTime (received "${v}" / "${y}"); no times are available.`);
|
|
70
70
|
}, [
|
|
71
71
|
v,
|
|
72
72
|
y,
|
|
73
73
|
k
|
|
74
74
|
]);
|
|
75
|
-
let j = !b && !x, [M, N,
|
|
75
|
+
let j = !b && !x, [M, N, Ct] = a(We, (Ge ?? !1) && j, Ke), wt = te(), P = M && j && wt;
|
|
76
76
|
d.useEffect(() => {
|
|
77
|
-
!j && M && !
|
|
77
|
+
!j && M && !Ct && N(!1);
|
|
78
78
|
}, [
|
|
79
79
|
j,
|
|
80
80
|
M,
|
|
81
|
-
|
|
81
|
+
Ct,
|
|
82
82
|
N
|
|
83
83
|
]);
|
|
84
|
-
let [F, I] = d.useState(null), [L, R] = d.useState(null), [
|
|
85
|
-
|
|
86
|
-
let [
|
|
87
|
-
|
|
88
|
-
let
|
|
84
|
+
let [F, I] = d.useState(null), [L, R] = d.useState(null), [Tt, Et] = d.useState(j);
|
|
85
|
+
Tt !== j && (Et(j), j || (I(null), R(null)));
|
|
86
|
+
let [Dt, Ot] = d.useState(E);
|
|
87
|
+
Dt !== E && (Ot(E), L !== null && (I(null), R(null)));
|
|
88
|
+
let kt = F ?? "", At = () => {
|
|
89
89
|
j && !P && N(!0);
|
|
90
90
|
}, z = () => N(!1), B = d.useMemo(() => {
|
|
91
|
-
let e =
|
|
91
|
+
let e = kt.trim().toLowerCase();
|
|
92
92
|
if (!e) return;
|
|
93
93
|
let t = u(e), n = Number.isNaN(t) ? null : l(t);
|
|
94
|
-
return (t) => t.value === n ||
|
|
95
|
-
}, [
|
|
94
|
+
return (t) => t.value === n || Ie(t, e);
|
|
95
|
+
}, [kt]), jt = (e) => {
|
|
96
96
|
let t = e.trim().toLowerCase();
|
|
97
97
|
if (!t) return null;
|
|
98
98
|
let n = u(e);
|
|
@@ -100,192 +100,194 @@ var g = (s) => {
|
|
|
100
100
|
let e = l(n);
|
|
101
101
|
return A.some((t) => t.value === e) ? e : null;
|
|
102
102
|
}
|
|
103
|
-
return (A.find((e) =>
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
if (!e.trim()) return
|
|
103
|
+
return (A.find((e) => Le(e, t)) ?? A.find((e) => Ie(e, t)))?.value ?? null;
|
|
104
|
+
}, Mt = E !== "" && A.some((e) => e.value === E), Nt = d.useMemo(() => E ? [E] : [], [E]), V = (e) => {
|
|
105
|
+
xt(e), I(null), R(null);
|
|
106
|
+
}, H = (e) => {
|
|
107
|
+
if (!e.trim()) return V(""), null;
|
|
108
108
|
let t = u(e);
|
|
109
|
-
return Number.isNaN(t) ? "unparseable" : !k || t < D || t > O ? "out-of-range" : (
|
|
110
|
-
},
|
|
111
|
-
R(t),
|
|
112
|
-
},
|
|
109
|
+
return Number.isNaN(t) ? "unparseable" : !k || t < D || t > O ? "out-of-range" : (V(l(t)), null);
|
|
110
|
+
}, Pt = (e, t) => {
|
|
111
|
+
R(t), qe?.(e, t);
|
|
112
|
+
}, U = () => {
|
|
113
113
|
I(null), R(null);
|
|
114
|
-
},
|
|
115
|
-
open:
|
|
116
|
-
onOpenChange: (e) => e ?
|
|
114
|
+
}, W = d.useMemo(() => B ? A.some(B) : A.length > 0, [A, B]), G = P && W, K = oe({
|
|
115
|
+
open: G,
|
|
116
|
+
onOpenChange: (e) => e ? At() : z(),
|
|
117
117
|
mode: "editable",
|
|
118
|
-
selectedValues:
|
|
119
|
-
onSelect: (e) =>
|
|
118
|
+
selectedValues: Nt,
|
|
119
|
+
onSelect: (e) => V(e),
|
|
120
120
|
items: A,
|
|
121
121
|
filter: B,
|
|
122
|
-
autoHighlight: F === null &&
|
|
122
|
+
autoHighlight: F === null && Mt ? "selected" : !1,
|
|
123
123
|
idPrefix: "timepicker-listbox",
|
|
124
124
|
onClearDraft: F === null ? void 0 : () => {
|
|
125
|
-
|
|
125
|
+
U(), z();
|
|
126
126
|
}
|
|
127
|
-
}),
|
|
127
|
+
}), Ft = E ? K.getItem(E)?.label ?? h(E, g) : "", q = He && !x && E !== "", It = P && !W ? A.length === 0 ? S?.noTimes ?? "No times available" : S?.noMatches ?? "No matching times" : "", Lt = d.useRef(null), J = d.useRef(null), Rt = d.useRef(null), zt = o(yt, Lt), Bt = o(_t, J), { layerId: Vt } = le({
|
|
128
128
|
open: P,
|
|
129
129
|
onDismiss: z,
|
|
130
|
-
refs: [
|
|
131
|
-
anchorRef:
|
|
130
|
+
refs: [Rt, Lt],
|
|
131
|
+
anchorRef: J,
|
|
132
132
|
kind: "listbox",
|
|
133
133
|
focusOutside: !0
|
|
134
|
-
}), { setReference:
|
|
134
|
+
}), { setReference: Ht, setFloating: Ut, floatingProps: Wt } = ce({
|
|
135
135
|
open: P,
|
|
136
136
|
side: "bottom",
|
|
137
137
|
align: "start",
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
"aria-
|
|
145
|
-
"aria-
|
|
146
|
-
"aria-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
138
|
+
...se(Be, {
|
|
139
|
+
matchReferenceWidth: !0,
|
|
140
|
+
fitViewport: !0
|
|
141
|
+
})
|
|
142
|
+
}), Gt = o(Rt, Ut), Y = re(), Kt = (Xe ?? Y?.required ?? !1) && !x, qt = ee("timepicker-error"), X = L !== null && !Y?.hasErrorMessage, Z = ie({
|
|
143
|
+
id: ot,
|
|
144
|
+
"aria-label": C,
|
|
145
|
+
"aria-labelledby": st,
|
|
146
|
+
"aria-describedby": ne(ct, X ? qt : void 0),
|
|
147
|
+
"aria-invalid": L !== null || lt,
|
|
148
|
+
"aria-required": ut ?? Xe
|
|
149
|
+
}), Jt = be(!1, Z["aria-invalid"]);
|
|
150
|
+
xe(J, () => {
|
|
151
|
+
xt(c ?? ""), U(), z();
|
|
152
|
+
}, Ye);
|
|
153
|
+
let Yt = (e) => {
|
|
152
154
|
if (!j) return;
|
|
153
155
|
let t = e.target.value;
|
|
154
|
-
I(t), R(null), P || N(!0),
|
|
155
|
-
},
|
|
156
|
-
if (j && (
|
|
157
|
-
if (e.key === "Escape" && F === "" &&
|
|
158
|
-
e.preventDefault(),
|
|
156
|
+
I(t), R(null), P || N(!0), K.setActiveValue(jt(t));
|
|
157
|
+
}, Xt = r(ht, (e) => {
|
|
158
|
+
if (j && (K.onKeyDown(e), !(e.defaultPrevented || e.nativeEvent.isComposing))) {
|
|
159
|
+
if (e.key === "Escape" && F === "" && Ft !== "") {
|
|
160
|
+
e.preventDefault(), U(), z();
|
|
159
161
|
return;
|
|
160
162
|
}
|
|
161
163
|
if (e.key === "Enter" && F !== null) {
|
|
162
164
|
e.preventDefault();
|
|
163
|
-
let t =
|
|
164
|
-
z(), t !== null &&
|
|
165
|
+
let t = H(F);
|
|
166
|
+
z(), t !== null && Pt(F, t);
|
|
165
167
|
}
|
|
166
|
-
e.key === "Tab" && !e.shiftKey &&
|
|
168
|
+
e.key === "Tab" && !e.shiftKey && q && F !== null && !F.trim() && Me(() => H(F)), e.key === "Tab" && P && !G && z();
|
|
167
169
|
}
|
|
168
|
-
}),
|
|
169
|
-
j && !P && (
|
|
170
|
-
},
|
|
170
|
+
}), Zt = r(gt, K.onKeyUp), Qt = () => {
|
|
171
|
+
j && !P && (At(), F !== null && K.setActiveValue(jt(F)));
|
|
172
|
+
}, $t = r(mt, () => {
|
|
171
173
|
if (!j || F === null) return;
|
|
172
|
-
let e = L === null ?
|
|
173
|
-
z(), e !== null &&
|
|
174
|
-
}),
|
|
175
|
-
j && (P ? z() :
|
|
176
|
-
},
|
|
177
|
-
j && (
|
|
178
|
-
},
|
|
179
|
-
...
|
|
180
|
-
"aria-labelledby":
|
|
181
|
-
"aria-label":
|
|
174
|
+
let e = L === null ? H(F) : null;
|
|
175
|
+
z(), e !== null && Pt(F, e);
|
|
176
|
+
}), en = () => {
|
|
177
|
+
j && (P ? z() : Qt(), J.current?.focus());
|
|
178
|
+
}, tn = () => {
|
|
179
|
+
j && (V(""), J.current?.focus());
|
|
180
|
+
}, nn = ne(st, Y?.labelId), rn = (t) => /* @__PURE__ */ f("ul", {
|
|
181
|
+
...K.getListboxProps(),
|
|
182
|
+
"aria-labelledby": nn,
|
|
183
|
+
"aria-label": nn ? void 0 : C ?? S?.list ?? "Times",
|
|
182
184
|
hidden: t || void 0,
|
|
183
185
|
className: e(i.listbox, "max-h-60 min-h-0 overflow-auto py-1 focus:outline-hidden"),
|
|
184
|
-
children:
|
|
186
|
+
children: K.items.map((e) => /* @__PURE__ */ f(Ne, {
|
|
185
187
|
value: e.value,
|
|
186
188
|
label: e.label
|
|
187
189
|
}, e.value))
|
|
188
|
-
}), Q =
|
|
189
|
-
|
|
190
|
-
let
|
|
190
|
+
}), Q = Oe(Ue), $ = "";
|
|
191
|
+
X && L === "unparseable" ? $ = (S?.invalidTime ?? Pe)(g === "24h" ? "HH:mm" : "h:mm AM") : X && ($ = (S?.outOfRange ?? Fe)(s.minTime === void 0 ? void 0 : h(v, g), s.maxTime === void 0 ? void 0 : h(y, g)));
|
|
192
|
+
let an = P ? W : A.length > 0;
|
|
191
193
|
return /* @__PURE__ */ f(ae.Provider, {
|
|
192
|
-
value:
|
|
194
|
+
value: K.context,
|
|
193
195
|
children: /* @__PURE__ */ p("div", {
|
|
194
|
-
"data-size":
|
|
195
|
-
"data-appearance":
|
|
196
|
-
...
|
|
197
|
-
ref:
|
|
198
|
-
className: e(i.root, "relative inline-flex flex-col",
|
|
196
|
+
"data-size": w,
|
|
197
|
+
"data-appearance": T,
|
|
198
|
+
...bt,
|
|
199
|
+
ref: zt,
|
|
200
|
+
className: e(i.root, "relative inline-flex flex-col", vt),
|
|
199
201
|
children: [
|
|
200
202
|
/* @__PURE__ */ p("div", {
|
|
201
|
-
ref:
|
|
203
|
+
ref: Ht,
|
|
202
204
|
className: "relative flex items-center",
|
|
203
205
|
children: [
|
|
204
206
|
/* @__PURE__ */ f("input", {
|
|
205
|
-
ref:
|
|
207
|
+
ref: Bt,
|
|
206
208
|
type: "text",
|
|
207
|
-
...
|
|
208
|
-
"aria-controls":
|
|
209
|
-
...
|
|
210
|
-
"aria-errormessage":
|
|
211
|
-
"aria-details":
|
|
212
|
-
value: F ??
|
|
213
|
-
onChange:
|
|
214
|
-
onClick:
|
|
215
|
-
onFocus:
|
|
216
|
-
onBlur:
|
|
217
|
-
onKeyDown:
|
|
218
|
-
onKeyUp:
|
|
219
|
-
placeholder:
|
|
209
|
+
...K.getComboboxProps(),
|
|
210
|
+
"aria-controls": an ? K.listboxId : void 0,
|
|
211
|
+
...Z,
|
|
212
|
+
"aria-errormessage": dt,
|
|
213
|
+
"aria-details": ft,
|
|
214
|
+
value: F ?? Ft,
|
|
215
|
+
onChange: Yt,
|
|
216
|
+
onClick: Qt,
|
|
217
|
+
onFocus: pt,
|
|
218
|
+
onBlur: $t,
|
|
219
|
+
onKeyDown: Xt,
|
|
220
|
+
onKeyUp: Zt,
|
|
221
|
+
placeholder: Re,
|
|
220
222
|
disabled: b,
|
|
221
223
|
readOnly: x,
|
|
222
|
-
autoComplete:
|
|
223
|
-
autoCapitalize:
|
|
224
|
-
autoCorrect:
|
|
225
|
-
maxLength:
|
|
226
|
-
enterKeyHint:
|
|
227
|
-
inputMode:
|
|
228
|
-
spellCheck:
|
|
229
|
-
autoFocus:
|
|
230
|
-
tabIndex:
|
|
231
|
-
className: e(i.input,
|
|
224
|
+
autoComplete: Ze,
|
|
225
|
+
autoCapitalize: Qe,
|
|
226
|
+
autoCorrect: $e,
|
|
227
|
+
maxLength: et,
|
|
228
|
+
enterKeyHint: tt,
|
|
229
|
+
inputMode: nt,
|
|
230
|
+
spellCheck: rt,
|
|
231
|
+
autoFocus: it,
|
|
232
|
+
tabIndex: at,
|
|
233
|
+
className: e(i.input, me[w], "w-full", he[w], ge[w], fe[T], "text-foreground placeholder:text-muted-foreground", pe, ue, Jt && "border-destructive", we(Number(q) + Number(Q), w))
|
|
232
234
|
}),
|
|
233
|
-
|
|
235
|
+
q && /* @__PURE__ */ f("button", {
|
|
234
236
|
type: "button",
|
|
235
237
|
"aria-label": S?.clear ?? "Clear time",
|
|
236
238
|
disabled: b,
|
|
237
239
|
onMouseDown: (e) => e.preventDefault(),
|
|
238
|
-
onClick:
|
|
239
|
-
className: e(i.clearButton,
|
|
240
|
-
children: /* @__PURE__ */ f(
|
|
240
|
+
onClick: tn,
|
|
241
|
+
className: e(i.clearButton, Ee(w, T), Ce(w, Q ? 2 : 1), "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"),
|
|
242
|
+
children: /* @__PURE__ */ f(ve, { size: Te(w, "icon") })
|
|
241
243
|
}),
|
|
242
|
-
Q && /* @__PURE__ */ f(
|
|
244
|
+
Q && /* @__PURE__ */ f(De, {
|
|
243
245
|
component: "TimePicker",
|
|
244
|
-
expandIcon:
|
|
246
|
+
expandIcon: Ue,
|
|
245
247
|
label: S?.expand ?? "Show times",
|
|
246
|
-
expanded:
|
|
247
|
-
listboxId:
|
|
248
|
+
expanded: G,
|
|
249
|
+
listboxId: K.listboxId,
|
|
248
250
|
disabled: b || !!x,
|
|
249
|
-
onToggle:
|
|
250
|
-
size:
|
|
251
|
-
appearance:
|
|
251
|
+
onToggle: en,
|
|
252
|
+
size: w,
|
|
253
|
+
appearance: T,
|
|
252
254
|
className: i.expandButton,
|
|
253
255
|
iconClassName: i.expandIcon
|
|
254
256
|
})
|
|
255
257
|
]
|
|
256
258
|
}),
|
|
257
|
-
|
|
258
|
-
id:
|
|
259
|
+
X && /* @__PURE__ */ f("p", {
|
|
260
|
+
id: qt,
|
|
259
261
|
role: "alert",
|
|
260
262
|
className: e(i.errorMessage, "mt-1 text-caption-1 text-error"),
|
|
261
263
|
children: $
|
|
262
264
|
}),
|
|
263
|
-
!P && A.length > 0 &&
|
|
265
|
+
!P && A.length > 0 && rn(!0),
|
|
264
266
|
/* @__PURE__ */ f("span", {
|
|
265
267
|
role: "status",
|
|
266
268
|
className: "sr-only",
|
|
267
|
-
children:
|
|
269
|
+
children: It
|
|
268
270
|
}),
|
|
269
|
-
/* @__PURE__ */ f(
|
|
270
|
-
name:
|
|
271
|
-
form:
|
|
271
|
+
/* @__PURE__ */ f(Se, {
|
|
272
|
+
name: Je,
|
|
273
|
+
form: Ye,
|
|
272
274
|
disabled: b,
|
|
273
|
-
value:
|
|
275
|
+
value: E,
|
|
274
276
|
type: "text",
|
|
275
|
-
required:
|
|
276
|
-
onInvalid: () =>
|
|
277
|
+
required: Kt,
|
|
278
|
+
onInvalid: () => J.current?.focus()
|
|
277
279
|
}),
|
|
278
|
-
P && /* @__PURE__ */ f(
|
|
279
|
-
layerId:
|
|
280
|
+
P && /* @__PURE__ */ f(_e, {
|
|
281
|
+
layerId: Vt,
|
|
280
282
|
children: /* @__PURE__ */ f("div", {
|
|
281
|
-
ref:
|
|
282
|
-
...
|
|
283
|
+
ref: Gt,
|
|
284
|
+
...Wt,
|
|
283
285
|
"data-state": "open",
|
|
284
286
|
className: e(i.surface, "flex flex-col overflow-hidden rounded border border-border bg-background shadow-8"),
|
|
285
|
-
children:
|
|
287
|
+
children: W ? rn(!1) : /* @__PURE__ */ f("div", {
|
|
286
288
|
"aria-hidden": "true",
|
|
287
289
|
className: e(i.emptyMessage, "px-3 py-1.5 text-body-1 text-muted-foreground"),
|
|
288
|
-
children:
|
|
290
|
+
children: It
|
|
289
291
|
})
|
|
290
292
|
})
|
|
291
293
|
})
|