@altinn/altinn-components 0.24.4 → 0.24.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.
- package/README.md +16 -2
- package/dist/PersonCircle-DMwECpgW.js +25 -0
- package/dist/assets/AccountButton.css +1 -0
- package/dist/assets/EndUserLabel.css +1 -0
- package/dist/assets/GlobalMenuBase.css +1 -1
- package/dist/assets/MenuItemBase.css +1 -1
- package/dist/assets/MenuItemLabel.css +1 -1
- package/dist/components/Dropdown/DrawerBase.js +15 -8
- package/dist/components/Dropdown/DropdownBase.js +21 -21
- package/dist/components/GlobalMenu/AccountButton.js +34 -12
- package/dist/components/GlobalMenu/EndUserLabel.js +13 -0
- package/dist/components/GlobalMenu/GlobalMenu.js +68 -60
- package/dist/components/GlobalMenu/GlobalMenuBase.js +9 -9
- package/dist/components/GlobalMenu/index.js +10 -8
- package/dist/components/Header/LocaleSwitcher.js +24 -10
- package/dist/components/Menu/MenuItemBase.js +5 -5
- package/dist/components/Menu/MenuItemLabel.js +21 -10
- package/dist/components/Menu/MenuItems.js +24 -23
- package/dist/components/Toolbar/Toolbar.js +32 -31
- package/dist/components/index.js +252 -250
- package/dist/index.js +260 -258
- package/dist/types/lib/components/Dropdown/DrawerBase.d.ts +2 -1
- package/dist/types/lib/components/Dropdown/DropdownBase.d.ts +2 -1
- package/dist/types/lib/components/GlobalMenu/EndUserLabel.d.ts +5 -0
- package/dist/types/lib/components/GlobalMenu/GlobalMenu.d.ts +2 -1
- package/dist/types/lib/components/GlobalMenu/GlobalMenu.stories.d.ts +3 -1
- package/dist/types/lib/components/GlobalMenu/GlobalMenuBase.d.ts +3 -1
- package/dist/types/lib/components/GlobalMenu/index.d.ts +1 -0
- package/dist/types/lib/components/Menu/Examples.stories.d.ts +4 -0
- package/dist/types/lib/components/Menu/MenuItemLabel.d.ts +2 -1
- package/dist/types/lib/components/Menu/MenuItems.d.ts +3 -1
- package/package.json +1 -1
- package/dist/userMenuItems-vSWEGGu2.js +0 -84
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as i, jsx as m, Fragment as
|
|
3
|
-
import { Fragment as
|
|
2
|
+
import { jsxs as i, jsx as m, Fragment as B } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment as E } from "react";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
|
-
import { useMenu as
|
|
5
|
+
import { useMenu as G } from "../../hooks/useMenu.js";
|
|
6
6
|
import "../RootProvider/RootProvider.js";
|
|
7
|
-
import { MenuItem as
|
|
8
|
-
import { MenuSearch as
|
|
9
|
-
import { MenuHeader as
|
|
10
|
-
import { MenuList as
|
|
7
|
+
import { MenuItem as H } from "./MenuItem.js";
|
|
8
|
+
import { MenuSearch as K } from "./MenuSearch.js";
|
|
9
|
+
import { MenuHeader as S } from "./MenuHeader.js";
|
|
10
|
+
import { MenuList as _, MenuListItem as c } from "./MenuBase.js";
|
|
11
11
|
import "../Search/AutocompleteBase.js";
|
|
12
12
|
import "../Snackbar/useSnackbar.js";
|
|
13
|
-
const
|
|
13
|
+
const $ = ({
|
|
14
14
|
level: h = 0,
|
|
15
15
|
expanded: F,
|
|
16
16
|
search: f,
|
|
@@ -19,42 +19,43 @@ const _ = ({
|
|
|
19
19
|
defaultItemSize: x,
|
|
20
20
|
defaultItemColor: M,
|
|
21
21
|
defaultItemTheme: I,
|
|
22
|
-
defaultIconTheme: v
|
|
22
|
+
defaultIconTheme: v,
|
|
23
|
+
as: o
|
|
23
24
|
}) => {
|
|
24
|
-
const { menu: b } =
|
|
25
|
+
const { menu: b } = G({
|
|
25
26
|
items: j,
|
|
26
27
|
groups: r,
|
|
27
28
|
groupByKey: "groupId",
|
|
28
29
|
keyboardEvents: !1
|
|
29
30
|
});
|
|
30
|
-
return /* @__PURE__ */ i(
|
|
31
|
-
f && /* @__PURE__ */ m(
|
|
31
|
+
return /* @__PURE__ */ i(_, { expanded: F, as: o, children: [
|
|
32
|
+
f && /* @__PURE__ */ m(K, { ...f }),
|
|
32
33
|
b.map((n, l) => {
|
|
33
|
-
const t = (n == null ? void 0 : n.props) || {}, { title: y, divider:
|
|
34
|
-
return /* @__PURE__ */ i(
|
|
35
|
-
(h > 0 || l) &&
|
|
36
|
-
y && /* @__PURE__ */ m(c, { children: /* @__PURE__ */ m(
|
|
34
|
+
const t = (n == null ? void 0 : n.props) || {}, { title: y, divider: z = !0 } = t, L = b[l + 1];
|
|
35
|
+
return /* @__PURE__ */ i(E, { children: [
|
|
36
|
+
(h > 0 || l) && z ? /* @__PURE__ */ m(c, { role: "separator" }) : "",
|
|
37
|
+
y && /* @__PURE__ */ m(c, { children: /* @__PURE__ */ m(S, { title: y }) }),
|
|
37
38
|
n == null ? void 0 : n.items.filter((a) => {
|
|
38
39
|
var d;
|
|
39
40
|
return !((d = a.props) != null && d.hidden);
|
|
40
41
|
}).map((a, d) => {
|
|
41
|
-
const { active:
|
|
42
|
+
const { active: T } = a, { groupId: q, ...e } = a.props || {}, { expanded: s } = e, k = n == null ? void 0 : n.items[d + 1];
|
|
42
43
|
return /* @__PURE__ */ i(c, { expanded: s, children: [
|
|
43
44
|
/* @__PURE__ */ m(
|
|
44
|
-
|
|
45
|
+
H,
|
|
45
46
|
{
|
|
46
47
|
...e,
|
|
47
48
|
size: (e == null ? void 0 : e.size) || (t == null ? void 0 : t.defaultItemSize) || x,
|
|
48
49
|
color: (e == null ? void 0 : e.color) || (t == null ? void 0 : t.defaultItemColor) || M,
|
|
49
50
|
theme: (e == null ? void 0 : e.theme) || (t == null ? void 0 : t.defaultItemTheme) || I,
|
|
50
51
|
iconTheme: (e == null ? void 0 : e.iconTheme) || (t == null ? void 0 : t.defaultIconTheme) || v,
|
|
51
|
-
active:
|
|
52
|
+
active: T,
|
|
52
53
|
tabIndex: e != null && e.disabled ? -1 : 0
|
|
53
54
|
}
|
|
54
55
|
),
|
|
55
|
-
s && (e == null ? void 0 : e.items) && /* @__PURE__ */ i(
|
|
56
|
+
s && (e == null ? void 0 : e.items) && /* @__PURE__ */ i(B, { children: [
|
|
56
57
|
/* @__PURE__ */ m(
|
|
57
|
-
|
|
58
|
+
$,
|
|
58
59
|
{
|
|
59
60
|
expanded: s,
|
|
60
61
|
level: h + 1,
|
|
@@ -66,7 +67,7 @@ const _ = ({
|
|
|
66
67
|
defaultIconTheme: v
|
|
67
68
|
}
|
|
68
69
|
),
|
|
69
|
-
(
|
|
70
|
+
(L || k) && /* @__PURE__ */ m(c, { role: "separator", as: "div" })
|
|
70
71
|
] })
|
|
71
72
|
] }, d);
|
|
72
73
|
})
|
|
@@ -75,5 +76,5 @@ const _ = ({
|
|
|
75
76
|
] });
|
|
76
77
|
};
|
|
77
78
|
export {
|
|
78
|
-
|
|
79
|
+
$ as MenuItems
|
|
79
80
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as v, jsx as i } from "react/jsx-runtime";
|
|
3
3
|
import { useState as F, useMemo as T } from "react";
|
|
4
|
-
import { useRootContext as
|
|
5
|
-
import { ToolbarAccountMenu as
|
|
6
|
-
import { ToolbarAdd as
|
|
7
|
-
import { ToolbarBase as
|
|
8
|
-
import { ToolbarFilter as
|
|
9
|
-
import { ToolbarSearch as
|
|
4
|
+
import { useRootContext as B } from "../RootProvider/RootProvider.js";
|
|
5
|
+
import { ToolbarAccountMenu as M } from "./ToolbarAccountMenu.js";
|
|
6
|
+
import { ToolbarAdd as V } from "./ToolbarAdd.js";
|
|
7
|
+
import { ToolbarBase as $ } from "./ToolbarBase.js";
|
|
8
|
+
import { ToolbarFilter as q } from "./ToolbarFilter.js";
|
|
9
|
+
import { ToolbarSearch as w } from "./ToolbarSearch.js";
|
|
10
10
|
const g = (n, l) => l || `toolbar-filter-${n}`, Q = ({
|
|
11
11
|
filters: n = [],
|
|
12
12
|
filterState: l,
|
|
@@ -19,45 +19,45 @@ const g = (n, l) => l || `toolbar-filter-${n}`, Q = ({
|
|
|
19
19
|
removeButtonAltText: S,
|
|
20
20
|
addFilterButtonLabel: h
|
|
21
21
|
}) => {
|
|
22
|
-
const { openId: C, closeAll: I } =
|
|
22
|
+
const { openId: C, closeAll: I } = B(), [N, R] = F(
|
|
23
23
|
l ?? {}
|
|
24
|
-
),
|
|
24
|
+
), p = typeof s == "function" ? s : R, t = l || N, [c, u] = F(
|
|
25
25
|
(n == null ? void 0 : n.filter((o) => !(o.removable && typeof t[o.name] > "u")).map((o) => o.name)) ?? []
|
|
26
|
-
),
|
|
27
|
-
() =>
|
|
28
|
-
[n,
|
|
26
|
+
), f = n == null ? void 0 : n.filter((o) => !c.includes(o.name)), j = T(
|
|
27
|
+
() => c.map((o) => n.find((e) => e.name === o)).filter((o) => typeof o < "u"),
|
|
28
|
+
[n, c]
|
|
29
29
|
), a = T(
|
|
30
|
-
() => n.filter((o) =>
|
|
31
|
-
[n,
|
|
32
|
-
),
|
|
33
|
-
r === "radio" ? (I(),
|
|
30
|
+
() => n.filter((o) => f.includes(o)),
|
|
31
|
+
[n, f]
|
|
32
|
+
), G = (o, e, r) => {
|
|
33
|
+
r === "radio" ? (I(), p({
|
|
34
34
|
...t,
|
|
35
35
|
[o]: e
|
|
36
|
-
})) :
|
|
36
|
+
})) : p({
|
|
37
37
|
...t,
|
|
38
|
-
[o]: t[o] ? t[o].some((
|
|
38
|
+
[o]: t[o] ? t[o].some((d) => e == null ? void 0 : e.includes(d)) ? t[o].filter((d) => !e.includes(d)) : [...t[o], ...e] : e
|
|
39
39
|
});
|
|
40
|
-
},
|
|
41
|
-
|
|
40
|
+
}, L = (o) => {
|
|
41
|
+
u((e) => e.filter((r) => r !== o)), p({
|
|
42
42
|
...t,
|
|
43
43
|
[o]: void 0
|
|
44
44
|
});
|
|
45
|
-
},
|
|
46
|
-
|
|
45
|
+
}, k = (o, e) => {
|
|
46
|
+
u((r) => [...r, o]), C(e);
|
|
47
47
|
};
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
b && /* @__PURE__ */ i(
|
|
50
|
-
m && /* @__PURE__ */ i(
|
|
48
|
+
return /* @__PURE__ */ v($, { children: [
|
|
49
|
+
b && /* @__PURE__ */ i(M, { ...b }),
|
|
50
|
+
m && /* @__PURE__ */ i(w, { ...m }),
|
|
51
51
|
j.map((o) => /* @__PURE__ */ i(
|
|
52
|
-
|
|
52
|
+
q,
|
|
53
53
|
{
|
|
54
54
|
id: g(o.name, o.id),
|
|
55
55
|
showResultsLabel: A,
|
|
56
56
|
onRemove: () => {
|
|
57
|
-
|
|
57
|
+
L(o.name);
|
|
58
58
|
},
|
|
59
59
|
onChange: (e) => {
|
|
60
|
-
|
|
60
|
+
G(o.name, [e.target.value], o.optionType);
|
|
61
61
|
},
|
|
62
62
|
name: o.name,
|
|
63
63
|
options: o.options,
|
|
@@ -66,12 +66,13 @@ const g = (n, l) => l || `toolbar-filter-${n}`, Q = ({
|
|
|
66
66
|
optionType: o.optionType,
|
|
67
67
|
removable: o.removable,
|
|
68
68
|
getSelectedLabel: y,
|
|
69
|
-
buttonAltText: S
|
|
69
|
+
buttonAltText: S,
|
|
70
|
+
optionGroups: o.optionGroups
|
|
70
71
|
},
|
|
71
72
|
o.name
|
|
72
73
|
)),
|
|
73
74
|
(a == null ? void 0 : a.length) > 0 && /* @__PURE__ */ i(
|
|
74
|
-
|
|
75
|
+
V,
|
|
75
76
|
{
|
|
76
77
|
id: "toolbar-filter-add",
|
|
77
78
|
label: h,
|
|
@@ -82,7 +83,7 @@ const g = (n, l) => l || `toolbar-filter-${n}`, Q = ({
|
|
|
82
83
|
title: o.label,
|
|
83
84
|
name: o.name,
|
|
84
85
|
onClick: () => {
|
|
85
|
-
|
|
86
|
+
k(o.name, e);
|
|
86
87
|
}
|
|
87
88
|
};
|
|
88
89
|
})
|