amotify 0.2.100 → 0.2.102
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/dist/fn/Input/List.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as o,c as m,d as B}from"../../chunk-C5N2D3ZX.js";import{jsx as a}from"react/jsx-runtime";import f,{UUID as w}from"jmini";import{useState as ae}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 M}from"./core";import{InputListClasses as T}from"../../@styles/componentClasses";function Ce(t){let{value:l,states:i}=t,{type:e,required:d,min:n,max:p}=i;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:i=[]}=t,e=f.is.exist(l)?f.flatArray(l):[],d=[];return e.forEach(n=>{i.findIndex(s=>f.is.equal(s.value,n))!=-1&&d.push(n)}),a(h.Core,m(o({},t),{value:d,options:i}))},Core:t=>{let
|
|
1
|
+
import{b as o,c as m,d as B}from"../../chunk-C5N2D3ZX.js";import{jsx as a}from"react/jsx-runtime";import f,{UUID as w}from"jmini";import{useState as ae}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 M}from"./core";import{InputListClasses as T}from"../../@styles/componentClasses";function Ce(t){let{value:l,states:i}=t,{type:e,required:d,min:n,max:p}=i;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:i=[]}=t,e=f.is.exist(l)?f.flatArray(l):[],d=[];return e.forEach(n=>{i.findIndex(s=>f.is.equal(s.value,n))!=-1&&d.push(n)}),a(h.Core,m(o({},t),{value:d,options:i}))},Core:t=>{let D=t,{type:l,tone:i,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}=D,b=B(D,["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"]),[L,C]=ae(M.DefaultStatus(d,_)),[O,Z]=ae({ok:!1,notice:[]});return M.CommonEffects({type:"list."+l,states:t,val_status:L,set_status:C,val_validate:O,set_validate:Z,SystemValidation:Ce}),a(pe,{val_status:L,set_status:C,val_validate:O,states:t,children:a(h.List,{rootStates:t,val_status:L,set_status:C})})},List:t=>{let{rootStates:l,val_status:i,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}=i,G=l.CustomIcon,Q=V.map((Y,E)=>{let le=Y,{value:u,label:N,disabled:b,className:L="",checkedStyles:C,checkedClassName:O="",freeCSS:Z}=le,D=B(le,["value","label","disabled","className","checkedStyles","checkedClassName","freeCSS"]),ee=w(),R=j.findIndex(r=>r===u)!=-1,y=o(o({},_),D),z=[T("Label"),K,L];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)}),z=[...z,q,O]);const te=()=>{if(v||b)return;let r=[];if(n=="radio")r=[u];else if(n=="checkbox"||P)if(!R)r=[...i.dataValue,u];else{let c=[...i.dataValue];c.splice(i.dataValue.findIndex(F=>F==u),1),r=c}e(c=>m(o({},c),{dataValue:r,eventType:"update",eventID:w()}))};let oe=[a(de,{position:"relative",freeCSS:{zIndex:2},flexSizing:0,children:f.is.string(N)?a(I,{children:N}):N},"content")];return s&&oe[l.iconPosition=="right"?"push":"unshift"](a(G,{isChecked:R,iconSize:S,iconColor:k,toggle:te},"icon")),[a(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||b,checked:R,onFocus:r=>{b||n=="radio"&&(i.dataValue.length||e(c=>m(o({},c),{dataValue:[u],eventType:"update",eventID:w()})))},onChange:()=>{te()},onKeyDown:r=>{let{key:c,shiftKey:F}=r;if((n=="checkbox"||t.rootStates.isChecker)&&c!="Tab"){if(c.match(/Arrow/)){r.preventDefault();let ie=["ArrowLeft","ArrowUp"].includes(c)?-1:1,g=E+ie;g<0?g=V.length-1:g>=V.length&&(g=0),ne(`input[data-list-index="${d}-${g}"]`).focus()}}H&&M.SubmitForm(r,A)},tabIndex:$},"List-"+f.Stringify(u)),a(I,m(o({htmlTag:"label","data-disabled":v||b,htmlFor:ee,className:z.join(" "),tabIndex:-1,display:"flex",verticalAlign:"center",flexWrap:!1},y),{children:oe}),"ListTrigger-"+f.Stringify(u))]});return a(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),a(ue.Normal,{ssPushable:!0,color:"cloud",tabIndex:-1,ssEffectsOnActive:"ripple.cloud",ssSphere:2,freeCSS:{transform:`scale(${l})`},onClick:i=>{i.preventDefault(),i.stopPropagation(),t.toggle()},children:t.children})},RadioIcon:t=>a(h._Icon,m(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(.4)"}})})})),CheckboxIcon:t=>a(h._Icon,m(o({type:"checkbox"},t),{children:a(I,{flexCenter:!0,boxShadow:t.isChecked?"0.remark":"none",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(ce.Check,{transition:"middle",opacity:t.isChecked?"max":"trans",freeCSS:{zIndex:8,width:"100%",height:"100%",transform:t.isChecked?"scale(1)":"scale(.5)"}})})}))},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({border:"1.thin",backgroundColor:"layer.1",padding:["1/2",1,"1/2","1/2"]},e.cellStyles),e.cellCheckedStyles=o({borderColor:"theme",fontColor:"theme"},e.cellCheckedStyles)):e.tone=="cloud"&&(e.cellStyles=o({border:"1.thin",backgroundColor:"layer.2",padding:["1/2",1,"1/2","1/2"]},e.cellStyles),e.cellCheckedStyles=o({backgroundColor:"cloud",fontColor:"theme"},e.cellCheckedStyles)),e=se(e),a(me,{componentID:e.componentID,children:h.OptionalListWrapper,states:e})),i=l;return i.Normal=e=>a(l,o({type:t,tone:"normal",icon:!1},e)),i.Border=e=>a(l,o({type:t,tone:"border"},e)),i.Cloud=e=>a(l,o({type:t,tone:"cloud"},e)),i.Vivid=e=>a(l,o({type:t,tone:"normal",icon:!1,cellCheckedStyles:{backgroundColor:"theme",fontColor:"white"}},e)),i.Simple=e=>a(l,o({type:t,tone:"plain",icon:!1,cellCheckedStyles:{fontColor:"theme"}},e)),i},he=J("radio"),Se=J("checkbox"),ye=J();export{Se as Checkbox,ye as List,he as Radio};
|
|
@@ -8,7 +8,7 @@ declare namespace RootViewController {
|
|
|
8
8
|
TopNavigation: React.FC<Flex.Input>;
|
|
9
9
|
SideNavigation: React.FC<Flex.Input>;
|
|
10
10
|
FooterNavigation: React.FC<Flex.Input & {
|
|
11
|
-
baseStyles?: StyleTags.
|
|
11
|
+
baseStyles?: StyleTags.States;
|
|
12
12
|
}>;
|
|
13
13
|
Comps: {
|
|
14
14
|
Button: React.FC<Button>;
|