@kakadu/components 2.2.1 → 2.3.0
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/button-tooltip.d.ts +2 -1
- package/build/components/button-tooltip.js +1 -1
- package/build/components/button-tooltip.mjs +7 -6
- package/build/components/button.js +1 -1
- package/build/components/button.mjs +44 -44
- package/build/components/collapsible.js +1 -1
- package/build/components/collapsible.mjs +12 -12
- package/build/components/icon-button.js +1 -1
- package/build/components/icon-button.mjs +29 -29
- package/build/components/modal.d.ts +3 -2
- package/build/components/modal.js +1 -9
- package/build/components/modal.mjs +105 -1226
- package/build/components/moving-gradients.js +1 -1
- package/build/components/moving-gradients.mjs +2 -2
- package/build/components/moving-stars.js +1 -1
- package/build/components/moving-stars.mjs +17 -17
- package/build/components/notification.js +1 -1
- package/build/components/notification.mjs +12 -12
- package/build/components/popover-menu.d.ts +19 -0
- package/build/components/popover-menu.js +1 -0
- package/build/components/popover-menu.mjs +68 -0
- package/build/components/popover.d.ts +26 -0
- package/build/components/popover.js +1 -0
- package/build/components/popover.mjs +95 -0
- package/build/components/skeleton.js +1 -1
- package/build/components/skeleton.mjs +23 -23
- package/build/components/spinner.js +1 -1
- package/build/components/spinner.mjs +1 -1
- package/build/components/text-button.js +1 -1
- package/build/components/text-button.mjs +14 -14
- package/build/components.css +1 -1
- package/build/focus-trap-react-CcpTuiJi.js +9 -0
- package/build/focus-trap-react-DYXrtbDH.mjs +1130 -0
- package/build/icons/icon.js +1 -1
- package/build/icons/icon.mjs +11 -11
- package/build/index.d.ts +4 -0
- package/build/index.js +1 -1
- package/build/index.mjs +161 -154
- package/package.json +1 -1
|
@@ -3,8 +3,9 @@ export declare enum ButtonTooltipPosition {
|
|
|
3
3
|
bottom = "bottom"
|
|
4
4
|
}
|
|
5
5
|
export type ButtonTooltipProperties = {
|
|
6
|
+
readonly id?: string;
|
|
6
7
|
readonly label: string;
|
|
7
8
|
readonly position?: ButtonTooltipPosition;
|
|
8
9
|
readonly className?: string;
|
|
9
10
|
};
|
|
10
|
-
export default function ButtonTooltip({ label, position, className, }: ButtonTooltipProperties): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default function ButtonTooltip({ id, label, position, className, }: ButtonTooltipProperties): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../jsx-runtime-BB_1_6y_.js"),u=require("@kuma-ui/core");var a=(t=>(t.top="top",t.bottom="bottom",t))(a||{});function
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../jsx-runtime-BB_1_6y_.js"),u=require("@kuma-ui/core");var a=(t=>(t.top="top",t.bottom="bottom",t))(a||{});function s({id:t,label:r,position:o="top",className:e}){return n.jsxRuntimeExports.jsx("div",{id:t,role:"tooltip",className:u.cx("kakadu-components-982005200",o==="top"&&"kakadu-components-430823771",o==="bottom"&&"kakadu-components-2189175034",e),children:n.jsxRuntimeExports.jsx("span",{className:u.cx("kakadu-components-3460060923",o==="top"&&"kakadu-components-2481216458",o==="bottom"&&"kakadu-components-637471806",e),children:r})})}exports.ButtonTooltipPosition=a;exports.default=s;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { j as m } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
2
|
import { cx as n } from "@kuma-ui/core";
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
|
|
3
|
+
var p = /* @__PURE__ */ ((o) => (o.top = "top", o.bottom = "bottom", o))(p || {});
|
|
4
|
+
function c({
|
|
5
|
+
id: o,
|
|
6
|
+
label: e,
|
|
6
7
|
position: t = "top",
|
|
7
8
|
className: a
|
|
8
9
|
}) {
|
|
9
|
-
return /* @__PURE__ */ m.jsx("div", { className: n("kakadu-components-982005200", t === "top" && "kakadu-components-430823771", t === "bottom" && "kakadu-components-2189175034", a), children: /* @__PURE__ */ m.jsx("span", { className: n("kakadu-components-
|
|
10
|
+
return /* @__PURE__ */ m.jsx("div", { id: o, role: "tooltip", className: n("kakadu-components-982005200", t === "top" && "kakadu-components-430823771", t === "bottom" && "kakadu-components-2189175034", a), children: /* @__PURE__ */ m.jsx("span", { className: n("kakadu-components-3460060923", t === "top" && "kakadu-components-2481216458", t === "bottom" && "kakadu-components-637471806", a), children: e }) });
|
|
10
11
|
}
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
p as ButtonTooltipPosition,
|
|
14
|
+
c as default
|
|
14
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),j=require("react"),a=require("@kuma-ui/core"),T=require("../theme.js"),G=require("../icons/icon.js"),z=require("./spinner.js"),W=require("./moving-gradients.js"),$=require("./moving-stars.js"),F=require("./theme-setter.js"),O=require("./click-ripples.js"),y=require("./hover-gradient.js"),P=require("./button-tooltip.js"),A=require("./aria-text.js"),C=require("./atom.js");var S=(s=>(s.primary="primary",s.secondary="secondary",s.warning="warning",s.danger="danger",s))(S||{});function R({icon:s,variant:n="primary",className:o,...r}){return e.jsxRuntimeExports.jsx("div",{...r,className:a.cx("kakadu-components-2658660333",n==="secondary"&&"kakadu-components-3469662110",o),children:typeof s=="string"?e.jsxRuntimeExports.jsx(G.default,{width:14,height:14,type:s}):s})}const b="kakadu-components-2244098950",H="kakadu-components-3923184173",E="kakadu-components-317965671",f="kakadu-components-1978976872";function J({type:s,variant:n="primary",href:o,target:r,rel:q,disabled:m,className:g,children:t,label:v,tooltip:u,tooltipPosition:_,iconLeft:c,iconRight:d,isLoading:i,hasMovingGradients:N=!1,movingGradientsCount:p=4,hasMovingStars:w=!1,movingStarsCount:x=10,...M}){const l=j.useId(),k=j.useRef(null),h=F.useIsDarkMode(k),B=s??"button",D=N&&p>0,I=w&&x>0;return e.jsxRuntimeExports.jsxs(C.default,{...M,as:o?"a":"button",type:o?void 0:B,href:o,target:r,rel:q,"aria-describedby":u?l:void 0,disabled:o?void 0:!!m||!!i,className:a.cx(T.effectStyles,"kakadu-components-1897763514",!!c&&"kakadu-components-3652831856",!t&&"kakadu-components-2746167644",n==="secondary"&&b,n==="warning"&&E,n==="danger"&&f,g),children:[c?e.jsxRuntimeExports.jsx(R,{variant:n,icon:c,className:t?"kakadu-components-294089230":void 0}):null,t?e.jsxRuntimeExports.jsx("div",{ref:k,className:"kakadu-components-2618257692",children:t}):e.jsxRuntimeExports.jsx(A.default,{children:v}),d?e.jsxRuntimeExports.jsx(R,{variant:n,icon:d,className:t?"kakadu-components-3127707672":void 0}):null,e.jsxRuntimeExports.jsx("div",{className:a.cx("kakadu-components-1029011626",i&&"kakadu-components-726496666"),children:e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-772420116",children:e.jsxRuntimeExports.jsx(z.RevealSpinner,{isVisible:i})})}),D&&e.jsxRuntimeExports.jsx(W.default,{opacity:h?.4:.3,maximumGradientsCount:p,className:a.cx("kakadu-components-1505766785",n==="secondary"&&"kakadu-components-3712045697")}),I&&e.jsxRuntimeExports.jsx($.default,{maximumStarsCount:x,className:"kakadu-components-2813474662"}),m?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(O.default,{size:t?void 0:50}),e.jsxRuntimeExports.jsx(y.default,{size:t?void 0:50,className:n==="secondary"?y.normalBlendStyles:void 0})]}),u?e.jsxRuntimeExports.jsx(P.default,{id:l,label:u,position:_}):null]})}exports.ButtonVariant=S;exports.buttonDangerStyles=f;exports.buttonSecondaryStyles=b;exports.buttonSuccessStyles=H;exports.buttonWarningStyles=E;exports.default=J;
|
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
import { j as o } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { useId as D, useRef as G } from "react";
|
|
3
3
|
import { cx as t } from "@kuma-ui/core";
|
|
4
|
-
import { effectStyles as
|
|
5
|
-
import
|
|
6
|
-
import { RevealSpinner as
|
|
7
|
-
import
|
|
4
|
+
import { effectStyles as R } from "../theme.mjs";
|
|
5
|
+
import T from "../icons/icon.mjs";
|
|
6
|
+
import { RevealSpinner as z } from "./spinner.mjs";
|
|
7
|
+
import A from "./moving-gradients.mjs";
|
|
8
8
|
import h from "./moving-stars.mjs";
|
|
9
|
-
import { useIsDarkMode as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
var
|
|
16
|
-
function
|
|
9
|
+
import { useIsDarkMode as C } from "./theme-setter.mjs";
|
|
10
|
+
import E from "./click-ripples.mjs";
|
|
11
|
+
import F, { normalBlendStyles as H } from "./hover-gradient.mjs";
|
|
12
|
+
import W from "./button-tooltip.mjs";
|
|
13
|
+
import q from "./aria-text.mjs";
|
|
14
|
+
import J from "./atom.mjs";
|
|
15
|
+
var K = /* @__PURE__ */ ((s) => (s.primary = "primary", s.secondary = "secondary", s.warning = "warning", s.danger = "danger", s))(K || {});
|
|
16
|
+
function y({
|
|
17
17
|
icon: s,
|
|
18
18
|
variant: n = "primary",
|
|
19
19
|
className: a,
|
|
20
20
|
...m
|
|
21
21
|
}) {
|
|
22
|
-
return /* @__PURE__ */ o.jsx("div", { ...m, className: t("kakadu-components-2658660333", n === "secondary" && "kakadu-components-3469662110", a), children: typeof s == "string" ? /* @__PURE__ */ o.jsx(
|
|
22
|
+
return /* @__PURE__ */ o.jsx("div", { ...m, className: t("kakadu-components-2658660333", n === "secondary" && "kakadu-components-3469662110", a), children: typeof s == "string" ? /* @__PURE__ */ o.jsx(T, { width: 14, height: 14, type: s }) : s });
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
function
|
|
24
|
+
const O = "kakadu-components-2244098950", mo = "kakadu-components-3923184173", P = "kakadu-components-317965671", Q = "kakadu-components-1978976872";
|
|
25
|
+
function ro({
|
|
26
26
|
type: s,
|
|
27
27
|
variant: n = "primary",
|
|
28
28
|
href: a,
|
|
29
29
|
target: m,
|
|
30
|
-
rel:
|
|
30
|
+
rel: f,
|
|
31
31
|
disabled: p,
|
|
32
|
-
className:
|
|
32
|
+
className: j,
|
|
33
33
|
children: e,
|
|
34
|
-
label:
|
|
35
|
-
tooltip:
|
|
36
|
-
tooltipPosition:
|
|
37
|
-
iconLeft:
|
|
38
|
-
iconRight:
|
|
39
|
-
isLoading:
|
|
40
|
-
hasMovingGradients:
|
|
41
|
-
movingGradientsCount:
|
|
42
|
-
hasMovingStars:
|
|
34
|
+
label: b,
|
|
35
|
+
tooltip: r,
|
|
36
|
+
tooltipPosition: v,
|
|
37
|
+
iconLeft: c,
|
|
38
|
+
iconRight: i,
|
|
39
|
+
isLoading: d,
|
|
40
|
+
hasMovingGradients: S = !1,
|
|
41
|
+
movingGradientsCount: u = 4,
|
|
42
|
+
hasMovingStars: g = !1,
|
|
43
43
|
movingStarsCount: l = 10,
|
|
44
|
-
...
|
|
44
|
+
...N
|
|
45
45
|
}) {
|
|
46
|
-
const k = D(
|
|
47
|
-
return /* @__PURE__ */ o.jsxs(
|
|
48
|
-
|
|
49
|
-
e ? /* @__PURE__ */ o.jsx("div", { ref:
|
|
50
|
-
|
|
51
|
-
/* @__PURE__ */ o.jsx("div", { className: t("kakadu-components-1029011626",
|
|
52
|
-
|
|
46
|
+
const k = D(), x = G(null), w = C(x), M = s ?? "button", I = S && u > 0, B = g && l > 0;
|
|
47
|
+
return /* @__PURE__ */ o.jsxs(J, { ...N, as: a ? "a" : "button", type: a ? void 0 : M, href: a, target: m, rel: f, "aria-describedby": r ? k : void 0, disabled: a ? void 0 : !!p || !!d, className: t(R, "kakadu-components-1897763514", !!c && "kakadu-components-3652831856", !e && "kakadu-components-2746167644", n === "secondary" && O, n === "warning" && P, n === "danger" && Q, j), children: [
|
|
48
|
+
c ? /* @__PURE__ */ o.jsx(y, { variant: n, icon: c, className: e ? "kakadu-components-294089230" : void 0 }) : null,
|
|
49
|
+
e ? /* @__PURE__ */ o.jsx("div", { ref: x, className: "kakadu-components-2618257692", children: e }) : /* @__PURE__ */ o.jsx(q, { children: b }),
|
|
50
|
+
i ? /* @__PURE__ */ o.jsx(y, { variant: n, icon: i, className: e ? "kakadu-components-3127707672" : void 0 }) : null,
|
|
51
|
+
/* @__PURE__ */ o.jsx("div", { className: t("kakadu-components-1029011626", d && "kakadu-components-726496666"), children: /* @__PURE__ */ o.jsx("div", { className: "kakadu-components-772420116", children: /* @__PURE__ */ o.jsx(z, { isVisible: d }) }) }),
|
|
52
|
+
I && /* @__PURE__ */ o.jsx(A, { opacity: w ? 0.4 : 0.3, maximumGradientsCount: u, className: t("kakadu-components-1505766785", n === "secondary" && "kakadu-components-3712045697") }),
|
|
53
53
|
B && /* @__PURE__ */ o.jsx(h, { maximumStarsCount: l, className: "kakadu-components-2813474662" }),
|
|
54
54
|
p ? null : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
55
|
-
/* @__PURE__ */ o.jsx(
|
|
56
|
-
/* @__PURE__ */ o.jsx(
|
|
55
|
+
/* @__PURE__ */ o.jsx(E, { size: e ? void 0 : 50 }),
|
|
56
|
+
/* @__PURE__ */ o.jsx(F, { size: e ? void 0 : 50, className: n === "secondary" ? H : void 0 })
|
|
57
57
|
] }),
|
|
58
|
-
|
|
58
|
+
r ? /* @__PURE__ */ o.jsx(W, { id: k, label: r, position: v }) : null
|
|
59
59
|
] });
|
|
60
60
|
}
|
|
61
61
|
export {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
K as ButtonVariant,
|
|
63
|
+
Q as buttonDangerStyles,
|
|
64
|
+
O as buttonSecondaryStyles,
|
|
65
|
+
mo as buttonSuccessStyles,
|
|
66
|
+
P as buttonWarningStyles,
|
|
67
|
+
ro as default
|
|
68
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),m=require("@kuma-ui/core"),f=require("./atom.js");function d({as:c,isCollapsed:e=!0,children:o,className:i,...a}){const n=t.useRef(null),[l,r]=t.useState();return t.useEffect(()=>{if(e)r(0);else{const s=n.current;s&&r(s.scrollHeight??0)}},[e]),u.jsxRuntimeExports.jsx(f.default,{as:c??"div",...a,"aria-hidden":e,style:{height:l,opacity:e?0:1},className:m.cx("kakadu-components-2223449868",e&&"kakadu-components-512418581",i),children:u.jsxRuntimeExports.jsx("div",{ref:n,className:"kakadu-components-3857562328",children:o})})}exports.default=d;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useRef as f, useState as u, useEffect as
|
|
3
|
-
import { cx as
|
|
4
|
-
import
|
|
1
|
+
import { j as n } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import { useRef as f, useState as u, useEffect as p } from "react";
|
|
3
|
+
import { cx as h } from "@kuma-ui/core";
|
|
4
|
+
import k from "./atom.mjs";
|
|
5
5
|
function g({
|
|
6
|
-
as:
|
|
6
|
+
as: s,
|
|
7
7
|
isCollapsed: e = !0,
|
|
8
8
|
children: c,
|
|
9
|
-
className:
|
|
10
|
-
...
|
|
9
|
+
className: m,
|
|
10
|
+
...a
|
|
11
11
|
}) {
|
|
12
|
-
const t = f(null), [
|
|
13
|
-
return
|
|
12
|
+
const t = f(null), [i, r] = u();
|
|
13
|
+
return p(() => {
|
|
14
14
|
if (e)
|
|
15
15
|
r(0);
|
|
16
16
|
else {
|
|
17
17
|
const o = t.current;
|
|
18
18
|
o && r(o.scrollHeight ?? 0);
|
|
19
19
|
}
|
|
20
|
-
}, [e]), /* @__PURE__ */
|
|
21
|
-
height:
|
|
20
|
+
}, [e]), /* @__PURE__ */ n.jsx(k, { as: s ?? "div", ...a, "aria-hidden": e, style: {
|
|
21
|
+
height: i,
|
|
22
22
|
opacity: e ? 0 : 1
|
|
23
|
-
}, className:
|
|
23
|
+
}, className: h("kakadu-components-2223449868", e && "kakadu-components-512418581", m), children: /* @__PURE__ */ n.jsx("div", { ref: t, className: "kakadu-components-3857562328", children: c }) });
|
|
24
24
|
}
|
|
25
25
|
export {
|
|
26
26
|
g as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../jsx-runtime-BB_1_6y_.js"),s=require("react"),n=require("@kuma-ui/core"),a=require("../icons/icon.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../jsx-runtime-BB_1_6y_.js"),s=require("react"),n=require("@kuma-ui/core"),a=require("../icons/icon.js"),S=require("../theme.js"),q=require("./theme-setter.js"),i=require("./button.js"),w=require("./button-tooltip.js"),_=require("./click-ripples.js"),h=require("./hover-gradient.js");var j=(e=>(e.default="default",e.success="success",e.warning="warning",e.danger="danger",e))(j||{});function N({icon:e,variant:u="default",label:d,tooltipPosition:g,disabled:m,className:R,...y}){const x=s.useId(),b=q.useIsDarkMode(),[o,E]=s.useState(e),[p,l]=s.useState(!1),f=s.useRef(e),r=s.useRef(null);s.useEffect(()=>{f.current=e},[e]);const c=s.useCallback(()=>{r.current&&(clearTimeout(r.current),r.current=null)},[]);return s.useEffect(()=>{if(o===e){l(k=>k&&!1);return}l(!0),c(),r.current=setTimeout(()=>{l(!1),E(f.current)},370)},[o,e,c]),s.useEffect(()=>()=>{c()},[c]),t.jsxRuntimeExports.jsxs("button",{...y,type:"button","aria-label":d,"aria-describedby":x,disabled:m,className:n.cx(S.buttonResetStyles,S.effectStyles,"kakadu-components-3515018630",u==="default"&&n.cx(i.buttonSecondaryStyles,"kakadu-components-2089159949"),u==="success"&&n.cx(i.buttonSuccessStyles,"kakadu-components-4088931955"),u==="warning"&&n.cx(i.buttonWarningStyles,"kakadu-components-1450399719"),u==="danger"&&n.cx(i.buttonDangerStyles,"kakadu-components-3594030066"),R),children:[t.jsxRuntimeExports.jsxs("span",{"data-theme":u==="default"?b?"dark":"light":"dark",className:"kakadu-components-2197738751",children:[t.jsxRuntimeExports.jsx(a.default,{width:16,height:16,type:o,className:n.cx(a.iconShadowStyles,"kakadu-components-1309118222",p&&"kakadu-components-3602476657")}),o===e?null:t.jsxRuntimeExports.jsx(a.default,{width:16,height:16,type:e,className:n.cx(a.iconShadowStyles,"kakadu-components-2883440801",p&&"kakadu-components-1406924214")})]}),t.jsxRuntimeExports.jsx(w.default,{id:x,label:d,position:g}),m?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(_.default,{size:50}),t.jsxRuntimeExports.jsx(h.default,{size:50,className:u==="default"?h.normalBlendStyles:void 0})]})]})}exports.IconButtonVariant=j;exports.default=N;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
import { j as t } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useId as R, useState as k, useRef as h, useEffect as c, useCallback as N } from "react";
|
|
3
3
|
import { cx as s } from "@kuma-ui/core";
|
|
4
|
-
import
|
|
5
|
-
import { buttonResetStyles as
|
|
6
|
-
import { useIsDarkMode as
|
|
7
|
-
import { buttonSecondaryStyles as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
var
|
|
12
|
-
function
|
|
4
|
+
import g, { iconShadowStyles as S } from "../icons/icon.mjs";
|
|
5
|
+
import { buttonResetStyles as I, effectStyles as T } from "../theme.mjs";
|
|
6
|
+
import { useIsDarkMode as D } from "./theme-setter.mjs";
|
|
7
|
+
import { buttonSecondaryStyles as z, buttonSuccessStyles as C, buttonWarningStyles as E, buttonDangerStyles as M } from "./button.mjs";
|
|
8
|
+
import F from "./button-tooltip.mjs";
|
|
9
|
+
import G from "./click-ripples.mjs";
|
|
10
|
+
import H, { normalBlendStyles as P } from "./hover-gradient.mjs";
|
|
11
|
+
var W = /* @__PURE__ */ ((e) => (e.default = "default", e.success = "success", e.warning = "warning", e.danger = "danger", e))(W || {});
|
|
12
|
+
function Y({
|
|
13
13
|
icon: e,
|
|
14
14
|
variant: o = "default",
|
|
15
|
-
label:
|
|
16
|
-
tooltipPosition:
|
|
17
|
-
disabled:
|
|
15
|
+
label: l,
|
|
16
|
+
tooltipPosition: y,
|
|
17
|
+
disabled: m,
|
|
18
18
|
className: x,
|
|
19
|
-
...
|
|
19
|
+
...j
|
|
20
20
|
}) {
|
|
21
|
-
const
|
|
21
|
+
const d = R(), b = D(), [n, w] = k(e), [i, a] = k(!1), f = h(e), r = h(null);
|
|
22
22
|
c(() => {
|
|
23
|
-
|
|
23
|
+
f.current = e;
|
|
24
24
|
}, [e]);
|
|
25
|
-
const u =
|
|
25
|
+
const u = N(() => {
|
|
26
26
|
r.current && (clearTimeout(r.current), r.current = null);
|
|
27
27
|
}, []);
|
|
28
28
|
return c(() => {
|
|
29
29
|
if (n === e) {
|
|
30
|
-
a((
|
|
30
|
+
a((p) => p && !1);
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
a(!0), u(), r.current = setTimeout(() => {
|
|
34
|
-
a(!1), w(
|
|
34
|
+
a(!1), w(f.current);
|
|
35
35
|
}, 370);
|
|
36
36
|
}, [n, e, u]), c(() => () => {
|
|
37
37
|
u();
|
|
38
|
-
}, [u]), /* @__PURE__ */ t.jsxs("button", { ...
|
|
39
|
-
/* @__PURE__ */ t.jsxs("span", { "data-theme": o === "default" ?
|
|
40
|
-
/* @__PURE__ */ t.jsx(
|
|
41
|
-
n === e ? null : /* @__PURE__ */ t.jsx(
|
|
38
|
+
}, [u]), /* @__PURE__ */ t.jsxs("button", { ...j, type: "button", "aria-label": l, "aria-describedby": d, disabled: m, className: s(I, T, "kakadu-components-3515018630", o === "default" && s(z, "kakadu-components-2089159949"), o === "success" && s(C, "kakadu-components-4088931955"), o === "warning" && s(E, "kakadu-components-1450399719"), o === "danger" && s(M, "kakadu-components-3594030066"), x), children: [
|
|
39
|
+
/* @__PURE__ */ t.jsxs("span", { "data-theme": o === "default" ? b ? "dark" : "light" : "dark", className: "kakadu-components-2197738751", children: [
|
|
40
|
+
/* @__PURE__ */ t.jsx(g, { width: 16, height: 16, type: n, className: s(S, "kakadu-components-1309118222", i && "kakadu-components-3602476657") }),
|
|
41
|
+
n === e ? null : /* @__PURE__ */ t.jsx(g, { width: 16, height: 16, type: e, className: s(S, "kakadu-components-2883440801", i && "kakadu-components-1406924214") })
|
|
42
42
|
] }),
|
|
43
|
-
/* @__PURE__ */ t.jsx(
|
|
44
|
-
|
|
45
|
-
/* @__PURE__ */ t.jsx(
|
|
46
|
-
/* @__PURE__ */ t.jsx(
|
|
43
|
+
/* @__PURE__ */ t.jsx(F, { id: d, label: l, position: y }),
|
|
44
|
+
m ? null : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
45
|
+
/* @__PURE__ */ t.jsx(G, { size: 50 }),
|
|
46
|
+
/* @__PURE__ */ t.jsx(H, { size: 50, className: o === "default" ? P : void 0 })
|
|
47
47
|
] })
|
|
48
48
|
] });
|
|
49
49
|
}
|
|
50
50
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
W as IconButtonVariant,
|
|
52
|
+
Y as default
|
|
53
53
|
};
|
|
@@ -14,6 +14,7 @@ export type ModalProperties<Data = any> = {
|
|
|
14
14
|
readonly outerDecorators?: DecoratorType[];
|
|
15
15
|
readonly innerDecorators?: DecoratorType[];
|
|
16
16
|
readonly maxWidth?: number;
|
|
17
|
+
readonly label?: string;
|
|
17
18
|
readonly className?: string;
|
|
18
19
|
readonly isVisible?: boolean;
|
|
19
20
|
readonly isFullWidth?: boolean;
|
|
@@ -24,10 +25,10 @@ export type ModalProperties<Data = any> = {
|
|
|
24
25
|
readonly children?: ReactNode;
|
|
25
26
|
};
|
|
26
27
|
type ModalBaseProperties<ModalResult> = Omit<ModalProperties<ModalResult>, 'isVisible' | 'onClose'>;
|
|
27
|
-
export default function Modal<Data = any>({ root, outerDecorators, innerDecorators, maxWidth, className, isVisible, isFullWidth, shouldCloseOnOutsideClick, shouldCloseOnEscapePress, showCloseButton, onClose, children, }: ModalProperties<Data>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export default function Modal<Data = any>({ root, outerDecorators, innerDecorators, label, maxWidth, className, isVisible, isFullWidth, shouldCloseOnOutsideClick, shouldCloseOnEscapePress, showCloseButton, onClose, children, }: ModalProperties<Data>): import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export declare function useModal<ModalResult, ModalProperties = ModalBaseProperties<ModalResult>>(ModalComponent: ComponentType<ModalProperties>, properties?: ModalProperties): {
|
|
29
30
|
isVisible: boolean;
|
|
30
|
-
show: () => Promise<ModalResult | undefined>;
|
|
31
|
+
show: (reference?: HTMLElement) => Promise<ModalResult | undefined>;
|
|
31
32
|
modal: import("react/jsx-runtime").JSX.Element;
|
|
32
33
|
};
|
|
33
34
|
export {};
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
* tabbable 6.4.0
|
|
3
|
-
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
4
|
-
*/var ge=["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=ge.join(","),Te=typeof Element>"u",Y=Te?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,re=!Te&&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 s=e==null||(a=e.getAttribute)===null||a===void 0?void 0:a.call(e,"inert"),c=s===""||s==="true",n=c||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):ae(e.parentNode));return n},Ce=function(e){var t,a=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return a===""||a==="true"},we=function(e,t,a){if(ae(e))return[];var s=Array.prototype.slice.apply(e.querySelectorAll(te));return t&&Y.call(e,te)&&s.unshift(e),s=s.filter(a),s},ne=function(e,t,a){for(var s=[],c=Array.from(e);c.length;){var n=c.shift();if(!ae(n,!1))if(n.tagName==="SLOT"){var p=n.assignedElements(),y=p.length?p:n.children,E=ne(y,!0,a);a.flatten?s.push.apply(s,E):s.push({scopeParent:n,candidates:E})}else{var F=Y.call(n,te);F&&a.filter(n)&&(t||!e.includes(n))&&s.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 A=ne(D===!0?n.children:D.children,!0,a);a.flatten?s.push.apply(s,A):s.push({scopeParent:n,candidates:A})}else c.unshift.apply(c,n.children)}}return s},Ee=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},q=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Ce(e))&&!Ee(e)?0:e.tabIndex},Ie=function(e,t){var a=q(e);return a<0&&t&&!Ee(e)?0:a},Ae=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ke=function(e){return e.tagName==="INPUT"},_e=function(e){return ke(e)&&e.type==="hidden"},Le=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(a){return a.tagName==="SUMMARY"});return t},Me=function(e,t){for(var a=0;a<e.length;a++)if(e[a].checked&&e[a].form===t)return e[a]},Be=function(e){if(!e.name)return!0;var t=e.form||re(e),a=function(p){return t.querySelectorAll('input[type="radio"][name="'+p+'"]')},s;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")s=a(window.CSS.escape(e.name));else try{s=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=Me(s,e.form);return!c||c===e},Ke=function(e){return ke(e)&&e.type==="radio"},qe=function(e){return Ke(e)&&!Be(e)},Ve=function(e){var t,a=e&&re(e),s=(t=a)===null||t===void 0?void 0:t.host,c=!1;if(a&&a!==e){var n,p,y;for(c=!!((n=s)!==null&&n!==void 0&&(p=n.ownerDocument)!==null&&p!==void 0&&p.contains(s)||e!=null&&(y=e.ownerDocument)!==null&&y!==void 0&&y.contains(e));!c&&s;){var E,F,D;a=re(s),s=(E=a)===null||E===void 0?void 0:E.host,c=!!((F=s)!==null&&F!==void 0&&(D=F.ownerDocument)!==null&&D!==void 0&&D.contains(s))}}return c},fe=function(e){var t=e.getBoundingClientRect(),a=t.width,s=t.height;return a===0&&s===0},$e=function(e,t){var a=t.displayCheck,s=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"),p=n?e.parentElement:e;if(Y.call(p,"details:not([open]) *"))return!0;if(!a||a==="full"||a==="full-native"||a==="legacy-full"){if(typeof s=="function"){for(var y=e;e;){var E=e.parentElement,F=re(e);if(E&&!E.shadowRoot&&s(E)===!0)return fe(e);e.assignedSlot?e=e.assignedSlot:!E&&F!==e.ownerDocument?e=F.host:e=E}e=y}if(Ve(e))return!e.getClientRects().length;if(a!=="legacy-full")return!0}else if(a==="non-zero-area")return fe(e);return!1},Ge=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 s=t.children.item(a);if(s.tagName==="LEGEND")return Y.call(t,"fieldset[disabled] *")?!0:!s.contains(e)}return!0}t=t.parentElement}return!1},ie=function(e,t){return!(t.disabled||_e(t)||$e(t,e)||Le(t)||Ge(t))},ce=function(e,t){return!(qe(t)||q(t)<0||!ie(e,t))},Ue=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Se=function(e){var t=[],a=[];return e.forEach(function(s,c){var n=!!s.scopeParent,p=n?s.scopeParent:s,y=Ie(p,n),E=n?Se(s.candidates):p;y===0?n?t.push.apply(t,E):t.push(p):a.push({documentOrder:c,tabIndex:y,item:s,isScope:n,content:E})}),a.sort(Ae).reduce(function(s,c){return c.isScope?s.push.apply(s,c.content):s.push(c.content),s},[]).concat(t)},Fe=function(e,t){t=t||{};var a;return t.getShadowRoot?a=ne([e],t.includeContainer,{filter:ce.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ue}):a=we(e,t.includeContainer,ce.bind(null,t)),Se(a)},Oe=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=we(e,t.includeContainer,ie.bind(null,t)),a},W=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Y.call(e,te)===!1?!1:ce(t,e)},ze=ge.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,ze)===!1?!1:ie(t,e)};const We=Object.freeze(Object.defineProperty({__proto__:null,focusable:Oe,getTabIndex:q,isFocusable:ee,isTabbable:W,tabbable:Fe},Symbol.toStringTag,{value:"Module"}));/*!
|
|
5
|
-
* focus-trap 7.8.0
|
|
6
|
-
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
7
|
-
*/function le(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 Ye(r){if(Array.isArray(r))return le(r)}function de(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=Re(r))||e){t&&(r=t);var a=0,s=function(){};return{s,n:function(){return a>=r.length?{done:!0}:{done:!1,value:r[a++]}},e:function(y){throw y},f:s}}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,p=!1;return{s:function(){t=t.call(r)},n:function(){var y=t.next();return n=y.done,y},e:function(y){p=!0,c=y},f:function(){try{n||t.return==null||t.return()}finally{if(p)throw c}}}}function He(r,e,t){return(e=et(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ze(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Xe(){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(s){return Object.getOwnPropertyDescriptor(r,s).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)||Re(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 Re(r,e){if(r){if(typeof r=="string")return le(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)?le(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 s=e.indexOf(t);s===-1||e.splice(s,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),s=1;s<t;s++)a[s-1]=arguments[s];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,s=(t==null?void 0:t.trapStack)||it,c=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,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(g){var h=g.container,w=g.tabbableNodes;return h.contains(o)||(l==null?void 0:l.includes(h))||w.find(function(v){return v===o})})},F=function(o){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=i.hasFallback,g=l===void 0?!1:l,h=i.params,w=h===void 0?[]:h,v=c[o];if(typeof v=="function"&&(v=v.apply(void 0,Je(w))),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=F("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||F("fallbackFocus")}else o===null&&(o=F("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=Fe(o,c.tabbableOptions),l=Oe(o,c.tabbableOptions),g=i.length>0?i[0]:void 0,h=i.length>0?i[i.length-1]:void 0,w=l.find(function(S){return W(S)}),v=l.slice().reverse().find(function(S){return W(S)}),k=!!i.find(function(S){return q(S)>0});return{container:o,tabbableNodes:i,focusableNodes:l,posTabIndexesFound:k,firstTabbableNode:g,lastTabbableNode:h,firstDomTabbableNode:w,lastDomTabbableNode:v,nextTabbableNode:function(C){var L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,_=i.indexOf(C);return _<0?L?l.slice(l.indexOf(C)+1).find(function(z){return W(z)}):l.slice(0,l.indexOf(C)).reverse().find(function(z){return W(z)}):i[_+(L?1:-1)]}}}),n.tabbableGroups=n.containerGroups.filter(function(o){return o.tabbableNodes.length>0}),n.tabbableGroups.length<=0&&!F("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},j=function(o){if(o!==!1&&o!==A(document)){if(!o||!o.focus){j(D());return}o.focus({preventScroll:!!c.preventScroll}),n.mostRecentlyFocusedNode=o,tt(o)&&o.select()}},H=function(o){var i=F("setReturnFocus",{params:[o]});return i||(i===!1?!1:o)},P=function(o){var i=o.target,l=o.event,g=o.isBackward,h=g===void 0?!1:g;i=i||Q(l),x();var w=null;if(n.tabbableGroups.length>0){var v=E(i,l),k=v>=0?n.containerGroups[v]:void 0;if(v<0)h?w=n.tabbableGroups[n.tabbableGroups.length-1].lastTabbableNode:w=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,c.tabbableOptions)&&!W(i,c.tabbableOptions)&&!k.nextTabbableNode(i,!1))&&(S=v),S>=0){var C=S===0?n.tabbableGroups.length-1:S-1,L=n.tabbableGroups[C];w=q(i)>=0?L.lastTabbableNode:L.lastDomTabbableNode}else X(l)||(w=k.nextTabbableNode(i,!1))}else{var _=n.tabbableGroups.findIndex(function(oe){var ue=oe.lastTabbableNode;return i===ue});if(_<0&&(k.container===i||ee(i,c.tabbableOptions)&&!W(i,c.tabbableOptions)&&!k.nextTabbableNode(i))&&(_=v),_>=0){var z=_===n.tabbableGroups.length-1?0:_+1,K=n.tabbableGroups[z];w=q(i)>=0?K.firstTabbableNode:K.firstDomTabbableNode}else X(l)||(w=k.nextTabbableNode(i))}}else w=F("fallbackFocus");return w},I=function(o){var i=Q(o);if(!(E(i,o)>=0)){if(Z(c.clickOutsideDeactivates,o)){p.deactivate({returnFocus:c.returnFocusOnDeactivate});return}Z(c.allowOutsideClick,o)||o.preventDefault()}},V=function(o){var i=Q(o),l=E(i,o)>=0;if(l||i instanceof Document)l&&(n.mostRecentlyFocusedNode=i);else{o.stopImmediatePropagation();var g,h=!0;if(n.mostRecentlyFocusedNode)if(q(n.mostRecentlyFocusedNode)>0){var w=E(n.mostRecentlyFocusedNode),v=n.containerGroups[w].tabbableNodes;if(v.length>0){var k=v.findIndex(function(S){return S===n.mostRecentlyFocusedNode});k>=0&&(c.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(C){return q(C)>0})})||(h=!1);else h=!1;h&&(g=P({target:n.mostRecentlyFocusedNode,isBackward:c.isKeyBackward(n.recentNavEvent)})),j(g||n.mostRecentlyFocusedNode||D())}n.recentNavEvent=void 0},$=function(o){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n.recentNavEvent=o;var l=P({event:o,isBackward:i});l&&(X(o)&&o.preventDefault(),j(l))},G=function(o){(c.isKeyForward(o)||c.isKeyBackward(o))&&$(o,c.isKeyBackward(o))},U=function(o){rt(o)&&Z(c.escapeDeactivates,o)!==!1&&(o.preventDefault(),p.deactivate())},M=function(o){var i=Q(o);E(i,o)>=0||Z(c.clickOutsideDeactivates,o)||Z(c.allowOutsideClick,o)||(o.preventDefault(),o.stopImmediatePropagation())},d=function(){if(n.active)return B.activateTrap(s,p),n.delayInitialFocusTimer=c.delayInitialFocus?be(function(){j(D())}):j(D()),a.addEventListener("focusin",V,!0),a.addEventListener("mousedown",I,{capture:!0,passive:!1}),a.addEventListener("touchstart",I,{capture:!0,passive:!1}),a.addEventListener("click",M,{capture:!0,passive:!1}),a.addEventListener("keydown",G,{capture:!0,passive:!1}),a.addEventListener("keydown",U),p},f=function(o){n.active&&!n.paused&&p._setSubtreeIsolation(!1),n.adjacentElements.clear(),n.alreadySilent.clear();var i=new Set,l=new Set,g=de(o),h;try{for(g.s();!(h=g.n()).done;){var w=h.value;i.add(w);for(var v=typeof ShadowRoot<"u"&&w.getRootNode()instanceof ShadowRoot,k=w;k;){i.add(k);var S=k.parentElement,C=[];S?C=S.children:!S&&v&&(C=k.getRootNode().children,S=k.getRootNode().host,v=typeof ShadowRoot<"u"&&S.getRootNode()instanceof ShadowRoot);var L=de(C),_;try{for(L.s();!(_=L.n()).done;){var z=_.value;l.add(z)}}catch(K){L.e(K)}finally{L.f()}k=S}}}catch(K){g.e(K)}finally{g.f()}i.forEach(function(K){l.delete(K)}),n.adjacentElements=l},m=function(){if(n.active)return a.removeEventListener("focusin",V,!0),a.removeEventListener("mousedown",I,!0),a.removeEventListener("touchstart",I,!0),a.removeEventListener("click",M,!0),a.removeEventListener("keydown",G,!0),a.removeEventListener("keydown",U),p},u=function(o){var i=o.some(function(l){var g=Array.from(l.removedNodes);return g.some(function(h){return h===n.mostRecentlyFocusedNode})});i&&j(D())},T=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(u):void 0,R=function(){T&&(T.disconnect(),n.active&&!n.paused&&n.containers.map(function(o){T.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"),l=y(o,"onPostActivate"),g=y(o,"checkCanFocusTrap"),h=B.getActiveTrap(s),w=!1;if(h&&!h.paused){var v;(v=h._setSubtreeIsolation)===null||v===void 0||v.call(h,!1),w=!0}try{g||x(),n.active=!0,n.paused=!1,n.nodeFocusedBeforeActivation=A(a),i==null||i();var k=function(){g&&x(),d(),R(),c.isolateSubtrees&&p._setSubtreeIsolation(!0),l==null||l()};if(g)return g(n.containers.concat()).then(k,k),this;k()}catch(C){if(h===B.getActiveTrap(s)&&w){var S;(S=h._setSubtreeIsolation)===null||S===void 0||S.call(h,!0)}throw C}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||p._setSubtreeIsolation(!1),n.alreadySilent.clear(),m(),n.active=!1,n.paused=!1,R(),B.deactivateTrap(s,p);var l=y(i,"onDeactivate"),g=y(i,"onPostDeactivate"),h=y(i,"checkCanReturnFocus"),w=y(i,"returnFocus","returnFocusOnDeactivate");l==null||l();var v=function(){be(function(){w&&j(H(n.nodeFocusedBeforeActivation)),g==null||g()})};return w&&h?(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,s[s.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&&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 l=y(i,"onPause"),g=y(i,"onPostPause");l==null||l(),m(),R(),p._setSubtreeIsolation(!1),g==null||g()}else{var h=y(i,"onUnpause"),w=y(i,"onPostUnpause");h==null||h(),p._setSubtreeIsolation(!0),x(),d(),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}})}}}),p.updateContainerElements(e),p};const ut=Object.freeze(Object.defineProperty({__proto__:null,createFocusTrap:ot},Symbol.toStringTag,{value:"Module"})),st=me(ut),ct=me(We);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(f){return typeof f}:function(f){return f&&typeof Symbol=="function"&&f.constructor===Symbol&&f!==Symbol.prototype?"symbol":typeof f},r(d)}var e,t;function a(d,f){if(!(d instanceof f))throw new TypeError("Cannot call a class as a function")}function s(d,f){for(var m=0;m<f.length;m++){var u=f[m];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(d,j(u.key),u)}}function c(d,f,m){return f&&s(d.prototype,f),Object.defineProperty(d,"prototype",{writable:!1}),d}function n(d,f,m){return f=F(f),p(d,E()?Reflect.construct(f,m||[],F(d).constructor):f.apply(d,m))}function p(d,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 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 F(d){return F=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(f){return f.__proto__||Object.getPrototypeOf(f)},F(d)}function D(d,f){if(typeof f!="function"&&f!==null)throw new TypeError("Super expression must either be null or a function");d.prototype=Object.create(f&&f.prototype,{constructor:{value:d,writable:!0,configurable:!0}}),Object.defineProperty(d,"prototype",{writable:!1}),f&&x(d,f)}function x(d,f){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,u){return m.__proto__=u,m},x(d,f)}function A(d,f,m){return(f=j(f))in d?Object.defineProperty(d,f,{value:m,enumerable:!0,configurable:!0,writable:!0}):d[f]=m,d}function j(d){var f=H(d,"string");return r(f)=="symbol"?f:f+""}function H(d,f){if(r(d)!="object"||!d)return d;var m=d[Symbol.toPrimitive];if(m!==void 0){var u=m.call(d,f);if(r(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(f==="string"?String:Number)(d)}var P=O,I=st,V=I.createFocusTrap,$=ct,G=$.isFocusable,U=parseInt((e=(t=/^(\d+)\./.exec(P.version))===null||t===void 0?void 0:t[1])!==null&&e!==void 0?e:0,10),M=(function(d){function f(m){var u;a(this,f),u=n(this,f,[m]),A(u,"getNodeForOption",function(b){var o,i=(o=this.internalOptions[b])!==null&&o!==void 0?o:this.originalOptions[b];if(typeof i=="function"){for(var l=arguments.length,g=new Array(l>1?l-1:0),h=1;h<l;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 w=i;if(typeof i=="string"){var v;if(w=(v=this.getDocument())===null||v===void 0?void 0:v.querySelector(i),!w)throw new Error("`".concat(b,"` as selector refers to no known node"))}return w}),u.handleDeactivate=u.handleDeactivate.bind(u),u.handlePostDeactivate=u.handlePostDeactivate.bind(u),u.handleClickOutsideDeactivates=u.handleClickOutsideDeactivates.bind(u),u.internalOptions={returnFocusOnDeactivate:!1,checkCanReturnFocus:null,onDeactivate:u.handleDeactivate,onPostDeactivate:u.handlePostDeactivate,clickOutsideDeactivates:u.handleClickOutsideDeactivates},u.originalOptions={returnFocusOnDeactivate:!0,onDeactivate:null,onPostDeactivate:null,checkCanReturnFocus:null,clickOutsideDeactivates:!1};var T=m.focusTrapOptions;for(var R in T)if(Object.prototype.hasOwnProperty.call(T,R)){if(R==="returnFocusOnDeactivate"||R==="onDeactivate"||R==="onPostDeactivate"||R==="checkCanReturnFocus"||R==="clickOutsideDeactivates"){u.originalOptions[R]=T[R];continue}u.internalOptions[R]=T[R]}return u.outsideClick=null,u.focusTrapElements=m.containerElements||[],u.updatePreviousElement(),u}return D(f,d),c(f,[{key:"getDocument",value:function(){return this.props.focusTrapOptions.document||(typeof document<"u"?document:void 0)}},{key:"getReturnFocusNode",value:function(){var u=this.getNodeForOption("setReturnFocus",this.previouslyFocusedElement);return u||(u===!1?!1:this.previouslyFocusedElement)}},{key:"updatePreviousElement",value:function(){var u=this.getDocument();u&&(this.previouslyFocusedElement=u.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(u){var T=typeof this.originalOptions.clickOutsideDeactivates=="function"?this.originalOptions.clickOutsideDeactivates.call(null,u):this.originalOptions.clickOutsideDeactivates;return T&&(this.outsideClick={target:u.target,allowDeactivation:T}),T}},{key:"handleDeactivate",value:function(){this.originalOptions.onDeactivate&&this.originalOptions.onDeactivate.call(null),this.deactivateTrap()}},{key:"handlePostDeactivate",value:function(){var u=this,T=function(){var b=u.getReturnFocusNode(),o=!!(u.originalOptions.returnFocusOnDeactivate&&b!==null&&b!==void 0&&b.focus&&(!u.outsideClick||u.outsideClick.allowDeactivation&&!G(u.outsideClick.target,u.internalOptions.tabbableOptions))),i=u.internalOptions.preventScroll,l=i===void 0?!1:i;o&&b.focus({preventScroll:l}),u.originalOptions.onPostDeactivate&&u.originalOptions.onPostDeactivate.call(null),u.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 u=this.focusTrapElements.some(Boolean);u&&(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(u){if(this.focusTrap){u.containerElements!==this.props.containerElements&&this.focusTrap.updateContainerElements(this.props.containerElements);var T=!u.active&&this.props.active,R=u.active&&!this.props.active,b=!u.paused&&this.props.paused,o=u.paused&&!this.props.paused;if(T&&(this.updatePreviousElement(),this.focusTrap.activate()),R){this.deactivateTrap();return}b&&this.focusTrap.pause(),o&&this.focusTrap.unpause()}else u.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 u=this,T=this.props.children?P.Children.only(this.props.children):void 0;if(T){if(T.type&&T.type===P.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=u.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)),u.focusTrapElements=l||[i]},b=P.cloneElement(T,{ref:R});return b}return null}}])})(P.Component);return M.defaultProps={active:!0,paused:!1,focusTrapOptions:{},_createFocusTrap:V},J.exports=M,J.exports.FocusTrap=M,J.exports}var ft=lt();const De=O.createContext({isVisible:!1}),{Provider:dt}=De;function Ne(){return O.useContext(De)}function vt(){const{close:r}=Ne(),e=O.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(Pe.default,{iconLeft:je.IconType.times,label:"Close",className:"kakadu-components-3855719072",onClick:e})})]})}function ye({decorators:r,children:e}){return r.length===0?e:r.reduceRight((t,a)=>N.jsxRuntimeExports.jsx(a,{children:t}),e)}function pt({root:r,outerDecorators:e=[],innerDecorators:t=[],maxWidth:a,className:s,isVisible:c,isFullWidth:n=!1,shouldCloseOnOutsideClick:p=!0,shouldCloseOnEscapePress:y=!0,showCloseButton:E=!0,onClose:F,children:D}){const x=O.useRef(null),A=O.useRef(null),[j,H]=O.useState(!1),[P,I]=O.useState(!1),V=O.useCallback(u=>{x.current=u,I(!1)},[]),$=O.useRef(null),G=O.useCallback(u=>{u&&($.current=u)},[]),[U,M]=O.useState(c??!1),d=O.useMemo(()=>({isVisible:U,setInitialFocus:G,close:V}),[U,G,V]);O.useEffect(()=>{c&&(H(!0),M(!0))},[c]),O.useEffect(()=>{if(c){const u=setTimeout(()=>{I(!0)},100);return()=>{clearTimeout(u)}}I(!1)},[c]),O.useEffect(()=>{if(j&&!P){const u=setTimeout(()=>{F==null||F(x.current??void 0),M(!1)},370);return()=>{clearTimeout(u)}}},[j,P,F]),O.useEffect(()=>{const u=A.current;if(c&&p&&u){const T=R=>{u===R.target&&I(!1)};return u.addEventListener("click",T),()=>{u.removeEventListener("click",T)}}},[c,p]),O.useEffect(()=>{if(!c||!y)return;const u=T=>{T.key==="Escape"&&I(!1)};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[c,y]);const f=O.useMemo(()=>({initialFocus:()=>$.current??void 0,onActivate:()=>{var u;return(u=$.current)==null?void 0:u.focus()}}),[]),m=N.jsxRuntimeExports.jsx(ye,{decorators:e,children:N.jsxRuntimeExports.jsx("div",{style:{"--max-width":a?`${a}px`:void 0},className:se.cx("kakadu-components-4119461136",P&&"kakadu-components-2522346797",s),children:N.jsxRuntimeExports.jsx(ye,{decorators:t,children:N.jsxRuntimeExports.jsx(ft.FocusTrap,{active:P,focusTrapOptions:f,children:N.jsxRuntimeExports.jsx("div",{ref:A,className:"kakadu-components-4011815997",children:N.jsxRuntimeExports.jsx("div",{className:se.cx("kakadu-components-3324483532",n&&"kakadu-components-3799971070",P&&"kakadu-components-968755580"),children:N.jsxRuntimeExports.jsxs(dt,{value:d,children:[E?N.jsxRuntimeExports.jsx(vt,{}):null,N.jsxRuntimeExports.jsx("div",{className:se.cx("kakadu-components-633990035",n&&"kakadu-components-171969824"),children:D})]})})})})})})});return r?xe.createPortal(m,r):m}function bt(r,e){const[t,a]=O.useState(!1),s=O.useRef(void 0),c=O.useCallback(async()=>(a(!0),new Promise(y=>{s.current=y})),[]),n=O.useCallback(y=>{var E;a(!1),(E=s.current)==null||E.call(s,y),s.current=void 0},[]),p=O.useMemo(()=>N.jsxRuntimeExports.jsx(r,{...e,isVisible:t,onClose:n}),[r,e,t,n]);return O.useMemo(()=>({isVisible:t,show:c,modal:p}),[t,c,p])}exports.default=pt;exports.useModal=bt;exports.useModalContext=Ne;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../jsx-runtime-BB_1_6y_.js"),e=require("react"),E=require("@kuma-ui/core"),P=require("react-dom"),$=require("../focus-trap-react-CcpTuiJi.js"),B=require("../icons/icon.js"),D=require("./text-button.js"),I=e.createContext({isVisible:!1}),{Provider:A}=I;function y(){return e.useContext(I)}function z(){const{close:n}=y(),r=e.useCallback(()=>{n==null||n()},[n]);return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2543813221"}),s.jsxRuntimeExports.jsx("div",{className:"kakadu-components-840864829",children:s.jsxRuntimeExports.jsx(D.default,{iconLeft:B.IconType.times,label:"Close",className:"kakadu-components-3855719072",onClick:r})})]})}function q({decorators:n,children:r}){return n.length===0?r:n.reduceRight((c,i)=>s.jsxRuntimeExports.jsx(i,{children:c}),r)}function G({root:n,outerDecorators:r=[],innerDecorators:c=[],label:i,maxWidth:u,className:l,isVisible:o,isFullWidth:f=!1,shouldCloseOnOutsideClick:p=!0,shouldCloseOnEscapePress:d=!0,showCloseButton:x=!0,onClose:a,children:N}){const v=e.useRef(null),h=e.useRef(null),[M,L]=e.useState(!1),[m,j]=e.useState(!1),b=e.useCallback(t=>{v.current=t,j(!1)},[]),R=e.useRef(null),w=e.useCallback(t=>{t&&(R.current=t)},[]),[T,C]=e.useState(o??!1),S=e.useMemo(()=>({isVisible:T,setInitialFocus:w,close:b}),[T,w,b]);e.useEffect(()=>{o&&(L(!0),C(!0))},[o]),e.useEffect(()=>{if(o){const t=setTimeout(()=>{j(!0)},100);return()=>{clearTimeout(t)}}j(!1)},[o]),e.useEffect(()=>{if(M&&!m){const t=setTimeout(()=>{a==null||a(v.current??void 0),C(!1)},370);return()=>{clearTimeout(t)}}},[M,m,a]),e.useEffect(()=>{const t=h.current;if(o&&p&&t){const k=_=>{t===_.target&&j(!1)};return t.addEventListener("click",k),()=>{t.removeEventListener("click",k)}}},[o,p]),e.useEffect(()=>{if(!o||!d)return;const t=k=>{k.key==="Escape"&&j(!1)};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[o,d]);const F=e.useMemo(()=>({initialFocus:()=>R.current??void 0,onActivate:()=>{var t;return(t=R.current)==null?void 0:t.focus()}}),[]),g=s.jsxRuntimeExports.jsx(q,{decorators:r,children:s.jsxRuntimeExports.jsx("div",{"aria-hidden":!m,style:{"--max-width":u?`${u}px`:void 0},className:E.cx("kakadu-components-4119461136",m&&"kakadu-components-2522346797",l),children:s.jsxRuntimeExports.jsx(q,{decorators:c,children:s.jsxRuntimeExports.jsx($.focusTrapReactExports.FocusTrap,{active:m,focusTrapOptions:F,children:s.jsxRuntimeExports.jsx("div",{ref:h,className:"kakadu-components-4011815997",children:s.jsxRuntimeExports.jsx("div",{role:"dialog","aria-modal":"true","aria-label":i??"Modal",className:E.cx("kakadu-components-3324483532",f&&"kakadu-components-3799971070",m&&"kakadu-components-968755580"),children:s.jsxRuntimeExports.jsxs(A,{value:S,children:[x?s.jsxRuntimeExports.jsx(z,{}):null,s.jsxRuntimeExports.jsx("div",{className:E.cx("kakadu-components-633990035",f&&"kakadu-components-171969824"),children:N})]})})})})})})});return n?P.createPortal(g,n):g}function H(n,r){const[c,i]=e.useState(!1),u=e.useRef(void 0),l=e.useRef(null),o=e.useCallback(async d=>(i(!0),l.current=d??document.activeElement,new Promise(x=>{u.current=x})),[]),f=e.useCallback(d=>{var x;if(i(!1),(x=u.current)==null||x.call(u,d),u.current=void 0,l.current){const a=l.current;a.isConnected&&a.focus(),l.current=null}},[]),p=e.useMemo(()=>s.jsxRuntimeExports.jsx(n,{...r,isVisible:c,onClose:f}),[n,r,c,f]);return e.useMemo(()=>({isVisible:c,show:o,modal:p}),[c,o,p])}exports.default=G;exports.useModal=H;exports.useModalContext=y;
|