@altinn/altinn-components 0.25.2 → 0.25.4
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,12 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { createElement as m } from "react";
|
|
3
3
|
import "../../index-L8X2o7IH.js";
|
|
4
4
|
import "../RootProvider/RootProvider.js";
|
|
5
|
-
import { ListBase as
|
|
5
|
+
import { ListBase as i } from "../List/ListBase.js";
|
|
6
6
|
import "../Search/AutocompleteBase.js";
|
|
7
|
-
import { AccountListItem as
|
|
7
|
+
import { AccountListItem as e } from "./AccountListItem.js";
|
|
8
8
|
import "../Snackbar/useSnackbar.js";
|
|
9
|
-
const
|
|
9
|
+
const d = ({ items: t }) => /* @__PURE__ */ o(i, { children: t.map((r) => /* @__PURE__ */ m(e, { ...r, key: r.id })) });
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
d as AccountList
|
|
12
12
|
};
|
|
@@ -1,102 +1,102 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useRootContext as
|
|
5
|
-
import { ToolbarAccountMenu as
|
|
6
|
-
import { ToolbarAdd as
|
|
7
|
-
import { ToolbarBase as
|
|
8
|
-
import { ToolbarFilter as
|
|
9
|
-
import { ToolbarSearch as
|
|
10
|
-
const
|
|
11
|
-
filters:
|
|
12
|
-
filterState:
|
|
13
|
-
onFilterStateChange:
|
|
14
|
-
search:
|
|
15
|
-
accountMenu:
|
|
16
|
-
getFilterLabel:
|
|
17
|
-
children:
|
|
18
|
-
showResultsLabel:
|
|
19
|
-
removeButtonAltText:
|
|
20
|
-
addFilterButtonLabel:
|
|
2
|
+
import { jsxs as G, jsx as c } from "react/jsx-runtime";
|
|
3
|
+
import { useState as V, useMemo as v, useEffect as k } from "react";
|
|
4
|
+
import { useRootContext as w } from "../RootProvider/RootProvider.js";
|
|
5
|
+
import { ToolbarAccountMenu as B } from "./ToolbarAccountMenu.js";
|
|
6
|
+
import { ToolbarAdd as E } from "./ToolbarAdd.js";
|
|
7
|
+
import { ToolbarBase as L } from "./ToolbarBase.js";
|
|
8
|
+
import { ToolbarFilter as M } from "./ToolbarFilter.js";
|
|
9
|
+
import { ToolbarSearch as $ } from "./ToolbarSearch.js";
|
|
10
|
+
const T = (t, m) => m || `toolbar-filter-${t}`, Q = ({
|
|
11
|
+
filters: t = [],
|
|
12
|
+
filterState: m,
|
|
13
|
+
onFilterStateChange: u,
|
|
14
|
+
search: b,
|
|
15
|
+
accountMenu: g,
|
|
16
|
+
getFilterLabel: y,
|
|
17
|
+
children: F,
|
|
18
|
+
showResultsLabel: S,
|
|
19
|
+
removeButtonAltText: x,
|
|
20
|
+
addFilterButtonLabel: A
|
|
21
21
|
}) => {
|
|
22
|
-
const { openId:
|
|
23
|
-
|
|
22
|
+
const { openId: h, closeAll: C } = w(), n = m || {}, i = typeof u == "function" ? u : () => {
|
|
23
|
+
}, [r, p] = V(
|
|
24
|
+
() => t.filter((e) => !e.removable || typeof n[e.name] < "u").map((e) => e.name)
|
|
25
|
+
), I = v(
|
|
26
|
+
() => r.map((e) => t.find((o) => o.name === e)).filter((e) => typeof e < "u"),
|
|
27
|
+
[t, r]
|
|
28
|
+
), s = v(
|
|
29
|
+
() => t.filter((e) => !r.includes(e.name)),
|
|
30
|
+
[t, r]
|
|
24
31
|
);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const F = n == null ? void 0 : n.filter((o) => !c.includes(o.name)), j = T(
|
|
31
|
-
() => c.map((o) => n.find((e) => e.name === o)).filter((o) => typeof o < "u"),
|
|
32
|
-
[n, c]
|
|
33
|
-
), i = T(
|
|
34
|
-
() => n.filter((o) => F.includes(o)),
|
|
35
|
-
[n, F]
|
|
36
|
-
), G = (o) => {
|
|
37
|
-
const { name: e, value: l, type: B } = o.target, a = [l];
|
|
38
|
-
B === "radio" ? (I(), p({
|
|
39
|
-
...t,
|
|
40
|
-
[e]: a
|
|
41
|
-
})) : p({
|
|
42
|
-
...t,
|
|
43
|
-
[e]: t[e] ? t[e].some((s) => a == null ? void 0 : a.includes(String(s))) ? t[e].filter((s) => !a.includes(String(s))) : [...t[e], ...a] : a
|
|
32
|
+
k(() => {
|
|
33
|
+
const e = t.filter((o) => !o.removable || typeof n[o.name] < "u").map((o) => o.name);
|
|
34
|
+
p((o) => {
|
|
35
|
+
const l = e.filter((d) => !o.includes(d));
|
|
36
|
+
return l.length === 0 ? o : [...o, ...l];
|
|
44
37
|
});
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
}, [t, n]);
|
|
39
|
+
const N = (e) => {
|
|
40
|
+
const { name: o, value: l, type: d } = e.target, a = [l];
|
|
41
|
+
d === "radio" ? (C(), i({
|
|
42
|
+
...n,
|
|
43
|
+
[o]: a
|
|
44
|
+
})) : i({
|
|
45
|
+
...n,
|
|
46
|
+
[o]: n[o] ? n[o].some((f) => a.includes(String(f))) ? n[o].filter((f) => !a.includes(String(f))) : [...n[o], ...a] : a
|
|
47
|
+
});
|
|
48
|
+
}, R = (e) => {
|
|
49
|
+
p((o) => o.filter((l) => l !== e)), i({
|
|
50
|
+
...n,
|
|
51
|
+
[e]: void 0
|
|
52
|
+
});
|
|
53
|
+
}, j = (e, o) => {
|
|
54
|
+
r.includes(e) || p((l) => [...l, e]), h(o), i({
|
|
55
|
+
...n,
|
|
56
|
+
[e]: n[e] ?? []
|
|
49
57
|
});
|
|
50
|
-
}, k = (o, e) => {
|
|
51
|
-
d((l) => [...l, o]), C(e);
|
|
52
58
|
};
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
return /* @__PURE__ */ G(L, { children: [
|
|
60
|
+
g && /* @__PURE__ */ c(B, { ...g }),
|
|
61
|
+
b && /* @__PURE__ */ c($, { ...b }),
|
|
62
|
+
I.map((e) => /* @__PURE__ */ c(
|
|
63
|
+
M,
|
|
58
64
|
{
|
|
59
|
-
id:
|
|
60
|
-
showResultsLabel:
|
|
61
|
-
onRemove: () =>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
getSelectedLabel: S,
|
|
73
|
-
buttonAltText: A,
|
|
74
|
-
optionGroups: o.optionGroups,
|
|
75
|
-
filterState: t
|
|
65
|
+
id: T(e.name, e.id),
|
|
66
|
+
showResultsLabel: S,
|
|
67
|
+
onRemove: () => R(e.name),
|
|
68
|
+
onChange: N,
|
|
69
|
+
name: e.name,
|
|
70
|
+
options: e.options,
|
|
71
|
+
label: e.label,
|
|
72
|
+
optionType: e.optionType,
|
|
73
|
+
removable: e.removable,
|
|
74
|
+
getSelectedLabel: y,
|
|
75
|
+
buttonAltText: x,
|
|
76
|
+
optionGroups: e.optionGroups,
|
|
77
|
+
filterState: n
|
|
76
78
|
},
|
|
77
|
-
|
|
79
|
+
e.name
|
|
78
80
|
)),
|
|
79
|
-
(
|
|
80
|
-
|
|
81
|
+
(s == null ? void 0 : s.length) > 0 && /* @__PURE__ */ c(
|
|
82
|
+
E,
|
|
81
83
|
{
|
|
82
84
|
id: "toolbar-filter-add",
|
|
83
|
-
label:
|
|
84
|
-
items:
|
|
85
|
-
const
|
|
85
|
+
label: A,
|
|
86
|
+
items: s.map((e) => {
|
|
87
|
+
const o = T(e.name, e.id);
|
|
86
88
|
return {
|
|
87
|
-
id:
|
|
88
|
-
title:
|
|
89
|
-
name:
|
|
90
|
-
onClick: () =>
|
|
91
|
-
k(o.name, e);
|
|
92
|
-
}
|
|
89
|
+
id: o,
|
|
90
|
+
title: e.label,
|
|
91
|
+
name: e.name,
|
|
92
|
+
onClick: () => j(e.name, o)
|
|
93
93
|
};
|
|
94
94
|
})
|
|
95
95
|
}
|
|
96
96
|
),
|
|
97
|
-
|
|
97
|
+
F
|
|
98
98
|
] });
|
|
99
99
|
};
|
|
100
100
|
export {
|
|
101
|
-
|
|
101
|
+
Q as Toolbar
|
|
102
102
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
declare const meta: {
|
|
2
2
|
title: string;
|
|
3
3
|
tags: string[];
|
|
4
|
-
parameters: {
|
|
4
|
+
parameters: {
|
|
5
|
+
layout: string;
|
|
6
|
+
};
|
|
5
7
|
args: {
|
|
6
8
|
owner: import('..').AvatarProps;
|
|
7
9
|
contact: import('..').DialogContactProps;
|
|
@@ -18,6 +20,6 @@ declare const meta: {
|
|
|
18
20
|
};
|
|
19
21
|
export default meta;
|
|
20
22
|
export declare const ProfileDashboard: () => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const ProfileAccounts: () => import("react/jsx-runtime").JSX.Element;
|
|
21
24
|
export declare const CompanyDashboard: () => import("react/jsx-runtime").JSX.Element;
|
|
22
25
|
export declare const ServicePage: () => import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export declare const AccountsPage: () => import("react/jsx-runtime").JSX.Element;
|