asma-ui-core 3.128.0 → 3.128.1

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.
@@ -2,26 +2,27 @@ import { cn as l } from "../../../helpers/cn.js";
2
2
  import { registerOpenModalDialog as z } from "../../../hooks/useTopLayer.hook.js";
3
3
  import { CloseIcon as J } from "../../icons/close-icon/CloseIcon.js";
4
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 y, 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 g, useId as ie, useLayoutEffect as le, useRef as c, useState as ce } from "react";
5
+ import { StyledButton as _ } from "../../inputs/button/StyledButton.js";
6
+ import { useShortViewportMediaQuery as Z } from "../../../hooks/useMediaQuery.hook.js";
7
+ import { OverlayBackOwnerContext as ee, isOverlayBackEnabled as j, requestCloseTopOverlayBack as y, useBackCloses as te } from "../../../hooks/useBackCloses.hook.js";
8
+ import { useDebouncedValue as re } from "../../../hooks/useDebouncedValue.hook.js";
9
+ import { useFocusTrap as oe } from "../../../hooks/useFocusTrap.hook.js";
10
+ import { SHEET_TEXT as ne } from "./sheetCopy.js";
11
+ import { formatResultsLabel as ae } from "./formatResultsLabel.js";
12
+ import { useBodyScrollLock as se } from "../../../hooks/useBodyScrollLock.hook.js";
13
+ import ie from "./StyledBottomSheet.module.js";
14
+ import { useDragToDismiss as le } from "./useDragToDismiss.hook.js";
15
+ import { useEffect as g, useId as ce, useLayoutEffect as de, useRef as c, useState as ue } from "react";
15
16
  import { jsx as o, jsxs as u } from "react/jsx-runtime";
16
- var de = 500, Le = ({ dataTest: d, id: T, open: t, onClose: s, title: m, ariaLabel: _, children: q, viewResultsAction: E, resetAction: $, footerActions: A, resultCount: k, closeLabel: U = "Lukk", className: V, registerBackClose: H = !0, ownerRef: K }) => {
17
- const S = ie(), i = c(null), N = c(null), R = c(null), L = K ?? i, h = c(!1), [x, B] = ce(!1), G = X(), f = c(s), C = c(t);
17
+ var me = 500, Oe = ({ dataTest: d, id: P, open: t, onClose: s, title: m, ariaLabel: q, children: $, viewResultsAction: E, resetAction: A, footerActions: H, resultCount: S, locale: k = "en", closeLabel: U = ne[k].close, className: V, registerBackClose: K = !0, ownerRef: G }) => {
18
+ const N = ce(), i = c(null), R = c(null), B = c(null), L = G ?? i, h = c(!1), [x, C] = ue(!1), Q = Z(), f = c(s), O = c(t);
18
19
  g(() => {
19
- f.current = s, C.current = t;
20
+ f.current = s, O.current = t;
20
21
  }, [s, t]);
21
- const { dragHandleProps: Q, dragOffset: O } = se(N, () => {
22
+ const { dragHandleProps: X, dragOffset: I } = le(R, () => {
22
23
  f.current("drag");
23
24
  });
24
- ne(t), re(t, i), g(() => {
25
+ se(t), oe(t, i), g(() => {
25
26
  if (!t) return;
26
27
  const e = (r) => {
27
28
  r.key === "Escape" && (h.current = !0, window.setTimeout(() => {
@@ -35,20 +36,20 @@ var de = 500, Le = ({ dataTest: d, id: T, open: t, onClose: s, title: m, ariaLab
35
36
  return window.addEventListener("keydown", e, !0), window.addEventListener("keydown", n), () => {
36
37
  window.removeEventListener("keydown", e, !0), window.removeEventListener("keydown", n);
37
38
  };
38
- }, [t]), ee({
39
- active: t && H,
39
+ }, [t]), te({
40
+ active: t && K,
40
41
  requestClose: () => f.current("escape"),
41
42
  ownerRef: L
42
- }), le(() => {
43
+ }), de(() => {
43
44
  const e = i.current;
44
45
  if (!t || !e) return;
45
- R.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.open || e.showModal(), e.focus({ preventScroll: !0 });
46
+ B.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.open || e.showModal(), e.focus({ preventScroll: !0 });
46
47
  const n = requestAnimationFrame(() => {
47
- B(!0);
48
+ C(!0);
48
49
  }), r = z(e);
49
50
  return () => {
50
- cancelAnimationFrame(n), r(), B(!1), e.open && e.close();
51
- const a = R.current;
51
+ cancelAnimationFrame(n), r(), C(!1), e.open && e.close();
52
+ const a = B.current;
52
53
  a?.isConnected && a.focus({ preventScroll: !0 });
53
54
  };
54
55
  }, [t]), g(() => {
@@ -57,46 +58,46 @@ var de = 500, Le = ({ dataTest: d, id: T, open: t, onClose: s, title: m, ariaLab
57
58
  let n = !1;
58
59
  const r = () => {
59
60
  requestAnimationFrame(() => {
60
- n = !1, C.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
61
+ n = !1, O.current && e.isConnected && !e.open && (e.showModal(), e.focus({ preventScroll: !0 }));
61
62
  });
62
63
  }, a = () => {
63
- n || (n = !0, P() && y(), r());
64
+ n || (n = !0, j() && y(), r());
64
65
  };
65
66
  return e.addEventListener("close", a), () => e.removeEventListener("close", a);
66
67
  }, [t]);
67
- const I = oe(te(k, de));
68
+ const D = ae(re(S, me), k);
68
69
  if (!t) return null;
69
70
  const Y = { close: () => {
70
71
  s("action");
71
- } }, p = (e) => typeof e == "function" ? e(Y) : e, D = k !== void 0, b = E !== void 0 ? p(E) : D ? /* @__PURE__ */ o(j, {
72
+ } }, p = (e) => typeof e == "function" ? e(Y) : e, T = S !== void 0, b = E !== void 0 ? p(E) : T ? /* @__PURE__ */ o(_, {
72
73
  dataTest: `${d}-view-results`,
73
74
  type: "button",
74
75
  variant: "text",
75
76
  onClick: () => {
76
77
  s("viewResults");
77
78
  },
78
- children: I
79
- }) : void 0, F = p($), v = p(A), w = !!(b ?? F), M = O > 0;
79
+ children: D
80
+ }) : void 0, F = p(A), v = p(H), w = !!(b ?? F), M = I > 0;
80
81
  return /* @__PURE__ */ o("dialog", {
81
82
  ref: i,
82
- id: T,
83
+ id: P,
83
84
  tabIndex: -1,
84
85
  "aria-modal": "true",
85
- "aria-labelledby": m ? S : void 0,
86
- "aria-label": m ? void 0 : _,
86
+ "aria-labelledby": m ? N : void 0,
87
+ "aria-label": m ? void 0 : q,
87
88
  "data-test": d,
88
89
  "data-testid": d,
89
90
  onCancel: (e) => {
90
91
  if (e.cancelable && e.preventDefault(), !h.current) {
91
- if (!P()) {
92
+ if (!j()) {
92
93
  f.current("escape");
93
94
  return;
94
95
  }
95
96
  y();
96
97
  }
97
98
  },
98
- className: l(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, {
99
+ className: l(ie.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"),
100
+ children: /* @__PURE__ */ u(ee.Provider, {
100
101
  value: L,
101
102
  children: [/* @__PURE__ */ o("div", {
102
103
  "aria-hidden": "true",
@@ -106,19 +107,19 @@ var de = 500, Le = ({ dataTest: d, id: T, open: t, onClose: s, title: m, ariaLab
106
107
  },
107
108
  className: l("absolute inset-0 bg-[#626e7eb2] transition-opacity duration-[250ms] ease-out motion-reduce:duration-150", x ? "opacity-100" : "opacity-0")
108
109
  }), /* @__PURE__ */ u("div", {
109
- ref: N,
110
+ ref: R,
110
111
  "data-state": x ? "open" : "closed",
111
- style: M ? { transform: `translateY(${O}px)` } : void 0,
112
- 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", 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", x ? "translate-y-0 opacity-100" : "motion-safe:translate-y-full motion-reduce:opacity-0"], V),
112
+ style: M ? { transform: `translateY(${I}px)` } : void 0,
113
+ 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", Q ? "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", x ? "translate-y-0 opacity-100" : "motion-safe:translate-y-full motion-reduce:opacity-0"], V),
113
114
  children: [
114
115
  /* @__PURE__ */ u("div", {
115
116
  className: "border-b-solid shrink-0 border-b border-delta-200 pb-2",
116
117
  children: [/* @__PURE__ */ u("div", {
117
- ...Q,
118
+ ...X,
118
119
  className: "relative flex h-12 touch-none items-center gap-2 px-2",
119
120
  children: [
120
121
  /* @__PURE__ */ o("div", { className: "min-w-0 flex-1" }),
121
- /* @__PURE__ */ o(j, {
122
+ /* @__PURE__ */ o(_, {
122
123
  dataTest: `${d}-close`,
123
124
  variant: "textGray",
124
125
  type: "button",
@@ -140,26 +141,26 @@ var de = 500, Le = ({ dataTest: d, id: T, open: t, onClose: s, title: m, ariaLab
140
141
  })
141
142
  ]
142
143
  }), m && /* @__PURE__ */ o("div", {
143
- id: S,
144
+ id: N,
144
145
  className: "truncate px-4 text-lg font-semibold leading-7 text-delta-800",
145
146
  children: m
146
147
  })]
147
148
  }),
148
149
  /* @__PURE__ */ o("div", {
149
150
  className: l("flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain pl-4 pr-2 pt-2", w || v ? "pb-2" : "pb-[max(0.5rem,env(safe-area-inset-bottom))]"),
150
- children: p(q)
151
+ children: p($)
151
152
  }),
152
153
  w && /* @__PURE__ */ u("div", {
153
154
  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))]"),
154
155
  children: [
155
156
  b,
156
157
  F,
157
- D && /* @__PURE__ */ o("span", {
158
+ T && /* @__PURE__ */ o("span", {
158
159
  className: "sr-only",
159
160
  role: "status",
160
161
  "aria-live": "polite",
161
162
  "aria-atomic": "true",
162
- children: I
163
+ children: D
163
164
  })
164
165
  ]
165
166
  }),
@@ -173,5 +174,5 @@ var de = 500, Le = ({ dataTest: d, id: T, open: t, onClose: s, title: m, ariaLab
173
174
  });
174
175
  };
175
176
  export {
176
- Le as StyledBottomSheet
177
+ Oe as StyledBottomSheet
177
178
  };
@@ -1,4 +1,8 @@
1
- var e = 9999, t = (r) => r == null ? "Vis resultater" : r === 0 ? "Ingen treff" : r > e ? `Vis resultater (${e}+)` : `Vis resultater (${r})`;
1
+ import { SHEET_TEXT as l } from "./sheetCopy.js";
2
+ var s = 9999, a = (r, t = "en") => {
3
+ const e = l[t];
4
+ return r == null ? e.showResults : r === 0 ? e.noMatches : r > s ? `${e.showResults} (${s}+)` : `${e.showResults} (${r})`;
5
+ };
2
6
  export {
3
- t as formatResultsLabel
7
+ a as formatResultsLabel
4
8
  };
@@ -0,0 +1,15 @@
1
+ var s = {
2
+ no: {
3
+ close: "Lukk",
4
+ showResults: "Vis resultater",
5
+ noMatches: "Ingen treff"
6
+ },
7
+ en: {
8
+ close: "Close",
9
+ showResults: "Show results",
10
+ noMatches: "No matches"
11
+ }
12
+ };
13
+ export {
14
+ s as SHEET_TEXT
15
+ };
@@ -1,63 +1,64 @@
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 = {
1
+ import { cn as Le } from "../../../helpers/cn.js";
2
+ import { firstTabbable as ne } from "../../../helpers/focusable.js";
3
+ import { TOP_LAYER_PROPS as Se, TOP_LAYER_RESET_STYLE as Ce, getOpenModalDialogAncestor as _e, shouldUsePopoverTopLayer as Ie, useTopLayerRef as Me } from "../../../hooks/useTopLayer.hook.js";
4
+ import { StyledButton as ke } from "../../inputs/button/StyledButton.js";
5
+ import { useMobileMediaQuery as He } from "../../../hooks/useMediaQuery.hook.js";
6
+ import { OverlayBackOwnerContext as We, requestCloseTopOverlayBack as Be, useBackCloses as De } from "../../../hooks/useBackCloses.hook.js";
7
+ import { useDebouncedValue as qe } from "../../../hooks/useDebouncedValue.hook.js";
8
+ import { useFocusTrap as Xe } from "../../../hooks/useFocusTrap.hook.js";
9
+ import { SHEET_TEXT as $e } from "../bottom-sheet/sheetCopy.js";
10
+ import { formatResultsLabel as Ne } from "../bottom-sheet/formatResultsLabel.js";
11
+ import { StyledBottomSheet as je } from "../bottom-sheet/StyledBottomSheet.js";
12
+ import { PopoverAnatomy as Ke } from "./PopoverAnatomy.js";
13
+ import { useCallback as d, useEffect as v, useId as Ue, useRef as f, useState as l } from "react";
14
+ import { Fragment as re, jsx as m, jsxs as ie } from "react/jsx-runtime";
15
+ import { FloatingPortal as Ye, autoUpdate as ze, flip as Ve, offset as Ge, shift as Qe, size as Je, useDismiss as Ze, useFloating as et, useInteractions as tt, useMergeRefs as ot } from "@floating-ui/react";
16
+ var C = 240, nt = {
16
17
  info: 472,
17
18
  action: 472
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({
19
+ }, se = 0.6, ae = "calc(100vw - 32px)", Pt = ({ dataTest: p, renderTrigger: _, variant: I = "info", title: E, children: M, viewResultsAction: k, resetAction: H, footerActions: W, resultCount: x, locale: R = "en", closeLabel: B = $e[R].close, ariaLabel: D, onOpenChange: q, className: X, align: $ = "auto", ignoreOutside: N }) => {
20
+ const g = Ue(), j = `${g}-title`, [o, ce] = l(!1), [K, le] = l(), [ue, U] = l(), [de, fe] = l("start"), [T, Y] = l(), [me, z] = l(C), u = He(), n = I === "action", pe = u && !n, w = u && n, y = d((e) => {
21
+ ce(e), q?.(e);
22
+ }, [q]), { refs: b, floatingStyles: ge, context: he, placement: V, isPositioned: ve } = et({
22
23
  open: o,
23
- onOpenChange: P,
24
- placement: `${R ?? "bottom"}-${ue}`,
24
+ onOpenChange: y,
25
+ placement: `${T ?? "bottom"}-${de}`,
25
26
  strategy: "fixed",
26
- whileElementsMounted: Ue,
27
+ whileElementsMounted: ze,
27
28
  middleware: [
28
- ze(8),
29
- ...me || R ? [] : [Ye({
29
+ Ge(8),
30
+ ...pe || T ? [] : [Ve({
30
31
  padding: 8,
31
32
  crossAxis: !1,
32
33
  flipAlignment: !1
33
34
  })],
34
- Ve({ padding: 8 }),
35
- Ge({
35
+ Qe({ padding: 8 }),
36
+ Je({
36
37
  padding: 8,
37
38
  apply({ availableHeight: e, rects: t }) {
38
- K(Math.min(e, Math.round(window.innerHeight * ie))), u || Y((a) => Math.max(a, t.floating.width));
39
+ U(Math.min(e, Math.round(window.innerHeight * se))), u || z((a) => Math.max(a, t.floating.width));
39
40
  }
40
41
  })
41
42
  ]
42
43
  });
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) => {
44
+ o && ve && !T && Y(V.startsWith("top") ? "top" : "bottom");
45
+ const F = Ie(K), c = f(null), [r, Ee] = l(null), we = d((e) => {
46
+ c.current = e, Ee(e);
47
+ }, []), ye = ot([Me(b.setFloating, F), we]), A = f(null), Pe = d((e) => {
47
48
  A.current = e, b.setReference(e);
48
- }, [b]), V = f(null), L = N?.length ? N.join(",") : void 0, G = f(L);
49
+ }, [b]), G = f(null), O = N?.length ? N.join(",") : void 0, Q = f(O);
49
50
  v(() => {
50
- G.current = L;
51
- }, [L]);
51
+ Q.current = O;
52
+ }, [O]);
52
53
  const h = d((e) => {
53
54
  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;
55
+ if (c.current?.contains(e) || A.current?.contains(e) || G.current === e) return !0;
56
+ const t = Q.current;
56
57
  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,
58
+ }, []), J = f(null), xe = d((e) => {
59
+ G.current = e.target, e.target instanceof HTMLElement && c.current?.contains(e.target) && (J.current = e.target);
60
+ }, []), { getFloatingProps: Re } = tt([Ze(he, {
61
+ enabled: !w,
61
62
  escapeKey: !1,
62
63
  outsidePress: (e) => {
63
64
  const t = e.target;
@@ -67,24 +68,24 @@ var C = 240, tt = {
67
68
  return !a || a.contains(c.current);
68
69
  }
69
70
  })]), s = d(() => {
70
- P(!1);
71
- }, [P]);
72
- Be({
71
+ y(!1);
72
+ }, [y]);
73
+ De({
73
74
  active: o,
74
75
  requestClose: s,
75
76
  ownerRef: c
76
77
  }), v(() => {
77
- if (!o || y) return;
78
+ if (!o || w) return;
78
79
  const e = (t) => {
79
- t.key !== "Escape" || t.defaultPrevented || t.isComposing || (t.preventDefault(), t.stopImmediatePropagation(), We(t));
80
+ t.key !== "Escape" || t.defaultPrevented || t.isComposing || (t.preventDefault(), t.stopImmediatePropagation(), Be(t));
80
81
  };
81
82
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
82
- }, [o, y]), qe(o && n && r !== null, c);
83
- const [J, Re] = l(!1);
83
+ }, [o, w]), Xe(o && n && r !== null, c);
84
+ const [Z, Te] = l(!1);
84
85
  v(() => {
85
- if (!r || n && !J) return;
86
+ if (!r || n && !Z) return;
86
87
  const e = requestAnimationFrame(() => {
87
- (n ? oe(r) : r)?.focus({ preventScroll: !0 });
88
+ (n ? ne(r) : r)?.focus({ preventScroll: !0 });
88
89
  });
89
90
  return () => {
90
91
  cancelAnimationFrame(e);
@@ -92,7 +93,7 @@ var C = 240, tt = {
92
93
  }, [
93
94
  r,
94
95
  n,
95
- J
96
+ Z
96
97
  ]), v(() => {
97
98
  if (!r) return;
98
99
  let e = 0;
@@ -100,18 +101,18 @@ var C = 240, tt = {
100
101
  cancelAnimationFrame(e), e = requestAnimationFrame(() => {
101
102
  const i = document.activeElement;
102
103
  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 });
104
+ const S = J.current;
105
+ (S?.isConnected && r.contains(S) ? S : ne(r) ?? r).focus({ preventScroll: !0 });
105
106
  });
106
107
  }, a = (i) => {
107
108
  i.relatedTarget === null && s();
108
- }, ee = (i) => {
109
- i.relatedTarget === null && h(i.target) && t();
110
109
  }, te = (i) => {
110
+ i.relatedTarget === null && h(i.target) && t();
111
+ }, oe = (i) => {
111
112
  !r.isConnected || h(i.target) || (n ? t() : s());
112
113
  };
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);
114
+ return n ? document.addEventListener("focusout", te) : r.addEventListener("focusout", a), document.addEventListener("focusin", oe), () => {
115
+ cancelAnimationFrame(e), document.removeEventListener("focusout", te), r.removeEventListener("focusout", a), document.removeEventListener("focusin", oe);
115
116
  };
116
117
  }, [
117
118
  r,
@@ -119,14 +120,14 @@ var C = 240, tt = {
119
120
  s,
120
121
  h
121
122
  ]);
122
- const O = f(!1);
123
+ const L = f(!1);
123
124
  v(() => {
124
125
  if (o) {
125
- O.current = !0;
126
+ L.current = !0;
126
127
  return;
127
128
  }
128
- if (!O.current) return;
129
- O.current = !1;
129
+ if (!L.current) return;
130
+ L.current = !1;
130
131
  const e = A.current;
131
132
  if (!e) return;
132
133
  const t = requestAnimationFrame(() => {
@@ -136,7 +137,7 @@ var C = 240, tt = {
136
137
  cancelAnimationFrame(t);
137
138
  };
138
139
  }, [o]);
139
- const Z = {
140
+ const ee = {
140
141
  ref: Pe,
141
142
  isOpen: o,
142
143
  triggerProps: {
@@ -145,79 +146,80 @@ var C = 240, tt = {
145
146
  s();
146
147
  return;
147
148
  }
148
- ce(Se(e.currentTarget));
149
+ le(_e(e.currentTarget));
149
150
  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);
151
+ fe($ === "auto" ? a ? "end" : "start" : $), Y(void 0), z(C), U(Math.round(window.innerHeight * se)), Te(e.detail === 0), y(!0);
151
152
  },
152
153
  "aria-expanded": o,
153
154
  "aria-controls": o ? g : void 0,
154
155
  "aria-haspopup": n ? "dialog" : void 0,
155
156
  "aria-describedby": !n && o ? g : void 0
156
157
  }
157
- }, x = (e) => typeof e == "function" ? e({ close: s }) : e, be = De(E, 500), Fe = _ ?? (E === void 0 ? void 0 : /* @__PURE__ */ m(_e, {
158
+ }, P = (e) => typeof e == "function" ? e({ close: s }) : e, be = qe(x, 500), Fe = k ?? (x === void 0 ? void 0 : /* @__PURE__ */ m(ke, {
158
159
  dataTest: `${p}-view-results`,
159
160
  type: "button",
160
161
  variant: "text",
161
162
  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, {
163
+ children: Ne(be, R)
164
+ })), Ae = u ? ae : nt[I], Oe = u ? ae : void 0;
165
+ return w ? /* @__PURE__ */ ie(re, { children: [_(ee), /* @__PURE__ */ m(je, {
165
166
  id: g,
166
167
  dataTest: p,
167
168
  open: o,
168
169
  onClose: s,
169
170
  registerBackClose: !1,
170
171
  ownerRef: c,
171
- title: w,
172
- ariaLabel: B,
173
- viewResultsAction: _,
174
- resetAction: k,
175
- footerActions: H,
176
- resultCount: E,
177
- closeLabel: W,
178
- className: q,
172
+ title: E,
173
+ ariaLabel: D,
174
+ viewResultsAction: k,
175
+ resetAction: H,
176
+ footerActions: W,
177
+ resultCount: x,
178
+ locale: R,
179
+ closeLabel: B,
180
+ className: X,
179
181
  children: M
180
- })] }) : /* @__PURE__ */ re(ne, { children: [S(Z), o && /* @__PURE__ */ m(Ke, {
181
- root: j,
182
+ })] }) : /* @__PURE__ */ ie(re, { children: [_(ee), o && /* @__PURE__ */ m(Ye, {
183
+ root: K,
182
184
  children: /* @__PURE__ */ m("div", {
183
- ...Ee(),
185
+ ...Re(),
184
186
  onFocusCapture: xe,
185
187
  ref: ye,
186
188
  id: g,
187
- "data-placement": z,
189
+ "data-placement": V,
188
190
  "data-test": p,
189
191
  "data-testid": p,
190
192
  role: n ? "dialog" : void 0,
191
- "aria-labelledby": n && w ? X : void 0,
192
- "aria-label": n && !w ? B : void 0,
193
+ "aria-labelledby": n && E ? j : void 0,
194
+ "aria-label": n && !E ? D : void 0,
193
195
  tabIndex: n ? void 0 : -1,
194
- ...F ? Te : {},
196
+ ...F ? Se : {},
195
197
  style: {
196
198
  ...F ? Ce : {},
197
- ...pe,
198
- minWidth: u ? C : fe,
199
- width: Le,
199
+ ...ge,
200
+ minWidth: u ? C : me,
201
+ width: Oe,
200
202
  maxWidth: Ae,
201
- maxHeight: le
203
+ maxHeight: ue
202
204
  },
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, {
205
+ className: Le("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]", X),
206
+ children: /* @__PURE__ */ m(We.Provider, {
205
207
  value: c,
206
- children: /* @__PURE__ */ m(Xe, {
208
+ children: /* @__PURE__ */ m(Ke, {
207
209
  dataTest: p,
208
- title: w,
209
- titleId: X,
210
- viewResultsAction: x(Fe),
211
- resetAction: x(k),
212
- footerActions: x(H),
213
- closeLabel: W,
210
+ title: E,
211
+ titleId: j,
212
+ viewResultsAction: P(Fe),
213
+ resetAction: P(H),
214
+ footerActions: P(W),
215
+ closeLabel: B,
214
216
  onClose: s,
215
- children: x(M)
217
+ children: P(M)
216
218
  })
217
219
  })
218
220
  })
219
221
  })] });
220
222
  };
221
223
  export {
222
- wt as PopoverSheet
224
+ Pt as PopoverSheet
223
225
  };
@@ -1,4 +1,5 @@
1
1
  import { ReactNode, RefObject } from 'react';
2
+ import { UiCoreLocale } from '../../../helpers/uiCoreLocale';
2
3
  import { PopoverSlot } from '../popover/PopoverSheet';
3
4
  export type BottomSheetCloseReason = 'closeButton' | 'scrim' | 'escape' | 'drag' | 'viewResults' | 'action';
4
5
  /** @figmaNode 9Q7C7JYPgnUSsrX1L8v40t#5354-169163 (Ad-Voca-concept · "_bottom sheet") */
@@ -37,8 +38,10 @@ export interface StyledBottomSheetProps {
37
38
  * @figmaProp none — behavioral
38
39
  */
39
40
  resultCount?: number | null;
40
- /** @figmaProp none — a11y: accessible name of the close control */
41
+ /** @figmaProp none — a11y: accessible name of the close control; defaults to "Close" in `locale` */
41
42
  closeLabel?: string;
43
+ /** Language of the default result and close labels; defaults to English. */
44
+ locale?: UiCoreLocale;
42
45
  /** @figmaProp none — style escape hatch, applied to the sheet container */
43
46
  className?: string;
44
47
  /** Set `false` when a wrapper already owns the Back-close registration. */
@@ -60,4 +63,4 @@ export interface StyledBottomSheetProps {
60
63
  * Focus moves to the sheet on open (so the title is announced first) and back to the trigger on
61
64
  * close. `PopoverSheet` with `variant='action'` renders this automatically below 744px.
62
65
  */
63
- export declare const StyledBottomSheet: ({ dataTest, id, open, onClose, title, ariaLabel, children, viewResultsAction, resetAction, footerActions, resultCount, closeLabel, className, registerBackClose, ownerRef, }: StyledBottomSheetProps) => JSX.Element | null;
66
+ export declare const StyledBottomSheet: ({ dataTest, id, open, onClose, title, ariaLabel, children, viewResultsAction, resetAction, footerActions, resultCount, locale, closeLabel, className, registerBackClose, ownerRef, }: StyledBottomSheetProps) => JSX.Element | null;
@@ -1,3 +1,4 @@
1
+ import { UiCoreLocale } from '../../../helpers/uiCoreLocale';
1
2
  /**
2
3
  * The label of the "Vis resultater (N)" dismiss control — one system-wide pattern, not per-screen copy.
3
4
  *
@@ -5,5 +6,7 @@
5
6
  * - `0` → `Ingen treff` (stays enabled — it is the way out of the sheet)
6
7
  * - above 9999 → `Vis resultater (9999+)`, so the label keeps a fixed shape and never wraps
7
8
  * - otherwise → `Vis resultater (N)`, parenthesised even for 1 to sidestep resultat/resultater
9
+ *
10
+ * English (`locale='en'`) reads `Show results (N)` and `No matches`.
8
11
  */
9
- export declare const formatResultsLabel: (count: number | null | undefined) => string;
12
+ export declare const formatResultsLabel: (count: number | null | undefined, locale?: UiCoreLocale) => string;
@@ -0,0 +1,11 @@
1
+ import { UiCoreLocale } from '../../../helpers/uiCoreLocale';
2
+ /**
3
+ * Default strings of `PopoverSheet` and `StyledBottomSheet`. English is the meaning column of the spec's copy table.
4
+ *
5
+ * @see asma-modules/_docs/ux/specs/spec-design-system-bottom-sheet.md:116 — Copy and label guidelines
6
+ */
7
+ export declare const SHEET_TEXT: Record<UiCoreLocale, {
8
+ close: string;
9
+ showResults: string;
10
+ noMatches: string;
11
+ }>;
@@ -1,4 +1,5 @@
1
1
  import { MouseEvent, ReactNode } from 'react';
2
+ import { UiCoreLocale } from '../../../helpers/uiCoreLocale';
2
3
  /** Spread on the trigger element. The ref is handed over separately — `StyledButton` takes `refLink`. */
3
4
  export interface PopoverTriggerProps {
4
5
  onClick: (event: MouseEvent<HTMLElement>) => void;
@@ -52,8 +53,10 @@ export interface PopoverSheetProps {
52
53
  * @figmaProp none — behavioral
53
54
  */
54
55
  resultCount?: number | null;
55
- /** @figmaProp none — a11y: accessible name of the close control */
56
+ /** @figmaProp none — a11y: accessible name of the close control; defaults to "Close" in `locale` */
56
57
  closeLabel?: string;
58
+ /** Language of the default result and close labels; defaults to English. */
59
+ locale?: UiCoreLocale;
57
60
  /** @figmaProp none — a11y: required when `variant='action'` and no `title` is given, so the dialog has a name */
58
61
  ariaLabel?: string;
59
62
  /** @figmaProp none — behavioral */
@@ -95,4 +98,4 @@ export interface PopoverSheetProps {
95
98
  * Separate from {@link StyledPopover}, which stays as the MUI-parity positioning primitive its eight
96
99
  * internal consumers still depend on; those migrate here gradually.
97
100
  */
98
- export declare const PopoverSheet: ({ dataTest, renderTrigger, variant, title, children, viewResultsAction, resetAction, footerActions, resultCount, closeLabel, ariaLabel, onOpenChange, className, align, ignoreOutside, }: PopoverSheetProps) => JSX.Element;
101
+ export declare const PopoverSheet: ({ dataTest, renderTrigger, variant, title, children, viewResultsAction, resetAction, footerActions, resultCount, locale, closeLabel, ariaLabel, onOpenChange, className, align, ignoreOutside, }: PopoverSheetProps) => JSX.Element;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.128.0",
6
+ "version": "3.128.1",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",