tekivex-ui 3.19.0 → 3.20.0
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/dist/headless.cjs +1 -1
- package/dist/headless.js +45 -45
- package/dist/index.cjs +1 -1
- package/dist/index.js +25 -23
- package/dist/src/components/TkxAddressInput.d.ts +19 -0
- package/dist/src/headless/index.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -68,29 +68,29 @@ return b("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"c
|
|
|
68
68
|
/* @__PURE__ */x("div",{className:At("flex-1 overflow-y-auto px-5 py-4"),style:{color:u.text},children:i}),a&&/* @__PURE__ */x("div",{className:At("flex items-center justify-end gap-2 px-5 py-4 shrink-0"),style:{borderTop:`1px solid ${u.border}`},children:a})]})]}),document.body)}var vr=["Su","Mo","Tu","We","Th","Fr","Sa"],wr=["January","February","March","April","May","June","July","August","September","October","November","December"],kr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function $r(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Sr(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function Cr(e,t,n){return!(!t||!$r(e,t))||!(!n||!$r(e,n))}function zr(e,t="en-US",n){if(!e)return"";if(n){const t=String(e.getFullYear()),r=t.slice(-2),o=e.getMonth()+1,i=String(o).padStart(2,"0"),a=kr[e.getMonth()],l=wr[e.getMonth()],s=e.getDate(),d=String(s).padStart(2,"0");return n.replace(/YYYY/g,t).replace(/YY/g,r).replace(/MMMM/g,l).replace(/MMM/g,a).replace(/MM/g,i).replace(/\bM\b/g,String(o)).replace(/DD/g,d).replace(/\bD\b/g,String(s))}return e.toLocaleDateString(t,{month:"2-digit",day:"2-digit",year:"numeric"})}function Mr(e,t){return new Date(e,t+1,0).getDate()}function Nr(e){return 10*Math.floor(e/10)}function Dr({values:e,selected:t,onSelect:n,label:r,theme:o,format:i}){const a=f([]),l=f(null);s(()=>{const e=a.current[t];e&&l.current&&e.scrollIntoView({block:"nearest"})},[t]);const d=i??(e=>String(e).padStart(2,"0"));/* @__PURE__ */
|
|
69
69
|
return b("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"4px"},children:[/* @__PURE__ */x("div",{style:{fontSize:"11px",fontWeight:600,color:o.textMuted,textTransform:"uppercase",letterSpacing:"0.05em"},children:r}),/* @__PURE__ */x("div",{ref:l,style:{height:"160px",overflowY:"auto",width:"52px",scrollbarWidth:"thin",border:`1px solid ${o.border}`,borderRadius:"8px",padding:"4px"},children:e.map(e=>{const r=e===t;/* @__PURE__ */
|
|
70
70
|
return x("button",{ref:t=>{a.current[e]=t},type:"button",onClick:()=>n(e),style:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",height:"32px",borderRadius:"6px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:r?600:400,backgroundColor:r?o.primary:"transparent",color:r?o.bg:o.text,fontFamily:"monospace",transition:"background-color 100ms ease"},children:d(e)},e)})})]})}function Rr({year:e,month:t,today:n,mode:r,selectedDate:o,selectedRange:i,multiDates:a,hoverDate:l,focusedDate:s,isDateDisabled:d,onSelectDate:c,onHoverDate:u,onSetFocused:p,theme:h,locale:f}){const m=function(e,t){const n=new Date(e,t,1).getDay(),r=Mr(e,t),o=[],i=Mr(e,t-1);for(let l=n-1;l>=0;l--)o.push(new Date(e,t-1,i-l));for(let l=1;l<=r;l++)o.push(new Date(e,t,l));let a=1;for(;o.length<42;)o.push(new Date(e,t+1,a++));return o}(e,t);/* @__PURE__ */
|
|
71
|
-
return b("div",{children:[/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},children:vr.map(e=>/* @__PURE__ */x("div",{style:{textAlign:"center",fontSize:"11px",fontWeight:600,color:h.textMuted,padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:e},e))}),/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},children:m.map((e,m)=>{const g=e.getMonth()===t,b=$r(e,n),y=0===e.getDay()||6===e.getDay(),v=d(e),w="single"===r&&null!=o&&$r(e,o),k="multiple"===r&&a.some(t=>$r(t,e)),$="range"===r&&Cr(e,i[0],null),S="range"===r&&Cr(e,null,i[1]),C=$||S,z="range"===r&&i[0]&&!i[1]&&l?l:i[1],M="range"===r&&function(e,t,n){if(!t||!n)return!1;const r=Sr(e).getTime(),o=Sr(t).getTime(),i=Sr(n).getTime();return r>Math.min(o,i)&&r<Math.max(o,i)}(e,i[0],z),N="range"===r&&i[0]&&!i[1]&&l&&$r(e,l),D=w||k||C,R=null!=s&&$r(e,s);let P="transparent",F=g?y?`${h.text}cc`:h.text:`${h.textMuted}60`,I="none",A=400;return D||N?(P=h.primary,F=h.bg,A=600):M&&(P=`${h.primary}18`),b&&!D&&(I=`2px solid ${h.primary}`,A=600),v&&(F=`${h.textMuted}50`),R&&!D&&(I=`2px solid ${h.secondary}`),/* @__PURE__ */x("button",{type:"button","aria-label":e.toLocaleDateString(f,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),"aria-pressed":D,"aria-disabled":v,disabled:v,onClick:()=>!v&&c(e),onMouseEnter:()=>u(e),onMouseLeave:()=>u(null),onFocus:()=>p(e),style:{width:"34px",height:"34px",borderRadius:"8px",backgroundColor:P,color:F,border:I,fontSize:"13px",fontWeight:A,cursor:v?"not-allowed":"pointer",opacity:v?.35:1,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit",position:"relative",outline:"none",textDecoration:v?"line-through":"none",transition:"background-color 80ms ease"},children:e.getDate()},m)})})]})}function Pr({value:e,onChange:t,rangeValue:n,onRangeChange:r,multiValue:o,onMultiChange:i,mode:l="single",minDate:c,maxDate:u,disabledDates:p,locale:v="en-US",dateFormat:w,showTime:k=!1,timeValue:$,onTimeChange:S,showPresets:C=!1,customPresets:z,label:M,placeholder:N="MM/DD/YYYY",hint:D,isDisabled:R=!1,isInvalid:P=!1,errorMessage:F,numberOfMonths:I=1,id:A,className:L,style:T}){const W=se(),j=yn(),E=d(),B=A??E,V=et(),H=Sr(/* @__PURE__ */new Date),O=void 0!==e,[
|
|
72
|
-
return x("button",{type:"button",onClick:()=>(e=>{const[t,n]=e.getValue(),o=[t,n];
|
|
71
|
+
return b("div",{children:[/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px",marginBottom:"4px"},children:vr.map(e=>/* @__PURE__ */x("div",{style:{textAlign:"center",fontSize:"11px",fontWeight:600,color:h.textMuted,padding:"4px 0",textTransform:"uppercase",letterSpacing:"0.05em"},children:e},e))}),/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:"2px"},children:m.map((e,m)=>{const g=e.getMonth()===t,b=$r(e,n),y=0===e.getDay()||6===e.getDay(),v=d(e),w="single"===r&&null!=o&&$r(e,o),k="multiple"===r&&a.some(t=>$r(t,e)),$="range"===r&&Cr(e,i[0],null),S="range"===r&&Cr(e,null,i[1]),C=$||S,z="range"===r&&i[0]&&!i[1]&&l?l:i[1],M="range"===r&&function(e,t,n){if(!t||!n)return!1;const r=Sr(e).getTime(),o=Sr(t).getTime(),i=Sr(n).getTime();return r>Math.min(o,i)&&r<Math.max(o,i)}(e,i[0],z),N="range"===r&&i[0]&&!i[1]&&l&&$r(e,l),D=w||k||C,R=null!=s&&$r(e,s);let P="transparent",F=g?y?`${h.text}cc`:h.text:`${h.textMuted}60`,I="none",A=400;return D||N?(P=h.primary,F=h.bg,A=600):M&&(P=`${h.primary}18`),b&&!D&&(I=`2px solid ${h.primary}`,A=600),v&&(F=`${h.textMuted}50`),R&&!D&&(I=`2px solid ${h.secondary}`),/* @__PURE__ */x("button",{type:"button","aria-label":e.toLocaleDateString(f,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),"aria-pressed":D,"aria-disabled":v,disabled:v,onClick:()=>!v&&c(e),onMouseEnter:()=>u(e),onMouseLeave:()=>u(null),onFocus:()=>p(e),style:{width:"34px",height:"34px",borderRadius:"8px",backgroundColor:P,color:F,border:I,fontSize:"13px",fontWeight:A,cursor:v?"not-allowed":"pointer",opacity:v?.35:1,display:"flex",alignItems:"center",justifyContent:"center",fontFamily:"inherit",position:"relative",outline:"none",textDecoration:v?"line-through":"none",transition:"background-color 80ms ease"},children:e.getDate()},m)})})]})}function Pr({value:e,onChange:t,rangeValue:n,onRangeChange:r,multiValue:o,onMultiChange:i,mode:l="single",minDate:c,maxDate:u,disabledDates:p,locale:v="en-US",dateFormat:w,showTime:k=!1,timeValue:$,onTimeChange:S,showPresets:C=!1,customPresets:z,label:M,placeholder:N="MM/DD/YYYY",hint:D,isDisabled:R=!1,isInvalid:P=!1,errorMessage:F,numberOfMonths:I=1,id:A,className:L,style:T}){const W=se(),j=yn(),E=d(),B=A??E,V=et(),H=Sr(/* @__PURE__ */new Date),O=e=>e instanceof Date&&!Number.isNaN(e.getTime())?e:null,q=void 0!==e,[U,K]=m(null),Y=q?O(e):U,X=void 0!==n,[Z,G]=m([null,null]),_=X?(J=n,Array.isArray(J)?[O(J[0]),O(J[1])]:[null,null]):Z;var J;const Q=void 0!==o,[ee,te]=m([]),ne=Q?(o??[]).filter(e=>e instanceof Date&&!Number.isNaN(e.getTime())):ee,[re,oe]=m("start"),ie="range"===l||"single"===l&&k,[ae,le]=m([null,null]),[de,ce]=m(null),ue=Y??_[0]??H,[pe,he]=m(ue.getFullYear()),[fe,me]=m(ue.getMonth()),[ge,xe]=m("day"),[be,ye]=m({h:0,m:0}),ve=$??be,[we,$e]=m(!1),[Se,Ce]=m(()=>{if("single"===l)return zr(Y,v,w);if("range"===l){const[e,t]=_;if(e&&t)return`${zr(e,v,w)} – ${zr(t,v,w)}`}return""}),[ze,Me]=m(null),[Ne,De]=m(null),[Re,Pe]=m({top:0,left:0,flipUp:!1}),[,Fe]=h(e=>e+1,0),Ie=f(null),Ae=f(null),Le=f(null),Te=f(!1),We=C?420:k?480:360;s(()=>{if("single"===l)Ce(zr(Y,v,w));else if("range"===l){const[e,t]=_;Ce(e&&t?`${zr(e,v,w)} – ${zr(t,v,w)}`:e?zr(e,v,w):"")}else"multiple"===l&&Ce(ne.length>0?`${ne.length} date${1!==ne.length?"s":""} selected`:"")},[Y,_,ne,l,v,w]);const je=a(()=>{Ie.current&&Pe(function(e,t){const n=e.getBoundingClientRect(),r=window.innerHeight,o=window.scrollY,i=window.scrollX,a=r-n.bottom<t+8&&n.top>t+8;return{top:a?o+n.top-t-4:o+n.bottom+4,left:i+n.left,flipUp:a}}(Ie.current,We))},[We]);s(()=>{if(we)return je(),window.addEventListener("scroll",je,!0),window.addEventListener("resize",je),()=>{window.removeEventListener("scroll",je,!0),window.removeEventListener("resize",je)}},[we,je]),s(()=>{if(!we)return;const e=e=>{Ie.current?.contains(e.target)||Ae.current?.contains(e.target)||$e(!1)};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[we]),s(()=>{if(!we)return;const e=e=>{"Escape"===e.key&&($e(!1),Te.current=!0,Le.current?.focus())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[we]);const Ee=a(e=>!!(c&&Sr(e)<Sr(c))||!!(u&&Sr(e)>Sr(u))||!!p&&("function"==typeof p?p(e):p.some(t=>$r(t,e))),[c,u,p]),Be=a(e=>{if(!Ee(e)){if("single"===l)ie?ce(e):(q||K(e),t?.(e),Ce(zr(e,v,w)),$e(!1));else if("range"===l)if("start"===re){const t=[e,null];le(t),X||G(t),r?.(t),oe("end")}else{const t=ae[0]??_[0],n=t&&e<t?[e,t]:[t,e];le(n),ie?oe("start"):(X||G(n),r?.(n),oe("start"),$e(!1))}else if("multiple"===l){const t=ne.some(t=>$r(t,e))?ne.filter(t=>!$r(t,e)):[...ne,e];Q||te(t),i?.(t)}Fe()}},[l,Ee,q,X,Q,t,r,i,re,ae,_,ne,ie,v]),Ve=a(()=>{if("single"===l){const e=de??Y;q||K(e),t?.(e)}else"range"===l&&(X||G(ae),r?.(ae));$e(!1),oe("start")},[l,de,ae,Y,q,X,t,r]),He=a(()=>{ce(null),le([null,null]),oe("start"),$e(!1)},[]),Oe=z??function(e){const t={today:e?.today??"Today",yesterday:e?.yesterday??"Yesterday",last7:e?.last7Days??"Last 7 days",last30:e?.last30Days??"Last 30 days",last90:"Last 90 days",thisWeek:"This week",lastWeek:"Last week",thisMonth:e?.thisMonth??"This month",lastMonth:e?.lastMonth??"Last month"};return[{label:t.today,getValue:()=>{const e=Sr(/* @__PURE__ */new Date);return[e,e]}},{label:t.yesterday,getValue:()=>{const e=Sr(/* @__PURE__ */new Date);return e.setDate(e.getDate()-1),[e,e]}},{label:t.last7,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);return t.setDate(t.getDate()-6),[t,e]}},{label:t.last30,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);return t.setDate(t.getDate()-29),[t,e]}},{label:t.last90,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);return t.setDate(t.getDate()-89),[t,e]}},{label:t.thisWeek,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);t.setDate(t.getDate()-t.getDay());const n=new Date(t);return n.setDate(n.getDate()+6),[t,n]}},{label:t.lastWeek,getValue:()=>{const e=Sr(/* @__PURE__ */new Date),t=new Date(e);t.setDate(t.getDate()-t.getDay()-1);const n=new Date(t);return n.setDate(n.getDate()-6),[n,t]}},{label:t.thisMonth,getValue:()=>{const e=/* @__PURE__ */new Date;return[new Date(e.getFullYear(),e.getMonth(),1),new Date(e.getFullYear(),e.getMonth()+1,0)]}},{label:t.lastMonth,getValue:()=>{const e=/* @__PURE__ */new Date;return[new Date(e.getFullYear(),e.getMonth()-1,1),new Date(e.getFullYear(),e.getMonth(),0)]}},{label:"This quarter",getValue:()=>{const e=/* @__PURE__ */new Date,t=Math.floor(e.getMonth()/3);return[new Date(e.getFullYear(),3*t,1),new Date(e.getFullYear(),3*t+3,0)]}},{label:"Last quarter",getValue:()=>{const e=/* @__PURE__ */new Date,t=Math.floor(e.getMonth()/3),n=0===t?3:t-1,r=0===t?e.getFullYear()-1:e.getFullYear();return[new Date(r,3*n,1),new Date(r,3*n+3,0)]}},{label:"This year",getValue:()=>{const e=/* @__PURE__ */(new Date).getFullYear();return[new Date(e,0,1),new Date(e,11,31)]}},{label:"Last year",getValue:()=>{const e=/* @__PURE__ */(new Date).getFullYear()-1;return[new Date(e,0,1),new Date(e,11,31)]}}]}(j),qe=11===fe?0:fe+1,Ue=11===fe?pe+1:pe,Ke=I>=2,Ye=M?ke(M):void 0,Xe=D?ke(D):void 0,Ze=F?ke(F):void 0,Ge=ke(N),_e="single"===l&&null!=Y||"range"===l&&(null!=_[0]||null!=_[1])||"multiple"===l&&ne.length>0,Je="range"===l?ie?ae:_:[null,null],Qe=P?W.danger:we?W.primary:W.border,tt=Array.from({length:24},(e,t)=>t),nt=Array.from({length:60},(e,t)=>t),rt=/* @__PURE__ */b("div",{ref:Ae,role:"dialog","aria-label":"Date picker","aria-modal":"false",onKeyDown:e=>{if("day"!==ge)return;const t=ze??Y??H;let n=null;if("ArrowRight"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1);else if("ArrowLeft"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-1);else if("ArrowDown"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+7);else if("ArrowUp"===e.key)n=new Date(t.getFullYear(),t.getMonth(),t.getDate()-7);else if("Enter"===e.key&&ze)return void Be(ze);n&&(e.preventDefault(),Me(n),n.getMonth()===fe&&n.getFullYear()===pe||(me(n.getMonth()),he(n.getFullYear())))},style:{position:"absolute",top:Re.top,left:Re.left,zIndex:9999,backgroundColor:W.surface,border:`1px solid ${W.border}`,borderRadius:"14px",boxShadow:"0 8px 30px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.1)",display:"flex",overflow:"hidden",minWidth:Ke?"580px":"300px",maxWidth:Ke&&C?"780px":Ke?"620px":C?"520px":"300px",opacity:we?1:0,transform:we?"translateY(0) scale(1)":Re.flipUp?"translateY(4px) scale(0.98)":"translateY(-4px) scale(0.98)",transition:V?"none":"opacity 120ms ease, transform 120ms ease",fontFamily:"inherit"},children:[C&&"range"===l&&/* @__PURE__ */b("div",{style:{width:"148px",flexShrink:0,borderRight:`1px solid ${W.border}`,padding:"8px 6px",overflowY:"auto",display:"flex",flexDirection:"column",gap:"1px"},children:[/* @__PURE__ */x("div",{style:{fontSize:"11px",fontWeight:600,color:W.textMuted,textTransform:"uppercase",letterSpacing:"0.07em",padding:"4px 8px 8px"},children:"Quick select"}),Oe.map(e=>{const[t,n]=e.getValue(),o=Je[0]&&Je[1]&&$r(Je[0],t)&&$r(Je[1],n);/* @__PURE__ */
|
|
72
|
+
return x("button",{type:"button",onClick:()=>(e=>{const[t,n]=e.getValue(),o=[t,n];le(o),X||G(o),r?.(o),he(t.getFullYear()),me(t.getMonth()),oe("start"),ie||$e(!1)})(e),style:{width:"100%",textAlign:"left",padding:"7px 10px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",backgroundColor:o?`${W.primary}20`:"transparent",color:o?W.primary:W.text,fontWeight:o?600:400,fontFamily:"inherit",transition:"background-color 80ms ease"},onMouseEnter:e=>{o||(e.currentTarget.style.backgroundColor=`${W.surfaceAlt}`)},onMouseLeave:e=>{o||(e.currentTarget.style.backgroundColor="transparent")},children:e.label},e.label)})]}),/* @__PURE__ */b("div",{style:{flex:1,padding:"16px",display:"flex",flexDirection:"column",gap:"12px",minWidth:0},children:[
|
|
73
73
|
/* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[
|
|
74
|
-
/* @__PURE__ */x("button",{type:"button","aria-label":"day"===
|
|
75
|
-
/* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:["day"===
|
|
76
|
-
/* @__PURE__ */x("button",{type:"button",onClick:()=>
|
|
77
|
-
/* @__PURE__ */x("button",{type:"button",onClick:()=>
|
|
78
|
-
/* @__PURE__ */x("button",{type:"button","aria-label":"day"===
|
|
79
|
-
return x("button",{type:"button",onClick:()=>{
|
|
80
|
-
return x("button",{type:"button",onClick:()=>{
|
|
81
|
-
/* @__PURE__ */x(Dr,{values:
|
|
74
|
+
/* @__PURE__ */x("button",{type:"button","aria-label":"day"===ge?"Previous month":"month"===ge?"Previous year":"Previous decade",onClick:()=>{"day"===ge?(0===fe?(me(11),he(e=>e-1)):me(e=>e-1),xe("day")):he("month"===ge?e=>e-1:e=>e-10)},style:{border:"none",background:"transparent",cursor:"pointer",color:W.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"15 18 9 12 15 6"})})}),
|
|
75
|
+
/* @__PURE__ */b("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:["day"===ge&&/* @__PURE__ */b(g,{children:[
|
|
76
|
+
/* @__PURE__ */x("button",{type:"button",onClick:()=>xe("month"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:W.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:wr[fe]}),
|
|
77
|
+
/* @__PURE__ */x("button",{type:"button",onClick:()=>xe("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:W.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:pe}),Ke&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("span",{style:{color:W.textMuted,fontSize:"14px"},children:"–"}),/* @__PURE__ */b("span",{style:{fontSize:"14px",fontWeight:600,color:W.text},children:[wr[qe]," ",Ue]})]})]}),"month"===ge&&/* @__PURE__ */x("button",{type:"button",onClick:()=>xe("year"),style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"14px",fontWeight:600,color:W.text,padding:"4px 6px",borderRadius:"6px",fontFamily:"inherit"},children:pe}),"year"===ge&&/* @__PURE__ */b("span",{style:{fontSize:"14px",fontWeight:600,color:W.text},children:[Nr(pe),"–",Nr(pe)+9]})]}),
|
|
78
|
+
/* @__PURE__ */x("button",{type:"button","aria-label":"day"===ge?"Next month":"month"===ge?"Next year":"Next decade",onClick:()=>{"day"===ge?(11===fe?(me(0),he(e=>e+1)):me(e=>e+1),xe("day")):he("month"===ge?e=>e+1:e=>e+10)},style:{border:"none",background:"transparent",cursor:"pointer",color:W.textMuted,padding:"6px",borderRadius:"6px",display:"flex",alignItems:"center"},children:/* @__PURE__ */x("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:/* @__PURE__ */x("polyline",{points:"9 18 15 12 9 6"})})})]}),"day"===ge&&/* @__PURE__ */b("div",{style:{display:"flex",gap:"20px"},children:[/* @__PURE__ */x(Rr,{year:pe,month:fe,today:H,mode:l,selectedDate:Y,selectedRange:Je,multiDates:ne,hoverDate:Ne,focusedDate:ze,isDateDisabled:Ee,onSelectDate:Be,onHoverDate:De,onSetFocused:Me,theme:W,locale:v}),Ke&&/* @__PURE__ */x(Rr,{year:Ue,month:qe,today:H,mode:l,selectedDate:Y,selectedRange:Je,multiDates:ne,hoverDate:Ne,focusedDate:ze,isDateDisabled:Ee,onSelectDate:Be,onHoverDate:De,onSetFocused:Me,theme:W,locale:v})]}),"month"===ge&&/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"6px"},children:kr.map((e,t)=>{const n=t===fe;/* @__PURE__ */
|
|
79
|
+
return x("button",{type:"button",onClick:()=>{me(t),xe("day")},style:{padding:"10px",borderRadius:"8px",border:t!==H.getMonth()||pe!==H.getFullYear()||n?"none":`2px solid ${W.primary}`,cursor:"pointer",fontSize:"13px",fontWeight:n?600:400,backgroundColor:n?W.primary:"transparent",color:n?W.bg:W.text,fontFamily:"inherit",transition:"background-color 80ms ease"},children:e},e)})}),"year"===ge&&/* @__PURE__ */x("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:"6px"},children:Array.from({length:12},(e,t)=>{const n=Nr(pe)-1+t,r=n===pe,o=n===H.getFullYear(),i=0===t||11===t;/* @__PURE__ */
|
|
80
|
+
return x("button",{type:"button",onClick:()=>{he(n),xe("month")},style:{padding:"10px 6px",borderRadius:"8px",border:o&&!r?`2px solid ${W.primary}`:"none",cursor:"pointer",fontSize:"13px",fontWeight:r?600:400,backgroundColor:r?W.primary:"transparent",color:r?W.bg:i?W.textMuted:W.text,fontFamily:"inherit",transition:"background-color 80ms ease",opacity:i?.5:1},children:n},n)})}),k&&"day"===ge&&/* @__PURE__ */b("div",{style:{borderTop:`1px solid ${W.border}`,paddingTop:"12px",display:"flex",alignItems:"flex-start",gap:"8px",justifyContent:"center"},children:[
|
|
81
|
+
/* @__PURE__ */x(Dr,{values:tt,selected:ve.h,onSelect:e=>{$||ye(t=>({...t,h:e})),S?.({...ve,h:e})},label:"Hour",theme:W}),
|
|
82
82
|
/* @__PURE__ */x("div",{style:{display:"flex",alignItems:"center",height:"40px",marginTop:"28px",fontSize:"16px",fontWeight:700,color:W.textMuted},children:":"}),
|
|
83
|
-
/* @__PURE__ */x(Dr,{values:
|
|
84
|
-
/* @__PURE__ */b("div",{style:{borderTop:`1px solid ${W.border}`,paddingTop:"10px",display:"flex",alignItems:"center",justifyContent:
|
|
85
|
-
return b("div",{className:L,style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",position:"relative",...T},children:[
|
|
86
|
-
/* @__PURE__ */b("div",{ref:
|
|
83
|
+
/* @__PURE__ */x(Dr,{values:nt,selected:ve.m,onSelect:e=>{$||ye(t=>({...t,m:e})),S?.({...ve,m:e})},label:"Min",theme:W})]}),"multiple"===l&&"day"===ge&&ne.length>0&&/* @__PURE__ */b("div",{style:{borderTop:`1px solid ${W.border}`,paddingTop:"8px",fontSize:"12px",color:W.textMuted,textAlign:"center"},children:[ne.length," date",1!==ne.length?"s":""," selected"]}),
|
|
84
|
+
/* @__PURE__ */b("div",{style:{borderTop:`1px solid ${W.border}`,paddingTop:"10px",display:"flex",alignItems:"center",justifyContent:ie?"space-between":"flex-start",gap:"8px"},children:[/* @__PURE__ */x("button",{type:"button",onClick:()=>{he(H.getFullYear()),me(H.getMonth()),xe("day"),Be(H)},style:{border:"none",background:"transparent",cursor:"pointer",fontSize:"13px",color:W.primary,fontWeight:500,padding:"6px 10px",borderRadius:"6px",fontFamily:"inherit"},children:"Today"}),ie&&/* @__PURE__ */b("div",{style:{display:"flex",gap:"6px"},children:[/* @__PURE__ */x("button",{type:"button",onClick:He,style:{padding:"6px 14px",borderRadius:"7px",border:`1px solid ${W.border}`,cursor:"pointer",fontSize:"13px",fontWeight:500,backgroundColor:"transparent",color:W.text,fontFamily:"inherit"},children:"Cancel"}),/* @__PURE__ */x("button",{type:"button",onClick:Ve,style:{padding:"6px 14px",borderRadius:"7px",border:"none",cursor:"pointer",fontSize:"13px",fontWeight:600,backgroundColor:W.primary,color:W.bg,fontFamily:"inherit"},children:"Apply"})]})]})]})]});/* @__PURE__ */
|
|
85
|
+
return b("div",{className:L,style:{display:"flex",flexDirection:"column",gap:"4px",width:"100%",position:"relative",...T},children:[Ye&&/* @__PURE__ */x("label",{htmlFor:B,style:{fontSize:"13px",fontWeight:500,color:W.text,marginBottom:"2px"},children:Ye}),
|
|
86
|
+
/* @__PURE__ */b("div",{ref:Ie,style:{display:"flex",alignItems:"center",border:`1.5px solid ${Qe}`,borderRadius:"8px",backgroundColor:W.surface,overflow:"hidden",transition:V?"none":"border-color 120ms ease",opacity:R?.5:1},children:[
|
|
87
87
|
/* @__PURE__ */x("span",{style:{display:"flex",alignItems:"center",paddingLeft:"10px",color:W.textMuted,flexShrink:0},children:/* @__PURE__ */b("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[
|
|
88
88
|
/* @__PURE__ */x("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),
|
|
89
89
|
/* @__PURE__ */x("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),
|
|
90
90
|
/* @__PURE__ */x("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),
|
|
91
91
|
/* @__PURE__ */x("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),
|
|
92
|
-
/* @__PURE__ */x("input",{ref:
|
|
93
|
-
/* @__PURE__ */x("button",{type:"button","aria-label":
|
|
92
|
+
/* @__PURE__ */x("input",{ref:Le,id:B,type:"text",value:Se,placeholder:Ge,disabled:R,"aria-invalid":P,"aria-haspopup":"dialog","aria-expanded":we,readOnly:"range"===l||"multiple"===l,onChange:e=>(e=>{if(Ce(e),"single"===l){const n=function(e,t){const n=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(n){const[,e,t,r]=n.map(Number);if(e>=1&&e<=12&&t>=1&&t<=31){const n=new Date(r,e-1,t);if(n.getMonth()===e-1)return n}}const r=e.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);if(r){const[,e,t,n]=r.map(Number),o=new Date(e,t-1,n);if(o.getMonth()===t-1)return o}if(t&&/^DD/.test(t)){const t=e.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);if(t){const[,e,n,r]=t.map(Number),o=new Date(r,n-1,e);if(o.getMonth()===n-1)return o}}return null}(e,w);n&&!Ee(n)&&(q||K(n),t?.(n),he(n.getFullYear()),me(n.getMonth()))}})(e.target.value),onFocus:()=>{R||(Te.current?Te.current=!1:$e(!0))},style:{flex:1,backgroundColor:"transparent",border:"none",outline:"none",fontSize:"14px",padding:"9px 8px",color:W.text,cursor:"single"!==l?"pointer":"text",fontFamily:"inherit",minWidth:0}}),_e&&!R&&/* @__PURE__ */x("button",{type:"button","aria-label":"Clear selection",onClick:e=>{if(e.stopPropagation(),"single"===l)q||K(null),t?.(null),Ce("");else if("range"===l){const e=[null,null];X||G(e),r?.(e),le(e),Ce(""),oe("start")}else"multiple"===l&&(Q||te([]),i?.([]),Ce(""))},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"28px",height:"28px",border:"none",background:"transparent",cursor:"pointer",color:W.textMuted,flexShrink:0,borderRadius:"4px",marginRight:"4px"},children:/* @__PURE__ */b("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[/* @__PURE__ */x("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),/* @__PURE__ */x("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),
|
|
93
|
+
/* @__PURE__ */x("button",{type:"button","aria-label":we?"Close calendar":"Open calendar",tabIndex:-1,disabled:R,onClick:()=>{R||$e(e=>!e)},style:{display:"flex",alignItems:"center",justifyContent:"center",width:"34px",height:"36px",border:"none",background:"transparent",cursor:R?"not-allowed":"pointer",color:W.textMuted,flexShrink:0},children:/* @__PURE__ */x("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{transform:we?"rotate(180deg)":"rotate(0deg)",transition:V?"none":"transform 160ms ease"},children:/* @__PURE__ */x("polyline",{points:"6 9 12 15 18 9"})})})]}),Xe&&!P&&/* @__PURE__ */x("span",{style:{fontSize:"12px",color:W.textMuted},children:Xe}),P&&Ze&&/* @__PURE__ */x("span",{role:"alert",style:{fontSize:"12px",color:W.danger},children:Ze}),we&&"undefined"!=typeof document&&y(rt,document.body)]})}Pr.displayName="TkxDatePicker";var Fr={sm:{track:4,thumb:14,fontSize:"0.75rem"},md:{track:6,thumb:18,fontSize:"0.875rem"},lg:{track:8,thumb:22,fontSize:"1rem"}};function Ir(e,t,n){return Math.min(Math.max(e,t),n)}function Ar(e,t,n){return Math.round((e-t)/n)*n+t}function Lr(e,t,n){return(e-t)/(n-t)*100}function Tr({value:e,min:t,max:n,step:r,isDisabled:o,trackColor:i,thumbSize:a,ariaLabel:l,tooltipMode:s,formatValue:d,orientation:c,onChange:u,onChangeEnd:p}){const[h,f]=m(!1),[g,y]=m(!1),[v,w]=m(!1),k="vertical"===c,$=Lr(e,t,n);/* @__PURE__ */
|
|
94
94
|
return b("div",{style:k?{position:"absolute",bottom:`${$}%`,transform:"translateY(50%)",left:"50%",marginLeft:`-${a/2}px`,zIndex:2,cursor:o?"not-allowed":"grab"}:{position:"absolute",left:`${$}%`,transform:"translateX(-50%)",top:"50%",marginTop:`-${a/2}px`,zIndex:2,cursor:o?"not-allowed":"grab"},children:[("always"===s||"hover"===s&&(v||g||h))&&/* @__PURE__ */x("div",{style:k?{position:"absolute",left:a+6,top:"50%",transform:"translateY(-50%)",backgroundColor:i,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"}:{position:"absolute",bottom:a+6,left:"50%",transform:"translateX(-50%)",backgroundColor:i,color:"#fff",borderRadius:"4px",padding:"2px 6px",fontSize:"0.75rem",whiteSpace:"nowrap",pointerEvents:"none"},children:d(e)}),/* @__PURE__ */x("div",{role:"slider",tabIndex:o?-1:0,"aria-label":l,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-disabled":o,"aria-orientation":c,onKeyDown:i=>{o||("ArrowRight"===i.key||"ArrowUp"===i.key?(i.preventDefault(),u(Ir(Ar(e+r,t,r),t,n))):"ArrowLeft"===i.key||"ArrowDown"===i.key?(i.preventDefault(),u(Ir(Ar(e-r,t,r),t,n))):"Home"===i.key?(i.preventDefault(),u(t)):"End"===i.key&&(i.preventDefault(),u(n)))},onFocus:()=>f(!0),onBlur:()=>f(!1),onPointerEnter:()=>w(!0),onPointerLeave:()=>w(!1),onPointerDown:e=>{o||(y(!0),e.target.setPointerCapture(e.pointerId))},onPointerUp:()=>{y(!1),p?.()},style:{width:a,height:a,borderRadius:"50%",backgroundColor:o?"#888":i,border:"3px solid #fff",boxShadow:h?`0 0 0 3px ${i}44`:"0 1px 4px rgba(0,0,0,0.3)",outline:"none",display:"block",transition:"box-shadow 150ms ease"}})]})}function Wr({value:e,defaultValue:t=0,onChange:n,rangeValue:r,onRangeChange:o,min:i=0,max:l=100,step:s=1,isRange:c=!1,label:u,showValue:p=!1,showTicks:h=!1,tickCount:y=5,isDisabled:v=!1,colorScheme:w="primary",size:k="md",marks:$,orientation:S="horizontal",showTooltip:C=!1,formatValue:z,onChangeEnd:M,onRangeChangeEnd:N,gradient:D=!1}){const R=se(),P=d(),F=et(),I=void 0!==e,[A,L]=m(t),T=I?e:A,W=void 0!==r,[j,E]=m([i,l]),B=W?r:j,V=f(null),H=f(T);H.current=T;const O=f(B);O.current=B;const q={primary:R.primary,success:R.success,danger:R.danger,warning:R.warning}[w],U=Fr[k],K="vertical"===S,Y=!0===C?"hover":!1!==C&&C,X=z??(e=>String(e)),Z=q+"66",G=a((e,t)=>{const n=V.current;if(!n)return i;const r=n.getBoundingClientRect();let o;return o=Ir(K?(r.bottom-(t??0))/r.height:(e-r.left)/r.width,0,1),Ir(Ar(o*(l-i)+i,i,s),i,l)},[i,l,s,K]),_=a(e=>{if(v)return;const t=G(e.clientX,e.clientY);if(c){const[e,n]=B,r=Math.abs(t-e)<=Math.abs(t-n)?[t,n]:[e,t];W||E(r),o?.(r)}else I||L(t),n?.(t)},[v,c,I,W,G,n,o,B]),J=c?Lr(B[0],i,l):0,Q=Lr(c?B[1]:T,i,l),ee=h?Array.from({length:y},(e,t)=>i+t/(y-1)*(l-i)):[],te=u?ke(u):void 0,ne=F?"none":"background 150ms ease";/* @__PURE__ */
|
|
95
95
|
return b("div",{className:At("flex flex-col gap-2"),style:{opacity:v?.55:1,...K?{height:200,width:"auto",display:"inline-flex"}:{width:"100%"}},children:[(te||p)&&/* @__PURE__ */b("div",{className:At("flex items-center justify-between"),children:[te&&/* @__PURE__ */x("label",{htmlFor:P,className:At("text-sm font-medium"),style:{color:R.text,fontSize:U.fontSize},children:te}),p&&!c&&/* @__PURE__ */x("span",{className:At("text-sm tabular-nums"),style:{color:R.textMuted,fontSize:U.fontSize},children:X(T)}),p&&c&&/* @__PURE__ */b("span",{className:At("text-sm tabular-nums"),style:{color:R.textMuted,fontSize:U.fontSize},children:[X(B[0])," – ",X(B[1])]})]}),
|
|
96
96
|
/* @__PURE__ */b("div",{style:{position:"relative",...K?{paddingLeft:U.thumb/2,paddingRight:U.thumb/2,flex:1}:{paddingTop:U.thumb/2,paddingBottom:U.thumb/2}},children:[/* @__PURE__ */b("div",{ref:V,onPointerDown:_,style:{position:"relative",...K?{width:U.track,height:"100%"}:{height:U.track},borderRadius:9999,backgroundColor:R.border,cursor:v?"not-allowed":"pointer",userSelect:"none",touchAction:"none"},children:[
|
|
@@ -450,14 +450,16 @@ return b("div",{className:y,style:X,onKeyDown:e=>{I&&("ArrowDown"===e.key?(e.pre
|
|
|
450
450
|
/* @__PURE__ */x("button",{type:"button",style:{..._,color:$.primary,borderColor:$.primary},children:k.browse}),
|
|
451
451
|
/* @__PURE__ */x("input",{ref:S,type:"file",accept:"image/*",style:{display:"none"},onChange:e=>{const t=e.target.files?.[0];t&&K(t)}})]})})});Ds.displayName="TkxImageEditor";var Rs={razorpay:"https://checkout.razorpay.com/v1/checkout.js",stripe:"https://js.stripe.com/v3/",square:"https://web.squarecdn.com/v1/square.js"},Ps={razorpay:"Razorpay",stripe:"Stripe",square:"Square"},Fs=/^[A-Za-z0-9_-]{20,200}$/,Is={},As=i(function({config:e,onSuccess:t,onFailure:n,onDismiss:r,children:o,variant:i="primary",size:a="md",disabled:l,className:s,style:d},c){const u=se(),p=yn(),[h,f]=m(!1),g="razorpay"===e.provider||"stripe"===e.provider?e.publicKey:e.applicationId;Fs.test(g);const b="sm"===a?13:"lg"===a?16:14,y="sm"===a?32:"lg"===a?48:40,v={padding:`${"sm"===a?6:"lg"===a?12:9}px ${"sm"===a?12:"lg"===a?22:16}px`,borderRadius:8,border:"outline"===i?`1.5px solid ${u.primary}`:"none",background:"outline"===i?"transparent":u.primary,color:"outline"===i?u.primary:u.bg,fontSize:b,fontWeight:600,cursor:l?"not-allowed":h?"progress":"pointer",opacity:l?.5:1,minHeight:y,display:"inline-flex",alignItems:"center",justifyContent:"center",gap:8,transition:"opacity 0.15s, transform 0.05s",...d};/* @__PURE__ */
|
|
452
452
|
return x("button",{ref:c,type:"button",onClick:async()=>{if(!h&&!l){f(!0);try{if(await function(e){if("undefined"==typeof window)return Promise.resolve();if(window[Ps[e]])return Promise.resolve();if(Is[e])return Is[e];const t=new Promise((t,n)=>{const r=document.querySelector(`script[data-tkx-payment="${e}"]`);if(r)return r.addEventListener("load",()=>t()),void r.addEventListener("error",()=>n(/* @__PURE__ */new Error("script-load-failed")));const o=document.createElement("script");o.src=Rs[e],o.async=!0,o.dataset.tkxPayment=e,o.addEventListener("load",()=>t()),o.addEventListener("error",()=>n(/* @__PURE__ */new Error("script-load-failed"))),document.head.appendChild(o)});return Is[e]=t,t}(e.provider),"razorpay"===e.provider){const o=window.Razorpay;if(!o)throw new Error("Razorpay script loaded but global missing");const i=new o({key:e.publicKey,amount:e.amount,currency:e.currency,order_id:e.orderId,name:ke(e.brand?.name??"Payment"),description:ke(e.brand?.description??""),image:e.brand?.image,prefill:e.prefill,notes:e.notes,theme:{color:e.themeColor??u.primary},handler:e=>{t({provider:"razorpay",paymentId:e.razorpay_payment_id,orderId:e.razorpay_order_id,signature:e.razorpay_signature,raw:e})},modal:{ondismiss:()=>{f(!1),r?.()}}});return i.on("payment.failed",e=>{f(!1),n?.({provider:"razorpay",code:e?.error?.code??"unknown",message:e?.error?.description??"Payment failed",raw:e})}),void i.open()}if("stripe"===e.provider){const t=window.Stripe;if(!t)throw new Error("Stripe script loaded but global missing");const r=await t(e.publicKey).redirectToCheckout({sessionId:e.sessionId});return void(r?.error&&(f(!1),n?.({provider:"stripe",code:r.error.code??"unknown",message:r.error.message??"Stripe checkout failed",raw:r})))}if("square"===e.provider){if(!window.Square)throw new Error("Square script loaded but global missing");const r={applicationId:e.applicationId,locationId:e.locationId,orderId:e.orderId,amount:e.amount,currency:e.currency,success:(n,r)=>t({provider:"square",paymentId:n,orderId:e.orderId,raw:r}),failure:(e,t,r)=>n?.({provider:"square",code:e,message:t,raw:r})};return void window.dispatchEvent(new CustomEvent("tkx-payment-square-init",{detail:r}))}}catch(o){f(!1),n?.({provider:e.provider,code:"sdk-load-failed",message:o?.message??"Unable to load payment SDK",raw:o})}}},disabled:l||h,"aria-busy":h,className:s,style:v,"data-tkx-payment-provider":e.provider,children:h?/* @__PURE__ */x("span",{"aria-hidden":"true",children:p.loading}):o??"Pay"})});As.displayName="TkxPaymentButton";var Ls=i(function({label:e,width:t,height:n=180,strokeColor:r,strokeWidth:o=2,backgroundColor:i,onChange:l,disabled:d,className:u,style:p},h){const g=se(),y=yn(),v=f(null),w=f(null),k=f([]),$=f(null),S=f(1),[C,z]=m(t??320),M=r??g.text,N=i??g.surface;s(()=>{if(void 0!==t)return;const e=v.current;if(!e||"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(e=>{for(const t of e){const e=Math.floor(t.contentRect.width);e>0&&z(e)}});return n.observe(e),()=>n.disconnect()},[t]);const D=a(()=>{const e=w.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=S.current;t.fillStyle=N,t.fillRect(0,0,e.width,e.height),t.strokeStyle=M,t.lineWidth=o*n,t.lineCap="round",t.lineJoin="round";for(const r of k.current){if(r.length<2){1===r.length&&(t.beginPath(),t.arc(r[0].x*n,r[0].y*n,o*n/2,0,2*Math.PI),t.fillStyle=M,t.fill());continue}t.beginPath(),t.moveTo(r[0].x*n,r[0].y*n);for(let o=1;o<r.length-1;o++){const e=(r[o].x+r[o+1].x)/2,i=(r[o].y+r[o+1].y)/2;t.quadraticCurveTo(r[o].x*n,r[o].y*n,e*n,i*n)}const e=r[r.length-1];t.lineTo(e.x*n,e.y*n),t.stroke()}},[N,M,o]);s(()=>{const e=w.current;if(!e)return;const t=window.devicePixelRatio||1;S.current=t,e.width=C*t,e.height=n*t,e.style.width=`${C}px`,e.style.height=`${n}px`,D()},[C,n,D]);const R=e=>{const t=e.currentTarget.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}},P=e=>{if($.current){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}$.current=null,l?.(w.current?.toDataURL("image/png")??"")}};c(h,()=>({clear:()=>{k.current=[],$.current=null,D(),l?.(w.current?.toDataURL("image/png")??"")},undo:()=>{k.current.pop(),D(),l?.(w.current?.toDataURL("image/png")??"")},isEmpty:()=>0===k.current.length,toDataURL:(e="image/png",t=.92)=>w.current?.toDataURL(e,t)??"",toBlob:(e="image/png",t=.92)=>new Promise(n=>{w.current?.toBlob(e=>n(e),e,t)})}),[D,l]);const F={display:"inline-flex",flexDirection:"column",gap:6,width:t??"100%",...p},I={fontSize:13,fontWeight:600,color:g.text},A={borderRadius:8,border:`1px solid ${g.border}`,background:N,cursor:d?"not-allowed":"crosshair",touchAction:"none",display:"block",width:"100%"};/* @__PURE__ */
|
|
453
|
-
return b("div",{ref:v,className:u,style:F,children:[e&&/* @__PURE__ */x("label",{style:I,children:e}),/* @__PURE__ */x("canvas",{ref:w,role:"img","aria-label":e??y.uploadFiles??"Signature pad",style:A,onPointerDown:e=>{d||(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),$.current=[R(e)],k.current.push($.current))},onPointerMove:e=>{if(!$.current||d)return;e.preventDefault();const t=R(e),n=$.current,r=n[n.length-1];Math.abs(r.x-t.x)<1&&Math.abs(r.y-t.y)<1||(n.push(t),D())},onPointerUp:P,onPointerCancel:P})]})});Ls.displayName="TkxSignaturePad";var Ts=async(e,t)=>{const n=await fetch(`https://api.postalpincode.in/pincode/${e}`,{signal:t});if(!n.ok)throw new Error(`HTTP ${n.status}`);const r=await n.json();return Array.isArray(r)&&r[0]&&"Success"===r[0].Status&&r[0].PostOffice?r[0].PostOffice:[]},Ws=/^\d{6}$/,js=i(function({value:e,onChange:t,lookup:n=Ts,
|
|
454
|
-
return b("div",{className:
|
|
455
|
-
/* @__PURE__ */b("div",{style:{
|
|
456
|
-
/* @__PURE__ */b("div",{style:
|
|
457
|
-
/* @__PURE__ */b("div",{style:
|
|
458
|
-
/* @__PURE__ */b("div",{style:
|
|
453
|
+
return b("div",{ref:v,className:u,style:F,children:[e&&/* @__PURE__ */x("label",{style:I,children:e}),/* @__PURE__ */x("canvas",{ref:w,role:"img","aria-label":e??y.uploadFiles??"Signature pad",style:A,onPointerDown:e=>{d||(e.preventDefault(),e.currentTarget.setPointerCapture(e.pointerId),$.current=[R(e)],k.current.push($.current))},onPointerMove:e=>{if(!$.current||d)return;e.preventDefault();const t=R(e),n=$.current,r=n[n.length-1];Math.abs(r.x-t.x)<1&&Math.abs(r.y-t.y)<1||(n.push(t),D())},onPointerUp:P,onPointerCancel:P})]})});Ls.displayName="TkxSignaturePad";var Ts=async(e,t)=>{const n=await fetch(`https://api.postalpincode.in/pincode/${e}`,{signal:t});if(!n.ok)throw new Error(`HTTP ${n.status}`);const r=await n.json();return Array.isArray(r)&&r[0]&&"Success"===r[0].Status&&r[0].PostOffice?r[0].PostOffice:[]},Ws=/^\d{6}$/,js=i(function({value:e,onChange:t,lookup:n=Ts,divisionsSource:r,label:o,showAddressLines:i=!0,disabled:a,className:l,style:c},u){const h=se(),f=yn(),y=d(),[v,w]=m([]),[k,$]=m(!1),[S,C]=m(null),[z,M]=m([]),[N,D]=m([]),[R,P]=m([]),[F,I]=m([]),[A,L]=m(null);s(()=>{if(!r)return;const e=new AbortController;return L(null),r.countries(e.signal).then(M).catch(e=>{"AbortError"!==e?.name&&L(e?.message||"Failed to load countries")}),()=>e.abort()},[r]),s(()=>{if(!r||!e.countryCode)return void D([]);const t=new AbortController;return r.states(e.countryCode,t.signal).then(D).catch(e=>{"AbortError"!==e?.name&&L(e?.message||"Failed to load states")}),()=>t.abort()},[r,e.countryCode]),s(()=>{if(!r||!e.countryCode||!e.stateCode)return void P([]);const t=new AbortController;return r.districts(e.countryCode,e.stateCode,t.signal).then(P).catch(e=>{"AbortError"!==e?.name&&L(e?.message||"Failed to load districts")}),()=>t.abort()},[r,e.countryCode,e.stateCode]),s(()=>{if(!(r&&e.countryCode&&e.stateCode&&e.districtCode))return void I([]);const t=new AbortController;return r.subDistricts(e.countryCode,e.stateCode,e.districtCode,t.signal).then(I).catch(e=>{"AbortError"!==e?.name&&L(e?.message||"Failed to load sub-districts")}),()=>t.abort()},[r,e.countryCode,e.stateCode,e.districtCode]);const T=p(()=>{if(!r?.subDistrictLabel||!e.countryCode||!e.stateCode)return"Sub-district";try{return r.subDistrictLabel(e.countryCode,e.stateCode)||"Sub-district"}catch{return"Sub-district"}},[r,e.countryCode,e.stateCode]);s(()=>{if(!e.pin||!Ws.test(e.pin))return w([]),void C(null);const t=new AbortController;return $(!0),C(null),n(e.pin,t.signal).then(e=>{w(e),0===e.length&&C(f.noResults)}).catch(e=>{"AbortError"!==e?.name&&(C(e?.message||"Lookup failed"),w([]))}).finally(()=>$(!1)),()=>t.abort()},[e.pin]);const W=n=>{t({...e,pin:n.Pincode,postOffice:n.Name,city:n.District,state:n.State,country:n.Country}),w([])},j=(n,r)=>{t({...e,pin:e.pin??"",[n]:r})},E={display:"flex",flexDirection:"column",gap:8,width:"100%",...c},B={display:"flex",gap:8,flexWrap:"wrap"},V={flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},H={width:"100%",padding:"8px 10px",border:`1px solid ${h.border}`,borderRadius:8,background:h.surface,color:h.text,fontSize:14,outline:"none",minHeight:40},O={...H,appearance:"none",WebkitAppearance:"none",MozAppearance:"none",paddingRight:28,backgroundImage:`url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='${encodeURIComponent(h.textMuted)}' d='M0 0l5 6 5-6z'/></svg>")`,backgroundRepeat:"no-repeat",backgroundPosition:"right 10px center"},q={border:`1px solid ${h.border}`,borderRadius:8,background:h.surface,maxHeight:200,overflow:"auto",padding:4},U={padding:"8px 10px",borderRadius:6,cursor:"pointer",fontSize:13,color:h.text},K={fontSize:12,color:h.textMuted};/* @__PURE__ */
|
|
454
|
+
return b("div",{className:l,style:E,children:[o&&/* @__PURE__ */x("label",{htmlFor:`${y}-pin`,style:{fontSize:13,fontWeight:600},children:o}),r&&/* @__PURE__ */b(g,{children:[
|
|
455
|
+
/* @__PURE__ */b("div",{style:B,children:[/* @__PURE__ */b("div",{style:V,children:[/* @__PURE__ */x("label",{style:K,htmlFor:`${y}-country`,children:"Country"}),/* @__PURE__ */b("select",{id:`${y}-country`,value:e.countryCode??"",onChange:n=>(n=>{const r=z.find(e=>e.code===n);t({...e,pin:e.pin??"",countryCode:n||void 0,country:r?.name,stateCode:void 0,state:void 0,districtCode:void 0,city:void 0,subDistrictCode:void 0,subDistrict:void 0})})(n.target.value),disabled:a||0===z.length,style:O,children:[/* @__PURE__ */x("option",{value:"",children:0===z.length?"Loading…":"Select country"}),z.map(e=>/* @__PURE__ */x("option",{value:e.code,children:e.name},e.code))]})]}),/* @__PURE__ */b("div",{style:V,children:[/* @__PURE__ */x("label",{style:K,htmlFor:`${y}-state`,children:"State / UT"}),/* @__PURE__ */b("select",{id:`${y}-state`,value:e.stateCode??"",onChange:n=>(n=>{const r=N.find(e=>e.code===n);t({...e,pin:e.pin??"",stateCode:n||void 0,state:r?.name,districtCode:void 0,city:void 0,subDistrictCode:void 0,subDistrict:void 0})})(n.target.value),disabled:a||!e.countryCode||0===N.length,style:O,children:[/* @__PURE__ */x("option",{value:"",children:e.countryCode?0===N.length?"Loading…":"Select state":"Pick country first"}),N.map(e=>/* @__PURE__ */x("option",{value:e.code,children:e.name},e.code))]})]})]}),
|
|
456
|
+
/* @__PURE__ */b("div",{style:B,children:[/* @__PURE__ */b("div",{style:V,children:[/* @__PURE__ */x("label",{style:K,htmlFor:`${y}-district`,children:"District"}),/* @__PURE__ */b("select",{id:`${y}-district`,value:e.districtCode??"",onChange:n=>(n=>{const r=R.find(e=>e.code===n);t({...e,pin:e.pin??"",districtCode:n||void 0,city:r?.name,subDistrictCode:void 0,subDistrict:void 0})})(n.target.value),disabled:a||!e.stateCode||0===R.length,style:O,children:[/* @__PURE__ */x("option",{value:"",children:e.stateCode?0===R.length?"Loading…":"Select district":"Pick state first"}),R.map(e=>/* @__PURE__ */x("option",{value:e.code,children:e.name},e.code))]})]}),/* @__PURE__ */b("div",{style:V,children:[/* @__PURE__ */x("label",{style:K,htmlFor:`${y}-subdistrict`,children:T}),/* @__PURE__ */b("select",{id:`${y}-subdistrict`,value:e.subDistrictCode??"",onChange:n=>(n=>{const r=F.find(e=>e.code===n);t({...e,pin:e.pin??"",subDistrictCode:n||void 0,subDistrict:r?.name})})(n.target.value),disabled:a||!e.districtCode||0===F.length,style:O,children:[/* @__PURE__ */x("option",{value:"",children:e.districtCode?0===F.length?"Loading…":`Select ${T.toLowerCase()}`:"Pick district first"}),F.map(e=>/* @__PURE__ */x("option",{value:e.code,children:e.name},e.code))]})]})]}),A&&/* @__PURE__ */x("div",{role:"alert",style:{fontSize:12,color:h.danger},children:A})]}),
|
|
457
|
+
/* @__PURE__ */b("div",{style:B,children:[
|
|
458
|
+
/* @__PURE__ */b("div",{style:{...V,flex:"0 0 140px"},children:[/* @__PURE__ */x("span",{style:K,children:"PIN code"}),/* @__PURE__ */x("input",{ref:u,id:`${y}-pin`,type:"text",inputMode:"numeric",maxLength:6,autoComplete:"postal-code",value:e.pin??"",onChange:n=>(n=>{const r=n.replace(/\D+/g,"").slice(0,6);t({...e,pin:r})})(n.target.value),disabled:a,"aria-busy":k,"aria-invalid":null!==S,style:H,placeholder:"000000"})]}),
|
|
459
|
+
/* @__PURE__ */b("div",{style:V,children:[/* @__PURE__ */x("span",{style:K,children:"City"}),/* @__PURE__ */x("input",{type:"text",autoComplete:"address-level2",value:e.city??"",onChange:n=>t({...e,city:n.target.value,pin:e.pin??""}),disabled:a,style:H})]}),
|
|
460
|
+
/* @__PURE__ */b("div",{style:V,children:[/* @__PURE__ */x("span",{style:K,children:"State"}),/* @__PURE__ */x("input",{type:"text",autoComplete:"address-level1",value:e.state??"",onChange:n=>t({...e,state:n.target.value,pin:e.pin??""}),disabled:a,style:H})]})]}),v.length>1&&/* @__PURE__ */x("div",{role:"listbox","aria-label":"Matching post offices",style:q,children:v.map(t=>/* @__PURE__ */b("div",{role:"option","aria-selected":e.postOffice===t.Name,onClick:()=>W(t),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),W(t))},tabIndex:0,style:{...U,background:e.postOffice===t.Name?h.surfaceAlt:"transparent"},children:[
|
|
459
461
|
/* @__PURE__ */x("strong",{children:t.Name})," ",
|
|
460
|
-
/* @__PURE__ */b("span",{style:{color:
|
|
462
|
+
/* @__PURE__ */b("span",{style:{color:h.textMuted},children:["· ",t.District,", ",t.State]})]},`${t.Pincode}-${t.Name}`))}),S&&/* @__PURE__ */x("div",{role:"alert",style:{fontSize:12,color:h.danger},children:S}),i&&/* @__PURE__ */b(g,{children:[/* @__PURE__ */x("input",{type:"text",autoComplete:"address-line1",placeholder:"Address line 1",value:e.line1??"",onChange:e=>j("line1",e.target.value),disabled:a,style:H}),/* @__PURE__ */x("input",{type:"text",autoComplete:"address-line2",placeholder:"Address line 2 (optional)",value:e.line2??"",onChange:e=>j("line2",e.target.value),disabled:a,style:H})]})]})});js.displayName="TkxAddressInput";var Es=new Set(["JPY","KRW"]),Bs=i(function({value:e,onChange:t,currency:n="INR",locale:r,label:o,min:i,max:l,precision:s,required:c,disabled:u,showSymbol:h=!0,id:f,name:m,className:g,style:y},v){const w=se(),k=d(),$=f??k,S=r??function(e){return"INR"===e?"en-IN":"PKR"===e?"ur-PK":"BDT"===e?"bn-BD":"JPY"===e?"ja-JP":"KRW"===e?"ko-KR":"CNY"===e?"zh-CN":"undefined"!=typeof navigator&&navigator.language?navigator.language:"en-US"}(n),C=s??(Es.has(n)?0:2),z=p(()=>new Intl.NumberFormat(S,{minimumFractionDigits:0,maximumFractionDigits:C,useGrouping:!0}),[S,C]),M=p(()=>{try{return new Intl.NumberFormat(S,{style:"currency",currency:n,currencyDisplay:"narrowSymbol",minimumFractionDigits:0,maximumFractionDigits:0}).formatToParts(0).find(e=>"currency"===e.type)?.value??n}catch{return n}},[S,n]),N=null===e||Number.isNaN(e)?"":z.format(e),D=a(e=>{const n=e.replace(/[^\d.,\-]/g,""),r=z.format(1.5),o=r.includes(",")&&!r.includes(".")?",":".",a=n.replace(new RegExp(`[^\\d\\-${o}]`,"g"),"").replace(o,".");if(""===a||"-"===a)return void t(null);const s=Number(a);if(Number.isNaN(s))return;let d=s;void 0!==i&&d<i&&(d=i),void 0!==l&&d>l&&(d=l),t(d)},[z,i,l,t]),R={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:320,...y},P={display:"flex",alignItems:"stretch",border:`1px solid ${w.border}`,borderRadius:8,background:w.surface,overflow:"hidden"},F={display:"inline-flex",alignItems:"center",padding:"0 12px",borderRight:`1px solid ${w.border}`,color:w.textMuted,fontSize:14,fontVariantNumeric:"tabular-nums",background:w.bg},I={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:w.text,background:"transparent",minHeight:40,minWidth:0,textAlign:"right",fontVariantNumeric:"tabular-nums"};/* @__PURE__ */
|
|
461
463
|
return b("div",{className:g,style:R,children:[o&&/* @__PURE__ */b("label",{htmlFor:$,style:{fontSize:13,fontWeight:600,color:w.text},children:[o,c&&/* @__PURE__ */x("span",{style:{color:w.danger,marginLeft:4},"aria-hidden":"true",children:"*"})]}),/* @__PURE__ */b("div",{style:P,children:[h&&/* @__PURE__ */x("span",{style:F,"aria-hidden":"true",children:M}),/* @__PURE__ */x("input",{ref:v,id:$,name:m,type:"text",inputMode:C>0?"decimal":"numeric",value:N,onChange:e=>D(e.target.value),disabled:u,required:c,"aria-label":o??`Amount in ${n}`,style:I})]})]})});Bs.displayName="TkxCurrencyInput";var Vs=i(function({items:e,onChange:t,renderItem:n,orientation:r="vertical",disabled:o,className:i,style:l,ariaLabel:s},c){const u=se(),p=d(),[h,y]=m(null),[v,w]=m(null),k=f(null),$=a((n,r)=>{if(n===r||n<0||r<0||r>=e.length)return;const o=[...e],[i]=o.splice(n,1);o.splice(r,0,i),t(o),k.current&&(k.current.textContent=`Moved item ${n+1} to position ${r+1}`)},[e,t]),S=e=>t=>{!o&&h&&(t.preventDefault(),t.dataTransfer.dropEffect="move",w(e))},C=()=>{y(null),w(null)},z=(t,n)=>t=>{if(o)return;const i="vertical"===r,a=i?"ArrowUp"===t.key:"ArrowLeft"===t.key,l=i?"ArrowDown"===t.key:"ArrowRight"===t.key;a&&n>0?(t.preventDefault(),$(n,n-1)):l&&n<e.length-1&&(t.preventDefault(),$(n,n+1))},M={display:"flex",flexDirection:"vertical"===r?"column":"row",gap:8,...l},N=e=>({cursor:o?"not-allowed":"grab",opacity:h===e?.5:1,transition:"opacity 0.15s, transform 0.05s",outline:v===e&&h!==e?`2px dashed ${u.primary}`:"none",outlineOffset:4,borderRadius:8});/* @__PURE__ */
|
|
462
464
|
return b(g,{children:[/* @__PURE__ */x("div",{ref:c,id:p,role:"list","aria-label":s??"Sortable list","aria-orientation":r,className:i,style:M,children:e.map((t,r)=>{/* @__PURE__ */return x("div",{role:"listitem",tabIndex:o?-1:0,draggable:!o,"data-tkx-sortable-handle":"true","aria-grabbed":h===t.id,"aria-posinset":r+1,"aria-setsize":e.length,onDragStart:(a=t.id,e=>{o||(y(a),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",a))}),onDragOver:S(t.id),onDragEnd:C,onDrop:(i=t.id,t=>{t.preventDefault(),!o&&h&&($(e.findIndex(e=>e.id===h),e.findIndex(e=>e.id===i)),y(null),w(null))}),onKeyDown:z(t.id,r),style:N(t.id),children:n(t,r)},t.id);var i,a})}),/* @__PURE__ */x("div",{ref:k,role:"status","aria-live":"polite","aria-atomic":"true",style:{position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0}})]})});Vs.displayName="TkxSortable";var Hs=["#00f5d4","#7b2ff7","#f72585","#ffbe0b","#06d6a0","#3a86ff"],Os=i(function({trigger:e,particleCount:t=80,spread:n=60,origin:r,colors:o=Hs,zIndex:i=9999,className:l,style:d},u){const p=f(null),h=f([]),m=f(null),g=et(),b=a(()=>{const e=p.current;if(!e)return;const t=window.devicePixelRatio||1;e.width=window.innerWidth*t,e.height=window.innerHeight*t,e.style.width="100vw",e.style.height="100vh";const n=e.getContext("2d");n&&n.scale(t,t)},[]);s(()=>(b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)),[b]);const y=a(()=>{const e=p.current;if(!e)return;const t=e.getContext("2d");if(!t)return;const n=window.devicePixelRatio||1;t.clearRect(0,0,e.width/n,e.height/n);const r=h.current;for(const o of r)t.save(),t.globalAlpha=o.alpha,t.translate(o.x,o.y),t.rotate(o.rot*Math.PI/180),t.fillStyle=o.color,t.fillRect(-o.size/2,-o.size/4,o.size,o.size/2),t.restore()},[]),v=a(()=>{const e=h.current;let t=!1;for(const n of e)n.ttl<=0||(n.x+=n.vx,n.y+=n.vy,n.vy+=.18,n.vx*=.99,n.rot+=n.vRot,n.ttl-=1,n.ttl<30&&(n.alpha=n.ttl/30),t=!0);e.length>1e3&&(h.current=e.filter(e=>e.ttl>0)),y(),m.current=t?requestAnimationFrame(v):null},[y]),w=a(e=>{if(!p.current)return;const i=e?.x??r?.x??window.innerWidth/2,a=e?.y??r?.y??window.innerHeight/3,l=[];for(let r=0;r<t;r++){const e=((Math.random()-.5)*n-90)*(Math.PI/180),t=6+6*Math.random();l.push({x:i,y:a,vx:Math.cos(e)*t,vy:Math.sin(e)*t,rot:360*Math.random(),vRot:14*(Math.random()-.5),size:6+6*Math.random(),color:o[Math.floor(Math.random()*o.length)],alpha:1,ttl:90+Math.floor(30*Math.random())})}if(h.current.push(...l),g)return y(),void window.setTimeout(()=>{h.current=[],y()},1500);null===m.current&&(m.current=requestAnimationFrame(v))},[t,n,r,o,g,v,y]);return c(u,()=>({fire:w}),[w]),s(()=>{e&&w()},[e]),s(()=>()=>{null!==m.current&&cancelAnimationFrame(m.current)},[]),/* @__PURE__ */x("canvas",{ref:p,"aria-hidden":"true",className:l,style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:i,...d}})});Os.displayName="TkxConfetti";var qs="data-tkx-seo";function Us(){"undefined"!=typeof document&&document.querySelectorAll(`[${qs}]`).forEach(e=>e.remove())}function Ks(e,t,n="name"){if("undefined"==typeof document||!t)return;const r=document.createElement("meta");r.setAttribute(n,e),r.content=t,r.setAttribute(qs,"1"),document.head.appendChild(r)}function Ys({title:e,description:t,canonical:n,keywords:r,image:o,twitterSite:i,twitterCreator:a,ogType:l="website",locale:d,robots:c="index, follow, max-snippet:-1, max-image-preview:large",schema:u}){return s(()=>{if("undefined"!=typeof document)return Us(),e&&(document.title=e),t&&Ks("description",t),r&&Ks("keywords",r),Ks("robots",c),e&&Ks("og:title",e,"property"),t&&Ks("og:description",t,"property"),Ks("og:type",l,"property"),n&&Ks("og:url",n,"property"),o&&(Ks("og:image",o,"property"),Ks("og:image:width","1200","property"),Ks("og:image:height","630","property")),d&&Ks("og:locale",d,"property"),Ks("twitter:card",o?"summary_large_image":"summary"),e&&Ks("twitter:title",e),t&&Ks("twitter:description",t),o&&Ks("twitter:image",o),i&&Ks("twitter:site",i),a&&Ks("twitter:creator",a),n&&function(e,t){if("undefined"==typeof document||!t)return;const n=document.createElement("link");n.rel="canonical",n.href=t,n.setAttribute(qs,"1"),document.head.appendChild(n)}(0,n),u&&function(e){if("undefined"==typeof document)return;const t=Array.isArray(e)?e:[e];for(const n of t){const e=document.createElement("script");e.type="application/ld+json",e.text=JSON.stringify(n),e.setAttribute(qs,"1"),document.head.appendChild(e)}}(u),()=>Us()},[e,t,n,r,o,i,a,l,d,c,u]),null}var Xs={softwareApplication:e=>({"@context":"https://schema.org","@type":"SoftwareApplication",name:e.name,description:e.description,url:e.url,applicationCategory:"DeveloperApplication",operatingSystem:"Web",...e.version&&{softwareVersion:e.version,version:e.version},...e.license&&{license:e.license},...e.repository&&{codeRepository:e.repository},...e.downloadUrl&&{downloadUrl:e.downloadUrl},...void 0!==e.price&&{offers:{"@type":"Offer",price:e.price,priceCurrency:e.currency??"USD"}}}),article:e=>({"@context":"https://schema.org","@type":"Article",headline:e.headline,description:e.description,mainEntityOfPage:e.url,...e.image&&{image:e.image},author:{"@type":"Person",name:e.author},datePublished:e.datePublished,...e.dateModified&&{dateModified:e.dateModified}}),faqPage:e=>({"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(e=>({"@type":"Question",name:e.question,acceptedAnswer:{"@type":"Answer",text:e.answer}}))}),breadcrumbList:e=>({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((e,t)=>({"@type":"ListItem",position:t+1,name:e.name,item:e.url}))}),product:e=>({"@context":"https://schema.org","@type":"Product",name:e.name,description:e.description,image:e.image,brand:{"@type":"Brand",name:e.brand},...e.sku&&{sku:e.sku},offers:{"@type":"Offer",price:e.price,priceCurrency:e.currency,availability:`https://schema.org/${e.availability??"InStock"}`},...e.rating&&{aggregateRating:{"@type":"AggregateRating",ratingValue:e.rating.value,reviewCount:e.rating.count}}})},Zs=["Pratipada","Dwitiya","Tritiya","Chaturthi","Panchami","Shashthi","Saptami","Ashtami","Navami","Dashami","Ekadashi","Dwadashi","Trayodashi","Chaturdashi","Purnima","Pratipada","Dwitiya","Tritiya","Chaturthi","Panchami","Shashthi","Saptami","Ashtami","Navami","Dashami","Ekadashi","Dwadashi","Trayodashi","Chaturdashi","Amavasya"],Gs=["Ashwini","Bharani","Krittika","Rohini","Mrigashira","Ardra","Punarvasu","Pushya","Ashlesha","Magha","Purva Phalguni","Uttara Phalguni","Hasta","Chitra","Swati","Vishakha","Anuradha","Jyeshtha","Mula","Purva Ashadha","Uttara Ashadha","Shravana","Dhanishtha","Shatabhisha","Purva Bhadrapada","Uttara Bhadrapada","Revati"];function _s(e,t,n){try{return{gregorian:e,display:new Intl.DateTimeFormat(`${t}-u-ca-${n}`,{day:"numeric",month:"long",year:"numeric"}).format(e)}}catch{return{gregorian:e,display:e.toISOString().slice(0,10)}}}function Js(e,t,n,r){switch(t){case"hindu":return function(e,t,n){const{tithi:r,nakshatra:o}=n?n(e):function(e){const t=function(e){return e.getTime()/864e5-10957.5}(e),n=function(e){return(280.46+.9856474*e)%360}(t),r=function(e){return(218.316+13.176396*e)%360}(t);let o=(r-n+360)%360;const i=Math.floor(o/12)+1,a=Math.floor(r%360/(360/27))+1;return{tithi:Math.max(1,Math.min(30,i)),nakshatra:a}}(e);return{gregorian:e,display:`${new Intl.DateTimeFormat(t,{dateStyle:"medium"}).format(e)} · ${r<=15?"Shukla":"Krishna"} ${Zs[r-1]} · ${Gs[o-1]}`,tithi:r,nakshatra:o}}(e,n,r);case"hijri":return _s(e,n,"islamic-civil");case"hebrew":return _s(e,n,"hebrew");case"buddhist":return _s(e,n,"buddhist");default:return function(e,t){return{gregorian:e,display:new Intl.DateTimeFormat(t,{dateStyle:"long"}).format(e)}}(e,n)}}var Qs=i(function({value:e,onChange:t,calendar:n="gregorian",locale:r,tithiResolver:o,label:i,minDate:a,maxDate:l,disabled:s,className:d,style:c},u){const h=se(),f=yn(),g=r??("undefined"!=typeof navigator?navigator.language:"en-US"),[y,v]=m(!1),w=p(()=>e?Js(e,n,g,o).display:"",[e,n,g,o]),k={display:"inline-flex",flexDirection:"column",gap:6,width:"100%",maxWidth:360,...c},$={display:"flex",alignItems:"stretch",border:`1px solid ${h.border}`,borderRadius:8,background:h.surface,overflow:"hidden"},S={flex:1,border:"none",outline:"none",padding:"0 12px",fontSize:14,color:h.text,background:"transparent",minHeight:40,minWidth:0};/* @__PURE__ */
|
|
463
465
|
return b("div",{className:d,style:k,children:[i&&/* @__PURE__ */x("label",{style:{fontSize:13,fontWeight:600,color:h.text},children:i}),
|
|
@@ -5,9 +5,27 @@ export interface AddressValue {
|
|
|
5
5
|
city?: string;
|
|
6
6
|
state?: string;
|
|
7
7
|
country?: string;
|
|
8
|
+
subDistrict?: string;
|
|
9
|
+
countryCode?: string;
|
|
10
|
+
stateCode?: string;
|
|
11
|
+
districtCode?: string;
|
|
12
|
+
subDistrictCode?: string;
|
|
8
13
|
line1?: string;
|
|
9
14
|
line2?: string;
|
|
10
15
|
}
|
|
16
|
+
export interface AdminDivision {
|
|
17
|
+
code: string;
|
|
18
|
+
name: string;
|
|
19
|
+
localName?: string;
|
|
20
|
+
}
|
|
21
|
+
export type DivisionLevel = 'country' | 'state' | 'district' | 'subDistrict';
|
|
22
|
+
export interface DivisionsLoader {
|
|
23
|
+
countries(signal?: AbortSignal): Promise<AdminDivision[]>;
|
|
24
|
+
states(countryCode: string, signal?: AbortSignal): Promise<AdminDivision[]>;
|
|
25
|
+
districts(countryCode: string, stateCode: string, signal?: AbortSignal): Promise<AdminDivision[]>;
|
|
26
|
+
subDistricts(countryCode: string, stateCode: string, districtCode: string, signal?: AbortSignal): Promise<AdminDivision[]>;
|
|
27
|
+
subDistrictLabel?(countryCode: string, stateCode: string): string;
|
|
28
|
+
}
|
|
11
29
|
interface PostOffice {
|
|
12
30
|
Name: string;
|
|
13
31
|
District: string;
|
|
@@ -22,6 +40,7 @@ export interface TkxAddressInputProps {
|
|
|
22
40
|
value: Partial<AddressValue>;
|
|
23
41
|
onChange: (value: AddressValue) => void;
|
|
24
42
|
lookup?: PinLookupFn;
|
|
43
|
+
divisionsSource?: DivisionsLoader;
|
|
25
44
|
label?: string;
|
|
26
45
|
showAddressLines?: boolean;
|
|
27
46
|
disabled?: boolean;
|
|
@@ -4,7 +4,8 @@ export type { FormInstance, ValidationRule } from '../components/TkxForm';
|
|
|
4
4
|
export { extractAtomicCSS, resetAtomicCSS, cx, tkxPlugin, tkxRemovePlugin, tkxListPlugins } from '../engine/tkx';
|
|
5
5
|
export { extractCSS, resetStyles, injectStyles, cssVar } from '../engine/css';
|
|
6
6
|
export { meetsAA, meetsAAA, contrastRatio } from '../engine/wcag';
|
|
7
|
-
export { sanitizeString, sanitizeProps } from '../engine/security';
|
|
7
|
+
export { sanitizeString, sanitizeProps, sanitizeUnicode, sanitizeJSON, sniffMimeType, scrubPII, audit, getAuditLog, verifyAuditIntegrity, sha256Hex, buildTkxCSP, installTrustedTypes, isFramed, createRateLimiter, } from '../engine/security';
|
|
8
|
+
export type { AuditEntry, AuditFilter, CSPDirectives, TkxCSPOptions, RateLimiter, PropSchema, ValidationResult, ComponentPermissions, } from '../engine/security';
|
|
8
9
|
export { useDisclosure } from './useDisclosure';
|
|
9
10
|
export { useRovingTabIndex } from './useRovingTabIndex';
|
|
10
11
|
export { useFormState } from './useFormState';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tekivex-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.20.0",
|
|
4
4
|
"description": "Production-grade React component library — 116 components (plus 4 experimental, opt-in), WCAG 2.1 AAA, WAI-ARIA 1.2, built-in security kernel with published threat model, built-in charts, headless primitives, zero-runtime CSS engine, 44-locale i18n, Indian KYC pack, agent runtime (Anthropic/OpenAI/Gemini/Ollama/MCP/A2A), TypeScript-first.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|