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