@altinn/altinn-components 0.46.2 → 0.46.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 +1 @@
1
- ._searchbar_13e7s_1{position:relative}._searchbar_13e7s_1[data-autocomplete=true][aria-expanded=true] input{border-bottom-left-radius:0;border-bottom-right-radius:0}._searchbar_13e7s_1 nav{display:none}._searchbarExpanded_13e7s_14 nav{position:absolute;display:block;border-top-left-radius:0;border-top-right-radius:0;margin-top:-2px}._searchbarLocal_13e7s_22{width:100%;padding:var(--dsc-spacing-4) 0;z-index:100;margin-bottom:16px}@media (min-width: 1024px){._searchbarLocal_13e7s_22{max-width:320px;margin-right:auto}._searchbarLocal_13e7s_22._searchbarExpanded_13e7s_14{max-width:640px}}
1
+ ._searchbar_1sz2n_1{position:relative}._searchbar_1sz2n_1[data-autocomplete=true][aria-expanded=true] input{border-bottom-left-radius:0;border-bottom-right-radius:0}._searchbar_1sz2n_1 nav{display:none}._searchbarExpanded_1sz2n_14 nav{position:absolute;display:block;border-top-left-radius:0;border-top-right-radius:0;margin-top:-2px}._searchbarLocal_1sz2n_22{width:100%;padding:var(--dsc-spacing-4) 0;margin-bottom:16px}._searchbarLocal_1sz2n_22._searchbarExpanded_1sz2n_14{z-index:100}@media (min-width: 1024px){._searchbarLocal_1sz2n_22{max-width:320px;margin-right:auto;z-index:100}._searchbarLocal_1sz2n_22._searchbarExpanded_1sz2n_14{max-width:640px}}
@@ -1,7 +1,7 @@
1
- import { jsx as b } from "react/jsx-runtime";
2
- import { c as l } from "../../index-L8X2o7IH.js";
3
- import '../../assets/SearchbarBase.css';const n = "_searchbar_13e7s_1", d = "_searchbarExpanded_13e7s_14", _ = "_searchbarLocal_13e7s_22", a = {
4
- searchbar: n,
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { c as b } from "../../index-L8X2o7IH.js";
3
+ import '../../assets/SearchbarBase.css';const l = "_searchbar_1sz2n_1", d = "_searchbarExpanded_1sz2n_14", _ = "_searchbarLocal_1sz2n_22", a = {
4
+ searchbar: l,
5
5
  searchbarExpanded: d,
6
6
  searchbarLocal: _
7
7
  }, m = ({
@@ -12,13 +12,13 @@ import '../../assets/SearchbarBase.css';const n = "_searchbar_13e7s_1", d = "_se
12
12
  autocomplete: o = !1,
13
13
  useGlobalHeader: t = !1
14
14
  }) => {
15
- const h = l(
15
+ const h = b(
16
16
  a.searchbar,
17
17
  r,
18
18
  e && a.searchbarExpanded,
19
19
  t && a.searchbarLocal
20
20
  );
21
- return /* @__PURE__ */ b("div", { className: h, "data-autocomplete": o, onBlurCapture: c, children: s });
21
+ return /* @__PURE__ */ n("div", { className: h, "data-autocomplete": o, onBlurCapture: c, children: s });
22
22
  };
23
23
  export {
24
24
  m as SearchbarBase
@@ -1,67 +1,87 @@
1
- import { jsx as o, jsxs as u } from "react/jsx-runtime";
1
+ import { jsx as r, jsxs as k } from "react/jsx-runtime";
2
2
  import "../../index-L8X2o7IH.js";
3
- import { useState as g } from "react";
4
- import { Button as x } from "../Button/Button.js";
5
- import { IconButton as z } from "../Button/IconButton.js";
6
- import { ButtonGroup as b } from "../Button/ButtonGroup.js";
3
+ import { useState as x } from "react";
4
+ import { Button as S } from "../Button/Button.js";
5
+ import { IconButton as h } from "../Button/IconButton.js";
6
+ import { ButtonGroup as G } from "../Button/ButtonGroup.js";
7
7
  import "../RootProvider/RootProvider.js";
8
- import { QueryLabel as S } from "../Searchbar/QueryLabel.js";
9
- import { TextField as h } from "../Forms/TextField.js";
8
+ import { QueryLabel as C } from "../Searchbar/QueryLabel.js";
9
+ import { TextField as j } from "../Forms/TextField.js";
10
10
  import "../Snackbar/useSnackbar.js";
11
- import { SettingsItemBase as G } from "./SettingsItemBase.js";
12
- import { SettingsModal as j } from "./SettingsModal.js";
13
- import { S as C } from "../../MagnifyingGlass-bwVhw07z.js";
14
- import { S as M } from "../../Pencil-BVHLEoQy.js";
15
- const K = ({
11
+ import { SettingsItemBase as M } from "./SettingsItemBase.js";
12
+ import { SettingsModal as T } from "./SettingsModal.js";
13
+ import { S as u } from "../../MagnifyingGlass-bwVhw07z.js";
14
+ import { S as A } from "../../Pencil-BVHLEoQy.js";
15
+ const U = ({
16
16
  id: d,
17
- icon: n = C,
18
- loading: k,
19
- title: i,
20
- params: m,
21
- controls: s,
22
- inputValue: a,
23
- titleField: r,
24
- saveButton: t,
25
- removeButton: e,
26
- onChange: p,
27
- ...I
17
+ icon: m = u,
18
+ loading: I,
19
+ title: a,
20
+ params: f,
21
+ controls: p,
22
+ inputValue: t,
23
+ titleField: l,
24
+ saveButton: i,
25
+ removeButton: o,
26
+ onChange: c,
27
+ ...y
28
28
  }) => {
29
- const [f, l] = g(!1), [v, y] = g("");
30
- return /* @__PURE__ */ o(
31
- G,
29
+ const [g, e] = x(!1), [z, b] = x("");
30
+ return /* @__PURE__ */ r(
31
+ M,
32
32
  {
33
- ...I,
33
+ ...y,
34
34
  id: d,
35
- expanded: f,
36
- icon: n,
37
- loading: k,
38
- title: i,
39
- value: /* @__PURE__ */ o(S, { params: m, size: "xs" }),
40
- controls: s || /* @__PURE__ */ o(z, { size: "xs", icon: M, iconAltText: "Edit", variant: "outline", onClick: () => l(!0) }),
35
+ expanded: g,
36
+ icon: m,
37
+ loading: I,
38
+ title: a,
39
+ value: /* @__PURE__ */ r(C, { params: f, size: "xs" }),
40
+ controls: p || /* @__PURE__ */ r(h, { size: "xs", icon: A, iconAltText: "Edit", variant: "outline", onClick: () => e(!0) }),
41
41
  linkIcon: !0,
42
- children: /* @__PURE__ */ u(j, { icon: n, title: i, open: f, onClose: () => l(!1), children: [
43
- /* @__PURE__ */ o(S, { params: m }),
44
- /* @__PURE__ */ o(
45
- h,
42
+ children: /* @__PURE__ */ k(T, { icon: m, title: a, open: g, onClose: () => e(!1), children: [
43
+ /* @__PURE__ */ r(C, { params: f }),
44
+ /* @__PURE__ */ r(
45
+ j,
46
46
  {
47
- ...r,
48
- label: (r == null ? void 0 : r.label) || "Gi søket et navn",
47
+ ...l,
48
+ label: (l == null ? void 0 : l.label) || "Gi søket et navn",
49
49
  size: "sm",
50
50
  name: "title",
51
- value: typeof a == "string" ? a : v,
52
- onChange: (c) => {
53
- typeof p == "function" ? p(c) : y(c.target.value);
51
+ value: typeof t == "string" ? t : z,
52
+ onChange: (n) => {
53
+ typeof c == "function" ? c(n) : b(n.target.value);
54
54
  }
55
55
  }
56
56
  ),
57
- (t || e) && /* @__PURE__ */ u(b, { size: "md", children: [
58
- t && /* @__PURE__ */ o(x, { ...t }),
59
- e && /* @__PURE__ */ o(x, { ...e, variant: "outline", color: "danger" })
57
+ (i || o) && /* @__PURE__ */ k(G, { size: "md", children: [
58
+ i && /* @__PURE__ */ r(
59
+ S,
60
+ {
61
+ ...i,
62
+ onClick: (n) => {
63
+ var s;
64
+ (s = i.onClick) == null || s.call(i, n), e(!1);
65
+ }
66
+ }
67
+ ),
68
+ o && /* @__PURE__ */ r(
69
+ S,
70
+ {
71
+ ...o,
72
+ variant: "outline",
73
+ color: "danger",
74
+ onClick: (n) => {
75
+ var s;
76
+ (s = o.onClick) == null || s.call(o, n), e(!1);
77
+ }
78
+ }
79
+ )
60
80
  ] })
61
81
  ] })
62
82
  }
63
83
  );
64
84
  };
65
85
  export {
66
- K as BookmarksSettingsItem
86
+ U as BookmarksSettingsItem
67
87
  };
@@ -1,100 +1,100 @@
1
- import { jsx as w } from "react/jsx-runtime";
2
- import { useMemo as G } from "react";
1
+ import { jsx as E } from "react/jsx-runtime";
2
+ import { useMemo as K } from "react";
3
3
  import "../index-L8X2o7IH.js";
4
- import { IconButton as E } from "../components/Button/IconButton.js";
4
+ import { IconButton as R } from "../components/Button/IconButton.js";
5
5
  import "../components/RootProvider/RootProvider.js";
6
- import { useIsDesktop as K } from "./useIsDesktop.js";
6
+ import { useIsDesktop as U } from "./useIsDesktop.js";
7
7
  import "../components/Snackbar/useSnackbar.js";
8
- import { formatDisplayName as N } from "../functions/name/name.js";
9
- import { formatDate as R } from "../functions/date/date.js";
10
- import { S as U, a as W } from "../HeartFill-CYSrJ_xK.js";
11
- const P = (o) => o === "Organization" ? "company" : "person", ot = ({
12
- partyListDTO: o = [],
8
+ import { formatDisplayName as $ } from "../functions/name/name.js";
9
+ import { formatDate as W } from "../functions/date/date.js";
10
+ import { S as Y, a as q } from "../HeartFill-CYSrJ_xK.js";
11
+ const S = (t) => t === "Organization" ? "company" : "person", te = ({
12
+ partyListDTO: t = [],
13
13
  favoriteAccountUuids: e,
14
14
  currentAccountUuid: u,
15
- selfAccountUuid: d,
16
- isLoading: a = !1,
17
- onSelectAccount: v,
18
- isVirtualized: g = !1,
19
- onToggleFavorite: r,
15
+ selfAccountUuid: m,
16
+ isLoading: f = !1,
17
+ onSelectAccount: _,
18
+ isVirtualized: h = !1,
19
+ onToggleFavorite: s,
20
20
  languageCode: c
21
21
  }) => {
22
- const s = K(), [n, _, l] = G(() => {
23
- var k, x;
24
- if (a || !o || !d)
22
+ const r = U(), [i, b, a] = K(() => {
23
+ var A, N;
24
+ if (f || !t || !m)
25
25
  return [[], {}, void 0];
26
- const i = (t) => e == null ? void 0 : e.includes(t), m = S(c), h = o.find((t) => $(t.type) && t.partyUuid === d), I = o.filter((t) => $(t.type) && t.partyUuid !== d), D = o.filter((t) => Y(t.type)), O = b(
26
+ const n = (o) => e == null ? void 0 : e.includes(o), l = D(c), I = t.find((o) => O(o.type) && o.partyUuid === m), z = t.filter((o) => O(o.type) && o.partyUuid !== m), B = t.filter((o) => J(o.type)), F = g(
27
27
  c,
28
- h,
28
+ I,
29
29
  "favorites",
30
30
  u,
31
31
  !1,
32
- r,
33
32
  s,
33
+ r,
34
34
  void 0,
35
35
  !0
36
- ), y = I == null ? void 0 : I.map(
37
- (t) => b(
36
+ ), k = z == null ? void 0 : z.map(
37
+ (o) => g(
38
38
  c,
39
- t,
40
- t.partyUuid,
39
+ o,
40
+ o.partyUuid,
41
41
  u,
42
- i(t.partyUuid),
43
- r,
44
- s
42
+ n(o.partyUuid),
43
+ s,
44
+ r
45
45
  )
46
- ), p = [];
47
- for (const t of D) {
48
- const f = b(
46
+ ), v = [];
47
+ for (const o of B) {
48
+ const d = g(
49
49
  c,
50
- t,
51
- t.partyUuid,
50
+ o,
51
+ o.partyUuid,
52
52
  u,
53
- i(t.partyUuid),
54
- r,
55
- s
53
+ n(o.partyUuid),
54
+ s,
55
+ r
56
56
  );
57
- if (p.push(f), t.subunits && t.subunits.length > 0)
58
- for (const A of t.subunits) {
59
- const V = b(
57
+ if (v.push(d), o.subunits && o.subunits.length > 0)
58
+ for (const P of o.subunits) {
59
+ const G = g(
60
60
  c,
61
- A,
62
- t.partyUuid,
61
+ P,
62
+ o.partyUuid,
63
63
  u,
64
- i(A.partyUuid),
65
- r,
64
+ n(P.partyUuid),
66
65
  s,
67
- t
66
+ r,
67
+ o
68
68
  );
69
- p.push(V);
69
+ v.push(G);
70
70
  }
71
71
  }
72
- const F = y.reduce((t, f) => (i(f.id) && t.push({ ...f, groupId: "favorites" }), t), []), j = p.reduce((t, f) => (i(f.id) && t.push({ ...f, groupId: "favorites" }), t), []), B = [...F, ...j], z = [O, ...B, ...y, ...p], H = z.find((t) => (t == null ? void 0 : t.selected) === !0), M = {
73
- [((k = p[0]) == null ? void 0 : k.groupId) || "company"]: {
74
- title: m.account_orgs,
72
+ const j = k.reduce((o, d) => (n(d.id) && o.push({ ...d, groupId: "favorites" }), o), []), H = v.reduce((o, d) => (n(d.id) && o.push({ ...d, groupId: "favorites" }), o), []), M = [...j, ...H], x = [F, ...M, ...k, ...v], V = x.find((o) => (o == null ? void 0 : o.selected) === !0), w = {
73
+ [((A = v[0]) == null ? void 0 : A.groupId) || "company"]: {
74
+ title: l.account_orgs,
75
75
  divider: !0
76
76
  },
77
- [((x = y[0]) == null ? void 0 : x.groupId) || "person"]: {
78
- title: m.account_persons,
77
+ [((N = k[0]) == null ? void 0 : N.groupId) || "person"]: {
78
+ title: l.account_persons,
79
79
  divider: !0
80
80
  },
81
81
  favorites: {
82
- title: m.account_favorites,
82
+ title: l.account_favorites,
83
83
  divider: !0
84
84
  }
85
85
  };
86
- return [z, M, H];
86
+ return [x, w, V];
87
87
  }, [
88
- o,
89
- d,
88
+ t,
89
+ m,
90
90
  e,
91
91
  u,
92
- a,
93
- r,
92
+ f,
93
+ s,
94
94
  c,
95
- s
95
+ r
96
96
  ]);
97
- return a || !o || !l ? {
97
+ return f || !t || !a ? {
98
98
  accountMenu: {
99
99
  items: [],
100
100
  groups: {},
@@ -103,71 +103,73 @@ const P = (o) => o === "Organization" ? "company" : "person", ot = ({
103
103
  },
104
104
  currentAccount: void 0
105
105
  },
106
- loading: a
106
+ loading: f
107
107
  } : {
108
108
  accountMenu: {
109
- items: n,
110
- groups: _,
111
- isVirtualized: g,
112
- onSelectAccount: v,
113
- currentAccount: l
109
+ items: i,
110
+ groups: b,
111
+ isVirtualized: h,
112
+ onSelectAccount: _,
113
+ currentAccount: a
114
114
  },
115
115
  loading: !1
116
116
  };
117
- }, b = (o, e, u, d, a, v, g, r, c) => {
118
- const s = P((e == null ? void 0 : e.type) ?? ""), n = S(o), _ = N({
119
- fullName: e.name,
120
- type: s
121
- }), l = r ? N({
122
- fullName: r.name,
123
- type: P(r.type ?? ""),
117
+ }, g = (t, e, u, m, f, _, h, s, c) => {
118
+ const r = S((e == null ? void 0 : e.type) ?? ""), i = D(t), b = $({
119
+ fullName: e == null ? void 0 : e.name,
120
+ type: r
121
+ }), a = s ? $({
122
+ fullName: s == null ? void 0 : s.name,
123
+ type: S((s == null ? void 0 : s.type) ?? ""),
124
124
  reverseNameOrder: !1
125
125
  }) : void 0;
126
- let i = "";
127
- const m = s === "company" && r ? "subunit" : s;
128
- switch (m) {
126
+ let n = "";
127
+ const l = r === "company" && s ? "subunit" : r;
128
+ switch (l) {
129
129
  case "company":
130
- i = `${n.org_no}: ${e.organizationNumber}`;
130
+ n = `${i.org_no}: ${e.organizationNumber}`;
131
131
  break;
132
132
  case "person":
133
- i = `${n.birthdate}: ${R(e.dateOfBirth)}`;
133
+ n = e != null && e.dateOfBirth ? `${i.birthdate}: ${W(e == null ? void 0 : e.dateOfBirth)}` : "";
134
134
  break;
135
135
  case "subunit":
136
- i = `↳ ${n.org_no}: ${e.organizationNumber}, ${n.subunit_of} ${l}`;
136
+ n = `↳ ${i.org_no}: ${e == null ? void 0 : e.organizationNumber}, ${i.subunit_of} ${a}`;
137
137
  break;
138
+ default:
139
+ n = "";
138
140
  }
139
141
  return {
140
- id: e.partyUuid,
142
+ id: e == null ? void 0 : e.partyUuid,
141
143
  icon: {
142
- name: _,
143
- type: s,
144
- isParent: !r,
145
- isDeleted: e.isDeleted,
146
- colorKey: l ?? void 0
144
+ name: b,
145
+ type: r,
146
+ isParent: !s,
147
+ isDeleted: e == null ? void 0 : e.isDeleted,
148
+ colorKey: a ?? void 0
147
149
  },
148
- name: _,
149
- description: i,
150
+ name: b,
151
+ description: n,
150
152
  groupId: u,
151
- type: m,
152
- selected: d === e.partyUuid,
153
- disabled: !!e.onlyHierarchyElementWithNoAccess,
154
- badge: c ? { label: n.you, color: "person" } : e.isDeleted && g ? { label: n.deleted, color: "neutral" } : void 0,
155
- controls: !c && /* @__PURE__ */ w(
156
- E,
153
+ type: l,
154
+ selected: m === (e == null ? void 0 : e.partyUuid),
155
+ disabled: !!(e != null && e.onlyHierarchyElementWithNoAccess),
156
+ badge: c ? { label: i.you, color: "person" } : e.isDeleted && h ? { label: i.deleted, color: "neutral" } : void 0,
157
+ controls: !c && /* @__PURE__ */ E(
158
+ R,
157
159
  {
158
160
  rounded: !0,
159
161
  variant: "text",
160
- icon: a ? U : W,
161
- iconAltText: a ? n.remove_from_favorites : n.add_to_favorites,
162
- onClick: (h) => {
163
- v && (h.stopPropagation(), v(e.partyUuid));
162
+ icon: f ? Y : q,
163
+ iconAltText: f ? i.remove_from_favorites : i.add_to_favorites,
164
+ onClick: (I) => {
165
+ _ && (I.stopPropagation(), _(e == null ? void 0 : e.partyUuid));
164
166
  },
165
167
  size: "xs"
166
168
  }
167
169
  )
168
170
  };
169
- }, Y = (o) => o === "Organization", $ = (o) => o === "Person", S = (o) => {
170
- switch (o) {
171
+ }, J = (t) => t === "Organization", O = (t) => t === "Person" || t === "SelfIdentified", D = (t) => {
172
+ switch (t) {
171
173
  case "nn":
172
174
  return {
173
175
  account_orgs: "Virksemder",
@@ -210,5 +212,5 @@ const P = (o) => o === "Organization" ? "company" : "person", ot = ({
210
212
  }
211
213
  };
212
214
  export {
213
- ot as useAccountSelector
215
+ te as useAccountSelector
214
216
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.46.2",
3
+ "version": "0.46.4",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",