@kakadu/components 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +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"),s=require("react"),n=require("@kuma-ui/core"),a=require("../icons/icon.js"),p=require("../theme.js"),y=require("./theme-setter.js"),l=require("./button.js"),q=require("./aria-text.js"),b=require("./button-tooltip.js"),E=require("./click-ripples.js"),k=require("./hover-gradient.js");var S=(e=>(e.default="default",e.success="success",e.warning="warning",e.danger="danger",e))(S||{});function w({icon:e,variant:u="default",label:d,className:h,...j}){const g=y.useIsDarkMode(),[o,R]=s.useState(e),[m,i]=s.useState(!1),x=s.useRef(e),c=s.useRef(null);s.useEffect(()=>{x.current=e},[e]);const r=s.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]);return s.useEffect(()=>{if(o===e){i(f=>f&&!1);return}i(!0),r(),c.current=setTimeout(()=>{i(!1),R(x.current)},370)},[o,e,r]),s.useEffect(()=>()=>{r()},[r]),t.jsxRuntimeExports.jsxs("button",{...j,type:"button",className:n.cx(p.buttonResetStyles,p.effectStyles,"kakadu-components-3057735296",u==="default"&&n.cx(l.buttonSecondaryStyles,"kakadu-components-2089159949"),u==="success"&&n.cx(l.buttonSuccessStyles,"kakadu-components-1463468148"),u==="warning"&&n.cx(l.buttonWarningStyles,"kakadu-components-2686186037"),u==="danger"&&n.cx(l.buttonDangerStyles,"kakadu-components-2463905722"),h),children:[t.jsxRuntimeExports.jsxs("span",{"data-theme":u==="default"?g?"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",m&&"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",m&&"kakadu-components-1406924214")})]}),t.jsxRuntimeExports.jsx(q.default,{children:d}),t.jsxRuntimeExports.jsx(b.default,{label:d}),t.jsxRuntimeExports.jsx(E.default,{size:50}),t.jsxRuntimeExports.jsx(k.default,{size:50,className:u==="default"?k.normalBlendStyles:void 0})]})}exports.IconButtonVariant=S;exports.default=w;
|
|
@@ -1,45 +1,51 @@
|
|
|
1
1
|
import { j as t } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as f, useRef as p, useEffect as c, useCallback as j } 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
|
-
import
|
|
12
|
-
var
|
|
13
|
-
function
|
|
4
|
+
import k, { iconShadowStyles as h } from "../icons/icon.mjs";
|
|
5
|
+
import { buttonResetStyles as w, effectStyles as b } from "../theme.mjs";
|
|
6
|
+
import { useIsDarkMode as R } from "./theme-setter.mjs";
|
|
7
|
+
import { buttonSecondaryStyles as N, buttonSuccessStyles as T, buttonWarningStyles as D, buttonDangerStyles as I } from "./button.mjs";
|
|
8
|
+
import z from "./aria-text.mjs";
|
|
9
|
+
import C from "./button-tooltip.mjs";
|
|
10
|
+
import E from "./click-ripples.mjs";
|
|
11
|
+
import M, { normalBlendStyles as A } from "./hover-gradient.mjs";
|
|
12
|
+
var G = /* @__PURE__ */ ((e) => (e.default = "default", e.success = "success", e.warning = "warning", e.danger = "danger", e))(G || {});
|
|
13
|
+
function U({
|
|
14
14
|
icon: e,
|
|
15
15
|
variant: o = "default",
|
|
16
|
-
label:
|
|
17
|
-
className:
|
|
18
|
-
...
|
|
16
|
+
label: m,
|
|
17
|
+
className: S,
|
|
18
|
+
...g
|
|
19
19
|
}) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
const x = R(), [r, y] = f(e), [l, a] = f(!1), d = p(e), n = p(null);
|
|
21
|
+
c(() => {
|
|
22
|
+
d.current = e;
|
|
23
|
+
}, [e]);
|
|
24
|
+
const u = j(() => {
|
|
25
|
+
n.current && (clearTimeout(n.current), n.current = null);
|
|
26
|
+
}, []);
|
|
27
|
+
return c(() => {
|
|
28
|
+
if (r === e) {
|
|
29
|
+
a((i) => i && !1);
|
|
30
|
+
return;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
a(!0), u(), n.current = setTimeout(() => {
|
|
33
|
+
a(!1), y(d.current);
|
|
34
|
+
}, 370);
|
|
35
|
+
}, [r, e, u]), c(() => () => {
|
|
36
|
+
u();
|
|
37
|
+
}, [u]), /* @__PURE__ */ t.jsxs("button", { ...g, type: "button", className: s(w, b, "kakadu-components-3057735296", o === "default" && s(N, "kakadu-components-2089159949"), o === "success" && s(T, "kakadu-components-1463468148"), o === "warning" && s(D, "kakadu-components-2686186037"), o === "danger" && s(I, "kakadu-components-2463905722"), S), children: [
|
|
38
|
+
/* @__PURE__ */ t.jsxs("span", { "data-theme": o === "default" ? x ? "dark" : "light" : "dark", className: "kakadu-components-2197738751", children: [
|
|
39
|
+
/* @__PURE__ */ t.jsx(k, { width: 16, height: 16, type: r, className: s(h, "kakadu-components-1309118222", l && "kakadu-components-3602476657") }),
|
|
40
|
+
r === e ? null : /* @__PURE__ */ t.jsx(k, { width: 16, height: 16, type: e, className: s(h, "kakadu-components-2883440801", l && "kakadu-components-1406924214") })
|
|
35
41
|
] }),
|
|
36
|
-
/* @__PURE__ */ t.jsx(
|
|
37
|
-
/* @__PURE__ */ t.jsx(
|
|
38
|
-
/* @__PURE__ */ t.jsx(
|
|
39
|
-
/* @__PURE__ */ t.jsx(
|
|
42
|
+
/* @__PURE__ */ t.jsx(z, { children: m }),
|
|
43
|
+
/* @__PURE__ */ t.jsx(C, { label: m }),
|
|
44
|
+
/* @__PURE__ */ t.jsx(E, { size: 50 }),
|
|
45
|
+
/* @__PURE__ */ t.jsx(M, { size: 50, className: o === "default" ? A : void 0 })
|
|
40
46
|
] });
|
|
41
47
|
}
|
|
42
48
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
G as IconButtonVariant,
|
|
50
|
+
U as default
|
|
45
51
|
};
|