asma-ui-core 3.108.2 → 3.108.4

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.
Files changed (23) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/feedback/dialog/StyledDialog.js +139 -96
  3. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +180 -171
  4. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +115 -106
  5. package/dist/components/inputs/select/StyledSelect.js +56 -50
  6. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +102 -96
  7. package/dist/components/navigation/drawer/StyledDrawer.js +55 -51
  8. package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +158 -118
  9. package/dist/components/utils/popover/PopoverSheet.js +95 -85
  10. package/dist/components/utils/popover/StyledPopover.js +81 -71
  11. package/dist/datetime/components/date-picker/StyledDatePicker.js +33 -28
  12. package/dist/datetime/components/date-picker/components/StyledCalendarPicker.js +9 -8
  13. package/dist/datetime/components/time-picker/StyledTimePicker.js +56 -51
  14. package/dist/datetime/hooks/useBackNavigationClose.hook.js +16 -7
  15. package/dist/hooks/useBackCloses.hook.js +100 -0
  16. package/dist/src/components/feedback/dialog/StyledDialog.d.ts +6 -1
  17. package/dist/src/components/navigation/drawer/StyledDrawer.d.ts +2 -0
  18. package/dist/src/components/utils/bottom-sheet/StyledBottomSheet.d.ts +6 -2
  19. package/dist/src/components/utils/popover/StyledPopover.d.ts +3 -1
  20. package/dist/src/datetime/hooks/useBackNavigationClose.hook.d.ts +2 -1
  21. package/dist/src/hooks/useBackCloses.hook.d.ts +101 -0
  22. package/dist/src/hooks/useBackCloses.hook.test.d.ts +1 -0
  23. package/package.json +1 -1
@@ -1,137 +1,177 @@
1
- import { cn as n } from "../../../helpers/cn.js";
2
- import { registerOpenModalDialog as A } from "../../../hooks/useTopLayer.hook.js";
3
- import { CloseIcon as H } from "../../icons/close-icon/CloseIcon.js";
4
- import { IndeterminateIcon as q } from "../../icons/indeterminate-icon/IndeterminateIcon.js";
5
- import { StyledButton as I } from "../../inputs/button/StyledButton.js";
6
- import { useShortViewportMediaQuery as G } from "../../../hooks/useMediaQuery.hook.js";
7
- import { useDebouncedValue as P } from "../../../hooks/useDebouncedValue.hook.js";
8
- import { useFocusTrap as Q } from "../../../hooks/useFocusTrap.hook.js";
9
- import { formatResultsLabel as Y } from "./formatResultsLabel.js";
10
- import { useBodyScrollLock as z } from "../../../hooks/useBodyScrollLock.hook.js";
11
- import J from "./StyledBottomSheet.module.js";
12
- import { useDragToDismiss as K } from "./useDragToDismiss.hook.js";
13
- import { useEffect as W, useId as X, useLayoutEffect as Z, useRef as d, useState as ee } from "react";
14
- import { jsx as t, jsxs as i } from "react/jsx-runtime";
15
- var te = 500, xe = ({ dataTest: r, id: D, open: a, onClose: o, title: s, ariaLabel: L, children: j, viewResultsAction: p, resetAction: F, footerActions: M, resultCount: h, closeLabel: _ = "Lukk", className: C }) => {
16
- const b = X(), m = d(null), x = d(null), v = d(null), [u, y] = ee(!1), O = G(), g = d(o);
17
- W(() => {
18
- g.current = o;
19
- }, [o]);
20
- const { dragHandleProps: $, dragOffset: w } = K(x, () => {
21
- g.current("drag");
1
+ import { cn as d } from "../../../helpers/cn.js";
2
+ import { registerOpenModalDialog as z } from "../../../hooks/useTopLayer.hook.js";
3
+ import { CloseIcon as J } from "../../icons/close-icon/CloseIcon.js";
4
+ import { IndeterminateIcon as W } from "../../icons/indeterminate-icon/IndeterminateIcon.js";
5
+ import { StyledButton as j } from "../../inputs/button/StyledButton.js";
6
+ import { useShortViewportMediaQuery as X } from "../../../hooks/useMediaQuery.hook.js";
7
+ import { OverlayBackOwnerContext as Z, isOverlayBackEnabled as P, requestCloseTopOverlayBack as x, useBackCloses as ee } from "../../../hooks/useBackCloses.hook.js";
8
+ import { useDebouncedValue as te } from "../../../hooks/useDebouncedValue.hook.js";
9
+ import { useFocusTrap as re } from "../../../hooks/useFocusTrap.hook.js";
10
+ import { formatResultsLabel as oe } from "./formatResultsLabel.js";
11
+ import { useBodyScrollLock as ne } from "../../../hooks/useBodyScrollLock.hook.js";
12
+ import ae from "./StyledBottomSheet.module.js";
13
+ import { useDragToDismiss as se } from "./useDragToDismiss.hook.js";
14
+ import { useEffect as y, useId as ie, useLayoutEffect as le, useRef as l, useState as ce } from "react";
15
+ import { jsx as o, jsxs as u } from "react/jsx-runtime";
16
+ var de = 500, Le = ({ dataTest: c, id: T, open: t, onClose: s, title: m, ariaLabel: _, children: q, viewResultsAction: g, resetAction: $, footerActions: A, resultCount: E, closeLabel: U = "Lukk", className: V, registerBackClose: H = !0, ownerRef: K }) => {
17
+ const k = ie(), i = l(null), S = l(null), N = l(null), R = K ?? i, h = l(!1), [b, L] = ce(!1), G = X(), f = l(s), B = l(t);
18
+ y(() => {
19
+ f.current = s, B.current = t;
20
+ }, [s, t]);
21
+ const { dragHandleProps: Q, dragOffset: C } = se(S, () => {
22
+ f.current("drag");
22
23
  });
23
- z(a), Q(a, m), Z(() => {
24
- const e = m.current;
25
- if (!a || !e) return;
26
- v.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.open || e.showModal(), e.focus({ preventScroll: !0 });
27
- const U = requestAnimationFrame(() => {
28
- y(!0);
29
- }), V = A(e);
24
+ ne(t), re(t, i), y(() => {
25
+ if (!t) return;
26
+ const e = (r) => {
27
+ r.key === "Escape" && (h.current = !0, window.setTimeout(() => {
28
+ h.current = !1;
29
+ }, 0));
30
+ }, n = (r) => {
31
+ if (r.key !== "Escape" || r.defaultPrevented) return;
32
+ const a = document.activeElement;
33
+ a instanceof Element && a.closest("dialog[open]") !== i.current || (r.preventDefault(), r.stopImmediatePropagation(), x(r));
34
+ };
35
+ return window.addEventListener("keydown", e, !0), window.addEventListener("keydown", n), () => {
36
+ window.removeEventListener("keydown", e, !0), window.removeEventListener("keydown", n);
37
+ };
38
+ }, [t]), ee({
39
+ active: t && H,
40
+ requestClose: () => f.current("escape"),
41
+ ownerRef: R
42
+ }), le(() => {
43
+ const e = i.current;
44
+ if (!t || !e) return;
45
+ N.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.open || e.showModal(), e.focus({ preventScroll: !0 });
46
+ const n = requestAnimationFrame(() => {
47
+ L(!0);
48
+ }), r = z(e);
30
49
  return () => {
31
- cancelAnimationFrame(U), V(), y(!1), e.open && e.close();
32
- const E = v.current;
33
- E?.isConnected && E.focus({ preventScroll: !0 });
50
+ cancelAnimationFrame(n), r(), L(!1), e.open && e.close();
51
+ const a = N.current;
52
+ a?.isConnected && a.focus({ preventScroll: !0 });
53
+ };
54
+ }, [t]), y(() => {
55
+ const e = i.current;
56
+ if (!e || !t) return;
57
+ let n = !1;
58
+ const r = () => {
59
+ requestAnimationFrame(() => {
60
+ n = !1, B.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
61
+ });
62
+ }, a = () => {
63
+ n || (n = !0, P() && x(), r());
34
64
  };
35
- }, [a]);
36
- const S = Y(P(h, te));
37
- if (!a) return null;
38
- const T = { close: () => {
39
- o("action");
40
- } }, l = (e) => typeof e == "function" ? e(T) : e, N = h !== void 0, f = p !== void 0 ? l(p) : N ? /* @__PURE__ */ t(I, {
41
- dataTest: `${r}-view-results`,
65
+ return e.addEventListener("close", a), () => e.removeEventListener("close", a);
66
+ }, [t]);
67
+ const O = oe(te(E, de));
68
+ if (!t) return null;
69
+ const Y = { close: () => {
70
+ s("action");
71
+ } }, p = (e) => typeof e == "function" ? e(Y) : e, I = E !== void 0, w = g !== void 0 ? p(g) : I ? /* @__PURE__ */ o(j, {
72
+ dataTest: `${c}-view-results`,
42
73
  type: "button",
43
74
  variant: "text",
44
75
  onClick: () => {
45
- o("viewResults");
76
+ s("viewResults");
46
77
  },
47
- children: S
48
- }) : void 0, k = l(F), c = l(M), R = !!(f ?? k), B = w > 0;
49
- return /* @__PURE__ */ i("dialog", {
50
- ref: m,
51
- id: D,
78
+ children: O
79
+ }) : void 0, D = p($), v = p(A), F = !!(w ?? D), M = C > 0;
80
+ return /* @__PURE__ */ o("dialog", {
81
+ ref: i,
82
+ id: T,
52
83
  tabIndex: -1,
53
84
  "aria-modal": "true",
54
- "aria-labelledby": s ? b : void 0,
55
- "aria-label": s ? void 0 : L,
56
- "data-test": r,
57
- "data-testid": r,
85
+ "aria-labelledby": m ? k : void 0,
86
+ "aria-label": m ? void 0 : _,
87
+ "data-test": c,
88
+ "data-testid": c,
58
89
  onCancel: (e) => {
59
- e.preventDefault(), o("escape");
90
+ if (e.cancelable && e.preventDefault(), !h.current) {
91
+ if (!P()) {
92
+ f.current("escape");
93
+ return;
94
+ }
95
+ x();
96
+ }
60
97
  },
61
- className: n(J.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"),
62
- children: [/* @__PURE__ */ t("div", {
63
- "aria-hidden": "true",
64
- "data-testid": `${r}-scrim`,
65
- onClick: () => {
66
- o("scrim");
67
- },
68
- className: n("absolute inset-0 bg-[#626e7eb2] transition-opacity duration-[250ms] ease-out motion-reduce:duration-150", u ? "opacity-100" : "opacity-0")
69
- }), /* @__PURE__ */ i("div", {
70
- ref: x,
71
- "data-state": u ? "open" : "closed",
72
- style: B ? { transform: `translateY(${w}px)` } : void 0,
73
- className: n("relative box-border flex w-full max-w-[640px] flex-col border border-solid border-delta-300 bg-white text-delta-700 outline-none", O ? "h-full max-h-none rounded-none" : "max-h-[90dvh] rounded-t-[28px]", !B && ["ease-out motion-safe:transition-transform motion-safe:duration-[250ms] motion-reduce:transition-opacity motion-reduce:duration-150", u ? "translate-y-0 opacity-100" : "motion-safe:translate-y-full motion-reduce:opacity-0"], C),
74
- children: [
75
- /* @__PURE__ */ i("div", {
76
- className: "border-b-solid shrink-0 border-b border-delta-200 pb-2",
77
- children: [/* @__PURE__ */ i("div", {
78
- ...$,
79
- className: "relative flex h-12 touch-none items-center gap-2 px-2",
80
- children: [
81
- /* @__PURE__ */ t("div", { className: "min-w-0 flex-1" }),
82
- /* @__PURE__ */ t(I, {
83
- dataTest: `${r}-close`,
84
- variant: "textGray",
85
- type: "button",
86
- "aria-label": _,
87
- onClick: () => {
88
- o("closeButton");
89
- },
90
- startIcon: /* @__PURE__ */ t(H, {
98
+ className: d(ae.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"),
99
+ children: /* @__PURE__ */ u(Z.Provider, {
100
+ value: R,
101
+ children: [/* @__PURE__ */ o("div", {
102
+ "aria-hidden": "true",
103
+ "data-testid": `${c}-scrim`,
104
+ onClick: () => {
105
+ s("scrim");
106
+ },
107
+ className: d("absolute inset-0 bg-[#626e7eb2] transition-opacity duration-[250ms] ease-out motion-reduce:duration-150", b ? "opacity-100" : "opacity-0")
108
+ }), /* @__PURE__ */ u("div", {
109
+ ref: S,
110
+ "data-state": b ? "open" : "closed",
111
+ style: M ? { transform: `translateY(${C}px)` } : void 0,
112
+ className: d("relative box-border flex w-full max-w-[640px] flex-col border border-solid border-delta-300 bg-white text-delta-700 outline-none", G ? "h-full max-h-none rounded-none" : "max-h-[90dvh] rounded-t-[28px]", !M && ["ease-out motion-safe:transition-transform motion-safe:duration-[250ms] motion-reduce:transition-opacity motion-reduce:duration-150", b ? "translate-y-0 opacity-100" : "motion-safe:translate-y-full motion-reduce:opacity-0"], V),
113
+ children: [
114
+ /* @__PURE__ */ u("div", {
115
+ className: "border-b-solid shrink-0 border-b border-delta-200 pb-2",
116
+ children: [/* @__PURE__ */ u("div", {
117
+ ...Q,
118
+ className: "relative flex h-12 touch-none items-center gap-2 px-2",
119
+ children: [
120
+ /* @__PURE__ */ o("div", { className: "min-w-0 flex-1" }),
121
+ /* @__PURE__ */ o(j, {
122
+ dataTest: `${c}-close`,
123
+ variant: "textGray",
124
+ type: "button",
125
+ "aria-label": U,
126
+ onClick: () => {
127
+ s("closeButton");
128
+ },
129
+ startIcon: /* @__PURE__ */ o(J, {
130
+ width: 24,
131
+ height: 24
132
+ })
133
+ }),
134
+ /* @__PURE__ */ o(W, {
135
+ "aria-hidden": "true",
136
+ focusable: "false",
91
137
  width: 24,
92
- height: 24
138
+ height: 24,
139
+ className: "pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-delta-800"
93
140
  })
94
- }),
95
- /* @__PURE__ */ t(q, {
96
- "aria-hidden": "true",
97
- focusable: "false",
98
- width: 24,
99
- height: 24,
100
- className: "pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-delta-800"
141
+ ]
142
+ }), m && /* @__PURE__ */ o("div", {
143
+ id: k,
144
+ className: "truncate px-4 text-lg font-semibold leading-7 text-delta-800",
145
+ children: m
146
+ })]
147
+ }),
148
+ /* @__PURE__ */ o("div", {
149
+ className: d("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain pl-4 pr-2 pt-2", F || v ? "pb-2" : "pb-[max(0.5rem,env(safe-area-inset-bottom))]"),
150
+ children: p(q)
151
+ }),
152
+ F && /* @__PURE__ */ u("div", {
153
+ className: d("border-t-solid flex shrink-0 items-start border-t border-delta-200 bg-white p-1", w ? "justify-between" : "justify-end", !v && "pb-[max(0.25rem,env(safe-area-inset-bottom))]"),
154
+ children: [
155
+ w,
156
+ D,
157
+ I && /* @__PURE__ */ o("span", {
158
+ className: "sr-only",
159
+ role: "status",
160
+ "aria-live": "polite",
161
+ "aria-atomic": "true",
162
+ children: O
101
163
  })
102
164
  ]
103
- }), s && /* @__PURE__ */ t("div", {
104
- id: b,
105
- className: "truncate px-4 text-lg font-semibold leading-7 text-delta-800",
106
- children: s
107
- })]
108
- }),
109
- /* @__PURE__ */ t("div", {
110
- className: n("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain pl-4 pr-2 pt-2", R || c ? "pb-2" : "pb-[max(0.5rem,env(safe-area-inset-bottom))]"),
111
- children: l(j)
112
- }),
113
- R && /* @__PURE__ */ i("div", {
114
- className: n("border-t-solid flex shrink-0 items-start border-t border-delta-200 bg-white p-1", f ? "justify-between" : "justify-end", !c && "pb-[max(0.25rem,env(safe-area-inset-bottom))]"),
115
- children: [
116
- f,
117
- k,
118
- N && /* @__PURE__ */ t("span", {
119
- className: "sr-only",
120
- role: "status",
121
- "aria-live": "polite",
122
- "aria-atomic": "true",
123
- children: S
124
- })
125
- ]
126
- }),
127
- c && /* @__PURE__ */ t("div", {
128
- className: "flex shrink-0 flex-col items-end bg-white p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",
129
- children: c
130
- })
131
- ]
132
- })]
165
+ }),
166
+ v && /* @__PURE__ */ o("div", {
167
+ className: "flex shrink-0 flex-col items-end bg-white p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",
168
+ children: v
169
+ })
170
+ ]
171
+ })]
172
+ })
133
173
  });
134
174
  };
135
175
  export {
136
- xe as StyledBottomSheet
176
+ Le as StyledBottomSheet
137
177
  };
@@ -3,54 +3,59 @@ import { firstTabbable as se } from "../../../helpers/focusable.js";
3
3
  import { TOP_LAYER_PROPS as ae, TOP_LAYER_RESET_STYLE as le, getOpenModalDialogAncestor as ce, shouldUsePopoverTopLayer as de, useTopLayerRef as ue } from "../../../hooks/useTopLayer.hook.js";
4
4
  import { StyledButton as fe } from "../../inputs/button/StyledButton.js";
5
5
  import { useMobileMediaQuery as pe } from "../../../hooks/useMediaQuery.hook.js";
6
- import { useDebouncedValue as me } from "../../../hooks/useDebouncedValue.hook.js";
7
- import { useFocusTrap as ge } from "../../../hooks/useFocusTrap.hook.js";
8
- import { formatResultsLabel as he } from "../bottom-sheet/formatResultsLabel.js";
9
- import { StyledBottomSheet as ve } from "../bottom-sheet/StyledBottomSheet.js";
10
- import { PopoverAnatomy as xe } from "./PopoverAnatomy.js";
11
- import { useCallback as v, useEffect as R, useId as _e, useRef as T, useState as l } from "react";
12
- import { Fragment as N, jsx as c, jsxs as B } from "react/jsx-runtime";
13
- import { FloatingPortal as be, autoUpdate as Pe, flip as ye, offset as Re, shift as Te, size as Ee, useDismiss as Me, useFloating as Se, useInteractions as we, useMergeRefs as Ae } from "@floating-ui/react";
14
- var Oe = 240, Fe = {
6
+ import { OverlayBackOwnerContext as me, useBackCloses as ge } from "../../../hooks/useBackCloses.hook.js";
7
+ import { useDebouncedValue as ve } from "../../../hooks/useDebouncedValue.hook.js";
8
+ import { useFocusTrap as he } from "../../../hooks/useFocusTrap.hook.js";
9
+ import { formatResultsLabel as xe } from "../bottom-sheet/formatResultsLabel.js";
10
+ import { StyledBottomSheet as _e } from "../bottom-sheet/StyledBottomSheet.js";
11
+ import { PopoverAnatomy as Pe } from "./PopoverAnatomy.js";
12
+ import { useCallback as x, useEffect as w, useId as be, useRef as O, useState as d } from "react";
13
+ import { Fragment as D, jsx as a, jsxs as N } from "react/jsx-runtime";
14
+ import { FloatingPortal as ye, autoUpdate as Re, flip as we, offset as Oe, shift as Te, size as Ee, useDismiss as Me, useFloating as Se, useInteractions as Ae, useMergeRefs as Fe } from "@floating-ui/react";
15
+ var Ie = 240, Ce = {
15
16
  info: 472,
16
17
  action: 472
17
- }, Ie = 0.6, X = "calc(100vw - 32px)", Le = (n, d, u) => Pe(n, d, u, { elementResize: !1 }), Ve = ({ dataTest: n, renderTrigger: d, variant: u = "info", title: f, children: E, viewResultsAction: M, resetAction: S, footerActions: w, resultCount: x, closeLabel: A = "Lukk", ariaLabel: O, onOpenChange: F, className: I }) => {
18
- const a = _e(), L = `${a}-title`, [o, z] = l(!1), [H, K] = l(), [U, Y] = l(), p = pe(), t = u === "action", $ = p && !t, k = p && t, m = v((e) => {
19
- z(e), F?.(e);
20
- }, [F]), { refs: _, floatingStyles: j, context: q } = Se({
18
+ }, ke = 0.6, X = "calc(100vw - 32px)", Le = (i, u, f) => Re(i, u, f, { elementResize: !1 }), Je = ({ dataTest: i, renderTrigger: u, variant: f = "info", title: p, children: T, viewResultsAction: E, resetAction: M, footerActions: S, resultCount: _, closeLabel: A = "Lukk", ariaLabel: F, onOpenChange: I, className: C }) => {
19
+ const l = be(), k = `${l}-title`, [o, q] = d(!1), [L, z] = d(), [K, U] = d(), m = pe(), t = f === "action", Y = m && !t, H = m && t, g = x((e) => {
20
+ q(e), I?.(e);
21
+ }, [I]), { refs: P, floatingStyles: $, context: j } = Se({
21
22
  open: o,
22
- onOpenChange: m,
23
+ onOpenChange: g,
23
24
  placement: "bottom-start",
24
25
  strategy: "fixed",
25
26
  whileElementsMounted: Le,
26
27
  middleware: [
27
- Re(8),
28
- ...$ ? [] : [ye({ padding: 8 })],
28
+ Oe(8),
29
+ ...Y ? [] : [we({ padding: 8 })],
29
30
  Te({ padding: 8 }),
30
31
  Ee({
31
32
  padding: 8,
32
33
  apply({ availableHeight: e }) {
33
- Y(Math.min(e, Math.round(window.innerHeight * Ie)));
34
+ U(Math.min(e, Math.round(window.innerHeight * ke)));
34
35
  }
35
36
  })
36
37
  ]
37
- }), { getFloatingProps: V } = we([Me(q, {
38
- enabled: !k,
38
+ }), { getFloatingProps: V } = Ae([Me(j, {
39
+ enabled: !H,
39
40
  escapeKey: !0,
40
41
  outsidePress: (e) => {
41
- const s = g.current;
42
+ const s = v.current;
42
43
  return !(s && e.target instanceof Node && s.contains(e.target));
43
44
  }
44
- })]), b = de(H), C = T(null), [r, G] = l(null), Q = v((e) => {
45
- C.current = e, G(e);
46
- }, []), J = Ae([ue(_.setFloating, b), Q]), g = T(null), Z = v((e) => {
47
- g.current = e, _.setReference(e);
48
- }, [_]), i = v(() => {
49
- m(!1);
50
- }, [m]);
51
- ge(o && t && r !== null, C);
52
- const [W, ee] = l(!1);
53
- R(() => {
45
+ })]), b = de(L), c = O(null), [r, G] = d(null), Q = x((e) => {
46
+ c.current = e, G(e);
47
+ }, []), J = Fe([ue(P.setFloating, b), Q]), v = O(null), Z = x((e) => {
48
+ v.current = e, P.setReference(e);
49
+ }, [P]), n = x(() => {
50
+ g(!1);
51
+ }, [g]);
52
+ ge({
53
+ active: o,
54
+ requestClose: n,
55
+ ownerRef: c
56
+ }), he(o && t && r !== null, c);
57
+ const [W, ee] = d(!1);
58
+ w(() => {
54
59
  if (!r || t && !W) return;
55
60
  const e = requestAnimationFrame(() => {
56
61
  (t ? se(r) : r)?.focus({ preventScroll: !0 });
@@ -62,11 +67,11 @@ var Oe = 240, Fe = {
62
67
  r,
63
68
  t,
64
69
  W
65
- ]), R(() => {
70
+ ]), w(() => {
66
71
  if (!r || t) return;
67
72
  const e = (s) => {
68
- const y = s.relatedTarget;
69
- y instanceof Node && (r.contains(y) || g.current?.contains(y)) || i();
73
+ const R = s.relatedTarget;
74
+ R instanceof Node && (r.contains(R) || v.current?.contains(R)) || n();
70
75
  };
71
76
  return r.addEventListener("focusout", e), () => {
72
77
  r.removeEventListener("focusout", e);
@@ -74,17 +79,17 @@ var Oe = 240, Fe = {
74
79
  }, [
75
80
  r,
76
81
  t,
77
- i
82
+ n
78
83
  ]);
79
- const P = T(!1);
80
- R(() => {
84
+ const y = O(!1);
85
+ w(() => {
81
86
  if (o) {
82
- P.current = !0;
87
+ y.current = !0;
83
88
  return;
84
89
  }
85
- if (!P.current) return;
86
- P.current = !1;
87
- const e = g.current;
90
+ if (!y.current) return;
91
+ y.current = !1;
92
+ const e = v.current;
88
93
  if (!e) return;
89
94
  const s = requestAnimationFrame(() => {
90
95
  document.activeElement === document.body && e.focus();
@@ -93,79 +98,84 @@ var Oe = 240, Fe = {
93
98
  cancelAnimationFrame(s);
94
99
  };
95
100
  }, [o]);
96
- const D = {
101
+ const B = {
97
102
  ref: Z,
98
103
  isOpen: o,
99
104
  triggerProps: {
100
105
  onClick: (e) => {
101
106
  if (o) {
102
- i();
107
+ n();
103
108
  return;
104
109
  }
105
- K(ce(e.currentTarget)), ee(e.detail === 0), m(!0);
110
+ z(ce(e.currentTarget)), ee(e.detail === 0), g(!0);
106
111
  },
107
112
  "aria-expanded": o,
108
- "aria-controls": o ? a : void 0,
113
+ "aria-controls": o ? l : void 0,
109
114
  "aria-haspopup": t ? "dialog" : void 0,
110
- "aria-describedby": !t && o ? a : void 0
115
+ "aria-describedby": !t && o ? l : void 0
111
116
  }
112
- }, h = (e) => typeof e == "function" ? e({ close: i }) : e, te = me(x, 500), oe = M ?? (x === void 0 ? void 0 : /* @__PURE__ */ c(fe, {
113
- dataTest: `${n}-view-results`,
117
+ }, h = (e) => typeof e == "function" ? e({ close: n }) : e, te = ve(_, 500), oe = E ?? (_ === void 0 ? void 0 : /* @__PURE__ */ a(fe, {
118
+ dataTest: `${i}-view-results`,
114
119
  type: "button",
115
120
  variant: "text",
116
- onClick: i,
117
- children: he(te)
118
- })), re = p ? X : Fe[u], ne = p ? X : void 0;
119
- return k ? /* @__PURE__ */ B(N, { children: [d(D), /* @__PURE__ */ c(ve, {
120
- id: a,
121
- dataTest: n,
121
+ onClick: n,
122
+ children: xe(te)
123
+ })), re = m ? X : Ce[f], ne = m ? X : void 0;
124
+ return H ? /* @__PURE__ */ N(D, { children: [u(B), /* @__PURE__ */ a(_e, {
125
+ id: l,
126
+ dataTest: i,
122
127
  open: o,
123
- onClose: i,
124
- title: f,
125
- ariaLabel: O,
126
- viewResultsAction: M,
127
- resetAction: S,
128
- footerActions: w,
129
- resultCount: x,
128
+ onClose: n,
129
+ registerBackClose: !1,
130
+ ownerRef: c,
131
+ title: p,
132
+ ariaLabel: F,
133
+ viewResultsAction: E,
134
+ resetAction: M,
135
+ footerActions: S,
136
+ resultCount: _,
130
137
  closeLabel: A,
131
- className: I,
132
- children: E
133
- })] }) : /* @__PURE__ */ B(N, { children: [d(D), o && /* @__PURE__ */ c(be, {
134
- root: H,
135
- children: /* @__PURE__ */ c("div", {
138
+ className: C,
139
+ children: T
140
+ })] }) : /* @__PURE__ */ N(D, { children: [u(B), o && /* @__PURE__ */ a(ye, {
141
+ root: L,
142
+ children: /* @__PURE__ */ a("div", {
136
143
  ...V(),
137
144
  ref: J,
138
- id: a,
139
- "data-test": n,
140
- "data-testid": n,
145
+ id: l,
146
+ "data-test": i,
147
+ "data-testid": i,
141
148
  role: t ? "dialog" : void 0,
142
- "aria-labelledby": t && f ? L : void 0,
143
- "aria-label": t && !f ? O : void 0,
149
+ "aria-labelledby": t && p ? k : void 0,
150
+ "aria-label": t && !p ? F : void 0,
144
151
  tabIndex: t ? void 0 : -1,
145
152
  ...b ? ae : {},
146
153
  style: {
147
154
  ...b ? le : {},
148
- ...j,
149
- minWidth: Oe,
155
+ ...$,
156
+ minWidth: Ie,
150
157
  width: ne,
151
158
  maxWidth: re,
152
- maxHeight: U
159
+ maxHeight: K
153
160
  },
154
- className: ie("z-[1300]", "box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[inset_0_0_0_1px_var(--colors-delta-300),0px_4px_40px_0px_#22213366]", I),
155
- children: /* @__PURE__ */ c(xe, {
156
- dataTest: n,
157
- title: f,
158
- titleId: L,
159
- viewResultsAction: h(oe),
160
- resetAction: h(S),
161
- footerActions: h(w),
162
- closeLabel: A,
163
- onClose: i,
164
- children: h(E)
161
+ className: ie("z-[1300]", "box-border flex flex-col overflow-hidden rounded-lg bg-white text-delta-700 outline-none shadow-[inset_0_0_0_1px_var(--colors-delta-300),0px_4px_40px_0px_#22213366]", C),
162
+ children: /* @__PURE__ */ a(me.Provider, {
163
+ value: c,
164
+ children: /* @__PURE__ */ a(Pe, {
165
+ dataTest: i,
166
+ title: p,
167
+ titleId: k,
168
+ viewResultsAction: h(oe),
169
+ resetAction: h(M),
170
+ footerActions: h(S),
171
+ closeLabel: A,
172
+ onClose: n,
173
+ children: h(T)
174
+ })
165
175
  })
166
176
  })
167
177
  })] });
168
178
  };
169
179
  export {
170
- Ve as PopoverSheet
180
+ Je as PopoverSheet
171
181
  };