@oliasoft-open-source/react-ui-library 4.10.6-beta-2 → 4.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/404.html +1 -0
- package/dist/storybook/assets/{Color-KGDBMAHA-D-NQaklH.js → Color-KGDBMAHA-DrMyC9A0.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-PKQXORMH-DxOnx1oV.js → DocsRenderer-PKQXORMH-CC68DXWF.js} +1 -1
- package/dist/storybook/assets/{buttons-and-links-CJpVkzrz.js → buttons-and-links-QeOe4vsi.js} +1 -1
- package/dist/storybook/assets/{chunk-HLWAVYOI-_rHyaL4V.js → chunk-HLWAVYOI-Cxh0E8tX.js} +1 -1
- package/dist/storybook/assets/{color-DRFp7ikN.js → color-4IjYk88L.js} +1 -1
- package/dist/storybook/assets/{iframe-C_hdCZCj.js → iframe-Cs4an5gG.js} +2 -2
- package/dist/storybook/assets/{index-DJTNHBDs.js → index-BOsX0bVI.js} +88 -88
- package/dist/storybook/assets/{index-lKvKvOdk.js → index-S8YjWNHt.js} +1 -1
- package/dist/storybook/assets/{input-validation-DxgmKoPU.js → input-validation-CsrR1bd6.js} +1 -1
- package/dist/storybook/assets/{inputs-CGEfLq-p.js → inputs-KGQtyGlg.js} +1 -1
- package/dist/storybook/assets/{layout-forms-CozlBsFf.js → layout-forms-D79Bssr0.js} +1 -1
- package/dist/storybook/assets/{layout-general-BVynyHt7.js → layout-general-CO0u964D.js} +1 -1
- package/dist/storybook/assets/{padding-and-spacing-m7vZCGZE.js → padding-and-spacing-4q9IoJDn.js} +1 -1
- package/dist/storybook/assets/{preview-B4AfZSL8.js → preview-Cph2vWSX.js} +2 -2
- package/dist/storybook/assets/{preview-9AC4uNvp.js → preview-D-mQWfBm.js} +1 -1
- package/dist/storybook/assets/{unit-input.stories-9b23SnFs.js → unit-input.stories-CkeTteis.js} +14 -14
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/project.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as n,X as T,m as l,a as c,A as H,l as L,u as B,s as b,b as S,J as u,O as C,w as h,c as d,p as g,d as y,f as F,h as I,e as k,g as x,D as A,v as P,i as R,B as W,j as f,q as D,k as E,y as N,n as q,z as v,r as w,C as O,x as U,_ as j,E as z,t as G,F as J,G as K,H as M,I as Q,K as V,L as X,S as Y,M as Z,N as _,P as $,Q as aa,R as sa,T as oa,U as ta,W as ra,V as ea,Y as ia}from"./index-
|
|
1
|
+
import{o as n,X as T,m as l,a as c,A as H,l as L,u as B,s as b,b as S,J as u,O as C,w as h,c as d,p as g,d as y,f as F,h as I,e as k,g as x,D as A,v as P,i as R,B as W,j as f,q as D,k as E,y as N,n as q,z as v,r as w,C as O,x as U,_ as j,E as z,t as G,F as J,G as K,H as M,I as Q,K as V,L as X,S as Y,M as Z,N as _,P as $,Q as aa,R as sa,T as oa,U as ta,W as ra,V as ea,Y as ia}from"./index-BOsX0bVI.js";import"./iframe-Cs4an5gG.js";import"../sb-preview/runtime.js";import"./index-DhsZuJvc.js";import"./index-CUZDtIZe.js";import"./inheritsLoose-DP0QEDDI.js";import"./assertThisInitialized-B9jnkVVz.js";import"./index-D6rZ4wEC.js";export{n as A,T as ActionBar,l as Bar,c as Blockquote,H as Button,L as Code,B as DL,b as Div,S as EmptyTabContent,u as ErrorFormatter,C as FlexBar,h as Form,d as H1,g as H2,y as H3,F as H4,I as H5,k as H6,x as HR,A as IconButton,P as Img,R as LI,W as Link,f as ListItem,D as Loader,E as OL,N as P,q as Pre,v as ResetWrapper,w as ScrollArea,O as Separator,U as Span,j as SyntaxHighlighter,z as TT,G as TabBar,J as TabButton,K as Table,M as Tabs,Q as TabsState,V as TooltipLinkList,X as TooltipNote,Y as UL,Z as WithTooltip,_ as WithTooltipPure,$ as Zoom,aa as codeCommon,sa as components,oa as createCopyToClipboardFunction,ta as getStoryHref,ra as icons,ea as nameSpaceClassNames,ia as withReset};
|
|
@@ -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-
|
|
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-BOsX0bVI.js";import{NonExistentValue as a,Error as l}from"./select.stories-B9w9ONzj.js";import"./index-DhsZuJvc.js";import"./iframe-Cs4an5gG.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-
|
|
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-BOsX0bVI.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-Cpd1NHbq.js";import{Default as d,Date as p}from"./input.stories-FKl0qVhm.js";import{Default as h}from"./number-input.stories-DMAU21wG.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-Cs4an5gG.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-B0-ERX66.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-B5ReSBSL.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-
|
|
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-BOsX0bVI.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-Cs4an5gG.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-
|
|
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-BOsX0bVI.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-Cs4an5gG.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."]}),`
|
package/dist/storybook/assets/{padding-and-spacing-m7vZCGZE.js → padding-and-spacing-4q9IoJDn.js}
RENAMED
|
@@ -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-
|
|
1
|
+
import{j as e}from"./jsx-runtime-eps93zm2.js";import{useMDXComponents as r}from"./index-BcNHZKhG.js";import{Z as t}from"./index-BOsX0bVI.js";import"./index-DhsZuJvc.js";import"./iframe-Cs4an5gG.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,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DocsRenderer-PKQXORMH-
|
|
2
|
-
import{_ as a}from"./iframe-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DocsRenderer-PKQXORMH-CC68DXWF.js","./chunk-HLWAVYOI-Cxh0E8tX.js","./iframe-Cs4an5gG.js","./index-DhsZuJvc.js","./react-16-DXAfArL2.js","./index-CUZDtIZe.js","./index-BOsX0bVI.js","./inheritsLoose-DP0QEDDI.js","./assertThisInitialized-B9jnkVVz.js","./index-D6rZ4wEC.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as a}from"./iframe-Cs4an5gG.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-CC68DXWF.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,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-
|
|
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-BOsX0bVI.js";import{e as _}from"./index-DRSy5Ssd.js";import"./chunk-HLWAVYOI-Cxh0E8tX.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-Cs4an5gG.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};
|
package/dist/storybook/assets/{unit-input.stories-9b23SnFs.js → unit-input.stories-CkeTteis.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJvc.js";import{d as r}from"./index-C0x1JmaP.js";import{w as he,u as f,e as w,f as yn,a as bn}from"./index-DMAnyMX5.js";import{c as Ln}from"./index-Bk2sglWO.js";import{u as Gn}from"./use-previous-D775JrO6.js";import{M as Oe}from"./actions-D-uVCDzk.js";import{I as Kn}from"./input-group-addon-D68iUKV2.js";import{B as p}from"./button-DHevvVBE.js";import{T as $n}from"./tooltip-1V7clEnw.js";import{I as zn}from"./input-group-BaRSJAEN.js";import{S as C}from"./spacer-BWoNR27H.js";import{T as Ue}from"./text-B3-TSWok.js";import{M as He}from"./types-BmbYqTX_.js";import{l as E}from"./lodash-c4VUpsOs.js";import{N as Jn,r as Yn}from"./number-input-B5ReSBSL.js";import{i as Qn}from"./select.input-D0UkAPd9.js";import{D as Zn}from"./divider-DY9nJ_7N.js";import{R as Cn,C as Be}from"./row-Bmiy2Lh0.js";import{F as V}from"./field-HrLaMLbx.js";import{M as xe}from"./message-Y48EomV-.js";import{G as Un}from"./grid-DRkC-bt8.js";import{C as F}from"./card-EcjmryU9.js";import{H as q}from"./heading-CRNoBc7q.js";import{T as Ne}from"./toggle-BbFVf61v.js";import{S as Xn}from"./select-DnRuRG_N.js";import{I as xn}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"./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 ea=()=>{const t=u.useRef(null);return u.useLayoutEffect(()=>{t.current&&(t.current(),t.current=null)}),n=>{t.current=n}},ta=(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.`),r.unitFromQuantity(t)??"")};var I=(t=>(t.CUSTOM="custom",t.PREDEFINED="predefined",t))(I||{});const In=t=>t==="undefined"||t===void 0||t===""||t==="null"||t===null||t==="NaN"||isNaN(t),Tn=({value:t,unitkey:a,toUnit:n})=>{var i;const s=r.ALT_UNITS[a];return!(!s||s.length===0||!((i=r.validateNumber(t))!=null&&i.valid)||!s.includes(n))},wn=(t="",a,n,s="",i=!1)=>{var m;if(i)return t;if((m=r.validateNumber(t))!=null&&m.valid&&a&&!In(t))try{const l=r.isValueWithUnit(t)?t:r.withUnit(t,s);if(Tn({value:l,toUnit:a,unitkey:n})){const h=r.convertSamePrecision(l,a);return r.getValue(h)}return r.getValue(l)}catch{}},na=t=>t?!!r.getUnit(t):!1,J=({value:t="",toUnit:a,unitkey:n,defaultFromUnit:s,doNotConvertValue:i})=>{const m=na(t)||r.isValueWithUnit(t),l=r.getValue(t);return In(l)?l:m?wn(l,a,n,s,i):t},Le=t=>E.isObject(t)&&!E.isArray(t)&&!E.isFunction(t)?E.get(t,"fieldName",""):typeof t=="string"?t:"",Ge=(t="")=>{var a;return(a=r.KNOWN_UNITS)==null?void 0:a.includes(t)},aa=(t,a)=>{const n=r.getUnit(t||"");return Ge(a)&&Ge(n)};let ia=u.createContext(null);const ra=()=>u.useContext(ia),sa="_predefinedMenuActive_ye9w9_1",la="_inputWrapper_ye9w9_4",Ke={predefinedMenuActive:sa,inputWrapper:la},d=({name:t,placeholder:a="",disabled:n=!1,disabledUnit:s=!1,error:i=null,left:m=!1,small:l=!1,width:g="100%",value:h,unitkey:y="",initUnit:Ie,noConversion:K=!1,onChange:P=E.noop,onClick:Te=E.noop,onFocus:we=E.noop,onSwitchUnit:x=E.noop,unitTemplate:N,doNotConvertValue:$=!1,testId:_,warning:De=null,predefinedOptions:S,initialPredefinedOption:Vn=!1,shouldLinkAutomaticly:Ae=!0,selectedPredefinedOptionKey:Fe,validationCallback:kn=()=>({name:"",error:null}),disabledValidation:Sn=!1,allowEmpty:ua=!1,autoValue:B,convertBackToStorageUnit:jn=!1,enableCosmeticRounding:qe=!0,enableDisplayRounding:En=!1})=>{const R=ra(),Nn=ea();typeof h=="number"&&(h=`${h}`);const[Pe="",D=""]=h!==void 0?r.split(h):[],_e=B?r.getUnit(B):"",Re=u.useMemo(()=>ta(y,N||(R==null?void 0:R.unitTemplate)),[y,N,R==null?void 0:R.unitTemplate]),Bn=aa(h,Re),k=Ie||Re||D,Dn=Gn(k),Me=J({value:h,toUnit:k,unitkey:y,defaultFromUnit:D,doNotConvertValue:$}),We=J({value:B,toUnit:k,unitkey:y,defaultFromUnit:_e,doNotConvertValue:$}),An=Me!==""?{value:Me,unit:k}:We!==""?{value:We,unit:k}:{value:Pe,unit:D},[v,Ve]=u.useState(An),Fn=(v==null?void 0:v.value)===void 0,[A,ke]=u.useState(Vn?I.PREDEFINED:I.CUSTOM),Se=Pe===""&&B,qn=!!(Sn||B||a&&Qn(h)),z=S&&S.find(o=>{if(!(o!=null&&o.value))return;if(Fe)return Fe===o.valueKey;const c=r.isValueWithUnit(o.value)?r.getUnit(o.value):"";return r.withUnit(wn(h,c,y),c)===o.value}),Pn=()=>{const o=Se?B:h??"",c=v.unit;if(Tn({value:o,unitkey:y,toUnit:c})){if(y)try{let b=r.altUnitsList(o,y);return r.getValue(o)===""?b.map(T=>["",T[1]]):b}catch{return null}}else{let b=r.getAltUnitsListByQuantity(y);return b==null?void 0:b.map(T=>["",T==null?void 0:T.unit])}},_n=o=>{const c=Le(t),j=o.target,{value:b,selectionStart:T}=j,be=r.withUnit(b,(v==null?void 0:v.unit)||""),Ee=jn?r.withUnit(r.convertAndGetValue(be,D),D):be;P({target:{value:Ee,name:c}});const[On,Hn]=r.split(be);Ve({value:On,unit:Hn}),Nn(()=>{j.selectionStart=T,j.selectionEnd=T})},Rn=(o,c)=>{c===v.unit||isNaN(Number(o))||(Ve({value:o,unit:c}),x&&x(c))};u.useEffect(()=>{if(k){let o,c="";Dn!==k?(o=J({value:h,toUnit:k,unitkey:y,defaultFromUnit:D,doNotConvertValue:$}),c=k):r.withUnit(v.value,v.unit)!==h&&(o=J({value:h,toUnit:v.unit,unitkey:y,defaultFromUnit:D,doNotConvertValue:$}),c=v.unit),o!==void 0&&Ve({value:o,unit:c}),S&&ke(z&&Ae?I.PREDEFINED:I.CUSTOM)}},[k,h,i,Ae]);const ve=Pn(),fe=r.label(v.unit)||v.unit||"",Mn=K||!ve||ve&&ve.length===1,je=Le(t);let ye;const Wn=o=>{const c=o!=null&&o.value?o.value:"",[j="",b=""]=r.isValueWithUnit(c)?r.split(c):[c];return{type:He.OPTION,inline:!0,onClick:()=>{r.validateNumber(j).valid&&!n&&(ke(I.PREDEFINED),P({target:{value:c,name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||"",predefinedSelected:!0,predefinedOption:o}}))},label:e.jsxs(e.Fragment,{children:[e.jsx(Ue,{children:o.label}),e.jsx(C,{width:"20px",height:"0"})]}),description:r.isValueWithUnit(c)?`${j} ${b}`:c,selected:z===o&&A===I.PREDEFINED}};if(ye=[{type:He.OPTION,inline:!0,onClick:()=>{A!==I.CUSTOM&&!n&&P({target:{value:r.withUnit(v.value,v.unit),name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||""}})},label:"Custom",selected:A===I.CUSTOM}],S!=null&&S.length){const o=S.map(Wn);ye=[...ye,...o]}return e.jsx("div",{className:A===I.PREDEFINED?Ln(Ke.predefinedMenuActive):"",children:e.jsxs(zn,{small:l,width:g,children:[S&&e.jsx($n,{text:A===I.PREDEFINED?z==null?void 0:z.label:"",children:e.jsx(Oe,{maxHeight:380,groupOrder:"first",testId:_&&`${_}-predefined-menu`,disabled:n,menu:{colored:!0,trigger:"Component",component:e.jsx(p,{groupOrder:"first",active:A===I.PREDEFINED,icon:A===I.PREDEFINED?"link":"unlink"}),small:l,sections:ye}})}),e.jsx("div",{className:Ke.inputWrapper,children:e.jsx(Jn,{name:je,testId:_,disabled:n,placeholder:Se?J({value:B,toUnit:v.unit,unitkey:y,defaultFromUnit:_e,doNotConvertValue:$}):a,value:v.value,onChange:_n,onFocus:we,error:i===null?void 0:i,warning:De===null?void 0:De,left:m,allowEmpty:Fn,validationCallback:(o,c)=>kn(je,c),enableCosmeticRounding:qe,enableDisplayRounding:En,groupOrder:S?"middle":"first",disableInternalErrorValidationMessages:qn,small:l},je)}),fe&&(Mn||!Bn?e.jsx(Kn,{groupOrder:"last",children:fe}):e.jsx(Oe,{maxHeight:380,groupOrder:"last",disabled:s,testId:_&&`${_}-menu`,menu:{label:fe,trigger:"DropDownButton",small:l,sections:ve.map(([o,c,j])=>{const b=j||c||"",T=r.isValidNum(o)?o:"";return{type:"Option",label:qe?Yn(T):T,inline:!0,onClick:Ee=>{Ee.stopPropagation(),Rn(Se?"":o,c)},description:b,selected:b===fe,testId:`${_}-unit-${b}`}})}}))]})})};d.__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 he,u as g,e as x,f as yn,a as bn}from"./index-DMAnyMX5.js";import{c as Hn}from"./index-Bk2sglWO.js";import{u as Ln}from"./use-previous-D775JrO6.js";import{M as Oe}from"./actions-D-uVCDzk.js";import{I as Gn}from"./input-group-addon-D68iUKV2.js";import{B as p}from"./button-DHevvVBE.js";import{T as Kn}from"./tooltip-1V7clEnw.js";import{I as $n}from"./input-group-BaRSJAEN.js";import{S as y}from"./spacer-BWoNR27H.js";import{T as Ue}from"./text-B3-TSWok.js";import{M as He}from"./types-BmbYqTX_.js";import{l as V}from"./lodash-c4VUpsOs.js";import{N as zn,r as Jn}from"./number-input-B5ReSBSL.js";import{i as Yn}from"./select.input-D0UkAPd9.js";import{D as Zn}from"./divider-DY9nJ_7N.js";import{R as Cn,C as Be}from"./row-Bmiy2Lh0.js";import{F as I}from"./field-HrLaMLbx.js";import{M as xe}from"./message-Y48EomV-.js";import{G as Un}from"./grid-DRkC-bt8.js";import{C as A}from"./card-EcjmryU9.js";import{H as q}from"./heading-CRNoBc7q.js";import{T as Ne}from"./toggle-BbFVf61v.js";import{S as Qn}from"./select-DnRuRG_N.js";import{I as xn}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"./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 Xn=()=>{const t=o.useRef(null);return o.useLayoutEffect(()=>{t.current&&(t.current(),t.current=null)}),n=>{t.current=n}},ea=(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 U=(t=>(t.CUSTOM="custom",t.PREDEFINED="predefined",t))(U||{});const In=t=>t==="undefined"||t===void 0||t===""||t==="null"||t===null||t==="NaN"||isNaN(t),Tn=(t="",a,n="",r=!1)=>{if(r)return t;if(a&&!In(t))try{const i=l.isValueWithUnit(t)?t:l.withUnit(t,n),m=l.convertSamePrecision(i,a);return l.getValue(m)}catch{}},ta=t=>t?!!l.getUnit(t):!1,J=(t="",a,n,r)=>{const i=ta(t)||l.isValueWithUnit(t),m=l.getValue(t);return In(m)?m:i?Tn(m,a,n,r):t},Le=t=>V.isObject(t)&&!V.isArray(t)&&!V.isFunction(t)?V.get(t,"fieldName",""):typeof t=="string"?t:"",Ge=(t="")=>{var a;return(a=l.KNOWN_UNITS)==null?void 0:a.includes(t)},na=(t,a)=>{const n=l.getUnit(t||"");return Ge(a)&&Ge(n)};let aa=o.createContext(null);const ia=()=>o.useContext(aa),ra="_predefinedMenuActive_ye9w9_1",sa="_inputWrapper_ye9w9_4",Ke={predefinedMenuActive:ra,inputWrapper:sa},c=({name:t,placeholder:a="",disabled:n=!1,disabledUnit:r=!1,error:i=null,left:m=!1,small:u=!1,width:h="100%",value:f,unitkey:S="",initUnit:Ie,noConversion:K=!1,onChange:F=V.noop,onClick:Te=V.noop,onFocus:we=V.noop,onSwitchUnit:C=V.noop,unitTemplate:j,doNotConvertValue:$=!1,testId:P,warning:De=null,predefinedOptions:k,initialPredefinedOption:wn=!1,shouldLinkAutomaticly:Ae=!0,selectedPredefinedOptionKey:qe,validationCallback:kn=()=>({name:"",error:null}),disabledValidation:Vn=!1,allowEmpty:oa=!1,autoValue:E,convertBackToStorageUnit:Sn=!1,enableCosmeticRounding:Fe=!0,enableDisplayRounding:jn=!1})=>{const R=ia(),En=Xn();typeof f=="number"&&(f=`${f}`);const[Pe="",N=""]=f!==void 0?l.split(f):[],Re=E?l.getUnit(E):"",_e=o.useMemo(()=>ea(S,j||(R==null?void 0:R.unitTemplate)),[S,j,R==null?void 0:R.unitTemplate]),Nn=na(f,_e),T=Ie||_e||N,Bn=Ln(T),Me=J(f,T,N,$),We=J(E,T,Re,$),Dn=Me!==""?{value:Me,unit:T}:We!==""?{value:We,unit:T}:{value:Pe,unit:N},[v,ke]=o.useState(Dn),An=(v==null?void 0:v.value)===void 0,[B,Ve]=o.useState(wn?U.PREDEFINED:U.CUSTOM),Se=Pe===""&&E,qn=!!(Vn||E||a&&Yn(f)),z=k&&k.find(s=>{if(!(s!=null&&s.value))return;if(qe)return qe===s.valueKey;const d=l.isValueWithUnit(s.value)?l.getUnit(s.value):"";return l.withUnit(Tn(f,d),d)===s.value}),Fn=()=>{if(S)try{const s=Se?E:f??"";let d=l.altUnitsList(s,S);return l.getValue(s)===""?d.map(w=>["",w[1]]):d}catch{return null}},Pn=s=>{const d=Le(t),w=s.target,{value:D,selectionStart:_}=w,be=l.withUnit(D,(v==null?void 0:v.unit)||""),Ee=Sn?l.withUnit(l.convertAndGetValue(be,N),N):be;F({target:{value:Ee,name:d}});const[Wn,On]=l.split(be);ke({value:Wn,unit:On}),En(()=>{w.selectionStart=_,w.selectionEnd=_})},Rn=(s,d)=>{d===v.unit||isNaN(Number(s))||(ke({value:s,unit:d}),C&&C(d))};o.useEffect(()=>{if(T){let s,d="";Bn!==T?(s=J(f,T,N,$),d=T):l.withUnit(v.value,v.unit)!==f&&(s=J(f,v.unit,N,$),d=v.unit),s!==void 0&&ke({value:s,unit:d}),k&&Ve(z&&Ae?U.PREDEFINED:U.CUSTOM)}},[T,f,i,Ae]);const ve=Fn(),fe=l.label(v.unit)||v.unit||"",_n=K||!ve||ve&&ve.length===1,je=Le(t);let ye;const Mn=s=>{const d=s!=null&&s.value?s.value:"",[w="",D=""]=l.isValueWithUnit(d)?l.split(d):[d];return{type:He.OPTION,inline:!0,onClick:()=>{l.validateNumber(w).valid&&!n&&(Ve(U.PREDEFINED),F({target:{value:d,name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||"",predefinedSelected:!0,predefinedOption:s}}))},label:e.jsxs(e.Fragment,{children:[e.jsx(Ue,{children:s.label}),e.jsx(y,{width:"20px",height:"0"})]}),description:l.isValueWithUnit(d)?`${w} ${D}`:d,selected:z===s&&B===U.PREDEFINED}};if(ye=[{type:He.OPTION,inline:!0,onClick:()=>{B!==U.CUSTOM&&!n&&F({target:{value:l.withUnit(v.value,v.unit),name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||""}})},label:"Custom",selected:B===U.CUSTOM}],k!=null&&k.length){const s=k.map(Mn);ye=[...ye,...s]}return e.jsx("div",{className:B===U.PREDEFINED?Hn(Ke.predefinedMenuActive):"",children:e.jsxs($n,{small:u,width:h,children:[k&&e.jsx(Kn,{text:B===U.PREDEFINED?z==null?void 0:z.label:"",children:e.jsx(Oe,{maxHeight:380,groupOrder:"first",testId:P&&`${P}-predefined-menu`,disabled:n,menu:{colored:!0,trigger:"Component",component:e.jsx(p,{groupOrder:"first",active:B===U.PREDEFINED,icon:B===U.PREDEFINED?"link":"unlink"}),small:u,sections:ye}})}),e.jsx("div",{className:Ke.inputWrapper,children:e.jsx(zn,{name:je,testId:P,disabled:n,placeholder:Se?J(E,v.unit,Re,$):a,value:v.value,onChange:Pn,onFocus:we,error:i===null?void 0:i,warning:De===null?void 0:De,left:m,allowEmpty:An,validationCallback:(s,d)=>kn(je,d),enableCosmeticRounding:Fe,enableDisplayRounding:jn,groupOrder:k?"middle":"first",disableInternalErrorValidationMessages:qn,small:u},je)}),fe&&(_n||!Nn?e.jsx(Gn,{groupOrder:"last",children:fe}):e.jsx(Oe,{maxHeight:380,groupOrder:"last",disabled:r,testId:P&&`${P}-menu`,menu:{label:fe,trigger:"DropDownButton",small:u,sections:ve.map(([s,d,w])=>{const D=w||d||"",_=l.isValidNum(s)?s:"";return{type:"Option",label:Fe?Jn(_):_,inline:!0,onClick:Ee=>{Ee.stopPropagation(),Rn(Se?"":s,d)},description:D,selected:D===fe,testId:`${P}-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 u}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:oa}=__STORYBOOK_MODULE_PREVIEW_API__,ei={title:"Forms/UnitInput",component:d,args:{name:"example",unitkey:"length",value:"123|m"}},U=t=>{const[a,n]=oa(),s=i=>{n({value:i.target.value})};return e.jsx(d,{...t,onChange:s})},Ce=U.bind({}),Y=U.bind({});Y.args={initUnit:"ft",unitTemplate:{length:"ft"}};const Q=U.bind({});Q.args={value:'123|"',unitkey:'"'};const Z=U.bind({});Z.args={width:"180px"};const X=U.bind({});X.args={noConversion:!0};const ee=U.bind({});ee.args={small:!0};const M=()=>{const[t,a]=u.useState("123|m");return e.jsx(d,{name:"example",onChange:n=>a(n.target.value),placeholder:"Type a value...",value:t,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId"})};M.play=async({canvasElement:t,step:a})=>{const n=he(t),s=he(t.ownerDocument.body);await a("Shows validation error for non-numeric input",async()=>{const i=n.getByTestId("testId");await f.clear(i),await f.type(i,"123x45s6"),await w(n.getByDisplayValue("123x45s6")).toBeInTheDocument(),await yn.mouseOver(i),await bn(()=>{w(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};const te=U.bind({});te.args={error:"Error message goes here"};const ne=U.bind({});ne.args={value:"asas123asd|%"};const W=U.bind({});W.args={disabled:!0,disabledUnit:!0};W.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 ae=U.bind({});ae.args={disabled:!0,disabledUnit:!0,noConversion:!0};const ie=U.bind({});ie.args={disabledUnit:!0,unitkey:void 0};const re=U.bind({});re.args={disabledUnit:!0,unitkey:"length"};const se=U.bind({});se.args={disabledUnit:!1,disabled:!0};const O=t=>{const[a,n]=u.useState("123|m"),[s,i]=u.useState("223|m"),[m,l]=u.useState("ft");return e.jsxs(e.Fragment,{children:[e.jsx(p,{label:"Change initUnit",onClick:()=>l(m==="m"?"ft":"m")}),e.jsx(C,{}),e.jsx(p,{label:"Change value",onClick:()=>n(a==="123|m"?"456|m":"123|m")}),e.jsx(C,{}),e.jsx(d,{name:"example",onChange:g=>{n(g.target.value)},unitkey:"length",value:a,initUnit:m,onSwitchUnit:l}),e.jsx(C,{}),e.jsx(d,{name:"example2",onChange:g=>{i(g.target.value)},unitkey:"length",value:s,initUnit:m,onSwitchUnit:l}),e.jsx(Zn,{}),e.jsx("h4",{children:"Without initUnit property (taken from the redux store)"}),e.jsx(d,{name:"example",onChange:g=>{n(g.target.value)},unitkey:"length",value:a,onSwitchUnit:l}),e.jsx(d,{name:"example2",onChange:g=>{i(g.target.value)},unitkey:"length",value:s,onSwitchUnit:l})]})};O.parameters={docs:{description:{story:"[OW-4380](https://oliasoft.atlassian.net/browse/OW-4380?atlOrigin=eyJpIjoiMmM1N2RkNWU3Mjk5NDYxY2E0YzhkMzk5ZTVmZTJhMjciLCJwIjoiaiJ9)"}}};const le=U.bind({});le.args={predefinedOptions:[{label:"bottom of casing",value:"12|km"},{label:"mud weight at shoe depth",value:"8|mm"}]};const H=()=>{const t="500px",[a,n]=u.useState(void 0);return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different edge cases such as +/- infinity, undefined, NaN, null:"}),e.jsxs(Cn,{children:[e.jsxs(Be,{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(Be,{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(V,{label:"Normal PUI",children:e.jsx(d,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit"})}),e.jsx(V,{label:"Disabled validation",children:e.jsx(d,{name:"example2",onChange:s=>n(s.target.value),value:a,unitkey:"length",disabledValidation:!0,width:t})}),e.jsx(V,{label:"Disabled validation and manual error",children:e.jsx(d,{name:"example3",onChange:s=>n(s.target.value),value:a,unitkey:"length",error:"test",disabledValidation:!0,width:t})}),e.jsx(xe,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})},oe=()=>{const t="500px",[a,n]=u.useState("1|m"),[s,i]=u.useState("|m"),m="123|km";return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different cases for automatic (placeholder) values:"}),e.jsx(Cn,{children:e.jsxs(Be,{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(V,{label:"Normal PUI (placeholder + auto)",children:e.jsx(d,{name:"example1",onChange:l=>n(l.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit",autoValue:m})}),e.jsx(V,{label:"Normal PUI (only auto)",children:e.jsx(d,{name:"example1",onChange:l=>n(l.target.value),value:a,unitkey:"length",width:t,autoValue:m})}),e.jsx(V,{label:"Empty PUI with autoValue",children:e.jsx(d,{name:"example1",onChange:l=>i(l.target.value),value:s,unitkey:"length",width:t,autoValue:m})}),e.jsx(V,{label:"Normal PUI (only placeholder)",children:e.jsx(d,{name:"example1",onChange:l=>n(l.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test"})}),e.jsx(V,{label:"Normal PUI (placeholder + allowEmpty)",children:e.jsx(d,{name:"example1",onChange:l=>n(l.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test",allowEmpty:!0})}),e.jsx(xe,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})};H.parameters={docs:{description:{story:"[OW-8884](https://oliasoft.atlassian.net/browse/OW-8884)"}}};const ue=()=>{const[t,a]=u.useState("123|%"),[n,s]=u.useState(null),i="This should be visible when an error appears",m=(l,g)=>(s(g),{name:l,error:g});return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"3rd party validation message when inputting invalid value:"}),e.jsx(d,{name:"example",onChange:l=>a(l.target.value),error:!n||i,validationCallback:m,value:t}),e.jsx("br",{}),e.jsx(C,{}),e.jsx("h4",{children:"Original validation message: "}),e.jsx(xe,{message:{heading:n,visible:!0}})]})},de=()=>{const[t,a]=u.useState("123|m"),[n,s]=u.useState(""),[i,m]=u.useState("km"),l=()=>{m("ft"),s("placeholder"),a("|m")};return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Empty value case:"}),e.jsx(d,{name:"example",onChange:g=>a(g.target.value),value:t,allowEmpty:!0,placeholder:n,initUnit:i,unitkey:"length"}),e.jsx("br",{}),e.jsx(C,{}),e.jsx(p,{label:"Change value |m and unit ft",onClick:()=>l()})]})},ce=()=>{const[t,a]=u.useState("123|m"),[n,s]=u.useState("m");return e.jsxs(e.Fragment,{children:[e.jsx(d,{name:"example",onChange:i=>a(i.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:s}),e.jsx(C,{}),e.jsx(d,{name:"example",onChange:i=>a(i.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:s})]})},me=()=>{const[t,a]=u.useState(!0),n=()=>{a(!1),setTimeout(()=>a(!0),0)},[s,i]=u.useState("123|ft");return e.jsxs(Un,{columns:"1fr 1fr",gap:!0,children:[e.jsxs(F,{heading:e.jsx(q,{children:"Storage State (Redux)"}),children:[s,e.jsx(C,{}),e.jsx(p,{label:"Change value",onClick:()=>i(r.withUnit(String(Math.floor(Math.random()*100)),"ft"))})]}),e.jsx(F,{heading:e.jsx(q,{icon:e.jsx(xn,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:n,children:"UnitInput"}),children:t&&e.jsx(d,{name:"example",onChange:m=>i(m.target.value),value:s,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"}})})]})},pe=()=>e.jsxs(e.Fragment,{children:[e.jsx(Ue,{faint:!0,children:"Reproduce OW-10614 rounding noise bug when storing values in a different unit to the display unit"}),e.jsx(C,{}),e.jsx(d,{name:"example",onChange:()=>{},value:r.withUnit(r.convertAndGetValue("9750|psi","bar"),"bar"),initUnit:"psi",unitkey:"pressure",unitTemplate:{pressure:"psi"}}),e.jsx(C,{}),e.jsx(d,{name:"example2",onChange:()=>{},value:r.withUnit(r.convertAndGetValue("8642|lbf","tonneForce"),"tonneForce"),initUnit:"lbf",unitkey:"force",unitTemplate:{force:"tonneForce"}})]}),L=()=>e.jsxs(e.Fragment,{children:[e.jsx(d,{name:"example",unitkey:"moleWeight",initUnit:"g/mol",doNotConvertValue:!0,value:"170|g/mol",unitTemplate:{moleWeight:"g/mol"},testId:"case1"}),e.jsx(C,{}),e.jsx(d,{name:"gor",unitkey:"moleWeight",initUnit:"gor",value:"Infinity|SCF/STB",testId:"case2"})]});L.play=async({canvasElement:t,step:a})=>{const n=he(t);await a("Can enter decimal values",async()=>{await w(n.getByDisplayValue("170")).toBeInTheDocument(),await w(n.getByDisplayValue("")).toBeInTheDocument()})};const ge=()=>{const[t,a]=u.useState(!0),n=()=>{a(!1),setTimeout(()=>a(!0),0)},[s,i]=u.useState("psi"),[m,l]=u.useState(!1),[g,h]=u.useState(!0),[y,Ie]=u.useState(!0),[K,P]=u.useState("672.2388357750001|bar"),[Te,we]=u.useState("");return e.jsxs(Un,{columns:"1fr 1fr",gap:!0,children:[e.jsxs(F,{heading:e.jsx(q,{children:"Settings"}),children:[e.jsx(V,{label:"Enable display rounding:",labelLeft:!0,labelWidth:200,children:e.jsx(Ne,{checked:m,onChange:x=>l(x.target.checked)})}),e.jsx(V,{label:"Enable cosmetic rounding:",labelLeft:!0,labelWidth:200,children:e.jsx(Ne,{checked:g,onChange:x=>h(x.target.checked)})}),e.jsx(V,{label:"Convert back to storage unit (onChange):",labelLeft:!0,labelWidth:200,children:e.jsx(Ne,{checked:y,onChange:x=>Ie(x.target.checked)})})]}),e.jsxs(F,{heading:e.jsx(q,{icon:e.jsx(xn,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:n,children:"UnitInput"}),children:[e.jsx(Ue,{faint:!0,children:"Cosmetic Rounding Test Case: type 9750 then return (compare with enableCosmeticRounding on and off)"}),e.jsx(C,{}),e.jsx(Ue,{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(C,{}),t&&e.jsx(d,{name:"Example",unitkey:"pressure",initUnit:s,unitTemplate:{pressure:"psi"},value:K,onChange:x=>{const{value:N}=x.target;N&&P(N)},enableDisplayRounding:m,enableCosmeticRounding:g,error:r.convertAndGetValue(K,"bar")>=0?"":"Value must be positive",validationCallback:(x,N)=>{we(N??"")},convertBackToStorageUnit:y})]}),e.jsx(F,{heading:e.jsx(q,{children:"Unit Template"}),children:e.jsx(Xn,{options:[{label:"Bar",value:"bar"},{label:"psi",value:"psi"}],value:s,width:70,onChange:x=>i(x.target.value)})}),e.jsx(F,{heading:e.jsx(q,{children:"Test Validation Callback"}),children:Te&&e.jsx(xe,{message:{content:Te,icon:!0,type:"Error",visible:!0}})}),e.jsxs(F,{heading:e.jsx(q,{children:"Storage State / Redux"}),children:[K,e.jsx(C,{}),e.jsx(p,{label:"Change value",onClick:()=>P(r.withUnit(String(Math.floor(Math.random()*100)),"bar"))})]})]})},G=()=>{const[t,a]=u.useState("123|m");return e.jsx(d,{name:"example",onChange:n=>a(n.target.value),value:t,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"},testId:"testId"})};G.play=async({canvasElement:t,step:a})=>{const n=he(t),s=he(t.ownerDocument.body);await a("Can enter decimal values",async()=>{const i=n.getByTestId("testId");await f.clear(i),await f.type(i,"123.123456789"),await w(n.getByDisplayValue("123.123456789")).toBeInTheDocument()}),await a("Can enter scientific notation",async()=>{const i=n.getByTestId("testId");await f.clear(i),await f.type(i,"-1.12e3"),await w(n.getByDisplayValue("-1.12e3")).toBeInTheDocument()}),await a("Can enter comma decimals (converts to dot)",async()=>{const i=n.getByTestId("testId");await f.clear(i),await f.type(i,"123,456"),await w(n.getByDisplayValue("123.456")).toBeInTheDocument()}),await a("Can enter small numbers",async()=>{const i=n.getByTestId("testId");await f.clear(i),await f.type(i,"0.0000000023"),await w(n.getByDisplayValue("0.0000000023")).toBeInTheDocument()}),await a("Can enter large numbers",async()=>{const i=n.getByTestId("testId");await f.clear(i),await f.type(i,"999999999999"),await w(n.getByDisplayValue("999999999999")).toBeInTheDocument()}),await a("Can convert units",async()=>{const i=n.getByTestId("testId"),m=n.getByTestId("testId-menu");await f.clear(i),await f.type(i,"456.1"),await f.click(m),await f.click(s.getByTestId("testId-unit-ft")),await w(n.getByDisplayValue("1496")).toBeInTheDocument()}),await a("Shows validation error for non-numeric input",async()=>{const i=n.getByTestId("testId");await f.clear(i),await f.type(i,"123x45s6"),await w(n.getByDisplayValue("123x45s6")).toBeInTheDocument(),await yn.mouseOver(i),await bn(()=>{w(s.getByText("Must be a numerical value")).toBeInTheDocument()})})};M.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"Placeholder"};O.__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:la}=__STORYBOOK_MODULE_PREVIEW_API__,Xa={title:"Forms/UnitInput",component:c,args:{name:"example",unitkey:"length",value:"123|m"}},b=t=>{const[a,n]=la(),r=i=>{n({value:i.target.value})};return e.jsx(c,{...t,onChange:r})},Ce=b.bind({}),Y=b.bind({});Y.args={initUnit:"ft",unitTemplate:{length:"ft"}};const Z=b.bind({});Z.args={value:'123|"',unitkey:'"'};const Q=b.bind({});Q.args={width:"180px"};const X=b.bind({});X.args={noConversion:!0};const ee=b.bind({});ee.args={small:!0};const M=()=>{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"})};M.play=async({canvasElement:t,step:a})=>{const n=he(t),r=he(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 x(n.getByDisplayValue("123x45s6")).toBeInTheDocument(),await yn.mouseOver(i),await bn(()=>{x(r.getByText("Must be a numerical value")).toBeInTheDocument()})})};const te=b.bind({});te.args={error:"Error message goes here"};const ne=b.bind({});ne.args={value:"asas123asd|%"};const W=b.bind({});W.args={disabled:!0,disabledUnit:!0};W.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 ae=b.bind({});ae.args={disabled:!0,disabledUnit:!0,noConversion:!0};const ie=b.bind({});ie.args={disabledUnit:!0,unitkey:void 0};const re=b.bind({});re.args={disabledUnit:!0,unitkey:"length"};const se=b.bind({});se.args={disabledUnit:!1,disabled:!0};const O=t=>{const[a,n]=o.useState("123|m"),[r,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(y,{}),e.jsx(p,{label:"Change value",onClick:()=>n(a==="123|m"?"456|m":"123|m")}),e.jsx(y,{}),e.jsx(c,{name:"example",onChange:h=>{n(h.target.value)},unitkey:"length",value:a,initUnit:m,onSwitchUnit:u}),e.jsx(y,{}),e.jsx(c,{name:"example2",onChange:h=>{i(h.target.value)},unitkey:"length",value:r,initUnit:m,onSwitchUnit:u}),e.jsx(Zn,{}),e.jsx("h4",{children:"Without initUnit property (taken from the redux store)"}),e.jsx(c,{name:"example",onChange:h=>{n(h.target.value)},unitkey:"length",value:a,onSwitchUnit:u}),e.jsx(c,{name:"example2",onChange:h=>{i(h.target.value)},unitkey:"length",value:r,onSwitchUnit:u})]})};O.parameters={docs:{description:{story:"[OW-4380](https://oliasoft.atlassian.net/browse/OW-4380?atlOrigin=eyJpIjoiMmM1N2RkNWU3Mjk5NDYxY2E0YzhkMzk5ZTVmZTJhMjciLCJwIjoiaiJ9)"}}};const le=b.bind({});le.args={predefinedOptions:[{label:"bottom of casing",value:"12|km"},{label:"mud weight at shoe depth",value:"8|mm"}]};const H=()=>{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(Cn,{children:[e.jsxs(Be,{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(Be,{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:r=>n(r.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit"})}),e.jsx(I,{label:"Disabled validation",children:e.jsx(c,{name:"example2",onChange:r=>n(r.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:r=>n(r.target.value),value:a,unitkey:"length",error:"test",disabledValidation:!0,width:t})}),e.jsx(xe,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})},oe=()=>{const t="500px",[a,n]=o.useState("1|m"),[r,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(Cn,{children:e.jsxs(Be,{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:r,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(xe,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})};H.parameters={docs:{description:{story:"[OW-8884](https://oliasoft.atlassian.net/browse/OW-8884)"}}};const ue=()=>{const[t,a]=o.useState("123|%"),[n,r]=o.useState(null),i="This should be visible when an error appears",m=(u,h)=>(r(h),{name:u,error:h});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(y,{}),e.jsx("h4",{children:"Original validation message: "}),e.jsx(xe,{message:{heading:n,visible:!0}})]})},de=()=>{const[t,a]=o.useState("123|m"),[n,r]=o.useState(""),[i,m]=o.useState("km"),u=()=>{m("ft"),r("placeholder"),a("|m")};return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Empty value case:"}),e.jsx(c,{name:"example",onChange:h=>a(h.target.value),value:t,allowEmpty:!0,placeholder:n,initUnit:i,unitkey:"length"}),e.jsx("br",{}),e.jsx(y,{}),e.jsx(p,{label:"Change value |m and unit ft",onClick:()=>u()})]})},ce=()=>{const[t,a]=o.useState("123|m"),[n,r]=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:r}),e.jsx(y,{}),e.jsx(c,{name:"example",onChange:i=>a(i.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:r})]})},me=()=>{const[t,a]=o.useState(!0),n=()=>{a(!1),setTimeout(()=>a(!0),0)},[r,i]=o.useState("123|ft");return e.jsxs(Un,{columns:"1fr 1fr",gap:!0,children:[e.jsxs(A,{heading:e.jsx(q,{children:"Storage State (Redux)"}),children:[r,e.jsx(y,{}),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(xn,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:n,children:"UnitInput"}),children:t&&e.jsx(c,{name:"example",onChange:m=>i(m.target.value),value:r,initUnit:"m",unitkey:"depth",unitTemplate:{depth:"m"}})})]})},pe=()=>e.jsxs(e.Fragment,{children:[e.jsx(Ue,{faint:!0,children:"Reproduce OW-10614 rounding noise bug when storing values in a different unit to the display unit"}),e.jsx(y,{}),e.jsx(c,{name:"example",onChange:()=>{},value:l.withUnit(l.convertAndGetValue("9750|psi","bar"),"bar"),initUnit:"psi",unitkey:"pressure",unitTemplate:{pressure:"psi"}}),e.jsx(y,{}),e.jsx(c,{name:"example2",onChange:()=>{},value:l.withUnit(l.convertAndGetValue("8642|lbf","tonneForce"),"tonneForce"),initUnit:"lbf",unitkey:"force",unitTemplate:{force:"tonneForce"}})]}),L=()=>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(y,{}),e.jsx(c,{name:"gor",unitkey:"moleWeight",initUnit:"gor",value:"Infinity|SCF/STB",testId:"case2"})]});L.play=async({canvasElement:t,step:a})=>{const n=he(t);await a("Can enter decimal values",async()=>{await x(n.getByDisplayValue("170")).toBeInTheDocument(),await x(n.getByDisplayValue("")).toBeInTheDocument()})};const ge=()=>{const[t,a]=o.useState(!0),n=()=>{a(!1),setTimeout(()=>a(!0),0)},[r,i]=o.useState("psi"),[m,u]=o.useState(!1),[h,f]=o.useState(!0),[S,Ie]=o.useState(!0),[K,F]=o.useState("672.2388357750001|bar"),[Te,we]=o.useState("");return e.jsxs(Un,{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(Ne,{checked:m,onChange:C=>u(C.target.checked)})}),e.jsx(I,{label:"Enable cosmetic rounding:",labelLeft:!0,labelWidth:200,children:e.jsx(Ne,{checked:h,onChange:C=>f(C.target.checked)})}),e.jsx(I,{label:"Convert back to storage unit (onChange):",labelLeft:!0,labelWidth:200,children:e.jsx(Ne,{checked:S,onChange:C=>Ie(C.target.checked)})})]}),e.jsxs(A,{heading:e.jsx(q,{icon:e.jsx(xn,{icon:"refresh",testId:"triggerRerenderTestId"}),onIconClick:n,children:"UnitInput"}),children:[e.jsx(Ue,{faint:!0,children:"Cosmetic Rounding Test Case: type 9750 then return (compare with enableCosmeticRounding on and off)"}),e.jsx(y,{}),e.jsx(Ue,{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(y,{}),t&&e.jsx(c,{name:"Example",unitkey:"pressure",initUnit:r,unitTemplate:{pressure:"psi"},value:K,onChange:C=>{const{value:j}=C.target;j&&F(j)},enableDisplayRounding:m,enableCosmeticRounding:h,error:l.convertAndGetValue(K,"bar")>=0?"":"Value must be positive",validationCallback:(C,j)=>{we(j??"")},convertBackToStorageUnit:S})]}),e.jsx(A,{heading:e.jsx(q,{children:"Unit Template"}),children:e.jsx(Qn,{options:[{label:"Bar",value:"bar"},{label:"psi",value:"psi"}],value:r,width:70,onChange:C=>i(C.target.value)})}),e.jsx(A,{heading:e.jsx(q,{children:"Test Validation Callback"}),children:Te&&e.jsx(xe,{message:{content:Te,icon:!0,type:"Error",visible:!0}})}),e.jsxs(A,{heading:e.jsx(q,{children:"Storage State / Redux"}),children:[K,e.jsx(y,{}),e.jsx(p,{label:"Change value",onClick:()=>F(l.withUnit(String(Math.floor(Math.random()*100)),"bar"))})]})]})},G=()=>{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"})};G.play=async({canvasElement:t,step:a})=>{const n=he(t),r=he(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 x(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 x(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 x(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 x(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 x(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(r.getByTestId("testId-unit-ft")),await x(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 x(n.getByDisplayValue("123x45s6")).toBeInTheDocument(),await yn.mouseOver(i),await bn(()=>{x(r.getByText("Must be a numerical value")).toBeInTheDocument()})})};M.__docgenInfo={description:"",methods:[{name:"play",docblock:null,modifiers:["static"],params:[{name:"{ canvasElement, step }",optional:!1,type:null}],returns:null}],displayName:"Placeholder"};O.__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 };
|
|
@@ -24,7 +24,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJv
|
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
return <UnitInput {...args} onChange={handleChange} />;
|
|
27
|
-
}`,...(Je=(ze=Ce.parameters)==null?void 0:ze.docs)==null?void 0:Je.source}}};var Ye,Qe
|
|
27
|
+
}`,...(Je=(ze=Ce.parameters)==null?void 0:ze.docs)==null?void 0:Je.source}}};var Ye,Ze,Qe;Y.parameters={...Y.parameters,docs:{...(Ye=Y.parameters)==null?void 0:Ye.docs,source:{originalSource:`args => {
|
|
28
28
|
const [_, updateArgs] = useArgs();
|
|
29
29
|
const handleChange = (evt: any) => {
|
|
30
30
|
updateArgs({
|
|
@@ -32,7 +32,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJv
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
return <UnitInput {...args} onChange={handleChange} />;
|
|
35
|
-
}`,...(
|
|
35
|
+
}`,...(Qe=(Ze=Y.parameters)==null?void 0:Ze.docs)==null?void 0:Qe.source}}};var Xe,et,tt;Z.parameters={...Z.parameters,docs:{...(Xe=Z.parameters)==null?void 0:Xe.docs,source:{originalSource:`args => {
|
|
36
36
|
const [_, updateArgs] = useArgs();
|
|
37
37
|
const handleChange = (evt: any) => {
|
|
38
38
|
updateArgs({
|
|
@@ -40,7 +40,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJv
|
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
return <UnitInput {...args} onChange={handleChange} />;
|
|
43
|
-
}`,...(tt=(et=
|
|
43
|
+
}`,...(tt=(et=Z.parameters)==null?void 0:et.docs)==null?void 0:tt.source}}};var nt,at,it;Q.parameters={...Q.parameters,docs:{...(nt=Q.parameters)==null?void 0:nt.docs,source:{originalSource:`args => {
|
|
44
44
|
const [_, updateArgs] = useArgs();
|
|
45
45
|
const handleChange = (evt: any) => {
|
|
46
46
|
updateArgs({
|
|
@@ -48,7 +48,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJv
|
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
50
|
return <UnitInput {...args} onChange={handleChange} />;
|
|
51
|
-
}`,...(it=(at=
|
|
51
|
+
}`,...(it=(at=Q.parameters)==null?void 0:at.docs)==null?void 0:it.source}}};var rt,st,lt;X.parameters={...X.parameters,docs:{...(rt=X.parameters)==null?void 0:rt.docs,source:{originalSource:`args => {
|
|
52
52
|
const [_, updateArgs] = useArgs();
|
|
53
53
|
const handleChange = (evt: any) => {
|
|
54
54
|
updateArgs({
|
|
@@ -101,7 +101,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJv
|
|
|
101
101
|
});
|
|
102
102
|
};
|
|
103
103
|
return <UnitInput {...args} onChange={handleChange} />;
|
|
104
|
-
}`,...(wt=(Tt=ae.parameters)==null?void 0:Tt.docs)==null?void 0:wt.source}}};var Vt,
|
|
104
|
+
}`,...(wt=(Tt=ae.parameters)==null?void 0:Tt.docs)==null?void 0:wt.source}}};var kt,Vt,St;ie.parameters={...ie.parameters,docs:{...(kt=ie.parameters)==null?void 0:kt.docs,source:{originalSource:`args => {
|
|
105
105
|
const [_, updateArgs] = useArgs();
|
|
106
106
|
const handleChange = (evt: any) => {
|
|
107
107
|
updateArgs({
|
|
@@ -109,7 +109,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJv
|
|
|
109
109
|
});
|
|
110
110
|
};
|
|
111
111
|
return <UnitInput {...args} onChange={handleChange} />;
|
|
112
|
-
}`,...(St=(
|
|
112
|
+
}`,...(St=(Vt=ie.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 => {
|
|
113
113
|
const [_, updateArgs] = useArgs();
|
|
114
114
|
const handleChange = (evt: any) => {
|
|
115
115
|
updateArgs({
|
|
@@ -125,7 +125,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJv
|
|
|
125
125
|
});
|
|
126
126
|
};
|
|
127
127
|
return <UnitInput {...args} onChange={handleChange} />;
|
|
128
|
-
}`,...(At=(Dt=se.parameters)==null?void 0:Dt.docs)==null?void 0:At.source}}};var Ft,
|
|
128
|
+
}`,...(At=(Dt=se.parameters)==null?void 0:Dt.docs)==null?void 0:At.source}}};var qt,Ft,Pt;O.parameters={...O.parameters,docs:{...(qt=O.parameters)==null?void 0:qt.docs,source:{originalSource:`(args: IUnitInputProps) => {
|
|
129
129
|
const [value, setValue] = useState('123|m');
|
|
130
130
|
const [value2, setValue2] = useState('223|m');
|
|
131
131
|
const [initUnit, setInitUnit] = useState('ft');
|
|
@@ -150,7 +150,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJv
|
|
|
150
150
|
setValue2(evt.target.value);
|
|
151
151
|
}} unitkey="length" value={value2} onSwitchUnit={setInitUnit} />
|
|
152
152
|
</>;
|
|
153
|
-
}`,...(Pt=(
|
|
153
|
+
}`,...(Pt=(Ft=O.parameters)==null?void 0:Ft.docs)==null?void 0:Pt.source}}};var Rt,_t,Mt;le.parameters={...le.parameters,docs:{...(Rt=le.parameters)==null?void 0:Rt.docs,source:{originalSource:`args => {
|
|
154
154
|
const [_, updateArgs] = useArgs();
|
|
155
155
|
const handleChange = (evt: any) => {
|
|
156
156
|
updateArgs({
|
|
@@ -158,7 +158,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJv
|
|
|
158
158
|
});
|
|
159
159
|
};
|
|
160
160
|
return <UnitInput {...args} onChange={handleChange} />;
|
|
161
|
-
}`,...(Mt=(
|
|
161
|
+
}`,...(Mt=(_t=le.parameters)==null?void 0:_t.docs)==null?void 0:Mt.source}}};var Wt,Ot,Ht;H.parameters={...H.parameters,docs:{...(Wt=H.parameters)==null?void 0:Wt.docs,source:{originalSource:`() => {
|
|
162
162
|
const width = '500px';
|
|
163
163
|
const [value, setValue] = useState<any>(undefined);
|
|
164
164
|
return <>
|
|
@@ -269,7 +269,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJv
|
|
|
269
269
|
visible: true
|
|
270
270
|
}} />
|
|
271
271
|
</>;
|
|
272
|
-
}`,...(Jt=(zt=ue.parameters)==null?void 0:zt.docs)==null?void 0:Jt.source}}};var Yt,Qt
|
|
272
|
+
}`,...(Jt=(zt=ue.parameters)==null?void 0:zt.docs)==null?void 0:Jt.source}}};var Yt,Zt,Qt;de.parameters={...de.parameters,docs:{...(Yt=de.parameters)==null?void 0:Yt.docs,source:{originalSource:`() => {
|
|
273
273
|
const [value, setValue] = useState('123|m');
|
|
274
274
|
const [placeholder, setPlaceholder] = useState('');
|
|
275
275
|
const [initUnit, setInitUnit] = useState('km');
|
|
@@ -285,7 +285,7 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJv
|
|
|
285
285
|
<Spacer />
|
|
286
286
|
<Button label="Change value |m and unit ft" onClick={() => setPlaceholderValue()} />
|
|
287
287
|
</>;
|
|
288
|
-
}`,...(
|
|
288
|
+
}`,...(Qt=(Zt=de.parameters)==null?void 0:Zt.docs)==null?void 0:Qt.source}}};var Xt,en,tn;ce.parameters={...ce.parameters,docs:{...(Xt=ce.parameters)==null?void 0:Xt.docs,source:{originalSource:`() => {
|
|
289
289
|
const [value, setValue] = useState('123|m');
|
|
290
290
|
const [unit, setUnit] = useState('m');
|
|
291
291
|
return <>
|
|
@@ -418,4 +418,4 @@ import{j as e}from"./jsx-runtime-eps93zm2.js";import{r as u}from"./index-DhsZuJv
|
|
|
418
418
|
return <UnitInput name="example" onChange={evt => setValue(evt.target.value)} value={value} initUnit="m" unitkey="depth" unitTemplate={{
|
|
419
419
|
depth: 'm'
|
|
420
420
|
}} testId="testId" />;
|
|
421
|
-
}`,...(fn=(vn=G.parameters)==null?void 0:vn.docs)==null?void 0:fn.source}}};const
|
|
421
|
+
}`,...(fn=(vn=G.parameters)==null?void 0:vn.docs)==null?void 0:fn.source}}};const ei=["Default","InitUnit","notKnownUnit","Width","NoConversion","Small","Placeholder","Error","InternalValidationError","Disabled","DisabledNoConversion","DisabledUnitWithoutUnitKey","DisabledUnitWithUnitKey","DisabledWithEnabledUnitMenu","TestExternalStateChangeWithSynchronizedUnits","PredefinedOptionsMenu","TestEdgeCases","AutomaticValues","ValidationCallback","AllowEmptyPUI","onSwitchUnit","ManagedTestCase","OW_10614TestCase","OW_17784TestCase","DemoCosmeticRounding","TestUserInput"];export{de as AllowEmptyPUI,oe as AutomaticValues,Ce as Default,ge as DemoCosmeticRounding,W as Disabled,ae as DisabledNoConversion,re as DisabledUnitWithUnitKey,ie as DisabledUnitWithoutUnitKey,se as DisabledWithEnabledUnitMenu,te as Error,Y as InitUnit,ne as InternalValidationError,me as ManagedTestCase,X as NoConversion,pe as OW_10614TestCase,L as OW_17784TestCase,M as Placeholder,le as PredefinedOptionsMenu,ee as Small,H as TestEdgeCases,O as TestExternalStateChangeWithSynchronizedUnits,G as TestUserInput,ue as ValidationCallback,Q as Width,ei as __namedExportsOrder,Xa as default,Z as notKnownUnit,ce as onSwitchUnit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"generatedAt":
|
|
1
|
+
{"generatedAt":1724339486987,"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