@oliasoft-open-source/react-ui-library 4.1.11 → 4.2.0-beta-2

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 (142) hide show
  1. package/dist/assets/{index-9e4179c3.css → index-0d78a198.css} +3 -0
  2. package/dist/assets/{index-cfa07a3f.js → index-26f804a8.js} +180 -175
  3. package/dist/global.css +3 -0
  4. package/dist/index.d.ts +54 -0
  5. package/dist/index.html +1 -1
  6. package/dist/index.js +822 -400
  7. package/dist/index.js.map +1 -1
  8. package/dist/storybook/assets/Color-6VNJS4EI-4c266928.js +1 -0
  9. package/dist/storybook/assets/DocsRenderer-NNNQARDV-4522c04a.js +1 -0
  10. package/dist/storybook/assets/WithTooltip-4HIR6TLV-3f797c81.js +1 -0
  11. package/dist/storybook/assets/{accordion-1b587708.js → accordion-168fa7c5.js} +1 -1
  12. package/dist/storybook/assets/{accordion.stories-c0594576.js → accordion.stories-0f8af16e.js} +1 -1
  13. package/dist/storybook/assets/{actions-83a2a04e.js → actions-2d4e1c8e.js} +1 -1
  14. package/dist/storybook/assets/{actions.stories-a38cd26e.js → actions.stories-81a7cb7a.js} +1 -1
  15. package/dist/storybook/assets/{afe.stories-7e91eae9.js → afe.stories-afb9be07.js} +2 -2
  16. package/dist/storybook/assets/{badge.stories-1cbf35f9.js → badge.stories-5ce7957f.js} +1 -1
  17. package/dist/storybook/assets/{blowout.stories-af7f9432.js → blowout.stories-ee7f932b.js} +1 -1
  18. package/dist/storybook/assets/{button-050c998a.js → button-74c97e4a.js} +1 -1
  19. package/dist/storybook/assets/{button-group-0176fca3.js → button-group-fa895d0c.js} +1 -1
  20. package/dist/storybook/assets/{button-group.stories-7659a587.js → button-group.stories-22f072b7.js} +1 -1
  21. package/dist/storybook/assets/{button.stories-5f73ddef.js → button.stories-9b954335.js} +1 -1
  22. package/dist/storybook/assets/buttons-and-links-3ca65a4b.js +14 -0
  23. package/dist/storybook/assets/{card.stories-0437a4e2.js → card.stories-537a1772.js} +1 -1
  24. package/dist/storybook/assets/{casing-loads.stories-825f83a2.js → casing-loads.stories-cfbab702.js} +1 -1
  25. package/dist/storybook/assets/{cell.stories-f38059bb.js → cell.stories-524a7418.js} +1 -1
  26. package/dist/storybook/assets/{check-box-b38490e5.js → check-box-e21258d5.js} +1 -1
  27. package/dist/storybook/assets/{check-box.stories-9bf1c260.js → check-box.stories-5f7d06e0.js} +1 -1
  28. package/dist/storybook/assets/{chunk-HLWAVYOI-666e47c8.js → chunk-HLWAVYOI-6bd5aff8.js} +1 -1
  29. package/dist/storybook/assets/color-6f498d70.js +25 -0
  30. package/dist/storybook/assets/{column.stories-d5ca2c42.js → column.stories-ae7588c5.js} +1 -1
  31. package/dist/storybook/assets/{dialog-c036ff34.js → dialog-cd58dd09.js} +1 -1
  32. package/dist/storybook/assets/{drawer-308b0a03.js → drawer-7f450988.js} +1 -1
  33. package/dist/storybook/assets/{drawer.stories-d76c0577.js → drawer.stories-39625e91.js} +2 -2
  34. package/dist/storybook/assets/{empty.stories-30fdd793.js → empty.stories-e0e3ac78.js} +1 -1
  35. package/dist/storybook/assets/{field-248df38c.js → field-a094cd72.js} +1 -1
  36. package/dist/storybook/assets/{field.stories-60d1a82f.js → field.stories-f1318053.js} +1 -1
  37. package/dist/storybook/assets/{file-input.stories-a7e96582.js → file-input.stories-1c6ce0ea.js} +1 -1
  38. package/dist/storybook/assets/{flex.stories-6a278b40.js → flex.stories-09e9c602.js} +1 -1
  39. package/dist/storybook/assets/footer.stories-57f07ea2.js +3 -0
  40. package/dist/storybook/assets/form.stories-45c0cd59.js +49 -0
  41. package/dist/storybook/assets/formation.stories-5eeaa826.js +74 -0
  42. package/dist/storybook/assets/{formatter-SWP5E3XI-9c4ced01.js → formatter-SWP5E3XI-cf89c041.js} +2 -2
  43. package/dist/storybook/assets/{heading-39e599c8.js → heading-d29eb744.js} +1 -1
  44. package/dist/storybook/assets/{heading.stories-6ff7f5ed.js → heading.stories-9689bddc.js} +1 -1
  45. package/dist/storybook/assets/{help-icon-c0abd380.js → help-icon-d4189b1b.js} +1 -1
  46. package/dist/storybook/assets/{help-icon.stories-a30b7058.js → help-icon.stories-15d1620d.js} +1 -1
  47. package/dist/storybook/assets/icon-e9cbb4d7.js +8 -0
  48. package/dist/storybook/assets/{icon.stories-466d158f.js → icon.stories-8dae69e1.js} +1 -1
  49. package/dist/storybook/assets/iframe-4241ee87.js +1 -0
  50. package/dist/storybook/assets/{index-321d8456.js → index-24b2d8c6.js} +4 -4
  51. package/dist/storybook/assets/{number-input-7cb3ea4d.js → index-57d7693e.js} +9 -9
  52. package/dist/storybook/assets/{index.es-37e2ce0d.js → index.es-85cc7dfc.js} +4 -4
  53. package/dist/storybook/assets/inheritsLoose-d4851ab8.js +1 -0
  54. package/dist/storybook/assets/{input-05f21b51.js → input-d68625a5.js} +1 -1
  55. package/dist/storybook/assets/{input-group.stories-8bfc754d.js → input-group.stories-a2a3400e.js} +2 -2
  56. package/dist/storybook/assets/{input-validation-6c75c726.js → input-validation-ca50f656.js} +2 -2
  57. package/dist/storybook/assets/{input.stories-bf58ba7c.js → input.stories-164d93ab.js} +1 -1
  58. package/dist/storybook/assets/{inputs-d5e439a7.js → inputs-48a26c2d.js} +1 -1
  59. package/dist/storybook/assets/{label-e6d15b59.js → label-13d490a3.js} +1 -1
  60. package/dist/storybook/assets/{label.stories-1c98204a.js → label.stories-427ba162.js} +1 -1
  61. package/dist/storybook/assets/layout-forms-ee9889f6.js +16 -0
  62. package/dist/storybook/assets/{layout-general-7f5a030f.js → layout-general-2d6bd6c2.js} +2 -2
  63. package/dist/storybook/assets/{list-bc0d9ad9.js → list-0dc3df85.js} +1 -1
  64. package/dist/storybook/assets/{list-heading-2215213f.js → list-heading-88cc8a9b.js} +1 -1
  65. package/dist/storybook/assets/{list.stories-c8b4f325.js → list.stories-5715452e.js} +2 -2
  66. package/dist/storybook/assets/{list.stories-data-ba40864f.js → list.stories-data-94f7c623.js} +1 -1
  67. package/dist/storybook/assets/{loader.stories-4e8e8df7.js → loader.stories-6107832a.js} +1 -1
  68. package/dist/storybook/assets/{menu.stories-8d724757.js → menu.stories-927adf3d.js} +1 -1
  69. package/dist/storybook/assets/{message-0b5ae3c5.js → message-7e627e60.js} +1 -1
  70. package/dist/storybook/assets/{message.stories-9b9c40c4.js → message.stories-f41a0c22.js} +1 -1
  71. package/dist/storybook/assets/{modal.stories-0cc6a0bb.js → modal.stories-0e068cc1.js} +2 -2
  72. package/dist/storybook/assets/number-input-7d49b0b3.js +1 -0
  73. package/dist/storybook/assets/{number-input.stories-cc2fcc11.js → number-input.stories-02528124.js} +1 -1
  74. package/dist/storybook/assets/{option-dropdown.stories-4c391727.js → option-dropdown.stories-5030bdb8.js} +1 -1
  75. package/dist/storybook/assets/{padding-and-spacing-51ac7658.js → padding-and-spacing-c11842e2.js} +2 -2
  76. package/dist/storybook/assets/{page.stories-b69a6953.js → page.stories-7cb68fed.js} +1 -1
  77. package/dist/storybook/assets/{pagination-fec74b7e.js → pagination-8aade846.js} +1 -1
  78. package/dist/storybook/assets/{pagination.stories-72183c57.js → pagination.stories-423b4938.js} +2 -2
  79. package/dist/storybook/assets/{pop-confirm.stories-3016f322.js → pop-confirm.stories-81b30901.js} +1 -1
  80. package/dist/storybook/assets/{popover-c1234faa.js → popover-06e375a5.js} +1 -1
  81. package/dist/storybook/assets/popover.stories-f651a81c.js +1 -0
  82. package/dist/storybook/assets/preview-ea6061e8.js +1 -0
  83. package/dist/storybook/assets/{preview-2f05745a.js → preview-f4241840.js} +3 -3
  84. package/dist/storybook/assets/projects.stories-3884a80c.js +47 -0
  85. package/dist/storybook/assets/{radio-button-d69b72e4.js → radio-button-135a9615.js} +1 -1
  86. package/dist/storybook/assets/{radio-button.stories-6ff0dc9b.js → radio-button.stories-0e8377ea.js} +1 -1
  87. package/dist/storybook/assets/{reservoirs.stories-ae41be59.js → reservoirs.stories-6b14a37f.js} +2 -2
  88. package/dist/storybook/assets/{rich-text-input.stories-986f747c.js → rich-text-input.stories-661f34f1.js} +3 -3
  89. package/dist/storybook/assets/{row.stories-d97c751c.js → row.stories-d5b6b4a6.js} +1 -1
  90. package/dist/storybook/assets/select-205cd538.js +1 -0
  91. package/dist/storybook/assets/{select.stories-f81a3e79.js → select.stories-60f055e6.js} +60 -25
  92. package/dist/storybook/assets/{side-bar-10cceacd.js → side-bar-88e8cf41.js} +1 -1
  93. package/dist/storybook/assets/{side-bar.stories-02211e0d.js → side-bar.stories-2c06f8a6.js} +1 -1
  94. package/dist/storybook/assets/{site.stories-ae79a20c.js → site.stories-dee8ce1c.js} +2 -2
  95. package/dist/storybook/assets/slider-160e2152.js +7 -0
  96. package/dist/storybook/assets/{slider.stories-a55df653.js → slider.stories-79ab0e97.js} +2 -2
  97. package/dist/storybook/assets/{spacer.stories-a2798d47.js → spacer.stories-38071af8.js} +1 -1
  98. package/dist/storybook/assets/syntaxhighlighter-NMPM6SWI-2e6bd966.js +1 -0
  99. package/dist/storybook/assets/{table-e1565225.js → table-da6f6045.js} +1 -1
  100. package/dist/storybook/assets/{table.stories-3f11111c.js → table.stories-67a3023a.js} +1 -1
  101. package/dist/storybook/assets/{table.stories-data-ddbcf8c3.js → table.stories-data-8a836b92.js} +1 -1
  102. package/dist/storybook/assets/{textarea-598f9fff.js → textarea-d48efea2.js} +1 -1
  103. package/dist/storybook/assets/{textarea.stories-3902f4aa.js → textarea.stories-89c8afd7.js} +1 -1
  104. package/dist/storybook/assets/{title.stories-c8601d39.js → title.stories-5b4a226c.js} +1 -1
  105. package/dist/storybook/assets/{toaster-f096ba56.js → toaster-541ce85b.js} +1 -1
  106. package/dist/storybook/assets/{toaster.stories-66162195.js → toaster.stories-5e4d95b1.js} +1 -1
  107. package/dist/storybook/assets/{toggle-6f4d5797.js → toggle-bb34b2a2.js} +1 -1
  108. package/dist/storybook/assets/{toggle.stories-a289f544.js → toggle.stories-b771ed81.js} +1 -1
  109. package/dist/storybook/assets/{tooltip-856042a7.js → tooltip-23e84186.js} +1 -1
  110. package/dist/storybook/assets/{tooltip.stories-666868d0.js → tooltip.stories-e8ba5fff.js} +1 -1
  111. package/dist/storybook/assets/{tooltip.test-case.stories-4c1ea273.js → tooltip.test-case.stories-9817078b.js} +1 -1
  112. package/dist/storybook/assets/{top-bar-38689fe2.js → top-bar-a84b9365.js} +1 -1
  113. package/dist/storybook/assets/{top-bar.stories-3d9a6da1.js → top-bar.stories-e93330f0.js} +1 -1
  114. package/dist/storybook/assets/{top-bar.testcase.stories-dc051455.js → top-bar.testcase.stories-3a824a14.js} +1 -1
  115. package/dist/storybook/assets/{tree.stories-729aebd7.js → tree.stories-590bdd69.js} +1 -1
  116. package/dist/storybook/assets/unit-input.stories-c251e2c8.css +1 -0
  117. package/dist/storybook/assets/unit-input.stories-ca28e74b.js +257 -0
  118. package/dist/storybook/iframe.html +1 -1
  119. package/dist/storybook/index.json +1 -1
  120. package/dist/storybook/project.json +1 -1
  121. package/dist/storybook/stories.json +1 -1
  122. package/package.json +1 -1
  123. package/dist/404.html +0 -1
  124. package/dist/storybook/assets/Color-6VNJS4EI-4e3c6900.js +0 -1
  125. package/dist/storybook/assets/DocsRenderer-NNNQARDV-78819900.js +0 -1
  126. package/dist/storybook/assets/WithTooltip-4HIR6TLV-051215cb.js +0 -1
  127. package/dist/storybook/assets/buttons-and-links-84e3426b.js +0 -14
  128. package/dist/storybook/assets/color-8a098cdf.js +0 -25
  129. package/dist/storybook/assets/extends-98964cd2.js +0 -1
  130. package/dist/storybook/assets/footer.stories-5b3c1620.js +0 -3
  131. package/dist/storybook/assets/form.stories-41ecd579.js +0 -49
  132. package/dist/storybook/assets/formation.stories-30bc36d4.js +0 -74
  133. package/dist/storybook/assets/icon-8acf9925.js +0 -8
  134. package/dist/storybook/assets/iframe-c82204d3.js +0 -1
  135. package/dist/storybook/assets/inheritsLoose-c82a83d4.js +0 -1
  136. package/dist/storybook/assets/layout-forms-9a0c6c34.js +0 -16
  137. package/dist/storybook/assets/popover.stories-3e4a0b6f.js +0 -1
  138. package/dist/storybook/assets/preview-64f6671a.js +0 -1
  139. package/dist/storybook/assets/projects.stories-104a0c19.js +0 -47
  140. package/dist/storybook/assets/select-1a8fd9be.js +0 -1
  141. package/dist/storybook/assets/slider-5d5442fe.js +0 -7
  142. package/dist/storybook/assets/syntaxhighlighter-NMPM6SWI-7352c231.js +0 -1
@@ -0,0 +1,257 @@
1
+ import{j as e}from"./jsx-runtime-f961835c.js";import{r as c}from"./index-f80c8c95.js";import{d as r,r as Yt}from"./index-57d7693e.js";import{c as Zt}from"./index-a80ed1cf.js";import{M as Ie}from"./actions-2d4e1c8e.js";import{I as Gt}from"./input-group-addon-f8f6683a.js";import{B as d}from"./button-74c97e4a.js";import{T as Qt}from"./tooltip-23e84186.js";import{I as Xt}from"./input-group-20c3add3.js";import{S as N}from"./spacer-54db0620.js";import{T as en}from"./text-ad1f5f1d.js";import{I as tn}from"./input-d68625a5.js";import{M as ke}from"./types-cc224262.js";import{l as w}from"./lodash-75c70a11.js";import{D as nn}from"./divider-182aa58c.js";import{R as Et,C as ce}from"./row-2299f0e7.js";import{F as j}from"./field-a094cd72.js";import{a as pe}from"./message-7e627e60.js";import"./index-54f0d271.js";import"./common-types-2c81813f.js";import"./disabled-context-d654f6ff.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./spinner-a81ebe38.js";import"./index-3d476d02.js";import"./styled-components.browser.esm-416d73e5.js";import"./label-13d490a3.js";import"./help-icon-d4189b1b.js";const an=()=>{const t=c.useRef(null);return c.useLayoutEffect(()=>{t.current&&(t.current(),t.current=null)}),n=>{t.current=n}},ln=t=>{const a=c.useRef();return c.useEffect(()=>{a.current=t},[t]),a.current},rn=(t,a)=>{const n=a==null?void 0:a[t];return n||(console.log(`Warning: unitTemplate is ${a}, unitkey is ${t}`),r.unitFromQuantity(t)??"")};var C=(t=>(t.CUSTOM="custom",t.PREDEFINED="predefined",t))(C||{});const me=t=>t==="undefined"||t===void 0||t===""||t==="null"||t===null||t==="NaN"||isNaN(t),Nt=(t="",a,n="",i=!1)=>{if(a&&!i)try{const u=me(t)?t:r.isValueWithUnit(t)?r.convertSamePrecision(t,a):r.convertSamePrecision(r.withUnit(t,n),a);return r.getValue(u)}catch{}return""},F=(t="",a,n,i)=>{const u=r.isValueWithUnit(t),m=u&&me(r.getValue(t))||!u&&me(t);return u?m?"":Nt(r.getValue(t),a,n,i):m?"":t},Se=t=>w.isObject(t)&&!w.isArray(t)&&!w.isFunction(t)?w.get(t,"fieldName",""):typeof t=="string"?t:"",sn=t=>w.isObjectLike(t)&&w.has(t,"message"),un=t=>typeof t=="string"?t:sn(t)?t.message:null;var on=Yt();const dn=t=>t.search(RegExp(/(^0{2}\.)|(^0+[1-9])/g))===0,we=(t,a)=>{var k;const{allowEmpty:n=!1,autoValue:i,placeholder:u,disabledValidation:m=!1}=a||{},s=String(t);if(m||i||u)return null;const p=on.isValueWithUnit(s)?r.getValue(s):s;if(n&&p==="")return null;if(dn(p))return"Invalid number format due to leading zeroes";const v=r.validateNumber(p);if(!v.valid){const ae=((k=v==null?void 0:v.errors)==null?void 0:k[0])??null;return un(ae)}return null},cn="_predefinedMenuActive_1yvt4_1",mn={predefinedMenuActive:cn},h=({name:t,placeholder:a="",disabled:n=!1,disabledUnit:i=!1,error:u=null,left:m=!1,small:s=!1,width:p="100%",value:v,unitkey:k="",initUnit:ae,noConversion:At=!1,onChange:le=()=>{},onClick:gn=()=>{},onFocus:Pt=()=>{},onSwitchUnit:ge=()=>{},unitTemplate:Dt,doNotConvertValue:A=!1,testId:S,warning:Ft=null,predefinedOptions:x,initialPredefinedOption:Mt=!1,shouldLinkAutomaticly:he=!0,selectedPredefinedOptionKey:ve,validationCallback:fe=()=>({name:"",error:null}),disabledValidation:Ce=!1,allowEmpty:be=!1,autoValue:V})=>{typeof v=="number"&&(v=`${v}`);const _t=an(),[re="",P=""]=v!==void 0?r.split(v):[],ye=V?r.getUnit(V):"",Ot=rn(k,Dt),y=ae||Ot||P,Bt=ln(y),Ue=F(v,y,P,A),xe=F(V,y,ye,A),qt=Ue!==""?{value:Ue,unit:y}:xe!==""?{value:xe,unit:y}:{value:re,unit:P},[g,J]=c.useState(qt),[Rt,se]=c.useState(null),[I,ie]=c.useState(Mt?C.PREDEFINED:C.CUSTOM),ue=re===""&&V,D=x&&x.find(l=>{if(ve)return ve===l.valueKey;const o=r.isValueWithUnit(l.value)?r.getUnit(l.value):"";return r.withUnit(Nt(String(v),o),o)===l.value}),Wt=()=>{if(k)try{const l=String(ue?V:v??"");let o=r.altUnitsList(l,k);return r.getValue(l)===""?o.map(f=>["",f[1]]):o}catch{return null}},Tt=l=>{const o=Se(t),f=l.target,{value:U,selectionStart:Q}=f,je=r.cleanNumStr(U.replaceAll(" ","").replaceAll("|","")),oe=r.withUnit(je,(g==null?void 0:g.unit)||""),Kt=r.getValue(oe),de=we(Kt,{allowEmpty:be,autoValue:V,placeholder:a,disabledValidation:Ce});if(de===null){le({target:{value:oe,name:o}});const[zt,Jt]=r.split(oe);J({value:zt,unit:Jt}),se(null),fe(o,null)}else J({value:je,unit:g.unit}),se(de),fe(o,de);_t(()=>{f.selectionStart=Q,f.selectionEnd=Q})},Lt=(l,o)=>{o===g.unit||isNaN(Number(l))||(J({value:l,unit:o}),ge&&ge(o))};c.useEffect(()=>{if(y){let f,U="";Bt!==y?(f=F(String(v),y,P,A),U=y):r.withUnit(g.value,g.unit)!==v&&(f=F(String(v),g.unit,P,A),U=g.unit),f!==void 0&&J({value:f,unit:U}),x&&ie(D&&he?C.PREDEFINED:C.CUSTOM)}const l=r.withUnit(r.checkAndCleanDecimalComma(re),(g==null?void 0:g.unit)||""),o=we(l,{allowEmpty:be,autoValue:V,placeholder:a,disabledValidation:Ce});se(o)},[y,v,u,he]);const Y=Wt(),Z=r.label(g.unit)||g.unit||"",$t=At||!Y||Y&&Y.length===1,Ve=Se(t);let G;const Ht=l=>{const[o,f=""]=r.isValueWithUnit(l.value)?r.split(l.value):[l.value];return{type:ke.OPTION,inline:!0,onClick:()=>{r.validateNumber(o).valid&&!n&&(ie(C.PREDEFINED),le({target:{value:l.value,name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||"",predefinedSelected:!0,predefinedOption:l}}))},label:e.jsxs(e.Fragment,{children:[e.jsx(en,{children:l.label}),e.jsx(N,{width:"20px",height:"0"})]}),description:r.isValueWithUnit(l.value)?`${o} ${f}`:l.value,selected:D===l&&I===C.PREDEFINED}};if(G=[{type:ke.OPTION,inline:!0,onClick:()=>{I!==C.CUSTOM&&!n&&le({target:{value:r.withUnit(g.value,g.unit),name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||""}})},label:"Custom",selected:I===C.CUSTOM}],x!=null&&x.length){const l=x.map(Ht);G=[...G,...l]}return e.jsx("div",{className:I===C.PREDEFINED?Zt(mn.predefinedMenuActive):"",children:e.jsxs(Xt,{small:s,width:p,children:[x&&e.jsx(Qt,{text:I===C.PREDEFINED?D==null?void 0:D.label:"",children:e.jsx(Ie,{maxHeight:380,groupOrder:"first",testId:S&&`${S}-predefined-menu`,disabled:n,menu:{colored:!0,trigger:"Component",component:e.jsx(d,{groupOrder:"first",active:I===C.PREDEFINED,icon:I===C.PREDEFINED?"link":"unlink"}),small:s,sections:G}})}),e.jsx(tn,{type:"text",name:Ve,testId:S,disabled:n,placeholder:ue?F(V,g.unit,ye,A):a,value:g.value,onChange:Tt,onFocus:Pt,error:u||Rt,warning:Ft,right:!m},Ve),Z&&($t?e.jsx(Gt,{groupOrder:"last",children:Z}):e.jsx(Ie,{maxHeight:380,groupOrder:"last",disabled:i,testId:S&&`${S}-menu`,menu:{label:Z,trigger:"DropDownButton",small:s,sections:Y.map(([l,o,f])=>{const U=f||o||"";return{type:"Option",label:isNaN(Number(l))?"":l,inline:!0,onClick:Q=>{Q.stopPropagation(),Lt(ue?"":l,o)},description:U,selected:U===Z,testId:`${S}-unit-${U}`}})}}))]})})};try{h.displayName="UnitInput",h.__docgenInfo={description:"",displayName:"UnitInput",props:{name:{defaultValue:null,description:"",name:"name",required:!0,type:{name:"string | { fieldName?: string | undefined; }"}},placeholder:{defaultValue:{value:""},description:"",name:"placeholder",required:!1,type:{name:"string"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},disabledUnit:{defaultValue:{value:"false"},description:"",name:"disabledUnit",required:!1,type:{name:"boolean"}},error:{defaultValue:{value:"null"},description:"",name:"error",required:!1,type:{name:"string | boolean | null"}},left:{defaultValue:{value:"false"},description:"",name:"left",required:!1,type:{name:"boolean"}},small:{defaultValue:{value:"false"},description:"",name:"small",required:!1,type:{name:"boolean"}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string | number"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"string | number"}},unitkey:{defaultValue:{value:""},description:"",name:"unitkey",required:!1,type:{name:"string"}},initUnit:{defaultValue:null,description:"",name:"initUnit",required:!1,type:{name:"string"}},noConversion:{defaultValue:{value:"false"},description:"",name:"noConversion",required:!1,type:{name:"boolean"}},doNotConvertValue:{defaultValue:{value:"false"},description:"",name:"doNotConvertValue",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}},warning:{defaultValue:{value:"null"},description:"",name:"warning",required:!1,type:{name:"string | null"}},predefinedOptions:{defaultValue:null,description:"",name:"predefinedOptions",required:!1,type:{name:"IPredefinedOption[]"}},initialPredefinedOption:{defaultValue:{value:"false"},description:"",name:"initialPredefinedOption",required:!1,type:{name:"boolean"}},shouldLinkAutomaticly:{defaultValue:{value:"true"},description:"",name:"shouldLinkAutomaticly",required:!1,type:{name:"boolean"}},selectedPredefinedOptionKey:{defaultValue:null,description:"",name:"selectedPredefinedOptionKey",required:!1,type:{name:"string"}},validationCallback:{defaultValue:{value:"() => ({ name: '', error: null })"},description:"",name:"validationCallback",required:!1,type:{name:"((name: string, message: string | null) => { name: string; error: string | null; })"}},disabledValidation:{defaultValue:{value:"false"},description:"",name:"disabledValidation",required:!1,type:{name:"boolean"}},allowEmpty:{defaultValue:{value:"false"},description:"",name:"allowEmpty",required:!1,type:{name:"boolean"}},autoValue:{defaultValue:null,description:"",name:"autoValue",required:!1,type:{name:"string"}},onChange:{defaultValue:{value:"() => {}"},description:"",name:"onChange",required:!1,type:{name:"(event: ChangeEvent<HTMLInputElement> | ICustomChangeEvent) => void"}},onSwitchUnit:{defaultValue:{value:"() => {}"},description:"",name:"onSwitchUnit",required:!1,type:{name:"((unit: string) => void)"}},onClick:{defaultValue:{value:"() => {}"},description:"",name:"onClick",required:!1,type:{name:"MouseEventHandler<HTMLInputElement>"}},onFocus:{defaultValue:{value:"() => {}"},description:"",name:"onFocus",required:!1,type:{name:"FocusEventHandler<HTMLInputElement>"}},unitTemplate:{defaultValue:null,description:"",name:"unitTemplate",required:!1,type:{name:"Record<string, any>"}}}}}catch{}const{useArgs:pn}=__STORYBOOK_MODULE_ADDONS__,zn={title:"Basic/UnitInput",component:h,args:{name:"example",unitkey:"length",value:"123|m"}},b=t=>{const[a,n]=pn(),i=u=>{n({value:u.target.value})};return e.jsx(h,{...t,onChange:i})},X=b.bind({}),M=b.bind({});M.args={initUnit:"ft",unitTemplate:{length:"ft"}};const _=b.bind({});_.args={width:"180px"};const O=b.bind({});O.args={noConversion:!0};const B=b.bind({});B.args={small:!0};const q=b.bind({});q.args={error:"Error message goes here"};const R=b.bind({});R.args={value:"asas123asd|%"};const E=b.bind({});E.args={disabled:!0,disabledUnit:!0};E.parameters={docs:{description:{story:"Each part of UnitInput can be disabled separately. `disabled` disables only the main text input, `disabledUnit` disables only the unit menu. **Needs review (comes from Reservoir input requirements)**"}}};const W=b.bind({});W.args={disabled:!0,disabledUnit:!0,noConversion:!0};const T=b.bind({});T.args={disabledUnit:!0,unitkey:void 0};const L=b.bind({});L.args={disabledUnit:!0,unitkey:"length"};const $=b.bind({});$.args={disabledUnit:!1,disabled:!0};const H=t=>{const[a,n]=c.useState("123|m"),[i,u]=c.useState("223|m"),[m,s]=c.useState("ft");return e.jsxs(e.Fragment,{children:[e.jsx(d,{label:"Change initUnit",onClick:()=>s(m==="m"?"ft":"m")}),e.jsx(N,{}),e.jsx(d,{label:"Change value",onClick:()=>n(a==="123|m"?"456|m":"123|m")}),e.jsx(N,{}),e.jsx(h,{name:"example",onChange:p=>{n(p.target.value)},unitkey:"length",value:a,initUnit:m,onSwitchUnit:s}),e.jsx(N,{}),e.jsx(h,{name:"example2",onChange:p=>{u(p.target.value)},unitkey:"length",value:i,initUnit:m,onSwitchUnit:s}),e.jsx(nn,{}),e.jsx("h4",{children:"Without initUnit property (taken from the redux store)"}),e.jsx(h,{name:"example",onChange:p=>{n(p.target.value)},unitkey:"length",value:a,onSwitchUnit:s}),e.jsx(h,{name:"example2",onChange:p=>{u(p.target.value)},unitkey:"length",value:i,onSwitchUnit:s})]})};H.parameters={docs:{description:{story:"[OW-4380](https://oliasoft.atlassian.net/browse/OW-4380?atlOrigin=eyJpIjoiMmM1N2RkNWU3Mjk5NDYxY2E0YzhkMzk5ZTVmZTJhMjciLCJwIjoiaiJ9)"}}};const K=b.bind({});K.args={predefinedOptions:[{label:"bottom of casing",value:"12|km"},{label:"mud weight at shoe depth",value:"8|mm"}]};const z=()=>{const t="500px",[a,n]=c.useState(void 0);return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different edge cases such as +/- infinity, undefined, NaN, null:"}),e.jsxs(Et,{children:[e.jsxs(ce,{width:"25%",children:[e.jsx(d,{label:"Change value infinity",onClick:()=>n(1/0)}),e.jsx("br",{}),e.jsx(d,{label:"Change value -infinity",onClick:()=>n(-1/0)}),e.jsx("br",{}),e.jsx(d,{label:"Change value null",onClick:()=>n(null)}),e.jsx("br",{}),e.jsx(d,{label:"Change value - undefined",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(d,{label:"Change value - NaN",onClick:()=>n(NaN)}),e.jsx("br",{}),e.jsx(d,{label:"Change value - nothing (empty)",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(d,{label:"Change value - empty string",onClick:()=>n("")})]}),e.jsxs(ce,{width:"25%",children:[e.jsx(d,{label:"Change value infinity|m",onClick:()=>n("Infinity|m")}),e.jsx("br",{}),e.jsx(d,{label:"Change value -infinity|m",onClick:()=>n("-Infinity|m")}),e.jsx("br",{}),e.jsx(d,{label:"Change value null|m",onClick:()=>n(null+"|m")}),e.jsx("br",{}),e.jsx(d,{label:"Change value - undefined|m",onClick:()=>n(void 0+"|m")}),e.jsx("br",{}),e.jsx(d,{label:"Change value - NaN|m",onClick:()=>n("NaN|m")}),e.jsx("br",{}),e.jsx(d,{label:"Change value - nothing (empty)|m",onClick:()=>n("|m")})]})]}),e.jsx("br",{}),e.jsx(j,{label:"Normal PUI",children:e.jsx(h,{name:"example1",onChange:i=>n(i.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit"})}),e.jsx(j,{label:"Disabled validation",children:e.jsx(h,{name:"example2",onChange:i=>n(i.target.value),value:a,unitkey:"length",disabledValidation:!0,width:t})}),e.jsx(j,{label:"Disabled validation and manual error",children:e.jsx(h,{name:"example3",onChange:i=>n(i.target.value),value:a,unitkey:"length",error:"test",disabledValidation:!0,width:t})}),e.jsx(pe,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})},ee=()=>{const t="500px",[a,n]=c.useState("1|m"),[i,u]=c.useState("|m"),m="123|km";return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different cases for automatic (placeholder) values:"}),e.jsx(Et,{children:e.jsxs(ce,{width:"25%",children:[e.jsx(d,{label:"Change value to ''",onClick:()=>n("")}),e.jsx("br",{}),e.jsx(d,{label:"Change value to 1",onClick:()=>n(1)}),e.jsx("br",{}),e.jsx(d,{label:"Change value to 1|m",onClick:()=>n("1|m")}),e.jsx("br",{}),e.jsx(d,{label:"Change value to |m - empty value",onClick:()=>n("|m")})]})}),e.jsx("br",{}),e.jsx(j,{label:"Normal PUI (placeholder + auto)",children:e.jsx(h,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit",autoValue:m})}),e.jsx(j,{label:"Normal PUI (only auto)",children:e.jsx(h,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,autoValue:m})}),e.jsx(j,{label:"Empty PUI with autoValue",children:e.jsx(h,{name:"example1",onChange:s=>u(s.target.value),value:i,unitkey:"length",width:t,autoValue:m})}),e.jsx(j,{label:"Normal PUI (only placeholder)",children:e.jsx(h,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test"})}),e.jsx(j,{label:"Normal PUI (placeholder + allowEmpty)",children:e.jsx(h,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test",allowEmpty:!0})}),e.jsx(pe,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})};z.parameters={docs:{description:{story:"[OW-8884](https://oliasoft.atlassian.net/browse/OW-8884)"}}};const te=()=>{const[t,a]=c.useState("123|%"),[n,i]=c.useState(null),u="This should be visible when an error appears",m=(s,p)=>(i(p),{name:s,error:p});return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"3rd party validation message when inputting invalid value:"}),e.jsx(h,{name:"example",onChange:s=>a(s.target.value),error:!n||u,validationCallback:m,value:t}),e.jsx("br",{}),e.jsx(N,{}),e.jsx("h4",{children:"Original validation message: "}),e.jsx(pe,{message:{heading:n,visible:!0}})]})},ne=()=>{const[t,a]=c.useState("123|m"),[n,i]=c.useState(""),[u,m]=c.useState("km"),s=()=>{m("ft"),i("placeholder"),a("|m")};return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Empty value case:"}),e.jsx(h,{name:"example",onChange:p=>a(p.target.value),value:t,allowEmpty:!0,placeholder:n,initUnit:u,unitkey:"length"}),e.jsx("br",{}),e.jsx(N,{}),e.jsx(d,{label:"Change value |m and unit ft",onClick:()=>s()})]})};var Ee,Ne,Ae;X.parameters={...X.parameters,docs:{...(Ee=X.parameters)==null?void 0:Ee.docs,source:{originalSource:`args => {
2
+ const [_, updateArgs] = useArgs();
3
+ const handleChange = (evt: any) => {
4
+ updateArgs({
5
+ value: evt.target.value
6
+ });
7
+ };
8
+ return <UnitInput {...args} onChange={handleChange} />;
9
+ }`,...(Ae=(Ne=X.parameters)==null?void 0:Ne.docs)==null?void 0:Ae.source}}};var Pe,De,Fe;M.parameters={...M.parameters,docs:{...(Pe=M.parameters)==null?void 0:Pe.docs,source:{originalSource:`args => {
10
+ const [_, updateArgs] = useArgs();
11
+ const handleChange = (evt: any) => {
12
+ updateArgs({
13
+ value: evt.target.value
14
+ });
15
+ };
16
+ return <UnitInput {...args} onChange={handleChange} />;
17
+ }`,...(Fe=(De=M.parameters)==null?void 0:De.docs)==null?void 0:Fe.source}}};var Me,_e,Oe;_.parameters={..._.parameters,docs:{...(Me=_.parameters)==null?void 0:Me.docs,source:{originalSource:`args => {
18
+ const [_, updateArgs] = useArgs();
19
+ const handleChange = (evt: any) => {
20
+ updateArgs({
21
+ value: evt.target.value
22
+ });
23
+ };
24
+ return <UnitInput {...args} onChange={handleChange} />;
25
+ }`,...(Oe=(_e=_.parameters)==null?void 0:_e.docs)==null?void 0:Oe.source}}};var Be,qe,Re;O.parameters={...O.parameters,docs:{...(Be=O.parameters)==null?void 0:Be.docs,source:{originalSource:`args => {
26
+ const [_, updateArgs] = useArgs();
27
+ const handleChange = (evt: any) => {
28
+ updateArgs({
29
+ value: evt.target.value
30
+ });
31
+ };
32
+ return <UnitInput {...args} onChange={handleChange} />;
33
+ }`,...(Re=(qe=O.parameters)==null?void 0:qe.docs)==null?void 0:Re.source}}};var We,Te,Le;B.parameters={...B.parameters,docs:{...(We=B.parameters)==null?void 0:We.docs,source:{originalSource:`args => {
34
+ const [_, updateArgs] = useArgs();
35
+ const handleChange = (evt: any) => {
36
+ updateArgs({
37
+ value: evt.target.value
38
+ });
39
+ };
40
+ return <UnitInput {...args} onChange={handleChange} />;
41
+ }`,...(Le=(Te=B.parameters)==null?void 0:Te.docs)==null?void 0:Le.source}}};var $e,He,Ke;q.parameters={...q.parameters,docs:{...($e=q.parameters)==null?void 0:$e.docs,source:{originalSource:`args => {
42
+ const [_, updateArgs] = useArgs();
43
+ const handleChange = (evt: any) => {
44
+ updateArgs({
45
+ value: evt.target.value
46
+ });
47
+ };
48
+ return <UnitInput {...args} onChange={handleChange} />;
49
+ }`,...(Ke=(He=q.parameters)==null?void 0:He.docs)==null?void 0:Ke.source}}};var ze,Je,Ye;R.parameters={...R.parameters,docs:{...(ze=R.parameters)==null?void 0:ze.docs,source:{originalSource:`args => {
50
+ const [_, updateArgs] = useArgs();
51
+ const handleChange = (evt: any) => {
52
+ updateArgs({
53
+ value: evt.target.value
54
+ });
55
+ };
56
+ return <UnitInput {...args} onChange={handleChange} />;
57
+ }`,...(Ye=(Je=R.parameters)==null?void 0:Je.docs)==null?void 0:Ye.source}}};var Ze,Ge,Qe;E.parameters={...E.parameters,docs:{...(Ze=E.parameters)==null?void 0:Ze.docs,source:{originalSource:`args => {
58
+ const [_, updateArgs] = useArgs();
59
+ const handleChange = (evt: any) => {
60
+ updateArgs({
61
+ value: evt.target.value
62
+ });
63
+ };
64
+ return <UnitInput {...args} onChange={handleChange} />;
65
+ }`,...(Qe=(Ge=E.parameters)==null?void 0:Ge.docs)==null?void 0:Qe.source}}};var Xe,et,tt;W.parameters={...W.parameters,docs:{...(Xe=W.parameters)==null?void 0:Xe.docs,source:{originalSource:`args => {
66
+ const [_, updateArgs] = useArgs();
67
+ const handleChange = (evt: any) => {
68
+ updateArgs({
69
+ value: evt.target.value
70
+ });
71
+ };
72
+ return <UnitInput {...args} onChange={handleChange} />;
73
+ }`,...(tt=(et=W.parameters)==null?void 0:et.docs)==null?void 0:tt.source}}};var nt,at,lt;T.parameters={...T.parameters,docs:{...(nt=T.parameters)==null?void 0:nt.docs,source:{originalSource:`args => {
74
+ const [_, updateArgs] = useArgs();
75
+ const handleChange = (evt: any) => {
76
+ updateArgs({
77
+ value: evt.target.value
78
+ });
79
+ };
80
+ return <UnitInput {...args} onChange={handleChange} />;
81
+ }`,...(lt=(at=T.parameters)==null?void 0:at.docs)==null?void 0:lt.source}}};var rt,st,it;L.parameters={...L.parameters,docs:{...(rt=L.parameters)==null?void 0:rt.docs,source:{originalSource:`args => {
82
+ const [_, updateArgs] = useArgs();
83
+ const handleChange = (evt: any) => {
84
+ updateArgs({
85
+ value: evt.target.value
86
+ });
87
+ };
88
+ return <UnitInput {...args} onChange={handleChange} />;
89
+ }`,...(it=(st=L.parameters)==null?void 0:st.docs)==null?void 0:it.source}}};var ut,ot,dt;$.parameters={...$.parameters,docs:{...(ut=$.parameters)==null?void 0:ut.docs,source:{originalSource:`args => {
90
+ const [_, updateArgs] = useArgs();
91
+ const handleChange = (evt: any) => {
92
+ updateArgs({
93
+ value: evt.target.value
94
+ });
95
+ };
96
+ return <UnitInput {...args} onChange={handleChange} />;
97
+ }`,...(dt=(ot=$.parameters)==null?void 0:ot.docs)==null?void 0:dt.source}}};var ct,mt,pt;H.parameters={...H.parameters,docs:{...(ct=H.parameters)==null?void 0:ct.docs,source:{originalSource:`(args: IUnitInputProps) => {
98
+ const [value, setValue] = useState('123|m');
99
+ const [value2, setValue2] = useState('223|m');
100
+ const [initUnit, setInitUnit] = useState('ft');
101
+ return <>
102
+ <Button label="Change initUnit" onClick={() => setInitUnit(initUnit === 'm' ? 'ft' : 'm')} />
103
+ <Spacer />
104
+ <Button label="Change value" onClick={() => setValue(value === '123|m' ? '456|m' : '123|m')} />
105
+ <Spacer />
106
+ <UnitInput name="example" onChange={evt => {
107
+ setValue(evt.target.value);
108
+ }} unitkey="length" value={value} initUnit={initUnit} onSwitchUnit={setInitUnit} />
109
+ <Spacer />
110
+ <UnitInput name="example2" onChange={evt => {
111
+ setValue2(evt.target.value);
112
+ }} unitkey="length" value={value2} initUnit={initUnit} onSwitchUnit={setInitUnit} />
113
+ <Divider />
114
+ <h4>Without initUnit property (taken from the redux store)</h4>
115
+ <UnitInput name="example" onChange={evt => {
116
+ setValue(evt.target.value);
117
+ }} unitkey="length" value={value} onSwitchUnit={setInitUnit} />
118
+ <UnitInput name="example2" onChange={evt => {
119
+ setValue2(evt.target.value);
120
+ }} unitkey="length" value={value2} onSwitchUnit={setInitUnit} />
121
+ </>;
122
+ }`,...(pt=(mt=H.parameters)==null?void 0:mt.docs)==null?void 0:pt.source}}};var gt,ht,vt;K.parameters={...K.parameters,docs:{...(gt=K.parameters)==null?void 0:gt.docs,source:{originalSource:`args => {
123
+ const [_, updateArgs] = useArgs();
124
+ const handleChange = (evt: any) => {
125
+ updateArgs({
126
+ value: evt.target.value
127
+ });
128
+ };
129
+ return <UnitInput {...args} onChange={handleChange} />;
130
+ }`,...(vt=(ht=K.parameters)==null?void 0:ht.docs)==null?void 0:vt.source}}};var ft,Ct,bt;z.parameters={...z.parameters,docs:{...(ft=z.parameters)==null?void 0:ft.docs,source:{originalSource:`() => {
131
+ const width = '500px';
132
+ const [value, setValue] = useState<any>(undefined);
133
+ return <>
134
+ <h4>Different edge cases such as +/- infinity, undefined, NaN, null:</h4>
135
+ <Row>
136
+ <Column width="25%">
137
+ <Button label="Change value infinity" onClick={() => setValue(Infinity)} />
138
+ <br />
139
+ <Button label="Change value -infinity" onClick={() => setValue(-Infinity)} />
140
+ <br />
141
+ <Button label="Change value null" onClick={() => setValue(null)} />
142
+ <br />
143
+ <Button label="Change value - undefined" onClick={() => setValue(undefined)} />
144
+ <br />
145
+ <Button label="Change value - NaN" onClick={() => setValue(NaN)} />
146
+ <br />
147
+ <Button label="Change value - nothing (empty)" onClick={() => setValue(undefined)} />
148
+ <br />
149
+ <Button label="Change value - empty string" onClick={() => setValue('')} />
150
+ </Column>
151
+ <Column width="25%">
152
+ <Button label="Change value infinity|m" onClick={() => setValue(Infinity + '|m')} />
153
+ <br />
154
+ <Button label="Change value -infinity|m" onClick={() => setValue(-Infinity + '|m')} />
155
+ <br />
156
+ <Button label="Change value null|m" onClick={() => setValue(null + '|m')} />
157
+ <br />
158
+ <Button label="Change value - undefined|m" onClick={() => setValue(undefined + '|m')} />
159
+ <br />
160
+ <Button label="Change value - NaN|m" onClick={() => setValue(NaN + '|m')} />
161
+ <br />
162
+ <Button label="Change value - nothing (empty)|m" onClick={() => setValue('|m')} />
163
+ </Column>
164
+ </Row>
165
+ <br />
166
+ <Field label="Normal PUI">
167
+ <UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} placeholder="value|unit" />
168
+ </Field>
169
+ <Field label="Disabled validation">
170
+ <UnitInput name="example2" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" disabledValidation width={width} />
171
+ </Field>
172
+ <Field label="Disabled validation and manual error">
173
+ <UnitInput name="example3" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" error="test" disabledValidation width={width} />
174
+ </Field>
175
+ <Message message={{
176
+ heading: 'Current value inside PUI: ' + value,
177
+ visible: true
178
+ }} />
179
+ </>;
180
+ }`,...(bt=(Ct=z.parameters)==null?void 0:Ct.docs)==null?void 0:bt.source}}};var yt,Ut,xt;ee.parameters={...ee.parameters,docs:{...(yt=ee.parameters)==null?void 0:yt.docs,source:{originalSource:`() => {
181
+ const width = '500px';
182
+ const [value, setValue] = useState<string | number>('1|m');
183
+ const [valueB, setValueB] = useState('|m');
184
+ const automaticValue = '123|km';
185
+ return <>
186
+ <h4>Different cases for automatic (placeholder) values:</h4>
187
+ <Row>
188
+ <Column width="25%">
189
+ <Button label="Change value to ''" onClick={() => setValue('')} />
190
+ <br />
191
+ <Button label="Change value to 1" onClick={() => setValue(1)} />
192
+ <br />
193
+ <Button label="Change value to 1|m" onClick={() => setValue('1|m')} />
194
+ <br />
195
+ <Button label="Change value to |m - empty value" onClick={() => setValue('|m')} />
196
+ </Column>
197
+ </Row>
198
+ <br />
199
+ <Field label="Normal PUI (placeholder + auto)">
200
+ <UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} placeholder="value|unit" autoValue={automaticValue} />
201
+ </Field>
202
+ <Field label="Normal PUI (only auto)">
203
+ <UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} autoValue={automaticValue} />
204
+ </Field>
205
+ <Field label="Empty PUI with autoValue">
206
+ <UnitInput name="example1" onChange={evt => setValueB(evt.target.value)} value={valueB} unitkey="length" width={width} autoValue={automaticValue} />
207
+ </Field>
208
+ <Field label="Normal PUI (only placeholder)">
209
+ <UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} placeholder="Placeholder test" />
210
+ </Field>
211
+ <Field label="Normal PUI (placeholder + allowEmpty)">
212
+ <UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} placeholder="Placeholder test" allowEmpty />
213
+ </Field>
214
+ <Message message={{
215
+ heading: 'Current value inside PUI: ' + value,
216
+ visible: true
217
+ }} />
218
+ </>;
219
+ }`,...(xt=(Ut=ee.parameters)==null?void 0:Ut.docs)==null?void 0:xt.source}}};var Vt,jt,It;te.parameters={...te.parameters,docs:{...(Vt=te.parameters)==null?void 0:Vt.docs,source:{originalSource:`() => {
220
+ const [value, setValue] = useState('123|%');
221
+ const [validation, setValidation] = useState<string | null>(null);
222
+ const predictedMessage = 'This should be visible when an error appears';
223
+ const handleValidation = (name: string, message: string | null) => {
224
+ setValidation(message);
225
+ return {
226
+ name,
227
+ error: message
228
+ };
229
+ };
230
+ return <>
231
+ <h4>3rd party validation message when inputting invalid value:</h4>
232
+ <UnitInput name="example" onChange={evt => setValue(evt.target.value)} error={!validation || predictedMessage} validationCallback={handleValidation} value={value} />
233
+ <br />
234
+ <Spacer />
235
+ <h4>Original validation message: </h4>
236
+ <Message message={{
237
+ heading: validation,
238
+ visible: true
239
+ }} />
240
+ </>;
241
+ }`,...(It=(jt=te.parameters)==null?void 0:jt.docs)==null?void 0:It.source}}};var kt,St,wt;ne.parameters={...ne.parameters,docs:{...(kt=ne.parameters)==null?void 0:kt.docs,source:{originalSource:`() => {
242
+ const [value, setValue] = useState('123|m');
243
+ const [placeholder, setPlaceholder] = useState('');
244
+ const [initUnit, setInitUnit] = useState('km');
245
+ const setPlaceholderValue = () => {
246
+ setInitUnit('ft');
247
+ setPlaceholder('placeholder');
248
+ setValue('|m');
249
+ };
250
+ return <>
251
+ <h4>Empty value case:</h4>
252
+ <UnitInput name="example" onChange={evt => setValue(evt.target.value)} value={value} allowEmpty placeholder={placeholder} initUnit={initUnit} unitkey="length" />
253
+ <br />
254
+ <Spacer />
255
+ <Button label="Change value |m and unit ft" onClick={() => setPlaceholderValue()} />
256
+ </>;
257
+ }`,...(wt=(St=ne.parameters)==null?void 0:St.docs)==null?void 0:wt.source}}};const Jn=["Default","InitUnit","Width","NoConversion","Small","Error","InternalValidationError","Disabled","DisabledNoConversion","DisabledUnitWithoutUnitKey","DisabledUnitWithUnitKey","DisabledWithEnabledUnitMenu","TestExternalStateChangeWithSynchronizedUnits","PredefinedOptionsMenu","TestEdgeCases","AutomaticValues","ValidationCallback","AllowEmptyPUI"];export{ne as AllowEmptyPUI,ee as AutomaticValues,X as Default,E as Disabled,W as DisabledNoConversion,L as DisabledUnitWithUnitKey,T as DisabledUnitWithoutUnitKey,$ as DisabledWithEnabledUnitMenu,q as Error,M as InitUnit,R as InternalValidationError,O as NoConversion,K as PredefinedOptionsMenu,B as Small,z as TestEdgeCases,H as TestExternalStateChangeWithSynchronizedUnits,te as ValidationCallback,_ as Width,Jn as __namedExportsOrder,zn as default};
@@ -357,7 +357,7 @@
357
357
  }
358
358
  </script>
359
359
 
360
- <script type="module" crossorigin src="./assets/iframe-c82204d3.js"></script>
360
+ <script type="module" crossorigin src="./assets/iframe-4241ee87.js"></script>
361
361
  </head>
362
362
 
363
363
  <body>