@altinn/altinn-components 0.56.23 → 0.56.25

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,78 +1,81 @@
1
1
  import { jsx as c, jsxs as f } from "react/jsx-runtime";
2
2
  import { c as p } from "../../index-p1eeF8LQ.js";
3
3
  import { useState as _, useEffect as g } from "react";
4
- import { AccountMenu as w } from "../Account/AccountMenu.js";
4
+ import { useLockBodyScroll as N } from "../../hooks/useLockBodyScroll.js";
5
+ import { AccountMenu as L } from "../Account/AccountMenu.js";
5
6
  import "../Button/Button.js";
6
7
  import "react-dom";
7
- import { useRootContext as N } from "../RootProvider/RootProvider.js";
8
+ import { useRootContext as A } from "../RootProvider/RootProvider.js";
8
9
  import "../Snackbar/useSnackbar.js";
9
- import { S as A } from "../../SearchField-QTfebYdU.js";
10
- import { S as L } from "../../button-BB5sYVKY.js";
11
- import { H as M, S as F } from "../../switch-Cemfhx0H.js";
12
- import '../../assets/AccountSelector.css';const T = "_accountSelector_139de_1", j = "_heading_139de_11", C = "_searchSection_139de_17", H = "_searchField_139de_26", V = "_accountMenu_139de_30", y = "_virtualized_139de_38", E = "_spinner_139de_47", r = {
13
- accountSelector: T,
14
- heading: j,
15
- searchSection: C,
16
- searchField: H,
17
- accountMenu: V,
18
- virtualized: y,
19
- spinner: E
20
- }, Z = ({
10
+ import { S as M } from "../../SearchField-QTfebYdU.js";
11
+ import { S as F } from "../../button-BB5sYVKY.js";
12
+ import { H as T, S as j } from "../../switch-Cemfhx0H.js";
13
+ import '../../assets/AccountSelector.css';const y = "_accountSelector_139de_1", C = "_heading_139de_11", H = "_searchSection_139de_17", V = "_searchField_139de_26", I = "_accountMenu_139de_30", E = "_virtualized_139de_38", R = "_spinner_139de_47", n = {
14
+ accountSelector: y,
15
+ heading: C,
16
+ searchSection: H,
17
+ searchField: V,
18
+ accountMenu: I,
19
+ virtualized: E,
20
+ spinner: R
21
+ }, U = ({
21
22
  accountMenu: e,
22
23
  forceOpenFullScreen: t,
23
24
  className: i,
24
25
  loading: v,
25
26
  showDeletedUnits: s,
26
- onShowDeletedUnitsChange: x
27
+ onShowDeletedUnitsChange: k
27
28
  }) => {
28
- const { openId: o, closeAll: l, languageCode: d } = N(), [u, h] = _(""), [a, m] = _(t);
29
+ const { openId: o, closeAll: l, languageCode: d, currentId: x } = A();
30
+ N(x === "account");
31
+ const [u, h] = _(""), [a, m] = _(t);
29
32
  g(() => {
30
33
  !t && a && l(), m(t);
31
34
  }, [t]), g(() => {
32
35
  a === !0 && o("account");
33
36
  }, [a, o]);
34
- const { searchText: S, heading: z, switchLabel: b } = I(d), k = (n) => {
35
- e.onSelectAccount?.(n), l(), m(!1);
37
+ const { searchText: S, heading: z, switchLabel: b } = $(d), w = (r) => {
38
+ e.onSelectAccount?.(r), l(), m(!1);
36
39
  };
37
- return v ? /* @__PURE__ */ c(L, { "aria-hidden": !0, "data-color": "neutral", className: r.spinner }) : /* @__PURE__ */ f("div", { className: p(i, r.accountSelector), children: [
38
- /* @__PURE__ */ c(M, { "data-size": "sm", level: 2, className: r.heading, children: z }),
39
- /* @__PURE__ */ f("div", { className: r.searchSection, children: [
40
+ return v ? /* @__PURE__ */ c(F, { "aria-hidden": !0, "data-color": "neutral", className: n.spinner }) : /* @__PURE__ */ f("div", { className: p(i, n.accountSelector), children: [
41
+ /* @__PURE__ */ c(T, { "data-size": "sm", level: 2, className: n.heading, children: z }),
42
+ /* @__PURE__ */ f("div", { className: n.searchSection, children: [
40
43
  /* @__PURE__ */ c(
41
- A,
44
+ M,
42
45
  {
43
46
  name: S,
44
47
  placeholder: S,
45
48
  value: u,
46
- onChange: (n) => h(n.target.value),
49
+ onChange: (r) => h(r.target.value),
47
50
  onClear: () => h(""),
48
- className: r.searchField
51
+ className: n.searchField
49
52
  }
50
53
  ),
51
54
  s !== void 0 && /* @__PURE__ */ c(
52
- F,
55
+ j,
53
56
  {
54
57
  checked: s,
55
- onChange: (n) => x?.(n.target.checked),
58
+ onChange: (r) => k?.(r.target.checked),
56
59
  label: b
57
60
  }
58
61
  )
59
62
  ] }),
60
- /* @__PURE__ */ c("div", { className: p(r.accountMenu, e.virtualized && r.virtualized), children: /* @__PURE__ */ c(
61
- w,
63
+ /* @__PURE__ */ c("div", { className: p(n.accountMenu, e.virtualized && n.virtualized), children: /* @__PURE__ */ c(
64
+ L,
62
65
  {
63
66
  ...e,
64
- onSelectAccount: k,
67
+ onSelectAccount: w,
65
68
  keyboardEvents: !1,
66
69
  search: {
67
70
  hidden: !0,
68
71
  name: "",
69
72
  value: u,
70
- getResultsLabel: (n) => R(n, d)
73
+ getResultsLabel: (r) => B(r, d)
71
74
  }
72
75
  }
73
76
  ) })
74
77
  ] });
75
- }, I = (e) => {
78
+ }, $ = (e) => {
76
79
  switch (e) {
77
80
  case "nn":
78
81
  return {
@@ -99,10 +102,10 @@ import '../../assets/AccountSelector.css';const T = "_accountSelector_139de_1",
99
102
  switchLabel: "Vis slettede"
100
103
  };
101
104
  }
102
- }, R = (e, t) => {
105
+ }, B = (e, t) => {
103
106
  const i = t === "nb" || t === "nn";
104
107
  return e === 0 ? i ? "Ingen treff" : "No hits" : i ? `${e} treff` : e === 1 ? "1 hit" : `${e} hits`;
105
108
  };
106
109
  export {
107
- Z as AccountSelector
110
+ U as AccountSelector
108
111
  };
@@ -10,9 +10,9 @@ import { formatDisplayName as S } from "../functions/name/name.js";
10
10
  import { formatDate as E } from "../functions/date/date.js";
11
11
  import { formatOrgNo as x } from "../functions/orgno/orgno.js";
12
12
  import { S as R, a as Y } from "../HeartFill-CYSrJ_xK.js";
13
- const D = (e) => e === "Organization" ? "company" : "person", st = ({
14
- partyListDTO: e = [],
15
- favoriteAccountUuids: o,
13
+ const D = (o) => o === "Organization" ? "company" : "person", st = ({
14
+ partyListDTO: o = [],
15
+ favoriteAccountUuids: e,
16
16
  currentAccountUuid: c,
17
17
  selfAccountUuid: v,
18
18
  isLoading: d = !1,
@@ -24,12 +24,12 @@ const D = (e) => e === "Organization" ? "company" : "person", st = ({
24
24
  onShowDeletedUnitsChange: n
25
25
  }) => {
26
26
  const a = W(), [z, m, p] = V(() => {
27
- if (d || !e || !v)
27
+ if (d || !o || !v)
28
28
  return [[], {}, void 0];
29
- const s = (t) => o?.includes(t), _ = (t) => !t.isDeleted || f !== !1 || t.partyUuid === c, N = B(i), F = i || "nb", k = (t, u) => t.name.localeCompare(u.name, F, {
29
+ const s = (t) => e?.includes(t), _ = (t) => !t.isDeleted || f !== !1 || t.partyUuid === c, N = B(i), F = i || "nb", k = (t, u) => t.name.localeCompare(u.name, F, {
30
30
  sensitivity: "base",
31
31
  ignorePunctuation: !0
32
- }), j = [...e].sort(k);
32
+ }), j = [...o].sort(k);
33
33
  let P;
34
34
  const O = [], y = [], g = [];
35
35
  for (const t of j)
@@ -110,9 +110,9 @@ const D = (e) => e === "Organization" ? "company" : "person", st = ({
110
110
  };
111
111
  return [A, M, H];
112
112
  }, [
113
- e,
114
- v,
115
113
  o,
114
+ v,
115
+ e,
116
116
  c,
117
117
  d,
118
118
  r,
@@ -120,7 +120,7 @@ const D = (e) => e === "Organization" ? "company" : "person", st = ({
120
120
  a,
121
121
  f
122
122
  ]);
123
- return d || !e || !p ? {
123
+ return d || !o || !p ? {
124
124
  accountMenu: {
125
125
  items: [],
126
126
  groups: {},
@@ -142,9 +142,9 @@ const D = (e) => e === "Organization" ? "company" : "person", st = ({
142
142
  showDeletedUnits: f,
143
143
  onShowDeletedUnitsChange: n
144
144
  };
145
- }, h = (e, o, c, v, d, b, I, r, i) => {
146
- const f = D(o?.type ?? ""), n = B(e), a = S({
147
- fullName: o?.name,
145
+ }, h = (o, e, c, v, d, b, I, r, i) => {
146
+ const f = D(e?.type ?? ""), n = B(o), a = S({
147
+ fullName: e?.name,
148
148
  type: f
149
149
  }), z = r ? S({
150
150
  fullName: r?.name,
@@ -155,33 +155,33 @@ const D = (e) => e === "Organization" ? "company" : "person", st = ({
155
155
  const p = f === "company" && r ? "subunit" : f;
156
156
  switch (p) {
157
157
  case "company":
158
- m = `${n.org_no}. ${x(o.organizationNumber)}`;
158
+ m = `${n.org_no}. ${x(e.organizationNumber)}`;
159
159
  break;
160
160
  case "person":
161
- m = o?.dateOfBirth ? `${n.birthdate}: ${E(o?.dateOfBirth)}` : "";
161
+ m = e?.dateOfBirth ? `${n.birthdate}: ${E(e?.dateOfBirth)}` : "";
162
162
  break;
163
163
  case "subunit":
164
- m = `↳ ${n.org_no}. ${x(o?.organizationNumber)}, ${n.subunit_of} ${z}`;
164
+ m = `↳ ${n.org_no}. ${x(e?.organizationNumber)}, ${n.subunit_of} ${z}`;
165
165
  break;
166
166
  default:
167
167
  m = "";
168
168
  }
169
169
  return {
170
- id: o?.partyUuid,
170
+ id: e?.partyUuid,
171
171
  icon: {
172
172
  name: a,
173
173
  type: f,
174
174
  isParent: !r,
175
- isDeleted: o?.isDeleted
175
+ isDeleted: e?.isDeleted
176
176
  },
177
177
  name: a,
178
178
  description: m,
179
- searchWords: p === "company" ? [a, o?.organizationNumber ?? ""] : [a, o?.dateOfBirth ?? ""],
179
+ searchWords: p === "person" ? [a, e?.dateOfBirth ?? ""] : [a, e?.organizationNumber ?? ""],
180
180
  groupId: c,
181
181
  type: p,
182
- selected: v === o?.partyUuid,
183
- disabled: !!o?.onlyHierarchyElementWithNoAccess,
184
- badge: i ? { label: n.you, color: "person" } : o.isDeleted && I ? { label: n.deleted, color: "neutral" } : void 0,
182
+ selected: v === e?.partyUuid,
183
+ disabled: !!e?.onlyHierarchyElementWithNoAccess,
184
+ badge: i ? { label: n.you, color: "person" } : e.isDeleted && I ? { label: n.deleted, color: "neutral" } : void 0,
185
185
  controls: !i && /* @__PURE__ */ U(
186
186
  G,
187
187
  {
@@ -189,15 +189,15 @@ const D = (e) => e === "Organization" ? "company" : "person", st = ({
189
189
  variant: "ghost",
190
190
  "aria-label": d ? n.remove_from_favorites : n.add_to_favorites,
191
191
  onClick: (s) => {
192
- b && (s.stopPropagation(), b(o?.partyUuid));
192
+ b && (s.stopPropagation(), b(e?.partyUuid));
193
193
  },
194
194
  size: "xs",
195
195
  children: d ? /* @__PURE__ */ U(R, {}) : /* @__PURE__ */ U(Y, {})
196
196
  }
197
197
  )
198
198
  };
199
- }, q = (e) => e === "Organization", w = (e) => e === "Person" || e === "SelfIdentified", B = (e) => {
200
- switch (e) {
199
+ }, q = (o) => o === "Organization", w = (o) => o === "Person" || o === "SelfIdentified", B = (o) => {
200
+ switch (o) {
201
201
  case "nn":
202
202
  return {
203
203
  account_orgs: "Virksemder",
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { useEffect as n } from "react";
3
+ const c = (t) => {
4
+ n(() => {
5
+ if (!t) return;
6
+ const { overflow: e, paddingRight: d } = document.body.style, o = window.innerWidth - document.documentElement.clientWidth;
7
+ return document.body.style.overflow = "hidden", o > 0 && (document.body.style.paddingRight = `${o}px`), () => {
8
+ document.body.style.overflow = e, document.body.style.paddingRight = d;
9
+ };
10
+ }, [t]);
11
+ };
12
+ export {
13
+ c as useLockBodyScroll
14
+ };
@@ -5,10 +5,13 @@ declare const meta: {
5
5
  parameters: {};
6
6
  args: {
7
7
  open: true;
8
- onClose: () => void;
9
8
  };
10
9
  };
11
10
  export default meta;
12
- export declare const Verified: () => import("react/jsx-runtime").JSX.Element;
13
- export declare const Unverified: () => import("react/jsx-runtime").JSX.Element;
11
+ export declare const ProfileReadOnly: () => import("react/jsx-runtime").JSX.Element;
12
+ export declare const ProfileInput: () => import("react/jsx-runtime").JSX.Element;
13
+ export declare const ProfileSelect: () => import("react/jsx-runtime").JSX.Element;
14
+ export declare const AccountVerified: () => import("react/jsx-runtime").JSX.Element;
15
+ export declare const AccountNewEmail: () => import("react/jsx-runtime").JSX.Element;
16
+ export declare const AccountNewEmailAndSms: () => import("react/jsx-runtime").JSX.Element;
14
17
  export declare const VerificationCodeSent: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const useLockBodyScroll: (locked: boolean) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.56.23",
3
+ "version": "0.56.25",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",