@altinn/altinn-components 0.38.18 → 0.38.20
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,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as f } from "react/jsx-runtime";
|
|
3
|
-
import { useRef as
|
|
3
|
+
import { useRef as x, useEffect as u } from "react";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
5
|
import "../RootProvider/RootProvider.js";
|
|
6
6
|
import "../Snackbar/useSnackbar.js";
|
|
7
|
-
import { Section as
|
|
7
|
+
import { Section as C } from "../Page/Section.js";
|
|
8
8
|
import '../../assets/ModalBase.css';const R = "_modal_4vfmr_1", I = "_content_4vfmr_35", d = {
|
|
9
9
|
modal: R,
|
|
10
10
|
content: I
|
|
11
11
|
}, Y = ({
|
|
12
|
-
open:
|
|
13
|
-
onClose:
|
|
12
|
+
open: a,
|
|
13
|
+
onClose: r,
|
|
14
14
|
closedBy: n = "any",
|
|
15
15
|
children: v,
|
|
16
16
|
backdropColor: p = "inherit",
|
|
@@ -20,16 +20,22 @@ import '../../assets/ModalBase.css';const R = "_modal_4vfmr_1", I = "_content_4v
|
|
|
20
20
|
spacing: b = 0,
|
|
21
21
|
variant: k = "default"
|
|
22
22
|
}) => {
|
|
23
|
-
const
|
|
23
|
+
const c = x(null);
|
|
24
24
|
return u(() => {
|
|
25
|
-
const e =
|
|
25
|
+
const e = c.current, o = (t) => {
|
|
26
26
|
var m;
|
|
27
27
|
const { clientY: s, clientX: l, target: L } = t;
|
|
28
|
-
if (t instanceof KeyboardEvent)
|
|
29
|
-
|
|
28
|
+
if (t instanceof KeyboardEvent && t.key === "Escape") {
|
|
29
|
+
if (n === "none") {
|
|
30
|
+
t.preventDefault();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
r();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
30
36
|
if (!((m = window.getSelection()) != null && m.toString()) && e && L === e && n === "any") {
|
|
31
|
-
const { top: _, left: w, right:
|
|
32
|
-
_ <= s && s <=
|
|
37
|
+
const { top: _, left: w, right: D, bottom: S } = e.getBoundingClientRect();
|
|
38
|
+
_ <= s && s <= S && w <= l && l <= D || e == null || e.close();
|
|
33
39
|
}
|
|
34
40
|
}, i = () => {
|
|
35
41
|
const t = e == null ? void 0 : e.querySelector("[autofocus]");
|
|
@@ -38,24 +44,24 @@ import '../../assets/ModalBase.css';const R = "_modal_4vfmr_1", I = "_content_4v
|
|
|
38
44
|
return e == null || e.addEventListener("animationend", i), e == null || e.addEventListener("click", o), e == null || e.addEventListener("keydown", o), () => {
|
|
39
45
|
e == null || e.removeEventListener("animationend", i), e == null || e.removeEventListener("click", o), e == null || e.removeEventListener("keydown", o);
|
|
40
46
|
};
|
|
41
|
-
}, [n]), u(() => {
|
|
42
|
-
const e =
|
|
43
|
-
e && (
|
|
44
|
-
}, [
|
|
47
|
+
}, [n, r]), u(() => {
|
|
48
|
+
const e = c.current;
|
|
49
|
+
e && (a ? e.open || e.showModal() : e.open && e.close());
|
|
50
|
+
}, [a]), /* @__PURE__ */ f(
|
|
45
51
|
"dialog",
|
|
46
52
|
{
|
|
47
|
-
ref:
|
|
53
|
+
ref: c,
|
|
48
54
|
"aria-modal": "true",
|
|
49
55
|
"aria-labelledby": "modal-title",
|
|
50
56
|
onCancel: (e) => {
|
|
51
|
-
e.preventDefault(), n === "any" &&
|
|
57
|
+
e.preventDefault(), n === "any" && r();
|
|
52
58
|
},
|
|
53
59
|
"data-backdrop-color": p,
|
|
54
60
|
className: d.modal,
|
|
55
61
|
"data-variant": k,
|
|
56
|
-
onClose: n !== "none" ?
|
|
62
|
+
onClose: n !== "none" ? r : void 0,
|
|
57
63
|
children: /* @__PURE__ */ f(
|
|
58
|
-
|
|
64
|
+
C,
|
|
59
65
|
{
|
|
60
66
|
className: d.content,
|
|
61
67
|
"aria-label": "modal content",
|
|
@@ -24,4 +24,5 @@ export default meta;
|
|
|
24
24
|
export declare const Login: (args: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
25
|
export declare const CurrentAccount: (args: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
26
|
export declare const CompanyAccount: (args: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare const SubcompanyAccount: (args: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
28
|
export declare const MobileMenu: (args: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|