@altinn/altinn-components 0.7.3 → 0.7.5

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 (78) hide show
  1. package/dist/Autocomplete-hEFuiN2u.js +287 -0
  2. package/dist/assets/Autocomplete.css +1 -0
  3. package/dist/assets/GlobalMenuBase.css +1 -1
  4. package/dist/assets/Header.css +1 -1
  5. package/dist/assets/LayoutBase.css +1 -1
  6. package/dist/components/Bookmarks/BookmarksList.js +1 -1
  7. package/dist/components/Bookmarks/BookmarksListItem.js +4 -5
  8. package/dist/components/Bookmarks/BookmarksListItem.stories.js +7 -7
  9. package/dist/components/Bookmarks/index.js +4 -4
  10. package/dist/components/Button/Buttons.stories.js +5 -4
  11. package/dist/components/ContextMenu/ContextMenu.js +4 -27
  12. package/dist/components/ContextMenu/ContextMenu.stories.js +3 -3
  13. package/dist/components/ContextMenu/ContextMenuBase.js +6 -32
  14. package/dist/components/ContextMenu/index.js +1 -1
  15. package/dist/components/Dialog/DialogActions.js +3 -2
  16. package/dist/components/Dialog/DialogGroup.js +3 -2
  17. package/dist/components/Dialog/DialogList.js +1 -1
  18. package/dist/components/Dialog/DialogListItem.js +13 -87
  19. package/dist/components/Dialog/DialogListItem.stories.js +1 -1
  20. package/dist/components/Dialog/DialogNav.js +11 -11
  21. package/dist/components/Dialog/Examples.stories.js +1 -1
  22. package/dist/components/Dialog/index.js +1 -1
  23. package/dist/components/Dropdown/DrawerButton.js +5 -4
  24. package/dist/components/Dropdown/DrawerOrDropdown.js +7 -6
  25. package/dist/components/GlobalMenu/AccountButton.js +3 -2
  26. package/dist/components/GlobalMenu/AccountMenu.d.ts +5 -2
  27. package/dist/components/GlobalMenu/AccountMenu.js +35 -26
  28. package/dist/components/GlobalMenu/AccountMenu.stories.js +19 -2
  29. package/dist/components/GlobalMenu/BackButton.js +3 -2
  30. package/dist/components/GlobalMenu/GlobalMenu.js +3 -2
  31. package/dist/components/GlobalMenu/GlobalMenu.stories.js +6 -12
  32. package/dist/components/GlobalMenu/GlobalMenuBase.js +9 -9
  33. package/dist/components/Header/Header.js +13 -13
  34. package/dist/components/Header/HeaderBase.js +5 -4
  35. package/dist/components/Layout/Layout.js +9 -8
  36. package/dist/components/Layout/Layout.stories.js +140 -49
  37. package/dist/components/Layout/LayoutBase.js +3 -3
  38. package/dist/components/LayoutAction/ActionMenu.js +5 -4
  39. package/dist/components/List/List.js +3 -3
  40. package/dist/components/List/List.stories.js +5 -4
  41. package/dist/components/List/ListItem.js +6 -39
  42. package/dist/components/List/ListItem.stories.js +1 -1
  43. package/dist/components/List/ListItemControls.js +5 -15
  44. package/dist/components/List/index.js +12 -13
  45. package/dist/components/Menu/Menu.js +9 -9
  46. package/dist/components/Menu/MenuItem.stories.js +21 -20
  47. package/dist/components/Menu/MenuItems.js +8 -59
  48. package/dist/components/Menu/MenuItems.stories.js +1 -1
  49. package/dist/components/Menu/MenuSearch.js +6 -5
  50. package/dist/components/Menu/index.js +7 -7
  51. package/dist/components/Page/PageHeader.js +8 -7
  52. package/dist/components/Searchbar/Autocomplete.d.ts +1 -2
  53. package/dist/components/Searchbar/Autocomplete.js +7 -23
  54. package/dist/components/Searchbar/Autocomplete.stories.js +1 -1
  55. package/dist/components/Searchbar/AutocompleteBase.d.ts +2 -1
  56. package/dist/components/Searchbar/AutocompleteBase.js +9 -6
  57. package/dist/components/Searchbar/AutocompleteItem.js +3 -20
  58. package/dist/components/Searchbar/ScopeListItem.d.ts +2 -2
  59. package/dist/components/Searchbar/ScopeListItem.js +3 -6
  60. package/dist/components/Searchbar/SearchField.js +39 -39
  61. package/dist/components/Searchbar/Searchbar.d.ts +1 -1
  62. package/dist/components/Searchbar/Searchbar.js +25 -17
  63. package/dist/components/Searchbar/Searchbar.stories.js +63 -47
  64. package/dist/components/Toolbar/ToolbarAdd.js +3 -2
  65. package/dist/components/Toolbar/ToolbarDaterange.js +3 -2
  66. package/dist/components/Toolbar/ToolbarFilter.js +3 -2
  67. package/dist/components/Toolbar/ToolbarMenu.js +3 -2
  68. package/dist/components/Toolbar/ToolbarOptions.js +13 -12
  69. package/dist/components/Toolbar/ToolbarSearch.js +16 -15
  70. package/dist/components/index.js +213 -218
  71. package/dist/hooks/useEnterKey.d.ts +1 -0
  72. package/dist/hooks/useEnterKey.js +15 -0
  73. package/dist/index.js +226 -231
  74. package/package.json +1 -1
  75. package/dist/assets/ContextMenuBase.css +0 -1
  76. package/dist/assets/DialogListItem.css +0 -1
  77. package/dist/assets/ListItemControls.css +0 -1
  78. package/dist/assets/ScopeListItem.css +0 -1
@@ -1,23 +1,23 @@
1
- import { jsx as n, jsxs as l } from "react/jsx-runtime";
2
- import { useState as a } from "react";
3
- import { Searchbar as o } from "./Searchbar.js";
4
- const k = {
1
+ import { jsxs as l, jsx as n } from "react/jsx-runtime";
2
+ import { useState as s } from "react";
3
+ import { Searchbar as i } from "./Searchbar.js";
4
+ const S = {
5
5
  title: "Header/Searchbar",
6
- component: o,
6
+ component: i,
7
7
  tags: ["autodocs"],
8
8
  parameters: {},
9
9
  args: {
10
10
  placeholder: "Search",
11
11
  name: "search",
12
- expanded: !1
12
+ expanded: !0
13
13
  }
14
- }, S = {
14
+ }, y = {
15
15
  args: {}
16
16
  }, x = {
17
17
  args: {
18
18
  value: "query"
19
19
  }
20
- }, I = {
20
+ }, A = {
21
21
  args: {
22
22
  placeholder: "Søk i innboks",
23
23
  expanded: !0,
@@ -29,96 +29,112 @@ const k = {
29
29
  },
30
30
  items: [
31
31
  {
32
+ type: "scope",
32
33
  id: "1a",
33
34
  groupId: "1",
34
35
  href: "#",
35
- label: "Alt i innboks"
36
+ label: "Alt i innboks",
37
+ badge: {
38
+ label: "2"
39
+ }
36
40
  },
37
41
  {
42
+ type: "scope",
38
43
  id: "1b",
39
44
  groupId: "1",
40
45
  href: "#",
41
- label: "Alt i hele Altinn"
46
+ label: "Alt i hele Altinn",
47
+ badge: {
48
+ label: "2"
49
+ }
42
50
  },
43
51
  {
52
+ type: "dialog",
44
53
  id: "2a",
45
54
  groupId: "2",
46
55
  href: "#",
47
- label: "Skattemelding 2024"
56
+ title: "Skattemelding 2024"
48
57
  },
49
58
  {
59
+ type: "dialog",
50
60
  id: "2b",
51
61
  groupId: "2",
52
62
  href: "#",
53
- label: "Skattemelding 2025"
63
+ title: "Skattemelding 2025"
54
64
  }
55
65
  ]
56
66
  }
57
67
  }
58
- }, A = (s) => {
59
- const [i, d] = a(!1), [e, c] = a(""), p = (t) => {
60
- c(t.target.value);
68
+ }, C = (d) => {
69
+ const [t, o] = s(""), [p, a] = s(!1), c = (e) => {
70
+ o(e.target.value);
61
71
  }, u = () => {
62
- d(!0);
72
+ o("");
63
73
  }, g = [
64
74
  {
65
- groupId: "1",
66
75
  id: "inbox",
67
- href: "#",
68
- label: e ? () => /* @__PURE__ */ l("span", { children: [
69
- /* @__PURE__ */ n("mark", { children: e }),
76
+ label: t ? () => /* @__PURE__ */ l("span", { children: [
77
+ /* @__PURE__ */ n("mark", { children: t }),
70
78
  " i innboksen"
71
79
  ] }) : "Alt i innboksen"
72
80
  },
73
81
  {
74
- groupId: "1",
75
82
  id: "global",
76
- href: "#",
77
- label: e ? () => /* @__PURE__ */ l("span", { children: [
78
- /* @__PURE__ */ n("mark", { children: e }),
83
+ label: t ? () => /* @__PURE__ */ l("span", { children: [
84
+ /* @__PURE__ */ n("mark", { children: t }),
79
85
  " i hele Altinn"
80
86
  ] }) : "Alt i hele Altinn"
81
87
  }
82
- ], r = e ? [
88
+ ].map((e) => ({
89
+ ...e,
90
+ groupId: "1",
91
+ type: "scope"
92
+ })), r = t ? [
83
93
  {
84
- groupId: "2",
85
- href: "http://www.altinn.no",
86
- label: "Skattemelding 2024"
94
+ href: "#skatt-2024",
95
+ title: "Skattemelding 2024"
87
96
  },
88
97
  {
89
- groupId: "2",
90
- onClick: () => {
91
- alert("Skattemelding 2025 ble trykket på");
92
- },
93
- label: "Skattemelding 2025"
98
+ href: "#skatt-2024",
99
+ title: "Skattemelding 2025"
100
+ }
101
+ ].filter((e) => e.title.toLowerCase().includes((t ?? "").toLowerCase())).map((e) => ({
102
+ ...e,
103
+ type: "dialog",
104
+ groupId: "2"
105
+ })) : [], m = [...g, ...r].map((e) => ({
106
+ ...e,
107
+ onClick: () => {
108
+ console.log(JSON.stringify(e));
94
109
  }
95
- ].filter((t) => t.label.toLowerCase().includes((e ?? "").toLowerCase())) : [], h = {
110
+ })), h = {
96
111
  groups: {
97
112
  2: {
98
113
  title: `${r.length} treff i innboksen`
99
114
  }
100
115
  },
101
- items: [...g, ...r]
116
+ items: m
102
117
  };
103
118
  return /* @__PURE__ */ n(
104
- o,
119
+ i,
105
120
  {
106
- ...s,
121
+ ...d,
107
122
  autocomplete: h,
108
- expanded: i,
109
- value: e,
110
- onChange: p,
111
- onFocus: u,
112
- onEnter: () => {
113
- alert(`Søk etter ${e}`);
123
+ value: t,
124
+ onChange: c,
125
+ onClear: u,
126
+ expanded: p,
127
+ onFocus: () => a(!0),
128
+ onClose: () => {
129
+ a(!1);
114
130
  }
115
131
  }
116
132
  );
117
133
  };
118
134
  export {
119
- A as ControlledState,
120
- S as Default,
121
- I as Expanded,
135
+ C as ControlledState,
136
+ y as Default,
137
+ A as Expanded,
122
138
  x as Query,
123
- k as default
139
+ S as default
124
140
  };
@@ -5,12 +5,13 @@ import "react";
5
5
  import "../RootProvider/RootProvider.js";
6
6
  import { Menu as p } from "../Menu/Menu.js";
7
7
  import { DrawerOrDropdown as l } from "../Dropdown/DrawerOrDropdown.js";
8
+ import "../../Autocomplete-hEFuiN2u.js";
8
9
  import { ToolbarButton as n } from "./ToolbarButton.js";
9
10
  import { ToolbarFilterBase as s } from "./ToolbarFilterBase.js";
10
- const x = ({ expanded: o = !1, onToggle: t, label: i = "Legg til", items: m }) => /* @__PURE__ */ e(s, { expanded: o, children: [
11
+ const B = ({ expanded: o = !1, onToggle: t, label: i = "Legg til", items: m }) => /* @__PURE__ */ e(s, { expanded: o, children: [
11
12
  /* @__PURE__ */ r(n, { type: "add", onToggle: t, children: i }),
12
13
  /* @__PURE__ */ r(l, { title: i, onClose: t, expanded: o, children: /* @__PURE__ */ r(p, { theme: "global", items: m }) })
13
14
  ] });
14
15
  export {
15
- x as ToolbarAdd
16
+ B as ToolbarAdd
16
17
  };
@@ -6,6 +6,7 @@ import "../RootProvider/RootProvider.js";
6
6
  import { MenuInputField as p } from "../Menu/MenuInputField.js";
7
7
  import { MenuBase as v } from "../Menu/MenuBase.js";
8
8
  import { DrawerOrDropdown as C } from "../Dropdown/DrawerOrDropdown.js";
9
+ import "../../Autocomplete-hEFuiN2u.js";
9
10
  import { ToolbarButton as F } from "./ToolbarButton.js";
10
11
  import { ToolbarFilterBase as T } from "./ToolbarFilterBase.js";
11
12
  import { Datepicker as S } from "../Datepicker/Datepicker.js";
@@ -13,7 +14,7 @@ import '../../assets/ToolbarDaterange.css';const y = "_datepicker_mqb1p_1", q =
13
14
  datepicker: y,
14
15
  fields: q,
15
16
  description: w
16
- }, H = ({
17
+ }, J = ({
17
18
  title: d = "Select daterange",
18
19
  description: f = "Choose dates or click to set daterange.",
19
20
  fromLabel: h = "From date",
@@ -45,5 +46,5 @@ import '../../assets/ToolbarDaterange.css';const y = "_datepicker_mqb1p_1", q =
45
46
  ] });
46
47
  };
47
48
  export {
48
- H as ToolbarDaterange
49
+ J as ToolbarDaterange
49
50
  };
@@ -4,10 +4,11 @@ import "../Icon/SvgIcon.js";
4
4
  import "react";
5
5
  import "../RootProvider/RootProvider.js";
6
6
  import { DrawerOrDropdown as j } from "../Dropdown/DrawerOrDropdown.js";
7
+ import "../../Autocomplete-hEFuiN2u.js";
7
8
  import { ToolbarButton as O } from "./ToolbarButton.js";
8
9
  import { ToolbarFilterBase as k } from "./ToolbarFilterBase.js";
9
10
  import { ToolbarOptions as u } from "./ToolbarOptions.js";
10
- const w = (t, o) => Array.isArray(o) ? o.join(", ") : o, _ = ({
11
+ const w = (t, o) => Array.isArray(o) ? o.join(", ") : o, e = ({
11
12
  expanded: t = !1,
12
13
  removable: o,
13
14
  label: m,
@@ -61,5 +62,5 @@ const w = (t, o) => Array.isArray(o) ? o.join(", ") : o, _ = ({
61
62
  ] });
62
63
  };
63
64
  export {
64
- _ as ToolbarFilter
65
+ e as ToolbarFilter
65
66
  };
@@ -5,12 +5,13 @@ import "react";
5
5
  import "../RootProvider/RootProvider.js";
6
6
  import { Menu as s } from "../Menu/Menu.js";
7
7
  import { DrawerOrDropdown as a } from "../Dropdown/DrawerOrDropdown.js";
8
+ import "../../Autocomplete-hEFuiN2u.js";
8
9
  import { ToolbarButton as f } from "./ToolbarButton.js";
9
10
  import { ToolbarFilterBase as c } from "./ToolbarFilterBase.js";
10
- const D = ({ expanded: r = !1, onToggle: t, label: e, value: i, groups: m, search: l, items: p }) => /* @__PURE__ */ n(c, { expanded: r, children: [
11
+ const M = ({ expanded: r = !1, onToggle: t, label: e, value: i, groups: m, search: l, items: p }) => /* @__PURE__ */ n(c, { expanded: r, children: [
11
12
  /* @__PURE__ */ o(f, { type: "switch", onToggle: t, active: !!i, children: e }),
12
13
  /* @__PURE__ */ o(a, { expanded: r, title: "Endre konto", onClose: t, children: /* @__PURE__ */ o(s, { theme: "global", defaultItemColor: "subtle", groups: m, search: l, items: p }) })
13
14
  ] });
14
15
  export {
15
- D as ToolbarMenu
16
+ M as ToolbarMenu
16
17
  };
@@ -6,25 +6,26 @@ import { MenuOption as v } from "../Menu/MenuOption.js";
6
6
  import { MenuSearch as j } from "../Menu/MenuSearch.js";
7
7
  import { MenuHeader as x } from "../Menu/MenuHeader.js";
8
8
  import "../RootProvider/RootProvider.js";
9
+ import "../../Autocomplete-hEFuiN2u.js";
9
10
  import { MenuBase as O, MenuList as I, MenuListItem as m } from "../Menu/MenuBase.js";
10
- const q = ({ search: d, optionGroups: o = {}, options: h, onChange: b, optionType: g }) => {
11
- var p;
12
- const a = h.reduce(
11
+ const w = ({ search: d, optionGroups: n = {}, options: h, onChange: b, optionType: g }) => {
12
+ var a;
13
+ const p = h.reduce(
13
14
  (e, l) => {
14
- const n = l.groupId || "";
15
- return e[n] = e[n] || [], e[n].push(l), e;
15
+ const o = l.groupId || "";
16
+ return e[o] = e[o] || [], e[o].push(l), e;
16
17
  },
17
18
  {}
18
19
  );
19
20
  return /* @__PURE__ */ c(O, { theme: "global", children: [
20
21
  d && /* @__PURE__ */ r(j, { ...d }),
21
- /* @__PURE__ */ r(I, { children: (p = Object.keys(a)) == null ? void 0 : p.map((e, l) => {
22
- var i;
23
- const n = o[e] || {}, { title: u, divider: f = !0 } = n;
22
+ /* @__PURE__ */ r(I, { children: (a = Object.keys(p)) == null ? void 0 : a.map((e, l) => {
23
+ var u;
24
+ const o = n[e] || {}, { title: i, divider: f = !0 } = o;
24
25
  return /* @__PURE__ */ c(M, { children: [
25
26
  l && f ? /* @__PURE__ */ r(m, { role: "separator" }) : "",
26
- u && /* @__PURE__ */ r(m, { children: /* @__PURE__ */ r(x, { title: u }) }),
27
- (i = a[e]) == null ? void 0 : i.map((t) => {
27
+ i && /* @__PURE__ */ r(m, { children: /* @__PURE__ */ r(x, { title: i }) }),
28
+ (u = p[e]) == null ? void 0 : u.map((t) => {
28
29
  var s;
29
30
  return /* @__PURE__ */ r(m, { children: /* @__PURE__ */ r(
30
31
  v,
@@ -32,7 +33,7 @@ const q = ({ search: d, optionGroups: o = {}, options: h, onChange: b, optionTyp
32
33
  onChange: b,
33
34
  label: t.label,
34
35
  badge: t.badge,
35
- type: t.type || ((s = o == null ? void 0 : o[e]) == null ? void 0 : s.optionType) || g,
36
+ type: t.type || ((s = n == null ? void 0 : n[e]) == null ? void 0 : s.optionType) || g,
36
37
  value: t.value,
37
38
  checked: t.checked
38
39
  }
@@ -43,5 +44,5 @@ const q = ({ search: d, optionGroups: o = {}, options: h, onChange: b, optionTyp
43
44
  ] });
44
45
  };
45
46
  export {
46
- q as ToolbarOptions
47
+ w as ToolbarOptions
47
48
  };
@@ -1,40 +1,41 @@
1
- import { jsxs as r, jsx as c } from "react/jsx-runtime";
1
+ import { jsxs as s, jsx as i } from "react/jsx-runtime";
2
2
  import { Icon as a } from "../Icon/Icon.js";
3
3
  import "../Icon/SvgIcon.js";
4
4
  import "../../index-L8X2o7IH.js";
5
5
  import "react";
6
- import { IconButton as l } from "../Button/IconButton.js";
6
+ import { IconButton as m } from "../Button/IconButton.js";
7
7
  import "../RootProvider/RootProvider.js";
8
- import '../../assets/ToolbarSearch.css';const m = "_field_dvezx_1", p = "_icon_dvezx_5", d = "_input_dvezx_14", _ = "_clear_dvezx_30", o = {
9
- field: m,
8
+ import "../../Autocomplete-hEFuiN2u.js";
9
+ import '../../assets/ToolbarSearch.css';const l = "_field_dvezx_1", p = "_icon_dvezx_5", d = "_input_dvezx_14", _ = "_clear_dvezx_30", o = {
10
+ field: l,
10
11
  icon: p,
11
12
  input: d,
12
13
  clear: _
13
- }, N = ({ value: e, name: n, placeholder: s = "Search", onChange: t, onClear: i }) => /* @__PURE__ */ r("div", { className: o.field, children: [
14
- /* @__PURE__ */ c(
14
+ }, g = ({ value: t, name: e, placeholder: n = "Search", onChange: r, onClear: c }) => /* @__PURE__ */ s("div", { className: o.field, children: [
15
+ /* @__PURE__ */ i(
15
16
  "input",
16
17
  {
17
18
  type: "search",
18
- value: e,
19
- name: n,
20
- placeholder: s,
19
+ value: t,
20
+ name: e,
21
+ placeholder: n,
21
22
  className: o.input,
22
- onChange: t
23
+ onChange: r
23
24
  }
24
25
  ),
25
- /* @__PURE__ */ c(a, { name: "magnifying-glass", className: o.icon }),
26
- i && /* @__PURE__ */ c(
27
- l,
26
+ /* @__PURE__ */ i(a, { name: "magnifying-glass", className: o.icon }),
27
+ c && /* @__PURE__ */ i(
28
+ m,
28
29
  {
29
30
  icon: "x-mark",
30
31
  color: "secondary",
31
32
  variant: "solid",
32
33
  size: "custom",
33
34
  className: o.clear,
34
- onClick: i
35
+ onClick: c
35
36
  }
36
37
  )
37
38
  ] });
38
39
  export {
39
- N as ToolbarSearch
40
+ g as ToolbarSearch
40
41
  };