@oliasoft-open-source/react-ui-library 4.2.1-beta-2 → 4.3.0-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-6VNJS4EI-6b48c85b.js → Color-6VNJS4EI-caa8bffa.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-NNNQARDV-25c0f625.js → DocsRenderer-NNNQARDV-e463e8a5.js} +1 -1
- package/dist/storybook/assets/{WithTooltip-4HIR6TLV-9ebd09dc.js → WithTooltip-4HIR6TLV-9514f93a.js} +1 -1
- package/dist/storybook/assets/accordion-with-default-toggle-0b4845c8.js +1 -0
- package/dist/storybook/assets/accordion.stories-ad491954.js +170 -0
- package/dist/storybook/assets/{afe.stories-afb9be07.js → afe.stories-49904fdb.js} +1 -1
- package/dist/storybook/assets/breadcrumb-f8742fbd.js +1 -0
- package/dist/storybook/assets/breadcrumb.stories-b5582cfb.js +1 -0
- package/dist/storybook/assets/buttons-and-links-6c701fa6.js +14 -0
- package/dist/storybook/assets/{casing-loads.stories-cfbab702.js → casing-loads.stories-dff0b8fc.js} +1 -1
- package/dist/storybook/assets/{chunk-HLWAVYOI-1c498991.js → chunk-HLWAVYOI-d8be29f3.js} +1 -1
- package/dist/storybook/assets/{color-8b40ecf4.js → color-9e78f280.js} +1 -1
- package/dist/storybook/assets/{drawer.stories-39625e91.js → drawer.stories-59cd794a.js} +1 -1
- package/dist/storybook/assets/empty-2d83d50b.js +1 -0
- package/dist/storybook/assets/empty.stories-c98807b8.js +1 -0
- package/dist/storybook/assets/file-input-a3594635.js +1 -0
- package/dist/storybook/assets/file-input.stories-3d2e95e7.js +55 -0
- package/dist/storybook/assets/{formatter-SWP5E3XI-521171e8.js → formatter-SWP5E3XI-c42be4d9.js} +1 -1
- package/dist/storybook/assets/{preview-d47a2f40.css → global-aa71ac9c.css} +1 -1
- package/dist/storybook/assets/iframe-8d80f428.js +1 -0
- package/dist/storybook/assets/{index-665bded2.js → index-56f304c1.js} +4 -4
- package/dist/storybook/assets/{input-validation-560fd9e3.js → input-validation-1b895773.js} +1 -1
- package/dist/storybook/assets/{inputs-ed0fc7ad.js → inputs-e51c1c31.js} +2 -2
- package/dist/storybook/assets/{layout-forms-e9b95540.js → layout-forms-29ceb520.js} +1 -1
- package/dist/storybook/assets/{layout-general-7a81d7f9.js → layout-general-245ef20f.js} +1 -1
- package/dist/storybook/assets/{list-0dc3df85.js → list-e6e7e5ed.js} +1 -1
- package/dist/storybook/assets/{list.stories-5715452e.js → list.stories-e2d00aea.js} +1 -1
- package/dist/storybook/assets/{message-7e627e60.js → message-dabd76a8.js} +1 -1
- package/dist/storybook/assets/{message.stories-f41a0c22.js → message.stories-6f612f7c.js} +1 -1
- package/dist/storybook/assets/meta-content-6f132e03.js +1 -0
- package/dist/storybook/assets/modal-ad69eee9.js +1 -0
- package/dist/storybook/assets/modal-f1e8e468.css +1 -0
- package/dist/storybook/assets/{modal.stories-0e068cc1.js → modal.stories-448cc75d.js} +1 -1
- package/dist/storybook/assets/option-dropdown-fbe54c09.js +1 -0
- package/dist/storybook/assets/option-dropdown.stories-8b7ee529.js +21 -0
- package/dist/storybook/assets/{padding-and-spacing-ea2bf22c.js → padding-and-spacing-27e63c65.js} +1 -1
- package/dist/storybook/assets/page.stories-4ad3bea8.js +57 -0
- package/dist/storybook/assets/pop-confirm-e6b7cc0c.js +1 -0
- package/dist/storybook/assets/pop-confirm.stories-27da1975.js +7 -0
- package/dist/storybook/assets/preview-608a4ee9.js +1 -0
- package/dist/storybook/assets/{preview-51e87244.js → preview-72d84988.js} +3 -3
- package/dist/storybook/assets/preview-a5b25924.css +1 -0
- package/dist/storybook/assets/print-header-bd013690.js +1 -0
- package/dist/storybook/assets/{projects.stories-3884a80c.js → projects.stories-c383cdce.js} +1 -1
- package/dist/storybook/assets/{reservoirs.stories-6b14a37f.js → reservoirs.stories-b4549b91.js} +1 -1
- package/dist/storybook/assets/{rich-text-input.stories-661f34f1.js → rich-text-input-977847ce.js} +52 -127
- package/dist/storybook/assets/rich-text-input.stories-b770908d.js +76 -0
- package/dist/storybook/assets/{site.stories-dee8ce1c.js → site.stories-80a441ea.js} +1 -1
- package/dist/storybook/assets/{syntaxhighlighter-NMPM6SWI-96abff19.js → syntaxhighlighter-NMPM6SWI-73149e16.js} +1 -1
- package/dist/storybook/assets/text-link-f4589768.js +1 -0
- package/dist/storybook/assets/text-link.stories-6b7c8329.js +1 -0
- package/dist/storybook/assets/{toaster-541ce85b.js → toaster-3fba1dd3.js} +1 -1
- package/dist/storybook/assets/{toaster.stories-5e4d95b1.js → toaster.stories-4cdefe35.js} +1 -1
- package/dist/storybook/assets/tree-a5de7d3a.js +6 -0
- package/dist/storybook/assets/tree.stories-b16724d6.js +123 -0
- package/dist/storybook/assets/unit-input-9bf08434.js +1 -0
- package/dist/storybook/assets/unit-input.stories-65646cf3.js +273 -0
- package/dist/storybook/assets/unit-table.stories-4706910f.js +229 -0
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/stories.json +1 -1
- package/package.json +1 -1
- package/dist/storybook/assets/accordion.stories-0f8af16e.js +0 -170
- package/dist/storybook/assets/breadcrumb.stories-e4334a75.js +0 -1
- package/dist/storybook/assets/buttons-and-links-16cf8577.js +0 -14
- package/dist/storybook/assets/dialog-8e840c50.css +0 -1
- package/dist/storybook/assets/dialog-cd58dd09.js +0 -1
- package/dist/storybook/assets/empty.stories-e0e3ac78.js +0 -1
- package/dist/storybook/assets/file-input.stories-1c6ce0ea.js +0 -55
- package/dist/storybook/assets/iframe-5eee0790.js +0 -1
- package/dist/storybook/assets/list-heading-88cc8a9b.js +0 -1
- package/dist/storybook/assets/option-dropdown.stories-5030bdb8.js +0 -21
- package/dist/storybook/assets/page.stories-7cb68fed.js +0 -57
- package/dist/storybook/assets/pop-confirm.stories-81b30901.js +0 -7
- package/dist/storybook/assets/preview-987fd1ab.js +0 -1
- package/dist/storybook/assets/text-link.stories-c1227c6f.js +0 -1
- package/dist/storybook/assets/tree.stories-590bdd69.js +0 -128
- package/dist/storybook/assets/unit-input.stories-0eea1703.js +0 -265
- /package/dist/storybook/assets/{accordion.stories-e92bccf3.css → accordion-with-default-toggle-e92bccf3.css} +0 -0
- /package/dist/storybook/assets/{breadcrumb.stories-a644544e.css → breadcrumb-a644544e.css} +0 -0
- /package/dist/storybook/assets/{empty.stories-9914c767.css → empty-9914c767.css} +0 -0
- /package/dist/storybook/assets/{file-input.stories-f40408e6.css → file-input-f40408e6.css} +0 -0
- /package/dist/storybook/assets/{list-heading-d7e578fa.css → meta-content-d7e578fa.css} +0 -0
- /package/dist/storybook/assets/{option-dropdown.stories-ddc96b15.css → option-dropdown-ddc96b15.css} +0 -0
- /package/dist/storybook/assets/{pop-confirm.stories-c9faec6b.css → pop-confirm-c9faec6b.css} +0 -0
- /package/dist/storybook/assets/{page.stories-dd8c1b35.css → print-header-dd8c1b35.css} +0 -0
- /package/dist/storybook/assets/{rich-text-input.stories-023a1c99.css → rich-text-input-023a1c99.css} +0 -0
- /package/dist/storybook/assets/{tree.stories-3406c5f6.css → tree-3406c5f6.css} +0 -0
- /package/dist/storybook/assets/{unit-input.stories-c251e2c8.css → unit-input-c251e2c8.css} +0 -0
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-f961835c.js";import{r as m}from"./index-f80c8c95.js";import{d as s,r as Xt}from"./index-57d7693e.js";import{c as en}from"./index-a80ed1cf.js";import{M as ke}from"./actions-2d4e1c8e.js";import{I as tn}from"./input-group-addon-f8f6683a.js";import{B as d}from"./button-74c97e4a.js";import{T as nn}from"./tooltip-23e84186.js";import{I as an}from"./input-group-20c3add3.js";import{S as N}from"./spacer-54db0620.js";import{T as ln}from"./text-ad1f5f1d.js";import{I as rn}from"./input-d68625a5.js";import{M as Se}from"./types-cc224262.js";import{l as w}from"./lodash-75c70a11.js";import{D as sn}from"./divider-182aa58c.js";import{R as Dt,C as me}from"./row-2299f0e7.js";import{F as I}from"./field-a094cd72.js";import{a as pe}from"./message-7e627e60.js";import"./index-54f0d271.js";import"./common-types-2c81813f.js";import"./disabled-context-d654f6ff.js";import"./icon-e9cbb4d7.js";import"./inheritsLoose-d4851ab8.js";import"./tslib.es6-dfef685f.js";import"./index-c89a1915.js";import"./types-332ceaf3.js";import"./badge-20e7ee0b.js";import"./spinner-a81ebe38.js";import"./index-3d476d02.js";import"./styled-components.browser.esm-416d73e5.js";import"./label-13d490a3.js";import"./help-icon-d4189b1b.js";const un=()=>{const t=m.useRef(null);return m.useLayoutEffect(()=>{t.current&&(t.current(),t.current=null)}),n=>{t.current=n}},on=t=>{const a=m.useRef();return m.useEffect(()=>{a.current=t},[t]),a.current},dn=(t,a)=>{const n=a==null?void 0:a[t];return n||(console.log(`Warning: 'unitTemplate' does not define a preferred unit for '${t}'. Defaulting to standard unit.`),s.unitFromQuantity(t)??"")};var b=(t=>(t.CUSTOM="custom",t.PREDEFINED="predefined",t))(b||{});const Mt=t=>t==="undefined"||t===void 0||t===""||t==="null"||t===null||t==="NaN"||isNaN(t),Ft=(t="",a,n="",i=!1)=>{if(i)return t;if(a&&!Mt(t))try{const c=s.isValueWithUnit(t)?t:s.withUnit(t,n),u=s.convertSamePrecision(c,a);return s.getValue(u)}catch{}return t},cn=t=>t?!!s.getUnit(t):!1,M=(t="",a,n,i)=>{if(i)return t;const c=cn(t)||s.isValueWithUnit(t),u=s.getValue(t);return Mt(u)?u:c?Ft(u,a,n,i):t},we=t=>w.isObject(t)&&!w.isArray(t)&&!w.isFunction(t)?w.get(t,"fieldName",""):typeof t=="string"?t:"",mn=t=>w.isObjectLike(t)&&w.has(t,"message"),pn=t=>typeof t=="string"?t:mn(t)?t.message:null;var gn=Xt();const hn=t=>t.search(RegExp(/(^0{2}\.)|(^0+[1-9])/g))===0,Ee=(t,a)=>{var j;const{allowEmpty:n=!1,autoValue:i,placeholder:c,disabledValidation:u=!1}=a||{},r=String(t);if(u||i||c)return null;const p=gn.isValueWithUnit(r)?s.getValue(r):r;if(n&&p==="")return null;if(hn(p))return"Invalid number format due to leading zeroes";const h=s.validateNumber(p);if(!h.valid){const le=((j=h==null?void 0:h.errors)==null?void 0:j[0])??null;return pn(le)}return null},vn="_predefinedMenuActive_1yvt4_1",fn={predefinedMenuActive:vn},g=({name:t,placeholder:a="",disabled:n=!1,disabledUnit:i=!1,error:c=null,left:u=!1,small:r=!1,width:p="100%",value:h,unitkey:j="",initUnit:le,noConversion:_t=!1,onChange:re=()=>{},onClick:bn=()=>{},onFocus:Ot=()=>{},onSwitchUnit:ge=()=>{},unitTemplate:he,doNotConvertValue:A=!1,testId:S,warning:Bt=null,predefinedOptions:x,initialPredefinedOption:qt=!1,shouldLinkAutomaticly:ve=!0,selectedPredefinedOptionKey:fe,validationCallback:Ce=()=>({name:"",error:null}),disabledValidation:be=!1,allowEmpty:ye=!1,autoValue:V})=>{typeof h=="number"&&(h=`${h}`);const Wt=un(),[se="",P=""]=h!==void 0?s.split(h):[],Ue=V?s.getUnit(V):"",Rt=m.useMemo(()=>dn(j,he),[j,he]),y=le||Rt||P,Tt=on(y),xe=M(h,y,P,A),Ve=M(V,y,Ue,A),Lt=xe!==""?{value:xe,unit:y}:Ve!==""?{value:Ve,unit:y}:{value:se,unit:P},[v,Y]=m.useState(Lt),[Kt,ie]=m.useState(null),[k,ue]=m.useState(qt?b.PREDEFINED:b.CUSTOM),oe=se===""&&V,D=x&&x.find(l=>{if(fe)return fe===l.valueKey;const o=s.isValueWithUnit(l.value)?s.getUnit(l.value):"";return s.withUnit(Ft(h,o),o)===l.value}),$t=()=>{if(j)try{const l=oe?V:h??"";let o=s.altUnitsList(l,j);return s.getValue(l)===""?o.map(f=>["",f[1]]):o}catch{return null}},Ht=l=>{const o=we(t),f=l.target,{value:U,selectionStart:X}=f,je=s.cleanNumStr(U.replaceAll(" ","").replaceAll("|","")),de=s.withUnit(je,(v==null?void 0:v.unit)||""),Zt=s.getValue(de),ce=Ee(Zt,{allowEmpty:ye,autoValue:V,placeholder:a,disabledValidation:be});if(ce===null){re({target:{value:de,name:o}});const[Gt,Qt]=s.split(de);Y({value:Gt,unit:Qt}),ie(null),Ce(o,null)}else Y({value:je,unit:v.unit}),ie(ce),Ce(o,ce);Wt(()=>{f.selectionStart=X,f.selectionEnd=X})},zt=(l,o)=>{o===v.unit||isNaN(Number(l))||(Y({value:l,unit:o}),ge&&ge(o))};m.useEffect(()=>{if(y){let f,U="";Tt!==y?(f=M(h,y,P,A),U=y):s.withUnit(v.value,v.unit)!==h&&(f=M(h,v.unit,P,A),U=v.unit),f!==void 0&&Y({value:f,unit:U}),x&&ue(D&&ve?b.PREDEFINED:b.CUSTOM)}const l=s.checkAndCleanDecimalComma(se),o=Ee(l,{allowEmpty:ye,autoValue:V,placeholder:a,disabledValidation:be});ie(o)},[y,h,c,ve]);const Z=$t(),G=s.label(v.unit)||v.unit||"",Jt=_t||!Z||Z&&Z.length===1,Ie=we(t);let Q;const Yt=l=>{const[o,f=""]=s.isValueWithUnit(l.value)?s.split(l.value):[l.value];return{type:Se.OPTION,inline:!0,onClick:()=>{s.validateNumber(o).valid&&!n&&(ue(b.PREDEFINED),re({target:{value:l.value,name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||"",predefinedSelected:!0,predefinedOption:l}}))},label:e.jsxs(e.Fragment,{children:[e.jsx(ln,{children:l.label}),e.jsx(N,{width:"20px",height:"0"})]}),description:s.isValueWithUnit(l.value)?`${o} ${f}`:l.value,selected:D===l&&k===b.PREDEFINED}};if(Q=[{type:Se.OPTION,inline:!0,onClick:()=>{k!==b.CUSTOM&&!n&&re({target:{value:s.withUnit(v.value,v.unit),name:typeof t=="string"?t:(t==null?void 0:t.fieldName)||""}})},label:"Custom",selected:k===b.CUSTOM}],x!=null&&x.length){const l=x.map(Yt);Q=[...Q,...l]}return e.jsx("div",{className:k===b.PREDEFINED?en(fn.predefinedMenuActive):"",children:e.jsxs(an,{small:r,width:p,children:[x&&e.jsx(nn,{text:k===b.PREDEFINED?D==null?void 0:D.label:"",children:e.jsx(ke,{maxHeight:380,groupOrder:"first",testId:S&&`${S}-predefined-menu`,disabled:n,menu:{colored:!0,trigger:"Component",component:e.jsx(d,{groupOrder:"first",active:k===b.PREDEFINED,icon:k===b.PREDEFINED?"link":"unlink"}),small:r,sections:Q}})}),e.jsx(rn,{type:"text",name:Ie,testId:S,disabled:n,placeholder:oe?M(V,v.unit,Ue,A):a,value:v.value,onChange:Ht,onFocus:Ot,error:c||Kt,warning:Bt,right:!u},Ie),G&&(Jt?e.jsx(tn,{groupOrder:"last",children:G}):e.jsx(ke,{maxHeight:380,groupOrder:"last",disabled:i,testId:S&&`${S}-menu`,menu:{label:G,trigger:"DropDownButton",small:r,sections:Z.map(([l,o,f])=>{const U=f||o||"";return{type:"Option",label:isNaN(Number(l))?"":l,inline:!0,onClick:X=>{X.stopPropagation(),zt(oe?"":l,o)},description:U,selected:U===G,testId:`${S}-unit-${U}`}})}}))]})})};try{g.displayName="UnitInput",g.__docgenInfo={description:"",displayName:"UnitInput",props:{name:{defaultValue:null,description:"",name:"name",required:!0,type:{name:"string | { fieldName?: string | undefined; }"}},placeholder:{defaultValue:{value:""},description:"",name:"placeholder",required:!1,type:{name:"string"}},disabled:{defaultValue:{value:"false"},description:"",name:"disabled",required:!1,type:{name:"boolean"}},disabledUnit:{defaultValue:{value:"false"},description:"",name:"disabledUnit",required:!1,type:{name:"boolean"}},error:{defaultValue:{value:"null"},description:"",name:"error",required:!1,type:{name:"string | boolean | null"}},left:{defaultValue:{value:"false"},description:"",name:"left",required:!1,type:{name:"boolean"}},small:{defaultValue:{value:"false"},description:"",name:"small",required:!1,type:{name:"boolean"}},width:{defaultValue:{value:"100%"},description:"",name:"width",required:!1,type:{name:"string | number"}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"string"}},unitkey:{defaultValue:{value:""},description:"",name:"unitkey",required:!1,type:{name:"string"}},initUnit:{defaultValue:null,description:"",name:"initUnit",required:!1,type:{name:"string"}},noConversion:{defaultValue:{value:"false"},description:"",name:"noConversion",required:!1,type:{name:"boolean"}},doNotConvertValue:{defaultValue:{value:"false"},description:"",name:"doNotConvertValue",required:!1,type:{name:"boolean"}},testId:{defaultValue:null,description:"",name:"testId",required:!1,type:{name:"string"}},warning:{defaultValue:{value:"null"},description:"",name:"warning",required:!1,type:{name:"string | null"}},predefinedOptions:{defaultValue:null,description:"",name:"predefinedOptions",required:!1,type:{name:"IPredefinedOption[]"}},initialPredefinedOption:{defaultValue:{value:"false"},description:"",name:"initialPredefinedOption",required:!1,type:{name:"boolean"}},shouldLinkAutomaticly:{defaultValue:{value:"true"},description:"",name:"shouldLinkAutomaticly",required:!1,type:{name:"boolean"}},selectedPredefinedOptionKey:{defaultValue:null,description:"",name:"selectedPredefinedOptionKey",required:!1,type:{name:"string"}},validationCallback:{defaultValue:{value:"() => ({ name: '', error: null })"},description:"",name:"validationCallback",required:!1,type:{name:"((name: string, message: string | null) => { name: string; error: string | null; })"}},disabledValidation:{defaultValue:{value:"false"},description:"",name:"disabledValidation",required:!1,type:{name:"boolean"}},allowEmpty:{defaultValue:{value:"false"},description:"",name:"allowEmpty",required:!1,type:{name:"boolean"}},autoValue:{defaultValue:null,description:"",name:"autoValue",required:!1,type:{name:"string"}},onChange:{defaultValue:{value:"() => {}"},description:"",name:"onChange",required:!1,type:{name:"(event: ChangeEvent<HTMLInputElement> | ICustomChangeEvent) => void"}},onSwitchUnit:{defaultValue:{value:"() => {}"},description:"",name:"onSwitchUnit",required:!1,type:{name:"((unit: string) => void)"}},onClick:{defaultValue:{value:"() => {}"},description:"",name:"onClick",required:!1,type:{name:"MouseEventHandler<HTMLInputElement>"}},onFocus:{defaultValue:{value:"() => {}"},description:"",name:"onFocus",required:!1,type:{name:"FocusEventHandler<HTMLInputElement>"}},unitTemplate:{defaultValue:null,description:"",name:"unitTemplate",required:!1,type:{name:"Record<string, any>"}}}}}catch{}const{useArgs:Cn}=__STORYBOOK_MODULE_ADDONS__,Qn={title:"Basic/UnitInput",component:g,args:{name:"example",unitkey:"length",value:"123|m"}},C=t=>{const[a,n]=Cn(),i=c=>{n({value:c.target.value})};return e.jsx(g,{...t,onChange:i})},ee=C.bind({}),F=C.bind({});F.args={initUnit:"ft",unitTemplate:{length:"ft"}};const _=C.bind({});_.args={value:'123|"',unitkey:'"',noConversion:!0};const O=C.bind({});O.args={width:"180px"};const B=C.bind({});B.args={noConversion:!0};const q=C.bind({});q.args={small:!0};const W=C.bind({});W.args={error:"Error message goes here"};const R=C.bind({});R.args={value:"asas123asd|%"};const E=C.bind({});E.args={disabled:!0,disabledUnit:!0};E.parameters={docs:{description:{story:"Each part of UnitInput can be disabled separately. `disabled` disables only the main text input, `disabledUnit` disables only the unit menu. **Needs review (comes from Reservoir input requirements)**"}}};const T=C.bind({});T.args={disabled:!0,disabledUnit:!0,noConversion:!0};const L=C.bind({});L.args={disabledUnit:!0,unitkey:void 0};const K=C.bind({});K.args={disabledUnit:!0,unitkey:"length"};const $=C.bind({});$.args={disabledUnit:!1,disabled:!0};const H=t=>{const[a,n]=m.useState("123|m"),[i,c]=m.useState("223|m"),[u,r]=m.useState("ft");return e.jsxs(e.Fragment,{children:[e.jsx(d,{label:"Change initUnit",onClick:()=>r(u==="m"?"ft":"m")}),e.jsx(N,{}),e.jsx(d,{label:"Change value",onClick:()=>n(a==="123|m"?"456|m":"123|m")}),e.jsx(N,{}),e.jsx(g,{name:"example",onChange:p=>{n(p.target.value)},unitkey:"length",value:a,initUnit:u,onSwitchUnit:r}),e.jsx(N,{}),e.jsx(g,{name:"example2",onChange:p=>{c(p.target.value)},unitkey:"length",value:i,initUnit:u,onSwitchUnit:r}),e.jsx(sn,{}),e.jsx("h4",{children:"Without initUnit property (taken from the redux store)"}),e.jsx(g,{name:"example",onChange:p=>{n(p.target.value)},unitkey:"length",value:a,onSwitchUnit:r}),e.jsx(g,{name:"example2",onChange:p=>{c(p.target.value)},unitkey:"length",value:i,onSwitchUnit:r})]})};H.parameters={docs:{description:{story:"[OW-4380](https://oliasoft.atlassian.net/browse/OW-4380?atlOrigin=eyJpIjoiMmM1N2RkNWU3Mjk5NDYxY2E0YzhkMzk5ZTVmZTJhMjciLCJwIjoiaiJ9)"}}};const z=C.bind({});z.args={predefinedOptions:[{label:"bottom of casing",value:"12|km"},{label:"mud weight at shoe depth",value:"8|mm"}]};const J=()=>{const t="500px",[a,n]=m.useState(void 0);return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different edge cases such as +/- infinity, undefined, NaN, null:"}),e.jsxs(Dt,{children:[e.jsxs(me,{width:"25%",children:[e.jsx(d,{label:"Change value infinity",onClick:()=>n(1/0)}),e.jsx("br",{}),e.jsx(d,{label:"Change value -infinity",onClick:()=>n(-1/0)}),e.jsx("br",{}),e.jsx(d,{label:"Change value null",onClick:()=>n(null)}),e.jsx("br",{}),e.jsx(d,{label:"Change value - undefined",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(d,{label:"Change value - NaN",onClick:()=>n(NaN)}),e.jsx("br",{}),e.jsx(d,{label:"Change value - nothing (empty)",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(d,{label:"Change value - empty string",onClick:()=>n("")})]}),e.jsxs(me,{width:"25%",children:[e.jsx(d,{label:"Change value infinity|m",onClick:()=>n("Infinity|m")}),e.jsx("br",{}),e.jsx(d,{label:"Change value -infinity|m",onClick:()=>n("-Infinity|m")}),e.jsx("br",{}),e.jsx(d,{label:"Change value null|m",onClick:()=>n(null+"|m")}),e.jsx("br",{}),e.jsx(d,{label:"Change value - undefined|m",onClick:()=>n(void 0+"|m")}),e.jsx("br",{}),e.jsx(d,{label:"Change value - NaN|m",onClick:()=>n("NaN|m")}),e.jsx("br",{}),e.jsx(d,{label:"Change value - nothing (empty)|m",onClick:()=>n("|m")})]})]}),e.jsx("br",{}),e.jsx(I,{label:"Normal PUI",children:e.jsx(g,{name:"example1",onChange:i=>n(i.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit"})}),e.jsx(I,{label:"Disabled validation",children:e.jsx(g,{name:"example2",onChange:i=>n(i.target.value),value:a,unitkey:"length",disabledValidation:!0,width:t})}),e.jsx(I,{label:"Disabled validation and manual error",children:e.jsx(g,{name:"example3",onChange:i=>n(i.target.value),value:a,unitkey:"length",error:"test",disabledValidation:!0,width:t})}),e.jsx(pe,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})},te=()=>{const t="500px",[a,n]=m.useState("1|m"),[i,c]=m.useState("|m"),u="123|km";return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different cases for automatic (placeholder) values:"}),e.jsx(Dt,{children:e.jsxs(me,{width:"25%",children:[e.jsx(d,{label:"Change value to ''",onClick:()=>n("")}),e.jsx("br",{}),e.jsx(d,{label:"Change value to 1",onClick:()=>n("1")}),e.jsx("br",{}),e.jsx(d,{label:"Change value to 1|m",onClick:()=>n("1|m")}),e.jsx("br",{}),e.jsx(d,{label:"Change value to |m - empty value",onClick:()=>n("|m")})]})}),e.jsx("br",{}),e.jsx(I,{label:"Normal PUI (placeholder + auto)",children:e.jsx(g,{name:"example1",onChange:r=>n(r.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit",autoValue:u})}),e.jsx(I,{label:"Normal PUI (only auto)",children:e.jsx(g,{name:"example1",onChange:r=>n(r.target.value),value:a,unitkey:"length",width:t,autoValue:u})}),e.jsx(I,{label:"Empty PUI with autoValue",children:e.jsx(g,{name:"example1",onChange:r=>c(r.target.value),value:i,unitkey:"length",width:t,autoValue:u})}),e.jsx(I,{label:"Normal PUI (only placeholder)",children:e.jsx(g,{name:"example1",onChange:r=>n(r.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test"})}),e.jsx(I,{label:"Normal PUI (placeholder + allowEmpty)",children:e.jsx(g,{name:"example1",onChange:r=>n(r.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test",allowEmpty:!0})}),e.jsx(pe,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})};J.parameters={docs:{description:{story:"[OW-8884](https://oliasoft.atlassian.net/browse/OW-8884)"}}};const ne=()=>{const[t,a]=m.useState("123|%"),[n,i]=m.useState(null),c="This should be visible when an error appears",u=(r,p)=>(i(p),{name:r,error:p});return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"3rd party validation message when inputting invalid value:"}),e.jsx(g,{name:"example",onChange:r=>a(r.target.value),error:!n||c,validationCallback:u,value:t}),e.jsx("br",{}),e.jsx(N,{}),e.jsx("h4",{children:"Original validation message: "}),e.jsx(pe,{message:{heading:n,visible:!0}})]})},ae=()=>{const[t,a]=m.useState("123|m"),[n,i]=m.useState(""),[c,u]=m.useState("km"),r=()=>{u("ft"),i("placeholder"),a("|m")};return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Empty value case:"}),e.jsx(g,{name:"example",onChange:p=>a(p.target.value),value:t,allowEmpty:!0,placeholder:n,initUnit:c,unitkey:"length"}),e.jsx("br",{}),e.jsx(N,{}),e.jsx(d,{label:"Change value |m and unit ft",onClick:()=>r()})]})};var Ne,Ae,Pe;ee.parameters={...ee.parameters,docs:{...(Ne=ee.parameters)==null?void 0:Ne.docs,source:{originalSource:`args => {
|
|
2
|
-
const [_, updateArgs] = useArgs();
|
|
3
|
-
const handleChange = (evt: any) => {
|
|
4
|
-
updateArgs({
|
|
5
|
-
value: evt.target.value
|
|
6
|
-
});
|
|
7
|
-
};
|
|
8
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
9
|
-
}`,...(Pe=(Ae=ee.parameters)==null?void 0:Ae.docs)==null?void 0:Pe.source}}};var De,Me,Fe;F.parameters={...F.parameters,docs:{...(De=F.parameters)==null?void 0:De.docs,source:{originalSource:`args => {
|
|
10
|
-
const [_, updateArgs] = useArgs();
|
|
11
|
-
const handleChange = (evt: any) => {
|
|
12
|
-
updateArgs({
|
|
13
|
-
value: evt.target.value
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
17
|
-
}`,...(Fe=(Me=F.parameters)==null?void 0:Me.docs)==null?void 0:Fe.source}}};var _e,Oe,Be;_.parameters={..._.parameters,docs:{...(_e=_.parameters)==null?void 0:_e.docs,source:{originalSource:`args => {
|
|
18
|
-
const [_, updateArgs] = useArgs();
|
|
19
|
-
const handleChange = (evt: any) => {
|
|
20
|
-
updateArgs({
|
|
21
|
-
value: evt.target.value
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
25
|
-
}`,...(Be=(Oe=_.parameters)==null?void 0:Oe.docs)==null?void 0:Be.source}}};var qe,We,Re;O.parameters={...O.parameters,docs:{...(qe=O.parameters)==null?void 0:qe.docs,source:{originalSource:`args => {
|
|
26
|
-
const [_, updateArgs] = useArgs();
|
|
27
|
-
const handleChange = (evt: any) => {
|
|
28
|
-
updateArgs({
|
|
29
|
-
value: evt.target.value
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
33
|
-
}`,...(Re=(We=O.parameters)==null?void 0:We.docs)==null?void 0:Re.source}}};var Te,Le,Ke;B.parameters={...B.parameters,docs:{...(Te=B.parameters)==null?void 0:Te.docs,source:{originalSource:`args => {
|
|
34
|
-
const [_, updateArgs] = useArgs();
|
|
35
|
-
const handleChange = (evt: any) => {
|
|
36
|
-
updateArgs({
|
|
37
|
-
value: evt.target.value
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
41
|
-
}`,...(Ke=(Le=B.parameters)==null?void 0:Le.docs)==null?void 0:Ke.source}}};var $e,He,ze;q.parameters={...q.parameters,docs:{...($e=q.parameters)==null?void 0:$e.docs,source:{originalSource:`args => {
|
|
42
|
-
const [_, updateArgs] = useArgs();
|
|
43
|
-
const handleChange = (evt: any) => {
|
|
44
|
-
updateArgs({
|
|
45
|
-
value: evt.target.value
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
49
|
-
}`,...(ze=(He=q.parameters)==null?void 0:He.docs)==null?void 0:ze.source}}};var Je,Ye,Ze;W.parameters={...W.parameters,docs:{...(Je=W.parameters)==null?void 0:Je.docs,source:{originalSource:`args => {
|
|
50
|
-
const [_, updateArgs] = useArgs();
|
|
51
|
-
const handleChange = (evt: any) => {
|
|
52
|
-
updateArgs({
|
|
53
|
-
value: evt.target.value
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
57
|
-
}`,...(Ze=(Ye=W.parameters)==null?void 0:Ye.docs)==null?void 0:Ze.source}}};var Ge,Qe,Xe;R.parameters={...R.parameters,docs:{...(Ge=R.parameters)==null?void 0:Ge.docs,source:{originalSource:`args => {
|
|
58
|
-
const [_, updateArgs] = useArgs();
|
|
59
|
-
const handleChange = (evt: any) => {
|
|
60
|
-
updateArgs({
|
|
61
|
-
value: evt.target.value
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
65
|
-
}`,...(Xe=(Qe=R.parameters)==null?void 0:Qe.docs)==null?void 0:Xe.source}}};var et,tt,nt;E.parameters={...E.parameters,docs:{...(et=E.parameters)==null?void 0:et.docs,source:{originalSource:`args => {
|
|
66
|
-
const [_, updateArgs] = useArgs();
|
|
67
|
-
const handleChange = (evt: any) => {
|
|
68
|
-
updateArgs({
|
|
69
|
-
value: evt.target.value
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
73
|
-
}`,...(nt=(tt=E.parameters)==null?void 0:tt.docs)==null?void 0:nt.source}}};var at,lt,rt;T.parameters={...T.parameters,docs:{...(at=T.parameters)==null?void 0:at.docs,source:{originalSource:`args => {
|
|
74
|
-
const [_, updateArgs] = useArgs();
|
|
75
|
-
const handleChange = (evt: any) => {
|
|
76
|
-
updateArgs({
|
|
77
|
-
value: evt.target.value
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
81
|
-
}`,...(rt=(lt=T.parameters)==null?void 0:lt.docs)==null?void 0:rt.source}}};var st,it,ut;L.parameters={...L.parameters,docs:{...(st=L.parameters)==null?void 0:st.docs,source:{originalSource:`args => {
|
|
82
|
-
const [_, updateArgs] = useArgs();
|
|
83
|
-
const handleChange = (evt: any) => {
|
|
84
|
-
updateArgs({
|
|
85
|
-
value: evt.target.value
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
89
|
-
}`,...(ut=(it=L.parameters)==null?void 0:it.docs)==null?void 0:ut.source}}};var ot,dt,ct;K.parameters={...K.parameters,docs:{...(ot=K.parameters)==null?void 0:ot.docs,source:{originalSource:`args => {
|
|
90
|
-
const [_, updateArgs] = useArgs();
|
|
91
|
-
const handleChange = (evt: any) => {
|
|
92
|
-
updateArgs({
|
|
93
|
-
value: evt.target.value
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
97
|
-
}`,...(ct=(dt=K.parameters)==null?void 0:dt.docs)==null?void 0:ct.source}}};var mt,pt,gt;$.parameters={...$.parameters,docs:{...(mt=$.parameters)==null?void 0:mt.docs,source:{originalSource:`args => {
|
|
98
|
-
const [_, updateArgs] = useArgs();
|
|
99
|
-
const handleChange = (evt: any) => {
|
|
100
|
-
updateArgs({
|
|
101
|
-
value: evt.target.value
|
|
102
|
-
});
|
|
103
|
-
};
|
|
104
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
105
|
-
}`,...(gt=(pt=$.parameters)==null?void 0:pt.docs)==null?void 0:gt.source}}};var ht,vt,ft;H.parameters={...H.parameters,docs:{...(ht=H.parameters)==null?void 0:ht.docs,source:{originalSource:`(args: IUnitInputProps) => {
|
|
106
|
-
const [value, setValue] = useState('123|m');
|
|
107
|
-
const [value2, setValue2] = useState('223|m');
|
|
108
|
-
const [initUnit, setInitUnit] = useState('ft');
|
|
109
|
-
return <>
|
|
110
|
-
<Button label="Change initUnit" onClick={() => setInitUnit(initUnit === 'm' ? 'ft' : 'm')} />
|
|
111
|
-
<Spacer />
|
|
112
|
-
<Button label="Change value" onClick={() => setValue(value === '123|m' ? '456|m' : '123|m')} />
|
|
113
|
-
<Spacer />
|
|
114
|
-
<UnitInput name="example" onChange={evt => {
|
|
115
|
-
setValue(evt.target.value);
|
|
116
|
-
}} unitkey="length" value={value} initUnit={initUnit} onSwitchUnit={setInitUnit} />
|
|
117
|
-
<Spacer />
|
|
118
|
-
<UnitInput name="example2" onChange={evt => {
|
|
119
|
-
setValue2(evt.target.value);
|
|
120
|
-
}} unitkey="length" value={value2} initUnit={initUnit} onSwitchUnit={setInitUnit} />
|
|
121
|
-
<Divider />
|
|
122
|
-
<h4>Without initUnit property (taken from the redux store)</h4>
|
|
123
|
-
<UnitInput name="example" onChange={evt => {
|
|
124
|
-
setValue(evt.target.value);
|
|
125
|
-
}} unitkey="length" value={value} onSwitchUnit={setInitUnit} />
|
|
126
|
-
<UnitInput name="example2" onChange={evt => {
|
|
127
|
-
setValue2(evt.target.value);
|
|
128
|
-
}} unitkey="length" value={value2} onSwitchUnit={setInitUnit} />
|
|
129
|
-
</>;
|
|
130
|
-
}`,...(ft=(vt=H.parameters)==null?void 0:vt.docs)==null?void 0:ft.source}}};var Ct,bt,yt;z.parameters={...z.parameters,docs:{...(Ct=z.parameters)==null?void 0:Ct.docs,source:{originalSource:`args => {
|
|
131
|
-
const [_, updateArgs] = useArgs();
|
|
132
|
-
const handleChange = (evt: any) => {
|
|
133
|
-
updateArgs({
|
|
134
|
-
value: evt.target.value
|
|
135
|
-
});
|
|
136
|
-
};
|
|
137
|
-
return <UnitInput {...args} onChange={handleChange} />;
|
|
138
|
-
}`,...(yt=(bt=z.parameters)==null?void 0:bt.docs)==null?void 0:yt.source}}};var Ut,xt,Vt;J.parameters={...J.parameters,docs:{...(Ut=J.parameters)==null?void 0:Ut.docs,source:{originalSource:`() => {
|
|
139
|
-
const width = '500px';
|
|
140
|
-
const [value, setValue] = useState<any>(undefined);
|
|
141
|
-
return <>
|
|
142
|
-
<h4>Different edge cases such as +/- infinity, undefined, NaN, null:</h4>
|
|
143
|
-
<Row>
|
|
144
|
-
<Column width="25%">
|
|
145
|
-
<Button label="Change value infinity" onClick={() => setValue(Infinity)} />
|
|
146
|
-
<br />
|
|
147
|
-
<Button label="Change value -infinity" onClick={() => setValue(-Infinity)} />
|
|
148
|
-
<br />
|
|
149
|
-
<Button label="Change value null" onClick={() => setValue(null)} />
|
|
150
|
-
<br />
|
|
151
|
-
<Button label="Change value - undefined" onClick={() => setValue(undefined)} />
|
|
152
|
-
<br />
|
|
153
|
-
<Button label="Change value - NaN" onClick={() => setValue(NaN)} />
|
|
154
|
-
<br />
|
|
155
|
-
<Button label="Change value - nothing (empty)" onClick={() => setValue(undefined)} />
|
|
156
|
-
<br />
|
|
157
|
-
<Button label="Change value - empty string" onClick={() => setValue('')} />
|
|
158
|
-
</Column>
|
|
159
|
-
<Column width="25%">
|
|
160
|
-
<Button label="Change value infinity|m" onClick={() => setValue(Infinity + '|m')} />
|
|
161
|
-
<br />
|
|
162
|
-
<Button label="Change value -infinity|m" onClick={() => setValue(-Infinity + '|m')} />
|
|
163
|
-
<br />
|
|
164
|
-
<Button label="Change value null|m" onClick={() => setValue(null + '|m')} />
|
|
165
|
-
<br />
|
|
166
|
-
<Button label="Change value - undefined|m" onClick={() => setValue(undefined + '|m')} />
|
|
167
|
-
<br />
|
|
168
|
-
<Button label="Change value - NaN|m" onClick={() => setValue(NaN + '|m')} />
|
|
169
|
-
<br />
|
|
170
|
-
<Button label="Change value - nothing (empty)|m" onClick={() => setValue('|m')} />
|
|
171
|
-
</Column>
|
|
172
|
-
</Row>
|
|
173
|
-
<br />
|
|
174
|
-
<Field label="Normal PUI">
|
|
175
|
-
<UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} placeholder="value|unit" />
|
|
176
|
-
</Field>
|
|
177
|
-
<Field label="Disabled validation">
|
|
178
|
-
<UnitInput name="example2" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" disabledValidation width={width} />
|
|
179
|
-
</Field>
|
|
180
|
-
<Field label="Disabled validation and manual error">
|
|
181
|
-
<UnitInput name="example3" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" error="test" disabledValidation width={width} />
|
|
182
|
-
</Field>
|
|
183
|
-
<Message message={{
|
|
184
|
-
heading: 'Current value inside PUI: ' + value,
|
|
185
|
-
visible: true
|
|
186
|
-
}} />
|
|
187
|
-
</>;
|
|
188
|
-
}`,...(Vt=(xt=J.parameters)==null?void 0:xt.docs)==null?void 0:Vt.source}}};var It,jt,kt;te.parameters={...te.parameters,docs:{...(It=te.parameters)==null?void 0:It.docs,source:{originalSource:`() => {
|
|
189
|
-
const width = '500px';
|
|
190
|
-
const [value, setValue] = useState<string>('1|m');
|
|
191
|
-
const [valueB, setValueB] = useState('|m');
|
|
192
|
-
const automaticValue = '123|km';
|
|
193
|
-
return <>
|
|
194
|
-
<h4>Different cases for automatic (placeholder) values:</h4>
|
|
195
|
-
<Row>
|
|
196
|
-
<Column width="25%">
|
|
197
|
-
<Button label="Change value to ''" onClick={() => setValue('')} />
|
|
198
|
-
<br />
|
|
199
|
-
<Button label="Change value to 1" onClick={() => setValue('1')} />
|
|
200
|
-
<br />
|
|
201
|
-
<Button label="Change value to 1|m" onClick={() => setValue('1|m')} />
|
|
202
|
-
<br />
|
|
203
|
-
<Button label="Change value to |m - empty value" onClick={() => setValue('|m')} />
|
|
204
|
-
</Column>
|
|
205
|
-
</Row>
|
|
206
|
-
<br />
|
|
207
|
-
<Field label="Normal PUI (placeholder + auto)">
|
|
208
|
-
<UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} placeholder="value|unit" autoValue={automaticValue} />
|
|
209
|
-
</Field>
|
|
210
|
-
<Field label="Normal PUI (only auto)">
|
|
211
|
-
<UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} autoValue={automaticValue} />
|
|
212
|
-
</Field>
|
|
213
|
-
<Field label="Empty PUI with autoValue">
|
|
214
|
-
<UnitInput name="example1" onChange={evt => setValueB(evt.target.value)} value={valueB} unitkey="length" width={width} autoValue={automaticValue} />
|
|
215
|
-
</Field>
|
|
216
|
-
<Field label="Normal PUI (only placeholder)">
|
|
217
|
-
<UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} placeholder="Placeholder test" />
|
|
218
|
-
</Field>
|
|
219
|
-
<Field label="Normal PUI (placeholder + allowEmpty)">
|
|
220
|
-
<UnitInput name="example1" onChange={evt => setValue(evt.target.value)} value={value} unitkey="length" width={width} placeholder="Placeholder test" allowEmpty />
|
|
221
|
-
</Field>
|
|
222
|
-
<Message message={{
|
|
223
|
-
heading: 'Current value inside PUI: ' + value,
|
|
224
|
-
visible: true
|
|
225
|
-
}} />
|
|
226
|
-
</>;
|
|
227
|
-
}`,...(kt=(jt=te.parameters)==null?void 0:jt.docs)==null?void 0:kt.source}}};var St,wt,Et;ne.parameters={...ne.parameters,docs:{...(St=ne.parameters)==null?void 0:St.docs,source:{originalSource:`() => {
|
|
228
|
-
const [value, setValue] = useState('123|%');
|
|
229
|
-
const [validation, setValidation] = useState<string | null>(null);
|
|
230
|
-
const predictedMessage = 'This should be visible when an error appears';
|
|
231
|
-
const handleValidation = (name: string, message: string | null) => {
|
|
232
|
-
setValidation(message);
|
|
233
|
-
return {
|
|
234
|
-
name,
|
|
235
|
-
error: message
|
|
236
|
-
};
|
|
237
|
-
};
|
|
238
|
-
return <>
|
|
239
|
-
<h4>3rd party validation message when inputting invalid value:</h4>
|
|
240
|
-
<UnitInput name="example" onChange={evt => setValue(evt.target.value)} error={!validation || predictedMessage} validationCallback={handleValidation} value={value} />
|
|
241
|
-
<br />
|
|
242
|
-
<Spacer />
|
|
243
|
-
<h4>Original validation message: </h4>
|
|
244
|
-
<Message message={{
|
|
245
|
-
heading: validation,
|
|
246
|
-
visible: true
|
|
247
|
-
}} />
|
|
248
|
-
</>;
|
|
249
|
-
}`,...(Et=(wt=ne.parameters)==null?void 0:wt.docs)==null?void 0:Et.source}}};var Nt,At,Pt;ae.parameters={...ae.parameters,docs:{...(Nt=ae.parameters)==null?void 0:Nt.docs,source:{originalSource:`() => {
|
|
250
|
-
const [value, setValue] = useState('123|m');
|
|
251
|
-
const [placeholder, setPlaceholder] = useState('');
|
|
252
|
-
const [initUnit, setInitUnit] = useState('km');
|
|
253
|
-
const setPlaceholderValue = () => {
|
|
254
|
-
setInitUnit('ft');
|
|
255
|
-
setPlaceholder('placeholder');
|
|
256
|
-
setValue('|m');
|
|
257
|
-
};
|
|
258
|
-
return <>
|
|
259
|
-
<h4>Empty value case:</h4>
|
|
260
|
-
<UnitInput name="example" onChange={evt => setValue(evt.target.value)} value={value} allowEmpty placeholder={placeholder} initUnit={initUnit} unitkey="length" />
|
|
261
|
-
<br />
|
|
262
|
-
<Spacer />
|
|
263
|
-
<Button label="Change value |m and unit ft" onClick={() => setPlaceholderValue()} />
|
|
264
|
-
</>;
|
|
265
|
-
}`,...(Pt=(At=ae.parameters)==null?void 0:At.docs)==null?void 0:Pt.source}}};const Xn=["Default","InitUnit","notKnownUnit","Width","NoConversion","Small","Error","InternalValidationError","Disabled","DisabledNoConversion","DisabledUnitWithoutUnitKey","DisabledUnitWithUnitKey","DisabledWithEnabledUnitMenu","TestExternalStateChangeWithSynchronizedUnits","PredefinedOptionsMenu","TestEdgeCases","AutomaticValues","ValidationCallback","AllowEmptyPUI"];export{ae as AllowEmptyPUI,te as AutomaticValues,ee as Default,E as Disabled,T as DisabledNoConversion,K as DisabledUnitWithUnitKey,L as DisabledUnitWithoutUnitKey,$ as DisabledWithEnabledUnitMenu,W as Error,F as InitUnit,R as InternalValidationError,B as NoConversion,z as PredefinedOptionsMenu,q as Small,J as TestEdgeCases,H as TestExternalStateChangeWithSynchronizedUnits,ne as ValidationCallback,O as Width,Xn as __namedExportsOrder,Qn as default,_ as notKnownUnit};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/storybook/assets/{option-dropdown.stories-ddc96b15.css → option-dropdown-ddc96b15.css}
RENAMED
|
File without changes
|
/package/dist/storybook/assets/{pop-confirm.stories-c9faec6b.css → pop-confirm-c9faec6b.css}
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/storybook/assets/{rich-text-input.stories-023a1c99.css → rich-text-input-023a1c99.css}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|