@kakadu/components 1.6.0 → 1.6.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.mjs +6 -6
- package/build/components/card.mjs +9 -9
- package/build/components/collapsible.js +1 -0
- package/build/components/collapsible.mjs +27 -0
- package/build/components/datum.mjs +1 -1
- package/build/components/icon-button.mjs +10 -10
- package/build/components/input.js +2 -0
- package/build/components/input.mjs +165 -0
- package/build/components/modal.mjs +1 -1
- package/build/components/notice.mjs +1 -1
- package/build/components/text-button.mjs +12 -12
- package/build/components.css +1 -1
- package/build/{icon-Dz2YJAPU.mjs → icon-Ci3BSxQa.mjs} +2 -2
- package/build/icons/icon.mjs +1 -1
- package/build/index.js +1 -2
- package/build/index.mjs +180 -349
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { j as o } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
2
|
import { useRef as M } from "react";
|
|
3
3
|
import { cx as t } from "@kuma-ui/core";
|
|
4
|
-
import { effectStyles as
|
|
5
|
-
import {
|
|
6
|
-
import { RevealSpinner as
|
|
4
|
+
import { effectStyles as I } from "../theme.mjs";
|
|
5
|
+
import { I as D } from "../icon-Ci3BSxQa.mjs";
|
|
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
9
|
import { useIsDarkMode as z } from "./theme-setter.mjs";
|
|
@@ -19,7 +19,7 @@ function l({
|
|
|
19
19
|
className: a,
|
|
20
20
|
...m
|
|
21
21
|
}) {
|
|
22
|
-
return /* @__PURE__ */ o.jsx("div", { ...m, className: t("kakadu-components-2658660333", e === "secondary" && "kakadu-components-3469662110", a), children: typeof s == "string" ? /* @__PURE__ */ o.jsx(
|
|
22
|
+
return /* @__PURE__ */ o.jsx("div", { ...m, className: t("kakadu-components-2658660333", e === "secondary" && "kakadu-components-3469662110", a), children: typeof s == "string" ? /* @__PURE__ */ o.jsx(D, { width: 14, height: 14, type: s }) : s });
|
|
23
23
|
}
|
|
24
24
|
const q = "kakadu-components-2244098950", eo = "kakadu-components-3923184173", F = "kakadu-components-317965671", J = "kakadu-components-1978976872";
|
|
25
25
|
function no({
|
|
@@ -42,11 +42,11 @@ function no({
|
|
|
42
42
|
...b
|
|
43
43
|
}) {
|
|
44
44
|
const k = M(null), N = z(k), g = s ?? "button", v = j && u > 0, w = S && i > 0;
|
|
45
|
-
return /* @__PURE__ */ o.jsxs(H, { ...b, as: a ? "a" : "button", type: a ? void 0 : g, href: a, target: m, rel: x, disabled: c, className: t(
|
|
45
|
+
return /* @__PURE__ */ o.jsxs(H, { ...b, as: a ? "a" : "button", type: a ? void 0 : g, href: a, target: m, rel: x, disabled: c, className: t(I, "kakadu-components-1578318887", !!r && "kakadu-components-3652831856", !n && "kakadu-components-2746167644", e === "secondary" && q, e === "warning" && F, e === "danger" && J, y), children: [
|
|
46
46
|
r ? /* @__PURE__ */ o.jsx(l, { variant: e, icon: r, className: n ? "kakadu-components-294089230" : void 0 }) : null,
|
|
47
47
|
n ? /* @__PURE__ */ o.jsx("div", { ref: k, className: "kakadu-components-2618257692", children: n }) : /* @__PURE__ */ o.jsx(E, { children: f }),
|
|
48
48
|
d ? /* @__PURE__ */ o.jsx(l, { variant: e, icon: d, className: n ? "kakadu-components-3127707672" : void 0 }) : null,
|
|
49
|
-
/* @__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(
|
|
49
|
+
/* @__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
50
|
v && /* @__PURE__ */ o.jsx(R, { opacity: N ? 0.4 : 0.3, maximumGradientsCount: u, className: t("kakadu-components-1505766785", e === "secondary" && "kakadu-components-3712045697") }),
|
|
51
51
|
w && /* @__PURE__ */ o.jsx(T, { maximumStarsCount: i, className: "kakadu-components-2813474662" }),
|
|
52
52
|
/* @__PURE__ */ o.jsx(A, { size: n ? void 0 : 50 }),
|
|
@@ -1,37 +1,37 @@
|
|
|
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 {
|
|
5
|
-
import
|
|
4
|
+
import { I as k, i as f } from "../icon-Ci3BSxQa.mjs";
|
|
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";
|
|
8
8
|
import g, { normalBlendStyles as y } from "./hover-gradient.mjs";
|
|
9
9
|
import { buttonSecondaryStyles as N } from "./button.mjs";
|
|
10
10
|
import S from "./atom.mjs";
|
|
11
|
-
function
|
|
11
|
+
function E({
|
|
12
12
|
icon: e,
|
|
13
13
|
title: r,
|
|
14
14
|
description: i,
|
|
15
15
|
action: l,
|
|
16
|
-
href:
|
|
16
|
+
href: s,
|
|
17
17
|
target: c,
|
|
18
18
|
rel: p,
|
|
19
19
|
className: d,
|
|
20
20
|
...x
|
|
21
21
|
}) {
|
|
22
|
-
return /* @__PURE__ */ o.jsxs(S, { ...x, as:
|
|
23
|
-
/* @__PURE__ */ o.jsxs(
|
|
24
|
-
/* @__PURE__ */ o.jsx(m, { className: "kakadu-components-1301774894", children: /* @__PURE__ */ o.jsxs(
|
|
22
|
+
return /* @__PURE__ */ o.jsxs(S, { ...x, as: s ? "a" : "button", type: s ? void 0 : "button", href: s, target: c, rel: p, className: t(u, N, "kakadu-components-2034054779", d), children: [
|
|
23
|
+
/* @__PURE__ */ o.jsxs(a, { gap: 0.75, direction: "column", children: [
|
|
24
|
+
/* @__PURE__ */ o.jsx(m, { className: "kakadu-components-1301774894", children: /* @__PURE__ */ o.jsxs(a, { gap: 0.5, direction: "row", alignment: n.start, children: [
|
|
25
25
|
e ? /* @__PURE__ */ o.jsx(k, { width: 16, height: 16, type: e, className: t(f, "kakadu-components-782417605") }) : null,
|
|
26
26
|
r
|
|
27
27
|
] }) }),
|
|
28
28
|
/* @__PURE__ */ o.jsx(j, { className: "kakadu-components-3061837309", children: i }),
|
|
29
|
-
/* @__PURE__ */ o.jsx(
|
|
29
|
+
/* @__PURE__ */ o.jsx(a, { alignment: n.end, children: /* @__PURE__ */ o.jsx(m, { className: "kakadu-components-425989064", children: l }) })
|
|
30
30
|
] }),
|
|
31
31
|
/* @__PURE__ */ o.jsx(h, { size: 250, className: "kakadu-components-2967167444" }),
|
|
32
32
|
/* @__PURE__ */ o.jsx(g, { size: 300, className: y })
|
|
33
33
|
] });
|
|
34
34
|
}
|
|
35
35
|
export {
|
|
36
|
-
|
|
36
|
+
E as default
|
|
37
37
|
};
|
|
@@ -0,0 +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"),f=require("@kuma-ui/core"),m=require("./atom.js");function d({as:c,isCollapsed:e=!0,children:o,className:i,...a}){const r=t.useRef(null),[l,s]=t.useState();return t.useEffect(()=>{if(e)s(0);else{const n=r.current;n&&s(n.scrollHeight??0)}},[e]),u.jsxRuntimeExports.jsx(m.default,{as:c??"div",...a,"aria-hidden":e,style:{height:l,opacity:e?0:1},className:f.cx("kakadu-components-2223449868",i),children:u.jsxRuntimeExports.jsx("div",{ref:r,className:"kakadu-components-3857562328",children:o})})}exports.default=d;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { j as s } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import { useRef as f, useState as u, useEffect as l } from "react";
|
|
3
|
+
import { cx as p } from "@kuma-ui/core";
|
|
4
|
+
import h from "./atom.mjs";
|
|
5
|
+
function g({
|
|
6
|
+
as: n,
|
|
7
|
+
isCollapsed: e = !0,
|
|
8
|
+
children: c,
|
|
9
|
+
className: i,
|
|
10
|
+
...m
|
|
11
|
+
}) {
|
|
12
|
+
const t = f(null), [a, r] = u();
|
|
13
|
+
return l(() => {
|
|
14
|
+
if (e)
|
|
15
|
+
r(0);
|
|
16
|
+
else {
|
|
17
|
+
const o = t.current;
|
|
18
|
+
o && r(o.scrollHeight ?? 0);
|
|
19
|
+
}
|
|
20
|
+
}, [e]), /* @__PURE__ */ s.jsx(h, { as: n ?? "div", ...m, "aria-hidden": e, style: {
|
|
21
|
+
height: a,
|
|
22
|
+
opacity: e ? 0 : 1
|
|
23
|
+
}, className: p("kakadu-components-2223449868", i), children: /* @__PURE__ */ s.jsx("div", { ref: t, className: "kakadu-components-3857562328", children: c }) });
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
g as default
|
|
27
|
+
};
|
|
@@ -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 {
|
|
3
|
+
import { a as r } from "../icon-Ci3BSxQa.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";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { j as t } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
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 {
|
|
4
|
+
import { I as k, i as h } from "../icon-Ci3BSxQa.mjs";
|
|
5
5
|
import { buttonResetStyles as w, effectStyles as b } from "../theme.mjs";
|
|
6
6
|
import { useIsDarkMode as R } from "./theme-setter.mjs";
|
|
7
|
-
import { buttonSecondaryStyles as N, buttonSuccessStyles as T, buttonWarningStyles as
|
|
7
|
+
import { buttonSecondaryStyles as N, buttonSuccessStyles as T, buttonWarningStyles as I, buttonDangerStyles as D } from "./button.mjs";
|
|
8
8
|
import z from "./aria-text.mjs";
|
|
9
9
|
import C from "./button-tooltip.mjs";
|
|
10
10
|
import E from "./click-ripples.mjs";
|
|
@@ -17,24 +17,24 @@ function U({
|
|
|
17
17
|
className: S,
|
|
18
18
|
...g
|
|
19
19
|
}) {
|
|
20
|
-
const x = R(), [r, y] = f(e), [l,
|
|
20
|
+
const x = R(), [r, y] = f(e), [l, a] = f(!1), d = p(e), n = p(null);
|
|
21
21
|
c(() => {
|
|
22
22
|
d.current = e;
|
|
23
23
|
}, [e]);
|
|
24
|
-
const
|
|
24
|
+
const u = j(() => {
|
|
25
25
|
n.current && (clearTimeout(n.current), n.current = null);
|
|
26
26
|
}, []);
|
|
27
27
|
return c(() => {
|
|
28
28
|
if (r === e) {
|
|
29
|
-
|
|
29
|
+
a((i) => i && !1);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
a(!0), u(), n.current = setTimeout(() => {
|
|
33
|
+
a(!1), y(d.current);
|
|
34
34
|
}, 370);
|
|
35
|
-
}, [r, e,
|
|
36
|
-
|
|
37
|
-
}, [
|
|
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(I, "kakadu-components-2686186037"), o === "danger" && s(D, "kakadu-components-2463905722"), S), children: [
|
|
38
38
|
/* @__PURE__ */ t.jsxs("span", { "data-theme": o === "default" ? x ? "dark" : "light" : "dark", className: "kakadu-components-2197738751", children: [
|
|
39
39
|
/* @__PURE__ */ t.jsx(k, { width: 16, height: 16, type: r, className: s(h, "kakadu-components-1309118222", l && "kakadu-components-3602476657") }),
|
|
40
40
|
r === e ? null : /* @__PURE__ */ t.jsx(k, { width: 16, height: 16, type: e, className: s(h, "kakadu-components-2883440801", l && "kakadu-components-1406924214") })
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),s=require("react"),i=require("@kuma-ui/core"),ne=require("../icons/chevron-up.js"),I=require("../icon-CRXHH3In.js"),H=require("../utilities/copy-to-clipboard.js"),_=require("../theme.js"),oe=require("./button-tooltip.js"),$=require("./text-button.js"),R=require("./text.js"),ae=require("./collapsible.js"),A=require("./click-ripples.js"),O=require("./hover-gradient.js"),ce=require("./notification.js"),re=require("./notice.js"),le="kakadu-components-2065792067",ie="kakadu-components-3551118672",y="kakadu-components-2161641266",W="kakadu-components-628401705",D=i.cx(W,"kakadu-components-3245407458"),ue=i.cx(W,"kakadu-components-1117160492");function pe({as:x,className:a,...u}){return e.jsxRuntimeExports.jsx(R.Span,{as:x??"span",...u,className:i.cx("kakadu-components-3574036749",a)})}function F({label:x,error:a,errorId:u,warning:c,warningId:f,footnote:n,attachments:k,className:d,children:E,...o}){const m=!!a,j=!!c,p=!!n;return e.jsxRuntimeExports.jsxs("label",{...o,className:i.cx(le,d),children:[e.jsxRuntimeExports.jsx(R.Span,{className:i.cx(_.overflowProtectionStyles,ie),children:e.jsxRuntimeExports.jsx("span",{children:x})}),e.jsxRuntimeExports.jsxs("span",{className:"kakadu-components-448077930",children:[E,p?e.jsxRuntimeExports.jsx(pe,{className:"kakadu-components-3258753754",children:n}):null,k]}),m?e.jsxRuntimeExports.jsx(R.Paragraph,{id:u,className:D,children:a instanceof Error?a.message:a}):j?e.jsxRuntimeExports.jsx(R.Paragraph,{id:f,className:ue,children:c instanceof Error?c.message:c}):null]})}function xe({label:x,options:a,error:u,warning:c,footnote:f,className:n,...k}){const d=s.useId(),E=`${d}-error`,o=`${d}-warning`,m=!!u,j=!!c;return e.jsxRuntimeExports.jsxs(F,{label:x,error:u,warning:c,footnote:f,children:[e.jsxRuntimeExports.jsx("select",{...k,"aria-invalid":m,"data-warning":j,"aria-describedby":m?E:j?o:void 0,className:i.cx(y,"kakadu-components-709108872",n),children:a.map(p=>e.jsxRuntimeExports.jsx("option",{value:p.value,children:p.label},p.value))}),e.jsxRuntimeExports.jsx(ne.default,{className:"kakadu-components-1616393393"})]})}const de=36,V="kakadu-components-4233741488";function me({type:x,label:a,error:u,warning:c,footnote:f,suggestion:n,hasCopyButton:k,hasClearButton:d,isMultiline:E,onChange:o,className:m,...j}){const p=s.useRef(null),v=s.useRef(null),S=s.useRef(null),P=ce.useCreateNotification(),w=s.useId(),z=`${w}-error`,G=`${w}-warning`,{value:b}=j,[U,M]=s.useState(""),r=b??U,[J,K]=s.useState(),Q=x==="textarea"||!!E;s.useLayoutEffect(()=>{typeof r=="string"&&S.current&&K(S.current.scrollHeight)},[r]);const g=s.useMemo(()=>typeof r=="string"?`${r} `.split(`
|
|
2
|
+
`):[],[r]),X=s.useMemo(()=>g.length,[g]),N=!!u,q=!!c,B=N?z:q?G:void 0;s.useEffect(()=>{M(typeof b=="string"?b:"")},[b]);const L=s.useCallback(t=>{const{value:l}=t.target;M(l),o==null||o(l,t)},[o]),Y=s.useCallback(()=>{typeof r=="string"&&(H.default(r),P({type:re.NoticeType.success,children:"Copied to clipboard."}))},[r,P]),Z=s.useCallback(()=>{var l;const t=v.current??p.current;if(o&&t){const h=(l=Object.getOwnPropertyDescriptor(t instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value"))==null?void 0:l.set;if(h){h.call(t,"");const T=new Event("input",{bubbles:!0});t.dispatchEvent(T),t.focus()}}},[o]),[ee,te]=s.useState(""),C=!!n&&ee!==n,se=s.useCallback(()=>{var l;const t=v.current??p.current;if(n&&o&&t){const h=(l=Object.getOwnPropertyDescriptor(t instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value"))==null?void 0:l.set;if(h){h.call(t,n);const T=new Event("input",{bubbles:!0});t.dispatchEvent(T),t.focus()}else H.default(n);te(n)}},[n,o]);return e.jsxRuntimeExports.jsxs(F,{label:a,error:u,warning:c,footnote:f,attachments:e.jsxRuntimeExports.jsx(ae.default,{isCollapsed:!C,children:C?e.jsxRuntimeExports.jsxs("button",{type:"button",className:i.cx(_.buttonResetStyles,_.overflowProtectionStyles,"kakadu-components-2355856341"),onClick:se,children:[e.jsxRuntimeExports.jsx(oe.default,{label:"Apply suggestion"}),e.jsxRuntimeExports.jsx(I.SparkleSvg,{width:13,height:13,className:"kakadu-components-1021263934"}),e.jsxRuntimeExports.jsx(R.Span,{className:"kakadu-components-1585874956",children:n}),e.jsxRuntimeExports.jsx(A.default,{className:"kakadu-components-3448565402"}),e.jsxRuntimeExports.jsx(O.default,{})]}):null}),style:{"--button-padding":`${de*((k?1:0)+(d?1:0))}px`},children:[e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[Q?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{ref:S,"aria-hidden":!0,className:i.cx(y,m,"kakadu-components-2033521835"),children:[g.map((t,l)=>e.jsxRuntimeExports.jsxs("span",{children:[t,X>1?e.jsxRuntimeExports.jsx("br",{}):null]},l))," "]}),e.jsxRuntimeExports.jsx("textarea",{...j,ref:v,rows:1,"aria-invalid":N,"data-warning":q,"aria-describedby":B,value:r,className:i.cx(y,m,"kakadu-components-2119524139"),style:{minHeight:J},onChange:L})]}):e.jsxRuntimeExports.jsx("input",{...j,ref:p,type:x??"text",value:r,"aria-invalid":N,"data-warning":q,"aria-describedby":B,className:i.cx(y,m),onChange:L}),e.jsxRuntimeExports.jsx(A.default,{className:"kakadu-components-1614211948"}),e.jsxRuntimeExports.jsx(O.default,{className:"kakadu-components-1041647916"})]}),k||d?e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-131986363",children:[k?e.jsxRuntimeExports.jsx($.default,{iconLeft:I.IconType.copy,label:"Copy",tooltip:"Copy",className:V,onClick:Y}):null,d?e.jsxRuntimeExports.jsx($.default,{iconLeft:I.IconType.times,label:"Clear",tooltip:"Clear",className:V,onClick:Z}):null]}):null]})}exports.Select=xe;exports.default=me;exports.errorParagraph=D;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { j as e } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import { useRef as B, useId as U, useState as w, useLayoutEffect as re, useMemo as $, useEffect as le, useCallback as y } from "react";
|
|
3
|
+
import { cx as l } from "@kuma-ui/core";
|
|
4
|
+
import ie from "../icons/chevron-up.mjs";
|
|
5
|
+
import { a as O, S as pe } from "../icon-Ci3BSxQa.mjs";
|
|
6
|
+
import V from "../utilities/copy-to-clipboard.mjs";
|
|
7
|
+
import { buttonResetStyles as de, overflowProtectionStyles as q } from "../theme.mjs";
|
|
8
|
+
import ue from "./button-tooltip.mjs";
|
|
9
|
+
import W from "./text-button.mjs";
|
|
10
|
+
import { Span as H, Paragraph as D } from "./text.mjs";
|
|
11
|
+
import me from "./collapsible.mjs";
|
|
12
|
+
import F from "./click-ripples.mjs";
|
|
13
|
+
import z from "./hover-gradient.mjs";
|
|
14
|
+
import { useCreateNotification as fe } from "./notification.mjs";
|
|
15
|
+
import { NoticeType as ke } from "./notice.mjs";
|
|
16
|
+
const xe = "kakadu-components-2065792067", he = "kakadu-components-3551118672", v = "kakadu-components-2161641266", J = "kakadu-components-628401705", je = l(J, "kakadu-components-3245407458"), be = l(J, "kakadu-components-1117160492");
|
|
17
|
+
function ye({
|
|
18
|
+
as: d,
|
|
19
|
+
className: s,
|
|
20
|
+
...i
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ e.jsx(H, { as: d ?? "span", ...i, className: l("kakadu-components-3574036749", s) });
|
|
23
|
+
}
|
|
24
|
+
function K({
|
|
25
|
+
label: d,
|
|
26
|
+
error: s,
|
|
27
|
+
errorId: i,
|
|
28
|
+
warning: o,
|
|
29
|
+
warningId: x,
|
|
30
|
+
footnote: n,
|
|
31
|
+
attachments: k,
|
|
32
|
+
className: u,
|
|
33
|
+
children: h,
|
|
34
|
+
...a
|
|
35
|
+
}) {
|
|
36
|
+
const m = !!s, f = !!o, p = !!n;
|
|
37
|
+
return /* @__PURE__ */ e.jsxs("label", { ...a, className: l(xe, u), children: [
|
|
38
|
+
/* @__PURE__ */ e.jsx(H, { className: l(q, he), children: /* @__PURE__ */ e.jsx("span", { children: d }) }),
|
|
39
|
+
/* @__PURE__ */ e.jsxs("span", { className: "kakadu-components-448077930", children: [
|
|
40
|
+
h,
|
|
41
|
+
p ? /* @__PURE__ */ e.jsx(ye, { className: "kakadu-components-3258753754", children: n }) : null,
|
|
42
|
+
k
|
|
43
|
+
] }),
|
|
44
|
+
m ? /* @__PURE__ */ e.jsx(D, { id: i, className: je, children: s instanceof Error ? s.message : s }) : f ? /* @__PURE__ */ e.jsx(D, { id: x, className: be, children: o instanceof Error ? o.message : o }) : null
|
|
45
|
+
] });
|
|
46
|
+
}
|
|
47
|
+
function $e({
|
|
48
|
+
label: d,
|
|
49
|
+
options: s,
|
|
50
|
+
error: i,
|
|
51
|
+
warning: o,
|
|
52
|
+
footnote: x,
|
|
53
|
+
className: n,
|
|
54
|
+
...k
|
|
55
|
+
}) {
|
|
56
|
+
const u = U(), h = `${u}-error`, a = `${u}-warning`, m = !!i, f = !!o;
|
|
57
|
+
return /* @__PURE__ */ e.jsxs(K, { label: d, error: i, warning: o, footnote: x, children: [
|
|
58
|
+
/* @__PURE__ */ e.jsx("select", { ...k, "aria-invalid": m, "data-warning": f, "aria-describedby": m ? h : f ? a : void 0, className: l(v, "kakadu-components-709108872", n), children: s.map((p) => /* @__PURE__ */ e.jsx("option", { value: p.value, children: p.label }, p.value)) }),
|
|
59
|
+
/* @__PURE__ */ e.jsx(ie, { className: "kakadu-components-1616393393" })
|
|
60
|
+
] });
|
|
61
|
+
}
|
|
62
|
+
const ve = 36, G = "kakadu-components-4233741488";
|
|
63
|
+
function Oe({
|
|
64
|
+
type: d,
|
|
65
|
+
label: s,
|
|
66
|
+
error: i,
|
|
67
|
+
warning: o,
|
|
68
|
+
footnote: x,
|
|
69
|
+
suggestion: n,
|
|
70
|
+
hasCopyButton: k,
|
|
71
|
+
hasClearButton: u,
|
|
72
|
+
isMultiline: h,
|
|
73
|
+
onChange: a,
|
|
74
|
+
className: m,
|
|
75
|
+
...f
|
|
76
|
+
}) {
|
|
77
|
+
const p = B(null), N = B(null), g = B(null), L = fe(), C = U(), Q = `${C}-error`, X = `${C}-warning`, {
|
|
78
|
+
value: b
|
|
79
|
+
} = f, [Y, M] = w(""), c = b ?? Y, [Z, _] = w(), ee = d === "textarea" || !!h;
|
|
80
|
+
re(() => {
|
|
81
|
+
typeof c == "string" && g.current && _(g.current.scrollHeight);
|
|
82
|
+
}, [c]);
|
|
83
|
+
const S = $(() => typeof c == "string" ? `${c} `.split(`
|
|
84
|
+
`) : [], [c]), te = $(() => S.length, [S]), E = !!i, T = !!o, P = E ? Q : T ? X : void 0;
|
|
85
|
+
le(() => {
|
|
86
|
+
M(typeof b == "string" ? b : "");
|
|
87
|
+
}, [b]);
|
|
88
|
+
const R = y((t) => {
|
|
89
|
+
const {
|
|
90
|
+
value: r
|
|
91
|
+
} = t.target;
|
|
92
|
+
M(r), a == null || a(r, t);
|
|
93
|
+
}, [a]), ne = y(() => {
|
|
94
|
+
typeof c == "string" && (V(c), L({
|
|
95
|
+
type: ke.success,
|
|
96
|
+
children: "Copied to clipboard."
|
|
97
|
+
}));
|
|
98
|
+
}, [c, L]), ae = y(() => {
|
|
99
|
+
var r;
|
|
100
|
+
const t = N.current ?? p.current;
|
|
101
|
+
if (a && t) {
|
|
102
|
+
const j = (r = Object.getOwnPropertyDescriptor(t instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype, "value")) == null ? void 0 : r.set;
|
|
103
|
+
if (j) {
|
|
104
|
+
j.call(t, "");
|
|
105
|
+
const I = new Event("input", {
|
|
106
|
+
bubbles: !0
|
|
107
|
+
});
|
|
108
|
+
t.dispatchEvent(I), t.focus();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, [a]), [se, oe] = w(""), A = !!n && se !== n, ce = y(() => {
|
|
112
|
+
var r;
|
|
113
|
+
const t = N.current ?? p.current;
|
|
114
|
+
if (n && a && t) {
|
|
115
|
+
const j = (r = Object.getOwnPropertyDescriptor(t instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype, "value")) == null ? void 0 : r.set;
|
|
116
|
+
if (j) {
|
|
117
|
+
j.call(t, n);
|
|
118
|
+
const I = new Event("input", {
|
|
119
|
+
bubbles: !0
|
|
120
|
+
});
|
|
121
|
+
t.dispatchEvent(I), t.focus();
|
|
122
|
+
} else
|
|
123
|
+
V(n);
|
|
124
|
+
oe(n);
|
|
125
|
+
}
|
|
126
|
+
}, [n, a]);
|
|
127
|
+
return /* @__PURE__ */ e.jsxs(K, { label: s, error: i, warning: o, footnote: x, attachments: /* @__PURE__ */ e.jsx(me, { isCollapsed: !A, children: A ? /* @__PURE__ */ e.jsxs("button", { type: "button", className: l(de, q, "kakadu-components-2355856341"), onClick: ce, children: [
|
|
128
|
+
/* @__PURE__ */ e.jsx(ue, { label: "Apply suggestion" }),
|
|
129
|
+
/* @__PURE__ */ e.jsx(pe, { width: 13, height: 13, className: "kakadu-components-1021263934" }),
|
|
130
|
+
/* @__PURE__ */ e.jsx(H, { className: "kakadu-components-1585874956", children: n }),
|
|
131
|
+
/* @__PURE__ */ e.jsx(F, { className: "kakadu-components-3448565402" }),
|
|
132
|
+
/* @__PURE__ */ e.jsx(z, {})
|
|
133
|
+
] }) : null }), style: {
|
|
134
|
+
"--button-padding": `${ve * ((k ? 1 : 0) + (u ? 1 : 0))}px`
|
|
135
|
+
}, children: [
|
|
136
|
+
/* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-3146929190", children: [
|
|
137
|
+
ee ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
138
|
+
/* @__PURE__ */ e.jsxs("span", { ref: g, "aria-hidden": !0, className: l(v, m, "kakadu-components-2033521835"), children: [
|
|
139
|
+
S.map((t, r) => (
|
|
140
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
141
|
+
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
142
|
+
t,
|
|
143
|
+
te > 1 ? /* @__PURE__ */ e.jsx("br", {}) : null
|
|
144
|
+
] }, r)
|
|
145
|
+
)),
|
|
146
|
+
" "
|
|
147
|
+
] }),
|
|
148
|
+
/* @__PURE__ */ e.jsx("textarea", { ...f, ref: N, rows: 1, "aria-invalid": E, "data-warning": T, "aria-describedby": P, value: c, className: l(v, m, "kakadu-components-2119524139"), style: {
|
|
149
|
+
minHeight: Z
|
|
150
|
+
}, onChange: R })
|
|
151
|
+
] }) : /* @__PURE__ */ e.jsx("input", { ...f, ref: p, type: d ?? "text", value: c, "aria-invalid": E, "data-warning": T, "aria-describedby": P, className: l(v, m), onChange: R }),
|
|
152
|
+
/* @__PURE__ */ e.jsx(F, { className: "kakadu-components-1614211948" }),
|
|
153
|
+
/* @__PURE__ */ e.jsx(z, { className: "kakadu-components-1041647916" })
|
|
154
|
+
] }),
|
|
155
|
+
k || u ? /* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-131986363", children: [
|
|
156
|
+
k ? /* @__PURE__ */ e.jsx(W, { iconLeft: O.copy, label: "Copy", tooltip: "Copy", className: G, onClick: ne }) : null,
|
|
157
|
+
u ? /* @__PURE__ */ e.jsx(W, { iconLeft: O.times, label: "Clear", tooltip: "Clear", className: G, onClick: ae }) : null
|
|
158
|
+
] }) : null
|
|
159
|
+
] });
|
|
160
|
+
}
|
|
161
|
+
export {
|
|
162
|
+
$e as Select,
|
|
163
|
+
Oe as default,
|
|
164
|
+
je as errorParagraph
|
|
165
|
+
};
|
|
@@ -2,7 +2,7 @@ import { j as C } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
|
2
2
|
import Ie, { createContext as Ae, useRef as te, useState as re, useCallback as J, useMemo as ne, useEffect as H, useContext as je } from "react";
|
|
3
3
|
import { cx as pe } from "@kuma-ui/core";
|
|
4
4
|
import { createPortal as xe } from "react-dom";
|
|
5
|
-
import {
|
|
5
|
+
import { a as _e } from "../icon-Ci3BSxQa.mjs";
|
|
6
6
|
import Le from "../theme.mjs";
|
|
7
7
|
import Be from "./text-button.mjs";
|
|
8
8
|
function we(r) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as s } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
2
|
import { cx as t } from "@kuma-ui/core";
|
|
3
|
-
import {
|
|
3
|
+
import { I as i, i as l } from "../icon-Ci3BSxQa.mjs";
|
|
4
4
|
import { Span as p } from "./text.mjs";
|
|
5
5
|
var h = /* @__PURE__ */ ((a) => (a.default = "default", a.success = "success", a.warning = "warning", a.danger = "danger", a))(h || {});
|
|
6
6
|
function w({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as o } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
2
|
import { cx as t } from "@kuma-ui/core";
|
|
3
|
-
import {
|
|
3
|
+
import { I as r } from "../icon-Ci3BSxQa.mjs";
|
|
4
4
|
import i, { FlexAlignment as c } from "./flex.mjs";
|
|
5
5
|
import { textShadowStyles as j } from "./text.mjs";
|
|
6
6
|
import y from "./click-ripples.mjs";
|
|
@@ -8,10 +8,10 @@ import B, { normalBlendStyles as f } from "./hover-gradient.mjs";
|
|
|
8
8
|
import v from "./button-tooltip.mjs";
|
|
9
9
|
import N from "./aria-text.mjs";
|
|
10
10
|
import w from "./atom.mjs";
|
|
11
|
-
var S = /* @__PURE__ */ ((
|
|
11
|
+
var S = /* @__PURE__ */ ((e) => (e.primary = "primary", e.delete = "delete", e))(S || {});
|
|
12
12
|
const b = "kakadu-components-4017654514";
|
|
13
|
-
function
|
|
14
|
-
iconLeft:
|
|
13
|
+
function H({
|
|
14
|
+
iconLeft: e,
|
|
15
15
|
iconRight: s,
|
|
16
16
|
variant: p = "primary",
|
|
17
17
|
tooltip: n,
|
|
@@ -19,24 +19,24 @@ function I({
|
|
|
19
19
|
target: l,
|
|
20
20
|
rel: d,
|
|
21
21
|
className: k,
|
|
22
|
-
children:
|
|
22
|
+
children: a,
|
|
23
23
|
label: u,
|
|
24
24
|
...x
|
|
25
25
|
}) {
|
|
26
|
-
return /* @__PURE__ */ o.jsxs(w, { ...x, as: m ? "a" : "button", type: m ? void 0 : "button", href: m, target: l, rel: d, className: t(j, "kakadu-components-3563685584",
|
|
26
|
+
return /* @__PURE__ */ o.jsxs(w, { ...x, as: m ? "a" : "button", type: m ? void 0 : "button", href: m, target: l, rel: d, className: t(j, "kakadu-components-3563685584", a && (e || s) ? t(!!e && "kakadu-components-497190725", !!s && "kakadu-components-3729381008") : "kakadu-components-3866032606", p === "delete" && b, k), children: [
|
|
27
27
|
/* @__PURE__ */ o.jsxs(i, { direction: "row", gap: 0.5, alignment: c.center, children: [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
s ? /* @__PURE__ */ o.jsx("div", { className: t("kakadu-components-3184610208",
|
|
28
|
+
e ? /* @__PURE__ */ o.jsx("div", { className: t("kakadu-components-3184610208", a ? "kakadu-components-602380047" : "kakadu-components-233407571"), children: typeof e == "string" ? /* @__PURE__ */ o.jsx(r, { width: 14, height: 14, type: e }) : e }) : null,
|
|
29
|
+
a ? /* @__PURE__ */ o.jsx("span", { className: "kakadu-components-1760622304", children: a }) : /* @__PURE__ */ o.jsx(N, { children: u }),
|
|
30
|
+
s ? /* @__PURE__ */ o.jsx("div", { className: t("kakadu-components-3184610208", a ? "kakadu-components-1681694072" : "kakadu-components-233407571"), children: typeof s == "string" ? /* @__PURE__ */ o.jsx(r, { width: 14, height: 14, type: s }) : s }) : null
|
|
31
31
|
] }),
|
|
32
32
|
/* @__PURE__ */ o.jsxs("span", { className: "kakadu-components-1343580459", children: [
|
|
33
|
-
/* @__PURE__ */ o.jsx(y, { size:
|
|
34
|
-
/* @__PURE__ */ o.jsx(B, { size:
|
|
33
|
+
/* @__PURE__ */ o.jsx(y, { size: a ? void 0 : 50 }),
|
|
34
|
+
/* @__PURE__ */ o.jsx(B, { size: a ? void 0 : 50, className: f }),
|
|
35
35
|
n ? /* @__PURE__ */ o.jsx(v, { label: n }) : null
|
|
36
36
|
] })
|
|
37
37
|
] });
|
|
38
38
|
}
|
|
39
39
|
export {
|
|
40
40
|
S as TextButtonVariant,
|
|
41
|
-
|
|
41
|
+
H as default
|
|
42
42
|
};
|