@oliasoft-open-source/react-ui-library 4.4.8 → 4.5.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.d.ts +55 -0
- package/dist/index.js +209 -8
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-6VNJS4EI-mlGeGy0N.js → Color-6VNJS4EI-OKUPsN5g.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-NNNQARDV-FLE8MQVp.js → DocsRenderer-NNNQARDV-GtO0h5cy.js} +1 -1
- package/dist/storybook/assets/{WithTooltip-4HIR6TLV-gwf45DIV.js → WithTooltip-4HIR6TLV-oJGDwI7F.js} +1 -1
- package/dist/storybook/assets/accordion-with-default-toggle-8PUIm8jP.js +1 -0
- package/dist/storybook/assets/accordion.stories-xUgAzm87.js +170 -0
- package/dist/storybook/assets/{afe.stories-u2K3NwaR.js → afe.stories-fh4-T0m2.js} +1 -1
- package/dist/storybook/assets/breadcrumb-WFZ7OoC2.js +1 -0
- package/dist/storybook/assets/breadcrumb.stories-mou0ppaX.js +1 -0
- package/dist/storybook/assets/{button.stories-f6VcbEgi.js → button.stories-PhWmZXOu.js} +1 -1
- package/dist/storybook/assets/{buttons-and-links-t1EEC4gc.js → buttons-and-links-mIhXkKfh.js} +2 -2
- package/dist/storybook/assets/{casing-loads.stories-ee6r2j2Q.js → casing-loads.stories-i9Kyuvs1.js} +1 -1
- package/dist/storybook/assets/{cell.stories-y081eSUk.js → cell.stories-QHDggPeA.js} +1 -1
- package/dist/storybook/assets/{chunk-HLWAVYOI-53hWDdvc.js → chunk-HLWAVYOI-YpA4-WPj.js} +1 -1
- package/dist/storybook/assets/{color-LlgCLGE5.js → color-0ogqq8EH.js} +1 -1
- package/dist/storybook/assets/{drawer.stories-ezk4vO0w.js → drawer.stories-BLdyJ3NA.js} +1 -1
- package/dist/storybook/assets/empty-PU0JdhZM.js +1 -0
- package/dist/storybook/assets/empty.stories-FYO6syUx.js +1 -0
- package/dist/storybook/assets/file-input-7-7kYhsS.js +1 -0
- package/dist/storybook/assets/file-input.stories-lW0gLK14.js +66 -0
- package/dist/storybook/assets/{flex-3eLDDUyy.js → flex-RYZsoWEN.js} +1 -1
- package/dist/storybook/assets/{flex.stories-_VBDAVzN.js → flex.stories-lLz0Xrt_.js} +1 -1
- package/dist/storybook/assets/{footer.stories-m5VFK6Bo.js → footer.stories-guoNYzr9.js} +1 -1
- package/dist/storybook/assets/{form.stories-z3f6tVdU.js → form.stories-tzZoKyyL.js} +1 -1
- package/dist/storybook/assets/{formatter-SWP5E3XI-TLomX0jS.js → formatter-SWP5E3XI-Z60pYM_f.js} +1 -1
- package/dist/storybook/assets/{preview-QdB_aBj_.css → global-M-3dCKk3.css} +1 -1
- package/dist/storybook/assets/{heading.stories-DmZLaZJb.js → heading.stories-HLMPkIPo.js} +1 -1
- package/dist/storybook/assets/{icon.stories-h0hheUmg.js → icon.stories-W-UgTWyK.js} +1 -1
- package/dist/storybook/assets/iframe-ybuSzuG4.js +7 -0
- package/dist/storybook/assets/{index-0dxTfrBP.js → index-isA0pQQP.js} +5 -5
- package/dist/storybook/assets/{input-validation-jCRmk_jl.js → input-validation-lBeNJX0o.js} +1 -1
- package/dist/storybook/assets/{inputs-ZpY3-Ny4.js → inputs-bYS5qR_g.js} +14 -14
- package/dist/storybook/assets/{layout-forms-tcQfdK2L.js → layout-forms-S1UZag29.js} +1 -1
- package/dist/storybook/assets/{layout-general-bz1oHjNF.js → layout-general-U3YRmnqR.js} +1 -1
- package/dist/storybook/assets/{list-8l-RGDgw.js → list-dAlCO11z.js} +1 -1
- package/dist/storybook/assets/{list.stories-uR6izjvO.js → list.stories-bt_cumRX.js} +1 -1
- package/dist/storybook/assets/{list.stories-data-9RrIjRci.js → list.stories-data-IcFu6vvd.js} +1 -1
- package/dist/storybook/assets/{menu.stories-5G4phywO.js → menu.stories-VwRF_Pbx.js} +1 -1
- package/dist/storybook/assets/{menu.stories-data-l5rlcD9_.js → menu.stories-data-hEz8P1yK.js} +1 -1
- package/dist/storybook/assets/{message-uMHaTEXV.js → message-yii7x6Na.js} +1 -1
- package/dist/storybook/assets/{message.stories-CDgUaLZP.js → message.stories-9RWD3-p1.js} +1 -1
- package/dist/storybook/assets/meta-content-2S9BpSoX.js +1 -0
- package/dist/storybook/assets/modal-BJKGBCkS.css +1 -0
- package/dist/storybook/assets/modal-Dr5HffrG.js +1 -0
- package/dist/storybook/assets/{modal.stories-15sY1c5H.js → modal.stories-rVfow_s3.js} +1 -1
- package/dist/storybook/assets/option-dropdown-6QvoS02o.js +1 -0
- package/dist/storybook/assets/option-dropdown.stories-5qw-N2Q9.js +21 -0
- package/dist/storybook/assets/{padding-and-spacing-dSuzf2dz.js → padding-and-spacing-Ej5fu8GG.js} +1 -1
- package/dist/storybook/assets/page.stories-4zM8wrxN.js +57 -0
- package/dist/storybook/assets/pop-confirm-nfz5S-f-.js +1 -0
- package/dist/storybook/assets/pop-confirm.stories-1vIAhdl-.js +9 -0
- package/dist/storybook/assets/{popover.stories-bWBLR9fB.js → popover.stories-b7Tt4S0j.js} +1 -1
- package/dist/storybook/assets/{preview-8q_cpMjL.js → preview-8d3sl769.js} +2 -2
- package/dist/storybook/assets/{preview-xbxc--KY.js → preview-UZXZGus9.js} +3 -3
- package/dist/storybook/assets/preview-agc3Xxfb.css +1 -0
- package/dist/storybook/assets/print-header-mVYWFles.js +1 -0
- package/dist/storybook/assets/{projects.stories-84p22lkF.js → projects.stories-bo3cPOP-.js} +1 -1
- package/dist/storybook/assets/{reservoirs.stories-CtIlcj-X.js → reservoirs.stories-RUFcw2h6.js} +1 -1
- package/dist/storybook/assets/{rich-text-input.stories-7UzvJ-A1.js → rich-text-input-W-kYpvgO.js} +52 -127
- package/dist/storybook/assets/rich-text-input.stories-6-587T_0.js +76 -0
- package/dist/storybook/assets/{row.stories-uPD-qTX2.js → row.stories-TurDc49t.js} +1 -1
- package/dist/storybook/assets/{side-bar.stories-0_pud_bN.js → side-bar.stories-sxBJCVnV.js} +1 -1
- package/dist/storybook/assets/{site.stories-UH3PK5eu.js → site.stories-Hnwa5Rxk.js} +1 -1
- package/dist/storybook/assets/{spacer.stories-bgTBb3VB.js → spacer.stories-eCrKj4b3.js} +1 -1
- package/dist/storybook/assets/{syntaxhighlighter-NMPM6SWI-1xSal2rv.js → syntaxhighlighter-NMPM6SWI-LVCFR00p.js} +1 -1
- package/dist/storybook/assets/{table.stories-GrJ75DyI.js → table.stories-TGOwb9FU.js} +1 -1
- package/dist/storybook/assets/{table.stories-data-9XfBJddg.js → table.stories-data-txTr9mYv.js} +1 -1
- package/dist/storybook/assets/text-link-1uKYQqn_.js +1 -0
- package/dist/storybook/assets/text-link.stories-ZcuOY5VK.js +1 -0
- package/dist/storybook/assets/{textarea-u-nirfI6.js → textarea-8bcldTyf.js} +1 -1
- package/dist/storybook/assets/{textarea.stories-Hl-oeUWU.js → textarea.stories-D9SctTMD.js} +1 -1
- package/dist/storybook/assets/{title.stories-RyQ9x-ug.js → title.stories-InoCrXr8.js} +1 -1
- package/dist/storybook/assets/{toaster-eOozfa7U.js → toaster-2HasMRmP.js} +1 -1
- package/dist/storybook/assets/{toaster.stories--z_U2gRN.js → toaster.stories-NBYloz0_.js} +1 -1
- package/dist/storybook/assets/{toggle.stories-HiGs6slZ.js → toggle.stories-aVmjpons.js} +1 -1
- package/dist/storybook/assets/{tooltip.test-case.stories-3T_tzhJs.js → tooltip.test-case.stories-kIeZayHw.js} +1 -1
- package/dist/storybook/assets/tree-Rhl5ea49.js +6 -0
- package/dist/storybook/assets/tree.stories-dFH-G6se.js +123 -0
- package/dist/storybook/assets/unit-input-fxjK7nON.js +1 -0
- package/dist/storybook/assets/unit-input.stories--UApgPT-.js +273 -0
- package/dist/storybook/assets/unit-table.stories-Vd1Nqk2h.js +434 -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/404.html +0 -1
- package/dist/storybook/assets/accordion.stories-yWtLkrNK.js +0 -170
- package/dist/storybook/assets/breadcrumb.stories-V7ozYBO-.js +0 -1
- package/dist/storybook/assets/dialog-WKHRZcjc.js +0 -1
- package/dist/storybook/assets/dialog-gTGZ42G6.css +0 -1
- package/dist/storybook/assets/empty.stories-lva3DbfI.js +0 -1
- package/dist/storybook/assets/file-input.stories-6NjWeNyC.js +0 -66
- package/dist/storybook/assets/iframe-ujjJUTtn.js +0 -7
- package/dist/storybook/assets/list-heading-Vd3hu5Pf.js +0 -1
- package/dist/storybook/assets/option-dropdown.stories-Q2zd2AcS.js +0 -21
- package/dist/storybook/assets/page.stories-9XUTUblI.js +0 -57
- package/dist/storybook/assets/pop-confirm.stories-_agvSFJd.js +0 -9
- package/dist/storybook/assets/text-link.stories-kjfUeFtk.js +0 -1
- package/dist/storybook/assets/tree.stories-_5t-Rrls.js +0 -128
- package/dist/storybook/assets/unit-input.stories-u823izRm.js +0 -273
- /package/dist/storybook/assets/{accordion-tw1O4Ru6.css → accordion-with-default-toggle-tw1O4Ru6.css} +0 -0
- /package/dist/storybook/assets/{list-heading-Y8BAUuV6.css → meta-content-Y8BAUuV6.css} +0 -0
- /package/dist/storybook/assets/{page-6iak35D6.css → print-header-6iak35D6.css} +0 -0
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-FsUICBgo.js";import{r as o}from"./index-RfLt4OUa.js";import{d as r,r as rn}from"./index-IQMsp8Ab.js";import{c as sn}from"./index-VW3EWkuE.js";import{M as we}from"./actions-Z9jDWreP.js";import{I as un}from"./input-group-addon-BHVsW9mL.js";import{B as m}from"./button-7V8oA22w.js";import{T as on}from"./tooltip-HEHiU__l.js";import{I as dn}from"./input-group-R8LoqKRn.js";import{S}from"./spacer-Yji9g2AW.js";import{T as cn}from"./text-6KQ6ntOV.js";import{I as mn}from"./input-u1He-wWs.js";import{M as Ee}from"./types-VB5zD18b.js";import{l as E}from"./lodash-Bmg8FrMx.js";import{D as pn}from"./divider-RwW2f_N0.js";import{R as qt,C as pe}from"./row-vFUhHoz5.js";import{F as I}from"./field-eknsj_Ll.js";import{a as ge}from"./message-uMHaTEXV.js";import"./index-cCpkwrS5.js";import"./common-types-U65vzrrz.js";import"./disabled-context-urNQThQz.js";import"./icon-y1a2N5SZ.js";import"./inheritsLoose-Y9jOMJLd.js";import"./tslib.es6-OIsz3r9a.js";import"./index-4QtD-hFu.js";import"./types-5uVBABF4.js";import"./badge-23Ty_zBt.js";import"./spinner-R8Il4aRe.js";import"./index-miLrID2P.js";import"./styled-components.browser.esm-qIipjd6c.js";import"./label-0_Qf6I8t.js";import"./help-icon--rUDxLUD.js";const gn=()=>{const t=o.useRef(null);return o.useLayoutEffect(()=>{t.current&&(t.current(),t.current=null)}),n=>{t.current=n}},hn=t=>{const a=o.useRef();return o.useEffect(()=>{a.current=t},[t]),a.current},vn=(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.`),r.unitFromQuantity(t)??"")};var b=(t=>(t.CUSTOM="custom",t.PREDEFINED="predefined",t))(b||{});const Wt=t=>t==="undefined"||t===void 0||t===""||t==="null"||t===null||t==="NaN"||isNaN(t),Rt=(t="",a,n="",i=!1)=>{if(i)return t;if(a&&!Wt(t))try{const u=r.isValueWithUnit(t)?t:r.withUnit(t,n),d=r.convertSamePrecision(u,a);return r.getValue(d)}catch{}return t},fn=t=>t?!!r.getUnit(t):!1,F=(t="",a,n,i)=>{if(i)return t;const u=fn(t)||r.isValueWithUnit(t),d=r.getValue(t);return Wt(d)?d:u?Rt(d,a,n,i):t},Ne=t=>E.isObject(t)&&!E.isArray(t)&&!E.isFunction(t)?E.get(t,"fieldName",""):typeof t=="string"?t:"",Cn=t=>E.isObjectLike(t)&&E.has(t,"message"),bn=t=>typeof t=="string"?t:Cn(t)?t.message:null;var Un=rn();const yn=t=>t.search(RegExp(/(^0{2}\.)|(^0+[1-9])/g))===0,Ae=(t,a)=>{var j;const{allowEmpty:n=!1,autoValue:i,placeholder:u,disabledValidation:d=!1}=a||{},s=String(t);if(d||i||u)return null;const g=Un.isValueWithUnit(s)?r.getValue(s):s;if(n&&g==="")return null;if(yn(g))return"Invalid number format due to leading zeroes";const h=r.validateNumber(g);if(!h.valid){const re=((j=h==null?void 0:h.errors)==null?void 0:j[0])??null;return bn(re)}return null},Pe=(t="")=>{var a;return(a=r.KNOWN_UNITS)==null?void 0:a.includes(t)},xn=(t,a)=>{const n=r.getUnit(t||"");return Pe(a)&&Pe(n)},Vn="_predefinedMenuActive_1yvt4_1",In={predefinedMenuActive:Vn},p=({name:t,placeholder:a="",disabled:n=!1,disabledUnit:i=!1,error:u=null,left:d=!1,small:s=!1,width:g="100%",value:h,unitkey:j="",initUnit:re,noConversion:Tt=!1,onChange:se=()=>{},onClick:kn=()=>{},onFocus:Lt=()=>{},onSwitchUnit:he=()=>{},unitTemplate:ve,doNotConvertValue:A=!1,testId:w,warning:Kt=null,predefinedOptions:x,initialPredefinedOption:$t=!1,shouldLinkAutomaticly:fe=!0,selectedPredefinedOptionKey:Ce,validationCallback:be=()=>({name:"",error:null}),disabledValidation:Ue=!1,allowEmpty:ye=!1,autoValue:V})=>{typeof h=="number"&&(h=`${h}`);const Ht=gn(),[ie="",P=""]=h!==void 0?r.split(h):[],xe=V?r.getUnit(V):"",Ve=o.useMemo(()=>vn(j,ve),[j,ve]),zt=xn(h,Ve),U=re||Ve||P,Jt=hn(U),Ie=F(h,U,P,A),je=F(V,U,xe,A),Yt=Ie!==""?{value:Ie,unit:U}:je!==""?{value:je,unit:U}:{value:ie,unit:P},[v,Y]=o.useState(Yt),[Zt,ue]=o.useState(null),[k,oe]=o.useState($t?b.PREDEFINED:b.CUSTOM),de=ie===""&&V,D=x&&x.find(l=>{if(Ce)return Ce===l.valueKey;const c=r.isValueWithUnit(l.value)?r.getUnit(l.value):"";return r.withUnit(Rt(h,c),c)===l.value}),Gt=()=>{if(j)try{const l=de?V:h??"";let c=r.altUnitsList(l,j);return r.getValue(l)===""?c.map(f=>["",f[1]]):c}catch{return null}},Qt=l=>{const c=Ne(t),f=l.target,{value:y,selectionStart:X}=f,Se=r.cleanNumStr(y.replaceAll(" ","").replaceAll("|","")),ce=r.withUnit(Se,(v==null?void 0:v.unit)||""),nn=r.getValue(ce),me=Ae(nn,{allowEmpty:ye,autoValue:V,placeholder:a,disabledValidation:Ue});if(me===null){se({target:{value:ce,name:c}});const[an,ln]=r.split(ce);Y({value:an,unit:ln}),ue(null),be(c,null)}else Y({value:Se,unit:v.unit}),ue(me),be(c,me);Ht(()=>{f.selectionStart=X,f.selectionEnd=X})},Xt=(l,c)=>{c===v.unit||isNaN(Number(l))||(Y({value:l,unit:c}),he&&he(c))};o.useEffect(()=>{if(U){let f,y="";Jt!==U?(f=F(h,U,P,A),y=U):r.withUnit(v.value,v.unit)!==h&&(f=F(h,v.unit,P,A),y=v.unit),f!==void 0&&Y({value:f,unit:y}),x&&oe(D&&fe?b.PREDEFINED:b.CUSTOM)}const l=r.checkAndCleanDecimalComma(ie),c=Ae(l,{allowEmpty:ye,autoValue:V,placeholder:a,disabledValidation:Ue});ue(c)},[U,h,u,fe]);const Z=Gt(),G=r.label(v.unit)||v.unit||"",en=Tt||!Z||Z&&Z.length===1,ke=Ne(t);let Q;const tn=l=>{const[c,f=""]=r.isValueWithUnit(l.value)?r.split(l.value):[l.value];return{type:Ee.OPTION,inline:!0,onClick:()=>{r.validateNumber(c).valid&&!n&&(oe(b.PREDEFINED),se({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(cn,{children:l.label}),e.jsx(S,{width:"20px",height:"0"})]}),description:r.isValueWithUnit(l.value)?`${c} ${f}`:l.value,selected:D===l&&k===b.PREDEFINED}};if(Q=[{type:Ee.OPTION,inline:!0,onClick:()=>{k!==b.CUSTOM&&!n&&se({target:{value:r.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(tn);Q=[...Q,...l]}return e.jsx("div",{className:k===b.PREDEFINED?sn(In.predefinedMenuActive):"",children:e.jsxs(dn,{small:s,width:g,children:[x&&e.jsx(on,{text:k===b.PREDEFINED?D==null?void 0:D.label:"",children:e.jsx(we,{maxHeight:380,groupOrder:"first",testId:w&&`${w}-predefined-menu`,disabled:n,menu:{colored:!0,trigger:"Component",component:e.jsx(m,{groupOrder:"first",active:k===b.PREDEFINED,icon:k===b.PREDEFINED?"link":"unlink"}),small:s,sections:Q}})}),e.jsx(mn,{type:"text",name:ke,testId:w,disabled:n,placeholder:de?F(V,v.unit,xe,A):a,value:v.value,onChange:Qt,onFocus:Lt,error:u||Zt,warning:Kt,right:!d},ke),G&&(en||!zt?e.jsx(un,{groupOrder:"last",children:G}):e.jsx(we,{maxHeight:380,groupOrder:"last",disabled:i,testId:w&&`${w}-menu`,menu:{label:G,trigger:"DropDownButton",small:s,sections:Z.map(([l,c,f])=>{const y=f||c||"";return{type:"Option",label:isNaN(Number(l))?"":l,inline:!0,onClick:X=>{X.stopPropagation(),Xt(de?"":l,c)},description:y,selected:y===G,testId:`${w}-unit-${y}`}})}}))]})})};try{p.displayName="UnitInput",p.__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:jn}=__STORYBOOK_MODULE_ADDONS__,ra={title:"Basic/UnitInput",component:p,args:{name:"example",unitkey:"length",value:"123|m"}},C=t=>{const[a,n]=jn(),i=u=>{n({value:u.target.value})};return e.jsx(p,{...t,onChange:i})},ee=C.bind({}),M=C.bind({});M.args={initUnit:"ft",unitTemplate:{length:"ft"}};const _=C.bind({});_.args={value:'123|"',unitkey:'"'};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 N=C.bind({});N.args={disabled:!0,disabledUnit:!0};N.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]=o.useState("123|m"),[i,u]=o.useState("223|m"),[d,s]=o.useState("ft");return e.jsxs(e.Fragment,{children:[e.jsx(m,{label:"Change initUnit",onClick:()=>s(d==="m"?"ft":"m")}),e.jsx(S,{}),e.jsx(m,{label:"Change value",onClick:()=>n(a==="123|m"?"456|m":"123|m")}),e.jsx(S,{}),e.jsx(p,{name:"example",onChange:g=>{n(g.target.value)},unitkey:"length",value:a,initUnit:d,onSwitchUnit:s}),e.jsx(S,{}),e.jsx(p,{name:"example2",onChange:g=>{u(g.target.value)},unitkey:"length",value:i,initUnit:d,onSwitchUnit:s}),e.jsx(pn,{}),e.jsx("h4",{children:"Without initUnit property (taken from the redux store)"}),e.jsx(p,{name:"example",onChange:g=>{n(g.target.value)},unitkey:"length",value:a,onSwitchUnit:s}),e.jsx(p,{name:"example2",onChange:g=>{u(g.target.value)},unitkey:"length",value:i,onSwitchUnit:s})]})};H.parameters={docs:{description:{story:"[OW-4380](https://oliasoft.atlassian.net/browse/OW-4380?atlOrigin=eyJpIjoiMmM1N2RkNWU3Mjk5NDYxY2E0YzhkMzk5ZTVmZTJhMjciLCJwIjoiaiJ9)"}}};const 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]=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(qt,{children:[e.jsxs(pe,{width:"25%",children:[e.jsx(m,{label:"Change value infinity",onClick:()=>n(1/0)}),e.jsx("br",{}),e.jsx(m,{label:"Change value -infinity",onClick:()=>n(-1/0)}),e.jsx("br",{}),e.jsx(m,{label:"Change value null",onClick:()=>n(null)}),e.jsx("br",{}),e.jsx(m,{label:"Change value - undefined",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(m,{label:"Change value - NaN",onClick:()=>n(NaN)}),e.jsx("br",{}),e.jsx(m,{label:"Change value - nothing (empty)",onClick:()=>n(void 0)}),e.jsx("br",{}),e.jsx(m,{label:"Change value - empty string",onClick:()=>n("")})]}),e.jsxs(pe,{width:"25%",children:[e.jsx(m,{label:"Change value infinity|m",onClick:()=>n("Infinity|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value -infinity|m",onClick:()=>n("-Infinity|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value null|m",onClick:()=>n("null|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value - undefined|m",onClick:()=>n("undefined|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value - NaN|m",onClick:()=>n("NaN|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value - nothing (empty)|m",onClick:()=>n("|m")})]})]}),e.jsx("br",{}),e.jsx(I,{label:"Normal PUI",children:e.jsx(p,{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(p,{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(p,{name:"example3",onChange:i=>n(i.target.value),value:a,unitkey:"length",error:"test",disabledValidation:!0,width:t})}),e.jsx(ge,{message:{heading:"Current value inside PUI: "+a,visible:!0}})]})},te=()=>{const t="500px",[a,n]=o.useState("1|m"),[i,u]=o.useState("|m"),d="123|km";return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Different cases for automatic (placeholder) values:"}),e.jsx(qt,{children:e.jsxs(pe,{width:"25%",children:[e.jsx(m,{label:"Change value to ''",onClick:()=>n("")}),e.jsx("br",{}),e.jsx(m,{label:"Change value to 1",onClick:()=>n("1")}),e.jsx("br",{}),e.jsx(m,{label:"Change value to 1|m",onClick:()=>n("1|m")}),e.jsx("br",{}),e.jsx(m,{label:"Change value to |m - empty value",onClick:()=>n("|m")})]})}),e.jsx("br",{}),e.jsx(I,{label:"Normal PUI (placeholder + auto)",children:e.jsx(p,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"value|unit",autoValue:d})}),e.jsx(I,{label:"Normal PUI (only auto)",children:e.jsx(p,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,autoValue:d})}),e.jsx(I,{label:"Empty PUI with autoValue",children:e.jsx(p,{name:"example1",onChange:s=>u(s.target.value),value:i,unitkey:"length",width:t,autoValue:d})}),e.jsx(I,{label:"Normal PUI (only placeholder)",children:e.jsx(p,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test"})}),e.jsx(I,{label:"Normal PUI (placeholder + allowEmpty)",children:e.jsx(p,{name:"example1",onChange:s=>n(s.target.value),value:a,unitkey:"length",width:t,placeholder:"Placeholder test",allowEmpty:!0})}),e.jsx(ge,{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]=o.useState("123|%"),[n,i]=o.useState(null),u="This should be visible when an error appears",d=(s,g)=>(i(g),{name:s,error:g});return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"3rd party validation message when inputting invalid value:"}),e.jsx(p,{name:"example",onChange:s=>a(s.target.value),error:!n||u,validationCallback:d,value:t}),e.jsx("br",{}),e.jsx(S,{}),e.jsx("h4",{children:"Original validation message: "}),e.jsx(ge,{message:{heading:n,visible:!0}})]})},ae=()=>{const[t,a]=o.useState("123|m"),[n,i]=o.useState(""),[u,d]=o.useState("km"),s=()=>{d("ft"),i("placeholder"),a("|m")};return e.jsxs(e.Fragment,{children:[e.jsx("h4",{children:"Empty value case:"}),e.jsx(p,{name:"example",onChange:g=>a(g.target.value),value:t,allowEmpty:!0,placeholder:n,initUnit:u,unitkey:"length"}),e.jsx("br",{}),e.jsx(S,{}),e.jsx(m,{label:"Change value |m and unit ft",onClick:()=>s()})]})},le=()=>{const[t,a]=o.useState("123|m"),[n,i]=o.useState("m");return e.jsxs(e.Fragment,{children:[e.jsx(p,{name:"example",onChange:u=>a(u.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:i}),e.jsx(S,{}),e.jsx(p,{name:"example",onChange:u=>a(u.target.value),value:t,initUnit:n,unitkey:"length",onSwitchUnit:i})]})};var De,Fe,Me;ee.parameters={...ee.parameters,docs:{...(De=ee.parameters)==null?void 0:De.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
|
-
}`,...(Me=(Fe=ee.parameters)==null?void 0:Fe.docs)==null?void 0:Me.source}}};var _e,Oe,Be;M.parameters={...M.parameters,docs:{...(_e=M.parameters)==null?void 0:_e.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
|
-
}`,...(Be=(Oe=M.parameters)==null?void 0:Oe.docs)==null?void 0:Be.source}}};var qe,We,Re;_.parameters={..._.parameters,docs:{...(qe=_.parameters)==null?void 0:qe.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
|
-
}`,...(Re=(We=_.parameters)==null?void 0:We.docs)==null?void 0:Re.source}}};var Te,Le,Ke;O.parameters={...O.parameters,docs:{...(Te=O.parameters)==null?void 0:Te.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
|
-
}`,...(Ke=(Le=O.parameters)==null?void 0:Le.docs)==null?void 0:Ke.source}}};var $e,He,ze;B.parameters={...B.parameters,docs:{...($e=B.parameters)==null?void 0:$e.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
|
-
}`,...(ze=(He=B.parameters)==null?void 0:He.docs)==null?void 0:ze.source}}};var Je,Ye,Ze;q.parameters={...q.parameters,docs:{...(Je=q.parameters)==null?void 0:Je.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=(Ye=q.parameters)==null?void 0:Ye.docs)==null?void 0:Ze.source}}};var Ge,Qe,Xe;W.parameters={...W.parameters,docs:{...(Ge=W.parameters)==null?void 0:Ge.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
|
-
}`,...(Xe=(Qe=W.parameters)==null?void 0:Qe.docs)==null?void 0:Xe.source}}};var et,tt,nt;R.parameters={...R.parameters,docs:{...(et=R.parameters)==null?void 0:et.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
|
-
}`,...(nt=(tt=R.parameters)==null?void 0:tt.docs)==null?void 0:nt.source}}};var at,lt,rt;N.parameters={...N.parameters,docs:{...(at=N.parameters)==null?void 0:at.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
|
-
}`,...(rt=(lt=N.parameters)==null?void 0:lt.docs)==null?void 0:rt.source}}};var st,it,ut;T.parameters={...T.parameters,docs:{...(st=T.parameters)==null?void 0:st.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
|
-
}`,...(ut=(it=T.parameters)==null?void 0:it.docs)==null?void 0:ut.source}}};var ot,dt,ct;L.parameters={...L.parameters,docs:{...(ot=L.parameters)==null?void 0:ot.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
|
-
}`,...(ct=(dt=L.parameters)==null?void 0:dt.docs)==null?void 0:ct.source}}};var mt,pt,gt;K.parameters={...K.parameters,docs:{...(mt=K.parameters)==null?void 0:mt.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
|
-
}`,...(gt=(pt=K.parameters)==null?void 0:pt.docs)==null?void 0:gt.source}}};var ht,vt,ft;$.parameters={...$.parameters,docs:{...(ht=$.parameters)==null?void 0:ht.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
|
-
}`,...(ft=(vt=$.parameters)==null?void 0:vt.docs)==null?void 0:ft.source}}};var Ct,bt,Ut;H.parameters={...H.parameters,docs:{...(Ct=H.parameters)==null?void 0:Ct.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
|
-
}`,...(Ut=(bt=H.parameters)==null?void 0:bt.docs)==null?void 0:Ut.source}}};var yt,xt,Vt;z.parameters={...z.parameters,docs:{...(yt=z.parameters)==null?void 0:yt.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
|
-
}`,...(Vt=(xt=z.parameters)==null?void 0:xt.docs)==null?void 0:Vt.source}}};var It,jt,kt;J.parameters={...J.parameters,docs:{...(It=J.parameters)==null?void 0:It.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
|
-
}`,...(kt=(jt=J.parameters)==null?void 0:jt.docs)==null?void 0:kt.source}}};var St,wt,Et;te.parameters={...te.parameters,docs:{...(St=te.parameters)==null?void 0:St.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
|
-
}`,...(Et=(wt=te.parameters)==null?void 0:wt.docs)==null?void 0:Et.source}}};var Nt,At,Pt;ne.parameters={...ne.parameters,docs:{...(Nt=ne.parameters)==null?void 0:Nt.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
|
-
}`,...(Pt=(At=ne.parameters)==null?void 0:At.docs)==null?void 0:Pt.source}}};var Dt,Ft,Mt;ae.parameters={...ae.parameters,docs:{...(Dt=ae.parameters)==null?void 0:Dt.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
|
-
}`,...(Mt=(Ft=ae.parameters)==null?void 0:Ft.docs)==null?void 0:Mt.source}}};var _t,Ot,Bt;le.parameters={...le.parameters,docs:{...(_t=le.parameters)==null?void 0:_t.docs,source:{originalSource:`() => {
|
|
266
|
-
const [value, setValue] = useState('123|m');
|
|
267
|
-
const [unit, setUnit] = useState('m');
|
|
268
|
-
return <>
|
|
269
|
-
<UnitInput name="example" onChange={evt => setValue(evt.target.value)} value={value} initUnit={unit} unitkey="length" onSwitchUnit={setUnit} />
|
|
270
|
-
<Spacer />
|
|
271
|
-
<UnitInput name="example" onChange={evt => setValue(evt.target.value)} value={value} initUnit={unit} unitkey="length" onSwitchUnit={setUnit} />
|
|
272
|
-
</>;
|
|
273
|
-
}`,...(Bt=(Ot=le.parameters)==null?void 0:Ot.docs)==null?void 0:Bt.source}}};const sa=["Default","InitUnit","notKnownUnit","Width","NoConversion","Small","Error","InternalValidationError","Disabled","DisabledNoConversion","DisabledUnitWithoutUnitKey","DisabledUnitWithUnitKey","DisabledWithEnabledUnitMenu","TestExternalStateChangeWithSynchronizedUnits","PredefinedOptionsMenu","TestEdgeCases","AutomaticValues","ValidationCallback","AllowEmptyPUI","onSwitchUnit"];export{ae as AllowEmptyPUI,te as AutomaticValues,ee as Default,N as Disabled,T as DisabledNoConversion,K as DisabledUnitWithUnitKey,L as DisabledUnitWithoutUnitKey,$ as DisabledWithEnabledUnitMenu,W as Error,M 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,sa as __namedExportsOrder,ra as default,_ as notKnownUnit,le as onSwitchUnit};
|
/package/dist/storybook/assets/{accordion-tw1O4Ru6.css → accordion-with-default-toggle-tw1O4Ru6.css}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|