amotify 0.2.92 → 0.2.93
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.
|
@@ -1584,7 +1584,7 @@ text5`}
|
|
|
1584
1584
|
Input.Radio
|
|
1585
1585
|
<Input.Radio
|
|
1586
1586
|
name='radio'
|
|
1587
|
-
value={
|
|
1587
|
+
value={ 1 }
|
|
1588
1588
|
options={ [
|
|
1589
1589
|
{ value: 1,label: 'Option1' },
|
|
1590
1590
|
{ value: 2,label: 'Option2' },
|
|
@@ -1592,6 +1592,9 @@ text5`}
|
|
|
1592
1592
|
{ value: 4,label: 'Option4' },
|
|
1593
1593
|
{ value: 5,label: 'Option5' },
|
|
1594
1594
|
] }
|
|
1595
|
+
onUpdateValidValue={ ( { value } ) => {
|
|
1596
|
+
|
|
1597
|
+
} }
|
|
1595
1598
|
/>
|
|
1596
1599
|
</Box>
|
|
1597
1600
|
<Box>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactElement } from '../../@declares';
|
|
2
|
-
import {
|
|
2
|
+
import { Checkbox } from './List';
|
|
3
3
|
declare namespace Checker {
|
|
4
4
|
type Exclude = 'type' | 'options';
|
|
5
|
-
export type Input = Omit<
|
|
5
|
+
export type Input = Omit<Checkbox.Input<boolean, boolean>, Exclude> & {
|
|
6
6
|
label: ReactElement;
|
|
7
7
|
};
|
|
8
8
|
export {};
|
package/dist/fn/Input/Checker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as o,c as t}from"../../chunk-C5N2D3ZX.js";import{jsx as n}from"react/jsx-runtime";import{Checkbox as a}from"./List";const l=e=>n(a,t(o({icon:!0},e),{isChecker:!0,value:!!e.value,options:[{value:!0,label:e.label}]}));export{l as Checker,l as default};
|
package/dist/fn/Input/List.d.ts
CHANGED
|
@@ -54,21 +54,9 @@ declare namespace List {
|
|
|
54
54
|
val_status: InputTypes.Status.Plain;
|
|
55
55
|
set_status: React.Dispatch<React.SetStateAction<InputTypes.Status.Plain>>;
|
|
56
56
|
};
|
|
57
|
-
namespace Methods {
|
|
58
|
-
type Component = {
|
|
59
|
-
<T = List.Value, O = T>(p: List.Input<List.Value<T>, List.Value<O>>): JSX.Element;
|
|
60
|
-
};
|
|
61
|
-
type FNs = {
|
|
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
|
-
};
|
|
68
|
-
}
|
|
69
|
-
type Methods = Methods.Component & Methods.FNs;
|
|
70
57
|
}
|
|
71
58
|
declare namespace Radio {
|
|
59
|
+
type Input<T = List.Value> = List.Input<T>;
|
|
72
60
|
namespace Methods {
|
|
73
61
|
type Component = {
|
|
74
62
|
<T = List.Value>(p: List.Input<List.Value<T>>): JSX.Element;
|
|
@@ -84,13 +72,21 @@ declare namespace Radio {
|
|
|
84
72
|
type Methods = Methods.Component & Methods.FNs;
|
|
85
73
|
}
|
|
86
74
|
declare namespace Checkbox {
|
|
75
|
+
type Input<T = List.Value, O = T[]> = List.Input<T, O>;
|
|
87
76
|
namespace Methods {
|
|
88
|
-
type Component =
|
|
89
|
-
|
|
77
|
+
type Component = {
|
|
78
|
+
<T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>): JSX.Element;
|
|
79
|
+
};
|
|
80
|
+
type FNs = {
|
|
81
|
+
Normal: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
82
|
+
Border: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
83
|
+
Cloud: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
84
|
+
Simple: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
85
|
+
Vivid: <T = List.Value, O = T[]>(p: List.Input<List.Value<T>, List.Value<O>>) => JSX.Element;
|
|
86
|
+
};
|
|
90
87
|
}
|
|
91
|
-
type Methods =
|
|
88
|
+
type Methods = Methods.Component & Methods.FNs;
|
|
92
89
|
}
|
|
93
|
-
declare const Checkbox: Checkbox.Methods;
|
|
94
90
|
declare const Radio: Radio.Methods;
|
|
95
|
-
declare const
|
|
91
|
+
declare const Checkbox: Checkbox.Methods;
|
|
96
92
|
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 p,d as B}from"../../chunk-C5N2D3ZX.js";import{jsx as a}from"react/jsx-runtime";import f,{UUID as M}from"jmini";import{useState as le}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 pe,BoxWrapper as me,CoreEffects as w}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:m}=i;n=n||0,m=m||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>m&&s.push({type:"invalid",label:m+"\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,p(o({},t),{value:d,options:i}))},Core:t=>{let R=t,{type:l,tone:i,required:e,componentID:d="",form:n,override:m,icon:s,iconType:S,iconSize:k,iconPosition:J,iconColor:V,CustomIcon:P,enableFormSubmit:X,checkValidationAtFirst:A,onValidate:$,onUpdateValue:v,onUpdateValidValue:W,value:_,options:U,className:g,cellStyles:K,cellClassName:q,cellCheckedStyles:H,cellCheckedClassName:j,min:G,max:Q,hideInput:E,freeCSS:u,wrapStyles:N}=R,x=B(R,["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]=le(w.DefaultStatus(d,_)),[O,Y]=le({ok:!1,notice:[]});return w.CommonEffects({type:"list."+l,states:t,val_status:b,set_status:C,val_validate:O,set_validate:Y,SystemValidation:Ce}),a(me,{val_status:b,set_status:C,val_validate:O,states:t,children:a(h.List,{rootStates:t,val_status:b,set_status:C})})},List:t=>{let{rootStates:l,val_status:i,set_status:e}=t,{componentID:d,type:n,tone:m,icon:s,iconSize:S,iconColor:k,isChecker:J,options:V,name:P,form:X,tabIndex:A,hideInput:$,disabled:v,className:W,cellStyles:_,cellClassName:U="",cellCheckedStyles:g,cellCheckedClassName:K="",enableFormSubmit:q}=l,{dataValue:H}=i,j=l.CustomIcon,G=V.map((Q,E)=>{let oe=Q,{value:u,label:N,disabled:x,className:b="",checkedStyles:C,checkedClassName:O="",freeCSS:Y}=oe,R=B(oe,["value","label","disabled","className","checkedStyles","checkedClassName","freeCSS"]),Z=M(),D=H.findIndex(r=>r===u)!=-1,y=o(o({},_),R),z=[T("Label"),U,b];D&&(y=p(o(o(o({},y),g),C),{freeCSS:o(o(o({},y==null?void 0:y.freeCSS),g==null?void 0:g.freeCSS),C==null?void 0:C.freeCSS)}),z=[...z,K,O]);const ee=()=>{if(v||x)return;let r=[];if(n=="radio")r=[u];else if(n=="checkbox"||J)if(!D)r=[...i.dataValue,u];else{let c=[...i.dataValue];c.splice(i.dataValue.findIndex(F=>F==u),1),r=c}e(c=>p(o({},c),{dataValue:r,eventType:"update",eventID:M()}))};let te=[a(de,{position:"relative",freeCSS:{zIndex:2},flexSizing:0,children:f.is.string(N)?a(I,{children:N}):N},"content")];return s&&te[l.iconPosition=="right"?"push":"unshift"](a(j,{isChecked:D,iconSize:S,iconColor:k,toggle:ee},"icon")),[a(I,{htmlTag:"input",type:n=="radio"?"radio":"checkbox",className:T("Input"),name:"RadioCheckbox-"+P,"data-list-index":d+"-"+E,id:Z,value:String(u),disabled:v||x,checked:D,onFocus:r=>{x||n=="radio"&&(i.dataValue.length||e(c=>p(o({},c),{dataValue:[u],eventType:"update",eventID:M()})))},onChange:()=>{ee()},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,L=E+ie;L<0?L=V.length-1:L>=V.length&&(L=0),ne(`input[data-list-index="${d}-${L}"]`).focus()}}q&&w.SubmitForm(r,X)},tabIndex:A},"List-"+f.Stringify(u)),a(I,p(o({htmlTag:"label","data-disabled":v||x,htmlFor:Z,className:z.join(" "),tabIndex:-1,display:"flex",verticalAlign:"center",flexWrap:!1},y),{children:te}),"ListTrigger-"+f.Stringify(u))]});return a(re,{flexSizing:"auto",style:l.style,freeCSS:o({},l.freeCSS),className:[W,T("CellBase"),T("HideInput_"+$),T("IconIndicator_"+!!s),T("Tone_"+m)].join(" "),children:G})},_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,p(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(h._Icon,p(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(ce.Check,{transition:"middle",opacity:t.isChecked?"max":"trans",freeCSS:{zIndex:8,width:"100%",height:"100%",transform:t.isChecked?"scale(1)":"scale(.6)"}})})}))},ae=t=>{t=t||"checkbox";const l=e=>(e=p(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),a(pe,{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=ae("radio"),Se=ae("checkbox");export{Se as Checkbox,he as Radio};
|