@oliasoft-open-source/react-ui-library 4.7.3 → 4.8.0-beta-2
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-D5kcnHmD.js → index-Csdt18_R.js} +1 -9
- package/dist/global.css +4 -1
- package/dist/index.d.ts +16 -6
- package/dist/index.html +1 -1
- package/dist/index.js +121 -158
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/Color-KGDBMAHA-BS-rAnbo.js +1 -0
- package/dist/storybook/assets/DocsRenderer-PKQXORMH-DZ7r3cmw.js +1 -0
- package/dist/storybook/assets/{accordion-6ouB0WTt.js → accordion-BiuI_LCA.js} +1 -1
- package/dist/storybook/assets/{accordion.stories-DlFZNmdv.js → accordion.stories-CKrpJWRn.js} +2 -2
- package/dist/storybook/assets/{actions-Cu_0szZ4.js → actions-CHgr8eL8.js} +1 -1
- package/dist/storybook/assets/{actions.stories-SCPuAp0T.js → actions.stories-CCDxFKFk.js} +1 -1
- package/dist/storybook/assets/{afe.stories-G3SzS3sg.js → afe.stories-80-X2oCf.js} +2 -2
- package/dist/storybook/assets/{badge.stories-DGYA6_1I.js → badge.stories-D5DA-vxC.js} +1 -1
- package/dist/storybook/assets/{blowout.stories-P0LHuXSY.js → blowout.stories-ES-Fuaqn.js} +1 -1
- package/dist/storybook/assets/{button-_0DiND6h.js → button-VxhoNhrV.js} +1 -1
- package/dist/storybook/assets/{button-group-BYiHMljF.js → button-group-CwJdFo2z.js} +1 -1
- package/dist/storybook/assets/{button-group.stories-Bz6NHaeB.js → button-group.stories-DU5k5qCY.js} +1 -1
- package/dist/storybook/assets/{button.stories-vVBGddVf.js → button.stories-DVtec2Eo.js} +2 -2
- package/dist/storybook/assets/{buttons-and-links-B6aQa-f5.js → buttons-and-links-sTGnmj6h.js} +2 -2
- package/dist/storybook/assets/{card.stories-DIlqxO94.js → card.stories-CsTB0DuM.js} +1 -1
- package/dist/storybook/assets/{casing-loads.stories-0T--WlaD.js → casing-loads.stories-Do3mZuX2.js} +2 -2
- package/dist/storybook/assets/{cell.stories-C5Tkxyfr.js → cell.stories-B0YsumDa.js} +2 -2
- package/dist/storybook/assets/{check-box-DkdQxC5c.js → check-box-BtCGePRy.js} +1 -1
- package/dist/storybook/assets/check-box.stories-B6vW-2Fd.js +126 -0
- package/dist/storybook/assets/{chunk-HLWAVYOI-dB_9CZG8.js → chunk-HLWAVYOI-BqK-R5cR.js} +1 -1
- package/dist/storybook/assets/color-Cvx86PKp.js +25 -0
- package/dist/storybook/assets/{column.stories-C1Sxwh4f.js → column.stories-BxfR9Tla.js} +1 -1
- package/dist/storybook/assets/dialog-Di8hNunM.js +1 -0
- package/dist/storybook/assets/{drawer-vbDFqa4U.js → drawer-BhuWxI7V.js} +1 -1
- package/dist/storybook/assets/{drawer.stories-CmbGsKmS.js → drawer.stories-B-PsNJJ6.js} +4 -4
- package/dist/storybook/assets/{empty.stories-iHPKKy4z.js → empty.stories-BVYXwvpa.js} +1 -1
- package/dist/storybook/assets/{field-DwLk_uWj.js → field-HrLaMLbx.js} +1 -1
- package/dist/storybook/assets/{field.stories-s-0LQVbp.js → field.stories-B9p9nBgY.js} +1 -1
- package/dist/storybook/assets/{file-button.stories-C90kcfbw.js → file-button.stories-FOaiNPt-.js} +1 -1
- package/dist/storybook/assets/{file-input-C_2w1dKj.js → file-input-BpMtsZ2S.js} +1 -1
- package/dist/storybook/assets/{file-input.stories-BEsZox6U.js → file-input.stories-Jrdw5k-s.js} +1 -1
- package/dist/storybook/assets/{flex.stories-D-QN0gkk.js → flex.stories-BEXf0VqI.js} +1 -1
- package/dist/storybook/assets/footer.stories-CMN_mVki.js +3 -0
- package/dist/storybook/assets/form.stories-C1Qx3M_1.js +49 -0
- package/dist/storybook/assets/formation.stories-CCJYaUpG.js +74 -0
- package/dist/storybook/assets/{heading-DkSFysAb.js → heading-CRNoBc7q.js} +1 -1
- package/dist/storybook/assets/{heading.stories-Dtq7LNlB.js → heading.stories-DahFxeiX.js} +1 -1
- package/dist/storybook/assets/{help-icon-LfPZiYla.js → help-icon-Buhx5nl6.js} +1 -1
- package/dist/storybook/assets/{help-icon.stories-Dh2ylnGq.js → help-icon.stories-DbmZ1fgP.js} +1 -1
- package/dist/storybook/assets/icon-BSFY3vDO.js +8 -0
- package/dist/storybook/assets/{icon.stories-B-tKaIKA.js → icon.stories-C1hZXIMX.js} +1 -1
- package/dist/storybook/assets/iframe-CUVhB5TR.js +2 -0
- package/dist/storybook/assets/{index-ccPuy0l1.js → index-B8zF6D3V.js} +8 -8
- package/dist/storybook/assets/index-Be0hXiyp.js +179 -0
- package/dist/storybook/assets/index-CF7H4eMJ.js +28 -0
- package/dist/storybook/assets/index-omjWi7I7.js +1 -0
- package/dist/storybook/assets/{index.es-D2piFfFj.js → index.es-DazXb-ul.js} +4 -4
- package/dist/storybook/assets/inheritsLoose-DP0QEDDI.js +1 -0
- package/dist/storybook/assets/{input-D97ganXq.js → input-BW9trNAW.js} +1 -1
- package/dist/storybook/assets/{input-group.stories-BcoORZ9x.js → input-group.stories-44quIZTV.js} +2 -2
- package/dist/storybook/assets/{input-validation-CLVu4gtl.js → input-validation-BREYBXzB.js} +2 -2
- package/dist/storybook/assets/{input.stories-BHdUwYqV.js → input.stories-BruLeJ44.js} +1 -1
- package/dist/storybook/assets/{inputs-qWlLPYX_.js → inputs-DkxT6vDD.js} +2 -2
- package/dist/storybook/assets/{label-tWjEmTQJ.js → label-CqmyC9he.js} +1 -1
- package/dist/storybook/assets/{label.stories-BTA8N7tD.js → label.stories-C0AO5F1a.js} +1 -1
- package/dist/storybook/assets/layout-forms-Y0Chz5wF.js +16 -0
- package/dist/storybook/assets/{layout-general-Dn1nlXYw.js → layout-general-CRJUCd3s.js} +2 -2
- package/dist/storybook/assets/{list-BpVed6Pw.js → list-yVTOdmpX.js} +1 -1
- package/dist/storybook/assets/{list.stories-CiT9J_FH.js → list.stories-ChqQXY5M.js} +2 -2
- package/dist/storybook/assets/{list.stories-data-CnVYk3eo.js → list.stories-data-Iq66w9oH.js} +1 -1
- package/dist/storybook/assets/{loader.stories-BKBFctQ1.js → loader.stories-DM7ZJBgz.js} +1 -1
- package/dist/storybook/assets/menu.stories-Dozt6Npk.js +84 -0
- package/dist/storybook/assets/message-BYzRg8Ae.js +1 -0
- package/dist/storybook/assets/{message.stories-C8YRT7nL.js → message.stories-K3bQ-5bJ.js} +1 -1
- package/dist/storybook/assets/{meta-content-Djgg-tiF.js → meta-content-cbHGvPJ7.js} +1 -1
- package/dist/storybook/assets/modal.stories-BX49dKIM.js +220 -0
- package/dist/storybook/assets/{number-input-B-Nmya5O.js → number-input-CD-fbjVQ.js} +1 -1
- package/dist/storybook/assets/number-input.stories-h1PlFB_G.js +105 -0
- package/dist/storybook/assets/{option-dropdown.stories-COGmMWEl.js → option-dropdown.stories-CoLsSS95.js} +1 -1
- package/dist/storybook/assets/{padding-and-spacing-BNiScrzg.js → padding-and-spacing-DYx_u7EA.js} +2 -2
- package/dist/storybook/assets/{page.stories-BB3g1zwB.js → page.stories-Cse3cMsO.js} +1 -1
- package/dist/storybook/assets/{pagination-DSQeMPG_.js → pagination-iSMIbR33.js} +1 -1
- package/dist/storybook/assets/pagination.stories-BUPaZD5R.js +59 -0
- package/dist/storybook/assets/{pop-confirm.stories-Cr_ZBbLn.js → pop-confirm.stories-Dhid1FK8.js} +1 -1
- package/dist/storybook/assets/popover-CzZdWNnB.js +1 -0
- package/dist/storybook/assets/popover.stories-Duemqiqp.js +10 -0
- package/dist/storybook/assets/{preview-DhMlVLsE.js → preview-B2Xzz4-3.js} +2 -2
- package/dist/storybook/assets/preview-DLBQXbKW.js +1 -0
- package/dist/storybook/assets/preview-kt6m1zZo.js +2 -0
- package/dist/storybook/assets/projects.stories-DU-QlBa6.js +47 -0
- package/dist/storybook/assets/{radio-button-BD7pi0ao.js → radio-button-YBwYcMaM.js} +1 -1
- package/dist/storybook/assets/radio-button.stories-8QEKlNvO.js +71 -0
- package/dist/storybook/assets/react-router-dom-Ck2Y_Fzc.js +8 -0
- package/dist/storybook/assets/{reservoirs.stories-kxVBoa7Y.js → reservoirs.stories-aSZ9r1Pu.js} +2 -2
- package/dist/storybook/assets/{rich-text-input.stories-C5pcIbSa.js → rich-text-input.stories-CsFyrKRA.js} +3 -3
- package/dist/storybook/assets/{row.stories-ATsrjumb.js → row.stories-ZCrMoTuY.js} +2 -2
- package/dist/storybook/assets/select-C8iu4-uz.js +40 -0
- package/dist/storybook/assets/select.stories-DbgjgsiX.js +579 -0
- package/dist/storybook/assets/{side-bar-WsK6pkmj.js → side-bar-CKbHPgIV.js} +1 -1
- package/dist/storybook/assets/{side-bar.stories-Bu2q_b_w.js → side-bar.stories-MUj_dj1F.js} +1 -1
- package/dist/storybook/assets/{site.stories-Yh4uNi3Q.js → site.stories-Ci4g5W2A.js} +2 -2
- package/dist/storybook/assets/{slider-CxVlS0fh.js → slider-DAramr8j.js} +4 -4
- package/dist/storybook/assets/{slider.stories-_wS70xsm.js → slider.stories-Cd0rLfHP.js} +2 -2
- package/dist/storybook/assets/{smart-upload-modal.stories-DDlO9y2j.js → smart-upload-modal.stories-DgnJ79fa.js} +1 -1
- package/dist/storybook/assets/{spacer.stories-B3LrTr7b.js → spacer.stories-CHEZdgDM.js} +1 -1
- package/dist/storybook/assets/{table-DPvzYjoq.js → table-ZQD4ELIM.js} +1 -1
- package/dist/storybook/assets/{table.stories-BGQ1O9nw.js → table.stories-DGedoAir.js} +2 -2
- package/dist/storybook/assets/{table.stories-data-2STKbgzG.js → table.stories-data-CR9VpXHs.js} +1 -1
- package/dist/storybook/assets/text-link.stories-BQAkVO-W.js +14 -0
- package/dist/storybook/assets/{textarea-DOJDK8hI.js → textarea-BV7xWEdt.js} +1 -1
- package/dist/storybook/assets/{textarea.stories-CKm5MlQF.js → textarea.stories-aRLEoDHg.js} +1 -1
- package/dist/storybook/assets/{title.stories-CVRTXggL.js → title.stories-jQBBSflc.js} +2 -2
- package/dist/storybook/assets/toaster-BNO0suPv.js +1 -0
- package/dist/storybook/assets/toaster.stories-CAqrDYpd.js +89 -0
- package/dist/storybook/assets/{toggle-t1iTuSL7.js → toggle-CBpNgTrm.js} +1 -1
- package/dist/storybook/assets/toggle.stories-t0T4HV1D.js +141 -0
- package/dist/storybook/assets/{tooltip-C_E_6ym5.js → tooltip-1V7clEnw.js} +1 -1
- package/dist/storybook/assets/{tooltip.stories-C70ADjjJ.js → tooltip.stories-1YexWg6N.js} +1 -1
- package/dist/storybook/assets/{tooltip.test-case.stories-BtrJUImB.js → tooltip.test-case.stories-i9YQqba1.js} +1 -1
- package/dist/storybook/assets/{top-bar-R-CjhJ21.js → top-bar-C_tn2Pc5.js} +1 -1
- package/dist/storybook/assets/top-bar.stories-B2a-RgK-.js +21 -0
- package/dist/storybook/assets/{top-bar.testcase.stories-ZPaSRyIh.js → top-bar.testcase.stories-DoPEAMYc.js} +1 -1
- package/dist/storybook/assets/{tree.stories-Ghxps-dL.js → tree.stories-6UHASEZu.js} +1 -1
- package/dist/storybook/assets/{unit-input.stories-Bqt0CdF7.js → unit-input.stories-C7XlUSaC.js} +1 -1
- package/dist/storybook/assets/unit-table.stories-BJbxGp7Y.js +150 -0
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.html +6 -2
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/sb-addons/interactions-2/manager-bundle.js +233 -0
- package/dist/storybook/sb-addons/storybook-dark-mode-esm-preset-3/manager-bundle.js.LEGAL.txt +0 -0
- package/package.json +1 -1
- package/dist/404.html +0 -1
- package/dist/storybook/assets/Color-KGDBMAHA-RK4YYQs0.js +0 -1
- package/dist/storybook/assets/DocsRenderer-PKQXORMH-B0ryFlHH.js +0 -1
- package/dist/storybook/assets/check-box.stories-D8C12IQo.js +0 -102
- package/dist/storybook/assets/color-BSzeqkLx.js +0 -25
- package/dist/storybook/assets/dialog-CAWCUmp3.js +0 -1
- package/dist/storybook/assets/extends-CF3RwP-h.js +0 -1
- package/dist/storybook/assets/footer.stories-U_zMDmxF.js +0 -3
- package/dist/storybook/assets/form.stories-1L75MGpX.js +0 -49
- package/dist/storybook/assets/formation.stories-YHpXrXvC.js +0 -74
- package/dist/storybook/assets/icon-BP4BO6-k.js +0 -8
- package/dist/storybook/assets/iframe-CNFcCVDc.js +0 -2
- package/dist/storybook/assets/index-BIwFZkUc.js +0 -1
- package/dist/storybook/assets/inheritsLoose-DR8r8Ogv.js +0 -1
- package/dist/storybook/assets/layout-forms-p4s8eHw6.js +0 -16
- package/dist/storybook/assets/menu.stories-Bp8L83xx.js +0 -82
- package/dist/storybook/assets/message-ttrR1AaP.js +0 -1
- package/dist/storybook/assets/modal.stories-BoVj2EsX.js +0 -200
- package/dist/storybook/assets/number-input.stories-CcNTeD25.js +0 -97
- package/dist/storybook/assets/pagination.stories-DjIohcDx.js +0 -59
- package/dist/storybook/assets/popover-Dq3iC_lM.js +0 -1
- package/dist/storybook/assets/popover.stories-CoWCb2Mn.js +0 -10
- package/dist/storybook/assets/preview-CZPuAPNr.js +0 -2
- package/dist/storybook/assets/projects.stories-BesbPJ8Z.js +0 -47
- package/dist/storybook/assets/radio-button.stories-B84Ip3NV.js +0 -61
- package/dist/storybook/assets/react-router-dom-CMITYWBH.js +0 -8
- package/dist/storybook/assets/select-78sreKsp.js +0 -40
- package/dist/storybook/assets/select.stories-CZwsHVDB.js +0 -914
- package/dist/storybook/assets/text-link.stories-BsuVBOWo.js +0 -14
- package/dist/storybook/assets/toaster-DPbde9Mi.js +0 -1
- package/dist/storybook/assets/toaster.stories-DfbfDavp.js +0 -86
- package/dist/storybook/assets/toggle.stories-D44S3Nix.js +0 -117
- package/dist/storybook/assets/top-bar.stories-BYN9rcUw.js +0 -21
- package/dist/storybook/assets/unit-table.stories-DXies3fA.js +0 -150
- /package/dist/storybook/sb-addons/{storybook-dark-mode-esm-preset-2 → interactions-2}/manager-bundle.js.LEGAL.txt +0 -0
- /package/dist/storybook/sb-addons/{storybook-dark-mode-esm-preset-2 → storybook-dark-mode-esm-preset-3}/manager-bundle.js +0 -0
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-eps93zm2.js";import{H as E,L as i,S as j,R as c}from"./react-router-dom-CMITYWBH.js";import{F as y}from"./flex-EllkLxgO.js";import{T as S}from"./text-B3-TSWok.js";import"./index-DhsZuJvc.js";import"./inheritsLoose-DR8r8Ogv.js";import"./index-CEuq6vkz.js";import"./extends-CF3RwP-h.js";import"./tiny-invariant-DqLgxztJ.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./index-Bk2sglWO.js";const s=({children:a,href:o=void 0,target:T=void 0,testId:R,onClick:L,component:v="a"})=>e.jsx(v,{href:o,to:o,target:T,onClick:L,"data-testid":R,children:e.jsx(S,{link:!0,children:a})});s.__docgenInfo={description:"",methods:[],displayName:"TextLink",props:{href:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"undefined",computed:!0}},target:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"undefined",computed:!0}},testId:{required:!1,tsType:{name:"string"},description:""},onClick:{required:!1,tsType:{name:"signature",type:"function",raw:"(e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void",signature:{arguments:[{type:{name:"ReactMouseEvent",raw:"React.MouseEvent<HTMLAnchorElement, MouseEvent>",elements:[{name:"HTMLAnchorElement"},{name:"MouseEvent"}]},name:"e"}],return:{name:"void"}}},description:""},children:{required:!1,tsType:{name:"ReactReactNode",raw:"React.ReactNode"},description:""},component:{required:!1,tsType:{name:"ReactElementType",raw:"React.ElementType"},description:"",defaultValue:{value:"'a'",computed:!1}}}};const I={title:"Basic/TextLink",component:s,args:{children:"Link text goes here",href:"http://oliasoft.com"}},k=a=>e.jsx(s,{...a}),n=k.bind({}),t=k.bind({});t.args={href:void 0,onClick:()=>console.log("Clicked!")};const r=()=>e.jsxs(E,{children:[e.jsxs(y,{gap:!0,children:[e.jsx(s,{component:i,href:"/dashboard",children:"Dashboard"}),e.jsx(s,{component:i,href:"/settings",children:"Settings"})]}),e.jsxs(j,{children:[e.jsx(c,{path:"/dashboard",children:"Dashboard"}),e.jsx(c,{path:"/settings",children:"Settings"})]})]});r.__docgenInfo={description:"",methods:[],displayName:"AsRouterLink"};var d,p,m;n.parameters={...n.parameters,docs:{...(d=n.parameters)==null?void 0:d.docs,source:{originalSource:"args => <TextLink {...args} />",...(m=(p=n.parameters)==null?void 0:p.docs)==null?void 0:m.source}}};var u,l,h;t.parameters={...t.parameters,docs:{...(u=t.parameters)==null?void 0:u.docs,source:{originalSource:"args => <TextLink {...args} />",...(h=(l=t.parameters)==null?void 0:l.docs)==null?void 0:h.source}}};var g,f,x;r.parameters={...r.parameters,docs:{...(g=r.parameters)==null?void 0:g.docs,source:{originalSource:`() => <HashRouter>
|
|
2
|
-
<Flex gap>
|
|
3
|
-
<TextLink component={Link} href="/dashboard">
|
|
4
|
-
Dashboard
|
|
5
|
-
</TextLink>
|
|
6
|
-
<TextLink component={Link} href="/settings">
|
|
7
|
-
Settings
|
|
8
|
-
</TextLink>
|
|
9
|
-
</Flex>
|
|
10
|
-
<Switch>
|
|
11
|
-
<Route path="/dashboard">Dashboard</Route>
|
|
12
|
-
<Route path="/settings">Settings</Route>
|
|
13
|
-
</Switch>
|
|
14
|
-
</HashRouter>`,...(x=(f=r.parameters)==null?void 0:f.docs)==null?void 0:x.source}}};const O=["Default","OnClick","AsRouterLink"];export{r as AsRouterLink,n as Default,t as OnClick,O as __namedExportsOrder,I as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as c}from"./jsx-runtime-eps93zm2.js";import{t,S as f}from"./toaster-7wnI6hqB.js";import{a as r,M as d,D as E}from"./message-ttrR1AaP.js";const m=({id:s,message:e={type:r.INFO,content:""},autoClose:o=6e3,onClose:a})=>{const{type:p=r.INFO}=e??{},u=({closeToast:l})=>c.jsx(E,{type:p,onClose:l,isInToast:!0}),i=c.jsx(d,{message:{...e,visible:!0,width:"100%",maxHeight:"500px",withDismiss:!1}}),n=(()=>{switch(e==null?void 0:e.type){case r.SUCCESS:return t.TYPE.SUCCESS;case r.WARNING:return t.TYPE.WARNING;case r.ERROR:return t.TYPE.ERROR;default:return t.TYPE.INFO}})();return s!==void 0&&t.isActive(s)?t.update(s,{render:i,autoClose:o,onClose:a,type:n}):t(i,{toastId:s,autoClose:o,onClose:a,hideProgressBar:o===!1,icon:!1,closeOnClick:!1,pauseOnHover:!0,draggable:!1,closeButton:u,transition:f,type:n})},x=s=>{t.dismiss(s)};export{x as d,m as t};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./jsx-runtime-eps93zm2.js";import{G as w}from"./grid-B6LFPf51.js";import{T as d}from"./text-B3-TSWok.js";import{F as v}from"./flex-EllkLxgO.js";import{t,d as u}from"./toaster-DPbde9Mi.js";import{B as o}from"./button-_0DiND6h.js";import{S as l}from"./spacer-BWoNR27H.js";import{a as m}from"./message-ttrR1AaP.js";import"./index-DhsZuJvc.js";import"./styled-components.browser.esm-Bf0q9Yjk.js";import"./index-Bk2sglWO.js";import"./toaster-7wnI6hqB.js";import"./index-CUZDtIZe.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./spinner-AWUe4xwQ.js";import"./icon-BP4BO6-k.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DR8r8Ogv.js";import"./index-CEuq6vkz.js";import"./tooltip-C_E_6ym5.js";const O={type:m.SUCCESS,icon:!0,heading:"Heading",content:"Great results"},A={type:m.ERROR,icon:!0,heading:"Heading",content:"An error has happened",details:"Bad input data lorem ipsum dolor est compendum lorem ipsum."},F={type:m.WARNING,icon:!0,heading:"Heading",content:"Warning message"},B={type:m.INFO,icon:!0,heading:"Heading",content:"Long content lorem ipsum dolor est compendum lorem ipsum."},ts={title:"Modals/Toaster",parameters:{docs:{story:{inline:!1,iframeHeight:400}}},source:{type:"code"},args:{id:void 0,message:B,autoClose:6e3,onClose:()=>{}}},G=()=>s.jsxs(s.Fragment,{children:[s.jsx(o,{label:"Info",onClick:()=>t({message:B,onClose:()=>console.log("toast closed")})}),s.jsx(l,{}),s.jsx(o,{label:"Error",onClick:()=>t({message:A,onClose:()=>console.log("toast closed")})}),s.jsx(l,{}),s.jsx(o,{label:"Warning",onClick:()=>t({message:F,onClose:()=>console.log("toast closed")})}),s.jsx(l,{}),s.jsx(o,{label:"Success",onClick:()=>t({message:O,onClose:()=>console.log("toast closed")})})]}),c=G.bind({}),n=()=>s.jsx(o,{label:"Show Toast",onClick:()=>{const e=Math.random()>=.5;t({message:{type:e?"Success":"Error",icon:!0,content:e?"Success":"Error"},onClose:()=>console.log("toast closed"),id:"uniqueId"})}});n.parameters={docs:{iframeHeight:200,description:{story:"Pass a unique `id` in the `toast` object to prevent duplicates. Successive toasts with the same ID will update the existing toast."}}};const a=()=>{const e="sessionExpiring",p={type:"Info",content:s.jsxs(w,{children:[s.jsx(d,{bold:!0,children:"You will be signed out soon"}),s.jsx(d,{children:"For your security, you will be automatically signed out in 30 minutes unless you extend your session."}),s.jsx(l,{height:"var(--padding-xxs)"}),s.jsxs(v,{gap:"var(--padding-xs)",children:[s.jsx(o,{label:"Extend session",small:!0,colored:"success",onClick:()=>u(e)}),s.jsx(o,{label:"Dismiss",small:!0,onClick:()=>u(e)})]})]})};return s.jsx(o,{label:"Show Toast",onClick:()=>t({message:p,autoClose:!1,id:e})})},r=()=>{const e="sessionExpiringSoon",p={type:"Error",content:s.jsxs(w,{children:[s.jsx(d,{bold:!0,children:"You will be signed out very soon"}),s.jsx(d,{children:"For your security, you will be automatically signed out in 30 minutes unless you extend your session."}),s.jsx(l,{height:"var(--padding-xxs)"}),s.jsxs(v,{gap:"var(--padding-xs)",children:[s.jsx(o,{label:"Extend session",small:!0,colored:"success",onClick:()=>u(e)}),s.jsx(o,{label:"Dismiss",small:!0,onClick:()=>u(e)})]})]})};return s.jsx(o,{label:"Show Toast",onClick:()=>t({message:p,autoClose:!1,id:e})})},i=()=>{const e={type:"Success",content:"Your session has been extended for 1 hour"};return s.jsx(o,{label:"Show Toast",onClick:()=>t({message:e})})};n.__docgenInfo={description:"",methods:[],displayName:"PreventDuplicates"};a.__docgenInfo={description:"",methods:[],displayName:"SessionExpiring"};r.__docgenInfo={description:"",methods:[],displayName:"SessionExpiringSoon"};i.__docgenInfo={description:"",methods:[],displayName:"SessionExtended"};var g,x,S;c.parameters={...c.parameters,docs:{...(g=c.parameters)==null?void 0:g.docs,source:{originalSource:`() => {
|
|
2
|
-
return <>
|
|
3
|
-
<Button label="Info" onClick={() => toast({
|
|
4
|
-
message: messageInfo,
|
|
5
|
-
onClose: () => console.log('toast closed')
|
|
6
|
-
})} />
|
|
7
|
-
<Spacer />
|
|
8
|
-
<Button label="Error" onClick={() => toast({
|
|
9
|
-
message: messageError,
|
|
10
|
-
onClose: () => console.log('toast closed')
|
|
11
|
-
})} />
|
|
12
|
-
<Spacer />
|
|
13
|
-
<Button label="Warning" onClick={() => toast({
|
|
14
|
-
message: messageWarning,
|
|
15
|
-
onClose: () => console.log('toast closed')
|
|
16
|
-
})} />
|
|
17
|
-
<Spacer />
|
|
18
|
-
<Button label="Success" onClick={() => toast({
|
|
19
|
-
message: messageSuccess,
|
|
20
|
-
onClose: () => console.log('toast closed')
|
|
21
|
-
})} />
|
|
22
|
-
</>;
|
|
23
|
-
}`,...(S=(x=c.parameters)==null?void 0:x.docs)==null?void 0:S.source}}};var y,T,h;n.parameters={...n.parameters,docs:{...(y=n.parameters)==null?void 0:y.docs,source:{originalSource:`() => <Button label="Show Toast" onClick={() => {
|
|
24
|
-
const isSuccess = Math.random() >= 0.5;
|
|
25
|
-
toast({
|
|
26
|
-
message: ({
|
|
27
|
-
type: isSuccess ? 'Success' : 'Error',
|
|
28
|
-
icon: true,
|
|
29
|
-
content: isSuccess ? 'Success' : 'Error'
|
|
30
|
-
} as IMessageType),
|
|
31
|
-
onClose: () => console.log('toast closed'),
|
|
32
|
-
id: 'uniqueId'
|
|
33
|
-
});
|
|
34
|
-
}} />`,...(h=(T=n.parameters)==null?void 0:T.docs)==null?void 0:h.source}}};var C,b,E;a.parameters={...a.parameters,docs:{...(C=a.parameters)==null?void 0:C.docs,source:{originalSource:`() => {
|
|
35
|
-
const TOAST_ID = 'sessionExpiring';
|
|
36
|
-
const message = ({
|
|
37
|
-
type: 'Info',
|
|
38
|
-
content: <Grid>
|
|
39
|
-
<Text bold>You will be signed out soon</Text>
|
|
40
|
-
<Text>
|
|
41
|
-
For your security, you will be automatically signed out in 30 minutes
|
|
42
|
-
unless you extend your session.
|
|
43
|
-
</Text>
|
|
44
|
-
<Spacer height="var(--padding-xxs)" />
|
|
45
|
-
<Flex gap="var(--padding-xs)">
|
|
46
|
-
<Button label="Extend session" small colored="success" onClick={() => dismissToast(TOAST_ID)} />
|
|
47
|
-
<Button label="Dismiss" small onClick={() => dismissToast(TOAST_ID)} />
|
|
48
|
-
</Flex>
|
|
49
|
-
</Grid>
|
|
50
|
-
} as IMessageType);
|
|
51
|
-
return <Button label="Show Toast" onClick={() => toast({
|
|
52
|
-
message,
|
|
53
|
-
autoClose: false,
|
|
54
|
-
id: TOAST_ID
|
|
55
|
-
})} />;
|
|
56
|
-
}`,...(E=(b=a.parameters)==null?void 0:b.docs)==null?void 0:E.source}}};var f,j,I;r.parameters={...r.parameters,docs:{...(f=r.parameters)==null?void 0:f.docs,source:{originalSource:`() => {
|
|
57
|
-
const TOAST_ID = 'sessionExpiringSoon';
|
|
58
|
-
const message = ({
|
|
59
|
-
type: 'Error',
|
|
60
|
-
content: <Grid>
|
|
61
|
-
<Text bold>You will be signed out very soon</Text>
|
|
62
|
-
<Text>
|
|
63
|
-
For your security, you will be automatically signed out in 30 minutes
|
|
64
|
-
unless you extend your session.
|
|
65
|
-
</Text>
|
|
66
|
-
<Spacer height="var(--padding-xxs)" />
|
|
67
|
-
<Flex gap="var(--padding-xs)">
|
|
68
|
-
<Button label="Extend session" small colored="success" onClick={() => dismissToast(TOAST_ID)} />
|
|
69
|
-
<Button label="Dismiss" small onClick={() => dismissToast(TOAST_ID)} />
|
|
70
|
-
</Flex>
|
|
71
|
-
</Grid>
|
|
72
|
-
} as IMessageType);
|
|
73
|
-
return <Button label="Show Toast" onClick={() => toast({
|
|
74
|
-
message,
|
|
75
|
-
autoClose: false,
|
|
76
|
-
id: TOAST_ID
|
|
77
|
-
})} />;
|
|
78
|
-
}`,...(I=(j=r.parameters)==null?void 0:j.docs)==null?void 0:I.source}}};var k,_,D;i.parameters={...i.parameters,docs:{...(k=i.parameters)==null?void 0:k.docs,source:{originalSource:`() => {
|
|
79
|
-
const message = ({
|
|
80
|
-
type: 'Success',
|
|
81
|
-
content: 'Your session has been extended for 1 hour'
|
|
82
|
-
} as IMessageType);
|
|
83
|
-
return <Button label="Show Toast" onClick={() => toast({
|
|
84
|
-
message
|
|
85
|
-
})} />;
|
|
86
|
-
}`,...(D=(_=i.parameters)==null?void 0:_.docs)==null?void 0:D.source}}};const ns=["Default","PreventDuplicates","SessionExpiring","SessionExpiringSoon","SessionExtended"];export{c as Default,n as PreventDuplicates,a as SessionExpiring,r as SessionExpiringSoon,i as SessionExtended,ns as __namedExportsOrder,ts as default};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as X}from"./index-DhsZuJvc.js";import{F as C}from"./flex-EllkLxgO.js";import{T as i}from"./text-B3-TSWok.js";import{T as p}from"./toggle-t1iTuSL7.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./help-icon-LfPZiYla.js";import"./tooltip-C_E_6ym5.js";import"./index-CUZDtIZe.js";import"./icon-BP4BO6-k.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DR8r8Ogv.js";import"./index-CEuq6vkz.js";const{useArgs:Z}=__STORYBOOK_MODULE_PREVIEW_API__,ue={title:"Forms/Toggle",component:p,args:{label:"Label"}},n=u=>{const[{checked:m},x]=Z(),b=()=>{x({checked:!m})};return e.jsx(p,{...u,onChange:b})},h=n.bind({}),s=n.bind({});s.args={disabled:!0};const a=n.bind({});a.args={checked:!0,disabled:!0};const r=n.bind({});r.args={small:!0};const t=n.bind({});t.args={label:null};const c=n.bind({});c.args={helpText:"Help text"};const o=n.bind({});o.args={onClickHelp:()=>console.log("Help clicked")};const d=()=>e.jsxs(e.Fragment,{children:[e.jsx(p,{display:"block",label:e.jsxs(C,{justifyContent:"space-between",wrap:!1,gap:!0,children:[e.jsx(i,{bold:!0,children:"Label"}),e.jsx(i,{success:!0,children:"Released yesterday"})]}),onChange:()=>{}}),e.jsx(p,{label:e.jsxs(C,{justifyContent:"space-between",wrap:!1,gap:!0,children:[e.jsx(i,{bold:!0,children:"Label"}),e.jsx(i,{success:!0,children:"Released yesterday"})]}),onChange:()=>{}})]}),l=()=>{const[u,m]=X.useState(!1);return e.jsx(p,{name:"name",label:"Label",checked:u,onChange:x=>{const{name:b,value:Q,checked:k}=x.target;m(k),console.log(b,Q,k)}})},g=n.bind({});g.args={helpText:"Help text",disabled:!0};d.__docgenInfo={description:"",methods:[],displayName:"Display"};l.__docgenInfo={description:"",methods:[],displayName:"TestClickevt"};var T,A,j;h.parameters={...h.parameters,docs:{...(T=h.parameters)==null?void 0:T.docs,source:{originalSource:`args => {
|
|
2
|
-
const [{
|
|
3
|
-
checked
|
|
4
|
-
}, updateArgs] = useArgs();
|
|
5
|
-
const handleChange = () => {
|
|
6
|
-
updateArgs({
|
|
7
|
-
checked: !checked
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
return <Toggle
|
|
11
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
12
|
-
{...args} onChange={handleChange} />;
|
|
13
|
-
}`,...(j=(A=h.parameters)==null?void 0:A.docs)==null?void 0:j.source}}};var f,y,S;s.parameters={...s.parameters,docs:{...(f=s.parameters)==null?void 0:f.docs,source:{originalSource:`args => {
|
|
14
|
-
const [{
|
|
15
|
-
checked
|
|
16
|
-
}, updateArgs] = useArgs();
|
|
17
|
-
const handleChange = () => {
|
|
18
|
-
updateArgs({
|
|
19
|
-
checked: !checked
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
return <Toggle
|
|
23
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
24
|
-
{...args} onChange={handleChange} />;
|
|
25
|
-
}`,...(S=(y=s.parameters)==null?void 0:y.docs)==null?void 0:S.source}}};var _,D,H;a.parameters={...a.parameters,docs:{...(_=a.parameters)==null?void 0:_.docs,source:{originalSource:`args => {
|
|
26
|
-
const [{
|
|
27
|
-
checked
|
|
28
|
-
}, updateArgs] = useArgs();
|
|
29
|
-
const handleChange = () => {
|
|
30
|
-
updateArgs({
|
|
31
|
-
checked: !checked
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
return <Toggle
|
|
35
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
36
|
-
{...args} onChange={handleChange} />;
|
|
37
|
-
}`,...(H=(D=a.parameters)==null?void 0:D.docs)==null?void 0:H.source}}};var v,w,F;r.parameters={...r.parameters,docs:{...(v=r.parameters)==null?void 0:v.docs,source:{originalSource:`args => {
|
|
38
|
-
const [{
|
|
39
|
-
checked
|
|
40
|
-
}, updateArgs] = useArgs();
|
|
41
|
-
const handleChange = () => {
|
|
42
|
-
updateArgs({
|
|
43
|
-
checked: !checked
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
return <Toggle
|
|
47
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
48
|
-
{...args} onChange={handleChange} />;
|
|
49
|
-
}`,...(F=(w=r.parameters)==null?void 0:w.docs)==null?void 0:F.source}}};var L,O,R;t.parameters={...t.parameters,docs:{...(L=t.parameters)==null?void 0:L.docs,source:{originalSource:`args => {
|
|
50
|
-
const [{
|
|
51
|
-
checked
|
|
52
|
-
}, updateArgs] = useArgs();
|
|
53
|
-
const handleChange = () => {
|
|
54
|
-
updateArgs({
|
|
55
|
-
checked: !checked
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
return <Toggle
|
|
59
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
60
|
-
{...args} onChange={handleChange} />;
|
|
61
|
-
}`,...(R=(O=t.parameters)==null?void 0:O.docs)==null?void 0:R.source}}};var E,I,W;c.parameters={...c.parameters,docs:{...(E=c.parameters)==null?void 0:E.docs,source:{originalSource:`args => {
|
|
62
|
-
const [{
|
|
63
|
-
checked
|
|
64
|
-
}, updateArgs] = useArgs();
|
|
65
|
-
const handleChange = () => {
|
|
66
|
-
updateArgs({
|
|
67
|
-
checked: !checked
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
return <Toggle
|
|
71
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
72
|
-
{...args} onChange={handleChange} />;
|
|
73
|
-
}`,...(W=(I=c.parameters)==null?void 0:I.docs)==null?void 0:W.source}}};var N,P,B;o.parameters={...o.parameters,docs:{...(N=o.parameters)==null?void 0:N.docs,source:{originalSource:`args => {
|
|
74
|
-
const [{
|
|
75
|
-
checked
|
|
76
|
-
}, updateArgs] = useArgs();
|
|
77
|
-
const handleChange = () => {
|
|
78
|
-
updateArgs({
|
|
79
|
-
checked: !checked
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
return <Toggle
|
|
83
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
84
|
-
{...args} onChange={handleChange} />;
|
|
85
|
-
}`,...(B=(P=o.parameters)==null?void 0:P.docs)==null?void 0:B.source}}};var K,M,U;d.parameters={...d.parameters,docs:{...(K=d.parameters)==null?void 0:K.docs,source:{originalSource:`() => <>
|
|
86
|
-
<Toggle display="block" label={<Flex justifyContent="space-between" wrap={false} gap>
|
|
87
|
-
<Text bold>Label</Text>
|
|
88
|
-
<Text success>Released yesterday</Text>
|
|
89
|
-
</Flex>} onChange={() => {}} />
|
|
90
|
-
<Toggle label={<Flex justifyContent="space-between" wrap={false} gap>
|
|
91
|
-
<Text bold>Label</Text>
|
|
92
|
-
<Text success>Released yesterday</Text>
|
|
93
|
-
</Flex>} onChange={() => {}} />
|
|
94
|
-
</>`,...(U=(M=d.parameters)==null?void 0:M.docs)==null?void 0:U.source}}};var V,Y,q;l.parameters={...l.parameters,docs:{...(V=l.parameters)==null?void 0:V.docs,source:{originalSource:`() => {
|
|
95
|
-
const [checked, setChecked] = useState(false);
|
|
96
|
-
return <Toggle name="name" label="Label" checked={checked} onChange={evt => {
|
|
97
|
-
const {
|
|
98
|
-
name,
|
|
99
|
-
value,
|
|
100
|
-
checked
|
|
101
|
-
} = evt.target;
|
|
102
|
-
setChecked(checked);
|
|
103
|
-
console.log(name, value, checked);
|
|
104
|
-
}} />;
|
|
105
|
-
}`,...(q=(Y=l.parameters)==null?void 0:Y.docs)==null?void 0:q.source}}};var z,G,J;g.parameters={...g.parameters,docs:{...(z=g.parameters)==null?void 0:z.docs,source:{originalSource:`args => {
|
|
106
|
-
const [{
|
|
107
|
-
checked
|
|
108
|
-
}, updateArgs] = useArgs();
|
|
109
|
-
const handleChange = () => {
|
|
110
|
-
updateArgs({
|
|
111
|
-
checked: !checked
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
return <Toggle
|
|
115
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
116
|
-
{...args} onChange={handleChange} />;
|
|
117
|
-
}`,...(J=(G=g.parameters)==null?void 0:G.docs)==null?void 0:J.source}}};const me=["Default","Disabled","DisabledChecked","Small","Standalone","HelpText","OnClickHelp","Display","TestClickevt","DisabledWithHelpText"];export{h as Default,s as Disabled,a as DisabledChecked,g as DisabledWithHelpText,d as Display,c as HelpText,o as OnClickHelp,r as Small,t as Standalone,l as TestClickevt,me as __namedExportsOrder,ue as default};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-eps93zm2.js";import{H as I,L as c,S as D,R as l}from"./react-router-dom-CMITYWBH.js";import{I as O,T as A}from"./common-types-Sih75Sav.js";import{T as p}from"./top-bar-R-CjhJ21.js";import{P as w}from"./page-7SSpdYhb.js";import{M as N}from"./actions-Cu_0szZ4.js";import{B as m}from"./button-_0DiND6h.js";import{B as P}from"./badge-CLQ59MDF.js";import{L as v}from"./logo-BVP9045W.js";import{s as H}from"./icon-custom-Xcl4YkWP.js";import{M as s}from"./types-BmbYqTX_.js";import"./index-DhsZuJvc.js";import"./inheritsLoose-DR8r8Ogv.js";import"./index-CEuq6vkz.js";import"./extends-CF3RwP-h.js";import"./tiny-invariant-DqLgxztJ.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./index-Bk2sglWO.js";import"./icon-BP4BO6-k.js";import"./disabled-context-rmpd7YJS.js";import"./lodash-BHd_uQHh.js";import"./tooltip-C_E_6ym5.js";import"./index-CUZDtIZe.js";import"./types-UmZ4Y_CR.js";import"./spinner-AWUe4xwQ.js";const M=[{type:"Link",label:"Link",onClick:()=>{}},{type:"Link",label:"Active",active:!0,onClick:()=>{}},{type:"Link",label:"Disabled",disabled:!0,onClick:()=>{}},{type:"Menu",label:"Dropdown",onClick:()=>{},sections:[{type:"Option",label:"Alpacas",onClick:()=>{}},{type:"Option",label:"Llamas",onClick:()=>{}}]},{type:"Button",label:"Save",colored:!0,onClick:()=>{},testId:"top-bar-button-save"}],E=[{type:"Component",component:e.jsx(P,{title:"3",small:!0,margin:"5px",children:e.jsx(m,{icon:O.NOTIFICATION,round:!0,onClick:()=>{}})})},{type:"Component",component:e.jsx(N,{menu:{trigger:A.COMPONENT,fullHeightTrigger:!0,placement:"bottom-end",component:e.jsx(m,{label:"TU",round:!0,onClick:()=>{}}),sections:[{type:s.HEADING,label:"Test User"},{type:s.OPTION,label:"Profile",icon:"user",onClick:()=>{}},{type:s.DIVIDER},{type:s.OPTION,label:"Sign out",icon:"lock",onClick:()=>{}}]}})}],le={title:"Navigation/TopBar",component:p,parameters:{layout:"fullscreen",docs:{story:{inline:!1,iframeHeight:400}}},argTypes:{height:{control:"text"}},args:{title:{logo:e.jsx("img",{src:v,alt:"logo"}),onClick:()=>{}},content:M,contentRight:E}},i=j=>e.jsx(p,{...j}),n=i.bind({}),t=i.bind({});t.args={warning:"Application update available. Please refresh your browser."};const r=i.bind({});r.args={title:{label:"Text Branding",onClick:()=>{}}};const o=i.bind({});o.args={appSwitcher:{icon:H,onClick:()=>{}}};const a=()=>e.jsx(I,{children:e.jsxs(w,{left:0,children:[e.jsx(p,{content:[{type:"Link",label:"Dashboard",component:c,url:"/dashboard"},{type:"Link",label:"Settings",component:c,url:"/settings"}]}),e.jsxs(D,{children:[e.jsx(l,{path:"/dashboard",children:"Dashboard"}),e.jsx(l,{path:"/settings",children:"Settings"})]})]})});a.__docgenInfo={description:"",methods:[],displayName:"AsRouterLink"};var d,u,g;n.parameters={...n.parameters,docs:{...(d=n.parameters)==null?void 0:d.docs,source:{originalSource:"args => <TopBar {...args} />",...(g=(u=n.parameters)==null?void 0:u.docs)==null?void 0:g.source}}};var h,b,k;t.parameters={...t.parameters,docs:{...(h=t.parameters)==null?void 0:h.docs,source:{originalSource:"args => <TopBar {...args} />",...(k=(b=t.parameters)==null?void 0:b.docs)==null?void 0:k.source}}};var T,y,f;r.parameters={...r.parameters,docs:{...(T=r.parameters)==null?void 0:T.docs,source:{originalSource:"args => <TopBar {...args} />",...(f=(y=r.parameters)==null?void 0:y.docs)==null?void 0:f.source}}};var x,S,C;o.parameters={...o.parameters,docs:{...(x=o.parameters)==null?void 0:x.docs,source:{originalSource:"args => <TopBar {...args} />",...(C=(S=o.parameters)==null?void 0:S.docs)==null?void 0:C.source}}};var L,B,R;a.parameters={...a.parameters,docs:{...(L=a.parameters)==null?void 0:L.docs,source:{originalSource:`() => {
|
|
2
|
-
return <HashRouter>
|
|
3
|
-
<Page left={0}>
|
|
4
|
-
<TopBar content={[{
|
|
5
|
-
type: 'Link',
|
|
6
|
-
label: 'Dashboard',
|
|
7
|
-
component: Link,
|
|
8
|
-
url: '/dashboard'
|
|
9
|
-
}, {
|
|
10
|
-
type: 'Link',
|
|
11
|
-
label: 'Settings',
|
|
12
|
-
component: Link,
|
|
13
|
-
url: '/settings'
|
|
14
|
-
}]} />
|
|
15
|
-
<Switch>
|
|
16
|
-
<Route path="/dashboard">Dashboard</Route>
|
|
17
|
-
<Route path="/settings">Settings</Route>
|
|
18
|
-
</Switch>
|
|
19
|
-
</Page>
|
|
20
|
-
</HashRouter>;
|
|
21
|
-
}`,...(R=(B=a.parameters)==null?void 0:B.docs)==null?void 0:R.source}}};const me=["Default","WithWarning","TextBranding","AppSwitcher","AsRouterLink"];export{o as AppSwitcher,a as AsRouterLink,n as Default,r as TextBranding,t as WithWarning,me as __namedExportsOrder,le as default};
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import{j as n}from"./jsx-runtime-eps93zm2.js";import{r as v}from"./index-DhsZuJvc.js";import{f as z}from"./immer.esm-BwVl9PS2.js";import{d as U}from"./index-DQs5XS8h.js";import{G as Z}from"./grid-B6LFPf51.js";import{S as ee}from"./spacer-BWoNR27H.js";import{C as F}from"./card-EcjmryU9.js";import{F as L}from"./field-DwLk_uWj.js";import{H as W}from"./heading-DkSFysAb.js";import{S as P}from"./select-78sreKsp.js";import{T as I}from"./toggle-t1iTuSL7.js";import{l as te}from"./lodash-BHd_uQHh.js";import{u as ne}from"./use-previous-D775JrO6.js";import{T as ae,C as _}from"./table-DPvzYjoq.js";import"./index-DRSy5Ssd.js";import"./styled-components.browser.esm-Bf0q9Yjk.js";import"./index-Bk2sglWO.js";import"./label-tWjEmTQJ.js";import"./common-types-Sih75Sav.js";import"./help-icon-LfPZiYla.js";import"./tooltip-C_E_6ym5.js";import"./index-CUZDtIZe.js";import"./icon-BP4BO6-k.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DR8r8Ogv.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./types-UmZ4Y_CR.js";import"./extends-CF3RwP-h.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-Cu_0szZ4.js";import"./button-_0DiND6h.js";import"./spinner-AWUe4xwQ.js";import"./badge-CLQ59MDF.js";import"./select.input-DIKP56UZ.js";import"./index.es-D2piFfFj.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./pagination-DSQeMPG_.js";import"./input-D97ganXq.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./number-input-B-Nmya5O.js";import"./check-box-DkdQxC5c.js";import"./slider-CxVlS0fh.js";import"./index-BI4_Bp97.js";import"./popover-Dq3iC_lM.js";const ie=l=>l.reduce(({preferredUnits:i,storageUnits:r},{unitKey:s,preferredUnit:a,storageUnit:h})=>(i[s]=a,r[s]=h,{preferredUnits:i,storageUnits:r}),{preferredUnits:{},storageUnits:{}}),re=({headers:l,rows:i,selectedUnits:r,storageUnits:s,onChangeUnit:a,convertBackToStorageUnit:h,enableCosmeticRounding:g,enableDisplayRounding:y})=>{const u=l?l.map(d=>({...d,cells:d.cells.map(c=>{var t;if(c.type===_.AUTO_UNIT){const{testId:C,unitKey:p}=c;return{value:r[p],type:_.SELECT,searchable:!1,options:(t=U.getUnitsForQuantity(p))==null?void 0:t.map(T=>({label:U.label(T),value:T})),native:c.native,onChange:T=>a({unitKey:p,value:T.target.value}),testId:C}}return c})})):[],o=i?i.map((d,c)=>({...d,cells:d.cells.map((t,C)=>{if("autoUnit"in t&&(t!=null&&t.autoUnit)&&(typeof(t==null?void 0:t.value)=="string"||typeof(t==null?void 0:t.value)=="number")){const{unitKey:p,value:T,formatDisplayValue:w}=t,j=y&&"roundDisplayValue"in t?t==null?void 0:t.roundDisplayValue:null,m=r[p],b=s[p],e=m!==b,f=e?U.convertAndGetValue(T,m,b):t.value,x=U.isScientificStringNum(T),D=g&&(e||!x)?U.roundToPrecision(f,14):f,R=w?w(D):D;return{...t,value:R,enableCosmeticRounding:g,enableDisplayRounding:y,roundDisplayValue:j,onChange:S=>{const{value:B}=S.target,A=s[p],E=r[p],N=E!==A,k=h?A:E,$=N?U.convertAndGetValue(B,k,E):B;if("onChange"in t){const{onChange:X}=t,Y={...S,target:{...S.target,value:String($),rowIndex:c,cellIndex:C,unit:k}};X(Y)}}}}return t})})):[];return{convertedHeaders:u,convertedRows:o}},M=({table:l,unitConfig:i,convertBackToStorageUnit:r=!0,enableCosmeticRounding:s=!0,enableDisplayRounding:a=!0})=>{const{rows:h,headers:g,...y}=l,{storageUnits:u,preferredUnits:o}=ie(i),d=ne(o),[c,t]=v.useState(o),C=({unitKey:m,value:b})=>{t({...c,[m]:b});const e=i.find(f=>f.unitKey===m);e&&typeof e.onChange=="function"&&e.onChange({oldUnit:c[m],newUnit:b,unitKey:m})},p=m=>re({headers:g,rows:h,selectedUnits:m,storageUnits:u,onChangeUnit:C,convertBackToStorageUnit:r,enableCosmeticRounding:s,enableDisplayRounding:a}),T=p(c),[w,j]=v.useState(T);return v.useEffect(()=>{!te.isEqual(o,d)&&(Object.keys(o).forEach(b=>{const e=d==null?void 0:d[b],f=o[b];e!==f&&C({unitKey:b,value:f})}),j(p(o)))},[i]),v.useEffect(()=>{j(p(c))},[l,c]),n.jsx(ae,{table:{...y,headers:w.convertedHeaders,rows:w.convertedRows}})};M.__docgenInfo={description:"",methods:[],displayName:"UnitTable",props:{table:{required:!0,tsType:{name:"IUnitTable"},description:""},unitConfig:{required:!0,tsType:{name:"Array",elements:[{name:"IUnitConfigItem"}],raw:"IUnitConfigItem[]"},description:""},convertBackToStorageUnit:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},enableCosmeticRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},enableDisplayRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}}},composes:["Omit"]};const pt={title:"Basic/UnitTable",args:{}},oe=!0,le=!0,se=!0,ue=!1,H="m",J="C",de=3,ce=(l,i,r)=>{const s=[i,i,r],a=[...Array(l)].map((h,g)=>{const y=g,u=g+1.25,o=4+g*.25;return[String(y),String(u),String(o)]});return[s,...a]},pe=ce(de,H,J),ge=({reduxTable:l,value:i,unit:r,rowIndex:s,cellIndex:a})=>z(l,h=>{const g=h[0][a],y=(u,o)=>o===0;return h.forEach((u,o)=>{if(y(u,o)){u[a]=r;return}if(o===s+1){u[a]=String(i);return}const d=U.convertAndGetValue(u[a],r,g);u[a]=String(d)}),h}),me=({reduxTable:l,value:i,rowIndex:r,cellIndex:s})=>z(l,a=>{a[r+1][s]=i}),V=()=>{var m,b;const[l,i]=v.useState(H),[r,s]=v.useState(J),[a,h]=v.useState(pe),[g,y]=v.useState(oe),[u,o]=v.useState(se),[d,c]=v.useState(le),[t,C]=v.useState(ue),[p,T]=v.useState(H),w=e=>{const{rowIndex:f,cellIndex:x,value:D,unit:R}=e.target,S=t?ge({reduxTable:a,value:D,unit:R,rowIndex:f,cellIndex:x}):me({reduxTable:a,value:D,rowIndex:f,cellIndex:x});h(S)},j=a.reduce((e,f,x)=>(x===0?e.headers=[{cells:[{value:"From"},{value:"To"},{value:"Temperature"}]},{cells:[{type:"AutoUnit",unitKey:"length"},{type:"AutoUnit",unitKey:"length"},{type:"AutoUnit",unitKey:"temperature",testId:"table-unit-selector-3"}]}]:e.rows=e.rows.concat({cells:f.map((D,R)=>{const S=x===1&&R===1;return{value:D,type:S?"Text":"NumberInput",unitKey:R===2?"temperature":"length",onChange:w,roundDisplayValue:x===3&&R===2?k=>U.roundByMagnitude(k,2):null,formatDisplayValue:S?k=>`T* ${k}`:null,autoUnit:!0}})}),e),{headers:[],rows:[]});return n.jsxs(Z,{columns:"1fr 1fr",gap:!0,children:[n.jsxs(F,{heading:n.jsx(W,{children:"Settings"}),children:[n.jsx(L,{label:"Convert back to storage unit:",labelLeft:!0,labelWidth:200,children:n.jsx(I,{checked:g,onChange:e=>y(e.target.checked)})}),n.jsx(L,{label:"Enable display rounding:",labelLeft:!0,labelWidth:200,children:n.jsx(I,{checked:u,onChange:e=>o(e.target.checked)})}),n.jsx(L,{label:"Enable cosmetic rounding:",labelLeft:!0,labelWidth:200,children:n.jsx(I,{checked:d,onChange:e=>c(e.target.checked)})}),n.jsx(L,{label:"Convert whole table:",labelLeft:!0,labelWidth:200,children:n.jsx(I,{checked:t,onChange:e=>C(e.target.checked)})})]}),n.jsxs(F,{heading:n.jsx(W,{children:"Unit template"}),children:[n.jsx(L,{label:"Length unit:",labelLeft:!0,labelWidth:120,children:n.jsx(P,{options:(m=U.getUnitsForQuantity("length"))==null?void 0:m.map(e=>({value:e,label:U.label(e)})),value:{value:l},onChange:e=>i(e.target.value),width:"100px"})}),n.jsx(L,{label:"Temperature unit:",labelLeft:!0,labelWidth:120,children:n.jsx(P,{options:(b=U.getUnitsForQuantity("temperature"))==null?void 0:b.map(e=>({value:e,label:U.label(e)})),value:{value:r},onChange:e=>s(e.target.value),width:"100px"})})]}),n.jsx(F,{heading:n.jsx(W,{children:"Storage State (Redux)"}),children:n.jsx("pre",{children:n.jsx("code",{children:JSON.stringify(a,null,2)})})}),n.jsxs(F,{heading:n.jsx(W,{children:"UnitTable"}),children:[n.jsx(M,{table:j,unitConfig:[{unitKey:"length",storageUnit:a[0][0],preferredUnit:l,onChange:({newUnit:e})=>T(e)},{unitKey:"temperature",storageUnit:a[0][2],preferredUnit:r}],convertBackToStorageUnit:g,enableDisplayRounding:u,enableCosmeticRounding:d}),n.jsx(ee,{height:20}),n.jsx(L,{label:"Displayed length unit:",labelLeft:!0,labelWidth:150,children:p})]})]})};V.__docgenInfo={description:"",methods:[],displayName:"UnitTablePrototype"};var K,G,O,q,Q;V.parameters={...V.parameters,docs:{...(K=V.parameters)==null?void 0:K.docs,source:{originalSource:`() => {
|
|
2
|
-
const [preferredLengthUnit, setPreferredLengthUnit] = useState(initialLengthUnit);
|
|
3
|
-
const [preferredTemperatureUnit, setPreferredTemperatureUnit] = useState(initialTemperatureUnit);
|
|
4
|
-
const [reduxTable, setReduxTable] = useState<TTable>(initialTable);
|
|
5
|
-
const [convertBackToStorageUnit, setConvertBackToStorageUnit] = useState(initialConvertBackToStorageUnit);
|
|
6
|
-
const [enableDisplayRounding, setEnableDisplayRounding] = useState(initialEnableDisplayRounding);
|
|
7
|
-
const [enableCosmeticRounding, setEnableCosmeticRounding] = useState(initialEnableCosmeticRounding);
|
|
8
|
-
const [convertWholeTable, setConvertWholeTable] = useState(initialConvertWholeTable);
|
|
9
|
-
const [displayedLengthUnit, setDisplayedLengthUnit] = useState(initialLengthUnit);
|
|
10
|
-
|
|
11
|
-
/*********************************************************************************************************************
|
|
12
|
-
Cell onChange handler
|
|
13
|
-
*********************************************************************************************************************/
|
|
14
|
-
const onUpdateCell = (evt: IUnitTableOnChangeEvent) => {
|
|
15
|
-
const {
|
|
16
|
-
rowIndex,
|
|
17
|
-
cellIndex,
|
|
18
|
-
value,
|
|
19
|
-
unit
|
|
20
|
-
} = evt.target;
|
|
21
|
-
const nextTable = convertWholeTable ? convertStorageTable({
|
|
22
|
-
reduxTable,
|
|
23
|
-
value,
|
|
24
|
-
unit,
|
|
25
|
-
rowIndex,
|
|
26
|
-
cellIndex
|
|
27
|
-
}) : updateCell({
|
|
28
|
-
reduxTable,
|
|
29
|
-
value,
|
|
30
|
-
rowIndex,
|
|
31
|
-
cellIndex
|
|
32
|
-
});
|
|
33
|
-
setReduxTable(nextTable);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/*********************************************************************************************************************
|
|
37
|
-
Construct table view data (same as old Table component, with a new props)
|
|
38
|
-
*********************************************************************************************************************/
|
|
39
|
-
const tableViewData = reduxTable.reduce((acc, row, rowIndex) => {
|
|
40
|
-
if (rowIndex === 0) {
|
|
41
|
-
acc.headers = [{
|
|
42
|
-
cells: [{
|
|
43
|
-
value: 'From'
|
|
44
|
-
}, {
|
|
45
|
-
value: 'To'
|
|
46
|
-
}, {
|
|
47
|
-
value: 'Temperature'
|
|
48
|
-
}]
|
|
49
|
-
}, {
|
|
50
|
-
cells: [{
|
|
51
|
-
type: 'AutoUnit',
|
|
52
|
-
unitKey: 'length'
|
|
53
|
-
}, {
|
|
54
|
-
type: 'AutoUnit',
|
|
55
|
-
unitKey: 'length'
|
|
56
|
-
}, {
|
|
57
|
-
type: 'AutoUnit',
|
|
58
|
-
unitKey: 'temperature',
|
|
59
|
-
testId: 'table-unit-selector-3'
|
|
60
|
-
}]
|
|
61
|
-
}];
|
|
62
|
-
} else {
|
|
63
|
-
acc.rows = acc.rows.concat({
|
|
64
|
-
cells: row.map((cell, cellIndex) => {
|
|
65
|
-
const specialCell = rowIndex === 1 && cellIndex === 1;
|
|
66
|
-
const type = specialCell ? 'Text' : 'NumberInput';
|
|
67
|
-
const formatDisplayValue = specialCell ? (value: number | string) => \`T* \${value}\` : null;
|
|
68
|
-
const customDisplayRounding = rowIndex === 3 && cellIndex === 2 ? (value: TStringNumberNull) => roundByMagnitude(value, 2) : null;
|
|
69
|
-
const value = cell;
|
|
70
|
-
return {
|
|
71
|
-
value,
|
|
72
|
-
type,
|
|
73
|
-
unitKey: cellIndex === 2 ? 'temperature' : 'length',
|
|
74
|
-
onChange: onUpdateCell,
|
|
75
|
-
roundDisplayValue: customDisplayRounding,
|
|
76
|
-
// optionally customize the display rounding of specific columns/cells
|
|
77
|
-
formatDisplayValue,
|
|
78
|
-
// optionally extend/customize the display formatting of specific columns/cells
|
|
79
|
-
autoUnit: true
|
|
80
|
-
};
|
|
81
|
-
})
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return acc;
|
|
85
|
-
}, {
|
|
86
|
-
headers: ([] as any[]),
|
|
87
|
-
rows: ([] as IUnitTableRow[])
|
|
88
|
-
});
|
|
89
|
-
return <Grid columns="1fr 1fr" gap>
|
|
90
|
-
<Card heading={<Heading>Settings</Heading>}>
|
|
91
|
-
<Field label="Convert back to storage unit:" labelLeft labelWidth={200}>
|
|
92
|
-
<Toggle checked={convertBackToStorageUnit} onChange={evt => setConvertBackToStorageUnit(evt.target.checked)} />
|
|
93
|
-
</Field>
|
|
94
|
-
<Field label="Enable display rounding:" labelLeft labelWidth={200}>
|
|
95
|
-
<Toggle checked={enableDisplayRounding} onChange={evt => setEnableDisplayRounding(evt.target.checked)} />
|
|
96
|
-
</Field>
|
|
97
|
-
<Field label="Enable cosmetic rounding:" labelLeft labelWidth={200}>
|
|
98
|
-
<Toggle checked={enableCosmeticRounding} onChange={evt => setEnableCosmeticRounding(evt.target.checked)} />
|
|
99
|
-
</Field>
|
|
100
|
-
<Field label="Convert whole table:" labelLeft labelWidth={200}>
|
|
101
|
-
<Toggle checked={convertWholeTable} onChange={evt => setConvertWholeTable(evt.target.checked)} />
|
|
102
|
-
</Field>
|
|
103
|
-
</Card>
|
|
104
|
-
<Card heading={<Heading>Unit template</Heading>}>
|
|
105
|
-
<Field label="Length unit:" labelLeft labelWidth={120}>
|
|
106
|
-
<Select options={getUnitsForQuantity('length')?.map(unit => ({
|
|
107
|
-
value: unit,
|
|
108
|
-
label: label(unit)
|
|
109
|
-
}))} value={{
|
|
110
|
-
value: preferredLengthUnit
|
|
111
|
-
}} onChange={evt => setPreferredLengthUnit(evt.target.value)} width="100px" />
|
|
112
|
-
</Field>
|
|
113
|
-
<Field label="Temperature unit:" labelLeft labelWidth={120}>
|
|
114
|
-
<Select options={getUnitsForQuantity('temperature')?.map(unit => ({
|
|
115
|
-
value: unit,
|
|
116
|
-
label: label(unit)
|
|
117
|
-
}))} value={{
|
|
118
|
-
value: preferredTemperatureUnit
|
|
119
|
-
}} onChange={evt => setPreferredTemperatureUnit(evt.target.value)} width="100px" />
|
|
120
|
-
</Field>
|
|
121
|
-
</Card>
|
|
122
|
-
<Card heading={<Heading>Storage State (Redux)</Heading>}>
|
|
123
|
-
<pre>
|
|
124
|
-
<code>{JSON.stringify(reduxTable, null, 2)}</code>
|
|
125
|
-
</pre>
|
|
126
|
-
</Card>
|
|
127
|
-
<Card heading={<Heading>UnitTable</Heading>}>
|
|
128
|
-
<UnitTable table={tableViewData}
|
|
129
|
-
//New props:
|
|
130
|
-
unitConfig={[{
|
|
131
|
-
unitKey: 'length',
|
|
132
|
-
storageUnit: reduxTable[0][0],
|
|
133
|
-
preferredUnit: preferredLengthUnit,
|
|
134
|
-
onChange: ({
|
|
135
|
-
newUnit
|
|
136
|
-
}) => setDisplayedLengthUnit(newUnit)
|
|
137
|
-
}, {
|
|
138
|
-
unitKey: 'temperature',
|
|
139
|
-
storageUnit: reduxTable[0][2],
|
|
140
|
-
preferredUnit: preferredTemperatureUnit
|
|
141
|
-
}]}
|
|
142
|
-
//Most tables should just use the default values here (true):
|
|
143
|
-
convertBackToStorageUnit={convertBackToStorageUnit} enableDisplayRounding={enableDisplayRounding} enableCosmeticRounding={enableCosmeticRounding} />
|
|
144
|
-
<Spacer height={20} />
|
|
145
|
-
<Field label="Displayed length unit:" labelLeft labelWidth={150}>
|
|
146
|
-
{displayedLengthUnit}
|
|
147
|
-
</Field>
|
|
148
|
-
</Card>
|
|
149
|
-
</Grid>;
|
|
150
|
-
}`,...(O=(G=V.parameters)==null?void 0:G.docs)==null?void 0:O.source},description:{story:"Story",...(Q=(q=V.parameters)==null?void 0:q.docs)==null?void 0:Q.description}}};const gt=["UnitTablePrototype"];export{V as UnitTablePrototype,gt as __namedExportsOrder,pt as default};
|
|
File without changes
|