@altinn/altinn-components 0.56.24 → 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
  };
@@ -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
+ };
@@ -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.24",
3
+ "version": "0.56.25",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",