@altinn/altinn-components 0.56.22 → 0.56.24
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/components/GlobalMenu/GlobalMenu.js +23 -23
- package/dist/components/GlobalMenu/GlobalMenuBase.js +6 -7
- package/dist/hooks/useAccountSelector.js +24 -24
- package/dist/types/lib/components/GlobalMenu/GlobalMenuBase.d.ts +0 -4
- package/dist/types/lib/components/Settings/VerifySettingsModal.stories.d.ts +6 -3
- package/package.json +8 -8
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as f, jsx as
|
|
3
|
-
import { useState as d, useCallback as
|
|
2
|
+
import { jsxs as f, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { useState as d, useCallback as L, useEffect as C, useMemo as G } from "react";
|
|
4
4
|
import { M as S } from "../../SearchField-QTfebYdU.js";
|
|
5
5
|
import "../../index-p1eeF8LQ.js";
|
|
6
6
|
import "../Button/Button.js";
|
|
7
7
|
import "react-dom";
|
|
8
8
|
import "../RootProvider/RootProvider.js";
|
|
9
|
-
import { LocaleSwitcher as
|
|
9
|
+
import { LocaleSwitcher as v } from "./LocaleSwitcher.js";
|
|
10
10
|
import "../Snackbar/useSnackbar.js";
|
|
11
|
-
import { MenuListItem as
|
|
12
|
-
import { GlobalMenuBase as u,
|
|
11
|
+
import { MenuListItem as x } from "../Menu/MenuListItem.js";
|
|
12
|
+
import { GlobalMenuBase as u, GlobalMenuFooter as I } from "./GlobalMenuBase.js";
|
|
13
13
|
import { LogoutButton as T } from "./LogoutButton.js";
|
|
14
|
-
import { S as
|
|
15
|
-
const
|
|
16
|
-
menu:
|
|
14
|
+
import { S as h } from "../../Globe-BcPkcH4E.js";
|
|
15
|
+
const N = ({
|
|
16
|
+
menu: e,
|
|
17
17
|
backLabel: g = "Back",
|
|
18
|
-
onClose:
|
|
18
|
+
onClose: s,
|
|
19
19
|
logoutButton: a,
|
|
20
20
|
ariaLabel: n = "Menu",
|
|
21
21
|
localeSwitcher: r,
|
|
22
22
|
isOpen: m = !1
|
|
23
23
|
}) => {
|
|
24
|
-
const [k, c] = d(!1),
|
|
24
|
+
const [k, c] = d(!1), l = L(() => {
|
|
25
25
|
c((t) => !t);
|
|
26
26
|
}, []);
|
|
27
|
-
|
|
27
|
+
C(() => {
|
|
28
28
|
m || c(!1);
|
|
29
29
|
}, [m]);
|
|
30
|
-
const M =
|
|
31
|
-
const t = (
|
|
30
|
+
const M = G(() => {
|
|
31
|
+
const t = (e?.items ?? []).map((i) => ({
|
|
32
32
|
...i,
|
|
33
33
|
onClick: () => {
|
|
34
|
-
i.onClick?.(),
|
|
34
|
+
i.onClick?.(), s?.();
|
|
35
35
|
},
|
|
36
36
|
items: Array.isArray(i.items) ? i.items.map((p) => ({
|
|
37
37
|
...p,
|
|
38
38
|
onClick: () => {
|
|
39
|
-
p.onClick?.(),
|
|
39
|
+
p.onClick?.(), s?.();
|
|
40
40
|
}
|
|
41
41
|
})) : void 0
|
|
42
42
|
}));
|
|
43
43
|
if (!r) return t;
|
|
44
44
|
const b = {
|
|
45
45
|
title: "Språk/language",
|
|
46
|
-
icon:
|
|
46
|
+
icon: h,
|
|
47
47
|
size: "sm",
|
|
48
|
-
onClick:
|
|
48
|
+
onClick: l,
|
|
49
49
|
linkIcon: !0
|
|
50
50
|
};
|
|
51
51
|
return [...t, b];
|
|
52
|
-
}, [
|
|
52
|
+
}, [e, s, r, l]);
|
|
53
53
|
return k ? /* @__PURE__ */ f(u, { "aria-label": n, children: [
|
|
54
|
-
|
|
55
|
-
/* @__PURE__ */
|
|
54
|
+
r && /* @__PURE__ */ o(v, { ...r, backLabel: g, onToggle: l }),
|
|
55
|
+
/* @__PURE__ */ o(x, { as: "div", role: "separator" })
|
|
56
56
|
] }) : /* @__PURE__ */ f(u, { "aria-label": n, children: [
|
|
57
|
-
|
|
58
|
-
a && /* @__PURE__ */
|
|
57
|
+
e && /* @__PURE__ */ o(S, { ...e, items: M }),
|
|
58
|
+
a && /* @__PURE__ */ o(I, { children: /* @__PURE__ */ o(T, { ...a }) })
|
|
59
59
|
] });
|
|
60
60
|
};
|
|
61
61
|
export {
|
|
62
|
-
|
|
62
|
+
N as GlobalMenu
|
|
63
63
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import '../../assets/GlobalMenuBase.css';const
|
|
3
|
-
nav:
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/GlobalMenuBase.css';const r = "_nav_b7k4e_1", s = "_footer_b7k4e_6", t = {
|
|
3
|
+
nav: r,
|
|
4
4
|
footer: s
|
|
5
|
-
},
|
|
5
|
+
}, l = ({ color: o, children: a, ...n }) => /* @__PURE__ */ e("nav", { className: t.nav, "data-color": o, ...n, children: a }), f = ({ children: o }) => /* @__PURE__ */ e("footer", { className: t.footer, children: o });
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
f as GlobalMenuHeader
|
|
7
|
+
l as GlobalMenuBase,
|
|
8
|
+
f as GlobalMenuFooter
|
|
10
9
|
};
|
|
@@ -10,9 +10,9 @@ import { formatDisplayName as S } from "../functions/name/name.js";
|
|
|
10
10
|
import { formatDate as E } from "../functions/date/date.js";
|
|
11
11
|
import { formatOrgNo as x } from "../functions/orgno/orgno.js";
|
|
12
12
|
import { S as R, a as Y } from "../HeartFill-CYSrJ_xK.js";
|
|
13
|
-
const D = (
|
|
14
|
-
partyListDTO:
|
|
15
|
-
favoriteAccountUuids:
|
|
13
|
+
const D = (o) => o === "Organization" ? "company" : "person", st = ({
|
|
14
|
+
partyListDTO: o = [],
|
|
15
|
+
favoriteAccountUuids: e,
|
|
16
16
|
currentAccountUuid: c,
|
|
17
17
|
selfAccountUuid: v,
|
|
18
18
|
isLoading: d = !1,
|
|
@@ -24,12 +24,12 @@ const D = (e) => e === "Organization" ? "company" : "person", st = ({
|
|
|
24
24
|
onShowDeletedUnitsChange: n
|
|
25
25
|
}) => {
|
|
26
26
|
const a = W(), [z, m, p] = V(() => {
|
|
27
|
-
if (d || !
|
|
27
|
+
if (d || !o || !v)
|
|
28
28
|
return [[], {}, void 0];
|
|
29
|
-
const s = (t) =>
|
|
29
|
+
const s = (t) => e?.includes(t), _ = (t) => !t.isDeleted || f !== !1 || t.partyUuid === c, N = B(i), F = i || "nb", k = (t, u) => t.name.localeCompare(u.name, F, {
|
|
30
30
|
sensitivity: "base",
|
|
31
31
|
ignorePunctuation: !0
|
|
32
|
-
}), j = [...
|
|
32
|
+
}), j = [...o].sort(k);
|
|
33
33
|
let P;
|
|
34
34
|
const O = [], y = [], g = [];
|
|
35
35
|
for (const t of j)
|
|
@@ -110,9 +110,9 @@ const D = (e) => e === "Organization" ? "company" : "person", st = ({
|
|
|
110
110
|
};
|
|
111
111
|
return [A, M, H];
|
|
112
112
|
}, [
|
|
113
|
-
e,
|
|
114
|
-
v,
|
|
115
113
|
o,
|
|
114
|
+
v,
|
|
115
|
+
e,
|
|
116
116
|
c,
|
|
117
117
|
d,
|
|
118
118
|
r,
|
|
@@ -120,7 +120,7 @@ const D = (e) => e === "Organization" ? "company" : "person", st = ({
|
|
|
120
120
|
a,
|
|
121
121
|
f
|
|
122
122
|
]);
|
|
123
|
-
return d || !
|
|
123
|
+
return d || !o || !p ? {
|
|
124
124
|
accountMenu: {
|
|
125
125
|
items: [],
|
|
126
126
|
groups: {},
|
|
@@ -142,9 +142,9 @@ const D = (e) => e === "Organization" ? "company" : "person", st = ({
|
|
|
142
142
|
showDeletedUnits: f,
|
|
143
143
|
onShowDeletedUnitsChange: n
|
|
144
144
|
};
|
|
145
|
-
}, h = (
|
|
146
|
-
const f = D(
|
|
147
|
-
fullName:
|
|
145
|
+
}, h = (o, e, c, v, d, b, I, r, i) => {
|
|
146
|
+
const f = D(e?.type ?? ""), n = B(o), a = S({
|
|
147
|
+
fullName: e?.name,
|
|
148
148
|
type: f
|
|
149
149
|
}), z = r ? S({
|
|
150
150
|
fullName: r?.name,
|
|
@@ -155,33 +155,33 @@ const D = (e) => e === "Organization" ? "company" : "person", st = ({
|
|
|
155
155
|
const p = f === "company" && r ? "subunit" : f;
|
|
156
156
|
switch (p) {
|
|
157
157
|
case "company":
|
|
158
|
-
m = `${n.org_no}. ${x(
|
|
158
|
+
m = `${n.org_no}. ${x(e.organizationNumber)}`;
|
|
159
159
|
break;
|
|
160
160
|
case "person":
|
|
161
|
-
m =
|
|
161
|
+
m = e?.dateOfBirth ? `${n.birthdate}: ${E(e?.dateOfBirth)}` : "";
|
|
162
162
|
break;
|
|
163
163
|
case "subunit":
|
|
164
|
-
m = `↳ ${n.org_no}. ${x(
|
|
164
|
+
m = `↳ ${n.org_no}. ${x(e?.organizationNumber)}, ${n.subunit_of} ${z}`;
|
|
165
165
|
break;
|
|
166
166
|
default:
|
|
167
167
|
m = "";
|
|
168
168
|
}
|
|
169
169
|
return {
|
|
170
|
-
id:
|
|
170
|
+
id: e?.partyUuid,
|
|
171
171
|
icon: {
|
|
172
172
|
name: a,
|
|
173
173
|
type: f,
|
|
174
174
|
isParent: !r,
|
|
175
|
-
isDeleted:
|
|
175
|
+
isDeleted: e?.isDeleted
|
|
176
176
|
},
|
|
177
177
|
name: a,
|
|
178
178
|
description: m,
|
|
179
|
-
searchWords: p === "
|
|
179
|
+
searchWords: p === "person" ? [a, e?.dateOfBirth ?? ""] : [a, e?.organizationNumber ?? ""],
|
|
180
180
|
groupId: c,
|
|
181
181
|
type: p,
|
|
182
|
-
selected: v ===
|
|
183
|
-
disabled: !!
|
|
184
|
-
badge: i ? { label: n.you, color: "person" } :
|
|
182
|
+
selected: v === e?.partyUuid,
|
|
183
|
+
disabled: !!e?.onlyHierarchyElementWithNoAccess,
|
|
184
|
+
badge: i ? { label: n.you, color: "person" } : e.isDeleted && I ? { label: n.deleted, color: "neutral" } : void 0,
|
|
185
185
|
controls: !i && /* @__PURE__ */ U(
|
|
186
186
|
G,
|
|
187
187
|
{
|
|
@@ -189,15 +189,15 @@ const D = (e) => e === "Organization" ? "company" : "person", st = ({
|
|
|
189
189
|
variant: "ghost",
|
|
190
190
|
"aria-label": d ? n.remove_from_favorites : n.add_to_favorites,
|
|
191
191
|
onClick: (s) => {
|
|
192
|
-
b && (s.stopPropagation(), b(
|
|
192
|
+
b && (s.stopPropagation(), b(e?.partyUuid));
|
|
193
193
|
},
|
|
194
194
|
size: "xs",
|
|
195
195
|
children: d ? /* @__PURE__ */ U(R, {}) : /* @__PURE__ */ U(Y, {})
|
|
196
196
|
}
|
|
197
197
|
)
|
|
198
198
|
};
|
|
199
|
-
}, q = (
|
|
200
|
-
switch (
|
|
199
|
+
}, q = (o) => o === "Organization", w = (o) => o === "Person" || o === "SelfIdentified", B = (o) => {
|
|
200
|
+
switch (o) {
|
|
201
201
|
case "nn":
|
|
202
202
|
return {
|
|
203
203
|
account_orgs: "Virksemder",
|
|
@@ -4,12 +4,8 @@ export type GlobalMenuBaseProps = {
|
|
|
4
4
|
color?: Color;
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
} & React.HTMLAttributes<HTMLElement>;
|
|
7
|
-
export interface GlobalMenuHeaderProps {
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
}
|
|
10
7
|
export interface GlobalMenuFooterProps {
|
|
11
8
|
children: ReactNode;
|
|
12
9
|
}
|
|
13
10
|
export declare const GlobalMenuBase: ({ color, children, ...rest }: GlobalMenuBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export declare const GlobalMenuHeader: ({ children }: GlobalMenuHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
11
|
export declare const GlobalMenuFooter: ({ children }: GlobalMenuFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,10 +5,13 @@ declare const meta: {
|
|
|
5
5
|
parameters: {};
|
|
6
6
|
args: {
|
|
7
7
|
open: true;
|
|
8
|
-
onClose: () => void;
|
|
9
8
|
};
|
|
10
9
|
};
|
|
11
10
|
export default meta;
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
11
|
+
export declare const ProfileReadOnly: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const ProfileInput: () => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const ProfileSelect: () => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const AccountVerified: () => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const AccountNewEmail: () => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const AccountNewEmailAndSms: () => import("react/jsx-runtime").JSX.Element;
|
|
14
17
|
export declare const VerificationCodeSent: () => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altinn/altinn-components",
|
|
3
|
-
"version": "0.56.
|
|
3
|
+
"version": "0.56.24",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@biomejs/biome": "1.9.4",
|
|
34
34
|
"@chromatic-com/storybook": "4.1.3",
|
|
35
|
-
"@storybook/addon-a11y": "10.
|
|
36
|
-
"@storybook/addon-docs": "10.
|
|
37
|
-
"@storybook/addon-themes": "10.
|
|
38
|
-
"@storybook/addon-vitest": "
|
|
39
|
-
"@storybook/react-vite": "10.
|
|
35
|
+
"@storybook/addon-a11y": "10.2.10",
|
|
36
|
+
"@storybook/addon-docs": "10.2.10",
|
|
37
|
+
"@storybook/addon-themes": "10.2.10",
|
|
38
|
+
"@storybook/addon-vitest": "10.2.10",
|
|
39
|
+
"@storybook/react-vite": "10.2.10",
|
|
40
40
|
"@testing-library/react": "^16.3.0",
|
|
41
41
|
"@types/node": "^25.0.7",
|
|
42
42
|
"@types/react": "^19.1.5",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"@vitest/coverage-v8": "^4.0.0",
|
|
48
48
|
"axe-core": "^4.10.3",
|
|
49
49
|
"axe-playwright": "^2.1.0",
|
|
50
|
-
"glob": "^13.0.
|
|
50
|
+
"glob": "^13.0.6",
|
|
51
51
|
"lint-staged": "^15.5.2",
|
|
52
52
|
"playwright": "^1.57.0",
|
|
53
53
|
"rollup-preserve-directives": "^1.1.3",
|
|
54
|
-
"storybook": "
|
|
54
|
+
"storybook": "10.2.10",
|
|
55
55
|
"storybook-addon-tag-badges": "^3.0.4",
|
|
56
56
|
"storybook-addon-theme-provider": "^0.2.10",
|
|
57
57
|
"tsx": "^4.21.0",
|