amotify 0.2.171 → 0.2.172
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/demo/esbuild/app.tsx +22 -16
- package/demo/esbuild/public/index.js +171 -77
- package/dist/fn/Input/TextField.js +2 -2
- package/package.json +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{b as i,c as
|
|
1
|
+
import{b as i,c as s,d as G,e as ae}from"../../chunk-C5N2D3ZX.js";import{Fragment as ne,jsx as n,jsxs as W}from"react/jsx-runtime";import b,{UUID as L,useStore as ve}from"jmini";import{useState as Z,useEffect as X}from"react";import{$$fromRoot as Ce,ExtractStyles as Te}from"../../@utils";import{Box as F,FAI as Re}from"../../atoms";import{Literal as j}from"../../mols";import{Tips as le,Button as we}from"..";import{faEye as ye}from"@fortawesome/free-solid-svg-icons/faEye";import{OptionalInputWrapper as Ve,BoxWrapper as De,CoreEffects as U,DefaultBoxishStyles as ke}from"./core";import{InputLabel as Ne}from"./Label";import{LeftIcon as Fe,RightIcon as ie}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:W(ne,{children:[n(F,{children:"\u25CB\u25CB\u25CB\u25CB@\u25CB\u25CB\u25CB\u25CB.\u25CB\u25CB\u25CB\u306E\u5F62\u5F0F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),n(F,{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:W(ne,{children:[n(F,{children:"0\u304B\u3089\u59CB\u307E\u308B\u756A\u53F7\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059"}),n(F,{children:"9~12\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),n(F,{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"}},R={setSelection:e=>{let{id:l,restrict:o,val_status:u}=e,a=Ce("#"+l)[0];if(a&&u.prevValue&&u.formatValue){let{formatValue:t,prevValue:p,caretFrom:d,caretTo:r}=u;if(o=="creditCard")t.length>=p.length&&d%5==0&&(d++,r++),a.setSelectionRange(d,r);else if(o=="postal")t.length==5&&p.length==3&&(d++,r++),a.setSelectionRange(d,r);else if(o=="digitNumber"){let f=t.length-p.length;f==2&&(d++,r++),f==-2&&(d--,r--),a.setSelectionRange(d,r)}}},Validation:{System:e=>{let{value:l,states:o}=e,{restrict:u="text",defaultValidation:a,maxLength:t,multiline:p,required:d}=o,r=[];if(p||(t=t||255),b.is.exist(t)&&l.length>=Number(t)&&r.push({type:"invalid",label:t+"\u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),l){let f=R.Validation.Text(l,u,a);f.ok||r.push({type:"invalid",label:f.body})}else d&&r.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"});return{ok:!r.filter(({type:f})=>f=="invalid").length,notice:r}},Text:(e,l,o)=>{let u={ok:!0,body:""};return(()=>{let a=o||_e[l];if(!a)return;let t=a.reason;if(a){let p=!!(+!!e.match(a.reg)^+!a.exist);u={ok:p,body:p?"":t}}})(),u},DataLeveling:e=>{let{restrict:l,allowDecimals:o,allowZeroStart:u,value:a=""}=e,t=String(a);["tel","number","digitNumber","test","postal","creditCard"].includes(l)&&(t=t.zen2hanNumber()),l=="katakana",l=="hankaku.katakana",["postal","creditCard"].includes(l)&&(t=t.removeLetters()),b.scope(()=>{if(!["number","digitNumber"].includes(l))return;t=t.replace(/(\.\d+)\..*/g,"$1").replace(/\.+/g,".").replace(/[^0-9.-]/g,"");let d=Number(t)<0||t[0]=="-";t=t.replace(/[^0-9.]/g,""),d&&(t="-"+t),o||(t=t.replace(/\.\d?/g,"")),b.scope(()=>{l=="number"&&(u||(t=t.replace(/^0(\d+)/g,"$1").replace(/^-0(\d+)/g,"-$1")))}),b.scope(()=>{let r=t.slice(-1);t&&r!="."&&r!="-"&&(b.is.exist(e.min)&&(t=String(Math.max(Number(t),Number(e.min)))),b.is.exist(e.max)&&(t=String(Math.min(Number(t),Number(e.max)))))}),b.scope(()=>{if(!t||t=="-"||l!="digitNumber")return;let r=Number(t)<0,f=String(Math.abs(Math.round(Number(t)))),C=t.split("."),y=[];for(let g=f.length-1;g>=0;g--){y.unshift(f[g]);let m=f.length-1-g+1;g!=0&&m%3==0&&y.unshift(",")}t=y.join(""),r&&(t="-"+t),(C==null?void 0:C.length)==2&&(t+="."+C[1]||"")})});let p=t;return l=="digitNumber"||(l=="postal"?t.length>=4&&(p=t.clip(0,3)+"-"+t.clip(3)):l=="creditCard"&&(p=t.replace(/.{4}(?=.)/g,"$& "))),t=t.replace(/,/g,""),{formatValue:p,dataValue:t}}},Shallow:e=>{let{rootStates:l,val_status:o}=e,u=o.dataValue||"";X(()=>{b.scope(()=>ae(void 0,null,function*(){if(!l.multiline)return;let f=b('[data-input-origin="'+o.componentID+'"]'),C=b('[data-input-shallow="'+o.componentID+'"]'),y=b('[data-input-min-height-value-shallow="'+o.componentID+'"]'),g=b('[data-input-max-height-value-shallow="'+o.componentID+'"]');if(!f[0]||!C[0]||!y[0]||!g[0])return;let m=C.position(),_=y.position(),M=g.position(),I=0;l.autoHeight&&(I=m.height),I=Math.max(I,_.height),I=Math.min(I,M.height),f[0].style.height=I+"px"}))},[u]);let a=u||"";(!!u.match(/\n$/)||!u)&&(a+="T");let p="",d="";if(l.multiline){let f=l.minRows||1,C=l.maxRows||100;p=`
|
|
2
2
|
T`.repeat(f-1),d=`
|
|
3
|
-
T`.repeat(C-1)}let
|
|
3
|
+
T`.repeat(C-1)}let r=Te(l);return W(F,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",opacity:"trans",freeCSS:{zIndex:3,pointerEvents:"none"},children:[n(j.Description,s(i({className:l.className},r),{position:"absolute",width:1,freeCSS:s(i({},r.freeCSS),{color:"orange"}),"data-input-shallow":o.componentID,children:n(F,{"data-input-value-shallow":o.componentID,children:a})})),n(j.Description,s(i({className:l.className},r),{position:"absolute",left:0,freeCSS:s(i({},r.freeCSS),{backgroundColor:"transparent",color:"blue"}),"data-input-min-height-value-shallow":o.componentID,children:p})),n(j.Description,s(i({className:l.className},r),{position:"absolute",right:0,freeCSS:s(i({},r.freeCSS),{backgroundColor:"transparent",color:"red"}),"data-input-max-height-value-shallow":o.componentID,children:d}))]})},InputBox:e=>{let{rootStates:l,val_validate:o,set_validate:u,val_status:a,set_status:t,val_focus:p,set_focus:d,val_isComposing:r,set_isComposing:f}=e;if(l.multiline)return null;let te=l,{componentID:C,tone:y,required:g,restrict:m="text",form:_,autoComplete:M="off",autoCapitalize:I="off",minRows:oe,maxRows:re,multiline:se,autoHeight:ue,enableFormSubmit:O,clearButton:me=!1,allowDecimals:$,allowZeroStart:H,checkValidationAtFirst:K,onChange:q,onKeyDown:J,onValidate:ce,onUpdateValue:pe,onUpdateValidValue:de,value:fe="",leftIndicator:ge,rightIndicator:xe,leftIcon:he,rightIcon:be,maxLength:S,min:P,max:B,label:V,isLabelActive:Q,defaultValidation:ee,wrapStyles:Le}=te,c=G(te,["componentID","tone","required","restrict","form","autoComplete","autoCapitalize","minRows","maxRows","multiline","autoHeight","enableFormSubmit","clearButton","allowDecimals","allowZeroStart","checkValidationAtFirst","onChange","onKeyDown","onValidate","onUpdateValue","onUpdateValidValue","value","leftIndicator","rightIndicator","leftIcon","rightIcon","maxLength","min","max","label","isLabelActive","defaultValidation","wrapStyles"]),Ie=m=="password"||m=="concealed"?"password":"text",Se=["number","digitNumber","creditCard"].includes(m)?"numeric":m=="email"?"email":"text";return n(F,s(i({htmlTag:"input",type:Ie,inputMode:Se,"data-disabled":l.disabled,"data-show-validation":U.isShowValidation(o,a,!!K),"data-component-id":a.componentID,"data-input-origin":a.componentID,value:a.formatValue,autoComplete:M,autoCapitalize:I,onKeyDown:x=>{let{key:T,target:E}=x;{let D=E,{selectionStart:k,selectionEnd:v}=D,A=Number(k),z=Number(v),N=a.formatValue[Number(A)],Y=a.formatValue[Number(A)-1];T=="Delete"&&(m=="creditCard"&&N==" "||m=="postal"&&N=="-"||m=="digitNumber"&&N==",")&&(D.setSelectionRange(A+1,z+1),x.preventDefault()),T=="Backspace"&&(m=="creditCard"&&Y==" "||m=="postal"&&Y=="-"||m=="digitNumber"&&Y==",")&&(D.setSelectionRange(A-1,z-1),x.preventDefault()),T=="Enter"||T=="Tab"}b.scope(()=>{["number","digitNumber","creditCard"].includes(m)&&T=="Clear"&&t(D=>s(i({},D),{dataValue:"",formatValue:"",eventType:"update",eventID:L()}))}),b.scope(()=>{var z;if(!["number","digitNumber"].includes(m)||!["ArrowUp","ArrowDown"].includes(T))return;let D=+(T=="ArrowUp")*2-1,k=a.dataValue.slice(-1),v=a.dataValue,A=((z=a.dataValue.split(".")[1])==null?void 0:z.length)||0;if(!k)v+="0";else if(k=="-")v+="0";else if(k==".")v+="0";else if(A){let N=Number(k)+D;v=v.slice(0,-1),N<0?v+="9":N>9?v+="0":v+=String(N)}else v=String(Number(a.dataValue.replace(/,/g,""))+D);o.ok&&u({ok:!1,notice:[]}),t(N=>s(i(i({},N),R.Validation.DataLeveling({allowDecimals:$,allowZeroStart:H,min:P,max:B,restrict:m,value:v})),{eventType:"update",eventID:L()})),x.preventDefault()}),J&&J(x),O&&U.SubmitForm(x,_)},onChange:x=>{let{value:T,selectionStart:E,selectionEnd:D}=x.target,k=R.Validation.DataLeveling({allowDecimals:$,allowZeroStart:H,min:P,max:B,restrict:m,value:T});r&&(k.formatValue=T),k.formatValue!=a.formatValue&&(o.ok&&u({ok:!1,notice:[]}),t(v=>s(i(i({},v),k),{prevValue:a.formatValue,eventType:"update",eventID:L(),caretFrom:Number(E),caretTo:Number(D)})),q&&q(x))},width:1},c),{onFocus:x=>{c!=null&&c.onFocus&&(c==null||c.onFocus(x)),d(!0)},onBlur:x=>{c!=null&&c.onBlur&&(c==null||c.onBlur(x)),d(!1)},onCompositionStart:x=>{c!=null&&c.onCompositionStart&&(c==null||c.onCompositionStart(x)),f(!0)},onCompositionEnd:x=>{if(c!=null&&c.onCompositionEnd&&(c==null||c.onCompositionEnd(x)),m=="text")return;let T=R.Validation.DataLeveling({allowDecimals:$,allowZeroStart:H,min:P,max:B,restrict:m,value:a.formatValue});t(E=>s(i(i({},E),T),{prevValue:E.formatValue,eventType:"update",eventID:L(),caretFrom:Number(E.formatValue.length+1),caretTo:Number(E.formatValue.length+1)})),f(!1)}}))},TextAreaBox:e=>{let{rootStates:l,val_focus:o,set_focus:u,val_validate:a,set_validate:t,val_status:p,set_status:d,isShallow:r}=e,B=l,{componentID:f,tone:C,required:y,form:g,label:m,isLabelActive:_,minRows:M,maxRows:I,multiline:oe,autoHeight:re,allowDecimals:se,allowZeroStart:ue,enableFormSubmit:O,maxLength:me,checkValidationAtFirst:$,onChange:H,onKeyDown:K,onValidate:q,onUpdateValue:J,onUpdateValidValue:ce,value:pe="",leftIndicator:de,rightIndicator:fe,leftIcon:ge,rightIcon:xe,defaultValidation:he,wrapStyles:be}=B,S=G(B,["componentID","tone","required","form","label","isLabelActive","minRows","maxRows","multiline","autoHeight","allowDecimals","allowZeroStart","enableFormSubmit","maxLength","checkValidationAtFirst","onChange","onKeyDown","onValidate","onUpdateValue","onUpdateValidValue","value","leftIndicator","rightIndicator","leftIcon","rightIcon","defaultValidation","wrapStyles"]);return!l.multiline?null:n(F,s(i({htmlTag:"textarea","data-show-validation":U.isShowValidation(a,p,!!$),"data-input-origin":p.componentID,"data-component-id":p.componentID,value:p.dataValue,width:1},S),{onFocus:V=>{S!=null&&S.onFocus&&(S==null||S.onFocus(V)),u(!0)},onBlur:V=>{S!=null&&S.onBlur&&(S==null||S.onBlur(V)),u(!1)},onKeyDown:V=>{K&&K(V),O&&U.SubmitForm(V,g)},onChange:V=>{let{value:Q}=V.target;a.ok&&t({ok:!1,notice:[]}),d(ee=>s(i({},ee),{dataValue:Q,eventType:"update",eventID:L()})),H&&H(V)}}))}},Ee=e=>{let{componentID:l,restrict:o="text",value:u="",min:a,max:t,allowDecimals:p,allowZeroStart:d}=e,[r,f]=Z(!1),[C,y]=Z(!1),[g,m]=Z(s(i({componentID:l},R.Validation.DataLeveling({allowDecimals:p,allowZeroStart:d,min:a,max:t,restrict:o,value:u})),{prevValue:"",eventType:"init",eventID:L(),caretFrom:null,caretTo:null})),[_,M]=Z({ok:!1,notice:[]}),I={rootStates:e,val_focus:r,set_focus:f,val_isComposing:C,set_isComposing:y,val_status:g,set_status:m,val_validate:_,set_validate:M};return U.CommonEffects({type:"textfield",states:e,val_status:g,set_status:m,val_validate:_,set_validate:M,SystemValidation:R.Validation.System,ExtraOverrideStates:i({},R.Validation.DataLeveling({allowDecimals:p,allowZeroStart:d,min:a,max:t,restrict:o,value:u}))}),X(()=>{R.setSelection({id:e.id,restrict:o,val_status:g})},[g]),W(De,{val_status:g,set_status:m,val_validate:_,states:I.rootStates,children:[n(Ne,{componentID:e.componentID,fontSize:e.fontSize,required:e.required,label:e.label,isActive:e.isLabelActive||r||!!g.dataValue}),n(R.Shallow,i({},I)),n(R.InputBox,i({},I)),n(R.TextAreaBox,i({},I))]})},w=e=>(e=i({autoHeight:!0,restrict:"text",fontSize:"inherit"},e),e.multiline?(e.minRows=e.minRows||5,e.maxRows=e.maxRows||20):(e.minRows=1,e.maxRows=1),n(Ve,{componentID:e.componentID,children:Ee,states:ke(e)})),h=w;h.Validate=R.Validation.Text,h.Katakana=e=>n(w,s(i({},e),{restrict:"katakana",multiline:!1,autoHeight:!1})),h.HankakuKatakana=e=>n(w,s(i({},e),{restrict:"hankaku.katakana",multiline:!1,autoHeight:!1})),h.CreditCard=e=>n(w,s(i({},e),{restrict:"creditCard",multiline:!1,autoHeight:!1})),h.Tel=e=>n(w,s(i({},e),{restrict:"tel",multiline:!1,autoHeight:!1})),h.Number=e=>n(w,s(i({},e),{restrict:"number",multiline:!1,autoHeight:!1})),h.DigitNumber=e=>n(w,s(i({},e),{restrict:"digitNumber",multiline:!1,autoHeight:!1})),h.Email=e=>n(w,s(i({},e),{restrict:"email",multiline:!1,autoHeight:!1})),h.Url=e=>n(w,s(i({},e),{restrict:"url",multiline:!1,autoHeight:!1})),h.Postal=e=>{let[l]=Z(L());return X(()=>()=>{ve.delete(l)},[]),n(w,s(i({label:"\u90F5\u4FBF\u756A\u53F7"},e),{restrict:"postal",multiline:!1,autoHeight:!1,leftIcon:n(Fe,{ssSphere:2,fontColor:"4.thin",children:"\u3012"})}))},h.Password=e=>{let l=e.componentID||L();return n(w,s(i({label:"\u30D1\u30B9\u30EF\u30FC\u30C9",rightIcon:n(ie,{ssSphere:2,padding:0,freeCSS:{pointerEvents:"all"},children:n(we.Sub,{ssSphere:2,borderRadius:"3.tone.tertiary",fontColor:"theme",flexCenter:!0,height:1,ssEffectsOnActive:["expand"],onMouseOver:o=>{le.open(o.currentTarget,"\u30C6\u30AD\u30B9\u30C8\u3092\u8868\u793A",24)},onMouseLeave:le.abort,tabIndex:-1,onClick:o=>{b(o.target).parent().parent().find("input").callback(u=>{let a=u[0];a&&(a.type=a.type==="password"?"text":"password")})},children:n(Re,{icon:ye})})}),restrict:"password"},e),{multiline:!1,autoHeight:!1}))},h.Concealed=e=>n(h.Password,s(i({label:"\u79D8\u5BC6\u9375"},e),{restrict:"concealed"})),h.Money={JPY:e=>n(h.DigitNumber,s(i({rightIcon:n(ie,{ssSphere:2,fontColor:"4.thin",children:"\u5186"})},e),{multiline:!1,autoHeight:!1}))};export{h as TextField,Ee as TextInput,h as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amotify",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.172",
|
|
4
4
|
"description": "UI Component for React,NextJS,esbuild",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "run-p clean build:*",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"@fortawesome/free-solid-svg-icons": "^6.6.0",
|
|
91
91
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
92
92
|
"dotenv": "^16.4.6",
|
|
93
|
-
"jmini": "^0.0.
|
|
93
|
+
"jmini": "^0.0.77",
|
|
94
94
|
"react": "^18.3.1"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|