Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tailwind-datepicker-react

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tailwind-datepicker-react - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

dist/Options.js

2

dist/Components/Buttons.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:all[name]})}_export(exports,{ButtonPrevMonth:function(){return ButtonPrevMonth},ButtonSelectMonth:function(){return ButtonSelectMonth},ButtonNextMonth:function(){return ButtonNextMonth},ButtonToday:function(){return ButtonToday},ButtonClear:function(){return ButtonClear}});var _react=_interopRequireWildcard(require("react"));var _date=require("../Utils/date");var _datePickerProvider=require("./DatePickerProvider");function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}var ButtonPrevMonth=function(){var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref.selectedDate,setSelectedDate=ref.setSelectedDate,view=ref.view;return _react.default.createElement("button",{type:"button",className:"bg-white dark:bg-gray-700 rounded-lg text-gray-500 dark:text-white hover:bg-gray-100 dark:hover:bg-gray-600 hover:text-gray-900 dark:hover:text-white text-lg p-2.5 focus:outline-none focus:ring-2 focus:ring-gray-200",onClick:function(){return setSelectedDate(new Date((0,_date.goToPrevNext)(view,selectedDate,-1)))}},_react.default.createElement("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},_react.default.createElement("path",{fillRule:"evenodd",d:"M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})))};var ButtonSelectMonth=function(){var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref.selectedDate,view=ref.view,setView=ref.setView;var calculateView=function(){if(view==="days")return"months";if(view==="months")return"years";if(view==="years")return"decades";return view};return _react.default.createElement("button",{type:"button",className:"text-sm rounded-lg text-gray-900 dark:text-white bg-white dark:bg-gray-700 font-semibold py-2.5 px-5 hover:bg-gray-100 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-200",onClick:function(){return setView(calculateView())}},view==="days"&&(0,_date.getFormattedDate)(selectedDate,{month:"long",year:"numeric"}),view==="months"&&(0,_date.getFormattedDate)(selectedDate,{year:"numeric"}),view==="years"&&"".concat((0,_date.startOfYearPeriod)(selectedDate,10),"-").concat((0,_date.startOfYearPeriod)(selectedDate,10)+9),view==="decades"&&"".concat((0,_date.startOfYearPeriod)(selectedDate,100),"-").concat((0,_date.startOfYearPeriod)(selectedDate,100)+90))};var ButtonNextMonth=function(){var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref.selectedDate,setSelectedDate=ref.setSelectedDate,view=ref.view;return _react.default.createElement("button",{type:"button",className:"bg-white dark:bg-gray-700 rounded-lg text-gray-500 dark:text-white hover:bg-gray-100 dark:hover:bg-gray-600 hover:text-gray-900 dark:hover:text-white text-lg p-2.5 focus:outline-none focus:ring-2 focus:ring-gray-200",onClick:function(){return setSelectedDate(new Date((0,_date.goToPrevNext)(view,selectedDate,1)))}},_react.default.createElement("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},_react.default.createElement("path",{fillRule:"evenodd",d:"M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"})))};var ButtonToday=function(){var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),setSelectedDate=ref.setSelectedDate,setShowSelectedDate=ref.setShowSelectedDate,setView=ref.setView;return _react.default.createElement("button",{type:"button",className:"w-1/2 px-5 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg dark:bg-blue-600 hover:bg-blue-800 dark:hover:bg-blue-700 focus:ring-4 focus:ring-blue-300",onClick:function(){setSelectedDate(new Date);setShowSelectedDate(true);setView("days")}},"Today")};var ButtonClear=function(){var setShowSelectedDate=(0,_react.useContext)(_datePickerProvider.DatePickerContext).setShowSelectedDate;return _react.default.createElement("button",{type:"button",className:"w-1/2 px-5 py-2 text-sm font-medium text-center text-gray-900 bg-white border border-gray-300 rounded-lg dark:text-white dark:bg-gray-700 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-600 focus:ring-4 focus:ring-blue-300",onClick:function(){return setShowSelectedDate(false)}},"Clear")};
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:all[name]})}_export(exports,{ButtonPrevMonth:function(){return ButtonPrevMonth},ButtonSelectMonth:function(){return ButtonSelectMonth},ButtonNextMonth:function(){return ButtonNextMonth},ButtonToday:function(){return ButtonToday},ButtonClear:function(){return ButtonClear}});var _react=_interopRequireWildcard(require("react"));var _tailwindMerge=require("tailwind-merge");var _date=require("../Utils/date");var _datePickerProvider=require("./DatePickerProvider");function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}var ButtonPrevMonth=function(){var ref,ref1,ref2;var ref3=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref3.selectedDate,changeSelectedDate=ref3.changeSelectedDate,view=ref3.view,options=ref3.options;return _react.default.createElement("button",{type:"button",className:(0,_tailwindMerge.twMerge)("bg-white dark:bg-gray-700 rounded-lg text-gray-500 dark:text-white hover:bg-gray-100 dark:hover:bg-gray-600 hover:text-gray-900 dark:hover:text-white text-lg p-2.5 focus:outline-none focus:ring-2 focus:ring-gray-200",options===null||options===void 0?void 0:(ref=options.theme)===null||ref===void 0?void 0:ref.icons),onClick:function(){return changeSelectedDate("prev",new Date((0,_date.goToPrevNext)(view,selectedDate,-1)))}},(options===null||options===void 0?void 0:(ref1=options.icons)===null||ref1===void 0?void 0:ref1.prev)?options===null||options===void 0?void 0:(ref2=options.icons)===null||ref2===void 0?void 0:ref2.prev():_react.default.createElement("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},_react.default.createElement("path",{fillRule:"evenodd",d:"M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z",clipRule:"evenodd"})))};var ButtonSelectMonth=function(){var ref;var ref1=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref1.selectedDate,view=ref1.view,setView=ref1.setView,options=ref1.options,getFormattedDate=ref1.getFormattedDate;var calculateView=function(){if(view==="days")return"months";if(view==="months")return"years";if(view==="years")return"decades";return view};return _react.default.createElement("button",{type:"button",className:(0,_tailwindMerge.twMerge)("text-sm rounded-lg text-gray-900 dark:text-white bg-white dark:bg-gray-700 font-semibold py-2.5 px-5 hover:bg-gray-100 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-gray-200",options===null||options===void 0?void 0:(ref=options.theme)===null||ref===void 0?void 0:ref.icons),onClick:function(){return setView(calculateView())}},view==="days"&&getFormattedDate(selectedDate,{month:"long",year:"numeric"}),view==="months"&&getFormattedDate(selectedDate,{year:"numeric"}),view==="years"&&"".concat((0,_date.startOfYearPeriod)(selectedDate,10),"-").concat((0,_date.startOfYearPeriod)(selectedDate,10)+9),view==="decades"&&"".concat((0,_date.startOfYearPeriod)(selectedDate,100),"-").concat((0,_date.startOfYearPeriod)(selectedDate,100)+90))};var ButtonNextMonth=function(){var ref,ref1,ref2;var ref3=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref3.selectedDate,changeSelectedDate=ref3.changeSelectedDate,view=ref3.view,options=ref3.options;return _react.default.createElement("button",{type:"button",className:(0,_tailwindMerge.twMerge)("bg-white dark:bg-gray-700 rounded-lg text-gray-500 dark:text-white hover:bg-gray-100 dark:hover:bg-gray-600 hover:text-gray-900 dark:hover:text-white text-lg p-2.5 focus:outline-none focus:ring-2 focus:ring-gray-200",options===null||options===void 0?void 0:(ref=options.theme)===null||ref===void 0?void 0:ref.icons),onClick:function(){return changeSelectedDate("next",new Date((0,_date.goToPrevNext)(view,selectedDate,1)))}},(options===null||options===void 0?void 0:(ref1=options.icons)===null||ref1===void 0?void 0:ref1.next)?options===null||options===void 0?void 0:(ref2=options.icons)===null||ref2===void 0?void 0:ref2.next():_react.default.createElement("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},_react.default.createElement("path",{fillRule:"evenodd",d:"M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"})))};var ButtonToday=function(){var ref;var ref1=(0,_react.useContext)(_datePickerProvider.DatePickerContext),changeSelectedDate=ref1.changeSelectedDate,setView=ref1.setView,options=ref1.options;return _react.default.createElement("button",{type:"button",className:(0,_tailwindMerge.twMerge)("w-full px-5 py-2 text-sm font-medium text-center text-white bg-blue-700 rounded-lg dark:bg-blue-600 hover:bg-blue-800 dark:hover:bg-blue-700 focus:ring-4 focus:ring-blue-300",options===null||options===void 0?void 0:(ref=options.theme)===null||ref===void 0?void 0:ref.todayBtn),onClick:function(){changeSelectedDate("today",new Date);setView("days")}},"Today")};var ButtonClear=function(){var ref;var ref1=(0,_react.useContext)(_datePickerProvider.DatePickerContext),setShowSelectedDate=ref1.setShowSelectedDate,options=ref1.options;return _react.default.createElement("button",{type:"button",className:(0,_tailwindMerge.twMerge)("w-full px-5 py-2 text-sm font-medium text-center text-gray-900 bg-white border border-gray-300 rounded-lg dark:text-white dark:bg-gray-700 dark:border-gray-600 hover:bg-gray-100 dark:hover:bg-gray-600 focus:ring-4 focus:ring-blue-300",options===null||options===void 0?void 0:(ref=options.theme)===null||ref===void 0?void 0:ref.clearBtn),onClick:function(){return setShowSelectedDate(false)}},"Clear")};

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _date=require("../Utils/date");var _datePickerPopup=_interopRequireDefault(require("./DatePickerPopup"));var _datePickerProvider=_interopRequireWildcard(require("./DatePickerProvider"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}var DatePicker=function(param){var title=param.title,_actionButtons=param.actionButtons,actionButtons=_actionButtons===void 0?true:_actionButtons;return _react.default.createElement(_datePickerProvider.default,null,_react.default.createElement(DatePickerMain,{title:title,actionButtons:actionButtons}))};var DatePickerMain=function(param){var title=param.title,actionButtons=param.actionButtons;var setShowDatePicker=(0,_react.useContext)(_datePickerProvider.DatePickerContext).setShowDatePicker;var datePickerShow=(0,_react.useContext)(_datePickerProvider.DatePickerContext).datePickerShow;var InputRef=(0,_react.useRef)(null);var DatePickerRef=(0,_react.useRef)(null);(0,_react.useEffect)(function(){var handleClickOutside=function(event){if(!(InputRef.current&&DatePickerRef.current))return;if(!InputRef.current.contains(event.target)&&!DatePickerRef.current.contains(event.target)){console.log(!InputRef.current.contains(event.target),!DatePickerRef.current.contains(event.target));setShowDatePicker(false)}};document.addEventListener("mousedown",function(event){return handleClickOutside(event)});return function(){document.removeEventListener("mousedown",function(event){return handleClickOutside(event)})}},[DatePickerRef,InputRef,setShowDatePicker]);return _react.default.createElement(_react.default.Fragment,null,_react.default.createElement("div",{className:"relative"},_react.default.createElement("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},_react.default.createElement(CalendarIcon,null)),_react.default.createElement(Input,{ref:InputRef})),datePickerShow&&_react.default.createElement(_datePickerPopup.default,{ref:DatePickerRef,title:title,actionButtons:actionButtons}))};var Input=(0,_react.forwardRef)(function(_props,ref){var _$ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),setShowDatePicker=_$ref.setShowDatePicker,selectedDate=_$ref.selectedDate,showSelectedDate=_$ref.showSelectedDate;return _react.default.createElement("input",{ref:ref,type:"text",id:"date",className:"pl-9 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",placeholder:"Select Date",value:selectedDate.getTime()>0&&showSelectedDate?(0,_date.getFormattedDate)(selectedDate):"",onFocus:function(){return setShowDatePicker(true)},readOnly:true})});Input.displayName="Input";var CalendarIcon=function(){return _react.default.createElement("svg",{"aria-hidden":"true",className:"w-5 h-5 text-gray-500 dark:text-gray-400",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},_react.default.createElement("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"}))};var _default=DatePicker;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _tailwindMerge=require("tailwind-merge");var _datePickerPopup=_interopRequireDefault(require("./DatePickerPopup"));var _datePickerProvider=_interopRequireWildcard(require("./DatePickerProvider"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}var DatePicker=function(param){var children=param.children,options=param.options,onChange=param.onChange,classNames=param.classNames,show=param.show,setShow=param.setShow;return _react.default.createElement("div",{className:(0,_tailwindMerge.twMerge)("w-full",classNames)},_react.default.createElement(_datePickerProvider.default,{options:options,onChange:onChange,show:show,setShow:setShow},_react.default.createElement(DatePickerMain,null,children)))};var DatePickerMain=function(param){var children=param.children;var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),setShow=ref.setShow,show=ref.show;var InputRef=(0,_react.useRef)(null);var DatePickerRef=(0,_react.useRef)(null);(0,_react.useEffect)(function(){var handleClickOutside=function(event){if(!((InputRef===null||InputRef===void 0?void 0:InputRef.current)&&(DatePickerRef===null||DatePickerRef===void 0?void 0:DatePickerRef.current)))return;if(!InputRef.current.contains(event.target)&&!DatePickerRef.current.contains(event.target)){setShow(false)}};document.addEventListener("mousedown",function(event){return handleClickOutside(event)});return function(){document.removeEventListener("mousedown",function(event){return handleClickOutside(event)})}},[DatePickerRef,InputRef,setShow]);return _react.default.createElement(_react.default.Fragment,null,children?{children:children}:_react.default.createElement("div",{className:"relative"},_react.default.createElement("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none"},_react.default.createElement(CalendarIcon,null)),_react.default.createElement(Input,{ref:InputRef})),show&&_react.default.createElement(_datePickerPopup.default,{ref:DatePickerRef}))};var Input=(0,_react.forwardRef)(function(_props,ref){var _$ref;var _$ref1=(0,_react.useContext)(_datePickerProvider.DatePickerContext),setShow=_$ref1.setShow,selectedDate=_$ref1.selectedDate,showSelectedDate=_$ref1.showSelectedDate,options=_$ref1.options,getFormattedDate=_$ref1.getFormattedDate;return _react.default.createElement("input",{ref:ref,type:"text",id:"date",className:(0,_tailwindMerge.twMerge)("pl-9 pr-2.5 py-2.5 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500",options===null||options===void 0?void 0:(_$ref=options.theme)===null||_$ref===void 0?void 0:_$ref.input),placeholder:"Select Date",value:selectedDate.getTime()>0&&showSelectedDate?getFormattedDate(selectedDate):"",onFocus:function(){return setShow(true)},readOnly:true})});Input.displayName="Input";var CalendarIcon=function(){var ref;var options=(0,_react.useContext)(_datePickerProvider.DatePickerContext).options;return _react.default.createElement("svg",{"aria-hidden":"true",className:(0,_tailwindMerge.twMerge)("w-5 h-5 text-gray-500 dark:text-gray-400",options===null||options===void 0?void 0:(ref=options.theme)===null||ref===void 0?void 0:ref.inputIcon),fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},_react.default.createElement("path",{fillRule:"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z",clipRule:"evenodd"}))};var _default=DatePicker;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _date=require("../Utils/date");var _buttons=require("./Buttons");var _datePickerProvider=require("./DatePickerProvider");var _days=_interopRequireDefault(require("./Views/Days"));var _decades=_interopRequireDefault(require("./Views/Decades"));var _months=_interopRequireDefault(require("./Views/Months"));var _years=_interopRequireDefault(require("./Views/Years"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}var DatePickerPopup=(0,_react.forwardRef)(function(param,ref){var title=param.title,actionButtons=param.actionButtons;var _$ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedMonth=_$ref.selectedMonth,selectedYear=_$ref.selectedYear,view=_$ref.view;var firstOfMonth=(0,_date.firstDateOfMonth)(selectedYear,selectedMonth,1);var start=(0,_date.dayOfTheWeekOf)(firstOfMonth,1,1);return _react.default.createElement("div",{ref:ref,className:"absolute z-50 block pt-2"},_react.default.createElement("div",{className:"inline-block p-4 bg-white rounded-lg shadow-lg dark:bg-gray-700"},_react.default.createElement("div",null,title&&_react.default.createElement("div",{className:"px-2 py-3 font-semibold text-center bg-white dark:bg-gray-700 dark:text-white"},title),_react.default.createElement("div",{className:"flex justify-between mb-2"},_react.default.createElement(_buttons.ButtonPrevMonth,null),_react.default.createElement(_buttons.ButtonSelectMonth,null),_react.default.createElement(_buttons.ButtonNextMonth,null))),_react.default.createElement("div",{className:"p-1"},view==="days"&&_react.default.createElement(_days.default,{start:start}),view==="months"&&_react.default.createElement(_months.default,null),view==="years"&&_react.default.createElement(_years.default,null),view==="decades"&&_react.default.createElement(_decades.default,null)),actionButtons&&_react.default.createElement("div",{className:"flex mt-2 space-x-2"},_react.default.createElement(_buttons.ButtonToday,null),_react.default.createElement(_buttons.ButtonClear,null))))});DatePickerPopup.displayName="DatePickerPopup";var _default=DatePickerPopup;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _tailwindMerge=require("tailwind-merge");var _date=require("../Utils/date");var _buttons=require("./Buttons");var _datePickerProvider=require("./DatePickerProvider");var _days=_interopRequireDefault(require("./Views/Days"));var _decades=_interopRequireDefault(require("./Views/Decades"));var _months=_interopRequireDefault(require("./Views/Months"));var _years=_interopRequireDefault(require("./Views/Years"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}var DatePickerPopup=(0,_react.forwardRef)(function(_props,ref){var _$ref,_$ref1;var _$ref2=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedMonth=_$ref2.selectedMonth,selectedYear=_$ref2.selectedYear,view=_$ref2.view,options=_$ref2.options;var firstOfMonth=(0,_date.firstDateOfMonth)(selectedYear,selectedMonth,1);var start=(0,_date.dayOfTheWeekOf)(firstOfMonth,1,1);return _react.default.createElement("div",{ref:ref,className:(0,_tailwindMerge.twMerge)("absolute z-50 block pt-2 top-10",options===null||options===void 0?void 0:options.datepickerClassNames)},_react.default.createElement("div",{className:(0,_tailwindMerge.twMerge)("inline-block p-4 bg-white rounded-lg shadow-lg dark:bg-gray-700",options===null||options===void 0?void 0:(_$ref=options.theme)===null||_$ref===void 0?void 0:_$ref.background)},_react.default.createElement("div",null,(options===null||options===void 0?void 0:options.title)&&_react.default.createElement("div",{className:(0,_tailwindMerge.twMerge)("px-2 py-3 font-semibold text-center text-gray-900 dark:text-white",options===null||options===void 0?void 0:(_$ref1=options.theme)===null||_$ref1===void 0?void 0:_$ref1.text)},options===null||options===void 0?void 0:options.title),_react.default.createElement("div",{className:"flex justify-between mb-2"},_react.default.createElement(_buttons.ButtonPrevMonth,null),_react.default.createElement(_buttons.ButtonSelectMonth,null),_react.default.createElement(_buttons.ButtonNextMonth,null))),_react.default.createElement("div",{className:"p-1"},view==="days"&&_react.default.createElement(_days.default,{start:start}),view==="months"&&_react.default.createElement(_months.default,null),view==="years"&&_react.default.createElement(_years.default,null),view==="decades"&&_react.default.createElement(_decades.default,null)),((options===null||options===void 0?void 0:options.todayBtn)||(options===null||options===void 0?void 0:options.clearBtn))&&_react.default.createElement("div",{className:"flex mt-2 space-x-2"},(options===null||options===void 0?void 0:options.todayBtn)&&_react.default.createElement(_buttons.ButtonToday,null),(options===null||options===void 0?void 0:options.clearBtn)&&_react.default.createElement(_buttons.ButtonClear,null))))});DatePickerPopup.displayName="DatePickerPopup";var _default=DatePickerPopup;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:all[name]})}_export(exports,{DatePickerContext:function(){return DatePickerContext},default:function(){return _default}});var _react=_interopRequireWildcard(require("react"));function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var DatePickerContext=(0,_react.createContext)({view:"days",setView:function(){},datePickerShow:false,setShowDatePicker:function(){},selectedDate:new Date,setSelectedDate:function(){},showSelectedDate:true,setShowSelectedDate:function(){},selectedMonth:0,selectedYear:0});var DatePickerProvider=function(param){var children=param.children;var ref=_slicedToArray((0,_react.useState)("days"),2),view=ref[0],setView=ref[1];var ref1=_slicedToArray((0,_react.useState)(false),2),datePickerShow=ref1[0],setShowDatePicker=ref1[1];var ref2=_slicedToArray((0,_react.useState)(new Date),2),selectedDate=ref2[0],setSelectedDate=ref2[1];var ref3=_slicedToArray((0,_react.useState)(true),2),showSelectedDate=ref3[0],setShowSelectedDate=ref3[1];var selectedMonth=selectedDate.getMonth();var selectedYear=selectedDate.getFullYear();return _react.default.createElement(DatePickerContext.Provider,{value:{view:view,setView:setView,datePickerShow:datePickerShow,setShowDatePicker:setShowDatePicker,selectedDate:selectedDate,setSelectedDate:setSelectedDate,showSelectedDate:showSelectedDate,setShowSelectedDate:setShowSelectedDate,selectedMonth:selectedMonth,selectedYear:selectedYear}},children)};var _default=DatePickerProvider;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:all[name]})}_export(exports,{DatePickerContext:function(){return DatePickerContext},default:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _options=_interopRequireDefault(require("../Options"));var _date=require("../Utils/date");function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};var ownKeys=Object.keys(source);if(typeof Object.getOwnPropertySymbols==="function"){ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable}))}ownKeys.forEach(function(key){_defineProperty(target,key,source[key])})}return target}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var DatePickerContext=(0,_react.createContext)({options:_options.default,view:"days",setView:function(){},show:false,setShow:function(){},selectedDate:new Date,changeSelectedDate:function(){},showSelectedDate:true,setShowSelectedDate:function(){},selectedMonth:0,selectedYear:0,getFormattedDate:function(){return""}});var DatePickerProvider=function(param){var children=param.children,customOptions=param.options,onChange=param.onChange,show=param.show,setShow=param.setShow;var options=_objectSpread({},_options.default,customOptions);var ref=_slicedToArray((0,_react.useState)("days"),2),view=ref[0],setView=ref[1];var ref1=_slicedToArray((0,_react.useState)((options===null||options===void 0?void 0:options.defaultDate)||new Date),2),selectedDate=ref1[0],setSelectedDate=ref1[1];var ref2=_slicedToArray((0,_react.useState)(true),2),showSelectedDate=ref2[0],setShowSelectedDate=ref2[1];var selectedMonth=selectedDate.getMonth();var selectedYear=selectedDate.getFullYear();var changeSelectedDate=function(action,date){if((options===null||options===void 0?void 0:options.maxDate)&&date>options.maxDate)return;if((options===null||options===void 0?void 0:options.minDate)&&date<options.minDate)return;setSelectedDate(date);setShowSelectedDate(true);if((options===null||options===void 0?void 0:options.autoHide)&&view==="days"&&action==="date")setShow(false);if(onChange)onChange(date)};var getFormattedDate=function(date,formatOptions){return(0,_date.getFormattedDate)((options===null||options===void 0?void 0:options.language)?options===null||options===void 0?void 0:options.language:"en",date,formatOptions)};return _react.default.createElement(DatePickerContext.Provider,{value:{options:options,view:view,setView:setView,show:show,setShow:setShow,selectedDate:selectedDate,changeSelectedDate:changeSelectedDate,showSelectedDate:showSelectedDate,setShowSelectedDate:setShowSelectedDate,selectedMonth:selectedMonth,selectedYear:selectedYear,getFormattedDate:getFormattedDate}},children)};var _default=DatePickerProvider;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _date=require("../../Utils/date");var _datePickerProvider=require("../DatePickerProvider");function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var Days=function(param){var start=param.start;var weekDays=["Mo","Tu","We","Th","Fr","Sa","Su"];var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref.selectedDate,setSelectedDate=ref.setSelectedDate,showSelectedDate=ref.showSelectedDate,setShowSelectedDate=ref.setShowSelectedDate;return _react.default.createElement(_react.default.Fragment,null,_react.default.createElement("div",{className:"grid grid-cols-7 mb-1"},weekDays.map(function(day,index){return _react.default.createElement("span",{key:index,className:"h-6 text-sm font-medium leading-6 text-center text-gray-500 dow dark:text-gray-400"},day)})),_react.default.createElement("div",{className:"grid w-64 grid-cols-7"},_toConsumableArray(Array(42)).map(function(_date1,index){var current=(0,_date.addDays)(start,index);var day=(0,_date.getFormattedDate)(current,{day:"numeric"});var month=(0,_date.getFormattedDate)(current,{month:"long"});var year=(0,_date.getFormattedDate)(current,{year:"numeric"});return _react.default.createElement("span",{key:index,className:"hover:bg-gray-100 dark:hover:bg-gray-600 block flex-1 leading-9 border-0 rounded-lg cursor-pointer text-center dark:text-white font-semibold text-sm ".concat(showSelectedDate&&selectedDate.getTime()>0&&(0,_date.getFormattedDate)(selectedDate)===(0,_date.getFormattedDate)(current)?"bg-blue-700 text-white hover:bg-blue-600":""," ").concat(month==(0,_date.getFormattedDate)(selectedDate,{month:"long"})&&year==(0,_date.getFormattedDate)(selectedDate,{year:"numeric"})?"text-gray-900":"text-gray-500"),onClick:function(){setSelectedDate(new Date(current));setShowSelectedDate(true)}},day)})))};var _default=Days;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _date=require("../../Utils/date");var _datePickerProvider=require("../DatePickerProvider");var _tailwindMerge=require("tailwind-merge");function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var Days=function(param){var start=param.start;var weekDays=["Mo","Tu","We","Th","Fr","Sa","Su"];var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref.selectedDate,changeSelectedDate=ref.changeSelectedDate,showSelectedDate=ref.showSelectedDate,getFormattedDate=ref.getFormattedDate,options=ref.options;return _react.default.createElement(_react.default.Fragment,null,_react.default.createElement("div",{className:"grid grid-cols-7 mb-1"},weekDays.map(function(day,index){return _react.default.createElement("span",{key:index,className:"h-6 text-sm font-medium leading-6 text-center text-gray-500 dow dark:text-gray-400"},day)})),_react.default.createElement("div",{className:"grid w-64 grid-cols-7"},_toConsumableArray(Array(42)).map(function(_date1,index){var ref,ref1,ref2;var current=(0,_date.addDays)(start,index);var day=getFormattedDate(current,{day:"numeric"});var month=getFormattedDate(current,{month:"long"});var year=getFormattedDate(current,{year:"numeric"});return _react.default.createElement("span",{key:index,className:"hover:bg-gray-100 dark:hover:bg-gray-600 block flex-1 leading-9 border-0 rounded-lg cursor-pointer text-center dark:text-white font-semibold text-sm ".concat(showSelectedDate&&selectedDate.getTime()>0&&getFormattedDate(selectedDate)===getFormattedDate(current)?(0,_tailwindMerge.twMerge)("bg-blue-700 text-white hover:bg-blue-600",options===null||options===void 0?void 0:(ref=options.theme)===null||ref===void 0?void 0:ref.selected):""," ").concat(month==getFormattedDate(selectedDate,{month:"long"})&&year==getFormattedDate(selectedDate,{year:"numeric"})?(0,_tailwindMerge.twMerge)("text-gray-900",options===null||options===void 0?void 0:(ref1=options.theme)===null||ref1===void 0?void 0:ref1.text):(0,_tailwindMerge.twMerge)("text-gray-500",options===null||options===void 0?void 0:(ref2=options.theme)===null||ref2===void 0?void 0:ref2.disabledText)),onClick:function(){changeSelectedDate("date",new Date(current))}},day)})))};var _default=Days;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _date=require("../../Utils/date");var _datePickerProvider=require("../DatePickerProvider");function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var Decades=function(){var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref.selectedDate,showSelectedDate=ref.showSelectedDate,setSelectedDate=ref.setSelectedDate,setView=ref.setView,setShowSelectedDate=ref.setShowSelectedDate;return _react.default.createElement("div",{className:"grid w-64 grid-cols-4"},_toConsumableArray(Array(12)).map(function(_year,index){var first=(0,_date.startOfYearPeriod)(selectedDate,100);var year=first-10+index*10;return _react.default.createElement("span",{key:index,className:"hover:bg-gray-100 dark:hover:bg-gray-600 block flex-1 leading-9 border-0 rounded-lg cursor-pointer text-center dark:text-white font-semibold text-sm ".concat(showSelectedDate&&selectedDate.getTime()>0&&Number((0,_date.getFormattedDate)(selectedDate,{year:"numeric"}))===year?"bg-blue-700 text-white hover:bg-blue-600":""," ").concat(index==0||index==11?"text-gray-500":"text-gray-900"),onClick:function(){setSelectedDate(new Date((0,_date.addYears)(selectedDate,year-selectedDate.getFullYear())));setView("years");setShowSelectedDate(true)}},year)}))};var _default=Decades;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _date=require("../../Utils/date");var _datePickerProvider=require("../DatePickerProvider");var _tailwindMerge=require("tailwind-merge");function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var Decades=function(){var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref.selectedDate,showSelectedDate=ref.showSelectedDate,changeSelectedDate=ref.changeSelectedDate,setView=ref.setView,getFormattedDate=ref.getFormattedDate,options=ref.options;return _react.default.createElement("div",{className:"grid w-64 grid-cols-4"},_toConsumableArray(Array(12)).map(function(_year,index){var ref,ref1,ref2;var first=(0,_date.startOfYearPeriod)(selectedDate,100);var year=first-10+index*10;return _react.default.createElement("span",{key:index,className:"hover:bg-gray-100 dark:hover:bg-gray-600 block flex-1 leading-9 border-0 rounded-lg cursor-pointer text-center dark:text-white font-semibold text-sm ".concat(showSelectedDate&&selectedDate.getTime()>0&&Number(getFormattedDate(selectedDate,{year:"numeric"}))===year?(0,_tailwindMerge.twMerge)("bg-blue-700 text-white hover:bg-blue-600",options===null||options===void 0?void 0:(ref=options.theme)===null||ref===void 0?void 0:ref.selected):""," ").concat(index==0||index==11?(0,_tailwindMerge.twMerge)("text-gray-500",options===null||options===void 0?void 0:(ref1=options.theme)===null||ref1===void 0?void 0:ref1.disabledText):(0,_tailwindMerge.twMerge)("text-gray-900",options===null||options===void 0?void 0:(ref2=options.theme)===null||ref2===void 0?void 0:ref2.text)),onClick:function(){changeSelectedDate("date",new Date((0,_date.addYears)(selectedDate,year-selectedDate.getFullYear())));setView("years")}},year)}))};var _default=Decades;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _date=require("../../Utils/date");var _datePickerProvider=require("../DatePickerProvider");function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var Months=function(){var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref.selectedDate,showSelectedDate=ref.showSelectedDate,setSelectedDate=ref.setSelectedDate,setShowSelectedDate=ref.setShowSelectedDate,setView=ref.setView;return _react.default.createElement("div",{className:"grid w-64 grid-cols-4"},_toConsumableArray(Array(12)).map(function(_month,index){var month=(0,_date.getFormattedDate)(new Date(selectedDate.getFullYear(),index),{month:"short"});return _react.default.createElement("span",{key:index,className:"hover:bg-gray-100 dark:hover:bg-gray-600 block flex-1 leading-9 border-0 rounded-lg cursor-pointer text-center dark:text-white font-semibold text-sm text-gray-900 ".concat(showSelectedDate&&selectedDate.getTime()>0&&(0,_date.getFormattedDate)(selectedDate,{month:"short"})===month?"bg-blue-700 text-white hover:bg-blue-600":""),onClick:function(){setSelectedDate(new Date((0,_date.addMonths)(selectedDate,index-selectedDate.getMonth())));setView("days");setShowSelectedDate(true)}},month)}))};var _default=Months;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _date=require("../../Utils/date");var _datePickerProvider=require("../DatePickerProvider");var _tailwindMerge=require("tailwind-merge");function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var Months=function(){var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref.selectedDate,showSelectedDate=ref.showSelectedDate,changeSelectedDate=ref.changeSelectedDate,getFormattedDate=ref.getFormattedDate,setView=ref.setView,options=ref.options;return _react.default.createElement("div",{className:"grid w-64 grid-cols-4"},_toConsumableArray(Array(12)).map(function(_month,index){var ref;var month=getFormattedDate(new Date(selectedDate.getFullYear(),index),{month:"short"});return _react.default.createElement("span",{key:index,className:"hover:bg-gray-100 dark:hover:bg-gray-600 block flex-1 leading-9 border-0 rounded-lg cursor-pointer text-center dark:text-white font-semibold text-sm text-gray-900 ".concat(showSelectedDate&&selectedDate.getTime()>0&&getFormattedDate(selectedDate,{month:"short"})===month?(0,_tailwindMerge.twMerge)("bg-blue-700 text-white hover:bg-blue-600",options===null||options===void 0?void 0:(ref=options.theme)===null||ref===void 0?void 0:ref.selected):""),onClick:function(){changeSelectedDate("date",new Date((0,_date.addMonths)(selectedDate,index-selectedDate.getMonth())));setView("days")}},month)}))};var _default=Months;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _date=require("../../Utils/date");var _datePickerProvider=require("../DatePickerProvider");function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var Years=function(){var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref.selectedDate,showSelectedDate=ref.showSelectedDate,setSelectedDate=ref.setSelectedDate,setView=ref.setView,setShowSelectedDate=ref.setShowSelectedDate;return _react.default.createElement("div",{className:"grid w-64 grid-cols-4"},_toConsumableArray(Array(12)).map(function(_year,index){var first=(0,_date.startOfYearPeriod)(selectedDate,10);var year=first-1+index*1;return _react.default.createElement("span",{key:index,className:"hover:bg-gray-100 dark:hover:bg-gray-600 block flex-1 leading-9 border-0 rounded-lg cursor-pointer text-center dark:text-white font-semibold text-sm ".concat(showSelectedDate&&selectedDate.getTime()>0&&Number((0,_date.getFormattedDate)(selectedDate,{year:"numeric"}))===year?"bg-blue-700 text-white hover:bg-blue-600":""," ").concat(index==0||index==11?"text-gray-500":"text-gray-900"),onClick:function(){setSelectedDate(new Date((0,_date.addYears)(selectedDate,year-selectedDate.getFullYear())));setView("months");setShowSelectedDate(true)}},year)}))};var _default=Years;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return _default}});var _react=_interopRequireWildcard(require("react"));var _date=require("../../Utils/date");var _datePickerProvider=require("../DatePickerProvider");var _tailwindMerge=require("tailwind-merge");function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap;var cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj}}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj)}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc)}else{newObj[key]=obj[key]}}}newObj.default=obj;if(cache){cache.set(obj,newObj)}return newObj}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}var Years=function(){var ref=(0,_react.useContext)(_datePickerProvider.DatePickerContext),selectedDate=ref.selectedDate,showSelectedDate=ref.showSelectedDate,changeSelectedDate=ref.changeSelectedDate,setView=ref.setView,getFormattedDate=ref.getFormattedDate,options=ref.options;return _react.default.createElement("div",{className:"grid w-64 grid-cols-4"},_toConsumableArray(Array(12)).map(function(_year,index){var ref,ref1,ref2;var first=(0,_date.startOfYearPeriod)(selectedDate,10);var year=first-1+index*1;return _react.default.createElement("span",{key:index,className:"hover:bg-gray-100 dark:hover:bg-gray-600 block flex-1 leading-9 border-0 rounded-lg cursor-pointer text-center dark:text-white font-semibold text-sm ".concat(showSelectedDate&&selectedDate.getTime()>0&&Number(getFormattedDate(selectedDate,{year:"numeric"}))===year?(0,_tailwindMerge.twMerge)("bg-blue-700 text-white hover:bg-blue-600",options===null||options===void 0?void 0:(ref=options.theme)===null||ref===void 0?void 0:ref.selected):""," ").concat(index==0||index==11?(0,_tailwindMerge.twMerge)("text-gray-500",options===null||options===void 0?void 0:(ref1=options.theme)===null||ref1===void 0?void 0:ref1.disabledText):(0,_tailwindMerge.twMerge)("text-gray-900",options===null||options===void 0?void 0:(ref2=options.theme)===null||ref2===void 0?void 0:ref2.text)),onClick:function(){changeSelectedDate("date",new Date((0,_date.addYears)(selectedDate,year-selectedDate.getFullYear())));setView("months")}},year)}))};var _default=Years;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:all[name]})}_export(exports,{firstDateOfMonth:function(){return firstDateOfMonth},addDays:function(){return addDays},dayDiff:function(){return dayDiff},dayOfTheWeekOf:function(){return dayOfTheWeekOf},addMonths:function(){return addMonths},addYears:function(){return addYears},getFormattedDate:function(){return getFormattedDate},goToPrevNext:function(){return goToPrevNext},startOfYearPeriod:function(){return startOfYearPeriod}});var firstDateOfMonth=function(selectedYear,selectedMonth,date){var newDate=new Date(0);newDate.setFullYear(selectedYear,selectedMonth,date);return newDate.setHours(0,0,0,0)};var addDays=function(date,amount){var newDate=new Date(date);return newDate.setDate(newDate.getDate()+amount)};var dayDiff=function(day,from){return(day-from+7)%7};var dayOfTheWeekOf=function(baseDate,dayOfWeek){var weekStart=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;var baseDay=new Date(baseDate).getDay();return addDays(baseDate,dayDiff(dayOfWeek,weekStart)-dayDiff(baseDay,weekStart))};var addMonths=function(date,amount){var newDate=date;var monthsToSet=newDate.getMonth()+amount;var expectedMonth=monthsToSet%12;if(expectedMonth<0){expectedMonth+=12}var time=newDate.setMonth(monthsToSet);return newDate.getMonth()!==expectedMonth?newDate.setDate(0):time};var addYears=function(date,amount){var newDate=date;var expectedMonth=newDate.getMonth();var time=newDate.setFullYear(newDate.getFullYear()+amount);return expectedMonth===1&&newDate.getMonth()===2?newDate.setDate(0):time};var getFormattedDate=function(date,options){var defaultOptions={day:"numeric",month:"long",year:"numeric"};if(options)defaultOptions=options;return new Intl.DateTimeFormat("en",defaultOptions).format(date)};var goToPrevNext=function(view,date,direction){switch(view){case"days":return addMonths(date,direction);case"months":return addYears(date,direction);case"years":return addYears(date,direction*10);case"decades":return addYears(date,direction*100);default:return addYears(date,direction*10)}};var startOfYearPeriod=function(date,years){var year=date.getFullYear();return Math.floor(year/years)*years};
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _export(target,all){for(var name in all)Object.defineProperty(target,name,{enumerable:true,get:all[name]})}_export(exports,{firstDateOfMonth:function(){return firstDateOfMonth},addDays:function(){return addDays},dayDiff:function(){return dayDiff},dayOfTheWeekOf:function(){return dayOfTheWeekOf},addMonths:function(){return addMonths},addYears:function(){return addYears},getFormattedDate:function(){return getFormattedDate},goToPrevNext:function(){return goToPrevNext},startOfYearPeriod:function(){return startOfYearPeriod}});var firstDateOfMonth=function(selectedYear,selectedMonth,date){var newDate=new Date(0);newDate.setFullYear(selectedYear,selectedMonth,date);return newDate.setHours(0,0,0,0)};var addDays=function(date,amount){var newDate=new Date(date);return newDate.setDate(newDate.getDate()+amount)};var dayDiff=function(day,from){return(day-from+7)%7};var dayOfTheWeekOf=function(baseDate,dayOfWeek){var weekStart=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;var baseDay=new Date(baseDate).getDay();return addDays(baseDate,dayDiff(dayOfWeek,weekStart)-dayDiff(baseDay,weekStart))};var addMonths=function(date,amount){var newDate=date;var monthsToSet=newDate.getMonth()+amount;var expectedMonth=monthsToSet%12;if(expectedMonth<0){expectedMonth+=12}var time=newDate.setMonth(monthsToSet);return newDate.getMonth()!==expectedMonth?newDate.setDate(0):time};var addYears=function(date,amount){var newDate=date;var expectedMonth=newDate.getMonth();var time=newDate.setFullYear(newDate.getFullYear()+amount);return expectedMonth===1&&newDate.getMonth()===2?newDate.setDate(0):time};var getFormattedDate=function(language,date,options){var defaultOptions={day:"numeric",month:"long",year:"numeric"};if(options)defaultOptions=options;return new Intl.DateTimeFormat(language,defaultOptions).format(date)};var goToPrevNext=function(view,date,direction){switch(view){case"days":return addMonths(date,direction);case"months":return addYears(date,direction);case"years":return addYears(date,direction*10);case"decades":return addYears(date,direction*100);default:return addYears(date,direction*10)}};var startOfYearPeriod=function(date,years){var year=date.getFullYear();return Math.floor(year/years)*years};
{
"name": "tailwind-datepicker-react",
"version": "1.1.2",
"version": "1.2.0",
"description": "A tailwindcss/flowbite datepicker component built as a react component with types",

@@ -49,3 +49,6 @@ "main": "dist/index.js",

"typescript": "^4.8.4"
},
"dependencies": {
"tailwind-merge": "^1.6.1"
}
}

@@ -0,1 +1,5 @@

[![NPM Version](https://img.shields.io/npm/v/tailwind-datepicker-react?color=green)](https://www.npmjs.com/package/tailwind-datepicker-react)
[![NPM Minified Size](https://img.shields.io/bundlephobia/min/tailwind-datepicker-react)](https://www.npmjs.com/package/tailwind-datepicker-react)
[![GitHub deployments](https://img.shields.io/github/deployments/OMikkel/tailwind-datepicker-react/github-pages?label=Demo%20Website%20Deployment)](https://omikkel.github.io/tailwind-datepicker-react/)
# Tailwind-datepicker-react

@@ -5,2 +9,4 @@

Date logic from [VanillaJS-datepicker](https://github.com/mymth/vanillajs-datepicker)
## [Demo](https://omikkel.github.io/tailwind-datepicker-react/)

@@ -41,1 +47,153 @@

```
## Usage
### Basic
```jsx
const options = {
title: "Demo Title",
autoHide: true,
todayBtn: false,
clearBtn: true,
maxDate: new Date("2030-01-01"),
minDate: new Date("1950-01-01"),
theme: {
background: "bg-gray-700 dark:bg-gray-800",
todayBtn: "",
clearBtn: "",
icons: "",
text: "",
disabledText: "bg-red-500",
input: "",
inputIcon: "",
selected: "",
},
icons: { // () => ReactNode | JSX.Element
prev: () => <span>Previous</span>,
next: () => <span>Next</span>,
}
datepickerClassNames: "top-12",
defaultDate: new Date("2022-01-01"),
language: "en",
}
const DemoComponent = () => {
const [show, setShow] = useState<boolean>(false)
const handleChange = (selectedDate: Date) => {
console.log(selectedDate)
}
const handleClose = (state: boolean) => {
setShow(state)
}
return (
<div>
<Datepicker options={options} onChange={handleChange} show={show} setShow={handleClose} />
</div>
)
}
```
### Advanced - Custom input field
```jsx
const options = {
title: "Demo Title",
autoHide: true,
todayBtn: false,
clearBtn: true,
maxDate: new Date("2030-01-01"),
minDate: new Date("1950-01-01"),
theme: {
background: "bg-gray-700 dark:bg-gray-800",
todayBtn: "",
clearBtn: "",
icons: "",
text: "",
disabledText: "bg-red-500",
input: "",
inputIcon: "",
selected: "",
},
icons: { // () => ReactNode | JSX.Element
prev: () => <span>Previous</span>,
next: () => <span>Next</span>,
},
datepickerClassNames: "top-12",
defaultDate: new Date("2022-01-01"),
language: "en",
}
const DemoComponent = () => {
const [show, setShow] = useState<boolean>(false)
const [selectedDate, setSelectedDate] = useState<Date | null>(null)
const handleChange = (selectedDate: Date) => {
setSelectedDate(selectedDate)
console.log(selectedDate)
}
const handleClose = (state: boolean) => {
setShow(state)
}
return (
<div>
<Datepicker options={options} onChange={handleChange} show={show} setShow={handleClose} />
<div className="...">
<div className="...">
<CalendarIcon />
</div>
<input
type="text"
className="..."
placeholder="Select Date"
value={selectedDate}
onFocus={() => setShow(true)}
readOnly
/>
</div>
</DatePicker>
</div>
)
}
```
### DatePicker Props
- children?: ReactNode
- options?: [IOptions](###IOptions)
- onChange?: (date: Date) => void
- show: boolean
- setShow: (show: boolean) => void
- classNames?: string
### IOptions
- title?: string - Default: `disabled`
- autoHide?: boolean - Default: `true`
- todayBtn?: boolean - Default: `true`
- clearBtn?: boolean - Default: `true`
- maxDate?: Date - Default: `disabled`
- minDate?: Date - Default: `disabled`
- theme?: [ITheme](###ITheme) - Default: `As seen on demo page`
- icons?: [IIcons](###IIcons) - Default: `As seen on demo page`
- datepickerClassNames?: string - Default: `""`
- defaultDate?: Date - Default: `new Date()`
- language?: string - Default: `en`
### ITheme
- background: string
- todayBtn: string
- clearBtn: string
- icons: string
- text: string
- disabledText: string
- input: string
- inputIcon: string
- selected: string
### IIcons
- prev: () => ReactNode | JSX.Element
- next: () => ReactNode | JSX.Element
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc