@altinn/altinn-components 0.47.0 → 0.47.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,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as o, jsxs as O } from "react/jsx-runtime";
|
|
3
3
|
import { c as g } from "../../index-L8X2o7IH.js";
|
|
4
4
|
import s, { forwardRef as v, useState as z, useEffect as j } from "react";
|
|
5
5
|
import { AccountMenu as C } from "../Account/AccountMenu.js";
|
|
@@ -10,42 +10,42 @@ import { SearchField as F } from "../Forms/SearchField.js";
|
|
|
10
10
|
import { S as N } from "../../Spinner-BDXfwXIh.js";
|
|
11
11
|
import { H as R } from "../../Heading-By5DKz2H.js";
|
|
12
12
|
import { u as _ } from "../../useId-BVFxCjkq.js";
|
|
13
|
-
import '../../assets/AccountSelector.css';var M = function(e,
|
|
13
|
+
import '../../assets/AccountSelector.css';var M = function(e, l) {
|
|
14
14
|
var r = {};
|
|
15
|
-
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) &&
|
|
15
|
+
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && l.indexOf(t) < 0 && (r[t] = e[t]);
|
|
16
16
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
17
17
|
for (var n = 0, t = Object.getOwnPropertySymbols(e); n < t.length; n++)
|
|
18
|
-
|
|
18
|
+
l.indexOf(t[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[n]) && (r[t[n]] = e[t[n]]);
|
|
19
19
|
return r;
|
|
20
20
|
};
|
|
21
|
-
const P = v((e,
|
|
21
|
+
const P = v((e, l) => {
|
|
22
22
|
var { title: r, titleId: t } = e, n = M(e, ["title", "titleId"]);
|
|
23
|
-
let
|
|
24
|
-
return
|
|
23
|
+
let i = _();
|
|
24
|
+
return i = r ? t || "title-" + i : void 0, s.createElement(
|
|
25
25
|
"svg",
|
|
26
|
-
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:
|
|
27
|
-
r ? s.createElement("title", { id:
|
|
26
|
+
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 }, n),
|
|
27
|
+
r ? s.createElement("title", { id: i }, r) : null,
|
|
28
28
|
s.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" })
|
|
29
29
|
);
|
|
30
30
|
});
|
|
31
|
-
var A = function(e,
|
|
31
|
+
var A = function(e, l) {
|
|
32
32
|
var r = {};
|
|
33
|
-
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) &&
|
|
33
|
+
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && l.indexOf(t) < 0 && (r[t] = e[t]);
|
|
34
34
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
35
35
|
for (var n = 0, t = Object.getOwnPropertySymbols(e); n < t.length; n++)
|
|
36
|
-
|
|
36
|
+
l.indexOf(t[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[n]) && (r[t[n]] = e[t[n]]);
|
|
37
37
|
return r;
|
|
38
38
|
};
|
|
39
|
-
const T = v((e,
|
|
39
|
+
const T = v((e, l) => {
|
|
40
40
|
var { title: r, titleId: t } = e, n = A(e, ["title", "titleId"]);
|
|
41
|
-
let
|
|
42
|
-
return
|
|
41
|
+
let i = _();
|
|
42
|
+
return i = r ? t || "title-" + i : void 0, s.createElement(
|
|
43
43
|
"svg",
|
|
44
|
-
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:
|
|
45
|
-
r ? s.createElement("title", { id:
|
|
44
|
+
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 }, n),
|
|
45
|
+
r ? s.createElement("title", { id: i }, r) : null,
|
|
46
46
|
s.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" })
|
|
47
47
|
);
|
|
48
|
-
}), H = "_accountSelector_1f74n_1", V = "_heading_1f74n_11", B = "_searchSection_1f74n_17", D = "_searchField_1f74n_22", K = "_accountMenu_1f74n_26", L = "_fullScreen_1f74n_34", U = "_virtualized_1f74n_38", W = "_btnIcon_1f74n_42", $ = "_spinner_1f74n_46",
|
|
48
|
+
}), H = "_accountSelector_1f74n_1", V = "_heading_1f74n_11", B = "_searchSection_1f74n_17", D = "_searchField_1f74n_22", K = "_accountMenu_1f74n_26", L = "_fullScreen_1f74n_34", U = "_virtualized_1f74n_38", W = "_btnIcon_1f74n_42", $ = "_spinner_1f74n_46", a = {
|
|
49
49
|
accountSelector: H,
|
|
50
50
|
heading: V,
|
|
51
51
|
searchSection: B,
|
|
@@ -55,57 +55,57 @@ const T = v((e, i) => {
|
|
|
55
55
|
virtualized: U,
|
|
56
56
|
btnIcon: W,
|
|
57
57
|
spinner: $
|
|
58
|
-
}, ie = ({ accountMenu: e, forceOpenFullScreen:
|
|
59
|
-
const { currentId: n, openId:
|
|
58
|
+
}, ie = ({ accountMenu: e, forceOpenFullScreen: l, className: r, loading: t }) => {
|
|
59
|
+
const { currentId: n, openId: i, toggleId: d, languageCode: S } = k(), c = n === "accountFullscreen", [f, m] = z(""), { minimize: b, fullscreen: y, searchText: h, heading: w } = q(S);
|
|
60
60
|
j(() => {
|
|
61
|
-
|
|
62
|
-
}, [
|
|
61
|
+
l === !0 && !c ? i("accountFullscreen") : l === !1 && c && d("accountFullscreen");
|
|
62
|
+
}, [l, c, i, d]);
|
|
63
63
|
const x = () => {
|
|
64
|
-
|
|
65
|
-
}, I = (
|
|
64
|
+
i(c ? "account" : "accountFullscreen");
|
|
65
|
+
}, I = (u) => {
|
|
66
66
|
var p;
|
|
67
|
-
(p = e.onSelectAccount) == null || p.call(e,
|
|
67
|
+
(p = e.onSelectAccount) == null || p.call(e, u), d(c ? "accountFullscreen" : "account");
|
|
68
68
|
};
|
|
69
|
-
return t ? /* @__PURE__ */
|
|
70
|
-
|
|
71
|
-
/* @__PURE__ */
|
|
69
|
+
return t ? /* @__PURE__ */ o(N, { "aria-hidden": !0, "data-color": "neutral", className: a.spinner }) : /* @__PURE__ */ O("div", { className: g(r, a.accountSelector), children: [
|
|
70
|
+
c && /* @__PURE__ */ o(R, { "data-size": "md", level: 2, className: a.heading, children: w }),
|
|
71
|
+
/* @__PURE__ */ o("div", { className: a.searchSection, children: /* @__PURE__ */ o(
|
|
72
72
|
F,
|
|
73
73
|
{
|
|
74
74
|
name: h,
|
|
75
75
|
placeholder: h,
|
|
76
76
|
value: f,
|
|
77
|
-
onChange: (
|
|
77
|
+
onChange: (u) => m(u.target.value),
|
|
78
78
|
onClear: () => m(""),
|
|
79
|
-
className:
|
|
79
|
+
className: a.searchField
|
|
80
80
|
}
|
|
81
81
|
) }),
|
|
82
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ o(
|
|
83
83
|
"div",
|
|
84
84
|
{
|
|
85
85
|
className: g(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
e.isVirtualized &&
|
|
86
|
+
a.accountMenu,
|
|
87
|
+
c && a.fullScreen,
|
|
88
|
+
e.isVirtualized && a.virtualized
|
|
89
89
|
),
|
|
90
|
-
children: /* @__PURE__ */
|
|
90
|
+
children: /* @__PURE__ */ o(
|
|
91
91
|
C,
|
|
92
92
|
{
|
|
93
93
|
...e,
|
|
94
94
|
onSelectAccount: I,
|
|
95
95
|
keyboardEvents: !1,
|
|
96
96
|
search: { hidden: !0, name: "", value: f },
|
|
97
|
-
scrollRefStyles: !
|
|
97
|
+
scrollRefStyles: !c && e.isVirtualized ? { maxHeight: "calc(40vh)" } : void 0
|
|
98
98
|
}
|
|
99
99
|
)
|
|
100
100
|
}
|
|
101
101
|
),
|
|
102
|
-
|
|
102
|
+
l !== !0 && /* @__PURE__ */ o(
|
|
103
103
|
E,
|
|
104
104
|
{
|
|
105
|
-
icon:
|
|
105
|
+
icon: c ? /* @__PURE__ */ o(T, { className: a.btnIcon, "aria-hidden": "true" }) : /* @__PURE__ */ o(P, { className: a.btnIcon, "aria-hidden": "true" }),
|
|
106
106
|
variant: "text",
|
|
107
107
|
onClick: x,
|
|
108
|
-
children:
|
|
108
|
+
children: c ? b : y
|
|
109
109
|
}
|
|
110
110
|
)
|
|
111
111
|
] });
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
2
|
+
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { useState as L, useEffect as B, useMemo as h } from "react";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
5
|
import "../RootProvider/RootProvider.js";
|
|
6
|
-
import { LocaleSwitcher as
|
|
6
|
+
import { LocaleSwitcher as u } from "./LocaleSwitcher.js";
|
|
7
7
|
import "../Snackbar/useSnackbar.js";
|
|
8
|
-
import { MenuListItem as
|
|
9
|
-
import { Menu as
|
|
10
|
-
import { BackButton as
|
|
11
|
-
import { GlobalMenuBase as
|
|
12
|
-
import { LocaleButton as
|
|
13
|
-
import { LogoutButton as
|
|
14
|
-
const
|
|
8
|
+
import { MenuListItem as G } from "../Menu/MenuBase.js";
|
|
9
|
+
import { Menu as x } from "../Menu/Menu.js";
|
|
10
|
+
import { BackButton as j } from "./BackButton.js";
|
|
11
|
+
import { GlobalMenuBase as k, GlobalMenuHeader as v, GlobalMenuFooter as y } from "./GlobalMenuBase.js";
|
|
12
|
+
import { LocaleButton as A } from "./LocaleButton.js";
|
|
13
|
+
import { LogoutButton as S } from "./LogoutButton.js";
|
|
14
|
+
const P = ({
|
|
15
15
|
menu: a,
|
|
16
|
-
backLabel:
|
|
16
|
+
backLabel: M = "Back",
|
|
17
17
|
onClose: i,
|
|
18
|
-
logoutButton:
|
|
18
|
+
logoutButton: e,
|
|
19
19
|
ariaLabel: f = "Menu",
|
|
20
|
-
localeSwitcher:
|
|
21
|
-
isOpen: p = !1
|
|
22
|
-
color: n = "person"
|
|
20
|
+
localeSwitcher: c,
|
|
21
|
+
isOpen: p = !1
|
|
23
22
|
}) => {
|
|
24
|
-
const [
|
|
25
|
-
|
|
23
|
+
const [d, n] = L(!1), m = () => {
|
|
24
|
+
n((r) => !r);
|
|
26
25
|
};
|
|
27
|
-
|
|
28
|
-
p ||
|
|
26
|
+
B(() => {
|
|
27
|
+
p || n(!1);
|
|
29
28
|
}, [p]);
|
|
30
|
-
const
|
|
29
|
+
const g = h(() => ((a == null ? void 0 : a.items) ?? []).map((r) => ({
|
|
31
30
|
...r,
|
|
32
31
|
onClick: () => {
|
|
33
32
|
var o;
|
|
@@ -36,23 +35,23 @@ const Q = ({
|
|
|
36
35
|
items: Array.isArray(r.items) ? r.items.map((o) => ({
|
|
37
36
|
...o,
|
|
38
37
|
onClick: () => {
|
|
39
|
-
var
|
|
40
|
-
(
|
|
38
|
+
var s;
|
|
39
|
+
(s = o.onClick) == null || s.call(o), i == null || i();
|
|
41
40
|
}
|
|
42
41
|
})) : void 0
|
|
43
42
|
})), [a, i]);
|
|
44
|
-
return
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */ t(
|
|
47
|
-
|
|
43
|
+
return d ? /* @__PURE__ */ l(k, { "aria-label": f, children: [
|
|
44
|
+
/* @__PURE__ */ l(v, { children: [
|
|
45
|
+
/* @__PURE__ */ t(j, { onClick: m, label: M }),
|
|
46
|
+
c && /* @__PURE__ */ t(u, { ...c })
|
|
48
47
|
] }),
|
|
49
|
-
/* @__PURE__ */ t(
|
|
50
|
-
] }) : /* @__PURE__ */
|
|
51
|
-
a && /* @__PURE__ */ t(
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
/* @__PURE__ */ t(G, { as: "div", role: "separator" })
|
|
49
|
+
] }) : /* @__PURE__ */ l(k, { "aria-label": f, children: [
|
|
50
|
+
a && /* @__PURE__ */ t(x, { ...a, items: g }),
|
|
51
|
+
c && /* @__PURE__ */ t(A, { onClick: m }),
|
|
52
|
+
e && /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t(S, { ...e }) })
|
|
54
53
|
] });
|
|
55
54
|
};
|
|
56
55
|
export {
|
|
57
|
-
|
|
56
|
+
P as GlobalMenu
|
|
58
57
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Color } from '../';
|
|
2
1
|
import { LocaleSwitcherProps } from '../Header';
|
|
3
2
|
import { MenuProps } from '../Menu';
|
|
4
3
|
import { LogoutButtonProps } from './LogoutButton';
|
|
@@ -14,6 +13,5 @@ export interface GlobalMenuProps {
|
|
|
14
13
|
ariaLabel?: string;
|
|
15
14
|
localeSwitcher?: LocaleSwitcherProps;
|
|
16
15
|
isOpen?: boolean;
|
|
17
|
-
color?: Color;
|
|
18
16
|
}
|
|
19
|
-
export declare const GlobalMenu: ({ menu, backLabel, onClose, logoutButton, ariaLabel, localeSwitcher, isOpen,
|
|
17
|
+
export declare const GlobalMenu: ({ menu, backLabel, onClose, logoutButton, ariaLabel, localeSwitcher, isOpen, }: GlobalMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { MenuProps } from '../Menu';
|
|
|
3
3
|
import { GlobalMenuProps } from './GlobalMenu';
|
|
4
4
|
declare const meta: {
|
|
5
5
|
title: string;
|
|
6
|
-
component: ({ menu, backLabel, onClose, logoutButton, ariaLabel, localeSwitcher, isOpen,
|
|
6
|
+
component: ({ menu, backLabel, onClose, logoutButton, ariaLabel, localeSwitcher, isOpen, }: GlobalMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
tags: string[];
|
|
8
8
|
parameters: {};
|
|
9
9
|
args: {
|