@kakadu/components 3.7.0 → 3.7.2
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.js +1 -1
- package/build/components/button.mjs +18 -18
- package/build/components/icon-button.d.ts +1 -1
- package/build/components/icon-button.js +1 -1
- package/build/components/icon-button.mjs +51 -47
- package/build/components/notification.js +1 -1
- package/build/components/notification.mjs +61 -50
- package/build/components/popover-menu.js +1 -1
- package/build/components/popover-menu.mjs +96 -95
- package/build/components/popover.d.ts +1 -0
- package/build/components/popover.js +1 -1
- package/build/components/popover.mjs +94 -80
- package/build/components/text-button.d.ts +2 -1
- package/build/components/text-button.js +1 -1
- package/build/components/text-button.mjs +32 -31
- package/build/components.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),R=require("react"),u=require("@kuma-ui/core"),$=require("../theme.js"),C=require("../icons/icon.js"),F=require("./spinner.js"),O=require("./moving-gradients.js"),P=require("./moving-stars.js"),H=require("./theme-setter.js"),J=require("./click-ripples.js"),E=require("./hover-gradient.js"),K=require("./button-tooltip.js"),Q=require("./aria-text.js"),U=require("./atom.js"),X=require("./skeleton.js");function f({isLoading:s,size:n,className:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),R=require("react"),u=require("@kuma-ui/core"),$=require("../theme.js"),C=require("../icons/icon.js"),F=require("./spinner.js"),O=require("./moving-gradients.js"),P=require("./moving-stars.js"),H=require("./theme-setter.js"),J=require("./click-ripples.js"),E=require("./hover-gradient.js"),K=require("./button-tooltip.js"),Q=require("./aria-text.js"),U=require("./atom.js"),X=require("./skeleton.js");function f({isLoading:s,size:n,className:a}){return e.jsxRuntimeExports.jsx("div",{className:u.cx("kakadu-components-2832510379",s&&"kakadu-components-4114685569",a),children:e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-920467642",children:e.jsxRuntimeExports.jsx(F.RevealSpinner,{isVisible:s,size:n})})})}var v=(s=>(s.primary="primary",s.secondary="secondary",s.warning="warning",s.danger="danger",s))(v||{});function b({icon:s,variant:n="primary",className:a,...c}){return e.jsxRuntimeExports.jsx("div",{...c,className:u.cx("kakadu-components-2658660333",n==="secondary"&&"kakadu-components-3469662110",a),children:typeof s=="string"?e.jsxRuntimeExports.jsx(C.default,{width:14,height:14,type:s}):s})}const S="kakadu-components-2244098950",Y="kakadu-components-3923184173",g="kakadu-components-317965671",q="kakadu-components-1978976872";function Z({type:s,variant:n="primary",href:a,target:c,rel:h,disabled:_,className:N,children:t,label:w,tooltip:i,tooltipPosition:B,iconLeft:m,iconRight:x,isLoading:l,isSkeleton:r,isSkeletonAnimated:M=!0,hasMovingGradients:D=!1,movingGradientsCount:p=4,hasMovingStars:I=!1,movingStarsCount:k=10,...T}){const j=R.useId(),y=R.useRef(null),G=H.useIsDarkMode(y),z=s??"button",A=D&&p>0,W=I&&k>0,o=a&&!r,d=!!_||!!l||!!r;return e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3559664923",children:[e.jsxRuntimeExports.jsxs(U.default,{...T,as:o?"a":"button",type:o?void 0:z,href:o?a:void 0,target:o?c:void 0,rel:o?h:void 0,"aria-describedby":i?j:void 0,disabled:o?void 0:d,inert:o?d:void 0,className:u.cx($.effectStyles,"kakadu-components-3709284365",!!m&&"kakadu-components-2735110382",!t&&"kakadu-components-3621693630",n==="secondary"&&S,n==="warning"&&g,n==="danger"&&q,r&&"kakadu-components-2662775151",N),children:[m?e.jsxRuntimeExports.jsx(b,{variant:n,icon:m,className:t?"kakadu-components-136489413":void 0}):null,t?e.jsxRuntimeExports.jsx("div",{ref:y,className:"kakadu-components-207477259",children:t}):e.jsxRuntimeExports.jsx(Q.default,{children:w}),x?e.jsxRuntimeExports.jsx(b,{variant:n,icon:x,className:t?"kakadu-components-3631501803":void 0}):null,e.jsxRuntimeExports.jsx(f,{isLoading:l}),A&&e.jsxRuntimeExports.jsx(O.default,{opacity:G?.4:.3,maximumGradientsCount:p,className:u.cx("kakadu-components-2055737617",n==="secondary"&&"kakadu-components-2972748387")}),W&&e.jsxRuntimeExports.jsx(P.default,{maximumStarsCount:k,className:"kakadu-components-1226008615"}),d?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(J.default,{size:t?void 0:50}),e.jsxRuntimeExports.jsx(E.default,{size:t?void 0:50,className:n==="secondary"?E.normalBlendStyles:void 0})]}),i?e.jsxRuntimeExports.jsx(K.default,{id:j,label:i,position:B}):null]}),r?e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-3422055155",children:e.jsxRuntimeExports.jsx(X.SkeletonInstance,{width:"100%",height:"100%",isAnimated:M})}):null]})}exports.ButtonLoader=f;exports.ButtonVariant=v;exports.buttonDangerStyles=q;exports.buttonSecondaryStyles=S;exports.buttonSuccessStyles=Y;exports.buttonWarningStyles=g;exports.default=Z;
|
|
@@ -16,24 +16,24 @@ import { SkeletonInstance as U } from "./skeleton.mjs";
|
|
|
16
16
|
function X({
|
|
17
17
|
isLoading: s,
|
|
18
18
|
size: n,
|
|
19
|
-
className:
|
|
19
|
+
className: t
|
|
20
20
|
}) {
|
|
21
|
-
return /* @__PURE__ */ o.jsx("div", { className: m("kakadu-components-2832510379", s && "kakadu-components-4114685569",
|
|
21
|
+
return /* @__PURE__ */ o.jsx("div", { className: m("kakadu-components-2832510379", s && "kakadu-components-4114685569", t), children: /* @__PURE__ */ o.jsx("div", { className: "kakadu-components-920467642", children: /* @__PURE__ */ o.jsx(E, { isVisible: s, size: n }) }) });
|
|
22
22
|
}
|
|
23
23
|
var Y = /* @__PURE__ */ ((s) => (s.primary = "primary", s.secondary = "secondary", s.warning = "warning", s.danger = "danger", s))(Y || {});
|
|
24
24
|
function j({
|
|
25
25
|
icon: s,
|
|
26
26
|
variant: n = "primary",
|
|
27
|
-
className:
|
|
27
|
+
className: t,
|
|
28
28
|
...d
|
|
29
29
|
}) {
|
|
30
|
-
return /* @__PURE__ */ o.jsx("div", { ...d, className: m("kakadu-components-2658660333", n === "secondary" && "kakadu-components-3469662110",
|
|
30
|
+
return /* @__PURE__ */ o.jsx("div", { ...d, className: m("kakadu-components-2658660333", n === "secondary" && "kakadu-components-3469662110", t), children: typeof s == "string" ? /* @__PURE__ */ o.jsx(C, { width: 14, height: 14, type: s }) : s });
|
|
31
31
|
}
|
|
32
32
|
const Z = "kakadu-components-2244098950", ko = "kakadu-components-3923184173", _ = "kakadu-components-317965671", $ = "kakadu-components-1978976872";
|
|
33
33
|
function xo({
|
|
34
34
|
type: s,
|
|
35
35
|
variant: n = "primary",
|
|
36
|
-
href:
|
|
36
|
+
href: t,
|
|
37
37
|
target: d,
|
|
38
38
|
rel: v,
|
|
39
39
|
disabled: b,
|
|
@@ -43,30 +43,30 @@ function xo({
|
|
|
43
43
|
tooltip: c,
|
|
44
44
|
tooltipPosition: h,
|
|
45
45
|
iconLeft: i,
|
|
46
|
-
iconRight:
|
|
47
|
-
isLoading:
|
|
46
|
+
iconRight: p,
|
|
47
|
+
isLoading: l,
|
|
48
48
|
isSkeleton: r,
|
|
49
49
|
isSkeletonAnimated: S = !0,
|
|
50
50
|
hasMovingGradients: w = !1,
|
|
51
|
-
movingGradientsCount:
|
|
51
|
+
movingGradientsCount: k = 4,
|
|
52
52
|
hasMovingStars: B = !1,
|
|
53
|
-
movingStarsCount:
|
|
53
|
+
movingStarsCount: x = 10,
|
|
54
54
|
...I
|
|
55
55
|
}) {
|
|
56
|
-
const
|
|
56
|
+
const f = R(), y = T(null), M = W(y), A = s ?? "button", D = w && k > 0, G = B && x > 0, a = t && !r, u = !!b || !!l || !!r;
|
|
57
57
|
return /* @__PURE__ */ o.jsxs("div", { className: "kakadu-components-3559664923", children: [
|
|
58
|
-
/* @__PURE__ */ o.jsxs(Q, { ...I, as:
|
|
58
|
+
/* @__PURE__ */ o.jsxs(Q, { ...I, as: a ? "a" : "button", type: a ? void 0 : A, href: a ? t : void 0, target: a ? d : void 0, rel: a ? v : void 0, "aria-describedby": c ? f : void 0, disabled: a ? void 0 : u, inert: a ? u : void 0, className: m(z, "kakadu-components-3709284365", !!i && "kakadu-components-2735110382", !e && "kakadu-components-3621693630", n === "secondary" && Z, n === "warning" && _, n === "danger" && $, r && "kakadu-components-2662775151", g), children: [
|
|
59
59
|
i ? /* @__PURE__ */ o.jsx(j, { variant: n, icon: i, className: e ? "kakadu-components-136489413" : void 0 }) : null,
|
|
60
|
-
e ? /* @__PURE__ */ o.jsx("div", { ref:
|
|
61
|
-
|
|
62
|
-
/* @__PURE__ */ o.jsx(X, { isLoading:
|
|
63
|
-
D && /* @__PURE__ */ o.jsx(F, { opacity: M ? 0.4 : 0.3, maximumGradientsCount:
|
|
64
|
-
G && /* @__PURE__ */ o.jsx(H, { maximumStarsCount:
|
|
65
|
-
|
|
60
|
+
e ? /* @__PURE__ */ o.jsx("div", { ref: y, className: "kakadu-components-207477259", children: e }) : /* @__PURE__ */ o.jsx(P, { children: N }),
|
|
61
|
+
p ? /* @__PURE__ */ o.jsx(j, { variant: n, icon: p, className: e ? "kakadu-components-3631501803" : void 0 }) : null,
|
|
62
|
+
/* @__PURE__ */ o.jsx(X, { isLoading: l }),
|
|
63
|
+
D && /* @__PURE__ */ o.jsx(F, { opacity: M ? 0.4 : 0.3, maximumGradientsCount: k, className: m("kakadu-components-2055737617", n === "secondary" && "kakadu-components-2972748387") }),
|
|
64
|
+
G && /* @__PURE__ */ o.jsx(H, { maximumStarsCount: x, className: "kakadu-components-1226008615" }),
|
|
65
|
+
u ? null : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
66
66
|
/* @__PURE__ */ o.jsx(q, { size: e ? void 0 : 50 }),
|
|
67
67
|
/* @__PURE__ */ o.jsx(J, { size: e ? void 0 : 50, className: n === "secondary" ? K : void 0 })
|
|
68
68
|
] }),
|
|
69
|
-
c ? /* @__PURE__ */ o.jsx(O, { id:
|
|
69
|
+
c ? /* @__PURE__ */ o.jsx(O, { id: f, label: c, position: h }) : null
|
|
70
70
|
] }),
|
|
71
71
|
r ? /* @__PURE__ */ o.jsx("div", { className: "kakadu-components-3422055155", children: /* @__PURE__ */ o.jsx(U, { width: "100%", height: "100%", isAnimated: S }) }) : null
|
|
72
72
|
] });
|
|
@@ -16,4 +16,4 @@ export type IconButtonProperties = HTMLProps<HTMLButtonElement> & {
|
|
|
16
16
|
readonly isSkeleton?: boolean;
|
|
17
17
|
readonly isSkeletonAnimated?: boolean;
|
|
18
18
|
};
|
|
19
|
-
export default function IconButton({ icon, variant, label, tooltipPosition, disabled, isLoading, isSkeleton, isSkeletonAnimated, className, ...properties }: IconButtonProperties): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export default function IconButton({ icon, variant, label, tooltipPosition, href, target, rel, disabled, isLoading, isSkeleton, isSkeletonAnimated, className, ...properties }: IconButtonProperties): import("react/jsx-runtime").JSX.Element;
|
|
@@ -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"),
|
|
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"),o=require("@kuma-ui/core"),d=require("../icons/icon.js"),g=require("../theme.js"),D=require("./theme-setter.js"),r=require("./button.js"),M=require("./button-tooltip.js"),z=require("./click-ripples.js"),b=require("./hover-gradient.js"),A=require("./skeleton.js"),C=require("./atom.js");var y=(e=>(e.default="default",e.success="success",e.warning="warning",e.danger="danger",e))(y||{});function P({icon:e,variant:u="default",label:p,tooltipPosition:E,href:f,target:q,rel:w,disabled:_,isLoading:k,isSkeleton:c,isSkeletonAnimated:v=!0,className:N,...I}){const j=s.useId(),T=D.useIsDarkMode(),n=f&&!c,[a,B]=s.useState(e),[h,m]=s.useState(!1),R=s.useRef(e),i=s.useRef(null);s.useEffect(()=>{R.current=e},[e]);const l=s.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null)},[]);s.useEffect(()=>{if(a===e){m(S=>S&&!1);return}m(!0),l(),i.current=setTimeout(()=>{m(!1),B(R.current)},370)},[a,e,l]),s.useEffect(()=>()=>{l()},[l]);const x=!!_||!!k||!!c;return t.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-4096632152",children:[t.jsxRuntimeExports.jsxs(C.default,{...I,as:n?"a":"button",type:n?void 0:"button",href:n?f:void 0,target:n?q:void 0,rel:n?w:void 0,"aria-label":p,"aria-describedby":j,disabled:n?void 0:x,inert:n?x:void 0,className:o.cx(g.buttonResetStyles,g.effectStyles,"kakadu-components-2957737620",u==="default"&&o.cx(r.buttonSecondaryStyles,"kakadu-components-1561784812"),u==="success"&&o.cx(r.buttonSuccessStyles,"kakadu-components-1398421429"),u==="warning"&&o.cx(r.buttonWarningStyles,"kakadu-components-1872098090"),u==="danger"&&o.cx(r.buttonDangerStyles,"kakadu-components-2064536093"),c&&"kakadu-components-2662775151",N),children:[t.jsxRuntimeExports.jsxs("span",{"data-theme":u==="default"?T?"dark":"light":"dark",className:"kakadu-components-3040141419",children:[t.jsxRuntimeExports.jsx(d.default,{width:16,height:16,type:a,className:o.cx(d.iconShadowStyles,"kakadu-components-1562914001",h&&"kakadu-components-2360250719")}),a===e?null:t.jsxRuntimeExports.jsx(d.default,{width:16,height:16,type:e,className:o.cx(d.iconShadowStyles,"kakadu-components-1224061930",h&&"kakadu-components-2519520784")})]}),t.jsxRuntimeExports.jsx(r.ButtonLoader,{isLoading:k,size:14}),t.jsxRuntimeExports.jsx(M.default,{id:j,label:p,position:E}),x?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(z.default,{size:50}),t.jsxRuntimeExports.jsx(b.default,{size:50,className:u==="default"?b.normalBlendStyles:void 0})]})]}),c?t.jsxRuntimeExports.jsx("div",{className:"kakadu-components-3422055155",children:t.jsxRuntimeExports.jsx(A.SkeletonInstance,{width:"100%",height:"100%",isAnimated:v})}):null]})}exports.IconButtonVariant=y;exports.default=P;
|
|
@@ -1,63 +1,67 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { useId as
|
|
3
|
-
import { cx as
|
|
4
|
-
import
|
|
5
|
-
import { buttonResetStyles as
|
|
6
|
-
import { useIsDarkMode as
|
|
7
|
-
import { ButtonLoader as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { SkeletonInstance as
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { j as t } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import { useId as A, useState as j, useRef as y, useEffect as l, useCallback as C } from "react";
|
|
3
|
+
import { cx as o } from "@kuma-ui/core";
|
|
4
|
+
import b, { iconShadowStyles as S } from "../icons/icon.mjs";
|
|
5
|
+
import { buttonResetStyles as E, effectStyles as M } from "../theme.mjs";
|
|
6
|
+
import { useIsDarkMode as F } from "./theme-setter.mjs";
|
|
7
|
+
import { ButtonLoader as G, buttonSecondaryStyles as H, buttonSuccessStyles as P, buttonWarningStyles as W, buttonDangerStyles as q } from "./button.mjs";
|
|
8
|
+
import J from "./button-tooltip.mjs";
|
|
9
|
+
import K from "./click-ripples.mjs";
|
|
10
|
+
import L, { normalBlendStyles as O } from "./hover-gradient.mjs";
|
|
11
|
+
import { SkeletonInstance as Q } from "./skeleton.mjs";
|
|
12
|
+
import U from "./atom.mjs";
|
|
13
|
+
var X = /* @__PURE__ */ ((e) => (e.default = "default", e.success = "success", e.warning = "warning", e.danger = "danger", e))(X || {});
|
|
14
|
+
function ue({
|
|
14
15
|
icon: e,
|
|
15
|
-
variant:
|
|
16
|
-
label:
|
|
17
|
-
tooltipPosition:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
variant: n = "default",
|
|
17
|
+
label: m,
|
|
18
|
+
tooltipPosition: w,
|
|
19
|
+
href: p,
|
|
20
|
+
target: v,
|
|
21
|
+
rel: N,
|
|
22
|
+
disabled: R,
|
|
23
|
+
isLoading: f,
|
|
24
|
+
isSkeleton: r,
|
|
25
|
+
isSkeletonAnimated: I = !0,
|
|
26
|
+
className: B,
|
|
27
|
+
...D
|
|
24
28
|
}) {
|
|
25
|
-
const
|
|
29
|
+
const k = A(), T = F(), s = p && !r, [a, z] = j(e), [h, d] = j(!1), x = y(e), u = y(null);
|
|
26
30
|
l(() => {
|
|
27
|
-
|
|
31
|
+
x.current = e;
|
|
28
32
|
}, [e]);
|
|
29
|
-
const
|
|
30
|
-
|
|
33
|
+
const c = C(() => {
|
|
34
|
+
u.current && (clearTimeout(u.current), u.current = null);
|
|
31
35
|
}, []);
|
|
32
36
|
l(() => {
|
|
33
|
-
if (
|
|
34
|
-
|
|
37
|
+
if (a === e) {
|
|
38
|
+
d((g) => g && !1);
|
|
35
39
|
return;
|
|
36
40
|
}
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
d(!0), c(), u.current = setTimeout(() => {
|
|
42
|
+
d(!1), z(x.current);
|
|
39
43
|
}, 370);
|
|
40
|
-
}, [
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
const
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
44
|
+
}, [a, e, c]), l(() => () => {
|
|
45
|
+
c();
|
|
46
|
+
}, [c]);
|
|
47
|
+
const i = !!R || !!f || !!r;
|
|
48
|
+
return /* @__PURE__ */ t.jsxs("div", { className: "kakadu-components-4096632152", children: [
|
|
49
|
+
/* @__PURE__ */ t.jsxs(U, { ...D, as: s ? "a" : "button", type: s ? void 0 : "button", href: s ? p : void 0, target: s ? v : void 0, rel: s ? N : void 0, "aria-label": m, "aria-describedby": k, disabled: s ? void 0 : i, inert: s ? i : void 0, className: o(E, M, "kakadu-components-2957737620", n === "default" && o(H, "kakadu-components-1561784812"), n === "success" && o(P, "kakadu-components-1398421429"), n === "warning" && o(W, "kakadu-components-1872098090"), n === "danger" && o(q, "kakadu-components-2064536093"), r && "kakadu-components-2662775151", B), children: [
|
|
50
|
+
/* @__PURE__ */ t.jsxs("span", { "data-theme": n === "default" ? T ? "dark" : "light" : "dark", className: "kakadu-components-3040141419", children: [
|
|
51
|
+
/* @__PURE__ */ t.jsx(b, { width: 16, height: 16, type: a, className: o(S, "kakadu-components-1562914001", h && "kakadu-components-2360250719") }),
|
|
52
|
+
a === e ? null : /* @__PURE__ */ t.jsx(b, { width: 16, height: 16, type: e, className: o(S, "kakadu-components-1224061930", h && "kakadu-components-2519520784") })
|
|
49
53
|
] }),
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ t.jsx(G, { isLoading: f, size: 14 }),
|
|
55
|
+
/* @__PURE__ */ t.jsx(J, { id: k, label: m, position: w }),
|
|
56
|
+
i ? null : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
57
|
+
/* @__PURE__ */ t.jsx(K, { size: 50 }),
|
|
58
|
+
/* @__PURE__ */ t.jsx(L, { size: 50, className: n === "default" ? O : void 0 })
|
|
55
59
|
] })
|
|
56
60
|
] }),
|
|
57
|
-
|
|
61
|
+
r ? /* @__PURE__ */ t.jsx("div", { className: "kakadu-components-3422055155", children: /* @__PURE__ */ t.jsx(Q, { width: "100%", height: "100%", isAnimated: I }) }) : null
|
|
58
62
|
] });
|
|
59
63
|
}
|
|
60
64
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
X as IconButtonVariant,
|
|
66
|
+
ue as default
|
|
63
67
|
};
|
|
@@ -1 +1 @@
|
|
|
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 i=require("../jsx-runtime-BB_1_6y_.js"),e=require("react"),p=require("@kuma-ui/core"),M=require("../utilities/generate-random-id.js"),j=require("./notice.js");function E({type:n,icon:d,index:u,className:c,children:m,onDismiss:s,...o}){const[t,a]=e.useState(!1),[l,C]=e.useState(!1),[f,k]=e.useState(!1);e.useEffect(()=>{const r=setTimeout(()=>{a(!0)},250);return()=>{clearTimeout(r)}},[]);const N=e.useRef(0),v=e.useRef(0),R=e.useCallback(()=>{k(!0)},[]),b=e.useCallback(()=>{k(!1)},[]);e.useEffect(()=>{if(f){v.current+=Date.now()-N.current;return}if(t){N.current=Date.now();const r=6e3-v.current,h=setTimeout(()=>{a(!1),C(!0)},r);return()=>{clearTimeout(h)}}},[f,t]);const x=u??0;return e.useEffect(()=>{if(l&&!t){const r=setTimeout(()=>{s==null||s(x)},300);return()=>{clearTimeout(r)}}},[l,t,s,x]),i.jsxRuntimeExports.jsx("div",{...o,style:{"--index":x},className:p.cx("kakadu-components-1727618227",t&&"kakadu-components-3003995416",c),children:i.jsxRuntimeExports.jsxs(j.default,{role:"status","aria-live":"polite","aria-atomic":"true",type:n,icon:d,className:p.cx("kakadu-components-3423716848",t&&"kakadu-components-2837603142"),onMouseEnter:R,onMouseLeave:b,children:[m,i.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2751825161",children:i.jsxRuntimeExports.jsx("div",{className:p.cx("kakadu-components-47664046",f?"kakadu-components-758522476":"kakadu-components-3914681513")})})]})})}const T=e.createContext({createNotification(){throw new Error("useCreateNotification must be used within a NotificationProvider")}});function S(){const{createNotification:n}=e.useContext(T);return n}function q({children:n}){const[d,u]=e.useState([]),c=e.useCallback(o=>{const t=M.default();u(a=>[...a,{...o,id:t}])},[]),m=e.useCallback(o=>{u(t=>t.filter((a,l)=>l!==o))},[]),s=e.useMemo(()=>({createNotification:c}),[c]);return i.jsxRuntimeExports.jsxs(T.Provider,{value:s,children:[n,d.map((o,t)=>i.jsxRuntimeExports.jsx(E,{...o,index:t,onDismiss:m},o.id))]})}exports.NotificationType=j.NoticeType;exports.NotificationProvider=q;exports.default=E;exports.useCreateNotification=S;
|
|
@@ -1,86 +1,97 @@
|
|
|
1
1
|
import { j as i } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { cx as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { NoticeType as
|
|
7
|
-
function
|
|
8
|
-
type:
|
|
9
|
-
icon:
|
|
2
|
+
import { createContext as b, useState as m, useEffect as N, useRef as j, useCallback as d, useContext as y, useMemo as P } from "react";
|
|
3
|
+
import { cx as x } from "@kuma-ui/core";
|
|
4
|
+
import R from "../utilities/generate-random-id.mjs";
|
|
5
|
+
import D from "./notice.mjs";
|
|
6
|
+
import { NoticeType as G } from "./notice.mjs";
|
|
7
|
+
function H({
|
|
8
|
+
type: n,
|
|
9
|
+
icon: f,
|
|
10
10
|
index: r,
|
|
11
11
|
className: c,
|
|
12
|
-
children:
|
|
12
|
+
children: l,
|
|
13
13
|
onDismiss: o,
|
|
14
14
|
...e
|
|
15
15
|
}) {
|
|
16
|
-
const [t,
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
16
|
+
const [t, s] = m(!1), [u, E] = m(!1), [p, v] = m(!1);
|
|
17
|
+
N(() => {
|
|
18
|
+
const a = setTimeout(() => {
|
|
19
|
+
s(!0);
|
|
20
20
|
}, 250);
|
|
21
21
|
return () => {
|
|
22
|
-
clearTimeout(
|
|
22
|
+
clearTimeout(a);
|
|
23
23
|
};
|
|
24
|
-
}, [])
|
|
24
|
+
}, []);
|
|
25
|
+
const T = j(0), h = j(0), w = d(() => {
|
|
26
|
+
v(!0);
|
|
27
|
+
}, []), I = d(() => {
|
|
28
|
+
v(!1);
|
|
29
|
+
}, []);
|
|
30
|
+
N(() => {
|
|
31
|
+
if (p) {
|
|
32
|
+
h.current += Date.now() - T.current;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
25
35
|
if (t) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
T.current = Date.now();
|
|
37
|
+
const a = 6e3 - h.current, M = setTimeout(() => {
|
|
38
|
+
s(!1), E(!0);
|
|
39
|
+
}, a);
|
|
29
40
|
return () => {
|
|
30
|
-
clearTimeout(
|
|
41
|
+
clearTimeout(M);
|
|
31
42
|
};
|
|
32
43
|
}
|
|
33
|
-
}, [t]);
|
|
34
|
-
const
|
|
35
|
-
return
|
|
44
|
+
}, [p, t]);
|
|
45
|
+
const k = r ?? 0;
|
|
46
|
+
return N(() => {
|
|
36
47
|
if (u && !t) {
|
|
37
|
-
const
|
|
38
|
-
o == null || o(
|
|
48
|
+
const a = setTimeout(() => {
|
|
49
|
+
o == null || o(k);
|
|
39
50
|
}, 300);
|
|
40
51
|
return () => {
|
|
41
|
-
clearTimeout(
|
|
52
|
+
clearTimeout(a);
|
|
42
53
|
};
|
|
43
54
|
}
|
|
44
|
-
}, [u, t, o,
|
|
45
|
-
"--index":
|
|
46
|
-
}, className:
|
|
47
|
-
|
|
48
|
-
/* @__PURE__ */ i.jsx("div", { className: "kakadu-components-2751825161", children: /* @__PURE__ */ i.jsx("div", { className: "kakadu-components-
|
|
55
|
+
}, [u, t, o, k]), /* @__PURE__ */ i.jsx("div", { ...e, style: {
|
|
56
|
+
"--index": k
|
|
57
|
+
}, className: x("kakadu-components-1727618227", t && "kakadu-components-3003995416", c), children: /* @__PURE__ */ i.jsxs(D, { role: "status", "aria-live": "polite", "aria-atomic": "true", type: n, icon: f, className: x("kakadu-components-3423716848", t && "kakadu-components-2837603142"), onMouseEnter: w, onMouseLeave: I, children: [
|
|
58
|
+
l,
|
|
59
|
+
/* @__PURE__ */ i.jsx("div", { className: "kakadu-components-2751825161", children: /* @__PURE__ */ i.jsx("div", { className: x("kakadu-components-47664046", p ? "kakadu-components-758522476" : "kakadu-components-3914681513") }) })
|
|
49
60
|
] }) });
|
|
50
61
|
}
|
|
51
|
-
const
|
|
62
|
+
const C = b({
|
|
52
63
|
createNotification() {
|
|
53
64
|
throw new Error("useCreateNotification must be used within a NotificationProvider");
|
|
54
65
|
}
|
|
55
66
|
});
|
|
56
|
-
function
|
|
67
|
+
function z() {
|
|
57
68
|
const {
|
|
58
|
-
createNotification:
|
|
59
|
-
} =
|
|
60
|
-
return
|
|
69
|
+
createNotification: n
|
|
70
|
+
} = y(C);
|
|
71
|
+
return n;
|
|
61
72
|
}
|
|
62
|
-
function
|
|
63
|
-
children:
|
|
73
|
+
function A({
|
|
74
|
+
children: n
|
|
64
75
|
}) {
|
|
65
|
-
const [
|
|
66
|
-
const t =
|
|
67
|
-
r((
|
|
76
|
+
const [f, r] = m([]), c = d((e) => {
|
|
77
|
+
const t = R();
|
|
78
|
+
r((s) => [...s, {
|
|
68
79
|
...e,
|
|
69
80
|
id: t
|
|
70
81
|
}]);
|
|
71
|
-
}, []),
|
|
72
|
-
r((t) => t.filter((
|
|
73
|
-
}, []), o =
|
|
82
|
+
}, []), l = d((e) => {
|
|
83
|
+
r((t) => t.filter((s, u) => u !== e));
|
|
84
|
+
}, []), o = P(() => ({
|
|
74
85
|
createNotification: c
|
|
75
86
|
}), [c]);
|
|
76
|
-
return /* @__PURE__ */ i.jsxs(
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
return /* @__PURE__ */ i.jsxs(C.Provider, { value: o, children: [
|
|
88
|
+
n,
|
|
89
|
+
f.map((e, t) => /* @__PURE__ */ i.jsx(H, { ...e, index: t, onDismiss: l }, e.id))
|
|
79
90
|
] });
|
|
80
91
|
}
|
|
81
92
|
export {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
A as NotificationProvider,
|
|
94
|
+
G as NotificationType,
|
|
95
|
+
H as default,
|
|
96
|
+
z as useCreateNotification
|
|
86
97
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../jsx-runtime-BB_1_6y_.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../jsx-runtime-BB_1_6y_.js"),I=require("@kuma-ui/core"),a=require("react"),N=require("../theme.js"),b=require("../icons/icon.js"),j=require("./popover.js"),S=require("./atom.js"),w=require("./text.js"),y=require("./hover-gradient.js"),_=require("./click-ripples.js"),C=require("./separator.js"),K=require("./decorators.js"),k=new Set;function M(){const[e,n]=a.useState(!1),u=a.useCallback(s=>{n(s);for(const o of k)o(s)},[]);return a.useEffect(()=>{const s=o=>{n(o)};return k.add(s),()=>{k.delete(s)}},[]),a.useMemo(()=>({isKeyboardNavigating:e,setIsKeyboardNavigating:u}),[e,u])}function F({label:e,iconLeft:n,iconRight:u,href:s,shouldCloseOnClick:o=!0,decorators:v=[],submenu:m,className:i,onClick:r,...f}){const{isVisible:p,isPreparingFocus:l,isFocused:c,close:x}=j.usePopoverContext(),{isKeyboardNavigating:d}=M(),E=a.useRef(!0),R=a.useCallback(()=>{E.current=c},[c]),g=a.useCallback(q=>{!d&&!E.current||c&&(r==null||r(q),m?m.show():o&&(x==null||x()))},[d,c,r,m,o,x]),h=a.useMemo(()=>t.jsxRuntimeExports.jsxs(S.default,{as:s?"a":"button",...f,type:s?void 0:"button",role:"menuitem",href:s,inert:!p&&!l,disabled:s?void 0:!p&&!l,className:I.cx(N.buttonResetStyles,"kakadu-components-4075327442",c&&"kakadu-components-3160069815",d?"kakadu-components-2043829669":c&&"kakadu-components-2862719809",i),onClick:g,onPointerDownCapture:R,children:[t.jsxRuntimeExports.jsxs(w.Span,{className:"kakadu-components-1109353535",children:[n?t.jsxRuntimeExports.jsx(b.default,{width:12,height:12,type:n}):null,t.jsxRuntimeExports.jsx("span",{className:"kakadu-components-913703148",children:e}),u?t.jsxRuntimeExports.jsx(b.default,{width:12,height:12,type:u}):null]}),d?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(_.default,{isActive:c,size:100}),t.jsxRuntimeExports.jsx(y.default,{isActive:c,size:150,className:y.normalBlendStyles})]})]}),[s,f,p,l,d,i,g,R,n,e,u,c]);return t.jsxRuntimeExports.jsx(K.default,{decorators:v,children:m?t.jsxRuntimeExports.jsx(P,{menu:m.popoverMenu,className:"kakadu-components-1861176543",children:h}):h})}function A(e){if("type"in e){if(e.type==="separator")return t.jsxRuntimeExports.jsx(C.default,{});if(e.type==="group")return t.jsxRuntimeExports.jsx(w.Span,{className:"kakadu-components-1499037363",children:e.label})}return t.jsxRuntimeExports.jsx(F,{...e})}function D({items:e}){const{isFocused:n}=j.usePopoverContext(),[u,s]=a.useState([]),{setIsKeyboardNavigating:o}=M(),v=a.useCallback(i=>{i&&s(r=>r.includes(i)?r:[...r,i])},[]),m=a.useCallback(i=>{n&&(i.currentTarget.focus(),o(!1))},[n,o]);return a.useEffect(()=>{if(!n)return;const i=r=>{const f=u.filter(d=>d.isConnected),p=f.length;if(p===0)return;let l;const c=document.activeElement;let x=c?f.indexOf(c):-1;switch(x===-1&&(x=0),r.key){case"ArrowDown":{l=(x+1)%p;break}case"ArrowUp":{l=(x-1+p)%p;break}case"Home":{l=0;break}case"End":{l=p-1;break}case"Tab":{o(!0);return}}if(l!==void 0){r.preventDefault(),r.stopPropagation();const d=f[l];d&&(d.focus(),o(!0))}};return window.addEventListener("keydown",i,{capture:!0}),()=>{window.removeEventListener("keydown",i,{capture:!0})}},[n,u,o]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:e.map((i,r)=>t.jsxRuntimeExports.jsx(A,{...i,reference:v,onMouseEnter:m},r))})}function T({items:e,...n}){return t.jsxRuntimeExports.jsx(j.default,{...n,as:"nav",role:"menu",innerClassName:"kakadu-components-3600436535",children:t.jsxRuntimeExports.jsx(D,{items:e})})}function z(e){const n=a.useMemo(()=>({items:e}),[e]),{show:u,close:s,popover:o}=j.usePopover(T,n);return a.useMemo(()=>({show:u,close:s,popoverMenu:o}),[u,s,o])}function P({menu:e,className:n,children:u}){return t.jsxRuntimeExports.jsxs(j.PopoverContainer,{className:n,children:[u,e]})}exports.default=P;exports.usePopoverMenu=z;
|