@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 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._accountSelector_qwjt5_1{display:flex;flex-direction:column;align-items:center;padding:1rem 0;max-width:1000px;margin:0 auto;--horizontal-padding: .7rem}._heading_qwjt5_11{margin-bottom:1rem;width:100%;padding:.3rem var(--horizontal-padding)}._searchSection_qwjt5_17{width:100%;padding:0 var(--horizontal-padding);display:flex;align-items:center;gap:1rem}._searchField_qwjt5_25{width:50%}._accountMenu_qwjt5_29{height:40vh;width:100%;overflow-y:auto;margin-bottom:1rem;padding:0 var(--horizontal-padding)}._accountMenu_qwjt5_29._fullScreen_qwjt5_37{height:fit-content}._accountMenu_qwjt5_29._virtualized_qwjt5_41{overflow-y:hidden}._btnIcon_qwjt5_45{font-size:1.5rem}._spinner_qwjt5_49{margin:auto;width:100%;overflow:hidden}@media(max-width:1023px){._accountSelector_qwjt5_1{--horizontal-padding: .1rem}._searchField_qwjt5_25{width:100%}._searchSection_qwjt5_17{flex-direction:column;align-items:stretch;gap:.5rem}}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { A as o } from "../../alert-BzifOfXl.js";
|
|
2
|
-
import { B as D, C as r, a as t, b as i, D as n, L as p, c as x, d as f, P as m, e as
|
|
3
|
-
import { B as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { B as D, C as r, a as t, b as i, D as n, L as p, c as x, d as f, P as m, e as S, S as d, f as g, T as l, u as P } from "../../textfield-DAuYWtUj.js";
|
|
3
|
+
import { B as h, S as c } from "../../button-BB5sYVKY.js";
|
|
4
|
+
import { H as C, S as L } from "../../switch-Cemfhx0H.js";
|
|
5
|
+
import { D as u } from "../../index-Q0EA2XB0.js";
|
|
6
6
|
import { P as A } from "../../paragraph-BRiIBpbY.js";
|
|
7
7
|
import { S as V } from "../../index-DttADHE1.js";
|
|
8
8
|
import { V as w } from "../../index-z82sbSVU.js";
|
|
9
9
|
export {
|
|
10
10
|
o as DsAlert,
|
|
11
11
|
D as DsBadge,
|
|
12
|
-
|
|
12
|
+
h as DsButton,
|
|
13
13
|
r as DsCheckbox,
|
|
14
14
|
t as DsChip,
|
|
15
15
|
i as DsCombobox,
|
|
16
|
-
|
|
16
|
+
u as DsDetails,
|
|
17
17
|
n as DsDialog,
|
|
18
|
-
|
|
18
|
+
C as DsHeading,
|
|
19
19
|
p as DsLink,
|
|
20
20
|
x as DsListItem,
|
|
21
21
|
f as DsListUnordered,
|
|
22
22
|
m as DsPagination,
|
|
23
23
|
A as DsParagraph,
|
|
24
|
-
|
|
24
|
+
S as DsPopover,
|
|
25
25
|
V as DsSearch,
|
|
26
26
|
d as DsSkeleton,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
c as DsSpinner,
|
|
28
|
+
L as DsSwitch,
|
|
29
|
+
g as DsTabs,
|
|
30
|
+
l as DsTextfield,
|
|
31
31
|
w as DsValidationMessage,
|
|
32
|
-
|
|
32
|
+
P as useDsPagination
|
|
33
33
|
};
|
|
@@ -1,149 +1,169 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { c as
|
|
4
|
-
import
|
|
5
|
-
import { useIsDesktop as
|
|
6
|
-
import { AccountMenu as
|
|
7
|
-
import { Button as
|
|
8
|
-
import { useRootContext as
|
|
2
|
+
import { jsx as o, jsxs as b } from "react/jsx-runtime";
|
|
3
|
+
import { c as y } from "../../index-p1eeF8LQ.js";
|
|
4
|
+
import u, { forwardRef as I, useState as j, useEffect as x } from "react";
|
|
5
|
+
import { useIsDesktop as N } from "../../hooks/useIsDesktop.js";
|
|
6
|
+
import { AccountMenu as q } from "../Account/AccountMenu.js";
|
|
7
|
+
import { Button as R } from "../Button/Button.js";
|
|
8
|
+
import { useRootContext as L } from "../RootProvider/RootProvider.js";
|
|
9
9
|
import "../Snackbar/useSnackbar.js";
|
|
10
|
-
import { SearchField as
|
|
11
|
-
import { S as
|
|
12
|
-
import { H as
|
|
13
|
-
import { u as
|
|
14
|
-
import '../../assets/AccountSelector.css';var
|
|
15
|
-
var
|
|
16
|
-
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && l.indexOf(t) < 0 && (
|
|
10
|
+
import { SearchField as A } from "../Forms/SearchField.js";
|
|
11
|
+
import { S as P } from "../../button-BB5sYVKY.js";
|
|
12
|
+
import { H as V, S as H } from "../../switch-Cemfhx0H.js";
|
|
13
|
+
import { u as O } from "../../useId-BVFxCjkq.js";
|
|
14
|
+
import '../../assets/AccountSelector.css';var T = function(e, l) {
|
|
15
|
+
var n = {};
|
|
16
|
+
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && l.indexOf(t) < 0 && (n[t] = e[t]);
|
|
17
17
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
18
|
-
for (var
|
|
19
|
-
l.indexOf(t[
|
|
20
|
-
return
|
|
18
|
+
for (var r = 0, t = Object.getOwnPropertySymbols(e); r < t.length; r++)
|
|
19
|
+
l.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[r]) && (n[t[r]] = e[t[r]]);
|
|
20
|
+
return n;
|
|
21
21
|
};
|
|
22
|
-
const
|
|
23
|
-
var { title:
|
|
24
|
-
let i =
|
|
25
|
-
return i =
|
|
22
|
+
const B = I((e, l) => {
|
|
23
|
+
var { title: n, titleId: t } = e, r = T(e, ["title", "titleId"]);
|
|
24
|
+
let i = O();
|
|
25
|
+
return i = n ? t || "title-" + i : void 0, u.createElement(
|
|
26
26
|
"svg",
|
|
27
|
-
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: l, "aria-labelledby": i },
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
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: l, "aria-labelledby": i }, r),
|
|
28
|
+
n ? u.createElement("title", { id: i }, n) : null,
|
|
29
|
+
u.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M3.75 12a8.25 8.25 0 1 1 16.5 0 8.25 8.25 0 0 1-16.5 0M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25m4.03 9.28-3.5 3.5a.75.75 0 0 1-1.06 0l-3.5-3.5a.75.75 0 0 1 .53-1.28h7a.75.75 0 0 1 .53 1.28m-2.34.22h-3.38L12 13.44z", clipRule: "evenodd" })
|
|
30
30
|
);
|
|
31
31
|
});
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && l.indexOf(t) < 0 && (
|
|
32
|
+
var $ = function(e, l) {
|
|
33
|
+
var n = {};
|
|
34
|
+
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && l.indexOf(t) < 0 && (n[t] = e[t]);
|
|
35
35
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
36
|
-
for (var
|
|
37
|
-
l.indexOf(t[
|
|
38
|
-
return
|
|
36
|
+
for (var r = 0, t = Object.getOwnPropertySymbols(e); r < t.length; r++)
|
|
37
|
+
l.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[r]) && (n[t[r]] = e[t[r]]);
|
|
38
|
+
return n;
|
|
39
39
|
};
|
|
40
|
-
const
|
|
41
|
-
var { title:
|
|
42
|
-
let i =
|
|
43
|
-
return i =
|
|
40
|
+
const D = I((e, l) => {
|
|
41
|
+
var { title: n, titleId: t } = e, r = $(e, ["title", "titleId"]);
|
|
42
|
+
let i = O();
|
|
43
|
+
return i = n ? t || "title-" + i : void 0, u.createElement(
|
|
44
44
|
"svg",
|
|
45
|
-
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: l, "aria-labelledby": i },
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
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: l, "aria-labelledby": i }, r),
|
|
46
|
+
n ? u.createElement("title", { id: i }, n) : null,
|
|
47
|
+
u.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M3.75 12a8.25 8.25 0 1 1 16.5 0 8.25 8.25 0 0 1-16.5 0M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25m.53 6.72a.75.75 0 0 0-1.06 0l-3.5 3.5a.75.75 0 0 0 .53 1.28h7a.75.75 0 0 0 .53-1.28zM12 10.56l1.69 1.69h-3.38z", clipRule: "evenodd" })
|
|
48
48
|
);
|
|
49
|
-
}),
|
|
50
|
-
accountSelector:
|
|
51
|
-
heading:
|
|
52
|
-
searchSection:
|
|
53
|
-
searchField:
|
|
54
|
-
accountMenu:
|
|
55
|
-
fullScreen:
|
|
56
|
-
virtualized:
|
|
57
|
-
btnIcon:
|
|
58
|
-
spinner:
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
49
|
+
}), K = "_accountSelector_qwjt5_1", W = "_heading_qwjt5_11", G = "_searchSection_qwjt5_17", J = "_searchField_qwjt5_25", Q = "_accountMenu_qwjt5_29", U = "_fullScreen_qwjt5_37", X = "_virtualized_qwjt5_41", Y = "_btnIcon_qwjt5_45", Z = "_spinner_qwjt5_49", c = {
|
|
50
|
+
accountSelector: K,
|
|
51
|
+
heading: W,
|
|
52
|
+
searchSection: G,
|
|
53
|
+
searchField: J,
|
|
54
|
+
accountMenu: Q,
|
|
55
|
+
fullScreen: U,
|
|
56
|
+
virtualized: X,
|
|
57
|
+
btnIcon: Y,
|
|
58
|
+
spinner: Z
|
|
59
|
+
}, he = ({
|
|
60
|
+
accountMenu: e,
|
|
61
|
+
forceOpenFullScreen: l,
|
|
62
|
+
className: n,
|
|
63
|
+
loading: t,
|
|
64
|
+
showDeletedUnits: r,
|
|
65
|
+
onShowDeletedUnitsChange: i
|
|
66
|
+
}) => {
|
|
67
|
+
const { currentId: m, openId: d, closeAll: p, languageCode: g } = L(), h = N(), a = m === "accountFullscreen", [v, S] = j(""), [f, w] = j(l);
|
|
68
|
+
x(() => {
|
|
69
|
+
!l && f && a && p(), w(l);
|
|
70
|
+
}, [l]), x(() => {
|
|
71
|
+
(f === !0 && !a || !h && m === "account") && d("accountFullscreen");
|
|
72
|
+
}, [f, a, h, m, d]);
|
|
73
|
+
const { minimize: z, fullscreen: k, searchText: _, heading: C, switchLabel: E } = ee(g), F = () => {
|
|
74
|
+
d(a ? "account" : "accountFullscreen");
|
|
75
|
+
}, M = (s) => {
|
|
76
|
+
e.onSelectAccount?.(s), p(), w(!1);
|
|
70
77
|
};
|
|
71
|
-
return t ? /* @__PURE__ */
|
|
72
|
-
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
return t ? /* @__PURE__ */ o(P, { "aria-hidden": !0, "data-color": "neutral", className: c.spinner }) : /* @__PURE__ */ b("div", { className: y(n, c.accountSelector), children: [
|
|
79
|
+
/* @__PURE__ */ o(V, { "data-size": "sm", level: 2, className: c.heading, children: C }),
|
|
80
|
+
/* @__PURE__ */ b("div", { className: c.searchSection, children: [
|
|
81
|
+
/* @__PURE__ */ o(
|
|
82
|
+
A,
|
|
83
|
+
{
|
|
84
|
+
name: _,
|
|
85
|
+
placeholder: _,
|
|
86
|
+
value: v,
|
|
87
|
+
onChange: (s) => S(s.target.value),
|
|
88
|
+
onClear: () => S(""),
|
|
89
|
+
className: c.searchField
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
r !== void 0 && /* @__PURE__ */ o(
|
|
93
|
+
H,
|
|
94
|
+
{
|
|
95
|
+
checked: r,
|
|
96
|
+
onChange: (s) => i?.(s.target.checked),
|
|
97
|
+
label: E
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
] }),
|
|
101
|
+
/* @__PURE__ */ o(
|
|
85
102
|
"div",
|
|
86
103
|
{
|
|
87
|
-
className:
|
|
104
|
+
className: y(
|
|
88
105
|
c.accountMenu,
|
|
89
|
-
|
|
106
|
+
a && c.fullScreen,
|
|
90
107
|
e.isVirtualized && c.virtualized
|
|
91
108
|
),
|
|
92
|
-
children: /* @__PURE__ */
|
|
93
|
-
|
|
109
|
+
children: /* @__PURE__ */ o(
|
|
110
|
+
q,
|
|
94
111
|
{
|
|
95
112
|
...e,
|
|
96
|
-
onSelectAccount:
|
|
113
|
+
onSelectAccount: M,
|
|
97
114
|
keyboardEvents: !1,
|
|
98
115
|
search: {
|
|
99
116
|
hidden: !0,
|
|
100
117
|
name: "",
|
|
101
|
-
value:
|
|
102
|
-
getResultsLabel: (
|
|
118
|
+
value: v,
|
|
119
|
+
getResultsLabel: (s) => te(s, g)
|
|
103
120
|
},
|
|
104
|
-
scrollRefStyles: !
|
|
121
|
+
scrollRefStyles: !a && e.isVirtualized ? { maxHeight: "calc(40vh)" } : void 0
|
|
105
122
|
}
|
|
106
123
|
)
|
|
107
124
|
}
|
|
108
125
|
),
|
|
109
|
-
|
|
110
|
-
|
|
126
|
+
f !== !0 && h && /* @__PURE__ */ o(
|
|
127
|
+
R,
|
|
111
128
|
{
|
|
112
|
-
icon:
|
|
129
|
+
icon: a ? /* @__PURE__ */ o(D, { className: c.btnIcon, "aria-hidden": "true" }) : /* @__PURE__ */ o(B, { className: c.btnIcon, "aria-hidden": "true" }),
|
|
113
130
|
variant: "ghost",
|
|
114
|
-
onClick:
|
|
115
|
-
children:
|
|
131
|
+
onClick: F,
|
|
132
|
+
children: a ? z : k
|
|
116
133
|
}
|
|
117
134
|
)
|
|
118
135
|
] });
|
|
119
|
-
},
|
|
136
|
+
}, ee = (e) => {
|
|
120
137
|
switch (e) {
|
|
121
138
|
case "nn":
|
|
122
139
|
return {
|
|
123
140
|
minimize: "Minimer",
|
|
124
141
|
fullscreen: "Vis i fullskjerm",
|
|
125
142
|
searchText: "Søk i aktørar",
|
|
126
|
-
heading: "Kven vil du representere?"
|
|
143
|
+
heading: "Kven vil du representere?",
|
|
144
|
+
switchLabel: "Vis slettede"
|
|
127
145
|
};
|
|
128
146
|
case "en":
|
|
129
147
|
return {
|
|
130
148
|
minimize: "Minimize",
|
|
131
149
|
fullscreen: "Show in fullscreen",
|
|
132
150
|
searchText: "Search in actors",
|
|
133
|
-
heading: "Who do you want to represent?"
|
|
151
|
+
heading: "Who do you want to represent?",
|
|
152
|
+
switchLabel: "Show deleted"
|
|
134
153
|
};
|
|
135
154
|
default:
|
|
136
155
|
return {
|
|
137
156
|
minimize: "Minimer",
|
|
138
157
|
fullscreen: "Vis i fullskjerm",
|
|
139
158
|
searchText: "Søk i aktører",
|
|
140
|
-
heading: "Hvem vil du representere?"
|
|
159
|
+
heading: "Hvem vil du representere?",
|
|
160
|
+
switchLabel: "Vis slettede"
|
|
141
161
|
};
|
|
142
162
|
}
|
|
143
|
-
},
|
|
144
|
-
const
|
|
145
|
-
return e === 0 ?
|
|
163
|
+
}, te = (e, l) => {
|
|
164
|
+
const n = l === "nb" || l === "nn";
|
|
165
|
+
return e === 0 ? n ? "Ingen treff" : "No hits" : n ? `${e} treff` : e === 1 ? "1 hit" : `${e} hits`;
|
|
146
166
|
};
|
|
147
167
|
export {
|
|
148
|
-
|
|
168
|
+
he as AccountSelector
|
|
149
169
|
};
|
package/dist/components/index.js
CHANGED
|
@@ -211,10 +211,10 @@ import { ModalIcon as px } from "./Modal/ModalIcon.js";
|
|
|
211
211
|
import { ModalBody as xx } from "./Modal/ModalBody.js";
|
|
212
212
|
import { Modal as ix } from "./Modal/Modal.js";
|
|
213
213
|
import { A as sx } from "../alert-BzifOfXl.js";
|
|
214
|
-
import { B as lx, C as ux, a as dx, b as gx, D as Dx, L as Bx, c as Lx, d as Ix, P as Sx, e as bx,
|
|
215
|
-
import { B as
|
|
216
|
-
import {
|
|
217
|
-
import {
|
|
214
|
+
import { B as lx, C as ux, a as dx, b as gx, D as Dx, L as Bx, c as Lx, d as Ix, P as Sx, e as bx, S as Ax, f as Mx, T as yx, u as Tx } from "../textfield-DAuYWtUj.js";
|
|
215
|
+
import { B as kx, S as Hx } from "../button-BB5sYVKY.js";
|
|
216
|
+
import { H as Fx, S as Px } from "../switch-Cemfhx0H.js";
|
|
217
|
+
import { D as wx } from "../index-Q0EA2XB0.js";
|
|
218
218
|
import { P as Ox } from "../paragraph-BRiIBpbY.js";
|
|
219
219
|
import { S as Nx } from "../index-DttADHE1.js";
|
|
220
220
|
import { V as Ux } from "../index-z82sbSVU.js";
|
|
@@ -303,13 +303,13 @@ export {
|
|
|
303
303
|
Yo as DropdownBase,
|
|
304
304
|
sx as DsAlert,
|
|
305
305
|
lx as DsBadge,
|
|
306
|
-
|
|
306
|
+
kx as DsButton,
|
|
307
307
|
ux as DsCheckbox,
|
|
308
308
|
dx as DsChip,
|
|
309
309
|
gx as DsCombobox,
|
|
310
|
-
|
|
310
|
+
wx as DsDetails,
|
|
311
311
|
Dx as DsDialog,
|
|
312
|
-
|
|
312
|
+
Fx as DsHeading,
|
|
313
313
|
Bx as DsLink,
|
|
314
314
|
Lx as DsListItem,
|
|
315
315
|
Ix as DsListUnordered,
|
|
@@ -318,10 +318,10 @@ export {
|
|
|
318
318
|
bx as DsPopover,
|
|
319
319
|
Nx as DsSearch,
|
|
320
320
|
Ax as DsSkeleton,
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
321
|
+
Hx as DsSpinner,
|
|
322
|
+
Px as DsSwitch,
|
|
323
|
+
Mx as DsTabs,
|
|
324
|
+
yx as DsTextfield,
|
|
325
325
|
Ux as DsValidationMessage,
|
|
326
326
|
Ar as EndUserLabel,
|
|
327
327
|
vp as Field,
|
|
@@ -467,7 +467,7 @@ export {
|
|
|
467
467
|
i as isAvatarProps,
|
|
468
468
|
ye as isHeadingProps,
|
|
469
469
|
qr as isIconProps,
|
|
470
|
-
|
|
470
|
+
Tx as useDsPagination,
|
|
471
471
|
wt as useRootContext,
|
|
472
472
|
fm as useSnackbar
|
|
473
473
|
};
|