@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
|
|
2
|
-
import { useRef as
|
|
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
|
|
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
|
|
12
|
-
import { S as
|
|
13
|
-
import '../../assets/HeaderDrawer.css';const M = "_backdrop_yn0zc_11", R = "_drawer_yn0zc_28",
|
|
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:
|
|
17
|
-
body:
|
|
18
|
-
toggleButton:
|
|
16
|
+
footer: B,
|
|
17
|
+
body: F,
|
|
18
|
+
toggleButton: V
|
|
19
19
|
}, Z = ({
|
|
20
|
-
id:
|
|
21
|
-
open:
|
|
22
|
-
onClose:
|
|
20
|
+
id: c,
|
|
21
|
+
open: r,
|
|
22
|
+
onClose: v,
|
|
23
23
|
closedBy: o = "any",
|
|
24
|
-
expanded:
|
|
25
|
-
expandable:
|
|
24
|
+
expanded: d,
|
|
25
|
+
expandable: _ = !0,
|
|
26
26
|
onToggle: b,
|
|
27
|
-
children:
|
|
27
|
+
children: w
|
|
28
28
|
}) => {
|
|
29
|
-
const { languageCode:
|
|
30
|
-
|
|
31
|
-
const e =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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",
|
|
50
|
-
e?.removeEventListener("animationend",
|
|
42
|
+
return e?.addEventListener("animationend", f), e?.addEventListener("click", u), () => {
|
|
43
|
+
e?.removeEventListener("animationend", f), e?.removeEventListener("click", u);
|
|
51
44
|
};
|
|
52
|
-
}, [o
|
|
53
|
-
const e =
|
|
54
|
-
e && (
|
|
55
|
-
}, [
|
|
56
|
-
const
|
|
57
|
-
|
|
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__ */
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
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:
|
|
65
|
-
ref:
|
|
57
|
+
id: c,
|
|
58
|
+
ref: s,
|
|
66
59
|
"aria-modal": "true",
|
|
67
60
|
"aria-labelledby": "modal-title",
|
|
68
|
-
"data-open":
|
|
69
|
-
"data-expanded":
|
|
70
|
-
onCancel:
|
|
71
|
-
className:
|
|
72
|
-
onClose: o !== "none" ?
|
|
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__ */
|
|
75
|
-
o !== "none" &&
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
|
|
78
|
-
] }) : /* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
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
|
-
},
|
|
87
|
-
switch (
|
|
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
|
|
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
|
|
13
|
-
import '../../assets/ModalBase.css';const
|
|
14
|
-
modal:
|
|
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:
|
|
18
|
-
onClose:
|
|
19
|
-
closedBy:
|
|
20
|
-
children:
|
|
17
|
+
open: a,
|
|
18
|
+
onClose: u,
|
|
19
|
+
closedBy: e = "any",
|
|
20
|
+
children: f,
|
|
21
21
|
backdropColor: p = "inherit",
|
|
22
22
|
size: g,
|
|
23
|
-
color:
|
|
24
|
-
padding:
|
|
25
|
-
spacing:
|
|
26
|
-
height:
|
|
27
|
-
variant:
|
|
23
|
+
color: h,
|
|
24
|
+
padding: v = 0,
|
|
25
|
+
spacing: C = 0,
|
|
26
|
+
height: E = "auto",
|
|
27
|
+
variant: _ = "default"
|
|
28
28
|
}) => {
|
|
29
|
-
const
|
|
30
|
-
return
|
|
31
|
-
const t =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
|
47
|
-
document.activeElement !==
|
|
39
|
+
const o = t?.querySelector("[autofocus]");
|
|
40
|
+
document.activeElement !== o && o?.focus();
|
|
48
41
|
};
|
|
49
|
-
return t?.addEventListener("animationend", c), t?.addEventListener("click",
|
|
50
|
-
t?.removeEventListener("animationend", c), t?.removeEventListener("click",
|
|
42
|
+
return t?.addEventListener("animationend", c), t?.addEventListener("click", i), () => {
|
|
43
|
+
t?.removeEventListener("animationend", c), t?.removeEventListener("click", i);
|
|
51
44
|
};
|
|
52
|
-
}, [
|
|
53
|
-
const t =
|
|
54
|
-
t && (
|
|
55
|
-
}, [
|
|
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:
|
|
51
|
+
ref: n,
|
|
59
52
|
"aria-modal": "true",
|
|
60
53
|
"aria-labelledby": "modal-title",
|
|
61
54
|
onCancel: (t) => {
|
|
62
|
-
|
|
55
|
+
e === "none" && t.preventDefault();
|
|
63
56
|
},
|
|
64
57
|
"data-backdrop-color": p,
|
|
65
|
-
className:
|
|
66
|
-
"data-variant":
|
|
67
|
-
"data-height":
|
|
68
|
-
onClose:
|
|
58
|
+
className: m.modal,
|
|
59
|
+
"data-variant": _,
|
|
60
|
+
"data-height": E,
|
|
61
|
+
onClose: e !== "none" ? u : void 0,
|
|
69
62
|
children: /* @__PURE__ */ s(
|
|
70
|
-
|
|
63
|
+
y,
|
|
71
64
|
{
|
|
72
|
-
className:
|
|
65
|
+
className: m.content,
|
|
73
66
|
"aria-label": "modal content",
|
|
74
67
|
size: g,
|
|
75
|
-
color:
|
|
76
|
-
padding:
|
|
77
|
-
spacing:
|
|
78
|
-
children:
|
|
68
|
+
color: h,
|
|
69
|
+
padding: v,
|
|
70
|
+
spacing: C,
|
|
71
|
+
children: f
|
|
79
72
|
}
|
|
80
73
|
)
|
|
81
74
|
}
|