@oliasoft-open-source/react-ui-library 4.13.0-beta-1 → 4.13.0-beta-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/assets/bg-rock-D_kpA0sy.jpg +0 -0
- package/dist/assets/index-BZ1vGLnA.css +0 -8547
- package/dist/assets/index-D4oUBkZd.js +0 -76217
- package/dist/assets/noto-sans-latin-400-italic-BT87CHj2.woff +0 -0
- package/dist/assets/noto-sans-latin-400-italic-NApRWGLz.woff2 +0 -0
- package/dist/assets/noto-sans-latin-400-normal-CF_EggQ_.woff2 +0 -0
- package/dist/assets/noto-sans-latin-400-normal-DMz6UGTQ.woff +0 -0
- package/dist/assets/noto-sans-latin-700-italic-Cw3cBBZk.woff2 +0 -0
- package/dist/assets/noto-sans-latin-700-italic-qe_3Da_h.woff +0 -0
- package/dist/assets/noto-sans-latin-700-normal-CkyHDghY.woff +0 -0
- package/dist/assets/noto-sans-latin-700-normal-DwlQfr5s.woff2 +0 -0
- package/dist/index.html +0 -1
- package/dist/storybook/assets/Color-KGDBMAHA-ANgdrQuZ.js +0 -1
- package/dist/storybook/assets/DocsRenderer-PKQXORMH-Diyq_37l.js +0 -1
- package/dist/storybook/assets/accordion-BiuI_LCA.js +0 -1
- package/dist/storybook/assets/accordion-C3DU7hG7.css +0 -1
- package/dist/storybook/assets/accordion-DhEg2ksb.css +0 -1
- package/dist/storybook/assets/accordion.stories-CrmHu75y.js +0 -170
- package/dist/storybook/assets/actions-Bax0KeqM.js +0 -39
- package/dist/storybook/assets/actions-D8UgHts6.css +0 -1
- package/dist/storybook/assets/actions.stories-BnPZKqOJ.js +0 -1
- package/dist/storybook/assets/afe.stories-C9XjJj62.js +0 -88
- package/dist/storybook/assets/assertThisInitialized-B9jnkVVz.js +0 -1
- package/dist/storybook/assets/badge-BiaoqO6w.css +0 -1
- package/dist/storybook/assets/badge-CLQ59MDF.js +0 -1
- package/dist/storybook/assets/badge.stories-DA_eeQyi.js +0 -1
- package/dist/storybook/assets/bg-rock-D_kpA0sy.jpg +0 -0
- package/dist/storybook/assets/blowout.stories-DH-sYHgB.js +0 -40
- package/dist/storybook/assets/breadcrumb-DMx-Mu4J.css +0 -1
- package/dist/storybook/assets/breadcrumb.stories-CJArS18Q.js +0 -1
- package/dist/storybook/assets/button-Cbv7WK6k.js +0 -1
- package/dist/storybook/assets/button-DtgxLQCF.css +0 -1
- package/dist/storybook/assets/button-group-0hjBV4tw.css +0 -1
- package/dist/storybook/assets/button-group-D2fGP_bX.js +0 -1
- package/dist/storybook/assets/button-group.stories-BETADGti.js +0 -71
- package/dist/storybook/assets/button.stories-C03VvX8K.js +0 -80
- package/dist/storybook/assets/buttons-and-links-CtA6FoCC.js +0 -14
- package/dist/storybook/assets/card-EcjmryU9.js +0 -1
- package/dist/storybook/assets/card-VFDFIKp2.css +0 -1
- package/dist/storybook/assets/card.stories-CsTB0DuM.js +0 -1
- package/dist/storybook/assets/casing-loads.stories-Buy0-e_n.js +0 -209
- package/dist/storybook/assets/cell.stories-CPNfDo9l.js +0 -245
- package/dist/storybook/assets/check-box-CV-zd_I_.css +0 -1
- package/dist/storybook/assets/check-box-DPLaOkRR.js +0 -13
- package/dist/storybook/assets/check-box.stories-BJ0ShmeC.js +0 -97
- package/dist/storybook/assets/check-box.test-case.stories-CzuYZkUh.js +0 -30
- package/dist/storybook/assets/chunk-HLWAVYOI-KJoVz4w2.js +0 -2
- package/dist/storybook/assets/color-fa-nGnuH.js +0 -25
- package/dist/storybook/assets/column.stories-DDTHFELF.js +0 -88
- package/dist/storybook/assets/common-types-Sih75Sav.js +0 -1
- package/dist/storybook/assets/dialog-CBMZnjYb.css +0 -1
- package/dist/storybook/assets/dialog-DkpQscuI.js +0 -1
- package/dist/storybook/assets/disabled-context-rmpd7YJS.js +0 -1
- package/dist/storybook/assets/divider-DY9nJ_7N.js +0 -1
- package/dist/storybook/assets/divider-wQx_bznd.css +0 -1
- package/dist/storybook/assets/divider.stories-Dd-yyGrX.js +0 -1
- package/dist/storybook/assets/drawer-BVc1xI9q.css +0 -1
- package/dist/storybook/assets/drawer-DaQ1xGjV.js +0 -3
- package/dist/storybook/assets/drawer.stories-C08XBVTq.js +0 -113
- package/dist/storybook/assets/empty-L0EXybeR.css +0 -1
- package/dist/storybook/assets/empty.stories-L7LSMcLe.js +0 -1
- package/dist/storybook/assets/entry-preview-CHonU0lQ.js +0 -1
- package/dist/storybook/assets/entry-preview-docs-DUYczTxA.js +0 -54
- package/dist/storybook/assets/enum-Bnn40S8Q.js +0 -1
- package/dist/storybook/assets/field-CNDCZ5UR.css +0 -1
- package/dist/storybook/assets/field-HrLaMLbx.js +0 -7
- package/dist/storybook/assets/field.stories-CYpQ669-.js +0 -49
- package/dist/storybook/assets/file-button.stories-CRaTdLfv.js +0 -22
- package/dist/storybook/assets/file-input-b95Ui6h6.css +0 -1
- package/dist/storybook/assets/file-input-yalPf7-m.js +0 -13
- package/dist/storybook/assets/file-input.stories-DMTQqAF8.js +0 -66
- package/dist/storybook/assets/flex-EllkLxgO.js +0 -1
- package/dist/storybook/assets/flex.stories-CLwPyEMp.js +0 -15
- package/dist/storybook/assets/footer.stories-DniqHrTZ.js +0 -3
- package/dist/storybook/assets/form-row-BYz5u-Vr.css +0 -1
- package/dist/storybook/assets/form-row-CM112EYF.js +0 -1
- package/dist/storybook/assets/form.stories-Cr5Pz40F.js +0 -49
- package/dist/storybook/assets/formation.stories-C4Kugh7C.js +0 -74
- package/dist/storybook/assets/grid-DRkC-bt8.js +0 -15
- package/dist/storybook/assets/grid.stories-DqjhHHwX.js +0 -13
- package/dist/storybook/assets/heading-CRNoBc7q.js +0 -1
- package/dist/storybook/assets/heading-DMYPCDVj.css +0 -1
- package/dist/storybook/assets/heading.stories-DahFxeiX.js +0 -15
- package/dist/storybook/assets/help-icon-Buhx5nl6.js +0 -1
- package/dist/storybook/assets/help-icon-DeweQs4N.css +0 -1
- package/dist/storybook/assets/help-icon.stories-DbmZ1fgP.js +0 -4
- package/dist/storybook/assets/helpers-JJxzGegQ.js +0 -1
- package/dist/storybook/assets/icon-BSFY3vDO.js +0 -8
- package/dist/storybook/assets/icon-CXtHvr8n.css +0 -1
- package/dist/storybook/assets/icon-custom-Xcl4YkWP.js +0 -1
- package/dist/storybook/assets/icon.stories-fnZUR-LK.js +0 -6
- package/dist/storybook/assets/iframe-zFwPc0wJ.js +0 -2
- package/dist/storybook/assets/immer.esm-BwVl9PS2.js +0 -1
- package/dist/storybook/assets/index-BI4_Bp97.js +0 -1
- package/dist/storybook/assets/index-BcNHZKhG.js +0 -1
- package/dist/storybook/assets/index-Bk2sglWO.js +0 -5
- package/dist/storybook/assets/index-C0x1JmaP.js +0 -14
- package/dist/storybook/assets/index-CEuq6vkz.js +0 -1
- package/dist/storybook/assets/index-CF7H4eMJ.js +0 -28
- package/dist/storybook/assets/index-CUZDtIZe.js +0 -23
- package/dist/storybook/assets/index-D6O8EiV-.js +0 -574
- package/dist/storybook/assets/index-D6rZ4wEC.js +0 -13
- package/dist/storybook/assets/index-DKfJ8f-b.js +0 -1
- package/dist/storybook/assets/index-DMAnyMX5.js +0 -179
- package/dist/storybook/assets/index-DRSy5Ssd.js +0 -1
- package/dist/storybook/assets/index-DhsZuJvc.js +0 -12
- package/dist/storybook/assets/index.es-DazXb-ul.js +0 -79
- package/dist/storybook/assets/inheritsLoose-DP0QEDDI.js +0 -1
- package/dist/storybook/assets/initialize-context-Y03pJPr5.js +0 -1
- package/dist/storybook/assets/input-Db9WkmPP.js +0 -1
- package/dist/storybook/assets/input-Dz1ZZYN5.css +0 -1
- package/dist/storybook/assets/input-group-BaRSJAEN.js +0 -1
- package/dist/storybook/assets/input-group-C4Ph05Zr.css +0 -1
- package/dist/storybook/assets/input-group-addon-CKbTwfkc.css +0 -1
- package/dist/storybook/assets/input-group-addon-D68iUKV2.js +0 -1
- package/dist/storybook/assets/input-group.stories-BCajsqAk.js +0 -167
- package/dist/storybook/assets/input-validation-D5ctNaQa.js +0 -26
- package/dist/storybook/assets/input.stories-SJy3TKkD.js +0 -41
- package/dist/storybook/assets/inputs-CwLa0axN.js +0 -62
- package/dist/storybook/assets/jsx-runtime-eps93zm2.js +0 -8
- package/dist/storybook/assets/label-BmwKJ2Mn.css +0 -1
- package/dist/storybook/assets/label-CqmyC9he.js +0 -7
- package/dist/storybook/assets/label.stories-C0AO5F1a.js +0 -11
- package/dist/storybook/assets/layout-forms-5MAO2Ru7.js +0 -16
- package/dist/storybook/assets/layout-general-BH_mkxyI.js +0 -35
- package/dist/storybook/assets/list-By3wp5Wa.js +0 -13
- package/dist/storybook/assets/list.stories-BcDHHHYJ.js +0 -476
- package/dist/storybook/assets/list.stories-data-Doo2Rqun.js +0 -1
- package/dist/storybook/assets/loader-B4-2F7c_.css +0 -1
- package/dist/storybook/assets/loader-XHoVniao.js +0 -1
- package/dist/storybook/assets/loader.stories-Q0U2BqZX.js +0 -83
- package/dist/storybook/assets/lodash-c4VUpsOs.js +0 -27
- package/dist/storybook/assets/logo-BVP9045W.js +0 -1
- package/dist/storybook/assets/memoize-one.esm-CcMeOnPo.js +0 -1
- package/dist/storybook/assets/menu.stories-1I5AGGQx.js +0 -82
- package/dist/storybook/assets/menu.stories-data-CQ59XhzU.js +0 -1
- package/dist/storybook/assets/menu.test-case.stories-XN9XFV-D.js +0 -3
- package/dist/storybook/assets/message-BRyKdRaX.js +0 -1
- package/dist/storybook/assets/message-C2ZCkHX6.css +0 -1
- package/dist/storybook/assets/message.stories-bCqCYIuN.js +0 -341
- package/dist/storybook/assets/meta-content-ByVTG0hd.css +0 -1
- package/dist/storybook/assets/meta-content-DNgQbAW0.js +0 -9
- package/dist/storybook/assets/modal.stories-C2d-Em5V.js +0 -200
- package/dist/storybook/assets/modal.test-case.stories-Ci1WRYdo.js +0 -21
- package/dist/storybook/assets/noto-sans-latin-400-italic-BT87CHj2.woff +0 -0
- package/dist/storybook/assets/noto-sans-latin-400-italic-NApRWGLz.woff2 +0 -0
- package/dist/storybook/assets/noto-sans-latin-400-normal-CF_EggQ_.woff2 +0 -0
- package/dist/storybook/assets/noto-sans-latin-400-normal-DMz6UGTQ.woff +0 -0
- package/dist/storybook/assets/noto-sans-latin-700-italic-Cw3cBBZk.woff2 +0 -0
- package/dist/storybook/assets/noto-sans-latin-700-italic-qe_3Da_h.woff +0 -0
- package/dist/storybook/assets/noto-sans-latin-700-normal-CkyHDghY.woff +0 -0
- package/dist/storybook/assets/noto-sans-latin-700-normal-DwlQfr5s.woff2 +0 -0
- package/dist/storybook/assets/number-input-B3_gmeWr.js +0 -16
- package/dist/storybook/assets/number-input.stories-epjUq9ve.js +0 -89
- package/dist/storybook/assets/number-input.test-case.stories-DeEtalIU.js +0 -95
- package/dist/storybook/assets/objectSpread2-DW4nTBoq.js +0 -1
- package/dist/storybook/assets/objectWithoutPropertiesLoose-CAYKN5F1.js +0 -1
- package/dist/storybook/assets/option-dropdown-CqPYsFHP.css +0 -1
- package/dist/storybook/assets/option-dropdown.stories-CznUbXVi.js +0 -52
- package/dist/storybook/assets/padding-and-spacing-B1k2xnXg.js +0 -19
- package/dist/storybook/assets/page-7SSpdYhb.js +0 -1
- package/dist/storybook/assets/page-BnAFjzxf.css +0 -1
- package/dist/storybook/assets/page-DqJqTfkP.css +0 -1
- package/dist/storybook/assets/page.stories-DthnK8qb.js +0 -57
- package/dist/storybook/assets/pagination-CR1nxnnq.js +0 -1
- package/dist/storybook/assets/pagination-Dv2vKYwQ.css +0 -1
- package/dist/storybook/assets/pagination.stories-qXmBYwYc.js +0 -59
- package/dist/storybook/assets/pop-confirm-DX_o_X81.css +0 -1
- package/dist/storybook/assets/pop-confirm.stories-CHa0qUBe.js +0 -9
- package/dist/storybook/assets/popover-CSc-8-Dh.css +0 -1
- package/dist/storybook/assets/popover-C_2P8LFJ.js +0 -1
- package/dist/storybook/assets/popover.stories-DZTfimDf.js +0 -10
- package/dist/storybook/assets/portal-GQ0_cLB6.js +0 -1
- package/dist/storybook/assets/portal.stories-BvRfNPz3.js +0 -20
- package/dist/storybook/assets/preview-B0ZyjArU.css +0 -1
- package/dist/storybook/assets/preview-Ct5NkTJf.js +0 -1
- package/dist/storybook/assets/preview-DLBQXbKW.js +0 -1
- package/dist/storybook/assets/preview-DpTCnAn-.js +0 -2
- package/dist/storybook/assets/preview-FIj3W2uF.js +0 -3
- package/dist/storybook/assets/progress-bar-C_kV6r0Q.js +0 -1
- package/dist/storybook/assets/progress-bar-ztYhwUbl.css +0 -1
- package/dist/storybook/assets/progress-bar.stories-CpbgT43D.js +0 -1
- package/dist/storybook/assets/projects.stories-BPm6ucAe.js +0 -47
- package/dist/storybook/assets/radio-button-C4ljBRED.js +0 -13
- package/dist/storybook/assets/radio-button-DvubT0Gg.css +0 -1
- package/dist/storybook/assets/radio-button.stories-D1rWr6ms.js +0 -61
- package/dist/storybook/assets/radio-button.test-case.stories-DglmHlWs.js +0 -11
- package/dist/storybook/assets/react-16-DXAfArL2.js +0 -1
- package/dist/storybook/assets/react-router-dom-Ck2Y_Fzc.js +0 -8
- package/dist/storybook/assets/redux-tRgGMjwY.js +0 -1
- package/dist/storybook/assets/reservoirs.stories-r1Ip90kJ.js +0 -156
- package/dist/storybook/assets/rich-text-input-BJfL0Me_.css +0 -1
- package/dist/storybook/assets/rich-text-input.stories-DwaseXZv.js +0 -256
- package/dist/storybook/assets/row-Bmiy2Lh0.js +0 -39
- package/dist/storybook/assets/row-D-EMWFT6.css +0 -1
- package/dist/storybook/assets/row.stories-jKh8Ms1e.js +0 -130
- package/dist/storybook/assets/select-BmYXTl_0.css +0 -1
- package/dist/storybook/assets/select-Cwks-WA0.js +0 -61
- package/dist/storybook/assets/select.input-CJed_LLR.js +0 -1
- package/dist/storybook/assets/select.stories-DjGSNDXK.js +0 -498
- package/dist/storybook/assets/select.stories-data-DxgWKlU6.js +0 -1
- package/dist/storybook/assets/select.test-case.stories-CrXzt4qn.js +0 -82
- package/dist/storybook/assets/side-bar-fBbBqyAT.css +0 -1
- package/dist/storybook/assets/side-bar-wpFQ5NEE.js +0 -24
- package/dist/storybook/assets/side-bar.stories-LjClxJcG.js +0 -1
- package/dist/storybook/assets/site.stories-BnWmALGd.js +0 -166
- package/dist/storybook/assets/slider-DPdTVMP0.css +0 -1
- package/dist/storybook/assets/slider-DxaD8LU4.js +0 -27
- package/dist/storybook/assets/slider.stories-DuGie_AX.js +0 -134
- package/dist/storybook/assets/smart-upload-modal.stories-BlTSF64K.js +0 -25
- package/dist/storybook/assets/spacer-BWoNR27H.js +0 -1
- package/dist/storybook/assets/spacer.stories-BT2S6B0R.js +0 -1
- package/dist/storybook/assets/spinner-AWUe4xwQ.js +0 -1
- package/dist/storybook/assets/spinner-C07x-KQu.css +0 -1
- package/dist/storybook/assets/spinner.stories-DuQNhl1V.js +0 -26
- package/dist/storybook/assets/styled-components.browser.esm-BQ9GQzDc.js +0 -2
- package/dist/storybook/assets/table-BSABGfWm.js +0 -86
- package/dist/storybook/assets/table-BtBtDwPu.css +0 -1
- package/dist/storybook/assets/table.stories-CHwzAdud.js +0 -772
- package/dist/storybook/assets/table.stories-data-C7mC5R8Q.js +0 -1
- package/dist/storybook/assets/tabs-BoToLVEP.js +0 -13
- package/dist/storybook/assets/tabs-DnWs2PtA.css +0 -1
- package/dist/storybook/assets/tabs.stories-B52iEaHf.js +0 -30
- package/dist/storybook/assets/text-2O-HSG8g.css +0 -1
- package/dist/storybook/assets/text-B3-TSWok.js +0 -1
- package/dist/storybook/assets/text-link.stories-BQAkVO-W.js +0 -14
- package/dist/storybook/assets/text.stories-B8L4FWPt.js +0 -1
- package/dist/storybook/assets/textarea-DflOOrxV.js +0 -13
- package/dist/storybook/assets/textarea-TqxidmV4.css +0 -1
- package/dist/storybook/assets/textarea.stories-CzsqRVpC.js +0 -9
- package/dist/storybook/assets/tiny-invariant-DqLgxztJ.js +0 -8
- package/dist/storybook/assets/title.stories-D0VjujmM.js +0 -37
- package/dist/storybook/assets/toaster-7wnI6hqB.js +0 -1
- package/dist/storybook/assets/toaster-DwLvOY18.css +0 -1
- package/dist/storybook/assets/toaster-O8ftrUAJ.js +0 -1
- package/dist/storybook/assets/toaster.stories-CdpwLBSo.js +0 -84
- package/dist/storybook/assets/toaster.test-case.stories-Cy3_Gvs_.js +0 -6
- package/dist/storybook/assets/toggle-BbFVf61v.js +0 -13
- package/dist/storybook/assets/toggle-yD7j1VSk.css +0 -1
- package/dist/storybook/assets/toggle.stories-BAislK3I.js +0 -106
- package/dist/storybook/assets/toggle.test-case.stories-CeUwdhGD.js +0 -36
- package/dist/storybook/assets/tooltip-1V7clEnw.js +0 -29
- package/dist/storybook/assets/tooltip-COvcX6J7.css +0 -1
- package/dist/storybook/assets/tooltip.stories-1YexWg6N.js +0 -17
- package/dist/storybook/assets/tooltip.test-case.stories-De9h8ThH.js +0 -5
- package/dist/storybook/assets/top-bar-Bjf6PQE1.js +0 -163
- package/dist/storybook/assets/top-bar-u7j8EgRd.css +0 -1
- package/dist/storybook/assets/top-bar.stories-1hZmlzDT.js +0 -21
- package/dist/storybook/assets/top-bar.testcase.stories-BsFYqaw6.js +0 -30
- package/dist/storybook/assets/tree-BTgu2lWb.css +0 -1
- package/dist/storybook/assets/tree.stories-NGZfmH_B.js +0 -181
- package/dist/storybook/assets/types-BmbYqTX_.js +0 -1
- package/dist/storybook/assets/types-Dx2TtIG9.js +0 -1
- package/dist/storybook/assets/unit-input-5P4Cogho.css +0 -1
- package/dist/storybook/assets/unit-input-CFaqZ7UG.js +0 -7
- package/dist/storybook/assets/unit-input.stories-DBuzpBTN.js +0 -203
- package/dist/storybook/assets/unit-input.test-case.stories-Dzx3BsjK.js +0 -223
- package/dist/storybook/assets/unit-table.stories-DwZVHcZo.js +0 -152
- package/dist/storybook/assets/unit-table.test-case.stories-C9Swzooe.js +0 -1
- package/dist/storybook/favicon.svg +0 -1
- package/dist/storybook/iframe.html +0 -639
- package/dist/storybook/index.html +0 -153
- package/dist/storybook/index.json +0 -1
- package/dist/storybook/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/storybook/nunito-sans-bold.woff2 +0 -0
- package/dist/storybook/nunito-sans-italic.woff2 +0 -0
- package/dist/storybook/nunito-sans-regular.woff2 +0 -0
- package/dist/storybook/project.json +0 -1
- package/dist/storybook/sb-addons/actions-1/manager-bundle.js +0 -3
- package/dist/storybook/sb-addons/actions-1/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/storybook/sb-addons/interactions-2/manager-bundle.js +0 -234
- package/dist/storybook/sb-addons/interactions-2/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/storybook/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +0 -3
- package/dist/storybook/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/dist/storybook/sb-addons/storybook-dark-mode-esm-preset-3/manager-bundle.js +0 -5
- package/dist/storybook/sb-addons/storybook-dark-mode-esm-preset-3/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/storybook/sb-common-assets/favicon.svg +0 -1
- package/dist/storybook/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/storybook/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/storybook/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/storybook/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/storybook/sb-manager/globals-module-info.js +0 -995
- package/dist/storybook/sb-manager/globals-runtime.js +0 -53525
- package/dist/storybook/sb-manager/globals.js +0 -48
- package/dist/storybook/sb-manager/runtime.js +0 -11884
- package/dist/storybook/sb-preview/globals.js +0 -33
- package/dist/storybook/sb-preview/runtime.js +0 -9485
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=(r=>(r.HEADING="Heading",r.DIVIDER="Divider",r.OPTION="Option",r.MENU="Menu",r))(i||{}),D=(r=>(r.FALSE="false",r.RIGHT="right",r.DOWN="down",r))(D||{});export{i as M,D as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t}from"./index-DhsZuJvc.js";import{l as s}from"./lodash-c4VUpsOs.js";const a=r=>s.isString(r)||s.isNumber(r)||t.isValidElement(r),e=r=>Array.isArray(r)?"array":typeof r;export{e as g,a as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._predefinedMenuActive_ye9w9_1 input{background:var(--color-background-disabled)!important}._inputWrapper_ye9w9_4{flex:1}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{j as l}from"./jsx-runtime-eps93zm2.js";import{r as T}from"./index-DhsZuJvc.js";import{d as r}from"./index-C0x1JmaP.js";import{c as Ve}from"./index-Bk2sglWO.js";import{c as Ee,i as be,g as Y,a as Ne,u as qe,b as we}from"./initialize-context-Y03pJPr5.js";import{M as Z}from"./actions-Bax0KeqM.js";import{I as he}from"./input-group-addon-D68iUKV2.js";import{I as Ie}from"./input-group-BaRSJAEN.js";import{l as N}from"./lodash-c4VUpsOs.js";import{N as ye,r as Oe}from"./number-input-B3_gmeWr.js";import{B as Pe}from"./button-Cbv7WK6k.js";import{T as Ce}from"./tooltip-1V7clEnw.js";import{S as De}from"./spacer-BWoNR27H.js";import{T as Me}from"./text-B3-TSWok.js";import{M as Q}from"./types-BmbYqTX_.js";const Se=()=>{const e=T.useRef(null);return T.useLayoutEffect(()=>{e.current&&(e.current(),e.current=null)}),p=>{e.current=p}};var c=(e=>(e.CUSTOM="custom",e.PREDEFINED="predefined",e))(c||{});const Fe=e=>{if(!e)return!1;const t=r.getUnit(e);return!r.KNOWN_UNITS.includes(t)},M=({value:e="",toUnit:t,unitkey:p,defaultFromUnit:C,doNotConvertValue:q})=>{const U=r.getValue(e),v=be(U);return Fe(e)?{value:U}:v?{value:U}:r.isValueWithUnit(e)?Ee({value:e,unitkey:p,toUnit:t,fromUnit:C,doNotConvertValue:q,exactPrecision:!0}):{value:e}},z=e=>N.isObject(e)&&!N.isArray(e)&&!N.isFunction(e)?N.get(e,"fieldName",""):typeof e=="string"?e:"",J=(e="")=>{var t;return(t=r.KNOWN_UNITS)==null?void 0:t.includes(e)},je=(e,t)=>{const p=r.getUnit(e||"");return J(t)&&J(p)},xe=e=>N.isNil(e)?e:r.isValueWithUnit(e)?r.getValue(e):e,L=({predefinedOptions:e,displayLayer:t,unitkey:p,unitTemplate:C,onPredefinedOptionSelect:q,disabled:U,initialPredefinedOption:v,predefinedOptionsMenuState:I,setPredefinedOptionsMenuState:u,testId:o})=>{const R=xe(t==null?void 0:t.value),[V,y]=T.useState(void 0),_=({value:a,unitkey:E})=>{if(!a||!p)return a;const f=E||p,O=Y(f,C),{value:S}=M({value:a,toUnit:O,unitkey:f,defaultFromUnit:"",doNotConvertValue:!1});return r.withUnit(S,O)},W=a=>{const E=_(a),[f="",O=""]=r.split(E);return{type:Q.OPTION,inline:!0,onClick:()=>{r.validateNumber(f).valid&&!U&&(u(c.PREDEFINED),q(f,a),y(a))},label:l.jsxs(l.Fragment,{children:[l.jsx(Me,{children:a.label}),l.jsx(De,{width:"20px",height:"0"})]}),description:`${f} ${O}`,selected:r.withUnit(t==null?void 0:t.value,(t==null?void 0:t.unit)??"")===E&&I===c.PREDEFINED}},w=T.useMemo(()=>e.find(a=>a.value===v||a.label===v||a.valueKey===v),[v,e]);T.useEffect(()=>{w&&(u(c.PREDEFINED),y(w),q(w.value,w))},[w]),T.useEffect(()=>{const a=e.find(E=>_(E)===r.withUnit(t==null?void 0:t.value,(t==null?void 0:t.unit)??""));a?(u(c.PREDEFINED),y(a)):(u(c.CUSTOM),y(void 0))},[R,e]);const D=[{type:Q.OPTION,inline:!0,onClick:()=>{U||u(c.CUSTOM)},label:"Custom",selected:I===c.CUSTOM},...e.map(W)];return l.jsx(Ce,{text:I===c.PREDEFINED?V==null?void 0:V.label:"",children:l.jsx(Z,{testId:o&&`${o}-predefined-menu`,maxHeight:380,groupOrder:"first",disabled:U,menu:{colored:!0,trigger:"Component",component:l.jsx(Pe,{groupOrder:"first",active:I===c.PREDEFINED,icon:I===c.PREDEFINED?"link":"unlink"}),small:!0,sections:D}})})};L.__docgenInfo={description:"",methods:[],displayName:"PredefinedOptionsMenu",props:{predefinedOptions:{required:!0,tsType:{name:"Array",elements:[{name:"IPredefinedOption"}],raw:"IPredefinedOption[]"},description:""},displayLayer:{required:!1,tsType:{name:"IDisplayLayer"},description:""},unitkey:{required:!1,tsType:{name:"string"},description:""},unitTemplate:{required:!0,tsType:{name:"Record",elements:[{name:"string"},{name:"any"}],raw:"Record<string, any>"},description:""},onPredefinedOptionSelect:{required:!0,tsType:{name:"signature",type:"function",raw:"(value: string, options: IPredefinedOption) => void",signature:{arguments:[{type:{name:"string"},name:"value"},{type:{name:"IPredefinedOption"},name:"options"}],return:{name:"void"}}},description:""},disabled:{required:!0,tsType:{name:"boolean"},description:""},initialPredefinedOption:{required:!1,tsType:{name:"string"},description:""},predefinedOptionsMenuState:{required:!0,tsType:{name:"PredefinedOptionsMenuState"},description:""},setPredefinedOptionsMenuState:{required:!0,tsType:{name:"Dispatch",elements:[{name:"SetStateAction",elements:[{name:"PredefinedOptionsMenuState"}],raw:"SetStateAction<PredefinedOptionsMenuState>"}],raw:`Dispatch<
|
|
2
|
-
SetStateAction<PredefinedOptionsMenuState>
|
|
3
|
-
>`},description:""},testId:{required:!1,tsType:{name:"string"},description:""}}};const Ae="_predefinedMenuActive_ye9w9_1",ke="_inputWrapper_ye9w9_4",X={predefinedMenuActive:Ae,inputWrapper:ke},Re=({name:e,placeholder:t="",disabled:p=!1,disabledUnit:C=!1,error:q=null,left:U=!1,small:v=!1,width:I="100%",value:u,unitkey:o="",initUnit:R,noConversion:V=!1,onChange:y=N.noop,onClick:_=N.noop,onFocus:W=N.noop,onSwitchUnit:w=N.noop,unitTemplate:D,testId:a,warning:E=null,predefinedOptions:f,initialPredefinedOption:O="",validationCallback:S=()=>({name:"",error:null}),disabledValidation:ee=!1,allowEmpty:te=!1,convertBackToStorageUnit:ne=!1,enableCosmeticRounding:B=!0,enableDisplayRounding:re=!1})=>{const b=Ne(),ie=Se(),[$,ae]=T.useState(c.CUSTOM);typeof u=="number"&&(u=`${u}`);const[se="",P=""]=u!==void 0?r.split(u):[],K=T.useMemo(()=>Y(o,D||(b==null?void 0:b.unitTemplate)),[o,D,b==null?void 0:b.unitTemplate]),ue=je(u,K),h=R||K||P,oe=qe(h),{value:G}=M({value:u,toUnit:h,unitkey:o,defaultFromUnit:P,doNotConvertValue:V}),le=G!==""?{value:G,unit:h}:{value:se,unit:P},[s,F]=T.useState(le),de=te||(s==null?void 0:s.value)===void 0,ce=!!ee,me=()=>{const n=u??"",i=s==null?void 0:s.unit;if(we({value:n,unitkey:o,toUnit:i})){if(o)try{let d=r.altUnitsList(n,o);return r.getValue(n)===""?d.map(g=>["",g[1]]):d}catch{return null}}else{let d=r.getAltUnitsListByQuantity(o);return d==null?void 0:d.map(g=>["",g==null?void 0:g.unit])}},pe=n=>{const i=z(e),m=n.target,{value:d,selectionStart:g}=m,k=r.withUnit(d,(s==null?void 0:s.unit)||""),H=ne?r.withUnit(r.convertAndGetValue(k,P),P):k;y({target:{value:H,name:i}});const[Te,Ue]=r.split(k);F({value:Te,unit:Ue}),ie(()=>{m.selectionStart=g,m.selectionEnd=g})},fe=(n,i)=>{i===s.unit||isNaN(Number(n))||(F({value:n,unit:i}),w&&w(i))};T.useEffect(()=>{if(h){let n,i="";if(oe!==h){const{value:m}=M({value:u,toUnit:h,unitkey:o,defaultFromUnit:P,doNotConvertValue:V});n=m,i=h}else if(r.withUnit(s.value,s.unit)!==u){const{value:m}=M({value:u,toUnit:s.unit,unitkey:o,defaultFromUnit:P,doNotConvertValue:V});n=m,i=s.unit}n!==void 0&&!O&&F({value:n,unit:i})}},[h,u,q]);const j=me(),x=r.label(s.unit)||s.unit||"",ge=V||!j||j&&j.length===1,A=z(e),ve=n=>{if(r.isValueWithUnit(n)){const i=r.getUnit(n),{value:m}=M({value:n,toUnit:s.unit,unitkey:o,defaultFromUnit:i,doNotConvertValue:V});return m}return n};return l.jsx("div",{className:$===c.PREDEFINED?Ve(X.predefinedMenuActive):"",children:l.jsxs(Ie,{small:v,width:I,children:[f&&l.jsx(L,{testId:a,unitTemplate:D||(b==null?void 0:b.unitTemplate),unitkey:o,predefinedOptions:f,displayLayer:s,onPredefinedOptionSelect:(n,i)=>{i!=null&&i.linked||(y({target:{value:n,name:A}}),F({value:n,unit:r.getUnit(n)||s.unit}))},disabled:p,initialPredefinedOption:O,predefinedOptionsMenuState:$,setPredefinedOptionsMenuState:ae}),l.jsx("div",{className:X.inputWrapper,children:l.jsx(ye,{name:A,testId:a,disabled:p,placeholder:ve(t),value:s.value,onChange:pe,onFocus:W,error:q===null?void 0:q,warning:E===null?void 0:E,left:U,allowEmpty:de,validationCallback:(n,i)=>S(A,i),enableCosmeticRounding:B,enableDisplayRounding:re,groupOrder:f?"middle":"first",disableInternalErrorValidationMessages:ce,small:v},A)}),x&&(ge||!ue?l.jsx(he,{groupOrder:"last",children:x}):l.jsx(Z,{maxHeight:380,groupOrder:"last",disabled:C,testId:a&&`${a}-menu`,menu:{label:x,trigger:"DropDownButton",small:v,sections:j.map(([n,i,m])=>{const d=m||i||"",g=r.isValidNum(n)?n:"";return{type:"Option",label:B?Oe(g):g,inline:!0,onClick:H=>{H.stopPropagation(),fe(n,i)},description:d,selected:d===x,testId:`${a}-unit-${d}`}})}}))]})})};Re.__docgenInfo={description:"",methods:[],displayName:"UnitInput",props:{name:{required:!0,tsType:{name:"union",raw:"string | { fieldName?: string }",elements:[{name:"string"},{name:"signature",type:"object",raw:"{ fieldName?: string }",signature:{properties:[{key:"fieldName",value:{name:"string",required:!1}}]}}]},description:""},placeholder:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"''",computed:!1}},disabled:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},disabledUnit:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},error:{required:!1,tsType:{name:"union",raw:"string | null | boolean",elements:[{name:"string"},{name:"null"},{name:"boolean"}]},description:"",defaultValue:{value:"null",computed:!1}},left:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},small:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},width:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:"",defaultValue:{value:"'100%'",computed:!1}},value:{required:!1,tsType:{name:"string"},description:""},unitkey:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"''",computed:!1}},initUnit:{required:!1,tsType:{name:"string"},description:""},noConversion:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},testId:{required:!1,tsType:{name:"string"},description:""},warning:{required:!1,tsType:{name:"union",raw:"string | boolean | null",elements:[{name:"string"},{name:"boolean"},{name:"null"}]},description:"",defaultValue:{value:"null",computed:!1}},predefinedOptions:{required:!1,tsType:{name:"union",raw:"IPredefinedOption[] | null",elements:[{name:"Array",elements:[{name:"IPredefinedOption"}],raw:"IPredefinedOption[]"},{name:"null"}]},description:""},initialPredefinedOption:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"''",computed:!1}},validationCallback:{required:!1,tsType:{name:"signature",type:"function",raw:"(name: string, error: string | null) => any",signature:{arguments:[{type:{name:"string"},name:"name"},{type:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},name:"error"}],return:{name:"any"}}},description:"",defaultValue:{value:"() => ({ name: '', error: null })",computed:!1}},disabledValidation:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},allowEmpty:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: TOnChangeEvent) => void",signature:{arguments:[{type:{name:"signature",type:"object",raw:"{ target: TOnChangeEventTarget }",signature:{properties:[{key:"target",value:{name:"union",raw:`| TOnChangeEventBaseTarget
|
|
4
|
-
| (TOnChangeEventBaseTarget & {
|
|
5
|
-
predefinedSelected: boolean;
|
|
6
|
-
predefinedOption: IPredefinedOption;
|
|
7
|
-
})`,elements:[{name:"signature",type:"object",raw:"{ name: string; value: string }",signature:{properties:[{key:"name",value:{name:"string",required:!0}},{key:"value",value:{name:"string",required:!0}}]}},{name:"unknown"}],required:!0}}]}},name:"evt"}],return:{name:"void"}}},description:"",defaultValue:{value:"noop",computed:!0}},onSwitchUnit:{required:!1,tsType:{name:"signature",type:"function",raw:"(unit: string) => void",signature:{arguments:[{type:{name:"string"},name:"unit"}],return:{name:"void"}}},description:"",defaultValue:{value:"noop",computed:!0}},onClick:{required:!1,tsType:{name:"MouseEventHandler",elements:[{name:"HTMLInputElement"}],raw:"MouseEventHandler<HTMLInputElement>"},description:"",defaultValue:{value:"noop",computed:!0}},onFocus:{required:!1,tsType:{name:"FocusEventHandler",elements:[{name:"HTMLInputElement"}],raw:"FocusEventHandler<HTMLInputElement>"},description:"",defaultValue:{value:"noop",computed:!0}},unitTemplate:{required:!1,tsType:{name:"Record",elements:[{name:"string"},{name:"any"}],raw:"Record<string, any>"},description:""},convertBackToStorageUnit:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},enableCosmeticRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},enableDisplayRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}}}};export{Re as U};
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as l}from"./index-DhsZuJvc.js";import{U as i}from"./unit-input-CFaqZ7UG.js";import{B as c}from"./button-Cbv7WK6k.js";import{S as O}from"./spacer-BWoNR27H.js";import{R as Te,C as qe}from"./row-Bmiy2Lh0.js";import{F as D}from"./field-HrLaMLbx.js";import{M as Ke}from"./message-BRyKdRaX.js";import"./index-C0x1JmaP.js";import"./index-DRSy5Ssd.js";import"./index-Bk2sglWO.js";import"./initialize-context-Y03pJPr5.js";import"./number-input-B3_gmeWr.js";import"./enum-Bnn40S8Q.js";import"./index-CEuq6vkz.js";import"./lodash-c4VUpsOs.js";import"./helpers-JJxzGegQ.js";import"./input-Db9WkmPP.js";import"./disabled-context-rmpd7YJS.js";import"./types-Dx2TtIG9.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./actions-Bax0KeqM.js";import"./common-types-Sih75Sav.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./types-BmbYqTX_.js";import"./badge-CLQ59MDF.js";import"./input-group-addon-D68iUKV2.js";import"./input-group-BaRSJAEN.js";import"./text-B3-TSWok.js";import"./spinner-AWUe4xwQ.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./label-CqmyC9he.js";import"./help-icon-Buhx5nl6.js";const{useArgs:Le}=__STORYBOOK_MODULE_PREVIEW_API__,ka={title:"Forms/UnitInput",component:i,args:{name:"example",unitkey:"length",value:"123|m"}},t=s=>{const[n,a]=Le(),r=o=>{a({value:o.target.value})};return e.jsx(i,{...s,onChange:r})},E=t.bind({}),g=t.bind({});g.args={initUnit:"ft",unitTemplate:{length:"ft"}};const p=t.bind({});p.args={value:'123|"',unitkey:'"'};const m=t.bind({});m.args={width:"180px"};const h=t.bind({});h.args={noConversion:!0};const v=t.bind({});v.args={small:!0};const C=t.bind({});C.args={error:"Error message goes here"};const b=t.bind({});b.args={value:"asas123asd|%"};const u=t.bind({});u.args={disabled:!0,disabledUnit:!0};u.parameters={docs:{description:{story:"Each part of UnitInput can be disabled separately. `disabled` disables only the main text input, `disabledUnit` disables only the unit menu. **Needs review (comes from Reservoir input requirements)**"}}};const U=t.bind({});U.args={disabled:!0,disabledUnit:!0,noConversion:!0};const y=t.bind({});y.args={disabledUnit:!0,unitkey:void 0};const x=t.bind({});x.args={disabledUnit:!0,unitkey:"length"};const A=t.bind({});A.args={disabledUnit:!1,disabled:!0};const f=t.bind({});f.args={name:"unitInput",placeholder:"Enter value",unitkey:"length",predefinedOptions:[{label:"Bottom of casing",value:"12|km"},{label:"Mud weight at shoe depth",value:"8|m"}],initialPredefinedOption:"8|m"};const I=t.bind({});I.args={name:"unitInput",placeholder:"Enter value",unitkey:"length",unitTemplate:{length:"ft"},predefinedOptions:[{label:"Bottom of casing in ft",value:"7|ft"},{label:"Bottom of casing",value:"12|m"},{label:"Mud weight at shoe depth",value:"8|m"}]};const S=t.bind({});S.args={name:"unitInput",placeholder:"Enter value",unitkey:"length",unitTemplate:{length:"ft"},predefinedOptions:[{label:"Bottom of casing",value:"12|km"},{label:"Mud weight at shoe depth",value:"8|m"},{label:"Mud weight at shoe depth",value:"35|%",unitkey:"percentage",linked:!0}]};const w=()=>{const s="500px",[n,a]=l.useState("1|m");return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different cases for automatic (placeholder) values:"}),e.jsx(Te,{children:e.jsxs(qe,{width:"25%",children:[e.jsx(c,{label:"Change value to ''",onClick:()=>a("")}),e.jsx("br",{}),e.jsx(c,{label:"Change value to 1",onClick:()=>a("1")}),e.jsx("br",{}),e.jsx(c,{label:"Change value to 1|m",onClick:()=>a("1|m")}),e.jsx("br",{}),e.jsx(c,{label:"Change value to |m - empty value",onClick:()=>a("|m")})]})}),e.jsx("br",{}),e.jsx(D,{label:"Normal PUI (only placeholder)",children:e.jsx(i,{name:"example1",onChange:r=>a(r.target.value),value:n,unitkey:"length",width:s,placeholder:"Placeholder test"})}),e.jsx(D,{label:"Normal PUI (placeholder + allowEmpty)",children:e.jsx(i,{name:"example1",onChange:r=>a(r.target.value),value:n,unitkey:"length",width:s,placeholder:"Placeholder test",allowEmpty:!0})}),e.jsx(Ke,{message:{heading:"Current value inside PUI: "+n,visible:!0}})]})},k=()=>{const[s,n]=l.useState("123|%"),[a,r]=l.useState(null),o="This should be visible when an error appears",P=(d,_)=>(r(_),{name:d,error:_});return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"3rd party validation message when inputting invalid value:"}),e.jsx(i,{name:"example",onChange:d=>n(d.target.value),error:!a||o,validationCallback:P,value:s}),e.jsx("br",{}),e.jsx(O,{}),e.jsx("h4",{children:"Original validation message: "}),e.jsx(Ke,{message:{heading:a,visible:!0}})]})},j=()=>{const[s,n]=l.useState("123|m"),[a,r]=l.useState(""),[o,P]=l.useState("km"),d=()=>{P("ft"),r("placeholder"),n("|m")};return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Empty value case:"}),e.jsx(i,{name:"example",onChange:_=>n(_.target.value),value:s,allowEmpty:!0,placeholder:a,initUnit:o,unitkey:"length"}),e.jsx("br",{}),e.jsx(O,{}),e.jsx(c,{label:"Change value |m and unit ft",onClick:()=>d()})]})},V=()=>{const[s,n]=l.useState("123|m"),[a,r]=l.useState("m");return e.jsxs(e.Fragment,{children:[e.jsx(i,{name:"example",onChange:o=>n(o.target.value),value:s,initUnit:a,unitkey:"length",onSwitchUnit:r}),e.jsx(O,{}),e.jsx(i,{name:"example",onChange:o=>n(o.target.value),value:s,initUnit:a,unitkey:"length",onSwitchUnit:r})]})};w.__docgenInfo={description:"",methods:[],displayName:"AutomaticValues"};k.__docgenInfo={description:"",methods:[],displayName:"ValidationCallback"};j.__docgenInfo={description:"",methods:[],displayName:"AllowEmptyPUI"};V.__docgenInfo={description:"",methods:[],displayName:"OnSwitchUnit"};var M,N,B;E.parameters={...E.parameters,docs:{...(M=E.parameters)==null?void 0:M.docs,source:{originalSource:`args => {
|
|
2
|
-
const [_, updateArgs] = useArgs();
|
|
3
|
-
const handleChange = (evt: any) => {
|
|
4
|
-
updateArgs({
|
|
5
|
-
value: evt.target.value
|
|
6
|
-
});
|
|
7
|
-
};
|
|
8
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
9
|
-
}`,...(B=(N=E.parameters)==null?void 0:N.docs)==null?void 0:B.source}}};var F,W,R;g.parameters={...g.parameters,docs:{...(F=g.parameters)==null?void 0:F.docs,source:{originalSource:`args => {
|
|
10
|
-
const [_, updateArgs] = useArgs();
|
|
11
|
-
const handleChange = (evt: any) => {
|
|
12
|
-
updateArgs({
|
|
13
|
-
value: evt.target.value
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
17
|
-
}`,...(R=(W=g.parameters)==null?void 0:W.docs)==null?void 0:R.source}}};var K,T,q;p.parameters={...p.parameters,docs:{...(K=p.parameters)==null?void 0:K.docs,source:{originalSource:`args => {
|
|
18
|
-
const [_, updateArgs] = useArgs();
|
|
19
|
-
const handleChange = (evt: any) => {
|
|
20
|
-
updateArgs({
|
|
21
|
-
value: evt.target.value
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
25
|
-
}`,...(q=(T=p.parameters)==null?void 0:T.docs)==null?void 0:q.source}}};var L,Y,z;m.parameters={...m.parameters,docs:{...(L=m.parameters)==null?void 0:L.docs,source:{originalSource:`args => {
|
|
26
|
-
const [_, updateArgs] = useArgs();
|
|
27
|
-
const handleChange = (evt: any) => {
|
|
28
|
-
updateArgs({
|
|
29
|
-
value: evt.target.value
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
33
|
-
}`,...(z=(Y=m.parameters)==null?void 0:Y.docs)==null?void 0:z.source}}};var G,H,J;h.parameters={...h.parameters,docs:{...(G=h.parameters)==null?void 0:G.docs,source:{originalSource:`args => {
|
|
34
|
-
const [_, updateArgs] = useArgs();
|
|
35
|
-
const handleChange = (evt: any) => {
|
|
36
|
-
updateArgs({
|
|
37
|
-
value: evt.target.value
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
41
|
-
}`,...(J=(H=h.parameters)==null?void 0:H.docs)==null?void 0:J.source}}};var Q,X,Z;v.parameters={...v.parameters,docs:{...(Q=v.parameters)==null?void 0:Q.docs,source:{originalSource:`args => {
|
|
42
|
-
const [_, updateArgs] = useArgs();
|
|
43
|
-
const handleChange = (evt: any) => {
|
|
44
|
-
updateArgs({
|
|
45
|
-
value: evt.target.value
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
49
|
-
}`,...(Z=(X=v.parameters)==null?void 0:X.docs)==null?void 0:Z.source}}};var $,ee,ae;C.parameters={...C.parameters,docs:{...($=C.parameters)==null?void 0:$.docs,source:{originalSource:`args => {
|
|
50
|
-
const [_, updateArgs] = useArgs();
|
|
51
|
-
const handleChange = (evt: any) => {
|
|
52
|
-
updateArgs({
|
|
53
|
-
value: evt.target.value
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
57
|
-
}`,...(ae=(ee=C.parameters)==null?void 0:ee.docs)==null?void 0:ae.source}}};var te,ne,re;b.parameters={...b.parameters,docs:{...(te=b.parameters)==null?void 0:te.docs,source:{originalSource:`args => {
|
|
58
|
-
const [_, updateArgs] = useArgs();
|
|
59
|
-
const handleChange = (evt: any) => {
|
|
60
|
-
updateArgs({
|
|
61
|
-
value: evt.target.value
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
65
|
-
}`,...(re=(ne=b.parameters)==null?void 0:ne.docs)==null?void 0:re.source}}};var se,oe,le;u.parameters={...u.parameters,docs:{...(se=u.parameters)==null?void 0:se.docs,source:{originalSource:`args => {
|
|
66
|
-
const [_, updateArgs] = useArgs();
|
|
67
|
-
const handleChange = (evt: any) => {
|
|
68
|
-
updateArgs({
|
|
69
|
-
value: evt.target.value
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
73
|
-
}`,...(le=(oe=u.parameters)==null?void 0:oe.docs)==null?void 0:le.source}}};var ie,ue,de;U.parameters={...U.parameters,docs:{...(ie=U.parameters)==null?void 0:ie.docs,source:{originalSource:`args => {
|
|
74
|
-
const [_, updateArgs] = useArgs();
|
|
75
|
-
const handleChange = (evt: any) => {
|
|
76
|
-
updateArgs({
|
|
77
|
-
value: evt.target.value
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
81
|
-
}`,...(de=(ue=U.parameters)==null?void 0:ue.docs)==null?void 0:de.source}}};var ce,ge,pe;y.parameters={...y.parameters,docs:{...(ce=y.parameters)==null?void 0:ce.docs,source:{originalSource:`args => {
|
|
82
|
-
const [_, updateArgs] = useArgs();
|
|
83
|
-
const handleChange = (evt: any) => {
|
|
84
|
-
updateArgs({
|
|
85
|
-
value: evt.target.value
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
89
|
-
}`,...(pe=(ge=y.parameters)==null?void 0:ge.docs)==null?void 0:pe.source}}};var me,he,ve;x.parameters={...x.parameters,docs:{...(me=x.parameters)==null?void 0:me.docs,source:{originalSource:`args => {
|
|
90
|
-
const [_, updateArgs] = useArgs();
|
|
91
|
-
const handleChange = (evt: any) => {
|
|
92
|
-
updateArgs({
|
|
93
|
-
value: evt.target.value
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
97
|
-
}`,...(ve=(he=x.parameters)==null?void 0:he.docs)==null?void 0:ve.source}}};var Ce,be,Ue;A.parameters={...A.parameters,docs:{...(Ce=A.parameters)==null?void 0:Ce.docs,source:{originalSource:`args => {
|
|
98
|
-
const [_, updateArgs] = useArgs();
|
|
99
|
-
const handleChange = (evt: any) => {
|
|
100
|
-
updateArgs({
|
|
101
|
-
value: evt.target.value
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
105
|
-
}`,...(Ue=(be=A.parameters)==null?void 0:be.docs)==null?void 0:Ue.source}}};var ye,xe,Ae;f.parameters={...f.parameters,docs:{...(ye=f.parameters)==null?void 0:ye.docs,source:{originalSource:`args => {
|
|
106
|
-
const [_, updateArgs] = useArgs();
|
|
107
|
-
const handleChange = (evt: any) => {
|
|
108
|
-
updateArgs({
|
|
109
|
-
value: evt.target.value
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
113
|
-
}`,...(Ae=(xe=f.parameters)==null?void 0:xe.docs)==null?void 0:Ae.source}}};var fe,Ie,Se;I.parameters={...I.parameters,docs:{...(fe=I.parameters)==null?void 0:fe.docs,source:{originalSource:`args => {
|
|
114
|
-
const [_, updateArgs] = useArgs();
|
|
115
|
-
const handleChange = (evt: any) => {
|
|
116
|
-
updateArgs({
|
|
117
|
-
value: evt.target.value
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
121
|
-
}`,...(Se=(Ie=I.parameters)==null?void 0:Ie.docs)==null?void 0:Se.source}}};var we,ke,je;S.parameters={...S.parameters,docs:{...(we=S.parameters)==null?void 0:we.docs,source:{originalSource:`args => {
|
|
122
|
-
const [_, updateArgs] = useArgs();
|
|
123
|
-
const handleChange = (evt: any) => {
|
|
124
|
-
updateArgs({
|
|
125
|
-
value: evt.target.value
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
129
|
-
}`,...(je=(ke=S.parameters)==null?void 0:ke.docs)==null?void 0:je.source}}};var Ve,_e,Ee;w.parameters={...w.parameters,docs:{...(Ve=w.parameters)==null?void 0:Ve.docs,source:{originalSource:`() => {
|
|
130
|
-
const width = '500px';
|
|
131
|
-
const [value, setValue] = useState<string>('1|m');
|
|
132
|
-
return <>
|
|
133
|
-
<h4>Different cases for automatic (placeholder) values:</h4>
|
|
134
|
-
<Row>
|
|
135
|
-
<Column width="25%">
|
|
136
|
-
<Button label="Change value to ''" onClick={() => setValue('')} />
|
|
137
|
-
<br />
|
|
138
|
-
<Button label="Change value to 1" onClick={() => setValue('1')} />
|
|
139
|
-
<br />
|
|
140
|
-
<Button label="Change value to 1|m" onClick={() => setValue('1|m')} />
|
|
141
|
-
<br />
|
|
142
|
-
<Button label="Change value to |m - empty value" onClick={() => setValue('|m')} />
|
|
143
|
-
</Column>
|
|
144
|
-
</Row>
|
|
145
|
-
<br />
|
|
146
|
-
<Field label="Normal PUI (only placeholder)">
|
|
147
|
-
<UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} placeholder="Placeholder test" />
|
|
148
|
-
</Field>
|
|
149
|
-
<Field label="Normal PUI (placeholder + allowEmpty)">
|
|
150
|
-
<UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} placeholder="Placeholder test" allowEmpty />
|
|
151
|
-
</Field>
|
|
152
|
-
<Message message={{
|
|
153
|
-
heading: 'Current value inside PUI: ' + value,
|
|
154
|
-
visible: true
|
|
155
|
-
}} />
|
|
156
|
-
</>;
|
|
157
|
-
}`,...(Ee=(_e=w.parameters)==null?void 0:_e.docs)==null?void 0:Ee.source}}};var Pe,Oe,De;k.parameters={...k.parameters,docs:{...(Pe=k.parameters)==null?void 0:Pe.docs,source:{originalSource:`() => {
|
|
158
|
-
const [value, setValue] = useState('123|%');
|
|
159
|
-
const [validation, setValidation] = useState<string | null>(null);
|
|
160
|
-
const predictedMessage = 'This should be visible when an error appears';
|
|
161
|
-
const handleValidation = (name: string, error: string | null) => {
|
|
162
|
-
setValidation(error);
|
|
163
|
-
return {
|
|
164
|
-
name,
|
|
165
|
-
error
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
return <>
|
|
169
|
-
<h4>3rd party validation message when inputting invalid value:</h4>
|
|
170
|
-
<UnitInput name="example" onChange={evt => setValue(evt.target.value)} error={!validation || predictedMessage} validationCallback={handleValidation} value={value} />
|
|
171
|
-
<br />
|
|
172
|
-
<Spacer />
|
|
173
|
-
<h4>Original validation message: </h4>
|
|
174
|
-
<Message message={{
|
|
175
|
-
heading: validation,
|
|
176
|
-
visible: true
|
|
177
|
-
}} />
|
|
178
|
-
</>;
|
|
179
|
-
}`,...(De=(Oe=k.parameters)==null?void 0:Oe.docs)==null?void 0:De.source}}};var Me,Ne,Be;j.parameters={...j.parameters,docs:{...(Me=j.parameters)==null?void 0:Me.docs,source:{originalSource:`() => {
|
|
180
|
-
const [value, setValue] = useState('123|m');
|
|
181
|
-
const [placeholder, setPlaceholder] = useState('');
|
|
182
|
-
const [initUnit, setInitUnit] = useState('km');
|
|
183
|
-
const setPlaceholderValue = () => {
|
|
184
|
-
setInitUnit('ft');
|
|
185
|
-
setPlaceholder('placeholder');
|
|
186
|
-
setValue('|m');
|
|
187
|
-
};
|
|
188
|
-
return <>
|
|
189
|
-
<h4>Empty value case:</h4>
|
|
190
|
-
<UnitInput name="example" onChange={evt => setValue(evt.target.value)} value={value} allowEmpty placeholder={placeholder} initUnit={initUnit} unitkey="length" />
|
|
191
|
-
<br />
|
|
192
|
-
<Spacer />
|
|
193
|
-
<Button label="Change value |m and unit ft" onClick={() => setPlaceholderValue()} />
|
|
194
|
-
</>;
|
|
195
|
-
}`,...(Be=(Ne=j.parameters)==null?void 0:Ne.docs)==null?void 0:Be.source}}};var Fe,We,Re;V.parameters={...V.parameters,docs:{...(Fe=V.parameters)==null?void 0:Fe.docs,source:{originalSource:`() => {
|
|
196
|
-
const [value, setValue] = useState('123|m');
|
|
197
|
-
const [unit, setUnit] = useState('m');
|
|
198
|
-
return <>
|
|
199
|
-
<UnitInput name="example" onChange={evt => setValue(evt.target.value)} value={value} initUnit={unit} unitkey="length" onSwitchUnit={setUnit} />
|
|
200
|
-
<Spacer />
|
|
201
|
-
<UnitInput name="example" onChange={evt => setValue(evt.target.value)} value={value} initUnit={unit} unitkey="length" onSwitchUnit={setUnit} />
|
|
202
|
-
</>;
|
|
203
|
-
}`,...(Re=(We=V.parameters)==null?void 0:We.docs)==null?void 0:Re.source}}};const ja=["Default","InitUnit","NotKnownUnit","Width","NoConversion","Small","Error","InternalValidationError","Disabled","DisabledNoConversion","DisabledUnitWithoutUnitKey","DisabledUnitWithUnitKey","DisabledWithEnabledUnitMenu","PredefinedOptionsMenu","PredefinedOptionsConverted","PredefinedOptionsWithDiffUnit","AutomaticValues","ValidationCallback","AllowEmptyPUI","OnSwitchUnit"];export{j as AllowEmptyPUI,w as AutomaticValues,E as Default,u as Disabled,U as DisabledNoConversion,x as DisabledUnitWithUnitKey,y as DisabledUnitWithoutUnitKey,A as DisabledWithEnabledUnitMenu,C as Error,g as InitUnit,b as InternalValidationError,h as NoConversion,p as NotKnownUnit,V as OnSwitchUnit,I as PredefinedOptionsConverted,f as PredefinedOptionsMenu,S as PredefinedOptionsWithDiffUnit,v as Small,k as ValidationCallback,m as Width,ja as __namedExportsOrder,ka as default};
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./jsx-runtime-eps93zm2.js";import{r as m}from"./index-DhsZuJvc.js";import{d as C}from"./index-C0x1JmaP.js";import{w as o,u as l,e as i,f as v,a as Z}from"./index-DMAnyMX5.js";import{U as c}from"./unit-input-CFaqZ7UG.js";import{B as p}from"./button-Cbv7WK6k.js";import{S as b}from"./spacer-BWoNR27H.js";import{D as tn}from"./divider-DY9nJ_7N.js";import{R as nn,C as oe}from"./row-Bmiy2Lh0.js";import{F as Y}from"./field-HrLaMLbx.js";import{M as Kt}from"./message-BRyKdRaX.js";import{G as Jt}from"./grid-DRkC-bt8.js";import{C as T}from"./card-EcjmryU9.js";import{H as f}from"./heading-CRNoBc7q.js";import{T as ne}from"./toggle-BbFVf61v.js";import{T as ae}from"./text-B3-TSWok.js";import{S as an}from"./select-Cwks-WA0.js";import{I as Yt}from"./icon-BSFY3vDO.js";import"./index-DRSy5Ssd.js";import"./index-CF7H4eMJ.js";import"./index-Bk2sglWO.js";import"./initialize-context-Y03pJPr5.js";import"./number-input-B3_gmeWr.js";import"./enum-Bnn40S8Q.js";import"./index-CEuq6vkz.js";import"./lodash-c4VUpsOs.js";import"./helpers-JJxzGegQ.js";import"./input-Db9WkmPP.js";import"./disabled-context-rmpd7YJS.js";import"./types-Dx2TtIG9.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./actions-Bax0KeqM.js";import"./common-types-Sih75Sav.js";import"./types-BmbYqTX_.js";import"./badge-CLQ59MDF.js";import"./input-group-addon-D68iUKV2.js";import"./input-group-BaRSJAEN.js";import"./spinner-AWUe4xwQ.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./label-CqmyC9he.js";import"./help-icon-Buhx5nl6.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./select.input-CJed_LLR.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";const{useArgs:rn}=__STORYBOOK_MODULE_PREVIEW_API__,ea={title:"Forms/UnitInput/Test Cases",component:c,tags:["!autodocs"],args:{name:"example",unitkey:"length",value:"123|m",testId:"unit-input"}},sn=n=>{const[a,e]=rn(),s=r=>{e({value:r.target.value})};return t.jsx(c,{...n,onChange:s})},u=sn.bind({}),w=()=>{const[n,a]=m.useState("123|m");return t.jsx(c,{name:"example",onChange:e=>a(e.target.value),placeholder:"Type a value...",value:n,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId"})};w.play=async({canvasElement:n,step:a})=>{const e=o(n),s=o(n.ownerDocument.body);await a("Shows validation error for non-numeric input",async()=>{const r=e.getByTestId("testId");await l.clear(r),await l.type(r,"123x45s6"),await i(e.getByDisplayValue("123x45s6")).toBeInTheDocument(),await i(r.getAttribute("data-error")).toEqual("Must be a numerical value"),await v.mouseOver(r),await Z(()=>{i(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};const x=()=>{const[n,a]=m.useState("|m");return t.jsx(c,{name:"example-ft",onChange:e=>a(e.target.value),placeholder:"7|ft",value:n,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId-ft"})};x.play=async({canvasElement:n,step:a})=>{const e=o(n),s=o(n.ownerDocument.body);await a("Handle input with unit only",async()=>{const r=e.getByTestId("testId-ft");await i(e.getByDisplayValue("")).toBeInTheDocument(),await i(r.getAttribute("data-error")).toBeNull(),await v.mouseOver(r),await i(r.getAttribute("data-error")).toBeNull()}),await a("Clear input and check placeholder",async()=>{const r=e.getByTestId("testId-ft");await l.clear(r),await i(r).toHaveAttribute("placeholder","2.13")}),await a("Type a correct numeric value and ensure no error",async()=>{const r=e.getByTestId("testId-ft");await l.type(r,"123"),await i(e.getByDisplayValue("123")).toBeInTheDocument(),await i(r.getAttribute("data-error")).toBeNull(),await v.mouseOver(r),await i(r.getAttribute("data-error")).toBeNull()}),await a("Remove value, type incorrect value and check for error",async()=>{const r=e.getByTestId("testId-ft");await l.clear(r),await l.type(r,"123abc"),await i(e.getByDisplayValue("123abc")).toBeInTheDocument(),await i(r.getAttribute("data-error")).toEqual("Must be a numerical value"),await v.mouseOver(r),await Z(()=>{i(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};const I=n=>{const[a,e]=m.useState("123|m"),[s,r]=m.useState("223|m"),[d,g]=m.useState("ft");return t.jsxs(t.Fragment,{children:[t.jsx(p,{label:"Change initUnit",onClick:()=>g(d==="m"?"ft":"m")}),t.jsx(b,{}),t.jsx(p,{label:"Change value",onClick:()=>e(a==="123|m"?"456|m":"123|m")}),t.jsx(b,{}),t.jsx(c,{name:"example",onChange:y=>{e(y.target.value)},unitkey:"length",value:a,initUnit:d,onSwitchUnit:g}),t.jsx(b,{}),t.jsx(c,{name:"example2",onChange:y=>{r(y.target.value)},unitkey:"length",value:s,initUnit:d,onSwitchUnit:g}),t.jsx(tn,{}),t.jsx("h4",{children:"Without initUnit property (taken from the redux store)"}),t.jsx(c,{name:"example",onChange:y=>{e(y.target.value)},unitkey:"length",value:a,onSwitchUnit:g}),t.jsx(c,{name:"example2",onChange:y=>{r(y.target.value)},unitkey:"length",value:s,onSwitchUnit:g})]})};I.parameters={docs:{description:{story:"[OW-4380](https://oliasoft.atlassian.net/browse/OW-4380?atlOrigin=eyJpIjoiMmM1N2RkNWU3Mjk5NDYxY2E0YzhkMzk5ZTVmZTJhMjciLCJwIjoiaiJ9)"}}};const B=()=>{const n="500px",[a,e]=m.useState(void 0);return t.jsxs(t.Fragment,{children:[t.jsx("h4",{children:"Different edge cases such as +/- infinity, undefined, NaN, null:"}),t.jsxs(nn,{children:[t.jsxs(oe,{width:"25%",children:[t.jsx(p,{label:"Change value infinity",onClick:()=>e(1/0)}),t.jsx("br",{}),t.jsx(p,{label:"Change value -infinity",onClick:()=>e(-1/0)}),t.jsx("br",{}),t.jsx(p,{label:"Change value null",onClick:()=>e(null)}),t.jsx("br",{}),t.jsx(p,{label:"Change value - undefined",onClick:()=>e(void 0)}),t.jsx("br",{}),t.jsx(p,{label:"Change value - NaN",onClick:()=>e(NaN)}),t.jsx("br",{}),t.jsx(p,{label:"Change value - nothing (empty)",onClick:()=>e(void 0)}),t.jsx("br",{}),t.jsx(p,{label:"Change value - empty string",onClick:()=>e("")})]}),t.jsxs(oe,{width:"25%",children:[t.jsx(p,{label:"Change value infinity|m",onClick:()=>e("Infinity|m")}),t.jsx("br",{}),t.jsx(p,{label:"Change value -infinity|m",onClick:()=>e("-Infinity|m")}),t.jsx("br",{}),t.jsx(p,{label:"Change value null|m",onClick:()=>e("null|m")}),t.jsx("br",{}),t.jsx(p,{label:"Change value - undefined|m",onClick:()=>e("undefined|m")}),t.jsx("br",{}),t.jsx(p,{label:"Change value - NaN|m",onClick:()=>e("NaN|m")}),t.jsx("br",{}),t.jsx(p,{label:"Change value - nothing (empty)|m",onClick:()=>e("|m")})]})]}),t.jsx("br",{}),t.jsx(Y,{label:"Normal PUI",children:t.jsx(c,{name:"example1",onChange:s=>e(s.target.value),value:a,unitkey:"length",width:n,placeholder:"value|unit"})}),t.jsx(Y,{label:"Disabled validation",children:t.jsx(c,{name:"example2",onChange:s=>e(s.target.value),value:a,unitkey:"length",disabledValidation:!0,width:n})}),t.jsx(Y,{label:"Disabled validation and manual error",children:t.jsx(c,{name:"example3",onChange:s=>e(s.target.value),value:a,unitkey:"length",error:"test",disabledValidation:!0,width:n})}),t.jsx(Kt,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})};B.parameters={docs:{description:{story:"[OW-8884](https://oliasoft.atlassian.net/browse/OW-8884)"}}};const Q=()=>{const[n,a]=m.useState(!0),e=()=>{a(!1),setTimeout(()=>a(!0),0)},[s,r]=m.useState("123|ft");return t.jsxs(Jt,{columns:"1fr 1fr",gap:!0,children:[t.jsxs(T,{heading:t.jsx(f,{children:"Storage State (Redux)"}),children:[s,t.jsx(b,{}),t.jsx(p,{label:"Change value",onClick:()=>r(C.withUnit(String(Math.floor(Math.random()*100)),"ft"))})]}),t.jsx(T,{heading:t.jsx(f,{icon:t.jsx(Yt,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:e,children:"UnitInput"}),children:n&&t.jsx(c,{name:"example",onChange:d=>r(d.target.value),value:s,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"}})})]})},X=()=>t.jsxs(t.Fragment,{children:[t.jsx(ae,{faint:!0,children:"Reproduce OW-10614 rounding noise bug when storing values in a different unit to the display unit"}),t.jsx(b,{}),t.jsx(c,{name:"example",onChange:()=>{},value:C.withUnit(C.convertAndGetValue("9750|psi","bar"),"bar"),initUnit:"psi",unitkey:"pressure",unitTemplate:{pressure:"psi"}}),t.jsx(b,{}),t.jsx(c,{name:"example2",onChange:()=>{},value:C.withUnit(C.convertAndGetValue("8642|lbf","tonneForce"),"tonneForce"),initUnit:"lbf",unitkey:"force",unitTemplate:{force:"tonneForce"}})]}),k=()=>t.jsxs(t.Fragment,{children:[t.jsx(c,{name:"example",unitkey:"moleWeight",initUnit:"g/mol",noConversion:!0,value:"170|g/mol",unitTemplate:{moleWeight:"g/mol"},testId:"case1"}),t.jsx(b,{}),t.jsx(c,{name:"gor",unitkey:"moleWeight",initUnit:"gor",value:"Infinity|SCF/STB",testId:"case2"})]});k.play=async({canvasElement:n,step:a})=>{const e=o(n);await a("Can enter decimal values",async()=>{await i(e.getByDisplayValue("170")).toBeInTheDocument(),await i(e.getByDisplayValue("")).toBeInTheDocument()})};const $=()=>{const[n,a]=m.useState(!0),e=()=>{a(!1),setTimeout(()=>a(!0),0)},[s,r]=m.useState("psi"),[d,g]=m.useState(!1),[y,Xt]=m.useState(!0),[re,$t]=m.useState(!0),[te,ie]=m.useState("672.2388357750001|bar"),[se,en]=m.useState("");return t.jsxs(Jt,{columns:"1fr 1fr",gap:!0,children:[t.jsxs(T,{heading:t.jsx(f,{children:"Settings"}),children:[t.jsx(Y,{label:"Enable display rounding:",labelLeft:!0,labelWidth:200,children:t.jsx(ne,{checked:d,onChange:h=>g(h.target.checked)})}),t.jsx(Y,{label:"Enable cosmetic rounding:",labelLeft:!0,labelWidth:200,children:t.jsx(ne,{checked:y,onChange:h=>Xt(h.target.checked)})}),t.jsx(Y,{label:"Convert back to storage unit (onChange):",labelLeft:!0,labelWidth:200,children:t.jsx(ne,{checked:re,onChange:h=>$t(h.target.checked)})})]}),t.jsxs(T,{heading:t.jsx(f,{icon:t.jsx(Yt,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:e,children:"UnitInput"}),children:[t.jsx(ae,{faint:!0,children:"Cosmetic Rounding Test Case: type 9750 then return (compare with enableCosmeticRounding on and off)"}),t.jsx(b,{}),t.jsx(ae,{warning:!0,children:"Note: UnitInput uses convertSamePrecision internally (decision prior to cosmetic value implementation). This means not all rounding noise occurrences seen in NumberInput will be reproducible in UnitInput, because they get rounded off by other logic."}),t.jsx(b,{}),n&&t.jsx(c,{name:"Example",unitkey:"pressure",initUnit:s,unitTemplate:{pressure:"psi"},value:te,onChange:h=>{const{value:ee}=h.target;ee&&ie(ee)},enableDisplayRounding:d,enableCosmeticRounding:y,error:C.convertAndGetValue(te,"bar")>=0?"":"Value must be positive",validationCallback:(h,ee)=>{en(ee??"")},convertBackToStorageUnit:re})]}),t.jsx(T,{heading:t.jsx(f,{children:"Unit Template"}),children:t.jsx(an,{options:[{label:"Bar",value:"bar"},{label:"psi",value:"psi"}],value:s,width:70,onChange:h=>r(h.target.value)})}),t.jsx(T,{heading:t.jsx(f,{children:"Test Validation Callback"}),children:se&&t.jsx(Kt,{message:{content:se,icon:!0,type:"Error",visible:!0}})}),t.jsxs(T,{heading:t.jsx(f,{children:"Storage State / Redux"}),children:[te,t.jsx(b,{}),t.jsx(p,{label:"Change value",onClick:()=>ie(C.withUnit(String(Math.floor(Math.random()*100)),"bar"))})]})]})},S=()=>{const[n,a]=m.useState("123|m");return t.jsx(c,{name:"example",onChange:e=>a(e.target.value),value:n,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId"})};S.play=async({canvasElement:n,step:a})=>{const e=o(n),s=o(n.ownerDocument.body);await a("Can enter decimal values",async()=>{const r=e.getByTestId("testId");await l.clear(r),await l.type(r,"123.123456789"),await i(e.getByDisplayValue("123.123456789")).toBeInTheDocument()}),await a("Can enter scientific notation",async()=>{const r=e.getByTestId("testId");await l.clear(r),await l.type(r,"-1.12e3"),await i(e.getByDisplayValue("-1.12e3")).toBeInTheDocument()}),await a("Can enter comma decimals (converts to dot)",async()=>{const r=e.getByTestId("testId");await l.clear(r),await l.type(r,"123,456"),await i(e.getByDisplayValue("123.456")).toBeInTheDocument()}),await a("Can enter small numbers",async()=>{const r=e.getByTestId("testId");await l.clear(r),await l.type(r,"0.0000000023"),await i(e.getByDisplayValue("0.0000000023")).toBeInTheDocument()}),await a("Can enter large numbers",async()=>{const r=e.getByTestId("testId");await l.clear(r),await l.type(r,"999999999999"),await i(e.getByDisplayValue("999999999999")).toBeInTheDocument()}),await a("Can convert units",async()=>{const r=e.getByTestId("testId"),d=e.getByTestId("testId-menu");await l.clear(r),await l.type(r,"456.1"),await l.click(d),await l.click(s.getByTestId("testId-unit-ft")),await i(e.getByDisplayValue("1496")).toBeInTheDocument()}),await a("Shows validation error for non-numeric input",async()=>{const r=e.getByTestId("testId");await l.clear(r),await l.type(r,"123x45s6"),await i(e.getByDisplayValue("123x45s6")).toBeInTheDocument(),await i(r.getAttribute("data-error")).toEqual("Must be a numerical value"),await v.mouseOver(r),await Z(()=>{i(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};const U=u.bind({});U.args={disabled:!0};U.play=async({canvasElement:n})=>{const e=o(n).getByRole("textbox");i(e).toBeDisabled()};const D=u.bind({});D.args={disabledUnit:!0};D.play=async({canvasElement:n})=>{const e=o(n).queryByTestId("unit-input-menu");i(e).toBeInTheDocument();const s=o(e).queryByRole("button");i(s).toBeDisabled()};const j=u.bind({});j.args={error:"Own Error message"};j.play=async({canvasElement:n})=>{const e=o(n).getByTestId("unit-input"),s=o(n.ownerDocument.body);await v.mouseOver(e),await Z(()=>{i(s.getByText("Own Error message")).toBeInTheDocument()})};const V=u.bind({});V.args={left:!0};V.play=async({canvasElement:n})=>{const e=o(n).getByTestId("unit-input");i(e).not.toHaveStyle("text-align: right")};const O=u.bind({});O.args={small:!0};O.play=async({canvasElement:n})=>{const e=o(n).getByTestId("unit-input");i(e).toHaveClass("_small_rhzw6_124")};const R=u.bind({});R.args={width:"250px"};R.play=async({canvasElement:n})=>{const{body:a}=n.ownerDocument,e=a.querySelectorAll("*"),s=Array.from(e).some(r=>window.getComputedStyle(r).width==="250px");i(s).toBe(!0)};const P=u.bind({});P.args={value:"456|ft",initUnit:"ft"};P.play=async({canvasElement:n})=>{const e=o(n).getByRole("textbox");i(e).toHaveValue("456")};const E=u.bind({});E.args={value:"10|kg",unitkey:"weight"};E.play=async({canvasElement:n})=>{const e=o(n).getByRole("button");await l.click(e);const s=n.ownerDocument.body;i(o(s).getByText("t")).toBeInTheDocument(),i(o(s).getByText("lbf")).toBeInTheDocument(),i(o(s).getByText("mt")).toBeInTheDocument(),i(o(s).getByText("kip")).toBeInTheDocument(),i(o(s).getByText("N")).toBeInTheDocument()};const N=u.bind({});N.args={initUnit:"ft"};N.play=async({canvasElement:n})=>{const a=o(n),e=a.getByRole("textbox");i(e).toHaveValue("404");const s=a.getByRole("button");i(s).toHaveTextContent("ft")};const q=u.bind({});q.args={noConversion:!0};q.play=async({canvasElement:n})=>{const a=n.querySelector("._addon_b4w53_1._groupOrderLast_b4w53_21");i(a).toBeInTheDocument(),i(a).toHaveTextContent("m")};const _=u.bind({});_.args={warning:"Warning message"};_.play=async({canvasElement:n})=>{const e=o(n).getByTestId("unit-input"),s=o(n.ownerDocument.body);await v.mouseOver(e),await Z(()=>{i(s.getByText("Warning message")).toBeInTheDocument()})};const W=u.bind({});W.args={predefinedOptions:[{label:"Option 1",value:"10|m"},{label:"Option 2",value:"20|m"}]};W.play=async({canvasElement:n})=>{const e=o(n).queryByTestId("unit-input-predefined-menu");i(e).toBeInTheDocument();const s=o(e).queryByRole("button");await l.click(s);const r=n.ownerDocument.body;i(o(r).getByText("Custom")).toBeInTheDocument(),i(o(r).getByText("Option 1")).toBeInTheDocument(),i(o(r).getByText("Option 2")).toBeInTheDocument()};const M=u.bind({});M.args={predefinedOptions:[{label:"Option 1",value:"10|m"},{label:"Option 2",value:"20|m"}],initialPredefinedOption:"20|m"};M.play=async({canvasElement:n})=>{const a=o(n),e=a.queryByTestId("unit-input-predefined-menu");i(e).toBeInTheDocument();const s=o(e).queryByRole("button");await l.click(s);const r=n.ownerDocument.body,d=o(r).getByText("Option 2");i(d).toBeInTheDocument();const g=a.getByRole("textbox");i(g).toHaveValue("20")};const H=u.bind({});H.args={unitkey:"length",unitTemplate:{length:"ft"},predefinedOptions:[{label:"Option 1",value:"10|m"},{label:"Option 2",value:"20|m"}]};H.play=async({canvasElement:n})=>{const e=o(n).queryByTestId("unit-input-predefined-menu");i(e).toBeInTheDocument();const s=o(e).queryByRole("button");await l.click(s);const r=n.ownerDocument.body;i(o(r).getByText("32.8 ft")).toBeInTheDocument(),i(o(r).getByText("65.6 ft")).toBeInTheDocument()};const F=u.bind({});F.args={unitkey:"length",unitTemplate:{length:"m"},predefinedOptions:[{label:"Option 1",value:"10|m"},{label:"Option 2",value:"20|m"},{label:"Option 3",value:"12|%",unitkey:"percentage",linked:!0}]};F.play=async({canvasElement:n})=>{const a=o(n),e=a.queryByTestId("unit-input-predefined-menu");i(e).toBeInTheDocument();const s=o(e).queryByRole("button");await l.click(s);const r=n.ownerDocument.body;i(o(r).getByText("10 m")).toBeInTheDocument(),i(o(r).getByText("20 m")).toBeInTheDocument(),i(o(r).getByText("12 %")).toBeInTheDocument();const d=o(r).getByText("Option 3");i(d).toBeInTheDocument(),await l.click(d);const g=a.getByRole("textbox");i(g).toHaveValue("123")};const A=u.bind({});let Zt={};A.args={validationCallback:(n,a)=>(Zt={name:n,error:a},{name:n,error:a})};A.play=async({canvasElement:n})=>{const e=o(n).getByRole("textbox"),s=o(n.ownerDocument.body);await l.clear(e),await l.type(e,"123asd");const r=n.querySelector("body");await l.click(r),i(Zt).toEqual({name:"example",error:"Must be a numerical value"}),await v.mouseOver(e),await Z(()=>{i(s.getByText("Must be a numerical value")).toBeInTheDocument()})};const L=u.bind({});L.args={disabledValidation:!0};L.play=async({canvasElement:n})=>{const e=o(n).getByRole("textbox");o(n.ownerDocument.body),await l.clear(e),await l.type(e,"123asd"),await v.mouseOver(e),await i(e.getAttribute("data-error")).toBeNull()};const G=u.bind({});G.args={allowEmpty:!0,value:"|m"};G.play=async({canvasElement:n})=>{const e=o(n).getByRole("textbox");i(e).toHaveValue("")};const z=u.bind({});let Qt="";z.args={onSwitchUnit:n=>{Qt=n}};z.play=async({canvasElement:n})=>{const a=o(n),e=a.getByRole("textbox"),s=a.getByRole("button");await l.click(s);const r=n.ownerDocument.body,d=o(r).getByText("km");await l.click(d),i(e).toHaveValue("0.123"),i(Qt).toEqual("km")};const K=u.bind({});K.args={unitTemplate:{length:"ft"}};K.play=async({canvasElement:n})=>{const a=o(n),e=a.getByRole("textbox"),s=a.getByRole("button");i(s).toHaveTextContent("ft"),i(e).toHaveValue("404")};const J=u.bind({});J.args={unitkey:void 0,value:'77|"'};J.play=async({canvasElement:n})=>{const a=o(n),e=a.getByTestId("unit-input");await l.clear(e),await l.type(e,"22"),await i(a.getByDisplayValue("22")).toBeInTheDocument(),await i(e.getAttribute("data-error")).toBeNull()};w.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"Placeholder"};x.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"PlaceholderWithUnit"};I.__docgenInfo={description:"",methods:[],displayName:"TestExternalStateChangeWithSynchronizedUnits",props:{name:{required:!0,tsType:{name:"union",raw:"string | { fieldName?: string }",elements:[{name:"string"},{name:"signature",type:"object",raw:"{ fieldName?: string }",signature:{properties:[{key:"fieldName",value:{name:"string",required:!1}}]}}]},description:""},placeholder:{required:!1,tsType:{name:"string"},description:""},disabled:{required:!1,tsType:{name:"boolean"},description:""},disabledUnit:{required:!1,tsType:{name:"boolean"},description:""},error:{required:!1,tsType:{name:"union",raw:"string | null | boolean",elements:[{name:"string"},{name:"null"},{name:"boolean"}]},description:""},left:{required:!1,tsType:{name:"boolean"},description:""},small:{required:!1,tsType:{name:"boolean"},description:""},width:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},value:{required:!1,tsType:{name:"string"},description:""},unitkey:{required:!1,tsType:{name:"string"},description:""},initUnit:{required:!1,tsType:{name:"string"},description:""},noConversion:{required:!1,tsType:{name:"boolean"},description:""},testId:{required:!1,tsType:{name:"string"},description:""},warning:{required:!1,tsType:{name:"union",raw:"string | boolean | null",elements:[{name:"string"},{name:"boolean"},{name:"null"}]},description:""},predefinedOptions:{required:!1,tsType:{name:"union",raw:"IPredefinedOption[] | null",elements:[{name:"Array",elements:[{name:"IPredefinedOption"}],raw:"IPredefinedOption[]"},{name:"null"}]},description:""},initialPredefinedOption:{required:!1,tsType:{name:"string"},description:""},validationCallback:{required:!1,tsType:{name:"signature",type:"function",raw:"(name: string, error: string | null) => any",signature:{arguments:[{type:{name:"string"},name:"name"},{type:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},name:"error"}],return:{name:"any"}}},description:""},disabledValidation:{required:!1,tsType:{name:"boolean"},description:""},allowEmpty:{required:!1,tsType:{name:"boolean"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(evt: TOnChangeEvent) => void",signature:{arguments:[{type:{name:"signature",type:"object",raw:"{ target: TOnChangeEventTarget }",signature:{properties:[{key:"target",value:{name:"union",raw:`| TOnChangeEventBaseTarget
|
|
2
|
-
| (TOnChangeEventBaseTarget & {
|
|
3
|
-
predefinedSelected: boolean;
|
|
4
|
-
predefinedOption: IPredefinedOption;
|
|
5
|
-
})`,elements:[{name:"signature",type:"object",raw:"{ name: string; value: string }",signature:{properties:[{key:"name",value:{name:"string",required:!0}},{key:"value",value:{name:"string",required:!0}}]}},{name:"unknown"}],required:!0}}]}},name:"evt"}],return:{name:"void"}}},description:""},onSwitchUnit:{required:!1,tsType:{name:"signature",type:"function",raw:"(unit: string) => void",signature:{arguments:[{type:{name:"string"},name:"unit"}],return:{name:"void"}}},description:""},onClick:{required:!1,tsType:{name:"MouseEventHandler",elements:[{name:"HTMLInputElement"}],raw:"MouseEventHandler<HTMLInputElement>"},description:""},onFocus:{required:!1,tsType:{name:"FocusEventHandler",elements:[{name:"HTMLInputElement"}],raw:"FocusEventHandler<HTMLInputElement>"},description:""},unitTemplate:{required:!1,tsType:{name:"Record",elements:[{name:"string"},{name:"any"}],raw:"Record<string, any>"},description:""},convertBackToStorageUnit:{required:!1,tsType:{name:"boolean"},description:""},enableCosmeticRounding:{required:!1,tsType:{name:"boolean"},description:""},enableDisplayRounding:{required:!1,tsType:{name:"boolean"},description:""}}};B.__docgenInfo={description:"",methods:[],displayName:"TestEdgeCases"};Q.__docgenInfo={description:"",methods:[],displayName:"ManagedTestCase"};X.__docgenInfo={description:"",methods:[],displayName:"OW_10614TestCase"};k.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"OW_17784TestCase"};$.__docgenInfo={description:"",methods:[],displayName:"DemoCosmeticRounding"};S.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"TestUserInput"};var le,ue,ce;u.parameters={...u.parameters,docs:{...(le=u.parameters)==null?void 0:le.docs,source:{originalSource:`args => {
|
|
6
|
-
const [_, updateArgs] = useArgs();
|
|
7
|
-
const handleChange = (evt: any) => {
|
|
8
|
-
updateArgs({
|
|
9
|
-
value: evt.target.value
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
13
|
-
}`,...(ce=(ue=u.parameters)==null?void 0:ue.docs)==null?void 0:ce.source}}};var de,pe,me;w.parameters={...w.parameters,docs:{...(de=w.parameters)==null?void 0:de.docs,source:{originalSource:`() => {
|
|
14
|
-
const [value, setValue] = useState('123|m');
|
|
15
|
-
return <UnitInput name="example" onChange={evt => setValue(evt.target.value)} placeholder="Type a value..." value={value} initUnit="m" unitkey="depth" unitTemplate={{
|
|
16
|
-
depth: 'm'
|
|
17
|
-
}} testId="testId" />;
|
|
18
|
-
}`,...(me=(pe=w.parameters)==null?void 0:pe.docs)==null?void 0:me.source}}};var ge,ye,he;x.parameters={...x.parameters,docs:{...(ge=x.parameters)==null?void 0:ge.docs,source:{originalSource:`() => {
|
|
19
|
-
const [value, setValue] = useState('|m');
|
|
20
|
-
return <UnitInput name="example-ft" onChange={evt => setValue(evt.target.value)} placeholder="7|ft" value={value} initUnit="m" unitkey="depth" unitTemplate={{
|
|
21
|
-
depth: 'm'
|
|
22
|
-
}} testId="testId-ft" />;
|
|
23
|
-
}`,...(he=(ye=x.parameters)==null?void 0:ye.docs)==null?void 0:he.source}}};var be,ve,Te;I.parameters={...I.parameters,docs:{...(be=I.parameters)==null?void 0:be.docs,source:{originalSource:`(args: IUnitInputProps) => {
|
|
24
|
-
const [value, setValue] = useState('123|m');
|
|
25
|
-
const [value2, setValue2] = useState('223|m');
|
|
26
|
-
const [initUnit, setInitUnit] = useState('ft');
|
|
27
|
-
return <>
|
|
28
|
-
<Button label="Change initUnit" onClick={() => setInitUnit(initUnit === 'm' ? 'ft' : 'm')} />
|
|
29
|
-
<Spacer />
|
|
30
|
-
<Button label="Change value" onClick={() => setValue(value === '123|m' ? '456|m' : '123|m')} />
|
|
31
|
-
<Spacer />
|
|
32
|
-
<UnitInput name="example" onChange={evt => {
|
|
33
|
-
setValue(evt.target.value);
|
|
34
|
-
}} unitkey="length" value={value} initUnit={initUnit} onSwitchUnit={setInitUnit} />
|
|
35
|
-
<Spacer />
|
|
36
|
-
<UnitInput name="example2" onChange={evt => {
|
|
37
|
-
setValue2(evt.target.value);
|
|
38
|
-
}} unitkey="length" value={value2} initUnit={initUnit} onSwitchUnit={setInitUnit} />
|
|
39
|
-
<Divider />
|
|
40
|
-
<h4>Without initUnit property (taken from the redux store)</h4>
|
|
41
|
-
<UnitInput name="example" onChange={evt => {
|
|
42
|
-
setValue(evt.target.value);
|
|
43
|
-
}} unitkey="length" value={value} onSwitchUnit={setInitUnit} />
|
|
44
|
-
<UnitInput name="example2" onChange={evt => {
|
|
45
|
-
setValue2(evt.target.value);
|
|
46
|
-
}} unitkey="length" value={value2} onSwitchUnit={setInitUnit} />
|
|
47
|
-
</>;
|
|
48
|
-
}`,...(Te=(ve=I.parameters)==null?void 0:ve.docs)==null?void 0:Te.source}}};var fe,Ce,we;B.parameters={...B.parameters,docs:{...(fe=B.parameters)==null?void 0:fe.docs,source:{originalSource:`() => {
|
|
49
|
-
const width = '500px';
|
|
50
|
-
const [value, setValue] = useState<any>(undefined);
|
|
51
|
-
return <>
|
|
52
|
-
<h4>Different edge cases such as +/- infinity, undefined, NaN, null:</h4>
|
|
53
|
-
<Row>
|
|
54
|
-
<Column width="25%">
|
|
55
|
-
<Button label="Change value infinity" onClick={() => setValue(Infinity)} />
|
|
56
|
-
<br />
|
|
57
|
-
<Button label="Change value -infinity" onClick={() => setValue(-Infinity)} />
|
|
58
|
-
<br />
|
|
59
|
-
<Button label="Change value null" onClick={() => setValue(null)} />
|
|
60
|
-
<br />
|
|
61
|
-
<Button label="Change value - undefined" onClick={() => setValue(undefined)} />
|
|
62
|
-
<br />
|
|
63
|
-
<Button label="Change value - NaN" onClick={() => setValue(NaN)} />
|
|
64
|
-
<br />
|
|
65
|
-
<Button label="Change value - nothing (empty)" onClick={() => setValue(undefined)} />
|
|
66
|
-
<br />
|
|
67
|
-
<Button label="Change value - empty string" onClick={() => setValue('')} />
|
|
68
|
-
</Column>
|
|
69
|
-
<Column width="25%">
|
|
70
|
-
<Button label="Change value infinity|m" onClick={() => setValue(Infinity + '|m')} />
|
|
71
|
-
<br />
|
|
72
|
-
<Button label="Change value -infinity|m" onClick={() => setValue(-Infinity + '|m')} />
|
|
73
|
-
<br />
|
|
74
|
-
<Button label="Change value null|m" onClick={() => setValue(null + '|m')} />
|
|
75
|
-
<br />
|
|
76
|
-
<Button label="Change value - undefined|m" onClick={() => setValue(undefined + '|m')} />
|
|
77
|
-
<br />
|
|
78
|
-
<Button label="Change value - NaN|m" onClick={() => setValue(NaN + '|m')} />
|
|
79
|
-
<br />
|
|
80
|
-
<Button label="Change value - nothing (empty)|m" onClick={() => setValue('|m')} />
|
|
81
|
-
</Column>
|
|
82
|
-
</Row>
|
|
83
|
-
<br />
|
|
84
|
-
<Field label="Normal PUI">
|
|
85
|
-
<UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} placeholder="value|unit" />
|
|
86
|
-
</Field>
|
|
87
|
-
<Field label="Disabled validation">
|
|
88
|
-
<UnitInput name="example2" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" disabledValidation width={width} />
|
|
89
|
-
</Field>
|
|
90
|
-
<Field label="Disabled validation and manual error">
|
|
91
|
-
<UnitInput name="example3" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" error="test" disabledValidation width={width} />
|
|
92
|
-
</Field>
|
|
93
|
-
<Message message={{
|
|
94
|
-
heading: 'Current value inside PUI: ' + value,
|
|
95
|
-
visible: true
|
|
96
|
-
}} />
|
|
97
|
-
</>;
|
|
98
|
-
}`,...(we=(Ce=B.parameters)==null?void 0:Ce.docs)==null?void 0:we.source}}};var xe,Ie,Be;Q.parameters={...Q.parameters,docs:{...(xe=Q.parameters)==null?void 0:xe.docs,source:{originalSource:`() => {
|
|
99
|
-
const [visible, setVisible] = useState(true);
|
|
100
|
-
const triggerRerender = () => {
|
|
101
|
-
setVisible(false);
|
|
102
|
-
setTimeout(() => setVisible(true), 0);
|
|
103
|
-
};
|
|
104
|
-
const [value, setValue] = useState('123|ft');
|
|
105
|
-
return <Grid columns="1fr 1fr" gap>
|
|
106
|
-
<Card heading={<Heading>Storage State (Redux)</Heading>}>
|
|
107
|
-
{value}
|
|
108
|
-
<Spacer />
|
|
109
|
-
<Button label="Change value" onClick={() => setValue(withUnit(String(Math.floor(Math.random() * 100)), 'ft'))} />
|
|
110
|
-
</Card>
|
|
111
|
-
<Card heading={<Heading icon={<Icon icon="refresh" testId="triggerRerenderTestId" />} onIconClick={triggerRerender}>
|
|
112
|
-
UnitInput
|
|
113
|
-
</Heading>}>
|
|
114
|
-
{visible && <UnitInput name="example" onChange={evt => setValue(evt.target.value)} value={value} initUnit="m" unitkey="depth" unitTemplate={{
|
|
115
|
-
depth: 'm'
|
|
116
|
-
}} />}
|
|
117
|
-
</Card>
|
|
118
|
-
</Grid>;
|
|
119
|
-
}`,...(Be=(Ie=Q.parameters)==null?void 0:Ie.docs)==null?void 0:Be.source}}};var ke,Se,Ue;X.parameters={...X.parameters,docs:{...(ke=X.parameters)==null?void 0:ke.docs,source:{originalSource:`() => {
|
|
120
|
-
return <>
|
|
121
|
-
<Text faint>
|
|
122
|
-
Reproduce OW-10614 rounding noise bug when storing values in a different
|
|
123
|
-
unit to the display unit
|
|
124
|
-
</Text>
|
|
125
|
-
<Spacer />
|
|
126
|
-
<UnitInput name="example" onChange={() => {}} value={withUnit(convertAndGetValue('9750|psi', 'bar'), 'bar')} initUnit="psi" unitkey="pressure" unitTemplate={{
|
|
127
|
-
pressure: 'psi'
|
|
128
|
-
}} />
|
|
129
|
-
<Spacer />
|
|
130
|
-
<UnitInput name="example2" onChange={() => {}} value={withUnit(convertAndGetValue('8642|lbf', 'tonneForce'), 'tonneForce')} initUnit="lbf" unitkey="force" unitTemplate={{
|
|
131
|
-
force: 'tonneForce'
|
|
132
|
-
}} />
|
|
133
|
-
</>;
|
|
134
|
-
}`,...(Ue=(Se=X.parameters)==null?void 0:Se.docs)==null?void 0:Ue.source}}};var De,je,Ve;k.parameters={...k.parameters,docs:{...(De=k.parameters)==null?void 0:De.docs,source:{originalSource:`() => {
|
|
135
|
-
return <>
|
|
136
|
-
<UnitInput name="example" unitkey="moleWeight" initUnit="g/mol" noConversion //reproduces OW_17784
|
|
137
|
-
value="170|g/mol" unitTemplate={{
|
|
138
|
-
moleWeight: 'g/mol'
|
|
139
|
-
}} testId="case1" />
|
|
140
|
-
<Spacer />
|
|
141
|
-
<UnitInput name="gor" unitkey="moleWeight" initUnit="gor" value="Infinity|SCF/STB" testId="case2" />
|
|
142
|
-
</>;
|
|
143
|
-
}`,...(Ve=(je=k.parameters)==null?void 0:je.docs)==null?void 0:Ve.source}}};var Oe,Re,Pe;$.parameters={...$.parameters,docs:{...(Oe=$.parameters)==null?void 0:Oe.docs,source:{originalSource:`() => {
|
|
144
|
-
const [visible, setVisible] = useState(true);
|
|
145
|
-
const triggerRerender = () => {
|
|
146
|
-
setVisible(false);
|
|
147
|
-
setTimeout(() => setVisible(true), 0);
|
|
148
|
-
};
|
|
149
|
-
const [preferredUnit, setPreferredUnit] = useState('psi');
|
|
150
|
-
const [enableDisplayRounding, setEnableDisplayRounding] = useState(false);
|
|
151
|
-
const [enableCosmeticRounding, setEnableCosmeticRounding] = useState(true);
|
|
152
|
-
const [convertBackToStorageUnit, setConvertBackToStorageUnit] = useState(true);
|
|
153
|
-
const [value, setValue] = useState('672.2388357750001|bar');
|
|
154
|
-
const [callBackError, setCallBackError] = useState('');
|
|
155
|
-
return <Grid columns="1fr 1fr" gap>
|
|
156
|
-
<Card heading={<Heading>Settings</Heading>}>
|
|
157
|
-
<Field label="Enable display rounding:" labelLeft labelWidth={200}>
|
|
158
|
-
<Toggle checked={enableDisplayRounding} onChange={evt => setEnableDisplayRounding(evt.target.checked)} />
|
|
159
|
-
</Field>
|
|
160
|
-
<Field label="Enable cosmetic rounding:" labelLeft labelWidth={200}>
|
|
161
|
-
<Toggle checked={enableCosmeticRounding} onChange={evt => setEnableCosmeticRounding(evt.target.checked)} />
|
|
162
|
-
</Field>
|
|
163
|
-
<Field label="Convert back to storage unit (onChange):" labelLeft labelWidth={200}>
|
|
164
|
-
<Toggle checked={convertBackToStorageUnit} onChange={evt => setConvertBackToStorageUnit(evt.target.checked)} />
|
|
165
|
-
</Field>
|
|
166
|
-
</Card>
|
|
167
|
-
<Card heading={<Heading icon={<Icon icon="refresh" testId="triggerRerenderTestId" />} onIconClick={triggerRerender}>
|
|
168
|
-
UnitInput
|
|
169
|
-
</Heading>}>
|
|
170
|
-
<Text faint>
|
|
171
|
-
Cosmetic Rounding Test Case: type 9750 then return (compare with
|
|
172
|
-
enableCosmeticRounding on and off)
|
|
173
|
-
</Text>
|
|
174
|
-
<Spacer />
|
|
175
|
-
<Text warning>
|
|
176
|
-
Note: UnitInput uses convertSamePrecision internally (decision prior
|
|
177
|
-
to cosmetic value implementation). This means not all rounding noise
|
|
178
|
-
occurrences seen in NumberInput will be reproducible in UnitInput,
|
|
179
|
-
because they get rounded off by other logic.
|
|
180
|
-
</Text>
|
|
181
|
-
<Spacer />
|
|
182
|
-
{visible && <UnitInput name="Example" unitkey="pressure" initUnit={preferredUnit} unitTemplate={{
|
|
183
|
-
pressure: 'psi'
|
|
184
|
-
}} value={value} onChange={evt => {
|
|
185
|
-
const {
|
|
186
|
-
value
|
|
187
|
-
} = evt.target;
|
|
188
|
-
if (value) {
|
|
189
|
-
setValue(value);
|
|
190
|
-
}
|
|
191
|
-
}} enableDisplayRounding={enableDisplayRounding} enableCosmeticRounding={enableCosmeticRounding} error={convertAndGetValue(value, 'bar') >= 0 ? '' : 'Value must be positive'} validationCallback={(name, error) => {
|
|
192
|
-
setCallBackError(error ?? '');
|
|
193
|
-
}} convertBackToStorageUnit={convertBackToStorageUnit} />}
|
|
194
|
-
</Card>
|
|
195
|
-
<Card heading={<Heading>Unit Template</Heading>}>
|
|
196
|
-
<Select options={[{
|
|
197
|
-
label: 'Bar',
|
|
198
|
-
value: 'bar'
|
|
199
|
-
}, {
|
|
200
|
-
label: 'psi',
|
|
201
|
-
value: 'psi'
|
|
202
|
-
}]} value={preferredUnit} width={70} onChange={evt => setPreferredUnit(evt.target.value)} />
|
|
203
|
-
</Card>
|
|
204
|
-
<Card heading={<Heading>Test Validation Callback</Heading>}>
|
|
205
|
-
{callBackError && <Message message={{
|
|
206
|
-
content: callBackError,
|
|
207
|
-
icon: true,
|
|
208
|
-
type: 'Error',
|
|
209
|
-
visible: true
|
|
210
|
-
}} />}
|
|
211
|
-
</Card>
|
|
212
|
-
<Card heading={<Heading>Storage State / Redux</Heading>}>
|
|
213
|
-
{value}
|
|
214
|
-
<Spacer />
|
|
215
|
-
<Button label="Change value" onClick={() => setValue(withUnit(String(Math.floor(Math.random() * 100)), 'bar'))} />
|
|
216
|
-
</Card>
|
|
217
|
-
</Grid>;
|
|
218
|
-
}`,...(Pe=(Re=$.parameters)==null?void 0:Re.docs)==null?void 0:Pe.source}}};var Ee,Ne,qe;S.parameters={...S.parameters,docs:{...(Ee=S.parameters)==null?void 0:Ee.docs,source:{originalSource:`() => {
|
|
219
|
-
const [value, setValue] = useState('123|m');
|
|
220
|
-
return <UnitInput name="example" onChange={evt => setValue(evt.target.value)} value={value} initUnit="m" unitkey="depth" unitTemplate={{
|
|
221
|
-
depth: 'm'
|
|
222
|
-
}} testId="testId" />;
|
|
223
|
-
}`,...(qe=(Ne=S.parameters)==null?void 0:Ne.docs)==null?void 0:qe.source}}};var _e,We,Me;U.parameters={...U.parameters,docs:{...(_e=U.parameters)==null?void 0:_e.docs,source:{originalSource:"Template.bind({})",...(Me=(We=U.parameters)==null?void 0:We.docs)==null?void 0:Me.source}}};var He,Fe,Ae;D.parameters={...D.parameters,docs:{...(He=D.parameters)==null?void 0:He.docs,source:{originalSource:"Template.bind({})",...(Ae=(Fe=D.parameters)==null?void 0:Fe.docs)==null?void 0:Ae.source}}};var Le,Ge,ze;j.parameters={...j.parameters,docs:{...(Le=j.parameters)==null?void 0:Le.docs,source:{originalSource:"Template.bind({})",...(ze=(Ge=j.parameters)==null?void 0:Ge.docs)==null?void 0:ze.source}}};var Ke,Je,Ye;V.parameters={...V.parameters,docs:{...(Ke=V.parameters)==null?void 0:Ke.docs,source:{originalSource:"Template.bind({})",...(Ye=(Je=V.parameters)==null?void 0:Je.docs)==null?void 0:Ye.source}}};var Ze,Qe,Xe;O.parameters={...O.parameters,docs:{...(Ze=O.parameters)==null?void 0:Ze.docs,source:{originalSource:"Template.bind({})",...(Xe=(Qe=O.parameters)==null?void 0:Qe.docs)==null?void 0:Xe.source}}};var $e,et,tt;R.parameters={...R.parameters,docs:{...($e=R.parameters)==null?void 0:$e.docs,source:{originalSource:"Template.bind({})",...(tt=(et=R.parameters)==null?void 0:et.docs)==null?void 0:tt.source}}};var nt,at,rt;P.parameters={...P.parameters,docs:{...(nt=P.parameters)==null?void 0:nt.docs,source:{originalSource:"Template.bind({})",...(rt=(at=P.parameters)==null?void 0:at.docs)==null?void 0:rt.source}}};var it,st,ot;E.parameters={...E.parameters,docs:{...(it=E.parameters)==null?void 0:it.docs,source:{originalSource:"Template.bind({})",...(ot=(st=E.parameters)==null?void 0:st.docs)==null?void 0:ot.source}}};var lt,ut,ct;N.parameters={...N.parameters,docs:{...(lt=N.parameters)==null?void 0:lt.docs,source:{originalSource:"Template.bind({})",...(ct=(ut=N.parameters)==null?void 0:ut.docs)==null?void 0:ct.source}}};var dt,pt,mt;q.parameters={...q.parameters,docs:{...(dt=q.parameters)==null?void 0:dt.docs,source:{originalSource:"Template.bind({})",...(mt=(pt=q.parameters)==null?void 0:pt.docs)==null?void 0:mt.source}}};var gt,yt,ht;_.parameters={..._.parameters,docs:{...(gt=_.parameters)==null?void 0:gt.docs,source:{originalSource:"Template.bind({})",...(ht=(yt=_.parameters)==null?void 0:yt.docs)==null?void 0:ht.source}}};var bt,vt,Tt;W.parameters={...W.parameters,docs:{...(bt=W.parameters)==null?void 0:bt.docs,source:{originalSource:"Template.bind({})",...(Tt=(vt=W.parameters)==null?void 0:vt.docs)==null?void 0:Tt.source}}};var ft,Ct,wt;M.parameters={...M.parameters,docs:{...(ft=M.parameters)==null?void 0:ft.docs,source:{originalSource:"Template.bind({})",...(wt=(Ct=M.parameters)==null?void 0:Ct.docs)==null?void 0:wt.source}}};var xt,It,Bt;H.parameters={...H.parameters,docs:{...(xt=H.parameters)==null?void 0:xt.docs,source:{originalSource:"Template.bind({})",...(Bt=(It=H.parameters)==null?void 0:It.docs)==null?void 0:Bt.source}}};var kt,St,Ut;F.parameters={...F.parameters,docs:{...(kt=F.parameters)==null?void 0:kt.docs,source:{originalSource:"Template.bind({})",...(Ut=(St=F.parameters)==null?void 0:St.docs)==null?void 0:Ut.source}}};var Dt,jt,Vt;A.parameters={...A.parameters,docs:{...(Dt=A.parameters)==null?void 0:Dt.docs,source:{originalSource:"Template.bind({})",...(Vt=(jt=A.parameters)==null?void 0:jt.docs)==null?void 0:Vt.source}}};var Ot,Rt,Pt;L.parameters={...L.parameters,docs:{...(Ot=L.parameters)==null?void 0:Ot.docs,source:{originalSource:"Template.bind({})",...(Pt=(Rt=L.parameters)==null?void 0:Rt.docs)==null?void 0:Pt.source}}};var Et,Nt,qt;G.parameters={...G.parameters,docs:{...(Et=G.parameters)==null?void 0:Et.docs,source:{originalSource:"Template.bind({})",...(qt=(Nt=G.parameters)==null?void 0:Nt.docs)==null?void 0:qt.source}}};var _t,Wt,Mt;z.parameters={...z.parameters,docs:{...(_t=z.parameters)==null?void 0:_t.docs,source:{originalSource:"Template.bind({})",...(Mt=(Wt=z.parameters)==null?void 0:Wt.docs)==null?void 0:Mt.source}}};var Ht,Ft,At;K.parameters={...K.parameters,docs:{...(Ht=K.parameters)==null?void 0:Ht.docs,source:{originalSource:"Template.bind({})",...(At=(Ft=K.parameters)==null?void 0:Ft.docs)==null?void 0:At.source}}};var Lt,Gt,zt;J.parameters={...J.parameters,docs:{...(Lt=J.parameters)==null?void 0:Lt.docs,source:{originalSource:"Template.bind({})",...(zt=(Gt=J.parameters)==null?void 0:Gt.docs)==null?void 0:zt.source}}};const ta=["Default","Placeholder","PlaceholderWithUnit","TestExternalStateChangeWithSynchronizedUnits","TestEdgeCases","ManagedTestCase","OW_10614TestCase","OW_17784TestCase","DemoCosmeticRounding","TestUserInput","TestDisabledProp","TestDisabledUnitProp","TestErrorProp","TestLeftProp","TestSmallProp","TestWidthProp","TestValueProp","TestUnitKeyProp","TestInitUnitProp","TestNoConversionProp","TestWarningProp","TestPredefinedOptionsProp","TestInitialPredefinedOptionProp","TestConversionsInPredefinedOptions","TestDiffLinkedUnitInPredefinedOptions","TestValidationCallbackProp","TestDisabledValidationProp","TestAllowEmptyProp","TestOnSwitchUnitProp","TestUnitTemplateProp","TestNotKnownUnit"];export{u as Default,$ as DemoCosmeticRounding,Q as ManagedTestCase,X as OW_10614TestCase,k as OW_17784TestCase,w as Placeholder,x as PlaceholderWithUnit,G as TestAllowEmptyProp,H as TestConversionsInPredefinedOptions,F as TestDiffLinkedUnitInPredefinedOptions,U as TestDisabledProp,D as TestDisabledUnitProp,L as TestDisabledValidationProp,B as TestEdgeCases,j as TestErrorProp,I as TestExternalStateChangeWithSynchronizedUnits,N as TestInitUnitProp,M as TestInitialPredefinedOptionProp,V as TestLeftProp,q as TestNoConversionProp,J as TestNotKnownUnit,z as TestOnSwitchUnitProp,W as TestPredefinedOptionsProp,O as TestSmallProp,E as TestUnitKeyProp,K as TestUnitTemplateProp,S as TestUserInput,A as TestValidationCallbackProp,P as TestValueProp,_ as TestWarningProp,R as TestWidthProp,ta as __namedExportsOrder,ea as default};
|