@altinn/altinn-components 0.53.0 → 0.53.1
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/assets/AccountSelector.css +1 -1
- package/dist/components/DsComponents/index.js +13 -13
- package/dist/components/GlobalHeader/AccountSelector.js +113 -93
- package/dist/components/index.js +12 -12
- package/dist/hooks/useAccountSelector.js +128 -106
- package/dist/index.js +12 -12
- package/dist/switch-Cemfhx0H.js +18 -0
- package/dist/{textfield-C_c2H05R.js → textfield-DAuYWtUj.js} +91 -94
- package/dist/types/lib/components/GlobalHeader/AccountSector.stories.d.ts +1 -1
- package/dist/types/lib/components/GlobalHeader/AccountSelector.d.ts +5 -1
- package/dist/types/lib/hooks/useAccountSelector.d.ts +5 -1
- package/package.json +2 -2
- package/dist/heading-C_XYsUfi.js +0 -12
|
@@ -1,104 +1,124 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
1
|
+
import { jsx as k } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as H } from "react";
|
|
3
3
|
import "../index-p1eeF8LQ.js";
|
|
4
|
-
import { Button as
|
|
4
|
+
import { Button as M } from "../components/Button/Button.js";
|
|
5
5
|
import "../components/RootProvider/RootProvider.js";
|
|
6
|
-
import { useIsDesktop as
|
|
6
|
+
import { useIsDesktop as G } from "./useIsDesktop.js";
|
|
7
7
|
import "../components/Snackbar/useSnackbar.js";
|
|
8
|
-
import { formatDisplayName as
|
|
9
|
-
import { formatDate as
|
|
10
|
-
import { S as
|
|
11
|
-
const
|
|
8
|
+
import { formatDisplayName as S } from "../functions/name/name.js";
|
|
9
|
+
import { formatDate as E } from "../functions/date/date.js";
|
|
10
|
+
import { S as R, a as W } from "../HeartFill-CYSrJ_xK.js";
|
|
11
|
+
const x = (e) => e === "Organization" ? "company" : "person", et = ({
|
|
12
12
|
partyListDTO: e = [],
|
|
13
13
|
favoriteAccountUuids: o,
|
|
14
|
-
currentAccountUuid:
|
|
15
|
-
selfAccountUuid:
|
|
16
|
-
isLoading:
|
|
17
|
-
onSelectAccount:
|
|
18
|
-
isVirtualized:
|
|
14
|
+
currentAccountUuid: f,
|
|
15
|
+
selfAccountUuid: l,
|
|
16
|
+
isLoading: d = !1,
|
|
17
|
+
onSelectAccount: b,
|
|
18
|
+
isVirtualized: I = !1,
|
|
19
19
|
onToggleFavorite: r,
|
|
20
|
-
languageCode:
|
|
20
|
+
languageCode: i,
|
|
21
|
+
showDeletedUnits: u,
|
|
22
|
+
onShowDeletedUnitsChange: n
|
|
21
23
|
}) => {
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
+
const c = G(), [P, m, v] = H(() => {
|
|
25
|
+
if (d || !e || !l)
|
|
24
26
|
return [[], {}, void 0];
|
|
25
|
-
const s = (t) => o?.includes(t),
|
|
27
|
+
const s = (t) => o?.includes(t), _ = (t) => !t.isDeleted || u !== !1, z = D(i), F = i || "nb", N = (t, a) => t.name.localeCompare(a.name, F, {
|
|
26
28
|
sensitivity: "base",
|
|
27
29
|
ignorePunctuation: !0
|
|
28
|
-
}),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
for (const t of D) {
|
|
50
|
-
const c = b(
|
|
51
|
-
n,
|
|
52
|
-
t,
|
|
53
|
-
t.partyUuid,
|
|
54
|
-
u,
|
|
55
|
-
s(t.partyUuid),
|
|
56
|
-
r,
|
|
57
|
-
i
|
|
58
|
-
);
|
|
59
|
-
if (l.push(c), t.subunits && t.subunits.length > 0) {
|
|
60
|
-
const V = [...t.subunits].sort(I);
|
|
61
|
-
for (const P of V) {
|
|
62
|
-
const w = b(
|
|
63
|
-
n,
|
|
64
|
-
P,
|
|
30
|
+
}), B = [...e].sort(N);
|
|
31
|
+
let A;
|
|
32
|
+
const U = [], y = [], g = [];
|
|
33
|
+
for (const t of B)
|
|
34
|
+
if (q(t.type)) {
|
|
35
|
+
if (t.partyUuid === l)
|
|
36
|
+
A = h(
|
|
37
|
+
i,
|
|
38
|
+
t,
|
|
39
|
+
"favorites",
|
|
40
|
+
f,
|
|
41
|
+
!1,
|
|
42
|
+
r,
|
|
43
|
+
c,
|
|
44
|
+
void 0,
|
|
45
|
+
!0
|
|
46
|
+
);
|
|
47
|
+
else if (_(t) || s(t.partyUuid)) {
|
|
48
|
+
const a = h(
|
|
49
|
+
i,
|
|
50
|
+
t,
|
|
65
51
|
t.partyUuid,
|
|
66
|
-
|
|
67
|
-
s(
|
|
52
|
+
f,
|
|
53
|
+
s(t.partyUuid),
|
|
68
54
|
r,
|
|
55
|
+
c
|
|
56
|
+
);
|
|
57
|
+
U.push(a), s(t.partyUuid) && g.push({ ...a, groupId: "favorites" });
|
|
58
|
+
}
|
|
59
|
+
} else if (Y(t.type)) {
|
|
60
|
+
if (_(t) || s(t.partyUuid)) {
|
|
61
|
+
const a = h(
|
|
69
62
|
i,
|
|
70
|
-
t
|
|
63
|
+
t,
|
|
64
|
+
t.partyUuid,
|
|
65
|
+
f,
|
|
66
|
+
s(t.partyUuid),
|
|
67
|
+
r,
|
|
68
|
+
c
|
|
71
69
|
);
|
|
72
|
-
|
|
70
|
+
_(t) && y.push(a), s(t.partyUuid) && g.push({ ...a, groupId: "favorites" });
|
|
71
|
+
}
|
|
72
|
+
if (t.subunits && t.subunits.length > 0) {
|
|
73
|
+
const a = [...t.subunits].sort(N);
|
|
74
|
+
for (const p of a)
|
|
75
|
+
if (_(p) || s(p.partyUuid)) {
|
|
76
|
+
const O = h(
|
|
77
|
+
i,
|
|
78
|
+
p,
|
|
79
|
+
t.partyUuid,
|
|
80
|
+
f,
|
|
81
|
+
s(p.partyUuid),
|
|
82
|
+
r,
|
|
83
|
+
c,
|
|
84
|
+
t
|
|
85
|
+
);
|
|
86
|
+
_(p) && y.push(O), s(p.partyUuid) && g.push({
|
|
87
|
+
...O,
|
|
88
|
+
groupId: "favorites"
|
|
89
|
+
});
|
|
90
|
+
}
|
|
73
91
|
}
|
|
74
92
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
93
|
+
if (A === void 0)
|
|
94
|
+
return [[], {}, void 0];
|
|
95
|
+
const $ = [A, ...g, ...U, ...y], V = $.find((t) => t?.selected === !0), j = {
|
|
96
|
+
[y[0]?.groupId || "company"]: {
|
|
97
|
+
title: z.account_orgs,
|
|
79
98
|
divider: !0
|
|
80
99
|
},
|
|
81
|
-
[
|
|
82
|
-
title:
|
|
100
|
+
[U[0]?.groupId || "person"]: {
|
|
101
|
+
title: z.account_persons,
|
|
83
102
|
divider: !0
|
|
84
103
|
},
|
|
85
104
|
favorites: {
|
|
86
|
-
title:
|
|
105
|
+
title: z.account_favorites,
|
|
87
106
|
divider: !0
|
|
88
107
|
}
|
|
89
108
|
};
|
|
90
|
-
return [
|
|
109
|
+
return [$, j, V];
|
|
91
110
|
}, [
|
|
92
111
|
e,
|
|
93
|
-
|
|
112
|
+
l,
|
|
94
113
|
o,
|
|
95
|
-
u,
|
|
96
114
|
f,
|
|
115
|
+
d,
|
|
97
116
|
r,
|
|
98
|
-
|
|
99
|
-
|
|
117
|
+
i,
|
|
118
|
+
c,
|
|
119
|
+
u
|
|
100
120
|
]);
|
|
101
|
-
return
|
|
121
|
+
return d || !e || !v ? {
|
|
102
122
|
accountMenu: {
|
|
103
123
|
items: [],
|
|
104
124
|
groups: {},
|
|
@@ -107,71 +127,73 @@ const N = (e) => e === "Organization" ? "company" : "person", rt = ({
|
|
|
107
127
|
},
|
|
108
128
|
currentAccount: void 0
|
|
109
129
|
},
|
|
110
|
-
loading:
|
|
130
|
+
loading: d
|
|
111
131
|
} : {
|
|
112
132
|
accountMenu: {
|
|
113
|
-
items:
|
|
114
|
-
groups:
|
|
115
|
-
isVirtualized:
|
|
116
|
-
onSelectAccount:
|
|
117
|
-
currentAccount:
|
|
133
|
+
items: P,
|
|
134
|
+
groups: m,
|
|
135
|
+
isVirtualized: I,
|
|
136
|
+
onSelectAccount: b,
|
|
137
|
+
currentAccount: v
|
|
118
138
|
},
|
|
119
|
-
loading: !1
|
|
139
|
+
loading: !1,
|
|
140
|
+
showDeletedUnits: u,
|
|
141
|
+
onShowDeletedUnitsChange: n
|
|
120
142
|
};
|
|
121
|
-
},
|
|
122
|
-
const
|
|
143
|
+
}, h = (e, o, f, l, d, b, I, r, i) => {
|
|
144
|
+
const u = x(o?.type ?? ""), n = D(e), c = S({
|
|
123
145
|
fullName: o?.name,
|
|
124
|
-
type:
|
|
125
|
-
}),
|
|
146
|
+
type: u
|
|
147
|
+
}), P = r ? S({
|
|
126
148
|
fullName: r?.name,
|
|
127
|
-
type:
|
|
149
|
+
type: x(r?.type ?? ""),
|
|
128
150
|
reverseNameOrder: !1
|
|
129
151
|
}) : void 0;
|
|
130
|
-
let
|
|
131
|
-
const
|
|
132
|
-
switch (
|
|
152
|
+
let m = "";
|
|
153
|
+
const v = u === "company" && r ? "subunit" : u;
|
|
154
|
+
switch (v) {
|
|
133
155
|
case "company":
|
|
134
|
-
|
|
156
|
+
m = `${n.org_no}. ${o.organizationNumber}`;
|
|
135
157
|
break;
|
|
136
158
|
case "person":
|
|
137
|
-
|
|
159
|
+
m = o?.dateOfBirth ? `${n.birthdate}: ${E(o?.dateOfBirth)}` : "";
|
|
138
160
|
break;
|
|
139
161
|
case "subunit":
|
|
140
|
-
|
|
162
|
+
m = `↳ ${n.org_no}: ${o?.organizationNumber}, ${n.subunit_of} ${P}`;
|
|
141
163
|
break;
|
|
142
164
|
default:
|
|
143
|
-
|
|
165
|
+
m = "";
|
|
144
166
|
}
|
|
145
167
|
return {
|
|
146
168
|
id: o?.partyUuid,
|
|
147
169
|
icon: {
|
|
148
|
-
name:
|
|
149
|
-
type:
|
|
170
|
+
name: c,
|
|
171
|
+
type: u,
|
|
150
172
|
isParent: !r,
|
|
151
173
|
isDeleted: o?.isDeleted
|
|
152
174
|
},
|
|
153
|
-
name:
|
|
154
|
-
description:
|
|
155
|
-
groupId:
|
|
156
|
-
type:
|
|
157
|
-
selected:
|
|
175
|
+
name: c,
|
|
176
|
+
description: m,
|
|
177
|
+
groupId: f,
|
|
178
|
+
type: v,
|
|
179
|
+
selected: l === o?.partyUuid,
|
|
158
180
|
disabled: !!o?.onlyHierarchyElementWithNoAccess,
|
|
159
|
-
badge:
|
|
160
|
-
controls: !
|
|
161
|
-
|
|
181
|
+
badge: i ? { label: n.you, color: "person" } : o.isDeleted && I ? { label: n.deleted, color: "neutral" } : void 0,
|
|
182
|
+
controls: !i && /* @__PURE__ */ k(
|
|
183
|
+
M,
|
|
162
184
|
{
|
|
163
185
|
rounded: !0,
|
|
164
186
|
variant: "ghost",
|
|
165
|
-
"aria-label":
|
|
166
|
-
onClick: (
|
|
167
|
-
|
|
187
|
+
"aria-label": d ? n.remove_from_favorites : n.add_to_favorites,
|
|
188
|
+
onClick: (s) => {
|
|
189
|
+
b && (s.stopPropagation(), b(o?.partyUuid));
|
|
168
190
|
},
|
|
169
191
|
size: "xs",
|
|
170
|
-
children:
|
|
192
|
+
children: d ? /* @__PURE__ */ k(R, {}) : /* @__PURE__ */ k(W, {})
|
|
171
193
|
}
|
|
172
194
|
)
|
|
173
195
|
};
|
|
174
|
-
},
|
|
196
|
+
}, Y = (e) => e === "Organization", q = (e) => e === "Person" || e === "SelfIdentified", D = (e) => {
|
|
175
197
|
switch (e) {
|
|
176
198
|
case "nn":
|
|
177
199
|
return {
|
|
@@ -215,5 +237,5 @@ const N = (e) => e === "Organization" ? "company" : "person", rt = ({
|
|
|
215
237
|
}
|
|
216
238
|
};
|
|
217
239
|
export {
|
|
218
|
-
|
|
240
|
+
et as useAccountSelector
|
|
219
241
|
};
|
package/dist/index.js
CHANGED
|
@@ -217,10 +217,10 @@ import { useAccountSelector as Dx } from "./hooks/useAccountSelector.js";
|
|
|
217
217
|
import { formatDisplayName as Lx } from "./functions/name/name.js";
|
|
218
218
|
import { formatDate as Sx } from "./functions/date/date.js";
|
|
219
219
|
import { A as Ax } from "./alert-BzifOfXl.js";
|
|
220
|
-
import { B as yx, C as Tx, a as hx, b as kx, D as Cx, L as Hx, c as Fx, d as Px, P as vx, e as wx,
|
|
221
|
-
import { B as
|
|
222
|
-
import {
|
|
223
|
-
import {
|
|
220
|
+
import { B as yx, C as Tx, a as hx, b as kx, D as Cx, L as Hx, c as Fx, d as Px, P as vx, e as wx, S as Gx, f as Ox, T as Ex, u as Nx } from "./textfield-DAuYWtUj.js";
|
|
221
|
+
import { B as Ux, S as zx } from "./button-BB5sYVKY.js";
|
|
222
|
+
import { H as Vx, S as _x } from "./switch-Cemfhx0H.js";
|
|
223
|
+
import { D as jx } from "./index-Q0EA2XB0.js";
|
|
224
224
|
import { P as Jx } from "./paragraph-BRiIBpbY.js";
|
|
225
225
|
import { S as Xx } from "./index-DttADHE1.js";
|
|
226
226
|
import { V as Zx } from "./index-z82sbSVU.js";
|
|
@@ -309,13 +309,13 @@ export {
|
|
|
309
309
|
Yo as DropdownBase,
|
|
310
310
|
Ax as DsAlert,
|
|
311
311
|
yx as DsBadge,
|
|
312
|
-
|
|
312
|
+
Ux as DsButton,
|
|
313
313
|
Tx as DsCheckbox,
|
|
314
314
|
hx as DsChip,
|
|
315
315
|
kx as DsCombobox,
|
|
316
|
-
|
|
316
|
+
jx as DsDetails,
|
|
317
317
|
Cx as DsDialog,
|
|
318
|
-
|
|
318
|
+
Vx as DsHeading,
|
|
319
319
|
Hx as DsLink,
|
|
320
320
|
Fx as DsListItem,
|
|
321
321
|
Px as DsListUnordered,
|
|
@@ -324,10 +324,10 @@ export {
|
|
|
324
324
|
wx as DsPopover,
|
|
325
325
|
Xx as DsSearch,
|
|
326
326
|
Gx as DsSkeleton,
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
327
|
+
zx as DsSpinner,
|
|
328
|
+
_x as DsSwitch,
|
|
329
|
+
Ox as DsTabs,
|
|
330
|
+
Ex as DsTextfield,
|
|
331
331
|
Zx as DsValidationMessage,
|
|
332
332
|
Ar as EndUserLabel,
|
|
333
333
|
vp as Field,
|
|
@@ -477,7 +477,7 @@ export {
|
|
|
477
477
|
jr as isIconProps,
|
|
478
478
|
Dx as useAccountSelector,
|
|
479
479
|
nx as useClickOutside,
|
|
480
|
-
|
|
480
|
+
Nx as useDsPagination,
|
|
481
481
|
lx as useEscapeKey,
|
|
482
482
|
dx as useMenu,
|
|
483
483
|
wt as useRootContext,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
3
|
+
import { S as p } from "./index-D7FJjvrv.js";
|
|
4
|
+
import { c as h } from "./lite-1fxw3LjI.js";
|
|
5
|
+
import { forwardRef as n } from "react";
|
|
6
|
+
import { F as u } from "./index-z82sbSVU.js";
|
|
7
|
+
import { I as g } from "./input-wBv_FkEV.js";
|
|
8
|
+
import { L as w } from "./label-xTmTyPhk.js";
|
|
9
|
+
const F = n(function({ level: e = 2, className: a, asChild: i, ...t }, o) {
|
|
10
|
+
const s = i ? p : `h${e}`;
|
|
11
|
+
return r(s, { className: h("ds-heading", a), ref: o, ...t });
|
|
12
|
+
}), I = n(function({ "data-size": e, children: a, className: i, description: t, label: o, position: s, style: m, ...d }, f) {
|
|
13
|
+
return l(u, { className: i, "data-position": s, "data-size": e, style: m, children: [r(g, { type: "checkbox", role: "switch", ref: f, ...d }), !!o && r(w, { weight: "regular", children: o }), !!t && r("div", { "data-field": "description", children: t })] });
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
F as H,
|
|
17
|
+
I as S
|
|
18
|
+
};
|