@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
|
@@ -9,278 +9,283 @@ import { useMergedRefs as o } from "../../hooks/useMergedRefs.mjs";
|
|
|
9
9
|
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
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import {
|
|
12
|
+
import { ListboxContext as ae, useListbox as oe, useListboxOption as s } from "../../hooks/useListbox.mjs";
|
|
13
|
+
import { useDismiss as se } from "../../hooks/useDismiss.mjs";
|
|
14
|
+
import { Portal as ce } from "../portal/Portal.mjs";
|
|
15
|
+
import { disabledStyles as le, forcedColors as ue, inputAppearanceClasses as de, inputFocus as fe, inputHeightClasses as pe, inputPaddingClasses as me, inputTextClasses as he } from "../../lib/styles.mjs";
|
|
16
|
+
import { CheckIcon as c, DismissIcon as ge } from "../../lib/icons.mjs";
|
|
17
|
+
import { useInputLook as _e } from "./inputLook.mjs";
|
|
18
|
+
import { isInvalidLook as ve } from "./Input.mjs";
|
|
19
|
+
import { useFormReset as ye } from "../../hooks/useFormReset.mjs";
|
|
20
|
+
import { HiddenInput as be } from "../internal/HiddenInput.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 } = s({
|
|
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 && ue.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(c, { 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: ue, 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 } = _e(Re, ze), [T, E] = a(ue, 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]), V = (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
|
-
|
|
105
|
-
},
|
|
106
|
-
if (!e.trim()) return
|
|
107
|
-
let t =
|
|
108
|
-
return Number.isNaN(t) ? "unparseable" : !
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
open:
|
|
115
|
-
onOpenChange: (e) => e ?
|
|
103
|
+
return (A.find((e) => Ie(e, t)) ?? A.find((e) => Fe(e, t)))?.value ?? null;
|
|
104
|
+
}, kt = T !== "" && A.some((e) => e.value === T), At = d.useMemo(() => T ? [T] : [], [T]), H = (e) => {
|
|
105
|
+
E(e), I(null), R(null);
|
|
106
|
+
}, U = (e) => {
|
|
107
|
+
if (!e.trim()) return H(""), null;
|
|
108
|
+
let t = u(e);
|
|
109
|
+
return Number.isNaN(t) ? "unparseable" : !k || t < D || t > O ? "out-of-range" : (H(l(t)), null);
|
|
110
|
+
}, jt = (e, t) => {
|
|
111
|
+
R(t), Ge?.(e, t);
|
|
112
|
+
}, W = () => {
|
|
113
|
+
I(null), R(null);
|
|
114
|
+
}, G = d.useMemo(() => B ? A.some(B) : A.length > 0, [A, B]), K = P && G, q = oe({
|
|
115
|
+
open: K,
|
|
116
|
+
onOpenChange: (e) => e ? Ot() : z(),
|
|
116
117
|
mode: "editable",
|
|
117
|
-
selectedValues:
|
|
118
|
-
onSelect: (e) =>
|
|
119
|
-
items:
|
|
120
|
-
filter:
|
|
121
|
-
autoHighlight:
|
|
118
|
+
selectedValues: At,
|
|
119
|
+
onSelect: (e) => H(e),
|
|
120
|
+
items: A,
|
|
121
|
+
filter: B,
|
|
122
|
+
autoHighlight: F === null && kt ? "selected" : !1,
|
|
122
123
|
idPrefix: "timepicker-listbox",
|
|
123
|
-
onClearDraft:
|
|
124
|
-
|
|
124
|
+
onClearDraft: F === null ? void 0 : () => {
|
|
125
|
+
W(), z();
|
|
125
126
|
}
|
|
126
|
-
}),
|
|
127
|
-
open:
|
|
128
|
-
onDismiss:
|
|
129
|
-
refs: [
|
|
130
|
-
anchorRef:
|
|
127
|
+
}), Mt = T ? q.getItem(T)?.label ?? h(T, g) : "", J = Be && !x && T !== "", Nt = P && !G ? A.length === 0 ? S?.noTimes ?? "No times available" : S?.noMatches ?? "No matching times" : "", Pt = d.useRef(null), Y = d.useRef(null), Ft = d.useRef(null), It = o(vt, Pt), Lt = o(gt, Y), { layerId: Rt } = se({
|
|
128
|
+
open: P,
|
|
129
|
+
onDismiss: z,
|
|
130
|
+
refs: [Ft, Pt],
|
|
131
|
+
anchorRef: Y,
|
|
131
132
|
kind: "listbox",
|
|
132
133
|
focusOutside: !0
|
|
133
|
-
}), { setReference:
|
|
134
|
-
open:
|
|
134
|
+
}), { setReference: zt, setFloating: Bt, floatingProps: Vt } = 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
|
+
}), Ht = o(Ft, Bt), X = re(), Ut = (Je ?? X?.required ?? !1) && !x, Wt = ee("timepicker-error"), Z = L !== null && !X?.hasErrorMessage, Gt = ie({
|
|
141
|
+
id: it,
|
|
142
|
+
"aria-label": at,
|
|
143
|
+
"aria-labelledby": ot,
|
|
144
|
+
"aria-describedby": ne(st, Z ? Wt : void 0),
|
|
145
|
+
"aria-invalid": L !== null || ct,
|
|
146
|
+
"aria-required": lt ?? Je
|
|
147
|
+
}), Kt = ve(!1, Gt["aria-invalid"]);
|
|
148
|
+
ye(Y, () => {
|
|
149
|
+
E(c ?? ""), W(), 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(),
|
|
154
|
+
I(t), R(null), P || N(!0), q.setActiveValue(V(t));
|
|
155
|
+
}, Jt = r(mt, (e) => {
|
|
156
|
+
if (j && (q.onKeyDown(e), !(e.defaultPrevented || e.nativeEvent.isComposing))) {
|
|
157
|
+
if (e.key === "Escape" && F === "" && Mt !== "") {
|
|
158
|
+
e.preventDefault(), W(), 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 =
|
|
163
|
-
|
|
163
|
+
let t = U(F);
|
|
164
|
+
z(), t !== null && jt(F, t);
|
|
164
165
|
}
|
|
165
|
-
e.key === "Tab" && !e.shiftKey &&
|
|
166
|
+
e.key === "Tab" && !e.shiftKey && J && F !== null && !F.trim() && je(() => U(F)), e.key === "Tab" && P && !K && z();
|
|
166
167
|
}
|
|
167
|
-
}),
|
|
168
|
-
|
|
169
|
-
},
|
|
170
|
-
if (!
|
|
171
|
-
let e =
|
|
172
|
-
|
|
173
|
-
}),
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
},
|
|
178
|
-
...
|
|
179
|
-
"aria-labelledby":
|
|
180
|
-
"aria-label":
|
|
168
|
+
}), Yt = r(ht, q.onKeyUp), Xt = () => {
|
|
169
|
+
j && !P && (Ot(), F !== null && q.setActiveValue(V(F)));
|
|
170
|
+
}, Zt = r(pt, () => {
|
|
171
|
+
if (!j || F === null) return;
|
|
172
|
+
let e = L === null ? U(F) : null;
|
|
173
|
+
z(), e !== null && jt(F, e);
|
|
174
|
+
}), Qt = () => {
|
|
175
|
+
j && (P ? z() : Xt(), Y.current?.focus());
|
|
176
|
+
}, $t = () => {
|
|
177
|
+
j && (H(""), Y.current?.focus());
|
|
178
|
+
}, en = ne(ot, X?.labelId), tn = (t) => /* @__PURE__ */ f("ul", {
|
|
179
|
+
...q.getListboxProps(),
|
|
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:
|
|
184
|
+
children: q.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__ */
|
|
191
|
-
value:
|
|
192
|
-
children: /* @__PURE__ */
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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 ? G : A.length > 0;
|
|
191
|
+
return /* @__PURE__ */ f(ae.Provider, {
|
|
192
|
+
value: q.context,
|
|
193
|
+
children: /* @__PURE__ */ p("div", {
|
|
194
|
+
"data-size": C,
|
|
195
|
+
"data-appearance": w,
|
|
196
|
+
...yt,
|
|
197
|
+
ref: It,
|
|
198
|
+
className: e(i.root, "relative inline-flex flex-col", _t),
|
|
196
199
|
children: [
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
ref:
|
|
200
|
+
/* @__PURE__ */ p("div", {
|
|
201
|
+
ref: zt,
|
|
199
202
|
className: "relative flex items-center",
|
|
200
203
|
children: [
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
ref:
|
|
204
|
+
/* @__PURE__ */ f("input", {
|
|
205
|
+
ref: Lt,
|
|
203
206
|
type: "text",
|
|
204
|
-
...
|
|
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,
|
|
207
|
+
...q.getComboboxProps(),
|
|
208
|
+
"aria-controls": nn ? q.listboxId : void 0,
|
|
209
|
+
...Gt,
|
|
210
|
+
"aria-errormessage": ut,
|
|
211
|
+
"aria-details": dt,
|
|
212
|
+
value: F ?? Mt,
|
|
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, pe[C], "w-full", me[C], he[C], de[w], "text-foreground placeholder:text-muted-foreground", fe, le, Kt && "border-destructive", Se(Number(J) + Number(Q), C))
|
|
229
232
|
}),
|
|
230
|
-
|
|
233
|
+
J && /* @__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(ge, { size: Ce(C, "icon") })
|
|
238
241
|
}),
|
|
239
|
-
Q && /* @__PURE__ */
|
|
242
|
+
Q && /* @__PURE__ */ f(Te, {
|
|
240
243
|
component: "TimePicker",
|
|
241
|
-
expandIcon:
|
|
242
|
-
label:
|
|
243
|
-
expanded:
|
|
244
|
-
listboxId:
|
|
245
|
-
disabled:
|
|
246
|
-
onToggle:
|
|
244
|
+
expandIcon: Ve,
|
|
245
|
+
label: S?.expand ?? "Show times",
|
|
246
|
+
expanded: K,
|
|
247
|
+
listboxId: q.listboxId,
|
|
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__ */
|
|
253
|
-
id:
|
|
257
|
+
Z && /* @__PURE__ */ f("p", {
|
|
258
|
+
id: Wt,
|
|
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: Nt
|
|
263
268
|
}),
|
|
264
|
-
/* @__PURE__ */
|
|
265
|
-
name:
|
|
266
|
-
form:
|
|
267
|
-
disabled:
|
|
268
|
-
value:
|
|
269
|
+
/* @__PURE__ */ f(be, {
|
|
270
|
+
name: Ke,
|
|
271
|
+
form: qe,
|
|
272
|
+
disabled: b,
|
|
273
|
+
value: T,
|
|
269
274
|
type: "text",
|
|
270
|
-
required:
|
|
271
|
-
onInvalid: () =>
|
|
275
|
+
required: Ut,
|
|
276
|
+
onInvalid: () => Y.current?.focus()
|
|
272
277
|
}),
|
|
273
|
-
|
|
274
|
-
layerId:
|
|
275
|
-
children: /* @__PURE__ */
|
|
276
|
-
ref:
|
|
277
|
-
...
|
|
278
|
+
P && /* @__PURE__ */ f(ce, {
|
|
279
|
+
layerId: Rt,
|
|
280
|
+
children: /* @__PURE__ */ f("div", {
|
|
281
|
+
ref: Ht,
|
|
282
|
+
...Vt,
|
|
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:
|
|
285
|
+
children: G ? 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: Nt
|
|
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
|