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

@zach.codes/react-calendar

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zach.codes/react-calendar - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

13

dist/react-calendar.cjs.development.js

@@ -109,4 +109,12 @@ 'use strict';

};
}; //to prevent these from being purged in production, we make a lookup object
var headingClasses = {
l3: 'lg:grid-cols-3',
l4: 'lg:grid-cols-4',
l5: 'lg:grid-cols-5',
l6: 'lg:grid-cols-6',
l7: 'lg:grid-cols-7'
};
function MonthlyBody(_ref3) {

@@ -132,3 +140,4 @@ var omitDays = _ref3.omitDays,

}, React__default.createElement("div", {
className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-" + headings.length
className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 " + //@ts-ignore
headingClasses["l" + headings.length]
}, headings.map(function (day) {

@@ -135,0 +144,0 @@ return React__default.createElement("div", {

2

dist/react-calendar.cjs.production.min.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("date-fns"),a=require("react"),r=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,n=[{day:0,label:"Sunday"},{day:1,label:"Monday"},{day:2,label:"Tuesday"},{day:3,label:"Wednesday"},{day:4,label:"Thursday"},{day:5,label:"Friday"},{day:6,label:"Saturday"}],l=r.createContext({}),d=function(){return a.useContext(l)},o=r.createContext({}),s=function(){return a.useContext(o)},i=function(e){var a=e.day,n=s(),l=n.week,d=n.selectedDay,o=n.changeSelectedDay,i=!!d&&t.getDay(d)===a.day,c=t.setDay(l,a.day);return r.createElement("li",{onClick:function(){return o(i?void 0:c)},className:"bg-white cursor-pointer","aria-label":"Day of Week"},r.createElement("div",{className:"rounded-lg border sm:w-36 text-center py-4 "+(i?"border-indigo-600":"border-gray-300 hover:border-gray-500")},r.createElement("p",{className:"font-medium text-sm text-gray-800"},a.label," ",t.format(c,"do"))))};exports.DefaultMonthlyEventItem=function(e){var t=e.date;return r.createElement("li",{className:"py-2"},r.createElement("div",{className:"flex text-sm flex-1 justify-between"},r.createElement("h3",{className:"font-medium"},e.title),r.createElement("p",{className:"text-gray-500"},t)))},exports.DefaultWeeklyEventItem=function(e){var t=e.date;return r.createElement("li",{className:"py-4 w-72"},r.createElement("div",{className:"text-sm flex justify-between"},r.createElement("h3",{className:"font-medium"},e.title),r.createElement("p",{className:"text-gray-500"},t)))},exports.MonthlyBody=function(e){var a=e.omitDays,l=e.events,o=e.renderDay,s=function(e){var a=e.days,r=e.omitDays,l=n,d=a;r&&(l=n.filter((function(e){return!r.includes(e.day)})),d=a.filter((function(e){return!r.includes(t.getDay(e))})));var o=t.getDay(d[0]);if(r){var s=r.filter((function(e){return e<o})).length;o-=s}return{headings:l,daysToRender:d,padding:new Array(o).fill(0)}}({days:d().days,omitDays:a}),i=s.headings,c=s.daysToRender,u=s.padding;return r.createElement("div",{className:"bg-white border-l-2 border-t-2"},r.createElement("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-"+i.length},i.map((function(e){return r.createElement("div",{key:e.day,className:"border-b-2 p-2 border-r-2 lg:block hidden","aria-label":"Day of Week"},e.label)})),u.map((function(e,t){return r.createElement("div",{key:t,className:"border-b-2 p-2 border-r-2 lg:block hidden","aria-label":"Empty Day"})})),c.map((function(e){var a=l.filter((function(a){return t.isSameDay(a.date,e)})),n=t.format(e,"d");return r.createElement("div",{key:e.toISOString(),"aria-label":"Events for day "+n,className:"h-48 p-2 border-b-2 border-r-2"},r.createElement("div",{className:"flex justify-between"},r.createElement("div",{className:"font-bold"},n),r.createElement("div",{className:"lg:hidden block"},t.format(e,"EEEE"))),r.createElement("ul",{className:"divide-gray-200 divide-y overflow-hidden max-h-36 overflow-y-auto"},o(a)))}))))},exports.MonthlyCalendar=function(e){var a=e.onCurrentMonthChange,n=e.children,d=t.startOfMonth(e.currentMonth),o=t.eachDayOfInterval({start:d,end:t.endOfMonth(d)});return r.createElement(l.Provider,{value:{days:o,onCurrentMonthChange:a,currentMonth:d}},n)},exports.MonthlyNav=function(){var e=d(),a=e.currentMonth,n=e.onCurrentMonthChange;return r.createElement("div",{className:"flex justify-end mb-4"},r.createElement("button",{onClick:function(){return n(t.subMonths(a,1))},className:"cursor-pointer"},"Previous"),r.createElement("div",{className:"ml-4 mr-4 w-32 text-center","aria-label":"Current Month"},t.format(a,t.getYear(a)===t.getYear(new Date)?"LLLL":"LLLL yyyy")),r.createElement("button",{onClick:function(){return n(t.addMonths(a,1))},className:"cursor-pointer"},"Next"))},exports.WeeklyBody=function(e){var a=e.events,n=e.renderItem,l=e.style,d=s(),o=d.week,i=d.selectedDay;return r.createElement("div",{className:"overflow-auto max-h-96",style:l},r.createElement("ul",{className:"divide-y divide-gray-200 "},a.map((function(e){return i&&!t.isSameDay(i,e.date)?null:t.isSameWeek(o,e.date)?n({item:e,showingFullWeek:void 0===i}):null}))))},exports.WeeklyCalendar=function(e){var n=e.week,l=e.children,d=a.useState(),s=d[0],i=d[1];return a.useEffect((function(){i(void 0)}),[n]),r.createElement(o.Provider,{value:{selectedDay:s,week:t.startOfWeek(n),changeSelectedDay:i}},l)},exports.WeeklyContainer=function(e){return r.createElement("div",{className:"md:flex md:justify-between"},e.children)},exports.WeeklyDays=function(e){var t=e.omitDays,a=n;return t&&(a=n.filter((function(e){return!t.includes(e.day)}))),r.createElement("ul",{className:"grid md:grid-cols-1 grid-cols-2 gap-2"},a.map((function(e){return r.createElement(i,{key:e.day,day:e})})))},exports.WeeklyResponsiveContainer=function(e){return r.createElement("div",{className:"border p-4 md:w-3/4 lg:w-1/2 w-full"},e.children)},exports.useMonthlyCalendar=d,exports.useWeeklyCalendar=s;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("date-fns"),a=require("react"),r=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,n=[{day:0,label:"Sunday"},{day:1,label:"Monday"},{day:2,label:"Tuesday"},{day:3,label:"Wednesday"},{day:4,label:"Thursday"},{day:5,label:"Friday"},{day:6,label:"Saturday"}],l=r.createContext({}),d=function(){return a.useContext(l)},o={l3:"lg:grid-cols-3",l4:"lg:grid-cols-4",l5:"lg:grid-cols-5",l6:"lg:grid-cols-6",l7:"lg:grid-cols-7"},s=r.createContext({}),i=function(){return a.useContext(s)},c=function(e){var a=e.day,n=i(),l=n.week,d=n.selectedDay,o=n.changeSelectedDay,s=!!d&&t.getDay(d)===a.day,c=t.setDay(l,a.day);return r.createElement("li",{onClick:function(){return o(s?void 0:c)},className:"bg-white cursor-pointer","aria-label":"Day of Week"},r.createElement("div",{className:"rounded-lg border sm:w-36 text-center py-4 "+(s?"border-indigo-600":"border-gray-300 hover:border-gray-500")},r.createElement("p",{className:"font-medium text-sm text-gray-800"},a.label," ",t.format(c,"do"))))};exports.DefaultMonthlyEventItem=function(e){var t=e.date;return r.createElement("li",{className:"py-2"},r.createElement("div",{className:"flex text-sm flex-1 justify-between"},r.createElement("h3",{className:"font-medium"},e.title),r.createElement("p",{className:"text-gray-500"},t)))},exports.DefaultWeeklyEventItem=function(e){var t=e.date;return r.createElement("li",{className:"py-4 w-72"},r.createElement("div",{className:"text-sm flex justify-between"},r.createElement("h3",{className:"font-medium"},e.title),r.createElement("p",{className:"text-gray-500"},t)))},exports.MonthlyBody=function(e){var a=e.omitDays,l=e.events,s=e.renderDay,i=function(e){var a=e.days,r=e.omitDays,l=n,d=a;r&&(l=n.filter((function(e){return!r.includes(e.day)})),d=a.filter((function(e){return!r.includes(t.getDay(e))})));var o=t.getDay(d[0]);if(r){var s=r.filter((function(e){return e<o})).length;o-=s}return{headings:l,daysToRender:d,padding:new Array(o).fill(0)}}({days:d().days,omitDays:a}),c=i.headings,u=i.daysToRender,m=i.padding;return r.createElement("div",{className:"bg-white border-l-2 border-t-2"},r.createElement("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 "+o["l"+c.length]},c.map((function(e){return r.createElement("div",{key:e.day,className:"border-b-2 p-2 border-r-2 lg:block hidden","aria-label":"Day of Week"},e.label)})),m.map((function(e,t){return r.createElement("div",{key:t,className:"border-b-2 p-2 border-r-2 lg:block hidden","aria-label":"Empty Day"})})),u.map((function(e){var a=l.filter((function(a){return t.isSameDay(a.date,e)})),n=t.format(e,"d");return r.createElement("div",{key:e.toISOString(),"aria-label":"Events for day "+n,className:"h-48 p-2 border-b-2 border-r-2"},r.createElement("div",{className:"flex justify-between"},r.createElement("div",{className:"font-bold"},n),r.createElement("div",{className:"lg:hidden block"},t.format(e,"EEEE"))),r.createElement("ul",{className:"divide-gray-200 divide-y overflow-hidden max-h-36 overflow-y-auto"},s(a)))}))))},exports.MonthlyCalendar=function(e){var a=e.onCurrentMonthChange,n=e.children,d=t.startOfMonth(e.currentMonth),o=t.eachDayOfInterval({start:d,end:t.endOfMonth(d)});return r.createElement(l.Provider,{value:{days:o,onCurrentMonthChange:a,currentMonth:d}},n)},exports.MonthlyNav=function(){var e=d(),a=e.currentMonth,n=e.onCurrentMonthChange;return r.createElement("div",{className:"flex justify-end mb-4"},r.createElement("button",{onClick:function(){return n(t.subMonths(a,1))},className:"cursor-pointer"},"Previous"),r.createElement("div",{className:"ml-4 mr-4 w-32 text-center","aria-label":"Current Month"},t.format(a,t.getYear(a)===t.getYear(new Date)?"LLLL":"LLLL yyyy")),r.createElement("button",{onClick:function(){return n(t.addMonths(a,1))},className:"cursor-pointer"},"Next"))},exports.WeeklyBody=function(e){var a=e.events,n=e.renderItem,l=e.style,d=i(),o=d.week,s=d.selectedDay;return r.createElement("div",{className:"overflow-auto max-h-96",style:l},r.createElement("ul",{className:"divide-y divide-gray-200 "},a.map((function(e){return s&&!t.isSameDay(s,e.date)?null:t.isSameWeek(o,e.date)?n({item:e,showingFullWeek:void 0===s}):null}))))},exports.WeeklyCalendar=function(e){var n=e.week,l=e.children,d=a.useState(),o=d[0],i=d[1];return a.useEffect((function(){i(void 0)}),[n]),r.createElement(s.Provider,{value:{selectedDay:o,week:t.startOfWeek(n),changeSelectedDay:i}},l)},exports.WeeklyContainer=function(e){return r.createElement("div",{className:"md:flex md:justify-between"},e.children)},exports.WeeklyDays=function(e){var t=e.omitDays,a=n;return t&&(a=n.filter((function(e){return!t.includes(e.day)}))),r.createElement("ul",{className:"grid md:grid-cols-1 grid-cols-2 gap-2"},a.map((function(e){return r.createElement(c,{key:e.day,day:e})})))},exports.WeeklyResponsiveContainer=function(e){return r.createElement("div",{className:"border p-4 md:w-3/4 lg:w-1/2 w-full"},e.children)},exports.useMonthlyCalendar=d,exports.useWeeklyCalendar=i;
//# sourceMappingURL=react-calendar.cjs.production.min.js.map

@@ -102,4 +102,12 @@ import { startOfMonth, eachDayOfInterval, endOfMonth, subMonths, format, getYear, addMonths, isSameDay, getDay, startOfWeek, isSameWeek, setDay } from 'date-fns';

};
}; //to prevent these from being purged in production, we make a lookup object
var headingClasses = {
l3: 'lg:grid-cols-3',
l4: 'lg:grid-cols-4',
l5: 'lg:grid-cols-5',
l6: 'lg:grid-cols-6',
l7: 'lg:grid-cols-7'
};
function MonthlyBody(_ref3) {

@@ -125,3 +133,4 @@ var omitDays = _ref3.omitDays,

}, React.createElement("div", {
className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-" + headings.length
className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 " + //@ts-ignore
headingClasses["l" + headings.length]
}, headings.map(function (day) {

@@ -128,0 +137,0 @@ return React.createElement("div", {

{
"version": "0.0.2",
"version": "0.0.3",
"license": "MIT",

@@ -4,0 +4,0 @@ "name": "@zach.codes/react-calendar",

@@ -164,3 +164,3 @@ # React Calendar

Building a calendar is highly opinionated. This library to let you easily customize any piece of it. Let's take a look at the `MonthlyNav` component:
Building a calendar is highly opinionated. This library lets you easily customize any piece of it. Let's take a look at the `MonthlyNav` component:

@@ -167,0 +167,0 @@ ```tsx

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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