reactjs-calendar-date-picker
Advanced tools
Comparing version 0.0.0 to 0.0.1
import Calendar from './src/components/Calendar'; | ||
export type { TCalDate } from './src/components/Calendar'; | ||
export default Calendar; |
@@ -27,3 +27,3 @@ (function(_,L){typeof exports=="object"&&typeof module<"u"?module.exports=L(require("react")):typeof define=="function"&&define.amd?define(["react"],L):(_=typeof globalThis<"u"?globalThis:_||self,_["reactjs-calendar-date-picker"]=L(_.React))})(this,function(_){"use strict";var L={exports:{}},J={};/** | ||
Check the top-level render call using <`+t+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=nr(r);if(ke[t])return;ke[t]=!0;var n="";e&&e._owner&&e._owner!==le.current&&(n=" It was passed a child from "+T(e._owner.type)+"."),B(e),h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),B(null)}}function Ie(e,r){{if(typeof e!="object")return;if(ue(e))for(var t=0;t<e.length;t++){var n=e[t];de(n)&&Fe(n,r)}else if(de(e))e._store&&(e._store.validated=!0);else if(e){var i=ae(e);if(typeof i=="function"&&i!==e.entries)for(var u=i.call(e),o;!(o=u.next()).done;)de(o.value)&&Fe(o.value,r)}}}function ar(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===m||r.$$typeof===S))t=r.propTypes;else return;if(t){var n=T(r);$e(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!fe){fe=!0;var i=T(r);h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function or(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){B(e),h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),B(null);break}}e.ref!==null&&(B(e),h("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function Ae(e,r,t,n,i,u){{var o=R(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var b=tr(i);b?a+=b:a+=Pe();var l;e===null?l="null":ue(e)?l="array":e!==void 0&&e.$$typeof===N?(l="<"+(T(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,a)}var v=rr(e,r,t,i,u);if(v==null)return v;if(o){var C=r.children;if(C!==void 0)if(n)if(ue(C)){for(var $=0;$<C.length;$++)Ie(C[$],e);Object.freeze&&Object.freeze(C)}else h("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 Ie(C,e)}return e===g?or(v):ar(v),v}}function ir(e,r,t){return Ae(e,r,t,!0)}function sr(e,r,t){return Ae(e,r,t,!1)}var ur=sr,cr=ir;G.Fragment=g,G.jsx=ur,G.jsxs=cr}()),G}process.env.NODE_ENV==="production"?L.exports=Le():L.exports=Ne();var f=L.exports;const X=[16915266e5,16916994e5];return z=>{const{onChange:N}=z,p=_.useRef(0),g=_.useRef(0),[Y,V]=_.useState([]),[c,D]=_.useState(new Date),m=["January","February","March","April","May","June","July","August","September","October","November","December"];_.useEffect(()=>H(),[]),_.useEffect(()=>Z(),[Y]);const O=s=>{var d=document.querySelectorAll(`.${s}`);[].forEach.call(d,E=>{E.classList.remove(s)})},y=()=>{const s=document.querySelector(".from");s&&s.classList.remove("from")},S=()=>{const s=document.querySelector(".to");s&&s.classList.remove("to")},P=s=>{let d=!1,E=!1;return X.forEach(x=>{x>=p.current&&x<=parseInt(s)&&(d=!0)}),(p.current&&d||X.includes(parseInt(s)))&&(E=!0,p.current=0,g.current=0,y(),S(),O("lights")),E},I=s=>{const d=s.target.id,E=document.getElementById(d),x=p.current&&parseInt(d)-p.current<0;P(d)||((g.current||x)&&(p.current=0,g.current=0,S(),y(),O("lights")),p.current&&!x?E.classList.contains("from")?(p.current=0,E.classList.remove("from")):(g.current=parseInt(d),E.classList.add("to"),Z()):(p.current=parseInt(d),E.classList.add("from")),N({from:p.current,to:g.current}))},U=(s,d)=>{const x=new Date(c.getFullYear(),d,s).getTime();let j="";return x===p.current?j="from":x===g.current&&(j="to"),{num:x.toString(),cls:j}},H=()=>{c.setDate(1),D(c);const s=new Date(c.getFullYear(),c.getMonth()+1,0).getDate(),d=new Date(c.getFullYear(),c.getMonth(),0).getDate(),E=c.getDay(),j=7-new Date(c.getFullYear(),c.getMonth()+1,0).getDay()-1;let w=[];for(let R=E;R>0;R--){const k=d-R+1,{num:M,cls:T}=U(k,c.getMonth()-1);w.push(f.jsx("div",{id:M,onMouseOver:h,onClick:I,className:`prev-date ${T}`,children:k}))}for(let R=1;R<=s;R++){const{num:k,cls:M}=U(R,c.getMonth());let T=R===new Date().getDate()&&c.getMonth()===new Date().getMonth()?"today":"day";X.includes(parseInt(k))&&(T+=" reserved"),w.push(f.jsx("div",{id:k,onMouseOver:h,onClick:I,className:`${T} ${M}`,children:R}))}for(let R=1;R<=j;R++){const{num:k,cls:M}=U(R,c.getMonth()+1);w.push(f.jsx("div",{id:k,onMouseOver:h,onClick:I,className:`next-date ${M}`,children:R}))}V(w)},ae=()=>{c.setMonth(c.getMonth()-1),H()},A=()=>{c.setMonth(c.getMonth()+1),H()},h=s=>{if(O("light"),!p.current||g.current)return;const E=parseInt(s.target.id),x=p.current;for(let j=x;j<=E;j+=864e5){const w=document.getElementById(j.toString());if(X.includes(j))return;w&&w.classList.add("light")}},Z=()=>{if(!(!p.current||!g.current))for(let s=p.current;s<=g.current;s+=864e5){const d=document.getElementById(s.toString());d&&d.classList.add("lights")}};return f.jsxs("div",{className:"calendar",children:[f.jsxs("div",{className:"month",children:[f.jsx("i",{onClick:ae,className:"prev"}),f.jsxs("div",{className:"date",children:[f.jsx("h1",{children:m[c.getMonth()]}),f.jsx("p",{children:new Date().toDateString()})]}),f.jsx("i",{onClick:A,className:"next"})]}),f.jsxs("div",{className:"weekdays",children:[f.jsx("div",{children:"Sun"}),f.jsx("div",{children:"Mon"}),f.jsx("div",{children:"Tue"}),f.jsx("div",{children:"Wed"}),f.jsx("div",{children:"Thu"}),f.jsx("div",{children:"Fri"}),f.jsx("div",{children:"Sat"})]}),f.jsx("div",{className:"days",children:Y.map(s=>f.jsx(_.Fragment,{children:s},s.props.id))})]})}}); | ||
Check the top-level render call using <`+t+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=nr(r);if(ke[t])return;ke[t]=!0;var n="";e&&e._owner&&e._owner!==le.current&&(n=" It was passed a child from "+T(e._owner.type)+"."),B(e),h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),B(null)}}function Ie(e,r){{if(typeof e!="object")return;if(ue(e))for(var t=0;t<e.length;t++){var n=e[t];de(n)&&Fe(n,r)}else if(de(e))e._store&&(e._store.validated=!0);else if(e){var i=ae(e);if(typeof i=="function"&&i!==e.entries)for(var u=i.call(e),o;!(o=u.next()).done;)de(o.value)&&Fe(o.value,r)}}}function ar(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===m||r.$$typeof===S))t=r.propTypes;else return;if(t){var n=T(r);$e(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!fe){fe=!0;var i=T(r);h("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&h("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function or(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){B(e),h("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),B(null);break}}e.ref!==null&&(B(e),h("Invalid attribute `ref` supplied to `React.Fragment`."),B(null))}}function Ae(e,r,t,n,i,u){{var o=R(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var b=tr(i);b?a+=b:a+=Pe();var l;e===null?l="null":ue(e)?l="array":e!==void 0&&e.$$typeof===N?(l="<"+(T(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,a)}var v=rr(e,r,t,i,u);if(v==null)return v;if(o){var C=r.children;if(C!==void 0)if(n)if(ue(C)){for(var $=0;$<C.length;$++)Ie(C[$],e);Object.freeze&&Object.freeze(C)}else h("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 Ie(C,e)}return e===g?or(v):ar(v),v}}function ir(e,r,t){return Ae(e,r,t,!0)}function sr(e,r,t){return Ae(e,r,t,!1)}var ur=sr,cr=ir;G.Fragment=g,G.jsx=ur,G.jsxs=cr}()),G}process.env.NODE_ENV==="production"?L.exports=Le():L.exports=Ne();var f=L.exports;const lr="",X=[16915266e5,16916994e5];return z=>{const{onChange:N}=z,p=_.useRef(0),g=_.useRef(0),[Y,V]=_.useState([]),[c,D]=_.useState(new Date),m=["January","February","March","April","May","June","July","August","September","October","November","December"];_.useEffect(()=>H(),[]),_.useEffect(()=>Z(),[Y]);const O=s=>{var d=document.querySelectorAll(`.${s}`);[].forEach.call(d,E=>{E.classList.remove(s)})},y=()=>{const s=document.querySelector(".from");s&&s.classList.remove("from")},S=()=>{const s=document.querySelector(".to");s&&s.classList.remove("to")},P=s=>{let d=!1,E=!1;return X.forEach(x=>{x>=p.current&&x<=parseInt(s)&&(d=!0)}),(p.current&&d||X.includes(parseInt(s)))&&(E=!0,p.current=0,g.current=0,y(),S(),O("lights")),E},I=s=>{const d=s.target.id,E=document.getElementById(d),x=p.current&&parseInt(d)-p.current<0;P(d)||((g.current||x)&&(p.current=0,g.current=0,S(),y(),O("lights")),p.current&&!x?E.classList.contains("from")?(p.current=0,E.classList.remove("from")):(g.current=parseInt(d),E.classList.add("to"),Z()):(p.current=parseInt(d),E.classList.add("from")),N({from:p.current,to:g.current}))},U=(s,d)=>{const x=new Date(c.getFullYear(),d,s).getTime();let j="";return x===p.current?j="from":x===g.current&&(j="to"),{num:x.toString(),cls:j}},H=()=>{c.setDate(1),D(c);const s=new Date(c.getFullYear(),c.getMonth()+1,0).getDate(),d=new Date(c.getFullYear(),c.getMonth(),0).getDate(),E=c.getDay(),j=7-new Date(c.getFullYear(),c.getMonth()+1,0).getDay()-1;let w=[];for(let R=E;R>0;R--){const k=d-R+1,{num:M,cls:T}=U(k,c.getMonth()-1);w.push(f.jsx("div",{id:M,onMouseOver:h,onClick:I,className:`prev-date ${T}`,children:k}))}for(let R=1;R<=s;R++){const{num:k,cls:M}=U(R,c.getMonth());let T=R===new Date().getDate()&&c.getMonth()===new Date().getMonth()?"today":"day";X.includes(parseInt(k))&&(T+=" reserved"),w.push(f.jsx("div",{id:k,onMouseOver:h,onClick:I,className:`${T} ${M}`,children:R}))}for(let R=1;R<=j;R++){const{num:k,cls:M}=U(R,c.getMonth()+1);w.push(f.jsx("div",{id:k,onMouseOver:h,onClick:I,className:`next-date ${M}`,children:R}))}V(w)},ae=()=>{c.setMonth(c.getMonth()-1),H()},A=()=>{c.setMonth(c.getMonth()+1),H()},h=s=>{if(O("light"),!p.current||g.current)return;const E=parseInt(s.target.id),x=p.current;for(let j=x;j<=E;j+=864e5){const w=document.getElementById(j.toString());if(X.includes(j))return;w&&w.classList.add("light")}},Z=()=>{if(!(!p.current||!g.current))for(let s=p.current;s<=g.current;s+=864e5){const d=document.getElementById(s.toString());d&&d.classList.add("lights")}};return f.jsxs("div",{className:"calendar",children:[f.jsxs("div",{className:"month",children:[f.jsx("i",{onClick:ae,className:"prev"}),f.jsxs("div",{className:"date",children:[f.jsx("h1",{children:m[c.getMonth()]}),f.jsx("p",{children:new Date().toDateString()})]}),f.jsx("i",{onClick:A,className:"next"})]}),f.jsxs("div",{className:"weekdays",children:[f.jsx("div",{children:"Sun"}),f.jsx("div",{children:"Mon"}),f.jsx("div",{children:"Tue"}),f.jsx("div",{children:"Wed"}),f.jsx("div",{children:"Thu"}),f.jsx("div",{children:"Fri"}),f.jsx("div",{children:"Sat"})]}),f.jsx("div",{className:"days",children:Y.map(s=>f.jsx(_.Fragment,{children:s},s.props.id))})]})}}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "reactjs-calendar-date-picker", | ||
"private": false, | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.umd.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
201654
11
891