asma-ui-core 3.86.0 → 3.86.2
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/dist/asma-ui-core.css +1 -1
- package/dist/components/data-display/chip/StyledChip.js +28 -27
- package/dist/components/data-display/tooltip/StyledTooltip.js +76 -47
- package/dist/components/feedback/dialog/StyledDialog.js +62 -58
- package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +113 -105
- package/dist/components/feedback/minimizable-dialog/components/FullscreenBtn.js +10 -12
- package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +75 -67
- package/dist/components/feedback/snack-bar/StyledSnackbar.js +12 -10
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +69 -71
- package/dist/components/inputs/input-field/StyledInputField.js +10 -9
- package/dist/components/inputs/phone-field/CountryCodeOptions.js +16 -15
- package/dist/components/inputs/phone-field/CountryCodeSelect.js +98 -85
- package/dist/components/inputs/phone-field/useCountryPicker.js +44 -24
- package/dist/components/inputs/select/StyledSelect.js +15 -14
- package/dist/components/inputs/select/StyledSelectItem.js +4 -4
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +199 -172
- package/dist/components/inputs/slider/StyledSlider.js +158 -107
- package/dist/components/navigation/listbox/Listbox.js +104 -54
- package/dist/components/navigation/menu/StyledMenu.js +22 -18
- package/dist/components/navigation/menu/StyledMenuItem.js +6 -6
- package/dist/components/utils/accordion/base-ui/StyledAccordionDetails.js +26 -22
- package/dist/components/utils/copy-wrapper/CopyWrapper.module.js +2 -2
- package/dist/components/utils/popover/StyledPopover.js +102 -52
- package/dist/datetime/components/date-picker/StyledDatePicker.js +40 -34
- package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +5 -4
- package/dist/datetime/components/time-picker/StyledTimePicker.js +69 -56
- package/dist/helpers/focusable.js +5 -0
- package/dist/hooks/useFocusTrap.hook.js +24 -19
- package/dist/src/components/data-display/chip/StyledChip.d.ts +2 -0
- package/dist/src/components/inputs/dynamic-select/StyledDynamicSelect.d.ts +3 -4
- package/dist/src/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.test.d.ts +1 -0
- package/dist/src/components/inputs/phone-field/CountryCodeOptions.d.ts +1 -1
- package/dist/src/components/inputs/phone-field/useCountryPicker.d.ts +5 -2
- package/dist/src/components/inputs/slider/StyledSlider.d.ts +4 -1
- package/dist/src/components/navigation/listbox/Listbox.d.ts +3 -2
- package/dist/src/components/navigation/menu/StyledMenu.d.ts +3 -2
- package/dist/src/components/utils/accordion/base-ui/StyledAccordionDetails.d.ts +2 -1
- package/dist/src/components/utils/popover/StyledPopover.d.ts +9 -2
- package/dist/src/helpers/focusable.d.ts +8 -0
- package/dist/src/hooks/useFocusTrap.hook.d.ts +2 -1
- package/dist/table/components/columns/action-column/components/RowActionMenu.js +30 -34
- package/dist/table/components/table-footer/TablePagination.js +18 -17
- package/dist/table/components/table-footer/TableRowCountSelect.js +5 -4
- package/package.json +1 -1
|
@@ -1,74 +1,124 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { resolveSx as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { cn as Y } from "../../../helpers/cn.js";
|
|
2
|
+
import { resolveSx as R } from "../../../helpers/sx.js";
|
|
3
|
+
import { tabbableWithin as y } from "../../../helpers/focusable.js";
|
|
4
|
+
import { TOP_LAYER_PROPS as W, TOP_LAYER_RESET_STYLE as $, getOpenModalDialogAncestor as j, shouldUsePopoverTopLayer as q, useTopLayerRef as B } from "../../../hooks/useTopLayer.hook.js";
|
|
5
|
+
import { useEffect as P, useMemo as G, useRef as J, useState as h } from "react";
|
|
6
|
+
import { jsx as T } from "react/jsx-runtime";
|
|
7
|
+
import { FloatingPortal as Q, autoUpdate as V, flip as X, offset as Z, shift as C, useDismiss as ee, useFloating as te, useInteractions as oe, useMergeRefs as ne } from "@floating-ui/react";
|
|
8
|
+
var re = {
|
|
8
9
|
vertical: "bottom",
|
|
9
10
|
horizontal: "left"
|
|
10
|
-
},
|
|
11
|
+
}, se = {
|
|
11
12
|
vertical: "top",
|
|
12
13
|
horizontal: "left"
|
|
13
|
-
},
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const { refs:
|
|
19
|
-
open:
|
|
20
|
-
placement:
|
|
14
|
+
}, ie = (o, t) => `${t.vertical === "bottom" ? "top" : t.vertical === "top" ? "bottom" : o.vertical === "top" ? "top" : "bottom"}${o.horizontal === "left" ? "-start" : o.horizontal === "right" ? "-end" : ""}`, ve = ({ open: o, anchorEl: t, onClose: u, anchorOrigin: b = re, transformOrigin: L = se, id: x, className: D, sx: K, slotProps: l, onClick: S, children: _, keepMounted: E = !1, tabIntoContent: d = !0 }) => {
|
|
15
|
+
const F = G(() => ie(b, L), [b, L]), [w, O] = h(o), c = J(!1);
|
|
16
|
+
o && !w && O(!0);
|
|
17
|
+
const m = o || E && w, p = j(t), [v, k] = h(p);
|
|
18
|
+
t && v !== p && k(p);
|
|
19
|
+
const { refs: a, floatingStyles: M, context: A } = te({
|
|
20
|
+
open: o,
|
|
21
|
+
placement: F,
|
|
21
22
|
strategy: "fixed",
|
|
22
|
-
whileElementsMounted:
|
|
23
|
-
elements: { reference:
|
|
23
|
+
whileElementsMounted: V,
|
|
24
|
+
elements: { reference: t ?? void 0 },
|
|
24
25
|
middleware: [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
Z(4),
|
|
27
|
+
X({ padding: 8 }),
|
|
28
|
+
C({ padding: 8 })
|
|
28
29
|
],
|
|
29
|
-
onOpenChange: (
|
|
30
|
-
|
|
30
|
+
onOpenChange: (e, r, n) => {
|
|
31
|
+
e || u?.(r ?? {}, n === "escape-key" ? "escapeKeyDown" : "backdropClick");
|
|
31
32
|
}
|
|
32
|
-
}), { getFloatingProps:
|
|
33
|
-
outsidePress: (
|
|
34
|
-
const
|
|
35
|
-
return !(
|
|
33
|
+
}), { getFloatingProps: N } = oe([ee(A, {
|
|
34
|
+
outsidePress: (e) => {
|
|
35
|
+
const r = e.target;
|
|
36
|
+
return !(t instanceof Element && r instanceof Node && t.contains(r));
|
|
36
37
|
},
|
|
37
38
|
escapeKey: !0
|
|
38
|
-
})]),
|
|
39
|
-
|
|
40
|
-
if (!
|
|
41
|
-
const t =
|
|
42
|
-
|
|
39
|
+
})]), f = q(v), z = ne([B(a.setFloating, f)]);
|
|
40
|
+
P(() => {
|
|
41
|
+
if (!o) return;
|
|
42
|
+
const e = t instanceof HTMLElement ? t : null, r = () => a.floating.current?.contains(document.activeElement) ?? !1;
|
|
43
|
+
let n = r();
|
|
44
|
+
const s = () => {
|
|
45
|
+
n = r();
|
|
46
|
+
};
|
|
47
|
+
return document.addEventListener("focusin", s), () => {
|
|
48
|
+
document.removeEventListener("focusin", s);
|
|
49
|
+
const i = document.activeElement, g = !i || i === document.body || r();
|
|
50
|
+
n && g && e?.isConnected && e.focus({ preventScroll: !0 });
|
|
51
|
+
};
|
|
52
|
+
}, [
|
|
53
|
+
o,
|
|
54
|
+
t,
|
|
55
|
+
a.floating
|
|
56
|
+
]), P(() => {
|
|
57
|
+
if (!o) return;
|
|
58
|
+
const e = (n) => {
|
|
59
|
+
if (c.current = n.key === "Tab", !d || !c.current || n.shiftKey || n.defaultPrevented) return;
|
|
60
|
+
const s = a.floating.current;
|
|
61
|
+
if (!s || !(t instanceof Element) || !t.contains(document.activeElement)) return;
|
|
62
|
+
const [i] = y(s);
|
|
63
|
+
i && (n.preventDefault(), i.focus({ preventScroll: !0 }), c.current = !1);
|
|
64
|
+
}, r = (n) => {
|
|
65
|
+
const s = n.target, i = s instanceof Node && ((a.floating.current?.contains(s) ?? !1) || t instanceof Element && t.contains(s));
|
|
66
|
+
c.current && !i && u?.(n, "tabKeyDown"), c.current = !1;
|
|
67
|
+
};
|
|
68
|
+
return document.addEventListener("keydown", e, !0), document.addEventListener("focusin", r), () => {
|
|
69
|
+
document.removeEventListener("keydown", e, !0), document.removeEventListener("focusin", r);
|
|
70
|
+
};
|
|
71
|
+
}, [
|
|
72
|
+
o,
|
|
73
|
+
t,
|
|
74
|
+
u,
|
|
75
|
+
a.floating,
|
|
76
|
+
d
|
|
77
|
+
]);
|
|
78
|
+
const H = o ? N({
|
|
79
|
+
onClick: S,
|
|
80
|
+
onKeyDown: (e) => {
|
|
81
|
+
if (e.key !== "Tab" || e.defaultPrevented || !(t instanceof HTMLElement)) return;
|
|
82
|
+
const r = e.currentTarget, n = y(r), s = n.indexOf(document.activeElement);
|
|
83
|
+
if (s === -1 || (e.shiftKey ? s !== 0 : s !== n.length - 1)) return;
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
const i = y(document).filter((I) => !r.contains(I)), g = i[i.indexOf(t) + (e.shiftKey ? -1 : 1)], U = (d && e.shiftKey ? void 0 : g) ?? t;
|
|
86
|
+
c.current = !1, U.focus({ preventScroll: !0 }), u?.(e, "tabKeyDown");
|
|
87
|
+
}
|
|
88
|
+
}) : {};
|
|
89
|
+
return P(() => {
|
|
90
|
+
if (!m || !f) return;
|
|
91
|
+
const e = a.floating.current;
|
|
92
|
+
if (!(!e || typeof e.showPopover != "function"))
|
|
43
93
|
try {
|
|
44
|
-
|
|
94
|
+
o && !e.matches(":popover-open") && e.showPopover(), !o && e.matches(":popover-open") && e.hidePopover();
|
|
45
95
|
} catch {
|
|
46
96
|
}
|
|
47
97
|
}, [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
]),
|
|
53
|
-
root:
|
|
54
|
-
children: /* @__PURE__ */
|
|
55
|
-
ref:
|
|
56
|
-
id:
|
|
57
|
-
...
|
|
98
|
+
o,
|
|
99
|
+
m,
|
|
100
|
+
f,
|
|
101
|
+
a.floating
|
|
102
|
+
]), m ? /* @__PURE__ */ T(Q, {
|
|
103
|
+
root: v,
|
|
104
|
+
children: /* @__PURE__ */ T("div", {
|
|
105
|
+
ref: z,
|
|
106
|
+
id: x,
|
|
107
|
+
...f ? W : {},
|
|
58
108
|
style: {
|
|
59
|
-
...
|
|
60
|
-
...
|
|
61
|
-
...
|
|
62
|
-
...
|
|
63
|
-
...
|
|
64
|
-
...
|
|
109
|
+
...f ? $ : {},
|
|
110
|
+
...o ? M : {},
|
|
111
|
+
...R(K),
|
|
112
|
+
...R(l?.paper?.sx),
|
|
113
|
+
...l?.paper?.style,
|
|
114
|
+
...o ? null : { display: "none" }
|
|
65
115
|
},
|
|
66
|
-
...
|
|
67
|
-
className:
|
|
116
|
+
...H,
|
|
117
|
+
className: Y("z-[1300] overflow-auto rounded bg-white shadow-[0px_1px_12px_0px_rgba(0,0,0,0.15)]", D ?? "my-1", l?.paper?.className),
|
|
68
118
|
children: _
|
|
69
119
|
})
|
|
70
120
|
}) : null;
|
|
71
121
|
};
|
|
72
122
|
export {
|
|
73
|
-
|
|
123
|
+
ve as StyledPopover
|
|
74
124
|
};
|
|
@@ -1,54 +1,60 @@
|
|
|
1
|
-
import { setPickerPosition as
|
|
1
|
+
import { setPickerPosition as P } from "./helpers.js";
|
|
2
2
|
import { StyledDayPicker as k } from "./components/StyledDayPicker.js";
|
|
3
|
-
import { StyledCalendarPicker as
|
|
4
|
-
import { DatePickerInputIndex as
|
|
5
|
-
import { useIsMobileView as
|
|
6
|
-
import { StyledDrawer as
|
|
7
|
-
import { useBackNavigationClose as
|
|
8
|
-
import { useState as a } from "react";
|
|
9
|
-
import { Fragment as
|
|
10
|
-
var
|
|
11
|
-
const s =
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
|
|
3
|
+
import { StyledCalendarPicker as v } from "./components/StyledCalendarPicker.js";
|
|
4
|
+
import { DatePickerInputIndex as y } from "./components/DatePickerInputIndex.js";
|
|
5
|
+
import { useIsMobileView as x } from "../../hooks/useWindowWidthSize.hook.js";
|
|
6
|
+
import { StyledDrawer as b } from "../../../components/navigation/drawer/StyledDrawer.js";
|
|
7
|
+
import { useBackNavigationClose as h } from "../../hooks/useBackNavigationClose.hook.js";
|
|
8
|
+
import { useEffect as C, useState as a } from "react";
|
|
9
|
+
import { Fragment as E, jsx as t, jsxs as w } from "react/jsx-runtime";
|
|
10
|
+
var L = (m) => {
|
|
11
|
+
const s = x(), [e, i] = a(null), [p, d] = a(!1), [f, c] = a(!1), u = (r) => {
|
|
12
|
+
i(r.currentTarget), P(r, d);
|
|
13
|
+
}, o = () => {
|
|
14
|
+
c(!0), i(null);
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
C(() => {
|
|
17
|
+
if (!e) return;
|
|
18
|
+
const r = (l) => {
|
|
19
|
+
document.activeElement === e && (l.key === "Escape" || l.key === "Tab") && o();
|
|
20
|
+
};
|
|
21
|
+
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
22
|
+
}, [e]), h({
|
|
17
23
|
open: !!e,
|
|
18
|
-
onClose:
|
|
24
|
+
onClose: o
|
|
19
25
|
});
|
|
20
|
-
const
|
|
21
|
-
...
|
|
22
|
-
validateOnCalendarClose:
|
|
23
|
-
onValidatedOnce: () =>
|
|
26
|
+
const n = {
|
|
27
|
+
...m,
|
|
28
|
+
validateOnCalendarClose: f,
|
|
29
|
+
onValidatedOnce: () => c(!1)
|
|
24
30
|
};
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
datePickerProps:
|
|
28
|
-
onClick:
|
|
31
|
+
return /* @__PURE__ */ w(E, { children: [
|
|
32
|
+
/* @__PURE__ */ t(y, {
|
|
33
|
+
datePickerProps: n,
|
|
34
|
+
onClick: u
|
|
29
35
|
}),
|
|
30
|
-
!s && /* @__PURE__ */
|
|
31
|
-
datePickerProps: { ...
|
|
36
|
+
!s && /* @__PURE__ */ t(v, {
|
|
37
|
+
datePickerProps: { ...n },
|
|
32
38
|
popoverProps: {
|
|
33
39
|
open: !!e,
|
|
34
40
|
anchorEl: e,
|
|
35
|
-
onClose:
|
|
41
|
+
onClose: o
|
|
36
42
|
},
|
|
37
|
-
positionAbove:
|
|
43
|
+
positionAbove: p
|
|
38
44
|
}),
|
|
39
|
-
s && /* @__PURE__ */
|
|
45
|
+
s && /* @__PURE__ */ t(b, {
|
|
40
46
|
anchor: "bottom",
|
|
41
47
|
open: !!e,
|
|
42
|
-
onClose:
|
|
48
|
+
onClose: o,
|
|
43
49
|
anchorEl: e,
|
|
44
|
-
children: /* @__PURE__ */
|
|
50
|
+
children: /* @__PURE__ */ t("div", {
|
|
45
51
|
className: "mx-auto max-w-[360px] px-2 pb-[max(1.5rem,env(safe-area-inset-bottom))]",
|
|
46
|
-
children: /* @__PURE__ */
|
|
47
|
-
datePickerProps: { ...
|
|
52
|
+
children: /* @__PURE__ */ t(k, {
|
|
53
|
+
datePickerProps: { ...n },
|
|
48
54
|
popoverProps: {
|
|
49
55
|
open: !!e,
|
|
50
56
|
anchorEl: e,
|
|
51
|
-
onClose:
|
|
57
|
+
onClose: o
|
|
52
58
|
}
|
|
53
59
|
})
|
|
54
60
|
})
|
|
@@ -56,5 +62,5 @@ var E = (p) => {
|
|
|
56
62
|
] });
|
|
57
63
|
};
|
|
58
64
|
export {
|
|
59
|
-
|
|
65
|
+
L as StyledDatePicker
|
|
60
66
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { StyledPopover as
|
|
1
|
+
import { StyledPopover as i } from "../../../../components/utils/popover/StyledPopover.js";
|
|
2
2
|
import { StyledDayPicker as c } from "./StyledDayPicker.js";
|
|
3
3
|
import { jsx as r } from "react/jsx-runtime";
|
|
4
4
|
var h = ({ datePickerProps: e, popoverProps: t, positionAbove: o }) => {
|
|
5
|
-
const { open: l, anchorEl:
|
|
6
|
-
return /* @__PURE__ */ r(
|
|
5
|
+
const { open: l, anchorEl: n, onClose: a } = t;
|
|
6
|
+
return /* @__PURE__ */ r(i, {
|
|
7
7
|
open: l,
|
|
8
|
-
anchorEl:
|
|
8
|
+
anchorEl: n,
|
|
9
9
|
onClose: a,
|
|
10
|
+
tabIntoContent: !1,
|
|
10
11
|
anchorOrigin: {
|
|
11
12
|
vertical: o ? "top" : 50,
|
|
12
13
|
horizontal: "left"
|
|
@@ -1,90 +1,103 @@
|
|
|
1
|
-
import { useIsMobileView as
|
|
2
|
-
import { StyledDrawer as
|
|
1
|
+
import { useIsMobileView as O } from "../../hooks/useWindowWidthSize.hook.js";
|
|
2
|
+
import { StyledDrawer as D } from "../../../components/navigation/drawer/StyledDrawer.js";
|
|
3
3
|
import { useBackNavigationClose as I } from "../../hooks/useBackNavigationClose.hook.js";
|
|
4
4
|
import { usePopupState as j } from "../../../hooks/usePopupState.js";
|
|
5
|
-
import { ClickAwayListener as
|
|
6
|
-
import { TimePickerPanel as
|
|
7
|
-
import { TimePickerPopper as
|
|
5
|
+
import { ClickAwayListener as A } from "../../../components/mui-compat/ClickAwayListener.js";
|
|
6
|
+
import { TimePickerPanel as B } from "./components/TimePickerPanel.js";
|
|
7
|
+
import { TimePickerPopper as M } from "./TimePickerPopper.js";
|
|
8
8
|
import { getTimeFromValue as S } from "./helpers/getTimeFromValue.js";
|
|
9
|
-
import { TimePickerInput as
|
|
10
|
-
import { useState as
|
|
11
|
-
import { jsx as o, jsxs as
|
|
12
|
-
import { format as
|
|
13
|
-
var
|
|
14
|
-
const { value: a, onSelect: r, notBeforeTime:
|
|
9
|
+
import { TimePickerInput as F } from "./TimePickerInput.js";
|
|
10
|
+
import { useEffect as K, useState as v } from "react";
|
|
11
|
+
import { jsx as o, jsxs as C } from "react/jsx-runtime";
|
|
12
|
+
import { format as y, isBefore as q, isValid as z } from "date-fns";
|
|
13
|
+
var te = (n) => {
|
|
14
|
+
const { value: a, onSelect: r, notBeforeTime: u } = n, t = j({
|
|
15
15
|
variant: "popper",
|
|
16
16
|
popupId: "time-picker-popper"
|
|
17
|
-
}),
|
|
17
|
+
}), c = O();
|
|
18
18
|
I({
|
|
19
|
-
open:
|
|
20
|
-
onClose:
|
|
19
|
+
open: c && t.isOpen,
|
|
20
|
+
onClose: t.close
|
|
21
21
|
});
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
|
|
22
|
+
const { isOpen: k, anchorEl: V, close: w } = t;
|
|
23
|
+
K(() => {
|
|
24
|
+
if (!k || c) return;
|
|
25
|
+
const e = (i) => {
|
|
26
|
+
V?.contains(document.activeElement) && (i.key === "Escape" || i.key === "Tab") && w();
|
|
27
|
+
};
|
|
28
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
29
|
+
}, [
|
|
30
|
+
k,
|
|
31
|
+
V,
|
|
32
|
+
w,
|
|
33
|
+
c
|
|
34
|
+
]);
|
|
35
|
+
const E = a ? y(a, "HH:mm") : "", [b, m] = v(E), [g, l] = v(!1), [H, s] = v(!0), p = g ? b : E, f = (e) => !e || !u || !z(u) || !q(e, u), x = p.length === 5 ? S(p, a) : null, L = x ? f(x) : !0, N = (e) => {
|
|
36
|
+
const i = e.target.value;
|
|
37
|
+
if (l(!0), m(i), i.length !== 5) {
|
|
38
|
+
s(!1);
|
|
26
39
|
return;
|
|
27
40
|
}
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
30
|
-
r(void 0),
|
|
41
|
+
const h = S(i, a);
|
|
42
|
+
if (!h) {
|
|
43
|
+
r(void 0), s(!1);
|
|
31
44
|
return;
|
|
32
45
|
}
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
if (
|
|
36
|
-
r(
|
|
46
|
+
s(!0), f(h) ? (r(h), l(!1), t.close()) : r(void 0);
|
|
47
|
+
}, T = (e) => {
|
|
48
|
+
if (s(!0), f(e)) {
|
|
49
|
+
r(e), m(e ? y(e, "HH:mm") : ""), l(!1);
|
|
37
50
|
return;
|
|
38
51
|
}
|
|
39
|
-
r(void 0),
|
|
40
|
-
},
|
|
41
|
-
r(void 0),
|
|
42
|
-
},
|
|
43
|
-
...
|
|
44
|
-
popupState:
|
|
45
|
-
localValue:
|
|
46
|
-
isValidTime:
|
|
47
|
-
isValidEndTime:
|
|
48
|
-
handleChange:
|
|
52
|
+
r(void 0), m(e ? y(e, "HH:mm") : ""), l(!0);
|
|
53
|
+
}, P = () => {
|
|
54
|
+
r(void 0), m(""), l(!1), s(!0);
|
|
55
|
+
}, d = /* @__PURE__ */ o(F, {
|
|
56
|
+
...n,
|
|
57
|
+
popupState: t,
|
|
58
|
+
localValue: p,
|
|
59
|
+
isValidTime: H,
|
|
60
|
+
isValidEndTime: L,
|
|
61
|
+
handleChange: N
|
|
49
62
|
});
|
|
50
|
-
return
|
|
63
|
+
return n.disabled || n.readOnly ? d : c ? /* @__PURE__ */ C("div", {
|
|
51
64
|
className: "relative h-auto w-auto",
|
|
52
65
|
children: [/* @__PURE__ */ o("div", {
|
|
53
66
|
className: "m-0 flex h-fit items-center justify-center p-0",
|
|
54
|
-
children:
|
|
55
|
-
}), /* @__PURE__ */ o(
|
|
67
|
+
children: d
|
|
68
|
+
}), /* @__PURE__ */ o(D, {
|
|
56
69
|
anchor: "bottom",
|
|
57
|
-
open:
|
|
58
|
-
onClose:
|
|
59
|
-
anchorEl:
|
|
70
|
+
open: t.isOpen,
|
|
71
|
+
onClose: t.close,
|
|
72
|
+
anchorEl: t.anchorEl,
|
|
60
73
|
children: /* @__PURE__ */ o("div", {
|
|
61
74
|
className: "mx-auto w-full max-w-[360px] px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2",
|
|
62
|
-
children: /* @__PURE__ */ o(
|
|
63
|
-
dataTest:
|
|
75
|
+
children: /* @__PURE__ */ o(B, {
|
|
76
|
+
dataTest: n.dataTest,
|
|
64
77
|
value: a,
|
|
65
|
-
onSelect:
|
|
66
|
-
handleClear:
|
|
67
|
-
onConfirm:
|
|
78
|
+
onSelect: T,
|
|
79
|
+
handleClear: P,
|
|
80
|
+
onConfirm: t.close
|
|
68
81
|
})
|
|
69
82
|
})
|
|
70
83
|
})]
|
|
71
|
-
}) : /* @__PURE__ */ o(
|
|
84
|
+
}) : /* @__PURE__ */ o(A, {
|
|
72
85
|
mouseEvent: "onMouseDown",
|
|
73
|
-
onClickAway:
|
|
74
|
-
children: /* @__PURE__ */
|
|
86
|
+
onClickAway: t.close,
|
|
87
|
+
children: /* @__PURE__ */ C("div", {
|
|
75
88
|
className: "relative h-auto w-auto",
|
|
76
89
|
children: [/* @__PURE__ */ o("div", {
|
|
77
90
|
className: "m-0 flex h-fit items-center justify-center p-0",
|
|
78
|
-
children:
|
|
79
|
-
}),
|
|
80
|
-
...
|
|
81
|
-
popupState:
|
|
82
|
-
handleClear:
|
|
83
|
-
onSelect:
|
|
91
|
+
children: d
|
|
92
|
+
}), t.isOpen && /* @__PURE__ */ o(M, {
|
|
93
|
+
...n,
|
|
94
|
+
popupState: t,
|
|
95
|
+
handleClear: P,
|
|
96
|
+
onSelect: T
|
|
84
97
|
})]
|
|
85
98
|
})
|
|
86
99
|
});
|
|
87
100
|
};
|
|
88
101
|
export {
|
|
89
|
-
|
|
102
|
+
te as StyledTimePicker
|
|
90
103
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var a = (r) => r.tabIndex >= 0 && !r.matches(":disabled") && !r.closest("[inert]") && (r.checkVisibility?.() ?? !0), b = (r) => Array.from(r.querySelectorAll("*")).filter(a), i = (r) => a(r) ? r : Array.from(r.querySelectorAll("*")).find(a) ?? null;
|
|
2
|
+
export {
|
|
3
|
+
i as firstTabbable,
|
|
4
|
+
b as tabbableWithin
|
|
5
|
+
};
|
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { tabbableWithin as p } from "../helpers/focusable.js";
|
|
2
|
+
import { useEffect as d, useRef as y } from "react";
|
|
3
|
+
var E = (c, i, s) => {
|
|
4
|
+
const f = y(s);
|
|
3
5
|
d(() => {
|
|
6
|
+
f.current = s;
|
|
7
|
+
}, [s]), d(() => {
|
|
4
8
|
if (!c) return;
|
|
5
|
-
const t =
|
|
9
|
+
const t = i.current;
|
|
6
10
|
if (!t) return;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
const n = document.activeElement, a = t.getAttribute("tabindex");
|
|
12
|
+
t.setAttribute("tabindex", "-1");
|
|
13
|
+
const b = requestAnimationFrame(() => {
|
|
14
|
+
(!n || !t.contains(n)) && t.focus({ preventScroll: !0 });
|
|
15
|
+
}), l = (e) => {
|
|
10
16
|
if (e.key === "Escape") {
|
|
11
|
-
|
|
17
|
+
f.current?.();
|
|
12
18
|
return;
|
|
13
19
|
}
|
|
14
20
|
if (e.key !== "Tab") return;
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
21
|
+
const r = p(t);
|
|
22
|
+
if (r.length === 0) {
|
|
17
23
|
e.preventDefault();
|
|
18
24
|
return;
|
|
19
25
|
}
|
|
20
|
-
const
|
|
21
|
-
e.shiftKey && (o ===
|
|
26
|
+
const u = r[0], m = r[r.length - 1], o = document.activeElement;
|
|
27
|
+
e.shiftKey && (o === u || o === t) ? (e.preventDefault(), m?.focus()) : (!e.shiftKey && o === m || !e.shiftKey && o === t) && (e.preventDefault(), u?.focus());
|
|
22
28
|
};
|
|
23
|
-
return document.addEventListener("keydown",
|
|
24
|
-
cancelAnimationFrame(
|
|
29
|
+
return document.addEventListener("keydown", l), () => {
|
|
30
|
+
cancelAnimationFrame(b), document.removeEventListener("keydown", l), a === null ? t.removeAttribute("tabindex") : t.setAttribute("tabindex", a), requestAnimationFrame(() => {
|
|
31
|
+
const e = document.activeElement;
|
|
32
|
+
(!e || e === document.body) && n && document.contains(n) && n.focus({ preventScroll: !0 });
|
|
33
|
+
});
|
|
25
34
|
};
|
|
26
|
-
}, [
|
|
27
|
-
c,
|
|
28
|
-
u,
|
|
29
|
-
a
|
|
30
|
-
]);
|
|
35
|
+
}, [c, i]);
|
|
31
36
|
};
|
|
32
37
|
export {
|
|
33
|
-
|
|
38
|
+
E as useFocusTrap
|
|
34
39
|
};
|
|
@@ -47,6 +47,8 @@ export interface StyledChipProps {
|
|
|
47
47
|
classes?: ChipClasses;
|
|
48
48
|
sx?: unknown;
|
|
49
49
|
tabIndex?: number;
|
|
50
|
+
/** Removes the delete affordance from sequential navigation when its owner has a keyboard equivalent. */
|
|
51
|
+
deleteButtonTabIndex?: number;
|
|
50
52
|
'aria-label'?: string;
|
|
51
53
|
/** Overrides the default `role="button"`/no-role logic — for `StyledInteractiveChip`'s
|
|
52
54
|
* checkbox/radio chip, whose inner control is `decorative`/`aria-hidden` (a real, even hidden,
|
|
@@ -9,9 +9,8 @@ import { StyledDynamicSelectComponent } from './types';
|
|
|
9
9
|
* **Multiple**) to a representation, which this component's thresholds reproduce exactly:
|
|
10
10
|
* - **≤5 → Chips select** (`DynamicInteractiveChipGroup`): `StyledInteractiveChip` radio (single)
|
|
11
11
|
* or checkbox (multiple) chips; long labels stack vertically; "Clear selection" link + helper row.
|
|
12
|
-
* - **>5
|
|
13
|
-
*
|
|
14
|
-
* - **>10 → Autocomplete**: same trigger + scrollable `Menus` list with type-ahead search.
|
|
12
|
+
* - **>5 → Autocomplete**: outlined `StyledInputField` trigger + scrollable `Menus` list with
|
|
13
|
+
* type-ahead search.
|
|
15
14
|
* Each representation is composed from components already aligned to their own Figma nodes (Chip
|
|
16
15
|
* `13248-31089`, Input field `15561-37391`, Menus `16073-19226`, Autocomplete `20474-27966`), so
|
|
17
16
|
* parity here is the mode routing + the shared title/clear/helper chrome, not a bespoke visual.
|
|
@@ -25,7 +24,7 @@ import { StyledDynamicSelectComponent } from './types';
|
|
|
25
24
|
* Long labels automatically switch to a vertical stacked layout.
|
|
26
25
|
* When `!required` and a value is selected, a "Clear selection" button is shown.
|
|
27
26
|
* - `0 or 6+ options` → renders as a searchable autocomplete (`DynamicSelectAutocomplete`).
|
|
28
|
-
*
|
|
27
|
+
* All autocomplete option counts remain filterable and keyboard-operable.
|
|
29
28
|
*
|
|
30
29
|
* **Option types:**
|
|
31
30
|
* Options can be primitives (`string | number | boolean`) or objects. When using objects,
|
package/dist/src/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,7 +4,7 @@ export interface CountryCodeOptionsProps {
|
|
|
4
4
|
/** Already filtered — the caller owns the query. */
|
|
5
5
|
visible: readonly PhoneCountryChoice[];
|
|
6
6
|
selectedIso2: string;
|
|
7
|
-
activeIndex: number;
|
|
7
|
+
activeIndex: number | null;
|
|
8
8
|
optionId: (index: number) => string;
|
|
9
9
|
onSelect: (iso2: string) => void;
|
|
10
10
|
listId: string;
|
|
@@ -10,13 +10,16 @@ export interface UseCountryPickerOptions {
|
|
|
10
10
|
selectedIso2: string;
|
|
11
11
|
query: string;
|
|
12
12
|
listId: string;
|
|
13
|
-
onSelect: (iso2: string) => void;
|
|
13
|
+
onSelect: (iso2: string, close?: boolean) => void;
|
|
14
14
|
onDismiss: () => void;
|
|
15
15
|
}
|
|
16
16
|
export interface CountryPicker {
|
|
17
17
|
visible: readonly PhoneCountryChoice[];
|
|
18
|
-
activeIndex: number;
|
|
18
|
+
activeIndex: number | null;
|
|
19
19
|
optionId: (index: number) => string;
|
|
20
|
+
openWithKeyboard: (direction: -1 | 1) => void;
|
|
21
|
+
select: (iso2: string) => void;
|
|
22
|
+
dismiss: () => void;
|
|
20
23
|
handleKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
@@ -50,6 +50,9 @@ export interface StyledSliderProps {
|
|
|
50
50
|
errorText?: string;
|
|
51
51
|
helperText?: string;
|
|
52
52
|
reserveHelperText?: boolean;
|
|
53
|
+
fromLabel?: ReactNode;
|
|
54
|
+
toLabel?: ReactNode;
|
|
55
|
+
showButtons?: boolean;
|
|
53
56
|
/** Accessible name for the thumb input(s) — there is no visible label to derive it from
|
|
54
57
|
* (axe `label`). A function receives the thumb index (0, or 0/1 for a two-thumb range) so each
|
|
55
58
|
* thumb of a range slider can get a distinct name. */
|
|
@@ -67,5 +70,5 @@ export interface StyledSliderProps {
|
|
|
67
70
|
* CI is the visual gate. Upgrade path: tune the 8px thumb inset if a diff shows misalignment.
|
|
68
71
|
* TASK-204.
|
|
69
72
|
*/
|
|
70
|
-
export declare const StyledSlider: ({ dataTest, min, max, step, value, defaultValue, disabled, size, orientation, marks, name, className, classes, slotProps, error, errorText, helperText, reserveHelperText, ariaLabel, ariaLabelledBy, onChange, onChangeCommitted, }: StyledSliderProps) => JSX.Element;
|
|
73
|
+
export declare const StyledSlider: ({ dataTest, min, max, step, value, defaultValue, disabled, size, orientation, marks, name, className, classes, slotProps, error, errorText, helperText, reserveHelperText, fromLabel, toLabel, showButtons, ariaLabel, ariaLabelledBy, onChange, onChangeCommitted, }: StyledSliderProps) => JSX.Element;
|
|
71
74
|
export {};
|
|
@@ -5,16 +5,17 @@ declare function ListboxRoot<T>({ value, onChange, children, }: {
|
|
|
5
5
|
onChange: (value: T) => void;
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
}): JSX.Element;
|
|
8
|
-
declare function ListboxOption<T>({ value, disabled, children, className, }: {
|
|
8
|
+
declare function ListboxOption<T>({ value, disabled, children, className, optionIndex, }: {
|
|
9
9
|
value: T;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
children: RenderProp<{
|
|
12
12
|
selected: boolean;
|
|
13
13
|
}>;
|
|
14
14
|
className?: string;
|
|
15
|
+
optionIndex?: number;
|
|
15
16
|
}): JSX.Element;
|
|
16
17
|
export declare const Listbox: typeof ListboxRoot & {
|
|
17
|
-
Button: ({ children, className, ...rest }: {
|
|
18
|
+
Button: ({ children, className, onClick, onKeyDown, ...rest }: {
|
|
18
19
|
children: RenderProp<{
|
|
19
20
|
open: boolean;
|
|
20
21
|
}>;
|