amotify 0.2.139 → 0.2.141

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 C,c as T,d as k}from"../../chunk-C5N2D3ZX.js";import{jsx as d,jsxs as W}from"react/jsx-runtime";import g,{UUID as _}from"jmini";import{useState as B,useEffect as P}from"react";import{$$fromRoot as I,GenerateHTMLProps as $}from"../../@utils";import{Box as D,Flex as A,Column as q}from"../../atoms";import{Button as O}from"../Button";import{OptionalInputWrapper as G,BoxWrapper as X,CoreEffects as F}from"./core";import{InputSliderClasses as c}from"../../@styles/componentClasses";function j(t){let{value:e,states:n}=t,{required:s}=n,o=[];return s&&!e&&o.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!o.filter(({type:r})=>r=="invalid").length,notice:o}}const z=t=>{let{value:e,val_status:n}=t,{min:s,max:o,step:r}=n;e=Math.max(e,s),e=Math.min(e,o);let a=e/o*o;return a=Math.round(a/r),{stepValue:a*r,stepIndex:a,positionLeft:a*r/o*100+"%"}},N={IndicatorLabels:t=>{let{componentID:e,min:n,max:s,step:o,customLegends:r}=t,i=[],a=Math.round(n/o),p=Math.round(s/o),S=p-a+1;for(var u=a;u<=p;u++){let l=u*o;l=Math.max(l,n),l=Math.min(l,s);let f=l/s*100+"%";i.push(d(D,{className:c("Label"),id:"Legend-"+e+"-"+u,display:u==a||u==p?"flex":"none",position:"absolute",top:0,unitHeight:1,unitWidth:1.5,transition:"middle",fontColor:"1.clear",verticalAlign:"center",horizontalAlign:"center",freeCSS:{left:f,whiteSpace:"nowrap",textAlign:"center"},children:r?r(l):l.rank()},l))}return P(()=>{const l=()=>{let f=I("#Labels-"+e),{width:v}=f.position(),L=Math.round(v/50)-1,b=Math.round(S/L);for(let m=a+1;m<p;m++)I("#Legend-"+e+"-"+m).css({display:m%b==0?"flex":"none"})};return g(window).addEvent({eventID:"SliderResizeCallback-"+e,eventType:"resize",callback:()=>{l()}}),l(),()=>{g(window).removeEvent("SliderResizeCallback-"+e)}},[]),d(A,{className:c("Labels"),verticalAlign:"center",horizontalAlign:"between",fontSize:"0.xs",position:"relative",unitHeight:1,id:"Labels-"+e,children:d(D,{position:"absolute",top:0,left:0,bottom:0,freeCSS:{right:12*1.5},children:i})})},Rail:t=>{let{val_status:e,set_status:n,DotData:s,form:o,enableFormSubmit:r}=t,{componentID:i}=e;return W(A,{className:c("Rail"),position:"relative",paddingLeft:"1/2",unitHeight:1.5,verticalAlign:"center",freeCSS:{minWidth:"10rem",zIndex:1,cursor:"pointer"},onPointerDown:a=>{t.rootStates.disabled||(a.stopPropagation(),y.Effects.Start(a,{val_status:e,set_status:n,DotData:s}))},children:[d(D,{className:c("Bar"),backgroundColor:"layer.4",position:"relative",borderRadius:"1.tone.primary",transition:"middle",flexSizing:"none",unitHeight:"2/3",width:1,id:i+"_Bar",children:d(D,{className:c("BarColor"),position:"relative",height:1,width:0,left:0,transition:"long",borderRadius:"inherit",backgroundColor:t.color,opacity:"middle",overflow:"hidden",freeCSS:{width:s.positionLeft},id:i+"_BarColor"})}),d(D,{className:c("BallWrap"),position:"absolute",top:0,left:0,bottom:0,freeCSS:{right:12*1.5},children:d(O.Plain,{className:c("Ball"),position:"absolute",boxShadow:"1.remark",backgroundColor:t.color,top:0,left:0,ssSquare:1.5,borderRadius:"1.tone.primary",freeCSS:{zIndex:2,left:s.positionLeft},id:i+"_Ball",onKeyDown:a=>{y.KeyDownEvent({event:a,val_status:e,set_status:n,DotData:s}),r&&F.SubmitForm(a,o)}})})]})}},y={Effects:{Start:(t,e)=>{g(document).addEvent({eventID:"SliderMouseMove",eventType:"mousemove",callback:n=>{y.Effects.Move(n,e)},options:{passive:!1}}).addEvent({eventID:"SliderTouchMove",eventType:"touchmove",callback:n=>{y.Effects.Move(n,e)},options:{passive:!1}}).addEvent({eventID:"SliderMouseUp",eventType:"mouseup",callback:()=>{y.Effects.End()}}).addEvent({eventID:"SliderTouchEnd",eventType:"touchend",callback:()=>{y.Effects.End()}})},Move:(t,e)=>{let n=g.getCursor(t).x,{val_status:s,set_status:o}=e,{componentID:r,min:i,max:a}=s,p=I("#"+r+"_Ball"),S=I("#"+r+"_Bar"),u=I("#"+r+"_BarColor"),{width:l,left:f}=S.position(),v=(n-f)/l;v=Math.max(v,0),v=Math.min(v,1);let L=v*a,b=z({value:L,val_status:s}),m=b.positionLeft,w=b.stepValue;return p.css({left:m}),u.css({width:m}),o(x=>{let E=x.dataValue;return w==E?x:T(C({},x),{dataValue:w,eventType:"update",eventID:_()})}),t.preventDefault(),t.stopPropagation(),!1},End:()=>{g(document).removeEvent(["SliderMouseMove","SliderTouchMove","SliderMouseUp","SliderTouchEnd"])}},KeyDownEvent:t=>{let{event:e,val_status:n,set_status:s}=t,{min:o,max:r,step:i}=n,{key:a,metaKey:p,ctrlKey:S}=e,u=S||p,l=n.dataValue;a.match(/Arrow/)&&(e.preventDefault(),a.match(/Left|Up/)?u?l=o:l-=i:a.match(/Right|Down/)&&(u?l=r:l+=i),l=Math.max(Math.min(l,r),o),s(f=>T(C({},f),{dataValue:l,eventType:"update",eventID:_()})))}},J=t=>{let V=t,{color:e="theme",required:n,form:s="",legends:{enable:o=!0,custom:r,showAlways:i=!1}={},min:a,max:p,step:S,enableFormSubmit:u,checkValidationAtFirst:l,onValidate:f,onUpdateValue:v,onUpdateValidValue:L,value:b="",className:m,freeCSS:w,wrapStyles:x}=V,E=k(V,["color","required","form","legends","min","max","step","enableFormSubmit","checkValidationAtFirst","onValidate","onUpdateValue","onUpdateValidValue","value","className","freeCSS","wrapStyles"]),[h,R]=B({componentID:t.componentID||"",dataValue:b,min:a,max:p,step:S,eventType:"init",eventID:_()}),[M,K]=B({ok:!1,notice:[]});F.CommonEffects({type:"slider",states:t,val_status:h,set_status:R,val_validate:M,set_validate:K,SystemValidation:j});let U=z({value:h.dataValue,val_status:h});return d(X,{val_status:h,set_status:R,val_validate:M,states:t,children:W(q,{gap:"1/2",flexSizing:"auto",className:[c("Wrap"),m,c("ShowLegendsAlways_"+i)].join(" "),children:[d(N.Rail,{rootStates:t,color:e,val_status:h,set_status:R,DotData:U,form:s,enableFormSubmit:u}),!!o&&d(N.IndicatorLabels,{componentID:h.componentID,min:a,max:p,step:S,customLegends:r})]})})},H=t=>{let e=C({},t);return d(G,{componentID:t.componentID,children:J,states:$(e)})};export{H as Slider,H as default};
1
+ import{b as y,c as D,d as V}from"../../chunk-C5N2D3ZX.js";import{jsx as d,jsxs as H}from"react/jsx-runtime";import L,{UUID as _}from"jmini";import{useState as k,useEffect as U}from"react";import{$$fromRoot as x,GenerateHTMLProps as P}from"../../@utils";import{Box as C,Flex as B,Column as $}from"../../atoms";import{Button as q}from"../Button";import{OptionalInputWrapper as O,BoxWrapper as G,CoreEffects as A}from"./core";import{InputSliderClasses as c}from"../../@styles/componentClasses";function X(t){let{value:e,states:n}=t,{required:s}=n,o=[];return s&&!e&&o.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!o.filter(({type:r})=>r=="invalid").length,notice:o}}const F=t=>{let{value:e,val_status:n}=t,{min:s,max:o,step:r}=n;e=Math.max(e,s),e=Math.min(e,o);let a=e/o*o;return a=Math.round(a/r),{stepValue:a*r,stepIndex:a,positionLeft:a*r/o*100+"%"}},z={IndicatorLabels:t=>{let{componentID:e,min:n,max:s,step:o,customLegends:r}=t,i=[],a=Math.round(n/o),p=Math.round(s/o),S=p-a+1;for(var u=a;u<=p;u++){let l=u*o;l=Math.max(l,n),l=Math.min(l,s);let f=l/s*100+"%";i.push(d(C,{className:c("Label"),id:"Legend-"+e+"-"+u,display:u==a||u==p?"flex":"none",position:"absolute",top:0,unitHeight:1,unitWidth:1.5,transition:"middle",fontColor:"1.clear",verticalAlign:"center",horizontalAlign:"center",freeCSS:{left:f,whiteSpace:"nowrap",textAlign:"center"},children:r?r(l):l.rank()},l))}return U(()=>{const l=()=>{let f=x("#Labels-"+e),{width:v}=f.position(),w=Math.round(v/50)-1,h=Math.round(S/w);for(let m=a+1;m<p;m++)x("#Legend-"+e+"-"+m).css({display:m%h==0?"flex":"none"})};return L(window).addEvent({eventID:"SliderResizeCallback-"+e,eventType:"resize",callback:()=>{l()}}),l(),()=>{L(window).removeEvent("SliderResizeCallback-"+e)}},[]),d(B,{className:c("Labels"),verticalAlign:"center",horizontalAlign:"between",fontSize:"0.xs",position:"relative",unitHeight:1,id:"Labels-"+e,children:d(C,{position:"absolute",top:0,left:0,bottom:0,freeCSS:{right:12*1.5},children:i})})},Rail:t=>{let{val_status:e,set_status:n,DotData:s,form:o,enableFormSubmit:r}=t,{componentID:i}=e;return H(B,{className:c("Rail"),position:"relative",paddingLeft:"1/2",unitHeight:1.5,verticalAlign:"center",freeCSS:{zIndex:1,cursor:"pointer"},onPointerDown:a=>{t.rootStates.disabled||(a.stopPropagation(),g.Effects.Start(a,{val_status:e,set_status:n,DotData:s}))},children:[d(C,{className:c("Bar"),backgroundColor:"layer.4",position:"relative",borderRadius:"1.tone.primary",transition:"middle",flexSizing:"none",unitHeight:"2/3",width:1,id:i+"_Bar",children:d(C,{className:c("BarColor"),position:"relative",height:1,width:0,left:0,transition:"long",borderRadius:"inherit",backgroundColor:t.color,opacity:"middle",overflow:"hidden",freeCSS:{width:s.positionLeft},id:i+"_BarColor"})}),d(C,{className:c("BallWrap"),position:"absolute",top:0,left:0,bottom:0,freeCSS:{right:12*1.5},children:d(q.Plain,{className:c("Ball"),position:"absolute",boxShadow:"1.remark",backgroundColor:t.color,top:0,left:0,ssSquare:1.5,borderRadius:"1.tone.primary",freeCSS:{zIndex:2,left:s.positionLeft},id:i+"_Ball",onKeyDown:a=>{g.KeyDownEvent({event:a,val_status:e,set_status:n,DotData:s}),r&&A.SubmitForm(a,o)}})})]})}},g={Effects:{Start:(t,e)=>{L(document).addEvent({eventID:"SliderMouseMove",eventType:"mousemove",callback:n=>{g.Effects.Move(n,e)},options:{passive:!1}}).addEvent({eventID:"SliderTouchMove",eventType:"touchmove",callback:n=>{g.Effects.Move(n,e)},options:{passive:!1}}).addEvent({eventID:"SliderMouseUp",eventType:"mouseup",callback:()=>{g.Effects.End()}}).addEvent({eventID:"SliderTouchEnd",eventType:"touchend",callback:()=>{g.Effects.End()}})},Move:(t,e)=>{let n=L.getCursor(t).x,{val_status:s,set_status:o}=e,{componentID:r,min:i,max:a}=s,p=x("#"+r+"_Ball"),S=x("#"+r+"_Bar"),u=x("#"+r+"_BarColor"),{width:l,left:f}=S.position(),v=(n-f)/l;v=Math.max(v,0),v=Math.min(v,1);let w=v*a,h=F({value:w,val_status:s}),m=h.positionLeft,R=h.stepValue;return p.css({left:m}),u.css({width:m}),o(I=>{let b=I.dataValue;return R==b?I:D(y({},I),{dataValue:R,eventType:"update",eventID:_()})}),t.preventDefault(),t.stopPropagation(),!1},End:()=>{L(document).removeEvent(["SliderMouseMove","SliderTouchMove","SliderMouseUp","SliderTouchEnd"])}},KeyDownEvent:t=>{let{event:e,val_status:n,set_status:s}=t,{min:o,max:r,step:i}=n,{key:a,metaKey:p,ctrlKey:S}=e,u=S||p,l=n.dataValue;a.match(/Arrow/)&&(e.preventDefault(),a.match(/Left|Up/)?u?l=o:l-=i:a.match(/Right|Down/)&&(u?l=r:l+=i),l=Math.max(Math.min(l,r),o),s(f=>D(y({},f),{dataValue:l,eventType:"update",eventID:_()})))}},j=t=>{let M=t,{color:e="theme",required:n,form:s="",legends:{enable:o=!0,custom:r,showAlways:i=!1}={},min:a,max:p,step:S,enableFormSubmit:u,checkValidationAtFirst:l,onValidate:f,onUpdateValue:v,onUpdateValidValue:w,value:h="",className:m,wrapStyles:R}=M,I=V(M,["color","required","form","legends","min","max","step","enableFormSubmit","checkValidationAtFirst","onValidate","onUpdateValue","onUpdateValidValue","value","className","wrapStyles"]),[b,T]=k({componentID:t.componentID||"",dataValue:h,min:a,max:p,step:S,eventType:"init",eventID:_()}),[E,W]=k({ok:!1,notice:[]});A.CommonEffects({type:"slider",states:t,val_status:b,set_status:T,val_validate:E,set_validate:W,SystemValidation:X});let K=F({value:b.dataValue,val_status:b});return d(G,{val_status:b,set_status:T,val_validate:E,states:t,children:H($,D(y({gap:"1/2",flexSizing:"auto"},I),{className:[c("Wrap"),m,c("ShowLegendsAlways_"+i)].join(" "),children:[d(z.Rail,{rootStates:t,color:e,val_status:b,set_status:T,DotData:K,form:s,enableFormSubmit:u}),!!o&&d(z.IndicatorLabels,{componentID:b.componentID,min:a,max:p,step:S,customLegends:r})]}))})},N=t=>{let e=D(y({},t),{freeCSS:y({minWidth:120},t.freeCSS)});return d(O,{componentID:t.componentID,children:j,states:P(e)})};export{N as Slider,N as default};
@@ -1 +1 @@
1
- import{b as u,d as D}from"../chunk-C5N2D3ZX.js";import{jsx as y}from"react/jsx-runtime";import a,{UUID as O,useStore as c}from"jmini";import{useState as l,useEffect as w,useRef as b}from"react";import{$$fromRoot as d}from"../@utils";import{Box as H}from"../atoms";import{AccordionClasses as _}from"../@styles/componentClasses";const E=e=>{e=u({},e);let A=e,{accordionID:o="",slideAnimation:v="fast",defaultOpen:f=!1,override:C=!1}=A,R=D(A,["accordionID","slideAnimation","defaultOpen","override"]),[p]=l(O()),[m]=l(O()),[s,r]=l(f),[g,I]=l(0);C&&s!=f&&r(f);const x=b(!1);return w(()=>{a.scope(()=>{let t=d('[data-accordion-content-id="'+m+'"]')[0];if(!t)return;let n=t.offsetHeight,i=0;v=="fast"?(i=n/1e3,i=Math.max(i,.2)):v=="slow"&&(i=n/300),I(n),d("#"+p).css({transition:i+"s"})}),a.scope(()=>{o&&c.set({["Accordion-"+o]:{open:()=>{r(!0)},close:()=>{r(!1)},toggle:()=>{r(t=>!t)},isOpen:()=>{let t;return r(n=>(t=n,n)),t}}})})},[]),w(()=>{let t=d("#"+p),n=d('[data-accordion-content-id="'+m+'"]')[0];x.current||(x.current=!0),a.scope(()=>{if(!n||a.is.nullish(g))return;let i=n.offsetHeight;g!=i&&I(i),g&&t.css({maxHeight:i+1+"px"}).await(100),s?t.css({maxHeight:"unset",overflow:(e==null?void 0:e.overflow)||"unset"}):t.css({maxHeight:"0px",overflow:"hidden"})})},[s]),y(H,{className:[_("Wrap"),_("Open_"+s)].join(" "),id:p,children:y(H,u({"data-accordion-content-id":m},R))})},h=E;h.fn={open:e=>{let o=c.get("Accordion-"+e);!o||o.open()},close:e=>{let o=c.get("Accordion-"+e);!o||o.close()},toggle:e=>{let o=c.get("Accordion-"+e);!o||o.toggle()},isOpen:e=>{let o=c.get("Accordion-"+e);if(o)return o.isOpen()}};export{h as Accordion,h as default};
1
+ import{b as u,d as D}from"../chunk-C5N2D3ZX.js";import{jsx as C}from"react/jsx-runtime";import a,{UUID as w,useStore as r}from"jmini";import{useState as l,useEffect as H,useRef as b}from"react";import{$$fromRoot as d}from"../@utils";import{Box as O}from"../atoms";import{AccordionClasses as _}from"../@styles/componentClasses";const E=o=>{o=u({},o);let x=o,{accordionID:e="",slideAnimation:v="fast",defaultOpen:f=!1,override:R=!1}=x,y=D(x,["accordionID","slideAnimation","defaultOpen","override"]),[p]=l(w()),[m]=l(w()),[c,s]=l(f),[g,A]=l(0);R&&c!=f&&s(f);const I=b(!1);return H(()=>{a.scope(()=>{let n=d('[data-accordion-content-id="'+m+'"]')[0];if(!n)return;let i=n.offsetHeight,t=0;v=="fast"?(t=i/1e3,t=Math.max(t,.2)):v=="slow"&&(t=i/300),A(i),d("#"+p).css({transition:t+"s"})}),a.scope(()=>{e&&r.set({["Accordion-"+e]:{open:()=>{s(!0)},close:()=>{s(!1)},toggle:()=>{s(n=>!n)}}})})},[]),r.update({["Accordion-"+e]:{isOpen:!!c}}),H(()=>{let n=d("#"+p),i=d('[data-accordion-content-id="'+m+'"]')[0];I.current||(I.current=!0),a.scope(()=>{if(!i||a.is.nullish(g))return;let t=i.offsetHeight;g!=t&&A(t),g&&n.css({maxHeight:t+1+"px"}).await(100),c?n.css({maxHeight:"unset",overflow:(o==null?void 0:o.overflow)||"unset"}):n.css({maxHeight:"0px",overflow:"hidden"})})},[c]),C(O,{className:[_("Wrap"),_("Open_"+c)].join(" "),id:p,children:C(O,u({"data-accordion-content-id":m},y))})},h=E;h.fn={open:o=>{let e=r.get("Accordion-"+o);!e||e.open()},close:o=>{let e=r.get("Accordion-"+o);!e||e.close()},toggle:o=>{let e=r.get("Accordion-"+o);!e||e.toggle()},isOpen:o=>{let e=r.get("Accordion-"+o);if(e)return e.isOpen}};export{h as Accordion,h as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amotify",
3
- "version": "0.2.139",
3
+ "version": "0.2.141",
4
4
  "description": "UI Component for React,NextJS,esbuild",
5
5
  "scripts": {
6
6
  "start": "run-p clean build:*",