@altinn/altinn-components 0.6.8 → 0.6.10

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 (33) hide show
  1. package/dist/assets/AvatarGroup.css +1 -1
  2. package/dist/assets/ButtonBase.css +1 -1
  3. package/dist/assets/DialogListItemBase.css +1 -1
  4. package/dist/assets/FooterBase.css +1 -1
  5. package/dist/assets/GlobalMenuBase.css +1 -1
  6. package/dist/assets/MenuItemBase.css +1 -1
  7. package/dist/assets/MenuOption.css +1 -1
  8. package/dist/components/Avatar/AvatarGroup.js +21 -21
  9. package/dist/components/Button/ButtonBase.js +7 -7
  10. package/dist/components/ContextMenu/ContextMenu.d.ts +3 -1
  11. package/dist/components/ContextMenu/ContextMenu.js +13 -7
  12. package/dist/components/ContextMenu/ContextMenuBase.d.ts +3 -1
  13. package/dist/components/ContextMenu/ContextMenuBase.js +19 -18
  14. package/dist/components/Dialog/Dialog.d.ts +1 -1
  15. package/dist/components/Dialog/Dialog.js +41 -50
  16. package/dist/components/Dialog/Dialog.stories.js +150 -192
  17. package/dist/components/Dialog/DialogFooter.d.ts +2 -1
  18. package/dist/components/Dialog/DialogListItem.stories.js +110 -131
  19. package/dist/components/Dialog/DialogListItemBase.js +5 -5
  20. package/dist/components/Dialog/DialogNav.js +20 -20
  21. package/dist/components/Footer/FooterBase.js +5 -5
  22. package/dist/components/Footer/FooterMenu.js +9 -13
  23. package/dist/components/GlobalMenu/AccountMenu.js +13 -5
  24. package/dist/components/GlobalMenu/GlobalMenu.js +46 -40
  25. package/dist/components/GlobalMenu/GlobalMenu.stories.js +16 -5
  26. package/dist/components/GlobalMenu/GlobalMenuBase.d.ts +8 -2
  27. package/dist/components/GlobalMenu/GlobalMenuBase.js +9 -10
  28. package/dist/components/Menu/MenuItem.stories.js +2 -2
  29. package/dist/components/Menu/MenuItemBase.js +22 -22
  30. package/dist/components/Menu/MenuItemMedia.js +1 -3
  31. package/dist/components/Menu/MenuOption.js +20 -20
  32. package/dist/components/Toolbar/Toolbar.stories.js +14 -7
  33. package/package.json +1 -1
@@ -1,14 +1,14 @@
1
- import { jsx as s, jsxs as n } from "react/jsx-runtime";
2
- import { useState as f, Fragment as o } from "react";
3
- import { DialogListItem as l } from "./DialogListItem.js";
4
- import { DialogStatusEnum as b } from "./DialogStatus.js";
1
+ import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
+ import { Fragment as u, useState as y } from "react";
3
+ import { DialogListItem as r } from "./DialogListItem.js";
4
+ import { DialogStatusEnum as g } from "./DialogStatus.js";
5
5
  import "../../index-L8X2o7IH.js";
6
6
  import "../Icon/SvgIcon.js";
7
- import { MetaItem as u } from "../Meta/MetaItem.js";
7
+ import { MetaItem as i } from "../Meta/MetaItem.js";
8
8
  import "../RootProvider/RootProvider.js";
9
- import { ListBase as d } from "../List/ListBase.js";
10
- const y = (r) => {
11
- switch (r) {
9
+ import { ListBase as s } from "../List/ListBase.js";
10
+ const f = (t) => {
11
+ switch (t) {
12
12
  case "draft":
13
13
  return "Utkast";
14
14
  case "sent":
@@ -22,16 +22,18 @@ const y = (r) => {
22
22
  default:
23
23
  return "";
24
24
  }
25
- }, i = ["lg", "md", "sm", "xs"];
26
- var g;
27
- const c = (g = Object.keys(b)) == null ? void 0 : g.map((r) => ({
28
- value: r,
29
- label: y(r)
30
- })), T = {
25
+ }, d = ["lg", "md", "sm", "xs"];
26
+ var p;
27
+ const o = (p = Object.keys(g)) == null ? void 0 : p.map((t) => ({
28
+ value: t,
29
+ label: f(t)
30
+ })), I = {
31
31
  title: "Dialog/DialogListItem",
32
- component: l,
32
+ component: r,
33
33
  tags: ["autodocs"],
34
- parameters: {},
34
+ parameters: {
35
+ theme: "company"
36
+ },
35
37
  argTypes: {},
36
38
  args: {
37
39
  title: "Title",
@@ -44,87 +46,74 @@ const c = (g = Object.keys(b)) == null ? void 0 : g.map((r) => ({
44
46
  type: "person",
45
47
  name: "Recipient name"
46
48
  },
47
- status: {
48
- value: "completed"
49
- }
50
- }
51
- }, j = {
52
- args: {
53
- select: {
54
- checked: !1
55
- }
49
+ updatedAt: "2024-11-25 15:30",
50
+ updatedAtLabel: "25. november 2024 kl 15.30",
51
+ status: {}
56
52
  }
57
- }, q = {
58
- args: {
59
- selected: !0,
60
- select: {
61
- checked: !0
62
- }
63
- }
64
- }, x = {
65
- args: {
66
- seenByEndUser: !0
67
- }
68
- }, A = {
69
- args: {
70
- touchedBy: [
71
- {
72
- name: "Lars"
73
- },
74
- {
75
- name: "Trine"
76
- }
77
- ]
78
- }
79
- }, E = {
80
- args: {
81
- status: {
82
- value: "draft"
53
+ }, O = (t) => /* @__PURE__ */ e(s, { children: o == null ? void 0 : o.map((a) => /* @__PURE__ */ l(u, { children: [
54
+ /* @__PURE__ */ e(r, { ...t, status: a }),
55
+ /* @__PURE__ */ e(i, { children: a == null ? void 0 : a.value })
56
+ ] }, a == null ? void 0 : a.value)) }), j = (t) => /* @__PURE__ */ l(s, { children: [
57
+ /* @__PURE__ */ e(
58
+ r,
59
+ {
60
+ ...t,
61
+ status: { label: "Krever handling", value: "requires-attention" },
62
+ dueAt: "2025-01-01",
63
+ dueAtLabel: "Frist: 1. januar 2025"
83
64
  }
84
- }
85
- }, M = {
86
- args: {
87
- status: {
88
- value: "sent"
65
+ ),
66
+ /* @__PURE__ */ e(i, { children: "Dialog requires action wihtin a spesific due date." })
67
+ ] }), x = (t) => /* @__PURE__ */ l(s, { children: [
68
+ /* @__PURE__ */ e(r, { ...t, attachmentsCount: 2 }),
69
+ /* @__PURE__ */ e(i, { children: "Dialog has attachments." })
70
+ ] }), K = (t) => /* @__PURE__ */ l(s, { children: [
71
+ /* @__PURE__ */ e(r, { ...t, seen: !0, seenBy: { seenByEndUser: !0, label: "Sett av deg" } }),
72
+ /* @__PURE__ */ e(i, { children: "Seen by end user. Dialog is marked as seen." }),
73
+ /* @__PURE__ */ e(r, { ...t, seenBy: { seenByOthersCount: 4, label: "Sett av 4" } }),
74
+ /* @__PURE__ */ e(i, { children: "Seen by others. Dialog is not marked as seen." }),
75
+ /* @__PURE__ */ e(
76
+ r,
77
+ {
78
+ ...t,
79
+ seen: !0,
80
+ seenBy: { seenByOthersCount: 4, seenByEndUser: !0, label: "Sett av deg + 4" }
89
81
  }
90
- }
91
- }, U = {
92
- args: {
93
- status: {
94
- value: "requires-attention"
82
+ ),
83
+ /* @__PURE__ */ e(i, { children: "Seen by end user and others. Dialog is marked as seen." })
84
+ ] }), q = (t) => /* @__PURE__ */ l(s, { children: [
85
+ /* @__PURE__ */ e(r, { ...t, touchedBy: [{ name: "Kari Nordmann" }] }),
86
+ /* @__PURE__ */ e(i, { children: "Dialog has been touched by a single actor." }),
87
+ /* @__PURE__ */ e(r, { ...t, touchedBy: [{ name: "Kari Nordmann" }, { name: "Ola Nordmann" }] }),
88
+ /* @__PURE__ */ e(i, { children: "Dialog has been touched by two actors." }),
89
+ /* @__PURE__ */ e(
90
+ r,
91
+ {
92
+ ...t,
93
+ touchedBy: [{ name: "Kari Nordmann" }, { name: "Ola Nordmann" }, { name: "Per Nordmann" }]
95
94
  }
96
- }
97
- }, w = {
98
- args: {
99
- status: {
100
- value: "in-progress"
95
+ ),
96
+ /* @__PURE__ */ e(i, { children: "Dialog has been touched by a multiple actors." })
97
+ ] }), E = (t) => /* @__PURE__ */ l(s, { children: [
98
+ /* @__PURE__ */ e(
99
+ r,
100
+ {
101
+ ...t,
102
+ title: "Cras mattis consectetur purus sit amet fermentum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum. Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam id dolor id nibh ultricies vehicula ut id elit."
101
103
  }
102
- }
103
- }, O = {
104
- args: {
105
- status: {
106
- value: "completed"
104
+ ),
105
+ /* @__PURE__ */ e(i, { children: "Long title" }),
106
+ /* @__PURE__ */ e(
107
+ r,
108
+ {
109
+ ...t,
110
+ summary: "Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Maecenas faucibus mollis interdum. Nullam id dolor id nibh ultricies vehicula ut id elit.\\n\\nCras mattis consectetur purus sit amet fermentum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum. Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam id dolor id nibh ultricies vehicula ut id elit."
107
111
  }
108
- }
109
- }, P = {
110
- args: {
111
- grouped: !0
112
- }
113
- }, R = {
114
- args: {
115
- title: "Long summary",
116
- summary: `Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Etiam porta sem malesuada magna mollis euismod. Maecenas faucibus mollis interdum. Nullam id dolor id nibh ultricies vehicula ut id elit.
117
-
118
- Cras mattis consectetur purus sit amet fermentum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum. Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam id dolor id nibh ultricies vehicula ut id elit.`
119
- }
120
- }, F = {
121
- args: {
122
- title: "Cras mattis consectetur purus sit amet fermentum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum. Nullam id dolor id nibh ultricies vehicula ut id elit. Nullam id dolor id nibh ultricies vehicula ut id elit.",
123
- summary: "Short summary."
124
- }
125
- }, G = (r) => {
126
- var p;
127
- const [t, h] = f({
112
+ ),
113
+ /* @__PURE__ */ e(i, { children: "Long summary" })
114
+ ] }), M = (t) => {
115
+ var h;
116
+ const [a, b] = y({
128
117
  1: {
129
118
  id: "1",
130
119
  title: "Item 1",
@@ -140,53 +129,43 @@ Cras mattis consectetur purus sit amet fermentum. Lorem ipsum dolor sit amet, co
140
129
  title: "Item 2",
141
130
  selected: !1
142
131
  }
143
- }), m = ({ id: e }) => {
144
- h((a) => ({
145
- ...a,
146
- [e]: {
147
- ...a[e],
148
- selected: !a[e].selected
132
+ }), m = ({ id: n }) => {
133
+ b((c) => ({
134
+ ...c,
135
+ [n]: {
136
+ ...c[n],
137
+ selected: !c[n].selected
149
138
  }
150
139
  }));
151
140
  };
152
- return /* @__PURE__ */ s(d, { children: (p = Object.values(t)) == null ? void 0 : p.map((e) => /* @__PURE__ */ n(o, { children: [
153
- /* @__PURE__ */ s(
154
- l,
141
+ return /* @__PURE__ */ e(s, { children: (h = Object.values(a)) == null ? void 0 : h.map((n) => /* @__PURE__ */ l(u, { children: [
142
+ /* @__PURE__ */ e(
143
+ r,
155
144
  {
156
- ...r,
157
- title: e.title,
158
- onClick: e.selected ? () => m(e) : null,
159
- selected: e.selected,
160
- select: { checked: e == null ? void 0 : e.selected, onChange: () => m(e) }
145
+ ...t,
146
+ title: n.title,
147
+ onClick: n.selected ? () => m(n) : null,
148
+ selected: n.selected,
149
+ select: { checked: n == null ? void 0 : n.selected, onChange: () => m(n) }
161
150
  }
162
151
  ),
163
- /* @__PURE__ */ n(u, { children: [
152
+ /* @__PURE__ */ l(i, { children: [
164
153
  "selected:",
165
- e.selected ? "true" : "false"
154
+ n.selected ? "true" : "false"
166
155
  ] })
167
- ] }, e == null ? void 0 : e.id)) });
168
- }, K = (r) => /* @__PURE__ */ s(d, { children: c == null ? void 0 : c.map((t) => /* @__PURE__ */ n(o, { children: [
169
- /* @__PURE__ */ s(l, { ...r, status: t }),
170
- /* @__PURE__ */ s(u, { children: t == null ? void 0 : t.value })
171
- ] }, t == null ? void 0 : t.value)) }), V = (r) => /* @__PURE__ */ s(d, { children: i == null ? void 0 : i.map((t) => /* @__PURE__ */ n(o, { children: [
172
- /* @__PURE__ */ s(l, { ...r, size: t }),
173
- /* @__PURE__ */ s(u, { children: t })
174
- ] }, t)) });
156
+ ] }, n == null ? void 0 : n.id)) });
157
+ }, T = (t) => /* @__PURE__ */ e(s, { children: d == null ? void 0 : d.map((a) => /* @__PURE__ */ l(u, { children: [
158
+ /* @__PURE__ */ e(r, { ...t, size: a }),
159
+ /* @__PURE__ */ e(i, { children: a })
160
+ ] }, a)) });
175
161
  export {
176
- O as Completed,
177
- E as Draft,
178
- P as GroupedView,
179
- w as InProgress,
180
- R as LongSummary,
181
- F as LongTitle,
182
- U as RequiresAttention,
183
- G as SelectableSelected,
184
- M as Sent,
185
- V as Sizes,
186
- K as Statuses,
187
- A as TouchedBy,
188
- T as default,
189
- x as seenByEndUser,
190
- j as selectable,
191
- q as selected
162
+ x as Attachments,
163
+ j as DueAt,
164
+ K as SeenBy,
165
+ M as Selectable,
166
+ T as Sizes,
167
+ O as Statuses,
168
+ E as TextLength,
169
+ q as TouchedBy,
170
+ I as default
192
171
  };
@@ -1,10 +1,10 @@
1
1
  import { jsxs as r, jsx as a } from "react/jsx-runtime";
2
2
  import { DialogSelect as _ } from "./DialogSelect.js";
3
- import '../../assets/DialogListItemBase.css';const d = "_item_1ate4_1", k = "_link_1ate4_13", p = "_select_1ate4_23", t = {
3
+ import '../../assets/DialogListItemBase.css';const d = "_item_1uvy5_1", u = "_link_1uvy5_13", k = "_select_1uvy5_46", t = {
4
4
  item: d,
5
- link: k,
6
- select: p
7
- }, b = ({
5
+ link: u,
6
+ select: k
7
+ }, y = ({
8
8
  as: i = "a",
9
9
  size: e,
10
10
  href: l,
@@ -20,5 +20,5 @@ import '../../assets/DialogListItemBase.css';const d = "_item_1ate4_1", k = "_li
20
20
  ] });
21
21
  };
22
22
  export {
23
- b as DialogListItemBase
23
+ y as DialogListItemBase
24
24
  };
@@ -1,34 +1,34 @@
1
1
  "use client";
2
- import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
+ import { jsxs as t, jsx as o } from "react/jsx-runtime";
3
3
  import "../../index-L8X2o7IH.js";
4
4
  import "../Icon/SvgIcon.js";
5
- import { Button as l } from "../Button/Button.js";
6
- import { ContextMenu as c } from "../ContextMenu/ContextMenu.js";
5
+ import { Button as c } from "../Button/Button.js";
6
+ import { ContextMenu as l } from "../ContextMenu/ContextMenu.js";
7
7
  import { MetaTimestamp as p } from "../Meta/MetaTimestamp.js";
8
8
  import { DialogStatus as v } from "./DialogStatus.js";
9
- import { DialogTouchedBy as f } from "./DialogTouchedBy.js";
10
- import '../../assets/DialogNav.css';const x = "_nav_678a5_1", _ = "_action_678a5_8", m = {
11
- nav: x,
12
- action: _
13
- }, T = ({
14
- backButton: o = {
9
+ import { DialogTouchedBy as d } from "./DialogTouchedBy.js";
10
+ import '../../assets/DialogNav.css';const f = "_nav_678a5_1", x = "_action_678a5_8", m = {
11
+ nav: f,
12
+ action: x
13
+ }, M = ({
14
+ backButton: r = {
15
15
  as: "a",
16
16
  label: "Back"
17
17
  },
18
- status: a,
19
- dueAt: i,
18
+ status: i,
19
+ dueAt: a,
20
20
  dueAtLabel: e,
21
- touchedBy: t,
21
+ touchedBy: s,
22
22
  menu: n
23
- }) => /* @__PURE__ */ s("nav", { className: m.nav, children: [
24
- /* @__PURE__ */ r(l, { ...o, variant: "text", color: "secondary", icon: "arrow-left", reverse: !0, children: (o == null ? void 0 : o.label) || "Back" }),
25
- /* @__PURE__ */ s("div", { className: m.action, children: [
26
- i && e && /* @__PURE__ */ r(p, { datetime: i, size: "xs", children: e }),
27
- a && /* @__PURE__ */ r(v, { ...a }),
28
- t && /* @__PURE__ */ r(f, { touchedBy: t }),
29
- n && /* @__PURE__ */ r(c, { ...n })
23
+ }) => /* @__PURE__ */ t("nav", { className: m.nav, children: [
24
+ /* @__PURE__ */ o(c, { ...r, variant: "text", color: "secondary", icon: "arrow-left", reverse: !0, children: (r == null ? void 0 : r.label) || "Back" }),
25
+ /* @__PURE__ */ t("div", { className: m.action, children: [
26
+ a && e && /* @__PURE__ */ o(p, { datetime: a, icon: "clock-dashed", size: "xs", children: e }),
27
+ i && /* @__PURE__ */ o(v, { ...i }),
28
+ s && /* @__PURE__ */ o(d, { touchedBy: s }),
29
+ n && /* @__PURE__ */ o(l, { ...n, size: "md" })
30
30
  ] })
31
31
  ] });
32
32
  export {
33
- T as DialogNav
33
+ M as DialogNav
34
34
  };
@@ -1,12 +1,12 @@
1
1
  import { jsx as t, jsxs as e } from "react/jsx-runtime";
2
2
  import { c } from "../../index-L8X2o7IH.js";
3
- import '../../assets/FooterBase.css';const i = "_footer_z2xgm_1", m = "_grid_z2xgm_13", o = {
4
- footer: i,
5
- grid: m
6
- }, n = ({ className: r, children: s }) => /* @__PURE__ */ t("footer", { className: c(o.footer, r), children: /* @__PURE__ */ e("div", { className: o.grid, children: [
3
+ import '../../assets/FooterBase.css';const d = "_footer_1d8fg_1", f = "_grid_1d8fg_14", o = {
4
+ footer: d,
5
+ grid: f
6
+ }, a = ({ className: r, children: s }) => /* @__PURE__ */ t("footer", { className: c(o.footer, r), children: /* @__PURE__ */ e("div", { className: o.grid, children: [
7
7
  s,
8
8
  " "
9
9
  ] }) });
10
10
  export {
11
- n as FooterBase
11
+ a as FooterBase
12
12
  };
@@ -1,16 +1,12 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
- import { c as s } from "../../index-L8X2o7IH.js";
3
- import "../Icon/SvgIcon.js";
4
- import "react";
5
- import "../RootProvider/RootProvider.js";
6
- import { MenuBase as m } from "../Menu/MenuBase.js";
7
- import '../../assets/FooterMenu.css';const l = "_menu_3o631_1", c = "_list_3o631_7", _ = "_item_3o631_28", a = "_link_3o631_32", i = {
8
- menu: l,
9
- list: c,
10
- item: _,
11
- link: a
12
- }, p = ({ as: t, className: e, title: o, ...r }) => /* @__PURE__ */ n(t || "a", { className: s(i.link, e), ...r, children: o }), C = ({ className: t, items: e = [] }) => /* @__PURE__ */ n(m, { className: s(i.menu, t), children: /* @__PURE__ */ n("ul", { className: i.list, children: e.map((o) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(p, { ...o }) }, o.id)) }) });
2
+ import { c as i } from "../../index-L8X2o7IH.js";
3
+ import '../../assets/FooterMenu.css';const c = "_menu_3o631_1", r = "_list_3o631_7", m = "_item_3o631_28", _ = "_link_3o631_32", s = {
4
+ menu: c,
5
+ list: r,
6
+ item: m,
7
+ link: _
8
+ }, a = ({ as: t, className: e, title: o, ...l }) => /* @__PURE__ */ n(t || "a", { className: i(s.link, e), ...l, children: o }), k = ({ className: t, items: e = [] }) => /* @__PURE__ */ n("nav", { className: i(s.menu, t), children: /* @__PURE__ */ n("ul", { className: s.list, children: e.map((o) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n(a, { ...o }) }, o.id)) }) });
13
9
  export {
14
- p as FooterLink,
15
- C as FooterMenu
10
+ a as FooterLink,
11
+ k as FooterMenu
16
12
  };
@@ -5,7 +5,7 @@ import "../../index-L8X2o7IH.js";
5
5
  import "../Icon/SvgIcon.js";
6
6
  import "../RootProvider/RootProvider.js";
7
7
  import { Menu as b } from "../Menu/Menu.js";
8
- const v = (r) => `${r} hits`, R = ({
8
+ const v = (r) => `${r} hits`, k = ({
9
9
  accounts: r = [],
10
10
  accountGroups: f = {},
11
11
  accountSearch: s,
@@ -29,11 +29,11 @@ const v = (r) => `${r} hits`, R = ({
29
29
  }).map((e) => ({
30
30
  ...e,
31
31
  groupId: "search"
32
- })) : p, h = i ? {
32
+ })) : p, I = i ? {
33
33
  search: {
34
34
  title: ((m = s == null ? void 0 : s.getResultsLabel) == null ? void 0 : m.call(s, l.length)) ?? v(l.length)
35
35
  }
36
- } : f, I = {
36
+ } : f, h = {
37
37
  name: "account-search",
38
38
  value: i,
39
39
  placeholder: (s == null ? void 0 : s.placeholder) ?? "Find account",
@@ -41,8 +41,16 @@ const v = (r) => `${r} hits`, R = ({
41
41
  }, C = [
42
42
  ...l.length > 0 ? l : [{ id: "search", groupId: "search", hidden: !0 }]
43
43
  ];
44
- return /* @__PURE__ */ L(b, { theme: "global", search: I, groups: h, items: C });
44
+ return /* @__PURE__ */ L(
45
+ b,
46
+ {
47
+ theme: "global",
48
+ search: s && h,
49
+ groups: I,
50
+ items: C
51
+ }
52
+ );
45
53
  };
46
54
  export {
47
- R as AccountMenu
55
+ k as AccountMenu
48
56
  };
@@ -1,58 +1,64 @@
1
1
  "use client";
2
- import { jsxs as u, jsx as o } from "react/jsx-runtime";
3
- import { useState as k } from "react";
2
+ import { jsxs as n, jsx as o, Fragment as x } from "react/jsx-runtime";
3
+ import { useState as G } from "react";
4
4
  import "../../index-L8X2o7IH.js";
5
5
  import "../Icon/SvgIcon.js";
6
6
  import "../RootProvider/RootProvider.js";
7
- import { AccountMenu as B } from "./AccountMenu.js";
8
- import { Menu as p } from "../Menu/Menu.js";
9
- import { AccountButton as x } from "./AccountButton.js";
10
- import { BackButton as G } from "./BackButton.js";
11
- import { GlobalMenuBase as i, GlobalMenuHeader as C, GlobalMenuFooter as j } from "./GlobalMenuBase.js";
12
- import { LogoutButton as A } from "./LogoutButton.js";
13
- const I = ({
14
- accounts: l = [],
15
- accountGroups: s = {},
16
- accountSearch: f,
17
- items: m = [],
7
+ import { AccountMenu as v } from "./AccountMenu.js";
8
+ import { MenuListItem as l } from "../Menu/MenuBase.js";
9
+ import { Menu as d } from "../Menu/Menu.js";
10
+ import { AccountButton as C } from "./AccountButton.js";
11
+ import { BackButton as j } from "./BackButton.js";
12
+ import { GlobalMenuBase as m, GlobalMenuHeader as f, GlobalMenuFooter as A } from "./GlobalMenuBase.js";
13
+ import { LogoutButton as F } from "./LogoutButton.js";
14
+ const N = ({
15
+ accounts: a = [],
16
+ accountGroups: h = {},
17
+ accountSearch: s,
18
+ items: p = [],
18
19
  groups: c,
19
- changeLabel: h = "Change",
20
- backLabel: d = "Back",
21
- currentAccount: t,
20
+ changeLabel: M = "Change",
21
+ backLabel: g = "Back",
22
+ currentAccount: r,
22
23
  onSelectAccount: e,
23
- logoutButton: a
24
+ logoutButton: u
24
25
  }) => {
25
- const [M, b] = k(!1), r = () => {
26
- b((n) => !n);
27
- }, g = (n) => {
28
- r(), e == null || e(n);
26
+ const [b, k] = G(!1), t = () => {
27
+ k((i) => !i);
28
+ }, B = (i) => {
29
+ t(), e == null || e(i);
29
30
  };
30
- return M ? /* @__PURE__ */ u(i, { children: [
31
- /* @__PURE__ */ o(G, { onClick: r, label: d }),
31
+ return b ? /* @__PURE__ */ n(m, { children: [
32
+ /* @__PURE__ */ o(f, { children: /* @__PURE__ */ o(j, { onClick: t, label: g }) }),
33
+ !s && /* @__PURE__ */ o(l, { as: "div", role: "separator" }),
32
34
  /* @__PURE__ */ o(
33
- B,
35
+ v,
34
36
  {
35
- currentAccount: t,
36
- accounts: l,
37
- accountGroups: s,
38
- accountSearch: f,
39
- onSelectAccount: g
37
+ currentAccount: r,
38
+ accounts: a,
39
+ accountGroups: h,
40
+ accountSearch: s,
41
+ onSelectAccount: B
40
42
  }
41
43
  )
42
- ] }) : t ? /* @__PURE__ */ u(i, { children: [
43
- /* @__PURE__ */ o(C, { children: /* @__PURE__ */ o(
44
- x,
44
+ ] }) : r ? /* @__PURE__ */ n(m, { children: [
45
+ /* @__PURE__ */ o(f, { children: /* @__PURE__ */ o(
46
+ C,
45
47
  {
46
- account: t,
47
- linkText: h,
48
- multipleAccounts: l.length > 1,
49
- onClick: r
48
+ account: r,
49
+ linkText: M,
50
+ multipleAccounts: a.length > 1,
51
+ onClick: t
50
52
  }
51
53
  ) }),
52
- /* @__PURE__ */ o(p, { groups: c, items: m }),
53
- a && /* @__PURE__ */ o(j, { children: /* @__PURE__ */ o(A, { ...a }) })
54
- ] }) : /* @__PURE__ */ o(i, { children: /* @__PURE__ */ o(p, { groups: c, items: m }) });
54
+ /* @__PURE__ */ o(l, { as: "div", role: "separator" }),
55
+ /* @__PURE__ */ o(d, { groups: c, items: p }),
56
+ u && /* @__PURE__ */ n(x, { children: [
57
+ /* @__PURE__ */ o(l, { as: "div", role: "separator" }),
58
+ /* @__PURE__ */ o(A, { children: /* @__PURE__ */ o(F, { ...u }) })
59
+ ] })
60
+ ] }) : /* @__PURE__ */ o(m, { children: /* @__PURE__ */ o(d, { groups: c, items: p }) });
55
61
  };
56
62
  export {
57
- I as GlobalMenu
63
+ N as GlobalMenu
58
64
  };
@@ -1,7 +1,7 @@
1
- import { GlobalMenu as r } from "./GlobalMenu.js";
2
- const t = {
1
+ import { GlobalMenu as t } from "./GlobalMenu.js";
2
+ const r = {
3
3
  title: "GlobalMenu/GlobalMenu",
4
- component: r,
4
+ component: t,
5
5
  tags: ["autodocs"],
6
6
  parameters: {},
7
7
  args: {
@@ -14,10 +14,14 @@ const t = {
14
14
  }
15
15
  },
16
16
  currentAccount: {
17
+ id: "party:mathias",
17
18
  type: "person",
18
19
  name: "Mathias Dyngeland",
19
20
  description: "Fødselsnr. 07101995 XXXXXX"
20
21
  },
22
+ logoutButton: {
23
+ label: "Logg ut"
24
+ },
21
25
  accounts: [
22
26
  {
23
27
  id: "party:mathias",
@@ -148,6 +152,12 @@ const t = {
148
152
  }
149
153
  }
150
154
  }, l = {
155
+ args: {
156
+ accountSearch: {
157
+ placeholder: "Finn konto"
158
+ }
159
+ }
160
+ }, s = {
151
161
  args: {
152
162
  logoutLabel: "Logg ut",
153
163
  menuLabel: "Meny",
@@ -161,9 +171,10 @@ const t = {
161
171
  }
162
172
  };
163
173
  export {
174
+ l as AccountSearch,
164
175
  i as Company,
165
- l as CustomLabels,
176
+ s as CustomLabels,
166
177
  o as Default,
167
178
  n as Login,
168
- t as default
179
+ r as default
169
180
  };
@@ -2,6 +2,12 @@ import { ReactNode } from 'react';
2
2
  export interface GlobalMenuBaseProps {
3
3
  children: ReactNode;
4
4
  }
5
+ export interface GlobalMenuHeaderProps {
6
+ children: ReactNode;
7
+ }
8
+ export interface GlobalMenuFooterProps {
9
+ children: ReactNode;
10
+ }
5
11
  export declare const GlobalMenuBase: ({ children }: GlobalMenuBaseProps) => import("react/jsx-runtime").JSX.Element;
6
- export declare const GlobalMenuHeader: ({ children }: GlobalMenuBaseProps) => import("react/jsx-runtime").JSX.Element;
7
- export declare const GlobalMenuFooter: ({ children }: GlobalMenuBaseProps) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const GlobalMenuHeader: ({ children }: GlobalMenuHeaderProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const GlobalMenuFooter: ({ children }: GlobalMenuFooterProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,13 +1,12 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import '../../assets/GlobalMenuBase.css';const a = "_nav_gzloq_1", n = "_header_gzloq_8", t = "_footer_gzloq_12", s = "_drawer_gzloq_20", l = "_dropdown_gzloq_26", r = {
3
- nav: a,
4
- header: n,
5
- footer: t,
6
- drawer: s,
7
- dropdown: l
8
- }, _ = ({ children: o }) => /* @__PURE__ */ e("nav", { className: r.nav, "data-theme": "global", children: o }), c = ({ children: o }) => /* @__PURE__ */ e("header", { className: r.header, children: o }), f = ({ children: o }) => /* @__PURE__ */ e("footer", { className: r.footer, children: o });
2
+ import '../../assets/GlobalMenuBase.css';const n = "_nav_1mnmu_1", a = "_footer_1mnmu_8", t = "_drawer_1mnmu_16", s = "_dropdown_1mnmu_22", r = {
3
+ nav: n,
4
+ footer: a,
5
+ drawer: t,
6
+ dropdown: s
7
+ }, d = ({ children: o }) => /* @__PURE__ */ e("nav", { className: r.nav, "data-theme": "global", children: o }), l = ({ children: o }) => /* @__PURE__ */ e("header", { className: r.header, children: o }), _ = ({ children: o }) => /* @__PURE__ */ e("footer", { className: r.footer, children: o });
9
8
  export {
10
- _ as GlobalMenuBase,
11
- f as GlobalMenuFooter,
12
- c as GlobalMenuHeader
9
+ d as GlobalMenuBase,
10
+ _ as GlobalMenuFooter,
11
+ l as GlobalMenuHeader
13
12
  };