asma-ui-core 3.134.6 → 3.135.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,178 +1,223 @@
1
1
  import { cn as l } from "../../../helpers/cn.js";
2
- import { registerOpenModalDialog as W } from "../../../hooks/useTopLayer.hook.js";
3
- import { CloseIcon as Z } from "../../icons/close-icon/CloseIcon.js";
4
- import { IndeterminateIcon as ee } from "../../icons/indeterminate-icon/IndeterminateIcon.js";
5
- import { StyledButton as P } from "../../inputs/button/StyledButton.js";
6
- import { OverlayBackOwnerContext as te, isOverlayBackEnabled as q, requestCloseTopOverlayBack as w, useBackCloses as re } from "../../../hooks/useBackCloses.hook.js";
7
- import { isKeyboardModality as oe, trackInputModality as ne } from "../../inputs/full-screen-picker/inputModality.js";
8
- import { useDebouncedValue as ae } from "../../../hooks/useDebouncedValue.hook.js";
9
- import { useFocusTrap as se } from "../../../hooks/useFocusTrap.hook.js";
10
- import { useShortViewportMediaQuery as ie } from "../../../hooks/useMediaQuery.hook.js";
11
- import { SHEET_TEXT as le } from "./sheetCopy.js";
12
- import { formatResultsLabel as ce } from "./formatResultsLabel.js";
13
- import { useBodyScrollLock as de } from "../../../hooks/useBodyScrollLock.hook.js";
14
- import ue from "./StyledBottomSheet.module.js";
15
- import { useDragToDismiss as me } from "./useDragToDismiss.hook.js";
16
- import { useEffect as g, useId as fe, useLayoutEffect as pe, useRef as c, useState as ve } from "react";
17
- import { jsx as o, jsxs as u } from "react/jsx-runtime";
18
- var he = 500, Fe = ({ dataTest: d, id: V, open: t, onClose: a, title: m, ariaLabel: $, children: A, viewResultsAction: E, resetAction: H, footerActions: K, resultCount: k, locale: S = "en", closeLabel: U = le[S].close, className: G, registerBackClose: Q = !0, ownerRef: X, triggerRef: N }) => {
19
- const R = fe(), i = c(null), B = c(null), L = c(null), C = X ?? i, h = c(!1), [x, I] = ve(!1), Y = ie(), f = c(a), O = c(t);
20
- g(() => {
21
- f.current = a, O.current = t;
22
- }, [a, t]);
23
- const { dragHandleProps: z, dragOffset: D } = me(B, () => {
24
- f.current("drag");
25
- });
26
- de(t), se(t, i), g(() => {
27
- if (!t) return;
28
- const e = (r) => {
29
- r.key === "Escape" && (h.current = !0, window.setTimeout(() => {
30
- h.current = !1;
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);
32
+ };
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;
31
43
  }, 0));
32
- }, n = (r) => {
33
- if (r.key !== "Escape" || r.defaultPrevented) return;
34
- const s = document.activeElement;
35
- s instanceof Element && s.closest("dialog[open]") !== i.current || (r.preventDefault(), r.stopImmediatePropagation(), w(r));
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));
36
48
  };
37
- return window.addEventListener("keydown", e, !0), window.addEventListener("keydown", n), () => {
38
- window.removeEventListener("keydown", e, !0), window.removeEventListener("keydown", n);
49
+ return window.addEventListener("keydown", e, !0), window.addEventListener("keydown", a), () => {
50
+ window.removeEventListener("keydown", e, !0), window.removeEventListener("keydown", a);
39
51
  };
40
- }, [t]), re({
41
- active: t && Q,
42
- requestClose: () => f.current("escape"),
43
- ownerRef: C
44
- }), pe(() => {
45
- const e = i.current;
46
- if (!t || !e) return;
47
- ne();
48
- const n = document.activeElement instanceof HTMLElement ? document.activeElement : null;
49
- L.current = N?.current ?? n, e.open || e.showModal(), e.focus({ preventScroll: !0 });
50
- const r = requestAnimationFrame(() => {
51
- I(!0);
52
- }), s = W(e);
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);
53
65
  return () => {
54
- cancelAnimationFrame(r), s(), I(!1), e.open && e.close();
55
- const j = L.current;
56
- j?.isConnected && j.focus({
66
+ cancelAnimationFrame(o), n(), j(!1), p(!1), e.open && e.close();
67
+ const G = I.current;
68
+ G?.isConnected && G.focus({
57
69
  preventScroll: !0,
58
- focusVisible: oe()
70
+ focusVisible: pe()
59
71
  });
60
72
  };
61
- }, [t, N]), g(() => {
62
- const e = i.current;
63
- if (!e || !t) return;
64
- let n = !1;
65
- const r = () => {
73
+ }, [r, T]), x(() => {
74
+ const e = d.current;
75
+ if (!e || !r) return;
76
+ let a = !1;
77
+ const o = () => {
66
78
  requestAnimationFrame(() => {
67
- n = !1, O.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
79
+ a = !1, P.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
68
80
  });
69
- }, s = () => {
70
- n || (n = !0, q() && w(), r());
81
+ }, n = () => {
82
+ a || (a = !0, X() && R(), o());
71
83
  };
72
- return e.addEventListener("close", s), () => e.removeEventListener("close", s);
73
- }, [t]);
74
- const M = ce(ae(k, he), S);
75
- if (!t) return null;
76
- const J = { close: () => {
77
- a("action");
78
- } }, p = (e) => typeof e == "function" ? e(J) : e, T = k !== void 0, b = E !== void 0 ? p(E) : T ? /* @__PURE__ */ o(P, {
79
- dataTest: `${d}-view-results`,
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, {
91
+ dataTest: `${s}-view-results`,
80
92
  type: "button",
81
93
  variant: "text",
82
94
  onClick: () => {
83
- a("viewResults");
95
+ i("viewResults");
84
96
  },
85
- children: M
86
- }) : void 0, F = p(H), v = p(K), y = !!(b ?? F), _ = D > 0;
87
- return /* @__PURE__ */ o("dialog", {
88
- ref: i,
89
- id: V,
97
+ children: V
98
+ }) : void 0, U = v(Z), b = v(ee), S = !!(k ?? U), z = q > 0;
99
+ return /* @__PURE__ */ t("dialog", {
100
+ ref: d,
101
+ id: Q,
90
102
  tabIndex: -1,
91
103
  "aria-modal": "true",
92
- "aria-labelledby": m ? R : void 0,
93
- "aria-label": m ? void 0 : $,
94
- "data-test": d,
95
- "data-testid": d,
104
+ "aria-labelledby": m ? D : void 0,
105
+ "aria-label": m ? void 0 : Y,
106
+ "data-test": s,
107
+ "data-testid": s,
96
108
  onCancel: (e) => {
97
- if (e.cancelable && e.preventDefault(), !h.current) {
98
- if (!q()) {
99
- f.current("escape");
109
+ if (e.cancelable && e.preventDefault(), !w.current) {
110
+ if (!X()) {
111
+ h.current("escape");
100
112
  return;
101
113
  }
102
- w();
114
+ R();
103
115
  }
104
116
  },
105
- className: l(ue.StyledBottomSheet, "fixed inset-0 m-0 h-full max-h-none w-full max-w-none flex-col items-center justify-end overflow-hidden border-0 bg-transparent p-0 outline-none open:flex"),
106
- children: /* @__PURE__ */ u(te.Provider, {
107
- value: C,
108
- children: [/* @__PURE__ */ o("div", {
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,
120
+ children: [/* @__PURE__ */ t("div", {
109
121
  "aria-hidden": "true",
110
- "data-testid": `${d}-scrim`,
122
+ "data-testid": `${s}-scrim`,
111
123
  onClick: () => {
112
- a("scrim");
124
+ i("scrim");
113
125
  },
114
- className: l("absolute inset-0 bg-[#626e7eb2] transition-opacity duration-[250ms] ease-out motion-reduce:duration-150", x ? "opacity-100" : "opacity-0")
115
- }), /* @__PURE__ */ u("div", {
116
- ref: B,
117
- "data-state": x ? "open" : "closed",
118
- style: _ ? { transform: `translateY(${D}px)` } : void 0,
119
- className: l("relative box-border flex w-full max-w-[640px] flex-col border border-solid border-delta-300 bg-white text-delta-700 outline-none", Y ? "h-full max-h-none rounded-none" : "max-h-[90dvh] rounded-t-[28px]", !_ && ["ease-out motion-safe:transition-transform motion-safe:duration-[250ms] motion-reduce:transition-opacity motion-reduce:duration-150", x ? "translate-y-0 opacity-100" : "motion-safe:translate-y-full motion-reduce:opacity-0"], G),
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),
120
132
  children: [
121
- /* @__PURE__ */ u("div", {
133
+ /* @__PURE__ */ f("div", {
122
134
  className: "border-b-solid shrink-0 border-b border-delta-200 pb-2",
123
- children: [/* @__PURE__ */ u("div", {
124
- ...z,
135
+ children: [/* @__PURE__ */ f("div", {
136
+ ...ie,
125
137
  className: "relative flex h-12 touch-none items-center gap-2 px-2",
126
138
  children: [
127
- /* @__PURE__ */ o("div", { className: "min-w-0 flex-1" }),
128
- /* @__PURE__ */ o(P, {
129
- dataTest: `${d}-close`,
139
+ /* @__PURE__ */ t("div", {
140
+ className: "flex min-w-0 flex-1 items-center",
141
+ children: B && /* @__PURE__ */ t(N, {
142
+ dataTest: `${s}-back`,
143
+ variant: "textGray",
144
+ type: "button",
145
+ "aria-label": J ?? E.back,
146
+ onClick: B,
147
+ startIcon: /* @__PURE__ */ t(ue, {
148
+ width: 24,
149
+ height: 24
150
+ })
151
+ })
152
+ }),
153
+ A ? /* @__PURE__ */ t("button", {
154
+ type: "button",
155
+ "data-drag-handle": !0,
156
+ "data-testid": `${s}-drag-handle`,
157
+ "aria-label": u ? E.collapse : E.expand,
158
+ "aria-expanded": u,
159
+ onClick: () => {
160
+ p((e) => !e);
161
+ },
162
+ 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
+ children: /* @__PURE__ */ t("span", {
164
+ "aria-hidden": "true",
165
+ className: "h-1 w-8 rounded-full bg-delta-700"
166
+ })
167
+ }) : /* @__PURE__ */ t("span", {
168
+ "aria-hidden": "true",
169
+ "data-testid": `${s}-drag-handle`,
170
+ 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
+ }),
172
+ /* @__PURE__ */ t(N, {
173
+ dataTest: `${s}-close`,
130
174
  variant: "textGray",
131
175
  type: "button",
132
- "aria-label": U,
176
+ "aria-label": te,
133
177
  onClick: () => {
134
- a("closeButton");
178
+ i("closeButton");
135
179
  },
136
- startIcon: /* @__PURE__ */ o(Z, {
180
+ startIcon: /* @__PURE__ */ t(de, {
137
181
  width: 24,
138
182
  height: 24
139
183
  })
140
- }),
141
- /* @__PURE__ */ o(ee, {
142
- "aria-hidden": "true",
143
- focusable: "false",
144
- width: 24,
145
- height: 24,
146
- className: "pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-delta-800"
147
184
  })
148
185
  ]
149
- }), m && /* @__PURE__ */ o("div", {
150
- id: R,
151
- className: "truncate px-4 text-lg font-semibold leading-7 text-delta-800",
152
- children: m
186
+ }), m && /* @__PURE__ */ f("div", {
187
+ className: "flex items-center gap-1 px-4",
188
+ children: [_ && /* @__PURE__ */ t("span", {
189
+ "aria-hidden": "true",
190
+ className: "flex size-5 shrink-0 items-center justify-center text-delta-700",
191
+ children: _
192
+ }), /* @__PURE__ */ t("div", {
193
+ id: D,
194
+ className: "min-w-0 flex-1 truncate text-lg font-semibold leading-7 text-delta-800",
195
+ children: m
196
+ })]
153
197
  })]
154
198
  }),
155
- /* @__PURE__ */ o("div", {
156
- className: l("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain pl-4 pr-2 pt-2", y || v ? "pb-2" : "pb-[max(0.5rem,env(safe-area-inset-bottom))]"),
157
- children: p(A)
199
+ /* @__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)
158
203
  }),
159
- y && /* @__PURE__ */ u("div", {
160
- className: l("border-t-solid flex shrink-0 items-start border-t border-delta-200 bg-white p-1", b ? "justify-between" : "justify-end", "max-xs:flex-wrap max-xs:gap-y-2 max-xs:[&>:nth-child(2)]:ml-auto", !v && "pb-[max(0.25rem,env(safe-area-inset-bottom))]"),
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))]"),
161
206
  children: [
162
- b,
163
- F,
164
- T && /* @__PURE__ */ o("span", {
207
+ k,
208
+ U,
209
+ K && /* @__PURE__ */ t("span", {
165
210
  className: "sr-only",
166
211
  role: "status",
167
212
  "aria-live": "polite",
168
213
  "aria-atomic": "true",
169
- children: M
214
+ children: V
170
215
  })
171
216
  ]
172
217
  }),
173
- v && /* @__PURE__ */ o("div", {
174
- className: l("flex shrink-0 flex-col items-end bg-white p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]", y && "max-xs:pt-1"),
175
- children: v
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
176
221
  })
177
222
  ]
178
223
  })]
@@ -180,5 +225,5 @@ var he = 500, Fe = ({ dataTest: d, id: V, open: t, onClose: a, title: m, ariaLab
180
225
  });
181
226
  };
182
227
  export {
183
- Fe as StyledBottomSheet
228
+ ze as StyledBottomSheet
184
229
  };
@@ -9,7 +9,19 @@ var e = {
9
9
  viewResults: "View results",
10
10
  noMatches: "No matches"
11
11
  }
12
+ }, s = {
13
+ no: {
14
+ expand: "Utvid",
15
+ collapse: "Minimer",
16
+ back: "Tilbake"
17
+ },
18
+ en: {
19
+ expand: "Expand",
20
+ collapse: "Minimize",
21
+ back: "Back"
22
+ }
12
23
  };
13
24
  export {
25
+ s as SHEET_HEADER_TEXT,
14
26
  e as SHEET_TEXT
15
27
  };
@@ -1,40 +1,46 @@
1
- import { useRef as c, useState as l } from "react";
2
- var p = 0.3, f = (i, u) => {
3
- const [a, n] = l(0), e = c(null), o = (r, t) => {
4
- e.current?.pointerId === r.pointerId && (e.current = null, r.currentTarget.hasPointerCapture(r.pointerId) && r.currentTarget.releasePointerCapture(r.pointerId), n(0), t && u());
1
+ import { useRef as d, useState as p } from "react";
2
+ var f = 0.3, g = 48, l = 4, h = (i, u, c) => {
3
+ const [s, o] = p(0), n = d(null), a = (r, t) => {
4
+ const e = n.current;
5
+ e?.pointerId === r.pointerId && (n.current = null, r.currentTarget.hasPointerCapture(r.pointerId) && r.currentTarget.releasePointerCapture(r.pointerId), o(0), e.captured && (t > e.height * f ? u() : t < -g && c?.()));
5
6
  };
6
7
  return {
7
- dragOffset: a,
8
+ dragOffset: s,
8
9
  dragHandleProps: {
9
10
  onPointerDown: (r) => {
10
- if (r.pointerType === "mouse" && r.button !== 0 || r.target instanceof Element && r.target.closest("button")) return;
11
+ if (r.pointerType === "mouse" && r.button !== 0 || r.target instanceof Element && r.target.closest("button:not([data-drag-handle])")) return;
11
12
  const t = i.current;
12
- if (t) {
13
- e.current = {
14
- pointerId: r.pointerId,
15
- startY: r.clientY,
16
- height: t.getBoundingClientRect().height
17
- };
13
+ t && (n.current = {
14
+ pointerId: r.pointerId,
15
+ startY: r.clientY,
16
+ height: t.getBoundingClientRect().height,
17
+ captured: !1
18
+ });
19
+ },
20
+ onPointerMove: (r) => {
21
+ const t = n.current;
22
+ if (t?.pointerId !== r.pointerId) return;
23
+ const e = r.clientY - t.startY;
24
+ if (!t.captured) {
25
+ if (Math.abs(e) < l) return;
26
+ t.captured = !0;
18
27
  try {
19
28
  r.currentTarget.setPointerCapture(r.pointerId);
20
29
  } catch {
21
30
  }
22
31
  }
23
- },
24
- onPointerMove: (r) => {
25
- const t = e.current;
26
- t?.pointerId === r.pointerId && n(Math.max(0, r.clientY - t.startY));
32
+ o(Math.max(0, e));
27
33
  },
28
34
  onPointerUp: (r) => {
29
- const t = e.current, s = t ? r.clientY - t.startY : 0;
30
- o(r, t !== null && s > t.height * p);
35
+ const t = n.current;
36
+ a(r, t ? r.clientY - t.startY : 0);
31
37
  },
32
38
  onPointerCancel: (r) => {
33
- o(r, !1);
39
+ a(r, 0);
34
40
  }
35
41
  }
36
42
  };
37
43
  };
38
44
  export {
39
- f as useDragToDismiss
45
+ h as useDragToDismiss
40
46
  };
@@ -2,7 +2,7 @@ import { ReactNode, RefObject } from 'react';
2
2
  import { UiCoreLocale } from '../../../helpers/uiCoreLocale';
3
3
  import { PopoverSlot } from '../popover/PopoverSheet';
4
4
  export type BottomSheetCloseReason = 'closeButton' | 'scrim' | 'escape' | 'drag' | 'viewResults' | 'action';
5
- /** @figmaNode 9Q7C7JYPgnUSsrX1L8v40t#5354-169163 (Ad-Voca-concept · "_bottom sheet") */
5
+ /** @figmaNode rIndtQfMCi8wQ46CQ2oqsb#7-10991 (DS_draft · "_bottom sheet", approved) */
6
6
  export interface StyledBottomSheetProps {
7
7
  /** @figmaProp none — test hook */
8
8
  dataTest: string;
@@ -20,6 +20,15 @@ export interface StyledBottomSheetProps {
20
20
  title?: ReactNode;
21
21
  /** @figmaProp none — a11y: the dialog's name when there is no `title` */
22
22
  ariaLabel?: string;
23
+ /** @figmaProp Icon = ReactNode→true | undefined→false — the 20px icon before the title */
24
+ titleIcon?: ReactNode;
25
+ /**
26
+ * Shows the header's back control, e.g. to return from a sub-step to the previous sheet content.
27
+ * @figmaProp Back = function→true | undefined→false
28
+ */
29
+ onBack?: () => void;
30
+ /** @figmaProp none — a11y: accessible name of the back control; defaults to "Back" in `locale` */
31
+ backLabel?: string;
23
32
  /** @figmaProp Slot — the scrollable body */
24
33
  children: PopoverSlot;
25
34
  /**
@@ -57,16 +66,18 @@ export interface StyledBottomSheetProps {
57
66
  }
58
67
  /**
59
68
  * ASMA Design System **Bottom Sheet** (ASMA-8184) — the mobile (0–743px) form of the Action popover:
60
- * a modal sheet with a dimmed scrim, top-rounded container, decorative grabber, header (title +
61
- * close), a body that scrolls internally and an optional sticky footer.
69
+ * a modal sheet with a dimmed scrim, top-rounded container, drag handle, header (optional back,
70
+ * close, optional icon + title), a body that scrolls internally and an optional sticky footer.
62
71
  *
63
- * Height fits the content up to 90vh; there are no resize detents. Below 480px of viewport height
64
- * (a phone in landscape) it becomes a full-screen dialog instead. Five equivalent dismiss routes —
65
- * close button, "Vis resultater", scrim, Escape, dragging down past 30% — and none of them commits
66
- * or discards anything: filters apply as the user goes and actions commit on activation.
72
+ * Height fits the content, with no minimum, up to half the screen. A sheet whose content needs more
73
+ * can be expanded to 90vh — by dragging the handle up, or by activating it (Tab lands on it, Space /
74
+ * Enter toggle between the two heights) — and scrolls internally from there. Below 480px of viewport
75
+ * height (a phone in landscape) it becomes a full-screen dialog instead. Five equivalent dismiss
76
+ * routes — close button, "Vis resultater", scrim, Escape, dragging down past 30% — and none of them
77
+ * commits or discards anything: filters apply as the user goes and actions commit on activation.
67
78
  *
68
79
  * Interaction model is the popover's: `role="dialog"`, `Tab` only, no `role="menu"`, no arrow keys.
69
80
  * Focus moves to the sheet on open (so the title is announced first) and back to the trigger on
70
81
  * close. `PopoverSheet` with `variant='action'` renders this automatically below 744px.
71
82
  */
72
- export declare const StyledBottomSheet: ({ dataTest, id, open, onClose, title, ariaLabel, children, viewResultsAction, resetAction, footerActions, resultCount, locale, closeLabel, className, registerBackClose, ownerRef, triggerRef, }: StyledBottomSheetProps) => JSX.Element | null;
83
+ export declare const StyledBottomSheet: ({ dataTest, id, open, onClose, title, ariaLabel, titleIcon, onBack, backLabel, children, viewResultsAction, resetAction, footerActions, resultCount, locale, closeLabel, className, registerBackClose, ownerRef, triggerRef, }: StyledBottomSheetProps) => JSX.Element | null;
@@ -9,3 +9,9 @@ export declare const SHEET_TEXT: Record<UiCoreLocale, {
9
9
  viewResults: string;
10
10
  noMatches: string;
11
11
  }>;
12
+ /** Names of the sheet's header controls, worded as `MinimizableDialog`'s expand/minimize and the header's back. */
13
+ export declare const SHEET_HEADER_TEXT: Record<UiCoreLocale, {
14
+ expand: string;
15
+ collapse: string;
16
+ back: string;
17
+ }>;
@@ -12,11 +12,13 @@ interface DragToDismiss {
12
12
  dragOffset: number;
13
13
  }
14
14
  /**
15
- * Drag the sheet down past 30% of its height to dismiss it; release earlier and it snaps back.
15
+ * Drag the sheet down past 30% of its height to dismiss it; release earlier and it snaps back. Drag it
16
+ * up by 48px and `onDragUp` runs, which expands a sheet that has a taller height.
16
17
  *
17
- * Deliberately never the only exit (WCAG 2.5.7): the close button, the scrim and Escape all do the
18
- * same without a dragging movement. A press that starts on a button in the drag zone is left alone,
19
- * so the close control keeps working as a plain click.
18
+ * Deliberately never the only exit or the only way to resize (WCAG 2.5.7): the close button, the scrim
19
+ * and Escape close it, and the drag handle toggles the height as a button. A press that starts on any
20
+ * other button in the drag zone is left alone, so the close control keeps working as a plain click.
21
+ * The pointer is captured only once it has moved, so a tap on the drag handle stays a click.
20
22
  */
21
- export declare const useDragToDismiss: (sheetRef: RefObject<HTMLElement | null>, onDismiss: () => void) => DragToDismiss;
23
+ export declare const useDragToDismiss: (sheetRef: RefObject<HTMLElement | null>, onDismiss: () => void, onDragUp?: () => void) => DragToDismiss;
22
24
  export {};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.134.6",
6
+ "version": "3.135.0",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",