@kakadu/components 1.7.10 → 1.7.12
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.d.ts +1 -1
- package/build/components/button.js +1 -1
- package/build/components/button.mjs +39 -36
- package/build/components/card.js +1 -1
- package/build/components/card.mjs +1 -1
- package/build/components/datum.js +1 -1
- package/build/components/datum.mjs +1 -1
- package/build/components/icon-button.d.ts +1 -1
- package/build/components/icon-button.js +1 -1
- package/build/components/icon-button.mjs +28 -25
- package/build/components/input.d.ts +7 -1
- package/build/components/input.js +2 -2
- package/build/components/input.mjs +135 -123
- package/build/components/modal.js +1 -1
- package/build/components/modal.mjs +1 -1
- package/build/components/notice.js +1 -1
- package/build/components/notice.mjs +1 -1
- package/build/components/text-button.d.ts +1 -1
- package/build/components/text-button.js +1 -1
- package/build/components/text-button.mjs +30 -27
- package/build/components.css +1 -1
- package/build/icon-B__SNDvD.js +1 -0
- package/build/{icon-C6X3pQX0.mjs → icon-BscWXhKi.mjs} +53 -31
- package/build/icons/icon.d.ts +1 -0
- package/build/icons/icon.js +1 -1
- package/build/icons/icon.mjs +1 -1
- package/build/icons/select.d.ts +2 -0
- package/build/index.js +1 -1
- package/build/index.mjs +1 -1
- package/package.json +1 -1
- package/build/icon-Dw7yhWuE.js +0 -1
|
@@ -28,5 +28,5 @@ export type ButtonProperties = BaseButtonProperties & ({
|
|
|
28
28
|
children?: never;
|
|
29
29
|
label: string;
|
|
30
30
|
});
|
|
31
|
-
export default function Button({ type, variant, href, target, rel, className, children, label, tooltip, iconLeft, iconRight, isLoading, hasMovingGradients, movingGradientsCount, hasMovingStars, movingStarsCount, ...properties }: ButtonProperties): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export default function Button({ type, variant, href, target, rel, disabled, className, children, label, tooltip, iconLeft, iconRight, isLoading, hasMovingGradients, movingGradientsCount, hasMovingStars, movingStarsCount, ...properties }: ButtonProperties): import("react/jsx-runtime").JSX.Element;
|
|
32
32
|
export {};
|
|
@@ -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"),B=require("react"),a=require("@kuma-ui/core"),D=require("../theme.js"),T=require("../icon-B__SNDvD.js"),G=require("./spinner.js"),I=require("./moving-gradients.js"),z=require("./moving-stars.js"),W=require("./theme-setter.js"),$=require("./click-ripples.js"),k=require("./hover-gradient.js"),F=require("./button-tooltip.js"),O=require("./aria-text.js"),P=require("./atom.js");var y=(s=>(s.primary="primary",s.secondary="secondary",s.warning="warning",s.danger="danger",s))(y||{});function j({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(T.Icon,{width:14,height:14,type:s}):s})}const R="kakadu-components-2244098950",A="kakadu-components-3923184173",S="kakadu-components-317965671",E="kakadu-components-1978976872";function C({type:s,variant:n="primary",href:o,target:r,rel:b,disabled:m,className:f,children:t,label:q,tooltip:i,iconLeft:u,iconRight:p,isLoading:c,hasMovingGradients:g=!1,movingGradientsCount:x=4,hasMovingStars:_=!1,movingStarsCount:l=10,...v}){const d=B.useRef(null),N=W.useIsDarkMode(d),w=s??"button",M=g&&x>0,h=_&&l>0;return e.jsxRuntimeExports.jsxs(P.default,{...v,as:o?"a":"button",type:o?void 0:w,href:o,target:r,rel:b,disabled:!!m||!!c,className:a.cx(D.effectStyles,"kakadu-components-1897763514",!!u&&"kakadu-components-3652831856",!t&&"kakadu-components-2746167644",n==="secondary"&&R,n==="warning"&&S,n==="danger"&&E,f),children:[u?e.jsxRuntimeExports.jsx(j,{variant:n,icon:u,className:t?"kakadu-components-294089230":void 0}):null,t?e.jsxRuntimeExports.jsx("div",{ref:d,className:"kakadu-components-2618257692",children:t}):e.jsxRuntimeExports.jsx(O.default,{children:q}),p?e.jsxRuntimeExports.jsx(j,{variant:n,icon:p,className:t?"kakadu-components-3127707672":void 0}):null,e.jsxRuntimeExports.jsx("div",{className:a.cx("kakadu-components-1029011626",c&&"kakadu-components-726496666"),children:e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-772420116",children:e.jsxRuntimeExports.jsx(G.RevealSpinner,{isVisible:c})})}),M&&e.jsxRuntimeExports.jsx(I.default,{opacity:N?.4:.3,maximumGradientsCount:x,className:a.cx("kakadu-components-1505766785",n==="secondary"&&"kakadu-components-3712045697")}),h&&e.jsxRuntimeExports.jsx(z.default,{maximumStarsCount:l,className:"kakadu-components-2813474662"}),m?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx($.default,{size:t?void 0:50}),e.jsxRuntimeExports.jsx(k.default,{size:t?void 0:50,className:n==="secondary"?k.normalBlendStyles:void 0})]}),i?e.jsxRuntimeExports.jsx(F.default,{label:i}):null]})}exports.ButtonVariant=y;exports.buttonDangerStyles=E;exports.buttonSecondaryStyles=R;exports.buttonSuccessStyles=A;exports.buttonWarningStyles=S;exports.default=C;
|
|
@@ -1,64 +1,67 @@
|
|
|
1
1
|
import { j as o } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import { useRef as
|
|
2
|
+
import { useRef as B } from "react";
|
|
3
3
|
import { cx as t } from "@kuma-ui/core";
|
|
4
4
|
import { effectStyles as I } from "../theme.mjs";
|
|
5
|
-
import { I as D } from "../icon-
|
|
5
|
+
import { I as D } from "../icon-BscWXhKi.mjs";
|
|
6
6
|
import { RevealSpinner as G } from "./spinner.mjs";
|
|
7
7
|
import R from "./moving-gradients.mjs";
|
|
8
8
|
import T from "./moving-stars.mjs";
|
|
9
|
-
import { useIsDarkMode as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
9
|
+
import { useIsDarkMode as h } from "./theme-setter.mjs";
|
|
10
|
+
import z from "./click-ripples.mjs";
|
|
11
|
+
import A, { normalBlendStyles as C } from "./hover-gradient.mjs";
|
|
12
|
+
import E from "./button-tooltip.mjs";
|
|
13
|
+
import F from "./aria-text.mjs";
|
|
14
14
|
import H from "./atom.mjs";
|
|
15
15
|
var W = /* @__PURE__ */ ((s) => (s.primary = "primary", s.secondary = "secondary", s.warning = "warning", s.danger = "danger", s))(W || {});
|
|
16
|
-
function
|
|
16
|
+
function x({
|
|
17
17
|
icon: s,
|
|
18
|
-
variant:
|
|
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",
|
|
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(D, { width: 14, height: 14, type: s }) : s });
|
|
23
23
|
}
|
|
24
|
-
const q = "kakadu-components-2244098950", eo = "kakadu-components-3923184173",
|
|
25
|
-
function
|
|
24
|
+
const q = "kakadu-components-2244098950", eo = "kakadu-components-3923184173", J = "kakadu-components-317965671", K = "kakadu-components-1978976872";
|
|
25
|
+
function ao({
|
|
26
26
|
type: s,
|
|
27
|
-
variant:
|
|
27
|
+
variant: n = "primary",
|
|
28
28
|
href: a,
|
|
29
29
|
target: m,
|
|
30
|
-
rel:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
rel: y,
|
|
31
|
+
disabled: p,
|
|
32
|
+
className: f,
|
|
33
|
+
children: e,
|
|
34
|
+
label: j,
|
|
35
|
+
tooltip: d,
|
|
35
36
|
iconLeft: r,
|
|
36
|
-
iconRight:
|
|
37
|
+
iconRight: u,
|
|
37
38
|
isLoading: c,
|
|
38
|
-
hasMovingGradients:
|
|
39
|
-
movingGradientsCount:
|
|
40
|
-
hasMovingStars:
|
|
39
|
+
hasMovingGradients: S = !1,
|
|
40
|
+
movingGradientsCount: l = 4,
|
|
41
|
+
hasMovingStars: g = !1,
|
|
41
42
|
movingStarsCount: i = 10,
|
|
42
|
-
...
|
|
43
|
+
...N
|
|
43
44
|
}) {
|
|
44
|
-
const k =
|
|
45
|
-
return /* @__PURE__ */ o.jsxs(H, { ...
|
|
46
|
-
r ? /* @__PURE__ */ o.jsx(
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const k = B(null), b = h(k), v = s ?? "button", w = S && l > 0, M = g && i > 0;
|
|
46
|
+
return /* @__PURE__ */ o.jsxs(H, { ...N, as: a ? "a" : "button", type: a ? void 0 : v, href: a, target: m, rel: y, disabled: !!p || !!c, className: t(I, "kakadu-components-1897763514", !!r && "kakadu-components-3652831856", !e && "kakadu-components-2746167644", n === "secondary" && q, n === "warning" && J, n === "danger" && K, f), children: [
|
|
47
|
+
r ? /* @__PURE__ */ o.jsx(x, { variant: n, icon: r, className: e ? "kakadu-components-294089230" : void 0 }) : null,
|
|
48
|
+
e ? /* @__PURE__ */ o.jsx("div", { ref: k, className: "kakadu-components-2618257692", children: e }) : /* @__PURE__ */ o.jsx(F, { children: j }),
|
|
49
|
+
u ? /* @__PURE__ */ o.jsx(x, { variant: n, icon: u, className: e ? "kakadu-components-3127707672" : void 0 }) : null,
|
|
49
50
|
/* @__PURE__ */ o.jsx("div", { className: t("kakadu-components-1029011626", c && "kakadu-components-726496666"), children: /* @__PURE__ */ o.jsx("div", { className: "kakadu-components-772420116", children: /* @__PURE__ */ o.jsx(G, { isVisible: c }) }) }),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/* @__PURE__ */ o.
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
w && /* @__PURE__ */ o.jsx(R, { opacity: b ? 0.4 : 0.3, maximumGradientsCount: l, className: t("kakadu-components-1505766785", n === "secondary" && "kakadu-components-3712045697") }),
|
|
52
|
+
M && /* @__PURE__ */ o.jsx(T, { maximumStarsCount: i, className: "kakadu-components-2813474662" }),
|
|
53
|
+
p ? null : /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
54
|
+
/* @__PURE__ */ o.jsx(z, { size: e ? void 0 : 50 }),
|
|
55
|
+
/* @__PURE__ */ o.jsx(A, { size: e ? void 0 : 50, className: n === "secondary" ? C : void 0 })
|
|
56
|
+
] }),
|
|
57
|
+
d ? /* @__PURE__ */ o.jsx(E, { label: d }) : null
|
|
55
58
|
] });
|
|
56
59
|
}
|
|
57
60
|
export {
|
|
58
61
|
W as ButtonVariant,
|
|
59
|
-
|
|
62
|
+
K as buttonDangerStyles,
|
|
60
63
|
q as buttonSecondaryStyles,
|
|
61
64
|
eo as buttonSuccessStyles,
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
J as buttonWarningStyles,
|
|
66
|
+
ao as default
|
|
64
67
|
};
|
package/build/components/card.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),a=require("@kuma-ui/core"),j=require("../theme.js"),r=require("../icon-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),a=require("@kuma-ui/core"),j=require("../theme.js"),r=require("../icon-B__SNDvD.js"),t=require("./flex.js"),n=require("./text.js"),k=require("./click-ripples.js"),c=require("./hover-gradient.js"),h=require("./button.js"),R=require("./atom.js");function f({icon:o,title:i,description:u,action:l,href:s,target:m,rel:x,className:d,...p}){return e.jsxRuntimeExports.jsxs(R.default,{...p,as:s?"a":"button",type:s?void 0:"button",href:s,target:m,rel:x,className:a.cx(j.effectStyles,h.buttonSecondaryStyles,"kakadu-components-1387630570",d),children:[e.jsxRuntimeExports.jsxs(t.default,{gap:.5,direction:"column",children:[e.jsxRuntimeExports.jsx(n.Span,{className:"kakadu-components-1301774894",children:e.jsxRuntimeExports.jsxs(t.default,{gap:.5,direction:"row",alignment:t.FlexAlignment.start,children:[o?e.jsxRuntimeExports.jsx(r.Icon,{width:16,height:16,type:o,className:a.cx(r.iconShadowStyles,"kakadu-components-782417605")}):null,i]})}),e.jsxRuntimeExports.jsx(n.Paragraph,{className:"kakadu-components-3061837309",children:u}),e.jsxRuntimeExports.jsx(t.default,{alignment:t.FlexAlignment.end,children:e.jsxRuntimeExports.jsx(n.Span,{className:"kakadu-components-777975485",children:l})})]}),e.jsxRuntimeExports.jsx(k.default,{size:250,className:"kakadu-components-2967167444"}),e.jsxRuntimeExports.jsx(c.default,{size:300,className:c.normalBlendStyles})]})}exports.default=f;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { j as o } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
2
|
import { cx as t } from "@kuma-ui/core";
|
|
3
3
|
import { effectStyles as u } from "../theme.mjs";
|
|
4
|
-
import { I as k, i as f } from "../icon-
|
|
4
|
+
import { I as k, i as f } from "../icon-BscWXhKi.mjs";
|
|
5
5
|
import a, { FlexAlignment as n } from "./flex.mjs";
|
|
6
6
|
import { Span as m, Paragraph as j } from "./text.mjs";
|
|
7
7
|
import h from "./click-ripples.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),o=require("react"),u=require("../icon-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),o=require("react"),u=require("../icon-B__SNDvD.js"),t=require("./flex.js"),c=require("./text.js"),r=require("./icon-button.js");function x({title:a,value:l,hasCopyButton:p}){const n=o.useRef(null),[s,i]=o.useState(!1),m=o.useCallback(()=>{i(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{i(!1)},2e3)},[]);return e.jsxRuntimeExports.jsxs(t.default,{direction:"row",gap:1.5,alignment:t.FlexAlignment.start,children:[e.jsxRuntimeExports.jsxs(t.default,{fill:!0,gap:.375,alignment:t.FlexAlignment.start,children:[e.jsxRuntimeExports.jsx(c.Span,{className:"kakadu-components-3772513716",children:a}),e.jsxRuntimeExports.jsx(c.Span,{className:"kakadu-components-2497879239",children:l})]}),p?e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(r.default,{icon:s?u.IconType.check:u.IconType.copy,label:s?"Kopiert!":"Kopier",variant:s?r.IconButtonVariant.success:r.IconButtonVariant.default,onClick:m})}):null]})}exports.default=x;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as e } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
2
|
import { useRef as f, useState as d, useCallback as x } from "react";
|
|
3
|
-
import { a as r } from "../icon-
|
|
3
|
+
import { a as r } from "../icon-BscWXhKi.mjs";
|
|
4
4
|
import s, { FlexAlignment as a } from "./flex.mjs";
|
|
5
5
|
import { Span as i } from "./text.mjs";
|
|
6
6
|
import j, { IconButtonVariant as c } from "./icon-button.mjs";
|
|
@@ -11,4 +11,4 @@ export type IconButtonProperties = HTMLProps<HTMLButtonElement> & {
|
|
|
11
11
|
readonly variant?: IconButtonVariant;
|
|
12
12
|
readonly label: string;
|
|
13
13
|
};
|
|
14
|
-
export default function IconButton({ icon, variant, label, className, ...properties }: IconButtonProperties): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default function IconButton({ icon, variant, label, disabled, 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"),n=require("@kuma-ui/core"),a=require("../icon-
|
|
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("../icon-B__SNDvD.js"),k=require("../theme.js"),E=require("./theme-setter.js"),i=require("./button.js"),q=require("./aria-text.js"),b=require("./button-tooltip.js"),w=require("./click-ripples.js"),j=require("./hover-gradient.js");var h=(e=>(e.default="default",e.success="success",e.warning="warning",e.danger="danger",e))(h||{});function _({icon:e,variant:u="default",label:d,disabled:m,className:S,...R}){const g=E.useIsDarkMode(),[o,y]=s.useState(e),[x,l]=s.useState(!1),p=s.useRef(e),c=s.useRef(null);s.useEffect(()=>{p.current=e},[e]);const r=s.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null)},[]);return s.useEffect(()=>{if(o===e){l(f=>f&&!1);return}l(!0),r(),c.current=setTimeout(()=>{l(!1),y(p.current)},370)},[o,e,r]),s.useEffect(()=>()=>{r()},[r]),t.jsxRuntimeExports.jsxs("button",{...R,type:"button",disabled:m,className:n.cx(k.buttonResetStyles,k.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"),S),children:[t.jsxRuntimeExports.jsxs("span",{"data-theme":u==="default"?g?"dark":"light":"dark",className:"kakadu-components-2197738751",children:[t.jsxRuntimeExports.jsx(a.Icon,{width:16,height:16,type:o,className:n.cx(a.iconShadowStyles,"kakadu-components-1309118222",x&&"kakadu-components-3602476657")}),o===e?null:t.jsxRuntimeExports.jsx(a.Icon,{width:16,height:16,type:e,className:n.cx(a.iconShadowStyles,"kakadu-components-2883440801",x&&"kakadu-components-1406924214")})]}),t.jsxRuntimeExports.jsx(q.default,{children:d}),t.jsxRuntimeExports.jsx(b.default,{label:d}),m?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(w.default,{size:50}),t.jsxRuntimeExports.jsx(j.default,{size:50,className:u==="default"?j.normalBlendStyles:void 0})]})]})}exports.IconButtonVariant=h;exports.default=_;
|
|
@@ -1,51 +1,54 @@
|
|
|
1
1
|
import { j as t } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
-
import { useState as
|
|
2
|
+
import { useState as p, useRef as k, useEffect as c, useCallback as w } from "react";
|
|
3
3
|
import { cx as s } from "@kuma-ui/core";
|
|
4
|
-
import { I as
|
|
5
|
-
import { buttonResetStyles as
|
|
6
|
-
import { useIsDarkMode as
|
|
7
|
-
import { buttonSecondaryStyles as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
4
|
+
import { I as h, i as g } from "../icon-BscWXhKi.mjs";
|
|
5
|
+
import { buttonResetStyles as b, effectStyles as R } from "../theme.mjs";
|
|
6
|
+
import { useIsDarkMode as N } from "./theme-setter.mjs";
|
|
7
|
+
import { buttonSecondaryStyles as T, buttonSuccessStyles as I, buttonWarningStyles as D, buttonDangerStyles as z } from "./button.mjs";
|
|
8
|
+
import C from "./aria-text.mjs";
|
|
9
|
+
import E from "./button-tooltip.mjs";
|
|
10
|
+
import M from "./click-ripples.mjs";
|
|
11
|
+
import A, { normalBlendStyles as F } from "./hover-gradient.mjs";
|
|
12
12
|
var G = /* @__PURE__ */ ((e) => (e.default = "default", e.success = "success", e.warning = "warning", e.danger = "danger", e))(G || {});
|
|
13
|
-
function
|
|
13
|
+
function X({
|
|
14
14
|
icon: e,
|
|
15
15
|
variant: o = "default",
|
|
16
16
|
label: m,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
disabled: l,
|
|
18
|
+
className: x,
|
|
19
|
+
...S
|
|
19
20
|
}) {
|
|
20
|
-
const
|
|
21
|
+
const y = N(), [r, j] = p(e), [i, a] = p(!1), d = k(e), n = k(null);
|
|
21
22
|
c(() => {
|
|
22
23
|
d.current = e;
|
|
23
24
|
}, [e]);
|
|
24
|
-
const u =
|
|
25
|
+
const u = w(() => {
|
|
25
26
|
n.current && (clearTimeout(n.current), n.current = null);
|
|
26
27
|
}, []);
|
|
27
28
|
return c(() => {
|
|
28
29
|
if (r === e) {
|
|
29
|
-
a((
|
|
30
|
+
a((f) => f && !1);
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
33
|
a(!0), u(), n.current = setTimeout(() => {
|
|
33
|
-
a(!1),
|
|
34
|
+
a(!1), j(d.current);
|
|
34
35
|
}, 370);
|
|
35
36
|
}, [r, e, u]), c(() => () => {
|
|
36
37
|
u();
|
|
37
|
-
}, [u]), /* @__PURE__ */ t.jsxs("button", { ...
|
|
38
|
-
/* @__PURE__ */ t.jsxs("span", { "data-theme": o === "default" ?
|
|
39
|
-
/* @__PURE__ */ t.jsx(
|
|
40
|
-
r === e ? null : /* @__PURE__ */ t.jsx(
|
|
38
|
+
}, [u]), /* @__PURE__ */ t.jsxs("button", { ...S, type: "button", disabled: l, className: s(b, R, "kakadu-components-3515018630", o === "default" && s(T, "kakadu-components-2089159949"), o === "success" && s(I, "kakadu-components-4088931955"), o === "warning" && s(D, "kakadu-components-1450399719"), o === "danger" && s(z, "kakadu-components-3594030066"), x), children: [
|
|
39
|
+
/* @__PURE__ */ t.jsxs("span", { "data-theme": o === "default" ? y ? "dark" : "light" : "dark", className: "kakadu-components-2197738751", children: [
|
|
40
|
+
/* @__PURE__ */ t.jsx(h, { width: 16, height: 16, type: r, className: s(g, "kakadu-components-1309118222", i && "kakadu-components-3602476657") }),
|
|
41
|
+
r === e ? null : /* @__PURE__ */ t.jsx(h, { width: 16, height: 16, type: e, className: s(g, "kakadu-components-2883440801", i && "kakadu-components-1406924214") })
|
|
41
42
|
] }),
|
|
42
|
-
/* @__PURE__ */ t.jsx(
|
|
43
|
-
/* @__PURE__ */ t.jsx(
|
|
44
|
-
/* @__PURE__ */ t.
|
|
45
|
-
|
|
43
|
+
/* @__PURE__ */ t.jsx(C, { children: m }),
|
|
44
|
+
/* @__PURE__ */ t.jsx(E, { label: m }),
|
|
45
|
+
l ? null : /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
46
|
+
/* @__PURE__ */ t.jsx(M, { size: 50 }),
|
|
47
|
+
/* @__PURE__ */ t.jsx(A, { size: 50, className: o === "default" ? F : void 0 })
|
|
48
|
+
] })
|
|
46
49
|
] });
|
|
47
50
|
}
|
|
48
51
|
export {
|
|
49
52
|
G as IconButtonVariant,
|
|
50
|
-
|
|
53
|
+
X as default
|
|
51
54
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ChangeEvent, type HTMLProps, type ReactNode } from 'react';
|
|
2
|
+
import { IconType } from '../icons/icon';
|
|
2
3
|
export declare const errorParagraph: string;
|
|
3
4
|
type LabelProperties = HTMLProps<HTMLLabelElement> & {
|
|
4
5
|
readonly label: string;
|
|
@@ -22,10 +23,15 @@ export declare function Select({ label, options, error, warning, footnote, class
|
|
|
22
23
|
type InputType = HTMLInputElement | HTMLTextAreaElement;
|
|
23
24
|
export type InputProperties = Omit<ControllerProperties & HTMLProps<InputType>, 'onChange'> & {
|
|
24
25
|
readonly suggestion?: string;
|
|
26
|
+
readonly actions?: Array<{
|
|
27
|
+
icon: IconType;
|
|
28
|
+
label: string;
|
|
29
|
+
onClick: () => void;
|
|
30
|
+
}>;
|
|
25
31
|
readonly hasCopyButton?: boolean;
|
|
26
32
|
readonly hasClearButton?: boolean;
|
|
27
33
|
readonly isMultiline?: boolean;
|
|
28
34
|
readonly onChange?: (value: string, event: ChangeEvent<InputType>) => void;
|
|
29
35
|
};
|
|
30
|
-
export default function Input({ type, label, error, warning, footnote, suggestion, hasCopyButton, hasClearButton, isMultiline, onChange, className, ...properties }: InputProperties): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export default function Input({ type, label, error, warning, footnote, suggestion, actions, hasCopyButton, hasClearButton, isMultiline, onChange, className, ...properties }: InputProperties): import("react/jsx-runtime").JSX.Element;
|
|
31
37
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),u=require("@kuma-ui/core"),
|
|
2
|
-
`):[],[
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),u=require("@kuma-ui/core"),re=require("../icons/chevron-up.js"),P=require("../icon-B__SNDvD.js"),U=require("../utilities/copy-to-clipboard.js"),L=require("../theme.js"),ie=require("./button-tooltip.js"),T=require("./text-button.js"),g=require("./text.js"),ue=require("./collapsible.js"),z=require("./click-ripples.js"),D=require("./hover-gradient.js"),xe=require("./notification.js"),pe=require("./notice.js"),de="kakadu-components-922159086",me="kakadu-components-2436386418",I="kakadu-components-1816130686",G="kakadu-components-4056037255",J=u.cx(G,"kakadu-components-3245407458"),je=u.cx(G,"kakadu-components-1117160492");function ke({as:d,className:o,...x}){return e.jsxRuntimeExports.jsx(g.Span,{as:d??"span",...x,className:u.cx("kakadu-components-3574036749",o)})}function K({label:d,error:o,errorId:x,warning:c,warningId:R,footnote:s,attachments:l,className:m,children:j,...b}){const p=!!o,r=!!c,k=!!s;return e.jsxRuntimeExports.jsx("label",{...b,className:u.cx(de,m),children:e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[e.jsxRuntimeExports.jsx(g.Span,{className:u.cx(L.overflowProtectionStyles,me),children:e.jsxRuntimeExports.jsx("span",{children:d})}),e.jsxRuntimeExports.jsxs("span",{className:"kakadu-components-3298764637",children:[j,k?e.jsxRuntimeExports.jsx(ke,{className:"kakadu-components-613632806",children:s}):null,l]}),p||r?e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2927674627",children:p?e.jsxRuntimeExports.jsx(g.Paragraph,{id:x,className:J,children:o instanceof Error?o.message:o}):r?e.jsxRuntimeExports.jsx(g.Paragraph,{id:R,className:je,children:c instanceof Error?c.message:c}):null}):null]})})}function fe({label:d,options:o,error:x,warning:c,footnote:R,className:s,onChange:l,...m}){const j=t.useId(),b=`${j}-error`,p=`${j}-warning`,r=!!x,k=!r&&!!c,N=r?b:k?p:void 0,{value:h}=m,[y,v]=t.useState(""),S=h??y;t.useEffect(()=>{v(typeof h=="string"?h:"")},[h]);const _=t.useCallback(f=>{const{value:E}=f.target;v(E),l==null||l(E,f)},[l]);return e.jsxRuntimeExports.jsxs(K,{label:d,error:x,warning:c,footnote:R,children:[e.jsxRuntimeExports.jsx("select",{...m,value:S,"aria-invalid":r,"data-warning":k,"aria-describedby":N,className:u.cx(I,"kakadu-components-4228384787",s),onChange:_,children:o.map(f=>e.jsxRuntimeExports.jsx("option",{value:f.value,children:f.label},f.value))}),e.jsxRuntimeExports.jsx(re.default,{width:14,height:14,className:"kakadu-components-158931186"})]})}const he=40,M="kakadu-components-4233741488";function Ee({type:d,label:o,error:x,warning:c,footnote:R,suggestion:s,actions:l=[],hasCopyButton:m,hasClearButton:j,isMultiline:b,onChange:p,className:r,...k}){const N=t.useRef(null),h=t.useRef(null),y=t.useRef(null),v=xe.useCreateNotification(),S=t.useId(),_=`${S}-error`,f=`${S}-warning`,{value:E,disabled:Q}=k,[X,$]=t.useState(""),i=E??X,[Y,Z]=t.useState(),ee=d==="textarea"||!!b;t.useLayoutEffect(()=>{typeof i=="string"&&y.current&&Z(y.current.scrollHeight)},[i]);const w=t.useMemo(()=>typeof i=="string"?`${i} `.split(`
|
|
2
|
+
`):[],[i]),te=t.useMemo(()=>w.length,[w]),q=!!x,B=!q&&!!c,V=q?_:B?f:void 0;t.useEffect(()=>{$(typeof E=="string"?E:"")},[E]);const H=t.useCallback(n=>{const{value:a}=n.target;$(a),p==null||p(a,n)},[p]),se=t.useCallback(()=>{typeof i=="string"&&(U.default(i),v({type:pe.NoticeType.success,children:"Copied to clipboard."}))},[i,v]),C=t.useCallback(n=>{var O;const a=h.current??N.current??void 0;if(a){const W=(O=Object.getOwnPropertyDescriptor(a instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value"))==null?void 0:O.set;if(W){W.call(a,n);const le=new Event("input",{bubbles:!0});a.dispatchEvent(le),a.focus();return}}throw new Error("Unable to set value.")},[]),ne=t.useCallback(()=>{C("")},[C]),[ae,oe]=t.useState(""),A=!!s&&ae!==s,ce=t.useCallback(()=>{if(s){try{C(s)}catch{U.default(s)}oe(s)}},[s,C]),F=t.useMemo(()=>l.length,[l]);return e.jsxRuntimeExports.jsxs(K,{label:o,error:x,warning:c,footnote:R,attachments:e.jsxRuntimeExports.jsx(ue.default,{isCollapsed:!A,children:A?e.jsxRuntimeExports.jsxs("button",{type:"button",className:u.cx(L.buttonResetStyles,L.overflowProtectionStyles,"kakadu-components-2355856341"),onClick:ce,children:[e.jsxRuntimeExports.jsx(ie.default,{label:"Apply suggestion"}),e.jsxRuntimeExports.jsx(P.SparkleSvg,{width:13,height:13,className:"kakadu-components-1021263934"}),e.jsxRuntimeExports.jsx(g.Span,{className:"kakadu-components-1585874956",children:s}),e.jsxRuntimeExports.jsx(z.default,{className:"kakadu-components-3448565402"}),e.jsxRuntimeExports.jsx(D.default,{})]}):null}),style:{"--button-padding":`calc(${he*((m?1:0)+(j?1:0)+F)}px + 6px)`},children:[e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[ee?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{ref:y,"aria-hidden":!0,className:u.cx(I,r,"kakadu-components-2033521835"),children:[w.map((n,a)=>e.jsxRuntimeExports.jsxs("span",{children:[n,te>1?e.jsxRuntimeExports.jsx("br",{}):null]},a))," "]}),e.jsxRuntimeExports.jsx("textarea",{...k,ref:h,rows:1,"aria-invalid":q,"data-warning":B,"aria-describedby":V,value:i,className:u.cx(I,r,"kakadu-components-2119524139"),style:{minHeight:Y},onChange:H})]}):e.jsxRuntimeExports.jsx("input",{...k,ref:N,type:d??"text",value:i,"aria-invalid":q,"data-warning":B,"aria-describedby":V,className:u.cx(I,r),onChange:H}),Q?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(z.default,{className:"kakadu-components-616311160"}),e.jsxRuntimeExports.jsx(D.default,{className:"kakadu-components-1962999040"})]})]}),m||j||F>0?e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-131986363",children:[l.map((n,a)=>e.jsxRuntimeExports.jsx(T.default,{iconLeft:n.icon,label:n.label,tooltip:n.label,className:M,onClick:n.onClick},n.label+a)),m?e.jsxRuntimeExports.jsx(T.default,{iconLeft:P.IconType.copy,label:"Copy",tooltip:"Copy",className:M,onClick:se}):null,j?e.jsxRuntimeExports.jsx(T.default,{iconLeft:P.IconType.times,label:"Clear",tooltip:"Clear",className:M,onClick:ne}):null]}):null]})}exports.Select=fe;exports.default=Ee;exports.errorParagraph=J;
|