@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 t } from "react/jsx-runtime";
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 p } from "../List/ListBase.js";
5
+ import { ListBase as i } from "../List/ListBase.js";
6
6
  import "../Search/AutocompleteBase.js";
7
- import { AccountListItem as i } from "./AccountListItem.js";
7
+ import { AccountListItem as e } from "./AccountListItem.js";
8
8
  import "../Snackbar/useSnackbar.js";
9
- const L = ({ items: r }) => /* @__PURE__ */ t(p, { children: r == null ? void 0 : r.map((o) => /* @__PURE__ */ m(i, { ...o, key: o.id }, "Details")) });
9
+ const d = ({ items: t }) => /* @__PURE__ */ o(i, { children: t.map((r) => /* @__PURE__ */ m(e, { ...r, key: r.id })) });
10
10
  export {
11
- L as AccountList
11
+ d as AccountList
12
12
  };
@@ -1,102 +1,102 @@
1
1
  "use client";
2
- import { jsxs as E, jsx as m } from "react/jsx-runtime";
3
- import { useState as v, useEffect as M, useMemo as T } from "react";
4
- import { useRootContext as V } from "../RootProvider/RootProvider.js";
5
- import { ToolbarAccountMenu as $ } from "./ToolbarAccountMenu.js";
6
- import { ToolbarAdd as q } from "./ToolbarAdd.js";
7
- import { ToolbarBase as w } from "./ToolbarBase.js";
8
- import { ToolbarFilter as z } from "./ToolbarFilter.js";
9
- import { ToolbarSearch as D } from "./ToolbarSearch.js";
10
- const g = (n, r) => r || `toolbar-filter-${n}`, X = ({
11
- filters: n = [],
12
- filterState: r,
13
- onFilterStateChange: b,
14
- search: u,
15
- accountMenu: f,
16
- getFilterLabel: S,
17
- children: y,
18
- showResultsLabel: x,
19
- removeButtonAltText: A,
20
- addFilterButtonLabel: h
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: C, closeAll: I } = V(), [N, R] = v(r || {}), p = typeof b == "function" ? b : R, t = r || N, [c, d] = v(
23
- (n == null ? void 0 : n.filter((o) => !(o.removable && typeof t[o.name] > "u")).map((o) => o.name)) ?? []
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
- M(() => {
26
- d(
27
- (n == null ? void 0 : n.filter((o) => !(o.removable && typeof t[o.name] > "u")).map((o) => o.name)) ?? []
28
- );
29
- }, [t]);
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
- }, L = (o) => {
46
- d((e) => e.filter((l) => l !== o)), p({
47
- ...t,
48
- [o]: void 0
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__ */ E(w, { children: [
54
- f && /* @__PURE__ */ m($, { ...f }),
55
- u && /* @__PURE__ */ m(D, { ...u }),
56
- j.map((o) => /* @__PURE__ */ m(
57
- z,
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: g(o.name, o.id),
60
- showResultsLabel: x,
61
- onRemove: () => {
62
- L(o.name);
63
- },
64
- onChange: (e) => {
65
- G(e);
66
- },
67
- name: o.name,
68
- options: o.options,
69
- label: o.label,
70
- optionType: o.optionType,
71
- removable: o.removable,
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
- o.name
79
+ e.name
78
80
  )),
79
- (i == null ? void 0 : i.length) > 0 && /* @__PURE__ */ m(
80
- q,
81
+ (s == null ? void 0 : s.length) > 0 && /* @__PURE__ */ c(
82
+ E,
81
83
  {
82
84
  id: "toolbar-filter-add",
83
- label: h,
84
- items: i.map((o) => {
85
- const e = g(o.name, o.id);
85
+ label: A,
86
+ items: s.map((e) => {
87
+ const o = T(e.name, e.id);
86
88
  return {
87
- id: e,
88
- title: o.label,
89
- name: o.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
- y
97
+ F
98
98
  ] });
99
99
  };
100
100
  export {
101
- X as Toolbar
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.25.2",
3
+ "version": "0.25.4",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",