@altinn/altinn-components 0.56.25 → 0.56.27
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/components/ContextMenu/ContextMenu.js +37 -32
- package/dist/components/Dialog/DialogActions.js +29 -24
- package/dist/components/GlobalHeader/AccountSelector.js +35 -34
- package/dist/types/lib/components/GlobalHeader/AccountSelector.d.ts +3 -1
- package/dist/types/lib/components/GlobalHeader/AccountSelector.stories.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,47 +1,52 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import u, { forwardRef as m, useMemo as c } from "react";
|
|
4
|
+
import { Button as f } from "../Button/Button.js";
|
|
4
5
|
import "../../index-p1eeF8LQ.js";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { M as f } from "../../SearchField-QTfebYdU.js";
|
|
6
|
+
import { Dropdown as g } from "../Dropdown/Dropdown.js";
|
|
7
|
+
import { useRootContext as h } from "../RootProvider/RootProvider.js";
|
|
8
|
+
import { M as b } from "../../SearchField-QTfebYdU.js";
|
|
9
9
|
import "../Snackbar/useSnackbar.js";
|
|
10
|
-
import { useDropdownMenuController as
|
|
11
|
-
import { Tooltip as
|
|
12
|
-
import { u as
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
for (var e in t) Object.prototype.hasOwnProperty.call(t, e) && l.indexOf(e) < 0 && (
|
|
10
|
+
import { useDropdownMenuController as x } from "../Menu/useDropdownMenuController.js";
|
|
11
|
+
import { Tooltip as v } from "../Tooltip/Tooltip.js";
|
|
12
|
+
import { u as y } from "../../useId-BVFxCjkq.js";
|
|
13
|
+
var O = function(t, l) {
|
|
14
|
+
var r = {};
|
|
15
|
+
for (var e in t) Object.prototype.hasOwnProperty.call(t, e) && l.indexOf(e) < 0 && (r[e] = t[e]);
|
|
16
16
|
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
17
|
-
for (var
|
|
18
|
-
l.indexOf(e[
|
|
19
|
-
return
|
|
17
|
+
for (var o = 0, e = Object.getOwnPropertySymbols(t); o < e.length; o++)
|
|
18
|
+
l.indexOf(e[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, e[o]) && (r[e[o]] = t[e[o]]);
|
|
19
|
+
return r;
|
|
20
20
|
};
|
|
21
|
-
const
|
|
22
|
-
var { title:
|
|
23
|
-
let i =
|
|
24
|
-
return i =
|
|
21
|
+
const w = m((t, l) => {
|
|
22
|
+
var { title: r, titleId: e } = t, o = O(t, ["title", "titleId"]);
|
|
23
|
+
let i = y();
|
|
24
|
+
return i = r ? e || "title-" + i : void 0, u.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: l, "aria-labelledby": i },
|
|
27
|
-
|
|
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 }, o),
|
|
27
|
+
r ? u.createElement("title", { id: i }, r) : null,
|
|
28
28
|
u.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M6 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3m4.5 1.5a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0m6 0a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0", clipRule: "evenodd" })
|
|
29
29
|
);
|
|
30
|
-
}),
|
|
30
|
+
}), A = ({
|
|
31
31
|
groups: t = {},
|
|
32
32
|
items: l,
|
|
33
|
-
title:
|
|
33
|
+
title: r,
|
|
34
34
|
id: e = "context-menu",
|
|
35
|
-
placement:
|
|
35
|
+
placement: o = "right",
|
|
36
36
|
"aria-label": i
|
|
37
37
|
}) => {
|
|
38
|
-
const n =
|
|
38
|
+
const n = x({ id: e, returnFocusOnClose: !0 }), { languageCode: s } = h(), d = c(() => l.map((p) => ({
|
|
39
|
+
...p,
|
|
40
|
+
onClick: () => {
|
|
41
|
+
n.setOpen(!1), p.onClick?.();
|
|
42
|
+
}
|
|
43
|
+
})), [l, n]);
|
|
39
44
|
return /* @__PURE__ */ a(
|
|
40
|
-
|
|
45
|
+
g,
|
|
41
46
|
{
|
|
42
47
|
backdrop: !1,
|
|
43
|
-
trigger: /* @__PURE__ */ a(() => /* @__PURE__ */ a(
|
|
44
|
-
|
|
48
|
+
trigger: /* @__PURE__ */ a(() => /* @__PURE__ */ a(v, { content: r || C(s).title, hidden: n.open, children: /* @__PURE__ */ a(
|
|
49
|
+
f,
|
|
45
50
|
{
|
|
46
51
|
ref: n.triggerRef,
|
|
47
52
|
icon: !0,
|
|
@@ -53,19 +58,19 @@ const v = s((t, l) => {
|
|
|
53
58
|
"aria-haspopup": "menu",
|
|
54
59
|
"aria-expanded": n.open,
|
|
55
60
|
"aria-controls": n.open ? n.menuId : void 0,
|
|
56
|
-
children: /* @__PURE__ */ a(
|
|
61
|
+
children: /* @__PURE__ */ a(w, { "aria-hidden": "true" })
|
|
57
62
|
}
|
|
58
63
|
) }), {}),
|
|
59
64
|
open: n.open,
|
|
60
65
|
onClose: () => n.setOpen(!1),
|
|
61
66
|
id: n.menuId,
|
|
62
|
-
placement:
|
|
67
|
+
placement: o,
|
|
63
68
|
useFixedPosition: !0,
|
|
64
69
|
...n.dropdownA11yProps,
|
|
65
|
-
children: /* @__PURE__ */ a(
|
|
70
|
+
children: /* @__PURE__ */ a(b, { groups: t, items: d, maxLevels: 1, keyboardEvents: n.open, ...n.menuA11yProps })
|
|
66
71
|
}
|
|
67
72
|
);
|
|
68
|
-
},
|
|
73
|
+
}, C = (t) => {
|
|
69
74
|
switch (t) {
|
|
70
75
|
case "nb":
|
|
71
76
|
return {
|
|
@@ -82,5 +87,5 @@ const v = s((t, l) => {
|
|
|
82
87
|
}
|
|
83
88
|
};
|
|
84
89
|
export {
|
|
85
|
-
|
|
90
|
+
A as ContextMenu
|
|
86
91
|
};
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useMemo as
|
|
2
|
+
import { jsxs as p, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as m } from "react";
|
|
4
4
|
import "../../index-p1eeF8LQ.js";
|
|
5
|
-
import { Button as
|
|
6
|
-
import { ButtonGroup as
|
|
5
|
+
import { Button as s } from "../Button/Button.js";
|
|
6
|
+
import { ButtonGroup as g } from "../Button/ButtonGroup.js";
|
|
7
7
|
import { ButtonGroupDivider as B } from "../Button/ButtonGroupDivider.js";
|
|
8
|
-
import { DropdownBase as
|
|
8
|
+
import { DropdownBase as k } from "../Dropdown/DropdownBase.js";
|
|
9
9
|
import "react-dom";
|
|
10
|
-
import { useRootContext as
|
|
11
|
-
import { M as
|
|
10
|
+
import { useRootContext as x } from "../RootProvider/RootProvider.js";
|
|
11
|
+
import { M as _ } from "../../SearchField-QTfebYdU.js";
|
|
12
12
|
import "../Snackbar/useSnackbar.js";
|
|
13
|
-
import { S as
|
|
14
|
-
import '../../assets/DialogActions.css';const I = "_action_1n930_1", M = "_comboButton_1n930_8",
|
|
13
|
+
import { S as v, a as D } from "../../ChevronUp-_BBfEirx.js";
|
|
14
|
+
import '../../assets/DialogActions.css';const I = "_action_1n930_1", M = "_comboButton_1n930_8", u = {
|
|
15
15
|
action: I,
|
|
16
16
|
comboButton: M
|
|
17
|
-
}, H = ({ items: i, maxItems:
|
|
18
|
-
const { currentId:
|
|
19
|
-
const
|
|
20
|
-
return
|
|
21
|
-
})
|
|
22
|
-
|
|
17
|
+
}, H = ({ items: i, maxItems: a = 2, id: l = "dialog-actions", expandAltLabel: f }) => {
|
|
18
|
+
const { currentId: h, closeAll: b, toggleId: d } = x(), e = h === l, t = m(() => (i || []).filter((o) => !o.hidden).sort((o, r) => {
|
|
19
|
+
const c = ["primary", "secondary", "tertiary"];
|
|
20
|
+
return c.indexOf(o?.priority) - c.indexOf(r?.priority);
|
|
21
|
+
}).map((o) => ({
|
|
22
|
+
...o,
|
|
23
|
+
onClick: () => {
|
|
24
|
+
o.onClick?.(), d(l);
|
|
25
|
+
}
|
|
26
|
+
})), [i]), y = m(() => i.find((o) => o.priority === "primary")?.disabled, [i]);
|
|
27
|
+
if (!t.length || a <= 0)
|
|
23
28
|
return null;
|
|
24
|
-
if (t.length >
|
|
29
|
+
if (t.length > a) {
|
|
25
30
|
const o = t.slice(1).map((r) => ({
|
|
26
31
|
id: r.id,
|
|
27
32
|
title: r.label,
|
|
@@ -29,18 +34,18 @@ import '../../assets/DialogActions.css';const I = "_action_1n930_1", M = "_combo
|
|
|
29
34
|
group: r.priority,
|
|
30
35
|
hidden: r.hidden
|
|
31
36
|
}));
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */ n(
|
|
37
|
+
return /* @__PURE__ */ p("section", { className: u.comboButton, children: [
|
|
38
|
+
/* @__PURE__ */ p(g, { connected: !0, size: "md", children: [
|
|
39
|
+
/* @__PURE__ */ n(s, { disabled: y, onClick: t[0].onClick, children: t[0].label }),
|
|
35
40
|
/* @__PURE__ */ n(B, {}),
|
|
36
|
-
/* @__PURE__ */ n(
|
|
41
|
+
/* @__PURE__ */ n(s, { "aria-label": f, onClick: () => d(l), "aria-expanded": e ? "true" : "false", children: e ? /* @__PURE__ */ n(v, {}) : /* @__PURE__ */ n(D, {}) })
|
|
37
42
|
] }),
|
|
38
|
-
e && /* @__PURE__ */ n(
|
|
43
|
+
e && /* @__PURE__ */ n(k, { open: e, onClose: b, children: /* @__PURE__ */ n(_, { items: o }) })
|
|
39
44
|
] });
|
|
40
45
|
}
|
|
41
|
-
return /* @__PURE__ */ n("section", { className:
|
|
42
|
-
const { priority:
|
|
43
|
-
return /* @__PURE__ */ n(
|
|
46
|
+
return /* @__PURE__ */ n("section", { className: u.action, children: t.map((o, r) => {
|
|
47
|
+
const { priority: c, id: O, ...C } = o;
|
|
48
|
+
return /* @__PURE__ */ n(s, { variant: c === "primary" ? "solid" : "outline", size: "md", ...C, children: o.label }, "button-" + r);
|
|
44
49
|
}) });
|
|
45
50
|
};
|
|
46
51
|
export {
|
|
@@ -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;
|