@oliasoft-open-source/react-ui-library 4.11.2-beta-2 → 4.11.2-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.
Files changed (153) hide show
  1. package/dist/global.css +14 -12
  2. package/dist/index.js +20 -23
  3. package/dist/index.js.map +1 -1
  4. package/dist/storybook/assets/Color-KGDBMAHA-BU5Cvr93.js +1 -0
  5. package/dist/storybook/assets/DocsRenderer-PKQXORMH-giM41WN8.js +1 -0
  6. package/dist/storybook/assets/{accordion-6ouB0WTt.js → accordion-BiuI_LCA.js} +1 -1
  7. package/dist/storybook/assets/{accordion.stories-DtRR01fE.js → accordion.stories-BlHfHegj.js} +2 -2
  8. package/dist/storybook/assets/{actions-KLRbmKRF.js → actions-Bax0KeqM.js} +1 -1
  9. package/dist/storybook/assets/{actions.stories-C23gWRWM.js → actions.stories-BnPZKqOJ.js} +1 -1
  10. package/dist/storybook/assets/{afe.stories-BS17Wy3X.js → afe.stories-C9XjJj62.js} +2 -2
  11. package/dist/storybook/assets/{badge.stories-DU2dncNt.js → badge.stories-DA_eeQyi.js} +1 -1
  12. package/dist/storybook/assets/{blowout.stories-Cylh2TXs.js → blowout.stories-DH-sYHgB.js} +1 -1
  13. package/dist/storybook/assets/{button-CjbZ5CrF.js → button-Cbv7WK6k.js} +1 -1
  14. package/dist/storybook/assets/{button-group-DubmMwSS.js → button-group-D2fGP_bX.js} +1 -1
  15. package/dist/storybook/assets/{button-group.stories-PQ9lcPIH.js → button-group.stories-BETADGti.js} +1 -1
  16. package/dist/storybook/assets/{button.stories-DKC1fejY.js → button.stories-C03VvX8K.js} +2 -2
  17. package/dist/storybook/assets/{buttons-and-links-wxWmkOUF.js → buttons-and-links-BA3MNFjq.js} +2 -2
  18. package/dist/storybook/assets/{card.stories-Bn6LpucB.js → card.stories-CsTB0DuM.js} +1 -1
  19. package/dist/storybook/assets/{casing-loads.stories-DfN1h9Nf.js → casing-loads.stories-Cl2tJipP.js} +2 -2
  20. package/dist/storybook/assets/{cell.stories-CreKyw65.js → cell.stories-rzJE_qJC.js} +2 -2
  21. package/dist/storybook/assets/{check-box-wCvXxtCz.js → check-box-DPLaOkRR.js} +1 -1
  22. package/dist/storybook/assets/{check-box.stories-nJkLcHZb.js → check-box.stories-BJ0ShmeC.js} +1 -1
  23. package/dist/storybook/assets/{check-box.test-case.stories-B2vjtKjR.js → check-box.test-case.stories-CzuYZkUh.js} +1 -1
  24. package/dist/storybook/assets/{chunk-HLWAVYOI-CEGdiTjE.js → chunk-HLWAVYOI-Dvbg03uT.js} +1 -1
  25. package/dist/storybook/assets/color-DIyQ13kP.js +25 -0
  26. package/dist/storybook/assets/{column.stories-DATtbLrP.js → column.stories-DDTHFELF.js} +1 -1
  27. package/dist/storybook/assets/{dialog-B-Q5su6I.js → dialog-DkpQscuI.js} +1 -1
  28. package/dist/storybook/assets/{drawer-X4ZJ2aZ0.js → drawer-DaQ1xGjV.js} +1 -1
  29. package/dist/storybook/assets/drawer.stories-C08XBVTq.js +113 -0
  30. package/dist/storybook/assets/{empty.stories-CYf8-mRm.js → empty.stories-L7LSMcLe.js} +1 -1
  31. package/dist/storybook/assets/{field-C5_fLDpy.js → field-HrLaMLbx.js} +1 -1
  32. package/dist/storybook/assets/{field.stories-DW0W89lR.js → field.stories-CYpQ669-.js} +1 -1
  33. package/dist/storybook/assets/{file-button.stories-C_GvNiIi.js → file-button.stories-CRaTdLfv.js} +1 -1
  34. package/dist/storybook/assets/{file-input-BAwHZe0n.js → file-input-yalPf7-m.js} +1 -1
  35. package/dist/storybook/assets/{file-input.stories-DYXTB7gQ.js → file-input.stories-DMTQqAF8.js} +1 -1
  36. package/dist/storybook/assets/{flex.stories-DkN6INc7.js → flex.stories-CLwPyEMp.js} +1 -1
  37. package/dist/storybook/assets/footer.stories-C6M5S0UZ.js +3 -0
  38. package/dist/storybook/assets/form.stories-BNORsn6Z.js +49 -0
  39. package/dist/storybook/assets/formation.stories-1WX1Nu1P.js +74 -0
  40. package/dist/storybook/assets/{heading-NkLgQYoP.js → heading-CRNoBc7q.js} +1 -1
  41. package/dist/storybook/assets/{heading.stories-nI_cFnAN.js → heading.stories-DahFxeiX.js} +1 -1
  42. package/dist/storybook/assets/{help-icon-41R-Z9N1.js → help-icon-Buhx5nl6.js} +1 -1
  43. package/dist/storybook/assets/{help-icon.stories-DBYh0YX7.js → help-icon.stories-DbmZ1fgP.js} +1 -1
  44. package/dist/storybook/assets/icon-BSFY3vDO.js +8 -0
  45. package/dist/storybook/assets/{icon.stories-C4pR7xky.js → icon.stories-fnZUR-LK.js} +1 -1
  46. package/dist/storybook/assets/iframe-B0e2q2Zd.js +2 -0
  47. package/dist/storybook/assets/index-BXJ79Lvz.js +1 -0
  48. package/dist/storybook/assets/{index-D4ghw39u.js → index-BlyDuQBv.js} +8 -8
  49. package/dist/storybook/assets/{index.es-D2piFfFj.js → index.es-DazXb-ul.js} +4 -4
  50. package/dist/storybook/assets/inheritsLoose-DP0QEDDI.js +1 -0
  51. package/dist/storybook/assets/{initialize-context-rEvM6bdZ.js → initialize-context-Y03pJPr5.js} +1 -1
  52. package/dist/storybook/assets/{input-group.stories-Ddz8LT4X.js → input-group.stories-BCajsqAk.js} +2 -2
  53. package/dist/storybook/assets/{input-validation-CuPnRCxY.js → input-validation-CLZKtfoW.js} +2 -2
  54. package/dist/storybook/assets/{inputs-CTDqn8NT.js → inputs-DlW6Jeem.js} +2 -2
  55. package/dist/storybook/assets/{label-hiSz3I8H.js → label-CqmyC9he.js} +1 -1
  56. package/dist/storybook/assets/{label.stories-Cyv5jBAO.js → label.stories-C0AO5F1a.js} +1 -1
  57. package/dist/storybook/assets/layout-forms-C6ZH-nYk.js +16 -0
  58. package/dist/storybook/assets/{layout-general-BDvvrYSA.js → layout-general-CWqOMwXA.js} +2 -2
  59. package/dist/storybook/assets/{list-BuGEbcVL.js → list-By3wp5Wa.js} +1 -1
  60. package/dist/storybook/assets/{list.stories-B5c_uQGt.js → list.stories-BcDHHHYJ.js} +2 -2
  61. package/dist/storybook/assets/{list.stories-data-8Z0neBbX.js → list.stories-data-Doo2Rqun.js} +1 -1
  62. package/dist/storybook/assets/{loader.stories-CNWIIZ6E.js → loader.stories-Q0U2BqZX.js} +1 -1
  63. package/dist/storybook/assets/{menu.stories-BdTFPm_7.js → menu.stories-1I5AGGQx.js} +2 -2
  64. package/dist/storybook/assets/{menu.test-case.stories-CSHeRTes.js → menu.test-case.stories-XN9XFV-D.js} +1 -1
  65. package/dist/storybook/assets/{message-y9kZ5iw6.js → message-BRyKdRaX.js} +1 -1
  66. package/dist/storybook/assets/{message.stories-B7RGjzak.js → message.stories-bCqCYIuN.js} +1 -1
  67. package/dist/storybook/assets/{meta-content-CDd9TzY4.js → meta-content-DNgQbAW0.js} +1 -1
  68. package/dist/storybook/assets/{modal.stories-DZi9oABL.js → modal.stories-C2d-Em5V.js} +2 -2
  69. package/dist/storybook/assets/{modal.test-case.stories-BEw1SVN7.js → modal.test-case.stories-Ci1WRYdo.js} +1 -1
  70. package/dist/storybook/assets/{number-input-CNnU6gOF.js → number-input-B3_gmeWr.js} +1 -1
  71. package/dist/storybook/assets/{number-input.stories-Bo26PJmJ.js → number-input.stories-epjUq9ve.js} +1 -1
  72. package/dist/storybook/assets/number-input.test-case.stories-DeEtalIU.js +95 -0
  73. package/dist/storybook/assets/{option-dropdown.stories-B1pkizRG.js → option-dropdown.stories-CznUbXVi.js} +1 -1
  74. package/dist/storybook/assets/{padding-and-spacing-mPE53XO4.js → padding-and-spacing-CfnXk0Zn.js} +2 -2
  75. package/dist/storybook/assets/{page.stories-Zuw5G3Q1.js → page.stories-DthnK8qb.js} +1 -1
  76. package/dist/storybook/assets/{pagination-CiGr3h9N.js → pagination-CR1nxnnq.js} +1 -1
  77. package/dist/storybook/assets/{pagination.stories-Dd2mM2qz.js → pagination.stories-qXmBYwYc.js} +2 -2
  78. package/dist/storybook/assets/{pop-confirm.stories-DiPq3JCu.js → pop-confirm.stories-CHa0qUBe.js} +1 -1
  79. package/dist/storybook/assets/{popover-C9ygeajM.js → popover-C_2P8LFJ.js} +1 -1
  80. package/dist/storybook/assets/popover.stories-DZTfimDf.js +10 -0
  81. package/dist/storybook/assets/preview-b9pkIJl_.js +2 -0
  82. package/dist/storybook/assets/{preview-orqWJ2ST.js → preview-jWpKVqju.js} +2 -2
  83. package/dist/storybook/assets/projects.stories-BPm6ucAe.js +47 -0
  84. package/dist/storybook/assets/{radio-button-C3RuBqEf.js → radio-button-C4ljBRED.js} +1 -1
  85. package/dist/storybook/assets/{radio-button.stories-B0KZMz4B.js → radio-button.stories-D1rWr6ms.js} +1 -1
  86. package/dist/storybook/assets/{radio-button.test-case.stories-BwUah-6O.js → radio-button.test-case.stories-DglmHlWs.js} +1 -1
  87. package/dist/storybook/assets/react-router-dom-Ck2Y_Fzc.js +8 -0
  88. package/dist/storybook/assets/{reservoirs.stories-CDD0TjSy.js → reservoirs.stories-r1Ip90kJ.js} +2 -2
  89. package/dist/storybook/assets/{rich-text-input.stories-D1j_y7V_.js → rich-text-input.stories-DwaseXZv.js} +3 -3
  90. package/dist/storybook/assets/{row.stories-DB38kAZL.js → row.stories-DRvH8Grn.js} +2 -2
  91. package/dist/storybook/assets/{select-B3sB0hqr.js → select-Cwks-WA0.js} +2 -2
  92. package/dist/storybook/assets/{select.stories-BSoB4ldP.js → select.stories-DjGSNDXK.js} +2 -2
  93. package/dist/storybook/assets/{select.stories-data-BEF6nqsN.js → select.stories-data-DxgWKlU6.js} +1 -1
  94. package/dist/storybook/assets/select.test-case.stories-CrXzt4qn.js +82 -0
  95. package/dist/storybook/assets/{side-bar-D2164Tn-.js → side-bar-wpFQ5NEE.js} +1 -1
  96. package/dist/storybook/assets/{side-bar.stories-E0tQZmAY.js → side-bar.stories-LjClxJcG.js} +1 -1
  97. package/dist/storybook/assets/{site.stories-Dmk01rYh.js → site.stories-BnWmALGd.js} +2 -2
  98. package/dist/storybook/assets/slider-CcpE4BLD.js +27 -0
  99. package/dist/storybook/assets/{slider-DPdTVMP0.css → slider-DnRddBCy.css} +1 -1
  100. package/dist/storybook/assets/slider.stories-BqlRLY_C.js +171 -0
  101. package/dist/storybook/assets/{smart-upload-modal.stories-CUln0bMR.js → smart-upload-modal.stories-BlTSF64K.js} +1 -1
  102. package/dist/storybook/assets/{spacer.stories-BVuZoGQG.js → spacer.stories-BT2S6B0R.js} +1 -1
  103. package/dist/storybook/assets/{table-Bl5BWKeT.js → table-DoyDBG6l.js} +1 -1
  104. package/dist/storybook/assets/{table.stories-CqW7dMju.js → table.stories-BgWKzIob.js} +2 -2
  105. package/dist/storybook/assets/{table.stories-data-CElcAZ7Y.js → table.stories-data-C7mC5R8Q.js} +1 -1
  106. package/dist/storybook/assets/text-link.stories-BQAkVO-W.js +14 -0
  107. package/dist/storybook/assets/{title.stories-HWf-jbB_.js → title.stories-Rv6ZO_Wl.js} +2 -2
  108. package/dist/storybook/assets/{toaster-BMWF3yRW.js → toaster-O8ftrUAJ.js} +1 -1
  109. package/dist/storybook/assets/{toaster.stories-shnom1S1.js → toaster.stories-CdpwLBSo.js} +1 -1
  110. package/dist/storybook/assets/{toaster.test-case.stories-BndtbjCb.js → toaster.test-case.stories-Cy3_Gvs_.js} +1 -1
  111. package/dist/storybook/assets/{toggle-C0zvrIOF.js → toggle-BbFVf61v.js} +1 -1
  112. package/dist/storybook/assets/{toggle.stories-HIP6dA5T.js → toggle.stories-BAislK3I.js} +1 -1
  113. package/dist/storybook/assets/{toggle.test-case.stories-SLhE2A5P.js → toggle.test-case.stories-CeUwdhGD.js} +1 -1
  114. package/dist/storybook/assets/{tooltip.test-case.stories-B_zX5FCQ.js → tooltip.test-case.stories-De9h8ThH.js} +1 -1
  115. package/dist/storybook/assets/{top-bar-4AZm07Mc.js → top-bar-Bjf6PQE1.js} +1 -1
  116. package/dist/storybook/assets/top-bar.stories-1hZmlzDT.js +21 -0
  117. package/dist/storybook/assets/{top-bar.testcase.stories-DN3MQDLk.js → top-bar.testcase.stories-BsFYqaw6.js} +1 -1
  118. package/dist/storybook/assets/{tree.stories-0qtpSom_.js → tree.stories-NGZfmH_B.js} +1 -1
  119. package/dist/storybook/assets/{unit-input-BGnD9Z8O.js → unit-input-BXg4VphV.js} +1 -1
  120. package/dist/storybook/assets/{unit-input.stories-CGRypKCW.js → unit-input.stories-Btz2M_TP.js} +1 -1
  121. package/dist/storybook/assets/unit-input.test-case.stories-CZD1jf36.js +220 -0
  122. package/dist/storybook/assets/unit-table.stories-CISvZMxX.js +152 -0
  123. package/dist/storybook/assets/unit-table.test-case.stories-tEype9om.js +1 -0
  124. package/dist/storybook/iframe.html +1 -1
  125. package/dist/storybook/index.json +1 -1
  126. package/dist/storybook/project.json +1 -1
  127. package/package.json +1 -1
  128. package/dist/storybook/assets/Color-KGDBMAHA-Bqds5h8Z.js +0 -1
  129. package/dist/storybook/assets/DocsRenderer-PKQXORMH-DCqVP8-K.js +0 -1
  130. package/dist/storybook/assets/color-BQwVduH-.js +0 -25
  131. package/dist/storybook/assets/drawer.stories-Di0z4mQf.js +0 -113
  132. package/dist/storybook/assets/extends-CF3RwP-h.js +0 -1
  133. package/dist/storybook/assets/footer.stories-BGYrbMcS.js +0 -3
  134. package/dist/storybook/assets/form.stories-QcF3dSbt.js +0 -49
  135. package/dist/storybook/assets/formation.stories-DnQfJcH1.js +0 -74
  136. package/dist/storybook/assets/icon-BP4BO6-k.js +0 -8
  137. package/dist/storybook/assets/iframe-DzDQhvl_.js +0 -2
  138. package/dist/storybook/assets/index-DO2UUQkG.js +0 -1
  139. package/dist/storybook/assets/inheritsLoose-DR8r8Ogv.js +0 -1
  140. package/dist/storybook/assets/layout-forms-BNzU7smr.js +0 -16
  141. package/dist/storybook/assets/number-input.test-case.stories-noFGMaR2.js +0 -92
  142. package/dist/storybook/assets/popover.stories-BjQWHpS3.js +0 -10
  143. package/dist/storybook/assets/preview-SSh22Coz.js +0 -2
  144. package/dist/storybook/assets/projects.stories-Rn2Q-yAl.js +0 -47
  145. package/dist/storybook/assets/react-router-dom-CMITYWBH.js +0 -8
  146. package/dist/storybook/assets/select.test-case.stories-trBjoExl.js +0 -82
  147. package/dist/storybook/assets/slider-CSesKEJF.js +0 -27
  148. package/dist/storybook/assets/slider.stories-CX-hT1FF.js +0 -134
  149. package/dist/storybook/assets/text-link.stories-BsuVBOWo.js +0 -14
  150. package/dist/storybook/assets/top-bar.stories-DbuzGzjw.js +0 -21
  151. package/dist/storybook/assets/unit-input.test-case.stories-fGxudkap.js +0 -220
  152. package/dist/storybook/assets/unit-table.stories-BqLmWCPl.js +0 -152
  153. package/dist/storybook/assets/unit-table.test-case.stories-DgT7qcpi.js +0 -1
@@ -1,220 +0,0 @@
1
- import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as d}from"./index-DhsZuJvc.js";import{d as b}from"./index-C0x1JmaP.js";import{w as f,u as l,e as r,f as V,a as D}from"./index-DMAnyMX5.js";import{U as u}from"./unit-input-BGnD9Z8O.js";import{B as o}from"./button-CjbZ5CrF.js";import{S as g}from"./spacer-BWoNR27H.js";import{D as fe}from"./divider-DY9nJ_7N.js";import{R as Ce,C as _}from"./row-Bmiy2Lh0.js";import{F as U}from"./field-C5_fLDpy.js";import{M as pe}from"./message-y9kZ5iw6.js";import{G as ge}from"./grid-DRkC-bt8.js";import{C as v}from"./card-EcjmryU9.js";import{H as y}from"./heading-NkLgQYoP.js";import{T as N}from"./toggle-C0zvrIOF.js";import{T as q}from"./text-B3-TSWok.js";import{S as xe}from"./select-B3sB0hqr.js";import{I as he}from"./icon-BP4BO6-k.js";import"./index-DRSy5Ssd.js";import"./index-CF7H4eMJ.js";import"./index-Bk2sglWO.js";import"./initialize-context-rEvM6bdZ.js";import"./number-input-CNnU6gOF.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-KLRbmKRF.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-hiSz3I8H.js";import"./help-icon-41R-Z9N1.js";import"./extends-CF3RwP-h.js";import"./assertThisInitialized-B9jnkVVz.js";import"./inheritsLoose-DR8r8Ogv.js";import"./memoize-one.esm-CcMeOnPo.js";import"./select.input-CJed_LLR.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";const vt={title:"Forms/UnitInput/Test Cases",component:u,tags:["!autodocs"]},C=()=>{const[i,a]=d.useState("123|m");return e.jsx(u,{name:"example",onChange:t=>a(t.target.value),placeholder:"Type a value...",value:i,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId"})};C.play=async({canvasElement:i,step:a})=>{const t=f(i),s=f(i.ownerDocument.body);await a("Shows validation error for non-numeric input",async()=>{const n=t.getByTestId("testId");await l.clear(n),await l.type(n,"123x45s6"),await r(t.getByDisplayValue("123x45s6")).toBeInTheDocument(),await r(n.getAttribute("data-error")).toEqual("Must be a numerical value"),await V.mouseOver(n),await D(()=>{r(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};const x=()=>{const[i,a]=d.useState("|m");return e.jsx(u,{name:"example-ft",onChange:t=>a(t.target.value),placeholder:"7|ft",value:i,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId-ft"})};x.play=async({canvasElement:i,step:a})=>{const t=f(i),s=f(i.ownerDocument.body);await a("Handle input with unit only",async()=>{const n=t.getByTestId("testId-ft");await r(t.getByDisplayValue("")).toBeInTheDocument(),await r(n.getAttribute("data-error")).toBeNull(),await V.mouseOver(n),await D(()=>{r(s.queryByText("Must be a numerical value")).not.toBeInTheDocument()})}),await a("Clear input and check placeholder",async()=>{const n=t.getByTestId("testId-ft");await l.clear(n),await r(n).toHaveAttribute("placeholder","2.13")}),await a("Type a correct numeric value and ensure no error",async()=>{const n=t.getByTestId("testId-ft");await l.type(n,"123"),await r(t.getByDisplayValue("123")).toBeInTheDocument(),await r(n.getAttribute("data-error")).toBeNull(),await V.mouseOver(n),await D(()=>{r(s.queryByText("Must be a numerical value")).not.toBeInTheDocument()})}),await a("Remove value, type incorrect value and check for error",async()=>{const n=t.getByTestId("testId-ft");await l.clear(n),await l.type(n,"123abc"),await r(t.getByDisplayValue("123abc")).toBeInTheDocument(),await r(n.getAttribute("data-error")).toEqual("Must be a numerical value"),await V.mouseOver(n),await D(()=>{r(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};const T=i=>{const[a,t]=d.useState("123|m"),[s,n]=d.useState("223|m"),[c,h]=d.useState("ft");return e.jsxs(e.Fragment,{children:[e.jsx(o,{label:"Change initUnit",onClick:()=>h(c==="m"?"ft":"m")}),e.jsx(g,{}),e.jsx(o,{label:"Change value",onClick:()=>t(a==="123|m"?"456|m":"123|m")}),e.jsx(g,{}),e.jsx(u,{name:"example",onChange:m=>{t(m.target.value)},unitkey:"length",value:a,initUnit:c,onSwitchUnit:h}),e.jsx(g,{}),e.jsx(u,{name:"example2",onChange:m=>{n(m.target.value)},unitkey:"length",value:s,initUnit:c,onSwitchUnit:h}),e.jsx(fe,{}),e.jsx("h4",{children:"Without initUnit property (taken from the redux store)"}),e.jsx(u,{name:"example",onChange:m=>{t(m.target.value)},unitkey:"length",value:a,onSwitchUnit:h}),e.jsx(u,{name:"example2",onChange:m=>{n(m.target.value)},unitkey:"length",value:s,onSwitchUnit:h})]})};T.parameters={docs:{description:{story:"[OW-4380](https://oliasoft.atlassian.net/browse/OW-4380?atlOrigin=eyJpIjoiMmM1N2RkNWU3Mjk5NDYxY2E0YzhkMzk5ZTVmZTJhMjciLCJwIjoiaiJ9)"}}};const I=()=>{const i="500px",[a,t]=d.useState(void 0);return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different edge cases such as +/- infinity, undefined, NaN, null:"}),e.jsxs(Ce,{children:[e.jsxs(_,{width:"25%",children:[e.jsx(o,{label:"Change value infinity",onClick:()=>t(1/0)}),e.jsx("br",{}),e.jsx(o,{label:"Change value -infinity",onClick:()=>t(-1/0)}),e.jsx("br",{}),e.jsx(o,{label:"Change value null",onClick:()=>t(null)}),e.jsx("br",{}),e.jsx(o,{label:"Change value - undefined",onClick:()=>t(void 0)}),e.jsx("br",{}),e.jsx(o,{label:"Change value - NaN",onClick:()=>t(NaN)}),e.jsx("br",{}),e.jsx(o,{label:"Change value - nothing (empty)",onClick:()=>t(void 0)}),e.jsx("br",{}),e.jsx(o,{label:"Change value - empty string",onClick:()=>t("")})]}),e.jsxs(_,{width:"25%",children:[e.jsx(o,{label:"Change value infinity|m",onClick:()=>t("Infinity|m")}),e.jsx("br",{}),e.jsx(o,{label:"Change value -infinity|m",onClick:()=>t("-Infinity|m")}),e.jsx("br",{}),e.jsx(o,{label:"Change value null|m",onClick:()=>t("null|m")}),e.jsx("br",{}),e.jsx(o,{label:"Change value - undefined|m",onClick:()=>t("undefined|m")}),e.jsx("br",{}),e.jsx(o,{label:"Change value - NaN|m",onClick:()=>t("NaN|m")}),e.jsx("br",{}),e.jsx(o,{label:"Change value - nothing (empty)|m",onClick:()=>t("|m")})]})]}),e.jsx("br",{}),e.jsx(U,{label:"Normal PUI",children:e.jsx(u,{name:"example1",onChange:s=>t(s.target.value),value:a,unitkey:"length",width:i,placeholder:"value|unit"})}),e.jsx(U,{label:"Disabled validation",children:e.jsx(u,{name:"example2",onChange:s=>t(s.target.value),value:a,unitkey:"length",disabledValidation:!0,width:i})}),e.jsx(U,{label:"Disabled validation and manual error",children:e.jsx(u,{name:"example3",onChange:s=>t(s.target.value),value:a,unitkey:"length",error:"test",disabledValidation:!0,width:i})}),e.jsx(pe,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})};I.parameters={docs:{description:{story:"[OW-8884](https://oliasoft.atlassian.net/browse/OW-8884)"}}};const j=()=>{const[i,a]=d.useState(!0),t=()=>{a(!1),setTimeout(()=>a(!0),0)},[s,n]=d.useState("123|ft");return e.jsxs(ge,{columns:"1fr 1fr",gap:!0,children:[e.jsxs(v,{heading:e.jsx(y,{children:"Storage State (Redux)"}),children:[s,e.jsx(g,{}),e.jsx(o,{label:"Change value",onClick:()=>n(b.withUnit(String(Math.floor(Math.random()*100)),"ft"))})]}),e.jsx(v,{heading:e.jsx(y,{icon:e.jsx(he,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:t,children:"UnitInput"}),children:i&&e.jsx(u,{name:"example",onChange:c=>n(c.target.value),value:s,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"}})})]})},S=()=>e.jsxs(e.Fragment,{children:[e.jsx(q,{faint:!0,children:"Reproduce OW-10614 rounding noise bug when storing values in a different unit to the display unit"}),e.jsx(g,{}),e.jsx(u,{name:"example",onChange:()=>{},value:b.withUnit(b.convertAndGetValue("9750|psi","bar"),"bar"),initUnit:"psi",unitkey:"pressure",unitTemplate:{pressure:"psi"}}),e.jsx(g,{}),e.jsx(u,{name:"example2",onChange:()=>{},value:b.withUnit(b.convertAndGetValue("8642|lbf","tonneForce"),"tonneForce"),initUnit:"lbf",unitkey:"force",unitTemplate:{force:"tonneForce"}})]}),w=()=>e.jsxs(e.Fragment,{children:[e.jsx(u,{name:"example",unitkey:"moleWeight",initUnit:"g/mol",doNotConvertValue:!0,value:"170|g/mol",unitTemplate:{moleWeight:"g/mol"},testId:"case1"}),e.jsx(g,{}),e.jsx(u,{name:"gor",unitkey:"moleWeight",initUnit:"gor",value:"Infinity|SCF/STB",testId:"case2"})]});w.play=async({canvasElement:i,step:a})=>{const t=f(i);await a("Can enter decimal values",async()=>{await r(t.getByDisplayValue("170")).toBeInTheDocument(),await r(t.getByDisplayValue("")).toBeInTheDocument()})};const B=()=>{const[i,a]=d.useState(!0),t=()=>{a(!1),setTimeout(()=>a(!0),0)},[s,n]=d.useState("psi"),[c,h]=d.useState(!1),[m,ve]=d.useState(!0),[F,ye]=d.useState(!0),[R,M]=d.useState("672.2388357750001|bar"),[W,be]=d.useState("");return e.jsxs(ge,{columns:"1fr 1fr",gap:!0,children:[e.jsxs(v,{heading:e.jsx(y,{children:"Settings"}),children:[e.jsx(U,{label:"Enable display rounding:",labelLeft:!0,labelWidth:200,children:e.jsx(N,{checked:c,onChange:p=>h(p.target.checked)})}),e.jsx(U,{label:"Enable cosmetic rounding:",labelLeft:!0,labelWidth:200,children:e.jsx(N,{checked:m,onChange:p=>ve(p.target.checked)})}),e.jsx(U,{label:"Convert back to storage unit (onChange):",labelLeft:!0,labelWidth:200,children:e.jsx(N,{checked:F,onChange:p=>ye(p.target.checked)})})]}),e.jsxs(v,{heading:e.jsx(y,{icon:e.jsx(he,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:t,children:"UnitInput"}),children:[e.jsx(q,{faint:!0,children:"Cosmetic Rounding Test Case: type 9750 then return (compare with enableCosmeticRounding on and off)"}),e.jsx(g,{}),e.jsx(q,{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."}),e.jsx(g,{}),i&&e.jsx(u,{name:"Example",unitkey:"pressure",initUnit:s,unitTemplate:{pressure:"psi"},value:R,onChange:p=>{const{value:E}=p.target;E&&M(E)},enableDisplayRounding:c,enableCosmeticRounding:m,error:b.convertAndGetValue(R,"bar")>=0?"":"Value must be positive",validationCallback:(p,E)=>{be(E??"")},convertBackToStorageUnit:F})]}),e.jsx(v,{heading:e.jsx(y,{children:"Unit Template"}),children:e.jsx(xe,{options:[{label:"Bar",value:"bar"},{label:"psi",value:"psi"}],value:s,width:70,onChange:p=>n(p.target.value)})}),e.jsx(v,{heading:e.jsx(y,{children:"Test Validation Callback"}),children:W&&e.jsx(pe,{message:{content:W,icon:!0,type:"Error",visible:!0}})}),e.jsxs(v,{heading:e.jsx(y,{children:"Storage State / Redux"}),children:[R,e.jsx(g,{}),e.jsx(o,{label:"Change value",onClick:()=>M(b.withUnit(String(Math.floor(Math.random()*100)),"bar"))})]})]})},k=()=>{const[i,a]=d.useState("123|m");return e.jsx(u,{name:"example",onChange:t=>a(t.target.value),value:i,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId"})};k.play=async({canvasElement:i,step:a})=>{const t=f(i),s=f(i.ownerDocument.body);await a("Can enter decimal values",async()=>{const n=t.getByTestId("testId");await l.clear(n),await l.type(n,"123.123456789"),await r(t.getByDisplayValue("123.123456789")).toBeInTheDocument()}),await a("Can enter scientific notation",async()=>{const n=t.getByTestId("testId");await l.clear(n),await l.type(n,"-1.12e3"),await r(t.getByDisplayValue("-1.12e3")).toBeInTheDocument()}),await a("Can enter comma decimals (converts to dot)",async()=>{const n=t.getByTestId("testId");await l.clear(n),await l.type(n,"123,456"),await r(t.getByDisplayValue("123.456")).toBeInTheDocument()}),await a("Can enter small numbers",async()=>{const n=t.getByTestId("testId");await l.clear(n),await l.type(n,"0.0000000023"),await r(t.getByDisplayValue("0.0000000023")).toBeInTheDocument()}),await a("Can enter large numbers",async()=>{const n=t.getByTestId("testId");await l.clear(n),await l.type(n,"999999999999"),await r(t.getByDisplayValue("999999999999")).toBeInTheDocument()}),await a("Can convert units",async()=>{const n=t.getByTestId("testId"),c=t.getByTestId("testId-menu");await l.clear(n),await l.type(n,"456.1"),await l.click(c),await l.click(s.getByTestId("testId-unit-ft")),await r(t.getByDisplayValue("1496")).toBeInTheDocument()}),await a("Shows validation error for non-numeric input",async()=>{const n=t.getByTestId("testId");await l.clear(n),await l.type(n,"123x45s6"),await r(t.getByDisplayValue("123x45s6")).toBeInTheDocument(),await r(n.getAttribute("data-error")).toEqual("Must be a numerical value"),await V.mouseOver(n),await D(()=>{r(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};C.__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"};T.__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:""},doNotConvertValue:{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:"boolean"},description:""},shouldLinkAutomaticly:{required:!1,tsType:{name:"boolean"},description:""},selectedPredefinedOptionKey:{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:""},autoValue:{required:!1,tsType:{name:"string"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(event: TChangeEvent | ICustomChangeEvent) => void",signature:{arguments:[{type:{name:"union",raw:"TChangeEvent | ICustomChangeEvent",elements:[{name:"intersection",raw:`ChangeEvent<T> & {
2
- target:
3
- | T
4
- | { name: string; value: any; label?: string; files?: FileList | null };
5
- }`,elements:[{name:"ChangeEvent",elements:[{name:"T"}],raw:"ChangeEvent<T>"},{name:"signature",type:"object",raw:`{
6
- target:
7
- | T
8
- | { name: string; value: any; label?: string; files?: FileList | null };
9
- }`,signature:{properties:[{key:"target",value:{name:"union",raw:`| T
10
- | { name: string; value: any; label?: string; files?: FileList | null }`,elements:[{name:"T"},{name:"signature",type:"object",raw:"{ name: string; value: any; label?: string; files?: FileList | null }",signature:{properties:[{key:"name",value:{name:"string",required:!0}},{key:"value",value:{name:"any",required:!0}},{key:"label",value:{name:"string",required:!1}},{key:"files",value:{name:"union",raw:"FileList | null",elements:[{name:"FileList"},{name:"null"}],required:!1}}]}}],required:!0}}]}}]},{name:"ICustomChangeEvent"}]},name:"event"}],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:""}}};I.__docgenInfo={description:"",methods:[],displayName:"TestEdgeCases"};j.__docgenInfo={description:"",methods:[],displayName:"ManagedTestCase"};S.__docgenInfo={description:"",methods:[],displayName:"OW_10614TestCase"};w.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"OW_17784TestCase"};B.__docgenInfo={description:"",methods:[],displayName:"DemoCosmeticRounding"};k.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"TestUserInput"};var H,O,P;C.parameters={...C.parameters,docs:{...(H=C.parameters)==null?void 0:H.docs,source:{originalSource:`() => {
11
- const [value, setValue] = useState('123|m');
12
- return <UnitInput name="example" onChange={evt => setValue(evt.target.value)} placeholder="Type a value..." value={value} initUnit="m" unitkey="depth" unitTemplate={{
13
- depth: 'm'
14
- }} testId="testId" />;
15
- }`,...(P=(O=C.parameters)==null?void 0:O.docs)==null?void 0:P.source}}};var L,A,G;x.parameters={...x.parameters,docs:{...(L=x.parameters)==null?void 0:L.docs,source:{originalSource:`() => {
16
- const [value, setValue] = useState('|m');
17
- return <UnitInput name="example-ft" onChange={evt => setValue(evt.target.value)} placeholder="7|ft" value={value} initUnit="m" unitkey="depth" unitTemplate={{
18
- depth: 'm'
19
- }} testId="testId-ft" />;
20
- }`,...(G=(A=x.parameters)==null?void 0:A.docs)==null?void 0:G.source}}};var z,J,Y;T.parameters={...T.parameters,docs:{...(z=T.parameters)==null?void 0:z.docs,source:{originalSource:`(args: IUnitInputProps) => {
21
- const [value, setValue] = useState('123|m');
22
- const [value2, setValue2] = useState('223|m');
23
- const [initUnit, setInitUnit] = useState('ft');
24
- return <>
25
- <Button label="Change initUnit" onClick={() => setInitUnit(initUnit === 'm' ? 'ft' : 'm')} />
26
- <Spacer />
27
- <Button label="Change value" onClick={() => setValue(value === '123|m' ? '456|m' : '123|m')} />
28
- <Spacer />
29
- <UnitInput name="example" onChange={evt => {
30
- setValue(evt.target.value);
31
- }} unitkey="length" value={value} initUnit={initUnit} onSwitchUnit={setInitUnit} />
32
- <Spacer />
33
- <UnitInput name="example2" onChange={evt => {
34
- setValue2(evt.target.value);
35
- }} unitkey="length" value={value2} initUnit={initUnit} onSwitchUnit={setInitUnit} />
36
- <Divider />
37
- <h4>Without initUnit property (taken from the redux store)</h4>
38
- <UnitInput name="example" onChange={evt => {
39
- setValue(evt.target.value);
40
- }} unitkey="length" value={value} onSwitchUnit={setInitUnit} />
41
- <UnitInput name="example2" onChange={evt => {
42
- setValue2(evt.target.value);
43
- }} unitkey="length" value={value2} onSwitchUnit={setInitUnit} />
44
- </>;
45
- }`,...(Y=(J=T.parameters)==null?void 0:J.docs)==null?void 0:Y.source}}};var Z,K,Q;I.parameters={...I.parameters,docs:{...(Z=I.parameters)==null?void 0:Z.docs,source:{originalSource:`() => {
46
- const width = '500px';
47
- const [value, setValue] = useState<any>(undefined);
48
- return <>
49
- <h4>Different edge cases such as +/- infinity, undefined, NaN, null:</h4>
50
- <Row>
51
- <Column width="25%">
52
- <Button label="Change value infinity" onClick={() => setValue(Infinity)} />
53
- <br />
54
- <Button label="Change value -infinity" onClick={() => setValue(-Infinity)} />
55
- <br />
56
- <Button label="Change value null" onClick={() => setValue(null)} />
57
- <br />
58
- <Button label="Change value - undefined" onClick={() => setValue(undefined)} />
59
- <br />
60
- <Button label="Change value - NaN" onClick={() => setValue(NaN)} />
61
- <br />
62
- <Button label="Change value - nothing (empty)" onClick={() => setValue(undefined)} />
63
- <br />
64
- <Button label="Change value - empty string" onClick={() => setValue('')} />
65
- </Column>
66
- <Column width="25%">
67
- <Button label="Change value infinity|m" onClick={() => setValue(Infinity + '|m')} />
68
- <br />
69
- <Button label="Change value -infinity|m" onClick={() => setValue(-Infinity + '|m')} />
70
- <br />
71
- <Button label="Change value null|m" onClick={() => setValue(null + '|m')} />
72
- <br />
73
- <Button label="Change value - undefined|m" onClick={() => setValue(undefined + '|m')} />
74
- <br />
75
- <Button label="Change value - NaN|m" onClick={() => setValue(NaN + '|m')} />
76
- <br />
77
- <Button label="Change value - nothing (empty)|m" onClick={() => setValue('|m')} />
78
- </Column>
79
- </Row>
80
- <br />
81
- <Field label="Normal PUI">
82
- <UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} placeholder="value|unit" />
83
- </Field>
84
- <Field label="Disabled validation">
85
- <UnitInput name="example2" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" disabledValidation width={width} />
86
- </Field>
87
- <Field label="Disabled validation and manual error">
88
- <UnitInput name="example3" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" error="test" disabledValidation width={width} />
89
- </Field>
90
- <Message message={{
91
- heading: 'Current value inside PUI: ' + value,
92
- visible: true
93
- }} />
94
- </>;
95
- }`,...(Q=(K=I.parameters)==null?void 0:K.docs)==null?void 0:Q.source}}};var X,$,ee;j.parameters={...j.parameters,docs:{...(X=j.parameters)==null?void 0:X.docs,source:{originalSource:`() => {
96
- const [visible, setVisible] = useState(true);
97
- const triggerRerender = () => {
98
- setVisible(false);
99
- setTimeout(() => setVisible(true), 0);
100
- };
101
- const [value, setValue] = useState('123|ft');
102
- return <Grid columns="1fr 1fr" gap>
103
- <Card heading={<Heading>Storage State (Redux)</Heading>}>
104
- {value}
105
- <Spacer />
106
- <Button label="Change value" onClick={() => setValue(withUnit(String(Math.floor(Math.random() * 100)), 'ft'))} />
107
- </Card>
108
- <Card heading={<Heading icon={<Icon icon="refresh" testId="triggerRerenderTestId" />} onIconClick={triggerRerender}>
109
- UnitInput
110
- </Heading>}>
111
- {visible && <UnitInput name="example" onChange={evt => setValue(evt.target.value)} value={value} initUnit="m" unitkey="depth" unitTemplate={{
112
- depth: 'm'
113
- }} />}
114
- </Card>
115
- </Grid>;
116
- }`,...(ee=($=j.parameters)==null?void 0:$.docs)==null?void 0:ee.source}}};var te,ne,ae;S.parameters={...S.parameters,docs:{...(te=S.parameters)==null?void 0:te.docs,source:{originalSource:`() => {
117
- return <>
118
- <Text faint>
119
- Reproduce OW-10614 rounding noise bug when storing values in a different
120
- unit to the display unit
121
- </Text>
122
- <Spacer />
123
- <UnitInput name="example" onChange={() => {}} value={withUnit(convertAndGetValue('9750|psi', 'bar'), 'bar')} initUnit="psi" unitkey="pressure" unitTemplate={{
124
- pressure: 'psi'
125
- }} />
126
- <Spacer />
127
- <UnitInput name="example2" onChange={() => {}} value={withUnit(convertAndGetValue('8642|lbf', 'tonneForce'), 'tonneForce')} initUnit="lbf" unitkey="force" unitTemplate={{
128
- force: 'tonneForce'
129
- }} />
130
- </>;
131
- }`,...(ae=(ne=S.parameters)==null?void 0:ne.docs)==null?void 0:ae.source}}};var ie,re,se;w.parameters={...w.parameters,docs:{...(ie=w.parameters)==null?void 0:ie.docs,source:{originalSource:`() => {
132
- return <>
133
- <UnitInput name="example" unitkey="moleWeight" initUnit="g/mol" doNotConvertValue //reproduces OW_17784
134
- value="170|g/mol" unitTemplate={{
135
- moleWeight: 'g/mol'
136
- }} testId="case1" />
137
- <Spacer />
138
- <UnitInput name="gor" unitkey="moleWeight" initUnit="gor" value="Infinity|SCF/STB" testId="case2" />
139
- </>;
140
- }`,...(se=(re=w.parameters)==null?void 0:re.docs)==null?void 0:se.source}}};var le,oe,ue;B.parameters={...B.parameters,docs:{...(le=B.parameters)==null?void 0:le.docs,source:{originalSource:`() => {
141
- const [visible, setVisible] = useState(true);
142
- const triggerRerender = () => {
143
- setVisible(false);
144
- setTimeout(() => setVisible(true), 0);
145
- };
146
- const [preferredUnit, setPreferredUnit] = useState('psi');
147
- const [enableDisplayRounding, setEnableDisplayRounding] = useState(false);
148
- const [enableCosmeticRounding, setEnableCosmeticRounding] = useState(true);
149
- const [convertBackToStorageUnit, setConvertBackToStorageUnit] = useState(true);
150
- const [value, setValue] = useState('672.2388357750001|bar');
151
- const [callBackError, setCallBackError] = useState('');
152
- return <Grid columns="1fr 1fr" gap>
153
- <Card heading={<Heading>Settings</Heading>}>
154
- <Field label="Enable display rounding:" labelLeft labelWidth={200}>
155
- <Toggle checked={enableDisplayRounding} onChange={evt => setEnableDisplayRounding(evt.target.checked)} />
156
- </Field>
157
- <Field label="Enable cosmetic rounding:" labelLeft labelWidth={200}>
158
- <Toggle checked={enableCosmeticRounding} onChange={evt => setEnableCosmeticRounding(evt.target.checked)} />
159
- </Field>
160
- <Field label="Convert back to storage unit (onChange):" labelLeft labelWidth={200}>
161
- <Toggle checked={convertBackToStorageUnit} onChange={evt => setConvertBackToStorageUnit(evt.target.checked)} />
162
- </Field>
163
- </Card>
164
- <Card heading={<Heading icon={<Icon icon="refresh" testId="triggerRerenderTestId" />} onIconClick={triggerRerender}>
165
- UnitInput
166
- </Heading>}>
167
- <Text faint>
168
- Cosmetic Rounding Test Case: type 9750 then return (compare with
169
- enableCosmeticRounding on and off)
170
- </Text>
171
- <Spacer />
172
- <Text warning>
173
- Note: UnitInput uses convertSamePrecision internally (decision prior
174
- to cosmetic value implementation). This means not all rounding noise
175
- occurrences seen in NumberInput will be reproducible in UnitInput,
176
- because they get rounded off by other logic.
177
- </Text>
178
- <Spacer />
179
- {visible && <UnitInput name="Example" unitkey="pressure" initUnit={preferredUnit} unitTemplate={{
180
- pressure: 'psi'
181
- }} value={value} onChange={evt => {
182
- const {
183
- value
184
- } = evt.target;
185
- if (value) {
186
- setValue(value);
187
- }
188
- }} enableDisplayRounding={enableDisplayRounding} enableCosmeticRounding={enableCosmeticRounding} error={convertAndGetValue(value, 'bar') >= 0 ? '' : 'Value must be positive'} validationCallback={(name, error) => {
189
- setCallBackError(error ?? '');
190
- }} convertBackToStorageUnit={convertBackToStorageUnit} />}
191
- </Card>
192
- <Card heading={<Heading>Unit Template</Heading>}>
193
- <Select options={[{
194
- label: 'Bar',
195
- value: 'bar'
196
- }, {
197
- label: 'psi',
198
- value: 'psi'
199
- }]} value={preferredUnit} width={70} onChange={evt => setPreferredUnit(evt.target.value)} />
200
- </Card>
201
- <Card heading={<Heading>Test Validation Callback</Heading>}>
202
- {callBackError && <Message message={{
203
- content: callBackError,
204
- icon: true,
205
- type: 'Error',
206
- visible: true
207
- }} />}
208
- </Card>
209
- <Card heading={<Heading>Storage State / Redux</Heading>}>
210
- {value}
211
- <Spacer />
212
- <Button label="Change value" onClick={() => setValue(withUnit(String(Math.floor(Math.random() * 100)), 'bar'))} />
213
- </Card>
214
- </Grid>;
215
- }`,...(ue=(oe=B.parameters)==null?void 0:oe.docs)==null?void 0:ue.source}}};var de,ce,me;k.parameters={...k.parameters,docs:{...(de=k.parameters)==null?void 0:de.docs,source:{originalSource:`() => {
216
- const [value, setValue] = useState('123|m');
217
- return <UnitInput name="example" onChange={evt => setValue(evt.target.value)} value={value} initUnit="m" unitkey="depth" unitTemplate={{
218
- depth: 'm'
219
- }} testId="testId" />;
220
- }`,...(me=(ce=k.parameters)==null?void 0:ce.docs)==null?void 0:me.source}}};const yt=["Placeholder","PlaceholderWithUnit","TestExternalStateChangeWithSynchronizedUnits","TestEdgeCases","ManagedTestCase","OW_10614TestCase","OW_17784TestCase","DemoCosmeticRounding","TestUserInput"];export{B as DemoCosmeticRounding,j as ManagedTestCase,S as OW_10614TestCase,w as OW_17784TestCase,C as Placeholder,x as PlaceholderWithUnit,I as TestEdgeCases,T as TestExternalStateChangeWithSynchronizedUnits,k as TestUserInput,yt as __namedExportsOrder,vt as default};
@@ -1,152 +0,0 @@
1
- import{j as n}from"./jsx-runtime-eps93zm2.js";import{r as f}from"./index-DhsZuJvc.js";import{f as z}from"./immer.esm-BwVl9PS2.js";import{d as w}from"./index-C0x1JmaP.js";import{G as ee}from"./grid-DRkC-bt8.js";import{S as te}from"./spacer-BWoNR27H.js";import{C as V}from"./card-EcjmryU9.js";import{F as R}from"./field-C5_fLDpy.js";import{H as F}from"./heading-NkLgQYoP.js";import{S as N}from"./select-B3sB0hqr.js";import{T as W}from"./toggle-C0zvrIOF.js";import{l as ne}from"./lodash-c4VUpsOs.js";import{u as ae,a as ie,g as re,c as K}from"./initialize-context-rEvM6bdZ.js";import{T as oe,C as P}from"./table-Bl5BWKeT.js";import{s as le}from"./number-input-CNnU6gOF.js";import"./index-DRSy5Ssd.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./index-Bk2sglWO.js";import"./label-hiSz3I8H.js";import"./common-types-Sih75Sav.js";import"./help-icon-41R-Z9N1.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./icon-BP4BO6-k.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DR8r8Ogv.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./types-Dx2TtIG9.js";import"./enum-Bnn40S8Q.js";import"./extends-CF3RwP-h.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-KLRbmKRF.js";import"./button-CjbZ5CrF.js";import"./spinner-AWUe4xwQ.js";import"./badge-CLQ59MDF.js";import"./select.input-CJed_LLR.js";import"./helpers-JJxzGegQ.js";import"./index.es-D2piFfFj.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./pagination-CiGr3h9N.js";import"./input-Db9WkmPP.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./check-box-wCvXxtCz.js";import"./slider-CSesKEJF.js";import"./index-BI4_Bp97.js";import"./popover-C9ygeajM.js";const se=l=>l.reduce(({preferredUnits:i,storageUnits:r},{unitKey:s,preferredUnit:a,storageUnit:h})=>{const{unitTemplate:p=null}=ie()??{};return i[s]=a??re(s,p),r[s]=h,{preferredUnits:i,storageUnits:r}},{preferredUnits:{},storageUnits:{}}),ue=({headers:l,rows:i,selectedUnits:r,storageUnits:s,onChangeUnit:a,convertBackToStorageUnit:h,enableCosmeticRounding:p,enableDisplayRounding:T})=>{const d=l?l.map(c=>({...c,cells:c.cells.map(g=>{var t;if(g.type===P.AUTO_UNIT){const{testId:x,unitKey:u}=g;return{value:r[u],type:P.SELECT,searchable:!1,options:(t=w.getUnitsForQuantity(u))==null?void 0:t.map(v=>({label:w.label(v),value:v})),native:g.native,onChange:v=>a({unitKey:u,value:v.target.value}),testId:x}}return g})})):[],o=i?i.map((c,g)=>({...c,cells:c.cells.map((t,x)=>{if("autoUnit"in t&&(t!=null&&t.autoUnit)&&(typeof(t==null?void 0:t.value)=="string"||typeof(t==null?void 0:t.value)=="number")){const{unitKey:u,value:v,formatDisplayValue:D}=t,L=T&&"roundDisplayValue"in t?t==null?void 0:t.roundDisplayValue:null,m=r[u],b=s[u],e=m!==b,{value:U=v}=K({value:le(v),unitkey:u,toUnit:m,fromUnit:b}),y=e?U:t.value,k=D?D(y):y;return{...t,value:k,enableCosmeticRounding:p&&e,enableDisplayRounding:T,roundDisplayValue:L,onChange:C=>{const{value:S}=C.target,B=s[u],E=r[u],A=E!==B,_=h?B:E,{value:I=S}=K({value:String(S),unitkey:u,toUnit:_,fromUnit:E}),X=A?I:S;if("onChange"in t){const{onChange:Y}=t,Z={...C,target:{...C.target,value:String(X),rowIndex:g,cellIndex:x,unit:_}};Y(Z)}}}}return t})})):[];return{convertedHeaders:d,convertedRows:o}},M=({table:l,unitConfig:i,convertBackToStorageUnit:r=!0,enableCosmeticRounding:s=!0,enableDisplayRounding:a=!0})=>{const{rows:h,headers:p,...T}=l,{storageUnits:d,preferredUnits:o}=se(i),c=ae(o),[g,t]=f.useState(o),x=({unitKey:m,value:b})=>{t({...g,[m]:b});const e=i.find(U=>U.unitKey===m);e&&typeof e.onChange=="function"&&e.onChange({oldUnit:g[m],newUnit:b,unitKey:m})},u=m=>ue({headers:p,rows:h,selectedUnits:m,storageUnits:d,onChangeUnit:x,convertBackToStorageUnit:r,enableCosmeticRounding:s,enableDisplayRounding:a}),v=u(g),[D,L]=f.useState(v);return f.useEffect(()=>{!ne.isEqual(o,c)&&(Object.keys(o).forEach(b=>{const e=c==null?void 0:c[b],U=o[b];e!==U&&x({unitKey:b,value:U})}),L(u(o)))},[i]),f.useEffect(()=>{L(u(g))},[l,g]),n.jsx(oe,{table:{...T,headers:D.convertedHeaders,rows:D.convertedRows}})};M.__docgenInfo={description:"",methods:[],displayName:"UnitTable",props:{table:{required:!0,tsType:{name:"IUnitTable"},description:""},unitConfig:{required:!0,tsType:{name:"Array",elements:[{name:"IUnitConfigItem"}],raw:"IUnitConfigItem[]"},description:""},convertBackToStorageUnit:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},enableCosmeticRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},enableDisplayRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}}},composes:["Omit"]};const vt={title:"Basic/UnitTable",args:{}},de=!0,ce=!0,pe=!0,ge=!1,H="ft",J="C",me=3,he=(l,i,r)=>{const s=[i,i,r],a=[...Array(l)].map((h,p)=>{const T=p,d=p+1.25,o=4+p*.25;return[String(T),String(d),String(o)]});return[s,...a]},be=he(me,H,J),fe=({reduxTable:l,value:i,unit:r,rowIndex:s,cellIndex:a})=>z(l,h=>{const p=h[0][a],T=(d,o)=>o===0;return h.forEach((d,o)=>{if(T(d,o)){d[a]=r;return}if(o===s+1){d[a]=String(i);return}const c=w.convertAndGetValue(d[a],r,p);d[a]=String(c)}),h}),ve=({reduxTable:l,value:i,rowIndex:r,cellIndex:s})=>z(l,a=>{a[r+1][s]=i}),j=()=>{var m,b;const[l,i]=f.useState(H),[r,s]=f.useState(J),[a,h]=f.useState(be),[p,T]=f.useState(de),[d,o]=f.useState(pe),[c,g]=f.useState(ce),[t,x]=f.useState(ge),[u,v]=f.useState(H),D=e=>{const{rowIndex:U,cellIndex:y,value:k,unit:C}=e.target,S=t?fe({reduxTable:a,value:k,unit:C,rowIndex:U,cellIndex:y}):ve({reduxTable:a,value:k,rowIndex:U,cellIndex:y});h(S)},L=a.reduce((e,U,y)=>(y===0?e.headers=[{cells:[{value:"From"},{value:"To"},{value:"Temperature"}]},{cells:[{type:"AutoUnit",unitKey:"length"},{type:"AutoUnit",unitKey:"length"},{type:"AutoUnit",unitKey:"temperature",testId:"table-unit-selector-3"}]}]:e.rows=e.rows.concat({cells:U.map((k,C)=>{const S=y===1&&C===1;return{value:k,type:S?"Text":"NumberInput",unitKey:C===2?"temperature":"length",onChange:D,roundDisplayValue:y===3&&C===2?I=>w.roundByMagnitude(I,2):null,formatDisplayValue:S?I=>`T* ${I}`:null,autoUnit:!0,testId:`testId_${y}_${C}`}})}),e),{testId:"testId",headers:[],rows:[]});return n.jsxs(ee,{columns:"1fr 1fr",gap:!0,children:[n.jsxs(V,{heading:n.jsx(F,{children:"Settings"}),children:[n.jsx(R,{label:"Convert back to storage unit:",labelLeft:!0,labelWidth:200,children:n.jsx(W,{checked:p,onChange:e=>T(e.target.checked)})}),n.jsx(R,{label:"Enable display rounding:",labelLeft:!0,labelWidth:200,children:n.jsx(W,{checked:d,onChange:e=>o(e.target.checked)})}),n.jsx(R,{label:"Enable cosmetic rounding:",labelLeft:!0,labelWidth:200,children:n.jsx(W,{checked:c,onChange:e=>g(e.target.checked)})}),n.jsx(R,{label:"Convert whole table:",labelLeft:!0,labelWidth:200,children:n.jsx(W,{checked:t,onChange:e=>x(e.target.checked)})})]}),n.jsxs(V,{heading:n.jsx(F,{children:"Unit template"}),children:[n.jsx(R,{label:"Length unit:",labelLeft:!0,labelWidth:120,children:n.jsx(N,{options:(m=w.getUnitsForQuantity("length"))==null?void 0:m.map(e=>({value:e,label:w.label(e)})),value:{value:l},onChange:e=>i(e.target.value),width:"100px"})}),n.jsx(R,{label:"Temperature unit:",labelLeft:!0,labelWidth:120,children:n.jsx(N,{options:(b=w.getUnitsForQuantity("temperature"))==null?void 0:b.map(e=>({value:e,label:w.label(e)})),value:{value:r},onChange:e=>s(e.target.value),width:"100px"})})]}),n.jsx(V,{heading:n.jsx(F,{children:"Storage State (Redux)"}),children:n.jsx("pre",{children:n.jsx("code",{children:JSON.stringify(a,null,2)})})}),n.jsxs(V,{heading:n.jsx(F,{children:"UnitTable"}),children:[n.jsx(M,{table:L,unitConfig:[{unitKey:"length",storageUnit:a[0][0],preferredUnit:l,onChange:({newUnit:e})=>v(e)},{unitKey:"temperature",storageUnit:a[0][2],preferredUnit:r}],convertBackToStorageUnit:p,enableDisplayRounding:d,enableCosmeticRounding:c}),n.jsx(te,{height:20}),n.jsx(R,{label:"Displayed length unit:",labelLeft:!0,labelWidth:150,children:u})]})]})};j.__docgenInfo={description:"",methods:[],displayName:"UnitTableExample"};var O,q,$,G,Q;j.parameters={...j.parameters,docs:{...(O=j.parameters)==null?void 0:O.docs,source:{originalSource:`() => {
2
- const [preferredLengthUnit, setPreferredLengthUnit] = useState(initialLengthUnit);
3
- const [preferredTemperatureUnit, setPreferredTemperatureUnit] = useState(initialTemperatureUnit);
4
- const [reduxTable, setReduxTable] = useState<TTable>(initialTable);
5
- const [convertBackToStorageUnit, setConvertBackToStorageUnit] = useState(initialConvertBackToStorageUnit);
6
- const [enableDisplayRounding, setEnableDisplayRounding] = useState(initialEnableDisplayRounding);
7
- const [enableCosmeticRounding, setEnableCosmeticRounding] = useState(initialEnableCosmeticRounding);
8
- const [convertWholeTable, setConvertWholeTable] = useState(initialConvertWholeTable);
9
- const [displayedLengthUnit, setDisplayedLengthUnit] = useState(initialLengthUnit);
10
-
11
- /*********************************************************************************************************************
12
- Cell onChange handler
13
- *********************************************************************************************************************/
14
- const onUpdateCell = (evt: IUnitTableOnChangeEvent) => {
15
- const {
16
- rowIndex,
17
- cellIndex,
18
- value,
19
- unit
20
- } = evt.target;
21
- const nextTable = convertWholeTable ? convertStorageTable({
22
- reduxTable,
23
- value,
24
- unit,
25
- rowIndex,
26
- cellIndex
27
- }) : updateCell({
28
- reduxTable,
29
- value,
30
- rowIndex,
31
- cellIndex
32
- });
33
- setReduxTable(nextTable);
34
- };
35
-
36
- /*********************************************************************************************************************
37
- Construct table view data (same as old Table component, with a new props)
38
- *********************************************************************************************************************/
39
- const tableViewData = reduxTable.reduce((acc, row, rowIndex) => {
40
- if (rowIndex === 0) {
41
- acc.headers = [{
42
- cells: [{
43
- value: 'From'
44
- }, {
45
- value: 'To'
46
- }, {
47
- value: 'Temperature'
48
- }]
49
- }, {
50
- cells: [{
51
- type: 'AutoUnit',
52
- unitKey: 'length'
53
- }, {
54
- type: 'AutoUnit',
55
- unitKey: 'length'
56
- }, {
57
- type: 'AutoUnit',
58
- unitKey: 'temperature',
59
- testId: 'table-unit-selector-3'
60
- }]
61
- }];
62
- } else {
63
- acc.rows = acc.rows.concat({
64
- cells: row.map((cell, cellIndex) => {
65
- const specialCell = rowIndex === 1 && cellIndex === 1;
66
- const type = specialCell ? 'Text' : 'NumberInput';
67
- const formatDisplayValue = specialCell ? (value: number | string) => \`T* \${value}\` : null;
68
- const customDisplayRounding = rowIndex === 3 && cellIndex === 2 ? (value: TStringNumberNull) => roundByMagnitude(value, 2) : null;
69
- const value = cell;
70
- return {
71
- value,
72
- type,
73
- unitKey: cellIndex === 2 ? 'temperature' : 'length',
74
- onChange: onUpdateCell,
75
- roundDisplayValue: customDisplayRounding,
76
- // optionally customize the display rounding of specific columns/cells
77
- formatDisplayValue,
78
- // optionally extend/customize the display formatting of specific columns/cells
79
- autoUnit: true,
80
- testId: \`testId_\${rowIndex}_\${cellIndex}\`
81
- };
82
- })
83
- });
84
- }
85
- return acc;
86
- }, {
87
- testId: 'testId',
88
- headers: ([] as any[]),
89
- rows: ([] as IUnitTableRow[])
90
- });
91
- return <Grid columns="1fr 1fr" gap>
92
- <Card heading={<Heading>Settings</Heading>}>
93
- <Field label="Convert back to storage unit:" labelLeft labelWidth={200}>
94
- <Toggle checked={convertBackToStorageUnit} onChange={evt => setConvertBackToStorageUnit(evt.target.checked)} />
95
- </Field>
96
- <Field label="Enable display rounding:" labelLeft labelWidth={200}>
97
- <Toggle checked={enableDisplayRounding} onChange={evt => setEnableDisplayRounding(evt.target.checked)} />
98
- </Field>
99
- <Field label="Enable cosmetic rounding:" labelLeft labelWidth={200}>
100
- <Toggle checked={enableCosmeticRounding} onChange={evt => setEnableCosmeticRounding(evt.target.checked)} />
101
- </Field>
102
- <Field label="Convert whole table:" labelLeft labelWidth={200}>
103
- <Toggle checked={convertWholeTable} onChange={evt => setConvertWholeTable(evt.target.checked)} />
104
- </Field>
105
- </Card>
106
- <Card heading={<Heading>Unit template</Heading>}>
107
- <Field label="Length unit:" labelLeft labelWidth={120}>
108
- <Select options={getUnitsForQuantity('length')?.map(unit => ({
109
- value: unit,
110
- label: label(unit)
111
- }))} value={{
112
- value: preferredLengthUnit
113
- }} onChange={evt => setPreferredLengthUnit(evt.target.value)} width="100px" />
114
- </Field>
115
- <Field label="Temperature unit:" labelLeft labelWidth={120}>
116
- <Select options={getUnitsForQuantity('temperature')?.map(unit => ({
117
- value: unit,
118
- label: label(unit)
119
- }))} value={{
120
- value: preferredTemperatureUnit
121
- }} onChange={evt => setPreferredTemperatureUnit(evt.target.value)} width="100px" />
122
- </Field>
123
- </Card>
124
- <Card heading={<Heading>Storage State (Redux)</Heading>}>
125
- <pre>
126
- <code>{JSON.stringify(reduxTable, null, 2)}</code>
127
- </pre>
128
- </Card>
129
- <Card heading={<Heading>UnitTable</Heading>}>
130
- <UnitTable table={tableViewData}
131
- //New props:
132
- unitConfig={[{
133
- unitKey: 'length',
134
- storageUnit: reduxTable[0][0],
135
- preferredUnit: preferredLengthUnit,
136
- onChange: ({
137
- newUnit
138
- }) => setDisplayedLengthUnit(newUnit)
139
- }, {
140
- unitKey: 'temperature',
141
- storageUnit: reduxTable[0][2],
142
- preferredUnit: preferredTemperatureUnit
143
- }]}
144
- //Most tables should just use the default values here (true):
145
- convertBackToStorageUnit={convertBackToStorageUnit} enableDisplayRounding={enableDisplayRounding} enableCosmeticRounding={enableCosmeticRounding} />
146
- <Spacer height={20} />
147
- <Field label="Displayed length unit:" labelLeft labelWidth={150}>
148
- {displayedLengthUnit}
149
- </Field>
150
- </Card>
151
- </Grid>;
152
- }`,...($=(q=j.parameters)==null?void 0:q.docs)==null?void 0:$.source},description:{story:"Story",...(Q=(G=j.parameters)==null?void 0:G.docs)==null?void 0:Q.description}}};const Ut=["UnitTableExample"];export{j as UnitTableExample,Ut as __namedExportsOrder,vt as default};
@@ -1 +0,0 @@
1
- import{w as p,u as i,e as r,f as s,a as n}from"./index-DMAnyMX5.js";import{UnitTableExample as c}from"./unit-table.stories-BqLmWCPl.js";import"./index-CF7H4eMJ.js";import"./jsx-runtime-eps93zm2.js";import"./index-DhsZuJvc.js";import"./immer.esm-BwVl9PS2.js";import"./index-C0x1JmaP.js";import"./index-DRSy5Ssd.js";import"./grid-DRkC-bt8.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./spacer-BWoNR27H.js";import"./card-EcjmryU9.js";import"./index-Bk2sglWO.js";import"./field-C5_fLDpy.js";import"./label-hiSz3I8H.js";import"./common-types-Sih75Sav.js";import"./help-icon-41R-Z9N1.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./icon-BP4BO6-k.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DR8r8Ogv.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./heading-NkLgQYoP.js";import"./select-B3sB0hqr.js";import"./lodash-c4VUpsOs.js";import"./types-Dx2TtIG9.js";import"./enum-Bnn40S8Q.js";import"./extends-CF3RwP-h.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-KLRbmKRF.js";import"./button-CjbZ5CrF.js";import"./spinner-AWUe4xwQ.js";import"./badge-CLQ59MDF.js";import"./select.input-CJed_LLR.js";import"./helpers-JJxzGegQ.js";import"./toggle-C0zvrIOF.js";import"./initialize-context-rEvM6bdZ.js";import"./number-input-CNnU6gOF.js";import"./input-Db9WkmPP.js";import"./table-Bl5BWKeT.js";import"./index.es-D2piFfFj.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./pagination-CiGr3h9N.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./check-box-wCvXxtCz.js";import"./slider-CSesKEJF.js";import"./index-BI4_Bp97.js";import"./popover-C9ygeajM.js";const yt={title:"Basic/UnitTable/Test Cases",args:{},tags:["!autodocs"]},u=c.bind({});u.play=async({canvasElement:o,step:e})=>{const a=p(o),m=p(o.ownerDocument.body);await e("Can enter decimal values",async()=>{const t=a.getByTestId("testId_2_1");await i.clear(t),await i.type(t,"123.123456789"),await i.click(o),await r(a.getByDisplayValue("123.12")).toBeInTheDocument()}),await e("Can enter comma decimals (converts to dot)",async()=>{const t=a.getByTestId("testId_2_1");await i.clear(t),await i.type(t,"123,456"),await i.click(o),await r(a.getByDisplayValue("123.46")).toBeInTheDocument()}),await e("Can enter small numbers",async()=>{const t=a.getByTestId("testId_2_1");await i.clear(t),await i.type(t,"0.0000000023"),await i.click(o),await r(t).toHaveDisplayValue("0.00")}),await e("Can enter large numbers",async()=>{const t=a.getByTestId("testId_2_1");await i.clear(t),await i.type(t,"999999999999"),await i.click(o),await r(a.getByDisplayValue("999999999999.00")).toBeInTheDocument()}),await e("Shows validation error for non-numeric input",async()=>{const t=a.getByTestId("testId_2_1");await i.clear(t),await i.type(t,"123x45s6"),await i.click(o),await r(a.getByDisplayValue("123x45s6")).toBeInTheDocument(),await r(t.getAttribute("data-error")).toEqual("Must be a numerical value"),await s.mouseOver(t),await n(()=>{r(m.getByText("Must be a numerical value")).toBeInTheDocument()})})};const dt=["Test"];export{u as Test,dt as __namedExportsOrder,yt as default};