@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.
- package/dist/Autocomplete-hEFuiN2u.js +287 -0
- package/dist/assets/Autocomplete.css +1 -0
- package/dist/assets/GlobalMenuBase.css +1 -1
- package/dist/assets/Header.css +1 -1
- package/dist/assets/LayoutBase.css +1 -1
- package/dist/components/Bookmarks/BookmarksList.js +1 -1
- package/dist/components/Bookmarks/BookmarksListItem.js +4 -5
- package/dist/components/Bookmarks/BookmarksListItem.stories.js +7 -7
- package/dist/components/Bookmarks/index.js +4 -4
- package/dist/components/Button/Buttons.stories.js +5 -4
- package/dist/components/ContextMenu/ContextMenu.js +4 -27
- package/dist/components/ContextMenu/ContextMenu.stories.js +3 -3
- package/dist/components/ContextMenu/ContextMenuBase.js +6 -32
- package/dist/components/ContextMenu/index.js +1 -1
- package/dist/components/Dialog/DialogActions.js +3 -2
- package/dist/components/Dialog/DialogGroup.js +3 -2
- package/dist/components/Dialog/DialogList.js +1 -1
- package/dist/components/Dialog/DialogListItem.js +13 -87
- package/dist/components/Dialog/DialogListItem.stories.js +1 -1
- package/dist/components/Dialog/DialogNav.js +11 -11
- package/dist/components/Dialog/Examples.stories.js +1 -1
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/Dropdown/DrawerButton.js +5 -4
- package/dist/components/Dropdown/DrawerOrDropdown.js +7 -6
- package/dist/components/GlobalMenu/AccountButton.js +3 -2
- package/dist/components/GlobalMenu/AccountMenu.d.ts +5 -2
- package/dist/components/GlobalMenu/AccountMenu.js +35 -26
- package/dist/components/GlobalMenu/AccountMenu.stories.js +19 -2
- package/dist/components/GlobalMenu/BackButton.js +3 -2
- package/dist/components/GlobalMenu/GlobalMenu.js +3 -2
- package/dist/components/GlobalMenu/GlobalMenu.stories.js +6 -12
- package/dist/components/GlobalMenu/GlobalMenuBase.js +9 -9
- package/dist/components/Header/Header.js +13 -13
- package/dist/components/Header/HeaderBase.js +5 -4
- package/dist/components/Layout/Layout.js +9 -8
- package/dist/components/Layout/Layout.stories.js +140 -49
- package/dist/components/Layout/LayoutBase.js +3 -3
- package/dist/components/LayoutAction/ActionMenu.js +5 -4
- package/dist/components/List/List.js +3 -3
- package/dist/components/List/List.stories.js +5 -4
- package/dist/components/List/ListItem.js +6 -39
- package/dist/components/List/ListItem.stories.js +1 -1
- package/dist/components/List/ListItemControls.js +5 -15
- package/dist/components/List/index.js +12 -13
- package/dist/components/Menu/Menu.js +9 -9
- package/dist/components/Menu/MenuItem.stories.js +21 -20
- package/dist/components/Menu/MenuItems.js +8 -59
- package/dist/components/Menu/MenuItems.stories.js +1 -1
- package/dist/components/Menu/MenuSearch.js +6 -5
- package/dist/components/Menu/index.js +7 -7
- package/dist/components/Page/PageHeader.js +8 -7
- package/dist/components/Searchbar/Autocomplete.d.ts +1 -2
- package/dist/components/Searchbar/Autocomplete.js +7 -23
- package/dist/components/Searchbar/Autocomplete.stories.js +1 -1
- package/dist/components/Searchbar/AutocompleteBase.d.ts +2 -1
- package/dist/components/Searchbar/AutocompleteBase.js +9 -6
- package/dist/components/Searchbar/AutocompleteItem.js +3 -20
- package/dist/components/Searchbar/ScopeListItem.d.ts +2 -2
- package/dist/components/Searchbar/ScopeListItem.js +3 -6
- package/dist/components/Searchbar/SearchField.js +39 -39
- package/dist/components/Searchbar/Searchbar.d.ts +1 -1
- package/dist/components/Searchbar/Searchbar.js +25 -17
- package/dist/components/Searchbar/Searchbar.stories.js +63 -47
- package/dist/components/Toolbar/ToolbarAdd.js +3 -2
- package/dist/components/Toolbar/ToolbarDaterange.js +3 -2
- package/dist/components/Toolbar/ToolbarFilter.js +3 -2
- package/dist/components/Toolbar/ToolbarMenu.js +3 -2
- package/dist/components/Toolbar/ToolbarOptions.js +13 -12
- package/dist/components/Toolbar/ToolbarSearch.js +16 -15
- package/dist/components/index.js +213 -218
- package/dist/hooks/useEnterKey.d.ts +1 -0
- package/dist/hooks/useEnterKey.js +15 -0
- package/dist/index.js +226 -231
- package/package.json +1 -1
- package/dist/assets/ContextMenuBase.css +0 -1
- package/dist/assets/DialogListItem.css +0 -1
- package/dist/assets/ListItemControls.css +0 -1
- package/dist/assets/ScopeListItem.css +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Searchbar as
|
|
4
|
-
const
|
|
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:
|
|
6
|
+
component: i,
|
|
7
7
|
tags: ["autodocs"],
|
|
8
8
|
parameters: {},
|
|
9
9
|
args: {
|
|
10
10
|
placeholder: "Search",
|
|
11
11
|
name: "search",
|
|
12
|
-
expanded: !
|
|
12
|
+
expanded: !0
|
|
13
13
|
}
|
|
14
|
-
},
|
|
14
|
+
}, y = {
|
|
15
15
|
args: {}
|
|
16
16
|
}, x = {
|
|
17
17
|
args: {
|
|
18
18
|
value: "query"
|
|
19
19
|
}
|
|
20
|
-
},
|
|
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
|
-
|
|
56
|
+
title: "Skattemelding 2024"
|
|
48
57
|
},
|
|
49
58
|
{
|
|
59
|
+
type: "dialog",
|
|
50
60
|
id: "2b",
|
|
51
61
|
groupId: "2",
|
|
52
62
|
href: "#",
|
|
53
|
-
|
|
63
|
+
title: "Skattemelding 2025"
|
|
54
64
|
}
|
|
55
65
|
]
|
|
56
66
|
}
|
|
57
67
|
}
|
|
58
|
-
},
|
|
59
|
-
const [
|
|
60
|
-
|
|
68
|
+
}, C = (d) => {
|
|
69
|
+
const [t, o] = s(""), [p, a] = s(!1), c = (e) => {
|
|
70
|
+
o(e.target.value);
|
|
61
71
|
}, u = () => {
|
|
62
|
-
|
|
72
|
+
o("");
|
|
63
73
|
}, g = [
|
|
64
74
|
{
|
|
65
|
-
groupId: "1",
|
|
66
75
|
id: "inbox",
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
77
|
-
|
|
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
|
-
]
|
|
88
|
+
].map((e) => ({
|
|
89
|
+
...e,
|
|
90
|
+
groupId: "1",
|
|
91
|
+
type: "scope"
|
|
92
|
+
})), r = t ? [
|
|
83
93
|
{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
label: "Skattemelding 2024"
|
|
94
|
+
href: "#skatt-2024",
|
|
95
|
+
title: "Skattemelding 2024"
|
|
87
96
|
},
|
|
88
97
|
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
|
-
|
|
110
|
+
})), h = {
|
|
96
111
|
groups: {
|
|
97
112
|
2: {
|
|
98
113
|
title: `${r.length} treff i innboksen`
|
|
99
114
|
}
|
|
100
115
|
},
|
|
101
|
-
items:
|
|
116
|
+
items: m
|
|
102
117
|
};
|
|
103
118
|
return /* @__PURE__ */ n(
|
|
104
|
-
|
|
119
|
+
i,
|
|
105
120
|
{
|
|
106
|
-
...
|
|
121
|
+
...d,
|
|
107
122
|
autocomplete: h,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
120
|
-
|
|
121
|
-
|
|
135
|
+
C as ControlledState,
|
|
136
|
+
y as Default,
|
|
137
|
+
A as Expanded,
|
|
122
138
|
x as Query,
|
|
123
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
},
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
11
|
-
var
|
|
12
|
-
const
|
|
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
|
|
15
|
-
return 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: (
|
|
22
|
-
var
|
|
23
|
-
const
|
|
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
|
-
|
|
27
|
-
(
|
|
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 =
|
|
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
|
-
|
|
47
|
+
w as ToolbarOptions
|
|
47
48
|
};
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { jsxs as
|
|
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
|
|
6
|
+
import { IconButton as m } from "../Button/IconButton.js";
|
|
7
7
|
import "../RootProvider/RootProvider.js";
|
|
8
|
-
import
|
|
9
|
-
|
|
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
|
-
},
|
|
14
|
-
/* @__PURE__ */
|
|
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:
|
|
19
|
-
name:
|
|
20
|
-
placeholder:
|
|
19
|
+
value: t,
|
|
20
|
+
name: e,
|
|
21
|
+
placeholder: n,
|
|
21
22
|
className: o.input,
|
|
22
|
-
onChange:
|
|
23
|
+
onChange: r
|
|
23
24
|
}
|
|
24
25
|
),
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
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:
|
|
35
|
+
onClick: c
|
|
35
36
|
}
|
|
36
37
|
)
|
|
37
38
|
] });
|
|
38
39
|
export {
|
|
39
|
-
|
|
40
|
+
g as ToolbarSearch
|
|
40
41
|
};
|