@altinn/altinn-components 0.63.1 → 0.63.2

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,90 +1,93 @@
1
- import { jsx as c, jsxs as m } from "react/jsx-runtime";
2
- import { c as S } from "../../index-p1eeF8LQ.js";
3
- import { useState as f, useEffect as z } from "react";
4
- import { AccountMenu as N } from "../Account/AccountMenu.js";
1
+ import { jsx as c, jsxs as f } from "react/jsx-runtime";
2
+ import { c as _ } from "../../index-p1eeF8LQ.js";
3
+ import { useState as o, useRef as T, useEffect as g } from "react";
4
+ import { AccountMenu as F } from "../Account/AccountMenu.js";
5
5
  import "../Typography/Link.js";
6
6
  import "../Button/Button.js";
7
7
  import "react-dom";
8
- import { u as k, S as A } from "../../ToolbarSearch-DT-KvnVb.js";
8
+ import { u as H, S as R } from "../../ToolbarSearch-DT-KvnVb.js";
9
9
  import "../Snackbar/useSnackbar.js";
10
- import { Switch as L } from "../Forms/Switch.js";
11
- import { S as F } from "../../button-BB5sYVKY.js";
12
- import { H as T } from "../../heading-C_XYsUfi.js";
13
- import '../../assets/AccountSelector.css';const C = "_accountSelector_829wd_1", H = "_heading_829wd_11", y = "_searchSection_829wd_17", M = "_searchField_829wd_30", j = "_accountMenu_829wd_34", E = "_virtualized_829wd_43", R = "_spinner_829wd_58", t = {
14
- accountSelector: C,
15
- heading: H,
16
- searchSection: y,
17
- searchField: M,
18
- accountMenu: j,
19
- virtualized: E,
20
- spinner: R
21
- }, D = ({
10
+ import { Switch as y } from "../Forms/Switch.js";
11
+ import { S as I } from "../../button-BB5sYVKY.js";
12
+ import { H as M } from "../../heading-C_XYsUfi.js";
13
+ import '../../assets/AccountSelector.css';const j = "_accountSelector_829wd_1", E = "_heading_829wd_11", V = "_searchSection_829wd_17", $ = "_searchField_829wd_30", K = "_accountMenu_829wd_34", O = "_virtualized_829wd_43", W = "_spinner_829wd_58", r = {
14
+ accountSelector: j,
15
+ heading: E,
16
+ searchSection: V,
17
+ searchField: $,
18
+ accountMenu: K,
19
+ virtualized: O,
20
+ spinner: W
21
+ }, re = ({
22
22
  accountMenu: e,
23
- forceOpenFullScreen: r,
24
- className: a,
25
- loading: p,
26
- showDeletedUnits: s,
27
- onShowDeletedUnitsChange: _,
28
- isFullScreen: g
23
+ forceOpenFullScreen: n,
24
+ className: s,
25
+ loading: v,
26
+ showDeletedUnits: i,
27
+ onShowDeletedUnitsChange: w,
28
+ isFullScreen: x
29
29
  }) => {
30
- const { closeAll: i, languageCode: o } = k(), [l, d] = f(""), [v, h] = f(r);
31
- z(() => {
32
- !r && v && i(), h(r);
33
- }, [r]);
34
- const { searchText: u, heading: w, switchLabel: x } = V(o), b = (n) => {
35
- e.onSelectAccount?.(n), i(), h(!1);
30
+ const { closeAll: l, languageCode: d, currentId: b } = H(), a = b === "account" || !!n, [u, h] = o(""), [z, m] = o(n), [N, k] = o(0), S = T(a);
31
+ g(() => {
32
+ a && !S.current && k((t) => t + 1), S.current = a;
33
+ }, [a]), g(() => {
34
+ !n && z && l(), m(n);
35
+ }, [n]);
36
+ const { searchText: p, heading: A, switchLabel: C } = q(d), L = (t) => {
37
+ e.onSelectAccount?.(t), l(), m(!1);
36
38
  };
37
- return p ? /* @__PURE__ */ c(F, { "aria-hidden": !0, "data-color": "neutral", className: t.spinner }) : /* @__PURE__ */ m("div", { className: S(a, t.accountSelector), children: [
38
- /* @__PURE__ */ c(T, { "data-size": "sm", level: 2, className: t.heading, children: w }),
39
- /* @__PURE__ */ m("div", { className: t.searchSection, children: [
39
+ return v ? /* @__PURE__ */ c(I, { "aria-hidden": !0, "data-color": "neutral", className: r.spinner }) : /* @__PURE__ */ f("div", { className: _(s, r.accountSelector), children: [
40
+ /* @__PURE__ */ c(M, { "data-size": "sm", level: 2, className: r.heading, children: A }),
41
+ /* @__PURE__ */ f("div", { className: r.searchSection, children: [
40
42
  /* @__PURE__ */ c(
41
- A,
43
+ R,
42
44
  {
43
45
  size: "sm",
44
- name: u,
45
- placeholder: u,
46
- value: l,
47
- onChange: (n) => d(n.target.value),
48
- onClear: () => d(""),
49
- className: t.searchField
46
+ name: p,
47
+ placeholder: p,
48
+ value: u,
49
+ onChange: (t) => h(t.target.value),
50
+ onClear: () => h(""),
51
+ className: r.searchField
50
52
  }
51
53
  ),
52
- s !== void 0 && /* @__PURE__ */ c(
53
- L,
54
+ i !== void 0 && /* @__PURE__ */ c(
55
+ y,
54
56
  {
55
57
  size: "sm",
56
- checked: s,
57
- onChange: (n) => _?.(n.target.checked),
58
- label: x
58
+ checked: i,
59
+ onChange: (t) => w?.(t.target.checked),
60
+ label: C
59
61
  }
60
62
  )
61
63
  ] }),
62
64
  /* @__PURE__ */ c(
63
65
  "div",
64
66
  {
65
- className: S(
66
- t.accountMenu,
67
- g && t.fullScreen,
68
- e.virtualized && t.virtualized
67
+ className: _(
68
+ r.accountMenu,
69
+ x && r.fullScreen,
70
+ e.virtualized && r.virtualized
69
71
  ),
70
72
  children: /* @__PURE__ */ c(
71
- N,
73
+ F,
72
74
  {
73
75
  ...e,
74
- onSelectAccount: b,
76
+ onSelectAccount: L,
75
77
  keyboardEvents: !1,
76
78
  search: {
77
79
  hidden: !0,
78
80
  name: "",
79
- value: l,
80
- getResultsLabel: (n) => $(n, o)
81
+ value: u,
82
+ getResultsLabel: (t) => B(t, d)
81
83
  }
82
- }
84
+ },
85
+ N
83
86
  )
84
87
  }
85
88
  )
86
89
  ] });
87
- }, V = (e) => {
90
+ }, q = (e) => {
88
91
  switch (e) {
89
92
  case "nn":
90
93
  return {
@@ -105,10 +108,10 @@ import '../../assets/AccountSelector.css';const C = "_accountSelector_829wd_1",
105
108
  switchLabel: "Vis slettede"
106
109
  };
107
110
  }
108
- }, $ = (e, r) => {
109
- const a = r === "nb" || r === "nn";
110
- return e === 0 ? a ? "Ingen treff" : "No hits" : a ? `${e} treff` : e === 1 ? "1 hit" : `${e} hits`;
111
+ }, B = (e, n) => {
112
+ const s = n === "nb" || n === "nn";
113
+ return e === 0 ? s ? "Ingen treff" : "No hits" : s ? `${e} treff` : e === 1 ? "1 hit" : `${e} hits`;
111
114
  };
112
115
  export {
113
- D as AccountSelector
116
+ re as AccountSelector
114
117
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.63.1",
3
+ "version": "0.63.2",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",