@oliasoft-open-source/react-ui-library 4.8.0 → 4.9.0-beta-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/assets/{index-CvGLlWUJ.js → index-CnfDrmnZ.js} +55 -43
- package/dist/index.d.ts +9 -4
- package/dist/index.html +1 -1
- package/dist/index.js +180 -179
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-KGDBMAHA-BLtMCq8G.js → Color-KGDBMAHA-nHvSq78M.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-PKQXORMH-Cq_uPi34.js → DocsRenderer-PKQXORMH-C1krXrOf.js} +1 -1
- package/dist/storybook/assets/{accordion.stories-CNjaOE6j.js → accordion.stories-kLk1OtZZ.js} +2 -2
- package/dist/storybook/assets/{afe.stories-Be4Zi8Qk.js → afe.stories-DFQsvqIV.js} +2 -2
- package/dist/storybook/assets/{buttons-and-links-CGf2fkq-.js → buttons-and-links-DC-E4soa.js} +2 -2
- package/dist/storybook/assets/{casing-loads.stories-9Iu4v1Y5.js → casing-loads.stories-B2lND_PU.js} +2 -2
- package/dist/storybook/assets/{cell.stories-OWJtpzu1.js → cell.stories-BVDrv2SU.js} +2 -2
- package/dist/storybook/assets/{chunk-HLWAVYOI-DQmzN82L.js → chunk-HLWAVYOI-DX3eyNf5.js} +1 -1
- package/dist/storybook/assets/{color-CUmK6HaC.js → color-BgW0SkoL.js} +2 -2
- package/dist/storybook/assets/footer.stories-BVXSVjq1.js +3 -0
- package/dist/storybook/assets/form.stories-BrUnmw7R.js +49 -0
- package/dist/storybook/assets/{formation.stories-BwshNr5I.js → formation.stories-DmecxRaM.js} +2 -2
- package/dist/storybook/assets/iframe-DHWiHrZY.js +2 -0
- package/dist/storybook/assets/index-B7q2KU2k.js +1 -0
- package/dist/storybook/assets/{index-DLsIgQne.js → index-BRAKCNI8.js} +87 -87
- package/dist/storybook/assets/{index-DaLCDjg_.js → index-C0x1JmaP.js} +1 -1
- package/dist/storybook/assets/{input-group.stories-Bqx8op1f.js → input-group.stories-CElwRt3p.js} +2 -2
- package/dist/storybook/assets/{input-validation-CRDfoI4h.js → input-validation-CD_0XD31.js} +2 -2
- package/dist/storybook/assets/{inputs-D3qEs1Q4.js → inputs-DmKjdzn7.js} +2 -2
- package/dist/storybook/assets/{layout-forms-CDGrrwBl.js → layout-forms-BxdMnma9.js} +4 -4
- package/dist/storybook/assets/{layout-general-D9kS22a0.js → layout-general-DTuKIl0f.js} +1 -1
- package/dist/storybook/assets/{modal.stories-BcqAhYEy.js → modal.stories-LhoWfDE6.js} +2 -2
- package/dist/storybook/assets/number-input-DBZIl9dz.js +16 -0
- package/dist/storybook/assets/number-input.stories-BRQWeYF6.js +166 -0
- package/dist/storybook/assets/{padding-and-spacing-Cr5c7WxM.js → padding-and-spacing-pWMUN6u_.js} +1 -1
- package/dist/storybook/assets/{pagination-D6pYWeQM.js → pagination-CLt-kUlx.js} +1 -1
- package/dist/storybook/assets/{pagination.stories-ItfGvzb-.js → pagination.stories-CTRM0Xou.js} +2 -2
- package/dist/storybook/assets/popover.stories-CGm0M5fv.js +10 -0
- package/dist/storybook/assets/{preview-B_VD4s7b.js → preview-BCA8OXOK.js} +2 -2
- package/dist/storybook/assets/{preview-t_Zs3gQw.js → preview-Ddw3AHiS.js} +2 -2
- package/dist/storybook/assets/{projects.stories-Co_WnKSx.js → projects.stories-BQswWVCx.js} +2 -2
- package/dist/storybook/assets/{radio-button-C4ljBRED.js → radio-button-DmDuw4DA.js} +1 -1
- package/dist/storybook/assets/{radio-button.stories-BzyW2CtK.js → radio-button.stories-5gvV0LD0.js} +2 -2
- package/dist/storybook/assets/{reservoirs.stories-FQuUA3DK.js → reservoirs.stories-B12tIrmZ.js} +2 -2
- package/dist/storybook/assets/{rich-text-input.stories-CmFzKTb-.js → rich-text-input.stories-hAHCnDHk.js} +44 -44
- package/dist/storybook/assets/{row.stories-xvzQuDF0.js → row.stories-BO2s7oph.js} +2 -2
- package/dist/storybook/assets/{select-V2ZNp3Pv.js → select-DnRuRG_N.js} +2 -2
- package/dist/storybook/assets/select.input-D0UkAPd9.js +1 -0
- package/dist/storybook/assets/{select.stories-CV9h5z0E.js → select.stories-B9w9ONzj.js} +2 -2
- package/dist/storybook/assets/{site.stories-ZGohyW6Z.js → site.stories-umpPYjkq.js} +2 -2
- package/dist/storybook/assets/{smart-upload-modal.stories-BKNxg_3y.js → smart-upload-modal.stories-Dn7dIsu1.js} +1 -1
- package/dist/storybook/assets/{table-D9JJ68Tx.js → table-CB6btQu9.js} +1 -1
- package/dist/storybook/assets/{table.stories-f-cNU-ed.js → table.stories-CvHvaYMC.js} +2 -2
- package/dist/storybook/assets/{tabs-BoToLVEP.js → tabs-C3NG6m9W.js} +1 -1
- package/dist/storybook/assets/tabs.stories-dsXjRHJy.js +30 -0
- package/dist/storybook/assets/{title.stories-5TyZBiBD.js → title.stories-DYXG2_x-.js} +2 -2
- package/dist/storybook/assets/unit-input-5P4Cogho.css +1 -0
- package/dist/storybook/assets/unit-input.stories-DRP-nDdh.js +380 -0
- package/dist/storybook/assets/unit-table.stories-DiER-CMn.js +152 -0
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/sb-addons/interactions-2/manager-bundle.js +52 -52
- package/dist/storybook/sb-manager/globals-runtime.js +7164 -7166
- package/dist/storybook/sb-manager/runtime.js +1110 -1111
- package/dist/storybook/sb-preview/runtime.js +1485 -1483
- package/package.json +3 -3
- package/dist/404.html +0 -1
- package/dist/storybook/assets/footer.stories-CCaqnn-t.js +0 -3
- package/dist/storybook/assets/form.stories-CX1WxUVL.js +0 -49
- package/dist/storybook/assets/helpers-JJxzGegQ.js +0 -1
- package/dist/storybook/assets/iframe-aT7NCuic.js +0 -2
- package/dist/storybook/assets/index-CDuLcH5d.js +0 -1
- package/dist/storybook/assets/number-input-Ct8VwJX0.js +0 -16
- package/dist/storybook/assets/number-input.stories-lRKm6_tZ.js +0 -110
- package/dist/storybook/assets/popover.stories-B4sQDryP.js +0 -10
- package/dist/storybook/assets/select.input-CJed_LLR.js +0 -1
- package/dist/storybook/assets/tabs.stories-B52iEaHf.js +0 -30
- package/dist/storybook/assets/unit-input-CoFS2qhN.css +0 -1
- package/dist/storybook/assets/unit-input.stories-tjEyowge.js +0 -318
- package/dist/storybook/assets/unit-table.stories-BDYxeHSM.js +0 -152
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-eps93zm2.js";import{r as D}from"./index-DhsZuJvc.js";import{T as g}from"./table-
|
|
1
|
+
import{j as o}from"./jsx-runtime-eps93zm2.js";import{r as D}from"./index-DhsZuJvc.js";import{T as g}from"./table-CB6btQu9.js";import{T as z}from"./text-B3-TSWok.js";import{t as R,s as G,u as J,v as K,w as Q}from"./table.stories-data-D52aKMY1.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-CLt-kUlx.js";import"./select-DnRuRG_N.js";import"./assertThisInitialized-B9jnkVVz.js";import"./select.input-D0UkAPd9.js";import"./input-DTXbDJaL.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./number-input-DBZIl9dz.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 Ie={title:"Basic/Table/Row",component:g,args:{table:{...R}}},v=n=>o.jsx(g,{...n}),i=v.bind({});i.args={table:G};const p=v.bind({});p.args={table:J};const c=v.bind({});c.args={table:K};const d=v.bind({});d.args={table:Q};const t=v.bind({});t.args={table:{...R,striped:!1}};t.parameters={docs:{description:{story:"`striped: false` removes tinted background on alternative rows."}}};const u=()=>{const[n,e]=D.useState(null),a=r=>e(n===r?null:r);return o.jsx(g,{table:{...R,striped:!1,rows:R.rows.map((r,x)=>({...r,onRowClick:()=>a(x),expandedContent:{content:n===x?o.jsx("div",{children:"Example expanded content"}):null}}))}})},m=()=>{const n={draggable:!0,headers:[{cells:[{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"}]}],rows:[{noDrag:!0,cells:[{value:"Undraggable"},{value:100},{value:361},{value:"Vietnam"}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"}]}]},e=(s,b,l)=>{const y=[...s];return s[l].noDrag?s:(y.splice(l,0,y.splice(b,1)[0]),y)},[a,r]=D.useState(n.rows),x=s=>{const{to:b,from:l}=s;e(a,l,b),r(e(a,l,b))};return o.jsx(g,{table:{...n,rows:a},onListReorder:x})},w=()=>{const[n,e]=D.useState("Hover any row!"),a=[1,2,3,4,5].map(r=>({cells:[{value:`Row ${r}`},{value:`${r**2}`}],onRowMouseEnter:()=>e(`Hovering row ${r}`),onRowMouseLeave:()=>e("Not hovering any row...")}));return o.jsxs(o.Fragment,{children:[o.jsx(z,{children:n}),o.jsx(g,{table:{fixedWidth:"100%",headers:[{cells:[{value:"Description"},{value:"Value"}],onRowMouseEnter:()=>e("Hovering header row"),onRowMouseLeave:()=>e("Not hovering any row...")}],rows:a}})]})};u.__docgenInfo={description:"",methods:[],displayName:"Expandable"};m.__docgenInfo={description:"",methods:[],displayName:"DragAndDrop"};w.__docgenInfo={description:"",methods:[],displayName:"OnRowEnter"};var E,h,T;i.parameters={...i.parameters,docs:{...(E=i.parameters)==null?void 0:E.docs,source:{originalSource:`args => {
|
|
2
2
|
return <Table
|
|
3
3
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
4
|
{...args} />;
|
|
@@ -127,4 +127,4 @@ import{j as o}from"./jsx-runtime-eps93zm2.js";import{r as D}from"./index-DhsZuJv
|
|
|
127
127
|
rows
|
|
128
128
|
}} />
|
|
129
129
|
</>;
|
|
130
|
-
}`,...(q=(U=w.parameters)==null?void 0:U.docs)==null?void 0:q.source}}};const
|
|
130
|
+
}`,...(q=(U=w.parameters)==null?void 0:U.docs)==null?void 0:q.source}}};const Ve=["ActiveRow","ErrorRow","WarningRow","RowFocusEvent","NotStriped","Expandable","DragAndDrop","OnRowEnter"];export{i as ActiveRow,m as DragAndDrop,p as ErrorRow,u as Expandable,t as NotStriped,w as OnRowEnter,d as RowFocusEvent,c as WarningRow,Ve as __namedExportsOrder,Ie as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as p}from"./jsx-runtime-eps93zm2.js";import{l as ae}from"./lodash-c4VUpsOs.js";import{r as N,g as We}from"./index-DhsZuJvc.js";import{c as G}from"./index-Bk2sglWO.js";import{G as ie,I as Ie}from"./common-types-Sih75Sav.js";import{D as me}from"./disabled-context-rmpd7YJS.js";import{i as ne}from"./types-Dx2TtIG9.js";import{T as pe,u as Ue,m as Ge}from"./tooltip-1V7clEnw.js";import{p as $e}from"./index-CEuq6vkz.js";import{a as Ve,_ as Ke}from"./inheritsLoose-DP0QEDDI.js";import{_ as ge}from"./assertThisInitialized-B9jnkVVz.js";import{m as le}from"./memoize-one.esm-CcMeOnPo.js";import{M as se}from"./types-BmbYqTX_.js";import{T as ue}from"./text-B3-TSWok.js";import{A as Ye}from"./actions-D-uVCDzk.js";import{I as ce}from"./icon-BSFY3vDO.js";import{s as Be}from"./select.input-
|
|
1
|
+
import{j as p}from"./jsx-runtime-eps93zm2.js";import{l as ae}from"./lodash-c4VUpsOs.js";import{r as N,g as We}from"./index-DhsZuJvc.js";import{c as G}from"./index-Bk2sglWO.js";import{G as ie,I as Ie}from"./common-types-Sih75Sav.js";import{D as me}from"./disabled-context-rmpd7YJS.js";import{i as ne}from"./types-Dx2TtIG9.js";import{T as pe,u as Ue,m as Ge}from"./tooltip-1V7clEnw.js";import{p as $e}from"./index-CEuq6vkz.js";import{a as Ve,_ as Ke}from"./inheritsLoose-DP0QEDDI.js";import{_ as ge}from"./assertThisInitialized-B9jnkVVz.js";import{m as le}from"./memoize-one.esm-CcMeOnPo.js";import{M as se}from"./types-BmbYqTX_.js";import{T as ue}from"./text-B3-TSWok.js";import{A as Ye}from"./actions-D-uVCDzk.js";import{I as ce}from"./icon-BSFY3vDO.js";import{s as Be}from"./select.input-D0UkAPd9.js";const Ze="_inputInTable_1nzfr_1",Xe="_error_1nzfr_7",Je="_warning_1nzfr_7",Qe="_inputHover_1nzfr_13",en="_inputFocus_1nzfr_18",nn="_inputError_1nzfr_25",tn="_inputWarning_1nzfr_26",rn="_inputDisabled_1nzfr_61",an="_hideScrollbars_1nzfr_67",sn="_select_1nzfr_77",ln="_isInTable_1nzfr_121",on="_unSelected_1nzfr_133",un="_small_1nzfr_174",cn="_right_1nzfr_182",dn="_groupOrderFirst_1nzfr_193",mn="_groupOrderMiddle_1nzfr_194",pn="_groupOrderLast_1nzfr_198",W={inputInTable:Ze,error:Xe,warning:Je,inputHover:Qe,inputFocus:en,inputError:nn,inputWarning:tn,inputDisabled:rn,hideScrollbars:an,select:sn,isInTable:ln,unSelected:on,small:un,right:cn,groupOrderFirst:dn,groupOrderMiddle:mn,groupOrderLast:pn},Oe=({disabled:e=!1,error:n=null,warning:a=null,tooltip:d=null,options:c,onChange:v=ae.noop,onFocus:f=ae.noop,onBlur:s=ae.noop,right:o=!1,small:g=!1,tabIndex:S=0,selectedOption:b,width:T=null,groupOrder:E=null,testId:_,isInTable:t=!1,clearable:l,placeholder:i,hasNonExistentValue:r,maxTooltipWidth:u,borderRadius:m})=>{const y=N.useContext(me),h=b===null||(b==null?void 0:b.value)===null?"unselected":b==null?void 0:b.value,I=h==="unselected",L=(h==="unselected"||l?[p.jsx("option",{value:"unselected",disabled:!l,hidden:!l,children:i||"Select..."},"unselected")]:[]).concat(r?[p.jsx("option",{value:b==null?void 0:b.value,disabled:e||y,children:b==null?void 0:b.label},"selectedNonExistentValue")]:[]).concat(c.map((x,w)=>p.jsx("option",{value:x.value,"data-testid":x.testId,children:x.label},w))),R=(()=>{if(E)switch(E){case ie.FIRST:return W.groupOrderFirst;case ie.LAST:return W.groupOrderLast;default:return W.groupOrderMiddle}return""})();return p.jsx(pe,{error:!!n,warning:!!a,text:d||n||a,enabled:d&&ne(d)||n&&ne(n)||a&&ne(a)||!1,maxWidth:u,placement:"bottom-center",children:p.jsx("select",{className:G(W.select,I?W.unSelected:"",n?W.error:a?W.warning:"",o?W.right:"",g?W.small:"",t?W.isInTable:"",R),style:{width:T||"",borderRadius:m||""},onChange:x=>{const{value:w}=x.target;let q;w==="unselected"?q={value:null}:q=c.find(A=>String(A.value)===String(w))||{value:null},v(x,q)},onFocus:f,onBlur:s,tabIndex:S,value:h,disabled:e||y,"data-testid":_,children:L})})};Oe.__docgenInfo={description:"",methods:[],displayName:"NativeSelect",props:{borderRadius:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},disabled:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},error:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | React.ReactNode | null",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactReactNode",raw:"React.ReactNode"},{name:"null"}]},description:"",defaultValue:{value:"null",computed:!1}},warning:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | React.ReactNode | null",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactReactNode",raw:"React.ReactNode"},{name:"null"}]},description:"",defaultValue:{value:"null",computed:!1}},tooltip:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | React.ReactNode | null",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactReactNode",raw:"React.ReactNode"},{name:"null"}]},description:"",defaultValue:{value:"null",computed:!1}},options:{required:!0,tsType:{name:"Array",elements:[{name:"ISelectSelectedOption"}],raw:"ISelectSelectedOption[]"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:`(
|
|
2
2
|
evt: ChangeEvent<HTMLSelectElement>,
|
|
3
3
|
value: ISelectSelectedOption | { value: null },
|
|
4
4
|
) => void`,signature:{arguments:[{type:{name:"ChangeEvent",elements:[{name:"HTMLSelectElement"}],raw:"ChangeEvent<HTMLSelectElement>"},name:"evt"},{type:{name:"union",raw:"ISelectSelectedOption | { value: null }",elements:[{name:"ISelectSelectedOption"},{name:"signature",type:"object",raw:"{ value: null }",signature:{properties:[{key:"value",value:{name:"null",required:!0}}]}}]},name:"value"}],return:{name:"void"}}},description:"",defaultValue:{value:"noop",computed:!0}},onFocus:{required:!1,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:"",defaultValue:{value:"noop",computed:!0}},onBlur:{required:!1,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:"",defaultValue:{value:"noop",computed:!0}},right:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},small:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},tabIndex:{required:!1,tsType:{name:"number"},description:"",defaultValue:{value:"0",computed:!1}},selectedOption:{required:!1,tsType:{name:"ISelectSelectedOption"},description:""},width:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | null",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"null"}]},description:"",defaultValue:{value:"null",computed:!1}},groupOrder:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:"",defaultValue:{value:"null",computed:!1}},testId:{required:!1,tsType:{name:"union",raw:"string | undefined",elements:[{name:"string"},{name:"undefined"}]},description:""},isInTable:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},clearable:{required:!1,tsType:{name:"boolean"},description:""},placeholder:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""},hasNonExistentValue:{required:!1,tsType:{name:"boolean"},description:""},maxTooltipWidth:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""}}};var we={exports:{}};(function(e,n){(function(a,d){e.exports=d(N,$e)})(window,function(a,d){return function(c){var v={};function f(s){if(v[s])return v[s].exports;var o=v[s]={i:s,l:!1,exports:{}};return c[s].call(o.exports,o,o.exports,f),o.l=!0,o.exports}return f.m=c,f.c=v,f.d=function(s,o,g){f.o(s,o)||Object.defineProperty(s,o,{enumerable:!0,get:g})},f.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},f.t=function(s,o){if(1&o&&(s=f(s)),8&o||4&o&&typeof s=="object"&&s&&s.__esModule)return s;var g=Object.create(null);if(f.r(g),Object.defineProperty(g,"default",{enumerable:!0,value:s}),2&o&&typeof s!="string")for(var S in s)f.d(g,S,(function(b){return s[b]}).bind(null,S));return g},f.n=function(s){var o=s&&s.__esModule?function(){return s.default}:function(){return s};return f.d(o,"a",o),o},f.o=function(s,o){return Object.prototype.hasOwnProperty.call(s,o)},f.p="",f(f.s=0)}([function(c,v,f){Object.defineProperty(v,"__esModule",{value:!0});var s=f(1);Object.defineProperty(v,"default",{enumerable:!0,get:function(){return function(o){return o&&o.__esModule?o:{default:o}}(s).default}}),c.exports=v.default},function(c,v,f){Object.defineProperty(v,"__esModule",{value:!0});var s=Object.assign||function(t){for(var l=1;l<arguments.length;l++){var i=arguments[l];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},o=function(){function t(l,i){for(var r=0;r<i.length;r++){var u=i[r];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(l,u.key,u)}}return function(l,i,r){return i&&t(l.prototype,i),r&&t(l,r),l}}(),g=T(f(2)),S=T(f(3)),b=f(4);function T(t){return t&&t.__esModule?t:{default:t}}var E=[],_=function(t){function l(i){(function(u,m){if(!(u instanceof m))throw new TypeError("Cannot call a class as a function")})(this,l);var r=function(u,m){if(!u)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!m||typeof m!="object"&&typeof m!="function"?u:m}(this,(l.__proto__||Object.getPrototypeOf(l)).call(this,i));return r.handleKeyboardEvent=r.handleKeyboardEvent.bind(r),r.registerExclusiveHandler=r.registerExclusiveHandler.bind(r),r.deregisterExclusiveHandler=r.deregisterExclusiveHandler.bind(r),r}return function(i,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof r);i.prototype=Object.create(r&&r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(i,r):i.__proto__=r)}(l,g.default.Component),o(l,[{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyboardEvent,!1),document.addEventListener("keyup",this.handleKeyboardEvent,!1),document.addEventListener("keypress",this.handleKeyboardEvent,!1);var i=this.props,r=i.isExclusive,u=i.isDisabled;r&&!u&&this.registerExclusiveHandler()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyboardEvent,!1),document.removeEventListener("keyup",this.handleKeyboardEvent,!1),document.removeEventListener("keypress",this.handleKeyboardEvent,!1),this.deregisterExclusiveHandler()}},{key:"componentDidUpdate",value:function(i){var r=i.isExclusive,u=i.isDisabled;(this.props.isExclusive!==r||this.props.isDisabled!==u)&&(this.props.isExclusive&&!this.props.isDisabled?this.registerExclusiveHandler():this.deregisterExclusiveHandler())}},{key:"registerExclusiveHandler",value:function(){this.deregisterExclusiveHandler(),E.unshift(this)}},{key:"deregisterExclusiveHandler",value:function(){var i=this;E.includes(this)&&(E=E.filter(function(r){return r!==i}))}},{key:"handleKeyboardEvent",value:function(i){var r=this.props,u=r.isDisabled,m=r.handleKeys,y=r.onKeyEvent,h=r.handleEventType,I=r.children,L=r.handleFocusableElements;if(u||h!==i.type||E.length>0&&E[0]!==this)return!1;var R=i.target===document.body||L,x=this.childrenContainer&&this.childrenContainer.contains(i.target);if(!(I?x:R))return!1;var w=(0,b.findMatchedKey)(i,m);return!!w&&(y(w,i),!0)}},{key:"render",value:function(){var i=this,r=this.props.children,u=Object.assign({},this.props),m=!0,y=!1,h=void 0;try{for(var I,L=Object.keys(l.propTypes)[Symbol.iterator]();!(m=(I=L.next()).done);m=!0)delete u[I.value]}catch(R){y=!0,h=R}finally{try{!m&&L.return&&L.return()}finally{if(y)throw h}}return r?g.default.createElement("span",s({ref:function(R){i.childrenContainer=R}},u),r):null}}]),l}();v.default=_,_.propTypes={handleKeys:S.default.array,handleEventType:S.default.oneOf(["keydown","keyup","keypress"]),handleFocusableElements:S.default.bool,onKeyEvent:S.default.func,isDisabled:S.default.bool,isExclusive:S.default.bool,children:S.default.any},_.defaultProps={handleKeys:[],handleFocusableElements:!1,handleEventType:"keydown",onKeyEvent:function(){return null}},c.exports=v.default},function(c,v){c.exports=a},function(c,v){c.exports=d},function(c,v,f){function s(r,u,m){return u in r?Object.defineProperty(r,u,{value:m,enumerable:!0,configurable:!0,writable:!0}):r[u]=m,r}Object.defineProperty(v,"__esModule",{value:!0}),v.matchKeyEvent=i,v.findMatchedKey=function(r,u){var m=u.map(function(y){var h=y.toLowerCase(),I=l[h];return I||[y]}).reduce(function(y,h){return y.concat(h)},[]).find(function(y){return i(r,y)});return!m&&u.includes("all")&&(m="other"),m};var o={backspace:[8],del:[46],delete:[46],ins:[45],insert:[45],tab:[9],enter:[13],return:[13],esc:[27],space:[32],pageup:[33],pagedown:[34],end:[35],home:[36],left:[37],up:[38],right:[39],down:[40],shift:[16],ctrl:[17],alt:[18],cap:[20],num:[144],clear:[12],meta:[91],";":[186,59],"=":[187,61],",":[188,44],"-":[189,45,173,109],minus:[189,45,173,109],".":[190,110],"/":[191,111],"`":[192],"[":[219],"\\":[220],"]":[221],"*":[106],"+":[107],plus:[107],"'":[222],quote:[222]},g=Object.keys(o).reduce(function(r,u){return Object.assign(r,s({},u.toUpperCase(),o[u]))},{}),S="0123456789".split("").reduce(function(r,u,m){return Object.assign(r,s({},u,[m+48,m+96]))},{}),b="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").reduce(function(r,u,m){return Object.assign(r,s({},u.toLowerCase(),[m+65]),s({},u,[m+65]))},{}),T="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19".split(",").reduce(function(r,u,m){return Object.assign(r,s({},"f"+u,[m+112]))},{}),E={control:"ctrl",ctrl:"ctrl",shift:"shift",meta:"meta",cmd:"meta",command:"meta",option:"alt",alt:"alt"},_=v.AllKeys=Object.assign({},o,g,S,b,T),t=Object.assign({},S,b),l={all:Object.keys(_),alphanumeric:Object.keys(t),numeric:Object.keys(S),alphabetic:Object.keys(b),function:Object.keys(T)};function i(r,u){var m=r.which||r.keyCode,y=r.type,h=Object.keys(E).filter(function(A){return r[A+"Key"]}).sort(),I=u.toLowerCase().trim(),L=I==="+"?["+"]:I.split(/\s?\+\s?/),R=L.pop(),x=_[R],w=L;if(y==="keypress")return u==String.fromCharCode(m).toLowerCase();if(w.length===0&&h.length===0)return x.indexOf(m)>=0;if(w.length>0&&h.length>0){var q=w.map(function(A){return E[A]}).sort(),F=q.length===h.length&&q.every(function(A,H){return h[H]===A});return x.indexOf(m)>=0&&F}return w.length==0&&h.length===1&&R===h[0]}}])})})(we);var fn=we.exports;const gn=We(fn),Re=()=>{const e=N.useRef(null);return[e,()=>{e.current&&e.current.focus()}]},Le=()=>{const[e,n]=N.useState(!1);return N.useEffect(()=>{(async()=>{document.fonts&&await document.fonts.ready.then(()=>n(!0))})()},[]),e};var vn=typeof performance=="object"&&typeof performance.now=="function",ve=vn?function(){return performance.now()}:function(){return Date.now()};function ye(e){cancelAnimationFrame(e.id)}function yn(e,n){var a=ve();function d(){ve()-a>=n?e.call(null):c.id=requestAnimationFrame(d)}var c={id:requestAnimationFrame(d)};return c}var oe=-1;function he(e){if(e===void 0&&(e=!1),oe===-1||e){var n=document.createElement("div"),a=n.style;a.width="50px",a.height="50px",a.overflow="scroll",document.body.appendChild(n),oe=n.offsetWidth-n.clientWidth,document.body.removeChild(n)}return oe}var ee=null;function be(e){if(e===void 0&&(e=!1),ee===null||e){var n=document.createElement("div"),a=n.style;a.width="50px",a.height="50px",a.overflow="scroll",a.direction="rtl";var d=document.createElement("div"),c=d.style;return c.width="100px",c.height="100px",n.appendChild(d),document.body.appendChild(n),n.scrollLeft>0?ee="positive-descending":(n.scrollLeft=1,n.scrollLeft===0?ee="negative":ee="positive-ascending"),document.body.removeChild(n),ee}return ee}var hn=150,bn=function(n,a){return n};function Sn(e){var n,a=e.getItemOffset,d=e.getEstimatedTotalSize,c=e.getItemSize,v=e.getOffsetForIndexAndAlignment,f=e.getStartIndexForOffset,s=e.getStopIndexForStartIndex,o=e.initInstanceProps,g=e.shouldResetStyleCacheOnItemSizeChange,S=e.validateProps;return n=function(b){Ve(T,b);function T(_){var t;return t=b.call(this,_)||this,t._instanceProps=o(t.props,ge(t)),t._outerRef=void 0,t._resetIsScrollingTimeoutId=null,t.state={instance:ge(t),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof t.props.initialScrollOffset=="number"?t.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},t._callOnItemsRendered=void 0,t._callOnItemsRendered=le(function(l,i,r,u){return t.props.onItemsRendered({overscanStartIndex:l,overscanStopIndex:i,visibleStartIndex:r,visibleStopIndex:u})}),t._callOnScroll=void 0,t._callOnScroll=le(function(l,i,r){return t.props.onScroll({scrollDirection:l,scrollOffset:i,scrollUpdateWasRequested:r})}),t._getItemStyle=void 0,t._getItemStyle=function(l){var i=t.props,r=i.direction,u=i.itemSize,m=i.layout,y=t._getItemStyleCache(g&&u,g&&m,g&&r),h;if(y.hasOwnProperty(l))h=y[l];else{var I=a(t.props,l,t._instanceProps),L=c(t.props,l,t._instanceProps),R=r==="horizontal"||m==="horizontal",x=r==="rtl",w=R?I:0;y[l]=h={position:"absolute",left:x?void 0:w,right:x?w:void 0,top:R?0:I,height:R?"100%":L,width:R?L:"100%"}}return h},t._getItemStyleCache=void 0,t._getItemStyleCache=le(function(l,i,r){return{}}),t._onScrollHorizontal=function(l){var i=l.currentTarget,r=i.clientWidth,u=i.scrollLeft,m=i.scrollWidth;t.setState(function(y){if(y.scrollOffset===u)return null;var h=t.props.direction,I=u;if(h==="rtl")switch(be()){case"negative":I=-u;break;case"positive-descending":I=m-r-u;break}return I=Math.max(0,Math.min(I,m-r)),{isScrolling:!0,scrollDirection:y.scrollOffset<I?"forward":"backward",scrollOffset:I,scrollUpdateWasRequested:!1}},t._resetIsScrollingDebounced)},t._onScrollVertical=function(l){var i=l.currentTarget,r=i.clientHeight,u=i.scrollHeight,m=i.scrollTop;t.setState(function(y){if(y.scrollOffset===m)return null;var h=Math.max(0,Math.min(m,u-r));return{isScrolling:!0,scrollDirection:y.scrollOffset<h?"forward":"backward",scrollOffset:h,scrollUpdateWasRequested:!1}},t._resetIsScrollingDebounced)},t._outerRefSetter=function(l){var i=t.props.outerRef;t._outerRef=l,typeof i=="function"?i(l):i!=null&&typeof i=="object"&&i.hasOwnProperty("current")&&(i.current=l)},t._resetIsScrollingDebounced=function(){t._resetIsScrollingTimeoutId!==null&&ye(t._resetIsScrollingTimeoutId),t._resetIsScrollingTimeoutId=yn(t._resetIsScrolling,hn)},t._resetIsScrolling=function(){t._resetIsScrollingTimeoutId=null,t.setState({isScrolling:!1},function(){t._getItemStyleCache(-1,null)})},t}T.getDerivedStateFromProps=function(t,l){return _n(t,l),S(t),null};var E=T.prototype;return E.scrollTo=function(t){t=Math.max(0,t),this.setState(function(l){return l.scrollOffset===t?null:{scrollDirection:l.scrollOffset<t?"forward":"backward",scrollOffset:t,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},E.scrollToItem=function(t,l){l===void 0&&(l="auto");var i=this.props,r=i.itemCount,u=i.layout,m=this.state.scrollOffset;t=Math.max(0,Math.min(t,r-1));var y=0;if(this._outerRef){var h=this._outerRef;u==="vertical"?y=h.scrollWidth>h.clientWidth?he():0:y=h.scrollHeight>h.clientHeight?he():0}this.scrollTo(v(this.props,t,l,m,this._instanceProps,y))},E.componentDidMount=function(){var t=this.props,l=t.direction,i=t.initialScrollOffset,r=t.layout;if(typeof i=="number"&&this._outerRef!=null){var u=this._outerRef;l==="horizontal"||r==="horizontal"?u.scrollLeft=i:u.scrollTop=i}this._callPropsCallbacks()},E.componentDidUpdate=function(){var t=this.props,l=t.direction,i=t.layout,r=this.state,u=r.scrollOffset,m=r.scrollUpdateWasRequested;if(m&&this._outerRef!=null){var y=this._outerRef;if(l==="horizontal"||i==="horizontal")if(l==="rtl")switch(be()){case"negative":y.scrollLeft=-u;break;case"positive-ascending":y.scrollLeft=u;break;default:var h=y.clientWidth,I=y.scrollWidth;y.scrollLeft=I-h-u;break}else y.scrollLeft=u;else y.scrollTop=u}this._callPropsCallbacks()},E.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&ye(this._resetIsScrollingTimeoutId)},E.render=function(){var t=this.props,l=t.children,i=t.className,r=t.direction,u=t.height,m=t.innerRef,y=t.innerElementType,h=t.innerTagName,I=t.itemCount,L=t.itemData,R=t.itemKey,x=R===void 0?bn:R,w=t.layout,q=t.outerElementType,F=t.outerTagName,A=t.style,H=t.useIsScrolling,K=t.width,$=this.state.isScrolling,k=r==="horizontal"||w==="horizontal",P=k?this._onScrollHorizontal:this._onScrollVertical,Z=this._getRangeToRender(),te=Z[0],re=Z[1],X=[];if(I>0)for(var z=te;z<=re;z++)X.push(N.createElement(l,{data:L,key:x(z,L),index:z,isScrolling:H?$:void 0,style:this._getItemStyle(z)}));var J=d(this.props,this._instanceProps);return N.createElement(q||F||"div",{className:i,onScroll:P,ref:this._outerRefSetter,style:Ke({position:"relative",height:u,width:K,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:r},A)},N.createElement(y||h||"div",{children:X,ref:m,style:{height:k?"100%":J,pointerEvents:$?"none":void 0,width:k?J:"100%"}}))},E._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var t=this.props.itemCount;if(t>0){var l=this._getRangeToRender(),i=l[0],r=l[1],u=l[2],m=l[3];this._callOnItemsRendered(i,r,u,m)}}if(typeof this.props.onScroll=="function"){var y=this.state,h=y.scrollDirection,I=y.scrollOffset,L=y.scrollUpdateWasRequested;this._callOnScroll(h,I,L)}},E._getRangeToRender=function(){var t=this.props,l=t.itemCount,i=t.overscanCount,r=this.state,u=r.isScrolling,m=r.scrollDirection,y=r.scrollOffset;if(l===0)return[0,0,0,0];var h=f(this.props,y,this._instanceProps),I=s(this.props,h,y,this._instanceProps),L=!u||m==="backward"?Math.max(1,i):1,R=!u||m==="forward"?Math.max(1,i):1;return[Math.max(0,h-L),Math.max(0,Math.min(l-1,I+R)),h,I]},T}(N.PureComponent),n.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},n}var _n=function(n,a){n.children,n.direction,n.height,n.layout,n.innerTagName,n.outerTagName,n.width,a.instance},Tn=Sn({getItemOffset:function(n,a){var d=n.itemSize;return a*d},getItemSize:function(n,a){var d=n.itemSize;return d},getEstimatedTotalSize:function(n){var a=n.itemCount,d=n.itemSize;return d*a},getOffsetForIndexAndAlignment:function(n,a,d,c,v,f){var s=n.direction,o=n.height,g=n.itemCount,S=n.itemSize,b=n.layout,T=n.width,E=s==="horizontal"||b==="horizontal",_=E?T:o,t=Math.max(0,g*S-_),l=Math.min(t,a*S),i=Math.max(0,a*S-_+S+f);switch(d==="smart"&&(c>=i-_&&c<=l+_?d="auto":d="center"),d){case"start":return l;case"end":return i;case"center":{var r=Math.round(i+(l-i)/2);return r<Math.ceil(_/2)?0:r>t+Math.floor(_/2)?t:r}case"auto":default:return c>=i&&c<=l?c:c<i?i:l}},getStartIndexForOffset:function(n,a){var d=n.itemCount,c=n.itemSize;return Math.max(0,Math.min(d-1,Math.floor(a/c)))},getStopIndexForStartIndex:function(n,a,d){var c=n.direction,v=n.height,f=n.itemCount,s=n.itemSize,o=n.layout,g=n.width,S=c==="horizontal"||o==="horizontal",b=a*s,T=S?g:v,E=Math.ceil((T+d-b)/s);return Math.max(0,Math.min(f-1,a+E-1))},initInstanceProps:function(n){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(n){n.itemSize}});const En="_layerContainer_1lbvo_1",In="_layer_1lbvo_1",On="_small_1lbvo_23",wn="_heading_1lbvo_26",Rn="_option_1lbvo_27",Ln="_message_1lbvo_28",xn="_focused_1lbvo_64",Cn="_selected_1lbvo_68",qn="_disabled_1lbvo_71",Mn="_check_1lbvo_75",Nn="_optionContent_1lbvo_92",Fn="_label_1lbvo_97",An="_icon_1lbvo_104",jn="_details_1lbvo_109",j={layerContainer:En,layer:In,small:On,heading:wn,option:Rn,message:Ln,focused:xn,selected:Cn,disabled:qn,check:Mn,optionContent:Nn,label:Fn,icon:An,details:jn},xe=({label:e})=>p.jsx("div",{onClick:n=>n.stopPropagation(),className:j.heading,children:e});xe.__docgenInfo={description:"",methods:[],displayName:"Heading",props:{label:{required:!0,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""}}};const Ce=({details:e,label:n,icon:a,disabled:d=!1,selected:c=!1,focused:v=!1,onSelectOption:f,actions:s,closeLayer:o,testId:g})=>p.jsxs("div",{className:G(j.option,d?j.disabled:"",c?j.selected:"",v?j.focused:""),onClick:!d&&f?f:void 0,"data-testid":g,children:[p.jsx("div",{className:j.optionContent,children:p.jsxs("span",{className:j.label,title:n,children:[n,a&&p.jsx("span",{className:j.icon,children:a})]})}),e&&p.jsx("div",{className:G(j.details),children:p.jsx(ue,{faint:!0,children:e})}),!!(s!=null&&s.length)&&p.jsx("div",{className:G(j.actions),children:p.jsx(Ye,{actions:s,closeLayer:o})}),p.jsx("span",{className:j.check,children:c?p.jsx(ce,{icon:Ie.CHECK}):null})]});Ce.__docgenInfo={description:"",methods:[],displayName:"Option",props:{details:{required:!1,tsType:{name:"string"},description:""},label:{required:!0,tsType:{name:"string"},description:""},icon:{required:!1,tsType:{name:"ReactNode"},description:""},disabled:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},selected:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},focused:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},onSelectOption:{required:!1,tsType:{name:"signature",type:"function",raw:`(
|
|
@@ -58,4 +58,4 @@ import{j as p}from"./jsx-runtime-eps93zm2.js";import{l as ae}from"./lodash-c4VUp
|
|
|
58
58
|
| T
|
|
59
59
|
| { name: string; value: any; label?: string; files?: FileList | null };
|
|
60
60
|
}`,signature:{properties:[{key:"target",value:{name:"union",raw:`| T
|
|
61
|
-
| { 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:"event"},{type:{name:"Array",elements:[{name:"signature",type:"object",raw:"{ [key: string]: any }",signature:{properties:[{key:{name:"string"},value:{name:"any",required:!0}}]}}],raw:"{ [key: string]: any }[]"},name:"additionalProps",rest:!0}],return:{name:"void"}}},description:""},deprecatedEventHandler:{required:!1,tsType:{name:"boolean"},description:""},autoScroll:{required:!1,tsType:{name:"boolean"},description:""},warning:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:""},error:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:""},checkNonExistentValues:{required:!1,tsType:{name:"boolean"},description:""},closeOnOptionActionClick:{required:!1,tsType:{name:"boolean"},description:""},small:{required:!1,tsType:{name:"boolean"},description:""},width:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | null",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"null"}]},description:""},borderRadius:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},onCreate:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: any) => any",signature:{arguments:[{type:{name:"any"},name:"evt"}],return:{name:"any"}}},description:""},disabled:{required:!1,tsType:{name:"boolean"},description:""},placeholder:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""},isInTable:{required:!1,tsType:{name:"boolean"},description:""},clearable:{required:!1,tsType:{name:"boolean"},description:""},searchable:{required:!1,tsType:{name:"boolean"},description:""},maxTooltipWidth:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},autoLayerWidth:{required:!1,tsType:{name:"boolean"},description:""},right:{required:!1,tsType:{name:"boolean"},description:""},tabIndex:{required:!1,tsType:{name:"number"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};export{Mt as S};
|
|
61
|
+
| { 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:"event"},{type:{name:"Array",elements:[{name:"signature",type:"object",raw:"{ [key: string]: any }",signature:{properties:[{key:{name:"string"},value:{name:"any",required:!0}}]}}],raw:"{ [key: string]: any }[]"},name:"additionalProps",rest:!0}],return:{name:"void"}}},description:""},deprecatedEventHandler:{required:!1,tsType:{name:"boolean"},description:""},autoScroll:{required:!1,tsType:{name:"boolean"},description:""},warning:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:""},error:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | ReactNode",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"ReactNode"}]},description:""},checkNonExistentValues:{required:!1,tsType:{name:"boolean"},description:""},closeOnOptionActionClick:{required:!1,tsType:{name:"boolean"},description:""},small:{required:!1,tsType:{name:"boolean"},description:""},width:{required:!1,tsType:{name:"union",raw:"TStringOrNumber | null",elements:[{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},{name:"null"}]},description:""},borderRadius:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},onCreate:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: any) => any",signature:{arguments:[{type:{name:"any"},name:"evt"}],return:{name:"any"}}},description:""},disabled:{required:!1,tsType:{name:"boolean"},description:""},placeholder:{required:!1,tsType:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},description:""},isInTable:{required:!1,tsType:{name:"boolean"},description:""},clearable:{required:!1,tsType:{name:"boolean"},description:""},searchable:{required:!1,tsType:{name:"boolean"},description:""},maxTooltipWidth:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},autoLayerWidth:{required:!1,tsType:{name:"boolean"},description:""},right:{required:!1,tsType:{name:"boolean"},description:""},tabIndex:{required:!1,tsType:{name:"number"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};export{V as E,gn as K,Mt as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{M as y}from"./types-BmbYqTX_.js";const c=r=>r==null||r==="",o=r=>r instanceof Array,v=(r,n)=>n&&Array.isArray(r)?r.map(t=>typeof t=="string"||typeof t=="number"?{label:t,value:t}:t):r,f=(r,n)=>{if(n!==null&&typeof n=="object"&&n.hasOwnProperty("label")&&n.hasOwnProperty("value"))return n;{const t=n!==null&&typeof n=="object"&&n.hasOwnProperty("value")?n.value:n;return(Array.isArray(r)?r.filter(e=>e.type!==y.HEADING).find(e=>e.value==t):void 0)||(c(t)?void 0:{value:t,label:t})}},p=(r,n)=>o(n)?n.map(u=>f(r,u)).filter(u=>u!==void 0):n===null?void 0:f(r,n),A=r=>Array.isArray(r)&&r.some(n=>typeof n=="string"||typeof n=="number"),b=(r,n)=>{const t=n instanceof Array?n.length?n[0]:null:n,u=t==null?null:typeof t=="string"||typeof t=="number"?t:t.value,e=r.filter(l=>l.type!==y.HEADING).findIndex(l=>typeof l=="string"||typeof l=="number"?l==u:l.value==u);return e===-1?null:e},S=(r,n)=>!(o(n)?n:c(n)?[]:[n]).every(e=>r.find(a=>a.value===e.value)!==void 0),I=(r,n,t,u)=>{const e=Array.isArray(r)?r:[],l=o(n),a=A(e),s=v(e,a),d=t?b(e,n):null,i=p(s,n),m=u&&i!==void 0?S(s,i):!1;return{options:s,selectedOptions:i,multi:l,simpleInputs:a,firstSelectedOptionIndex:d,hasNonExistentValue:m}};export{c as i,I as s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as d}from"./jsx-runtime-eps93zm2.js";import{r as b}from"./index-DhsZuJvc.js";import{w as i,e as o,u as c}from"./index-DMAnyMX5.js";import{S as z}from"./select-
|
|
1
|
+
import{j as d}from"./jsx-runtime-eps93zm2.js";import{r as b}from"./index-DhsZuJvc.js";import{w as i,e as o,u as c}from"./index-DMAnyMX5.js";import{S as z}from"./select-DnRuRG_N.js";import{S as qa}from"./spacer-BWoNR27H.js";import{I as Z}from"./common-types-Sih75Sav.js";import{I as $}from"./icon-BSFY3vDO.js";import"./index-CF7H4eMJ.js";import"./lodash-c4VUpsOs.js";import"./index-Bk2sglWO.js";import"./disabled-context-rmpd7YJS.js";import"./types-Dx2TtIG9.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./index-CEuq6vkz.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-D-uVCDzk.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./badge-CLQ59MDF.js";import"./select.input-D0UkAPd9.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";const _a=[{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Koalas",value:"leaves"},{label:"Monkeys",value:"bananas",disabled:!0},{label:"Wombats",value:"bark"}],Fa=[{label:"Kangaroos",value:"grass",details:"(grass)"},{label:"Monkeys",value:"bananas",details:"(bananas)"},{label:"Possums",value:"slugs",details:"(slugs)"}],Ga=[{type:"Heading",label:"Large"},{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Monkeys",value:"bananas"},{type:"Heading",label:"Small"},{label:"Possums",value:"slugs"}],Ya=[{label:1,value:1},{label:2,value:2},{label:3,value:3},{label:4,value:4}],Za=[{label:"Yes",value:!0},{label:"No",value:!1}],$a=[{label:"Aardvarks",value:"termites"},{label:"Monkeys",value:"bananas"},{label:"Vampires",value:"blood",icon:d.jsx($,{icon:Z.WARNING,color:"var(--color-text-warning)"})},{label:"Zombies",value:"brains",icon:d.jsx($,{icon:Z.ERROR,color:"var(--color-text-error)"})}],y=[{label:"Delete",icon:"delete",onClick:()=>{}},{label:"Rename",icon:"rename",onClick:()=>{}}],za=[{label:"Kangaroos",value:"grass",actions:y},{label:"Monkeys",value:"bananas",actions:y},{label:"Possums",value:"slugs",actions:y,details:"(some details)"}],Ja=[{label:"Kangaroos",value:"grass",actions:y,icon:d.jsx($,{icon:Z.WARNING,color:"var(--color-text-warning)"}),details:"(grass)"},{label:"Monkeys",value:"bananas",actions:y,icon:d.jsx($,{icon:Z.WARNING,color:"var(--color-text-warning)"}),details:"(bananas)"},{label:"Possums",value:"slugs",actions:y,icon:d.jsx($,{icon:Z.WARNING,color:"var(--color-text-warning)"}),details:"(slugs)"}],Qa=[...Array(1e4).keys()].map((t,l)=>({label:Math.random().toString(36).substring(7),value:l})),Ua=["Aardvarks","Kangaroos","Monkeys","Possums"],Tn={title:"Forms/Select",component:z,args:{options:_a,native:!1,multi:!1,disabled:!1,autoLayerWidth:!1,clearable:!1,searchable:!0,right:!1}},a=t=>{const{multi:l,value:e}=t,[s,n]=b.useState(e||(l?[]:void 0)),u=r=>{const{value:g}=r.target;n(l?g:{value:g})};return d.jsx(z,{value:s,onChange:u,...t})},J=a.bind({}),C=a.bind({});C.args={small:!0};const x=a.bind({});x.args={width:"auto"};const I=a.bind({});I.args={width:"200px"};const w=a.bind({});w.args={native:!0};const f=a.bind({});f.args={multi:!0,clearable:!0};const T=a.bind({});T.args={options:[]};const B=a.bind({});B.args={clearable:!0};const j=a.bind({});j.args={value:{label:"Vampires",value:"blood"}};const k=a.bind({});k.args={placeholder:"Select the best animal..."};const W=a.bind({});W.args={options:Ga};const O=a.bind({});O.args={options:Fa};const D=a.bind({});D.args={options:$a};const N=a.bind({});N.args={options:za};const A=a.bind({});A.args={options:Ja};const E=a.bind({});E.args={searchable:!1};const M=a.bind({});M.args={right:!0};const v=a.bind({});v.parameters={docs:{description:{story:"Avoid autoLayerWidth for very long lists in custom selects (slow)"}}};v.args={width:"70px",autoLayerWidth:!0};const L=a.bind({});L.args={tooltip:"Some info"};const K=a.bind({});K.args={error:"Some info"};const R=a.bind({});R.args={warning:"Some info"};const P=a.bind({});P.args={disabled:!0};const H=a.bind({});H.args={options:Ya,placeholder:void 0};const _=a.bind({});_.args={options:Za};const q=a.bind({});q.args={options:Ua};const m=a.bind({});m.parameters={docs:{description:{story:"Avoid `width: auto` and autoLayerWidth for very long lists in custom selects (slow). Consider checkNonExistentValues={false}."}}};m.args={options:Qa};const F=a.bind({});F.args={deprecatedEventHandler:!0};const G=a.bind({});G.args={value:{label:"Vampires",value:"blood"},disabled:!0};const Y=()=>{const[t,l]=b.useState([{label:"Aardvarks",value:"termites"},{label:"Kangaroos",value:"grass"},{label:"Monkeys",value:"bananas"},{label:"Possums",value:"slugs"}]),[e,s]=b.useState(void 0),[n,u]=b.useState([]);return d.jsxs(d.Fragment,{children:[d.jsx(z,{name:"example",options:t,onChange:r=>s({value:r.target.value}),onCreate:r=>{const g={label:r,value:r};l([...t,g]),s(g)},value:e,clearable:!0}),d.jsx(qa,{}),d.jsx(z,{name:"example",options:t,onChange:r=>u(r.target.value),onCreate:r=>{const g={label:r,value:r};l([...t,g]),console.log(r),u([...n,g])},value:n,multi:!0,clearable:!0})]})},h=a.bind({});h.args={testId:"testId",clearable:!0};h.play=async({canvasElement:t,step:l})=>{const e=t.parentElement?i(t.parentElement):null;await o(e).toBeTruthy(),e&&(await l("Select item with click",async()=>{const s=e.getByTestId("testId");await c.click(s);const n=e.getByTestId("testId-layer");await o(n).toBeInTheDocument();const u=i(n).getByText("Wombats");await c.click(u);const r=e.getByTestId("testId-value");await o(i(r).getByText("Wombats")).toBeInTheDocument()}),await l("Clear selected value",async()=>{const s=e.getByTestId("testId-clear");await c.click(s);const n=e.queryByTestId("testId-value");await o(n).not.toBeInTheDocument()}))};const S=a.bind({});S.args={testId:"testId",clearable:!0,multi:!0};S.play=async({canvasElement:t,step:l})=>{const e=t.parentElement?i(t.parentElement):null;await o(e).toBeTruthy(),e&&(await l("Select items with click",async()=>{const s=e.getByTestId("testId");await c.click(s);const n=e.getByTestId("testId-layer");await o(n).toBeInTheDocument();const u=i(n).getByText("Wombats");await c.click(u);const r=i(n).getByText("Kangaroos");await c.click(r),await c.click(t),await o(n).not.toBeInTheDocument();const g=e.getByTestId("testId-value");await o(i(g).getByText("Wombats")).toBeInTheDocument(),await o(i(g).getByText("Kangaroos")).toBeInTheDocument()}),await l("Deselect item with click",async()=>{const s=e.getByTestId("testId");await c.click(s);const n=e.getByTestId("testId-layer");await o(n).toBeInTheDocument();const u=i(n).getByText("Wombats");await c.click(u),await c.click(t),await o(n).not.toBeInTheDocument();const r=e.getByTestId("testId-value");await o(i(r).queryByText("Wombats")).not.toBeInTheDocument()}),await l("Clear selected values",async()=>{const s=e.getByTestId("testId-clear");await c.click(s);const n=e.queryByTestId("testId-value");await o(n).not.toBeInTheDocument()}))};const V=a.bind({});V.args={testId:"testId",disabled:!0};V.play=async({canvasElement:t,step:l})=>{const e=i(t);await l("Clicking disabled trigger should not show layer",async()=>{await e.getByTestId("testId").click();const n=e.queryByTestId("testId-layer");await o(n).toBeNull()})};const p=()=>{const[t,l]=b.useState(_a),[e,s]=b.useState(void 0);return d.jsx(z,{testId:"testId",name:"example",options:t,onChange:n=>s({value:n.target.value}),onCreate:n=>{const u={label:n,value:n};l([...t,u]),s(u)},value:e})};p.args={testId:"testId"};p.play=async({canvasElement:t,step:l})=>{const e=t.parentElement?i(t.parentElement):null;await o(e).toBeTruthy(),e&&await l("Create new item",async()=>{const s=e.getByTestId("testId-input");if(o(s).toBeInTheDocument(),!s)return;await c.type(s,"New value");const n=e.getByText('Create "New value"');await c.click(n);const u=e.getByTestId("testId-value");await o(i(u).getByText("New value")).toBeInTheDocument()})};Y.__docgenInfo={description:"",methods:[],displayName:"OnCreate"};p.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"TestCreate"};var Q,U,X;J.parameters={...J.parameters,docs:{...(Q=J.parameters)==null?void 0:Q.docs,source:{originalSource:`(args: any) => {
|
|
2
2
|
const {
|
|
3
3
|
multi,
|
|
4
4
|
value
|
|
@@ -576,4 +576,4 @@ import{j as d}from"./jsx-runtime-eps93zm2.js";import{r as b}from"./index-DhsZuJv
|
|
|
576
576
|
setOptions([...options, newValue]);
|
|
577
577
|
setSingleValue(newValue);
|
|
578
578
|
}} value={singleValue} />;
|
|
579
|
-
}`,...(Ha=(Pa=p.parameters)==null?void 0:Pa.docs)==null?void 0:Ha.source}}};const
|
|
579
|
+
}`,...(Ha=(Pa=p.parameters)==null?void 0:Pa.docs)==null?void 0:Ha.source}}};const Bn=["Default","Small","AutoWidth","FixedWidth","Native","Multiselect","Empty","Clearable","NonExistentValue","CustomPlaceholder","OptionsWithHeadings","OptionsWithDetails","OptionsWithIcons","OptionsWithActions","OptionsWithEverything","NotSearchable","RightAligned","AutoLayerWidth","Tooltip","Error","Warning","Disabled","NumericOptions","BooleanOptions","SimpleOptions","VeryLongList","DeprecatedEventHandler","TestDisabledNonExistentValue","OnCreate","Test","TestMulti","TestDisabled","TestCreate"];export{v as AutoLayerWidth,x as AutoWidth,_ as BooleanOptions,B as Clearable,k as CustomPlaceholder,J as Default,F as DeprecatedEventHandler,P as Disabled,T as Empty,K as Error,I as FixedWidth,f as Multiselect,w as Native,j as NonExistentValue,E as NotSearchable,H as NumericOptions,Y as OnCreate,N as OptionsWithActions,O as OptionsWithDetails,A as OptionsWithEverything,W as OptionsWithHeadings,D as OptionsWithIcons,M as RightAligned,q as SimpleOptions,C as Small,h as Test,p as TestCreate,V as TestDisabled,G as TestDisabledNonExistentValue,S as TestMulti,L as Tooltip,m as VeryLongList,R as Warning,Bn as __namedExportsOrder,Tn as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as x}from"./index-DhsZuJvc.js";import{I as j}from"./common-types-Sih75Sav.js";import{T as g}from"./top-bar-DkXSzzqt.js";import{S as w}from"./side-bar-CSx5wI-k.js";import{H as t}from"./heading-CRNoBc7q.js";import{B as L}from"./button-DHevvVBE.js";import{D as v}from"./drawer-DOWJp9T4.js";import{L as d}from"./list-bKpz6I9Q.js";import{F as l}from"./field-HrLaMLbx.js";import{I as a}from"./input-DTXbDJaL.js";import{C as m}from"./check-box-DPLaOkRR.js";import{P as f}from"./page-7SSpdYhb.js";import{R as o,C as i}from"./row-Bmiy2Lh0.js";import{A as u}from"./accordion-BiuI_LCA.js";import{S as s}from"./spacer-BWoNR27H.js";import{T as F}from"./tabs-
|
|
1
|
+
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as x}from"./index-DhsZuJvc.js";import{I as j}from"./common-types-Sih75Sav.js";import{T as g}from"./top-bar-DkXSzzqt.js";import{S as w}from"./side-bar-CSx5wI-k.js";import{H as t}from"./heading-CRNoBc7q.js";import{B as L}from"./button-DHevvVBE.js";import{D as v}from"./drawer-DOWJp9T4.js";import{L as d}from"./list-bKpz6I9Q.js";import{F as l}from"./field-HrLaMLbx.js";import{I as a}from"./input-DTXbDJaL.js";import{C as m}from"./check-box-DPLaOkRR.js";import{P as f}from"./page-7SSpdYhb.js";import{R as o,C as i}from"./row-Bmiy2Lh0.js";import{A as u}from"./accordion-BiuI_LCA.js";import{S as s}from"./spacer-BWoNR27H.js";import{T as F}from"./tabs-C3NG6m9W.js";import"./index-Bk2sglWO.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./actions-D-uVCDzk.js";import"./lodash-c4VUpsOs.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./types-BmbYqTX_.js";import"./types-Dx2TtIG9.js";import"./badge-CLQ59MDF.js";import"./index-BI4_Bp97.js";import"./help-icon-Buhx5nl6.js";import"./spinner-AWUe4xwQ.js";import"./index.es-DazXb-ul.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./memoize-one.esm-CcMeOnPo.js";import"./card-EcjmryU9.js";import"./meta-content-DWZbURV2.js";import"./loader-XHoVniao.js";import"./label-CqmyC9he.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./select.input-D0UkAPd9.js";const C=[{label:"Import",value:"import",right:!0},{label:"Settings",value:"settings",right:!0}],S=()=>e.jsx("div",{style:{background:"#AAD3DF",borderLeft:"1px solid #8AB3BF",display:"flex",alignItems:"center",justifyContent:"center",color:"white",height:"100%"},children:"MAP"}),xe={title:"Layout/Layout Examples",parameters:{layout:"fullscreen",docs:{story:{inline:!1,iframeHeight:400}}}},n=()=>{const[r,b]=x.useState(!0);return e.jsxs(e.Fragment,{children:[e.jsx(g,{}),e.jsx(w,{options:{title:"",sections:[]},width:"250px"}),e.jsx(f,{padding:!1,scroll:!1,children:e.jsxs(o,{spacing:0,flex:!0,children:[e.jsxs(v,{button:e.jsx(L,{onClick:()=>b(!r),round:!0,icon:j.CHEVRON_LEFT}),open:r,width:300,closedWidth:"var(--size-sidebar)",children:[e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Sites",items:[{id:1,name:"Main Site",type:"Heading"},{id:2,name:"Site name here",active:!0,label:{value:1,color:"#69779b"}},{id:3,name:"Locations",type:"Heading"},{id:4,name:"Ipsum",label:{value:2,color:"#69779b"}},{id:5,name:"Dolor",label:{value:3,color:"#69779b"}}]}}),e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Wells",items:[{id:1,name:"Main Wellbore",type:"Heading"},{id:2,name:"Lorem",label:{value:1,color:"#77699b"}}]}}),e.jsx(d,{drawer:!0,narrow:!r,list:{name:"Targets",items:[{id:1,name:"Lorem",label:{value:1,color:"#9b6977"}}]}})]}),e.jsxs(i,{borderLeft:!0,flexbox:!0,children:[e.jsx(s,{}),e.jsx(F,{padding:!0,margin:!1,options:C}),e.jsxs(o,{spacing:0,flex:!0,children:[e.jsxs(i,{scroll:!0,padding:!0,width:550,children:[e.jsx(t,{top:!0,children:"Site name here"}),e.jsx(l,{label:"Name",children:e.jsx(a,{value:"Site name here",width:"200px"})}),e.jsxs(u,{heading:e.jsx(t,{children:"Coordinate Reference System"}),managed:!0,children:[e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",labelLeft:!0,labelWidth:"50px",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{children:e.jsx(m,{label:"Dolor"})})]}),e.jsx(s,{}),e.jsx(t,{marginBottom:"var(--padding)",children:"Location"}),e.jsxs(o,{children:[e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})})]}),e.jsx(s,{}),e.jsx(t,{marginBottom:"var(--padding)",children:"Model"}),e.jsxs(o,{children:[e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})}),e.jsx(i,{children:e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})})]}),e.jsxs(u,{heading:e.jsx(t,{children:"Settings"}),managed:!0,children:[e.jsx(l,{children:e.jsx(m,{label:"Dolor"})}),e.jsxs(o,{children:[e.jsxs(i,{children:[e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})]}),e.jsxs(i,{children:[e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})}),e.jsx(l,{label:"Label",children:e.jsx(a,{value:"Value",width:"100%"})})]})]})]})]}),e.jsx(i,{children:e.jsx(S,{})})]})]})]})})]})};n.__docgenInfo={description:"",methods:[],displayName:"Site"};var p,c,h;n.parameters={...n.parameters,docs:{...(p=n.parameters)==null?void 0:p.docs,source:{originalSource:`() => {
|
|
2
2
|
const [open, setOpen] = useState(true);
|
|
3
3
|
return <>
|
|
4
4
|
<TopBar />
|
|
@@ -163,4 +163,4 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as x}from"./index-DhsZuJv
|
|
|
163
163
|
</Row>
|
|
164
164
|
</Page>
|
|
165
165
|
</>;
|
|
166
|
-
}`,...(h=(c=n.parameters)==null?void 0:c.docs)==null?void 0:h.source}}};const
|
|
166
|
+
}`,...(h=(c=n.parameters)==null?void 0:c.docs)==null?void 0:h.source}}};const je=["Site"];export{n as Site,je as __namedExportsOrder,xe as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as i}from"./index-DhsZuJvc.js";import{B as h}from"./button-DHevvVBE.js";import{u as Q,M as z,D as G}from"./dialog-BelCA1mt.js";import{F as J}from"./file-input-X3BnZaHk.js";import{S}from"./spacer-BWoNR27H.js";import{T as W}from"./text-B3-TSWok.js";import{P as X}from"./progress-bar-C_kV6r0Q.js";import{d as Y}from"./index-
|
|
1
|
+
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as i}from"./index-DhsZuJvc.js";import{B as h}from"./button-DHevvVBE.js";import{u as Q,M as z,D as G}from"./dialog-BelCA1mt.js";import{F as J}from"./file-input-X3BnZaHk.js";import{S}from"./spacer-BWoNR27H.js";import{T as W}from"./text-B3-TSWok.js";import{P as X}from"./progress-bar-C_kV6r0Q.js";import{d as Y}from"./index-C0x1JmaP.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";import"./index-CUZDtIZe.js";import"./portal-GQ0_cLB6.js";import"./lodash-c4VUpsOs.js";import"./heading-CRNoBc7q.js";import"./help-icon-Buhx5nl6.js";import"./input-group-BaRSJAEN.js";import"./input-DTXbDJaL.js";import"./types-Dx2TtIG9.js";import"./index-DRSy5Ssd.js";const U=250,g=4e4,b=20,I=500,M=({visible:s,prompt:p,onCloseModal:f,onUpload:m,onComplete:y,onFailed:n,onError:a,width:F,heading:_,dialogText:E,fileInputText:k,fileInputPlaceholder:N,uploadText:V,cancelText:B,testId:d})=>{const[c,v]=i.useState(null),[C,u]=i.useState(!1),[P,T]=i.useState(0);let o=0;const R=()=>{o=o+U,T(o)},A=t=>{let r=o+t;r>=.99*g&&(r=g),o=r,T(o)};i.useEffect(()=>{v(null)},[s]);const L=t=>{t.target.value&&v(t.target.value)},H=async()=>{T(0);const t=setInterval(R,U);try{if(!c)return;u(!0);const r=await m(p,c);if(!s)return;if(r){clearInterval(t);const K=setInterval(A,I/b,(g-o)/(b-1));setTimeout(()=>{y(r),clearInterval(K),u(!1)},I)}else n==null||n(),u(!1)}catch(r){a==null||a(r),u(!1)}finally{clearInterval(t)}},O=()=>{H()},x=()=>{f()},$=e.jsxs(e.Fragment,{children:[e.jsx(W,{children:E||"Upload file and extract data using a LLM"}),e.jsx(S,{}),e.jsx(J,{placeholder:N||"No file",label:k||"Select",file:c||void 0,onChange:L,testId:`${d}-file-input`,accept:"image/*"}),C&&e.jsxs(e.Fragment,{children:[e.jsx(S,{}),e.jsx(X,{percentage:Y.roundByMagnitudeToFixed(100*P/g,3)})]})]}),D=e.jsxs(e.Fragment,{children:[e.jsx(h,{label:V||"Upload",colored:!0,onClick:O,disabled:!c||C,testId:`${d}-button-upload`}),e.jsx(h,{label:B||"Cancel",onClick:x,testId:`${d}-button-cancel`})]});return Q("Escape",()=>x()),e.jsx(z,{visible:s,centered:!0,children:e.jsx(G,{dialog:{scroll:!0,heading:_||"Smart Upload",content:$,footer:D,onClose:x,width:F||350,testId:d}})})};M.__docgenInfo={description:"",methods:[],displayName:"SmartUploadModal",props:{visible:{required:!0,tsType:{name:"boolean"},description:""},prompt:{required:!0,tsType:{name:"string"},description:""},onCloseModal:{required:!0,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},onUpload:{required:!0,tsType:{name:"signature",type:"function",raw:"(prompt: string, file: File) => any",signature:{arguments:[{type:{name:"string"},name:"prompt"},{type:{name:"File"},name:"file"}],return:{name:"any"}}},description:""},onComplete:{required:!0,tsType:{name:"signature",type:"function",raw:"(data: { [key: string]: string }[]) => void",signature:{arguments:[{type:{name:"Array",elements:[{name:"signature",type:"object",raw:"{ [key: string]: string }",signature:{properties:[{key:{name:"string"},value:{name:"string",required:!0}}]}}],raw:"{ [key: string]: string }[]"},name:"data"}],return:{name:"void"}}},description:""},onFailed:{required:!1,tsType:{name:"signature",type:"function",raw:"() => void",signature:{arguments:[],return:{name:"void"}}},description:""},onError:{required:!1,tsType:{name:"signature",type:"function",raw:"(error: any) => void",signature:{arguments:[{type:{name:"any"},name:"error"}],return:{name:"void"}}},description:""},width:{required:!1,tsType:{name:"number"},description:""},heading:{required:!1,tsType:{name:"string"},description:""},dialogText:{required:!1,tsType:{name:"string"},description:""},fileInputText:{required:!1,tsType:{name:"string"},description:""},fileInputPlaceholder:{required:!1,tsType:{name:"string"},description:""},uploadText:{required:!1,tsType:{name:"string"},description:""},cancelText:{required:!1,tsType:{name:"string"},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Ie={title:"Ai/SmartUploadModal",component:M,args:{visible:!0,prompt:"This is a prompt",onCloseModal:()=>{},onUpload:()=>{},onComplete:()=>{}},parameters:{docs:{story:{inline:!1,iframeHeight:400}}}},l=()=>{const[s,p]=i.useState(!0),f=()=>{p(!0)},m=()=>{p(!1)},y=()=>(console.log("Uploading"),new Promise(a=>{setTimeout(()=>{a([])},4e3)})),n=()=>{console.log("Completed"),m()};return e.jsxs(e.Fragment,{children:[e.jsx(M,{visible:s,prompt:"This is a prompt",onCloseModal:m,onUpload:y,onComplete:n}),e.jsx(h,{label:"Open Modal",onClick:f})]})};l.__docgenInfo={description:"",methods:[],displayName:"SmartUpload"};var j,q,w;l.parameters={...l.parameters,docs:{...(j=l.parameters)==null?void 0:j.docs,source:{originalSource:`() => {
|
|
2
2
|
const [visible, setVisible] = useState(true);
|
|
3
3
|
const openModal = () => {
|
|
4
4
|
setVisible(true);
|
|
@@ -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 T}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-D6pYWeQM.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-Ct8VwJX0.js";import{S as Ge}from"./select-V2ZNp3Pv.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",dn="_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:dn},un="_title_zn5s7_1",cn={title:un},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 mn="_footer_4sumy_1",pn="_section_4sumy_7",J={footer:mn,section:pn},Z=({colSpan:e,pagination:t,actions:r,content:o})=>{const a=r&&r.length,i=o!=null,l=()=>{var d,m;if(t){const{rowCount:u,rowsPerPage:y}=t,I=Number((m=(d=y==null?void 0:y.options)==null?void 0:d[0])==null?void 0:m.value);return u>I}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 Ce=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=[Ce(t),Ce(e)];return Math.max(...r)},be=e=>e.reduce((t,r)=>r.actions&&r.actions.length>0?1:t,0),In=(e,t)=>be(t)>0||be(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,d]=o?S.useState(i<r.length):[!1,null],m=()=>{if(i>=r.length&&d){d(!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:m,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 yn="_clickableRow_1ki29_1",Cn="_hoverableRow_1ki29_4",bn="_rowActive_1ki29_4",hn="_expandableRow_1ki29_8",fn="_flush_1ki29_8",_n="_errorRow_1ki29_12",wn="_warningRow_1ki29_15",vn="_dragIconCell_1ki29_34",xn="_dragIcon_1ki29_34",h={clickableRow:yn,hoverableRow:Cn,rowActive:bn,expandableRow:hn,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:T(h.expandableRow,r?h.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 he=(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."),[])},jn="_inputInTable_1rtjr_1",kn="_error_1rtjr_7",An="_warning_1rtjr_7",Rn="_inputHover_1rtjr_13",qn="_inputFocus_1rtjr_18",Nn="_inputError_1rtjr_25",Sn="_inputWarning_1rtjr_26",En="_inputDisabled_1rtjr_61",Hn="_hideScrollbars_1rtjr_67",Ln="_cell_1rtjr_77",Wn="_disabledLink_1rtjr_87",Fn="_inputWrapper_1rtjr_91",Pn="_breakWord_1rtjr_106",Dn="_inputCell_1rtjr_109",On="_sliderCell_1rtjr_112",$n="_staticCell_1rtjr_116",Bn="_staticCellContent_1rtjr_119",Mn="_unit_1rtjr_141",Gn="_sortingCell_1rtjr_144",Vn="_sortingCellIcon_1rtjr_155",Un="_icon_1rtjr_166",zn="_checkBoxCell_1rtjr_170",Kn="_iconCellWrapper_1rtjr_174",Xn="_actionsCell_1rtjr_178",Yn="_rightAligned_1rtjr_186",Jn="_centerAligned_1rtjr_192",Qn="_leftAligned_1rtjr_198",Zn="_popover_1rtjr_201",et="_disabledPointerEvents_1rtjr_204",s={inputInTable:jn,error:kn,warning:An,inputHover:Rn,inputFocus:qn,inputError:Nn,inputWarning:Sn,inputDisabled:En,hideScrollbars:Hn,cell:Ln,disabledLink:Wn,inputWrapper:Fn,breakWord:Pn,inputCell:Dn,sliderCell:On,staticCell:$n,staticCellContent:Bn,unit:Mn,sortingCell:Gn,sortingCellIcon:Vn,icon:Un,checkBoxCell:zn,iconCellWrapper:Kn,actionsCell:Xn,rightAligned:Yn,centerAligned:Jn,leftAligned:Qn,popover:Zn,disabledPointerEvents:et},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,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,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=d=>M(d);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:T(s.staticCellContent,o?s.error:a?s.warning:""),children:n.jsx("a",{className:T((e.disabled||r)&&s.disabledLink),onClick:e.disabled||r?void 0:d=>{var m;d.stopPropagation(),(m=e.onClick)==null||m.call(e,d)},"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 je=({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})});je.__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 qe=({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};qe.__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:d,type:m}=e,u=n.jsxs("div",{className:T(s.staticCellContent,m==="Unit"?s.unit:"",o?s.error:a?s.warning:""),onClick:c?y=>d&&d(y):()=>{},"data-testid":r,children:[e.value,t?n.jsxs(n.Fragment,{children:[n.jsx(Re,{cell:e}),n.jsx(qe,{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:u})})};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(je,{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:d,rowSpan:m,width:u}=e,y=S.useRef(null),I={bodyAlignment:o,headerAlignment:r,isHeader:t},W=he(I,s),_=he(I,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,j=T(s.cell,F,e.hasSort?s.sortingCell:null,W,e.breakWord?s.breakWord:""),E=u??a??((i==null?void 0:i.isDragging)&&y.current&&y.current.offsetWidth)??void 0,w={width:E,minWidth:E,...c},k=t?"th":"td";return n.jsx(k,{ref:y,className:j,style:w,colSpan:d,rowSpan:m,children:n.jsx(Ee,{cell:e,columnAlignment:_??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 T}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-DBZIl9dz.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",dn="_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:dn},un="_title_zn5s7_1",cn={title:un},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 mn="_footer_4sumy_1",pn="_section_4sumy_7",J={footer:mn,section:pn},Z=({colSpan:e,pagination:t,actions:r,content:o})=>{const a=r&&r.length,i=o!=null,l=()=>{var d,m;if(t){const{rowCount:u,rowsPerPage:y}=t,I=Number((m=(d=y==null?void 0:y.options)==null?void 0:d[0])==null?void 0:m.value);return u>I}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 Ce=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=[Ce(t),Ce(e)];return Math.max(...r)},be=e=>e.reduce((t,r)=>r.actions&&r.actions.length>0?1:t,0),In=(e,t)=>be(t)>0||be(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,d]=o?S.useState(i<r.length):[!1,null],m=()=>{if(i>=r.length&&d){d(!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:m,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 yn="_clickableRow_1ki29_1",Cn="_hoverableRow_1ki29_4",bn="_rowActive_1ki29_4",hn="_expandableRow_1ki29_8",fn="_flush_1ki29_8",_n="_errorRow_1ki29_12",wn="_warningRow_1ki29_15",vn="_dragIconCell_1ki29_34",xn="_dragIcon_1ki29_34",h={clickableRow:yn,hoverableRow:Cn,rowActive:bn,expandableRow:hn,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:T(h.expandableRow,r?h.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 he=(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."),[])},jn="_inputInTable_1rtjr_1",kn="_error_1rtjr_7",An="_warning_1rtjr_7",Rn="_inputHover_1rtjr_13",qn="_inputFocus_1rtjr_18",Nn="_inputError_1rtjr_25",Sn="_inputWarning_1rtjr_26",En="_inputDisabled_1rtjr_61",Hn="_hideScrollbars_1rtjr_67",Ln="_cell_1rtjr_77",Wn="_disabledLink_1rtjr_87",Fn="_inputWrapper_1rtjr_91",Pn="_breakWord_1rtjr_106",Dn="_inputCell_1rtjr_109",On="_sliderCell_1rtjr_112",$n="_staticCell_1rtjr_116",Bn="_staticCellContent_1rtjr_119",Mn="_unit_1rtjr_141",Gn="_sortingCell_1rtjr_144",Vn="_sortingCellIcon_1rtjr_155",Un="_icon_1rtjr_166",zn="_checkBoxCell_1rtjr_170",Kn="_iconCellWrapper_1rtjr_174",Xn="_actionsCell_1rtjr_178",Yn="_rightAligned_1rtjr_186",Jn="_centerAligned_1rtjr_192",Qn="_leftAligned_1rtjr_198",Zn="_popover_1rtjr_201",et="_disabledPointerEvents_1rtjr_204",s={inputInTable:jn,error:kn,warning:An,inputHover:Rn,inputFocus:qn,inputError:Nn,inputWarning:Sn,inputDisabled:En,hideScrollbars:Hn,cell:Ln,disabledLink:Wn,inputWrapper:Fn,breakWord:Pn,inputCell:Dn,sliderCell:On,staticCell:$n,staticCellContent:Bn,unit:Mn,sortingCell:Gn,sortingCellIcon:Vn,icon:Un,checkBoxCell:zn,iconCellWrapper:Kn,actionsCell:Xn,rightAligned:Yn,centerAligned:Jn,leftAligned:Qn,popover:Zn,disabledPointerEvents:et},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,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=d=>M(d);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:T(s.staticCellContent,o?s.error:a?s.warning:""),children:n.jsx("a",{className:T((e.disabled||r)&&s.disabledLink),onClick:e.disabled||r?void 0:d=>{var m;d.stopPropagation(),(m=e.onClick)==null||m.call(e,d)},"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 je=({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})});je.__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 qe=({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};qe.__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:d,type:m}=e,u=n.jsxs("div",{className:T(s.staticCellContent,m==="Unit"?s.unit:"",o?s.error:a?s.warning:""),onClick:c?y=>d&&d(y):()=>{},"data-testid":r,children:[e.value,t?n.jsxs(n.Fragment,{children:[n.jsx(Re,{cell:e}),n.jsx(qe,{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:u})})};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(je,{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:d,rowSpan:m,width:u}=e,y=S.useRef(null),I={bodyAlignment:o,headerAlignment:r,isHeader:t},W=he(I,s),_=he(I,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,j=T(s.cell,F,e.hasSort?s.sortingCell:null,W,e.breakWord?s.breakWord:""),E=u??a??((i==null?void 0:i.isDragging)&&y.current&&y.current.offsetWidth)??void 0,w={width:E,minWidth:E,...c},k=t?"th":"td";return n.jsx(k,{ref:y,className:j,style:w,colSpan:d,rowSpan:m,children:n.jsx(Ee,{cell:e,columnAlignment:_??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-D9JJ68Tx.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-D52aKMY1.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-D6pYWeQM.js";import"./select-V2ZNp3Pv.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-Ct8VwJX0.js";import"./index-DaLCDjg_.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 bt={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-CB6btQu9.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-D52aKMY1.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-DBZIl9dz.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 => {
|
|
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 bt=["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,bt as __namedExportsOrder,gt 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-D0UkAPd9.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-C3NG6m9W.js";import"./index-Bk2sglWO.js";import"./disabled-context-rmpd7YJS.js";import"./lodash-c4VUpsOs.js";import"./badge-CLQ59MDF.js";import"./select.input-D0UkAPd9.js";import"./types-BmbYqTX_.js";const Q={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 U=["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,U as __namedExportsOrder,Q 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-CB6btQu9.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-D52aKMY1.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-CLt-kUlx.js";import"./select-DnRuRG_N.js";import"./assertThisInitialized-B9jnkVVz.js";import"./text-B3-TSWok.js";import"./select.input-D0UkAPd9.js";import"./input-DTXbDJaL.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./number-input-DBZIl9dz.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 Gr={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 l=r.bind({});l.args={table:Q};var m,c,d;e.parameters={...e.parameters,docs:{...(m=e.parameters)==null?void 0:m.docs,source:{originalSource:`args => {
|
|
2
2
|
return <Table
|
|
3
3
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
4
|
{...args} />;
|
|
@@ -34,4 +34,4 @@ import{j as G}from"./jsx-runtime-eps93zm2.js";import{T as X}from"./table-D9JJ68T
|
|
|
34
34
|
return <Table
|
|
35
35
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
36
36
|
{...args} />;
|
|
37
|
-
}`,...(_=(U=l.parameters)==null?void 0:U.docs)==null?void 0:_.source}}};const
|
|
37
|
+
}`,...(_=(U=l.parameters)==null?void 0:U.docs)==null?void 0:_.source}}};const Kr=["Units","ActiveRow","Title","TitleJSX","ChildComponent","Filter","Sort","HeaderActionsNoLabel","HelpAndLibraryIcons"];export{s as ActiveRow,o as ChildComponent,n as Filter,p as HeaderActionsNoLabel,l as HelpAndLibraryIcons,i as Sort,a as Title,t as TitleJSX,e as Units,Kr as __namedExportsOrder,Gr as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._predefinedMenuActive_ye9w9_1 input{background:var(--color-background-disabled)!important}._inputWrapper_ye9w9_4{flex:1}
|