@oliasoft-open-source/react-ui-library 4.7.5 → 4.7.6
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/index.d.ts +5 -0
- package/dist/index.js +20 -7
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/Color-KGDBMAHA-C0EpwEFf.js +1 -0
- package/dist/storybook/assets/DocsRenderer-PKQXORMH-CWe5JIRI.js +1 -0
- package/dist/storybook/assets/{accordion-BiuI_LCA.js → accordion-6ouB0WTt.js} +1 -1
- package/dist/storybook/assets/{accordion.stories-BWUwZ5cN.js → accordion.stories-YuQaNHcr.js} +2 -2
- package/dist/storybook/assets/{actions-CHgr8eL8.js → actions-CZK3mphC.js} +1 -1
- package/dist/storybook/assets/{actions.stories-CCDxFKFk.js → actions.stories-FOK1cLb3.js} +1 -1
- package/dist/storybook/assets/{afe.stories-CC785MgO.js → afe.stories-CT81gs6M.js} +2 -2
- package/dist/storybook/assets/{badge.stories-D5DA-vxC.js → badge.stories-D30jHm96.js} +1 -1
- package/dist/storybook/assets/{blowout.stories-ES-Fuaqn.js → blowout.stories-CJrNKpKP.js} +1 -1
- package/dist/storybook/assets/{button-VxhoNhrV.js → button-C1sV-0mR.js} +1 -1
- package/dist/storybook/assets/{button-group-CwJdFo2z.js → button-group-Ai4DXqNr.js} +1 -1
- package/dist/storybook/assets/{button-group.stories-DU5k5qCY.js → button-group.stories-incmyYJ-.js} +1 -1
- package/dist/storybook/assets/{button.stories-DVtec2Eo.js → button.stories-Bcy7mnLs.js} +2 -2
- package/dist/storybook/assets/{buttons-and-links-CfkgVoVA.js → buttons-and-links-CtOaPZlv.js} +2 -2
- package/dist/storybook/assets/{card.stories-CsTB0DuM.js → card.stories-Bn6LpucB.js} +1 -1
- package/dist/storybook/assets/{casing-loads.stories-BoG7UuIu.js → casing-loads.stories-DQy8gjj6.js} +2 -2
- package/dist/storybook/assets/{cell.stories-CfiPC1eE.js → cell.stories-ChfAWqCt.js} +2 -2
- package/dist/storybook/assets/{check-box-BtCGePRy.js → check-box-CaSrhzev.js} +1 -1
- package/dist/storybook/assets/check-box.stories-BAH78tMZ.js +126 -0
- package/dist/storybook/assets/{chunk-HLWAVYOI-CuMm7Qpv.js → chunk-HLWAVYOI-CkQdzq8g.js} +1 -1
- package/dist/storybook/assets/color-eaylxLAo.js +25 -0
- package/dist/storybook/assets/{column.stories-BxfR9Tla.js → column.stories-JMvj3_fr.js} +1 -1
- package/dist/storybook/assets/dialog-vClt2ahZ.js +1 -0
- package/dist/storybook/assets/{drawer-BhuWxI7V.js → drawer-DSS8yvvp.js} +1 -1
- package/dist/storybook/assets/drawer.stories-D6FBs1_r.js +113 -0
- package/dist/storybook/assets/{empty.stories-BVYXwvpa.js → empty.stories-G8jeIfLL.js} +1 -1
- package/dist/storybook/assets/extends-CF3RwP-h.js +1 -0
- package/dist/storybook/assets/{field-HrLaMLbx.js → field-C5_fLDpy.js} +1 -1
- package/dist/storybook/assets/{field.stories-B9p9nBgY.js → field.stories-D5Mej0Bt.js} +1 -1
- package/dist/storybook/assets/{file-button.stories-FOaiNPt-.js → file-button.stories-DePr8MKB.js} +1 -1
- package/dist/storybook/assets/{file-input-BpMtsZ2S.js → file-input-BZecnRBy.js} +1 -1
- package/dist/storybook/assets/{file-input.stories--ZoISXk0.js → file-input.stories-Br89AkVv.js} +1 -1
- package/dist/storybook/assets/{flex.stories-BEXf0VqI.js → flex.stories-sSdg0ChR.js} +1 -1
- package/dist/storybook/assets/footer.stories-BM5UBN62.js +3 -0
- package/dist/storybook/assets/form.stories-CYcggA-f.js +49 -0
- package/dist/storybook/assets/formation.stories-NDB_Sbor.js +74 -0
- package/dist/storybook/assets/{heading-CRNoBc7q.js → heading-NkLgQYoP.js} +1 -1
- package/dist/storybook/assets/{heading.stories-DahFxeiX.js → heading.stories-nI_cFnAN.js} +1 -1
- package/dist/storybook/assets/{help-icon-Buhx5nl6.js → help-icon-41R-Z9N1.js} +1 -1
- package/dist/storybook/assets/{help-icon.stories-DbmZ1fgP.js → help-icon.stories-DBYh0YX7.js} +1 -1
- package/dist/storybook/assets/icon-BP4BO6-k.js +8 -0
- package/dist/storybook/assets/{icon.stories-C1hZXIMX.js → icon.stories-B-tKaIKA.js} +1 -1
- package/dist/storybook/assets/iframe-WLuE3PcW.js +2 -0
- package/dist/storybook/assets/index-Be0hXiyp.js +179 -0
- package/dist/storybook/assets/index-CF7H4eMJ.js +28 -0
- package/dist/storybook/assets/index-CXmS_Aty.js +1 -0
- package/dist/storybook/assets/{index-DCGYYCUT.js → index-Cf2IDQZ4.js} +8 -8
- package/dist/storybook/assets/{index.es-DazXb-ul.js → index.es-D2piFfFj.js} +4 -4
- package/dist/storybook/assets/inheritsLoose-DR8r8Ogv.js +1 -0
- package/dist/storybook/assets/{input-group.stories-BiReS545.js → input-group.stories-BmeUtBOK.js} +2 -2
- package/dist/storybook/assets/{input-validation-Bd_JP2WL.js → input-validation-U3o9_8IY.js} +2 -2
- package/dist/storybook/assets/{inputs-BsGUQTI3.js → inputs-gP7hGRtM.js} +4 -4
- package/dist/storybook/assets/{label-CqmyC9he.js → label-hiSz3I8H.js} +1 -1
- package/dist/storybook/assets/{label.stories-C0AO5F1a.js → label.stories-Cyv5jBAO.js} +1 -1
- package/dist/storybook/assets/layout-forms-r2wYyx-8.js +16 -0
- package/dist/storybook/assets/{layout-general-jp5QULaU.js → layout-general-Bw291PmI.js} +2 -2
- package/dist/storybook/assets/{list-yVTOdmpX.js → list-DYNKqvUR.js} +1 -1
- package/dist/storybook/assets/{list.stories-ChqQXY5M.js → list.stories-BX67BegD.js} +2 -2
- package/dist/storybook/assets/{list.stories-data-Iq66w9oH.js → list.stories-data-D_ZfzaxE.js} +1 -1
- package/dist/storybook/assets/{loader.stories-DM7ZJBgz.js → loader.stories-DjrwwZ15.js} +1 -1
- package/dist/storybook/assets/menu.stories-QTzp0Z7C.js +84 -0
- package/dist/storybook/assets/message-B7G1ESkC.js +1 -0
- package/dist/storybook/assets/{message.stories-Dmk-t8hM.js → message.stories-Czui5Ym7.js} +1 -1
- package/dist/storybook/assets/{meta-content-cbHGvPJ7.js → meta-content-BE7pulye.js} +1 -1
- package/dist/storybook/assets/modal.stories-DAxDpo0A.js +220 -0
- package/dist/storybook/assets/number-input.stories-CFTNLnHw.js +105 -0
- package/dist/storybook/assets/{option-dropdown.stories-CoLsSS95.js → option-dropdown.stories-ByLG631x.js} +1 -1
- package/dist/storybook/assets/{padding-and-spacing-D7O49YoW.js → padding-and-spacing-DLeCWmND.js} +2 -2
- package/dist/storybook/assets/{page.stories-Cse3cMsO.js → page.stories-br9ia4zp.js} +1 -1
- package/dist/storybook/assets/{pagination-DzpYFhAO.js → pagination-BtguPxeR.js} +1 -1
- package/dist/storybook/assets/{pagination.stories-CJwR-XAD.js → pagination.stories-CgG4wp8P.js} +2 -2
- package/dist/storybook/assets/{pop-confirm.stories-Hox7vJnl.js → pop-confirm.stories-CZpYmUBz.js} +1 -1
- package/dist/storybook/assets/{popover-CzZdWNnB.js → popover-DgUpTRMk.js} +1 -1
- package/dist/storybook/assets/popover.stories-CtaFGXR_.js +10 -0
- package/dist/storybook/assets/preview-BjyexbB3.js +2 -0
- package/dist/storybook/assets/preview-DLBQXbKW.js +1 -0
- package/dist/storybook/assets/{preview-DOYx8RvS.js → preview-Dml2wSQG.js} +2 -2
- package/dist/storybook/assets/projects.stories-BSAMs8RG.js +47 -0
- package/dist/storybook/assets/{radio-button-YBwYcMaM.js → radio-button-C_cV5TWA.js} +1 -1
- package/dist/storybook/assets/radio-button.stories-BNE-U9db.js +71 -0
- package/dist/storybook/assets/react-router-dom-CMITYWBH.js +8 -0
- package/dist/storybook/assets/{reservoirs.stories-WKT7gCnp.js → reservoirs.stories-ux3hZbkX.js} +2 -2
- package/dist/storybook/assets/{rich-text-input.stories-RjuY6LDo.js → rich-text-input.stories-savcIJ5B.js} +3 -3
- package/dist/storybook/assets/{row.stories-B6IcyamO.js → row.stories-CG6Eipay.js} +2 -2
- package/dist/storybook/assets/select-Z-GCZ-pY.js +40 -0
- package/dist/storybook/assets/select.stories-CX_B6BvR.js +579 -0
- package/dist/storybook/assets/{side-bar-CKbHPgIV.js → side-bar-ChOjPNLR.js} +1 -1
- package/dist/storybook/assets/{side-bar.stories-MUj_dj1F.js → side-bar.stories-BupidZk5.js} +1 -1
- package/dist/storybook/assets/{site.stories-Ci4g5W2A.js → site.stories-C1GnbK5P.js} +2 -2
- package/dist/storybook/assets/{slider-DAramr8j.js → slider-gZmYlxxz.js} +4 -4
- package/dist/storybook/assets/{slider.stories-Cd0rLfHP.js → slider.stories-CY4GxD4Y.js} +2 -2
- package/dist/storybook/assets/{smart-upload-modal.stories-OBY4Jc5w.js → smart-upload-modal.stories-BrsVuS4a.js} +1 -1
- package/dist/storybook/assets/{spacer.stories-CHEZdgDM.js → spacer.stories-D7Q45uBk.js} +1 -1
- package/dist/storybook/assets/{table-BOVkj1wL.js → table-CaaSoHex.js} +1 -1
- package/dist/storybook/assets/{table.stories-CdFHs6Xl.js → table.stories-BiBivAvh.js} +2 -2
- package/dist/storybook/assets/{table.stories-data-CR9VpXHs.js → table.stories-data-DwfKQW7P.js} +1 -1
- package/dist/storybook/assets/text-link.stories-BsuVBOWo.js +14 -0
- package/dist/storybook/assets/{title.stories-DT3HSIHi.js → title.stories-CfdJbgvT.js} +2 -2
- package/dist/storybook/assets/toaster-DJeREs3e.js +1 -0
- package/dist/storybook/assets/toaster.stories-QjvljKdT.js +89 -0
- package/dist/storybook/assets/{toggle-CBpNgTrm.js → toggle-Bo-JPbUP.js} +1 -1
- package/dist/storybook/assets/toggle.stories-BYrikgrA.js +141 -0
- package/dist/storybook/assets/{tooltip.test-case.stories-i9YQqba1.js → tooltip.test-case.stories-C74mKGrI.js} +1 -1
- package/dist/storybook/assets/{top-bar-C_tn2Pc5.js → top-bar-DG4ok0uF.js} +1 -1
- package/dist/storybook/assets/top-bar.stories-BI4a_ekv.js +21 -0
- package/dist/storybook/assets/{top-bar.testcase.stories-DoPEAMYc.js → top-bar.testcase.stories-DzsYUZIx.js} +1 -1
- package/dist/storybook/assets/{tree.stories-6UHASEZu.js → tree.stories-RtuZpYXn.js} +1 -1
- package/dist/storybook/assets/{unit-input.stories-DyeptPz2.js → unit-input.stories-BSWm9641.js} +1 -1
- package/dist/storybook/assets/unit-table.stories-CgF-UOP3.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/storybook/assets/Color-KGDBMAHA-DHDKE9Re.js +0 -1
- package/dist/storybook/assets/DocsRenderer-PKQXORMH-BmaBzyAH.js +0 -1
- package/dist/storybook/assets/check-box.stories-L9T_i0RT.js +0 -102
- package/dist/storybook/assets/color-DJNturFf.js +0 -25
- package/dist/storybook/assets/dialog-IAPGkLet.js +0 -1
- package/dist/storybook/assets/drawer.stories-B-PsNJJ6.js +0 -113
- package/dist/storybook/assets/footer.stories-DdUzRiYm.js +0 -3
- package/dist/storybook/assets/form.stories-CDE7hTBL.js +0 -49
- package/dist/storybook/assets/formation.stories-vU3zoZ2c.js +0 -74
- package/dist/storybook/assets/icon-BSFY3vDO.js +0 -8
- package/dist/storybook/assets/iframe-CgUc-Ukp.js +0 -2
- package/dist/storybook/assets/index-CQKekHCo.js +0 -1
- package/dist/storybook/assets/inheritsLoose-DP0QEDDI.js +0 -1
- package/dist/storybook/assets/layout-forms-BH-i91Wg.js +0 -16
- package/dist/storybook/assets/menu.stories-CSSvL08X.js +0 -82
- package/dist/storybook/assets/message-ZenLdkrf.js +0 -1
- package/dist/storybook/assets/modal.stories-BVttWvlZ.js +0 -200
- package/dist/storybook/assets/number-input.stories-CVFfJvjY.js +0 -97
- package/dist/storybook/assets/popover.stories-L5z549ww.js +0 -10
- package/dist/storybook/assets/preview-Bq2bLcjv.js +0 -2
- package/dist/storybook/assets/projects.stories-DU-QlBa6.js +0 -47
- package/dist/storybook/assets/radio-button.stories-Bg5JVXpo.js +0 -61
- package/dist/storybook/assets/react-router-dom-Ck2Y_Fzc.js +0 -8
- package/dist/storybook/assets/select-D55JvDou.js +0 -40
- package/dist/storybook/assets/select.stories-2DiOP0OZ.js +0 -914
- package/dist/storybook/assets/text-link.stories-BQAkVO-W.js +0 -14
- package/dist/storybook/assets/toaster-B8A3xIYu.js +0 -1
- package/dist/storybook/assets/toaster.stories-B61l_zxQ.js +0 -86
- package/dist/storybook/assets/toggle.stories-D4c4fr5t.js +0 -117
- package/dist/storybook/assets/top-bar.stories-B2a-RgK-.js +0 -21
- package/dist/storybook/assets/unit-table.stories-BAVqAbfG.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-Ck2Y_Fzc.js";import{F as y}from"./flex-EllkLxgO.js";import{T as S}from"./text-B3-TSWok.js";import"./index-DhsZuJvc.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./tiny-invariant-DqLgxztJ.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./index-Bk2sglWO.js";const r=({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})});r.__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 N={title:"Basic/TextLink",component:r,args:{children:"Link text goes here",href:"http://oliasoft.com"}},k=a=>e.jsx(r,{...a}),n=k.bind({}),t=k.bind({});t.args={href:void 0,onClick:()=>console.log("Clicked!")};const s=()=>e.jsxs(E,{children:[e.jsxs(y,{gap:!0,children:[e.jsx(r,{component:i,href:"/dashboard",children:"Dashboard"}),e.jsx(r,{component:i,href:"/settings",children:"Settings"})]}),e.jsxs(j,{children:[e.jsx(c,{path:"/dashboard",children:"Dashboard"}),e.jsx(c,{path:"/settings",children:"Settings"})]})]});s.__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;s.parameters={...s.parameters,docs:{...(g=s.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=s.parameters)==null?void 0:f.docs)==null?void 0:x.source}}};const I=["Default","OnClick","AsRouterLink"];export{s as AsRouterLink,n as Default,t as OnClick,I as __namedExportsOrder,N 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-ZenLdkrf.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-B8A3xIYu.js";import{B as o}from"./button-VxhoNhrV.js";import{S as l}from"./spacer-BWoNR27H.js";import{a as m}from"./message-ZenLdkrf.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-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./tooltip-1V7clEnw.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-CBpNgTrm.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./help-icon-Buhx5nl6.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";const{useArgs: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-Ck2Y_Fzc.js";import{I as O,T as A}from"./common-types-Sih75Sav.js";import{T as p}from"./top-bar-C_tn2Pc5.js";import{P as w}from"./page-7SSpdYhb.js";import{M as N}from"./actions-CHgr8eL8.js";import{B as m}from"./button-VxhoNhrV.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-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./tiny-invariant-DqLgxztJ.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./index-Bk2sglWO.js";import"./icon-BSFY3vDO.js";import"./disabled-context-rmpd7YJS.js";import"./lodash-BHd_uQHh.js";import"./tooltip-1V7clEnw.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:()=>{}}]}})}],ce={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 le=["Default","WithWarning","TextBranding","AppSwitcher","AsRouterLink"];export{o as AppSwitcher,a as AsRouterLink,n as Default,r as TextBranding,t as WithWarning,le as __namedExportsOrder,ce 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-CWz-hU-f.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-HrLaMLbx.js";import{H as W}from"./heading-CRNoBc7q.js";import{S as P}from"./select-D55JvDou.js";import{T as I}from"./toggle-CBpNgTrm.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-BOVkj1wL.js";import"./index-DRSy5Ssd.js";import"./styled-components.browser.esm-Bf0q9Yjk.js";import"./index-Bk2sglWO.js";import"./label-CqmyC9he.js";import"./common-types-Sih75Sav.js";import"./help-icon-Buhx5nl6.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./types-UmZ4Y_CR.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-CHgr8eL8.js";import"./button-VxhoNhrV.js";import"./spinner-AWUe4xwQ.js";import"./badge-CLQ59MDF.js";import"./select.input-DIKP56UZ.js";import"./index.es-DazXb-ul.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./pagination-DzpYFhAO.js";import"./input-BW9trNAW.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./number-input-uQOVHv2N.js";import"./check-box-BtCGePRy.js";import"./slider-DAramr8j.js";import"./index-BI4_Bp97.js";import"./popover-CzZdWNnB.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 ct={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 pt=["UnitTablePrototype"];export{V as UnitTablePrototype,pt as __namedExportsOrder,ct as default};
|
|
File without changes
|