@altinn/altinn-components 0.63.1 → 0.63.2
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,90 +1,93 @@
|
|
|
1
|
-
import { jsx as c, jsxs as
|
|
2
|
-
import { c as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { AccountMenu as
|
|
1
|
+
import { jsx as c, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { c as _ } from "../../index-p1eeF8LQ.js";
|
|
3
|
+
import { useState as o, useRef as T, useEffect as g } from "react";
|
|
4
|
+
import { AccountMenu as F } from "../Account/AccountMenu.js";
|
|
5
5
|
import "../Typography/Link.js";
|
|
6
6
|
import "../Button/Button.js";
|
|
7
7
|
import "react-dom";
|
|
8
|
-
import { u as
|
|
8
|
+
import { u as H, S as R } from "../../ToolbarSearch-DT-KvnVb.js";
|
|
9
9
|
import "../Snackbar/useSnackbar.js";
|
|
10
|
-
import { Switch as
|
|
11
|
-
import { S as
|
|
12
|
-
import { H as
|
|
13
|
-
import '../../assets/AccountSelector.css';const
|
|
14
|
-
accountSelector:
|
|
15
|
-
heading:
|
|
16
|
-
searchSection:
|
|
17
|
-
searchField:
|
|
18
|
-
accountMenu:
|
|
19
|
-
virtualized:
|
|
20
|
-
spinner:
|
|
21
|
-
},
|
|
10
|
+
import { Switch as y } from "../Forms/Switch.js";
|
|
11
|
+
import { S as I } from "../../button-BB5sYVKY.js";
|
|
12
|
+
import { H as M } from "../../heading-C_XYsUfi.js";
|
|
13
|
+
import '../../assets/AccountSelector.css';const j = "_accountSelector_829wd_1", E = "_heading_829wd_11", V = "_searchSection_829wd_17", $ = "_searchField_829wd_30", K = "_accountMenu_829wd_34", O = "_virtualized_829wd_43", W = "_spinner_829wd_58", r = {
|
|
14
|
+
accountSelector: j,
|
|
15
|
+
heading: E,
|
|
16
|
+
searchSection: V,
|
|
17
|
+
searchField: $,
|
|
18
|
+
accountMenu: K,
|
|
19
|
+
virtualized: O,
|
|
20
|
+
spinner: W
|
|
21
|
+
}, re = ({
|
|
22
22
|
accountMenu: e,
|
|
23
|
-
forceOpenFullScreen:
|
|
24
|
-
className:
|
|
25
|
-
loading:
|
|
26
|
-
showDeletedUnits:
|
|
27
|
-
onShowDeletedUnitsChange:
|
|
28
|
-
isFullScreen:
|
|
23
|
+
forceOpenFullScreen: n,
|
|
24
|
+
className: s,
|
|
25
|
+
loading: v,
|
|
26
|
+
showDeletedUnits: i,
|
|
27
|
+
onShowDeletedUnitsChange: w,
|
|
28
|
+
isFullScreen: x
|
|
29
29
|
}) => {
|
|
30
|
-
const { closeAll:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}, [
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
const { closeAll: l, languageCode: d, currentId: b } = H(), a = b === "account" || !!n, [u, h] = o(""), [z, m] = o(n), [N, k] = o(0), S = T(a);
|
|
31
|
+
g(() => {
|
|
32
|
+
a && !S.current && k((t) => t + 1), S.current = a;
|
|
33
|
+
}, [a]), g(() => {
|
|
34
|
+
!n && z && l(), m(n);
|
|
35
|
+
}, [n]);
|
|
36
|
+
const { searchText: p, heading: A, switchLabel: C } = q(d), L = (t) => {
|
|
37
|
+
e.onSelectAccount?.(t), l(), m(!1);
|
|
36
38
|
};
|
|
37
|
-
return
|
|
38
|
-
/* @__PURE__ */ c(
|
|
39
|
-
/* @__PURE__ */
|
|
39
|
+
return v ? /* @__PURE__ */ c(I, { "aria-hidden": !0, "data-color": "neutral", className: r.spinner }) : /* @__PURE__ */ f("div", { className: _(s, r.accountSelector), children: [
|
|
40
|
+
/* @__PURE__ */ c(M, { "data-size": "sm", level: 2, className: r.heading, children: A }),
|
|
41
|
+
/* @__PURE__ */ f("div", { className: r.searchSection, children: [
|
|
40
42
|
/* @__PURE__ */ c(
|
|
41
|
-
|
|
43
|
+
R,
|
|
42
44
|
{
|
|
43
45
|
size: "sm",
|
|
44
|
-
name:
|
|
45
|
-
placeholder:
|
|
46
|
-
value:
|
|
47
|
-
onChange: (
|
|
48
|
-
onClear: () =>
|
|
49
|
-
className:
|
|
46
|
+
name: p,
|
|
47
|
+
placeholder: p,
|
|
48
|
+
value: u,
|
|
49
|
+
onChange: (t) => h(t.target.value),
|
|
50
|
+
onClear: () => h(""),
|
|
51
|
+
className: r.searchField
|
|
50
52
|
}
|
|
51
53
|
),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
i !== void 0 && /* @__PURE__ */ c(
|
|
55
|
+
y,
|
|
54
56
|
{
|
|
55
57
|
size: "sm",
|
|
56
|
-
checked:
|
|
57
|
-
onChange: (
|
|
58
|
-
label:
|
|
58
|
+
checked: i,
|
|
59
|
+
onChange: (t) => w?.(t.target.checked),
|
|
60
|
+
label: C
|
|
59
61
|
}
|
|
60
62
|
)
|
|
61
63
|
] }),
|
|
62
64
|
/* @__PURE__ */ c(
|
|
63
65
|
"div",
|
|
64
66
|
{
|
|
65
|
-
className:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
e.virtualized &&
|
|
67
|
+
className: _(
|
|
68
|
+
r.accountMenu,
|
|
69
|
+
x && r.fullScreen,
|
|
70
|
+
e.virtualized && r.virtualized
|
|
69
71
|
),
|
|
70
72
|
children: /* @__PURE__ */ c(
|
|
71
|
-
|
|
73
|
+
F,
|
|
72
74
|
{
|
|
73
75
|
...e,
|
|
74
|
-
onSelectAccount:
|
|
76
|
+
onSelectAccount: L,
|
|
75
77
|
keyboardEvents: !1,
|
|
76
78
|
search: {
|
|
77
79
|
hidden: !0,
|
|
78
80
|
name: "",
|
|
79
|
-
value:
|
|
80
|
-
getResultsLabel: (
|
|
81
|
+
value: u,
|
|
82
|
+
getResultsLabel: (t) => B(t, d)
|
|
81
83
|
}
|
|
82
|
-
}
|
|
84
|
+
},
|
|
85
|
+
N
|
|
83
86
|
)
|
|
84
87
|
}
|
|
85
88
|
)
|
|
86
89
|
] });
|
|
87
|
-
},
|
|
90
|
+
}, q = (e) => {
|
|
88
91
|
switch (e) {
|
|
89
92
|
case "nn":
|
|
90
93
|
return {
|
|
@@ -105,10 +108,10 @@ import '../../assets/AccountSelector.css';const C = "_accountSelector_829wd_1",
|
|
|
105
108
|
switchLabel: "Vis slettede"
|
|
106
109
|
};
|
|
107
110
|
}
|
|
108
|
-
},
|
|
109
|
-
const
|
|
110
|
-
return e === 0 ?
|
|
111
|
+
}, B = (e, n) => {
|
|
112
|
+
const s = n === "nb" || n === "nn";
|
|
113
|
+
return e === 0 ? s ? "Ingen treff" : "No hits" : s ? `${e} treff` : e === 1 ? "1 hit" : `${e} hits`;
|
|
111
114
|
};
|
|
112
115
|
export {
|
|
113
|
-
|
|
116
|
+
re as AccountSelector
|
|
114
117
|
};
|