@oliasoft-open-source/react-ui-library 4.3.2 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2645 -2
- package/dist/404.html +1 -1
- package/dist/assets/{index-KHBkFPvW.js → index-vJcZHmMH.js} +2 -1
- package/dist/index.html +1 -1
- package/dist/storybook/assets/{Color-6VNJS4EI-N_ztWf-2.js → Color-6VNJS4EI-fNEnxQ05.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-NNNQARDV-n9vPiSxN.js → DocsRenderer-NNNQARDV-KMTyUuTi.js} +1 -1
- package/dist/storybook/assets/{WithTooltip-4HIR6TLV-SapwsMVA.js → WithTooltip-4HIR6TLV-29nNQIoq.js} +1 -1
- package/dist/storybook/assets/{accordion.stories-1Yd6WIbt.js → accordion.stories-gltYKUzg.js} +1 -1
- package/dist/storybook/assets/{actions-ESle7xCw.js → actions-Z9jDWreP.js} +1 -1
- package/dist/storybook/assets/actions.stories-Qrio9EMy.js +1 -0
- package/dist/storybook/assets/{afe.stories-4IYdV9SC.js → afe.stories-Vnsgz9Oy.js} +1 -1
- package/dist/storybook/assets/{blowout.stories-KO5_m0Xn.js → blowout.stories-BXWf5R9h.js} +1 -1
- package/dist/storybook/assets/{buttons-and-links-tNxsA8cW.js → buttons-and-links-veHns3Q1.js} +1 -1
- package/dist/storybook/assets/{casing-loads.stories-Yonx5Xjy.js → casing-loads.stories-ZzYedx2i.js} +1 -1
- package/dist/storybook/assets/{cell.stories-Ai43vY3p.js → cell.stories-AfSTiUk8.js} +1 -1
- package/dist/storybook/assets/{chunk-HLWAVYOI-vQmBbPB0.js → chunk-HLWAVYOI-mGXCf4xj.js} +1 -1
- package/dist/storybook/assets/{color-vWRh3Qae.js → color-tLDnWSIG.js} +1 -1
- package/dist/storybook/assets/{drawer.stories-yRZlQHoV.js → drawer.stories-ezk4vO0w.js} +1 -1
- package/dist/storybook/assets/{file-input.stories-wkU6vhN2.js → file-input.stories-UaDciacM.js} +1 -1
- package/dist/storybook/assets/{footer.stories-sVnY5dxB.js → footer.stories-bp50SxzB.js} +1 -1
- package/dist/storybook/assets/{form.stories-vqEAUdaV.js → form.stories-XCXzg5lT.js} +1 -1
- package/dist/storybook/assets/{formation.stories-EZGmfE0B.js → formation.stories-5x0HcI_o.js} +1 -1
- package/dist/storybook/assets/{formatter-SWP5E3XI-JiERVZcR.js → formatter-SWP5E3XI-6m6W7NB7.js} +1 -1
- package/dist/storybook/assets/{iframe-MASZ_taO.js → iframe-AtjhTGyx.js} +2 -2
- package/dist/storybook/assets/{index-VjG8bBMn.js → index-PqLI7NLX.js} +5 -5
- package/dist/storybook/assets/{input-group.stories-o6aJnQk-.js → input-group.stories-WljyIQ0a.js} +1 -1
- package/dist/storybook/assets/{input-validation-MPaWGcuk.js → input-validation-DXz2wD-a.js} +1 -1
- package/dist/storybook/assets/{inputs-Sm5fiswx.js → inputs-XRPZnL3K.js} +1 -1
- package/dist/storybook/assets/{layout-forms-VHDoIwjI.js → layout-forms-ZNGJC4ku.js} +1 -1
- package/dist/storybook/assets/{layout-general-QHIsmA1E.js → layout-general-ZjVDSo7T.js} +1 -1
- package/dist/storybook/assets/{list-AFiJglj_.js → list-8l-RGDgw.js} +1 -1
- package/dist/storybook/assets/{list-heading-aUkU7WVX.js → list-heading-Vd3hu5Pf.js} +1 -1
- package/dist/storybook/assets/{list.stories-data-diC_-6U8.js → list.stories-data-9RrIjRci.js} +1 -1
- package/dist/storybook/assets/{list.stories-W1gjIbW0.js → list.stories-uR6izjvO.js} +1 -1
- package/dist/storybook/assets/{menu.stories-5QTqzc0j.js → menu.stories-5G4phywO.js} +1 -1
- package/dist/storybook/assets/{modal.stories-0tVFnKsk.js → modal.stories-15sY1c5H.js} +1 -1
- package/dist/storybook/assets/{number-input.stories-Y4KCEwyl.js → number-input.stories-BURENIFo.js} +1 -1
- package/dist/storybook/assets/{option-dropdown.stories-BZFwP6Yb.js → option-dropdown.stories-M-9T9SPD.js} +1 -1
- package/dist/storybook/assets/{padding-and-spacing-8Wu8yRXq.js → padding-and-spacing-jFhAKOb3.js} +1 -1
- package/dist/storybook/assets/{page.stories--UKnMSnH.js → page.stories-9XUTUblI.js} +1 -1
- package/dist/storybook/assets/{pagination-xSK12Mw6.js → pagination-5n5spTRo.js} +1 -1
- package/dist/storybook/assets/{pagination.stories-QCBvGl43.js → pagination.stories-g4a-aSxq.js} +1 -1
- package/dist/storybook/assets/{popover.stories-A0yFzv01.js → popover.stories-bWBLR9fB.js} +1 -1
- package/dist/storybook/assets/{preview-gGv3xOED.js → preview--FJCNxDW.js} +2 -2
- package/dist/storybook/assets/{preview-a0xf0jE3.js → preview-iJSm7cbB.js} +1 -1
- package/dist/storybook/assets/{projects.stories-th_1Q6JE.js → projects.stories-84p22lkF.js} +1 -1
- package/dist/storybook/assets/{reservoirs.stories-8TqqVc0I.js → reservoirs.stories-lSGho6cn.js} +1 -1
- package/dist/storybook/assets/{rich-text-input.stories-GdgPkhki.js → rich-text-input.stories-7UzvJ-A1.js} +1 -1
- package/dist/storybook/assets/{row.stories-bgcrzXdg.js → row.stories-PI3ZuTkd.js} +1 -1
- package/dist/storybook/assets/{select-5jrVNbFb.js → select-JjEPivho.js} +1 -1
- package/dist/storybook/assets/{select.stories-CHb_zXq1.js → select.stories-YmcYKg5S.js} +1 -1
- package/dist/storybook/assets/{site.stories-DZWVugCr.js → site.stories-kQfgnXtd.js} +1 -1
- package/dist/storybook/assets/{syntaxhighlighter-NMPM6SWI-sxd_zSAO.js → syntaxhighlighter-NMPM6SWI-_gbIaGwd.js} +1 -1
- package/dist/storybook/assets/{table-GUPoXZvd.js → table-KQyoQ8Lr.js} +1 -1
- package/dist/storybook/assets/{table.stories--_S1ugBI.js → table.stories-Fm6V6i5a.js} +1 -1
- package/dist/storybook/assets/{table.stories-data-I6ced_TS.js → table.stories-data-9XfBJddg.js} +1 -1
- package/dist/storybook/assets/{textarea-4DUPP53K.js → textarea-G-2zTY2v.js} +1 -1
- package/dist/storybook/assets/{textarea.stories-vQSCjGav.js → textarea.stories-Uc6PIiD1.js} +1 -1
- package/dist/storybook/assets/{title.stories-Iv83hSjO.js → title.stories-txOeNeeh.js} +1 -1
- package/dist/storybook/assets/{tooltip.test-case.stories-3XN1XAsX.js → tooltip.test-case.stories-3T_tzhJs.js} +1 -1
- package/dist/storybook/assets/{top-bar-C1c_2fzK.js → top-bar-3dxv0sp9.js} +1 -1
- package/dist/storybook/assets/{top-bar.stories-__ExKqyI.js → top-bar.stories-sMvXnmhR.js} +1 -1
- package/dist/storybook/assets/{top-bar.testcase.stories-IBxNcBB7.js → top-bar.testcase.stories-Nb8fdPBS.js} +1 -1
- package/dist/storybook/assets/{tree.stories-Qj5XiDg8.js → tree.stories-_5t-Rrls.js} +1 -1
- package/dist/storybook/assets/{unit-input.stories-W6qu5wAu.js → unit-input.stories-SeRH17v8.js} +1 -1
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/project.json +1 -1
- package/package.json +1 -1
- package/dist/storybook/assets/actions.stories-e6y9BT7N.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as m}from"./jsx-runtime-FsUICBgo.js";import{r as j,g as Ue}from"./index-RfLt4OUa.js";import{c as U}from"./index-VW3EWkuE.js";import{G as re,I as Fe}from"./common-types-U65vzrrz.js";import{D as Se}from"./disabled-context-urNQThQz.js";import{i as te}from"./types-5uVBABF4.js";import{T as Ie,u as ze,m as Ge}from"./tooltip-HEHiU__l.js";import{p as $e}from"./index-4QtD-hFu.js";import"./lodash-Bmg8FrMx.js";import{_ as Ke}from"./extends-dGVwEr9R.js";import{_ as Ee}from"./assertThisInitialized-4q6YPdh3.js";import{_ as Ye}from"./inheritsLoose-Y9jOMJLd.js";import{m as ie}from"./memoize-one.esm-hqe5SRxC.js";import{M as ae}from"./types-VB5zD18b.js";import{T as se}from"./text-6KQ6ntOV.js";import{A as Be}from"./actions-ESle7xCw.js";import{I as ue}from"./icon-y1a2N5SZ.js";import{s as Xe}from"./select.input-zP5tW20f.js";const Je="_inputInTable_2ynxq_1",Ze="_inputHover_2ynxq_13",Qe="_inputFocus_2ynxq_18",et="_inputError_2ynxq_25",tt="_inputWarning_2ynxq_26",nt="_inputDisabled_2ynxq_61",lt="_hideScrollbars_2ynxq_67",rt="_select_2ynxq_77",at="_isInTable_2ynxq_121",it="_unSelected_2ynxq_133",ot="_error_2ynxq_140",st="_warning_2ynxq_157",ut="_small_2ynxq_174",ct="_right_2ynxq_182",dt="_groupOrderFirst_2ynxq_193",pt="_groupOrderMiddle_2ynxq_194",ft="_groupOrderLast_2ynxq_198",W={inputInTable:Je,inputHover:Ze,inputFocus:Qe,inputError:et,inputWarning:tt,inputDisabled:nt,hideScrollbars:lt,select:rt,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:r=null,tooltip:d=null,options:c,onChange:y=()=>{},onFocus:f=()=>{},onBlur:i=()=>{},right:o=!1,small:h=!1,tabIndex:v=0,selectedOption:b,width:E=null,groupOrder:I=null,testId:S,isInTable:n=!1,clearable:s,placeholder:a,hasNonExistentValue:l,maxTooltipWidth:u,borderRadius:p})=>{const g=j.useContext(Se),_=b===null||(b==null?void 0:b.value)===null?"unselected":b==null?void 0:b.value,O=_==="unselected",C=(_==="unselected"||s?[m.jsx("option",{value:"unselected",disabled:!s,hidden:!s,children:a||"Select..."},"unselected")]:[]).concat(l?[m.jsx("option",{value:b==null?void 0:b.value,disabled:e||g,children:b==null?void 0:b.label},"selectedNonExistentValue")]:[]).concat(c.map((V,T)=>m.jsx("option",{value:V.value,"data-testid":V.testId,children:V.label},T))),q=(()=>{if(I)switch(I){case re.FIRST:return W.groupOrderFirst;case re.LAST:return W.groupOrderLast;default:return W.groupOrderMiddle}return""})();return m.jsx(Ie,{error:!!t,warning:!!r,text:d||t||r,enabled:d&&te(d)||t&&te(t)||r&&te(r)||!1,maxWidth:u,placement:"bottom-center",children:m.jsx("select",{className:U(W.select,O?W.unSelected:"",t?W.error:r?W.warning:"",o?W.right:"",h?W.small:"",n?W.isInTable:"",q),style:{width:E||"",borderRadius:p||""},onChange:V=>{const{value:T}=V.target;let R;T==="unselected"?R={value:null}:R=c.find(F=>String(F.value)===String(T))||{value:null},y(V,R)},onFocus:f,onBlur:i,tabIndex:v,value:_,disabled:e||g,"data-testid":S,children:C})})};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 Ae={exports:{}};(function(e,t){(function(r,d){e.exports=d(j,$e)})(window,function(r,d){return function(c){var y={};function f(i){if(y[i])return y[i].exports;var o=y[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=y,f.d=function(i,o,h){f.o(i,o)||Object.defineProperty(i,o,{enumerable:!0,get:h})},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 h=Object.create(null);if(f.r(h),Object.defineProperty(h,"default",{enumerable:!0,value:i}),2&o&&typeof i!="string")for(var v in i)f.d(h,v,(function(b){return i[b]}).bind(null,v));return h},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,y,f){Object.defineProperty(y,"__esModule",{value:!0});var i=f(1);Object.defineProperty(y,"default",{enumerable:!0,get:function(){return function(o){return o&&o.__esModule?o:{default:o}}(i).default}}),c.exports=y.default},function(c,y,f){Object.defineProperty(y,"__esModule",{value:!0});var i=Object.assign||function(n){for(var s=1;s<arguments.length;s++){var a=arguments[s];for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(n[l]=a[l])}return n},o=function(){function n(s,a){for(var l=0;l<a.length;l++){var u=a[l];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,a,l){return a&&n(s.prototype,a),l&&n(s,l),s}}(),h=E(f(2)),v=E(f(3)),b=f(4);function E(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 l=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 l.handleKeyboardEvent=l.handleKeyboardEvent.bind(l),l.registerExclusiveHandler=l.registerExclusiveHandler.bind(l),l.deregisterExclusiveHandler=l.deregisterExclusiveHandler.bind(l),l}return function(a,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof l);a.prototype=Object.create(l&&l.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),l&&(Object.setPrototypeOf?Object.setPrototypeOf(a,l):a.__proto__=l)}(s,h.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,l=a.isExclusive,u=a.isDisabled;l&&!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 l=a.isExclusive,u=a.isDisabled;(this.props.isExclusive!==l||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(l){return l!==a}))}},{key:"handleKeyboardEvent",value:function(a){var l=this.props,u=l.isDisabled,p=l.handleKeys,g=l.onKeyEvent,_=l.handleEventType,O=l.children,C=l.handleFocusableElements;if(u||_!==a.type||I.length>0&&I[0]!==this)return!1;var q=a.target===document.body||C,V=this.childrenContainer&&this.childrenContainer.contains(a.target);if(!(O?V:q))return!1;var T=(0,b.findMatchedKey)(a,p);return!!T&&(g(T,a),!0)}},{key:"render",value:function(){var a=this,l=this.props.children,u=Object.assign({},this.props),p=!0,g=!1,_=void 0;try{for(var O,C=Object.keys(s.propTypes)[Symbol.iterator]();!(p=(O=C.next()).done);p=!0)delete u[O.value]}catch(q){g=!0,_=q}finally{try{!p&&C.return&&C.return()}finally{if(g)throw _}}return l?h.default.createElement("span",i({ref:function(q){a.childrenContainer=q}},u),l):null}}]),s}();y.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=y.default},function(c,y){c.exports=r},function(c,y){c.exports=d},function(c,y,f){function i(l,u,p){return u in l?Object.defineProperty(l,u,{value:p,enumerable:!0,configurable:!0,writable:!0}):l[u]=p,l}Object.defineProperty(y,"__esModule",{value:!0}),y.matchKeyEvent=a,y.findMatchedKey=function(l,u){var p=u.map(function(g){var _=g.toLowerCase(),O=s[_];return O||[g]}).reduce(function(g,_){return g.concat(_)},[]).find(function(g){return a(l,g)});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]},h=Object.keys(o).reduce(function(l,u){return Object.assign(l,i({},u.toUpperCase(),o[u]))},{}),v="0123456789".split("").reduce(function(l,u,p){return Object.assign(l,i({},u,[p+48,p+96]))},{}),b="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").reduce(function(l,u,p){return Object.assign(l,i({},u.toLowerCase(),[p+65]),i({},u,[p+65]))},{}),E="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19".split(",").reduce(function(l,u,p){return Object.assign(l,i({},"f"+u,[p+112]))},{}),I={control:"ctrl",ctrl:"ctrl",shift:"shift",meta:"meta",cmd:"meta",command:"meta",option:"alt",alt:"alt"},S=y.AllKeys=Object.assign({},o,h,v,b,E),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(E)};function a(l,u){var p=l.which||l.keyCode,g=l.type,_=Object.keys(I).filter(function(F){return l[F+"Key"]}).sort(),O=u.toLowerCase().trim(),C=O==="+"?["+"]:O.split(/\s?\+\s?/),q=C.pop(),V=S[q],T=C;if(g==="keypress")return u==String.fromCharCode(p).toLowerCase();if(T.length===0&&_.length===0)return V.indexOf(p)>=0;if(T.length>0&&_.length>0){var R=T.map(function(F){return I[F]}).sort(),A=R.length===_.length&&R.every(function(F,z){return _[z]===F});return V.indexOf(p)>=0&&A}return T.length==0&&_.length===1&&q===_[0]}}])})})(Ae);var mt=Ae.exports;const yt=Ue(mt),we=()=>{const e=j.useRef(null);return[e,()=>{e.current&&e.current.focus()}]},Pe=()=>{const[e,t]=j.useState(!1);return j.useEffect(()=>{(async()=>{document.fonts&&await document.fonts.ready.then(()=>t(!0))})()},[]),e};var ht=typeof performance=="object"&&typeof performance.now=="function",xe=ht?function(){return performance.now()}:function(){return Date.now()};function Te(e){cancelAnimationFrame(e.id)}function gt(e,t){var r=xe();function d(){xe()-r>=t?e.call(null):c.id=requestAnimationFrame(d)}var c={id:requestAnimationFrame(d)};return c}var oe=-1;function qe(e){if(e===void 0&&(e=!1),oe===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),oe=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return oe}var ee=null;function Ce(e){if(e===void 0&&(e=!1),ee===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.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?ee="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ee="negative":ee="positive-ascending"),document.body.removeChild(t),ee}return ee}var _t=150,bt=function(t,r){return t};function vt(e){var t,r=e.getItemOffset,d=e.getEstimatedTotalSize,c=e.getItemSize,y=e.getOffsetForIndexAndAlignment,f=e.getStartIndexForOffset,i=e.getStopIndexForStartIndex,o=e.initInstanceProps,h=e.shouldResetStyleCacheOnItemSizeChange,v=e.validateProps;return t=function(b){Ye(E,b);function E(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,l,u){return n.props.onItemsRendered({overscanStartIndex:s,overscanStopIndex:a,visibleStartIndex:l,visibleStopIndex:u})}),n._callOnScroll=void 0,n._callOnScroll=ie(function(s,a,l){return n.props.onScroll({scrollDirection:s,scrollOffset:a,scrollUpdateWasRequested:l})}),n._getItemStyle=void 0,n._getItemStyle=function(s){var a=n.props,l=a.direction,u=a.itemSize,p=a.layout,g=n._getItemStyleCache(h&&u,h&&p,h&&l),_;if(g.hasOwnProperty(s))_=g[s];else{var O=r(n.props,s,n._instanceProps),C=c(n.props,s,n._instanceProps),q=l==="horizontal"||p==="horizontal",V=l==="rtl",T=q?O:0;g[s]=_={position:"absolute",left:V?void 0:T,right:V?T:void 0,top:q?0:O,height:q?"100%":C,width:q?C:"100%"}}return _},n._getItemStyleCache=void 0,n._getItemStyleCache=ie(function(s,a,l){return{}}),n._onScrollHorizontal=function(s){var a=s.currentTarget,l=a.clientWidth,u=a.scrollLeft,p=a.scrollWidth;n.setState(function(g){if(g.scrollOffset===u)return null;var _=n.props.direction,O=u;if(_==="rtl")switch(Ce()){case"negative":O=-u;break;case"positive-descending":O=p-l-u;break}return O=Math.max(0,Math.min(O,p-l)),{isScrolling:!0,scrollDirection:g.scrollOffset<u?"forward":"backward",scrollOffset:O,scrollUpdateWasRequested:!1}},n._resetIsScrollingDebounced)},n._onScrollVertical=function(s){var a=s.currentTarget,l=a.clientHeight,u=a.scrollHeight,p=a.scrollTop;n.setState(function(g){if(g.scrollOffset===p)return null;var _=Math.max(0,Math.min(p,u-l));return{isScrolling:!0,scrollDirection:g.scrollOffset<_?"forward":"backward",scrollOffset:_,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}E.getDerivedStateFromProps=function(n,s){return St(n,s),v(n),null};var I=E.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,l=a.itemCount,u=a.layout,p=this.state.scrollOffset;n=Math.max(0,Math.min(n,l-1));var g=0;if(this._outerRef){var _=this._outerRef;u==="vertical"?g=_.scrollWidth>_.clientWidth?qe():0:g=_.scrollHeight>_.clientHeight?qe():0}this.scrollTo(y(this.props,n,s,p,this._instanceProps,g))},I.componentDidMount=function(){var n=this.props,s=n.direction,a=n.initialScrollOffset,l=n.layout;if(typeof a=="number"&&this._outerRef!=null){var u=this._outerRef;s==="horizontal"||l==="horizontal"?u.scrollLeft=a:u.scrollTop=a}this._callPropsCallbacks()},I.componentDidUpdate=function(){var n=this.props,s=n.direction,a=n.layout,l=this.state,u=l.scrollOffset,p=l.scrollUpdateWasRequested;if(p&&this._outerRef!=null){var g=this._outerRef;if(s==="horizontal"||a==="horizontal")if(s==="rtl")switch(Ce()){case"negative":g.scrollLeft=-u;break;case"positive-ascending":g.scrollLeft=u;break;default:var _=g.clientWidth,O=g.scrollWidth;g.scrollLeft=O-_-u;break}else g.scrollLeft=u;else g.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,l=n.direction,u=n.height,p=n.innerRef,g=n.innerElementType,_=n.innerTagName,O=n.itemCount,C=n.itemData,q=n.itemKey,V=q===void 0?bt:q,T=n.layout,R=n.outerElementType,A=n.outerTagName,F=n.style,z=n.useIsScrolling,K=n.width,G=this.state.isScrolling,P=l==="horizontal"||T==="horizontal",M=P?this._onScrollHorizontal:this._onScrollVertical,X=this._getRangeToRender(),ne=X[0],le=X[1],J=[];if(O>0)for(var H=ne;H<=le;H++)J.push(j.createElement(s,{data:C,key:V(H,C),index:H,isScrolling:z?G:void 0,style:this._getItemStyle(H)}));var Z=d(this.props,this._instanceProps);return j.createElement(R||A||"div",{className:a,onScroll:M,ref:this._outerRefSetter,style:Ke({position:"relative",height:u,width:K,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:l},F)},j.createElement(g||_||"div",{children:J,ref:p,style:{height:P?"100%":Z,pointerEvents:G?"none":void 0,width:P?Z:"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],l=s[1],u=s[2],p=s[3];this._callOnItemsRendered(a,l,u,p)}}if(typeof this.props.onScroll=="function"){var g=this.state,_=g.scrollDirection,O=g.scrollOffset,C=g.scrollUpdateWasRequested;this._callOnScroll(_,O,C)}},I._getRangeToRender=function(){var n=this.props,s=n.itemCount,a=n.overscanCount,l=this.state,u=l.isScrolling,p=l.scrollDirection,g=l.scrollOffset;if(s===0)return[0,0,0,0];var _=f(this.props,g,this._instanceProps),O=i(this.props,_,g,this._instanceProps),C=!u||p==="backward"?Math.max(1,a):1,q=!u||p==="forward"?Math.max(1,a):1;return[Math.max(0,_-C),Math.max(0,Math.min(s-1,O+q)),_,O]},E}(j.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var St=function(t,r){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,r.instance},It=vt({getItemOffset:function(t,r){var d=t.itemSize;return r*d},getItemSize:function(t,r){var d=t.itemSize;return d},getEstimatedTotalSize:function(t){var r=t.itemCount,d=t.itemSize;return d*r},getOffsetForIndexAndAlignment:function(t,r,d,c,y,f){var i=t.direction,o=t.height,h=t.itemCount,v=t.itemSize,b=t.layout,E=t.width,I=i==="horizontal"||b==="horizontal",S=I?E:o,n=Math.max(0,h*v-S),s=Math.min(n,r*v),a=Math.max(0,r*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 l=Math.round(a+(s-a)/2);return l<Math.ceil(S/2)?0:l>n+Math.floor(S/2)?n:l}case"auto":default:return c>=a&&c<=s?c:c<a?a:s}},getStartIndexForOffset:function(t,r){var d=t.itemCount,c=t.itemSize;return Math.max(0,Math.min(d-1,Math.floor(r/c)))},getStopIndexForStartIndex:function(t,r,d){var c=t.direction,y=t.height,f=t.itemCount,i=t.itemSize,o=t.layout,h=t.width,v=c==="horizontal"||o==="horizontal",b=r*i,E=v?h:y,I=Math.ceil((E+d-b)/i);return Math.max(0,Math.min(f-1,r+I-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){t.itemSize}});const Ot="_layerContainer_1lbvo_1",Et="_layer_1lbvo_1",xt="_small_1lbvo_23",Tt="_heading_1lbvo_26",qt="_option_1lbvo_27",Ct="_message_1lbvo_28",Vt="_focused_1lbvo_64",Lt="_selected_1lbvo_68",Rt="_disabled_1lbvo_71",Nt="_check_1lbvo_75",jt="_optionContent_1lbvo_92",Ft="_label_1lbvo_97",At="_icon_1lbvo_104",wt="_details_1lbvo_109",w={layerContainer:Ot,layer:Et,small:xt,heading:Tt,option:qt,message:Ct,focused:Vt,selected:Lt,disabled:Rt,check:Nt,optionContent:jt,label:Ft,icon:At,details:wt},de=({label:e})=>m.jsx("div",{onClick:t=>t.stopPropagation(),className:w.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:r,disabled:d=!1,selected:c=!1,focused:y=!1,onSelectOption:f,actions:i,closeLayer:o,testId:h})=>m.jsxs("div",{className:U(w.option,d?w.disabled:"",c?w.selected:"",y?w.focused:""),onClick:!d&&f?f:void 0,"data-testid":h,children:[m.jsx("div",{className:w.optionContent,children:m.jsxs("span",{className:w.label,title:t,children:[t,r&&m.jsx("span",{className:w.icon,children:r})]})}),e&&m.jsx("div",{className:U(w.details),children:m.jsx(se,{faint:!0,children:e})}),!!(i!=null&&i.length)&&m.jsx("div",{className:U(w.actions),children:m.jsx(Be,{actions:i,closeLayer:o})}),m.jsx("span",{className:w.check,children:c?m.jsx(ue,{icon:Fe.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:r,onSelectOption:d,closeLayer:c})=>{const y=j.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||y,selected:t,focused:r,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},Me="13px",ke="12px",Pt="Roobert",Mt="sans-serif",kt=12,Ht=8,Wt=30,Dt=24,Ut=5,zt=3,Gt=1,$t=2,Ve=10,He=(e=!1,t=!1)=>`${e?ke:Me} ${t?Pt:Mt}`,Kt=(e=!1,t=!1)=>(e?Ht:kt)+(e?Dt:Wt)+(t?17:0),Le=(e,t,r,d)=>{const c=He(t,r),y=d?me(d,c):0,f=Math.ceil(e.reduce((o,h)=>{var S;const v=(((S=h==null?void 0:h.actions)==null?void 0:S.length)??0)*24,b=h.icon?parseInt(t?ke:Me)+7:0,E=`${h.label} ${h.details||""}`,I=me(E,c)+v+b;return o=I>o?I:o,o},y)),i=Kt(t,!0);return f+i},Yt=(e,t,r)=>{const d=He(!0,r),c=me(e.label,d),y=(t?zt:Ut)*2+Gt*2+$t;return Math.ceil(c+y)},ye=({listRef:e,isMulti:t,sections:r,selectedOptions:d,onSelectOption:c,focusedOptionIndex:y,width:f,small:i,firstSelectedOptionIndex:o,closeLayer:h,testId:v})=>{j.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:U(w.layer,i&&w.small),children:r.length?m.jsx(It,{ref:e,height:r.length<Ve?b*r.length:b*Ve,itemCount:r.length,itemSize:b,width:f,children:({index:E,style:I})=>{var S;return m.jsx("div",{style:I,children:m.jsx(fe,{closeLayer:h,section:r[E],selected:t&&r[E].type!==ae.HEADING&&Array.isArray(d)?d.some(n=>{var s;return n&&(n==null?void 0:n.value)===((s=r==null?void 0:r[E])==null?void 0:s.value)}):!Array.isArray(d)&&((S=r==null?void 0:r[E])==null?void 0:S.value)===(d==null?void 0:d.value),focused:y===E,onSelectOption:n=>c(n,r[E])})})}}):m.jsx("ul",{children:m.jsx("li",{children:m.jsx("div",{className:w.message,style:{width:f},children:"No matches"})})})})};try{ye.displayName="Layer",ye.__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_1qfoj_1",Xt="_inputHover_1qfoj_13",Jt="_inputFocus_1qfoj_18",Zt="_inputError_1qfoj_25",Qt="_inputWarning_1qfoj_26",en="_inputDisabled_1qfoj_61",tn="_hideScrollbars_1qfoj_67",nn="_trigger_1qfoj_77",ln="_isInTable_1qfoj_93",rn="_input_1qfoj_1",an="_isOpen_1qfoj_114",on="_error_1qfoj_122",sn="_warning_1qfoj_139",un="_disabled_1qfoj_156",cn="_icons_1qfoj_162",dn="_clearAll_1qfoj_169",pn="_iconOpen_1qfoj_170",fn="_small_1qfoj_181",mn="_triggerInputContainer_1qfoj_189",yn="_right_1qfoj_198",hn="_multiOptions_1qfoj_211",gn="_multiOption_1qfoj_211",_n="_label_1qfoj_239",bn="_closeMultiOption_1qfoj_242",vn="_focus_1qfoj_253",Sn="_selectedSingleValue_1qfoj_257",In="_placeHolder_1qfoj_258",On="_groupOrderFirst_1qfoj_297",En="_groupOrderMiddle_1qfoj_298",xn="_groupOrderLast_1qfoj_302",Tn="_detailedLabel_1qfoj_307",N={inputInTable:Bt,inputHover:Xt,inputFocus:Jt,inputError:Zt,inputWarning:Qt,inputDisabled:en,hideScrollbars:tn,trigger:nn,isInTable:ln,input:rn,isOpen:an,error:on,warning:sn,disabled:un,icons:cn,clearAll:dn,iconOpen:pn,small:fn,triggerInputContainer:mn,right:yn,multiOptions:hn,multiOption:gn,label:_n,closeMultiOption:bn,focus:vn,selectedSingleValue:Sn,placeHolder:In,groupOrderFirst:On,groupOrderMiddle:En,groupOrderLast:xn,detailedLabel:Tn},he=({selectedOptions:e,small:t,width:r})=>{const d=Pe(),[c,y]=j.useState([]),[f,i]=j.useState([]);return j.useEffect(()=>{let o=[],h=[],v=0;e.forEach((b,E)=>{v+=Yt(b,t,d),E===e.length-1&&v<r||v<r-24?o.push(b):h.push(b)}),y(o),i(h)},[e,d,r]),m.jsxs("div",{className:N.multiOptions,children:[c.filter(o=>o&&o.label).map((o,h)=>m.jsx("span",{className:N.multiOption,onClick:v=>{v.stopPropagation()},children:o.label},h)),f.length>0&&m.jsx(Ie,{text:f.map((o,h)=>m.jsx("div",{children:o.label},h)),display:"inline-flex",children:m.jsx("span",{className:N.multiOption,children:c.length?`+${f.length}`:`${f.length} items`})})]})};try{he.displayName="MultiSelectedOptions",he.__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:r,onChange:d=()=>{},inputRef:c,error:y,placeholder:f="Select...",small:i})=>{const o=j.useRef(null),h=Array.isArray(e),v=h?e.length>0:!!e,b=r?r.length+1:1,E=()=>{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:N.triggerInputContainer,ref:o,children:[v?h?m.jsx(he,{selectedOptions:e,small:i,width:E()}):m.jsx("span",{className:N.selectedSingleValue,children:r!=null&&r.length?"":e==null?void 0:e.label}):m.jsx("span",{className:N.placeHolder,children:r!=null&&r.length?"":f}),t?m.jsx("input",{tabIndex:-1,ref:c,size:b,className:U(N.input,y?N.error:""),value:r,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:r,clearable:d,onClickTrigger:c,element:y,error:f,warning:i,tooltip:o,small:h,isInTable:v,disabled:b,onChangeSearch:E,onClickDeselect:I,onClickClear:S,tabIndex:n,isOpen:s,triggerRef:a,clearAllIsFocused:l,focusedSelectedOptionIndex:u,onFocus:p,onBlur:g,groupOrder:_,maxTooltipWidth:O,placeholder:C,right:q,testId:V})=>{var P;const[T,R]=we(),A=Array.isArray(e)?e.length>0&&((P=e[0])==null?void 0:P.value):e==null?void 0:e.value,F=d&&A,z=(()=>{if(_)switch(_){case re.FIRST:return N.groupOrderFirst;case re.LAST:return N.groupOrderLast;default:return N.groupOrderMiddle}return""})(),K=!Array.isArray(e)&&(e!=null&&e.details)?{...e,label:m.jsxs("div",{className:U(N.detailedLabel),children:[m.jsx(se,{children:e.label}),m.jsx(se,{muted:!0,children:e.details})]})}:e,G=m.jsxs(m.Fragment,{children:[y,m.jsxs("div",{ref:a,tabIndex:n,className:U(N.trigger,s?N.isOpen:"",f?N.error:i?N.warning:"",b?N.disabled:"",h?N.small:"",v?N.isInTable:"",q?N.right:"",z),onClick:M=>{M.stopPropagation(),typeof R=="function"&&R(),c(M)},onFocus:p,onBlur:g,"data-testid":V,children:[m.jsx(ge,{selectedOptions:K,placeholder:C,searchable:r,searchValue:t,inputRef:T,onChange:E,error:f,small:h}),m.jsx("span",{className:N.icons,children:F?m.jsx("span",{className:U(N.clearAll,l?N.focus:""),onClick:M=>{M.stopPropagation(),S&&S(M)},children:m.jsx(ue,{icon:Fe.CLOSE})}):m.jsx("span",{className:U(N.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&&te(o)||f&&te(f)||i&&te(i)||!1,maxWidth:O,placement:"bottom-center",children:G})})};try{_e.displayName="Trigger",_e.__docgenInfo={description:"",displayName:"Trigger",props:{selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!1,type:{name:"ISelectSelectedOption | 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 D=(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))(D||{});const We={options:["none","clearAll"],currentIndex:0,currentOption:!1,clearAll:!1},qn=e=>e!==null?e+1:0,De=(e,t)=>{const r=["none",...e.map((c,y)=>c.type!==ae.HEADING?y:null).filter(c=>c!==null)],d=qn(t);return{options:r,currentIndex:d,current:r[d]}},Cn=(e,t)=>{const r=e==="up"?-1:1,d=t.currentIndex+r,c=(d<0?t.options.length-1:d)%t.options.length,y=t.options[c];return{...t,currentIndex:c,current:y}},Vn=(e,t,r)=>{const d=e==="left"?-1:1,c=t&&t.length?["none",...Array.from({length:t.length},(h,v)=>v),"clearAll"]:["none","clearAll"],y=r.currentIndex+d,f=(y<0?c.length-1:y)%c.length,i=c[f];return{options:c,currentIndex:f,currentOption:i,clearAll:i==="clearAll"}},Re=()=>We,Ne=e=>({...e,currentIndex:0,current:"none"}),Ln=(e,t)=>{switch(t.type){case D.SET_VISIBLE_OPTIONS:return{...e,visibleOptions:t.options||[]};case D.RESET_LAYER_FOCUS:return{...e,layerFocus:De(t.options||[],t.firstSelectedOptionIndex||0)};case D.CLEAR_SEARCH:return{...e,visibleOptions:t.options||[],searchValue:""};case D.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 D.FOCUS_TRIGGER_INPUTS:return{...e,triggerFocus:Vn(t.direction||"right",t.selectedOptions||[],e.triggerFocus),layerFocus:Ne(e.layerFocus)};case D.BLUR_TRIGGER_INPUTS:return{...e,triggerFocus:Re()};case D.FOCUS_LAYER_OPTIONS:return t.nextLayerFocus?{...e,layerFocus:t.nextLayerFocus,triggerFocus:Re()}:e;case D.OPEN_LAYER:return{...e,isLayerOpen:!0};case D.CLOSE_LAYER:return{...e,isLayerOpen:!1};default:return e}},Rn={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||{}),$=(e=>(e.RIGHT="right",e.LEFT="left",e.UP="up",e.DOWN="down",e.ENTER="enter",e.ESC="esc",e.TAB="tab",e))($||{});const be=({state:e,dispatch:t,options:r,setTriggerFocus:d,disabled:c,disabledContext:y,onCreate:f,onChange:i,selectedOptions:o,width:h,small:v,isFontLoaded:b,placeholder:E,firstSelectedOptionIndex:I,createAble:S,listRef:n,autoLayerWidth:s})=>{const a=()=>{e.isLayerOpen&&t({type:k.CLOSE_LAYER}),d()},l=()=>t({type:k.OPEN_LAYER}),u=j.useRef(!0);j.useEffect(()=>{u.current?u.current=!1:t({type:k.SET_VISIBLE_OPTIONS,options:r})},[r]);const p=(x,L,Q)=>{if(!(c||y)){if(Q&&Q(),L){if(L.createAble&&f)f(L.value);else if(!L.disabled)if(Array.isArray(o))if(o.some(B=>B.label===L.label)){const B=o.filter(Oe=>Oe.label!==L.label);i&&i(x,B)}else{const B=[...o,L];i&&i(x,B)}else i&&i(x,L)}t({type:k.CLEAR_SEARCH,options:r}),d()}},g=j.useCallback(()=>h?h!=="auto"?h:Le(r,v,b,E):"100%",[r,b]),_=j.useCallback(x=>s?Math.max(Le(r,v,b,E),x==null?void 0:x.width):x==null?void 0:x.width,[r,b]),{renderLayer:O,layerProps:C,triggerProps:q,triggerBounds:V}=ze({isOpen:(e==null?void 0:e.isLayerOpen)??!1,overflowContainer:!0,...Rn,ResizeObserver,onOutsideClick:a,onParentClose:a}),T=()=>{if(!(c||y)){if(e.isLayerOpen){a();return}t({type:k.RESET_LAYER_FOCUS,options:r,firstSelectedOptionIndex:I}),l()}},R=j.useRef(!0);j.useEffect(()=>{R.current?R.current=!1:e.isLayerOpen||t({type:k.CLEAR_SEARCH,options:r})},[e.isLayerOpen]);const A=(x,L)=>{const Q=o instanceof Array?o.filter(Y=>Y.value!==L.value):null;i&&i(x,Q)},F=x=>{const L=o instanceof Array?[]:{value:null};i&&i(x,L)},z=x=>t({type:k.ON_CHANGE_SEARCH,options:r,value:x,createAble:S}),K=()=>{l(),t({type:k.BLUR_TRIGGER_INPUTS})},G=x=>{n.current&&Number.isInteger(x)&&n.current.scrollToItem(x)},P=x=>{const L=Cn(x,e.layerFocus);t({type:k.FOCUS_LAYER_OPTIONS,nextLayerFocus:L}),G(L.current)},M=x=>{t({type:k.FOCUS_TRIGGER_INPUTS,ICustomSelectDirection:x,selectedOptions:o})},X=x=>F(x),ne=o&&o[e.triggerFocus.currentOption],le=x=>{A(x,o[e.triggerFocus.currentOption])},J=x=>{var L;p(x,(L=e==null?void 0:e.visibleOptions)==null?void 0:L[e.layerFocus.current],a)},H=e.triggerFocus.clearAll;return{getTriggerWidth:g,onKeyEvent:(x,L)=>{switch(x){case $.UP:{P(x);break}case $.DOWN:{e.isLayerOpen?P(x):K();break}case $.LEFT:case $.RIGHT:{M(x);break}case $.ENTER:{H?X(L):ne?le(L):J(L);break}case $.ESC:{a();break}}},clearAllIsFocused:H,triggerProps:q,onClickTrigger:T,onChangeSearch:z,onClickDeselectOption:A,onClickClearAll:F,renderLayer:O,layerProps:C,closeLayer:a,onSelectOption:p,getLayerWidth:_,triggerBounds:V}};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:r=!1,error:d=null,warning:c=null,tooltip:y=null,options:f,selectedOptions:i,onCreate:o=null,placeholder:h="",small:v=!1,tabIndex:b=0,onFocus:E=()=>{},onBlur:I=()=>{},searchable:S=!0,clearable:n=!1,maxTooltipWidth:s,closeOnOptionActionClick:a,isInTable:l=!1,groupOrder:u,firstSelectedOptionIndex:p=0,right:g=!1,testId:_=void 0}=e,O=j.useContext(Se),C=o!==null,q=j.useRef(null),[V,T]=we(),R=Pe(),[A,F]=j.useReducer(Ln,{options:f,firstSelectedOptionIndex:p},({options:Y})=>({searchValue:"",visibleOptions:Y,layerFocus:De(Y,p??0),triggerFocus:We,isLayerOpen:!1})),{getTriggerWidth:z,onKeyEvent:K,clearAllIsFocused:G,triggerProps:P,onClickTrigger:M,onChangeSearch:X,onClickDeselectOption:ne,onClickClearAll:le,renderLayer:J,layerProps:H,closeLayer:Z,onSelectOption:x,getLayerWidth:L,triggerBounds:Q}=be({...e,state:A,dispatch:F,setTriggerFocus:T,disabledContext:O,isFontLoaded:R,createAble:C,listRef:q});return m.jsx("div",{style:{width:z()},children:m.jsxs(yt,{handleKeys:Object.values($),onKeyEvent:K,children:[m.jsx(_e,{selectedOptions:i,searchValue:A.searchValue,isOpen:A.isLayerOpen,focusedSelectedOptionIndex:A.triggerFocus.currentOption,clearAllIsFocused:G,searchable:S,triggerRef:Ge(V,P.ref),error:d,warning:c,tooltip:y,small:v,isInTable:l,disabled:r||O,clearable:n,tabIndex:b,onClickTrigger:M,onChangeSearch:X,onClickDeselect:ne,onClickClear:le,onFocus:E,onBlur:I,groupOrder:u,maxTooltipWidth:s,placeholder:h,right:g,testId:_}),A.isLayerOpen&&J(m.jsx("div",{...H,className:w.layerContainer,children:m.jsx(ye,{listRef:q,isMulti:t,sections:A.visibleOptions,selectedOptions:i,onSelectOption:(Y,B)=>{x(Y,B,t?void 0:Z)},closeLayer:()=>{a&&Z()},width:L(Q),small:v,focusedOptionIndex:A.layerFocus.current,firstSelectedOptionIndex:p??0,testId:_&&`${_}-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 je=e=>{const{name:t="",options:r=[],value:d,native:c=!1,onChange:y=()=>{},deprecatedEventHandler:f=!1,autoScroll:i=!0,warning:o,error:h,checkNonExistentValues:v=!0,closeOnOptionActionClick:b=!0,testId:E,disabled:I}=e,S=!c&&i===!0,{multi:n,simpleInputs:s,options:a,selectedOptions:l,firstSelectedOptionIndex:u,hasNonExistentValue:p}=Xe(r,d,S,v),g=!n,_=c&&g;c&&!g&&console.warn("Native select does not support provided props (see stories)");const O="Value no longer available for re-selection",C=p&&!I?o?m.jsxs("div",{children:[m.jsx("div",{children:O}),m.jsx("div",{children:o})]}):O:o,q=p&&h&&!I?m.jsxs("div",{children:[m.jsx("div",{children:O}),m.jsx("div",{children:h})]}):h,V=(T,R)=>{if(f){const A=n?R.map(F=>s?F.value:F):s?R.value:R;y(A)}else{const A=!(T instanceof Event),F=n?R:R.value;A?(T.target.name=t,T.target.value=F,n||(T.target.label=R.label),y(T)):y({...T,target:{...T.target,name:t,value:F,...!n&&{label:R.label}}})}};return _?m.jsx(ce,{...e,options:a,selectedOption:l,onChange:V,hasNonExistentValue:p,warning:C,error:q,testId:E}):m.jsx(ve,{...e,options:a,selectedOptions:l,onChange:V,multi:n,firstSelectedOptionIndex:u,warning:C,error:q,testId:E,closeOnOptionActionClick:b})};try{je.displayName="Select",je.__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{je as S};
|
|
1
|
+
import{j as m}from"./jsx-runtime-FsUICBgo.js";import{r as j,g as Ue}from"./index-RfLt4OUa.js";import{c as U}from"./index-VW3EWkuE.js";import{G as re,I as Fe}from"./common-types-U65vzrrz.js";import{D as Se}from"./disabled-context-urNQThQz.js";import{i as te}from"./types-5uVBABF4.js";import{T as Ie,u as ze,m as Ge}from"./tooltip-HEHiU__l.js";import{p as $e}from"./index-4QtD-hFu.js";import"./lodash-Bmg8FrMx.js";import{_ as Ke}from"./extends-dGVwEr9R.js";import{_ as Ee}from"./assertThisInitialized-4q6YPdh3.js";import{_ as Ye}from"./inheritsLoose-Y9jOMJLd.js";import{m as ie}from"./memoize-one.esm-hqe5SRxC.js";import{M as ae}from"./types-VB5zD18b.js";import{T as se}from"./text-6KQ6ntOV.js";import{A as Be}from"./actions-Z9jDWreP.js";import{I as ue}from"./icon-y1a2N5SZ.js";import{s as Xe}from"./select.input-zP5tW20f.js";const Je="_inputInTable_2ynxq_1",Ze="_inputHover_2ynxq_13",Qe="_inputFocus_2ynxq_18",et="_inputError_2ynxq_25",tt="_inputWarning_2ynxq_26",nt="_inputDisabled_2ynxq_61",lt="_hideScrollbars_2ynxq_67",rt="_select_2ynxq_77",at="_isInTable_2ynxq_121",it="_unSelected_2ynxq_133",ot="_error_2ynxq_140",st="_warning_2ynxq_157",ut="_small_2ynxq_174",ct="_right_2ynxq_182",dt="_groupOrderFirst_2ynxq_193",pt="_groupOrderMiddle_2ynxq_194",ft="_groupOrderLast_2ynxq_198",W={inputInTable:Je,inputHover:Ze,inputFocus:Qe,inputError:et,inputWarning:tt,inputDisabled:nt,hideScrollbars:lt,select:rt,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:r=null,tooltip:d=null,options:c,onChange:y=()=>{},onFocus:f=()=>{},onBlur:i=()=>{},right:o=!1,small:h=!1,tabIndex:v=0,selectedOption:b,width:E=null,groupOrder:I=null,testId:S,isInTable:n=!1,clearable:s,placeholder:a,hasNonExistentValue:l,maxTooltipWidth:u,borderRadius:p})=>{const g=j.useContext(Se),_=b===null||(b==null?void 0:b.value)===null?"unselected":b==null?void 0:b.value,O=_==="unselected",C=(_==="unselected"||s?[m.jsx("option",{value:"unselected",disabled:!s,hidden:!s,children:a||"Select..."},"unselected")]:[]).concat(l?[m.jsx("option",{value:b==null?void 0:b.value,disabled:e||g,children:b==null?void 0:b.label},"selectedNonExistentValue")]:[]).concat(c.map((V,T)=>m.jsx("option",{value:V.value,"data-testid":V.testId,children:V.label},T))),q=(()=>{if(I)switch(I){case re.FIRST:return W.groupOrderFirst;case re.LAST:return W.groupOrderLast;default:return W.groupOrderMiddle}return""})();return m.jsx(Ie,{error:!!t,warning:!!r,text:d||t||r,enabled:d&&te(d)||t&&te(t)||r&&te(r)||!1,maxWidth:u,placement:"bottom-center",children:m.jsx("select",{className:U(W.select,O?W.unSelected:"",t?W.error:r?W.warning:"",o?W.right:"",h?W.small:"",n?W.isInTable:"",q),style:{width:E||"",borderRadius:p||""},onChange:V=>{const{value:T}=V.target;let R;T==="unselected"?R={value:null}:R=c.find(F=>String(F.value)===String(T))||{value:null},y(V,R)},onFocus:f,onBlur:i,tabIndex:v,value:_,disabled:e||g,"data-testid":S,children:C})})};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 Ae={exports:{}};(function(e,t){(function(r,d){e.exports=d(j,$e)})(window,function(r,d){return function(c){var y={};function f(i){if(y[i])return y[i].exports;var o=y[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=y,f.d=function(i,o,h){f.o(i,o)||Object.defineProperty(i,o,{enumerable:!0,get:h})},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 h=Object.create(null);if(f.r(h),Object.defineProperty(h,"default",{enumerable:!0,value:i}),2&o&&typeof i!="string")for(var v in i)f.d(h,v,(function(b){return i[b]}).bind(null,v));return h},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,y,f){Object.defineProperty(y,"__esModule",{value:!0});var i=f(1);Object.defineProperty(y,"default",{enumerable:!0,get:function(){return function(o){return o&&o.__esModule?o:{default:o}}(i).default}}),c.exports=y.default},function(c,y,f){Object.defineProperty(y,"__esModule",{value:!0});var i=Object.assign||function(n){for(var s=1;s<arguments.length;s++){var a=arguments[s];for(var l in a)Object.prototype.hasOwnProperty.call(a,l)&&(n[l]=a[l])}return n},o=function(){function n(s,a){for(var l=0;l<a.length;l++){var u=a[l];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(s,u.key,u)}}return function(s,a,l){return a&&n(s.prototype,a),l&&n(s,l),s}}(),h=E(f(2)),v=E(f(3)),b=f(4);function E(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 l=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 l.handleKeyboardEvent=l.handleKeyboardEvent.bind(l),l.registerExclusiveHandler=l.registerExclusiveHandler.bind(l),l.deregisterExclusiveHandler=l.deregisterExclusiveHandler.bind(l),l}return function(a,l){if(typeof l!="function"&&l!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof l);a.prototype=Object.create(l&&l.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),l&&(Object.setPrototypeOf?Object.setPrototypeOf(a,l):a.__proto__=l)}(s,h.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,l=a.isExclusive,u=a.isDisabled;l&&!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 l=a.isExclusive,u=a.isDisabled;(this.props.isExclusive!==l||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(l){return l!==a}))}},{key:"handleKeyboardEvent",value:function(a){var l=this.props,u=l.isDisabled,p=l.handleKeys,g=l.onKeyEvent,_=l.handleEventType,O=l.children,C=l.handleFocusableElements;if(u||_!==a.type||I.length>0&&I[0]!==this)return!1;var q=a.target===document.body||C,V=this.childrenContainer&&this.childrenContainer.contains(a.target);if(!(O?V:q))return!1;var T=(0,b.findMatchedKey)(a,p);return!!T&&(g(T,a),!0)}},{key:"render",value:function(){var a=this,l=this.props.children,u=Object.assign({},this.props),p=!0,g=!1,_=void 0;try{for(var O,C=Object.keys(s.propTypes)[Symbol.iterator]();!(p=(O=C.next()).done);p=!0)delete u[O.value]}catch(q){g=!0,_=q}finally{try{!p&&C.return&&C.return()}finally{if(g)throw _}}return l?h.default.createElement("span",i({ref:function(q){a.childrenContainer=q}},u),l):null}}]),s}();y.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=y.default},function(c,y){c.exports=r},function(c,y){c.exports=d},function(c,y,f){function i(l,u,p){return u in l?Object.defineProperty(l,u,{value:p,enumerable:!0,configurable:!0,writable:!0}):l[u]=p,l}Object.defineProperty(y,"__esModule",{value:!0}),y.matchKeyEvent=a,y.findMatchedKey=function(l,u){var p=u.map(function(g){var _=g.toLowerCase(),O=s[_];return O||[g]}).reduce(function(g,_){return g.concat(_)},[]).find(function(g){return a(l,g)});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]},h=Object.keys(o).reduce(function(l,u){return Object.assign(l,i({},u.toUpperCase(),o[u]))},{}),v="0123456789".split("").reduce(function(l,u,p){return Object.assign(l,i({},u,[p+48,p+96]))},{}),b="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").reduce(function(l,u,p){return Object.assign(l,i({},u.toLowerCase(),[p+65]),i({},u,[p+65]))},{}),E="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19".split(",").reduce(function(l,u,p){return Object.assign(l,i({},"f"+u,[p+112]))},{}),I={control:"ctrl",ctrl:"ctrl",shift:"shift",meta:"meta",cmd:"meta",command:"meta",option:"alt",alt:"alt"},S=y.AllKeys=Object.assign({},o,h,v,b,E),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(E)};function a(l,u){var p=l.which||l.keyCode,g=l.type,_=Object.keys(I).filter(function(F){return l[F+"Key"]}).sort(),O=u.toLowerCase().trim(),C=O==="+"?["+"]:O.split(/\s?\+\s?/),q=C.pop(),V=S[q],T=C;if(g==="keypress")return u==String.fromCharCode(p).toLowerCase();if(T.length===0&&_.length===0)return V.indexOf(p)>=0;if(T.length>0&&_.length>0){var R=T.map(function(F){return I[F]}).sort(),A=R.length===_.length&&R.every(function(F,z){return _[z]===F});return V.indexOf(p)>=0&&A}return T.length==0&&_.length===1&&q===_[0]}}])})})(Ae);var mt=Ae.exports;const yt=Ue(mt),we=()=>{const e=j.useRef(null);return[e,()=>{e.current&&e.current.focus()}]},Pe=()=>{const[e,t]=j.useState(!1);return j.useEffect(()=>{(async()=>{document.fonts&&await document.fonts.ready.then(()=>t(!0))})()},[]),e};var ht=typeof performance=="object"&&typeof performance.now=="function",xe=ht?function(){return performance.now()}:function(){return Date.now()};function Te(e){cancelAnimationFrame(e.id)}function gt(e,t){var r=xe();function d(){xe()-r>=t?e.call(null):c.id=requestAnimationFrame(d)}var c={id:requestAnimationFrame(d)};return c}var oe=-1;function qe(e){if(e===void 0&&(e=!1),oe===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),oe=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return oe}var ee=null;function Ce(e){if(e===void 0&&(e=!1),ee===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.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?ee="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ee="negative":ee="positive-ascending"),document.body.removeChild(t),ee}return ee}var _t=150,bt=function(t,r){return t};function vt(e){var t,r=e.getItemOffset,d=e.getEstimatedTotalSize,c=e.getItemSize,y=e.getOffsetForIndexAndAlignment,f=e.getStartIndexForOffset,i=e.getStopIndexForStartIndex,o=e.initInstanceProps,h=e.shouldResetStyleCacheOnItemSizeChange,v=e.validateProps;return t=function(b){Ye(E,b);function E(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,l,u){return n.props.onItemsRendered({overscanStartIndex:s,overscanStopIndex:a,visibleStartIndex:l,visibleStopIndex:u})}),n._callOnScroll=void 0,n._callOnScroll=ie(function(s,a,l){return n.props.onScroll({scrollDirection:s,scrollOffset:a,scrollUpdateWasRequested:l})}),n._getItemStyle=void 0,n._getItemStyle=function(s){var a=n.props,l=a.direction,u=a.itemSize,p=a.layout,g=n._getItemStyleCache(h&&u,h&&p,h&&l),_;if(g.hasOwnProperty(s))_=g[s];else{var O=r(n.props,s,n._instanceProps),C=c(n.props,s,n._instanceProps),q=l==="horizontal"||p==="horizontal",V=l==="rtl",T=q?O:0;g[s]=_={position:"absolute",left:V?void 0:T,right:V?T:void 0,top:q?0:O,height:q?"100%":C,width:q?C:"100%"}}return _},n._getItemStyleCache=void 0,n._getItemStyleCache=ie(function(s,a,l){return{}}),n._onScrollHorizontal=function(s){var a=s.currentTarget,l=a.clientWidth,u=a.scrollLeft,p=a.scrollWidth;n.setState(function(g){if(g.scrollOffset===u)return null;var _=n.props.direction,O=u;if(_==="rtl")switch(Ce()){case"negative":O=-u;break;case"positive-descending":O=p-l-u;break}return O=Math.max(0,Math.min(O,p-l)),{isScrolling:!0,scrollDirection:g.scrollOffset<u?"forward":"backward",scrollOffset:O,scrollUpdateWasRequested:!1}},n._resetIsScrollingDebounced)},n._onScrollVertical=function(s){var a=s.currentTarget,l=a.clientHeight,u=a.scrollHeight,p=a.scrollTop;n.setState(function(g){if(g.scrollOffset===p)return null;var _=Math.max(0,Math.min(p,u-l));return{isScrolling:!0,scrollDirection:g.scrollOffset<_?"forward":"backward",scrollOffset:_,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}E.getDerivedStateFromProps=function(n,s){return St(n,s),v(n),null};var I=E.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,l=a.itemCount,u=a.layout,p=this.state.scrollOffset;n=Math.max(0,Math.min(n,l-1));var g=0;if(this._outerRef){var _=this._outerRef;u==="vertical"?g=_.scrollWidth>_.clientWidth?qe():0:g=_.scrollHeight>_.clientHeight?qe():0}this.scrollTo(y(this.props,n,s,p,this._instanceProps,g))},I.componentDidMount=function(){var n=this.props,s=n.direction,a=n.initialScrollOffset,l=n.layout;if(typeof a=="number"&&this._outerRef!=null){var u=this._outerRef;s==="horizontal"||l==="horizontal"?u.scrollLeft=a:u.scrollTop=a}this._callPropsCallbacks()},I.componentDidUpdate=function(){var n=this.props,s=n.direction,a=n.layout,l=this.state,u=l.scrollOffset,p=l.scrollUpdateWasRequested;if(p&&this._outerRef!=null){var g=this._outerRef;if(s==="horizontal"||a==="horizontal")if(s==="rtl")switch(Ce()){case"negative":g.scrollLeft=-u;break;case"positive-ascending":g.scrollLeft=u;break;default:var _=g.clientWidth,O=g.scrollWidth;g.scrollLeft=O-_-u;break}else g.scrollLeft=u;else g.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,l=n.direction,u=n.height,p=n.innerRef,g=n.innerElementType,_=n.innerTagName,O=n.itemCount,C=n.itemData,q=n.itemKey,V=q===void 0?bt:q,T=n.layout,R=n.outerElementType,A=n.outerTagName,F=n.style,z=n.useIsScrolling,K=n.width,G=this.state.isScrolling,P=l==="horizontal"||T==="horizontal",M=P?this._onScrollHorizontal:this._onScrollVertical,X=this._getRangeToRender(),ne=X[0],le=X[1],J=[];if(O>0)for(var H=ne;H<=le;H++)J.push(j.createElement(s,{data:C,key:V(H,C),index:H,isScrolling:z?G:void 0,style:this._getItemStyle(H)}));var Z=d(this.props,this._instanceProps);return j.createElement(R||A||"div",{className:a,onScroll:M,ref:this._outerRefSetter,style:Ke({position:"relative",height:u,width:K,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:l},F)},j.createElement(g||_||"div",{children:J,ref:p,style:{height:P?"100%":Z,pointerEvents:G?"none":void 0,width:P?Z:"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],l=s[1],u=s[2],p=s[3];this._callOnItemsRendered(a,l,u,p)}}if(typeof this.props.onScroll=="function"){var g=this.state,_=g.scrollDirection,O=g.scrollOffset,C=g.scrollUpdateWasRequested;this._callOnScroll(_,O,C)}},I._getRangeToRender=function(){var n=this.props,s=n.itemCount,a=n.overscanCount,l=this.state,u=l.isScrolling,p=l.scrollDirection,g=l.scrollOffset;if(s===0)return[0,0,0,0];var _=f(this.props,g,this._instanceProps),O=i(this.props,_,g,this._instanceProps),C=!u||p==="backward"?Math.max(1,a):1,q=!u||p==="forward"?Math.max(1,a):1;return[Math.max(0,_-C),Math.max(0,Math.min(s-1,O+q)),_,O]},E}(j.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var St=function(t,r){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,r.instance},It=vt({getItemOffset:function(t,r){var d=t.itemSize;return r*d},getItemSize:function(t,r){var d=t.itemSize;return d},getEstimatedTotalSize:function(t){var r=t.itemCount,d=t.itemSize;return d*r},getOffsetForIndexAndAlignment:function(t,r,d,c,y,f){var i=t.direction,o=t.height,h=t.itemCount,v=t.itemSize,b=t.layout,E=t.width,I=i==="horizontal"||b==="horizontal",S=I?E:o,n=Math.max(0,h*v-S),s=Math.min(n,r*v),a=Math.max(0,r*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 l=Math.round(a+(s-a)/2);return l<Math.ceil(S/2)?0:l>n+Math.floor(S/2)?n:l}case"auto":default:return c>=a&&c<=s?c:c<a?a:s}},getStartIndexForOffset:function(t,r){var d=t.itemCount,c=t.itemSize;return Math.max(0,Math.min(d-1,Math.floor(r/c)))},getStopIndexForStartIndex:function(t,r,d){var c=t.direction,y=t.height,f=t.itemCount,i=t.itemSize,o=t.layout,h=t.width,v=c==="horizontal"||o==="horizontal",b=r*i,E=v?h:y,I=Math.ceil((E+d-b)/i);return Math.max(0,Math.min(f-1,r+I-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){t.itemSize}});const Ot="_layerContainer_1lbvo_1",Et="_layer_1lbvo_1",xt="_small_1lbvo_23",Tt="_heading_1lbvo_26",qt="_option_1lbvo_27",Ct="_message_1lbvo_28",Vt="_focused_1lbvo_64",Lt="_selected_1lbvo_68",Rt="_disabled_1lbvo_71",Nt="_check_1lbvo_75",jt="_optionContent_1lbvo_92",Ft="_label_1lbvo_97",At="_icon_1lbvo_104",wt="_details_1lbvo_109",w={layerContainer:Ot,layer:Et,small:xt,heading:Tt,option:qt,message:Ct,focused:Vt,selected:Lt,disabled:Rt,check:Nt,optionContent:jt,label:Ft,icon:At,details:wt},de=({label:e})=>m.jsx("div",{onClick:t=>t.stopPropagation(),className:w.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:r,disabled:d=!1,selected:c=!1,focused:y=!1,onSelectOption:f,actions:i,closeLayer:o,testId:h})=>m.jsxs("div",{className:U(w.option,d?w.disabled:"",c?w.selected:"",y?w.focused:""),onClick:!d&&f?f:void 0,"data-testid":h,children:[m.jsx("div",{className:w.optionContent,children:m.jsxs("span",{className:w.label,title:t,children:[t,r&&m.jsx("span",{className:w.icon,children:r})]})}),e&&m.jsx("div",{className:U(w.details),children:m.jsx(se,{faint:!0,children:e})}),!!(i!=null&&i.length)&&m.jsx("div",{className:U(w.actions),children:m.jsx(Be,{actions:i,closeLayer:o})}),m.jsx("span",{className:w.check,children:c?m.jsx(ue,{icon:Fe.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:r,onSelectOption:d,closeLayer:c})=>{const y=j.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||y,selected:t,focused:r,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},Me="13px",ke="12px",Pt="Roobert",Mt="sans-serif",kt=12,Ht=8,Wt=30,Dt=24,Ut=5,zt=3,Gt=1,$t=2,Ve=10,He=(e=!1,t=!1)=>`${e?ke:Me} ${t?Pt:Mt}`,Kt=(e=!1,t=!1)=>(e?Ht:kt)+(e?Dt:Wt)+(t?17:0),Le=(e,t,r,d)=>{const c=He(t,r),y=d?me(d,c):0,f=Math.ceil(e.reduce((o,h)=>{var S;const v=(((S=h==null?void 0:h.actions)==null?void 0:S.length)??0)*24,b=h.icon?parseInt(t?ke:Me)+7:0,E=`${h.label} ${h.details||""}`,I=me(E,c)+v+b;return o=I>o?I:o,o},y)),i=Kt(t,!0);return f+i},Yt=(e,t,r)=>{const d=He(!0,r),c=me(e.label,d),y=(t?zt:Ut)*2+Gt*2+$t;return Math.ceil(c+y)},ye=({listRef:e,isMulti:t,sections:r,selectedOptions:d,onSelectOption:c,focusedOptionIndex:y,width:f,small:i,firstSelectedOptionIndex:o,closeLayer:h,testId:v})=>{j.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:U(w.layer,i&&w.small),children:r.length?m.jsx(It,{ref:e,height:r.length<Ve?b*r.length:b*Ve,itemCount:r.length,itemSize:b,width:f,children:({index:E,style:I})=>{var S;return m.jsx("div",{style:I,children:m.jsx(fe,{closeLayer:h,section:r[E],selected:t&&r[E].type!==ae.HEADING&&Array.isArray(d)?d.some(n=>{var s;return n&&(n==null?void 0:n.value)===((s=r==null?void 0:r[E])==null?void 0:s.value)}):!Array.isArray(d)&&((S=r==null?void 0:r[E])==null?void 0:S.value)===(d==null?void 0:d.value),focused:y===E,onSelectOption:n=>c(n,r[E])})})}}):m.jsx("ul",{children:m.jsx("li",{children:m.jsx("div",{className:w.message,style:{width:f},children:"No matches"})})})})};try{ye.displayName="Layer",ye.__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_1qfoj_1",Xt="_inputHover_1qfoj_13",Jt="_inputFocus_1qfoj_18",Zt="_inputError_1qfoj_25",Qt="_inputWarning_1qfoj_26",en="_inputDisabled_1qfoj_61",tn="_hideScrollbars_1qfoj_67",nn="_trigger_1qfoj_77",ln="_isInTable_1qfoj_93",rn="_input_1qfoj_1",an="_isOpen_1qfoj_114",on="_error_1qfoj_122",sn="_warning_1qfoj_139",un="_disabled_1qfoj_156",cn="_icons_1qfoj_162",dn="_clearAll_1qfoj_169",pn="_iconOpen_1qfoj_170",fn="_small_1qfoj_181",mn="_triggerInputContainer_1qfoj_189",yn="_right_1qfoj_198",hn="_multiOptions_1qfoj_211",gn="_multiOption_1qfoj_211",_n="_label_1qfoj_239",bn="_closeMultiOption_1qfoj_242",vn="_focus_1qfoj_253",Sn="_selectedSingleValue_1qfoj_257",In="_placeHolder_1qfoj_258",On="_groupOrderFirst_1qfoj_297",En="_groupOrderMiddle_1qfoj_298",xn="_groupOrderLast_1qfoj_302",Tn="_detailedLabel_1qfoj_307",N={inputInTable:Bt,inputHover:Xt,inputFocus:Jt,inputError:Zt,inputWarning:Qt,inputDisabled:en,hideScrollbars:tn,trigger:nn,isInTable:ln,input:rn,isOpen:an,error:on,warning:sn,disabled:un,icons:cn,clearAll:dn,iconOpen:pn,small:fn,triggerInputContainer:mn,right:yn,multiOptions:hn,multiOption:gn,label:_n,closeMultiOption:bn,focus:vn,selectedSingleValue:Sn,placeHolder:In,groupOrderFirst:On,groupOrderMiddle:En,groupOrderLast:xn,detailedLabel:Tn},he=({selectedOptions:e,small:t,width:r})=>{const d=Pe(),[c,y]=j.useState([]),[f,i]=j.useState([]);return j.useEffect(()=>{let o=[],h=[],v=0;e.forEach((b,E)=>{v+=Yt(b,t,d),E===e.length-1&&v<r||v<r-24?o.push(b):h.push(b)}),y(o),i(h)},[e,d,r]),m.jsxs("div",{className:N.multiOptions,children:[c.filter(o=>o&&o.label).map((o,h)=>m.jsx("span",{className:N.multiOption,onClick:v=>{v.stopPropagation()},children:o.label},h)),f.length>0&&m.jsx(Ie,{text:f.map((o,h)=>m.jsx("div",{children:o.label},h)),display:"inline-flex",children:m.jsx("span",{className:N.multiOption,children:c.length?`+${f.length}`:`${f.length} items`})})]})};try{he.displayName="MultiSelectedOptions",he.__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:r,onChange:d=()=>{},inputRef:c,error:y,placeholder:f="Select...",small:i})=>{const o=j.useRef(null),h=Array.isArray(e),v=h?e.length>0:!!e,b=r?r.length+1:1,E=()=>{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:N.triggerInputContainer,ref:o,children:[v?h?m.jsx(he,{selectedOptions:e,small:i,width:E()}):m.jsx("span",{className:N.selectedSingleValue,children:r!=null&&r.length?"":e==null?void 0:e.label}):m.jsx("span",{className:N.placeHolder,children:r!=null&&r.length?"":f}),t?m.jsx("input",{tabIndex:-1,ref:c,size:b,className:U(N.input,y?N.error:""),value:r,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:r,clearable:d,onClickTrigger:c,element:y,error:f,warning:i,tooltip:o,small:h,isInTable:v,disabled:b,onChangeSearch:E,onClickDeselect:I,onClickClear:S,tabIndex:n,isOpen:s,triggerRef:a,clearAllIsFocused:l,focusedSelectedOptionIndex:u,onFocus:p,onBlur:g,groupOrder:_,maxTooltipWidth:O,placeholder:C,right:q,testId:V})=>{var P;const[T,R]=we(),A=Array.isArray(e)?e.length>0&&((P=e[0])==null?void 0:P.value):e==null?void 0:e.value,F=d&&A,z=(()=>{if(_)switch(_){case re.FIRST:return N.groupOrderFirst;case re.LAST:return N.groupOrderLast;default:return N.groupOrderMiddle}return""})(),K=!Array.isArray(e)&&(e!=null&&e.details)?{...e,label:m.jsxs("div",{className:U(N.detailedLabel),children:[m.jsx(se,{children:e.label}),m.jsx(se,{muted:!0,children:e.details})]})}:e,G=m.jsxs(m.Fragment,{children:[y,m.jsxs("div",{ref:a,tabIndex:n,className:U(N.trigger,s?N.isOpen:"",f?N.error:i?N.warning:"",b?N.disabled:"",h?N.small:"",v?N.isInTable:"",q?N.right:"",z),onClick:M=>{M.stopPropagation(),typeof R=="function"&&R(),c(M)},onFocus:p,onBlur:g,"data-testid":V,children:[m.jsx(ge,{selectedOptions:K,placeholder:C,searchable:r,searchValue:t,inputRef:T,onChange:E,error:f,small:h}),m.jsx("span",{className:N.icons,children:F?m.jsx("span",{className:U(N.clearAll,l?N.focus:""),onClick:M=>{M.stopPropagation(),S&&S(M)},children:m.jsx(ue,{icon:Fe.CLOSE})}):m.jsx("span",{className:U(N.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&&te(o)||f&&te(f)||i&&te(i)||!1,maxWidth:O,placement:"bottom-center",children:G})})};try{_e.displayName="Trigger",_e.__docgenInfo={description:"",displayName:"Trigger",props:{selectedOptions:{defaultValue:null,description:"",name:"selectedOptions",required:!1,type:{name:"ISelectSelectedOption | 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 D=(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))(D||{});const We={options:["none","clearAll"],currentIndex:0,currentOption:!1,clearAll:!1},qn=e=>e!==null?e+1:0,De=(e,t)=>{const r=["none",...e.map((c,y)=>c.type!==ae.HEADING?y:null).filter(c=>c!==null)],d=qn(t);return{options:r,currentIndex:d,current:r[d]}},Cn=(e,t)=>{const r=e==="up"?-1:1,d=t.currentIndex+r,c=(d<0?t.options.length-1:d)%t.options.length,y=t.options[c];return{...t,currentIndex:c,current:y}},Vn=(e,t,r)=>{const d=e==="left"?-1:1,c=t&&t.length?["none",...Array.from({length:t.length},(h,v)=>v),"clearAll"]:["none","clearAll"],y=r.currentIndex+d,f=(y<0?c.length-1:y)%c.length,i=c[f];return{options:c,currentIndex:f,currentOption:i,clearAll:i==="clearAll"}},Re=()=>We,Ne=e=>({...e,currentIndex:0,current:"none"}),Ln=(e,t)=>{switch(t.type){case D.SET_VISIBLE_OPTIONS:return{...e,visibleOptions:t.options||[]};case D.RESET_LAYER_FOCUS:return{...e,layerFocus:De(t.options||[],t.firstSelectedOptionIndex||0)};case D.CLEAR_SEARCH:return{...e,visibleOptions:t.options||[],searchValue:""};case D.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 D.FOCUS_TRIGGER_INPUTS:return{...e,triggerFocus:Vn(t.direction||"right",t.selectedOptions||[],e.triggerFocus),layerFocus:Ne(e.layerFocus)};case D.BLUR_TRIGGER_INPUTS:return{...e,triggerFocus:Re()};case D.FOCUS_LAYER_OPTIONS:return t.nextLayerFocus?{...e,layerFocus:t.nextLayerFocus,triggerFocus:Re()}:e;case D.OPEN_LAYER:return{...e,isLayerOpen:!0};case D.CLOSE_LAYER:return{...e,isLayerOpen:!1};default:return e}},Rn={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||{}),$=(e=>(e.RIGHT="right",e.LEFT="left",e.UP="up",e.DOWN="down",e.ENTER="enter",e.ESC="esc",e.TAB="tab",e))($||{});const be=({state:e,dispatch:t,options:r,setTriggerFocus:d,disabled:c,disabledContext:y,onCreate:f,onChange:i,selectedOptions:o,width:h,small:v,isFontLoaded:b,placeholder:E,firstSelectedOptionIndex:I,createAble:S,listRef:n,autoLayerWidth:s})=>{const a=()=>{e.isLayerOpen&&t({type:k.CLOSE_LAYER}),d()},l=()=>t({type:k.OPEN_LAYER}),u=j.useRef(!0);j.useEffect(()=>{u.current?u.current=!1:t({type:k.SET_VISIBLE_OPTIONS,options:r})},[r]);const p=(x,L,Q)=>{if(!(c||y)){if(Q&&Q(),L){if(L.createAble&&f)f(L.value);else if(!L.disabled)if(Array.isArray(o))if(o.some(B=>B.label===L.label)){const B=o.filter(Oe=>Oe.label!==L.label);i&&i(x,B)}else{const B=[...o,L];i&&i(x,B)}else i&&i(x,L)}t({type:k.CLEAR_SEARCH,options:r}),d()}},g=j.useCallback(()=>h?h!=="auto"?h:Le(r,v,b,E):"100%",[r,b]),_=j.useCallback(x=>s?Math.max(Le(r,v,b,E),x==null?void 0:x.width):x==null?void 0:x.width,[r,b]),{renderLayer:O,layerProps:C,triggerProps:q,triggerBounds:V}=ze({isOpen:(e==null?void 0:e.isLayerOpen)??!1,overflowContainer:!0,...Rn,ResizeObserver,onOutsideClick:a,onParentClose:a}),T=()=>{if(!(c||y)){if(e.isLayerOpen){a();return}t({type:k.RESET_LAYER_FOCUS,options:r,firstSelectedOptionIndex:I}),l()}},R=j.useRef(!0);j.useEffect(()=>{R.current?R.current=!1:e.isLayerOpen||t({type:k.CLEAR_SEARCH,options:r})},[e.isLayerOpen]);const A=(x,L)=>{const Q=o instanceof Array?o.filter(Y=>Y.value!==L.value):null;i&&i(x,Q)},F=x=>{const L=o instanceof Array?[]:{value:null};i&&i(x,L)},z=x=>t({type:k.ON_CHANGE_SEARCH,options:r,value:x,createAble:S}),K=()=>{l(),t({type:k.BLUR_TRIGGER_INPUTS})},G=x=>{n.current&&Number.isInteger(x)&&n.current.scrollToItem(x)},P=x=>{const L=Cn(x,e.layerFocus);t({type:k.FOCUS_LAYER_OPTIONS,nextLayerFocus:L}),G(L.current)},M=x=>{t({type:k.FOCUS_TRIGGER_INPUTS,ICustomSelectDirection:x,selectedOptions:o})},X=x=>F(x),ne=o&&o[e.triggerFocus.currentOption],le=x=>{A(x,o[e.triggerFocus.currentOption])},J=x=>{var L;p(x,(L=e==null?void 0:e.visibleOptions)==null?void 0:L[e.layerFocus.current],a)},H=e.triggerFocus.clearAll;return{getTriggerWidth:g,onKeyEvent:(x,L)=>{switch(x){case $.UP:{P(x);break}case $.DOWN:{e.isLayerOpen?P(x):K();break}case $.LEFT:case $.RIGHT:{M(x);break}case $.ENTER:{H?X(L):ne?le(L):J(L);break}case $.ESC:{a();break}}},clearAllIsFocused:H,triggerProps:q,onClickTrigger:T,onChangeSearch:z,onClickDeselectOption:A,onClickClearAll:F,renderLayer:O,layerProps:C,closeLayer:a,onSelectOption:p,getLayerWidth:_,triggerBounds:V}};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:r=!1,error:d=null,warning:c=null,tooltip:y=null,options:f,selectedOptions:i,onCreate:o=null,placeholder:h="",small:v=!1,tabIndex:b=0,onFocus:E=()=>{},onBlur:I=()=>{},searchable:S=!0,clearable:n=!1,maxTooltipWidth:s,closeOnOptionActionClick:a,isInTable:l=!1,groupOrder:u,firstSelectedOptionIndex:p=0,right:g=!1,testId:_=void 0}=e,O=j.useContext(Se),C=o!==null,q=j.useRef(null),[V,T]=we(),R=Pe(),[A,F]=j.useReducer(Ln,{options:f,firstSelectedOptionIndex:p},({options:Y})=>({searchValue:"",visibleOptions:Y,layerFocus:De(Y,p??0),triggerFocus:We,isLayerOpen:!1})),{getTriggerWidth:z,onKeyEvent:K,clearAllIsFocused:G,triggerProps:P,onClickTrigger:M,onChangeSearch:X,onClickDeselectOption:ne,onClickClearAll:le,renderLayer:J,layerProps:H,closeLayer:Z,onSelectOption:x,getLayerWidth:L,triggerBounds:Q}=be({...e,state:A,dispatch:F,setTriggerFocus:T,disabledContext:O,isFontLoaded:R,createAble:C,listRef:q});return m.jsx("div",{style:{width:z()},children:m.jsxs(yt,{handleKeys:Object.values($),onKeyEvent:K,children:[m.jsx(_e,{selectedOptions:i,searchValue:A.searchValue,isOpen:A.isLayerOpen,focusedSelectedOptionIndex:A.triggerFocus.currentOption,clearAllIsFocused:G,searchable:S,triggerRef:Ge(V,P.ref),error:d,warning:c,tooltip:y,small:v,isInTable:l,disabled:r||O,clearable:n,tabIndex:b,onClickTrigger:M,onChangeSearch:X,onClickDeselect:ne,onClickClear:le,onFocus:E,onBlur:I,groupOrder:u,maxTooltipWidth:s,placeholder:h,right:g,testId:_}),A.isLayerOpen&&J(m.jsx("div",{...H,className:w.layerContainer,children:m.jsx(ye,{listRef:q,isMulti:t,sections:A.visibleOptions,selectedOptions:i,onSelectOption:(Y,B)=>{x(Y,B,t?void 0:Z)},closeLayer:()=>{a&&Z()},width:L(Q),small:v,focusedOptionIndex:A.layerFocus.current,firstSelectedOptionIndex:p??0,testId:_&&`${_}-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 je=e=>{const{name:t="",options:r=[],value:d,native:c=!1,onChange:y=()=>{},deprecatedEventHandler:f=!1,autoScroll:i=!0,warning:o,error:h,checkNonExistentValues:v=!0,closeOnOptionActionClick:b=!0,testId:E,disabled:I}=e,S=!c&&i===!0,{multi:n,simpleInputs:s,options:a,selectedOptions:l,firstSelectedOptionIndex:u,hasNonExistentValue:p}=Xe(r,d,S,v),g=!n,_=c&&g;c&&!g&&console.warn("Native select does not support provided props (see stories)");const O="Value no longer available for re-selection",C=p&&!I?o?m.jsxs("div",{children:[m.jsx("div",{children:O}),m.jsx("div",{children:o})]}):O:o,q=p&&h&&!I?m.jsxs("div",{children:[m.jsx("div",{children:O}),m.jsx("div",{children:h})]}):h,V=(T,R)=>{if(f){const A=n?R.map(F=>s?F.value:F):s?R.value:R;y(A)}else{const A=!(T instanceof Event),F=n?R:R.value;A?(T.target.name=t,T.target.value=F,n||(T.target.label=R.label),y(T)):y({...T,target:{...T.target,name:t,value:F,...!n&&{label:R.label}}})}};return _?m.jsx(ce,{...e,options:a,selectedOption:l,onChange:V,hasNonExistentValue:p,warning:C,error:q,testId:E}):m.jsx(ve,{...e,options:a,selectedOptions:l,onChange:V,multi:n,firstSelectedOptionIndex:u,warning:C,error:q,testId:E,closeOnOptionActionClick:b})};try{je.displayName="Select",je.__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{je as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as n}from"./jsx-runtime-FsUICBgo.js";import{r as on}from"./index-RfLt4OUa.js";import{S as r}from"./select-
|
|
1
|
+
import{j as n}from"./jsx-runtime-FsUICBgo.js";import{r as on}from"./index-RfLt4OUa.js";import{S as r}from"./select-JjEPivho.js";import{S as D}from"./spacer-Yji9g2AW.js";import{I as W}from"./common-types-U65vzrrz.js";import{I as N}from"./icon-y1a2N5SZ.js";import{T as dn}from"./text-6KQ6ntOV.js";import"./index-VW3EWkuE.js";import"./disabled-context-urNQThQz.js";import"./types-5uVBABF4.js";import"./lodash-Bmg8FrMx.js";import"./tooltip-HEHiU__l.js";import"./index-miLrID2P.js";import"./index-4QtD-hFu.js";import"./extends-dGVwEr9R.js";import"./assertThisInitialized-4q6YPdh3.js";import"./inheritsLoose-Y9jOMJLd.js";import"./memoize-one.esm-hqe5SRxC.js";import"./types-VB5zD18b.js";import"./actions-Z9jDWreP.js";import"./button-7V8oA22w.js";import"./spinner-R8Il4aRe.js";import"./badge-23Ty_zBt.js";import"./select.input-zP5tW20f.js";import"./tslib.es6-OIsz3r9a.js";const cn=[{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Koalas",value:"leaves"},{label:"Monkeys",value:"bananas",disabled:!0},{label:"Wombats",value:"bark"}],un=[{label:"Kangaroos",value:"grass",details:"(grass)"},{label:"Monkeys",value:"bananas",details:"(bananas)"},{label:"Possums",value:"slugs",details:"(slugs)"}],pn=[{type:"Heading",label:"Large"},{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Monkeys",value:"bananas"},{type:"Heading",label:"Small"},{label:"Possums",value:"slugs"}],hn=[{label:1,value:1},{label:2,value:2},{label:3,value:3},{label:4,value:4}],gn=[{label:"Yes",value:!0},{label:"No",value:!1}],vn=[{label:"Aardvarks",value:"termites"},{label:"Monkeys",value:"bananas"},{label:"Vampires",value:"blood",icon:n.jsx(N,{icon:W.WARNING,color:"var(--color-text-warning)"})},{label:"Zombies",value:"brains",icon:n.jsx(N,{icon:W.ERROR,color:"var(--color-text-error)"})}],s=[{label:"Delete",icon:"delete",onClick:()=>{}},{label:"Rename",icon:"rename",onClick:()=>{}}],mn=[{label:"Kangaroos",value:"grass",actions:s},{label:"Monkeys",value:"bananas",actions:s},{label:"Possums",value:"slugs",actions:s,details:"(some details)"}],Sn=[{label:"Kangaroos",value:"grass",actions:s,icon:n.jsx(N,{icon:W.WARNING,color:"var(--color-text-warning)"}),details:"(grass)"},{label:"Monkeys",value:"bananas",actions:s,icon:n.jsx(N,{icon:W.WARNING,color:"var(--color-text-warning)"}),details:"(bananas)"},{label:"Possums",value:"slugs",actions:s,icon:n.jsx(N,{icon:W.WARNING,color:"var(--color-text-warning)"}),details:"(slugs)"}],xn=[...Array(1e4).keys()].map((a,E)=>({label:Math.random().toString(36).substring(7),value:E})),Cn=["Aardvarks","Kangaroos","Monkeys","Possums"],Yn={title:"Forms/Select",component:r,args:{options:cn,native:!1,multi:!1,disabled:!1,autoLayerWidth:!1,clearable:!1,searchable:!0,right:!1}},e=a=>{const{multi:E,value:tn}=a,[O,sn]=on.useState(tn||(E?[]:void 0)),k=rn=>{const{value:I}=rn.target;sn(E?I:{value:I})};return n.jsxs(n.Fragment,{children:[n.jsx(r,{value:O,onChange:k,placeholder:"Full width",...a}),n.jsx(D,{}),n.jsx(r,{value:O,onChange:k,width:"200px",placeholder:"Fixed width",...a}),n.jsx(D,{}),n.jsx(r,{value:O,onChange:k,width:"auto",placeholder:"Auto width",...a}),n.jsx(D,{}),n.jsx(r,{value:O,onChange:k,width:"auto",placeholder:"Small",small:!0,...a}),n.jsx(D,{}),n.jsx(dn,{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:pn};const g=e.bind({});g.args={options:un};const v=e.bind({});v.args={options:vn};const m=e.bind({});m.args={options:mn};const S=e.bind({});S.args={options:Sn};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:hn,placeholder:void 0};const f=e.bind({});f.args={options:gn};const A=e.bind({});A.args={options:Cn};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:xn};const T=e.bind({});T.args={deprecatedEventHandler:!0};const F=e.bind({});F.args={value:{label:"Vampires",value:"blood"},disabled:!0};var R,M,H;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-FsUICBgo.js";import{r as x}from"./index-RfLt4OUa.js";import{I as j}from"./common-types-U65vzrrz.js";import{T as g}from"./top-bar-
|
|
1
|
+
import{j as e}from"./jsx-runtime-FsUICBgo.js";import{r as x}from"./index-RfLt4OUa.js";import{I as j}from"./common-types-U65vzrrz.js";import{T as g}from"./top-bar-3dxv0sp9.js";import{S as w}from"./side-bar-Fjr2t9MT.js";import{H as t}from"./heading-Bk0bpNfe.js";import{B as L}from"./button-7V8oA22w.js";import{D as v}from"./drawer-WuErQ5Z8.js";import{L as d}from"./list-8l-RGDgw.js";import{F as l}from"./field-eknsj_Ll.js";import{I as a}from"./input-u1He-wWs.js";import{C as m}from"./check-box-s9CvqRSD.js";import{P as f}from"./page-9-f6BzS0.js";import{R as o,C as i}from"./row-vFUhHoz5.js";import{A as u}from"./accordion-6_27SROY.js";import{S as s}from"./spacer-Yji9g2AW.js";import{T as F}from"./tabs-fcLbHC1n.js";import"./index-VW3EWkuE.js";import"./icon-y1a2N5SZ.js";import"./inheritsLoose-Y9jOMJLd.js";import"./tslib.es6-OIsz3r9a.js";import"./index-4QtD-hFu.js";import"./disabled-context-urNQThQz.js";import"./actions-Z9jDWreP.js";import"./lodash-Bmg8FrMx.js";import"./tooltip-HEHiU__l.js";import"./index-miLrID2P.js";import"./types-VB5zD18b.js";import"./types-5uVBABF4.js";import"./badge-23Ty_zBt.js";import"./index-ugi_ZH6T.js";import"./help-icon--rUDxLUD.js";import"./spinner-R8Il4aRe.js";import"./index.es-JXn3JM7k.js";import"./extends-dGVwEr9R.js";import"./redux-F5dueAP3.js";import"./objectSpread2-93s0nBry.js";import"./memoize-one.esm-hqe5SRxC.js";import"./card-0r8RRVk-.js";import"./list-heading-Vd3hu5Pf.js";import"./loader-TGOJBZQG.js";import"./label-0_Qf6I8t.js";import"./styled-components.browser.esm-qIipjd6c.js";import"./select.input-zP5tW20f.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"}),xe={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 l,c as n,s as d}from"./index-
|
|
1
|
+
import{S as l,c as n,s as d}from"./index-PqLI7NLX.js";import"./iframe-AtjhTGyx.js";import"../sb-preview/runtime.js";import"./index-RfLt4OUa.js";import"./index-miLrID2P.js";import"./extends-dGVwEr9R.js";import"./assertThisInitialized-4q6YPdh3.js";import"./inheritsLoose-Y9jOMJLd.js";import"./index-gM75B7fB.js";export{l as SyntaxHighlighter,n as createCopyToClipboardFunction,d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n}from"./jsx-runtime-FsUICBgo.js";import{r as T}from"./index-RfLt4OUa.js";import{c as N}from"./index-VW3EWkuE.js";import{I as He,D as Pe,C as Le,P as De}from"./index.es-JXn3JM7k.js";import{l as Fe}from"./lodash-Bmg8FrMx.js";import{A as ye}from"./actions-ESle7xCw.js";import{H as $e}from"./heading-Bk0bpNfe.js";import{P as Oe}from"./pagination-xSK12Mw6.js";import{A as b,I as $}from"./common-types-U65vzrrz.js";import{I as Be}from"./input-u1He-wWs.js";import{N as Me}from"./number-input-SvjJIGsW.js";import{S as Ge}from"./select-5jrVNbFb.js";import{D as Ue}from"./disabled-context-urNQThQz.js";import{i as O}from"./types-5uVBABF4.js";import{T as fe}from"./tooltip-HEHiU__l.js";import{C as Xe}from"./check-box-s9CvqRSD.js";import{S as Je}from"./slider-nl2rJ9LF.js";import{I as B}from"./icon-y1a2N5SZ.js";import{P as Ke}from"./popover-Y3FpGdUS.js";import{H as Ee}from"./help-icon--rUDxLUD.js";import{T as ee}from"./text-6KQ6ntOV.js";const ze="_inputInTable_y9car_1",Ye="_inputHover_y9car_13",Qe="_inputFocus_y9car_18",Ze="_inputError_y9car_25",en="_inputWarning_y9car_26",nn="_inputDisabled_y9car_61",tn="_hideScrollbars_y9car_67",rn="_wrapper_y9car_85",an="_bordered_y9car_93",ln="_scroll_y9car_98",on="_table_y9car_108",sn="_striped_y9car_188",H={inputInTable:ze,inputHover:Ye,inputFocus:Qe,inputError:Ze,inputWarning:en,inputDisabled:nn,hideScrollbars:tn,wrapper:rn,bordered:an,scroll:ln,table:on,striped:sn},dn="_title_11pbp_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(ye,{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:y}=t,g=Number((p=(d=y==null?void 0:y.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(ye,{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)},Ve=e=>e.reduce((t,a)=>a.actions&&a.actions.length>0?1:t,0),_n=(e,t)=>Ve(t)>0||Ve(e)>0,J=({table:e,children:t})=>{const{rows:a,infiniteScroll:l}=e,r=Math.ceil(window.innerHeight/30),[o,s]=l?T.useState(r):[a.length,null],[u,d]=l?T.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{J.displayName="TableScrollWrapper",J.__docgenInfo={description:"",displayName:"TableScrollWrapper",props:{table:{defaultValue:null,description:"",name:"table",required:!0,type:{name:"ITableProps"}}}}}catch{}const gn="_clickableRow_11d5t_1",yn="_hoverableRow_11d5t_4",fn="_rowActive_11d5t_4",hn="_expandableRow_11d5t_8",bn="_flush_11d5t_8",xn="_dragIconCell_11d5t_28",Cn="_dragIcon_11d5t_28",R={clickableRow:gn,hoverableRow:yn,rowActive:fn,expandableRow:hn,flush:bn,dragIconCell:xn,dragIcon:Cn},K=({colSpan:e,children:t,flush:a})=>n.jsx("tr",{children:n.jsx("td",{colSpan:e,className:N(R.expandableRow,a?R.flush:""),children:t})});try{K.displayName="ExpandedContentRow",K.__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 Te=(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."),[])},jn="_inputInTable_u3xdj_1",Nn="_inputHover_u3xdj_13",wn="_inputFocus_u3xdj_18",An="_inputError_u3xdj_25",vn="_inputWarning_u3xdj_26",Rn="_inputDisabled_u3xdj_61",Sn="_hideScrollbars_u3xdj_67",Vn="_cell_u3xdj_77",Tn="_disabledLink_u3xdj_87",qn="_inputWrapper_u3xdj_91",En="_breakWord_u3xdj_106",kn="_inputCell_u3xdj_109",Wn="_sliderCell_u3xdj_112",Hn="_staticCell_u3xdj_116",Pn="_staticCellContent_u3xdj_119",Ln="_error_u3xdj_131",Dn="_warning_u3xdj_132",Fn="_unit_u3xdj_141",$n="_sortingCell_u3xdj_144",On="_sortingCellIcon_u3xdj_155",Bn="_icon_u3xdj_166",Mn="_checkBoxCell_u3xdj_170",Gn="_iconCellWrapper_u3xdj_174",Un="_actionsCell_u3xdj_178",Xn="_rightAligned_u3xdj_186",Jn="_centerAligned_u3xdj_192",Kn="_leftAligned_u3xdj_198",zn="_popover_u3xdj_201",Yn="_disabledPointerEvents_u3xdj_204",i={inputInTable:jn,inputHover:Nn,inputFocus:wn,inputError:An,inputWarning:vn,inputDisabled:Rn,hideScrollbars:Sn,cell:Vn,disabledLink:Tn,inputWrapper:qn,breakWord:En,inputCell:kn,sliderCell:Wn,staticCell:Hn,staticCellContent:Pn,error:Ln,warning:Dn,unit:Fn,sortingCell:$n,sortingCellIcon:On,icon:Bn,checkBoxCell:Mn,iconCellWrapper:Gn,actionsCell:Un,rightAligned:Xn,centerAligned:Jn,leftAligned:Kn,popover:zn,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=T.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(fe,{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:N(i.staticCellContent,l?i.error:r?i.warning:""),children:n.jsx("a",{className:N((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(Je,{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(fe,{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(ye,{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 z=({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:N(i.staticCellContent,p==="Unit"?i.unit:"",l?i.error:r?i.warning:""),onClick:u?y=>d&&d(y):()=>{},"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(fe,{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{z.displayName="StaticCell",z.__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(Ke,{content:a,fullWidth:l,closeOnOutsideClick:r,disabled:o,children:n.jsx("div",{className:i.popover,children:n.jsx(z,{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(z,{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,columnAlignment:l=b.LEFT,width:r,snapshot:o,testId:s})=>{if(!e)return null;const{style:u,colSpan:d,rowSpan:p,width:c}=e,y=T.useRef(null),g={bodyAlignment:l,headerAlignment:a,isHeader:t},P=Te(g,i),x=Te(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=N(i.cell,L,e.hasSort?i.sortingCell:null,P,e.breakWord?i.breakWord:""),q=c??r??((o==null?void 0:o.isDragging)&&y.current&&y.current.offsetWidth)??void 0,C={width:q,minWidth:q,...u},A=t?"th":"td";return n.jsx(A,{ref:y,className:w,style:C,colSpan:d,rowSpan:p,children:n.jsx(ge,{cell:e,columnAlignment:x??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:null,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 F=({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:y,columnWidths:g,testId:P})=>{const x=T.useRef(null),L=In(o,a,t),{onRowClick:w,onRowFocus:q,onRowMouseEnter:C,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)}),V=u&&n.jsx(Y,{cell:{type:S.ACTIONS,actions:e.actions},isHeader:a},l),k=(h,v)=>({minWidth:h&&`${y}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:x,onClick:w,onMouseEnter:C,onMouseLeave:A,onFocus:q,className:N(w?R.clickableRow:null,C?R.hoverableRow:null),children:[d?n.jsx("th",{}):null,E,V]},t),I&&I.content?n.jsx(K,{colSpan:r,flush:I.flush===!0,children:I.content},`${t}_expanded_content`):null]}):n.jsxs(n.Fragment,{children:[n.jsxs("tr",{onClick:w,onMouseEnter:C,onMouseLeave:A,onFocus:q,className:N(w&&!w.noStyle?R.clickableRow:null,C&&!C.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,V]},t),I&&I.content?n.jsx(K,{colSpan:r,flush:I.flush===!0,children:I.content},`${t}_expanded_content`):null]})};try{F.displayName="Row",F.__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,je,Ne,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:y=!0,testId:g,draggable:P,defaultEmptyRow:x=null,onAddRow:L=null,bordered:w=!0,maxHeight:q,fixedWidth:C}=a,A=T.useRef(null),[I,Q]=T.useState({width:0,height:0});T.useEffect(()=>{A.current&&Q({width:A.current.offsetWidth,height:A.current.offsetHeight})},[]);const E=Fe.get(e,"table.headers",[]),V=mn(s,E),k=_n(s,E),W=V+(k?1:0),h=r?((je=(Ie=r==null?void 0:r.pagination)==null?void 0:Ie.rowsPerPage)==null?void 0:je.value)===0||Number((Ne=r==null?void 0:r.pagination)==null?void 0:Ne.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=x==null?void 0:x.cells)==null?void 0:Re.length)&&L&&h,ke={cells:v?x.cells.map((m,j)=>(m==null?void 0:m.type)==="Input"?{...m,onChange:_=>{var M;const f=(M=_==null?void 0:_.target)==null?void 0:M.value,D={...x,cells:x.cells.map((G,We)=>({...G,value:We===j?f:G==null?void 0:G.value}))};L({newRow:D})}}:{...m,disabled:!0}):null,testId:g?`${g}-last-empty-row`:void 0},Z=v?s.concat(ke):s,be={...a,rows:Z},xe=N(H.wrapper,w?H.bordered:""),Ce={maxHeight:q,width:C,display:C==="auto"?"inline-flex":"flex"};return P?n.jsxs("div",{ref:A,className:xe,style:Ce,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(Pe,{onDragEnd:m=>{var f,D;const j=(f=m==null?void 0:m.source)==null?void 0:f.index,_=(D=m==null?void 0:m.destination)==null?void 0:D.index;typeof j=="number"&&typeof _=="number"&&t({from:j,to:_})},children:n.jsx(Le,{droppableId:"droppable",children:m=>n.jsx(J,{table:be,children:({visibleRows:j})=>n.jsxs("table",{className:N(H.table,y?H.striped:""),"data-testid":g,ref:m.innerRef,children:[n.jsx("thead",{children:E.map((_,f)=>n.jsx(F,{rowIndex:f,isHeader:!0,row:_,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p,draggableTable:P},`0_${f}`))}),n.jsxs("tbody",{children:[Z.slice(0,j).map((_,f)=>n.jsx(De,{draggableId:f+"",index:f,isDragDisabled:_.noDrag,children:(D,M)=>n.jsx(F,{rowIndex:f,row:_,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,provided:D,snapshot:M,draggableTable:P,width:I.width},`1_${f}`)},`index_${f}`)),m.placeholder]})]})})})}),r&&n.jsx(X,{pagination:r.pagination,actions:r.actions,content:r.content})]}):n.jsxs("div",{className:xe,style:Ce,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(J,{table:be,children:({visibleRows:m})=>n.jsxs("table",{className:N(H.table,y?H.striped:""),"data-testid":g,children:[n.jsx("thead",{children:E.map((j,_)=>n.jsx(F,{rowIndex:_,isHeader:!0,row:j,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p},`0_${_}`))}),n.jsx("tbody",{children:Z.slice(0,m).map((j,_)=>n.jsx(F,{rowIndex:_,row:j,columnCount:V,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-FsUICBgo.js";import{r as T}from"./index-RfLt4OUa.js";import{c as N}from"./index-VW3EWkuE.js";import{I as He,D as Pe,C as Le,P as De}from"./index.es-JXn3JM7k.js";import{l as Fe}from"./lodash-Bmg8FrMx.js";import{A as ye}from"./actions-Z9jDWreP.js";import{H as $e}from"./heading-Bk0bpNfe.js";import{P as Oe}from"./pagination-5n5spTRo.js";import{A as b,I as $}from"./common-types-U65vzrrz.js";import{I as Be}from"./input-u1He-wWs.js";import{N as Me}from"./number-input-SvjJIGsW.js";import{S as Ge}from"./select-JjEPivho.js";import{D as Ue}from"./disabled-context-urNQThQz.js";import{i as O}from"./types-5uVBABF4.js";import{T as fe}from"./tooltip-HEHiU__l.js";import{C as Xe}from"./check-box-s9CvqRSD.js";import{S as Je}from"./slider-nl2rJ9LF.js";import{I as B}from"./icon-y1a2N5SZ.js";import{P as Ke}from"./popover-Y3FpGdUS.js";import{H as Ee}from"./help-icon--rUDxLUD.js";import{T as ee}from"./text-6KQ6ntOV.js";const ze="_inputInTable_y9car_1",Ye="_inputHover_y9car_13",Qe="_inputFocus_y9car_18",Ze="_inputError_y9car_25",en="_inputWarning_y9car_26",nn="_inputDisabled_y9car_61",tn="_hideScrollbars_y9car_67",rn="_wrapper_y9car_85",an="_bordered_y9car_93",ln="_scroll_y9car_98",on="_table_y9car_108",sn="_striped_y9car_188",H={inputInTable:ze,inputHover:Ye,inputFocus:Qe,inputError:Ze,inputWarning:en,inputDisabled:nn,hideScrollbars:tn,wrapper:rn,bordered:an,scroll:ln,table:on,striped:sn},dn="_title_11pbp_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(ye,{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:y}=t,g=Number((p=(d=y==null?void 0:y.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(ye,{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)},Ve=e=>e.reduce((t,a)=>a.actions&&a.actions.length>0?1:t,0),_n=(e,t)=>Ve(t)>0||Ve(e)>0,J=({table:e,children:t})=>{const{rows:a,infiniteScroll:l}=e,r=Math.ceil(window.innerHeight/30),[o,s]=l?T.useState(r):[a.length,null],[u,d]=l?T.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{J.displayName="TableScrollWrapper",J.__docgenInfo={description:"",displayName:"TableScrollWrapper",props:{table:{defaultValue:null,description:"",name:"table",required:!0,type:{name:"ITableProps"}}}}}catch{}const gn="_clickableRow_11d5t_1",yn="_hoverableRow_11d5t_4",fn="_rowActive_11d5t_4",hn="_expandableRow_11d5t_8",bn="_flush_11d5t_8",xn="_dragIconCell_11d5t_28",Cn="_dragIcon_11d5t_28",R={clickableRow:gn,hoverableRow:yn,rowActive:fn,expandableRow:hn,flush:bn,dragIconCell:xn,dragIcon:Cn},K=({colSpan:e,children:t,flush:a})=>n.jsx("tr",{children:n.jsx("td",{colSpan:e,className:N(R.expandableRow,a?R.flush:""),children:t})});try{K.displayName="ExpandedContentRow",K.__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 Te=(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."),[])},jn="_inputInTable_u3xdj_1",Nn="_inputHover_u3xdj_13",wn="_inputFocus_u3xdj_18",An="_inputError_u3xdj_25",vn="_inputWarning_u3xdj_26",Rn="_inputDisabled_u3xdj_61",Sn="_hideScrollbars_u3xdj_67",Vn="_cell_u3xdj_77",Tn="_disabledLink_u3xdj_87",qn="_inputWrapper_u3xdj_91",En="_breakWord_u3xdj_106",kn="_inputCell_u3xdj_109",Wn="_sliderCell_u3xdj_112",Hn="_staticCell_u3xdj_116",Pn="_staticCellContent_u3xdj_119",Ln="_error_u3xdj_131",Dn="_warning_u3xdj_132",Fn="_unit_u3xdj_141",$n="_sortingCell_u3xdj_144",On="_sortingCellIcon_u3xdj_155",Bn="_icon_u3xdj_166",Mn="_checkBoxCell_u3xdj_170",Gn="_iconCellWrapper_u3xdj_174",Un="_actionsCell_u3xdj_178",Xn="_rightAligned_u3xdj_186",Jn="_centerAligned_u3xdj_192",Kn="_leftAligned_u3xdj_198",zn="_popover_u3xdj_201",Yn="_disabledPointerEvents_u3xdj_204",i={inputInTable:jn,inputHover:Nn,inputFocus:wn,inputError:An,inputWarning:vn,inputDisabled:Rn,hideScrollbars:Sn,cell:Vn,disabledLink:Tn,inputWrapper:qn,breakWord:En,inputCell:kn,sliderCell:Wn,staticCell:Hn,staticCellContent:Pn,error:Ln,warning:Dn,unit:Fn,sortingCell:$n,sortingCellIcon:On,icon:Bn,checkBoxCell:Mn,iconCellWrapper:Gn,actionsCell:Un,rightAligned:Xn,centerAligned:Jn,leftAligned:Kn,popover:zn,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=T.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(fe,{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:N(i.staticCellContent,l?i.error:r?i.warning:""),children:n.jsx("a",{className:N((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(Je,{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(fe,{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(ye,{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 z=({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:N(i.staticCellContent,p==="Unit"?i.unit:"",l?i.error:r?i.warning:""),onClick:u?y=>d&&d(y):()=>{},"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(fe,{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{z.displayName="StaticCell",z.__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(Ke,{content:a,fullWidth:l,closeOnOutsideClick:r,disabled:o,children:n.jsx("div",{className:i.popover,children:n.jsx(z,{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(z,{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,columnAlignment:l=b.LEFT,width:r,snapshot:o,testId:s})=>{if(!e)return null;const{style:u,colSpan:d,rowSpan:p,width:c}=e,y=T.useRef(null),g={bodyAlignment:l,headerAlignment:a,isHeader:t},P=Te(g,i),x=Te(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=N(i.cell,L,e.hasSort?i.sortingCell:null,P,e.breakWord?i.breakWord:""),q=c??r??((o==null?void 0:o.isDragging)&&y.current&&y.current.offsetWidth)??void 0,C={width:q,minWidth:q,...u},A=t?"th":"td";return n.jsx(A,{ref:y,className:w,style:C,colSpan:d,rowSpan:p,children:n.jsx(ge,{cell:e,columnAlignment:x??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:null,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 F=({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:y,columnWidths:g,testId:P})=>{const x=T.useRef(null),L=In(o,a,t),{onRowClick:w,onRowFocus:q,onRowMouseEnter:C,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)}),V=u&&n.jsx(Y,{cell:{type:S.ACTIONS,actions:e.actions},isHeader:a},l),k=(h,v)=>({minWidth:h&&`${y}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:x,onClick:w,onMouseEnter:C,onMouseLeave:A,onFocus:q,className:N(w?R.clickableRow:null,C?R.hoverableRow:null),children:[d?n.jsx("th",{}):null,E,V]},t),I&&I.content?n.jsx(K,{colSpan:r,flush:I.flush===!0,children:I.content},`${t}_expanded_content`):null]}):n.jsxs(n.Fragment,{children:[n.jsxs("tr",{onClick:w,onMouseEnter:C,onMouseLeave:A,onFocus:q,className:N(w&&!w.noStyle?R.clickableRow:null,C&&!C.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,V]},t),I&&I.content?n.jsx(K,{colSpan:r,flush:I.flush===!0,children:I.content},`${t}_expanded_content`):null]})};try{F.displayName="Row",F.__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,je,Ne,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:y=!0,testId:g,draggable:P,defaultEmptyRow:x=null,onAddRow:L=null,bordered:w=!0,maxHeight:q,fixedWidth:C}=a,A=T.useRef(null),[I,Q]=T.useState({width:0,height:0});T.useEffect(()=>{A.current&&Q({width:A.current.offsetWidth,height:A.current.offsetHeight})},[]);const E=Fe.get(e,"table.headers",[]),V=mn(s,E),k=_n(s,E),W=V+(k?1:0),h=r?((je=(Ie=r==null?void 0:r.pagination)==null?void 0:Ie.rowsPerPage)==null?void 0:je.value)===0||Number((Ne=r==null?void 0:r.pagination)==null?void 0:Ne.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=x==null?void 0:x.cells)==null?void 0:Re.length)&&L&&h,ke={cells:v?x.cells.map((m,j)=>(m==null?void 0:m.type)==="Input"?{...m,onChange:_=>{var M;const f=(M=_==null?void 0:_.target)==null?void 0:M.value,D={...x,cells:x.cells.map((G,We)=>({...G,value:We===j?f:G==null?void 0:G.value}))};L({newRow:D})}}:{...m,disabled:!0}):null,testId:g?`${g}-last-empty-row`:void 0},Z=v?s.concat(ke):s,be={...a,rows:Z},xe=N(H.wrapper,w?H.bordered:""),Ce={maxHeight:q,width:C,display:C==="auto"?"inline-flex":"flex"};return P?n.jsxs("div",{ref:A,className:xe,style:Ce,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(Pe,{onDragEnd:m=>{var f,D;const j=(f=m==null?void 0:m.source)==null?void 0:f.index,_=(D=m==null?void 0:m.destination)==null?void 0:D.index;typeof j=="number"&&typeof _=="number"&&t({from:j,to:_})},children:n.jsx(Le,{droppableId:"droppable",children:m=>n.jsx(J,{table:be,children:({visibleRows:j})=>n.jsxs("table",{className:N(H.table,y?H.striped:""),"data-testid":g,ref:m.innerRef,children:[n.jsx("thead",{children:E.map((_,f)=>n.jsx(F,{rowIndex:f,isHeader:!0,row:_,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p,draggableTable:P},`0_${f}`))}),n.jsxs("tbody",{children:[Z.slice(0,j).map((_,f)=>n.jsx(De,{draggableId:f+"",index:f,isDragDisabled:_.noDrag,children:(D,M)=>n.jsx(F,{rowIndex:f,row:_,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,provided:D,snapshot:M,draggableTable:P,width:I.width},`1_${f}`)},`index_${f}`)),m.placeholder]})]})})})}),r&&n.jsx(X,{pagination:r.pagination,actions:r.actions,content:r.content})]}):n.jsxs("div",{className:xe,style:Ce,children:[n.jsx(U,{actions:u,actionsRight:d,name:o,testId:g&&`${g}-title`}),n.jsx(J,{table:be,children:({visibleRows:m})=>n.jsxs("table",{className:N(H.table,y?H.striped:""),"data-testid":g,children:[n.jsx("thead",{children:E.map((j,_)=>n.jsx(F,{rowIndex:_,isHeader:!0,row:j,columnCount:V,columnWidths:l,colSpan:W,hasRowActions:k,columnAlignment:c,columnHeaderAlignments:p},`0_${_}`))}),n.jsx("tbody",{children:Z.slice(0,m).map((j,_)=>n.jsx(F,{rowIndex:_,row:j,columnCount:V,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 n}from"./jsx-runtime-FsUICBgo.js";import{r as S}from"./index-RfLt4OUa.js";import{f as K}from"./immer.esm-bD7SSJ7T.js";import{l as oe}from"./lodash-Bmg8FrMx.js";import{G as se}from"./grid-u1mZpaML.js";import{T as V}from"./text-6KQ6ntOV.js";import{T as A}from"./table-GUPoXZvd.js";import{C as sn}from"./card-0r8RRVk-.js";import{I as ae}from"./input-u1He-wWs.js";import{F as re}from"./field-eknsj_Ll.js";import{H as ln}from"./heading-Bk0bpNfe.js";import{t as ne,a as on,b as cn,c as dn,d as un,e as pn,f as gn,g as mn}from"./table.stories-data-I6ced_TS.js";import"./styled-components.browser.esm-qIipjd6c.js";import"./tslib.es6-OIsz3r9a.js";import"./index-VW3EWkuE.js";import"./index.es-JXn3JM7k.js";import"./inheritsLoose-Y9jOMJLd.js";import"./extends-dGVwEr9R.js";import"./redux-F5dueAP3.js";import"./objectSpread2-93s0nBry.js";import"./index-miLrID2P.js";import"./memoize-one.esm-hqe5SRxC.js";import"./icon-y1a2N5SZ.js";import"./index-4QtD-hFu.js";import"./disabled-context-urNQThQz.js";import"./actions-ESle7xCw.js";import"./common-types-U65vzrrz.js";import"./button-7V8oA22w.js";import"./spinner-R8Il4aRe.js";import"./tooltip-HEHiU__l.js";import"./types-VB5zD18b.js";import"./types-5uVBABF4.js";import"./badge-23Ty_zBt.js";import"./pagination-xSK12Mw6.js";import"./select-5jrVNbFb.js";import"./assertThisInitialized-4q6YPdh3.js";import"./select.input-zP5tW20f.js";import"./input-group-R8LoqKRn.js";import"./input-group-addon-BHVsW9mL.js";import"./number-input-SvjJIGsW.js";import"./index-IQMsp8Ab.js";import"./index-cCpkwrS5.js";import"./check-box-s9CvqRSD.js";import"./help-icon--rUDxLUD.js";import"./slider-nl2rJ9LF.js";import"./index-ugi_ZH6T.js";import"./popover-Y3FpGdUS.js";import"./label-0_Qf6I8t.js";import"./flex-3eLDDUyy.js";const dt={title:"Basic/Table",component:A,args:{table:{...ne}}},I=g=>n.jsx(A,{...g}),B=I.bind({}),_=I.bind({});_.args={table:{...ne,fixedWidth:"400px"}};const M=I.bind({});M.args={table:{...ne,fixedWidth:"auto"}};const O=I.bind({});O.args={table:on};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 L=I.bind({});L.args={table:cn};const U=I.bind({});U.args={table:dn};U.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const Q=I.bind({});Q.args={table:un};const E=I.bind({});E.args={table:pn};E.decorators=[g=>n.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:n.jsx(g,{})})];const N=I.bind({});N.args={table:gn};N.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const G=I.bind({});G.args={table:mn};const q=()=>n.jsx(sn,{heading:n.jsx(ln,{children:"Card heading"}),padding:!1,children:n.jsx(A,{table:{...ne,bordered:!1}})});q.parameters={docs:{source:{type:"dynamic"}}};const z=()=>{const g=["Section","Width","Height"];let u=["","m","m"],r=[...Array(175).keys()].map((s,t)=>[t,t*2,t*2]);const T=(s,t,i)=>s==="m"&&t==="ft"?i*3.28084:s==="ft"&&t==="m"?i/3.28084:i,o=(s,t,i,p)=>{r[t][i]=s.target.value,p()},C=s=>{r=r.concat([["","",""]]),s()},k=(s,t)=>{r=r.filter((i,p)=>p!==s),t()},d=(s,t,i)=>{const p=u[t],y=s.target.value;u=u.map((R,h)=>h===t?y:R),r=r.map(R=>R.map((h,b)=>b===t?T(p,y,h):h)),i()},m=()=>{const s=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[t,i]=S.useState(10),[p,y]=S.useState(1),[R,h]=S.useState(!1),b=()=>{h(!R)},W=()=>{const e=Math.ceil(r.length/t);y(e)},D=(p-1)*t,a=t===0?r.length-1:D+t,c={headers:[{cells:g.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{C(b),W()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:u[1],type:"Select",native:!0,onChange:e=>d(e,1,b)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:u[2],type:"Select",native:!0,onChange:e=>d(e,2,b)}]}],rows:r.slice(D,a).map((e,l)=>{const P=D+l;return{cells:[...Array(3).keys()].map((f,w)=>({value:e[w],type:"Input",onChange:x=>o(x,P,w,b)})),actions:[{label:"Delete",icon:"minus",onClick:()=>k(P,b)}]}}),footer:{pagination:{rowCount:r.length,selectedPage:p,rowsPerPage:{onChange:e=>{const{value:l}=e.target;i(Number(l))},options:s,value:t},onSelectPage:e=>y(e),small:!0}}};return n.jsx(A,{table:c})};return n.jsx(m,{})},J=()=>{const g=["Section","Width","Height"];let u=[...Array(175).keys()].map((T,o)=>({Section:o,Width:o*2,Height:o*2}));const r=()=>{const T=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[o,C]=S.useState(10),[k,d]=S.useState(1),[m,s]=S.useState({}),[t,i]=S.useState({});S.useEffect(()=>{d(1)},[m,t]);const p=(k-1)*o,y=o===0?u.length-1:p+o,R=(e,l,P)=>e.filter(f=>Object.keys(l).every(w=>l[w]===""?!0:f[w].toString().includes(l[w]))).sort((f,w)=>Object.entries(P).map(([x,F])=>{switch(F){case"up":return f[x]-w[x];case"down":return w[x]-f[x];default:return 0}}).reduce((x,F)=>x||F,0)),h=(e,l,P,f,w)=>{const x=e.map(v=>{const j=Object.keys(f).includes(v)?f[v]:"",H=`${v[0].toUpperCase()}${v.slice(1)}`;return{key:v,value:H,hasSort:!0,sort:j,onSort:()=>{const $=j===""?"up":j==="up"?"down":"";w({...f,[v]:$})}}}),F=e.map(v=>{const j=Object.keys(l).includes(v)?l[v]:"";return{key:v,value:j,type:"Input",placeholder:"Filter",onChange:H=>P({...l,[v]:H.target.value})}});return{dataSortCells:x,dataFilterCells:F}},{dataSortCells:b,dataFilterCells:W}=h(g,m,s,t,i),D=R(u,m,t),a=[...D.slice(p,y).map(e=>({cells:Object.entries(e).map(([P,f])=>({key:P,value:f,type:"Input",disabled:!0}))}))],c={headers:[{cells:b},{cells:W}],rows:a,footer:{pagination:{rowCount:D.length,selectedPage:k,rowsPerPage:{onChange:e=>{const{value:l}=e.target;C(Number(l))},options:T,value:o},onSelectPage:e=>d(e),small:!0}}};return n.jsx(A,{table:c})};return n.jsx(r,{})},X=()=>{const g={tea:3.6,coffee:3.2,orange:4.1},u=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],r={cells:[{type:"Select",options:u,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},T=[...Array(15).keys()].map((a,c)=>({cells:[{type:"Select",options:u,value:{value:"tea"}},{type:"Input",value:c+1},{type:"Static"}]})),[o,C]=S.useState(T),k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[d,m]=S.useState(10),[s,t]=S.useState(1),i=(s-1)*d,p=d===0?o.length-1:i+d,y=({newRow:a}={})=>{const c=K(o,e=>{e.push(a??r)});C(c)},R=({rowIndex:a})=>{const c=K(o,e=>{delete e[a]}).filter(e=>e);C(c)},h=({rowIndex:a,value:c})=>{const e=K(o,l=>{l[a].cells[0].value.value=c});C(e)},b=({rowIndex:a,value:c})=>{const e=K(o,l=>{l[a].cells[1].value=c});C(e)},W=({value:a})=>{const c=Number(a);return!oe.isNaN(c)&&oe.isInteger(c)&&c>0},D=o.slice(i,p).map((a,c)=>{const e=i+c;return o.length-1,{...a,cells:a==null?void 0:a.cells.map((l,P)=>{var v,j,H,$,le;const f=(H=(j=(v=a==null?void 0:a.cells)==null?void 0:v[0])==null?void 0:j.value)==null?void 0:H.value,w=Number((le=($=a==null?void 0:a.cells)==null?void 0:$[1])==null?void 0:le.value),x=g==null?void 0:g[f],F=x&&W({value:w})?(x*w).toFixed(2):null;if(P===0)return{...l,onChange:te=>h({rowIndex:e,value:te.target.value})};if(P===1)return{...l,onChange:te=>b({rowIndex:e,value:te.target.value}),error:W({value:l.value})?null:"Must be valid whole number"};if(P===2)return{...l,value:F}}),actions:[{label:"Delete",icon:"minus",onClick:()=>R({rowIndex:e})}]}});return n.jsx(A,{table:{defaultEmptyRow:r,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:o.length,selectedPage:s,rowsPerPage:{onChange:a=>{const{value:c}=a.target;m(Number(c))},options:k,value:d},onSelectPage:a=>t(a),small:!0}}}})},Y=()=>{const g=["Section","Width","Height"];let u=Array.from(Array(10),(d,m)=>[m,m*2,m*2]);const[r,T]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),o=(d,m,s,t)=>{u[m][s]=Number(d.target.value),t()},C=(d,m,s,t)=>{var p;let i=((p=d==null?void 0:d.clipboardData)==null?void 0:p.getData("text"))??"";return T({rowIndex:m,cellIndex:s,pastedValues:i}),t(),{pastedData:r}},k=()=>{const[d,m]=S.useState(!1),s=()=>{m(!d)},t={headers:[{cells:g.map(i=>({value:i}))}],rows:u.map((i,p)=>{const y=p;return{cells:[...Array(3).keys()].map((R,h)=>({value:i[h],type:"Input",onChange:b=>o(b,y,h,s),onPaste:b=>C(b,y,h,s)}))}})};return n.jsxs(n.Fragment,{children:[n.jsx(A,{table:t}),n.jsx(re,{label:"Pasted Data",children:n.jsx(ae,{value:r.pastedValues})}),n.jsx(re,{label:"At Row",children:n.jsx(ae,{value:r.rowIndex})}),n.jsx(re,{label:"At Cell Index",children:n.jsx(ae,{value:r.cellIndex})})]})};return n.jsx(k,{})},Z=()=>{const g={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],columnAlignment:[...Array(10)].map((u,r)=>"right"),headers:[{cells:[...Array(10)].map((u,r)=>({value:"Heading"}))},{cells:[...Array(10)].map((u,r)=>({options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],type:"Select",searchable:!1,value:{label:"m",value:"m"},autoLayerWidth:!0}))}],rows:[...Array(10)].map((u,r)=>({cells:[...Array(10)].map((T,o)=>({value:123.45})),actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here lorem ipsum"}),n.jsx(V,{children:"Label: 123.45m"}),n.jsx(V,{children:"Another label: 123.45m"}),n.jsx(V,{children:"Label: 123.45m"})]})}]}))};return n.jsx(A,{table:g})},ee=()=>{const g={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],headers:[{cells:[{value:"Label"},{value:"Value",colSpan:2}]}],rows:[{cells:[{value:"Country",style:{fontWeight:"bold"},width:"120px"},{value:"Norway",colSpan:2}],actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here"}),n.jsx(V,{children:"Details go here"})]})}]},{cells:[{value:"Depth",style:{fontWeight:"bold"}},{value:123,width:"80px"},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:{label:"m",value:"m"},type:"Select",width:"80px"}],actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here"}),n.jsx(V,{children:"Details go here"})]})}]}]};return n.jsx(A,{table:g})};var ie,ce,de;B.parameters={...B.parameters,docs:{...(ie=B.parameters)==null?void 0:ie.docs,source:{originalSource:`args => {
|
|
1
|
+
import{j as n}from"./jsx-runtime-FsUICBgo.js";import{r as S}from"./index-RfLt4OUa.js";import{f as K}from"./immer.esm-bD7SSJ7T.js";import{l as oe}from"./lodash-Bmg8FrMx.js";import{G as se}from"./grid-u1mZpaML.js";import{T as V}from"./text-6KQ6ntOV.js";import{T as A}from"./table-KQyoQ8Lr.js";import{C as sn}from"./card-0r8RRVk-.js";import{I as ae}from"./input-u1He-wWs.js";import{F as re}from"./field-eknsj_Ll.js";import{H as ln}from"./heading-Bk0bpNfe.js";import{t as ne,a as on,b as cn,c as dn,d as un,e as pn,f as gn,g as mn}from"./table.stories-data-9XfBJddg.js";import"./styled-components.browser.esm-qIipjd6c.js";import"./tslib.es6-OIsz3r9a.js";import"./index-VW3EWkuE.js";import"./index.es-JXn3JM7k.js";import"./inheritsLoose-Y9jOMJLd.js";import"./extends-dGVwEr9R.js";import"./redux-F5dueAP3.js";import"./objectSpread2-93s0nBry.js";import"./index-miLrID2P.js";import"./memoize-one.esm-hqe5SRxC.js";import"./icon-y1a2N5SZ.js";import"./index-4QtD-hFu.js";import"./disabled-context-urNQThQz.js";import"./actions-Z9jDWreP.js";import"./common-types-U65vzrrz.js";import"./button-7V8oA22w.js";import"./spinner-R8Il4aRe.js";import"./tooltip-HEHiU__l.js";import"./types-VB5zD18b.js";import"./types-5uVBABF4.js";import"./badge-23Ty_zBt.js";import"./pagination-5n5spTRo.js";import"./select-JjEPivho.js";import"./assertThisInitialized-4q6YPdh3.js";import"./select.input-zP5tW20f.js";import"./input-group-R8LoqKRn.js";import"./input-group-addon-BHVsW9mL.js";import"./number-input-SvjJIGsW.js";import"./index-IQMsp8Ab.js";import"./index-cCpkwrS5.js";import"./check-box-s9CvqRSD.js";import"./help-icon--rUDxLUD.js";import"./slider-nl2rJ9LF.js";import"./index-ugi_ZH6T.js";import"./popover-Y3FpGdUS.js";import"./label-0_Qf6I8t.js";import"./flex-3eLDDUyy.js";const dt={title:"Basic/Table",component:A,args:{table:{...ne}}},I=g=>n.jsx(A,{...g}),B=I.bind({}),_=I.bind({});_.args={table:{...ne,fixedWidth:"400px"}};const M=I.bind({});M.args={table:{...ne,fixedWidth:"auto"}};const O=I.bind({});O.args={table:on};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 L=I.bind({});L.args={table:cn};const U=I.bind({});U.args={table:dn};U.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const Q=I.bind({});Q.args={table:un};const E=I.bind({});E.args={table:pn};E.decorators=[g=>n.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:n.jsx(g,{})})];const N=I.bind({});N.args={table:gn};N.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const G=I.bind({});G.args={table:mn};const q=()=>n.jsx(sn,{heading:n.jsx(ln,{children:"Card heading"}),padding:!1,children:n.jsx(A,{table:{...ne,bordered:!1}})});q.parameters={docs:{source:{type:"dynamic"}}};const z=()=>{const g=["Section","Width","Height"];let u=["","m","m"],r=[...Array(175).keys()].map((s,t)=>[t,t*2,t*2]);const T=(s,t,i)=>s==="m"&&t==="ft"?i*3.28084:s==="ft"&&t==="m"?i/3.28084:i,o=(s,t,i,p)=>{r[t][i]=s.target.value,p()},C=s=>{r=r.concat([["","",""]]),s()},k=(s,t)=>{r=r.filter((i,p)=>p!==s),t()},d=(s,t,i)=>{const p=u[t],y=s.target.value;u=u.map((R,h)=>h===t?y:R),r=r.map(R=>R.map((h,b)=>b===t?T(p,y,h):h)),i()},m=()=>{const s=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[t,i]=S.useState(10),[p,y]=S.useState(1),[R,h]=S.useState(!1),b=()=>{h(!R)},W=()=>{const e=Math.ceil(r.length/t);y(e)},D=(p-1)*t,a=t===0?r.length-1:D+t,c={headers:[{cells:g.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{C(b),W()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:u[1],type:"Select",native:!0,onChange:e=>d(e,1,b)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:u[2],type:"Select",native:!0,onChange:e=>d(e,2,b)}]}],rows:r.slice(D,a).map((e,l)=>{const P=D+l;return{cells:[...Array(3).keys()].map((f,w)=>({value:e[w],type:"Input",onChange:x=>o(x,P,w,b)})),actions:[{label:"Delete",icon:"minus",onClick:()=>k(P,b)}]}}),footer:{pagination:{rowCount:r.length,selectedPage:p,rowsPerPage:{onChange:e=>{const{value:l}=e.target;i(Number(l))},options:s,value:t},onSelectPage:e=>y(e),small:!0}}};return n.jsx(A,{table:c})};return n.jsx(m,{})},J=()=>{const g=["Section","Width","Height"];let u=[...Array(175).keys()].map((T,o)=>({Section:o,Width:o*2,Height:o*2}));const r=()=>{const T=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[o,C]=S.useState(10),[k,d]=S.useState(1),[m,s]=S.useState({}),[t,i]=S.useState({});S.useEffect(()=>{d(1)},[m,t]);const p=(k-1)*o,y=o===0?u.length-1:p+o,R=(e,l,P)=>e.filter(f=>Object.keys(l).every(w=>l[w]===""?!0:f[w].toString().includes(l[w]))).sort((f,w)=>Object.entries(P).map(([x,F])=>{switch(F){case"up":return f[x]-w[x];case"down":return w[x]-f[x];default:return 0}}).reduce((x,F)=>x||F,0)),h=(e,l,P,f,w)=>{const x=e.map(v=>{const j=Object.keys(f).includes(v)?f[v]:"",H=`${v[0].toUpperCase()}${v.slice(1)}`;return{key:v,value:H,hasSort:!0,sort:j,onSort:()=>{const $=j===""?"up":j==="up"?"down":"";w({...f,[v]:$})}}}),F=e.map(v=>{const j=Object.keys(l).includes(v)?l[v]:"";return{key:v,value:j,type:"Input",placeholder:"Filter",onChange:H=>P({...l,[v]:H.target.value})}});return{dataSortCells:x,dataFilterCells:F}},{dataSortCells:b,dataFilterCells:W}=h(g,m,s,t,i),D=R(u,m,t),a=[...D.slice(p,y).map(e=>({cells:Object.entries(e).map(([P,f])=>({key:P,value:f,type:"Input",disabled:!0}))}))],c={headers:[{cells:b},{cells:W}],rows:a,footer:{pagination:{rowCount:D.length,selectedPage:k,rowsPerPage:{onChange:e=>{const{value:l}=e.target;C(Number(l))},options:T,value:o},onSelectPage:e=>d(e),small:!0}}};return n.jsx(A,{table:c})};return n.jsx(r,{})},X=()=>{const g={tea:3.6,coffee:3.2,orange:4.1},u=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],r={cells:[{type:"Select",options:u,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},T=[...Array(15).keys()].map((a,c)=>({cells:[{type:"Select",options:u,value:{value:"tea"}},{type:"Input",value:c+1},{type:"Static"}]})),[o,C]=S.useState(T),k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[d,m]=S.useState(10),[s,t]=S.useState(1),i=(s-1)*d,p=d===0?o.length-1:i+d,y=({newRow:a}={})=>{const c=K(o,e=>{e.push(a??r)});C(c)},R=({rowIndex:a})=>{const c=K(o,e=>{delete e[a]}).filter(e=>e);C(c)},h=({rowIndex:a,value:c})=>{const e=K(o,l=>{l[a].cells[0].value.value=c});C(e)},b=({rowIndex:a,value:c})=>{const e=K(o,l=>{l[a].cells[1].value=c});C(e)},W=({value:a})=>{const c=Number(a);return!oe.isNaN(c)&&oe.isInteger(c)&&c>0},D=o.slice(i,p).map((a,c)=>{const e=i+c;return o.length-1,{...a,cells:a==null?void 0:a.cells.map((l,P)=>{var v,j,H,$,le;const f=(H=(j=(v=a==null?void 0:a.cells)==null?void 0:v[0])==null?void 0:j.value)==null?void 0:H.value,w=Number((le=($=a==null?void 0:a.cells)==null?void 0:$[1])==null?void 0:le.value),x=g==null?void 0:g[f],F=x&&W({value:w})?(x*w).toFixed(2):null;if(P===0)return{...l,onChange:te=>h({rowIndex:e,value:te.target.value})};if(P===1)return{...l,onChange:te=>b({rowIndex:e,value:te.target.value}),error:W({value:l.value})?null:"Must be valid whole number"};if(P===2)return{...l,value:F}}),actions:[{label:"Delete",icon:"minus",onClick:()=>R({rowIndex:e})}]}});return n.jsx(A,{table:{defaultEmptyRow:r,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:o.length,selectedPage:s,rowsPerPage:{onChange:a=>{const{value:c}=a.target;m(Number(c))},options:k,value:d},onSelectPage:a=>t(a),small:!0}}}})},Y=()=>{const g=["Section","Width","Height"];let u=Array.from(Array(10),(d,m)=>[m,m*2,m*2]);const[r,T]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),o=(d,m,s,t)=>{u[m][s]=Number(d.target.value),t()},C=(d,m,s,t)=>{var p;let i=((p=d==null?void 0:d.clipboardData)==null?void 0:p.getData("text"))??"";return T({rowIndex:m,cellIndex:s,pastedValues:i}),t(),{pastedData:r}},k=()=>{const[d,m]=S.useState(!1),s=()=>{m(!d)},t={headers:[{cells:g.map(i=>({value:i}))}],rows:u.map((i,p)=>{const y=p;return{cells:[...Array(3).keys()].map((R,h)=>({value:i[h],type:"Input",onChange:b=>o(b,y,h,s),onPaste:b=>C(b,y,h,s)}))}})};return n.jsxs(n.Fragment,{children:[n.jsx(A,{table:t}),n.jsx(re,{label:"Pasted Data",children:n.jsx(ae,{value:r.pastedValues})}),n.jsx(re,{label:"At Row",children:n.jsx(ae,{value:r.rowIndex})}),n.jsx(re,{label:"At Cell Index",children:n.jsx(ae,{value:r.cellIndex})})]})};return n.jsx(k,{})},Z=()=>{const g={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],columnAlignment:[...Array(10)].map((u,r)=>"right"),headers:[{cells:[...Array(10)].map((u,r)=>({value:"Heading"}))},{cells:[...Array(10)].map((u,r)=>({options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],type:"Select",searchable:!1,value:{label:"m",value:"m"},autoLayerWidth:!0}))}],rows:[...Array(10)].map((u,r)=>({cells:[...Array(10)].map((T,o)=>({value:123.45})),actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here lorem ipsum"}),n.jsx(V,{children:"Label: 123.45m"}),n.jsx(V,{children:"Another label: 123.45m"}),n.jsx(V,{children:"Label: 123.45m"})]})}]}))};return n.jsx(A,{table:g})},ee=()=>{const g={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],headers:[{cells:[{value:"Label"},{value:"Value",colSpan:2}]}],rows:[{cells:[{value:"Country",style:{fontWeight:"bold"},width:"120px"},{value:"Norway",colSpan:2}],actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here"}),n.jsx(V,{children:"Details go here"})]})}]},{cells:[{value:"Depth",style:{fontWeight:"bold"}},{value:123,width:"80px"},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:{label:"m",value:"m"},type:"Select",width:"80px"}],actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here"}),n.jsx(V,{children:"Details go here"})]})}]}]};return n.jsx(A,{table:g})};var ie,ce,de;B.parameters={...B.parameters,docs:{...(ie=B.parameters)==null?void 0:ie.docs,source:{originalSource:`args => {
|
|
2
2
|
return <Table
|
|
3
3
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
4
|
{...args} />;
|