@oliasoft-open-source/react-ui-library 4.11.0-beta-3 → 4.11.1
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/dist/404.html +1 -0
- package/dist/global.css +643 -643
- package/dist/index.js +402 -421
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-KGDBMAHA-DeGjmgTY.js → Color-KGDBMAHA-B3T0ILh4.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-PKQXORMH-DJIj_qEG.js → DocsRenderer-PKQXORMH-CJgueRY3.js} +1 -1
- package/dist/storybook/assets/{accordion.stories-BTxV-ybU.js → accordion.stories-Ctfewlsk.js} +2 -2
- package/dist/storybook/assets/{afe.stories-DFQsvqIV.js → afe.stories-DM18uTAa.js} +2 -2
- package/dist/storybook/assets/{buttons-and-links-BHGzZGPV.js → buttons-and-links-BgjMT4gF.js} +1 -1
- package/dist/storybook/assets/{casing-loads.stories-CJpnsmsZ.js → casing-loads.stories-Cc2cl9m1.js} +2 -2
- package/dist/storybook/assets/{cell.stories-Bpl0Squh.js → cell.stories-D8aQP2lw.js} +2 -2
- package/dist/storybook/assets/check-box.stories-BJ0ShmeC.js +97 -0
- package/dist/storybook/assets/check-box.test-case.stories-CzuYZkUh.js +30 -0
- package/dist/storybook/assets/{chunk-HLWAVYOI-D2p4xoma.js → chunk-HLWAVYOI-DW5riARI.js} +1 -1
- package/dist/storybook/assets/{color-D9KYOiNh.js → color-Cidw5dH_.js} +1 -1
- package/dist/storybook/assets/enum-Bnn40S8Q.js +1 -0
- package/dist/storybook/assets/footer.stories-DcDOHTpf.js +3 -0
- package/dist/storybook/assets/form.stories-BLcmnfy8.js +49 -0
- package/dist/storybook/assets/{formation.stories-BT8VrcqV.js → formation.stories-D9xC_fJP.js} +2 -2
- package/dist/storybook/assets/helpers-JJxzGegQ.js +1 -0
- package/dist/storybook/assets/iframe-BOQa8dKi.js +2 -0
- package/dist/storybook/assets/{index-CNkaN_wz.js → index-CqF2VcgG.js} +1 -1
- package/dist/storybook/assets/{index-C0Iaso0O.js → index-IzFttIXx.js} +88 -88
- package/dist/storybook/assets/initialize-context-BvejO8yS.js +1 -0
- package/dist/storybook/assets/{input-group.stories-CElwRt3p.js → input-group.stories-EhmORqH9.js} +3 -3
- package/dist/storybook/assets/{input-validation-Ccgprl1C.js → input-validation-Barn85e8.js} +2 -2
- package/dist/storybook/assets/{inputs-DtQ245kS.js → inputs-DhSTn98J.js} +2 -2
- package/dist/storybook/assets/{layout-forms-Bm7FYA3V.js → layout-forms-B7tboerR.js} +5 -5
- package/dist/storybook/assets/{layout-general-V7ekuEG7.js → layout-general-IRBlgjFP.js} +1 -1
- package/dist/storybook/assets/menu.stories-DLJSzJa-.js +82 -0
- package/dist/storybook/assets/menu.test-case.stories-DyrNbGBs.js +3 -0
- package/dist/storybook/assets/modal.stories-DOgeTuHT.js +200 -0
- package/dist/storybook/assets/modal.test-case.stories-DQ1Izuq6.js +21 -0
- package/dist/storybook/assets/{number-input-Bpg4Yqmo.js → number-input-Dq8zEk7X.js} +2 -2
- package/dist/storybook/assets/number-input.stories-DUvn4L-Z.js +89 -0
- package/dist/storybook/assets/number-input.test-case.stories-C6CDA2a8.js +92 -0
- package/dist/storybook/assets/{padding-and-spacing-IKi7rvQ-.js → padding-and-spacing-CZZN7tnu.js} +1 -1
- package/dist/storybook/assets/{pagination-CLt-kUlx.js → pagination-DWc8zp3k.js} +1 -1
- package/dist/storybook/assets/{pagination.stories-CTRM0Xou.js → pagination.stories-B5cOvzik.js} +2 -2
- package/dist/storybook/assets/popover.stories-p9_-pH_Q.js +10 -0
- package/dist/storybook/assets/{preview-ZgLLfBPl.js → preview-Bb6CWa9a.js} +2 -2
- package/dist/storybook/assets/{preview-CtQzjqBP.js → preview-u3mhrMoU.js} +1 -1
- package/dist/storybook/assets/{projects.stories-BQswWVCx.js → projects.stories-Co_WnKSx.js} +2 -2
- package/dist/storybook/assets/{radio-button-DmDuw4DA.js → radio-button-C4ljBRED.js} +1 -1
- package/dist/storybook/assets/radio-button.stories-D1rWr6ms.js +61 -0
- package/dist/storybook/assets/radio-button.test-case.stories-DglmHlWs.js +11 -0
- package/dist/storybook/assets/{reservoirs.stories-B12tIrmZ.js → reservoirs.stories-UW_8sofe.js} +2 -2
- package/dist/storybook/assets/{rich-text-input.stories-DkaOBgbE.js → rich-text-input.stories-CK_OTGiV.js} +3 -3
- package/dist/storybook/assets/{row.stories-msEoNdGI.js → row.stories-D1iDHHxo.js} +2 -2
- package/dist/storybook/assets/select-03uRbc4I.js +61 -0
- package/dist/storybook/assets/select.input-CJed_LLR.js +1 -0
- package/dist/storybook/assets/select.stories-Bpffz9TF.js +498 -0
- package/dist/storybook/assets/select.stories-data-DxgWKlU6.js +1 -0
- package/dist/storybook/assets/select.test-case.stories-DwDNDHax.js +82 -0
- package/dist/storybook/assets/{site.stories-umpPYjkq.js → site.stories-ZGohyW6Z.js} +2 -2
- package/dist/storybook/assets/{table-5Y5KPNSk.js → table-Cw1-vdpR.js} +1 -1
- package/dist/storybook/assets/{table.stories-Clltxls0.js → table.stories-oLm8-Sg3.js} +2 -2
- package/dist/storybook/assets/{tabs-C3NG6m9W.js → tabs-BoToLVEP.js} +1 -1
- package/dist/storybook/assets/tabs.stories-B52iEaHf.js +30 -0
- package/dist/storybook/assets/{title.stories-CsrYTGde.js → title.stories-iTXgnNqS.js} +3 -3
- package/dist/storybook/assets/toaster.stories-G6nKp3uV.js +84 -0
- package/dist/storybook/assets/toaster.test-case.stories-CCHTh_U1.js +6 -0
- package/dist/storybook/assets/toggle.stories-BAislK3I.js +106 -0
- package/dist/storybook/assets/toggle.test-case.stories-CeUwdhGD.js +36 -0
- package/dist/storybook/assets/{tooltip.test-case.stories-CHibN8rC.js → tooltip.test-case.stories-C0wxGvKJ.js} +1 -1
- package/dist/storybook/assets/unit-input-DZs3wEdY.js +10 -0
- package/dist/storybook/assets/unit-input.stories-BRl4TnIK.js +198 -0
- package/dist/storybook/assets/unit-input.test-case.stories-xWsKGi4p.js +220 -0
- package/dist/storybook/assets/unit-table.stories-C4AcKcPO.js +152 -0
- package/dist/storybook/assets/unit-table.test-case.stories-Do8WFzxy.js +1 -0
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/package.json +1 -1
- package/dist/storybook/assets/check-box.stories-DfbWw6mD.js +0 -126
- package/dist/storybook/assets/footer.stories-DgjDE_JR.js +0 -3
- package/dist/storybook/assets/form.stories-BrUnmw7R.js +0 -49
- package/dist/storybook/assets/iframe-B8VgeFPT.js +0 -2
- package/dist/storybook/assets/initialize-context-DOqEe1Xq.js +0 -1
- package/dist/storybook/assets/menu.stories-xWX80Eh2.js +0 -84
- package/dist/storybook/assets/modal.stories-LhoWfDE6.js +0 -220
- package/dist/storybook/assets/number-input.stories-DhCjZ37u.js +0 -180
- package/dist/storybook/assets/popover.stories-CGm0M5fv.js +0 -10
- package/dist/storybook/assets/radio-button.stories-5gvV0LD0.js +0 -71
- package/dist/storybook/assets/select-DnRuRG_N.js +0 -61
- package/dist/storybook/assets/select.input-D0UkAPd9.js +0 -1
- package/dist/storybook/assets/select.stories-B9w9ONzj.js +0 -579
- package/dist/storybook/assets/tabs.stories-dsXjRHJy.js +0 -30
- package/dist/storybook/assets/toaster.stories-HO4VBTy-.js +0 -89
- package/dist/storybook/assets/toggle.stories-qTHFTXxI.js +0 -141
- package/dist/storybook/assets/unit-input.stories-QnEpR0rY.js +0 -426
- package/dist/storybook/assets/unit-table.stories-BZCc0yfc.js +0 -152
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as n}from"./jsx-runtime-eps93zm2.js";import{r as S}from"./index-DhsZuJvc.js";import{c as _}from"./index-Bk2sglWO.js";import{I as Le,D as We,C as Fe,P as Pe}from"./index.es-DazXb-ul.js";import{l as De}from"./lodash-c4VUpsOs.js";import{A as ae}from"./actions-D-uVCDzk.js";import{H as Oe}from"./heading-CRNoBc7q.js";import{P as $e}from"./pagination-CLt-kUlx.js";import{A as f,I as B}from"./common-types-Sih75Sav.js";import{I as Be}from"./input-DTXbDJaL.js";import{N as Me}from"./number-input-Bpg4Yqmo.js";import{S as Ge}from"./select-DnRuRG_N.js";import{D as Ve}from"./disabled-context-rmpd7YJS.js";import{i as M}from"./types-Dx2TtIG9.js";import{T as oe}from"./tooltip-1V7clEnw.js";import{C as Ue}from"./check-box-DPLaOkRR.js";import{S as ze}from"./slider-C7vnj_3M.js";import{I as G}from"./icon-BSFY3vDO.js";import{P as Ke}from"./popover-rq33c1W2.js";import{H as fe}from"./help-icon-Buhx5nl6.js";import{T as Y}from"./text-B3-TSWok.js";const Xe="_inputInTable_k0mvt_1",Ye="_error_k0mvt_7",Je="_warning_k0mvt_7",Qe="_inputHover_k0mvt_13",Ze="_inputFocus_k0mvt_18",en="_inputError_k0mvt_25",nn="_inputWarning_k0mvt_26",tn="_inputDisabled_k0mvt_61",rn="_hideScrollbars_k0mvt_67",an="_wrapper_k0mvt_85",on="_bordered_k0mvt_93",sn="_scroll_k0mvt_98",ln="_table_k0mvt_108",un="_striped_k0mvt_188",L={inputInTable:Xe,error:Ye,warning:Je,inputHover:Qe,inputFocus:Ze,inputError:en,inputWarning:nn,inputDisabled:tn,hideScrollbars:rn,wrapper:an,bordered:on,scroll:sn,table:ln,striped:un},dn="_title_zn5s7_1",cn={title:dn},Q=({name:e=null,actions:t=null,actionsRight:r=!1,testId:o})=>{const a=e!==null,i=t!==null;if(!a&&!i)return null;const l=()=>{if(!i)return null;const c=n.jsx(ae,{actions:t});return r?c:n.jsx("div",{children:c})};return n.jsxs("div",{className:cn.title,children:[a?n.jsx(Oe,{children:n.jsx("span",{"data-testid":o,children:e})}):null,l()]})};Q.__docgenInfo={description:"",methods:[],displayName:"Title",props:{name:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:"",defaultValue:{value:"null",computed:!1}},actions:{required:!1,tsType:{name:"any"},description:"",defaultValue:{value:"null",computed:!1}},actionsRight:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},testId:{required:!1,tsType:{name:"string"},description:""}}};const pn="_footer_4sumy_1",mn="_section_4sumy_7",J={footer:pn,section:mn},Z=({colSpan:e,pagination:t,actions:r,content:o})=>{const a=r&&r.length,i=o!=null,l=()=>{var u,p;if(t){const{rowCount:d,rowsPerPage:I}=t,h=Number((p=(u=I==null?void 0:I.options)==null?void 0:u[0])==null?void 0:p.value);return d>h}return!1};return a||i||l()?n.jsxs("div",{className:J.footer,children:[i?n.jsx("div",{className:J.section,children:n.jsx("div",{children:o})}):null,a||l()?n.jsxs("div",{className:J.section,children:[l()?n.jsx($e,{pagination:t}):n.jsx("div",{}),a&&n.jsx("div",{children:n.jsx(ae,{actions:r})})]}):null]}):null};Z.__docgenInfo={description:"",methods:[],displayName:"Footer",props:{colSpan:{required:!1,tsType:{name:"number"},description:""},pagination:{required:!0,tsType:{name:"IPagination"},description:""},actions:{required:!1,tsType:{name:"Array",elements:[{name:"IAction"}],raw:"IAction[]"},description:""},content:{required:!1,tsType:{name:"ReactNode"},description:""}}};const ye=e=>{const t=Math.max(...e.reduce((r,o)=>{const a=o.cells.map(i=>i.colSpan?i.colSpan:1).reduce((i,l)=>i+l,0);return r.concat(a)},[]));return isNaN(t)?0:t},gn=(e,t)=>{const r=[ye(t),ye(e)];return Math.max(...r)},Ce=e=>e.reduce((t,r)=>r.actions&&r.actions.length>0?1:t,0),hn=(e,t)=>Ce(t)>0||Ce(e)>0,ee=({table:e,children:t})=>{const{rows:r,infiniteScroll:o}=e,a=Math.ceil(window.innerHeight/30),[i,l]=o?S.useState(a):[r.length,null],[c,u]=o?S.useState(i<r.length):[!1,null],p=()=>{if(i>=r.length&&u){u(!1);return}l&&l(i+a)};return n.jsx("div",{id:"scrollWrapper",className:L.scroll,children:o?n.jsx(Le,{dataLength:Math.min(r.length,i+a),next:p,hasMore:c,scrollableTarget:"scrollWrapper",style:{overflow:"initial"},loader:null,children:t({visibleRows:i})}):t({visibleRows:i})})};ee.__docgenInfo={description:"",methods:[],displayName:"TableScrollWrapper",props:{table:{required:!0,tsType:{name:"ITableProps"},description:""},children:{required:!0,tsType:{name:"signature",type:"function",raw:"(props: { visibleRows: number }) => ReactNode",signature:{arguments:[{type:{name:"signature",type:"object",raw:"{ visibleRows: number }",signature:{properties:[{key:"visibleRows",value:{name:"number",required:!0}}]}},name:"props"}],return:{name:"ReactNode"}}},description:""}}};const In="_clickableRow_1ki29_1",yn="_hoverableRow_1ki29_4",Cn="_rowActive_1ki29_4",bn="_expandableRow_1ki29_8",fn="_flush_1ki29_8",_n="_errorRow_1ki29_12",wn="_warningRow_1ki29_15",vn="_dragIconCell_1ki29_34",xn="_dragIcon_1ki29_34",b={clickableRow:In,hoverableRow:yn,rowActive:Cn,expandableRow:bn,flush:fn,errorRow:_n,warningRow:wn,dragIconCell:vn,dragIcon:xn},ne=({colSpan:e,children:t,flush:r})=>n.jsx("tr",{children:n.jsx("td",{colSpan:e,className:_(b.expandableRow,r?b.flush:""),children:t})});ne.__docgenInfo={description:"",methods:[],displayName:"ExpandedContentRow",props:{colSpan:{required:!0,tsType:{name:"number"},description:""},children:{required:!0,tsType:{name:"ReactNode"},description:""},flush:{required:!1,tsType:{name:"boolean"},description:""}}};const be=(e,t={leftAligned:"",rightAligned:"",centerAligned:""},r=!1)=>{if(!e)return null;const{bodyAlignment:o,headerAlignment:a,isHeader:i}=e;switch(i&&a?a:o){case f.LEFT:return r?f.LEFT:t.leftAligned;case f.RIGHT:return r?f.RIGHT:t.rightAligned;case f.CENTER:return r?f.CENTER:t.centerAligned;default:return r?f.LEFT:t.leftAligned}},Tn=(e,t=!1,r=0)=>{if(!e||e.length===0)return[];const o=e.every(i=>Array.isArray(i)),a=e.every(i=>typeof i=="string");return o&&t?e[r]||[]:a?e:(console.warn("getHeaderAlignment: alignments array contains a mix of strings and arrays, returning an empty array."),[])},qn="_inputInTable_9hq13_1",kn="_error_9hq13_7",An="_warning_9hq13_7",Rn="_inputHover_9hq13_13",jn="_inputFocus_9hq13_18",Nn="_inputError_9hq13_25",Sn="_inputWarning_9hq13_26",En="_inputDisabled_9hq13_61",Hn="_hideScrollbars_9hq13_67",Ln="_cell_9hq13_77",Wn="_disabledLink_9hq13_87",Fn="_inputWrapper_9hq13_91",Pn="_numberInputWrapper_9hq13_106",Dn="_breakWord_9hq13_113",On="_inputCell_9hq13_116",$n="_sliderCell_9hq13_119",Bn="_staticCell_9hq13_123",Mn="_staticCellContent_9hq13_126",Gn="_unit_9hq13_148",Vn="_sortingCell_9hq13_151",Un="_sortingCellIcon_9hq13_162",zn="_icon_9hq13_173",Kn="_checkBoxCell_9hq13_177",Xn="_iconCellWrapper_9hq13_181",Yn="_actionsCell_9hq13_185",Jn="_rightAligned_9hq13_193",Qn="_centerAligned_9hq13_199",Zn="_leftAligned_9hq13_205",et="_popover_9hq13_208",nt="_disabledPointerEvents_9hq13_211",s={inputInTable:qn,error:kn,warning:An,inputHover:Rn,inputFocus:jn,inputError:Nn,inputWarning:Sn,inputDisabled:En,hideScrollbars:Hn,cell:Ln,disabledLink:Wn,inputWrapper:Fn,numberInputWrapper:Pn,breakWord:Dn,inputCell:On,sliderCell:$n,staticCell:Bn,staticCellContent:Mn,unit:Gn,sortingCell:Vn,sortingCellIcon:Un,icon:zn,checkBoxCell:Kn,iconCellWrapper:Xn,actionsCell:Yn,rightAligned:Jn,centerAligned:Qn,leftAligned:Zn,popover:et,disabledPointerEvents:nt},te=({cell:e,columnAlignment:t,testId:r,type:o})=>n.jsx(Be,{name:e.name,value:e.value,onChange:a=>{var i;return(i=e.onChange)==null?void 0:i.call(e,a)},onFocus:e.onFocus,onBlur:e.onBlur,onPaste:a=>{var i;return(i=e.onPaste)==null?void 0:i.call(e,a)},placeholder:e.placeholder,error:e.error,warning:e.warning,disabled:e.disabled,isInTable:!0,maxTooltipWidth:e.maxTooltipWidth,right:t===f.RIGHT,testId:r,tabIndex:e.disabled?-1:0,tooltip:e.tooltip,type:o});te.__docgenInfo={description:"",methods:[],displayName:"InputCell",props:{cell:{required:!0,tsType:{name:"IInputCell"},description:""},columnAlignment:{required:!1,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | string",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"string"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""},type:{required:!1,tsType:{name:"union",raw:"'text' | 'date'",elements:[{name:"literal",value:"'text'"},{name:"literal",value:"'date'"}]},description:""}}};const _e=({cell:e,testId:t})=>n.jsx(Me,{name:e.name,value:e.value,onChange:r=>{var o;return(o=e.onChange)==null?void 0:o.call(e,r)},onFocus:e.onFocus,onBlur:e.onBlur,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,enableCosmeticRounding:e.enableCosmeticRounding,enableDisplayRounding:e.enableDisplayRounding,roundDisplayValue:e.roundDisplayValue});_e.__docgenInfo={description:"",methods:[],displayName:"NumberInputCell",props:{cell:{required:!0,tsType:{name:"INumberInputCell"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const we=({cell:e,columnAlignment:t,testId:r})=>n.jsx(Ge,{name:e.name,borderRadius:0,options:e.options,onChange:o=>{var a;return(a=e.onChange)==null?void 0:a.call(e,o)},onCreate:e.onCreate?o=>e.onCreate&&e.onCreate(o):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,multi:e.multi,right:t===f.RIGHT,testId:r,tabIndex:e.disabled?-1:0});we.__docgenInfo={description:"",methods:[],displayName:"SelectCell",props:{cell:{required:!0,tsType:{name:"ISelectCell"},description:""},columnAlignment:{required:!1,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | string",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"string"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const ve=({cell:e,columnAlignment:t,testId:r})=>n.jsx("div",{className:_(s.inputWrapper,e.type==="NumberInput"?s.numberInputWrapper:""),children:e.type==="Input"?n.jsx(te,{cell:e,columnAlignment:t,testId:r}):e.type==="NumberInput"?n.jsx(_e,{cell:e,testId:r}):e.type==="DateInput"?n.jsx(te,{cell:e,testId:r,type:"date"}):e.type==="Select"?n.jsx(we,{cell:e,columnAlignment:t,testId:r}):null});ve.__docgenInfo={description:"",methods:[],displayName:"InputCellWrapper",props:{cell:{required:!0,tsType:{name:"any"},description:""},columnAlignment:{required:!0,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | string",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"string"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const xe=({cell:e,testId:t})=>{const r=S.useContext(Ve),{error:o,warning:a,tooltip:i,maxTooltipWidth:l}=e,c=u=>M(u);return n.jsx("div",{className:s.inputWrapper,children:n.jsx(oe,{error:!!o,warning:!!a,text:i||o||a,enabled:c(i)||c(o)||c(a)||!1,maxWidth:l,placement:"bottom-center",children:n.jsx("div",{className:_(s.staticCellContent,o?s.error:a?s.warning:""),children:n.jsx("a",{className:_((e.disabled||r)&&s.disabledLink),onClick:e.disabled||r?void 0:u=>{var p;u.stopPropagation(),(p=e.onClick)==null||p.call(e,u)},"data-testid":t,children:e.value})})})})};xe.__docgenInfo={description:"",methods:[],displayName:"LinkCell",props:{cell:{required:!0,tsType:{name:"ILinkCell"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Te=({cell:e,testId:t})=>n.jsx(Ue,{label:e.label,checked:e.checked,isInTable:!0,disabled:e.disabled,onChange:r=>e.onChange(r),testId:t,tabIndex:e.disabled?-1:0});Te.__docgenInfo={description:"",methods:[],displayName:"CheckBoxCell",props:{cell:{required:!0,tsType:{name:"ICheckBoxCell"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const qe=({cell:e})=>n.jsx("div",{className:s.inputWrapper,children:n.jsx(ze,{label:e.label,value:e.value,min:e.min,max:e.max,step:e.step,marks:e.marks,onChange:t=>e.onChange(t),showArrows:e.showArrows,showTooltip:e.showTooltip,tooltipFormatter:e.tooltipFormatter,disabled:e.disabled})});qe.__docgenInfo={description:"",methods:[],displayName:"SliderCell",props:{cell:{required:!0,tsType:{name:"ISliderCell"},description:""}}};const ke=({cell:e})=>{const{tooltip:t,icon:r}=e;return n.jsx("div",{className:s.iconCellWrapper,children:n.jsx(oe,{text:t,enabled:!!t&&M(t),display:"flex",placement:"top-center",children:n.jsx(G,{icon:r})})})};ke.__docgenInfo={description:"",methods:[],displayName:"IconCell",props:{cell:{required:!0,tsType:{name:"IIconCell"},description:""}}};const Ae=({cell:e})=>n.jsx(ae,{actions:e.actions});Ae.__docgenInfo={description:"",methods:[],displayName:"ActionsCell",props:{cell:{required:!0,tsType:{name:"IActionCell"},description:""}}};const Re=({cell:e})=>{const{helpIcon:t}=e;return t?n.jsx("div",{className:s.icon,children:n.jsx(fe,{onClick:t.onClick,text:t.tooltip})}):null};Re.__docgenInfo={description:"",methods:[],displayName:"CellHelpIcon",props:{cell:{required:!0,tsType:{name:"IHelpIconCell"},description:""}}};const je=({cell:e})=>{const{libraryIcon:t}=e;return t?n.jsx("div",{className:s.icon,children:n.jsx(fe,{onClick:t.onClick,text:t.tooltip,icon:B.LIBRARY})}):null};je.__docgenInfo={description:"",methods:[],displayName:"CellLibraryIcon",props:{cell:{required:!0,tsType:{name:"ILibraryIconCell"},description:""}}};const Ne=({cell:e})=>{const{hasSort:t,sort:r,sortPriority:o}=e;return t?n.jsxs("span",{className:s.sortingCellIcon,children:[r==="down"?n.jsx(Y,{link:!0,children:n.jsx(G,{icon:B.SORT_ASCENDING})}):r==="up"?n.jsx(Y,{link:!0,children:n.jsx(G,{icon:B.SORT_DESCENDING})}):n.jsx(Y,{faint:!0,children:n.jsx(G,{icon:B.SORT_DESCENDING})}),o&&r?n.jsx("sup",{children:o}):null]}):null};Ne.__docgenInfo={description:"",methods:[],displayName:"Sort",props:{cell:{required:!0,tsType:{name:"ISortCell"},description:""}}};const ie=({cell:e,isHeader:t,testId:r})=>{const{error:o,warning:a,tooltip:i,maxTooltipWidth:l,hasSort:c,onSort:u,type:p}=e,d=n.jsxs("div",{className:_(s.staticCellContent,p==="Unit"?s.unit:"",o?s.error:a?s.warning:""),onClick:c?I=>u&&u(I):()=>{},"data-testid":r,children:[e.value,t?n.jsxs(n.Fragment,{children:[n.jsx(Re,{cell:e}),n.jsx(je,{cell:e}),n.jsx(Ne,{cell:e})]}):null]});return n.jsx("div",{className:s.inputWrapper,children:n.jsx(oe,{error:!!o,warning:!!a,text:i||o||a,enabled:i&&M(i)||o&&M(o)||a&&M(a)||!1,maxWidth:l,display:"block",placement:"bottom-center",children:d})})};ie.__docgenInfo={description:"",methods:[],displayName:"StaticCell",props:{cell:{required:!0,tsType:{name:"IStaticCell"},description:""},isHeader:{required:!1,tsType:{name:"boolean"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Se=({cell:e,testId:t})=>{const{content:r,fullWidth:o,closeOnOutsideClick:a,disabled:i}=e;return n.jsx(Ke,{content:r,fullWidth:o,closeOnOutsideClick:a,disabled:i,children:n.jsx("div",{className:s.popover,children:n.jsx(ie,{cell:e,testId:t})})})};Se.__docgenInfo={description:"",methods:[],displayName:"PopoverCell",props:{cell:{required:!0,tsType:{name:"IPopoverCell"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Ee=({cell:e,isHeader:t,columnAlignment:r,testId:o})=>{if(!e)return null;switch(e.type){case"Input":case"NumberInput":case"DateInput":case"Select":return n.jsx(ve,{cell:e,columnAlignment:r,testId:o});case"Link":return n.jsx(xe,{cell:e,testId:o});case"CheckBox":return n.jsx(Te,{cell:e,testId:o});case"Slider":return n.jsx(qe,{cell:e});case"Icon":return n.jsx(ke,{cell:e});case"Actions":return n.jsx(Ae,{cell:e});case"Popover":return n.jsx(Se,{cell:e});default:return n.jsx(ie,{cell:e,isHeader:t,testId:o})}};Ee.__docgenInfo={description:"",methods:[],displayName:"CellWrapper",props:{cell:{required:!0,tsType:{name:"any"},description:""},isHeader:{required:!0,tsType:{name:"boolean"},description:""},columnAlignment:{required:!0,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | string",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"string"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};var A=(e=>(e.INPUT="Input",e.NUMBER_INPUT="NumberInput",e.SELECT="Select",e.POPOVER="Popover",e.SLIDER="Slider",e.CHECKBOX="CheckBox",e.ACTIONS="Actions",e.AUTO_UNIT="AutoUnit",e))(A||{});const re=({cell:e,isHeader:t,columnHeaderAlignment:r,columnAlignment:o=f.LEFT,width:a,snapshot:i,testId:l})=>{if(!e)return null;const{style:c,colSpan:u,rowSpan:p,width:d}=e,I=S.useRef(null),h={bodyAlignment:o,headerAlignment:r,isHeader:t},W=be(h,s),w=be(h,s,!0),F=e.type===A.INPUT||e.type===A.NUMBER_INPUT||e.type===A.SELECT||e.type===A.POPOVER?s.inputCell:e.type===A.SLIDER?s.sliderCell:e.type===A.CHECKBOX?s.checkBoxCell:e.type===A.ACTIONS?s.actionsCell:s.staticCell,q=_(s.cell,F,e.hasSort?s.sortingCell:null,W,e.breakWord?s.breakWord:""),E=d??a??((i==null?void 0:i.isDragging)&&I.current&&I.current.offsetWidth)??void 0,v={width:E,minWidth:E,...c},k=t?"th":"td";return n.jsx(k,{ref:I,className:q,style:v,colSpan:u,rowSpan:p,children:n.jsx(Ee,{cell:e,columnAlignment:w??f.RIGHT,isHeader:t,testId:l})})};re.__docgenInfo={description:"",methods:[],displayName:"Cell",props:{cell:{required:!1,tsType:{name:"union",raw:`| IPopoverCell
|
|
1
|
+
import{j as n}from"./jsx-runtime-eps93zm2.js";import{r as S}from"./index-DhsZuJvc.js";import{c as _}from"./index-Bk2sglWO.js";import{I as Le,D as We,C as Fe,P as Pe}from"./index.es-DazXb-ul.js";import{l as De}from"./lodash-c4VUpsOs.js";import{A as ae}from"./actions-D-uVCDzk.js";import{H as Oe}from"./heading-CRNoBc7q.js";import{P as $e}from"./pagination-DWc8zp3k.js";import{A as f,I as B}from"./common-types-Sih75Sav.js";import{I as Be}from"./input-DTXbDJaL.js";import{N as Me}from"./number-input-Dq8zEk7X.js";import{S as Ge}from"./select-03uRbc4I.js";import{D as Ve}from"./disabled-context-rmpd7YJS.js";import{i as M}from"./types-Dx2TtIG9.js";import{T as oe}from"./tooltip-1V7clEnw.js";import{C as Ue}from"./check-box-DPLaOkRR.js";import{S as ze}from"./slider-C7vnj_3M.js";import{I as G}from"./icon-BSFY3vDO.js";import{P as Ke}from"./popover-rq33c1W2.js";import{H as fe}from"./help-icon-Buhx5nl6.js";import{T as Y}from"./text-B3-TSWok.js";const Xe="_inputInTable_k0mvt_1",Ye="_error_k0mvt_7",Je="_warning_k0mvt_7",Qe="_inputHover_k0mvt_13",Ze="_inputFocus_k0mvt_18",en="_inputError_k0mvt_25",nn="_inputWarning_k0mvt_26",tn="_inputDisabled_k0mvt_61",rn="_hideScrollbars_k0mvt_67",an="_wrapper_k0mvt_85",on="_bordered_k0mvt_93",sn="_scroll_k0mvt_98",ln="_table_k0mvt_108",un="_striped_k0mvt_188",L={inputInTable:Xe,error:Ye,warning:Je,inputHover:Qe,inputFocus:Ze,inputError:en,inputWarning:nn,inputDisabled:tn,hideScrollbars:rn,wrapper:an,bordered:on,scroll:sn,table:ln,striped:un},dn="_title_zn5s7_1",cn={title:dn},Q=({name:e=null,actions:t=null,actionsRight:r=!1,testId:o})=>{const a=e!==null,i=t!==null;if(!a&&!i)return null;const l=()=>{if(!i)return null;const c=n.jsx(ae,{actions:t});return r?c:n.jsx("div",{children:c})};return n.jsxs("div",{className:cn.title,children:[a?n.jsx(Oe,{children:n.jsx("span",{"data-testid":o,children:e})}):null,l()]})};Q.__docgenInfo={description:"",methods:[],displayName:"Title",props:{name:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:"",defaultValue:{value:"null",computed:!1}},actions:{required:!1,tsType:{name:"any"},description:"",defaultValue:{value:"null",computed:!1}},actionsRight:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},testId:{required:!1,tsType:{name:"string"},description:""}}};const pn="_footer_4sumy_1",mn="_section_4sumy_7",J={footer:pn,section:mn},Z=({colSpan:e,pagination:t,actions:r,content:o})=>{const a=r&&r.length,i=o!=null,l=()=>{var u,p;if(t){const{rowCount:d,rowsPerPage:I}=t,h=Number((p=(u=I==null?void 0:I.options)==null?void 0:u[0])==null?void 0:p.value);return d>h}return!1};return a||i||l()?n.jsxs("div",{className:J.footer,children:[i?n.jsx("div",{className:J.section,children:n.jsx("div",{children:o})}):null,a||l()?n.jsxs("div",{className:J.section,children:[l()?n.jsx($e,{pagination:t}):n.jsx("div",{}),a&&n.jsx("div",{children:n.jsx(ae,{actions:r})})]}):null]}):null};Z.__docgenInfo={description:"",methods:[],displayName:"Footer",props:{colSpan:{required:!1,tsType:{name:"number"},description:""},pagination:{required:!0,tsType:{name:"IPagination"},description:""},actions:{required:!1,tsType:{name:"Array",elements:[{name:"IAction"}],raw:"IAction[]"},description:""},content:{required:!1,tsType:{name:"ReactNode"},description:""}}};const ye=e=>{const t=Math.max(...e.reduce((r,o)=>{const a=o.cells.map(i=>i.colSpan?i.colSpan:1).reduce((i,l)=>i+l,0);return r.concat(a)},[]));return isNaN(t)?0:t},gn=(e,t)=>{const r=[ye(t),ye(e)];return Math.max(...r)},Ce=e=>e.reduce((t,r)=>r.actions&&r.actions.length>0?1:t,0),hn=(e,t)=>Ce(t)>0||Ce(e)>0,ee=({table:e,children:t})=>{const{rows:r,infiniteScroll:o}=e,a=Math.ceil(window.innerHeight/30),[i,l]=o?S.useState(a):[r.length,null],[c,u]=o?S.useState(i<r.length):[!1,null],p=()=>{if(i>=r.length&&u){u(!1);return}l&&l(i+a)};return n.jsx("div",{id:"scrollWrapper",className:L.scroll,children:o?n.jsx(Le,{dataLength:Math.min(r.length,i+a),next:p,hasMore:c,scrollableTarget:"scrollWrapper",style:{overflow:"initial"},loader:null,children:t({visibleRows:i})}):t({visibleRows:i})})};ee.__docgenInfo={description:"",methods:[],displayName:"TableScrollWrapper",props:{table:{required:!0,tsType:{name:"ITableProps"},description:""},children:{required:!0,tsType:{name:"signature",type:"function",raw:"(props: { visibleRows: number }) => ReactNode",signature:{arguments:[{type:{name:"signature",type:"object",raw:"{ visibleRows: number }",signature:{properties:[{key:"visibleRows",value:{name:"number",required:!0}}]}},name:"props"}],return:{name:"ReactNode"}}},description:""}}};const In="_clickableRow_1ki29_1",yn="_hoverableRow_1ki29_4",Cn="_rowActive_1ki29_4",bn="_expandableRow_1ki29_8",fn="_flush_1ki29_8",_n="_errorRow_1ki29_12",wn="_warningRow_1ki29_15",vn="_dragIconCell_1ki29_34",xn="_dragIcon_1ki29_34",b={clickableRow:In,hoverableRow:yn,rowActive:Cn,expandableRow:bn,flush:fn,errorRow:_n,warningRow:wn,dragIconCell:vn,dragIcon:xn},ne=({colSpan:e,children:t,flush:r})=>n.jsx("tr",{children:n.jsx("td",{colSpan:e,className:_(b.expandableRow,r?b.flush:""),children:t})});ne.__docgenInfo={description:"",methods:[],displayName:"ExpandedContentRow",props:{colSpan:{required:!0,tsType:{name:"number"},description:""},children:{required:!0,tsType:{name:"ReactNode"},description:""},flush:{required:!1,tsType:{name:"boolean"},description:""}}};const be=(e,t={leftAligned:"",rightAligned:"",centerAligned:""},r=!1)=>{if(!e)return null;const{bodyAlignment:o,headerAlignment:a,isHeader:i}=e;switch(i&&a?a:o){case f.LEFT:return r?f.LEFT:t.leftAligned;case f.RIGHT:return r?f.RIGHT:t.rightAligned;case f.CENTER:return r?f.CENTER:t.centerAligned;default:return r?f.LEFT:t.leftAligned}},Tn=(e,t=!1,r=0)=>{if(!e||e.length===0)return[];const o=e.every(i=>Array.isArray(i)),a=e.every(i=>typeof i=="string");return o&&t?e[r]||[]:a?e:(console.warn("getHeaderAlignment: alignments array contains a mix of strings and arrays, returning an empty array."),[])},qn="_inputInTable_9hq13_1",kn="_error_9hq13_7",An="_warning_9hq13_7",Rn="_inputHover_9hq13_13",jn="_inputFocus_9hq13_18",Nn="_inputError_9hq13_25",Sn="_inputWarning_9hq13_26",En="_inputDisabled_9hq13_61",Hn="_hideScrollbars_9hq13_67",Ln="_cell_9hq13_77",Wn="_disabledLink_9hq13_87",Fn="_inputWrapper_9hq13_91",Pn="_numberInputWrapper_9hq13_106",Dn="_breakWord_9hq13_113",On="_inputCell_9hq13_116",$n="_sliderCell_9hq13_119",Bn="_staticCell_9hq13_123",Mn="_staticCellContent_9hq13_126",Gn="_unit_9hq13_148",Vn="_sortingCell_9hq13_151",Un="_sortingCellIcon_9hq13_162",zn="_icon_9hq13_173",Kn="_checkBoxCell_9hq13_177",Xn="_iconCellWrapper_9hq13_181",Yn="_actionsCell_9hq13_185",Jn="_rightAligned_9hq13_193",Qn="_centerAligned_9hq13_199",Zn="_leftAligned_9hq13_205",et="_popover_9hq13_208",nt="_disabledPointerEvents_9hq13_211",s={inputInTable:qn,error:kn,warning:An,inputHover:Rn,inputFocus:jn,inputError:Nn,inputWarning:Sn,inputDisabled:En,hideScrollbars:Hn,cell:Ln,disabledLink:Wn,inputWrapper:Fn,numberInputWrapper:Pn,breakWord:Dn,inputCell:On,sliderCell:$n,staticCell:Bn,staticCellContent:Mn,unit:Gn,sortingCell:Vn,sortingCellIcon:Un,icon:zn,checkBoxCell:Kn,iconCellWrapper:Xn,actionsCell:Yn,rightAligned:Jn,centerAligned:Qn,leftAligned:Zn,popover:et,disabledPointerEvents:nt},te=({cell:e,columnAlignment:t,testId:r,type:o})=>n.jsx(Be,{name:e.name,value:e.value,onChange:a=>{var i;return(i=e.onChange)==null?void 0:i.call(e,a)},onFocus:e.onFocus,onBlur:e.onBlur,onPaste:a=>{var i;return(i=e.onPaste)==null?void 0:i.call(e,a)},placeholder:e.placeholder,error:e.error,warning:e.warning,disabled:e.disabled,isInTable:!0,maxTooltipWidth:e.maxTooltipWidth,right:t===f.RIGHT,testId:r,tabIndex:e.disabled?-1:0,tooltip:e.tooltip,type:o});te.__docgenInfo={description:"",methods:[],displayName:"InputCell",props:{cell:{required:!0,tsType:{name:"IInputCell"},description:""},columnAlignment:{required:!1,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | string",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"string"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""},type:{required:!1,tsType:{name:"union",raw:"'text' | 'date'",elements:[{name:"literal",value:"'text'"},{name:"literal",value:"'date'"}]},description:""}}};const _e=({cell:e,testId:t})=>n.jsx(Me,{name:e.name,value:e.value,onChange:r=>{var o;return(o=e.onChange)==null?void 0:o.call(e,r)},onFocus:e.onFocus,onBlur:e.onBlur,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,enableCosmeticRounding:e.enableCosmeticRounding,enableDisplayRounding:e.enableDisplayRounding,roundDisplayValue:e.roundDisplayValue});_e.__docgenInfo={description:"",methods:[],displayName:"NumberInputCell",props:{cell:{required:!0,tsType:{name:"INumberInputCell"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const we=({cell:e,columnAlignment:t,testId:r})=>n.jsx(Ge,{name:e.name,borderRadius:0,options:e.options,onChange:o=>{var a;return(a=e.onChange)==null?void 0:a.call(e,o)},onCreate:e.onCreate?o=>e.onCreate&&e.onCreate(o):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,multi:e.multi,right:t===f.RIGHT,testId:r,tabIndex:e.disabled?-1:0});we.__docgenInfo={description:"",methods:[],displayName:"SelectCell",props:{cell:{required:!0,tsType:{name:"ISelectCell"},description:""},columnAlignment:{required:!1,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | string",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"string"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const ve=({cell:e,columnAlignment:t,testId:r})=>n.jsx("div",{className:_(s.inputWrapper,e.type==="NumberInput"?s.numberInputWrapper:""),children:e.type==="Input"?n.jsx(te,{cell:e,columnAlignment:t,testId:r}):e.type==="NumberInput"?n.jsx(_e,{cell:e,testId:r}):e.type==="DateInput"?n.jsx(te,{cell:e,testId:r,type:"date"}):e.type==="Select"?n.jsx(we,{cell:e,columnAlignment:t,testId:r}):null});ve.__docgenInfo={description:"",methods:[],displayName:"InputCellWrapper",props:{cell:{required:!0,tsType:{name:"any"},description:""},columnAlignment:{required:!0,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | string",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"string"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const xe=({cell:e,testId:t})=>{const r=S.useContext(Ve),{error:o,warning:a,tooltip:i,maxTooltipWidth:l}=e,c=u=>M(u);return n.jsx("div",{className:s.inputWrapper,children:n.jsx(oe,{error:!!o,warning:!!a,text:i||o||a,enabled:c(i)||c(o)||c(a)||!1,maxWidth:l,placement:"bottom-center",children:n.jsx("div",{className:_(s.staticCellContent,o?s.error:a?s.warning:""),children:n.jsx("a",{className:_((e.disabled||r)&&s.disabledLink),onClick:e.disabled||r?void 0:u=>{var p;u.stopPropagation(),(p=e.onClick)==null||p.call(e,u)},"data-testid":t,children:e.value})})})})};xe.__docgenInfo={description:"",methods:[],displayName:"LinkCell",props:{cell:{required:!0,tsType:{name:"ILinkCell"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Te=({cell:e,testId:t})=>n.jsx(Ue,{label:e.label,checked:e.checked,isInTable:!0,disabled:e.disabled,onChange:r=>e.onChange(r),testId:t,tabIndex:e.disabled?-1:0});Te.__docgenInfo={description:"",methods:[],displayName:"CheckBoxCell",props:{cell:{required:!0,tsType:{name:"ICheckBoxCell"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const qe=({cell:e})=>n.jsx("div",{className:s.inputWrapper,children:n.jsx(ze,{label:e.label,value:e.value,min:e.min,max:e.max,step:e.step,marks:e.marks,onChange:t=>e.onChange(t),showArrows:e.showArrows,showTooltip:e.showTooltip,tooltipFormatter:e.tooltipFormatter,disabled:e.disabled})});qe.__docgenInfo={description:"",methods:[],displayName:"SliderCell",props:{cell:{required:!0,tsType:{name:"ISliderCell"},description:""}}};const ke=({cell:e})=>{const{tooltip:t,icon:r}=e;return n.jsx("div",{className:s.iconCellWrapper,children:n.jsx(oe,{text:t,enabled:!!t&&M(t),display:"flex",placement:"top-center",children:n.jsx(G,{icon:r})})})};ke.__docgenInfo={description:"",methods:[],displayName:"IconCell",props:{cell:{required:!0,tsType:{name:"IIconCell"},description:""}}};const Ae=({cell:e})=>n.jsx(ae,{actions:e.actions});Ae.__docgenInfo={description:"",methods:[],displayName:"ActionsCell",props:{cell:{required:!0,tsType:{name:"IActionCell"},description:""}}};const Re=({cell:e})=>{const{helpIcon:t}=e;return t?n.jsx("div",{className:s.icon,children:n.jsx(fe,{onClick:t.onClick,text:t.tooltip})}):null};Re.__docgenInfo={description:"",methods:[],displayName:"CellHelpIcon",props:{cell:{required:!0,tsType:{name:"IHelpIconCell"},description:""}}};const je=({cell:e})=>{const{libraryIcon:t}=e;return t?n.jsx("div",{className:s.icon,children:n.jsx(fe,{onClick:t.onClick,text:t.tooltip,icon:B.LIBRARY})}):null};je.__docgenInfo={description:"",methods:[],displayName:"CellLibraryIcon",props:{cell:{required:!0,tsType:{name:"ILibraryIconCell"},description:""}}};const Ne=({cell:e})=>{const{hasSort:t,sort:r,sortPriority:o}=e;return t?n.jsxs("span",{className:s.sortingCellIcon,children:[r==="down"?n.jsx(Y,{link:!0,children:n.jsx(G,{icon:B.SORT_ASCENDING})}):r==="up"?n.jsx(Y,{link:!0,children:n.jsx(G,{icon:B.SORT_DESCENDING})}):n.jsx(Y,{faint:!0,children:n.jsx(G,{icon:B.SORT_DESCENDING})}),o&&r?n.jsx("sup",{children:o}):null]}):null};Ne.__docgenInfo={description:"",methods:[],displayName:"Sort",props:{cell:{required:!0,tsType:{name:"ISortCell"},description:""}}};const ie=({cell:e,isHeader:t,testId:r})=>{const{error:o,warning:a,tooltip:i,maxTooltipWidth:l,hasSort:c,onSort:u,type:p}=e,d=n.jsxs("div",{className:_(s.staticCellContent,p==="Unit"?s.unit:"",o?s.error:a?s.warning:""),onClick:c?I=>u&&u(I):()=>{},"data-testid":r,children:[e.value,t?n.jsxs(n.Fragment,{children:[n.jsx(Re,{cell:e}),n.jsx(je,{cell:e}),n.jsx(Ne,{cell:e})]}):null]});return n.jsx("div",{className:s.inputWrapper,children:n.jsx(oe,{error:!!o,warning:!!a,text:i||o||a,enabled:i&&M(i)||o&&M(o)||a&&M(a)||!1,maxWidth:l,display:"block",placement:"bottom-center",children:d})})};ie.__docgenInfo={description:"",methods:[],displayName:"StaticCell",props:{cell:{required:!0,tsType:{name:"IStaticCell"},description:""},isHeader:{required:!1,tsType:{name:"boolean"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Se=({cell:e,testId:t})=>{const{content:r,fullWidth:o,closeOnOutsideClick:a,disabled:i}=e;return n.jsx(Ke,{content:r,fullWidth:o,closeOnOutsideClick:a,disabled:i,children:n.jsx("div",{className:s.popover,children:n.jsx(ie,{cell:e,testId:t})})})};Se.__docgenInfo={description:"",methods:[],displayName:"PopoverCell",props:{cell:{required:!0,tsType:{name:"IPopoverCell"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Ee=({cell:e,isHeader:t,columnAlignment:r,testId:o})=>{if(!e)return null;switch(e.type){case"Input":case"NumberInput":case"DateInput":case"Select":return n.jsx(ve,{cell:e,columnAlignment:r,testId:o});case"Link":return n.jsx(xe,{cell:e,testId:o});case"CheckBox":return n.jsx(Te,{cell:e,testId:o});case"Slider":return n.jsx(qe,{cell:e});case"Icon":return n.jsx(ke,{cell:e});case"Actions":return n.jsx(Ae,{cell:e});case"Popover":return n.jsx(Se,{cell:e});default:return n.jsx(ie,{cell:e,isHeader:t,testId:o})}};Ee.__docgenInfo={description:"",methods:[],displayName:"CellWrapper",props:{cell:{required:!0,tsType:{name:"any"},description:""},isHeader:{required:!0,tsType:{name:"boolean"},description:""},columnAlignment:{required:!0,tsType:{name:"union",raw:"Align.LEFT | Align.RIGHT | string",elements:[{name:"Align.LEFT"},{name:"Align.RIGHT"},{name:"string"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};var A=(e=>(e.INPUT="Input",e.NUMBER_INPUT="NumberInput",e.SELECT="Select",e.POPOVER="Popover",e.SLIDER="Slider",e.CHECKBOX="CheckBox",e.ACTIONS="Actions",e.AUTO_UNIT="AutoUnit",e))(A||{});const re=({cell:e,isHeader:t,columnHeaderAlignment:r,columnAlignment:o=f.LEFT,width:a,snapshot:i,testId:l})=>{if(!e)return null;const{style:c,colSpan:u,rowSpan:p,width:d}=e,I=S.useRef(null),h={bodyAlignment:o,headerAlignment:r,isHeader:t},W=be(h,s),w=be(h,s,!0),F=e.type===A.INPUT||e.type===A.NUMBER_INPUT||e.type===A.SELECT||e.type===A.POPOVER?s.inputCell:e.type===A.SLIDER?s.sliderCell:e.type===A.CHECKBOX?s.checkBoxCell:e.type===A.ACTIONS?s.actionsCell:s.staticCell,q=_(s.cell,F,e.hasSort?s.sortingCell:null,W,e.breakWord?s.breakWord:""),E=d??a??((i==null?void 0:i.isDragging)&&I.current&&I.current.offsetWidth)??void 0,v={width:E,minWidth:E,...c},k=t?"th":"td";return n.jsx(k,{ref:I,className:q,style:v,colSpan:u,rowSpan:p,children:n.jsx(Ee,{cell:e,columnAlignment:w??f.RIGHT,isHeader:t,testId:l})})};re.__docgenInfo={description:"",methods:[],displayName:"Cell",props:{cell:{required:!1,tsType:{name:"union",raw:`| IPopoverCell
|
|
2
2
|
| IStaticCell
|
|
3
3
|
| ISelectCell
|
|
4
4
|
| IHelpIconCell
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as n}from"./jsx-runtime-eps93zm2.js";import{r as S}from"./index-DhsZuJvc.js";import{f as ne}from"./immer.esm-BwVl9PS2.js";import{l as Z}from"./lodash-c4VUpsOs.js";import{G as le}from"./grid-DRkC-bt8.js";import{T as W}from"./text-B3-TSWok.js";import{T as D}from"./table-5Y5KPNSk.js";import{C as dn}from"./card-EcjmryU9.js";import{I as se}from"./input-DTXbDJaL.js";import{F as oe}from"./field-HrLaMLbx.js";import{H as un}from"./heading-CRNoBc7q.js";import{t as ae,x as pn,y as mn,z as gn,A as bn,B as hn,C as wn,D as yn}from"./table.stories-data-C3vJedB1.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./index-Bk2sglWO.js";import"./index.es-DazXb-ul.js";import"./inheritsLoose-DP0QEDDI.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./index-CUZDtIZe.js";import"./memoize-one.esm-CcMeOnPo.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./actions-D-uVCDzk.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./index-CEuq6vkz.js";import"./tooltip-1V7clEnw.js";import"./types-BmbYqTX_.js";import"./types-Dx2TtIG9.js";import"./badge-CLQ59MDF.js";import"./pagination-CLt-kUlx.js";import"./select-DnRuRG_N.js";import"./assertThisInitialized-B9jnkVVz.js";import"./select.input-D0UkAPd9.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./number-input-Bpg4Yqmo.js";import"./index-C0x1JmaP.js";import"./index-DRSy5Ssd.js";import"./check-box-DPLaOkRR.js";import"./help-icon-Buhx5nl6.js";import"./slider-C7vnj_3M.js";import"./index-BI4_Bp97.js";import"./popover-rq33c1W2.js";import"./label-CqmyC9he.js";import"./flex-EllkLxgO.js";const gt={title:"Basic/Table",component:D,args:{table:{...ae}}},A=h=>n.jsx(D,{...h}),te=A.bind({}),E=A.bind({});E.args={table:{...ae,fixedWidth:"400px"}};const L=A.bind({});L.args={table:{...ae,fixedWidth:"auto"}};const _=A.bind({});_.args={table:pn};_.parameters={docs:{description:{story:"Use sparingly when certain columns cannot be below a certain width. Unless the Table is auto width, set one column to `auto` to use remaining space."}}};const Q=A.bind({});Q.args={table:mn};const O=A.bind({});O.args={table:gn};O.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const G=A.bind({});G.args={table:bn};const N=A.bind({});N.args={table:hn};N.decorators=[h=>n.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:n.jsx(h,{})})];const U=A.bind({});U.args={table:wn};U.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const $=A.bind({});$.args={table:yn};const M=()=>n.jsx(dn,{heading:n.jsx(un,{children:"Card heading"}),padding:!1,children:n.jsx(D,{table:{...ae,bordered:!1}})});M.parameters={docs:{source:{type:"dynamic"}}};const q=()=>{const h=["Section","Width","Height"];let g=["","m","m"],o=[...Array(175).keys()].map((l,t)=>[t,t*2,t*2]);const x=(l,t,r)=>l==="m"&&t==="ft"?r*3.28084:l==="ft"&&t==="m"?r/3.28084:r,i=(l,t,r,c)=>{o[t][r]=l.target.value,c()},R=l=>{o=o.concat([["","",""]]),l()},k=(l,t)=>{o=o.filter((r,c)=>c!==l),t()},p=(l,t,r)=>{const c=g[t],b=l.target.value;g=g.map((y,s)=>s===t?b:y),o=o.map(y=>y.map((s,u)=>u===t?x(c,b,s):s)),r()},w=()=>{const l=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[t,r]=S.useState(10),[c,b]=S.useState(1),[y,s]=S.useState(!1),u=()=>{s(!y)},j=()=>{const e=Math.ceil(o.length/t);b(e)},T=(c-1)*t,a=t===0?o.length-1:T+t,m={headers:[{cells:h.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{R(u),j()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:g[1],type:"Select",native:!0,onChange:e=>p(e,1,u)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:g[2],type:"Select",native:!0,onChange:e=>p(e,2,u)}]}],rows:o.slice(T,a).map((e,d)=>{const I=T+d;return{cells:[...Array(3).keys()].map((P,v)=>({value:e[v],type:"Input",onChange:C=>i(C,I,v,u)})),actions:[{label:"Delete",icon:"minus",onClick:()=>k(I,u)}]}}),footer:{pagination:{rowCount:o.length,selectedPage:c,rowsPerPage:{onChange:e=>{const{value:d}=e.target;r(Number(d))},options:l,value:t},onSelectPage:e=>b(e),small:!0}}};return n.jsx(D,{table:m})};return n.jsx(w,{})},K=()=>{const h=["Section","Width","Height"];let g=[...Array(20).keys()].map((x,i)=>({Section:Z.random(0,100),Width:Z.random(0,100),Height:Z.random(0,100)}));const o=()=>{const[x,i]=S.useState({Section:"up"}),R=(r,c)=>r.sort((b,y)=>Object.entries(c).map(([s,u])=>{switch(u){case"up":return b[s]-y[s];case"down":return y[s]-b[s];default:return 0}}).reduce((s,u)=>s||u,0)),k=(r,c,b)=>({dataSortCells:r.map(s=>{const u=Object.keys(c).includes(s)?c[s]:"",j=`${s[0].toUpperCase()}${s.slice(1)}`;return{key:s,value:j,hasSort:!0,sort:u,onSort:()=>{const T=u==="up"?"down":"up";b({[s]:T})}}})}),{dataSortCells:p}=k(h,x,i),l=[...R(g,x).map(r=>({cells:Object.entries(r).map(([b,y])=>({key:b,value:y,type:"Input",disabled:!0}))}))],t={headers:[{cells:p}],rows:l};return n.jsx(D,{table:t})};return n.jsx(o,{})},B=()=>{const h=["Section","Width","Height"];let g=[...Array(175).keys()].map((x,i)=>({Section:i,Width:i*2,Height:i*2}));const o=()=>{const x=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[i,R]=S.useState(10),[k,p]=S.useState(1),[w,l]=S.useState({}),[t,r]=S.useState({});S.useEffect(()=>{p(1)},[w,t]);const c=(k-1)*i,b=i===0?g.length-1:c+i,y=(e,d,I)=>e.filter(P=>Object.keys(d).every(v=>d[v]===""?!0:P[v].toString().includes(d[v]))).sort((P,v)=>Object.entries(I).map(([C,H])=>{switch(H){case"up":return P[C]-v[C];case"down":return v[C]-P[C];default:return 0}}).reduce((C,H)=>C||H,0)),s=(e,d,I,P,v)=>{const C=e.map(f=>{const V=Object.keys(P).includes(f)?P[f]:"",F=`${f[0].toUpperCase()}${f.slice(1)}`;return{key:f,value:F,hasSort:!0,sort:V,onSort:()=>{const ee=V===""?"up":V==="up"?"down":"";v({...P,[f]:ee})}}}),H=e.map(f=>{const V=Object.keys(d).includes(f)?d[f]:"";return{key:f,value:V,type:"Input",placeholder:"Filter",onChange:F=>I({...d,[f]:F.target.value})}});return{dataSortCells:C,dataFilterCells:H}},{dataSortCells:u,dataFilterCells:j}=s(h,w,l,t,r),T=y(g,w,t),a=[...T.slice(c,b).map(e=>({cells:Object.entries(e).map(([I,P])=>({key:I,value:P,type:"Input",disabled:!0}))}))],m={headers:[{cells:u},{cells:j}],rows:a,footer:{pagination:{rowCount:T.length,selectedPage:k,rowsPerPage:{onChange:e=>{const{value:d}=e.target;R(Number(d))},options:x,value:i},onSelectPage:e=>p(e),small:!0}}};return n.jsx(D,{table:m})};return n.jsx(o,{})},z=()=>{const h={tea:3.6,coffee:3.2,orange:4.1},g=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],o={cells:[{type:"Select",options:g,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},x=[...Array(15).keys()].map((a,m)=>({cells:[{type:"Select",options:g,value:{value:"tea"}},{type:"Input",value:m+1},{type:"Static"}]})),[i,R]=S.useState(x),k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[p,w]=S.useState(10),[l,t]=S.useState(1),r=(l-1)*p,c=p===0?i.length-1:r+p,b=({newRow:a}={})=>{const m=ne(i,e=>{e.push(a??o)});R(m)},y=({rowIndex:a})=>{const m=ne(i,e=>{delete e[a]}).filter(e=>e);R(m)},s=({rowIndex:a,value:m})=>{const e=ne(i,d=>{d[a].cells[0].value.value=m});R(e)},u=({rowIndex:a,value:m})=>{const e=ne(i,d=>{d[a].cells[1].value=m});R(e)},j=({value:a})=>{const m=Number(a);return!Z.isNaN(m)&&Z.isInteger(m)&&m>0},T=i.slice(r,c).map((a,m)=>{const e=r+m;return i.length-1,{...a,cells:a==null?void 0:a.cells.map((d,I)=>{var f,V,F,ee,ie;const P=(F=(V=(f=a==null?void 0:a.cells)==null?void 0:f[0])==null?void 0:V.value)==null?void 0:F.value,v=Number((ie=(ee=a==null?void 0:a.cells)==null?void 0:ee[1])==null?void 0:ie.value),C=h==null?void 0:h[P],H=C&&j({value:v})?(C*v).toFixed(2):null;if(I===0)return{...d,onChange:re=>s({rowIndex:e,value:re.target.value})};if(I===1)return{...d,onChange:re=>u({rowIndex:e,value:re.target.value}),error:j({value:d.value})?null:"Must be valid whole number"};if(I===2)return{...d,value:H}}),actions:[{label:"Delete",icon:"minus",onClick:()=>y({rowIndex:e})}]}});return n.jsx(D,{table:{defaultEmptyRow:o,onAddRow:b,columnAlignment:["left","right","right"],headers:[{cells:[{value:"Drink"},{value:"Quantity"},{value:"Total Price (£)"}],actions:[{primary:!0,icon:"plus",label:"Add",onClick:()=>b()}]}],rows:T,footer:{pagination:{rowCount:i.length,selectedPage:l,rowsPerPage:{onChange:a=>{const{value:m}=a.target;w(Number(m))},options:k,value:p},onSelectPage:a=>t(a),small:!0}}}})},J=()=>{const h=["Section","Width","Height"];let g=Array.from(Array(10),(p,w)=>[w,w*2,w*2]);const[o,x]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),i=(p,w,l,t)=>{g[w][l]=Number(p.target.value),t()},R=(p,w,l,t)=>{var c;let r=((c=p==null?void 0:p.clipboardData)==null?void 0:c.getData("text"))??"";return x({rowIndex:w,cellIndex:l,pastedValues:r}),t(),{pastedData:o}},k=()=>{const[p,w]=S.useState(!1),l=()=>{w(!p)},t={headers:[{cells:h.map(r=>({value:r}))}],rows:g.map((r,c)=>{const b=c;return{cells:[...Array(3).keys()].map((y,s)=>({value:r[s],type:"Input",onChange:u=>i(u,b,s,l),onPaste:u=>R(u,b,s,l)}))}})};return n.jsxs(n.Fragment,{children:[n.jsx(D,{table:t}),n.jsx(oe,{label:"Pasted Data",children:n.jsx(se,{value:o.pastedValues})}),n.jsx(oe,{label:"At Row",children:n.jsx(se,{value:o.rowIndex})}),n.jsx(oe,{label:"At Cell Index",children:n.jsx(se,{value:o.cellIndex})})]})};return n.jsx(k,{})},X=()=>{const h={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],columnAlignment:[...Array(10)].map((g,o)=>"right"),headers:[{cells:[...Array(10)].map((g,o)=>({value:"Heading"}))},{cells:[...Array(10)].map((g,o)=>({options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],type:"Select",searchable:!1,value:{label:"m",value:"m"},autoLayerWidth:!0}))}],rows:[...Array(10)].map((g,o)=>({cells:[...Array(10)].map((x,i)=>({value:123.45})),actions:[{icon:"help",tooltip:n.jsxs(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here lorem ipsum"}),n.jsx(W,{children:"Label: 123.45m"}),n.jsx(W,{children:"Another label: 123.45m"}),n.jsx(W,{children:"Label: 123.45m"})]})}]}))};return n.jsx(D,{table:h})},Y=()=>{const h={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(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here"}),n.jsx(W,{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(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here"}),n.jsx(W,{children:"Details go here"})]})}]}]};return n.jsx(D,{table:h})};M.__docgenInfo={description:"",methods:[],displayName:"InCard"};q.__docgenInfo={description:"",methods:[],displayName:"Managed"};K.__docgenInfo={description:"",methods:[],displayName:"ManagedWithSort"};B.__docgenInfo={description:"",methods:[],displayName:"ManagedWithFilterAndMultipleSort"};z.__docgenInfo={description:"",methods:[],displayName:"AutoAddNewRow"};J.__docgenInfo={description:"",methods:[],displayName:"OnPasteCallback"};X.__docgenInfo={description:"",methods:[],displayName:"ExampleTableWithInfoTooltips"};Y.__docgenInfo={description:"",methods:[],displayName:"ExampleTableWithInlineUnits"};var ce,de,ue;te.parameters={...te.parameters,docs:{...(ce=te.parameters)==null?void 0:ce.docs,source:{originalSource:`args => {
|
|
1
|
+
import{j as n}from"./jsx-runtime-eps93zm2.js";import{r as S}from"./index-DhsZuJvc.js";import{f as ne}from"./immer.esm-BwVl9PS2.js";import{l as Z}from"./lodash-c4VUpsOs.js";import{G as le}from"./grid-DRkC-bt8.js";import{T as W}from"./text-B3-TSWok.js";import{T as D}from"./table-Cw1-vdpR.js";import{C as dn}from"./card-EcjmryU9.js";import{I as se}from"./input-DTXbDJaL.js";import{F as oe}from"./field-HrLaMLbx.js";import{H as un}from"./heading-CRNoBc7q.js";import{t as ae,x as pn,y as mn,z as gn,A as bn,B as hn,C as wn,D as yn}from"./table.stories-data-C3vJedB1.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./index-Bk2sglWO.js";import"./index.es-DazXb-ul.js";import"./inheritsLoose-DP0QEDDI.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./index-CUZDtIZe.js";import"./memoize-one.esm-CcMeOnPo.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./actions-D-uVCDzk.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./index-CEuq6vkz.js";import"./tooltip-1V7clEnw.js";import"./types-BmbYqTX_.js";import"./types-Dx2TtIG9.js";import"./badge-CLQ59MDF.js";import"./pagination-DWc8zp3k.js";import"./select-03uRbc4I.js";import"./enum-Bnn40S8Q.js";import"./assertThisInitialized-B9jnkVVz.js";import"./select.input-CJed_LLR.js";import"./helpers-JJxzGegQ.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./number-input-Dq8zEk7X.js";import"./index-C0x1JmaP.js";import"./index-DRSy5Ssd.js";import"./check-box-DPLaOkRR.js";import"./help-icon-Buhx5nl6.js";import"./slider-C7vnj_3M.js";import"./index-BI4_Bp97.js";import"./popover-rq33c1W2.js";import"./label-CqmyC9he.js";import"./flex-EllkLxgO.js";const ht={title:"Basic/Table",component:D,args:{table:{...ae}}},A=h=>n.jsx(D,{...h}),te=A.bind({}),E=A.bind({});E.args={table:{...ae,fixedWidth:"400px"}};const L=A.bind({});L.args={table:{...ae,fixedWidth:"auto"}};const _=A.bind({});_.args={table:pn};_.parameters={docs:{description:{story:"Use sparingly when certain columns cannot be below a certain width. Unless the Table is auto width, set one column to `auto` to use remaining space."}}};const Q=A.bind({});Q.args={table:mn};const O=A.bind({});O.args={table:gn};O.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const G=A.bind({});G.args={table:bn};const N=A.bind({});N.args={table:hn};N.decorators=[h=>n.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:n.jsx(h,{})})];const U=A.bind({});U.args={table:wn};U.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const $=A.bind({});$.args={table:yn};const M=()=>n.jsx(dn,{heading:n.jsx(un,{children:"Card heading"}),padding:!1,children:n.jsx(D,{table:{...ae,bordered:!1}})});M.parameters={docs:{source:{type:"dynamic"}}};const q=()=>{const h=["Section","Width","Height"];let g=["","m","m"],o=[...Array(175).keys()].map((l,t)=>[t,t*2,t*2]);const x=(l,t,r)=>l==="m"&&t==="ft"?r*3.28084:l==="ft"&&t==="m"?r/3.28084:r,i=(l,t,r,c)=>{o[t][r]=l.target.value,c()},R=l=>{o=o.concat([["","",""]]),l()},k=(l,t)=>{o=o.filter((r,c)=>c!==l),t()},p=(l,t,r)=>{const c=g[t],b=l.target.value;g=g.map((y,s)=>s===t?b:y),o=o.map(y=>y.map((s,u)=>u===t?x(c,b,s):s)),r()},w=()=>{const l=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[t,r]=S.useState(10),[c,b]=S.useState(1),[y,s]=S.useState(!1),u=()=>{s(!y)},j=()=>{const e=Math.ceil(o.length/t);b(e)},T=(c-1)*t,a=t===0?o.length-1:T+t,m={headers:[{cells:h.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{R(u),j()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:g[1],type:"Select",native:!0,onChange:e=>p(e,1,u)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:g[2],type:"Select",native:!0,onChange:e=>p(e,2,u)}]}],rows:o.slice(T,a).map((e,d)=>{const I=T+d;return{cells:[...Array(3).keys()].map((P,v)=>({value:e[v],type:"Input",onChange:C=>i(C,I,v,u)})),actions:[{label:"Delete",icon:"minus",onClick:()=>k(I,u)}]}}),footer:{pagination:{rowCount:o.length,selectedPage:c,rowsPerPage:{onChange:e=>{const{value:d}=e.target;r(Number(d))},options:l,value:t},onSelectPage:e=>b(e),small:!0}}};return n.jsx(D,{table:m})};return n.jsx(w,{})},K=()=>{const h=["Section","Width","Height"];let g=[...Array(20).keys()].map((x,i)=>({Section:Z.random(0,100),Width:Z.random(0,100),Height:Z.random(0,100)}));const o=()=>{const[x,i]=S.useState({Section:"up"}),R=(r,c)=>r.sort((b,y)=>Object.entries(c).map(([s,u])=>{switch(u){case"up":return b[s]-y[s];case"down":return y[s]-b[s];default:return 0}}).reduce((s,u)=>s||u,0)),k=(r,c,b)=>({dataSortCells:r.map(s=>{const u=Object.keys(c).includes(s)?c[s]:"",j=`${s[0].toUpperCase()}${s.slice(1)}`;return{key:s,value:j,hasSort:!0,sort:u,onSort:()=>{const T=u==="up"?"down":"up";b({[s]:T})}}})}),{dataSortCells:p}=k(h,x,i),l=[...R(g,x).map(r=>({cells:Object.entries(r).map(([b,y])=>({key:b,value:y,type:"Input",disabled:!0}))}))],t={headers:[{cells:p}],rows:l};return n.jsx(D,{table:t})};return n.jsx(o,{})},B=()=>{const h=["Section","Width","Height"];let g=[...Array(175).keys()].map((x,i)=>({Section:i,Width:i*2,Height:i*2}));const o=()=>{const x=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[i,R]=S.useState(10),[k,p]=S.useState(1),[w,l]=S.useState({}),[t,r]=S.useState({});S.useEffect(()=>{p(1)},[w,t]);const c=(k-1)*i,b=i===0?g.length-1:c+i,y=(e,d,I)=>e.filter(P=>Object.keys(d).every(v=>d[v]===""?!0:P[v].toString().includes(d[v]))).sort((P,v)=>Object.entries(I).map(([C,H])=>{switch(H){case"up":return P[C]-v[C];case"down":return v[C]-P[C];default:return 0}}).reduce((C,H)=>C||H,0)),s=(e,d,I,P,v)=>{const C=e.map(f=>{const V=Object.keys(P).includes(f)?P[f]:"",F=`${f[0].toUpperCase()}${f.slice(1)}`;return{key:f,value:F,hasSort:!0,sort:V,onSort:()=>{const ee=V===""?"up":V==="up"?"down":"";v({...P,[f]:ee})}}}),H=e.map(f=>{const V=Object.keys(d).includes(f)?d[f]:"";return{key:f,value:V,type:"Input",placeholder:"Filter",onChange:F=>I({...d,[f]:F.target.value})}});return{dataSortCells:C,dataFilterCells:H}},{dataSortCells:u,dataFilterCells:j}=s(h,w,l,t,r),T=y(g,w,t),a=[...T.slice(c,b).map(e=>({cells:Object.entries(e).map(([I,P])=>({key:I,value:P,type:"Input",disabled:!0}))}))],m={headers:[{cells:u},{cells:j}],rows:a,footer:{pagination:{rowCount:T.length,selectedPage:k,rowsPerPage:{onChange:e=>{const{value:d}=e.target;R(Number(d))},options:x,value:i},onSelectPage:e=>p(e),small:!0}}};return n.jsx(D,{table:m})};return n.jsx(o,{})},z=()=>{const h={tea:3.6,coffee:3.2,orange:4.1},g=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],o={cells:[{type:"Select",options:g,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},x=[...Array(15).keys()].map((a,m)=>({cells:[{type:"Select",options:g,value:{value:"tea"}},{type:"Input",value:m+1},{type:"Static"}]})),[i,R]=S.useState(x),k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[p,w]=S.useState(10),[l,t]=S.useState(1),r=(l-1)*p,c=p===0?i.length-1:r+p,b=({newRow:a}={})=>{const m=ne(i,e=>{e.push(a??o)});R(m)},y=({rowIndex:a})=>{const m=ne(i,e=>{delete e[a]}).filter(e=>e);R(m)},s=({rowIndex:a,value:m})=>{const e=ne(i,d=>{d[a].cells[0].value.value=m});R(e)},u=({rowIndex:a,value:m})=>{const e=ne(i,d=>{d[a].cells[1].value=m});R(e)},j=({value:a})=>{const m=Number(a);return!Z.isNaN(m)&&Z.isInteger(m)&&m>0},T=i.slice(r,c).map((a,m)=>{const e=r+m;return i.length-1,{...a,cells:a==null?void 0:a.cells.map((d,I)=>{var f,V,F,ee,ie;const P=(F=(V=(f=a==null?void 0:a.cells)==null?void 0:f[0])==null?void 0:V.value)==null?void 0:F.value,v=Number((ie=(ee=a==null?void 0:a.cells)==null?void 0:ee[1])==null?void 0:ie.value),C=h==null?void 0:h[P],H=C&&j({value:v})?(C*v).toFixed(2):null;if(I===0)return{...d,onChange:re=>s({rowIndex:e,value:re.target.value})};if(I===1)return{...d,onChange:re=>u({rowIndex:e,value:re.target.value}),error:j({value:d.value})?null:"Must be valid whole number"};if(I===2)return{...d,value:H}}),actions:[{label:"Delete",icon:"minus",onClick:()=>y({rowIndex:e})}]}});return n.jsx(D,{table:{defaultEmptyRow:o,onAddRow:b,columnAlignment:["left","right","right"],headers:[{cells:[{value:"Drink"},{value:"Quantity"},{value:"Total Price (£)"}],actions:[{primary:!0,icon:"plus",label:"Add",onClick:()=>b()}]}],rows:T,footer:{pagination:{rowCount:i.length,selectedPage:l,rowsPerPage:{onChange:a=>{const{value:m}=a.target;w(Number(m))},options:k,value:p},onSelectPage:a=>t(a),small:!0}}}})},J=()=>{const h=["Section","Width","Height"];let g=Array.from(Array(10),(p,w)=>[w,w*2,w*2]);const[o,x]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),i=(p,w,l,t)=>{g[w][l]=Number(p.target.value),t()},R=(p,w,l,t)=>{var c;let r=((c=p==null?void 0:p.clipboardData)==null?void 0:c.getData("text"))??"";return x({rowIndex:w,cellIndex:l,pastedValues:r}),t(),{pastedData:o}},k=()=>{const[p,w]=S.useState(!1),l=()=>{w(!p)},t={headers:[{cells:h.map(r=>({value:r}))}],rows:g.map((r,c)=>{const b=c;return{cells:[...Array(3).keys()].map((y,s)=>({value:r[s],type:"Input",onChange:u=>i(u,b,s,l),onPaste:u=>R(u,b,s,l)}))}})};return n.jsxs(n.Fragment,{children:[n.jsx(D,{table:t}),n.jsx(oe,{label:"Pasted Data",children:n.jsx(se,{value:o.pastedValues})}),n.jsx(oe,{label:"At Row",children:n.jsx(se,{value:o.rowIndex})}),n.jsx(oe,{label:"At Cell Index",children:n.jsx(se,{value:o.cellIndex})})]})};return n.jsx(k,{})},X=()=>{const h={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],columnAlignment:[...Array(10)].map((g,o)=>"right"),headers:[{cells:[...Array(10)].map((g,o)=>({value:"Heading"}))},{cells:[...Array(10)].map((g,o)=>({options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],type:"Select",searchable:!1,value:{label:"m",value:"m"},autoLayerWidth:!0}))}],rows:[...Array(10)].map((g,o)=>({cells:[...Array(10)].map((x,i)=>({value:123.45})),actions:[{icon:"help",tooltip:n.jsxs(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here lorem ipsum"}),n.jsx(W,{children:"Label: 123.45m"}),n.jsx(W,{children:"Another label: 123.45m"}),n.jsx(W,{children:"Label: 123.45m"})]})}]}))};return n.jsx(D,{table:h})},Y=()=>{const h={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(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here"}),n.jsx(W,{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(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here"}),n.jsx(W,{children:"Details go here"})]})}]}]};return n.jsx(D,{table:h})};M.__docgenInfo={description:"",methods:[],displayName:"InCard"};q.__docgenInfo={description:"",methods:[],displayName:"Managed"};K.__docgenInfo={description:"",methods:[],displayName:"ManagedWithSort"};B.__docgenInfo={description:"",methods:[],displayName:"ManagedWithFilterAndMultipleSort"};z.__docgenInfo={description:"",methods:[],displayName:"AutoAddNewRow"};J.__docgenInfo={description:"",methods:[],displayName:"OnPasteCallback"};X.__docgenInfo={description:"",methods:[],displayName:"ExampleTableWithInfoTooltips"};Y.__docgenInfo={description:"",methods:[],displayName:"ExampleTableWithInlineUnits"};var ce,de,ue;te.parameters={...te.parameters,docs:{...(ce=te.parameters)==null?void 0:ce.docs,source:{originalSource:`args => {
|
|
2
2
|
return <Table
|
|
3
3
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
4
|
{...args} />;
|
|
@@ -769,4 +769,4 @@ import{j as n}from"./jsx-runtime-eps93zm2.js";import{r as S}from"./index-DhsZuJv
|
|
|
769
769
|
}]
|
|
770
770
|
};
|
|
771
771
|
return <Table table={table} />;
|
|
772
|
-
}`,...(cn=(ln=Y.parameters)==null?void 0:ln.docs)==null?void 0:cn.source}}};const
|
|
772
|
+
}`,...(cn=(ln=Y.parameters)==null?void 0:ln.docs)==null?void 0:cn.source}}};const wt=["Default","FixedWidth","AutoWidth","ColumnWidths","ColumnAlignment","ColumnHeaderAlignment","InfiniteScrollFixedHeight","InfiniteScrollFullHeight","InfiniteScrollShort","InfiniteScrollWithDragAndDrop","InCard","Managed","ManagedWithSort","ManagedWithFilterAndMultipleSort","AutoAddNewRow","OnPasteCallback","ExampleTableWithInfoTooltips","ExampleTableWithInlineUnits"];export{z as AutoAddNewRow,L as AutoWidth,Q as ColumnAlignment,O as ColumnHeaderAlignment,_ as ColumnWidths,te as Default,X as ExampleTableWithInfoTooltips,Y as ExampleTableWithInlineUnits,E as FixedWidth,M as InCard,G as InfiniteScrollFixedHeight,N as InfiniteScrollFullHeight,U as InfiniteScrollShort,$ as InfiniteScrollWithDragAndDrop,q as Managed,B as ManagedWithFilterAndMultipleSort,K as ManagedWithSort,J as OnPasteCallback,wt as __namedExportsOrder,ht as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as r}from"./jsx-runtime-eps93zm2.js";import{r as D}from"./index-DhsZuJvc.js";import{c as _}from"./index-Bk2sglWO.js";import{D as H}from"./disabled-context-rmpd7YJS.js";import{l as $}from"./lodash-c4VUpsOs.js";import{B as C}from"./badge-CLQ59MDF.js";import{s as z}from"./select.input-
|
|
1
|
+
import{j as r}from"./jsx-runtime-eps93zm2.js";import{r as D}from"./index-DhsZuJvc.js";import{c as _}from"./index-Bk2sglWO.js";import{D as H}from"./disabled-context-rmpd7YJS.js";import{l as $}from"./lodash-c4VUpsOs.js";import{B as C}from"./badge-CLQ59MDF.js";import{s as z}from"./select.input-CJed_LLR.js";const G="_tabs_1y79t_1",J="_padding_1y79t_7",K="_margin_1y79t_11",Q="_contentPadding_1y79t_14",U="_item_1y79t_17",W="_active_1y79t_39",X="_hidden_1y79t_58",Y="_disabled_1y79t_61",Z="_left_1y79t_65",ee="_right_1y79t_65",a={tabs:G,padding:J,margin:K,contentPadding:Q,item:U,active:W,hidden:X,disabled:Y,left:Z,right:ee},j=({label:n,url:u,hidden:i,disabled:m,active:o,onClick:f,right:v,invalid:b,badge:s,testId:c})=>{const T=getComputedStyle(document.body).getPropertyValue("--color-text-error");return r.jsx("a",{id:n==null?void 0:n.toString(),href:u,className:_(a.item,o?a.active:"",m?a.disabled:"",i&&!o?a.hidden:"",v?a.right:a.left),onClick:f,"data-testid":c,children:b?r.jsx(C,{small:!0,margin:"-4px",color:T,title:"!",children:n}):s?r.jsx(C,{small:!0,margin:"-4px",title:s==null?void 0:s.toString(),children:n}):n})};j.__docgenInfo={description:"",methods:[],displayName:"Label",props:{label:{required:!0,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},url:{required:!1,tsType:{name:"string"},description:""},hidden:{required:!1,tsType:{name:"boolean"},description:""},disabled:{required:!1,tsType:{name:"boolean"},description:""},active:{required:!1,tsType:{name:"boolean"},description:""},onClick:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: MouseEvent<HTMLAnchorElement>) => void",signature:{arguments:[{type:{name:"MouseEvent",elements:[{name:"HTMLAnchorElement"}],raw:"MouseEvent<HTMLAnchorElement>"},name:"evt"}],return:{name:"void"}}},description:""},right:{required:!1,tsType:{name:"boolean"},description:""},invalid:{required:!1,tsType:{name:"boolean"},description:""},badge:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const k=({children:n,activeTabIndex:u,contentPadding:i})=>Array.isArray(n)?r.jsx("div",{className:_(i?a.contentPadding:""),children:n.map((m,o)=>u===o&&m)}):null;k.__docgenInfo={description:"",methods:[],displayName:"Content",props:{children:{required:!1,tsType:{name:"union",raw:"ReactNode[] | ReactNode",elements:[{name:"Array",elements:[{name:"ReactNode"}],raw:"ReactNode[]"},{name:"ReactNode"}]},description:""},activeTabIndex:{required:!0,tsType:{name:"number"},description:""},contentPadding:{required:!1,tsType:{name:"boolean"},description:""}}};const ne=({name:n=void 0,options:u=null,children:i=null,value:m=void 0,onChange:o=$.noop,padding:f=!1,margin:v=!0,contentPadding:b=!0,onChangeTab:s,activeTabIndex:c=void 0,tabs:T=void 0,testId:E})=>{const h=D.useContext(H),g=s!==void 0,q=i?i.map((e,t)=>{var l;return{value:t,url:e.props.url,label:e.props.label,hidden:e.props.hidden,disabled:e.props.disabled||h,badge:e.props.badge,testId:((l=e.props)==null?void 0:l.testId)&&`${e.props.testId}-${t}`}}):u||T,{simpleInputs:N,options:p,selectedOptions:y}=g?{simpleInputs:!1,options:q,selectedOptions:void 0}:z(q,m),I=g||y===void 0||y===null?void 0:N?y:y.value,x=c!==void 0?c:p==null?void 0:p.findIndex(e=>e.value===I),w=x===-1?0:x,V=(e,t,l)=>{if(g){const d=t.key||t.label||null;s(e,d)}else{const d=l.target;d.name=n,d.value=t.value,d.label=t.label,o(l)}},L=(e,t)=>{const{label:l,url:d,hidden:O,disabled:P,value:A,right:F,invalid:M,badge:R,testId:S}=e;return r.jsx(j,{label:l,url:d,hidden:O,disabled:P||h,invalid:M,badge:R,right:F,active:g?t===w:A===I,onClick:B=>V(t,e,B),testId:S},t)};return p?r.jsxs("div",{children:[r.jsx("div",{className:_(a.tabs,f?a.padding:"",v?a.margin:""),"data-testid":E,children:p.map(L)}),r.jsx(k,{activeTabIndex:w??0,contentPadding:b,children:i})]}):null};ne.__docgenInfo={description:"",methods:[],displayName:"Tabs",props:{name:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"undefined",computed:!0}},options:{required:!1,tsType:{name:"union",raw:"ITabOption[] | null",elements:[{name:"Array",elements:[{name:"ITabOption"}],raw:"ITabOption[]"},{name:"null"}]},description:"",defaultValue:{value:"null",computed:!1}},children:{required:!1,tsType:{name:"any"},description:"",defaultValue:{value:"null",computed:!1}},value:{required:!1,tsType:{name:"ITabSelectedOption"},description:"",defaultValue:{value:"undefined",computed:!0}},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:`(
|
|
2
2
|
event: TChangeEvent<T>,
|
|
3
3
|
...additionalProps: { [key: string]: any }[]
|
|
4
4
|
) => void`,signature:{arguments:[{type:{name:"intersection",raw:`ChangeEvent<T> & {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as I}from"./index-DhsZuJvc.js";import{T as b}from"./tabs-BoToLVEP.js";import"./index-Bk2sglWO.js";import"./disabled-context-rmpd7YJS.js";import"./lodash-c4VUpsOs.js";import"./badge-CLQ59MDF.js";import"./select.input-CJed_LLR.js";import"./helpers-JJxzGegQ.js";import"./types-BmbYqTX_.js";const U={title:"Navigation/Tabs",component:b,args:{name:"example",options:[{label:"Tab",value:0},{label:"Tab",value:1},{label:"With Badge",value:2,badge:"3"},{label:"Invalid",value:3,invalid:!0},{label:"Disabled",value:4,disabled:!0},{label:"Hidden tab",value:5,hidden:!0}],value:0}},s=i=>e.jsx(b,{...i}),d=s.bind({}),r=s.bind({});r.args={children:[e.jsx("div",{label:"Tab 0",children:e.jsx("h3",{children:"Tab 0 Content"})}),e.jsx("div",{label:"Tab 1",hidden:!0,children:e.jsx("h3",{children:"Tab 1 Content"})}),e.jsx("div",{label:"Tab 2",disabled:!0,children:e.jsx("h3",{children:"Tab 2 Content"})}),e.jsx("div",{label:"Tab 3",children:e.jsx("h3",{children:"Tab 3 Content"})}),e.jsx("div",{label:"Tab 4",children:e.jsx("h3",{children:"Tab 4 Content"})})]};const l=s.bind({});l.args={margin:!1};const a=s.bind({});a.parameters={layout:"fullscreen",docs:{description:{story:"When you want the divider to fill the edges of its container."}}};a.args={padding:!0};const t=s.bind({});t.args={options:[{label:"Tab 0",value:0},{label:"Tab 1",value:1},{label:"Tab 2",value:2},{label:"Tab 3",value:3,right:!0},{label:"Tab 4",value:4,right:!0}]};const o=()=>{const i=[{label:"Strawberries",value:"strawberries"},{label:"Bananas",value:"bananas"},{label:"Apples",value:"apples",disabled:!0},{label:"Pomegranates",value:"pomegranates"}],[p,D]=I.useState(i[0]);return e.jsxs(e.Fragment,{children:[e.jsx(b,{name:"example",value:p,options:i,onChange:c=>{const{value:H,label:z}=(c==null?void 0:c.target)??{};D({value:H,label:z})}}),e.jsxs("span",{children:["Eating ",p.value,"..."]})]})},n=s.bind({});n.args={options:[{label:"Title Case Label",value:0},{label:"Mixed case label",value:1},{label:"lower case label",value:2}]};o.__docgenInfo={description:"",methods:[],displayName:"Managed"};var u,m,g;d.parameters={...d.parameters,docs:{...(u=d.parameters)==null?void 0:u.docs,source:{originalSource:"args => <Tabs {...args} />",...(g=(m=d.parameters)==null?void 0:m.docs)==null?void 0:g.source}}};var T,v,h;r.parameters={...r.parameters,docs:{...(T=r.parameters)==null?void 0:T.docs,source:{originalSource:"args => <Tabs {...args} />",...(h=(v=r.parameters)==null?void 0:v.docs)==null?void 0:h.source}}};var x,j,S;l.parameters={...l.parameters,docs:{...(x=l.parameters)==null?void 0:x.docs,source:{originalSource:"args => <Tabs {...args} />",...(S=(j=l.parameters)==null?void 0:j.docs)==null?void 0:S.source}}};var C,f,w;a.parameters={...a.parameters,docs:{...(C=a.parameters)==null?void 0:C.docs,source:{originalSource:"args => <Tabs {...args} />",...(w=(f=a.parameters)==null?void 0:f.docs)==null?void 0:w.source}}};var M,y,E;t.parameters={...t.parameters,docs:{...(M=t.parameters)==null?void 0:M.docs,source:{originalSource:"args => <Tabs {...args} />",...(E=(y=t.parameters)==null?void 0:y.docs)==null?void 0:E.source}}};var _,A,N;o.parameters={...o.parameters,docs:{...(_=o.parameters)==null?void 0:_.docs,source:{originalSource:`() => {
|
|
2
|
+
const options = [{
|
|
3
|
+
label: 'Strawberries',
|
|
4
|
+
value: 'strawberries'
|
|
5
|
+
}, {
|
|
6
|
+
label: 'Bananas',
|
|
7
|
+
value: 'bananas'
|
|
8
|
+
}, {
|
|
9
|
+
label: 'Apples',
|
|
10
|
+
value: 'apples',
|
|
11
|
+
disabled: true
|
|
12
|
+
}, {
|
|
13
|
+
label: 'Pomegranates',
|
|
14
|
+
value: 'pomegranates'
|
|
15
|
+
}];
|
|
16
|
+
const [selectedTab, setSelectedTab] = useState(options[0]);
|
|
17
|
+
return <>
|
|
18
|
+
<Tabs name="example" value={selectedTab} options={options} onChange={evt => {
|
|
19
|
+
const {
|
|
20
|
+
value,
|
|
21
|
+
label
|
|
22
|
+
} = ((evt?.target ?? {}) as any);
|
|
23
|
+
setSelectedTab({
|
|
24
|
+
value,
|
|
25
|
+
label
|
|
26
|
+
});
|
|
27
|
+
}} />
|
|
28
|
+
<span>Eating {selectedTab.value}...</span>
|
|
29
|
+
</>;
|
|
30
|
+
}`,...(N=(A=o.parameters)==null?void 0:A.docs)==null?void 0:N.source}}};var P,W,B;n.parameters={...n.parameters,docs:{...(P=n.parameters)==null?void 0:P.docs,source:{originalSource:"args => <Tabs {...args} />",...(B=(W=n.parameters)==null?void 0:W.docs)==null?void 0:B.source}}};const V=["Default","WithChildren","NoMargin","HorizontalPadding","Alignment","Managed","TestTitleCase"];export{t as Alignment,d as Default,a as HorizontalPadding,o as Managed,l as NoMargin,n as TestTitleCase,r as WithChildren,V as __namedExportsOrder,U as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as G}from"./jsx-runtime-eps93zm2.js";import{T as X}from"./table-
|
|
1
|
+
import{j as G}from"./jsx-runtime-eps93zm2.js";import{T as X}from"./table-Cw1-vdpR.js";import{t as K,E as O,s as W,F as k,G as q,H as z,I as D,J as M,K as P,L as Q}from"./table.stories-data-C3vJedB1.js";import"./index-DhsZuJvc.js";import"./index-Bk2sglWO.js";import"./index.es-DazXb-ul.js";import"./inheritsLoose-DP0QEDDI.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./index-CUZDtIZe.js";import"./memoize-one.esm-CcMeOnPo.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./lodash-c4VUpsOs.js";import"./actions-D-uVCDzk.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./index-CEuq6vkz.js";import"./tooltip-1V7clEnw.js";import"./types-BmbYqTX_.js";import"./types-Dx2TtIG9.js";import"./badge-CLQ59MDF.js";import"./heading-CRNoBc7q.js";import"./help-icon-Buhx5nl6.js";import"./pagination-DWc8zp3k.js";import"./select-03uRbc4I.js";import"./enum-Bnn40S8Q.js";import"./assertThisInitialized-B9jnkVVz.js";import"./text-B3-TSWok.js";import"./select.input-CJed_LLR.js";import"./helpers-JJxzGegQ.js";import"./input-DTXbDJaL.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./number-input-Dq8zEk7X.js";import"./index-C0x1JmaP.js";import"./index-DRSy5Ssd.js";import"./check-box-DPLaOkRR.js";import"./slider-C7vnj_3M.js";import"./index-BI4_Bp97.js";import"./popover-rq33c1W2.js";import"./flex-EllkLxgO.js";const Or={title:"Basic/Table/Title & Header",component:X,args:{table:{...K}}},r=B=>G.jsx(X,{...B}),e=r.bind({});e.args={table:O};const s=r.bind({});s.args={table:W};const a=r.bind({});a.args={table:k};const t=r.bind({});t.args={table:q};const o=r.bind({});o.args={table:z};const n=r.bind({});n.args={table:D};const i=r.bind({});i.args={table:M};const p=r.bind({});p.args={table:P};const m=r.bind({});m.args={table:Q};var l,c,d;e.parameters={...e.parameters,docs:{...(l=e.parameters)==null?void 0:l.docs,source:{originalSource:`args => {
|
|
2
2
|
return <Table
|
|
3
3
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
4
|
{...args} />;
|
|
@@ -30,8 +30,8 @@ import{j as G}from"./jsx-runtime-eps93zm2.js";import{T as X}from"./table-5Y5KPNS
|
|
|
30
30
|
return <Table
|
|
31
31
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
32
32
|
{...args} />;
|
|
33
|
-
}`,...(E=(y=p.parameters)==null?void 0:y.docs)==null?void 0:E.source}}};var N,U,_;
|
|
33
|
+
}`,...(E=(y=p.parameters)==null?void 0:y.docs)==null?void 0:E.source}}};var N,U,_;m.parameters={...m.parameters,docs:{...(N=m.parameters)==null?void 0:N.docs,source:{originalSource:`args => {
|
|
34
34
|
return <Table
|
|
35
35
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
36
36
|
{...args} />;
|
|
37
|
-
}`,...(_=(U=
|
|
37
|
+
}`,...(_=(U=m.parameters)==null?void 0:U.docs)==null?void 0:_.source}}};const Wr=["Units","ActiveRow","Title","TitleJSX","ChildComponent","Filter","Sort","HeaderActionsNoLabel","HelpAndLibraryIcons"];export{s as ActiveRow,o as ChildComponent,n as Filter,p as HeaderActionsNoLabel,m as HelpAndLibraryIcons,i as Sort,a as Title,t as TitleJSX,e as Units,Wr as __namedExportsOrder,Or as default};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import{j as s}from"./jsx-runtime-eps93zm2.js";import{G as W}from"./grid-DRkC-bt8.js";import{T as m}from"./text-B3-TSWok.js";import{F as P}from"./flex-EllkLxgO.js";import{t as d,d as p}from"./toaster-BoBcvmf9.js";import{B as o}from"./button-DHevvVBE.js";import{S as q}from"./spacer-BWoNR27H.js";import{a as g}from"./message-Y48EomV-.js";import"./index-DhsZuJvc.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./index-Bk2sglWO.js";import"./toaster-7wnI6hqB.js";import"./index-CUZDtIZe.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./tooltip-1V7clEnw.js";const L={type:g.SUCCESS,icon:!0,heading:"Heading",content:"Great results"},U={type:g.ERROR,icon:!0,heading:"Heading",content:"An error has happened",details:"Bad input data lorem ipsum dolor est compendum lorem ipsum."},z={type:g.WARNING,icon:!0,heading:"Heading",content:"Warning message"},J={type:g.INFO,icon:!0,heading:"Heading",content:"Long content lorem ipsum dolor est compendum lorem ipsum."},xs={title:"Modals/Toaster",parameters:{docs:{story:{inline:!1,iframeHeight:400}}},source:{type:"code"},args:{id:void 0,message:J,autoClose:6e3,onClose:()=>{}}},x=e=>s.jsx(o,{onClick:()=>d({...e,onClose:()=>console.log("toast closed")}),label:"Show toast"}),u=x.bind({}),r=x.bind({});r.args={message:L};const a=x.bind({});a.args={message:z};const n=x.bind({});n.args={message:U};const t=()=>s.jsx(o,{label:"Show Toast",onClick:()=>{const e=Math.random()>=.5;d({message:{type:e?"Success":"Error",icon:!0,content:e?"Success":"Error"},onClose:()=>console.log("toast closed"),id:"uniqueId"})}});t.parameters={docs:{iframeHeight:200,description:{story:"Pass a unique `id` in the `toast` object to prevent duplicates. Successive toasts with the same ID will update the existing toast."}}};const i=()=>{const e="sessionExpiring",S={type:"Info",content:s.jsxs(W,{children:[s.jsx(m,{bold:!0,children:"You will be signed out soon"}),s.jsx(m,{children:"For your security, you will be automatically signed out in 30 minutes unless you extend your session."}),s.jsx(q,{height:"var(--padding-xxs)"}),s.jsxs(P,{gap:"var(--padding-xs)",children:[s.jsx(o,{label:"Extend session",small:!0,colored:"success",onClick:()=>p(e)}),s.jsx(o,{label:"Dismiss",small:!0,onClick:()=>p(e)})]})]})};return s.jsx(o,{label:"Show Toast",onClick:()=>d({message:S,autoClose:!1,id:e})})},c=()=>{const e="sessionExpiringSoon",S={type:"Error",content:s.jsxs(W,{children:[s.jsx(m,{bold:!0,children:"You will be signed out very soon"}),s.jsx(m,{children:"For your security, you will be automatically signed out in 30 minutes unless you extend your session."}),s.jsx(q,{height:"var(--padding-xxs)"}),s.jsxs(P,{gap:"var(--padding-xs)",children:[s.jsx(o,{label:"Extend session",small:!0,colored:"success",onClick:()=>p(e)}),s.jsx(o,{label:"Dismiss",small:!0,onClick:()=>p(e)})]})]})};return s.jsx(o,{label:"Show Toast",onClick:()=>d({message:S,autoClose:!1,id:e})})},l=()=>{const e={type:"Success",content:"Your session has been extended for 1 hour"};return s.jsx(o,{label:"Show Toast",onClick:()=>d({message:e})})};t.__docgenInfo={description:"",methods:[],displayName:"PreventDuplicates"};i.__docgenInfo={description:"",methods:[],displayName:"SessionExpiring"};c.__docgenInfo={description:"",methods:[],displayName:"SessionExpiringSoon"};l.__docgenInfo={description:"",methods:[],displayName:"SessionExtended"};var h,y,T;u.parameters={...u.parameters,docs:{...(h=u.parameters)==null?void 0:h.docs,source:{originalSource:`args => {
|
|
2
|
+
return <Button onClick={() => toast({
|
|
3
|
+
...args,
|
|
4
|
+
onClose: () => console.log('toast closed')
|
|
5
|
+
})} label="Show toast" />;
|
|
6
|
+
}`,...(T=(y=u.parameters)==null?void 0:y.docs)==null?void 0:T.source}}};var b,C,E;r.parameters={...r.parameters,docs:{...(b=r.parameters)==null?void 0:b.docs,source:{originalSource:`args => {
|
|
7
|
+
return <Button onClick={() => toast({
|
|
8
|
+
...args,
|
|
9
|
+
onClose: () => console.log('toast closed')
|
|
10
|
+
})} label="Show toast" />;
|
|
11
|
+
}`,...(E=(C=r.parameters)==null?void 0:C.docs)==null?void 0:E.source}}};var f,I,w;a.parameters={...a.parameters,docs:{...(f=a.parameters)==null?void 0:f.docs,source:{originalSource:`args => {
|
|
12
|
+
return <Button onClick={() => toast({
|
|
13
|
+
...args,
|
|
14
|
+
onClose: () => console.log('toast closed')
|
|
15
|
+
})} label="Show toast" />;
|
|
16
|
+
}`,...(w=(I=a.parameters)==null?void 0:I.docs)==null?void 0:w.source}}};var j,k,_;n.parameters={...n.parameters,docs:{...(j=n.parameters)==null?void 0:j.docs,source:{originalSource:`args => {
|
|
17
|
+
return <Button onClick={() => toast({
|
|
18
|
+
...args,
|
|
19
|
+
onClose: () => console.log('toast closed')
|
|
20
|
+
})} label="Show toast" />;
|
|
21
|
+
}`,...(_=(k=n.parameters)==null?void 0:k.docs)==null?void 0:_.source}}};var D,v,B;t.parameters={...t.parameters,docs:{...(D=t.parameters)==null?void 0:D.docs,source:{originalSource:`() => <Button label="Show Toast" onClick={() => {
|
|
22
|
+
const isSuccess = Math.random() >= 0.5;
|
|
23
|
+
toast({
|
|
24
|
+
message: ({
|
|
25
|
+
type: isSuccess ? 'Success' : 'Error',
|
|
26
|
+
icon: true,
|
|
27
|
+
content: isSuccess ? 'Success' : 'Error'
|
|
28
|
+
} as IMessageType),
|
|
29
|
+
onClose: () => console.log('toast closed'),
|
|
30
|
+
id: 'uniqueId'
|
|
31
|
+
});
|
|
32
|
+
}} />`,...(B=(v=t.parameters)==null?void 0:v.docs)==null?void 0:B.source}}};var O,A,F;i.parameters={...i.parameters,docs:{...(O=i.parameters)==null?void 0:O.docs,source:{originalSource:`() => {
|
|
33
|
+
const TOAST_ID = 'sessionExpiring';
|
|
34
|
+
const message = ({
|
|
35
|
+
type: 'Info',
|
|
36
|
+
content: <Grid>
|
|
37
|
+
<Text bold>You will be signed out soon</Text>
|
|
38
|
+
<Text>
|
|
39
|
+
For your security, you will be automatically signed out in 30 minutes
|
|
40
|
+
unless you extend your session.
|
|
41
|
+
</Text>
|
|
42
|
+
<Spacer height="var(--padding-xxs)" />
|
|
43
|
+
<Flex gap="var(--padding-xs)">
|
|
44
|
+
<Button label="Extend session" small colored="success" onClick={() => dismissToast(TOAST_ID)} />
|
|
45
|
+
<Button label="Dismiss" small onClick={() => dismissToast(TOAST_ID)} />
|
|
46
|
+
</Flex>
|
|
47
|
+
</Grid>
|
|
48
|
+
} as IMessageType);
|
|
49
|
+
return <Button label="Show Toast" onClick={() => toast({
|
|
50
|
+
message,
|
|
51
|
+
autoClose: false,
|
|
52
|
+
id: TOAST_ID
|
|
53
|
+
})} />;
|
|
54
|
+
}`,...(F=(A=i.parameters)==null?void 0:A.docs)==null?void 0:F.source}}};var G,M,N;c.parameters={...c.parameters,docs:{...(G=c.parameters)==null?void 0:G.docs,source:{originalSource:`() => {
|
|
55
|
+
const TOAST_ID = 'sessionExpiringSoon';
|
|
56
|
+
const message = ({
|
|
57
|
+
type: 'Error',
|
|
58
|
+
content: <Grid>
|
|
59
|
+
<Text bold>You will be signed out very soon</Text>
|
|
60
|
+
<Text>
|
|
61
|
+
For your security, you will be automatically signed out in 30 minutes
|
|
62
|
+
unless you extend your session.
|
|
63
|
+
</Text>
|
|
64
|
+
<Spacer height="var(--padding-xxs)" />
|
|
65
|
+
<Flex gap="var(--padding-xs)">
|
|
66
|
+
<Button label="Extend session" small colored="success" onClick={() => dismissToast(TOAST_ID)} />
|
|
67
|
+
<Button label="Dismiss" small onClick={() => dismissToast(TOAST_ID)} />
|
|
68
|
+
</Flex>
|
|
69
|
+
</Grid>
|
|
70
|
+
} as IMessageType);
|
|
71
|
+
return <Button label="Show Toast" onClick={() => toast({
|
|
72
|
+
message,
|
|
73
|
+
autoClose: false,
|
|
74
|
+
id: TOAST_ID
|
|
75
|
+
})} />;
|
|
76
|
+
}`,...(N=(M=c.parameters)==null?void 0:M.docs)==null?void 0:N.source}}};var H,Y,R;l.parameters={...l.parameters,docs:{...(H=l.parameters)==null?void 0:H.docs,source:{originalSource:`() => {
|
|
77
|
+
const message = ({
|
|
78
|
+
type: 'Success',
|
|
79
|
+
content: 'Your session has been extended for 1 hour'
|
|
80
|
+
} as IMessageType);
|
|
81
|
+
return <Button label="Show Toast" onClick={() => toast({
|
|
82
|
+
message
|
|
83
|
+
})} />;
|
|
84
|
+
}`,...(R=(Y=l.parameters)==null?void 0:Y.docs)==null?void 0:R.source}}};const Ss=["Default","Success","Warning","Error","PreventDuplicates","SessionExpiring","SessionExpiringSoon","SessionExtended"];export{u as Default,n as Error,t as PreventDuplicates,i as SessionExpiring,c as SessionExpiringSoon,l as SessionExtended,r as Success,a as Warning,Ss as __namedExportsOrder,xs as default};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{j as u}from"./jsx-runtime-eps93zm2.js";import{w as d,e as a,u as n,a as c}from"./index-DMAnyMX5.js";import{t as g}from"./toaster-BoBcvmf9.js";import{B as w}from"./button-DHevvVBE.js";import{a as y}from"./message-Y48EomV-.js";import"./index-DhsZuJvc.js";import"./index-CF7H4eMJ.js";import"./toaster-7wnI6hqB.js";import"./index-CUZDtIZe.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./tooltip-1V7clEnw.js";const h={type:y.INFO,icon:!0,heading:"Heading",content:"Long content lorem ipsum dolor est compendum lorem ipsum."},O={title:"Modals/Toaster/Test Cases",parameters:{docs:{story:{inline:!1,iframeHeight:400}}},source:{type:"code"},args:{id:void 0,message:h,autoClose:6e3,onClose:()=>{}},tags:["!autodocs"]},T=r=>u.jsx(w,{onClick:()=>g({...r,onClose:()=>console.log("toast closed")}),label:"Show toast"}),s=T.bind({});s.args={id:"testId",autoClose:50};s.play=async({canvasElement:r,step:i})=>{const t=r.parentElement?d(r.parentElement):null;await a(t).toBeTruthy(),t&&(await i("Toast should appear when triggered",async()=>{const o=t.getByText("Show toast");await n.click(o);const e=t.getByRole("alert");await a(e).toBeInTheDocument()}),await i("Duplicate toasts shouldn't be created",async()=>{const o=t.getByText("Show toast");await n.click(o);const e=t.queryAllByRole("alert");await a(e).toHaveLength(1)}),await i("Toast should disappear when close button pressed",async()=>{const o=t.getByRole("alert"),e=t.getByTestId("testId-dismiss");await n.click(e),await c(()=>a(o).not.toBeInTheDocument(),{timeout:2e3})}),await i("Toast should automatically close",async()=>{const o=t.getByText("Show toast");await n.click(o);const e=t.getByRole("alert");await c(()=>a(e).not.toBeInTheDocument(),{timeout:2e3})}))};var l,m,p;s.parameters={...s.parameters,docs:{...(l=s.parameters)==null?void 0:l.docs,source:{originalSource:`args => {
|
|
2
|
+
return <Button onClick={() => toast({
|
|
3
|
+
...args,
|
|
4
|
+
onClose: () => console.log('toast closed')
|
|
5
|
+
})} label="Show toast" />;
|
|
6
|
+
}`,...(p=(m=s.parameters)==null?void 0:m.docs)==null?void 0:p.source}}};const q=["Test"];export{s as Test,q as __namedExportsOrder,O as default};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-eps93zm2.js";import{F as h}from"./flex-EllkLxgO.js";import{T as g}from"./text-B3-TSWok.js";import{T as i}from"./toggle-BbFVf61v.js";import"./index-DhsZuJvc.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./help-icon-Buhx5nl6.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";const{useArgs:q}=__STORYBOOK_MODULE_PREVIEW_API__,ce={title:"Forms/Toggle",component:i,args:{label:"Label"}},n=N=>{const[{checked:U},V]=q(),Y=()=>{V({checked:!U})};return e.jsx(i,{...N,onChange:Y})},p=n.bind({}),s=n.bind({});s.args={disabled:!0};const a=n.bind({});a.args={checked:!0,disabled:!0};const r=n.bind({});r.args={small:!0};const t=n.bind({});t.args={label:null};const o=n.bind({});o.args={helpText:"Help text"};const c=n.bind({});c.args={onClickHelp:()=>console.log("Help clicked")};const d=()=>e.jsxs(e.Fragment,{children:[e.jsx(i,{display:"block",label:e.jsxs(h,{justifyContent:"space-between",wrap:!1,gap:!0,children:[e.jsx(g,{bold:!0,children:"Label"}),e.jsx(g,{success:!0,children:"Released yesterday"})]}),onChange:()=>{}}),e.jsx(i,{label:e.jsxs(h,{justifyContent:"space-between",wrap:!1,gap:!0,children:[e.jsx(g,{bold:!0,children:"Label"}),e.jsx(g,{success:!0,children:"Released yesterday"})]}),onChange:()=>{}})]}),l=n.bind({});l.args={helpText:"Help text",disabled:!0};d.__docgenInfo={description:"",methods:[],displayName:"Display"};var u,m,x;p.parameters={...p.parameters,docs:{...(u=p.parameters)==null?void 0:u.docs,source:{originalSource:`args => {
|
|
2
|
+
const [{
|
|
3
|
+
checked
|
|
4
|
+
}, updateArgs] = useArgs();
|
|
5
|
+
const handleChange = () => {
|
|
6
|
+
updateArgs({
|
|
7
|
+
checked: !checked
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
return <Toggle
|
|
11
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
12
|
+
{...args} onChange={handleChange} />;
|
|
13
|
+
}`,...(x=(m=p.parameters)==null?void 0:m.docs)==null?void 0:x.source}}};var b,C,k;s.parameters={...s.parameters,docs:{...(b=s.parameters)==null?void 0:b.docs,source:{originalSource:`args => {
|
|
14
|
+
const [{
|
|
15
|
+
checked
|
|
16
|
+
}, updateArgs] = useArgs();
|
|
17
|
+
const handleChange = () => {
|
|
18
|
+
updateArgs({
|
|
19
|
+
checked: !checked
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
return <Toggle
|
|
23
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
24
|
+
{...args} onChange={handleChange} />;
|
|
25
|
+
}`,...(k=(C=s.parameters)==null?void 0:C.docs)==null?void 0:k.source}}};var T,A,j;a.parameters={...a.parameters,docs:{...(T=a.parameters)==null?void 0:T.docs,source:{originalSource:`args => {
|
|
26
|
+
const [{
|
|
27
|
+
checked
|
|
28
|
+
}, updateArgs] = useArgs();
|
|
29
|
+
const handleChange = () => {
|
|
30
|
+
updateArgs({
|
|
31
|
+
checked: !checked
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
return <Toggle
|
|
35
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
36
|
+
{...args} onChange={handleChange} />;
|
|
37
|
+
}`,...(j=(A=a.parameters)==null?void 0:A.docs)==null?void 0:j.source}}};var y,f,S;r.parameters={...r.parameters,docs:{...(y=r.parameters)==null?void 0:y.docs,source:{originalSource:`args => {
|
|
38
|
+
const [{
|
|
39
|
+
checked
|
|
40
|
+
}, updateArgs] = useArgs();
|
|
41
|
+
const handleChange = () => {
|
|
42
|
+
updateArgs({
|
|
43
|
+
checked: !checked
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
return <Toggle
|
|
47
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
48
|
+
{...args} onChange={handleChange} />;
|
|
49
|
+
}`,...(S=(f=r.parameters)==null?void 0:f.docs)==null?void 0:S.source}}};var D,_,H;t.parameters={...t.parameters,docs:{...(D=t.parameters)==null?void 0:D.docs,source:{originalSource:`args => {
|
|
50
|
+
const [{
|
|
51
|
+
checked
|
|
52
|
+
}, updateArgs] = useArgs();
|
|
53
|
+
const handleChange = () => {
|
|
54
|
+
updateArgs({
|
|
55
|
+
checked: !checked
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
return <Toggle
|
|
59
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
60
|
+
{...args} onChange={handleChange} />;
|
|
61
|
+
}`,...(H=(_=t.parameters)==null?void 0:_.docs)==null?void 0:H.source}}};var w,F,O;o.parameters={...o.parameters,docs:{...(w=o.parameters)==null?void 0:w.docs,source:{originalSource:`args => {
|
|
62
|
+
const [{
|
|
63
|
+
checked
|
|
64
|
+
}, updateArgs] = useArgs();
|
|
65
|
+
const handleChange = () => {
|
|
66
|
+
updateArgs({
|
|
67
|
+
checked: !checked
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
return <Toggle
|
|
71
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
72
|
+
{...args} onChange={handleChange} />;
|
|
73
|
+
}`,...(O=(F=o.parameters)==null?void 0:F.docs)==null?void 0:O.source}}};var R,L,E;c.parameters={...c.parameters,docs:{...(R=c.parameters)==null?void 0:R.docs,source:{originalSource:`args => {
|
|
74
|
+
const [{
|
|
75
|
+
checked
|
|
76
|
+
}, updateArgs] = useArgs();
|
|
77
|
+
const handleChange = () => {
|
|
78
|
+
updateArgs({
|
|
79
|
+
checked: !checked
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
return <Toggle
|
|
83
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
84
|
+
{...args} onChange={handleChange} />;
|
|
85
|
+
}`,...(E=(L=c.parameters)==null?void 0:L.docs)==null?void 0:E.source}}};var I,W,P;d.parameters={...d.parameters,docs:{...(I=d.parameters)==null?void 0:I.docs,source:{originalSource:`() => <>
|
|
86
|
+
<Toggle display="block" label={<Flex justifyContent="space-between" wrap={false} gap>
|
|
87
|
+
<Text bold>Label</Text>
|
|
88
|
+
<Text success>Released yesterday</Text>
|
|
89
|
+
</Flex>} onChange={() => {}} />
|
|
90
|
+
<Toggle label={<Flex justifyContent="space-between" wrap={false} gap>
|
|
91
|
+
<Text bold>Label</Text>
|
|
92
|
+
<Text success>Released yesterday</Text>
|
|
93
|
+
</Flex>} onChange={() => {}} />
|
|
94
|
+
</>`,...(P=(W=d.parameters)==null?void 0:W.docs)==null?void 0:P.source}}};var B,K,M;l.parameters={...l.parameters,docs:{...(B=l.parameters)==null?void 0:B.docs,source:{originalSource:`args => {
|
|
95
|
+
const [{
|
|
96
|
+
checked
|
|
97
|
+
}, updateArgs] = useArgs();
|
|
98
|
+
const handleChange = () => {
|
|
99
|
+
updateArgs({
|
|
100
|
+
checked: !checked
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
return <Toggle
|
|
104
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
105
|
+
{...args} onChange={handleChange} />;
|
|
106
|
+
}`,...(M=(K=l.parameters)==null?void 0:K.docs)==null?void 0:M.source}}};const de=["Default","Disabled","DisabledChecked","Small","Standalone","HelpText","OnClickHelp","Display","DisabledWithHelpText"];export{p as Default,s as Disabled,a as DisabledChecked,l as DisabledWithHelpText,d as Display,o as HelpText,c as OnClickHelp,r as Small,t as Standalone,de as __namedExportsOrder,ce as default};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import{j as _}from"./jsx-runtime-eps93zm2.js";import{r as I}from"./index-DhsZuJvc.js";import{w as v,u as g,e as d}from"./index-DMAnyMX5.js";import{T as i}from"./toggle-BbFVf61v.js";import"./index-CF7H4eMJ.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./help-icon-Buhx5nl6.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";const{useArgs:w}=__STORYBOOK_MODULE_PREVIEW_API__,N={title:"Forms/Toggle/Test Cases",component:i,args:{label:"Label"},tags:["!autodocs"]},y=t=>{const[{checked:s},n]=w(),e=()=>{n({checked:!s})};return _.jsx(i,{...t,onChange:e})},o=()=>{const[t,s]=I.useState(!1);return _.jsx(i,{name:"name",label:"Label",checked:t,onChange:n=>{const{name:e,value:r,checked:l}=n.target;s(l),console.log(e,r,l)}})},a=y.bind({});a.args={testId:"testId"};a.play=async({canvasElement:t,step:s})=>{const n=v(t);await s("Clicking checkbox should toggle it",async()=>{const e=n.getByTestId("testId"),r=e.querySelector("input");await g.click(e),await d(r).toBeChecked(),await g.click(e),await d(r).not.toBeChecked()})};const c=y.bind({});c.args={testId:"testId",disabled:!0};c.play=async({canvasElement:t,step:s})=>{const n=v(t);await s("Clicking disabled checkbox shouldn't toggle it",async()=>{const e=n.getByTestId("testId");await e.click(),await d(e.querySelector("input")).not.toBeChecked()})};o.__docgenInfo={description:"",methods:[],displayName:"TestClickevt"};var p,m,h;o.parameters={...o.parameters,docs:{...(p=o.parameters)==null?void 0:p.docs,source:{originalSource:`() => {
|
|
2
|
+
const [checked, setChecked] = useState(false);
|
|
3
|
+
return <Toggle name="name" label="Label" checked={checked} onChange={evt => {
|
|
4
|
+
const {
|
|
5
|
+
name,
|
|
6
|
+
value,
|
|
7
|
+
checked
|
|
8
|
+
} = evt.target;
|
|
9
|
+
setChecked(checked);
|
|
10
|
+
console.log(name, value, checked);
|
|
11
|
+
}} />;
|
|
12
|
+
}`,...(h=(m=o.parameters)==null?void 0:m.docs)==null?void 0:h.source}}};var u,k,C;a.parameters={...a.parameters,docs:{...(u=a.parameters)==null?void 0:u.docs,source:{originalSource:`args => {
|
|
13
|
+
const [{
|
|
14
|
+
checked
|
|
15
|
+
}, updateArgs] = useArgs();
|
|
16
|
+
const handleChange = () => {
|
|
17
|
+
updateArgs({
|
|
18
|
+
checked: !checked
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
return <Toggle
|
|
22
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
23
|
+
{...args} onChange={handleChange} />;
|
|
24
|
+
}`,...(C=(k=a.parameters)==null?void 0:k.docs)==null?void 0:C.source}}};var T,b,x;c.parameters={...c.parameters,docs:{...(T=c.parameters)==null?void 0:T.docs,source:{originalSource:`args => {
|
|
25
|
+
const [{
|
|
26
|
+
checked
|
|
27
|
+
}, updateArgs] = useArgs();
|
|
28
|
+
const handleChange = () => {
|
|
29
|
+
updateArgs({
|
|
30
|
+
checked: !checked
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
return <Toggle
|
|
34
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
35
|
+
{...args} onChange={handleChange} />;
|
|
36
|
+
}`,...(x=(b=c.parameters)==null?void 0:b.docs)==null?void 0:x.source}}};const U=["TestClickevt","Test","TestDisabled"];export{a as Test,o as TestClickevt,c as TestDisabled,U as __namedExportsOrder,N as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-eps93zm2.js";import{T as m}from"./tooltip-1V7clEnw.js";import{M as u}from"./actions-D-uVCDzk.js";import{m as d}from"./menu.stories-data-CQ59XhzU.js";import"./index-DhsZuJvc.js";import"./index-CUZDtIZe.js";import"./index-Bk2sglWO.js";import"./lodash-c4VUpsOs.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./types-BmbYqTX_.js";import"./types-Dx2TtIG9.js";import"./badge-CLQ59MDF.js";import"./flex-EllkLxgO.js";const B={title:"Basic/Tooltip/Test Cases",component:m,args:{text:"Tooltip text"}},l=c=>o.jsx(m,{...c}),e=l.bind({});e.args={children:o.jsx(u,{menu:d}),placement:"bottom-end",display:"inline-block"};const s=l.bind({});s.args={children:o.jsx("span",{children:"Hover over me"}),text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean pharetra tellus eu cursus suscipit. Maecenas leo sapien, convallis ac urna ullamcorper, tempus porttitor eros. Suspendisse pellentesque odio ac metus semper, nec sagittis nisi cursus. Aenean felis libero, bibendum id accumsan id, commodo suscipit ex. Pellentesque gravida rhoncus neque, ac tincidunt libero maximus vel. In lacus nisi, malesuada vitae velit vel, laoreet porta nisl."};var t,r,i;e.parameters={...e.parameters,docs:{...(t=e.parameters)==null?void 0:t.docs,source:{originalSource:`args => <Tooltip
|
|
1
|
+
import{j as o}from"./jsx-runtime-eps93zm2.js";import{T as m}from"./tooltip-1V7clEnw.js";import{M as u}from"./actions-D-uVCDzk.js";import{m as d}from"./menu.stories-data-CQ59XhzU.js";import"./index-DhsZuJvc.js";import"./index-CUZDtIZe.js";import"./index-Bk2sglWO.js";import"./lodash-c4VUpsOs.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./types-BmbYqTX_.js";import"./types-Dx2TtIG9.js";import"./badge-CLQ59MDF.js";import"./flex-EllkLxgO.js";const B={title:"Basic/Tooltip/Test Cases",component:m,args:{text:"Tooltip text"},tags:["!autodocs"]},l=c=>o.jsx(m,{...c}),e=l.bind({});e.args={children:o.jsx(u,{menu:d}),placement:"bottom-end",display:"inline-block"};const s=l.bind({});s.args={children:o.jsx("span",{children:"Hover over me"}),text:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean pharetra tellus eu cursus suscipit. Maecenas leo sapien, convallis ac urna ullamcorper, tempus porttitor eros. Suspendisse pellentesque odio ac metus semper, nec sagittis nisi cursus. Aenean felis libero, bibendum id accumsan id, commodo suscipit ex. Pellentesque gravida rhoncus neque, ac tincidunt libero maximus vel. In lacus nisi, malesuada vitae velit vel, laoreet porta nisl."};var t,r,i;e.parameters={...e.parameters,docs:{...(t=e.parameters)==null?void 0:t.docs,source:{originalSource:`args => <Tooltip
|
|
2
2
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
3
3
|
{...args} />`,...(i=(r=e.parameters)==null?void 0:r.docs)==null?void 0:i.source}}};var a,n,p;s.parameters={...s.parameters,docs:{...(a=s.parameters)==null?void 0:a.docs,source:{originalSource:`args => <Tooltip
|
|
4
4
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{j as o}from"./jsx-runtime-eps93zm2.js";import{r as q}from"./index-DhsZuJvc.js";import{d as a}from"./index-C0x1JmaP.js";import{c as Ce}from"./index-Bk2sglWO.js";import{c as ae,i as Ne,a as Fe,g as De,u as Me,b as Pe}from"./initialize-context-BvejO8yS.js";import{M as Y}from"./actions-D-uVCDzk.js";import{I as xe}from"./input-group-addon-D68iUKV2.js";import{B as je}from"./button-DHevvVBE.js";import{T as Ae}from"./tooltip-1V7clEnw.js";import{I as Se}from"./input-group-BaRSJAEN.js";import{S as Oe}from"./spacer-BWoNR27H.js";import{T as Le}from"./text-B3-TSWok.js";import{M as Z}from"./types-BmbYqTX_.js";import{l as v}from"./lodash-c4VUpsOs.js";import{N as We,r as Re}from"./number-input-Dq8zEk7X.js";const He=()=>{const e=q.useRef(null);return q.useLayoutEffect(()=>{e.current&&(e.current(),e.current=null)}),m=>{e.current=m}};var d=(e=>(e.CUSTOM="custom",e.PREDEFINED="predefined",e))(d||{});const _e=e=>e?!!a.getUnit(e):!1,w=({value:e="",toUnit:f,unitkey:m,defaultFromUnit:P,doNotConvertValue:I})=>{const x=_e(e)||a.isValueWithUnit(e),y=a.getValue(e);return Ne(y)?{value:y}:x?ae({value:e,unitkey:m,toUnit:f,fromUnit:P,doNotConvertValue:I,exactPrecision:!0}):{value:e}},ee=e=>v.isObject(e)&&!v.isArray(e)&&!v.isFunction(e)?v.get(e,"fieldName",""):typeof e=="string"?e:"",te=(e="")=>{var f;return(f=a.KNOWN_UNITS)==null?void 0:f.includes(e)},ke=(e,f)=>{const m=a.getUnit(e||"");return te(f)&&te(m)},$e="_predefinedMenuActive_ye9w9_1",Be="_inputWrapper_ye9w9_4",ne={predefinedMenuActive:$e,inputWrapper:Be},Ke=({name:e,placeholder:f="",disabled:m=!1,disabledUnit:P=!1,error:I=null,left:x=!1,small:y=!1,width:R="100%",value:l,unitkey:u="",initUnit:ie,noConversion:re=!1,onChange:j=v.noop,onClick:Ge=v.noop,onFocus:se=v.noop,onSwitchUnit:H=v.noop,unitTemplate:_,doNotConvertValue:b=!1,testId:V,warning:k=null,predefinedOptions:g,initialPredefinedOption:le=!1,shouldLinkAutomaticly:$=!0,selectedPredefinedOptionKey:B,validationCallback:ue=()=>({name:"",error:null}),disabledValidation:oe=!1,allowEmpty:de=!1,autoValue:U,convertBackToStorageUnit:pe=!1,enableCosmeticRounding:K=!0,enableDisplayRounding:me=!1})=>{const h=Fe(),ce=He();typeof l=="number"&&(l=`${l}`);const[G="",T=""]=l!==void 0?a.split(l):[],Q=U?a.getUnit(U):"",z=q.useMemo(()=>De(u,_||(h==null?void 0:h.unitTemplate)),[u,_,h==null?void 0:h.unitTemplate]),fe=ke(l,z),c=ie||z||T,ge=Me(c),{value:J}=w({value:l,toUnit:c,unitkey:u,defaultFromUnit:T,doNotConvertValue:b}),{value:X}=w({value:U,toUnit:c,unitkey:u,defaultFromUnit:Q,doNotConvertValue:b}),ve=J!==""?{value:J,unit:c}:X!==""?{value:X,unit:c}:{value:G,unit:T},[i,A]=q.useState(ve),ye=de||(i==null?void 0:i.value)===void 0,[E,S]=q.useState(le?d.PREDEFINED:d.CUSTOM),O=G===""&&U,Ue=!!(oe||U),C=g&&g.find(t=>{if(!(t!=null&&t.value))return;if(B)return B===t.valueKey;const n=a.isValueWithUnit(t.value)?a.getUnit(t.value):"",{value:r=l}=ae({value:String(l),unitkey:u,toUnit:n});return a.withUnit(r,n)===t.value}),Te=()=>{const t=O?U:l??"",n=i.unit;if(Pe({value:t,unitkey:u,toUnit:n})){if(u)try{let s=a.altUnitsList(t,u);return a.getValue(t)===""?s.map(p=>["",p[1]]):s}catch{return null}}else{let s=a.getAltUnitsListByQuantity(u);return s==null?void 0:s.map(p=>["",p==null?void 0:p.unit])}},Ee=t=>{const n=ee(e),r=t.target,{value:s,selectionStart:p}=r,M=a.withUnit(s,(i==null?void 0:i.unit)||""),W=pe?a.withUnit(a.convertAndGetValue(M,T),T):M;j({target:{value:W,name:n}});const[qe,Ie]=a.split(M);A({value:qe,unit:Ie}),ce(()=>{r.selectionStart=p,r.selectionEnd=p})},be=(t,n)=>{n===i.unit||isNaN(Number(t))||(A({value:t,unit:n}),H&&H(n))};q.useEffect(()=>{if(c){let t,n="";if(ge!==c){const{value:r}=w({value:l,toUnit:c,unitkey:u,defaultFromUnit:T,doNotConvertValue:b});t=r,n=c}else if(a.withUnit(i.value,i.unit)!==l){const{value:r}=w({value:l,toUnit:i.unit,unitkey:u,defaultFromUnit:T,doNotConvertValue:b});t=r,n=i.unit}t!==void 0&&A({value:t,unit:n}),g&&S(C&&$?d.PREDEFINED:d.CUSTOM)}},[c,l,I,$]);const N=Te(),F=a.label(i.unit)||i.unit||"",Ve=re||!N||N&&N.length===1,L=ee(e);let D;const he=t=>{const n=t!=null&&t.value?t.value:"",[r="",s=""]=a.isValueWithUnit(n)?a.split(n):[n];return{type:Z.OPTION,inline:!0,onClick:()=>{a.validateNumber(r).valid&&!m&&(S(d.PREDEFINED),j({target:{value:n,name:typeof e=="string"?e:(e==null?void 0:e.fieldName)||"",predefinedSelected:!0,predefinedOption:t}}))},label:o.jsxs(o.Fragment,{children:[o.jsx(Le,{children:t.label}),o.jsx(Oe,{width:"20px",height:"0"})]}),description:a.isValueWithUnit(n)?`${r} ${s}`:n,selected:C===t&&E===d.PREDEFINED}};if(D=[{type:Z.OPTION,inline:!0,onClick:()=>{E!==d.CUSTOM&&!m&&j({target:{value:a.withUnit(i.value,i.unit),name:typeof e=="string"?e:(e==null?void 0:e.fieldName)||""}})},label:"Custom",selected:E===d.CUSTOM}],g!=null&&g.length){const t=g.map(he);D=[...D,...t]}const we=t=>{if(O){const{value:n}=w({value:U,toUnit:i.unit,unitkey:u,defaultFromUnit:Q,doNotConvertValue:b});return n}else if(a.isValueWithUnit(t)){const n=a.getUnit(t),{value:r}=w({value:t,toUnit:i.unit,unitkey:u,defaultFromUnit:n,doNotConvertValue:b});return r}return t};return o.jsx("div",{className:E===d.PREDEFINED?Ce(ne.predefinedMenuActive):"",children:o.jsxs(Se,{small:y,width:R,children:[g&&o.jsx(Ae,{text:E===d.PREDEFINED?C==null?void 0:C.label:"",children:o.jsx(Y,{maxHeight:380,groupOrder:"first",testId:V&&`${V}-predefined-menu`,disabled:m,menu:{colored:!0,trigger:"Component",component:o.jsx(je,{groupOrder:"first",active:E===d.PREDEFINED,icon:E===d.PREDEFINED?"link":"unlink"}),small:y,sections:D}})}),o.jsx("div",{className:ne.inputWrapper,children:o.jsx(We,{name:L,testId:V,disabled:m,placeholder:we(f),value:i.value,onChange:Ee,onFocus:se,error:I===null?void 0:I,warning:k===null?void 0:k,left:x,allowEmpty:ye,validationCallback:(t,n)=>ue(L,n),enableCosmeticRounding:K,enableDisplayRounding:me,groupOrder:g?"middle":"first",disableInternalErrorValidationMessages:Ue,small:y},L)}),F&&(Ve||!fe?o.jsx(xe,{groupOrder:"last",children:F}):o.jsx(Y,{maxHeight:380,groupOrder:"last",disabled:P,testId:V&&`${V}-menu`,menu:{label:F,trigger:"DropDownButton",small:y,sections:N.map(([t,n,r])=>{const s=r||n||"",p=a.isValidNum(t)?t:"";return{type:"Option",label:K?Re(p):p,inline:!0,onClick:W=>{W.stopPropagation(),be(O?"":t,n)},description:s,selected:s===F,testId:`${V}-unit-${s}`}})}}))]})})};Ke.__docgenInfo={description:"",methods:[],displayName:"UnitInput",props:{name:{required:!0,tsType:{name:"union",raw:"string | { fieldName?: string }",elements:[{name:"string"},{name:"signature",type:"object",raw:"{ fieldName?: string }",signature:{properties:[{key:"fieldName",value:{name:"string",required:!1}}]}}]},description:""},placeholder:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"''",computed:!1}},disabled:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},disabledUnit:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},error:{required:!1,tsType:{name:"union",raw:"string | null | boolean",elements:[{name:"string"},{name:"null"},{name:"boolean"}]},description:"",defaultValue:{value:"null",computed:!1}},left:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},small:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},width:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:"",defaultValue:{value:"'100%'",computed:!1}},value:{required:!1,tsType:{name:"string"},description:""},unitkey:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"''",computed:!1}},initUnit:{required:!1,tsType:{name:"string"},description:""},noConversion:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},doNotConvertValue:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},testId:{required:!1,tsType:{name:"string"},description:""},warning:{required:!1,tsType:{name:"union",raw:"string | boolean | null",elements:[{name:"string"},{name:"boolean"},{name:"null"}]},description:"",defaultValue:{value:"null",computed:!1}},predefinedOptions:{required:!1,tsType:{name:"union",raw:"IPredefinedOption[] | null",elements:[{name:"Array",elements:[{name:"IPredefinedOption"}],raw:"IPredefinedOption[]"},{name:"null"}]},description:""},initialPredefinedOption:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},shouldLinkAutomaticly:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},selectedPredefinedOptionKey:{required:!1,tsType:{name:"string"},description:""},validationCallback:{required:!1,tsType:{name:"signature",type:"function",raw:"(name: string, error: string | null) => any",signature:{arguments:[{type:{name:"string"},name:"name"},{type:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},name:"error"}],return:{name:"any"}}},description:"",defaultValue:{value:"() => ({ name: '', error: null })",computed:!1}},disabledValidation:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},allowEmpty:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},autoValue:{required:!1,tsType:{name:"string"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(event: TChangeEvent | ICustomChangeEvent) => void",signature:{arguments:[{type:{name:"union",raw:"TChangeEvent | ICustomChangeEvent",elements:[{name:"intersection",raw:`ChangeEvent<T> & {
|
|
2
|
+
target:
|
|
3
|
+
| T
|
|
4
|
+
| { name: string; value: any; label?: string; files?: FileList | null };
|
|
5
|
+
}`,elements:[{name:"ChangeEvent",elements:[{name:"T"}],raw:"ChangeEvent<T>"},{name:"signature",type:"object",raw:`{
|
|
6
|
+
target:
|
|
7
|
+
| T
|
|
8
|
+
| { name: string; value: any; label?: string; files?: FileList | null };
|
|
9
|
+
}`,signature:{properties:[{key:"target",value:{name:"union",raw:`| T
|
|
10
|
+
| { name: string; value: any; label?: string; files?: FileList | null }`,elements:[{name:"T"},{name:"signature",type:"object",raw:"{ name: string; value: any; label?: string; files?: FileList | null }",signature:{properties:[{key:"name",value:{name:"string",required:!0}},{key:"value",value:{name:"any",required:!0}},{key:"label",value:{name:"string",required:!1}},{key:"files",value:{name:"union",raw:"FileList | null",elements:[{name:"FileList"},{name:"null"}],required:!1}}]}}],required:!0}}]}}]},{name:"ICustomChangeEvent"}]},name:"event"}],return:{name:"void"}}},description:"",defaultValue:{value:"noop",computed:!0}},onSwitchUnit:{required:!1,tsType:{name:"signature",type:"function",raw:"(unit: string) => void",signature:{arguments:[{type:{name:"string"},name:"unit"}],return:{name:"void"}}},description:"",defaultValue:{value:"noop",computed:!0}},onClick:{required:!1,tsType:{name:"MouseEventHandler",elements:[{name:"HTMLInputElement"}],raw:"MouseEventHandler<HTMLInputElement>"},description:"",defaultValue:{value:"noop",computed:!0}},onFocus:{required:!1,tsType:{name:"FocusEventHandler",elements:[{name:"HTMLInputElement"}],raw:"FocusEventHandler<HTMLInputElement>"},description:"",defaultValue:{value:"noop",computed:!0}},unitTemplate:{required:!1,tsType:{name:"Record",elements:[{name:"string"},{name:"any"}],raw:"Record<string, any>"},description:""},convertBackToStorageUnit:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},enableCosmeticRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},enableDisplayRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}}}};export{Ke as U};
|