@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.
@@ -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"),j=require("@kuma-ui/core"),_=require("../icons/icon.js"),F=require("../theme.js"),B=require("./input.js"),T=require("./aria-text.js"),R=require("./flex.js"),b=require("./text.js"),w=require("./hover-gradient.js"),z=require("./click-ripples.js");function N({value:a,className:t}){return e.jsxRuntimeExports.jsx("div",{"aria-hidden":!0,className:j.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(_.default,{type:"check",size:14,fill:"#fff",className:_.iconShadowStyles})}):null})}function M({label:a,disabled:t,className:x,children:r,onChange:s,...k}){const{value:i,...f}=k,[c,m]=o.useState(!1),n=i??c;o.useEffect(()=>{m(!!i)},[i]);const d=o.useCallback(u=>{const{checked:l}=u.target;m(l),s==null||s(l,u)},[s]);return e.jsxRuntimeExports.jsxs("label",{className:j.cx("kakadu-components-1233932825",t&&"kakadu-components-2246117376",x),children:[e.jsxRuntimeExports.jsx("input",{...f,type:"checkbox",checked:n,disabled:t,className:T.ariaTextStyles,onChange:d}),e.jsxRuntimeExports.jsxs(R.default,{direction:"row",gap:.75,children:[e.jsxRuntimeExports.jsx(N,{value:n}),e.jsxRuntimeExports.jsxs(R.default,{fill:!0,gap:.25,children:[e.jsxRuntimeExports.jsx(b.Span,{className:j.cx(F.overflowProtectionStyles,"kakadu-components-3627383913",n&&"kakadu-components-572005680"),children:a}),r?e.jsxRuntimeExports.jsx(b.Footnote,{children:r}):null]})]})]})}function C({label:a,disabled:t,error:x,warning:r,information:s,footnote:k,className:i,children:f,onChange:c,...m}){const n=o.useId(),d=`${n}-error`,u=`${n}-warning`,l=`${n}-information`,p=!!x,h=!p&&!!r,q=!p&&!h&&!!s,V=p?d:h?u:q?l:void 0,{value:E,...g}=m,[$,y]=o.useState(!1),S=E??$;o.useEffect(()=>{y(!!E)},[E]);const P=o.useCallback(v=>{const{checked:I}=v.target;y(I),c==null||c(I,v)},[c]);return e.jsxRuntimeExports.jsxs(B.InputLabel,{label:a,error:x,errorId:d,warning:r,warningId:u,information:s,informationId:l,footnote:k,className:j.cx("kakadu-components-1233932825",t&&"kakadu-components-2246117376",i),children:[e.jsxRuntimeExports.jsx("input",{...g,type:"checkbox",checked:S,disabled:t,"aria-invalid":p,"data-warning":h,"data-information":q,"aria-describedby":V,className:T.ariaTextStyles,onChange:P}),e.jsxRuntimeExports.jsxs("div",{className:B.inputStyles,"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:S,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(w.default,{size:150,className:w.normalBlendStyles}),e.jsxRuntimeExports.jsx(z.default,{})]})]})]})}exports.CheckboxIcon=N;exports.TextCheckbox=M;exports.default=C;
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 T, useState as B, useEffect as w, useCallback as V } from "react";
3
- import { cx as k } from "@kuma-ui/core";
4
- import G, { iconShadowStyles as H } from "../icons/icon.mjs";
5
- import { overflowProtectionStyles as L } from "../theme.mjs";
6
- import { InputLabel as W, inputStyles as q } from "./input.mjs";
7
- import { ariaTextStyles as g } from "./aria-text.mjs";
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 E, Span as A } from "./text.mjs";
10
- import D, { normalBlendStyles as J } from "./hover-gradient.mjs";
11
- import K from "./click-ripples.mjs";
12
- function F({
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: k("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(G, { type: "check", size: 14, fill: "#fff", className: H }) }) : null });
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 se({
18
+ function oe({
19
19
  label: t,
20
20
  disabled: a,
21
- className: m,
22
- children: c,
21
+ className: u,
22
+ children: n,
23
23
  onChange: s,
24
- ...x
24
+ ...k
25
25
  }) {
26
26
  const {
27
- value: r,
28
- ...f
29
- } = x, [n, d] = B(!1), o = r ?? n;
30
- w(() => {
31
- d(!!r);
32
- }, [r]);
33
- const u = V((l) => {
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: i
36
- } = l.target;
37
- d(i), s == null || s(i, l);
35
+ checked: m
36
+ } = i.target;
37
+ o(m), s == null || s(m, i);
38
38
  }, [s]);
39
- return /* @__PURE__ */ e.jsxs("label", { className: k("kakadu-components-1233932825", a && "kakadu-components-2246117376", m), children: [
40
- /* @__PURE__ */ e.jsx("input", { ...f, type: "checkbox", checked: o, disabled: a, className: g, onChange: u }),
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(F, { value: o }),
42
+ /* @__PURE__ */ e.jsx(P, { value: r }),
43
43
  /* @__PURE__ */ e.jsxs(N, { fill: !0, gap: 0.25, children: [
44
- /* @__PURE__ */ e.jsx(A, { className: k(L, "kakadu-components-3627383913", o && "kakadu-components-572005680"), children: t }),
45
- c ? /* @__PURE__ */ e.jsx(E, { children: c }) : null
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 oe({
50
+ function te({
51
51
  label: t,
52
52
  disabled: a,
53
- error: m,
54
- warning: c,
53
+ error: u,
54
+ warning: n,
55
55
  information: s,
56
- footnote: x,
57
- className: r,
56
+ footnote: k,
57
+ className: c,
58
+ labelClassName: x,
58
59
  children: f,
59
- onChange: n,
60
- ...d
60
+ onChange: o,
61
+ ...r
61
62
  }) {
62
- const o = T(), u = `${o}-error`, l = `${o}-warning`, i = `${o}-information`, p = !!m, h = !p && !!c, y = !p && !h && !!s, P = p ? u : h ? l : y ? i : void 0, {
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
- } = d, [z, I] = B(!1), v = j ?? z;
66
- w(() => {
67
- I(!!j);
65
+ ...z
66
+ } = r, [R, v] = w(!1), b = j ?? R;
67
+ V(() => {
68
+ v(!!j);
68
69
  }, [j]);
69
- const R = V((b) => {
70
+ const T = g((S) => {
70
71
  const {
71
- checked: S
72
- } = b.target;
73
- I(S), n == null || n(S, b);
74
- }, [n]);
75
- return /* @__PURE__ */ e.jsxs(W, { label: t, error: m, errorId: u, warning: c, warningId: l, information: s, informationId: i, footnote: x, className: k("kakadu-components-1233932825", a && "kakadu-components-2246117376", r), children: [
76
- /* @__PURE__ */ e.jsx("input", { ...$, type: "checkbox", checked: v, disabled: a, "aria-invalid": p, "data-warning": h, "data-information": y, "aria-describedby": P, className: g, onChange: R }),
77
- /* @__PURE__ */ e.jsxs("div", { className: q, "aria-disabled": a ? !0 : void 0, children: [
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(F, { value: v, className: "kakadu-components-3803487082" }),
80
- /* @__PURE__ */ e.jsx(E, { className: "kakadu-components-4115080333", children: f })
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(D, { size: 150, className: J }),
84
- /* @__PURE__ */ e.jsx(K, {})
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
- F as CheckboxIcon,
91
- se as TextCheckbox,
92
- oe as default
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"),r=require("@kuma-ui/core"),Q=require("../utilities/copy-to-clipboard.js"),M=require("../theme.js"),de=require("../icons/sparkle.js"),je=require("./button-tooltip.js"),B=require("./text-button.js"),x=require("./text.js"),ke=require("./collapsible.js"),X=require("./click-ripples.js"),Y=require("./hover-gradient.js"),fe=require("./notification.js"),he="kakadu-components-922159086",Ee="kakadu-components-25448712",N="kakadu-components-3308836726",T="kakadu-components-4056037255",Z=r.cx(T,"kakadu-components-3245407458"),Re=r.cx(T,"kakadu-components-1117160492"),be=r.cx(T,"kakadu-components-821835704");function ee({as:p,className:c,...m}){return e.jsxRuntimeExports.jsx(x.Span,{as:p??"span",...m,className:r.cx("kakadu-components-2675681525",c)})}function te({label:p,error:c,errorId:m,warning:l,warningId:h,information:i,informationId:S,footnote:a,attachments:C,className:d,children:j,...k}){const E=!!c,u=!!l,R=!!i,f=!!a;return e.jsxRuntimeExports.jsx("label",{...k,className:r.cx(he,d),children:e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[e.jsxRuntimeExports.jsx(x.Span,{className:r.cx(M.overflowProtectionStyles,Ee),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:c instanceof Error?c.message:c}):u?e.jsxRuntimeExports.jsx(x.Paragraph,{id:h,className:Re,children:l instanceof Error?l.message:l}):R?e.jsxRuntimeExports.jsx(x.Paragraph,{id:S,className:be,children:i instanceof Error?i.message:i}):null}):null]})})}const ge=40,L="kakadu-components-4233741488";function ye({ref:p,type:c,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,...b}){const $=t.useRef(null),A=t.useRef(null),q=t.useRef(null),H=fe.useCreateNotification(),I=t.useId(),F=`${I}-error`,V=`${I}-warning`,O=`${I}-information`,{value:g,disabled:se}=b,[ne,W]=t.useState(""),o=g??ne,[ae,oe]=t.useState(),re=c==="textarea"||!!E;t.useLayoutEffect(()=>{typeof o=="string"&&q.current&&oe(q.current.scrollHeight)},[o]);const P=t.useMemo(()=>typeof o=="string"?`${o} `.split(`
2
- `):[],[o]),ce=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]),le=t.useCallback(()=>{typeof o=="string"&&(Q.default(o),H({type:"success",children:"Copied to clipboard."}))},[o,H]),v=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 me=new Event("input",{bubbles:!0});n.dispatchEvent(me),n.focus();return}}throw new Error("Unable to set value.")},[]),ie=t.useCallback(()=>{v("")},[v]),[ue,xe]=t.useState(""),G=!!a&&ue!==a,pe=t.useCallback(()=>{if(a){try{v(a)}catch{Q.default(a)}xe(a)}},[a,v]),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(ke.default,{isCollapsed:!G,children:G?e.jsxRuntimeExports.jsxs("button",{type:"button",className:r.cx(M.buttonResetStyles,M.overflowProtectionStyles,"kakadu-components-4141839293"),onClick:pe,children:[e.jsxRuntimeExports.jsx(je.default,{label:"Apply suggestion"}),e.jsxRuntimeExports.jsx(de.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(${ge*((j?1:0)+(k?1:0)+U)}px + 6px)`},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:r.cx(N,f,"kakadu-components-2033521835"),children:[P.map((s,n)=>e.jsxRuntimeExports.jsxs("span",{children:[s,ce>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:r.cx(N,f,"kakadu-components-2119524139"),style:{minHeight:ae},onChange:D})]}):e.jsxRuntimeExports.jsx("input",{...b,ref:$,type:c??"text",value:o,"aria-invalid":y,"data-warning":_,"data-information":w,"aria-describedby":z,className:r.cx(N,f),onChange:D}),se?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:le}):null,k?e.jsxRuntimeExports.jsx(B.default,{iconLeft:"times",label:"Clear",tooltip:"Clear",className:L,onClick:ie}):null]}):null,R]})}exports.InputAttachment=ee;exports.InputLabel=te;exports.default=ye;exports.errorParagraph=Z;exports.inputStyles=N;
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 fe, useState as T, useLayoutEffect as he, useMemo as H, useEffect as xe, useCallback as h } from "react";
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 je, overflowProtectionStyles as te } from "../theme.mjs";
6
- import be from "../icons/sparkle.mjs";
7
- import ye from "./button-tooltip.mjs";
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 ge from "./collapsible.mjs";
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 Ne } from "./notification.mjs";
14
- const ve = "kakadu-components-922159086", Ce = "kakadu-components-25448712", M = "kakadu-components-3308836726", V = "kakadu-components-4056037255", Se = o(V, "kakadu-components-3245407458"), Ee = o(V, "kakadu-components-1117160492"), Ie = o(V, "kakadu-components-821835704");
15
- function Be({
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 we({
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(ve, p), children: /* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-3146929190", children: [
38
- /* @__PURE__ */ e.jsx(F, { className: o(te, Ce), children: /* @__PURE__ */ e.jsx("span", { children: d }) }),
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(Be, { children: a }) : null,
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: Se, children: l instanceof Error ? l.message : l }) : i ? /* @__PURE__ */ e.jsx(A, { id: x, className: Ee, children: c instanceof Error ? c.message : c }) : b ? /* @__PURE__ */ e.jsx(A, { id: C, className: Ie, children: r instanceof Error ? r.message : r }) : null }) : null
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 Le = 40, $ = "kakadu-components-4233741488";
48
- function Ge({
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 = Ne(), I = fe(), D = `${I}-error`, G = `${I}-warning`, U = `${I}-information`, {
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: ae
70
- } = y, [se, q] = T(""), s = g ?? se, [oe, le] = T(), ce = l === "textarea" || !!j;
71
- he(() => {
72
- typeof s == "string" && E.current && le(E.current.scrollHeight);
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]), re = H(() => B.length, [B]), N = !!c, w = !N && !!x, L = !!r, J = N ? D : w ? G : L ? U : void 0;
76
- xe(() => {
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]), ie = h(() => {
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 ke = new Event("input", {
97
+ const fe = new Event("input", {
97
98
  bubbles: !0
98
99
  });
99
- t.dispatchEvent(ke), t.focus();
100
+ t.dispatchEvent(fe), t.focus();
100
101
  return;
101
102
  }
102
103
  }
103
104
  throw new Error("Unable to set value.");
104
- }, []), de = h(() => {
105
+ }, []), me = h(() => {
105
106
  v("");
106
- }, [v]), [me, pe] = T(""), Q = !!a && me !== a, ue = h(() => {
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
- pe(a);
114
+ ue(a);
114
115
  }
115
116
  }, [a, v]), X = H(() => p.length, [p]);
116
- return /* @__PURE__ */ e.jsxs(we, { 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: [
117
- /* @__PURE__ */ e.jsx(ge, { isCollapsed: !Q, children: Q ? /* @__PURE__ */ e.jsxs("button", { type: "button", className: o(je, te, "kakadu-components-4141839293"), onClick: ue, children: [
118
- /* @__PURE__ */ e.jsx(ye, { label: "Apply suggestion" }),
119
- /* @__PURE__ */ e.jsx(be, { width: 13, height: 13, className: "kakadu-components-1417828741" }),
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(${Le * ((u ? 1 : 0) + (k ? 1 : 0) + X)}px + 6px)`
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
- ce ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
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
- re > 1 ? /* @__PURE__ */ e.jsx("br", {}) : null
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: oe
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
- ae ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
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: ie }) : null,
162
- k ? /* @__PURE__ */ e.jsx(R, { iconLeft: "times", label: "Clear", tooltip: "Clear", className: $, onClick: de }) : null
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
- Be as InputAttachment,
169
- we as InputLabel,
170
- Ge as default,
171
- Se as errorParagraph,
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 t=require("../jsx-runtime-CZa898vN.js"),o=require("react"),k=require("@kuma-ui/core"),S=require("../icons/chevron-up.js"),f=require("./input.js");function B({label:h,options:y,error:i,warning:c,information:d,footnote:E,className:I,onChange:s,...x}){const l=o.useId(),m=`${l}-error`,p=`${l}-warning`,j=`${l}-information`,a=!!i,u=!a&&!!c,v=!a&&!u&&!!d,q=a?m:u?p:v?j:void 0,{value:n}=x,[R,b]=o.useState(""),$=n??R;o.useEffect(()=>{b(typeof n=="string"?n:"")},[n]);const g=o.useCallback(e=>{const{value:r}=e.target;b(r),s==null||s(r,e)},[s]);return t.jsxRuntimeExports.jsxs(f.InputLabel,{label:h,error:i,errorId:m,warning:c,warningId:p,information:d,informationId:j,footnote:E,children:[t.jsxRuntimeExports.jsx("select",{...x,value:$,"aria-invalid":a,"data-warning":u,"data-information":v,"aria-describedby":q,className:k.cx(f.inputStyles,"kakadu-components-1997515934",I),onChange:g,children:y.map((e,r)=>"type"in e?e.type==="separator"?t.jsxRuntimeExports.jsx("hr",{},`separator-${r}`):null:t.jsxRuntimeExports.jsx("option",{value:e.value,disabled:e.disabled,children:e.label},e.value))}),t.jsxRuntimeExports.jsx(S.default,{width:14,height:14,className:"kakadu-components-158931186"})]})}exports.default=B;
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 S, useState as $, useEffect as w, useCallback as E } from "react";
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 N from "../icons/chevron-up.mjs";
5
- import { InputLabel as L, inputStyles as R } from "./input.mjs";
6
- function D({
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: i,
10
- warning: c,
9
+ error: c,
10
+ warning: i,
11
11
  information: d,
12
12
  footnote: j,
13
13
  className: I,
14
- onChange: t,
14
+ labelClassName: y,
15
+ onChange: s,
15
16
  ...u
16
17
  }) {
17
- const l = S(), m = `${l}-error`, f = `${l}-warning`, p = `${l}-information`, s = !!i, o = !s && !!c, v = !s && !o && !!d, y = s ? m : o ? f : v ? p : void 0, {
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, [k, x] = $(""), g = r ?? k;
20
- w(() => {
20
+ } = u, [g, x] = w(""), B = r ?? g;
21
+ E(() => {
21
22
  x(typeof r == "string" ? r : "");
22
23
  }, [r]);
23
- const B = E((a) => {
24
+ const S = N((a) => {
24
25
  const {
25
26
  value: n
26
27
  } = a.target;
27
- x(n), t == null || t(n, a);
28
- }, [t]);
29
- return /* @__PURE__ */ e.jsxs(L, { label: h, error: i, errorId: m, warning: c, warningId: f, information: d, informationId: p, footnote: j, children: [
30
- /* @__PURE__ */ e.jsx("select", { ...u, value: g, "aria-invalid": s, "data-warning": o, "data-information": v, "aria-describedby": y, className: V(R, "kakadu-components-1997515934", I), onChange: B, children: b.map((a, n) => "type" in a ? a.type === "separator" ? (
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(N, { width: 14, height: 14, className: "kakadu-components-158931186" })
35
+ /* @__PURE__ */ e.jsx(L, { width: 14, height: 14, className: "kakadu-components-158931186" })
35
36
  ] });
36
37
  }
37
38
  export {
38
- D as default
39
+ F as default
39
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kakadu/components",
3
- "version": "6.13.3",
3
+ "version": "6.14.0",
4
4
  "description": "Kakadu components library",
5
5
  "license": "MIT",
6
6
  "main": "./build/index.js",