asma-ui-core 3.130.4 → 3.130.5
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/components/inputs/full-screen-picker/FullScreenPicker.js +8 -8
- package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +74 -68
- package/dist/components/utils/popover/PopoverSheet.js +69 -67
- package/dist/src/components/utils/bottom-sheet/StyledBottomSheet.d.ts +7 -1
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { CloseIcon as y } from "../../icons/close-icon/CloseIcon.js";
|
|
2
2
|
import { StyledButton as w } from "../button/StyledButton.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { isKeyboardModality as g, trackInputModality as k } from "./inputModality.js";
|
|
4
|
+
import { usePickerOneRowHeaderMediaQuery as N } from "../../../hooks/useMediaQuery.hook.js";
|
|
5
|
+
import { StyledDialog as S } from "../../feedback/dialog/StyledDialog.js";
|
|
6
|
+
import { PickerLiveRegion as R } from "./PickerLiveRegion.js";
|
|
7
7
|
import { useReleaseFieldOnKeyboardDismiss as I } from "./useReleaseFieldOnKeyboardDismiss.js";
|
|
8
8
|
import { useVisualViewportHeight as F } from "./useVisualViewportHeight.js";
|
|
9
9
|
import { useEffect as x, useRef as p } from "react";
|
|
10
10
|
import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
11
11
|
var E = ({ open: i, onClose: o, dataTest: l, title: r, fallbackName: n, ...c }) => {
|
|
12
12
|
const t = r != null && r !== !1 && r !== "";
|
|
13
|
-
return x(
|
|
13
|
+
return x(k, []), /* @__PURE__ */ e(S, {
|
|
14
14
|
open: i,
|
|
15
15
|
onClose: (f, s) => o(s),
|
|
16
16
|
dataTest: l,
|
|
@@ -25,11 +25,11 @@ var E = ({ open: i, onClose: o, dataTest: l, title: r, fallbackName: n, ...c })
|
|
|
25
25
|
})
|
|
26
26
|
});
|
|
27
27
|
}, P = ({ dataTest: i, title: o, closeLabel: l, search: r, headerRow: n, children: c, announcement: t, onClose: f }) => {
|
|
28
|
-
const s =
|
|
28
|
+
const s = N(), v = F(), a = p(null), u = p(null);
|
|
29
29
|
return I(a), x(() => {
|
|
30
30
|
const b = requestAnimationFrame(() => {
|
|
31
31
|
const h = a.current?.closest("dialog");
|
|
32
|
-
if (!h || document.activeElement !== h || !
|
|
32
|
+
if (!h || document.activeElement !== h || !g()) return;
|
|
33
33
|
const d = u.current?.querySelector('[role="listbox"]');
|
|
34
34
|
(d && d.tabIndex >= 0 ? d : a.current)?.focus({ preventScroll: !0 });
|
|
35
35
|
});
|
|
@@ -83,7 +83,7 @@ var E = ({ open: i, onClose: o, dataTest: l, title: r, fallbackName: n, ...c })
|
|
|
83
83
|
className: "flex min-h-0 flex-1 flex-col overflow-y-auto px-4",
|
|
84
84
|
children: c
|
|
85
85
|
}),
|
|
86
|
-
/* @__PURE__ */ e(
|
|
86
|
+
/* @__PURE__ */ e(R, {
|
|
87
87
|
announcement: t,
|
|
88
88
|
dataTest: `${i}-live`
|
|
89
89
|
})
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import { cn as l } from "../../../helpers/cn.js";
|
|
2
|
-
import { registerOpenModalDialog as
|
|
3
|
-
import { CloseIcon as
|
|
4
|
-
import { IndeterminateIcon as
|
|
5
|
-
import { StyledButton as
|
|
6
|
-
import { OverlayBackOwnerContext as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
2
|
+
import { registerOpenModalDialog as W } from "../../../hooks/useTopLayer.hook.js";
|
|
3
|
+
import { CloseIcon as Z } from "../../icons/close-icon/CloseIcon.js";
|
|
4
|
+
import { IndeterminateIcon as ee } from "../../icons/indeterminate-icon/IndeterminateIcon.js";
|
|
5
|
+
import { StyledButton as P } from "../../inputs/button/StyledButton.js";
|
|
6
|
+
import { OverlayBackOwnerContext as te, isOverlayBackEnabled as q, requestCloseTopOverlayBack as w, useBackCloses as re } from "../../../hooks/useBackCloses.hook.js";
|
|
7
|
+
import { isKeyboardModality as oe, trackInputModality as ne } from "../../inputs/full-screen-picker/inputModality.js";
|
|
8
|
+
import { useDebouncedValue as ae } from "../../../hooks/useDebouncedValue.hook.js";
|
|
9
|
+
import { useFocusTrap as se } from "../../../hooks/useFocusTrap.hook.js";
|
|
10
|
+
import { useShortViewportMediaQuery as ie } from "../../../hooks/useMediaQuery.hook.js";
|
|
11
|
+
import { SHEET_TEXT as le } from "./sheetCopy.js";
|
|
12
|
+
import { formatResultsLabel as ce } from "./formatResultsLabel.js";
|
|
13
|
+
import { useBodyScrollLock as de } from "../../../hooks/useBodyScrollLock.hook.js";
|
|
14
|
+
import ue from "./StyledBottomSheet.module.js";
|
|
15
|
+
import { useDragToDismiss as me } from "./useDragToDismiss.hook.js";
|
|
16
|
+
import { useEffect as g, useId as fe, useLayoutEffect as pe, useRef as c, useState as ve } from "react";
|
|
16
17
|
import { jsx as o, jsxs as u } from "react/jsx-runtime";
|
|
17
|
-
var
|
|
18
|
-
const
|
|
18
|
+
var he = 500, Fe = ({ dataTest: d, id: V, open: t, onClose: a, title: m, ariaLabel: $, children: A, viewResultsAction: E, resetAction: H, footerActions: K, resultCount: k, locale: S = "en", closeLabel: U = le[S].close, className: G, registerBackClose: Q = !0, ownerRef: X, triggerRef: N }) => {
|
|
19
|
+
const R = fe(), i = c(null), B = c(null), L = c(null), C = X ?? i, h = c(!1), [x, I] = ve(!1), Y = ie(), f = c(a), O = c(t);
|
|
19
20
|
g(() => {
|
|
20
|
-
f.current =
|
|
21
|
-
}, [
|
|
22
|
-
const { dragHandleProps:
|
|
21
|
+
f.current = a, O.current = t;
|
|
22
|
+
}, [a, t]);
|
|
23
|
+
const { dragHandleProps: z, dragOffset: D } = me(B, () => {
|
|
23
24
|
f.current("drag");
|
|
24
25
|
});
|
|
25
|
-
|
|
26
|
+
de(t), se(t, i), g(() => {
|
|
26
27
|
if (!t) return;
|
|
27
28
|
const e = (r) => {
|
|
28
29
|
r.key === "Escape" && (h.current = !0, window.setTimeout(() => {
|
|
@@ -30,29 +31,34 @@ var me = 500, Oe = ({ dataTest: d, id: P, open: t, onClose: s, title: m, ariaLab
|
|
|
30
31
|
}, 0));
|
|
31
32
|
}, n = (r) => {
|
|
32
33
|
if (r.key !== "Escape" || r.defaultPrevented) return;
|
|
33
|
-
const
|
|
34
|
-
|
|
34
|
+
const s = document.activeElement;
|
|
35
|
+
s instanceof Element && s.closest("dialog[open]") !== i.current || (r.preventDefault(), r.stopImmediatePropagation(), w(r));
|
|
35
36
|
};
|
|
36
37
|
return window.addEventListener("keydown", e, !0), window.addEventListener("keydown", n), () => {
|
|
37
38
|
window.removeEventListener("keydown", e, !0), window.removeEventListener("keydown", n);
|
|
38
39
|
};
|
|
39
|
-
}, [t]),
|
|
40
|
-
active: t &&
|
|
40
|
+
}, [t]), re({
|
|
41
|
+
active: t && Q,
|
|
41
42
|
requestClose: () => f.current("escape"),
|
|
42
|
-
ownerRef:
|
|
43
|
-
}),
|
|
43
|
+
ownerRef: C
|
|
44
|
+
}), pe(() => {
|
|
44
45
|
const e = i.current;
|
|
45
46
|
if (!t || !e) return;
|
|
46
|
-
|
|
47
|
-
const n =
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
ne();
|
|
48
|
+
const n = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
49
|
+
L.current = N?.current ?? n, e.open || e.showModal(), e.focus({ preventScroll: !0 });
|
|
50
|
+
const r = requestAnimationFrame(() => {
|
|
51
|
+
I(!0);
|
|
52
|
+
}), s = W(e);
|
|
50
53
|
return () => {
|
|
51
|
-
cancelAnimationFrame(
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
+
cancelAnimationFrame(r), s(), I(!1), e.open && e.close();
|
|
55
|
+
const j = L.current;
|
|
56
|
+
j?.isConnected && j.focus({
|
|
57
|
+
preventScroll: !0,
|
|
58
|
+
focusVisible: oe()
|
|
59
|
+
});
|
|
54
60
|
};
|
|
55
|
-
}, [t]), g(() => {
|
|
61
|
+
}, [t, N]), g(() => {
|
|
56
62
|
const e = i.current;
|
|
57
63
|
if (!e || !t) return;
|
|
58
64
|
let n = !1;
|
|
@@ -60,79 +66,79 @@ var me = 500, Oe = ({ dataTest: d, id: P, open: t, onClose: s, title: m, ariaLab
|
|
|
60
66
|
requestAnimationFrame(() => {
|
|
61
67
|
n = !1, O.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
|
|
62
68
|
});
|
|
63
|
-
},
|
|
64
|
-
n || (n = !0,
|
|
69
|
+
}, s = () => {
|
|
70
|
+
n || (n = !0, q() && w(), r());
|
|
65
71
|
};
|
|
66
|
-
return e.addEventListener("close",
|
|
72
|
+
return e.addEventListener("close", s), () => e.removeEventListener("close", s);
|
|
67
73
|
}, [t]);
|
|
68
|
-
const
|
|
74
|
+
const M = ce(ae(k, he), S);
|
|
69
75
|
if (!t) return null;
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
} }, p = (e) => typeof e == "function" ? e(
|
|
76
|
+
const J = { close: () => {
|
|
77
|
+
a("action");
|
|
78
|
+
} }, p = (e) => typeof e == "function" ? e(J) : e, T = k !== void 0, b = E !== void 0 ? p(E) : T ? /* @__PURE__ */ o(P, {
|
|
73
79
|
dataTest: `${d}-view-results`,
|
|
74
80
|
type: "button",
|
|
75
81
|
variant: "text",
|
|
76
82
|
onClick: () => {
|
|
77
|
-
|
|
83
|
+
a("viewResults");
|
|
78
84
|
},
|
|
79
|
-
children:
|
|
80
|
-
}) : void 0, F = p(
|
|
85
|
+
children: M
|
|
86
|
+
}) : void 0, F = p(H), v = p(K), y = !!(b ?? F), _ = D > 0;
|
|
81
87
|
return /* @__PURE__ */ o("dialog", {
|
|
82
88
|
ref: i,
|
|
83
|
-
id:
|
|
89
|
+
id: V,
|
|
84
90
|
tabIndex: -1,
|
|
85
91
|
"aria-modal": "true",
|
|
86
|
-
"aria-labelledby": m ?
|
|
87
|
-
"aria-label": m ? void 0 :
|
|
92
|
+
"aria-labelledby": m ? R : void 0,
|
|
93
|
+
"aria-label": m ? void 0 : $,
|
|
88
94
|
"data-test": d,
|
|
89
95
|
"data-testid": d,
|
|
90
96
|
onCancel: (e) => {
|
|
91
97
|
if (e.cancelable && e.preventDefault(), !h.current) {
|
|
92
|
-
if (!
|
|
98
|
+
if (!q()) {
|
|
93
99
|
f.current("escape");
|
|
94
100
|
return;
|
|
95
101
|
}
|
|
96
|
-
|
|
102
|
+
w();
|
|
97
103
|
}
|
|
98
104
|
},
|
|
99
|
-
className: l(
|
|
100
|
-
children: /* @__PURE__ */ u(
|
|
101
|
-
value:
|
|
105
|
+
className: l(ue.StyledBottomSheet, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none flex-col items-center justify-end overflow-hidden border-0 bg-transparent p-0 outline-none open:flex"),
|
|
106
|
+
children: /* @__PURE__ */ u(te.Provider, {
|
|
107
|
+
value: C,
|
|
102
108
|
children: [/* @__PURE__ */ o("div", {
|
|
103
109
|
"aria-hidden": "true",
|
|
104
110
|
"data-testid": `${d}-scrim`,
|
|
105
111
|
onClick: () => {
|
|
106
|
-
|
|
112
|
+
a("scrim");
|
|
107
113
|
},
|
|
108
114
|
className: l("absolute inset-0 bg-[#626e7eb2] transition-opacity duration-[250ms] ease-out motion-reduce:duration-150", x ? "opacity-100" : "opacity-0")
|
|
109
115
|
}), /* @__PURE__ */ u("div", {
|
|
110
|
-
ref:
|
|
116
|
+
ref: B,
|
|
111
117
|
"data-state": x ? "open" : "closed",
|
|
112
|
-
style:
|
|
113
|
-
className: l("relative box-border flex w-full max-w-[640px] flex-col border border-solid border-delta-300 bg-white text-delta-700 outline-none",
|
|
118
|
+
style: _ ? { transform: `translateY(${D}px)` } : void 0,
|
|
119
|
+
className: l("relative box-border flex w-full max-w-[640px] flex-col border border-solid border-delta-300 bg-white text-delta-700 outline-none", Y ? "h-full max-h-none rounded-none" : "max-h-[90dvh] rounded-t-[28px]", !_ && ["ease-out motion-safe:transition-transform motion-safe:duration-[250ms] motion-reduce:transition-opacity motion-reduce:duration-150", x ? "translate-y-0 opacity-100" : "motion-safe:translate-y-full motion-reduce:opacity-0"], G),
|
|
114
120
|
children: [
|
|
115
121
|
/* @__PURE__ */ u("div", {
|
|
116
122
|
className: "border-b-solid shrink-0 border-b border-delta-200 pb-2",
|
|
117
123
|
children: [/* @__PURE__ */ u("div", {
|
|
118
|
-
...
|
|
124
|
+
...z,
|
|
119
125
|
className: "relative flex h-12 touch-none items-center gap-2 px-2",
|
|
120
126
|
children: [
|
|
121
127
|
/* @__PURE__ */ o("div", { className: "min-w-0 flex-1" }),
|
|
122
|
-
/* @__PURE__ */ o(
|
|
128
|
+
/* @__PURE__ */ o(P, {
|
|
123
129
|
dataTest: `${d}-close`,
|
|
124
130
|
variant: "textGray",
|
|
125
131
|
type: "button",
|
|
126
132
|
"aria-label": U,
|
|
127
133
|
onClick: () => {
|
|
128
|
-
|
|
134
|
+
a("closeButton");
|
|
129
135
|
},
|
|
130
|
-
startIcon: /* @__PURE__ */ o(
|
|
136
|
+
startIcon: /* @__PURE__ */ o(Z, {
|
|
131
137
|
width: 24,
|
|
132
138
|
height: 24
|
|
133
139
|
})
|
|
134
140
|
}),
|
|
135
|
-
/* @__PURE__ */ o(
|
|
141
|
+
/* @__PURE__ */ o(ee, {
|
|
136
142
|
"aria-hidden": "true",
|
|
137
143
|
focusable: "false",
|
|
138
144
|
width: 24,
|
|
@@ -141,16 +147,16 @@ var me = 500, Oe = ({ dataTest: d, id: P, open: t, onClose: s, title: m, ariaLab
|
|
|
141
147
|
})
|
|
142
148
|
]
|
|
143
149
|
}), m && /* @__PURE__ */ o("div", {
|
|
144
|
-
id:
|
|
150
|
+
id: R,
|
|
145
151
|
className: "truncate px-4 text-lg font-semibold leading-7 text-delta-800",
|
|
146
152
|
children: m
|
|
147
153
|
})]
|
|
148
154
|
}),
|
|
149
155
|
/* @__PURE__ */ o("div", {
|
|
150
|
-
className: l("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain pl-4 pr-2 pt-2",
|
|
151
|
-
children: p(
|
|
156
|
+
className: l("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain pl-4 pr-2 pt-2", y || v ? "pb-2" : "pb-[max(0.5rem,env(safe-area-inset-bottom))]"),
|
|
157
|
+
children: p(A)
|
|
152
158
|
}),
|
|
153
|
-
|
|
159
|
+
y && /* @__PURE__ */ u("div", {
|
|
154
160
|
className: l("border-t-solid flex shrink-0 items-start border-t border-delta-200 bg-white p-1", b ? "justify-between" : "justify-end", "max-xs:flex-wrap max-xs:gap-y-2 max-xs:[&>:nth-child(2)]:ml-auto", !v && "pb-[max(0.25rem,env(safe-area-inset-bottom))]"),
|
|
155
161
|
children: [
|
|
156
162
|
b,
|
|
@@ -160,12 +166,12 @@ var me = 500, Oe = ({ dataTest: d, id: P, open: t, onClose: s, title: m, ariaLab
|
|
|
160
166
|
role: "status",
|
|
161
167
|
"aria-live": "polite",
|
|
162
168
|
"aria-atomic": "true",
|
|
163
|
-
children:
|
|
169
|
+
children: M
|
|
164
170
|
})
|
|
165
171
|
]
|
|
166
172
|
}),
|
|
167
173
|
v && /* @__PURE__ */ o("div", {
|
|
168
|
-
className: l("flex shrink-0 flex-col items-end bg-white p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",
|
|
174
|
+
className: l("flex shrink-0 flex-col items-end bg-white p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]", y && "max-xs:pt-1"),
|
|
169
175
|
children: v
|
|
170
176
|
})
|
|
171
177
|
]
|
|
@@ -174,5 +180,5 @@ var me = 500, Oe = ({ dataTest: d, id: P, open: t, onClose: s, title: m, ariaLab
|
|
|
174
180
|
});
|
|
175
181
|
};
|
|
176
182
|
export {
|
|
177
|
-
|
|
183
|
+
Fe as StyledBottomSheet
|
|
178
184
|
};
|
|
@@ -1,64 +1,65 @@
|
|
|
1
1
|
import { cn as Le } from "../../../helpers/cn.js";
|
|
2
2
|
import { firstTabbable as ne } from "../../../helpers/focusable.js";
|
|
3
|
-
import { TOP_LAYER_PROPS as
|
|
3
|
+
import { TOP_LAYER_PROPS as Me, TOP_LAYER_RESET_STYLE as Se, getOpenModalDialogAncestor as Ce, shouldUsePopoverTopLayer as Ie, useTopLayerRef as _e } from "../../../hooks/useTopLayer.hook.js";
|
|
4
4
|
import { StyledButton as ke } from "../../inputs/button/StyledButton.js";
|
|
5
5
|
import { OverlayBackOwnerContext as He, requestCloseTopOverlayBack as We, useBackCloses as Be } from "../../../hooks/useBackCloses.hook.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
6
|
+
import { isKeyboardModality as De, trackInputModality as qe } from "../../inputs/full-screen-picker/inputModality.js";
|
|
7
|
+
import { useDebouncedValue as Xe } from "../../../hooks/useDebouncedValue.hook.js";
|
|
8
|
+
import { useFocusTrap as $e } from "../../../hooks/useFocusTrap.hook.js";
|
|
9
|
+
import { useMobileMediaQuery as Ke } from "../../../hooks/useMediaQuery.hook.js";
|
|
10
|
+
import { SHEET_TEXT as Ne } from "../bottom-sheet/sheetCopy.js";
|
|
11
|
+
import { formatResultsLabel as je } from "../bottom-sheet/formatResultsLabel.js";
|
|
12
|
+
import { StyledBottomSheet as Ue } from "../bottom-sheet/StyledBottomSheet.js";
|
|
13
|
+
import { PopoverAnatomy as Ve } from "./PopoverAnatomy.js";
|
|
14
|
+
import { useCallback as d, useEffect as v, useId as Ye, useRef as f, useState as l } from "react";
|
|
14
15
|
import { Fragment as re, jsx as m, jsxs as ie } from "react/jsx-runtime";
|
|
15
|
-
import { FloatingPortal as
|
|
16
|
-
var
|
|
16
|
+
import { FloatingPortal as ze, autoUpdate as Ge, flip as Qe, offset as Je, shift as Ze, size as et, useDismiss as tt, useFloating as ot, useInteractions as nt, useMergeRefs as rt } from "@floating-ui/react";
|
|
17
|
+
var S = 240, it = {
|
|
17
18
|
info: 472,
|
|
18
19
|
action: 472
|
|
19
|
-
}, se = 0.6, ae = "calc(100vw - 32px)",
|
|
20
|
-
const g =
|
|
20
|
+
}, se = 0.6, ae = "calc(100vw - 32px)", Rt = ({ dataTest: p, renderTrigger: C, variant: I = "info", title: y, children: _, viewResultsAction: k, resetAction: H, footerActions: W, resultCount: b, locale: R = "en", closeLabel: B = Ne[R].close, ariaLabel: D, onOpenChange: q, className: X, align: $ = "auto", ignoreOutside: K }) => {
|
|
21
|
+
const g = Ye(), N = `${g}-title`, [o, ce] = l(!1), [j, le] = l(), [ue, U] = l(), [de, fe] = l("start"), [T, V] = l(), [me, Y] = l(S), u = Ke(), n = I === "action", pe = u && !n, E = u && n, w = d((e) => {
|
|
21
22
|
ce(e), q?.(e);
|
|
22
|
-
}, [q]), { refs:
|
|
23
|
+
}, [q]), { refs: F, floatingStyles: ge, context: he, placement: z, isPositioned: ve } = ot({
|
|
23
24
|
open: o,
|
|
24
|
-
onOpenChange:
|
|
25
|
+
onOpenChange: w,
|
|
25
26
|
placement: `${T ?? "bottom"}-${de}`,
|
|
26
27
|
strategy: "fixed",
|
|
27
|
-
whileElementsMounted:
|
|
28
|
+
whileElementsMounted: Ge,
|
|
28
29
|
middleware: [
|
|
29
|
-
|
|
30
|
-
...pe || T ? [] : [
|
|
30
|
+
Je(8),
|
|
31
|
+
...pe || T ? [] : [Qe({
|
|
31
32
|
padding: 8,
|
|
32
33
|
crossAxis: !1,
|
|
33
34
|
flipAlignment: !1
|
|
34
35
|
})],
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
Ze({ padding: 8 }),
|
|
37
|
+
et({
|
|
37
38
|
padding: 8,
|
|
38
39
|
apply({ availableHeight: e, rects: t }) {
|
|
39
|
-
U(Math.min(e, Math.round(window.innerHeight * se))), u ||
|
|
40
|
+
U(Math.min(e, Math.round(window.innerHeight * se))), u || Y((a) => Math.max(a, t.floating.width));
|
|
40
41
|
}
|
|
41
42
|
})
|
|
42
43
|
]
|
|
43
44
|
});
|
|
44
|
-
o && ve && !T &&
|
|
45
|
-
const
|
|
46
|
-
c.current = e,
|
|
47
|
-
}, []),
|
|
48
|
-
|
|
49
|
-
}, [
|
|
45
|
+
o && ve && !T && V(z.startsWith("top") ? "top" : "bottom");
|
|
46
|
+
const A = Ie(j), c = f(null), [r, ye] = l(null), Ee = d((e) => {
|
|
47
|
+
c.current = e, ye(e);
|
|
48
|
+
}, []), we = rt([_e(F.setFloating, A), Ee]), P = f(null), Pe = d((e) => {
|
|
49
|
+
P.current = e, F.setReference(e);
|
|
50
|
+
}, [F]), G = f(null), O = K?.length ? K.join(",") : void 0, Q = f(O);
|
|
50
51
|
v(() => {
|
|
51
52
|
Q.current = O;
|
|
52
53
|
}, [O]);
|
|
53
54
|
const h = d((e) => {
|
|
54
55
|
if (!(e instanceof Element)) return !1;
|
|
55
|
-
if (c.current?.contains(e) ||
|
|
56
|
+
if (c.current?.contains(e) || P.current?.contains(e) || G.current === e) return !0;
|
|
56
57
|
const t = Q.current;
|
|
57
58
|
return t !== void 0 && e.closest(t) !== null;
|
|
58
59
|
}, []), J = f(null), xe = d((e) => {
|
|
59
60
|
G.current = e.target, e.target instanceof HTMLElement && c.current?.contains(e.target) && (J.current = e.target);
|
|
60
|
-
}, []), { getFloatingProps:
|
|
61
|
-
enabled: !
|
|
61
|
+
}, []), { getFloatingProps: be } = nt([tt(he, {
|
|
62
|
+
enabled: !E,
|
|
62
63
|
escapeKey: !1,
|
|
63
64
|
outsidePress: (e) => {
|
|
64
65
|
const t = e.target;
|
|
@@ -68,20 +69,20 @@ var C = 240, nt = {
|
|
|
68
69
|
return !a || a.contains(c.current);
|
|
69
70
|
}
|
|
70
71
|
})]), s = d(() => {
|
|
71
|
-
|
|
72
|
-
}, [
|
|
72
|
+
w(!1);
|
|
73
|
+
}, [w]);
|
|
73
74
|
Be({
|
|
74
75
|
active: o,
|
|
75
76
|
requestClose: s,
|
|
76
77
|
ownerRef: c
|
|
77
78
|
}), v(() => {
|
|
78
|
-
if (!o ||
|
|
79
|
+
if (!o || E) return;
|
|
79
80
|
const e = (t) => {
|
|
80
81
|
t.key !== "Escape" || t.defaultPrevented || t.isComposing || (t.preventDefault(), t.stopImmediatePropagation(), We(t));
|
|
81
82
|
};
|
|
82
83
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
83
|
-
}, [o,
|
|
84
|
-
const [Z,
|
|
84
|
+
}, [o, E]), $e(o && n && r !== null, c);
|
|
85
|
+
const [Z, Re] = l(!1);
|
|
85
86
|
v(() => {
|
|
86
87
|
if (!r || n && !Z) return;
|
|
87
88
|
const e = requestAnimationFrame(() => {
|
|
@@ -101,8 +102,8 @@ var C = 240, nt = {
|
|
|
101
102
|
cancelAnimationFrame(e), e = requestAnimationFrame(() => {
|
|
102
103
|
const i = document.activeElement;
|
|
103
104
|
if (!r.isConnected || i && i !== document.body && h(i)) return;
|
|
104
|
-
const
|
|
105
|
-
(
|
|
105
|
+
const M = J.current;
|
|
106
|
+
(M?.isConnected && r.contains(M) ? M : ne(r) ?? r).focus({ preventScroll: !0 });
|
|
106
107
|
});
|
|
107
108
|
}, a = (i) => {
|
|
108
109
|
i.relatedTarget === null && s();
|
|
@@ -123,15 +124,15 @@ var C = 240, nt = {
|
|
|
123
124
|
const L = f(!1);
|
|
124
125
|
v(() => {
|
|
125
126
|
if (o) {
|
|
126
|
-
L.current = !0;
|
|
127
|
+
qe(), L.current = !0;
|
|
127
128
|
return;
|
|
128
129
|
}
|
|
129
130
|
if (!L.current) return;
|
|
130
131
|
L.current = !1;
|
|
131
|
-
const e =
|
|
132
|
+
const e = P.current;
|
|
132
133
|
if (!e) return;
|
|
133
134
|
const t = requestAnimationFrame(() => {
|
|
134
|
-
document.activeElement === document.body && e.focus();
|
|
135
|
+
document.activeElement === document.body && e.focus({ focusVisible: De() });
|
|
135
136
|
});
|
|
136
137
|
return () => {
|
|
137
138
|
cancelAnimationFrame(t);
|
|
@@ -146,58 +147,59 @@ var C = 240, nt = {
|
|
|
146
147
|
s();
|
|
147
148
|
return;
|
|
148
149
|
}
|
|
149
|
-
le(
|
|
150
|
+
le(Ce(e.currentTarget));
|
|
150
151
|
const t = e.currentTarget.getBoundingClientRect(), a = t.left + t.width / 2 > window.innerWidth / 2;
|
|
151
|
-
fe($ === "auto" ? a ? "end" : "start" : $),
|
|
152
|
+
fe($ === "auto" ? a ? "end" : "start" : $), V(void 0), Y(S), U(Math.round(window.innerHeight * se)), Re(e.detail === 0), w(!0);
|
|
152
153
|
},
|
|
153
154
|
"aria-expanded": o,
|
|
154
155
|
"aria-controls": o ? g : void 0,
|
|
155
156
|
"aria-haspopup": n ? "dialog" : void 0,
|
|
156
157
|
"aria-describedby": !n && o ? g : void 0
|
|
157
158
|
}
|
|
158
|
-
},
|
|
159
|
+
}, x = (e) => typeof e == "function" ? e({ close: s }) : e, Te = Xe(b, 500), Fe = k ?? (b === void 0 ? void 0 : /* @__PURE__ */ m(ke, {
|
|
159
160
|
dataTest: `${p}-view-results`,
|
|
160
161
|
type: "button",
|
|
161
162
|
variant: "text",
|
|
162
163
|
onClick: s,
|
|
163
|
-
children:
|
|
164
|
-
})), Ae = u ? ae :
|
|
165
|
-
return
|
|
164
|
+
children: je(Te, R)
|
|
165
|
+
})), Ae = u ? ae : it[I], Oe = u ? ae : void 0;
|
|
166
|
+
return E ? /* @__PURE__ */ ie(re, { children: [C(ee), /* @__PURE__ */ m(Ue, {
|
|
166
167
|
id: g,
|
|
167
168
|
dataTest: p,
|
|
168
169
|
open: o,
|
|
169
170
|
onClose: s,
|
|
170
171
|
registerBackClose: !1,
|
|
171
172
|
ownerRef: c,
|
|
172
|
-
|
|
173
|
+
triggerRef: P,
|
|
174
|
+
title: y,
|
|
173
175
|
ariaLabel: D,
|
|
174
176
|
viewResultsAction: k,
|
|
175
177
|
resetAction: H,
|
|
176
178
|
footerActions: W,
|
|
177
|
-
resultCount:
|
|
179
|
+
resultCount: b,
|
|
178
180
|
locale: R,
|
|
179
181
|
closeLabel: B,
|
|
180
182
|
className: X,
|
|
181
|
-
children:
|
|
182
|
-
})] }) : /* @__PURE__ */ ie(re, { children: [
|
|
183
|
-
root:
|
|
183
|
+
children: _
|
|
184
|
+
})] }) : /* @__PURE__ */ ie(re, { children: [C(ee), o && /* @__PURE__ */ m(ze, {
|
|
185
|
+
root: j,
|
|
184
186
|
children: /* @__PURE__ */ m("div", {
|
|
185
|
-
...
|
|
187
|
+
...be(),
|
|
186
188
|
onFocusCapture: xe,
|
|
187
|
-
ref:
|
|
189
|
+
ref: we,
|
|
188
190
|
id: g,
|
|
189
|
-
"data-placement":
|
|
191
|
+
"data-placement": z,
|
|
190
192
|
"data-test": p,
|
|
191
193
|
"data-testid": p,
|
|
192
194
|
role: n ? "dialog" : void 0,
|
|
193
|
-
"aria-labelledby": n &&
|
|
194
|
-
"aria-label": n && !
|
|
195
|
+
"aria-labelledby": n && y ? N : void 0,
|
|
196
|
+
"aria-label": n && !y ? D : void 0,
|
|
195
197
|
tabIndex: n ? void 0 : -1,
|
|
196
|
-
...
|
|
198
|
+
...A ? Me : {},
|
|
197
199
|
style: {
|
|
198
|
-
...
|
|
200
|
+
...A ? Se : {},
|
|
199
201
|
...ge,
|
|
200
|
-
minWidth: u ?
|
|
202
|
+
minWidth: u ? S : me,
|
|
201
203
|
width: Oe,
|
|
202
204
|
maxWidth: Ae,
|
|
203
205
|
maxHeight: ue
|
|
@@ -205,21 +207,21 @@ var C = 240, nt = {
|
|
|
205
207
|
className: Le("z-[1300]", "box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[0px_4px_40px_0px_#22213366]", X),
|
|
206
208
|
children: /* @__PURE__ */ m(He.Provider, {
|
|
207
209
|
value: c,
|
|
208
|
-
children: /* @__PURE__ */ m(
|
|
210
|
+
children: /* @__PURE__ */ m(Ve, {
|
|
209
211
|
dataTest: p,
|
|
210
|
-
title:
|
|
211
|
-
titleId:
|
|
212
|
-
viewResultsAction:
|
|
213
|
-
resetAction:
|
|
214
|
-
footerActions:
|
|
212
|
+
title: y,
|
|
213
|
+
titleId: N,
|
|
214
|
+
viewResultsAction: x(Fe),
|
|
215
|
+
resetAction: x(H),
|
|
216
|
+
footerActions: x(W),
|
|
215
217
|
closeLabel: B,
|
|
216
218
|
onClose: s,
|
|
217
|
-
children:
|
|
219
|
+
children: x(_)
|
|
218
220
|
})
|
|
219
221
|
})
|
|
220
222
|
})
|
|
221
223
|
})] });
|
|
222
224
|
};
|
|
223
225
|
export {
|
|
224
|
-
|
|
226
|
+
Rt as PopoverSheet
|
|
225
227
|
};
|
|
@@ -48,6 +48,12 @@ export interface StyledBottomSheetProps {
|
|
|
48
48
|
registerBackClose?: boolean;
|
|
49
49
|
/** Logical owner supplied by a wrapper that must keep one identity across responsive variants. */
|
|
50
50
|
ownerRef?: RefObject<Element | null>;
|
|
51
|
+
/**
|
|
52
|
+
* The control that opened the sheet; focus returns to it on close. Without it the sheet returns
|
|
53
|
+
* focus to whatever was focused on open — in Safari a tap never focuses a button, so that is the
|
|
54
|
+
* nearest focusable ancestor (a dialog's scrollable content), which then shows a focus ring.
|
|
55
|
+
*/
|
|
56
|
+
triggerRef?: RefObject<HTMLElement | null>;
|
|
51
57
|
}
|
|
52
58
|
/**
|
|
53
59
|
* ASMA Design System **Bottom Sheet** (ASMA-8184) — the mobile (0–743px) form of the Action popover:
|
|
@@ -63,4 +69,4 @@ export interface StyledBottomSheetProps {
|
|
|
63
69
|
* Focus moves to the sheet on open (so the title is announced first) and back to the trigger on
|
|
64
70
|
* close. `PopoverSheet` with `variant='action'` renders this automatically below 744px.
|
|
65
71
|
*/
|
|
66
|
-
export declare const StyledBottomSheet: ({ dataTest, id, open, onClose, title, ariaLabel, children, viewResultsAction, resetAction, footerActions, resultCount, locale, closeLabel, className, registerBackClose, ownerRef, }: StyledBottomSheetProps) => JSX.Element | null;
|
|
72
|
+
export declare const StyledBottomSheet: ({ dataTest, id, open, onClose, title, ariaLabel, children, viewResultsAction, resetAction, footerActions, resultCount, locale, closeLabel, className, registerBackClose, ownerRef, triggerRef, }: StyledBottomSheetProps) => JSX.Element | null;
|