asma-ui-core 3.104.0 → 3.106.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.
Files changed (70) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/custom/module/header-layout/DynamicToolbar.js +99 -97
  3. package/dist/components/custom/module/header-layout/ToolbarActionGroup.js +62 -43
  4. package/dist/components/custom/module/header-layout/ToolbarRows.js +51 -47
  5. package/dist/components/custom/module/header-layout/useTranslations.js +12 -10
  6. package/dist/components/custom/page/page-header/PageHeader.js +41 -40
  7. package/dist/components/custom/widget/widget/StyledWidget.js +21 -20
  8. package/dist/components/data-display/chip/StyledChip.js +70 -52
  9. package/dist/components/data-display/tooltip/StyledTooltip.js +110 -65
  10. package/dist/components/feedback/dialog/DialogBusyContext.js +32 -0
  11. package/dist/components/feedback/dialog/StyledDialog.js +104 -80
  12. package/dist/components/feedback/dialog/dialog-footer/StyledDialogFooter.js +76 -71
  13. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +133 -137
  14. package/dist/components/feedback/minimizable-dialog/components/CloseBtn.js +11 -8
  15. package/dist/components/feedback/minimizable-dialog/components/FullscreenBtn.js +6 -6
  16. package/dist/components/feedback/minimizable-dialog/components/MinimizeBtn.js +1 -1
  17. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +94 -85
  18. package/dist/components/feedback/minimizable-dialog/v2/useTranslations.js +6 -4
  19. package/dist/components/inputs/button/StyledButton.js +83 -33
  20. package/dist/components/inputs/button/StyledButton.module.js +8 -8
  21. package/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +32 -32
  22. package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +91 -82
  23. package/dist/components/inputs/select/StyledSelect.js +8 -8
  24. package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +152 -152
  25. package/dist/components/navigation/link/StyledLink.js +53 -26
  26. package/dist/components/navigation/link/StyledLink.module.js +6 -6
  27. package/dist/components/navigation/menu/StyledMenuItem.js +35 -30
  28. package/dist/components/navigation/menu/StyledMenuList.js +47 -38
  29. package/dist/components/navigation/tabs/StyledTab.js +25 -18
  30. package/dist/components/navigation/tabs/StyledTabs.js +33 -33
  31. package/dist/components/utils/bottom-sheet/StyledBottomSheet.js +6 -6
  32. package/dist/components/utils/copy-wrapper/CopyButton.js +4 -4
  33. package/dist/components/utils/copy-wrapper/CopyWrapper.js +4 -4
  34. package/dist/datetime/shared-components/button/StyledButton.module.js +11 -11
  35. package/dist/helpers/focusable.js +4 -3
  36. package/dist/helpers/warnUnnamedDialog.js +6 -0
  37. package/dist/index.js +589 -585
  38. package/dist/src/components/custom/module/header-layout/ToolbarActionGroup.d.ts +13 -2
  39. package/dist/src/components/custom/module/header-layout/ToolbarRows.d.ts +2 -1
  40. package/dist/src/components/custom/module/header-layout/planToolbarActions.d.ts +18 -1
  41. package/dist/src/components/custom/module/header-layout/useTranslations.d.ts +2 -0
  42. package/dist/src/components/custom/widget/widget/StyledWidget.d.ts +5 -0
  43. package/dist/src/components/data-display/chip/StyledChip.d.ts +6 -0
  44. package/dist/src/components/data-display/interactive-chip/StyledInteractiveChip.d.ts +7 -1
  45. package/dist/src/components/data-display/tooltip/StyledTooltip.d.ts +16 -2
  46. package/dist/src/components/feedback/dialog/DialogBusy.test.d.ts +1 -0
  47. package/dist/src/components/feedback/dialog/DialogBusyContext.d.ts +28 -0
  48. package/dist/src/components/feedback/dialog/StyledDialog.d.ts +15 -2
  49. package/dist/src/components/feedback/dialog/dialog-footer/StyledDialogFooter.d.ts +10 -7
  50. package/dist/src/components/feedback/dialog/index.d.ts +1 -0
  51. package/dist/src/components/feedback/minimizable-dialog/components/CloseBtn.d.ts +2 -0
  52. package/dist/src/components/feedback/minimizable-dialog/types.d.ts +11 -0
  53. package/dist/src/components/feedback/minimizable-dialog/v2/types.d.ts +2 -0
  54. package/dist/src/components/feedback/minimizable-dialog/v2/useTranslations.d.ts +2 -0
  55. package/dist/src/components/inputs/button/StyledButton.d.ts +25 -1
  56. package/dist/src/components/inputs/button/StyledButtonBusy.test.d.ts +1 -0
  57. package/dist/src/components/navigation/link/StyledLink.d.ts +6 -0
  58. package/dist/src/components/navigation/menu/StyledMenuItem.d.ts +8 -1
  59. package/dist/src/components/navigation/menu/StyledMenuList.d.ts +2 -1
  60. package/dist/src/components/navigation/tabs/StyledTab.d.ts +17 -1
  61. package/dist/src/forms/submitChanged.d.ts +3 -0
  62. package/dist/src/helpers/focusable.d.ts +9 -0
  63. package/dist/src/helpers/index.d.ts +1 -0
  64. package/dist/src/helpers/uiCoreLocale.d.ts +1 -0
  65. package/dist/src/helpers/warnUnnamedDialog.d.ts +5 -0
  66. package/dist/src/table/shared-components/StyledMenuItem.d.ts +5 -1
  67. package/dist/table/components/columns/action-column/components/RowActionMenu.js +57 -50
  68. package/dist/table/shared-components/StyledMenuItem.js +28 -16
  69. package/dist/table/shared-components/button/StyledButton.module.js +11 -11
  70. package/package.json +1 -1
@@ -1,51 +1,56 @@
1
- import { cn as i } from "../../../helpers/cn.js";
2
- import { resolveSx as w } from "../../../helpers/sx.js";
3
- import { StyledCheckbox as D } from "../../inputs/checkbox/base-ui/StyledCheckbox.js";
4
- import { StyledTooltip as g } from "../../data-display/tooltip/StyledTooltip.js";
5
- import { Children as k, isValidElement as A } from "react";
1
+ import { cn as s } from "../../../helpers/cn.js";
2
+ import { resolveSx as A } from "../../../helpers/sx.js";
3
+ import { StyledTooltip as E } from "../../data-display/tooltip/StyledTooltip.js";
4
+ import { StyledCheckbox as _ } from "../../inputs/checkbox/base-ui/StyledCheckbox.js";
5
+ import { Children as C, isValidElement as S } from "react";
6
6
  import { jsx as u } from "react/jsx-runtime";
7
- var p = {
7
+ var c = {
8
8
  en: "Already added",
9
9
  no: "Allerede lagt til"
10
- }, E = () => (typeof document > "u" ? "" : document.documentElement.lang).toLowerCase().startsWith("en") ? p.en : p.no, c = (r) => {
10
+ }, L = () => (typeof document > "u" ? "" : document.documentElement.lang).toLowerCase().startsWith("en") ? c.en : c.no, f = (a) => {
11
11
  let t = !1;
12
- return k.forEach(r, (o) => {
13
- if (t || !A(o)) return;
14
- if (o.type === D) {
12
+ return C.forEach(a, (o) => {
13
+ if (t || !S(o)) return;
14
+ if (o.type === _) {
15
15
  const e = o.props;
16
16
  t = e.checked === !0 && e.disabled === !0;
17
17
  return;
18
18
  }
19
- const a = o.props.children;
20
- a !== void 0 && c(a) && (t = !0);
19
+ const n = o.props.children;
20
+ n !== void 0 && f(n) && (t = !0);
21
21
  }), t;
22
- }, j = ({ children: r, onClick: t, onMouseDown: o, onMouseUp: a, disabled: e, selected: l, dense: f, tooltip: y, className: v, classes: d, sx: x, "data-test": h, "data-testid": b, value: _ }) => {
23
- const s = /* @__PURE__ */ u("li", {
22
+ }, H = ({ children: a, onClick: t, onMouseDown: o, onMouseUp: n, disabled: e, disabledReason: l, "aria-busy": v, selected: d, dense: y, tooltip: x, className: h, classes: p, sx: b, "data-test": D, "data-testid": w, value: M }) => {
23
+ const g = (i) => {
24
+ e || (i.key === "Enter" || i.key === " ") && (i.preventDefault(), t?.(i));
25
+ }, r = !!e && !!l, k = /* @__PURE__ */ u("li", {
24
26
  role: "menuitem",
25
27
  "aria-disabled": e ? !0 : void 0,
28
+ "aria-busy": v ? !0 : void 0,
29
+ "data-has-reason": r ? "" : void 0,
26
30
  tabIndex: -1,
27
- "data-test": h,
28
- "data-testid": b,
31
+ "data-test": D,
32
+ "data-testid": w,
29
33
  onClick: e ? void 0 : t,
30
34
  onMouseDown: e ? void 0 : o,
31
- onMouseUp: e ? void 0 : a,
32
- onKeyDown: (n) => {
33
- e || (n.key === "Enter" || n.key === " ") && (n.preventDefault(), t?.(n));
34
- },
35
- className: i("box-border flex items-center px-4 text-base outline-none focus-visible:shadow-[inset_3px_0_var(--colors-focus-ring)]", f ? "min-h-8 py-1" : "min-h-10 py-2", "asma-pressable asma-touch-target", e ? "cursor-not-allowed text-delta-300 aria-disabled:text-delta-300" : i("cursor-pointer text-delta-700", !l && "hover:bg-delta-50"), l && i("bg-gama-50", d?.selected), d?.root, v),
35
+ onMouseUp: e ? void 0 : n,
36
+ onKeyDown: g,
37
+ className: s("box-border flex items-center px-4 text-base outline-none focus-visible:shadow-[inset_3px_0_var(--colors-focus-ring)]", y ? "min-h-8 py-1" : "min-h-10 py-2", "asma-pressable asma-touch-target", e ? "cursor-not-allowed text-delta-300 aria-disabled:text-delta-300" : s("cursor-pointer text-delta-700", !d && "hover:bg-delta-50"), d && s("bg-gama-50", p?.selected), p?.root, h),
36
38
  style: {
37
39
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
38
- ...w(x)
40
+ ...A(b)
39
41
  },
40
- children: r
41
- }), m = y ?? (c(r) ? E() : void 0);
42
- return m ? /* @__PURE__ */ u(g, {
42
+ children: a
43
+ }), m = r ? l : x ?? (f(a) ? L() : void 0);
44
+ return /* @__PURE__ */ u(E, {
43
45
  title: m,
44
- arrow: !0,
45
- placement: "top",
46
- children: s
47
- }) : s;
46
+ open: m ? void 0 : !1,
47
+ arrow: !r,
48
+ placement: r ? "left" : "top",
49
+ openOnTap: r,
50
+ persistentDescription: r,
51
+ children: k
52
+ });
48
53
  };
49
54
  export {
50
- j as StyledMenuItem
55
+ H as StyledMenuItem
51
56
  };
@@ -1,65 +1,74 @@
1
- import { cn as S } from "../../../helpers/cn.js";
2
- import { consumerOverrides as R } from "../../../helpers/classOverride.js";
3
- import y from "./StyledMenu.module.js";
4
- import { useEffect as I, useLayoutEffect as k, useRef as q } from "react";
5
- import { jsx as p } from "react/jsx-runtime";
6
- var b = '[role="menu"], [role="listbox"]', c = '[role="menuitem"]', A = (l) => Array.from(l.childNodes).flatMap((r) => r instanceof HTMLElement ? r.hidden ? [] : r.matches(b) ? [null] : r.matches(c) ? [r] : r.querySelector(c) ? A(r) : [null] : r.textContent?.trim() ? [null] : []), g = (l) => l ? Array.from(l.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')) : [], O = ({ children: l, id: r, role: x = "menu", className: m, autoFocus: f, disablePadding: E, onClick: w, onKeyDown: v }) => {
7
- const i = q(null), d = R(m, "padding");
1
+ import { cn as R } from "../../../helpers/cn.js";
2
+ import { consumerOverrides as T } from "../../../helpers/classOverride.js";
3
+ import p from "./StyledMenu.module.js";
4
+ import { useEffect as M, useLayoutEffect as k, useRef as q } from "react";
5
+ import { jsx as A } from "react/jsx-runtime";
6
+ var d = '[role="menu"], [role="listbox"]', y = '[role="menuitem"]', E = (r) => Array.from(r.childNodes).flatMap((t) => t instanceof HTMLElement ? t.hidden ? [] : t.matches(d) ? [null] : t.matches(y) ? [t] : t.querySelector(y) ? E(t) : [null] : t.textContent?.trim() ? [null] : []), h = (r) => r ? Array.from(r.querySelectorAll('[role="menuitem"]')) : [], v = (r) => h(r).filter((t) => t.getAttribute("aria-disabled") !== "true"), x = (r, t) => {
7
+ const u = h(r).filter((o) => o.closest(d) === r), m = (t && u.includes(t) ? t : void 0) ?? u.find((o) => o.tabIndex === 0) ?? v(r).find((o) => o.closest(d) === r) ?? u[0];
8
+ u.forEach((o) => {
9
+ o.tabIndex = o === m ? 0 : -1;
10
+ });
11
+ }, _ = ({ children: r, id: t, role: u = "menu", className: m, autoFocus: o, disablePadding: w, onClick: I, onKeyDown: L }) => {
12
+ const i = q(null), b = T(m, "padding");
8
13
  k(() => {
9
14
  const e = i.current;
10
15
  if (!e) return;
11
- const t = () => {
12
- const s = A(e);
13
- if (Array.from(e.querySelectorAll(c)).filter((n) => n.closest(b) === e).forEach((n) => n.removeAttribute("data-menu-separator")), s.forEach((n, a) => n?.toggleAttribute("data-menu-separator", !!s[a + 1])), e.classList.contains(y.anchoredList)) {
14
- const n = (s.every(Boolean) ? s[7] : null)?.getBoundingClientRect(), a = n && n.height > 0 ? n.top - e.getBoundingClientRect().top + e.scrollTop + n.height / 2 : null;
15
- e.style.maxHeight = a === null ? "" : `${a}px`, e.toggleAttribute("data-menu-scroll", a !== null);
16
+ const n = () => {
17
+ const a = E(e);
18
+ if (Array.from(e.querySelectorAll(y)).filter((l) => l.closest(d) === e).forEach((l) => l.removeAttribute("data-menu-separator")), a.forEach((l, f) => l?.toggleAttribute("data-menu-separator", !!a[f + 1])), e.classList.contains(p.anchoredList)) {
19
+ const l = (a.every(Boolean) ? a[7] : null)?.getBoundingClientRect(), f = l && l.height > 0 ? l.top - e.getBoundingClientRect().top + e.scrollTop + l.height / 2 : null;
20
+ e.style.maxHeight = f === null ? "" : `${f}px`, e.toggleAttribute("data-menu-scroll", f !== null);
16
21
  }
22
+ x(e);
17
23
  };
18
- t();
19
- const u = requestAnimationFrame(t), o = new MutationObserver(t);
20
- return o.observe(e, {
24
+ n();
25
+ const c = requestAnimationFrame(n), s = new MutationObserver(n);
26
+ return s.observe(e, {
21
27
  childList: !0,
22
28
  subtree: !0,
23
29
  attributes: !0,
24
30
  attributeFilter: ["hidden"]
25
31
  }), () => {
26
- cancelAnimationFrame(u), o.disconnect();
32
+ cancelAnimationFrame(c), s.disconnect();
27
33
  };
28
- }, []), I(() => {
29
- f && g(i.current)[0]?.focus();
30
- }, [f]);
31
- const L = (e) => {
32
- if (v?.(e), ![
34
+ }, []), M(() => {
35
+ o && (v(i.current)[0] ?? h(i.current)[0])?.focus();
36
+ }, [o]);
37
+ const S = (e) => {
38
+ if (L?.(e), ![
33
39
  "ArrowDown",
34
40
  "ArrowUp",
35
41
  "Home",
36
42
  "End"
37
43
  ].includes(e.key)) return;
38
44
  e.preventDefault();
39
- const t = g(i.current);
40
- if (t.length === 0) return;
41
- const u = t.findIndex((s) => s === document.activeElement);
42
- let o = u;
43
- e.key === "ArrowDown" ? o = (u + 1) % t.length : e.key === "ArrowUp" ? o = (u - 1 + t.length) % t.length : e.key === "Home" ? o = 0 : e.key === "End" && (o = t.length - 1), t[o]?.focus(), i.current?.hasAttribute("data-menu-scroll") && t[o]?.scrollIntoView({ block: "nearest" });
44
- }, h = {
45
- id: r,
46
- className: S(y.list, "m-0 list-none outline-none", !d && "px-0", !d && (E ? "py-0" : "py-2"), m),
45
+ const n = h(i.current);
46
+ if (n.length === 0) return;
47
+ const c = n.findIndex((a) => a === document.activeElement);
48
+ let s = c;
49
+ e.key === "ArrowDown" ? s = (c + 1) % n.length : e.key === "ArrowUp" ? s = (c - 1 + n.length) % n.length : e.key === "Home" ? s = 0 : e.key === "End" && (s = n.length - 1), n[s]?.focus(), i.current?.hasAttribute("data-menu-scroll") && n[s]?.scrollIntoView({ block: "nearest" });
50
+ }, g = {
51
+ id: t,
52
+ className: R(p.list, "m-0 list-none outline-none", !b && "px-0", !b && (w ? "py-0" : "py-2"), m),
47
53
  style: { fontFamily: "Roboto, Helvetica, Arial, sans-serif" },
48
- onClick: w,
49
- onKeyDown: L
54
+ onClick: I,
55
+ onKeyDown: S,
56
+ onFocus: (e) => {
57
+ i.current && e.target instanceof HTMLElement && x(i.current, e.target);
58
+ }
50
59
  };
51
- return x === "listbox" ? /* @__PURE__ */ p("ul", {
60
+ return u === "listbox" ? /* @__PURE__ */ A("ul", {
52
61
  ref: i,
53
- ...h,
62
+ ...g,
54
63
  role: "listbox",
55
- children: l
56
- }) : /* @__PURE__ */ p("ul", {
64
+ children: r
65
+ }) : /* @__PURE__ */ A("ul", {
57
66
  ref: i,
58
- ...h,
67
+ ...g,
59
68
  role: "menu",
60
- children: l
69
+ children: r
61
70
  });
62
71
  };
63
72
  export {
64
- O as StyledMenuList
73
+ _ as StyledMenuList
65
74
  };
@@ -1,30 +1,37 @@
1
- import { cn as f } from "../../../helpers/cn.js";
2
- import { resolveSx as x } from "../../../helpers/sx.js";
3
- import { useTabsContext as u } from "./TabsContext.js";
4
- import { useCallback as h } from "react";
5
- import { jsx as d } from "react/jsx-runtime";
6
- var k = ({ value: a, label: i, disabled: e, className: s, sx: l, index: m }) => {
7
- const t = u(), o = a !== void 0 ? a : m, r = t ? t.value === o : !1, c = /\btext-(?:xs|sm|base|lg|xl|\[)/.test(s ?? ""), p = /\bfont-(?:thin|extralight|light|normal|medium|semibold|bold|extrabold|black)\b/.test(s ?? ""), b = /\b(?:uppercase|lowercase|capitalize|normal-case)\b/.test(s ?? "");
8
- return /* @__PURE__ */ d("button", {
9
- ref: h((n) => {
10
- t?.register(o, n);
11
- }, [t, o]),
1
+ import { cn as y } from "../../../helpers/cn.js";
2
+ import { resolveSx as _ } from "../../../helpers/sx.js";
3
+ import { StyledTooltip as w } from "../../data-display/tooltip/StyledTooltip.js";
4
+ import { useTabsContext as T } from "./TabsContext.js";
5
+ import { useCallback as S } from "react";
6
+ import { jsx as c } from "react/jsx-runtime";
7
+ var A = ({ value: i, label: m, disabled: t, disabledReason: l, tooltip: p, className: n, sx: f, index: x }) => {
8
+ const e = T(), o = i !== void 0 ? i : x, r = e ? e.value === o : !1, b = /\btext-(?:xs|sm|base|lg|xl|\[)/.test(n ?? ""), u = /\bfont-(?:thin|extralight|light|normal|medium|semibold|bold|extrabold|black)\b/.test(n ?? ""), h = /\b(?:uppercase|lowercase|capitalize|normal-case)\b/.test(n ?? ""), d = S((a) => {
9
+ e?.register(o, a);
10
+ }, [e, o]), s = t && l ? l : p, v = !!t && !!s, g = /* @__PURE__ */ c("button", {
11
+ ref: d,
12
12
  type: "button",
13
13
  role: "tab",
14
14
  "aria-selected": r,
15
- "aria-disabled": e ? !0 : void 0,
16
- disabled: e,
15
+ "aria-disabled": t ? !0 : void 0,
17
16
  tabIndex: r ? 0 : -1,
18
17
  "data-tab-value": typeof o == "string" || typeof o == "number" ? String(o) : void 0,
19
- onClick: (n) => !e && t?.onSelect(n, o),
20
- className: f("inline-flex min-h-12 min-w-[90px] shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-t-lg border-0 bg-transparent px-4 py-3 tracking-normal outline-none transition-colors", !c && (t?.size === "small" ? "text-base" : "text-lg"), !p && (t?.size === "small" || r || e ? "font-semibold" : "font-medium hover:font-semibold focus-visible:font-semibold"), !b && "normal-case", t?.size === "small" && "min-h-10 px-3 py-2", "asma-pressable", e ? "text-delta-300" : r ? "text-gama-500" : "text-delta-600", !e && "cursor-pointer", "focus-visible:shadow-[inset_0_0_0_3px_var(--colors-focus-ring)]", !e && !r && "hover:shadow-[inset_0_-3px_0_0_var(--colors-delta-300)]", s),
18
+ onClick: (a) => !t && e?.onSelect(a, o),
19
+ className: y("inline-flex min-h-12 min-w-[90px] shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-t-lg border-0 bg-transparent px-4 py-3 tracking-normal outline-none transition-colors", !b && (e?.size === "small" ? "text-base" : "text-lg"), !u && (e?.size === "small" || r || t ? "font-semibold" : "font-medium hover:font-semibold focus-visible:font-semibold"), !h && "normal-case", e?.size === "small" && "min-h-10 px-3 py-2", "asma-pressable", t ? "text-delta-300" : r ? "text-gama-500" : "text-delta-600", t ? "cursor-not-allowed" : "cursor-pointer", "focus-visible:shadow-[inset_0_0_0_3px_var(--colors-focus-ring)]", !t && !r && "hover:shadow-[inset_0_-3px_0_0_var(--colors-delta-300)]", n),
21
20
  style: {
22
21
  fontFamily: "Roboto, Helvetica, Arial, sans-serif",
23
- ...x(l)
22
+ ..._(f)
24
23
  },
25
- children: i
24
+ children: m
25
+ });
26
+ return /* @__PURE__ */ c(w, {
27
+ title: s,
28
+ open: s ? void 0 : !1,
29
+ arrow: !0,
30
+ openOnTap: v,
31
+ persistentDescription: !!s,
32
+ children: g
26
33
  });
27
34
  };
28
35
  export {
29
- k as StyledTab
36
+ A as StyledTab
30
37
  };
@@ -1,4 +1,4 @@
1
- import { cn as n } from "../../../helpers/cn.js";
1
+ import { cn as s } from "../../../helpers/cn.js";
2
2
  import { resolveSx as K } from "../../../helpers/sx.js";
3
3
  import { ChevronRightIcon as M } from "../../icons/chevron-right-icon/ChevronRightIcon.js";
4
4
  import { ChevronLeftIcon as V } from "../../icons/chevron-left-icon/ChevronLeftIcon.js";
@@ -6,39 +6,39 @@ import { consumerOverrides as q } from "../../../helpers/classOverride.js";
6
6
  import { TabsContext as z } from "./TabsContext.js";
7
7
  import { Children as F, cloneElement as G, isValidElement as J, useCallback as b, useLayoutEffect as Q, useMemo as U, useRef as E, useState as A } from "react";
8
8
  import { jsx as l, jsxs as B } from "react/jsx-runtime";
9
- var I = 120, le = ({ value: i, onChange: m, variant: g = "standard", scrollButtons: w = "auto", centered: j, size: h = "default", className: p, sx: N, children: x }) => {
10
- const a = E(null), c = E(/* @__PURE__ */ new Map()), [u, O] = A({
9
+ var I = 120, le = ({ value: n, onChange: m, variant: g = "standard", scrollButtons: w = "auto", centered: j, size: f = "default", className: p, sx: N, children: x }) => {
10
+ const i = E(null), a = E(/* @__PURE__ */ new Map()), [h, O] = A({
11
11
  left: 0,
12
12
  width: 0,
13
13
  disabled: !1
14
- }), [d, W] = A({
14
+ }), [c, W] = A({
15
15
  left: !1,
16
16
  right: !1
17
17
  }), y = g === "scrollable", v = b((e, t) => {
18
- t ? c.current.set(e, t) : c.current.delete(e);
19
- }, []), S = b((e, t) => m?.(e, t), [m]), f = b(() => {
20
- const e = c.current.get(i), t = a.current;
18
+ t ? a.current.set(e, t) : a.current.delete(e);
19
+ }, []), S = b((e, t) => m?.(e, t), [m]), d = b(() => {
20
+ const e = a.current.get(n), t = i.current;
21
21
  if (e && O({
22
22
  left: e.offsetLeft,
23
23
  width: e.offsetWidth,
24
24
  disabled: e.disabled || e.getAttribute("aria-disabled") === "true"
25
25
  }), t) {
26
- const { scrollLeft: o, scrollWidth: r, clientWidth: s } = t;
26
+ const { scrollLeft: o, scrollWidth: r, clientWidth: u } = t;
27
27
  W({
28
28
  left: o > 1,
29
- right: o + s < r - 1
29
+ right: o + u < r - 1
30
30
  });
31
31
  }
32
- }, [i]);
32
+ }, [n]);
33
33
  Q(() => {
34
- f();
35
- const e = a.current;
34
+ d();
35
+ const e = i.current;
36
36
  if (!e) return;
37
- const t = new ResizeObserver(f);
37
+ const t = new ResizeObserver(d);
38
38
  return t.observe(e), () => t.disconnect();
39
- }, [f, x]);
39
+ }, [d, x]);
40
40
  const k = (e) => {
41
- a.current?.scrollBy({
41
+ i.current?.scrollBy({
42
42
  left: e,
43
43
  behavior: "smooth"
44
44
  });
@@ -50,33 +50,33 @@ var I = 120, le = ({ value: i, onChange: m, variant: g = "standard", scrollButto
50
50
  "End"
51
51
  ].includes(e.key)) return;
52
52
  e.preventDefault();
53
- const t = Array.from(c.current.values()).filter((s) => !s.disabled);
53
+ const t = Array.from(a.current.values());
54
54
  if (t.length === 0) return;
55
- const o = t.findIndex((s) => s === document.activeElement);
55
+ const o = t.findIndex((u) => u === document.activeElement);
56
56
  let r = o;
57
57
  e.key === "ArrowRight" ? r = (o + 1) % t.length : e.key === "ArrowLeft" ? r = (o - 1 + t.length) % t.length : e.key === "Home" ? r = 0 : e.key === "End" && (r = t.length - 1), t[r]?.focus();
58
- }, L = y && w !== !1, R = w === !0, D = L && (R || d.left), P = L && (R || d.right), T = q(p, "padding-x"), H = U(() => ({
59
- value: i,
60
- size: h,
58
+ }, L = y && w !== !1, R = w === !0, D = L && (R || c.left), P = L && (R || c.right), T = q(p, "padding-x"), H = U(() => ({
59
+ value: n,
60
+ size: f,
61
61
  onSelect: S,
62
62
  register: v
63
63
  }), [
64
- i,
65
- h,
64
+ n,
65
+ f,
66
66
  S,
67
67
  v
68
68
  ]), C = "flex h-10 w-10 shrink-0 items-center justify-center self-center rounded-[10%] border border-solid border-delta-500 text-delta-700 transition-colors hover:bg-gama-50 disabled:invisible";
69
69
  return /* @__PURE__ */ l(z.Provider, {
70
70
  value: H,
71
71
  children: /* @__PURE__ */ B("div", {
72
- className: n("relative flex items-center rounded-t-lg bg-white", !T && "px-4", p),
72
+ className: s("relative flex items-center rounded-t-lg bg-white", !T && "px-4", p),
73
73
  style: K(N),
74
74
  children: [
75
75
  D && /* @__PURE__ */ l("button", {
76
76
  type: "button",
77
77
  "aria-label": "scroll tabs left",
78
- className: n(C, "mr-2"),
79
- disabled: !d.left,
78
+ className: s(C, "mr-2"),
79
+ disabled: !c.left,
80
80
  onClick: () => k(-I),
81
81
  children: /* @__PURE__ */ l(V, {
82
82
  width: 24,
@@ -84,26 +84,26 @@ var I = 120, le = ({ value: i, onChange: m, variant: g = "standard", scrollButto
84
84
  })
85
85
  }),
86
86
  /* @__PURE__ */ B("div", {
87
- ref: a,
87
+ ref: i,
88
88
  role: "tablist",
89
89
  "aria-orientation": "horizontal",
90
90
  onKeyDown: _,
91
- onScroll: f,
92
- className: n("relative flex bg-[linear-gradient(to_top,var(--colors-delta-200)_1px,transparent_1px)] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", y ? "flex-1 overflow-x-auto" : "w-full", g === "fullWidth" && "[&>*]:flex-1", j && "justify-center", h === "small" && "min-h-9"),
91
+ onScroll: d,
92
+ className: s("relative flex bg-[linear-gradient(to_top,var(--colors-delta-200)_1px,transparent_1px)] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", y ? "flex-1 overflow-x-auto" : "w-full", g === "fullWidth" && "[&>*]:flex-1", j && "justify-center", f === "small" && "min-h-9"),
93
93
  children: [F.map(x, (e, t) => J(e) ? G(e, { index: t }) : e), /* @__PURE__ */ l("span", {
94
94
  "aria-hidden": !0,
95
- className: n("absolute bottom-0 h-[3px] transition-all duration-300", u.disabled ? "bg-delta-300" : "bg-gama-500"),
95
+ className: s("absolute bottom-0 h-[3px] transition-all duration-300", h.disabled ? "bg-delta-300" : "bg-gama-500"),
96
96
  style: {
97
- left: u.left,
98
- width: u.width
97
+ left: h.left,
98
+ width: h.width
99
99
  }
100
100
  })]
101
101
  }),
102
102
  P && /* @__PURE__ */ l("button", {
103
103
  type: "button",
104
104
  "aria-label": "scroll tabs right",
105
- className: n(C, "ml-2"),
106
- disabled: !d.right,
105
+ className: s(C, "ml-2"),
106
+ disabled: !c.right,
107
107
  onClick: () => k(I),
108
108
  children: /* @__PURE__ */ l(M, {
109
109
  width: 24,
@@ -1,7 +1,7 @@
1
1
  import { cn as n } from "../../../helpers/cn.js";
2
- import { CloseIcon as A } from "../../icons/close-icon/CloseIcon.js";
3
- import { IndeterminateIcon as H } from "../../icons/indeterminate-icon/IndeterminateIcon.js";
4
- import { registerOpenModalDialog as q } from "../../../hooks/useTopLayer.hook.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
5
  import { StyledButton as I } from "../../inputs/button/StyledButton.js";
6
6
  import { useShortViewportMediaQuery as G } from "../../../hooks/useMediaQuery.hook.js";
7
7
  import { useDebouncedValue as P } from "../../../hooks/useDebouncedValue.hook.js";
@@ -26,7 +26,7 @@ var te = 500, xe = ({ dataTest: r, id: D, open: a, onClose: o, title: s, ariaLab
26
26
  v.current = document.activeElement instanceof HTMLElement ? document.activeElement : null, e.open || e.showModal(), e.focus({ preventScroll: !0 });
27
27
  const U = requestAnimationFrame(() => {
28
28
  y(!0);
29
- }), V = q(e);
29
+ }), V = A(e);
30
30
  return () => {
31
31
  cancelAnimationFrame(U), V(), y(!1), e.open && e.close();
32
32
  const E = v.current;
@@ -87,12 +87,12 @@ var te = 500, xe = ({ dataTest: r, id: D, open: a, onClose: o, title: s, ariaLab
87
87
  onClick: () => {
88
88
  o("closeButton");
89
89
  },
90
- startIcon: /* @__PURE__ */ t(A, {
90
+ startIcon: /* @__PURE__ */ t(H, {
91
91
  width: 24,
92
92
  height: 24
93
93
  })
94
94
  }),
95
- /* @__PURE__ */ t(H, {
95
+ /* @__PURE__ */ t(q, {
96
96
  "aria-hidden": "true",
97
97
  focusable: "false",
98
98
  width: 24,
@@ -1,12 +1,12 @@
1
- import { ContentCopyIcon as c } from "../../icons/content-copy-icon/ContentCopyIcon.js";
2
- import { StyledTooltip as d } from "../../data-display/tooltip/StyledTooltip.js";
1
+ import { StyledTooltip as c } from "../../data-display/tooltip/StyledTooltip.js";
2
+ import { ContentCopyIcon as d } from "../../icons/content-copy-icon/ContentCopyIcon.js";
3
3
  import { StyledButton as m } from "../../inputs/button/StyledButton.js";
4
4
  import { useMobileMediaQuery as h } from "../../../hooks/useMediaQuery.hook.js";
5
5
  import "react";
6
6
  import { jsx as t } from "react/jsx-runtime";
7
7
  var g = ({ className: n, contentToCopy: p, locale: r, messageInfo: a, text: e }) => {
8
8
  const i = r === "en" ? "Copy" : "Kopier", l = h();
9
- return /* @__PURE__ */ t(d, {
9
+ return /* @__PURE__ */ t(c, {
10
10
  title: i,
11
11
  children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(m, {
12
12
  dataTest: "copy-button",
@@ -14,7 +14,7 @@ var g = ({ className: n, contentToCopy: p, locale: r, messageInfo: a, text: e })
14
14
  className: n,
15
15
  size: "small",
16
16
  variant: "text",
17
- startIcon: /* @__PURE__ */ t(c, {
17
+ startIcon: /* @__PURE__ */ t(d, {
18
18
  width: 20,
19
19
  height: 20
20
20
  }),
@@ -1,13 +1,13 @@
1
1
  import { cn as m } from "../../../helpers/cn.js";
2
- import { ContentCopyIcon as s } from "../../icons/content-copy-icon/ContentCopyIcon.js";
3
- import { StyledTooltip as c } from "../../data-display/tooltip/StyledTooltip.js";
2
+ import { StyledTooltip as s } from "../../data-display/tooltip/StyledTooltip.js";
3
+ import { ContentCopyIcon as c } from "../../icons/content-copy-icon/ContentCopyIcon.js";
4
4
  import { StyledButton as d } from "../../inputs/button/StyledButton.js";
5
5
  import e from "./CopyWrapper.module.js";
6
6
  import "react";
7
7
  import { jsx as t, jsxs as h } from "react/jsx-runtime";
8
8
  var b = ({ className: i, contentToCopy: p, locale: o, messageInfo: a, children: n }) => /* @__PURE__ */ h("div", {
9
9
  className: m("flex items-center hover:text-gama-500", e["copy-wrapper"], i),
10
- children: [n, /* @__PURE__ */ t(c, {
10
+ children: [n, /* @__PURE__ */ t(s, {
11
11
  title: o === "no" ? "Kopier" : "Copy",
12
12
  children: /* @__PURE__ */ t("div", {
13
13
  className: e["hidden-copy"],
@@ -22,7 +22,7 @@ var b = ({ className: i, contentToCopy: p, locale: o, messageInfo: a, children:
22
22
  a(o === "no" ? "Kopiert til utklippstavle" : "Copied to clipboard");
23
23
  }).catch((l) => console.error("Copying failed with this: ", l));
24
24
  },
25
- startIcon: /* @__PURE__ */ t(s, {
25
+ startIcon: /* @__PURE__ */ t(c, {
26
26
  width: 20,
27
27
  height: 20
28
28
  })
@@ -1,16 +1,16 @@
1
- var e = "_contained_efhli_6", _ = "_common_efhli_6", t = "_medium_efhli_56", a = "_small_efhli_61", r = "_large_efhli_66", l = "_error_efhli_76", i = "_outlined_efhli_146", o = "_text_efhli_286", f = "_textGray_efhli_426", h = "_textWhite_efhli_496", m = {
2
- "asma-core-ui-button": "_asma-core-ui-button_efhli_1",
3
- contained: e,
4
- common: _,
1
+ var _ = "_contained_11nol_6", o = "_common_11nol_6", t = "_medium_11nol_56", a = "_small_11nol_61", e = "_large_11nol_66", r = "_error_11nol_76", l = "_outlined_11nol_146", n = "_text_11nol_286", m = "_textGray_11nol_426", u = "_textWhite_11nol_496", v = {
2
+ "asma-core-ui-button": "_asma-core-ui-button_11nol_1",
3
+ contained: _,
4
+ common: o,
5
5
  medium: t,
6
6
  small: a,
7
- large: r,
8
- error: l,
9
- outlined: i,
10
- text: o,
11
- textGray: f,
12
- textWhite: h
7
+ large: e,
8
+ error: r,
9
+ outlined: l,
10
+ text: n,
11
+ textGray: m,
12
+ textWhite: u
13
13
  };
14
14
  export {
15
- m as default
15
+ v as default
16
16
  };
@@ -1,5 +1,6 @@
1
- var a = (r) => r.tabIndex >= 0 && !r.matches(":disabled") && !r.closest("[inert]") && (r.checkVisibility?.() ?? !0), b = (r) => Array.from(r.querySelectorAll("*")).filter(a), i = (r) => a(r) ? r : Array.from(r.querySelectorAll("*")).find(a) ?? null;
1
+ var r = (a) => a.tabIndex >= 0 && !a.matches(":disabled") && !a.closest("[inert]") && (a.checkVisibility?.() ?? !0), b = (a) => (a.tabIndex >= 0 || a.hasAttribute("tabindex")) && !a.matches(":disabled"), i = (a) => Array.from(a.querySelectorAll("*")).filter(r), l = (a) => r(a) ? a : Array.from(a.querySelectorAll("*")).find(r) ?? null, s = (a) => b(a) ? a : Array.from(a.querySelectorAll("*")).find(b) ?? null;
2
2
  export {
3
- i as firstTabbable,
4
- b as tabbableWithin
3
+ s as firstFocusable,
4
+ l as firstTabbable,
5
+ i as tabbableWithin
5
6
  };
@@ -0,0 +1,6 @@
1
+ function a(e) {
2
+ typeof process < "u" && process.env.NODE_ENV === "production" || console.warn(`[asma-ui-core/StyledDialog] "${e ?? "dialog"}" has no accessible name — pass dialogTitle, dialogLabel or ariaLabel, or render a heading in its content`);
3
+ }
4
+ export {
5
+ a as warnUnnamedDialog
6
+ };