amotify 0.2.269 → 0.2.270

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.
@@ -1,3 +1,3 @@
1
- import{b as n,c as s,d as te,e as ue}from"../../chunk-C5N2D3ZX.js";import{Fragment as fe,jsx as u,jsxs as q}from"react/jsx-runtime";import g,{UUID as y,useStore as ce}from"jmini";import{useState as pe,useEffect as ae}from"react";import{$$fromRoot as Fe,ExtractStyles as Ne}from"../../@utils";import{Box as N,FAI as ke}from"../../atoms";import{Literal as ie}from"../../mols";import{Tips as me,Button as De}from"..";import{faEye as Ee}from"@fortawesome/free-solid-svg-icons/faEye";import{OptionalInputWrapper as He,BoxWrapper as Ae,CoreEffects as P,DefaultBoxishStyles as Le}from"./core";import{InputLabel as Be}from"./Label";import{LeftIcon as Me,RightIcon as de}from".";const _e={katakana:{reg:/^[ァ-ヶー  ヲ-゚  ]*$/g,exist:!0,reason:"\u30AB\u30BF\u30AB\u30CA\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},"hankaku.katakana":{reg:/^[ヲ-゚  ]*$/g,exist:!0,reason:"\u534A\u89D2\u30AB\u30BF\u30AB\u30CA\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},number:{reg:/^-?[0-9\.]{0,}[0-9]{1,}$/g,exist:!0,reason:"\u534A\u89D2\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},digitNumber:{reg:/^-?[0-9\,\.]{0,}[0-9]{1,}$/g,exist:!0,reason:"\u534A\u89D2\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},fileName:{reg:/[¥\/:*\?\"\'\|\.\s\n\r\<\>]/g,exist:!1,reason:"\u7A7A\u767D\u307E\u305F\u306F\u4E00\u90E8\u306E\u7279\u6B8A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093"},creditCard:{reg:/^\d{14,16}$/g,exist:!0,reason:"14~16\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},email:{reg:/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]+\.[A-Za-z0-9]+$/,exist:!0,reason:q(fe,{children:[u(N,{children:"\u25CB\u25CB\u25CB\u25CB@\u25CB\u25CB\u25CB\u25CB.\u25CB\u25CB\u25CB\u306E\u5F62\u5F0F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),u(N,{children:"\u6700\u5F8C\u306E\u6587\u5B57\u306B.(\u30C9\u30C3\u30C8)\u3092\u5165\u308C\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"})]})},password:{reg:/^(?=[^A-Z]*[A-Z])(?=[^a-z]*[a-z])(?=[^0-9]*[0-9]).{8,}$/,exist:!0,reason:"8\u6587\u5B57\u4EE5\u4E0A\u3001\u534A\u89D2\u82F1\u6570\u5927\u5C0F\u6587\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},tel:{reg:/.*$/g,exist:!0,reason:q(fe,{children:[u(N,{children:"0\u304B\u3089\u59CB\u307E\u308B\u756A\u53F7\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059"}),u(N,{children:"9~12\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),u(N,{children:"\u6570\u5B57\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059"})]})},url:{reg:/^https?:\/\/[^\n\s]+(\.|\:)[^\n\s\.\:]+$/,exist:!0,reason:"URL\u5F62\u5F0F : http(s)://\u25EF\u25EF\u25EF\u25EF"},postal:{reg:/^\d{7}$/g,exist:!0,reason:"7\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}},w={setSelection:e=>{let{id:i,restrict:a,val_status:o}=e,p=Fe("#"+i)[0];if(!p||!o.prevValue||!o.safeValue||!o.isFocusing||o.isComposing)return;let{safeValue:t,prevValue:d,caretFrom:f,caretTo:r}=o;if(a=="creditCard")t.length>=d.length&&f%5==0&&(f++,r++),p.setSelectionRange(f,r);else if(a=="postal")t.length==5&&d.length==3&&(f++,r++),p.setSelectionRange(f,r);else if(a=="digitNumber"){let l=t.length-d.length;l==2&&(f++,r++),l==-2&&(f--,r--),p.setSelectionRange(f,r)}},Validation:{System:e=>{let{value:i,states:a}=e,{restrict:o="text",defaultValidation:p,maxLength:t,multiline:d,required:f}=a,r=[];if(d||(t=t||255),g.is.exist(t)&&i.length>=Number(t)&&r.push({type:"invalid",label:t+"\u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),i){let l=w.Validation.Text(i,o,p);l.ok||r.push({type:"invalid",label:l.body})}else f&&r.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"});return{ok:!r.filter(({type:l})=>l=="invalid").length,notice:r}},Text:(e,i,a)=>{let o={ok:!0,body:""};return(()=>{let p=a||_e[i];if(!p)return;let t=p.reason;if(p){let d=!!(+!!e.match(p.reg)^+!p.exist);o={ok:d,body:d?"":t}}})(),o},SyncValue:e=>{let{restrict:i,allowDecimals:a,allowZeroStart:o,value:p=""}=e,t=String(p);["tel","number","digitNumber","postal","creditCard"].includes(i)&&(t=t.zen2hanNumber()),i=="katakana",i=="hankaku.katakana",["postal","creditCard"].includes(i)&&(t=t.removeLetters()),g.scope(()=>{if(!["number","digitNumber"].includes(i))return;t=t.replace(/(\.\d+)\..*/g,"$1").replace(/\.+/g,".").replace(/[^0-9.-]/g,"");let f=Number(t)<0||t[0]=="-";t=t.replace(/[^0-9.]/g,""),f&&(t="-"+t);let r=Number(a);a?t=t.replace(/(\.\d{0,})\..*/g,"$1").replace(/\.(\d{0,})/g,(l,x)=>x.length>r?"."+x.slice(0,r):l):t=t.replace(/\.\d?/g,""),g.scope(()=>{i=="number"&&(o||(t=t.replace(/^0(\d+)/g,"$1").replace(/^-0(\d+)/g,"-$1")))}),g.scope(()=>{let l=t.slice(-1);if(!t||l=="."||l=="-")return;let{min:x,max:h}=e;g.is.exist(x)&&g.is.number(x)&&Number(t)<Number(x)&&(t=String(x.toFixed(r))),g.is.exist(h)&&g.is.number(h)&&Number(t)>Number(h)&&(t=String(h.toFixed(r)))}),g.scope(()=>{if(!t||t=="-"||i!="digitNumber")return;let l=t.slice(-1),[x,h]=t.split(".");t=x.replace(/\B(?=(\d{3})+(?!\d))/g,","),h&&(t+="."+h),l=="."&&(t+=".")})});let d=t;return i=="digitNumber"||(i=="postal"?t.length>=4&&(d=t.clip(0,3)+"-"+t.clip(3)):i=="creditCard"&&(d=t.replace(/.{4}(?=.)/g,"$& "))),(i=="digitNumber"||i=="number")&&(t=t.replace(/,/g,"")),{safeValue:d,rawValue:t}}},Shallow:e=>{let{rootStates:i,val_status:a}=e,o=a.rawValue||"";ae(()=>{g.scope(()=>ue(void 0,null,function*(){if(!i.multiline)return;let l=g('[data-input-origin="'+a.componentId+'"]'),x=g('[data-input-shallow="'+a.componentId+'"]'),h=g('[data-input-min-height-value-shallow="'+a.componentId+'"]'),v=g('[data-input-max-height-value-shallow="'+a.componentId+'"]');if(!l[0]||!x[0]||!h[0]||!v[0])return;let E=x.position(),J=h.position(),Y=v.position(),k=0;i.autoHeight&&(k=E.height),k=Math.max(k,J.height),k=Math.min(k,Y.height),l[0].style.height=k+"px"}))},[o]);let p=o||"";(!!o.match(/\n$/)||!o)&&(p+="T");let d="",f="";if(i.multiline){let l=i.minRows||1,x=i.maxRows||100;d=`
1
+ import{b as n,c as s,d as te,e as ue}from"../../chunk-C5N2D3ZX.js";import{Fragment as fe,jsx as u,jsxs as q}from"react/jsx-runtime";import g,{UUID as y,useStore as ce}from"jmini";import{useState as pe,useEffect as ae}from"react";import{$$fromRoot as Fe,ExtractStyles as Ne}from"../../@utils";import{Box as N,FAI as ke}from"../../atoms";import{Literal as ie}from"../../mols";import{Tips as me,Button as De}from"..";import{faEye as Ee}from"@fortawesome/free-solid-svg-icons/faEye";import{OptionalInputWrapper as He,BoxWrapper as Ae,CoreEffects as z,DefaultBoxishStyles as Le}from"./core";import{InputLabel as Be}from"./Label";import{LeftIcon as Me,RightIcon as de}from".";const _e={katakana:{reg:/^[ァ-ヶー  ヲ-゚  ]*$/g,exist:!0,reason:"\u30AB\u30BF\u30AB\u30CA\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},"hankaku.katakana":{reg:/^[ヲ-゚  ]*$/g,exist:!0,reason:"\u534A\u89D2\u30AB\u30BF\u30AB\u30CA\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},number:{reg:/^-?[0-9\.]{0,}[0-9]{1,}$/g,exist:!0,reason:"\u534A\u89D2\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},digitNumber:{reg:/^-?[0-9\,\.]{0,}[0-9]{1,}$/g,exist:!0,reason:"\u534A\u89D2\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},fileName:{reg:/[¥\/:*\?\"\'\|\.\s\n\r\<\>]/g,exist:!1,reason:"\u7A7A\u767D\u307E\u305F\u306F\u4E00\u90E8\u306E\u7279\u6B8A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093"},creditCard:{reg:/^\d{14,16}$/g,exist:!0,reason:"14~16\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},email:{reg:/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]+\.[A-Za-z0-9]+$/,exist:!0,reason:q(fe,{children:[u(N,{children:"\u25CB\u25CB\u25CB\u25CB@\u25CB\u25CB\u25CB\u25CB.\u25CB\u25CB\u25CB\u306E\u5F62\u5F0F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),u(N,{children:"\u6700\u5F8C\u306E\u6587\u5B57\u306B.(\u30C9\u30C3\u30C8)\u3092\u5165\u308C\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"})]})},password:{reg:/^(?=[^A-Z]*[A-Z])(?=[^a-z]*[a-z])(?=[^0-9]*[0-9]).{8,}$/,exist:!0,reason:"8\u6587\u5B57\u4EE5\u4E0A\u3001\u534A\u89D2\u82F1\u6570\u5927\u5C0F\u6587\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},tel:{reg:/.*$/g,exist:!0,reason:q(fe,{children:[u(N,{children:"0\u304B\u3089\u59CB\u307E\u308B\u756A\u53F7\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059"}),u(N,{children:"9~12\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),u(N,{children:"\u6570\u5B57\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059"})]})},url:{reg:/^https?:\/\/[^\n\s]+(\.|\:)[^\n\s\.\:]+$/,exist:!0,reason:"URL\u5F62\u5F0F : http(s)://\u25EF\u25EF\u25EF\u25EF"},postal:{reg:/^\d{7}$/g,exist:!0,reason:"7\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}},w={setSelection:e=>{let{id:i,restrict:a,val_status:o}=e,p=Fe("#"+i)[0];if(!p||!o.prevValue||!o.safeValue||!o.isFocusing||o.isComposing)return;let{safeValue:t,prevValue:d,caretFrom:f,caretTo:r}=o;if(a=="creditCard")t.length>=d.length&&f%5==0&&(f++,r++),p.setSelectionRange(f,r);else if(a=="postal")t.length==5&&d.length==3&&(f++,r++),p.setSelectionRange(f,r);else if(a=="digitNumber"){let l=t.length-d.length;l==2&&(f++,r++),l==-2&&(f--,r--),p.setSelectionRange(f,r)}},Validation:{System:e=>{let{value:i,states:a}=e,{restrict:o="text",defaultValidation:p,maxLength:t,multiline:d,required:f}=a,r=[];if(d||(t=t||255),g.is.exist(t)&&i.length>=Number(t)&&r.push({type:"invalid",label:t+"\u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),i){let l=w.Validation.Text(i,o,p);l.ok||r.push({type:"invalid",label:l.body})}else f&&r.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"});return{ok:!r.filter(({type:l})=>l=="invalid").length,notice:r}},Text:(e,i,a)=>{let o={ok:!0,body:""};return(()=>{let p=a||_e[i];if(!p)return;let t=p.reason;if(p){let d=!!(+!!e.match(p.reg)^+!p.exist);o={ok:d,body:d?"":t}}})(),o},SyncValue:e=>{let{restrict:i,allowDecimals:a,allowZeroStart:o,value:p=""}=e,t=String(p);["tel","number","digitNumber","postal","creditCard"].includes(i)&&(t=t.zen2hanNumber()),i=="katakana",i=="hankaku.katakana",["postal","creditCard"].includes(i)&&(t=t.removeLetters()),g.scope(()=>{if(!["number","digitNumber"].includes(i))return;t=t.replace(/(\.\d+)\..*/g,"$1").replace(/\.+/g,".").replace(/[^0-9.-]/g,"");let f=Number(t)<0||t[0]=="-";t=t.replace(/[^0-9.]/g,""),f&&(t="-"+t);let r=Number(a);a?t=t.replace(/(\.\d{0,})\..*/g,"$1").replace(/\.(\d{0,})/g,(l,x)=>x.length>r?"."+x.slice(0,r):l):t=t.replace(/\.\d?/g,""),g.scope(()=>{["number","digitNumber"].includes(i)&&(o||(t=t.replace(/^0(\d+)/g,"$1").replace(/^-0(\d+)/g,"-$1")))}),g.scope(()=>{let l=t.slice(-1);if(!t||l=="."||l=="-")return;let{min:x,max:h}=e;g.is.exist(x)&&g.is.number(x)&&Number(t)<Number(x)&&(t=String(x.toFixed(r))),g.is.exist(h)&&g.is.number(h)&&Number(t)>Number(h)&&(t=String(h.toFixed(r)))}),g.scope(()=>{if(!t||t=="-"||i!="digitNumber")return;let l=t.slice(-1),[x,h]=t.split(".");t=x.replace(/\B(?=(\d{3})+(?!\d))/g,","),h&&(t+="."+h),l=="."&&(t+=".")})});let d=t;return i=="digitNumber"||(i=="postal"?t.length>=4&&(d=t.clip(0,3)+"-"+t.clip(3)):i=="creditCard"&&(d=t.replace(/.{4}(?=.)/g,"$& "))),(i=="digitNumber"||i=="number")&&(t=t.replace(/,/g,"")),{safeValue:d,rawValue:t}}},Shallow:e=>{let{rootStates:i,val_status:a}=e,o=a.rawValue||"";ae(()=>{g.scope(()=>ue(void 0,null,function*(){if(!i.multiline)return;let l=g('[data-input-origin="'+a.componentId+'"]'),x=g('[data-input-shallow="'+a.componentId+'"]'),h=g('[data-input-min-height-value-shallow="'+a.componentId+'"]'),v=g('[data-input-max-height-value-shallow="'+a.componentId+'"]');if(!l[0]||!x[0]||!h[0]||!v[0])return;let E=x.position(),J=h.position(),Y=v.position(),k=0;i.autoHeight&&(k=E.height),k=Math.max(k,J.height),k=Math.min(k,Y.height),l[0].style.height=k+"px"}))},[o]);let p=o||"";(!!o.match(/\n$/)||!o)&&(p+="T");let d="",f="";if(i.multiline){let l=i.minRows||1,x=i.maxRows||100;d=`
2
2
  T`.repeat(l-1),f=`
3
- T`.repeat(x-1)}let r=Ne(i);return q(N,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",opacity:"trans",freeCSS:{zIndex:3,pointerEvents:"none"},children:[u(ie.Description,s(n({className:i.className},r),{position:"absolute",width:1,freeCSS:s(n({},r.freeCSS),{color:"orange"}),"data-input-shallow":a.componentId,children:u(N,{"data-input-value-shallow":a.componentId,children:p})})),u(ie.Description,s(n({className:i.className},r),{position:"absolute",left:0,freeCSS:s(n({},r.freeCSS),{backgroundColor:"transparent",color:"blue"}),"data-input-min-height-value-shallow":a.componentId,children:d})),u(ie.Description,s(n({className:i.className},r),{position:"absolute",right:0,freeCSS:s(n({},r.freeCSS),{backgroundColor:"transparent",color:"red"}),"data-input-max-height-value-shallow":a.componentId,children:f}))]})},InputBox:e=>{let{rootStates:i,val_status:a,set_status:o,val_inputType:p,set_inputType:t}=e;if(i.multiline)return null;let re=i,{componentId:d,tone:f,required:r,restrict:l="text",form:x,autoComplete:h="off",autoCapitalize:v="off",minRows:E,maxRows:J,multiline:Y,autoHeight:k,enableFormSubmit:ne,clearButton:le=!1,allowDecimals:Z,allowZeroStart:B,checkValidationAtFirst:U,onChange:M,onKeyDown:G,onValidate:ge,onValidateDelay:xe,onUpdateValue:be,onUpdateValidValue:Ie,onUserAction:Se,value:he="",leftIndicator:Te,rightIndicator:we,leftIcon:ye,rightIcon:Ce,maxLength:ve,min:c,max:K,label:X,isLabelActive:T,defaultValidation:V,wrapStyles:oe}=re,m=te(re,["componentId","tone","required","restrict","form","autoComplete","autoCapitalize","minRows","maxRows","multiline","autoHeight","enableFormSubmit","clearButton","allowDecimals","allowZeroStart","checkValidationAtFirst","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","leftIndicator","rightIndicator","leftIcon","rightIcon","maxLength","min","max","label","isLabelActive","defaultValidation","wrapStyles"]);return u(N,s(n({htmlTag:"input",type:p,inputMode:["number","digitNumber","creditCard"].includes(l)?"numeric":l=="email"?"email":"text","data-disabled":i.disabled,"data-show-validation":P.isShowValidation(a,!!U),"data-component-id":a.componentId,"data-input-origin":a.componentId,value:a.safeValue,autoComplete:h,autoCapitalize:v,onKeyDown:I=>{let{key:b,target:R}=I,L=R,{selectionStart:_,selectionEnd:Q}=L,W=Number(_),$=Number(Q);{let H=a.safeValue[Number(W)],A=a.safeValue[Number(W)-1];b=="Delete"&&(l=="creditCard"&&H==" "||l=="postal"&&H=="-"||l=="digitNumber"&&H==",")&&(L.setSelectionRange(W+1,$+1),I.preventDefault()),b=="Backspace"&&(l=="creditCard"&&A==" "||l=="postal"&&A=="-"||l=="digitNumber"&&A==",")&&(L.setSelectionRange(W-1,$-1),I.preventDefault()),b=="Enter"||b=="Tab"}g.scope(()=>{["number","digitNumber","creditCard"].includes(l)&&b=="Clear"&&o(H=>s(n({},H),{rawValue:"",safeValue:"",eventType:"update",eventID:y(12),isFocusing:!0,isInspected:!1}))}),g.scope(()=>{if(!["number","digitNumber"].includes(l)||!["ArrowUp","ArrowDown"].includes(b))return;let H=+(b=="ArrowUp")*2-1,A=a.rawValue.slice(-1),se=a.safeValue[$-1],D=$-1,F=String(a.safeValue),j=a.rawValue.split(".")[1],Ve=(j==null?void 0:j.length)||0;g.scope(()=>{if(!A){F="0";return}if(A=="-"){F+="0";return}if(A=="."){F+="0";return}if($==0)return;let ee=String(F).slice(0,D).match(/\./),Re=String(F).slice(D),O=String(Re.toNumber().toFixed(0)).length;se=="."&&(O=1,D=F.split(".")[0].length-1),se==","&&(O+=1,D--),ee&&(O=-1*(Ve-O));let z=F[D].toNumber()+H;z<0?z=9:z>=10&&(z=0),F=F.partReplace(D,String(z)),setTimeout(()=>{L.setSelectionRange(D+1,D+1)},1)}),o(ee=>s(n(n({},ee),w.Validation.SyncValue({allowDecimals:Z,allowZeroStart:B,min:c,max:K,restrict:l,value:F})),{eventType:"update",eventID:y(12),isFocusing:!0,isInspected:!1,isValidated:!1,notice:[]})),I.preventDefault()}),G&&G(I),ne&&P.SubmitForm(I,x)},onChange:I=>{let{value:b,selectionStart:R,selectionEnd:L}=I.target,_=w.Validation.SyncValue({allowDecimals:Z,allowZeroStart:B,min:c,max:K,restrict:l,value:b});a.isComposing&&(_.safeValue=b),_.safeValue!=a.safeValue&&(o(Q=>s(n(n({},Q),_),{prevValue:a.safeValue,eventType:"update",eventID:y(12),caretFrom:Number(R),caretTo:Number(L),isFocusing:!0,isInspected:!1,isValidated:!1,notice:[]})),M&&M(I))},width:1},m),{onFocus:I=>{m!=null&&m.onFocus&&(m==null||m.onFocus(I)),o(b=>s(n({},b),{eventID:y(12),isFocusing:!0}))},onBlur:I=>{m!=null&&m.onBlur&&(m==null||m.onBlur(I)),o(b=>s(n({},b),{eventID:y(12),isFocusing:!1}))},onCompositionStart:I=>{m!=null&&m.onCompositionStart&&(m==null||m.onCompositionStart(I)),o(b=>s(n({},b),{eventID:y(12),isComposing:!0}))},onCompositionEnd:I=>{if(m!=null&&m.onCompositionEnd&&(m==null||m.onCompositionEnd(I)),l=="text"){g.interval.once(()=>{o(R=>s(n({},R),{isComposing:!1}))},100,"input.textfield.composing.end");return}let b=w.Validation.SyncValue({allowDecimals:Z,allowZeroStart:B,min:c,max:K,restrict:l,value:a.safeValue});o(R=>s(n(n({},R),b),{prevValue:R.safeValue,eventType:"update",eventID:y(12),caretFrom:Number(R.safeValue.length+1),caretTo:Number(R.safeValue.length+1),isComposing:!1,isInspected:!1}))}}))},TextAreaBox:e=>{let{rootStates:i,val_status:a,set_status:o,isShallow:p}=e,X=i,{componentId:t,tone:d,required:f,form:r,label:l,isLabelActive:x,clearButton:h=!1,minRows:v,maxRows:E,multiline:J,autoHeight:Y,allowDecimals:k,allowZeroStart:ne,enableFormSubmit:le,maxLength:Z,checkValidationAtFirst:B,onChange:U,onKeyDown:M,onValidate:G,onValidateDelay:ge,onUpdateValue:xe,onUpdateValidValue:be,onUserAction:Ie,value:Se="",leftIndicator:he,rightIndicator:Te,leftIcon:we,rightIcon:ye,defaultValidation:Ce,wrapStyles:ve}=X,c=te(X,["componentId","tone","required","form","label","isLabelActive","clearButton","minRows","maxRows","multiline","autoHeight","allowDecimals","allowZeroStart","enableFormSubmit","maxLength","checkValidationAtFirst","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","leftIndicator","rightIndicator","leftIcon","rightIcon","defaultValidation","wrapStyles"]);return!i.multiline?null:u(N,s(n({htmlTag:"textarea","data-show-validation":P.isShowValidation(a,!!B),"data-input-origin":a.componentId,"data-component-id":a.componentId,value:a.rawValue,width:1},c),{onFocus:T=>{c!=null&&c.onFocus&&(c==null||c.onFocus(T)),o(V=>s(n({},V),{eventID:y(12),isFocusing:!0}))},onBlur:T=>{c!=null&&c.onBlur&&(c==null||c.onBlur(T)),o(V=>s(n({},V),{eventID:y(12),isFocusing:!1}))},onCompositionStart:T=>{c!=null&&c.onCompositionStart&&(c==null||c.onCompositionStart(T)),o(V=>s(n({},V),{eventID:y(12),isComposing:!0}))},onCompositionEnd:T=>{c!=null&&c.onCompositionEnd&&(c==null||c.onCompositionEnd(T)),g.interval.once(()=>{o(V=>s(n({},V),{eventID:y(12),isComposing:!1}))},100,"input.textfield.composing.end")},onKeyDown:T=>{M&&M(T),le&&P.SubmitForm(T,r)},onChange:T=>{let{value:V}=T.target;o(oe=>s(n({},oe),{rawValue:V,eventType:"update",eventID:y(12),isFocusing:!0,isInspected:!1,isValidated:!1,notice:[]})),U&&U(T)}}))}},$e=e=>{let{componentId:i,restrict:a="text",value:o="",min:p,max:t,allowDecimals:d,allowZeroStart:f}=e,[r,l]=pe(s(n({componentId:i},w.Validation.SyncValue({allowDecimals:d,allowZeroStart:f,min:p,max:t,restrict:a,value:o})),{prevValue:"",eventType:"init",eventID:y(12),caretFrom:null,caretTo:null})),[x,h]=pe(["password","concealed"].includes(a)&&"password"||"text");ae(()=>{l(E=>s(n(n({},E),w.Validation.SyncValue({allowDecimals:d,allowZeroStart:f,min:p,max:t,restrict:a,value:o})),{isInspected:!1})),ce.set({[i+":set_inputType"]:h})},[]);let v={rootStates:e,val_inputType:x,set_inputType:h,val_status:r,set_status:l};return P.CommonEffects({type:"textfield",states:e,val_status:r,set_status:l,SystemValidation:w.Validation.System,ExtraOverrideStates:E=>w.Validation.SyncValue({allowDecimals:d,allowZeroStart:f,min:p,max:t,restrict:a,value:E})}),ae(()=>{w.setSelection({id:e.id,restrict:a,val_status:r})},[r]),q(Ae,{val_status:r,set_status:l,states:v.rootStates,children:[u(Be,{componentId:e.componentId,fontSize:e.fontSize,required:e.required,label:e.label,isActive:e.isLabelActive||!!r.isFocusing||!!r.rawValue}),u(w.Shallow,n({},v)),u(w.InputBox,n({},v)),u(w.TextAreaBox,n({},v))]})},C=e=>{var i,a;return e=n({autoHeight:!0,restrict:"text",fontSize:"inherit",value:""},e),e.value=(a=w.Validation.SyncValue({allowDecimals:e.allowDecimals,allowZeroStart:e.allowZeroStart,min:e.min,max:e.max,restrict:e.restrict||"text",value:(i=e.value)!=null?i:""}).rawValue)!=null?a:"",e.multiline?(e.minRows=e.minRows||5,e.maxRows=e.maxRows||20):(e.minRows=1,e.maxRows=1),u(He,{componentId:e.componentId,children:$e,states:Le(e)})},S=C;S.Validate=w.Validation.Text,S.Katakana=e=>u(C,s(n({},e),{restrict:"katakana",multiline:!1,autoHeight:!1})),S.HankakuKatakana=e=>u(C,s(n({},e),{restrict:"hankaku.katakana",multiline:!1,autoHeight:!1})),S.CreditCard=e=>u(C,s(n({},e),{restrict:"creditCard",multiline:!1,autoHeight:!1})),S.Tel=e=>u(C,s(n({},e),{restrict:"tel",multiline:!1,autoHeight:!1})),S.Number=e=>u(C,s(n({},e),{restrict:"number",multiline:!1,autoHeight:!1})),S.DigitNumber=e=>u(C,s(n({},e),{restrict:"digitNumber",multiline:!1,autoHeight:!1})),S.Email=e=>u(C,s(n({},e),{restrict:"email",multiline:!1,autoHeight:!1})),S.Url=e=>u(C,s(n({},e),{restrict:"url",multiline:!1,autoHeight:!1})),S.Postal=e=>u(C,s(n({label:"\u90F5\u4FBF\u756A\u53F7"},e),{restrict:"postal",multiline:!1,autoHeight:!1,leftIcon:u(Me,{ssSphere:2,fontColor:"4.thin",children:"\u3012"})})),S.Password=e=>u(C,s(n({label:"\u30D1\u30B9\u30EF\u30FC\u30C9",rightIcon:u(de,{ssSphere:2.5,freeCSS:{pointerEvents:"all"},children:u(De.Sub,{ssSphere:2.5,borderRadius:"3.tone.tertiary",fontColor:"theme",flexCenter:!0,height:1,ssEffectsOnActive:["expand"],onMouseOver:i=>{me.open(i.currentTarget,"\u30C6\u30AD\u30B9\u30C8\u3092\u8868\u793A",24)},onMouseLeave:me.abort,tabIndex:-1,onClick:i=>{g(i.target).parent().parent().find("input").callback(a=>{let o=a[0];if(!o)return;let p=o.dataset.componentId;if(!p)return;let t=ce.get(p+":set_inputType");t&&t(d=>d==="password"&&"text"||"password")})},children:u(ke,{icon:Ee})})}),restrict:"password"},e),{multiline:!1,autoHeight:!1})),S.Concealed=e=>u(S.Password,s(n({label:"\u79D8\u5BC6\u9375"},e),{restrict:"concealed"})),S.Money={JPY:e=>u(S.DigitNumber,s(n({rightIcon:u(de,{fontColor:"4.thin",children:"\u5186"})},e),{multiline:!1,autoHeight:!1}))};export{S as TextField,$e as TextInput,S as default};
3
+ T`.repeat(x-1)}let r=Ne(i);return q(N,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",opacity:"trans",freeCSS:{zIndex:3,pointerEvents:"none"},children:[u(ie.Description,s(n({className:i.className},r),{position:"absolute",width:1,freeCSS:s(n({},r.freeCSS),{color:"orange"}),"data-input-shallow":a.componentId,children:u(N,{"data-input-value-shallow":a.componentId,children:p})})),u(ie.Description,s(n({className:i.className},r),{position:"absolute",left:0,freeCSS:s(n({},r.freeCSS),{backgroundColor:"transparent",color:"blue"}),"data-input-min-height-value-shallow":a.componentId,children:d})),u(ie.Description,s(n({className:i.className},r),{position:"absolute",right:0,freeCSS:s(n({},r.freeCSS),{backgroundColor:"transparent",color:"red"}),"data-input-max-height-value-shallow":a.componentId,children:f}))]})},InputBox:e=>{let{rootStates:i,val_status:a,set_status:o,val_inputType:p,set_inputType:t}=e;if(i.multiline)return null;let re=i,{componentId:d,tone:f,required:r,restrict:l="text",form:x,autoComplete:h="off",autoCapitalize:v="off",minRows:E,maxRows:J,multiline:Y,autoHeight:k,enableFormSubmit:ne,clearButton:le=!1,allowDecimals:P,allowZeroStart:B,checkValidationAtFirst:U,onChange:M,onKeyDown:G,onValidate:ge,onValidateDelay:xe,onUpdateValue:be,onUpdateValidValue:Se,onUserAction:Ie,value:he="",leftIndicator:Te,rightIndicator:we,leftIcon:ye,rightIcon:Ce,maxLength:ve,min:c,max:K,label:X,isLabelActive:T,defaultValidation:V,wrapStyles:oe}=re,m=te(re,["componentId","tone","required","restrict","form","autoComplete","autoCapitalize","minRows","maxRows","multiline","autoHeight","enableFormSubmit","clearButton","allowDecimals","allowZeroStart","checkValidationAtFirst","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","leftIndicator","rightIndicator","leftIcon","rightIcon","maxLength","min","max","label","isLabelActive","defaultValidation","wrapStyles"]);return u(N,s(n({htmlTag:"input",type:p,inputMode:["number","digitNumber","creditCard"].includes(l)?"numeric":l=="email"?"email":"text","data-disabled":i.disabled,"data-show-validation":z.isShowValidation(a,!!U),"data-component-id":a.componentId,"data-input-origin":a.componentId,value:a.safeValue,autoComplete:h,autoCapitalize:v,onKeyDown:S=>{let{key:b,target:R}=S,L=R,{selectionStart:_,selectionEnd:Q}=L,W=Number(_),$=Number(Q);{let H=a.safeValue[Number(W)],A=a.safeValue[Number(W)-1];b=="Delete"&&(l=="creditCard"&&H==" "||l=="postal"&&H=="-"||l=="digitNumber"&&H==",")&&(L.setSelectionRange(W+1,$+1),S.preventDefault()),b=="Backspace"&&(l=="creditCard"&&A==" "||l=="postal"&&A=="-"||l=="digitNumber"&&A==",")&&(L.setSelectionRange(W-1,$-1),S.preventDefault()),b=="Enter"||b=="Tab"}g.scope(()=>{["number","digitNumber","creditCard"].includes(l)&&b=="Clear"&&o(H=>s(n({},H),{rawValue:"",safeValue:"",eventType:"update",eventID:y(12),isFocusing:!0,isInspected:!1}))}),g.scope(()=>{if(!["number","digitNumber"].includes(l)||!["ArrowUp","ArrowDown"].includes(b))return;let H=+(b=="ArrowUp")*2-1,A=a.rawValue.slice(-1),se=a.safeValue[$-1],D=$-1,F=String(a.safeValue),j=a.rawValue.split(".")[1],Ve=(j==null?void 0:j.length)||0;g.scope(()=>{if(!A){F="0";return}if(A=="-"){F+="0";return}if(A=="."){F+="0";return}if($==0)return;let ee=String(F).slice(0,D).match(/\./),Re=String(F).slice(D),O=String(Re.toNumber().toFixed(0)).length;se=="."&&(O=1,D=F.split(".")[0].length-1),se==","&&(O+=1,D--),ee&&(O=-1*(Ve-O));let Z=F[D].toNumber()+H;Z<0?Z=9:Z>=10&&(Z=0),F=F.partReplace(D,String(Z)),setTimeout(()=>{L.setSelectionRange(D+1,D+1)},1)}),o(ee=>s(n(n({},ee),w.Validation.SyncValue({allowDecimals:P,allowZeroStart:B,min:c,max:K,restrict:l,value:F})),{eventType:"update",eventID:y(12),isFocusing:!0,isInspected:!1,isValidated:!1,notice:[]})),S.preventDefault()}),G&&G(S),ne&&z.SubmitForm(S,x)},onChange:S=>{let{value:b,selectionStart:R,selectionEnd:L}=S.target,_=w.Validation.SyncValue({allowDecimals:P,allowZeroStart:B,min:c,max:K,restrict:l,value:b});a.isComposing&&(_.safeValue=b),_.safeValue!=a.safeValue&&(o(Q=>s(n(n({},Q),_),{prevValue:a.safeValue,eventType:"update",eventID:y(12),caretFrom:Number(R),caretTo:Number(L),isFocusing:!0,isInspected:!1,isValidated:!1,notice:[]})),M&&M(S))},width:1},m),{onFocus:S=>{m!=null&&m.onFocus&&(m==null||m.onFocus(S)),o(b=>s(n({},b),{eventID:y(12),isFocusing:!0}))},onBlur:S=>{m!=null&&m.onBlur&&(m==null||m.onBlur(S)),o(b=>s(n({},b),{eventID:y(12),isFocusing:!1}))},onCompositionStart:S=>{m!=null&&m.onCompositionStart&&(m==null||m.onCompositionStart(S)),o(b=>s(n({},b),{eventID:y(12),isComposing:!0}))},onCompositionEnd:S=>{if(m!=null&&m.onCompositionEnd&&(m==null||m.onCompositionEnd(S)),l=="text"){g.interval.once(()=>{o(R=>s(n({},R),{isComposing:!1}))},100,"input.textfield.composing.end");return}let b=w.Validation.SyncValue({allowDecimals:P,allowZeroStart:B,min:c,max:K,restrict:l,value:a.safeValue});o(R=>s(n(n({},R),b),{prevValue:R.safeValue,eventType:"update",eventID:y(12),caretFrom:Number(R.safeValue.length+1),caretTo:Number(R.safeValue.length+1),isComposing:!1,isInspected:!1}))}}))},TextAreaBox:e=>{let{rootStates:i,val_status:a,set_status:o,isShallow:p}=e,X=i,{componentId:t,tone:d,required:f,form:r,label:l,isLabelActive:x,clearButton:h=!1,minRows:v,maxRows:E,multiline:J,autoHeight:Y,allowDecimals:k,allowZeroStart:ne,enableFormSubmit:le,maxLength:P,checkValidationAtFirst:B,onChange:U,onKeyDown:M,onValidate:G,onValidateDelay:ge,onUpdateValue:xe,onUpdateValidValue:be,onUserAction:Se,value:Ie="",leftIndicator:he,rightIndicator:Te,leftIcon:we,rightIcon:ye,defaultValidation:Ce,wrapStyles:ve}=X,c=te(X,["componentId","tone","required","form","label","isLabelActive","clearButton","minRows","maxRows","multiline","autoHeight","allowDecimals","allowZeroStart","enableFormSubmit","maxLength","checkValidationAtFirst","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","leftIndicator","rightIndicator","leftIcon","rightIcon","defaultValidation","wrapStyles"]);return!i.multiline?null:u(N,s(n({htmlTag:"textarea","data-show-validation":z.isShowValidation(a,!!B),"data-input-origin":a.componentId,"data-component-id":a.componentId,value:a.rawValue,width:1},c),{onFocus:T=>{c!=null&&c.onFocus&&(c==null||c.onFocus(T)),o(V=>s(n({},V),{eventID:y(12),isFocusing:!0}))},onBlur:T=>{c!=null&&c.onBlur&&(c==null||c.onBlur(T)),o(V=>s(n({},V),{eventID:y(12),isFocusing:!1}))},onCompositionStart:T=>{c!=null&&c.onCompositionStart&&(c==null||c.onCompositionStart(T)),o(V=>s(n({},V),{eventID:y(12),isComposing:!0}))},onCompositionEnd:T=>{c!=null&&c.onCompositionEnd&&(c==null||c.onCompositionEnd(T)),g.interval.once(()=>{o(V=>s(n({},V),{eventID:y(12),isComposing:!1}))},100,"input.textfield.composing.end")},onKeyDown:T=>{M&&M(T),le&&z.SubmitForm(T,r)},onChange:T=>{let{value:V}=T.target;o(oe=>s(n({},oe),{rawValue:V,eventType:"update",eventID:y(12),isFocusing:!0,isInspected:!1,isValidated:!1,notice:[]})),U&&U(T)}}))}},$e=e=>{let{componentId:i,restrict:a="text",value:o="",min:p,max:t,allowDecimals:d,allowZeroStart:f}=e,[r,l]=pe(s(n({componentId:i},w.Validation.SyncValue({allowDecimals:d,allowZeroStart:f,min:p,max:t,restrict:a,value:o})),{prevValue:"",eventType:"init",eventID:y(12),caretFrom:null,caretTo:null})),[x,h]=pe(["password","concealed"].includes(a)&&"password"||"text");ae(()=>{l(E=>s(n(n({},E),w.Validation.SyncValue({allowDecimals:d,allowZeroStart:f,min:p,max:t,restrict:a,value:o})),{isInspected:!1})),ce.set({[i+":set_inputType"]:h})},[]);let v={rootStates:e,val_inputType:x,set_inputType:h,val_status:r,set_status:l};return z.CommonEffects({type:"textfield",states:e,val_status:r,set_status:l,SystemValidation:w.Validation.System,ExtraOverrideStates:E=>w.Validation.SyncValue({allowDecimals:d,allowZeroStart:f,min:p,max:t,restrict:a,value:E})}),ae(()=>{w.setSelection({id:e.id,restrict:a,val_status:r})},[r]),q(Ae,{val_status:r,set_status:l,states:v.rootStates,children:[u(Be,{componentId:e.componentId,fontSize:e.fontSize,required:e.required,label:e.label,isActive:e.isLabelActive||!!r.isFocusing||!!r.rawValue}),u(w.Shallow,n({},v)),u(w.InputBox,n({},v)),u(w.TextAreaBox,n({},v))]})},C=e=>{var i,a;return e=n({autoHeight:!0,restrict:"text",fontSize:"inherit",value:""},e),e.value=(a=w.Validation.SyncValue({allowDecimals:e.allowDecimals,allowZeroStart:e.allowZeroStart,min:e.min,max:e.max,restrict:e.restrict||"text",value:(i=e.value)!=null?i:""}).rawValue)!=null?a:"",e.multiline?(e.minRows=e.minRows||5,e.maxRows=e.maxRows||20):(e.minRows=1,e.maxRows=1),u(He,{componentId:e.componentId,children:$e,states:Le(e)})},I=C;I.Validate=w.Validation.Text,I.Katakana=e=>u(C,s(n({},e),{restrict:"katakana",multiline:!1,autoHeight:!1})),I.HankakuKatakana=e=>u(C,s(n({},e),{restrict:"hankaku.katakana",multiline:!1,autoHeight:!1})),I.CreditCard=e=>u(C,s(n({},e),{restrict:"creditCard",multiline:!1,autoHeight:!1})),I.Tel=e=>u(C,s(n({},e),{restrict:"tel",multiline:!1,autoHeight:!1})),I.Number=e=>u(C,s(n({},e),{restrict:"number",multiline:!1,autoHeight:!1})),I.DigitNumber=e=>u(C,s(n({},e),{restrict:"digitNumber",multiline:!1,autoHeight:!1})),I.Email=e=>u(C,s(n({},e),{restrict:"email",multiline:!1,autoHeight:!1})),I.Url=e=>u(C,s(n({},e),{restrict:"url",multiline:!1,autoHeight:!1})),I.Postal=e=>u(C,s(n({label:"\u90F5\u4FBF\u756A\u53F7"},e),{restrict:"postal",multiline:!1,autoHeight:!1,leftIcon:u(Me,{ssSphere:2,fontColor:"4.thin",children:"\u3012"})})),I.Password=e=>u(C,s(n({label:"\u30D1\u30B9\u30EF\u30FC\u30C9",rightIcon:u(de,{ssSphere:2.5,freeCSS:{pointerEvents:"all"},children:u(De.Sub,{ssSphere:2.5,borderRadius:"3.tone.tertiary",fontColor:"theme",flexCenter:!0,height:1,ssEffectsOnActive:["expand"],onMouseOver:i=>{me.open(i.currentTarget,"\u30C6\u30AD\u30B9\u30C8\u3092\u8868\u793A",24)},onMouseLeave:me.abort,tabIndex:-1,onClick:i=>{g(i.target).parent().parent().find("input").callback(a=>{let o=a[0];if(!o)return;let p=o.dataset.componentId;if(!p)return;let t=ce.get(p+":set_inputType");t&&t(d=>d==="password"&&"text"||"password")})},children:u(ke,{icon:Ee})})}),restrict:"password"},e),{multiline:!1,autoHeight:!1})),I.Concealed=e=>u(I.Password,s(n({label:"\u79D8\u5BC6\u9375"},e),{restrict:"concealed"})),I.Money={JPY:e=>u(I.DigitNumber,s(n({rightIcon:u(de,{fontColor:"4.thin",children:"\u5186"}),allowZeroStart:!1},e),{multiline:!1,autoHeight:!1}))};export{I as TextField,$e as TextInput,I as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amotify",
3
- "version": "0.2.269",
3
+ "version": "0.2.270",
4
4
  "description": "UI Component for React,NextJS,esbuild",
5
5
  "scripts": {
6
6
  "start": "run-p clean build:*",