@altinn/altinn-components 0.67.2 → 0.67.3

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,83 @@
1
- import { jsxs as c, Fragment as m, jsx as r } from "react/jsx-runtime";
2
- import { useRef as N, useEffect as v } from "react";
1
+ import { jsxs as a, Fragment as l, jsx as t } from "react/jsx-runtime";
2
+ import { useRef as E, useEffect as h } from "react";
3
3
  import { Button as D } from "../Button/Button.js";
4
4
  import "../../index-p1eeF8LQ.js";
5
5
  import "../../tooltip-Ct39-719.js";
6
- import { w as L } from "../../ToolbarSearch-bv2opbAj.js";
6
+ import { w as j } from "../../ToolbarSearch-bv2opbAj.js";
7
7
  import "../Typography/Link.js";
8
8
  import "react-dom";
9
9
  import "../GlobalMenu/GlobalMenuBase.js";
10
10
  import "../Snackbar/useSnackbar.js";
11
- import { S as j } from "../../ChevronUp-hn05LboH.js";
12
- import { S as I } from "../../ChevronDown-D_a7nb-G.js";
13
- import '../../assets/HeaderDrawer.css';const M = "_backdrop_yn0zc_11", R = "_drawer_yn0zc_28", F = "_footer_yn0zc_60", V = "_body_yn0zc_64", q = "_toggleButton_yn0zc_104", t = {
11
+ import { S as I } from "../../ChevronUp-hn05LboH.js";
12
+ import { S as L } from "../../ChevronDown-D_a7nb-G.js";
13
+ import '../../assets/HeaderDrawer.css';const M = "_backdrop_yn0zc_11", R = "_drawer_yn0zc_28", B = "_footer_yn0zc_60", F = "_body_yn0zc_64", V = "_toggleButton_yn0zc_104", n = {
14
14
  backdrop: M,
15
15
  drawer: R,
16
- footer: F,
17
- body: V,
18
- toggleButton: q
16
+ footer: B,
17
+ body: F,
18
+ toggleButton: V
19
19
  }, Z = ({
20
- id: l,
21
- open: i,
22
- onClose: a,
20
+ id: c,
21
+ open: r,
22
+ onClose: v,
23
23
  closedBy: o = "any",
24
- expanded: u,
25
- expandable: y = !0,
24
+ expanded: d,
25
+ expandable: _ = !0,
26
26
  onToggle: b,
27
- children: _
27
+ children: w
28
28
  }) => {
29
- const { languageCode: w } = L(), f = A(w), d = N(null);
30
- v(() => {
31
- const e = d.current, s = (n) => {
32
- const { clientY: p, clientX: h, target: z } = n;
33
- if (n instanceof KeyboardEvent && n.key === "Escape") {
34
- if (o === "none") {
35
- n.preventDefault();
36
- return;
37
- }
38
- a();
39
- return;
29
+ const { languageCode: k } = j(), m = q(k), s = E(null);
30
+ h(() => {
31
+ const e = s.current, u = (i) => {
32
+ if (window.getSelection()?.toString()) return;
33
+ const { clientY: g, clientX: p, target: z } = i;
34
+ if (e && z === e && o === "any") {
35
+ const { top: C, left: x, right: S, bottom: N } = e.getBoundingClientRect();
36
+ C <= g && g <= N && x <= p && p <= S || e.close();
40
37
  }
41
- if (!window.getSelection()?.toString() && e && z === e && o === "any") {
42
- const { top: E, left: x, right: S, bottom: C } = e.getBoundingClientRect();
43
- E <= p && p <= C && x <= h && h <= S || e?.close();
44
- }
45
- }, g = () => {
46
- const n = e?.querySelector("[autofocus]");
47
- document.activeElement !== n && n?.focus();
38
+ }, f = () => {
39
+ const i = e?.querySelector("[autofocus]");
40
+ document.activeElement !== i && i?.focus();
48
41
  };
49
- return e?.addEventListener("animationend", g), e?.addEventListener("click", s), e?.addEventListener("keydown", s), () => {
50
- e?.removeEventListener("animationend", g), e?.removeEventListener("click", s), e?.removeEventListener("keydown", s);
42
+ return e?.addEventListener("animationend", f), e?.addEventListener("click", u), () => {
43
+ e?.removeEventListener("animationend", f), e?.removeEventListener("click", u);
51
44
  };
52
- }, [o, a]), v(() => {
53
- const e = d.current;
54
- e && (i ? e.open || e.showModal() : e.open && e.close());
55
- }, [i]);
56
- const k = (e) => {
57
- e.preventDefault(), o === "any" && a();
45
+ }, [o]), h(() => {
46
+ const e = s.current;
47
+ e && (r ? e.open || e.showModal() : e.open && e.close());
48
+ }, [r]);
49
+ const y = (e) => {
50
+ o === "none" && e.preventDefault();
58
51
  };
59
- return /* @__PURE__ */ c(m, { children: [
60
- /* @__PURE__ */ r("div", { className: t.backdrop, "aria-hidden": !i }),
61
- /* @__PURE__ */ c(
52
+ return /* @__PURE__ */ a(l, { children: [
53
+ /* @__PURE__ */ t("div", { className: n.backdrop, "aria-hidden": !r }),
54
+ /* @__PURE__ */ a(
62
55
  "dialog",
63
56
  {
64
- id: l,
65
- ref: d,
57
+ id: c,
58
+ ref: s,
66
59
  "aria-modal": "true",
67
60
  "aria-labelledby": "modal-title",
68
- "data-open": i,
69
- "data-expanded": u,
70
- onCancel: k,
71
- className: t.drawer,
72
- onClose: o !== "none" ? a : void 0,
61
+ "data-open": r,
62
+ "data-expanded": d,
63
+ onCancel: y,
64
+ className: n.drawer,
65
+ onClose: o !== "none" ? v : void 0,
73
66
  children: [
74
- /* @__PURE__ */ r("div", { className: t.body, children: _ }),
75
- o !== "none" && y && /* @__PURE__ */ r("footer", { className: t.footer, children: /* @__PURE__ */ r(D, { className: t.toggleButton, size: "xs", variant: "outline", onClick: b, children: u ? /* @__PURE__ */ c(m, { children: [
76
- /* @__PURE__ */ r(j, { className: t.btnIcon, "aria-hidden": "true" }),
77
- f.minimize
78
- ] }) : /* @__PURE__ */ c(m, { children: [
79
- /* @__PURE__ */ r(I, { className: t.btnIcon, "aria-hidden": "true" }),
80
- f.fullscreen
67
+ /* @__PURE__ */ t("div", { className: n.body, children: w }),
68
+ o !== "none" && _ && /* @__PURE__ */ t("footer", { className: n.footer, children: /* @__PURE__ */ t(D, { className: n.toggleButton, size: "xs", variant: "outline", onClick: b, children: d ? /* @__PURE__ */ a(l, { children: [
69
+ /* @__PURE__ */ t(I, { className: n.btnIcon, "aria-hidden": "true" }),
70
+ m.minimize
71
+ ] }) : /* @__PURE__ */ a(l, { children: [
72
+ /* @__PURE__ */ t(L, { className: n.btnIcon, "aria-hidden": "true" }),
73
+ m.fullscreen
81
74
  ] }) }) })
82
75
  ]
83
76
  }
84
77
  )
85
78
  ] });
86
- }, A = (l) => {
87
- switch (l) {
79
+ }, q = (c) => {
80
+ switch (c) {
88
81
  case "nn":
89
82
  return {
90
83
  minimize: "Minimer",
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as s } from "react/jsx-runtime";
3
- import { useRef as D, useEffect as m } from "react";
3
+ import { useRef as w, useEffect as d } from "react";
4
4
  import "../../index-p1eeF8LQ.js";
5
5
  import "../../tooltip-Ct39-719.js";
6
6
  import "../../ToolbarSearch-bv2opbAj.js";
@@ -9,73 +9,66 @@ import "../Button/Button.js";
9
9
  import "react-dom";
10
10
  import "../GlobalMenu/GlobalMenuBase.js";
11
11
  import "../Snackbar/useSnackbar.js";
12
- import { Section as S } from "../Page/Section.js";
13
- import '../../assets/ModalBase.css';const C = "_modal_3d5cx_1", R = "_content_3d5cx_41", f = {
14
- modal: C,
12
+ import { Section as y } from "../Page/Section.js";
13
+ import '../../assets/ModalBase.css';const D = "_modal_3d5cx_1", R = "_content_3d5cx_41", m = {
14
+ modal: D,
15
15
  content: R
16
16
  }, J = ({
17
- open: r,
18
- onClose: o,
19
- closedBy: n = "any",
20
- children: u,
17
+ open: a,
18
+ onClose: u,
19
+ closedBy: e = "any",
20
+ children: f,
21
21
  backdropColor: p = "inherit",
22
22
  size: g,
23
- color: v,
24
- padding: h = 0,
25
- spacing: E = 0,
26
- height: y = "auto",
27
- variant: b = "default"
23
+ color: h,
24
+ padding: v = 0,
25
+ spacing: C = 0,
26
+ height: E = "auto",
27
+ variant: _ = "default"
28
28
  }) => {
29
- const i = D(null);
30
- return m(() => {
31
- const t = i.current, a = (e) => {
32
- const { clientY: l, clientX: d, target: k } = e;
33
- if (e instanceof KeyboardEvent && e.key === "Escape") {
34
- if (n === "none") {
35
- e.preventDefault();
36
- return;
37
- }
38
- o();
39
- return;
40
- }
41
- if (!window.getSelection()?.toString() && t && k === t && n === "any") {
42
- const { top: L, left: _, right: w, bottom: x } = t.getBoundingClientRect();
43
- L <= l && l <= x && _ <= d && d <= w || t?.close();
29
+ const n = w(null);
30
+ return d(() => {
31
+ const t = n.current, i = (o) => {
32
+ if (window.getSelection()?.toString()) return;
33
+ const { clientY: r, clientX: l, target: b } = o;
34
+ if (t && b === t && e === "any") {
35
+ const { top: k, left: x, right: L, bottom: S } = t.getBoundingClientRect();
36
+ k <= r && r <= S && x <= l && l <= L || t.close();
44
37
  }
45
38
  }, c = () => {
46
- const e = t?.querySelector("[autofocus]");
47
- document.activeElement !== e && e?.focus();
39
+ const o = t?.querySelector("[autofocus]");
40
+ document.activeElement !== o && o?.focus();
48
41
  };
49
- return t?.addEventListener("animationend", c), t?.addEventListener("click", a), t?.addEventListener("keydown", a), () => {
50
- t?.removeEventListener("animationend", c), t?.removeEventListener("click", a), t?.removeEventListener("keydown", a);
42
+ return t?.addEventListener("animationend", c), t?.addEventListener("click", i), () => {
43
+ t?.removeEventListener("animationend", c), t?.removeEventListener("click", i);
51
44
  };
52
- }, [n, o]), m(() => {
53
- const t = i.current;
54
- t && (r ? t.open || t.showModal() : t.open && t.close());
55
- }, [r]), /* @__PURE__ */ s(
45
+ }, [e]), d(() => {
46
+ const t = n.current;
47
+ t && (a ? t.open || t.showModal() : t.open && t.close());
48
+ }, [a]), /* @__PURE__ */ s(
56
49
  "dialog",
57
50
  {
58
- ref: i,
51
+ ref: n,
59
52
  "aria-modal": "true",
60
53
  "aria-labelledby": "modal-title",
61
54
  onCancel: (t) => {
62
- t.preventDefault(), n === "any" && o();
55
+ e === "none" && t.preventDefault();
63
56
  },
64
57
  "data-backdrop-color": p,
65
- className: f.modal,
66
- "data-variant": b,
67
- "data-height": y,
68
- onClose: n !== "none" ? o : void 0,
58
+ className: m.modal,
59
+ "data-variant": _,
60
+ "data-height": E,
61
+ onClose: e !== "none" ? u : void 0,
69
62
  children: /* @__PURE__ */ s(
70
- S,
63
+ y,
71
64
  {
72
- className: f.content,
65
+ className: m.content,
73
66
  "aria-label": "modal content",
74
67
  size: g,
75
- color: v,
76
- padding: h,
77
- spacing: E,
78
- children: u
68
+ color: h,
69
+ padding: v,
70
+ spacing: C,
71
+ children: f
79
72
  }
80
73
  )
81
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.67.2",
3
+ "version": "0.67.3",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",