amotify 0.2.295 → 0.2.296

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,6 +1,6 @@
1
- import { ThemeColor } from '../@declares';
1
+ import { Themecolor } from '../@declares';
2
2
  export declare const ColorObjects: {
3
- key: ThemeColor;
3
+ key: Themecolor;
4
4
  isBrand: boolean;
5
5
  isAvocado: boolean;
6
6
  }[];
@@ -12,7 +12,7 @@ declare const DarkmodeColors: {
12
12
  auto(): string;
13
13
  };
14
14
  declare const ThemeColors: {
15
- [key in ThemeColor]: {
15
+ [key in Themecolor]: {
16
16
  alfa(alfa?: number): string;
17
17
  isBrand: boolean;
18
18
  isAvocado: boolean;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ThemeColor } from '../../@declares';
2
+ import { Themecolor } from '../../@declares';
3
3
  import { InputTypes } from '.';
4
4
  declare namespace Color {
5
5
  type Input = InputTypes.CoreInput<string> & React.DOMAttributes<HTMLInputElement> & {
@@ -8,7 +8,7 @@ declare namespace Color {
8
8
  disabled?: boolean;
9
9
  value?: string;
10
10
  };
11
- type Color = ThemeColor | 'theme' | 'posi' | 'nega' | 'warn';
11
+ type Color = Themecolor | 'theme' | 'posi' | 'nega' | 'warn';
12
12
  }
13
13
  declare const Color: React.FC<Color.Input>;
14
14
  export { Color, Color as default };
@@ -1 +1 @@
1
- import{b as n,c as a,d as v}from"../../chunk-C5N2D3ZX.js";import{jsx as d}from"react/jsx-runtime";import{UUID as m}from"jmini";import{useState as T}from"react";import x from"../../atoms/Box";import{OptionalInputWrapper as F,BoxWrapper as h,CoreEffects as c,DefaultBoxishStyles as w}from"./core";import{InputSwitchClasses as B}from"../../@styles/componentClasses";function S(e){let{value:r,states:I}=e,{required:p}=I,l=[];return p&&!r&&l.push({type:"invalid",label:"ON\u306B\u306A\u3063\u3066\u3044\u307E\u305B\u3093"}),{ok:!l.filter(({type:f})=>f=="invalid").length,notice:l}}const U=e=>{let g=e,{componentId:r,required:I,form:p,enableFormSubmit:l,showInitValidation:f,onChange:C,onKeyDown:y,onValidate:E,onValidateDelay:R,onUpdateValue:W,onUpdateValidValue:_,onUserAction:H,value:b=""}=g,t=v(g,["componentId","required","form","enableFormSubmit","showInitValidation","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value"]),[i,s]=T(c.DefaultStatus(e.componentId||"",b));return c.CommonEffects({type:"color",states:e,val_status:i,set_status:s,SystemValidation:S}),d(h,{val_status:i,set_status:s,states:e,children:d(x,n({htmlTag:"input",type:"color","data-component-id":i.componentId,value:i.rawValue,className:B("Input"),onKeyDown:o=>{y&&y(o),l&&c.SubmitForm(o,p)},onChange:o=>{let{value:u}=o.target;s(D=>a(n({},D),{rawValue:u,eventType:"update",eventID:m(12),isInspected:!1,isValidated:!1,notice:[]})),C&&C(o)},onFocus:o=>{t!=null&&t.onFocus&&(t==null||t.onFocus(o)),s(u=>a(n({},u),{eventID:m(12),isFocusing:!0}))},onBlur:o=>{t!=null&&t.onBlur&&(t==null||t.onBlur(o)),s(u=>a(n({},u),{eventID:m(12),isFocusing:!1}))}},t))})},V=e=>{let r=a(n(a(n({},w(e)),{backgroundColor:"cloud",unitHeight:3}),e),{xcss:n({minWidth:108},e.xcss)});return d(F,{componentId:e.componentId,children:U,states:r})};export{V as Color,V as default};
1
+ import{b as n,c as a,d as v}from"../../chunk-C5N2D3ZX.js";import{jsx as d}from"react/jsx-runtime";import{UUID as m}from"jmini";import{useState as T}from"react";import x from"../../atoms/Box";import{OptionalInputWrapper as F,BoxWrapper as h,CoreEffects as c,DefaultBoxishStyles as w}from"./core";import{InputSwitchClasses as B}from"../../@styles/componentClasses";function S(e){let{value:r,states:I}=e,{required:p}=I,l=[];return p&&!r&&l.push({type:"invalid",label:"ON\u306B\u306A\u3063\u3066\u3044\u307E\u305B\u3093"}),{ok:!l.filter(({type:f})=>f=="invalid").length,notice:l}}const U=e=>{let g=e,{componentId:r,required:I,form:p,enableFormSubmit:l,showInitValidation:f,onChange:y,onKeyDown:C,onValidate:E,onValidateDelay:R,onUpdateValue:W,onUpdateValidValue:_,onUserAction:H,value:b=""}=g,t=v(g,["componentId","required","form","enableFormSubmit","showInitValidation","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value"]),[i,s]=T(c.DefaultStatus(e.componentId||"",b));return c.CommonEffects({type:"color",states:e,val_status:i,set_status:s,SystemValidation:S}),d(h,{val_status:i,set_status:s,states:e,children:d(x,n({htmlTag:"input",type:"color","data-component-id":i.componentId,value:i.rawValue,className:B("Input"),onKeyDown:o=>{C&&C(o),l&&c.SubmitForm(o,p)},onChange:o=>{let{value:u}=o.target;s(D=>a(n({},D),{rawValue:u,eventType:"update",eventID:m(12),isInspected:!1,isValidated:!1,notice:[]})),y&&y(o)},onFocus:o=>{t!=null&&t.onFocus&&(t==null||t.onFocus(o)),s(u=>a(n({},u),{eventID:m(12),isFocusing:!0}))},onBlur:o=>{t!=null&&t.onBlur&&(t==null||t.onBlur(o)),s(u=>a(n({},u),{eventID:m(12),isFocusing:!1}))}},t))})},V=e=>{let r=a(n(a(n({},w(e)),{backgroundColor:"cloud",unitHeight:3}),e),{xcss:n({minWidth:108},e.xcss)});return d(F,{componentId:e.componentId,children:U,states:r})};export{V as Color,V as default};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ReactElement, ThemeColor } from '../../@declares';
2
+ import { ReactElement, Themecolor } from '../../@declares';
3
3
  import { InputTypes } from '.';
4
4
  declare namespace Slider {
5
5
  type Size = 'small' | 'medium' | 'large';
@@ -12,6 +12,10 @@ declare namespace Slider {
12
12
  disabled?: boolean;
13
13
  value?: number | [number, number];
14
14
  color?: Color;
15
+ /**
16
+ * default min
17
+ */
18
+ trackMin?: number;
15
19
  min: number;
16
20
  max: number;
17
21
  step: number;
@@ -26,7 +30,7 @@ declare namespace Slider {
26
30
  };
27
31
  }
28
32
  type Input = Input.Single | Input.Range;
29
- type Color = ThemeColor | 'theme' | 'posi' | 'nega' | 'warn';
33
+ type Color = Themecolor | 'theme' | 'posi' | 'nega' | 'warn';
30
34
  type LegendsCallback = {
31
35
  (value: number): ReactElement;
32
36
  };
@@ -1 +1 @@
1
- import{b as g,c as y,d as N,e as F}from"../../chunk-C5N2D3ZX.js";import{Fragment as Z,jsx as u,jsxs as C}from"react/jsx-runtime";import v,{UUID as M}from"jmini";import{useState as P,useEffect as O}from"react";import{$$fromRoot as _,GenerateHTMLProps as K}from"../../@utils";import{Box as x,Flex as $,Column as z}from"../../atoms";import{Literal as W}from"../../mols";import{Button as q}from"../Button";import{OptionalInputWrapper as Y,BoxWrapper as G,CoreEffects as X}from"./core";import{InputSliderClasses as R}from"../../@styles/componentClasses";function j(e){let{value:l,states:t}=e,{required:a}=t,n=[],[s,o]=v.Arrayify(l);return a&&!s&&!o&&n.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!n.filter(({type:m})=>m=="invalid").length,notice:n}}const S={normalize:e=>{let{min:l,max:t,step:a,value:n}=e;n=Math.max(n,l),n=Math.min(n,t);let s=Math.round(n/a)*a;return{value:s,offsetLeft:Math.min(s/t,1)*100}},Effects:{Start:(e,l)=>{let t=v.getCursor(e).x,{val_status:a}=l,{componentId:n}=a,s=_("#"+n+"_Bar"),{width:o,left:m}=s.position(),d=(t-m)/o;d=Math.max(d,0),d=Math.min(d,1);let i=d*a.max;v(document).onEvent("mousemove",f=>{S.Effects.Move(f,l,i)},{eventID:"SliderMouseMove",passive:!1}).onEvent("touchmove",f=>{S.Effects.Move(f,l,i)},{eventID:"SliderTouchMove",passive:!1}).onEvent("mouseup",()=>{S.Effects.End()},{eventID:"SliderMouseUp"}).onEvent("touchend",()=>{S.Effects.End()},{eventID:"SliderTouchEnd"})},Move:(e,l,t)=>{let a=v.getCursor(e).x,{val_status:n}=l,{componentId:s}=n,o=_("#"+s+"_Bar"),{width:m,left:d}=o.position(),i=(a-d)/m;i=Math.max(i,0),i=Math.min(i,1);let f=i*n.max,r=S.normalize({min:n.min,max:n.max,step:n.step,value:f}).value,c=Math.round(f-t);return l.onChange(r,c),e.preventDefault(),e.stopPropagation(),!1},End:()=>{v(document).removeEvent(["SliderMouseMove","SliderTouchMove","SliderMouseUp","SliderTouchEnd"])}},Rail:e=>{let{rootStates:l,val_status:t,set_status:a}=e,{componentId:n}=t,s=2;l.size=="small"?s=1.5:l.size=="large"&&(s=2.5);let o=[S.normalize({min:t.min,max:t.max,step:t.step,value:t.safeValue[0]}),S.normalize({min:t.min,max:t.max,step:t.step,value:t.safeValue[1]||0})];const m=(d,i)=>{let{min:f,max:h,step:r}=t;d=Math.max(Math.min(d,h),f),a(c=>{let p=g({},c);return p.safeValue[i]==d?p:(p.safeValue[i]=d,t.ranged&&p.safeValue[0]>p.safeValue[1]&&(p.safeValue=[p.safeValue[1],p.safeValue[0]]),y(g({},p),{rawValue:p.ranged?p.safeValue:p.safeValue[0],eventType:"update",eventID:M(12),isInspected:!1}))})};return u(z,{padding:[1,"1/2"],onPointerDown:d=>{e.rootStates.disabled||(d.stopPropagation(),!t.ranged&&S.Effects.Start(d,{val_status:t,onChange:i=>{m(i,0)}}))},children:C(x,{className:R("Bar"),height:0,position:"relative",transition:"middle",flexSizing:"none",id:n+"_Bar",children:[u(x,{position:"absolute",isRounded:!0,backgroundColor:"cloud",xcss:{top:-2*s,left:-2*s,right:-2*s,bottom:-2*s}}),u(S.Range,{rootStates:l,val_status:t,set_status:a,formatData:o,onUpdateValue:m}),u(S.DiscreteScale,{rootStates:l,val_status:t}),u(S.Edge,{focusIndex:0,rootStates:l,val_status:t,set_status:a,formatData:o[0],onUpdateValue:m}),t.ranged&&u(S.Edge,{focusIndex:1,rootStates:l,val_status:t,set_status:a,formatData:o[1],onUpdateValue:m})]})})},DiscreteScale:e=>{let{rootStates:l,val_status:t}=e;if(!l.discreteScale)return null;let{min:a,max:n,step:s}=t,o=Math.round(a/s),d=Math.round(n/s)-o+1,i=0,f=t.safeValue[0]||0;return t.ranged&&(i=t.safeValue[0]||0,f=t.safeValue[1]||0),u(Z,{children:Array.from({length:d},(h,r)=>r+o).map(h=>{let r=h*s;r=Math.max(r,a),r=Math.min(r,n);let c=r/n*100+"%",p=v.isInRange(r,i,f);return u(z,{gap:0,position:"absolute",verticalAlign:"center",horizontalAlign:"center",width:0,height:0,transition:"middle",fontColor:"1.clear",xcss:{pointerEvents:"none",top:"50%",left:c,transform:"translateY(-50%)"},children:u(x,{isRounded:!0,backgroundColor:p?"layer.0":"gray",ssSphere:"1/4"})},r)})})},Range:e=>{let{rootStates:l,formatData:t,val_status:a}=e,n=2;return l.size=="small"?n=1.5:l.size=="large"&&(n=2.5),C(x,{className:R("Range"),position:"absolute",transition:"middle",xcss:g({cursor:"pointer",top:"50%",transform:"translateY(-50%)"},a.ranged?{left:t[0].offsetLeft+"%",width:t[1].offsetLeft-t[0].offsetLeft+"%"}:{left:0,width:(t[0].offsetLeft||0)+"%"}),onPointerDown:s=>{if(!e.rootStates.disabled){if(s.stopPropagation(),a.ranged){let[o,m]=a.safeValue;s.stopPropagation(),S.Effects.Start(s,{val_status:a,onChange:(d,i)=>{e.set_status(f=>{let h=f.safeValue,r=g({},f);return r.safeValue=[S.normalize({min:a.min,max:a.max,step:a.step,value:o+i}).value,S.normalize({min:a.min,max:a.max,step:a.step,value:m+i}).value],r.safeValue[0]==h[0]&&r.safeValue[1]==h[1]?y(g({},f),{eventType:"update",eventID:M(12)}):y(g({},r),{rawValue:r.ranged?r.safeValue:r.safeValue[0],eventType:"update",eventID:M(12),isInspected:!1})})}});return}S.Effects.Start(s,{val_status:a,onChange:o=>{e.onUpdateValue(o,0)}})}},children:[u(x,{className:R("Field"),transition:"middle",position:"absolute",isRounded:!0,backgroundColor:l.color,xcss:{top:-6*n,bottom:-6*n,left:-6*n,right:-6*n}}),u(x,{className:R("Child"),transition:"middle",position:"absolute",isRounded:!0,backgroundColor:l.color,xcss:{pointerEvents:"none",top:-2*n,left:-2*n,right:-2*n,bottom:-2*n}})]})},Edge:e=>{let{formatData:l,rootStates:t,val_status:a,set_status:n}=e,s=2;return t.size=="small"?s=1.5:t.size=="large"&&(s=2.5),C(q.Plain,{className:R("Edge"),position:"absolute",transition:"middle",height:0,width:0,flexCenter:!0,xcss:{left:l.offsetLeft+"%"},onPointerDown:o=>{e.rootStates.disabled||e.focusIndex==1&&!a.ranged||(o.stopPropagation(),S.Effects.Start(o,{val_status:a,onChange:m=>{e.onUpdateValue(m,e.focusIndex)}}))},onKeyDown:o=>{t.enableFormSubmit&&X.SubmitForm(o,t.form);let{min:m,max:d,step:i}=a,{key:f,metaKey:h,ctrlKey:r}=o,c=r||h,p=a.safeValue[e.focusIndex];if(!f.match(/Arrow/))return;o.preventDefault(),f.match(/Left|Up/)?c?p=m:p-=i:f.match(/Right|Down/)&&(c?p=d:p+=i);let E=S.normalize({min:a.min,max:a.max,step:a.step,value:p});e.onUpdateValue(E.value,e.focusIndex)},onFocus:o=>{n(m=>y(g({},m),{eventID:M(12),isFocusing:!0}))},onBlur:o=>{n(m=>y(g({},m),{eventID:M(12),isFocusing:!1}))},children:[u(x,{className:R("EdgeChild"),transition:"middle",position:"absolute",backgroundColor:t.color,isRounded:!0,opacity:"trans",xcss:{pointerEvents:"all",top:-12*s,bottom:-12*s,left:-12*s,right:-12*s}}),u(x,{transition:"long",boxShadow:"1.remark",fontSize:"0.xs",backgroundColor:!a.ranged||e.focusIndex==1?t.color:"layer.0",ssSphere:s,xcss:{pointerEvents:"all"}})]})},Legends:e=>{var h;let{val_status:l,rootStates:t}=e,{min:a,max:n,step:s}=l,[o]=P(M()),m=(h=t.legends)!=null?h:!0,d=Math.round(a/s),i=Math.round(n/s),f=i-d+1;return O(()=>{if(!m)return;const r=()=>F(void 0,null,function*(){yield v.pending(100);let c=_("#"+o),p=_("#"+o+"-"+a),E=c.position().width-p.position().left,T=12*4,B=Math.round(E/T),U=Math.max(1,Math.floor(f/B));for(let I=d;I<=i;I++){let L=I*s,k=I==d||I==i||I%U==0;_("#"+o+"-"+L).css({display:k?"flex":"none"})}});return v(window).onEvent("resize",r,{eventID:"SliderResizeCB-"+o}),r(),()=>{v(window).removeEvent("SliderResizeCB-"+o)}},[]),m?C($,{fontSize:"0.xs",position:"relative",padding:[0,"1/2"],id:o,xcss:{pointerEvents:"none",userSelect:"none"},children:[C(z,{gap:0,unitWidth:0,opacity:"trans",children:[u(x,{unitHeight:"1/2"}),u(W.Supplement,{fontHeight:1.2,children:"A"})]}),Array.from({length:f},(r,c)=>c+d).map(r=>{let c=r*s;c=Math.max(c,a),c=Math.min(c,n);let p=c/n*100+"%";return C(z,{gap:0,id:o+"-"+c,className:R("Legend"),position:"relative",verticalAlign:"center",unitWidth:0,display:"none",transition:"middle",fontColor:"1.clear",textAlign:"center",xcss:{left:p,whiteSpace:"nowrap"},children:[u(x,{isRounded:!0,backgroundColor:"mono.positive",opacity:"low",unitWidth:"1/12",unitHeight:"1/2"}),u(W.Supplement,{fontHeight:1.2,fontSize:"0.xs",children:t.onLegendRender?t.onLegendRender(c):c.rank()})]},c)})]}):null},index:e=>{let A=e,{color:l="theme",required:t,form:a="",discreteScale:n,size:s,ranged:o,legends:m,onLegendRender:d,min:i,max:f,step:h,enableFormSubmit:r,showInitValidation:c,onValidate:p,onValidateDelay:E,onUpdateValue:T,onUpdateValidValue:B,onUserAction:U,value:I=0,className:L,wrapStyles:k}=A,J=N(A,["color","required","form","discreteScale","size","ranged","legends","onLegendRender","min","max","step","enableFormSubmit","showInitValidation","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","className","wrapStyles"]),[D,w]=P({componentId:e.componentId||"",rawValue:I,safeValue:v.Arrayify(I),ranged:!!o,min:i,max:f,step:h,eventType:"init",eventID:M(12)});return X.CommonEffects({type:"slider",states:e,val_status:D,set_status:w,SystemValidation:j,ExtraOverrideStates:H=>({safeValue:v.Arrayify(H)})}),u(G,{val_status:D,set_status:w,states:e,children:C(z,y(g({gap:0,padding:[0,"1/2"],flexSizing:"auto"},J),{className:[L,R("Wrap")].join(" "),children:[u(S.Rail,{rootStates:e,val_status:D,set_status:w}),u(S.Legends,{rootStates:e,val_status:D})]}))})}},V=e=>{let l=y(g({color:"theme",size:"medium",discreteScale:!0},e),{xcss:g({minWidth:120},e.xcss)});return u(Y,{componentId:e.componentId,children:S.index,states:K(l)})},b=V;b.Small=e=>u(V,g({size:"small"},e)),b.Medium=e=>u(V,g({size:"medium"},e)),b.Large=e=>u(V,g({size:"large"},e));const Q=e=>u(V,g({ranged:!0},e));b.Range=Q,b.Range.Small=e=>u(V,g({ranged:!0,size:"small"},e)),b.Range.Medium=e=>u(V,g({ranged:!0,size:"medium"},e)),b.Range.Large=e=>u(V,g({ranged:!0,size:"large"},e));export{b as Slider,b as default};
1
+ import{b as d,c as h,d as F,e as P}from"../../chunk-C5N2D3ZX.js";import{Fragment as ee,jsx as m,jsxs as C}from"react/jsx-runtime";import x,{UUID as E}from"jmini";import{useState as W,useEffect as K}from"react";import{$$fromRoot as _,GenerateHTMLProps as $}from"../../@utils";import{Box as b,Flex as q,Column as z}from"../../atoms";import{Literal as O}from"../../mols";import{Button as Y}from"../Button";import{OptionalInputWrapper as G,BoxWrapper as j,CoreEffects as X}from"./core";import{InputSliderClasses as V}from"../../@styles/componentClasses";function Q(e){let{value:n,states:t}=e,{required:o}=t,a=[],[l,r]=x.Arrayify(n);return o&&!l&&!r&&a.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!a.filter(({type:i})=>i=="invalid").length,notice:a}}const f={getOffsetLeft:e=>{let{trackMin:n,min:t,max:o,value:a}=e,l=(a-(n!=null?n:t))/(o-(n!=null?n:t));return Math.min(l,1)*100},normalize:e=>{let{min:n,max:t,step:o,value:a}=e;a=Math.max(a,n),a=Math.min(a,t);let l=Math.round(a/o)*o;return{value:l,offsetLeft:f.getOffsetLeft(h(d({},e),{value:l}))}},Effects:{Start:(e,n)=>{let t=x.getCursor(e).x,{val_status:o}=n,{componentId:a}=o,l=_("#"+a+"_Bar"),{width:r,left:i}=l.position(),c=(t-i)/r;c=Math.max(c,0),c=Math.min(c,1);let u=c*o.max;x(document).onEvent("mousemove",p=>{f.Effects.Move(p,n,u)},{eventID:"SliderMouseMove",passive:!1}).onEvent("touchmove",p=>{f.Effects.Move(p,n,u)},{eventID:"SliderTouchMove",passive:!1}).onEvent("mouseup",()=>{f.Effects.End()},{eventID:"SliderMouseUp"}).onEvent("touchend",()=>{f.Effects.End()},{eventID:"SliderTouchEnd"})},Move:(e,n,t)=>{var I;let o=x.getCursor(e).x,{val_status:a}=n,{componentId:l}=a,r=_("#"+l+"_Bar"),{width:i,left:c}=r.position(),u=(o-c)/i;u=Math.max(u,0),u=Math.min(u,1);let p=(I=a.trackMin)!=null?I:a.min,v=u*(a.max-p)+p,S=f.normalize(h(d({},a),{value:v})).value,s=Math.round(v-t);return n.onChange(S,s),e.preventDefault(),e.stopPropagation(),!1},End:()=>{x(document).removeEvent(["SliderMouseMove","SliderTouchMove","SliderMouseUp","SliderTouchEnd"])}},Rail:e=>{let{rootStates:n,val_status:t,set_status:o}=e,{componentId:a}=t,l=2;n.size=="small"?l=1.5:n.size=="large"&&(l=2.5);let r=[f.normalize(h(d({},t),{value:t.safeValue[0]})),f.normalize(h(d({},t),{value:t.safeValue[1]||0}))];const i=(c,u)=>{let{min:p,max:v,step:g}=t;c=Math.max(Math.min(c,v),p),o(S=>{let s=d({},S);return s.safeValue[u]==c?s:(s.safeValue[u]=c,t.ranged&&s.safeValue[0]>s.safeValue[1]&&(s.safeValue=[s.safeValue[1],s.safeValue[0]]),h(d({},s),{rawValue:s.ranged?s.safeValue:s.safeValue[0],eventType:"update",eventID:E(12),isInspected:!1}))})};return m(z,{padding:[1,"1/2"],onPointerDown:c=>{e.rootStates.disabled||(c.stopPropagation(),!t.ranged&&f.Effects.Start(c,{val_status:t,onChange:u=>{i(u,0)}}))},children:C(b,{className:V("Bar"),height:0,position:"relative",transition:"middle",flexSizing:"none",id:a+"_Bar",children:[m(b,{position:"absolute",isRounded:!0,backgroundColor:"cloud",xcss:{top:-2*l,left:-2*l,right:-2*l,bottom:-2*l}}),m(f.Range,{rootStates:n,val_status:t,set_status:o,formatData:r,onUpdateValue:i}),m(f.DiscreteScale,{rootStates:n,val_status:t}),m(f.Edge,{focusIndex:0,rootStates:n,val_status:t,set_status:o,formatData:r[0],onUpdateValue:i}),t.ranged&&m(f.Edge,{focusIndex:1,rootStates:n,val_status:t,set_status:o,formatData:r[1],onUpdateValue:i})]})})},DiscreteScale:e=>{let{rootStates:n,val_status:t}=e;if(!n.discreteScale)return null;let{trackMin:o,min:a,max:l,step:r}=t,i=Math.round(a/r),u=Math.round(l/r)-i+1,p=0,v=t.safeValue[0]||0;return t.ranged&&(p=t.safeValue[0]||0,v=t.safeValue[1]||0),m(ee,{children:Array.from({length:u},(g,S)=>S+i).map(g=>{let S=g*r;S=Math.max(S,a),S=Math.min(S,l);let s=f.getOffsetLeft(h(d({},t),{value:S}))+"%",I=x.isInRange(S,p,v);return m(z,{gap:0,position:"absolute",verticalAlign:"center",horizontalAlign:"center",width:0,height:0,transition:"middle",fontColor:"1.clear",xcss:{pointerEvents:"none",top:"50%",left:s,transform:"translateY(-50%)"},children:m(b,{isRounded:!0,backgroundColor:I?"layer.0":"gray",ssSphere:"1/4"})},S)})})},Range:e=>{let{rootStates:n,formatData:t,val_status:o}=e,a=2;return n.size=="small"?a=1.5:n.size=="large"&&(a=2.5),C(b,{className:V("Range"),position:"absolute",transition:"middle",xcss:d({cursor:"pointer",top:"50%",transform:"translateY(-50%)"},o.ranged?{left:t[0].offsetLeft+"%",width:t[1].offsetLeft-t[0].offsetLeft+"%"}:{left:0,width:(t[0].offsetLeft||0)+"%"}),onPointerDown:l=>{if(!e.rootStates.disabled){if(l.stopPropagation(),o.ranged){let[r,i]=o.safeValue;l.stopPropagation(),f.Effects.Start(l,{val_status:o,onChange:(c,u)=>{e.set_status(p=>{let v=p.safeValue,g=d({},p);return g.safeValue=[f.normalize(h(d({},o),{value:r+u})).value,f.normalize(h(d({},o),{value:i+u})).value],g.safeValue[0]==v[0]&&g.safeValue[1]==v[1]?h(d({},p),{eventType:"update",eventID:E(12)}):h(d({},g),{rawValue:g.ranged?g.safeValue:g.safeValue[0],eventType:"update",eventID:E(12),isInspected:!1})})}});return}f.Effects.Start(l,{val_status:o,onChange:r=>{e.onUpdateValue(r,0)}})}},children:[m(b,{className:V("Field"),transition:"middle",position:"absolute",isRounded:!0,backgroundColor:n.color,xcss:{top:-6*a,bottom:-6*a,left:-6*a,right:-6*a}}),m(b,{className:V("Child"),transition:"middle",position:"absolute",isRounded:!0,backgroundColor:n.color,xcss:{pointerEvents:"none",top:-2*a,left:-2*a,right:-2*a,bottom:-2*a}})]})},Edge:e=>{let{formatData:n,rootStates:t,val_status:o,set_status:a}=e,l=2;return t.size=="small"?l=1.5:t.size=="large"&&(l=2.5),C(Y.Plain,{className:V("Edge"),position:"absolute",transition:"middle",height:0,width:0,flexCenter:!0,xcss:{left:n.offsetLeft+"%"},onPointerDown:r=>{e.rootStates.disabled||e.focusIndex==1&&!o.ranged||(r.stopPropagation(),f.Effects.Start(r,{val_status:o,onChange:i=>{e.onUpdateValue(i,e.focusIndex)}}))},onKeyDown:r=>{t.enableFormSubmit&&X.SubmitForm(r,t.form);let{min:i,max:c,step:u}=o,{key:p,metaKey:v,ctrlKey:g}=r,S=g||v,s=o.safeValue[e.focusIndex];if(!p.match(/Arrow/))return;r.preventDefault(),p.match(/Left|Up/)?S?s=i:s-=u:p.match(/Right|Down/)&&(S?s=c:s+=u);let I=f.normalize(h(d({},o),{value:s}));e.onUpdateValue(I.value,e.focusIndex)},onFocus:r=>{a(i=>h(d({},i),{eventID:E(12),isFocusing:!0}))},onBlur:r=>{a(i=>h(d({},i),{eventID:E(12),isFocusing:!1}))},children:[m(b,{className:V("EdgeChild"),transition:"middle",position:"absolute",backgroundColor:t.color,isRounded:!0,opacity:"trans",xcss:{pointerEvents:"all",top:-12*l,bottom:-12*l,left:-12*l,right:-12*l}}),m(b,{transition:"long",boxShadow:"1.remark",fontSize:"0.xs",backgroundColor:!o.ranged||e.focusIndex==1?t.color:"layer.0",ssSphere:l,xcss:{pointerEvents:"all"}})]})},Legends:e=>{var g;let{val_status:n,rootStates:t}=e,{trackMin:o,min:a,max:l,step:r}=n,[i]=W(E()),c=(g=t.legends)!=null?g:!0,u=Math.round(a/r),p=Math.round(l/r),v=p-u+1;return K(()=>{if(!c)return;const S=()=>P(void 0,null,function*(){yield x.pending(100);let s=_("#"+i),I=_("#"+i+"-"+a),T=s.position().width-I.position().left,B=12*4,k=Math.round(T/B),U=Math.max(1,Math.floor(v/k));for(let y=u;y<=p;y++){let D=y*r,A=y==u||y==p||y%U==0;_("#"+i+"-"+D).css({display:A?"flex":"none"})}});return x(window).onEvent("resize",S,{eventID:"SliderResizeCB-"+i}),S(),()=>{x(window).removeEvent("SliderResizeCB-"+i)}},[]),c?C(q,{fontSize:"0.xs",position:"relative",padding:[0,"1/2"],id:i,xcss:{pointerEvents:"none",userSelect:"none"},children:[C(z,{gap:0,unitWidth:0,opacity:"trans",children:[m(b,{unitHeight:"1/2"}),m(O.Supplement,{fontHeight:1.2,children:"A"})]}),Array.from({length:v},(S,s)=>s+u).map(S=>{let s=S*r;s=Math.max(s,a),s=Math.min(s,l);let I=f.getOffsetLeft(h(d({},n),{value:s}))+"%";return C(z,{gap:0,id:i+"-"+s,className:V("Legend"),position:"relative",verticalAlign:"center",unitWidth:0,display:"none",transition:"middle",fontColor:"1.clear",textAlign:"center",xcss:{left:I,whiteSpace:"nowrap"},children:[m(b,{isRounded:!0,backgroundColor:"mono.positive",opacity:"low",unitWidth:"1/12",unitHeight:"1/2"}),m(O.Supplement,{fontHeight:1.2,fontSize:"0.xs",children:t.onLegendRender?t.onLegendRender(s):s.rank()})]},s)})]}):null},index:e=>{let N=e,{color:n="theme",required:t,form:o="",discreteScale:a,size:l,ranged:r,legends:i,onLegendRender:c,trackMin:u,min:p,max:v,step:g,enableFormSubmit:S,showInitValidation:s,onValidate:I,onValidateDelay:T,onUpdateValue:B,onUpdateValidValue:k,onUserAction:U,value:y=0,className:D,wrapStyles:A}=N,J=F(N,["color","required","form","discreteScale","size","ranged","legends","onLegendRender","trackMin","min","max","step","enableFormSubmit","showInitValidation","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","className","wrapStyles"]),[L,w]=W({componentId:e.componentId||"",rawValue:y,safeValue:x.Arrayify(y),ranged:!!r,trackMin:Math.min(u!=null?u:p,p),min:p,max:v,step:g,eventType:"init",eventID:E(12)});return X.CommonEffects({type:"slider",states:e,val_status:L,set_status:w,SystemValidation:Q,ExtraOverrideStates:H=>({safeValue:x.Arrayify(H)})}),m(j,{val_status:L,set_status:w,states:e,children:C(z,h(d({gap:0,padding:[0,"1/2"],flexSizing:"auto"},J),{className:[D,V("Wrap")].join(" "),children:[m(f.Rail,{rootStates:e,val_status:L,set_status:w}),m(f.Legends,{rootStates:e,val_status:L})]}))})}},M=e=>{let n=h(d({color:"theme",size:"medium",discreteScale:!0},e),{xcss:d({minWidth:120},e.xcss)});return m(G,{componentId:e.componentId,children:f.index,states:$(n)})},R=M;R.Small=e=>m(M,d({size:"small"},e)),R.Medium=e=>m(M,d({size:"medium"},e)),R.Large=e=>m(M,d({size:"large"},e));const Z=e=>m(M,d({ranged:!0},e));R.Range=Z,R.Range.Small=e=>m(M,d({ranged:!0,size:"small"},e)),R.Range.Medium=e=>m(M,d({ranged:!0,size:"medium"},e)),R.Range.Large=e=>m(M,d({ranged:!0,size:"large"},e));export{R as Slider,R as default};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { ThemeColor, ReactElement } from '../../@declares';
2
+ import { Themecolor, ReactElement } from '../../@declares';
3
3
  import { InputTypes } from '.';
4
4
  declare namespace Switch {
5
5
  type Size = 'small' | 'regular' | 'large';
@@ -13,7 +13,7 @@ declare namespace Switch {
13
13
  value?: boolean;
14
14
  icon?: ReactElement;
15
15
  };
16
- type Color = ThemeColor | 'theme' | 'posi' | 'nega' | 'warn';
16
+ type Color = Themecolor | 'theme' | 'posi' | 'nega' | 'warn';
17
17
  namespace Methods {
18
18
  type Component = React.FC<Input>;
19
19
  type FNs = {
@@ -1 +1 @@
1
- import{b as o,c as s,d as T}from"../../chunk-C5N2D3ZX.js";import{jsx as a,jsxs as k}from"react/jsx-runtime";import{UUID as C}from"jmini";import{useState as E}from"react";import h from"../../atoms/Box";import{Row as L}from"../../mols";import{Label as U}from"../Button";import{OptionalInputWrapper as P,BoxWrapper as W,CoreEffects as B}from"./core";import{InputSwitchClasses as b}from"../../@styles/componentClasses";function A(e){let{value:n,states:l}=e,{required:S}=l,r=[];return S&&!n&&r.push({type:"invalid",label:"ON\u306B\u306A\u3063\u3066\u3044\u307E\u305B\u3093"}),{ok:!r.filter(({type:I})=>I=="invalid").length,notice:r}}const O=e=>{let V=e,{componentId:n,color:l="posi",required:S,form:r,id:I,enableFormSubmit:M,showInitValidation:_,onChange:R,onKeyDown:F,onValidate:H,onValidateDelay:q,onUpdateValue:K,onUpdateValidValue:$,onUserAction:j,size:w="regular",value:N="",icon:v="",isApply:p=!1}=V,t=T(V,["componentId","color","required","form","id","enableFormSubmit","showInitValidation","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","size","value","icon","isApply"]),[c,u]=E({componentId:e.componentId||"",rawValue:N,eventType:"init",eventID:C(12)}),d=!!c.rawValue;B.CommonEffects({type:"switch",states:e,val_status:c,set_status:u,SystemValidation:A});let f="middle",x=5,y=3;return p&&(y=4),k(W,{val_status:c,set_status:u,states:e,children:[a(h,s(o({htmlTag:"input",type:"checkbox","data-component-id":c.componentId,checked:c.rawValue,className:b("Input"),id:I,onKeyDown:i=>{F&&F(i),M&&B.SubmitForm(i,r)},onChange:i=>{let{checked:m}=i.target;u(z=>s(o({},z),{rawValue:m,eventType:"update",eventID:C(12),isInspected:!1,isValidated:!1,notice:[]})),R&&R(i)}},t),{onFocus:i=>{t!=null&&t.onFocus&&(t==null||t.onFocus(i)),u(m=>s(o({},m),{eventID:C(12),isFocusing:!0}))},onBlur:i=>{t!=null&&t.onBlur&&(t==null||t.onBlur(i)),u(m=>s(o({},m),{eventID:C(12),isFocusing:!1}))}})),a(U.Plain,{tabIndex:-1,htmlFor:I,padding:"1/4",transition:f,borderRadius:"1.tone.primary",className:b("Label"),children:a(h,s(o({},p?{padding:"1/4",isRounded:!0,backgroundColor:d?l:"layer.3"}:{}),{children:k(L.Center,{unitHeight:w=="small"?2:w=="regular"?2.5:w=="large"?3:0,position:"relative",xcss:{aspectRatio:(x+y)/x},children:[!p&&a(h,{position:"absolute",backgroundColor:d?l:"layer.5",isRounded:!0,transition:f,width:1,opacity:"middle",className:b("Bar"),xcss:{height:"40%"}}),a(h,{position:"absolute",top:0,backgroundColor:!p&&d?l:"white",transition:f,isRounded:!0,flexCenter:!0,boxShadow:"1.remark",className:b("Dot"),xcss:{height:"100%",aspectRatio:"1",left:d?`calc(${y.ratio(x+y)}%)`:0},children:v&&a(h,{transition:f,flexCenter:!0,fontColor:d?p?l:"white":"6.clear",children:v})})]})}))})]})},g=e=>{let n=o({},e);return n.value=!!n.value,n.color=n.color||"theme",a(P,{componentId:n.componentId,children:O,states:n})},D=Object.assign(g,{S:e=>a(g,s(o({},e),{size:"small"})),R:e=>a(g,s(o({},e),{size:"regular"})),L:e=>a(g,s(o({},e),{size:"large"}))});export{D as Switch,D as default};
1
+ import{b as o,c as s,d as T}from"../../chunk-C5N2D3ZX.js";import{jsx as a,jsxs as k}from"react/jsx-runtime";import{UUID as b}from"jmini";import{useState as E}from"react";import h from"../../atoms/Box";import{Row as L}from"../../mols";import{Label as U}from"../Button";import{OptionalInputWrapper as P,BoxWrapper as W,CoreEffects as B}from"./core";import{InputSwitchClasses as g}from"../../@styles/componentClasses";function A(e){let{value:n,states:l}=e,{required:S}=l,r=[];return S&&!n&&r.push({type:"invalid",label:"ON\u306B\u306A\u3063\u3066\u3044\u307E\u305B\u3093"}),{ok:!r.filter(({type:I})=>I=="invalid").length,notice:r}}const O=e=>{let V=e,{componentId:n,color:l="posi",required:S,form:r,id:I,enableFormSubmit:M,showInitValidation:_,onChange:R,onKeyDown:F,onValidate:H,onValidateDelay:q,onUpdateValue:K,onUpdateValidValue:$,onUserAction:j,size:C="regular",value:N="",icon:v="",isApply:p=!1}=V,t=T(V,["componentId","color","required","form","id","enableFormSubmit","showInitValidation","onChange","onKeyDown","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","size","value","icon","isApply"]),[c,u]=E({componentId:e.componentId||"",rawValue:N,eventType:"init",eventID:b(12)}),d=!!c.rawValue;B.CommonEffects({type:"switch",states:e,val_status:c,set_status:u,SystemValidation:A});let f="middle",x=5,y=3;return p&&(y=4),k(W,{val_status:c,set_status:u,states:e,children:[a(h,s(o({htmlTag:"input",type:"checkbox","data-component-id":c.componentId,checked:c.rawValue,className:g("Input"),id:I,onKeyDown:i=>{F&&F(i),M&&B.SubmitForm(i,r)},onChange:i=>{let{checked:m}=i.target;u(z=>s(o({},z),{rawValue:m,eventType:"update",eventID:b(12),isInspected:!1,isValidated:!1,notice:[]})),R&&R(i)}},t),{onFocus:i=>{t!=null&&t.onFocus&&(t==null||t.onFocus(i)),u(m=>s(o({},m),{eventID:b(12),isFocusing:!0}))},onBlur:i=>{t!=null&&t.onBlur&&(t==null||t.onBlur(i)),u(m=>s(o({},m),{eventID:b(12),isFocusing:!1}))}})),a(U.Plain,{tabIndex:-1,htmlFor:I,padding:"1/4",transition:f,borderRadius:"1.tone.primary",className:g("Label"),children:a(h,s(o({},p?{padding:"1/4",isRounded:!0,backgroundColor:d?l:"layer.3"}:{}),{children:k(L.Center,{unitHeight:C=="small"?2:C=="regular"?2.5:C=="large"?3:0,position:"relative",xcss:{aspectRatio:(x+y)/x},children:[!p&&a(h,{position:"absolute",backgroundColor:d?l:"layer.5",isRounded:!0,transition:f,width:1,opacity:"middle",className:g("Bar"),xcss:{height:"40%"}}),a(h,{position:"absolute",top:0,backgroundColor:!p&&d?l:"white",transition:f,isRounded:!0,flexCenter:!0,boxShadow:"1.remark",className:g("Dot"),xcss:{height:"100%",aspectRatio:"1",left:d?`calc(${y.ratio(x+y)}%)`:0},children:v&&a(h,{transition:f,flexCenter:!0,fontColor:d?p?l:"white":"6.clear",children:v})})]})}))})]})},w=e=>{let n=o({},e);return n.value=!!n.value,n.color=n.color||"theme",a(P,{componentId:n.componentId,children:O,states:n})},D=Object.assign(w,{S:e=>a(w,s(o({},e),{size:"small"})),R:e=>a(w,s(o({},e),{size:"regular"})),L:e=>a(w,s(o({},e),{size:"large"}))});export{D as Switch,D as default};
@@ -82,6 +82,7 @@ export declare namespace InputTypes {
82
82
  type Slider = Status & {
83
83
  safeValue: number[];
84
84
  ranged: boolean;
85
+ trackMin?: number;
85
86
  min: number;
86
87
  max: number;
87
88
  step: number;
package/dist/index.d.ts CHANGED
@@ -80,7 +80,7 @@ declare const amotify: {
80
80
  useUpdateEffect: (effect: () => void | (() => void), deps: any[]) => void;
81
81
  pageRouter: utils.pageRouter.Methods;
82
82
  ColorObjects: {
83
- key: utils.ThemeColor;
83
+ key: utils.Themecolor;
84
84
  isBrand: boolean;
85
85
  isAvocado: boolean;
86
86
  }[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amotify",
3
- "version": "0.2.295",
3
+ "version": "0.2.296",
4
4
  "description": "UI Component for React,NextJS,esbuild",
5
5
  "scripts": {
6
6
  "start": "run-p clean build:*",