@kakadu/components 1.7.4 → 1.7.6
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.
- package/build/components/input.js +2 -2
- package/build/components/input.mjs +60 -60
- package/build/components/modal.d.ts +5 -1
- package/build/components/modal.js +5 -5
- package/build/components/modal.mjs +462 -456
- package/build/components.css +1 -1
- package/package.json +1 -1
- package/readme.md +14 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),u=require("@kuma-ui/core"),oe=require("../icons/chevron-up.js"),P=require("../icon-Dw7yhWuE.js"),O=require("../utilities/copy-to-clipboard.js"),T=require("../theme.js"),ce=require("./button-tooltip.js"),W=require("./text-button.js"),y=require("./text.js"),re=require("./collapsible.js"),F=require("./click-ripples.js"),U=require("./hover-gradient.js"),le=require("./notification.js"),ie=require("./notice.js"),ue="kakadu-components-
|
|
2
|
-
`):[],[l]),Y=t.useMemo(()=>C.length,[C]),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),u=require("@kuma-ui/core"),oe=require("../icons/chevron-up.js"),P=require("../icon-Dw7yhWuE.js"),O=require("../utilities/copy-to-clipboard.js"),T=require("../theme.js"),ce=require("./button-tooltip.js"),W=require("./text-button.js"),y=require("./text.js"),re=require("./collapsible.js"),F=require("./click-ripples.js"),U=require("./hover-gradient.js"),le=require("./notification.js"),ie=require("./notice.js"),ue="kakadu-components-172442510",xe="kakadu-components-2436386418",I="kakadu-components-3096914092",D="kakadu-components-4056037255",G=u.cx(D,"kakadu-components-3245407458"),pe=u.cx(D,"kakadu-components-1117160492");function de({as:p,className:a,...x}){return e.jsxRuntimeExports.jsx(y.Span,{as:p??"span",...x,className:u.cx("kakadu-components-3574036749",a)})}function J({label:p,error:a,errorId:x,warning:o,warningId:R,footnote:s,attachments:c,className:d,children:h,...m}){const j=!!a,r=!!o,f=!!s;return e.jsxRuntimeExports.jsx("label",{...m,className:u.cx(ue,d),children:e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[e.jsxRuntimeExports.jsx(y.Span,{className:u.cx(T.overflowProtectionStyles,xe),children:e.jsxRuntimeExports.jsx("span",{children:p})}),e.jsxRuntimeExports.jsxs("span",{className:"kakadu-components-3298764637",children:[h,f?e.jsxRuntimeExports.jsx(de,{className:"kakadu-components-613632806",children:s}):null,c]}),j||r?e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2927674627",children:j?e.jsxRuntimeExports.jsx(y.Paragraph,{id:x,className:G,children:a instanceof Error?a.message:a}):r?e.jsxRuntimeExports.jsx(y.Paragraph,{id:R,className:pe,children:o instanceof Error?o.message:o}):null}):null]})})}function me({label:p,options:a,error:x,warning:o,footnote:R,className:s,onChange:c,...d}){const h=t.useId(),m=`${h}-error`,j=`${h}-warning`,r=!!x,f=!r&&!!o,v=r?m:f?j:void 0,{value:k}=d,[g,b]=t.useState(""),_=k??g;t.useEffect(()=>{b(typeof k=="string"?k:"")},[k]);const w=t.useCallback(n=>{const{value:N}=n.target;b(N),c==null||c(N,n)},[c]);return e.jsxRuntimeExports.jsxs(J,{label:p,error:x,warning:o,footnote:R,children:[e.jsxRuntimeExports.jsx("select",{...d,value:_,"aria-invalid":r,"data-warning":f,"aria-describedby":v,className:u.cx(I,"kakadu-components-4228384787",s),onChange:w,children:a.map(n=>e.jsxRuntimeExports.jsx("option",{value:n.value,children:n.label},n.value))}),e.jsxRuntimeExports.jsx(oe.default,{width:14,height:14,className:"kakadu-components-158931186"})]})}const je=36,z="kakadu-components-4233741488";function ke({type:p,label:a,error:x,warning:o,footnote:R,suggestion:s,hasCopyButton:c,hasClearButton:d,isMultiline:h,onChange:m,className:j,...r}){const f=t.useRef(null),v=t.useRef(null),k=t.useRef(null),g=le.useCreateNotification(),b=t.useId(),_=`${b}-error`,w=`${b}-warning`,{value:n}=r,[N,M]=t.useState(""),l=n??N,[K,Q]=t.useState(),X=p==="textarea"||!!h;t.useLayoutEffect(()=>{typeof l=="string"&&k.current&&Q(k.current.scrollHeight)},[l]);const C=t.useMemo(()=>typeof l=="string"?`${l} `.split(`
|
|
2
|
+
`):[],[l]),Y=t.useMemo(()=>C.length,[C]),S=!!x,B=!S&&!!o,$=S?_:B?w:void 0;t.useEffect(()=>{M(typeof n=="string"?n:"")},[n]);const L=t.useCallback(E=>{const{value:i}=E.target;M(i),m==null||m(i,E)},[m]),Z=t.useCallback(()=>{typeof l=="string"&&(O.default(l),g({type:ie.NoticeType.success,children:"Copied to clipboard."}))},[l,g]),q=t.useCallback(E=>{var H;const i=v.current??f.current??void 0;if(i){const A=(H=Object.getOwnPropertyDescriptor(i instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value"))==null?void 0:H.set;if(A){A.call(i,E);const ae=new Event("input",{bubbles:!0});i.dispatchEvent(ae),i.focus();return}}throw new Error("Unable to set value.")},[]),ee=t.useCallback(()=>{q("")},[q]),[te,se]=t.useState(""),V=!!s&&te!==s,ne=t.useCallback(()=>{if(s){try{q(s)}catch{O.default(s)}se(s)}},[s,q]);return e.jsxRuntimeExports.jsxs(J,{label:a,error:x,warning:o,footnote:R,attachments:e.jsxRuntimeExports.jsx(re.default,{isCollapsed:!V,children:V?e.jsxRuntimeExports.jsxs("button",{type:"button",className:u.cx(T.buttonResetStyles,T.overflowProtectionStyles,"kakadu-components-2355856341"),onClick:ne,children:[e.jsxRuntimeExports.jsx(ce.default,{label:"Apply suggestion"}),e.jsxRuntimeExports.jsx(P.SparkleSvg,{width:13,height:13,className:"kakadu-components-1021263934"}),e.jsxRuntimeExports.jsx(y.Span,{className:"kakadu-components-1585874956",children:s}),e.jsxRuntimeExports.jsx(F.default,{className:"kakadu-components-3448565402"}),e.jsxRuntimeExports.jsx(U.default,{})]}):null}),style:{"--button-padding":`${je*((c?1:0)+(d?1:0))}px`},children:[e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[X?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{ref:k,"aria-hidden":!0,className:u.cx(I,j,"kakadu-components-2033521835"),children:[C.map((E,i)=>e.jsxRuntimeExports.jsxs("span",{children:[E,Y>1?e.jsxRuntimeExports.jsx("br",{}):null]},i))," "]}),e.jsxRuntimeExports.jsx("textarea",{...r,ref:v,rows:1,"aria-invalid":S,"data-warning":B,"aria-describedby":$,value:l,className:u.cx(I,j,"kakadu-components-2119524139"),style:{minHeight:K},onChange:L})]}):e.jsxRuntimeExports.jsx("input",{...r,ref:f,type:p??"text",value:l,"aria-invalid":S,"data-warning":B,"aria-describedby":$,className:u.cx(I,j),onChange:L}),e.jsxRuntimeExports.jsx(F.default,{className:"kakadu-components-1614211948"}),e.jsxRuntimeExports.jsx(U.default,{className:"kakadu-components-1041647916"})]}),c||d?e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-131986363",children:[c?e.jsxRuntimeExports.jsx(W.default,{iconLeft:P.IconType.copy,label:"Copy",tooltip:"Copy",className:z,onClick:Z}):null,d?e.jsxRuntimeExports.jsx(W.default,{iconLeft:P.IconType.times,label:"Clear",tooltip:"Clear",className:z,onClick:ee}):null]}):null]})}exports.Select=me;exports.default=ke;exports.errorParagraph=G;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { j as e } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import { useRef as P, useId as Q, useState as I, useLayoutEffect as de, useMemo as O, useEffect as X, useCallback as
|
|
2
|
+
import { useRef as P, useId as Q, useState as I, useLayoutEffect as de, useMemo as O, useEffect as X, useCallback as v } from "react";
|
|
3
3
|
import { cx as i } from "@kuma-ui/core";
|
|
4
4
|
import ue from "../icons/chevron-up.mjs";
|
|
5
|
-
import { a as U, S as
|
|
5
|
+
import { a as U, S as me } from "../icon-C6X3pQX0.mjs";
|
|
6
6
|
import z from "../utilities/copy-to-clipboard.mjs";
|
|
7
|
-
import { buttonResetStyles as
|
|
7
|
+
import { buttonResetStyles as pe, overflowProtectionStyles as Y } from "../theme.mjs";
|
|
8
8
|
import ke from "./button-tooltip.mjs";
|
|
9
9
|
import D from "./text-button.mjs";
|
|
10
10
|
import { Span as R, Paragraph as G } from "./text.mjs";
|
|
@@ -13,8 +13,8 @@ import q from "./click-ripples.mjs";
|
|
|
13
13
|
import J from "./hover-gradient.mjs";
|
|
14
14
|
import { useCreateNotification as he } from "./notification.mjs";
|
|
15
15
|
import { NoticeType as xe } from "./notice.mjs";
|
|
16
|
-
const je = "kakadu-components-
|
|
17
|
-
function
|
|
16
|
+
const je = "kakadu-components-172442510", ve = "kakadu-components-2436386418", w = "kakadu-components-3096914092", Z = "kakadu-components-4056037255", ye = i(Z, "kakadu-components-3245407458"), be = i(Z, "kakadu-components-1117160492");
|
|
17
|
+
function Ne({
|
|
18
18
|
as: u,
|
|
19
19
|
className: a,
|
|
20
20
|
...d
|
|
@@ -26,90 +26,90 @@ function _({
|
|
|
26
26
|
error: a,
|
|
27
27
|
errorId: d,
|
|
28
28
|
warning: s,
|
|
29
|
-
warningId:
|
|
30
|
-
footnote:
|
|
29
|
+
warningId: y,
|
|
30
|
+
footnote: n,
|
|
31
31
|
attachments: o,
|
|
32
|
-
className:
|
|
32
|
+
className: m,
|
|
33
33
|
children: x,
|
|
34
|
-
...
|
|
34
|
+
...p
|
|
35
35
|
}) {
|
|
36
|
-
const k = !!a, l = !!s, h = !!
|
|
37
|
-
return /* @__PURE__ */ e.
|
|
38
|
-
/* @__PURE__ */ e.jsx(R, { className: i(Y,
|
|
39
|
-
/* @__PURE__ */ e.jsxs("span", { className: "kakadu-components-
|
|
36
|
+
const k = !!a, l = !!s, h = !!n;
|
|
37
|
+
return /* @__PURE__ */ e.jsx("label", { ...p, className: i(je, m), children: /* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-3146929190", children: [
|
|
38
|
+
/* @__PURE__ */ e.jsx(R, { className: i(Y, ve), children: /* @__PURE__ */ e.jsx("span", { children: u }) }),
|
|
39
|
+
/* @__PURE__ */ e.jsxs("span", { className: "kakadu-components-3298764637", children: [
|
|
40
40
|
x,
|
|
41
|
-
h ? /* @__PURE__ */ e.jsx(
|
|
41
|
+
h ? /* @__PURE__ */ e.jsx(Ne, { className: "kakadu-components-613632806", children: n }) : null,
|
|
42
42
|
o
|
|
43
43
|
] }),
|
|
44
|
-
k || l ? /* @__PURE__ */ e.jsx("div", { className: "kakadu-components-
|
|
45
|
-
] });
|
|
44
|
+
k || l ? /* @__PURE__ */ e.jsx("div", { className: "kakadu-components-2927674627", children: k ? /* @__PURE__ */ e.jsx(G, { id: d, className: ye, children: a instanceof Error ? a.message : a }) : l ? /* @__PURE__ */ e.jsx(G, { id: y, className: be, children: s instanceof Error ? s.message : s }) : null }) : null
|
|
45
|
+
] }) });
|
|
46
46
|
}
|
|
47
47
|
function We({
|
|
48
48
|
label: u,
|
|
49
49
|
options: a,
|
|
50
50
|
error: d,
|
|
51
51
|
warning: s,
|
|
52
|
-
footnote:
|
|
53
|
-
className:
|
|
52
|
+
footnote: y,
|
|
53
|
+
className: n,
|
|
54
54
|
onChange: o,
|
|
55
|
-
...
|
|
55
|
+
...m
|
|
56
56
|
}) {
|
|
57
|
-
const x = Q(),
|
|
57
|
+
const x = Q(), p = `${x}-error`, k = `${x}-warning`, l = !!d, h = !l && !!s, N = l ? p : h ? k : void 0, {
|
|
58
58
|
value: f
|
|
59
|
-
} =
|
|
59
|
+
} = m, [g, b] = I(""), C = f ?? g;
|
|
60
60
|
X(() => {
|
|
61
|
-
|
|
61
|
+
b(typeof f == "string" ? f : "");
|
|
62
62
|
}, [f]);
|
|
63
|
-
const T =
|
|
63
|
+
const T = v((t) => {
|
|
64
64
|
const {
|
|
65
65
|
value: S
|
|
66
|
-
} =
|
|
67
|
-
|
|
66
|
+
} = t.target;
|
|
67
|
+
b(S), o == null || o(S, t);
|
|
68
68
|
}, [o]);
|
|
69
|
-
return /* @__PURE__ */ e.jsxs(_, { label: u, error: d, warning: s, footnote:
|
|
70
|
-
/* @__PURE__ */ e.jsx("select", { ...
|
|
69
|
+
return /* @__PURE__ */ e.jsxs(_, { label: u, error: d, warning: s, footnote: y, children: [
|
|
70
|
+
/* @__PURE__ */ e.jsx("select", { ...m, value: C, "aria-invalid": l, "data-warning": h, "aria-describedby": N, className: i(w, "kakadu-components-4228384787", n), onChange: T, children: a.map((t) => /* @__PURE__ */ e.jsx("option", { value: t.value, children: t.label }, t.value)) }),
|
|
71
71
|
/* @__PURE__ */ e.jsx(ue, { width: 14, height: 14, className: "kakadu-components-158931186" })
|
|
72
72
|
] });
|
|
73
73
|
}
|
|
74
|
-
const
|
|
74
|
+
const ge = 36, K = "kakadu-components-4233741488";
|
|
75
75
|
function Fe({
|
|
76
76
|
type: u,
|
|
77
77
|
label: a,
|
|
78
78
|
error: d,
|
|
79
79
|
warning: s,
|
|
80
|
-
footnote:
|
|
81
|
-
suggestion:
|
|
80
|
+
footnote: y,
|
|
81
|
+
suggestion: n,
|
|
82
82
|
hasCopyButton: o,
|
|
83
|
-
hasClearButton:
|
|
83
|
+
hasClearButton: m,
|
|
84
84
|
isMultiline: x,
|
|
85
|
-
onChange:
|
|
85
|
+
onChange: p,
|
|
86
86
|
className: k,
|
|
87
87
|
...l
|
|
88
88
|
}) {
|
|
89
|
-
const h = P(null),
|
|
90
|
-
value:
|
|
91
|
-
} = l, [S, V] = I(""), c =
|
|
89
|
+
const h = P(null), N = P(null), f = P(null), g = he(), b = Q(), C = `${b}-error`, T = `${b}-warning`, {
|
|
90
|
+
value: t
|
|
91
|
+
} = l, [S, V] = I(""), c = t ?? S, [ee, ne] = I(), te = u === "textarea" || !!x;
|
|
92
92
|
de(() => {
|
|
93
|
-
typeof c == "string" && f.current &&
|
|
93
|
+
typeof c == "string" && f.current && ne(f.current.scrollHeight);
|
|
94
94
|
}, [c]);
|
|
95
95
|
const H = O(() => typeof c == "string" ? `${c} `.split(`
|
|
96
96
|
`) : [], [c]), ae = O(() => H.length, [H]), E = !!d, L = !E && !!s, $ = E ? C : L ? T : void 0;
|
|
97
97
|
X(() => {
|
|
98
|
-
V(typeof
|
|
99
|
-
}, [
|
|
100
|
-
const M =
|
|
98
|
+
V(typeof t == "string" ? t : "");
|
|
99
|
+
}, [t]);
|
|
100
|
+
const M = v((j) => {
|
|
101
101
|
const {
|
|
102
102
|
value: r
|
|
103
103
|
} = j.target;
|
|
104
|
-
V(r),
|
|
105
|
-
}, [
|
|
106
|
-
typeof c == "string" && (z(c),
|
|
104
|
+
V(r), p == null || p(r, j);
|
|
105
|
+
}, [p]), se = v(() => {
|
|
106
|
+
typeof c == "string" && (z(c), g({
|
|
107
107
|
type: xe.success,
|
|
108
108
|
children: "Copied to clipboard."
|
|
109
109
|
}));
|
|
110
|
-
}, [c,
|
|
110
|
+
}, [c, g]), B = v((j) => {
|
|
111
111
|
var W;
|
|
112
|
-
const r =
|
|
112
|
+
const r = N.current ?? h.current ?? void 0;
|
|
113
113
|
if (r) {
|
|
114
114
|
const F = (W = Object.getOwnPropertyDescriptor(r instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype, "value")) == null ? void 0 : W.set;
|
|
115
115
|
if (F) {
|
|
@@ -122,29 +122,29 @@ function Fe({
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
throw new Error("Unable to set value.");
|
|
125
|
-
}, []), oe =
|
|
125
|
+
}, []), oe = v(() => {
|
|
126
126
|
B("");
|
|
127
|
-
}, [B]), [le, ce] = I(""), A = !!
|
|
128
|
-
if (
|
|
127
|
+
}, [B]), [le, ce] = I(""), A = !!n && le !== n, re = v(() => {
|
|
128
|
+
if (n) {
|
|
129
129
|
try {
|
|
130
|
-
B(
|
|
130
|
+
B(n);
|
|
131
131
|
} catch {
|
|
132
|
-
z(
|
|
132
|
+
z(n);
|
|
133
133
|
}
|
|
134
|
-
ce(
|
|
134
|
+
ce(n);
|
|
135
135
|
}
|
|
136
|
-
}, [
|
|
137
|
-
return /* @__PURE__ */ e.jsxs(_, { label: a, error: d, warning: s, footnote:
|
|
136
|
+
}, [n, B]);
|
|
137
|
+
return /* @__PURE__ */ e.jsxs(_, { label: a, error: d, warning: s, footnote: y, attachments: /* @__PURE__ */ e.jsx(fe, { isCollapsed: !A, children: A ? /* @__PURE__ */ e.jsxs("button", { type: "button", className: i(pe, Y, "kakadu-components-2355856341"), onClick: re, children: [
|
|
138
138
|
/* @__PURE__ */ e.jsx(ke, { label: "Apply suggestion" }),
|
|
139
|
-
/* @__PURE__ */ e.jsx(
|
|
140
|
-
/* @__PURE__ */ e.jsx(R, { className: "kakadu-components-1585874956", children:
|
|
139
|
+
/* @__PURE__ */ e.jsx(me, { width: 13, height: 13, className: "kakadu-components-1021263934" }),
|
|
140
|
+
/* @__PURE__ */ e.jsx(R, { className: "kakadu-components-1585874956", children: n }),
|
|
141
141
|
/* @__PURE__ */ e.jsx(q, { className: "kakadu-components-3448565402" }),
|
|
142
142
|
/* @__PURE__ */ e.jsx(J, {})
|
|
143
143
|
] }) : null }), style: {
|
|
144
|
-
"--button-padding": `${
|
|
144
|
+
"--button-padding": `${ge * ((o ? 1 : 0) + (m ? 1 : 0))}px`
|
|
145
145
|
}, children: [
|
|
146
146
|
/* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-3146929190", children: [
|
|
147
|
-
|
|
147
|
+
te ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
148
148
|
/* @__PURE__ */ e.jsxs("span", { ref: f, "aria-hidden": !0, className: i(w, k, "kakadu-components-2033521835"), children: [
|
|
149
149
|
H.map((j, r) => (
|
|
150
150
|
// eslint-disable-next-line react/no-array-index-key
|
|
@@ -155,21 +155,21 @@ function Fe({
|
|
|
155
155
|
)),
|
|
156
156
|
" "
|
|
157
157
|
] }),
|
|
158
|
-
/* @__PURE__ */ e.jsx("textarea", { ...l, ref:
|
|
158
|
+
/* @__PURE__ */ e.jsx("textarea", { ...l, ref: N, rows: 1, "aria-invalid": E, "data-warning": L, "aria-describedby": $, value: c, className: i(w, k, "kakadu-components-2119524139"), style: {
|
|
159
159
|
minHeight: ee
|
|
160
160
|
}, onChange: M })
|
|
161
161
|
] }) : /* @__PURE__ */ e.jsx("input", { ...l, ref: h, type: u ?? "text", value: c, "aria-invalid": E, "data-warning": L, "aria-describedby": $, className: i(w, k), onChange: M }),
|
|
162
162
|
/* @__PURE__ */ e.jsx(q, { className: "kakadu-components-1614211948" }),
|
|
163
163
|
/* @__PURE__ */ e.jsx(J, { className: "kakadu-components-1041647916" })
|
|
164
164
|
] }),
|
|
165
|
-
o ||
|
|
165
|
+
o || m ? /* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-131986363", children: [
|
|
166
166
|
o ? /* @__PURE__ */ e.jsx(D, { iconLeft: U.copy, label: "Copy", tooltip: "Copy", className: K, onClick: se }) : null,
|
|
167
|
-
|
|
167
|
+
m ? /* @__PURE__ */ e.jsx(D, { iconLeft: U.times, label: "Clear", tooltip: "Clear", className: K, onClick: oe }) : null
|
|
168
168
|
] }) : null
|
|
169
169
|
] });
|
|
170
170
|
}
|
|
171
171
|
export {
|
|
172
172
|
We as Select,
|
|
173
173
|
Fe as default,
|
|
174
|
-
|
|
174
|
+
ye as errorParagraph
|
|
175
175
|
};
|
|
@@ -6,8 +6,12 @@ type ModalProviderProperties<Data = any> = {
|
|
|
6
6
|
close?: (data?: Data) => void;
|
|
7
7
|
};
|
|
8
8
|
export declare function useModalContext<Data = any>(): ModalProviderProperties<Data>;
|
|
9
|
+
export type DecoratorType = ComponentType<{
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}>;
|
|
9
12
|
export type ModalProperties<Data = any> = {
|
|
10
13
|
readonly root?: HTMLElement | ShadowRoot;
|
|
14
|
+
readonly decorators?: DecoratorType[];
|
|
11
15
|
readonly maxWidth?: number;
|
|
12
16
|
readonly className?: string;
|
|
13
17
|
readonly isVisible?: boolean;
|
|
@@ -19,7 +23,7 @@ export type ModalProperties<Data = any> = {
|
|
|
19
23
|
readonly children?: ReactNode;
|
|
20
24
|
};
|
|
21
25
|
type ModalBaseProperties<ModalResult> = Omit<ModalProperties<ModalResult>, 'isVisible' | 'onClose'>;
|
|
22
|
-
export default function Modal<Data = any>({ root, maxWidth, className, isVisible, isFullWidth, shouldCloseOnOutsideClick, shouldCloseOnEscapePress, showCloseButton, onClose, children, }: ModalProperties<Data>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export default function Modal<Data = any>({ root, decorators, maxWidth, className, isVisible, isFullWidth, shouldCloseOnOutsideClick, shouldCloseOnEscapePress, showCloseButton, onClose, children, }: ModalProperties<Data>): import("react/jsx-runtime").JSX.Element;
|
|
23
27
|
export declare function useModal<ModalResult, ModalProperties = ModalBaseProperties<ModalResult>>(ModalComponent: ComponentType<ModalProperties>, properties?: ModalProperties): {
|
|
24
28
|
isVisible: boolean;
|
|
25
29
|
show: () => Promise<ModalResult | undefined>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("../jsx-runtime-BB_1_6y_.js"),F=require("react"),le=require("@kuma-ui/core"),Ne=require("react-dom"),xe=require("../icon-Dw7yhWuE.js"),je=require("./text-button.js");function ye(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var e=r.default;if(typeof e=="function"){var t=function a(){return this instanceof a?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(a){var u=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(t,a,u.get?u:{enumerable:!0,get:function(){return r[a]}})}),t}var J={exports:{}};/*!
|
|
2
2
|
* tabbable 6.4.0
|
|
3
3
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
4
|
-
*/var me=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],te=me.join(","),ge=typeof Element>"u",
|
|
4
|
+
*/var me=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],te=me.join(","),ge=typeof Element>"u",Y=ge?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,re=!ge&&Element.prototype.getRootNode?function(r){var e;return r==null||(e=r.getRootNode)===null||e===void 0?void 0:e.call(r)}:function(r){return r==null?void 0:r.ownerDocument},ae=function(e,t){var a;t===void 0&&(t=!0);var u=e==null||(a=e.getAttribute)===null||a===void 0?void 0:a.call(e,"inert"),c=u===""||u==="true",n=c||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):ae(e.parentNode));return n},Pe=function(e){var t,a=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return a===""||a==="true"},Te=function(e,t,a){if(ae(e))return[];var u=Array.prototype.slice.apply(e.querySelectorAll(te));return t&&Y.call(e,te)&&u.unshift(e),u=u.filter(a),u},ne=function(e,t,a){for(var u=[],c=Array.from(e);c.length;){var n=c.shift();if(!ae(n,!1))if(n.tagName==="SLOT"){var b=n.assignedElements(),g=b.length?b:n.children,E=ne(g,!0,a);a.flatten?u.push.apply(u,E):u.push({scopeParent:n,candidates:E})}else{var O=Y.call(n,te);O&&a.filter(n)&&(t||!e.includes(n))&&u.push(n);var D=n.shadowRoot||typeof a.getShadowRoot=="function"&&a.getShadowRoot(n),x=!ae(D,!1)&&(!a.shadowRootFilter||a.shadowRootFilter(n));if(D&&x){var I=ne(D===!0?n.children:D.children,!0,a);a.flatten?u.push.apply(u,I):u.push({scopeParent:n,candidates:I})}else c.unshift.apply(c,n.children)}}return u},we=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},$=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Pe(e))&&!we(e)?0:e.tabIndex},Ce=function(e,t){var a=$(e);return a<0&&t&&!we(e)?0:a},Ie=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ee=function(e){return e.tagName==="INPUT"},Ae=function(e){return Ee(e)&&e.type==="hidden"},_e=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(a){return a.tagName==="SUMMARY"});return t},Le=function(e,t){for(var a=0;a<e.length;a++)if(e[a].checked&&e[a].form===t)return e[a]},Me=function(e){if(!e.name)return!0;var t=e.form||re(e),a=function(b){return t.querySelectorAll('input[type="radio"][name="'+b+'"]')},u;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")u=a(window.CSS.escape(e.name));else try{u=a(e.name)}catch(n){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",n.message),!1}var c=Le(u,e.form);return!c||c===e},Be=function(e){return Ee(e)&&e.type==="radio"},Ke=function(e){return Be(e)&&!Me(e)},qe=function(e){var t,a=e&&re(e),u=(t=a)===null||t===void 0?void 0:t.host,c=!1;if(a&&a!==e){var n,b,g;for(c=!!((n=u)!==null&&n!==void 0&&(b=n.ownerDocument)!==null&&b!==void 0&&b.contains(u)||e!=null&&(g=e.ownerDocument)!==null&&g!==void 0&&g.contains(e));!c&&u;){var E,O,D;a=re(u),u=(E=a)===null||E===void 0?void 0:E.host,c=!!((O=u)!==null&&O!==void 0&&(D=O.ownerDocument)!==null&&D!==void 0&&D.contains(u))}}return c},fe=function(e){var t=e.getBoundingClientRect(),a=t.width,u=t.height;return a===0&&u===0},Ve=function(e,t){var a=t.displayCheck,u=t.getShadowRoot;if(a==="full-native"&&"checkVisibility"in e){var c=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!c}if(getComputedStyle(e).visibility==="hidden")return!0;var n=Y.call(e,"details>summary:first-of-type"),b=n?e.parentElement:e;if(Y.call(b,"details:not([open]) *"))return!0;if(!a||a==="full"||a==="full-native"||a==="legacy-full"){if(typeof u=="function"){for(var g=e;e;){var E=e.parentElement,O=re(e);if(E&&!E.shadowRoot&&u(E)===!0)return fe(e);e.assignedSlot?e=e.assignedSlot:!E&&O!==e.ownerDocument?e=O.host:e=E}e=g}if(qe(e))return!e.getClientRects().length;if(a!=="legacy-full")return!0}else if(a==="non-zero-area")return fe(e);return!1},$e=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var a=0;a<t.children.length;a++){var u=t.children.item(a);if(u.tagName==="LEGEND")return Y.call(t,"fieldset[disabled] *")?!0:!u.contains(e)}return!0}t=t.parentElement}return!1},ie=function(e,t){return!(t.disabled||Ae(t)||Ve(t,e)||_e(t)||$e(t))},se=function(e,t){return!(Ke(t)||$(t)<0||!ie(e,t))},Ge=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},ke=function(e){var t=[],a=[];return e.forEach(function(u,c){var n=!!u.scopeParent,b=n?u.scopeParent:u,g=Ce(b,n),E=n?ke(u.candidates):b;g===0?n?t.push.apply(t,E):t.push(b):a.push({documentOrder:c,tabIndex:g,item:u,isScope:n,content:E})}),a.sort(Ie).reduce(function(u,c){return c.isScope?u.push.apply(u,c.content):u.push(c.content),u},[]).concat(t)},Se=function(e,t){t=t||{};var a;return t.getShadowRoot?a=ne([e],t.includeContainer,{filter:se.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ge}):a=Te(e,t.includeContainer,se.bind(null,t)),ke(a)},Fe=function(e,t){t=t||{};var a;return t.getShadowRoot?a=ne([e],t.includeContainer,{filter:ie.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):a=Te(e,t.includeContainer,ie.bind(null,t)),a},z=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Y.call(e,te)===!1?!1:se(t,e)},Ue=me.concat("iframe:not([inert]):not([inert] *)").join(","),ee=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Y.call(e,Ue)===!1?!1:ie(t,e)};const We=Object.freeze(Object.defineProperty({__proto__:null,focusable:Fe,getTabIndex:$,isFocusable:ee,isTabbable:z,tabbable:Se},Symbol.toStringTag,{value:"Module"}));/*!
|
|
5
5
|
* focus-trap 7.8.0
|
|
6
6
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
7
|
-
*/function ce(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,a=Array(e);t<e;t++)a[t]=r[t];return a}function
|
|
8
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var
|
|
9
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ve(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);e&&(a=a.filter(function(u){return Object.getOwnPropertyDescriptor(r,u).enumerable})),t.push.apply(t,a)}return t}function pe(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ve(Object(t),!0).forEach(function(a){He(r,a,t[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ve(Object(t)).forEach(function(a){Object.defineProperty(r,a,Object.getOwnPropertyDescriptor(t,a))})}return r}function Je(r){return Ye(r)||Ze(r)||Oe(r)||Xe()}function Qe(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var a=t.call(r,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function et(r){var e=Qe(r,"string");return typeof e=="symbol"?e:e+""}function Oe(r,e){if(r){if(typeof r=="string")return ce(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ce(r,e):void 0}}var B={getActiveTrap:function(e){return(e==null?void 0:e.length)>0?e[e.length-1]:null},activateTrap:function(e,t){var a=B.getActiveTrap(e);t!==a&&B.pauseTrap(e);var u=e.indexOf(t);u===-1||e.splice(u,1),e.push(t)},deactivateTrap:function(e,t){var a=e.indexOf(t);a!==-1&&e.splice(a,1),B.unpauseTrap(e)},pauseTrap:function(e){var t=B.getActiveTrap(e);t==null||t._setPausedState(!0)},unpauseTrap:function(e){var t=B.getActiveTrap(e);t&&!t._isManuallyPaused()&&t._setPausedState(!1)}},tt=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},rt=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},X=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},at=function(e){return X(e)&&!e.shiftKey},nt=function(e){return X(e)&&e.shiftKey},be=function(e){return setTimeout(e,0)},Z=function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),u=1;u<t;u++)a[u-1]=arguments[u];return typeof e=="function"?e.apply(void 0,a):e},Q=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},it=[],ot=function(e,t){var a=(t==null?void 0:t.document)||document,u=(t==null?void 0:t.trapStack)||it,l=pe({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isolateSubtrees:!1,isKeyForward:at,isKeyBackward:nt},t),n={containers:[],containerGroups:[],tabbableGroups:[],adjacentElements:new Set,alreadySilent:new Set,nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,manuallyPaused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},p,y=function(o,i,f){return o&&o[i]!==void 0?o[i]:l[f||i]},E=function(o,i){var f=typeof(i==null?void 0:i.composedPath)=="function"?i.composedPath():void 0;return n.containerGroups.findIndex(function(g){var h=g.container,T=g.tabbableNodes;return h.contains(o)||(f==null?void 0:f.includes(h))||T.find(function(v){return v===o})})},O=function(o){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},f=i.hasFallback,g=f===void 0?!1:f,h=i.params,T=h===void 0?[]:h,v=l[o];if(typeof v=="function"&&(v=v.apply(void 0,Je(T))),v===!0&&(v=void 0),!v){if(v===void 0||v===!1)return v;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var k=v;if(typeof v=="string"){try{k=a.querySelector(v)}catch(S){throw new Error("`".concat(o,'` appears to be an invalid selector; error="').concat(S.message,'"'))}if(!k&&!g)throw new Error("`".concat(o,"` as selector refers to no known node"))}return k},D=function(){var o=O("initialFocus",{hasFallback:!0});if(o===!1)return!1;if(o===void 0||o&&!ee(o,l.tabbableOptions))if(E(a.activeElement)>=0)o=a.activeElement;else{var i=n.tabbableGroups[0],f=i&&i.firstTabbableNode;o=f||O("fallbackFocus")}else o===null&&(o=O("fallbackFocus"));if(!o)throw new Error("Your focus-trap needs to have at least one focusable element");return o},x=function(){if(n.containerGroups=n.containers.map(function(o){var i=Se(o,l.tabbableOptions),f=Fe(o,l.tabbableOptions),g=i.length>0?i[0]:void 0,h=i.length>0?i[i.length-1]:void 0,T=f.find(function(S){return W(S)}),v=f.slice().reverse().find(function(S){return W(S)}),k=!!i.find(function(S){return V(S)>0});return{container:o,tabbableNodes:i,focusableNodes:f,posTabIndexesFound:k,firstTabbableNode:g,lastTabbableNode:h,firstDomTabbableNode:T,lastDomTabbableNode:v,nextTabbableNode:function(P){var M=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,I=i.indexOf(P);return I<0?M?f.slice(f.indexOf(P)+1).find(function(U){return W(U)}):f.slice(0,f.indexOf(P)).reverse().find(function(U){return W(U)}):i[I+(M?1:-1)]}}}),n.tabbableGroups=n.containerGroups.filter(function(o){return o.tabbableNodes.length>0}),n.tabbableGroups.length<=0&&!O("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(n.containerGroups.find(function(o){return o.posTabIndexesFound})&&n.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},A=function(o){var i=o.activeElement;if(i)return i.shadowRoot&&i.shadowRoot.activeElement!==null?A(i.shadowRoot):i},N=function(o){if(o!==!1&&o!==A(document)){if(!o||!o.focus){N(D());return}o.focus({preventScroll:!!l.preventScroll}),n.mostRecentlyFocusedNode=o,tt(o)&&o.select()}},_=function(o){var i=O("setReturnFocus",{params:[o]});return i||(i===!1?!1:o)},C=function(o){var i=o.target,f=o.event,g=o.isBackward,h=g===void 0?!1:g;i=i||Q(f),x();var T=null;if(n.tabbableGroups.length>0){var v=E(i,f),k=v>=0?n.containerGroups[v]:void 0;if(v<0)h?T=n.tabbableGroups[n.tabbableGroups.length-1].lastTabbableNode:T=n.tabbableGroups[0].firstTabbableNode;else if(h){var S=n.tabbableGroups.findIndex(function(oe){var ue=oe.firstTabbableNode;return i===ue});if(S<0&&(k.container===i||ee(i,l.tabbableOptions)&&!W(i,l.tabbableOptions)&&!k.nextTabbableNode(i,!1))&&(S=v),S>=0){var P=S===0?n.tabbableGroups.length-1:S-1,M=n.tabbableGroups[P];T=V(i)>=0?M.lastTabbableNode:M.lastDomTabbableNode}else X(f)||(T=k.nextTabbableNode(i,!1))}else{var I=n.tabbableGroups.findIndex(function(oe){var ue=oe.lastTabbableNode;return i===ue});if(I<0&&(k.container===i||ee(i,l.tabbableOptions)&&!W(i,l.tabbableOptions)&&!k.nextTabbableNode(i))&&(I=v),I>=0){var U=I===n.tabbableGroups.length-1?0:I+1,q=n.tabbableGroups[U];T=V(i)>=0?q.firstTabbableNode:q.firstDomTabbableNode}else X(f)||(T=k.nextTabbableNode(i))}}else T=O("fallbackFocus");return T},L=function(o){var i=Q(o);if(!(E(i,o)>=0)){if(Z(l.clickOutsideDeactivates,o)){p.deactivate({returnFocus:l.returnFocusOnDeactivate});return}Z(l.allowOutsideClick,o)||o.preventDefault()}},$=function(o){var i=Q(o),f=E(i,o)>=0;if(f||i instanceof Document)f&&(n.mostRecentlyFocusedNode=i);else{o.stopImmediatePropagation();var g,h=!0;if(n.mostRecentlyFocusedNode)if(V(n.mostRecentlyFocusedNode)>0){var T=E(n.mostRecentlyFocusedNode),v=n.containerGroups[T].tabbableNodes;if(v.length>0){var k=v.findIndex(function(S){return S===n.mostRecentlyFocusedNode});k>=0&&(l.isKeyForward(n.recentNavEvent)?k+1<v.length&&(g=v[k+1],h=!1):k-1>=0&&(g=v[k-1],h=!1))}}else n.containerGroups.some(function(S){return S.tabbableNodes.some(function(P){return V(P)>0})})||(h=!1);else h=!1;h&&(g=C({target:n.mostRecentlyFocusedNode,isBackward:l.isKeyBackward(n.recentNavEvent)})),N(g||n.mostRecentlyFocusedNode||D())}n.recentNavEvent=void 0},Y=function(o){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n.recentNavEvent=o;var f=C({event:o,isBackward:i});f&&(X(o)&&o.preventDefault(),N(f))},G=function(o){(l.isKeyForward(o)||l.isKeyBackward(o))&&Y(o,l.isKeyBackward(o))},H=function(o){rt(o)&&Z(l.escapeDeactivates,o)!==!1&&(o.preventDefault(),p.deactivate())},K=function(o){var i=Q(o);E(i,o)>=0||Z(l.clickOutsideDeactivates,o)||Z(l.allowOutsideClick,o)||(o.preventDefault(),o.stopImmediatePropagation())},d=function(){if(n.active)return B.activateTrap(u,p),n.delayInitialFocusTimer=l.delayInitialFocus?be(function(){N(D())}):N(D()),a.addEventListener("focusin",$,!0),a.addEventListener("mousedown",L,{capture:!0,passive:!1}),a.addEventListener("touchstart",L,{capture:!0,passive:!1}),a.addEventListener("click",K,{capture:!0,passive:!1}),a.addEventListener("keydown",G,{capture:!0,passive:!1}),a.addEventListener("keydown",H),p},s=function(o){n.active&&!n.paused&&p._setSubtreeIsolation(!1),n.adjacentElements.clear(),n.alreadySilent.clear();var i=new Set,f=new Set,g=de(o),h;try{for(g.s();!(h=g.n()).done;){var T=h.value;i.add(T);for(var v=typeof ShadowRoot<"u"&&T.getRootNode()instanceof ShadowRoot,k=T;k;){i.add(k);var S=k.parentElement,P=[];S?P=S.children:!S&&v&&(P=k.getRootNode().children,S=k.getRootNode().host,v=typeof ShadowRoot<"u"&&S.getRootNode()instanceof ShadowRoot);var M=de(P),I;try{for(M.s();!(I=M.n()).done;){var U=I.value;f.add(U)}}catch(q){M.e(q)}finally{M.f()}k=S}}}catch(q){g.e(q)}finally{g.f()}i.forEach(function(q){f.delete(q)}),n.adjacentElements=f},m=function(){if(n.active)return a.removeEventListener("focusin",$,!0),a.removeEventListener("mousedown",L,!0),a.removeEventListener("touchstart",L,!0),a.removeEventListener("click",K,!0),a.removeEventListener("keydown",G,!0),a.removeEventListener("keydown",H),p},c=function(o){var i=o.some(function(f){var g=Array.from(f.removedNodes);return g.some(function(h){return h===n.mostRecentlyFocusedNode})});i&&N(D())},w=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(c):void 0,R=function(){w&&(w.disconnect(),n.active&&!n.paused&&n.containers.map(function(o){w.observe(o,{subtree:!0,childList:!0})}))};return p={get active(){return n.active},get paused(){return n.paused},activate:function(o){if(n.active)return this;var i=y(o,"onActivate"),f=y(o,"onPostActivate"),g=y(o,"checkCanFocusTrap"),h=B.getActiveTrap(u),T=!1;if(h&&!h.paused){var v;(v=h._setSubtreeIsolation)===null||v===void 0||v.call(h,!1),T=!0}try{g||x(),n.active=!0,n.paused=!1,n.nodeFocusedBeforeActivation=A(a),i==null||i();var k=function(){g&&x(),d(),R(),l.isolateSubtrees&&p._setSubtreeIsolation(!0),f==null||f()};if(g)return g(n.containers.concat()).then(k,k),this;k()}catch(P){if(h===B.getActiveTrap(u)&&T){var S;(S=h._setSubtreeIsolation)===null||S===void 0||S.call(h,!0)}throw P}return this},deactivate:function(o){if(!n.active)return this;var i=pe({onDeactivate:l.onDeactivate,onPostDeactivate:l.onPostDeactivate,checkCanReturnFocus:l.checkCanReturnFocus},o);clearTimeout(n.delayInitialFocusTimer),n.delayInitialFocusTimer=void 0,n.paused||p._setSubtreeIsolation(!1),n.alreadySilent.clear(),m(),n.active=!1,n.paused=!1,R(),B.deactivateTrap(u,p);var f=y(i,"onDeactivate"),g=y(i,"onPostDeactivate"),h=y(i,"checkCanReturnFocus"),T=y(i,"returnFocus","returnFocusOnDeactivate");f==null||f();var v=function(){be(function(){T&&N(_(n.nodeFocusedBeforeActivation)),g==null||g()})};return T&&h?(h(_(n.nodeFocusedBeforeActivation)).then(v,v),this):(v(),this)},pause:function(o){return n.active?(n.manuallyPaused=!0,this._setPausedState(!0,o)):this},unpause:function(o){return n.active?(n.manuallyPaused=!1,u[u.length-1]!==this?this:this._setPausedState(!1,o)):this},updateContainerElements:function(o){var i=[].concat(o).filter(Boolean);return n.containers=i.map(function(f){return typeof f=="string"?a.querySelector(f):f}),l.isolateSubtrees&&s(n.containers),n.active&&(x(),l.isolateSubtrees&&!n.paused&&p._setSubtreeIsolation(!0)),R(),this}},Object.defineProperties(p,{_isManuallyPaused:{value:function(){return n.manuallyPaused}},_setPausedState:{value:function(o,i){if(n.paused===o)return this;if(n.paused=o,o){var f=y(i,"onPause"),g=y(i,"onPostPause");f==null||f(),m(),R(),p._setSubtreeIsolation(!1),g==null||g()}else{var h=y(i,"onUnpause"),T=y(i,"onPostUnpause");h==null||h(),p._setSubtreeIsolation(!0),x(),d(),R(),T==null||T()}return this}},_setSubtreeIsolation:{value:function(o){l.isolateSubtrees&&n.adjacentElements.forEach(function(i){var f;if(o)switch(l.isolateSubtrees){case"aria-hidden":(i.ariaHidden==="true"||((f=i.getAttribute("aria-hidden"))===null||f===void 0?void 0:f.toLowerCase())==="true")&&n.alreadySilent.add(i),i.setAttribute("aria-hidden","true");break;default:(i.inert||i.hasAttribute("inert"))&&n.alreadySilent.add(i),i.setAttribute("inert",!0);break}else if(!n.alreadySilent.has(i))switch(l.isolateSubtrees){case"aria-hidden":i.removeAttribute("aria-hidden");break;default:i.removeAttribute("inert");break}})}}}),p.updateContainerElements(e),p};const ut=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:ot},Symbol.toStringTag,{value:"Module"})),st=ye(ut),ct=ye(ze);var he;function lt(){if(he)return J.exports;he=1;function r(d){"@babel/helpers - typeof";return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},r(d)}var e,t;function a(d,s){if(!(d instanceof s))throw new TypeError("Cannot call a class as a function")}function u(d,s){for(var m=0;m<s.length;m++){var c=s[m];c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(d,N(c.key),c)}}function l(d,s,m){return s&&u(d.prototype,s),Object.defineProperty(d,"prototype",{writable:!1}),d}function n(d,s,m){return s=O(s),p(d,E()?Reflect.construct(s,m||[],O(d).constructor):s.apply(d,m))}function p(d,s){if(s&&(r(s)=="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y(d)}function y(d){if(d===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return d}function E(){try{var d=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(E=function(){return!!d})()}function O(d){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},O(d)}function D(d,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");d.prototype=Object.create(s&&s.prototype,{constructor:{value:d,writable:!0,configurable:!0}}),Object.defineProperty(d,"prototype",{writable:!1}),s&&x(d,s)}function x(d,s){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,c){return m.__proto__=c,m},x(d,s)}function A(d,s,m){return(s=N(s))in d?Object.defineProperty(d,s,{value:m,enumerable:!0,configurable:!0,writable:!0}):d[s]=m,d}function N(d){var s=_(d,"string");return r(s)=="symbol"?s:s+""}function _(d,s){if(r(d)!="object"||!d)return d;var m=d[Symbol.toPrimitive];if(m!==void 0){var c=m.call(d,s);if(r(c)!="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(d)}var C=F,L=st,$=L.createFocusTrap,Y=ct,G=Y.isFocusable,H=parseInt((e=(t=/^(\d+)\./.exec(C.version))===null||t===void 0?void 0:t[1])!==null&&e!==void 0?e:0,10),K=(function(d){function s(m){var c;a(this,s),c=n(this,s,[m]),A(c,"getNodeForOption",function(b){var o,i=(o=this.internalOptions[b])!==null&&o!==void 0?o:this.originalOptions[b];if(typeof i=="function"){for(var f=arguments.length,g=new Array(f>1?f-1:0),h=1;h<f;h++)g[h-1]=arguments[h];i=i.apply(void 0,g)}if(i===!0&&(i=void 0),!i){if(i===void 0||i===!1)return i;throw new Error("`".concat(b,"` was specified but was not a node, or did not return a node"))}var T=i;if(typeof i=="string"){var v;if(T=(v=this.getDocument())===null||v===void 0?void 0:v.querySelector(i),!T)throw new Error("`".concat(b,"` as selector refers to no known node"))}return T}),c.handleDeactivate=c.handleDeactivate.bind(c),c.handlePostDeactivate=c.handlePostDeactivate.bind(c),c.handleClickOutsideDeactivates=c.handleClickOutsideDeactivates.bind(c),c.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:c.handleDeactivate,onPostDeactivate:c.handlePostDeactivate,clickOutsideDeactivates:c.handleClickOutsideDeactivates},c.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var w=m.focusTrapOptions;for(var R in w)if(Object.prototype.hasOwnProperty.call(w,R)){if(R==="returnFocusOnDeactivate"||R==="onDeactivate"||R==="onPostDeactivate"||R==="checkCanReturnFocus"||R==="clickOutsideDeactivates"){c.originalOptions[R]=w[R];continue}c.internalOptions[R]=w[R]}return c.outsideClick=null,c.focusTrapElements=m.containerElements||[],c.updatePreviousElement(),c}return D(s,d),l(s,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var c=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return c||(c===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var c=this.getDocument();c&&(this.previouslyFocusedElement=c.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(c){var w=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,c):this.originalOptions.clickOutsideDeactivates;return w&&(this.outsideClick={target:c.target,allowDeactivation:w}),w}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var c=this,w=function(){var b=c.getReturnFocusNode(),o=!!(c.originalOptions.returnFocusOnDeactivate&&b!==null&&b!==void 0&&b.focus&&(!c.outsideClick||c.outsideClick.allowDeactivation&&!G(c.outsideClick.target,c.internalOptions.tabbableOptions))),i=c.internalOptions.preventScroll,f=i===void 0?!1:i;o&&b.focus({preventScroll:f}),c.originalOptions.onPostDeactivate&&c.originalOptions.onPostDeactivate.call(null),c.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(w,w):w()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var c=this.focusTrapElements.some(Boolean);c&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(c){if(this.focusTrap){c.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var w=!c.active&&this.props.active,R=c.active&&!this.props.active,b=!c.paused&&this.props.paused,o=c.paused&&!this.props.paused;if(w&&(this.updatePreviousElement(),this.focusTrap.activate()),R){this.deactivateTrap();return}b&&this.focusTrap.pause(),o&&this.focusTrap.unpause()}else c.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var c=this,w=this.props.children?C.Children.only(this.props.children):void 0;if(w){if(w.type&&w.type===C.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var R=function(i){var f=c.props.containerElements;w&&(H>=19?typeof w.props.ref=="function"?w.props.ref(i):w.props.ref&&(w.props.ref.current=i):typeof w.ref=="function"?w.ref(i):w.ref&&(w.ref.current=i)),c.focusTrapElements=f||[i]},b=C.cloneElement(w,{ref:R});return b}return null}}])})(C.Component);return K.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:$},J.exports=K,J.exports.FocusTrap=K,J.exports}var ft=lt();const Re=F.createContext({isVisible:!1}),{Provider:dt}=Re;function De(){return F.useContext(Re)}function vt(){const{close:r}=De(),e=F.useCallback(()=>{r==null||r()},[r]);return j.jsxRuntimeExports.jsxs(j.jsxRuntimeExports.Fragment,{children:[j.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2543813221"}),j.jsxRuntimeExports.jsx("div",{className:"kakadu-components-840864829",children:j.jsxRuntimeExports.jsx(je.default,{iconLeft:xe.IconType.times,label:"Close",className:"kakadu-components-3855719072",onClick:e})})]})}function pt({root:r,maxWidth:e,className:t,isVisible:a,isFullWidth:u=!1,shouldCloseOnOutsideClick:l=!0,shouldCloseOnEscapePress:n=!0,showCloseButton:p=!0,onClose:y,children:E}){const O=F.useRef(null),D=F.useRef(null),[x,A]=F.useState(!1),[N,_]=F.useState(!1),C=F.useCallback(s=>{O.current=s,_(!1)},[]),L=F.useRef(null),$=F.useCallback(s=>{s&&(L.current=s)},[]),[Y,G]=F.useState(a??!1),H=F.useMemo(()=>({isVisible:Y,setInitialFocus:$,close:C}),[Y,$,C]);F.useEffect(()=>{a&&(A(!0),G(!0))},[a]),F.useEffect(()=>{if(a){const s=setTimeout(()=>{_(!0)},100);return()=>{clearTimeout(s)}}_(!1)},[a]),F.useEffect(()=>{if(x&&!N){const s=setTimeout(()=>{y==null||y(O.current??void 0),G(!1)},370);return()=>{clearTimeout(s)}}},[x,N,y]),F.useEffect(()=>{const s=D.current;if(a&&l&&s){const m=c=>{s===c.target&&_(!1)};return s.addEventListener("click",m),()=>{s.removeEventListener("click",m)}}},[a,l]),F.useEffect(()=>{if(!a||!n)return;const s=m=>{m.key==="Escape"&&_(!1)};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s)}},[a,n]);const K=F.useMemo(()=>({initialFocus:()=>L.current??void 0,onActivate:()=>{var s;return(s=L.current)==null?void 0:s.focus()}}),[]),d=j.jsxRuntimeExports.jsx("div",{style:{"--max-width":e?`${e}px`:void 0},className:le.cx(r?Pe.default:void 0,"kakadu-components-2807459246",N&&"kakadu-components-1399012551",t),children:j.jsxRuntimeExports.jsx(ft.FocusTrap,{active:N,focusTrapOptions:K,children:j.jsxRuntimeExports.jsx("div",{ref:D,className:"kakadu-components-3521538255",children:j.jsxRuntimeExports.jsx("div",{className:le.cx("kakadu-components-1982320206",u&&"kakadu-components-3904045733",N&&"kakadu-components-3829535111"),children:j.jsxRuntimeExports.jsxs(dt,{value:H,children:[p?j.jsxRuntimeExports.jsx(vt,{}):null,j.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2617708556",children:E})]})})})})});return r?Ne.createPortal(d,r):d}function bt(r,e){const[t,a]=F.useState(!1),u=F.useRef(void 0),l=F.useCallback(async()=>(a(!0),new Promise(y=>{u.current=y})),[]),n=F.useCallback(y=>{var E;a(!1),(E=u.current)==null||E.call(u,y),u.current=void 0},[]),p=F.useMemo(()=>j.jsxRuntimeExports.jsx(r,{...e,isVisible:t,onClose:n}),[r,e,t,n]);return F.useMemo(()=>({isVisible:t,show:l,modal:p}),[t,l,p])}exports.default=pt;exports.useModal=bt;exports.useModalContext=De;
|
|
7
|
+
*/function ce(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,a=Array(e);t<e;t++)a[t]=r[t];return a}function ze(r){if(Array.isArray(r))return ce(r)}function de(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=Oe(r))||e){t&&(r=t);var a=0,u=function(){};return{s:u,n:function(){return a>=r.length?{done:!0}:{done:!1,value:r[a++]}},e:function(g){throw g},f:u}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
8
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var c,n=!0,b=!1;return{s:function(){t=t.call(r)},n:function(){var g=t.next();return n=g.done,g},e:function(g){b=!0,c=g},f:function(){try{n||t.return==null||t.return()}finally{if(b)throw c}}}}function Ye(r,e,t){return(e=Qe(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function He(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Ze(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
9
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ve(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);e&&(a=a.filter(function(u){return Object.getOwnPropertyDescriptor(r,u).enumerable})),t.push.apply(t,a)}return t}function pe(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ve(Object(t),!0).forEach(function(a){Ye(r,a,t[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ve(Object(t)).forEach(function(a){Object.defineProperty(r,a,Object.getOwnPropertyDescriptor(t,a))})}return r}function Xe(r){return ze(r)||He(r)||Oe(r)||Ze()}function Je(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var a=t.call(r,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Qe(r){var e=Je(r,"string");return typeof e=="symbol"?e:e+""}function Oe(r,e){if(r){if(typeof r=="string")return ce(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ce(r,e):void 0}}var B={getActiveTrap:function(e){return(e==null?void 0:e.length)>0?e[e.length-1]:null},activateTrap:function(e,t){var a=B.getActiveTrap(e);t!==a&&B.pauseTrap(e);var u=e.indexOf(t);u===-1||e.splice(u,1),e.push(t)},deactivateTrap:function(e,t){var a=e.indexOf(t);a!==-1&&e.splice(a,1),B.unpauseTrap(e)},pauseTrap:function(e){var t=B.getActiveTrap(e);t==null||t._setPausedState(!0)},unpauseTrap:function(e){var t=B.getActiveTrap(e);t&&!t._isManuallyPaused()&&t._setPausedState(!1)}},et=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},tt=function(e){return(e==null?void 0:e.key)==="Escape"||(e==null?void 0:e.key)==="Esc"||(e==null?void 0:e.keyCode)===27},X=function(e){return(e==null?void 0:e.key)==="Tab"||(e==null?void 0:e.keyCode)===9},rt=function(e){return X(e)&&!e.shiftKey},at=function(e){return X(e)&&e.shiftKey},be=function(e){return setTimeout(e,0)},Z=function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),u=1;u<t;u++)a[u-1]=arguments[u];return typeof e=="function"?e.apply(void 0,a):e},Q=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},nt=[],it=function(e,t){var a=(t==null?void 0:t.document)||document,u=(t==null?void 0:t.trapStack)||nt,c=pe({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isolateSubtrees:!1,isKeyForward:rt,isKeyBackward:at},t),n={containers:[],containerGroups:[],tabbableGroups:[],adjacentElements:new Set,alreadySilent:new Set,nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,manuallyPaused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},b,g=function(o,i,l){return o&&o[i]!==void 0?o[i]:c[l||i]},E=function(o,i){var l=typeof(i==null?void 0:i.composedPath)=="function"?i.composedPath():void 0;return n.containerGroups.findIndex(function(m){var y=m.container,w=m.tabbableNodes;return y.contains(o)||(l==null?void 0:l.includes(y))||w.find(function(p){return p===o})})},O=function(o){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=i.hasFallback,m=l===void 0?!1:l,y=i.params,w=y===void 0?[]:y,p=c[o];if(typeof p=="function"&&(p=p.apply(void 0,Xe(w))),p===!0&&(p=void 0),!p){if(p===void 0||p===!1)return p;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var k=p;if(typeof p=="string"){try{k=a.querySelector(p)}catch(S){throw new Error("`".concat(o,'` appears to be an invalid selector; error="').concat(S.message,'"'))}if(!k&&!m)throw new Error("`".concat(o,"` as selector refers to no known node"))}return k},D=function(){var o=O("initialFocus",{hasFallback:!0});if(o===!1)return!1;if(o===void 0||o&&!ee(o,c.tabbableOptions))if(E(a.activeElement)>=0)o=a.activeElement;else{var i=n.tabbableGroups[0],l=i&&i.firstTabbableNode;o=l||O("fallbackFocus")}else o===null&&(o=O("fallbackFocus"));if(!o)throw new Error("Your focus-trap needs to have at least one focusable element");return o},x=function(){if(n.containerGroups=n.containers.map(function(o){var i=Se(o,c.tabbableOptions),l=Fe(o,c.tabbableOptions),m=i.length>0?i[0]:void 0,y=i.length>0?i[i.length-1]:void 0,w=l.find(function(S){return z(S)}),p=l.slice().reverse().find(function(S){return z(S)}),k=!!i.find(function(S){return $(S)>0});return{container:o,tabbableNodes:i,focusableNodes:l,posTabIndexesFound:k,firstTabbableNode:m,lastTabbableNode:y,firstDomTabbableNode:w,lastDomTabbableNode:p,nextTabbableNode:function(P){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,A=i.indexOf(P);return A<0?L?l.slice(l.indexOf(P)+1).find(function(W){return z(W)}):l.slice(0,l.indexOf(P)).reverse().find(function(W){return z(W)}):i[A+(L?1:-1)]}}}),n.tabbableGroups=n.containerGroups.filter(function(o){return o.tabbableNodes.length>0}),n.tabbableGroups.length<=0&&!O("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(n.containerGroups.find(function(o){return o.posTabIndexesFound})&&n.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},I=function(o){var i=o.activeElement;if(i)return i.shadowRoot&&i.shadowRoot.activeElement!==null?I(i.shadowRoot):i},C=function(o){if(o!==!1&&o!==I(document)){if(!o||!o.focus){C(D());return}o.focus({preventScroll:!!c.preventScroll}),n.mostRecentlyFocusedNode=o,et(o)&&o.select()}},_=function(o){var i=O("setReturnFocus",{params:[o]});return i||(i===!1?!1:o)},j=function(o){var i=o.target,l=o.event,m=o.isBackward,y=m===void 0?!1:m;i=i||Q(l),x();var w=null;if(n.tabbableGroups.length>0){var p=E(i,l),k=p>=0?n.containerGroups[p]:void 0;if(p<0)y?w=n.tabbableGroups[n.tabbableGroups.length-1].lastTabbableNode:w=n.tabbableGroups[0].firstTabbableNode;else if(y){var S=n.tabbableGroups.findIndex(function(oe){var ue=oe.firstTabbableNode;return i===ue});if(S<0&&(k.container===i||ee(i,c.tabbableOptions)&&!z(i,c.tabbableOptions)&&!k.nextTabbableNode(i,!1))&&(S=p),S>=0){var P=S===0?n.tabbableGroups.length-1:S-1,L=n.tabbableGroups[P];w=$(i)>=0?L.lastTabbableNode:L.lastDomTabbableNode}else X(l)||(w=k.nextTabbableNode(i,!1))}else{var A=n.tabbableGroups.findIndex(function(oe){var ue=oe.lastTabbableNode;return i===ue});if(A<0&&(k.container===i||ee(i,c.tabbableOptions)&&!z(i,c.tabbableOptions)&&!k.nextTabbableNode(i))&&(A=p),A>=0){var W=A===n.tabbableGroups.length-1?0:A+1,V=n.tabbableGroups[W];w=$(i)>=0?V.firstTabbableNode:V.firstDomTabbableNode}else X(l)||(w=k.nextTabbableNode(i))}}else w=O("fallbackFocus");return w},M=function(o){var i=Q(o);if(!(E(i,o)>=0)){if(Z(c.clickOutsideDeactivates,o)){b.deactivate({returnFocus:c.returnFocusOnDeactivate});return}Z(c.allowOutsideClick,o)||o.preventDefault()}},K=function(o){var i=Q(o),l=E(i,o)>=0;if(l||i instanceof Document)l&&(n.mostRecentlyFocusedNode=i);else{o.stopImmediatePropagation();var m,y=!0;if(n.mostRecentlyFocusedNode)if($(n.mostRecentlyFocusedNode)>0){var w=E(n.mostRecentlyFocusedNode),p=n.containerGroups[w].tabbableNodes;if(p.length>0){var k=p.findIndex(function(S){return S===n.mostRecentlyFocusedNode});k>=0&&(c.isKeyForward(n.recentNavEvent)?k+1<p.length&&(m=p[k+1],y=!1):k-1>=0&&(m=p[k-1],y=!1))}}else n.containerGroups.some(function(S){return S.tabbableNodes.some(function(P){return $(P)>0})})||(y=!1);else y=!1;y&&(m=j({target:n.mostRecentlyFocusedNode,isBackward:c.isKeyBackward(n.recentNavEvent)})),C(m||n.mostRecentlyFocusedNode||D())}n.recentNavEvent=void 0},H=function(o){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n.recentNavEvent=o;var l=j({event:o,isBackward:i});l&&(X(o)&&o.preventDefault(),C(l))},G=function(o){(c.isKeyForward(o)||c.isKeyBackward(o))&&H(o,c.isKeyBackward(o))},U=function(o){tt(o)&&Z(c.escapeDeactivates,o)!==!1&&(o.preventDefault(),b.deactivate())},q=function(o){var i=Q(o);E(i,o)>=0||Z(c.clickOutsideDeactivates,o)||Z(c.allowOutsideClick,o)||(o.preventDefault(),o.stopImmediatePropagation())},v=function(){if(n.active)return B.activateTrap(u,b),n.delayInitialFocusTimer=c.delayInitialFocus?be(function(){C(D())}):C(D()),a.addEventListener("focusin",K,!0),a.addEventListener("mousedown",M,{capture:!0,passive:!1}),a.addEventListener("touchstart",M,{capture:!0,passive:!1}),a.addEventListener("click",q,{capture:!0,passive:!1}),a.addEventListener("keydown",G,{capture:!0,passive:!1}),a.addEventListener("keydown",U),b},f=function(o){n.active&&!n.paused&&b._setSubtreeIsolation(!1),n.adjacentElements.clear(),n.alreadySilent.clear();var i=new Set,l=new Set,m=de(o),y;try{for(m.s();!(y=m.n()).done;){var w=y.value;i.add(w);for(var p=typeof ShadowRoot<"u"&&w.getRootNode()instanceof ShadowRoot,k=w;k;){i.add(k);var S=k.parentElement,P=[];S?P=S.children:!S&&p&&(P=k.getRootNode().children,S=k.getRootNode().host,p=typeof ShadowRoot<"u"&&S.getRootNode()instanceof ShadowRoot);var L=de(P),A;try{for(L.s();!(A=L.n()).done;){var W=A.value;l.add(W)}}catch(V){L.e(V)}finally{L.f()}k=S}}}catch(V){m.e(V)}finally{m.f()}i.forEach(function(V){l.delete(V)}),n.adjacentElements=l},d=function(){if(n.active)return a.removeEventListener("focusin",K,!0),a.removeEventListener("mousedown",M,!0),a.removeEventListener("touchstart",M,!0),a.removeEventListener("click",q,!0),a.removeEventListener("keydown",G,!0),a.removeEventListener("keydown",U),b},s=function(o){var i=o.some(function(l){var m=Array.from(l.removedNodes);return m.some(function(y){return y===n.mostRecentlyFocusedNode})});i&&C(D())},T=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(s):void 0,R=function(){T&&(T.disconnect(),n.active&&!n.paused&&n.containers.map(function(o){T.observe(o,{subtree:!0,childList:!0})}))};return b={get active(){return n.active},get paused(){return n.paused},activate:function(o){if(n.active)return this;var i=g(o,"onActivate"),l=g(o,"onPostActivate"),m=g(o,"checkCanFocusTrap"),y=B.getActiveTrap(u),w=!1;if(y&&!y.paused){var p;(p=y._setSubtreeIsolation)===null||p===void 0||p.call(y,!1),w=!0}try{m||x(),n.active=!0,n.paused=!1,n.nodeFocusedBeforeActivation=I(a),i==null||i();var k=function(){m&&x(),v(),R(),c.isolateSubtrees&&b._setSubtreeIsolation(!0),l==null||l()};if(m)return m(n.containers.concat()).then(k,k),this;k()}catch(P){if(y===B.getActiveTrap(u)&&w){var S;(S=y._setSubtreeIsolation)===null||S===void 0||S.call(y,!0)}throw P}return this},deactivate:function(o){if(!n.active)return this;var i=pe({onDeactivate:c.onDeactivate,onPostDeactivate:c.onPostDeactivate,checkCanReturnFocus:c.checkCanReturnFocus},o);clearTimeout(n.delayInitialFocusTimer),n.delayInitialFocusTimer=void 0,n.paused||b._setSubtreeIsolation(!1),n.alreadySilent.clear(),d(),n.active=!1,n.paused=!1,R(),B.deactivateTrap(u,b);var l=g(i,"onDeactivate"),m=g(i,"onPostDeactivate"),y=g(i,"checkCanReturnFocus"),w=g(i,"returnFocus","returnFocusOnDeactivate");l==null||l();var p=function(){be(function(){w&&C(_(n.nodeFocusedBeforeActivation)),m==null||m()})};return w&&y?(y(_(n.nodeFocusedBeforeActivation)).then(p,p),this):(p(),this)},pause:function(o){return n.active?(n.manuallyPaused=!0,this._setPausedState(!0,o)):this},unpause:function(o){return n.active?(n.manuallyPaused=!1,u[u.length-1]!==this?this:this._setPausedState(!1,o)):this},updateContainerElements:function(o){var i=[].concat(o).filter(Boolean);return n.containers=i.map(function(l){return typeof l=="string"?a.querySelector(l):l}),c.isolateSubtrees&&f(n.containers),n.active&&(x(),c.isolateSubtrees&&!n.paused&&b._setSubtreeIsolation(!0)),R(),this}},Object.defineProperties(b,{_isManuallyPaused:{value:function(){return n.manuallyPaused}},_setPausedState:{value:function(o,i){if(n.paused===o)return this;if(n.paused=o,o){var l=g(i,"onPause"),m=g(i,"onPostPause");l==null||l(),d(),R(),b._setSubtreeIsolation(!1),m==null||m()}else{var y=g(i,"onUnpause"),w=g(i,"onPostUnpause");y==null||y(),b._setSubtreeIsolation(!0),x(),v(),R(),w==null||w()}return this}},_setSubtreeIsolation:{value:function(o){c.isolateSubtrees&&n.adjacentElements.forEach(function(i){var l;if(o)switch(c.isolateSubtrees){case"aria-hidden":(i.ariaHidden==="true"||((l=i.getAttribute("aria-hidden"))===null||l===void 0?void 0:l.toLowerCase())==="true")&&n.alreadySilent.add(i),i.setAttribute("aria-hidden","true");break;default:(i.inert||i.hasAttribute("inert"))&&n.alreadySilent.add(i),i.setAttribute("inert",!0);break}else if(!n.alreadySilent.has(i))switch(c.isolateSubtrees){case"aria-hidden":i.removeAttribute("aria-hidden");break;default:i.removeAttribute("inert");break}})}}}),b.updateContainerElements(e),b};const ot=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:it},Symbol.toStringTag,{value:"Module"})),ut=ye(ot),st=ye(We);var he;function ct(){if(he)return J.exports;he=1;function r(v){"@babel/helpers - typeof";return r=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},r(v)}var e,t;function a(v,f){if(!(v instanceof f))throw new TypeError("Cannot call a class as a function")}function u(v,f){for(var d=0;d<f.length;d++){var s=f[d];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(v,C(s.key),s)}}function c(v,f,d){return f&&u(v.prototype,f),Object.defineProperty(v,"prototype",{writable:!1}),v}function n(v,f,d){return f=O(f),b(v,E()?Reflect.construct(f,d||[],O(v).constructor):f.apply(v,d))}function b(v,f){if(f&&(r(f)=="object"||typeof f=="function"))return f;if(f!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return g(v)}function g(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function E(){try{var v=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(E=function(){return!!v})()}function O(v){return O=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(f){return f.__proto__||Object.getPrototypeOf(f)},O(v)}function D(v,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function");v.prototype=Object.create(f&&f.prototype,{constructor:{value:v,writable:!0,configurable:!0}}),Object.defineProperty(v,"prototype",{writable:!1}),f&&x(v,f)}function x(v,f){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(d,s){return d.__proto__=s,d},x(v,f)}function I(v,f,d){return(f=C(f))in v?Object.defineProperty(v,f,{value:d,enumerable:!0,configurable:!0,writable:!0}):v[f]=d,v}function C(v){var f=_(v,"string");return r(f)=="symbol"?f:f+""}function _(v,f){if(r(v)!="object"||!v)return v;var d=v[Symbol.toPrimitive];if(d!==void 0){var s=d.call(v,f);if(r(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(v)}var j=F,M=ut,K=M.createFocusTrap,H=st,G=H.isFocusable,U=parseInt((e=(t=/^(\d+)\./.exec(j.version))===null||t===void 0?void 0:t[1])!==null&&e!==void 0?e:0,10),q=(function(v){function f(d){var s;a(this,f),s=n(this,f,[d]),I(s,"getNodeForOption",function(h){var o,i=(o=this.internalOptions[h])!==null&&o!==void 0?o:this.originalOptions[h];if(typeof i=="function"){for(var l=arguments.length,m=new Array(l>1?l-1:0),y=1;y<l;y++)m[y-1]=arguments[y];i=i.apply(void 0,m)}if(i===!0&&(i=void 0),!i){if(i===void 0||i===!1)return i;throw new Error("`".concat(h,"` was specified but was not a node, or did not return a node"))}var w=i;if(typeof i=="string"){var p;if(w=(p=this.getDocument())===null||p===void 0?void 0:p.querySelector(i),!w)throw new Error("`".concat(h,"` as selector refers to no known node"))}return w}),s.handleDeactivate=s.handleDeactivate.bind(s),s.handlePostDeactivate=s.handlePostDeactivate.bind(s),s.handleClickOutsideDeactivates=s.handleClickOutsideDeactivates.bind(s),s.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:s.handleDeactivate,onPostDeactivate:s.handlePostDeactivate,clickOutsideDeactivates:s.handleClickOutsideDeactivates},s.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var T=d.focusTrapOptions;for(var R in T)if(Object.prototype.hasOwnProperty.call(T,R)){if(R==="returnFocusOnDeactivate"||R==="onDeactivate"||R==="onPostDeactivate"||R==="checkCanReturnFocus"||R==="clickOutsideDeactivates"){s.originalOptions[R]=T[R];continue}s.internalOptions[R]=T[R]}return s.outsideClick=null,s.focusTrapElements=d.containerElements||[],s.updatePreviousElement(),s}return D(f,v),c(f,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var s=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return s||(s===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var s=this.getDocument();s&&(this.previouslyFocusedElement=s.activeElement)}},{key:"deactivateTrap",value:function(){!this.focusTrap||!this.focusTrap.active||this.focusTrap.deactivate({returnFocus:!1,checkCanReturnFocus:null,onDeactivate:this.originalOptions.onDeactivate})}},{key:"handleClickOutsideDeactivates",value:function(s){var T=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,s):this.originalOptions.clickOutsideDeactivates;return T&&(this.outsideClick={target:s.target,allowDeactivation:T}),T}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var s=this,T=function(){var h=s.getReturnFocusNode(),o=!!(s.originalOptions.returnFocusOnDeactivate&&h!==null&&h!==void 0&&h.focus&&(!s.outsideClick||s.outsideClick.allowDeactivation&&!G(s.outsideClick.target,s.internalOptions.tabbableOptions))),i=s.internalOptions.preventScroll,l=i===void 0?!1:i;o&&h.focus({preventScroll:l}),s.originalOptions.onPostDeactivate&&s.originalOptions.onPostDeactivate.call(null),s.outsideClick=null};this.originalOptions.checkCanReturnFocus?this.originalOptions.checkCanReturnFocus.call(null,this.getReturnFocusNode()).then(T,T):T()}},{key:"setupFocusTrap",value:function(){if(this.focusTrap)this.props.active&&!this.focusTrap.active&&(this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause());else{var s=this.focusTrapElements.some(Boolean);s&&(this.focusTrap=this.props._createFocusTrap(this.focusTrapElements,this.internalOptions),this.props.active&&this.focusTrap.activate(),this.props.paused&&this.focusTrap.pause())}}},{key:"componentDidMount",value:function(){this.props.active&&this.setupFocusTrap()}},{key:"componentDidUpdate",value:function(s){if(this.focusTrap){s.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var T=!s.active&&this.props.active,R=s.active&&!this.props.active,h=!s.paused&&this.props.paused,o=s.paused&&!this.props.paused;if(T&&(this.updatePreviousElement(),this.focusTrap.activate()),R){this.deactivateTrap();return}h&&this.focusTrap.pause(),o&&this.focusTrap.unpause()}else s.containerElements!==this.props.containerElements&&(this.focusTrapElements=this.props.containerElements),this.props.active&&(this.updatePreviousElement(),this.setupFocusTrap())}},{key:"componentWillUnmount",value:function(){this.deactivateTrap()}},{key:"render",value:function(){var s=this,T=this.props.children?j.Children.only(this.props.children):void 0;if(T){if(T.type&&T.type===j.Fragment)throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");var R=function(i){var l=s.props.containerElements;T&&(U>=19?typeof T.props.ref=="function"?T.props.ref(i):T.props.ref&&(T.props.ref.current=i):typeof T.ref=="function"?T.ref(i):T.ref&&(T.ref.current=i)),s.focusTrapElements=l||[i]},h=j.cloneElement(T,{ref:R});return h}return null}}])})(j.Component);return q.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:K},J.exports=q,J.exports.FocusTrap=q,J.exports}var lt=ct();const Re=F.createContext({isVisible:!1}),{Provider:ft}=Re;function De(){return F.useContext(Re)}function dt(){const{close:r}=De(),e=F.useCallback(()=>{r==null||r()},[r]);return N.jsxRuntimeExports.jsxs(N.jsxRuntimeExports.Fragment,{children:[N.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2543813221"}),N.jsxRuntimeExports.jsx("div",{className:"kakadu-components-840864829",children:N.jsxRuntimeExports.jsx(je.default,{iconLeft:xe.IconType.times,label:"Close",className:"kakadu-components-3855719072",onClick:e})})]})}function vt({decorators:r,children:e}){return r.length===0?e:r.reduceRight((t,a)=>N.jsxRuntimeExports.jsx(a,{children:t}),e)}function pt({root:r,decorators:e=[],maxWidth:t,className:a,isVisible:u,isFullWidth:c=!1,shouldCloseOnOutsideClick:n=!0,shouldCloseOnEscapePress:b=!0,showCloseButton:g=!0,onClose:E,children:O}){const D=F.useRef(null),x=F.useRef(null),[I,C]=F.useState(!1),[_,j]=F.useState(!1),M=F.useCallback(d=>{D.current=d,j(!1)},[]),K=F.useRef(null),H=F.useCallback(d=>{d&&(K.current=d)},[]),[G,U]=F.useState(u??!1),q=F.useMemo(()=>({isVisible:G,setInitialFocus:H,close:M}),[G,H,M]);F.useEffect(()=>{u&&(C(!0),U(!0))},[u]),F.useEffect(()=>{if(u){const d=setTimeout(()=>{j(!0)},100);return()=>{clearTimeout(d)}}j(!1)},[u]),F.useEffect(()=>{if(I&&!_){const d=setTimeout(()=>{E==null||E(D.current??void 0),U(!1)},370);return()=>{clearTimeout(d)}}},[I,_,E]),F.useEffect(()=>{const d=x.current;if(u&&n&&d){const s=T=>{d===T.target&&j(!1)};return d.addEventListener("click",s),()=>{d.removeEventListener("click",s)}}},[u,n]),F.useEffect(()=>{if(!u||!b)return;const d=s=>{s.key==="Escape"&&j(!1)};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}},[u,b]);const v=F.useMemo(()=>({initialFocus:()=>K.current??void 0,onActivate:()=>{var d;return(d=K.current)==null?void 0:d.focus()}}),[]),f=N.jsxRuntimeExports.jsx(vt,{decorators:e,children:N.jsxRuntimeExports.jsx("div",{style:{"--max-width":t?`${t}px`:void 0},className:le.cx("kakadu-components-4119461136",_&&"kakadu-components-2522346797",a),children:N.jsxRuntimeExports.jsx(lt.FocusTrap,{active:_,focusTrapOptions:v,children:N.jsxRuntimeExports.jsx("div",{ref:x,className:"kakadu-components-3001745367",children:N.jsxRuntimeExports.jsx("div",{className:le.cx("kakadu-components-3903793117",c&&"kakadu-components-2700481558",_&&"kakadu-components-2379306144"),children:N.jsxRuntimeExports.jsxs(ft,{value:q,children:[g?N.jsxRuntimeExports.jsx(dt,{}):null,N.jsxRuntimeExports.jsx("div",{className:"kakadu-components-4238836556",children:O})]})})})})})});return r?Ne.createPortal(f,r):f}function bt(r,e){const[t,a]=F.useState(!1),u=F.useRef(void 0),c=F.useCallback(async()=>(a(!0),new Promise(g=>{u.current=g})),[]),n=F.useCallback(g=>{var E;a(!1),(E=u.current)==null||E.call(u,g),u.current=void 0},[]),b=F.useMemo(()=>N.jsxRuntimeExports.jsx(r,{...e,isVisible:t,onClose:n}),[r,e,t,n]);return F.useMemo(()=>({isVisible:t,show:c,modal:b}),[t,c,b])}exports.default=pt;exports.useModal=bt;exports.useModalContext=De;
|