@oliasoft-open-source/react-ui-library 4.6.13 → 4.6.15-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{index-D5bNrBhF.js → index-noRhVNRn.js} +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.html +1 -1
- package/dist/index.js +25 -6
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/Color-6VNJS4EI-zsSkOkZZ.js +1 -0
- package/dist/storybook/assets/DocsRenderer-NNNQARDV-qG6IOFhG.js +1 -0
- package/dist/storybook/assets/WithTooltip-V3YHNWJZ-yOnEAyhN.js +1 -0
- package/dist/storybook/assets/{accordion-MRdNs3mQ.js → accordion-M-sY23Hd.js} +1 -1
- package/dist/storybook/assets/{accordion.stories-fQEMJlxQ.js → accordion.stories-dq4cVL-x.js} +2 -2
- package/dist/storybook/assets/{actions-0lKGEXVi.js → actions-7PO9r8zE.js} +1 -1
- package/dist/storybook/assets/{actions.stories-1G9apUqW.js → actions.stories-sQK7SAX5.js} +1 -1
- package/dist/storybook/assets/afe.stories-ODEPBi0c.js +88 -0
- package/dist/storybook/assets/{badge.stories-YE5hHtSe.js → badge.stories-fpUlm73g.js} +1 -1
- package/dist/storybook/assets/{blowout.stories-xSwBWe5T.js → blowout.stories-4nLIosc7.js} +1 -1
- package/dist/storybook/assets/{button-pSDG6Ka2.js → button-BiJw0fB3.js} +1 -1
- package/dist/storybook/assets/{button-group-0RTzcUIP.js → button-group-uKCjEKYR.js} +1 -1
- package/dist/storybook/assets/{button-group.stories-eQ5h-50o.js → button-group.stories-mynaBhDz.js} +1 -1
- package/dist/storybook/assets/{button.stories-QDP0P6s7.js → button.stories-7N3AZjiw.js} +6 -6
- package/dist/storybook/assets/{buttons-and-links-dSpYF4I_.js → buttons-and-links-A0m53_zo.js} +2 -2
- package/dist/storybook/assets/{card.stories-nEB15GEp.js → card.stories-N8mLrD63.js} +1 -1
- package/dist/storybook/assets/{casing-loads.stories-uu-yK01O.js → casing-loads.stories-_FNbyeeA.js} +2 -2
- package/dist/storybook/assets/{cell.stories-jU_N8b9E.js → cell.stories-3MAfxgx0.js} +2 -2
- package/dist/storybook/assets/{check-box--ih7cmR1.js → check-box-KynSyTaY.js} +1 -1
- package/dist/storybook/assets/{check-box.stories-WFbOF7kK.js → check-box.stories-yE82OQod.js} +1 -1
- package/dist/storybook/assets/{chunk-HLWAVYOI-TfoHKvis.js → chunk-HLWAVYOI-GsXUOgxA.js} +1 -1
- package/dist/storybook/assets/color-q6tTUpFY.js +25 -0
- package/dist/storybook/assets/{column.stories-uR7F6GLZ.js → column.stories-cX-u-DHI.js} +1 -1
- package/dist/storybook/assets/{dialog-kardLd1s.js → dialog-Au78k7wS.js} +1 -1
- package/dist/storybook/assets/{drawer-fq99yzU7.js → drawer-Vhj7CUNA.js} +1 -1
- package/dist/storybook/assets/{drawer.stories-zos7-Jef.js → drawer.stories-gbeto4wq.js} +2 -2
- package/dist/storybook/assets/{empty.stories-V5nX7JMj.js → empty.stories-oRmjEU7P.js} +1 -1
- package/dist/storybook/assets/{field-V2qkm8ON.js → field-m7XXDdEG.js} +1 -1
- package/dist/storybook/assets/{field.stories-oQ-oKw9H.js → field.stories-6xmZA-uD.js} +1 -1
- package/dist/storybook/assets/{file-input-ASEHnODl.js → file-input-AwnqYeJy.js} +1 -1
- package/dist/storybook/assets/{file-input.stories-K1-X4A2h.js → file-input.stories-Ry6pP1Zp.js} +1 -1
- package/dist/storybook/assets/{flex.stories-rUC8irnS.js → flex.stories-xAOrglx5.js} +1 -1
- package/dist/storybook/assets/footer.stories-qmAGeGs1.js +3 -0
- package/dist/storybook/assets/form.stories-Ey59t61k.js +49 -0
- package/dist/storybook/assets/formation.stories-Keaqq-1Z.js +74 -0
- package/dist/storybook/assets/{formatter-SWP5E3XI-E_AUyOmB.js → formatter-SWP5E3XI-cZ_FW1kO.js} +2 -2
- package/dist/storybook/assets/{heading-OSdaYHYE.js → heading-4tVgoT7O.js} +1 -1
- package/dist/storybook/assets/{heading.stories-YhoAJ5xD.js → heading.stories-7Bqlw14c.js} +1 -1
- package/dist/storybook/assets/{help-icon-jdxRTcvs.js → help-icon-eelulTML.js} +1 -1
- package/dist/storybook/assets/{help-icon.stories-NKBYmv_o.js → help-icon.stories-CptgOV2E.js} +1 -1
- package/dist/storybook/assets/icon-8EQazuuW.js +8 -0
- package/dist/storybook/assets/{icon.stories-2aZia1VV.js → icon.stories-j-b_Exev.js} +1 -1
- package/dist/storybook/assets/iframe-SjYxkjL0.js +7 -0
- package/dist/storybook/assets/{index-g34udPZo.js → index-eZm9jYMB.js} +5 -5
- package/dist/storybook/assets/{index.es-HG2GUH9i.js → index.es-VXFRDikp.js} +4 -4
- package/dist/storybook/assets/inheritsLoose-8sb_A2v4.js +1 -0
- package/dist/storybook/assets/{input-w-UScEUy.js → input-fYKvBwPs.js} +1 -1
- package/dist/storybook/assets/{input-group.stories-HXoMZkHB.js → input-group.stories-BJcLpgsm.js} +2 -2
- package/dist/storybook/assets/{input-validation-EHlvLdps.js → input-validation-cA6NMipU.js} +2 -2
- package/dist/storybook/assets/{input.stories-NMD1Bqi4.js → input.stories-Y5X-JFWU.js} +1 -1
- package/dist/storybook/assets/{inputs-UqnSQlzK.js → inputs-HhHtsFTZ.js} +2 -2
- package/dist/storybook/assets/{label-KLaw_y6R.js → label-bLcoUwtK.js} +1 -1
- package/dist/storybook/assets/{label.stories-8KngvJd3.js → label.stories-KbJuUVw3.js} +1 -1
- package/dist/storybook/assets/layout-forms-6ESvGeNK.js +16 -0
- package/dist/storybook/assets/{layout-general-4Z_dYwOs.js → layout-general-45XaQyoR.js} +2 -2
- package/dist/storybook/assets/{list-HBgplEUa.js → list-F9uDwsrH.js} +1 -1
- package/dist/storybook/assets/{list.stories-AC7IBnuA.js → list.stories-GyWvG8gC.js} +2 -2
- package/dist/storybook/assets/{list.stories-data-YuaX7eYb.js → list.stories-data-Ijj3YnfK.js} +1 -1
- package/dist/storybook/assets/{loader.stories-A0lEe-_I.js → loader.stories-B5lK8-XB.js} +1 -1
- package/dist/storybook/assets/{menu.stories-wWr6qpLS.js → menu.stories-YY0ZhdqW.js} +6 -6
- package/dist/storybook/assets/{message-bbAE2zjv.js → message-CRKuTfOl.js} +1 -1
- package/dist/storybook/assets/{message.stories-rANJfalB.js → message.stories-aLAQs_iU.js} +1 -1
- package/dist/storybook/assets/{meta-content-xcMHnFul.js → meta-content-h1NJ9ypR.js} +1 -1
- package/dist/storybook/assets/{modal.stories-GY64tFtP.js → modal.stories-VdULKoni.js} +2 -2
- package/dist/storybook/assets/{number-input-hrCn3Rag.js → number-input-ymd7m-s5.js} +1 -1
- package/dist/storybook/assets/{number-input.stories-oaHrqqEo.js → number-input.stories-QU9Llt5Z.js} +5 -5
- package/dist/storybook/assets/{option-dropdown.stories-IIXgJvpF.js → option-dropdown.stories-f_5X-NT4.js} +1 -1
- package/dist/storybook/assets/{padding-and-spacing-6Wmzdt8V.js → padding-and-spacing-kcyE8npU.js} +2 -2
- package/dist/storybook/assets/{page.stories-jmoBCw29.js → page.stories-_evmOXW2.js} +1 -1
- package/dist/storybook/assets/{pagination-LajpPl1E.js → pagination-DtJdggbI.js} +1 -1
- package/dist/storybook/assets/{pagination.stories-QNaX-nfT.js → pagination.stories-M2RqRdRc.js} +2 -2
- package/dist/storybook/assets/{pop-confirm.stories-qL_Z99O8.js → pop-confirm.stories-VnMlv9V7.js} +1 -1
- package/dist/storybook/assets/popover-1CwIRm4P.js +1 -0
- package/dist/storybook/assets/popover.stories-c_ZOMOy7.js +10 -0
- package/dist/storybook/assets/preview-5sJhlF6_.js +7 -0
- package/dist/storybook/assets/{preview-izL99lIf.js → preview-l_O2seEt.js} +3 -3
- package/dist/storybook/assets/projects.stories-H8sLyz8n.js +47 -0
- package/dist/storybook/assets/{radio-button-YSXmxvG2.js → radio-button-HPU-KHv4.js} +1 -1
- package/dist/storybook/assets/{radio-button.stories-kcqjIFI9.js → radio-button.stories-ZyjCpReq.js} +1 -1
- package/dist/storybook/assets/react-router-dom-EZH1n7K1.js +8 -0
- package/dist/storybook/assets/{reservoirs.stories-SK2d9Fio.js → reservoirs.stories-dvGcJAh0.js} +2 -2
- package/dist/storybook/assets/{rich-text-input.stories-zaKtuZiu.js → rich-text-input.stories-BroJS4L0.js} +3 -3
- package/dist/storybook/assets/{row.stories-U-yrdTYI.js → row.stories-uLjS3aLm.js} +2 -2
- package/dist/storybook/assets/select-AcJYUY86.js +1 -0
- package/dist/storybook/assets/{select.stories-xDbB-kMM.js → select.stories-pZ8RM3fJ.js} +2 -2
- package/dist/storybook/assets/{side-bar-5P37lMUr.js → side-bar-evBxuVzm.js} +1 -1
- package/dist/storybook/assets/{side-bar.stories-JTyeqg4a.js → side-bar.stories-mtQSbRi1.js} +1 -1
- package/dist/storybook/assets/{site.stories-h1X4It52.js → site.stories--LjoKnDF.js} +2 -2
- package/dist/storybook/assets/slider-n3IxC2iq.js +7 -0
- package/dist/storybook/assets/{slider.stories-EBNa8dCL.js → slider.stories-ZZQVWjaY.js} +2 -2
- package/dist/storybook/assets/{smart-upload-modal.stories--J7j_ykg.js → smart-upload-modal.stories-RRF2yq4B.js} +1 -1
- package/dist/storybook/assets/{spacer.stories-Bp11g7WY.js → spacer.stories-oFV2pFb8.js} +1 -1
- package/dist/storybook/assets/syntaxhighlighter-B5GMVT5T-4O5JDV7T.js +1 -0
- package/dist/storybook/assets/{table-YO72eq6-.js → table-ZBqRpa7M.js} +1 -1
- package/dist/storybook/assets/{table.stories-87uvXmuW.js → table.stories-3JSl8GYJ.js} +94 -18
- package/dist/storybook/assets/{table.stories-data-hDQBe08f.js → table.stories-data-tjY9V0bM.js} +1 -1
- package/dist/storybook/assets/text-link.stories-Mx9ojcOC.js +14 -0
- package/dist/storybook/assets/{textarea-XY_iUfzV.js → textarea-U_i0cI7f.js} +1 -1
- package/dist/storybook/assets/{textarea.stories-tpIT4O3R.js → textarea.stories-pGEjF8nH.js} +1 -1
- package/dist/storybook/assets/{title.stories-mhWM-m41.js → title.stories-JpJGF0vE.js} +3 -3
- package/dist/storybook/assets/{toaster-IL_npIpU.js → toaster-yPcd4ELJ.js} +1 -1
- package/dist/storybook/assets/{toaster.stories-2399ErHt.js → toaster.stories-Cu8HbPc6.js} +1 -1
- package/dist/storybook/assets/{toggle-KddTHsTd.js → toggle-R__kwKym.js} +1 -1
- package/dist/storybook/assets/{toggle.stories-ZPLKo1CO.js → toggle.stories-ViKd2aK_.js} +1 -1
- package/dist/storybook/assets/{tooltip-gljV_DQ0.js → tooltip-dueTLnwA.js} +2 -2
- package/dist/storybook/assets/{tooltip.stories-CEbtg_cS.js → tooltip.stories-a_gd0XYu.js} +1 -1
- package/dist/storybook/assets/tooltip.test-case.stories-_THFk3Hb.js +5 -0
- package/dist/storybook/assets/{top-bar-xIrfLvE9.js → top-bar-0Ownj3Bx.js} +1 -1
- package/dist/storybook/assets/top-bar.stories-Z8pUGVuU.js +21 -0
- package/dist/storybook/assets/{top-bar.testcase.stories-uu_mJjq3.js → top-bar.testcase.stories-3XlaHVAQ.js} +1 -1
- package/dist/storybook/assets/{tree.stories-KFifRduQ.js → tree.stories-Uh4XKQdz.js} +1 -1
- package/dist/storybook/assets/{unit-input.stories-EPjs0Jo3.js → unit-input.stories-R93nVPV4.js} +1 -1
- package/dist/storybook/assets/unit-table.stories-kapwCHI6.js +142 -0
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/stories.json +1 -1
- package/package.json +1 -1
- package/dist/404.html +0 -1
- package/dist/storybook/assets/Color-6VNJS4EI-0Es0Y_hf.js +0 -1
- package/dist/storybook/assets/DocsRenderer-NNNQARDV-8Agqr_1z.js +0 -1
- package/dist/storybook/assets/WithTooltip-V3YHNWJZ-VkPCPx4O.js +0 -1
- package/dist/storybook/assets/afe.stories-YtbvNBzx.js +0 -88
- package/dist/storybook/assets/color-LJZaNnUB.js +0 -25
- package/dist/storybook/assets/extends-dGVwEr9R.js +0 -1
- package/dist/storybook/assets/footer.stories-6IYhl3Y9.js +0 -3
- package/dist/storybook/assets/form.stories-TfCufaed.js +0 -49
- package/dist/storybook/assets/formation.stories-arormd_z.js +0 -74
- package/dist/storybook/assets/icon-_m67DAr0.js +0 -8
- package/dist/storybook/assets/iframe-XBWdLgXl.js +0 -7
- package/dist/storybook/assets/inheritsLoose-Y9jOMJLd.js +0 -1
- package/dist/storybook/assets/layout-forms-n0KRZ2JT.js +0 -16
- package/dist/storybook/assets/popover-dGHzPDyA.js +0 -1
- package/dist/storybook/assets/popover.stories-4yXf4qke.js +0 -1
- package/dist/storybook/assets/preview-sTJNaY8B.js +0 -7
- package/dist/storybook/assets/projects.stories-gJiQXNLT.js +0 -47
- package/dist/storybook/assets/react-router-dom-4Z66xYqZ.js +0 -8
- package/dist/storybook/assets/select-7lyQEtzA.js +0 -1
- package/dist/storybook/assets/slider-bFd0qknB.js +0 -7
- package/dist/storybook/assets/syntaxhighlighter-B5GMVT5T-ACJ3LFR3.js +0 -1
- package/dist/storybook/assets/text-link.stories-Plmiu8NV.js +0 -14
- package/dist/storybook/assets/tooltip.test-case.stories-e7KXJ1zz.js +0 -3
- package/dist/storybook/assets/top-bar.stories-OWyuBUT6.js +0 -21
- package/dist/storybook/assets/unit-table.stories-KSzMk2ae.js +0 -142
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import{j as n}from"./jsx-runtime-FsUICBgo.js";import{r as S}from"./index-RfLt4OUa.js";import{f as B}from"./immer.esm-bD7SSJ7T.js";import{l as oe}from"./lodash-Bmg8FrMx.js";import{G as se}from"./grid-u1mZpaML.js";import{T as V}from"./text-6KQ6ntOV.js";import{T as A}from"./table-YO72eq6-.js";import{C as sn}from"./card-0r8RRVk-.js";import{I as ae}from"./input-w-UScEUy.js";import{F as re}from"./field-V2qkm8ON.js";import{H as ln}from"./heading-OSdaYHYE.js";import{t as ne,x as on,y as cn,z as dn,A as un,B as pn,C as gn,D as mn}from"./table.stories-data-hDQBe08f.js";import"./styled-components.browser.esm-qIipjd6c.js";import"./tslib.es6-OIsz3r9a.js";import"./index-VW3EWkuE.js";import"./index.es-HG2GUH9i.js";import"./inheritsLoose-Y9jOMJLd.js";import"./extends-dGVwEr9R.js";import"./redux-F5dueAP3.js";import"./objectSpread2-93s0nBry.js";import"./tiny-invariant-R4kOKlvx.js";import"./index-miLrID2P.js";import"./memoize-one.esm-hqe5SRxC.js";import"./objectWithoutPropertiesLoose-9Q1jwsKS.js";import"./actions-0lKGEXVi.js";import"./common-types-U65vzrrz.js";import"./disabled-context-urNQThQz.js";import"./button-pSDG6Ka2.js";import"./spinner-R8Il4aRe.js";import"./icon-_m67DAr0.js";import"./index-4QtD-hFu.js";import"./tooltip-gljV_DQ0.js";import"./types-VB5zD18b.js";import"./types-5uVBABF4.js";import"./badge-23Ty_zBt.js";import"./pagination-LajpPl1E.js";import"./select-7lyQEtzA.js";import"./assertThisInitialized-4q6YPdh3.js";import"./select.input-zP5tW20f.js";import"./input-group-R8LoqKRn.js";import"./input-group-addon-BHVsW9mL.js";import"./number-input-hrCn3Rag.js";import"./index-qZmQ7nA9.js";import"./index-cCpkwrS5.js";import"./check-box--ih7cmR1.js";import"./help-icon-jdxRTcvs.js";import"./slider-bFd0qknB.js";import"./index-ugi_ZH6T.js";import"./popover-dGHzPDyA.js";import"./label-KLaw_y6R.js";import"./flex-RYZsoWEN.js";const pt={title:"Basic/Table",component:A,args:{table:{...ne}}},I=g=>n.jsx(A,{...g}),K=I.bind({}),_=I.bind({});_.args={table:{...ne,fixedWidth:"400px"}};const M=I.bind({});M.args={table:{...ne,fixedWidth:"auto"}};const O=I.bind({});O.args={table:on};O.parameters={docs:{description:{story:"Use sparingly when certain columns cannot be below a certain width. Unless the Table is auto width, set one column to `auto` to use remaining space."}}};const L=I.bind({});L.args={table:cn};const U=I.bind({});U.args={table:dn};U.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const Q=I.bind({});Q.args={table:un};const E=I.bind({});E.args={table:pn};E.decorators=[g=>n.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:n.jsx(g,{})})];const N=I.bind({});N.args={table:gn};N.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const G=I.bind({});G.args={table:mn};const q=()=>n.jsx(sn,{heading:n.jsx(ln,{children:"Card heading"}),padding:!1,children:n.jsx(A,{table:{...ne,bordered:!1}})});q.parameters={docs:{source:{type:"dynamic"}}};const z=()=>{const g=["Section","Width","Height"];let u=["","m","m"],r=[...Array(175).keys()].map((s,t)=>[t,t*2,t*2]);const T=(s,t,i)=>s==="m"&&t==="ft"?i*3.28084:s==="ft"&&t==="m"?i/3.28084:i,o=(s,t,i,p)=>{r[t][i]=s.target.value,p()},C=s=>{r=r.concat([["","",""]]),s()},k=(s,t)=>{r=r.filter((i,p)=>p!==s),t()},d=(s,t,i)=>{const p=u[t],y=s.target.value;u=u.map((R,h)=>h===t?y:R),r=r.map(R=>R.map((h,b)=>b===t?T(p,y,h):h)),i()},m=()=>{const s=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[t,i]=S.useState(10),[p,y]=S.useState(1),[R,h]=S.useState(!1),b=()=>{h(!R)},W=()=>{const e=Math.ceil(r.length/t);y(e)},D=(p-1)*t,a=t===0?r.length-1:D+t,c={headers:[{cells:g.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{C(b),W()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:u[1],type:"Select",native:!0,onChange:e=>d(e,1,b)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:u[2],type:"Select",native:!0,onChange:e=>d(e,2,b)}]}],rows:r.slice(D,a).map((e,l)=>{const P=D+l;return{cells:[...Array(3).keys()].map((f,w)=>({value:e[w],type:"Input",onChange:x=>o(x,P,w,b)})),actions:[{label:"Delete",icon:"minus",onClick:()=>k(P,b)}]}}),footer:{pagination:{rowCount:r.length,selectedPage:p,rowsPerPage:{onChange:e=>{const{value:l}=e.target;i(Number(l))},options:s,value:t},onSelectPage:e=>y(e),small:!0}}};return n.jsx(A,{table:c})};return n.jsx(m,{})},J=()=>{const g=["Section","Width","Height"];let u=[...Array(175).keys()].map((T,o)=>({Section:o,Width:o*2,Height:o*2}));const r=()=>{const T=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[o,C]=S.useState(10),[k,d]=S.useState(1),[m,s]=S.useState({}),[t,i]=S.useState({});S.useEffect(()=>{d(1)},[m,t]);const p=(k-1)*o,y=o===0?u.length-1:p+o,R=(e,l,P)=>e.filter(f=>Object.keys(l).every(w=>l[w]===""?!0:f[w].toString().includes(l[w]))).sort((f,w)=>Object.entries(P).map(([x,F])=>{switch(F){case"up":return f[x]-w[x];case"down":return w[x]-f[x];default:return 0}}).reduce((x,F)=>x||F,0)),h=(e,l,P,f,w)=>{const x=e.map(v=>{const j=Object.keys(f).includes(v)?f[v]:"",H=`${v[0].toUpperCase()}${v.slice(1)}`;return{key:v,value:H,hasSort:!0,sort:j,onSort:()=>{const $=j===""?"up":j==="up"?"down":"";w({...f,[v]:$})}}}),F=e.map(v=>{const j=Object.keys(l).includes(v)?l[v]:"";return{key:v,value:j,type:"Input",placeholder:"Filter",onChange:H=>P({...l,[v]:H.target.value})}});return{dataSortCells:x,dataFilterCells:F}},{dataSortCells:b,dataFilterCells:W}=h(g,m,s,t,i),D=R(u,m,t),a=[...D.slice(p,y).map(e=>({cells:Object.entries(e).map(([P,f])=>({key:P,value:f,type:"Input",disabled:!0}))}))],c={headers:[{cells:b},{cells:W}],rows:a,footer:{pagination:{rowCount:D.length,selectedPage:k,rowsPerPage:{onChange:e=>{const{value:l}=e.target;C(Number(l))},options:T,value:o},onSelectPage:e=>d(e),small:!0}}};return n.jsx(A,{table:c})};return n.jsx(r,{})},X=()=>{const g={tea:3.6,coffee:3.2,orange:4.1},u=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],r={cells:[{type:"Select",options:u,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},T=[...Array(15).keys()].map((a,c)=>({cells:[{type:"Select",options:u,value:{value:"tea"}},{type:"Input",value:c+1},{type:"Static"}]})),[o,C]=S.useState(T),k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[d,m]=S.useState(10),[s,t]=S.useState(1),i=(s-1)*d,p=d===0?o.length-1:i+d,y=({newRow:a}={})=>{const c=B(o,e=>{e.push(a??r)});C(c)},R=({rowIndex:a})=>{const c=B(o,e=>{delete e[a]}).filter(e=>e);C(c)},h=({rowIndex:a,value:c})=>{const e=B(o,l=>{l[a].cells[0].value.value=c});C(e)},b=({rowIndex:a,value:c})=>{const e=B(o,l=>{l[a].cells[1].value=c});C(e)},W=({value:a})=>{const c=Number(a);return!oe.isNaN(c)&&oe.isInteger(c)&&c>0},D=o.slice(i,p).map((a,c)=>{const e=i+c;return o.length-1,{...a,cells:a==null?void 0:a.cells.map((l,P)=>{var v,j,H,$,le;const f=(H=(j=(v=a==null?void 0:a.cells)==null?void 0:v[0])==null?void 0:j.value)==null?void 0:H.value,w=Number((le=($=a==null?void 0:a.cells)==null?void 0:$[1])==null?void 0:le.value),x=g==null?void 0:g[f],F=x&&W({value:w})?(x*w).toFixed(2):null;if(P===0)return{...l,onChange:te=>h({rowIndex:e,value:te.target.value})};if(P===1)return{...l,onChange:te=>b({rowIndex:e,value:te.target.value}),error:W({value:l.value})?null:"Must be valid whole number"};if(P===2)return{...l,value:F}}),actions:[{label:"Delete",icon:"minus",onClick:()=>R({rowIndex:e})}]}});return n.jsx(A,{table:{defaultEmptyRow:r,onAddRow:y,columnAlignment:["left","right","right"],headers:[{cells:[{value:"Drink"},{value:"Quantity"},{value:"Total Price (£)"}],actions:[{primary:!0,icon:"plus",label:"Add",onClick:()=>y()}]}],rows:D,footer:{pagination:{rowCount:o.length,selectedPage:s,rowsPerPage:{onChange:a=>{const{value:c}=a.target;m(Number(c))},options:k,value:d},onSelectPage:a=>t(a),small:!0}}}})},Y=()=>{const g=["Section","Width","Height"];let u=Array.from(Array(10),(d,m)=>[m,m*2,m*2]);const[r,T]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),o=(d,m,s,t)=>{u[m][s]=Number(d.target.value),t()},C=(d,m,s,t)=>{var p;let i=((p=d==null?void 0:d.clipboardData)==null?void 0:p.getData("text"))??"";return T({rowIndex:m,cellIndex:s,pastedValues:i}),t(),{pastedData:r}},k=()=>{const[d,m]=S.useState(!1),s=()=>{m(!d)},t={headers:[{cells:g.map(i=>({value:i}))}],rows:u.map((i,p)=>{const y=p;return{cells:[...Array(3).keys()].map((R,h)=>({value:i[h],type:"Input",onChange:b=>o(b,y,h,s),onPaste:b=>C(b,y,h,s)}))}})};return n.jsxs(n.Fragment,{children:[n.jsx(A,{table:t}),n.jsx(re,{label:"Pasted Data",children:n.jsx(ae,{value:r.pastedValues})}),n.jsx(re,{label:"At Row",children:n.jsx(ae,{value:r.rowIndex})}),n.jsx(re,{label:"At Cell Index",children:n.jsx(ae,{value:r.cellIndex})})]})};return n.jsx(k,{})},Z=()=>{const g={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],columnAlignment:[...Array(10)].map((u,r)=>"right"),headers:[{cells:[...Array(10)].map((u,r)=>({value:"Heading"}))},{cells:[...Array(10)].map((u,r)=>({options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],type:"Select",searchable:!1,value:{label:"m",value:"m"},autoLayerWidth:!0}))}],rows:[...Array(10)].map((u,r)=>({cells:[...Array(10)].map((T,o)=>({value:123.45})),actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here lorem ipsum"}),n.jsx(V,{children:"Label: 123.45m"}),n.jsx(V,{children:"Another label: 123.45m"}),n.jsx(V,{children:"Label: 123.45m"})]})}]}))};return n.jsx(A,{table:g})},ee=()=>{const g={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],headers:[{cells:[{value:"Label"},{value:"Value",colSpan:2}]}],rows:[{cells:[{value:"Country",style:{fontWeight:"bold"},width:"120px"},{value:"Norway",colSpan:2}],actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here"}),n.jsx(V,{children:"Details go here"})]})}]},{cells:[{value:"Depth",style:{fontWeight:"bold"}},{value:123,width:"80px"},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:{label:"m",value:"m"},type:"Select",width:"80px"}],actions:[{icon:"help",tooltip:n.jsxs(se,{children:[n.jsx(V,{bold:!0,children:"Title goes here"}),n.jsx(V,{children:"Details go here"})]})}]}]};return n.jsx(A,{table:g})};var ie,ce,de;K.parameters={...K.parameters,docs:{...(ie=K.parameters)==null?void 0:ie.docs,source:{originalSource:`args => {
|
|
1
|
+
import{j as n}from"./jsx-runtime-FsUICBgo.js";import{r as S}from"./index-RfLt4OUa.js";import{f as B}from"./immer.esm-bD7SSJ7T.js";import{l as q}from"./lodash-Bmg8FrMx.js";import{G as le}from"./grid-u1mZpaML.js";import{T as W}from"./text-6KQ6ntOV.js";import{T as D}from"./table-ZBqRpa7M.js";import{C as dn}from"./card-0r8RRVk-.js";import{I as se}from"./input-fYKvBwPs.js";import{F as oe}from"./field-m7XXDdEG.js";import{H as un}from"./heading-4tVgoT7O.js";import{t as ae,x as pn,y as gn,z as mn,A as bn,B as hn,C as wn,D as vn}from"./table.stories-data-tjY9V0bM.js";import"./styled-components.browser.esm-qIipjd6c.js";import"./tslib.es6-OIsz3r9a.js";import"./index-VW3EWkuE.js";import"./index.es-VXFRDikp.js";import"./inheritsLoose-8sb_A2v4.js";import"./redux-F5dueAP3.js";import"./objectSpread2-93s0nBry.js";import"./tiny-invariant-R4kOKlvx.js";import"./index-miLrID2P.js";import"./memoize-one.esm-hqe5SRxC.js";import"./objectWithoutPropertiesLoose-9Q1jwsKS.js";import"./actions-7PO9r8zE.js";import"./common-types-U65vzrrz.js";import"./disabled-context-urNQThQz.js";import"./button-BiJw0fB3.js";import"./spinner-R8Il4aRe.js";import"./icon-8EQazuuW.js";import"./index-4QtD-hFu.js";import"./tooltip-dueTLnwA.js";import"./types-VB5zD18b.js";import"./types-5uVBABF4.js";import"./badge-23Ty_zBt.js";import"./pagination-DtJdggbI.js";import"./select-AcJYUY86.js";import"./assertThisInitialized-4q6YPdh3.js";import"./select.input-zP5tW20f.js";import"./input-group-R8LoqKRn.js";import"./input-group-addon-BHVsW9mL.js";import"./number-input-ymd7m-s5.js";import"./index-qZmQ7nA9.js";import"./index-cCpkwrS5.js";import"./check-box-KynSyTaY.js";import"./help-icon-eelulTML.js";import"./slider-n3IxC2iq.js";import"./index-ugi_ZH6T.js";import"./popover-1CwIRm4P.js";import"./label-bLcoUwtK.js";import"./flex-RYZsoWEN.js";const bt={title:"Basic/Table",component:D,args:{table:{...ae}}},A=h=>n.jsx(D,{...h}),z=A.bind({}),_=A.bind({});_.args={table:{...ae,fixedWidth:"400px"}};const N=A.bind({});N.args={table:{...ae,fixedWidth:"auto"}};const O=A.bind({});O.args={table:pn};O.parameters={docs:{description:{story:"Use sparingly when certain columns cannot be below a certain width. Unless the Table is auto width, set one column to `auto` to use remaining space."}}};const L=A.bind({});L.args={table:gn};const U=A.bind({});U.args={table:mn};U.parameters={docs:{description:{story:"This is only required when you need to override `columnAlignment` in header cells (i.e. they have different alignment)"}}};const Q=A.bind({});Q.args={table:bn};const E=A.bind({});E.args={table:hn};E.decorators=[h=>n.jsx("div",{style:{position:"absolute",inset:0,padding:"var(--padding)"},children:n.jsx(h,{})})];const M=A.bind({});M.args={table:wn};M.parameters={docs:{description:{story:"If a `maxHeight` is set, the table should only fill that height if it needs to."}}};const G=A.bind({});G.args={table:vn};const $=()=>n.jsx(dn,{heading:n.jsx(un,{children:"Card heading"}),padding:!1,children:n.jsx(D,{table:{...ae,bordered:!1}})});$.parameters={docs:{source:{type:"dynamic"}}};const J=()=>{const h=["Section","Width","Height"];let m=["","m","m"],o=[...Array(175).keys()].map((l,t)=>[t,t*2,t*2]);const x=(l,t,r)=>l==="m"&&t==="ft"?r*3.28084:l==="ft"&&t==="m"?r/3.28084:r,i=(l,t,r,c)=>{o[t][r]=l.target.value,c()},R=l=>{o=o.concat([["","",""]]),l()},k=(l,t)=>{o=o.filter((r,c)=>c!==l),t()},p=(l,t,r)=>{const c=m[t],b=l.target.value;m=m.map((v,s)=>s===t?b:v),o=o.map(v=>v.map((s,u)=>u===t?x(c,b,s):s)),r()},w=()=>{const l=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[t,r]=S.useState(10),[c,b]=S.useState(1),[v,s]=S.useState(!1),u=()=>{s(!v)},j=()=>{const e=Math.ceil(o.length/t);b(e)},T=(c-1)*t,a=t===0?o.length-1:T+t,g={headers:[{cells:h.map(e=>({value:e})),actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{R(u),j()}}]},{cells:[{},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:m[1],type:"Select",native:!0,onChange:e=>p(e,1,u)},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:m[2],type:"Select",native:!0,onChange:e=>p(e,2,u)}]}],rows:o.slice(T,a).map((e,d)=>{const I=T+d;return{cells:[...Array(3).keys()].map((P,y)=>({value:e[y],type:"Input",onChange:C=>i(C,I,y,u)})),actions:[{label:"Delete",icon:"minus",onClick:()=>k(I,u)}]}}),footer:{pagination:{rowCount:o.length,selectedPage:c,rowsPerPage:{onChange:e=>{const{value:d}=e.target;r(Number(d))},options:l,value:t},onSelectPage:e=>b(e),small:!0}}};return n.jsx(D,{table:g})};return n.jsx(w,{})},X=()=>{const h=["Section","Width","Height"];let m=[...Array(20).keys()].map((x,i)=>({Section:q.random(0,100),Width:q.random(0,100),Height:q.random(0,100)}));const o=()=>{const[x,i]=S.useState({Section:"up"}),R=(r,c)=>r.sort((b,v)=>Object.entries(c).map(([s,u])=>{switch(u){case"up":return b[s]-v[s];case"down":return v[s]-b[s];default:return 0}}).reduce((s,u)=>s||u,0)),k=(r,c,b)=>({dataSortCells:r.map(s=>{const u=Object.keys(c).includes(s)?c[s]:"",j=`${s[0].toUpperCase()}${s.slice(1)}`;return{key:s,value:j,hasSort:!0,sort:u,onSort:()=>{const T=u==="up"?"down":"up";b({[s]:T})}}})}),{dataSortCells:p}=k(h,x,i),l=[...R(m,x).map(r=>({cells:Object.entries(r).map(([b,v])=>({key:b,value:v,type:"Input",disabled:!0}))}))],t={headers:[{cells:p}],rows:l};return n.jsx(D,{table:t})};return n.jsx(o,{})},Y=()=>{const h=["Section","Width","Height"];let m=[...Array(175).keys()].map((x,i)=>({Section:i,Width:i*2,Height:i*2}));const o=()=>{const x=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[i,R]=S.useState(10),[k,p]=S.useState(1),[w,l]=S.useState({}),[t,r]=S.useState({});S.useEffect(()=>{p(1)},[w,t]);const c=(k-1)*i,b=i===0?m.length-1:c+i,v=(e,d,I)=>e.filter(P=>Object.keys(d).every(y=>d[y]===""?!0:P[y].toString().includes(d[y]))).sort((P,y)=>Object.entries(I).map(([C,H])=>{switch(H){case"up":return P[C]-y[C];case"down":return y[C]-P[C];default:return 0}}).reduce((C,H)=>C||H,0)),s=(e,d,I,P,y)=>{const C=e.map(f=>{const V=Object.keys(P).includes(f)?P[f]:"",F=`${f[0].toUpperCase()}${f.slice(1)}`;return{key:f,value:F,hasSort:!0,sort:V,onSort:()=>{const K=V===""?"up":V==="up"?"down":"";y({...P,[f]:K})}}}),H=e.map(f=>{const V=Object.keys(d).includes(f)?d[f]:"";return{key:f,value:V,type:"Input",placeholder:"Filter",onChange:F=>I({...d,[f]:F.target.value})}});return{dataSortCells:C,dataFilterCells:H}},{dataSortCells:u,dataFilterCells:j}=s(h,w,l,t,r),T=v(m,w,t),a=[...T.slice(c,b).map(e=>({cells:Object.entries(e).map(([I,P])=>({key:I,value:P,type:"Input",disabled:!0}))}))],g={headers:[{cells:u},{cells:j}],rows:a,footer:{pagination:{rowCount:T.length,selectedPage:k,rowsPerPage:{onChange:e=>{const{value:d}=e.target;R(Number(d))},options:x,value:i},onSelectPage:e=>p(e),small:!0}}};return n.jsx(D,{table:g})};return n.jsx(o,{})},Z=()=>{const h={tea:3.6,coffee:3.2,orange:4.1},m=[{label:"Tea",value:"tea"},{label:"Coffee",value:"coffee"},{label:"Orange juice",value:"orange"}],o={cells:[{type:"Select",options:m,value:{value:"tea"}},{type:"Input"},{type:"Static"}]},x=[...Array(15).keys()].map((a,g)=>({cells:[{type:"Select",options:m,value:{value:"tea"}},{type:"Input",value:g+1},{type:"Static"}]})),[i,R]=S.useState(x),k=[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],[p,w]=S.useState(10),[l,t]=S.useState(1),r=(l-1)*p,c=p===0?i.length-1:r+p,b=({newRow:a}={})=>{const g=B(i,e=>{e.push(a??o)});R(g)},v=({rowIndex:a})=>{const g=B(i,e=>{delete e[a]}).filter(e=>e);R(g)},s=({rowIndex:a,value:g})=>{const e=B(i,d=>{d[a].cells[0].value.value=g});R(e)},u=({rowIndex:a,value:g})=>{const e=B(i,d=>{d[a].cells[1].value=g});R(e)},j=({value:a})=>{const g=Number(a);return!q.isNaN(g)&&q.isInteger(g)&&g>0},T=i.slice(r,c).map((a,g)=>{const e=r+g;return i.length-1,{...a,cells:a==null?void 0:a.cells.map((d,I)=>{var f,V,F,K,ie;const P=(F=(V=(f=a==null?void 0:a.cells)==null?void 0:f[0])==null?void 0:V.value)==null?void 0:F.value,y=Number((ie=(K=a==null?void 0:a.cells)==null?void 0:K[1])==null?void 0:ie.value),C=h==null?void 0:h[P],H=C&&j({value:y})?(C*y).toFixed(2):null;if(I===0)return{...d,onChange:re=>s({rowIndex:e,value:re.target.value})};if(I===1)return{...d,onChange:re=>u({rowIndex:e,value:re.target.value}),error:j({value:d.value})?null:"Must be valid whole number"};if(I===2)return{...d,value:H}}),actions:[{label:"Delete",icon:"minus",onClick:()=>v({rowIndex:e})}]}});return n.jsx(D,{table:{defaultEmptyRow:o,onAddRow:b,columnAlignment:["left","right","right"],headers:[{cells:[{value:"Drink"},{value:"Quantity"},{value:"Total Price (£)"}],actions:[{primary:!0,icon:"plus",label:"Add",onClick:()=>b()}]}],rows:T,footer:{pagination:{rowCount:i.length,selectedPage:l,rowsPerPage:{onChange:a=>{const{value:g}=a.target;w(Number(g))},options:k,value:p},onSelectPage:a=>t(a),small:!0}}}})},ee=()=>{const h=["Section","Width","Height"];let m=Array.from(Array(10),(p,w)=>[w,w*2,w*2]);const[o,x]=S.useState({pastedValues:"",rowIndex:0,cellIndex:0}),i=(p,w,l,t)=>{m[w][l]=Number(p.target.value),t()},R=(p,w,l,t)=>{var c;let r=((c=p==null?void 0:p.clipboardData)==null?void 0:c.getData("text"))??"";return x({rowIndex:w,cellIndex:l,pastedValues:r}),t(),{pastedData:o}},k=()=>{const[p,w]=S.useState(!1),l=()=>{w(!p)},t={headers:[{cells:h.map(r=>({value:r}))}],rows:m.map((r,c)=>{const b=c;return{cells:[...Array(3).keys()].map((v,s)=>({value:r[s],type:"Input",onChange:u=>i(u,b,s,l),onPaste:u=>R(u,b,s,l)}))}})};return n.jsxs(n.Fragment,{children:[n.jsx(D,{table:t}),n.jsx(oe,{label:"Pasted Data",children:n.jsx(se,{value:o.pastedValues})}),n.jsx(oe,{label:"At Row",children:n.jsx(se,{value:o.rowIndex})}),n.jsx(oe,{label:"At Cell Index",children:n.jsx(se,{value:o.cellIndex})})]})};return n.jsx(k,{})},ne=()=>{const h={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],columnAlignment:[...Array(10)].map((m,o)=>"right"),headers:[{cells:[...Array(10)].map((m,o)=>({value:"Heading"}))},{cells:[...Array(10)].map((m,o)=>({options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],type:"Select",searchable:!1,value:{label:"m",value:"m"},autoLayerWidth:!0}))}],rows:[...Array(10)].map((m,o)=>({cells:[...Array(10)].map((x,i)=>({value:123.45})),actions:[{icon:"help",tooltip:n.jsxs(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here lorem ipsum"}),n.jsx(W,{children:"Label: 123.45m"}),n.jsx(W,{children:"Another label: 123.45m"}),n.jsx(W,{children:"Label: 123.45m"})]})}]}))};return n.jsx(D,{table:h})},te=()=>{const h={fixedWidth:"auto",name:"Table title",actions:[{icon:"download",tooltip:"Download"}],headers:[{cells:[{value:"Label"},{value:"Value",colSpan:2}]}],rows:[{cells:[{value:"Country",style:{fontWeight:"bold"},width:"120px"},{value:"Norway",colSpan:2}],actions:[{icon:"help",tooltip:n.jsxs(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here"}),n.jsx(W,{children:"Details go here"})]})}]},{cells:[{value:"Depth",style:{fontWeight:"bold"}},{value:123,width:"80px"},{options:[{label:"m",value:"m"},{label:"ft",value:"ft"}],value:{label:"m",value:"m"},type:"Select",width:"80px"}],actions:[{icon:"help",tooltip:n.jsxs(le,{children:[n.jsx(W,{bold:!0,children:"Title goes here"}),n.jsx(W,{children:"Details go here"})]})}]}]};return n.jsx(D,{table:h})};var ce,de,ue;z.parameters={...z.parameters,docs:{...(ce=z.parameters)==null?void 0:ce.docs,source:{originalSource:`args => {
|
|
2
2
|
return <Table
|
|
3
3
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
4
|
{...args} />;
|
|
5
|
-
}`,...(
|
|
5
|
+
}`,...(ue=(de=z.parameters)==null?void 0:de.docs)==null?void 0:ue.source}}};var pe,ge,me;_.parameters={..._.parameters,docs:{...(pe=_.parameters)==null?void 0:pe.docs,source:{originalSource:`args => {
|
|
6
6
|
return <Table
|
|
7
7
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
8
8
|
{...args} />;
|
|
9
|
-
}`,...(
|
|
9
|
+
}`,...(me=(ge=_.parameters)==null?void 0:ge.docs)==null?void 0:me.source}}};var be,he,we;N.parameters={...N.parameters,docs:{...(be=N.parameters)==null?void 0:be.docs,source:{originalSource:`args => {
|
|
10
10
|
return <Table
|
|
11
11
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
12
12
|
{...args} />;
|
|
13
|
-
}`,...(
|
|
13
|
+
}`,...(we=(he=N.parameters)==null?void 0:he.docs)==null?void 0:we.source}}};var ve,ye,fe;O.parameters={...O.parameters,docs:{...(ve=O.parameters)==null?void 0:ve.docs,source:{originalSource:`args => {
|
|
14
14
|
return <Table
|
|
15
15
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
16
16
|
{...args} />;
|
|
17
|
-
}`,...(
|
|
17
|
+
}`,...(fe=(ye=O.parameters)==null?void 0:ye.docs)==null?void 0:fe.source}}};var Se,xe,Pe;L.parameters={...L.parameters,docs:{...(Se=L.parameters)==null?void 0:Se.docs,source:{originalSource:`args => {
|
|
18
18
|
return <Table
|
|
19
19
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
20
20
|
{...args} />;
|
|
21
|
-
}`,...(
|
|
21
|
+
}`,...(Pe=(xe=L.parameters)==null?void 0:xe.docs)==null?void 0:Pe.source}}};var Ce,Re,Ie;U.parameters={...U.parameters,docs:{...(Ce=U.parameters)==null?void 0:Ce.docs,source:{originalSource:`args => {
|
|
22
22
|
return <Table
|
|
23
23
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
24
24
|
{...args} />;
|
|
25
|
-
}`,...(
|
|
25
|
+
}`,...(Ie=(Re=U.parameters)==null?void 0:Re.docs)==null?void 0:Ie.source}}};var ke,Te,De;Q.parameters={...Q.parameters,docs:{...(ke=Q.parameters)==null?void 0:ke.docs,source:{originalSource:`args => {
|
|
26
26
|
return <Table
|
|
27
27
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
28
28
|
{...args} />;
|
|
29
|
-
}`,...(
|
|
29
|
+
}`,...(De=(Te=Q.parameters)==null?void 0:Te.docs)==null?void 0:De.source}}};var Ae,je,Ve;E.parameters={...E.parameters,docs:{...(Ae=E.parameters)==null?void 0:Ae.docs,source:{originalSource:`args => {
|
|
30
30
|
return <Table
|
|
31
31
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
32
32
|
{...args} />;
|
|
33
|
-
}`,...(
|
|
33
|
+
}`,...(Ve=(je=E.parameters)==null?void 0:je.docs)==null?void 0:Ve.source}}};var We,He,Fe;M.parameters={...M.parameters,docs:{...(We=M.parameters)==null?void 0:We.docs,source:{originalSource:`args => {
|
|
34
34
|
return <Table
|
|
35
35
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
36
36
|
{...args} />;
|
|
37
|
-
}`,...(
|
|
37
|
+
}`,...(Fe=(He=M.parameters)==null?void 0:He.docs)==null?void 0:Fe.source}}};var Oe,Ue,Ee;G.parameters={...G.parameters,docs:{...(Oe=G.parameters)==null?void 0:Oe.docs,source:{originalSource:`args => {
|
|
38
38
|
return <Table
|
|
39
39
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
40
40
|
{...args} />;
|
|
41
|
-
}`,...(
|
|
41
|
+
}`,...(Ee=(Ue=G.parameters)==null?void 0:Ue.docs)==null?void 0:Ee.source}}};var Me,_e,Ne;$.parameters={...$.parameters,docs:{...(Me=$.parameters)==null?void 0:Me.docs,source:{originalSource:`() => <Card heading={<Heading>Card heading</Heading>} padding={false}>
|
|
42
42
|
<Table table={({
|
|
43
43
|
...storyData.table,
|
|
44
44
|
bordered: false
|
|
45
45
|
} as any)} />
|
|
46
|
-
</Card>`,...(
|
|
46
|
+
</Card>`,...(Ne=(_e=$.parameters)==null?void 0:_e.docs)==null?void 0:Ne.source}}};var Le,Qe,Ge;J.parameters={...J.parameters,docs:{...(Le=J.parameters)==null?void 0:Le.docs,source:{originalSource:`() => {
|
|
47
47
|
/*
|
|
48
48
|
Mock table data store (real apps should use Redux or similar)
|
|
49
49
|
*/
|
|
@@ -185,7 +185,83 @@ import{j as n}from"./jsx-runtime-FsUICBgo.js";import{r as S}from"./index-RfLt4OU
|
|
|
185
185
|
return <Table table={(table as any)} />;
|
|
186
186
|
};
|
|
187
187
|
return <ManagedTable />;
|
|
188
|
-
}`,...(
|
|
188
|
+
}`,...(Ge=(Qe=J.parameters)==null?void 0:Qe.docs)==null?void 0:Ge.source}}};var $e,qe,Ke;X.parameters={...X.parameters,docs:{...($e=X.parameters)==null?void 0:$e.docs,source:{originalSource:`() => {
|
|
189
|
+
/*
|
|
190
|
+
Mock table data store (real apps should use Redux or similar)
|
|
191
|
+
*/
|
|
192
|
+
const headings = ['Section', 'Width', 'Height'];
|
|
193
|
+
let keyedData = [...Array(20).keys()].map((_c, i) => ({
|
|
194
|
+
Section: random(0, 100),
|
|
195
|
+
Width: random(0, 100),
|
|
196
|
+
Height: random(0, 100)
|
|
197
|
+
}));
|
|
198
|
+
/*
|
|
199
|
+
Container component manages state and configuration of table
|
|
200
|
+
*/
|
|
201
|
+
const TableWithSort: StoryFn<any> = () => {
|
|
202
|
+
const [sort, setSort] = useState({
|
|
203
|
+
Section: 'up'
|
|
204
|
+
});
|
|
205
|
+
const sortDataRows = (dataRows: any, sort: any) => dataRows.sort((a: any, b: any) => Object.entries(sort).map(([key, value]) => {
|
|
206
|
+
switch (value) {
|
|
207
|
+
case 'up':
|
|
208
|
+
{
|
|
209
|
+
return a[key] - b[key];
|
|
210
|
+
}
|
|
211
|
+
case 'down':
|
|
212
|
+
{
|
|
213
|
+
return b[key] - a[key];
|
|
214
|
+
}
|
|
215
|
+
default:
|
|
216
|
+
return 0;
|
|
217
|
+
}
|
|
218
|
+
}).reduce((a, acc) => a || acc, 0));
|
|
219
|
+
const dataHeaders = (dataRowsKeys: any, sort: any, setSort: any) => {
|
|
220
|
+
const dataSortCells = dataRowsKeys.map((key: any) => {
|
|
221
|
+
const sortDirection = Object.keys(sort).includes(key) ? sort[key] : '';
|
|
222
|
+
const prettifyHeaderValue = \`\${key[0].toUpperCase()}\${key.slice(1)}\`;
|
|
223
|
+
return {
|
|
224
|
+
key,
|
|
225
|
+
value: prettifyHeaderValue,
|
|
226
|
+
hasSort: true,
|
|
227
|
+
sort: sortDirection,
|
|
228
|
+
onSort: () => {
|
|
229
|
+
const newSortDirection = sortDirection === 'up' ? 'down' : 'up';
|
|
230
|
+
setSort({
|
|
231
|
+
[key]: newSortDirection
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
});
|
|
236
|
+
return {
|
|
237
|
+
dataSortCells
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
const {
|
|
241
|
+
dataSortCells
|
|
242
|
+
} = dataHeaders(headings, sort, setSort);
|
|
243
|
+
const sortedData = sortDataRows(keyedData, sort);
|
|
244
|
+
const dataRows = [...sortedData.map((dataRow: any) => {
|
|
245
|
+
const rowsCells = Object.entries(dataRow).map(([key, value]) => ({
|
|
246
|
+
key,
|
|
247
|
+
value,
|
|
248
|
+
type: 'Input',
|
|
249
|
+
disabled: true
|
|
250
|
+
}));
|
|
251
|
+
return {
|
|
252
|
+
cells: rowsCells
|
|
253
|
+
};
|
|
254
|
+
})];
|
|
255
|
+
const table = {
|
|
256
|
+
headers: [{
|
|
257
|
+
cells: dataSortCells
|
|
258
|
+
}],
|
|
259
|
+
rows: dataRows
|
|
260
|
+
};
|
|
261
|
+
return <Table table={(table as any)} />;
|
|
262
|
+
};
|
|
263
|
+
return <TableWithSort />;
|
|
264
|
+
}`,...(Ke=(qe=X.parameters)==null?void 0:qe.docs)==null?void 0:Ke.source}}};var Be,ze,Je;Y.parameters={...Y.parameters,docs:{...(Be=Y.parameters)==null?void 0:Be.docs,source:{originalSource:`() => {
|
|
189
265
|
/*
|
|
190
266
|
Mock table data store (real apps should use Redux or similar)
|
|
191
267
|
*/
|
|
@@ -318,7 +394,7 @@ import{j as n}from"./jsx-runtime-FsUICBgo.js";import{r as S}from"./index-RfLt4OU
|
|
|
318
394
|
return <Table table={(table as any)} />;
|
|
319
395
|
};
|
|
320
396
|
return <TableWithSortAndFilter />;
|
|
321
|
-
}`,...(
|
|
397
|
+
}`,...(Je=(ze=Y.parameters)==null?void 0:ze.docs)==null?void 0:Je.source}}};var Xe,Ye,Ze;Z.parameters={...Z.parameters,docs:{...(Xe=Z.parameters)==null?void 0:Xe.docs,source:{originalSource:`() => {
|
|
322
398
|
const prices = {
|
|
323
399
|
tea: 3.6,
|
|
324
400
|
coffee: 3.2,
|
|
@@ -506,7 +582,7 @@ import{j as n}from"./jsx-runtime-FsUICBgo.js";import{r as S}from"./index-RfLt4OU
|
|
|
506
582
|
}
|
|
507
583
|
}
|
|
508
584
|
} as any)} />;
|
|
509
|
-
}`,...(
|
|
585
|
+
}`,...(Ze=(Ye=Z.parameters)==null?void 0:Ye.docs)==null?void 0:Ze.source}}};var en,nn,tn;ee.parameters={...ee.parameters,docs:{...(en=ee.parameters)==null?void 0:en.docs,source:{originalSource:`() => {
|
|
510
586
|
const headings = ['Section', 'Width', 'Height'];
|
|
511
587
|
let data = Array.from(Array(10), (_, i) => [i, i * 2, i * 2]);
|
|
512
588
|
const [pastedData, setpastedData] = useState<PastedData>({
|
|
@@ -578,7 +654,7 @@ import{j as n}from"./jsx-runtime-FsUICBgo.js";import{r as S}from"./index-RfLt4OU
|
|
|
578
654
|
</>;
|
|
579
655
|
};
|
|
580
656
|
return <CallbackCellTable />;
|
|
581
|
-
}`,...(
|
|
657
|
+
}`,...(tn=(nn=ee.parameters)==null?void 0:nn.docs)==null?void 0:tn.source}}};var an,rn,sn;ne.parameters={...ne.parameters,docs:{...(an=ne.parameters)==null?void 0:an.docs,source:{originalSource:`() => {
|
|
582
658
|
const table = {
|
|
583
659
|
fixedWidth: 'auto',
|
|
584
660
|
name: 'Table title',
|
|
@@ -625,7 +701,7 @@ import{j as n}from"./jsx-runtime-FsUICBgo.js";import{r as S}from"./index-RfLt4OU
|
|
|
625
701
|
}))
|
|
626
702
|
};
|
|
627
703
|
return <Table table={table} />;
|
|
628
|
-
}`,...(
|
|
704
|
+
}`,...(sn=(rn=ne.parameters)==null?void 0:rn.docs)==null?void 0:sn.source}}};var on,ln,cn;te.parameters={...te.parameters,docs:{...(on=te.parameters)==null?void 0:on.docs,source:{originalSource:`() => {
|
|
629
705
|
const table = {
|
|
630
706
|
fixedWidth: 'auto',
|
|
631
707
|
name: 'Table title',
|
|
@@ -693,4 +769,4 @@ import{j as n}from"./jsx-runtime-FsUICBgo.js";import{r as S}from"./index-RfLt4OU
|
|
|
693
769
|
}]
|
|
694
770
|
};
|
|
695
771
|
return <Table table={table} />;
|
|
696
|
-
}`,...(
|
|
772
|
+
}`,...(cn=(ln=te.parameters)==null?void 0:ln.docs)==null?void 0:cn.source}}};const ht=["Default","FixedWidth","AutoWidth","ColumnWidths","ColumnAlignment","ColumnHeaderAlignment","InfiniteScrollFixedHeight","InfiniteScrollFullHeight","InfiniteScrollShort","InfiniteScrollWithDragAndDrop","InCard","Managed","ManagedWithSort","ManagedWithFilterAndMultipleSort","AutoAddNewRow","OnPasteCallback","ExampleTableWithInfoTooltips","ExampleTableWithInlineUnits"];export{Z as AutoAddNewRow,N as AutoWidth,L as ColumnAlignment,U as ColumnHeaderAlignment,O as ColumnWidths,z as Default,ne as ExampleTableWithInfoTooltips,te as ExampleTableWithInlineUnits,_ as FixedWidth,$ as InCard,Q as InfiniteScrollFixedHeight,E as InfiniteScrollFullHeight,M as InfiniteScrollShort,G as InfiniteScrollWithDragAndDrop,J as Managed,Y as ManagedWithFilterAndMultipleSort,X as ManagedWithSort,ee as OnPasteCallback,ht as __namedExportsOrder,bt as default};
|
package/dist/storybook/assets/{table.stories-data-hDQBe08f.js → table.stories-data-tjY9V0bM.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t}from"./jsx-runtime-FsUICBgo.js";import{I as o,T as c}from"./common-types-U65vzrrz.js";import{F as v}from"./flex-RYZsoWEN.js";import{M as p}from"./actions-0lKGEXVi.js";import{T as d}from"./text-6KQ6ntOV.js";import{I as n}from"./icon-_m67DAr0.js";import{M as r}from"./types-VB5zD18b.js";const e={headers:[{cells:[{value:"Name"},{value:"Weight"},{value:"Energy"},{value:"Origin"}]}],rows:[{cells:[{value:"Brown rice",testId:"table-tbody-cell-brown-rice"},{value:100,testId:"table-tbody-cell-100"},{value:361,testId:"table-tbody-cell-361"},{value:"Vietnam",testId:"table-tbody-cell-vietnam"}]},{cells:[{value:"Buckwheat",testId:"table-tbody-cell-buckwheat"},{value:50,testId:"table-tbody-cell-50"},{value:358,testId:"table-tbody-cell-358"},{value:"Poland",testId:"table-tbody-cell-poland"}]},{cells:[{value:"Couscous",testId:"table-tbody-cell-couscous"},{value:10,testId:"table-tbody-cell-10"},{value:368,testId:"table-tbody-cell-368"},{value:"France",testId:"table-tbody-cell-france"}]}]},S={...e,columnWidths:["200px","20%","100px","auto"]},x={...e,rows:e.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,tooltip:"Tooltip"}))}))},f={...e,rows:e.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,width:"200px"}))}))},W={...e,rows:e.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,style:{width:"200px",background:"var(--color-background-table-header)",fontWeight:"bold"}}))}))},F={...e,rows:[{cells:[{breakWord:!0,value:"LoremipsumdolorsitametconsecteturadipiscingelitseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquaUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariaturufugiatnullapariatur"},{value:100},{value:361},{value:"Vietnam"}]},...e.rows]},D={...e,headers:[...e.headers,{cells:[{},{options:[{label:"kg",value:"kg"},{label:"tonnes",value:"tonnes"}],type:"Select",searchable:!1,value:{label:"kg",value:"kg"},onChange:()=>{}},{type:"Unit",value:"kcal / 100g"},{}]}]},L={...e,rows:e.rows.map((l,a)=>({...l,active:a===0,onRowClick:()=>{}}))},E={...e,rows:e.rows.map((l,a)=>({...l,error:a===1}))},A={...e,rows:e.rows.map((l,a)=>({...l,warning:a===1}))},P={...e,name:"Food"},V={...e,name:t.jsxs(v,{gap:"var(--padding-xs)",alignItems:"center",children:["Food",t.jsx(n,{icon:o.STAR})]})},u=[{childComponent:t.jsx(p,{menu:{label:"Import food",trigger:c.DROP_DOWN_BUTTON,sections:[{type:r.HEADING,label:"Import options"},{type:r.OPTION,label:"Import from csv"},{type:r.OPTION,label:"Import from library"}],small:!0}})}],B={...e,name:"Food",actions:u,testId:"table-child-component"},N={...e,actions:u,actionsRight:!0},i={...e,headers:[...e.headers,{cells:[{},{options:[{label:"kg",value:"kg"},{label:"tonnes",value:"tonnes"}],type:"Select",native:!0,value:{label:"kg",value:"kg"},onChange:()=>{}},{type:"Unit",value:"kcal / 100g"},{}]}],bordered:!0,infiniteScroll:!0,maxHeight:"500px",stickyHeaders:!0,rows:Array.from({length:100},(l,a)=>({cells:[{type:"Input",value:`Strawberry Letter ${a+1}`},{type:"Input",value:100},{type:"Input",value:361},{type:"Input",value:"Vietnam"}]})),footer:{content:t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Footer content:"})," goes here"]})}},O={...i,maxHeight:"100%"},j={...i,rows:Array.from({length:1},(l,a)=>({cells:[{type:"Input",value:`Strawberry Letter ${a+1}`},{type:"Input",value:100},{type:"Input",value:361},{type:"Input",value:"Vietnam"}]}))},T={...i,draggable:!0},H={...e,rows:e.rows.map(l=>({...l,onRowFocus:()=>{}}))},b=()=>t.jsxs("ul",{children:[t.jsx("li",{children:"Carrots"}),t.jsx("li",{children:"Chocolate"}),t.jsx("li",{children:"Chorizo"})]}),R={headers:[{cells:[{value:"Name"},{value:"Content"}]}],rows:[{cells:[{value:"Sub-component"},{value:b()}]},{cells:[{value:"JSX"},{value:t.jsxs("div",{children:["Some ",t.jsx(d,{bold:!0,children:"bold content"})]})}]}]},m={...e,headers:[{cells:[{value:""},{value:"Stats",colSpan:2},{value:""}]},...e.headers],rows:[...e.rows,{cells:[{value:"Total",colSpan:4}]}]},q={...e,headers:[{cells:[{value:"Name",colSpan:2},{value:"Origin",rowSpan:2}]},{cells:[{value:"English"},{value:"Chinese"}]}],rows:[{cells:[{type:"Input",value:"Brown rice"},{type:"Input",value:"糙米"},{type:"Select",options:[{label:"China",value:"China"},{label:"France",value:"France"},{label:"Poland",value:"Poland"}],value:{label:"China",value:"China"},rowSpan:2}]},{cells:[{type:"Input",value:"White rice"},{type:"Input",value:"白米"}]}]},M={...e,columnWidths:["auto","120px","120px","auto"],headers:[{cells:[{value:"Header"},{value:"Header",colSpan:2},{value:"Header"}]}]},U={...e,columnAlignment:["left","right","right","left"]},J={...m,columnAlignment:["left","right","right","left","right"],columnHeaderAlignments:[["","center",""],["","right","right",""]]},s={fixedWidth:"auto",headers:[{cells:[{value:"Input",testId:"with-editable-cells-cell-name",width:"140px"},{value:"Select (native)",width:"140px"},{value:"Number Input",width:"140px"},{value:"Select (custom)",width:"140px"},{value:"Slider",width:"140px"},{value:"Static"}]}],rows:[{cells:[{value:"Buckwheat",type:"Input",onChange:()=>{},testId:"table-tbody-cell-buckwheat"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{}},{value:361,type:"NumberInput",onChange:()=>{}},{type:"Select",options:[{label:"France",value:"France"},{label:"Poland",value:"Poland"},{label:"Vietnam",value:"Vietnam"}],value:{label:"Poland",value:"Poland"},onChange:()=>{}},{type:"Slider",value:50,min:0,max:100,onChange:()=>{}},{value:361}]},{cells:[{value:"Arborio rice",type:"Input",onChange:()=>{},testId:"table-tbody-cell-arborio",error:"Error"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{},error:"Error"},{value:361,type:"NumberInput",onChange:()=>{},error:"Error"},{type:"Select",options:[{label:"France",value:"France"},{label:"Italy",value:"Italy"},{label:"Vietnam",value:"Vietnam"}],value:{label:"Italy",value:"Italy"},onChange:()=>{},error:"Error"},{type:"Slider",value:50,min:0,max:100,onChange:()=>{},error:"Error"},{value:361,error:"Error"}]},{cells:[{value:"Couscous",type:"Input",onChange:()=>{},testId:"table-tbody-cell-couscous",warning:"Warning"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{},warning:"Warning"},{value:361,type:"NumberInput",onChange:()=>{},warning:"Warning"},{type:"Select",options:[{label:"France",value:"France"},{label:"Poland",value:"Poland"},{label:"Vietnam",value:"Vietnam"}],value:{label:"France",value:"France"},onChange:()=>{},warning:"Warning"},{type:"Slider",value:50,min:0,max:100,onChange:()=>{},warning:"Warning"},{value:361,warning:"Warning"}]}]},z={...e,headers:e.headers.map(l=>({...l,cells:[{type:"CheckBox",onChange:()=>{}},...l.cells]})),rows:e.rows.map(l=>({...l,cells:[{type:"CheckBox",onChange:()=>{}},...l.cells]}))},_={...s,rows:s.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,disabled:!0}))}))},G={...e,headers:[...e.headers,{cells:[{value:"",type:"Input",placeholder:"Search",onChange:()=>{}},{value:"",type:"Input",placeholder:"Search",onChange:()=>{}},{value:"",type:"Input",placeholder:"Search",onChange:()=>{}},{value:"",type:"Input",placeholder:"Search",onChange:()=>{}}]}]},$={headers:[{cells:[{value:"Name"},{value:"Weight (kg)",hasSort:!0,sort:"up",sortPriority:1,onSort:()=>{}},{value:"Energy (kcal / 100g)",hasSort:!0,sort:"down",sortPriority:2,onSort:()=>{}},{value:"Origin",hasSort:!0,sort:"",sortPriority:1,onSort:()=>{}}]}],rows:[{cells:[{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"}]}]},K={headers:[{cells:[{},{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"}]}],rows:[{cells:[{type:"Icon",icon:t.jsx(n,{icon:o.SUCCESS,color:"var(--color-text-success)"}),tooltip:"Success tooltip here",width:"var(--size)"},{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"}]},{cells:[{type:"Icon",icon:t.jsx(n,{icon:o.WARNING,color:"var(--color-text-warning)"}),tooltip:"Warning tooltip here",width:"var(--size)"},{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}]},{cells:[{type:"Icon",icon:t.jsx(n,{icon:o.ERROR,color:"var(--color-text-error)"}),tooltip:"Error tooltip here",width:"var(--size)"},{value:"Couscous"},{value:10},{value:368},{value:"France"}]}]},X={headers:[{cells:[{value:"Lorem"},{value:"Ipsum"}]}],rows:[{cells:[{type:"Link",value:"Link text",onClick:()=>console.log("Link clicked")},{type:"Link",value:"Disabled link text",disabled:!0,onClick:()=>console.log("Link clicked")}]},{cells:[{type:"Link",value:"Static warning link",warning:"Warning message",onClick:()=>console.log("Link clicked")},{type:"Link",value:"Static error link",error:"Error message",onClick:()=>console.log("Link clicked")}]}]},Q={headers:[{cells:[{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{}}]}],rows:[{cells:[{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{label:"test",icon:"minus",onClick:()=>{},hidden:!0}]}]},Y={headers:[{cells:[{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"}],actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{}}]}],rows:[{cells:[{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"}],actions:[{label:"More",subActions:[{label:"Move Up",icon:"up",onClick:()=>{}},{label:"Move Down",icon:"down",onClick:()=>{}}]},{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}],actions:[{label:"More",subActions:[{label:"Move Up",icon:"up",onClick:()=>{}},{label:"Move Down",icon:"down",onClick:()=>{}}]},{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"}],actions:[{label:"More",subActions:[{label:"Move Up",icon:"up",onClick:()=>{}},{label:"Move Down",icon:"down",onClick:()=>{}}]},{label:"Delete",icon:"minus",onClick:()=>{}}]}]},Z={...e,footer:{content:t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Footer content:"})," goes here"]}),pagination:{rowCount:500,selectedPage:10,rowsPerPage:{onChange:()=>{},options:[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],value:20},goTo:{onChange:()=>{}},onSelectPage:()=>{},small:!0},actions:[{label:"Star",icon:"star",onClick:()=>{}}]}},ee={...e,headers:e.headers.map(l=>({...l,cells:l.cells.map(a=>({...a,helpIcon:{onClick:()=>console.log("Help clicked"),tooltip:"Help text goes here"},libraryIcon:{onClick:()=>console.log("Library clicked"),tooltip:"Edit in library"}}))}))},le={columnWidths:[void 0,"100px","100px","100px",void 0],columnAlignment:["left","right","left","left","left","right"],columnHeaderAlignments:[["left","right","left","left","left","right"]],headers:[{cells:[{value:"Lorem ipsum dolor sit amet consectetur adipiscing elit sed doeius mod tempor incididunt laboreet dolore magna aliqua"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"},{value:"Static"},{value:"Static Right"}]}],rows:[{cells:[{breakWord:!0,value:"LoremipsumdolorsitametconsecteturadipiscingelitseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquaUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariaturufugiatnullapariatur"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{},disabled:!0},{type:"Select",options:[{label:"Vietnam",value:"Vietnam"},{label:"Other",value:"Other"}],value:{label:"Vietnam",value:"Vietnam"},onChange:()=>{},error:"Error"},{value:"Brown rice",type:"Input",onChange:()=>{},testId:"table-tbody-cell-brown-rice",warning:"Warning message"},{value:"Static warning",warning:"Warning message"},{value:"100"}]},{cells:[{value:"Buckwheat"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{}},{type:"Select",options:[{label:"Vietnam",value:"Vietnam"},{label:"Other",value:"Other"}],value:{label:"Vietnam",value:"Vietnam"},onChange:()=>{}},{value:"Brown rice",type:"Input",onChange:()=>{},testId:"table-tbody-cell-brown-rice"},{type:"Link",value:"Static error link",error:"Error message"},{value:"100"}]}]},ae={fixedWidth:"auto",headers:[{cells:[{value:"Name"},{value:"Date of birth"}]}],rows:[{cells:[{value:"John Smith",width:"140px"},{value:"1980-05-05",type:"DateInput",width:"110px"}]},{cells:[{value:"Jane Doe",width:"140px"},{value:"1984-12-12",type:"DateInput",width:"110px"}]}]};export{i as A,O as B,j as C,T as D,D as E,P as F,V as G,B as H,G as I,$ as J,N as K,ee as L,s as a,_ as b,ae as c,m as d,M as e,f,W as g,q as h,z as i,K as j,X as k,Q as l,Y as m,R as n,x as o,F as p,le as q,Z as r,L as s,e as t,E as u,A as v,H as w,S as x,U as y,J as z};
|
|
1
|
+
import{j as t}from"./jsx-runtime-FsUICBgo.js";import{I as o,T as c}from"./common-types-U65vzrrz.js";import{F as v}from"./flex-RYZsoWEN.js";import{M as p}from"./actions-7PO9r8zE.js";import{T as d}from"./text-6KQ6ntOV.js";import{I as n}from"./icon-8EQazuuW.js";import{M as r}from"./types-VB5zD18b.js";const e={headers:[{cells:[{value:"Name"},{value:"Weight"},{value:"Energy"},{value:"Origin"}]}],rows:[{cells:[{value:"Brown rice",testId:"table-tbody-cell-brown-rice"},{value:100,testId:"table-tbody-cell-100"},{value:361,testId:"table-tbody-cell-361"},{value:"Vietnam",testId:"table-tbody-cell-vietnam"}]},{cells:[{value:"Buckwheat",testId:"table-tbody-cell-buckwheat"},{value:50,testId:"table-tbody-cell-50"},{value:358,testId:"table-tbody-cell-358"},{value:"Poland",testId:"table-tbody-cell-poland"}]},{cells:[{value:"Couscous",testId:"table-tbody-cell-couscous"},{value:10,testId:"table-tbody-cell-10"},{value:368,testId:"table-tbody-cell-368"},{value:"France",testId:"table-tbody-cell-france"}]}]},S={...e,columnWidths:["200px","20%","100px","auto"]},x={...e,rows:e.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,tooltip:"Tooltip"}))}))},f={...e,rows:e.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,width:"200px"}))}))},W={...e,rows:e.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,style:{width:"200px",background:"var(--color-background-table-header)",fontWeight:"bold"}}))}))},F={...e,rows:[{cells:[{breakWord:!0,value:"LoremipsumdolorsitametconsecteturadipiscingelitseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquaUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariaturufugiatnullapariatur"},{value:100},{value:361},{value:"Vietnam"}]},...e.rows]},D={...e,headers:[...e.headers,{cells:[{},{options:[{label:"kg",value:"kg"},{label:"tonnes",value:"tonnes"}],type:"Select",searchable:!1,value:{label:"kg",value:"kg"},onChange:()=>{}},{type:"Unit",value:"kcal / 100g"},{}]}]},L={...e,rows:e.rows.map((l,a)=>({...l,active:a===0,onRowClick:()=>{}}))},E={...e,rows:e.rows.map((l,a)=>({...l,error:a===1}))},A={...e,rows:e.rows.map((l,a)=>({...l,warning:a===1}))},P={...e,name:"Food"},V={...e,name:t.jsxs(v,{gap:"var(--padding-xs)",alignItems:"center",children:["Food",t.jsx(n,{icon:o.STAR})]})},u=[{childComponent:t.jsx(p,{menu:{label:"Import food",trigger:c.DROP_DOWN_BUTTON,sections:[{type:r.HEADING,label:"Import options"},{type:r.OPTION,label:"Import from csv"},{type:r.OPTION,label:"Import from library"}],small:!0}})}],B={...e,name:"Food",actions:u,testId:"table-child-component"},N={...e,actions:u,actionsRight:!0},i={...e,headers:[...e.headers,{cells:[{},{options:[{label:"kg",value:"kg"},{label:"tonnes",value:"tonnes"}],type:"Select",native:!0,value:{label:"kg",value:"kg"},onChange:()=>{}},{type:"Unit",value:"kcal / 100g"},{}]}],bordered:!0,infiniteScroll:!0,maxHeight:"500px",stickyHeaders:!0,rows:Array.from({length:100},(l,a)=>({cells:[{type:"Input",value:`Strawberry Letter ${a+1}`},{type:"Input",value:100},{type:"Input",value:361},{type:"Input",value:"Vietnam"}]})),footer:{content:t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Footer content:"})," goes here"]})}},O={...i,maxHeight:"100%"},j={...i,rows:Array.from({length:1},(l,a)=>({cells:[{type:"Input",value:`Strawberry Letter ${a+1}`},{type:"Input",value:100},{type:"Input",value:361},{type:"Input",value:"Vietnam"}]}))},T={...i,draggable:!0},H={...e,rows:e.rows.map(l=>({...l,onRowFocus:()=>{}}))},b=()=>t.jsxs("ul",{children:[t.jsx("li",{children:"Carrots"}),t.jsx("li",{children:"Chocolate"}),t.jsx("li",{children:"Chorizo"})]}),R={headers:[{cells:[{value:"Name"},{value:"Content"}]}],rows:[{cells:[{value:"Sub-component"},{value:b()}]},{cells:[{value:"JSX"},{value:t.jsxs("div",{children:["Some ",t.jsx(d,{bold:!0,children:"bold content"})]})}]}]},m={...e,headers:[{cells:[{value:""},{value:"Stats",colSpan:2},{value:""}]},...e.headers],rows:[...e.rows,{cells:[{value:"Total",colSpan:4}]}]},q={...e,headers:[{cells:[{value:"Name",colSpan:2},{value:"Origin",rowSpan:2}]},{cells:[{value:"English"},{value:"Chinese"}]}],rows:[{cells:[{type:"Input",value:"Brown rice"},{type:"Input",value:"糙米"},{type:"Select",options:[{label:"China",value:"China"},{label:"France",value:"France"},{label:"Poland",value:"Poland"}],value:{label:"China",value:"China"},rowSpan:2}]},{cells:[{type:"Input",value:"White rice"},{type:"Input",value:"白米"}]}]},M={...e,columnWidths:["auto","120px","120px","auto"],headers:[{cells:[{value:"Header"},{value:"Header",colSpan:2},{value:"Header"}]}]},U={...e,columnAlignment:["left","right","right","left"]},J={...m,columnAlignment:["left","right","right","left","right"],columnHeaderAlignments:[["","center",""],["","right","right",""]]},s={fixedWidth:"auto",headers:[{cells:[{value:"Input",testId:"with-editable-cells-cell-name",width:"140px"},{value:"Select (native)",width:"140px"},{value:"Number Input",width:"140px"},{value:"Select (custom)",width:"140px"},{value:"Slider",width:"140px"},{value:"Static"}]}],rows:[{cells:[{value:"Buckwheat",type:"Input",onChange:()=>{},testId:"table-tbody-cell-buckwheat"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{}},{value:361,type:"NumberInput",onChange:()=>{}},{type:"Select",options:[{label:"France",value:"France"},{label:"Poland",value:"Poland"},{label:"Vietnam",value:"Vietnam"}],value:{label:"Poland",value:"Poland"},onChange:()=>{}},{type:"Slider",value:50,min:0,max:100,onChange:()=>{}},{value:361}]},{cells:[{value:"Arborio rice",type:"Input",onChange:()=>{},testId:"table-tbody-cell-arborio",error:"Error"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{},error:"Error"},{value:361,type:"NumberInput",onChange:()=>{},error:"Error"},{type:"Select",options:[{label:"France",value:"France"},{label:"Italy",value:"Italy"},{label:"Vietnam",value:"Vietnam"}],value:{label:"Italy",value:"Italy"},onChange:()=>{},error:"Error"},{type:"Slider",value:50,min:0,max:100,onChange:()=>{},error:"Error"},{value:361,error:"Error"}]},{cells:[{value:"Couscous",type:"Input",onChange:()=>{},testId:"table-tbody-cell-couscous",warning:"Warning"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{},warning:"Warning"},{value:361,type:"NumberInput",onChange:()=>{},warning:"Warning"},{type:"Select",options:[{label:"France",value:"France"},{label:"Poland",value:"Poland"},{label:"Vietnam",value:"Vietnam"}],value:{label:"France",value:"France"},onChange:()=>{},warning:"Warning"},{type:"Slider",value:50,min:0,max:100,onChange:()=>{},warning:"Warning"},{value:361,warning:"Warning"}]}]},z={...e,headers:e.headers.map(l=>({...l,cells:[{type:"CheckBox",onChange:()=>{}},...l.cells]})),rows:e.rows.map(l=>({...l,cells:[{type:"CheckBox",onChange:()=>{}},...l.cells]}))},_={...s,rows:s.rows.map(l=>({...l,cells:l.cells.map(a=>({...a,disabled:!0}))}))},G={...e,headers:[...e.headers,{cells:[{value:"",type:"Input",placeholder:"Search",onChange:()=>{}},{value:"",type:"Input",placeholder:"Search",onChange:()=>{}},{value:"",type:"Input",placeholder:"Search",onChange:()=>{}},{value:"",type:"Input",placeholder:"Search",onChange:()=>{}}]}]},$={headers:[{cells:[{value:"Name"},{value:"Weight (kg)",hasSort:!0,sort:"up",sortPriority:1,onSort:()=>{}},{value:"Energy (kcal / 100g)",hasSort:!0,sort:"down",sortPriority:2,onSort:()=>{}},{value:"Origin",hasSort:!0,sort:"",sortPriority:1,onSort:()=>{}}]}],rows:[{cells:[{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"}]}]},K={headers:[{cells:[{},{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"}]}],rows:[{cells:[{type:"Icon",icon:t.jsx(n,{icon:o.SUCCESS,color:"var(--color-text-success)"}),tooltip:"Success tooltip here",width:"var(--size)"},{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"}]},{cells:[{type:"Icon",icon:t.jsx(n,{icon:o.WARNING,color:"var(--color-text-warning)"}),tooltip:"Warning tooltip here",width:"var(--size)"},{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}]},{cells:[{type:"Icon",icon:t.jsx(n,{icon:o.ERROR,color:"var(--color-text-error)"}),tooltip:"Error tooltip here",width:"var(--size)"},{value:"Couscous"},{value:10},{value:368},{value:"France"}]}]},X={headers:[{cells:[{value:"Lorem"},{value:"Ipsum"}]}],rows:[{cells:[{type:"Link",value:"Link text",onClick:()=>console.log("Link clicked")},{type:"Link",value:"Disabled link text",disabled:!0,onClick:()=>console.log("Link clicked")}]},{cells:[{type:"Link",value:"Static warning link",warning:"Warning message",onClick:()=>console.log("Link clicked")},{type:"Link",value:"Static error link",error:"Error message",onClick:()=>console.log("Link clicked")}]}]},Q={headers:[{cells:[{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{}}]}],rows:[{cells:[{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"},{value:"Lorem"},{value:"Ipsum"},{value:"Dolor"}],actions:[{label:"test",icon:"minus",onClick:()=>{},hidden:!0}]}]},Y={headers:[{cells:[{value:"Name"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"}],actions:[{primary:!0,label:"Add",icon:"add",onClick:()=>{}}]}],rows:[{cells:[{value:"Brown rice"},{value:100},{value:361},{value:"Vietnam"}],actions:[{label:"More",subActions:[{label:"Move Up",icon:"up",onClick:()=>{}},{label:"Move Down",icon:"down",onClick:()=>{}}]},{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Buckwheat"},{value:50},{value:358},{value:"Poland"}],actions:[{label:"More",subActions:[{label:"Move Up",icon:"up",onClick:()=>{}},{label:"Move Down",icon:"down",onClick:()=>{}}]},{label:"Delete",icon:"minus",onClick:()=>{}}]},{cells:[{value:"Couscous"},{value:10},{value:368},{value:"France"}],actions:[{label:"More",subActions:[{label:"Move Up",icon:"up",onClick:()=>{}},{label:"Move Down",icon:"down",onClick:()=>{}}]},{label:"Delete",icon:"minus",onClick:()=>{}}]}]},Z={...e,footer:{content:t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Footer content:"})," goes here"]}),pagination:{rowCount:500,selectedPage:10,rowsPerPage:{onChange:()=>{},options:[{label:"10 / page",value:10},{label:"20 / page",value:20},{label:"50 / page",value:50},{label:"Show all",value:0}],value:20},goTo:{onChange:()=>{}},onSelectPage:()=>{},small:!0},actions:[{label:"Star",icon:"star",onClick:()=>{}}]}},ee={...e,headers:e.headers.map(l=>({...l,cells:l.cells.map(a=>({...a,helpIcon:{onClick:()=>console.log("Help clicked"),tooltip:"Help text goes here"},libraryIcon:{onClick:()=>console.log("Library clicked"),tooltip:"Edit in library"}}))}))},le={columnWidths:[void 0,"100px","100px","100px",void 0],columnAlignment:["left","right","left","left","left","right"],columnHeaderAlignments:[["left","right","left","left","left","right"]],headers:[{cells:[{value:"Lorem ipsum dolor sit amet consectetur adipiscing elit sed doeius mod tempor incididunt laboreet dolore magna aliqua"},{value:"Weight (kg)"},{value:"Energy (kcal / 100g)"},{value:"Origin"},{value:"Static"},{value:"Static Right"}]}],rows:[{cells:[{breakWord:!0,value:"LoremipsumdolorsitametconsecteturadipiscingelitseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquaUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariaturufugiatnullapariatur"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{},disabled:!0},{type:"Select",options:[{label:"Vietnam",value:"Vietnam"},{label:"Other",value:"Other"}],value:{label:"Vietnam",value:"Vietnam"},onChange:()=>{},error:"Error"},{value:"Brown rice",type:"Input",onChange:()=>{},testId:"table-tbody-cell-brown-rice",warning:"Warning message"},{value:"Static warning",warning:"Warning message"},{value:"100"}]},{cells:[{value:"Buckwheat"},{type:"Select",native:!0,options:[{label:50,value:50},{label:100,value:100}],value:{label:100,value:100},onChange:()=>{}},{type:"Select",options:[{label:"Vietnam",value:"Vietnam"},{label:"Other",value:"Other"}],value:{label:"Vietnam",value:"Vietnam"},onChange:()=>{}},{value:"Brown rice",type:"Input",onChange:()=>{},testId:"table-tbody-cell-brown-rice"},{type:"Link",value:"Static error link",error:"Error message"},{value:"100"}]}]},ae={fixedWidth:"auto",headers:[{cells:[{value:"Name"},{value:"Date of birth"}]}],rows:[{cells:[{value:"John Smith",width:"140px"},{value:"1980-05-05",type:"DateInput",width:"110px"}]},{cells:[{value:"Jane Doe",width:"140px"},{value:"1984-12-12",type:"DateInput",width:"110px"}]}]};export{i as A,O as B,j as C,T as D,D as E,P as F,V as G,B as H,G as I,$ as J,N as K,ee as L,s as a,_ as b,ae as c,m as d,M as e,f,W as g,q as h,z as i,K as j,X as k,Q as l,Y as m,R as n,x as o,F as p,le as q,Z as r,L as s,e as t,E as u,A as v,H as w,S as x,U as y,J as z};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-FsUICBgo.js";import{H as y,L as i,S,R as d}from"./react-router-dom-EZH1n7K1.js";import{F as _}from"./flex-RYZsoWEN.js";import{T as b}from"./text-6KQ6ntOV.js";import"./index-RfLt4OUa.js";import"./inheritsLoose-8sb_A2v4.js";import"./index-4QtD-hFu.js";import"./tiny-invariant-R4kOKlvx.js";import"./objectWithoutPropertiesLoose-9Q1jwsKS.js";import"./index-VW3EWkuE.js";const t=({children:n,href:o=void 0,target:L=void 0,testId:T,onClick:j,component:R="a"})=>e.jsx(R,{href:o,to:o,target:L,onClick:j,"data-testid":T,children:e.jsx(b,{link:!0,children:n})});try{t.displayName="TextLink",t.__docgenInfo={description:"",displayName:"TextLink",props:{href:{defaultValue:{value:"undefined"},description:"",name:"href",required:!1,type:{name:"string"}},target:{defaultValue:{value:"undefined"},description:"",name:"target",required:!1,type:{name:"string"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"((e: MouseEvent<HTMLAnchorElement, MouseEvent>) => void)"}},component:{defaultValue:null,description:"",name:"component",required:!1,type:{name:"ElementType<any>"}}}}}catch{}const I={title:"Basic/TextLink",component:t,args:{children:"Link text goes here",href:"http://oliasoft.com"}},k=n=>e.jsx(t,{...n}),s=k.bind({}),r=k.bind({});r.args={href:void 0,onClick:()=>console.log("Clicked!")};const a=()=>e.jsxs(y,{children:[e.jsxs(_,{gap:!0,children:[e.jsx(t,{component:i,href:"/dashboard",children:"Dashboard"}),e.jsx(t,{component:i,href:"/settings",children:"Settings"})]}),e.jsxs(S,{children:[e.jsx(d,{path:"/dashboard",children:"Dashboard"}),e.jsx(d,{path:"/settings",children:"Settings"})]})]});var c,p,l;s.parameters={...s.parameters,docs:{...(c=s.parameters)==null?void 0:c.docs,source:{originalSource:"args => <TextLink {...args} />",...(l=(p=s.parameters)==null?void 0:p.docs)==null?void 0:l.source}}};var m,u,h;r.parameters={...r.parameters,docs:{...(m=r.parameters)==null?void 0:m.docs,source:{originalSource:"args => <TextLink {...args} />",...(h=(u=r.parameters)==null?void 0:u.docs)==null?void 0:h.source}}};var x,f,g;a.parameters={...a.parameters,docs:{...(x=a.parameters)==null?void 0:x.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>`,...(g=(f=a.parameters)==null?void 0:f.docs)==null?void 0:g.source}}};const M=["Default","OnClick","AsRouterLink"];export{a as AsRouterLink,s as Default,r as OnClick,M as __namedExportsOrder,I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-FsUICBgo.js";import{r as V}from"./index-RfLt4OUa.js";import{c as h}from"./index-VW3EWkuE.js";import{i as l}from"./types-5uVBABF4.js";import{D as z}from"./disabled-context-urNQThQz.js";import{T as k}from"./tooltip-
|
|
1
|
+
import{j as o}from"./jsx-runtime-FsUICBgo.js";import{r as V}from"./index-RfLt4OUa.js";import{c as h}from"./index-VW3EWkuE.js";import{i as l}from"./types-5uVBABF4.js";import{D as z}from"./disabled-context-urNQThQz.js";import{T as k}from"./tooltip-dueTLnwA.js";const I="_inputInTable_66zck_1",N="_inputHover_66zck_13",R="_inputFocus_66zck_18",C="_inputError_66zck_25",S="_inputWarning_66zck_26",A="_inputDisabled_66zck_61",F="_hideScrollbars_66zck_67",H="_textarea_66zck_77",W="_small_66zck_116",w="_error_66zck_121",D="_warning_66zck_138",P="_monospace_66zck_155",t={inputInTable:I,inputHover:N,inputFocus:R,inputError:C,inputWarning:S,inputDisabled:A,hideScrollbars:F,textarea:H,small:W,error:w,warning:D,monospace:P},i=({name:r,value:u="",placeholder:s="",cols:d,rows:c,disabled:m=!1,onChange:p=()=>{},onKeyPress:f=()=>{},onFocus:v=()=>{},onBlur:_=()=>{},tabIndex:b=0,error:e=null,warning:a=null,tooltip:n=null,maxTooltipWidth:y,resize:x,monospace:g=!1,testId:E})=>{const T=V.useContext(z),q=o.jsx("textarea",{className:h(t.textarea,e?t.error:"",a?t.warning:"",g?t.monospace:""),name:r,value:u,placeholder:s,cols:d,rows:c,onChange:p,disabled:m||T,onKeyPress:f,onFocus:v,onBlur:_,tabIndex:b,style:{resize:x},"data-testid":E});return o.jsx(k,{error:!!e,warning:!!a,text:n||e||a,enabled:n&&l(n)||e&&l(e)||a&&l(a)||!1,maxWidth:y,placement:"bottom-center",children:q})};try{i.displayName="TextArea",i.__docgenInfo={description:"",displayName:"TextArea",props:{name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},value:{defaultValue:{value:""},description:"",name:"value",required:!1,type:{name:"TStringOrNumber"}},placeholder:{defaultValue:{value:""},description:"",name:"placeholder",required:!1,type:{name:"string"}},cols:{defaultValue:null,description:"",name:"cols",required:!1,type:{name:"number"}},rows:{defaultValue:null,description:"",name:"rows",required:!1,type:{name:"number"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},onChange:{defaultValue:{value:"() => {}"},description:"",name:"onChange",required:!1,type:{name:"((evt: ChangeEvent<HTMLTextAreaElement>) => void)"}},onKeyPress:{defaultValue:{value:"() => {}"},description:"",name:"onKeyPress",required:!1,type:{name:"((evt: KeyboardEvent<HTMLTextAreaElement>) => void)"}},onFocus:{defaultValue:{value:"() => {}"},description:"",name:"onFocus",required:!1,type:{name:"((evt: FocusEvent<HTMLTextAreaElement, Element>) => void)"}},onBlur:{defaultValue:{value:"() => {}"},description:"",name:"onBlur",required:!1,type:{name:"((evt: FocusEvent<HTMLTextAreaElement, Element>) => void)"}},tabIndex:{defaultValue:{value:"0"},description:"",name:"tabIndex",required:!1,type:{name:"number"}},error:{defaultValue:{value:"null"},description:"",name:"error",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},warning:{defaultValue:{value:"null"},description:"",name:"warning",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},tooltip:{defaultValue:{value:"null"},description:"",name:"tooltip",required:!1,type:{name:"string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null"}},maxTooltipWidth:{defaultValue:null,description:"",name:"maxTooltipWidth",required:!1,type:{name:"TStringOrNumber"}},resize:{defaultValue:null,description:"",name:"resize",required:!1,type:{name:"enum",value:[{value:'"-moz-initial"'},{value:'"inherit"'},{value:'"initial"'},{value:'"revert"'},{value:'"revert-layer"'},{value:'"unset"'},{value:'"inline"'},{value:'"vertical"'},{value:'"block"'},{value:'"both"'},{value:'"horizontal"'},{value:'"none"'}]}},monospace:{defaultValue:{value:"false"},description:"",name:"monospace",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}}}}}catch{}export{i as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as u}from"./jsx-runtime-FsUICBgo.js";import{T as s}from"./textarea-
|
|
1
|
+
import{j as u}from"./jsx-runtime-FsUICBgo.js";import{T as s}from"./textarea-U_i0cI7f.js";import"./index-RfLt4OUa.js";import"./index-VW3EWkuE.js";import"./types-5uVBABF4.js";import"./lodash-Bmg8FrMx.js";import"./disabled-context-urNQThQz.js";import"./tooltip-dueTLnwA.js";import"./index-miLrID2P.js";const{useArgs:g}=__STORYBOOK_MODULE_ADDONS__,C={title:"Forms/TextArea",component:s,args:{disabled:!1}},c=n=>{const[i,o]=g(),m=p=>{o({value:p.target.value})};return u.jsx(s,{...n,onChange:m})},e=c.bind({});var t,r,a;e.parameters={...e.parameters,docs:{...(t=e.parameters)==null?void 0:t.docs,source:{originalSource:`args => {
|
|
2
2
|
const [_, updateArgs] = useArgs();
|
|
3
3
|
const handleChange = (evt: ChangeEvent<HTMLTextAreaElement>) => {
|
|
4
4
|
updateArgs({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as G}from"./jsx-runtime-FsUICBgo.js";import{T as X}from"./table-
|
|
1
|
+
import{j as G}from"./jsx-runtime-FsUICBgo.js";import{T as X}from"./table-ZBqRpa7M.js";import{t as K,E as O,s as W,F as k,G as q,H as z,I as D,J as M,K as P,L as Q}from"./table.stories-data-tjY9V0bM.js";import"./index-RfLt4OUa.js";import"./index-VW3EWkuE.js";import"./index.es-VXFRDikp.js";import"./inheritsLoose-8sb_A2v4.js";import"./redux-F5dueAP3.js";import"./objectSpread2-93s0nBry.js";import"./tiny-invariant-R4kOKlvx.js";import"./index-miLrID2P.js";import"./memoize-one.esm-hqe5SRxC.js";import"./objectWithoutPropertiesLoose-9Q1jwsKS.js";import"./lodash-Bmg8FrMx.js";import"./actions-7PO9r8zE.js";import"./common-types-U65vzrrz.js";import"./disabled-context-urNQThQz.js";import"./button-BiJw0fB3.js";import"./spinner-R8Il4aRe.js";import"./icon-8EQazuuW.js";import"./tslib.es6-OIsz3r9a.js";import"./index-4QtD-hFu.js";import"./tooltip-dueTLnwA.js";import"./types-VB5zD18b.js";import"./types-5uVBABF4.js";import"./badge-23Ty_zBt.js";import"./heading-4tVgoT7O.js";import"./help-icon-eelulTML.js";import"./pagination-DtJdggbI.js";import"./select-AcJYUY86.js";import"./assertThisInitialized-4q6YPdh3.js";import"./text-6KQ6ntOV.js";import"./select.input-zP5tW20f.js";import"./input-fYKvBwPs.js";import"./input-group-R8LoqKRn.js";import"./input-group-addon-BHVsW9mL.js";import"./number-input-ymd7m-s5.js";import"./index-qZmQ7nA9.js";import"./index-cCpkwrS5.js";import"./check-box-KynSyTaY.js";import"./slider-n3IxC2iq.js";import"./index-ugi_ZH6T.js";import"./popover-1CwIRm4P.js";import"./flex-RYZsoWEN.js";const Kr={title:"Basic/Table/Title & Header",component:X,args:{table:{...K}}},r=B=>G.jsx(X,{...B}),e=r.bind({});e.args={table:O};const s=r.bind({});s.args={table:W};const a=r.bind({});a.args={table:k};const t=r.bind({});t.args={table:q};const o=r.bind({});o.args={table:z};const n=r.bind({});n.args={table:D};const i=r.bind({});i.args={table:M};const p=r.bind({});p.args={table:P};const l=r.bind({});l.args={table:Q};var m,c,d;e.parameters={...e.parameters,docs:{...(m=e.parameters)==null?void 0:m.docs,source:{originalSource:`args => {
|
|
2
2
|
return <Table
|
|
3
3
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
4
4
|
{...args} />;
|
|
@@ -30,8 +30,8 @@ import{j as G}from"./jsx-runtime-FsUICBgo.js";import{T as X}from"./table-YO72eq6
|
|
|
30
30
|
return <Table
|
|
31
31
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
32
32
|
{...args} />;
|
|
33
|
-
}`,...(E=(y=p.parameters)==null?void 0:y.docs)==null?void 0:E.source}}};var N,U,_;
|
|
33
|
+
}`,...(E=(y=p.parameters)==null?void 0:y.docs)==null?void 0:E.source}}};var N,U,_;l.parameters={...l.parameters,docs:{...(N=l.parameters)==null?void 0:N.docs,source:{originalSource:`args => {
|
|
34
34
|
return <Table
|
|
35
35
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
36
36
|
{...args} />;
|
|
37
|
-
}`,...(_=(U=
|
|
37
|
+
}`,...(_=(U=l.parameters)==null?void 0:U.docs)==null?void 0:_.source}}};const Or=["Units","ActiveRow","Title","TitleJSX","ChildComponent","Filter","Sort","HeaderActionsNoLabel","HelpAndLibraryIcons"];export{s as ActiveRow,o as ChildComponent,n as Filter,p as HeaderActionsNoLabel,l as HelpAndLibraryIcons,i as Sort,a as Title,t as TitleJSX,e as Units,Or as __namedExportsOrder,Kr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as ue}from"./jsx-runtime-FsUICBgo.js";import{r as o,R as de}from"./index-RfLt4OUa.js";import{r as Le}from"./index-miLrID2P.js";import{a as Y,M as xe,D as Se}from"./message-bbAE2zjv.js";function Te(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Te(e[t]))&&(a&&(a+=" "),a+=n);else for(t in e)e[t]&&(a&&(a+=" "),a+=t);return a}function F(){for(var e,t,n=0,a="";n<arguments.length;)(e=arguments[n++])&&(t=Te(e))&&(a&&(a+=" "),a+=t);return a}function S(){return S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},S.apply(this,arguments)}function he(e,t){if(e==null)return{};var n={},a=Object.keys(e),l,f;for(f=0;f<a.length;f++)l=a[f],!(t.indexOf(l)>=0)&&(n[l]=e[l]);return n}function K(e){return typeof e=="number"&&!isNaN(e)}function Q(e){return typeof e=="boolean"}function q(e){return typeof e=="string"}function P(e){return typeof e=="function"}function X(e){return q(e)||P(e)?e:null}function ae(e){return e===0||e}function De(e,t){return e===!1||K(e)&&e>0?e:t}var pe=!!(typeof window<"u"&&window.document&&window.document.createElement);function se(e){return o.isValidElement(e)||q(e)||P(e)||K(e)}var Ee={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},A={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"};function Be(e,t,n){n===void 0&&(n=300);var a=e.scrollHeight,l=e.style;requestAnimationFrame(function(){l.minHeight="initial",l.height=a+"px",l.transition="all "+n+"ms",requestAnimationFrame(function(){l.height="0",l.padding="0",l.margin="0",setTimeout(t,n)})})}function Ce(e){var t=e.enter,n=e.exit,a=e.appendPosition,l=a===void 0?!1:a,f=e.collapse,y=f===void 0?!0:f,v=e.collapseDuration,s=v===void 0?300:v;return function(T){var I=T.children,h=T.position,p=T.preventExitTransition,R=T.done,E=T.nodeRef,O=T.isIn,c=l?t+"--"+h:t,d=l?n+"--"+h:n,C=o.useRef(),b=o.useRef(0);o.useLayoutEffect(function(){r()},[]),o.useEffect(function(){O||(p?L():D())},[O]);function r(){var i=E.current;C.current=i.className,i.className+=" "+c,i.addEventListener("animationend",_),i.addEventListener("animationcancel",_)}function _(i){if(i.target===E.current){var m=E.current;m.dispatchEvent(new Event("d")),m.removeEventListener("animationend",_),m.removeEventListener("animationcancel",_),b.current===0&&(m.className=C.current)}}function D(){b.current=1;var i=E.current;i.className+=" "+d,i.addEventListener("animationend",L)}function L(){var i=E.current;i.removeEventListener("animationend",L),y?Be(i,R,s):R()}return de.createElement(de.Fragment,null,I)}}var w={list:new Map,emitQueue:new Map,on:function(t,n){return this.list.has(t)||this.list.set(t,[]),this.list.get(t).push(n),this},off:function(t,n){if(n){var a=this.list.get(t).filter(function(l){return l!==n});return this.list.set(t,a),this}return this.list.delete(t),this},cancelEmit:function(t){var n=this.emitQueue.get(t);return n&&(n.forEach(clearTimeout),this.emitQueue.delete(t)),this},emit:function(t){for(var n=this,a=arguments.length,l=new Array(a>1?a-1:0),f=1;f<a;f++)l[f-1]=arguments[f];this.list.has(t)&&this.list.get(t).forEach(function(y){var v=setTimeout(function(){y.apply(void 0,l)},0);n.emitQueue.has(t)||n.emitQueue.set(t,[]),n.emitQueue.get(t).push(v)})}},we=["delay","staleId"];function Me(e){var t=o.useReducer(function(c){return c+1},0),n=t[1],a=o.useState([]),l=a[0],f=a[1],y=o.useRef(null),v=o.useRef(new Map).current,s=function(d){return l.indexOf(d)!==-1},u=o.useRef({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:s,getToast:function(d){return v.get(d)}}).current;o.useEffect(function(){return u.containerId=e.containerId,w.cancelEmit(3).on(0,R).on(1,function(c){return y.current&&I(c)}).on(5,T).emit(2,u),function(){return w.emit(3,u)}},[]),o.useEffect(function(){u.isToastActive=s,u.displayedToast=l.length,w.emit(4,l.length,e.containerId)},[l]),o.useEffect(function(){u.props=e});function T(c){var d=c.containerId,C=u.props.limit;C&&(!d||u.containerId===d)&&(u.count-=u.queue.length,u.queue=[])}function I(c){f(function(d){return ae(c)?d.filter(function(C){return C!==c}):[]})}function h(){var c=u.queue.shift(),d=c.toastContent,C=c.toastProps,b=c.staleId;E(d,C,b)}function p(c){return!y.current||u.props.enableMultiContainer&&c.containerId!==u.props.containerId||v.has(c.toastId)&&c.updateId==null}function R(c,d){var C=d.delay,b=d.staleId,r=he(d,we);if(!(!se(c)||p(r))){var _=r.toastId,D=r.updateId,L=r.data,i=u.props,m=function(){return I(_)},N=D==null;N&&u.count++;var x={toastId:_,updateId:D,isLoading:r.isLoading,theme:r.theme||i.theme,icon:r.icon!=null?r.icon:i.icon,isIn:!1,key:r.key||u.toastKey++,type:r.type,closeToast:m,closeButton:r.closeButton,rtl:i.rtl,position:r.position||i.position,transition:r.transition||i.transition,className:X(r.className||i.toastClassName),bodyClassName:X(r.bodyClassName||i.bodyClassName),style:r.style||i.toastStyle,bodyStyle:r.bodyStyle||i.bodyStyle,onClick:r.onClick||i.onClick,pauseOnHover:Q(r.pauseOnHover)?r.pauseOnHover:i.pauseOnHover,pauseOnFocusLoss:Q(r.pauseOnFocusLoss)?r.pauseOnFocusLoss:i.pauseOnFocusLoss,draggable:Q(r.draggable)?r.draggable:i.draggable,draggablePercent:r.draggablePercent||i.draggablePercent,draggableDirection:r.draggableDirection||i.draggableDirection,closeOnClick:Q(r.closeOnClick)?r.closeOnClick:i.closeOnClick,progressClassName:X(r.progressClassName||i.progressClassName),progressStyle:r.progressStyle||i.progressStyle,autoClose:r.isLoading?!1:De(r.autoClose,i.autoClose),hideProgressBar:Q(r.hideProgressBar)?r.hideProgressBar:i.hideProgressBar,progress:r.progress,role:r.role||i.role,deleteToast:function(){v.delete(_);var H=u.queue.length;if(u.count=ae(_)?u.count-1:u.count-u.displayedToast,u.count<0&&(u.count=0),H>0){var B=ae(_)?1:u.props.limit;if(H===1||B===1)u.displayedToast++,h();else{var j=B>H?H:B;u.displayedToast=j;for(var V=0;V<j;V++)h()}}else n()}};P(r.onOpen)&&(x.onOpen=r.onOpen),P(r.onClose)&&(x.onClose=r.onClose),x.closeButton=i.closeButton,r.closeButton===!1||se(r.closeButton)?x.closeButton=r.closeButton:r.closeButton===!0&&(x.closeButton=se(i.closeButton)?i.closeButton:!0);var M=c;o.isValidElement(c)&&!q(c.type)?M=o.cloneElement(c,{closeToast:m,toastProps:x,data:L}):P(c)&&(M=c({closeToast:m,toastProps:x,data:L})),i.limit&&i.limit>0&&u.count>i.limit&&N?u.queue.push({toastContent:M,toastProps:x,staleId:b}):K(C)&&C>0?setTimeout(function(){E(M,x,b)},C):E(M,x,b)}}function E(c,d,C){var b=d.toastId;C&&v.delete(C),v.set(b,{content:c,props:d}),f(function(r){return[].concat(r,[b]).filter(function(_){return _!==C})})}function O(c){var d=new Map,C=Array.from(v.values());return e.newestOnTop&&C.reverse(),C.forEach(function(b){var r=b.props.position;d.has(r)||d.set(r,[]),d.get(r).push(b)}),Array.from(d,function(b){return c(b[0],b[1])})}return{getToastToRender:O,containerRef:y,isToastActive:s}}function fe(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function me(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function Ae(e){var t=o.useState(!1),n=t[0],a=t[1],l=o.useState(!1),f=l[0],y=l[1],v=o.useRef(null),s=o.useRef({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,u=o.useRef(e),T=e.autoClose,I=e.pauseOnHover,h=e.closeToast,p=e.onClick,R=e.closeOnClick;o.useEffect(function(){u.current=e}),o.useEffect(function(){return v.current&&v.current.addEventListener("d",c,{once:!0}),P(e.onOpen)&&e.onOpen(o.isValidElement(e.children)&&e.children.props),function(){var m=u.current;P(m.onClose)&&m.onClose(o.isValidElement(m.children)&&m.children.props)}},[]),o.useEffect(function(){return e.pauseOnFocusLoss&&C(),function(){e.pauseOnFocusLoss&&b()}},[e.pauseOnFocusLoss]);function E(m){if(e.draggable){r();var N=v.current;s.canCloseOnClick=!0,s.canDrag=!0,s.boundingRect=N.getBoundingClientRect(),N.style.transition="",s.x=fe(m.nativeEvent),s.y=me(m.nativeEvent),e.draggableDirection==="x"?(s.start=s.x,s.removalDistance=N.offsetWidth*(e.draggablePercent/100)):(s.start=s.y,s.removalDistance=N.offsetHeight*(e.draggablePercent===80?e.draggablePercent*1.5:e.draggablePercent/100))}}function O(){if(s.boundingRect){var m=s.boundingRect,N=m.top,x=m.bottom,M=m.left,k=m.right;e.pauseOnHover&&s.x>=M&&s.x<=k&&s.y>=N&&s.y<=x?d():c()}}function c(){a(!0)}function d(){a(!1)}function C(){document.hasFocus()||d(),window.addEventListener("focus",c),window.addEventListener("blur",d)}function b(){window.removeEventListener("focus",c),window.removeEventListener("blur",d)}function r(){s.didMove=!1,document.addEventListener("mousemove",D),document.addEventListener("mouseup",L),document.addEventListener("touchmove",D),document.addEventListener("touchend",L)}function _(){document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",L),document.removeEventListener("touchmove",D),document.removeEventListener("touchend",L)}function D(m){var N=v.current;s.canDrag&&N&&(s.didMove=!0,n&&d(),s.x=fe(m),s.y=me(m),e.draggableDirection==="x"?s.delta=s.x-s.start:s.delta=s.y-s.start,s.start!==s.x&&(s.canCloseOnClick=!1),N.style.transform="translate"+e.draggableDirection+"("+s.delta+"px)",N.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function L(){_();var m=v.current;if(s.canDrag&&s.didMove&&m){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance){y(!0),e.closeToast();return}m.style.transition="transform 0.2s, opacity 0.2s",m.style.transform="translate"+e.draggableDirection+"(0)",m.style.opacity="1"}}var i={onMouseDown:E,onTouchStart:E,onMouseUp:O,onTouchEnd:O};return T&&I&&(i.onMouseEnter=d,i.onMouseLeave=c),R&&(i.onClick=function(m){p&&p(m),s.canCloseOnClick&&h()}),{playToast:c,pauseToast:d,isRunning:n,preventExitTransition:f,toastRef:v,eventHandlers:i}}function be(e){var t=e.closeToast,n=e.theme,a=e.ariaLabel,l=a===void 0?"close":a;return o.createElement("button",{className:"Toastify__close-button Toastify__close-button--"+n,type:"button",onClick:function(y){y.stopPropagation(),t(y)},"aria-label":l},o.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},o.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function Ie(e){var t,n,a=e.delay,l=e.isRunning,f=e.closeToast,y=e.type,v=e.hide,s=e.className,u=e.style,T=e.controlledProgress,I=e.progress,h=e.rtl,p=e.isIn,R=e.theme,E=S({},u,{animationDuration:a+"ms",animationPlayState:l?"running":"paused",opacity:v?0:1});T&&(E.transform="scaleX("+I+")");var O=F("Toastify__progress-bar",T?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated","Toastify__progress-bar-theme--"+R,"Toastify__progress-bar--"+y,(t={},t["Toastify__progress-bar--rtl"]=h,t)),c=P(s)?s({rtl:h,type:y,defaultClassName:O}):F(O,s),d=(n={},n[T&&I>=1?"onTransitionEnd":"onAnimationEnd"]=T&&I<1?null:function(){p&&f()},n);return o.createElement("div",Object.assign({role:"progressbar","aria-hidden":v?"true":"false","aria-label":"notification timer",className:c,style:E},d))}Ie.defaultProps={type:A.DEFAULT,hide:!1};var Fe=["theme","type"],J=function(t){var n=t.theme,a=t.type,l=he(t,Fe);return o.createElement("svg",Object.assign({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:n==="colored"?"currentColor":"var(--toastify-icon-color-"+a+")"},l))};function ke(e){return o.createElement(J,Object.assign({},e),o.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function He(e){return o.createElement(J,Object.assign({},e),o.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function je(e){return o.createElement(J,Object.assign({},e),o.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function ze(e){return o.createElement(J,Object.assign({},e),o.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function qe(){return o.createElement("div",{className:"Toastify__spinner"})}var ve={info:He,warning:ke,success:je,error:ze,spinner:qe},Ue=function(t){var n,a,l=Ae(t),f=l.isRunning,y=l.preventExitTransition,v=l.toastRef,s=l.eventHandlers,u=t.closeButton,T=t.children,I=t.autoClose,h=t.onClick,p=t.type,R=t.hideProgressBar,E=t.closeToast,O=t.transition,c=t.position,d=t.className,C=t.style,b=t.bodyClassName,r=t.bodyStyle,_=t.progressClassName,D=t.progressStyle,L=t.updateId,i=t.role,m=t.progress,N=t.rtl,x=t.toastId,M=t.deleteToast,k=t.isIn,H=t.isLoading,B=t.icon,j=t.theme,V=F("Toastify__toast","Toastify__toast-theme--"+j,"Toastify__toast--"+p,(n={},n["Toastify__toast--rtl"]=N,n)),_e=P(d)?d({rtl:N,position:c,type:p,defaultClassName:V}):F(V,d),te=!!m,le=ve[p],ne={theme:j,type:p},z=le&&le(ne);B===!1?z=void 0:P(B)?z=B(ne):o.isValidElement(B)?z=o.cloneElement(B,ne):q(B)?z=B:H&&(z=ve.spinner());function Pe(W){if(W){var ce={closeToast:E,type:p,theme:j};if(P(W))return W(ce);if(o.isValidElement(W))return o.cloneElement(W,ce)}}return o.createElement(O,{isIn:k,done:M,position:c,preventExitTransition:y,nodeRef:v},o.createElement("div",Object.assign({id:x,onClick:h,className:_e},s,{style:C,ref:v}),o.createElement("div",Object.assign({},k&&{role:i},{className:P(b)?b({type:p}):F("Toastify__toast-body",b),style:r}),z&&o.createElement("div",{className:F("Toastify__toast-icon",(a={},a["Toastify--animate-icon Toastify__zoom-enter"]=!H,a))},z),o.createElement("div",null,T)),Pe(u),(I||te)&&o.createElement(Ie,Object.assign({},L&&!te?{key:"pb-"+L}:{},{rtl:N,theme:j,delay:I,isRunning:f,isIn:k,closeToast:E,hide:R,type:p,style:D,className:_,controlledProgress:te,progress:m}))))},Ve=Ce({enter:"Toastify--animate Toastify__bounce-enter",exit:"Toastify--animate Toastify__bounce-exit",appendPosition:!0}),We=Ce({enter:"Toastify--animate Toastify__slide-enter",exit:"Toastify--animate Toastify__slide-exit",appendPosition:!0}),Oe=function(t){var n=Me(t),a=n.getToastToRender,l=n.containerRef,f=n.isToastActive,y=t.className,v=t.style,s=t.rtl,u=t.containerId;function T(I){var h,p=F("Toastify__toast-container","Toastify__toast-container--"+I,(h={},h["Toastify__toast-container--rtl"]=s,h));return P(y)?y({position:I,rtl:s,defaultClassName:p}):F(p,X(y))}return o.createElement("div",{ref:l,className:"Toastify",id:u},a(function(I,h){var p=h.length?S({},v):S({},v,{pointerEvents:"none"});return o.createElement("div",{className:T(I),style:p,key:"container-"+I},h.map(function(R){var E=R.content,O=R.props;return o.createElement(Ue,Object.assign({},O,{isIn:f(O.toastId),key:"toast-"+O.key,closeButton:O.closeButton===!0?be:O.closeButton}),E)}))}))};Oe.defaultProps={position:Ee.TOP_RIGHT,transition:Ve,rtl:!1,autoClose:5e3,hideProgressBar:!1,closeButton:be,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,newestOnTop:!1,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};var U=new Map,re,G,Ne,oe=[],ie=!1;function Ye(e,t){var n=t.containerId,a=U.get(n||re);return a?a.getToast(e):null}function Re(){return Math.random().toString(36).substring(2,9)}function Qe(e){return e&&(q(e.toastId)||K(e.toastId))?e.toastId:Re()}function $(e,t){return U.size>0?w.emit(0,e,t):(oe.push({content:e,options:t}),ie&&pe&&(ie=!1,G=document.createElement("div"),document.body.appendChild(G),Le.render(o.createElement(Oe,Object.assign({},Ne)),G))),t.toastId}function Z(e,t){return S({},t,{type:t&&t.type||e,toastId:Qe(t)})}function ee(e){return function(t,n){return $(t,Z(e,n))}}function g(e,t){return $(e,Z(A.DEFAULT,t))}g.loading=function(e,t){return $(e,Z(A.DEFAULT,S({isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1},t)))};function Ge(e,t,n){var a=t.pending,l=t.error,f=t.success,y;a&&(y=q(a)?g.loading(a,n):g.loading(a.render,S({},n,a)));var v={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},s=function(I,h,p){if(h==null){g.dismiss(y);return}var R=S({type:I},v,n,{data:p}),E=q(h)?{render:h}:h;return y?g.update(y,S({},R,E)):g(E.render,S({},R,E)),p},u=P(e)?e():e;return u.then(function(T){return s("success",f,T)}).catch(function(T){return s("error",l,T)}),u}g.promise=Ge;g.success=ee(A.SUCCESS);g.info=ee(A.INFO);g.error=ee(A.ERROR);g.warning=ee(A.WARNING);g.warn=g.warning;g.dark=function(e,t){return $(e,Z(A.DEFAULT,S({theme:"dark"},t)))};g.dismiss=function(e){return w.emit(1,e)};g.clearWaitingQueue=function(e){return e===void 0&&(e={}),w.emit(5,e)};g.isActive=function(e){var t=!1;return U.forEach(function(n){n.isToastActive&&n.isToastActive(e)&&(t=!0)}),t};g.update=function(e,t){t===void 0&&(t={}),setTimeout(function(){var n=Ye(e,t);if(n){var a=n.props,l=n.content,f=S({},a,t,{toastId:t.toastId||e,updateId:Re()});f.toastId!==e&&(f.staleId=e);var y=f.render||l;delete f.render,$(y,f)}},0)};g.done=function(e){g.update(e,{progress:1})};g.onChange=function(e){return P(e)&&w.on(4,e),function(){P(e)&&w.off(4,e)}};g.configure=function(e){e===void 0&&(e={}),ie=!0,Ne=e};g.POSITION=Ee;g.TYPE=A;w.on(2,function(e){re=e.containerId||e,U.set(re,e),oe.forEach(function(t){w.emit(0,t.content,t.options)}),oe=[]}).on(3,function(e){U.delete(e.containerId||e),U.size===0&&w.off(0).off(1).off(5),pe&&G&&document.body.removeChild(G)});const ge=({id:e,message:t={type:Y.INFO,content:""},autoClose:n=6e3,onClose:a})=>{const{type:l=Y.INFO}=t??{},f=({closeToast:s})=>ue.jsx(Se,{type:l,onClose:s,isInToast:!0}),y=ue.jsx(xe,{message:{...t,visible:!0,width:"100%",maxHeight:"500px",withDismiss:!1}}),v=(()=>{switch(t==null?void 0:t.type){case Y.SUCCESS:return g.TYPE.SUCCESS;case Y.WARNING:return g.TYPE.WARNING;case Y.ERROR:return g.TYPE.ERROR;default:return g.TYPE.INFO}})();return e!==void 0&&g.isActive(e)?g.update(e,{render:y,autoClose:n,onClose:a,type:v}):g(y,{toastId:e,autoClose:n,onClose:a,hideProgressBar:n===!1,icon:!1,closeOnClick:!1,pauseOnHover:!0,draggable:!1,closeButton:f,transition:We,type:v})},ye=e=>{g.dismiss(e)};try{ToastContainer.displayName="ToastContainer",ToastContainer.__docgenInfo={description:"",displayName:"ToastContainer",props:{}}}catch{}try{ge.displayName="toast",ge.__docgenInfo={description:"",displayName:"toast",props:{id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"Id"}},message:{defaultValue:{value:"{ type: MessageType.INFO, content: '' }"},description:"",name:"message",required:!1,type:{name:"IMessageType"}},autoClose:{defaultValue:{value:"6000"},description:"",name:"autoClose",required:!1,type:{name:"number | false"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!1,type:{name:"TEmpty"}}}}}catch{}try{ye.displayName="dismissToast",ye.__docgenInfo={description:"",displayName:"dismissToast",props:{}}}catch{}export{Oe as T,ye as d,ge as t};
|
|
1
|
+
import{j as ue}from"./jsx-runtime-FsUICBgo.js";import{r as o,R as de}from"./index-RfLt4OUa.js";import{r as Le}from"./index-miLrID2P.js";import{a as Y,M as xe,D as Se}from"./message-CRKuTfOl.js";function Te(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=Te(e[t]))&&(a&&(a+=" "),a+=n);else for(t in e)e[t]&&(a&&(a+=" "),a+=t);return a}function F(){for(var e,t,n=0,a="";n<arguments.length;)(e=arguments[n++])&&(t=Te(e))&&(a&&(a+=" "),a+=t);return a}function S(){return S=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},S.apply(this,arguments)}function he(e,t){if(e==null)return{};var n={},a=Object.keys(e),l,f;for(f=0;f<a.length;f++)l=a[f],!(t.indexOf(l)>=0)&&(n[l]=e[l]);return n}function K(e){return typeof e=="number"&&!isNaN(e)}function Q(e){return typeof e=="boolean"}function q(e){return typeof e=="string"}function P(e){return typeof e=="function"}function X(e){return q(e)||P(e)?e:null}function ae(e){return e===0||e}function De(e,t){return e===!1||K(e)&&e>0?e:t}var pe=!!(typeof window<"u"&&window.document&&window.document.createElement);function se(e){return o.isValidElement(e)||q(e)||P(e)||K(e)}var Ee={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},A={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"};function Be(e,t,n){n===void 0&&(n=300);var a=e.scrollHeight,l=e.style;requestAnimationFrame(function(){l.minHeight="initial",l.height=a+"px",l.transition="all "+n+"ms",requestAnimationFrame(function(){l.height="0",l.padding="0",l.margin="0",setTimeout(t,n)})})}function Ce(e){var t=e.enter,n=e.exit,a=e.appendPosition,l=a===void 0?!1:a,f=e.collapse,y=f===void 0?!0:f,v=e.collapseDuration,s=v===void 0?300:v;return function(T){var I=T.children,h=T.position,p=T.preventExitTransition,R=T.done,E=T.nodeRef,O=T.isIn,c=l?t+"--"+h:t,d=l?n+"--"+h:n,C=o.useRef(),b=o.useRef(0);o.useLayoutEffect(function(){r()},[]),o.useEffect(function(){O||(p?L():D())},[O]);function r(){var i=E.current;C.current=i.className,i.className+=" "+c,i.addEventListener("animationend",_),i.addEventListener("animationcancel",_)}function _(i){if(i.target===E.current){var m=E.current;m.dispatchEvent(new Event("d")),m.removeEventListener("animationend",_),m.removeEventListener("animationcancel",_),b.current===0&&(m.className=C.current)}}function D(){b.current=1;var i=E.current;i.className+=" "+d,i.addEventListener("animationend",L)}function L(){var i=E.current;i.removeEventListener("animationend",L),y?Be(i,R,s):R()}return de.createElement(de.Fragment,null,I)}}var w={list:new Map,emitQueue:new Map,on:function(t,n){return this.list.has(t)||this.list.set(t,[]),this.list.get(t).push(n),this},off:function(t,n){if(n){var a=this.list.get(t).filter(function(l){return l!==n});return this.list.set(t,a),this}return this.list.delete(t),this},cancelEmit:function(t){var n=this.emitQueue.get(t);return n&&(n.forEach(clearTimeout),this.emitQueue.delete(t)),this},emit:function(t){for(var n=this,a=arguments.length,l=new Array(a>1?a-1:0),f=1;f<a;f++)l[f-1]=arguments[f];this.list.has(t)&&this.list.get(t).forEach(function(y){var v=setTimeout(function(){y.apply(void 0,l)},0);n.emitQueue.has(t)||n.emitQueue.set(t,[]),n.emitQueue.get(t).push(v)})}},we=["delay","staleId"];function Me(e){var t=o.useReducer(function(c){return c+1},0),n=t[1],a=o.useState([]),l=a[0],f=a[1],y=o.useRef(null),v=o.useRef(new Map).current,s=function(d){return l.indexOf(d)!==-1},u=o.useRef({toastKey:1,displayedToast:0,count:0,queue:[],props:e,containerId:null,isToastActive:s,getToast:function(d){return v.get(d)}}).current;o.useEffect(function(){return u.containerId=e.containerId,w.cancelEmit(3).on(0,R).on(1,function(c){return y.current&&I(c)}).on(5,T).emit(2,u),function(){return w.emit(3,u)}},[]),o.useEffect(function(){u.isToastActive=s,u.displayedToast=l.length,w.emit(4,l.length,e.containerId)},[l]),o.useEffect(function(){u.props=e});function T(c){var d=c.containerId,C=u.props.limit;C&&(!d||u.containerId===d)&&(u.count-=u.queue.length,u.queue=[])}function I(c){f(function(d){return ae(c)?d.filter(function(C){return C!==c}):[]})}function h(){var c=u.queue.shift(),d=c.toastContent,C=c.toastProps,b=c.staleId;E(d,C,b)}function p(c){return!y.current||u.props.enableMultiContainer&&c.containerId!==u.props.containerId||v.has(c.toastId)&&c.updateId==null}function R(c,d){var C=d.delay,b=d.staleId,r=he(d,we);if(!(!se(c)||p(r))){var _=r.toastId,D=r.updateId,L=r.data,i=u.props,m=function(){return I(_)},N=D==null;N&&u.count++;var x={toastId:_,updateId:D,isLoading:r.isLoading,theme:r.theme||i.theme,icon:r.icon!=null?r.icon:i.icon,isIn:!1,key:r.key||u.toastKey++,type:r.type,closeToast:m,closeButton:r.closeButton,rtl:i.rtl,position:r.position||i.position,transition:r.transition||i.transition,className:X(r.className||i.toastClassName),bodyClassName:X(r.bodyClassName||i.bodyClassName),style:r.style||i.toastStyle,bodyStyle:r.bodyStyle||i.bodyStyle,onClick:r.onClick||i.onClick,pauseOnHover:Q(r.pauseOnHover)?r.pauseOnHover:i.pauseOnHover,pauseOnFocusLoss:Q(r.pauseOnFocusLoss)?r.pauseOnFocusLoss:i.pauseOnFocusLoss,draggable:Q(r.draggable)?r.draggable:i.draggable,draggablePercent:r.draggablePercent||i.draggablePercent,draggableDirection:r.draggableDirection||i.draggableDirection,closeOnClick:Q(r.closeOnClick)?r.closeOnClick:i.closeOnClick,progressClassName:X(r.progressClassName||i.progressClassName),progressStyle:r.progressStyle||i.progressStyle,autoClose:r.isLoading?!1:De(r.autoClose,i.autoClose),hideProgressBar:Q(r.hideProgressBar)?r.hideProgressBar:i.hideProgressBar,progress:r.progress,role:r.role||i.role,deleteToast:function(){v.delete(_);var H=u.queue.length;if(u.count=ae(_)?u.count-1:u.count-u.displayedToast,u.count<0&&(u.count=0),H>0){var B=ae(_)?1:u.props.limit;if(H===1||B===1)u.displayedToast++,h();else{var j=B>H?H:B;u.displayedToast=j;for(var V=0;V<j;V++)h()}}else n()}};P(r.onOpen)&&(x.onOpen=r.onOpen),P(r.onClose)&&(x.onClose=r.onClose),x.closeButton=i.closeButton,r.closeButton===!1||se(r.closeButton)?x.closeButton=r.closeButton:r.closeButton===!0&&(x.closeButton=se(i.closeButton)?i.closeButton:!0);var M=c;o.isValidElement(c)&&!q(c.type)?M=o.cloneElement(c,{closeToast:m,toastProps:x,data:L}):P(c)&&(M=c({closeToast:m,toastProps:x,data:L})),i.limit&&i.limit>0&&u.count>i.limit&&N?u.queue.push({toastContent:M,toastProps:x,staleId:b}):K(C)&&C>0?setTimeout(function(){E(M,x,b)},C):E(M,x,b)}}function E(c,d,C){var b=d.toastId;C&&v.delete(C),v.set(b,{content:c,props:d}),f(function(r){return[].concat(r,[b]).filter(function(_){return _!==C})})}function O(c){var d=new Map,C=Array.from(v.values());return e.newestOnTop&&C.reverse(),C.forEach(function(b){var r=b.props.position;d.has(r)||d.set(r,[]),d.get(r).push(b)}),Array.from(d,function(b){return c(b[0],b[1])})}return{getToastToRender:O,containerRef:y,isToastActive:s}}function fe(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}function me(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientY:e.clientY}function Ae(e){var t=o.useState(!1),n=t[0],a=t[1],l=o.useState(!1),f=l[0],y=l[1],v=o.useRef(null),s=o.useRef({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,u=o.useRef(e),T=e.autoClose,I=e.pauseOnHover,h=e.closeToast,p=e.onClick,R=e.closeOnClick;o.useEffect(function(){u.current=e}),o.useEffect(function(){return v.current&&v.current.addEventListener("d",c,{once:!0}),P(e.onOpen)&&e.onOpen(o.isValidElement(e.children)&&e.children.props),function(){var m=u.current;P(m.onClose)&&m.onClose(o.isValidElement(m.children)&&m.children.props)}},[]),o.useEffect(function(){return e.pauseOnFocusLoss&&C(),function(){e.pauseOnFocusLoss&&b()}},[e.pauseOnFocusLoss]);function E(m){if(e.draggable){r();var N=v.current;s.canCloseOnClick=!0,s.canDrag=!0,s.boundingRect=N.getBoundingClientRect(),N.style.transition="",s.x=fe(m.nativeEvent),s.y=me(m.nativeEvent),e.draggableDirection==="x"?(s.start=s.x,s.removalDistance=N.offsetWidth*(e.draggablePercent/100)):(s.start=s.y,s.removalDistance=N.offsetHeight*(e.draggablePercent===80?e.draggablePercent*1.5:e.draggablePercent/100))}}function O(){if(s.boundingRect){var m=s.boundingRect,N=m.top,x=m.bottom,M=m.left,k=m.right;e.pauseOnHover&&s.x>=M&&s.x<=k&&s.y>=N&&s.y<=x?d():c()}}function c(){a(!0)}function d(){a(!1)}function C(){document.hasFocus()||d(),window.addEventListener("focus",c),window.addEventListener("blur",d)}function b(){window.removeEventListener("focus",c),window.removeEventListener("blur",d)}function r(){s.didMove=!1,document.addEventListener("mousemove",D),document.addEventListener("mouseup",L),document.addEventListener("touchmove",D),document.addEventListener("touchend",L)}function _(){document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",L),document.removeEventListener("touchmove",D),document.removeEventListener("touchend",L)}function D(m){var N=v.current;s.canDrag&&N&&(s.didMove=!0,n&&d(),s.x=fe(m),s.y=me(m),e.draggableDirection==="x"?s.delta=s.x-s.start:s.delta=s.y-s.start,s.start!==s.x&&(s.canCloseOnClick=!1),N.style.transform="translate"+e.draggableDirection+"("+s.delta+"px)",N.style.opacity=""+(1-Math.abs(s.delta/s.removalDistance)))}function L(){_();var m=v.current;if(s.canDrag&&s.didMove&&m){if(s.canDrag=!1,Math.abs(s.delta)>s.removalDistance){y(!0),e.closeToast();return}m.style.transition="transform 0.2s, opacity 0.2s",m.style.transform="translate"+e.draggableDirection+"(0)",m.style.opacity="1"}}var i={onMouseDown:E,onTouchStart:E,onMouseUp:O,onTouchEnd:O};return T&&I&&(i.onMouseEnter=d,i.onMouseLeave=c),R&&(i.onClick=function(m){p&&p(m),s.canCloseOnClick&&h()}),{playToast:c,pauseToast:d,isRunning:n,preventExitTransition:f,toastRef:v,eventHandlers:i}}function be(e){var t=e.closeToast,n=e.theme,a=e.ariaLabel,l=a===void 0?"close":a;return o.createElement("button",{className:"Toastify__close-button Toastify__close-button--"+n,type:"button",onClick:function(y){y.stopPropagation(),t(y)},"aria-label":l},o.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},o.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function Ie(e){var t,n,a=e.delay,l=e.isRunning,f=e.closeToast,y=e.type,v=e.hide,s=e.className,u=e.style,T=e.controlledProgress,I=e.progress,h=e.rtl,p=e.isIn,R=e.theme,E=S({},u,{animationDuration:a+"ms",animationPlayState:l?"running":"paused",opacity:v?0:1});T&&(E.transform="scaleX("+I+")");var O=F("Toastify__progress-bar",T?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated","Toastify__progress-bar-theme--"+R,"Toastify__progress-bar--"+y,(t={},t["Toastify__progress-bar--rtl"]=h,t)),c=P(s)?s({rtl:h,type:y,defaultClassName:O}):F(O,s),d=(n={},n[T&&I>=1?"onTransitionEnd":"onAnimationEnd"]=T&&I<1?null:function(){p&&f()},n);return o.createElement("div",Object.assign({role:"progressbar","aria-hidden":v?"true":"false","aria-label":"notification timer",className:c,style:E},d))}Ie.defaultProps={type:A.DEFAULT,hide:!1};var Fe=["theme","type"],J=function(t){var n=t.theme,a=t.type,l=he(t,Fe);return o.createElement("svg",Object.assign({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:n==="colored"?"currentColor":"var(--toastify-icon-color-"+a+")"},l))};function ke(e){return o.createElement(J,Object.assign({},e),o.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function He(e){return o.createElement(J,Object.assign({},e),o.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function je(e){return o.createElement(J,Object.assign({},e),o.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function ze(e){return o.createElement(J,Object.assign({},e),o.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function qe(){return o.createElement("div",{className:"Toastify__spinner"})}var ve={info:He,warning:ke,success:je,error:ze,spinner:qe},Ue=function(t){var n,a,l=Ae(t),f=l.isRunning,y=l.preventExitTransition,v=l.toastRef,s=l.eventHandlers,u=t.closeButton,T=t.children,I=t.autoClose,h=t.onClick,p=t.type,R=t.hideProgressBar,E=t.closeToast,O=t.transition,c=t.position,d=t.className,C=t.style,b=t.bodyClassName,r=t.bodyStyle,_=t.progressClassName,D=t.progressStyle,L=t.updateId,i=t.role,m=t.progress,N=t.rtl,x=t.toastId,M=t.deleteToast,k=t.isIn,H=t.isLoading,B=t.icon,j=t.theme,V=F("Toastify__toast","Toastify__toast-theme--"+j,"Toastify__toast--"+p,(n={},n["Toastify__toast--rtl"]=N,n)),_e=P(d)?d({rtl:N,position:c,type:p,defaultClassName:V}):F(V,d),te=!!m,le=ve[p],ne={theme:j,type:p},z=le&&le(ne);B===!1?z=void 0:P(B)?z=B(ne):o.isValidElement(B)?z=o.cloneElement(B,ne):q(B)?z=B:H&&(z=ve.spinner());function Pe(W){if(W){var ce={closeToast:E,type:p,theme:j};if(P(W))return W(ce);if(o.isValidElement(W))return o.cloneElement(W,ce)}}return o.createElement(O,{isIn:k,done:M,position:c,preventExitTransition:y,nodeRef:v},o.createElement("div",Object.assign({id:x,onClick:h,className:_e},s,{style:C,ref:v}),o.createElement("div",Object.assign({},k&&{role:i},{className:P(b)?b({type:p}):F("Toastify__toast-body",b),style:r}),z&&o.createElement("div",{className:F("Toastify__toast-icon",(a={},a["Toastify--animate-icon Toastify__zoom-enter"]=!H,a))},z),o.createElement("div",null,T)),Pe(u),(I||te)&&o.createElement(Ie,Object.assign({},L&&!te?{key:"pb-"+L}:{},{rtl:N,theme:j,delay:I,isRunning:f,isIn:k,closeToast:E,hide:R,type:p,style:D,className:_,controlledProgress:te,progress:m}))))},Ve=Ce({enter:"Toastify--animate Toastify__bounce-enter",exit:"Toastify--animate Toastify__bounce-exit",appendPosition:!0}),We=Ce({enter:"Toastify--animate Toastify__slide-enter",exit:"Toastify--animate Toastify__slide-exit",appendPosition:!0}),Oe=function(t){var n=Me(t),a=n.getToastToRender,l=n.containerRef,f=n.isToastActive,y=t.className,v=t.style,s=t.rtl,u=t.containerId;function T(I){var h,p=F("Toastify__toast-container","Toastify__toast-container--"+I,(h={},h["Toastify__toast-container--rtl"]=s,h));return P(y)?y({position:I,rtl:s,defaultClassName:p}):F(p,X(y))}return o.createElement("div",{ref:l,className:"Toastify",id:u},a(function(I,h){var p=h.length?S({},v):S({},v,{pointerEvents:"none"});return o.createElement("div",{className:T(I),style:p,key:"container-"+I},h.map(function(R){var E=R.content,O=R.props;return o.createElement(Ue,Object.assign({},O,{isIn:f(O.toastId),key:"toast-"+O.key,closeButton:O.closeButton===!0?be:O.closeButton}),E)}))}))};Oe.defaultProps={position:Ee.TOP_RIGHT,transition:Ve,rtl:!1,autoClose:5e3,hideProgressBar:!1,closeButton:be,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,newestOnTop:!1,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};var U=new Map,re,G,Ne,oe=[],ie=!1;function Ye(e,t){var n=t.containerId,a=U.get(n||re);return a?a.getToast(e):null}function Re(){return Math.random().toString(36).substring(2,9)}function Qe(e){return e&&(q(e.toastId)||K(e.toastId))?e.toastId:Re()}function $(e,t){return U.size>0?w.emit(0,e,t):(oe.push({content:e,options:t}),ie&&pe&&(ie=!1,G=document.createElement("div"),document.body.appendChild(G),Le.render(o.createElement(Oe,Object.assign({},Ne)),G))),t.toastId}function Z(e,t){return S({},t,{type:t&&t.type||e,toastId:Qe(t)})}function ee(e){return function(t,n){return $(t,Z(e,n))}}function g(e,t){return $(e,Z(A.DEFAULT,t))}g.loading=function(e,t){return $(e,Z(A.DEFAULT,S({isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1},t)))};function Ge(e,t,n){var a=t.pending,l=t.error,f=t.success,y;a&&(y=q(a)?g.loading(a,n):g.loading(a.render,S({},n,a)));var v={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},s=function(I,h,p){if(h==null){g.dismiss(y);return}var R=S({type:I},v,n,{data:p}),E=q(h)?{render:h}:h;return y?g.update(y,S({},R,E)):g(E.render,S({},R,E)),p},u=P(e)?e():e;return u.then(function(T){return s("success",f,T)}).catch(function(T){return s("error",l,T)}),u}g.promise=Ge;g.success=ee(A.SUCCESS);g.info=ee(A.INFO);g.error=ee(A.ERROR);g.warning=ee(A.WARNING);g.warn=g.warning;g.dark=function(e,t){return $(e,Z(A.DEFAULT,S({theme:"dark"},t)))};g.dismiss=function(e){return w.emit(1,e)};g.clearWaitingQueue=function(e){return e===void 0&&(e={}),w.emit(5,e)};g.isActive=function(e){var t=!1;return U.forEach(function(n){n.isToastActive&&n.isToastActive(e)&&(t=!0)}),t};g.update=function(e,t){t===void 0&&(t={}),setTimeout(function(){var n=Ye(e,t);if(n){var a=n.props,l=n.content,f=S({},a,t,{toastId:t.toastId||e,updateId:Re()});f.toastId!==e&&(f.staleId=e);var y=f.render||l;delete f.render,$(y,f)}},0)};g.done=function(e){g.update(e,{progress:1})};g.onChange=function(e){return P(e)&&w.on(4,e),function(){P(e)&&w.off(4,e)}};g.configure=function(e){e===void 0&&(e={}),ie=!0,Ne=e};g.POSITION=Ee;g.TYPE=A;w.on(2,function(e){re=e.containerId||e,U.set(re,e),oe.forEach(function(t){w.emit(0,t.content,t.options)}),oe=[]}).on(3,function(e){U.delete(e.containerId||e),U.size===0&&w.off(0).off(1).off(5),pe&&G&&document.body.removeChild(G)});const ge=({id:e,message:t={type:Y.INFO,content:""},autoClose:n=6e3,onClose:a})=>{const{type:l=Y.INFO}=t??{},f=({closeToast:s})=>ue.jsx(Se,{type:l,onClose:s,isInToast:!0}),y=ue.jsx(xe,{message:{...t,visible:!0,width:"100%",maxHeight:"500px",withDismiss:!1}}),v=(()=>{switch(t==null?void 0:t.type){case Y.SUCCESS:return g.TYPE.SUCCESS;case Y.WARNING:return g.TYPE.WARNING;case Y.ERROR:return g.TYPE.ERROR;default:return g.TYPE.INFO}})();return e!==void 0&&g.isActive(e)?g.update(e,{render:y,autoClose:n,onClose:a,type:v}):g(y,{toastId:e,autoClose:n,onClose:a,hideProgressBar:n===!1,icon:!1,closeOnClick:!1,pauseOnHover:!0,draggable:!1,closeButton:f,transition:We,type:v})},ye=e=>{g.dismiss(e)};try{ToastContainer.displayName="ToastContainer",ToastContainer.__docgenInfo={description:"",displayName:"ToastContainer",props:{}}}catch{}try{ge.displayName="toast",ge.__docgenInfo={description:"",displayName:"toast",props:{id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"Id"}},message:{defaultValue:{value:"{ type: MessageType.INFO, content: '' }"},description:"",name:"message",required:!1,type:{name:"IMessageType"}},autoClose:{defaultValue:{value:"6000"},description:"",name:"autoClose",required:!1,type:{name:"number | false"}},onClose:{defaultValue:null,description:"",name:"onClose",required:!1,type:{name:"TEmpty"}}}}}catch{}try{ye.displayName="dismissToast",ye.__docgenInfo={description:"",displayName:"dismissToast",props:{}}}catch{}export{Oe as T,ye as d,ge as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as s}from"./jsx-runtime-FsUICBgo.js";import{G as v}from"./grid-u1mZpaML.js";import{T as u}from"./text-6KQ6ntOV.js";import{F as B}from"./flex-RYZsoWEN.js";import{t as n,d}from"./toaster-
|
|
1
|
+
import{j as s}from"./jsx-runtime-FsUICBgo.js";import{G as v}from"./grid-u1mZpaML.js";import{T as u}from"./text-6KQ6ntOV.js";import{F as B}from"./flex-RYZsoWEN.js";import{t as n,d}from"./toaster-yPcd4ELJ.js";import{B as o}from"./button-BiJw0fB3.js";import{S as a}from"./spacer-Yji9g2AW.js";import{a as m}from"./message-CRKuTfOl.js";import"./index-RfLt4OUa.js";import"./styled-components.browser.esm-qIipjd6c.js";import"./tslib.es6-OIsz3r9a.js";import"./index-VW3EWkuE.js";import"./index-miLrID2P.js";import"./common-types-U65vzrrz.js";import"./disabled-context-urNQThQz.js";import"./spinner-R8Il4aRe.js";import"./icon-8EQazuuW.js";import"./objectWithoutPropertiesLoose-9Q1jwsKS.js";import"./inheritsLoose-8sb_A2v4.js";import"./index-4QtD-hFu.js";import"./tooltip-dueTLnwA.js";const _={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"},O={type:m.INFO,icon:!0,heading:"Heading",content:"Long content lorem ipsum dolor est compendum lorem ipsum."},ns={title:"Modals/Toaster",parameters:{docs:{story:{inline:!1,iframeHeight:400}}},source:{type:"code"},args:{id:void 0,message:O,autoClose:6e3,onClose:()=>{}}},G=()=>s.jsxs(s.Fragment,{children:[s.jsx(o,{label:"Info",onClick:()=>n({message:O,onClose:()=>console.log("toast closed")})}),s.jsx(a,{}),s.jsx(o,{label:"Error",onClick:()=>n({message:A,onClose:()=>console.log("toast closed")})}),s.jsx(a,{}),s.jsx(o,{label:"Warning",onClick:()=>n({message:F,onClose:()=>console.log("toast closed")})}),s.jsx(a,{}),s.jsx(o,{label:"Success",onClick:()=>n({message:_,onClose:()=>console.log("toast closed")})})]}),r=G.bind({}),t=()=>s.jsx(o,{label:"Show Toast",onClick:()=>{const e=Math.random()>=.5;n({message:{type:e?"Success":"Error",icon:!0,content:e?"Success":"Error"},onClose:()=>console.log("toast closed"),id:"uniqueId"})}});t.parameters={docs:{iframeHeight:200,description:{story:"Pass a unique `id` in the `toast` object to prevent duplicates. Successive toasts with the same ID will update the existing toast."}}};const i=()=>{const e="sessionExpiring",p={type:"Info",content:s.jsxs(v,{children:[s.jsx(u,{bold:!0,children:"You will be signed out soon"}),s.jsx(u,{children:"For your security, you will be automatically signed out in 30 minutes unless you extend your session."}),s.jsx(a,{height:"var(--padding-xxs)"}),s.jsxs(B,{gap:"var(--padding-xs)",children:[s.jsx(o,{label:"Extend session",small:!0,colored:"success",onClick:()=>d(e)}),s.jsx(o,{label:"Dismiss",small:!0,onClick:()=>d(e)})]})]})};return s.jsx(o,{label:"Show Toast",onClick:()=>n({message:p,autoClose:!1,id:e})})},l=()=>{const e="sessionExpiringSoon",p={type:"Error",content:s.jsxs(v,{children:[s.jsx(u,{bold:!0,children:"You will be signed out very soon"}),s.jsx(u,{children:"For your security, you will be automatically signed out in 30 minutes unless you extend your session."}),s.jsx(a,{height:"var(--padding-xxs)"}),s.jsxs(B,{gap:"var(--padding-xs)",children:[s.jsx(o,{label:"Extend session",small:!0,colored:"success",onClick:()=>d(e)}),s.jsx(o,{label:"Dismiss",small:!0,onClick:()=>d(e)})]})]})};return s.jsx(o,{label:"Show Toast",onClick:()=>n({message:p,autoClose:!1,id:e})})},c=()=>{const e={type:"Success",content:"Your session has been extended for 1 hour"};return s.jsx(o,{label:"Show Toast",onClick:()=>n({message:e})})};var g,x,S;r.parameters={...r.parameters,docs:{...(g=r.parameters)==null?void 0:g.docs,source:{originalSource:`() => {
|
|
2
2
|
return <>
|
|
3
3
|
<Button label="Info" onClick={() => toast({
|
|
4
4
|
message: messageInfo,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as l}from"./jsx-runtime-FsUICBgo.js";import{r as b}from"./index-RfLt4OUa.js";import{c as x}from"./index-VW3EWkuE.js";import{b as C}from"./common-types-U65vzrrz.js";import{D as q}from"./disabled-context-urNQThQz.js";import{H as E}from"./help-icon-
|
|
1
|
+
import{j as l}from"./jsx-runtime-FsUICBgo.js";import{r as b}from"./index-RfLt4OUa.js";import{c as x}from"./index-VW3EWkuE.js";import{b as C}from"./common-types-U65vzrrz.js";import{D as q}from"./disabled-context-urNQThQz.js";import{H as E}from"./help-icon-eelulTML.js";const V="_toggle_1mo1i_9",h="_small_1mo1i_25",I="_disabled_1mo1i_102",v="_noMargin_1mo1i_113",j="_helpIconEnabled_1mo1i_116",a={toggle:V,small:h,disabled:I,noMargin:v,helpIconEnabled:j},r=({name:t,label:d,checked:e=!1,disabled:u,display:m,small:p=!1,onChange:c,noMargin:g=!1,testId:f,helpText:i,onClickHelp:o})=>{const y=b.useContext(q),_=i||o,s=u||y;return l.jsxs("div",{className:x(a.toggle,s?a.disabled:null,p?a.small:null,g?a.noMargin:null),style:{display:m},onClick:n=>{s||(n.target.name=t,n.target.checked=!e,n.target.value=!e,c(n))},"data-testid":f,children:[l.jsx("input",{type:C.CHECKBOX,name:t,value:e==null?void 0:e.toString(),disabled:s,checked:e,onChange:()=>{}}),l.jsx("label",{children:d}),_&&l.jsx("div",{className:a.helpIconEnabled,onClick:o,children:l.jsx(E,{text:i})})]})};try{r.displayName="Toggle",r.__docgenInfo={description:"",displayName:"Toggle",props:{name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"string"}},label:{defaultValue:null,description:"",name:"label",required:!1,type:{name:"string | ReactElement<any, string | JSXElementConstructor<any>> | null"}},checked:{defaultValue:{value:"false"},description:"",name:"checked",required:!1,type:{name:"boolean"}},disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"boolean"}},display:{defaultValue:null,description:"",name:"display",required:!1,type:{name:"string"}},small:{defaultValue:{value:"false"},description:"",name:"small",required:!1,type:{name:"boolean"}},onChange:{defaultValue:null,description:"",name:"onChange",required:!0,type:{name:"(evt: ChangeEvent<HTMLInputElement>) => void"}},noMargin:{defaultValue:{value:"false"},description:"",name:"noMargin",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}},helpText:{defaultValue:null,description:"",name:"helpText",required:!1,type:{name:"string"}},onClickHelp:{defaultValue:null,description:"",name:"onClickHelp",required:!1,type:{name:"((evt: any) => void)"}}}}}catch{}export{r as T};
|