@oliasoft-open-source/react-ui-library 4.10.5-beta-1 → 4.10.5-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 (19) hide show
  1. package/dist/storybook/assets/{Color-KGDBMAHA-DJWDR-7k.js → Color-KGDBMAHA-Clo6H3WP.js} +1 -1
  2. package/dist/storybook/assets/{DocsRenderer-PKQXORMH-BR-Q_v8z.js → DocsRenderer-PKQXORMH-gpTLkmsi.js} +1 -1
  3. package/dist/storybook/assets/{buttons-and-links-DuvLeI7j.js → buttons-and-links-DzAIMXeO.js} +1 -1
  4. package/dist/storybook/assets/{chunk-HLWAVYOI-uYgdzPBn.js → chunk-HLWAVYOI-Dj2MWya0.js} +1 -1
  5. package/dist/storybook/assets/{color-p0RSCo7_.js → color-CZN-p4aM.js} +1 -1
  6. package/dist/storybook/assets/{iframe-C6gZEhn6.js → iframe-9ccGSytp.js} +2 -2
  7. package/dist/storybook/assets/{index-C1LnJwgO.js → index-B3iLD3UY.js} +1 -1
  8. package/dist/storybook/assets/{index-D1Pn-Nwo.js → index-DGBZhlHG.js} +4 -4
  9. package/dist/storybook/assets/{input-validation-BC1lJN-G.js → input-validation-BA1-pp__.js} +1 -1
  10. package/dist/storybook/assets/{inputs-DbMDVL7N.js → inputs-B4D_ZFgy.js} +1 -1
  11. package/dist/storybook/assets/{layout-forms-BbMs0L2o.js → layout-forms-BkDnEJwQ.js} +1 -1
  12. package/dist/storybook/assets/{layout-general-D_U8HM1C.js → layout-general-DHM5VM3D.js} +1 -1
  13. package/dist/storybook/assets/{padding-and-spacing-Ea7KrTxw.js → padding-and-spacing-CUJJ9GU5.js} +1 -1
  14. package/dist/storybook/assets/{preview-BeBKFOVC.js → preview-CEXyF-6g.js} +1 -1
  15. package/dist/storybook/assets/{preview-BKGc9iJY.js → preview-FMbzOyLt.js} +2 -2
  16. package/dist/storybook/assets/{unit-input.stories-C4WI2DCh.js → unit-input.stories-DMU1BH5_.js} +4 -4
  17. package/dist/storybook/iframe.html +1 -1
  18. package/dist/storybook/project.json +1 -1
  19. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as r}from"./index-BcNHZKhG.js";import{Z as s,$ as n}from"./index-D1Pn-Nwo.js";import{NonExistentValue as a,Error as l}from"./select.stories-B9w9ONzj.js";import"./index-DhsZuJvc.js";import"./iframe-C6gZEhn6.js";import"../sb-preview/runtime.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";import"./index-DMAnyMX5.js";import"./index-CF7H4eMJ.js";import"./select-DnRuRG_N.js";import"./lodash-c4VUpsOs.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./types-Dx2TtIG9.js";import"./tooltip-1V7clEnw.js";import"./index-CEuq6vkz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-D-uVCDzk.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./badge-CLQ59MDF.js";import"./select.input-D0UkAPd9.js";import"./spacer-BWoNR27H.js";function o(t){const i={code:"code",h1:"h1",h2:"h2",h3:"h3",p:"p",strong:"strong",...r(),...t.components};return e.jsxs(e.Fragment,{children:[e.jsx(s,{title:"Input Validation"}),`
1
+ import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as r}from"./index-BcNHZKhG.js";import{Z as s,$ as n}from"./index-DGBZhlHG.js";import{NonExistentValue as a,Error as l}from"./select.stories-B9w9ONzj.js";import"./index-DhsZuJvc.js";import"./iframe-9ccGSytp.js";import"../sb-preview/runtime.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";import"./index-DMAnyMX5.js";import"./index-CF7H4eMJ.js";import"./select-DnRuRG_N.js";import"./lodash-c4VUpsOs.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./types-Dx2TtIG9.js";import"./tooltip-1V7clEnw.js";import"./index-CEuq6vkz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-D-uVCDzk.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./badge-CLQ59MDF.js";import"./select.input-D0UkAPd9.js";import"./spacer-BWoNR27H.js";function o(t){const i={code:"code",h1:"h1",h2:"h2",h3:"h3",p:"p",strong:"strong",...r(),...t.components};return e.jsxs(e.Fragment,{children:[e.jsx(s,{title:"Input Validation"}),`
2
2
  `,e.jsx(i.h1,{id:"input-validation",children:"Input Validation"}),`
3
3
  `,e.jsx(i.h2,{id:"select",children:"Select"}),`
4
4
  `,e.jsx(i.h3,{id:"invalid-states",children:"Invalid states"}),`
@@ -1,4 +1,4 @@
1
- import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as s}from"./index-BcNHZKhG.js";import{Z as r,$ as o}from"./index-D1Pn-Nwo.js";import{Default as l}from"./button.stories-DA9DGYD2.js";import{Default as a}from"./check-box.stories-DfbWw6mD.js";import{Default as c}from"./file-input.stories-CWD5XYE9.js";import{Default as d,Date as p}from"./input.stories-FKl0qVhm.js";import{Default as h}from"./number-input.stories-u2pq69wU.js";import{Default as m}from"./option-dropdown.stories-CIvqMhQ3.js";import{Default as u}from"./radio-button.stories-5gvV0LD0.js";import{Native as f,Default as x}from"./select.stories-B9w9ONzj.js";import{Default as j}from"./slider.stories-BzBb3PkP.js";import{Default as b}from"./textarea.stories-CJ-Oqytp.js";import{Default as g}from"./toggle.stories-qTHFTXxI.js";import"./index-DhsZuJvc.js";import"./iframe-C6gZEhn6.js";import"../sb-preview/runtime.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";import"./react-router-dom-Ck2Y_Fzc.js";import"./index-CEuq6vkz.js";import"./tiny-invariant-DqLgxztJ.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./flex-EllkLxgO.js";import"./button-DHevvVBE.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./tooltip-1V7clEnw.js";import"./index-DMAnyMX5.js";import"./index-CF7H4eMJ.js";import"./check-box-DPLaOkRR.js";import"./help-icon-Buhx5nl6.js";import"./file-input-X3BnZaHk.js";import"./lodash-c4VUpsOs.js";import"./input-group-BaRSJAEN.js";import"./input-DTXbDJaL.js";import"./types-Dx2TtIG9.js";import"./spacer-BWoNR27H.js";import"./message-Y48EomV-.js";import"./textarea-D6ltcKhz.js";import"./index-C0x1JmaP.js";import"./index-DRSy5Ssd.js";import"./grid-DRkC-bt8.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./card-EcjmryU9.js";import"./heading-CRNoBc7q.js";import"./input-group-addon-D68iUKV2.js";import"./select-DnRuRG_N.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-D-uVCDzk.js";import"./badge-CLQ59MDF.js";import"./select.input-D0UkAPd9.js";import"./field-HrLaMLbx.js";import"./label-CqmyC9he.js";import"./toggle-BbFVf61v.js";import"./number-input-DOZPfwJP.js";import"./divider-DY9nJ_7N.js";import"./radio-button-DmDuw4DA.js";import"./slider-C7vnj_3M.js";import"./objectSpread2-DW4nTBoq.js";import"./index-BI4_Bp97.js";function i(n){const t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",strong:"strong",ul:"ul",...s(),...n.components};return e.jsxs(e.Fragment,{children:[e.jsx(r,{title:"Inputs"}),`
1
+ import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as s}from"./index-BcNHZKhG.js";import{Z as r,$ as o}from"./index-DGBZhlHG.js";import{Default as l}from"./button.stories-DA9DGYD2.js";import{Default as a}from"./check-box.stories-DfbWw6mD.js";import{Default as c}from"./file-input.stories-CWD5XYE9.js";import{Default as d,Date as p}from"./input.stories-FKl0qVhm.js";import{Default as h}from"./number-input.stories-u2pq69wU.js";import{Default as m}from"./option-dropdown.stories-CIvqMhQ3.js";import{Default as u}from"./radio-button.stories-5gvV0LD0.js";import{Native as f,Default as x}from"./select.stories-B9w9ONzj.js";import{Default as j}from"./slider.stories-BzBb3PkP.js";import{Default as b}from"./textarea.stories-CJ-Oqytp.js";import{Default as g}from"./toggle.stories-qTHFTXxI.js";import"./index-DhsZuJvc.js";import"./iframe-9ccGSytp.js";import"../sb-preview/runtime.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";import"./react-router-dom-Ck2Y_Fzc.js";import"./index-CEuq6vkz.js";import"./tiny-invariant-DqLgxztJ.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./flex-EllkLxgO.js";import"./button-DHevvVBE.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./tooltip-1V7clEnw.js";import"./index-DMAnyMX5.js";import"./index-CF7H4eMJ.js";import"./check-box-DPLaOkRR.js";import"./help-icon-Buhx5nl6.js";import"./file-input-X3BnZaHk.js";import"./lodash-c4VUpsOs.js";import"./input-group-BaRSJAEN.js";import"./input-DTXbDJaL.js";import"./types-Dx2TtIG9.js";import"./spacer-BWoNR27H.js";import"./message-Y48EomV-.js";import"./textarea-D6ltcKhz.js";import"./index-C0x1JmaP.js";import"./index-DRSy5Ssd.js";import"./grid-DRkC-bt8.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./card-EcjmryU9.js";import"./heading-CRNoBc7q.js";import"./input-group-addon-D68iUKV2.js";import"./select-DnRuRG_N.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./text-B3-TSWok.js";import"./actions-D-uVCDzk.js";import"./badge-CLQ59MDF.js";import"./select.input-D0UkAPd9.js";import"./field-HrLaMLbx.js";import"./label-CqmyC9he.js";import"./toggle-BbFVf61v.js";import"./number-input-DOZPfwJP.js";import"./divider-DY9nJ_7N.js";import"./radio-button-DmDuw4DA.js";import"./slider-C7vnj_3M.js";import"./objectSpread2-DW4nTBoq.js";import"./index-BI4_Bp97.js";function i(n){const t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",strong:"strong",ul:"ul",...s(),...n.components};return e.jsxs(e.Fragment,{children:[e.jsx(r,{title:"Inputs"}),`
2
2
  `,e.jsx(t.h1,{id:"inputs",children:"Inputs"}),`
3
3
  `,e.jsx(t.p,{children:"React UI Library provides a comprehensive set of user input components."}),`
4
4
  `,e.jsx(t.h2,{id:"button",children:"Button"}),`
@@ -1,4 +1,4 @@
1
- import{j as t}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as n}from"./index-BcNHZKhG.js";import{Z as s,$ as o}from"./index-D1Pn-Nwo.js";import{Default as l,LabelOnLeft as p}from"./field.stories-DUGMwi1O.js";import{Default as m,LabelsOnLeft as a,Row as h}from"./form.stories-BrUnmw7R.js";import"./index-DhsZuJvc.js";import"./iframe-C6gZEhn6.js";import"../sb-preview/runtime.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";import"./field-HrLaMLbx.js";import"./index-Bk2sglWO.js";import"./label-CqmyC9he.js";import"./common-types-Sih75Sav.js";import"./help-icon-Buhx5nl6.js";import"./tooltip-1V7clEnw.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./input-DTXbDJaL.js";import"./types-Dx2TtIG9.js";import"./lodash-c4VUpsOs.js";import"./text-B3-TSWok.js";import"./select-DnRuRG_N.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./actions-D-uVCDzk.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./badge-CLQ59MDF.js";import"./select.input-D0UkAPd9.js";import"./check-box-DPLaOkRR.js";import"./button-group-1DEZPmxq.js";import"./toggle-BbFVf61v.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./slider-C7vnj_3M.js";import"./objectSpread2-DW4nTBoq.js";import"./index-BI4_Bp97.js";import"./textarea-D6ltcKhz.js";import"./radio-button-DmDuw4DA.js";import"./form-row-CM112EYF.js";function r(i){const e={code:"code",h1:"h1",h2:"h2",p:"p",...n(),...i.components};return t.jsxs(t.Fragment,{children:[t.jsx(s,{title:"Layout (Forms)"}),`
1
+ import{j as t}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as n}from"./index-BcNHZKhG.js";import{Z as s,$ as o}from"./index-DGBZhlHG.js";import{Default as l,LabelOnLeft as p}from"./field.stories-DUGMwi1O.js";import{Default as m,LabelsOnLeft as a,Row as h}from"./form.stories-BrUnmw7R.js";import"./index-DhsZuJvc.js";import"./iframe-9ccGSytp.js";import"../sb-preview/runtime.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";import"./field-HrLaMLbx.js";import"./index-Bk2sglWO.js";import"./label-CqmyC9he.js";import"./common-types-Sih75Sav.js";import"./help-icon-Buhx5nl6.js";import"./tooltip-1V7clEnw.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./input-DTXbDJaL.js";import"./types-Dx2TtIG9.js";import"./lodash-c4VUpsOs.js";import"./text-B3-TSWok.js";import"./select-DnRuRG_N.js";import"./memoize-one.esm-CcMeOnPo.js";import"./types-BmbYqTX_.js";import"./actions-D-uVCDzk.js";import"./button-DHevvVBE.js";import"./spinner-AWUe4xwQ.js";import"./badge-CLQ59MDF.js";import"./select.input-D0UkAPd9.js";import"./check-box-DPLaOkRR.js";import"./button-group-1DEZPmxq.js";import"./toggle-BbFVf61v.js";import"./input-group-BaRSJAEN.js";import"./input-group-addon-D68iUKV2.js";import"./slider-C7vnj_3M.js";import"./objectSpread2-DW4nTBoq.js";import"./index-BI4_Bp97.js";import"./textarea-D6ltcKhz.js";import"./radio-button-DmDuw4DA.js";import"./form-row-CM112EYF.js";function r(i){const e={code:"code",h1:"h1",h2:"h2",p:"p",...n(),...i.components};return t.jsxs(t.Fragment,{children:[t.jsx(s,{title:"Layout (Forms)"}),`
2
2
  `,t.jsx(e.h1,{id:"layout-forms",children:"Layout (Forms)"}),`
3
3
  `,t.jsx(e.h2,{id:"field",children:"Field"}),`
4
4
  `,t.jsxs(e.p,{children:["This is a wrapper for any form element with default bottom margin, and props like ",t.jsx(e.code,{children:"label"})," for other default styling."]}),`
@@ -1,4 +1,4 @@
1
- import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as s}from"./index-BcNHZKhG.js";import{Z as r,$ as n}from"./index-D1Pn-Nwo.js";import{Center as d,SpaceBetween as l,JustifyEnd as a,Column as c}from"./flex.stories-BhvJpHpN.js";import{Default as h,CustomColumnWidth as p,DefaultGap as x,CustomGap as m,Responsive as u}from"./grid.stories-DqjhHHwX.js";import{Default as j,FixedWidth as f,NoPadding as w,ResponsiveWidth as g}from"./column.stories-DDTHFELF.js";import"./index-DhsZuJvc.js";import"./iframe-C6gZEhn6.js";import"../sb-preview/runtime.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";import"./flex-EllkLxgO.js";import"./button-DHevvVBE.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./index-CEuq6vkz.js";import"./tooltip-1V7clEnw.js";import"./text-B3-TSWok.js";import"./grid-DRkC-bt8.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./card-EcjmryU9.js";import"./row-Bmiy2Lh0.js";import"./heading-CRNoBc7q.js";import"./help-icon-Buhx5nl6.js";function t(i){const o={code:"code",h1:"h1",h2:"h2",h3:"h3",p:"p",...s(),...i.components};return e.jsxs(e.Fragment,{children:[e.jsx(r,{title:"Layout (General)"}),`
1
+ import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as s}from"./index-BcNHZKhG.js";import{Z as r,$ as n}from"./index-DGBZhlHG.js";import{Center as d,SpaceBetween as l,JustifyEnd as a,Column as c}from"./flex.stories-BhvJpHpN.js";import{Default as h,CustomColumnWidth as p,DefaultGap as x,CustomGap as m,Responsive as u}from"./grid.stories-DqjhHHwX.js";import{Default as j,FixedWidth as f,NoPadding as w,ResponsiveWidth as g}from"./column.stories-DDTHFELF.js";import"./index-DhsZuJvc.js";import"./iframe-9ccGSytp.js";import"../sb-preview/runtime.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";import"./flex-EllkLxgO.js";import"./button-DHevvVBE.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./spinner-AWUe4xwQ.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./index-CEuq6vkz.js";import"./tooltip-1V7clEnw.js";import"./text-B3-TSWok.js";import"./grid-DRkC-bt8.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./card-EcjmryU9.js";import"./row-Bmiy2Lh0.js";import"./heading-CRNoBc7q.js";import"./help-icon-Buhx5nl6.js";function t(i){const o={code:"code",h1:"h1",h2:"h2",h3:"h3",p:"p",...s(),...i.components};return e.jsxs(e.Fragment,{children:[e.jsx(r,{title:"Layout (General)"}),`
2
2
  `,e.jsx(o.h1,{id:"layout-general",children:"Layout (General)"}),`
3
3
  `,e.jsx(o.h2,{id:"flex",children:"Flex"}),`
4
4
  `,e.jsxs(o.p,{children:["The ",e.jsx(o.code,{children:"Flex"})," component is a basic flexbox wrapper with optional props for ",e.jsx(o.code,{children:"alignItems"}),", ",e.jsx(o.code,{children:"justifyContent"})," and ",e.jsx(o.code,{children:"flexDirection"}),". This is a conveninent way to center items vertically and/or horizontally, to align them to opposite edges, or align them to the far side."]}),`
@@ -1,4 +1,4 @@
1
- import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as r}from"./index-BcNHZKhG.js";import{Z as t}from"./index-D1Pn-Nwo.js";import"./index-DhsZuJvc.js";import"./iframe-C6gZEhn6.js";import"../sb-preview/runtime.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";function i(s){const n={code:"code",h1:"h1",h2:"h2",li:"li",p:"p",strong:"strong",ul:"ul",...r(),...s.components};return e.jsxs(e.Fragment,{children:[e.jsx(t,{title:"Padding, Margin & Size"}),`
1
+ import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as r}from"./index-BcNHZKhG.js";import{Z as t}from"./index-DGBZhlHG.js";import"./index-DhsZuJvc.js";import"./iframe-9ccGSytp.js";import"../sb-preview/runtime.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";function i(s){const n={code:"code",h1:"h1",h2:"h2",li:"li",p:"p",strong:"strong",ul:"ul",...r(),...s.components};return e.jsxs(e.Fragment,{children:[e.jsx(t,{title:"Padding, Margin & Size"}),`
2
2
  `,e.jsx(n.h1,{id:"padding-margin--size",children:"Padding, Margin & Size"}),`
3
3
  `,e.jsx(n.h2,{id:"padding--margin",children:"Padding & Margin"}),`
4
4
  `,e.jsx(n.p,{children:"There are standard CSS spacing variables for padding and margin."}),`
@@ -1,3 +1,3 @@
1
- import{j as s}from"./jsx-runtime-eps93zm2.js";import{r as P,R as C}from"./index-DhsZuJvc.js";import{T as I}from"./toaster-7wnI6hqB.js";import"./message-Y48EomV-.js";import{a4 as d,a5 as M}from"./index-D1Pn-Nwo.js";import{e as _}from"./index-DRSy5Ssd.js";import"./chunk-HLWAVYOI-uYgdzPBn.js";import"./index-CUZDtIZe.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./iframe-C6gZEhn6.js";import"../sb-preview/runtime.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";import"./react-16-DXAfArL2.js";var v="DARK_MODE";function f(r){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(r)}var b;function A(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),e.push.apply(e,n)}return e}function k(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?A(Object(e),!0).forEach(function(n){R(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):A(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function R(r,t,e){return t=x(t),t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function x(r){var t=K(r,"string");return f(t)==="symbol"?t:String(t)}function K(r,t){if(f(r)!=="object"||r===null)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t||"default");if(f(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function p(r){return B(r)||U(r)||L(r)||N()}function N(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ import{j as s}from"./jsx-runtime-eps93zm2.js";import{r as P,R as C}from"./index-DhsZuJvc.js";import{T as I}from"./toaster-7wnI6hqB.js";import"./message-Y48EomV-.js";import{a4 as d,a5 as M}from"./index-DGBZhlHG.js";import{e as _}from"./index-DRSy5Ssd.js";import"./chunk-HLWAVYOI-Dj2MWya0.js";import"./index-CUZDtIZe.js";import"./index-Bk2sglWO.js";import"./common-types-Sih75Sav.js";import"./icon-BSFY3vDO.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";import"./inheritsLoose-DP0QEDDI.js";import"./index-CEuq6vkz.js";import"./disabled-context-rmpd7YJS.js";import"./iframe-9ccGSytp.js";import"../sb-preview/runtime.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";import"./react-16-DXAfArL2.js";var v="DARK_MODE";function f(r){"@babel/helpers - typeof";return f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(r)}var b;function A(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),e.push.apply(e,n)}return e}function k(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?A(Object(e),!0).forEach(function(n){R(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):A(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function R(r,t,e){return t=x(t),t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function x(r){var t=K(r,"string");return f(t)==="symbol"?t:String(t)}function K(r,t){if(f(r)!=="object"||r===null)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t||"default");if(f(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function p(r){return B(r)||U(r)||L(r)||N()}function N(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(r,t){if(r){if(typeof r=="string")return h(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);if(e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set")return Array.from(r);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return h(r,t)}}function U(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function B(r){if(Array.isArray(r))return h(r)}function h(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}const{global:Y}=__STORYBOOK_MODULE_GLOBAL__;__STORYBOOK_MODULE_CORE_EVENTS__;var T=Y,$=T.document,g=T.window,j="sb-addon-themes-3";(b=g.matchMedia)===null||b===void 0||b.call(g,"(prefers-color-scheme: dark)");var O={classTarget:"body",dark:d.dark,darkClass:["dark"],light:d.light,lightClass:["light"],stylePreview:!1,userHasExplicitlySetTheTheme:!1},E=function(t){g.localStorage.setItem(j,JSON.stringify(t))},H=function(t,e){var n=e.current,a=e.darkClass,l=a===void 0?O.darkClass:a,o=e.lightClass,i=o===void 0?O.lightClass:o;if(n==="dark"){var u,c;(u=t.classList).remove.apply(u,p(y(i))),(c=t.classList).add.apply(c,p(y(l)))}else{var m,S;(m=t.classList).remove.apply(m,p(y(l))),(S=t.classList).add.apply(S,p(y(i)))}},y=function(t){var e=[];return e.concat(t).map(function(n){return n})},V=function(t){var e=$.querySelector(t.classTarget);e&&H(e,t)},D=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=g.localStorage.getItem(j);if(typeof e=="string"){var n=JSON.parse(e);return t&&(t.dark&&!_(n.dark,t.dark)&&(n.dark=t.dark,E(n)),t.light&&!_(n.light,t.light)&&(n.light=t.light,E(n))),n}return k(k({},O),t)};V(D());function W(r,t){return F(r)||J(r,t)||G(r,t)||q()}function q(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function G(r,t){if(r){if(typeof r=="string")return w(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);if(e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set")return Array.from(r);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return w(r,t)}}function w(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function J(r,t){var e=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e!=null){var n,a,l,o,i=[],u=!0,c=!1;try{if(l=(e=e.call(r)).next,t!==0)for(;!(u=(n=l.call(e)).done)&&(i.push(n.value),i.length!==t);u=!0);}catch(m){c=!0,a=m}finally{try{if(!u&&e.return!=null&&(o=e.return(),Object(o)!==o))return}finally{if(c)throw a}}return i}}function F(r){if(Array.isArray(r))return r}const{addons:z,useState:Q,useEffect:X}=__STORYBOOK_MODULE_PREVIEW_API__;function Z(){var r=Q(D().current==="dark"),t=W(r,2),e=t[0],n=t[1];return X(function(){var a=z.getChannel();return a.on(v,n),function(){return a.off(v,n)}},[]),e}const Or=[r=>s.jsxs(s.Fragment,{children:[s.jsx(r,{}),s.jsx(I,{})]}),r=>{const t=Z();return P.useEffect(()=>document.documentElement.dataset.theme=t?"dark":"default",[t]),s.jsx(r,{})}],Sr={docs:{container:r=>{const[t,e]=C.useState(!1);r.context.channel.on(v,a=>e(a));const n={...r};return n.theme=t?d.dark:d.light,s.jsx(M,{...n})}},darkMode:{current:"light",stylePreview:!0}},_r=["autodocs"];export{Or as decorators,Sr as parameters,_r as tags};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DocsRenderer-PKQXORMH-BR-Q_v8z.js","./chunk-HLWAVYOI-uYgdzPBn.js","./iframe-C6gZEhn6.js","./index-DhsZuJvc.js","./react-16-DXAfArL2.js","./index-CUZDtIZe.js","./index-D1Pn-Nwo.js","./inheritsLoose-DP0QEDDI.js","./assertThisInitialized-B9jnkVVz.js","./index-D6rZ4wEC.js"])))=>i.map(i=>d[i]);
2
- import{_ as a}from"./iframe-C6gZEhn6.js";import"../sb-preview/runtime.js";const{global:s}=__STORYBOOK_MODULE_GLOBAL__;var _=Object.entries(s.TAGS_OPTIONS??{}).reduce((e,r)=>{let[t,o]=r;return o.excludeFromDocsStories&&(e[t]=!0),e},{}),d={docs:{renderer:async()=>{let{DocsRenderer:e}=await a(()=>import("./DocsRenderer-PKQXORMH-BR-Q_v8z.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url);return new e},stories:{filter:e=>{var r;return(e.tags||[]).filter(t=>_[t]).length===0&&!((r=e.parameters.docs)!=null&&r.disable)}}}};export{d as parameters};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DocsRenderer-PKQXORMH-gpTLkmsi.js","./chunk-HLWAVYOI-Dj2MWya0.js","./iframe-9ccGSytp.js","./index-DhsZuJvc.js","./react-16-DXAfArL2.js","./index-CUZDtIZe.js","./index-DGBZhlHG.js","./inheritsLoose-DP0QEDDI.js","./assertThisInitialized-B9jnkVVz.js","./index-D6rZ4wEC.js"])))=>i.map(i=>d[i]);
2
+ import{_ as a}from"./iframe-9ccGSytp.js";import"../sb-preview/runtime.js";const{global:s}=__STORYBOOK_MODULE_GLOBAL__;var _=Object.entries(s.TAGS_OPTIONS??{}).reduce((e,r)=>{let[t,o]=r;return o.excludeFromDocsStories&&(e[t]=!0),e},{}),d={docs:{renderer:async()=>{let{DocsRenderer:e}=await a(()=>import("./DocsRenderer-PKQXORMH-gpTLkmsi.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url);return new e},stories:{filter:e=>{var r;return(e.tags||[]).filter(t=>_[t]).length===0&&!((r=e.parameters.docs)!=null&&r.disable)}}}};export{d as parameters};
@@ -1,4 +1,4 @@
1
- import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as o}from"./index-DhsZuJvc.js";import{d as l}from"./index-C0x1JmaP.js";import{w as F,u as g,e as y,f as Ae,a as qe}from"./index-DMAnyMX5.js";import{c as zn}from"./index-Bk2sglWO.js";import{u as Jn}from"./use-previous-D775JrO6.js";import{M as Ge}from"./actions-D-uVCDzk.js";import{I as Yn}from"./input-group-addon-D68iUKV2.js";import{B as p}from"./button-DHevvVBE.js";import{T as Zn}from"./tooltip-1V7clEnw.js";import{I as Qn}from"./input-group-BaRSJAEN.js";import{S as b}from"./spacer-BWoNR27H.js";import{T as xe}from"./text-B3-TSWok.js";import{M as Ke}from"./types-BmbYqTX_.js";import{l as V}from"./lodash-c4VUpsOs.js";import{N as Xn,r as ea}from"./number-input-DOZPfwJP.js";import{D as ta}from"./divider-DY9nJ_7N.js";import{R as wn,C as De}from"./row-Bmiy2Lh0.js";import{F as I}from"./field-HrLaMLbx.js";import{M as Ie}from"./message-Y48EomV-.js";import{G as Tn}from"./grid-DRkC-bt8.js";import{C as A}from"./card-EcjmryU9.js";import{H as q}from"./heading-CRNoBc7q.js";import{T as Be}from"./toggle-BbFVf61v.js";import{S as na}from"./select-DnRuRG_N.js";import{I as kn}from"./icon-BSFY3vDO.js";import"./index-DRSy5Ssd.js";import"./index-CF7H4eMJ.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./types-Dx2TtIG9.js";import"./badge-CLQ59MDF.js";import"./spinner-AWUe4xwQ.js";import"./index-CUZDtIZe.js";import"./select.input-D0UkAPd9.js";import"./input-DTXbDJaL.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./label-CqmyC9he.js";import"./help-icon-Buhx5nl6.js";import"./index-CEuq6vkz.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";const aa=()=>{const t=o.useRef(null);return o.useLayoutEffect(()=>{t.current&&(t.current(),t.current=null)}),n=>{t.current=n}},ia=(t,a)=>{const n=a==null?void 0:a[t];return n||(console.log(`Warning: 'unitTemplate' missing for '${t}'. Using initial unit, preferred unit or value unit.`),l.unitFromQuantity(t)??"")};var x=(t=>(t.CUSTOM="custom",t.PREDEFINED="predefined",t))(x||{});const Vn=t=>t==="undefined"||t===void 0||t===""||t==="null"||t===null||t==="NaN"||isNaN(t),Sn=(t="",a,n="",s=!1)=>{if(s)return t;if(a&&!Vn(t))try{const i=l.isValueWithUnit(t)?t:l.withUnit(t,n),m=l.convertSamePrecision(i,a);return l.getValue(m)}catch{}},ra=t=>t?!!l.getUnit(t):!1,O=(t="",a,n,s)=>{const i=ra(t)||l.isValueWithUnit(t),m=l.getValue(t);return Vn(m)?m:i?Sn(m,a,n,s):t},$e=t=>V.isObject(t)&&!V.isArray(t)&&!V.isFunction(t)?V.get(t,"fieldName",""):typeof t=="string"?t:"",ze=(t="")=>{var a;return(a=l.KNOWN_UNITS)==null?void 0:a.includes(t)},sa=(t,a)=>{const n=l.getUnit(t||"");return ze(a)&&ze(n)};let la=o.createContext(null);const oa=()=>o.useContext(la),ua="_predefinedMenuActive_ye9w9_1",da="_inputWrapper_ye9w9_4",Je={predefinedMenuActive:ua,inputWrapper:da},c=({name:t,placeholder:a="",disabled:n=!1,disabledUnit:s=!1,error:i=null,left:m=!1,small:u=!1,width:v="100%",value:f,unitkey:S="",initUnit:we,noConversion:Y=!1,onChange:P=V.noop,onClick:Te=V.noop,onFocus:ke=V.noop,onSwitchUnit:U=V.noop,unitTemplate:j,doNotConvertValue:R=!1,testId:_,warning:Fe=null,predefinedOptions:k,initialPredefinedOption:jn=!1,shouldLinkAutomaticly:Pe=!0,selectedPredefinedOptionKey:Re,validationCallback:En=()=>({name:"",error:null}),disabledValidation:Nn=!1,allowEmpty:ma=!1,autoValue:E,convertBackToStorageUnit:Bn=!1,enableCosmeticRounding:_e=!0,enableDisplayRounding:Dn=!1})=>{const M=oa(),An=aa();typeof f=="number"&&(f=`${f}`);const[Me="",N=""]=f!==void 0?l.split(f):[],We=E?l.getUnit(E):"",Oe=o.useMemo(()=>ia(S,j||(M==null?void 0:M.unitTemplate)),[S,j,M==null?void 0:M.unitTemplate]),qn=sa(f,Oe),w=we||Oe||N,Fn=Jn(w),He=O(f,w,N,R),Le=O(E,w,We,R),Pn=He!==""?{value:He,unit:w}:Le!==""?{value:Le,unit:w}:{value:Me,unit:N},[h,Ve]=o.useState(Pn),Rn=(h==null?void 0:h.value)===void 0,[B,Se]=o.useState(jn?x.PREDEFINED:x.CUSTOM),je=Me===""&&E,_n=!!(Nn||E),Z=k&&k.find(r=>{if(!(r!=null&&r.value))return;if(Re)return Re===r.valueKey;const d=l.isValueWithUnit(r.value)?l.getUnit(r.value):"";return l.withUnit(Sn(f,d),d)===r.value}),Mn=()=>{if(S)try{const r=je?E:f??"";let d=l.altUnitsList(r,S);return l.getValue(r)===""?d.map(T=>["",T[1]]):d}catch{return null}},Wn=r=>{const d=$e(t),T=r.target,{value:D,selectionStart:W}=T,Ce=l.withUnit(D,(h==null?void 0:h.unit)||""),Ne=Bn?l.withUnit(l.convertAndGetValue(Ce,N),N):Ce;P({target:{value:Ne,name:d}});const[Kn,$n]=l.split(Ce);Ve({value:Kn,unit:$n}),An(()=>{T.selectionStart=W,T.selectionEnd=W})},On=(r,d)=>{d===h.unit||isNaN(Number(r))||(Ve({value:r,unit:d}),U&&U(d))};o.useEffect(()=>{if(w){let r,d="";Fn!==w?(r=O(f,w,N,R),d=w):l.withUnit(h.value,h.unit)!==f&&(r=O(f,h.unit,N,R),d=h.unit),r!==void 0&&Ve({value:r,unit:d}),k&&Se(Z&&Pe?x.PREDEFINED:x.CUSTOM)}},[w,f,i,Pe]);const fe=Mn(),ye=l.label(h.unit)||h.unit||"",Hn=Y||!fe||fe&&fe.length===1,Ee=$e(t);let be;const Ln=r=>{const d=r!=null&&r.value?r.value:"",[T="",D=""]=l.isValueWithUnit(d)?l.split(d):[d];return{type:Ke.OPTION,inline:!0,onClick:()=>{l.validateNumber(T).valid&&!n&&(Se(x.PREDEFINED),P({target:{value:d,name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||"",predefinedSelected:!0,predefinedOption:r}}))},label:e.jsxs(e.Fragment,{children:[e.jsx(xe,{children:r.label}),e.jsx(b,{width:"20px",height:"0"})]}),description:l.isValueWithUnit(d)?`${T} ${D}`:d,selected:Z===r&&B===x.PREDEFINED}};if(be=[{type:Ke.OPTION,inline:!0,onClick:()=>{B!==x.CUSTOM&&!n&&P({target:{value:l.withUnit(h.value,h.unit),name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||""}})},label:"Custom",selected:B===x.CUSTOM}],k!=null&&k.length){const r=k.map(Ln);be=[...be,...r]}const Gn=r=>{if(je)return O(E,h.unit,We,R);if(l.isValueWithUnit(r)){const d=l.getUnit(r);return O(r,h.unit,d,R)}return r};return e.jsx("div",{className:B===x.PREDEFINED?zn(Je.predefinedMenuActive):"",children:e.jsxs(Qn,{small:u,width:v,children:[k&&e.jsx(Zn,{text:B===x.PREDEFINED?Z==null?void 0:Z.label:"",children:e.jsx(Ge,{maxHeight:380,groupOrder:"first",testId:_&&`${_}-predefined-menu`,disabled:n,menu:{colored:!0,trigger:"Component",component:e.jsx(p,{groupOrder:"first",active:B===x.PREDEFINED,icon:B===x.PREDEFINED?"link":"unlink"}),small:u,sections:be}})}),e.jsx("div",{className:Je.inputWrapper,children:e.jsx(Xn,{name:Ee,testId:_,disabled:n,placeholder:Gn(a),value:h.value,onChange:Wn,onFocus:ke,error:i===null?void 0:i,warning:Fe===null?void 0:Fe,left:m,allowEmpty:Rn,validationCallback:(r,d)=>En(Ee,d),enableCosmeticRounding:_e,enableDisplayRounding:Dn,groupOrder:k?"middle":"first",disableInternalErrorValidationMessages:_n,small:u},Ee)}),ye&&(Hn||!qn?e.jsx(Yn,{groupOrder:"last",children:ye}):e.jsx(Ge,{maxHeight:380,groupOrder:"last",disabled:s,testId:_&&`${_}-menu`,menu:{label:ye,trigger:"DropDownButton",small:u,sections:fe.map(([r,d,T])=>{const D=T||d||"",W=l.isValidNum(r)?r:"";return{type:"Option",label:_e?ea(W):W,inline:!0,onClick:Ne=>{Ne.stopPropagation(),On(je?"":r,d)},description:D,selected:D===ye,testId:`${_}-unit-${D}`}})}}))]})})};c.__docgenInfo={description:"",methods:[],displayName:"UnitInput",props:{name:{required:!0,tsType:{name:"union",raw:"string | { fieldName?: string }",elements:[{name:"string"},{name:"signature",type:"object",raw:"{ fieldName?: string }",signature:{properties:[{key:"fieldName",value:{name:"string",required:!1}}]}}]},description:""},placeholder:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"''",computed:!1}},disabled:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},disabledUnit:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},error:{required:!1,tsType:{name:"union",raw:"string | null | boolean",elements:[{name:"string"},{name:"null"},{name:"boolean"}]},description:"",defaultValue:{value:"null",computed:!1}},left:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},small:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},width:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:"",defaultValue:{value:"'100%'",computed:!1}},value:{required:!1,tsType:{name:"string"},description:""},unitkey:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"''",computed:!1}},initUnit:{required:!1,tsType:{name:"string"},description:""},noConversion:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},doNotConvertValue:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},testId:{required:!1,tsType:{name:"string"},description:""},warning:{required:!1,tsType:{name:"union",raw:"string | boolean | null",elements:[{name:"string"},{name:"boolean"},{name:"null"}]},description:"",defaultValue:{value:"null",computed:!1}},predefinedOptions:{required:!1,tsType:{name:"union",raw:"IPredefinedOption[] | null",elements:[{name:"Array",elements:[{name:"IPredefinedOption"}],raw:"IPredefinedOption[]"},{name:"null"}]},description:""},initialPredefinedOption:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},shouldLinkAutomaticly:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},selectedPredefinedOptionKey:{required:!1,tsType:{name:"string"},description:""},validationCallback:{required:!1,tsType:{name:"signature",type:"function",raw:"(name: string, error: string | null) => any",signature:{arguments:[{type:{name:"string"},name:"name"},{type:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},name:"error"}],return:{name:"any"}}},description:"",defaultValue:{value:"() => ({ name: '', error: null })",computed:!1}},disabledValidation:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},allowEmpty:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},autoValue:{required:!1,tsType:{name:"string"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(event: TChangeEvent | ICustomChangeEvent) => void",signature:{arguments:[{type:{name:"union",raw:"TChangeEvent | ICustomChangeEvent",elements:[{name:"intersection",raw:`ChangeEvent<T> & {
1
+ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as o}from"./index-DhsZuJvc.js";import{d as l}from"./index-C0x1JmaP.js";import{w as F,u as g,e as f,f as xe,a as Ie}from"./index-DMAnyMX5.js";import{c as zn}from"./index-Bk2sglWO.js";import{u as Jn}from"./use-previous-D775JrO6.js";import{M as Ge}from"./actions-D-uVCDzk.js";import{I as Yn}from"./input-group-addon-D68iUKV2.js";import{B as p}from"./button-DHevvVBE.js";import{T as Zn}from"./tooltip-1V7clEnw.js";import{I as Qn}from"./input-group-BaRSJAEN.js";import{S as b}from"./spacer-BWoNR27H.js";import{T as we}from"./text-B3-TSWok.js";import{M as Ke}from"./types-BmbYqTX_.js";import{l as V}from"./lodash-c4VUpsOs.js";import{N as Xn,r as ea}from"./number-input-DOZPfwJP.js";import{D as ta}from"./divider-DY9nJ_7N.js";import{R as wn,C as qe}from"./row-Bmiy2Lh0.js";import{F as I}from"./field-HrLaMLbx.js";import{M as Te}from"./message-Y48EomV-.js";import{G as Tn}from"./grid-DRkC-bt8.js";import{C as A}from"./card-EcjmryU9.js";import{H as q}from"./heading-CRNoBc7q.js";import{T as Ae}from"./toggle-BbFVf61v.js";import{S as na}from"./select-DnRuRG_N.js";import{I as kn}from"./icon-BSFY3vDO.js";import"./index-DRSy5Ssd.js";import"./index-CF7H4eMJ.js";import"./common-types-Sih75Sav.js";import"./disabled-context-rmpd7YJS.js";import"./types-Dx2TtIG9.js";import"./badge-CLQ59MDF.js";import"./spinner-AWUe4xwQ.js";import"./index-CUZDtIZe.js";import"./select.input-D0UkAPd9.js";import"./input-DTXbDJaL.js";import"./styled-components.browser.esm-BQ9GQzDc.js";import"./label-CqmyC9he.js";import"./help-icon-Buhx5nl6.js";import"./index-CEuq6vkz.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./memoize-one.esm-CcMeOnPo.js";import"./objectWithoutPropertiesLoose-CAYKN5F1.js";const aa=()=>{const t=o.useRef(null);return o.useLayoutEffect(()=>{t.current&&(t.current(),t.current=null)}),n=>{t.current=n}},ia=(t,a)=>{const n=a==null?void 0:a[t];return n||(console.log(`Warning: 'unitTemplate' missing for '${t}'. Using initial unit, preferred unit or value unit.`),l.unitFromQuantity(t)??"")};var x=(t=>(t.CUSTOM="custom",t.PREDEFINED="predefined",t))(x||{});const Vn=t=>t==="undefined"||t===void 0||t===""||t==="null"||t===null||t==="NaN"||isNaN(t),Sn=(t="",a,n="",s=!1)=>{if(s)return t;if(a&&!Vn(t))try{const i=l.isValueWithUnit(t)?t:l.withUnit(t,n),m=l.convertSamePrecision(i,a);return l.getValue(m)}catch{}},ra=t=>t?!!l.getUnit(t):!1,O=(t="",a,n,s)=>{const i=ra(t)||l.isValueWithUnit(t),m=l.getValue(t);return Vn(m)?m:i?Sn(m,a,n,s):t},$e=t=>V.isObject(t)&&!V.isArray(t)&&!V.isFunction(t)?V.get(t,"fieldName",""):typeof t=="string"?t:"",ze=(t="")=>{var a;return(a=l.KNOWN_UNITS)==null?void 0:a.includes(t)},sa=(t,a)=>{const n=l.getUnit(t||"");return ze(a)&&ze(n)};let la=o.createContext(null);const oa=()=>o.useContext(la),ua="_predefinedMenuActive_ye9w9_1",da="_inputWrapper_ye9w9_4",Je={predefinedMenuActive:ua,inputWrapper:da},c=({name:t,placeholder:a="",disabled:n=!1,disabledUnit:s=!1,error:i=null,left:m=!1,small:u=!1,width:v="100%",value:y,unitkey:S="",initUnit:ke,noConversion:Y=!1,onChange:P=V.noop,onClick:Ve=V.noop,onFocus:Se=V.noop,onSwitchUnit:U=V.noop,unitTemplate:j,doNotConvertValue:R=!1,testId:_,warning:Fe=null,predefinedOptions:k,initialPredefinedOption:jn=!1,shouldLinkAutomaticly:Pe=!0,selectedPredefinedOptionKey:Re,validationCallback:En=()=>({name:"",error:null}),disabledValidation:Bn=!1,allowEmpty:ma=!1,autoValue:E,convertBackToStorageUnit:Nn=!1,enableCosmeticRounding:_e=!0,enableDisplayRounding:Dn=!1})=>{const M=oa(),An=aa();typeof y=="number"&&(y=`${y}`);const[Me="",B=""]=y!==void 0?l.split(y):[],We=E?l.getUnit(E):"",Oe=o.useMemo(()=>ia(S,j||(M==null?void 0:M.unitTemplate)),[S,j,M==null?void 0:M.unitTemplate]),qn=sa(y,Oe),w=ke||Oe||B,Fn=Jn(w),He=O(y,w,B,R),Le=O(E,w,We,R),Pn=He!==""?{value:He,unit:w}:Le!==""?{value:Le,unit:w}:{value:Me,unit:B},[h,je]=o.useState(Pn),Rn=(h==null?void 0:h.value)===void 0,[N,Ee]=o.useState(jn?x.PREDEFINED:x.CUSTOM),Be=Me===""&&E,_n=!!(Bn||E),Z=k&&k.find(r=>{if(!(r!=null&&r.value))return;if(Re)return Re===r.valueKey;const d=l.isValueWithUnit(r.value)?l.getUnit(r.value):"";return l.withUnit(Sn(y,d),d)===r.value}),Mn=()=>{if(S)try{const r=Be?E:y??"";let d=l.altUnitsList(r,S);return l.getValue(r)===""?d.map(T=>["",T[1]]):d}catch{return null}},Wn=r=>{const d=$e(t),T=r.target,{value:D,selectionStart:W}=T,Ce=l.withUnit(D,(h==null?void 0:h.unit)||""),De=Nn?l.withUnit(l.convertAndGetValue(Ce,B),B):Ce;P({target:{value:De,name:d}});const[Kn,$n]=l.split(Ce);je({value:Kn,unit:$n}),An(()=>{T.selectionStart=W,T.selectionEnd=W})},On=(r,d)=>{d===h.unit||isNaN(Number(r))||(je({value:r,unit:d}),U&&U(d))};o.useEffect(()=>{if(w){let r,d="";Fn!==w?(r=O(y,w,B,R),d=w):l.withUnit(h.value,h.unit)!==y&&(r=O(y,h.unit,B,R),d=h.unit),r!==void 0&&je({value:r,unit:d}),k&&Ee(Z&&Pe?x.PREDEFINED:x.CUSTOM)}},[w,y,i,Pe]);const fe=Mn(),ye=l.label(h.unit)||h.unit||"",Hn=Y||!fe||fe&&fe.length===1,Ne=$e(t);let be;const Ln=r=>{const d=r!=null&&r.value?r.value:"",[T="",D=""]=l.isValueWithUnit(d)?l.split(d):[d];return{type:Ke.OPTION,inline:!0,onClick:()=>{l.validateNumber(T).valid&&!n&&(Ee(x.PREDEFINED),P({target:{value:d,name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||"",predefinedSelected:!0,predefinedOption:r}}))},label:e.jsxs(e.Fragment,{children:[e.jsx(we,{children:r.label}),e.jsx(b,{width:"20px",height:"0"})]}),description:l.isValueWithUnit(d)?`${T} ${D}`:d,selected:Z===r&&N===x.PREDEFINED}};if(be=[{type:Ke.OPTION,inline:!0,onClick:()=>{N!==x.CUSTOM&&!n&&P({target:{value:l.withUnit(h.value,h.unit),name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||""}})},label:"Custom",selected:N===x.CUSTOM}],k!=null&&k.length){const r=k.map(Ln);be=[...be,...r]}const Gn=r=>{if(Be)return O(E,h.unit,We,R);if(l.isValueWithUnit(r)){const d=l.getUnit(r);return O(r,h.unit,d,R)}return r};return e.jsx("div",{className:N===x.PREDEFINED?zn(Je.predefinedMenuActive):"",children:e.jsxs(Qn,{small:u,width:v,children:[k&&e.jsx(Zn,{text:N===x.PREDEFINED?Z==null?void 0:Z.label:"",children:e.jsx(Ge,{maxHeight:380,groupOrder:"first",testId:_&&`${_}-predefined-menu`,disabled:n,menu:{colored:!0,trigger:"Component",component:e.jsx(p,{groupOrder:"first",active:N===x.PREDEFINED,icon:N===x.PREDEFINED?"link":"unlink"}),small:u,sections:be}})}),e.jsx("div",{className:Je.inputWrapper,children:e.jsx(Xn,{name:Ne,testId:_,disabled:n,placeholder:Gn(a),value:h.value,onChange:Wn,onFocus:Se,error:i===null?void 0:i,warning:Fe===null?void 0:Fe,left:m,allowEmpty:Rn,validationCallback:(r,d)=>En(Ne,d),enableCosmeticRounding:_e,enableDisplayRounding:Dn,groupOrder:k?"middle":"first",disableInternalErrorValidationMessages:_n,small:u},Ne)}),ye&&(Hn||!qn?e.jsx(Yn,{groupOrder:"last",children:ye}):e.jsx(Ge,{maxHeight:380,groupOrder:"last",disabled:s,testId:_&&`${_}-menu`,menu:{label:ye,trigger:"DropDownButton",small:u,sections:fe.map(([r,d,T])=>{const D=T||d||"",W=l.isValidNum(r)?r:"";return{type:"Option",label:_e?ea(W):W,inline:!0,onClick:De=>{De.stopPropagation(),On(Be?"":r,d)},description:D,selected:D===ye,testId:`${_}-unit-${D}`}})}}))]})})};c.__docgenInfo={description:"",methods:[],displayName:"UnitInput",props:{name:{required:!0,tsType:{name:"union",raw:"string | { fieldName?: string }",elements:[{name:"string"},{name:"signature",type:"object",raw:"{ fieldName?: string }",signature:{properties:[{key:"fieldName",value:{name:"string",required:!1}}]}}]},description:""},placeholder:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"''",computed:!1}},disabled:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},disabledUnit:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},error:{required:!1,tsType:{name:"union",raw:"string | null | boolean",elements:[{name:"string"},{name:"null"},{name:"boolean"}]},description:"",defaultValue:{value:"null",computed:!1}},left:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},small:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},width:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:"",defaultValue:{value:"'100%'",computed:!1}},value:{required:!1,tsType:{name:"string"},description:""},unitkey:{required:!1,tsType:{name:"string"},description:"",defaultValue:{value:"''",computed:!1}},initUnit:{required:!1,tsType:{name:"string"},description:""},noConversion:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},doNotConvertValue:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},testId:{required:!1,tsType:{name:"string"},description:""},warning:{required:!1,tsType:{name:"union",raw:"string | boolean | null",elements:[{name:"string"},{name:"boolean"},{name:"null"}]},description:"",defaultValue:{value:"null",computed:!1}},predefinedOptions:{required:!1,tsType:{name:"union",raw:"IPredefinedOption[] | null",elements:[{name:"Array",elements:[{name:"IPredefinedOption"}],raw:"IPredefinedOption[]"},{name:"null"}]},description:""},initialPredefinedOption:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},shouldLinkAutomaticly:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},selectedPredefinedOptionKey:{required:!1,tsType:{name:"string"},description:""},validationCallback:{required:!1,tsType:{name:"signature",type:"function",raw:"(name: string, error: string | null) => any",signature:{arguments:[{type:{name:"string"},name:"name"},{type:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},name:"error"}],return:{name:"any"}}},description:"",defaultValue:{value:"() => ({ name: '', error: null })",computed:!1}},disabledValidation:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},allowEmpty:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},autoValue:{required:!1,tsType:{name:"string"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(event: TChangeEvent | ICustomChangeEvent) => void",signature:{arguments:[{type:{name:"union",raw:"TChangeEvent | ICustomChangeEvent",elements:[{name:"intersection",raw:`ChangeEvent<T> & {
2
2
  target:
3
3
  | T
4
4
  | { name: string; value: any; label?: string; files?: FileList | null };
@@ -7,7 +7,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as o}from"./index-DhsZuJv
7
7
  | T
8
8
  | { name: string; value: any; label?: string; files?: FileList | null };
9
9
  }`,signature:{properties:[{key:"target",value:{name:"union",raw:`| T
10
- | { name: string; value: any; label?: string; files?: FileList | null }`,elements:[{name:"T"},{name:"signature",type:"object",raw:"{ name: string; value: any; label?: string; files?: FileList | null }",signature:{properties:[{key:"name",value:{name:"string",required:!0}},{key:"value",value:{name:"any",required:!0}},{key:"label",value:{name:"string",required:!1}},{key:"files",value:{name:"union",raw:"FileList | null",elements:[{name:"FileList"},{name:"null"}],required:!1}}]}}],required:!0}}]}}]},{name:"ICustomChangeEvent"}]},name:"event"}],return:{name:"void"}}},description:"",defaultValue:{value:"noop",computed:!0}},onSwitchUnit:{required:!1,tsType:{name:"signature",type:"function",raw:"(unit: string) => void",signature:{arguments:[{type:{name:"string"},name:"unit"}],return:{name:"void"}}},description:"",defaultValue:{value:"noop",computed:!0}},onClick:{required:!1,tsType:{name:"MouseEventHandler",elements:[{name:"HTMLInputElement"}],raw:"MouseEventHandler<HTMLInputElement>"},description:"",defaultValue:{value:"noop",computed:!0}},onFocus:{required:!1,tsType:{name:"FocusEventHandler",elements:[{name:"HTMLInputElement"}],raw:"FocusEventHandler<HTMLInputElement>"},description:"",defaultValue:{value:"noop",computed:!0}},unitTemplate:{required:!1,tsType:{name:"Record",elements:[{name:"string"},{name:"any"}],raw:"Record<string, any>"},description:""},convertBackToStorageUnit:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},enableCosmeticRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},enableDisplayRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}}}};const{useArgs:ca}=__STORYBOOK_MODULE_PREVIEW_API__,ai={title:"Forms/UnitInput",component:c,args:{name:"example",unitkey:"length",value:"123|m"}},C=t=>{const[a,n]=ca(),s=i=>{n({value:i.target.value})};return e.jsx(c,{...t,onChange:s})},Ue=C.bind({}),Q=C.bind({});Q.args={initUnit:"ft",unitTemplate:{length:"ft"}};const X=C.bind({});X.args={value:'123|"',unitkey:'"'};const ee=C.bind({});ee.args={width:"180px"};const te=C.bind({});te.args={noConversion:!0};const ne=C.bind({});ne.args={small:!0};const H=()=>{const[t,a]=o.useState("123|m");return e.jsx(c,{name:"example",onChange:n=>a(n.target.value),placeholder:"Type a value...",value:t,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId"})};H.play=async({canvasElement:t,step:a})=>{const n=F(t),s=F(t.ownerDocument.body);await a("Shows validation error for non-numeric input",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"123x45s6"),await y(n.getByDisplayValue("123x45s6")).toBeInTheDocument(),await Ae.mouseOver(i),await qe(()=>{y(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};const L=()=>{const[t,a]=o.useState("12|m");return e.jsx(c,{name:"example-ft",onChange:n=>a(n.target.value),placeholder:"7|ft",value:t,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId-ft"})};L.play=async({canvasElement:t,step:a})=>{const n=F(t),s=F(t.ownerDocument.body);await a("Shows validation error for non-numeric input",async()=>{const i=n.getByTestId("testId-ft");await g.clear(i),await g.type(i,"123sdf231"),await y(n.getByDisplayValue("123sdf231")).toBeInTheDocument(),await Ae.mouseOver(i),await qe(()=>{y(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};const ae=C.bind({});ae.args={error:"Error message goes here"};const ie=C.bind({});ie.args={value:"asas123asd|%"};const G=C.bind({});G.args={disabled:!0,disabledUnit:!0};G.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 re=C.bind({});re.args={disabled:!0,disabledUnit:!0,noConversion:!0};const se=C.bind({});se.args={disabledUnit:!0,unitkey:void 0};const le=C.bind({});le.args={disabledUnit:!0,unitkey:"length"};const oe=C.bind({});oe.args={disabledUnit:!1,disabled:!0};const K=t=>{const[a,n]=o.useState("123|m"),[s,i]=o.useState("223|m"),[m,u]=o.useState("ft");return e.jsxs(e.Fragment,{children:[e.jsx(p,{label:"Change initUnit",onClick:()=>u(m==="m"?"ft":"m")}),e.jsx(b,{}),e.jsx(p,{label:"Change value",onClick:()=>n(a==="123|m"?"456|m":"123|m")}),e.jsx(b,{}),e.jsx(c,{name:"example",onChange:v=>{n(v.target.value)},unitkey:"length",value:a,initUnit:m,onSwitchUnit:u}),e.jsx(b,{}),e.jsx(c,{name:"example2",onChange:v=>{i(v.target.value)},unitkey:"length",value:s,initUnit:m,onSwitchUnit:u}),e.jsx(ta,{}),e.jsx("h4",{children:"Without initUnit property (taken from the redux store)"}),e.jsx(c,{name:"example",onChange:v=>{n(v.target.value)},unitkey:"length",value:a,onSwitchUnit:u}),e.jsx(c,{name:"example2",onChange:v=>{i(v.target.value)},unitkey:"length",value:s,onSwitchUnit:u})]})};K.parameters={docs:{description:{story:"[OW-4380](https://oliasoft.atlassian.net/browse/OW-4380?atlOrigin=eyJpIjoiMmM1N2RkNWU3Mjk5NDYxY2E0YzhkMzk5ZTVmZTJhMjciLCJwIjoiaiJ9)"}}};const ue=C.bind({});ue.args={predefinedOptions:[{label:"bottom of casing",value:"12|km"},{label:"mud weight at shoe depth",value:"8|mm"}]};const $=()=>{const t="500px",[a,n]=o.useState(void 0);return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different edge cases such as +/- infinity, undefined, NaN, null:"}),e.jsxs(wn,{children:[e.jsxs(De,{width:"25%",children:[e.jsx(p,{label:"Change value infinity",onClick:()=>n(1/0)}),e.jsx("br",{}),e.jsx(p,{label:"Change value -infinity",onClick:()=>n(-1/0)}),e.jsx("br",{}),e.jsx(p,{label:"Change value null",onClick:()=>n(null)}),e.jsx("br",{}),e.jsx(p,{label:"Change value - undefined",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(p,{label:"Change value - NaN",onClick:()=>n(NaN)}),e.jsx("br",{}),e.jsx(p,{label:"Change value - nothing (empty)",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(p,{label:"Change value - empty string",onClick:()=>n("")})]}),e.jsxs(De,{width:"25%",children:[e.jsx(p,{label:"Change value infinity|m",onClick:()=>n("Infinity|m")}),e.jsx("br",{}),e.jsx(p,{label:"Change value -infinity|m",onClick:()=>n("-Infinity|m")}),e.jsx("br",{}),e.jsx(p,{label:"Change value null|m",onClick:()=>n("null|m")}),e.jsx("br",{}),e.jsx(p,{label:"Change value - undefined|m",onClick:()=>n("undefined|m")}),e.jsx("br",{}),e.jsx(p,{label:"Change value - NaN|m",onClick:()=>n("NaN|m")}),e.jsx("br",{}),e.jsx(p,{label:"Change value - nothing (empty)|m",onClick:()=>n("|m")})]})]}),e.jsx("br",{}),e.jsx(I,{label:"Normal PUI",children:e.jsx(c,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit"})}),e.jsx(I,{label:"Disabled validation",children:e.jsx(c,{name:"example2",onChange:s=>n(s.target.value),value:a,unitkey:"length",disabledValidation:!0,width:t})}),e.jsx(I,{label:"Disabled validation and manual error",children:e.jsx(c,{name:"example3",onChange:s=>n(s.target.value),value:a,unitkey:"length",error:"test",disabledValidation:!0,width:t})}),e.jsx(Ie,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})},de=()=>{const t="500px",[a,n]=o.useState("1|m"),[s,i]=o.useState("|m"),m="123|km";return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different cases for automatic (placeholder) values:"}),e.jsx(wn,{children:e.jsxs(De,{width:"25%",children:[e.jsx(p,{label:"Change value to ''",onClick:()=>n("")}),e.jsx("br",{}),e.jsx(p,{label:"Change value to 1",onClick:()=>n("1")}),e.jsx("br",{}),e.jsx(p,{label:"Change value to 1|m",onClick:()=>n("1|m")}),e.jsx("br",{}),e.jsx(p,{label:"Change value to |m - empty value",onClick:()=>n("|m")})]})}),e.jsx("br",{}),e.jsx(I,{label:"Normal PUI (placeholder + auto)",children:e.jsx(c,{name:"example1",onChange:u=>n(u.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit",autoValue:m})}),e.jsx(I,{label:"Normal PUI (only auto)",children:e.jsx(c,{name:"example1",onChange:u=>n(u.target.value),value:a,unitkey:"length",width:t,autoValue:m})}),e.jsx(I,{label:"Empty PUI with autoValue",children:e.jsx(c,{name:"example1",onChange:u=>i(u.target.value),value:s,unitkey:"length",width:t,autoValue:m})}),e.jsx(I,{label:"Normal PUI (only placeholder)",children:e.jsx(c,{name:"example1",onChange:u=>n(u.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test"})}),e.jsx(I,{label:"Normal PUI (placeholder + allowEmpty)",children:e.jsx(c,{name:"example1",onChange:u=>n(u.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test",allowEmpty:!0})}),e.jsx(Ie,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})};$.parameters={docs:{description:{story:"[OW-8884](https://oliasoft.atlassian.net/browse/OW-8884)"}}};const ce=()=>{const[t,a]=o.useState("123|%"),[n,s]=o.useState(null),i="This should be visible when an error appears",m=(u,v)=>(s(v),{name:u,error:v});return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"3rd party validation message when inputting invalid value:"}),e.jsx(c,{name:"example",onChange:u=>a(u.target.value),error:!n||i,validationCallback:m,value:t}),e.jsx("br",{}),e.jsx(b,{}),e.jsx("h4",{children:"Original validation message: "}),e.jsx(Ie,{message:{heading:n,visible:!0}})]})},me=()=>{const[t,a]=o.useState("123|m"),[n,s]=o.useState(""),[i,m]=o.useState("km"),u=()=>{m("ft"),s("placeholder"),a("|m")};return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Empty value case:"}),e.jsx(c,{name:"example",onChange:v=>a(v.target.value),value:t,allowEmpty:!0,placeholder:n,initUnit:i,unitkey:"length"}),e.jsx("br",{}),e.jsx(b,{}),e.jsx(p,{label:"Change value |m and unit ft",onClick:()=>u()})]})},pe=()=>{const[t,a]=o.useState("123|m"),[n,s]=o.useState("m");return e.jsxs(e.Fragment,{children:[e.jsx(c,{name:"example",onChange:i=>a(i.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:s}),e.jsx(b,{}),e.jsx(c,{name:"example",onChange:i=>a(i.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:s})]})},ge=()=>{const[t,a]=o.useState(!0),n=()=>{a(!1),setTimeout(()=>a(!0),0)},[s,i]=o.useState("123|ft");return e.jsxs(Tn,{columns:"1fr 1fr",gap:!0,children:[e.jsxs(A,{heading:e.jsx(q,{children:"Storage State (Redux)"}),children:[s,e.jsx(b,{}),e.jsx(p,{label:"Change value",onClick:()=>i(l.withUnit(String(Math.floor(Math.random()*100)),"ft"))})]}),e.jsx(A,{heading:e.jsx(q,{icon:e.jsx(kn,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:n,children:"UnitInput"}),children:t&&e.jsx(c,{name:"example",onChange:m=>i(m.target.value),value:s,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"}})})]})},he=()=>e.jsxs(e.Fragment,{children:[e.jsx(xe,{faint:!0,children:"Reproduce OW-10614 rounding noise bug when storing values in a different unit to the display unit"}),e.jsx(b,{}),e.jsx(c,{name:"example",onChange:()=>{},value:l.withUnit(l.convertAndGetValue("9750|psi","bar"),"bar"),initUnit:"psi",unitkey:"pressure",unitTemplate:{pressure:"psi"}}),e.jsx(b,{}),e.jsx(c,{name:"example2",onChange:()=>{},value:l.withUnit(l.convertAndGetValue("8642|lbf","tonneForce"),"tonneForce"),initUnit:"lbf",unitkey:"force",unitTemplate:{force:"tonneForce"}})]}),z=()=>e.jsxs(e.Fragment,{children:[e.jsx(c,{name:"example",unitkey:"moleWeight",initUnit:"g/mol",doNotConvertValue:!0,value:"170|g/mol",unitTemplate:{moleWeight:"g/mol"},testId:"case1"}),e.jsx(b,{}),e.jsx(c,{name:"gor",unitkey:"moleWeight",initUnit:"gor",value:"Infinity|SCF/STB",testId:"case2"})]});z.play=async({canvasElement:t,step:a})=>{const n=F(t);await a("Can enter decimal values",async()=>{await y(n.getByDisplayValue("170")).toBeInTheDocument(),await y(n.getByDisplayValue("")).toBeInTheDocument()})};const ve=()=>{const[t,a]=o.useState(!0),n=()=>{a(!1),setTimeout(()=>a(!0),0)},[s,i]=o.useState("psi"),[m,u]=o.useState(!1),[v,f]=o.useState(!0),[S,we]=o.useState(!0),[Y,P]=o.useState("672.2388357750001|bar"),[Te,ke]=o.useState("");return e.jsxs(Tn,{columns:"1fr 1fr",gap:!0,children:[e.jsxs(A,{heading:e.jsx(q,{children:"Settings"}),children:[e.jsx(I,{label:"Enable display rounding:",labelLeft:!0,labelWidth:200,children:e.jsx(Be,{checked:m,onChange:U=>u(U.target.checked)})}),e.jsx(I,{label:"Enable cosmetic rounding:",labelLeft:!0,labelWidth:200,children:e.jsx(Be,{checked:v,onChange:U=>f(U.target.checked)})}),e.jsx(I,{label:"Convert back to storage unit (onChange):",labelLeft:!0,labelWidth:200,children:e.jsx(Be,{checked:S,onChange:U=>we(U.target.checked)})})]}),e.jsxs(A,{heading:e.jsx(q,{icon:e.jsx(kn,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:n,children:"UnitInput"}),children:[e.jsx(xe,{faint:!0,children:"Cosmetic Rounding Test Case: type 9750 then return (compare with enableCosmeticRounding on and off)"}),e.jsx(b,{}),e.jsx(xe,{warning:!0,children:"Note: UnitInput uses convertSamePrecision internally (decision prior to cosmetic value implementation). This means not all rounding noise occurrences seen in NumberInput will be reproducible in UnitInput, because they get rounded off by other logic."}),e.jsx(b,{}),t&&e.jsx(c,{name:"Example",unitkey:"pressure",initUnit:s,unitTemplate:{pressure:"psi"},value:Y,onChange:U=>{const{value:j}=U.target;j&&P(j)},enableDisplayRounding:m,enableCosmeticRounding:v,error:l.convertAndGetValue(Y,"bar")>=0?"":"Value must be positive",validationCallback:(U,j)=>{ke(j??"")},convertBackToStorageUnit:S})]}),e.jsx(A,{heading:e.jsx(q,{children:"Unit Template"}),children:e.jsx(na,{options:[{label:"Bar",value:"bar"},{label:"psi",value:"psi"}],value:s,width:70,onChange:U=>i(U.target.value)})}),e.jsx(A,{heading:e.jsx(q,{children:"Test Validation Callback"}),children:Te&&e.jsx(Ie,{message:{content:Te,icon:!0,type:"Error",visible:!0}})}),e.jsxs(A,{heading:e.jsx(q,{children:"Storage State / Redux"}),children:[Y,e.jsx(b,{}),e.jsx(p,{label:"Change value",onClick:()=>P(l.withUnit(String(Math.floor(Math.random()*100)),"bar"))})]})]})},J=()=>{const[t,a]=o.useState("123|m");return e.jsx(c,{name:"example",onChange:n=>a(n.target.value),value:t,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId"})};J.play=async({canvasElement:t,step:a})=>{const n=F(t),s=F(t.ownerDocument.body);await a("Can enter decimal values",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"123.123456789"),await y(n.getByDisplayValue("123.123456789")).toBeInTheDocument()}),await a("Can enter scientific notation",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"-1.12e3"),await y(n.getByDisplayValue("-1.12e3")).toBeInTheDocument()}),await a("Can enter comma decimals (converts to dot)",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"123,456"),await y(n.getByDisplayValue("123.456")).toBeInTheDocument()}),await a("Can enter small numbers",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"0.0000000023"),await y(n.getByDisplayValue("0.0000000023")).toBeInTheDocument()}),await a("Can enter large numbers",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"999999999999"),await y(n.getByDisplayValue("999999999999")).toBeInTheDocument()}),await a("Can convert units",async()=>{const i=n.getByTestId("testId"),m=n.getByTestId("testId-menu");await g.clear(i),await g.type(i,"456.1"),await g.click(m),await g.click(s.getByTestId("testId-unit-ft")),await y(n.getByDisplayValue("1496")).toBeInTheDocument()}),await a("Shows validation error for non-numeric input",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"123x45s6"),await y(n.getByDisplayValue("123x45s6")).toBeInTheDocument(),await Ae.mouseOver(i),await qe(()=>{y(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};H.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"Placeholder"};L.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"PlaceholderWithUnit"};K.__docgenInfo={description:"",methods:[],displayName:"TestExternalStateChangeWithSynchronizedUnits",props:{name:{required:!0,tsType:{name:"union",raw:"string | { fieldName?: string }",elements:[{name:"string"},{name:"signature",type:"object",raw:"{ fieldName?: string }",signature:{properties:[{key:"fieldName",value:{name:"string",required:!1}}]}}]},description:""},placeholder:{required:!1,tsType:{name:"string"},description:""},disabled:{required:!1,tsType:{name:"boolean"},description:""},disabledUnit:{required:!1,tsType:{name:"boolean"},description:""},error:{required:!1,tsType:{name:"union",raw:"string | null | boolean",elements:[{name:"string"},{name:"null"},{name:"boolean"}]},description:""},left:{required:!1,tsType:{name:"boolean"},description:""},small:{required:!1,tsType:{name:"boolean"},description:""},width:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},value:{required:!1,tsType:{name:"string"},description:""},unitkey:{required:!1,tsType:{name:"string"},description:""},initUnit:{required:!1,tsType:{name:"string"},description:""},noConversion:{required:!1,tsType:{name:"boolean"},description:""},doNotConvertValue:{required:!1,tsType:{name:"boolean"},description:""},testId:{required:!1,tsType:{name:"string"},description:""},warning:{required:!1,tsType:{name:"union",raw:"string | boolean | null",elements:[{name:"string"},{name:"boolean"},{name:"null"}]},description:""},predefinedOptions:{required:!1,tsType:{name:"union",raw:"IPredefinedOption[] | null",elements:[{name:"Array",elements:[{name:"IPredefinedOption"}],raw:"IPredefinedOption[]"},{name:"null"}]},description:""},initialPredefinedOption:{required:!1,tsType:{name:"boolean"},description:""},shouldLinkAutomaticly:{required:!1,tsType:{name:"boolean"},description:""},selectedPredefinedOptionKey:{required:!1,tsType:{name:"string"},description:""},validationCallback:{required:!1,tsType:{name:"signature",type:"function",raw:"(name: string, error: string | null) => any",signature:{arguments:[{type:{name:"string"},name:"name"},{type:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},name:"error"}],return:{name:"any"}}},description:""},disabledValidation:{required:!1,tsType:{name:"boolean"},description:""},allowEmpty:{required:!1,tsType:{name:"boolean"},description:""},autoValue:{required:!1,tsType:{name:"string"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(event: TChangeEvent | ICustomChangeEvent) => void",signature:{arguments:[{type:{name:"union",raw:"TChangeEvent | ICustomChangeEvent",elements:[{name:"intersection",raw:`ChangeEvent<T> & {
10
+ | { name: string; value: any; label?: string; files?: FileList | null }`,elements:[{name:"T"},{name:"signature",type:"object",raw:"{ name: string; value: any; label?: string; files?: FileList | null }",signature:{properties:[{key:"name",value:{name:"string",required:!0}},{key:"value",value:{name:"any",required:!0}},{key:"label",value:{name:"string",required:!1}},{key:"files",value:{name:"union",raw:"FileList | null",elements:[{name:"FileList"},{name:"null"}],required:!1}}]}}],required:!0}}]}}]},{name:"ICustomChangeEvent"}]},name:"event"}],return:{name:"void"}}},description:"",defaultValue:{value:"noop",computed:!0}},onSwitchUnit:{required:!1,tsType:{name:"signature",type:"function",raw:"(unit: string) => void",signature:{arguments:[{type:{name:"string"},name:"unit"}],return:{name:"void"}}},description:"",defaultValue:{value:"noop",computed:!0}},onClick:{required:!1,tsType:{name:"MouseEventHandler",elements:[{name:"HTMLInputElement"}],raw:"MouseEventHandler<HTMLInputElement>"},description:"",defaultValue:{value:"noop",computed:!0}},onFocus:{required:!1,tsType:{name:"FocusEventHandler",elements:[{name:"HTMLInputElement"}],raw:"FocusEventHandler<HTMLInputElement>"},description:"",defaultValue:{value:"noop",computed:!0}},unitTemplate:{required:!1,tsType:{name:"Record",elements:[{name:"string"},{name:"any"}],raw:"Record<string, any>"},description:""},convertBackToStorageUnit:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}},enableCosmeticRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"true",computed:!1}},enableDisplayRounding:{required:!1,tsType:{name:"boolean"},description:"",defaultValue:{value:"false",computed:!1}}}};const{useArgs:ca}=__STORYBOOK_MODULE_PREVIEW_API__,ai={title:"Forms/UnitInput",component:c,args:{name:"example",unitkey:"length",value:"123|m"}},C=t=>{const[a,n]=ca(),s=i=>{n({value:i.target.value})};return e.jsx(c,{...t,onChange:s})},Ue=C.bind({}),Q=C.bind({});Q.args={initUnit:"ft",unitTemplate:{length:"ft"}};const X=C.bind({});X.args={value:'123|"',unitkey:'"'};const ee=C.bind({});ee.args={width:"180px"};const te=C.bind({});te.args={noConversion:!0};const ne=C.bind({});ne.args={small:!0};const H=()=>{const[t,a]=o.useState("123|m");return e.jsx(c,{name:"example",onChange:n=>a(n.target.value),placeholder:"Type a value...",value:t,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId"})};H.play=async({canvasElement:t,step:a})=>{const n=F(t),s=F(t.ownerDocument.body);await a("Shows validation error for non-numeric input",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"123x45s6"),await f(n.getByDisplayValue("123x45s6")).toBeInTheDocument(),await xe.mouseOver(i),await Ie(()=>{f(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};const L=()=>{const[t,a]=o.useState("12|m");return e.jsx(c,{name:"example-ft",onChange:n=>a(n.target.value),placeholder:"7|ft",value:t,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId-ft"})};L.play=async({canvasElement:t,step:a})=>{const n=F(t),s=F(t.ownerDocument.body);await a("Clear input and check placeholder",async()=>{const i=n.getByTestId("testId-ft");await g.clear(i),await f(i).toHaveAttribute("placeholder","2.13")}),await a("Type a correct numeric value and ensure no error",async()=>{const i=n.getByTestId("testId-ft");await g.type(i,"123"),await f(n.getByDisplayValue("123")).toBeInTheDocument(),await xe.mouseOver(i),await Ie(()=>{f(s.queryByText("Must be a numerical value")).not.toBeInTheDocument()})}),await a("Remove value, type incorrect value and check for error",async()=>{const i=n.getByTestId("testId-ft");await g.clear(i),await g.type(i,"123abc"),await f(n.getByDisplayValue("123abc")).toBeInTheDocument(),await xe.mouseOver(i),await Ie(()=>{f(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};const ae=C.bind({});ae.args={error:"Error message goes here"};const ie=C.bind({});ie.args={value:"asas123asd|%"};const G=C.bind({});G.args={disabled:!0,disabledUnit:!0};G.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 re=C.bind({});re.args={disabled:!0,disabledUnit:!0,noConversion:!0};const se=C.bind({});se.args={disabledUnit:!0,unitkey:void 0};const le=C.bind({});le.args={disabledUnit:!0,unitkey:"length"};const oe=C.bind({});oe.args={disabledUnit:!1,disabled:!0};const K=t=>{const[a,n]=o.useState("123|m"),[s,i]=o.useState("223|m"),[m,u]=o.useState("ft");return e.jsxs(e.Fragment,{children:[e.jsx(p,{label:"Change initUnit",onClick:()=>u(m==="m"?"ft":"m")}),e.jsx(b,{}),e.jsx(p,{label:"Change value",onClick:()=>n(a==="123|m"?"456|m":"123|m")}),e.jsx(b,{}),e.jsx(c,{name:"example",onChange:v=>{n(v.target.value)},unitkey:"length",value:a,initUnit:m,onSwitchUnit:u}),e.jsx(b,{}),e.jsx(c,{name:"example2",onChange:v=>{i(v.target.value)},unitkey:"length",value:s,initUnit:m,onSwitchUnit:u}),e.jsx(ta,{}),e.jsx("h4",{children:"Without initUnit property (taken from the redux store)"}),e.jsx(c,{name:"example",onChange:v=>{n(v.target.value)},unitkey:"length",value:a,onSwitchUnit:u}),e.jsx(c,{name:"example2",onChange:v=>{i(v.target.value)},unitkey:"length",value:s,onSwitchUnit:u})]})};K.parameters={docs:{description:{story:"[OW-4380](https://oliasoft.atlassian.net/browse/OW-4380?atlOrigin=eyJpIjoiMmM1N2RkNWU3Mjk5NDYxY2E0YzhkMzk5ZTVmZTJhMjciLCJwIjoiaiJ9)"}}};const ue=C.bind({});ue.args={predefinedOptions:[{label:"bottom of casing",value:"12|km"},{label:"mud weight at shoe depth",value:"8|mm"}]};const $=()=>{const t="500px",[a,n]=o.useState(void 0);return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different edge cases such as +/- infinity, undefined, NaN, null:"}),e.jsxs(wn,{children:[e.jsxs(qe,{width:"25%",children:[e.jsx(p,{label:"Change value infinity",onClick:()=>n(1/0)}),e.jsx("br",{}),e.jsx(p,{label:"Change value -infinity",onClick:()=>n(-1/0)}),e.jsx("br",{}),e.jsx(p,{label:"Change value null",onClick:()=>n(null)}),e.jsx("br",{}),e.jsx(p,{label:"Change value - undefined",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(p,{label:"Change value - NaN",onClick:()=>n(NaN)}),e.jsx("br",{}),e.jsx(p,{label:"Change value - nothing (empty)",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(p,{label:"Change value - empty string",onClick:()=>n("")})]}),e.jsxs(qe,{width:"25%",children:[e.jsx(p,{label:"Change value infinity|m",onClick:()=>n("Infinity|m")}),e.jsx("br",{}),e.jsx(p,{label:"Change value -infinity|m",onClick:()=>n("-Infinity|m")}),e.jsx("br",{}),e.jsx(p,{label:"Change value null|m",onClick:()=>n("null|m")}),e.jsx("br",{}),e.jsx(p,{label:"Change value - undefined|m",onClick:()=>n("undefined|m")}),e.jsx("br",{}),e.jsx(p,{label:"Change value - NaN|m",onClick:()=>n("NaN|m")}),e.jsx("br",{}),e.jsx(p,{label:"Change value - nothing (empty)|m",onClick:()=>n("|m")})]})]}),e.jsx("br",{}),e.jsx(I,{label:"Normal PUI",children:e.jsx(c,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit"})}),e.jsx(I,{label:"Disabled validation",children:e.jsx(c,{name:"example2",onChange:s=>n(s.target.value),value:a,unitkey:"length",disabledValidation:!0,width:t})}),e.jsx(I,{label:"Disabled validation and manual error",children:e.jsx(c,{name:"example3",onChange:s=>n(s.target.value),value:a,unitkey:"length",error:"test",disabledValidation:!0,width:t})}),e.jsx(Te,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})},de=()=>{const t="500px",[a,n]=o.useState("1|m"),[s,i]=o.useState("|m"),m="123|km";return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different cases for automatic (placeholder) values:"}),e.jsx(wn,{children:e.jsxs(qe,{width:"25%",children:[e.jsx(p,{label:"Change value to ''",onClick:()=>n("")}),e.jsx("br",{}),e.jsx(p,{label:"Change value to 1",onClick:()=>n("1")}),e.jsx("br",{}),e.jsx(p,{label:"Change value to 1|m",onClick:()=>n("1|m")}),e.jsx("br",{}),e.jsx(p,{label:"Change value to |m - empty value",onClick:()=>n("|m")})]})}),e.jsx("br",{}),e.jsx(I,{label:"Normal PUI (placeholder + auto)",children:e.jsx(c,{name:"example1",onChange:u=>n(u.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit",autoValue:m})}),e.jsx(I,{label:"Normal PUI (only auto)",children:e.jsx(c,{name:"example1",onChange:u=>n(u.target.value),value:a,unitkey:"length",width:t,autoValue:m})}),e.jsx(I,{label:"Empty PUI with autoValue",children:e.jsx(c,{name:"example1",onChange:u=>i(u.target.value),value:s,unitkey:"length",width:t,autoValue:m})}),e.jsx(I,{label:"Normal PUI (only placeholder)",children:e.jsx(c,{name:"example1",onChange:u=>n(u.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test"})}),e.jsx(I,{label:"Normal PUI (placeholder + allowEmpty)",children:e.jsx(c,{name:"example1",onChange:u=>n(u.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test",allowEmpty:!0})}),e.jsx(Te,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})};$.parameters={docs:{description:{story:"[OW-8884](https://oliasoft.atlassian.net/browse/OW-8884)"}}};const ce=()=>{const[t,a]=o.useState("123|%"),[n,s]=o.useState(null),i="This should be visible when an error appears",m=(u,v)=>(s(v),{name:u,error:v});return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"3rd party validation message when inputting invalid value:"}),e.jsx(c,{name:"example",onChange:u=>a(u.target.value),error:!n||i,validationCallback:m,value:t}),e.jsx("br",{}),e.jsx(b,{}),e.jsx("h4",{children:"Original validation message: "}),e.jsx(Te,{message:{heading:n,visible:!0}})]})},me=()=>{const[t,a]=o.useState("123|m"),[n,s]=o.useState(""),[i,m]=o.useState("km"),u=()=>{m("ft"),s("placeholder"),a("|m")};return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Empty value case:"}),e.jsx(c,{name:"example",onChange:v=>a(v.target.value),value:t,allowEmpty:!0,placeholder:n,initUnit:i,unitkey:"length"}),e.jsx("br",{}),e.jsx(b,{}),e.jsx(p,{label:"Change value |m and unit ft",onClick:()=>u()})]})},pe=()=>{const[t,a]=o.useState("123|m"),[n,s]=o.useState("m");return e.jsxs(e.Fragment,{children:[e.jsx(c,{name:"example",onChange:i=>a(i.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:s}),e.jsx(b,{}),e.jsx(c,{name:"example",onChange:i=>a(i.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:s})]})},ge=()=>{const[t,a]=o.useState(!0),n=()=>{a(!1),setTimeout(()=>a(!0),0)},[s,i]=o.useState("123|ft");return e.jsxs(Tn,{columns:"1fr 1fr",gap:!0,children:[e.jsxs(A,{heading:e.jsx(q,{children:"Storage State (Redux)"}),children:[s,e.jsx(b,{}),e.jsx(p,{label:"Change value",onClick:()=>i(l.withUnit(String(Math.floor(Math.random()*100)),"ft"))})]}),e.jsx(A,{heading:e.jsx(q,{icon:e.jsx(kn,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:n,children:"UnitInput"}),children:t&&e.jsx(c,{name:"example",onChange:m=>i(m.target.value),value:s,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"}})})]})},he=()=>e.jsxs(e.Fragment,{children:[e.jsx(we,{faint:!0,children:"Reproduce OW-10614 rounding noise bug when storing values in a different unit to the display unit"}),e.jsx(b,{}),e.jsx(c,{name:"example",onChange:()=>{},value:l.withUnit(l.convertAndGetValue("9750|psi","bar"),"bar"),initUnit:"psi",unitkey:"pressure",unitTemplate:{pressure:"psi"}}),e.jsx(b,{}),e.jsx(c,{name:"example2",onChange:()=>{},value:l.withUnit(l.convertAndGetValue("8642|lbf","tonneForce"),"tonneForce"),initUnit:"lbf",unitkey:"force",unitTemplate:{force:"tonneForce"}})]}),z=()=>e.jsxs(e.Fragment,{children:[e.jsx(c,{name:"example",unitkey:"moleWeight",initUnit:"g/mol",doNotConvertValue:!0,value:"170|g/mol",unitTemplate:{moleWeight:"g/mol"},testId:"case1"}),e.jsx(b,{}),e.jsx(c,{name:"gor",unitkey:"moleWeight",initUnit:"gor",value:"Infinity|SCF/STB",testId:"case2"})]});z.play=async({canvasElement:t,step:a})=>{const n=F(t);await a("Can enter decimal values",async()=>{await f(n.getByDisplayValue("170")).toBeInTheDocument(),await f(n.getByDisplayValue("")).toBeInTheDocument()})};const ve=()=>{const[t,a]=o.useState(!0),n=()=>{a(!1),setTimeout(()=>a(!0),0)},[s,i]=o.useState("psi"),[m,u]=o.useState(!1),[v,y]=o.useState(!0),[S,ke]=o.useState(!0),[Y,P]=o.useState("672.2388357750001|bar"),[Ve,Se]=o.useState("");return e.jsxs(Tn,{columns:"1fr 1fr",gap:!0,children:[e.jsxs(A,{heading:e.jsx(q,{children:"Settings"}),children:[e.jsx(I,{label:"Enable display rounding:",labelLeft:!0,labelWidth:200,children:e.jsx(Ae,{checked:m,onChange:U=>u(U.target.checked)})}),e.jsx(I,{label:"Enable cosmetic rounding:",labelLeft:!0,labelWidth:200,children:e.jsx(Ae,{checked:v,onChange:U=>y(U.target.checked)})}),e.jsx(I,{label:"Convert back to storage unit (onChange):",labelLeft:!0,labelWidth:200,children:e.jsx(Ae,{checked:S,onChange:U=>ke(U.target.checked)})})]}),e.jsxs(A,{heading:e.jsx(q,{icon:e.jsx(kn,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:n,children:"UnitInput"}),children:[e.jsx(we,{faint:!0,children:"Cosmetic Rounding Test Case: type 9750 then return (compare with enableCosmeticRounding on and off)"}),e.jsx(b,{}),e.jsx(we,{warning:!0,children:"Note: UnitInput uses convertSamePrecision internally (decision prior to cosmetic value implementation). This means not all rounding noise occurrences seen in NumberInput will be reproducible in UnitInput, because they get rounded off by other logic."}),e.jsx(b,{}),t&&e.jsx(c,{name:"Example",unitkey:"pressure",initUnit:s,unitTemplate:{pressure:"psi"},value:Y,onChange:U=>{const{value:j}=U.target;j&&P(j)},enableDisplayRounding:m,enableCosmeticRounding:v,error:l.convertAndGetValue(Y,"bar")>=0?"":"Value must be positive",validationCallback:(U,j)=>{Se(j??"")},convertBackToStorageUnit:S})]}),e.jsx(A,{heading:e.jsx(q,{children:"Unit Template"}),children:e.jsx(na,{options:[{label:"Bar",value:"bar"},{label:"psi",value:"psi"}],value:s,width:70,onChange:U=>i(U.target.value)})}),e.jsx(A,{heading:e.jsx(q,{children:"Test Validation Callback"}),children:Ve&&e.jsx(Te,{message:{content:Ve,icon:!0,type:"Error",visible:!0}})}),e.jsxs(A,{heading:e.jsx(q,{children:"Storage State / Redux"}),children:[Y,e.jsx(b,{}),e.jsx(p,{label:"Change value",onClick:()=>P(l.withUnit(String(Math.floor(Math.random()*100)),"bar"))})]})]})},J=()=>{const[t,a]=o.useState("123|m");return e.jsx(c,{name:"example",onChange:n=>a(n.target.value),value:t,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId"})};J.play=async({canvasElement:t,step:a})=>{const n=F(t),s=F(t.ownerDocument.body);await a("Can enter decimal values",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"123.123456789"),await f(n.getByDisplayValue("123.123456789")).toBeInTheDocument()}),await a("Can enter scientific notation",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"-1.12e3"),await f(n.getByDisplayValue("-1.12e3")).toBeInTheDocument()}),await a("Can enter comma decimals (converts to dot)",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"123,456"),await f(n.getByDisplayValue("123.456")).toBeInTheDocument()}),await a("Can enter small numbers",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"0.0000000023"),await f(n.getByDisplayValue("0.0000000023")).toBeInTheDocument()}),await a("Can enter large numbers",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"999999999999"),await f(n.getByDisplayValue("999999999999")).toBeInTheDocument()}),await a("Can convert units",async()=>{const i=n.getByTestId("testId"),m=n.getByTestId("testId-menu");await g.clear(i),await g.type(i,"456.1"),await g.click(m),await g.click(s.getByTestId("testId-unit-ft")),await f(n.getByDisplayValue("1496")).toBeInTheDocument()}),await a("Shows validation error for non-numeric input",async()=>{const i=n.getByTestId("testId");await g.clear(i),await g.type(i,"123x45s6"),await f(n.getByDisplayValue("123x45s6")).toBeInTheDocument(),await xe.mouseOver(i),await Ie(()=>{f(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};H.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"Placeholder"};L.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"PlaceholderWithUnit"};K.__docgenInfo={description:"",methods:[],displayName:"TestExternalStateChangeWithSynchronizedUnits",props:{name:{required:!0,tsType:{name:"union",raw:"string | { fieldName?: string }",elements:[{name:"string"},{name:"signature",type:"object",raw:"{ fieldName?: string }",signature:{properties:[{key:"fieldName",value:{name:"string",required:!1}}]}}]},description:""},placeholder:{required:!1,tsType:{name:"string"},description:""},disabled:{required:!1,tsType:{name:"boolean"},description:""},disabledUnit:{required:!1,tsType:{name:"boolean"},description:""},error:{required:!1,tsType:{name:"union",raw:"string | null | boolean",elements:[{name:"string"},{name:"null"},{name:"boolean"}]},description:""},left:{required:!1,tsType:{name:"boolean"},description:""},small:{required:!1,tsType:{name:"boolean"},description:""},width:{required:!1,tsType:{name:"union",raw:"string | number",elements:[{name:"string"},{name:"number"}]},description:""},value:{required:!1,tsType:{name:"string"},description:""},unitkey:{required:!1,tsType:{name:"string"},description:""},initUnit:{required:!1,tsType:{name:"string"},description:""},noConversion:{required:!1,tsType:{name:"boolean"},description:""},doNotConvertValue:{required:!1,tsType:{name:"boolean"},description:""},testId:{required:!1,tsType:{name:"string"},description:""},warning:{required:!1,tsType:{name:"union",raw:"string | boolean | null",elements:[{name:"string"},{name:"boolean"},{name:"null"}]},description:""},predefinedOptions:{required:!1,tsType:{name:"union",raw:"IPredefinedOption[] | null",elements:[{name:"Array",elements:[{name:"IPredefinedOption"}],raw:"IPredefinedOption[]"},{name:"null"}]},description:""},initialPredefinedOption:{required:!1,tsType:{name:"boolean"},description:""},shouldLinkAutomaticly:{required:!1,tsType:{name:"boolean"},description:""},selectedPredefinedOptionKey:{required:!1,tsType:{name:"string"},description:""},validationCallback:{required:!1,tsType:{name:"signature",type:"function",raw:"(name: string, error: string | null) => any",signature:{arguments:[{type:{name:"string"},name:"name"},{type:{name:"union",raw:"string | null",elements:[{name:"string"},{name:"null"}]},name:"error"}],return:{name:"any"}}},description:""},disabledValidation:{required:!1,tsType:{name:"boolean"},description:""},allowEmpty:{required:!1,tsType:{name:"boolean"},description:""},autoValue:{required:!1,tsType:{name:"string"},description:""},onChange:{required:!1,tsType:{name:"signature",type:"function",raw:"(event: TChangeEvent | ICustomChangeEvent) => void",signature:{arguments:[{type:{name:"union",raw:"TChangeEvent | ICustomChangeEvent",elements:[{name:"intersection",raw:`ChangeEvent<T> & {
11
11
  target:
12
12
  | T
13
13
  | { name: string; value: any; label?: string; files?: FileList | null };
@@ -98,7 +98,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as o}from"./index-DhsZuJv
98
98
  });
99
99
  };
100
100
  return <UnitInput {...args} onChange={handleChange} />;
101
- }`,...(St=(Vt=G.parameters)==null?void 0:Vt.docs)==null?void 0:St.source}}};var jt,Et,Nt;re.parameters={...re.parameters,docs:{...(jt=re.parameters)==null?void 0:jt.docs,source:{originalSource:`args => {
101
+ }`,...(St=(Vt=G.parameters)==null?void 0:Vt.docs)==null?void 0:St.source}}};var jt,Et,Bt;re.parameters={...re.parameters,docs:{...(jt=re.parameters)==null?void 0:jt.docs,source:{originalSource:`args => {
102
102
  const [_, updateArgs] = useArgs();
103
103
  const handleChange = (evt: any) => {
104
104
  updateArgs({
@@ -106,7 +106,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as o}from"./index-DhsZuJv
106
106
  });
107
107
  };
108
108
  return <UnitInput {...args} onChange={handleChange} />;
109
- }`,...(Nt=(Et=re.parameters)==null?void 0:Et.docs)==null?void 0:Nt.source}}};var Bt,Dt,At;se.parameters={...se.parameters,docs:{...(Bt=se.parameters)==null?void 0:Bt.docs,source:{originalSource:`args => {
109
+ }`,...(Bt=(Et=re.parameters)==null?void 0:Et.docs)==null?void 0:Bt.source}}};var Nt,Dt,At;se.parameters={...se.parameters,docs:{...(Nt=se.parameters)==null?void 0:Nt.docs,source:{originalSource:`args => {
110
110
  const [_, updateArgs] = useArgs();
111
111
  const handleChange = (evt: any) => {
112
112
  updateArgs({
@@ -509,7 +509,7 @@
509
509
  }
510
510
  </script>
511
511
 
512
- <script type="module" crossorigin src="./assets/iframe-C6gZEhn6.js"></script>
512
+ <script type="module" crossorigin src="./assets/iframe-9ccGSytp.js"></script>
513
513
  </head>
514
514
 
515
515
  <body>
@@ -1 +1 @@
1
- {"generatedAt":1724240346274,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@types/jest":"29.5.12","@vitest/coverage-c8":"0.31.4","eslint-plugin-vitest":null,"eslint-plugin-vitest-globals":"1.5.0","vitest":"1.6.0"},"packageManager":{"type":"yarn","version":"1.22.19"},"typescriptOptions":{"reactDocgen":"react-docgen"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","storybookVersion":"8.2.8","storybookVersionSpecifier":"^8.2.4","language":"typescript","storybookPackages":{"@storybook/addon-essentials":{"version":"8.2.8"},"@storybook/addon-links":{"version":"8.2.8"},"@storybook/preview-api":{"version":"8.2.8"},"@storybook/react":{"version":"8.2.8"},"@storybook/react-vite":{"version":"8.2.8"},"@storybook/test":{"version":"8.2.8"},"@storybook/test-runner":{"version":"0.19.1"},"eslint-plugin-storybook":{"version":"0.6.15"},"storybook":{"version":"8.2.8"}},"addons":{"@storybook/addon-actions":{"version":"8.2.8"},"@storybook/addon-docs":{"version":"8.2.8"},"@storybook/addon-interactions":{"version":"8.2.8"},"storybook-dark-mode":{"version":"4.0.2"}}}
1
+ {"generatedAt":1724249300369,"hasCustomBabel":false,"hasCustomWebpack":false,"hasStaticDirs":false,"hasStorybookEslint":true,"refCount":0,"testPackages":{"@types/jest":"29.5.12","@vitest/coverage-c8":"0.31.4","eslint-plugin-vitest":null,"eslint-plugin-vitest-globals":"1.5.0","vitest":"1.6.0"},"packageManager":{"type":"yarn","version":"1.22.19"},"typescriptOptions":{"reactDocgen":"react-docgen"},"preview":{"usesGlobals":false},"framework":{"name":"@storybook/react-vite","options":{}},"builder":"@storybook/builder-vite","renderer":"@storybook/react","storybookVersion":"8.2.8","storybookVersionSpecifier":"^8.2.4","language":"typescript","storybookPackages":{"@storybook/addon-essentials":{"version":"8.2.8"},"@storybook/addon-links":{"version":"8.2.8"},"@storybook/preview-api":{"version":"8.2.8"},"@storybook/react":{"version":"8.2.8"},"@storybook/react-vite":{"version":"8.2.8"},"@storybook/test":{"version":"8.2.8"},"@storybook/test-runner":{"version":"0.19.1"},"eslint-plugin-storybook":{"version":"0.6.15"},"storybook":{"version":"8.2.8"}},"addons":{"@storybook/addon-actions":{"version":"8.2.8"},"@storybook/addon-docs":{"version":"8.2.8"},"@storybook/addon-interactions":{"version":"8.2.8"},"storybook-dark-mode":{"version":"4.0.2"}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "4.10.5-beta-1",
3
+ "version": "4.10.5-beta-2",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {