asma-ui-core 3.118.0 → 3.120.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/filter-menu/StyledFilterButton.js +19 -18
- package/dist/components/utils/filter-menu/StyledFilterMenu.js +48 -47
- package/dist/components/utils/filter-menu/filterButtonText.js +8 -0
- 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/filter-menu/StyledFilterButton.d.ts +5 -2
- package/dist/src/components/utils/filter-menu/StyledFilterMenu.d.ts +5 -2
- package/dist/src/components/utils/filter-menu/filterButtonText.d.ts +11 -0
- 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,32 +1,33 @@
|
|
|
1
|
-
import { StyledBadge as
|
|
2
|
-
import { FilterIcon as
|
|
3
|
-
import { StyledButton as
|
|
4
|
-
import { useDynamicToolbarLayout as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { StyledBadge as f } from "../../data-display/badge/StyledBadge.js";
|
|
2
|
+
import { FilterIcon as p } from "../../icons/filter-icon/FilterIcon.js";
|
|
3
|
+
import { StyledButton as h } from "../../inputs/button/StyledButton.js";
|
|
4
|
+
import { useDynamicToolbarLayout as u } from "../../custom/module/header-layout/DynamicToolbarLayoutContext.js";
|
|
5
|
+
import { filterButtonText as g, isFilterDotShown as y } from "./filterButtonText.js";
|
|
6
|
+
import b from "clsx";
|
|
7
|
+
import { Fragment as x, jsx as o, jsxs as v } from "react/jsx-runtime";
|
|
8
|
+
var j = ({ filterIsActive: l, activeCount: r, label: a, hideLabel: n, size: t = "large", variant: m = "outlined", ...s }) => {
|
|
9
|
+
const { filterIconOnly: d } = u(), e = n ?? d, i = g(a, r), c = y(l, r);
|
|
10
|
+
return /* @__PURE__ */ o(x, { children: /* @__PURE__ */ v("div", {
|
|
10
11
|
className: "relative h-fit w-fit",
|
|
11
|
-
children: [/* @__PURE__ */
|
|
12
|
-
...
|
|
12
|
+
children: [/* @__PURE__ */ o(h, {
|
|
13
|
+
...s,
|
|
13
14
|
type: "button",
|
|
14
|
-
"aria-label": e ?
|
|
15
|
-
startIcon: /* @__PURE__ */
|
|
15
|
+
"aria-label": e ? i : void 0,
|
|
16
|
+
startIcon: /* @__PURE__ */ o(p, {
|
|
16
17
|
width: t === "large" ? 24 : 20,
|
|
17
18
|
height: t === "large" ? 24 : 20
|
|
18
19
|
}),
|
|
19
|
-
variant:
|
|
20
|
+
variant: m,
|
|
20
21
|
size: t,
|
|
21
|
-
children: !e &&
|
|
22
|
-
}),
|
|
22
|
+
children: !e && i
|
|
23
|
+
}), c && /* @__PURE__ */ o(f, {
|
|
23
24
|
dataTest: "filter-button-active-dot",
|
|
24
25
|
variant: "dot",
|
|
25
26
|
purpose: "filter",
|
|
26
|
-
className:
|
|
27
|
+
className: b("absolute", t === "large" ? "right-2 top-2" : "right-1 top-1")
|
|
27
28
|
})]
|
|
28
29
|
}) });
|
|
29
30
|
};
|
|
30
31
|
export {
|
|
31
|
-
|
|
32
|
+
j as StyledFilterButton
|
|
32
33
|
};
|
|
@@ -1,75 +1,76 @@
|
|
|
1
|
-
import { StyledBadge as
|
|
2
|
-
import { FilterIcon as
|
|
3
|
-
import { StyledButton as
|
|
1
|
+
import { StyledBadge as S } from "../../data-display/badge/StyledBadge.js";
|
|
2
|
+
import { FilterIcon as E } from "../../icons/filter-icon/FilterIcon.js";
|
|
3
|
+
import { StyledButton as k } from "../../inputs/button/StyledButton.js";
|
|
4
4
|
import { StyledPopover as F } from "../popover/StyledPopover.js";
|
|
5
|
-
import { useDynamicToolbarLayout as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
t
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
import { useDynamicToolbarLayout as I } from "../../custom/module/header-layout/DynamicToolbarLayoutContext.js";
|
|
6
|
+
import { filterButtonText as w, isFilterDotShown as C } from "./filterButtonText.js";
|
|
7
|
+
import N from "clsx";
|
|
8
|
+
import c, { useState as B } from "react";
|
|
9
|
+
import { Fragment as D, jsx as l, jsxs as A } from "react/jsx-runtime";
|
|
10
|
+
var T = () => {
|
|
11
|
+
const [r, n] = B(null), i = (t) => {
|
|
12
|
+
const s = t.currentTarget;
|
|
13
|
+
n(s);
|
|
14
|
+
}, a = () => {
|
|
15
|
+
n(null);
|
|
15
16
|
};
|
|
16
17
|
return {
|
|
17
18
|
anchorEl: r,
|
|
18
|
-
onClose:
|
|
19
|
-
onAnchorClick: (
|
|
20
|
-
r ?
|
|
19
|
+
onClose: a,
|
|
20
|
+
onAnchorClick: (t) => {
|
|
21
|
+
r ? a() : i(t);
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
|
-
},
|
|
24
|
-
const { onAnchorClick: u, onClose: m, anchorEl:
|
|
25
|
-
isOpen: !!
|
|
24
|
+
}, $ = (r) => c.isValidElement(r) || typeof r == "string" || typeof r == "number" || r === null || Array.isArray(r), K = ({ filterIsActive: r, activeCount: n, popoverContent: i, dataTest: a, disabled: h, size: t = "large", variant: s = "outlined", popoverProps: e, anchorNode: d, label: O, hideLabel: b }) => {
|
|
25
|
+
const { onAnchorClick: u, onClose: m, anchorEl: o } = T(), { filterIconOnly: v } = I(), f = b ?? v, g = w(O, n), x = C(r, n), p = d?.({
|
|
26
|
+
isOpen: !!o,
|
|
26
27
|
onClose: m
|
|
27
|
-
}),
|
|
28
|
-
return /* @__PURE__ */
|
|
28
|
+
}), y = c.useId();
|
|
29
|
+
return /* @__PURE__ */ A(D, { children: [/* @__PURE__ */ A("div", {
|
|
29
30
|
className: "relative h-fit w-fit",
|
|
30
|
-
children: [d &&
|
|
31
|
+
children: [d && c.isValidElement(p) ? c.cloneElement(p, { onClick: u }) : /* @__PURE__ */ l(k, {
|
|
31
32
|
type: "button",
|
|
32
|
-
disabled:
|
|
33
|
-
variant:
|
|
34
|
-
startIcon: /* @__PURE__ */
|
|
35
|
-
width:
|
|
36
|
-
height:
|
|
33
|
+
disabled: h,
|
|
34
|
+
variant: s,
|
|
35
|
+
startIcon: /* @__PURE__ */ l(E, {
|
|
36
|
+
width: t === "large" ? 24 : 20,
|
|
37
|
+
height: t === "large" ? 24 : 20
|
|
37
38
|
}),
|
|
38
39
|
onClick: u,
|
|
39
|
-
size:
|
|
40
|
-
dataTest:
|
|
41
|
-
"aria-label":
|
|
40
|
+
size: t,
|
|
41
|
+
dataTest: a,
|
|
42
|
+
"aria-label": f ? g : void 0,
|
|
42
43
|
"aria-haspopup": "true",
|
|
43
|
-
"aria-expanded": !!
|
|
44
|
-
"aria-controls":
|
|
45
|
-
children: !
|
|
46
|
-
}),
|
|
47
|
-
dataTest: `${
|
|
44
|
+
"aria-expanded": !!o,
|
|
45
|
+
"aria-controls": o ? y : void 0,
|
|
46
|
+
children: !f && g
|
|
47
|
+
}), x && /* @__PURE__ */ l(S, {
|
|
48
|
+
dataTest: `${a}-active-dot`,
|
|
48
49
|
variant: "dot",
|
|
49
50
|
purpose: "filter",
|
|
50
|
-
className:
|
|
51
|
+
className: N("absolute", t === "large" ? "right-2 top-2" : "right-1 top-1")
|
|
51
52
|
})]
|
|
52
|
-
}), /* @__PURE__ */
|
|
53
|
-
...
|
|
54
|
-
id:
|
|
55
|
-
open: !!
|
|
56
|
-
anchorEl:
|
|
53
|
+
}), /* @__PURE__ */ l(F, {
|
|
54
|
+
...e,
|
|
55
|
+
id: y,
|
|
56
|
+
open: !!o,
|
|
57
|
+
anchorEl: o,
|
|
57
58
|
onClose: m,
|
|
58
|
-
anchorOrigin:
|
|
59
|
+
anchorOrigin: e?.anchorOrigin ?? {
|
|
59
60
|
vertical: "bottom",
|
|
60
61
|
horizontal: "right"
|
|
61
62
|
},
|
|
62
|
-
transformOrigin:
|
|
63
|
+
transformOrigin: e?.transformOrigin ?? {
|
|
63
64
|
vertical: "top",
|
|
64
65
|
horizontal: "right"
|
|
65
66
|
},
|
|
66
|
-
className:
|
|
67
|
-
children:
|
|
68
|
-
isOpen: !!
|
|
67
|
+
className: e?.className ?? "my-1",
|
|
68
|
+
children: $(i) ? i : i({
|
|
69
|
+
isOpen: !!o,
|
|
69
70
|
onClose: m
|
|
70
71
|
})
|
|
71
72
|
})] });
|
|
72
73
|
};
|
|
73
74
|
export {
|
|
74
|
-
|
|
75
|
+
K as StyledFilterMenu
|
|
75
76
|
};
|
|
@@ -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
|
};
|