@featherk/composables 0.8.0 → 0.8.2
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.
- package/README.md +9 -0
- package/dist/featherk-composables.es.js +794 -734
- package/dist/featherk-composables.umd.js +1 -1
- package/dist/form/index.d.ts +4 -0
- package/dist/form/useFieldsetTouchTracker.d.ts +13 -0
- package/dist/form/useFieldsetTouchTracker.test.d.ts +1 -0
- package/dist/form/useFieldsetValidationKit.d.ts +62 -0
- package/dist/form/useFieldsetValidationKit.test.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/docs/address/useZipTextBox.md +18 -11
- package/docs/form/useFieldsetTouchTracker.md +74 -0
- package/docs/form/useFieldsetValidationKit.md +150 -0
- package/package.json +7 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(te,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],t):(te=typeof globalThis<"u"?globalThis:te||self,t(te.FeatherKComposables={},te.Vue,te.useFocusTrap))})(this,(function(te,t,Me){"use strict";const Te=(e,n)=>{const s=t.ref(null);let U=!1,L=null,C=null;const O=[],x=".k-table-row[data-grid-row-index] [tabindex]",A=()=>{const l=e?.value?.$el;return l?l.closest(".k-grid"):null},D=l=>{const y=A();if(!y)return!1;const u=l.closest(".k-grid-aria-root");if(u)return y.contains(u);const d=l.closest(".k-grid-header, .k-grid-content, .k-grid-content-locked");return d?y.contains(d):!1},w=l=>l.key==="Enter"||l.code==="Enter"||l.code==="NumpadEnter",I=()=>e?.value?.columns,E=l=>{const y=l.key||l.code;([" ","Spacebar","Space"].includes(y)||w(l))&&(l.preventDefault(),l.stopPropagation(),s.value=l.target,l.target.click())},v=l=>{if(!s.value)return;if(l.code==="Escape"){l.stopPropagation(),s.value&&s.value.focus();return}const y=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),u=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(u){if(l.code==="Tab"){const d=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],b=n?.focusableMenuSelectors??d,m=Array.from(u.querySelectorAll(b.join(",")));if(m.length===0)return;const k=m.findIndex(G=>G===document.activeElement);let F;k===-1?F=0:l.shiftKey?F=(k-1+m.length)%m.length:F=(k+1)%m.length,l.preventDefault(),l.stopPropagation(),m[F]?.focus()}}else if(l.code==="ArrowUp"||l.code==="ArrowDown"){l.preventDefault(),l.stopPropagation();const d=y.findIndex(m=>m===document.activeElement);let b=d;l.code==="ArrowUp"?b=d>0?d-1:y.length-1:l.code==="ArrowDown"&&(b=d<y.length-1?d+1:0),y[b]?.focus();return}if(l.code==="Tab"){l.preventDefault(),l.stopPropagation();const d=s.value?.parentElement;(l.shiftKey?d?.previousElementSibling:d?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},M=()=>{L=new MutationObserver(l=>{l.forEach(y=>{y.addedNodes.forEach(u=>{if(u.nodeType===Node.ELEMENT_NODE){const d=u;if(d.classList.contains("k-animation-container")){const m=s.value;m&&(m.dataset.featherKSortable==="true"||t.nextTick(()=>{d.querySelectorAll(".k-columnmenu-item-wrapper").forEach(G=>{G.textContent?.toLowerCase().includes("sort")&&G.remove()})})),d.addEventListener("keydown",v),t.nextTick(()=>{const k=()=>{const F=Array.from(d.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(F.length===1)F[0].focus(),F[0].click(),k.attempts=0;else if(F.length>1){k.attempts=0;return}else k.attempts===void 0&&(k.attempts=0),k.attempts++<3&&setTimeout(k,200)};k()})}d.querySelectorAll(".k-animation-container").forEach(m=>{m.addEventListener("keydown",v)})}}),y.removedNodes.forEach(u=>{if(u.nodeType===Node.ELEMENT_NODE){const d=u;d.classList.contains("k-animation-container")&&d.removeEventListener("keydown",v),d.querySelectorAll(".k-animation-container").forEach(m=>{m.removeEventListener("keydown",v)})}})})}),L.observe(document.body,{childList:!0,subtree:!0})},P=l=>{const y=l.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(y)||l.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},f=l=>{if(!l.type||!l)return;const y=l.target;if(!y)return;const u=y.closest(".k-table-row[data-grid-row-index]");if(!D(y))return;const d=["ArrowLeft","ArrowRight"].includes(l.code);if(!(P(y)&&!(u&&d))){if(l.code==="Escape"){const b=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(b){l.preventDefault(),l.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(k=>k.setAttribute("tabindex","-1"))}catch{}b.setAttribute("tabindex","0"),b.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(l.code)){if(y.classList.contains("k-grid-header-menu")&&y.classList.contains("k-grid-column-menu")){s.value=y;return}if(u){if(["ArrowDown","ArrowUp"].includes(l.code)){l.preventDefault(),l.stopPropagation();const b=(k,F)=>{let G=F==="next"?k.nextElementSibling:k.previousElementSibling;for(;G;){const a=G;try{if(a.classList.contains("k-table-row"))return a}catch{}G=F==="next"?G.nextElementSibling:G.previousElementSibling}return null},m=l.code==="ArrowDown"?b(u,"next"):b(u,"previous");m&&(u.setAttribute("tabindex","-1"),m.setAttribute("tabindex","0"),m.focus());return}if(["ArrowLeft","ArrowRight"].includes(l.code)){l.preventDefault(),l.stopPropagation();const b=u.querySelectorAll(x);if(b.length===0)return;let m=Array.from(b).findIndex(k=>k===document.activeElement);if(m===-1&&document.activeElement===u){b[0].focus();return}l.code==="ArrowRight"?m=m===b.length-1?0:m+1:l.code==="ArrowLeft"&&(m=m===0?b.length-1:m-1),b[m].focus();return}}}}},S=()=>{t.nextTick(()=>{const l=e.value.$el.closest(".k-grid");l&&l.classList.add("fk-grid")})},R=()=>{if(!C)try{const l=()=>{try{const d=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!d||d.length===0||d.filter(k=>k.getAttribute("tabindex")==="0").length===1)return;const m=d.find(k=>k===document.activeElement||k.contains(document.activeElement));if(d.forEach(k=>k.setAttribute("tabindex","-1")),m){m.setAttribute("tabindex","0");return}d[0].setAttribute("tabindex","0")}catch(d){console.error("ensureSingleTabindex error:",d)}},y=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));y.length>0&&y.forEach((d,b)=>{d.setAttribute("tabindex",b===0?"0":"-1")});const u=e.value.$el.querySelector(".k-table-tbody");u&&(C=new MutationObserver(()=>{l()}),C.observe(u,{childList:!0,subtree:!0}))}catch(l){console.error("Error setting up row navigation:",l)}},j=()=>{t.nextTick(()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(u=>{u.setAttribute("role","button"),u.addEventListener("keydown",E)}),M(),X()})},W=()=>{const y=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");y&&y.forEach(u=>{u.removeEventListener("keydown",E)}),L&&(L.disconnect(),L=null),C&&(C.disconnect(),C=null),O.forEach(u=>u()),O.length=0},X=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((u,d)=>{if(u.dataset.featherKHeaderBound==="true")return;const b=u.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!b)return;const m=I();if(m&&m[d]){const g=m[d].field??"";u.setAttribute("data-feather-k-field",g),u.setAttribute("data-feather-k-filterable",m[d].filterable===!1?"false":"true"),u.setAttribute("data-feather-k-sortable",m[d].sortable===!1?"false":"true")}const k=u.dataset.featherKFilterable!=="false",F=u.dataset.featherKSortable!=="false";b.setAttribute("tabindex","-1"),k||F?u.style.cursor="pointer":u.style.cursor="default",k?(u.setAttribute("tabindex","0"),u.setAttribute("role","button"),u.setAttribute("aria-haspopup","menu")):(u.setAttribute("tabindex","0"),u.setAttribute("role","columnheader"),u.removeAttribute("aria-haspopup"));const G=g=>{g.target?.closest(".k-column-resizer")||(s.value=u,b.click())},a=g=>{if(k)s.value=u,g.preventDefault(),g.stopPropagation(),G(g);else if(F){s.value=u;const V=u.querySelector(".k-link");V&&V.click()}};u.addEventListener("click",a),O.push(()=>{u.removeEventListener("click",a)});const p=g=>{if((w(g)||g.code==="Space")&&(k||F)){if(g.preventDefault(),g.stopPropagation(),s.value=u,s.value.focus(),k)G(g);else if(F){const V=u.querySelector(".k-link");V&&V.click()}}};u.addEventListener("keydown",p,!0),O.push(()=>{u.removeEventListener("keydown",p,!0)}),u.dataset.featherKHeaderBound="true"});const y=document.querySelector(".k-grid-header .k-table-thead");if(y&&y.dataset.featherKHeaderBound!=="true"){const u=d=>{const b=d.target.closest("th");b&&(w(d)||d.code==="Space")&&b.dataset.featherKFilterable==="false"&&b.dataset.featherKSortable==="false"&&(d.preventDefault(),d.stopImmediatePropagation())};y.addEventListener("keydown",u,!0),O.push(()=>{y.removeEventListener("keydown",u,!0)}),y.dataset.featherKHeaderBound="true"}},J=function(l,y){const u=l?.event?.event.target,d=I();if(!u||!d)return;const b=u.classList.contains("k-grid-header-menu"),m=u.classList.contains("k-columnmenu-item"),k=d.find(F=>F.field===l?.event?.field)?.sortable&&!0;if(!b){if(m&&!k){l?.event?.sort?.filter(G=>G.field!==l?.event?.field);return}typeof y=="function"&&t.nextTick(()=>{s.value&&s.value.focus(),y(l),t.nextTick(()=>{X()})})}},oe=()=>{if(!U)try{S(),R(),j(),U=!0}catch(l){console.error("initA11y failed:",l),W()}};return t.onBeforeUnmount(()=>{W()}),{activeFilterButton:s,handleGridKeyDown:f,handleSortChange:J,initA11y:oe}},$e=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Ce=e=>!!e&&typeof e=="object"&&"field"in e,we=(e,n)=>!e||typeof e!="object"?!1:$e(e)?e.filters.some(s=>we(s,n)):Ce(e)?e.field===n:!1,Ie=e=>n=>e.value?.filters&&e.value.filters.some(s=>we(s,n))?"active":"",Pe="Enter a valid ZIP code with exactly 5 or 9 digits.",De=e=>{const n=e.replace(/\D/g,"").slice(0,9);return n.length>5?`${n.slice(0,5)}-${n.slice(5)}`:n},Le=(e,n)=>e.slice(0,Math.max(0,n)).replace(/\D/g,"").length,Re=e=>e<=5?e:Math.min(e+1,10),Fe=e=>{const n=t.ref(De(e.initialValue??"")),s=t.ref(!1),U=t.ref(e.errorMessage?.trim()||Pe),L=t.computed(()=>n.value.replace(/\D/g,"")),C=t.computed(()=>{const v=L.value.length;return v===5||v===9}),O=t.computed(()=>s.value&&!C.value),x=t.computed(()=>!s.value||C.value),A=t.computed(()=>s.value),D=(v,M)=>{const P=Re(M);t.nextTick(()=>{v.isConnected&&v.setSelectionRange(P,P)})};return{zipDisplay:n,submitted:s,errorMessage:U,wrapperClass:"fk-zip-textbox",zipRaw:L,isZipValid:C,showZipError:O,textBoxValid:x,textBoxValidate:A,handleZipInput:(...v)=>{const M=v[0],f=M?.event?.target,S=M?.value,R=Array.isArray(S)?S.join(""):String(S??""),j=f?.selectionStart!==void 0&&f.selectionStart!==null?Le(f.value,f.selectionStart):R.replace(/\D/g,"").length;n.value=De(R),f&&D(f,j)},submitAndValidate:v=>{s.value=!0;const M=C.value;return!M&&v?.focus&&t.nextTick(()=>{document.getElementById(e.id)?.focus()}),M},buildPayload:()=>({zip:L.value})}};function qe(e){const n=t.ref(""),s=t.ref(void 0),U=t.ref(!!e.debug),L=t.ref(e.dateFormat??"mm/dd/yyyy"),C=t.computed(()=>!!e.required),O=t.ref(!1),x=["ArrowUp","ArrowDown"],A=["ArrowLeft","ArrowRight"],D=t.computed(()=>(n.value??"").replace(/\D/g,"")),w=a=>a<=2?"mm":a<=5?"dd":D.value.length<=10?"yyyy":"mm",I=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(2,"0")}),E=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(2,"0")}),v=t.computed(()=>{const a=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(4,"0")}),M=a=>{if(D.value.length===0){e.onChange({value:null,event:a});return}if(D.value.length<8){e.onChange({value:null,event:a});return}if((n.value??"").length===10&&D.value.length===8){const[p,g,V]=n.value.split("/"),K=parseInt(p),N=parseInt(g),_=parseInt(V);if(j(_,K,N)){const ae=new Date(_,K-1,N);P(ae)?e.onChange({value:ae,event:a}):e.onChange({value:null,event:a})}else e.onChange({value:null,event:a})}},P=a=>{const p=e.min??void 0,g=e.max??void 0;return!(p&&a<p||g&&a>g)},f=t.computed(()=>{if((n.value??"").length===10&&D.value.length===8){const[a,p,g]=(n.value??"").split("/"),V=parseInt(a),K=parseInt(p),N=parseInt(g);if(j(N,V,K))return new Date(N,V-1,K)}return null}),S=t.computed(()=>(n.value??"").length===10&&D.value.length===8),R=(a,p)=>new Date(a,p,0).getDate(),j=(a,p,g)=>p>=1&&p<=12&&a>=1900&&g>=1&&g<=R(a,p),W=a=>{n.value=a.value;const p=a.event?.target;s.value=p?.selectionStart??0,M(a)},X=a=>{s.value=a.target.selectionStart??0},J=(a,p,g)=>{const V=p?.selectionStart??s.value??0;s.value=V;let K=parseInt(I.value),N=parseInt(E.value),_=parseInt(v.value);if(!(D.value.length>=8)||!j(_,K,N)){const z=e.defaultValue??new Date;K=z.getMonth()+1,N=z.getDate(),_=z.getFullYear(),n.value=`${String(K).padStart(2,"0")}/${String(N).padStart(2,"0")}/${String(_)}`;const B=new Date(_,K-1,N);e.onChange({value:P(B)?B:null,event:g}),d({useRAF:!0});return}const o=w(V);if(o==="mm")K=a==="ArrowUp"?K<12?K+1:1:K>1?K-1:12;else if(o==="dd"){const z=new Date(_,K,0).getDate();N=a==="ArrowUp"?N<z?N+1:1:N>1?N-1:z}else o==="yyyy"&&(_=a==="ArrowUp"?_+1:Math.max(1,_-1));n.value=`${String(K).padStart(2,"0")}/${String(N).padStart(2,"0")}/${String(_)}`;const[i,$,q]=n.value.split("/"),H=new Date(parseInt(q),parseInt(i)-1,parseInt($));H.toString()!=="Invalid Date"&&parseInt(q)>=1e3?e.onChange({value:P(H)?H:null,event:g}):e.onChange({value:null,event:g}),d({useRAF:!0})},oe=a=>{if(a.code==="Space"||a.key===" "){a.preventDefault(),a.stopPropagation(),e.onShowCalendar(a);return}if(a.key==="ArrowDown"&&a.altKey){a.preventDefault(),a.stopPropagation(),e.onShowCalendar(a);return}if(x.includes(a.key)){if(a.altKey)return;a.preventDefault(),a.stopPropagation();const p=a.target;J(a.key,p,a);return}},l=a=>{a.preventDefault();const p=a.deltaY<0?"ArrowUp":"ArrowDown";J(p,a.target,a)},y=a=>{const p=a.target;if(A.includes(a.key)){s.value=p?.selectionStart??0;return}if(x.includes(a.key)){if(a.altKey)return;s.value=p?.selectionStart??0}},u=a=>{O.value=!0,C.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&D.value.length===0&&(e.externalValue.value="");const p=a.target;p&&(s.value=p.selectionStart??0)},d=a=>{const p=()=>{const g=document.getElementById(e.id);if(!g)return;const V=a?.pos??s.value??g.value.length;try{g.focus(),g.setSelectionRange(V,V)}catch{}};t.nextTick(()=>{if(a?.delay&&a.delay>0){setTimeout(p,a.delay);return}if(a?.useRAF){requestAnimationFrame(p);return}p()})};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const p=new Date(a);if(p.toString()!=="Invalid Date"){const g=(p.getMonth()+1).toString().padStart(2,"0"),V=p.getDate().toString().padStart(2,"0"),K=p.getFullYear().toString();n.value=`${g}/${V}/${K}`,d({delay:50});return}}},{immediate:!0});const b=t.computed(()=>[["Date",`${I.value} / ${E.value} / ${v.value}`],["Digits only",D.value],["min",e.min?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null],["max",e.max?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null]]),m=t.computed(()=>{if(!C.value){if(!S.value)return!0;const p=f.value;return p?P(p):!1}if(!O.value)return!0;const a=f.value;return!S.value||!a?!1:P(a)}),k=t.computed(()=>{if(!C.value){if(!S.value)return;const p=f.value;return p?P(p)?"valid":"out-of-bounds":"invalid-date"}if(!O.value)return;if(D.value.length===0||!S.value)return"incomplete";const a=f.value;return a?P(a)?"valid":"out-of-bounds":"invalid-date"}),F=t.computed(()=>{const a=k.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-date")return`Must be in ${L.value} format.`;const p=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,g=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(a==="out-of-bounds"){if(p&&g)return`Must be between ${p} and ${g}.`;if(p)return`Must be on or after ${p}.`;if(g)return`Must be on or before ${g}.`}return""}),G=()=>{t.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`ID (#${e.id}) not found for styling.`);return}const p=a.closest(".k-datepicker");if(!p){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const g=p.parentElement;if(g){if(g.classList.contains("fk-datepicker"))return;g.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{G()}),{raw:n,cursorPos:s,debugEnabled:U,debugLines:b,placeholder:L,isValid:m,reason:t.readonly(k),validationMessage:F,digitsOnly:D,month:t.readonly(I),day:t.readonly(E),year:t.readonly(v),datePart:w,handleChange:W,handleKeyDown:oe,handleWheel:l,handleKeyUp:y,handleClick:X,handleBlur:u,initStyling:G}}function Ve(e){const n=t.ref(""),s=t.ref(void 0),U=t.ref(!!e.debug),L=t.ref(!1),C=1440*60*1e3,O=365*C,x=new Date,A=new Date(x.getTime()-O),D=new Date(x.getTime()+O);e.min=e.min??A,e.max=e.max??D;const w=t.computed(()=>(n.value??"").replace(/\D/g,"")),I=(r,c)=>new Date(r,c,0).getDate(),E=(r,c,h)=>c>=1&&c<=12&&r>=1e3&&h>=1&&h<=I(r,c),v=r=>Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),M=r=>{if(!r)return null;const c=e.min??new Date(Date.now()-90*C),h=e.max??new Date,T=v(r);return T<v(c)||T>v(h)?null:r},P=(r,c)=>e.allowReverse??!1?!0:r<=c,f=t.computed(()=>(n.value?.length??0)>=23&&w.value.length>=16),S=r=>{if((r??"").length<23||w.value.length<16)return{start:null,end:null};const c=r.substring(0,10),h=r.substring(13,23),[T,Q,ee]=c.split("/").map(se=>parseInt(se||"0",10)),[ie,ce,de]=h.split("/").map(se=>parseInt(se||"0",10)),fe=new Date(ee,T-1,Q),ye=new Date(de,ie-1,ce),Se=E(ee,T,Q)&&fe.toString()!=="Invalid Date",be=E(de,ie,ce)&&ye.toString()!=="Invalid Date";return{start:Se?fe:null,end:be?ye:null}},R=e.externalValid??t.ref(!0),j=t.computed(()=>S(n.value)),W=t.computed(()=>{const r=M(j.value.start),c=M(j.value.end);return{start:r,end:c}}),X=t.computed(()=>{if(!f.value)return;const r=W.value.start,c=W.value.end;if(!r||!c)return;const h=Math.abs(v(c)-v(r));return Math.round(h/864e5+1)}),J=t.computed(()=>{if(!f.value)return!1;const{start:r,end:c}=j.value;if(!r||!c||!W.value.start||!W.value.end)return!1;const h=W.value.start,T=W.value.end;return!(!P(h,T)||typeof e.maxSpanDays=="number"&&X.value!==void 0&&X.value>e.maxSpanDays)}),oe=t.computed(()=>{const{start:r,end:c}=j.value;if(!f.value)return"incomplete";if(!r||!c)return"invalid-date";if(!W.value.start||!W.value.end)return"out-of-bounds";const h=W.value.start,T=W.value.end;return P(h,T)?typeof e.maxSpanDays=="number"&&X.value!==void 0&&X.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),l=t.ref(void 0),y=t.computed(()=>{if(R.value!==!1)return"";const{min:r,max:c}=e,h=l.value;if(!h)return"";switch(h){case"incomplete":return"Required";case"invalid-date":return"One or both dates invalid.";case"reversed-range":return"End Date must be on or after Start Date.";case"out-of-bounds":return r&&c?`Dates must be between ${m(r)} and ${m(c)}.`:"Dates must be within the allowed range.";case"span-exceeds-limit":return typeof e.maxSpanDays=="number"?`Date range exceeds ${e.maxSpanDays} days.`:"Date range exceeds maximum allowed span.";default:return""}}),u=["ArrowUp","ArrowDown"],d=["ArrowLeft","ArrowRight"],b=(r,c)=>String(r).padStart(c,"0"),m=r=>`${b(r.getMonth()+1,2)}/${b(r.getDate(),2)}/${b(r.getFullYear(),4)}`,k=r=>r<=2?{side:"start",part:"mm"}:r<=5?{side:"start",part:(r<=3,"dd")}:r<=11?{side:"start",part:"yyyy"}:r<=15?{side:"end",part:"mm"}:r<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},F=(r,c,h)=>{const T=c?.selectionStart??s.value??0;s.value=T;const{start:Q,end:ee}=S(n.value);if(!Q&&!ee){const Y=new Date,le=m(Y);n.value=`${le} - ${le}`,e.onChange({value:{start:Y,end:Y},event:h}),t.nextTick(()=>{requestAnimationFrame(()=>{const ne=document.getElementById(e.id),re=s.value??0;ne&&(ne.focus(),ne.setSelectionRange(re,re))})});return}const ie=new Date,ce=k(T);let de=Q?new Date(Q):new Date(ie),fe=ee?new Date(ee):new Date(ie);const ye=(Y,le)=>{if(le==="mm"){const ne=Y.getMonth()+1,re=r==="ArrowUp"?ne<12?ne+1:1:ne>1?ne-1:12;Y.setMonth(re-1);const ge=I(Y.getFullYear(),re);Y.getDate()>ge&&Y.setDate(ge)}else if(le==="dd"){const ne=I(Y.getFullYear(),Y.getMonth()+1),re=Y.getDate(),ge=r==="ArrowUp"?re<ne?re+1:1:re>1?re-1:ne;Y.setDate(ge)}else if(le==="yyyy"){const ne=Y.getFullYear();Y.setFullYear(r==="ArrowUp"?ne+1:Math.max(1,ne-1));const re=I(Y.getFullYear(),Y.getMonth()+1);Y.getDate()>re&&Y.setDate(re)}};ce.side==="start"?ye(de,ce.part):ye(fe,ce.part);const Se=m(de),be=m(fe);n.value=`${Se} - ${be}`;const se=M(de),ke=M(fe);se&&ke&&P(se,ke)?e.onChange({value:{start:se,end:ke},event:h}):e.onChange({value:null,event:h}),t.nextTick(()=>{requestAnimationFrame(()=>{const Y=document.getElementById(e.id),le=s.value??0;Y&&(Y.focus(),Y.setSelectionRange(le,le))})})},G=r=>{const{start:c,end:h}=S(n.value);if(!c||!h){e.onChange({value:null,event:r});return}const T=M(c),Q=M(h);if(!T||!Q){e.onChange({value:null,event:r});return}if(!P(T,Q)){e.onChange({value:null,event:r});return}e.onChange({value:{start:T,end:Q},event:r})},a=r=>{const c=r.value??"",h=r.event;if(!c&&h&&h.type==="click"){ae(h);return}n.value=c;const T=h?.target;s.value=T?.selectionStart??0,G(r)},p=r=>{s.value=r.target.selectionStart??0},g=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(u.includes(r.key)){r.preventDefault(),r.stopPropagation();const c=r.target;F(r.key,c,r);return}},V=r=>{r.preventDefault();const c=r.deltaY<0?"ArrowUp":"ArrowDown";F(c,r.target,r)},K=r=>{if(d.includes(r.key)||u.includes(r.key)){const c=r.target;s.value=c?.selectionStart??0}},N=()=>{l.value=oe.value,(e.manageValid??!0)&&(R.value=J.value)},_=r=>{N()},ae=r=>{console.log("Clear event:",r),n.value="",s.value=0,e.onChange({value:null,event:r}),N(),t.nextTick(()=>{const c=document.getElementById(e.id);c&&(c.focus(),c.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,r=>{const c=r?.start??null,h=r?.end??null;if(c&&h){if(n.value=`${m(c)} - ${m(h)}`,e.isOpen?.value&&L.value&&e.onRequestClose){const T=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),L.value=!1,N()},T)}return}},{immediate:!0});const o=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),i=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),$=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),q=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),H=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),z=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),B=t.computed(()=>{const{start:r,end:c}=S(n.value);return[{label:"Raw",value:n.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(o.value).padStart(2,"0")} / ${String(i.value).padStart(2,"0")} / ${String($.value).padStart(4,"0")}`},{label:"End",value:`${String(q.value).padStart(2,"0")} / ${String(H.value).padStart(2,"0")} / ${String(z.value).padStart(4,"0")}`},{label:"Digits only",value:w.value},{label:"Mask complete",value:`${f.value}`},{label:"Parsed",value:`${r?r.toDateString():"-"} | ${c?c.toDateString():"-"}`},{label:"Valid (managed)",value:`${R.value??"-"}`},{label:"Span (days)",value:`${X.value??"-"}`},{label:"Reason",value:`${oe.value??"-"}`},{label:"Cursor in",value:`${s.value??"-"} (${(()=>{const h=s.value??0,T=k(h);return`${T.side}.${T.part}`})()})`}]}),Z=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`#${e.id} not found for styling.`);return}const c=r.closest("div");if(!c){console.warn(`Parent div of #${e.id} not found for styling.`);return}c.classList.contains("fk-daterangepicker")||c.classList.add("fk-daterangepicker")})};t.onMounted(()=>{Z()});const me=()=>{t.nextTick(()=>{try{const r=Array.from(document.querySelectorAll(".k-animation-container"));if(!r.length)return;const h=[...r].reverse().find(ee=>ee.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!h)return;const T=h.querySelectorAll(".k-calendar-table");let Q=!1;T.forEach(ee=>{ee.tabIndex===0&&(Q?ee.tabIndex=-1:Q=!0)})}catch(r){console.warn(r)}})};return e.isOpen&&t.watch(e.isOpen,r=>{r&&setTimeout(()=>me(),0)},{immediate:!1}),{raw:n,cursorPos:s,debugEnabled:U,debugLines:B,digitsOnly:w,valid:R,validComputed:t.readonly(J),reason:t.readonly(oe),validationMessage:t.readonly(y),spanDays:t.readonly(X),month1:t.readonly(o),day1:t.readonly(i),year1:t.readonly($),month2:t.readonly(q),day2:t.readonly(H),year2:t.readonly(z),handleChange:a,handleKeyDown:g,handleWheel:V,handleKeyUp:K,handleClick:p,handleBlur:_,handleClear:ae,onCalendarChange:()=>{L.value=!0},initStyling:Z}}function Ue(e){const n=t.ref(""),s=t.ref(void 0),U=t.ref(!!e.debug),L=t.ref(e.timeFormat??"hh:mm AM"),C=t.computed(()=>!!e.required),O=t.ref(!1),x=["ArrowUp","ArrowDown"],A=["ArrowLeft","ArrowRight"],D=t.computed(()=>(n.value??"").replace(/\D/g,"")),w={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},I=o=>o<=2?"hh":o<=5?"mm":"ampm",E=t.computed(()=>{const o=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",i=parseInt(o);return Math.min(Math.max(i,0),23)}),v=t.computed(()=>{const o=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",i=parseInt(o);return Math.min(Math.max(i,0),59)}),M=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),P=t.computed(()=>{const o=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),i=M.value;return o===12?i==="AM"?0:12:i==="PM"?o+12:o}),f=t.computed(()=>S.value?`${String(P.value).padStart(2,"0")}:${String(v.value).padStart(2,"0")}:00`:null),S=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),R=(o,i,$)=>{let q=o%12;return q===0&&(q=12),`${String(q).padStart(2,"0")}:${String(i).padStart(2,"0")} ${$}`},j=o=>{const i=o.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!i)return null;const $=parseInt(i[1]),q=parseInt(i[2]),H=i[3].toUpperCase();if($<1||$>12||q<0||q>59)return null;let z=$%12;H==="PM"&&(z+=12);const B=new Date;return B.setSeconds(0,0),B.setHours(z),B.setMinutes(q),B},W=o=>{if(D.value.length===0){e.onChange({value:null,event:o});return}if(!S.value){e.onChange({value:null,event:o});return}const i=j(n.value);i&&J(i)?e.onChange({value:i,event:o}):e.onChange({value:null,event:o})},X=o=>o.getHours()*60+o.getMinutes(),J=o=>{const i=e.min??void 0,$=e.max??void 0,q=X(o);if(i){const H=X(i);if(q<H)return!1}if($){const H=X($);if(q>H)return!1}return!0},oe=o=>{const i=o.getHours(),$=i>=12?"PM":"AM";n.value=R(i,o.getMinutes(),$)},l=(o,i)=>{e.onChange({value:o,event:i})},y=()=>{t.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const o=document.getElementById(e.id);if(o){o.focus();const i=(o.value??"").length;o.setSelectionRange(i,i)}})})})},u=o=>{const i=o?.event?.target;return i?i.closest(".k-time-now")?"now":i.closest(".k-time-accept")?"set":null:null},d=(o,i)=>{o&&J(o)?l(o,i):l(null,i)},b=(...o)=>{const i=o[0];if(!i)return;const $=u(i);if($==="now"){const H=new Date;oe(H),d(H,i),y();return}if(i?.value instanceof Date){const H=new Date(i.value);oe(H),d(H,i),$==="set"&&y();return}if(i?.value===null){n.value="",l(null,i);return}n.value=i.value;const q=i.event?.target;s.value=q?.selectionStart??0;try{const H=s.value??0;if(I(H)==="ampm"&&(n.value??"").length>=8){const z=n.value.charAt(6);/[Aa]/.test(z)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const B=document.getElementById(e.id);B&&(B.focus(),B.setSelectionRange(8,8))})})):/[Pp]/.test(z)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const B=document.getElementById(e.id);B&&(B.focus(),B.setSelectionRange(8,8))})}))}}catch{}W(i)},m=o=>{s.value=o.target.selectionStart??0},k=(o,i,$)=>{const q=i?.selectionStart??s.value??0;s.value=q;const H=I(q),z=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!z){if((n.value??"").length===0||D.value.length===0){const c=new Date,h=c.getHours(),T=h>=12?"PM":"AM";n.value=R(h,c.getMinutes(),T);const Q=j(n.value);d(Q,$),t.nextTick(()=>{requestAnimationFrame(()=>{const ee=document.getElementById(e.id),ie=s.value??0;ee&&(ee.focus(),ee.setSelectionRange(ie,ie))})})}return}let B=parseInt(z[1]),Z=parseInt(z[2]),me=z[3].toUpperCase();if(H==="hh")o==="ArrowUp"?B=B<12?B+1:1:B=B>1?B-1:12;else if(H==="mm"){const c=e.minuteStepRef?.value??e.minuteStep??1;if(c===1)o==="ArrowUp"?Z=Z<59?Z+1:0:Z=Z>0?Z-1:59;else if(o==="ArrowUp"){const h=Z%c;let T=h===0?Z+c:Z+(c-h);T>=60&&(T=0),Z=T}else{const h=Z%c;let T=h===0?Z-c:Z-h;T<0&&(T=60-c),Z=T}}else H==="ampm"&&(me=me==="AM"?"PM":"AM");n.value=`${String(B).padStart(2,"0")}:${String(Z).padStart(2,"0")} ${me}`;const r=j(n.value);d(r,$),t.nextTick(()=>{requestAnimationFrame(()=>{const c=document.getElementById(e.id),h=s.value??0;c&&(c.focus(),c.setSelectionRange(h,h))})})},F=o=>{if(o.code==="Space"||o.key===" "){o.preventDefault(),o.stopPropagation(),e.onShowPicker(o);return}if(o.key==="ArrowDown"&&o.altKey){o.preventDefault(),o.stopPropagation(),e.onShowPicker(o);return}if(x.includes(o.key)){if(o.altKey)return;o.preventDefault(),o.stopPropagation();const i=o.target;k(o.key,i,o);return}},G=o=>{o.preventDefault();const i=o.deltaY<0?"ArrowUp":"ArrowDown";k(i,o.target,o)},a=o=>{const i=o.target;if(A.includes(o.key)){s.value=i?.selectionStart??0;return}if(x.includes(o.key)){if(o.altKey)return;s.value=i?.selectionStart??0}},p=o=>{O.value=!0,C.value&&e.externalValue&&e.externalValue.value===void 0&&D.value.length===0&&(e.externalValue.value="");const i=o.target;i&&(s.value=i.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,o=>{if(o){const i=new Date(o);if(i.toString()!=="Invalid Date"){const $=i.getHours(),q=$>=12?"PM":"AM";n.value=R($,i.getMinutes(),q);return}}},{immediate:!0});const g=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",E.value],["Hour (24h)",P.value],["Minute",v.value],["Period",M.value],["Time (24h)",f.value??"--:--:--"],["Digits only",D.value],["Parsed Date",V.value?.toLocaleDateString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["min",e.min?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["max",e.max?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["valid",K.value],["reason",N.value],["validationMessage",_.value]]),V=t.computed(()=>j(n.value)??null),K=t.computed(()=>{if(!C.value){if(!S.value)return!0;const i=V.value;return i?J(i):!1}if(!O.value)return!0;const o=V.value;return!S.value||!o?!1:J(o)}),N=t.computed(()=>{if(!C.value){if(!S.value)return;const i=V.value;return i?J(i)?"valid":"out-of-bounds":"invalid-time"}if(!O.value)return;if(D.value.length===0||!S.value)return"incomplete";const o=V.value;return o?J(o)?"valid":"out-of-bounds":"invalid-time"}),_=t.computed(()=>{const o=N.value;if(!o||o==="valid")return"";if(o==="incomplete")return"Required";if(o==="invalid-time")return`Must be in ${L.value} format.`;const i={hour:"2-digit",minute:"2-digit"},$=e.min?e.min.toLocaleTimeString("en-US",i):null,q=e.max?e.max.toLocaleTimeString("en-US",i):null;if(o==="out-of-bounds"){if($&&q)return`Must be between ${$} and ${q}.`;if($)return`Must be ${$} or later.`;if(q)return`Must be ${q} or earlier.`}return""}),ae=()=>{t.nextTick(()=>{const o=document.getElementById(e.id);if(!o){console.warn(`#${e.id} not found for styling.`);return}const i=o.closest(".k-timepicker");if(!i){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const $=i.parentElement;if(!$){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}$.classList.contains("fk-timepicker")||$.classList.add("fk-timepicker")})};return t.onMounted(()=>{ae()}),{raw:n,rules:w,debugEnabled:U,debugLines:g,placeholder:L,isValid:K,reason:t.readonly(N),validationMessage:_,isComplete:S,inRangeTime:J,cursorPos:s,hour:t.readonly(E),hour24:t.readonly(P),minute:t.readonly(v),period:t.readonly(M),time24:t.readonly(f),parsedRawTime:t.readonly(V),handleChange:b,handleKeyDown:F,handleKeyUp:a,handleClick:m,handleWheel:G,handleBlur:p,initStyling:ae}}function Oe(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}const Ae=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Be=Object.prototype.toString,Ke=e=>Be.call(e)==="[object Object]",ue=()=>{},Ne=He();function He(){var e,n;return Ae&&((e=window?.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((n=window?.navigator)==null?void 0:n.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function he(e){return Array.isArray(e)?e:[e]}function Ye(e,n,s){return t.watch(e,n,{...s,immediate:!0})}const xe=Ae?window:void 0;function pe(e){var n;const s=t.toValue(e);return(n=s?.$el)!=null?n:s}function ve(...e){const n=[],s=()=>{n.forEach(x=>x()),n.length=0},U=(x,A,D,w)=>(x.addEventListener(A,D,w),()=>x.removeEventListener(A,D,w)),L=t.computed(()=>{const x=he(t.toValue(e[0])).filter(A=>A!=null);return x.every(A=>typeof A!="string")?x:void 0}),C=Ye(()=>{var x,A;return[(A=(x=L.value)==null?void 0:x.map(D=>pe(D)))!=null?A:[xe].filter(D=>D!=null),he(t.toValue(L.value?e[1]:e[0])),he(t.unref(L.value?e[2]:e[1])),t.toValue(L.value?e[3]:e[2])]},([x,A,D,w])=>{if(s(),!x?.length||!A?.length||!D?.length)return;const I=Ke(w)?{...w}:w;n.push(...x.flatMap(E=>A.flatMap(v=>D.map(M=>U(E,v,M,I)))))},{flush:"post"}),O=()=>{C(),s()};return Oe(s),O}let Ee=!1;function Ge(e,n,s={}){const{window:U=xe,ignore:L=[],capture:C=!0,detectIframe:O=!1,controls:x=!1}=s;if(!U)return x?{stop:ue,cancel:ue,trigger:ue}:ue;if(Ne&&!Ee){Ee=!0;const f={passive:!0};Array.from(U.document.body.children).forEach(S=>S.addEventListener("click",ue,f)),U.document.documentElement.addEventListener("click",ue,f)}let A=!0;const D=f=>t.toValue(L).some(S=>{if(typeof S=="string")return Array.from(U.document.querySelectorAll(S)).some(R=>R===f.target||f.composedPath().includes(R));{const R=pe(S);return R&&(f.target===R||f.composedPath().includes(R))}});function w(f){const S=t.toValue(f);return S&&S.$.subTree.shapeFlag===16}function I(f,S){const R=t.toValue(f),j=R.$.subTree&&R.$.subTree.children;return j==null||!Array.isArray(j)?!1:j.some(W=>W.el===S.target||S.composedPath().includes(W.el))}const E=f=>{const S=pe(e);if(f.target!=null&&!(!(S instanceof Element)&&w(e)&&I(e,f))&&!(!S||S===f.target||f.composedPath().includes(S))){if("detail"in f&&f.detail===0&&(A=!D(f)),!A){A=!0;return}n(f)}};let v=!1;const M=[ve(U,"click",f=>{v||(v=!0,setTimeout(()=>{v=!1},0),E(f))},{passive:!0,capture:C}),ve(U,"pointerdown",f=>{const S=pe(e);A=!D(f)&&!!(S&&!f.composedPath().includes(S))},{passive:!0}),O&&ve(U,"blur",f=>{setTimeout(()=>{var S;const R=pe(e);((S=U.document.activeElement)==null?void 0:S.tagName)==="IFRAME"&&!R?.contains(U.document.activeElement)&&n(f)},0)},{passive:!0})].filter(Boolean),P=()=>M.forEach(f=>f());return x?{stop:P,cancel:()=>{A=!1},trigger:f=>{A=!0,E(f),A=!1}}:P}function je(e){const n=t.shallowRef(null),s=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],U=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??s].flat(),L=w=>w?typeof e.initialFocus=="string"?w.querySelector(e.initialFocus)??w:typeof e.initialFocus=="function"?e.initialFocus(w)??w:w.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??w:null,{activate:C,deactivate:O}=Me.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>L(n.value),...e.focusTrapOptions??{}});let x=null,A=t.ref(null);const D=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const w=(E,v)=>{const M=Array.from(E.querySelectorAll(v));if(!M.length)return null;const P=M.filter(f=>f.offsetParent!==null||f.getClientRects().length>0);return P[P.length-1]??M[M.length-1]??null},I=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const E of U){const v=w(I,E);if(v)return v}for(const E of U){const v=w(document,E);if(v)return v}return null};return Ge(n,w=>{A.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",w)}),t.watch(()=>e.isOpen.value,w=>{w?(A.value=null,t.nextTick(()=>{const I=D();I&&(n.value=I,setTimeout(()=>C(),0),x||(x=E=>{E.key==="Escape"&&(A.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",E))},document.addEventListener("keydown",x,!0)))})):(O(),x&&(document.removeEventListener("keydown",x,!0),x=null),n.value=null,A.value==="outside"&&t.nextTick(()=>{const I=()=>{const E=e.triggerEl?.value,v=E?.querySelector("input"),M=document.activeElement;M&&(M===v||E&&E.contains(M))&&(v??E)?.blur?.()};requestAnimationFrame(()=>setTimeout(I,0))}),e.returnFocusToTrigger!==!1&&A.value==="escape"&&e.triggerEl?.value&&(console.log("Returning focus to trigger element:",e.triggerEl.value),t.nextTick(()=>{const I=()=>{const E=e.triggerEl?.value;if(!E)return;(E.querySelector("input")??E)?.focus?.()};requestAnimationFrame(()=>setTimeout(I,0))})))}),{popupRef:n,activate:C,deactivate:O,lastCloseReason:t.readonly(A),setPopupEl:w=>n.value=w}}te.useGridA11y=Te,te.useGridActiveFilter=Ie,te.useMaskedDateInput=qe,te.useMaskedDateRangeInput=Ve,te.useMaskedTimeInput=Ue,te.usePopupTrap=je,te.useZipTextBox=Fe,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(X,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@vueuse/integrations/useFocusTrap")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/integrations/useFocusTrap"],t):(X=typeof globalThis<"u"?globalThis:X||self,t(X.FeatherKComposables={},X.Vue,X.useFocusTrap))})(this,(function(X,t,Te){"use strict";const Ie=(e,n)=>{const i=t.ref(null);let F=!1,I=null,$=null;const P=[],D=".k-table-row[data-grid-row-index] [tabindex]",E=()=>{const l=e?.value?.$el;return l?l.closest(".k-grid"):null},x=l=>{const g=E();if(!g)return!1;const u=l.closest(".k-grid-aria-root");if(u)return g.contains(u);const d=l.closest(".k-grid-header, .k-grid-content, .k-grid-content-locked");return d?g.contains(d):!1},A=l=>l.key==="Enter"||l.code==="Enter"||l.code==="NumpadEnter",L=()=>e?.value?.columns,b=l=>{const g=l.key||l.code;([" ","Spacebar","Space"].includes(g)||A(l))&&(l.preventDefault(),l.stopPropagation(),i.value=l.target,l.target.click())},y=l=>{if(!i.value)return;if(l.code==="Escape"){l.stopPropagation(),i.value&&i.value.focus();return}const g=Array.from(document.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item")),u=document.querySelector(".k-animation-container .k-popup .k-column-menu .k-filter-menu-container");if(u){if(l.code==="Tab"){const d=[".k-dropdownlist[tabindex='0']","input.k-input-inner:not([tabindex='-1']):not([disabled])","button:not([tabindex='-1']):not([disabled])",".k-checkbox"],k=n?.focusableMenuSelectors??d,m=Array.from(u.querySelectorAll(k.join(",")));if(m.length===0)return;const w=m.findIndex(j=>j===document.activeElement);let V;w===-1?V=0:l.shiftKey?V=(w-1+m.length)%m.length:V=(w+1)%m.length,l.preventDefault(),l.stopPropagation(),m[V]?.focus()}}else if(l.code==="ArrowUp"||l.code==="ArrowDown"){l.preventDefault(),l.stopPropagation();const d=g.findIndex(m=>m===document.activeElement);let k=d;l.code==="ArrowUp"?k=d>0?d-1:g.length-1:l.code==="ArrowDown"&&(k=d<g.length-1?d+1:0),g[k]?.focus();return}if(l.code==="Tab"){l.preventDefault(),l.stopPropagation();const d=i.value?.parentElement;(l.shiftKey?d?.previousElementSibling:d?.nextElementSibling)?.querySelector("button, [role='button'], .k-link")?.focus()}},M=()=>{I=new MutationObserver(l=>{l.forEach(g=>{g.addedNodes.forEach(u=>{if(u.nodeType===Node.ELEMENT_NODE){const d=u;if(d.classList.contains("k-animation-container")){const m=i.value;m&&(m.dataset.featherKSortable==="true"||t.nextTick(()=>{d.querySelectorAll(".k-columnmenu-item-wrapper").forEach(j=>{j.textContent?.toLowerCase().includes("sort")&&j.remove()})})),d.addEventListener("keydown",y),t.nextTick(()=>{const w=()=>{const V=Array.from(d.querySelectorAll(".k-animation-container .k-popup .k-column-menu .k-columnmenu-item-wrapper .k-columnmenu-item"));if(V.length===1)V[0].focus(),V[0].click(),w.attempts=0;else if(V.length>1){w.attempts=0;return}else w.attempts===void 0&&(w.attempts=0),w.attempts++<3&&setTimeout(w,200)};w()})}d.querySelectorAll(".k-animation-container").forEach(m=>{m.addEventListener("keydown",y)})}}),g.removedNodes.forEach(u=>{if(u.nodeType===Node.ELEMENT_NODE){const d=u;d.classList.contains("k-animation-container")&&d.removeEventListener("keydown",y),d.querySelectorAll(".k-animation-container").forEach(m=>{m.removeEventListener("keydown",y)})}})})}),I.observe(document.body,{childList:!0,subtree:!0})},R=l=>{const g=l.tagName.toLowerCase();return!!(["input","textarea","select","button"].includes(g)||l.closest('.k-picker-wrap, .k-input-inner, .k-textbox, [role="combobox"]'))},f=l=>{if(!l.type||!l)return;const g=l.target;if(!g)return;const u=g.closest(".k-table-row[data-grid-row-index]");if(!x(g))return;const d=["ArrowLeft","ArrowRight"].includes(l.code);if(!(R(g)&&!(u&&d))){if(l.code==="Escape"){const k=document.activeElement?.closest(".k-table-row[data-grid-row-index]");if(k){l.preventDefault(),l.stopPropagation();try{Array.from(e?.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]")).forEach(w=>w.setAttribute("tabindex","-1"))}catch{}k.setAttribute("tabindex","0"),k.focus();return}}if(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Enter","NumpadEnter","Space"].includes(l.code)){if(g.classList.contains("k-grid-header-menu")&&g.classList.contains("k-grid-column-menu")){i.value=g;return}if(u){if(["ArrowDown","ArrowUp"].includes(l.code)){l.preventDefault(),l.stopPropagation();const k=(w,V)=>{let j=V==="next"?w.nextElementSibling:w.previousElementSibling;for(;j;){const a=j;try{if(a.classList.contains("k-table-row"))return a}catch{}j=V==="next"?j.nextElementSibling:j.previousElementSibling}return null},m=l.code==="ArrowDown"?k(u,"next"):k(u,"previous");m&&(u.setAttribute("tabindex","-1"),m.setAttribute("tabindex","0"),m.focus());return}if(["ArrowLeft","ArrowRight"].includes(l.code)){l.preventDefault(),l.stopPropagation();const k=u.querySelectorAll(D);if(k.length===0)return;let m=Array.from(k).findIndex(w=>w===document.activeElement);if(m===-1&&document.activeElement===u){k[0].focus();return}l.code==="ArrowRight"?m=m===k.length-1?0:m+1:l.code==="ArrowLeft"&&(m=m===0?k.length-1:m-1),k[m].focus();return}}}}},S=()=>{t.nextTick(()=>{const l=e.value.$el.closest(".k-grid");l&&l.classList.add("fk-grid")})},q=()=>{if(!$)try{const l=()=>{try{const d=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));if(!d||d.length===0||d.filter(w=>w.getAttribute("tabindex")==="0").length===1)return;const m=d.find(w=>w===document.activeElement||w.contains(document.activeElement));if(d.forEach(w=>w.setAttribute("tabindex","-1")),m){m.setAttribute("tabindex","0");return}d[0].setAttribute("tabindex","0")}catch(d){console.error("ensureSingleTabindex error:",d)}},g=Array.from(e.value.$el.querySelectorAll(".k-table-row[data-grid-row-index]"));g.length>0&&g.forEach((d,k)=>{d.setAttribute("tabindex",k===0?"0":"-1")});const u=e.value.$el.querySelector(".k-table-tbody");u&&($=new MutationObserver(()=>{l()}),$.observe(u,{childList:!0,subtree:!0}))}catch(l){console.error("Error setting up row navigation:",l)}},G=()=>{t.nextTick(()=>{const g=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");g&&g.forEach(u=>{u.setAttribute("role","button"),u.addEventListener("keydown",b)}),M(),J()})},W=()=>{const g=document.querySelectorAll(".k-grid-header .k-grid-header-menu.k-grid-column-menu");g&&g.forEach(u=>{u.removeEventListener("keydown",b)}),I&&(I.disconnect(),I=null),$&&($.disconnect(),$=null),P.forEach(u=>u()),P.length=0},J=()=>{document.querySelectorAll(".k-grid-header .k-table-thead th").forEach((u,d)=>{if(u.dataset.featherKHeaderBound==="true")return;const k=u.querySelector(".k-grid-header-menu.k-grid-column-menu");if(!k)return;const m=L();if(m&&m[d]){const h=m[d].field??"";u.setAttribute("data-feather-k-field",h),u.setAttribute("data-feather-k-filterable",m[d].filterable===!1?"false":"true"),u.setAttribute("data-feather-k-sortable",m[d].sortable===!1?"false":"true")}const w=u.dataset.featherKFilterable!=="false",V=u.dataset.featherKSortable!=="false";k.setAttribute("tabindex","-1"),w||V?u.style.cursor="pointer":u.style.cursor="default",w?(u.setAttribute("tabindex","0"),u.setAttribute("role","button"),u.setAttribute("aria-haspopup","menu")):(u.setAttribute("tabindex","0"),u.setAttribute("role","columnheader"),u.removeAttribute("aria-haspopup"));const j=h=>{h.target?.closest(".k-column-resizer")||(i.value=u,k.click())},a=h=>{if(w)i.value=u,h.preventDefault(),h.stopPropagation(),j(h);else if(V){i.value=u;const U=u.querySelector(".k-link");U&&U.click()}};u.addEventListener("click",a),P.push(()=>{u.removeEventListener("click",a)});const p=h=>{if((A(h)||h.code==="Space")&&(w||V)){if(h.preventDefault(),h.stopPropagation(),i.value=u,i.value.focus(),w)j(h);else if(V){const U=u.querySelector(".k-link");U&&U.click()}}};u.addEventListener("keydown",p,!0),P.push(()=>{u.removeEventListener("keydown",p,!0)}),u.dataset.featherKHeaderBound="true"});const g=document.querySelector(".k-grid-header .k-table-thead");if(g&&g.dataset.featherKHeaderBound!=="true"){const u=d=>{const k=d.target.closest("th");k&&(A(d)||d.code==="Space")&&k.dataset.featherKFilterable==="false"&&k.dataset.featherKSortable==="false"&&(d.preventDefault(),d.stopImmediatePropagation())};g.addEventListener("keydown",u,!0),P.push(()=>{g.removeEventListener("keydown",u,!0)}),g.dataset.featherKHeaderBound="true"}},Q=function(l,g){const u=l?.event?.event.target,d=L();if(!u||!d)return;const k=u.classList.contains("k-grid-header-menu"),m=u.classList.contains("k-columnmenu-item"),w=d.find(V=>V.field===l?.event?.field)?.sortable&&!0;if(!k){if(m&&!w){l?.event?.sort?.filter(j=>j.field!==l?.event?.field);return}typeof g=="function"&&t.nextTick(()=>{i.value&&i.value.focus(),g(l),t.nextTick(()=>{J()})})}},oe=()=>{if(!F)try{S(),q(),G(),F=!0}catch(l){console.error("initA11y failed:",l),W()}};return t.onBeforeUnmount(()=>{W()}),{activeFilterButton:i,handleGridKeyDown:f,handleSortChange:Q,initA11y:oe}},$e=e=>!!e&&typeof e=="object"&&"filters"in e&&Array.isArray(e.filters),Ce=e=>!!e&&typeof e=="object"&&"field"in e,we=(e,n)=>!e||typeof e!="object"?!1:$e(e)?e.filters.some(i=>we(i,n)):Ce(e)?e.field===n:!1,Pe=e=>n=>e.value?.filters&&e.value.filters.some(i=>we(i,n))?"active":"",Fe="Enter a valid ZIP code with exactly 5 or 9 digits.",De=e=>{const n=e.replace(/\D/g,"").slice(0,9);return n.length>5?`${n.slice(0,5)}-${n.slice(5)}`:n},Le=(e,n)=>e.slice(0,Math.max(0,n)).replace(/\D/g,"").length,Re=e=>e<=5?e:Math.min(e+1,10),qe=e=>{const n=t.ref(De(e.initialValue??"")),i=t.ref(!1),F=t.ref(e.errorMessage?.trim()||Fe),I=t.computed(()=>n.value.replace(/\D/g,"")),$=t.computed(()=>{const y=I.value.length;return y===5||y===9}),P=t.computed(()=>i.value&&!$.value),D=t.computed(()=>!i.value||$.value),E=t.computed(()=>i.value),x=(y,M)=>{const R=Re(M);t.nextTick(()=>{y.isConnected&&y.setSelectionRange(R,R)})};return{zipDisplay:n,submitted:i,errorMessage:F,wrapperClass:"fk-zip-textbox",zipRaw:I,isZipValid:$,showZipError:P,textBoxValid:D,textBoxValidate:E,handleZipInput:(...y)=>{const M=y[0],f=M?.event?.target,S=M?.value,q=Array.isArray(S)?S.join(""):String(S??""),G=f?.selectionStart!==void 0&&f.selectionStart!==null?Le(f.value,f.selectionStart):q.replace(/\D/g,"").length;n.value=De(q),f&&x(f,G)},submitAndValidate:y=>{i.value=!0;const M=$.value;return!M&&y?.focus&&t.nextTick(()=>{document.getElementById(e.id)?.focus()}),M},buildPayload:()=>({zip:I.value})}};function Ae(e,n){const i=t.ref(!1);t.watchEffect(()=>{e.value?.setAttribute("aria-invalid",String(!n.isValid()))});function F($){const P=e.value??$.currentTarget,D=$.relatedTarget;(!P||!P.contains(D))&&(i.value=!0)}function I(){i.value=!1}return{touched:i,onFocusout:F,reset:I}}function Ve(e,n){const i=t.ref(!1),F=t.ref(!1),I=t.computed(()=>t.toValue(n.submitted)||i.value),$=t.computed(()=>!I.value||n.isValid()),P=Ae(e,{isValid:()=>$.value});function D(b){return t.computed(()=>!I.value||t.toValue(b))}function E(b){return Object.fromEntries(Object.entries(b).map(([y,M])=>[y,D(M)]))}function x(b){const y=t.toValue(b);if(!y)return;y.querySelector('.k-invalid input, .k-invalid[tabindex="0"]')?.focus()}function A(b){if(F.value){F.value=!1;return}P.onFocusout(b),P.touched.value&&(i.value=!0)}function L(){i.value=!1,F.value=!0,P.reset()}return{touched:i,fieldsetValidate:I,onFocusout:A,reset:L,createFieldValidity:D,createFieldValidationsMap:E,focusFirstInvalidField:x}}function Oe(e){const n=t.ref(""),i=t.ref(void 0),F=t.ref(!!e.debug),I=t.ref(e.dateFormat??"mm/dd/yyyy"),$=t.computed(()=>!!e.required),P=t.ref(!1),D=["ArrowUp","ArrowDown"],E=["ArrowLeft","ArrowRight"],x=t.computed(()=>(n.value??"").replace(/\D/g,"")),A=a=>a<=2?"mm":a<=5?"dd":x.value.length<=10?"yyyy":"mm",L=t.computed(()=>{const a=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(2,"0")}),b=t.computed(()=>{const a=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(2,"0")}),y=t.computed(()=>{const a=n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0";return parseInt(a).toString().padStart(4,"0")}),M=a=>{if(x.value.length===0){e.onChange({value:null,event:a});return}if(x.value.length<8){e.onChange({value:null,event:a});return}if((n.value??"").length===10&&x.value.length===8){const[p,h,U]=n.value.split("/"),K=parseInt(p),N=parseInt(h),_=parseInt(U);if(G(_,K,N)){const ae=new Date(_,K-1,N);R(ae)?e.onChange({value:ae,event:a}):e.onChange({value:null,event:a})}else e.onChange({value:null,event:a})}},R=a=>{const p=e.min??void 0,h=e.max??void 0;return!(p&&a<p||h&&a>h)},f=t.computed(()=>{if((n.value??"").length===10&&x.value.length===8){const[a,p,h]=(n.value??"").split("/"),U=parseInt(a),K=parseInt(p),N=parseInt(h);if(G(N,U,K))return new Date(N,U-1,K)}return null}),S=t.computed(()=>(n.value??"").length===10&&x.value.length===8),q=(a,p)=>new Date(a,p,0).getDate(),G=(a,p,h)=>p>=1&&p<=12&&a>=1900&&h>=1&&h<=q(a,p),W=a=>{n.value=a.value;const p=a.event?.target;i.value=p?.selectionStart??0,M(a)},J=a=>{i.value=a.target.selectionStart??0},Q=(a,p,h)=>{const U=p?.selectionStart??i.value??0;i.value=U;let K=parseInt(L.value),N=parseInt(b.value),_=parseInt(y.value);if(!(x.value.length>=8)||!G(_,K,N)){const z=e.defaultValue??new Date;K=z.getMonth()+1,N=z.getDate(),_=z.getFullYear(),n.value=`${String(K).padStart(2,"0")}/${String(N).padStart(2,"0")}/${String(_)}`;const B=new Date(_,K-1,N);e.onChange({value:R(B)?B:null,event:h}),d({useRAF:!0});return}const o=A(U);if(o==="mm")K=a==="ArrowUp"?K<12?K+1:1:K>1?K-1:12;else if(o==="dd"){const z=new Date(_,K,0).getDate();N=a==="ArrowUp"?N<z?N+1:1:N>1?N-1:z}else o==="yyyy"&&(_=a==="ArrowUp"?_+1:Math.max(1,_-1));n.value=`${String(K).padStart(2,"0")}/${String(N).padStart(2,"0")}/${String(_)}`;const[s,C,O]=n.value.split("/"),H=new Date(parseInt(O),parseInt(s)-1,parseInt(C));H.toString()!=="Invalid Date"&&parseInt(O)>=1e3?e.onChange({value:R(H)?H:null,event:h}):e.onChange({value:null,event:h}),d({useRAF:!0})},oe=a=>{if(a.code==="Space"||a.key===" "){a.preventDefault(),a.stopPropagation(),e.onShowCalendar(a);return}if(a.key==="ArrowDown"&&a.altKey){a.preventDefault(),a.stopPropagation(),e.onShowCalendar(a);return}if(D.includes(a.key)){if(a.altKey)return;a.preventDefault(),a.stopPropagation();const p=a.target;Q(a.key,p,a);return}},l=a=>{a.preventDefault();const p=a.deltaY<0?"ArrowUp":"ArrowDown";Q(p,a.target,a)},g=a=>{const p=a.target;if(E.includes(a.key)){i.value=p?.selectionStart??0;return}if(D.includes(a.key)){if(a.altKey)return;i.value=p?.selectionStart??0}},u=a=>{P.value=!0,$.value&&!e.defaultValue&&e.externalValue&&e.externalValue.value===void 0&&x.value.length===0&&(e.externalValue.value="");const p=a.target;p&&(i.value=p.selectionStart??0)},d=a=>{const p=()=>{const h=document.getElementById(e.id);if(!h)return;const U=a?.pos??i.value??h.value.length;try{h.focus(),h.setSelectionRange(U,U)}catch{}};t.nextTick(()=>{if(a?.delay&&a.delay>0){setTimeout(p,a.delay);return}if(a?.useRAF){requestAnimationFrame(p);return}p()})};e.externalValue&&t.watch(e.externalValue,a=>{if(a){const p=new Date(a);if(p.toString()!=="Invalid Date"){const h=(p.getMonth()+1).toString().padStart(2,"0"),U=p.getDate().toString().padStart(2,"0"),K=p.getFullYear().toString();n.value=`${h}/${U}/${K}`,d({delay:50});return}}},{immediate:!0});const k=t.computed(()=>[["Date",`${L.value} / ${b.value} / ${y.value}`],["Digits only",x.value],["min",e.min?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null],["max",e.max?.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"})??null]]),m=t.computed(()=>{if(!$.value){if(!S.value)return!0;const p=f.value;return p?R(p):!1}if(!P.value)return!0;const a=f.value;return!S.value||!a?!1:R(a)}),w=t.computed(()=>{if(!$.value){if(!S.value)return;const p=f.value;return p?R(p)?"valid":"out-of-bounds":"invalid-date"}if(!P.value)return;if(x.value.length===0||!S.value)return"incomplete";const a=f.value;return a?R(a)?"valid":"out-of-bounds":"invalid-date"}),V=t.computed(()=>{const a=w.value;if(!a||a==="valid")return"";if(a==="incomplete")return"Required";if(a==="invalid-date")return`Must be in ${I.value} format.`;const p=e.min?e.min.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null,h=e.max?e.max.toLocaleDateString("en-US",{year:"numeric",month:"2-digit",day:"2-digit"}):null;if(a==="out-of-bounds"){if(p&&h)return`Must be between ${p} and ${h}.`;if(p)return`Must be on or after ${p}.`;if(h)return`Must be on or before ${h}.`}return""}),j=()=>{t.nextTick(()=>{const a=document.getElementById(e.id);if(!a){console.warn(`ID (#${e.id}) not found for styling.`);return}const p=a.closest(".k-datepicker");if(!p){console.warn(`.k-datepicker parent not found for #${e.id} styling.`);return}const h=p.parentElement;if(h){if(h.classList.contains("fk-datepicker"))return;h.classList.add("fk-datepicker")}else console.warn(`Parent of .k-datepicker not found for #${e.id} styling.`)})};return t.onMounted(()=>{j()}),{raw:n,cursorPos:i,debugEnabled:F,debugLines:k,placeholder:I,isValid:m,reason:t.readonly(w),validationMessage:V,digitsOnly:x,month:t.readonly(L),day:t.readonly(b),year:t.readonly(y),datePart:A,handleChange:W,handleKeyDown:oe,handleWheel:l,handleKeyUp:g,handleClick:J,handleBlur:u,initStyling:j}}function Ue(e){const n=t.ref(""),i=t.ref(void 0),F=t.ref(!!e.debug),I=t.ref(!1),$=1440*60*1e3,P=365*$,D=new Date,E=new Date(D.getTime()-P),x=new Date(D.getTime()+P);e.min=e.min??E,e.max=e.max??x;const A=t.computed(()=>(n.value??"").replace(/\D/g,"")),L=(r,c)=>new Date(r,c,0).getDate(),b=(r,c,v)=>c>=1&&c<=12&&r>=1e3&&v>=1&&v<=L(r,c),y=r=>Date.UTC(r.getFullYear(),r.getMonth(),r.getDate()),M=r=>{if(!r)return null;const c=e.min??new Date(Date.now()-90*$),v=e.max??new Date,T=y(r);return T<y(c)||T>y(v)?null:r},R=(r,c)=>e.allowReverse??!1?!0:r<=c,f=t.computed(()=>(n.value?.length??0)>=23&&A.value.length>=16),S=r=>{if((r??"").length<23||A.value.length<16)return{start:null,end:null};const c=r.substring(0,10),v=r.substring(13,23),[T,ee,te]=c.split("/").map(se=>parseInt(se||"0",10)),[ie,ce,de]=v.split("/").map(se=>parseInt(se||"0",10)),fe=new Date(te,T-1,ee),ye=new Date(de,ie-1,ce),Se=b(te,T,ee)&&fe.toString()!=="Invalid Date",be=b(de,ie,ce)&&ye.toString()!=="Invalid Date";return{start:Se?fe:null,end:be?ye:null}},q=e.externalValid??t.ref(!0),G=t.computed(()=>S(n.value)),W=t.computed(()=>{const r=M(G.value.start),c=M(G.value.end);return{start:r,end:c}}),J=t.computed(()=>{if(!f.value)return;const r=W.value.start,c=W.value.end;if(!r||!c)return;const v=Math.abs(y(c)-y(r));return Math.round(v/864e5+1)}),Q=t.computed(()=>{if(!f.value)return!1;const{start:r,end:c}=G.value;if(!r||!c||!W.value.start||!W.value.end)return!1;const v=W.value.start,T=W.value.end;return!(!R(v,T)||typeof e.maxSpanDays=="number"&&J.value!==void 0&&J.value>e.maxSpanDays)}),oe=t.computed(()=>{const{start:r,end:c}=G.value;if(!f.value)return"incomplete";if(!r||!c)return"invalid-date";if(!W.value.start||!W.value.end)return"out-of-bounds";const v=W.value.start,T=W.value.end;return R(v,T)?typeof e.maxSpanDays=="number"&&J.value!==void 0&&J.value>e.maxSpanDays?"span-exceeds-limit":"valid":"reversed-range"}),l=t.ref(void 0),g=t.computed(()=>{if(q.value!==!1)return"";const{min:r,max:c}=e,v=l.value;if(!v)return"";switch(v){case"incomplete":return"Required";case"invalid-date":return"One or both dates invalid.";case"reversed-range":return"End Date must be on or after Start Date.";case"out-of-bounds":return r&&c?`Dates must be between ${m(r)} and ${m(c)}.`:"Dates must be within the allowed range.";case"span-exceeds-limit":return typeof e.maxSpanDays=="number"?`Date range exceeds ${e.maxSpanDays} days.`:"Date range exceeds maximum allowed span.";default:return""}}),u=["ArrowUp","ArrowDown"],d=["ArrowLeft","ArrowRight"],k=(r,c)=>String(r).padStart(c,"0"),m=r=>`${k(r.getMonth()+1,2)}/${k(r.getDate(),2)}/${k(r.getFullYear(),4)}`,w=r=>r<=2?{side:"start",part:"mm"}:r<=5?{side:"start",part:(r<=3,"dd")}:r<=11?{side:"start",part:"yyyy"}:r<=15?{side:"end",part:"mm"}:r<=18?{side:"end",part:"dd"}:{side:"end",part:"yyyy"},V=(r,c,v)=>{const T=c?.selectionStart??i.value??0;i.value=T;const{start:ee,end:te}=S(n.value);if(!ee&&!te){const Y=new Date,le=m(Y);n.value=`${le} - ${le}`,e.onChange({value:{start:Y,end:Y},event:v}),t.nextTick(()=>{requestAnimationFrame(()=>{const ne=document.getElementById(e.id),re=i.value??0;ne&&(ne.focus(),ne.setSelectionRange(re,re))})});return}const ie=new Date,ce=w(T);let de=ee?new Date(ee):new Date(ie),fe=te?new Date(te):new Date(ie);const ye=(Y,le)=>{if(le==="mm"){const ne=Y.getMonth()+1,re=r==="ArrowUp"?ne<12?ne+1:1:ne>1?ne-1:12;Y.setMonth(re-1);const ge=L(Y.getFullYear(),re);Y.getDate()>ge&&Y.setDate(ge)}else if(le==="dd"){const ne=L(Y.getFullYear(),Y.getMonth()+1),re=Y.getDate(),ge=r==="ArrowUp"?re<ne?re+1:1:re>1?re-1:ne;Y.setDate(ge)}else if(le==="yyyy"){const ne=Y.getFullYear();Y.setFullYear(r==="ArrowUp"?ne+1:Math.max(1,ne-1));const re=L(Y.getFullYear(),Y.getMonth()+1);Y.getDate()>re&&Y.setDate(re)}};ce.side==="start"?ye(de,ce.part):ye(fe,ce.part);const Se=m(de),be=m(fe);n.value=`${Se} - ${be}`;const se=M(de),ke=M(fe);se&&ke&&R(se,ke)?e.onChange({value:{start:se,end:ke},event:v}):e.onChange({value:null,event:v}),t.nextTick(()=>{requestAnimationFrame(()=>{const Y=document.getElementById(e.id),le=i.value??0;Y&&(Y.focus(),Y.setSelectionRange(le,le))})})},j=r=>{const{start:c,end:v}=S(n.value);if(!c||!v){e.onChange({value:null,event:r});return}const T=M(c),ee=M(v);if(!T||!ee){e.onChange({value:null,event:r});return}if(!R(T,ee)){e.onChange({value:null,event:r});return}e.onChange({value:{start:T,end:ee},event:r})},a=r=>{const c=r.value??"",v=r.event;if(!c&&v&&v.type==="click"){ae(v);return}n.value=c;const T=v?.target;i.value=T?.selectionStart??0,j(r)},p=r=>{i.value=r.target.selectionStart??0},h=r=>{if(r.code==="Space"||r.key===" "){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(r.key==="ArrowDown"&&r.altKey){r.preventDefault(),r.stopPropagation(),e.onShowCalendar(r);return}if(u.includes(r.key)){r.preventDefault(),r.stopPropagation();const c=r.target;V(r.key,c,r);return}},U=r=>{r.preventDefault();const c=r.deltaY<0?"ArrowUp":"ArrowDown";V(c,r.target,r)},K=r=>{if(d.includes(r.key)||u.includes(r.key)){const c=r.target;i.value=c?.selectionStart??0}},N=()=>{l.value=oe.value,(e.manageValid??!0)&&(q.value=Q.value)},_=r=>{N()},ae=r=>{console.log("Clear event:",r),n.value="",i.value=0,e.onChange({value:null,event:r}),N(),t.nextTick(()=>{const c=document.getElementById(e.id);c&&(c.focus(),c.setSelectionRange(0,0))})};e.externalValue&&t.watch(e.externalValue,r=>{const c=r?.start??null,v=r?.end??null;if(c&&v){if(n.value=`${m(c)} - ${m(v)}`,e.isOpen?.value&&I.value&&e.onRequestClose){const T=typeof e.closeDelay=="number"?e.closeDelay:e.closeDelay?.value??0;setTimeout(()=>{e.onRequestClose?.(),I.value=!1,N()},T)}return}},{immediate:!0});const o=t.computed(()=>n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0"),s=t.computed(()=>n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0"),C=t.computed(()=>n.value&&n.value.substring(6,10).replace(/\D/g,"0")||"0"),O=t.computed(()=>n.value&&n.value.substring(13,15).replace(/\D/g,"0")||"0"),H=t.computed(()=>n.value&&n.value.substring(16,18).replace(/\D/g,"0")||"0"),z=t.computed(()=>n.value&&n.value.substring(19,23).replace(/\D/g,"0")||"0"),B=t.computed(()=>{const{start:r,end:c}=S(n.value);return[{label:"Raw",value:n.value},{label:"Min Date",value:`${e.min?e.min.toDateString():"-"}`},{label:"Max Date",value:`${e.max?e.max.toDateString():"-"}`},{label:"Start",value:`${String(o.value).padStart(2,"0")} / ${String(s.value).padStart(2,"0")} / ${String(C.value).padStart(4,"0")}`},{label:"End",value:`${String(O.value).padStart(2,"0")} / ${String(H.value).padStart(2,"0")} / ${String(z.value).padStart(4,"0")}`},{label:"Digits only",value:A.value},{label:"Mask complete",value:`${f.value}`},{label:"Parsed",value:`${r?r.toDateString():"-"} | ${c?c.toDateString():"-"}`},{label:"Valid (managed)",value:`${q.value??"-"}`},{label:"Span (days)",value:`${J.value??"-"}`},{label:"Reason",value:`${oe.value??"-"}`},{label:"Cursor in",value:`${i.value??"-"} (${(()=>{const v=i.value??0,T=w(v);return`${T.side}.${T.part}`})()})`}]}),Z=()=>{t.nextTick(()=>{const r=document.getElementById(e.id);if(!r){console.warn(`#${e.id} not found for styling.`);return}const c=r.closest("div");if(!c){console.warn(`Parent div of #${e.id} not found for styling.`);return}c.classList.contains("fk-daterangepicker")||c.classList.add("fk-daterangepicker")})};t.onMounted(()=>{Z()});const me=()=>{t.nextTick(()=>{try{const r=Array.from(document.querySelectorAll(".k-animation-container"));if(!r.length)return;const v=[...r].reverse().find(te=>te.querySelector(".k-calendar"))?.querySelector(".k-calendar");if(!v)return;const T=v.querySelectorAll(".k-calendar-table");let ee=!1;T.forEach(te=>{te.tabIndex===0&&(ee?te.tabIndex=-1:ee=!0)})}catch(r){console.warn(r)}})};return e.isOpen&&t.watch(e.isOpen,r=>{r&&setTimeout(()=>me(),0)},{immediate:!1}),{raw:n,cursorPos:i,debugEnabled:F,debugLines:B,digitsOnly:A,valid:q,validComputed:t.readonly(Q),reason:t.readonly(oe),validationMessage:t.readonly(g),spanDays:t.readonly(J),month1:t.readonly(o),day1:t.readonly(s),year1:t.readonly(C),month2:t.readonly(O),day2:t.readonly(H),year2:t.readonly(z),handleChange:a,handleKeyDown:h,handleWheel:U,handleKeyUp:K,handleClick:p,handleBlur:_,handleClear:ae,onCalendarChange:()=>{I.value=!0},initStyling:Z}}function Be(e){const n=t.ref(""),i=t.ref(void 0),F=t.ref(!!e.debug),I=t.ref(e.timeFormat??"hh:mm AM"),$=t.computed(()=>!!e.required),P=t.ref(!1),D=["ArrowUp","ArrowDown"],E=["ArrowLeft","ArrowRight"],x=t.computed(()=>(n.value??"").replace(/\D/g,"")),A={H:/[0-9]/,h:/[0-9]/,M:/[0-9]/,m:/[0-9]/,A:/[AaPp]/,a:/[Mm]/},L=o=>o<=2?"hh":o<=5?"mm":"ampm",b=t.computed(()=>{const o=n.value&&n.value.substring(0,2).replace(/\D/g,"0")||"0",s=parseInt(o);return Math.min(Math.max(s,0),23)}),y=t.computed(()=>{const o=n.value&&n.value.substring(3,5).replace(/\D/g,"0")||"0",s=parseInt(o);return Math.min(Math.max(s,0),59)}),M=t.computed(()=>(n.value?.substring(6,8)||"AM").toUpperCase().startsWith("P")?"PM":"AM"),R=t.computed(()=>{const o=parseInt(n.value?.substring(0,2).replace(/\D/g,"0")||"0"),s=M.value;return o===12?s==="AM"?0:12:s==="PM"?o+12:o}),f=t.computed(()=>S.value?`${String(R.value).padStart(2,"0")}:${String(y.value).padStart(2,"0")}:00`:null),S=t.computed(()=>/^(\d{2}):(\d{2})\s([AP]M)$/i.test(n.value??"")),q=(o,s,C)=>{let O=o%12;return O===0&&(O=12),`${String(O).padStart(2,"0")}:${String(s).padStart(2,"0")} ${C}`},G=o=>{const s=o.match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!s)return null;const C=parseInt(s[1]),O=parseInt(s[2]),H=s[3].toUpperCase();if(C<1||C>12||O<0||O>59)return null;let z=C%12;H==="PM"&&(z+=12);const B=new Date;return B.setSeconds(0,0),B.setHours(z),B.setMinutes(O),B},W=o=>{if(x.value.length===0){e.onChange({value:null,event:o});return}if(!S.value){e.onChange({value:null,event:o});return}const s=G(n.value);s&&Q(s)?e.onChange({value:s,event:o}):e.onChange({value:null,event:o})},J=o=>o.getHours()*60+o.getMinutes(),Q=o=>{const s=e.min??void 0,C=e.max??void 0,O=J(o);if(s){const H=J(s);if(O<H)return!1}if(C){const H=J(C);if(O>H)return!1}return!0},oe=o=>{const s=o.getHours(),C=s>=12?"PM":"AM";n.value=q(s,o.getMinutes(),C)},l=(o,s)=>{e.onChange({value:o,event:s})},g=()=>{t.nextTick(()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{const o=document.getElementById(e.id);if(o){o.focus();const s=(o.value??"").length;o.setSelectionRange(s,s)}})})})},u=o=>{const s=o?.event?.target;return s?s.closest(".k-time-now")?"now":s.closest(".k-time-accept")?"set":null:null},d=(o,s)=>{o&&Q(o)?l(o,s):l(null,s)},k=(...o)=>{const s=o[0];if(!s)return;const C=u(s);if(C==="now"){const H=new Date;oe(H),d(H,s),g();return}if(s?.value instanceof Date){const H=new Date(s.value);oe(H),d(H,s),C==="set"&&g();return}if(s?.value===null){n.value="",l(null,s);return}n.value=s.value;const O=s.event?.target;i.value=O?.selectionStart??0;try{const H=i.value??0;if(L(H)==="ampm"&&(n.value??"").length>=8){const z=n.value.charAt(6);/[Aa]/.test(z)?(n.value=`${n.value.slice(0,6)}AM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const B=document.getElementById(e.id);B&&(B.focus(),B.setSelectionRange(8,8))})})):/[Pp]/.test(z)&&(n.value=`${n.value.slice(0,6)}PM${n.value.slice(8)}`,t.nextTick(()=>{requestAnimationFrame(()=>{const B=document.getElementById(e.id);B&&(B.focus(),B.setSelectionRange(8,8))})}))}}catch{}W(s)},m=o=>{i.value=o.target.selectionStart??0},w=(o,s,C)=>{const O=s?.selectionStart??i.value??0;i.value=O;const H=L(O),z=(n.value??"").match(/^(\d{2}):(\d{2})\s([AP]M)$/i);if(!z){if((n.value??"").length===0||x.value.length===0){const c=new Date,v=c.getHours(),T=v>=12?"PM":"AM";n.value=q(v,c.getMinutes(),T);const ee=G(n.value);d(ee,C),t.nextTick(()=>{requestAnimationFrame(()=>{const te=document.getElementById(e.id),ie=i.value??0;te&&(te.focus(),te.setSelectionRange(ie,ie))})})}return}let B=parseInt(z[1]),Z=parseInt(z[2]),me=z[3].toUpperCase();if(H==="hh")o==="ArrowUp"?B=B<12?B+1:1:B=B>1?B-1:12;else if(H==="mm"){const c=e.minuteStepRef?.value??e.minuteStep??1;if(c===1)o==="ArrowUp"?Z=Z<59?Z+1:0:Z=Z>0?Z-1:59;else if(o==="ArrowUp"){const v=Z%c;let T=v===0?Z+c:Z+(c-v);T>=60&&(T=0),Z=T}else{const v=Z%c;let T=v===0?Z-c:Z-v;T<0&&(T=60-c),Z=T}}else H==="ampm"&&(me=me==="AM"?"PM":"AM");n.value=`${String(B).padStart(2,"0")}:${String(Z).padStart(2,"0")} ${me}`;const r=G(n.value);d(r,C),t.nextTick(()=>{requestAnimationFrame(()=>{const c=document.getElementById(e.id),v=i.value??0;c&&(c.focus(),c.setSelectionRange(v,v))})})},V=o=>{if(o.code==="Space"||o.key===" "){o.preventDefault(),o.stopPropagation(),e.onShowPicker(o);return}if(o.key==="ArrowDown"&&o.altKey){o.preventDefault(),o.stopPropagation(),e.onShowPicker(o);return}if(D.includes(o.key)){if(o.altKey)return;o.preventDefault(),o.stopPropagation();const s=o.target;w(o.key,s,o);return}},j=o=>{o.preventDefault();const s=o.deltaY<0?"ArrowUp":"ArrowDown";w(s,o.target,o)},a=o=>{const s=o.target;if(E.includes(o.key)){i.value=s?.selectionStart??0;return}if(D.includes(o.key)){if(o.altKey)return;i.value=s?.selectionStart??0}},p=o=>{P.value=!0,$.value&&e.externalValue&&e.externalValue.value===void 0&&x.value.length===0&&(e.externalValue.value="");const s=o.target;s&&(i.value=s.selectionStart??0)};e.externalValue&&t.watch(e.externalValue,o=>{if(o){const s=new Date(o);if(s.toString()!=="Invalid Date"){const C=s.getHours(),O=C>=12?"PM":"AM";n.value=q(C,s.getMinutes(),O);return}}},{immediate:!0});const h=t.computed(()=>[["Time",n.value||"--:-- --"],["Hour (12h)",b.value],["Hour (24h)",R.value],["Minute",y.value],["Period",M.value],["Time (24h)",f.value??"--:--:--"],["Digits only",x.value],["Parsed Date",U.value?.toLocaleDateString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["min",e.min?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["max",e.max?.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"})??null],["valid",K.value],["reason",N.value],["validationMessage",_.value]]),U=t.computed(()=>G(n.value)??null),K=t.computed(()=>{if(!$.value){if(!S.value)return!0;const s=U.value;return s?Q(s):!1}if(!P.value)return!0;const o=U.value;return!S.value||!o?!1:Q(o)}),N=t.computed(()=>{if(!$.value){if(!S.value)return;const s=U.value;return s?Q(s)?"valid":"out-of-bounds":"invalid-time"}if(!P.value)return;if(x.value.length===0||!S.value)return"incomplete";const o=U.value;return o?Q(o)?"valid":"out-of-bounds":"invalid-time"}),_=t.computed(()=>{const o=N.value;if(!o||o==="valid")return"";if(o==="incomplete")return"Required";if(o==="invalid-time")return`Must be in ${I.value} format.`;const s={hour:"2-digit",minute:"2-digit"},C=e.min?e.min.toLocaleTimeString("en-US",s):null,O=e.max?e.max.toLocaleTimeString("en-US",s):null;if(o==="out-of-bounds"){if(C&&O)return`Must be between ${C} and ${O}.`;if(C)return`Must be ${C} or later.`;if(O)return`Must be ${O} or earlier.`}return""}),ae=()=>{t.nextTick(()=>{const o=document.getElementById(e.id);if(!o){console.warn(`#${e.id} not found for styling.`);return}const s=o.closest(".k-timepicker");if(!s){console.warn(`.k-timepicker parent of #${e.id} not found for styling.`);return}const C=s.parentElement;if(!C){console.warn(`Parent of .k-timepicker not found for #${e.id} styling.`);return}C.classList.contains("fk-timepicker")||C.classList.add("fk-timepicker")})};return t.onMounted(()=>{ae()}),{raw:n,rules:A,debugEnabled:F,debugLines:h,placeholder:I,isValid:K,reason:t.readonly(N),validationMessage:_,isComplete:S,inRangeTime:Q,cursorPos:i,hour:t.readonly(b),hour24:t.readonly(R),minute:t.readonly(y),period:t.readonly(M),time24:t.readonly(f),parsedRawTime:t.readonly(U),handleChange:k,handleKeyDown:V,handleKeyUp:a,handleClick:m,handleWheel:j,handleBlur:p,initStyling:ae}}function Ke(e){return t.getCurrentScope()?(t.onScopeDispose(e),!0):!1}const xe=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ne=Object.prototype.toString,He=e=>Ne.call(e)==="[object Object]",ue=()=>{},Ye=je();function je(){var e,n;return xe&&((e=window?.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((n=window?.navigator)==null?void 0:n.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function he(e){return Array.isArray(e)?e:[e]}function Ge(e,n,i){return t.watch(e,n,{...i,immediate:!0})}const Ee=xe?window:void 0;function pe(e){var n;const i=t.toValue(e);return(n=i?.$el)!=null?n:i}function ve(...e){const n=[],i=()=>{n.forEach(D=>D()),n.length=0},F=(D,E,x,A)=>(D.addEventListener(E,x,A),()=>D.removeEventListener(E,x,A)),I=t.computed(()=>{const D=he(t.toValue(e[0])).filter(E=>E!=null);return D.every(E=>typeof E!="string")?D:void 0}),$=Ge(()=>{var D,E;return[(E=(D=I.value)==null?void 0:D.map(x=>pe(x)))!=null?E:[Ee].filter(x=>x!=null),he(t.toValue(I.value?e[1]:e[0])),he(t.unref(I.value?e[2]:e[1])),t.toValue(I.value?e[3]:e[2])]},([D,E,x,A])=>{if(i(),!D?.length||!E?.length||!x?.length)return;const L=He(A)?{...A}:A;n.push(...D.flatMap(b=>E.flatMap(y=>x.map(M=>F(b,y,M,L)))))},{flush:"post"}),P=()=>{$(),i()};return Ke(i),P}let Me=!1;function We(e,n,i={}){const{window:F=Ee,ignore:I=[],capture:$=!0,detectIframe:P=!1,controls:D=!1}=i;if(!F)return D?{stop:ue,cancel:ue,trigger:ue}:ue;if(Ye&&!Me){Me=!0;const f={passive:!0};Array.from(F.document.body.children).forEach(S=>S.addEventListener("click",ue,f)),F.document.documentElement.addEventListener("click",ue,f)}let E=!0;const x=f=>t.toValue(I).some(S=>{if(typeof S=="string")return Array.from(F.document.querySelectorAll(S)).some(q=>q===f.target||f.composedPath().includes(q));{const q=pe(S);return q&&(f.target===q||f.composedPath().includes(q))}});function A(f){const S=t.toValue(f);return S&&S.$.subTree.shapeFlag===16}function L(f,S){const q=t.toValue(f),G=q.$.subTree&&q.$.subTree.children;return G==null||!Array.isArray(G)?!1:G.some(W=>W.el===S.target||S.composedPath().includes(W.el))}const b=f=>{const S=pe(e);if(f.target!=null&&!(!(S instanceof Element)&&A(e)&&L(e,f))&&!(!S||S===f.target||f.composedPath().includes(S))){if("detail"in f&&f.detail===0&&(E=!x(f)),!E){E=!0;return}n(f)}};let y=!1;const M=[ve(F,"click",f=>{y||(y=!0,setTimeout(()=>{y=!1},0),b(f))},{passive:!0,capture:$}),ve(F,"pointerdown",f=>{const S=pe(e);E=!x(f)&&!!(S&&!f.composedPath().includes(S))},{passive:!0}),P&&ve(F,"blur",f=>{setTimeout(()=>{var S;const q=pe(e);((S=F.document.activeElement)==null?void 0:S.tagName)==="IFRAME"&&!q?.contains(F.document.activeElement)&&n(f)},0)},{passive:!0})].filter(Boolean),R=()=>M.forEach(f=>f());return D?{stop:R,cancel:()=>{E=!1},trigger:f=>{E=!0,b(f),E=!1}}:R}function ze(e){const n=t.shallowRef(null),i=[".k-animation-container .k-popup",".k-popup",".k-timepicker-popup",".k-menu-popup"],F=Array.isArray(e.popupSelector)?e.popupSelector:[e.popupSelector??i].flat(),I=A=>A?typeof e.initialFocus=="string"?A.querySelector(e.initialFocus)??A:typeof e.initialFocus=="function"?e.initialFocus(A)??A:A.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')??A:null,{activate:$,deactivate:P}=Te.useFocusTrap(n,{escapeDeactivates:!1,clickOutsideDeactivates:!1,fallbackFocus:()=>n.value,initialFocus:()=>I(n.value),...e.focusTrapOptions??{}});let D=null,E=t.ref(null);const x=()=>{if(e.resolvePopupEl)return e.resolvePopupEl();const A=(b,y)=>{const M=Array.from(b.querySelectorAll(y));if(!M.length)return null;const R=M.filter(f=>f.offsetParent!==null||f.getClientRects().length>0);return R[R.length-1]??M[M.length-1]??null},L=e.triggerEl?.value?.closest?.(".k-animation-container")??document.body;for(const b of F){const y=A(L,b);if(y)return y}for(const b of F){const y=A(document,b);if(y)return y}return null};return We(n,A=>{E.value="outside",e.isOpen.value&&e.onRequestClose?.("outside",A)}),t.watch(()=>e.isOpen.value,A=>{A?(E.value=null,t.nextTick(()=>{const L=x();L&&(n.value=L,setTimeout(()=>$(),0),D||(D=b=>{b.key==="Escape"&&(E.value="escape",e.isOpen.value&&e.onRequestClose?.("escape",b))},document.addEventListener("keydown",D,!0)))})):(P(),D&&(document.removeEventListener("keydown",D,!0),D=null),n.value=null,E.value==="outside"&&t.nextTick(()=>{const L=()=>{const b=e.triggerEl?.value,y=b?.querySelector("input"),M=document.activeElement;M&&(M===y||b&&b.contains(M))&&(y??b)?.blur?.()};requestAnimationFrame(()=>setTimeout(L,0))}),e.returnFocusToTrigger!==!1&&E.value==="escape"&&e.triggerEl?.value&&(console.log("Returning focus to trigger element:",e.triggerEl.value),t.nextTick(()=>{const L=()=>{const b=e.triggerEl?.value;if(!b)return;(b.querySelector("input")??b)?.focus?.()};requestAnimationFrame(()=>setTimeout(L,0))})))}),{popupRef:n,activate:$,deactivate:P,lastCloseReason:t.readonly(E),setPopupEl:A=>n.value=A}}X.useFieldsetTouchTracker=Ae,X.useFieldsetValidationKit=Ve,X.useGridA11y=Ie,X.useGridActiveFilter=Pe,X.useMaskedDateInput=Oe,X.useMaskedDateRangeInput=Ue,X.useMaskedTimeInput=Be,X.usePopupTrap=ze,X.useZipTextBox=qe,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { useFieldsetTouchTracker } from "./useFieldsetTouchTracker";
|
|
2
|
+
export type { UseFieldsetTouchTrackerOptions, UseFieldsetTouchTrackerApi, } from "./useFieldsetTouchTracker";
|
|
3
|
+
export { useFieldsetValidationKit } from "./useFieldsetValidationKit";
|
|
4
|
+
export type { UseFieldsetValidationKitOptions, UseFieldsetValidationKitApi, } from "./useFieldsetValidationKit";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Ref } from "vue";
|
|
2
|
+
export interface UseFieldsetTouchTrackerOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Function that returns whether the fieldset is valid.
|
|
5
|
+
*/
|
|
6
|
+
isValid: () => boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface UseFieldsetTouchTrackerApi {
|
|
9
|
+
touched: Ref<boolean>;
|
|
10
|
+
onFocusout: (event: FocusEvent) => void;
|
|
11
|
+
reset: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function useFieldsetTouchTracker(fieldsetRef: Ref<HTMLFieldSetElement | null>, options: UseFieldsetTouchTrackerOptions): UseFieldsetTouchTrackerApi;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type ComputedRef, type MaybeRefOrGetter, type Ref } from "vue";
|
|
2
|
+
export interface UseFieldsetValidationKitOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Consumer-owned submit state. The kit reads this value but never mutates it.
|
|
5
|
+
*/
|
|
6
|
+
submitted: MaybeRefOrGetter<boolean>;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the real validity of the fieldset when validation is active.
|
|
9
|
+
*/
|
|
10
|
+
isValid: () => boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* API returned by {@link useFieldsetValidationKit}.
|
|
14
|
+
*/
|
|
15
|
+
export interface UseFieldsetValidationKitApi {
|
|
16
|
+
/**
|
|
17
|
+
* Becomes true after the first focus transition that leaves the fieldset.
|
|
18
|
+
*/
|
|
19
|
+
touched: Ref<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Delayed validation gate. True when either submitted or touched is true.
|
|
22
|
+
*/
|
|
23
|
+
fieldsetValidate: ComputedRef<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Forwards fieldset focusout events to the internal touch tracker.
|
|
26
|
+
*/
|
|
27
|
+
onFocusout: (event: FocusEvent) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Clears touched state and suppresses one immediate post-reset focusout.
|
|
30
|
+
*
|
|
31
|
+
* This avoids re-activating delayed validation from reset-related focus
|
|
32
|
+
* transitions (for example, clicking Reset while an input is focused).
|
|
33
|
+
*/
|
|
34
|
+
reset: () => void;
|
|
35
|
+
/**
|
|
36
|
+
* Wraps a field-level validity source with delayed validation behavior.
|
|
37
|
+
*/
|
|
38
|
+
createFieldValidity: (isValid: MaybeRefOrGetter<boolean>) => ComputedRef<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Builds a named map of delayed field validity refs for ergonomic form setup.
|
|
41
|
+
*/
|
|
42
|
+
createFieldValidationsMap: <T extends Record<string, MaybeRefOrGetter<boolean>>>(isValidMap: T) => {
|
|
43
|
+
[K in keyof T]: ComputedRef<boolean>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Moves focus to the first invalid Kendo control found within the provided form.
|
|
47
|
+
*/
|
|
48
|
+
focusFirstInvalidField: (formRef: MaybeRefOrGetter<HTMLFormElement | null>) => void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Orchestrates delayed fieldset validation using submit state and touch state.
|
|
52
|
+
*
|
|
53
|
+
* Intended as the primary form-level API for gated validity UX:
|
|
54
|
+
* - validation displays after submit or first fieldset exit
|
|
55
|
+
* - field-level validity can be composed through helper factories
|
|
56
|
+
* - invalid focus and reset behavior are handled consistently
|
|
57
|
+
*
|
|
58
|
+
* @param fieldsetRef Reference to the fieldset whose focus transitions are tracked.
|
|
59
|
+
* @param options Consumer-provided submit state and base validity function.
|
|
60
|
+
* @returns Validation kit API for wiring fieldset-level and field-level behavior.
|
|
61
|
+
*/
|
|
62
|
+
export declare function useFieldsetValidationKit(fieldsetRef: Ref<HTMLFieldSetElement | null>, options: UseFieldsetValidationKitOptions): UseFieldsetValidationKitApi;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -19,18 +19,25 @@ import { TextBox } from "@progress/kendo-vue-inputs";
|
|
|
19
19
|
import { Error } from "@progress/kendo-vue-labels";
|
|
20
20
|
import { useZipTextBox } from "@featherk/composables";
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const {
|
|
23
|
+
zipDisplay,
|
|
24
|
+
errorMessage,
|
|
25
|
+
textBoxValid,
|
|
26
|
+
textBoxValidate,
|
|
27
|
+
wrapperClass,
|
|
28
|
+
showZipError,
|
|
29
|
+
zipRaw,
|
|
30
|
+
submitAndValidate,
|
|
31
|
+
handleZipInput,
|
|
32
|
+
} = useZipTextBox({
|
|
33
|
+
id: "zip", // required — must match the TextBox id attribute
|
|
34
|
+
initialValue: "", // optional pre-populated value (digits or formatted)
|
|
25
35
|
errorMessage: "Enter a valid ZIP code.", // optional custom message
|
|
26
36
|
});
|
|
27
37
|
|
|
28
|
-
const { zipDisplay, errorMessage, textBoxValid, textBoxValidate, wrapperClass } = zip;
|
|
29
|
-
|
|
30
38
|
const handleSubmit = () => {
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
console.log("ZIP (digits only):", zipValue); // e.g. "902101234"
|
|
39
|
+
if (submitAndValidate()) {
|
|
40
|
+
console.log({ zip: zipRaw.value }); // e.g. { zip: "902101234" }
|
|
34
41
|
}
|
|
35
42
|
};
|
|
36
43
|
</script>
|
|
@@ -44,9 +51,9 @@ const handleSubmit = () => {
|
|
|
44
51
|
:validate="textBoxValidate"
|
|
45
52
|
:validityStyles="textBoxValidate"
|
|
46
53
|
placeholder="XXXXX or XXXXX-XXXX"
|
|
47
|
-
@input="
|
|
54
|
+
@input="handleZipInput"
|
|
48
55
|
/>
|
|
49
|
-
<Error for="zip" v-if="
|
|
56
|
+
<Error for="zip" v-if="showZipError">{{ errorMessage }}</Error>
|
|
50
57
|
|
|
51
58
|
<button @click="handleSubmit">Submit</button>
|
|
52
59
|
</template>
|
|
@@ -67,7 +74,7 @@ const handleSubmit = () => {
|
|
|
67
74
|
| Property | Type | Description |
|
|
68
75
|
|----------|------|-------------|
|
|
69
76
|
| `zipDisplay` | `Ref<string>` | The formatted display value bound to the `TextBox`. Either `XXXXX` or `XXXXX-XXXX`. |
|
|
70
|
-
| `submitted` | `Ref<boolean>` | Whether `submitAndValidate()` has been called. Drives error visibility.
|
|
77
|
+
| `submitted` | `Ref<boolean>` | Whether `submitAndValidate()` has been called. Drives error visibility. Use `submitted.value` directly (e.g. to reset) — not typically bound in the template. |
|
|
71
78
|
| `errorMessage` | `Ref<string>` | Active error message (custom or default). |
|
|
72
79
|
|
|
73
80
|
### Bindings (readonly `string`)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# useFieldsetTouchTracker
|
|
2
|
+
|
|
3
|
+
[← Back to Composables README](https://github.com/NantHealth/featherk/blob/integration/packages/composables/README.md)
|
|
4
|
+
|
|
5
|
+
Low-level composable that tracks when focus leaves a fieldset and synchronizes the fieldset `aria-invalid` attribute from a provided validity function.
|
|
6
|
+
|
|
7
|
+
This is a primitive used by `useFieldsetValidationKit`. Most app-level form workflows should use the kit first and only use this composable directly for custom orchestration.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- Vue 3 Composition API
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { ref } from "vue";
|
|
18
|
+
import { useFieldsetTouchTracker } from "@featherk/composables/form";
|
|
19
|
+
|
|
20
|
+
const fieldsetRef = ref<HTMLFieldSetElement | null>(null);
|
|
21
|
+
const isValid = ref(false);
|
|
22
|
+
|
|
23
|
+
const { touched, onFocusout, reset } = useFieldsetTouchTracker(fieldsetRef, {
|
|
24
|
+
isValid: () => isValid.value,
|
|
25
|
+
});
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<fieldset ref="fieldsetRef" @focusout="onFocusout">
|
|
30
|
+
<!-- fields -->
|
|
31
|
+
</fieldset>
|
|
32
|
+
|
|
33
|
+
<button type="button" @click="reset">Reset Touch State</button>
|
|
34
|
+
<p>Touched: {{ touched }}</p>
|
|
35
|
+
</template>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## API
|
|
39
|
+
|
|
40
|
+
### useFieldsetTouchTracker(fieldsetRef, options)
|
|
41
|
+
|
|
42
|
+
Tracks focus transitions for one fieldset.
|
|
43
|
+
|
|
44
|
+
#### Parameters
|
|
45
|
+
|
|
46
|
+
| Parameter | Type | Description |
|
|
47
|
+
|----------|------|-------------|
|
|
48
|
+
| `fieldsetRef` | `Ref<HTMLFieldSetElement \| null>` | Ref for the target fieldset. |
|
|
49
|
+
| `options.isValid` | `() => boolean` | Current validity function used to set `aria-invalid`. |
|
|
50
|
+
|
|
51
|
+
#### Returns
|
|
52
|
+
|
|
53
|
+
| Property | Type | Description |
|
|
54
|
+
|----------|------|-------------|
|
|
55
|
+
| `touched` | `Ref<boolean>` | Becomes `true` after a focus transition that leaves the fieldset. |
|
|
56
|
+
| `onFocusout` | `(event: FocusEvent) => void` | Focusout handler to bind on the fieldset. |
|
|
57
|
+
| `reset` | `() => void` | Sets `touched` back to `false`. |
|
|
58
|
+
|
|
59
|
+
## Behavior Notes
|
|
60
|
+
|
|
61
|
+
- `aria-invalid` is kept in sync with `!options.isValid()` via `watchEffect`.
|
|
62
|
+
- A focusout counts as "leaving" when the next focused element (`event.relatedTarget`) is not inside the fieldset.
|
|
63
|
+
- If `fieldsetRef.value` is `null`, the handler falls back to `event.currentTarget`.
|
|
64
|
+
|
|
65
|
+
## When to Use vs Validation Kit
|
|
66
|
+
|
|
67
|
+
Use `useFieldsetTouchTracker` when you want full control over delayed validation behavior.
|
|
68
|
+
|
|
69
|
+
Use `useFieldsetValidationKit` when you want:
|
|
70
|
+
|
|
71
|
+
- submit-or-touch gating (`submitted || touched`)
|
|
72
|
+
- delayed field-validity helpers
|
|
73
|
+
- focus-first-invalid helper
|
|
74
|
+
- reset handling for post-reset focus churn
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# useFieldsetValidationKit
|
|
2
|
+
|
|
3
|
+
[← Back to Composables README](https://github.com/NantHealth/featherk/blob/integration/packages/composables/README.md)
|
|
4
|
+
|
|
5
|
+
Form orchestration composable for delayed fieldset validation UX.
|
|
6
|
+
|
|
7
|
+
`useFieldsetValidationKit` composes `useFieldsetTouchTracker` and provides a kit-oriented API for:
|
|
8
|
+
|
|
9
|
+
- delayed validation gate (`submitted || touched`)
|
|
10
|
+
- field-level delayed validity wrappers
|
|
11
|
+
- first-invalid focus targeting
|
|
12
|
+
- reset behavior that avoids immediate re-trigger from reset-related focus transitions
|
|
13
|
+
|
|
14
|
+
> `focusFirstInvalidField` is currently included as a convenience helper. It is
|
|
15
|
+
> form-scoped rather than fieldset-scoped, so it does not cleanly belong to this
|
|
16
|
+
> kit and is expected to move to a separate utility in a future release.
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
- Vue 3 Composition API
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```vue
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
import { computed, ref } from "vue";
|
|
27
|
+
import { useFieldsetValidationKit } from "@featherk/composables/form";
|
|
28
|
+
|
|
29
|
+
const fieldsetRef = ref<HTMLFieldSetElement | null>(null);
|
|
30
|
+
const formRef = ref<HTMLFormElement | null>(null);
|
|
31
|
+
|
|
32
|
+
const submitted = ref(false);
|
|
33
|
+
|
|
34
|
+
const firstName = ref("");
|
|
35
|
+
const city = ref("");
|
|
36
|
+
|
|
37
|
+
const firstNameValidRule = computed(() => firstName.value.trim().length >= 2);
|
|
38
|
+
const cityValidRule = computed(() => city.value.trim().length >= 2);
|
|
39
|
+
|
|
40
|
+
const isFieldsetValid = computed(
|
|
41
|
+
() => firstNameValidRule.value && cityValidRule.value,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const kit = useFieldsetValidationKit(fieldsetRef, {
|
|
45
|
+
submitted,
|
|
46
|
+
isValid: () => isFieldsetValid.value,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const { touched, fieldsetValidate, onFocusout, reset, focusFirstInvalidField } =
|
|
50
|
+
kit;
|
|
51
|
+
|
|
52
|
+
const fieldValidations = kit.createFieldValidationsMap({
|
|
53
|
+
firstName: () => firstNameValidRule.value,
|
|
54
|
+
city: () => cityValidRule.value,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// fieldValidations.firstName and fieldValidations.city are ComputedRef<boolean>
|
|
58
|
+
// values that stay true until fieldset validation is active.
|
|
59
|
+
|
|
60
|
+
function onSubmit() {
|
|
61
|
+
submitted.value = true;
|
|
62
|
+
if (!isFieldsetValid.value) {
|
|
63
|
+
focusFirstInvalidField(formRef);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function onReset() {
|
|
68
|
+
submitted.value = false;
|
|
69
|
+
reset();
|
|
70
|
+
}
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<template>
|
|
74
|
+
<form ref="formRef" @submit.prevent="onSubmit" @reset.prevent="onReset">
|
|
75
|
+
<fieldset ref="fieldsetRef" @focusout="onFocusout">
|
|
76
|
+
<!-- controls bind to fieldsetValidate + fieldValidations -->
|
|
77
|
+
</fieldset>
|
|
78
|
+
</form>
|
|
79
|
+
|
|
80
|
+
<p>Touched: {{ touched }}</p>
|
|
81
|
+
<p>Validate: {{ fieldsetValidate }}</p>
|
|
82
|
+
</template>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## What createFieldValidationsMap Returns
|
|
86
|
+
|
|
87
|
+
You pass one object argument whose properties are the field rules:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const rules = {
|
|
91
|
+
firstName: () => firstNameValidRule.value,
|
|
92
|
+
city: () => cityValidRule.value,
|
|
93
|
+
};
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
And the kit returns the same shape, but each field becomes a delayed
|
|
97
|
+
`ComputedRef<boolean>`:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
const fieldValidations = kit.createFieldValidationsMap(rules);
|
|
101
|
+
|
|
102
|
+
fieldValidations.firstName.value;
|
|
103
|
+
fieldValidations.city.value;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
This is important because it lets you define field rules once, keep the field
|
|
107
|
+
names intact, and apply the same delayed-validation gate consistently across
|
|
108
|
+
the whole fieldset.
|
|
109
|
+
|
|
110
|
+
## API
|
|
111
|
+
|
|
112
|
+
### useFieldsetValidationKit(fieldsetRef, options)
|
|
113
|
+
|
|
114
|
+
Creates delayed-validation behavior for a fieldset.
|
|
115
|
+
|
|
116
|
+
#### Options
|
|
117
|
+
|
|
118
|
+
| Option | Type | Required | Description |
|
|
119
|
+
|--------|------|----------|-------------|
|
|
120
|
+
| `submitted` | `MaybeRefOrGetter<boolean>` | Yes | Consumer-owned submit state. Never mutated by the kit. |
|
|
121
|
+
| `isValid` | `() => boolean` | Yes | Returns the entire fieldset's current true validity. |
|
|
122
|
+
|
|
123
|
+
#### Returns
|
|
124
|
+
|
|
125
|
+
| Property | Type | Description |
|
|
126
|
+
|----------|------|-------------|
|
|
127
|
+
| `touched` | `Ref<boolean>` | Becomes `true` once focus leaves the fieldset. |
|
|
128
|
+
| `fieldsetValidate` | `ComputedRef<boolean>` | Delayed validation gate: `submitted || touched`. |
|
|
129
|
+
| `onFocusout` | `(event: FocusEvent) => void` | Bind to fieldset `focusout`. Handles touch tracking. |
|
|
130
|
+
| `reset` | `() => void` | Clears touch state and suppresses one immediate post-reset focusout. |
|
|
131
|
+
| `createFieldValidity` | `(isValid: MaybeRefOrGetter<boolean>) => ComputedRef<boolean>` | Wraps a field rule with delayed-validation gate behavior. |
|
|
132
|
+
| `createFieldValidationsMap` | `<T>(isValidMap: T) => { [K in keyof T]: ComputedRef<boolean> }` | Accepts one object argument of named field rules and returns the same shape with delayed `ComputedRef<boolean>` values. |
|
|
133
|
+
| `focusFirstInvalidField` | `(formRef: MaybeRefOrGetter<HTMLFormElement \| null>) => void` | Convenience helper that focuses the first invalid Kendo control in the form using `.k-invalid` selectors. This is expected to move out of the kit in a future release. |
|
|
134
|
+
|
|
135
|
+
## Behavior Notes
|
|
136
|
+
|
|
137
|
+
- Validation visibility is inactive until either:
|
|
138
|
+
- consumer sets `submitted = true`, or
|
|
139
|
+
- focus leaves the fieldset and marks `touched = true`.
|
|
140
|
+
- `createFieldValidity` and `createFieldValidationsMap` return `true` while gated off, then expose real rule results once gated on.
|
|
141
|
+
- `reset()` intentionally suppresses one immediate post-reset focusout to avoid reset-click focus churn re-arming validation immediately.
|
|
142
|
+
- `reset()` also resets the underlying touch tracker to keep kit and tracker state synchronized.
|
|
143
|
+
- `focusFirstInvalidField()` is available for now as a convenience, but it is a
|
|
144
|
+
form-level concern and not a natural fieldset-kit responsibility.
|
|
145
|
+
|
|
146
|
+
## Recommended Usage
|
|
147
|
+
|
|
148
|
+
For app forms, prefer this composable over `useFieldsetTouchTracker` directly.
|
|
149
|
+
|
|
150
|
+
Use the touch tracker directly only when you need custom orchestration not covered by this kit.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@featherk/composables",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"main": "dist/featherk-composables.umd.js",
|
|
5
5
|
"module": "dist/featherk-composables.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,6 +35,11 @@
|
|
|
35
35
|
"import": "./dist/featherk-composables.es.js",
|
|
36
36
|
"require": "./dist/featherk-composables.umd.js"
|
|
37
37
|
},
|
|
38
|
+
"./form": {
|
|
39
|
+
"types": "./dist/form/index.d.ts",
|
|
40
|
+
"import": "./dist/featherk-composables.es.js",
|
|
41
|
+
"require": "./dist/featherk-composables.umd.js"
|
|
42
|
+
},
|
|
38
43
|
"./address": {
|
|
39
44
|
"types": "./dist/address/index.d.ts",
|
|
40
45
|
"import": "./dist/featherk-composables.es.js",
|
|
@@ -49,7 +54,7 @@
|
|
|
49
54
|
"build": "vite build && npm run build:types",
|
|
50
55
|
"build:types": "vue-tsc --emitDeclarationOnly --declaration --declarationDir dist",
|
|
51
56
|
"test": "vitest --config vitest.config.ts",
|
|
52
|
-
"test:
|
|
57
|
+
"test:unit": "vitest run --config vitest.config.ts",
|
|
53
58
|
"test:coverage": "vitest run --config vitest.config.ts --coverage",
|
|
54
59
|
"clean": "rm -rf dist",
|
|
55
60
|
"prepublishOnly": "npm run build"
|