asma-ui-core 3.118.0 → 3.119.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/dist/asma-ui-core.css +1 -1
- package/dist/components/utils/popover/PopoverAnatomy.js +22 -17
- package/dist/components/utils/popover/PopoverSheet.js +165 -123
- package/dist/hooks/useFocusTrap.hook.js +7 -7
- package/dist/src/components/utils/popover/PopoverAnatomy.d.ts +6 -1
- package/dist/src/components/utils/popover/PopoverSheet.d.ts +13 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as d } from "../../../helpers/cn.js";
|
|
2
2
|
import { CloseIcon as c } from "../../icons/close-icon/CloseIcon.js";
|
|
3
3
|
import { StyledButton as h } from "../../inputs/button/StyledButton.js";
|
|
4
4
|
import { useScrollGutter as u } from "./useScrollGutter.js";
|
|
5
5
|
import { useRef as v } from "react";
|
|
6
|
-
import { Fragment as
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
6
|
+
import { Fragment as _, jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
var g = 40, j = "relative box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[0px_4px_40px_0px_#22213366]", b = "pointer-events-none absolute inset-0 rounded-[inherit] shadow-[inset_0_0_0_1px_var(--colors-delta-300)]", k = ({ dataTest: a, title: t, titleId: m, children: p, viewResultsAction: r, resetAction: o, footerActions: i, closeLabel: f, onClose: x }) => {
|
|
8
|
+
const n = v(null), s = u(n);
|
|
9
|
+
return /* @__PURE__ */ l(_, { children: [
|
|
10
|
+
/* @__PURE__ */ l("div", {
|
|
11
11
|
className: "relative flex min-h-0 flex-1 flex-col",
|
|
12
12
|
children: [
|
|
13
13
|
t && /* @__PURE__ */ e("div", {
|
|
@@ -16,18 +16,18 @@ var _ = 40, j = "box-border flex flex-col overflow-hidden rounded-lg bg-white te
|
|
|
16
16
|
children: t
|
|
17
17
|
}),
|
|
18
18
|
/* @__PURE__ */ e("div", {
|
|
19
|
-
ref:
|
|
20
|
-
className:
|
|
21
|
-
style: { paddingRight: Math.max(0,
|
|
22
|
-
children:
|
|
19
|
+
ref: n,
|
|
20
|
+
className: d("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto py-2 pl-4 [scrollbar-gutter:stable]", !t && s.overflows && "mt-10"),
|
|
21
|
+
style: { paddingRight: Math.max(0, g - s.width) },
|
|
22
|
+
children: p
|
|
23
23
|
}),
|
|
24
24
|
/* @__PURE__ */ e("div", {
|
|
25
25
|
className: "absolute right-0 top-0",
|
|
26
26
|
children: /* @__PURE__ */ e(h, {
|
|
27
|
-
dataTest: `${
|
|
27
|
+
dataTest: `${a}-close`,
|
|
28
28
|
variant: "textGray",
|
|
29
29
|
type: "button",
|
|
30
|
-
"aria-label":
|
|
30
|
+
"aria-label": f,
|
|
31
31
|
onClick: x,
|
|
32
32
|
startIcon: /* @__PURE__ */ e(c, {
|
|
33
33
|
width: 24,
|
|
@@ -37,13 +37,18 @@ var _ = 40, j = "box-border flex flex-col overflow-hidden rounded-lg bg-white te
|
|
|
37
37
|
})
|
|
38
38
|
]
|
|
39
39
|
}),
|
|
40
|
-
(
|
|
41
|
-
className:
|
|
42
|
-
children: [
|
|
40
|
+
(r ?? o) && /* @__PURE__ */ l("div", {
|
|
41
|
+
className: d("flex shrink-0 items-start p-1", r ? "justify-between" : "justify-end"),
|
|
42
|
+
children: [r, o]
|
|
43
43
|
}),
|
|
44
|
-
|
|
44
|
+
i && /* @__PURE__ */ e("div", {
|
|
45
45
|
className: "flex shrink-0 flex-col items-end p-3",
|
|
46
|
-
children:
|
|
46
|
+
children: i
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ e("span", {
|
|
49
|
+
"aria-hidden": !0,
|
|
50
|
+
"data-test": `${a}-edge`,
|
|
51
|
+
className: b
|
|
47
52
|
})
|
|
48
53
|
] });
|
|
49
54
|
};
|
|
@@ -1,181 +1,223 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { firstTabbable as
|
|
3
|
-
import { TOP_LAYER_PROPS as
|
|
4
|
-
import { StyledButton as
|
|
5
|
-
import { useMobileMediaQuery as
|
|
6
|
-
import { OverlayBackOwnerContext as
|
|
7
|
-
import { useDebouncedValue as
|
|
8
|
-
import { useFocusTrap as
|
|
9
|
-
import { formatResultsLabel as
|
|
10
|
-
import { StyledBottomSheet as
|
|
11
|
-
import { PopoverAnatomy as
|
|
12
|
-
import { useCallback as
|
|
13
|
-
import { Fragment as
|
|
14
|
-
import { FloatingPortal as
|
|
15
|
-
var
|
|
1
|
+
import { cn as Oe } from "../../../helpers/cn.js";
|
|
2
|
+
import { firstTabbable as oe } from "../../../helpers/focusable.js";
|
|
3
|
+
import { TOP_LAYER_PROPS as Te, TOP_LAYER_RESET_STYLE as Ce, getOpenModalDialogAncestor as Se, shouldUsePopoverTopLayer as Ie, useTopLayerRef as Me } from "../../../hooks/useTopLayer.hook.js";
|
|
4
|
+
import { StyledButton as _e } from "../../inputs/button/StyledButton.js";
|
|
5
|
+
import { useMobileMediaQuery as ke } from "../../../hooks/useMediaQuery.hook.js";
|
|
6
|
+
import { OverlayBackOwnerContext as He, requestCloseTopOverlayBack as We, useBackCloses as Be } from "../../../hooks/useBackCloses.hook.js";
|
|
7
|
+
import { useDebouncedValue as De } from "../../../hooks/useDebouncedValue.hook.js";
|
|
8
|
+
import { useFocusTrap as qe } from "../../../hooks/useFocusTrap.hook.js";
|
|
9
|
+
import { formatResultsLabel as $e } from "../bottom-sheet/formatResultsLabel.js";
|
|
10
|
+
import { StyledBottomSheet as Ne } from "../bottom-sheet/StyledBottomSheet.js";
|
|
11
|
+
import { PopoverAnatomy as Xe } from "./PopoverAnatomy.js";
|
|
12
|
+
import { useCallback as d, useEffect as v, useId as je, useRef as f, useState as l } from "react";
|
|
13
|
+
import { Fragment as ne, jsx as m, jsxs as re } from "react/jsx-runtime";
|
|
14
|
+
import { FloatingPortal as Ke, autoUpdate as Ue, flip as Ye, offset as ze, shift as Ve, size as Ge, useDismiss as Qe, useFloating as Je, useInteractions as Ze, useMergeRefs as et } from "@floating-ui/react";
|
|
15
|
+
var C = 240, tt = {
|
|
16
16
|
info: 472,
|
|
17
17
|
action: 472
|
|
18
|
-
},
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
}, [
|
|
18
|
+
}, ie = 0.6, se = "calc(100vw - 32px)", wt = ({ dataTest: p, renderTrigger: S, variant: I = "info", title: w, children: M, viewResultsAction: _, resetAction: k, footerActions: H, resultCount: E, closeLabel: W = "Lukk", ariaLabel: B, onOpenChange: D, className: q, align: $ = "auto", ignoreOutside: N }) => {
|
|
19
|
+
const g = je(), X = `${g}-title`, [o, ae] = l(!1), [j, ce] = l(), [le, K] = l(), [ue, de] = l("start"), [R, U] = l(), [fe, Y] = l(C), u = ke(), n = I === "action", me = u && !n, y = u && n, P = d((e) => {
|
|
20
|
+
ae(e), D?.(e);
|
|
21
|
+
}, [D]), { refs: b, floatingStyles: pe, context: ge, placement: z, isPositioned: he } = Je({
|
|
22
22
|
open: o,
|
|
23
|
-
onOpenChange:
|
|
24
|
-
placement: "bottom
|
|
23
|
+
onOpenChange: P,
|
|
24
|
+
placement: `${R ?? "bottom"}-${ue}`,
|
|
25
25
|
strategy: "fixed",
|
|
26
|
-
whileElementsMounted:
|
|
26
|
+
whileElementsMounted: Ue,
|
|
27
27
|
middleware: [
|
|
28
|
-
|
|
29
|
-
...
|
|
30
|
-
Te({ padding: 8 }),
|
|
31
|
-
Ee({
|
|
28
|
+
ze(8),
|
|
29
|
+
...me || R ? [] : [Ye({
|
|
32
30
|
padding: 8,
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
crossAxis: !1,
|
|
32
|
+
flipAlignment: !1
|
|
33
|
+
})],
|
|
34
|
+
Ve({ padding: 8 }),
|
|
35
|
+
Ge({
|
|
36
|
+
padding: 8,
|
|
37
|
+
apply({ availableHeight: e, rects: t }) {
|
|
38
|
+
K(Math.min(e, Math.round(window.innerHeight * ie))), u || Y((a) => Math.max(a, t.floating.width));
|
|
35
39
|
}
|
|
36
40
|
})
|
|
37
41
|
]
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
});
|
|
43
|
+
o && he && !R && U(z.startsWith("top") ? "top" : "bottom");
|
|
44
|
+
const F = Ie(j), c = f(null), [r, ve] = l(null), we = d((e) => {
|
|
45
|
+
c.current = e, ve(e);
|
|
46
|
+
}, []), ye = et([Me(b.setFloating, F), we]), A = f(null), Pe = d((e) => {
|
|
47
|
+
A.current = e, b.setReference(e);
|
|
48
|
+
}, [b]), V = f(null), L = N?.length ? N.join(",") : void 0, G = f(L);
|
|
49
|
+
v(() => {
|
|
50
|
+
G.current = L;
|
|
51
|
+
}, [L]);
|
|
52
|
+
const h = d((e) => {
|
|
53
|
+
if (!(e instanceof Element)) return !1;
|
|
54
|
+
if (c.current?.contains(e) || A.current?.contains(e) || V.current === e) return !0;
|
|
55
|
+
const t = G.current;
|
|
56
|
+
return t !== void 0 && e.closest(t) !== null;
|
|
57
|
+
}, []), Q = f(null), xe = d((e) => {
|
|
58
|
+
V.current = e.target, e.target instanceof HTMLElement && c.current?.contains(e.target) && (Q.current = e.target);
|
|
59
|
+
}, []), { getFloatingProps: Ee } = Ze([Qe(ge, {
|
|
60
|
+
enabled: !y,
|
|
61
|
+
escapeKey: !1,
|
|
41
62
|
outsidePress: (e) => {
|
|
42
|
-
const
|
|
43
|
-
|
|
63
|
+
const t = e.target;
|
|
64
|
+
if (!(t instanceof Element)) return !0;
|
|
65
|
+
if (h(t) || t.closest("[data-floating-ui-portal]")) return !1;
|
|
66
|
+
const a = t.closest('dialog[open], [role="dialog"]');
|
|
67
|
+
return !a || a.contains(c.current);
|
|
44
68
|
}
|
|
45
|
-
})]),
|
|
46
|
-
|
|
47
|
-
}, [
|
|
48
|
-
|
|
49
|
-
}, [P]), n = x(() => {
|
|
50
|
-
g(!1);
|
|
51
|
-
}, [g]);
|
|
52
|
-
ge({
|
|
69
|
+
})]), s = d(() => {
|
|
70
|
+
P(!1);
|
|
71
|
+
}, [P]);
|
|
72
|
+
Be({
|
|
53
73
|
active: o,
|
|
54
|
-
requestClose:
|
|
74
|
+
requestClose: s,
|
|
55
75
|
ownerRef: c
|
|
56
|
-
}),
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
76
|
+
}), v(() => {
|
|
77
|
+
if (!o || y) return;
|
|
78
|
+
const e = (t) => {
|
|
79
|
+
t.key !== "Escape" || t.defaultPrevented || t.isComposing || (t.preventDefault(), t.stopImmediatePropagation(), We(t));
|
|
80
|
+
};
|
|
81
|
+
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
82
|
+
}, [o, y]), qe(o && n && r !== null, c);
|
|
83
|
+
const [J, Re] = l(!1);
|
|
84
|
+
v(() => {
|
|
85
|
+
if (!r || n && !J) return;
|
|
60
86
|
const e = requestAnimationFrame(() => {
|
|
61
|
-
(
|
|
87
|
+
(n ? oe(r) : r)?.focus({ preventScroll: !0 });
|
|
62
88
|
});
|
|
63
89
|
return () => {
|
|
64
90
|
cancelAnimationFrame(e);
|
|
65
91
|
};
|
|
66
92
|
}, [
|
|
67
93
|
r,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
]),
|
|
71
|
-
if (!r
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
94
|
+
n,
|
|
95
|
+
J
|
|
96
|
+
]), v(() => {
|
|
97
|
+
if (!r) return;
|
|
98
|
+
let e = 0;
|
|
99
|
+
const t = () => {
|
|
100
|
+
cancelAnimationFrame(e), e = requestAnimationFrame(() => {
|
|
101
|
+
const i = document.activeElement;
|
|
102
|
+
if (!r.isConnected || i && i !== document.body && h(i)) return;
|
|
103
|
+
const T = Q.current;
|
|
104
|
+
(T?.isConnected && r.contains(T) ? T : oe(r) ?? r).focus({ preventScroll: !0 });
|
|
105
|
+
});
|
|
106
|
+
}, a = (i) => {
|
|
107
|
+
i.relatedTarget === null && s();
|
|
108
|
+
}, ee = (i) => {
|
|
109
|
+
i.relatedTarget === null && h(i.target) && t();
|
|
110
|
+
}, te = (i) => {
|
|
111
|
+
!r.isConnected || h(i.target) || (n ? t() : s());
|
|
75
112
|
};
|
|
76
|
-
return r.addEventListener("focusout",
|
|
77
|
-
r.removeEventListener("focusout",
|
|
113
|
+
return n ? document.addEventListener("focusout", ee) : r.addEventListener("focusout", a), document.addEventListener("focusin", te), () => {
|
|
114
|
+
cancelAnimationFrame(e), document.removeEventListener("focusout", ee), r.removeEventListener("focusout", a), document.removeEventListener("focusin", te);
|
|
78
115
|
};
|
|
79
116
|
}, [
|
|
80
117
|
r,
|
|
81
|
-
|
|
82
|
-
|
|
118
|
+
n,
|
|
119
|
+
s,
|
|
120
|
+
h
|
|
83
121
|
]);
|
|
84
|
-
const
|
|
85
|
-
|
|
122
|
+
const O = f(!1);
|
|
123
|
+
v(() => {
|
|
86
124
|
if (o) {
|
|
87
|
-
|
|
125
|
+
O.current = !0;
|
|
88
126
|
return;
|
|
89
127
|
}
|
|
90
|
-
if (!
|
|
91
|
-
|
|
92
|
-
const e =
|
|
128
|
+
if (!O.current) return;
|
|
129
|
+
O.current = !1;
|
|
130
|
+
const e = A.current;
|
|
93
131
|
if (!e) return;
|
|
94
|
-
const
|
|
132
|
+
const t = requestAnimationFrame(() => {
|
|
95
133
|
document.activeElement === document.body && e.focus();
|
|
96
134
|
});
|
|
97
135
|
return () => {
|
|
98
|
-
cancelAnimationFrame(
|
|
136
|
+
cancelAnimationFrame(t);
|
|
99
137
|
};
|
|
100
138
|
}, [o]);
|
|
101
|
-
const
|
|
102
|
-
ref:
|
|
139
|
+
const Z = {
|
|
140
|
+
ref: Pe,
|
|
103
141
|
isOpen: o,
|
|
104
142
|
triggerProps: {
|
|
105
143
|
onClick: (e) => {
|
|
106
144
|
if (o) {
|
|
107
|
-
|
|
145
|
+
s();
|
|
108
146
|
return;
|
|
109
147
|
}
|
|
110
|
-
|
|
148
|
+
ce(Se(e.currentTarget));
|
|
149
|
+
const t = e.currentTarget.getBoundingClientRect(), a = t.left + t.width / 2 > window.innerWidth / 2;
|
|
150
|
+
de($ === "auto" ? a ? "end" : "start" : $), U(void 0), Y(C), K(Math.round(window.innerHeight * ie)), Re(e.detail === 0), P(!0);
|
|
111
151
|
},
|
|
112
152
|
"aria-expanded": o,
|
|
113
|
-
"aria-controls": o ?
|
|
114
|
-
"aria-haspopup":
|
|
115
|
-
"aria-describedby": !
|
|
153
|
+
"aria-controls": o ? g : void 0,
|
|
154
|
+
"aria-haspopup": n ? "dialog" : void 0,
|
|
155
|
+
"aria-describedby": !n && o ? g : void 0
|
|
116
156
|
}
|
|
117
|
-
},
|
|
118
|
-
dataTest: `${
|
|
157
|
+
}, x = (e) => typeof e == "function" ? e({ close: s }) : e, be = De(E, 500), Fe = _ ?? (E === void 0 ? void 0 : /* @__PURE__ */ m(_e, {
|
|
158
|
+
dataTest: `${p}-view-results`,
|
|
119
159
|
type: "button",
|
|
120
160
|
variant: "text",
|
|
121
|
-
onClick:
|
|
122
|
-
children:
|
|
123
|
-
})),
|
|
124
|
-
return
|
|
125
|
-
id:
|
|
126
|
-
dataTest:
|
|
161
|
+
onClick: s,
|
|
162
|
+
children: $e(be)
|
|
163
|
+
})), Ae = u ? se : tt[I], Le = u ? se : void 0;
|
|
164
|
+
return y ? /* @__PURE__ */ re(ne, { children: [S(Z), /* @__PURE__ */ m(Ne, {
|
|
165
|
+
id: g,
|
|
166
|
+
dataTest: p,
|
|
127
167
|
open: o,
|
|
128
|
-
onClose:
|
|
168
|
+
onClose: s,
|
|
129
169
|
registerBackClose: !1,
|
|
130
170
|
ownerRef: c,
|
|
131
|
-
title:
|
|
132
|
-
ariaLabel:
|
|
133
|
-
viewResultsAction:
|
|
134
|
-
resetAction:
|
|
135
|
-
footerActions:
|
|
136
|
-
resultCount:
|
|
137
|
-
closeLabel:
|
|
138
|
-
className:
|
|
139
|
-
children:
|
|
140
|
-
})] }) : /* @__PURE__ */
|
|
141
|
-
root:
|
|
142
|
-
children: /* @__PURE__ */
|
|
143
|
-
...
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
"data-
|
|
148
|
-
|
|
149
|
-
"
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
171
|
+
title: w,
|
|
172
|
+
ariaLabel: B,
|
|
173
|
+
viewResultsAction: _,
|
|
174
|
+
resetAction: k,
|
|
175
|
+
footerActions: H,
|
|
176
|
+
resultCount: E,
|
|
177
|
+
closeLabel: W,
|
|
178
|
+
className: q,
|
|
179
|
+
children: M
|
|
180
|
+
})] }) : /* @__PURE__ */ re(ne, { children: [S(Z), o && /* @__PURE__ */ m(Ke, {
|
|
181
|
+
root: j,
|
|
182
|
+
children: /* @__PURE__ */ m("div", {
|
|
183
|
+
...Ee(),
|
|
184
|
+
onFocusCapture: xe,
|
|
185
|
+
ref: ye,
|
|
186
|
+
id: g,
|
|
187
|
+
"data-placement": z,
|
|
188
|
+
"data-test": p,
|
|
189
|
+
"data-testid": p,
|
|
190
|
+
role: n ? "dialog" : void 0,
|
|
191
|
+
"aria-labelledby": n && w ? X : void 0,
|
|
192
|
+
"aria-label": n && !w ? B : void 0,
|
|
193
|
+
tabIndex: n ? void 0 : -1,
|
|
194
|
+
...F ? Te : {},
|
|
153
195
|
style: {
|
|
154
|
-
...
|
|
155
|
-
|
|
156
|
-
minWidth:
|
|
157
|
-
width:
|
|
158
|
-
maxWidth:
|
|
159
|
-
maxHeight:
|
|
196
|
+
...F ? Ce : {},
|
|
197
|
+
...pe,
|
|
198
|
+
minWidth: u ? C : fe,
|
|
199
|
+
width: Le,
|
|
200
|
+
maxWidth: Ae,
|
|
201
|
+
maxHeight: le
|
|
160
202
|
},
|
|
161
|
-
className:
|
|
162
|
-
children: /* @__PURE__ */
|
|
203
|
+
className: Oe("z-[1300]", "relative box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[0px_4px_40px_0px_#22213366]", q),
|
|
204
|
+
children: /* @__PURE__ */ m(He.Provider, {
|
|
163
205
|
value: c,
|
|
164
|
-
children: /* @__PURE__ */
|
|
165
|
-
dataTest:
|
|
166
|
-
title:
|
|
167
|
-
titleId:
|
|
168
|
-
viewResultsAction:
|
|
169
|
-
resetAction:
|
|
170
|
-
footerActions:
|
|
171
|
-
closeLabel:
|
|
172
|
-
onClose:
|
|
173
|
-
children:
|
|
206
|
+
children: /* @__PURE__ */ m(Xe, {
|
|
207
|
+
dataTest: p,
|
|
208
|
+
title: w,
|
|
209
|
+
titleId: X,
|
|
210
|
+
viewResultsAction: x(Fe),
|
|
211
|
+
resetAction: x(k),
|
|
212
|
+
footerActions: x(H),
|
|
213
|
+
closeLabel: W,
|
|
214
|
+
onClose: s,
|
|
215
|
+
children: x(M)
|
|
174
216
|
})
|
|
175
217
|
})
|
|
176
218
|
})
|
|
177
219
|
})] });
|
|
178
220
|
};
|
|
179
221
|
export {
|
|
180
|
-
|
|
222
|
+
wt as PopoverSheet
|
|
181
223
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { tabbableWithin as p } from "../helpers/focusable.js";
|
|
2
2
|
import { useEffect as d, useRef as y } from "react";
|
|
3
|
-
var E = (c, i,
|
|
4
|
-
const f = y(
|
|
3
|
+
var E = (c, i, u) => {
|
|
4
|
+
const f = y(u);
|
|
5
5
|
d(() => {
|
|
6
|
-
f.current =
|
|
7
|
-
}, [
|
|
6
|
+
f.current = u;
|
|
7
|
+
}, [u]), d(() => {
|
|
8
8
|
if (!c) return;
|
|
9
9
|
const t = i.current;
|
|
10
10
|
if (!t) return;
|
|
@@ -17,14 +17,14 @@ var E = (c, i, s) => {
|
|
|
17
17
|
f.current?.();
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
if (e.key !== "Tab") return;
|
|
20
|
+
if (e.key !== "Tab" || e.defaultPrevented) return;
|
|
21
21
|
const r = p(t);
|
|
22
22
|
if (r.length === 0) {
|
|
23
23
|
e.preventDefault();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
e.shiftKey && (o ===
|
|
26
|
+
const s = r[0], m = r[r.length - 1], o = document.activeElement;
|
|
27
|
+
e.shiftKey && (o === s || o === t) ? (e.preventDefault(), m?.focus()) : (!e.shiftKey && o === m || !e.shiftKey && o === t) && (e.preventDefault(), s?.focus());
|
|
28
28
|
};
|
|
29
29
|
return document.addEventListener("keydown", l), () => {
|
|
30
30
|
cancelAnimationFrame(b), document.removeEventListener("keydown", l), a === null ? t.removeAttribute("tabindex") : t.setAttribute("tabindex", a), requestAnimationFrame(() => {
|
|
@@ -9,13 +9,18 @@ import { ReactNode } from 'react';
|
|
|
9
9
|
* 40px body padding) needs the full 472px of the frame — with a border only 470px remain and the
|
|
10
10
|
* pair wraps. Figma's stroke takes no width from autolayout, and the inset shadow matches that.
|
|
11
11
|
*
|
|
12
|
+
* The ring is not on this surface itself: an element's own inset shadow paints beneath its
|
|
13
|
+
* children, so the Close button's hover fill in the top-right corner covered it. `PopoverAnatomy`
|
|
14
|
+
* draws it as its last, absolutely positioned layer (`SURFACE_EDGE_CLASSNAME`), above the content.
|
|
15
|
+
* `relative` makes the surface that layer's containing block where no floating position is set.
|
|
16
|
+
*
|
|
12
17
|
* `box-border` is load-bearing, not noise: this package builds Tailwind with `preflight: false`, so
|
|
13
18
|
* without it `box-sizing` falls back to `content-box` and a 472px max-width renders 474.
|
|
14
19
|
*
|
|
15
20
|
* Positioning (`z-index`, the floating transform, the top-layer props) deliberately stays with the
|
|
16
21
|
* caller, so the Gallery story can render the same surface statically in a grid.
|
|
17
22
|
*/
|
|
18
|
-
export declare const POPOVER_SURFACE_CLASSNAME = "box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[
|
|
23
|
+
export declare const POPOVER_SURFACE_CLASSNAME = "relative box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[0px_4px_40px_0px_#22213366]";
|
|
19
24
|
export interface PopoverAnatomyProps {
|
|
20
25
|
dataTest: string;
|
|
21
26
|
title?: ReactNode;
|
|
@@ -60,6 +60,18 @@ export interface PopoverSheetProps {
|
|
|
60
60
|
onOpenChange?: (isOpen: boolean) => void;
|
|
61
61
|
/** @figmaProp none — style escape hatch, applied to the surface */
|
|
62
62
|
className?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Which trigger edge the surface lines up with. `auto` picks once per open: `end` when the
|
|
65
|
+
* trigger's centre is in the right half of the viewport, otherwise `start`.
|
|
66
|
+
* @figmaProp none — behavioral
|
|
67
|
+
*/
|
|
68
|
+
align?: 'start' | 'end' | 'auto';
|
|
69
|
+
/**
|
|
70
|
+
* CSS selectors for overlays rendered outside React (e.g. DevExtreme's `.dx-overlay-wrapper`).
|
|
71
|
+
* Pressing or focusing inside them counts as inside the surface.
|
|
72
|
+
* @figmaProp none — behavioral
|
|
73
|
+
*/
|
|
74
|
+
ignoreOutside?: string[];
|
|
63
75
|
}
|
|
64
76
|
/**
|
|
65
77
|
* ASMA Design System **Popover** (ASMA-8183) — an anchored overlay with the DS surface, an optional
|
|
@@ -83,4 +95,4 @@ export interface PopoverSheetProps {
|
|
|
83
95
|
* Separate from {@link StyledPopover}, which stays as the MUI-parity positioning primitive its eight
|
|
84
96
|
* internal consumers still depend on; those migrate here gradually.
|
|
85
97
|
*/
|
|
86
|
-
export declare const PopoverSheet: ({ dataTest, renderTrigger, variant, title, children, viewResultsAction, resetAction, footerActions, resultCount, closeLabel, ariaLabel, onOpenChange, className, }: PopoverSheetProps) => JSX.Element;
|
|
98
|
+
export declare const PopoverSheet: ({ dataTest, renderTrigger, variant, title, children, viewResultsAction, resetAction, footerActions, resultCount, closeLabel, ariaLabel, onOpenChange, className, align, ignoreOutside, }: PopoverSheetProps) => JSX.Element;
|