@oliasoft-open-source/react-ui-library 4.0.0-beta-52 → 4.0.0-beta-53

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 (80) hide show
  1. package/dist/assets/{index-c603c2a7.css → index-58a715fe.css} +51 -52
  2. package/dist/assets/{index-ec75e6bd.js → index-b6a2aa40.js} +45 -43
  3. package/dist/global.css +51 -52
  4. package/dist/index.d.ts +4 -3
  5. package/dist/index.html +1 -1
  6. package/dist/index.js +57 -55
  7. package/dist/index.js.map +1 -1
  8. package/dist/storybook/assets/{Color-6VNJS4EI-0e859f5d.js → Color-6VNJS4EI-6e065ad8.js} +1 -1
  9. package/dist/storybook/assets/{DocsRenderer-NNNQARDV-f798bb00.js → DocsRenderer-NNNQARDV-5425a885.js} +1 -1
  10. package/dist/storybook/assets/{WithTooltip-4HIR6TLV-6e941d70.js → WithTooltip-4HIR6TLV-1c9087b8.js} +1 -1
  11. package/dist/storybook/assets/{accordion.stories-3f53373a.js → accordion.stories-dcd01702.js} +1 -1
  12. package/dist/storybook/assets/actions-6461b40b.css +1 -0
  13. package/dist/storybook/assets/actions-d843b059.js +1 -0
  14. package/dist/storybook/assets/{actions.stories-49f7c99e.js → actions.stories-b3f44deb.js} +1 -1
  15. package/dist/storybook/assets/{afe.stories-a7cd678a.js → afe.stories-47d8dc57.js} +1 -1
  16. package/dist/storybook/assets/{blowout.stories-041f9064.js → blowout.stories-733dc6c1.js} +1 -1
  17. package/dist/storybook/assets/button-group.stories-5974a0f6.js +71 -0
  18. package/dist/storybook/assets/button.stories-1cabffd4.js +71 -0
  19. package/dist/storybook/assets/{buttons-and-links-334983fe.js → buttons-and-links-667193aa.js} +1 -1
  20. package/dist/storybook/assets/{casing-loads.stories-2917f31b.js → casing-loads.stories-fb187130.js} +1 -1
  21. package/dist/storybook/assets/{cell.stories-7bfb15c1.js → cell.stories-deea75bd.js} +1 -1
  22. package/dist/storybook/assets/{chunk-HLWAVYOI-29644656.js → chunk-HLWAVYOI-48235861.js} +1 -1
  23. package/dist/storybook/assets/{color-0d791dab.js → color-8f86bd73.js} +1 -1
  24. package/dist/storybook/assets/{column.stories-dc850214.js → column.stories-677ce5ea.js} +1 -1
  25. package/dist/storybook/assets/{drawer.stories-6ed88208.js → drawer.stories-255662af.js} +1 -1
  26. package/dist/storybook/assets/{footer.stories-be696df7.js → footer.stories-049a9ce5.js} +1 -1
  27. package/dist/storybook/assets/{form.stories-def0936d.js → form.stories-da0279d9.js} +1 -1
  28. package/dist/storybook/assets/{formation.stories-699c7871.js → formation.stories-48f9d2a7.js} +1 -1
  29. package/dist/storybook/assets/{formatter-SWP5E3XI-bdd67232.js → formatter-SWP5E3XI-d8e653ce.js} +1 -1
  30. package/dist/storybook/assets/{iframe-d9853d67.js → iframe-0bc7c3ad.js} +1 -1
  31. package/dist/storybook/assets/{index-4997c9dc.js → index-8fea21ba.js} +4 -4
  32. package/dist/storybook/assets/{input-group.stories-3bffb32f.js → input-group.stories-725d10d5.js} +1 -1
  33. package/dist/storybook/assets/{input-validation-aaf1c48a.js → input-validation-397337bb.js} +1 -1
  34. package/dist/storybook/assets/{inputs-fc74a6a6.js → inputs-0451400a.js} +1 -1
  35. package/dist/storybook/assets/{layout-forms-76617c35.js → layout-forms-b0e93dbe.js} +1 -1
  36. package/dist/storybook/assets/{layout-general-f1950619.js → layout-general-4cb1dfc2.js} +1 -1
  37. package/dist/storybook/assets/{list-bc2bb312.js → list-4c7a514b.js} +1 -1
  38. package/dist/storybook/assets/{list-heading-f838e8b9.js → list-heading-395fcb89.js} +1 -1
  39. package/dist/storybook/assets/{list.stories-d3b5454a.js → list.stories-9e52197b.js} +1 -1
  40. package/dist/storybook/assets/{list.stories-data-0bf85e7c.js → list.stories-data-4e3a7e0d.js} +1 -1
  41. package/dist/storybook/assets/{menu.stories-f4ee2169.js → menu.stories-36fc62e3.js} +1 -1
  42. package/dist/storybook/assets/{modal.stories-97ff9179.js → modal.stories-a8a6e24e.js} +1 -1
  43. package/dist/storybook/assets/{number-input.stories-820d854b.js → number-input.stories-44aaa5e7.js} +1 -1
  44. package/dist/storybook/assets/{option-dropdown.stories-d690de77.js → option-dropdown.stories-7be90519.js} +1 -1
  45. package/dist/storybook/assets/{padding-and-spacing-86cee39b.js → padding-and-spacing-2c26ca5e.js} +1 -1
  46. package/dist/storybook/assets/{page.stories-7a5d6597.js → page.stories-4c00ed1a.js} +1 -1
  47. package/dist/storybook/assets/{pagination-cfbe0404.js → pagination-c5f96ac2.js} +1 -1
  48. package/dist/storybook/assets/{pagination.stories-ccbc8a0d.js → pagination.stories-68e52a64.js} +1 -1
  49. package/dist/storybook/assets/{popover.stories-81a6f8cd.js → popover.stories-cf75f163.js} +1 -1
  50. package/dist/storybook/assets/{preview-ff579ef7.js → preview-23966b1f.js} +1 -1
  51. package/dist/storybook/assets/preview-c0193a0a.js +1 -0
  52. package/dist/storybook/assets/{projects.stories-7c2f981c.js → projects.stories-675f5b3f.js} +1 -1
  53. package/dist/storybook/assets/{reservoirs.stories-dad5573f.js → reservoirs.stories-80882299.js} +1 -1
  54. package/dist/storybook/assets/{rich-text-input.stories-8b81b03f.js → rich-text-input.stories-2f6d7094.js} +1 -1
  55. package/dist/storybook/assets/row-2f12e486.js +39 -0
  56. package/dist/storybook/assets/{row.stories-3302da9d.js → row.stories-b2e06e8c.js} +1 -1
  57. package/dist/storybook/assets/{select-c8f67cba.js → select-fb35923e.js} +1 -1
  58. package/dist/storybook/assets/{select.stories-2aa0ad4a.js → select.stories-ec473b01.js} +1 -1
  59. package/dist/storybook/assets/{site.stories-e87829fd.js → site.stories-07449468.js} +1 -1
  60. package/dist/storybook/assets/{syntaxhighlighter-NMPM6SWI-263ddad6.js → syntaxhighlighter-NMPM6SWI-765c5d11.js} +1 -1
  61. package/dist/storybook/assets/{table-14d09eed.js → table-419ac141.js} +1 -1
  62. package/dist/storybook/assets/{table.stories-a7b6a314.js → table.stories-88efc984.js} +1 -1
  63. package/dist/storybook/assets/{table.stories-data-609c613f.js → table.stories-data-0456a150.js} +1 -1
  64. package/dist/storybook/assets/{title.stories-8f355b1b.js → title.stories-b6bc3c30.js} +1 -1
  65. package/dist/storybook/assets/{tooltip.test-case.stories-cc1e44f4.js → tooltip.test-case.stories-c68e2057.js} +1 -1
  66. package/dist/storybook/assets/{top-bar-952f0e1a.js → top-bar-86fb309b.js} +1 -1
  67. package/dist/storybook/assets/{top-bar.stories-05be5d4c.js → top-bar.stories-d1adf3e9.js} +1 -1
  68. package/dist/storybook/assets/{top-bar.testcase.stories-9383705f.js → top-bar.testcase.stories-d43070df.js} +1 -1
  69. package/dist/storybook/assets/{tree.stories-706f7fae.js → tree.stories-b0f9671b.js} +8 -10
  70. package/dist/storybook/iframe.html +1 -1
  71. package/dist/storybook/index.json +1 -1
  72. package/dist/storybook/project.json +1 -1
  73. package/dist/storybook/stories.json +1 -1
  74. package/package.json +1 -1
  75. package/dist/storybook/assets/actions-26858b6b.css +0 -1
  76. package/dist/storybook/assets/actions-7f428221.js +0 -1
  77. package/dist/storybook/assets/button-group.stories-037665c3.js +0 -61
  78. package/dist/storybook/assets/button.stories-527e5e10.js +0 -61
  79. package/dist/storybook/assets/preview-d6d8b5a6.js +0 -1
  80. package/dist/storybook/assets/row-bd69aca9.js +0 -39
@@ -1 +1 @@
1
- import{j as m}from"./jsx-runtime-f961835c.js";import{r as N,g as Ue}from"./index-f80c8c95.js";import{c as D}from"./index-a80ed1cf.js";import{G as le,I as Ae}from"./common-types-2c81813f.js";import{D as Se}from"./disabled-context-d654f6ff.js";import{i as ee}from"./types-332ceaf3.js";import{T as Ie,u as ze,m as Ge}from"./tooltip-23e84186.js";import{p as $e}from"./index-c89a1915.js";import"./lodash-75c70a11.js";import{_ as Ke,a as Ye}from"./inheritsLoose-d4851ab8.js";import{_ as Ee}from"./assertThisInitialized-081f9914.js";import{m as ie}from"./memoize-one.esm-52518564.js";import{M as ae}from"./types-cc224262.js";import{T as se}from"./text-ad1f5f1d.js";import{A as Be}from"./actions-7f428221.js";import{I as ue}from"./icon-afbea088.js";import{s as Xe}from"./select.input-88b6ebab.js";const Je="_inputInTable_m6lot_1",Ze="_inputHover_m6lot_13",Qe="_inputFocus_m6lot_18",et="_inputError_m6lot_25",tt="_inputWarning_m6lot_26",nt="_inputDisabled_m6lot_61",rt="_hideScrollbars_m6lot_67",lt="_select_m6lot_77",at="_isInTable_m6lot_121",it="_unSelected_m6lot_133",ot="_error_m6lot_140",st="_warning_m6lot_157",ut="_small_m6lot_174",ct="_right_m6lot_182",dt="_groupOrderFirst_m6lot_193",pt="_groupOrderMiddle_m6lot_194",ft="_groupOrderLast_m6lot_198",H={inputInTable:Je,inputHover:Ze,inputFocus:Qe,inputError:et,inputWarning:tt,inputDisabled:nt,hideScrollbars:rt,select:lt,isInTable:at,unSelected:it,error:ot,warning:st,small:ut,right:ct,groupOrderFirst:dt,groupOrderMiddle:pt,groupOrderLast:ft},ce=({disabled:e=!1,error:t=null,warning:l=null,tooltip:d=null,options:c,onChange:h=()=>{},onFocus:f=()=>{},onBlur:i=()=>{},right:o=!1,small:y=!1,tabIndex:v=0,selectedOption:b,width:O=null,groupOrder:I=null,testId:S,isInTable:n=!1,clearable:s,placeholder:a,hasNonExistentValue:r,maxTooltipWidth:u,borderRadius:p})=>{const _=N.useContext(Se),g=b===null||(b==null?void 0:b.value)===null?"unselected":b==null?void 0:b.value,E=g==="unselected",V=(g==="unselected"||s?[m.jsx("option",{value:"unselected",disabled:!s,hidden:!s,children:a||"Select..."},"unselected")]:[]).concat(r?[m.jsx("option",{value:b==null?void 0:b.value,disabled:e||_,children:b==null?void 0:b.label},"selectedNonExistentValue")]:[]).concat(c.map((L,T)=>m.jsx("option",{value:L.value,"data-testid":L.testId,children:L.label},T))),C=(()=>{if(I)switch(I){case le.FIRST:return H.groupOrderFirst;case le.LAST:return H.groupOrderLast;default:return H.groupOrderMiddle}return""})();return m.jsx(Ie,{error:!!t,warning:!!l,text:d||t||l,enabled:d&&ee(d)||t&&ee(t)||l&&ee(l)||!1,maxWidth:u,placement:"bottom-center",children:m.jsx("select",{className:D(H.select,E?H.unSelected:"",t?H.error:l?H.warning:"",o?H.right:"",y?H.small:"",n?H.isInTable:"",C),style:{width:O||"",borderRadius:p||""},onChange:L=>{const{value:T}=L.target;let A;T==="unselected"?A={value:null}:A=c.find(w=>String(w.value)===String(T))||{value:null},h(L,A)},onFocus:f,onBlur:i,tabIndex:v,value:g,disabled:e||_,"data-testid":S,children:V})})};try{ce.displayName="NativeSelect",ce.__docgenInfo={description:"",displayName:"NativeSelect",props:{borderRadius:{defaultValue:null,description:"",name:"borderRadius",required:!1,type:{name:"TStringOrNumber"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},error:{defaultValue:{value:"null"},description:"",name:"error",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},warning:{defaultValue:{value:"null"},description:"",name:"warning",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},tooltip:{defaultValue:{value:"null"},description:"",name:"tooltip",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"ISelectSelectedOption[]"}},onChange:{defaultValue:{value:"() => {}"},description:"",name:"onChange",required:!1,type:{name:"((evt: ChangeEvent<HTMLSelectElement>, value: ISelectSelectedOption | { value: null; }) => void)"}},onFocus:{defaultValue:{value:"() => {}"},description:"",name:"onFocus",required:!1,type:{name:"TEmpty"}},onBlur:{defaultValue:{value:"() => {}"},description:"",name:"onBlur",required:!1,type:{name:"TEmpty"}},right:{defaultValue:{value:"false"},description:"",name:"right",required:!1,type:{name:"boolean"}},small:{defaultValue:{value:"false"},description:"",name:"small",required:!1,type:{name:"boolean"}},tabIndex:{defaultValue:{value:"0"},description:"",name:"tabIndex",required:!1,type:{name:"number"}},selectedOption:{defaultValue:null,description:"",name:"selectedOption",required:!1,type:{name:"ISelectSelectedOption"}},width:{defaultValue:{value:"null"},description:"",name:"width",required:!1,type:{name:"TStringOrNumber | null"}},groupOrder:{defaultValue:{value:"null"},description:"",name:"groupOrder",required:!1,type:{name:"string | null"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}},isInTable:{defaultValue:{value:"false"},description:"",name:"isInTable",required:!1,type:{name:"boolean"}},clearable:{defaultValue:null,description:"",name:"clearable",required:!1,type:{name:"boolean"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string | null"}},hasNonExistentValue:{defaultValue:null,description:"",name:"hasNonExistentValue",required:!1,type:{name:"boolean"}},maxTooltipWidth:{defaultValue:null,description:"",name:"maxTooltipWidth",required:!1,type:{name:"TStringOrNumber"}}}}}catch{}var we={exports:{}};(function(e,t){(function(l,d){e.exports=d(N,$e)})(window,function(l,d){return function(c){var h={};function f(i){if(h[i])return h[i].exports;var o=h[i]={i,l:!1,exports:{}};return c[i].call(o.exports,o,o.exports,f),o.l=!0,o.exports}return f.m=c,f.c=h,f.d=function(i,o,y){f.o(i,o)||Object.defineProperty(i,o,{enumerable:!0,get:y})},f.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},f.t=function(i,o){if(1&o&&(i=f(i)),8&o||4&o&&typeof i=="object"&&i&&i.__esModule)return i;var y=Object.create(null);if(f.r(y),Object.defineProperty(y,"default",{enumerable:!0,value:i}),2&o&&typeof i!="string")for(var v in i)f.d(y,v,(function(b){return i[b]}).bind(null,v));return y},f.n=function(i){var o=i&&i.__esModule?function(){return i.default}:function(){return i};return f.d(o,"a",o),o},f.o=function(i,o){return Object.prototype.hasOwnProperty.call(i,o)},f.p="",f(f.s=0)}([function(c,h,f){Object.defineProperty(h,"__esModule",{value:!0});var i=f(1);Object.defineProperty(h,"default",{enumerable:!0,get:function(){return function(o){return o&&o.__esModule?o:{default:o}}(i).default}}),c.exports=h.default},function(c,h,f){Object.defineProperty(h,"__esModule",{value:!0});var i=Object.assign||function(n){for(var s=1;s<arguments.length;s++){var a=arguments[s];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(n[r]=a[r])}return n},o=function(){function n(s,a){for(var r=0;r<a.length;r++){var u=a[r];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,a,r){return a&&n(s.prototype,a),r&&n(s,r),s}}(),y=O(f(2)),v=O(f(3)),b=f(4);function O(n){return n&&n.__esModule?n:{default:n}}var I=[],S=function(n){function s(a){(function(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")})(this,s);var r=function(u,p){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!p||typeof p!="object"&&typeof p!="function"?u:p}(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,a));return r.handleKeyboardEvent=r.handleKeyboardEvent.bind(r),r.registerExclusiveHandler=r.registerExclusiveHandler.bind(r),r.deregisterExclusiveHandler=r.deregisterExclusiveHandler.bind(r),r}return function(a,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof r);a.prototype=Object.create(r&&r.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(a,r):a.__proto__=r)}(s,y.default.Component),o(s,[{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyboardEvent,!1),document.addEventListener("keyup",this.handleKeyboardEvent,!1),document.addEventListener("keypress",this.handleKeyboardEvent,!1);var a=this.props,r=a.isExclusive,u=a.isDisabled;r&&!u&&this.registerExclusiveHandler()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyboardEvent,!1),document.removeEventListener("keyup",this.handleKeyboardEvent,!1),document.removeEventListener("keypress",this.handleKeyboardEvent,!1),this.deregisterExclusiveHandler()}},{key:"componentDidUpdate",value:function(a){var r=a.isExclusive,u=a.isDisabled;(this.props.isExclusive!==r||this.props.isDisabled!==u)&&(this.props.isExclusive&&!this.props.isDisabled?this.registerExclusiveHandler():this.deregisterExclusiveHandler())}},{key:"registerExclusiveHandler",value:function(){this.deregisterExclusiveHandler(),I.unshift(this)}},{key:"deregisterExclusiveHandler",value:function(){var a=this;I.includes(this)&&(I=I.filter(function(r){return r!==a}))}},{key:"handleKeyboardEvent",value:function(a){var r=this.props,u=r.isDisabled,p=r.handleKeys,_=r.onKeyEvent,g=r.handleEventType,E=r.children,V=r.handleFocusableElements;if(u||g!==a.type||I.length>0&&I[0]!==this)return!1;var C=a.target===document.body||V,L=this.childrenContainer&&this.childrenContainer.contains(a.target);if(!(E?L:C))return!1;var T=(0,b.findMatchedKey)(a,p);return!!T&&(_(T,a),!0)}},{key:"render",value:function(){var a=this,r=this.props.children,u=Object.assign({},this.props),p=!0,_=!1,g=void 0;try{for(var E,V=Object.keys(s.propTypes)[Symbol.iterator]();!(p=(E=V.next()).done);p=!0)delete u[E.value]}catch(C){_=!0,g=C}finally{try{!p&&V.return&&V.return()}finally{if(_)throw g}}return r?y.default.createElement("span",i({ref:function(C){a.childrenContainer=C}},u),r):null}}]),s}();h.default=S,S.propTypes={handleKeys:v.default.array,handleEventType:v.default.oneOf(["keydown","keyup","keypress"]),handleFocusableElements:v.default.bool,onKeyEvent:v.default.func,isDisabled:v.default.bool,isExclusive:v.default.bool,children:v.default.any},S.defaultProps={handleKeys:[],handleFocusableElements:!1,handleEventType:"keydown",onKeyEvent:function(){return null}},c.exports=h.default},function(c,h){c.exports=l},function(c,h){c.exports=d},function(c,h,f){function i(r,u,p){return u in r?Object.defineProperty(r,u,{value:p,enumerable:!0,configurable:!0,writable:!0}):r[u]=p,r}Object.defineProperty(h,"__esModule",{value:!0}),h.matchKeyEvent=a,h.findMatchedKey=function(r,u){var p=u.map(function(_){var g=_.toLowerCase(),E=s[g];return E||[_]}).reduce(function(_,g){return _.concat(g)},[]).find(function(_){return a(r,_)});return!p&&u.includes("all")&&(p="other"),p};var o={backspace:[8],del:[46],delete:[46],ins:[45],insert:[45],tab:[9],enter:[13],return:[13],esc:[27],space:[32],pageup:[33],pagedown:[34],end:[35],home:[36],left:[37],up:[38],right:[39],down:[40],shift:[16],ctrl:[17],alt:[18],cap:[20],num:[144],clear:[12],meta:[91],";":[186,59],"=":[187,61],",":[188,44],"-":[189,45,173,109],minus:[189,45,173,109],".":[190,110],"/":[191,111],"`":[192],"[":[219],"\\":[220],"]":[221],"*":[106],"+":[107],plus:[107],"'":[222],quote:[222]},y=Object.keys(o).reduce(function(r,u){return Object.assign(r,i({},u.toUpperCase(),o[u]))},{}),v="0123456789".split("").reduce(function(r,u,p){return Object.assign(r,i({},u,[p+48,p+96]))},{}),b="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").reduce(function(r,u,p){return Object.assign(r,i({},u.toLowerCase(),[p+65]),i({},u,[p+65]))},{}),O="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19".split(",").reduce(function(r,u,p){return Object.assign(r,i({},"f"+u,[p+112]))},{}),I={control:"ctrl",ctrl:"ctrl",shift:"shift",meta:"meta",cmd:"meta",command:"meta",option:"alt",alt:"alt"},S=h.AllKeys=Object.assign({},o,y,v,b,O),n=Object.assign({},v,b),s={all:Object.keys(S),alphanumeric:Object.keys(n),numeric:Object.keys(v),alphabetic:Object.keys(b),function:Object.keys(O)};function a(r,u){var p=r.which||r.keyCode,_=r.type,g=Object.keys(I).filter(function(w){return r[w+"Key"]}).sort(),E=u.toLowerCase().trim(),V=E==="+"?["+"]:E.split(/\s?\+\s?/),C=V.pop(),L=S[C],T=V;if(_==="keypress")return u==String.fromCharCode(p).toLowerCase();if(T.length===0&&g.length===0)return L.indexOf(p)>=0;if(T.length>0&&g.length>0){var A=T.map(function(w){return I[w]}).sort(),F=A.length===g.length&&A.every(function(w,U){return g[U]===w});return L.indexOf(p)>=0&&F}return T.length==0&&g.length===1&&C===g[0]}}])})})(we);var mt=we.exports;const ht=Ue(mt),je=()=>{const e=N.useRef(null);return[e,()=>{e.current&&e.current.focus()}]},Pe=()=>{const[e,t]=N.useState(!1);return N.useEffect(()=>{(async()=>{document.fonts&&await document.fonts.ready.then(()=>t(!0))})()},[]),e};var yt=typeof performance=="object"&&typeof performance.now=="function",xe=yt?function(){return performance.now()}:function(){return Date.now()};function Te(e){cancelAnimationFrame(e.id)}function gt(e,t){var l=xe();function d(){xe()-l>=t?e.call(null):c.id=requestAnimationFrame(d)}var c={id:requestAnimationFrame(d)};return c}var oe=-1;function Ce(e){if(e===void 0&&(e=!1),oe===-1||e){var t=document.createElement("div"),l=t.style;l.width="50px",l.height="50px",l.overflow="scroll",document.body.appendChild(t),oe=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return oe}var Q=null;function Le(e){if(e===void 0&&(e=!1),Q===null||e){var t=document.createElement("div"),l=t.style;l.width="50px",l.height="50px",l.overflow="scroll",l.direction="rtl";var d=document.createElement("div"),c=d.style;return c.width="100px",c.height="100px",t.appendChild(d),document.body.appendChild(t),t.scrollLeft>0?Q="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?Q="negative":Q="positive-ascending"),document.body.removeChild(t),Q}return Q}var _t=150,bt=function(t,l){return t};function vt(e){var t,l=e.getItemOffset,d=e.getEstimatedTotalSize,c=e.getItemSize,h=e.getOffsetForIndexAndAlignment,f=e.getStartIndexForOffset,i=e.getStopIndexForStartIndex,o=e.initInstanceProps,y=e.shouldResetStyleCacheOnItemSizeChange,v=e.validateProps;return t=function(b){Ke(O,b);function O(S){var n;return n=b.call(this,S)||this,n._instanceProps=o(n.props,Ee(n)),n._outerRef=void 0,n._resetIsScrollingTimeoutId=null,n.state={instance:Ee(n),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof n.props.initialScrollOffset=="number"?n.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},n._callOnItemsRendered=void 0,n._callOnItemsRendered=ie(function(s,a,r,u){return n.props.onItemsRendered({overscanStartIndex:s,overscanStopIndex:a,visibleStartIndex:r,visibleStopIndex:u})}),n._callOnScroll=void 0,n._callOnScroll=ie(function(s,a,r){return n.props.onScroll({scrollDirection:s,scrollOffset:a,scrollUpdateWasRequested:r})}),n._getItemStyle=void 0,n._getItemStyle=function(s){var a=n.props,r=a.direction,u=a.itemSize,p=a.layout,_=n._getItemStyleCache(y&&u,y&&p,y&&r),g;if(_.hasOwnProperty(s))g=_[s];else{var E=l(n.props,s,n._instanceProps),V=c(n.props,s,n._instanceProps),C=r==="horizontal"||p==="horizontal",L=r==="rtl",T=C?E:0;_[s]=g={position:"absolute",left:L?void 0:T,right:L?T:void 0,top:C?0:E,height:C?"100%":V,width:C?V:"100%"}}return g},n._getItemStyleCache=void 0,n._getItemStyleCache=ie(function(s,a,r){return{}}),n._onScrollHorizontal=function(s){var a=s.currentTarget,r=a.clientWidth,u=a.scrollLeft,p=a.scrollWidth;n.setState(function(_){if(_.scrollOffset===u)return null;var g=n.props.direction,E=u;if(g==="rtl")switch(Le()){case"negative":E=-u;break;case"positive-descending":E=p-r-u;break}return E=Math.max(0,Math.min(E,p-r)),{isScrolling:!0,scrollDirection:_.scrollOffset<u?"forward":"backward",scrollOffset:E,scrollUpdateWasRequested:!1}},n._resetIsScrollingDebounced)},n._onScrollVertical=function(s){var a=s.currentTarget,r=a.clientHeight,u=a.scrollHeight,p=a.scrollTop;n.setState(function(_){if(_.scrollOffset===p)return null;var g=Math.max(0,Math.min(p,u-r));return{isScrolling:!0,scrollDirection:_.scrollOffset<g?"forward":"backward",scrollOffset:g,scrollUpdateWasRequested:!1}},n._resetIsScrollingDebounced)},n._outerRefSetter=function(s){var a=n.props.outerRef;n._outerRef=s,typeof a=="function"?a(s):a!=null&&typeof a=="object"&&a.hasOwnProperty("current")&&(a.current=s)},n._resetIsScrollingDebounced=function(){n._resetIsScrollingTimeoutId!==null&&Te(n._resetIsScrollingTimeoutId),n._resetIsScrollingTimeoutId=gt(n._resetIsScrolling,_t)},n._resetIsScrolling=function(){n._resetIsScrollingTimeoutId=null,n.setState({isScrolling:!1},function(){n._getItemStyleCache(-1,null)})},n}O.getDerivedStateFromProps=function(n,s){return St(n,s),v(n),null};var I=O.prototype;return I.scrollTo=function(n){n=Math.max(0,n),this.setState(function(s){return s.scrollOffset===n?null:{scrollDirection:s.scrollOffset<n?"forward":"backward",scrollOffset:n,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},I.scrollToItem=function(n,s){s===void 0&&(s="auto");var a=this.props,r=a.itemCount,u=a.layout,p=this.state.scrollOffset;n=Math.max(0,Math.min(n,r-1));var _=0;if(this._outerRef){var g=this._outerRef;u==="vertical"?_=g.scrollWidth>g.clientWidth?Ce():0:_=g.scrollHeight>g.clientHeight?Ce():0}this.scrollTo(h(this.props,n,s,p,this._instanceProps,_))},I.componentDidMount=function(){var n=this.props,s=n.direction,a=n.initialScrollOffset,r=n.layout;if(typeof a=="number"&&this._outerRef!=null){var u=this._outerRef;s==="horizontal"||r==="horizontal"?u.scrollLeft=a:u.scrollTop=a}this._callPropsCallbacks()},I.componentDidUpdate=function(){var n=this.props,s=n.direction,a=n.layout,r=this.state,u=r.scrollOffset,p=r.scrollUpdateWasRequested;if(p&&this._outerRef!=null){var _=this._outerRef;if(s==="horizontal"||a==="horizontal")if(s==="rtl")switch(Le()){case"negative":_.scrollLeft=-u;break;case"positive-ascending":_.scrollLeft=u;break;default:var g=_.clientWidth,E=_.scrollWidth;_.scrollLeft=E-g-u;break}else _.scrollLeft=u;else _.scrollTop=u}this._callPropsCallbacks()},I.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Te(this._resetIsScrollingTimeoutId)},I.render=function(){var n=this.props,s=n.children,a=n.className,r=n.direction,u=n.height,p=n.innerRef,_=n.innerElementType,g=n.innerTagName,E=n.itemCount,V=n.itemData,C=n.itemKey,L=C===void 0?bt:C,T=n.layout,A=n.outerElementType,F=n.outerTagName,w=n.style,U=n.useIsScrolling,$=n.width,P=this.state.isScrolling,z=r==="horizontal"||T==="horizontal",te=z?this._onScrollHorizontal:this._onScrollVertical,B=this._getRangeToRender(),ne=B[0],re=B[1],X=[];if(E>0)for(var M=ne;M<=re;M++)X.push(N.createElement(s,{data:V,key:L(M,V),index:M,isScrolling:U?P:void 0,style:this._getItemStyle(M)}));var J=d(this.props,this._instanceProps);return N.createElement(A||F||"div",{className:a,onScroll:te,ref:this._outerRefSetter,style:Ye({position:"relative",height:u,width:$,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:r},w)},N.createElement(_||g||"div",{children:X,ref:p,style:{height:z?"100%":J,pointerEvents:P?"none":void 0,width:z?J:"100%"}}))},I._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var n=this.props.itemCount;if(n>0){var s=this._getRangeToRender(),a=s[0],r=s[1],u=s[2],p=s[3];this._callOnItemsRendered(a,r,u,p)}}if(typeof this.props.onScroll=="function"){var _=this.state,g=_.scrollDirection,E=_.scrollOffset,V=_.scrollUpdateWasRequested;this._callOnScroll(g,E,V)}},I._getRangeToRender=function(){var n=this.props,s=n.itemCount,a=n.overscanCount,r=this.state,u=r.isScrolling,p=r.scrollDirection,_=r.scrollOffset;if(s===0)return[0,0,0,0];var g=f(this.props,_,this._instanceProps),E=i(this.props,g,_,this._instanceProps),V=!u||p==="backward"?Math.max(1,a):1,C=!u||p==="forward"?Math.max(1,a):1;return[Math.max(0,g-V),Math.max(0,Math.min(s-1,E+C)),g,E]},O}(N.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var St=function(t,l){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,l.instance},It=vt({getItemOffset:function(t,l){var d=t.itemSize;return l*d},getItemSize:function(t,l){var d=t.itemSize;return d},getEstimatedTotalSize:function(t){var l=t.itemCount,d=t.itemSize;return d*l},getOffsetForIndexAndAlignment:function(t,l,d,c,h,f){var i=t.direction,o=t.height,y=t.itemCount,v=t.itemSize,b=t.layout,O=t.width,I=i==="horizontal"||b==="horizontal",S=I?O:o,n=Math.max(0,y*v-S),s=Math.min(n,l*v),a=Math.max(0,l*v-S+v+f);switch(d==="smart"&&(c>=a-S&&c<=s+S?d="auto":d="center"),d){case"start":return s;case"end":return a;case"center":{var r=Math.round(a+(s-a)/2);return r<Math.ceil(S/2)?0:r>n+Math.floor(S/2)?n:r}case"auto":default:return c>=a&&c<=s?c:c<a?a:s}},getStartIndexForOffset:function(t,l){var d=t.itemCount,c=t.itemSize;return Math.max(0,Math.min(d-1,Math.floor(l/c)))},getStopIndexForStartIndex:function(t,l,d){var c=t.direction,h=t.height,f=t.itemCount,i=t.itemSize,o=t.layout,y=t.width,v=c==="horizontal"||o==="horizontal",b=l*i,O=v?y:h,I=Math.ceil((O+d-b)/i);return Math.max(0,Math.min(f-1,l+I-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){t.itemSize}});const Ot="_layerContainer_8ackd_1",Et="_layer_8ackd_1",xt="_small_8ackd_23",Tt="_heading_8ackd_26",Ct="_option_8ackd_27",Lt="_message_8ackd_28",Vt="_focused_8ackd_64",Rt="_selected_8ackd_68",qt="_disabled_8ackd_71",Nt="_check_8ackd_75",Ft="_optionContent_8ackd_92",At="_label_8ackd_97",wt="_icon_8ackd_104",jt="_details_8ackd_109",j={layerContainer:Ot,layer:Et,small:xt,heading:Tt,option:Ct,message:Lt,focused:Vt,selected:Rt,disabled:qt,check:Nt,optionContent:Ft,label:At,icon:wt,details:jt},de=({label:e})=>m.jsx("div",{onClick:t=>t.stopPropagation(),className:j.heading,children:e});try{de.displayName="Heading",de.__docgenInfo={description:"",displayName:"Heading",props:{label:{defaultValue:null,description:"",name:"label",required:!0,type:{name:"TStringOrNumber"}}}}}catch{}const pe=({details:e,label:t,icon:l,disabled:d=!1,selected:c=!1,focused:h=!1,onSelectOption:f,actions:i,closeLayer:o,testId:y})=>m.jsxs("div",{className:D(j.option,d?j.disabled:"",c?j.selected:"",h?j.focused:""),onClick:!d&&f?f:void 0,"data-testid":y,children:[m.jsx("div",{className:j.optionContent,children:m.jsxs("span",{className:j.label,title:t,children:[t,l&&m.jsx("span",{className:j.icon,children:l})]})}),e&&m.jsx("div",{className:D(j.details),children:m.jsx(se,{faint:!0,children:e})}),!!(i!=null&&i.length)&&m.jsx("div",{className:D(j.actions),children:m.jsx(Be,{actions:i,closeLayer:o})}),m.jsx("span",{className:j.check,children:c?m.jsx(ue,{icon:Ae.CHECK}):null})]});try{pe.displayName="Option",pe.__docgenInfo={description:"",displayName:"Option",props:{details:{defaultValue:null,description:"",name:"details",required:!1,type:{name:"string"}},label:{defaultValue:null,description:"",name:"label",required:!0,type:{name:"string"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},selected:{defaultValue:{value:"false"},description:"",name:"selected",required:!1,type:{name:"boolean"}},focused:{defaultValue:{value:"false"},description:"",name:"focused",required:!1,type:{name:"boolean"}},onSelectOption:{defaultValue:null,description:"",name:"onSelectOption",required:!1,type:{name:"((event?: MouseEvent<HTMLDivElement, MouseEvent>, section?: ISelectSectionProps) => void) | undefined"}},actions:{defaultValue:null,description:"",name:"actions",required:!1,type:{name:"any[]"}},closeLayer:{defaultValue:null,description:"",name:"closeLayer",required:!1,type:{name:"TEmpty"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const fe=({section:e,selected:t,focused:l,onSelectOption:d,closeLayer:c})=>{const h=N.useContext(Se);switch(e.type){case ae.HEADING:return m.jsx(de,{label:e.label});case ae.OPTION:default:return m.jsx(pe,{closeLayer:c,actions:e.actions,label:e.label,details:e.details,icon:e.icon,disabled:e.disabled||h,selected:t,focused:l,onSelectOption:d,testId:e.testId})}};try{fe.displayName="Section",fe.__docgenInfo={description:"",displayName:"Section",props:{section:{defaultValue:null,description:"",name:"section",required:!0,type:{name:"ISelectSection"}},selected:{defaultValue:null,description:"",name:"selected",required:!1,type:{name:"boolean"}},focused:{defaultValue:null,description:"",name:"focused",required:!1,type:{name:"boolean"}},onSelectOption:{defaultValue:null,description:"",name:"onSelectOption",required:!1,type:{name:"((event?: MouseEvent<HTMLDivElement, MouseEvent>, section?: ISelectSectionProps) => void) | undefined"}},closeLayer:{defaultValue:null,description:"",name:"closeLayer",required:!1,type:{name:"TEmpty"}}}}}catch{}const me=(e,t)=>{const d=document.createElement("canvas").getContext("2d");return d?(d.font=t,d.measureText(e).width):0},ke="14px",Me="12px",Pt="Lato",kt="sans-serif",Mt=14,Ht=7,Wt=38,Dt=24,Ut=5,zt=3,Gt=1,$t=2,Ve=10,He=(e=!1,t=!1)=>`${e?Me:ke} ${t?Pt:kt}`,Kt=(e=!1,t=!1)=>(e?Ht:Mt)+(e?Dt:Wt)+(t?17:0),Re=(e,t,l,d)=>{const c=He(t,l),h=d?me(d,c):0,f=Math.ceil(e.reduce((o,y)=>{var S;const v=(((S=y==null?void 0:y.actions)==null?void 0:S.length)??0)*24,b=y.icon?parseInt(t?Me:ke)+7:0,O=`${y.label} ${y.details||""}`,I=me(O,c)+v+b;return o=I>o?I:o,o},h)),i=Kt(t,!0);return f+i},Yt=(e,t,l)=>{const d=He(!0,l),c=me(e.label,d),h=(t?zt:Ut)*2+Gt*2+$t;return Math.ceil(c+h)},he=({listRef:e,isMulti:t,sections:l,selectedOptions:d,onSelectOption:c,focusedOptionIndex:h,width:f,small:i,firstSelectedOptionIndex:o,closeLayer:y,testId:v})=>{N.useEffect(()=>{o&&o!==null&&e.current!==null&&e.current.scrollToItem(o,"start")},[o,e]);const b=i?24:30;return m.jsx("div",{"data-testid":v,className:D(j.layer,i&&j.small),children:l.length?m.jsx(It,{ref:e,height:l.length<Ve?b*l.length:b*Ve,itemCount:l.length,itemSize:b,width:f,children:({index:O,style:I})=>{var S;return m.jsx("div",{style:I,children:m.jsx(fe,{closeLayer:y,section:l[O],selected:t&&l[O].type!==ae.HEADING&&Array.isArray(d)?d.some(n=>{var s;return n&&(n==null?void 0:n.value)===((s=l==null?void 0:l[O])==null?void 0:s.value)}):!Array.isArray(d)&&((S=l==null?void 0:l[O])==null?void 0:S.value)===(d==null?void 0:d.value),focused:h===O,onSelectOption:n=>c(n,l[O])})})}}):m.jsx("ul",{children:m.jsx("li",{children:m.jsx("div",{className:j.message,style:{width:f},children:"No matches"})})})})};try{he.displayName="Layer",he.__docgenInfo={description:"",displayName:"Layer",props:{listRef:{defaultValue:null,description:"",name:"listRef",required:!0,type:{name:"RefObject<any>"}},isMulti:{defaultValue:null,description:"",name:"isMulti",required:!1,type:{name:"boolean"}},sections:{defaultValue:null,description:"",name:"sections",required:!0,type:{name:"ISelectSection[]"}},selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!0,type:{name:"ISelectSelectedOption | ISelectSelectedOption[]"}},onSelectOption:{defaultValue:null,description:"",name:"onSelectOption",required:!0,type:{name:"(event?: MouseEvent<HTMLDivElement, MouseEvent> | undefined, section?: ISelectSection | undefined) => void"}},focusedOptionIndex:{defaultValue:null,description:"",name:"focusedOptionIndex",required:!1,type:{name:"number"}},width:{defaultValue:null,description:"",name:"width",required:!0,type:{name:"number"}},small:{defaultValue:null,description:"",name:"small",required:!1,type:{name:"boolean"}},firstSelectedOptionIndex:{defaultValue:null,description:"",name:"firstSelectedOptionIndex",required:!1,type:{name:"number"}},closeLayer:{defaultValue:null,description:"",name:"closeLayer",required:!0,type:{name:"TEmpty"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const Bt="_inputInTable_1n7ro_1",Xt="_inputHover_1n7ro_13",Jt="_inputFocus_1n7ro_18",Zt="_inputError_1n7ro_25",Qt="_inputWarning_1n7ro_26",en="_inputDisabled_1n7ro_61",tn="_hideScrollbars_1n7ro_67",nn="_trigger_1n7ro_77",rn="_isInTable_1n7ro_93",ln="_input_1n7ro_1",an="_isOpen_1n7ro_114",on="_error_1n7ro_122",sn="_warning_1n7ro_139",un="_disabled_1n7ro_156",cn="_icons_1n7ro_162",dn="_clearAll_1n7ro_169",pn="_iconOpen_1n7ro_170",fn="_small_1n7ro_181",mn="_triggerInputContainer_1n7ro_189",hn="_right_1n7ro_198",yn="_multiOptions_1n7ro_211",gn="_multiOption_1n7ro_211",_n="_label_1n7ro_239",bn="_closeMultiOption_1n7ro_242",vn="_focus_1n7ro_253",Sn="_selectedSingleValue_1n7ro_257",In="_placeHolder_1n7ro_258",On="_groupOrderFirst_1n7ro_297",En="_groupOrderMiddle_1n7ro_298",xn="_groupOrderLast_1n7ro_302",Tn="_detailedLabel_1n7ro_307",q={inputInTable:Bt,inputHover:Xt,inputFocus:Jt,inputError:Zt,inputWarning:Qt,inputDisabled:en,hideScrollbars:tn,trigger:nn,isInTable:rn,input:ln,isOpen:an,error:on,warning:sn,disabled:un,icons:cn,clearAll:dn,iconOpen:pn,small:fn,triggerInputContainer:mn,right:hn,multiOptions:yn,multiOption:gn,label:_n,closeMultiOption:bn,focus:vn,selectedSingleValue:Sn,placeHolder:In,groupOrderFirst:On,groupOrderMiddle:En,groupOrderLast:xn,detailedLabel:Tn},ye=({selectedOptions:e,small:t,width:l})=>{const d=Pe(),[c,h]=N.useState([]),[f,i]=N.useState([]);return N.useEffect(()=>{let o=[],y=[],v=0;e.forEach((b,O)=>{v+=Yt(b,t,d),O===e.length-1&&v<l||v<l-24?o.push(b):y.push(b)}),h(o),i(y)},[e,d,l]),m.jsxs("div",{className:q.multiOptions,children:[c.filter(o=>o&&o.label).map((o,y)=>m.jsx("span",{className:q.multiOption,onClick:v=>{v.stopPropagation()},children:o.label},y)),f.length>0&&m.jsx(Ie,{text:f.map((o,y)=>m.jsx("div",{children:o.label},y)),display:"inline-flex",children:m.jsx("span",{className:q.multiOption,children:c.length?`+${f.length}`:`${f.length} items`})})]})};try{ye.displayName="MultiSelectedOptions",ye.__docgenInfo={description:"",displayName:"MultiSelectedOptions",props:{selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!0,type:{name:"ISelectSelectedOption[]"}},small:{defaultValue:null,description:"",name:"small",required:!1,type:{name:"boolean"}},width:{defaultValue:null,description:"",name:"width",required:!0,type:{name:"number"}}}}}catch{}const ge=({selectedOptions:e,searchable:t=!1,searchValue:l,onChange:d=()=>{},inputRef:c,error:h,placeholder:f="Select...",small:i})=>{const o=N.useRef(null),y=Array.isArray(e),v=y?e.length>0:!!e,b=l?l.length+1:1,O=()=>{var n,s;const I=((n=o.current)==null?void 0:n.offsetWidth)||0,S=((s=c.current)==null?void 0:s.offsetWidth)||0;return I-S};return m.jsxs("div",{className:q.triggerInputContainer,ref:o,children:[v?y?m.jsx(ye,{selectedOptions:e,small:i,width:O()}):m.jsx("span",{className:q.selectedSingleValue,children:l!=null&&l.length?"":e==null?void 0:e.label}):m.jsx("span",{className:q.placeHolder,children:l!=null&&l.length?"":f}),t?m.jsx("input",{tabIndex:-1,ref:c,size:b,className:D(q.input,h?q.error:""),value:l,onChange:I=>d(I.target.value)}):null]})};try{ge.displayName="Input",ge.__docgenInfo={description:"",displayName:"Input",props:{selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!1,type:{name:"ISelectSelectedOption | ISelectSelectedOption[]"}},searchable:{defaultValue:{value:"false"},description:"",name:"searchable",required:!1,type:{name:"boolean"}},searchValue:{defaultValue:null,description:"",name:"searchValue",required:!1,type:{name:"string"}},inputRef:{defaultValue:null,description:"",name:"inputRef",required:!0,type:{name:"MutableRefObject<HTMLInputElement | null>"}},onChange:{defaultValue:{value:"() => {}"},description:"",name:"onChange",required:!1,type:{name:"((value: string) => void)"}},error:{defaultValue:null,description:"",name:"error",required:!1,type:{name:"ReactNode"}},placeholder:{defaultValue:{value:"Select..."},description:"",name:"placeholder",required:!1,type:{name:"string | null"}},small:{defaultValue:null,description:"",name:"small",required:!1,type:{name:"boolean"}}}}}catch{}const _e=({selectedOptions:e,searchValue:t,searchable:l,clearable:d,onClickTrigger:c,element:h,error:f,warning:i,tooltip:o,small:y,isInTable:v,disabled:b,onChangeSearch:O,onClickDeselect:I,onClickClear:S,tabIndex:n,isOpen:s,triggerRef:a,clearAllIsFocused:r,focusedSelectedOptionIndex:u,onFocus:p,onBlur:_,groupOrder:g,maxTooltipWidth:E,placeholder:V,right:C,testId:L})=>{const[T,A]=je(),F=d&&e&&e.value,w=(()=>{if(g)switch(g){case le.FIRST:return q.groupOrderFirst;case le.LAST:return q.groupOrderLast;default:return q.groupOrderMiddle}return""})(),U=e!=null&&e.details?{...e,label:m.jsxs("div",{className:D(q.detailedLabel),children:[m.jsx(se,{children:e.label}),m.jsx(se,{muted:!0,children:e.details})]})}:e,$=m.jsxs(m.Fragment,{children:[h,m.jsxs("div",{ref:a,tabIndex:n,className:D(q.trigger,s?q.isOpen:"",f?q.error:i?q.warning:"",b?q.disabled:"",y?q.small:"",v?q.isInTable:"",C?q.right:"",w),onClick:P=>{P.stopPropagation(),typeof A=="function"&&A(),c(P)},onFocus:p,onBlur:_,"data-testid":L,children:[m.jsx(ge,{selectedOptions:U,placeholder:V,searchable:l,searchValue:t,inputRef:T,onChange:O,error:f,small:y}),m.jsx("span",{className:q.icons,children:F?m.jsx("span",{className:D(q.clearAll,r?q.focus:""),onClick:P=>{P.stopPropagation(),S&&S(P)},children:m.jsx(ue,{icon:Ae.CLOSE})}):m.jsx("span",{className:D(q.iconOpen),children:m.jsx(ue,{icon:"chevron down"})})})]})]});return m.jsx(m.Fragment,{children:m.jsx(Ie,{error:!!f,warning:!!i,text:o||f||i,enabled:o&&ee(o)||f&&ee(f)||i&&ee(i)||!1,maxWidth:E,placement:"bottom-center",children:$})})};try{_e.displayName="Trigger",_e.__docgenInfo={description:"",displayName:"Trigger",props:{selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!1,type:{name:"ISelectSelectedOption"}},searchValue:{defaultValue:null,description:"",name:"searchValue",required:!1,type:{name:"string"}},searchable:{defaultValue:null,description:"",name:"searchable",required:!1,type:{name:"boolean"}},clearable:{defaultValue:null,description:"",name:"clearable",required:!1,type:{name:"boolean"}},onClickTrigger:{defaultValue:null,description:"",name:"onClickTrigger",required:!0,type:{name:"(evt: MouseEvent<HTMLDivElement, MouseEvent>) => void"}},element:{defaultValue:null,description:"",name:"element",required:!1,type:{name:"ReactNode"}},error:{defaultValue:null,description:"",name:"error",required:!1,type:{name:"ReactNode"}},warning:{defaultValue:null,description:"",name:"warning",required:!1,type:{name:"ReactNode"}},tooltip:{defaultValue:null,description:"",name:"tooltip",required:!1,type:{name:"ReactNode"}},small:{defaultValue:null,description:"",name:"small",required:!1,type:{name:"boolean"}},isInTable:{defaultValue:null,description:"",name:"isInTable",required:!1,type:{name:"boolean"}},disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"boolean"}},onChangeSearch:{defaultValue:null,description:"",name:"onChangeSearch",required:!1,type:{name:"((value: string) => void)"}},onClickDeselect:{defaultValue:null,description:"",name:"onClickDeselect",required:!1,type:{name:"((evt: MouseEvent<HTMLDivElement, MouseEvent>) => void)"}},onClickClear:{defaultValue:null,description:"",name:"onClickClear",required:!1,type:{name:"((evt: MouseEvent<HTMLSpanElement, MouseEvent>) => void)"}},tabIndex:{defaultValue:null,description:"",name:"tabIndex",required:!1,type:{name:"number"}},isOpen:{defaultValue:null,description:"",name:"isOpen",required:!1,type:{name:"boolean"}},triggerRef:{defaultValue:null,description:"",name:"triggerRef",required:!1,type:{name:"RefObject<HTMLDivElement>"}},clearAllIsFocused:{defaultValue:null,description:"",name:"clearAllIsFocused",required:!1,type:{name:"boolean"}},focusedSelectedOptionIndex:{defaultValue:null,description:"",name:"focusedSelectedOptionIndex",required:!1,type:{name:"number"}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"((evt: FocusEvent<HTMLDivElement, Element>) => void)"}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"((evt: FocusEvent<HTMLDivElement, Element>) => void)"}},groupOrder:{defaultValue:null,description:"",name:"groupOrder",required:!1,type:{name:"string"}},maxTooltipWidth:{defaultValue:null,description:"",name:"maxTooltipWidth",required:!1,type:{name:"TStringOrNumber"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string | null"}},right:{defaultValue:null,description:"",name:"right",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}var W=(e=>(e.SET_VISIBLE_OPTIONS="SET_VISIBLE_OPTIONS",e.RESET_LAYER_FOCUS="RESET_LAYER_FOCUS",e.CLEAR_SEARCH="CLEAR_SEARCH",e.ON_CHANGE_SEARCH="ON_CHANGE_SEARCH",e.FOCUS_TRIGGER_INPUTS="FOCUS_TRIGGER_INPUTS",e.BLUR_TRIGGER_INPUTS="BLUR_TRIGGER_INPUTS",e.FOCUS_LAYER_OPTIONS="FOCUS_LAYER_OPTIONS",e.OPEN_LAYER="OPEN_LAYER",e.CLOSE_LAYER="CLOSE_LAYER",e))(W||{});const We={options:["none","clearAll"],currentIndex:0,currentOption:!1,clearAll:!1},Cn=e=>e!==null?e+1:0,De=(e,t)=>{const l=["none",...e.map((c,h)=>c.type!==ae.HEADING?h:null).filter(c=>c!==null)],d=Cn(t);return{options:l,currentIndex:d,current:l[d]}},Ln=(e,t)=>{const l=e==="up"?-1:1,d=t.currentIndex+l,c=(d<0?t.options.length-1:d)%t.options.length,h=t.options[c];return{...t,currentIndex:c,current:h}},Vn=(e,t,l)=>{const d=e==="left"?-1:1,c=t&&t.length?["none",...Array.from({length:t.length},(y,v)=>v),"clearAll"]:["none","clearAll"],h=l.currentIndex+d,f=(h<0?c.length-1:h)%c.length,i=c[f];return{options:c,currentIndex:f,currentOption:i,clearAll:i==="clearAll"}},qe=()=>We,Ne=e=>({...e,currentIndex:0,current:"none"}),Rn=(e,t)=>{switch(t.type){case W.SET_VISIBLE_OPTIONS:return{...e,visibleOptions:t.options||[]};case W.RESET_LAYER_FOCUS:return{...e,layerFocus:De(t.options||[],t.firstSelectedOptionIndex||0)};case W.CLEAR_SEARCH:return{...e,visibleOptions:t.options||[],searchValue:""};case W.ON_CHANGE_SEARCH:{let d=[...(t.options||[]).filter(c=>(String(c.label)+(c.details?String(c.details):"")).toLowerCase().includes(String(t.value||"").toLowerCase()))];return t.createAble&&t.value&&t.value!==""&&d.push({label:`Create "${t.value}"`,value:t.value,createAble:!0}),{...e,searchValue:t.value,visibleOptions:d,layerFocus:Ne(e.layerFocus)}}case W.FOCUS_TRIGGER_INPUTS:return{...e,triggerFocus:Vn(t.direction||"right",t.selectedOptions||[],e.triggerFocus),layerFocus:Ne(e.layerFocus)};case W.BLUR_TRIGGER_INPUTS:return{...e,triggerFocus:qe()};case W.FOCUS_LAYER_OPTIONS:return t.nextLayerFocus?{...e,layerFocus:t.nextLayerFocus,triggerFocus:qe()}:e;case W.OPEN_LAYER:return{...e,isLayerOpen:!0};case W.CLOSE_LAYER:return{...e,isLayerOpen:!1};default:return e}},qn={auto:!0,possiblePlacements:["bottom-start","top-start"],placement:"bottom-start",preferX:"right",preferY:"bottom"};var k=(e=>(e.CLOSE_LAYER="CLOSE_LAYER",e.OPEN_LAYER="OPEN_LAYER",e.SET_VISIBLE_OPTIONS="SET_VISIBLE_OPTIONS",e.CLEAR_SEARCH="CLEAR_SEARCH",e.RESET_LAYER_FOCUS="RESET_LAYER_FOCUS",e.FOCUS_LAYER_OPTIONS="FOCUS_LAYER_OPTIONS",e.BLUR_TRIGGER_INPUTS="BLUR_TRIGGER_INPUTS",e.FOCUS_TRIGGER_INPUTS="FOCUS_TRIGGER_INPUTS",e.ON_CHANGE_SEARCH="ON_CHANGE_SEARCH",e))(k||{}),G=(e=>(e.RIGHT="right",e.LEFT="left",e.UP="up",e.DOWN="down",e.ENTER="enter",e.ESC="esc",e.TAB="tab",e))(G||{});const be=({state:e,dispatch:t,options:l,setTriggerFocus:d,disabled:c,disabledContext:h,onCreate:f,onChange:i,selectedOptions:o,width:y,small:v,isFontLoaded:b,placeholder:O,firstSelectedOptionIndex:I,createAble:S,listRef:n,autoLayerWidth:s})=>{const a=()=>{e.isLayerOpen&&t({type:k.CLOSE_LAYER}),d()},r=()=>t({type:k.OPEN_LAYER}),u=N.useRef(!0);N.useEffect(()=>{u.current?u.current=!1:t({type:k.SET_VISIBLE_OPTIONS,options:l})},[l]);const p=(x,R,Z)=>{if(!(c||h)){if(Z&&Z(),R){if(R.createAble&&f)f(R.value);else if(!R.disabled)if(Array.isArray(o))if(o.some(Y=>Y.label===R.label)){const Y=o.filter(Oe=>Oe.label!==R.label);i&&i(x,Y)}else{const Y=[...o,R];i&&i(x,Y)}else i&&i(x,R)}t({type:k.CLEAR_SEARCH,options:l}),d()}},_=N.useCallback(()=>y?y!=="auto"?y:Re(l,v,b,O):"100%",[l,b]),g=N.useCallback(x=>s?Math.max(Re(l,v,b,O),x==null?void 0:x.width):x==null?void 0:x.width,[l,b]),{renderLayer:E,layerProps:V,triggerProps:C,triggerBounds:L}=ze({isOpen:(e==null?void 0:e.isLayerOpen)??!1,overflowContainer:!0,...qn,ResizeObserver,onOutsideClick:a,onParentClose:a}),T=()=>{if(!(c||h)){if(e.isLayerOpen){a();return}t({type:k.RESET_LAYER_FOCUS,options:l,firstSelectedOptionIndex:I}),r()}},A=N.useRef(!0);N.useEffect(()=>{A.current?A.current=!1:e.isLayerOpen||t({type:k.CLEAR_SEARCH,options:l})},[e.isLayerOpen]);const F=(x,R)=>{const Z=o instanceof Array?o.filter(K=>K.value!==R.value):null;i&&i(x,Z)},w=x=>{const R=o instanceof Array?[]:{value:null};i&&i(x,R)},U=x=>t({type:k.ON_CHANGE_SEARCH,options:l,value:x,createAble:S}),$=()=>{r(),t({type:k.BLUR_TRIGGER_INPUTS})},P=x=>{n.current&&Number.isInteger(x)&&n.current.scrollToItem(x)},z=x=>{const R=Ln(x,e.layerFocus);t({type:k.FOCUS_LAYER_OPTIONS,nextLayerFocus:R}),P(R.current)},te=x=>{t({type:k.FOCUS_TRIGGER_INPUTS,ICustomSelectDirection:x,selectedOptions:o})},B=x=>w(x),ne=o&&o[e.triggerFocus.currentOption],re=x=>{F(x,o[e.triggerFocus.currentOption])},X=x=>{var R;p(x,(R=e==null?void 0:e.visibleOptions)==null?void 0:R[e.layerFocus.current],a)},M=e.triggerFocus.clearAll;return{getTriggerWidth:_,onKeyEvent:(x,R)=>{switch(x){case G.UP:{z(x);break}case G.DOWN:{e.isLayerOpen?z(x):$();break}case G.LEFT:case G.RIGHT:{te(x);break}case G.ENTER:{M?B(R):ne?re(R):X(R);break}case G.ESC:{a();break}}},clearAllIsFocused:M,triggerProps:C,onClickTrigger:T,onChangeSearch:U,onClickDeselectOption:F,onClickClearAll:w,renderLayer:E,layerProps:V,closeLayer:a,onSelectOption:p,getLayerWidth:g,triggerBounds:L}};try{be.displayName="useCustomSelectLogic",be.__docgenInfo={description:"",displayName:"useCustomSelectLogic",props:{state:{defaultValue:null,description:"",name:"state",required:!0,type:{name:"ICustomSelectState"}},dispatch:{defaultValue:null,description:"",name:"dispatch",required:!0,type:{name:"(action: any) => void"}},options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"TCustomSelectSelectOption[]"}},setTriggerFocus:{defaultValue:null,description:"",name:"setTriggerFocus",required:!0,type:{name:"TEmpty"}},disabled:{defaultValue:null,description:"",name:"disabled",required:!0,type:{name:"boolean"}},disabledContext:{defaultValue:null,description:"",name:"disabledContext",required:!0,type:{name:"boolean"}},onCreate:{defaultValue:null,description:"",name:"onCreate",required:!0,type:{name:"((value: string) => void) | null"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!0,type:{name:"((evt: any, selected: any) => void) | null"}},selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!0,type:{name:"ISelectSelectedOption | ISelectSelectedOption[]"}},width:{defaultValue:null,description:"",name:"width",required:!0,type:{name:"TStringOrNumber | null"}},small:{defaultValue:null,description:"",name:"small",required:!0,type:{name:"boolean"}},isFontLoaded:{defaultValue:null,description:"",name:"isFontLoaded",required:!0,type:{name:"boolean"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!0,type:{name:"string"}},firstSelectedOptionIndex:{defaultValue:null,description:"",name:"firstSelectedOptionIndex",required:!0,type:{name:"number"}},createAble:{defaultValue:null,description:"",name:"createAble",required:!0,type:{name:"boolean"}},listRef:{defaultValue:null,description:"",name:"listRef",required:!0,type:{name:"RefObject<any>"}},autoLayerWidth:{defaultValue:null,description:"",name:"autoLayerWidth",required:!0,type:{name:"boolean"}}}}}catch{}const ve=e=>{const{multi:t=!1,disabled:l=!1,error:d=null,warning:c=null,tooltip:h=null,options:f,selectedOptions:i,onCreate:o=null,placeholder:y="",small:v=!1,tabIndex:b=0,onFocus:O=()=>{},onBlur:I=()=>{},searchable:S=!0,clearable:n=!1,maxTooltipWidth:s,closeOnOptionActionClick:a,isInTable:r=!1,groupOrder:u,firstSelectedOptionIndex:p=0,right:_=!1,testId:g=void 0}=e,E=N.useContext(Se),V=o!==null,C=N.useRef(null),[L,T]=je(),A=Pe(),[F,w]=N.useReducer(Rn,{options:f,firstSelectedOptionIndex:p},({options:K})=>({searchValue:"",visibleOptions:K,layerFocus:De(K,p??0),triggerFocus:We,isLayerOpen:!1})),{getTriggerWidth:U,onKeyEvent:$,clearAllIsFocused:P,triggerProps:z,onClickTrigger:te,onChangeSearch:B,onClickDeselectOption:ne,onClickClearAll:re,renderLayer:X,layerProps:M,closeLayer:J,onSelectOption:x,getLayerWidth:R,triggerBounds:Z}=be({...e,state:F,dispatch:w,setTriggerFocus:T,disabledContext:E,isFontLoaded:A,createAble:V,listRef:C});return m.jsx("div",{style:{width:U()},children:m.jsxs(ht,{handleKeys:Object.values(G),onKeyEvent:$,children:[m.jsx(_e,{selectedOptions:i,searchValue:F.searchValue,isOpen:F.isLayerOpen,focusedSelectedOptionIndex:F.triggerFocus.currentOption,clearAllIsFocused:P,searchable:S,triggerRef:Ge(L,z.ref),error:d,warning:c,tooltip:h,small:v,isInTable:r,disabled:l||E,clearable:n,tabIndex:b,onClickTrigger:te,onChangeSearch:B,onClickDeselect:ne,onClickClear:re,onFocus:O,onBlur:I,groupOrder:u,maxTooltipWidth:s,placeholder:y,right:_,testId:g}),F.isLayerOpen&&X(m.jsx("div",{...M,className:j.layerContainer,children:m.jsx(he,{listRef:C,isMulti:t,sections:F.visibleOptions,selectedOptions:i,onSelectOption:(K,Y)=>{x(K,Y,t?void 0:J)},closeLayer:()=>{a&&J()},width:R(Z),small:v,focusedOptionIndex:F.layerFocus.current,firstSelectedOptionIndex:p??0,testId:g&&`${g}-layer`})}))]})})};try{ve.displayName="CustomSelect",ve.__docgenInfo={description:"",displayName:"CustomSelect",props:{multi:{defaultValue:null,description:"",name:"multi",required:!1,type:{name:"boolean"}},disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"boolean"}},error:{defaultValue:null,description:"",name:"error",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},warning:{defaultValue:null,description:"",name:"warning",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},tooltip:{defaultValue:null,description:"",name:"tooltip",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"TCustomSelectSelectOption[]"}},selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!0,type:{name:"ISelectSelectedOption | ISelectSelectedOption[]"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((evt: ChangeEvent<HTMLInputElement>, newSelectedOptions: ISelectSelectedOption) => void)"}},onCreate:{defaultValue:null,description:"",name:"onCreate",required:!1,type:{name:"((value: string) => void)"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string | null"}},small:{defaultValue:null,description:"",name:"small",required:!1,type:{name:"boolean"}},tabIndex:{defaultValue:null,description:"",name:"tabIndex",required:!1,type:{name:"number"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber | null"}},autoLayerWidth:{defaultValue:null,description:"",name:"autoLayerWidth",required:!1,type:{name:"boolean"}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"TEmpty"}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"TEmpty"}},searchable:{defaultValue:null,description:"",name:"searchable",required:!1,type:{name:"boolean"}},clearable:{defaultValue:null,description:"",name:"clearable",required:!1,type:{name:"boolean"}},isInTable:{defaultValue:null,description:"",name:"isInTable",required:!1,type:{name:"boolean"}},groupOrder:{defaultValue:null,description:"",name:"groupOrder",required:!1,type:{name:"string"}},firstSelectedOptionIndex:{defaultValue:null,description:"",name:"firstSelectedOptionIndex",required:!0,type:{name:"number | null"}},right:{defaultValue:null,description:"",name:"right",required:!1,type:{name:"boolean"}},maxTooltipWidth:{defaultValue:null,description:"",name:"maxTooltipWidth",required:!1,type:{name:"TStringOrNumber"}},closeOnOptionActionClick:{defaultValue:null,description:"",name:"closeOnOptionActionClick",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const Fe=e=>{const{name:t="",options:l=[],value:d,native:c=!1,onChange:h=()=>{},deprecatedEventHandler:f=!1,autoScroll:i=!0,warning:o,error:y,checkNonExistentValues:v=!0,closeOnOptionActionClick:b=!0,testId:O}=e,I=!c&&i===!0,{multi:S,simpleInputs:n,options:s,selectedOptions:a,firstSelectedOptionIndex:r,hasNonExistentValue:u}=Xe(l,d,I,v),p=!S,_=c&&p;c&&!p&&console.warn("Native select does not support provided props (see stories)");const g="Value no longer available for re-selection",E=u?o?m.jsxs("div",{children:[m.jsx("div",{children:g}),m.jsx("div",{children:o})]}):g:o,V=u&&y?m.jsxs("div",{children:[m.jsx("div",{children:g}),m.jsx("div",{children:y})]}):y,C=(L,T)=>{if(f){const A=S?T.map(F=>n?F.value:F):n?T.value:T;h(A)}else{const A=!(L instanceof Event),F=S?T:T.value;A?(L.target.name=t,L.target.value=F,S||(L.target.label=T.label),h(L)):h({...L,target:{...L.target,name:t,value:F,...!S&&{label:T.label}}})}};return _?m.jsx(ce,{...e,options:s,selectedOption:a,onChange:C,hasNonExistentValue:u,warning:E,error:V,testId:O}):m.jsx(ve,{...e,options:s,selectedOptions:a,onChange:C,multi:S,firstSelectedOptionIndex:r,warning:E,error:V,testId:O,closeOnOptionActionClick:b})};try{Fe.displayName="Select",Fe.__docgenInfo={description:"",displayName:"Select",props:{name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},multi:{defaultValue:null,description:"",name:"multi",required:!1,type:{name:"boolean"}},options:{defaultValue:null,description:"",name:"options",required:!1,type:{name:"ISelectSelectedOption[]"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"any"}},native:{defaultValue:null,description:"",name:"native",required:!1,type:{name:"boolean"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((value: any) => void)"}},deprecatedEventHandler:{defaultValue:null,description:"",name:"deprecatedEventHandler",required:!1,type:{name:"boolean"}},autoScroll:{defaultValue:null,description:"",name:"autoScroll",required:!1,type:{name:"boolean"}},warning:{defaultValue:null,description:"",name:"warning",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},error:{defaultValue:null,description:"",name:"error",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},checkNonExistentValues:{defaultValue:null,description:"",name:"checkNonExistentValues",required:!1,type:{name:"boolean"}},closeOnOptionActionClick:{defaultValue:null,description:"",name:"closeOnOptionActionClick",required:!1,type:{name:"boolean"}},small:{defaultValue:null,description:"",name:"small",required:!1,type:{name:"boolean"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber | null"}},borderRadius:{defaultValue:null,description:"",name:"borderRadius",required:!1,type:{name:"TStringOrNumber"}},onCreate:{defaultValue:null,description:"",name:"onCreate",required:!1,type:{name:"((evt: any) => any)"}},disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"boolean"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string | null"}},isInTable:{defaultValue:null,description:"",name:"isInTable",required:!1,type:{name:"boolean"}},clearable:{defaultValue:null,description:"",name:"clearable",required:!1,type:{name:"boolean"}},searchable:{defaultValue:null,description:"",name:"searchable",required:!1,type:{name:"boolean"}},maxTooltipWidth:{defaultValue:null,description:"",name:"maxTooltipWidth",required:!1,type:{name:"TStringOrNumber"}},autoLayerWidth:{defaultValue:null,description:"",name:"autoLayerWidth",required:!1,type:{name:"boolean"}},right:{defaultValue:null,description:"",name:"right",required:!1,type:{name:"boolean"}},tabIndex:{defaultValue:null,description:"",name:"tabIndex",required:!1,type:{name:"number"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}export{Fe as S};
1
+ import{j as m}from"./jsx-runtime-f961835c.js";import{r as N,g as Ue}from"./index-f80c8c95.js";import{c as D}from"./index-a80ed1cf.js";import{G as le,I as Ae}from"./common-types-2c81813f.js";import{D as Se}from"./disabled-context-d654f6ff.js";import{i as ee}from"./types-332ceaf3.js";import{T as Ie,u as ze,m as Ge}from"./tooltip-23e84186.js";import{p as $e}from"./index-c89a1915.js";import"./lodash-75c70a11.js";import{_ as Ke,a as Ye}from"./inheritsLoose-d4851ab8.js";import{_ as Ee}from"./assertThisInitialized-081f9914.js";import{m as ie}from"./memoize-one.esm-52518564.js";import{M as ae}from"./types-cc224262.js";import{T as se}from"./text-ad1f5f1d.js";import{A as Be}from"./actions-d843b059.js";import{I as ue}from"./icon-afbea088.js";import{s as Xe}from"./select.input-88b6ebab.js";const Je="_inputInTable_m6lot_1",Ze="_inputHover_m6lot_13",Qe="_inputFocus_m6lot_18",et="_inputError_m6lot_25",tt="_inputWarning_m6lot_26",nt="_inputDisabled_m6lot_61",rt="_hideScrollbars_m6lot_67",lt="_select_m6lot_77",at="_isInTable_m6lot_121",it="_unSelected_m6lot_133",ot="_error_m6lot_140",st="_warning_m6lot_157",ut="_small_m6lot_174",ct="_right_m6lot_182",dt="_groupOrderFirst_m6lot_193",pt="_groupOrderMiddle_m6lot_194",ft="_groupOrderLast_m6lot_198",H={inputInTable:Je,inputHover:Ze,inputFocus:Qe,inputError:et,inputWarning:tt,inputDisabled:nt,hideScrollbars:rt,select:lt,isInTable:at,unSelected:it,error:ot,warning:st,small:ut,right:ct,groupOrderFirst:dt,groupOrderMiddle:pt,groupOrderLast:ft},ce=({disabled:e=!1,error:t=null,warning:l=null,tooltip:d=null,options:c,onChange:h=()=>{},onFocus:f=()=>{},onBlur:i=()=>{},right:o=!1,small:y=!1,tabIndex:v=0,selectedOption:b,width:O=null,groupOrder:I=null,testId:S,isInTable:n=!1,clearable:s,placeholder:a,hasNonExistentValue:r,maxTooltipWidth:u,borderRadius:p})=>{const _=N.useContext(Se),g=b===null||(b==null?void 0:b.value)===null?"unselected":b==null?void 0:b.value,E=g==="unselected",V=(g==="unselected"||s?[m.jsx("option",{value:"unselected",disabled:!s,hidden:!s,children:a||"Select..."},"unselected")]:[]).concat(r?[m.jsx("option",{value:b==null?void 0:b.value,disabled:e||_,children:b==null?void 0:b.label},"selectedNonExistentValue")]:[]).concat(c.map((L,T)=>m.jsx("option",{value:L.value,"data-testid":L.testId,children:L.label},T))),C=(()=>{if(I)switch(I){case le.FIRST:return H.groupOrderFirst;case le.LAST:return H.groupOrderLast;default:return H.groupOrderMiddle}return""})();return m.jsx(Ie,{error:!!t,warning:!!l,text:d||t||l,enabled:d&&ee(d)||t&&ee(t)||l&&ee(l)||!1,maxWidth:u,placement:"bottom-center",children:m.jsx("select",{className:D(H.select,E?H.unSelected:"",t?H.error:l?H.warning:"",o?H.right:"",y?H.small:"",n?H.isInTable:"",C),style:{width:O||"",borderRadius:p||""},onChange:L=>{const{value:T}=L.target;let A;T==="unselected"?A={value:null}:A=c.find(w=>String(w.value)===String(T))||{value:null},h(L,A)},onFocus:f,onBlur:i,tabIndex:v,value:g,disabled:e||_,"data-testid":S,children:V})})};try{ce.displayName="NativeSelect",ce.__docgenInfo={description:"",displayName:"NativeSelect",props:{borderRadius:{defaultValue:null,description:"",name:"borderRadius",required:!1,type:{name:"TStringOrNumber"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},error:{defaultValue:{value:"null"},description:"",name:"error",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},warning:{defaultValue:{value:"null"},description:"",name:"warning",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},tooltip:{defaultValue:{value:"null"},description:"",name:"tooltip",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"ISelectSelectedOption[]"}},onChange:{defaultValue:{value:"() => {}"},description:"",name:"onChange",required:!1,type:{name:"((evt: ChangeEvent<HTMLSelectElement>, value: ISelectSelectedOption | { value: null; }) => void)"}},onFocus:{defaultValue:{value:"() => {}"},description:"",name:"onFocus",required:!1,type:{name:"TEmpty"}},onBlur:{defaultValue:{value:"() => {}"},description:"",name:"onBlur",required:!1,type:{name:"TEmpty"}},right:{defaultValue:{value:"false"},description:"",name:"right",required:!1,type:{name:"boolean"}},small:{defaultValue:{value:"false"},description:"",name:"small",required:!1,type:{name:"boolean"}},tabIndex:{defaultValue:{value:"0"},description:"",name:"tabIndex",required:!1,type:{name:"number"}},selectedOption:{defaultValue:null,description:"",name:"selectedOption",required:!1,type:{name:"ISelectSelectedOption"}},width:{defaultValue:{value:"null"},description:"",name:"width",required:!1,type:{name:"TStringOrNumber | null"}},groupOrder:{defaultValue:{value:"null"},description:"",name:"groupOrder",required:!1,type:{name:"string | null"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}},isInTable:{defaultValue:{value:"false"},description:"",name:"isInTable",required:!1,type:{name:"boolean"}},clearable:{defaultValue:null,description:"",name:"clearable",required:!1,type:{name:"boolean"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string | null"}},hasNonExistentValue:{defaultValue:null,description:"",name:"hasNonExistentValue",required:!1,type:{name:"boolean"}},maxTooltipWidth:{defaultValue:null,description:"",name:"maxTooltipWidth",required:!1,type:{name:"TStringOrNumber"}}}}}catch{}var we={exports:{}};(function(e,t){(function(l,d){e.exports=d(N,$e)})(window,function(l,d){return function(c){var h={};function f(i){if(h[i])return h[i].exports;var o=h[i]={i,l:!1,exports:{}};return c[i].call(o.exports,o,o.exports,f),o.l=!0,o.exports}return f.m=c,f.c=h,f.d=function(i,o,y){f.o(i,o)||Object.defineProperty(i,o,{enumerable:!0,get:y})},f.r=function(i){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(i,"__esModule",{value:!0})},f.t=function(i,o){if(1&o&&(i=f(i)),8&o||4&o&&typeof i=="object"&&i&&i.__esModule)return i;var y=Object.create(null);if(f.r(y),Object.defineProperty(y,"default",{enumerable:!0,value:i}),2&o&&typeof i!="string")for(var v in i)f.d(y,v,(function(b){return i[b]}).bind(null,v));return y},f.n=function(i){var o=i&&i.__esModule?function(){return i.default}:function(){return i};return f.d(o,"a",o),o},f.o=function(i,o){return Object.prototype.hasOwnProperty.call(i,o)},f.p="",f(f.s=0)}([function(c,h,f){Object.defineProperty(h,"__esModule",{value:!0});var i=f(1);Object.defineProperty(h,"default",{enumerable:!0,get:function(){return function(o){return o&&o.__esModule?o:{default:o}}(i).default}}),c.exports=h.default},function(c,h,f){Object.defineProperty(h,"__esModule",{value:!0});var i=Object.assign||function(n){for(var s=1;s<arguments.length;s++){var a=arguments[s];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(n[r]=a[r])}return n},o=function(){function n(s,a){for(var r=0;r<a.length;r++){var u=a[r];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,a,r){return a&&n(s.prototype,a),r&&n(s,r),s}}(),y=O(f(2)),v=O(f(3)),b=f(4);function O(n){return n&&n.__esModule?n:{default:n}}var I=[],S=function(n){function s(a){(function(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")})(this,s);var r=function(u,p){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!p||typeof p!="object"&&typeof p!="function"?u:p}(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,a));return r.handleKeyboardEvent=r.handleKeyboardEvent.bind(r),r.registerExclusiveHandler=r.registerExclusiveHandler.bind(r),r.deregisterExclusiveHandler=r.deregisterExclusiveHandler.bind(r),r}return function(a,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof r);a.prototype=Object.create(r&&r.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(a,r):a.__proto__=r)}(s,y.default.Component),o(s,[{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyboardEvent,!1),document.addEventListener("keyup",this.handleKeyboardEvent,!1),document.addEventListener("keypress",this.handleKeyboardEvent,!1);var a=this.props,r=a.isExclusive,u=a.isDisabled;r&&!u&&this.registerExclusiveHandler()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyboardEvent,!1),document.removeEventListener("keyup",this.handleKeyboardEvent,!1),document.removeEventListener("keypress",this.handleKeyboardEvent,!1),this.deregisterExclusiveHandler()}},{key:"componentDidUpdate",value:function(a){var r=a.isExclusive,u=a.isDisabled;(this.props.isExclusive!==r||this.props.isDisabled!==u)&&(this.props.isExclusive&&!this.props.isDisabled?this.registerExclusiveHandler():this.deregisterExclusiveHandler())}},{key:"registerExclusiveHandler",value:function(){this.deregisterExclusiveHandler(),I.unshift(this)}},{key:"deregisterExclusiveHandler",value:function(){var a=this;I.includes(this)&&(I=I.filter(function(r){return r!==a}))}},{key:"handleKeyboardEvent",value:function(a){var r=this.props,u=r.isDisabled,p=r.handleKeys,_=r.onKeyEvent,g=r.handleEventType,E=r.children,V=r.handleFocusableElements;if(u||g!==a.type||I.length>0&&I[0]!==this)return!1;var C=a.target===document.body||V,L=this.childrenContainer&&this.childrenContainer.contains(a.target);if(!(E?L:C))return!1;var T=(0,b.findMatchedKey)(a,p);return!!T&&(_(T,a),!0)}},{key:"render",value:function(){var a=this,r=this.props.children,u=Object.assign({},this.props),p=!0,_=!1,g=void 0;try{for(var E,V=Object.keys(s.propTypes)[Symbol.iterator]();!(p=(E=V.next()).done);p=!0)delete u[E.value]}catch(C){_=!0,g=C}finally{try{!p&&V.return&&V.return()}finally{if(_)throw g}}return r?y.default.createElement("span",i({ref:function(C){a.childrenContainer=C}},u),r):null}}]),s}();h.default=S,S.propTypes={handleKeys:v.default.array,handleEventType:v.default.oneOf(["keydown","keyup","keypress"]),handleFocusableElements:v.default.bool,onKeyEvent:v.default.func,isDisabled:v.default.bool,isExclusive:v.default.bool,children:v.default.any},S.defaultProps={handleKeys:[],handleFocusableElements:!1,handleEventType:"keydown",onKeyEvent:function(){return null}},c.exports=h.default},function(c,h){c.exports=l},function(c,h){c.exports=d},function(c,h,f){function i(r,u,p){return u in r?Object.defineProperty(r,u,{value:p,enumerable:!0,configurable:!0,writable:!0}):r[u]=p,r}Object.defineProperty(h,"__esModule",{value:!0}),h.matchKeyEvent=a,h.findMatchedKey=function(r,u){var p=u.map(function(_){var g=_.toLowerCase(),E=s[g];return E||[_]}).reduce(function(_,g){return _.concat(g)},[]).find(function(_){return a(r,_)});return!p&&u.includes("all")&&(p="other"),p};var o={backspace:[8],del:[46],delete:[46],ins:[45],insert:[45],tab:[9],enter:[13],return:[13],esc:[27],space:[32],pageup:[33],pagedown:[34],end:[35],home:[36],left:[37],up:[38],right:[39],down:[40],shift:[16],ctrl:[17],alt:[18],cap:[20],num:[144],clear:[12],meta:[91],";":[186,59],"=":[187,61],",":[188,44],"-":[189,45,173,109],minus:[189,45,173,109],".":[190,110],"/":[191,111],"`":[192],"[":[219],"\\":[220],"]":[221],"*":[106],"+":[107],plus:[107],"'":[222],quote:[222]},y=Object.keys(o).reduce(function(r,u){return Object.assign(r,i({},u.toUpperCase(),o[u]))},{}),v="0123456789".split("").reduce(function(r,u,p){return Object.assign(r,i({},u,[p+48,p+96]))},{}),b="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").reduce(function(r,u,p){return Object.assign(r,i({},u.toLowerCase(),[p+65]),i({},u,[p+65]))},{}),O="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19".split(",").reduce(function(r,u,p){return Object.assign(r,i({},"f"+u,[p+112]))},{}),I={control:"ctrl",ctrl:"ctrl",shift:"shift",meta:"meta",cmd:"meta",command:"meta",option:"alt",alt:"alt"},S=h.AllKeys=Object.assign({},o,y,v,b,O),n=Object.assign({},v,b),s={all:Object.keys(S),alphanumeric:Object.keys(n),numeric:Object.keys(v),alphabetic:Object.keys(b),function:Object.keys(O)};function a(r,u){var p=r.which||r.keyCode,_=r.type,g=Object.keys(I).filter(function(w){return r[w+"Key"]}).sort(),E=u.toLowerCase().trim(),V=E==="+"?["+"]:E.split(/\s?\+\s?/),C=V.pop(),L=S[C],T=V;if(_==="keypress")return u==String.fromCharCode(p).toLowerCase();if(T.length===0&&g.length===0)return L.indexOf(p)>=0;if(T.length>0&&g.length>0){var A=T.map(function(w){return I[w]}).sort(),F=A.length===g.length&&A.every(function(w,U){return g[U]===w});return L.indexOf(p)>=0&&F}return T.length==0&&g.length===1&&C===g[0]}}])})})(we);var mt=we.exports;const ht=Ue(mt),je=()=>{const e=N.useRef(null);return[e,()=>{e.current&&e.current.focus()}]},Pe=()=>{const[e,t]=N.useState(!1);return N.useEffect(()=>{(async()=>{document.fonts&&await document.fonts.ready.then(()=>t(!0))})()},[]),e};var yt=typeof performance=="object"&&typeof performance.now=="function",xe=yt?function(){return performance.now()}:function(){return Date.now()};function Te(e){cancelAnimationFrame(e.id)}function gt(e,t){var l=xe();function d(){xe()-l>=t?e.call(null):c.id=requestAnimationFrame(d)}var c={id:requestAnimationFrame(d)};return c}var oe=-1;function Ce(e){if(e===void 0&&(e=!1),oe===-1||e){var t=document.createElement("div"),l=t.style;l.width="50px",l.height="50px",l.overflow="scroll",document.body.appendChild(t),oe=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return oe}var Q=null;function Le(e){if(e===void 0&&(e=!1),Q===null||e){var t=document.createElement("div"),l=t.style;l.width="50px",l.height="50px",l.overflow="scroll",l.direction="rtl";var d=document.createElement("div"),c=d.style;return c.width="100px",c.height="100px",t.appendChild(d),document.body.appendChild(t),t.scrollLeft>0?Q="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?Q="negative":Q="positive-ascending"),document.body.removeChild(t),Q}return Q}var _t=150,bt=function(t,l){return t};function vt(e){var t,l=e.getItemOffset,d=e.getEstimatedTotalSize,c=e.getItemSize,h=e.getOffsetForIndexAndAlignment,f=e.getStartIndexForOffset,i=e.getStopIndexForStartIndex,o=e.initInstanceProps,y=e.shouldResetStyleCacheOnItemSizeChange,v=e.validateProps;return t=function(b){Ke(O,b);function O(S){var n;return n=b.call(this,S)||this,n._instanceProps=o(n.props,Ee(n)),n._outerRef=void 0,n._resetIsScrollingTimeoutId=null,n.state={instance:Ee(n),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof n.props.initialScrollOffset=="number"?n.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},n._callOnItemsRendered=void 0,n._callOnItemsRendered=ie(function(s,a,r,u){return n.props.onItemsRendered({overscanStartIndex:s,overscanStopIndex:a,visibleStartIndex:r,visibleStopIndex:u})}),n._callOnScroll=void 0,n._callOnScroll=ie(function(s,a,r){return n.props.onScroll({scrollDirection:s,scrollOffset:a,scrollUpdateWasRequested:r})}),n._getItemStyle=void 0,n._getItemStyle=function(s){var a=n.props,r=a.direction,u=a.itemSize,p=a.layout,_=n._getItemStyleCache(y&&u,y&&p,y&&r),g;if(_.hasOwnProperty(s))g=_[s];else{var E=l(n.props,s,n._instanceProps),V=c(n.props,s,n._instanceProps),C=r==="horizontal"||p==="horizontal",L=r==="rtl",T=C?E:0;_[s]=g={position:"absolute",left:L?void 0:T,right:L?T:void 0,top:C?0:E,height:C?"100%":V,width:C?V:"100%"}}return g},n._getItemStyleCache=void 0,n._getItemStyleCache=ie(function(s,a,r){return{}}),n._onScrollHorizontal=function(s){var a=s.currentTarget,r=a.clientWidth,u=a.scrollLeft,p=a.scrollWidth;n.setState(function(_){if(_.scrollOffset===u)return null;var g=n.props.direction,E=u;if(g==="rtl")switch(Le()){case"negative":E=-u;break;case"positive-descending":E=p-r-u;break}return E=Math.max(0,Math.min(E,p-r)),{isScrolling:!0,scrollDirection:_.scrollOffset<u?"forward":"backward",scrollOffset:E,scrollUpdateWasRequested:!1}},n._resetIsScrollingDebounced)},n._onScrollVertical=function(s){var a=s.currentTarget,r=a.clientHeight,u=a.scrollHeight,p=a.scrollTop;n.setState(function(_){if(_.scrollOffset===p)return null;var g=Math.max(0,Math.min(p,u-r));return{isScrolling:!0,scrollDirection:_.scrollOffset<g?"forward":"backward",scrollOffset:g,scrollUpdateWasRequested:!1}},n._resetIsScrollingDebounced)},n._outerRefSetter=function(s){var a=n.props.outerRef;n._outerRef=s,typeof a=="function"?a(s):a!=null&&typeof a=="object"&&a.hasOwnProperty("current")&&(a.current=s)},n._resetIsScrollingDebounced=function(){n._resetIsScrollingTimeoutId!==null&&Te(n._resetIsScrollingTimeoutId),n._resetIsScrollingTimeoutId=gt(n._resetIsScrolling,_t)},n._resetIsScrolling=function(){n._resetIsScrollingTimeoutId=null,n.setState({isScrolling:!1},function(){n._getItemStyleCache(-1,null)})},n}O.getDerivedStateFromProps=function(n,s){return St(n,s),v(n),null};var I=O.prototype;return I.scrollTo=function(n){n=Math.max(0,n),this.setState(function(s){return s.scrollOffset===n?null:{scrollDirection:s.scrollOffset<n?"forward":"backward",scrollOffset:n,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},I.scrollToItem=function(n,s){s===void 0&&(s="auto");var a=this.props,r=a.itemCount,u=a.layout,p=this.state.scrollOffset;n=Math.max(0,Math.min(n,r-1));var _=0;if(this._outerRef){var g=this._outerRef;u==="vertical"?_=g.scrollWidth>g.clientWidth?Ce():0:_=g.scrollHeight>g.clientHeight?Ce():0}this.scrollTo(h(this.props,n,s,p,this._instanceProps,_))},I.componentDidMount=function(){var n=this.props,s=n.direction,a=n.initialScrollOffset,r=n.layout;if(typeof a=="number"&&this._outerRef!=null){var u=this._outerRef;s==="horizontal"||r==="horizontal"?u.scrollLeft=a:u.scrollTop=a}this._callPropsCallbacks()},I.componentDidUpdate=function(){var n=this.props,s=n.direction,a=n.layout,r=this.state,u=r.scrollOffset,p=r.scrollUpdateWasRequested;if(p&&this._outerRef!=null){var _=this._outerRef;if(s==="horizontal"||a==="horizontal")if(s==="rtl")switch(Le()){case"negative":_.scrollLeft=-u;break;case"positive-ascending":_.scrollLeft=u;break;default:var g=_.clientWidth,E=_.scrollWidth;_.scrollLeft=E-g-u;break}else _.scrollLeft=u;else _.scrollTop=u}this._callPropsCallbacks()},I.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&Te(this._resetIsScrollingTimeoutId)},I.render=function(){var n=this.props,s=n.children,a=n.className,r=n.direction,u=n.height,p=n.innerRef,_=n.innerElementType,g=n.innerTagName,E=n.itemCount,V=n.itemData,C=n.itemKey,L=C===void 0?bt:C,T=n.layout,A=n.outerElementType,F=n.outerTagName,w=n.style,U=n.useIsScrolling,$=n.width,P=this.state.isScrolling,z=r==="horizontal"||T==="horizontal",te=z?this._onScrollHorizontal:this._onScrollVertical,B=this._getRangeToRender(),ne=B[0],re=B[1],X=[];if(E>0)for(var M=ne;M<=re;M++)X.push(N.createElement(s,{data:V,key:L(M,V),index:M,isScrolling:U?P:void 0,style:this._getItemStyle(M)}));var J=d(this.props,this._instanceProps);return N.createElement(A||F||"div",{className:a,onScroll:te,ref:this._outerRefSetter,style:Ye({position:"relative",height:u,width:$,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:r},w)},N.createElement(_||g||"div",{children:X,ref:p,style:{height:z?"100%":J,pointerEvents:P?"none":void 0,width:z?J:"100%"}}))},I._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var n=this.props.itemCount;if(n>0){var s=this._getRangeToRender(),a=s[0],r=s[1],u=s[2],p=s[3];this._callOnItemsRendered(a,r,u,p)}}if(typeof this.props.onScroll=="function"){var _=this.state,g=_.scrollDirection,E=_.scrollOffset,V=_.scrollUpdateWasRequested;this._callOnScroll(g,E,V)}},I._getRangeToRender=function(){var n=this.props,s=n.itemCount,a=n.overscanCount,r=this.state,u=r.isScrolling,p=r.scrollDirection,_=r.scrollOffset;if(s===0)return[0,0,0,0];var g=f(this.props,_,this._instanceProps),E=i(this.props,g,_,this._instanceProps),V=!u||p==="backward"?Math.max(1,a):1,C=!u||p==="forward"?Math.max(1,a):1;return[Math.max(0,g-V),Math.max(0,Math.min(s-1,E+C)),g,E]},O}(N.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var St=function(t,l){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,l.instance},It=vt({getItemOffset:function(t,l){var d=t.itemSize;return l*d},getItemSize:function(t,l){var d=t.itemSize;return d},getEstimatedTotalSize:function(t){var l=t.itemCount,d=t.itemSize;return d*l},getOffsetForIndexAndAlignment:function(t,l,d,c,h,f){var i=t.direction,o=t.height,y=t.itemCount,v=t.itemSize,b=t.layout,O=t.width,I=i==="horizontal"||b==="horizontal",S=I?O:o,n=Math.max(0,y*v-S),s=Math.min(n,l*v),a=Math.max(0,l*v-S+v+f);switch(d==="smart"&&(c>=a-S&&c<=s+S?d="auto":d="center"),d){case"start":return s;case"end":return a;case"center":{var r=Math.round(a+(s-a)/2);return r<Math.ceil(S/2)?0:r>n+Math.floor(S/2)?n:r}case"auto":default:return c>=a&&c<=s?c:c<a?a:s}},getStartIndexForOffset:function(t,l){var d=t.itemCount,c=t.itemSize;return Math.max(0,Math.min(d-1,Math.floor(l/c)))},getStopIndexForStartIndex:function(t,l,d){var c=t.direction,h=t.height,f=t.itemCount,i=t.itemSize,o=t.layout,y=t.width,v=c==="horizontal"||o==="horizontal",b=l*i,O=v?y:h,I=Math.ceil((O+d-b)/i);return Math.max(0,Math.min(f-1,l+I-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){t.itemSize}});const Ot="_layerContainer_8ackd_1",Et="_layer_8ackd_1",xt="_small_8ackd_23",Tt="_heading_8ackd_26",Ct="_option_8ackd_27",Lt="_message_8ackd_28",Vt="_focused_8ackd_64",Rt="_selected_8ackd_68",qt="_disabled_8ackd_71",Nt="_check_8ackd_75",Ft="_optionContent_8ackd_92",At="_label_8ackd_97",wt="_icon_8ackd_104",jt="_details_8ackd_109",j={layerContainer:Ot,layer:Et,small:xt,heading:Tt,option:Ct,message:Lt,focused:Vt,selected:Rt,disabled:qt,check:Nt,optionContent:Ft,label:At,icon:wt,details:jt},de=({label:e})=>m.jsx("div",{onClick:t=>t.stopPropagation(),className:j.heading,children:e});try{de.displayName="Heading",de.__docgenInfo={description:"",displayName:"Heading",props:{label:{defaultValue:null,description:"",name:"label",required:!0,type:{name:"TStringOrNumber"}}}}}catch{}const pe=({details:e,label:t,icon:l,disabled:d=!1,selected:c=!1,focused:h=!1,onSelectOption:f,actions:i,closeLayer:o,testId:y})=>m.jsxs("div",{className:D(j.option,d?j.disabled:"",c?j.selected:"",h?j.focused:""),onClick:!d&&f?f:void 0,"data-testid":y,children:[m.jsx("div",{className:j.optionContent,children:m.jsxs("span",{className:j.label,title:t,children:[t,l&&m.jsx("span",{className:j.icon,children:l})]})}),e&&m.jsx("div",{className:D(j.details),children:m.jsx(se,{faint:!0,children:e})}),!!(i!=null&&i.length)&&m.jsx("div",{className:D(j.actions),children:m.jsx(Be,{actions:i,closeLayer:o})}),m.jsx("span",{className:j.check,children:c?m.jsx(ue,{icon:Ae.CHECK}):null})]});try{pe.displayName="Option",pe.__docgenInfo={description:"",displayName:"Option",props:{details:{defaultValue:null,description:"",name:"details",required:!1,type:{name:"string"}},label:{defaultValue:null,description:"",name:"label",required:!0,type:{name:"string"}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"ReactNode"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},selected:{defaultValue:{value:"false"},description:"",name:"selected",required:!1,type:{name:"boolean"}},focused:{defaultValue:{value:"false"},description:"",name:"focused",required:!1,type:{name:"boolean"}},onSelectOption:{defaultValue:null,description:"",name:"onSelectOption",required:!1,type:{name:"((event?: MouseEvent<HTMLDivElement, MouseEvent>, section?: ISelectSectionProps) => void) | undefined"}},actions:{defaultValue:null,description:"",name:"actions",required:!1,type:{name:"any[]"}},closeLayer:{defaultValue:null,description:"",name:"closeLayer",required:!1,type:{name:"TEmpty"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const fe=({section:e,selected:t,focused:l,onSelectOption:d,closeLayer:c})=>{const h=N.useContext(Se);switch(e.type){case ae.HEADING:return m.jsx(de,{label:e.label});case ae.OPTION:default:return m.jsx(pe,{closeLayer:c,actions:e.actions,label:e.label,details:e.details,icon:e.icon,disabled:e.disabled||h,selected:t,focused:l,onSelectOption:d,testId:e.testId})}};try{fe.displayName="Section",fe.__docgenInfo={description:"",displayName:"Section",props:{section:{defaultValue:null,description:"",name:"section",required:!0,type:{name:"ISelectSection"}},selected:{defaultValue:null,description:"",name:"selected",required:!1,type:{name:"boolean"}},focused:{defaultValue:null,description:"",name:"focused",required:!1,type:{name:"boolean"}},onSelectOption:{defaultValue:null,description:"",name:"onSelectOption",required:!1,type:{name:"((event?: MouseEvent<HTMLDivElement, MouseEvent>, section?: ISelectSectionProps) => void) | undefined"}},closeLayer:{defaultValue:null,description:"",name:"closeLayer",required:!1,type:{name:"TEmpty"}}}}}catch{}const me=(e,t)=>{const d=document.createElement("canvas").getContext("2d");return d?(d.font=t,d.measureText(e).width):0},ke="14px",Me="12px",Pt="Lato",kt="sans-serif",Mt=14,Ht=7,Wt=38,Dt=24,Ut=5,zt=3,Gt=1,$t=2,Ve=10,He=(e=!1,t=!1)=>`${e?Me:ke} ${t?Pt:kt}`,Kt=(e=!1,t=!1)=>(e?Ht:Mt)+(e?Dt:Wt)+(t?17:0),Re=(e,t,l,d)=>{const c=He(t,l),h=d?me(d,c):0,f=Math.ceil(e.reduce((o,y)=>{var S;const v=(((S=y==null?void 0:y.actions)==null?void 0:S.length)??0)*24,b=y.icon?parseInt(t?Me:ke)+7:0,O=`${y.label} ${y.details||""}`,I=me(O,c)+v+b;return o=I>o?I:o,o},h)),i=Kt(t,!0);return f+i},Yt=(e,t,l)=>{const d=He(!0,l),c=me(e.label,d),h=(t?zt:Ut)*2+Gt*2+$t;return Math.ceil(c+h)},he=({listRef:e,isMulti:t,sections:l,selectedOptions:d,onSelectOption:c,focusedOptionIndex:h,width:f,small:i,firstSelectedOptionIndex:o,closeLayer:y,testId:v})=>{N.useEffect(()=>{o&&o!==null&&e.current!==null&&e.current.scrollToItem(o,"start")},[o,e]);const b=i?24:30;return m.jsx("div",{"data-testid":v,className:D(j.layer,i&&j.small),children:l.length?m.jsx(It,{ref:e,height:l.length<Ve?b*l.length:b*Ve,itemCount:l.length,itemSize:b,width:f,children:({index:O,style:I})=>{var S;return m.jsx("div",{style:I,children:m.jsx(fe,{closeLayer:y,section:l[O],selected:t&&l[O].type!==ae.HEADING&&Array.isArray(d)?d.some(n=>{var s;return n&&(n==null?void 0:n.value)===((s=l==null?void 0:l[O])==null?void 0:s.value)}):!Array.isArray(d)&&((S=l==null?void 0:l[O])==null?void 0:S.value)===(d==null?void 0:d.value),focused:h===O,onSelectOption:n=>c(n,l[O])})})}}):m.jsx("ul",{children:m.jsx("li",{children:m.jsx("div",{className:j.message,style:{width:f},children:"No matches"})})})})};try{he.displayName="Layer",he.__docgenInfo={description:"",displayName:"Layer",props:{listRef:{defaultValue:null,description:"",name:"listRef",required:!0,type:{name:"RefObject<any>"}},isMulti:{defaultValue:null,description:"",name:"isMulti",required:!1,type:{name:"boolean"}},sections:{defaultValue:null,description:"",name:"sections",required:!0,type:{name:"ISelectSection[]"}},selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!0,type:{name:"ISelectSelectedOption | ISelectSelectedOption[]"}},onSelectOption:{defaultValue:null,description:"",name:"onSelectOption",required:!0,type:{name:"(event?: MouseEvent<HTMLDivElement, MouseEvent> | undefined, section?: ISelectSection | undefined) => void"}},focusedOptionIndex:{defaultValue:null,description:"",name:"focusedOptionIndex",required:!1,type:{name:"number"}},width:{defaultValue:null,description:"",name:"width",required:!0,type:{name:"number"}},small:{defaultValue:null,description:"",name:"small",required:!1,type:{name:"boolean"}},firstSelectedOptionIndex:{defaultValue:null,description:"",name:"firstSelectedOptionIndex",required:!1,type:{name:"number"}},closeLayer:{defaultValue:null,description:"",name:"closeLayer",required:!0,type:{name:"TEmpty"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const Bt="_inputInTable_1n7ro_1",Xt="_inputHover_1n7ro_13",Jt="_inputFocus_1n7ro_18",Zt="_inputError_1n7ro_25",Qt="_inputWarning_1n7ro_26",en="_inputDisabled_1n7ro_61",tn="_hideScrollbars_1n7ro_67",nn="_trigger_1n7ro_77",rn="_isInTable_1n7ro_93",ln="_input_1n7ro_1",an="_isOpen_1n7ro_114",on="_error_1n7ro_122",sn="_warning_1n7ro_139",un="_disabled_1n7ro_156",cn="_icons_1n7ro_162",dn="_clearAll_1n7ro_169",pn="_iconOpen_1n7ro_170",fn="_small_1n7ro_181",mn="_triggerInputContainer_1n7ro_189",hn="_right_1n7ro_198",yn="_multiOptions_1n7ro_211",gn="_multiOption_1n7ro_211",_n="_label_1n7ro_239",bn="_closeMultiOption_1n7ro_242",vn="_focus_1n7ro_253",Sn="_selectedSingleValue_1n7ro_257",In="_placeHolder_1n7ro_258",On="_groupOrderFirst_1n7ro_297",En="_groupOrderMiddle_1n7ro_298",xn="_groupOrderLast_1n7ro_302",Tn="_detailedLabel_1n7ro_307",q={inputInTable:Bt,inputHover:Xt,inputFocus:Jt,inputError:Zt,inputWarning:Qt,inputDisabled:en,hideScrollbars:tn,trigger:nn,isInTable:rn,input:ln,isOpen:an,error:on,warning:sn,disabled:un,icons:cn,clearAll:dn,iconOpen:pn,small:fn,triggerInputContainer:mn,right:hn,multiOptions:yn,multiOption:gn,label:_n,closeMultiOption:bn,focus:vn,selectedSingleValue:Sn,placeHolder:In,groupOrderFirst:On,groupOrderMiddle:En,groupOrderLast:xn,detailedLabel:Tn},ye=({selectedOptions:e,small:t,width:l})=>{const d=Pe(),[c,h]=N.useState([]),[f,i]=N.useState([]);return N.useEffect(()=>{let o=[],y=[],v=0;e.forEach((b,O)=>{v+=Yt(b,t,d),O===e.length-1&&v<l||v<l-24?o.push(b):y.push(b)}),h(o),i(y)},[e,d,l]),m.jsxs("div",{className:q.multiOptions,children:[c.filter(o=>o&&o.label).map((o,y)=>m.jsx("span",{className:q.multiOption,onClick:v=>{v.stopPropagation()},children:o.label},y)),f.length>0&&m.jsx(Ie,{text:f.map((o,y)=>m.jsx("div",{children:o.label},y)),display:"inline-flex",children:m.jsx("span",{className:q.multiOption,children:c.length?`+${f.length}`:`${f.length} items`})})]})};try{ye.displayName="MultiSelectedOptions",ye.__docgenInfo={description:"",displayName:"MultiSelectedOptions",props:{selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!0,type:{name:"ISelectSelectedOption[]"}},small:{defaultValue:null,description:"",name:"small",required:!1,type:{name:"boolean"}},width:{defaultValue:null,description:"",name:"width",required:!0,type:{name:"number"}}}}}catch{}const ge=({selectedOptions:e,searchable:t=!1,searchValue:l,onChange:d=()=>{},inputRef:c,error:h,placeholder:f="Select...",small:i})=>{const o=N.useRef(null),y=Array.isArray(e),v=y?e.length>0:!!e,b=l?l.length+1:1,O=()=>{var n,s;const I=((n=o.current)==null?void 0:n.offsetWidth)||0,S=((s=c.current)==null?void 0:s.offsetWidth)||0;return I-S};return m.jsxs("div",{className:q.triggerInputContainer,ref:o,children:[v?y?m.jsx(ye,{selectedOptions:e,small:i,width:O()}):m.jsx("span",{className:q.selectedSingleValue,children:l!=null&&l.length?"":e==null?void 0:e.label}):m.jsx("span",{className:q.placeHolder,children:l!=null&&l.length?"":f}),t?m.jsx("input",{tabIndex:-1,ref:c,size:b,className:D(q.input,h?q.error:""),value:l,onChange:I=>d(I.target.value)}):null]})};try{ge.displayName="Input",ge.__docgenInfo={description:"",displayName:"Input",props:{selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!1,type:{name:"ISelectSelectedOption | ISelectSelectedOption[]"}},searchable:{defaultValue:{value:"false"},description:"",name:"searchable",required:!1,type:{name:"boolean"}},searchValue:{defaultValue:null,description:"",name:"searchValue",required:!1,type:{name:"string"}},inputRef:{defaultValue:null,description:"",name:"inputRef",required:!0,type:{name:"MutableRefObject<HTMLInputElement | null>"}},onChange:{defaultValue:{value:"() => {}"},description:"",name:"onChange",required:!1,type:{name:"((value: string) => void)"}},error:{defaultValue:null,description:"",name:"error",required:!1,type:{name:"ReactNode"}},placeholder:{defaultValue:{value:"Select..."},description:"",name:"placeholder",required:!1,type:{name:"string | null"}},small:{defaultValue:null,description:"",name:"small",required:!1,type:{name:"boolean"}}}}}catch{}const _e=({selectedOptions:e,searchValue:t,searchable:l,clearable:d,onClickTrigger:c,element:h,error:f,warning:i,tooltip:o,small:y,isInTable:v,disabled:b,onChangeSearch:O,onClickDeselect:I,onClickClear:S,tabIndex:n,isOpen:s,triggerRef:a,clearAllIsFocused:r,focusedSelectedOptionIndex:u,onFocus:p,onBlur:_,groupOrder:g,maxTooltipWidth:E,placeholder:V,right:C,testId:L})=>{const[T,A]=je(),F=d&&e&&e.value,w=(()=>{if(g)switch(g){case le.FIRST:return q.groupOrderFirst;case le.LAST:return q.groupOrderLast;default:return q.groupOrderMiddle}return""})(),U=e!=null&&e.details?{...e,label:m.jsxs("div",{className:D(q.detailedLabel),children:[m.jsx(se,{children:e.label}),m.jsx(se,{muted:!0,children:e.details})]})}:e,$=m.jsxs(m.Fragment,{children:[h,m.jsxs("div",{ref:a,tabIndex:n,className:D(q.trigger,s?q.isOpen:"",f?q.error:i?q.warning:"",b?q.disabled:"",y?q.small:"",v?q.isInTable:"",C?q.right:"",w),onClick:P=>{P.stopPropagation(),typeof A=="function"&&A(),c(P)},onFocus:p,onBlur:_,"data-testid":L,children:[m.jsx(ge,{selectedOptions:U,placeholder:V,searchable:l,searchValue:t,inputRef:T,onChange:O,error:f,small:y}),m.jsx("span",{className:q.icons,children:F?m.jsx("span",{className:D(q.clearAll,r?q.focus:""),onClick:P=>{P.stopPropagation(),S&&S(P)},children:m.jsx(ue,{icon:Ae.CLOSE})}):m.jsx("span",{className:D(q.iconOpen),children:m.jsx(ue,{icon:"chevron down"})})})]})]});return m.jsx(m.Fragment,{children:m.jsx(Ie,{error:!!f,warning:!!i,text:o||f||i,enabled:o&&ee(o)||f&&ee(f)||i&&ee(i)||!1,maxWidth:E,placement:"bottom-center",children:$})})};try{_e.displayName="Trigger",_e.__docgenInfo={description:"",displayName:"Trigger",props:{selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!1,type:{name:"ISelectSelectedOption"}},searchValue:{defaultValue:null,description:"",name:"searchValue",required:!1,type:{name:"string"}},searchable:{defaultValue:null,description:"",name:"searchable",required:!1,type:{name:"boolean"}},clearable:{defaultValue:null,description:"",name:"clearable",required:!1,type:{name:"boolean"}},onClickTrigger:{defaultValue:null,description:"",name:"onClickTrigger",required:!0,type:{name:"(evt: MouseEvent<HTMLDivElement, MouseEvent>) => void"}},element:{defaultValue:null,description:"",name:"element",required:!1,type:{name:"ReactNode"}},error:{defaultValue:null,description:"",name:"error",required:!1,type:{name:"ReactNode"}},warning:{defaultValue:null,description:"",name:"warning",required:!1,type:{name:"ReactNode"}},tooltip:{defaultValue:null,description:"",name:"tooltip",required:!1,type:{name:"ReactNode"}},small:{defaultValue:null,description:"",name:"small",required:!1,type:{name:"boolean"}},isInTable:{defaultValue:null,description:"",name:"isInTable",required:!1,type:{name:"boolean"}},disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"boolean"}},onChangeSearch:{defaultValue:null,description:"",name:"onChangeSearch",required:!1,type:{name:"((value: string) => void)"}},onClickDeselect:{defaultValue:null,description:"",name:"onClickDeselect",required:!1,type:{name:"((evt: MouseEvent<HTMLDivElement, MouseEvent>) => void)"}},onClickClear:{defaultValue:null,description:"",name:"onClickClear",required:!1,type:{name:"((evt: MouseEvent<HTMLSpanElement, MouseEvent>) => void)"}},tabIndex:{defaultValue:null,description:"",name:"tabIndex",required:!1,type:{name:"number"}},isOpen:{defaultValue:null,description:"",name:"isOpen",required:!1,type:{name:"boolean"}},triggerRef:{defaultValue:null,description:"",name:"triggerRef",required:!1,type:{name:"RefObject<HTMLDivElement>"}},clearAllIsFocused:{defaultValue:null,description:"",name:"clearAllIsFocused",required:!1,type:{name:"boolean"}},focusedSelectedOptionIndex:{defaultValue:null,description:"",name:"focusedSelectedOptionIndex",required:!1,type:{name:"number"}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"((evt: FocusEvent<HTMLDivElement, Element>) => void)"}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"((evt: FocusEvent<HTMLDivElement, Element>) => void)"}},groupOrder:{defaultValue:null,description:"",name:"groupOrder",required:!1,type:{name:"string"}},maxTooltipWidth:{defaultValue:null,description:"",name:"maxTooltipWidth",required:!1,type:{name:"TStringOrNumber"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string | null"}},right:{defaultValue:null,description:"",name:"right",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}var W=(e=>(e.SET_VISIBLE_OPTIONS="SET_VISIBLE_OPTIONS",e.RESET_LAYER_FOCUS="RESET_LAYER_FOCUS",e.CLEAR_SEARCH="CLEAR_SEARCH",e.ON_CHANGE_SEARCH="ON_CHANGE_SEARCH",e.FOCUS_TRIGGER_INPUTS="FOCUS_TRIGGER_INPUTS",e.BLUR_TRIGGER_INPUTS="BLUR_TRIGGER_INPUTS",e.FOCUS_LAYER_OPTIONS="FOCUS_LAYER_OPTIONS",e.OPEN_LAYER="OPEN_LAYER",e.CLOSE_LAYER="CLOSE_LAYER",e))(W||{});const We={options:["none","clearAll"],currentIndex:0,currentOption:!1,clearAll:!1},Cn=e=>e!==null?e+1:0,De=(e,t)=>{const l=["none",...e.map((c,h)=>c.type!==ae.HEADING?h:null).filter(c=>c!==null)],d=Cn(t);return{options:l,currentIndex:d,current:l[d]}},Ln=(e,t)=>{const l=e==="up"?-1:1,d=t.currentIndex+l,c=(d<0?t.options.length-1:d)%t.options.length,h=t.options[c];return{...t,currentIndex:c,current:h}},Vn=(e,t,l)=>{const d=e==="left"?-1:1,c=t&&t.length?["none",...Array.from({length:t.length},(y,v)=>v),"clearAll"]:["none","clearAll"],h=l.currentIndex+d,f=(h<0?c.length-1:h)%c.length,i=c[f];return{options:c,currentIndex:f,currentOption:i,clearAll:i==="clearAll"}},qe=()=>We,Ne=e=>({...e,currentIndex:0,current:"none"}),Rn=(e,t)=>{switch(t.type){case W.SET_VISIBLE_OPTIONS:return{...e,visibleOptions:t.options||[]};case W.RESET_LAYER_FOCUS:return{...e,layerFocus:De(t.options||[],t.firstSelectedOptionIndex||0)};case W.CLEAR_SEARCH:return{...e,visibleOptions:t.options||[],searchValue:""};case W.ON_CHANGE_SEARCH:{let d=[...(t.options||[]).filter(c=>(String(c.label)+(c.details?String(c.details):"")).toLowerCase().includes(String(t.value||"").toLowerCase()))];return t.createAble&&t.value&&t.value!==""&&d.push({label:`Create "${t.value}"`,value:t.value,createAble:!0}),{...e,searchValue:t.value,visibleOptions:d,layerFocus:Ne(e.layerFocus)}}case W.FOCUS_TRIGGER_INPUTS:return{...e,triggerFocus:Vn(t.direction||"right",t.selectedOptions||[],e.triggerFocus),layerFocus:Ne(e.layerFocus)};case W.BLUR_TRIGGER_INPUTS:return{...e,triggerFocus:qe()};case W.FOCUS_LAYER_OPTIONS:return t.nextLayerFocus?{...e,layerFocus:t.nextLayerFocus,triggerFocus:qe()}:e;case W.OPEN_LAYER:return{...e,isLayerOpen:!0};case W.CLOSE_LAYER:return{...e,isLayerOpen:!1};default:return e}},qn={auto:!0,possiblePlacements:["bottom-start","top-start"],placement:"bottom-start",preferX:"right",preferY:"bottom"};var k=(e=>(e.CLOSE_LAYER="CLOSE_LAYER",e.OPEN_LAYER="OPEN_LAYER",e.SET_VISIBLE_OPTIONS="SET_VISIBLE_OPTIONS",e.CLEAR_SEARCH="CLEAR_SEARCH",e.RESET_LAYER_FOCUS="RESET_LAYER_FOCUS",e.FOCUS_LAYER_OPTIONS="FOCUS_LAYER_OPTIONS",e.BLUR_TRIGGER_INPUTS="BLUR_TRIGGER_INPUTS",e.FOCUS_TRIGGER_INPUTS="FOCUS_TRIGGER_INPUTS",e.ON_CHANGE_SEARCH="ON_CHANGE_SEARCH",e))(k||{}),G=(e=>(e.RIGHT="right",e.LEFT="left",e.UP="up",e.DOWN="down",e.ENTER="enter",e.ESC="esc",e.TAB="tab",e))(G||{});const be=({state:e,dispatch:t,options:l,setTriggerFocus:d,disabled:c,disabledContext:h,onCreate:f,onChange:i,selectedOptions:o,width:y,small:v,isFontLoaded:b,placeholder:O,firstSelectedOptionIndex:I,createAble:S,listRef:n,autoLayerWidth:s})=>{const a=()=>{e.isLayerOpen&&t({type:k.CLOSE_LAYER}),d()},r=()=>t({type:k.OPEN_LAYER}),u=N.useRef(!0);N.useEffect(()=>{u.current?u.current=!1:t({type:k.SET_VISIBLE_OPTIONS,options:l})},[l]);const p=(x,R,Z)=>{if(!(c||h)){if(Z&&Z(),R){if(R.createAble&&f)f(R.value);else if(!R.disabled)if(Array.isArray(o))if(o.some(Y=>Y.label===R.label)){const Y=o.filter(Oe=>Oe.label!==R.label);i&&i(x,Y)}else{const Y=[...o,R];i&&i(x,Y)}else i&&i(x,R)}t({type:k.CLEAR_SEARCH,options:l}),d()}},_=N.useCallback(()=>y?y!=="auto"?y:Re(l,v,b,O):"100%",[l,b]),g=N.useCallback(x=>s?Math.max(Re(l,v,b,O),x==null?void 0:x.width):x==null?void 0:x.width,[l,b]),{renderLayer:E,layerProps:V,triggerProps:C,triggerBounds:L}=ze({isOpen:(e==null?void 0:e.isLayerOpen)??!1,overflowContainer:!0,...qn,ResizeObserver,onOutsideClick:a,onParentClose:a}),T=()=>{if(!(c||h)){if(e.isLayerOpen){a();return}t({type:k.RESET_LAYER_FOCUS,options:l,firstSelectedOptionIndex:I}),r()}},A=N.useRef(!0);N.useEffect(()=>{A.current?A.current=!1:e.isLayerOpen||t({type:k.CLEAR_SEARCH,options:l})},[e.isLayerOpen]);const F=(x,R)=>{const Z=o instanceof Array?o.filter(K=>K.value!==R.value):null;i&&i(x,Z)},w=x=>{const R=o instanceof Array?[]:{value:null};i&&i(x,R)},U=x=>t({type:k.ON_CHANGE_SEARCH,options:l,value:x,createAble:S}),$=()=>{r(),t({type:k.BLUR_TRIGGER_INPUTS})},P=x=>{n.current&&Number.isInteger(x)&&n.current.scrollToItem(x)},z=x=>{const R=Ln(x,e.layerFocus);t({type:k.FOCUS_LAYER_OPTIONS,nextLayerFocus:R}),P(R.current)},te=x=>{t({type:k.FOCUS_TRIGGER_INPUTS,ICustomSelectDirection:x,selectedOptions:o})},B=x=>w(x),ne=o&&o[e.triggerFocus.currentOption],re=x=>{F(x,o[e.triggerFocus.currentOption])},X=x=>{var R;p(x,(R=e==null?void 0:e.visibleOptions)==null?void 0:R[e.layerFocus.current],a)},M=e.triggerFocus.clearAll;return{getTriggerWidth:_,onKeyEvent:(x,R)=>{switch(x){case G.UP:{z(x);break}case G.DOWN:{e.isLayerOpen?z(x):$();break}case G.LEFT:case G.RIGHT:{te(x);break}case G.ENTER:{M?B(R):ne?re(R):X(R);break}case G.ESC:{a();break}}},clearAllIsFocused:M,triggerProps:C,onClickTrigger:T,onChangeSearch:U,onClickDeselectOption:F,onClickClearAll:w,renderLayer:E,layerProps:V,closeLayer:a,onSelectOption:p,getLayerWidth:g,triggerBounds:L}};try{be.displayName="useCustomSelectLogic",be.__docgenInfo={description:"",displayName:"useCustomSelectLogic",props:{state:{defaultValue:null,description:"",name:"state",required:!0,type:{name:"ICustomSelectState"}},dispatch:{defaultValue:null,description:"",name:"dispatch",required:!0,type:{name:"(action: any) => void"}},options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"TCustomSelectSelectOption[]"}},setTriggerFocus:{defaultValue:null,description:"",name:"setTriggerFocus",required:!0,type:{name:"TEmpty"}},disabled:{defaultValue:null,description:"",name:"disabled",required:!0,type:{name:"boolean"}},disabledContext:{defaultValue:null,description:"",name:"disabledContext",required:!0,type:{name:"boolean"}},onCreate:{defaultValue:null,description:"",name:"onCreate",required:!0,type:{name:"((value: string) => void) | null"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!0,type:{name:"((evt: any, selected: any) => void) | null"}},selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!0,type:{name:"ISelectSelectedOption | ISelectSelectedOption[]"}},width:{defaultValue:null,description:"",name:"width",required:!0,type:{name:"TStringOrNumber | null"}},small:{defaultValue:null,description:"",name:"small",required:!0,type:{name:"boolean"}},isFontLoaded:{defaultValue:null,description:"",name:"isFontLoaded",required:!0,type:{name:"boolean"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!0,type:{name:"string"}},firstSelectedOptionIndex:{defaultValue:null,description:"",name:"firstSelectedOptionIndex",required:!0,type:{name:"number"}},createAble:{defaultValue:null,description:"",name:"createAble",required:!0,type:{name:"boolean"}},listRef:{defaultValue:null,description:"",name:"listRef",required:!0,type:{name:"RefObject<any>"}},autoLayerWidth:{defaultValue:null,description:"",name:"autoLayerWidth",required:!0,type:{name:"boolean"}}}}}catch{}const ve=e=>{const{multi:t=!1,disabled:l=!1,error:d=null,warning:c=null,tooltip:h=null,options:f,selectedOptions:i,onCreate:o=null,placeholder:y="",small:v=!1,tabIndex:b=0,onFocus:O=()=>{},onBlur:I=()=>{},searchable:S=!0,clearable:n=!1,maxTooltipWidth:s,closeOnOptionActionClick:a,isInTable:r=!1,groupOrder:u,firstSelectedOptionIndex:p=0,right:_=!1,testId:g=void 0}=e,E=N.useContext(Se),V=o!==null,C=N.useRef(null),[L,T]=je(),A=Pe(),[F,w]=N.useReducer(Rn,{options:f,firstSelectedOptionIndex:p},({options:K})=>({searchValue:"",visibleOptions:K,layerFocus:De(K,p??0),triggerFocus:We,isLayerOpen:!1})),{getTriggerWidth:U,onKeyEvent:$,clearAllIsFocused:P,triggerProps:z,onClickTrigger:te,onChangeSearch:B,onClickDeselectOption:ne,onClickClearAll:re,renderLayer:X,layerProps:M,closeLayer:J,onSelectOption:x,getLayerWidth:R,triggerBounds:Z}=be({...e,state:F,dispatch:w,setTriggerFocus:T,disabledContext:E,isFontLoaded:A,createAble:V,listRef:C});return m.jsx("div",{style:{width:U()},children:m.jsxs(ht,{handleKeys:Object.values(G),onKeyEvent:$,children:[m.jsx(_e,{selectedOptions:i,searchValue:F.searchValue,isOpen:F.isLayerOpen,focusedSelectedOptionIndex:F.triggerFocus.currentOption,clearAllIsFocused:P,searchable:S,triggerRef:Ge(L,z.ref),error:d,warning:c,tooltip:h,small:v,isInTable:r,disabled:l||E,clearable:n,tabIndex:b,onClickTrigger:te,onChangeSearch:B,onClickDeselect:ne,onClickClear:re,onFocus:O,onBlur:I,groupOrder:u,maxTooltipWidth:s,placeholder:y,right:_,testId:g}),F.isLayerOpen&&X(m.jsx("div",{...M,className:j.layerContainer,children:m.jsx(he,{listRef:C,isMulti:t,sections:F.visibleOptions,selectedOptions:i,onSelectOption:(K,Y)=>{x(K,Y,t?void 0:J)},closeLayer:()=>{a&&J()},width:R(Z),small:v,focusedOptionIndex:F.layerFocus.current,firstSelectedOptionIndex:p??0,testId:g&&`${g}-layer`})}))]})})};try{ve.displayName="CustomSelect",ve.__docgenInfo={description:"",displayName:"CustomSelect",props:{multi:{defaultValue:null,description:"",name:"multi",required:!1,type:{name:"boolean"}},disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"boolean"}},error:{defaultValue:null,description:"",name:"error",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},warning:{defaultValue:null,description:"",name:"warning",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},tooltip:{defaultValue:null,description:"",name:"tooltip",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},options:{defaultValue:null,description:"",name:"options",required:!0,type:{name:"TCustomSelectSelectOption[]"}},selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!0,type:{name:"ISelectSelectedOption | ISelectSelectedOption[]"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((evt: ChangeEvent<HTMLInputElement>, newSelectedOptions: ISelectSelectedOption) => void)"}},onCreate:{defaultValue:null,description:"",name:"onCreate",required:!1,type:{name:"((value: string) => void)"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string | null"}},small:{defaultValue:null,description:"",name:"small",required:!1,type:{name:"boolean"}},tabIndex:{defaultValue:null,description:"",name:"tabIndex",required:!1,type:{name:"number"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber | null"}},autoLayerWidth:{defaultValue:null,description:"",name:"autoLayerWidth",required:!1,type:{name:"boolean"}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"TEmpty"}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"TEmpty"}},searchable:{defaultValue:null,description:"",name:"searchable",required:!1,type:{name:"boolean"}},clearable:{defaultValue:null,description:"",name:"clearable",required:!1,type:{name:"boolean"}},isInTable:{defaultValue:null,description:"",name:"isInTable",required:!1,type:{name:"boolean"}},groupOrder:{defaultValue:null,description:"",name:"groupOrder",required:!1,type:{name:"string"}},firstSelectedOptionIndex:{defaultValue:null,description:"",name:"firstSelectedOptionIndex",required:!0,type:{name:"number | null"}},right:{defaultValue:null,description:"",name:"right",required:!1,type:{name:"boolean"}},maxTooltipWidth:{defaultValue:null,description:"",name:"maxTooltipWidth",required:!1,type:{name:"TStringOrNumber"}},closeOnOptionActionClick:{defaultValue:null,description:"",name:"closeOnOptionActionClick",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const Fe=e=>{const{name:t="",options:l=[],value:d,native:c=!1,onChange:h=()=>{},deprecatedEventHandler:f=!1,autoScroll:i=!0,warning:o,error:y,checkNonExistentValues:v=!0,closeOnOptionActionClick:b=!0,testId:O}=e,I=!c&&i===!0,{multi:S,simpleInputs:n,options:s,selectedOptions:a,firstSelectedOptionIndex:r,hasNonExistentValue:u}=Xe(l,d,I,v),p=!S,_=c&&p;c&&!p&&console.warn("Native select does not support provided props (see stories)");const g="Value no longer available for re-selection",E=u?o?m.jsxs("div",{children:[m.jsx("div",{children:g}),m.jsx("div",{children:o})]}):g:o,V=u&&y?m.jsxs("div",{children:[m.jsx("div",{children:g}),m.jsx("div",{children:y})]}):y,C=(L,T)=>{if(f){const A=S?T.map(F=>n?F.value:F):n?T.value:T;h(A)}else{const A=!(L instanceof Event),F=S?T:T.value;A?(L.target.name=t,L.target.value=F,S||(L.target.label=T.label),h(L)):h({...L,target:{...L.target,name:t,value:F,...!S&&{label:T.label}}})}};return _?m.jsx(ce,{...e,options:s,selectedOption:a,onChange:C,hasNonExistentValue:u,warning:E,error:V,testId:O}):m.jsx(ve,{...e,options:s,selectedOptions:a,onChange:C,multi:S,firstSelectedOptionIndex:r,warning:E,error:V,testId:O,closeOnOptionActionClick:b})};try{Fe.displayName="Select",Fe.__docgenInfo={description:"",displayName:"Select",props:{name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},multi:{defaultValue:null,description:"",name:"multi",required:!1,type:{name:"boolean"}},options:{defaultValue:null,description:"",name:"options",required:!1,type:{name:"ISelectSelectedOption[]"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"any"}},native:{defaultValue:null,description:"",name:"native",required:!1,type:{name:"boolean"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"((value: any) => void)"}},deprecatedEventHandler:{defaultValue:null,description:"",name:"deprecatedEventHandler",required:!1,type:{name:"boolean"}},autoScroll:{defaultValue:null,description:"",name:"autoScroll",required:!1,type:{name:"boolean"}},warning:{defaultValue:null,description:"",name:"warning",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},error:{defaultValue:null,description:"",name:"error",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},checkNonExistentValues:{defaultValue:null,description:"",name:"checkNonExistentValues",required:!1,type:{name:"boolean"}},closeOnOptionActionClick:{defaultValue:null,description:"",name:"closeOnOptionActionClick",required:!1,type:{name:"boolean"}},small:{defaultValue:null,description:"",name:"small",required:!1,type:{name:"boolean"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber | null"}},borderRadius:{defaultValue:null,description:"",name:"borderRadius",required:!1,type:{name:"TStringOrNumber"}},onCreate:{defaultValue:null,description:"",name:"onCreate",required:!1,type:{name:"((evt: any) => any)"}},disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"boolean"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"string | null"}},isInTable:{defaultValue:null,description:"",name:"isInTable",required:!1,type:{name:"boolean"}},clearable:{defaultValue:null,description:"",name:"clearable",required:!1,type:{name:"boolean"}},searchable:{defaultValue:null,description:"",name:"searchable",required:!1,type:{name:"boolean"}},maxTooltipWidth:{defaultValue:null,description:"",name:"maxTooltipWidth",required:!1,type:{name:"TStringOrNumber"}},autoLayerWidth:{defaultValue:null,description:"",name:"autoLayerWidth",required:!1,type:{name:"boolean"}},right:{defaultValue:null,description:"",name:"right",required:!1,type:{name:"boolean"}},tabIndex:{defaultValue:null,description:"",name:"tabIndex",required:!1,type:{name:"number"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}export{Fe as S};
@@ -1,4 +1,4 @@
1
- import{j as n}from"./jsx-runtime-f961835c.js";import{r as ln}from"./index-f80c8c95.js";import{S as r}from"./select-c8f67cba.js";import{S as k}from"./spacer-54db0620.js";import{I as F}from"./common-types-2c81813f.js";import{I as W}from"./icon-afbea088.js";import{T as tn}from"./text-ad1f5f1d.js";import"./index-a80ed1cf.js";import"./disabled-context-d654f6ff.js";import"./types-332ceaf3.js";import"./lodash-75c70a11.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./index-c89a1915.js";import"./inheritsLoose-d4851ab8.js";import"./assertThisInitialized-081f9914.js";import"./memoize-one.esm-52518564.js";import"./types-cc224262.js";import"./actions-7f428221.js";import"./button-1a6432ca.js";import"./spinner-cb92a546.js";import"./badge-3abf067b.js";import"./select.input-88b6ebab.js";import"./tslib.es6-dfef685f.js";const sn=[{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Koalas",value:"leaves"},{label:"Monkeys",value:"bananas",disabled:!0},{label:"Wombats",value:"bark"}],rn=[{label:"Kangaroos",value:"grass",details:"(grass)"},{label:"Monkeys",value:"bananas",details:"(bananas)"},{label:"Possums",value:"slugs",details:"(slugs)"}],on=[{type:"Heading",label:"Large"},{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Monkeys",value:"bananas"},{type:"Heading",label:"Small"},{label:"Possums",value:"slugs"}],dn=[{label:1,value:1},{label:2,value:2},{label:3,value:3},{label:4,value:4}],cn=[{label:"Yes",value:!0},{label:"No",value:!1}],un=[{label:"Aardvarks",value:"termites"},{label:"Monkeys",value:"bananas"},{label:"Vampires",value:"blood",icon:n.jsx(W,{icon:F.WARNING,color:"var(--color-text-warning)"})},{label:"Zombies",value:"brains",icon:n.jsx(W,{icon:F.ERROR,color:"var(--color-text-error)"})}],s=[{label:"Delete",icon:"delete",onClick:()=>{}},{label:"Rename",icon:"rename",onClick:()=>{}}],pn=[{label:"Kangaroos",value:"grass",actions:s},{label:"Monkeys",value:"bananas",actions:s},{label:"Possums",value:"slugs",actions:s,details:"(some details)"}],hn=[{label:"Kangaroos",value:"grass",actions:s,icon:n.jsx(W,{icon:F.WARNING,color:"var(--color-text-warning)"}),details:"(grass)"},{label:"Monkeys",value:"bananas",actions:s,icon:n.jsx(W,{icon:F.WARNING,color:"var(--color-text-warning)"}),details:"(bananas)"},{label:"Possums",value:"slugs",actions:s,icon:n.jsx(W,{icon:F.WARNING,color:"var(--color-text-warning)"}),details:"(slugs)"}],gn=[...Array(1e4).keys()].map((a,N)=>({label:Math.random().toString(36).substring(7),value:N})),vn=["Aardvarks","Kangaroos","Monkeys","Possums"],Kn={title:"Forms/Select",component:r,args:{options:sn,native:!1,multi:!1,disabled:!1,autoLayerWidth:!1,clearable:!1,searchable:!0,right:!1}},e=a=>{const{multi:N,value:en}=a,[O,nn]=ln.useState(en||(N?[]:void 0)),E=an=>{const{value:I}=an.target;nn(N?I:{value:I})};return n.jsxs(n.Fragment,{children:[n.jsx(r,{value:O,onChange:E,placeholder:"Full width",...a}),n.jsx(k,{}),n.jsx(r,{value:O,onChange:E,width:"200px",placeholder:"Fixed width",...a}),n.jsx(k,{}),n.jsx(r,{value:O,onChange:E,width:"auto",placeholder:"Auto width",...a}),n.jsx(k,{}),n.jsx(r,{value:O,onChange:E,width:"auto",placeholder:"Small",small:!0,...a}),n.jsx(k,{}),n.jsx(tn,{small:!0,muted:!0,children:"Avoid auto width for very long lists."})]})},L=e.bind({}),o=e.bind({});o.args={native:!0};const d=e.bind({});d.args={multi:!0,clearable:!0};const i=e.bind({});i.args={options:[]};const c=e.bind({});c.args={clearable:!0};const u=e.bind({});u.args={value:{label:"Vampires",value:"blood"}};const p=e.bind({});p.args={placeholder:"Select the best animal..."};const h=e.bind({});h.args={options:on};const g=e.bind({});g.args={options:rn};const v=e.bind({});v.args={options:un};const m=e.bind({});m.args={options:pn};const S=e.bind({});S.args={options:hn};const x=e.bind({});x.args={searchable:!1};const C=e.bind({});C.args={right:!0};const l=e.bind({});l.parameters={docs:{description:{story:"Avoid autoLayerWidth for very long lists in custom selects (slow)"}}};l.args={width:"70px",autoLayerWidth:!0};const b=e.bind({});b.args={tooltip:"Some info"};const w=e.bind({});w.args={error:"Some info"};const V=e.bind({});V.args={warning:"Some info"};const j=e.bind({});j.args={disabled:!0};const y=e.bind({});y.args={options:dn,placeholder:void 0};const f=e.bind({});f.args={options:cn};const A=e.bind({});A.args={options:vn};const t=e.bind({});t.parameters={docs:{description:{story:"Avoid `width: auto` and autoLayerWidth for very long lists in custom selects (slow). Consider checkNonExistentValues={false}."}}};t.args={options:gn};const T=e.bind({});T.args={deprecatedEventHandler:!0};var R,D,M;L.parameters={...L.parameters,docs:{...(R=L.parameters)==null?void 0:R.docs,source:{originalSource:`(args: any) => {
1
+ import{j as n}from"./jsx-runtime-f961835c.js";import{r as ln}from"./index-f80c8c95.js";import{S as r}from"./select-fb35923e.js";import{S as k}from"./spacer-54db0620.js";import{I as F}from"./common-types-2c81813f.js";import{I as W}from"./icon-afbea088.js";import{T as tn}from"./text-ad1f5f1d.js";import"./index-a80ed1cf.js";import"./disabled-context-d654f6ff.js";import"./types-332ceaf3.js";import"./lodash-75c70a11.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./index-c89a1915.js";import"./inheritsLoose-d4851ab8.js";import"./assertThisInitialized-081f9914.js";import"./memoize-one.esm-52518564.js";import"./types-cc224262.js";import"./actions-d843b059.js";import"./button-1a6432ca.js";import"./spinner-cb92a546.js";import"./badge-3abf067b.js";import"./select.input-88b6ebab.js";import"./tslib.es6-dfef685f.js";const sn=[{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Koalas",value:"leaves"},{label:"Monkeys",value:"bananas",disabled:!0},{label:"Wombats",value:"bark"}],rn=[{label:"Kangaroos",value:"grass",details:"(grass)"},{label:"Monkeys",value:"bananas",details:"(bananas)"},{label:"Possums",value:"slugs",details:"(slugs)"}],on=[{type:"Heading",label:"Large"},{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Monkeys",value:"bananas"},{type:"Heading",label:"Small"},{label:"Possums",value:"slugs"}],dn=[{label:1,value:1},{label:2,value:2},{label:3,value:3},{label:4,value:4}],cn=[{label:"Yes",value:!0},{label:"No",value:!1}],un=[{label:"Aardvarks",value:"termites"},{label:"Monkeys",value:"bananas"},{label:"Vampires",value:"blood",icon:n.jsx(W,{icon:F.WARNING,color:"var(--color-text-warning)"})},{label:"Zombies",value:"brains",icon:n.jsx(W,{icon:F.ERROR,color:"var(--color-text-error)"})}],s=[{label:"Delete",icon:"delete",onClick:()=>{}},{label:"Rename",icon:"rename",onClick:()=>{}}],pn=[{label:"Kangaroos",value:"grass",actions:s},{label:"Monkeys",value:"bananas",actions:s},{label:"Possums",value:"slugs",actions:s,details:"(some details)"}],hn=[{label:"Kangaroos",value:"grass",actions:s,icon:n.jsx(W,{icon:F.WARNING,color:"var(--color-text-warning)"}),details:"(grass)"},{label:"Monkeys",value:"bananas",actions:s,icon:n.jsx(W,{icon:F.WARNING,color:"var(--color-text-warning)"}),details:"(bananas)"},{label:"Possums",value:"slugs",actions:s,icon:n.jsx(W,{icon:F.WARNING,color:"var(--color-text-warning)"}),details:"(slugs)"}],gn=[...Array(1e4).keys()].map((a,N)=>({label:Math.random().toString(36).substring(7),value:N})),vn=["Aardvarks","Kangaroos","Monkeys","Possums"],Kn={title:"Forms/Select",component:r,args:{options:sn,native:!1,multi:!1,disabled:!1,autoLayerWidth:!1,clearable:!1,searchable:!0,right:!1}},e=a=>{const{multi:N,value:en}=a,[O,nn]=ln.useState(en||(N?[]:void 0)),E=an=>{const{value:I}=an.target;nn(N?I:{value:I})};return n.jsxs(n.Fragment,{children:[n.jsx(r,{value:O,onChange:E,placeholder:"Full width",...a}),n.jsx(k,{}),n.jsx(r,{value:O,onChange:E,width:"200px",placeholder:"Fixed width",...a}),n.jsx(k,{}),n.jsx(r,{value:O,onChange:E,width:"auto",placeholder:"Auto width",...a}),n.jsx(k,{}),n.jsx(r,{value:O,onChange:E,width:"auto",placeholder:"Small",small:!0,...a}),n.jsx(k,{}),n.jsx(tn,{small:!0,muted:!0,children:"Avoid auto width for very long lists."})]})},L=e.bind({}),o=e.bind({});o.args={native:!0};const d=e.bind({});d.args={multi:!0,clearable:!0};const i=e.bind({});i.args={options:[]};const c=e.bind({});c.args={clearable:!0};const u=e.bind({});u.args={value:{label:"Vampires",value:"blood"}};const p=e.bind({});p.args={placeholder:"Select the best animal..."};const h=e.bind({});h.args={options:on};const g=e.bind({});g.args={options:rn};const v=e.bind({});v.args={options:un};const m=e.bind({});m.args={options:pn};const S=e.bind({});S.args={options:hn};const x=e.bind({});x.args={searchable:!1};const C=e.bind({});C.args={right:!0};const l=e.bind({});l.parameters={docs:{description:{story:"Avoid autoLayerWidth for very long lists in custom selects (slow)"}}};l.args={width:"70px",autoLayerWidth:!0};const b=e.bind({});b.args={tooltip:"Some info"};const w=e.bind({});w.args={error:"Some info"};const V=e.bind({});V.args={warning:"Some info"};const j=e.bind({});j.args={disabled:!0};const y=e.bind({});y.args={options:dn,placeholder:void 0};const f=e.bind({});f.args={options:cn};const A=e.bind({});A.args={options:vn};const t=e.bind({});t.parameters={docs:{description:{story:"Avoid `width: auto` and autoLayerWidth for very long lists in custom selects (slow). Consider checkNonExistentValues={false}."}}};t.args={options:gn};const T=e.bind({});T.args={deprecatedEventHandler:!0};var R,D,M;L.parameters={...L.parameters,docs:{...(R=L.parameters)==null?void 0:R.docs,source:{originalSource:`(args: any) => {
2
2
  const {
3
3
  multi,
4
4
  value
@@ -1,4 +1,4 @@
1
- import{j as e}from"./jsx-runtime-f961835c.js";import{r as x}from"./index-f80c8c95.js";import{I as j}from"./common-types-2c81813f.js";import{T as g}from"./top-bar-952f0e1a.js";import{S as w}from"./side-bar-340baf4a.js";import{H as t}from"./heading-e7d165ab.js";import{B as L}from"./button-1a6432ca.js";import{D as v}from"./drawer-c7c47af0.js";import{L as d}from"./list-bc2bb312.js";import{F as l}from"./field-ea8dc7c8.js";import{I as a}from"./input-d116362c.js";import{C as m}from"./check-box-7706d069.js";import{P as f}from"./page-6d07f774.js";import{R as o,C as i}from"./row-bd69aca9.js";import{A as u}from"./accordion-a0bcd3cf.js";import{S as s}from"./spacer-54db0620.js";import{T as F}from"./tabs-087681cd.js";import"./index-a80ed1cf.js";import"./icon-afbea088.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-7f428221.js";import"./lodash-75c70a11.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-3abf067b.js";import"./index-c7f280f6.js";import"./help-icon-45458fb1.js";import"./spinner-cb92a546.js";import"./index.es-ddd8aaab.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./memoize-one.esm-52518564.js";import"./card-0e97f333.js";import"./list-heading-f838e8b9.js";import"./loader-87ec8334.js";import"./label-87bf6474.js";import"./styled-components.browser.esm-416d73e5.js";import"./select.input-88b6ebab.js";const C=[{label:"Import",value:"import",right:!0},{label:"Settings",value:"settings",right:!0}],S=()=>e.jsx("div",{style:{background:"#AAD3DF",borderLeft:"1px solid #8AB3BF",display:"flex",alignItems:"center",justifyContent:"center",color:"white",height:"100%"},children:"MAP"}),be={title:"Layout/Layout Examples",parameters:{layout:"fullscreen",docs:{story:{inline:!1,iframeHeight:400}}}},n=()=>{const[r,b]=x.useState(!0);return e.jsxs(e.Fragment,{children:[e.jsx(g,{}),e.jsx(w,{options:{title:"",sections:[]},width:"250px"}),e.jsx(f,{padding:!1,scroll:!1,children:e.jsxs(o,{spacing:0,flex:!0,children:[e.jsxs(v,{button:e.jsx(L,{onClick:()=>b(!r),round:!0,icon:j.CHEVRON_LEFT}),open:r,width:300,closedWidth:"var(--size-sidebar)",children:[e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Sites",items:[{id:1,name:"Main Site",type:"Heading"},{id:2,name:"Site name here",active:!0,label:{value:1,color:"#69779b"}},{id:3,name:"Locations",type:"Heading"},{id:4,name:"Ipsum",label:{value:2,color:"#69779b"}},{id:5,name:"Dolor",label:{value:3,color:"#69779b"}}]}}),e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Wells",items:[{id:1,name:"Main Wellbore",type:"Heading"},{id:2,name:"Lorem",label:{value:1,color:"#77699b"}}]}}),e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Targets",items:[{id:1,name:"Lorem",label:{value:1,color:"#9b6977"}}]}})]}),e.jsxs(i,{borderLeft:!0,flexbox:!0,children:[e.jsx(s,{}),e.jsx(F,{padding:!0,margin:!1,options:C}),e.jsxs(o,{spacing:0,flex:!0,children:[e.jsxs(i,{scroll:!0,padding:!0,width:550,children:[e.jsx(t,{top:!0,children:"Site name here"}),e.jsx(l,{label:"Name",children:e.jsx(a,{value:"Site name here",width:"200px"})}),e.jsxs(u,{heading:e.jsx(t,{children:"Coordinate Reference System"}),managed:!0,children:[e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{children:e.jsx(m,{label:"Dolor"})})]}),e.jsx(s,{}),e.jsx(t,{marginBottom:"var(--padding)",children:"Location"}),e.jsxs(o,{children:[e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})})]}),e.jsx(s,{}),e.jsx(t,{marginBottom:"var(--padding)",children:"Model"}),e.jsxs(o,{children:[e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})})]}),e.jsxs(u,{heading:e.jsx(t,{children:"Settings"}),managed:!0,children:[e.jsx(l,{children:e.jsx(m,{label:"Dolor"})}),e.jsxs(o,{children:[e.jsxs(i,{children:[e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})]}),e.jsxs(i,{children:[e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})]})]})]})]}),e.jsx(i,{children:e.jsx(S,{})})]})]})]})})]})};var p,c,h;n.parameters={...n.parameters,docs:{...(p=n.parameters)==null?void 0:p.docs,source:{originalSource:`() => {
1
+ import{j as e}from"./jsx-runtime-f961835c.js";import{r as x}from"./index-f80c8c95.js";import{I as j}from"./common-types-2c81813f.js";import{T as g}from"./top-bar-86fb309b.js";import{S as w}from"./side-bar-340baf4a.js";import{H as t}from"./heading-e7d165ab.js";import{B as L}from"./button-1a6432ca.js";import{D as v}from"./drawer-c7c47af0.js";import{L as d}from"./list-4c7a514b.js";import{F as l}from"./field-ea8dc7c8.js";import{I as a}from"./input-d116362c.js";import{C as m}from"./check-box-7706d069.js";import{P as f}from"./page-6d07f774.js";import{R as o,C as i}from"./row-2f12e486.js";import{A as u}from"./accordion-a0bcd3cf.js";import{S as s}from"./spacer-54db0620.js";import{T as F}from"./tabs-087681cd.js";import"./index-a80ed1cf.js";import"./icon-afbea088.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-d843b059.js";import"./lodash-75c70a11.js";import"./tooltip-23e84186.js";import"./index-3d476d02.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-3abf067b.js";import"./index-c7f280f6.js";import"./help-icon-45458fb1.js";import"./spinner-cb92a546.js";import"./index.es-ddd8aaab.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./memoize-one.esm-52518564.js";import"./card-0e97f333.js";import"./list-heading-395fcb89.js";import"./loader-87ec8334.js";import"./label-87bf6474.js";import"./styled-components.browser.esm-416d73e5.js";import"./select.input-88b6ebab.js";const C=[{label:"Import",value:"import",right:!0},{label:"Settings",value:"settings",right:!0}],S=()=>e.jsx("div",{style:{background:"#AAD3DF",borderLeft:"1px solid #8AB3BF",display:"flex",alignItems:"center",justifyContent:"center",color:"white",height:"100%"},children:"MAP"}),be={title:"Layout/Layout Examples",parameters:{layout:"fullscreen",docs:{story:{inline:!1,iframeHeight:400}}}},n=()=>{const[r,b]=x.useState(!0);return e.jsxs(e.Fragment,{children:[e.jsx(g,{}),e.jsx(w,{options:{title:"",sections:[]},width:"250px"}),e.jsx(f,{padding:!1,scroll:!1,children:e.jsxs(o,{spacing:0,flex:!0,children:[e.jsxs(v,{button:e.jsx(L,{onClick:()=>b(!r),round:!0,icon:j.CHEVRON_LEFT}),open:r,width:300,closedWidth:"var(--size-sidebar)",children:[e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Sites",items:[{id:1,name:"Main Site",type:"Heading"},{id:2,name:"Site name here",active:!0,label:{value:1,color:"#69779b"}},{id:3,name:"Locations",type:"Heading"},{id:4,name:"Ipsum",label:{value:2,color:"#69779b"}},{id:5,name:"Dolor",label:{value:3,color:"#69779b"}}]}}),e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Wells",items:[{id:1,name:"Main Wellbore",type:"Heading"},{id:2,name:"Lorem",label:{value:1,color:"#77699b"}}]}}),e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Targets",items:[{id:1,name:"Lorem",label:{value:1,color:"#9b6977"}}]}})]}),e.jsxs(i,{borderLeft:!0,flexbox:!0,children:[e.jsx(s,{}),e.jsx(F,{padding:!0,margin:!1,options:C}),e.jsxs(o,{spacing:0,flex:!0,children:[e.jsxs(i,{scroll:!0,padding:!0,width:550,children:[e.jsx(t,{top:!0,children:"Site name here"}),e.jsx(l,{label:"Name",children:e.jsx(a,{value:"Site name here",width:"200px"})}),e.jsxs(u,{heading:e.jsx(t,{children:"Coordinate Reference System"}),managed:!0,children:[e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{children:e.jsx(m,{label:"Dolor"})})]}),e.jsx(s,{}),e.jsx(t,{marginBottom:"var(--padding)",children:"Location"}),e.jsxs(o,{children:[e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})})]}),e.jsx(s,{}),e.jsx(t,{marginBottom:"var(--padding)",children:"Model"}),e.jsxs(o,{children:[e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})})]}),e.jsxs(u,{heading:e.jsx(t,{children:"Settings"}),managed:!0,children:[e.jsx(l,{children:e.jsx(m,{label:"Dolor"})}),e.jsxs(o,{children:[e.jsxs(i,{children:[e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})]}),e.jsxs(i,{children:[e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})]})]})]})]}),e.jsx(i,{children:e.jsx(S,{})})]})]})]})})]})};var p,c,h;n.parameters={...n.parameters,docs:{...(p=n.parameters)==null?void 0:p.docs,source:{originalSource:`() => {
2
2
  const [open, setOpen] = useState(true);
3
3
  return <>
4
4
  <TopBar />
@@ -1 +1 @@
1
- import{S as c,c as l,s as n}from"./index-4997c9dc.js";import"./iframe-d9853d67.js";import"../sb-preview/runtime.js";import"./index-f80c8c95.js";import"./index-3d476d02.js";import"./inheritsLoose-d4851ab8.js";import"./assertThisInitialized-081f9914.js";import"./index-97a99495.js";export{c as SyntaxHighlighter,l as createCopyToClipboardFunction,n as default};
1
+ import{S as c,c as l,s as n}from"./index-8fea21ba.js";import"./iframe-0bc7c3ad.js";import"../sb-preview/runtime.js";import"./index-f80c8c95.js";import"./index-3d476d02.js";import"./inheritsLoose-d4851ab8.js";import"./assertThisInitialized-081f9914.js";import"./index-97a99495.js";export{c as SyntaxHighlighter,l as createCopyToClipboardFunction,n as default};
@@ -1 +1 @@
1
- import{j as n}from"./jsx-runtime-f961835c.js";import{r as V}from"./index-f80c8c95.js";import{c as j}from"./index-a80ed1cf.js";import{I as He,D as Pe,C as Le,P as Fe}from"./index.es-ddd8aaab.js";import{l as De}from"./lodash-75c70a11.js";import{A as fe}from"./actions-7f428221.js";import{H as $e}from"./heading-e7d165ab.js";import{P as Oe}from"./pagination-cfbe0404.js";import{A as b,I as $}from"./common-types-2c81813f.js";import{I as Be}from"./input-d116362c.js";import{N as Me}from"./number-input-2867677b.js";import{S as Ge}from"./select-c8f67cba.js";import{D as Ue}from"./disabled-context-d654f6ff.js";import{i as O}from"./types-332ceaf3.js";import{T as ye}from"./tooltip-23e84186.js";import{C as Xe}from"./check-box-7706d069.js";import{S as ze}from"./slider-054cbf00.js";import{I as B}from"./icon-afbea088.js";import{P as Je}from"./popover-2bc1502d.js";import{H as Ee}from"./help-icon-45458fb1.js";import{T as ee}from"./text-ad1f5f1d.js";const Ke="_inputInTable_1bnfd_1",Ye="_inputHover_1bnfd_13",Qe="_inputFocus_1bnfd_18",Ze="_inputError_1bnfd_25",en="_inputWarning_1bnfd_26",nn="_inputDisabled_1bnfd_61",tn="_hideScrollbars_1bnfd_67",rn="_wrapper_1bnfd_85",an="_bordered_1bnfd_93",ln="_scroll_1bnfd_98",on="_table_1bnfd_108",sn="_striped_1bnfd_191",H={inputInTable:Ke,inputHover:Ye,inputFocus:Qe,inputError:Ze,inputWarning:en,inputDisabled:nn,hideScrollbars:tn,wrapper:rn,bordered:an,scroll:ln,table:on,striped:sn},dn="_title_bzw5n_1",cn={title:dn},U=({name:e=null,actions:t=null,actionsRight:a=!1,testId:l})=>{const r=e!==null,o=t!==null;if(!r&&!o)return null;const s=()=>{if(!o)return null;const u=n.jsx(fe,{actions:t});return a?u:n.jsx("div",{children:u})};return n.jsxs("div",{className:cn.title,children:[r?n.jsx($e,{children:n.jsx("span",{"data-testid":l,children:e})}):null,s()]})};try{U.displayName="Title",U.__docgenInfo={description:"",displayName:"Title",props:{name:{defaultValue:{value:"null"},description:"",name:"name",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},actions:{defaultValue:{value:"null"},description:"",name:"actions",required:!1,type:{name:"any"}},actionsRight:{defaultValue:{value:"false"},description:"",name:"actionsRight",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const un="_footer_4sumy_1",pn="_section_4sumy_7",ne={footer:un,section:pn},X=({colSpan:e,pagination:t,actions:a,content:l})=>{const r=a&&a.length,o=l!=null,s=()=>{var d,p;if(t){const{rowCount:c,rowsPerPage:f}=t,g=Number((p=(d=f==null?void 0:f.options)==null?void 0:d[0])==null?void 0:p.value);return c>g}return!1};return r||o||s()?n.jsxs("div",{className:ne.footer,children:[o?n.jsx("div",{className:ne.section,children:n.jsx("div",{children:l})}):null,r||s()?n.jsxs("div",{className:ne.section,children:[s()?n.jsx(Oe,{pagination:t}):n.jsx("div",{}),r&&n.jsx("div",{children:n.jsx(fe,{actions:a})})]}):null]}):null};try{X.displayName="Footer",X.__docgenInfo={description:"",displayName:"Footer",props:{colSpan:{defaultValue:null,description:"",name:"colSpan",required:!1,type:{name:"number"}},pagination:{defaultValue:null,description:"",name:"pagination",required:!0,type:{name:"IPagination"}},actions:{defaultValue:null,description:"",name:"actions",required:!1,type:{name:"IAction[]"}},content:{defaultValue:null,description:"",name:"content",required:!1,type:{name:"ReactNode"}}}}}catch{}const Se=e=>{const t=Math.max(...e.reduce((a,l)=>{const r=l.cells.map(o=>o.colSpan?o.colSpan:1).reduce((o,s)=>o+s,0);return a.concat(r)},[]));return isNaN(t)?0:t},mn=(e,t)=>{const a=[Se(t),Se(e)];return Math.max(...a)},Te=e=>e.reduce((t,a)=>a.actions&&a.actions.length>0?1:t,0),_n=(e,t)=>Te(t)>0||Te(e)>0,z=({table:e,children:t})=>{const{rows:a,infiniteScroll:l}=e,r=Math.ceil(window.innerHeight/30),[o,s]=l?V.useState(r):[a.length,null],[u,d]=l?V.useState(o<a.length):[!1,null],p=()=>{if(o>=a.length&&d){d(!1);return}s&&s(o+r)};return n.jsx("div",{id:"scrollWrapper",className:H.scroll,children:l?n.jsx(He,{dataLength:Math.min(a.length,o+r),next:p,hasMore:u,scrollableTarget:"scrollWrapper",style:{overflow:"initial"},loader:null,children:t({visibleRows:o})}):t({visibleRows:o})})};try{z.displayName="TableScrollWrapper",z.__docgenInfo={description:"",displayName:"TableScrollWrapper",props:{table:{defaultValue:null,description:"",name:"table",required:!0,type:{name:"ITableProps"}}}}}catch{}const gn="_clickableRow_11d5t_1",fn="_hoverableRow_11d5t_4",yn="_rowActive_11d5t_4",hn="_expandableRow_11d5t_8",bn="_flush_11d5t_8",Cn="_dragIconCell_11d5t_28",xn="_dragIcon_11d5t_28",R={clickableRow:gn,hoverableRow:fn,rowActive:yn,expandableRow:hn,flush:bn,dragIconCell:Cn,dragIcon:xn},J=({colSpan:e,children:t,flush:a})=>n.jsx("tr",{children:n.jsx("td",{colSpan:e,className:j(R.expandableRow,a?R.flush:""),children:t})});try{J.displayName="ExpandedContentRow",J.__docgenInfo={description:"",displayName:"ExpandedContentRow",props:{colSpan:{defaultValue:null,description:"",name:"colSpan",required:!0,type:{name:"number"}},flush:{defaultValue:null,description:"",name:"flush",required:!1,type:{name:"boolean"}}}}}catch{}const Ve=(e,t={leftAligned:"",rightAligned:"",centerAligned:""},a=!1)=>{if(!e)return null;const{bodyAlignment:l,headerAlignment:r,isHeader:o}=e;switch(o&&r?r:l){case b.LEFT:return a?b.LEFT:t.leftAligned;case b.RIGHT:return a?b.RIGHT:t.rightAligned;case b.CENTER:return a?b.CENTER:t.centerAligned;default:return a?b.LEFT:t.leftAligned}},In=(e,t=!1,a=0)=>{if(!e||e.length===0)return[];const l=e.every(o=>Array.isArray(o)),r=e.every(o=>typeof o=="string");return l&&t?e[a]||[]:r?e:(console.warn("getHeaderAlignment: alignments array contains a mix of strings and arrays, returning an empty array."),[])},Nn="_inputInTable_sdi21_1",jn="_inputHover_sdi21_13",wn="_inputFocus_sdi21_18",An="_inputError_sdi21_25",vn="_inputWarning_sdi21_26",Rn="_inputDisabled_sdi21_61",Sn="_hideScrollbars_sdi21_67",Tn="_cell_sdi21_77",Vn="_disabledLink_sdi21_87",qn="_inputWrapper_sdi21_91",En="_breakWord_sdi21_106",kn="_inputCell_sdi21_109",Wn="_sliderCell_sdi21_112",Hn="_staticCell_sdi21_116",Pn="_staticCellContent_sdi21_119",Ln="_error_sdi21_131",Fn="_warning_sdi21_132",Dn="_unit_sdi21_141",$n="_sortingCell_sdi21_144",On="_sortingCellIcon_sdi21_155",Bn="_icon_sdi21_166",Mn="_checkBoxCell_sdi21_170",Gn="_iconCellWrapper_sdi21_174",Un="_actionsCell_sdi21_178",Xn="_rightAligned_sdi21_186",zn="_centerAligned_sdi21_192",Jn="_leftAligned_sdi21_198",Kn="_popover_sdi21_201",Yn="_disabledPointerEvents_sdi21_204",i={inputInTable:Nn,inputHover:jn,inputFocus:wn,inputError:An,inputWarning:vn,inputDisabled:Rn,hideScrollbars:Sn,cell:Tn,disabledLink:Vn,inputWrapper:qn,breakWord:En,inputCell:kn,sliderCell:Wn,staticCell:Hn,staticCellContent:Pn,error:Ln,warning:Fn,unit:Dn,sortingCell:$n,sortingCellIcon:On,icon:Bn,checkBoxCell:Mn,iconCellWrapper:Gn,actionsCell:Un,rightAligned:Xn,centerAligned:zn,leftAligned:Jn,popover:Kn,disabledPointerEvents:Yn},te=({cell:e,columnAlignment:t,testId:a})=>n.jsx(Be,{name:e.name,value:e.value,onChange:l=>{var r;return(r=e.onChange)==null?void 0:r.call(e,l)},onPaste:l=>{var r;return(r=e.onPaste)==null?void 0:r.call(e,l)},placeholder:e.placeholder,error:e.error,warning:e.warning,disabled:e.disabled,isInTable:!0,maxTooltipWidth:e.maxTooltipWidth,right:t===b.RIGHT,testId:a,tabIndex:e.disabled?-1:0,tooltip:e.tooltip});try{te.displayName="InputCell",te.__docgenInfo={description:"",displayName:"InputCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IInputCell"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!1,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const re=({cell:e,testId:t})=>n.jsx(Me,{name:e.name,value:e.value,onChange:a=>{var l;return(l=e.onChange)==null?void 0:l.call(e,a)},placeholder:e.placeholder,error:e.error,warning:e.warning,disabled:e.disabled,isInTable:!0,left:e.left,tabIndex:e.disabled?-1:0,testId:t,tooltip:e.tooltip,validationCallback:e.validationCallback,allowEmpty:e.allowEmpty});try{re.displayName="NumberInputCell",re.__docgenInfo={description:"",displayName:"NumberInputCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"INumberInputCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const ae=({cell:e,columnAlignment:t,testId:a})=>n.jsx(Ge,{name:e.name,borderRadius:0,options:e.options,onChange:l=>{var r;return(r=e.onChange)==null?void 0:r.call(e,l)},onCreate:e.onCreate?l=>e.onCreate&&e.onCreate(l):void 0,error:e.error,warning:e.warning,disabled:e.disabled,placeholder:e.placeholder,isInTable:!0,value:e.value,native:e.native,clearable:e.clearable,searchable:e.searchable,deprecatedEventHandler:e.deprecatedEventHandler,maxTooltipWidth:e.maxTooltipWidth,width:"100%",autoLayerWidth:e.autoLayerWidth,right:t===b.RIGHT,testId:a,tabIndex:e.disabled?-1:0});try{ae.displayName="SelectCell",ae.__docgenInfo={description:"",displayName:"SelectCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ISelectCell"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!1,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const le=({cell:e,columnAlignment:t,testId:a})=>n.jsx("div",{className:i.inputWrapper,children:e.type==="Input"?n.jsx(te,{cell:e,columnAlignment:t,testId:a}):e.type==="NumberInput"?n.jsx(re,{cell:e,testId:a}):e.type==="Select"?n.jsx(ae,{cell:e,columnAlignment:t,testId:a}):null});try{le.displayName="InputCellWrapper",le.__docgenInfo={description:"",displayName:"InputCellWrapper",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"any"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!0,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const oe=({cell:e,testId:t})=>{const a=V.useContext(Ue),{error:l,warning:r,tooltip:o,maxTooltipWidth:s}=e,u=d=>O(d);return n.jsx("div",{className:i.inputWrapper,children:n.jsx(ye,{error:!!l,warning:!!r,text:o||l||r,enabled:u(o)||u(l)||u(r)||!1,maxWidth:s,placement:"bottom-center",children:n.jsx("div",{className:j(i.staticCellContent,l?i.error:r?i.warning:""),children:n.jsx("a",{className:j((e.disabled||a)&&i.disabledLink),onClick:e.disabled||a?void 0:d=>{var p;d.stopPropagation(),(p=e.onClick)==null||p.call(e,d)},"data-testid":t,children:e.value})})})})};try{oe.displayName="LinkCell",oe.__docgenInfo={description:"",displayName:"LinkCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ILinkCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const ie=({cell:e,testId:t})=>n.jsx(Xe,{label:e.label,checked:e.checked,isInTable:!0,disabled:e.disabled,onChange:a=>e.onChange(a),testId:t,tabIndex:e.disabled?-1:0});try{ie.displayName="CheckBoxCell",ie.__docgenInfo={description:"",displayName:"CheckBoxCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ICheckBoxCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const se=({cell:e})=>n.jsx("div",{className:i.inputWrapper,children:n.jsx(ze,{label:e.label,value:e.value,min:e.min,max:e.max,step:e.step,marks:e.marks,onChange:t=>e.onChange(t),showArrows:e.showArrows,showTooltip:e.showTooltip,tooltipFormatter:e.tooltipFormatter,disabled:e.disabled})});try{se.displayName="SliderCell",se.__docgenInfo={description:"",displayName:"SliderCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ISliderCell"}}}}}catch{}const de=({cell:e})=>{const{tooltip:t,icon:a}=e;return n.jsx("div",{className:i.iconCellWrapper,children:n.jsx(ye,{text:t,enabled:!!t&&O(t),display:"flex",placement:"top-center",children:n.jsx(B,{icon:a})})})};try{de.displayName="IconCell",de.__docgenInfo={description:"",displayName:"IconCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IIconCell"}}}}}catch{}const ce=({cell:e})=>n.jsx(fe,{actions:e.actions});try{ce.displayName="ActionsCell",ce.__docgenInfo={description:"",displayName:"ActionsCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IActionCell"}}}}}catch{}const ue=({cell:e})=>{const{helpIcon:t}=e;return t?n.jsx("div",{className:i.icon,children:n.jsx(Ee,{onClick:t.onClick,text:t.tooltip})}):null};try{ue.displayName="CellHelpIcon",ue.__docgenInfo={description:"",displayName:"CellHelpIcon",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IHelpIconCell"}}}}}catch{}const pe=({cell:e})=>{const{libraryIcon:t}=e;return t?n.jsx("div",{className:i.icon,children:n.jsx(Ee,{onClick:t.onClick,text:t.tooltip,icon:$.LIBRARY})}):null};try{pe.displayName="CellLibraryIcon",pe.__docgenInfo={description:"",displayName:"CellLibraryIcon",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ILibraryIconCell"}}}}}catch{}const me=({cell:e})=>{const{hasSort:t,sort:a,sortPriority:l}=e;return t?n.jsxs("span",{className:i.sortingCellIcon,children:[a==="down"?n.jsx(ee,{link:!0,children:n.jsx(B,{icon:$.SORT_ASCENDING})}):a==="up"?n.jsx(ee,{link:!0,children:n.jsx(B,{icon:$.SORT_DESCENDING})}):n.jsx(ee,{faint:!0,children:n.jsx(B,{icon:$.SORT_DESCENDING})}),l&&a?n.jsx("sup",{children:l}):null]}):null};try{me.displayName="Sort",me.__docgenInfo={description:"",displayName:"Sort",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ISortCell"}}}}}catch{}const K=({cell:e,isHeader:t,testId:a})=>{const{error:l,warning:r,tooltip:o,maxTooltipWidth:s,hasSort:u,onSort:d,type:p}=e,c=n.jsxs("div",{className:j(i.staticCellContent,p==="Unit"?i.unit:"",l?i.error:r?i.warning:""),onClick:u?f=>d&&d(f):()=>{},"data-testid":a,children:[e.value,t?n.jsxs(n.Fragment,{children:[n.jsx(ue,{cell:e}),n.jsx(pe,{cell:e}),n.jsx(me,{cell:e})]}):null]});return n.jsx("div",{className:i.inputWrapper,children:n.jsx(ye,{error:!!l,warning:!!r,text:o||l||r,enabled:o&&O(o)||l&&O(l)||r&&O(r)||!1,maxWidth:s,display:"block",placement:"bottom-center",children:c})})};try{K.displayName="StaticCell",K.__docgenInfo={description:"",displayName:"StaticCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IStaticCell"}},isHeader:{defaultValue:null,description:"",name:"isHeader",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const _e=({cell:e,testId:t})=>{const{content:a,fullWidth:l,closeOnOutsideClick:r,disabled:o}=e;return n.jsx(Je,{content:a,fullWidth:l,closeOnOutsideClick:r,disabled:o,children:n.jsx("div",{className:i.popover,children:n.jsx(K,{cell:e,testId:t})})})};try{_e.displayName="PopoverCell",_e.__docgenInfo={description:"",displayName:"PopoverCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IPopoverCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const ge=({cell:e,isHeader:t,columnAlignment:a,testId:l})=>{if(!e)return null;switch(e.type){case"Input":case"NumberInput":case"Select":return n.jsx(le,{cell:e,columnAlignment:a,testId:l});case"Link":return n.jsx(oe,{cell:e,testId:l});case"CheckBox":return n.jsx(ie,{cell:e,testId:l});case"Slider":return n.jsx(se,{cell:e});case"Icon":return n.jsx(de,{cell:e});case"Actions":return n.jsx(ce,{cell:e});case"Popover":return n.jsx(_e,{cell:e});default:return n.jsx(K,{cell:e,isHeader:t,testId:l})}};try{ge.displayName="CellWrapper",ge.__docgenInfo={description:"",displayName:"CellWrapper",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"any"}},isHeader:{defaultValue:null,description:"",name:"isHeader",required:!0,type:{name:"boolean"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!0,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}var S=(e=>(e.INPUT="Input",e.NUMBER_INPUT="NumberInput",e.SELECT="Select",e.POPOVER="Popover",e.SLIDER="Slider",e.CHECKBOX="CheckBox",e.ACTIONS="Actions",e))(S||{});const Y=({cell:e,isHeader:t,columnHeaderAlignment:a=b.LEFT,columnAlignment:l=b.LEFT,width:r,snapshot:o,testId:s})=>{if(!e)return null;const{style:u,colSpan:d,rowSpan:p,width:c}=e,f=V.useRef(null),g={bodyAlignment:l,headerAlignment:a,isHeader:t},P=Ve(g,i),C=Ve(g,i,!0),L=e.type===S.INPUT||e.type===S.NUMBER_INPUT||e.type===S.SELECT||e.type===S.POPOVER?i.inputCell:e.type===S.SLIDER?i.sliderCell:e.type===S.CHECKBOX?i.checkBoxCell:e.type===S.ACTIONS?i.actionsCell:i.staticCell,w=j(i.cell,L,e.hasSort?i.sortingCell:null,P,e.breakWord?i.breakWord:""),q=c??r??((o==null?void 0:o.isDragging)&&f.current&&f.current.offsetWidth)??void 0,x={width:q,minWidth:q,...u},A=t?"th":"td";return n.jsx(A,{ref:f,className:w,style:x,colSpan:d,rowSpan:p,children:n.jsx(ge,{cell:e,columnAlignment:C??b.RIGHT,isHeader:t,testId:s})})};try{Y.displayName="Cell",Y.__docgenInfo={description:"",displayName:"Cell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!1,type:{name:"TCellShape"}},isHeader:{defaultValue:null,description:"",name:"isHeader",required:!0,type:{name:"boolean"}},columnHeaderAlignment:{defaultValue:{value:"Align.LEFT"},description:"",name:"columnHeaderAlignment",required:!1,type:{name:"string"}},columnAlignment:{defaultValue:{value:"Align.LEFT"},description:"",name:"columnAlignment",required:!1,type:{name:"Align.LEFT | Align.RIGHT | null"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber"}},snapshot:{defaultValue:null,description:"",name:"snapshot",required:!1,type:{name:"any"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const D=({row:e,rowIndex:t,isHeader:a=!1,columnCount:l,colSpan:r,columnHeaderAlignments:o=[],columnAlignment:s=[],hasRowActions:u,draggableTable:d=!1,snapshot:p=null,provided:c=null,width:f,columnWidths:g,testId:P})=>{const C=V.useRef(null),L=In(o,a,t),{onRowClick:w,onRowFocus:q,onRowMouseEnter:x,onRowMouseLeave:A,expandedContent:I,active:Q}=e,E=e.cells.map((h,v)=>{const he=`${a?0:1}_${t}_${v}`;return n.jsx(Y,{cell:h,isHeader:a,columnAlignment:s[v],columnHeaderAlignment:L[v],width:g?g[v]:void 0,snapshot:p,testId:h.testId},he)}),T=u&&n.jsx(Y,{cell:{type:S.ACTIONS,actions:e.actions},isHeader:a},l),k=(h,v)=>({minWidth:h&&`${f}px`,width:h&&"100%",display:h&&"table",background:h&&"var(--color-background-listitem-active)",border:h&&"var(--color-border)",borderTop:h&&0,opacity:h&&.1,...v}),W=()=>e.noDrag?n.jsx("td",{"aria-labelledby":"unique-label-id"}):n.jsx("td",{className:R.dragIconCell,children:n.jsx("div",{...c.dragHandleProps,className:R.dragIcon,children:n.jsx(B,{icon:$.DRAG})})});return a?n.jsxs(n.Fragment,{children:[n.jsxs("tr",{ref:C,onClick:w,onMouseEnter:x,onMouseLeave:A,onFocus:q,className:j(w?R.clickableRow:null,x?R.hoverableRow:null),children:[d?n.jsx("th",{}):null,E,T]},t),I&&I.content?n.jsx(J,{colSpan:r,flush:I.flush===!0,children:I.content},`${t}_expanded_content`):null]}):n.jsxs(n.Fragment,{children:[n.jsxs("tr",{onClick:w,onMouseEnter:x,onMouseLeave:A,onFocus:q,className:j(w&&!w.noStyle?R.clickableRow:null,x&&!x.noStyle?R.hoverableRow:null,Q?R.rowActive:null),ref:(c==null?void 0:c.innerRef)||null,...(c==null?void 0:c.draggableProps)||null,style:p&&c?k(p.isDragging,c.draggableProps.style):null,children:[d?W():null,E,T]},t),I&&I.content?n.jsx(J,{colSpan:r,flush:I.flush===!0,children:I.content},`${t}_expanded_content`):null]})};try{D.displayName="Row",D.__docgenInfo={description:"",displayName:"Row",props:{row:{defaultValue:null,description:"",name:"row",required:!0,type:{name:"TRowType"}},rowIndex:{defaultValue:null,description:"",name:"rowIndex",required:!0,type:{name:"number"}},isHeader:{defaultValue:{value:"false"},description:"",name:"isHeader",required:!1,type:{name:"boolean"}},columnCount:{defaultValue:null,description:"",name:"columnCount",required:!0,type:{name:"number"}},colSpan:{defaultValue:null,description:"",name:"colSpan",required:!0,type:{name:"number"}},columnHeaderAlignments:{defaultValue:{value:"[]"},description:"",name:"columnHeaderAlignments",required:!1,type:{name:"string[] | string[][]"}},columnAlignment:{defaultValue:{value:"[]"},description:"",name:"columnAlignment",required:!1,type:{name:"string[]"}},hasRowActions:{defaultValue:null,description:"",name:"hasRowActions",required:!0,type:{name:"boolean"}},draggableTable:{defaultValue:{value:"false"},description:"",name:"draggableTable",required:!1,type:{name:"boolean"}},snapshot:{defaultValue:{value:"null"},description:"",name:"snapshot",required:!1,type:{name:"any"}},provided:{defaultValue:{value:"null"},description:"",name:"provided",required:!1,type:{name:"any"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber"}},columnWidths:{defaultValue:null,description:"",name:"columnWidths",required:!1,type:{name:"string[]"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const qe=e=>{var Ie,Ne,je,we,Ae,ve,Re;const{onListReorder:t=()=>{},table:a}=e,{columnWidths:l,footer:r,name:o,rows:s=[],actions:u,actionsRight:d,columnHeaderAlignments:p,columnAlignment:c,striped:f=!0,testId:g,draggable:P,defaultEmptyRow:C=null,onAddRow:L=null,bordered:w=!0,maxHeight:q,fixedWidth:x}=a,A=V.useRef(null),[I,Q]=V.useState({width:0,height:0});V.useEffect(()=>{A.current&&Q({width:A.current.offsetWidth,height:A.current.offsetHeight})},[]);const E=De.get(e,"table.headers",[]),T=mn(s,E),k=_n(s,E),W=T+(k?1:0),h=r?((Ne=(Ie=r==null?void 0:r.pagination)==null?void 0:Ie.rowsPerPage)==null?void 0:Ne.value)===0||Number((je=r==null?void 0:r.pagination)==null?void 0:je.selectedPage)>=Number((we=r==null?void 0:r.pagination)==null?void 0:we.rowCount)/Number((ve=(Ae=r==null?void 0:r.pagination)==null?void 0:Ae.rowsPerPage)==null?void 0:ve.value):!0,v=((Re=C==null?void 0:C.cells)==null?void 0:Re.length)&&L&&h,ke={cells:v?C.cells.map((m,N)=>(m==null?void 0:m.type)==="Input"?{...m,onChange:_=>{var M;const y=(M=_==null?void 0:_.target)==null?void 0:M.value,F={...C,cells:C.cells.map((G,We)=>({...G,value:We===N?y:G==null?void 0:G.value}))};L({newRow:F})}}:{...m,disabled:!0}):null,testId:g?`${g}-last-empty-row`:void 0},Z=v?s.concat(ke):s,be={...a,rows:Z},Ce=j(H.wrapper,w?H.bordered:""),xe={maxHeight:q,width:x,display:x==="auto"?"inline-flex":"flex"};return P?n.jsxs("div",{ref:A,className:Ce,style:xe,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(Pe,{onDragEnd:m=>{var y,F;const N=(y=m==null?void 0:m.source)==null?void 0:y.index,_=(F=m==null?void 0:m.destination)==null?void 0:F.index;typeof N=="number"&&typeof _=="number"&&t({from:N,to:_})},children:n.jsx(Le,{droppableId:"droppable",children:m=>n.jsx(z,{table:be,children:({visibleRows:N})=>n.jsxs("table",{className:j(H.table,f?H.striped:""),"data-testid":g,ref:m.innerRef,children:[n.jsx("thead",{children:E.map((_,y)=>n.jsx(D,{rowIndex:y,isHeader:!0,row:_,columnCount:T,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p,draggableTable:P},`0_${y}`))}),n.jsxs("tbody",{children:[Z.slice(0,N).map((_,y)=>n.jsx(Fe,{draggableId:y+"",index:y,isDragDisabled:_.noDrag,children:(F,M)=>n.jsx(D,{rowIndex:y,row:_,columnCount:T,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,provided:F,snapshot:M,draggableTable:P,width:I.width},`1_${y}`)},`index_${y}`)),m.placeholder]})]})})})}),r&&n.jsx(X,{pagination:r.pagination,actions:r.actions,content:r.content})]}):n.jsxs("div",{className:Ce,style:xe,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(z,{table:be,children:({visibleRows:m})=>n.jsxs("table",{className:j(H.table,f?H.striped:""),"data-testid":g,children:[n.jsx("thead",{children:E.map((N,_)=>n.jsx(D,{rowIndex:_,isHeader:!0,row:N,columnCount:T,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p},`0_${_}`))}),n.jsx("tbody",{children:Z.slice(0,m).map((N,_)=>n.jsx(D,{rowIndex:_,row:N,columnCount:T,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c},`1_${_}`))})]})}),r&&n.jsx(X,{colSpan:W,pagination:r.pagination,actions:r.actions,content:r.content})]})};try{qe.displayName="Table",qe.__docgenInfo={description:"",displayName:"Table",props:{onListReorder:{defaultValue:null,description:"",name:"onListReorder",required:!1,type:{name:"((obj: { from: number; to: number; }) => void)"}},table:{defaultValue:null,description:"",name:"table",required:!0,type:{name:"{ name?: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined; ... 18 more ...; actions?: any; }"}}}}}catch{}export{qe as T};
1
+ import{j as n}from"./jsx-runtime-f961835c.js";import{r as V}from"./index-f80c8c95.js";import{c as j}from"./index-a80ed1cf.js";import{I as He,D as Pe,C as Le,P as Fe}from"./index.es-ddd8aaab.js";import{l as De}from"./lodash-75c70a11.js";import{A as fe}from"./actions-d843b059.js";import{H as $e}from"./heading-e7d165ab.js";import{P as Oe}from"./pagination-c5f96ac2.js";import{A as b,I as $}from"./common-types-2c81813f.js";import{I as Be}from"./input-d116362c.js";import{N as Me}from"./number-input-2867677b.js";import{S as Ge}from"./select-fb35923e.js";import{D as Ue}from"./disabled-context-d654f6ff.js";import{i as O}from"./types-332ceaf3.js";import{T as ye}from"./tooltip-23e84186.js";import{C as Xe}from"./check-box-7706d069.js";import{S as ze}from"./slider-054cbf00.js";import{I as B}from"./icon-afbea088.js";import{P as Je}from"./popover-2bc1502d.js";import{H as Ee}from"./help-icon-45458fb1.js";import{T as ee}from"./text-ad1f5f1d.js";const Ke="_inputInTable_1bnfd_1",Ye="_inputHover_1bnfd_13",Qe="_inputFocus_1bnfd_18",Ze="_inputError_1bnfd_25",en="_inputWarning_1bnfd_26",nn="_inputDisabled_1bnfd_61",tn="_hideScrollbars_1bnfd_67",rn="_wrapper_1bnfd_85",an="_bordered_1bnfd_93",ln="_scroll_1bnfd_98",on="_table_1bnfd_108",sn="_striped_1bnfd_191",H={inputInTable:Ke,inputHover:Ye,inputFocus:Qe,inputError:Ze,inputWarning:en,inputDisabled:nn,hideScrollbars:tn,wrapper:rn,bordered:an,scroll:ln,table:on,striped:sn},dn="_title_bzw5n_1",cn={title:dn},U=({name:e=null,actions:t=null,actionsRight:a=!1,testId:l})=>{const r=e!==null,o=t!==null;if(!r&&!o)return null;const s=()=>{if(!o)return null;const u=n.jsx(fe,{actions:t});return a?u:n.jsx("div",{children:u})};return n.jsxs("div",{className:cn.title,children:[r?n.jsx($e,{children:n.jsx("span",{"data-testid":l,children:e})}):null,s()]})};try{U.displayName="Title",U.__docgenInfo={description:"",displayName:"Title",props:{name:{defaultValue:{value:"null"},description:"",name:"name",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},actions:{defaultValue:{value:"null"},description:"",name:"actions",required:!1,type:{name:"any"}},actionsRight:{defaultValue:{value:"false"},description:"",name:"actionsRight",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const un="_footer_4sumy_1",pn="_section_4sumy_7",ne={footer:un,section:pn},X=({colSpan:e,pagination:t,actions:a,content:l})=>{const r=a&&a.length,o=l!=null,s=()=>{var d,p;if(t){const{rowCount:c,rowsPerPage:f}=t,g=Number((p=(d=f==null?void 0:f.options)==null?void 0:d[0])==null?void 0:p.value);return c>g}return!1};return r||o||s()?n.jsxs("div",{className:ne.footer,children:[o?n.jsx("div",{className:ne.section,children:n.jsx("div",{children:l})}):null,r||s()?n.jsxs("div",{className:ne.section,children:[s()?n.jsx(Oe,{pagination:t}):n.jsx("div",{}),r&&n.jsx("div",{children:n.jsx(fe,{actions:a})})]}):null]}):null};try{X.displayName="Footer",X.__docgenInfo={description:"",displayName:"Footer",props:{colSpan:{defaultValue:null,description:"",name:"colSpan",required:!1,type:{name:"number"}},pagination:{defaultValue:null,description:"",name:"pagination",required:!0,type:{name:"IPagination"}},actions:{defaultValue:null,description:"",name:"actions",required:!1,type:{name:"IAction[]"}},content:{defaultValue:null,description:"",name:"content",required:!1,type:{name:"ReactNode"}}}}}catch{}const Se=e=>{const t=Math.max(...e.reduce((a,l)=>{const r=l.cells.map(o=>o.colSpan?o.colSpan:1).reduce((o,s)=>o+s,0);return a.concat(r)},[]));return isNaN(t)?0:t},mn=(e,t)=>{const a=[Se(t),Se(e)];return Math.max(...a)},Te=e=>e.reduce((t,a)=>a.actions&&a.actions.length>0?1:t,0),_n=(e,t)=>Te(t)>0||Te(e)>0,z=({table:e,children:t})=>{const{rows:a,infiniteScroll:l}=e,r=Math.ceil(window.innerHeight/30),[o,s]=l?V.useState(r):[a.length,null],[u,d]=l?V.useState(o<a.length):[!1,null],p=()=>{if(o>=a.length&&d){d(!1);return}s&&s(o+r)};return n.jsx("div",{id:"scrollWrapper",className:H.scroll,children:l?n.jsx(He,{dataLength:Math.min(a.length,o+r),next:p,hasMore:u,scrollableTarget:"scrollWrapper",style:{overflow:"initial"},loader:null,children:t({visibleRows:o})}):t({visibleRows:o})})};try{z.displayName="TableScrollWrapper",z.__docgenInfo={description:"",displayName:"TableScrollWrapper",props:{table:{defaultValue:null,description:"",name:"table",required:!0,type:{name:"ITableProps"}}}}}catch{}const gn="_clickableRow_11d5t_1",fn="_hoverableRow_11d5t_4",yn="_rowActive_11d5t_4",hn="_expandableRow_11d5t_8",bn="_flush_11d5t_8",Cn="_dragIconCell_11d5t_28",xn="_dragIcon_11d5t_28",R={clickableRow:gn,hoverableRow:fn,rowActive:yn,expandableRow:hn,flush:bn,dragIconCell:Cn,dragIcon:xn},J=({colSpan:e,children:t,flush:a})=>n.jsx("tr",{children:n.jsx("td",{colSpan:e,className:j(R.expandableRow,a?R.flush:""),children:t})});try{J.displayName="ExpandedContentRow",J.__docgenInfo={description:"",displayName:"ExpandedContentRow",props:{colSpan:{defaultValue:null,description:"",name:"colSpan",required:!0,type:{name:"number"}},flush:{defaultValue:null,description:"",name:"flush",required:!1,type:{name:"boolean"}}}}}catch{}const Ve=(e,t={leftAligned:"",rightAligned:"",centerAligned:""},a=!1)=>{if(!e)return null;const{bodyAlignment:l,headerAlignment:r,isHeader:o}=e;switch(o&&r?r:l){case b.LEFT:return a?b.LEFT:t.leftAligned;case b.RIGHT:return a?b.RIGHT:t.rightAligned;case b.CENTER:return a?b.CENTER:t.centerAligned;default:return a?b.LEFT:t.leftAligned}},In=(e,t=!1,a=0)=>{if(!e||e.length===0)return[];const l=e.every(o=>Array.isArray(o)),r=e.every(o=>typeof o=="string");return l&&t?e[a]||[]:r?e:(console.warn("getHeaderAlignment: alignments array contains a mix of strings and arrays, returning an empty array."),[])},Nn="_inputInTable_sdi21_1",jn="_inputHover_sdi21_13",wn="_inputFocus_sdi21_18",An="_inputError_sdi21_25",vn="_inputWarning_sdi21_26",Rn="_inputDisabled_sdi21_61",Sn="_hideScrollbars_sdi21_67",Tn="_cell_sdi21_77",Vn="_disabledLink_sdi21_87",qn="_inputWrapper_sdi21_91",En="_breakWord_sdi21_106",kn="_inputCell_sdi21_109",Wn="_sliderCell_sdi21_112",Hn="_staticCell_sdi21_116",Pn="_staticCellContent_sdi21_119",Ln="_error_sdi21_131",Fn="_warning_sdi21_132",Dn="_unit_sdi21_141",$n="_sortingCell_sdi21_144",On="_sortingCellIcon_sdi21_155",Bn="_icon_sdi21_166",Mn="_checkBoxCell_sdi21_170",Gn="_iconCellWrapper_sdi21_174",Un="_actionsCell_sdi21_178",Xn="_rightAligned_sdi21_186",zn="_centerAligned_sdi21_192",Jn="_leftAligned_sdi21_198",Kn="_popover_sdi21_201",Yn="_disabledPointerEvents_sdi21_204",i={inputInTable:Nn,inputHover:jn,inputFocus:wn,inputError:An,inputWarning:vn,inputDisabled:Rn,hideScrollbars:Sn,cell:Tn,disabledLink:Vn,inputWrapper:qn,breakWord:En,inputCell:kn,sliderCell:Wn,staticCell:Hn,staticCellContent:Pn,error:Ln,warning:Fn,unit:Dn,sortingCell:$n,sortingCellIcon:On,icon:Bn,checkBoxCell:Mn,iconCellWrapper:Gn,actionsCell:Un,rightAligned:Xn,centerAligned:zn,leftAligned:Jn,popover:Kn,disabledPointerEvents:Yn},te=({cell:e,columnAlignment:t,testId:a})=>n.jsx(Be,{name:e.name,value:e.value,onChange:l=>{var r;return(r=e.onChange)==null?void 0:r.call(e,l)},onPaste:l=>{var r;return(r=e.onPaste)==null?void 0:r.call(e,l)},placeholder:e.placeholder,error:e.error,warning:e.warning,disabled:e.disabled,isInTable:!0,maxTooltipWidth:e.maxTooltipWidth,right:t===b.RIGHT,testId:a,tabIndex:e.disabled?-1:0,tooltip:e.tooltip});try{te.displayName="InputCell",te.__docgenInfo={description:"",displayName:"InputCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IInputCell"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!1,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const re=({cell:e,testId:t})=>n.jsx(Me,{name:e.name,value:e.value,onChange:a=>{var l;return(l=e.onChange)==null?void 0:l.call(e,a)},placeholder:e.placeholder,error:e.error,warning:e.warning,disabled:e.disabled,isInTable:!0,left:e.left,tabIndex:e.disabled?-1:0,testId:t,tooltip:e.tooltip,validationCallback:e.validationCallback,allowEmpty:e.allowEmpty});try{re.displayName="NumberInputCell",re.__docgenInfo={description:"",displayName:"NumberInputCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"INumberInputCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const ae=({cell:e,columnAlignment:t,testId:a})=>n.jsx(Ge,{name:e.name,borderRadius:0,options:e.options,onChange:l=>{var r;return(r=e.onChange)==null?void 0:r.call(e,l)},onCreate:e.onCreate?l=>e.onCreate&&e.onCreate(l):void 0,error:e.error,warning:e.warning,disabled:e.disabled,placeholder:e.placeholder,isInTable:!0,value:e.value,native:e.native,clearable:e.clearable,searchable:e.searchable,deprecatedEventHandler:e.deprecatedEventHandler,maxTooltipWidth:e.maxTooltipWidth,width:"100%",autoLayerWidth:e.autoLayerWidth,right:t===b.RIGHT,testId:a,tabIndex:e.disabled?-1:0});try{ae.displayName="SelectCell",ae.__docgenInfo={description:"",displayName:"SelectCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ISelectCell"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!1,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const le=({cell:e,columnAlignment:t,testId:a})=>n.jsx("div",{className:i.inputWrapper,children:e.type==="Input"?n.jsx(te,{cell:e,columnAlignment:t,testId:a}):e.type==="NumberInput"?n.jsx(re,{cell:e,testId:a}):e.type==="Select"?n.jsx(ae,{cell:e,columnAlignment:t,testId:a}):null});try{le.displayName="InputCellWrapper",le.__docgenInfo={description:"",displayName:"InputCellWrapper",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"any"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!0,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const oe=({cell:e,testId:t})=>{const a=V.useContext(Ue),{error:l,warning:r,tooltip:o,maxTooltipWidth:s}=e,u=d=>O(d);return n.jsx("div",{className:i.inputWrapper,children:n.jsx(ye,{error:!!l,warning:!!r,text:o||l||r,enabled:u(o)||u(l)||u(r)||!1,maxWidth:s,placement:"bottom-center",children:n.jsx("div",{className:j(i.staticCellContent,l?i.error:r?i.warning:""),children:n.jsx("a",{className:j((e.disabled||a)&&i.disabledLink),onClick:e.disabled||a?void 0:d=>{var p;d.stopPropagation(),(p=e.onClick)==null||p.call(e,d)},"data-testid":t,children:e.value})})})})};try{oe.displayName="LinkCell",oe.__docgenInfo={description:"",displayName:"LinkCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ILinkCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const ie=({cell:e,testId:t})=>n.jsx(Xe,{label:e.label,checked:e.checked,isInTable:!0,disabled:e.disabled,onChange:a=>e.onChange(a),testId:t,tabIndex:e.disabled?-1:0});try{ie.displayName="CheckBoxCell",ie.__docgenInfo={description:"",displayName:"CheckBoxCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ICheckBoxCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const se=({cell:e})=>n.jsx("div",{className:i.inputWrapper,children:n.jsx(ze,{label:e.label,value:e.value,min:e.min,max:e.max,step:e.step,marks:e.marks,onChange:t=>e.onChange(t),showArrows:e.showArrows,showTooltip:e.showTooltip,tooltipFormatter:e.tooltipFormatter,disabled:e.disabled})});try{se.displayName="SliderCell",se.__docgenInfo={description:"",displayName:"SliderCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ISliderCell"}}}}}catch{}const de=({cell:e})=>{const{tooltip:t,icon:a}=e;return n.jsx("div",{className:i.iconCellWrapper,children:n.jsx(ye,{text:t,enabled:!!t&&O(t),display:"flex",placement:"top-center",children:n.jsx(B,{icon:a})})})};try{de.displayName="IconCell",de.__docgenInfo={description:"",displayName:"IconCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IIconCell"}}}}}catch{}const ce=({cell:e})=>n.jsx(fe,{actions:e.actions});try{ce.displayName="ActionsCell",ce.__docgenInfo={description:"",displayName:"ActionsCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IActionCell"}}}}}catch{}const ue=({cell:e})=>{const{helpIcon:t}=e;return t?n.jsx("div",{className:i.icon,children:n.jsx(Ee,{onClick:t.onClick,text:t.tooltip})}):null};try{ue.displayName="CellHelpIcon",ue.__docgenInfo={description:"",displayName:"CellHelpIcon",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IHelpIconCell"}}}}}catch{}const pe=({cell:e})=>{const{libraryIcon:t}=e;return t?n.jsx("div",{className:i.icon,children:n.jsx(Ee,{onClick:t.onClick,text:t.tooltip,icon:$.LIBRARY})}):null};try{pe.displayName="CellLibraryIcon",pe.__docgenInfo={description:"",displayName:"CellLibraryIcon",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ILibraryIconCell"}}}}}catch{}const me=({cell:e})=>{const{hasSort:t,sort:a,sortPriority:l}=e;return t?n.jsxs("span",{className:i.sortingCellIcon,children:[a==="down"?n.jsx(ee,{link:!0,children:n.jsx(B,{icon:$.SORT_ASCENDING})}):a==="up"?n.jsx(ee,{link:!0,children:n.jsx(B,{icon:$.SORT_DESCENDING})}):n.jsx(ee,{faint:!0,children:n.jsx(B,{icon:$.SORT_DESCENDING})}),l&&a?n.jsx("sup",{children:l}):null]}):null};try{me.displayName="Sort",me.__docgenInfo={description:"",displayName:"Sort",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"ISortCell"}}}}}catch{}const K=({cell:e,isHeader:t,testId:a})=>{const{error:l,warning:r,tooltip:o,maxTooltipWidth:s,hasSort:u,onSort:d,type:p}=e,c=n.jsxs("div",{className:j(i.staticCellContent,p==="Unit"?i.unit:"",l?i.error:r?i.warning:""),onClick:u?f=>d&&d(f):()=>{},"data-testid":a,children:[e.value,t?n.jsxs(n.Fragment,{children:[n.jsx(ue,{cell:e}),n.jsx(pe,{cell:e}),n.jsx(me,{cell:e})]}):null]});return n.jsx("div",{className:i.inputWrapper,children:n.jsx(ye,{error:!!l,warning:!!r,text:o||l||r,enabled:o&&O(o)||l&&O(l)||r&&O(r)||!1,maxWidth:s,display:"block",placement:"bottom-center",children:c})})};try{K.displayName="StaticCell",K.__docgenInfo={description:"",displayName:"StaticCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IStaticCell"}},isHeader:{defaultValue:null,description:"",name:"isHeader",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const _e=({cell:e,testId:t})=>{const{content:a,fullWidth:l,closeOnOutsideClick:r,disabled:o}=e;return n.jsx(Je,{content:a,fullWidth:l,closeOnOutsideClick:r,disabled:o,children:n.jsx("div",{className:i.popover,children:n.jsx(K,{cell:e,testId:t})})})};try{_e.displayName="PopoverCell",_e.__docgenInfo={description:"",displayName:"PopoverCell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"IPopoverCell"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const ge=({cell:e,isHeader:t,columnAlignment:a,testId:l})=>{if(!e)return null;switch(e.type){case"Input":case"NumberInput":case"Select":return n.jsx(le,{cell:e,columnAlignment:a,testId:l});case"Link":return n.jsx(oe,{cell:e,testId:l});case"CheckBox":return n.jsx(ie,{cell:e,testId:l});case"Slider":return n.jsx(se,{cell:e});case"Icon":return n.jsx(de,{cell:e});case"Actions":return n.jsx(ce,{cell:e});case"Popover":return n.jsx(_e,{cell:e});default:return n.jsx(K,{cell:e,isHeader:t,testId:l})}};try{ge.displayName="CellWrapper",ge.__docgenInfo={description:"",displayName:"CellWrapper",props:{cell:{defaultValue:null,description:"",name:"cell",required:!0,type:{name:"any"}},isHeader:{defaultValue:null,description:"",name:"isHeader",required:!0,type:{name:"boolean"}},columnAlignment:{defaultValue:null,description:"",name:"columnAlignment",required:!0,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}var S=(e=>(e.INPUT="Input",e.NUMBER_INPUT="NumberInput",e.SELECT="Select",e.POPOVER="Popover",e.SLIDER="Slider",e.CHECKBOX="CheckBox",e.ACTIONS="Actions",e))(S||{});const Y=({cell:e,isHeader:t,columnHeaderAlignment:a=b.LEFT,columnAlignment:l=b.LEFT,width:r,snapshot:o,testId:s})=>{if(!e)return null;const{style:u,colSpan:d,rowSpan:p,width:c}=e,f=V.useRef(null),g={bodyAlignment:l,headerAlignment:a,isHeader:t},P=Ve(g,i),C=Ve(g,i,!0),L=e.type===S.INPUT||e.type===S.NUMBER_INPUT||e.type===S.SELECT||e.type===S.POPOVER?i.inputCell:e.type===S.SLIDER?i.sliderCell:e.type===S.CHECKBOX?i.checkBoxCell:e.type===S.ACTIONS?i.actionsCell:i.staticCell,w=j(i.cell,L,e.hasSort?i.sortingCell:null,P,e.breakWord?i.breakWord:""),q=c??r??((o==null?void 0:o.isDragging)&&f.current&&f.current.offsetWidth)??void 0,x={width:q,minWidth:q,...u},A=t?"th":"td";return n.jsx(A,{ref:f,className:w,style:x,colSpan:d,rowSpan:p,children:n.jsx(ge,{cell:e,columnAlignment:C??b.RIGHT,isHeader:t,testId:s})})};try{Y.displayName="Cell",Y.__docgenInfo={description:"",displayName:"Cell",props:{cell:{defaultValue:null,description:"",name:"cell",required:!1,type:{name:"TCellShape"}},isHeader:{defaultValue:null,description:"",name:"isHeader",required:!0,type:{name:"boolean"}},columnHeaderAlignment:{defaultValue:{value:"Align.LEFT"},description:"",name:"columnHeaderAlignment",required:!1,type:{name:"string"}},columnAlignment:{defaultValue:{value:"Align.LEFT"},description:"",name:"columnAlignment",required:!1,type:{name:"Align.LEFT | Align.RIGHT | null"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber"}},snapshot:{defaultValue:null,description:"",name:"snapshot",required:!1,type:{name:"any"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const D=({row:e,rowIndex:t,isHeader:a=!1,columnCount:l,colSpan:r,columnHeaderAlignments:o=[],columnAlignment:s=[],hasRowActions:u,draggableTable:d=!1,snapshot:p=null,provided:c=null,width:f,columnWidths:g,testId:P})=>{const C=V.useRef(null),L=In(o,a,t),{onRowClick:w,onRowFocus:q,onRowMouseEnter:x,onRowMouseLeave:A,expandedContent:I,active:Q}=e,E=e.cells.map((h,v)=>{const he=`${a?0:1}_${t}_${v}`;return n.jsx(Y,{cell:h,isHeader:a,columnAlignment:s[v],columnHeaderAlignment:L[v],width:g?g[v]:void 0,snapshot:p,testId:h.testId},he)}),T=u&&n.jsx(Y,{cell:{type:S.ACTIONS,actions:e.actions},isHeader:a},l),k=(h,v)=>({minWidth:h&&`${f}px`,width:h&&"100%",display:h&&"table",background:h&&"var(--color-background-listitem-active)",border:h&&"var(--color-border)",borderTop:h&&0,opacity:h&&.1,...v}),W=()=>e.noDrag?n.jsx("td",{"aria-labelledby":"unique-label-id"}):n.jsx("td",{className:R.dragIconCell,children:n.jsx("div",{...c.dragHandleProps,className:R.dragIcon,children:n.jsx(B,{icon:$.DRAG})})});return a?n.jsxs(n.Fragment,{children:[n.jsxs("tr",{ref:C,onClick:w,onMouseEnter:x,onMouseLeave:A,onFocus:q,className:j(w?R.clickableRow:null,x?R.hoverableRow:null),children:[d?n.jsx("th",{}):null,E,T]},t),I&&I.content?n.jsx(J,{colSpan:r,flush:I.flush===!0,children:I.content},`${t}_expanded_content`):null]}):n.jsxs(n.Fragment,{children:[n.jsxs("tr",{onClick:w,onMouseEnter:x,onMouseLeave:A,onFocus:q,className:j(w&&!w.noStyle?R.clickableRow:null,x&&!x.noStyle?R.hoverableRow:null,Q?R.rowActive:null),ref:(c==null?void 0:c.innerRef)||null,...(c==null?void 0:c.draggableProps)||null,style:p&&c?k(p.isDragging,c.draggableProps.style):null,children:[d?W():null,E,T]},t),I&&I.content?n.jsx(J,{colSpan:r,flush:I.flush===!0,children:I.content},`${t}_expanded_content`):null]})};try{D.displayName="Row",D.__docgenInfo={description:"",displayName:"Row",props:{row:{defaultValue:null,description:"",name:"row",required:!0,type:{name:"TRowType"}},rowIndex:{defaultValue:null,description:"",name:"rowIndex",required:!0,type:{name:"number"}},isHeader:{defaultValue:{value:"false"},description:"",name:"isHeader",required:!1,type:{name:"boolean"}},columnCount:{defaultValue:null,description:"",name:"columnCount",required:!0,type:{name:"number"}},colSpan:{defaultValue:null,description:"",name:"colSpan",required:!0,type:{name:"number"}},columnHeaderAlignments:{defaultValue:{value:"[]"},description:"",name:"columnHeaderAlignments",required:!1,type:{name:"string[] | string[][]"}},columnAlignment:{defaultValue:{value:"[]"},description:"",name:"columnAlignment",required:!1,type:{name:"string[]"}},hasRowActions:{defaultValue:null,description:"",name:"hasRowActions",required:!0,type:{name:"boolean"}},draggableTable:{defaultValue:{value:"false"},description:"",name:"draggableTable",required:!1,type:{name:"boolean"}},snapshot:{defaultValue:{value:"null"},description:"",name:"snapshot",required:!1,type:{name:"any"}},provided:{defaultValue:{value:"null"},description:"",name:"provided",required:!1,type:{name:"any"}},width:{defaultValue:null,description:"",name:"width",required:!1,type:{name:"TStringOrNumber"}},columnWidths:{defaultValue:null,description:"",name:"columnWidths",required:!1,type:{name:"string[]"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}const qe=e=>{var Ie,Ne,je,we,Ae,ve,Re;const{onListReorder:t=()=>{},table:a}=e,{columnWidths:l,footer:r,name:o,rows:s=[],actions:u,actionsRight:d,columnHeaderAlignments:p,columnAlignment:c,striped:f=!0,testId:g,draggable:P,defaultEmptyRow:C=null,onAddRow:L=null,bordered:w=!0,maxHeight:q,fixedWidth:x}=a,A=V.useRef(null),[I,Q]=V.useState({width:0,height:0});V.useEffect(()=>{A.current&&Q({width:A.current.offsetWidth,height:A.current.offsetHeight})},[]);const E=De.get(e,"table.headers",[]),T=mn(s,E),k=_n(s,E),W=T+(k?1:0),h=r?((Ne=(Ie=r==null?void 0:r.pagination)==null?void 0:Ie.rowsPerPage)==null?void 0:Ne.value)===0||Number((je=r==null?void 0:r.pagination)==null?void 0:je.selectedPage)>=Number((we=r==null?void 0:r.pagination)==null?void 0:we.rowCount)/Number((ve=(Ae=r==null?void 0:r.pagination)==null?void 0:Ae.rowsPerPage)==null?void 0:ve.value):!0,v=((Re=C==null?void 0:C.cells)==null?void 0:Re.length)&&L&&h,ke={cells:v?C.cells.map((m,N)=>(m==null?void 0:m.type)==="Input"?{...m,onChange:_=>{var M;const y=(M=_==null?void 0:_.target)==null?void 0:M.value,F={...C,cells:C.cells.map((G,We)=>({...G,value:We===N?y:G==null?void 0:G.value}))};L({newRow:F})}}:{...m,disabled:!0}):null,testId:g?`${g}-last-empty-row`:void 0},Z=v?s.concat(ke):s,be={...a,rows:Z},Ce=j(H.wrapper,w?H.bordered:""),xe={maxHeight:q,width:x,display:x==="auto"?"inline-flex":"flex"};return P?n.jsxs("div",{ref:A,className:Ce,style:xe,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(Pe,{onDragEnd:m=>{var y,F;const N=(y=m==null?void 0:m.source)==null?void 0:y.index,_=(F=m==null?void 0:m.destination)==null?void 0:F.index;typeof N=="number"&&typeof _=="number"&&t({from:N,to:_})},children:n.jsx(Le,{droppableId:"droppable",children:m=>n.jsx(z,{table:be,children:({visibleRows:N})=>n.jsxs("table",{className:j(H.table,f?H.striped:""),"data-testid":g,ref:m.innerRef,children:[n.jsx("thead",{children:E.map((_,y)=>n.jsx(D,{rowIndex:y,isHeader:!0,row:_,columnCount:T,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p,draggableTable:P},`0_${y}`))}),n.jsxs("tbody",{children:[Z.slice(0,N).map((_,y)=>n.jsx(Fe,{draggableId:y+"",index:y,isDragDisabled:_.noDrag,children:(F,M)=>n.jsx(D,{rowIndex:y,row:_,columnCount:T,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,provided:F,snapshot:M,draggableTable:P,width:I.width},`1_${y}`)},`index_${y}`)),m.placeholder]})]})})})}),r&&n.jsx(X,{pagination:r.pagination,actions:r.actions,content:r.content})]}):n.jsxs("div",{className:Ce,style:xe,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(z,{table:be,children:({visibleRows:m})=>n.jsxs("table",{className:j(H.table,f?H.striped:""),"data-testid":g,children:[n.jsx("thead",{children:E.map((N,_)=>n.jsx(D,{rowIndex:_,isHeader:!0,row:N,columnCount:T,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p},`0_${_}`))}),n.jsx("tbody",{children:Z.slice(0,m).map((N,_)=>n.jsx(D,{rowIndex:_,row:N,columnCount:T,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c},`1_${_}`))})]})}),r&&n.jsx(X,{colSpan:W,pagination:r.pagination,actions:r.actions,content:r.content})]})};try{qe.displayName="Table",qe.__docgenInfo={description:"",displayName:"Table",props:{onListReorder:{defaultValue:null,description:"",name:"onListReorder",required:!1,type:{name:"((obj: { from: number; to: number; }) => void)"}},table:{defaultValue:null,description:"",name:"table",required:!0,type:{name:"{ name?: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined; ... 18 more ...; actions?: any; }"}}}}}catch{}export{qe as T};
@@ -1,4 +1,4 @@
1
- import{j as c}from"./jsx-runtime-f961835c.js";import{r as S}from"./index-f80c8c95.js";import{f as K}from"./immer.esm-5c06d4d0.js";import{l as ae}from"./lodash-75c70a11.js";import{T}from"./table-14d09eed.js";import{C as Ge}from"./card-0e97f333.js";import{I as ee}from"./input-d116362c.js";import{F as ne}from"./field-ea8dc7c8.js";import{H as Je}from"./heading-e7d165ab.js";import{t as Y,a as Xe,b as Ye,c as Ze,d as en,e as nn,f as tn,g as an}from"./table.stories-data-609c613f.js";import"./index-a80ed1cf.js";import"./index.es-ddd8aaab.js";import"./inheritsLoose-d4851ab8.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./index-3d476d02.js";import"./memoize-one.esm-52518564.js";import"./icon-afbea088.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-7f428221.js";import"./common-types-2c81813f.js";import"./button-1a6432ca.js";import"./spinner-cb92a546.js";import"./tooltip-23e84186.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-3abf067b.js";import"./pagination-cfbe0404.js";import"./select-c8f67cba.js";import"./assertThisInitialized-081f9914.js";import"./text-ad1f5f1d.js";import"./select.input-88b6ebab.js";import"./input-group-20c3add3.js";import"./input-group-addon-f8f6683a.js";import"./number-input-2867677b.js";import"./index-54f0d271.js";import"./check-box-7706d069.js";import"./help-icon-45458fb1.js";import"./slider-054cbf00.js";import"./index-c7f280f6.js";import"./popover-2bc1502d.js";import"./label-87bf6474.js";import"./flex-47732c42.js";const Jn={title:"Basic/Table",component:T,args:{table:{...Y}}},I=h=>c.jsx(T,{...h}),B=I.bind({}),N=I.bind({});N.args={table:{...Y,fixedWidth:"400px"}};const M=I.bind({});M.args={table:{...Y,fixedWidth:"auto"}};const O=I.bind({});O.args={table:Xe};O.parameters={docs:{description:{story:"Use sparingly when certain columns cannot be below a certain width. Unless the Table is auto width, set one column to `auto` to use remaining space."}}};const Q=I.bind({});Q.args={table:Ye};const W=I.bind({});W.args={table:Ze};W.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const _=I.bind({});_.args={table:en};const U=I.bind({});U.args={table:nn};U.decorators=[h=>c.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:c.jsx(h,{})})];const E=I.bind({});E.args={table:tn};E.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const L=I.bind({});L.args={table:an};const q=()=>c.jsx(Ge,{heading:c.jsx(Je,{children:"Card heading"}),padding:!1,children:c.jsx(T,{table:{...Y,bordered:!1}})});q.parameters={docs:{source:{type:"dynamic"}}};const z=()=>{const h=["Section","Width","Height"];let m=["","m","m"],o=[...Array(175).keys()].map((a,n)=>[n,n*2,n*2]);const k=(a,n,s)=>a==="m"&&n==="ft"?s*3.28084:a==="ft"&&n==="m"?s/3.28084:s,l=(a,n,s,u)=>{o[n][s]=a.target.value,u()},C=a=>{o=o.concat([["","",""]]),a()},A=(a,n)=>{o=o.filter((s,u)=>u!==a),n()},d=(a,n,s)=>{const u=m[n],y=a.target.value;m=m.map((R,b)=>b===n?y:R),o=o.map(R=>R.map((b,g)=>g===n?k(u,y,b):b)),s()},p=()=>{const a=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[n,s]=S.useState(10),[u,y]=S.useState(1),[R,b]=S.useState(!1),g=()=>{b(!R)},F=()=>{const e=Math.ceil(o.length/n);y(e)},D=(u-1)*n,t=n===0?o.length-1:D+n,i={headers:[{cells:h.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{C(g),F()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:m[1],type:"Select",native:!0,onChange:e=>d(e,1,g)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:m[2],type:"Select",native:!0,onChange:e=>d(e,2,g)}]}],rows:o.slice(D,t).map((e,r)=>{const x=D+r;return{cells:[...Array(3).keys()].map((f,w)=>({value:e[w],type:"Input",onChange:P=>l(P,x,w,g)})),actions:[{label:"Delete",icon:"minus",onClick:()=>A(x,g)}]}}),footer:{pagination:{rowCount:o.length,selectedPage:u,rowsPerPage:{onChange:e=>{const{value:r}=e.target;s(Number(r))},options:a,value:n},onSelectPage:e=>y(e),small:!0}}};return c.jsx(T,{table:i})};return c.jsx(p,{})},G=()=>{const h=["Section","Width","Height"];let m=[...Array(175).keys()].map((k,l)=>({Section:l,Width:l*2,Height:l*2}));const o=()=>{const k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[l,C]=S.useState(10),[A,d]=S.useState(1),[p,a]=S.useState({}),[n,s]=S.useState({});S.useEffect(()=>{d(1)},[p,n]);const u=(A-1)*l,y=l===0?m.length-1:u+l,R=(e,r,x)=>e.filter(f=>Object.keys(r).every(w=>r[w]===""?!0:f[w].toString().includes(r[w]))).sort((f,w)=>Object.entries(x).map(([P,j])=>{switch(j){case"up":return f[P]-w[P];case"down":return w[P]-f[P];default:return 0}}).reduce((P,j)=>P||j,0)),b=(e,r,x,f,w)=>{const P=e.map(v=>{const V=Object.keys(f).includes(v)?f[v]:"",H=`${v[0].toUpperCase()}${v.slice(1)}`;return{key:v,value:H,hasSort:!0,sort:V,onSort:()=>{const $=V===""?"up":V==="up"?"down":"";w({...f,[v]:$})}}}),j=e.map(v=>{const V=Object.keys(r).includes(v)?r[v]:"";return{key:v,value:V,type:"Input",placeholder:"Filter",onChange:H=>x({...r,[v]:H.target.value})}});return{dataSortCells:P,dataFilterCells:j}},{dataSortCells:g,dataFilterCells:F}=b(h,p,a,n,s),D=R(m,p,n),t=[...D.slice(u,y).map(e=>({cells:Object.entries(e).map(([x,f])=>({key:x,value:f,type:"Input",disabled:!0}))}))],i={headers:[{cells:g},{cells:F}],rows:t,footer:{pagination:{rowCount:D.length,selectedPage:A,rowsPerPage:{onChange:e=>{const{value:r}=e.target;C(Number(r))},options:k,value:l},onSelectPage:e=>d(e),small:!0}}};return c.jsx(T,{table:i})};return c.jsx(o,{})},J=()=>{const h={tea:3.6,coffee:3.2,orange:4.1},m=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],o={cells:[{type:"Select",options:m,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},k=[...Array(15).keys()].map((t,i)=>({cells:[{type:"Select",options:m,value:{value:"tea"}},{type:"Input",value:i+1},{type:"Static"}]})),[l,C]=S.useState(k),A=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[d,p]=S.useState(10),[a,n]=S.useState(1),s=(a-1)*d,u=d===0?l.length-1:s+d,y=({newRow:t}={})=>{const i=K(l,e=>{e.push(t??o)});C(i)},R=({rowIndex:t})=>{const i=K(l,e=>{delete e[t]}).filter(e=>e);C(i)},b=({rowIndex:t,value:i})=>{const e=K(l,r=>{r[t].cells[0].value.value=i});C(e)},g=({rowIndex:t,value:i})=>{const e=K(l,r=>{r[t].cells[1].value=i});C(e)},F=({value:t})=>{const i=Number(t);return!ae.isNaN(i)&&ae.isInteger(i)&&i>0},D=l.slice(s,u).map((t,i)=>{const e=s+i;return l.length-1,{...t,cells:t==null?void 0:t.cells.map((r,x)=>{var v,V,H,$,te;const f=(H=(V=(v=t==null?void 0:t.cells)==null?void 0:v[0])==null?void 0:V.value)==null?void 0:H.value,w=Number((te=($=t==null?void 0:t.cells)==null?void 0:$[1])==null?void 0:te.value),P=h==null?void 0:h[f],j=P&&F({value:w})?(P*w).toFixed(2):null;if(x===0)return{...r,onChange:Z=>b({rowIndex:e,value:Z.target.value})};if(x===1)return{...r,onChange:Z=>g({rowIndex:e,value:Z.target.value}),error:F({value:r.value})?null:"Must be valid whole number"};if(x===2)return{...r,value:j}}),actions:[{label:"Delete",icon:"minus",onClick:()=>R({rowIndex:e})}]}});return c.jsx(T,{table:{defaultEmptyRow:o,onAddRow:y,columnAlignment:["left","right","right"],headers:[{cells:[{value:"Drink"},{value:"Quantity"},{value:"Total Price (£)"}],actions:[{primary:!0,icon:"plus",label:"Add",onClick:()=>y()}]}],rows:D,footer:{pagination:{rowCount:l.length,selectedPage:a,rowsPerPage:{onChange:t=>{const{value:i}=t.target;p(Number(i))},options:A,value:d},onSelectPage:t=>n(t),small:!0}}}})},X=()=>{const h=["Section","Width","Height"];let m=Array.from(Array(10),(d,p)=>[p,p*2,p*2]);const[o,k]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),l=(d,p,a,n)=>{m[p][a]=Number(d.target.value),n()},C=(d,p,a,n)=>{var u;let s=((u=d==null?void 0:d.clipboardData)==null?void 0:u.getData("text"))??"";return k({rowIndex:p,cellIndex:a,pastedValues:s}),n(),{pastedData:o}},A=()=>{const[d,p]=S.useState(!1),a=()=>{p(!d)},n={headers:[{cells:h.map(s=>({value:s}))}],rows:m.map((s,u)=>{const y=u;return{cells:[...Array(3).keys()].map((R,b)=>({value:s[b],type:"Input",onChange:g=>l(g,y,b,a),onPaste:g=>C(g,y,b,a)}))}})};return c.jsxs(c.Fragment,{children:[c.jsx(T,{table:n}),c.jsx(ne,{label:"Pasted Data",children:c.jsx(ee,{value:o.pastedValues})}),c.jsx(ne,{label:"At Row",children:c.jsx(ee,{value:o.rowIndex})}),c.jsx(ne,{label:"At Cell Index",children:c.jsx(ee,{value:o.cellIndex})})]})};return c.jsx(A,{})};var re,se,oe;B.parameters={...B.parameters,docs:{...(re=B.parameters)==null?void 0:re.docs,source:{originalSource:`args => {
1
+ import{j as c}from"./jsx-runtime-f961835c.js";import{r as S}from"./index-f80c8c95.js";import{f as K}from"./immer.esm-5c06d4d0.js";import{l as ae}from"./lodash-75c70a11.js";import{T}from"./table-419ac141.js";import{C as Ge}from"./card-0e97f333.js";import{I as ee}from"./input-d116362c.js";import{F as ne}from"./field-ea8dc7c8.js";import{H as Je}from"./heading-e7d165ab.js";import{t as Y,a as Xe,b as Ye,c as Ze,d as en,e as nn,f as tn,g as an}from"./table.stories-data-0456a150.js";import"./index-a80ed1cf.js";import"./index.es-ddd8aaab.js";import"./inheritsLoose-d4851ab8.js";import"./redux-10ee6be7.js";import"./objectSpread2-fdee9b6d.js";import"./index-3d476d02.js";import"./memoize-one.esm-52518564.js";import"./icon-afbea088.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./disabled-context-d654f6ff.js";import"./actions-d843b059.js";import"./common-types-2c81813f.js";import"./button-1a6432ca.js";import"./spinner-cb92a546.js";import"./tooltip-23e84186.js";import"./types-cc224262.js";import"./types-332ceaf3.js";import"./badge-3abf067b.js";import"./pagination-c5f96ac2.js";import"./select-fb35923e.js";import"./assertThisInitialized-081f9914.js";import"./text-ad1f5f1d.js";import"./select.input-88b6ebab.js";import"./input-group-20c3add3.js";import"./input-group-addon-f8f6683a.js";import"./number-input-2867677b.js";import"./index-54f0d271.js";import"./check-box-7706d069.js";import"./help-icon-45458fb1.js";import"./slider-054cbf00.js";import"./index-c7f280f6.js";import"./popover-2bc1502d.js";import"./label-87bf6474.js";import"./flex-47732c42.js";const Jn={title:"Basic/Table",component:T,args:{table:{...Y}}},I=h=>c.jsx(T,{...h}),B=I.bind({}),N=I.bind({});N.args={table:{...Y,fixedWidth:"400px"}};const M=I.bind({});M.args={table:{...Y,fixedWidth:"auto"}};const O=I.bind({});O.args={table:Xe};O.parameters={docs:{description:{story:"Use sparingly when certain columns cannot be below a certain width. Unless the Table is auto width, set one column to `auto` to use remaining space."}}};const Q=I.bind({});Q.args={table:Ye};const W=I.bind({});W.args={table:Ze};W.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const _=I.bind({});_.args={table:en};const U=I.bind({});U.args={table:nn};U.decorators=[h=>c.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:c.jsx(h,{})})];const E=I.bind({});E.args={table:tn};E.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const L=I.bind({});L.args={table:an};const q=()=>c.jsx(Ge,{heading:c.jsx(Je,{children:"Card heading"}),padding:!1,children:c.jsx(T,{table:{...Y,bordered:!1}})});q.parameters={docs:{source:{type:"dynamic"}}};const z=()=>{const h=["Section","Width","Height"];let m=["","m","m"],o=[...Array(175).keys()].map((a,n)=>[n,n*2,n*2]);const k=(a,n,s)=>a==="m"&&n==="ft"?s*3.28084:a==="ft"&&n==="m"?s/3.28084:s,l=(a,n,s,u)=>{o[n][s]=a.target.value,u()},C=a=>{o=o.concat([["","",""]]),a()},A=(a,n)=>{o=o.filter((s,u)=>u!==a),n()},d=(a,n,s)=>{const u=m[n],y=a.target.value;m=m.map((R,b)=>b===n?y:R),o=o.map(R=>R.map((b,g)=>g===n?k(u,y,b):b)),s()},p=()=>{const a=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[n,s]=S.useState(10),[u,y]=S.useState(1),[R,b]=S.useState(!1),g=()=>{b(!R)},F=()=>{const e=Math.ceil(o.length/n);y(e)},D=(u-1)*n,t=n===0?o.length-1:D+n,i={headers:[{cells:h.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{C(g),F()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:m[1],type:"Select",native:!0,onChange:e=>d(e,1,g)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:m[2],type:"Select",native:!0,onChange:e=>d(e,2,g)}]}],rows:o.slice(D,t).map((e,r)=>{const x=D+r;return{cells:[...Array(3).keys()].map((f,w)=>({value:e[w],type:"Input",onChange:P=>l(P,x,w,g)})),actions:[{label:"Delete",icon:"minus",onClick:()=>A(x,g)}]}}),footer:{pagination:{rowCount:o.length,selectedPage:u,rowsPerPage:{onChange:e=>{const{value:r}=e.target;s(Number(r))},options:a,value:n},onSelectPage:e=>y(e),small:!0}}};return c.jsx(T,{table:i})};return c.jsx(p,{})},G=()=>{const h=["Section","Width","Height"];let m=[...Array(175).keys()].map((k,l)=>({Section:l,Width:l*2,Height:l*2}));const o=()=>{const k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[l,C]=S.useState(10),[A,d]=S.useState(1),[p,a]=S.useState({}),[n,s]=S.useState({});S.useEffect(()=>{d(1)},[p,n]);const u=(A-1)*l,y=l===0?m.length-1:u+l,R=(e,r,x)=>e.filter(f=>Object.keys(r).every(w=>r[w]===""?!0:f[w].toString().includes(r[w]))).sort((f,w)=>Object.entries(x).map(([P,j])=>{switch(j){case"up":return f[P]-w[P];case"down":return w[P]-f[P];default:return 0}}).reduce((P,j)=>P||j,0)),b=(e,r,x,f,w)=>{const P=e.map(v=>{const V=Object.keys(f).includes(v)?f[v]:"",H=`${v[0].toUpperCase()}${v.slice(1)}`;return{key:v,value:H,hasSort:!0,sort:V,onSort:()=>{const $=V===""?"up":V==="up"?"down":"";w({...f,[v]:$})}}}),j=e.map(v=>{const V=Object.keys(r).includes(v)?r[v]:"";return{key:v,value:V,type:"Input",placeholder:"Filter",onChange:H=>x({...r,[v]:H.target.value})}});return{dataSortCells:P,dataFilterCells:j}},{dataSortCells:g,dataFilterCells:F}=b(h,p,a,n,s),D=R(m,p,n),t=[...D.slice(u,y).map(e=>({cells:Object.entries(e).map(([x,f])=>({key:x,value:f,type:"Input",disabled:!0}))}))],i={headers:[{cells:g},{cells:F}],rows:t,footer:{pagination:{rowCount:D.length,selectedPage:A,rowsPerPage:{onChange:e=>{const{value:r}=e.target;C(Number(r))},options:k,value:l},onSelectPage:e=>d(e),small:!0}}};return c.jsx(T,{table:i})};return c.jsx(o,{})},J=()=>{const h={tea:3.6,coffee:3.2,orange:4.1},m=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],o={cells:[{type:"Select",options:m,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},k=[...Array(15).keys()].map((t,i)=>({cells:[{type:"Select",options:m,value:{value:"tea"}},{type:"Input",value:i+1},{type:"Static"}]})),[l,C]=S.useState(k),A=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[d,p]=S.useState(10),[a,n]=S.useState(1),s=(a-1)*d,u=d===0?l.length-1:s+d,y=({newRow:t}={})=>{const i=K(l,e=>{e.push(t??o)});C(i)},R=({rowIndex:t})=>{const i=K(l,e=>{delete e[t]}).filter(e=>e);C(i)},b=({rowIndex:t,value:i})=>{const e=K(l,r=>{r[t].cells[0].value.value=i});C(e)},g=({rowIndex:t,value:i})=>{const e=K(l,r=>{r[t].cells[1].value=i});C(e)},F=({value:t})=>{const i=Number(t);return!ae.isNaN(i)&&ae.isInteger(i)&&i>0},D=l.slice(s,u).map((t,i)=>{const e=s+i;return l.length-1,{...t,cells:t==null?void 0:t.cells.map((r,x)=>{var v,V,H,$,te;const f=(H=(V=(v=t==null?void 0:t.cells)==null?void 0:v[0])==null?void 0:V.value)==null?void 0:H.value,w=Number((te=($=t==null?void 0:t.cells)==null?void 0:$[1])==null?void 0:te.value),P=h==null?void 0:h[f],j=P&&F({value:w})?(P*w).toFixed(2):null;if(x===0)return{...r,onChange:Z=>b({rowIndex:e,value:Z.target.value})};if(x===1)return{...r,onChange:Z=>g({rowIndex:e,value:Z.target.value}),error:F({value:r.value})?null:"Must be valid whole number"};if(x===2)return{...r,value:j}}),actions:[{label:"Delete",icon:"minus",onClick:()=>R({rowIndex:e})}]}});return c.jsx(T,{table:{defaultEmptyRow:o,onAddRow:y,columnAlignment:["left","right","right"],headers:[{cells:[{value:"Drink"},{value:"Quantity"},{value:"Total Price (£)"}],actions:[{primary:!0,icon:"plus",label:"Add",onClick:()=>y()}]}],rows:D,footer:{pagination:{rowCount:l.length,selectedPage:a,rowsPerPage:{onChange:t=>{const{value:i}=t.target;p(Number(i))},options:A,value:d},onSelectPage:t=>n(t),small:!0}}}})},X=()=>{const h=["Section","Width","Height"];let m=Array.from(Array(10),(d,p)=>[p,p*2,p*2]);const[o,k]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),l=(d,p,a,n)=>{m[p][a]=Number(d.target.value),n()},C=(d,p,a,n)=>{var u;let s=((u=d==null?void 0:d.clipboardData)==null?void 0:u.getData("text"))??"";return k({rowIndex:p,cellIndex:a,pastedValues:s}),n(),{pastedData:o}},A=()=>{const[d,p]=S.useState(!1),a=()=>{p(!d)},n={headers:[{cells:h.map(s=>({value:s}))}],rows:m.map((s,u)=>{const y=u;return{cells:[...Array(3).keys()].map((R,b)=>({value:s[b],type:"Input",onChange:g=>l(g,y,b,a),onPaste:g=>C(g,y,b,a)}))}})};return c.jsxs(c.Fragment,{children:[c.jsx(T,{table:n}),c.jsx(ne,{label:"Pasted Data",children:c.jsx(ee,{value:o.pastedValues})}),c.jsx(ne,{label:"At Row",children:c.jsx(ee,{value:o.rowIndex})}),c.jsx(ne,{label:"At Cell Index",children:c.jsx(ee,{value:o.cellIndex})})]})};return c.jsx(A,{})};var re,se,oe;B.parameters={...B.parameters,docs:{...(re=B.parameters)==null?void 0:re.docs,source:{originalSource:`args => {
2
2
  return <Table
3
3
  // eslint-disable-next-line react/jsx-props-no-spreading
4
4
  {...args} />;