@sauravluitel/date-time-picker-custom 1.0.0 → 1.0.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.
@@ -1,6 +1,6 @@
1
- (function(z,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("react"),require("lucide-react"),require("date-fns"),require("framer-motion")):typeof define=="function"&&define.amd?define(["exports","react","lucide-react","date-fns","framer-motion"],c):(z=typeof globalThis<"u"?globalThis:z||self,c(z.DateTimePickerCustom={},z.React,z.lucideReact,z.dateFns,z.framerMotion))})(this,(function(z,c,Z,M,K){"use strict";var te={exports:{}},$={};var ce;function ie(){if(ce)return $;ce=1;var m=Symbol.for("react.transitional.element"),v=Symbol.for("react.fragment");function W(u,l,p){var k=null;if(p!==void 0&&(k=""+p),l.key!==void 0&&(k=""+l.key),"key"in l){p={};for(var j in l)j!=="key"&&(p[j]=l[j])}else p=l;return l=p.ref,{$$typeof:m,type:u,key:k,ref:l!==void 0?l:null,props:p}}return $.Fragment=v,$.jsx=W,$.jsxs=W,$}var ee={};var ae;function ue(){return ae||(ae=1,process.env.NODE_ENV!=="production"&&(function(){function m(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===w?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case O:return"Profiler";case P:return"StrictMode";case i:return"Suspense";case d:return"SuspenseList";case V:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case J:return"Portal";case B:return e.displayName||"Context";case N:return(e._context.displayName||"Context")+".Consumer";case U:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case y:return r=e.displayName||null,r!==null?r:m(e.type)||"Memo";case x:r=e._payload,e=e._init;try{return m(e(r))}catch{}}return null}function v(e){return""+e}function W(e){try{v(e);var r=!1}catch{r=!0}if(r){r=console;var n=r.error,o=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",o),v(e)}}function u(e){if(e===C)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===x)return"<...>";try{var r=m(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function l(){var e=I.A;return e===null?null:e.getOwner()}function p(){return Error("react-stack-top-frame")}function k(e){if(_.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function j(e,r){function n(){D||(D=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function Q(){var e=m(this.type);return Y[e]||(Y[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function A(e,r,n,o,h,S){var g=n.ref;return e={$$typeof:H,type:e,key:r,props:n,_owner:o},(g!==void 0?g:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:Q}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:h}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:S}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function f(e,r,n,o,h,S){var g=r.children;if(g!==void 0)if(o)if(X(g)){for(o=0;o<g.length;o++)R(g[o]);Object.freeze&&Object.freeze(g)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else R(g);if(_.call(r,"key")){g=m(e);var F=Object.keys(r).filter(function(q){return q!=="key"});o=0<F.length?"{key: someKey, "+F.join(": ..., ")+": ...}":"{key: someKey}",s[g+o]||(F=0<F.length?"{"+F.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(J,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("react"),require("lucide-react"),require("date-fns"),require("framer-motion")):typeof define=="function"&&define.amd?define(["exports","react","lucide-react","date-fns","framer-motion"],f):(J=typeof globalThis<"u"?globalThis:J||self,f(J.DateTimePickerCustom={},J.React,J.lucideReact,J.dateFns,J.framerMotion))})(this,(function(J,f,Z,g,q){"use strict";var ce={exports:{}},re={};var fe;function pe(){if(fe)return re;fe=1;var b=Symbol.for("react.transitional.element"),P=Symbol.for("react.fragment");function F(p,d,C){var k=null;if(C!==void 0&&(k=""+C),d.key!==void 0&&(k=""+d.key),"key"in d){C={};for(var T in d)T!=="key"&&(C[T]=d[T])}else C=d;return d=C.ref,{$$typeof:b,type:p,key:k,ref:d!==void 0?d:null,props:C}}return re.Fragment=P,re.jsx=F,re.jsxs=F,re}var se={};var de;function he(){return de||(de=1,process.env.NODE_ENV!=="production"&&(function(){function b(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===D?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case x:return"Fragment";case G:return"Profiler";case N:return"StrictMode";case z:return"Suspense";case l:return"SuspenseList";case j:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case A:return"Portal";case L:return e.displayName||"Context";case X:return(e._context.displayName||"Context")+".Consumer";case W:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case m:return s=e.displayName||null,s!==null?s:b(e.type)||"Memo";case v:s=e._payload,e=e._init;try{return b(e(s))}catch{}}return null}function P(e){return""+e}function F(e){try{P(e);var s=!1}catch{s=!0}if(s){s=console;var i=s.error,a=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i.call(s,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",a),P(e)}}function p(e){if(e===x)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===v)return"<...>";try{var s=b(e);return s?"<"+s+">":"<...>"}catch{return"<...>"}}function d(){var e=M.A;return e===null?null:e.getOwner()}function C(){return Error("react-stack-top-frame")}function k(e){if(Y.call(e,"key")){var s=Object.getOwnPropertyDescriptor(e,"key").get;if(s&&s.isReactWarning)return!1}return e.key!==void 0}function T(e,s){function i(){U||(U=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",s))}i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}function E(){var e=b(this.type);return ee[e]||(ee[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function O(e,s,i,a,r,c){var t=i.ref;return e={$$typeof:h,type:e,key:s,props:i,_owner:a},(t!==void 0?t:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:E}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:r}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:c}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function S(e,s,i,a,r,c){var t=s.children;if(t!==void 0)if(a)if(_(t)){for(a=0;a<t.length;a++)H(t[a]);Object.freeze&&Object.freeze(t)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else H(t);if(Y.call(s,"key")){t=b(e);var u=Object.keys(s).filter(function(y){return y!=="key"});a=0<u.length?"{key: someKey, "+u.join(": ..., ")+": ...}":"{key: someKey}",ne[t+a]||(u=0<u.length?"{"+u.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,o,g,F,g),s[g+o]=!0)}if(g=null,n!==void 0&&(W(n),g=""+n),k(r)&&(W(r.key),g=""+r.key),"key"in r){n={};for(var G in r)G!=="key"&&(n[G]=r[G])}else n=r;return g&&j(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),A(e,g,n,l(),h,S)}function R(e){T(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===x&&(e._payload.status==="fulfilled"?T(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function T(e){return typeof e=="object"&&e!==null&&e.$$typeof===H}var E=c,H=Symbol.for("react.transitional.element"),J=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),B=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),w=Symbol.for("react.client.reference"),I=E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,_=Object.prototype.hasOwnProperty,X=Array.isArray,a=console.createTask?console.createTask:function(){return null};E={react_stack_bottom_frame:function(e){return e()}};var D,Y={},b=E.react_stack_bottom_frame.bind(E,p)(),L=a(u(p)),s={};ee.Fragment=C,ee.jsx=function(e,r,n){var o=1e4>I.recentlyCreatedOwnerStacks++;return f(e,r,n,!1,o?Error("react-stack-top-frame"):b,o?a(u(e)):L)},ee.jsxs=function(e,r,n){var o=1e4>I.recentlyCreatedOwnerStacks++;return f(e,r,n,!0,o?Error("react-stack-top-frame"):b,o?a(u(e)):L)}})()),ee}var le;function de(){return le||(le=1,process.env.NODE_ENV==="production"?te.exports=ie():te.exports=ue()),te.exports}var t=de();const fe=m=>{const[v,W]=c.useState(!1);return c.useEffect(()=>{const u=window.matchMedia(m);u.matches!==v&&W(u.matches);const l=()=>W(u.matches);return u.addEventListener("change",l),()=>u.removeEventListener("change",l)},[v,m]),v},re=()=>fe("(max-width: 768px)"),se=({icon:m,value:v,onChange:W,onToggle:u,placeholder:l,error:p,onClear:k,mask:j,onFocus:Q,onBlur:A})=>{const f=re(),[R,T]=c.useState(!1),[E,H]=c.useState("down"),J=c.useRef(null),C=c.useRef(null),P=()=>{if(C.current){const i=C.current.getBoundingClientRect(),d=window.innerHeight-i.bottom,y=i.top;d<350&&y>d?H("up"):H("down")}},O=i=>{i&&i.stopPropagation(),P(),u()},N=(i,d)=>{const y=parseInt(i,10);return isNaN(y)?i:d==="month"?Math.min(Math.max(y,1),12).toString().padStart(2,"0"):d==="day"?Math.min(Math.max(y,1),31).toString().padStart(2,"0"):d==="hour"?Math.min(Math.max(y,0),23).toString().padStart(2,"0"):d==="hour12"?Math.min(Math.max(y,1),12).toString().padStart(2,"0"):d==="minsec"?Math.min(Math.max(y,0),59).toString().padStart(2,"0"):i},B=i=>{if(!j)return i;if(j==="date"){const d=i.replace(/[^0-9]/g,"");let y=d.substring(0,4),x=d.substring(4,6),V=d.substring(6,8),w=y;return d.length>4?(x.length===2&&(x=N(x,"month")),w+="/"+x):d.length===4&&i.length===4&&(w+="/"),d.length>6?(V.length===2&&(V=N(V,"day")),w+="/"+V):d.length===6&&i.length===7&&(w+="/"),w}if(j.includes("time")){const d=j.endsWith("-ampm"),y=j.includes("seconds"),x=i.replace(/[^0-9]/g,""),V=i.toLowerCase().match(/[ap]/);let w="";d&&V&&(w=V[0]==="a"?"AM":"PM");let I=x.substring(0,2);x.substring(2,4),x.substring(4,6);let _=I;if(x.length>=2&&(I.length===2&&(I=N(I,d?"hour12":"hour")),_=I+":",x.length>2)){let X=x.substring(2,4);if(X.length===2&&(X=N(X,"minsec")),_+=X,x.length>=4)if(y){if(_+=":",x.length>4){let a=x.substring(4,6);a.length===2&&(a=N(a,"minsec")),_+=a,x.length>=6&&d&&(_+=" "+(w||""))}}else d&&(_+=" "+(w||""))}return d&&w&&!_.includes(w)&&(_.includes(" ")||(_+=" "),_+=w),_.trimEnd()}return i},U=i=>{const d=i.target.value,y=B(d);W(y)};return t.jsxs("div",{ref:C,className:`input-container glass-card ${R?"focused":""} ${p?"error":""} drop-${E}`,onClick:O,children:[t.jsx("div",{className:"input-icon-wrapper",children:t.jsx(m,{size:18,className:"input-icon"})}),t.jsx("input",{ref:J,type:"text",placeholder:l,className:"shared-input",value:v,onChange:U,readOnly:f,onFocus:i=>{T(!0),P(),Q&&Q(i)},onBlur:i=>{T(!1),A&&A(i)},onClick:i=>{f?O(i):i.stopPropagation()}}),v&&k&&t.jsx("button",{className:"clear-btn",onClick:i=>{i.stopPropagation(),k()},children:t.jsx(Z.X,{size:14})})]})},me=({value:m,onChange:v,placeholder:W="YYYY/MM/DD"})=>{const u=re(),[l,p]=c.useState(!1),[k,j]=c.useState("calendar"),[Q,A]=c.useState(m?M.format(new Date(m),"yyyy/MM/dd"):""),[f,R]=c.useState(m?new Date(m):new Date),[T,E]=c.useState(m?new Date(m):new Date),[H,J]=c.useState(!1),C=c.useRef(null),P=c.useRef(null),O=c.useRef(null),N=c.useRef(null),B=c.useRef(null),U=c.useRef(0),i=Array.from({length:151},(s,e)=>new Date().getFullYear()-100+e),d=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],y=new Date(f.getFullYear(),f.getMonth()+1,0).getDate(),x=Array.from({length:y},(s,e)=>e+1);c.useEffect(()=>{if(!H&&!l)if(m){const s=M.format(new Date(m),"yyyy/MM/dd");A(s),E(new Date(m)),R(new Date(m))}else A(""),R(new Date)},[m,H,l]),c.useEffect(()=>{if(l&&u){const s=()=>{const n=i.indexOf(f.getFullYear());P.current&&n!==-1&&(P.current.scrollTop=n*32),O.current&&(O.current.scrollTop=f.getMonth()*32),N.current&&(N.current.scrollTop=(f.getDate()-1)*32)};s();const e=setTimeout(s,50),r=setTimeout(s,300);return()=>{clearTimeout(e),clearTimeout(r)}}},[l,u]);const V=()=>{if(!l){const s=m?new Date(m):new Date;R(s),E(s),j("calendar"),U.current=Date.now()}p(!l)},w=()=>{v(f),A(M.format(f,"yyyy/MM/dd")),p(!1)},I=s=>{if(A(s),s===""){v(null),R(new Date);return}const e=M.parse(s,"yyyy/MM/dd",new Date);M.isValid(e)&&(v(e),E(e),R(e))},_=s=>{u?R(s):(v(s),A(M.format(s,"yyyy/MM/dd")),p(!1))},X=s=>{const e=new Date(T);e.setFullYear(s),E(e),j("calendar")},a=s=>{const e=new Date(T);e.setMonth(s),E(e),j("calendar")};c.useEffect(()=>{const s=e=>{C.current&&!C.current.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[]),c.useEffect(()=>(u&&l?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[l,u]);const D=()=>t.jsxs("div",{className:"selector-view",children:[t.jsx("div",{className:"calendar-header",children:t.jsx("span",{children:"Select Month"})}),t.jsx("div",{className:"grid-selector column-3",children:d.map((s,e)=>t.jsx("button",{className:`select-cell ${T.getMonth()===e?"active":""}`,onClick:()=>a(e),children:s},s))})]}),Y=()=>{const s=Math.floor(T.getFullYear()/12)*12,e=Array.from({length:12},(r,n)=>s+n);return t.jsxs("div",{className:"selector-view",children:[t.jsxs("div",{className:"calendar-header",children:[t.jsx("button",{onClick:()=>E(M.subMonths(T,144)),children:t.jsx(Z.ChevronLeft,{size:16})}),t.jsx("span",{children:"Select Year"}),t.jsx("button",{onClick:()=>E(M.addMonths(T,144)),children:t.jsx(Z.ChevronRight,{size:16})})]}),t.jsx("div",{className:"grid-selector column-3",children:e.map(r=>t.jsx("button",{className:`select-cell ${T.getFullYear()===r?"active":""}`,onClick:()=>X(r),children:r},r))})]})},b=()=>{const s=["Su","Mo","Tu","We","Th","Fr","Sa"],e=M.startOfMonth(T),r=M.endOfMonth(T),n=M.eachDayOfInterval({start:e,end:r}),o=Array(M.getDay(e)).fill(null);return k==="year"?Y():k==="month"?D():t.jsxs("div",{className:"desktop-calendar",children:[t.jsxs("div",{className:"calendar-header",children:[t.jsx("button",{onClick:()=>E(M.subMonths(T,1)),children:t.jsx(Z.ChevronLeft,{size:18})}),t.jsxs("div",{className:"header-nav",children:[t.jsx("span",{className:"nav-btn",onClick:()=>j("month"),children:M.format(T,"MMMM")}),t.jsx("span",{className:"nav-btn",onClick:()=>j("year"),children:M.format(T,"yyyy")})]}),t.jsx("button",{onClick:()=>E(M.addMonths(T,1)),children:t.jsx(Z.ChevronRight,{size:18})})]}),t.jsxs("div",{className:"calendar-grid",children:[s.map(h=>t.jsx("div",{className:"calendar-day-header",children:h},h)),o.map((h,S)=>t.jsx("div",{},`empty-${S}`)),n.map(h=>t.jsx("button",{className:`calendar-day-cell ${M.isSameDay(h,new Date(m))?"active":""} ${M.isSameDay(h,new Date)?"today":""}`,onClick:()=>_(h),children:M.format(h,"d")},h.toString()))]})]})},L=()=>{const s=(r,n)=>{const o=new Date(f);let h=o.getDate();r==="year"&&o.setFullYear(n),r==="month"&&o.setMonth(n),r==="day"&&(o.setDate(n),h=n);const S=new Date(o.getFullYear(),o.getMonth()+1,0).getDate();h>S&&o.setDate(S),R(o),r==="year"&&P.current&&P.current.scrollTo({top:i.indexOf(n)*32,behavior:"smooth"}),r==="month"&&O.current&&O.current.scrollTo({top:n*32,behavior:"smooth"}),r==="day"&&N.current&&N.current.scrollTo({top:(n-1)*32,behavior:"smooth"}),r!=="day"&&h>S&&N.current&&N.current.scrollTo({top:(S-1)*32,behavior:"smooth"})},e=(r,n,o)=>{if(Date.now()-U.current<500)return;const h=r.target.scrollTop,S=Math.round(h/32);if(S>=0&&S<o.length){const g=o[S];B.current&&clearTimeout(B.current),B.current=setTimeout(()=>{let F=f.getFullYear(),G=f.getMonth(),q=f.getDate();n==="year"&&(F=g),n==="month"&&(G=g),n==="day"&&(q=g);const ne=new Date(F,G+1,0).getDate();q>ne&&(q=ne);const oe=new Date(F,G,q);oe.setHours(f.getHours(),f.getMinutes(),f.getSeconds(),f.getMilliseconds()),f.getTime()!==oe.getTime()&&R(oe),n!=="day"&&f.getDate()>ne&&N.current&&N.current.scrollTo({top:(ne-1)*32,behavior:"smooth"})},150)}};return t.jsxs("div",{className:"mobile-scroll-picker",children:[t.jsxs("div",{className:"mobile-header",children:[t.jsx("h3",{children:"Select Date"}),t.jsx("span",{className:"selected-preview",children:M.format(f,"dd MMM yyyy")})]}),t.jsxs("div",{className:"scroll-columns",style:{touchAction:"pan-y"},children:[t.jsx("div",{className:"scroll-col year-col",ref:P,onScroll:r=>e(r,"year",i),children:i.map(r=>t.jsx("div",{className:`scroll-item ${f.getFullYear()===r?"selected":""}`,onClick:()=>s("year",r),children:r},r))}),t.jsx("div",{className:"scroll-col month-col",ref:O,onScroll:r=>e(r,"month",d.map((n,o)=>o)),children:d.map((r,n)=>t.jsx("div",{className:`scroll-item ${f.getMonth()===n?"selected":""}`,onClick:()=>s("month",n),children:r},r))}),t.jsx("div",{className:"scroll-col day-col",ref:N,onScroll:r=>e(r,"day",x),children:x.map(r=>t.jsx("div",{className:`scroll-item ${f.getDate()===r?"selected":""}`,onClick:()=>s("day",r),children:r},r))})]}),t.jsx("button",{className:"confirm-btn",onClick:w,children:"Confirm"})]})};return t.jsxs("div",{className:"datepicker-wrapper",ref:C,children:[t.jsx(se,{icon:Z.Calendar,value:Q,onChange:I,onToggle:V,placeholder:W,mask:"date",onFocus:()=>J(!0),onBlur:()=>J(!1),onClear:()=>{A(""),v(null)}}),t.jsx(K.AnimatePresence,{children:l&&t.jsxs(t.Fragment,{children:[u&&t.jsx(K.motion.div,{className:"mobile-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>p(!1)}),t.jsx(K.motion.div,{initial:{y:u?"100%":20,opacity:0},animate:{y:0,opacity:1},exit:{y:u?"100%":20,opacity:0},transition:{type:"spring",damping:25,stiffness:200},className:`picker-dropdown glass-card ${u?"mobile":"desktop"}`,children:u?L():b()})]})})]})},he=({value:m,onChange:v,placeholder:W="HH/MM AM/PM",showSeconds:u=!1,use12h:l=!0})=>{const p=re(),[k,j]=c.useState(!1),[Q,A]=c.useState(m||""),[f,R]=c.useState(m||""),[T,E]=c.useState(!1),H=c.useRef(null),J=c.useRef(null),C=c.useRef(null),P=c.useRef(null),O=c.useRef(null),N=c.useRef(null),B=c.useRef(0),U=l?Array.from({length:12},(a,D)=>(D+1).toString().padStart(2,"0")):Array.from({length:24},(a,D)=>D.toString().padStart(2,"0")),i=Array.from({length:60},(a,D)=>D.toString().padStart(2,"0")),d=Array.from({length:60},(a,D)=>D.toString().padStart(2,"0")),y=["AM","PM"];c.useEffect(()=>{!T&&!k&&(A(m||""),R(m||""))},[m,T,k]),c.useEffect(()=>{if(k&&p){let a="01:00";u&&(a+=":00"),l&&(a+=" AM");const Y=(f||a).split(" "),b=Y[0].split(":"),L=Y[1]||"AM",s=()=>{const n=U.indexOf(b[0]);J.current&&n!==-1&&(J.current.scrollTop=n*32),C.current&&(C.current.scrollTop=parseInt(b[1]||0)*32),P.current&&u&&(P.current.scrollTop=parseInt(b[2]||0)*32),O.current&&l&&(O.current.scrollTop=y.indexOf(L)*32)};s();const e=setTimeout(s,50),r=setTimeout(s,300);return()=>{clearTimeout(e),clearTimeout(r)}}},[k,p]);const x=()=>{if(!k){let a="01:00";u&&(a+=":00"),l&&(a+=" AM"),R(Q||a),B.current=Date.now()}j(!k)},V=()=>{A(f),v(f),j(!1)},w=a=>{A(a);const Y=a.split(" ")[0].split(":");Y.length>=2?Y.every(L=>L.length===2)&&(v(a),R(a)):a===""&&(v(""),R(""))},I=a=>{R(a),p||A(a)};c.useEffect(()=>{const a=D=>{H.current&&!H.current.contains(D.target)&&j(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]),c.useEffect(()=>(p&&k?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[k,p]);const _=()=>{let a="01:00";u&&(a+=":00"),l&&(a+=" AM");const Y=(f||a).split(" "),b=Y[0].split(":"),L=Y[1]||"AM",s=(e=b[0]||"12",r=b[1]||"00",n=b[2]||"00",o=L)=>{let h=`${e}:${r}`;u&&(h+=`:${n}`),l&&(h+=` ${o}`),I(h)};return t.jsxs("div",{className:`desktop-time-picker ${u?"with-seconds":""}`,children:[t.jsxs("div",{className:"time-select-grid",children:[t.jsxs("div",{className:"time-col",children:[t.jsx("span",{className:"col-label",children:"Hrs"}),t.jsx("div",{className:"time-scroll",children:U.map(e=>t.jsx("button",{className:`time-btn ${b[0]===e?"active":""}`,onClick:()=>s(e),children:e},e))})]}),t.jsxs("div",{className:"time-col",children:[t.jsx("span",{className:"col-label",children:"Min"}),t.jsx("div",{className:"time-scroll",children:i.map(e=>t.jsx("button",{className:`time-btn ${b[1]===e?"active":""}`,onClick:()=>s(void 0,e),children:e},e))})]}),u&&t.jsxs("div",{className:"time-col",children:[t.jsx("span",{className:"col-label",children:"Sec"}),t.jsx("div",{className:"time-scroll",children:d.map(e=>t.jsx("button",{className:`time-btn ${b[2]===e?"active":""}`,onClick:()=>s(void 0,void 0,e),children:e},e))})]}),l&&t.jsxs("div",{className:"time-col",children:[t.jsx("span",{className:"col-label",children:"Mode"}),t.jsx("div",{className:"time-scroll",children:y.map(e=>t.jsx("button",{className:`time-btn ${L===e?"active":""}`,onClick:()=>s(void 0,void 0,void 0,e),children:e},e))})]})]}),t.jsx("div",{className:"desktop-footer",children:t.jsxs("button",{className:"confirm-btn small",onClick:V,children:[t.jsx(Z.Check,{size:16,style:{marginRight:"6px"}})," Done"]})})]})},X=()=>{let a="01:00";u&&(a+=":00"),l&&(a+=" AM");const Y=(f||a).split(" "),b=Y[0].split(":"),L=Y[1]||"AM",s=(n,o)=>{const h=[...b];for(;h.length<(u?3:2);)h.push("00");h[n]=o;let S=h.slice(0,u?3:2).join(":");l&&(S+=` ${L}`),I(S),n===0&&J.current&&J.current.scrollTo({top:U.indexOf(o)*32,behavior:"smooth"}),n===1&&C.current&&C.current.scrollTo({top:i.indexOf(o)*32,behavior:"smooth"}),n===2&&P.current&&P.current.scrollTo({top:d.indexOf(o)*32,behavior:"smooth"})},e=n=>{let o=b.slice(0,u?3:2).join(":");l&&(o+=` ${n}`),I(o),O.current&&O.current.scrollTo({top:y.indexOf(n)*32,behavior:"smooth"})},r=(n,o,h,S)=>{if(Date.now()-B.current<500)return;const g=n.target.scrollTop,F=Math.round(g/32);if(F>=0&&F<S.length){const G=S[F];N.current&&clearTimeout(N.current),N.current=setTimeout(()=>{o==="part"?b[h]!==G&&s(h,G):o==="ampm"&&L!==G&&e(G)},150)}};return t.jsxs("div",{className:"mobile-scroll-picker",children:[t.jsxs("div",{className:"mobile-header",children:[t.jsx("h3",{children:"Select Time"}),t.jsx("span",{className:"selected-preview",children:f||"--:--"})]}),t.jsxs("div",{className:"scroll-columns",style:{touchAction:"pan-y"},children:[t.jsx("div",{className:"scroll-col hour-col",ref:J,onScroll:n=>r(n,"part",0,U),children:U.map(n=>t.jsx("div",{className:`scroll-item ${b[0]===n?"selected":""}`,onClick:()=>s(0,n),children:n},n))}),t.jsx("div",{className:"scroll-col min-col",ref:C,onScroll:n=>r(n,"part",1,i),children:i.map(n=>t.jsx("div",{className:`scroll-item ${b[1]===n?"selected":""}`,onClick:()=>s(1,n),children:n},n))}),u&&t.jsx("div",{className:"scroll-col sec-col",ref:P,onScroll:n=>r(n,"part",2,d),children:d.map(n=>t.jsx("div",{className:`scroll-item ${b[2]===n?"selected":""}`,onClick:()=>s(2,n),children:n},n))}),l&&t.jsx("div",{className:"scroll-col ampm-col",ref:O,onScroll:n=>r(n,"ampm",null,y),children:y.map(n=>t.jsx("div",{className:`scroll-item ${L===n?"selected":""}`,onClick:()=>e(n),children:n},n))})]}),t.jsx("button",{className:"confirm-btn",onClick:V,children:"Confirm"})]})};return t.jsxs("div",{className:"timepicker-wrapper",ref:H,children:[t.jsx(se,{icon:Z.Clock,value:Q,onChange:w,onToggle:x,placeholder:u?"HH:MM:SS AM/PM":"HH:MM AM/PM",mask:u?l?"time-seconds-ampm":"time-seconds":l?"time-ampm":"time",onFocus:()=>E(!0),onBlur:()=>E(!1),onClear:()=>{A(""),R(""),v("")}}),t.jsx(K.AnimatePresence,{children:k&&t.jsxs(t.Fragment,{children:[p&&t.jsx(K.motion.div,{className:"mobile-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>j(!1)}),t.jsx(K.motion.div,{initial:{y:p?"100%":20,opacity:0},animate:{y:0,opacity:1},exit:{y:p?"100%":20,opacity:0},transition:{type:"spring",damping:25,stiffness:200},className:`picker-dropdown glass-card ${p?"mobile":"desktop"}`,children:p?X():_()})]})})]})};z.DatePicker=me,z.SharedInput=se,z.TimePicker=he,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})}));
6
+ <%s key={someKey} {...props} />`,a,t,u,t),ne[t+a]=!0)}if(t=null,i!==void 0&&(F(i),t=""+i),k(s)&&(F(s.key),t=""+s.key),"key"in s){i={};for(var o in s)o!=="key"&&(i[o]=s[o])}else i=s;return t&&T(i,typeof e=="function"?e.displayName||e.name||"Unknown":e),O(e,t,i,d(),r,c)}function H(e){V(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===v&&(e._payload.status==="fulfilled"?V(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function V(e){return typeof e=="object"&&e!==null&&e.$$typeof===h}var w=f,h=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),X=Symbol.for("react.consumer"),L=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),D=Symbol.for("react.client.reference"),M=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=Object.prototype.hasOwnProperty,_=Array.isArray,I=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(e){return e()}};var U,ee={},K=w.react_stack_bottom_frame.bind(w,C)(),te=I(p(C)),ne={};se.Fragment=x,se.jsx=function(e,s,i){var a=1e4>M.recentlyCreatedOwnerStacks++;return S(e,s,i,!1,a?Error("react-stack-top-frame"):K,a?I(p(e)):te)},se.jsxs=function(e,s,i){var a=1e4>M.recentlyCreatedOwnerStacks++;return S(e,s,i,!0,a?Error("react-stack-top-frame"):K,a?I(p(e)):te)}})()),se}var me;function ye(){return me||(me=1,process.env.NODE_ENV==="production"?ce.exports=pe():ce.exports=he()),ce.exports}var n=ye();const ge=b=>{const[P,F]=f.useState(!1);return f.useEffect(()=>{const p=window.matchMedia(b);p.matches!==P&&F(p.matches);const d=()=>F(p.matches);return p.addEventListener("change",d),()=>p.removeEventListener("change",d)},[P,b]),P},le=()=>ge("(max-width: 768px)"),ie=({icon:b,value:P,onChange:F,onToggle:p,placeholder:d,error:C,onClear:k,mask:T,onFocus:E,onBlur:O,disabled:S=!1})=>{const H=le(),[V,w]=f.useState(!1),[h,A]=f.useState("down"),x=f.useRef(null),N=f.useRef(null),G=()=>{if(N.current){const l=N.current.getBoundingClientRect(),m=window.innerHeight-l.bottom,v=l.top;m<350&&v>m?A("up"):A("down")}},X=l=>{S||(l&&l.stopPropagation(),G(),p())},L=(l,m)=>{const v=parseInt(l,10);return isNaN(v)?l:m==="month"?Math.min(Math.max(v,1),12).toString().padStart(2,"0"):m==="day"?Math.min(Math.max(v,1),31).toString().padStart(2,"0"):m==="hour"?Math.min(Math.max(v,0),23).toString().padStart(2,"0"):m==="hour12"?Math.min(Math.max(v,1),12).toString().padStart(2,"0"):m==="minsec"?Math.min(Math.max(v,0),59).toString().padStart(2,"0"):l},W=l=>{if(!T)return l;if(T==="date"){const m=l.replace(/[^0-9]/g,"");let v=m.substring(0,4),j=m.substring(4,6),D=m.substring(6,8),M=v;return m.length>4?(j.length===2&&(j=L(j,"month")),M+="/"+j):m.length===4&&l.length===4&&(M+="/"),m.length>6?(D.length===2&&(D=L(D,"day")),M+="/"+D):m.length===6&&l.length===7&&(M+="/"),M}if(T.includes("time")){const m=T.endsWith("-ampm"),v=T.includes("seconds"),j=l.replace(/[^0-9]/g,""),D=l.toLowerCase().match(/[ap]/);let M="";m&&D&&(M=D[0]==="a"?"AM":"PM");let Y=j.substring(0,2);j.substring(2,4),j.substring(4,6);let _=Y;if(j.length>=2&&(Y.length===2&&(Y=L(Y,m?"hour12":"hour")),_=Y+":",j.length>2)){let I=j.substring(2,4);if(I.length===2&&(I=L(I,"minsec")),_+=I,j.length>=4)if(v){if(_+=":",j.length>4){let U=j.substring(4,6);U.length===2&&(U=L(U,"minsec")),_+=U,j.length>=6&&m&&(_+=" "+(M||""))}}else m&&(_+=" "+(M||""))}return m&&M&&!_.includes(M)&&(_.includes(" ")||(_+=" "),_+=M),_.trimEnd()}return l},z=l=>{if(S)return;const m=l.target.value,v=W(m);F(v)};return n.jsxs("div",{ref:N,className:`input-container glass-card ${V?"focused":""} ${C?"error":""} ${S?"disabled":""} drop-${h}`,onClick:X,children:[n.jsx("div",{className:"input-icon-wrapper",children:n.jsx(b,{size:18,className:"input-icon"})}),n.jsx("input",{ref:x,type:"text",placeholder:d,className:"shared-input",value:P,onChange:z,readOnly:H||S,onFocus:l=>{S||(w(!0),G(),E&&E(l))},onBlur:l=>{w(!1),O&&O(l)},onClick:l=>{if(S){l.stopPropagation();return}H?X(l):l.stopPropagation()}}),!S&&P&&k&&n.jsx("button",{type:"button",className:"clear-btn",onClick:l=>{l.stopPropagation(),k()},children:n.jsx(Z.X,{size:14})})]})},be=({value:b,onChange:P,placeholder:F="YYYY/MM/DD",name:p,onBlur:d,disabled:C=!1})=>{const k=le(),[T,E]=f.useState(!1),[O,S]=f.useState("calendar"),H=r=>{if(!r)return null;if(r instanceof Date)return g.isValid(r)?r:null;if(typeof r=="string"){const t=r.replace(/\//g,"-"),u=g.parse(t,"yyyy-MM-dd",new Date);if(g.isValid(u))return u;const o=g.parse(t,"yyyy/MM/dd",new Date);if(g.isValid(o))return o}const c=new Date(r);return g.isValid(c)?c:null},[V,w]=f.useState(()=>{const r=H(b);return r?g.format(r,"yyyy/MM/dd"):""}),[h,A]=f.useState(()=>H(b)||new Date),[x,N]=f.useState(()=>H(b)||new Date),[G,X]=f.useState(!1),L=f.useRef(null),W=f.useRef(null),z=f.useRef(null),l=f.useRef(null),m=f.useRef(null),v=f.useRef(0),j=Array.from({length:151},(r,c)=>new Date().getFullYear()-100+c),D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],M=new Date(h.getFullYear(),h.getMonth()+1,0).getDate(),Y=Array.from({length:M},(r,c)=>c+1);f.useEffect(()=>{if(!G&&!T){const r=H(b);if(r){const c=g.format(r,"yyyy/MM/dd");w(c),N(r),A(r)}else w(""),A(new Date)}},[b,G,T]),f.useEffect(()=>{if(T&&k){const r=()=>{const u=j.indexOf(h.getFullYear());W.current&&u!==-1&&(W.current.scrollTop=u*32),z.current&&(z.current.scrollTop=h.getMonth()*32),l.current&&(l.current.scrollTop=(h.getDate()-1)*32)};r();const c=setTimeout(r,50),t=setTimeout(r,300);return()=>{clearTimeout(c),clearTimeout(t)}}},[T,k]);const _=()=>{if(!C){if(!T){const r=H(b)||new Date;A(r),N(r),S("calendar"),v.current=Date.now()}E(!T)}},I=r=>{const c=r?g.format(r,"yyyy-MM-dd"):"";P&&P({target:{name:p,value:c}})},U=()=>{I(h),w(g.format(h,"yyyy/MM/dd")),E(!1)},ee=r=>{if(w(r),r===""){I(null),A(new Date);return}const c=g.parse(r,"yyyy/MM/dd",new Date);g.isValid(c)&&(I(c),N(c),A(c))},K=r=>{k?A(r):(I(r),w(g.format(r,"yyyy/MM/dd")),E(!1))},te=r=>{const c=new Date(x);c.setFullYear(r),N(c),S("calendar")},ne=r=>{const c=new Date(x);c.setMonth(r),N(c),S("calendar")};f.useEffect(()=>{const r=c=>{L.current&&!L.current.contains(c.target)&&E(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]),f.useEffect(()=>(k&&T?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[T,k]);const e=()=>n.jsxs("div",{className:"selector-view",children:[n.jsx("div",{className:"calendar-header",children:n.jsx("span",{children:"Select Month"})}),n.jsx("div",{className:"grid-selector column-3",children:D.map((r,c)=>n.jsx("button",{type:"button",className:`select-cell ${x.getMonth()===c?"active":""}`,onClick:()=>ne(c),children:r},r))})]}),s=()=>{const r=Math.floor(x.getFullYear()/12)*12,c=Array.from({length:12},(t,u)=>r+u);return n.jsxs("div",{className:"selector-view",children:[n.jsxs("div",{className:"calendar-header",children:[n.jsx("button",{type:"button",onClick:()=>N(g.subMonths(x,144)),children:n.jsx(Z.ChevronLeft,{size:16})}),n.jsx("span",{children:"Select Year"}),n.jsx("button",{type:"button",onClick:()=>N(g.addMonths(x,144)),children:n.jsx(Z.ChevronRight,{size:16})})]}),n.jsx("div",{className:"grid-selector column-3",children:c.map(t=>n.jsx("button",{type:"button",className:`select-cell ${x.getFullYear()===t?"active":""}`,onClick:()=>te(t),children:t},t))})]})},i=()=>{const r=["Su","Mo","Tu","We","Th","Fr","Sa"],c=g.startOfMonth(x),t=g.endOfMonth(x),u=g.eachDayOfInterval({start:c,end:t}),o=Array(g.getDay(c)).fill(null);return O==="year"?s():O==="month"?e():n.jsxs("div",{className:"desktop-calendar",children:[n.jsxs("div",{className:"calendar-header",children:[n.jsx("button",{type:"button",onClick:()=>N(g.subMonths(x,1)),children:n.jsx(Z.ChevronLeft,{size:18})}),n.jsxs("div",{className:"header-nav",children:[n.jsx("span",{className:"nav-btn",onClick:()=>S("month"),children:g.format(x,"MMMM")}),n.jsx("span",{className:"nav-btn",onClick:()=>S("year"),children:g.format(x,"yyyy")})]}),n.jsx("button",{type:"button",onClick:()=>N(g.addMonths(x,1)),children:n.jsx(Z.ChevronRight,{size:18})})]}),n.jsxs("div",{className:"calendar-grid",children:[r.map(y=>n.jsx("div",{className:"calendar-day-header",children:y},y)),o.map((y,R)=>n.jsx("div",{},`empty-${R}`)),u.map(y=>n.jsx("button",{type:"button",className:`calendar-day-cell ${b&&g.isSameDay(y,H(b)||new Date(0))?"active":""} ${g.isSameDay(y,new Date)?"today":""}`,onClick:()=>K(y),children:g.format(y,"d")},y.toString()))]})]})},a=()=>{const r=(t,u)=>{const o=new Date(h);let y=o.getDate();t==="year"&&o.setFullYear(u),t==="month"&&o.setMonth(u),t==="day"&&(o.setDate(u),y=u);const R=new Date(o.getFullYear(),o.getMonth()+1,0).getDate();y>R&&o.setDate(R),A(o),t==="year"&&W.current&&W.current.scrollTo({top:j.indexOf(u)*32,behavior:"smooth"}),t==="month"&&z.current&&z.current.scrollTo({top:u*32,behavior:"smooth"}),t==="day"&&l.current&&l.current.scrollTo({top:(u-1)*32,behavior:"smooth"}),t!=="day"&&y>R&&l.current&&l.current.scrollTo({top:(R-1)*32,behavior:"smooth"})},c=(t,u,o)=>{if(Date.now()-v.current<500)return;const y=t.target.scrollTop,R=Math.round(y/32);if(R>=0&&R<o.length){const B=o[R];m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{let oe=h.getFullYear(),$=h.getMonth(),Q=h.getDate();u==="year"&&(oe=B),u==="month"&&($=B),u==="day"&&(Q=B);const ae=new Date(oe,$+1,0).getDate();Q>ae&&(Q=ae);const ue=new Date(oe,$,Q);ue.setHours(h.getHours(),h.getMinutes(),h.getSeconds(),h.getMilliseconds()),h.getTime()!==ue.getTime()&&A(ue),u!=="day"&&h.getDate()>ae&&l.current&&l.current.scrollTo({top:(ae-1)*32,behavior:"smooth"})},150)}};return n.jsxs("div",{className:"mobile-scroll-picker",children:[n.jsxs("div",{className:"mobile-header",children:[n.jsx("h3",{children:"Select Date"}),n.jsx("span",{className:"selected-preview",children:g.format(h,"dd MMM yyyy")})]}),n.jsxs("div",{className:"scroll-columns",style:{touchAction:"pan-y"},children:[n.jsx("div",{className:"scroll-col year-col",ref:W,onScroll:t=>c(t,"year",j),children:j.map(t=>n.jsx("div",{className:`scroll-item ${h.getFullYear()===t?"selected":""}`,onClick:()=>r("year",t),children:t},t))}),n.jsx("div",{className:"scroll-col month-col",ref:z,onScroll:t=>c(t,"month",D.map((u,o)=>o)),children:D.map((t,u)=>n.jsx("div",{className:`scroll-item ${h.getMonth()===u?"selected":""}`,onClick:()=>r("month",u),children:t},t))}),n.jsx("div",{className:"scroll-col day-col",ref:l,onScroll:t=>c(t,"day",Y),children:Y.map(t=>n.jsx("div",{className:`scroll-item ${h.getDate()===t?"selected":""}`,onClick:()=>r("day",t),children:t},t))})]}),n.jsx("button",{type:"button",className:"confirm-btn",onClick:U,children:"Confirm"})]})};return n.jsxs("div",{className:"datepicker-wrapper",ref:L,children:[n.jsx(ie,{icon:Z.Calendar,value:V,onChange:ee,onToggle:_,placeholder:F,mask:"date",onFocus:()=>{X(!0)},onBlur:r=>{X(!1),d&&d({target:{name:p,value:V}})},onClear:()=>{w(""),I(null)},disabled:C}),n.jsx(q.AnimatePresence,{children:T&&n.jsxs(n.Fragment,{children:[k&&n.jsx(q.motion.div,{className:"mobile-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>E(!1)}),n.jsx(q.motion.div,{initial:{y:k?"100%":20,opacity:0},animate:{y:0,opacity:1},exit:{y:k?"100%":20,opacity:0},transition:{type:"spring",damping:25,stiffness:200},className:`picker-dropdown glass-card ${k?"mobile":"desktop"}`,children:k?a():i()})]})})]})},xe=({value:b,onChange:P,placeholder:F="HH/MM AM/PM",showSeconds:p=!1,use12h:d=!0,name:C,onBlur:k,disabled:T=!1})=>{const E=le(),[O,S]=f.useState(!1),H=e=>{if(!e)return"";const s=e.split(" ");if(s.length<2&&d||!d)return e;const i=s[0].split(":");let a=parseInt(i[0],10);const r=i[1]||"00",c=i[2]||"00",t=s[1]||"AM";t==="PM"&&a<12&&(a+=12),t==="AM"&&a===12&&(a=0);let u=`${a.toString().padStart(2,"0")}:${r}`;return p&&(u+=`:${c}`),u},V=e=>{if(!e)return"";if(d&&(e.includes("AM")||e.includes("PM"))||!d)return e;const s=e.split(":");if(s.length<2)return e;let i=parseInt(s[0],10);const a=s[1]||"00",r=s[2]||"00",c=i>=12?"PM":"AM";i=i%12||12;let t=`${i.toString().padStart(2,"0")}:${a}`;return p&&(t+=`:${r}`),t+=` ${c}`,t},w=e=>{const s=H(e);P&&P({target:{name:C,value:s}})},[h,A]=f.useState(V(b)||""),[x,N]=f.useState(V(b)||""),[G,X]=f.useState(!1),L=f.useRef(null),W=f.useRef(null),z=f.useRef(null),l=f.useRef(null),m=f.useRef(null),v=f.useRef(null),j=f.useRef(0),D=d?Array.from({length:12},(e,s)=>(s+1).toString().padStart(2,"0")):Array.from({length:24},(e,s)=>s.toString().padStart(2,"0")),M=Array.from({length:60},(e,s)=>s.toString().padStart(2,"0")),Y=Array.from({length:60},(e,s)=>s.toString().padStart(2,"0")),_=["AM","PM"];f.useEffect(()=>{if(!G&&!O){const e=V(b);A(e||""),N(e||"")}},[b,G,O]),f.useEffect(()=>{if(O&&E){let e="01:00";p&&(e+=":00"),d&&(e+=" AM");const i=(V(x)||e).split(" "),a=i[0].split(":"),r=i[1]||"AM",c=()=>{const o=D.indexOf(a[0]);W.current&&o!==-1&&(W.current.scrollTop=o*32),z.current&&(z.current.scrollTop=parseInt(a[1]||0)*32),l.current&&p&&(l.current.scrollTop=parseInt(a[2]||0)*32),m.current&&d&&(m.current.scrollTop=_.indexOf(r)*32)};c();const t=setTimeout(c,50),u=setTimeout(c,300);return()=>{clearTimeout(t),clearTimeout(u)}}},[O,E]);const I=()=>{if(!T){if(!O){let e="01:00";p&&(e+=":00"),d&&(e+=" AM"),N(V(h)||e),j.current=Date.now()}S(!O)}},U=()=>{A(x),w(x),S(!1)},ee=e=>{A(e);const s=e.split(" "),i=s[0].split(":");i.length>=2?i.every(r=>r.length===2)&&(!d||d&&s[1]&&(s[1]==="AM"||s[1]==="PM"))&&(w(e),N(e)):e===""&&(w(""),N(""))},K=e=>{N(e),E||A(e)};f.useEffect(()=>{const e=s=>{L.current&&!L.current.contains(s.target)&&S(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),f.useEffect(()=>(E&&O?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[O,E]);const te=()=>{let e="01:00";p&&(e+=":00"),d&&(e+=" AM");const i=(V(x)||e).split(" "),a=i[0].split(":"),r=i[1]||"AM",c=(t=a[0]||"12",u=a[1]||"00",o=a[2]||"00",y=r)=>{let R=`${t}:${u}`;p&&(R+=`:${o}`),d&&(R+=` ${y}`),K(R)};return n.jsxs("div",{className:`desktop-time-picker ${p?"with-seconds":""}`,children:[n.jsxs("div",{className:"time-select-grid",children:[n.jsxs("div",{className:"time-col",children:[n.jsx("span",{className:"col-label",children:"Hrs"}),n.jsx("div",{className:"time-scroll",children:D.map(t=>n.jsx("button",{type:"button",className:`time-btn ${a[0]===t?"active":""}`,onClick:()=>c(t),children:t},t))})]}),n.jsxs("div",{className:"time-col",children:[n.jsx("span",{className:"col-label",children:"Min"}),n.jsx("div",{className:"time-scroll",children:M.map(t=>n.jsx("button",{type:"button",className:`time-btn ${a[1]===t?"active":""}`,onClick:()=>c(void 0,t),children:t},t))})]}),p&&n.jsxs("div",{className:"time-col",children:[n.jsx("span",{className:"col-label",children:"Sec"}),n.jsx("div",{className:"time-scroll",children:Y.map(t=>n.jsx("button",{type:"button",className:`time-btn ${a[2]===t?"active":""}`,onClick:()=>c(void 0,void 0,t),children:t},t))})]}),d&&n.jsxs("div",{className:"time-col",children:[n.jsx("span",{className:"col-label",children:"Mode"}),n.jsx("div",{className:"time-scroll",children:_.map(t=>n.jsx("button",{type:"button",className:`time-btn ${r===t?"active":""}`,onClick:()=>c(void 0,void 0,void 0,t),children:t},t))})]})]}),n.jsx("div",{className:"desktop-footer",children:n.jsxs("button",{type:"button",className:"confirm-btn small",onClick:U,children:[n.jsx(Z.Check,{size:16,style:{marginRight:"6px"}})," Done"]})})]})},ne=()=>{let e="01:00";p&&(e+=":00"),d&&(e+=" AM");const i=(V(x)||e).split(" "),a=i[0].split(":"),r=i[1]||"AM",c=(o,y)=>{const R=[...a];for(;R.length<(p?3:2);)R.push("00");R[o]=y;let B=R.slice(0,p?3:2).join(":");d&&(B+=` ${r}`),K(B),o===0&&W.current&&W.current.scrollTo({top:D.indexOf(y)*32,behavior:"smooth"}),o===1&&z.current&&z.current.scrollTo({top:M.indexOf(y)*32,behavior:"smooth"}),o===2&&l.current&&l.current.scrollTo({top:Y.indexOf(y)*32,behavior:"smooth"})},t=o=>{let y=a.slice(0,p?3:2).join(":");d&&(y+=` ${o}`),K(y),m.current&&m.current.scrollTo({top:_.indexOf(o)*32,behavior:"smooth"})},u=(o,y,R,B)=>{if(Date.now()-j.current<500)return;const oe=o.target.scrollTop,$=Math.round(oe/32);if($>=0&&$<B.length){const Q=B[$];v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{y==="part"?a[R]!==Q&&c(R,Q):y==="ampm"&&r!==Q&&t(Q)},150)}};return n.jsxs("div",{className:"mobile-scroll-picker",children:[n.jsxs("div",{className:"mobile-header",children:[n.jsx("h3",{children:"Select Time"}),n.jsx("span",{className:"selected-preview",children:x||"--:--"})]}),n.jsxs("div",{className:"scroll-columns",style:{touchAction:"pan-y"},children:[n.jsx("div",{className:"scroll-col hour-col",ref:W,onScroll:o=>u(o,"part",0,D),children:D.map(o=>n.jsx("div",{className:`scroll-item ${a[0]===o?"selected":""}`,onClick:()=>c(0,o),children:o},o))}),n.jsx("div",{className:"scroll-col min-col",ref:z,onScroll:o=>u(o,"part",1,M),children:M.map(o=>n.jsx("div",{className:`scroll-item ${a[1]===o?"selected":""}`,onClick:()=>c(1,o),children:o},o))}),p&&n.jsx("div",{className:"scroll-col sec-col",ref:l,onScroll:o=>u(o,"part",2,Y),children:Y.map(o=>n.jsx("div",{className:`scroll-item ${a[2]===o?"selected":""}`,onClick:()=>c(2,o),children:o},o))}),d&&n.jsx("div",{className:"scroll-col ampm-col",ref:m,onScroll:o=>u(o,"ampm",null,_),children:_.map(o=>n.jsx("div",{className:`scroll-item ${r===o?"selected":""}`,onClick:()=>t(o),children:o},o))})]}),n.jsx("button",{type:"button",className:"confirm-btn",onClick:U,children:"Confirm"})]})};return n.jsxs("div",{className:"timepicker-wrapper",ref:L,children:[n.jsx(ie,{icon:Z.Clock,value:h,onChange:ee,onToggle:I,placeholder:p?"HH:MM:SS AM/PM":"HH:MM AM/PM",mask:p?d?"time-seconds-ampm":"time-seconds":d?"time-ampm":"time",onFocus:()=>X(!0),onBlur:e=>{X(!1),k&&k({target:{name:C,value:h}})},onClear:()=>{A(""),N(""),w("")},disabled:T}),n.jsx(q.AnimatePresence,{children:O&&n.jsxs(n.Fragment,{children:[E&&n.jsx(q.motion.div,{className:"mobile-backdrop",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>S(!1)}),n.jsx(q.motion.div,{initial:{y:E?"100%":20,opacity:0},animate:{y:0,opacity:1},exit:{y:E?"100%":20,opacity:0},transition:{type:"spring",damping:25,stiffness:200},className:`picker-dropdown glass-card ${E?"mobile":"desktop"}`,children:E?ne():te()})]})})]})};J.DatePicker=be,J.SharedInput=ie,J.TimePicker=xe,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sauravluitel/date-time-picker-custom",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Premium React Date and Time Pickers with dedicated Mobile and Desktop UI",
5
5
  "author": "Antigravity AI",
6
6
  "type": "module",