amotify 0.3.31 → 0.3.32

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 n,c as u,d as U}from"../../chunk-C5N2D3ZX.js";import{Fragment as te,jsx as o,jsxs as w}from"react/jsx-runtime";import c,{UUID as v}from"jmini";import{useState as Q,useEffect as K}from"react";import{Box as V,FAI as Y,Column as ve}from"../../atoms";import{Literal as q,Row as H}from"../../mols";import{Button as Ie}from"../Button";import{Sheet as be}from"../Sheet";import{OptionalInputWrapper as ge,BoxWrapper as ke,CoreEffects as P,DefaultBoxishStyles as he}from"./core";import{InputAutocompleteClasses as R}from"../../@styles/componentClasses";import{InputLabel as Oe}from"./Label";import{RightIcon as we}from".";function xe(t){let{value:e,states:a}=t,{required:d,options:p}=a,s=[];return d&&e===null&&s.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!s.filter(({type:I})=>I=="invalid").length,notice:s}}const k={FilterSelectableOptions:(t,e)=>{let a=t.rootStates.options;return e||(a=a.filter(d=>(d==null?void 0:d.type)!="label")),a},Button:t=>w(te,{children:[o(k.Native,n({},t)),o(k.Original,n({},t))]}),Placeholder:t=>!t.rootStates.placeholder||t.val_status.rawValue!==null?null:o(V,{position:"absolute",opacity:"middle",fontColor:"3.blur",children:t.rootStates.placeholder||""}),Native:t=>{let{rootStates:e,val_status:a,set_status:d}=t,T=e,{tone:p,required:s,form:I,className:i,label:b,isLabelActive:m,placeholder:h,enableFormSubmit:g,emptySelect:D,showInitValidation:B,onValidate:L,onValidateDelay:$,onUpdateValue:le,onUpdateValidValue:ae,onUserAction:ne,onKeyDown:W,onChange:_,value:ie="",options:z,leftIndicator:re,rightIndicator:se,leftIcon:oe,rightIcon:ue,componentId:ce,status_id:de,wrapStyles:pe,selectedStyles:fe,selectorStyles:Se,pickerStyles:me,pickerPosition:ye,nativePicker:E}=T,r=U(T,["tone","required","form","className","label","isLabelActive","placeholder","enableFormSubmit","emptySelect","showInitValidation","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","onKeyDown","onChange","value","options","leftIndicator","rightIndicator","leftIcon","rightIcon","componentId","status_id","wrapStyles","selectedStyles","selectorStyles","pickerStyles","pickerPosition","nativePicker"]);return E?w(V,u(n({htmlTag:"select",tabIndex:0},r),{"data-disabled":e.disabled,"data-show-validation":P.isShowValidation(a,!!B),"data-component-id":a.componentId,"data-input-origin":a.componentId,className:[i,R("Core")].join(" "),onKeyDown:l=>{W&&W(l),g&&P.SubmitForm(l,I)},onChange:l=>{let{value:S}=l.target;d(C=>u(n({},C),{rawValue:S,eventType:"update",eventID:v(12),isInspected:!1,isValidated:!1,notice:[]})),_&&_(l)},children:[!!D&&o("option",{value:"null",children:"\u9078\u629E"}),z.map(l=>c.isNullish(l==null?void 0:l.value)?null:o("option",{value:l==null?void 0:l.value,children:(l==null?void 0:l.label)||(l==null?void 0:l.value)},String(l==null?void 0:l.value)))]})):null},Original:t=>{let{rootStates:e,val_optionFocused:a,set_optionFocused:d,val_status:p,set_status:s}=t,T=e,{tone:I,required:i,form:b,className:m,label:h,isLabelActive:g,placeholder:D,enableFormSubmit:B,emptySelect:L,showInitValidation:$,onValidate:le,onValidateDelay:ae,onUpdateValue:ne,onUpdateValidValue:W,onUserAction:_,value:ie="",options:z,leftIndicator:re,rightIndicator:se,leftIcon:oe,rightIcon:ue,componentId:ce,status_id:de,wrapStyles:pe,selectedStyles:fe,selectorStyles:Se,pickerStyles:me,pickerPosition:ye,nativePicker:E}=T,r=U(T,["tone","required","form","className","label","isLabelActive","placeholder","enableFormSubmit","emptySelect","showInitValidation","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","options","leftIndicator","rightIndicator","leftIcon","rightIcon","componentId","status_id","wrapStyles","selectedStyles","selectorStyles","pickerStyles","pickerPosition","nativePicker"]);return K(()=>{if(E||e.disabled)return;let l="select-click-"+e.componentId;if(p.isPickerOpen){if(!c('[data-input-origin="'+e.componentId+'"]'))return;c(document).onEvent("click",C=>{let F=c(C.target),A=!!c(F).parent("."+R("Core")).length;c(F).parent("."+R("Selector")).length||A||s(f=>u(n({},f),{eventID:v(12),isPickerOpen:!1}))},{eventID:l})}else c(document).removeEvent([l])},[p.isPickerOpen]),E?null:w(te,{children:[o(V,u(n({tabIndex:0},r),{"data-disabled":e.disabled,"data-show-validation":P.isShowValidation(p,!!$),"data-component-id":p.componentId,"data-input-origin":p.componentId,className:[m,R("Core")].join(" "),onFocus:l=>{r!=null&&r.onFocus&&(r==null||r.onFocus(l)),!e.disabled&&s(S=>u(n({},S),{eventID:v(12),isFocusing:!0,isPickerOpen:!0}))},onBlur:l=>{r!=null&&r.onBlur&&(r==null||r.onBlur(l)),s(S=>u(n({},S),{eventID:v(12),isFocusing:!1}))},onClick:l=>{r!=null&&r.onClick&&(r==null||r.onClick(l)),!e.disabled&&s(S=>u(n({},S),{eventID:v(12),isPickerOpen:!0}))},onKeyDown:l=>{let{key:S,metaKey:C,ctrlKey:F}=l,A=C||F;if(r!=null&&r.onKeyDown&&(r==null||r.onKeyDown(l)),B&&P.SubmitForm(l,b),!e.disabled){if(c.scope(()=>{if(!c.isOneOf(S,"ArrowDown","ArrowUp"))return;if(l.preventDefault(),!p.isPickerOpen){s(O=>u(n({},O),{eventID:v(12),isPickerOpen:!0}));return}let y=S=="ArrowDown"?1:-1,f=k.FilterSelectableOptions(t),N=f.length-1,x=null;c.scope(()=>{var j,J,X,Z,G;let O=f.findIndex(M=>(M==null?void 0:M.id)==a);if(y==1){if(x=(j=f[0])==null?void 0:j.id,A){x=f[N].id;return}if(O==-1||O==N)return;x=(J=f[O+1])==null?void 0:J.id}else{if(x=(X=f[N])==null?void 0:X.id,A){x=(Z=f[0])==null?void 0:Z.id;return}if(O==-1||O==0)return;x=(G=f[O-1])==null?void 0:G.id}}),d(x)}),S=="Escape")s(y=>u(n({},y),{eventID:v(12),isPickerOpen:!1}));else if(S=="Tab")s(y=>u(n({},y),{eventID:v(12),isPickerOpen:!1}));else if(S=="Backspace")s(y=>u(n({},y),{rawValue:null,eventType:"update",eventID:v(12),isInspected:!1}));else if(S==" ")l.preventDefault(),s(y=>u(n({},y),{eventID:v(12),isPickerOpen:!0}));else if(S=="Enter"){if(!p.isPickerOpen){s(f=>u(n({},f),{eventID:v(12),isPickerOpen:!0}));return}l.preventDefault();let y=e.options.find(f=>(f==null?void 0:f.id)==a);if(!y)return;s(f=>u(n({},f),{rawValue:y==null?void 0:y.value,eventType:"update",eventID:v(12),isPickerOpen:!1,isInspected:!1}))}}},children:w(H.Left,{gap:0,children:[o(V,{xcss:{width:0},overflow:"hidden",opacity:"trans","data-input-value-shallow":p.componentId,children:"A"}),w(H.Left,{flexWrap:!0,gap:"1/3",xcss:{letterSpacing:".5px"},children:[o(k.Placeholder,n({},t)),o(k.Selected,n({},t))]})]})})),o(k.Picker,n({},t))]})},Picker:t=>{var I;let{rootStates:e,val_status:a,val_optionFocused:d}=t;K(()=>{if(!a.isPickerOpen||!a.rawValue)return;let i=c(`[data-picker-id="${a.componentId}"]`)[0];if(!i)return;let b=i.position(),m=e.options.find(g=>(g==null?void 0:g.value)===a.rawValue);if(!m)return;let h=c(`[data-select-input-value="${m.id}"]`)[0];h&&(i.scrollTop=h.offsetTop-b.height/2+h.offsetHeight/2)},[a.isPickerOpen]),K(()=>{let i=c(`[data-picker-id="${a.componentId}"]`)[0];if(!i)return;let b=i.position(),m=c(`[data-select-input-value="${d}"]`)[0];m&&(i.scrollTop=m.offsetTop-b.height/2+m.offsetHeight/2)},[d]);let p=k.FilterSelectableOptions(t,!0),s={};{let i=e.pickerPosition||0;c.isOneOf(i,1,2)?s.bottom="100%":c.isOneOf(i,3,4)&&(s.top="100%"),c.isOneOf(i,1,3)?s.left=0:c.isOneOf(i,2,4)&&(s.right=0)}return a.isPickerOpen?o(V,u(n({position:"absolute",ssZIndex:1e3,minWidth:1,padding:"1/3"},s),{children:o(be.Body,u(n({className:R("Selector"),ssCardBox:!0,borderRadius:"2.tone.secondary",boxShadow:"1.normal",overflow:"auto","data-picker-id":a.componentId},e.pickerStyles),{xcss:n({minWidth:12*6,maxHeight:12*24},(I=e.pickerStyles)==null?void 0:I.xcss),children:w(ve,{gap:"1/12",padding:[1,0],children:[p.map((i,b)=>{if(!i)return null;let{type:m,value:h}=i,g=t.val_optionFocused==i.id,D=t.val_status.rawValue===h;return m=="label"?o(V,{children:i.label||i.value},v()):o(Ie.Sub.S,u(n({"data-select-input-value":i.id,color:"cloud",backgroundColor:"trans",borderRadius:0,fontColor:"2.normal",textAlign:"left",padding:["1/2",1],isActive:D||g,isActiveStyles:g?{backgroundColor:"cloud"}:{backgroundColor:"theme.opa.few",fontColor:"theme"}},e.selectorStyles),{onClick:B=>{t.set_status(L=>u(n({},L),{rawValue:h,eventType:"update",eventID:v(12),isPickerOpen:!1,isInspected:!1}))},children:w(H.Left,{gap:"1/2",children:[D&&o(Y.Check,{fontColor:"theme"}),o(q.Mini,{transition:"short",flexSizing:0,children:i.label||i.value})]})}),i.id)}),!p.length&&o(q.Mini,{padding:[0,1],fontColor:"4.thin",children:"\u5019\u88DC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"},"no-selector-notice")]})}))})):null},Selected:t=>{let e=t.rootStates.options.find(a=>c.isEqual(a==null?void 0:a.value,t.val_status.rawValue));return!e||t.val_status.rawValue===null&&(t.rootStates.label||t.rootStates.placeholder)?null:o(V,u(n({},t.rootStates.selectedStyles),{children:(e==null?void 0:e.selectedLabel)||(e==null?void 0:e.label)||(e==null?void 0:e.value)}),String(e==null?void 0:e.value))},Core:t=>{var i,b;let{value:e}=t,[a,d]=Q(P.DefaultStatus(t.componentId,e)),[p,s]=Q(((i=t.options.find(m=>(m==null?void 0:m.value)===t.value))==null?void 0:i.id)||((b=t.options[0])==null?void 0:b.id)||""),I={rootStates:t,val_optionFocused:p,set_optionFocused:s,val_status:a,set_status:d};return P.CommonEffects({type:"select",states:t,val_status:a,set_status:d,SystemValidation:xe}),w(ke,{val_status:a,set_status:d,states:t,children:[o(Oe,{componentId:t.componentId,fontSize:t.fontSize,required:t.required,label:t.label,isActive:t.isLabelActive||a.rawValue!==null,val_status:a}),o(k.Button,n({},I))]})}},ee=t=>{var a,d;let e=n({},t);return e=u(n({emptySelect:!0,nativePicker:!1,pickerPosition:3},e),{xcss:n({cursor:"pointer"},e.xcss)}),e.emptySelect&&(e.options=[{value:null,label:o(q.Mini,{fontColor:"4.thin",children:"\u672A\u9078\u629E"})},...e.options]),e.value=(a=e.value)!=null?a:null,(d=e.options)==null||d.forEach((p,s)=>{if(!p)return;let{type:I,value:i}=p;e.options[s]=u(n({id:v(12)},p),{value:i,type:I||"selector"})}),c.isNullish(e.rightIcon)&&(e.rightIcon=o(we,{children:o(Y.AngleDown,{})})),o(ge,{componentId:e.componentId,children:k.Core,states:he(e)})};export{ee as Select,ee as default};
1
+ import{b as n,c as u,d as U}from"../../chunk-C5N2D3ZX.js";import{Fragment as te,jsx as o,jsxs as w}from"react/jsx-runtime";import c,{UUID as v}from"jmini";import{useState as Q,useEffect as K}from"react";import{Box as V,FAI as Y,Column as ve}from"../../atoms";import{Literal as q,Row as H}from"../../mols";import{Button as Ie}from"../Trigger";import{Sheet as be}from"../Sheet";import{OptionalInputWrapper as ge,BoxWrapper as ke,CoreEffects as P,DefaultBoxishStyles as he}from"./core";import{InputAutocompleteClasses as R}from"../../@styles/componentClasses";import{InputLabel as Oe}from"./Label";import{RightIcon as we}from".";function xe(t){let{value:e,states:a}=t,{required:d,options:p}=a,s=[];return d&&e===null&&s.push({type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}),{ok:!s.filter(({type:I})=>I=="invalid").length,notice:s}}const k={FilterSelectableOptions:(t,e)=>{let a=t.rootStates.options;return e||(a=a.filter(d=>(d==null?void 0:d.type)!="label")),a},Button:t=>w(te,{children:[o(k.Native,n({},t)),o(k.Original,n({},t))]}),Placeholder:t=>!t.rootStates.placeholder||t.val_status.rawValue!==null?null:o(V,{position:"absolute",opacity:"middle",fontColor:"3.blur",children:t.rootStates.placeholder||""}),Native:t=>{let{rootStates:e,val_status:a,set_status:d}=t,T=e,{tone:p,required:s,form:I,className:i,label:b,isLabelActive:m,placeholder:h,enableFormSubmit:g,emptySelect:D,showInitValidation:B,onValidate:L,onValidateDelay:$,onUpdateValue:le,onUpdateValidValue:ae,onUserAction:ne,onKeyDown:W,onChange:_,value:ie="",options:z,leftIndicator:re,rightIndicator:se,leftIcon:oe,rightIcon:ue,componentId:ce,status_id:de,wrapStyles:pe,selectedStyles:fe,selectorStyles:Se,pickerStyles:me,pickerPosition:ye,nativePicker:E}=T,r=U(T,["tone","required","form","className","label","isLabelActive","placeholder","enableFormSubmit","emptySelect","showInitValidation","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","onKeyDown","onChange","value","options","leftIndicator","rightIndicator","leftIcon","rightIcon","componentId","status_id","wrapStyles","selectedStyles","selectorStyles","pickerStyles","pickerPosition","nativePicker"]);return E?w(V,u(n({htmlTag:"select",tabIndex:0},r),{"data-disabled":e.disabled,"data-show-validation":P.isShowValidation(a,!!B),"data-component-id":a.componentId,"data-input-origin":a.componentId,className:[i,R("Core")].join(" "),onKeyDown:l=>{W&&W(l),g&&P.SubmitForm(l,I)},onChange:l=>{let{value:S}=l.target;d(C=>u(n({},C),{rawValue:S,eventType:"update",eventID:v(12),isInspected:!1,isValidated:!1,notice:[]})),_&&_(l)},children:[!!D&&o("option",{value:"null",children:"\u9078\u629E"}),z.map(l=>c.isNullish(l==null?void 0:l.value)?null:o("option",{value:l==null?void 0:l.value,children:(l==null?void 0:l.label)||(l==null?void 0:l.value)},String(l==null?void 0:l.value)))]})):null},Original:t=>{let{rootStates:e,val_optionFocused:a,set_optionFocused:d,val_status:p,set_status:s}=t,T=e,{tone:I,required:i,form:b,className:m,label:h,isLabelActive:g,placeholder:D,enableFormSubmit:B,emptySelect:L,showInitValidation:$,onValidate:le,onValidateDelay:ae,onUpdateValue:ne,onUpdateValidValue:W,onUserAction:_,value:ie="",options:z,leftIndicator:re,rightIndicator:se,leftIcon:oe,rightIcon:ue,componentId:ce,status_id:de,wrapStyles:pe,selectedStyles:fe,selectorStyles:Se,pickerStyles:me,pickerPosition:ye,nativePicker:E}=T,r=U(T,["tone","required","form","className","label","isLabelActive","placeholder","enableFormSubmit","emptySelect","showInitValidation","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","options","leftIndicator","rightIndicator","leftIcon","rightIcon","componentId","status_id","wrapStyles","selectedStyles","selectorStyles","pickerStyles","pickerPosition","nativePicker"]);return K(()=>{if(E||e.disabled)return;let l="select-click-"+e.componentId;if(p.isPickerOpen){if(!c('[data-input-origin="'+e.componentId+'"]'))return;c(document).onEvent("click",C=>{let F=c(C.target),A=!!c(F).parent("."+R("Core")).length;c(F).parent("."+R("Selector")).length||A||s(f=>u(n({},f),{eventID:v(12),isPickerOpen:!1}))},{eventID:l})}else c(document).removeEvent([l])},[p.isPickerOpen]),E?null:w(te,{children:[o(V,u(n({tabIndex:0},r),{"data-disabled":e.disabled,"data-show-validation":P.isShowValidation(p,!!$),"data-component-id":p.componentId,"data-input-origin":p.componentId,className:[m,R("Core")].join(" "),onFocus:l=>{r!=null&&r.onFocus&&(r==null||r.onFocus(l)),!e.disabled&&s(S=>u(n({},S),{eventID:v(12),isFocusing:!0,isPickerOpen:!0}))},onBlur:l=>{r!=null&&r.onBlur&&(r==null||r.onBlur(l)),s(S=>u(n({},S),{eventID:v(12),isFocusing:!1}))},onClick:l=>{r!=null&&r.onClick&&(r==null||r.onClick(l)),!e.disabled&&s(S=>u(n({},S),{eventID:v(12),isPickerOpen:!0}))},onKeyDown:l=>{let{key:S,metaKey:C,ctrlKey:F}=l,A=C||F;if(r!=null&&r.onKeyDown&&(r==null||r.onKeyDown(l)),B&&P.SubmitForm(l,b),!e.disabled){if(c.scope(()=>{if(!c.isOneOf(S,"ArrowDown","ArrowUp"))return;if(l.preventDefault(),!p.isPickerOpen){s(O=>u(n({},O),{eventID:v(12),isPickerOpen:!0}));return}let y=S=="ArrowDown"?1:-1,f=k.FilterSelectableOptions(t),N=f.length-1,x=null;c.scope(()=>{var j,J,X,Z,G;let O=f.findIndex(M=>(M==null?void 0:M.id)==a);if(y==1){if(x=(j=f[0])==null?void 0:j.id,A){x=f[N].id;return}if(O==-1||O==N)return;x=(J=f[O+1])==null?void 0:J.id}else{if(x=(X=f[N])==null?void 0:X.id,A){x=(Z=f[0])==null?void 0:Z.id;return}if(O==-1||O==0)return;x=(G=f[O-1])==null?void 0:G.id}}),d(x)}),S=="Escape")s(y=>u(n({},y),{eventID:v(12),isPickerOpen:!1}));else if(S=="Tab")s(y=>u(n({},y),{eventID:v(12),isPickerOpen:!1}));else if(S=="Backspace")s(y=>u(n({},y),{rawValue:null,eventType:"update",eventID:v(12),isInspected:!1}));else if(S==" ")l.preventDefault(),s(y=>u(n({},y),{eventID:v(12),isPickerOpen:!0}));else if(S=="Enter"){if(!p.isPickerOpen){s(f=>u(n({},f),{eventID:v(12),isPickerOpen:!0}));return}l.preventDefault();let y=e.options.find(f=>(f==null?void 0:f.id)==a);if(!y)return;s(f=>u(n({},f),{rawValue:y==null?void 0:y.value,eventType:"update",eventID:v(12),isPickerOpen:!1,isInspected:!1}))}}},children:w(H.Left,{gap:0,children:[o(V,{xcss:{width:0},overflow:"hidden",opacity:"trans","data-input-value-shallow":p.componentId,children:"A"}),w(H.Left,{flexWrap:!0,gap:"1/3",xcss:{letterSpacing:".5px"},children:[o(k.Placeholder,n({},t)),o(k.Selected,n({},t))]})]})})),o(k.Picker,n({},t))]})},Picker:t=>{var I;let{rootStates:e,val_status:a,val_optionFocused:d}=t;K(()=>{if(!a.isPickerOpen||!a.rawValue)return;let i=c(`[data-picker-id="${a.componentId}"]`)[0];if(!i)return;let b=i.position(),m=e.options.find(g=>(g==null?void 0:g.value)===a.rawValue);if(!m)return;let h=c(`[data-select-input-value="${m.id}"]`)[0];h&&(i.scrollTop=h.offsetTop-b.height/2+h.offsetHeight/2)},[a.isPickerOpen]),K(()=>{let i=c(`[data-picker-id="${a.componentId}"]`)[0];if(!i)return;let b=i.position(),m=c(`[data-select-input-value="${d}"]`)[0];m&&(i.scrollTop=m.offsetTop-b.height/2+m.offsetHeight/2)},[d]);let p=k.FilterSelectableOptions(t,!0),s={};{let i=e.pickerPosition||0;c.isOneOf(i,1,2)?s.bottom="100%":c.isOneOf(i,3,4)&&(s.top="100%"),c.isOneOf(i,1,3)?s.left=0:c.isOneOf(i,2,4)&&(s.right=0)}return a.isPickerOpen?o(V,u(n({position:"absolute",ssZIndex:1e3,minWidth:1,padding:"1/3"},s),{children:o(be.Body,u(n({className:R("Selector"),ssCardBox:!0,borderRadius:"2.tone.secondary",boxShadow:"1.normal",overflow:"auto","data-picker-id":a.componentId},e.pickerStyles),{xcss:n({minWidth:12*6,maxHeight:12*24},(I=e.pickerStyles)==null?void 0:I.xcss),children:w(ve,{gap:"1/12",padding:[1,0],children:[p.map((i,b)=>{if(!i)return null;let{type:m,value:h}=i,g=t.val_optionFocused==i.id,D=t.val_status.rawValue===h;return m=="label"?o(V,{children:i.label||i.value},v()):o(Ie.Sub.S,u(n({"data-select-input-value":i.id,color:"cloud",backgroundColor:"trans",borderRadius:0,fontColor:"2.normal",textAlign:"left",padding:["1/2",1],isActive:D||g,isActiveStyles:g?{backgroundColor:"cloud"}:{backgroundColor:"theme.opa.few",fontColor:"theme"}},e.selectorStyles),{onClick:B=>{t.set_status(L=>u(n({},L),{rawValue:h,eventType:"update",eventID:v(12),isPickerOpen:!1,isInspected:!1}))},children:w(H.Left,{gap:"1/2",children:[D&&o(Y.Check,{fontColor:"theme"}),o(q.Mini,{transition:"short",flexSizing:0,children:i.label||i.value})]})}),i.id)}),!p.length&&o(q.Mini,{padding:[0,1],fontColor:"4.thin",children:"\u5019\u88DC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"},"no-selector-notice")]})}))})):null},Selected:t=>{let e=t.rootStates.options.find(a=>c.isEqual(a==null?void 0:a.value,t.val_status.rawValue));return!e||t.val_status.rawValue===null&&(t.rootStates.label||t.rootStates.placeholder)?null:o(V,u(n({},t.rootStates.selectedStyles),{children:(e==null?void 0:e.selectedLabel)||(e==null?void 0:e.label)||(e==null?void 0:e.value)}),String(e==null?void 0:e.value))},Core:t=>{var i,b;let{value:e}=t,[a,d]=Q(P.DefaultStatus(t.componentId,e)),[p,s]=Q(((i=t.options.find(m=>(m==null?void 0:m.value)===t.value))==null?void 0:i.id)||((b=t.options[0])==null?void 0:b.id)||""),I={rootStates:t,val_optionFocused:p,set_optionFocused:s,val_status:a,set_status:d};return P.CommonEffects({type:"select",states:t,val_status:a,set_status:d,SystemValidation:xe}),w(ke,{val_status:a,set_status:d,states:t,children:[o(Oe,{componentId:t.componentId,fontSize:t.fontSize,required:t.required,label:t.label,isActive:t.isLabelActive||a.rawValue!==null,val_status:a}),o(k.Button,n({},I))]})}},ee=t=>{var a,d;let e=n({},t);return e=u(n({emptySelect:!0,nativePicker:!1,pickerPosition:3},e),{xcss:n({cursor:"pointer"},e.xcss)}),e.emptySelect&&(e.options=[{value:null,label:o(q.Mini,{fontColor:"4.thin",children:"\u672A\u9078\u629E"})},...e.options]),e.value=(a=e.value)!=null?a:null,(d=e.options)==null||d.forEach((p,s)=>{if(!p)return;let{type:I,value:i}=p;e.options[s]=u(n({id:v(12)},p),{value:i,type:I||"selector"})}),c.isNullish(e.rightIcon)&&(e.rightIcon=o(we,{children:o(Y.AngleDown,{})})),o(ge,{componentId:e.componentId,children:k.Core,states:he(e)})};export{ee as Select,ee as default};
@@ -1 +1 @@
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 M}from"../../@styles/componentClasses";function Q(e){let{value:n,states:t}=e,{required:l}=t,a=[],[o,r]=x.Arrayify(n);return l&&!o&&!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:l,value:a}=e,o=(a-(n!=null?n:t))/(l-(n!=null?n:t));return Math.min(o,1)*100},normalize:e=>{let{min:n,max:t,step:l,value:a}=e;a=Math.max(a,n),a=Math.min(a,t);let o=Math.round(a/l)*l;return{value:o,offsetLeft:f.getOffsetLeft(h(d({},e),{value:o}))}},Effects:{Start:(e,n)=>{let t=x.getCursor(e).x,{val_status:l}=n,{componentId:a}=l,o=_("#"+a+"_Bar"),{width:r,left:i}=o.position(),c=(t-i)/r;c=Math.max(c,0),c=Math.min(c,1);let u=c*l.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 l=x.getCursor(e).x,{val_status:a}=n,{componentId:o}=a,r=_("#"+o+"_Bar"),{width:i,left:c}=r.position(),u=(l-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:l}=e,{componentId:a}=t,o=2;n.size=="small"?o=1.5:n.size=="large"&&(o=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),l(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:M("Bar"),height:0,position:"relative",transition:"middle",flexSizing:"none",id:a+"_Bar",children:[m(b,{position:"absolute",isRounded:!0,backgroundColor:"cloud",xcss:{top:-2*o,left:-2*o,right:-2*o,bottom:-2*o}}),m(f.Range,{rootStates:n,val_status:t,set_status:l,formatData:r,onUpdateValue:i}),m(f.DiscreteScale,{rootStates:n,val_status:t}),m(f.Edge,{focusIndex:0,rootStates:n,val_status:t,set_status:l,formatData:r[0],onUpdateValue:i}),t.ranged&&m(f.Edge,{focusIndex:1,rootStates:n,val_status:t,set_status:l,formatData:r[1],onUpdateValue:i})]})})},DiscreteScale:e=>{let{rootStates:n,val_status:t}=e;if(!n.discreteScale)return null;let{trackMin:l,min:a,max:o,step:r}=t,i=Math.round(a/r),u=Math.round(o/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,o);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:l}=e,a=2;return n.size=="small"?a=1.5:n.size=="large"&&(a=2.5),C(b,{className:M("Range"),position:"absolute",transition:"middle",xcss:d({cursor:"pointer",top:"50%",transform:"translateY(-50%)"},l.ranged?{left:t[0].offsetLeft+"%",width:t[1].offsetLeft-t[0].offsetLeft+"%"}:{left:0,width:(t[0].offsetLeft||0)+"%"}),onPointerDown:o=>{if(!e.rootStates.disabled){if(o.stopPropagation(),l.ranged){let[r,i]=l.safeValue;o.stopPropagation(),f.Effects.Start(o,{val_status:l,onChange:(c,u)=>{e.set_status(p=>{let v=p.safeValue,g=d({},p);return g.safeValue=[f.normalize(h(d({},l),{value:r+u})).value,f.normalize(h(d({},l),{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(o,{val_status:l,onChange:r=>{e.onUpdateValue(r,0)}})}},children:[m(b,{className:M("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:M("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:l,set_status:a}=e,o=2;return t.size=="small"?o=1.5:t.size=="large"&&(o=2.5),C(Y.Plain,{className:M("Edge"),position:"absolute",transition:"middle",height:0,width:0,flexCenter:!0,xcss:{left:n.offsetLeft+"%"},onPointerDown:r=>{e.rootStates.disabled||e.focusIndex==1&&!l.ranged||(r.stopPropagation(),f.Effects.Start(r,{val_status:l,onChange:i=>{e.onUpdateValue(i,e.focusIndex)}}))},onKeyDown:r=>{t.enableFormSubmit&&X.SubmitForm(r,t.form);let{min:i,max:c,step:u}=l,{key:p,metaKey:v,ctrlKey:g}=r,S=g||v,s=l.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({},l),{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:M("EdgeChild"),transition:"middle",position:"absolute",backgroundColor:t.color,isRounded:!0,opacity:"trans",xcss:{pointerEvents:"all",top:-12*o,bottom:-12*o,left:-12*o,right:-12*o}}),m(b,{transition:"long",boxShadow:"1.remark",fontSize:"0.xs",backgroundColor:!l.ranged||e.focusIndex==1?t.color:"layer.0",ssSphere:o,xcss:{pointerEvents:"all"}})]})},Legends:e=>{var g;let{val_status:n,rootStates:t}=e,{trackMin:l,min:a,max:o,step:r}=n,[i]=W(E()),c=(g=t.legends)!=null?g:!0,u=Math.round(a/r),p=Math.round(o/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.Mini,{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,o);let I=f.getOffsetLeft(h(d({},n),{value:s}))+"%";return C(z,{gap:0,id:i+"-"+s,className:M("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.Micro,{fontHeight:1.2,children:t.onLegendRender?t.onLegendRender(s):s.rank()})]},s)})]}):null},index:e=>{let N=e,{color:n="theme",required:t,form:l="",discreteScale:a,size:o,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,M("Wrap")].join(" "),children:[m(f.Rail,{rootStates:e,val_status:L,set_status:w}),m(f.Legends,{rootStates:e,val_status:L})]}))})}},V=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=V;R.Small=e=>m(V,d({size:"small"},e)),R.Medium=e=>m(V,d({size:"medium"},e)),R.Large=e=>m(V,d({size:"large"},e));const Z=e=>m(V,d({ranged:!0},e));R.Range=Z,R.Range.Small=e=>m(V,d({ranged:!0,size:"small"},e)),R.Range.Medium=e=>m(V,d({ranged:!0,size:"medium"},e)),R.Range.Large=e=>m(V,d({ranged:!0,size:"large"},e));export{R as Slider,R 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"../Trigger";import{OptionalInputWrapper as G,BoxWrapper as j,CoreEffects as X}from"./core";import{InputSliderClasses as M}from"../../@styles/componentClasses";function Q(e){let{value:n,states:t}=e,{required:l}=t,a=[],[o,r]=x.Arrayify(n);return l&&!o&&!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:l,value:a}=e,o=(a-(n!=null?n:t))/(l-(n!=null?n:t));return Math.min(o,1)*100},normalize:e=>{let{min:n,max:t,step:l,value:a}=e;a=Math.max(a,n),a=Math.min(a,t);let o=Math.round(a/l)*l;return{value:o,offsetLeft:f.getOffsetLeft(h(d({},e),{value:o}))}},Effects:{Start:(e,n)=>{let t=x.getCursor(e).x,{val_status:l}=n,{componentId:a}=l,o=_("#"+a+"_Bar"),{width:r,left:i}=o.position(),c=(t-i)/r;c=Math.max(c,0),c=Math.min(c,1);let u=c*l.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 l=x.getCursor(e).x,{val_status:a}=n,{componentId:o}=a,r=_("#"+o+"_Bar"),{width:i,left:c}=r.position(),u=(l-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:l}=e,{componentId:a}=t,o=2;n.size=="small"?o=1.5:n.size=="large"&&(o=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),l(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:M("Bar"),height:0,position:"relative",transition:"middle",flexSizing:"none",id:a+"_Bar",children:[m(b,{position:"absolute",isRounded:!0,backgroundColor:"cloud",xcss:{top:-2*o,left:-2*o,right:-2*o,bottom:-2*o}}),m(f.Range,{rootStates:n,val_status:t,set_status:l,formatData:r,onUpdateValue:i}),m(f.DiscreteScale,{rootStates:n,val_status:t}),m(f.Edge,{focusIndex:0,rootStates:n,val_status:t,set_status:l,formatData:r[0],onUpdateValue:i}),t.ranged&&m(f.Edge,{focusIndex:1,rootStates:n,val_status:t,set_status:l,formatData:r[1],onUpdateValue:i})]})})},DiscreteScale:e=>{let{rootStates:n,val_status:t}=e;if(!n.discreteScale)return null;let{trackMin:l,min:a,max:o,step:r}=t,i=Math.round(a/r),u=Math.round(o/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,o);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:l}=e,a=2;return n.size=="small"?a=1.5:n.size=="large"&&(a=2.5),C(b,{className:M("Range"),position:"absolute",transition:"middle",xcss:d({cursor:"pointer",top:"50%",transform:"translateY(-50%)"},l.ranged?{left:t[0].offsetLeft+"%",width:t[1].offsetLeft-t[0].offsetLeft+"%"}:{left:0,width:(t[0].offsetLeft||0)+"%"}),onPointerDown:o=>{if(!e.rootStates.disabled){if(o.stopPropagation(),l.ranged){let[r,i]=l.safeValue;o.stopPropagation(),f.Effects.Start(o,{val_status:l,onChange:(c,u)=>{e.set_status(p=>{let v=p.safeValue,g=d({},p);return g.safeValue=[f.normalize(h(d({},l),{value:r+u})).value,f.normalize(h(d({},l),{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(o,{val_status:l,onChange:r=>{e.onUpdateValue(r,0)}})}},children:[m(b,{className:M("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:M("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:l,set_status:a}=e,o=2;return t.size=="small"?o=1.5:t.size=="large"&&(o=2.5),C(Y.Plain,{className:M("Edge"),position:"absolute",transition:"middle",height:0,width:0,flexCenter:!0,xcss:{left:n.offsetLeft+"%"},onPointerDown:r=>{e.rootStates.disabled||e.focusIndex==1&&!l.ranged||(r.stopPropagation(),f.Effects.Start(r,{val_status:l,onChange:i=>{e.onUpdateValue(i,e.focusIndex)}}))},onKeyDown:r=>{t.enableFormSubmit&&X.SubmitForm(r,t.form);let{min:i,max:c,step:u}=l,{key:p,metaKey:v,ctrlKey:g}=r,S=g||v,s=l.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({},l),{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:M("EdgeChild"),transition:"middle",position:"absolute",backgroundColor:t.color,isRounded:!0,opacity:"trans",xcss:{pointerEvents:"all",top:-12*o,bottom:-12*o,left:-12*o,right:-12*o}}),m(b,{transition:"long",boxShadow:"1.remark",fontSize:"0.xs",backgroundColor:!l.ranged||e.focusIndex==1?t.color:"layer.0",ssSphere:o,xcss:{pointerEvents:"all"}})]})},Legends:e=>{var g;let{val_status:n,rootStates:t}=e,{trackMin:l,min:a,max:o,step:r}=n,[i]=W(E()),c=(g=t.legends)!=null?g:!0,u=Math.round(a/r),p=Math.round(o/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.Mini,{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,o);let I=f.getOffsetLeft(h(d({},n),{value:s}))+"%";return C(z,{gap:0,id:i+"-"+s,className:M("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.Micro,{fontHeight:1.2,children:t.onLegendRender?t.onLegendRender(s):s.rank()})]},s)})]}):null},index:e=>{let N=e,{color:n="theme",required:t,form:l="",discreteScale:a,size:o,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,M("Wrap")].join(" "),children:[m(f.Rail,{rootStates:e,val_status:L,set_status:w}),m(f.Legends,{rootStates:e,val_status:L})]}))})}},V=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=V;R.Small=e=>m(V,d({size:"small"},e)),R.Medium=e=>m(V,d({size:"medium"},e)),R.Large=e=>m(V,d({size:"large"},e));const Z=e=>m(V,d({ranged:!0},e));R.Range=Z,R.Range.Small=e=>m(V,d({ranged:!0,size:"small"},e)),R.Range.Medium=e=>m(V,d({ranged:!0,size:"medium"},e)),R.Range.Large=e=>m(V,d({ranged:!0,size:"large"},e));export{R as Slider,R as default};
@@ -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 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.toRate(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};
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"../Trigger";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.toRate(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};
@@ -1 +1 @@
1
- import{b as p,c as g}from"../../../chunk-C5N2D3ZX.js";import{Fragment as $,jsx as e,jsxs as f}from"react/jsx-runtime";import S,{UUID as O,Time as d,useStore as W}from"jmini";import{useState as D,useEffect as R}from"react";import{Box as T,Grid as J,FAI as B,Column as L,FlexMargin as P}from"../../../atoms";import{Row as C,Literal as h}from"../../../mols";import{Button as x}from"../../Button";import _ from"../../Sheet";import Y from"../Select";import{LeftIcon as X,RightIcon as N}from"..";import{InputTimeClasses as V}from"../../../@styles/componentClasses";import F from"../Drum";const j=t=>{let{restrict:l}=t;return l=="year"?e(y.Year,p({},t)):l=="month"?e(y.Month,p({},t)):l=="week"?"[DEV]":l=="date"?e(y.Date,p({},t)):l=="locale.jp.warekiDate"?e(y.Locale.JP.WarekiDate,p({},t)):l=="clock"?e(y.Clock,p({},t)):l=="period.clock"?e(y.Period.Clock,p({},t)):l=="period.month"?e(y.Period.Month,p({},t)):l=="period.date"?e(y.Period.Date,p({},t)):null},y={YearOptions:t=>{var u,i,n;let l=[],v=(u=t==null?void 0:t.min)!=null?u:1900,o=(i=t==null?void 0:t.max)!=null?i:d().addYear(10).year;for(let a=v;a<=o;a++){let r=[a],[m,s]=S.transformer.wareki(a).value;((n=t.showJPWareki)==null||n)&&(m&&r.push(e(h.Micro,{fontColor:"4.thin",children:m},1)),s&&r.push(f(h.Micro,{fontColor:"4.thin",children:["[",s,"]"]},2))),l[t.reverse?"unshift":"push"]({value:a,label:e(C.Center,{gap:["1/12","1/4"],verticalAlign:"baseline",flexWrap:!0,children:r})})}return l},calendartypeState:()=>{let[t,l]=D(localStorage.getItem("@env/input/time/selector/calendartype")||"calendar");return R(()=>{localStorage.setItem("@env/input/time/selector/calendartype",String(t))},[t]),[t,l]},minutesUnitState:()=>{let[t,l]=D(Number(localStorage.getItem("@env/input/time/selector/clock/minutesUnit")||10));return R(()=>{localStorage.setItem("@env/input/time/selector/clock/minutesUnit",String(t))},[t]),[t,l]},remoteControl:function(t){let{restrict:l,pickerId:v,val_value:o,set_value:u}=t;R(()=>{v&&W.set({[v]:{onClear:()=>{if(l.match(/period\./)){u(i=>g(p({},i),{eventType:"commit",forcus:0,display:d(),from:d(null),to:d(null)}));return}u(i=>g(p({},i),{eventType:"commit",from:d(null)}))},onConfirm:()=>{u(i=>g(p({},i),{eventType:"commit"}))}}})},[])},Year:t=>{let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{let[i]=String(t.defaultValue).split(/\D/);return{eventType:"init",from:d().setYear(Number(i||d().year))}}));return y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{t.onValueUpdate({value:String(o.from.year||null),era:"year",eventType:o.eventType})},[o]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{flexWrap:!0,children:[f(h.Paragraph,{children:[o.from.year||"----","\u5E74"]}),e(x.Border.XS,{fontColor:"theme",borderRadius:"2.tone.secondary",onClick:()=>{let i=d();u({eventType:"update",from:i})},children:"\u4ECA\u5E74"}),e(P,{})]}),e(T,{borderTop:!0}),e(F,{override:"force",value:o.from.year||null,options:y.YearOptions({min:Number(l)||void 0,max:Number(v)||void 0}),onUpdateValidValue:i=>{u(n=>({eventType:"update",from:n.from.clone().setYear(Number(i))}))}})]})},Month:t=>{let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{let[i,n]=String(t.defaultValue).split(/\D/);(S.isNullish(i)||S.isNullish(n))&&([i,n]=d().toFormat("%Y-%M").split("-"));let a=d(),r=d().setYear(Number(i)||a.year).setMonth(Number(n)||a.month).setDate(1);return{eventType:"init",from:r,display:r}}));return y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{t.onValueUpdate({value:o.from.toFormatYM(),era:"year",eventType:o.eventType})},[o]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{gap:"1/2",children:[e(h.Paragraph,{children:o.from.toFormatYM("JP")||"----/--"}),e(x.Border.XS,{fontColor:"theme",borderRadius:"2.tone.secondary",onClick:()=>{let i=d();u({eventType:"update",from:i,display:i})},children:"\u4ECA\u6708"}),e(P,{})]}),e(T,{borderTop:!0}),e(y.Parts.DrumSelector,{type:"month",min:l,max:v,value:o.from,onChange:i=>{u(g(p({},o),{eventType:"update",from:i}))}})]})},Date:t=>{let{min:l,max:v}=t,[o,u]=y.calendartypeState(),[i,n]=D(S.scope(()=>{var b;let[a,r,m]=(b=String(t.defaultValue))==null?void 0:b.split(/\D/);(S.isNullish(a)||S.isNullish(r)||S.isNullish(m))&&([a,r,m]=d().toFormat("%Y-%M-%D").split("-"));let s=d(),c=d([Number(a)||s.year,(Number(r)||s.month).zeroEmbed(2),(Number(m)||s.date).zeroEmbed(2)].join("/"));return{eventType:"init",era:"year",display:c,from:c}}));return y.remoteControl(g(p({},t),{val_value:i,set_value:n})),R(()=>{t.onValueUpdate({value:i.from.toFormatYMD(),era:"year",eventType:i.eventType})},[i]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{flexWrap:!0,gap:"1/2",children:[e(h.Paragraph,{children:i.from.toFormatYMD("JP")||"----/--/--"}),e(x.Border.XS,{fontColor:"theme",borderRadius:"2.tone.secondary",onClick:()=>{let a=d();n({eventType:"update",era:"year",from:a,display:a})},children:"\u4ECA\u65E5"}),e(P,{}),f(x.Border.S,{padding:["1/6","1/2"],fontColor:"3.blur",fontSize:"0.xs",onClick:()=>{u(a=>a=="calendar"?"drum":"calendar")},children:[o=="calendar"&&"\u30C9\u30E9\u30E0",o=="drum"&&"\u30AB\u30EC\u30F3\u30C0\u30FC","\u8868\u793A"]})]}),e(T,{borderTop:!0}),o=="calendar"&&f($,{children:[f(C.Center,{gap:"1/2",children:[e(Y,{override:"force",emptySelect:!1,value:i.display.year,options:y.YearOptions({reverse:!0}),fontSize:"1.mini",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,pickerStyles:{xcss:{minWidth:12*12}},onUpdateValidValue:a=>{n(r=>g(p({},r),{eventType:"update",display:r.display.clone().setYear(Number(a))}))},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})})}),e(Y,{override:"force",emptySelect:!1,value:i.display.month,options:(()=>{let a=[];for(let r=1;r<=12;r++)a.push({value:r,label:String(r)+"\u6708"});return a})(),fontSize:"1.mini",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,pickerStyles:{xcss:{minWidth:12*8}},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})}),onUpdateValidValue:a=>{n(r=>g(p({},r),{eventType:"update",display:r.display.clone().setMonth(Number(a))}))}}),e(y.Parts.ShiftButtons,{callback:a=>{n(r=>g(p({},r),{eventType:"update",display:r.display.clone().addMonth(a)}))}})]}),f(L,{children:[e(T,{margin:"auto",xcss:{minWidth:"50%"},UnderBreakPointStyles:{margin:0},children:y.Parts.Calendar({min:l,max:v,onTitleRender:a=>"",targetMonth:i.display,from:i.from,onChange:a=>{n(r=>g(p({},r),{eventType:"update",from:a}))}})}),e(T,{unitHeight:"1/4",isRounded:!0,backgroundColor:"cloud",margin:1,ssHiddenOnBreak:!0}),f(C.Center,{verticalAlign:"unset",ssHiddenOnBreak:!0,children:[e(T,{flexSizing:0,children:y.Parts.Calendar({min:l,max:v,onTitleRender:a=>e(h.Mini,{children:f(C.Center,{gap:"1/2",children:[e(h,{isSemiBoldFont:!0,children:a.toFormatYM("JP")}),e(h,{fontColor:"4.thin",children:"[\u524D\u6708]"})]})}),targetMonth:i.display.clone().addMonth(-1),from:i.from,onChange:a=>{n(r=>g(p({},r),{eventType:"update",from:a}))}})}),e(T,{unitWidth:"1/4",isRounded:!0,backgroundColor:"cloud",margin:1}),e(T,{flexSizing:0,children:y.Parts.Calendar({min:l,max:v,onTitleRender:a=>e(h.Mini,{children:f(C.Center,{gap:"1/2",children:[e(h,{isSemiBoldFont:!0,children:a.toFormatYM("JP")}),e(h,{fontColor:"4.thin",children:"[\u7FCC\u6708]"})]})}),targetMonth:i.display.clone().addMonth(1),from:i.from,onChange:a=>{n(r=>g(p({},r),{eventType:"update",from:a}))}})})]})]})]}),o=="drum"&&e(y.Parts.DrumSelector,{type:"date",min:l,max:v,value:i.from,onChange:a=>{n(g(p({},i),{eventType:"update",from:a}))}})]})},Locale:{JP:{WarekiDate:t=>{var n;let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{var M;let[a,r,m]=(M=String(t.defaultValue))==null?void 0:M.split(/\D/),s=t.era||"year";if(S.isNullish(a)||S.isNullish(r)||S.isNullish(m)){let k=d();s=="heisei"?k.setYear(1989):s=="shouwa"?k.setYear(1926):s=="taisho"?k.setYear(1912):s=="meiji"&&k.setYear(1868),[a,r,m]=k.toFormat("%Y-%M-%D").split("-")}let c=d();return{eventType:"init",from:d([Number(a)||c.year,(Number(r)||c.month).zeroEmbed(2),(Number(m)||c.date).zeroEmbed(2)].join("/"))}}));y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{t.onValueUpdate({value:o.from.toFormatYMD(),era:o.from.wareki.toLower(),eventType:o.eventType})},[o]);let i={year:{label:"\u897F\u66A6",min:"1900/01/01",max:"2100/12/31"},reiwa:{label:"\u4EE4\u548C",min:"2019/05/01",max:d().addYear(10).setMonth(12).setDate(31).toFormatYMD()},heisei:{label:"\u5E73\u6210",min:"1989/01/08",max:"2019/04/30"},showa:{label:"\u662D\u548C",min:"1926/12/25",max:"1989/01/07"},taisho:{label:"\u5927\u6B63",min:"1912/07/30",max:"1926/12/24"},meiji:{label:"\u660E\u6CBB",min:"1868/09/08",max:"1912/07/29"}};return f(L,{children:[f(C.Left,{gap:"1/4",flexWrap:!0,children:[f(h.Paragraph,{children:[o.from.warekiLabel,(n=o.from.warekiYear)==null?void 0:n.zeroEmbed(2),"\u5E74",o.from.toFormatMD("JP")]}),e(P,{})]}),e(T,{borderTop:!0}),e(C.Left,{gap:"1/2",flexWrap:!0,children:["reiwa","heisei","showa","taisho","meiji"].map((a,r)=>{let m=i[a];return m?e(x.Border.S,{onClick:()=>{let s=o.from;if(a=="reiwa"||a=="year")s=d();else{let c=d(m.min),b=d(m.max);c.value>o.from.value&&(s=c),o.from.value>b.value&&(s=b)}if(l){let c=d(l);s.value<c.value&&(s=c)}if(v){let c=d(v);c.value<s.value&&(s=c)}u(g(p({},o),{eventType:"update",from:s}))},children:m.label},r):null})}),e(y.Parts.DrumSelector,{type:"locale.jp.warekiDate",min:t.min,max:t.max,value:o.from,onChange:a=>{u(g(p({},o),{eventType:"update",from:a}))}})]})}}},Clock:t=>{let[l,v]=D(S.scope(()=>{let r=String(t.defaultValue).split(/[^\d]/);if(!r[0]){let c=d();r=[c.hours,c.minutes]}let m=Number(r[0]),s=Number(r[1]);return{eventType:"init",from:d().setHours(m).setMinutes(s)}}));y.remoteControl(g(p({},t),{val_value:l,set_value:v})),R(()=>{t.onValueUpdate({value:l.from.toFormatHM(),era:"clock",eventType:l.eventType})},[l]);let[o,u]=y.minutesUnitState(),i=d().setFromFormatHHMM(t.min||"00:00"),n=d().setFromFormatHHMM(t.max||"23:59");const a=(r,m)=>{v(s=>{let c=s.from.clone();return S.isExist(r)&&c.setHours(r),S.isExist(m)&&c.setMinutes(m),c.toFormatHM().toNumber()>n.toFormatHM().toNumber()&&(c=n.clone()),c.toFormatHM().toNumber()<i.toFormatHM().toNumber()&&(c=i.clone()),g(p({},s),{eventType:"update",from:c})})};return f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{gap:"1/2",flexWrap:!0,children:[f(C.Center,{gap:"1/2",children:[e(T,{className:V("ClockBase"),children:e(T,{className:V("ClockUiBase"),flexCenter:!0,children:f(T,{className:V("ClockUi"),backgroundColor:"theme.opa.low",isRounded:!0,position:"relative",children:[e(T,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[V("Needle"),V("hour")].join(" "),xcss:{transform:`rotate(${l.from.hours*30+l.from.minutes/2}deg)`}}),e(T,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[V("Needle"),V("minute")].join(" "),xcss:{transform:`rotate(${l.from.minutes*6}deg)`}})]})})}),f(T,{textAlign:"center",fontHeight:1.2,children:[f(h.Paragraph,{children:[l.from.hours.zeroEmbed(2)," : ",l.from.minutes.zeroEmbed(2)]}),f(h.Mini,{fontColor:"4.thin",children:[l.from.hours>=12&&"PM"||"AM",l.from.hours%12,":",l.from.minutes.zeroEmbed(2)]})]})]}),e(x.Border.XS,{borderRadius:"2.tone.secondary",fontColor:"theme",onClick:()=>{let r=d().setSeconds(0);r.minutes=Math.round(r.minutes/o)*o,a(r.hours,r.minutes)},children:"\u73FE\u6642\u523B"}),e(P,{}),e(Y,{emptySelect:!1,value:o,paddingLeft:3.5,leftIcon:e(X,{left:"2/3",children:"\u5358\u4F4D"}),pickerPosition:4,pickerStyles:{xcss:{minWidth:12*8}},padding:"1/2",options:[{value:10,label:"10\u5206"},{value:5,label:"5\u5206"},{value:1,label:"1\u5206"}],tabIndex:-1,onUpdateValidValue:r=>{u(r||1)}})]}),e(T,{borderTop:!0}),f(C.Center,{gap:"1/2",children:[e(F,{xcss:{maxHeight:12*12},override:"force",options:[{value:0,label:"\u5348\u524D"},{value:12,label:"\u5348\u5F8C"}],value:l.from.hours>=12?12:0,onUpdateValidValue:r=>{let m=l.from.hours%12+r;a(m)}}),e(F,{override:"force",value:l.from.hours,options:Array.from({length:24}).map((r,m)=>{let s=m;return i.hours>s||n.hours<s?null:{value:s,label:s.zeroEmbed(2)}}),onUpdateValidValue:r=>{a(r)}}),e(h,{isSemiBoldFont:!0,children:"\u6642"}),e(F,{override:"force",value:l.from.minutes,options:Array.from({length:60}).map((r,m)=>{let s=m;return s!=59&&(o==5&&s%5!=0||o==10&&s%10!=0)?null:{value:s,label:s.zeroEmbed(2)}}),onUpdateValidValue:r=>{a(void 0,r)}},o),e(h,{isSemiBoldFont:!0,children:"\u5206"})]})]})},Period:{Clock:t=>{let[l,v]=y.minutesUnitState(),[o,u]=D(S.scope(()=>{let[r,m]=S.Arrayify(t.defaultValue),s=d().setFromFormatHHMM(r||"09:00"),c=d().setFromFormatHHMM(m||"18:00");return{eventType:"init",forcus:0,display:s,from:s,to:c}}));y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{if(!o.to.value)return;if(o.from.value>o.to.value){u(m=>g(p({},m),{eventType:"update",from:m.to,to:m.from}));return}t.onValueUpdate({value:[o.from.toFormatHM(),o.to.toFormatHM()],era:"clock",eventType:o.eventType})},[o]);let i=d().setFromFormatHHMM(t.min||"00:00"),n=d().setFromFormatHHMM(t.max||"23:59");const a=(r,m,s)=>{u(c=>{let b=c[r].clone();return S.isExist(m)&&b.setHours(m),S.isExist(s)&&b.setMinutes(s),b.toFormatHM().toNumber()>n.toFormatHM().toNumber()&&(b=n.clone()),b.toFormatHM().toNumber()<i.toFormatHM().toNumber()&&(b=i.clone()),g(p({},c),{eventType:"update",[r]:b})})};return f(L,{width:1,xcss:{minWidth:12*24},children:[f(C.Left,{flexWrap:!0,children:[f(C.Left,{gap:"1/2",children:[e(h.Paragraph,{children:o.from.toFormatHM()||"--:--"}),e(h.Mini,{children:"-"}),e(h.Paragraph,{children:o.to.toFormatHM()||"--:--"})]}),e(P,{}),e(Y,{emptySelect:!1,value:l,paddingLeft:3.5,leftIcon:e(X,{left:"2/3",children:"\u5358\u4F4D"}),pickerPosition:4,pickerStyles:{xcss:{minWidth:12*8}},padding:"1/2",options:[{value:10,label:"10\u5206"},{value:5,label:"5\u5206"},{value:1,label:"1\u5206"}],tabIndex:-1,onUpdateValidValue:r=>{v(r||1)}})]}),e(T,{borderBottom:"1.thin"}),e(y.Period.Preset,g(p({},t),{onPreset:(r,m)=>{u({eventType:"update",forcus:0,display:d(r),from:d(r),to:d(m)})}})),f(C.Center,{gap:"1/2",children:[e(F,{override:"force",value:o.from.hours,options:Array.from({length:24}).map((r,m)=>{let s=m;return i.hours>s||n.hours<s?null:{value:s,label:s.zeroEmbed(2)+"\u6642"}}),onUpdateValidValue:r=>{a("from",r)}}),e(F,{override:"force",value:o.from.minutes,options:Array.from({length:60}).map((r,m)=>{let s=m;return s!=59&&(l==5&&s%5!=0||l==10&&s%10!=0)?null:{value:s,label:s.zeroEmbed(2)+"\u5206"}}),onUpdateValidValue:r=>{a("from",void 0,r)}},l+"-from"),e(h,{isSemiBoldFont:!0,children:"~"}),e(F,{override:"force",value:o.to.hours,options:Array.from({length:24}).map((r,m)=>{let s=m;return i.hours>s||n.hours<s?null:{value:s,label:s.zeroEmbed(2)+"\u6642"}}),onUpdateValidValue:r=>{a("to",r)}}),e(F,{override:"force",value:o.to.minutes,options:Array.from({length:60}).map((r,m)=>{let s=m;return s!=59&&(l==5&&s%5!=0||l==10&&s%10!=0)?null:{value:s,label:s.zeroEmbed(2)+"\u5206"}}),onUpdateValidValue:r=>{a("to",void 0,r)}},l+"-to")]})]})},Date:t=>{let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{let[i,n]=S.Arrayify(t.defaultValue),a=d(i||void 0).setFirstOfDay(),r=d(n||null).setFirstOfDay();return{eventType:"init",forcus:0,display:a,from:a,to:r}}));return y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{if(!o.to.value)return;if(o.from.value>o.to.value){u(n=>g(p({},n),{eventType:"update",from:n.to,to:n.from}));return}t.onValueUpdate({value:[o.from.toFormatYMD(),o.to.toFormatYMD()],era:"year",eventType:o.eventType})},[o]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{gap:"1/2",flexWrap:!0,children:[e(h.Mini,{fontColor:"4.thin",children:"from"}),f(x.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{u(i=>g(p({},i),{forcus:0}))},children:[o.from.toFormatYMD()||"----/--/--",o.forcus==0&&e(y.Parts.PeriodFocusSign,{})]}),e(h.Mini,{fontColor:"4.thin",children:"to"}),f(x.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{u(i=>g(p({},i),{forcus:1}))},children:[o.to.toFormatYMD()||"----/--/--",o.forcus==1&&e(y.Parts.PeriodFocusSign,{})]}),e(P,{}),f(C.Right,{gap:"1/2",marginLeft:"auto",children:[e(Y,{emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,fontSize:"1.mini",pickerStyles:{xcss:{minWidth:12*12}},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})}),options:y.YearOptions({reverse:!0}),value:o.display.year,onUpdateValidValue:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().setYear(Number(i))}))}}),e(Y,{emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,fontSize:"1.mini",pickerStyles:{xcss:{minWidth:12*9}},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})}),options:[{value:1,label:"1\u6708"},{value:2,label:"2\u6708"},{value:3,label:"3\u6708"},{value:4,label:"4\u6708"},{value:5,label:"5\u6708"},{value:6,label:"6\u6708"},{value:7,label:"7\u6708"},{value:8,label:"8\u6708"},{value:9,label:"9\u6708"},{value:10,label:"10\u6708"},{value:11,label:"11\u6708"},{value:12,label:"12\u6708"}],value:o.display.month,onUpdateValidValue:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().setMonth(Number(i)).setDate(1)}))}}),e(y.Parts.ShiftButtons,{callback:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().addMonth(i)}))}})]})]}),e(T,{borderBottom:"1.thin"}),e(y.Period.Preset,g(p({},t),{onPreset:(i,n)=>{u({eventType:"update",forcus:0,display:d(i),from:d(i),to:d(n)})}})),e(C.Left,{verticalAlign:"top",flexWrap:!0,gap:2,children:Array.from({length:4}).map((i,n)=>{let a=y.Parts.Calendar({min:l,max:v,targetMonth:o.display.clone().addMonth(n-1),from:o.from,to:o.to,onTitleRender:r=>{let m=r.diff(o.display).months;return e(h.Mini,{ssHiddenOnBreak:!0,children:f(C.Center,{gap:"1/2",children:[e(h,{isSemiBoldFont:!0,children:r.toFormatYM("JP")}),e(h,{fontColor:"4.thin",children:["[\u524D\u6708]","","[\u7FCC\u6708]","[\u7FCC\u3005\u6708]"][m+1]})]})})},onChange:r=>{if(o.forcus==0){u(m=>g(p({},m),{eventType:"update",forcus:1,from:r,to:d(null)}));return}u(m=>g(p({},m),{eventType:"update",to:r}))}});return e(T,{flexSizing:"auto",ssHiddenOnBreak:n!=1,children:a},n)})})]})},Month:t=>{let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{let[i,n]=S.Arrayify(t.defaultValue),a=d(i||void 0).setDate(1).setFirstOfDay(),r=d(n||null).setDate(1).setFirstOfDay();return{eventType:"init",forcus:0,display:a,from:a,to:r}}));return y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{if(!o.to.value)return;if(o.from.value>o.to.value){u(n=>g(p({},n),{eventType:"update",from:n.to,to:n.from}));return}t.onValueUpdate({value:[o.from.toFormatYM(),o.to.toFormatYM()],era:"year",eventType:o.eventType})},[o]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{gap:"1/2",flexWrap:!0,children:[e(h.Mini,{fontColor:"4.thin",children:"from"}),f(x.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{u(i=>g(p({},i),{forcus:0}))},children:[o.from.toFormatYM("JP")||"----/--",o.forcus==0&&e(y.Parts.PeriodFocusSign,{})]}),e(h.Mini,{fontColor:"4.thin",children:"to"}),f(x.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{u(i=>g(p({},i),{forcus:1}))},children:[o.to.toFormatYM("JP")||"----/--",o.forcus==1&&e(y.Parts.PeriodFocusSign,{})]}),e(P,{}),f(C.Left,{flexWrap:!0,gap:"1/2",marginLeft:"auto",children:[e(Y,{emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,fontSize:"1.mini",pickerStyles:{xcss:{minWidth:12*12}},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})}),options:y.YearOptions({reverse:!0}),value:o.display.year,onUpdateValidValue:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().setYear(Number(i))}))}}),e(y.Parts.ShiftButtons,{callback:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().addYear(i)}))}})]})]}),e(T,{borderBottom:"1.thin"}),e(y.Period.Preset,g(p({},t),{onPreset:(i,n)=>{u({eventType:"update",forcus:0,display:d(i),from:d(i),to:d(n)})}})),e(C.Left,{verticalAlign:"top",flexWrap:!0,gap:2,UnderBreakPointStyles:{gap:1},children:Array.from({length:4}).map((i,n)=>{let a=y.Parts.YearCalendar({min:l,max:v,targetYear:o.display.year+n-1,from:o.from.getFirstDayOfMonth(),to:o.to.getLastDayOfMonth(),onTitleRender:r=>{let m=r-o.display.year;return e(h.Mini,{children:f(C.Left,{gap:"1/2",children:[f(h,{isSemiBoldFont:!0,children:[r,"\u5E74"]}),e(h,{fontColor:"4.thin",children:["[\u524D\u5E74]","","[\u7FCC\u5E74]","[\u7FCC\u3005\u5E74]"][m+1]})]})})},onChange:r=>{if(o.forcus==0){u(m=>g(p({},m),{eventType:"update",forcus:1,from:r,to:d(null)}));return}u(m=>g(p({},m),{eventType:"update",to:r}))}});return e(T,{flexSizing:"auto",ssHiddenOnBreak:n<1||n>2,xcss:{minWidth:"35%"},children:a},n)})})]})},Preset:t=>t.periodPresets?e(C.Right,{gap:"1/2",flexWrap:!0,children:t.periodPresets.map((l,v)=>e(x.Border.S,{padding:["1/4",1],onClick:()=>{t.onPreset(l.from,l.to)},children:l.label},v))}):null},Parts:{ShiftButtons:t=>f(C.Center,{gap:"1/3",fontSize:"1.mini",children:[e(x.Sub,{className:V("LeftButton"),tabIndex:-1,right:0,position:"relative",ssSquare:2.5,onClick:()=>{t.callback(-1)},children:e(B.ChevronLeft,{})}),e(x.Sub,{className:V("RightButton"),tabIndex:-1,left:0,position:"relative",ssSquare:2.5,onClick:()=>{t.callback(1)},children:e(B.ChevronRight,{})})]}),Calendar:t=>{let{targetMonth:l,from:v,to:o,onTitleRender:u=k=>e(h.Mini,{isSemiBoldFont:!0,children:k.toFormatYM("JP")})}=t,i=d();if(!t.targetMonth.validate)return null;let n=l.clone().setDate(1),a=n.getLastDayOfMonth(),r=d(n).addMonth(-1).getLastDayOfMonth().date,m=[],s=[],c=[],b=[];for(var M=0;M<7;M++){let k=M==6,w=M==0;m.push(e(h.Micro,{textAlign:"center",fontColor:k?"googleBlue":w?"googleRed":"inherit",children:S.transformer.weekday.shortJP(M)},M))}for(var M=0;M<n.weekday;M++)s.unshift(e(h.Mini,{fontColor:"4.thin",flexCenter:!0,children:r-M},M));for(var M=1;M<=a.date;M++){let w=l.clone().setDate(M),E=v.isSameDate(w),z=!1,H=!1;o&&o.validate&&(z=w.isInRange(v,o),H=o.isSameDate(w));let G=i.isSameDate(w),U=!1;if(t.min){let I=d(t.min);I&&w.value<I.value&&(U=!0)}if(t.max){let I=d(t.max);I&&I.value<w.value&&(U=!0)}c.push(f(x.Clear.S,{isLocked:U,color:"cloud",border:"1.thin",isActive:E||H||z,isActiveStyles:E||H?{fontColor:"white",backgroundColor:"theme",borderColor:"theme",boxShadow:"0.remark"}:{backgroundColor:"theme.opa.few",fontColor:"theme",borderColor:"0.trans"},xcss:{whiteSpace:"nowrap",minWidth:12*3,minHeight:12*3},flexCenter:!0,ssEffectsOnActive:"shrink",tabIndex:-1,onClick:()=>{t.onChange(w)},children:[M,G&&e(y.Parts.CurrentSign,{})]},w.toFormatYMD()))}for(var M=1;M<7-a.weekday;M++)b.push(e(h.Mini,{flexCenter:!0,fontColor:"4.thin",children:M},M));return f(L,{gap:"1/2",children:[u(l)||"",f(J,{gridCols:7,gap:"1/6",children:[m,s,c,b]})]},l.toFormatYM())},YearCalendar:t=>{let{targetYear:l,from:v,to:o,onTitleRender:u=a=>f(h.Mini,{isSemiBoldFont:!0,children:[a,"\u5E74"]})}=t,i=d(),n=[];for(let a=1;a<=12;a++){let r=d().setYear(t.targetYear).setMonth(a).setDate(1),m=!1;if(t.min){let k=d(t.min).getLastDayOfMonth();k&&r.value<k.value&&(m=!0)}if(t.max){let k=d(t.max).getLastDayOfMonth();k&&k.value<r.value&&(m=!0)}let s=v.year==l&&v.month==r.month,c=!1,b=!1;o&&o.validate&&(c=r.isInRange(v,o),b=o.year==l&&o.month==r.month);let M=i.year==l&&i.month==r.month;n.push(f(x.Clear.S,{isLocked:m,color:"cloud",border:"1.thin",isActive:s||b||c,isActiveStyles:s||b?{fontColor:"white",backgroundColor:"theme",borderColor:"theme",boxShadow:"0.remark"}:{backgroundColor:"theme.opa.few",fontColor:"theme",borderColor:"0.trans"},fontSize:"inherit",ssEffectsOnActive:"shrink",tabIndex:-1,xcss:{whiteSpace:"nowrap",minWidth:12*3,minHeight:12*3},flexCenter:!0,onClick:()=>{t.onChange(r)},children:[f(C.Center,{gap:"1/2",children:[e(h,{children:r.month}),e(h.Mini,{opacity:"middle",children:["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.month]})]}),M&&e(y.Parts.CurrentSign,{})]},l+"-"+r.month))}return f(L,{gap:"1/2",children:[u(t.targetYear),e(J,{flexWrap:!0,gridCols:4,gap:"1/6",children:n})]},t.targetYear)},DrumSelector:t=>{let{type:l,min:v,max:o,value:u}=t;const i=(r,m,s)=>{let c=t.value.clone();if(S.isExist(r)&&(c=c.setYear(r)),S.isExist(m)&&(c=c.setMonth(m)),S.isExist(s)&&(c=c.setDate(s)),v){let b=d(v);c.value<b.value&&(c=b)}if(o){let b=d(o);b.value<c.value&&(c=b)}t.onChange(c)};let n=u.getFirstDayOfMonth(),a=u.getLastDayOfMonth().date;return f(C.Center,{gap:"1/2",children:[e(F,{override:"force",options:y.YearOptions({}),value:u.year,onUpdateValidValue:r=>{i(Number(r))}}),e(h,{isSemiBoldFont:!0,children:"\u5E74"}),e(F,{override:"force",options:Array.from({length:12}).map((r,m)=>{let s=m+1;return{value:s,label:s}}),value:u.month,onUpdateValidValue:r=>{i(void 0,Number(r))}}),e(h,{isSemiBoldFont:!0,children:"\u6708"}),l!="month"&&f($,{children:[e(F,{override:"force",options:Array.from({length:31}).map((r,m)=>{let s=m+1,c=(n.weekday+m)%7;return s>a?null:{value:s,label:f(C.Right,{gap:"1/4",children:[e(h,{children:s}),f(h.Micro,{fontColor:c==0?"googleRed":c==6?"googleBlue":"4.thin",children:["(",S.transformer.weekday.shortJP(c),")"]})]})}}),value:u.date,onUpdateValidValue:r=>{i(void 0,void 0,Number(r))}},[u.year,u.month].join("-")),e(h,{isSemiBoldFont:!0,children:"\u65E5"})]})]})},MinMax:t=>{let{restrict:l,min:v,max:o}=t;if(!v&&!o)return null;let u=d(v||null),i=d(o||null),n="",a="";return l=="year"?(n=u.toFormat("%Y\u5E74"),a=i.toFormat("%Y\u5E74")):l.match(/month/)?(n=u.toFormatYM(),a=i.toFormatYM()):l.match(/date/)?(n=u.toFormatYMD(),a=i.toFormatYMD()):l.match(/clock/)&&(u=d().setFromFormatHHMM(v||""),i=d().setFromFormatHHMM(o||""),n=u.toFormatHM(),a=i.toFormatHM()),f(h.Micro,{fontHeight:1.2,children:[n&&f(h,{children:["\u6700\u5C0F: ",n]}),a&&f(h,{children:["\u6700\u5927: ",a]})]})},CurrentSign:()=>e(T,{position:"absolute",bottom:"1/6",left:"50%",width:1,unitHeight:"1/6",backgroundColor:"warn",xcss:{maxWidth:12*2.5,transform:"translateX(-50%)"},isRounded:!0}),PeriodFocusSign:()=>e(T,{position:"absolute",bottom:"1/4",left:"1/2",right:"1/2",backgroundColor:"theme",unitHeight:"1/4",boxShadow:"0.remark",isRounded:!0})}},A=j;A.picker={open:t=>{let l=null,v=null,o="init",u="L";t.restrict=="year"&&(u="S"),t.restrict=="month"&&(u="S"),t.restrict=="clock"?u="XS":(t.restrict=="locale.jp.warekiDate"||t.restrict=="period.clock")&&(u="S");let i=t.sheetID||O(),n=t.pickerId||O();_.open("middleCenter",{sheetID:i,size:u,padding:[2,0],closeAtAroundClick:!0,closeAtParentBlur:!1,onClose:()=>{o!="commit"&&t.onValueUpdate({value:l,era:v,eventType:"commit"})},content:f(L,{gap:"1/2",children:[f(C.Left,{children:[e(P,{}),e(x.Sub.S,{color:"cloud",ssSphere:3,onClick:()=>{_.close(i)},children:e(B.X,{})})]}),e(_.Body,{children:f(L,{borderRadius:"inherit",children:[e(L,{padding:1,children:e(j,{sheetID:i,pickerId:n,restrict:t.restrict,min:t.min,max:t.max,era:t.era,defaultValue:t.defaultValue,onValueUpdate:a=>{t.onValueUpdate&&t.onValueUpdate(a),l=a.value,v=a.era,o=a.eventType,a.eventType=="commit"&&_.close(i)}})}),f(C.Left,{padding:1,position:"sticky",ssZIndex:10,bottom:0,gap:"1/2",borderTop:"1.thin",backgroundColor:"layer.0.opa.low",borderBottomLeftRadius:"inherit",borderBottomRightRadius:"inherit",xcss:{backdropFilter:"blur(3px)"},children:[e(x.Clear.S,{color:"cloud",tabIndex:-1,fontColor:"4.thin",borderRadius:"2.tone.secondary",flexSizing:"none",onClick:()=>{var a,r;(r=(a=W.get(n||""))==null?void 0:a.onClear)==null||r.call(a)},children:f(C.Center,{gap:"1/2",children:[e(B.X,{}),e(h.Micro,{children:"\u30EA\u30BB\u30C3\u30C8"})]})}),e(y.Parts.MinMax,{restrict:t.restrict,min:t.min,max:t.max}),e(P,{}),e(x.Prime.S,{tabIndex:-1,xcss:{minWidth:12*6},onClick:()=>{var a,r;(r=(a=W.get(n||""))==null?void 0:a.onConfirm)==null||r.call(a)},children:"\u78BA\u5B9A"})]})]})})]})})},close:t=>{_.close(t)}};export{A as TimeSelector,A as default};
1
+ import{b as p,c as g}from"../../../chunk-C5N2D3ZX.js";import{Fragment as $,jsx as e,jsxs as f}from"react/jsx-runtime";import S,{UUID as O,Time as d,useStore as W}from"jmini";import{useState as D,useEffect as R}from"react";import{Box as T,Grid as J,FAI as B,Column as L,FlexMargin as P}from"../../../atoms";import{Row as C,Literal as h}from"../../../mols";import{Button as x}from"../../Trigger";import _ from"../../Sheet";import Y from"../Select";import{LeftIcon as X,RightIcon as N}from"..";import{InputTimeClasses as V}from"../../../@styles/componentClasses";import F from"../Drum";const j=t=>{let{restrict:l}=t;return l=="year"?e(y.Year,p({},t)):l=="month"?e(y.Month,p({},t)):l=="week"?"[DEV]":l=="date"?e(y.Date,p({},t)):l=="locale.jp.warekiDate"?e(y.Locale.JP.WarekiDate,p({},t)):l=="clock"?e(y.Clock,p({},t)):l=="period.clock"?e(y.Period.Clock,p({},t)):l=="period.month"?e(y.Period.Month,p({},t)):l=="period.date"?e(y.Period.Date,p({},t)):null},y={YearOptions:t=>{var u,i,n;let l=[],v=(u=t==null?void 0:t.min)!=null?u:1900,o=(i=t==null?void 0:t.max)!=null?i:d().addYear(10).year;for(let a=v;a<=o;a++){let r=[a],[m,s]=S.transformer.wareki(a).value;((n=t.showJPWareki)==null||n)&&(m&&r.push(e(h.Micro,{fontColor:"4.thin",children:m},1)),s&&r.push(f(h.Micro,{fontColor:"4.thin",children:["[",s,"]"]},2))),l[t.reverse?"unshift":"push"]({value:a,label:e(C.Center,{gap:["1/12","1/4"],verticalAlign:"baseline",flexWrap:!0,children:r})})}return l},calendartypeState:()=>{let[t,l]=D(localStorage.getItem("@env/input/time/selector/calendartype")||"calendar");return R(()=>{localStorage.setItem("@env/input/time/selector/calendartype",String(t))},[t]),[t,l]},minutesUnitState:()=>{let[t,l]=D(Number(localStorage.getItem("@env/input/time/selector/clock/minutesUnit")||10));return R(()=>{localStorage.setItem("@env/input/time/selector/clock/minutesUnit",String(t))},[t]),[t,l]},remoteControl:function(t){let{restrict:l,pickerId:v,val_value:o,set_value:u}=t;R(()=>{v&&W.set({[v]:{onClear:()=>{if(l.match(/period\./)){u(i=>g(p({},i),{eventType:"commit",forcus:0,display:d(),from:d(null),to:d(null)}));return}u(i=>g(p({},i),{eventType:"commit",from:d(null)}))},onConfirm:()=>{u(i=>g(p({},i),{eventType:"commit"}))}}})},[])},Year:t=>{let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{let[i]=String(t.defaultValue).split(/\D/);return{eventType:"init",from:d().setYear(Number(i||d().year))}}));return y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{t.onValueUpdate({value:String(o.from.year||null),era:"year",eventType:o.eventType})},[o]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{flexWrap:!0,children:[f(h.Paragraph,{children:[o.from.year||"----","\u5E74"]}),e(x.Border.XS,{fontColor:"theme",borderRadius:"2.tone.secondary",onClick:()=>{let i=d();u({eventType:"update",from:i})},children:"\u4ECA\u5E74"}),e(P,{})]}),e(T,{borderTop:!0}),e(F,{override:"force",value:o.from.year||null,options:y.YearOptions({min:Number(l)||void 0,max:Number(v)||void 0}),onUpdateValidValue:i=>{u(n=>({eventType:"update",from:n.from.clone().setYear(Number(i))}))}})]})},Month:t=>{let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{let[i,n]=String(t.defaultValue).split(/\D/);(S.isNullish(i)||S.isNullish(n))&&([i,n]=d().toFormat("%Y-%M").split("-"));let a=d(),r=d().setYear(Number(i)||a.year).setMonth(Number(n)||a.month).setDate(1);return{eventType:"init",from:r,display:r}}));return y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{t.onValueUpdate({value:o.from.toFormatYM(),era:"year",eventType:o.eventType})},[o]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{gap:"1/2",children:[e(h.Paragraph,{children:o.from.toFormatYM("JP")||"----/--"}),e(x.Border.XS,{fontColor:"theme",borderRadius:"2.tone.secondary",onClick:()=>{let i=d();u({eventType:"update",from:i,display:i})},children:"\u4ECA\u6708"}),e(P,{})]}),e(T,{borderTop:!0}),e(y.Parts.DrumSelector,{type:"month",min:l,max:v,value:o.from,onChange:i=>{u(g(p({},o),{eventType:"update",from:i}))}})]})},Date:t=>{let{min:l,max:v}=t,[o,u]=y.calendartypeState(),[i,n]=D(S.scope(()=>{var b;let[a,r,m]=(b=String(t.defaultValue))==null?void 0:b.split(/\D/);(S.isNullish(a)||S.isNullish(r)||S.isNullish(m))&&([a,r,m]=d().toFormat("%Y-%M-%D").split("-"));let s=d(),c=d([Number(a)||s.year,(Number(r)||s.month).zeroEmbed(2),(Number(m)||s.date).zeroEmbed(2)].join("/"));return{eventType:"init",era:"year",display:c,from:c}}));return y.remoteControl(g(p({},t),{val_value:i,set_value:n})),R(()=>{t.onValueUpdate({value:i.from.toFormatYMD(),era:"year",eventType:i.eventType})},[i]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{flexWrap:!0,gap:"1/2",children:[e(h.Paragraph,{children:i.from.toFormatYMD("JP")||"----/--/--"}),e(x.Border.XS,{fontColor:"theme",borderRadius:"2.tone.secondary",onClick:()=>{let a=d();n({eventType:"update",era:"year",from:a,display:a})},children:"\u4ECA\u65E5"}),e(P,{}),f(x.Border.S,{padding:["1/6","1/2"],fontColor:"3.blur",fontSize:"0.xs",onClick:()=>{u(a=>a=="calendar"?"drum":"calendar")},children:[o=="calendar"&&"\u30C9\u30E9\u30E0",o=="drum"&&"\u30AB\u30EC\u30F3\u30C0\u30FC","\u8868\u793A"]})]}),e(T,{borderTop:!0}),o=="calendar"&&f($,{children:[f(C.Center,{gap:"1/2",children:[e(Y,{override:"force",emptySelect:!1,value:i.display.year,options:y.YearOptions({reverse:!0}),fontSize:"1.mini",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,pickerStyles:{xcss:{minWidth:12*12}},onUpdateValidValue:a=>{n(r=>g(p({},r),{eventType:"update",display:r.display.clone().setYear(Number(a))}))},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})})}),e(Y,{override:"force",emptySelect:!1,value:i.display.month,options:(()=>{let a=[];for(let r=1;r<=12;r++)a.push({value:r,label:String(r)+"\u6708"});return a})(),fontSize:"1.mini",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,pickerStyles:{xcss:{minWidth:12*8}},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})}),onUpdateValidValue:a=>{n(r=>g(p({},r),{eventType:"update",display:r.display.clone().setMonth(Number(a))}))}}),e(y.Parts.ShiftButtons,{callback:a=>{n(r=>g(p({},r),{eventType:"update",display:r.display.clone().addMonth(a)}))}})]}),f(L,{children:[e(T,{margin:"auto",xcss:{minWidth:"50%"},UnderBreakPointStyles:{margin:0},children:y.Parts.Calendar({min:l,max:v,onTitleRender:a=>"",targetMonth:i.display,from:i.from,onChange:a=>{n(r=>g(p({},r),{eventType:"update",from:a}))}})}),e(T,{unitHeight:"1/4",isRounded:!0,backgroundColor:"cloud",margin:1,ssHiddenOnBreak:!0}),f(C.Center,{verticalAlign:"unset",ssHiddenOnBreak:!0,children:[e(T,{flexSizing:0,children:y.Parts.Calendar({min:l,max:v,onTitleRender:a=>e(h.Mini,{children:f(C.Center,{gap:"1/2",children:[e(h,{isSemiBoldFont:!0,children:a.toFormatYM("JP")}),e(h,{fontColor:"4.thin",children:"[\u524D\u6708]"})]})}),targetMonth:i.display.clone().addMonth(-1),from:i.from,onChange:a=>{n(r=>g(p({},r),{eventType:"update",from:a}))}})}),e(T,{unitWidth:"1/4",isRounded:!0,backgroundColor:"cloud",margin:1}),e(T,{flexSizing:0,children:y.Parts.Calendar({min:l,max:v,onTitleRender:a=>e(h.Mini,{children:f(C.Center,{gap:"1/2",children:[e(h,{isSemiBoldFont:!0,children:a.toFormatYM("JP")}),e(h,{fontColor:"4.thin",children:"[\u7FCC\u6708]"})]})}),targetMonth:i.display.clone().addMonth(1),from:i.from,onChange:a=>{n(r=>g(p({},r),{eventType:"update",from:a}))}})})]})]})]}),o=="drum"&&e(y.Parts.DrumSelector,{type:"date",min:l,max:v,value:i.from,onChange:a=>{n(g(p({},i),{eventType:"update",from:a}))}})]})},Locale:{JP:{WarekiDate:t=>{var n;let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{var M;let[a,r,m]=(M=String(t.defaultValue))==null?void 0:M.split(/\D/),s=t.era||"year";if(S.isNullish(a)||S.isNullish(r)||S.isNullish(m)){let k=d();s=="heisei"?k.setYear(1989):s=="shouwa"?k.setYear(1926):s=="taisho"?k.setYear(1912):s=="meiji"&&k.setYear(1868),[a,r,m]=k.toFormat("%Y-%M-%D").split("-")}let c=d();return{eventType:"init",from:d([Number(a)||c.year,(Number(r)||c.month).zeroEmbed(2),(Number(m)||c.date).zeroEmbed(2)].join("/"))}}));y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{t.onValueUpdate({value:o.from.toFormatYMD(),era:o.from.wareki.toLower(),eventType:o.eventType})},[o]);let i={year:{label:"\u897F\u66A6",min:"1900/01/01",max:"2100/12/31"},reiwa:{label:"\u4EE4\u548C",min:"2019/05/01",max:d().addYear(10).setMonth(12).setDate(31).toFormatYMD()},heisei:{label:"\u5E73\u6210",min:"1989/01/08",max:"2019/04/30"},showa:{label:"\u662D\u548C",min:"1926/12/25",max:"1989/01/07"},taisho:{label:"\u5927\u6B63",min:"1912/07/30",max:"1926/12/24"},meiji:{label:"\u660E\u6CBB",min:"1868/09/08",max:"1912/07/29"}};return f(L,{children:[f(C.Left,{gap:"1/4",flexWrap:!0,children:[f(h.Paragraph,{children:[o.from.warekiLabel,(n=o.from.warekiYear)==null?void 0:n.zeroEmbed(2),"\u5E74",o.from.toFormatMD("JP")]}),e(P,{})]}),e(T,{borderTop:!0}),e(C.Left,{gap:"1/2",flexWrap:!0,children:["reiwa","heisei","showa","taisho","meiji"].map((a,r)=>{let m=i[a];return m?e(x.Border.S,{onClick:()=>{let s=o.from;if(a=="reiwa"||a=="year")s=d();else{let c=d(m.min),b=d(m.max);c.value>o.from.value&&(s=c),o.from.value>b.value&&(s=b)}if(l){let c=d(l);s.value<c.value&&(s=c)}if(v){let c=d(v);c.value<s.value&&(s=c)}u(g(p({},o),{eventType:"update",from:s}))},children:m.label},r):null})}),e(y.Parts.DrumSelector,{type:"locale.jp.warekiDate",min:t.min,max:t.max,value:o.from,onChange:a=>{u(g(p({},o),{eventType:"update",from:a}))}})]})}}},Clock:t=>{let[l,v]=D(S.scope(()=>{let r=String(t.defaultValue).split(/[^\d]/);if(!r[0]){let c=d();r=[c.hours,c.minutes]}let m=Number(r[0]),s=Number(r[1]);return{eventType:"init",from:d().setHours(m).setMinutes(s)}}));y.remoteControl(g(p({},t),{val_value:l,set_value:v})),R(()=>{t.onValueUpdate({value:l.from.toFormatHM(),era:"clock",eventType:l.eventType})},[l]);let[o,u]=y.minutesUnitState(),i=d().setFromFormatHHMM(t.min||"00:00"),n=d().setFromFormatHHMM(t.max||"23:59");const a=(r,m)=>{v(s=>{let c=s.from.clone();return S.isExist(r)&&c.setHours(r),S.isExist(m)&&c.setMinutes(m),c.toFormatHM().toNumber()>n.toFormatHM().toNumber()&&(c=n.clone()),c.toFormatHM().toNumber()<i.toFormatHM().toNumber()&&(c=i.clone()),g(p({},s),{eventType:"update",from:c})})};return f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{gap:"1/2",flexWrap:!0,children:[f(C.Center,{gap:"1/2",children:[e(T,{className:V("ClockBase"),children:e(T,{className:V("ClockUiBase"),flexCenter:!0,children:f(T,{className:V("ClockUi"),backgroundColor:"theme.opa.low",isRounded:!0,position:"relative",children:[e(T,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[V("Needle"),V("hour")].join(" "),xcss:{transform:`rotate(${l.from.hours*30+l.from.minutes/2}deg)`}}),e(T,{position:"absolute",backgroundColor:"theme",unitWidth:"1/12",className:[V("Needle"),V("minute")].join(" "),xcss:{transform:`rotate(${l.from.minutes*6}deg)`}})]})})}),f(T,{textAlign:"center",fontHeight:1.2,children:[f(h.Paragraph,{children:[l.from.hours.zeroEmbed(2)," : ",l.from.minutes.zeroEmbed(2)]}),f(h.Mini,{fontColor:"4.thin",children:[l.from.hours>=12&&"PM"||"AM",l.from.hours%12,":",l.from.minutes.zeroEmbed(2)]})]})]}),e(x.Border.XS,{borderRadius:"2.tone.secondary",fontColor:"theme",onClick:()=>{let r=d().setSeconds(0);r.minutes=Math.round(r.minutes/o)*o,a(r.hours,r.minutes)},children:"\u73FE\u6642\u523B"}),e(P,{}),e(Y,{emptySelect:!1,value:o,paddingLeft:3.5,leftIcon:e(X,{left:"2/3",children:"\u5358\u4F4D"}),pickerPosition:4,pickerStyles:{xcss:{minWidth:12*8}},padding:"1/2",options:[{value:10,label:"10\u5206"},{value:5,label:"5\u5206"},{value:1,label:"1\u5206"}],tabIndex:-1,onUpdateValidValue:r=>{u(r||1)}})]}),e(T,{borderTop:!0}),f(C.Center,{gap:"1/2",children:[e(F,{xcss:{maxHeight:12*12},override:"force",options:[{value:0,label:"\u5348\u524D"},{value:12,label:"\u5348\u5F8C"}],value:l.from.hours>=12?12:0,onUpdateValidValue:r=>{let m=l.from.hours%12+r;a(m)}}),e(F,{override:"force",value:l.from.hours,options:Array.from({length:24}).map((r,m)=>{let s=m;return i.hours>s||n.hours<s?null:{value:s,label:s.zeroEmbed(2)}}),onUpdateValidValue:r=>{a(r)}}),e(h,{isSemiBoldFont:!0,children:"\u6642"}),e(F,{override:"force",value:l.from.minutes,options:Array.from({length:60}).map((r,m)=>{let s=m;return s!=59&&(o==5&&s%5!=0||o==10&&s%10!=0)?null:{value:s,label:s.zeroEmbed(2)}}),onUpdateValidValue:r=>{a(void 0,r)}},o),e(h,{isSemiBoldFont:!0,children:"\u5206"})]})]})},Period:{Clock:t=>{let[l,v]=y.minutesUnitState(),[o,u]=D(S.scope(()=>{let[r,m]=S.Arrayify(t.defaultValue),s=d().setFromFormatHHMM(r||"09:00"),c=d().setFromFormatHHMM(m||"18:00");return{eventType:"init",forcus:0,display:s,from:s,to:c}}));y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{if(!o.to.value)return;if(o.from.value>o.to.value){u(m=>g(p({},m),{eventType:"update",from:m.to,to:m.from}));return}t.onValueUpdate({value:[o.from.toFormatHM(),o.to.toFormatHM()],era:"clock",eventType:o.eventType})},[o]);let i=d().setFromFormatHHMM(t.min||"00:00"),n=d().setFromFormatHHMM(t.max||"23:59");const a=(r,m,s)=>{u(c=>{let b=c[r].clone();return S.isExist(m)&&b.setHours(m),S.isExist(s)&&b.setMinutes(s),b.toFormatHM().toNumber()>n.toFormatHM().toNumber()&&(b=n.clone()),b.toFormatHM().toNumber()<i.toFormatHM().toNumber()&&(b=i.clone()),g(p({},c),{eventType:"update",[r]:b})})};return f(L,{width:1,xcss:{minWidth:12*24},children:[f(C.Left,{flexWrap:!0,children:[f(C.Left,{gap:"1/2",children:[e(h.Paragraph,{children:o.from.toFormatHM()||"--:--"}),e(h.Mini,{children:"-"}),e(h.Paragraph,{children:o.to.toFormatHM()||"--:--"})]}),e(P,{}),e(Y,{emptySelect:!1,value:l,paddingLeft:3.5,leftIcon:e(X,{left:"2/3",children:"\u5358\u4F4D"}),pickerPosition:4,pickerStyles:{xcss:{minWidth:12*8}},padding:"1/2",options:[{value:10,label:"10\u5206"},{value:5,label:"5\u5206"},{value:1,label:"1\u5206"}],tabIndex:-1,onUpdateValidValue:r=>{v(r||1)}})]}),e(T,{borderBottom:"1.thin"}),e(y.Period.Preset,g(p({},t),{onPreset:(r,m)=>{u({eventType:"update",forcus:0,display:d(r),from:d(r),to:d(m)})}})),f(C.Center,{gap:"1/2",children:[e(F,{override:"force",value:o.from.hours,options:Array.from({length:24}).map((r,m)=>{let s=m;return i.hours>s||n.hours<s?null:{value:s,label:s.zeroEmbed(2)+"\u6642"}}),onUpdateValidValue:r=>{a("from",r)}}),e(F,{override:"force",value:o.from.minutes,options:Array.from({length:60}).map((r,m)=>{let s=m;return s!=59&&(l==5&&s%5!=0||l==10&&s%10!=0)?null:{value:s,label:s.zeroEmbed(2)+"\u5206"}}),onUpdateValidValue:r=>{a("from",void 0,r)}},l+"-from"),e(h,{isSemiBoldFont:!0,children:"~"}),e(F,{override:"force",value:o.to.hours,options:Array.from({length:24}).map((r,m)=>{let s=m;return i.hours>s||n.hours<s?null:{value:s,label:s.zeroEmbed(2)+"\u6642"}}),onUpdateValidValue:r=>{a("to",r)}}),e(F,{override:"force",value:o.to.minutes,options:Array.from({length:60}).map((r,m)=>{let s=m;return s!=59&&(l==5&&s%5!=0||l==10&&s%10!=0)?null:{value:s,label:s.zeroEmbed(2)+"\u5206"}}),onUpdateValidValue:r=>{a("to",void 0,r)}},l+"-to")]})]})},Date:t=>{let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{let[i,n]=S.Arrayify(t.defaultValue),a=d(i||void 0).setFirstOfDay(),r=d(n||null).setFirstOfDay();return{eventType:"init",forcus:0,display:a,from:a,to:r}}));return y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{if(!o.to.value)return;if(o.from.value>o.to.value){u(n=>g(p({},n),{eventType:"update",from:n.to,to:n.from}));return}t.onValueUpdate({value:[o.from.toFormatYMD(),o.to.toFormatYMD()],era:"year",eventType:o.eventType})},[o]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{gap:"1/2",flexWrap:!0,children:[e(h.Mini,{fontColor:"4.thin",children:"from"}),f(x.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{u(i=>g(p({},i),{forcus:0}))},children:[o.from.toFormatYMD()||"----/--/--",o.forcus==0&&e(y.Parts.PeriodFocusSign,{})]}),e(h.Mini,{fontColor:"4.thin",children:"to"}),f(x.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{u(i=>g(p({},i),{forcus:1}))},children:[o.to.toFormatYMD()||"----/--/--",o.forcus==1&&e(y.Parts.PeriodFocusSign,{})]}),e(P,{}),f(C.Right,{gap:"1/2",marginLeft:"auto",children:[e(Y,{emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,fontSize:"1.mini",pickerStyles:{xcss:{minWidth:12*12}},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})}),options:y.YearOptions({reverse:!0}),value:o.display.year,onUpdateValidValue:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().setYear(Number(i))}))}}),e(Y,{emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,fontSize:"1.mini",pickerStyles:{xcss:{minWidth:12*9}},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})}),options:[{value:1,label:"1\u6708"},{value:2,label:"2\u6708"},{value:3,label:"3\u6708"},{value:4,label:"4\u6708"},{value:5,label:"5\u6708"},{value:6,label:"6\u6708"},{value:7,label:"7\u6708"},{value:8,label:"8\u6708"},{value:9,label:"9\u6708"},{value:10,label:"10\u6708"},{value:11,label:"11\u6708"},{value:12,label:"12\u6708"}],value:o.display.month,onUpdateValidValue:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().setMonth(Number(i)).setDate(1)}))}}),e(y.Parts.ShiftButtons,{callback:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().addMonth(i)}))}})]})]}),e(T,{borderBottom:"1.thin"}),e(y.Period.Preset,g(p({},t),{onPreset:(i,n)=>{u({eventType:"update",forcus:0,display:d(i),from:d(i),to:d(n)})}})),e(C.Left,{verticalAlign:"top",flexWrap:!0,gap:2,children:Array.from({length:4}).map((i,n)=>{let a=y.Parts.Calendar({min:l,max:v,targetMonth:o.display.clone().addMonth(n-1),from:o.from,to:o.to,onTitleRender:r=>{let m=r.diff(o.display).months;return e(h.Mini,{ssHiddenOnBreak:!0,children:f(C.Center,{gap:"1/2",children:[e(h,{isSemiBoldFont:!0,children:r.toFormatYM("JP")}),e(h,{fontColor:"4.thin",children:["[\u524D\u6708]","","[\u7FCC\u6708]","[\u7FCC\u3005\u6708]"][m+1]})]})})},onChange:r=>{if(o.forcus==0){u(m=>g(p({},m),{eventType:"update",forcus:1,from:r,to:d(null)}));return}u(m=>g(p({},m),{eventType:"update",to:r}))}});return e(T,{flexSizing:"auto",ssHiddenOnBreak:n!=1,children:a},n)})})]})},Month:t=>{let{min:l,max:v}=t,[o,u]=D(S.scope(()=>{let[i,n]=S.Arrayify(t.defaultValue),a=d(i||void 0).setDate(1).setFirstOfDay(),r=d(n||null).setDate(1).setFirstOfDay();return{eventType:"init",forcus:0,display:a,from:a,to:r}}));return y.remoteControl(g(p({},t),{val_value:o,set_value:u})),R(()=>{if(!o.to.value)return;if(o.from.value>o.to.value){u(n=>g(p({},n),{eventType:"update",from:n.to,to:n.from}));return}t.onValueUpdate({value:[o.from.toFormatYM(),o.to.toFormatYM()],era:"year",eventType:o.eventType})},[o]),f(L,{xcss:{minWidth:12*16},children:[f(C.Left,{gap:"1/2",flexWrap:!0,children:[e(h.Mini,{fontColor:"4.thin",children:"from"}),f(x.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{u(i=>g(p({},i),{forcus:0}))},children:[o.from.toFormatYM("JP")||"----/--",o.forcus==0&&e(y.Parts.PeriodFocusSign,{})]}),e(h.Mini,{fontColor:"4.thin",children:"to"}),f(x.Sub,{color:"cloud",isSemiBoldFont:!0,fontColor:"inherit",onClick:()=>{u(i=>g(p({},i),{forcus:1}))},children:[o.to.toFormatYM("JP")||"----/--",o.forcus==1&&e(y.Parts.PeriodFocusSign,{})]}),e(P,{}),f(C.Left,{flexWrap:!0,gap:"1/2",marginLeft:"auto",children:[e(Y,{emptySelect:!1,override:"force",border:"1.thin",padding:["1/3","2/3"],paddingRight:2,fontSize:"1.mini",pickerStyles:{xcss:{minWidth:12*12}},rightIcon:e(N,{right:"2/3",children:e(B.AngleDown,{})}),options:y.YearOptions({reverse:!0}),value:o.display.year,onUpdateValidValue:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().setYear(Number(i))}))}}),e(y.Parts.ShiftButtons,{callback:i=>{u(n=>g(p({},n),{eventType:"update",display:n.display.clone().addYear(i)}))}})]})]}),e(T,{borderBottom:"1.thin"}),e(y.Period.Preset,g(p({},t),{onPreset:(i,n)=>{u({eventType:"update",forcus:0,display:d(i),from:d(i),to:d(n)})}})),e(C.Left,{verticalAlign:"top",flexWrap:!0,gap:2,UnderBreakPointStyles:{gap:1},children:Array.from({length:4}).map((i,n)=>{let a=y.Parts.YearCalendar({min:l,max:v,targetYear:o.display.year+n-1,from:o.from.getFirstDayOfMonth(),to:o.to.getLastDayOfMonth(),onTitleRender:r=>{let m=r-o.display.year;return e(h.Mini,{children:f(C.Left,{gap:"1/2",children:[f(h,{isSemiBoldFont:!0,children:[r,"\u5E74"]}),e(h,{fontColor:"4.thin",children:["[\u524D\u5E74]","","[\u7FCC\u5E74]","[\u7FCC\u3005\u5E74]"][m+1]})]})})},onChange:r=>{if(o.forcus==0){u(m=>g(p({},m),{eventType:"update",forcus:1,from:r,to:d(null)}));return}u(m=>g(p({},m),{eventType:"update",to:r}))}});return e(T,{flexSizing:"auto",ssHiddenOnBreak:n<1||n>2,xcss:{minWidth:"35%"},children:a},n)})})]})},Preset:t=>t.periodPresets?e(C.Right,{gap:"1/2",flexWrap:!0,children:t.periodPresets.map((l,v)=>e(x.Border.S,{padding:["1/4",1],onClick:()=>{t.onPreset(l.from,l.to)},children:l.label},v))}):null},Parts:{ShiftButtons:t=>f(C.Center,{gap:"1/3",fontSize:"1.mini",children:[e(x.Sub,{className:V("LeftButton"),tabIndex:-1,right:0,position:"relative",ssSquare:2.5,onClick:()=>{t.callback(-1)},children:e(B.ChevronLeft,{})}),e(x.Sub,{className:V("RightButton"),tabIndex:-1,left:0,position:"relative",ssSquare:2.5,onClick:()=>{t.callback(1)},children:e(B.ChevronRight,{})})]}),Calendar:t=>{let{targetMonth:l,from:v,to:o,onTitleRender:u=k=>e(h.Mini,{isSemiBoldFont:!0,children:k.toFormatYM("JP")})}=t,i=d();if(!t.targetMonth.validate)return null;let n=l.clone().setDate(1),a=n.getLastDayOfMonth(),r=d(n).addMonth(-1).getLastDayOfMonth().date,m=[],s=[],c=[],b=[];for(var M=0;M<7;M++){let k=M==6,w=M==0;m.push(e(h.Micro,{textAlign:"center",fontColor:k?"googleBlue":w?"googleRed":"inherit",children:S.transformer.weekday.shortJP(M)},M))}for(var M=0;M<n.weekday;M++)s.unshift(e(h.Mini,{fontColor:"4.thin",flexCenter:!0,children:r-M},M));for(var M=1;M<=a.date;M++){let w=l.clone().setDate(M),E=v.isSameDate(w),z=!1,H=!1;o&&o.validate&&(z=w.isInRange(v,o),H=o.isSameDate(w));let G=i.isSameDate(w),U=!1;if(t.min){let I=d(t.min);I&&w.value<I.value&&(U=!0)}if(t.max){let I=d(t.max);I&&I.value<w.value&&(U=!0)}c.push(f(x.Clear.S,{isLocked:U,color:"cloud",border:"1.thin",isActive:E||H||z,isActiveStyles:E||H?{fontColor:"white",backgroundColor:"theme",borderColor:"theme",boxShadow:"0.remark"}:{backgroundColor:"theme.opa.few",fontColor:"theme",borderColor:"0.trans"},xcss:{whiteSpace:"nowrap",minWidth:12*3,minHeight:12*3},flexCenter:!0,ssEffectsOnActive:"shrink",tabIndex:-1,onClick:()=>{t.onChange(w)},children:[M,G&&e(y.Parts.CurrentSign,{})]},w.toFormatYMD()))}for(var M=1;M<7-a.weekday;M++)b.push(e(h.Mini,{flexCenter:!0,fontColor:"4.thin",children:M},M));return f(L,{gap:"1/2",children:[u(l)||"",f(J,{gridCols:7,gap:"1/6",children:[m,s,c,b]})]},l.toFormatYM())},YearCalendar:t=>{let{targetYear:l,from:v,to:o,onTitleRender:u=a=>f(h.Mini,{isSemiBoldFont:!0,children:[a,"\u5E74"]})}=t,i=d(),n=[];for(let a=1;a<=12;a++){let r=d().setYear(t.targetYear).setMonth(a).setDate(1),m=!1;if(t.min){let k=d(t.min).getLastDayOfMonth();k&&r.value<k.value&&(m=!0)}if(t.max){let k=d(t.max).getLastDayOfMonth();k&&k.value<r.value&&(m=!0)}let s=v.year==l&&v.month==r.month,c=!1,b=!1;o&&o.validate&&(c=r.isInRange(v,o),b=o.year==l&&o.month==r.month);let M=i.year==l&&i.month==r.month;n.push(f(x.Clear.S,{isLocked:m,color:"cloud",border:"1.thin",isActive:s||b||c,isActiveStyles:s||b?{fontColor:"white",backgroundColor:"theme",borderColor:"theme",boxShadow:"0.remark"}:{backgroundColor:"theme.opa.few",fontColor:"theme",borderColor:"0.trans"},fontSize:"inherit",ssEffectsOnActive:"shrink",tabIndex:-1,xcss:{whiteSpace:"nowrap",minWidth:12*3,minHeight:12*3},flexCenter:!0,onClick:()=>{t.onChange(r)},children:[f(C.Center,{gap:"1/2",children:[e(h,{children:r.month}),e(h.Mini,{opacity:"middle",children:["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.month]})]}),M&&e(y.Parts.CurrentSign,{})]},l+"-"+r.month))}return f(L,{gap:"1/2",children:[u(t.targetYear),e(J,{flexWrap:!0,gridCols:4,gap:"1/6",children:n})]},t.targetYear)},DrumSelector:t=>{let{type:l,min:v,max:o,value:u}=t;const i=(r,m,s)=>{let c=t.value.clone();if(S.isExist(r)&&(c=c.setYear(r)),S.isExist(m)&&(c=c.setMonth(m)),S.isExist(s)&&(c=c.setDate(s)),v){let b=d(v);c.value<b.value&&(c=b)}if(o){let b=d(o);b.value<c.value&&(c=b)}t.onChange(c)};let n=u.getFirstDayOfMonth(),a=u.getLastDayOfMonth().date;return f(C.Center,{gap:"1/2",children:[e(F,{override:"force",options:y.YearOptions({}),value:u.year,onUpdateValidValue:r=>{i(Number(r))}}),e(h,{isSemiBoldFont:!0,children:"\u5E74"}),e(F,{override:"force",options:Array.from({length:12}).map((r,m)=>{let s=m+1;return{value:s,label:s}}),value:u.month,onUpdateValidValue:r=>{i(void 0,Number(r))}}),e(h,{isSemiBoldFont:!0,children:"\u6708"}),l!="month"&&f($,{children:[e(F,{override:"force",options:Array.from({length:31}).map((r,m)=>{let s=m+1,c=(n.weekday+m)%7;return s>a?null:{value:s,label:f(C.Right,{gap:"1/4",children:[e(h,{children:s}),f(h.Micro,{fontColor:c==0?"googleRed":c==6?"googleBlue":"4.thin",children:["(",S.transformer.weekday.shortJP(c),")"]})]})}}),value:u.date,onUpdateValidValue:r=>{i(void 0,void 0,Number(r))}},[u.year,u.month].join("-")),e(h,{isSemiBoldFont:!0,children:"\u65E5"})]})]})},MinMax:t=>{let{restrict:l,min:v,max:o}=t;if(!v&&!o)return null;let u=d(v||null),i=d(o||null),n="",a="";return l=="year"?(n=u.toFormat("%Y\u5E74"),a=i.toFormat("%Y\u5E74")):l.match(/month/)?(n=u.toFormatYM(),a=i.toFormatYM()):l.match(/date/)?(n=u.toFormatYMD(),a=i.toFormatYMD()):l.match(/clock/)&&(u=d().setFromFormatHHMM(v||""),i=d().setFromFormatHHMM(o||""),n=u.toFormatHM(),a=i.toFormatHM()),f(h.Micro,{fontHeight:1.2,children:[n&&f(h,{children:["\u6700\u5C0F: ",n]}),a&&f(h,{children:["\u6700\u5927: ",a]})]})},CurrentSign:()=>e(T,{position:"absolute",bottom:"1/6",left:"50%",width:1,unitHeight:"1/6",backgroundColor:"warn",xcss:{maxWidth:12*2.5,transform:"translateX(-50%)"},isRounded:!0}),PeriodFocusSign:()=>e(T,{position:"absolute",bottom:"1/4",left:"1/2",right:"1/2",backgroundColor:"theme",unitHeight:"1/4",boxShadow:"0.remark",isRounded:!0})}},A=j;A.picker={open:t=>{let l=null,v=null,o="init",u="L";t.restrict=="year"&&(u="S"),t.restrict=="month"&&(u="S"),t.restrict=="clock"?u="XS":(t.restrict=="locale.jp.warekiDate"||t.restrict=="period.clock")&&(u="S");let i=t.sheetID||O(),n=t.pickerId||O();_.open("middleCenter",{sheetID:i,size:u,padding:[2,0],closeAtAroundClick:!0,closeAtParentBlur:!1,onClose:()=>{o!="commit"&&t.onValueUpdate({value:l,era:v,eventType:"commit"})},content:f(L,{gap:"1/2",children:[f(C.Left,{children:[e(P,{}),e(x.Sub.S,{color:"cloud",ssSphere:3,onClick:()=>{_.close(i)},children:e(B.X,{})})]}),e(_.Body,{children:f(L,{borderRadius:"inherit",children:[e(L,{padding:1,children:e(j,{sheetID:i,pickerId:n,restrict:t.restrict,min:t.min,max:t.max,era:t.era,defaultValue:t.defaultValue,onValueUpdate:a=>{t.onValueUpdate&&t.onValueUpdate(a),l=a.value,v=a.era,o=a.eventType,a.eventType=="commit"&&_.close(i)}})}),f(C.Left,{padding:1,position:"sticky",ssZIndex:10,bottom:0,gap:"1/2",borderTop:"1.thin",backgroundColor:"layer.0.opa.low",borderBottomLeftRadius:"inherit",borderBottomRightRadius:"inherit",xcss:{backdropFilter:"blur(3px)"},children:[e(x.Clear.S,{color:"cloud",tabIndex:-1,fontColor:"4.thin",borderRadius:"2.tone.secondary",flexSizing:"none",onClick:()=>{var a,r;(r=(a=W.get(n||""))==null?void 0:a.onClear)==null||r.call(a)},children:f(C.Center,{gap:"1/2",children:[e(B.X,{}),e(h.Micro,{children:"\u30EA\u30BB\u30C3\u30C8"})]})}),e(y.Parts.MinMax,{restrict:t.restrict,min:t.min,max:t.max}),e(P,{}),e(x.Prime.S,{tabIndex:-1,xcss:{minWidth:12*6},onClick:()=>{var a,r;(r=(a=W.get(n||""))==null?void 0:a.onConfirm)==null||r.call(a)},children:"\u78BA\u5B9A"})]})]})})]})})},close:t=>{_.close(t)}};export{A as TimeSelector,A as default};
@@ -1 +1 @@
1
- import{a as re,b as i,c as v,d as Q}from"../../../chunk-C5N2D3ZX.js";import{Fragment as Ee,jsx as f,jsxs as le}from"react/jsx-runtime";import M,{UUID as $,useStore as W}from"jmini";import*as K from"jmini";import{useState as B,useEffect as z,useRef as me}from"react";import{$$fromRoot as ue,Config as ie,ExtractStyles as de}from"../../../@utils";import{Box as H,FAI as fe}from"../../../atoms";import{Literal as he}from"../../../mols";import{Button as oe}from"../../Button";import{faClock as ge}from"@fortawesome/free-solid-svg-icons/faClock";import{faCalendarAlt as ye}from"@fortawesome/free-solid-svg-icons/faCalendarAlt";import{OptionalInputWrapper as Ie,BoxWrapper as ve,CoreEffects as Y,DefaultBoxishStyles as Se}from"../core";import{RightIcon as we}from"..";import Te from"../Select";import{InputLabel as De}from"../Label";import{TimeSelector as ne}from"./Selector";const A=" ~ ",be={clock:{defaultValue:"--:--",format:/^\d{2}\D\d{2}$/,ranges:[{type:"hour",from:0,length:2},{type:"minute",from:3,length:2}],sets:1},date:{defaultValue:"----/--/--",format:/^\d{4}\D\d{2}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2},{type:"date",from:8,length:2}],sets:1},week:{defaultValue:"----\u5E74\u7B2C--\u9031",format:/^\d{4}\D\d{2}$/,ranges:[{type:"year",from:0,length:4,region:6},{type:"week",from:6,length:2,region:3}],sets:1},month:{defaultValue:"----\u5E74--\u6708",format:/^\d{4}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2,region:3}],sets:1},year:{defaultValue:"----\u5E74",format:/^\d{4}$/,ranges:[{type:"year",from:0,length:4,region:5}],sets:1},"period.clock":{defaultValue:"--:--",format:/^\d{2}\D\d{2}$/,ranges:[{type:"hour",from:0,length:2},{type:"minute",from:3,length:2},{type:"hour",from:5+A.length,length:2},{type:"minute",from:8+A.length,length:2}],sets:2},"period.date":{defaultValue:"----/--/--",format:/^\d{4}\D\d{2}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2},{type:"date",from:8,length:2,region:5},{type:"year",from:10+A.length,length:4},{type:"month",from:15+A.length,length:2},{type:"date",from:18+A.length,length:2}],sets:2},"period.month":{defaultValue:"----\u5E74--\u6708",format:/^\d{4}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2,region:6},{type:"year",from:8+A.length,length:4},{type:"month",from:13+A.length,length:2,region:3}],sets:2},"locale.jp.warekiDate":{defaultValue:"----\u5E74--\u6708--\u65E5",format:/^\d{4}\D\d{2}\D\d{2}$/,ranges:[{type:"locale.jp.warekiDate",from:0,length:4,region:5},{type:"month",from:5,length:2,region:3},{type:"date",from:8,length:2,region:3}],sets:1}},N={PeriodMargin:" ~ ",SyncValue:e=>{let{restrict:a,value:I,era:o}=e,h=M.Arrayify(I||""),{defaultValue:E,format:w,ranges:l,sets:r}=be[a],_=[],D=a.match(/clock/)?":":"/";for(let t=0;t<h.length;t++)h[t]=String(h[t]).replace(/\D/ig,D);for(let t=0;t<r;t++){let p=h[t]||"";if(!p.match(w))h[t]="",_.push(E);else{let m=E;p.split(/\D/).forEach((b,k)=>{if(k==0&&a=="locale.jp.warekiDate"){let g=Number(b);o!="year"&&(g>=2019?o=="reiwa"?g-=2018:o=="heisei"&&(g=31):g>=1989?o=="heisei"?g-=1988:o=="shouwa"&&(g=64):g>=1926?o=="shouwa"?g-=1925:o=="taisho"&&(g=15):g>=1912?o=="taisho"?g-=1911:o=="meiji"&&(g=45):g>=1868&&(g-=1867)),b=g.zeroEmbed(4)}m=m.replace(new RegExp("------------------".slice(0,b.length)),b)}),_.push(m)}}return{safeValue:_.join(A),rawValue:a.startsWith("period.")?h:h[0],ranges:l}},SystemValidation:e=>{let{states:a}=e,{restrict:I,min:o,max:h,required:E}=a,w=[],l=M.Arrayify(e.value),r={empty:!1,escalated:1,filled:!0,correct:!0,prohibited:!1};(()=>{let D=I.match(/clock/)?":":"/";for(let t=0;t<l.length;t++)l[t]=String(l[t]).replace(/\D/ig,D);for(let t=0;t<l.length;t++){let p=l[t],m=l[t-1];p.removeLetters()||(r.empty=!0),t>0&&(r.escalated&=+(p>=m))}r.escalated&&(r.empty||(I.match(/clock/)?l.forEach(t=>{let[p,m]=t.split(/\D+/);!p||!m?r.filled=!1:(Number(p)>23||Number(m)>59)&&(r.correct=!1)}):I.match(/date/)?l.forEach(t=>{let[p,m,b]=t.split(/\D+/);if(!p||!m||!b)r.filled=!1;else{let k=K.Time(t);(!k.validate||t!=k.toFormatYMD())&&(r.correct=!1)}}):I.match(/week/)?l.forEach(t=>{let[p,m]=t.split(/\D+/);if(!p||!m)r.filled=!1;else{let b=K.Time(p+"/01/01").weekday,g=K.Time(p+"/01/0"+(7-b+1)).addWeek(Number(m)-1);p!=String(g.year)&&(r.correct=!1)}}):I.match(/month/)?l.forEach(t=>{let[p,m]=t.split(/\D+/);!p||!m?r.filled=!1:K.Time([p,m,"01"].join("/")).validate||(r.correct=!1)}):I.match(/year/),r.filled&&r.correct&&l.forEach(t=>{{let p=Number(String(t).replace(/\D/ig,""));if(o&&Number(String(o).replace(/\D/ig,""))>p&&(r.prohibited=!0),h){let m=Number(String(h).replace(/\D/ig,""));p>m&&(r.prohibited=!0)}}})))})();{let{empty:D,escalated:t,filled:p,correct:m,prohibited:b}=r;D&&E&&(w=[{type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}]),t||w.push({type:"invalid",label:"\u6642\u7CFB\u5217\u3092\u6B63\u3057\u304F\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),m||w.push({type:"invalid",label:"\u7121\u52B9\u306A\u5024\u304C\u5165\u529B\u3055\u308C\u3066\u3044\u307E\u3059"}),p||w.push({type:"invalid",label:"\u6700\u5F8C\u307E\u3067\u5024\u3092\u57CB\u3081\u3066\u304F\u3060\u3055\u3044"}),b&&w.push({type:"invalid",label:le(Ee,{children:[f(H,{children:"\u5165\u529B\u7BC4\u56F2\u304C\u5236\u9650\u3055\u308C\u3066\u3044\u307E\u3059"}),"[",o||"\u4E0B\u9650\u7121\u3057","] ~ [",h||"\u4E0A\u9650\u7121\u3057","]"]})})}return{ok:!w.filter(({type:D})=>D=="invalid").length,notice:w}},KeyDownEvent:e=>{let{val_era:a,restrict:I,event:o,val_status:h,set_status:E,val_focus:w,set_focus:l}=e,{key:r,shiftKey:_,ctrlKey:D,metaKey:t}=o,p=D||t,{selectionStart:m,selectionEnd:b}=o.target,{index:k,prevIndex:g}=w,{ranges:q,safeValue:Z}=h,F=q.length-1;if(M.isOneOf(r,"Tab","ArrowLeft","ArrowRight")){let u=0;if(r=="Tab"){let c=+!_*2-1;if(u=w.index+c,u<0||u>F)return}else{let c=r=="ArrowLeft"?-1:r=="ArrowRight"?1:0;p||m==0&&b==String(h.safeValue).length?u=c==1?F:0:u=Math.max(0,Math.min(k+c,F))}l(c=>v(i({},c),{index:u,prevIndex:k})),o.preventDefault()}if(M.isOneOf(r,"Backspace","ArrowUp","ArrowDown","0","1","2","3","4","5","6","7","8","9")){o.preventDefault();let u=k;u=Math.max(u,0),u=Math.min(u,F);let{type:c,from:X,length:G}=q[u],C=Z.slice(X,X+G),S;if(r=="Backspace")S="------".slice(0,G);else if(M.isOneOf(r,"ArrowUp","ArrowDown")){let P=r=="ArrowUp"?1:-1;C=C|0,S=C+P;let[T,s,x]=c=="locale.jp.warekiDate"?a=="year"?[0,2999,4]:a=="reiwa"?[1,2999,4]:a=="heisei"?[1,31,4]:a=="shouwa"?[1,64,4]:a=="taisho"?[1,15,4]:a=="meiji"?[1,45,4]:[0,0,0]:c=="minute"?[0,59,2]:c=="hour"?[0,23,2]:c=="date"?[1,31,2]:c=="week"?[1,53,2]:c=="month"?[1,12,2]:c=="year"?[0,2999,4]:[0,0,0];S>s?S=T:S<T&&(S=s),S=Number(S).zeroEmbed(x)}else if(M.isOneOf(r,"0","1","2","3","4","5","6","7","8","9")){let P=C|0,T=r,s=`${P}${T}`;if(g!=k&&(P=0,s="0"+T),c=="year"||c=="locale.jp.warekiDate"&&a=="year")Number(s)>1e4?S=T:S=s,(S|0)>1e3&&u++;else if(M.isOneOf(c,"hour","minute","date","week","month")||c=="locale.jp.warekiDate"&&a!="year"){let x=c=="locale.jp.warekiDate"?a=="reiwa"?100:a=="heisei"?31:a=="shouwa"?64:a=="taisho"?15:a=="meiji"?45:0:c=="minute"?59:c=="hour"?23:c=="date"?31:c=="week"?53:c=="month"?12:0;S=(s|0)>x?T:s,(Number(T)>Number(String(x)[0])||C=="0000".slice(0,String(x).length)&&(s!="0000".slice(0,String(x).length)||M.isOneOf(c,"minute","hour")&&g==k)||(s|0)>=re(10,String(x).length-1))&&u++}c=="year"||c=="locale.jp.warekiDate"?S=(S|0).zeroEmbed(4):S=(S|0).zeroEmbed(2)}{let P=String(Z).partReplace(X,String(S)),T=P.split(A).map(s=>s.replace(/(^\D|\D$)/,"").split(/\D+/).join(I.match(/clock/)&&":"||"/").replace(/(^\D|\D$)/,""));if(I=="locale.jp.warekiDate"){let s=T[0].split(/\D/),[x,d,R]=s;s.length==3&&x&&(T=[[Number(x)-1+Number({year:1,reiwa:2019,heisei:1989,shouwa:1926,taisho:1912,meiji:1868}[a]),d,R].join("/")])}u=Math.max(u,0),u=Math.min(u,F),E(s=>v(i({},s),{rawValue:I.startsWith("period.")?T:T[0],safeValue:P,eventType:"update",eventID:$(12),isInspected:!1})),l(s=>v(i({},s),{index:u,prevIndex:s.index}))}}},Shallow:e=>{let{rootStates:a,val_status:I}=e,[o]=de(a);return f(H,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",ssZIndex:3,opacity:"trans",xcss:{pointerEvents:"none"},children:f(he.Description,v(i({className:a.className},o),{position:"absolute",width:1,xcss:v(i({},o.xcss),{color:"orange"}),children:f(H,{"data-input-value-shallow":I.componentId,children:"A"})}))})}},xe=e=>{let te=e,{tone:a,required:I,restrict:o="clock",componentId:h,era:E,form:w,name:l,min:r,max:_,className:D,enableFormSubmit:t,showInitValidation:p,onKeyDown:m,periodPresets:b,onValidate:k,onValidateDelay:g,onUpdateValue:q,onUpdateValidValue:Z,onUserAction:F,value:u="",leftIndicator:c,rightIndicator:X,leftIcon:G,rightIcon:C,xcss:S,wrapStyles:P}=te,T=Q(te,["tone","required","restrict","componentId","era","form","name","min","max","className","enableFormSubmit","showInitValidation","onKeyDown","periodPresets","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","leftIndicator","rightIndicator","leftIcon","rightIcon","xcss","wrapStyles"]),[s,x]=B(E||"year"),[d,R]=B(()=>v(i({componentId:e.componentId||""},N.SyncValue({restrict:o,value:u,era:s})),{ranges:[],eventType:"init",eventID:$(12)})),[J,j]=B({active:!1,index:0,prevIndex:-1}),se={rootStates:e,val_status:d,set_status:R,val_era:s,set_era:x,val_focus:J,set_focus:j};Y.CommonEffects({type:"time",states:e,val_status:d,set_status:R,SystemValidation:N.SystemValidation,ExtraOverrideStates:n=>N.SyncValue({restrict:o,value:n,era:s})}),z(()=>{R(n=>v(i(i({},n),N.SyncValue({restrict:o,value:u,era:s})),{isInspected:!1}))},[]);const ee=me(!1);return z(()=>{if(ee.current){R(y=>v(i(i({},y),N.SyncValue({restrict:o,value:y.rawValue,era:s})),{isInspected:!1}));let n=W.get("refreshEra_"+d.componentId);n&&n.refreshEra(s)}else ee.current=!0},[s]),W.update({[d.componentId]:{openPicker:n=>{e.disabled||ne.picker.open({restrict:o,era:E,defaultValue:d.rawValue,min:r,max:_,periodPresets:e.periodPresets,onValueUpdate:y=>{y.eventType=="commit"&&(R(O=>v(i(i({},O),N.SyncValue({restrict:o,value:y.value,era:y.era})),{eventType:"update",eventID:$(12),isInspected:!1,isValidated:!1,notice:[]})),x(y.era))}})},resetEra:n=>{x(n),R(y=>v(i(i({},y),N.SyncValue({restrict:o,value:"",era:s})),{eventType:"update",eventID:$(12),isInspected:!1}))}}}),z(()=>{let{index:n,active:y}=J;if(y){n=Math.max(n,0),n=Math.min(n,d.ranges.length-1);let{from:O,length:L}=d.ranges[n],U=ue("#"+e.id)[0];U&&U.setSelectionRange&&U.setSelectionRange(O,O+L)}R(O=>v(i({},O),{isFocusing:y}))},[J]),le(ve,{val_status:d,set_status:R,states:e,children:[f(N.Shallow,i({},se)),f(De,{componentId:e.componentId,fontSize:e.fontSize,required:e.required,label:e.label,isActive:!0,val_status:d}),ie.get().isTouchDevice?f(oe.Plain,v(i({"data-show-validation":Y.isShowValidation(d,!!p),"data-component-id":d.componentId,"data-input-origin":d.componentId,"data-disabled":e.disabled,className:D,xcss:{textAlign:"left"}},T),{children:d.safeValue,onClick:n=>{let y=W.get(d.componentId);y&&y.openPicker(`[data-input-origin="${d.componentId}"]`),n.stopPropagation()},onFocus:()=>{j(n=>v(i({},n),{active:!0}))},onBlur:()=>{j(n=>v(i({},n),{active:!1}))}})):f(H,i({htmlTag:"input",type:"text",inputMode:"numeric","data-show-validation":Y.isShowValidation(d,!!p),"data-input-origin":d.componentId,"data-disabled":e.disabled,value:d.safeValue,className:D,tabIndex:ie.get().isTouchDevice?-1:0,onKeyDown:n=>{N.KeyDownEvent({restrict:o,event:n,val_era:s,val_status:d,set_status:R,val_focus:J,set_focus:j}),m&&m(n),t&&Y.SubmitForm(n,w)},onKeyUp:n=>{n.key=="Tab"&&j(y=>v(i({},y),{active:!0}))},onClick:n=>{let y=n.target.selectionEnd,O=0;d.ranges.forEach((L,U)=>{let{from:ae,length:ce,region:pe}=L;ae<=y&&y<=ae+(pe||ce)&&(O=U)}),j(L=>v(i({},L),{active:!0,index:O})),n.preventDefault()},onBlur:()=>{j(n=>v(i({},n),{active:!1}))},onChange:()=>{}},T))]})},V={Origin:e=>{let a=i({fontSize:"inherit",width:1,value:""},e);a.value=a.value||"";let[I]=B(e.componentId||$(12));if(a.componentId=I,M.isNullish(a.rightIcon)){let o=(e.restrict||"").match(/clock/)?ge:ye;a.rightIcon=f(we,{ssSphere:2.5,xcss:{pointerEvents:"all"},children:f(oe.Sub,{color:"cloud",border:"unset",ssSphere:2.5,fontColor:"theme",boxShadow:"0.normal",borderRadius:"3.tone.tertiary",flexCenter:!0,ssEffectsOnActive:"push",tabIndex:-1,id:"Picker-"+a.componentId,onClick:()=>{let h=W.get(a.componentId);h&&h.openPicker("#Picker-"+a.componentId)},children:f(fe,{icon:o})})})}return f(Ie,{componentId:a.componentId,children:xe,states:Se(a)})},Clock:e=>f(V.Origin,i({restrict:"clock",era:"clock"},e)),Date:e=>f(V.Origin,i({restrict:"date"},e)),Week:e=>f(V.Origin,i({restrict:"week"},e)),Month:e=>f(V.Origin,i({restrict:"month"},e)),Year:e=>f(V.Origin,i({restrict:"year"},e)),Locale:{JP:{WarekiDate:e=>{e=i({},e);let[a]=B(e.componentId||$(12));e.componentId=a;let w=e,{defaultEra:I="wareki"}=w,o=Q(w,["defaultEra"]),[h,E]=B((()=>{let l="year";if(I=="wareki"&&(l="reiwa",e.value)){let[r,_,D]=e.value.split(/\D/);if(r&&_&&D){let t=Number(r);t>=2019?(t-=2019,l="reiwa"):t>=1989?(t-=1989,l="heisei"):t>=1926?(t-=1926,l="shouwa"):t>=1912?(t-=1912,l="taisho"):t>=1868&&(t-=1868,l="meiji"),t+=1}}return l})());return z(()=>{W.set({["refreshEra_"+a]:{refreshEra:l=>{E(l)}}})},[]),f(V.Origin,v(i({restrict:"locale.jp.warekiDate",leftIndicator:f(Te,{label:"\u5143\u53F7",emptySelect:!1,value:h,tone:e.tone||"border",override:"force",flexCenter:!0,borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",height:1,xcss:{whiteSpace:"nowrap"},options:[{value:"year",label:"\u897F\u66A6"},{value:"reiwa",label:"\u4EE4\u548C"},{value:"heisei",label:"\u5E73\u6210"},{value:"shouwa",label:"\u662D\u548C"},{value:"taisho",label:"\u5927\u6B63"},{value:"meiji",label:"\u660E\u6CBB"}],onUpdateValidValue:l=>{E(l);let r=W.get(e.componentId);r&&r.resetEra&&r.resetEra(l)}})},o),{era:h}))}}},Periods:{Clock:e=>f(V.Origin,i({restrict:"period.clock",era:"clock"},e)),Date:e=>f(V.Origin,i({restrict:"period.date"},e)),Month:e=>f(V.Origin,i({restrict:"period.month"},e))}};export{V as Time,ne as TimeSelector,V as default};
1
+ import{a as re,b as i,c as v,d as Q}from"../../../chunk-C5N2D3ZX.js";import{Fragment as Ee,jsx as f,jsxs as le}from"react/jsx-runtime";import M,{UUID as $,useStore as W}from"jmini";import*as K from"jmini";import{useState as B,useEffect as z,useRef as me}from"react";import{$$fromRoot as ue,Config as ie,ExtractStyles as de}from"../../../@utils";import{Box as H,FAI as fe}from"../../../atoms";import{Literal as he}from"../../../mols";import{Button as oe}from"../../Trigger";import{faClock as ge}from"@fortawesome/free-solid-svg-icons/faClock";import{faCalendarAlt as ye}from"@fortawesome/free-solid-svg-icons/faCalendarAlt";import{OptionalInputWrapper as Ie,BoxWrapper as ve,CoreEffects as Y,DefaultBoxishStyles as Se}from"../core";import{RightIcon as we}from"..";import Te from"../Select";import{InputLabel as De}from"../Label";import{TimeSelector as ne}from"./Selector";const A=" ~ ",be={clock:{defaultValue:"--:--",format:/^\d{2}\D\d{2}$/,ranges:[{type:"hour",from:0,length:2},{type:"minute",from:3,length:2}],sets:1},date:{defaultValue:"----/--/--",format:/^\d{4}\D\d{2}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2},{type:"date",from:8,length:2}],sets:1},week:{defaultValue:"----\u5E74\u7B2C--\u9031",format:/^\d{4}\D\d{2}$/,ranges:[{type:"year",from:0,length:4,region:6},{type:"week",from:6,length:2,region:3}],sets:1},month:{defaultValue:"----\u5E74--\u6708",format:/^\d{4}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2,region:3}],sets:1},year:{defaultValue:"----\u5E74",format:/^\d{4}$/,ranges:[{type:"year",from:0,length:4,region:5}],sets:1},"period.clock":{defaultValue:"--:--",format:/^\d{2}\D\d{2}$/,ranges:[{type:"hour",from:0,length:2},{type:"minute",from:3,length:2},{type:"hour",from:5+A.length,length:2},{type:"minute",from:8+A.length,length:2}],sets:2},"period.date":{defaultValue:"----/--/--",format:/^\d{4}\D\d{2}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2},{type:"date",from:8,length:2,region:5},{type:"year",from:10+A.length,length:4},{type:"month",from:15+A.length,length:2},{type:"date",from:18+A.length,length:2}],sets:2},"period.month":{defaultValue:"----\u5E74--\u6708",format:/^\d{4}\D\d{2}$/,ranges:[{type:"year",from:0,length:4},{type:"month",from:5,length:2,region:6},{type:"year",from:8+A.length,length:4},{type:"month",from:13+A.length,length:2,region:3}],sets:2},"locale.jp.warekiDate":{defaultValue:"----\u5E74--\u6708--\u65E5",format:/^\d{4}\D\d{2}\D\d{2}$/,ranges:[{type:"locale.jp.warekiDate",from:0,length:4,region:5},{type:"month",from:5,length:2,region:3},{type:"date",from:8,length:2,region:3}],sets:1}},N={PeriodMargin:" ~ ",SyncValue:e=>{let{restrict:a,value:I,era:o}=e,h=M.Arrayify(I||""),{defaultValue:E,format:w,ranges:l,sets:r}=be[a],_=[],D=a.match(/clock/)?":":"/";for(let t=0;t<h.length;t++)h[t]=String(h[t]).replace(/\D/ig,D);for(let t=0;t<r;t++){let p=h[t]||"";if(!p.match(w))h[t]="",_.push(E);else{let m=E;p.split(/\D/).forEach((b,k)=>{if(k==0&&a=="locale.jp.warekiDate"){let g=Number(b);o!="year"&&(g>=2019?o=="reiwa"?g-=2018:o=="heisei"&&(g=31):g>=1989?o=="heisei"?g-=1988:o=="shouwa"&&(g=64):g>=1926?o=="shouwa"?g-=1925:o=="taisho"&&(g=15):g>=1912?o=="taisho"?g-=1911:o=="meiji"&&(g=45):g>=1868&&(g-=1867)),b=g.zeroEmbed(4)}m=m.replace(new RegExp("------------------".slice(0,b.length)),b)}),_.push(m)}}return{safeValue:_.join(A),rawValue:a.startsWith("period.")?h:h[0],ranges:l}},SystemValidation:e=>{let{states:a}=e,{restrict:I,min:o,max:h,required:E}=a,w=[],l=M.Arrayify(e.value),r={empty:!1,escalated:1,filled:!0,correct:!0,prohibited:!1};(()=>{let D=I.match(/clock/)?":":"/";for(let t=0;t<l.length;t++)l[t]=String(l[t]).replace(/\D/ig,D);for(let t=0;t<l.length;t++){let p=l[t],m=l[t-1];p.removeLetters()||(r.empty=!0),t>0&&(r.escalated&=+(p>=m))}r.escalated&&(r.empty||(I.match(/clock/)?l.forEach(t=>{let[p,m]=t.split(/\D+/);!p||!m?r.filled=!1:(Number(p)>23||Number(m)>59)&&(r.correct=!1)}):I.match(/date/)?l.forEach(t=>{let[p,m,b]=t.split(/\D+/);if(!p||!m||!b)r.filled=!1;else{let k=K.Time(t);(!k.validate||t!=k.toFormatYMD())&&(r.correct=!1)}}):I.match(/week/)?l.forEach(t=>{let[p,m]=t.split(/\D+/);if(!p||!m)r.filled=!1;else{let b=K.Time(p+"/01/01").weekday,g=K.Time(p+"/01/0"+(7-b+1)).addWeek(Number(m)-1);p!=String(g.year)&&(r.correct=!1)}}):I.match(/month/)?l.forEach(t=>{let[p,m]=t.split(/\D+/);!p||!m?r.filled=!1:K.Time([p,m,"01"].join("/")).validate||(r.correct=!1)}):I.match(/year/),r.filled&&r.correct&&l.forEach(t=>{{let p=Number(String(t).replace(/\D/ig,""));if(o&&Number(String(o).replace(/\D/ig,""))>p&&(r.prohibited=!0),h){let m=Number(String(h).replace(/\D/ig,""));p>m&&(r.prohibited=!0)}}})))})();{let{empty:D,escalated:t,filled:p,correct:m,prohibited:b}=r;D&&E&&(w=[{type:"invalid",label:"\u5FC5\u9808\u9805\u76EE\u3067\u3059"}]),t||w.push({type:"invalid",label:"\u6642\u7CFB\u5217\u3092\u6B63\u3057\u304F\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044"}),m||w.push({type:"invalid",label:"\u7121\u52B9\u306A\u5024\u304C\u5165\u529B\u3055\u308C\u3066\u3044\u307E\u3059"}),p||w.push({type:"invalid",label:"\u6700\u5F8C\u307E\u3067\u5024\u3092\u57CB\u3081\u3066\u304F\u3060\u3055\u3044"}),b&&w.push({type:"invalid",label:le(Ee,{children:[f(H,{children:"\u5165\u529B\u7BC4\u56F2\u304C\u5236\u9650\u3055\u308C\u3066\u3044\u307E\u3059"}),"[",o||"\u4E0B\u9650\u7121\u3057","] ~ [",h||"\u4E0A\u9650\u7121\u3057","]"]})})}return{ok:!w.filter(({type:D})=>D=="invalid").length,notice:w}},KeyDownEvent:e=>{let{val_era:a,restrict:I,event:o,val_status:h,set_status:E,val_focus:w,set_focus:l}=e,{key:r,shiftKey:_,ctrlKey:D,metaKey:t}=o,p=D||t,{selectionStart:m,selectionEnd:b}=o.target,{index:k,prevIndex:g}=w,{ranges:q,safeValue:Z}=h,F=q.length-1;if(M.isOneOf(r,"Tab","ArrowLeft","ArrowRight")){let u=0;if(r=="Tab"){let c=+!_*2-1;if(u=w.index+c,u<0||u>F)return}else{let c=r=="ArrowLeft"?-1:r=="ArrowRight"?1:0;p||m==0&&b==String(h.safeValue).length?u=c==1?F:0:u=Math.max(0,Math.min(k+c,F))}l(c=>v(i({},c),{index:u,prevIndex:k})),o.preventDefault()}if(M.isOneOf(r,"Backspace","ArrowUp","ArrowDown","0","1","2","3","4","5","6","7","8","9")){o.preventDefault();let u=k;u=Math.max(u,0),u=Math.min(u,F);let{type:c,from:X,length:G}=q[u],C=Z.slice(X,X+G),S;if(r=="Backspace")S="------".slice(0,G);else if(M.isOneOf(r,"ArrowUp","ArrowDown")){let P=r=="ArrowUp"?1:-1;C=C|0,S=C+P;let[T,s,x]=c=="locale.jp.warekiDate"?a=="year"?[0,2999,4]:a=="reiwa"?[1,2999,4]:a=="heisei"?[1,31,4]:a=="shouwa"?[1,64,4]:a=="taisho"?[1,15,4]:a=="meiji"?[1,45,4]:[0,0,0]:c=="minute"?[0,59,2]:c=="hour"?[0,23,2]:c=="date"?[1,31,2]:c=="week"?[1,53,2]:c=="month"?[1,12,2]:c=="year"?[0,2999,4]:[0,0,0];S>s?S=T:S<T&&(S=s),S=Number(S).zeroEmbed(x)}else if(M.isOneOf(r,"0","1","2","3","4","5","6","7","8","9")){let P=C|0,T=r,s=`${P}${T}`;if(g!=k&&(P=0,s="0"+T),c=="year"||c=="locale.jp.warekiDate"&&a=="year")Number(s)>1e4?S=T:S=s,(S|0)>1e3&&u++;else if(M.isOneOf(c,"hour","minute","date","week","month")||c=="locale.jp.warekiDate"&&a!="year"){let x=c=="locale.jp.warekiDate"?a=="reiwa"?100:a=="heisei"?31:a=="shouwa"?64:a=="taisho"?15:a=="meiji"?45:0:c=="minute"?59:c=="hour"?23:c=="date"?31:c=="week"?53:c=="month"?12:0;S=(s|0)>x?T:s,(Number(T)>Number(String(x)[0])||C=="0000".slice(0,String(x).length)&&(s!="0000".slice(0,String(x).length)||M.isOneOf(c,"minute","hour")&&g==k)||(s|0)>=re(10,String(x).length-1))&&u++}c=="year"||c=="locale.jp.warekiDate"?S=(S|0).zeroEmbed(4):S=(S|0).zeroEmbed(2)}{let P=String(Z).partReplace(X,String(S)),T=P.split(A).map(s=>s.replace(/(^\D|\D$)/,"").split(/\D+/).join(I.match(/clock/)&&":"||"/").replace(/(^\D|\D$)/,""));if(I=="locale.jp.warekiDate"){let s=T[0].split(/\D/),[x,d,R]=s;s.length==3&&x&&(T=[[Number(x)-1+Number({year:1,reiwa:2019,heisei:1989,shouwa:1926,taisho:1912,meiji:1868}[a]),d,R].join("/")])}u=Math.max(u,0),u=Math.min(u,F),E(s=>v(i({},s),{rawValue:I.startsWith("period.")?T:T[0],safeValue:P,eventType:"update",eventID:$(12),isInspected:!1})),l(s=>v(i({},s),{index:u,prevIndex:s.index}))}}},Shallow:e=>{let{rootStates:a,val_status:I}=e,[o]=de(a);return f(H,{position:"absolute",top:0,left:0,right:0,height:0,overflow:"hidden",ssZIndex:3,opacity:"trans",xcss:{pointerEvents:"none"},children:f(he.Description,v(i({className:a.className},o),{position:"absolute",width:1,xcss:v(i({},o.xcss),{color:"orange"}),children:f(H,{"data-input-value-shallow":I.componentId,children:"A"})}))})}},xe=e=>{let te=e,{tone:a,required:I,restrict:o="clock",componentId:h,era:E,form:w,name:l,min:r,max:_,className:D,enableFormSubmit:t,showInitValidation:p,onKeyDown:m,periodPresets:b,onValidate:k,onValidateDelay:g,onUpdateValue:q,onUpdateValidValue:Z,onUserAction:F,value:u="",leftIndicator:c,rightIndicator:X,leftIcon:G,rightIcon:C,xcss:S,wrapStyles:P}=te,T=Q(te,["tone","required","restrict","componentId","era","form","name","min","max","className","enableFormSubmit","showInitValidation","onKeyDown","periodPresets","onValidate","onValidateDelay","onUpdateValue","onUpdateValidValue","onUserAction","value","leftIndicator","rightIndicator","leftIcon","rightIcon","xcss","wrapStyles"]),[s,x]=B(E||"year"),[d,R]=B(()=>v(i({componentId:e.componentId||""},N.SyncValue({restrict:o,value:u,era:s})),{ranges:[],eventType:"init",eventID:$(12)})),[J,j]=B({active:!1,index:0,prevIndex:-1}),se={rootStates:e,val_status:d,set_status:R,val_era:s,set_era:x,val_focus:J,set_focus:j};Y.CommonEffects({type:"time",states:e,val_status:d,set_status:R,SystemValidation:N.SystemValidation,ExtraOverrideStates:n=>N.SyncValue({restrict:o,value:n,era:s})}),z(()=>{R(n=>v(i(i({},n),N.SyncValue({restrict:o,value:u,era:s})),{isInspected:!1}))},[]);const ee=me(!1);return z(()=>{if(ee.current){R(y=>v(i(i({},y),N.SyncValue({restrict:o,value:y.rawValue,era:s})),{isInspected:!1}));let n=W.get("refreshEra_"+d.componentId);n&&n.refreshEra(s)}else ee.current=!0},[s]),W.update({[d.componentId]:{openPicker:n=>{e.disabled||ne.picker.open({restrict:o,era:E,defaultValue:d.rawValue,min:r,max:_,periodPresets:e.periodPresets,onValueUpdate:y=>{y.eventType=="commit"&&(R(O=>v(i(i({},O),N.SyncValue({restrict:o,value:y.value,era:y.era})),{eventType:"update",eventID:$(12),isInspected:!1,isValidated:!1,notice:[]})),x(y.era))}})},resetEra:n=>{x(n),R(y=>v(i(i({},y),N.SyncValue({restrict:o,value:"",era:s})),{eventType:"update",eventID:$(12),isInspected:!1}))}}}),z(()=>{let{index:n,active:y}=J;if(y){n=Math.max(n,0),n=Math.min(n,d.ranges.length-1);let{from:O,length:L}=d.ranges[n],U=ue("#"+e.id)[0];U&&U.setSelectionRange&&U.setSelectionRange(O,O+L)}R(O=>v(i({},O),{isFocusing:y}))},[J]),le(ve,{val_status:d,set_status:R,states:e,children:[f(N.Shallow,i({},se)),f(De,{componentId:e.componentId,fontSize:e.fontSize,required:e.required,label:e.label,isActive:!0,val_status:d}),ie.get().isTouchDevice?f(oe.Plain,v(i({"data-show-validation":Y.isShowValidation(d,!!p),"data-component-id":d.componentId,"data-input-origin":d.componentId,"data-disabled":e.disabled,className:D,xcss:{textAlign:"left"}},T),{children:d.safeValue,onClick:n=>{let y=W.get(d.componentId);y&&y.openPicker(`[data-input-origin="${d.componentId}"]`),n.stopPropagation()},onFocus:()=>{j(n=>v(i({},n),{active:!0}))},onBlur:()=>{j(n=>v(i({},n),{active:!1}))}})):f(H,i({htmlTag:"input",type:"text",inputMode:"numeric","data-show-validation":Y.isShowValidation(d,!!p),"data-input-origin":d.componentId,"data-disabled":e.disabled,value:d.safeValue,className:D,tabIndex:ie.get().isTouchDevice?-1:0,onKeyDown:n=>{N.KeyDownEvent({restrict:o,event:n,val_era:s,val_status:d,set_status:R,val_focus:J,set_focus:j}),m&&m(n),t&&Y.SubmitForm(n,w)},onKeyUp:n=>{n.key=="Tab"&&j(y=>v(i({},y),{active:!0}))},onClick:n=>{let y=n.target.selectionEnd,O=0;d.ranges.forEach((L,U)=>{let{from:ae,length:ce,region:pe}=L;ae<=y&&y<=ae+(pe||ce)&&(O=U)}),j(L=>v(i({},L),{active:!0,index:O})),n.preventDefault()},onBlur:()=>{j(n=>v(i({},n),{active:!1}))},onChange:()=>{}},T))]})},V={Origin:e=>{let a=i({fontSize:"inherit",width:1,value:""},e);a.value=a.value||"";let[I]=B(e.componentId||$(12));if(a.componentId=I,M.isNullish(a.rightIcon)){let o=(e.restrict||"").match(/clock/)?ge:ye;a.rightIcon=f(we,{ssSphere:2.5,xcss:{pointerEvents:"all"},children:f(oe.Sub,{color:"cloud",border:"unset",ssSphere:2.5,fontColor:"theme",boxShadow:"0.normal",borderRadius:"3.tone.tertiary",flexCenter:!0,ssEffectsOnActive:"push",tabIndex:-1,id:"Picker-"+a.componentId,onClick:()=>{let h=W.get(a.componentId);h&&h.openPicker("#Picker-"+a.componentId)},children:f(fe,{icon:o})})})}return f(Ie,{componentId:a.componentId,children:xe,states:Se(a)})},Clock:e=>f(V.Origin,i({restrict:"clock",era:"clock"},e)),Date:e=>f(V.Origin,i({restrict:"date"},e)),Week:e=>f(V.Origin,i({restrict:"week"},e)),Month:e=>f(V.Origin,i({restrict:"month"},e)),Year:e=>f(V.Origin,i({restrict:"year"},e)),Locale:{JP:{WarekiDate:e=>{e=i({},e);let[a]=B(e.componentId||$(12));e.componentId=a;let w=e,{defaultEra:I="wareki"}=w,o=Q(w,["defaultEra"]),[h,E]=B((()=>{let l="year";if(I=="wareki"&&(l="reiwa",e.value)){let[r,_,D]=e.value.split(/\D/);if(r&&_&&D){let t=Number(r);t>=2019?(t-=2019,l="reiwa"):t>=1989?(t-=1989,l="heisei"):t>=1926?(t-=1926,l="shouwa"):t>=1912?(t-=1912,l="taisho"):t>=1868&&(t-=1868,l="meiji"),t+=1}}return l})());return z(()=>{W.set({["refreshEra_"+a]:{refreshEra:l=>{E(l)}}})},[]),f(V.Origin,v(i({restrict:"locale.jp.warekiDate",leftIndicator:f(Te,{label:"\u5143\u53F7",emptySelect:!1,value:h,tone:e.tone||"border",override:"force",flexCenter:!0,borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",height:1,xcss:{whiteSpace:"nowrap"},options:[{value:"year",label:"\u897F\u66A6"},{value:"reiwa",label:"\u4EE4\u548C"},{value:"heisei",label:"\u5E73\u6210"},{value:"shouwa",label:"\u662D\u548C"},{value:"taisho",label:"\u5927\u6B63"},{value:"meiji",label:"\u660E\u6CBB"}],onUpdateValidValue:l=>{E(l);let r=W.get(e.componentId);r&&r.resetEra&&r.resetEra(l)}})},o),{era:h}))}}},Periods:{Clock:e=>f(V.Origin,i({restrict:"period.clock",era:"clock"},e)),Date:e=>f(V.Origin,i({restrict:"period.date"},e)),Month:e=>f(V.Origin,i({restrict:"period.month"},e))}};export{V as Time,ne as TimeSelector,V as default};
@@ -1 +1 @@
1
- import{b as i,c as l,e as T}from"../../chunk-C5N2D3ZX.js";import{jsx as y,jsxs as h}from"react/jsx-runtime";import{useState as w,useEffect as S}from"react";import u,{UUID as m,useStore as v}from"jmini";import{$$fromRoot as k}from"../../@utils";import{InputClasses as b}from"../../@styles/componentClasses";import{Box as E,Flex as B,FAI as g,Column as D}from"../../atoms";import{Row as _,Literal as O}from"../../mols";import{Button as A}from"../Button";import V from"../Tooltips";const te=e=>{let[n]=w(e.componentId||m(12));e=i({},e),e.states=l(i({enableFormSubmit:!0,status_id:m(8),override:"never",form:"",id:m(),"aria-label":"Input-"+n},e.states),{componentId:n});let{children:a}=e;return y(a,i({},e.states))},ae=e=>{let{children:n,val_status:a,states:t}=e,{leftIcon:s,wrapStyles:f}=t,r=a.notice||[];return t.showInitValidation||a.eventType=="init"&&(r=[]),h(_.Center,l(i({position:"relative",verticalAlign:"unset",gap:0},f),{className:b("Wrapper"),"data-notice-uid":a.componentId,children:[y(C.Notice,{notice:r,val_status:a}),t.leftIndicator,h(B,{position:"relative",flexSizing:"auto",children:[n,s,y(C.RightIcon,i({},e)),y(C.ClearButton,i({},e))]}),t.rightIndicator]}))},C={ClearButton:e=>!e.states.clearButton||!e.val_status.rawValue?null:y(A.Normal,{ssSphere:2,flexCenter:!0,fontColor:"5.translucent",ssEffectsOnActive:["ripple.theme"],position:"absolute",ssZIndex:3,right:"2/3",top:"50%",xcss:{transform:"translateY(-50%)"},onClick:()=>{e.set_status(n=>l(i({},n),{rawValue:"",safeValue:"",eventType:"update",eventID:m(12),isInspected:!1}))},children:y(g.X,{})}),RightIcon:e=>e.states.clearButton&&e.val_status.rawValue?null:e.states.rightIcon,Notice:e=>{let{notice:n,val_status:a}=e,{componentId:t}=a,s="NoticeTimer-"+t,f="NoticeTimerClose-"+t,r="notice-tips-"+t;return S(()=>{u.interval.once(()=>{if(!(n!=null&&n.length)){V.close(r);return}V.open({tipsID:r,parent:`[data-notice-uid="${t}"]`,gravityPoint:24,padding:[1,0],closeAtParentBlur:!1,content:h(V.Body,{padding:["1/2","2/3"],fontSize:"1.mini",position:"relative",children:[y(E,{position:"absolute",unitHeight:1,unitWidth:1,right:1,backgroundColor:"dark",ssZIndex:1,xcss:{transform:"rotate(45deg)",top:-6}}),y(D,{backgroundColor:"inherit",gap:"1/3",ssZIndex:2,children:n.map((d,p)=>{let{type:o,label:c}=d,I=o=="invalid"?g.Exclamation:o=="warn"?g.Exclamation:g.Check;return h(_.Left,{gap:0,borderRadius:"2.tone.secondary",children:[y(I,{flexCenter:!0,fontSize:"2.normal",fontColor:{invalid:"nega",warn:"warn",valid:"posi"}[o]}),y(O.Micro,{fontColor:"white",children:c})]},p+"-"+u.Stringify(d))})})]})})},350,s),u.interval.once(()=>{V.close(r)},6e3,f)},[n]),null}},F={DefaultStatus:(e,n)=>({componentId:e,rawValue:n,eventType:"init",eventID:m(12)}),CommonEffects:function(e){let{type:n,states:a,val_status:t,set_status:s,SystemValidation:f}=e;a=i({},a);let{componentId:r}=t;S(()=>(v.update({[`input_alias:id:${a.id}`]:{componentId:r},[`input_alias:name:${a.name}`]:{componentId:r},[r]:{ResolveRefresh:null,remoteUpdate:d=>{s(p=>l(i({},p),{isInspected:!1,isValidated:!1,rawValue:d,status_id:m(8),eventType:"update.remote",eventID:m(12)}))},Refresh:()=>new Promise((d,p)=>{v.get(r).ResolveRefresh=d,s(o=>l(i({},o),{isInspected:!1,eventType:"refresh",eventID:m(12)}))})}}),()=>{v.delete(r)}),[]),S(()=>{F.ValidationCheck({val_status:t,set_status:s,SystemValidation:f,states:a})},[t.eventID,t.rawValue]),u.scope(()=>{let{override:d}=a;if(t.eventType=="update.remote"){s(R=>l(i(i({},R),e.ExtraOverrideStates&&e.ExtraOverrideStates(t.rawValue)),{eventType:"override",eventID:m(12),isInspected:!1,isValidated:!1}));return}if(d=="never"||d=="beforeModified"&&!u.isOneOf(t.eventType,"init","override")||t.isComposing)return;let p=v.get(t.componentId);if(!p)return;let o=a.value,c=t.rawValue;if(e.ExtraOverrideStates&&(o=e.ExtraOverrideStates(o).rawValue||o),u.isEqual(o,c)){p.status_id=a.status_id;return}let I=u.SortifyObject(o),x=u.SortifyObject(c);if(I&&x&&u.isEqual(I,x)){p.status_id=a.status_id;return}a.status_id!=p.status_id&&(t.eventType=="update"&&!t.isInspected||s(R=>l(i(l(i({},R),{rawValue:o}),e.ExtraOverrideStates&&e.ExtraOverrideStates(o)),{eventType:"override",eventID:m(12),isInspected:!1,isValidated:!1})))});{let{componentId:d,eventType:p}=t,o={eventType:p,componentId:d,isInspected:!!t.isInspected,isValidated:!!t.isValidated,isComposing:!!t.isComposing,isFocusing:!!t.isFocusing,isPickerOpen:!!t.isPickerOpen},c=t.rawValue;n=="autocomplete.single"?c=u.Arrayify(c)[0]:n=="list.radio"?c=u.Arrayify(c)[0]:a.isChecker&&(c=!!u.Arrayify(c)[0]),S(()=>(u.scope(()=>{if(a.form=a.form||"testForm",a.name&&a.form&&v.update({[["form-data",a.form].join("-")]:{[a.name]:{componentId:d,type:n,value:c,validation:t.isValidated}}}),!t.isInspected||p!="refresh")return;let I=v.get(d);I&&I.ResolveRefresh&&I.ResolveRefresh(null)}),()=>{v.update({[["form-data",a.form].join("-")]:{[a.name]:null}})}),[t]),S(()=>{a.onUserAction&&a.onUserAction(c,o)},[t]),S(()=>{t.isInspected&&p=="update"&&(a.onUpdateValue&&a.onUpdateValue(c,o),t.isValidated&&a.onUpdateValidValue&&a.onUpdateValidValue(c,o))},[t.isValidated,t.isInspected,t.rawValue])}},ValidationCheck:e=>{let{states:n}=e;if(e.val_status.isInspected)return;let a="ValidationTimer-"+e.val_status.componentId;u.interval.abort(a),e.set_status(r=>l(i({},r),{isInspected:!1,isValidated:!1}));let t=e.SystemValidation({value:e.val_status.rawValue,states:n});if(!t.ok){e.set_status(r=>l(i({},r),{isInspected:!0,isValidated:!!t.ok,notice:t.notice||[]}));return}let s=t.notice||[];const f=()=>T(void 0,null,function*(){if(!n.onValidate)return;let r=yield n.onValidate(e.val_status.rawValue,e.val_status.eventType,e.val_status);e.set_status(d=>l(i({},d),{isInspected:!0,isValidated:!!r.ok,notice:[...s,...r.notice||[]]}))});if(n.onValidate){if(e.val_status.eventType=="refresh"){f();return}u.interval.once(f,n.onValidateDelay||400,a);return}e.set_status(r=>l(i({},r),{eventID:m(12),isInspected:!0,isValidated:!0,notice:s}))},SubmitForm:(e,n)=>{let a=!1;if(!n)return a;let t=k(`[data-form-submit-button="${n}"]`)[0];if(!t)return a;let s=t.dataset.sdfike||"",f=e.key,r=e.ctrlKey||e.metaKey;return u.scope(()=>{s.includes("enter")&&(f!="Enter"||e.nativeEvent.isComposing||(e==null?void 0:e.keyCode)==229)||((f=="Enter"&&(s.includes("enter")||s.includes("auxEnter")&&r)||f==" "&&s.includes("space"))&&(t.click(),e.preventDefault()),a=!0)}),a},isShowValidation:(e,n)=>{let a=e.isValidated;return!n&&e.eventType=="init"?!0:a}},ne=function(e){e=i({tone:"border"},e);let n=u.scope(()=>{if(e.tone=="plain")return{};let t={padding:1,transition:"long",flexSizing:"auto",boxShadow:"0.min"};return e.tone=="border"?t=l(i({},t),{border:!0,borderRadius:"2.tone.secondary",backgroundColor:"layer.1"}):e.tone=="cloud"?t=l(i({},t),{border:"1.thin",borderRadius:"2.tone.secondary",backgroundColor:"cloud"}):e.tone=="bottomBorder"&&(t=l(i({},t),{borderRadius:0,border:"unset",borderBottom:!0,backgroundColor:"cloud"})),t});return l(i(i(i(i(i(i({fontColor:"2.normal"},n),!!e.rightIcon&&{paddingRight:3}),!!e.leftIcon&&{paddingLeft:3}),!!e.leftIndicator&&{borderTopLeftRadius:"2/3",borderBottomLeftRadius:"2/3",marginLeft:"1/4"}),!!e.rightIndicator&&{borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",marginRight:"1/4"}),e),{xcss:i({letterSpacing:"1px",resize:"none"},e.xcss),className:[b("Input"),e.className].join(" ")})};export{ae as BoxWrapper,F as CoreEffects,ne as DefaultBoxishStyles,te as OptionalInputWrapper};
1
+ import{b as i,c as l,e as T}from"../../chunk-C5N2D3ZX.js";import{jsx as y,jsxs as h}from"react/jsx-runtime";import{useState as w,useEffect as S}from"react";import u,{UUID as m,useStore as v}from"jmini";import{$$fromRoot as k}from"../../@utils";import{InputClasses as b}from"../../@styles/componentClasses";import{Box as E,Flex as B,FAI as g,Column as D}from"../../atoms";import{Row as _,Literal as O}from"../../mols";import{Button as A}from"../Trigger";import V from"../Tooltips";const te=e=>{let[n]=w(e.componentId||m(12));e=i({},e),e.states=l(i({enableFormSubmit:!0,status_id:m(8),override:"never",form:"",id:m(),"aria-label":"Input-"+n},e.states),{componentId:n});let{children:a}=e;return y(a,i({},e.states))},ae=e=>{let{children:n,val_status:a,states:t}=e,{leftIcon:s,wrapStyles:f}=t,r=a.notice||[];return t.showInitValidation||a.eventType=="init"&&(r=[]),h(_.Center,l(i({position:"relative",verticalAlign:"unset",gap:0},f),{className:b("Wrapper"),"data-notice-uid":a.componentId,children:[y(C.Notice,{notice:r,val_status:a}),t.leftIndicator,h(B,{position:"relative",flexSizing:"auto",children:[n,s,y(C.RightIcon,i({},e)),y(C.ClearButton,i({},e))]}),t.rightIndicator]}))},C={ClearButton:e=>!e.states.clearButton||!e.val_status.rawValue?null:y(A.Normal,{ssSphere:2,flexCenter:!0,fontColor:"5.translucent",ssEffectsOnActive:["ripple.theme"],position:"absolute",ssZIndex:3,right:"2/3",top:"50%",xcss:{transform:"translateY(-50%)"},onClick:()=>{e.set_status(n=>l(i({},n),{rawValue:"",safeValue:"",eventType:"update",eventID:m(12),isInspected:!1}))},children:y(g.X,{})}),RightIcon:e=>e.states.clearButton&&e.val_status.rawValue?null:e.states.rightIcon,Notice:e=>{let{notice:n,val_status:a}=e,{componentId:t}=a,s="NoticeTimer-"+t,f="NoticeTimerClose-"+t,r="notice-tips-"+t;return S(()=>{u.interval.once(()=>{if(!(n!=null&&n.length)){V.close(r);return}V.open({tipsID:r,parent:`[data-notice-uid="${t}"]`,gravityPoint:24,padding:[1,0],closeAtParentBlur:!1,content:h(V.Body,{padding:["1/2","2/3"],fontSize:"1.mini",position:"relative",children:[y(E,{position:"absolute",unitHeight:1,unitWidth:1,right:1,backgroundColor:"dark",ssZIndex:1,xcss:{transform:"rotate(45deg)",top:-6}}),y(D,{backgroundColor:"inherit",gap:"1/3",ssZIndex:2,children:n.map((d,p)=>{let{type:o,label:c}=d,I=o=="invalid"?g.Exclamation:o=="warn"?g.Exclamation:g.Check;return h(_.Left,{gap:0,borderRadius:"2.tone.secondary",children:[y(I,{flexCenter:!0,fontSize:"2.normal",fontColor:{invalid:"nega",warn:"warn",valid:"posi"}[o]}),y(O.Micro,{fontColor:"white",children:c})]},p+"-"+u.Stringify(d))})})]})})},350,s),u.interval.once(()=>{V.close(r)},6e3,f)},[n]),null}},F={DefaultStatus:(e,n)=>({componentId:e,rawValue:n,eventType:"init",eventID:m(12)}),CommonEffects:function(e){let{type:n,states:a,val_status:t,set_status:s,SystemValidation:f}=e;a=i({},a);let{componentId:r}=t;S(()=>(v.update({[`input_alias:id:${a.id}`]:{componentId:r},[`input_alias:name:${a.name}`]:{componentId:r},[r]:{ResolveRefresh:null,remoteUpdate:d=>{s(p=>l(i({},p),{isInspected:!1,isValidated:!1,rawValue:d,status_id:m(8),eventType:"update.remote",eventID:m(12)}))},Refresh:()=>new Promise((d,p)=>{v.get(r).ResolveRefresh=d,s(o=>l(i({},o),{isInspected:!1,eventType:"refresh",eventID:m(12)}))})}}),()=>{v.delete(r)}),[]),S(()=>{F.ValidationCheck({val_status:t,set_status:s,SystemValidation:f,states:a})},[t.eventID,t.rawValue]),u.scope(()=>{let{override:d}=a;if(t.eventType=="update.remote"){s(R=>l(i(i({},R),e.ExtraOverrideStates&&e.ExtraOverrideStates(t.rawValue)),{eventType:"override",eventID:m(12),isInspected:!1,isValidated:!1}));return}if(d=="never"||d=="beforeModified"&&!u.isOneOf(t.eventType,"init","override")||t.isComposing)return;let p=v.get(t.componentId);if(!p)return;let o=a.value,c=t.rawValue;if(e.ExtraOverrideStates&&(o=e.ExtraOverrideStates(o).rawValue||o),u.isEqual(o,c)){p.status_id=a.status_id;return}let I=u.SortifyObject(o),x=u.SortifyObject(c);if(I&&x&&u.isEqual(I,x)){p.status_id=a.status_id;return}a.status_id!=p.status_id&&(t.eventType=="update"&&!t.isInspected||s(R=>l(i(l(i({},R),{rawValue:o}),e.ExtraOverrideStates&&e.ExtraOverrideStates(o)),{eventType:"override",eventID:m(12),isInspected:!1,isValidated:!1})))});{let{componentId:d,eventType:p}=t,o={eventType:p,componentId:d,isInspected:!!t.isInspected,isValidated:!!t.isValidated,isComposing:!!t.isComposing,isFocusing:!!t.isFocusing,isPickerOpen:!!t.isPickerOpen},c=t.rawValue;n=="autocomplete.single"?c=u.Arrayify(c)[0]:n=="list.radio"?c=u.Arrayify(c)[0]:a.isChecker&&(c=!!u.Arrayify(c)[0]),S(()=>(u.scope(()=>{if(a.form=a.form||"testForm",a.name&&a.form&&v.update({[["form-data",a.form].join("-")]:{[a.name]:{componentId:d,type:n,value:c,validation:t.isValidated}}}),!t.isInspected||p!="refresh")return;let I=v.get(d);I&&I.ResolveRefresh&&I.ResolveRefresh(null)}),()=>{v.update({[["form-data",a.form].join("-")]:{[a.name]:null}})}),[t]),S(()=>{a.onUserAction&&a.onUserAction(c,o)},[t]),S(()=>{t.isInspected&&p=="update"&&(a.onUpdateValue&&a.onUpdateValue(c,o),t.isValidated&&a.onUpdateValidValue&&a.onUpdateValidValue(c,o))},[t.isValidated,t.isInspected,t.rawValue])}},ValidationCheck:e=>{let{states:n}=e;if(e.val_status.isInspected)return;let a="ValidationTimer-"+e.val_status.componentId;u.interval.abort(a),e.set_status(r=>l(i({},r),{isInspected:!1,isValidated:!1}));let t=e.SystemValidation({value:e.val_status.rawValue,states:n});if(!t.ok){e.set_status(r=>l(i({},r),{isInspected:!0,isValidated:!!t.ok,notice:t.notice||[]}));return}let s=t.notice||[];const f=()=>T(void 0,null,function*(){if(!n.onValidate)return;let r=yield n.onValidate(e.val_status.rawValue,e.val_status.eventType,e.val_status);e.set_status(d=>l(i({},d),{isInspected:!0,isValidated:!!r.ok,notice:[...s,...r.notice||[]]}))});if(n.onValidate){if(e.val_status.eventType=="refresh"){f();return}u.interval.once(f,n.onValidateDelay||400,a);return}e.set_status(r=>l(i({},r),{eventID:m(12),isInspected:!0,isValidated:!0,notice:s}))},SubmitForm:(e,n)=>{let a=!1;if(!n)return a;let t=k(`[data-form-submit-button="${n}"]`)[0];if(!t)return a;let s=t.dataset.sdfike||"",f=e.key,r=e.ctrlKey||e.metaKey;return u.scope(()=>{s.includes("enter")&&(f!="Enter"||e.nativeEvent.isComposing||(e==null?void 0:e.keyCode)==229)||((f=="Enter"&&(s.includes("enter")||s.includes("auxEnter")&&r)||f==" "&&s.includes("space"))&&(t.click(),e.preventDefault()),a=!0)}),a},isShowValidation:(e,n)=>{let a=e.isValidated;return!n&&e.eventType=="init"?!0:a}},ne=function(e){e=i({tone:"border"},e);let n=u.scope(()=>{if(e.tone=="plain")return{};let t={padding:1,transition:"long",flexSizing:"auto",boxShadow:"0.min"};return e.tone=="border"?t=l(i({},t),{border:!0,borderRadius:"2.tone.secondary",backgroundColor:"layer.1"}):e.tone=="cloud"?t=l(i({},t),{border:"1.thin",borderRadius:"2.tone.secondary",backgroundColor:"cloud"}):e.tone=="bottomBorder"&&(t=l(i({},t),{borderRadius:0,border:"unset",borderBottom:!0,backgroundColor:"cloud"})),t});return l(i(i(i(i(i(i({fontColor:"2.normal"},n),!!e.rightIcon&&{paddingRight:3}),!!e.leftIcon&&{paddingLeft:3}),!!e.leftIndicator&&{borderTopLeftRadius:"2/3",borderBottomLeftRadius:"2/3",marginLeft:"1/4"}),!!e.rightIndicator&&{borderTopRightRadius:"2/3",borderBottomRightRadius:"2/3",marginRight:"1/4"}),e),{xcss:i({letterSpacing:"1px",resize:"none"},e.xcss),className:[b("Input"),e.className].join(" ")})};export{ae as BoxWrapper,F as CoreEffects,ne as DefaultBoxishStyles,te as OptionalInputWrapper};
@@ -1 +1 @@
1
- import"../chunk-C5N2D3ZX.js";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{Box as t,FAI as d,Column as a}from"../atoms";import{Row as m,Literal as e}from"../mols";import{Anchor as i}from"./Button";const l=()=>{let{href:n}=location;return o(m.Center,{padding:[4,1],children:r(a,{ssCardBox:!0,gap:2,padding:[3,2],textAlign:"center",width:1,xcss:{maxWidth:12*30},children:[o(d.LinkSlash,{fontColor:"theme",xcss:{fontSize:"3rem"}}),r(t,{children:[o(e.Paragraph,{children:"\u3053\u306E\u30DA\u30FC\u30B8\u306F\u3054\u5229\u7528\u3044\u305F\u3060\u3051\u307E\u305B\u3093\u3002"}),o(e.Mini,{fontColor:"3.blur",children:"\u5165\u529B\u3055\u308C\u305F\u30EA\u30F3\u30AF\u306E\u30DA\u30FC\u30B8\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002"})]}),r(a,{children:[r(e,{textAlign:"left",ssCardBox:"cloud",isSemiBoldFont:!0,padding:1,children:["\u30FB\u30EA\u30F3\u30AF\u304C\u6B63\u3057\u3044\u304B",o(t,{margin:["1/2",0],borderBottom:!0}),"\u30FB\u30EA\u30F3\u30AF\u306E\u6709\u52B9\u671F\u9650",o(t,{margin:["1/2",0],borderBottom:!0}),"\u30FB\u30A2\u30AF\u30BB\u30B9\u6A29\u9650\u7B49\u304C\u6B63\u3057\u3044\u304B"]}),"\u306A\u3069\u3092\u3082\u3046\u4E00\u5EA6\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"]}),o(i.Link,{newTab:!0,href:n,children:n}),o(i.BorderToFill,{href:"/",width:1,children:"\u30DB\u30FC\u30E0\u306B\u623B\u308B"})]})})};export{l as PageNotFound,l as default};
1
+ import"../chunk-C5N2D3ZX.js";import{jsx as o,jsxs as r}from"react/jsx-runtime";import{Box as t,FAI as d,Column as a}from"../atoms";import{Row as m,Literal as e}from"../mols";import{Anchor as i}from"./Trigger";const l=()=>{let{href:n}=location;return o(m.Center,{padding:[4,1],children:r(a,{ssCardBox:!0,gap:2,padding:[3,2],textAlign:"center",width:1,xcss:{maxWidth:12*30},children:[o(d.LinkSlash,{fontColor:"theme",xcss:{fontSize:"3rem"}}),r(t,{children:[o(e.Paragraph,{children:"\u3053\u306E\u30DA\u30FC\u30B8\u306F\u3054\u5229\u7528\u3044\u305F\u3060\u3051\u307E\u305B\u3093\u3002"}),o(e.Mini,{fontColor:"3.blur",children:"\u5165\u529B\u3055\u308C\u305F\u30EA\u30F3\u30AF\u306E\u30DA\u30FC\u30B8\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3067\u3057\u305F\u3002"})]}),r(a,{children:[r(e,{textAlign:"left",ssCardBox:"cloud",isSemiBoldFont:!0,padding:1,children:["\u30FB\u30EA\u30F3\u30AF\u304C\u6B63\u3057\u3044\u304B",o(t,{margin:["1/2",0],borderBottom:!0}),"\u30FB\u30EA\u30F3\u30AF\u306E\u6709\u52B9\u671F\u9650",o(t,{margin:["1/2",0],borderBottom:!0}),"\u30FB\u30A2\u30AF\u30BB\u30B9\u6A29\u9650\u7B49\u304C\u6B63\u3057\u3044\u304B"]}),"\u306A\u3069\u3092\u3082\u3046\u4E00\u5EA6\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"]}),o(i.Link,{newTab:!0,href:n,children:n}),o(i.BorderToFill,{href:"/",width:1,children:"\u30DB\u30FC\u30E0\u306B\u623B\u308B"})]})})};export{l as PageNotFound,l as default};
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { StyleProps, ReactElement } from '../@declares';
3
3
  import { Box, Flex } from '../atoms';
4
- import { Button, ButtonTypes } from './Button';
4
+ import { Trigger } from './Trigger';
5
5
  declare namespace RootViewController {
6
6
  type Methods = {
7
7
  Base: React.FC<RootViewController.Base>;
@@ -37,7 +37,7 @@ declare namespace RootViewController {
37
37
  rightNav?: ReactElement;
38
38
  footerNav?: ReactElement;
39
39
  };
40
- type Button = Button.Input<ButtonTypes.ClearColors> & {
40
+ type Button = Trigger.Button.Input<Trigger.ClearColors> & {
41
41
  path?: string;
42
42
  pathGroup?: (string | RegExp) | (string | RegExp)[];
43
43
  };
@@ -1 +1 @@
1
- import{b as f,c as m,d as N}from"../chunk-C5N2D3ZX.js";import{jsx as d,jsxs as A}from"react/jsx-runtime";import{useEffect as b}from"react";import t from"jmini";import{$$fromRoot as C,pageRouter as F}from"../@utils";import{Box as y,Flex as x,Column as W}from"../atoms";import{Button as _}from"./Button";import{LayoutClasses as w}from"../@styles/componentClasses";const e={Base:o=>{let v=o,{topNavigation:r,sideNavigation:a,footerNavigation:g,topNav:s,leftNav:h,rightNav:l,footerNav:u,children:p,className:i}=v,n=N(v,["topNavigation","sideNavigation","footerNavigation","topNav","leftNav","rightNav","footerNav","children","className"]);return b(()=>{e.fn.refresh();let c="ResizeCB";return t(window).onEvent("resize",()=>{t.interval.once(()=>{e.fn.refresh()},300,"__RVC_calcHeights")},{eventID:c}),()=>{t(window).removeEvent(c)}},[]),A(W,m(f({className:[i,w("RootViewController")].join(" "),backgroundColor:"layer.1",gap:0,minHeight:"viewHeight"},n),{children:[s||r,A(x,{flexWrap:!1,position:"relative",flexSizing:0,children:[h||a,d(y,{className:w("Content"),position:"relative",flexSizing:0,width:0,ssZIndex:2,children:p}),l]}),u||g]}))},TopNav:o=>d(x,m(f({flexSizing:"none",flexType:"col",position:"sticky",top:0,backgroundColor:"layer.1",ssZIndex:5},o),{id:"__RVC_TopNavigation"})),SideNav:o=>d(y,m(f({flexSizing:"none",minHeight:"sideNavigationHeight",ssZIndex:3},o),{id:"__RVC_SideNavigation"})),FooterNav:o=>{let g=o,{baseStyles:r}=g,a=N(g,["baseStyles"]);return d(x,m(f({borderTop:!0,position:"sticky",bottom:0,overflow:"auto",backgroundColor:"layer.1",paddingBottom:"safeAreaBottom",ssZIndex:4},r),{id:"__RVC_FooterNavigation",children:d(x,f({gap:1,flexWrap:!1,padding:"2/3",margin:"auto",width:1},a))}))},Comps:{Button:o=>{let p=o,{isActive:r,path:a,pathGroup:g,currentPath:s}=p,h=N(p,["isActive","path","pathGroup","currentPath"]),l=t.Arrayify(g),u=s||location.pathname;{let i=!1;t.scope(()=>{t.isString(a)&&(t.isNullish(a)||(i=u.replace(/^\//,"").replace(/\/$/,"")==a.replace(/^\//,"").replace(/\/$/,"")))}),t.scope(()=>{if(!i&&l.length)for(let n of l){if(i)break;t.isNullish(n)||(t.isString(n)&&(n=String(n).escapeRegExChar()),u.match(new RegExp(n))&&(i=!0))}}),r=r!=null?r:i}return d(_.Clear,f({isActive:r,isActiveStyles:{fontColor:"theme",backgroundColor:"cloud"},onClick:i=>{t.isExist(a)&&t.isString(a)&&F.push(a,i.ctrlKey||i.metaKey)},color:"cloud",padding:["3/4",1],display:"flex",gap:"1/2",fontColor:"inherit",flexSizing:"none",flexWrap:!1,ssEffectsOnActive:"ripple.cloud",verticalAlign:"center",textAlign:"left",isSemiBoldFont:!0},h))},Bar:o=>d(y,f({flexSizing:"none",backgroundColor:"layer.4.opa.middle",unitHeight:"1/3",margin:["2/3",1],isRounded:!0},o)),Title:o=>d(y,f({fontSize:"3.paragraph",isSemiBoldFont:!0,padding:[0,1]},o))},fn:{refresh:()=>{let o=t(document.body),r=C("#__RVC_TopNavigation"),a=C("#__RVC_FooterNavigation"),g=C("#__RVC_SideNavigation"),s=r.position().height||0,h=s,l=a.position().height||0,u=g.position().width||0;r.getStyleProperty("position")!="sticky"&&(h=0);let p=window.innerHeight,i=window.innerWidth,n=p-s-l,v=i-u;t.scope(()=>{e.fn.viewHeight!=p&&(e.fn.viewHeight=p,o.setStyleProperty("--viewHeight",p+"px"))}),t.scope(()=>{e.fn.viewWidth!=i&&(e.fn.viewWidth=i,o.setStyleProperty("--viewWidth",i+"px"))}),t.scope(()=>{e.fn.contentHeight!=n&&(e.fn.contentHeight=n,o.setStyleProperty("--contentHeight",n+"px").setStyleProperty("--sideNavHeight",n+"px"))}),t.scope(()=>{e.fn.contentWidth!=v&&(e.fn.contentWidth=v,o.setStyleProperty("--contentWidth",v+"px"))}),t.scope(()=>{e.fn.topBase!=h&&(e.fn.topBase=h,o.setStyleProperty("--topBase",h+"px"))}),t.scope(()=>{e.fn.topNavHeight!=s&&(e.fn.topNavHeight=s,o.setStyleProperty("--topNavHeight",s+"px"))}),t.scope(()=>{e.fn.footerNavHeight!=l&&(e.fn.footerNavHeight=l,o.setStyleProperty("--footerNavHeight",l+"px"))}),t.scope(()=>{e.fn.sideNavWidth!=u&&(e.fn.sideNavWidth=u)}),t.scope(()=>{let c=getComputedStyle(document.documentElement),R=parseInt(c.getPropertyValue("--safe-area-top"),10)||0,B=parseInt(c.getPropertyValue("--safe-area-bottom"),10)||0,S=parseInt(c.getPropertyValue("--safe-area-left"),10)||0,H=parseInt(c.getPropertyValue("--safe-area-right"),10)||0;e.fn.safeAreaTop!=R&&(e.fn.safeAreaTop=R),e.fn.safeAreaBottom!=B&&(e.fn.safeAreaBottom=B),e.fn.safeAreaLeft!=S&&(e.fn.safeAreaLeft=S),e.fn.safeAreaRight!=H&&(e.fn.safeAreaRight=H)})},viewHeight:0,viewWidth:0,contentHeight:0,contentWidth:0,topBase:0,sideNavWidth:0,topNavHeight:0,footerNavHeight:0,safeAreaTop:0,safeAreaBottom:0,safeAreaLeft:0,safeAreaRight:0}};export{e as RootViewController,e as default};
1
+ import{b as f,c as m,d as N}from"../chunk-C5N2D3ZX.js";import{jsx as d,jsxs as A}from"react/jsx-runtime";import{useEffect as b}from"react";import t from"jmini";import{$$fromRoot as C,pageRouter as F}from"../@utils";import{Box as y,Flex as x,Column as W}from"../atoms";import{Button as _}from"./Trigger";import{LayoutClasses as w}from"../@styles/componentClasses";const e={Base:o=>{let v=o,{topNavigation:r,sideNavigation:a,footerNavigation:g,topNav:s,leftNav:h,rightNav:l,footerNav:u,children:p,className:i}=v,n=N(v,["topNavigation","sideNavigation","footerNavigation","topNav","leftNav","rightNav","footerNav","children","className"]);return b(()=>{e.fn.refresh();let c="ResizeCB";return t(window).onEvent("resize",()=>{t.interval.once(()=>{e.fn.refresh()},300,"__RVC_calcHeights")},{eventID:c}),()=>{t(window).removeEvent(c)}},[]),A(W,m(f({className:[i,w("RootViewController")].join(" "),backgroundColor:"layer.1",gap:0,minHeight:"viewHeight"},n),{children:[s||r,A(x,{flexWrap:!1,position:"relative",flexSizing:0,children:[h||a,d(y,{className:w("Content"),position:"relative",flexSizing:0,width:0,ssZIndex:2,children:p}),l]}),u||g]}))},TopNav:o=>d(x,m(f({flexSizing:"none",flexType:"col",position:"sticky",top:0,backgroundColor:"layer.1",ssZIndex:5},o),{id:"__RVC_TopNavigation"})),SideNav:o=>d(y,m(f({flexSizing:"none",minHeight:"sideNavigationHeight",ssZIndex:3},o),{id:"__RVC_SideNavigation"})),FooterNav:o=>{let g=o,{baseStyles:r}=g,a=N(g,["baseStyles"]);return d(x,m(f({borderTop:!0,position:"sticky",bottom:0,overflow:"auto",backgroundColor:"layer.1",paddingBottom:"safeAreaBottom",ssZIndex:4},r),{id:"__RVC_FooterNavigation",children:d(x,f({gap:1,flexWrap:!1,padding:"2/3",margin:"auto",width:1},a))}))},Comps:{Button:o=>{let p=o,{isActive:r,path:a,pathGroup:g,currentPath:s}=p,h=N(p,["isActive","path","pathGroup","currentPath"]),l=t.Arrayify(g),u=s||location.pathname;{let i=!1;t.scope(()=>{t.isString(a)&&(t.isNullish(a)||(i=u.replace(/^\//,"").replace(/\/$/,"")==a.replace(/^\//,"").replace(/\/$/,"")))}),t.scope(()=>{if(!i&&l.length)for(let n of l){if(i)break;t.isNullish(n)||(t.isString(n)&&(n=String(n).escapeRegExChar()),u.match(new RegExp(n))&&(i=!0))}}),r=r!=null?r:i}return d(_.Clear,f({isActive:r,isActiveStyles:{fontColor:"theme",backgroundColor:"cloud"},onClick:i=>{t.isExist(a)&&t.isString(a)&&F.push(a,i.ctrlKey||i.metaKey)},color:"cloud",padding:["3/4",1],display:"flex",gap:"1/2",fontColor:"inherit",flexSizing:"none",flexWrap:!1,ssEffectsOnActive:"ripple.cloud",verticalAlign:"center",textAlign:"left",isSemiBoldFont:!0},h))},Bar:o=>d(y,f({flexSizing:"none",backgroundColor:"layer.4.opa.middle",unitHeight:"1/3",margin:["2/3",1],isRounded:!0},o)),Title:o=>d(y,f({fontSize:"3.paragraph",isSemiBoldFont:!0,padding:[0,1]},o))},fn:{refresh:()=>{let o=t(document.body),r=C("#__RVC_TopNavigation"),a=C("#__RVC_FooterNavigation"),g=C("#__RVC_SideNavigation"),s=r.position().height||0,h=s,l=a.position().height||0,u=g.position().width||0;r.getStyleProperty("position")!="sticky"&&(h=0);let p=window.innerHeight,i=window.innerWidth,n=p-s-l,v=i-u;t.scope(()=>{e.fn.viewHeight!=p&&(e.fn.viewHeight=p,o.setStyleProperty("--viewHeight",p+"px"))}),t.scope(()=>{e.fn.viewWidth!=i&&(e.fn.viewWidth=i,o.setStyleProperty("--viewWidth",i+"px"))}),t.scope(()=>{e.fn.contentHeight!=n&&(e.fn.contentHeight=n,o.setStyleProperty("--contentHeight",n+"px").setStyleProperty("--sideNavHeight",n+"px"))}),t.scope(()=>{e.fn.contentWidth!=v&&(e.fn.contentWidth=v,o.setStyleProperty("--contentWidth",v+"px"))}),t.scope(()=>{e.fn.topBase!=h&&(e.fn.topBase=h,o.setStyleProperty("--topBase",h+"px"))}),t.scope(()=>{e.fn.topNavHeight!=s&&(e.fn.topNavHeight=s,o.setStyleProperty("--topNavHeight",s+"px"))}),t.scope(()=>{e.fn.footerNavHeight!=l&&(e.fn.footerNavHeight=l,o.setStyleProperty("--footerNavHeight",l+"px"))}),t.scope(()=>{e.fn.sideNavWidth!=u&&(e.fn.sideNavWidth=u)}),t.scope(()=>{let c=getComputedStyle(document.documentElement),R=parseInt(c.getPropertyValue("--safe-area-top"),10)||0,S=parseInt(c.getPropertyValue("--safe-area-bottom"),10)||0,B=parseInt(c.getPropertyValue("--safe-area-left"),10)||0,H=parseInt(c.getPropertyValue("--safe-area-right"),10)||0;e.fn.safeAreaTop!=R&&(e.fn.safeAreaTop=R),e.fn.safeAreaBottom!=S&&(e.fn.safeAreaBottom=S),e.fn.safeAreaLeft!=B&&(e.fn.safeAreaLeft=B),e.fn.safeAreaRight!=H&&(e.fn.safeAreaRight=H)})},viewHeight:0,viewWidth:0,contentHeight:0,contentWidth:0,topBase:0,sideNavWidth:0,topNavHeight:0,footerNavHeight:0,safeAreaTop:0,safeAreaBottom:0,safeAreaLeft:0,safeAreaRight:0}};export{e as RootViewController,e as default};
@@ -2,7 +2,7 @@ import $$, { Time } from 'jmini';
2
2
  import { StyleProps, ReactElement } from '../@declares';
3
3
  import React from 'react';
4
4
  import { Box } from '../atoms';
5
- import { ButtonTypes } from './Button';
5
+ import { Trigger } from './Trigger';
6
6
  declare namespace Sheet {
7
7
  type Type = 'topLeft' | 'topCenter' | 'topRight' | 'middleLeft' | 'middleCenter' | 'middleRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight' | 'drawer.left' | 'drawer.right' | 'drawer.bottom' | 'custom';
8
8
  type Sizes = 'XS' | 'S' | 'R' | 'L' | '2L' | '3L' | 'MAX';
@@ -18,7 +18,7 @@ declare namespace Sheet {
18
18
  confirm(label: ReactElement, opt?: {
19
19
  sheetID?: string;
20
20
  size?: Sizes;
21
- color?: ButtonTypes.Colors;
21
+ color?: Trigger.Colors;
22
22
  buttonLabel?: ReactElement;
23
23
  }): Promise<boolean>;
24
24
  update<P = any>(sheetID: string, params: Partial<Input<P>>): void;