amotify 0.2.22 → 0.2.23

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 o,c,e as x}from"../../chunk-C5N2D3ZX.js";import{jsx as S,jsxs as V}from"react/jsx-runtime";import{useState as E,useEffect as k}from"react";import i from"@mingoo/jsmin";import{$$fromRoot as w,Config as F,useStore as v,GenerateClassName as D}from"../../@utils";import{InputClasses as B}from"../../@styles/componentClasses";import _ from"../../atoms/Box";import P from"../../atoms/Flex";import R from"../../atoms/FAI";import N from"../../mols/Row";import O from"../../mols/Column";import z from"../Button";import T from"../Tooltips";const ie=e=>{let[t]=E(e.componentID||i.uuid.gen());e=o({},e),e.states=c(o({enableFormSubmit:!0,status_id:i.uuid.gen(),override:"never",name:i.uuid.gen(),id:i.uuid.gen(),"aria-label":"Input-"+t},e.states),{componentID:t});let{children:a}=e;return S(a,o({},e.states))},se=e=>{let{children:t,val_status:a,set_status:r,val_validate:s,states:l}=e,{clearButton:n,rightIcon:u,leftIcon:p,wrapStyles:y}=l;return a.eventType=="init"&&!l.checkValidationAtFirst&&(s.notice=[]),V(N.Center,{styles:o({position:"relative",verticalAlign:"unset",gap:0},y),className:B("Wrapper"),"data-notice-uid":a.componentID,children:[S(L,{notice:s.notice,val_status:a}),l.leftIndicator,V(P,{styles:{position:"relative",flexSizing:"auto"},children:[p,t,n&&a.dataValue?S(z.Button.Normal.R,{styles:{ssSphere:2,flexCenter:!0,fontColor:"5.translucent",ssEffectsOnActive:["ripple.theme"],position:"absolute",right:1,top:"50%"},freeCSS:{zIndex:3,transform:"translateY(-50%)"},onClick:()=>{r(g=>c(o({},g),{dataValue:"",formatValue:"",eventType:"update",eventID:i.uuid.gen()}))},children:S(R.Times,{})}):u]}),l.rightIndicator]})},L=e=>{let{notice:t,val_status:a}=e,{componentID:r}=a,s="NoticeTimer-"+r,l="NoticeTimerClose-"+r,n="notice-tips-"+r;return i.interval.clear(s),i.interval.clear(l),i.interval.standBy(s,350,()=>{if(!t.length){T.close(n);return}T.open({tipsID:n,parent:`[data-notice-uid="${r}"]`,gravityPoint:22,styles:{padding:[1,0]},close_option:{parentBlur:!1},content:V(T.Comps.Body,{styles:{padding:["1/2","2/3"],fontSize:"1.mini",position:"relative"},children:[S(_,{styles:{position:"absolute",unitHeight:1,unitWidth:1,left:1,backgroundColor:"dark"},freeCSS:{zIndex:1,transform:"rotate(45deg)",top:-6}}),S(O,{styles:{backgroundColor:"inherit",gap:"1/3",position:"relative"},freeCSS:{zIndex:2},children:t.map((u,p)=>{let{type:y,label:g}=u,I=y=="invalid"?R.Times:y=="warn"?R.Exclamation:R.Check;return V(N.Left,{styles:{gap:0,borderRadius:"2.tone.secondary"},children:[S(I,{styles:{flexCenter:!0,fontSize:"3.paragraph",fontColor:{invalid:"nega",warn:"warn",valid:"posi"}[y]}}),S(_,{styles:{fontColor:"white"},children:g})]},p+"-"+JSON.stringify(u))})})]})})}),i.interval.standBy(l,6e3,()=>{T.close(n)}),null},ue=e=>{let{type:t,states:a,val_status:r,set_status:s,ExtraOverrideStates:l,ExtraStoreStates:n,val_validate:u,set_validate:p,DefaultValidation:y,onUpdateValue:g,onUpdateValidValue:I}=e;a=o({},a);let{componentID:b}=r;k(()=>(v.update({[b]:o({ResolveRefresh:null,Refresh:()=>new Promise((d,f)=>{v.get(b).ResolveRefresh=d,s(m=>c(o({},m),{eventType:"refresh",eventID:i.uuid.gen()}))}),GenNotice:d=>{let{ok:f,notice:m}=d;p({ok:f,notice:m})}},n)}),()=>{v.delete(b)}),[]),k(()=>{a.value=r.dataValue,i.interval.clear("ValidationTimer-"+b),A({val_status:r,set_validate:p,DefaultValidation:y,states:a})},[r.eventID]),(()=>{let{override:d}=a;if(d=="never"||d=="beforeModified"&&!["init","override"].includes(r.eventType))return;let f=v.get(r.componentID);f&&(a.value!=r.dataValue&&a.status_id!=f.status_id&&s(m=>c(o(c(o({},m),{dataValue:a.value}),l),{eventType:"override",eventID:i.uuid.gen()})),f.status_id=a.status_id)})(),k(()=>{let{componentID:d,eventType:f,dataValue:m}=r,C=m;if(t=="list"?C=m.map(h=>JSON.parse(h)):t=="select"||t=="richSelect"?C=JSON.parse(m):t=="file"&&v.update({[d]:{Files:r.dataValue}}),f=="refresh"){let h=v.get(d);h&&h.ResolveRefresh&&h.ResolveRefresh(null)}f=="update"&&(g&&g({componentID:d,value:C,storeData:v.get(d),eventType:f}),i.scope(()=>{u.ok&&I&&I({componentID:d,value:C,storeData:v.get(d),eventType:f})}))},[u])},A=e=>{let{val_status:t,states:a,set_validate:r,DefaultValidation:s}=e,l=s({value:t.dataValue,states:a});if(!l.ok){r(l);return}let n=l.notice;const u=()=>x(void 0,null,function*(){if(!a.onValidate)return;let p=yield a.onValidate({value:t.dataValue,eventType:t.eventType,props:e});if(!p.ok){r({ok:!1,notice:[...n,...p.notice]});return}r({ok:!0,notice:[...n,...p.notice]})});a.onValidate?t.eventType=="refresh"?u():i.interval.standBy("ValidationTimer-"+t.componentID,450,u):r({ok:!0,notice:n})},de=e=>{let t=e.target,{form:a,formName:r}=t.dataset;a=r||a;let s=!1,l=w(`[data-form-submit-button="${a}"]`)[0];if(!l)return s;let n=l.dataset.sdfike||"",u=e.key,p=e.ctrlKey||e.metaKey;return i.scope(()=>{n.includes("enter")&&(u!="Enter"||e.nativeEvent.isComposing||F.get().browserIs=="safari"&&e.keyCode==229)||((u=="Enter"&&(n.includes("enter")||n.includes("auxEnter")&&p)||u==" "&&n.includes("space"))&&(l.click(),e.preventDefault()),s=!0)}),s},K={Input:e=>{if(e=="plain")return{};let t={padding:"3/4",transition:"middle",flexSizing:"auto",boxShadow:"0.min"};return e=="border"?t=c(o({},t),{border:!0,borderRadius:"2.tone.secondary",backgroundColor:"layer.1"}):e=="cloud"?t=c(o({},t),{border:"1.thin",borderRadius:"2.tone.secondary",backgroundColor:"cloud"}):e=="bottomBorder"&&(t=c(o({},t),{borderRadius:0,border:"unset",borderBottom:!0,backgroundColor:"cloud"})),t},ListCell:e=>{e=o({},e),e.tone||(e.tone="border");let{tone:t}=e;return t=="plain"||(e.cellStyles=o({position:"relative",padding:["3/4",1],borderRadius:"2.tone.secondary",transition:"middle"},e.cellStyles),t=="normal"?(e.styles=o({gap:"1/2"},e.styles),e.cellStyles=o({isSemiBoldFont:!0},e.cellStyles),e.cellCheckedStyles=o({backgroundColor:"cloud"},e.cellCheckedStyles)):(e.styles=o({gap:"3/4"},e.styles),e.cellStyles=o({boxShadow:"0.min"},e.cellStyles),(t=="cloud"||t=="vivid")&&(e.cellStyles=o({border:"1.thin",backgroundColor:"layer.2"},e.cellStyles)),t=="border"?(e.cellStyles=o({border:!0,backgroundColor:"layer.1"},e.cellStyles),e.cellCheckedStyles=o({borderColor:"theme",fontColor:"theme"},e.cellCheckedStyles)):t=="cloud"?e.cellCheckedStyles=o({backgroundColor:"theme.opa.few",fontColor:"theme",borderColor:"theme"},e.cellCheckedStyles):t=="vivid"&&(e.cellCheckedStyles=o({backgroundColor:"theme",fontColor:"white",borderColor:"theme"},e.cellCheckedStyles)))),D(e)},Boxish:e=>{e=o({},e),e.tone||(e.tone="border");let t=K.Input(e.tone),a=c(o({},e),{styles:o(o(o(o({fontColor:"2.normal"},t),!!e.leftIndicator&&{borderTopLeftRadius:"2/3",borderBottomLeftRadius:"2/3",marginLeft:"1/4"}),!!e.rightIndicator&&{borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",marginRight:"1/4"}),e.styles),className:[B("Input"),e.className].join(" ")});return D(a)},Indicator:e=>{if(e||(e="border"),e=="plain")return{};let t={flexSizing:"none",flexCenter:!0,padding:[0,1],borderRadius:"2.tone.secondary",backgroundColor:"cloud"};return e=="border"?t=c(o({},t),{border:!0}):e=="cloud"?t=c(o({},t),{border:"1.thin"}):e=="bottomBorder"&&(t=c(o({},t),{borderRadius:0,borderBottom:!0})),t},IndicatorIcon:{position:"absolute",ssSquare:2,top:"50%",flexCenter:!0,fontColor:"theme",fontSize:"1.mini",backgroundColor:"inherit",freeCSS:{transform:"translateY(-50%)"}}};export{se as BoxWrapper,ue as CommonEffects,K as DefaultStyles,de as SubmitForm,A as ValidationCheck,ie as Wrapper};
1
+ import{b as o,c,e as x}from"../../chunk-C5N2D3ZX.js";import{jsx as v,jsxs as V}from"react/jsx-runtime";import{useState as E,useEffect as k}from"react";import i from"@mingoo/jsmin";import{$$fromRoot as w,Config as F,useStore as S,GenerateClassName as D}from"../../@utils";import{InputClasses as B}from"../../@styles/componentClasses";import _ from"../../atoms/Box";import P from"../../atoms/Flex";import R from"../../atoms/FAI";import N from"../../mols/Row";import O from"../../mols/Column";import z from"../Button";import T from"../Tooltips";const ie=e=>{let[t]=E(e.componentID||i.uuid.gen());e=o({},e),e.states=c(o({enableFormSubmit:!0,status_id:i.uuid.gen(),override:"never",name:i.uuid.gen(),id:i.uuid.gen(),"aria-label":"Input-"+t},e.states),{componentID:t});let{children:a}=e;return v(a,o({},e.states))},se=e=>{let{children:t,val_status:a,set_status:r,val_validate:s,states:l}=e,{clearButton:n,rightIcon:u,leftIcon:f,wrapStyles:y}=l;return a.eventType=="init"&&!l.checkValidationAtFirst&&(s.notice=[]),V(N.Center,{styles:o({position:"relative",verticalAlign:"unset",gap:0},y),freeCSS:y.freeCSS,className:B("Wrapper"),"data-notice-uid":a.componentID,children:[v(L,{notice:s.notice,val_status:a}),l.leftIndicator,V(P,{styles:{position:"relative",flexSizing:"auto"},children:[f,t,n&&a.dataValue?v(z.Button.Normal.R,{styles:{ssSphere:2,flexCenter:!0,fontColor:"5.translucent",ssEffectsOnActive:["ripple.theme"],position:"absolute",right:1,top:"50%"},freeCSS:{zIndex:3,transform:"translateY(-50%)"},onClick:()=>{r(C=>c(o({},C),{dataValue:"",formatValue:"",eventType:"update",eventID:i.uuid.gen()}))},children:v(R.Times,{})}):u]}),l.rightIndicator]})},L=e=>{let{notice:t,val_status:a}=e,{componentID:r}=a,s="NoticeTimer-"+r,l="NoticeTimerClose-"+r,n="notice-tips-"+r;return i.interval.clear(s),i.interval.clear(l),i.interval.standBy(s,350,()=>{if(!t.length){T.close(n);return}T.open({tipsID:n,parent:`[data-notice-uid="${r}"]`,gravityPoint:22,styles:{padding:[1,0]},close_option:{parentBlur:!1},content:V(T.Comps.Body,{styles:{padding:["1/2","2/3"],fontSize:"1.mini",position:"relative"},children:[v(_,{styles:{position:"absolute",unitHeight:1,unitWidth:1,left:1,backgroundColor:"dark"},freeCSS:{zIndex:1,transform:"rotate(45deg)",top:-6}}),v(O,{styles:{backgroundColor:"inherit",gap:"1/3",position:"relative"},freeCSS:{zIndex:2},children:t.map((u,f)=>{let{type:y,label:C}=u,I=y=="invalid"?R.Times:y=="warn"?R.Exclamation:R.Check;return V(N.Left,{styles:{gap:0,borderRadius:"2.tone.secondary"},children:[v(I,{styles:{flexCenter:!0,fontSize:"3.paragraph",fontColor:{invalid:"nega",warn:"warn",valid:"posi"}[y]}}),v(_,{styles:{fontColor:"white"},children:C})]},f+"-"+JSON.stringify(u))})})]})})}),i.interval.standBy(l,6e3,()=>{T.close(n)}),null},ue=e=>{let{type:t,states:a,val_status:r,set_status:s,ExtraOverrideStates:l,ExtraStoreStates:n,val_validate:u,set_validate:f,DefaultValidation:y,onUpdateValue:C,onUpdateValidValue:I}=e;a=o({},a);let{componentID:b}=r;k(()=>(S.update({[b]:o({ResolveRefresh:null,Refresh:()=>new Promise((d,p)=>{S.get(b).ResolveRefresh=d,s(m=>c(o({},m),{eventType:"refresh",eventID:i.uuid.gen()}))}),GenNotice:d=>{let{ok:p,notice:m}=d;f({ok:p,notice:m})}},n)}),()=>{S.delete(b)}),[]),k(()=>{a.value=r.dataValue,i.interval.clear("ValidationTimer-"+b),A({val_status:r,set_validate:f,DefaultValidation:y,states:a})},[r.eventID]),(()=>{let{override:d}=a;if(d=="never"||d=="beforeModified"&&!["init","override"].includes(r.eventType))return;let p=S.get(r.componentID);p&&(a.value!=r.dataValue&&a.status_id!=p.status_id&&s(m=>c(o(c(o({},m),{dataValue:a.value}),l),{eventType:"override",eventID:i.uuid.gen()})),p.status_id=a.status_id)})(),k(()=>{let{componentID:d,eventType:p,dataValue:m}=r,g=m;if(t=="list"?g=m.map(h=>JSON.parse(h)):t=="select"||t=="richSelect"?g=JSON.parse(m):t=="file"&&S.update({[d]:{Files:r.dataValue}}),p=="refresh"){let h=S.get(d);h&&h.ResolveRefresh&&h.ResolveRefresh(null)}p=="update"&&(C&&C({componentID:d,value:g,storeData:S.get(d),eventType:p}),i.scope(()=>{u.ok&&I&&I({componentID:d,value:g,storeData:S.get(d),eventType:p})}))},[u])},A=e=>{let{val_status:t,states:a,set_validate:r,DefaultValidation:s}=e,l=s({value:t.dataValue,states:a});if(!l.ok){r(l);return}let n=l.notice;const u=()=>x(void 0,null,function*(){if(!a.onValidate)return;let f=yield a.onValidate({value:t.dataValue,eventType:t.eventType,props:e});if(!f.ok){r({ok:!1,notice:[...n,...f.notice]});return}r({ok:!0,notice:[...n,...f.notice]})});a.onValidate?t.eventType=="refresh"?u():i.interval.standBy("ValidationTimer-"+t.componentID,450,u):r({ok:!0,notice:n})},de=e=>{let t=e.target,{form:a,formName:r}=t.dataset;a=r||a;let s=!1,l=w(`[data-form-submit-button="${a}"]`)[0];if(!l)return s;let n=l.dataset.sdfike||"",u=e.key,f=e.ctrlKey||e.metaKey;return i.scope(()=>{n.includes("enter")&&(u!="Enter"||e.nativeEvent.isComposing||F.get().browserIs=="safari"&&e.keyCode==229)||((u=="Enter"&&(n.includes("enter")||n.includes("auxEnter")&&f)||u==" "&&n.includes("space"))&&(l.click(),e.preventDefault()),s=!0)}),s},K={Input:e=>{if(e=="plain")return{};let t={padding:"3/4",transition:"middle",flexSizing:"auto",boxShadow:"0.min"};return e=="border"?t=c(o({},t),{border:!0,borderRadius:"2.tone.secondary",backgroundColor:"layer.1"}):e=="cloud"?t=c(o({},t),{border:"1.thin",borderRadius:"2.tone.secondary",backgroundColor:"cloud"}):e=="bottomBorder"&&(t=c(o({},t),{borderRadius:0,border:"unset",borderBottom:!0,backgroundColor:"cloud"})),t},ListCell:e=>{e=o({},e),e.tone||(e.tone="border");let{tone:t}=e;return t=="plain"||(e.cellStyles=o({position:"relative",padding:["3/4",1],borderRadius:"2.tone.secondary",transition:"middle"},e.cellStyles),t=="normal"?(e.styles=o({gap:"1/2"},e.styles),e.cellStyles=o({isSemiBoldFont:!0},e.cellStyles),e.cellCheckedStyles=o({backgroundColor:"cloud"},e.cellCheckedStyles)):(e.styles=o({gap:"3/4"},e.styles),e.cellStyles=o({boxShadow:"0.min"},e.cellStyles),(t=="cloud"||t=="vivid")&&(e.cellStyles=o({border:"1.thin",backgroundColor:"layer.2"},e.cellStyles)),t=="border"?(e.cellStyles=o({border:!0,backgroundColor:"layer.1"},e.cellStyles),e.cellCheckedStyles=o({borderColor:"theme",fontColor:"theme"},e.cellCheckedStyles)):t=="cloud"?e.cellCheckedStyles=o({backgroundColor:"theme.opa.few",fontColor:"theme",borderColor:"theme"},e.cellCheckedStyles):t=="vivid"&&(e.cellCheckedStyles=o({backgroundColor:"theme",fontColor:"white",borderColor:"theme"},e.cellCheckedStyles)))),D(e)},Boxish:e=>{e=o({},e),e.tone||(e.tone="border");let t=K.Input(e.tone),a=c(o({},e),{styles:o(o(o(o({fontColor:"2.normal"},t),!!e.leftIndicator&&{borderTopLeftRadius:"2/3",borderBottomLeftRadius:"2/3",marginLeft:"1/4"}),!!e.rightIndicator&&{borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",marginRight:"1/4"}),e.styles),className:[B("Input"),e.className].join(" ")});return D(a)},Indicator:e=>{if(e||(e="border"),e=="plain")return{};let t={flexSizing:"none",flexCenter:!0,padding:[0,1],borderRadius:"2.tone.secondary",backgroundColor:"cloud"};return e=="border"?t=c(o({},t),{border:!0}):e=="cloud"?t=c(o({},t),{border:"1.thin"}):e=="bottomBorder"&&(t=c(o({},t),{borderRadius:0,borderBottom:!0})),t},IndicatorIcon:{position:"absolute",ssSquare:2,top:"50%",flexCenter:!0,fontColor:"theme",fontSize:"1.mini",backgroundColor:"inherit",freeCSS:{transform:"translateY(-50%)"}}};export{se as BoxWrapper,ue as CommonEffects,K as DefaultStyles,de as SubmitForm,A as ValidationCheck,ie as Wrapper};
@@ -26,7 +26,7 @@ export declare namespace InputTypes {
26
26
  };
27
27
  type CoreInput = UniInput & {
28
28
  className?: string;
29
- wrapStyles?: TagProperty.Properties;
29
+ wrapStyles?: TagProperty.PropsNFreeCSS;
30
30
  } & TagProperty.States;
31
31
  namespace Validation {
32
32
  type EventType = 'init' | 'update' | 'override' | 'refresh';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amotify",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
4
4
  "description": "UI Component for React,NextJS,esbuild",
5
5
  "scripts": {
6
6
  "start": "run-p clean build:*",