@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.
@@ -1,17 +1,17 @@
1
1
  "use client";
2
- import { jsx as o, jsxs as b } from "react/jsx-runtime";
3
- import { c as y } from "../../index-p1eeF8LQ.js";
4
- import u, { forwardRef as I, useState as j, useEffect as x } from "react";
5
- import { useIsDesktop as N } from "../../hooks/useIsDesktop.js";
6
- import { AccountMenu as q } from "../Account/AccountMenu.js";
7
- import { Button as R } from "../Button/Button.js";
8
- import { useRootContext as L } from "../RootProvider/RootProvider.js";
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 A } from "../Forms/SearchField.js";
11
- import { S as P } from "../../button-BB5sYVKY.js";
12
- import { H as V, S as H } from "../../switch-Cemfhx0H.js";
13
- import { u as O } from "../../useId-BVFxCjkq.js";
14
- import '../../assets/AccountSelector.css';var T = function(e, l) {
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 B = I((e, l) => {
23
- var { title: n, titleId: t } = e, r = T(e, ["title", "titleId"]);
24
- let i = O();
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 $ = function(e, l) {
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 D = I((e, l) => {
41
- var { title: n, titleId: t } = e, r = $(e, ["title", "titleId"]);
42
- let i = O();
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
- }), K = "_accountSelector_qwjt5_1", W = "_heading_qwjt5_11", G = "_searchSection_qwjt5_17", J = "_searchField_qwjt5_25", Q = "_accountMenu_qwjt5_29", U = "_fullScreen_qwjt5_37", X = "_virtualized_qwjt5_41", Y = "_btnIcon_qwjt5_45", Z = "_spinner_qwjt5_49", c = {
50
- accountSelector: K,
51
- heading: W,
52
- searchSection: G,
53
- searchField: J,
54
- accountMenu: Q,
55
- fullScreen: U,
56
- virtualized: X,
57
- btnIcon: Y,
58
- spinner: Z
59
- }, he = ({
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: m, openId: d, closeAll: p, languageCode: g } = L(), h = N(), a = m === "accountFullscreen", [v, S] = j(""), [f, w] = j(l);
68
- x(() => {
69
- !l && f && a && p(), w(l);
70
- }, [l]), x(() => {
71
- (f === !0 && !a || !h && m === "account") && d("accountFullscreen");
72
- }, [f, a, h, m, d]);
73
- const { minimize: z, fullscreen: k, searchText: _, heading: C, switchLabel: E } = ee(g), F = () => {
74
- d(a ? "account" : "accountFullscreen");
75
- }, M = (s) => {
76
- e.onSelectAccount?.(s), p(), w(!1);
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__ */ o(P, { "aria-hidden": !0, "data-color": "neutral", className: c.spinner }) : /* @__PURE__ */ b("div", { className: y(n, c.accountSelector), children: [
79
- /* @__PURE__ */ o(V, { "data-size": "sm", level: 2, className: c.heading, children: C }),
80
- /* @__PURE__ */ b("div", { className: c.searchSection, children: [
81
- /* @__PURE__ */ o(
82
- A,
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: v,
87
- onChange: (s) => S(s.target.value),
88
- onClear: () => S(""),
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__ */ o(
93
- H,
92
+ r !== void 0 && /* @__PURE__ */ a(
93
+ T,
94
94
  {
95
95
  checked: r,
96
96
  onChange: (s) => i?.(s.target.checked),
97
- label: E
97
+ label: F
98
98
  }
99
99
  )
100
100
  ] }),
101
- /* @__PURE__ */ o(
101
+ /* @__PURE__ */ a(
102
102
  "div",
103
103
  {
104
- className: y(
104
+ className: j(
105
105
  c.accountMenu,
106
- a && c.fullScreen,
106
+ o && c.fullScreen,
107
107
  e.isVirtualized && c.virtualized
108
108
  ),
109
- children: /* @__PURE__ */ o(
110
- q,
109
+ children: /* @__PURE__ */ a(
110
+ R,
111
111
  {
112
112
  ...e,
113
- onSelectAccount: M,
113
+ onSelectAccount: N,
114
114
  keyboardEvents: !1,
115
115
  search: {
116
116
  hidden: !0,
117
117
  name: "",
118
- value: v,
119
- getResultsLabel: (s) => te(s, g)
118
+ value: S,
119
+ getResultsLabel: (s) => ne(s, v)
120
120
  },
121
- scrollRefStyles: !a && e.isVirtualized ? { maxHeight: "calc(40vh)" } : void 0
121
+ scrollRefStyles: !o && e.isVirtualized ? { maxHeight: "calc(40vh)" } : void 0
122
122
  }
123
123
  )
124
124
  }
125
125
  ),
126
- f !== !0 && h && /* @__PURE__ */ o(
127
- R,
128
- {
129
- icon: a ? /* @__PURE__ */ o(D, { className: c.btnIcon, "aria-hidden": "true" }) : /* @__PURE__ */ o(B, { className: c.btnIcon, "aria-hidden": "true" }),
130
- variant: "ghost",
131
- onClick: F,
132
- children: a ? z : k
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
- }, ee = (e) => {
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
- }, te = (e, l) => {
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
- he as AccountSelector
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: v,
17
- children: y,
18
- showResultsLabel: S,
19
- removeButtonAltText: h,
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: S,
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: v,
77
- buttonAltText: h,
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
- y
101
+ v
101
102
  ] });
102
103
  };
103
104
  export {
@@ -1,15 +1,15 @@
1
- import { jsxs as D, jsx as a } from "react/jsx-runtime";
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 I } from "../../hooks/useIsDesktop.js";
4
+ import { useIsDesktop as j } from "../../hooks/useIsDesktop.js";
5
5
  import "../Button/Button.js";
6
- import { useRootContext as j } from "../RootProvider/RootProvider.js";
7
- import { DrawerOrDropdown as F } from "../Dropdown/DrawerOrDropdown.js";
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 L } from "./ToolbarButton.js";
10
- import { ToolbarFilterBase as O } from "./ToolbarFilterBase.js";
11
- import { ToolbarOptions as R } from "./ToolbarOptions.js";
12
- const E = (i, t) => Array.isArray(t) ? t.join(", ") : t, P = ({
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
- optionType: A,
24
+ search: A,
25
+ optionType: h,
25
26
  id: s = `toolbar-filter-${o}`
26
27
  }) => {
27
- const { currentId: h, toggleId: v, closeAll: d } = j(), u = I(), k = (m ?? []).map((r) => {
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], w = g?.(o, n) ?? E(o, n), f = () => v(s), l = h === s, B = (r) => {
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
- }, C = Array.isArray(n) ? n.length > 0 : typeof n < "u";
38
- return /* @__PURE__ */ D(O, { expanded: l, onBlurCapture: B, "data-testid": "filter-base-" + s, children: [
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
- L,
41
+ O,
41
42
  {
42
43
  type: "select",
43
44
  removable: i,
44
- active: C,
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: w || t
52
+ children: B || t
52
53
  }
53
54
  ),
54
55
  /* @__PURE__ */ a(
55
- F,
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
- R,
66
+ E,
66
67
  {
67
68
  name: o,
68
- options: k,
69
+ options: w,
69
70
  optionGroups: b,
70
71
  onChange: y,
71
- optionType: A,
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
- P as ToolbarFilter
82
+ Q as ToolbarFilter
81
83
  };
@@ -1,77 +1,84 @@
1
- import { jsxs as b, jsx as e } from "react/jsx-runtime";
2
- import { useRef as A, Fragment as F } from "react";
3
- import { useMenu as H } from "../../hooks/useMenu.js";
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 K } from "../Menu/MenuOption.js";
8
- import { MenuSearch as N } from "../Menu/MenuSearch.js";
9
- import { MenuHeader as R } from "../Menu/MenuHeader.js";
10
- import { MenuBase as S, MenuList as q, MenuListItem as t } from "../Menu/MenuBase.js";
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: x,
14
- search: n,
15
- optionGroups: i = {},
16
- options: y,
17
- onChange: v,
18
- optionType: g,
19
- keyboardEvents: p,
20
- onBlurCapture: k
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 m = A(null), { menu: I, setActiveIndex: L } = H({
23
- items: y,
24
- groups: i,
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: p,
27
- ref: m
29
+ keyboardEvents: s,
30
+ ref: u
28
31
  });
29
- return /* @__PURE__ */ b(S, { variant: "default", ref: m, children: [
30
- n && /* @__PURE__ */ e(N, { ...n }),
31
- /* @__PURE__ */ e(q, { role: "menu", onBlurCapture: k, children: I.map((a, c) => {
32
- const T = a?.props || {}, { title: s, divider: j = !0 } = T;
33
- return /* @__PURE__ */ b(F, { children: [
34
- c && j ? /* @__PURE__ */ e(t, { role: "separator" }) : "",
35
- s && /* @__PURE__ */ e(t, { children: /* @__PURE__ */ e(R, { title: s }) }),
36
- a?.items.filter((r) => !r.props?.hidden).map((r, B) => {
37
- const { active: C, onMouseEnter: O } = r, { groupId: l, onClick: w, value: u, checked: d, type: f, ...o } = r.props || {}, { expanded: P } = o, h = o.name || x, M = f || l && i[l]?.optionType || g;
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
- t,
46
+ a,
40
47
  {
41
48
  expanded: P,
42
- onMouseEnter: O,
43
- onMouseLeave: () => L(-1),
44
- role: f === "radio" ? "menuitemradio" : "menuitemcheckbox",
45
- "aria-checked": d ?? !1,
49
+ onMouseEnter: B,
50
+ onMouseLeave: () => I(-1),
51
+ role: M === "radio" ? "menuitemradio" : "menuitemcheckbox",
52
+ "aria-checked": C ?? !1,
46
53
  children: /* @__PURE__ */ e(
47
- K,
54
+ R,
48
55
  {
49
56
  ...o,
50
- active: C,
51
- tabIndex: p ? -1 : 0,
57
+ active: w,
58
+ tabIndex: s ? -1 : 0,
52
59
  label: o.label,
53
60
  count: o.count,
54
- name: h,
55
- type: M,
56
- value: u,
57
- checked: d,
61
+ name: g,
62
+ type: b,
63
+ value: f,
64
+ checked: C,
58
65
  onClick: () => {
59
- v?.({
60
- name: h,
61
- value: u,
62
- type: M
66
+ x?.({
67
+ name: g,
68
+ value: f,
69
+ type: b
63
70
  });
64
71
  }
65
72
  }
66
73
  )
67
74
  },
68
- B
75
+ j
69
76
  );
70
77
  })
71
- ] }, c);
78
+ ] }, m);
72
79
  }) })
73
80
  ] });
74
81
  };
75
82
  export {
76
- _ as ToolbarOptions
83
+ ne as ToolbarOptions
77
84
  };
@@ -1,4 +1,4 @@
1
- import { jsx as k } from "react/jsx-runtime";
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: f,
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: u,
21
+ showDeletedUnits: c,
22
22
  onShowDeletedUnitsChange: n
23
23
  }) => {
24
- const c = G(), [P, m, v] = H(() => {
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 || u !== !1, z = D(i), F = i || "nb", N = (t, a) => t.name.localeCompare(a.name, F, {
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 A;
32
- const U = [], y = [], g = [];
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
- A = h(
36
+ U = h(
37
37
  i,
38
38
  t,
39
39
  "favorites",
40
- f,
40
+ u,
41
41
  !1,
42
42
  r,
43
- c,
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
- f,
52
+ u,
53
53
  s(t.partyUuid),
54
54
  r,
55
- c
55
+ f
56
56
  );
57
- U.push(a), s(t.partyUuid) && g.push({ ...a, groupId: "favorites" });
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
- f,
65
+ u,
66
66
  s(t.partyUuid),
67
67
  r,
68
- c
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
- f,
80
+ u,
81
81
  s(p.partyUuid),
82
82
  r,
83
- c,
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 (A === void 0)
93
+ if (U === void 0)
94
94
  return [[], {}, void 0];
95
- const $ = [A, ...g, ...U, ...y], V = $.find((t) => t?.selected === !0), j = {
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
- [U[0]?.groupId || "person"]: {
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
- f,
114
+ u,
115
115
  d,
116
116
  r,
117
117
  i,
118
- c,
119
- u
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: u,
140
+ showDeletedUnits: c,
141
141
  onShowDeletedUnitsChange: n
142
142
  };
143
- }, h = (e, o, f, l, d, b, I, r, i) => {
144
- const u = x(o?.type ?? ""), n = D(e), c = S({
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: u
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 = u === "company" && r ? "subunit" : u;
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: c,
171
- type: u,
170
+ name: f,
171
+ type: c,
172
172
  isParent: !r,
173
173
  isDeleted: o?.isDeleted
174
174
  },
175
- name: c,
175
+ name: f,
176
176
  description: m,
177
- groupId: f,
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__ */ k(
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__ */ k(R, {}) : /* @__PURE__ */ k(W, {})
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, MenuSearchProps } from '../Menu';
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?: MenuSearchProps;
14
+ search?: ToolbarSearchProps;
14
15
  optionType: ToolbarOptionType;
15
16
  optionGroups?: {
16
17
  [key: string]: OptionGroup;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.53.1",
3
+ "version": "0.54.1",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",