@kakadu/components 6.1.1 → 6.3.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.
Files changed (128) hide show
  1. package/build/components/aria-text.d.ts +2 -1
  2. package/build/components/box.d.ts +2 -1
  3. package/build/components/button-tooltip.d.ts +2 -1
  4. package/build/components/button.d.ts +3 -3
  5. package/build/components/button.js +1 -1
  6. package/build/components/button.mjs +27 -25
  7. package/build/components/card.d.ts +2 -2
  8. package/build/components/click-ripples.d.ts +2 -2
  9. package/build/components/click-ripples.js +1 -1
  10. package/build/components/click-ripples.mjs +50 -45
  11. package/build/components/collapsible.d.ts +2 -2
  12. package/build/components/combobox.d.ts +2 -2
  13. package/build/components/combobox.js +1 -1
  14. package/build/components/combobox.mjs +161 -159
  15. package/build/components/copy-icon-button.d.ts +2 -1
  16. package/build/components/datum.d.ts +2 -2
  17. package/build/components/dot.d.ts +2 -2
  18. package/build/components/flex.d.ts +2 -1
  19. package/build/components/footer.d.ts +2 -2
  20. package/build/components/gauge.d.ts +2 -1
  21. package/build/components/header.d.ts +2 -1
  22. package/build/components/hover-gradient.d.ts +2 -2
  23. package/build/components/hover-gradient.js +1 -1
  24. package/build/components/hover-gradient.mjs +48 -35
  25. package/build/components/icon-button.d.ts +2 -2
  26. package/build/components/input.d.ts +3 -3
  27. package/build/components/input.js +2 -2
  28. package/build/components/input.mjs +21 -21
  29. package/build/components/logos/akt-logo.d.ts +2 -2
  30. package/build/components/logos/amedia-logo.d.ts +2 -2
  31. package/build/components/logos/bankaxept-logo.d.ts +2 -2
  32. package/build/components/logos/bankid-logo.d.ts +2 -2
  33. package/build/components/logos/dnb-logo.d.ts +2 -2
  34. package/build/components/logos/entur-logo.d.ts +2 -2
  35. package/build/components/logos/gjensidige-logo.d.ts +2 -2
  36. package/build/components/logos/kakadu-academy-logo.d.ts +2 -2
  37. package/build/components/logos/kakadu-guide-icon.d.ts +2 -1
  38. package/build/components/logos/kakadu-guide-logo.d.ts +3 -3
  39. package/build/components/logos/kakadu-index-logo.d.ts +2 -2
  40. package/build/components/logos/kakadu-logo.d.ts +2 -2
  41. package/build/components/logos/kakadu-play-logo.d.ts +2 -2
  42. package/build/components/logos/kolumbus-logo.d.ts +2 -2
  43. package/build/components/logos/nordea-logo.d.ts +2 -2
  44. package/build/components/logos/norsk-tipping-logo.d.ts +2 -2
  45. package/build/components/logos/ruter-logo.d.ts +2 -2
  46. package/build/components/logos/senteret-for-et-aldersvennlig-norge-logo.d.ts +2 -2
  47. package/build/components/logos/sparebank1-logo.d.ts +2 -2
  48. package/build/components/logos/sparebanken-norge-logo.d.ts +2 -2
  49. package/build/components/logos/sto-logo.d.ts +2 -2
  50. package/build/components/logos/storebrand-logo.d.ts +2 -2
  51. package/build/components/modal.d.ts +6 -6
  52. package/build/components/modal.js +1 -1
  53. package/build/components/modal.mjs +86 -85
  54. package/build/components/moving-gradients.js +1 -1
  55. package/build/components/moving-gradients.mjs +80 -70
  56. package/build/components/moving-stars.js +1 -1
  57. package/build/components/moving-stars.mjs +77 -74
  58. package/build/components/notice.d.ts +2 -2
  59. package/build/components/notification.d.ts +8 -6
  60. package/build/components/notification.js +1 -1
  61. package/build/components/notification.mjs +87 -71
  62. package/build/components/popover-menu.d.ts +3 -3
  63. package/build/components/popover-menu.js +1 -1
  64. package/build/components/popover-menu.mjs +131 -129
  65. package/build/components/popover.d.ts +4 -4
  66. package/build/components/popover.js +1 -1
  67. package/build/components/popover.mjs +82 -73
  68. package/build/components/revealer.d.ts +2 -2
  69. package/build/components/select.d.ts +2 -2
  70. package/build/components/separator.d.ts +5 -5
  71. package/build/components/skeleton.d.ts +3 -2
  72. package/build/components/spinner.d.ts +3 -2
  73. package/build/components/text-button.d.ts +2 -2
  74. package/build/components/text.d.ts +9 -8
  75. package/build/components/theme-setter.d.ts +2 -2
  76. package/build/components/veil.d.ts +2 -1
  77. package/build/components/wrapper.d.ts +2 -2
  78. package/build/components.css +1 -1
  79. package/build/hooks/use-is-document-focused.js +1 -1
  80. package/build/hooks/use-is-document-focused.mjs +30 -14
  81. package/build/icons/anchor-down.d.ts +2 -2
  82. package/build/icons/anchor-up.d.ts +2 -2
  83. package/build/icons/arrow-down.d.ts +2 -2
  84. package/build/icons/arrow-left.d.ts +2 -2
  85. package/build/icons/arrow-right.d.ts +2 -2
  86. package/build/icons/arrow-up.d.ts +2 -2
  87. package/build/icons/caret-down.d.ts +2 -2
  88. package/build/icons/caret-left.d.ts +2 -2
  89. package/build/icons/caret-right.d.ts +2 -2
  90. package/build/icons/caret-up.d.ts +2 -2
  91. package/build/icons/check.d.ts +2 -2
  92. package/build/icons/chevron-down.d.ts +2 -2
  93. package/build/icons/chevron-left.d.ts +2 -2
  94. package/build/icons/chevron-right.d.ts +2 -2
  95. package/build/icons/chevron-up.d.ts +2 -2
  96. package/build/icons/chrome-browser-logo.d.ts +2 -2
  97. package/build/icons/cog.d.ts +2 -2
  98. package/build/icons/copy.d.ts +2 -2
  99. package/build/icons/document.d.ts +2 -2
  100. package/build/icons/dots.d.ts +2 -2
  101. package/build/icons/drag.d.ts +2 -2
  102. package/build/icons/edge-browser-logo.d.ts +2 -2
  103. package/build/icons/edit.d.ts +2 -2
  104. package/build/icons/exclamation-triangle.d.ts +2 -2
  105. package/build/icons/external.d.ts +2 -2
  106. package/build/icons/eye.d.ts +2 -2
  107. package/build/icons/icon.d.ts +2 -2
  108. package/build/icons/information.d.ts +2 -2
  109. package/build/icons/kakadu-guide-glyph.d.ts +2 -2
  110. package/build/icons/kakadu-guide-icon.d.ts +2 -2
  111. package/build/icons/menu.d.ts +2 -2
  112. package/build/icons/package.d.ts +2 -2
  113. package/build/icons/plus.d.ts +2 -2
  114. package/build/icons/select.d.ts +2 -2
  115. package/build/icons/share.d.ts +2 -2
  116. package/build/icons/sparkle.d.ts +2 -2
  117. package/build/icons/test.d.ts +2 -2
  118. package/build/icons/times.d.ts +2 -2
  119. package/build/icons/trash.d.ts +2 -2
  120. package/build/icons/trend-up.d.ts +2 -2
  121. package/build/index.d.ts +2 -0
  122. package/build/index.js +1 -1
  123. package/build/index.mjs +19 -17
  124. package/build/theme.d.ts +2 -1
  125. package/build/utilities/listeners.d.ts +5 -0
  126. package/build/utilities/listeners.js +1 -0
  127. package/build/utilities/listeners.mjs +16 -0
  128. package/package.json +16 -22
@@ -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"),r=require("@kuma-ui/core"),Q=require("../utilities/copy-to-clipboard.js"),M=require("../theme.js"),me=require("../icons/sparkle.js"),de=require("./button-tooltip.js"),w=require("./text-button.js"),x=require("./text.js"),je=require("./collapsible.js"),X=require("./click-ripples.js"),Y=require("./hover-gradient.js"),ke=require("./notification.js"),fe="kakadu-components-922159086",he="kakadu-components-25448712",N="kakadu-components-3185985134",T="kakadu-components-4056037255",Z=r.cx(T,"kakadu-components-3245407458"),Ee=r.cx(T,"kakadu-components-1117160492"),Re=r.cx(T,"kakadu-components-821835704");function be({as:p,className:c,...m}){return e.jsxRuntimeExports.jsx(x.Span,{as:p??"span",...m,className:r.cx("kakadu-components-520991867",c)})}function ee({label:p,error:c,errorId:m,warning:l,warningId:h,information:i,informationId:v,footnote:a,attachments:S,className:d,children:j,...k}){const E=!!c,u=!!l,R=!!i,f=!!a;return e.jsxRuntimeExports.jsx("label",{...k,className:r.cx(fe,d),children:e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[e.jsxRuntimeExports.jsx(x.Span,{className:r.cx(M.overflowProtectionStyles,he),children:e.jsxRuntimeExports.jsx("span",{children:p})}),e.jsxRuntimeExports.jsxs("span",{className:"kakadu-components-3298764637",children:[j,f?e.jsxRuntimeExports.jsx(be,{className:"kakadu-components-613632806",children:a}):null,S]}),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:Ee,children:l instanceof Error?l.message:l}):R?e.jsxRuntimeExports.jsx(x.Paragraph,{id:v,className:Re,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:v,suggestion:a,attachments:S,actions:d=[],hasCopyButton:j,hasClearButton:k,isMultiline:E,onChange:u,children:R,className:f,...C}){const $=t.useRef(null),H=t.useRef(null),q=t.useRef(null),A=ke.useCreateNotification(),I=t.useId(),F=`${I}-error`,V=`${I}-warning`,O=`${I}-information`,{value:b,disabled:te}=C,[se,W]=t.useState(""),o=b??se,[ne,ae]=t.useState(),oe=c==="textarea"||!!E;t.useLayoutEffect(()=>{typeof o=="string"&&q.current&&ae(q.current.scrollHeight)},[o]);const P=t.useMemo(()=>typeof o=="string"?`${o} `.split(`
2
- `):[],[o]),re=t.useMemo(()=>P.length,[P]),g=!!l,_=!g&&!!h,B=!!i,z=g?F:_?V:B?O:void 0;t.useEffect(()=>{W(typeof b=="string"?b:"")},[b]);const D=t.useCallback(s=>{const{value:n}=s.target;W(n),u==null||u(n,s)},[u]),ce=t.useCallback(()=>{typeof o=="string"&&(Q.default(o),A({type:"success",children:"Copied to clipboard."}))},[o,A]),y=t.useCallback(s=>{var J;const n=H.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 pe=new Event("input",{bubbles:!0});n.dispatchEvent(pe),n.focus();return}}throw new Error("Unable to set value.")},[]),le=t.useCallback(()=>{y("")},[y]),[ie,ue]=t.useState(""),G=!!a&&ie!==a,xe=t.useCallback(()=>{if(a){try{y(a)}catch{Q.default(a)}ue(a)}},[a,y]),U=t.useMemo(()=>d.length,[d]);return e.jsxRuntimeExports.jsxs(ee,{ref:p,label:m,error:l,errorId:F,warning:h,warningId:V,information:i,informationId:O,footnote:v,attachments:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(je.default,{isCollapsed:!G,children:G?e.jsxRuntimeExports.jsxs("button",{type:"button",className:r.cx(M.buttonResetStyles,M.overflowProtectionStyles,"kakadu-components-4141839293"),onClick:xe,children:[e.jsxRuntimeExports.jsx(de.default,{label:"Apply suggestion"}),e.jsxRuntimeExports.jsx(me.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}),S]}),style:{"--button-padding":`calc(${ge*((j?1:0)+(k?1:0)+U)}px + 6px)`},children:[e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[oe?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,re>1?e.jsxRuntimeExports.jsx("br",{}):null]},n))," "]}),e.jsxRuntimeExports.jsx("textarea",{...C,ref:H,rows:1,"aria-invalid":g,"data-warning":_,"data-information":B,"aria-describedby":z,value:o,className:r.cx(N,f,"kakadu-components-2119524139"),style:{minHeight:ne},onChange:D})]}):e.jsxRuntimeExports.jsx("input",{...C,ref:$,type:c??"text",value:o,"aria-invalid":g,"data-warning":_,"data-information":B,"aria-describedby":z,className:r.cx(N,f),onChange:D}),te?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(w.default,{iconLeft:s.icon,label:s.label,tooltip:s.label,className:L,onClick:s.onClick},s.label+n)),j?e.jsxRuntimeExports.jsx(w.default,{iconLeft:"copy",label:"Copy",tooltip:"Copy",className:L,onClick:ce}):null,k?e.jsxRuntimeExports.jsx(w.default,{iconLeft:"times",label:"Clear",tooltip:"Clear",className:L,onClick:le}):null]}):null,R]})}exports.InputLabel=ee;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-BB_1_6y_.js"),t=require("react"),r=require("@kuma-ui/core"),Q=require("../utilities/copy-to-clipboard.js"),M=require("../theme.js"),me=require("../icons/sparkle.js"),de=require("./button-tooltip.js"),B=require("./text-button.js"),x=require("./text.js"),je=require("./collapsible.js"),X=require("./click-ripples.js"),Y=require("./hover-gradient.js"),ke=require("./notification.js"),fe="kakadu-components-922159086",he="kakadu-components-25448712",v="kakadu-components-3185985134",T="kakadu-components-4056037255",Z=r.cx(T,"kakadu-components-3245407458"),Ee=r.cx(T,"kakadu-components-1117160492"),Re=r.cx(T,"kakadu-components-821835704");function be({as:p,className:c,...m}){return e.jsxRuntimeExports.jsx(x.Span,{as:p??"span",...m,className:r.cx("kakadu-components-520991867",c)})}function ee({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(fe,d),children:e.jsxRuntimeExports.jsxs("div",{className:"kakadu-components-3146929190",children:[e.jsxRuntimeExports.jsx(x.Span,{className:r.cx(M.overflowProtectionStyles,he),children:e.jsxRuntimeExports.jsx("span",{children:p})}),e.jsxRuntimeExports.jsxs("span",{className:"kakadu-components-3298764637",children:[j,f?e.jsxRuntimeExports.jsx(be,{className:"kakadu-components-613632806",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:Ee,children:l instanceof Error?l.message:l}):R?e.jsxRuntimeExports.jsx(x.Paragraph,{id:S,className:Re,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),H=t.useRef(null),q=t.useRef(null),A=ke.useCreateNotification(),I=t.useId(),F=`${I}-error`,V=`${I}-warning`,O=`${I}-information`,{value:g,disabled:te}=b,[se,W]=t.useState(""),o=g??se,[ne,ae]=t.useState(),oe=c==="textarea"||!!E;t.useLayoutEffect(()=>{typeof o=="string"&&q.current&&ae(q.current.scrollHeight)},[o]);const P=t.useMemo(()=>typeof o=="string"?`${o} `.split(`
2
+ `):[],[o]),re=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]),ce=t.useCallback(()=>{typeof o=="string"&&(Q.default(o),A({type:"success",children:"Copied to clipboard."}))},[o,A]),N=t.useCallback(s=>{var J;const n=H.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 pe=new Event("input",{bubbles:!0});n.dispatchEvent(pe),n.focus();return}}throw new Error("Unable to set value.")},[]),le=t.useCallback(()=>{N("")},[N]),[ie,ue]=t.useState(""),G=!!a&&ie!==a,xe=t.useCallback(()=>{if(a){try{N(a)}catch{Q.default(a)}ue(a)}},[a,N]),U=t.useMemo(()=>d.length,[d]);return e.jsxRuntimeExports.jsxs(ee,{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(je.default,{isCollapsed:!G,children:G?e.jsxRuntimeExports.jsxs("button",{type:"button",className:r.cx(M.buttonResetStyles,M.overflowProtectionStyles,"kakadu-components-4141839293"),onClick:xe,children:[e.jsxRuntimeExports.jsx(de.default,{label:"Apply suggestion"}),e.jsxRuntimeExports.jsx(me.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:[oe?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("span",{ref:q,"aria-hidden":!0,className:r.cx(v,f,"kakadu-components-2033521835"),children:[P.map((s,n)=>e.jsxRuntimeExports.jsxs("span",{children:[s,re>1?e.jsxRuntimeExports.jsx("br",{}):null]},n))," "]}),e.jsxRuntimeExports.jsx("textarea",{...b,ref:H,rows:b.rows??1,"aria-invalid":y,"data-warning":_,"data-information":w,"aria-describedby":z,value:o,className:r.cx(v,f,"kakadu-components-2119524139"),style:{minHeight:ne},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(v,f),onChange:D}),te?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:ce}):null,k?e.jsxRuntimeExports.jsx(B.default,{iconLeft:"times",label:"Clear",tooltip:"Clear",className:L,onClick:le}):null]}):null,R]})}exports.InputLabel=ee;exports.default=ye;exports.errorParagraph=Z;exports.inputStyles=v;
@@ -26,9 +26,9 @@ function we({
26
26
  warning: c,
27
27
  warningId: x,
28
28
  information: r,
29
- informationId: v,
29
+ informationId: C,
30
30
  footnote: a,
31
- attachments: C,
31
+ attachments: S,
32
32
  className: p,
33
33
  children: u,
34
34
  ...k
@@ -39,9 +39,9 @@ function we({
39
39
  /* @__PURE__ */ e.jsxs("span", { className: "kakadu-components-3298764637", children: [
40
40
  u,
41
41
  f ? /* @__PURE__ */ e.jsx(Be, { className: "kakadu-components-613632806", children: a }) : null,
42
- C
42
+ S
43
43
  ] }),
44
- j || i || b ? /* @__PURE__ */ e.jsx("div", { className: "kakadu-components-2927674627", children: j ? /* @__PURE__ */ e.jsx(M, { id: m, className: Se, children: l instanceof Error ? l.message : l }) : i ? /* @__PURE__ */ e.jsx(M, { id: x, className: Ee, children: c instanceof Error ? c.message : c }) : b ? /* @__PURE__ */ e.jsx(M, { id: v, 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(M, { id: m, className: Se, children: l instanceof Error ? l.message : l }) : i ? /* @__PURE__ */ e.jsx(M, { id: x, className: Ee, children: c instanceof Error ? c.message : c }) : b ? /* @__PURE__ */ e.jsx(M, { id: C, className: Ie, children: r instanceof Error ? r.message : r }) : null }) : null
45
45
  ] }) });
46
46
  }
47
47
  const Le = 40, A = "kakadu-components-4233741488";
@@ -52,9 +52,9 @@ function Ge({
52
52
  error: c,
53
53
  warning: x,
54
54
  information: r,
55
- footnote: v,
55
+ footnote: C,
56
56
  suggestion: a,
57
- attachments: C,
57
+ attachments: S,
58
58
  actions: p = [],
59
59
  hasCopyButton: u,
60
60
  hasClearButton: k,
@@ -62,20 +62,20 @@ function Ge({
62
62
  onChange: i,
63
63
  children: b,
64
64
  className: f,
65
- ...S
65
+ ...y
66
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
- value: y,
68
+ value: g,
69
69
  disabled: ae
70
- } = S, [se, q] = T(""), s = y ?? se, [oe, le] = T(), ce = l === "textarea" || !!j;
70
+ } = y, [se, q] = T(""), s = g ?? se, [oe, le] = T(), ce = l === "textarea" || !!j;
71
71
  he(() => {
72
72
  typeof s == "string" && E.current && le(E.current.scrollHeight);
73
73
  }, [s]);
74
74
  const B = H(() => typeof s == "string" ? `${s} `.split(`
75
- `) : [], [s]), re = H(() => B.length, [B]), g = !!c, w = !g && !!x, L = !!r, J = g ? D : w ? G : L ? U : void 0;
75
+ `) : [], [s]), re = H(() => B.length, [B]), N = !!c, w = !N && !!x, L = !!r, J = N ? D : w ? G : L ? U : void 0;
76
76
  xe(() => {
77
- q(typeof y == "string" ? y : "");
78
- }, [y]);
77
+ q(typeof g == "string" ? g : "");
78
+ }, [g]);
79
79
  const K = h((n) => {
80
80
  const {
81
81
  value: t
@@ -86,7 +86,7 @@ function Ge({
86
86
  type: "success",
87
87
  children: "Copied to clipboard."
88
88
  }));
89
- }, [s, z]), N = h((n) => {
89
+ }, [s, z]), v = h((n) => {
90
90
  var Y;
91
91
  const t = W.current ?? O.current ?? void 0;
92
92
  if (t) {
@@ -102,18 +102,18 @@ function Ge({
102
102
  }
103
103
  throw new Error("Unable to set value.");
104
104
  }, []), de = h(() => {
105
- N("");
106
- }, [N]), [me, pe] = T(""), Q = !!a && me !== a, ue = h(() => {
105
+ v("");
106
+ }, [v]), [me, pe] = T(""), Q = !!a && me !== a, ue = h(() => {
107
107
  if (a) {
108
108
  try {
109
- N(a);
109
+ v(a);
110
110
  } catch {
111
111
  _(a);
112
112
  }
113
113
  pe(a);
114
114
  }
115
- }, [a, N]), 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: v, attachments: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
115
+ }, [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
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
118
  /* @__PURE__ */ e.jsx(ye, { label: "Apply suggestion" }),
119
119
  /* @__PURE__ */ e.jsx(be, { width: 13, height: 13, className: "kakadu-components-1417828741" }),
@@ -121,7 +121,7 @@ function Ge({
121
121
  /* @__PURE__ */ e.jsx(ee, { className: "kakadu-components-2744733744" }),
122
122
  /* @__PURE__ */ e.jsx(ne, {})
123
123
  ] }) : null }),
124
- C
124
+ S
125
125
  ] }), style: {
126
126
  "--button-padding": `calc(${Le * ((u ? 1 : 0) + (k ? 1 : 0) + X)}px + 6px)`
127
127
  }, children: [
@@ -137,10 +137,10 @@ function Ge({
137
137
  )),
138
138
  " "
139
139
  ] }),
140
- /* @__PURE__ */ e.jsx("textarea", { ...S, ref: W, rows: 1, "aria-invalid": g, "data-warning": w, "data-information": L, "aria-describedby": J, value: s, className: o($, f, "kakadu-components-2119524139"), style: {
140
+ /* @__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($, f, "kakadu-components-2119524139"), style: {
141
141
  minHeight: oe
142
142
  }, onChange: K })
143
- ] }) : /* @__PURE__ */ e.jsx("input", { ...S, ref: O, type: l ?? "text", value: s, "aria-invalid": g, "data-warning": w, "data-information": L, "aria-describedby": J, className: o($, f), onChange: K }),
143
+ ] }) : /* @__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($, f), onChange: K }),
144
144
  ae ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
145
145
  /* @__PURE__ */ e.jsx(ee, { className: "kakadu-components-616311160" }),
146
146
  /* @__PURE__ */ e.jsx(ne, { className: "kakadu-components-1962999040" })
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function AktLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function AktLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function AmediaLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function AmediaLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function BankAxeptLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function BankAxeptLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function BankIdLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function BankIdLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function DnbLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function DnbLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function EnturLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function EnturLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function GjensidigeLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function GjensidigeLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function KakaduAcademyLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function KakaduAcademyLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  export default function KakaduGuideIcon({ size }: {
2
3
  readonly size?: number;
3
- }): import("react/jsx-runtime").JSX.Element;
4
+ }): React.JSX.Element;
@@ -1,8 +1,8 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export declare function KakaduGuideLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export declare function KakaduGuideLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
3
3
  export declare const kakaduGuideLogoVariants: readonly ["default", "flat"];
4
4
  export type KakaduGuideLogoVariant = (typeof kakaduGuideLogoVariants)[number];
5
5
  export default function KakaduGuideLogo({ variant, height, }: {
6
6
  readonly variant?: KakaduGuideLogoVariant;
7
7
  readonly height?: number;
8
- }): import("react/jsx-runtime").JSX.Element;
8
+ }): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function KakaduIndexLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function KakaduIndexLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function KakaduLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function KakaduLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function KakaduPlayLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function KakaduPlayLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function KolumbusLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function KolumbusLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function NordeaLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function NordeaLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function NorskTippingLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function NorskTippingLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function RuterLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function RuterLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function SenteretForEtAldersvennligNorgeLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function SenteretForEtAldersvennligNorgeLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function Sparebank1LogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function Sparebank1LogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function SparebankenNorgeLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function SparebankenNorgeLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function StoLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function StoLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- import { type ComponentPropsWithoutRef } from 'react';
2
- export default function StorebrandLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): import("react/jsx-runtime").JSX.Element;
1
+ import React, { type ComponentPropsWithoutRef } from 'react';
2
+ export default function StorebrandLogoSvg({ fill, ...properties }: ComponentPropsWithoutRef<'svg'>): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import { type ComponentType, type ReactNode } from 'react';
1
+ import React, { type ComponentType, type ReactNode } from 'react';
2
2
  import { type DecoratorType } from './decorators';
3
3
  import { type FlexProperties } from './flex';
4
4
  import { type AtomProperties, type AtomElementType, type DefaultAtomElementType } from './atom';
@@ -11,9 +11,9 @@ type ModalProviderProperties<Data = any> = {
11
11
  close?: (data?: Data) => void;
12
12
  };
13
13
  export declare function useModalContext<Data = any>(): ModalProviderProperties<Data>;
14
- export declare function ModalContent<Type extends AtomElementType = DefaultAtomElementType>(properties: FlexProperties<Type>): import("react/jsx-runtime").JSX.Element;
15
- export declare function ModalHeading<Type extends AtomElementType = DefaultHeadingElementType>({ as, className, ...properties }: AtomProperties<Type>): import("react/jsx-runtime").JSX.Element;
16
- export declare function ModalActions<Type extends AtomElementType = DefaultAtomElementType>({ as, ...properties }: FlexProperties<Type>): import("react/jsx-runtime").JSX.Element;
14
+ export declare function ModalContent<Type extends AtomElementType = DefaultAtomElementType>(properties: FlexProperties<Type>): React.JSX.Element;
15
+ export declare function ModalHeading<Type extends AtomElementType = DefaultHeadingElementType>({ as, className, ...properties }: AtomProperties<Type>): React.JSX.Element;
16
+ export declare function ModalActions<Type extends AtomElementType = DefaultAtomElementType>({ as, ...properties }: FlexProperties<Type>): React.JSX.Element;
17
17
  export type ModalProperties<Data = any> = {
18
18
  readonly root?: HTMLElement | ShadowRoot;
19
19
  readonly outerDecorators?: DecoratorType[];
@@ -30,11 +30,11 @@ export type ModalProperties<Data = any> = {
30
30
  readonly children?: ReactNode;
31
31
  };
32
32
  type ModalBaseProperties<ModalResult> = Omit<ModalProperties<ModalResult>, 'isVisible' | 'onClose'>;
33
- export default function Modal<Data = any>({ root, outerDecorators, innerDecorators, label, maxWidth, className, isVisible, isFullWidth, shouldCloseOnOutsideClick, shouldCloseOnEscapePress, showCloseButton, onClose, children, }: ModalProperties<Data>): import("react/jsx-runtime").JSX.Element | null;
33
+ export default function Modal<Data = any>({ root, outerDecorators, innerDecorators, label, maxWidth, className, isVisible, isFullWidth, shouldCloseOnOutsideClick, shouldCloseOnEscapePress, showCloseButton, onClose, children, }: ModalProperties<Data>): React.JSX.Element | null;
34
34
  export declare function useModal<ModalResult, ModalProperties = ModalBaseProperties<ModalResult>>(ModalComponent: ComponentType<ModalProperties>, properties?: ModalProperties): {
35
35
  isVisible: boolean;
36
36
  show: () => Promise<ModalResult | undefined>;
37
37
  close: (result?: ModalResult) => void;
38
- modal: import("react/jsx-runtime").JSX.Element | null;
38
+ modal: React.JSX.Element | null;
39
39
  };
40
40
  export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("../jsx-runtime-BB_1_6y_.js"),e=require("react"),M=require("@kuma-ui/core"),P=require("react-dom"),$=require("../focus-trap-react-B7f3iC5h.js"),B=require("./text-button.js"),T=require("./decorators.js"),S=require("./flex.js"),D=require("./atom.js"),y=require("./text.js"),_=e.createContext({isVisible:!1,isInteractive:!1}),{Provider:z}=_;function L(){return e.useContext(_)}function G(){const{isInteractive:o,close:r}=L(),a=e.useCallback(()=>{r==null||r()},[r]);return n.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2566044647",children:n.jsxRuntimeExports.jsx(B.default,{iconLeft:"times",label:"Close",disabled:!o,onClick:a})})}function J(o){return n.jsxRuntimeExports.jsx(S.default,{gap:2,...o})}function K({as:o,className:r,...a}){return n.jsxRuntimeExports.jsx(y.Heading,{...a,as:o??y.defaultHeadingElementType,className:M.cx("kakadu-components-4275938488",r)})}function Q({as:o,...r}){return n.jsxRuntimeExports.jsx(S.default,{direction:"row",gap:1,preset:"end",...r,as:o??D.defaultAtomElementType})}function U({root:o,outerDecorators:r=[],innerDecorators:a=[],label:k,maxWidth:c,className:f,isVisible:s,isFullWidth:i=!1,shouldCloseOnOutsideClick:x=!0,shouldCloseOnEscapePress:m=!0,showCloseButton:v=!0,onClose:l,children:d}){const R=e.useRef(null),p=e.useRef(null),[h,N]=e.useState(!1),[u,j]=e.useState(!1),q=e.useCallback(t=>{R.current=t,j(!1)},[]),b=e.useRef(null),w=e.useCallback(t=>{t&&(b.current=t)},[]),[g,C]=e.useState(s??!1),A=e.useMemo(()=>({isVisible:g,isInteractive:u,setInitialFocus:w,close:q}),[g,u,w,q]);e.useEffect(()=>{if(s){const t=setTimeout(()=>{j(!0)},100);return()=>{clearTimeout(t)}}j(!1)},[s]),e.useEffect(()=>{s&&(N(!0),C(!0))},[s]),e.useEffect(()=>{const t=p.current;if(s&&x&&t){const E=H=>{t===H.target&&j(!1)};return t.addEventListener("click",E),()=>{t.removeEventListener("click",E)}}},[s,x]),e.useEffect(()=>{if(!s||!m)return;const t=E=>{E.key==="Escape"&&j(!1)};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[s,m]),e.useEffect(()=>{if(h&&!u){const t=setTimeout(()=>{C(!1),l==null||l(R.current??void 0)},370);return()=>{clearTimeout(t)}}},[h,u,l]);const F=e.useMemo(()=>({initialFocus:()=>b.current??void 0,onActivate:()=>{var t;return(t=b.current)==null?void 0:t.focus()}}),[]);if(!g)return null;const I=n.jsxRuntimeExports.jsx(T.default,{decorators:r,children:n.jsxRuntimeExports.jsx("div",{"aria-hidden":!u,style:{"--max-width":c?`${c}px`:void 0},className:M.cx("kakadu-components-4119461136",u&&"kakadu-components-2522346797",f),children:n.jsxRuntimeExports.jsx(T.default,{decorators:a,children:n.jsxRuntimeExports.jsx($.focusTrapReactExports.FocusTrap,{active:u,focusTrapOptions:F,children:n.jsxRuntimeExports.jsx("div",{ref:p,className:"kakadu-components-4011815997",children:n.jsxRuntimeExports.jsx("div",{role:"dialog","aria-modal":"true","aria-label":k??"Modal",className:M.cx("kakadu-components-3324483532",i&&"kakadu-components-3799971070",u&&"kakadu-components-968755580"),children:n.jsxRuntimeExports.jsxs(z,{value:A,children:[v?n.jsxRuntimeExports.jsx(G,{}):null,n.jsxRuntimeExports.jsx("div",{className:M.cx("kakadu-components-633990035",i&&"kakadu-components-171969824"),children:d})]})})})})})})});return o?P.createPortal(I,o):I}function V(o,r){const[a,k]=e.useState(!1),[c,f]=e.useState(!1),s=e.useRef(void 0),i=e.useRef(void 0),x=e.useCallback(async()=>(i.current=void 0,k(!0),f(!0),new Promise(d=>{s.current=d})),[]),m=e.useCallback(d=>{i.current=d,f(!1)},[]),v=e.useCallback(d=>{var p;const R=d??i.current;i.current=void 0,(p=s.current)==null||p.call(s,R),s.current=void 0,k(!1),f(!1)},[]),l=e.useMemo(()=>a?n.jsxRuntimeExports.jsx(o,{...r,isVisible:c,onClose:v}):null,[a,o,r,c,v]);return e.useMemo(()=>({isVisible:c,show:x,close:m,modal:l}),[c,x,m,l])}exports.ModalActions=Q;exports.ModalContent=J;exports.ModalHeading=K;exports.default=U;exports.useModal=V;exports.useModalContext=L;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("../jsx-runtime-BB_1_6y_.js"),e=require("react"),E=require("@kuma-ui/core"),P=require("react-dom"),$=require("../focus-trap-react-B7f3iC5h.js"),B=require("../utilities/listeners.js"),D=require("./text-button.js"),T=require("./decorators.js"),_=require("./flex.js"),K=require("./atom.js"),y=require("./text.js"),z=B.default(s=>{window.addEventListener("keydown",s)},s=>{window.removeEventListener("keydown",s)}),S=e.createContext({isVisible:!1,isInteractive:!1}),{Provider:G}=S;function L(){return e.useContext(S)}function J(){const{isInteractive:s,close:r}=L(),a=e.useCallback(()=>{r==null||r()},[r]);return o.jsxRuntimeExports.jsx("div",{className:"kakadu-components-2566044647",children:o.jsxRuntimeExports.jsx(D.default,{iconLeft:"times",label:"Close",disabled:!s,onClick:a})})}function Q(s){return o.jsxRuntimeExports.jsx(_.default,{gap:2,...s})}function U({as:s,className:r,...a}){return o.jsxRuntimeExports.jsx(y.Heading,{...a,as:s??y.defaultHeadingElementType,className:E.cx("kakadu-components-4275938488",r)})}function V({as:s,...r}){return o.jsxRuntimeExports.jsx(_.default,{direction:"row",gap:1,preset:"end",...r,as:s??K.defaultAtomElementType})}function X({root:s,outerDecorators:r=[],innerDecorators:a=[],label:k,maxWidth:c,className:f,isVisible:n,isFullWidth:i=!1,shouldCloseOnOutsideClick:x=!0,shouldCloseOnEscapePress:m=!0,showCloseButton:v=!0,onClose:l,children:d}){const R=e.useRef(null),p=e.useRef(null),[q,N]=e.useState(!1),[u,j]=e.useState(!1),w=e.useCallback(t=>{R.current=t,j(!1)},[]),M=e.useRef(null),g=e.useCallback(t=>{t&&(M.current=t)},[]),[b,h]=e.useState(n??!1),A=e.useMemo(()=>({isVisible:b,isInteractive:u,setInitialFocus:g,close:w}),[b,u,g,w]);e.useEffect(()=>{if(n){const t=setTimeout(()=>{j(!0)},100);return()=>{clearTimeout(t)}}j(!1)},[n]),e.useEffect(()=>{n&&(N(!0),h(!0))},[n]),e.useEffect(()=>{const t=p.current;if(n&&x&&t){const I=H=>{t===H.target&&j(!1)};return t.addEventListener("click",I),()=>{t.removeEventListener("click",I)}}},[n,x]),e.useEffect(()=>{if(!(!n||!m))return z(t=>{t.key==="Escape"&&j(!1)})},[n,m]),e.useEffect(()=>{if(q&&!u){const t=setTimeout(()=>{h(!1),l==null||l(R.current??void 0)},370);return()=>{clearTimeout(t)}}},[q,u,l]);const F=e.useMemo(()=>({initialFocus:()=>M.current??void 0,onActivate:()=>{var t;return(t=M.current)==null?void 0:t.focus()}}),[]);if(!b)return null;const C=o.jsxRuntimeExports.jsx(T.default,{decorators:r,children:o.jsxRuntimeExports.jsx("div",{"aria-hidden":!u,style:{"--max-width":c?`${c}px`:void 0},className:E.cx("kakadu-components-4119461136",u&&"kakadu-components-2522346797",f),children:o.jsxRuntimeExports.jsx(T.default,{decorators:a,children:o.jsxRuntimeExports.jsx($.focusTrapReactExports.FocusTrap,{active:u,focusTrapOptions:F,children:o.jsxRuntimeExports.jsx("div",{ref:p,className:"kakadu-components-4011815997",children:o.jsxRuntimeExports.jsx("div",{role:"dialog","aria-modal":"true","aria-label":k??"Modal",className:E.cx("kakadu-components-3324483532",i&&"kakadu-components-3799971070",u&&"kakadu-components-968755580"),children:o.jsxRuntimeExports.jsxs(G,{value:A,children:[v?o.jsxRuntimeExports.jsx(J,{}):null,o.jsxRuntimeExports.jsx("div",{className:E.cx("kakadu-components-633990035",i&&"kakadu-components-171969824"),children:d})]})})})})})})});return s?P.createPortal(C,s):C}function Y(s,r){const[a,k]=e.useState(!1),[c,f]=e.useState(!1),n=e.useRef(void 0),i=e.useRef(void 0),x=e.useCallback(async()=>(i.current=void 0,k(!0),f(!0),new Promise(d=>{n.current=d})),[]),m=e.useCallback(d=>{i.current=d,f(!1)},[]),v=e.useCallback(d=>{var p;const R=d??i.current;i.current=void 0,(p=n.current)==null||p.call(n,R),n.current=void 0,k(!1),f(!1)},[]),l=e.useMemo(()=>a?o.jsxRuntimeExports.jsx(s,{...r,isVisible:c,onClose:v}):null,[a,s,r,c,v]);return e.useMemo(()=>({isVisible:c,show:x,close:m,modal:l}),[c,x,m,l])}exports.ModalActions=V;exports.ModalContent=Q;exports.ModalHeading=U;exports.default=X;exports.useModal=Y;exports.useModalContext=L;
@@ -1,55 +1,60 @@
1
- import { j as n } from "../jsx-runtime-B4hRZ52C.mjs";
2
- import { createContext as q, useRef as j, useState as h, useCallback as d, useMemo as g, useEffect as v, useContext as z } from "react";
3
- import { cx as E } from "@kuma-ui/core";
4
- import { createPortal as G } from "react-dom";
5
- import { f as J } from "../focus-trap-react-Dr3BYLw6.mjs";
6
- import K from "./text-button.mjs";
1
+ import { j as o } from "../jsx-runtime-B4hRZ52C.mjs";
2
+ import { createContext as $, useRef as j, useState as w, useCallback as d, useMemo as E, useEffect as v, useContext as q } from "react";
3
+ import { cx as T } from "@kuma-ui/core";
4
+ import { createPortal as z } from "react-dom";
5
+ import { f as G } from "../focus-trap-react-Dr3BYLw6.mjs";
6
+ import J from "../utilities/listeners.mjs";
7
+ import Q from "./text-button.mjs";
7
8
  import A from "./decorators.mjs";
8
9
  import H from "./flex.mjs";
9
- import { defaultAtomElementType as Q } from "./atom.mjs";
10
- import { Heading as U, defaultHeadingElementType as V } from "./text.mjs";
11
- const B = q({
10
+ import { defaultAtomElementType as U } from "./atom.mjs";
11
+ import { Heading as V, defaultHeadingElementType as X } from "./text.mjs";
12
+ const Y = J((t) => {
13
+ window.addEventListener("keydown", t);
14
+ }, (t) => {
15
+ window.removeEventListener("keydown", t);
16
+ }), B = $({
12
17
  isVisible: !1,
13
18
  isInteractive: !1
14
19
  }), {
15
- Provider: X
20
+ Provider: Z
16
21
  } = B;
17
- function Y() {
18
- return z(B);
22
+ function _() {
23
+ return q(B);
19
24
  }
20
- function Z() {
25
+ function W() {
21
26
  const {
22
- isInteractive: o,
23
- close: s
24
- } = Y(), r = d(() => {
25
- s == null || s();
26
- }, [s]);
27
- return /* @__PURE__ */ n.jsx("div", { className: "kakadu-components-2566044647", children: /* @__PURE__ */ n.jsx(K, { iconLeft: "times", label: "Close", disabled: !o, onClick: r }) });
27
+ isInteractive: t,
28
+ close: r
29
+ } = _(), s = d(() => {
30
+ r == null || r();
31
+ }, [r]);
32
+ return /* @__PURE__ */ o.jsx("div", { className: "kakadu-components-2566044647", children: /* @__PURE__ */ o.jsx(Q, { iconLeft: "times", label: "Close", disabled: !t, onClick: s }) });
28
33
  }
29
- function ce(o) {
30
- return /* @__PURE__ */ n.jsx(H, { gap: 2, ...o });
34
+ function le(t) {
35
+ return /* @__PURE__ */ o.jsx(H, { gap: 2, ...t });
31
36
  }
32
- function ie({
33
- as: o,
34
- className: s,
35
- ...r
37
+ function de({
38
+ as: t,
39
+ className: r,
40
+ ...s
36
41
  }) {
37
- return /* @__PURE__ */ n.jsx(U, { ...r, as: o ?? V, className: E("kakadu-components-4275938488", s) });
42
+ return /* @__PURE__ */ o.jsx(V, { ...s, as: t ?? X, className: T("kakadu-components-4275938488", r) });
38
43
  }
39
- function ue({
40
- as: o,
41
- ...s
44
+ function fe({
45
+ as: t,
46
+ ...r
42
47
  }) {
43
- return /* @__PURE__ */ n.jsx(H, { direction: "row", gap: 1, preset: "end", ...s, as: o ?? Q });
48
+ return /* @__PURE__ */ o.jsx(H, { direction: "row", gap: 1, preset: "end", ...r, as: t ?? U });
44
49
  }
45
- function le({
46
- root: o,
47
- outerDecorators: s = [],
48
- innerDecorators: r = [],
49
- label: w,
50
+ function me({
51
+ root: t,
52
+ outerDecorators: r = [],
53
+ innerDecorators: s = [],
54
+ label: h,
50
55
  maxWidth: c,
51
56
  className: f,
52
- isVisible: t,
57
+ isVisible: n,
53
58
  isFullWidth: i = !1,
54
59
  shouldCloseOnOutsideClick: m = !0,
55
60
  shouldCloseOnEscapePress: p = !0,
@@ -57,18 +62,18 @@ function le({
57
62
  onClose: u,
58
63
  children: l
59
64
  }) {
60
- const M = j(null), x = j(null), [L, P] = h(!1), [a, k] = h(!1), N = d((e) => {
65
+ const M = j(null), x = j(null), [R, P] = w(!1), [a, k] = w(!1), L = d((e) => {
61
66
  M.current = e, k(!1);
62
- }, []), R = j(null), b = d((e) => {
63
- e && (R.current = e);
64
- }, []), [y, F] = h(t ?? !1), D = g(() => ({
67
+ }, []), g = j(null), N = d((e) => {
68
+ e && (g.current = e);
69
+ }, []), [y, b] = w(n ?? !1), D = E(() => ({
65
70
  isVisible: y,
66
71
  isInteractive: a,
67
- setInitialFocus: b,
68
- close: N
69
- }), [y, a, b, N]);
72
+ setInitialFocus: N,
73
+ close: L
74
+ }), [y, a, N, L]);
70
75
  v(() => {
71
- if (t) {
76
+ if (n) {
72
77
  const e = setTimeout(() => {
73
78
  k(!0);
74
79
  }, 100);
@@ -77,65 +82,61 @@ function le({
77
82
  };
78
83
  }
79
84
  k(!1);
80
- }, [t]), v(() => {
81
- t && (P(!0), F(!0));
82
- }, [t]), v(() => {
85
+ }, [n]), v(() => {
86
+ n && (P(!0), b(!0));
87
+ }, [n]), v(() => {
83
88
  const e = x.current;
84
- if (t && m && e) {
85
- const T = ($) => {
86
- e === $.target && k(!1);
89
+ if (n && m && e) {
90
+ const C = (S) => {
91
+ e === S.target && k(!1);
87
92
  };
88
- return e.addEventListener("click", T), () => {
89
- e.removeEventListener("click", T);
93
+ return e.addEventListener("click", C), () => {
94
+ e.removeEventListener("click", C);
90
95
  };
91
96
  }
92
- }, [t, m]), v(() => {
93
- if (!t || !p)
94
- return;
95
- const e = (T) => {
96
- T.key === "Escape" && k(!1);
97
- };
98
- return window.addEventListener("keydown", e), () => {
99
- window.removeEventListener("keydown", e);
100
- };
101
- }, [t, p]), v(() => {
102
- if (L && !a) {
97
+ }, [n, m]), v(() => {
98
+ if (!(!n || !p))
99
+ return Y((e) => {
100
+ e.key === "Escape" && k(!1);
101
+ });
102
+ }, [n, p]), v(() => {
103
+ if (R && !a) {
103
104
  const e = setTimeout(() => {
104
- F(!1), u == null || u(M.current ?? void 0);
105
+ b(!1), u == null || u(M.current ?? void 0);
105
106
  }, 370);
106
107
  return () => {
107
108
  clearTimeout(e);
108
109
  };
109
110
  }
110
- }, [L, a, u]);
111
- const S = g(() => ({
112
- initialFocus: () => R.current ?? void 0,
111
+ }, [R, a, u]);
112
+ const K = E(() => ({
113
+ initialFocus: () => g.current ?? void 0,
113
114
  onActivate: () => {
114
115
  var e;
115
- return (e = R.current) == null ? void 0 : e.focus();
116
+ return (e = g.current) == null ? void 0 : e.focus();
116
117
  }
117
118
  }), []);
118
119
  if (!y)
119
120
  return null;
120
- const C = /* @__PURE__ */ n.jsx(A, { decorators: s, children: /* @__PURE__ */ n.jsx("div", { "aria-hidden": !a, style: {
121
+ const F = /* @__PURE__ */ o.jsx(A, { decorators: r, children: /* @__PURE__ */ o.jsx("div", { "aria-hidden": !a, style: {
121
122
  "--max-width": c ? `${c}px` : void 0
122
- }, className: E("kakadu-components-4119461136", a && "kakadu-components-2522346797", f), children: /* @__PURE__ */ n.jsx(A, { decorators: r, children: /* @__PURE__ */ n.jsx(J.FocusTrap, { active: a, focusTrapOptions: S, children: /* @__PURE__ */ n.jsx("div", { ref: x, className: "kakadu-components-4011815997", children: /* @__PURE__ */ n.jsx("div", { role: "dialog", "aria-modal": "true", "aria-label": w ?? "Modal", className: E("kakadu-components-3324483532", i && "kakadu-components-3799971070", a && "kakadu-components-968755580"), children: /* @__PURE__ */ n.jsxs(X, { value: D, children: [
123
- I ? /* @__PURE__ */ n.jsx(Z, {}) : null,
124
- /* @__PURE__ */ n.jsx("div", { className: E("kakadu-components-633990035", i && "kakadu-components-171969824"), children: l })
123
+ }, className: T("kakadu-components-4119461136", a && "kakadu-components-2522346797", f), children: /* @__PURE__ */ o.jsx(A, { decorators: s, children: /* @__PURE__ */ o.jsx(G.FocusTrap, { active: a, focusTrapOptions: K, children: /* @__PURE__ */ o.jsx("div", { ref: x, className: "kakadu-components-4011815997", children: /* @__PURE__ */ o.jsx("div", { role: "dialog", "aria-modal": "true", "aria-label": h ?? "Modal", className: T("kakadu-components-3324483532", i && "kakadu-components-3799971070", a && "kakadu-components-968755580"), children: /* @__PURE__ */ o.jsxs(Z, { value: D, children: [
124
+ I ? /* @__PURE__ */ o.jsx(W, {}) : null,
125
+ /* @__PURE__ */ o.jsx("div", { className: T("kakadu-components-633990035", i && "kakadu-components-171969824"), children: l })
125
126
  ] }) }) }) }) }) }) });
126
- return o ? G(C, o) : C;
127
+ return t ? z(F, t) : F;
127
128
  }
128
- function de(o, s) {
129
- const [r, w] = h(!1), [c, f] = h(!1), t = j(void 0), i = j(void 0), m = d(async () => (i.current = void 0, w(!0), f(!0), new Promise((l) => {
130
- t.current = l;
129
+ function pe(t, r) {
130
+ const [s, h] = w(!1), [c, f] = w(!1), n = j(void 0), i = j(void 0), m = d(async () => (i.current = void 0, h(!0), f(!0), new Promise((l) => {
131
+ n.current = l;
131
132
  })), []), p = d((l) => {
132
133
  i.current = l, f(!1);
133
134
  }, []), I = d((l) => {
134
135
  var x;
135
136
  const M = l ?? i.current;
136
- i.current = void 0, (x = t.current) == null || x.call(t, M), t.current = void 0, w(!1), f(!1);
137
- }, []), u = g(() => r ? /* @__PURE__ */ n.jsx(o, { ...s, isVisible: c, onClose: I }) : null, [r, o, s, c, I]);
138
- return g(() => ({
137
+ i.current = void 0, (x = n.current) == null || x.call(n, M), n.current = void 0, h(!1), f(!1);
138
+ }, []), u = E(() => s ? /* @__PURE__ */ o.jsx(t, { ...r, isVisible: c, onClose: I }) : null, [s, t, r, c, I]);
139
+ return E(() => ({
139
140
  isVisible: c,
140
141
  show: m,
141
142
  close: p,
@@ -143,10 +144,10 @@ function de(o, s) {
143
144
  }), [c, m, p, u]);
144
145
  }
145
146
  export {
146
- ue as ModalActions,
147
- ce as ModalContent,
148
- ie as ModalHeading,
149
- le as default,
150
- de as useModal,
151
- Y as useModalContext
147
+ fe as ModalActions,
148
+ le as ModalContent,
149
+ de as ModalHeading,
150
+ me as default,
151
+ pe as useModal,
152
+ _ as useModalContext
152
153
  };