@kakadu/components 3.13.2 → 3.15.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.
@@ -17,15 +17,16 @@ type LabelProperties = HTMLProps<HTMLLabelElement> & LabelMessageProperties<'err
17
17
  readonly attachments?: ReactNode;
18
18
  };
19
19
  type ControllerProperties = Omit<LabelProperties, 'errorId' | 'warningId' | 'attachments'>;
20
- export type SelectOption = {
21
- readonly value: string;
20
+ export type SelectOption<Type extends string = string> = {
21
+ readonly value: Type;
22
22
  readonly label: ReactNode | string;
23
+ readonly disabled?: boolean;
23
24
  };
24
- export type SelectProperties = Omit<ControllerProperties & HTMLProps<HTMLSelectElement>, 'onChange'> & {
25
- readonly options: SelectOption[];
26
- readonly onChange?: (value: string, event: ChangeEvent<HTMLSelectElement>) => void;
25
+ export type SelectProperties<Type extends string = string> = Omit<ControllerProperties & HTMLProps<HTMLSelectElement>, 'onChange'> & {
26
+ readonly options: Array<SelectOption<Type>>;
27
+ readonly onChange?: (value: Type, event: ChangeEvent<HTMLSelectElement>) => void;
27
28
  };
28
- export declare function Select({ label, options, error, warning, information, footnote, className, onChange, ...properties }: SelectProperties): import("react/jsx-runtime").JSX.Element;
29
+ export declare function Select<Type extends string = string>({ label, options, error, warning, information, footnote, className, onChange, ...properties }: SelectProperties<Type>): import("react/jsx-runtime").JSX.Element;
29
30
  type InputType = HTMLInputElement | HTMLTextAreaElement;
30
31
  export type InputAction = {
31
32
  icon: IconType;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),l=require("@kuma-ui/core"),xe=require("../icons/chevron-up.js"),J=require("../icons/icon.js"),K=require("../utilities/copy-to-clipboard.js"),H=require("../theme.js"),pe=require("../icons/sparkle.js"),de=require("./button-tooltip.js"),L=require("./text-button.js"),g=require("./text.js"),me=require("./collapsible.js"),Q=require("./click-ripples.js"),X=require("./hover-gradient.js"),je=require("./notification.js"),ke=require("./notice.js"),fe="kakadu-components-922159086",he="kakadu-components-25448712",w="kakadu-components-1923392328",A="kakadu-components-4056037255",Y=l.cx(A,"kakadu-components-3245407458"),Ee=l.cx(A,"kakadu-components-1117160492"),Re=l.cx(A,"kakadu-components-2261792866");function be({as:f,className:i,...p}){return e.jsxRuntimeExports.jsx(g.Span,{as:f??"span",...p,className:l.cx("kakadu-components-520991867",i)})}function Z({label:f,error:i,errorId:p,warning:u,warningId:R,information:h,informationId:s,footnote:o,attachments:E,className:d,children:v,...m}){const j=!!i,c=!!u,k=!!h,b=!!o;return e.jsxRuntimeExports.jsx("label",{...m,className:l.cx(fe,d),children:e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[e.jsxRuntimeExports.jsx(g.Span,{className:l.cx(H.overflowProtectionStyles,he),children:e.jsxRuntimeExports.jsx("span",{children:f})}),e.jsxRuntimeExports.jsxs("span",{className:"kakadu-components-3298764637",children:[v,b?e.jsxRuntimeExports.jsx(be,{className:"kakadu-components-613632806",children:o}):null,E]}),j||c||k?e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2927674627",children:j?e.jsxRuntimeExports.jsx(g.Paragraph,{id:p,className:Y,children:i instanceof Error?i.message:i}):c?e.jsxRuntimeExports.jsx(g.Paragraph,{id:R,className:Ee,children:u instanceof Error?u.message:u}):k?e.jsxRuntimeExports.jsx(g.Paragraph,{id:s,className:Re,children:h instanceof Error?h.message:h}):null}):null]})})}function ye({label:f,options:i,error:p,warning:u,information:R,footnote:h,className:s,onChange:o,...E}){const d=t.useId(),v=`${d}-error`,m=`${d}-warning`,j=`${d}-information`,c=!!p,k=!c&&!!u,b=!c&&!k&&!!R,N=c?v:k?m:b?j:void 0,{value:y}=E,[S,I]=t.useState(""),q=y??S;t.useEffect(()=>{I(typeof y=="string"?y:"")},[y]);const C=t.useCallback(r=>{const{value:B}=r.target;I(B),o==null||o(B,r)},[o]);return e.jsxRuntimeExports.jsxs(Z,{label:f,error:p,errorId:v,warning:u,warningId:m,information:R,informationId:j,footnote:h,children:[e.jsxRuntimeExports.jsx("select",{...E,value:q,"aria-invalid":c,"data-warning":k,"data-information":b,"aria-describedby":N,className:l.cx(w,"kakadu-components-4228384787",s),onChange:C,children:i.map(r=>e.jsxRuntimeExports.jsx("option",{value:r.value,children:r.label},r.value))}),e.jsxRuntimeExports.jsx(xe.default,{width:14,height:14,className:"kakadu-components-158931186"})]})}const ve=40,V="kakadu-components-4233741488";function ge({type:f,label:i,error:p,warning:u,information:R,footnote:h,suggestion:s,actions:o=[],hasCopyButton:E,hasClearButton:d,isMultiline:v,onChange:m,className:j,...c}){const k=t.useRef(null),b=t.useRef(null),N=t.useRef(null),y=je.useCreateNotification(),S=t.useId(),I=`${S}-error`,q=`${S}-warning`,C=`${S}-information`,{value:r,disabled:B}=c,[ee,F]=t.useState(""),x=r??ee,[te,se]=t.useState(),ne=f==="textarea"||!!v;t.useLayoutEffect(()=>{typeof x=="string"&&N.current&&se(N.current.scrollHeight)},[x]);const T=t.useMemo(()=>typeof x=="string"?`${x} `.split(`
2
- `):[],[x]),ae=t.useMemo(()=>T.length,[T]),_=!!p,$=!_&&!!u,M=!!R,O=_?I:$?q:M?C:void 0;t.useEffect(()=>{F(typeof r=="string"?r:"")},[r]);const W=t.useCallback(n=>{const{value:a}=n.target;F(a),m==null||m(a,n)},[m]),oe=t.useCallback(()=>{typeof x=="string"&&(K.default(x),y({type:ke.NoticeType.success,children:"Copied to clipboard."}))},[x,y]),P=t.useCallback(n=>{var D;const a=b.current??k.current??void 0;if(a){const G=(D=Object.getOwnPropertyDescriptor(a instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value"))==null?void 0:D.set;if(G){G.call(a,n);const ue=new Event("input",{bubbles:!0});a.dispatchEvent(ue),a.focus();return}}throw new Error("Unable to set value.")},[]),ce=t.useCallback(()=>{P("")},[P]),[re,le]=t.useState(""),U=!!s&&re!==s,ie=t.useCallback(()=>{if(s){try{P(s)}catch{K.default(s)}le(s)}},[s,P]),z=t.useMemo(()=>o.length,[o]);return e.jsxRuntimeExports.jsxs(Z,{label:i,error:p,errorId:I,warning:u,warningId:q,information:R,informationId:C,footnote:h,attachments:e.jsxRuntimeExports.jsx(me.default,{isCollapsed:!U,children:U?e.jsxRuntimeExports.jsxs("button",{type:"button",className:l.cx(H.buttonResetStyles,H.overflowProtectionStyles,"kakadu-components-2355856341"),onClick:ie,children:[e.jsxRuntimeExports.jsx(de.default,{label:"Apply suggestion"}),e.jsxRuntimeExports.jsx(pe.default,{width:13,height:13,className:"kakadu-components-1021263934"}),e.jsxRuntimeExports.jsx(g.Span,{className:"kakadu-components-1585874956",children:s}),e.jsxRuntimeExports.jsx(Q.default,{className:"kakadu-components-3448565402"}),e.jsxRuntimeExports.jsx(X.default,{})]}):null}),style:{"--button-padding":`calc(${ve*((E?1:0)+(d?1:0)+z)}px + 6px)`},children:[e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[ne?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{ref:N,"aria-hidden":!0,className:l.cx(w,j,"kakadu-components-2033521835"),children:[T.map((n,a)=>e.jsxRuntimeExports.jsxs("span",{children:[n,ae>1?e.jsxRuntimeExports.jsx("br",{}):null]},a))," "]}),e.jsxRuntimeExports.jsx("textarea",{...c,ref:b,rows:1,"aria-invalid":_,"data-warning":$,"data-information":M,"aria-describedby":O,value:x,className:l.cx(w,j,"kakadu-components-2119524139"),style:{minHeight:te},onChange:W})]}):e.jsxRuntimeExports.jsx("input",{...c,ref:k,type:f??"text",value:x,"aria-invalid":_,"data-warning":$,"data-information":M,"aria-describedby":O,className:l.cx(w,j),onChange:W}),B?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Q.default,{className:"kakadu-components-616311160"}),e.jsxRuntimeExports.jsx(X.default,{className:"kakadu-components-1962999040"})]})]}),E||d||z>0?e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-131986363",children:[o.map((n,a)=>e.jsxRuntimeExports.jsx(L.default,{iconLeft:n.icon,label:n.label,tooltip:n.label,className:V,onClick:n.onClick},n.label+a)),E?e.jsxRuntimeExports.jsx(L.default,{iconLeft:J.IconType.copy,label:"Copy",tooltip:"Copy",className:V,onClick:oe}):null,d?e.jsxRuntimeExports.jsx(L.default,{iconLeft:J.IconType.times,label:"Clear",tooltip:"Clear",className:V,onClick:ce}):null]}):null]})}exports.Select=ye;exports.default=ge;exports.errorParagraph=Y;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),t=require("react"),l=require("@kuma-ui/core"),xe=require("../icons/chevron-up.js"),J=require("../icons/icon.js"),K=require("../utilities/copy-to-clipboard.js"),H=require("../theme.js"),de=require("../icons/sparkle.js"),pe=require("./button-tooltip.js"),L=require("./text-button.js"),g=require("./text.js"),me=require("./collapsible.js"),Q=require("./click-ripples.js"),X=require("./hover-gradient.js"),je=require("./notification.js"),ke=require("./notice.js"),fe="kakadu-components-922159086",he="kakadu-components-25448712",w="kakadu-components-1923392328",A="kakadu-components-4056037255",Y=l.cx(A,"kakadu-components-3245407458"),Ee=l.cx(A,"kakadu-components-1117160492"),Re=l.cx(A,"kakadu-components-2261792866");function be({as:f,className:i,...d}){return e.jsxRuntimeExports.jsx(g.Span,{as:f??"span",...d,className:l.cx("kakadu-components-520991867",i)})}function Z({label:f,error:i,errorId:d,warning:u,warningId:R,information:h,informationId:s,footnote:c,attachments:E,className:p,children:v,...m}){const j=!!i,r=!!u,k=!!h,b=!!c;return e.jsxRuntimeExports.jsx("label",{...m,className:l.cx(fe,p),children:e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[e.jsxRuntimeExports.jsx(g.Span,{className:l.cx(H.overflowProtectionStyles,he),children:e.jsxRuntimeExports.jsx("span",{children:f})}),e.jsxRuntimeExports.jsxs("span",{className:"kakadu-components-3298764637",children:[v,b?e.jsxRuntimeExports.jsx(be,{className:"kakadu-components-613632806",children:c}):null,E]}),j||r||k?e.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2927674627",children:j?e.jsxRuntimeExports.jsx(g.Paragraph,{id:d,className:Y,children:i instanceof Error?i.message:i}):r?e.jsxRuntimeExports.jsx(g.Paragraph,{id:R,className:Ee,children:u instanceof Error?u.message:u}):k?e.jsxRuntimeExports.jsx(g.Paragraph,{id:s,className:Re,children:h instanceof Error?h.message:h}):null}):null]})})}function ye({label:f,options:i,error:d,warning:u,information:R,footnote:h,className:s,onChange:c,...E}){const p=t.useId(),v=`${p}-error`,m=`${p}-warning`,j=`${p}-information`,r=!!d,k=!r&&!!u,b=!r&&!k&&!!R,N=r?v:k?m:b?j:void 0,{value:y}=E,[S,I]=t.useState(""),q=y??S;t.useEffect(()=>{I(typeof y=="string"?y:"")},[y]);const C=t.useCallback(n=>{const{value:B}=n.target;I(B),c==null||c(B,n)},[c]);return e.jsxRuntimeExports.jsxs(Z,{label:f,error:d,errorId:v,warning:u,warningId:m,information:R,informationId:j,footnote:h,children:[e.jsxRuntimeExports.jsx("select",{...E,value:q,"aria-invalid":r,"data-warning":k,"data-information":b,"aria-describedby":N,className:l.cx(w,"kakadu-components-4228384787",s),onChange:C,children:i.map(n=>e.jsxRuntimeExports.jsx("option",{value:n.value,disabled:n.disabled,children:n.label},n.value))}),e.jsxRuntimeExports.jsx(xe.default,{width:14,height:14,className:"kakadu-components-158931186"})]})}const ve=40,V="kakadu-components-4233741488";function ge({type:f,label:i,error:d,warning:u,information:R,footnote:h,suggestion:s,actions:c=[],hasCopyButton:E,hasClearButton:p,isMultiline:v,onChange:m,className:j,...r}){const k=t.useRef(null),b=t.useRef(null),N=t.useRef(null),y=je.useCreateNotification(),S=t.useId(),I=`${S}-error`,q=`${S}-warning`,C=`${S}-information`,{value:n,disabled:B}=r,[ee,F]=t.useState(""),x=n??ee,[te,se]=t.useState(),ne=f==="textarea"||!!v;t.useLayoutEffect(()=>{typeof x=="string"&&N.current&&se(N.current.scrollHeight)},[x]);const T=t.useMemo(()=>typeof x=="string"?`${x} `.split(`
2
+ `):[],[x]),ae=t.useMemo(()=>T.length,[T]),_=!!d,$=!_&&!!u,M=!!R,O=_?I:$?q:M?C:void 0;t.useEffect(()=>{F(typeof n=="string"?n:"")},[n]);const W=t.useCallback(a=>{const{value:o}=a.target;F(o),m==null||m(o,a)},[m]),oe=t.useCallback(()=>{typeof x=="string"&&(K.default(x),y({type:ke.NoticeType.success,children:"Copied to clipboard."}))},[x,y]),P=t.useCallback(a=>{var D;const o=b.current??k.current??void 0;if(o){const G=(D=Object.getOwnPropertyDescriptor(o instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value"))==null?void 0:D.set;if(G){G.call(o,a);const ue=new Event("input",{bubbles:!0});o.dispatchEvent(ue),o.focus();return}}throw new Error("Unable to set value.")},[]),ce=t.useCallback(()=>{P("")},[P]),[re,le]=t.useState(""),U=!!s&&re!==s,ie=t.useCallback(()=>{if(s){try{P(s)}catch{K.default(s)}le(s)}},[s,P]),z=t.useMemo(()=>c.length,[c]);return e.jsxRuntimeExports.jsxs(Z,{label:i,error:d,errorId:I,warning:u,warningId:q,information:R,informationId:C,footnote:h,attachments:e.jsxRuntimeExports.jsx(me.default,{isCollapsed:!U,children:U?e.jsxRuntimeExports.jsxs("button",{type:"button",className:l.cx(H.buttonResetStyles,H.overflowProtectionStyles,"kakadu-components-2355856341"),onClick:ie,children:[e.jsxRuntimeExports.jsx(pe.default,{label:"Apply suggestion"}),e.jsxRuntimeExports.jsx(de.default,{width:13,height:13,className:"kakadu-components-1021263934"}),e.jsxRuntimeExports.jsx(g.Span,{className:"kakadu-components-1585874956",children:s}),e.jsxRuntimeExports.jsx(Q.default,{className:"kakadu-components-3448565402"}),e.jsxRuntimeExports.jsx(X.default,{})]}):null}),style:{"--button-padding":`calc(${ve*((E?1:0)+(p?1:0)+z)}px + 6px)`},children:[e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[ne?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{ref:N,"aria-hidden":!0,className:l.cx(w,j,"kakadu-components-2033521835"),children:[T.map((a,o)=>e.jsxRuntimeExports.jsxs("span",{children:[a,ae>1?e.jsxRuntimeExports.jsx("br",{}):null]},o))," "]}),e.jsxRuntimeExports.jsx("textarea",{...r,ref:b,rows:1,"aria-invalid":_,"data-warning":$,"data-information":M,"aria-describedby":O,value:x,className:l.cx(w,j,"kakadu-components-2119524139"),style:{minHeight:te},onChange:W})]}):e.jsxRuntimeExports.jsx("input",{...r,ref:k,type:f??"text",value:x,"aria-invalid":_,"data-warning":$,"data-information":M,"aria-describedby":O,className:l.cx(w,j),onChange:W}),B?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Q.default,{className:"kakadu-components-616311160"}),e.jsxRuntimeExports.jsx(X.default,{className:"kakadu-components-1962999040"})]})]}),E||p||z>0?e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-131986363",children:[c.map((a,o)=>e.jsxRuntimeExports.jsx(L.default,{iconLeft:a.icon,label:a.label,tooltip:a.label,className:V,onClick:a.onClick},a.label+o)),E?e.jsxRuntimeExports.jsx(L.default,{iconLeft:J.IconType.copy,label:"Copy",tooltip:"Copy",className:V,onClick:oe}):null,p?e.jsxRuntimeExports.jsx(L.default,{iconLeft:J.IconType.times,label:"Clear",tooltip:"Clear",className:V,onClick:ce}):null]}):null]})}exports.Select=ye;exports.default=ge;exports.errorParagraph=Y;
@@ -30,21 +30,21 @@ function se({
30
30
  warningId: b,
31
31
  information: x,
32
32
  informationId: n,
33
- footnote: s,
33
+ footnote: o,
34
34
  attachments: j,
35
35
  className: u,
36
36
  children: g,
37
37
  ...p
38
38
  }) {
39
- const k = !!r, o = !!i, f = !!x, v = !!s;
39
+ const k = !!r, l = !!i, f = !!x, v = !!o;
40
40
  return /* @__PURE__ */ e.jsx("label", { ...p, className: c(Ie, u), children: /* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-3146929190", children: [
41
41
  /* @__PURE__ */ e.jsx(U, { className: c(te, Se), children: /* @__PURE__ */ e.jsx("span", { children: h }) }),
42
42
  /* @__PURE__ */ e.jsxs("span", { className: "kakadu-components-3298764637", children: [
43
43
  g,
44
- v ? /* @__PURE__ */ e.jsx(we, { className: "kakadu-components-613632806", children: s }) : null,
44
+ v ? /* @__PURE__ */ e.jsx(we, { className: "kakadu-components-613632806", children: o }) : null,
45
45
  j
46
46
  ] }),
47
- k || o || f ? /* @__PURE__ */ e.jsx("div", { className: "kakadu-components-2927674627", children: k ? /* @__PURE__ */ e.jsx(W, { id: m, className: Be, children: r instanceof Error ? r.message : r }) : o ? /* @__PURE__ */ e.jsx(W, { id: b, className: Ee, children: i instanceof Error ? i.message : i }) : f ? /* @__PURE__ */ e.jsx(W, { id: n, className: Ce, children: x instanceof Error ? x.message : x }) : null }) : null
47
+ k || l || f ? /* @__PURE__ */ e.jsx("div", { className: "kakadu-components-2927674627", children: k ? /* @__PURE__ */ e.jsx(W, { id: m, className: Be, children: r instanceof Error ? r.message : r }) : l ? /* @__PURE__ */ e.jsx(W, { id: b, className: Ee, children: i instanceof Error ? i.message : i }) : f ? /* @__PURE__ */ e.jsx(W, { id: n, className: Ce, children: x instanceof Error ? x.message : x }) : null }) : null
48
48
  ] }) });
49
49
  }
50
50
  function Je({
@@ -55,23 +55,23 @@ function Je({
55
55
  information: b,
56
56
  footnote: x,
57
57
  className: n,
58
- onChange: s,
58
+ onChange: o,
59
59
  ...j
60
60
  }) {
61
- const u = ne(), g = `${u}-error`, p = `${u}-warning`, k = `${u}-information`, o = !!m, f = !o && !!i, v = !o && !f && !!b, I = o ? g : f ? p : v ? k : void 0, {
61
+ const u = ne(), g = `${u}-error`, p = `${u}-warning`, k = `${u}-information`, l = !!m, f = !l && !!i, v = !l && !f && !!b, I = l ? g : f ? p : v ? k : void 0, {
62
62
  value: y
63
63
  } = j, [S, B] = P(""), E = y ?? S;
64
64
  ae(() => {
65
65
  B(typeof y == "string" ? y : "");
66
66
  }, [y]);
67
- const C = N((l) => {
67
+ const C = N((a) => {
68
68
  const {
69
69
  value: w
70
- } = l.target;
71
- B(w), s == null || s(w, l);
72
- }, [s]);
70
+ } = a.target;
71
+ B(w), o == null || o(w, a);
72
+ }, [o]);
73
73
  return /* @__PURE__ */ e.jsxs(se, { label: h, error: m, errorId: g, warning: i, warningId: p, information: b, informationId: k, footnote: x, children: [
74
- /* @__PURE__ */ e.jsx("select", { ...j, value: E, "aria-invalid": o, "data-warning": f, "data-information": v, "aria-describedby": I, className: c($, "kakadu-components-4228384787", n), onChange: C, children: r.map((l) => /* @__PURE__ */ e.jsx("option", { value: l.value, children: l.label }, l.value)) }),
74
+ /* @__PURE__ */ e.jsx("select", { ...j, value: E, "aria-invalid": l, "data-warning": f, "data-information": v, "aria-describedby": I, className: c($, "kakadu-components-4228384787", n), onChange: C, children: r.map((a) => /* @__PURE__ */ e.jsx("option", { value: a.value, disabled: a.disabled, children: a.label }, a.value)) }),
75
75
  /* @__PURE__ */ e.jsx(xe, { width: 14, height: 14, className: "kakadu-components-158931186" })
76
76
  ] });
77
77
  }
@@ -84,47 +84,47 @@ function Ke({
84
84
  information: b,
85
85
  footnote: x,
86
86
  suggestion: n,
87
- actions: s = [],
87
+ actions: o = [],
88
88
  hasCopyButton: j,
89
89
  hasClearButton: u,
90
90
  isMultiline: g,
91
91
  onChange: p,
92
92
  className: k,
93
- ...o
93
+ ...l
94
94
  }) {
95
95
  const f = M(null), v = M(null), I = M(null), y = ge(), S = ne(), B = `${S}-error`, E = `${S}-warning`, C = `${S}-information`, {
96
- value: l,
96
+ value: a,
97
97
  disabled: w
98
- } = o, [oe, D] = P(""), d = l ?? oe, [le, ce] = P(), re = h === "textarea" || !!g;
98
+ } = l, [oe, D] = P(""), d = a ?? oe, [le, ce] = P(), re = h === "textarea" || !!g;
99
99
  he(() => {
100
100
  typeof d == "string" && I.current && ce(I.current.scrollHeight);
101
101
  }, [d]);
102
102
  const H = A(() => typeof d == "string" ? `${d} `.split(`
103
103
  `) : [], [d]), ie = A(() => H.length, [H]), T = !!m, R = !T && !!i, V = !!b, G = T ? B : R ? E : V ? C : void 0;
104
104
  ae(() => {
105
- D(typeof l == "string" ? l : "");
106
- }, [l]);
107
- const q = N((a) => {
105
+ D(typeof a == "string" ? a : "");
106
+ }, [a]);
107
+ const q = N((t) => {
108
108
  const {
109
- value: t
110
- } = a.target;
111
- D(t), p == null || p(t, a);
109
+ value: s
110
+ } = t.target;
111
+ D(s), p == null || p(s, t);
112
112
  }, [p]), de = N(() => {
113
113
  typeof d == "string" && (Z(d), y({
114
114
  type: Ne.success,
115
115
  children: "Copied to clipboard."
116
116
  }));
117
- }, [d, y]), L = N((a) => {
117
+ }, [d, y]), L = N((t) => {
118
118
  var Q;
119
- const t = v.current ?? f.current ?? void 0;
120
- if (t) {
121
- const X = (Q = Object.getOwnPropertyDescriptor(t instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype, "value")) == null ? void 0 : Q.set;
119
+ const s = v.current ?? f.current ?? void 0;
120
+ if (s) {
121
+ const X = (Q = Object.getOwnPropertyDescriptor(s instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype, "value")) == null ? void 0 : Q.set;
122
122
  if (X) {
123
- X.call(t, a);
123
+ X.call(s, t);
124
124
  const fe = new Event("input", {
125
125
  bubbles: !0
126
126
  });
127
- t.dispatchEvent(fe), t.focus();
127
+ s.dispatchEvent(fe), s.focus();
128
128
  return;
129
129
  }
130
130
  }
@@ -140,7 +140,7 @@ function Ke({
140
140
  }
141
141
  pe(n);
142
142
  }
143
- }, [n, L]), K = A(() => s.length, [s]);
143
+ }, [n, L]), K = A(() => o.length, [o]);
144
144
  return /* @__PURE__ */ e.jsxs(se, { label: r, error: m, errorId: B, warning: i, warningId: E, information: b, informationId: C, footnote: x, attachments: /* @__PURE__ */ e.jsx(ye, { isCollapsed: !J, children: J ? /* @__PURE__ */ e.jsxs("button", { type: "button", className: c(je, te, "kakadu-components-2355856341"), onClick: ke, children: [
145
145
  /* @__PURE__ */ e.jsx(ve, { label: "Apply suggestion" }),
146
146
  /* @__PURE__ */ e.jsx(be, { width: 13, height: 13, className: "kakadu-components-1021263934" }),
@@ -153,35 +153,35 @@ function Ke({
153
153
  /* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-3146929190", children: [
154
154
  re ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
155
155
  /* @__PURE__ */ e.jsxs("span", { ref: I, "aria-hidden": !0, className: c($, k, "kakadu-components-2033521835"), children: [
156
- H.map((a, t) => (
156
+ H.map((t, s) => (
157
157
  // eslint-disable-next-line react/no-array-index-key
158
158
  /* @__PURE__ */ e.jsxs("span", { children: [
159
- a,
159
+ t,
160
160
  ie > 1 ? /* @__PURE__ */ e.jsx("br", {}) : null
161
- ] }, t)
161
+ ] }, s)
162
162
  )),
163
163
  " "
164
164
  ] }),
165
- /* @__PURE__ */ e.jsx("textarea", { ...o, ref: v, rows: 1, "aria-invalid": T, "data-warning": R, "data-information": V, "aria-describedby": G, value: d, className: c($, k, "kakadu-components-2119524139"), style: {
165
+ /* @__PURE__ */ e.jsx("textarea", { ...l, ref: v, rows: 1, "aria-invalid": T, "data-warning": R, "data-information": V, "aria-describedby": G, value: d, className: c($, k, "kakadu-components-2119524139"), style: {
166
166
  minHeight: le
167
167
  }, onChange: q })
168
- ] }) : /* @__PURE__ */ e.jsx("input", { ...o, ref: f, type: h ?? "text", value: d, "aria-invalid": T, "data-warning": R, "data-information": V, "aria-describedby": G, className: c($, k), onChange: q }),
168
+ ] }) : /* @__PURE__ */ e.jsx("input", { ...l, ref: f, type: h ?? "text", value: d, "aria-invalid": T, "data-warning": R, "data-information": V, "aria-describedby": G, className: c($, k), onChange: q }),
169
169
  w ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
170
170
  /* @__PURE__ */ e.jsx(_, { className: "kakadu-components-616311160" }),
171
171
  /* @__PURE__ */ e.jsx(ee, { className: "kakadu-components-1962999040" })
172
172
  ] })
173
173
  ] }),
174
174
  j || u || K > 0 ? /* @__PURE__ */ e.jsxs("div", { className: "kakadu-components-131986363", children: [
175
- s.map((a, t) => /* @__PURE__ */ e.jsx(
175
+ o.map((t, s) => /* @__PURE__ */ e.jsx(
176
176
  F,
177
177
  {
178
- iconLeft: a.icon,
179
- label: a.label,
180
- tooltip: a.label,
178
+ iconLeft: t.icon,
179
+ label: t.label,
180
+ tooltip: t.label,
181
181
  className: O,
182
- onClick: a.onClick
182
+ onClick: t.onClick
183
183
  },
184
- a.label + t
184
+ t.label + s
185
185
  )),
186
186
  j ? /* @__PURE__ */ e.jsx(F, { iconLeft: Y.copy, label: "Copy", tooltip: "Copy", className: O, onClick: de }) : null,
187
187
  u ? /* @__PURE__ */ e.jsx(F, { iconLeft: Y.times, label: "Clear", tooltip: "Clear", className: O, onClick: me }) : null
@@ -9,6 +9,7 @@ export type PopoverMenuItemProperties = {
9
9
  type: 'group';
10
10
  readonly label: ReactNode;
11
11
  } | {
12
+ readonly isLoading?: boolean;
12
13
  readonly reference?: Ref<PopoverMenuItemElementType>;
13
14
  readonly label: ReactNode;
14
15
  readonly href?: string;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../jsx-runtime-BB_1_6y_.js"),q=require("@kuma-ui/core"),a=require("react"),N=require("../theme.js"),y=require("../icons/icon.js"),j=require("./popover.js"),S=require("./atom.js"),w=require("./text.js"),b=require("./hover-gradient.js"),_=require("./click-ripples.js"),C=require("./separator.js"),K=require("./decorators.js"),k=new Set;function M(){const[e,n]=a.useState(!1),u=a.useCallback(s=>{n(s);for(const o of k)o(s)},[]);return a.useEffect(()=>{const s=o=>{n(o)};return k.add(s),()=>{k.delete(s)}},[]),a.useMemo(()=>({isKeyboardNavigating:e,setIsKeyboardNavigating:u}),[e,u])}const F="kakadu-components-949294122";function A({label:e,iconLeft:n,iconRight:u,href:s,shouldCloseOnClick:o=!0,decorators:v=[],submenu:m,className:i,onClick:r,...f}){const{isVisible:d,isPreparingFocus:l,isFocused:c,close:x}=j.usePopoverContext(),{isKeyboardNavigating:p}=M(),E=a.useRef(!0),g=a.useCallback(()=>{E.current=c},[c]),R=a.useCallback(I=>{!p&&!E.current||c&&(r==null||r(I),m?m.show():o&&(x==null||x()))},[p,c,r,m,o,x]),h=a.useMemo(()=>t.jsxRuntimeExports.jsxs(S.default,{as:s?"a":"button",...f,type:s?void 0:"button",role:"menuitem",href:s,inert:!d&&!l,disabled:s?void 0:!d&&!l,className:q.cx(N.buttonResetStyles,"kakadu-components-1772835671",c&&"kakadu-components-3160069815",p?"kakadu-components-2254977234":c&&"kakadu-components-278139688",i),onClick:R,onPointerDownCapture:g,children:[t.jsxRuntimeExports.jsxs(w.Span,{className:"kakadu-components-1109353535",children:[n?t.jsxRuntimeExports.jsx(y.default,{width:12,height:12,type:n}):null,t.jsxRuntimeExports.jsx("span",{className:"kakadu-components-913703148",children:e}),u?t.jsxRuntimeExports.jsx(y.default,{width:12,height:12,type:u}):null]}),p?null:t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(_.default,{isActive:c,size:100}),t.jsxRuntimeExports.jsx(b.default,{isActive:c,size:150,className:b.normalBlendStyles})]})]}),[s,f,d,l,p,i,R,g,n,e,u,c]);return t.jsxRuntimeExports.jsx(K.default,{decorators:v,children:m?t.jsxRuntimeExports.jsx(P,{menu:m.popoverMenu,className:"kakadu-components-1861176543",children:h}):h})}function D(e){if("type"in e){if(e.type==="separator")return t.jsxRuntimeExports.jsx(C.default,{});if(e.type==="group")return t.jsxRuntimeExports.jsx(w.Span,{className:"kakadu-components-1499037363",children:e.label})}return t.jsxRuntimeExports.jsx(A,{...e})}function T({items:e}){const{isFocused:n}=j.usePopoverContext(),[u,s]=a.useState([]),{setIsKeyboardNavigating:o}=M(),v=a.useCallback(i=>{i&&s(r=>r.includes(i)?r:[...r,i])},[]),m=a.useCallback(i=>{n&&(i.currentTarget.focus(),o(!1))},[n,o]);return a.useEffect(()=>{if(!n)return;const i=r=>{const f=u.filter(p=>p.isConnected),d=f.length;if(d===0)return;let l;const c=document.activeElement;let x=c?f.indexOf(c):-1;switch(x===-1&&(x=0),r.key){case"ArrowDown":{l=(x+1)%d;break}case"ArrowUp":{l=(x-1+d)%d;break}case"Home":{l=0;break}case"End":{l=d-1;break}case"Tab":{o(!0);return}}if(l!==void 0){r.preventDefault(),r.stopPropagation();const p=f[l];p&&(p.focus(),o(!0))}};return window.addEventListener("keydown",i,{capture:!0}),()=>{window.removeEventListener("keydown",i,{capture:!0})}},[n,u,o]),t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:e.map((i,r)=>t.jsxRuntimeExports.jsx(D,{...i,reference:v,onMouseEnter:m},r))})}function z({items:e,...n}){return t.jsxRuntimeExports.jsx(j.default,{...n,as:"nav",role:"menu",innerClassName:"kakadu-components-3600436535",children:t.jsxRuntimeExports.jsx(T,{items:e})})}function H(e){const n=a.useMemo(()=>({items:e}),[e]),{show:u,close:s,popover:o}=j.usePopover(z,n);return a.useMemo(()=>({show:u,close:s,popoverMenu:o}),[u,s,o])}function P({menu:e,className:n,children:u}){return t.jsxRuntimeExports.jsxs(j.PopoverContainer,{className:n,children:[u,e]})}exports.dangerPopoverMenuItemStyles=F;exports.default=P;exports.usePopoverMenu=H;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../jsx-runtime-BB_1_6y_.js"),_=require("@kuma-ui/core"),i=require("react"),N=require("../theme.js"),w=require("../icons/icon.js"),f=require("./popover.js"),C=require("./atom.js"),P=require("./text.js"),b=require("./hover-gradient.js"),F=require("./click-ripples.js"),K=require("./separator.js"),z=require("./decorators.js"),M=require("./spinner.js"),A=require("./skeleton.js"),D=require("./aria-text.js"),k=new Set;function q(){const[t,s]=i.useState(!1),r=i.useCallback(u=>{s(u);for(const n of k)n(u)},[]);return i.useEffect(()=>{const u=n=>{s(n)};return k.add(u),()=>{k.delete(u)}},[]),i.useMemo(()=>({isKeyboardNavigating:t,setIsKeyboardNavigating:r}),[t,r])}const T="kakadu-components-949294122";function H({isLoading:t,label:s,iconLeft:r,iconRight:u,href:n,shouldCloseOnClick:v=!0,decorators:E=[],submenu:o,className:c,onClick:p,...m}){const{isVisible:x,isPreparingFocus:d,isFocused:a,close:l}=f.usePopoverContext(),{isKeyboardNavigating:j}=q(),R=i.useRef(!0),h=i.useCallback(()=>{R.current=a},[a]),y=i.useCallback(S=>{!j&&!R.current||a&&(p==null||p(S),o?o.show():v&&(l==null||l()))},[j,a,p,o,v,l]),g=i.useMemo(()=>e.jsxRuntimeExports.jsxs(C.default,{as:n&&!t?"a":"button",...m,type:n&&!t?void 0:"button",role:"menuitem",href:n,inert:!x&&!d||t,disabled:n?void 0:!x&&!d||t,className:_.cx(N.buttonResetStyles,"kakadu-components-1772835671",a&&"kakadu-components-3160069815",j?"kakadu-components-2254977234":a&&"kakadu-components-278139688",c),onClick:y,onPointerDownCapture:h,children:[e.jsxRuntimeExports.jsx(P.Span,{className:"kakadu-components-1109353535",children:t?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(D.default,{children:s}),r?e.jsxRuntimeExports.jsx(M.default,{size:12}):null,e.jsxRuntimeExports.jsx(A.SkeletonInstance,{height:"1em",width:"100%"}),u?e.jsxRuntimeExports.jsx(M.default,{size:12}):null]}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[r?e.jsxRuntimeExports.jsx(w.default,{width:12,height:12,type:r}):null,e.jsxRuntimeExports.jsx("span",{className:"kakadu-components-4055589237",children:s}),u?e.jsxRuntimeExports.jsx(w.default,{width:12,height:12,type:u}):null]})}),j||t?null:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(F.default,{isActive:a,size:100}),e.jsxRuntimeExports.jsx(b.default,{isActive:a,size:150,className:b.normalBlendStyles})]})]}),[n,t,m,x,d,j,c,y,h,r,s,u,a]);return e.jsxRuntimeExports.jsx(z.default,{decorators:E,children:o?e.jsxRuntimeExports.jsx(I,{menu:o.popoverMenu,className:"kakadu-components-1861176543",children:g}):g})}function V(t){if("type"in t){if(t.type==="separator")return e.jsxRuntimeExports.jsx(K.default,{});if(t.type==="group")return e.jsxRuntimeExports.jsx(P.Span,{className:"kakadu-components-1499037363",children:t.label})}return e.jsxRuntimeExports.jsx(H,{...t})}function $({items:t}){const{isFocused:s}=f.usePopoverContext(),[r,u]=i.useState([]),{setIsKeyboardNavigating:n}=q(),v=i.useCallback(o=>{o&&u(c=>c.includes(o)?c:[...c,o])},[]),E=i.useCallback(o=>{s&&(o.currentTarget.focus(),n(!1))},[s,n]);return i.useEffect(()=>{if(!s)return;const o=c=>{const p=r.filter(l=>l.isConnected),m=p.length;if(m===0)return;let x;const d=document.activeElement;let a=d?p.indexOf(d):-1;switch(a===-1&&(a=0),c.key){case"ArrowDown":{x=(a+1)%m;break}case"ArrowUp":{x=(a-1+m)%m;break}case"Home":{x=0;break}case"End":{x=m-1;break}case"Tab":{n(!0);return}}if(x!==void 0){c.preventDefault(),c.stopPropagation();const l=p[x];l&&(l.focus(),n(!0))}};return window.addEventListener("keydown",o,{capture:!0}),()=>{window.removeEventListener("keydown",o,{capture:!0})}},[s,r,n]),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t.map((o,c)=>e.jsxRuntimeExports.jsx(V,{...o,reference:v,onMouseEnter:E},c))})}function B({items:t,...s}){return e.jsxRuntimeExports.jsx(f.default,{...s,as:"nav",role:"menu",innerClassName:"kakadu-components-3600436535",children:e.jsxRuntimeExports.jsx($,{items:t})})}function G(t){const s=i.useMemo(()=>({items:t}),[t]),{show:r,close:u,popover:n}=f.usePopover(B,s);return i.useMemo(()=>({show:r,close:u,popoverMenu:n}),[r,u,n])}function I({menu:t,className:s,children:r}){return e.jsxRuntimeExports.jsxs(f.PopoverContainer,{className:s,children:[r,t]})}exports.dangerPopoverMenuItemStyles=T;exports.default=I;exports.usePopoverMenu=G;
@@ -1,109 +1,118 @@
1
- import { j as n } from "../jsx-runtime-B4hRZ52C.mjs";
1
+ import { j as e } from "../jsx-runtime-B4hRZ52C.mjs";
2
2
  import { cx as K } from "@kuma-ui/core";
3
- import { useMemo as x, useState as I, useCallback as v, useEffect as b, useRef as A } from "react";
4
- import { buttonResetStyles as C } from "../theme.mjs";
3
+ import { useMemo as k, useState as N, useCallback as x, useEffect as M, useRef as C } from "react";
4
+ import { buttonResetStyles as D } from "../theme.mjs";
5
5
  import P from "../icons/icon.mjs";
6
- import D, { PopoverContainer as F, usePopover as H, usePopoverContext as N } from "./popover.mjs";
6
+ import z, { PopoverContainer as H, usePopover as T, usePopoverContext as S } from "./popover.mjs";
7
7
  import R from "./atom.mjs";
8
- import { Span as M } from "./text.mjs";
9
- import z, { normalBlendStyles as L } from "./hover-gradient.mjs";
10
- import T from "./click-ripples.mjs";
11
- import V from "./separator.mjs";
12
- import B from "./decorators.mjs";
13
- const g = /* @__PURE__ */ new Set();
14
- function E() {
15
- const [e, t] = I(!1), a = v((o) => {
16
- t(o);
17
- for (const r of g)
18
- r(o);
8
+ import { Span as E } from "./text.mjs";
9
+ import V, { normalBlendStyles as B } from "./hover-gradient.mjs";
10
+ import G from "./click-ripples.mjs";
11
+ import U from "./separator.mjs";
12
+ import q from "./decorators.mjs";
13
+ import b from "./spinner.mjs";
14
+ import { SkeletonInstance as J } from "./skeleton.mjs";
15
+ import O from "./aria-text.mjs";
16
+ const h = /* @__PURE__ */ new Set();
17
+ function F() {
18
+ const [n, r] = N(!1), s = x((a) => {
19
+ r(a);
20
+ for (const t of h)
21
+ t(a);
19
22
  }, []);
20
- return b(() => {
21
- const o = (r) => {
22
- t(r);
23
+ return M(() => {
24
+ const a = (t) => {
25
+ r(t);
23
26
  };
24
- return g.add(o), () => {
25
- g.delete(o);
27
+ return h.add(a), () => {
28
+ h.delete(a);
26
29
  };
27
- }, []), x(() => ({
28
- isKeyboardNavigating: e,
29
- setIsKeyboardNavigating: a
30
- }), [e, a]);
30
+ }, []), k(() => ({
31
+ isKeyboardNavigating: n,
32
+ setIsKeyboardNavigating: s
33
+ }), [n, s]);
31
34
  }
32
- const se = "kakadu-components-949294122";
33
- function G({
34
- label: e,
35
- iconLeft: t,
35
+ const pe = "kakadu-components-949294122";
36
+ function Q({
37
+ isLoading: n,
38
+ label: r,
39
+ iconLeft: s,
36
40
  iconRight: a,
37
- href: o,
38
- shouldCloseOnClick: r = !0,
39
- decorators: k = [],
40
- submenu: l,
41
- className: i,
42
- onClick: s,
43
- ...f
41
+ href: t,
42
+ shouldCloseOnClick: v = !0,
43
+ decorators: j = [],
44
+ submenu: o,
45
+ className: c,
46
+ onClick: l,
47
+ ...p
44
48
  }) {
45
49
  const {
46
- isVisible: m,
47
- isPreparingFocus: u,
48
- isFocused: c,
49
- close: p
50
- } = N(), {
51
- isKeyboardNavigating: d
52
- } = E(), j = A(!0), h = v(() => {
53
- j.current = c;
54
- }, [c]), y = v((S) => {
55
- !d && !j.current || c && (s == null || s(S), l ? l.show() : r && (p == null || p()));
56
- }, [d, c, s, l, r, p]), w = x(() => /* @__PURE__ */ n.jsxs(R, { as: o ? "a" : "button", ...f, type: o ? void 0 : "button", role: "menuitem", href: o, inert: !m && !u, disabled: o ? void 0 : !m && !u, className: K(C, "kakadu-components-1772835671", c && "kakadu-components-3160069815", d ? "kakadu-components-2254977234" : c && "kakadu-components-278139688", i), onClick: y, onPointerDownCapture: h, children: [
57
- /* @__PURE__ */ n.jsxs(M, { className: "kakadu-components-1109353535", children: [
58
- t ? /* @__PURE__ */ n.jsx(P, { width: 12, height: 12, type: t }) : null,
59
- /* @__PURE__ */ n.jsx("span", { className: "kakadu-components-913703148", children: e }),
60
- a ? /* @__PURE__ */ n.jsx(P, { width: 12, height: 12, type: a }) : null
61
- ] }),
62
- d ? null : /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
63
- /* @__PURE__ */ n.jsx(T, { isActive: c, size: 100 }),
64
- /* @__PURE__ */ n.jsx(z, { isActive: c, size: 150, className: L })
50
+ isVisible: u,
51
+ isPreparingFocus: d,
52
+ isFocused: i,
53
+ close: m
54
+ } = S(), {
55
+ isKeyboardNavigating: f
56
+ } = F(), w = C(!0), y = x(() => {
57
+ w.current = i;
58
+ }, [i]), g = x((A) => {
59
+ !f && !w.current || i && (l == null || l(A), o ? o.show() : v && (m == null || m()));
60
+ }, [f, i, l, o, v, m]), I = k(() => /* @__PURE__ */ e.jsxs(R, { as: t && !n ? "a" : "button", ...p, type: t && !n ? void 0 : "button", role: "menuitem", href: t, inert: !u && !d || n, disabled: t ? void 0 : !u && !d || n, className: K(D, "kakadu-components-1772835671", i && "kakadu-components-3160069815", f ? "kakadu-components-2254977234" : i && "kakadu-components-278139688", c), onClick: g, onPointerDownCapture: y, children: [
61
+ /* @__PURE__ */ e.jsx(E, { className: "kakadu-components-1109353535", children: n ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
62
+ /* @__PURE__ */ e.jsx(O, { children: r }),
63
+ s ? /* @__PURE__ */ e.jsx(b, { size: 12 }) : null,
64
+ /* @__PURE__ */ e.jsx(J, { height: "1em", width: "100%" }),
65
+ a ? /* @__PURE__ */ e.jsx(b, { size: 12 }) : null
66
+ ] }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
67
+ s ? /* @__PURE__ */ e.jsx(P, { width: 12, height: 12, type: s }) : null,
68
+ /* @__PURE__ */ e.jsx("span", { className: "kakadu-components-4055589237", children: r }),
69
+ a ? /* @__PURE__ */ e.jsx(P, { width: 12, height: 12, type: a }) : null
70
+ ] }) }),
71
+ f || n ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
72
+ /* @__PURE__ */ e.jsx(G, { isActive: i, size: 100 }),
73
+ /* @__PURE__ */ e.jsx(V, { isActive: i, size: 150, className: B })
65
74
  ] })
66
- ] }), [o, f, m, u, d, i, y, h, t, e, a, c]);
67
- return /* @__PURE__ */ n.jsx(B, { decorators: k, children: l ? /* @__PURE__ */ n.jsx(O, { menu: l.popoverMenu, className: "kakadu-components-1861176543", children: w }) : w });
75
+ ] }), [t, n, p, u, d, f, c, g, y, s, r, a, i]);
76
+ return /* @__PURE__ */ e.jsx(q, { decorators: j, children: o ? /* @__PURE__ */ e.jsx(Z, { menu: o.popoverMenu, className: "kakadu-components-1861176543", children: I }) : I });
68
77
  }
69
- function U(e) {
70
- if ("type" in e) {
71
- if (e.type === "separator")
72
- return /* @__PURE__ */ n.jsx(V, {});
73
- if (e.type === "group")
74
- return /* @__PURE__ */ n.jsx(M, { className: "kakadu-components-1499037363", children: e.label });
78
+ function W(n) {
79
+ if ("type" in n) {
80
+ if (n.type === "separator")
81
+ return /* @__PURE__ */ e.jsx(U, {});
82
+ if (n.type === "group")
83
+ return /* @__PURE__ */ e.jsx(E, { className: "kakadu-components-1499037363", children: n.label });
75
84
  }
76
- return /* @__PURE__ */ n.jsx(G, { ...e });
85
+ return /* @__PURE__ */ e.jsx(Q, { ...n });
77
86
  }
78
- function q({
79
- items: e
87
+ function X({
88
+ items: n
80
89
  }) {
81
90
  const {
82
- isFocused: t
83
- } = N(), [a, o] = I([]), {
84
- setIsKeyboardNavigating: r
85
- } = E(), k = v((i) => {
86
- i && o((s) => s.includes(i) ? s : [...s, i]);
87
- }, []), l = v((i) => {
88
- t && (i.currentTarget.focus(), r(!1));
89
- }, [t, r]);
90
- return b(() => {
91
- if (!t)
91
+ isFocused: r
92
+ } = S(), [s, a] = N([]), {
93
+ setIsKeyboardNavigating: t
94
+ } = F(), v = x((o) => {
95
+ o && a((c) => c.includes(o) ? c : [...c, o]);
96
+ }, []), j = x((o) => {
97
+ r && (o.currentTarget.focus(), t(!1));
98
+ }, [r, t]);
99
+ return M(() => {
100
+ if (!r)
92
101
  return;
93
- const i = (s) => {
94
- const f = a.filter((d) => d.isConnected), m = f.length;
95
- if (m === 0)
102
+ const o = (c) => {
103
+ const l = s.filter((m) => m.isConnected), p = l.length;
104
+ if (p === 0)
96
105
  return;
97
106
  let u;
98
- const c = document.activeElement;
99
- let p = c ? f.indexOf(c) : -1;
100
- switch (p === -1 && (p = 0), s.key) {
107
+ const d = document.activeElement;
108
+ let i = d ? l.indexOf(d) : -1;
109
+ switch (i === -1 && (i = 0), c.key) {
101
110
  case "ArrowDown": {
102
- u = (p + 1) % m;
111
+ u = (i + 1) % p;
103
112
  break;
104
113
  }
105
114
  case "ArrowUp": {
106
- u = (p - 1 + m) % m;
115
+ u = (i - 1 + p) % p;
107
116
  break;
108
117
  }
109
118
  case "Home": {
@@ -111,69 +120,69 @@ function q({
111
120
  break;
112
121
  }
113
122
  case "End": {
114
- u = m - 1;
123
+ u = p - 1;
115
124
  break;
116
125
  }
117
126
  case "Tab": {
118
- r(!0);
127
+ t(!0);
119
128
  return;
120
129
  }
121
130
  }
122
131
  if (u !== void 0) {
123
- s.preventDefault(), s.stopPropagation();
124
- const d = f[u];
125
- d && (d.focus(), r(!0));
132
+ c.preventDefault(), c.stopPropagation();
133
+ const m = l[u];
134
+ m && (m.focus(), t(!0));
126
135
  }
127
136
  };
128
- return window.addEventListener("keydown", i, {
137
+ return window.addEventListener("keydown", o, {
129
138
  capture: !0
130
139
  }), () => {
131
- window.removeEventListener("keydown", i, {
140
+ window.removeEventListener("keydown", o, {
132
141
  capture: !0
133
142
  });
134
143
  };
135
- }, [t, a, r]), /* @__PURE__ */ n.jsx(n.Fragment, { children: e.map((i, s) => /* @__PURE__ */ n.jsx(
136
- U,
144
+ }, [r, s, t]), /* @__PURE__ */ e.jsx(e.Fragment, { children: n.map((o, c) => /* @__PURE__ */ e.jsx(
145
+ W,
137
146
  {
138
- ...i,
139
- reference: k,
140
- onMouseEnter: l
147
+ ...o,
148
+ reference: v,
149
+ onMouseEnter: j
141
150
  },
142
- s
151
+ c
143
152
  )) });
144
153
  }
145
- function J({
146
- items: e,
147
- ...t
154
+ function Y({
155
+ items: n,
156
+ ...r
148
157
  }) {
149
- return /* @__PURE__ */ n.jsx(D, { ...t, as: "nav", role: "menu", innerClassName: "kakadu-components-3600436535", children: /* @__PURE__ */ n.jsx(q, { items: e }) });
158
+ return /* @__PURE__ */ e.jsx(z, { ...r, as: "nav", role: "menu", innerClassName: "kakadu-components-3600436535", children: /* @__PURE__ */ e.jsx(X, { items: n }) });
150
159
  }
151
- function ae(e) {
152
- const t = x(() => ({
153
- items: e
154
- }), [e]), {
155
- show: a,
156
- close: o,
157
- popover: r
158
- } = H(J, t);
159
- return x(() => ({
160
- show: a,
161
- close: o,
162
- popoverMenu: r
163
- }), [a, o, r]);
160
+ function de(n) {
161
+ const r = k(() => ({
162
+ items: n
163
+ }), [n]), {
164
+ show: s,
165
+ close: a,
166
+ popover: t
167
+ } = T(Y, r);
168
+ return k(() => ({
169
+ show: s,
170
+ close: a,
171
+ popoverMenu: t
172
+ }), [s, a, t]);
164
173
  }
165
- function O({
166
- menu: e,
167
- className: t,
168
- children: a
174
+ function Z({
175
+ menu: n,
176
+ className: r,
177
+ children: s
169
178
  }) {
170
- return /* @__PURE__ */ n.jsxs(F, { className: t, children: [
171
- a,
172
- e
179
+ return /* @__PURE__ */ e.jsxs(H, { className: r, children: [
180
+ s,
181
+ n
173
182
  ] });
174
183
  }
175
184
  export {
176
- se as dangerPopoverMenuItemStyles,
177
- O as default,
178
- ae as usePopoverMenu
185
+ pe as dangerPopoverMenuItemStyles,
186
+ Z as default,
187
+ de as usePopoverMenu
179
188
  };
@@ -10,6 +10,7 @@ export declare function AnchorHeading<Type extends AtomElementType = 'h1'>({ as,
10
10
  export declare const spanStyles: string;
11
11
  export declare function Span<Type extends AtomElementType = 'span'>({ as, className, ...properties }: AtomProperties<Type>): import("react/jsx-runtime").JSX.Element;
12
12
  export declare function Paragraph<Type extends AtomElementType = 'p'>({ as, className, ...properties }: AtomProperties<Type>): import("react/jsx-runtime").JSX.Element;
13
+ export declare function Footnote<Type extends AtomElementType = 'small'>({ as, className, ...properties }: AtomProperties<Type>): import("react/jsx-runtime").JSX.Element;
13
14
  export declare function Label<Type extends AtomElementType = 'span'>({ as, className, ...properties }: AtomProperties<Type>): import("react/jsx-runtime").JSX.Element;
14
15
  export type TextProperties<Type extends AtomElementType = 'div'> = Omit<AtomProperties<Type>, 'width'> & {
15
16
  readonly width?: WrapperWidth;