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