asma-ui-core 3.136.1 → 3.137.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.
@@ -1,14 +1,14 @@
1
- import { cn as ee } from "../../../helpers/cn.js";
2
- import { resolveSx as te } from "../../../helpers/sx.js";
3
- import { firstFocusable as oe, firstTabbable as ne } from "../../../helpers/focusable.js";
4
- import { TOP_LAYER_PROPS as re, TOP_LAYER_RESET_STYLE as se, getOpenModalDialogAncestor as ie, shouldUsePopoverTopLayer as ce, useTopLayerRef as le } from "../../../hooks/useTopLayer.hook.js";
5
- import { Fragment as ae, cloneElement as fe, useCallback as ue, useEffect as U, useId as pe, useLayoutEffect as L, useMemo as de, useRef as H, useState as me } from "react";
6
- import { Fragment as k, jsx as b, jsxs as _ } from "react/jsx-runtime";
7
- import { FloatingArrow as ge, FloatingPortal as be, arrow as Re, autoUpdate as ye, flip as ve, offset as Ee, safePolygon as he, shift as Pe, useDismiss as xe, useFloating as Te, useFocus as we, useHover as Fe, useInteractions as Oe, useMergeRefs as Ae, useRole as Le } from "@floating-ui/react";
8
- var _e = "#363E4A", De = (t) => {
1
+ import { cn as te } from "../../../helpers/cn.js";
2
+ import { resolveSx as oe } from "../../../helpers/sx.js";
3
+ import { firstFocusable as ne, firstTabbable as re } from "../../../helpers/focusable.js";
4
+ import { TOP_LAYER_PROPS as se, TOP_LAYER_RESET_STYLE as ie, getOpenModalDialogAncestor as ce, shouldUsePopoverTopLayer as le, useTopLayerRef as ae } from "../../../hooks/useTopLayer.hook.js";
5
+ import { Fragment as fe, cloneElement as ue, useCallback as pe, useEffect as H, useId as de, useLayoutEffect as L, useMemo as me, useRef as k, useState as ge } from "react";
6
+ import { Fragment as Y, jsx as R, jsxs as _ } from "react/jsx-runtime";
7
+ import { FloatingArrow as Re, FloatingPortal as be, arrow as ye, autoUpdate as ve, flip as Ee, offset as he, safePolygon as Pe, shift as xe, useDismiss as Te, useFloating as we, useFocus as Fe, useHover as Oe, useInteractions as Ae, useMergeRefs as Le, useRole as _e } from "@floating-ui/react";
8
+ var De = "#363E4A", Me = (t) => {
9
9
  const n = document.createRange();
10
10
  return n.selectNodeContents(t), n.getBoundingClientRect();
11
- }, Me = [
11
+ }, Se = [
12
12
  "onFocus",
13
13
  "onBlur",
14
14
  "onMouseEnter",
@@ -18,41 +18,41 @@ var _e = "#363E4A", De = (t) => {
18
18
  "onPointerEnter",
19
19
  "onPointerUp",
20
20
  "onKeyDown"
21
- ], ke = ({ children: t, ...n }) => {
22
- const s = H({ element: null }), E = ue((i) => {
21
+ ], Ye = ({ children: t, ...n }) => {
22
+ const s = k({ element: null }), E = pe((i) => {
23
23
  s.current.element = i, s.current.setReference?.(i);
24
- }, []), c = t.type === ae, l = c ? /* @__PURE__ */ b("span", {
24
+ }, []), c = t.type === fe, l = c ? /* @__PURE__ */ R("span", {
25
25
  style: { display: "contents" },
26
26
  children: t
27
- }) : t, a = l.props, R = Ae([E, Object.getOwnPropertyDescriptor(a, "ref")?.value ?? Object.getOwnPropertyDescriptor(l, "ref")?.value]), h = de(() => Object.fromEntries(Me.map((i) => [i, (P) => {
27
+ }) : t, a = l.props, b = Le([E, Object.getOwnPropertyDescriptor(a, "ref")?.value ?? Object.getOwnPropertyDescriptor(l, "ref")?.value]), h = me(() => Object.fromEntries(Se.map((i) => [i, (P) => {
28
28
  const d = (s.current.getReferenceProps?.(a) ?? a)[i];
29
29
  d?.(P);
30
30
  }])), [a]), y = !!n.title || n.title === 0;
31
- return /* @__PURE__ */ _(k, { children: [y ? fe(l, {
31
+ return /* @__PURE__ */ _(Y, { children: [y ? ue(l, {
32
32
  ...h,
33
- ref: R
34
- }) : l, y && /* @__PURE__ */ b(Se, {
33
+ ref: b
34
+ }) : l, y && /* @__PURE__ */ R(Ce, {
35
35
  ...n,
36
36
  referenceRef: s,
37
37
  isFragment: c
38
38
  })] });
39
- }, Se = ({ title: t, referenceRef: n, isFragment: s, placement: E = "top", arrow: c = !1, enterDelay: l = 500, leaveDelay: a = 0, open: R, onOpen: h, onClose: y, disableHoverListener: i, disableFocusListener: P, openOnTap: d, persistentDescription: Y, persistentDescriptionId: z, offsetDistance: G, className: K, slotProps: x }) => {
40
- const [V, W] = me(!1), T = R !== void 0, D = !!t || t === 0, m = D && (R ?? V), w = D && Y, M = H(null), S = (e) => {
41
- T || W(e), e ? h?.() : y?.();
42
- }, { refs: o, floatingStyles: $, context: f } = Te({
39
+ }, Ce = ({ title: t, referenceRef: n, isFragment: s, placement: E = "top", arrow: c = !1, enterDelay: l = 500, leaveDelay: a = 0, open: b, onOpen: h, onClose: y, disableHoverListener: i, disableFocusListener: P, openOnTap: d, persistentDescription: z, persistentDescriptionId: G, describesTrigger: D = !0, offsetDistance: K, className: V, slotProps: x }) => {
40
+ const [W, $] = ge(!1), T = b !== void 0, M = !!t || t === 0, m = M && (b ?? W), w = M && D && z, S = k(null), C = (e) => {
41
+ T || $(e), e ? h?.() : y?.();
42
+ }, { refs: o, floatingStyles: q, context: f } = we({
43
43
  open: m,
44
- onOpenChange: S,
44
+ onOpenChange: C,
45
45
  placement: E,
46
46
  strategy: "fixed",
47
- whileElementsMounted: ye,
47
+ whileElementsMounted: ve,
48
48
  middleware: [
49
- Ee(G ?? (c ? 8 : 6)),
50
- ve({ padding: 8 }),
51
- Pe({ padding: 8 }),
52
- ...c ? [Re({ element: M })] : []
49
+ he(K ?? (c ? 8 : 6)),
50
+ Ee({ padding: 8 }),
51
+ xe({ padding: 8 }),
52
+ ...c ? [ye({ element: S })] : []
53
53
  ]
54
- }), { getReferenceProps: C, getFloatingProps: q } = Oe([
55
- Fe(f, {
54
+ }), { getReferenceProps: B, getFloatingProps: J } = Ae([
55
+ Oe(f, {
56
56
  enabled: !T && !i,
57
57
  delay: {
58
58
  open: l,
@@ -60,13 +60,13 @@ var _e = "#363E4A", De = (t) => {
60
60
  },
61
61
  move: !1,
62
62
  mouseOnly: !!d,
63
- handleClose: he()
63
+ handleClose: Pe()
64
64
  }),
65
- we(f, { enabled: !T && !P }),
66
- xe(f, { ancestorScroll: !!d }),
67
- Le(f, { role: "tooltip" }),
65
+ Fe(f, { enabled: !T && !P }),
66
+ Te(f, { ancestorScroll: !!d }),
67
+ _e(f, { role: "tooltip" }),
68
68
  { reference: { onPointerUp: (e) => {
69
- !d || e.pointerType !== "touch" || S(!m);
69
+ !d || e.pointerType !== "touch" || C(!m);
70
70
  } } }
71
71
  ]);
72
72
  L(() => {
@@ -75,19 +75,19 @@ var _e = "#363E4A", De = (t) => {
75
75
  e.setReference = void 0, e.getReferenceProps = void 0, o.setReference(null);
76
76
  };
77
77
  }, [n, o]), L(() => {
78
- n.current.getReferenceProps = C;
79
- }, [n, C]);
80
- const B = m ? ie(o.domReference.current) : void 0, F = ce(B), J = le(o.setFloating, F), { floatingId: Q } = f, X = pe(), j = z ?? X, u = w ? j : Q, O = !!w || m, I = (e) => ne(e) ?? oe(e) ?? e, A = typeof t == "string" || typeof t == "number" ? String(t).trim() : "", N = (e, r) => {
78
+ n.current.getReferenceProps = B;
79
+ }, [n, B]);
80
+ const j = m ? ce(o.domReference.current) : void 0, F = le(j), Q = ae(o.setFloating, F), { floatingId: X } = f, Z = de(), I = G ?? Z, u = w ? I : X, O = D && (!!w || m), N = (e) => re(e) ?? ne(e) ?? e, A = typeof t == "string" || typeof t == "number" ? String(t).trim() : "", U = (e, r) => {
81
81
  const p = e.getAttribute("aria-describedby"), g = p?.split(/\s+/) ?? [];
82
82
  if (g.includes(r)) return;
83
- const Z = (v) => document.getElementById(v)?.textContent?.trim();
84
- A && g.some((v) => v !== r && Z(v) === A) || e.setAttribute("aria-describedby", p ? `${p} ${r}` : r);
83
+ const ee = (v) => document.getElementById(v)?.textContent?.trim();
84
+ A && g.some((v) => v !== r && ee(v) === A) || e.setAttribute("aria-describedby", p ? `${p} ${r}` : r);
85
85
  };
86
- return U(() => {
86
+ return H(() => {
87
87
  const e = o.domReference.current;
88
88
  if (!O || !u || !(e instanceof HTMLElement)) return;
89
- const r = I(e);
90
- return N(r, u), () => {
89
+ const r = N(e);
90
+ return U(r, u), () => {
91
91
  const p = r.getAttribute("aria-describedby")?.split(/\s+/).filter((g) => g && g !== u).join(" ");
92
92
  p ? r.setAttribute("aria-describedby", p) : r.removeAttribute("aria-describedby");
93
93
  };
@@ -96,42 +96,42 @@ var _e = "#363E4A", De = (t) => {
96
96
  o.domReference,
97
97
  u,
98
98
  A
99
- ]), U(() => {
99
+ ]), H(() => {
100
100
  const e = o.domReference.current;
101
- !O || !u || !(e instanceof HTMLElement) || N(I(e), u);
101
+ !O || !u || !(e instanceof HTMLElement) || U(N(e), u);
102
102
  }), L(() => {
103
103
  const e = o.domReference.current;
104
104
  !s || !e || o.setPositionReference({
105
105
  contextElement: e,
106
- getBoundingClientRect: () => De(e)
106
+ getBoundingClientRect: () => Me(e)
107
107
  });
108
- }, [s, o]), /* @__PURE__ */ _(k, { children: [w && /* @__PURE__ */ b("span", {
109
- id: j,
108
+ }, [s, o]), /* @__PURE__ */ _(Y, { children: [w && /* @__PURE__ */ R("span", {
109
+ id: I,
110
110
  hidden: !0,
111
111
  children: t
112
- }), m && /* @__PURE__ */ b(be, {
113
- root: B,
112
+ }), m && /* @__PURE__ */ R(be, {
113
+ root: j,
114
114
  children: /* @__PURE__ */ _("div", {
115
- ref: J,
116
- ...F ? re : {},
117
- ...q(),
115
+ ref: Q,
116
+ ...F ? se : {},
117
+ ...J(),
118
118
  style: {
119
- ...F ? se : {},
120
- ...$,
119
+ ...F ? ie : {},
120
+ ...q,
121
121
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
122
122
  overflow: "visible",
123
123
  ...x?.tooltip?.style,
124
- ...te(x?.tooltip?.sx)
124
+ ...oe(x?.tooltip?.sx)
125
125
  },
126
- className: ee("z-[1500] block max-w-[320px] whitespace-normal break-words rounded-[3px] bg-[#363E4A] px-2 py-1 text-sm leading-5 text-white shadow-[0px_1px_6px_0px_rgba(0,0,0,0.15)]", K, x?.tooltip?.className),
127
- children: [t, c && /* @__PURE__ */ b(ge, {
128
- ref: M,
126
+ className: te("z-[1500] block max-w-[320px] whitespace-normal break-words rounded-[3px] bg-[#363E4A] px-2 py-1 text-sm leading-5 text-white shadow-[0px_1px_6px_0px_rgba(0,0,0,0.15)]", V, x?.tooltip?.className),
127
+ children: [t, c && /* @__PURE__ */ R(Re, {
128
+ ref: S,
129
129
  context: f,
130
- fill: _e
130
+ fill: De
131
131
  })]
132
132
  })
133
133
  })] });
134
134
  };
135
135
  export {
136
- ke as StyledTooltip
136
+ Ye as StyledTooltip
137
137
  };
@@ -1,163 +1,198 @@
1
- import { cn as l } from "../../../helpers/cn.js";
2
- import { registerOpenModalDialog as ce } from "../../../hooks/useTopLayer.hook.js";
3
- import { CloseIcon as de } from "../../icons/close-icon/CloseIcon.js";
4
- import { BackIcon as ue } from "../../icons/back-icon/BackIcon.js";
5
- import { StyledButton as N } from "../../inputs/button/StyledButton.js";
6
- import { OverlayBackOwnerContext as fe, isOverlayBackEnabled as X, requestCloseTopOverlayBack as R, useBackCloses as me } from "../../../hooks/useBackCloses.hook.js";
7
- import { isKeyboardModality as pe, trackInputModality as he } from "../../inputs/full-screen-picker/inputModality.js";
8
- import { useDebouncedValue as ve } from "../../../hooks/useDebouncedValue.hook.js";
9
- import { useFocusTrap as be } from "../../../hooks/useFocusTrap.hook.js";
10
- import { useShortViewportMediaQuery as xe } from "../../../hooks/useMediaQuery.hook.js";
11
- import { SHEET_HEADER_TEXT as ye, SHEET_TEXT as we } from "./sheetCopy.js";
12
- import { formatResultsLabel as ge } from "./formatResultsLabel.js";
13
- import { useBodyScrollLock as Ee } from "../../../hooks/useBodyScrollLock.hook.js";
14
- import ke from "./StyledBottomSheet.module.js";
15
- import { useDragToDismiss as Se } from "./useDragToDismiss.hook.js";
16
- import { useEffect as x, useId as Ne, useLayoutEffect as Re, useRef as c, useState as C } from "react";
17
- import { jsx as t, jsxs as f } from "react/jsx-runtime";
18
- var Ce = 500, ze = ({ dataTest: s, id: Q, open: r, onClose: i, title: m, ariaLabel: Y, titleIcon: _, onBack: B, backLabel: J, children: W, viewResultsAction: L, resetAction: Z, footerActions: ee, resultCount: O, locale: y = "en", closeLabel: te = we[y].close, className: re, registerBackClose: oe = !0, ownerRef: ne, triggerRef: T }) => {
19
- const D = Ne(), d = c(null), H = c(null), I = c(null), M = ne ?? d, w = c(!1), [g, j] = C(!1), $ = xe(), F = c(null), [u, p] = C(!1), [ae, se] = C(!1), A = !$ && (u || ae), E = ye[y], h = c(i), P = c(r);
20
- x(() => {
21
- h.current = i, P.current = r;
22
- }, [i, r]);
23
- const { dragHandleProps: ie, dragOffset: q } = Se(H, () => {
24
- h.current("drag");
25
- }, A ? () => p(!0) : void 0);
26
- x(() => {
27
- const e = F.current;
28
- if (!r || u || !e) return;
29
- const a = () => {
30
- const n = e.scrollHeight > e.clientHeight + 1;
31
- n && e.contains(document.activeElement) ? p(!0) : se(n);
1
+ import { cn as u } from "../../../helpers/cn.js";
2
+ import { registerOpenModalDialog as Se } from "../../../hooks/useTopLayer.hook.js";
3
+ import { CloseIcon as _e } from "../../icons/close-icon/CloseIcon.js";
4
+ import { BackIcon as Te } from "../../icons/back-icon/BackIcon.js";
5
+ import { StyledButton as I } from "../../inputs/button/StyledButton.js";
6
+ import { OverlayBackOwnerContext as Le, isOverlayBackEnabled as oe, requestCloseTopOverlayBack as M, useBackCloses as Re } from "../../../hooks/useBackCloses.hook.js";
7
+ import { isKeyboardModality as Ce, trackInputModality as Oe } from "../../inputs/full-screen-picker/inputModality.js";
8
+ import { useDebouncedValue as Be } from "../../../hooks/useDebouncedValue.hook.js";
9
+ import { useFocusTrap as He } from "../../../hooks/useFocusTrap.hook.js";
10
+ import { useShortViewportMediaQuery as Ie } from "../../../hooks/useMediaQuery.hook.js";
11
+ import { SHEET_HEADER_TEXT as Me, SHEET_TEXT as $e } from "./sheetCopy.js";
12
+ import { formatResultsLabel as De } from "./formatResultsLabel.js";
13
+ import { useBodyScrollLock as Ae } from "../../../hooks/useBodyScrollLock.hook.js";
14
+ import je from "./StyledBottomSheet.module.js";
15
+ import { useDragToDismiss as Fe } from "./useDragToDismiss.hook.js";
16
+ import { useCallback as ae, useEffect as b, useId as Pe, useLayoutEffect as qe, useRef as c, useState as m } from "react";
17
+ import { jsx as t, jsxs as p } from "react/jsx-runtime";
18
+ var ze = 500, se = "duration-[250ms] ease-[cubic-bezier(0.05,0.7,0.1,1)]", ie = "duration-[200ms] ease-[cubic-bezier(0.3,0,0.8,0.15)]", Ke = 200, Ve = 300, dt = ({ dataTest: s, id: le, open: n, onClose: d, title: x, ariaLabel: ce, titleIcon: $, onBack: D, backLabel: de, children: ue, viewResultsAction: A, resetAction: fe, footerActions: me, resultCount: j, locale: S = "en", closeLabel: pe = $e[S].close, className: he, registerBackClose: ve = !0, ownerRef: be, triggerRef: F }) => {
19
+ const P = Pe(), f = c(null), _ = c(null), q = c(null), z = be ?? f, T = c(!1), [w, K] = m(!1), [V, X] = m(n);
20
+ n && !V && X(!0);
21
+ const U = c(void 0), y = Ie(), G = c(null), [xe, we] = m(null), ye = ae((e) => {
22
+ G.current = e, we(e);
23
+ }, []), [l, h] = m(!1), [ge, Ee] = m(!1), [v, L] = m(!1), Q = !y && (l || ge || v), Y = ae(() => {
24
+ L(!0), h(!1);
25
+ }, []), R = Me[S], g = c(d), J = c(n);
26
+ b(() => {
27
+ g.current = d, J.current = n;
28
+ }, [d, n]);
29
+ const { dragHandleProps: ke, dragOffset: W, dragRatio: C, liftedHeight: Z } = Fe(_, () => {
30
+ g.current("drag");
31
+ }, Q && !l ? () => h(!0) : void 0, l && !y ? Y : void 0, xe);
32
+ b(() => {
33
+ const e = G.current;
34
+ if (!n || l || v || !e) return;
35
+ let o = e.scrollHeight;
36
+ const r = () => {
37
+ const i = e.scrollHeight > e.clientHeight + 1, N = e.scrollHeight > o + 1;
38
+ o = e.scrollHeight, i && N && e.contains(document.activeElement) ? h(!0) : Ee(i);
32
39
  };
33
- a();
34
- const o = new ResizeObserver(a);
35
- o.observe(e);
36
- for (const n of Array.from(e.children)) o.observe(n);
37
- return () => o.disconnect();
38
- }, [r, u]), Ee(r), be(r, d), x(() => {
39
- if (!r) return;
40
- const e = (o) => {
41
- o.key === "Escape" && (w.current = !0, window.setTimeout(() => {
42
- w.current = !1;
40
+ r();
41
+ const a = new ResizeObserver(r);
42
+ a.observe(e);
43
+ for (const i of Array.from(e.children)) a.observe(i);
44
+ return () => a.disconnect();
45
+ }, [
46
+ n,
47
+ l,
48
+ v
49
+ ]), b(() => {
50
+ const e = _.current;
51
+ if (!v || !e) return;
52
+ const o = () => {
53
+ L(!1);
54
+ }, r = (i) => {
55
+ i.target === e && i.propertyName === "max-height" && o();
56
+ }, a = window.setTimeout(o, Ve);
57
+ return e.addEventListener("transitionend", r), () => {
58
+ window.clearTimeout(a), e.removeEventListener("transitionend", r);
59
+ };
60
+ }, [v]), Ae(n), He(n, f), b(() => {
61
+ if (!n) return;
62
+ const e = (r) => {
63
+ r.key === "Escape" && (T.current = !0, window.setTimeout(() => {
64
+ T.current = !1;
43
65
  }, 0));
44
- }, a = (o) => {
45
- if (o.key !== "Escape" || o.defaultPrevented) return;
46
- const n = document.activeElement;
47
- n instanceof Element && n.closest("dialog[open]") !== d.current || (o.preventDefault(), o.stopImmediatePropagation(), R(o));
66
+ }, o = (r) => {
67
+ if (r.key !== "Escape" || r.defaultPrevented) return;
68
+ const a = document.activeElement;
69
+ a instanceof Element && a.closest("dialog[open]") !== f.current || (r.preventDefault(), r.stopImmediatePropagation(), M(r));
48
70
  };
49
- return window.addEventListener("keydown", e, !0), window.addEventListener("keydown", a), () => {
50
- window.removeEventListener("keydown", e, !0), window.removeEventListener("keydown", a);
71
+ return window.addEventListener("keydown", e, !0), window.addEventListener("keydown", o), () => {
72
+ window.removeEventListener("keydown", e, !0), window.removeEventListener("keydown", o);
51
73
  };
52
- }, [r]), me({
53
- active: r && oe,
54
- requestClose: () => h.current("escape"),
55
- ownerRef: M
56
- }), Re(() => {
57
- const e = d.current;
58
- if (!r || !e) return;
59
- he();
60
- const a = document.activeElement instanceof HTMLElement ? document.activeElement : null;
61
- I.current = T?.current ?? a, e.open || e.showModal(), e.focus({ preventScroll: !0 });
62
- const o = requestAnimationFrame(() => {
63
- j(!0);
64
- }), n = ce(e);
74
+ }, [n]), Re({
75
+ active: n && ve,
76
+ requestClose: () => g.current("escape"),
77
+ ownerRef: z
78
+ }), qe(() => {
79
+ const e = f.current;
80
+ if (!n || !e) return;
81
+ Oe();
82
+ const o = document.activeElement instanceof HTMLElement ? document.activeElement : null;
83
+ window.clearTimeout(U.current), q.current = F?.current ?? o, e.open || e.showModal(), e.focus({ preventScroll: !0 });
84
+ const r = requestAnimationFrame(() => {
85
+ K(!0);
86
+ }), a = Se(e);
65
87
  return () => {
66
- cancelAnimationFrame(o), n(), j(!1), p(!1), e.open && e.close();
67
- const G = I.current;
68
- G?.isConnected && G.focus({
69
- preventScroll: !0,
70
- focusVisible: pe()
71
- });
88
+ cancelAnimationFrame(r), a(), K(!1);
89
+ const i = () => {
90
+ X(!1), h(!1), L(!1), e.open && e.close();
91
+ const N = q.current;
92
+ N?.isConnected && N.focus({
93
+ preventScroll: !0,
94
+ focusVisible: Ce()
95
+ });
96
+ };
97
+ if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
98
+ i();
99
+ return;
100
+ }
101
+ U.current = window.setTimeout(i, Ke);
72
102
  };
73
- }, [r, T]), x(() => {
74
- const e = d.current;
75
- if (!e || !r) return;
76
- let a = !1;
77
- const o = () => {
103
+ }, [n, F]), b(() => {
104
+ const e = f.current;
105
+ if (!e || !n) return;
106
+ let o = !1;
107
+ const r = () => {
78
108
  requestAnimationFrame(() => {
79
- a = !1, P.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
109
+ o = !1, J.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
80
110
  });
81
- }, n = () => {
82
- a || (a = !0, X() && R(), o());
111
+ }, a = () => {
112
+ o || (o = !0, oe() && M(), r());
83
113
  };
84
- return e.addEventListener("close", n), () => e.removeEventListener("close", n);
85
- }, [r]);
86
- const V = ge(ve(O, Ce), y);
87
- if (!r) return null;
88
- const le = { close: () => {
89
- i("action");
90
- } }, v = (e) => typeof e == "function" ? e(le) : e, K = O !== void 0, k = L !== void 0 ? v(L) : K ? /* @__PURE__ */ t(N, {
114
+ return e.addEventListener("close", a), () => e.removeEventListener("close", a);
115
+ }, [n]);
116
+ const ee = De(Be(j, ze), S);
117
+ if (!V) return null;
118
+ const Ne = { close: () => {
119
+ d("action");
120
+ } }, E = (e) => typeof e == "function" ? e(Ne) : e, te = j !== void 0, O = A !== void 0 ? E(A) : te ? /* @__PURE__ */ t(I, {
91
121
  dataTest: `${s}-view-results`,
92
122
  type: "button",
93
123
  variant: "text",
94
124
  onClick: () => {
95
- i("viewResults");
125
+ d("viewResults");
96
126
  },
97
- children: V
98
- }) : void 0, U = v(Z), b = v(ee), S = !!(k ?? U), z = q > 0;
127
+ children: ee
128
+ }) : void 0, re = E(fe), k = E(me), B = !!(O ?? re), H = Z !== null, ne = W > 0 || H;
99
129
  return /* @__PURE__ */ t("dialog", {
100
- ref: d,
101
- id: Q,
130
+ ref: f,
131
+ id: le,
102
132
  tabIndex: -1,
103
133
  "aria-modal": "true",
104
- "aria-labelledby": m ? D : void 0,
105
- "aria-label": m ? void 0 : Y,
134
+ "aria-labelledby": x ? P : void 0,
135
+ "aria-label": x ? void 0 : ce,
106
136
  "data-test": s,
107
137
  "data-testid": s,
108
138
  onCancel: (e) => {
109
- if (e.cancelable && e.preventDefault(), !w.current) {
110
- if (!X()) {
111
- h.current("escape");
139
+ if (e.cancelable && e.preventDefault(), !T.current) {
140
+ if (!oe()) {
141
+ g.current("escape");
112
142
  return;
113
143
  }
114
- R();
144
+ M();
115
145
  }
116
146
  },
117
- className: l(ke.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"),
118
- children: /* @__PURE__ */ f(fe.Provider, {
119
- value: M,
147
+ className: u(je.StyledBottomSheet, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none flex-col items-center justify-end overflow-visible border-0 bg-transparent p-0 outline-none open:flex"),
148
+ children: /* @__PURE__ */ p(Le.Provider, {
149
+ value: z,
120
150
  children: [/* @__PURE__ */ t("div", {
121
151
  "aria-hidden": "true",
122
152
  "data-testid": `${s}-scrim`,
123
153
  onClick: () => {
124
- i("scrim");
154
+ d("scrim");
125
155
  },
126
- className: l("absolute inset-0 bg-[#626e7eb2] transition-opacity duration-[250ms] ease-out motion-reduce:duration-150", g ? "opacity-100" : "opacity-0")
127
- }), /* @__PURE__ */ f("div", {
128
- ref: H,
129
- "data-state": g ? "open" : "closed",
130
- style: z ? { transform: `translateY(${q}px)` } : void 0,
131
- 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", $ ? "h-full max-h-none rounded-none" : l("rounded-t-[28px]", u ? "max-h-[90dvh]" : "max-h-[50dvh]"), !z && ["ease-out motion-safe:transition-transform motion-safe:duration-[250ms] motion-reduce:transition-opacity motion-reduce:duration-150", g ? "translate-y-0 opacity-100" : "motion-safe:translate-y-full motion-reduce:opacity-0"], re),
156
+ style: C > 0 ? { opacity: 1 - C } : void 0,
157
+ className: u("absolute inset-0 bg-[#626e7eb2]", C === 0 && ["transition-opacity motion-reduce:duration-150", w ? ["opacity-100", se] : ["opacity-0", ie]])
158
+ }), /* @__PURE__ */ p("div", {
159
+ ref: _,
160
+ "data-state": w ? "open" : "closed",
161
+ style: H ? { maxHeight: `min(${Z}px, 90dvh)` } : ne ? { transform: `translateY(${W}px)` } : void 0,
162
+ className: u("relative box-border flex w-full max-w-[640px] flex-col bg-white text-delta-700 outline-none", y ? "h-full max-h-none rounded-none" : u("rounded-t-[28px]", !H && (l ? "max-h-[90dvh]" : "max-h-[50dvh]")), !ne && [
163
+ "motion-safe:transition-[transform,max-height] motion-reduce:transition-opacity motion-reduce:duration-150",
164
+ w ? se : ie,
165
+ w ? "translate-y-0 opacity-100" : "motion-safe:translate-y-full motion-reduce:opacity-0"
166
+ ], he),
132
167
  children: [
133
- /* @__PURE__ */ f("div", {
168
+ /* @__PURE__ */ p("div", {
134
169
  className: "border-b-solid shrink-0 border-b border-delta-200 pb-2",
135
- children: [/* @__PURE__ */ f("div", {
136
- ...ie,
170
+ children: [/* @__PURE__ */ p("div", {
171
+ ...ke,
137
172
  className: "relative flex h-12 touch-none items-center gap-2 px-2",
138
173
  children: [
139
174
  /* @__PURE__ */ t("div", {
140
175
  className: "flex min-w-0 flex-1 items-center",
141
- children: B && /* @__PURE__ */ t(N, {
176
+ children: D && /* @__PURE__ */ t(I, {
142
177
  dataTest: `${s}-back`,
143
178
  variant: "textGray",
144
179
  type: "button",
145
- "aria-label": J ?? E.back,
146
- onClick: B,
147
- startIcon: /* @__PURE__ */ t(ue, {
180
+ "aria-label": de ?? R.back,
181
+ onClick: D,
182
+ startIcon: /* @__PURE__ */ t(Te, {
148
183
  width: 24,
149
184
  height: 24
150
185
  })
151
186
  })
152
187
  }),
153
- A ? /* @__PURE__ */ t("button", {
188
+ Q ? /* @__PURE__ */ t("button", {
154
189
  type: "button",
155
190
  "data-drag-handle": !0,
156
191
  "data-testid": `${s}-drag-handle`,
157
- "aria-label": u ? E.collapse : E.expand,
158
- "aria-expanded": u,
192
+ "aria-label": l ? R.collapse : R.expand,
193
+ "aria-expanded": l,
159
194
  onClick: () => {
160
- p((e) => !e);
195
+ l ? Y() : h(!0);
161
196
  },
162
197
  className: "absolute left-1/2 top-1/2 flex h-6 w-12 -translate-x-1/2 -translate-y-1/2 cursor-grab items-center justify-center rounded border-0 bg-transparent p-0 outline-none focus-visible:[box-shadow:inset_0_0_0_2px_var(--colors-focus-ring)]",
163
198
  children: /* @__PURE__ */ t("span", {
@@ -169,55 +204,65 @@ var Ce = 500, ze = ({ dataTest: s, id: Q, open: r, onClose: i, title: m, ariaLab
169
204
  "data-testid": `${s}-drag-handle`,
170
205
  className: "pointer-events-none absolute left-1/2 top-1/2 h-1 w-8 -translate-x-1/2 -translate-y-1/2 rounded-full bg-delta-700"
171
206
  }),
172
- /* @__PURE__ */ t(N, {
207
+ /* @__PURE__ */ t(I, {
173
208
  dataTest: `${s}-close`,
174
209
  variant: "textGray",
175
210
  type: "button",
176
- "aria-label": te,
211
+ "aria-label": pe,
177
212
  onClick: () => {
178
- i("closeButton");
213
+ d("closeButton");
179
214
  },
180
- startIcon: /* @__PURE__ */ t(de, {
215
+ startIcon: /* @__PURE__ */ t(_e, {
181
216
  width: 24,
182
217
  height: 24
183
218
  })
184
219
  })
185
220
  ]
186
- }), m && /* @__PURE__ */ f("div", {
221
+ }), x && /* @__PURE__ */ p("div", {
187
222
  className: "flex items-center gap-1 px-4",
188
- children: [_ && /* @__PURE__ */ t("span", {
223
+ children: [$ && /* @__PURE__ */ t("span", {
189
224
  "aria-hidden": "true",
190
225
  className: "flex size-5 shrink-0 items-center justify-center text-delta-700",
191
- children: _
226
+ children: $
192
227
  }), /* @__PURE__ */ t("div", {
193
- id: D,
228
+ id: P,
194
229
  className: "min-w-0 flex-1 truncate text-lg font-semibold leading-7 text-delta-800",
195
- children: m
230
+ children: x
196
231
  })]
197
232
  })]
198
233
  }),
199
234
  /* @__PURE__ */ t("div", {
200
- ref: F,
201
- className: l("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain pl-4 pr-2 pt-2", S || b ? "pb-2" : "pb-[max(0.5rem,env(safe-area-inset-bottom))]"),
202
- children: v(W)
235
+ ref: ye,
236
+ className: u("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain pl-4 pr-2 pt-2", B || k ? "pb-2" : "pb-[max(0.5rem,env(safe-area-inset-bottom))]"),
237
+ children: E(ue)
203
238
  }),
204
- S && /* @__PURE__ */ f("div", {
205
- className: l("border-t-solid flex shrink-0 items-start border-t border-delta-200 bg-white p-1", k ? "justify-between" : "justify-end", "max-xs:flex-wrap max-xs:gap-y-2 max-xs:[&>:nth-child(2)]:ml-auto", !b && "pb-[max(0.25rem,env(safe-area-inset-bottom))]"),
239
+ B && /* @__PURE__ */ p("div", {
240
+ className: u("border-t-solid flex shrink-0 items-start border-t border-delta-200 bg-white p-1", O ? "justify-between" : "justify-end", "max-xs:flex-wrap max-xs:gap-y-2 max-xs:[&>:nth-child(2)]:ml-auto", !k && "pb-[max(0.25rem,env(safe-area-inset-bottom))]"),
206
241
  children: [
207
- k,
208
- U,
209
- K && /* @__PURE__ */ t("span", {
242
+ O,
243
+ re,
244
+ te && /* @__PURE__ */ t("span", {
210
245
  className: "sr-only",
211
246
  role: "status",
212
247
  "aria-live": "polite",
213
248
  "aria-atomic": "true",
214
- children: V
249
+ children: ee
215
250
  })
216
251
  ]
217
252
  }),
218
- b && /* @__PURE__ */ t("div", {
219
- className: l("flex shrink-0 flex-col items-end bg-white p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]", S && "max-xs:pt-1"),
220
- children: b
253
+ k && /* @__PURE__ */ t("div", {
254
+ className: u("flex shrink-0 flex-col items-end bg-white p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]", B && "max-xs:pt-1"),
255
+ children: k
256
+ }),
257
+ !y && /* @__PURE__ */ t("span", {
258
+ "aria-hidden": "true",
259
+ "data-testid": `${s}-skirt`,
260
+ className: "pointer-events-none absolute inset-x-0 top-full h-[100lvh] bg-white"
261
+ }),
262
+ /* @__PURE__ */ t("span", {
263
+ "aria-hidden": "true",
264
+ "data-testid": `${s}-edge`,
265
+ className: "pointer-events-none absolute inset-0 rounded-[inherit] [box-shadow:inset_0_0_0_1px_var(--colors-delta-300)]"
221
266
  })
222
267
  ]
223
268
  })]
@@ -225,5 +270,5 @@ var Ce = 500, ze = ({ dataTest: s, id: Q, open: r, onClose: i, title: m, ariaLab
225
270
  });
226
271
  };
227
272
  export {
228
- ze as StyledBottomSheet
273
+ dt as StyledBottomSheet
229
274
  };