amotify 0.2.90 → 0.2.92
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 +2 -2
- package/demo/esbuild/public/index.css +1 -1
- package/demo/esbuild/public/index.js +120 -22
- package/dist/@styles/init.css +1 -1
- package/dist/@styles/style.css +1 -1
- package/dist/fn/Input/List.d.ts +32 -10
- package/dist/fn/Input/List.js +1 -1
- package/dist/fn/Input/TextField.js +1 -1
- package/dist/fn/Input/core.js +1 -1
- package/package.json +1 -1
package/dist/fn/Input/List.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare namespace List {
|
|
|
7
7
|
type IconType = Type;
|
|
8
8
|
type Tone = 'normal' | 'border' | 'cloud' | 'plain';
|
|
9
9
|
type Size = 'small' | 'regular' | 'large';
|
|
10
|
-
type Input<T = Value> = InputTypes.CoreInput<
|
|
10
|
+
type Input<T = Value, O = T> = InputTypes.CoreInput<O> & {
|
|
11
11
|
type?: Type;
|
|
12
12
|
tone?: Tone;
|
|
13
13
|
icon?: boolean;
|
|
@@ -56,19 +56,41 @@ declare namespace List {
|
|
|
56
56
|
};
|
|
57
57
|
namespace Methods {
|
|
58
58
|
type Component = {
|
|
59
|
-
<T = Value>(p: Input<Value<T>>): JSX.Element;
|
|
59
|
+
<T = List.Value, O = T>(p: List.Input<List.Value<T>, List.Value<O>>): JSX.Element;
|
|
60
60
|
};
|
|
61
61
|
type FNs = {
|
|
62
|
-
Normal: <T = Value>(p: Input<Value<T>>) => JSX.Element;
|
|
63
|
-
Border: <T = Value>(p: Input<Value<T>>) => JSX.Element;
|
|
64
|
-
Cloud: <T = Value>(p: Input<Value<T>>) => JSX.Element;
|
|
65
|
-
Simple: <T = Value>(p: Input<Value<T>>) => JSX.Element;
|
|
66
|
-
Vivid: <T = Value>(p: Input<Value<T>>) => JSX.Element;
|
|
62
|
+
Normal: <T = List.Value, O = T>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
63
|
+
Border: <T = List.Value, O = T>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
64
|
+
Cloud: <T = List.Value, O = T>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
65
|
+
Simple: <T = List.Value, O = T>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
66
|
+
Vivid: <T = List.Value, O = T>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
type Methods = Methods.Component & Methods.FNs;
|
|
70
70
|
}
|
|
71
|
-
declare
|
|
72
|
-
|
|
71
|
+
declare namespace Radio {
|
|
72
|
+
namespace Methods {
|
|
73
|
+
type Component = {
|
|
74
|
+
<T = List.Value>(p: List.Input<List.Value<T>>): JSX.Element;
|
|
75
|
+
};
|
|
76
|
+
type FNs = {
|
|
77
|
+
Normal: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element;
|
|
78
|
+
Border: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element;
|
|
79
|
+
Cloud: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element;
|
|
80
|
+
Simple: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element;
|
|
81
|
+
Vivid: <T = List.Value>(p: List.Input<List.Value<T>>) => JSX.Element;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
type Methods = Methods.Component & Methods.FNs;
|
|
85
|
+
}
|
|
86
|
+
declare namespace Checkbox {
|
|
87
|
+
namespace Methods {
|
|
88
|
+
type Component = List.Methods.Component;
|
|
89
|
+
type FNs = List.Methods.FNs;
|
|
90
|
+
}
|
|
91
|
+
type Methods = List.Methods;
|
|
92
|
+
}
|
|
93
|
+
declare const Checkbox: Checkbox.Methods;
|
|
94
|
+
declare const Radio: Radio.Methods;
|
|
73
95
|
declare const List: List.Methods;
|
|
74
|
-
export { Checkbox, Radio
|
|
96
|
+
export { List, Checkbox, Radio };
|
package/dist/fn/Input/List.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,c as
|
|
1
|
+
import{b as o,c as m,d as z}from"../../chunk-C5N2D3ZX.js";import{jsx as i}from"react/jsx-runtime";import f,{UUID as B}from"jmini";import{useState as ie}from"react";import{$$fromRoot as ne,GenerateHTMLProps as se}from"../../@utils";import{Box as I,Flex as re,FAI as ce,Span as de}from"../../atoms";import{Button as ue}from"../Button";import{OptionalInputWrapper as me,BoxWrapper as pe,CoreEffects as w}from"./core";import{InputListClasses as T}from"../../@styles/componentClasses";function Ce(t){let{value:l,states:a}=t,{type:e,required:d,min:n,max:p}=a;n=n||0,p=p||65535;let s=[],S=l.length;return d&&(S||e=="radio"&&s.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"})),S<n&&s.push({type:"invalid",label:n+"\u500B\u4EE5\u4E0A\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"}),S>p&&s.push({type:"invalid",label:p+"\u500B\u307E\u3067\u9078\u629E\u3067\u304D\u307E\u3059"}),{ok:!s.filter(({type:k})=>k=="invalid").length,notice:s}}const h={OptionalListWrapper:t=>{let{value:l,options:a=[]}=t,e=f.is.exist(l)?f.flatArray(l):[],d=[];return e.forEach(n=>{a.findIndex(s=>f.is.equal(s.value,n))!=-1&&d.push(n)}),i(h.Core,m(o({},t),{value:d,options:a}))},Core:t=>{let O=t,{type:l,tone:a,required:e,componentID:d="",form:n,override:p,icon:s,iconType:S,iconSize:k,iconPosition:P,iconColor:V,CustomIcon:X,enableFormSubmit:A,checkValidationAtFirst:$,onValidate:W,onUpdateValue:v,onUpdateValidValue:U,value:_,options:K,className:x,cellStyles:q,cellClassName:H,cellCheckedStyles:j,cellCheckedClassName:G,min:Q,max:Y,hideInput:E,freeCSS:u,wrapStyles:N}=O,g=z(O,["type","tone","required","componentID","form","override","icon","iconType","iconSize","iconPosition","iconColor","CustomIcon","enableFormSubmit","checkValidationAtFirst","onValidate","onUpdateValue","onUpdateValidValue","value","options","className","cellStyles","cellClassName","cellCheckedStyles","cellCheckedClassName","min","max","hideInput","freeCSS","wrapStyles"]),[b,C]=ie(w.DefaultStatus(d,_)),[D,Z]=ie({ok:!1,notice:[]});return w.CommonEffects({type:"list."+l,states:t,val_status:b,set_status:C,val_validate:D,set_validate:Z,SystemValidation:Ce}),i(pe,{val_status:b,set_status:C,val_validate:D,states:t,children:i(h.List,{rootStates:t,val_status:b,set_status:C})})},List:t=>{let{rootStates:l,val_status:a,set_status:e}=t,{componentID:d,type:n,tone:p,icon:s,iconSize:S,iconColor:k,isChecker:P,options:V,name:X,form:A,tabIndex:$,hideInput:W,disabled:v,className:U,cellStyles:_,cellClassName:K="",cellCheckedStyles:x,cellCheckedClassName:q="",enableFormSubmit:H}=l,{dataValue:j}=a,G=l.CustomIcon,Q=V.map((Y,E)=>{let le=Y,{value:u,label:N,disabled:g,className:b="",checkedStyles:C,checkedClassName:D="",freeCSS:Z}=le,O=z(le,["value","label","disabled","className","checkedStyles","checkedClassName","freeCSS"]),ee=B(),R=j.findIndex(r=>r===u)!=-1,y=o(o({},_),O),F=[T("Label"),K,b];R&&(y=m(o(o(o({},y),x),C),{freeCSS:o(o(o({},y==null?void 0:y.freeCSS),x==null?void 0:x.freeCSS),C==null?void 0:C.freeCSS)}),F=[...F,q,D]);const te=()=>{if(v||g)return;let r=[];if(n=="radio")r=[u];else if(n=="checkbox"||P)if(!R)r=[...a.dataValue,u];else{let c=[...a.dataValue];c.splice(a.dataValue.findIndex(M=>M==u),1),r=c}e(c=>m(o({},c),{dataValue:r,eventType:"update",eventID:B()}))};let oe=[i(de,{position:"relative",freeCSS:{zIndex:2},flexSizing:0,children:f.is.string(N)?i(I,{children:N}):N},"content")];return s&&oe[l.iconPosition=="right"?"push":"unshift"](i(G,{isChecked:R,iconSize:S,iconColor:k,toggle:te},"icon")),[i(I,{htmlTag:"input",type:n=="radio"?"radio":"checkbox",className:T("Input"),name:"RadioCheckbox-"+X,"data-list-index":d+"-"+E,id:ee,value:String(u),disabled:v||g,checked:R,onFocus:r=>{g||n=="radio"&&(a.dataValue.length||e(c=>m(o({},c),{dataValue:[u],eventType:"update",eventID:B()})))},onChange:()=>{te()},onKeyDown:r=>{let{key:c,shiftKey:M}=r;if((n=="checkbox"||t.rootStates.isChecker)&&c!="Tab"){if(c.match(/Arrow/)){r.preventDefault();let ae=["ArrowLeft","ArrowUp"].includes(c)?-1:1,L=E+ae;L<0?L=V.length-1:L>=V.length&&(L=0),ne(`input[data-list-index="${d}-${L}"]`).focus()}}H&&w.SubmitForm(r,A)},tabIndex:$},"List-"+f.Stringify(u)),i(I,m(o({htmlTag:"label","data-disabled":v||g,htmlFor:ee,className:F.join(" "),tabIndex:-1,display:"flex",verticalAlign:"center",flexWrap:!1},y),{children:oe}),"ListTrigger-"+f.Stringify(u))]});return i(re,{flexSizing:"auto",style:l.style,freeCSS:o({},l.freeCSS),className:[U,T("CellBase"),T("HideInput_"+W),T("IconIndicator_"+!!s),T("Tone_"+p)].join(" "),children:Q})},_Icon:t=>{let l=1.5;return t.iconSize=="small"?l=1.2:t.iconSize=="large"&&(l=2),i(ue.Normal,{ssPushable:!0,color:"cloud",tabIndex:-1,ssEffectsOnActive:"ripple.cloud",ssSphere:2,freeCSS:{transform:`scale(${l})`},onClick:a=>{a.preventDefault(),a.stopPropagation(),t.toggle()},children:t.children})},RadioIcon:t=>i(h._Icon,m(o({type:"radio"},t),{children:i(I,{flexCenter:!0,isRounded:!0,border:t.isChecked?"0.trans":"3.thick",borderColor:t.isChecked?t.iconColor:"3.thick",position:"relative",transition:"middle",freeCSS:{width:"50%",height:"50%"},children:i(I,{position:"absolute",transition:"middle",isRounded:!0,backgroundColor:t.iconColor,opacity:t.isChecked?"max":"trans",freeCSS:{width:"60%",height:"60%",transform:t.isChecked?"scale(1)":"scale(.6)"}})})})),CheckboxIcon:t=>i(h._Icon,m(o({type:"checkbox"},t),{children:i(I,{flexCenter:!0,border:t.isChecked?"0.trans":"3.thick",backgroundColor:t.isChecked?t.iconColor:"trans",position:"relative",transition:"middle",fontColor:"white",freeCSS:{borderRadius:"25%",padding:"4%",width:"50%",height:"50%"},children:i(ce.Check,{transition:"middle",opacity:t.isChecked?"max":"trans",freeCSS:{zIndex:8,width:"100%",height:"100%",transform:t.isChecked?"scale(1)":"scale(.6)"}})})}))},J=t=>{t=t||"checkbox";const l=e=>(e=m(o({gap:1,icon:!0,iconSize:"regular",iconType:t=="radio"?"radio":"checkbox",iconPosition:"left",iconColor:"theme"},e),{type:t,cellStyles:o({gap:"1/6",position:"relative",borderRadius:"2.tone.secondary",transition:"middle"},e.cellStyles)}),e.CustomIcon||(e.iconType=="radio"?e.CustomIcon=h.RadioIcon:e.iconType=="checkbox"&&(e.CustomIcon=h.CheckboxIcon)),e.iconSize=="small"?e.cellStyles.gap=0:e.iconSize=="large"&&(e.cellStyles.gap="1/2"),e.tone=="normal"?(e.cellStyles=o({padding:["1/4",1],border:"1.thin",backgroundColor:"layer.1"},e.cellStyles),e.cellCheckedStyles=o({borderColor:"theme",fontColor:"theme",boxShadow:"1.normal"},e.cellCheckedStyles)):e.tone=="border"?(e.cellStyles=o({paddingRight:1,border:"1.thin",backgroundColor:"layer.1",padding:"1/2"},e.cellStyles),e.cellCheckedStyles=o({borderColor:"theme",fontColor:"theme"},e.cellCheckedStyles)):e.tone=="cloud"&&(e.cellStyles=o({paddingRight:1,border:"1.thin",backgroundColor:"layer.2",padding:"1/2"},e.cellStyles),e.cellCheckedStyles=o({backgroundColor:"cloud",fontColor:"theme"},e.cellCheckedStyles)),e=se(e),i(me,{componentID:e.componentID,children:h.OptionalListWrapper,states:e})),a=l;return a.Normal=e=>i(l,o({type:t,tone:"normal",icon:!1},e)),a.Border=e=>i(l,o({type:t,tone:"border"},e)),a.Cloud=e=>i(l,o({type:t,tone:"cloud"},e)),a.Vivid=e=>i(l,o({type:t,tone:"normal",icon:!1,cellCheckedStyles:{backgroundColor:"theme",fontColor:"white"}},e)),a.Simple=e=>i(l,o({type:t,tone:"plain",icon:!1,cellCheckedStyles:{fontColor:"theme"}},e)),a},he=J("checkbox"),Se=J("radio"),ye=J();export{he as Checkbox,ye as List,Se as Radio};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{b as l,c as s,d as q,e as ae}from"../../chunk-C5N2D3ZX.js";import{Fragment as le,jsx as o,jsxs as $}from"react/jsx-runtime";import w,{UUID as _}from"jmini";import{useState as L,useEffect as J}from"react";import{$$fromRoot as Ie,useStore as ve,ExtractStyles as Se}from"../../@utils";import{Box as V,FAI as Te}from"../../atoms";import{Text as Y}from"../../mols";import{Tips as ie,Button as Ce}from"..";import{faEye as Re}from"@fortawesome/free-solid-svg-icons/faEye";import{OptionalInputWrapper as ye,BoxWrapper as we,CoreEffects as M,DefaultBoxishStyles as Ve}from"./core";import{InputLabel as De}from"./Label";import{LeftIcon as ke,RightIcon as ne}from".";const Fe={number:{reg:/^-?[0-9\.]+$/g,exist:!0,reason:"\u534A\u89D2\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"},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"},digitNumber:{reg:/^-?[0-9\.]+$/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:$(le,{children:[o(V,{children:"\u25CB\u25CB\u25CB\u25CB@\u25CB\u25CB\u25CB\u25CB.\u25CB\u25CB\u25CB\u306E\u5F62\u5F0F\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),o(V,{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:$(le,{children:[o(V,{children:"0\u304B\u3089\u59CB\u307E\u308B\u756A\u53F7\u306E\u307F\u5165\u529B\u53EF\u80FD\u3067\u3059"}),o(V,{children:"9~12\u6841\u306E\u6570\u5B57\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),o(V,{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"}},D={setSelection:e=>{let{id:a,restrict:r,val_status:t}=e,n=Ie("#"+a)[0];if(n&&t.prevValue&&t.formatValue){let{formatValue:u,prevValue:c,caretFrom:i,caretTo:m}=t;if(r=="creditCard")u.length>=c.length&&i%5==0&&(i++,m++),n.setSelectionRange(i,m);else if(r=="postal")u.length==5&&c.length==3&&(i++,m++),n.setSelectionRange(i,m);else if(r=="digitNumber"){let h=u.length-c.length;h==2&&(i++,m++),h==-2&&(i--,m--),n.setSelectionRange(i,m)}}},Validation:{System:e=>{let{value:a,states:r}=e,{restrict:t="text",maxLength:n,multiline:u,required:c}=r,i=[];if(u||(n=n||255),w.is.exist(n)&&a.length>=Number(n)&&i.push({type:"invalid",label:n+"\u5B57\u4EE5\u5185\u3067\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),a){let m=D.Validation.Text(a,t);m.ok||i.push({type:"invalid",label:m.body})}else c&&i.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"});return{ok:!i.filter(({type:m})=>m=="invalid").length,notice:i}},Text:(e,a)=>{let r={ok:!0,body:""};return(()=>{let t=Fe[a];if(!t)return;let n=t.reason;if(t){let u=!!(+!!e.match(t.reg)^+!t.exist);r={ok:u,body:u?"":n}}})(),r},DataLeveling:e=>{let{restrict:a,value:r=""}=e,t=String(r),n=!1;if(["tel","number","digitNumber","test","postal","creditCard"].includes(a)&&(t=t.zen2hanNumber()),a=="katakana"&&(t=t.replace(/[^ァ-ヶー ヲ-゚ ]/ig,"")),a=="hankaku.katakana"&&(t=t.replace(/[^ヲ-゚ ]/ig,"")),["postal","creditCard"].includes(a)&&(t=t.removeLetters()),["number","number.zeroStart","digitNumber"].includes(a)){let c=t[0]=="0";if(t){if(t!="-")if(t=="0-")t="-";else{t[0]=="-"&&(n=!0),t=t.replace(/[^0-9\.]/ig,"");let i=Number(t);i===0&&(n=!1),n&&(i=-1*i),w.is.exist(e.min)&&(i=Math.max(i,Number(e.min))),w.is.exist(e.max)&&(i=Math.min(i,Number(e.max))),t=String(Math.abs(i))}c&&t!="0"&&a=="number.zeroStart"&&(t="0"+t)}}let u=t;if(a=="digitNumber"){if(t&&t!="-"){let c=[];for(let i=t.length-1;i>=0;i--){c.unshift(t[i]);let m=t.length-1-i+1;i!=0&&m%3==0&&c.unshift(",")}u=c.join("")}}else a=="postal"?t.length>=4&&(u=t.clip(0,3)+"-"+t.clip(3)):a=="creditCard"&&(u=t.replace(/.{4}(?=.)/g,"$& "));return["number","digitNumber"].includes(a)&&n&&(t="-"+t,u="-"+u),{formatValue:u,dataValue:t}}}},G={Shallow:e=>{let{rootStates:a,val_status:r}=e,t=r.dataValue||"";J(()=>{w.scope(()=>ae(void 0,null,function*(){if(!a.multiline)return;let h=w('[data-input-origin="'+r.componentID+'"]'),b=w('[data-input-shallow="'+r.componentID+'"]'),k=w('[data-input-min-height-value-shallow="'+r.componentID+'"]'),T=w('[data-input-max-height-value-shallow="'+r.componentID+'"]');if(!h[0]||!b[0]||!k[0]||!T[0])return;let d=b.position(),C=k.position(),A=T.position(),R=0;a.autoHeight&&(R=d.height),R=Math.max(R,C.height),R=Math.min(R,A.height),h[0].style.height=R+"px"}))},[t]);let n=t||"";(!!t.match(/\n$/)||!t)&&(n+="T");let c="",i="";if(a.multiline){let h=a.minRows||1,b=a.maxRows||100;c=`
|
|
2
2
|
T`.repeat(h-1),i=`
|
|
3
|
-
T`.repeat(b-1)}let m=Se(a);return $(V,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",opacity:"trans",freeCSS:{zIndex:3,pointerEvents:"none"},children:[o(Y.Description,s(l({className:a.className},m),{position:"absolute",width:1,freeCSS:s(l({},m.freeCSS),{color:"orange"}),"data-input-shallow":r.componentID,children:o(V,{"data-input-value-shallow":r.componentID,children:n})})),o(Y.Description,s(l({className:a.className},m),{position:"absolute",left:0,freeCSS:s(l({},m.freeCSS),{backgroundColor:"transparent",color:"blue"}),"data-input-min-height-value-shallow":r.componentID,children:c})),o(Y.Description,s(l({className:a.className},m),{position:"absolute",right:0,freeCSS:s(l({},m.freeCSS),{backgroundColor:"transparent",color:"red"}),"data-input-max-height-value-shallow":r.componentID,children:i}))]})},InputBox:e=>{let{rootStates:a,val_validate:r,set_validate:t,val_status:n,set_status:u,val_focus:c,set_focus:i,val_isComposing:m,set_isComposing:h}=e;if(a.multiline)return null;let ee=a,{componentID:b,tone:k,required:T,restrict:d="text",form:C,autoComplete:A="off",autoCapitalize:R="off",minRows:oe,maxRows:re,multiline:X,autoHeight:se,enableFormSubmit:U,clearButton:P=!1,checkValidationAtFirst:B,onChange:K,onKeyDown:W,onValidate:ue,onUpdateValue:me,onUpdateValidValue:pe,value:ce="",leftIndicator:de,rightIndicator:fe,leftIcon:ge,rightIcon:x,maxLength:xe,min:E,max:I,label:j,isLabelActive:Q,wrapStyles:_e}=ee,p=q(ee,["componentID","tone","required","restrict","form","autoComplete","autoCapitalize","minRows","maxRows","multiline","autoHeight","enableFormSubmit","clearButton","checkValidationAtFirst","onChange","onKeyDown","onValidate","onUpdateValue","onUpdateValidValue","value","leftIndicator","rightIndicator","leftIcon","rightIcon","maxLength","min","max","label","isLabelActive","wrapStyles"]),he=d=="password"||d=="concealed"?"password":"text",be=["number","digitNumber","creditCard"].includes(d)?"numeric":d=="email"?"email":"text";return o(V,s(l({htmlTag:"input",type:he,inputMode:be,"data-disabled":a.disabled,"data-show-validation":M.isShowValidation(r,n,!!B),"data-component-id":n.componentID,"data-input-origin":n.componentID,value:n.formatValue,autoComplete:A,autoCapitalize:R,onKeyDown:f=>{let{key:v,target:F}=f;{let y=F,{selectionStart:N,selectionEnd:H}=y,z=Number(N),te=Number(H),Z=n.formatValue[Number(z)],O=n.formatValue[Number(z)-1];v=="Delete"&&(d=="creditCard"&&Z==" "||d=="postal"&&Z=="-"||d=="digitNumber"&&Z==",")&&(y.setSelectionRange(z+1,te+1),f.preventDefault()),v=="Backspace"&&(d=="creditCard"&&O==" "||d=="postal"&&O=="-"||d=="digitNumber"&&O==",")&&(y.setSelectionRange(z-1,te-1),f.preventDefault()),v=="Enter"||v=="Tab"}if(["number","digitNumber","creditCard"].includes(d)&&v=="Clear"&&u(y=>s(l({},y),{dataValue:"",formatValue:"",eventType:"update",eventID:_()})),["number","digitNumber"].includes(d)&&["ArrowUp","ArrowDown"].includes(v)){let y=+(v=="ArrowUp")*2-1,N=String(Number(n.dataValue)+y);r.ok&&t({ok:!1,notice:[]}),u(H=>s(l(l({},H),D.Validation.DataLeveling({min:E,max:I,restrict:d,value:N})),{eventType:"update",eventID:_()})),f.preventDefault()}W&&W(f),U&&M.SubmitForm(f,C)},onChange:f=>{let{value:v,selectionStart:F,selectionEnd:y}=f.target,N=D.Validation.DataLeveling({min:E,max:I,restrict:d,value:v});m&&(N.formatValue=v),N.formatValue!=n.formatValue&&(r.ok&&t({ok:!1,notice:[]}),u(H=>s(l(l({},H),N),{prevValue:n.formatValue,eventType:"update",eventID:_(),caretFrom:Number(F),caretTo:Number(y)})),K&&K(f))},width:1},p),{onFocus:f=>{p!=null&&p.onFocus&&(p==null||p.onFocus(f)),i(!0)},onBlur:f=>{p!=null&&p.onBlur&&(p==null||p.onBlur(f)),i(!1)},onCompositionStart:f=>{p!=null&&p.onCompositionStart&&(p==null||p.onCompositionStart(f)),h(!0)},onCompositionEnd:f=>{if(p!=null&&p.onCompositionEnd&&(p==null||p.onCompositionEnd(f)),d=="text")return;let v=D.Validation.DataLeveling({min:E,max:I,restrict:d,value:n.formatValue});u(F=>s(l(l({},F),v),{prevValue:F.formatValue,eventType:"update",eventID:_(),caretFrom:Number(F.formatValue.length+1),caretTo:Number(F.formatValue.length+1)})),h(!1)}}))},TextAreaBox:e=>{let{rootStates:a,val_focus:r,set_focus:t,val_validate:n,set_validate:u,val_status:c,set_status:i,isShallow:m}=e,E=a,{componentID:h,tone:b,required:k,form:T,label:d,isLabelActive:C,minRows:A,maxRows:R,multiline:oe,autoHeight:re,enableFormSubmit:X,maxLength:se,checkValidationAtFirst:U,onChange:P,onKeyDown:B,onValidate:K,onUpdateValue:W,onUpdateValidValue:ue,value:me="",leftIndicator:pe,rightIndicator:ce,leftIcon:de,rightIcon:fe,wrapStyles:ge}=E,x=q(E,["componentID","tone","required","form","label","isLabelActive","minRows","maxRows","multiline","autoHeight","enableFormSubmit","maxLength","checkValidationAtFirst","onChange","onKeyDown","onValidate","onUpdateValue","onUpdateValidValue","value","leftIndicator","rightIndicator","leftIcon","rightIcon","wrapStyles"]);return!a.multiline?null:o(V,s(l({htmlTag:"textarea","data-show-validation":M.isShowValidation(n,c,!!U),"data-input-origin":c.componentID,"data-component-id":c.componentID,value:c.dataValue,width:1},x),{onFocus:I=>{x!=null&&x.onFocus&&(x==null||x.onFocus(I)),t(!0)},onBlur:I=>{x!=null&&x.onBlur&&(x==null||x.onBlur(I)),t(!1)},onKeyDown:I=>{B&&B(I),X&&M.SubmitForm(I,T)},onChange:I=>{let{value:j}=I.target;n.ok&&u({ok:!1,notice:[]}),i(Q=>s(l({},Q),{dataValue:j,eventType:"update",eventID:_()})),P&&P(I)}}))}},Ne=e=>{let{componentID:a,restrict:r="text",value:t="",min:n,max:u}=e,[c,i]=L(!1),[m,h]=L(!1),[b,k]=L(s(l({componentID:a},D.Validation.DataLeveling({min:n,max:u,restrict:r,value:t})),{prevValue:"",eventType:"init",eventID:_(),caretFrom:null,caretTo:null})),[T,d]=L({ok:!1,notice:[]}),C={rootStates:e,val_focus:c,set_focus:i,val_isComposing:m,set_isComposing:h,val_status:b,set_status:k,val_validate:T,set_validate:d};return M.CommonEffects({type:"textfield",states:e,val_status:b,set_status:k,val_validate:T,set_validate:d,SystemValidation:D.Validation.System,ExtraOverrideStates:l({},D.Validation.DataLeveling({min:n,max:u,restrict:r,value:t}))}),J(()=>{D.setSelection({id:e.id,restrict:r,val_status:b})},[b]),$(we,{val_status:b,set_status:k,val_validate:T,states:C.rootStates,children:[o(De,{componentID:e.componentID,fontSize:e.fontSize,required:e.required,label:e.label,isActive:e.isLabelActive||c||!!b.dataValue}),o(G.Shallow,l({},C)),o(G.InputBox,l({},C)),o(G.TextAreaBox,l({},C))]})},S=e=>(e=l({autoHeight:!0,restrict:"text"
|
|
3
|
+
T`.repeat(b-1)}let m=Se(a);return $(V,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",opacity:"trans",freeCSS:{zIndex:3,pointerEvents:"none"},children:[o(Y.Description,s(l({className:a.className},m),{position:"absolute",width:1,freeCSS:s(l({},m.freeCSS),{color:"orange"}),"data-input-shallow":r.componentID,children:o(V,{"data-input-value-shallow":r.componentID,children:n})})),o(Y.Description,s(l({className:a.className},m),{position:"absolute",left:0,freeCSS:s(l({},m.freeCSS),{backgroundColor:"transparent",color:"blue"}),"data-input-min-height-value-shallow":r.componentID,children:c})),o(Y.Description,s(l({className:a.className},m),{position:"absolute",right:0,freeCSS:s(l({},m.freeCSS),{backgroundColor:"transparent",color:"red"}),"data-input-max-height-value-shallow":r.componentID,children:i}))]})},InputBox:e=>{let{rootStates:a,val_validate:r,set_validate:t,val_status:n,set_status:u,val_focus:c,set_focus:i,val_isComposing:m,set_isComposing:h}=e;if(a.multiline)return null;let ee=a,{componentID:b,tone:k,required:T,restrict:d="text",form:C,autoComplete:A="off",autoCapitalize:R="off",minRows:oe,maxRows:re,multiline:X,autoHeight:se,enableFormSubmit:U,clearButton:P=!1,checkValidationAtFirst:B,onChange:K,onKeyDown:W,onValidate:ue,onUpdateValue:me,onUpdateValidValue:pe,value:ce="",leftIndicator:de,rightIndicator:fe,leftIcon:ge,rightIcon:x,maxLength:xe,min:E,max:I,label:j,isLabelActive:Q,wrapStyles:_e}=ee,p=q(ee,["componentID","tone","required","restrict","form","autoComplete","autoCapitalize","minRows","maxRows","multiline","autoHeight","enableFormSubmit","clearButton","checkValidationAtFirst","onChange","onKeyDown","onValidate","onUpdateValue","onUpdateValidValue","value","leftIndicator","rightIndicator","leftIcon","rightIcon","maxLength","min","max","label","isLabelActive","wrapStyles"]),he=d=="password"||d=="concealed"?"password":"text",be=["number","digitNumber","creditCard"].includes(d)?"numeric":d=="email"?"email":"text";return o(V,s(l({htmlTag:"input",type:he,inputMode:be,"data-disabled":a.disabled,"data-show-validation":M.isShowValidation(r,n,!!B),"data-component-id":n.componentID,"data-input-origin":n.componentID,value:n.formatValue,autoComplete:A,autoCapitalize:R,onKeyDown:f=>{let{key:v,target:F}=f;{let y=F,{selectionStart:N,selectionEnd:H}=y,z=Number(N),te=Number(H),Z=n.formatValue[Number(z)],O=n.formatValue[Number(z)-1];v=="Delete"&&(d=="creditCard"&&Z==" "||d=="postal"&&Z=="-"||d=="digitNumber"&&Z==",")&&(y.setSelectionRange(z+1,te+1),f.preventDefault()),v=="Backspace"&&(d=="creditCard"&&O==" "||d=="postal"&&O=="-"||d=="digitNumber"&&O==",")&&(y.setSelectionRange(z-1,te-1),f.preventDefault()),v=="Enter"||v=="Tab"}if(["number","digitNumber","creditCard"].includes(d)&&v=="Clear"&&u(y=>s(l({},y),{dataValue:"",formatValue:"",eventType:"update",eventID:_()})),["number","digitNumber"].includes(d)&&["ArrowUp","ArrowDown"].includes(v)){let y=+(v=="ArrowUp")*2-1,N=String(Number(n.dataValue)+y);r.ok&&t({ok:!1,notice:[]}),u(H=>s(l(l({},H),D.Validation.DataLeveling({min:E,max:I,restrict:d,value:N})),{eventType:"update",eventID:_()})),f.preventDefault()}W&&W(f),U&&M.SubmitForm(f,C)},onChange:f=>{let{value:v,selectionStart:F,selectionEnd:y}=f.target,N=D.Validation.DataLeveling({min:E,max:I,restrict:d,value:v});m&&(N.formatValue=v),N.formatValue!=n.formatValue&&(r.ok&&t({ok:!1,notice:[]}),u(H=>s(l(l({},H),N),{prevValue:n.formatValue,eventType:"update",eventID:_(),caretFrom:Number(F),caretTo:Number(y)})),K&&K(f))},width:1},p),{onFocus:f=>{p!=null&&p.onFocus&&(p==null||p.onFocus(f)),i(!0)},onBlur:f=>{p!=null&&p.onBlur&&(p==null||p.onBlur(f)),i(!1)},onCompositionStart:f=>{p!=null&&p.onCompositionStart&&(p==null||p.onCompositionStart(f)),h(!0)},onCompositionEnd:f=>{if(p!=null&&p.onCompositionEnd&&(p==null||p.onCompositionEnd(f)),d=="text")return;let v=D.Validation.DataLeveling({min:E,max:I,restrict:d,value:n.formatValue});u(F=>s(l(l({},F),v),{prevValue:F.formatValue,eventType:"update",eventID:_(),caretFrom:Number(F.formatValue.length+1),caretTo:Number(F.formatValue.length+1)})),h(!1)}}))},TextAreaBox:e=>{let{rootStates:a,val_focus:r,set_focus:t,val_validate:n,set_validate:u,val_status:c,set_status:i,isShallow:m}=e,E=a,{componentID:h,tone:b,required:k,form:T,label:d,isLabelActive:C,minRows:A,maxRows:R,multiline:oe,autoHeight:re,enableFormSubmit:X,maxLength:se,checkValidationAtFirst:U,onChange:P,onKeyDown:B,onValidate:K,onUpdateValue:W,onUpdateValidValue:ue,value:me="",leftIndicator:pe,rightIndicator:ce,leftIcon:de,rightIcon:fe,wrapStyles:ge}=E,x=q(E,["componentID","tone","required","form","label","isLabelActive","minRows","maxRows","multiline","autoHeight","enableFormSubmit","maxLength","checkValidationAtFirst","onChange","onKeyDown","onValidate","onUpdateValue","onUpdateValidValue","value","leftIndicator","rightIndicator","leftIcon","rightIcon","wrapStyles"]);return!a.multiline?null:o(V,s(l({htmlTag:"textarea","data-show-validation":M.isShowValidation(n,c,!!U),"data-input-origin":c.componentID,"data-component-id":c.componentID,value:c.dataValue,width:1},x),{onFocus:I=>{x!=null&&x.onFocus&&(x==null||x.onFocus(I)),t(!0)},onBlur:I=>{x!=null&&x.onBlur&&(x==null||x.onBlur(I)),t(!1)},onKeyDown:I=>{B&&B(I),X&&M.SubmitForm(I,T)},onChange:I=>{let{value:j}=I.target;n.ok&&u({ok:!1,notice:[]}),i(Q=>s(l({},Q),{dataValue:j,eventType:"update",eventID:_()})),P&&P(I)}}))}},Ne=e=>{let{componentID:a,restrict:r="text",value:t="",min:n,max:u}=e,[c,i]=L(!1),[m,h]=L(!1),[b,k]=L(s(l({componentID:a},D.Validation.DataLeveling({min:n,max:u,restrict:r,value:t})),{prevValue:"",eventType:"init",eventID:_(),caretFrom:null,caretTo:null})),[T,d]=L({ok:!1,notice:[]}),C={rootStates:e,val_focus:c,set_focus:i,val_isComposing:m,set_isComposing:h,val_status:b,set_status:k,val_validate:T,set_validate:d};return M.CommonEffects({type:"textfield",states:e,val_status:b,set_status:k,val_validate:T,set_validate:d,SystemValidation:D.Validation.System,ExtraOverrideStates:l({},D.Validation.DataLeveling({min:n,max:u,restrict:r,value:t}))}),J(()=>{D.setSelection({id:e.id,restrict:r,val_status:b})},[b]),$(we,{val_status:b,set_status:k,val_validate:T,states:C.rootStates,children:[o(De,{componentID:e.componentID,fontSize:e.fontSize,required:e.required,label:e.label,isActive:e.isLabelActive||c||!!b.dataValue}),o(G.Shallow,l({},C)),o(G.InputBox,l({},C)),o(G.TextAreaBox,l({},C))]})},S=e=>(e=l({autoHeight:!0,restrict:"text"},e),e.multiline?(e.minRows=e.minRows||5,e.maxRows=e.maxRows||20):(e.minRows=1,e.maxRows=1),o(ye,{componentID:e.componentID,children:Ne,states:Ve(e)})),g=S;g.Validate=D.Validation.Text,g.Katakana=e=>o(S,s(l({},e),{restrict:"katakana",multiline:!1,autoHeight:!1})),g.HankakuKatakana=e=>o(S,s(l({},e),{restrict:"hankaku.katakana",multiline:!1,autoHeight:!1})),g.CreditCard=e=>o(S,s(l({},e),{restrict:"creditCard",multiline:!1,autoHeight:!1})),g.Tel=e=>o(S,s(l({},e),{restrict:"tel",multiline:!1,autoHeight:!1})),g.Number=e=>o(S,s(l({},e),{restrict:"number",multiline:!1,autoHeight:!1})),g.DigitNumber=e=>o(S,s(l({},e),{restrict:"digitNumber",multiline:!1,autoHeight:!1})),g.Email=e=>o(S,s(l({},e),{restrict:"email",multiline:!1,autoHeight:!1})),g.Url=e=>o(S,s(l({},e),{restrict:"url",multiline:!1,autoHeight:!1})),g.Postal=e=>{let[a]=L(_());return J(()=>()=>{ve.delete(a)},[]),o(S,s(l({label:"\u90F5\u4FBF\u756A\u53F7"},e),{restrict:"postal",multiline:!1,autoHeight:!1,leftIcon:o(ke,{ssSphere:2,fontColor:"4.thin",children:"\u3012"})}))},g.Password=e=>o(S,s(l({label:"\u30D1\u30B9\u30EF\u30FC\u30C9",rightIcon:o(ne,{ssSphere:2,padding:0,freeCSS:{pointerEvents:"all"},children:o(Ce.Sub,{ssSphere:2,borderRadius:"3.tone.tertiary",fontColor:"theme",flexCenter:!0,height:1,ssEffectsOnActive:["expand"],onMouseOver:a=>{ie.open(a.currentTarget,"\u30C6\u30AD\u30B9\u30C8\u3092\u8868\u793A",24)},onMouseLeave:ie.abort,tabIndex:-1,onClick:a=>{w(a.target).parent().parent().find("input").callback(r=>{let t=r[0];t.type=t.type==="password"?"text":"password"})},children:o(Te,{icon:Re})})}),restrict:"password"},e),{multiline:!1,autoHeight:!1})),g.Concealed=e=>o(g.Password,s(l({label:"\u79D8\u5BC6\u9375"},e),{restrict:"concealed"})),g.Money={JPY:e=>o(g.DigitNumber,s(l({rightIcon:o(ne,{ssSphere:2,fontColor:"4.thin",children:"\u5186"})},e),{multiline:!1,autoHeight:!1}))};export{g as TextField,Ne as TextInput,g as default};
|
package/dist/fn/Input/core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,c as u,e as _}from"../../chunk-C5N2D3ZX.js";import{jsx as p,jsxs as h}from"react/jsx-runtime";import{useState as x,useEffect as g}from"react";import c,{UUID as y}from"jmini";import{$$fromRoot as k,Config as B,useStore as v}from"../../@utils";import{InputClasses as b}from"../../@styles/componentClasses";import{Box as E,Flex as w,FAI as T,Column as N}from"../../atoms";import{Row as D,Text as F}from"../../mols";import{Button as
|
|
1
|
+
import{b as o,c as u,e as _}from"../../chunk-C5N2D3ZX.js";import{jsx as p,jsxs as h}from"react/jsx-runtime";import{useState as x,useEffect as g}from"react";import c,{UUID as y}from"jmini";import{$$fromRoot as k,Config as B,useStore as v}from"../../@utils";import{InputClasses as b}from"../../@styles/componentClasses";import{Box as E,Flex as w,FAI as T,Column as N}from"../../atoms";import{Row as D,Text as F}from"../../mols";import{Button as W}from"../Button";import R from"../Tooltips";const et=t=>{let[n]=x(t.componentID||y());t=o({},t),t.states=u(o({enableFormSubmit:!0,status_id:y(),override:"never",form:"",id:y(),"aria-label":"Input-"+n},t.states),{componentID:n});let{children:e}=t;return p(e,o({},t.states))},at=t=>{let{children:n,val_status:e,val_validate:a,states:i}=t,{leftIcon:l,wrapStyles:d}=i;return e.eventType=="init"&&!i.checkValidationAtFirst&&(a.notice=[]),h(D.Center,u(o({position:"relative",verticalAlign:"unset",gap:0},d),{className:b("Wrapper"),"data-notice-uid":e.componentID,children:[p(C.Notice,{notice:a.notice,val_status:e}),i.leftIndicator,h(w,{position:"relative",flexSizing:"auto",children:[n,l,p(C.RightIcon,o({},t)),p(C.ClearButton,o({},t))]}),i.rightIndicator]}))},C={ClearButton:t=>!t.states.clearButton||!t.val_status.dataValue?null:p(W.Normal,{ssSphere:2,flexCenter:!0,fontColor:"5.translucent",ssEffectsOnActive:["ripple.theme"],position:"absolute",right:1,top:"50%",freeCSS:{zIndex:3,transform:"translateY(-50%)"},onClick:()=>{t.set_status(n=>u(o({},n),{dataValue:"",formatValue:"",eventType:"update",eventID:y()}))},children:p(T.Times,{})}),RightIcon:t=>t.states.clearButton&&t.val_status.dataValue?null:t.states.rightIcon,Notice:t=>{let{notice:n,val_status:e}=t,{componentID:a}=e,i="NoticeTimer-"+a,l="NoticeTimerClose-"+a,d="notice-tips-"+a;return g(()=>{c.interval.cycle(i,350,()=>{if(!n.length){R.close(d);return}R.open({tipsID:d,parent:`[data-notice-uid="${a}"]`,gravityPoint:22,padding:[1,0],closeAtParentBlur:!1,content:h(R.Body,{padding:["1/2","2/3"],fontSize:"1.mini",position:"relative",children:[p(E,{position:"absolute",unitHeight:1,unitWidth:1,left:1,backgroundColor:"dark",freeCSS:{zIndex:1,transform:"rotate(45deg)",top:-6}}),p(N,{backgroundColor:"inherit",gap:"1/3",position:"relative",freeCSS:{zIndex:2},children:n.map((I,S)=>{let{type:r,label:s}=I,f=r=="invalid"?T.Times:r=="warn"?T.Exclamation:T.Check;return h(D.Left,{gap:0,borderRadius:"2.tone.secondary",children:[p(f,{flexCenter:!0,fontSize:"2.normal",fontColor:{invalid:"nega",warn:"warn",valid:"posi"}[r]}),p(F.Supplement,{fontSize:"0.xs",fontColor:"white",children:s})]},S+"-"+c.Stringify(I))})})]})})}),c.interval.cycle(l,6e3,()=>{R.close(d)})},[n]),null}},z={DefaultStatus:(t,n)=>({componentID:t,dataValue:n,eventType:"init",eventID:y()}),CommonEffects:function(t){let{type:n,states:e,val_status:a,set_status:i,val_validate:l,set_validate:d,SystemValidation:I}=t;e=o({},e);let{componentID:S}=a;g(()=>(v.update({[S]:{ResolveRefresh:null,Refresh:()=>new Promise((r,s)=>{v.get(S).ResolveRefresh=r,i(f=>u(o({},f),{eventType:"refresh",eventID:y()}))}),GenNotice:r=>{let{ok:s,notice:f}=r;d({ok:s,notice:f})}}}),()=>{v.delete(S)}),[]),c.scope(()=>{let{override:r}=e;if(r=="never"||r=="beforeModified"&&!["init","override"].includes(a.eventType))return;let s=v.get(a.componentID);s&&(e.value!=a.dataValue&&e.status_id!=s.status_id&&i(f=>u(o(u(o({},f),{dataValue:e.value}),t.ExtraOverrideStates),{eventType:"override",eventID:y()})),s.status_id=e.status_id)}),g(()=>{z.ValidationCheck({val_status:a,set_validate:d,SystemValidation:I,states:e})},[a.eventID,a.dataValue]),g(()=>(c.scope(()=>{let{componentID:r,eventType:s,dataValue:f}=a,m=f;if(n=="autocomplete.single"||n=="list.radio"?m=m[0]:e.isChecker&&(m=!!m[0]),e.form=e.form||"testForm",e.name&&e.form&&v.update({[["form-data",e.form].join("-")]:{[e.name]:{componentID:r,type:n,value:m,validation:l.ok}}}),s=="refresh"){let V=v.get(r);V&&V.ResolveRefresh&&V.ResolveRefresh(null)}else s=="update"&&(e.onUpdateValue&&e.onUpdateValue({componentID:r,value:m,eventType:s}),c.scope(()=>{l.ok&&e.onUpdateValidValue&&e.onUpdateValidValue({componentID:r,value:m,eventType:s})}))}),()=>{v.update({[["form-data",e.form].join("-")]:{[e.name]:null}})}),[l])},ValidationCheck:t=>{let{states:n}=t;c.interval.clear("ValidationTimer-"+t.val_status.componentID);let e=t.SystemValidation({value:t.val_status.dataValue,states:n});if(!e.ok){t.set_validate(e);return}let a=e.notice;const i=()=>_(void 0,null,function*(){if(!n.onValidate)return;let l=yield n.onValidate({value:t.val_status.dataValue,eventType:t.val_status.eventType,props:t});t.set_validate({ok:l.ok,notice:[...a,...l.notice]})});if(n.onValidate){if(t.val_status.eventType=="refresh"){i();return}c.interval.run("ValidationTimer-"+t.val_status.componentID,450,i);return}t.set_validate({ok:!0,notice:a})},SubmitForm:(t,n)=>{let e=!1;if(!n)return e;let a=k(`[data-form-submit-button="${n}"]`)[0];if(!a)return e;let i=a.dataset.sdfike||"",l=t.key,d=t.ctrlKey||t.metaKey;return c.scope(()=>{i.includes("enter")&&(l!="Enter"||t.nativeEvent.isComposing||B.get().browserIs=="safari"&&t.keyCode==229)||((l=="Enter"&&(i.includes("enter")||i.includes("auxEnter")&&d)||l==" "&&i.includes("space"))&&(a.click(),t.preventDefault()),e=!0)}),e},isShowValidation:(t,n,e)=>{let a=t.ok;return!e&&n.eventType=="init"&&(a=!0),a}},nt=function(t){t=o({tone:"border"},t);let n=c.scope(()=>{if(t.tone=="plain")return{};let a={padding:"3/4",transition:"middle",flexSizing:"auto",boxShadow:"0.min"};return t.tone=="border"?a=u(o({},a),{border:!0,borderRadius:"2.tone.secondary",backgroundColor:"layer.1"}):t.tone=="cloud"?a=u(o({},a),{border:"1.thin",borderRadius:"2.tone.secondary",backgroundColor:"cloud"}):t.tone=="bottomBorder"&&(a=u(o({},a),{borderRadius:0,border:"unset",borderBottom:!0,backgroundColor:"cloud"})),a});return u(o(o(o(o(o(o({fontColor:"2.normal"},n),!!t.rightIcon&&{paddingRight:3}),!!t.leftIcon&&{paddingLeft:3}),!!t.leftIndicator&&{borderTopLeftRadius:"2/3",borderBottomLeftRadius:"2/3",marginLeft:"1/4"}),!!t.rightIndicator&&{borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",marginRight:"1/4"}),t),{freeCSS:o({letterSpacing:"1px",resize:"none"},t.freeCSS),className:[b("Input"),t.className].join(" ")})};export{at as BoxWrapper,z as CoreEffects,nt as DefaultBoxishStyles,et as OptionalInputWrapper};
|