amotify 0.2.85 → 0.2.86

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