@altinn/altinn-components 0.38.5 → 0.38.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,88 +1,89 @@
1
1
  "use client";
2
- import { jsxs as m, jsx as r, Fragment as j } from "react/jsx-runtime";
3
- import { useState as q, useMemo as w } from "react";
2
+ import { jsxs as p, jsx as r, Fragment as v } from "react/jsx-runtime";
3
+ import { useState as b, useMemo as q } from "react";
4
4
  import "../../index-L8X2o7IH.js";
5
- import { AccountMenu as z } from "../Account/AccountMenu.js";
5
+ import { AccountMenu as w } from "../Account/AccountMenu.js";
6
6
  import "../RootProvider/RootProvider.js";
7
- import { CurrentAccount as D } from "./CurrentAccount.js";
8
- import { BackButton as J } from "./BackButton.js";
9
- import { LogoutButton as B } from "./LogoutButton.js";
10
- import { EndUserLabel as F } from "./EndUserLabel.js";
7
+ import { CurrentAccount as z } from "./CurrentAccount.js";
8
+ import { BackButton as D } from "./BackButton.js";
9
+ import { LogoutButton as j } from "./LogoutButton.js";
10
+ import { EndUserLabel as B } from "./EndUserLabel.js";
11
11
  import { MenuListItem as f } from "../Menu/MenuBase.js";
12
- import { Menu as M } from "../Menu/Menu.js";
12
+ import { Menu as F } from "../Menu/Menu.js";
13
13
  import "../Snackbar/useSnackbar.js";
14
- import { GlobalMenuBase as k, GlobalMenuHeader as K, GlobalMenuFooter as T } from "./GlobalMenuBase.js";
15
- const n = ({
16
- accountMenu: p,
17
- items: v = [],
18
- groups: g,
19
- backLabel: H = "Back",
14
+ import { GlobalMenuBase as e, GlobalMenuHeader as J, GlobalMenuFooter as M } from "./GlobalMenuBase.js";
15
+ const E = ({
16
+ accountMenu: s,
17
+ menu: l,
18
+ backLabel: T = "Back",
20
19
  currentAccount: d,
21
- currentEndUserLabel: e = "Signed in",
22
- onSelectAccount: h,
20
+ currentEndUserLabel: h = "Signed in",
21
+ onSelectAccount: o,
23
22
  onClose: a,
24
23
  logoutButton: t,
25
- ariaLabel: s = "Menu"
24
+ ariaLabel: k = "Menu"
26
25
  }) => {
27
26
  var x;
28
- const [S, W] = q(!1), o = () => {
29
- W((i) => !i);
30
- }, b = (i) => {
31
- o(), a == null || a(), h == null || h(i);
32
- }, G = w(() => v.map((i) => ({
27
+ const [H, S] = b(!1), g = () => {
28
+ S((i) => !i);
29
+ }, W = (i) => {
30
+ g(), a == null || a(), o == null || o(i);
31
+ }, G = q(() => ((l == null ? void 0 : l.items) ?? []).map((i) => ({
33
32
  ...i,
34
33
  onClick: () => {
35
- var l;
36
- (l = i.onClick) == null || l.call(i), a == null || a();
34
+ var m;
35
+ (m = i.onClick) == null || m.call(i), a == null || a();
37
36
  },
38
- items: Array.isArray(i.items) ? i.items.map((l) => ({
39
- ...l,
37
+ items: Array.isArray(i.items) ? i.items.map((m) => ({
38
+ ...m,
40
39
  onClick: () => {
41
40
  var y;
42
- (y = l.onClick) == null || y.call(l), a == null || a();
41
+ (y = m.onClick) == null || y.call(m), a == null || a();
43
42
  }
44
43
  })) : void 0
45
- })), [v, a]);
46
- if (S)
47
- return /* @__PURE__ */ m(k, { "aria-label": s, children: [
48
- /* @__PURE__ */ r(K, { children: /* @__PURE__ */ r(J, { onClick: o, label: H }) }),
44
+ })), [l, a]);
45
+ if (H)
46
+ return /* @__PURE__ */ p(e, { "aria-label": k, children: [
47
+ /* @__PURE__ */ r(J, { children: /* @__PURE__ */ r(D, { onClick: g, label: T }) }),
49
48
  /* @__PURE__ */ r(f, { as: "div", role: "separator" }),
50
- p && /* @__PURE__ */ r(z, { ...p, currentAccount: d, onSelectAccount: b })
49
+ s && /* @__PURE__ */ r(w, { ...s, currentAccount: d, onSelectAccount: W })
51
50
  ] });
52
51
  if (d) {
53
- const i = p && ((x = p == null ? void 0 : p.items) == null ? void 0 : x.length) > 1;
54
- return /* @__PURE__ */ m(k, { "aria-label": s, color: d == null ? void 0 : d.type, children: [
55
- /* @__PURE__ */ r(
56
- D,
57
- {
58
- account: d,
59
- multipleAccounts: i,
60
- as: i ? "button" : "div",
61
- onClick: i ? o : void 0
62
- }
63
- ),
64
- /* @__PURE__ */ r(f, { as: "div", role: "separator" }),
65
- /* @__PURE__ */ r(M, { groups: g, items: G, theme: "default" }),
66
- t && /* @__PURE__ */ m(j, { children: [
52
+ const i = s && ((x = s == null ? void 0 : s.items) == null ? void 0 : x.length) > 1;
53
+ return /* @__PURE__ */ p(e, { "aria-label": k, color: d == null ? void 0 : d.type, children: [
54
+ d && /* @__PURE__ */ p(v, { children: [
55
+ /* @__PURE__ */ r(
56
+ z,
57
+ {
58
+ account: d,
59
+ multipleAccounts: i,
60
+ as: i ? "button" : "div",
61
+ onClick: i ? g : void 0
62
+ }
63
+ ),
64
+ /* @__PURE__ */ r(f, { as: "div", role: "separator" })
65
+ ] }),
66
+ l && /* @__PURE__ */ r(F, { ...l, items: G }),
67
+ t && /* @__PURE__ */ p(v, { children: [
67
68
  /* @__PURE__ */ r(f, { as: "div", role: "separator" }),
68
- /* @__PURE__ */ m(T, { children: [
69
- e && /* @__PURE__ */ r(F, { children: e }),
70
- /* @__PURE__ */ r(B, { ...t })
69
+ /* @__PURE__ */ p(M, { children: [
70
+ h && /* @__PURE__ */ r(B, { children: h }),
71
+ /* @__PURE__ */ r(j, { ...t })
71
72
  ] })
72
73
  ] })
73
74
  ] });
74
75
  }
75
- return /* @__PURE__ */ m(k, { "aria-label": s, children: [
76
- /* @__PURE__ */ r(M, { groups: g, items: G }),
77
- t && /* @__PURE__ */ m(j, { children: [
76
+ return /* @__PURE__ */ p(e, { "aria-label": k, children: [
77
+ l && /* @__PURE__ */ r(F, { ...l, items: G }),
78
+ t && /* @__PURE__ */ p(v, { children: [
78
79
  /* @__PURE__ */ r(f, { as: "div", role: "separator" }),
79
- /* @__PURE__ */ m(T, { children: [
80
- e && /* @__PURE__ */ r(F, { children: e }),
81
- /* @__PURE__ */ r(B, { ...t })
80
+ /* @__PURE__ */ p(M, { children: [
81
+ h && /* @__PURE__ */ r(B, { children: h }),
82
+ /* @__PURE__ */ r(j, { ...t })
82
83
  ] })
83
84
  ] })
84
85
  ] });
85
86
  };
86
87
  export {
87
- n as GlobalMenu
88
+ E as GlobalMenu
88
89
  };
@@ -1,73 +1,98 @@
1
1
  "use client";
2
- import { jsxs as l, jsx as e } from "react/jsx-runtime";
3
- import { DropdownBase as C } from "../Dropdown/DropdownBase.js";
2
+ import { jsxs as n, jsx as o } from "react/jsx-runtime";
4
3
  import "../../index-L8X2o7IH.js";
5
- import { DrawerBase as b } from "../Dropdown/DrawerBase.js";
6
4
  import "react";
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";
14
- import "../Snackbar/useSnackbar.js";
15
- import { HeaderGroup as D } from "./HeaderGroup.js";
5
+ import { useRootContext as k } from "../RootProvider/RootProvider.js";
6
+ import { DropdownBase as B } from "../Dropdown/DropdownBase.js";
7
+ import { DrawerBase as D } from "../Dropdown/DrawerBase.js";
8
+ import { GlobalMenu as f } from "../GlobalMenu/GlobalMenu.js";
9
+ import { GlobalMenuButton as I } from "../GlobalMenu/GlobalMenuButton.js";
10
+ import { HeaderBase as N } from "./HeaderBase.js";
11
+ import { HeaderLogo as u } from "./HeaderLogo.js";
12
+ import { HeaderGroup as F } from "./HeaderGroup.js";
16
13
  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 = () => {
24
- _("search");
25
- }, c = () => {
26
- p("search");
27
- }, g = () => {
28
- p("menu");
29
- }, m = I();
30
- return /* @__PURE__ */ l(
31
- S,
14
+ import { LocaleSwitcher as G } from "./LocaleSwitcher.js";
15
+ import { Searchbar as x } from "../Searchbar/Searchbar.js";
16
+ import "../Snackbar/useSnackbar.js";
17
+ import { useIsDesktop as L } from "../../hooks/useIsDesktop.js";
18
+ import '../../assets/Header.css';const j = "_drawer_1tael_1", y = "_dropdown_1tael_6", R = "_relative_1tael_20", t = {
19
+ drawer: j,
20
+ dropdown: y,
21
+ relative: R
22
+ }, A = ({
23
+ globalMenu: e,
24
+ desktopMenu: _,
25
+ mobileMenu: C,
26
+ locale: p,
27
+ search: s,
28
+ currentAccount: m,
29
+ logo: l = {},
30
+ badge: v
31
+ }) => {
32
+ const { currentId: r, toggleId: i, openId: H, closeAll: d } = k(), c = () => {
33
+ H("search");
34
+ }, a = () => {
35
+ i("search");
36
+ }, S = () => {
37
+ i("menu");
38
+ }, h = L();
39
+ return /* @__PURE__ */ n(
40
+ N,
32
41
  {
33
- currentId: o,
34
- open: o === "search" || o === "menu" || o === "locale",
35
- onClose: n,
42
+ currentId: r,
43
+ open: r === "search" || r === "menu" || r === "locale",
44
+ onClose: d,
36
45
  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: [
42
- /* @__PURE__ */ e(
43
- H,
46
+ /* @__PURE__ */ o(u, { ...l, className: t.logo }),
47
+ s && h && /* @__PURE__ */ o(w, { expanded: r === "search", children: /* @__PURE__ */ o(x, { ...s, expanded: r === "search", onClose: a, onFocus: c }) }),
48
+ /* @__PURE__ */ n(F, { children: [
49
+ p && /* @__PURE__ */ o(G, { ...p }),
50
+ /* @__PURE__ */ n("div", { className: t.relative, children: [
51
+ /* @__PURE__ */ o(
52
+ I,
44
53
  {
45
- badge: x,
46
- currentAccount: t,
47
- onClick: g,
48
- expanded: o === "menu",
49
- label: r == null ? void 0 : r.menuLabel
54
+ badge: v,
55
+ currentAccount: m,
56
+ onClick: S,
57
+ expanded: r === "menu",
58
+ label: e == null ? void 0 : e.menuLabel
50
59
  }
51
60
  ),
52
- r && /* @__PURE__ */ e(
53
- C,
61
+ e && /* @__PURE__ */ o(
62
+ B,
54
63
  {
55
64
  layout: "desktop",
56
65
  padding: !0,
57
66
  placement: "right",
58
- open: o === "menu",
59
- className: s.dropdown,
60
- children: /* @__PURE__ */ e(h, { ...r, currentAccount: t, onClose: n })
67
+ open: r === "menu",
68
+ className: t.dropdown,
69
+ children: /* @__PURE__ */ o(
70
+ f,
71
+ {
72
+ ...e,
73
+ menu: _ || (e == null ? void 0 : e.menu),
74
+ currentAccount: m,
75
+ onClose: d
76
+ }
77
+ )
61
78
  }
62
79
  )
63
80
  ] })
64
81
  ] }),
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
+ s && !h && /* @__PURE__ */ o(w, { expanded: r === "search", children: /* @__PURE__ */ o(x, { ...s, expanded: r === "search", onClose: a, onFocus: c }) }),
83
+ e && /* @__PURE__ */ o(D, { open: r === "menu", className: t.drawer, children: /* @__PURE__ */ o(
84
+ f,
85
+ {
86
+ ...e,
87
+ menu: C || (e == null ? void 0 : e.menu),
88
+ currentAccount: m,
89
+ onClose: d
90
+ }
91
+ ) })
67
92
  ]
68
93
  }
69
94
  );
70
95
  };
71
96
  export {
72
- W as Header
97
+ A as Header
73
98
  };
@@ -1,14 +1,18 @@
1
- import { Header as r } from "./Header.js";
1
+ import { Header as o } from "./Header.js";
2
2
  import { HeaderBase as a } from "./HeaderBase.js";
3
- import { HeaderLogo as m } from "./HeaderLogo.js";
3
+ import { HeaderLogo as f } from "./HeaderLogo.js";
4
4
  import { HeaderButton as x } from "./HeaderButton.js";
5
- import { LocaleButton as H } from "./LocaleButton.js";
6
- import { LocaleSwitcher as B } from "./LocaleSwitcher.js";
5
+ import { HeaderGroup as H } from "./HeaderGroup.js";
6
+ import { HeaderSearch as u } from "./HeaderSearch.js";
7
+ import { LocaleButton as L } from "./LocaleButton.js";
8
+ import { LocaleSwitcher as l } from "./LocaleSwitcher.js";
7
9
  export {
8
- r as Header,
10
+ o as Header,
9
11
  a as HeaderBase,
10
12
  x as HeaderButton,
11
- m as HeaderLogo,
12
- H as LocaleButton,
13
- B as LocaleSwitcher
13
+ H as HeaderGroup,
14
+ f as HeaderLogo,
15
+ u as HeaderSearch,
16
+ L as LocaleButton,
17
+ l as LocaleSwitcher
14
18
  };