amotify 0.2.91 → 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.
@@ -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<T> & {
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 const Checkbox: List.Methods;
72
- declare const Radio: List.Methods;
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, List, List as default };
96
+ export { List, Checkbox, Radio };
@@ -1 +1 @@
1
- import{b as o,c as C,d as w}from"../../chunk-C5N2D3ZX.js";import{jsx as a}from"react/jsx-runtime";import y,{UUID as P}from"jmini";import{useState as ae}from"react";import{$$fromRoot as se,GenerateHTMLProps as re}from"../../@utils";import{Box as I,Flex as ce,FAI as de,Span as ue}from"../../atoms";import{Button as Ce}from"../Button";import{OptionalInputWrapper as me,BoxWrapper as he,CoreEffects as M}from"./core";import{InputListClasses as g}from"../../@styles/componentClasses";function Se(t){let{value:l,states:n}=t,{type:e,required:d,min:i,max:m}=n;i=i||0,m=m||65535;let s=[],p=l.length;return d&&(p||e=="radio"&&s.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"})),p<i&&s.push({type:"invalid",label:i+"\u500B\u4EE5\u4E0A\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044"}),p>m&&s.push({type:"invalid",label:m+"\u500B\u307E\u3067\u9078\u629E\u3067\u304D\u307E\u3059"}),{ok:!s.filter(({type:V})=>V=="invalid").length,notice:s}}const S={OptionalListWrapper:t=>{let{value:l,options:n=[]}=t,e=y.is.exist(l)?y.flatArray(l):[],d=[];return e.forEach(i=>{n.findIndex(s=>y.is.equal(s.value,i))!=-1&&d.push(i)}),a(S.Core,C(o({},t),{value:d,options:n}))},Core:t=>{let _=t,{type:l,tone:n,required:e,componentID:d="",form:i,override:m,icon:s,iconType:p,iconSize:V,iconPosition:O,iconColor:v,CustomIcon:$,enableFormSubmit:J,checkValidationAtFirst:W,onValidate:X,onUpdateValue:L,onUpdateValidValue:U,value:z,options:K,className:b,cellStyles:q,cellClassName:H,cellCheckedStyles:j,cellCheckedClassName:G,min:Q,max:Y,hideInput:B,freeCSS:u,wrapStyles:N}=_,x=w(_,["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"]),[k,h]=ae(M.DefaultStatus(d,z)),[D,Z]=ae({ok:!1,notice:[]});return M.CommonEffects({type:"list."+l,states:t,val_status:k,set_status:h,val_validate:D,set_validate:Z,SystemValidation:Se}),a(he,{val_status:k,set_status:h,val_validate:D,states:t,children:a(S.List,{rootStates:t,val_status:k,set_status:h})})},List:t=>{let{rootStates:l,val_status:n,set_status:e}=t,{componentID:d,type:i,tone:m,icon:s,iconSize:p,iconColor:V,isChecker:O,options:v,name:$,form:J,tabIndex:W,hideInput:X,disabled:L,className:U,cellStyles:z,cellClassName:K="",cellCheckedStyles:b,cellCheckedClassName:q="",enableFormSubmit:H}=l,{dataValue:j}=n,G=l.CustomIcon,Q=v.map((Y,B)=>{let le=Y,{value:u,label:N,disabled:x,className:k="",checkedStyles:h,checkedClassName:D="",freeCSS:Z}=le,_=w(le,["value","label","disabled","className","checkedStyles","checkedClassName","freeCSS"]),ee=P(),R=j.findIndex(r=>r===u)!=-1,f=o(o({},z),_),F=[g("Label"),K,k];R&&(f=C(o(o(o({},f),b),h),{freeCSS:o(o(o({},f==null?void 0:f.freeCSS),b==null?void 0:b.freeCSS),h==null?void 0:h.freeCSS)}),F=[...F,q,D]);const te=()=>{if(L||x)return;let r=[];if(i=="radio")r=[u];else if(i=="checkbox"||O)if(!R)r=[...n.dataValue,u];else{let c=[...n.dataValue];c.splice(n.dataValue.findIndex(E=>E==u),1),r=c}e(c=>C(o({},c),{dataValue:r,eventType:"update",eventID:P()}))};let oe=[a(ue,{position:"relative",freeCSS:{zIndex:2},flexSizing:0,children:y.is.string(N)?a(I,{children:N}):N},"content")];return s&&oe[l.iconPosition=="right"?"push":"unshift"](a(G,{isChecked:R,iconSize:p,iconColor:V,toggle:te},"icon")),[a(I,{htmlTag:"input",type:i=="radio"?"radio":"checkbox",className:g("Input"),name:"RadioCheckbox-"+$,"data-list-index":d+"-"+B,id:ee,value:String(u),disabled:L||x,checked:R,onFocus:r=>{x||i=="radio"&&(n.dataValue.length||e(c=>C(o({},c),{dataValue:[u],eventType:"update",eventID:P()})))},onChange:()=>{te()},onKeyDown:r=>{let{key:c,shiftKey:E}=r;if((i=="checkbox"||t.rootStates.isChecker)&&c!="Tab"){if(c.match(/Arrow/)){r.preventDefault();let ie=["ArrowLeft","ArrowUp"].includes(c)?-1:1,T=B+ie;T<0?T=v.length-1:T>=v.length&&(T=0),se(`input[data-list-index="${d}-${T}"]`).focus()}}H&&M.SubmitForm(r,J)},tabIndex:W},"List-"+y.Stringify(u)),a(I,C(o({htmlTag:"label","data-disabled":L||x,htmlFor:ee,className:F.join(" "),tabIndex:-1,display:"flex",verticalAlign:"center",flexWrap:!1},f),{children:oe}),"ListTrigger-"+y.Stringify(u))]});return a(ce,{flexSizing:"auto",style:l.style,freeCSS:o({},l.freeCSS),className:[U,g("CellBase"),g("HideInput_"+X),g("IconIndicator_"+!!s),g("Tone_"+m)].join(" "),children:Q})},_Icon:t=>{let l=1.5;return t.iconSize=="small"?l=1.2:t.iconSize=="large"&&(l=2),a(Ce.Normal,{ssPushable:!0,color:"cloud",tabIndex:-1,ssEffectsOnActive:"ripple.cloud",ssSphere:2,freeCSS:{transform:`scale(${l})`},onClick:n=>{n.preventDefault(),n.stopPropagation(),t.toggle()},children:t.children})},RadioIcon:t=>a(S._Icon,C(o({type:"radio"},t),{children:a(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:a(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=>a(S._Icon,C(o({type:"checkbox"},t),{children:a(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:a(de.Check,{transition:"middle",opacity:t.isChecked?"max":"trans",freeCSS:{zIndex:8,width:"100%",height:"100%",transform:t.isChecked?"scale(1)":"scale(.6)"}})})}))},A=t=>{t=t||"checkbox";const l=e=>(e=C(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=S.RadioIcon:e.iconType=="checkbox"&&(e.CustomIcon=S.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=re(e),a(me,{componentID:e.componentID,children:S.OptionalListWrapper,states:e})),n=l;return n.Normal=e=>a(l,o({type:t,tone:"normal",icon:!1},e)),n.Border=e=>a(l,o({type:t,tone:"border"},e)),n.Cloud=e=>a(l,o({type:t,tone:"cloud"},e)),n.Vivid=e=>a(l,o({type:t,tone:"normal",icon:!1,cellCheckedStyles:{backgroundColor:"theme",fontColor:"white"}},e)),n.Simple=e=>a(l,o({type:t,tone:"plain",icon:!1,cellCheckedStyles:{fontColor:"theme"}},e)),n},pe=A("checkbox"),fe=A("radio"),ne=A();export{pe as Checkbox,ne as List,fe as Radio,ne as default};
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 +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 A}from"../Button";import R from"../Tooltips";const it=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))},rt=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(A.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}},W={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(()=>{W.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}},lt=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{rt as BoxWrapper,W as CoreEffects,lt as DefaultBoxishStyles,it as OptionalInputWrapper};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amotify",
3
- "version": "0.2.91",
3
+ "version": "0.2.92",
4
4
  "description": "UI Component for React,NextJS,esbuild",
5
5
  "scripts": {
6
6
  "start": "run-p clean build:*",