@oliasoft-open-source/react-ui-library 4.12.2 → 4.13.0-beta-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/dist/assets/{index-BU9wzZv9.css → index-BZ1vGLnA.css} +34 -317
  2. package/dist/assets/{index-BVCFmQTa.js → index-D4oUBkZd.js} +169 -145
  3. package/dist/global.css +0 -312
  4. package/dist/index.d.ts +5 -7
  5. package/dist/index.html +1 -1
  6. package/dist/index.js +166 -134
  7. package/dist/index.js.map +1 -1
  8. package/dist/storybook/assets/{Color-KGDBMAHA-CvQEdkJ-.js → Color-KGDBMAHA-ANgdrQuZ.js} +1 -1
  9. package/dist/storybook/assets/{DocsRenderer-PKQXORMH-C6GXR-GZ.js → DocsRenderer-PKQXORMH-Diyq_37l.js} +1 -1
  10. package/dist/storybook/assets/{accordion.stories-BlHfHegj.js → accordion.stories-CrmHu75y.js} +1 -1
  11. package/dist/storybook/assets/{buttons-and-links-B2aUSQnD.js → buttons-and-links-CtA6FoCC.js} +1 -1
  12. package/dist/storybook/assets/{casing-loads.stories-Cl2tJipP.js → casing-loads.stories-Buy0-e_n.js} +1 -1
  13. package/dist/storybook/assets/{cell.stories-rzJE_qJC.js → cell.stories-CPNfDo9l.js} +1 -1
  14. package/dist/storybook/assets/{chunk-HLWAVYOI-bMKAIsRx.js → chunk-HLWAVYOI-KJoVz4w2.js} +1 -1
  15. package/dist/storybook/assets/{color-C-IS9le6.js → color-fa-nGnuH.js} +1 -1
  16. package/dist/storybook/assets/{footer.stories-C6M5S0UZ.js → footer.stories-DniqHrTZ.js} +1 -1
  17. package/dist/storybook/assets/{form.stories-BNORsn6Z.js → form.stories-Cr5Pz40F.js} +1 -1
  18. package/dist/storybook/assets/{formation.stories-1WX1Nu1P.js → formation.stories-C4Kugh7C.js} +1 -1
  19. package/dist/storybook/assets/{iframe-QRTUElpr.js → iframe-zFwPc0wJ.js} +2 -2
  20. package/dist/storybook/assets/{index-bEJt8O9I.js → index-D6O8EiV-.js} +88 -88
  21. package/dist/storybook/assets/{index-BEnhO9y0.js → index-DKfJ8f-b.js} +1 -1
  22. package/dist/storybook/assets/{input-validation-DMG_NbpY.js → input-validation-D5ctNaQa.js} +1 -1
  23. package/dist/storybook/assets/{inputs-DBtZGdv-.js → inputs-CwLa0axN.js} +1 -1
  24. package/dist/storybook/assets/{layout-forms-CaGMNapf.js → layout-forms-5MAO2Ru7.js} +1 -1
  25. package/dist/storybook/assets/{layout-general-irIAv1Z-.js → layout-general-BH_mkxyI.js} +1 -1
  26. package/dist/storybook/assets/{padding-and-spacing-BWFXmHaT.js → padding-and-spacing-B1k2xnXg.js} +1 -1
  27. package/dist/storybook/assets/preview-B0ZyjArU.css +1 -0
  28. package/dist/storybook/assets/{preview-BQAoj8Wn.js → preview-DpTCnAn-.js} +2 -2
  29. package/dist/storybook/assets/{preview-BAhOLBiJ.js → preview-FIj3W2uF.js} +1 -1
  30. package/dist/storybook/assets/{row.stories-DRvH8Grn.js → row.stories-jKh8Ms1e.js} +1 -1
  31. package/dist/storybook/assets/{slider-DnRddBCy.css → slider-DPdTVMP0.css} +1 -1
  32. package/dist/storybook/assets/{slider-CcpE4BLD.js → slider-DxaD8LU4.js} +4 -4
  33. package/dist/storybook/assets/slider.stories-DuGie_AX.js +134 -0
  34. package/dist/storybook/assets/{table-DoyDBG6l.js → table-BSABGfWm.js} +1 -1
  35. package/dist/storybook/assets/{table.stories-BgWKzIob.js → table.stories-CHwzAdud.js} +1 -1
  36. package/dist/storybook/assets/{title.stories-Rv6ZO_Wl.js → title.stories-D0VjujmM.js} +1 -1
  37. package/dist/storybook/assets/unit-input-CFaqZ7UG.js +7 -0
  38. package/dist/storybook/assets/unit-input.stories-DBuzpBTN.js +203 -0
  39. package/dist/storybook/assets/unit-input.test-case.stories-Dzx3BsjK.js +223 -0
  40. package/dist/storybook/assets/{unit-table.stories-CISvZMxX.js → unit-table.stories-DwZVHcZo.js} +1 -1
  41. package/dist/storybook/assets/{unit-table.test-case.stories-tEype9om.js → unit-table.test-case.stories-C9Swzooe.js} +1 -1
  42. package/dist/storybook/iframe.html +1 -1
  43. package/dist/storybook/index.json +1 -1
  44. package/dist/storybook/project.json +1 -1
  45. package/package.json +1 -1
  46. package/dist/404.html +0 -1
  47. package/dist/assets/noto-sans-cyrillic-400-italic-BY-huaZy.woff +0 -0
  48. package/dist/assets/noto-sans-cyrillic-400-italic-V6PUkjg4.woff2 +0 -0
  49. package/dist/assets/noto-sans-cyrillic-400-normal--jh3sVvp.woff +0 -0
  50. package/dist/assets/noto-sans-cyrillic-400-normal-XY9qUppk.woff2 +0 -0
  51. package/dist/assets/noto-sans-cyrillic-700-italic-BsvNKSfQ.woff2 +0 -0
  52. package/dist/assets/noto-sans-cyrillic-700-italic-DSFghSMx.woff +0 -0
  53. package/dist/assets/noto-sans-cyrillic-700-normal-8ZAWbjJL.woff2 +0 -0
  54. package/dist/assets/noto-sans-cyrillic-700-normal-CTzjhoZt.woff +0 -0
  55. package/dist/assets/noto-sans-cyrillic-ext-400-italic-Bb5b47eb.woff +0 -0
  56. package/dist/assets/noto-sans-cyrillic-ext-400-italic-DGWPeY37.woff2 +0 -0
  57. package/dist/assets/noto-sans-cyrillic-ext-400-normal-CFQi7qvd.woff +0 -0
  58. package/dist/assets/noto-sans-cyrillic-ext-400-normal-CH_iUxq2.woff2 +0 -0
  59. package/dist/assets/noto-sans-cyrillic-ext-700-italic-BdqKfCVQ.woff2 +0 -0
  60. package/dist/assets/noto-sans-cyrillic-ext-700-italic-C55zR5rk.woff +0 -0
  61. package/dist/assets/noto-sans-cyrillic-ext-700-normal-B5dGcPIT.woff +0 -0
  62. package/dist/assets/noto-sans-cyrillic-ext-700-normal-CojAy5w4.woff2 +0 -0
  63. package/dist/assets/noto-sans-devanagari-400-italic-KeY3OvDe.woff +0 -0
  64. package/dist/assets/noto-sans-devanagari-400-italic-Lk_flmKd.woff2 +0 -0
  65. package/dist/assets/noto-sans-devanagari-400-normal-BV8n3Zrw.woff2 +0 -0
  66. package/dist/assets/noto-sans-devanagari-400-normal-Da_uNpmI.woff +0 -0
  67. package/dist/assets/noto-sans-devanagari-700-italic-DX_Ben-x.woff2 +0 -0
  68. package/dist/assets/noto-sans-devanagari-700-italic-Df3Sqs2H.woff +0 -0
  69. package/dist/assets/noto-sans-devanagari-700-normal-C2VYeOxD.woff +0 -0
  70. package/dist/assets/noto-sans-devanagari-700-normal-C8e99gZj.woff2 +0 -0
  71. package/dist/assets/noto-sans-greek-400-italic-BXJxTOvj.woff +0 -0
  72. package/dist/assets/noto-sans-greek-400-italic-DHwB0AdM.woff2 +0 -0
  73. package/dist/assets/noto-sans-greek-400-normal-BroOW-sQ.woff +0 -0
  74. package/dist/assets/noto-sans-greek-400-normal-CPTbu1sO.woff2 +0 -0
  75. package/dist/assets/noto-sans-greek-700-italic-CfolioWa.woff2 +0 -0
  76. package/dist/assets/noto-sans-greek-700-italic-DBCdhGrj.woff +0 -0
  77. package/dist/assets/noto-sans-greek-700-normal-BVjVfDKs.woff +0 -0
  78. package/dist/assets/noto-sans-greek-700-normal-P_B9BfF7.woff2 +0 -0
  79. package/dist/assets/noto-sans-greek-ext-400-italic-9zOpfpOs.woff2 +0 -0
  80. package/dist/assets/noto-sans-greek-ext-400-italic-D2WbBWVW.woff +0 -0
  81. package/dist/assets/noto-sans-greek-ext-400-normal-D73iK5X1.woff2 +0 -0
  82. package/dist/assets/noto-sans-greek-ext-400-normal-DWouWyWY.woff +0 -0
  83. package/dist/assets/noto-sans-greek-ext-700-italic-C5zCcdM3.woff2 +0 -0
  84. package/dist/assets/noto-sans-greek-ext-700-italic-YPo3ecki.woff +0 -0
  85. package/dist/assets/noto-sans-greek-ext-700-normal-BJpqEDTw.woff +0 -0
  86. package/dist/assets/noto-sans-greek-ext-700-normal-ZrWkOZr4.woff2 +0 -0
  87. package/dist/assets/noto-sans-latin-ext-400-italic-BOMiliBU.woff +0 -0
  88. package/dist/assets/noto-sans-latin-ext-400-italic-UXQeYjoB.woff2 +0 -0
  89. package/dist/assets/noto-sans-latin-ext-400-normal-BIBIZdeZ.woff2 +0 -0
  90. package/dist/assets/noto-sans-latin-ext-400-normal-vP3vnBxr.woff +0 -0
  91. package/dist/assets/noto-sans-latin-ext-700-italic-o2AF7PF_.woff2 +0 -0
  92. package/dist/assets/noto-sans-latin-ext-700-italic-zILg070W.woff +0 -0
  93. package/dist/assets/noto-sans-latin-ext-700-normal-BInqjRdw.woff +0 -0
  94. package/dist/assets/noto-sans-latin-ext-700-normal-BS3CI2D1.woff2 +0 -0
  95. package/dist/assets/noto-sans-vietnamese-400-italic-CDqW7NCu.woff2 +0 -0
  96. package/dist/assets/noto-sans-vietnamese-400-italic-DJmGvf9Z.woff +0 -0
  97. package/dist/assets/noto-sans-vietnamese-400-normal-DziUSn_1.woff +0 -0
  98. package/dist/assets/noto-sans-vietnamese-400-normal-l431O8bE.woff2 +0 -0
  99. package/dist/assets/noto-sans-vietnamese-700-italic-D0f5b0SE.woff +0 -0
  100. package/dist/assets/noto-sans-vietnamese-700-italic-GQhDhRZX.woff2 +0 -0
  101. package/dist/assets/noto-sans-vietnamese-700-normal-Dp2_pAUa.woff +0 -0
  102. package/dist/assets/noto-sans-vietnamese-700-normal-RhAWG0gK.woff2 +0 -0
  103. package/dist/storybook/assets/noto-sans-cyrillic-400-italic-BY-huaZy.woff +0 -0
  104. package/dist/storybook/assets/noto-sans-cyrillic-400-italic-V6PUkjg4.woff2 +0 -0
  105. package/dist/storybook/assets/noto-sans-cyrillic-400-normal--jh3sVvp.woff +0 -0
  106. package/dist/storybook/assets/noto-sans-cyrillic-400-normal-XY9qUppk.woff2 +0 -0
  107. package/dist/storybook/assets/noto-sans-cyrillic-700-italic-BsvNKSfQ.woff2 +0 -0
  108. package/dist/storybook/assets/noto-sans-cyrillic-700-italic-DSFghSMx.woff +0 -0
  109. package/dist/storybook/assets/noto-sans-cyrillic-700-normal-8ZAWbjJL.woff2 +0 -0
  110. package/dist/storybook/assets/noto-sans-cyrillic-700-normal-CTzjhoZt.woff +0 -0
  111. package/dist/storybook/assets/noto-sans-cyrillic-ext-400-italic-Bb5b47eb.woff +0 -0
  112. package/dist/storybook/assets/noto-sans-cyrillic-ext-400-italic-DGWPeY37.woff2 +0 -0
  113. package/dist/storybook/assets/noto-sans-cyrillic-ext-400-normal-CFQi7qvd.woff +0 -0
  114. package/dist/storybook/assets/noto-sans-cyrillic-ext-400-normal-CH_iUxq2.woff2 +0 -0
  115. package/dist/storybook/assets/noto-sans-cyrillic-ext-700-italic-BdqKfCVQ.woff2 +0 -0
  116. package/dist/storybook/assets/noto-sans-cyrillic-ext-700-italic-C55zR5rk.woff +0 -0
  117. package/dist/storybook/assets/noto-sans-cyrillic-ext-700-normal-B5dGcPIT.woff +0 -0
  118. package/dist/storybook/assets/noto-sans-cyrillic-ext-700-normal-CojAy5w4.woff2 +0 -0
  119. package/dist/storybook/assets/noto-sans-devanagari-400-italic-KeY3OvDe.woff +0 -0
  120. package/dist/storybook/assets/noto-sans-devanagari-400-italic-Lk_flmKd.woff2 +0 -0
  121. package/dist/storybook/assets/noto-sans-devanagari-400-normal-BV8n3Zrw.woff2 +0 -0
  122. package/dist/storybook/assets/noto-sans-devanagari-400-normal-Da_uNpmI.woff +0 -0
  123. package/dist/storybook/assets/noto-sans-devanagari-700-italic-DX_Ben-x.woff2 +0 -0
  124. package/dist/storybook/assets/noto-sans-devanagari-700-italic-Df3Sqs2H.woff +0 -0
  125. package/dist/storybook/assets/noto-sans-devanagari-700-normal-C2VYeOxD.woff +0 -0
  126. package/dist/storybook/assets/noto-sans-devanagari-700-normal-C8e99gZj.woff2 +0 -0
  127. package/dist/storybook/assets/noto-sans-greek-400-italic-BXJxTOvj.woff +0 -0
  128. package/dist/storybook/assets/noto-sans-greek-400-italic-DHwB0AdM.woff2 +0 -0
  129. package/dist/storybook/assets/noto-sans-greek-400-normal-BroOW-sQ.woff +0 -0
  130. package/dist/storybook/assets/noto-sans-greek-400-normal-CPTbu1sO.woff2 +0 -0
  131. package/dist/storybook/assets/noto-sans-greek-700-italic-CfolioWa.woff2 +0 -0
  132. package/dist/storybook/assets/noto-sans-greek-700-italic-DBCdhGrj.woff +0 -0
  133. package/dist/storybook/assets/noto-sans-greek-700-normal-BVjVfDKs.woff +0 -0
  134. package/dist/storybook/assets/noto-sans-greek-700-normal-P_B9BfF7.woff2 +0 -0
  135. package/dist/storybook/assets/noto-sans-greek-ext-400-italic-9zOpfpOs.woff2 +0 -0
  136. package/dist/storybook/assets/noto-sans-greek-ext-400-italic-D2WbBWVW.woff +0 -0
  137. package/dist/storybook/assets/noto-sans-greek-ext-400-normal-D73iK5X1.woff2 +0 -0
  138. package/dist/storybook/assets/noto-sans-greek-ext-400-normal-DWouWyWY.woff +0 -0
  139. package/dist/storybook/assets/noto-sans-greek-ext-700-italic-C5zCcdM3.woff2 +0 -0
  140. package/dist/storybook/assets/noto-sans-greek-ext-700-italic-YPo3ecki.woff +0 -0
  141. package/dist/storybook/assets/noto-sans-greek-ext-700-normal-BJpqEDTw.woff +0 -0
  142. package/dist/storybook/assets/noto-sans-greek-ext-700-normal-ZrWkOZr4.woff2 +0 -0
  143. package/dist/storybook/assets/noto-sans-latin-ext-400-italic-BOMiliBU.woff +0 -0
  144. package/dist/storybook/assets/noto-sans-latin-ext-400-italic-UXQeYjoB.woff2 +0 -0
  145. package/dist/storybook/assets/noto-sans-latin-ext-400-normal-BIBIZdeZ.woff2 +0 -0
  146. package/dist/storybook/assets/noto-sans-latin-ext-400-normal-vP3vnBxr.woff +0 -0
  147. package/dist/storybook/assets/noto-sans-latin-ext-700-italic-o2AF7PF_.woff2 +0 -0
  148. package/dist/storybook/assets/noto-sans-latin-ext-700-italic-zILg070W.woff +0 -0
  149. package/dist/storybook/assets/noto-sans-latin-ext-700-normal-BInqjRdw.woff +0 -0
  150. package/dist/storybook/assets/noto-sans-latin-ext-700-normal-BS3CI2D1.woff2 +0 -0
  151. package/dist/storybook/assets/noto-sans-vietnamese-400-italic-CDqW7NCu.woff2 +0 -0
  152. package/dist/storybook/assets/noto-sans-vietnamese-400-italic-DJmGvf9Z.woff +0 -0
  153. package/dist/storybook/assets/noto-sans-vietnamese-400-normal-DziUSn_1.woff +0 -0
  154. package/dist/storybook/assets/noto-sans-vietnamese-400-normal-l431O8bE.woff2 +0 -0
  155. package/dist/storybook/assets/noto-sans-vietnamese-700-italic-D0f5b0SE.woff +0 -0
  156. package/dist/storybook/assets/noto-sans-vietnamese-700-italic-GQhDhRZX.woff2 +0 -0
  157. package/dist/storybook/assets/noto-sans-vietnamese-700-normal-Dp2_pAUa.woff +0 -0
  158. package/dist/storybook/assets/noto-sans-vietnamese-700-normal-RhAWG0gK.woff2 +0 -0
  159. package/dist/storybook/assets/preview-DeFlgNaS.css +0 -1
  160. package/dist/storybook/assets/slider.stories-BqlRLY_C.js +0 -171
  161. package/dist/storybook/assets/unit-input-DTOrVqdm.js +0 -5
  162. package/dist/storybook/assets/unit-input.stories-BhSBzB95.js +0 -198
  163. package/dist/storybook/assets/unit-input.test-case.stories-Dk5SRvMt.js +0 -215
@@ -0,0 +1,223 @@
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};
@@ -1,4 +1,4 @@
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-HrLaMLbx.js";import{H as F}from"./heading-CRNoBc7q.js";import{S as N}from"./select-Cwks-WA0.js";import{T as W}from"./toggle-BbFVf61v.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-Y03pJPr5.js";import{T as oe,C as P}from"./table-DoyDBG6l.js";import{s as le}from"./number-input-B3_gmeWr.js";import"./index-DRSy5Ssd.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./index-Bk2sglWO.js";import"./label-CqmyC9he.js";import"./common-types-Sih75Sav.js";import"./help-icon-Buhx5nl6.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./types-Dx2TtIG9.js";import"./enum-Bnn40S8Q.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-Bax0KeqM.js";import"./button-Cbv7WK6k.js";import"./spinner-AWUe4xwQ.js";import"./badge-CLQ59MDF.js";import"./select.input-CJed_LLR.js";import"./helpers-JJxzGegQ.js";import"./index.es-DazXb-ul.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./pagination-CR1nxnnq.js";import"./input-Db9WkmPP.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./check-box-DPLaOkRR.js";import"./slider-CcpE4BLD.js";import"./index-BI4_Bp97.js";import"./popover-C_2P8LFJ.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 ft={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:`() => {
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-HrLaMLbx.js";import{H as F}from"./heading-CRNoBc7q.js";import{S as N}from"./select-Cwks-WA0.js";import{T as W}from"./toggle-BbFVf61v.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-Y03pJPr5.js";import{T as oe,C as P}from"./table-BSABGfWm.js";import{s as le}from"./number-input-B3_gmeWr.js";import"./index-DRSy5Ssd.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./index-Bk2sglWO.js";import"./label-CqmyC9he.js";import"./common-types-Sih75Sav.js";import"./help-icon-Buhx5nl6.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./types-Dx2TtIG9.js";import"./enum-Bnn40S8Q.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-Bax0KeqM.js";import"./button-Cbv7WK6k.js";import"./spinner-AWUe4xwQ.js";import"./badge-CLQ59MDF.js";import"./select.input-CJed_LLR.js";import"./helpers-JJxzGegQ.js";import"./index.es-DazXb-ul.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./pagination-CR1nxnnq.js";import"./input-Db9WkmPP.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./check-box-DPLaOkRR.js";import"./slider-DxaD8LU4.js";import"./index-BI4_Bp97.js";import"./popover-C_2P8LFJ.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 ft={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
2
  const [preferredLengthUnit, setPreferredLengthUnit] = useState(initialLengthUnit);
3
3
  const [preferredTemperatureUnit, setPreferredTemperatureUnit] = useState(initialTemperatureUnit);
4
4
  const [reduxTable, setReduxTable] = useState<TTable>(initialTable);
@@ -1 +1 @@
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-CISvZMxX.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-HrLaMLbx.js";import"./label-CqmyC9he.js";import"./common-types-Sih75Sav.js";import"./help-icon-Buhx5nl6.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./heading-CRNoBc7q.js";import"./select-Cwks-WA0.js";import"./lodash-c4VUpsOs.js";import"./types-Dx2TtIG9.js";import"./enum-Bnn40S8Q.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-Bax0KeqM.js";import"./button-Cbv7WK6k.js";import"./spinner-AWUe4xwQ.js";import"./badge-CLQ59MDF.js";import"./select.input-CJed_LLR.js";import"./helpers-JJxzGegQ.js";import"./toggle-BbFVf61v.js";import"./initialize-context-Y03pJPr5.js";import"./number-input-B3_gmeWr.js";import"./input-Db9WkmPP.js";import"./table-DoyDBG6l.js";import"./index.es-DazXb-ul.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./pagination-CR1nxnnq.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./check-box-DPLaOkRR.js";import"./slider-CcpE4BLD.js";import"./index-BI4_Bp97.js";import"./popover-C_2P8LFJ.js";const wt={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 yt=["Test"];export{u as Test,yt as __namedExportsOrder,wt as default};
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-DwZVHcZo.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-HrLaMLbx.js";import"./label-CqmyC9he.js";import"./common-types-Sih75Sav.js";import"./help-icon-Buhx5nl6.js";import"./tooltip-1V7clEnw.js";import"./index-CUZDtIZe.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./heading-CRNoBc7q.js";import"./select-Cwks-WA0.js";import"./lodash-c4VUpsOs.js";import"./types-Dx2TtIG9.js";import"./enum-Bnn40S8Q.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-Bax0KeqM.js";import"./button-Cbv7WK6k.js";import"./spinner-AWUe4xwQ.js";import"./badge-CLQ59MDF.js";import"./select.input-CJed_LLR.js";import"./helpers-JJxzGegQ.js";import"./toggle-BbFVf61v.js";import"./initialize-context-Y03pJPr5.js";import"./number-input-B3_gmeWr.js";import"./input-Db9WkmPP.js";import"./table-BSABGfWm.js";import"./index.es-DazXb-ul.js";import"./redux-tRgGMjwY.js";import"./objectSpread2-DW4nTBoq.js";import"./tiny-invariant-DqLgxztJ.js";import"./pagination-CR1nxnnq.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./check-box-DPLaOkRR.js";import"./slider-DxaD8LU4.js";import"./index-BI4_Bp97.js";import"./popover-C_2P8LFJ.js";const wt={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 yt=["Test"];export{u as Test,yt as __namedExportsOrder,wt as default};
@@ -509,7 +509,7 @@
509
509
  }
510
510
  </script>
511
511
 
512
- <script type="module" crossorigin src="./assets/iframe-QRTUElpr.js"></script>
512
+ <script type="module" crossorigin src="./assets/iframe-zFwPc0wJ.js"></script>
513
513
  </head>
514
514
 
515
515
  <body>