@altinn/altinn-components 0.53.1 → 0.54.1
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/GlobalHeader/AccountSelector.js +72 -74
- package/dist/components/Toolbar/Toolbar.js +10 -9
- package/dist/components/Toolbar/ToolbarFilter.js +24 -22
- package/dist/components/Toolbar/ToolbarOptions.js +56 -49
- package/dist/hooks/useAccountSelector.js +34 -34
- package/dist/types/lib/components/Toolbar/ToolbarDate.stories.d.ts +1 -1
- package/dist/types/lib/components/Toolbar/ToolbarFilter.d.ts +3 -2
- package/dist/types/lib/components/Toolbar/ToolbarFilter.stories.d.ts +2 -1
- package/dist/types/lib/components/Toolbar/ToolbarOptions.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { c as
|
|
4
|
-
import u, { forwardRef as
|
|
5
|
-
import { useIsDesktop as
|
|
6
|
-
import { AccountMenu as
|
|
7
|
-
import { Button as
|
|
8
|
-
import { useRootContext as
|
|
2
|
+
import { jsx as a, jsxs as m, Fragment as y } from "react/jsx-runtime";
|
|
3
|
+
import { c as j } from "../../index-p1eeF8LQ.js";
|
|
4
|
+
import u, { forwardRef as O, useState as x, useEffect as I } from "react";
|
|
5
|
+
import { useIsDesktop as q } from "../../hooks/useIsDesktop.js";
|
|
6
|
+
import { AccountMenu as R } from "../Account/AccountMenu.js";
|
|
7
|
+
import { Button as L } from "../Button/Button.js";
|
|
8
|
+
import { useRootContext as A } from "../RootProvider/RootProvider.js";
|
|
9
9
|
import "../Snackbar/useSnackbar.js";
|
|
10
|
-
import { SearchField as
|
|
11
|
-
import { S as
|
|
12
|
-
import { H
|
|
13
|
-
import { u as
|
|
14
|
-
import '../../assets/AccountSelector.css';var
|
|
10
|
+
import { SearchField as P } from "../Forms/SearchField.js";
|
|
11
|
+
import { S as V } from "../../button-BB5sYVKY.js";
|
|
12
|
+
import { H, S as T } from "../../switch-Cemfhx0H.js";
|
|
13
|
+
import { u as z } from "../../useId-BVFxCjkq.js";
|
|
14
|
+
import '../../assets/AccountSelector.css';var B = function(e, l) {
|
|
15
15
|
var n = {};
|
|
16
16
|
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && l.indexOf(t) < 0 && (n[t] = e[t]);
|
|
17
17
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -19,9 +19,9 @@ import '../../assets/AccountSelector.css';var T = function(e, l) {
|
|
|
19
19
|
l.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[r]) && (n[t[r]] = e[t[r]]);
|
|
20
20
|
return n;
|
|
21
21
|
};
|
|
22
|
-
const
|
|
23
|
-
var { title: n, titleId: t } = e, r =
|
|
24
|
-
let i =
|
|
22
|
+
const $ = O((e, l) => {
|
|
23
|
+
var { title: n, titleId: t } = e, r = B(e, ["title", "titleId"]);
|
|
24
|
+
let i = z();
|
|
25
25
|
return i = n ? t || "title-" + i : void 0, u.createElement(
|
|
26
26
|
"svg",
|
|
27
27
|
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 }, r),
|
|
@@ -29,7 +29,7 @@ const B = I((e, l) => {
|
|
|
29
29
|
u.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" })
|
|
30
30
|
);
|
|
31
31
|
});
|
|
32
|
-
var
|
|
32
|
+
var D = function(e, l) {
|
|
33
33
|
var n = {};
|
|
34
34
|
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && l.indexOf(t) < 0 && (n[t] = e[t]);
|
|
35
35
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -37,26 +37,26 @@ var $ = function(e, l) {
|
|
|
37
37
|
l.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[r]) && (n[t[r]] = e[t[r]]);
|
|
38
38
|
return n;
|
|
39
39
|
};
|
|
40
|
-
const
|
|
41
|
-
var { title: n, titleId: t } = e, r =
|
|
42
|
-
let i =
|
|
40
|
+
const K = O((e, l) => {
|
|
41
|
+
var { title: n, titleId: t } = e, r = D(e, ["title", "titleId"]);
|
|
42
|
+
let i = z();
|
|
43
43
|
return i = n ? t || "title-" + i : void 0, u.createElement(
|
|
44
44
|
"svg",
|
|
45
45
|
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 }, r),
|
|
46
46
|
n ? u.createElement("title", { id: i }, n) : null,
|
|
47
47
|
u.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" })
|
|
48
48
|
);
|
|
49
|
-
}),
|
|
50
|
-
accountSelector:
|
|
51
|
-
heading:
|
|
52
|
-
searchSection:
|
|
53
|
-
searchField:
|
|
54
|
-
accountMenu:
|
|
55
|
-
fullScreen:
|
|
56
|
-
virtualized:
|
|
57
|
-
btnIcon:
|
|
58
|
-
spinner:
|
|
59
|
-
},
|
|
49
|
+
}), W = "_accountSelector_qwjt5_1", G = "_heading_qwjt5_11", J = "_searchSection_qwjt5_17", Q = "_searchField_qwjt5_25", U = "_accountMenu_qwjt5_29", X = "_fullScreen_qwjt5_37", Y = "_virtualized_qwjt5_41", Z = "_btnIcon_qwjt5_45", ee = "_spinner_qwjt5_49", c = {
|
|
50
|
+
accountSelector: W,
|
|
51
|
+
heading: G,
|
|
52
|
+
searchSection: J,
|
|
53
|
+
searchField: Q,
|
|
54
|
+
accountMenu: U,
|
|
55
|
+
fullScreen: X,
|
|
56
|
+
virtualized: Y,
|
|
57
|
+
btnIcon: Z,
|
|
58
|
+
spinner: ee
|
|
59
|
+
}, pe = ({
|
|
60
60
|
accountMenu: e,
|
|
61
61
|
forceOpenFullScreen: l,
|
|
62
62
|
className: n,
|
|
@@ -64,76 +64,74 @@ const D = I((e, l) => {
|
|
|
64
64
|
showDeletedUnits: r,
|
|
65
65
|
onShowDeletedUnitsChange: i
|
|
66
66
|
}) => {
|
|
67
|
-
const { currentId:
|
|
68
|
-
|
|
69
|
-
!l && f &&
|
|
70
|
-
}, [l]),
|
|
71
|
-
(f === !0 && !
|
|
72
|
-
}, [f,
|
|
73
|
-
const { minimize:
|
|
74
|
-
d(
|
|
75
|
-
},
|
|
76
|
-
e.onSelectAccount?.(s),
|
|
67
|
+
const { currentId: h, openId: d, closeAll: g, languageCode: v } = A(), p = q(), o = h === "accountFullscreen", [S, w] = x(""), [f, _] = x(l);
|
|
68
|
+
I(() => {
|
|
69
|
+
!l && f && o && g(), _(l);
|
|
70
|
+
}, [l]), I(() => {
|
|
71
|
+
(f === !0 && !o || !p && h === "account") && d("accountFullscreen");
|
|
72
|
+
}, [f, o, p, h, d]);
|
|
73
|
+
const { minimize: k, fullscreen: C, searchText: b, heading: E, switchLabel: F } = te(v), M = () => {
|
|
74
|
+
d(o ? "account" : "accountFullscreen");
|
|
75
|
+
}, N = (s) => {
|
|
76
|
+
e.onSelectAccount?.(s), g(), _(!1);
|
|
77
77
|
};
|
|
78
|
-
return t ? /* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
|
|
78
|
+
return t ? /* @__PURE__ */ a(V, { "aria-hidden": !0, "data-color": "neutral", className: c.spinner }) : /* @__PURE__ */ m("div", { className: j(n, c.accountSelector), children: [
|
|
79
|
+
/* @__PURE__ */ a(H, { "data-size": "sm", level: 2, className: c.heading, children: E }),
|
|
80
|
+
/* @__PURE__ */ m("div", { className: c.searchSection, children: [
|
|
81
|
+
/* @__PURE__ */ a(
|
|
82
|
+
P,
|
|
83
83
|
{
|
|
84
|
-
name:
|
|
85
|
-
placeholder:
|
|
86
|
-
value:
|
|
87
|
-
onChange: (s) =>
|
|
88
|
-
onClear: () =>
|
|
84
|
+
name: b,
|
|
85
|
+
placeholder: b,
|
|
86
|
+
value: S,
|
|
87
|
+
onChange: (s) => w(s.target.value),
|
|
88
|
+
onClear: () => w(""),
|
|
89
89
|
className: c.searchField
|
|
90
90
|
}
|
|
91
91
|
),
|
|
92
|
-
r !== void 0 && /* @__PURE__ */
|
|
93
|
-
|
|
92
|
+
r !== void 0 && /* @__PURE__ */ a(
|
|
93
|
+
T,
|
|
94
94
|
{
|
|
95
95
|
checked: r,
|
|
96
96
|
onChange: (s) => i?.(s.target.checked),
|
|
97
|
-
label:
|
|
97
|
+
label: F
|
|
98
98
|
}
|
|
99
99
|
)
|
|
100
100
|
] }),
|
|
101
|
-
/* @__PURE__ */
|
|
101
|
+
/* @__PURE__ */ a(
|
|
102
102
|
"div",
|
|
103
103
|
{
|
|
104
|
-
className:
|
|
104
|
+
className: j(
|
|
105
105
|
c.accountMenu,
|
|
106
|
-
|
|
106
|
+
o && c.fullScreen,
|
|
107
107
|
e.isVirtualized && c.virtualized
|
|
108
108
|
),
|
|
109
|
-
children: /* @__PURE__ */
|
|
110
|
-
|
|
109
|
+
children: /* @__PURE__ */ a(
|
|
110
|
+
R,
|
|
111
111
|
{
|
|
112
112
|
...e,
|
|
113
|
-
onSelectAccount:
|
|
113
|
+
onSelectAccount: N,
|
|
114
114
|
keyboardEvents: !1,
|
|
115
115
|
search: {
|
|
116
116
|
hidden: !0,
|
|
117
117
|
name: "",
|
|
118
|
-
value:
|
|
119
|
-
getResultsLabel: (s) =>
|
|
118
|
+
value: S,
|
|
119
|
+
getResultsLabel: (s) => ne(s, v)
|
|
120
120
|
},
|
|
121
|
-
scrollRefStyles: !
|
|
121
|
+
scrollRefStyles: !o && e.isVirtualized ? { maxHeight: "calc(40vh)" } : void 0
|
|
122
122
|
}
|
|
123
123
|
)
|
|
124
124
|
}
|
|
125
125
|
),
|
|
126
|
-
f !== !0 &&
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
)
|
|
126
|
+
f !== !0 && p && /* @__PURE__ */ a(L, { variant: "ghost", onClick: M, children: o ? /* @__PURE__ */ m(y, { children: [
|
|
127
|
+
/* @__PURE__ */ a(K, { className: c.btnIcon, "aria-hidden": "true" }),
|
|
128
|
+
k
|
|
129
|
+
] }) : /* @__PURE__ */ m(y, { children: [
|
|
130
|
+
/* @__PURE__ */ a($, { className: c.btnIcon, "aria-hidden": "true" }),
|
|
131
|
+
C
|
|
132
|
+
] }) })
|
|
135
133
|
] });
|
|
136
|
-
},
|
|
134
|
+
}, te = (e) => {
|
|
137
135
|
switch (e) {
|
|
138
136
|
case "nn":
|
|
139
137
|
return {
|
|
@@ -160,10 +158,10 @@ const D = I((e, l) => {
|
|
|
160
158
|
switchLabel: "Vis slettede"
|
|
161
159
|
};
|
|
162
160
|
}
|
|
163
|
-
},
|
|
161
|
+
}, ne = (e, l) => {
|
|
164
162
|
const n = l === "nb" || l === "nn";
|
|
165
163
|
return e === 0 ? n ? "Ingen treff" : "No hits" : n ? `${e} treff` : e === 1 ? "1 hit" : `${e} hits`;
|
|
166
164
|
};
|
|
167
165
|
export {
|
|
168
|
-
|
|
166
|
+
pe as AccountSelector
|
|
169
167
|
};
|
|
@@ -13,10 +13,10 @@ const g = (n, c) => c || `toolbar-filter-${n}`, P = ({
|
|
|
13
13
|
onFilterStateChange: f,
|
|
14
14
|
search: m,
|
|
15
15
|
accountMenu: b,
|
|
16
|
-
getFilterLabel:
|
|
17
|
-
children:
|
|
18
|
-
showResultsLabel:
|
|
19
|
-
removeButtonAltText:
|
|
16
|
+
getFilterLabel: h,
|
|
17
|
+
children: v,
|
|
18
|
+
showResultsLabel: y,
|
|
19
|
+
removeButtonAltText: S,
|
|
20
20
|
addFilterButtonLabel: x
|
|
21
21
|
}) => {
|
|
22
22
|
const { openId: A, closeAll: F } = V(), t = c || {}, a = typeof f == "function" ? f : () => {
|
|
@@ -65,7 +65,7 @@ const g = (n, c) => c || `toolbar-filter-${n}`, P = ({
|
|
|
65
65
|
B,
|
|
66
66
|
{
|
|
67
67
|
id: g(e.name, e.id),
|
|
68
|
-
showResultsLabel:
|
|
68
|
+
showResultsLabel: y,
|
|
69
69
|
onRemove: () => C(e.name),
|
|
70
70
|
onChange: j,
|
|
71
71
|
name: e.name,
|
|
@@ -73,10 +73,11 @@ const g = (n, c) => c || `toolbar-filter-${n}`, P = ({
|
|
|
73
73
|
label: e.label,
|
|
74
74
|
optionType: e.optionType,
|
|
75
75
|
removable: e.removable,
|
|
76
|
-
getSelectedLabel:
|
|
77
|
-
buttonAltText:
|
|
76
|
+
getSelectedLabel: h,
|
|
77
|
+
buttonAltText: S,
|
|
78
78
|
optionGroups: e.optionGroups,
|
|
79
|
-
filterState: t
|
|
79
|
+
filterState: t,
|
|
80
|
+
search: e.search
|
|
80
81
|
},
|
|
81
82
|
e.name
|
|
82
83
|
)),
|
|
@@ -97,7 +98,7 @@ const g = (n, c) => c || `toolbar-filter-${n}`, P = ({
|
|
|
97
98
|
},
|
|
98
99
|
u.join(",")
|
|
99
100
|
),
|
|
100
|
-
|
|
101
|
+
v
|
|
101
102
|
] });
|
|
102
103
|
};
|
|
103
104
|
export {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as I, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import "../../index-p1eeF8LQ.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { useIsDesktop as
|
|
4
|
+
import { useIsDesktop as j } from "../../hooks/useIsDesktop.js";
|
|
5
5
|
import "../Button/Button.js";
|
|
6
|
-
import { useRootContext as
|
|
7
|
-
import { DrawerOrDropdown as
|
|
6
|
+
import { useRootContext as F } from "../RootProvider/RootProvider.js";
|
|
7
|
+
import { DrawerOrDropdown as L } from "../Dropdown/DrawerOrDropdown.js";
|
|
8
8
|
import "../Snackbar/useSnackbar.js";
|
|
9
|
-
import { ToolbarButton as
|
|
10
|
-
import { ToolbarFilterBase as
|
|
11
|
-
import { ToolbarOptions as
|
|
12
|
-
const
|
|
9
|
+
import { ToolbarButton as O } from "./ToolbarButton.js";
|
|
10
|
+
import { ToolbarFilterBase as R } from "./ToolbarFilterBase.js";
|
|
11
|
+
import { ToolbarOptions as E } from "./ToolbarOptions.js";
|
|
12
|
+
const G = (i, t) => Array.isArray(t) ? t.join(", ") : t, Q = ({
|
|
13
13
|
removable: i,
|
|
14
14
|
label: t,
|
|
15
15
|
name: o,
|
|
@@ -21,38 +21,39 @@ const E = (i, t) => Array.isArray(t) ? t.join(", ") : t, P = ({
|
|
|
21
21
|
buttonAltText: p = "Remove button",
|
|
22
22
|
getSelectedLabel: g,
|
|
23
23
|
showResultsLabel: x = "Show results",
|
|
24
|
-
|
|
24
|
+
search: A,
|
|
25
|
+
optionType: h,
|
|
25
26
|
id: s = `toolbar-filter-${o}`
|
|
26
27
|
}) => {
|
|
27
|
-
const { currentId:
|
|
28
|
+
const { currentId: v, toggleId: k, closeAll: d } = F(), u = j(), w = (m ?? []).map((r) => {
|
|
28
29
|
const e = c?.[r.name || o];
|
|
29
30
|
return {
|
|
30
31
|
name: o,
|
|
31
32
|
...r,
|
|
32
33
|
checked: Array.isArray(e) ? e.includes(r.value) : r.value === e
|
|
33
34
|
};
|
|
34
|
-
}), n = c?.[o],
|
|
35
|
+
}), n = c?.[o], B = g?.(o, n) ?? G(o, n), f = () => k(s), l = v === s, C = (r) => {
|
|
35
36
|
const e = r.relatedTarget;
|
|
36
37
|
u && (!e || !r.currentTarget.contains(e)) && d();
|
|
37
|
-
},
|
|
38
|
-
return /* @__PURE__ */
|
|
38
|
+
}, D = Array.isArray(n) ? n.length > 0 : typeof n < "u";
|
|
39
|
+
return /* @__PURE__ */ I(R, { expanded: l, onBlurCapture: C, "data-testid": "filter-base-" + s, children: [
|
|
39
40
|
/* @__PURE__ */ a(
|
|
40
|
-
|
|
41
|
+
O,
|
|
41
42
|
{
|
|
42
43
|
type: "select",
|
|
43
44
|
removable: i,
|
|
44
|
-
active:
|
|
45
|
+
active: D,
|
|
45
46
|
onToggle: f,
|
|
46
47
|
ariaLabel: p,
|
|
47
48
|
iconAltText: p,
|
|
48
49
|
onRemove: T,
|
|
49
50
|
"data-testid": s,
|
|
50
51
|
tabIndex: l ? -1 : 0,
|
|
51
|
-
children:
|
|
52
|
+
children: B || t
|
|
52
53
|
}
|
|
53
54
|
),
|
|
54
55
|
/* @__PURE__ */ a(
|
|
55
|
-
|
|
56
|
+
L,
|
|
56
57
|
{
|
|
57
58
|
open: l,
|
|
58
59
|
drawerTitle: t,
|
|
@@ -62,14 +63,15 @@ const E = (i, t) => Array.isArray(t) ? t.join(", ") : t, P = ({
|
|
|
62
63
|
label: x
|
|
63
64
|
},
|
|
64
65
|
children: /* @__PURE__ */ a(
|
|
65
|
-
|
|
66
|
+
E,
|
|
66
67
|
{
|
|
67
68
|
name: o,
|
|
68
|
-
options:
|
|
69
|
+
options: w,
|
|
69
70
|
optionGroups: b,
|
|
70
71
|
onChange: y,
|
|
71
|
-
optionType:
|
|
72
|
-
keyboardEvents: l && u
|
|
72
|
+
optionType: h,
|
|
73
|
+
keyboardEvents: l && u,
|
|
74
|
+
search: A
|
|
73
75
|
}
|
|
74
76
|
)
|
|
75
77
|
}
|
|
@@ -77,5 +79,5 @@ const E = (i, t) => Array.isArray(t) ? t.join(", ") : t, P = ({
|
|
|
77
79
|
] });
|
|
78
80
|
};
|
|
79
81
|
export {
|
|
80
|
-
|
|
82
|
+
Q as ToolbarFilter
|
|
81
83
|
};
|
|
@@ -1,77 +1,84 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as A,
|
|
3
|
-
import { useMenu as
|
|
1
|
+
import { jsxs as v, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as A, useState as F, useMemo as H, Fragment as K } from "react";
|
|
3
|
+
import { useMenu as N } from "../../hooks/useMenu.js";
|
|
4
4
|
import "../../index-p1eeF8LQ.js";
|
|
5
5
|
import "../Button/Button.js";
|
|
6
6
|
import "../RootProvider/RootProvider.js";
|
|
7
|
-
import { MenuOption as
|
|
8
|
-
import { MenuSearch as
|
|
9
|
-
import { MenuHeader as
|
|
10
|
-
import { MenuBase as
|
|
7
|
+
import { MenuOption as R } from "../Menu/MenuOption.js";
|
|
8
|
+
import { MenuSearch as q } from "../Menu/MenuSearch.js";
|
|
9
|
+
import { MenuHeader as z } from "../Menu/MenuHeader.js";
|
|
10
|
+
import { MenuBase as D, MenuList as E, MenuListItem as a } from "../Menu/MenuBase.js";
|
|
11
11
|
import "../Snackbar/useSnackbar.js";
|
|
12
|
-
const
|
|
13
|
-
name:
|
|
14
|
-
search:
|
|
15
|
-
optionGroups:
|
|
16
|
-
options:
|
|
17
|
-
onChange:
|
|
18
|
-
optionType:
|
|
19
|
-
keyboardEvents:
|
|
20
|
-
onBlurCapture:
|
|
12
|
+
const ne = ({
|
|
13
|
+
name: S,
|
|
14
|
+
search: i,
|
|
15
|
+
optionGroups: l = {},
|
|
16
|
+
options: c,
|
|
17
|
+
onChange: x,
|
|
18
|
+
optionType: y,
|
|
19
|
+
keyboardEvents: s,
|
|
20
|
+
onBlurCapture: V
|
|
21
21
|
}) => {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const u = A(null), [t, p] = F(""), L = H(
|
|
23
|
+
() => c.filter((r) => t ? r.label.toLowerCase().includes(t.toLowerCase()) : !0),
|
|
24
|
+
[c, t]
|
|
25
|
+
), { menu: k, setActiveIndex: I } = N({
|
|
26
|
+
items: L,
|
|
27
|
+
groups: l,
|
|
25
28
|
groupByKey: "groupId",
|
|
26
|
-
keyboardEvents:
|
|
27
|
-
ref:
|
|
29
|
+
keyboardEvents: s,
|
|
30
|
+
ref: u
|
|
28
31
|
});
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
return /* @__PURE__ */ v(D, { variant: "default", ref: u, children: [
|
|
33
|
+
i && /* @__PURE__ */ e(q, { ...i, value: t, onChange: (r) => {
|
|
34
|
+
p(r.target.value);
|
|
35
|
+
}, onClear: () => {
|
|
36
|
+
p("");
|
|
37
|
+
} }),
|
|
38
|
+
/* @__PURE__ */ e(E, { role: "menu", onBlurCapture: V, children: k.map((r, m) => {
|
|
39
|
+
const O = r?.props || {}, { title: d, divider: T = !0 } = O;
|
|
40
|
+
return /* @__PURE__ */ v(K, { children: [
|
|
41
|
+
m && T ? /* @__PURE__ */ e(a, { role: "separator" }) : "",
|
|
42
|
+
d && /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(z, { title: d }) }),
|
|
43
|
+
r?.items.filter((n) => !n.props?.hidden).map((n, j) => {
|
|
44
|
+
const { active: w, onMouseEnter: B } = n, { groupId: h, onClick: U, value: f, checked: C, type: M, ...o } = n.props || {}, { expanded: P } = o, g = o.name || S, b = M || h && l[h]?.optionType || y;
|
|
38
45
|
return /* @__PURE__ */ e(
|
|
39
|
-
|
|
46
|
+
a,
|
|
40
47
|
{
|
|
41
48
|
expanded: P,
|
|
42
|
-
onMouseEnter:
|
|
43
|
-
onMouseLeave: () =>
|
|
44
|
-
role:
|
|
45
|
-
"aria-checked":
|
|
49
|
+
onMouseEnter: B,
|
|
50
|
+
onMouseLeave: () => I(-1),
|
|
51
|
+
role: M === "radio" ? "menuitemradio" : "menuitemcheckbox",
|
|
52
|
+
"aria-checked": C ?? !1,
|
|
46
53
|
children: /* @__PURE__ */ e(
|
|
47
|
-
|
|
54
|
+
R,
|
|
48
55
|
{
|
|
49
56
|
...o,
|
|
50
|
-
active:
|
|
51
|
-
tabIndex:
|
|
57
|
+
active: w,
|
|
58
|
+
tabIndex: s ? -1 : 0,
|
|
52
59
|
label: o.label,
|
|
53
60
|
count: o.count,
|
|
54
|
-
name:
|
|
55
|
-
type:
|
|
56
|
-
value:
|
|
57
|
-
checked:
|
|
61
|
+
name: g,
|
|
62
|
+
type: b,
|
|
63
|
+
value: f,
|
|
64
|
+
checked: C,
|
|
58
65
|
onClick: () => {
|
|
59
|
-
|
|
60
|
-
name:
|
|
61
|
-
value:
|
|
62
|
-
type:
|
|
66
|
+
x?.({
|
|
67
|
+
name: g,
|
|
68
|
+
value: f,
|
|
69
|
+
type: b
|
|
63
70
|
});
|
|
64
71
|
}
|
|
65
72
|
}
|
|
66
73
|
)
|
|
67
74
|
},
|
|
68
|
-
|
|
75
|
+
j
|
|
69
76
|
);
|
|
70
77
|
})
|
|
71
|
-
] },
|
|
78
|
+
] }, m);
|
|
72
79
|
}) })
|
|
73
80
|
] });
|
|
74
81
|
};
|
|
75
82
|
export {
|
|
76
|
-
|
|
83
|
+
ne as ToolbarOptions
|
|
77
84
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as A } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as H } from "react";
|
|
3
3
|
import "../index-p1eeF8LQ.js";
|
|
4
4
|
import { Button as M } from "../components/Button/Button.js";
|
|
@@ -11,36 +11,36 @@ import { S as R, a as W } from "../HeartFill-CYSrJ_xK.js";
|
|
|
11
11
|
const x = (e) => e === "Organization" ? "company" : "person", et = ({
|
|
12
12
|
partyListDTO: e = [],
|
|
13
13
|
favoriteAccountUuids: o,
|
|
14
|
-
currentAccountUuid:
|
|
14
|
+
currentAccountUuid: u,
|
|
15
15
|
selfAccountUuid: l,
|
|
16
16
|
isLoading: d = !1,
|
|
17
17
|
onSelectAccount: b,
|
|
18
18
|
isVirtualized: I = !1,
|
|
19
19
|
onToggleFavorite: r,
|
|
20
20
|
languageCode: i,
|
|
21
|
-
showDeletedUnits:
|
|
21
|
+
showDeletedUnits: c,
|
|
22
22
|
onShowDeletedUnitsChange: n
|
|
23
23
|
}) => {
|
|
24
|
-
const
|
|
24
|
+
const f = G(), [P, m, v] = H(() => {
|
|
25
25
|
if (d || !e || !l)
|
|
26
26
|
return [[], {}, void 0];
|
|
27
|
-
const s = (t) => o?.includes(t), _ = (t) => !t.isDeleted ||
|
|
27
|
+
const s = (t) => o?.includes(t), _ = (t) => !t.isDeleted || c !== !1 || t.partyUuid === u, z = D(i), F = i || "nb", N = (t, a) => t.name.localeCompare(a.name, F, {
|
|
28
28
|
sensitivity: "base",
|
|
29
29
|
ignorePunctuation: !0
|
|
30
30
|
}), B = [...e].sort(N);
|
|
31
|
-
let
|
|
32
|
-
const
|
|
31
|
+
let U;
|
|
32
|
+
const k = [], y = [], g = [];
|
|
33
33
|
for (const t of B)
|
|
34
34
|
if (q(t.type)) {
|
|
35
35
|
if (t.partyUuid === l)
|
|
36
|
-
|
|
36
|
+
U = h(
|
|
37
37
|
i,
|
|
38
38
|
t,
|
|
39
39
|
"favorites",
|
|
40
|
-
|
|
40
|
+
u,
|
|
41
41
|
!1,
|
|
42
42
|
r,
|
|
43
|
-
|
|
43
|
+
f,
|
|
44
44
|
void 0,
|
|
45
45
|
!0
|
|
46
46
|
);
|
|
@@ -49,12 +49,12 @@ const x = (e) => e === "Organization" ? "company" : "person", et = ({
|
|
|
49
49
|
i,
|
|
50
50
|
t,
|
|
51
51
|
t.partyUuid,
|
|
52
|
-
|
|
52
|
+
u,
|
|
53
53
|
s(t.partyUuid),
|
|
54
54
|
r,
|
|
55
|
-
|
|
55
|
+
f
|
|
56
56
|
);
|
|
57
|
-
|
|
57
|
+
k.push(a), s(t.partyUuid) && g.push({ ...a, groupId: "favorites" });
|
|
58
58
|
}
|
|
59
59
|
} else if (Y(t.type)) {
|
|
60
60
|
if (_(t) || s(t.partyUuid)) {
|
|
@@ -62,10 +62,10 @@ const x = (e) => e === "Organization" ? "company" : "person", et = ({
|
|
|
62
62
|
i,
|
|
63
63
|
t,
|
|
64
64
|
t.partyUuid,
|
|
65
|
-
|
|
65
|
+
u,
|
|
66
66
|
s(t.partyUuid),
|
|
67
67
|
r,
|
|
68
|
-
|
|
68
|
+
f
|
|
69
69
|
);
|
|
70
70
|
_(t) && y.push(a), s(t.partyUuid) && g.push({ ...a, groupId: "favorites" });
|
|
71
71
|
}
|
|
@@ -77,10 +77,10 @@ const x = (e) => e === "Organization" ? "company" : "person", et = ({
|
|
|
77
77
|
i,
|
|
78
78
|
p,
|
|
79
79
|
t.partyUuid,
|
|
80
|
-
|
|
80
|
+
u,
|
|
81
81
|
s(p.partyUuid),
|
|
82
82
|
r,
|
|
83
|
-
|
|
83
|
+
f,
|
|
84
84
|
t
|
|
85
85
|
);
|
|
86
86
|
_(p) && y.push(O), s(p.partyUuid) && g.push({
|
|
@@ -90,14 +90,14 @@ const x = (e) => e === "Organization" ? "company" : "person", et = ({
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
if (
|
|
93
|
+
if (U === void 0)
|
|
94
94
|
return [[], {}, void 0];
|
|
95
|
-
const $ = [
|
|
95
|
+
const $ = [U, ...g, ...k, ...y], V = $.find((t) => t?.selected === !0), j = {
|
|
96
96
|
[y[0]?.groupId || "company"]: {
|
|
97
97
|
title: z.account_orgs,
|
|
98
98
|
divider: !0
|
|
99
99
|
},
|
|
100
|
-
[
|
|
100
|
+
[k[0]?.groupId || "person"]: {
|
|
101
101
|
title: z.account_persons,
|
|
102
102
|
divider: !0
|
|
103
103
|
},
|
|
@@ -111,12 +111,12 @@ const x = (e) => e === "Organization" ? "company" : "person", et = ({
|
|
|
111
111
|
e,
|
|
112
112
|
l,
|
|
113
113
|
o,
|
|
114
|
-
|
|
114
|
+
u,
|
|
115
115
|
d,
|
|
116
116
|
r,
|
|
117
117
|
i,
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
f,
|
|
119
|
+
c
|
|
120
120
|
]);
|
|
121
121
|
return d || !e || !v ? {
|
|
122
122
|
accountMenu: {
|
|
@@ -137,20 +137,20 @@ const x = (e) => e === "Organization" ? "company" : "person", et = ({
|
|
|
137
137
|
currentAccount: v
|
|
138
138
|
},
|
|
139
139
|
loading: !1,
|
|
140
|
-
showDeletedUnits:
|
|
140
|
+
showDeletedUnits: c,
|
|
141
141
|
onShowDeletedUnitsChange: n
|
|
142
142
|
};
|
|
143
|
-
}, h = (e, o,
|
|
144
|
-
const
|
|
143
|
+
}, h = (e, o, u, l, d, b, I, r, i) => {
|
|
144
|
+
const c = x(o?.type ?? ""), n = D(e), f = S({
|
|
145
145
|
fullName: o?.name,
|
|
146
|
-
type:
|
|
146
|
+
type: c
|
|
147
147
|
}), P = r ? S({
|
|
148
148
|
fullName: r?.name,
|
|
149
149
|
type: x(r?.type ?? ""),
|
|
150
150
|
reverseNameOrder: !1
|
|
151
151
|
}) : void 0;
|
|
152
152
|
let m = "";
|
|
153
|
-
const v =
|
|
153
|
+
const v = c === "company" && r ? "subunit" : c;
|
|
154
154
|
switch (v) {
|
|
155
155
|
case "company":
|
|
156
156
|
m = `${n.org_no}. ${o.organizationNumber}`;
|
|
@@ -167,19 +167,19 @@ const x = (e) => e === "Organization" ? "company" : "person", et = ({
|
|
|
167
167
|
return {
|
|
168
168
|
id: o?.partyUuid,
|
|
169
169
|
icon: {
|
|
170
|
-
name:
|
|
171
|
-
type:
|
|
170
|
+
name: f,
|
|
171
|
+
type: c,
|
|
172
172
|
isParent: !r,
|
|
173
173
|
isDeleted: o?.isDeleted
|
|
174
174
|
},
|
|
175
|
-
name:
|
|
175
|
+
name: f,
|
|
176
176
|
description: m,
|
|
177
|
-
groupId:
|
|
177
|
+
groupId: u,
|
|
178
178
|
type: v,
|
|
179
179
|
selected: l === o?.partyUuid,
|
|
180
180
|
disabled: !!o?.onlyHierarchyElementWithNoAccess,
|
|
181
181
|
badge: i ? { label: n.you, color: "person" } : o.isDeleted && I ? { label: n.deleted, color: "neutral" } : void 0,
|
|
182
|
-
controls: !i && /* @__PURE__ */
|
|
182
|
+
controls: !i && /* @__PURE__ */ A(
|
|
183
183
|
M,
|
|
184
184
|
{
|
|
185
185
|
rounded: !0,
|
|
@@ -189,7 +189,7 @@ const x = (e) => e === "Organization" ? "company" : "person", et = ({
|
|
|
189
189
|
b && (s.stopPropagation(), b(o?.partyUuid));
|
|
190
190
|
},
|
|
191
191
|
size: "xs",
|
|
192
|
-
children: d ? /* @__PURE__ */
|
|
192
|
+
children: d ? /* @__PURE__ */ A(R, {}) : /* @__PURE__ */ A(W, {})
|
|
193
193
|
}
|
|
194
194
|
)
|
|
195
195
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react-vite';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ removable, label, name, filterState, options, optionGroups, onChange, onRemove, buttonAltText, getSelectedLabel, showResultsLabel, optionType, id, }: import('./ToolbarFilter').ToolbarFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
component: ({ removable, label, name, filterState, options, optionGroups, onChange, onRemove, buttonAltText, getSelectedLabel, showResultsLabel, search, optionType, id, }: import('./ToolbarFilter').ToolbarFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
tags: string[];
|
|
6
6
|
parameters: {};
|
|
7
7
|
args: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MouseEventHandler } from 'react';
|
|
2
|
-
import { FilterChangePayload, FilterState } from '../';
|
|
2
|
+
import { FilterChangePayload, FilterState, ToolbarSearchProps } from '../';
|
|
3
3
|
import { MenuOptionProps } from '../Menu';
|
|
4
4
|
import { OptionGroup } from './ToolbarOptions';
|
|
5
5
|
type ToolbarFilterValue = (string | number)[];
|
|
@@ -20,6 +20,7 @@ export interface ToolbarFilterProps {
|
|
|
20
20
|
onChange?: (payload: FilterChangePayload) => void;
|
|
21
21
|
onRemove?: MouseEventHandler;
|
|
22
22
|
showResultsLabel?: string;
|
|
23
|
+
search?: ToolbarSearchProps;
|
|
23
24
|
}
|
|
24
|
-
export declare const ToolbarFilter: ({ removable, label, name, filterState, options, optionGroups, onChange, onRemove, buttonAltText, getSelectedLabel, showResultsLabel, optionType, id, }: ToolbarFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare const ToolbarFilter: ({ removable, label, name, filterState, options, optionGroups, onChange, onRemove, buttonAltText, getSelectedLabel, showResultsLabel, search, optionType, id, }: ToolbarFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
26
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react-vite';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ removable, label, name, filterState, options, optionGroups, onChange, onRemove, buttonAltText, getSelectedLabel, showResultsLabel, optionType, id, }: import('./ToolbarFilter').ToolbarFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
component: ({ removable, label, name, filterState, options, optionGroups, onChange, onRemove, buttonAltText, getSelectedLabel, showResultsLabel, search, optionType, id, }: import('./ToolbarFilter').ToolbarFilterProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
tags: string[];
|
|
6
6
|
parameters: {};
|
|
7
7
|
args: {
|
|
@@ -17,3 +17,4 @@ export default meta;
|
|
|
17
17
|
type Story = StoryObj<typeof meta>;
|
|
18
18
|
export declare const Single: Story;
|
|
19
19
|
export declare const Multiple: Story;
|
|
20
|
+
export declare const MultipleWithSearch: Story;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { MenuOptionProps
|
|
1
|
+
import { MenuOptionProps } from '../Menu';
|
|
2
2
|
import { FilterChangePayload } from './Toolbar.tsx';
|
|
3
|
+
import { ToolbarSearchProps } from './ToolbarSearch';
|
|
3
4
|
export type ToolbarOptionType = 'checkbox' | 'radio';
|
|
4
5
|
export interface OptionGroup {
|
|
5
6
|
title?: string;
|
|
@@ -10,7 +11,7 @@ export interface ToolbarOptionsProps {
|
|
|
10
11
|
name: string;
|
|
11
12
|
options: MenuOptionProps[];
|
|
12
13
|
onChange?: (input: FilterChangePayload) => void;
|
|
13
|
-
search?:
|
|
14
|
+
search?: ToolbarSearchProps;
|
|
14
15
|
optionType: ToolbarOptionType;
|
|
15
16
|
optionGroups?: {
|
|
16
17
|
[key: string]: OptionGroup;
|