amotify 0.2.89 → 0.2.90
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,22 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { InputTypes } from '.';
|
|
1
|
+
import { ReactElement } from '../../@declares';
|
|
3
2
|
import { List } from './List';
|
|
4
3
|
declare namespace Checker {
|
|
5
|
-
type
|
|
4
|
+
type Exclude = 'type' | 'options';
|
|
5
|
+
export type Input = Omit<List.Input<boolean>, Exclude> & {
|
|
6
6
|
label: ReactElement;
|
|
7
|
-
id?: string;
|
|
8
|
-
tabIndex?: number;
|
|
9
|
-
icon?: boolean;
|
|
10
|
-
iconType?: List.IconType;
|
|
11
|
-
iconSize?: List.Size;
|
|
12
|
-
iconPosition?: 'left' | 'right';
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
value?: boolean;
|
|
15
|
-
cellStyles?: StyleTags.PropsNFreeCSS;
|
|
16
|
-
cellClassName?: string;
|
|
17
|
-
cellCheckedStyles?: StyleTags.PropsNFreeCSS;
|
|
18
|
-
cellCheckedClassName?: string;
|
|
19
7
|
};
|
|
8
|
+
export {};
|
|
20
9
|
}
|
|
21
10
|
declare const Checker: (p: Checker.Input) => import("react/jsx-runtime").JSX.Element;
|
|
22
11
|
export { Checker, Checker as default };
|
package/dist/fn/Input/Checker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as t,c as l}from"../../chunk-C5N2D3ZX.js";import{jsx as c}from"react/jsx-runtime";import{Checkbox as a}from"./List";const o=e=>c(a,l(t({icon:!0},e),{type:"checkbox",isChecker:!0,value:!!e.value,options:[{value:!0,label:e.label}]}));export{o as Checker,o as default};
|
package/dist/fn/Input/List.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ declare namespace List {
|
|
|
14
14
|
iconType?: IconType;
|
|
15
15
|
iconSize?: Size;
|
|
16
16
|
iconPosition?: 'left' | 'right';
|
|
17
|
-
|
|
17
|
+
iconColor?: StyleTags.BackgroundColor;
|
|
18
18
|
isChecker?: boolean;
|
|
19
19
|
CustomIcon?: React.FC<CustomIconInput>;
|
|
20
20
|
tabIndex?: number;
|
package/dist/fn/Input/List.js
CHANGED
|
@@ -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,
|
|
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};
|