@kakadu/components 6.13.3 → 6.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/checkbox.d.ts +1 -1
- package/build/components/checkbox.js +1 -1
- package/build/components/checkbox.mjs +58 -57
- package/build/components/input.d.ts +4 -2
- package/build/components/input.js +2 -2
- package/build/components/input.mjs +45 -44
- package/build/components/select.d.ts +1 -1
- package/build/components/select.js +1 -1
- package/build/components/select.mjs +18 -17
- package/package.json +1 -1
|
@@ -16,4 +16,4 @@ export type CheckboxProperties<Type extends boolean = boolean> = Omit<InputLabel
|
|
|
16
16
|
readonly children: ReactNode;
|
|
17
17
|
readonly onChange?: (value: Type, event: ChangeEvent<HTMLInputElement>) => void;
|
|
18
18
|
};
|
|
19
|
-
export default function Checkbox<Type extends boolean = boolean>({ label, disabled, error, warning, information, footnote, className, children, onChange, ...properties }: CheckboxProperties<Type>): React.JSX.Element;
|
|
19
|
+
export default function Checkbox<Type extends boolean = boolean>({ label, disabled, error, warning, information, footnote, className, labelClassName, children, onChange, ...properties }: CheckboxProperties<Type>): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-CZa898vN.js"),o=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-CZa898vN.js"),o=require("react"),m=require("@kuma-ui/core"),B=require("../icons/icon.js"),z=require("../theme.js"),w=require("./input.js"),V=require("./aria-text.js"),R=require("./flex.js"),b=require("./text.js"),T=require("./hover-gradient.js"),M=require("./click-ripples.js");function N({value:a,className:t}){return e.jsxRuntimeExports.jsx("div",{"aria-hidden":!0,className:m.cx("kakadu-components-483027860",a&&"kakadu-components-347512941",t),children:a?e.jsxRuntimeExports.jsx("div",{"data-theme":"dark",className:"kakadu-components-3323194660",children:e.jsxRuntimeExports.jsx(B.default,{type:"check",size:14,fill:"#fff",className:B.iconShadowStyles})}):null})}function C({label:a,disabled:t,className:d,children:c,onChange:s,...j}){const{value:r,...k}=j,[f,n]=o.useState(!1),i=r??f;o.useEffect(()=>{n(!!r)},[r]);const u=o.useCallback(l=>{const{checked:x}=l.target;n(x),s==null||s(x,l)},[s]);return e.jsxRuntimeExports.jsxs("label",{className:m.cx("kakadu-components-1233932825",t&&"kakadu-components-2246117376",d),children:[e.jsxRuntimeExports.jsx("input",{...k,type:"checkbox",checked:i,disabled:t,className:V.ariaTextStyles,onChange:u}),e.jsxRuntimeExports.jsxs(R.default,{direction:"row",gap:.75,children:[e.jsxRuntimeExports.jsx(N,{value:i}),e.jsxRuntimeExports.jsxs(R.default,{fill:!0,gap:.25,children:[e.jsxRuntimeExports.jsx(b.Span,{className:m.cx(z.overflowProtectionStyles,"kakadu-components-3627383913",i&&"kakadu-components-572005680"),children:a}),c?e.jsxRuntimeExports.jsx(b.Footnote,{children:c}):null]})]})]})}function G({label:a,disabled:t,error:d,warning:c,information:s,footnote:j,className:r,labelClassName:k,children:f,onChange:n,...i}){const u=o.useId(),l=`${u}-error`,x=`${u}-warning`,q=`${u}-information`,p=!!d,h=!p&&!!c,y=!p&&!h&&!!s,g=p?l:h?x:y?q:void 0,{value:E,...$}=i,[P,S]=o.useState(!1),v=E??P;o.useEffect(()=>{S(!!E)},[E]);const F=o.useCallback(I=>{const{checked:_}=I.target;S(_),n==null||n(_,I)},[n]);return e.jsxRuntimeExports.jsxs(w.InputLabel,{label:a,error:d,errorId:l,warning:c,warningId:x,information:s,informationId:q,footnote:j,className:m.cx("kakadu-components-1233932825",t&&"kakadu-components-2246117376",k),children:[e.jsxRuntimeExports.jsx("input",{...$,type:"checkbox",checked:v,disabled:t,"aria-invalid":p,"data-warning":h,"data-information":y,"aria-describedby":g,className:V.ariaTextStyles,onChange:F}),e.jsxRuntimeExports.jsxs("div",{className:m.cx(w.inputStyles,r),"aria-disabled":t?!0:void 0,children:[e.jsxRuntimeExports.jsxs(R.default,{direction:"row",gap:.75,className:"kakadu-components-1066891822",children:[e.jsxRuntimeExports.jsx(N,{value:v,className:"kakadu-components-3803487082"}),e.jsxRuntimeExports.jsx(b.Footnote,{className:"kakadu-components-4115080333",children:f})]}),t?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(T.default,{size:150,className:T.normalBlendStyles}),e.jsxRuntimeExports.jsx(M.default,{})]})]})]})}exports.CheckboxIcon=N;exports.TextCheckbox=C;exports.default=G;
|
|
@@ -1,93 +1,94 @@
|
|
|
1
1
|
import { j as e } from "../jsx-runtime-z6PQ6F3d.mjs";
|
|
2
|
-
import { useId as
|
|
3
|
-
import { cx as
|
|
4
|
-
import
|
|
5
|
-
import { overflowProtectionStyles as
|
|
6
|
-
import { InputLabel as
|
|
7
|
-
import { ariaTextStyles as
|
|
2
|
+
import { useId as G, useState as w, useEffect as V, useCallback as g } from "react";
|
|
3
|
+
import { cx as d } from "@kuma-ui/core";
|
|
4
|
+
import H, { iconShadowStyles as L } from "../icons/icon.mjs";
|
|
5
|
+
import { overflowProtectionStyles as W } from "../theme.mjs";
|
|
6
|
+
import { InputLabel as q, inputStyles as A } from "./input.mjs";
|
|
7
|
+
import { ariaTextStyles as E } from "./aria-text.mjs";
|
|
8
8
|
import N from "./flex.mjs";
|
|
9
|
-
import { Footnote as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
function
|
|
9
|
+
import { Footnote as F, Span as D } from "./text.mjs";
|
|
10
|
+
import J, { normalBlendStyles as K } from "./hover-gradient.mjs";
|
|
11
|
+
import M from "./click-ripples.mjs";
|
|
12
|
+
function P({
|
|
13
13
|
value: t,
|
|
14
14
|
className: a
|
|
15
15
|
}) {
|
|
16
|
-
return /* @__PURE__ */ e.jsx("div", { "aria-hidden": !0, className:
|
|
16
|
+
return /* @__PURE__ */ e.jsx("div", { "aria-hidden": !0, className: d("kakadu-components-483027860", t && "kakadu-components-347512941", a), children: t ? /* @__PURE__ */ e.jsx("div", { "data-theme": "dark", className: "kakadu-components-3323194660", children: /* @__PURE__ */ e.jsx(H, { type: "check", size: 14, fill: "#fff", className: L }) }) : null });
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function oe({
|
|
19
19
|
label: t,
|
|
20
20
|
disabled: a,
|
|
21
|
-
className:
|
|
22
|
-
children:
|
|
21
|
+
className: u,
|
|
22
|
+
children: n,
|
|
23
23
|
onChange: s,
|
|
24
|
-
...
|
|
24
|
+
...k
|
|
25
25
|
}) {
|
|
26
26
|
const {
|
|
27
|
-
value:
|
|
28
|
-
...
|
|
29
|
-
} =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}, [
|
|
33
|
-
const
|
|
27
|
+
value: c,
|
|
28
|
+
...x
|
|
29
|
+
} = k, [f, o] = w(!1), r = c ?? f;
|
|
30
|
+
V(() => {
|
|
31
|
+
o(!!c);
|
|
32
|
+
}, [c]);
|
|
33
|
+
const l = g((i) => {
|
|
34
34
|
const {
|
|
35
|
-
checked:
|
|
36
|
-
} =
|
|
37
|
-
|
|
35
|
+
checked: m
|
|
36
|
+
} = i.target;
|
|
37
|
+
o(m), s == null || s(m, i);
|
|
38
38
|
}, [s]);
|
|
39
|
-
return /* @__PURE__ */ e.jsxs("label", { className:
|
|
40
|
-
/* @__PURE__ */ e.jsx("input", { ...
|
|
39
|
+
return /* @__PURE__ */ e.jsxs("label", { className: d("kakadu-components-1233932825", a && "kakadu-components-2246117376", u), children: [
|
|
40
|
+
/* @__PURE__ */ e.jsx("input", { ...x, type: "checkbox", checked: r, disabled: a, className: E, onChange: l }),
|
|
41
41
|
/* @__PURE__ */ e.jsxs(N, { direction: "row", gap: 0.75, children: [
|
|
42
|
-
/* @__PURE__ */ e.jsx(
|
|
42
|
+
/* @__PURE__ */ e.jsx(P, { value: r }),
|
|
43
43
|
/* @__PURE__ */ e.jsxs(N, { fill: !0, gap: 0.25, children: [
|
|
44
|
-
/* @__PURE__ */ e.jsx(
|
|
45
|
-
|
|
44
|
+
/* @__PURE__ */ e.jsx(D, { className: d(W, "kakadu-components-3627383913", r && "kakadu-components-572005680"), children: t }),
|
|
45
|
+
n ? /* @__PURE__ */ e.jsx(F, { children: n }) : null
|
|
46
46
|
] })
|
|
47
47
|
] })
|
|
48
48
|
] });
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function te({
|
|
51
51
|
label: t,
|
|
52
52
|
disabled: a,
|
|
53
|
-
error:
|
|
54
|
-
warning:
|
|
53
|
+
error: u,
|
|
54
|
+
warning: n,
|
|
55
55
|
information: s,
|
|
56
|
-
footnote:
|
|
57
|
-
className:
|
|
56
|
+
footnote: k,
|
|
57
|
+
className: c,
|
|
58
|
+
labelClassName: x,
|
|
58
59
|
children: f,
|
|
59
|
-
onChange:
|
|
60
|
-
...
|
|
60
|
+
onChange: o,
|
|
61
|
+
...r
|
|
61
62
|
}) {
|
|
62
|
-
const
|
|
63
|
+
const l = G(), i = `${l}-error`, m = `${l}-warning`, y = `${l}-information`, p = !!u, h = !p && !!n, I = !p && !h && !!s, $ = p ? i : h ? m : I ? y : void 0, {
|
|
63
64
|
value: j,
|
|
64
|
-
|
|
65
|
-
} =
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
...z
|
|
66
|
+
} = r, [R, v] = w(!1), b = j ?? R;
|
|
67
|
+
V(() => {
|
|
68
|
+
v(!!j);
|
|
68
69
|
}, [j]);
|
|
69
|
-
const
|
|
70
|
+
const T = g((S) => {
|
|
70
71
|
const {
|
|
71
|
-
checked:
|
|
72
|
-
} =
|
|
73
|
-
|
|
74
|
-
}, [
|
|
75
|
-
return /* @__PURE__ */ e.jsxs(
|
|
76
|
-
/* @__PURE__ */ e.jsx("input", {
|
|
77
|
-
/* @__PURE__ */ e.jsxs("div", { className:
|
|
72
|
+
checked: B
|
|
73
|
+
} = S.target;
|
|
74
|
+
v(B), o == null || o(B, S);
|
|
75
|
+
}, [o]);
|
|
76
|
+
return /* @__PURE__ */ e.jsxs(q, { label: t, error: u, errorId: i, warning: n, warningId: m, information: s, informationId: y, footnote: k, className: d("kakadu-components-1233932825", a && "kakadu-components-2246117376", x), children: [
|
|
77
|
+
/* @__PURE__ */ e.jsx("input", { ...z, type: "checkbox", checked: b, disabled: a, "aria-invalid": p, "data-warning": h, "data-information": I, "aria-describedby": $, className: E, onChange: T }),
|
|
78
|
+
/* @__PURE__ */ e.jsxs("div", { className: d(A, c), "aria-disabled": a ? !0 : void 0, children: [
|
|
78
79
|
/* @__PURE__ */ e.jsxs(N, { direction: "row", gap: 0.75, className: "kakadu-components-1066891822", children: [
|
|
79
|
-
/* @__PURE__ */ e.jsx(
|
|
80
|
-
/* @__PURE__ */ e.jsx(
|
|
80
|
+
/* @__PURE__ */ e.jsx(P, { value: b, className: "kakadu-components-3803487082" }),
|
|
81
|
+
/* @__PURE__ */ e.jsx(F, { className: "kakadu-components-4115080333", children: f })
|
|
81
82
|
] }),
|
|
82
83
|
a ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
83
|
-
/* @__PURE__ */ e.jsx(
|
|
84
|
-
/* @__PURE__ */ e.jsx(
|
|
84
|
+
/* @__PURE__ */ e.jsx(J, { size: 150, className: K }),
|
|
85
|
+
/* @__PURE__ */ e.jsx(M, {})
|
|
85
86
|
] })
|
|
86
87
|
] })
|
|
87
88
|
] });
|
|
88
89
|
}
|
|
89
90
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
P as CheckboxIcon,
|
|
92
|
+
oe as TextCheckbox,
|
|
93
|
+
te as default
|
|
93
94
|
};
|
|
@@ -20,7 +20,9 @@ type InputLabelProperties = HTMLProps<HTMLLabelElement> & InputLabelMessagePrope
|
|
|
20
20
|
readonly attachments?: ReactNode;
|
|
21
21
|
};
|
|
22
22
|
export declare function InputLabel({ label, error, errorId, warning, warningId, information, informationId, footnote, attachments, className, children, ...properties }: InputLabelProperties): React.JSX.Element;
|
|
23
|
-
export type InputLabelControllerProperties = Omit<InputLabelProperties, 'errorId' | 'warningId' | 'attachments' | 'onClick' | 'onMouseDown' | 'onMouseUp' | 'onChange' | 'onFocus' | 'onBlur' | 'onInput' | 'onBeforeInput'
|
|
23
|
+
export type InputLabelControllerProperties = Omit<InputLabelProperties, 'errorId' | 'warningId' | 'attachments' | 'onClick' | 'onMouseDown' | 'onMouseUp' | 'onChange' | 'onFocus' | 'onBlur' | 'onInput' | 'onBeforeInput'> & {
|
|
24
|
+
readonly labelClassName?: string;
|
|
25
|
+
};
|
|
24
26
|
export type InputType = HTMLInputElement | HTMLTextAreaElement;
|
|
25
27
|
export type InputAction = {
|
|
26
28
|
icon: IconType;
|
|
@@ -36,5 +38,5 @@ export type InputProperties = Omit<InputLabelControllerProperties & Omit<HTMLPro
|
|
|
36
38
|
readonly isMultiline?: boolean;
|
|
37
39
|
readonly onChange?: (value: string, event: ChangeEvent<InputType>) => void;
|
|
38
40
|
};
|
|
39
|
-
export default function Input({ ref, type, label, error, warning, information, footnote, suggestion, attachments, actions, hasCopyButton, hasClearButton, isMultiline, onChange, children, className, ...properties }: InputProperties): React.JSX.Element;
|
|
41
|
+
export default function Input({ ref, type, label, error, warning, information, footnote, suggestion, attachments, actions, hasCopyButton, hasClearButton, isMultiline, onChange, children, className, labelClassName, ...properties }: InputProperties): React.JSX.Element;
|
|
40
42
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-CZa898vN.js"),t=require("react"),
|
|
2
|
-
`):[],[o]),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-CZa898vN.js"),t=require("react"),c=require("@kuma-ui/core"),Q=require("../utilities/copy-to-clipboard.js"),M=require("../theme.js"),je=require("../icons/sparkle.js"),ke=require("./button-tooltip.js"),B=require("./text-button.js"),x=require("./text.js"),fe=require("./collapsible.js"),X=require("./click-ripples.js"),Y=require("./hover-gradient.js"),he=require("./notification.js"),Ee="kakadu-components-922159086",Re="kakadu-components-25448712",v="kakadu-components-3308836726",T="kakadu-components-4056037255",Z=c.cx(T,"kakadu-components-3245407458"),be=c.cx(T,"kakadu-components-1117160492"),ge=c.cx(T,"kakadu-components-821835704");function ee({as:p,className:r,...m}){return e.jsxRuntimeExports.jsx(x.Span,{as:p??"span",...m,className:c.cx("kakadu-components-2675681525",r)})}function te({label:p,error:r,errorId:m,warning:l,warningId:h,information:i,informationId:S,footnote:a,attachments:C,className:d,children:j,...k}){const E=!!r,u=!!l,R=!!i,f=!!a;return e.jsxRuntimeExports.jsx("label",{...k,className:c.cx(Ee,d),children:e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[e.jsxRuntimeExports.jsx(x.Span,{className:c.cx(M.overflowProtectionStyles,Re),children:e.jsxRuntimeExports.jsx("span",{children:p})}),e.jsxRuntimeExports.jsxs("span",{className:"kakadu-components-3298764637",children:[j,f?e.jsxRuntimeExports.jsx(ee,{children:a}):null,C]}),E||u||R?e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2927674627",children:E?e.jsxRuntimeExports.jsx(x.Paragraph,{id:m,className:Z,children:r instanceof Error?r.message:r}):u?e.jsxRuntimeExports.jsx(x.Paragraph,{id:h,className:be,children:l instanceof Error?l.message:l}):R?e.jsxRuntimeExports.jsx(x.Paragraph,{id:S,className:ge,children:i instanceof Error?i.message:i}):null}):null]})})}const ye=40,L="kakadu-components-4233741488";function Ne({ref:p,type:r,label:m,error:l,warning:h,information:i,footnote:S,suggestion:a,attachments:C,actions:d=[],hasCopyButton:j,hasClearButton:k,isMultiline:E,onChange:u,children:R,className:f,labelClassName:se,...b}){const $=t.useRef(null),A=t.useRef(null),q=t.useRef(null),H=he.useCreateNotification(),I=t.useId(),F=`${I}-error`,V=`${I}-warning`,O=`${I}-information`,{value:g,disabled:ne}=b,[ae,W]=t.useState(""),o=g??ae,[oe,ce]=t.useState(),re=r==="textarea"||!!E;t.useLayoutEffect(()=>{typeof o=="string"&&q.current&&ce(q.current.scrollHeight)},[o]);const P=t.useMemo(()=>typeof o=="string"?`${o} `.split(`
|
|
2
|
+
`):[],[o]),le=t.useMemo(()=>P.length,[P]),y=!!l,_=!y&&!!h,w=!!i,z=y?F:_?V:w?O:void 0;t.useEffect(()=>{W(typeof g=="string"?g:"")},[g]);const D=t.useCallback(s=>{const{value:n}=s.target;W(n),u==null||u(n,s)},[u]),ie=t.useCallback(()=>{typeof o=="string"&&(Q.default(o),H({type:"success",children:"Copied to clipboard."}))},[o,H]),N=t.useCallback(s=>{var J;const n=A.current??$.current??void 0;if(n){const K=(J=Object.getOwnPropertyDescriptor(n instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value"))==null?void 0:J.set;if(K){K.call(n,s);const de=new Event("input",{bubbles:!0});n.dispatchEvent(de),n.focus();return}}throw new Error("Unable to set value.")},[]),ue=t.useCallback(()=>{N("")},[N]),[xe,pe]=t.useState(""),G=!!a&&xe!==a,me=t.useCallback(()=>{if(a){try{N(a)}catch{Q.default(a)}pe(a)}},[a,N]),U=t.useMemo(()=>d.length,[d]);return e.jsxRuntimeExports.jsxs(te,{ref:p,label:m,error:l,errorId:F,warning:h,warningId:V,information:i,informationId:O,footnote:S,attachments:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.default,{isCollapsed:!G,children:G?e.jsxRuntimeExports.jsxs("button",{type:"button",className:c.cx(M.buttonResetStyles,M.overflowProtectionStyles,"kakadu-components-4141839293"),onClick:me,children:[e.jsxRuntimeExports.jsx(ke.default,{label:"Apply suggestion"}),e.jsxRuntimeExports.jsx(je.default,{width:13,height:13,className:"kakadu-components-1417828741"}),e.jsxRuntimeExports.jsx(x.Span,{className:"kakadu-components-1384720019",children:a}),e.jsxRuntimeExports.jsx(X.default,{className:"kakadu-components-2744733744"}),e.jsxRuntimeExports.jsx(Y.default,{})]}):null}),C]}),style:{"--button-padding":`calc(${ye*((j?1:0)+(k?1:0)+U)}px + 6px)`},className:se,children:[e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[re?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{ref:q,"aria-hidden":!0,className:c.cx(v,f,"kakadu-components-2033521835"),children:[P.map((s,n)=>e.jsxRuntimeExports.jsxs("span",{children:[s,le>1?e.jsxRuntimeExports.jsx("br",{}):null]},n))," "]}),e.jsxRuntimeExports.jsx("textarea",{...b,ref:A,rows:b.rows??1,"aria-invalid":y,"data-warning":_,"data-information":w,"aria-describedby":z,value:o,className:c.cx(v,f,"kakadu-components-2119524139"),style:{minHeight:oe},onChange:D})]}):e.jsxRuntimeExports.jsx("input",{...b,ref:$,type:r??"text",value:o,"aria-invalid":y,"data-warning":_,"data-information":w,"aria-describedby":z,className:c.cx(v,f),onChange:D}),ne?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(X.default,{className:"kakadu-components-616311160"}),e.jsxRuntimeExports.jsx(Y.default,{className:"kakadu-components-1962999040"})]})]}),j||k||U>0?e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-131986363",children:[d.map((s,n)=>e.jsxRuntimeExports.jsx(B.default,{iconLeft:s.icon,label:s.label,tooltip:s.label,className:L,onClick:s.onClick},s.label+n)),j?e.jsxRuntimeExports.jsx(B.default,{iconLeft:"copy",label:"Copy",tooltip:"Copy",className:L,onClick:ie}):null,k?e.jsxRuntimeExports.jsx(B.default,{iconLeft:"times",label:"Clear",tooltip:"Clear",className:L,onClick:ue}):null]}):null,R]})}exports.InputAttachment=ee;exports.InputLabel=te;exports.default=Ne;exports.errorParagraph=Z;exports.inputStyles=v;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { j as e } from "../jsx-runtime-z6PQ6F3d.mjs";
|
|
2
|
-
import { useRef as P, useId as
|
|
2
|
+
import { useRef as P, useId as he, useState as T, useLayoutEffect as xe, useMemo as H, useEffect as je, useCallback as h } from "react";
|
|
3
3
|
import { cx as o } from "@kuma-ui/core";
|
|
4
4
|
import _ from "../utilities/copy-to-clipboard.mjs";
|
|
5
|
-
import { buttonResetStyles as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
5
|
+
import { buttonResetStyles as be, overflowProtectionStyles as te } from "../theme.mjs";
|
|
6
|
+
import ye from "../icons/sparkle.mjs";
|
|
7
|
+
import ge from "./button-tooltip.mjs";
|
|
8
8
|
import R from "./text-button.mjs";
|
|
9
9
|
import { Span as F, Paragraph as A } from "./text.mjs";
|
|
10
|
-
import
|
|
10
|
+
import Ne from "./collapsible.mjs";
|
|
11
11
|
import ee from "./click-ripples.mjs";
|
|
12
12
|
import ne from "./hover-gradient.mjs";
|
|
13
|
-
import { useCreateNotification as
|
|
14
|
-
const
|
|
15
|
-
function
|
|
13
|
+
import { useCreateNotification as ve } from "./notification.mjs";
|
|
14
|
+
const Ce = "kakadu-components-922159086", Se = "kakadu-components-25448712", M = "kakadu-components-3308836726", V = "kakadu-components-4056037255", Ee = o(V, "kakadu-components-3245407458"), Ie = o(V, "kakadu-components-1117160492"), Be = o(V, "kakadu-components-821835704");
|
|
15
|
+
function we({
|
|
16
16
|
as: d,
|
|
17
17
|
className: l,
|
|
18
18
|
...m
|
|
19
19
|
}) {
|
|
20
20
|
return /* @__PURE__ */ e.jsx(F, { as: d ?? "span", ...m, className: o("kakadu-components-2675681525", l) });
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function Le({
|
|
23
23
|
label: d,
|
|
24
24
|
error: l,
|
|
25
25
|
errorId: m,
|
|
@@ -34,18 +34,18 @@ function we({
|
|
|
34
34
|
...k
|
|
35
35
|
}) {
|
|
36
36
|
const j = !!l, i = !!c, b = !!r, f = !!a;
|
|
37
|
-
return /* @__PURE__ */ e.jsx("label", { ...k, className: o(
|
|
38
|
-
/* @__PURE__ */ e.jsx(F, { className: o(te,
|
|
37
|
+
return /* @__PURE__ */ e.jsx("label", { ...k, className: o(Ce, p), children: /* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-3146929190", children: [
|
|
38
|
+
/* @__PURE__ */ e.jsx(F, { className: o(te, Se), children: /* @__PURE__ */ e.jsx("span", { children: d }) }),
|
|
39
39
|
/* @__PURE__ */ e.jsxs("span", { className: "kakadu-components-3298764637", children: [
|
|
40
40
|
u,
|
|
41
|
-
f ? /* @__PURE__ */ e.jsx(
|
|
41
|
+
f ? /* @__PURE__ */ e.jsx(we, { children: a }) : null,
|
|
42
42
|
S
|
|
43
43
|
] }),
|
|
44
|
-
j || i || b ? /* @__PURE__ */ e.jsx("div", { className: "kakadu-components-2927674627", children: j ? /* @__PURE__ */ e.jsx(A, { id: m, className:
|
|
44
|
+
j || i || b ? /* @__PURE__ */ e.jsx("div", { className: "kakadu-components-2927674627", children: j ? /* @__PURE__ */ e.jsx(A, { id: m, className: Ee, children: l instanceof Error ? l.message : l }) : i ? /* @__PURE__ */ e.jsx(A, { id: x, className: Ie, children: c instanceof Error ? c.message : c }) : b ? /* @__PURE__ */ e.jsx(A, { id: C, className: Be, children: r instanceof Error ? r.message : r }) : null }) : null
|
|
45
45
|
] }) });
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
function
|
|
47
|
+
const Pe = 40, $ = "kakadu-components-4233741488";
|
|
48
|
+
function Ue({
|
|
49
49
|
ref: d,
|
|
50
50
|
type: l,
|
|
51
51
|
label: m,
|
|
@@ -62,18 +62,19 @@ function Ge({
|
|
|
62
62
|
onChange: i,
|
|
63
63
|
children: b,
|
|
64
64
|
className: f,
|
|
65
|
+
labelClassName: ae,
|
|
65
66
|
...y
|
|
66
67
|
}) {
|
|
67
|
-
const O = P(null), W = P(null), E = P(null), z =
|
|
68
|
+
const O = P(null), W = P(null), E = P(null), z = ve(), I = he(), D = `${I}-error`, G = `${I}-warning`, U = `${I}-information`, {
|
|
68
69
|
value: g,
|
|
69
|
-
disabled:
|
|
70
|
-
} = y, [
|
|
71
|
-
|
|
72
|
-
typeof s == "string" && E.current &&
|
|
70
|
+
disabled: se
|
|
71
|
+
} = y, [oe, q] = T(""), s = g ?? oe, [le, ce] = T(), re = l === "textarea" || !!j;
|
|
72
|
+
xe(() => {
|
|
73
|
+
typeof s == "string" && E.current && ce(E.current.scrollHeight);
|
|
73
74
|
}, [s]);
|
|
74
75
|
const B = H(() => typeof s == "string" ? `${s} `.split(`
|
|
75
|
-
`) : [], [s]),
|
|
76
|
-
|
|
76
|
+
`) : [], [s]), ie = H(() => B.length, [B]), N = !!c, w = !N && !!x, L = !!r, J = N ? D : w ? G : L ? U : void 0;
|
|
77
|
+
je(() => {
|
|
77
78
|
q(typeof g == "string" ? g : "");
|
|
78
79
|
}, [g]);
|
|
79
80
|
const K = h((n) => {
|
|
@@ -81,7 +82,7 @@ function Ge({
|
|
|
81
82
|
value: t
|
|
82
83
|
} = n.target;
|
|
83
84
|
q(t), i == null || i(t, n);
|
|
84
|
-
}, [i]),
|
|
85
|
+
}, [i]), de = h(() => {
|
|
85
86
|
typeof s == "string" && (_(s), z({
|
|
86
87
|
type: "success",
|
|
87
88
|
children: "Copied to clipboard."
|
|
@@ -93,55 +94,55 @@ function Ge({
|
|
|
93
94
|
const Z = (Y = Object.getOwnPropertyDescriptor(t instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype, "value")) == null ? void 0 : Y.set;
|
|
94
95
|
if (Z) {
|
|
95
96
|
Z.call(t, n);
|
|
96
|
-
const
|
|
97
|
+
const fe = new Event("input", {
|
|
97
98
|
bubbles: !0
|
|
98
99
|
});
|
|
99
|
-
t.dispatchEvent(
|
|
100
|
+
t.dispatchEvent(fe), t.focus();
|
|
100
101
|
return;
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
throw new Error("Unable to set value.");
|
|
104
|
-
}, []),
|
|
105
|
+
}, []), me = h(() => {
|
|
105
106
|
v("");
|
|
106
|
-
}, [v]), [
|
|
107
|
+
}, [v]), [pe, ue] = T(""), Q = !!a && pe !== a, ke = h(() => {
|
|
107
108
|
if (a) {
|
|
108
109
|
try {
|
|
109
110
|
v(a);
|
|
110
111
|
} catch {
|
|
111
112
|
_(a);
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
+
ue(a);
|
|
114
115
|
}
|
|
115
116
|
}, [a, v]), X = H(() => p.length, [p]);
|
|
116
|
-
return /* @__PURE__ */ e.jsxs(
|
|
117
|
-
/* @__PURE__ */ e.jsx(
|
|
118
|
-
/* @__PURE__ */ e.jsx(
|
|
119
|
-
/* @__PURE__ */ e.jsx(
|
|
117
|
+
return /* @__PURE__ */ e.jsxs(Le, { ref: d, label: m, error: c, errorId: D, warning: x, warningId: G, information: r, informationId: U, footnote: C, attachments: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
118
|
+
/* @__PURE__ */ e.jsx(Ne, { isCollapsed: !Q, children: Q ? /* @__PURE__ */ e.jsxs("button", { type: "button", className: o(be, te, "kakadu-components-4141839293"), onClick: ke, children: [
|
|
119
|
+
/* @__PURE__ */ e.jsx(ge, { label: "Apply suggestion" }),
|
|
120
|
+
/* @__PURE__ */ e.jsx(ye, { width: 13, height: 13, className: "kakadu-components-1417828741" }),
|
|
120
121
|
/* @__PURE__ */ e.jsx(F, { className: "kakadu-components-1384720019", children: a }),
|
|
121
122
|
/* @__PURE__ */ e.jsx(ee, { className: "kakadu-components-2744733744" }),
|
|
122
123
|
/* @__PURE__ */ e.jsx(ne, {})
|
|
123
124
|
] }) : null }),
|
|
124
125
|
S
|
|
125
126
|
] }), style: {
|
|
126
|
-
"--button-padding": `calc(${
|
|
127
|
-
}, children: [
|
|
127
|
+
"--button-padding": `calc(${Pe * ((u ? 1 : 0) + (k ? 1 : 0) + X)}px + 6px)`
|
|
128
|
+
}, className: ae, children: [
|
|
128
129
|
/* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-3146929190", children: [
|
|
129
|
-
|
|
130
|
+
re ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
130
131
|
/* @__PURE__ */ e.jsxs("span", { ref: E, "aria-hidden": !0, className: o(M, f, "kakadu-components-2033521835"), children: [
|
|
131
132
|
B.map((n, t) => (
|
|
132
133
|
// eslint-disable-next-line react/no-array-index-key
|
|
133
134
|
/* @__PURE__ */ e.jsxs("span", { children: [
|
|
134
135
|
n,
|
|
135
|
-
|
|
136
|
+
ie > 1 ? /* @__PURE__ */ e.jsx("br", {}) : null
|
|
136
137
|
] }, t)
|
|
137
138
|
)),
|
|
138
139
|
" "
|
|
139
140
|
] }),
|
|
140
141
|
/* @__PURE__ */ e.jsx("textarea", { ...y, ref: W, rows: y.rows ?? 1, "aria-invalid": N, "data-warning": w, "data-information": L, "aria-describedby": J, value: s, className: o(M, f, "kakadu-components-2119524139"), style: {
|
|
141
|
-
minHeight:
|
|
142
|
+
minHeight: le
|
|
142
143
|
}, onChange: K })
|
|
143
144
|
] }) : /* @__PURE__ */ e.jsx("input", { ...y, ref: O, type: l ?? "text", value: s, "aria-invalid": N, "data-warning": w, "data-information": L, "aria-describedby": J, className: o(M, f), onChange: K }),
|
|
144
|
-
|
|
145
|
+
se ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
145
146
|
/* @__PURE__ */ e.jsx(ee, { className: "kakadu-components-616311160" }),
|
|
146
147
|
/* @__PURE__ */ e.jsx(ne, { className: "kakadu-components-1962999040" })
|
|
147
148
|
] })
|
|
@@ -158,16 +159,16 @@ function Ge({
|
|
|
158
159
|
},
|
|
159
160
|
n.label + t
|
|
160
161
|
)),
|
|
161
|
-
u ? /* @__PURE__ */ e.jsx(R, { iconLeft: "copy", label: "Copy", tooltip: "Copy", className: $, onClick:
|
|
162
|
-
k ? /* @__PURE__ */ e.jsx(R, { iconLeft: "times", label: "Clear", tooltip: "Clear", className: $, onClick:
|
|
162
|
+
u ? /* @__PURE__ */ e.jsx(R, { iconLeft: "copy", label: "Copy", tooltip: "Copy", className: $, onClick: de }) : null,
|
|
163
|
+
k ? /* @__PURE__ */ e.jsx(R, { iconLeft: "times", label: "Clear", tooltip: "Clear", className: $, onClick: me }) : null
|
|
163
164
|
] }) : null,
|
|
164
165
|
b
|
|
165
166
|
] });
|
|
166
167
|
}
|
|
167
168
|
export {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
we as InputAttachment,
|
|
170
|
+
Le as InputLabel,
|
|
171
|
+
Ue as default,
|
|
172
|
+
Ee as errorParagraph,
|
|
172
173
|
M as inputStyles
|
|
173
174
|
};
|
|
@@ -11,4 +11,4 @@ export type SelectProperties<Type extends string = string> = Omit<InputLabelCont
|
|
|
11
11
|
readonly options: Array<SelectOption<Type>>;
|
|
12
12
|
readonly onChange?: (value: Type, event: ChangeEvent<HTMLSelectElement>) => void;
|
|
13
13
|
};
|
|
14
|
-
export default function Select<Type extends string = string>({ label, options, error, warning, information, footnote, className, onChange, ...properties }: SelectProperties<Type>): React.JSX.Element;
|
|
14
|
+
export default function Select<Type extends string = string>({ label, options, error, warning, information, footnote, className, labelClassName, onChange, ...properties }: SelectProperties<Type>): React.JSX.Element;
|
|
@@ -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 s=require("../jsx-runtime-CZa898vN.js"),l=require("react"),S=require("@kuma-ui/core"),B=require("../icons/chevron-up.js"),f=require("./input.js");function _({label:h,options:y,error:i,warning:c,information:d,footnote:E,className:I,labelClassName:q,onChange:t,...x}){const o=l.useId(),m=`${o}-error`,p=`${o}-warning`,j=`${o}-information`,a=!!i,u=!a&&!!c,v=!a&&!u&&!!d,R=a?m:u?p:v?j:void 0,{value:n}=x,[$,b]=l.useState(""),g=n??$;l.useEffect(()=>{b(typeof n=="string"?n:"")},[n]);const k=l.useCallback(e=>{const{value:r}=e.target;b(r),t==null||t(r,e)},[t]);return s.jsxRuntimeExports.jsxs(f.InputLabel,{label:h,error:i,errorId:m,warning:c,warningId:p,information:d,informationId:j,footnote:E,className:q,children:[s.jsxRuntimeExports.jsx("select",{...x,value:g,"aria-invalid":a,"data-warning":u,"data-information":v,"aria-describedby":R,className:S.cx(f.inputStyles,"kakadu-components-1997515934",I),onChange:k,children:y.map((e,r)=>"type"in e?e.type==="separator"?s.jsxRuntimeExports.jsx("hr",{},`separator-${r}`):null:s.jsxRuntimeExports.jsx("option",{value:e.value,disabled:e.disabled,children:e.label},e.value))}),s.jsxRuntimeExports.jsx(B.default,{width:14,height:14,className:"kakadu-components-158931186"})]})}exports.default=_;
|
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import { j as e } from "../jsx-runtime-z6PQ6F3d.mjs";
|
|
2
|
-
import { useId as
|
|
2
|
+
import { useId as $, useState as w, useEffect as E, useCallback as N } from "react";
|
|
3
3
|
import { cx as V } from "@kuma-ui/core";
|
|
4
|
-
import
|
|
5
|
-
import { InputLabel as
|
|
6
|
-
function
|
|
4
|
+
import L from "../icons/chevron-up.mjs";
|
|
5
|
+
import { InputLabel as R, inputStyles as U } from "./input.mjs";
|
|
6
|
+
function F({
|
|
7
7
|
label: h,
|
|
8
8
|
options: b,
|
|
9
|
-
error:
|
|
10
|
-
warning:
|
|
9
|
+
error: c,
|
|
10
|
+
warning: i,
|
|
11
11
|
information: d,
|
|
12
12
|
footnote: j,
|
|
13
13
|
className: I,
|
|
14
|
-
|
|
14
|
+
labelClassName: y,
|
|
15
|
+
onChange: s,
|
|
15
16
|
...u
|
|
16
17
|
}) {
|
|
17
|
-
const l =
|
|
18
|
+
const l = $(), m = `${l}-error`, f = `${l}-warning`, p = `${l}-information`, t = !!c, o = !t && !!i, v = !t && !o && !!d, k = t ? m : o ? f : v ? p : void 0, {
|
|
18
19
|
value: r
|
|
19
|
-
} = u, [
|
|
20
|
-
|
|
20
|
+
} = u, [g, x] = w(""), B = r ?? g;
|
|
21
|
+
E(() => {
|
|
21
22
|
x(typeof r == "string" ? r : "");
|
|
22
23
|
}, [r]);
|
|
23
|
-
const
|
|
24
|
+
const S = N((a) => {
|
|
24
25
|
const {
|
|
25
26
|
value: n
|
|
26
27
|
} = a.target;
|
|
27
|
-
x(n),
|
|
28
|
-
}, [
|
|
29
|
-
return /* @__PURE__ */ e.jsxs(
|
|
30
|
-
/* @__PURE__ */ e.jsx("select", { ...u, value:
|
|
28
|
+
x(n), s == null || s(n, a);
|
|
29
|
+
}, [s]);
|
|
30
|
+
return /* @__PURE__ */ e.jsxs(R, { label: h, error: c, errorId: m, warning: i, warningId: f, information: d, informationId: p, footnote: j, className: y, children: [
|
|
31
|
+
/* @__PURE__ */ e.jsx("select", { ...u, value: B, "aria-invalid": t, "data-warning": o, "data-information": v, "aria-describedby": k, className: V(U, "kakadu-components-1997515934", I), onChange: S, children: b.map((a, n) => "type" in a ? a.type === "separator" ? (
|
|
31
32
|
// eslint-disable-next-line react/no-array-index-key
|
|
32
33
|
/* @__PURE__ */ e.jsx("hr", {}, `separator-${n}`)
|
|
33
34
|
) : null : /* @__PURE__ */ e.jsx("option", { value: a.value, disabled: a.disabled, children: a.label }, a.value)) }),
|
|
34
|
-
/* @__PURE__ */ e.jsx(
|
|
35
|
+
/* @__PURE__ */ e.jsx(L, { width: 14, height: 14, className: "kakadu-components-158931186" })
|
|
35
36
|
] });
|
|
36
37
|
}
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
+
F as default
|
|
39
40
|
};
|