@altinn/altinn-components 0.54.0 → 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
  };
@@ -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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.54.0",
3
+ "version": "0.54.1",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",