@altinn/altinn-components 0.56.25 → 0.56.26
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,50 +1,51 @@
|
|
|
1
|
-
import { jsx as c, jsxs as
|
|
1
|
+
import { jsx as c, jsxs as S } from "react/jsx-runtime";
|
|
2
2
|
import { c as p } from "../../index-p1eeF8LQ.js";
|
|
3
3
|
import { useState as _, useEffect as g } from "react";
|
|
4
|
-
import { useLockBodyScroll as
|
|
5
|
-
import { AccountMenu as
|
|
4
|
+
import { useLockBodyScroll as L } from "../../hooks/useLockBodyScroll.js";
|
|
5
|
+
import { AccountMenu as A } from "../Account/AccountMenu.js";
|
|
6
6
|
import "../Button/Button.js";
|
|
7
7
|
import "react-dom";
|
|
8
|
-
import { useRootContext as
|
|
8
|
+
import { useRootContext as M } from "../RootProvider/RootProvider.js";
|
|
9
9
|
import "../Snackbar/useSnackbar.js";
|
|
10
|
-
import { S 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 { S as F } from "../../SearchField-QTfebYdU.js";
|
|
11
|
+
import { S as T } from "../../button-BB5sYVKY.js";
|
|
12
|
+
import { H as j, S as y } from "../../switch-Cemfhx0H.js";
|
|
13
|
+
import '../../assets/AccountSelector.css';const C = "_accountSelector_139de_1", H = "_heading_139de_11", V = "_searchSection_139de_17", I = "_searchField_139de_26", E = "_accountMenu_139de_30", R = "_virtualized_139de_38", $ = "_spinner_139de_47", n = {
|
|
14
|
+
accountSelector: C,
|
|
15
|
+
heading: H,
|
|
16
|
+
searchSection: V,
|
|
17
|
+
searchField: I,
|
|
18
|
+
accountMenu: E,
|
|
19
|
+
virtualized: R,
|
|
20
|
+
spinner: $
|
|
21
|
+
}, ee = ({
|
|
22
22
|
accountMenu: e,
|
|
23
23
|
forceOpenFullScreen: t,
|
|
24
24
|
className: i,
|
|
25
25
|
loading: v,
|
|
26
26
|
showDeletedUnits: s,
|
|
27
|
-
onShowDeletedUnitsChange: k
|
|
27
|
+
onShowDeletedUnitsChange: k,
|
|
28
|
+
scrollLock: x
|
|
28
29
|
}) => {
|
|
29
|
-
const { openId: o, closeAll: l, languageCode: d, currentId:
|
|
30
|
-
|
|
30
|
+
const { openId: o, closeAll: l, languageCode: d, currentId: z } = M();
|
|
31
|
+
L(x ? z === "account" : !1);
|
|
31
32
|
const [u, h] = _(""), [a, m] = _(t);
|
|
32
33
|
g(() => {
|
|
33
34
|
!t && a && l(), m(t);
|
|
34
35
|
}, [t]), g(() => {
|
|
35
36
|
a === !0 && o("account");
|
|
36
37
|
}, [a, o]);
|
|
37
|
-
const { searchText:
|
|
38
|
+
const { searchText: f, heading: b, switchLabel: w } = B(d), N = (r) => {
|
|
38
39
|
e.onSelectAccount?.(r), l(), m(!1);
|
|
39
40
|
};
|
|
40
|
-
return v ? /* @__PURE__ */ c(
|
|
41
|
-
/* @__PURE__ */ c(
|
|
42
|
-
/* @__PURE__ */
|
|
41
|
+
return v ? /* @__PURE__ */ c(T, { "aria-hidden": !0, "data-color": "neutral", className: n.spinner }) : /* @__PURE__ */ S("div", { className: p(i, n.accountSelector), children: [
|
|
42
|
+
/* @__PURE__ */ c(j, { "data-size": "sm", level: 2, className: n.heading, children: b }),
|
|
43
|
+
/* @__PURE__ */ S("div", { className: n.searchSection, children: [
|
|
43
44
|
/* @__PURE__ */ c(
|
|
44
|
-
|
|
45
|
+
F,
|
|
45
46
|
{
|
|
46
|
-
name:
|
|
47
|
-
placeholder:
|
|
47
|
+
name: f,
|
|
48
|
+
placeholder: f,
|
|
48
49
|
value: u,
|
|
49
50
|
onChange: (r) => h(r.target.value),
|
|
50
51
|
onClear: () => h(""),
|
|
@@ -52,30 +53,30 @@ import '../../assets/AccountSelector.css';const y = "_accountSelector_139de_1",
|
|
|
52
53
|
}
|
|
53
54
|
),
|
|
54
55
|
s !== void 0 && /* @__PURE__ */ c(
|
|
55
|
-
|
|
56
|
+
y,
|
|
56
57
|
{
|
|
57
58
|
checked: s,
|
|
58
59
|
onChange: (r) => k?.(r.target.checked),
|
|
59
|
-
label:
|
|
60
|
+
label: w
|
|
60
61
|
}
|
|
61
62
|
)
|
|
62
63
|
] }),
|
|
63
64
|
/* @__PURE__ */ c("div", { className: p(n.accountMenu, e.virtualized && n.virtualized), children: /* @__PURE__ */ c(
|
|
64
|
-
|
|
65
|
+
A,
|
|
65
66
|
{
|
|
66
67
|
...e,
|
|
67
|
-
onSelectAccount:
|
|
68
|
+
onSelectAccount: N,
|
|
68
69
|
keyboardEvents: !1,
|
|
69
70
|
search: {
|
|
70
71
|
hidden: !0,
|
|
71
72
|
name: "",
|
|
72
73
|
value: u,
|
|
73
|
-
getResultsLabel: (r) =>
|
|
74
|
+
getResultsLabel: (r) => K(r, d)
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
) })
|
|
77
78
|
] });
|
|
78
|
-
},
|
|
79
|
+
}, B = (e) => {
|
|
79
80
|
switch (e) {
|
|
80
81
|
case "nn":
|
|
81
82
|
return {
|
|
@@ -102,10 +103,10 @@ import '../../assets/AccountSelector.css';const y = "_accountSelector_139de_1",
|
|
|
102
103
|
switchLabel: "Vis slettede"
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
|
-
},
|
|
106
|
+
}, K = (e, t) => {
|
|
106
107
|
const i = t === "nb" || t === "nn";
|
|
107
108
|
return e === 0 ? i ? "Ingen treff" : "No hits" : i ? `${e} treff` : e === 1 ? "1 hit" : `${e} hits`;
|
|
108
109
|
};
|
|
109
110
|
export {
|
|
110
|
-
|
|
111
|
+
ee as AccountSelector
|
|
111
112
|
};
|
|
@@ -11,5 +11,7 @@ export interface AccountSelectorProps {
|
|
|
11
11
|
showDeletedUnits?: boolean;
|
|
12
12
|
/** Function to handle changes to the include deleted accounts switch */
|
|
13
13
|
onShowDeletedUnitsChange?: (newValue: boolean) => void;
|
|
14
|
+
/** Enable scroll lock to prevent background scrolling **/
|
|
15
|
+
scrollLock?: boolean;
|
|
14
16
|
}
|
|
15
|
-
export declare const AccountSelector: ({ accountMenu, forceOpenFullScreen, className, loading, showDeletedUnits, onShowDeletedUnitsChange, }: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const AccountSelector: ({ accountMenu, forceOpenFullScreen, className, loading, showDeletedUnits, onShowDeletedUnitsChange, scrollLock, }: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AccountSelectorProps } from './AccountSelector';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ accountMenu, forceOpenFullScreen, className, loading, showDeletedUnits, onShowDeletedUnitsChange, }: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
component: ({ accountMenu, forceOpenFullScreen, className, loading, showDeletedUnits, onShowDeletedUnitsChange, scrollLock, }: AccountSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
tags: string[];
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: string;
|