@altinn/altinn-components 0.50.1 → 0.50.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._badges_1csip_1{display:flex;flex-direction:row;gap:.5rem;flex-wrap:wrap;justify-content:start;margin-bottom:auto;margin-top:calc(var(--dsc-item-my) * .85)}._label_1csip_11{display:flex;flex-direction:row;align-items:center;gap:.5rem;min-width:0;flex:1;overflow:hidden}._label_1csip_11>span{min-width:0;flex:1;overflow:hidden}._label_1csip_11 span[data-size]{overflow:hidden}._label_1csip_11 span[data-size] span[data-variant=subtle]{display:-webkit-box;-webkit-line-clamp:1;line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;white-space:normal}._description_1csip_42{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%;min-width:0}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as n, jsxs as u } from "react/jsx-runtime";
|
|
3
3
|
import { Badge as y } from "../Badge/Badge.js";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
|
-
import m, { forwardRef as
|
|
5
|
+
import m, { forwardRef as v } from "react";
|
|
6
6
|
import "../RootProvider/RootProvider.js";
|
|
7
7
|
import "../Snackbar/useSnackbar.js";
|
|
8
|
-
import { ListItemLabel as
|
|
9
|
-
import { ListItem as
|
|
8
|
+
import { ListItemLabel as g } from "../List/ListItemLabel.js";
|
|
9
|
+
import { ListItem as h } from "../List/ListItem.js";
|
|
10
10
|
import { u as _ } from "../../useId-BVFxCjkq.js";
|
|
11
11
|
import '../../assets/UserListItem.css';var w = function(e, r) {
|
|
12
12
|
var l = {};
|
|
@@ -16,16 +16,16 @@ import '../../assets/UserListItem.css';var w = function(e, r) {
|
|
|
16
16
|
r.indexOf(t[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[a]) && (l[t[a]] = e[t[a]]);
|
|
17
17
|
return l;
|
|
18
18
|
};
|
|
19
|
-
const O =
|
|
19
|
+
const O = v((e, r) => {
|
|
20
20
|
var { title: l, titleId: t } = e, a = w(e, ["title", "titleId"]);
|
|
21
|
-
let
|
|
22
|
-
return
|
|
21
|
+
let i = _();
|
|
22
|
+
return i = l ? t || "title-" + i : void 0, m.createElement(
|
|
23
23
|
"svg",
|
|
24
|
-
Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: r, "aria-labelledby":
|
|
25
|
-
l ? m.createElement("title", { id:
|
|
24
|
+
Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: r, "aria-labelledby": i }, a),
|
|
25
|
+
l ? m.createElement("title", { id: i }, l) : null,
|
|
26
26
|
m.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M11.625 2.35a.75.75 0 0 1 .75 0l7.794 4.5a.75.75 0 0 1 .375.65v9a.75.75 0 0 1-.375.65l-7.779 4.49a.75.75 0 0 1-.39.11h-.006a.76.76 0 0 1-.373-.103L3.83 17.15a.75.75 0 0 1-.375-.65V7.494a.75.75 0 0 1 .382-.648zm-.375 17.351-6.294-3.634V8.799l3.486 2.013a3.751 3.751 0 0 0 2.808 4.863zM15.75 12a3.75 3.75 0 0 1-3 3.675v4.026l6.294-3.634V8.799l-3.486 2.013c.124.373.192.773.192 1.188m-1.79-1.105a2.25 2.25 0 1 1-3.919-.003l.01-.017.01-.016a2.249 2.249 0 0 1 3.9.036m.847-1.382L18.294 7.5 12 3.866 5.706 7.5l3.487 2.013A3.74 3.74 0 0 1 12 8.25a3.74 3.74 0 0 1 2.807 1.263", clipRule: "evenodd" })
|
|
27
27
|
);
|
|
28
|
-
}), I = "
|
|
28
|
+
}), I = "_badges_1csip_1", j = "_label_1csip_11", f = {
|
|
29
29
|
badges: I,
|
|
30
30
|
label: j
|
|
31
31
|
}, B = ({
|
|
@@ -34,37 +34,37 @@ const O = h((e, r) => {
|
|
|
34
34
|
description: l,
|
|
35
35
|
roleNames: t,
|
|
36
36
|
titleAs: a = "h3",
|
|
37
|
-
subUnit:
|
|
37
|
+
subUnit: i = !1,
|
|
38
38
|
loading: c = !1,
|
|
39
|
-
...
|
|
39
|
+
...s
|
|
40
40
|
}) => {
|
|
41
|
-
let
|
|
41
|
+
let o;
|
|
42
42
|
switch (r) {
|
|
43
43
|
case "person":
|
|
44
|
-
|
|
44
|
+
o = { name: e, type: "person" };
|
|
45
45
|
break;
|
|
46
46
|
case "company":
|
|
47
|
-
|
|
47
|
+
o = { name: e, type: "company", isParent: !i };
|
|
48
48
|
break;
|
|
49
49
|
case "system":
|
|
50
|
-
|
|
50
|
+
o = O;
|
|
51
51
|
break;
|
|
52
52
|
default:
|
|
53
|
-
|
|
53
|
+
o = { name: e, type: "person" };
|
|
54
54
|
}
|
|
55
|
-
const b = !c && t ? /* @__PURE__ */
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
|
|
55
|
+
const b = !c && t ? /* @__PURE__ */ n("div", { className: f.badges, children: t.map((d) => /* @__PURE__ */ n(y, { label: d, color: s.color, children: d }, d)) }) : void 0, p = /* @__PURE__ */ u("div", { className: f.label, "data-size": s.size, children: [
|
|
56
|
+
/* @__PURE__ */ n(
|
|
57
|
+
g,
|
|
58
58
|
{
|
|
59
59
|
title: { children: e, as: a },
|
|
60
60
|
description: l,
|
|
61
|
-
size:
|
|
61
|
+
size: s.size,
|
|
62
62
|
loading: c
|
|
63
63
|
}
|
|
64
64
|
),
|
|
65
65
|
b
|
|
66
66
|
] });
|
|
67
|
-
return /* @__PURE__ */
|
|
67
|
+
return /* @__PURE__ */ n(h, { icon: o, ariaLabel: e, label: p, description: l, loading: c, ...s });
|
|
68
68
|
};
|
|
69
69
|
export {
|
|
70
70
|
B as UserListItem
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
1
|
+
import { jsx as W } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as Y } from "react";
|
|
3
3
|
import "../index-L8X2o7IH.js";
|
|
4
|
-
import { IconButton as
|
|
4
|
+
import { IconButton as q } from "../components/Button/IconButton.js";
|
|
5
5
|
import "../components/RootProvider/RootProvider.js";
|
|
6
|
-
import { useIsDesktop as
|
|
6
|
+
import { useIsDesktop as J } from "./useIsDesktop.js";
|
|
7
7
|
import "../components/Snackbar/useSnackbar.js";
|
|
8
8
|
import { formatDisplayName as S } from "../functions/name/name.js";
|
|
9
|
-
import { formatDate as
|
|
9
|
+
import { formatDate as K } from "../functions/date/date.js";
|
|
10
10
|
import { S as Q, a as X } from "../HeartFill-CYSrJ_xK.js";
|
|
11
11
|
const O = (t) => t === "Organization" ? "company" : "person", ro = ({
|
|
12
12
|
partyListDTO: t = [],
|
|
@@ -14,12 +14,12 @@ const O = (t) => t === "Organization" ? "company" : "person", ro = ({
|
|
|
14
14
|
currentAccountUuid: f,
|
|
15
15
|
selfAccountUuid: m,
|
|
16
16
|
isLoading: d = !1,
|
|
17
|
-
onSelectAccount:
|
|
17
|
+
onSelectAccount: v,
|
|
18
18
|
isVirtualized: h = !1,
|
|
19
19
|
onToggleFavorite: s,
|
|
20
20
|
languageCode: r
|
|
21
21
|
}) => {
|
|
22
|
-
const i =
|
|
22
|
+
const i = J(), [c, _, b] = Y(() => {
|
|
23
23
|
var A, N;
|
|
24
24
|
if (d || !t || !m)
|
|
25
25
|
return [[], {}, void 0];
|
|
@@ -46,7 +46,7 @@ const O = (t) => t === "Organization" ? "company" : "person", ro = ({
|
|
|
46
46
|
s,
|
|
47
47
|
i
|
|
48
48
|
)
|
|
49
|
-
),
|
|
49
|
+
), l = [];
|
|
50
50
|
for (const e of j) {
|
|
51
51
|
const u = g(
|
|
52
52
|
r,
|
|
@@ -57,10 +57,10 @@ const O = (t) => t === "Organization" ? "company" : "person", ro = ({
|
|
|
57
57
|
s,
|
|
58
58
|
i
|
|
59
59
|
);
|
|
60
|
-
if (
|
|
61
|
-
const
|
|
62
|
-
for (const $ of
|
|
63
|
-
const
|
|
60
|
+
if (l.push(u), e.subunits && e.subunits.length > 0) {
|
|
61
|
+
const R = [...e.subunits].sort(z);
|
|
62
|
+
for (const $ of R) {
|
|
63
|
+
const U = g(
|
|
64
64
|
r,
|
|
65
65
|
$,
|
|
66
66
|
e.partyUuid,
|
|
@@ -70,12 +70,12 @@ const O = (t) => t === "Organization" ? "company" : "person", ro = ({
|
|
|
70
70
|
i,
|
|
71
71
|
e
|
|
72
72
|
);
|
|
73
|
-
|
|
73
|
+
l.push(U);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
const M = k.reduce((e, u) => (n(u.id) && e.push({ ...u, groupId: "favorites" }), e), []), V =
|
|
78
|
-
[((A =
|
|
77
|
+
const M = k.reduce((e, u) => (n(u.id) && e.push({ ...u, groupId: "favorites" }), e), []), V = l.reduce((e, u) => (n(u.id) && e.push({ ...u, groupId: "favorites" }), e), []), w = [...M, ...V], x = [H, ...w, ...k, ...l], G = x.find((e) => (e == null ? void 0 : e.selected) === !0), E = {
|
|
78
|
+
[((A = l[0]) == null ? void 0 : A.groupId) || "company"]: {
|
|
79
79
|
title: a.account_orgs,
|
|
80
80
|
divider: !0
|
|
81
81
|
},
|
|
@@ -99,7 +99,7 @@ const O = (t) => t === "Organization" ? "company" : "person", ro = ({
|
|
|
99
99
|
r,
|
|
100
100
|
i
|
|
101
101
|
]);
|
|
102
|
-
return d || !t || !
|
|
102
|
+
return d || !t || !b ? {
|
|
103
103
|
accountMenu: {
|
|
104
104
|
items: [],
|
|
105
105
|
groups: {},
|
|
@@ -112,18 +112,18 @@ const O = (t) => t === "Organization" ? "company" : "person", ro = ({
|
|
|
112
112
|
} : {
|
|
113
113
|
accountMenu: {
|
|
114
114
|
items: c,
|
|
115
|
-
groups:
|
|
115
|
+
groups: _,
|
|
116
116
|
isVirtualized: h,
|
|
117
|
-
onSelectAccount:
|
|
118
|
-
currentAccount:
|
|
117
|
+
onSelectAccount: v,
|
|
118
|
+
currentAccount: b
|
|
119
119
|
},
|
|
120
120
|
loading: !1
|
|
121
121
|
};
|
|
122
|
-
}, g = (t, o, f, m, d,
|
|
123
|
-
const i = O((o == null ? void 0 : o.type) ?? ""), c = F(t),
|
|
122
|
+
}, g = (t, o, f, m, d, v, h, s, r) => {
|
|
123
|
+
const i = O((o == null ? void 0 : o.type) ?? ""), c = F(t), _ = S({
|
|
124
124
|
fullName: o == null ? void 0 : o.name,
|
|
125
125
|
type: i
|
|
126
|
-
}),
|
|
126
|
+
}), b = s ? S({
|
|
127
127
|
fullName: s == null ? void 0 : s.name,
|
|
128
128
|
type: O((s == null ? void 0 : s.type) ?? ""),
|
|
129
129
|
reverseNameOrder: !1
|
|
@@ -135,10 +135,10 @@ const O = (t) => t === "Organization" ? "company" : "person", ro = ({
|
|
|
135
135
|
n = `${c.org_no}: ${o.organizationNumber}`;
|
|
136
136
|
break;
|
|
137
137
|
case "person":
|
|
138
|
-
n = o != null && o.dateOfBirth ? `${c.birthdate}: ${
|
|
138
|
+
n = o != null && o.dateOfBirth ? `${c.birthdate}: ${K(o == null ? void 0 : o.dateOfBirth)}` : "";
|
|
139
139
|
break;
|
|
140
140
|
case "subunit":
|
|
141
|
-
n = `↳ ${c.org_no}: ${o == null ? void 0 : o.organizationNumber}, ${c.subunit_of} ${
|
|
141
|
+
n = `↳ ${c.org_no}: ${o == null ? void 0 : o.organizationNumber}, ${c.subunit_of} ${b}`;
|
|
142
142
|
break;
|
|
143
143
|
default:
|
|
144
144
|
n = "";
|
|
@@ -146,28 +146,27 @@ const O = (t) => t === "Organization" ? "company" : "person", ro = ({
|
|
|
146
146
|
return {
|
|
147
147
|
id: o == null ? void 0 : o.partyUuid,
|
|
148
148
|
icon: {
|
|
149
|
-
name:
|
|
149
|
+
name: _,
|
|
150
150
|
type: i,
|
|
151
151
|
isParent: !s,
|
|
152
|
-
isDeleted: o == null ? void 0 : o.isDeleted
|
|
153
|
-
colorKey: l ?? void 0
|
|
152
|
+
isDeleted: o == null ? void 0 : o.isDeleted
|
|
154
153
|
},
|
|
155
|
-
name:
|
|
154
|
+
name: _,
|
|
156
155
|
description: n,
|
|
157
156
|
groupId: f,
|
|
158
157
|
type: a,
|
|
159
158
|
selected: m === (o == null ? void 0 : o.partyUuid),
|
|
160
159
|
disabled: !!(o != null && o.onlyHierarchyElementWithNoAccess),
|
|
161
160
|
badge: r ? { label: c.you, color: "person" } : o.isDeleted && h ? { label: c.deleted, color: "neutral" } : void 0,
|
|
162
|
-
controls: !r && /* @__PURE__ */
|
|
163
|
-
|
|
161
|
+
controls: !r && /* @__PURE__ */ W(
|
|
162
|
+
q,
|
|
164
163
|
{
|
|
165
164
|
rounded: !0,
|
|
166
165
|
variant: "text",
|
|
167
166
|
icon: d ? Q : X,
|
|
168
167
|
iconAltText: d ? c.remove_from_favorites : c.add_to_favorites,
|
|
169
168
|
onClick: (I) => {
|
|
170
|
-
|
|
169
|
+
v && (I.stopPropagation(), v(o == null ? void 0 : o.partyUuid));
|
|
171
170
|
},
|
|
172
171
|
size: "xs"
|
|
173
172
|
}
|
|
@@ -115,5 +115,6 @@ export default meta;
|
|
|
115
115
|
export declare const Default: (args: UserListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
116
116
|
export declare const MultipleRoles: (args: UserListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
117
117
|
export declare const WithSubUnits: (args: UserListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
118
|
+
export declare const WithInheritingParties: (args: UserListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
118
119
|
export declare const DifferentHeadingLevelsAndSizes: (args: UserListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
119
120
|
export declare const WithControls: (args: UserListItemProps) => import("react/jsx-runtime").JSX.Element;
|