@altinn/altinn-components 0.37.0 → 0.38.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 (41) hide show
  1. package/dist/assets/DrawerOrDropdown.css +1 -1
  2. package/dist/assets/Header.css +1 -1
  3. package/dist/assets/MenuItemBase.css +1 -1
  4. package/dist/components/Button/IconButton.js +9 -7
  5. package/dist/components/ContextMenu/ContextMenu.js +58 -43
  6. package/dist/components/Dropdown/DrawerOrDropdown.js +4 -4
  7. package/dist/components/Header/Header.js +42 -57
  8. package/dist/components/Header/LocaleButton.js +3 -2
  9. package/dist/components/Header/LocaleSwitcher.js +38 -23
  10. package/dist/components/Layout/Layout.js +27 -16
  11. package/dist/components/Layout/LayoutContent.js +4 -4
  12. package/dist/components/Menu/MenuBase.js +9 -9
  13. package/dist/components/Menu/MenuItemBase.js +31 -27
  14. package/dist/components/Menu/MenuItems.js +43 -37
  15. package/dist/components/Searchbar/Autocomplete.js +23 -30
  16. package/dist/components/Searchbar/Searchbar.js +4 -4
  17. package/dist/components/SkipLink/SkipLink.js +18 -0
  18. package/dist/components/SkipLink/index.js +4 -0
  19. package/dist/hooks/useEnterKey.js +8 -8
  20. package/dist/hooks/useMenu.js +43 -28
  21. package/dist/types/lib/components/Button/IconButton.d.ts +2 -1
  22. package/dist/types/lib/components/Dropdown/DrawerOrDropdown.d.ts +1 -1
  23. package/dist/types/lib/components/GlobalMenu/GlobalMenu.stories.d.ts +1 -0
  24. package/dist/types/lib/components/Header/LocaleButton.d.ts +2 -1
  25. package/dist/types/lib/components/Header/LocaleSwitcher.d.ts +2 -5
  26. package/dist/types/lib/components/Layout/Layout.d.ts +3 -1
  27. package/dist/types/lib/components/Layout/Layout.stories.d.ts +7 -1
  28. package/dist/types/lib/components/Layout/LayoutContent.d.ts +9 -2
  29. package/dist/types/lib/components/Menu/MenuBase.d.ts +4 -2
  30. package/dist/types/lib/components/Menu/MenuItem.d.ts +2 -1
  31. package/dist/types/lib/components/Menu/MenuItemBase.d.ts +3 -2
  32. package/dist/types/lib/components/Menu/MenuItems.d.ts +3 -1
  33. package/dist/types/lib/components/SkipLink/SkipLink.d.ts +9 -0
  34. package/dist/types/lib/components/SkipLink/SkipLink.stories.d.ts +15 -0
  35. package/dist/types/lib/components/SkipLink/index.d.ts +1 -0
  36. package/dist/types/lib/components/Transmission/Transmission.stories.d.ts +1 -1
  37. package/dist/types/lib/hooks/useEnterKey.d.ts +1 -1
  38. package/dist/types/lib/hooks/useMenu.d.ts +6 -2
  39. package/dist/types/lib/stories/Beta.stories.d.ts +11 -0
  40. package/package.json +1 -1
  41. package/dist/types/lib/components/Header/LocaleSwitcher.stories.d.ts +0 -19
@@ -1 +1 @@
1
- ._drawerOrDropdown_ijmwc_1{background-color:var(--ds-color-background-default);display:none}._drawerOrDropdown_ijmwc_1[data-expanded=true]{position:fixed;top:5.5rem;right:0;bottom:0;left:0;display:block;z-index:2}@media (min-width: 1024px){._header_ijmwc_18,._footer_ijmwc_19{display:none}._drawerOrDropdown_ijmwc_1[data-expanded=true]{position:absolute;top:auto;right:auto;bottom:auto;left:0;min-width:16rem;max-width:24rem;margin-top:.5rem;border-radius:.375rem;overflow:hidden}}
1
+ ._drawerOrDropdown_2swxb_1{background-color:var(--ds-color-background-default);display:none}._drawerOrDropdown_2swxb_1[data-expanded=true]{position:fixed;top:5.5rem;right:0;bottom:0;left:0;display:block;z-index:2}@media (min-width: 1024px){._header_2swxb_17,._footer_2swxb_18{display:none}._drawerOrDropdown_2swxb_1[data-expanded=true]{position:absolute;top:auto;right:auto;bottom:auto;left:0;min-width:16rem;max-width:24rem;margin-top:.5rem;border-radius:.375rem;overflow:hidden}}
@@ -1 +1 @@
1
- ._drawer_1vzjh_1[data-expanded=true]{display:block}._dropdown_1vzjh_5[data-expanded=true]{display:none}@media (min-width: 1024px){._dropdown_1vzjh_5[data-expanded=true]{width:320px;display:block}._drawer_1vzjh_1[data-expanded=true]{display:none}}._relative_1vzjh_19{position:relative}
1
+ ._drawer_1tael_1[data-expanded=true]{display:block;width:100%}._dropdown_1tael_6[data-expanded=true]{display:none}@media (min-width: 1024px){._dropdown_1tael_6[data-expanded=true]{width:320px;display:block}._drawer_1tael_1[data-expanded=true]{display:none}}._relative_1tael_20{position:relative}
@@ -1 +1 @@
1
- ._item_1itcj_1{font:inherit;color:inherit;padding:0;border:0;text-align:inherit;text-decoration:none;line-height:normal;-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-user-select:none;user-select:none;cursor:pointer;position:relative;width:100%;display:flex;align-items:center;column-gap:.25rem;margin:.5rem 0;border-radius:2px}._item_1itcj_1[aria-disabled=true]{opacity:.5;pointer-events:none}._item_1itcj_1[data-size=md]{min-height:56px}._item_1itcj_1[data-size=md]{min-height:44px}._item_1itcj_1[data-size=sm]{min-height:40px}._content_1itcj_45{display:flex;width:100%;align-items:center;column-gap:6px;padding:6px}._item_1itcj_1,._item_1itcj_1[data-theme]{background-color:transparent}._item_1itcj_1{pointer-events:none}._item_1itcj_1[data-interactive=true]{pointer-events:all}[data-theme=subtle] ._item_1itcj_1:hover{background-color:var(--ds-color-surface-hover)}[data-theme=subtle] ._item_1itcj_1:active{background-color:var(--ds-color-surface-active)}[data-theme=subtle] ._item_1itcj_1[data-selected=true]{background-color:var(--ds-color-background-default)}[data-theme=default] ._item_1itcj_1:hover{background-color:var(--ds-color-surface-hover)}[data-theme=default] ._item_1itcj_1:active{background-color:var(--ds-color-surface-active)}[data-theme=default] ._item_1itcj_1[data-selected=true]{background-color:var(--ds-color-background-tinted)}._content_1itcj_45{display:flex;width:100%;align-items:center;column-gap:.5em}._item_1itcj_1:focus-visible{box-shadow:var(--_ds--focus, var(--dsc-focus-boxShadow));outline:var(--_ds--focus, var(--dsc-focus-outline))}._item_1itcj_1:focus-visible *{--_ds--focus: }
1
+ ._item_1qmxq_1{font:inherit;color:inherit;padding:0;border:0;text-align:inherit;text-decoration:none;line-height:normal;-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-user-select:none;user-select:none;cursor:pointer;position:relative;width:100%;display:flex;align-items:center;column-gap:.25rem;margin:.5rem 0;border-radius:2px}._item_1qmxq_1[aria-disabled=true]{opacity:.5;pointer-events:none}._item_1qmxq_1[data-size=md]{min-height:56px}._item_1qmxq_1[data-size=md]{min-height:44px}._item_1qmxq_1[data-size=sm]{min-height:40px}._content_1qmxq_45{display:flex;width:100%;align-items:center;column-gap:6px;padding:6px}._item_1qmxq_1,._item_1qmxq_1[data-theme]{background-color:transparent}._item_1qmxq_1{pointer-events:none}._item_1qmxq_1[data-interactive=true]{pointer-events:all}[data-theme=subtle] ._item_1qmxq_1:hover{background-color:var(--ds-color-surface-hover)}[data-theme=subtle] ._item_1qmxq_1:active{background-color:var(--ds-color-surface-active)}[data-theme=subtle] ._item_1qmxq_1[data-selected=true]{background-color:var(--ds-color-background-default)}[data-theme=default] ._item_1qmxq_1:hover,[data-theme=default] [data-active=true]{background-color:var(--ds-color-surface-hover)}[data-theme=default] ._item_1qmxq_1:active{background-color:var(--ds-color-surface-active)}[data-theme=default] ._item_1qmxq_1[data-selected=true]{background-color:var(--ds-color-background-tinted)}._content_1qmxq_45{display:flex;width:100%;align-items:center;column-gap:.5em}._item_1qmxq_1:focus-visible{box-shadow:var(--_ds--focus, var(--dsc-focus-boxShadow));outline:var(--_ds--focus, var(--dsc-focus-outline))}._item_1qmxq_1:focus-visible *{--_ds--focus: }
@@ -1,11 +1,11 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import "../../index-L8X2o7IH.js";
3
3
  import "react";
4
- import { ButtonBase as f } from "./ButtonBase.js";
5
- import { ButtonIcon as u } from "./ButtonIcon.js";
4
+ import { ButtonBase as u } from "./ButtonBase.js";
5
+ import { ButtonIcon as B } from "./ButtonIcon.js";
6
6
  import "../RootProvider/RootProvider.js";
7
7
  import "../Snackbar/useSnackbar.js";
8
- const z = ({
8
+ const g = ({
9
9
  variant: r = "solid",
10
10
  rounded: i = !1,
11
11
  size: m,
@@ -16,9 +16,10 @@ const z = ({
16
16
  className: n,
17
17
  selected: s,
18
18
  onClick: l,
19
- dataTestId: d
19
+ dataTestId: d,
20
+ onBlurCapture: f
20
21
  }) => /* @__PURE__ */ o(
21
- f,
22
+ u,
22
23
  {
23
24
  variant: r,
24
25
  rounded: i,
@@ -29,9 +30,10 @@ const z = ({
29
30
  selected: s,
30
31
  "data-testid": d,
31
32
  "aria-label": p,
32
- children: t && /* @__PURE__ */ o(u, { icon: t, size: e })
33
+ onBlurCapture: f,
34
+ children: t && /* @__PURE__ */ o(B, { icon: t, size: e })
33
35
  }
34
36
  );
35
37
  export {
36
- z as IconButton
38
+ g as IconButton
37
39
  };
@@ -1,68 +1,83 @@
1
1
  "use client";
2
- import { jsxs as v, jsx as s } from "react/jsx-runtime";
3
- import { c as O } from "../../index-L8X2o7IH.js";
4
- import * as a from "react";
5
- import { forwardRef as b, useRef as h, useMemo as w } from "react";
6
- import { IconButton as y } from "../Button/IconButton.js";
7
- import { useClickOutside as I } from "../../hooks/useClickOutside.js";
2
+ import { jsxs as y, jsx as f } from "react/jsx-runtime";
3
+ import { c as I } from "../../index-L8X2o7IH.js";
4
+ import * as m from "react";
5
+ import { forwardRef as w, useRef as O, useMemo as k } from "react";
6
+ import { IconButton as E } from "../Button/IconButton.js";
7
+ import { useClickOutside as C } from "../../hooks/useClickOutside.js";
8
+ import { useEnterKey as M } from "../../hooks/useEnterKey.js";
8
9
  import { DropdownBase as j } from "../Dropdown/DropdownBase.js";
9
- import { MenuItems as C } from "../Menu/MenuItems.js";
10
- import { useRootContext as _ } from "../RootProvider/RootProvider.js";
10
+ import { MenuItems as _ } from "../Menu/MenuItems.js";
11
+ import { useRootContext as R } from "../RootProvider/RootProvider.js";
11
12
  import "../Snackbar/useSnackbar.js";
12
- import { u as R } from "../../useId-BVFxCjkq.js";
13
- import '../../assets/ContextMenu.css';var E = function(e, l) {
14
- var r = {};
15
- for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && l.indexOf(t) < 0 && (r[t] = e[t]);
13
+ import { u as P } from "../../useId-BVFxCjkq.js";
14
+ import '../../assets/ContextMenu.css';var T = function(e, s) {
15
+ var n = {};
16
+ for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && s.indexOf(t) < 0 && (n[t] = e[t]);
16
17
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
17
18
  for (var o = 0, t = Object.getOwnPropertySymbols(e); o < t.length; o++)
18
- l.indexOf(t[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[o]) && (r[t[o]] = e[t[o]]);
19
- return r;
19
+ s.indexOf(t[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[o]) && (n[t[o]] = e[t[o]]);
20
+ return n;
20
21
  };
21
- const M = b((e, l) => {
22
- var { title: r, titleId: t } = e, o = E(e, ["title", "titleId"]);
23
- let n = R();
24
- return n = r ? t || "title-" + n : void 0, a.createElement(
22
+ const A = w((e, s) => {
23
+ var { title: n, titleId: t } = e, o = T(e, ["title", "titleId"]);
24
+ let i = P();
25
+ return i = n ? t || "title-" + i : void 0, m.createElement(
25
26
  "svg",
26
- Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: l, "aria-labelledby": n }, o),
27
- r ? a.createElement("title", { id: n }, r) : null,
28
- a.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M6 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3m4.5 1.5a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0m6 0a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0", clipRule: "evenodd" })
27
+ Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: s, "aria-labelledby": i }, o),
28
+ n ? m.createElement("title", { id: i }, n) : null,
29
+ m.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M6 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3m4.5 1.5a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0m6 0a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0", clipRule: "evenodd" })
29
30
  );
30
- }), k = "_toggle_nol5i_1", B = {
31
- toggle: k
32
- }, q = ({
31
+ }), B = "_toggle_nol5i_1", S = {
32
+ toggle: B
33
+ }, Q = ({
33
34
  id: e = "context-menu",
34
- ariaLabel: l,
35
- placement: r = "right",
35
+ ariaLabel: s,
36
+ placement: n = "right",
36
37
  groups: t = {},
37
38
  className: o,
38
- items: n
39
+ items: i
39
40
  }) => {
40
- const { currentId: p, toggleId: u, closeAll: f } = _(), m = h(null), g = () => u(e), c = p === e;
41
- I(m, () => {
42
- c && u(e);
41
+ const { currentId: v, toggleId: p, closeAll: a } = R(), d = O(null), g = "context-menu-" + e, x = () => p(e), u = v === e;
42
+ C(d, () => {
43
+ u && p(e);
43
44
  });
44
- const x = w(() => n.map((i) => ({
45
- ...i,
45
+ const b = k(() => i.map((r) => ({
46
+ ...r,
47
+ tabIndex: -1,
46
48
  onClick: () => {
47
- var d;
48
- (d = i.onClick) == null || d.call(i), f();
49
+ var c;
50
+ (c = r.onClick) == null || c.call(r), a();
49
51
  }
50
- })), [n, f]);
51
- return /* @__PURE__ */ v("div", { className: O(B.toggle, o), "data-color": "neutral", ref: m, children: [
52
- /* @__PURE__ */ s(
53
- y,
52
+ })), [i, a]);
53
+ M((r) => {
54
+ var c;
55
+ if (u) {
56
+ r.preventDefault();
57
+ const l = (c = d.current) == null ? void 0 : c.querySelector('[data-active="true"]');
58
+ l && (l.tagName === "A" && l.hasAttribute("href") ? l.click() : l.dispatchEvent(new MouseEvent("click", { bubbles: !0 }))), a();
59
+ }
60
+ });
61
+ const h = (r) => {
62
+ var l;
63
+ ((l = r == null ? void 0 : r.relatedTarget) == null ? void 0 : l.closest(`[data-testid="${g}"]`)) || a();
64
+ };
65
+ return /* @__PURE__ */ y("div", { className: I(S.toggle, o), "data-color": "neutral", ref: d, "data-testid": g, children: [
66
+ /* @__PURE__ */ f(
67
+ E,
54
68
  {
55
69
  size: "xs",
56
70
  rounded: !0,
57
- icon: M,
71
+ icon: A,
58
72
  variant: "text",
59
- onClick: g,
60
- iconAltText: l || `Open ${e}`
73
+ onClick: x,
74
+ iconAltText: s || `Open ${e}`,
75
+ onBlurCapture: h
61
76
  }
62
77
  ),
63
- c && /* @__PURE__ */ s(j, { placement: r, open: c, children: /* @__PURE__ */ s(C, { groups: t, items: x }) })
78
+ u && /* @__PURE__ */ f(j, { placement: n, open: u, children: /* @__PURE__ */ f(_, { groups: t, items: b, keyboardEvents: !0 }) })
64
79
  ] });
65
80
  };
66
81
  export {
67
- q as ContextMenu
82
+ Q as ContextMenu
68
83
  };
@@ -1,4 +1,4 @@
1
- import { jsxs as c, Fragment as s, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as s, Fragment as c, jsx as o } from "react/jsx-runtime";
2
2
  import "../../index-L8X2o7IH.js";
3
3
  import "react";
4
4
  import "../RootProvider/RootProvider.js";
@@ -8,7 +8,7 @@ import { DrawerFooter as f } from "./DrawerFooter.js";
8
8
  import { DrawerButton as D } from "./DrawerButton.js";
9
9
  import { DrawerBody as n } from "./DrawerBody.js";
10
10
  import "../Snackbar/useSnackbar.js";
11
- import '../../assets/DrawerOrDropdown.css';const t = "_drawerOrDropdown_ijmwc_1", _ = "_header_ijmwc_18", h = "_footer_ijmwc_19", e = {
11
+ import '../../assets/DrawerOrDropdown.css';const t = "_drawerOrDropdown_2swxb_1", _ = "_header_2swxb_17", h = "_footer_2swxb_18", e = {
12
12
  drawerOrDropdown: t,
13
13
  header: _,
14
14
  footer: h
@@ -18,9 +18,9 @@ import '../../assets/DrawerOrDropdown.css';const t = "_drawerOrDropdown_ijmwc_1"
18
18
  drawerButton: r,
19
19
  children: a,
20
20
  drawerTitle: p
21
- }) => /* @__PURE__ */ c(s, { children: [
21
+ }) => /* @__PURE__ */ s(c, { children: [
22
22
  m && /* @__PURE__ */ o(d, { onClick: i }),
23
- /* @__PURE__ */ c("div", { className: e.drawerOrDropdown, "data-expanded": m, children: [
23
+ /* @__PURE__ */ s("div", { className: e.drawerOrDropdown, "data-expanded": m, children: [
24
24
  /* @__PURE__ */ o(l, { className: e.header, title: p, onClose: i }),
25
25
  /* @__PURE__ */ o(n, { children: a }),
26
26
  /* @__PURE__ */ o(f, { className: e.footer, children: r && /* @__PURE__ */ o(D, { onClick: r == null ? void 0 : r.onClick, children: r == null ? void 0 : r.label }) })
@@ -1,88 +1,73 @@
1
1
  "use client";
2
- import { jsxs as c, jsx as e } from "react/jsx-runtime";
3
- import { DropdownBase as h } from "../Dropdown/DropdownBase.js";
2
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
3
+ import { DropdownBase as C } from "../Dropdown/DropdownBase.js";
4
4
  import "../../index-L8X2o7IH.js";
5
- import { DrawerBase as f } from "../Dropdown/DrawerBase.js";
5
+ import { DrawerBase as b } from "../Dropdown/DrawerBase.js";
6
6
  import "react";
7
- import { useRootContext as b } from "../RootProvider/RootProvider.js";
8
- import { GlobalMenu as w } from "../GlobalMenu/GlobalMenu.js";
9
- import { GlobalMenuButton as j } from "../GlobalMenu/GlobalMenuButton.js";
10
- import { HeaderBase as B } from "./HeaderBase.js";
11
- import { HeaderLogo as H } from "./HeaderLogo.js";
12
- import { LocaleButton as L } from "./LocaleButton.js";
13
- import { LocaleSwitcher as g } from "./LocaleSwitcher.js";
14
- import { Searchbar as u } from "../Searchbar/Searchbar.js";
7
+ import { useRootContext as v } from "../RootProvider/RootProvider.js";
8
+ import { GlobalMenu as h } from "../GlobalMenu/GlobalMenu.js";
9
+ import { GlobalMenuButton as H } from "../GlobalMenu/GlobalMenuButton.js";
10
+ import { HeaderBase as S } from "./HeaderBase.js";
11
+ import { HeaderLogo as k } from "./HeaderLogo.js";
12
+ import { LocaleSwitcher as B } from "./LocaleSwitcher.js";
13
+ import { Searchbar as f } from "../Searchbar/Searchbar.js";
15
14
  import "../Snackbar/useSnackbar.js";
16
- import { HeaderGroup as S } from "./HeaderGroup.js";
17
- import { HeaderSearch as v } from "./HeaderSearch.js";
18
- import { useIsDesktop as D } from "../../hooks/useIsDesktop.js";
19
- import '../../assets/Header.css';const I = "_drawer_1vzjh_1", y = "_dropdown_1vzjh_5", z = "_relative_1vzjh_19", a = {
20
- drawer: I,
21
- dropdown: y,
22
- relative: z
23
- }, Z = ({ menu: r, locale: n, search: s, currentAccount: l, logo: x = {}, badge: C }) => {
24
- const { currentId: o, toggleId: t, openId: _, closeAll: d } = b(), p = () => {
15
+ import { HeaderGroup as D } from "./HeaderGroup.js";
16
+ import { HeaderSearch as w } from "./HeaderSearch.js";
17
+ import { useIsDesktop as I } from "../../hooks/useIsDesktop.js";
18
+ import '../../assets/Header.css';const N = "_drawer_1tael_1", F = "_dropdown_1tael_6", G = "_relative_1tael_20", s = {
19
+ drawer: N,
20
+ dropdown: F,
21
+ relative: G
22
+ }, W = ({ menu: r, locale: d, search: a, currentAccount: t, logo: u = {}, badge: x }) => {
23
+ const { currentId: o, toggleId: p, openId: _, closeAll: n } = v(), i = () => {
25
24
  _("search");
26
- }, i = () => {
27
- t("search");
28
- }, N = () => {
29
- t("menu");
30
- }, k = () => {
31
- t("locale");
32
- }, m = D();
33
- return /* @__PURE__ */ c(
34
- B,
25
+ }, c = () => {
26
+ p("search");
27
+ }, g = () => {
28
+ p("menu");
29
+ }, m = I();
30
+ return /* @__PURE__ */ l(
31
+ S,
35
32
  {
36
33
  currentId: o,
37
34
  open: o === "search" || o === "menu" || o === "locale",
38
- onClose: d,
35
+ onClose: n,
39
36
  children: [
40
- /* @__PURE__ */ e(H, { ...x, className: a.logo }),
41
- s && m && /* @__PURE__ */ e(v, { expanded: o === "search", children: /* @__PURE__ */ e(u, { ...s, expanded: o === "search", onClose: i, onFocus: p }) }),
42
- /* @__PURE__ */ c(S, { children: [
43
- n && /* @__PURE__ */ e("div", { className: a.relative, children: /* @__PURE__ */ e(L, { onClick: k, expanded: o === "locale" }) }),
44
- /* @__PURE__ */ c("div", { className: a.relative, children: [
37
+ /* @__PURE__ */ e(k, { ...u, className: s.logo }),
38
+ a && m && /* @__PURE__ */ e(w, { expanded: o === "search", children: /* @__PURE__ */ e(f, { ...a, expanded: o === "search", onClose: c, onFocus: i }) }),
39
+ /* @__PURE__ */ l(D, { children: [
40
+ d && /* @__PURE__ */ e(B, { ...d }),
41
+ /* @__PURE__ */ l("div", { className: s.relative, children: [
45
42
  /* @__PURE__ */ e(
46
- j,
43
+ H,
47
44
  {
48
- badge: C,
49
- currentAccount: l,
50
- onClick: N,
45
+ badge: x,
46
+ currentAccount: t,
47
+ onClick: g,
51
48
  expanded: o === "menu",
52
49
  label: r == null ? void 0 : r.menuLabel
53
50
  }
54
51
  ),
55
- n && /* @__PURE__ */ e(
56
- h,
57
- {
58
- layout: "desktop",
59
- padding: !0,
60
- placement: "right",
61
- open: o === "locale",
62
- className: a.dropdown,
63
- children: /* @__PURE__ */ e(g, { ...n })
64
- }
65
- ),
66
52
  r && /* @__PURE__ */ e(
67
- h,
53
+ C,
68
54
  {
69
55
  layout: "desktop",
70
56
  padding: !0,
71
57
  placement: "right",
72
58
  open: o === "menu",
73
- className: a.dropdown,
74
- children: /* @__PURE__ */ e(w, { ...r, currentAccount: l, onClose: d })
59
+ className: s.dropdown,
60
+ children: /* @__PURE__ */ e(h, { ...r, currentAccount: t, onClose: n })
75
61
  }
76
62
  )
77
63
  ] })
78
64
  ] }),
79
- s && !m && /* @__PURE__ */ e(v, { expanded: o === "search", children: /* @__PURE__ */ e(u, { ...s, expanded: o === "search", onClose: i, onFocus: p }) }),
80
- n && /* @__PURE__ */ e(f, { open: o === "locale", className: a.drawer, children: /* @__PURE__ */ e(g, { ...n }) }),
81
- r && /* @__PURE__ */ e(f, { open: o === "menu", className: a.drawer, children: /* @__PURE__ */ e(w, { ...r, currentAccount: l, onClose: d }) })
65
+ a && !m && /* @__PURE__ */ e(w, { expanded: o === "search", children: /* @__PURE__ */ e(f, { ...a, expanded: o === "search", onClose: c, onFocus: i }) }),
66
+ r && /* @__PURE__ */ e(b, { open: o === "menu", className: s.drawer, children: /* @__PURE__ */ e(h, { ...r, currentAccount: t, onClose: n }) })
82
67
  ]
83
68
  }
84
69
  );
85
70
  };
86
71
  export {
87
- Z as Header
72
+ W as Header
88
73
  };
@@ -26,7 +26,7 @@ const d = c((e, n) => {
26
26
  );
27
27
  }), s = "_button_utwi0_1", p = {
28
28
  button: s
29
- }, x = ({ id: e = "language-switcher", expanded: n, onClick: o }) => /* @__PURE__ */ i(
29
+ }, x = ({ id: e = "language-switcher", expanded: n, onClick: o, onBlurCapture: t }) => /* @__PURE__ */ i(
30
30
  m,
31
31
  {
32
32
  className: p.button,
@@ -37,7 +37,8 @@ const d = c((e, n) => {
37
37
  selected: n,
38
38
  color: "company",
39
39
  onClick: o,
40
- iconAltText: `Open ${e}`
40
+ iconAltText: `Open ${e}`,
41
+ onBlurCapture: t
41
42
  }
42
43
  );
43
44
  export {
@@ -1,30 +1,45 @@
1
1
  "use client";
2
- import { jsx as t, jsxs as m } from "react/jsx-runtime";
2
+ import { jsx as r, jsxs as k } from "react/jsx-runtime";
3
+ import { useRef as h, useMemo as v } from "react";
4
+ import { useEnterKey as b } from "../../hooks/useEnterKey.js";
5
+ import { useIsDesktop as x } from "../../hooks/useIsDesktop.js";
6
+ import { DropdownBase as I } from "../Dropdown/DropdownBase.js";
3
7
  import "../../index-L8X2o7IH.js";
4
- import "react";
5
- import { useRootContext as n } from "../RootProvider/RootProvider.js";
8
+ import { DrawerBase as w } from "../Dropdown/DrawerBase.js";
9
+ import { useRootContext as C } from "../RootProvider/RootProvider.js";
10
+ import { MenuItems as m } from "../Menu/MenuItems.js";
11
+ import { LocaleButton as y } from "./LocaleButton.js";
6
12
  import "../Snackbar/useSnackbar.js";
7
- import { MenuOption as u } from "../Menu/MenuOption.js";
8
- import { MenuHeader as p } from "../Menu/MenuHeader.js";
9
- import { MenuBase as d, MenuList as s, MenuListItem as o } from "../Menu/MenuBase.js";
10
- const j = ({ title: l = "Select language", options: c, onChange: r }) => {
11
- const { toggleId: i } = n(), a = (e) => {
12
- i("locale"), r == null || r(e);
13
+ import { S as B } from "../../Checkmark-D17Nyv_u.js";
14
+ const z = ({ title: d = "Select language", options: i, onSelect: o }) => {
15
+ const c = h(null), u = x(), { currentId: g, toggleId: f, closeAll: s } = C(), n = g === "locale", l = v(() => i.map((e) => ({
16
+ ...e,
17
+ id: String(e.value),
18
+ tabIndex: -1,
19
+ groupId: "locales",
20
+ icon: e.checked ? B : /* @__PURE__ */ r("span", { "aria-hidden": "true" }),
21
+ onClick: () => {
22
+ o == null || o(String(e.value)), s();
23
+ }
24
+ })), [i, o]), p = {
25
+ locales: { title: d || "Språk/language" }
13
26
  };
14
- return /* @__PURE__ */ t(d, { theme: "default", children: /* @__PURE__ */ m(s, { children: [
15
- /* @__PURE__ */ t(o, { children: /* @__PURE__ */ t(p, { title: l }) }),
16
- c.map((e) => /* @__PURE__ */ t(o, { children: /* @__PURE__ */ t(
17
- u,
18
- {
19
- onChange: a,
20
- label: e.label,
21
- type: "radio",
22
- value: e.value,
23
- checked: e.checked
24
- }
25
- ) }, e.value))
26
- ] }) });
27
+ return b((e) => {
28
+ var a;
29
+ if (n) {
30
+ e.preventDefault();
31
+ const t = (a = c.current) == null ? void 0 : a.querySelector('[data-active="true"]');
32
+ t && (t.tagName === "A" && t.hasAttribute("href") ? t.click() : t.dispatchEvent(new MouseEvent("click", { bubbles: !0 }))), s();
33
+ }
34
+ }), /* @__PURE__ */ k("div", { ref: c, "data-testid": "locale-switcher", children: [
35
+ /* @__PURE__ */ r(y, { onClick: () => f("locale"), expanded: n, onBlurCapture: (e) => {
36
+ var t;
37
+ ((t = e == null ? void 0 : e.relatedTarget) == null ? void 0 : t.closest('[data-testid="locale-switcher"]')) || s();
38
+ } }),
39
+ n && u && /* @__PURE__ */ r(I, { layout: "desktop", padding: !0, placement: "right", open: !0, children: /* @__PURE__ */ r(m, { groups: p, items: l, keyboardEvents: !0 }) }),
40
+ n && !u && /* @__PURE__ */ r(w, { open: !0, placement: "bottom", children: /* @__PURE__ */ r(m, { groups: p, items: l, keyboardEvents: !0 }) })
41
+ ] });
27
42
  };
28
43
  export {
29
- j as LocaleSwitcher
44
+ z as LocaleSwitcher
30
45
  };
@@ -1,30 +1,41 @@
1
1
  "use client";
2
2
  import { jsxs as p, jsx as m } from "react/jsx-runtime";
3
- import { LayoutBase as y } from "./LayoutBase.js";
4
- import { LayoutBody as h } from "./LayoutBody.js";
5
- import { LayoutContent as L } from "./LayoutContent.js";
6
- import { LayoutSidebar as x } from "./LayoutSidebar.js";
7
- import { Footer as j } from "../Footer/Footer.js";
8
- import { Header as B } from "../Header/Header.js";
3
+ import { LayoutBase as h } from "./LayoutBase.js";
4
+ import { LayoutBody as L } from "./LayoutBody.js";
5
+ import { LayoutContent as x } from "./LayoutContent.js";
6
+ import { LayoutSidebar as j } from "./LayoutSidebar.js";
7
+ import { Footer as B } from "../Footer/Footer.js";
8
+ import { Header as C } from "../Header/Header.js";
9
9
  import "../../index-L8X2o7IH.js";
10
10
  import "react";
11
- import { useRootContext as C } from "../RootProvider/RootProvider.js";
11
+ import { useRootContext as S } from "../RootProvider/RootProvider.js";
12
12
  import { Menu as F } from "../Menu/Menu.js";
13
13
  import "../Snackbar/useSnackbar.js";
14
- const D = ({ color: r, theme: c = "subtle", header: u, footer: l, sidebar: o, content: t = {}, children: f }) => {
15
- const { currentId: n } = C();
16
- return /* @__PURE__ */ p(y, { color: r, theme: c, currentId: n, children: [
17
- u && /* @__PURE__ */ m(B, { ...u }),
18
- /* @__PURE__ */ p(h, { currentId: n, children: [
19
- o && /* @__PURE__ */ p(x, { hidden: o == null ? void 0 : o.hidden, color: o == null ? void 0 : o.color, ...o, children: [
14
+ import { SkipLink as H } from "../SkipLink/SkipLink.js";
15
+ const J = ({
16
+ color: c,
17
+ theme: f = "subtle",
18
+ header: u,
19
+ footer: n,
20
+ sidebar: o,
21
+ content: t = {},
22
+ children: y,
23
+ skipLink: r
24
+ }) => {
25
+ const { currentId: l } = S();
26
+ return /* @__PURE__ */ p(h, { color: c, theme: f, currentId: l, children: [
27
+ r && /* @__PURE__ */ m(H, { ...r }),
28
+ u && /* @__PURE__ */ m(C, { ...u }),
29
+ /* @__PURE__ */ p(L, { currentId: l, children: [
30
+ o && /* @__PURE__ */ p(j, { hidden: o == null ? void 0 : o.hidden, color: o == null ? void 0 : o.color, ...o, children: [
20
31
  (o == null ? void 0 : o.menu) && /* @__PURE__ */ m(F, { ...o == null ? void 0 : o.menu }),
21
32
  o == null ? void 0 : o.children
22
33
  ] }),
23
- /* @__PURE__ */ m(L, { color: t == null ? void 0 : t.color, children: f })
34
+ /* @__PURE__ */ m(x, { color: t == null ? void 0 : t.color, id: "main-content", children: y })
24
35
  ] }),
25
- l && /* @__PURE__ */ m(j, { ...l })
36
+ n && /* @__PURE__ */ m(B, { ...n })
26
37
  ] });
27
38
  };
28
39
  export {
29
- D as Layout
40
+ J as Layout
30
41
  };
@@ -1,7 +1,7 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import '../../assets/LayoutContent.css';const c = "_content_1wkbr_1", e = {
3
- content: c
4
- }, r = ({ color: t, children: n }) => /* @__PURE__ */ o("main", { className: e.content, "data-color": t, children: n });
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import '../../assets/LayoutContent.css';const e = "_content_1wkbr_1", s = {
3
+ content: e
4
+ }, r = ({ color: t, children: n, id: o = "main-content" }) => /* @__PURE__ */ c("main", { className: s.content, "data-color": t, id: o, children: n });
5
5
  export {
6
6
  r as LayoutContent
7
7
  };
@@ -1,17 +1,17 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import { c as a } from "../../index-L8X2o7IH.js";
3
- import '../../assets/MenuBase.css';const u = "_menu_sxyub_1", r = "_list_sxyub_16", l = "_item_sxyub_22", c = {
4
- menu: u,
5
- list: r,
6
- item: l
7
- }, C = ({ as: t = "nav", color: n, theme: e, className: o, children: s }) => /* @__PURE__ */ m(t, { className: a(c.menu, o), "data-color": n, "data-theme": e, children: s }), d = ({ as: t = "ul", role: n = "group", className: e, children: o }) => /* @__PURE__ */ m(t, { className: a(c.list, e), role: n, children: o }), y = ({
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { c } from "../../index-L8X2o7IH.js";
3
+ import '../../assets/MenuBase.css';const r = "_menu_sxyub_1", l = "_list_sxyub_16", p = "_item_sxyub_22", i = {
4
+ menu: r,
5
+ list: l,
6
+ item: p
7
+ }, C = ({ as: t = "nav", color: n, theme: e, className: o, children: s }) => /* @__PURE__ */ a(t, { className: c(i.menu, o), "data-color": n, "data-theme": e, children: s }), d = ({ as: t = "ul", role: n = "group", className: e, children: o, ref: s, onMouseEnter: m }) => /* @__PURE__ */ a(t, { className: c(i.list, e), role: n, ref: s, onMouseEnter: m, children: o }), y = ({
8
8
  as: t = "li",
9
9
  role: n = "presentation",
10
10
  className: e,
11
11
  children: o,
12
12
  style: s,
13
- dataIndex: i
14
- }) => /* @__PURE__ */ m(t, { className: a(c.item, e), role: n, style: s, "data-index": i, children: o });
13
+ dataIndex: m
14
+ }) => /* @__PURE__ */ a(t, { className: c(i.item, e), role: n, style: s, "data-index": m, children: o });
15
15
  export {
16
16
  C as MenuBase,
17
17
  d as MenuList,
@@ -1,43 +1,47 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import { c as u } from "../../index-L8X2o7IH.js";
3
- import '../../assets/MenuItemBase.css';const l = "_item_1itcj_1", I = "_content_1itcj_45", m = {
4
- item: l,
5
- content: I
6
- }, z = ({
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { c as v } from "../../index-L8X2o7IH.js";
3
+ import '../../assets/MenuItemBase.css';const I = "_item_1qmxq_1", N = "_content_1qmxq_45", c = {
4
+ item: I,
5
+ content: N
6
+ }, B = ({
7
7
  interactive: o = !0,
8
8
  as: s,
9
- color: r,
10
- theme: d,
9
+ color: d,
10
+ theme: r,
11
11
  size: i,
12
12
  className: p,
13
- href: _,
13
+ href: x,
14
14
  onClick: t,
15
- onKeyPress: e,
16
- tabIndex: x = 0,
17
- hidden: f,
18
- selected: h,
19
- disabled: a = !1,
20
- children: j
21
- }) => /* @__PURE__ */ c(
15
+ onKeyPress: a,
16
+ tabIndex: _ = 0,
17
+ hidden: q,
18
+ selected: f,
19
+ disabled: e = !1,
20
+ children: h,
21
+ active: u,
22
+ onMouseEnter: l
23
+ }) => /* @__PURE__ */ m(
22
24
  s || "a",
23
25
  {
24
- tabIndex: a ? "-1" : x ?? 0,
25
- className: u(m.item, p),
26
+ tabIndex: e ? "-1" : _ ?? 0,
27
+ className: v(c.item, p),
26
28
  "data-interactive": o,
29
+ "data-active": u,
27
30
  "data-size": i,
28
- "data-color": r,
29
- "data-theme": d,
30
- "aria-hidden": f,
31
- "aria-disabled": a,
32
- "data-selected": h,
33
- href: _,
31
+ "data-color": d,
32
+ "data-theme": r,
33
+ "aria-hidden": q,
34
+ "aria-disabled": e,
35
+ "data-selected": f,
36
+ href: x,
34
37
  onKeyPress: (n) => {
35
- n.key === "Enter" && (t == null || t()), e == null || e(n);
38
+ n.key === "Enter" && (t == null || t()), a == null || a(n);
36
39
  },
37
40
  onClick: t,
38
- children: /* @__PURE__ */ c("span", { className: m.content, children: j })
41
+ onMouseEnter: l,
42
+ children: /* @__PURE__ */ m("span", { className: c.content, children: h })
39
43
  }
40
44
  );
41
45
  export {
42
- z as MenuItemBase
46
+ B as MenuItemBase
43
47
  };