react-modular-datepicker 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/components/Day.tsx","../src/i18n.ts","../src/components/CalendarHeader.tsx","../src/classNames.ts","../src/components/MonthSelection.tsx","../src/components/YearSelection.tsx","../src/components/Calendar.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport type { CalendarClassNames, DateObj } from '../types';\n\ninterface DayProps {\n dateObj: DateObj | null;\n getDateProps: (args: { dateObj: DateObj, [key: string]: any }) => any;\n tooltip?: React.ReactNode;\n classNames: Required<CalendarClassNames>;\n}\n\nexport const Day: React.FC<DayProps> = ({ dateObj, getDateProps, classNames, tooltip }) => {\n const [isHovered, setIsHovered] = useState(false);\n\n if (!dateObj) {\n return <div className=\"aspect-square bg-white\" />;\n }\n\n const { date, selected, selectable, isRangeStart, isRangeEnd, isRangeBetween, isRangeHovering, isRangeActive } = dateObj;\n const dayClasses = classNames.day;\n\n let stateClasses = \"rounded-full\";\n if (isRangeStart && isRangeEnd) {\n stateClasses = `${dayClasses.selected} rounded-full`;\n } else if (isRangeStart) {\n stateClasses = `${dayClasses.rangeStart} ${isRangeActive ? 'rounded-l-full rounded-r-none' : 'rounded-full'}`;\n } else if (isRangeEnd) {\n stateClasses = `${dayClasses.rangeEnd} ${isRangeActive ? 'rounded-r-full rounded-l-none' : 'rounded-full'}`;\n } else if (isRangeBetween) {\n stateClasses = dayClasses.rangeBetween || '';\n } else if (isRangeHovering) {\n stateClasses = dayClasses.rangeHovering || '';\n } else if (selected) {\n stateClasses = dayClasses.selected || '';\n } else if (!selectable) {\n stateClasses = dayClasses.disabled || '';\n } else {\n stateClasses = dayClasses.unselected || '';\n }\n\n const className = [\n dayClasses.day,\n stateClasses,\n ...(dateObj.modifiers || []).map(m => (dayClasses as any)[m] || m)\n ].filter(Boolean).join(' ');\n\n return (\n <button\n {...getDateProps({\n dateObj,\n onMouseEnter: () => setIsHovered(true),\n onMouseLeave: () => setIsHovered(false)\n })}\n className={className}\n >\n {date.getDate()}\n {tooltip && isHovered && (\n <div className=\"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 hidden group-hover:block z-10\">\n <div className=\"bg-gray-800 text-white text-xs py-1 px-2 rounded whitespace-nowrap shadow-lg\">\n {tooltip}\n <div className=\"absolute top-full left-1/2 -translate-x-1/2 border-8 border-transparent border-t-gray-800\" />\n </div>\n </div>\n )}\n </button>\n );\n};\n","import { DateAdapter } from \"./types\";\nimport { defaultAdapter } from \"./adapters/dayjs\";\n\nexport interface Translations {\n months: string[];\n weekdays: string[];\n back: string;\n forward: string;\n}\n\nexport function getDefaults(adapter: DateAdapter = defaultAdapter, locale?: string): Translations {\n return {\n months: adapter.getMonths(locale),\n weekdays: adapter.getWeekdays(locale),\n back: 'Previous month',\n forward: 'Next month'\n };\n}\n\nexport function getTranslations(\n adapter: DateAdapter = defaultAdapter,\n locale?: string,\n custom?: Partial<Translations>\n): Translations {\n const base = getDefaults(adapter, locale);\n return { ...base, ...custom };\n}\n","import React from 'react';\nimport { Calendar, CalendarClassNames } from '../types';\n\nexport interface HeaderProps {\n calendars: Calendar[];\n getBackProps: (args: any) => any;\n getForwardProps: (args: any) => any;\n setView: (view: 'days' | 'months' | 'years') => void;\n monthNames: string[];\n t: { back: string; forward: string };\n classNames: Required<CalendarClassNames>;\n slideDirection?: 'left' | 'right' | null;\n currentView?: 'days' | 'months' | 'years';\n}\n\nexport const ChevronLeftIcon = () => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <polyline points=\"15 18 9 12 15 6\"></polyline>\n </svg>\n);\n\nexport const ChevronRightIcon = () => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <polyline points=\"9 18 15 12 9 6\"></polyline>\n </svg>\n);\n\nexport const CalendarHeader: React.FC<HeaderProps> = ({\n calendars,\n getBackProps,\n getForwardProps,\n setView,\n monthNames,\n t,\n classNames,\n slideDirection,\n currentView\n}) => {\n return (\n <div className={classNames.header}>\n <button\n {...getBackProps({ calendars })}\n onMouseDown={(e) => e.preventDefault()}\n className={`${classNames.navButton} ${currentView && currentView !== 'days' ? 'invisible pointer-events-none' : ''}`}\n aria-label={t.back}\n >\n <ChevronLeftIcon />\n </button>\n\n <div className={classNames.monthYearContainer}>\n {calendars.length === 1 ? (\n <div key={`${calendars[0].month}-${calendars[0].year}`} className={`${classNames.monthYearLabel} ${slideDirection === 'left' ? 'animate-slide-in-left' : slideDirection === 'right' ? 'animate-slide-in-right' : ''}`}>\n <button\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => setView(currentView === 'months' ? 'days' : 'months')}\n className={classNames.monthYearButton}\n >\n {monthNames[calendars[0].month]}\n </button>\n <button\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => setView(currentView === 'years' ? 'days' : 'years')}\n className={classNames.monthYearButton}\n >\n {calendars[0].year}\n </button>\n </div>\n ) : (\n <div className={`${classNames.monthYearLabel} ${slideDirection === 'left' ? 'animate-slide-in-left' : slideDirection === 'right' ? 'animate-slide-in-right' : ''}`}>\n {(() => {\n const first = calendars[0];\n const last = calendars[calendars.length - 1];\n const isFullYear = calendars.length === 12 && first.month === 0 && last.month === 11 && first.year === last.year;\n\n if (isFullYear) {\n return <span>{first.year}</span>;\n } else if (first.year === last.year) {\n return <span>{monthNames[first.month]} - {monthNames[last.month]} {first.year}</span>;\n } else {\n return <span>{monthNames[first.month]} {first.year} - {monthNames[last.month]} {last.year}</span>;\n }\n })()}\n </div>\n )}\n </div>\n\n <button\n {...getForwardProps({ calendars })}\n onMouseDown={(e) => e.preventDefault()}\n className={`${classNames.navButton} ${currentView && currentView !== 'days' ? 'invisible pointer-events-none' : ''}`}\n aria-label={t.forward}\n >\n <ChevronRightIcon />\n </button>\n </div>\n );\n};\n","export interface DayClassNames {\n day?: string;\n selected?: string;\n unselected?: string;\n disabled?: string;\n rangeStart?: string;\n rangeEnd?: string;\n rangeBetween?: string;\n rangeHovering?: string;\n [key: string]: string | undefined;\n}\n\nexport const defaultClassNames = {\n root: \"w-fit flex flex-col p-4 bg-white rounded-lg shadow-lg\",\n header: \"flex items-center justify-between border-b-2 border-brand-gray-light/40 pb-2\",\n calendarsContainer: \"flex flex-wrap gap-4 mt-3\",\n calendarContainer: \"flex-1 min-w-[280px] max-w-full\",\n weekdayGrid: \"grid grid-cols-7 gap-1 mb-1 border-b border-brand-gray-light/40\",\n weekday: \"text-center text-xs text-gray-400 py-2\",\n daysGrid: \"grid grid-cols-7 gap-px bg-brand-gray-light/20\",\n footer: \"mt-4\",\n\n navButton: \"p-2 text-brand-text hover:bg-gray-100 rounded-full transition-colors cursor-pointer disabled:opacity-30 disabled:pointer-events-none\",\n monthYearContainer: \"flex gap-8\",\n monthYearLabel: \"flex gap-1 items-center font-semibold text-brand-text\",\n monthYearButton: \"hover:bg-gray-100 px-2 py-1 rounded cursor-pointer\",\n\n day: {\n day: \"aspect-square flex items-center justify-center text-sm font-medium transition-all relative group cursor-pointer p-px\",\n selected: \"bg-brand-gold text-white rounded-full\",\n unselected: \"bg-white hover:bg-brand-gray-light text-brand-text\",\n disabled: \"bg-white text-gray-300 cursor-not-allowed\",\n rangeStart: \"bg-brand-gold text-white\",\n rangeEnd: \"bg-brand-gold text-white\",\n rangeBetween: \"bg-brand-gold/25 text-brand-text\",\n rangeHovering: \"bg-brand-gold/25 text-brand-text\",\n },\n\n monthsGrid: \"grid grid-cols-3 gap-2 animate-slide-in-top\",\n monthButton: \"py-3 rounded-lg hover:bg-brand-gray-light transition-colors cursor-pointer disabled:opacity-30 disabled:pointer-events-none\",\n monthButtonSelected: \"bg-brand-gold text-white\",\n monthButtonUnselected: \"text-brand-text\",\n\n yearsGrid: \"grid grid-cols-3 gap-2 max-h-[300px] overflow-y-auto pr-2 animate-slide-in-top\",\n yearButton: \"py-3 rounded-lg hover:bg-brand-gray-light transition-colors cursor-pointer disabled:opacity-30 disabled:pointer-events-none\",\n yearButtonSelected: \"bg-brand-gold text-white\",\n yearButtonUnselected: \"text-brand-text\",\n}\n\nexport interface CalendarClassNames {\n root?: string;\n header?: string;\n calendarsContainer?: string;\n calendarContainer?: string;\n weekdayGrid?: string;\n weekday?: string;\n daysGrid?: string;\n footer?: string;\n\n navButton?: string;\n monthYearContainer?: string;\n monthYearLabel?: string;\n monthYearButton?: string;\n\n day?: DayClassNames;\n\n monthsGrid?: string;\n monthButton?: string;\n monthButtonSelected?: string;\n monthButtonUnselected?: string;\n\n yearsGrid?: string;\n yearButton?: string;\n yearButtonSelected?: string;\n yearButtonUnselected?: string;\n}\n\nexport const mergeClassNames = (custom?: CalendarClassNames): Required<CalendarClassNames> => {\n const result = { ...defaultClassNames };\n if (!custom) return result;\n\n for (const key in custom) {\n const k = key as keyof CalendarClassNames;\n if (k === 'day' && custom.day) {\n result.day = { ...defaultClassNames.day, ...custom.day };\n } else if (custom[k]) {\n (result as any)[k] = custom[k];\n }\n }\n return result;\n};\n","import React from 'react';\nimport { CalendarClassNames } from '../types';\n\ninterface MonthSelectionProps {\n year: number;\n month: number;\n monthNames: string[];\n minDate?: Date | null;\n maxDate?: Date | null;\n onMonthSelect: (month: number) => void;\n classNames: Required<CalendarClassNames>;\n}\n\nexport const MonthSelection: React.FC<MonthSelectionProps> = ({\n year,\n month,\n monthNames,\n minDate,\n maxDate,\n onMonthSelect,\n classNames,\n}) => {\n const isMonthDisabled = (monthIdx: number) => {\n if (minDate && year === minDate.getFullYear() && monthIdx < minDate.getMonth()) {\n return true;\n }\n if (maxDate && year === maxDate.getFullYear() && monthIdx > maxDate.getMonth()) {\n return true;\n }\n return false;\n };\n\n return (\n <div className={classNames.monthsGrid}>\n {monthNames.map((name, idx) => {\n const disabled = isMonthDisabled(idx);\n return (\n <button\n key={name}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => !disabled && onMonthSelect(idx)}\n className={`${classNames.monthButton} ${idx === month ? classNames.monthButtonSelected : classNames.monthButtonUnselected}`}\n disabled={disabled}\n >\n {name}\n </button>\n );\n })}\n </div>\n );\n};\n","import React, { useEffect, useRef } from 'react';\nimport { CalendarClassNames, DateAdapter } from '../types';\n\ninterface YearSelectionProps {\n year: number;\n minDate?: Date | null;\n maxDate?: Date | null;\n adapter: DateAdapter;\n onYearSelect: (year: number) => void;\n classNames: Required<CalendarClassNames>;\n}\n\nexport const YearSelection: React.FC<YearSelectionProps> = ({\n year,\n minDate,\n maxDate,\n adapter,\n onYearSelect,\n classNames,\n}) => {\n const yearListRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (yearListRef.current) {\n const selectedYearBtn = yearListRef.current.querySelector('[data-selected=\"true\"]');\n if (selectedYearBtn) {\n selectedYearBtn.scrollIntoView({ block: 'center' });\n }\n }\n }, []);\n\n const startYear = minDate ? adapter.get(adapter.date(minDate), 'year') : year - 50;\n const endYear = maxDate ? adapter.get(adapter.date(maxDate), 'year') : year + 50;\n const years = [];\n for (let y = startYear; y <= endYear; y++) {\n years.push(y);\n }\n\n return (\n <div ref={yearListRef} className={classNames.yearsGrid}>\n {years.map((y) => (\n <button\n key={y}\n data-selected={y === year}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => onYearSelect(y)}\n className={`${classNames.yearButton} ${y === year ? classNames.yearButtonSelected : classNames.yearButtonUnselected}`}\n >\n {y}\n </button>\n ))}\n </div>\n );\n};\n","import React, { useState } from 'react';\nimport { useDates, UseDatesProps } from '../useDates';\nimport { Day } from './Day';\nimport { defaultAdapter } from '../adapters/dayjs';\nimport { getTranslations, Translations } from '../i18n';\nimport { CalendarHeader } from './CalendarHeader';\nimport { DateObj, CalendarClassNames } from '../types';\nimport { mergeClassNames } from '../classNames';\nimport { MonthSelection } from './MonthSelection';\nimport { YearSelection } from './YearSelection';\n\ninterface CalendarProps extends UseDatesProps {\n classNames?: CalendarClassNames;\n locale?: string;\n translations?: Partial<Translations>;\n header?: React.ReactNode | ((props: any) => React.ReactNode);\n footer?: React.ReactNode;\n renderDayTooltip?: (dateObj: DateObj) => React.ReactNode;\n}\n\ntype CalendarView = 'days' | 'months' | 'years';\n\nexport const Calendar: React.FC<CalendarProps> = (props) => {\n const {\n classNames: customClassNames,\n locale,\n translations: customTranslations,\n adapter = defaultAdapter,\n firstDayOfWeek = 0,\n header,\n footer,\n renderDayTooltip,\n ...useDatesProps\n } = props;\n\n const classNames = mergeClassNames(customClassNames);\n\n const [view, setView] = useState<CalendarView>('days');\n const [slideDirection, setSlideDirection] = useState<'left' | 'right' | null>(null);\n\n const t = getTranslations(adapter, locale, customTranslations);\n const weekdayNames = t.weekdays;\n const monthNames = t.months;\n\n const {\n calendars,\n getBackProps,\n getForwardProps,\n getDateProps,\n setOffset\n } = useDates({ ...useDatesProps, adapter, firstDayOfWeek });\n\n // Adjust weekday names based on firstDayOfWeek\n const sortedWeekdays = [...weekdayNames.slice(firstDayOfWeek), ...weekdayNames.slice(0, firstDayOfWeek)];\n\n const currentCalendar = calendars[0];\n const { month, year } = currentCalendar;\n\n const handleMonthSelect = (newMonth: number) => {\n const currentMonth = adapter.set(adapter.set(adapter.date(props.date || new Date()), 'year', year), 'month', month);\n const targetMonth = adapter.set(currentMonth, 'month', newMonth);\n const baseMonth = adapter.startOf(adapter.date(props.date || new Date()), 'month');\n const newOffset = adapter.diff(targetMonth, baseMonth, 'month');\n setSlideDirection(null);\n setOffset(newOffset);\n setView('days');\n };\n\n const handleYearSelect = (newYear: number) => {\n const currentMonth = adapter.set(adapter.set(adapter.date(props.date || new Date()), 'year', year), 'month', month);\n const targetMonth = adapter.set(currentMonth, 'year', newYear);\n const baseMonth = adapter.startOf(adapter.date(props.date || new Date()), 'month');\n const newOffset = adapter.diff(targetMonth, baseMonth, 'month');\n setSlideDirection(null);\n setOffset(newOffset);\n setView('days');\n };\n\n const wrappedGetBackProps = (args: any) => {\n const props = getBackProps(args);\n return {\n ...props,\n onClick: (e: any) => {\n setSlideDirection('left');\n props.onClick?.(e);\n }\n };\n };\n\n const wrappedGetForwardProps = (args: any) => {\n const props = getForwardProps(args);\n return {\n ...props,\n onClick: (e: any) => {\n setSlideDirection('right');\n props.onClick?.(e);\n }\n };\n };\n\n const renderDefaultHeader = () => (\n <CalendarHeader\n calendars={calendars}\n getBackProps={wrappedGetBackProps}\n getForwardProps={wrappedGetForwardProps}\n setView={setView}\n monthNames={monthNames}\n t={t}\n classNames={classNames}\n slideDirection={slideDirection}\n currentView={view}\n />\n );\n\n return (\n <div className={`rmdp ${classNames.root}`}>\n {typeof header === 'function' ? header({\n calendars,\n getBackProps: wrappedGetBackProps,\n getForwardProps: wrappedGetForwardProps,\n setView,\n monthNames,\n t,\n slideDirection,\n currentView: view\n }) : (header || renderDefaultHeader())}\n\n <div className={classNames.calendarsContainer}>\n {view === 'months' && calendars.map((calendar) => (\n <div key={`months-${calendar.year}`} className={classNames.calendarContainer}>\n <MonthSelection\n year={calendar.year}\n month={calendar.month}\n monthNames={monthNames}\n minDate={props.minDate}\n maxDate={props.maxDate}\n onMonthSelect={handleMonthSelect}\n classNames={classNames}\n />\n </div>\n ))}\n {view === 'years' && calendars.map((calendar) => (\n <div key={`years-${calendar.year}`} className={classNames.calendarContainer}>\n <YearSelection\n year={calendar.year}\n minDate={props.minDate}\n maxDate={props.maxDate}\n adapter={adapter}\n onYearSelect={handleYearSelect}\n classNames={classNames}\n />\n </div>\n ))}\n {view === 'days' && calendars.map((calendar) => (\n <div key={`${calendar.month}-${calendar.year}`} className={classNames.calendarContainer}>\n {calendars.length > 1 && (\n <button\n type=\"button\"\n aria-label={monthNames[calendar.month]}\n className=\"block w-full text-center font-semibold mb-2 text-brand-text\"\n >\n {monthNames[calendar.month]} {calendars[0].year !== calendars[calendars.length - 1].year ? calendar.year : ''}\n </button>\n )}\n <div className={classNames.weekdayGrid}>\n {sortedWeekdays.map((day) => (\n <div key={day} className={classNames.weekday}>{day}</div>\n ))}\n </div>\n <div className={`${classNames.daysGrid} ${slideDirection === 'left' ? 'animate-slide-in-left' : slideDirection === 'right' ? 'animate-slide-in-right' : ''}`}>\n {calendar.weeks.map((week, wi) =>\n week.map((dateObj, di) => (\n <Day\n key={`${wi}-${di}`}\n dateObj={dateObj}\n getDateProps={getDateProps}\n classNames={classNames}\n tooltip={dateObj && renderDayTooltip?.(dateObj)}\n />\n ))\n )}\n </div>\n </div>\n ))}\n </div>\n {footer && <div className={classNames.footer}>{footer}</div>}\n </div>\n );\n};\n"],"mappings":";;;;;AAUA,IAAa,KAA2B,EAAE,YAAS,iBAAc,eAAY,iBAAc;CACzF,IAAM,CAAC,GAAW,KAAgB,EAAS,EAAK;CAEhD,IAAI,CAAC,GACH,OAAO,kBAAC,OAAD,EAAK,WAAU,yBAA0B,CAAA;CAGlD,IAAM,EAAE,SAAM,aAAU,eAAY,iBAAc,eAAY,mBAAgB,oBAAiB,qBAAkB,GAC3G,IAAa,EAAW,KAE1B,IAAe;CACnB,AAaE,IAbE,KAAgB,IACH,GAAG,EAAW,SAAS,iBAC7B,IACM,GAAG,EAAW,WAAW,GAAG,IAAgB,kCAAkC,mBACpF,IACM,GAAG,EAAW,SAAS,GAAG,IAAgB,kCAAkC,mBAClF,IACM,EAAW,gBAAgB,KACjC,IACM,EAAW,iBAAiB,KAClC,IACM,EAAW,YAAY,KAC5B,IAGK,EAAW,cAAc,KAFzB,EAAW,YAAY;CAKxC,IAAM,IAAY;EAChB,EAAW;EACX;EACA,IAAI,EAAQ,aAAa,CAAC,EAAA,CAAG,KAAI,MAAM,EAAmB,MAAM,CAAC;CACnE,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;CAE1B,OACE,kBAAC,UAAD;EACE,GAAI,EAAa;GACf;GACA,oBAAoB,EAAa,EAAI;GACrC,oBAAoB,EAAa,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L,kBAAC,OAAD;QAAK,WAAW,GAAG,EAAW,SAAS,GAAG,MAAmB,SAAS,0BAA0B,MAAmB,UAAU,2BAA2B;QACrJ,UAAA,EAAS,MAAM,KAAK,GAAM,MACzB,EAAK,KAAK,GAAS,MACjB,kBAAC,GAAD;SAEW;SACK;SACF;SACZ,SAAS,KAAW,IAAmB,CAAO;QAC/C,GALM,GAAG,EAAG,GAAG,GAKf,CACF,CACH;OACG,CAAA;MACF;KA5BK,GAAA,GAAG,EAAS,MAAM,GAAG,EAAS,MA4BnC,CACN;IACE;;GACJ,KAAU,kBAAC,OAAD;IAAK,WAAW,EAAW;IAAS,UAAA;GAAY,CAAA;EACxD;;AAET"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/classNames.ts","../src/i18n.ts","../src/components/CalendarHeader.tsx","../src/components/Day.tsx","../src/components/MonthSelection.tsx","../src/components/YearSelection.tsx","../src/components/Calendar.tsx"],"sourcesContent":["export interface DayClassNames {\n day?: string;\n selected?: string;\n unselected?: string;\n disabled?: string;\n empty?: string;\n rangeStart?: string;\n rangeEnd?: string;\n rangeBetween?: string;\n rangeHovering?: string;\n [key: string]: string | undefined;\n}\n\nexport const defaultClassNames = {\n root: \"w-fit flex flex-col p-4 bg-white rounded-lg shadow-lg\",\n header: \"flex items-center justify-between border-b-2 border-brand-gray-light/40 pb-2\",\n headerMultiMonth: \"border-b-0 pb-0\",\n calendarsContainer: \"flex flex-wrap gap-4\",\n calendarContainer: \"flex-1 min-w-[280px] max-w-full\",\n navButtonSlotStart: \"w-9 flex justify-start\",\n navButtonSlotEnd: \"w-9 flex justify-end\",\n headerTitleContainer: \"font-semibold text-brand-text text-center flex-1\",\n weekdayGrid: \"grid grid-cols-7 gap-1 mb-1 border-b border-brand-gray-light/40\",\n weekday: \"text-center text-xs text-gray-400 py-2\",\n daysGrid: \"grid grid-cols-7 gap-px bg-brand-gray-light/20\",\n footer: \"mt-4\",\n\n navButton: \"p-2 text-brand-text hover:bg-gray-100 rounded-full transition-colors cursor-pointer disabled:opacity-30 disabled:pointer-events-none\",\n navButtonHidden: \"invisible pointer-events-none\",\n monthYearContainer: \"flex gap-8\",\n monthYearLabel: \"flex gap-1 items-center font-semibold text-brand-text\",\n monthYearButton: \"hover:bg-gray-100 px-2 py-1 rounded cursor-pointer\",\n\n day: {\n day: \"rmdp-day group\",\n selected: \"rmdp-day-selected\",\n unselected: \"rmdp-day-unselected\",\n disabled: \"rmdp-day-disabled\",\n empty: \"rmdp-day-empty\",\n rangeStart: \"rmdp-day-range-start\",\n rangeEnd: \"rmdp-day-range-end\",\n rangeBetween: \"rmdp-day-range-between\",\n rangeHovering: \"rmdp-day-range-hovering\",\n },\n\n monthsGrid: \"grid grid-cols-3 gap-2 animate-slide-in-top\",\n monthButton: \"py-3 rounded-lg hover:bg-brand-gray-light transition-colors cursor-pointer disabled:opacity-30 disabled:pointer-events-none\",\n monthButtonSelected: \"bg-brand-gold text-white\",\n monthButtonUnselected: \"text-brand-text\",\n\n yearsGrid: \"grid grid-cols-3 gap-2 max-h-[210px] overflow-y-auto pr-2 animate-slide-in-top rmdp-scrollbar\",\n yearButton: \"py-3 rounded-lg hover:bg-brand-gray-light transition-colors cursor-pointer disabled:opacity-30 disabled:pointer-events-none\",\n yearButtonSelected: \"bg-brand-gold text-white\",\n yearButtonUnselected: \"text-brand-text\",\n}\n\nexport interface CalendarClassNames {\n root?: string;\n header?: string;\n headerMultiMonth?: string;\n calendarsContainer?: string;\n calendarContainer?: string;\n navButtonSlotStart?: string;\n navButtonSlotEnd?: string;\n headerTitleContainer?: string;\n weekdayGrid?: string;\n weekday?: string;\n daysGrid?: string;\n footer?: string;\n\n navButton?: string;\n navButtonHidden?: string;\n monthYearContainer?: string;\n monthYearLabel?: string;\n monthYearButton?: string;\n\n day?: DayClassNames;\n\n monthsGrid?: string;\n monthButton?: string;\n monthButtonSelected?: string;\n monthButtonUnselected?: string;\n\n yearsGrid?: string;\n yearButton?: string;\n yearButtonSelected?: string;\n yearButtonUnselected?: string;\n}\n\nexport const mergeClassNames = (custom?: CalendarClassNames): Required<CalendarClassNames> => {\n const result = { ...defaultClassNames };\n if (!custom) return result;\n\n for (const key in custom) {\n const k = key as keyof CalendarClassNames;\n if (k === 'day' && custom.day) {\n result.day = { ...defaultClassNames.day, ...custom.day };\n } else if (custom[k]) {\n (result as any)[k] = custom[k];\n }\n }\n return result;\n};\n","import { DateAdapter } from \"./types\";\nimport { defaultAdapter } from \"./adapters/dayjs\";\n\nexport interface Translations {\n months: string[];\n weekdays: string[];\n back: string;\n forward: string;\n}\n\nexport function getDefaults(adapter: DateAdapter = defaultAdapter, locale?: string): Translations {\n return {\n months: adapter.getMonths(locale),\n weekdays: adapter.getWeekdays(locale),\n back: 'Previous month',\n forward: 'Next month'\n };\n}\n\nexport function getTranslations(\n adapter: DateAdapter = defaultAdapter,\n locale?: string,\n custom?: Partial<Translations>\n): Translations {\n const base = getDefaults(adapter, locale);\n return { ...base, ...custom };\n}\n","import React from 'react';\nimport { Calendar, CalendarClassNames } from '../types';\n\nexport interface HeaderProps {\n calendars: Calendar[];\n getBackProps: (args: any) => any;\n getForwardProps: (args: any) => any;\n setView: (view: 'days' | 'months' | 'years') => void;\n monthNames: string[];\n t: { back: string; forward: string };\n classNames: Required<CalendarClassNames>;\n slideDirection?: 'left' | 'right' | null;\n currentView?: 'days' | 'months' | 'years';\n}\n\nexport const ChevronLeftIcon = () => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <polyline points=\"15 18 9 12 15 6\"></polyline>\n </svg>\n);\n\nexport const ChevronRightIcon = () => (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <polyline points=\"9 18 15 12 9 6\"></polyline>\n </svg>\n);\n\nexport const CalendarHeader: React.FC<HeaderProps> = ({\n calendars,\n getBackProps,\n getForwardProps,\n setView,\n monthNames,\n t,\n classNames,\n slideDirection,\n currentView\n}) => {\n if (calendars.length > 1 && calendars.length < 12) {\n return null;\n }\n\n const first = calendars[0];\n const last = calendars[calendars.length - 1];\n\n const headerClassName = [\n classNames.header,\n calendars.length > 1 ? classNames.headerMultiMonth : ''\n ].filter(Boolean).join(' ');\n\n const navButtonClassName = (isHidden: boolean) => [\n classNames.navButton,\n isHidden ? classNames.navButtonHidden : ''\n ].filter(Boolean).join(' ');\n\n const isNavHidden = !!(currentView && currentView !== 'days');\n\n return (\n <div className={headerClassName}>\n <button\n {...getBackProps({ calendars })}\n onMouseDown={(e) => e.preventDefault()}\n className={navButtonClassName(isNavHidden)}\n aria-label={t.back}\n >\n <ChevronLeftIcon />\n </button>\n\n <div className={classNames.monthYearContainer}>\n {calendars.length === 1 ? (\n <div key={`${calendars[0].month}-${calendars[0].year}`} className={`${classNames.monthYearLabel} ${slideDirection === 'left' ? 'animate-slide-in-left' : slideDirection === 'right' ? 'animate-slide-in-right' : ''}`}>\n <button\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => setView(currentView === 'months' ? 'days' : 'months')}\n className={classNames.monthYearButton}\n >\n {monthNames[calendars[0].month]}\n </button>\n <button\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => setView(currentView === 'years' ? 'days' : 'years')}\n className={classNames.monthYearButton}\n >\n {calendars[0].year}\n </button>\n </div>\n ) : (\n <div className={`${classNames.monthYearLabel} ${slideDirection === 'left' ? 'animate-slide-in-left' : slideDirection === 'right' ? 'animate-slide-in-right' : ''}`}>\n <span>\n {first.year === last.year ? first.year : `${first.year} - ${last.year}`}\n </span>\n </div>\n )}\n </div>\n\n <button\n {...getForwardProps({ calendars })}\n onMouseDown={(e) => e.preventDefault()}\n className={navButtonClassName(isNavHidden)}\n aria-label={t.forward}\n >\n <ChevronRightIcon />\n </button>\n </div>\n );\n};\n","import React from 'react';\nimport type { CalendarClassNames, DateObj } from '../types';\n\ninterface DayProps {\n dateObj: DateObj | null;\n getDateProps: (args: { dateObj: DateObj, [key: string]: any }) => any;\n dayProps?: Record<string, any>;\n classNames: Required<CalendarClassNames>;\n}\n\nexport const Day: React.FC<DayProps> = ({ dateObj, getDateProps, dayProps, classNames }) => {\n if (!dateObj) {\n return <div className={classNames.day.empty} />;\n }\n\n const { date, selected, selectable, isRangeStart, isRangeEnd, isRangeBetween, isRangeHovering, isRangeActive } = dateObj;\n const dayClasses = classNames.day;\n\n let stateClasses = \"rounded-full\";\n if (isRangeStart && isRangeEnd) {\n stateClasses = `${dayClasses.selected} rounded-full`;\n } else if (isRangeStart) {\n stateClasses = `${dayClasses.rangeStart} ${isRangeActive ? 'rounded-l-full rounded-r-none' : 'rounded-full'}`;\n } else if (isRangeEnd) {\n stateClasses = `${dayClasses.rangeEnd} ${isRangeActive ? 'rounded-r-full rounded-l-none' : 'rounded-full'}`;\n } else if (isRangeBetween) {\n stateClasses = dayClasses.rangeBetween || '';\n } else if (isRangeHovering) {\n stateClasses = dayClasses.rangeHovering || '';\n } else if (selected) {\n stateClasses = dayClasses.selected || '';\n } else if (!selectable) {\n stateClasses = dayClasses.disabled || '';\n } else {\n stateClasses = dayClasses.unselected || '';\n }\n\n const modifierClasses = (dateObj.modifiers || [])\n .map(m => (dayClasses as any)[m] || m)\n .filter(Boolean)\n .join(' ');\n\n const className = [dayClasses.day, stateClasses, modifierClasses]\n .filter(Boolean)\n .join(' ');\n\n return (\n <button\n {...getDateProps({ dateObj, ...dayProps })}\n className={className}\n >\n {date.getDate()}\n </button>\n );\n};\n","import React from 'react';\nimport { CalendarClassNames } from '../types';\n\ninterface MonthSelectionProps {\n year: number;\n month: number;\n monthNames: string[];\n minDate?: Date | null;\n maxDate?: Date | null;\n onMonthSelect: (month: number) => void;\n classNames: Required<CalendarClassNames>;\n}\n\nexport const MonthSelection: React.FC<MonthSelectionProps> = ({\n year,\n month,\n monthNames,\n minDate,\n maxDate,\n onMonthSelect,\n classNames,\n}) => {\n const isMonthDisabled = (monthIdx: number) => {\n if (minDate && year === minDate.getFullYear() && monthIdx < minDate.getMonth()) {\n return true;\n }\n if (maxDate && year === maxDate.getFullYear() && monthIdx > maxDate.getMonth()) {\n return true;\n }\n return false;\n };\n\n return (\n <div className={classNames.monthsGrid}>\n {monthNames.map((name, idx) => {\n const disabled = isMonthDisabled(idx);\n return (\n <button\n key={name}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => !disabled && onMonthSelect(idx)}\n className={`${classNames.monthButton} ${idx === month ? classNames.monthButtonSelected : classNames.monthButtonUnselected}`}\n disabled={disabled}\n >\n {name}\n </button>\n );\n })}\n </div>\n );\n};\n","import React, { useEffect, useRef } from 'react';\nimport { CalendarClassNames, DateAdapter } from '../types';\n\ninterface YearSelectionProps {\n year: number;\n minDate?: Date | null;\n maxDate?: Date | null;\n adapter: DateAdapter;\n onYearSelect: (year: number) => void;\n classNames: Required<CalendarClassNames>;\n}\n\nexport const YearSelection: React.FC<YearSelectionProps> = ({\n year,\n minDate,\n maxDate,\n adapter,\n onYearSelect,\n classNames,\n}) => {\n const yearListRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (yearListRef.current) {\n const selectedYearBtn = yearListRef.current.querySelector('[data-selected=\"true\"]');\n if (selectedYearBtn) {\n selectedYearBtn.scrollIntoView({ block: 'center' });\n }\n }\n }, []);\n\n const startYear = minDate ? adapter.get(adapter.date(minDate), 'year') : year - 50;\n const endYear = maxDate ? adapter.get(adapter.date(maxDate), 'year') : year + 50;\n const years = [];\n for (let y = startYear; y <= endYear; y++) {\n years.push(y);\n }\n\n return (\n <div ref={yearListRef} className={classNames.yearsGrid}>\n {years.map((y) => (\n <button\n key={y}\n data-selected={y === year}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => onYearSelect(y)}\n className={`${classNames.yearButton} ${y === year ? classNames.yearButtonSelected : classNames.yearButtonUnselected}`}\n >\n {y}\n </button>\n ))}\n </div>\n );\n};\n","import React, { useState } from 'react';\nimport { defaultAdapter } from '../adapters/dayjs';\nimport { mergeClassNames } from '../classNames';\nimport { getTranslations, Translations } from '../i18n';\nimport { CalendarClassNames, DateObj } from '../types';\nimport { useDates, UseDatesProps } from '../useDates';\nimport { CalendarHeader, ChevronLeftIcon, ChevronRightIcon } from './CalendarHeader';\nimport { Day } from './Day';\nimport { MonthSelection } from './MonthSelection';\nimport { YearSelection } from './YearSelection';\n\ninterface CalendarProps extends UseDatesProps {\n classNames?: CalendarClassNames;\n locale?: string;\n translations?: Partial<Translations>;\n header?: React.ReactNode | ((props: any) => React.ReactNode);\n footer?: React.ReactNode;\n getDayProps?: (dateObj: DateObj) => Record<string, any>;\n}\n\ntype CalendarView = 'days' | 'months' | 'years';\n\nexport const Calendar: React.FC<CalendarProps> = (props) => {\n const {\n classNames: customClassNames,\n locale,\n translations: customTranslations,\n adapter = defaultAdapter,\n firstDayOfWeek = 0,\n header,\n footer,\n getDayProps,\n ...useDatesProps\n } = props;\n\n const classNames = mergeClassNames(customClassNames);\n\n const [view, setView] = useState<CalendarView>('days');\n const [slideDirection, setSlideDirection] = useState<'left' | 'right' | null>(null);\n\n const t = getTranslations(adapter, locale, customTranslations);\n const weekdayNames = t.weekdays;\n const monthNames = t.months;\n\n const {\n calendars,\n getBackProps,\n getForwardProps,\n getDateProps,\n setOffset\n } = useDates({ ...useDatesProps, adapter, firstDayOfWeek });\n\n // Adjust weekday names based on firstDayOfWeek\n const sortedWeekdays = [...weekdayNames.slice(firstDayOfWeek), ...weekdayNames.slice(0, firstDayOfWeek)];\n\n const currentCalendar = calendars[0];\n const { month, year } = currentCalendar;\n\n const handleMonthSelect = (newMonth: number) => {\n const currentMonth = adapter.set(adapter.set(adapter.date(props.date || new Date()), 'year', year), 'month', month);\n const targetMonth = adapter.set(currentMonth, 'month', newMonth);\n const baseMonth = adapter.startOf(adapter.date(props.date || new Date()), 'month');\n const newOffset = adapter.diff(targetMonth, baseMonth, 'month');\n setSlideDirection(null);\n setOffset(newOffset);\n setView('days');\n };\n\n const handleYearSelect = (newYear: number) => {\n const currentMonth = adapter.set(adapter.set(adapter.date(props.date || new Date()), 'year', year), 'month', month);\n const targetMonth = adapter.set(currentMonth, 'year', newYear);\n const baseMonth = adapter.startOf(adapter.date(props.date || new Date()), 'month');\n const newOffset = adapter.diff(targetMonth, baseMonth, 'month');\n setSlideDirection(null);\n setOffset(newOffset);\n setView('days');\n };\n\n const stepOffset = useDatesProps.monthsToDisplay || 1;\n\n const wrappedGetBackProps = (args: any) => {\n const props = getBackProps({ offset: stepOffset, ...args });\n return {\n ...props,\n onClick: (e: any) => {\n setSlideDirection('left');\n props.onClick?.(e);\n }\n };\n };\n\n const wrappedGetForwardProps = (args: any) => {\n const props = getForwardProps({ offset: stepOffset, ...args });\n return {\n ...props,\n onClick: (e: any) => {\n setSlideDirection('right');\n props.onClick?.(e);\n }\n };\n };\n\n const renderDefaultHeader = () => (\n <CalendarHeader\n calendars={calendars}\n getBackProps={wrappedGetBackProps}\n getForwardProps={wrappedGetForwardProps}\n setView={setView}\n monthNames={monthNames}\n t={t}\n classNames={classNames}\n slideDirection={slideDirection}\n currentView={view}\n />\n );\n\n return (\n <div className={`rmdp ${classNames.root}`}>\n {typeof header === 'function' ? header({\n calendars,\n getBackProps: wrappedGetBackProps,\n getForwardProps: wrappedGetForwardProps,\n setView,\n monthNames,\n t,\n slideDirection,\n currentView: view\n }) : (header || renderDefaultHeader())}\n\n <div className={classNames.calendarsContainer}>\n {view === 'months' && calendars.map((calendar) => (\n <div key={`months-${calendar.year}`} className={classNames.calendarContainer}>\n <MonthSelection\n year={calendar.year}\n month={calendar.month}\n monthNames={monthNames}\n minDate={props.minDate}\n maxDate={props.maxDate}\n onMonthSelect={handleMonthSelect}\n classNames={classNames}\n />\n </div>\n ))}\n {view === 'years' && calendars.map((calendar) => (\n <div key={`years-${calendar.year}`} className={classNames.calendarContainer}>\n <YearSelection\n year={calendar.year}\n minDate={props.minDate}\n maxDate={props.maxDate}\n adapter={adapter}\n onYearSelect={handleYearSelect}\n classNames={classNames}\n />\n </div>\n ))}\n {view === 'days' && calendars.map((calendar, index) => (\n <div key={`${calendar.month}-${calendar.year}`} className={classNames.calendarContainer}>\n {calendars.length > 1 && (\n <div className={classNames.header}>\n <div className={classNames.navButtonSlotStart}>\n {index === 0 && calendars.length < 12 && (\n <button\n {...wrappedGetBackProps({ calendars })}\n onMouseDown={(e) => e.preventDefault()}\n className={classNames.navButton}\n aria-label={t.back}\n >\n <ChevronLeftIcon />\n </button>\n )}\n </div>\n <span className={classNames.headerTitleContainer}>\n {monthNames[calendar.month]}\n {calendars.length < 12 ? ` ${calendar.year}` : ''}\n </span>\n <div className={classNames.navButtonSlotEnd}>\n {index === calendars.length - 1 && calendars.length < 12 && (\n <button\n {...wrappedGetForwardProps({ calendars })}\n onMouseDown={(e) => e.preventDefault()}\n className={classNames.navButton}\n aria-label={t.forward}\n >\n <ChevronRightIcon />\n </button>\n )}\n </div>\n </div>\n )}\n <div className={classNames.weekdayGrid}>\n {sortedWeekdays.map((day) => (\n <div key={day} className={classNames.weekday}>{day}</div>\n ))}\n </div>\n <div key={`daysGrid-${calendar.month}-${calendar.year}`} className={`${classNames.daysGrid} ${slideDirection === 'left' ? 'animate-slide-in-left' : slideDirection === 'right' ? 'animate-slide-in-right' : ''}`}>\n {calendar.weeks.map((week, wi) =>\n week.map((dateObj, di) => (\n <Day\n key={`${wi}-${di}`}\n dateObj={dateObj}\n getDateProps={getDateProps}\n dayProps={dateObj ? getDayProps?.(dateObj) : undefined}\n classNames={classNames}\n />\n ))\n )}\n </div>\n </div>\n ))}\n </div>\n {footer && <div className={classNames.footer}>{footer}</div>}\n </div>\n );\n};\n"],"mappings":";;;;;AAaA,IAAa,IAAoB;CAC/B,MAAM;CACN,QAAQ;CACR,kBAAkB;CAClB,oBAAoB;CACpB,mBAAmB;CACnB,oBAAoB;CACpB,kBAAkB;CAClB,sBAAsB;CACtB,aAAa;CACb,SAAS;CACT,UAAU;CACV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B,EAAK,KAAK,GAAS,MACjB,kBAAC,GAAD;SAEW;SACK;SACd,UAAU,IAAU,IAAc,CAAO,IAAI,KAAA;SACjC;QACb,GALM,GAAG,EAAG,GAAG,GAKf,CACF,CACH;OACG,GAZK,YAAY,EAAS,MAAM,GAAG,EAAS,MAY5C;MACF;KAnDK,GAAA,GAAG,EAAS,MAAM,GAAG,EAAS,MAmDnC,CACN;IACE;;GACJ,KAAU,kBAAC,OAAD;IAAK,WAAW,EAAW;IAAS,UAAA;GAAY,CAAA;EACxD;;AAET"}
package/dist/utils.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(...e){return(t,...n)=>e.some(e=>(e&&e(t,...n),t&&t.defaultPrevented))}function t({calendars:e,offset:t,minDate:n,adapter:r}){let i=e[0].firstDayOfMonth,a=r.subtract(r.date(i),t,`month`);return n&&r.isBefore(a,r.startOf(r.date(n),`month`))?r.diff(r.startOf(r.date(i),`month`),r.startOf(r.date(n),`month`),`month`):t}function n({calendars:e,offset:t,maxDate:n,adapter:r}){let i=e[e.length-1].firstDayOfMonth,a=r.add(r.date(i),t,`month`);return n&&r.isAfter(a,r.startOf(r.date(n),`month`))?r.diff(r.startOf(r.date(n),`month`),r.startOf(r.date(i),`month`),`month`):t}function r({date:e,selected:t,disabledDates:n,modifiers:r,monthsToDisplay:a,minDate:o,maxDate:s,offset:c,firstDayOfWeek:l,showOutsideDays:u,adapter:d,selectionMode:f,hoveredDate:p}){let m=[],h=d.add(d.startOf(d.date(e),`month`),c,`month`);for(let e=0;e<a;e++){let a=d.add(h,e,`month`);m.push(i({month:d.get(a,`month`),year:d.get(a,`year`),selectedDates:t,disabledDates:n,modifiers:r,minDate:o,maxDate:s,firstDayOfWeek:l,showOutsideDays:u,adapter:d,selectionMode:f,hoveredDate:p}))}return m}function i({month:e,year:t,selectedDates:n,disabledDates:r,modifiers:i,minDate:l,maxDate:u,firstDayOfWeek:d,showOutsideDays:f,adapter:p,selectionMode:m,hoveredDate:h}){let g=p.set(p.set(p.date(),`year`,t),`month`,e);e=p.get(g,`month`),t=p.get(g,`year`);let _=p.getDaysInMonth(g),v=[];for(let o=1;o<=_;o++){let s=a(p.toDate(p.set(g,`day`,o)),n,r,i,l,u,p,m,!1,h,e,t);v.push(s)}let y=p.toDate(p.startOf(g,`month`)),b=p.toDate(p.endOf(g,`month`)),x=o({firstDayOfMonth:y,minDate:l,maxDate:u,selectedDates:n,disabledDates:r,modifiers:i,firstDayOfWeek:d,showOutsideDays:f,adapter:p,selectionMode:m,hoveredDate:h,month:e,year:t}),S=s({lastDayOfMonth:b,minDate:l,maxDate:u,selectedDates:n,disabledDates:r,modifiers:i,firstDayOfWeek:d,showOutsideDays:f,adapter:p,selectionMode:m,hoveredDate:h,month:e,year:t});v.unshift(...x),v.push(...S);let C=c(v);return{firstDayOfMonth:y,lastDayOfMonth:b,month:e,year:t,weeks:C}}function a(e,t,n,r,i,a,o,s,c=!1,d,f,p){let{selected:m,isRangeStart:h,isRangeEnd:g,isRangeBetween:_,isRangeHovering:v,isRangeActive:y}=l(t,e,o,s,d),b=o.isSame(o.date(e),o.date(),`day`),x=c&&o.isBefore(o.date(e),o.startOf(o.date(e),`month`)),S=c&&o.isAfter(o.date(e),o.endOf(o.date(e),`month`)),C={"text-brand-gold border border-brand-gold":e=>o.isSame(o.date(e),o.date(),`day`),"text-gray-400 opacity-50":(e,t)=>o.get(o.date(e),`month`)!==t,...r},w=Object.keys(C).filter(t=>C[t](e,f??o.get(o.date(e),`month`),p??o.get(o.date(e),`year`)));return b&&w.push(`today`),c&&w.push(`outside`),x&&w.push(`prev-month`),S&&w.push(`next-month`),{date:e,selected:m,modifiers:w,selectable:u(i,a,n,e,o),today:b,prevMonth:x,nextMonth:S,isRangeStart:h,isRangeEnd:g,isRangeBetween:_,isRangeHovering:v,isRangeActive:y}}function o({firstDayOfMonth:e,minDate:t,maxDate:n,selectedDates:r,disabledDates:i,modifiers:o,firstDayOfWeek:s,showOutsideDays:c,adapter:l,selectionMode:u,hoveredDate:d,month:f,year:p}){let m=[],h=(l.toDate(l.date(e)).getDay()+7-s)%7,g=l.subtract(l.date(e),1,`day`);for(let e=0;e<h;e++){let e=a(l.toDate(g),r,i,o,t,n,l,u,!0,d,f,p);e.prevMonth=!0,c||(e.selectable=!1),m.unshift(e),g=l.subtract(g,1,`day`)}return m}function s({lastDayOfMonth:e,minDate:t,maxDate:n,selectedDates:r,disabledDates:i,modifiers:o,firstDayOfWeek:s,showOutsideDays:c,adapter:l,selectionMode:u,hoveredDate:d,month:f,year:p}){let m=[],h=(l.toDate(l.date(e)).getDay()+7-s)%7,g=l.add(l.date(e),1,`day`);for(let e=0;e<6-h;e++){let e=a(l.toDate(g),r,i,o,t,n,l,u,!0,d,f,p);e.nextMonth=!0,c||(e.selectable=!1),m.push(e),g=l.add(g,1,`day`)}return m}function c(e){let t=Math.ceil(e.length/7),n=[];for(let r=0;r<t;r++){n[r]=[];for(let t=0;t<7;t++)n[r].push(e[r*7+t])}return n}function l(e,t,n,r,i){if(!e&&!i)return{selected:!1};let a=n.date(t);if(r===`single`&&e instanceof Date)return{selected:n.isSame(a,n.date(e),`day`)};if(r===`multiple`&&Array.isArray(e))return{selected:e.some(e=>n.isSame(a,n.date(e),`day`))};if(r===`range`){let{start:t,end:r}=e&&typeof e==`object`&&!(e instanceof Date)&&!Array.isArray(e)?e:{start:void 0,end:void 0},o=t?n.isSame(a,n.date(t),`day`):!1,s=r?n.isSame(a,n.date(r),`day`):!1,c=t&&r?n.isAfter(a,n.date(t),`day`)&&n.isBefore(a,n.date(r),`day`):!1,l=!1;if(t&&!r&&i){let e=n.date(i),r=n.date(t);n.isAfter(e,r,`day`)?(l=n.isAfter(a,r,`day`)&&n.isBefore(a,e,`day`)||n.isSame(a,e,`day`),n.isSame(a,e,`day`)&&(s=!0)):n.isBefore(e,r,`day`)&&(l=n.isAfter(a,e,`day`)&&n.isBefore(a,r,`day`)||n.isSame(a,e,`day`),n.isSame(a,e,`day`)&&(o=!0),n.isSame(a,r,`day`)&&(o=!1,s=!0))}let u=!!(t&&r&&!n.isSame(n.date(t),n.date(r),`day`)||t&&!r&&i&&!n.isSame(n.date(t),n.date(i),`day`));return{selected:o||s||c,isRangeStart:o,isRangeEnd:s,isRangeBetween:c,isRangeHovering:l,isRangeActive:u}}return Array.isArray(e)&&e.length===1&&r===`single`?{selected:n.isSame(a,n.date(e[0]),`day`)}:{selected:!1}}function u(e,t,n,r,i){let a=i.date(r),o=e&&i.isBefore(a,i.date(e),`day`),s=t&&i.isAfter(a,i.date(t),`day`),c=n?.some(e=>i.isSame(a,i.date(e),`day`));return!o&&!s&&!c}function d({calendars:e,minDate:t,adapter:n}){if(!t)return!1;let r=e[0].firstDayOfMonth;return n.isSame(n.startOf(n.date(r),`month`),n.startOf(n.date(t),`month`),`month`)||n.isBefore(n.date(r),n.date(t),`month`)}function f({calendars:e,maxDate:t,adapter:n}){if(!t)return!1;let r=e[e.length-1].firstDayOfMonth;return n.isSame(n.startOf(n.date(r),`month`),n.startOf(n.date(t),`month`),`month`)||n.isAfter(n.date(r),n.date(t),`month`)}exports.addMonth=n,exports.composeEventHandlers=e,exports.getCalendars=r,exports.isBackDisabled=d,exports.isForwardDisabled=f,exports.subtractMonth=t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(...e){return(t,...n)=>e.some(e=>(e&&e(t,...n),t&&t.defaultPrevented))}function t({calendars:e,offset:t,minDate:n,adapter:r}){let i=e[0].firstDayOfMonth,a=r.subtract(r.date(i),t,`month`);return n&&r.isBefore(a,r.startOf(r.date(n),`month`))?r.diff(r.startOf(r.date(i),`month`),r.startOf(r.date(n),`month`),`month`):t}function n({calendars:e,offset:t,maxDate:n,adapter:r}){let i=e[e.length-1].firstDayOfMonth,a=r.add(r.date(i),t,`month`);return n&&r.isAfter(a,r.startOf(r.date(n),`month`))?r.diff(r.startOf(r.date(n),`month`),r.startOf(r.date(i),`month`),`month`):t}function r({date:e,selected:t,disabledDates:n,modifiers:r,monthsToDisplay:a,minDate:o,maxDate:s,offset:c,firstDayOfWeek:l,showOutsideDays:u,adapter:d,selectionMode:f,hoveredDate:p}){let m=[],h=d.add(d.startOf(d.date(e),`month`),c,`month`);for(let e=0;e<a;e++){let a=d.add(h,e,`month`);m.push(i({month:d.get(a,`month`),year:d.get(a,`year`),selectedDates:t,disabledDates:n,modifiers:r,minDate:o,maxDate:s,firstDayOfWeek:l,showOutsideDays:u,adapter:d,selectionMode:f,hoveredDate:p}))}return m}function i({month:e,year:t,selectedDates:n,disabledDates:r,modifiers:i,minDate:l,maxDate:u,firstDayOfWeek:d,showOutsideDays:f,adapter:p,selectionMode:m,hoveredDate:h}){let g=p.set(p.set(p.date(),`year`,t),`month`,e);e=p.get(g,`month`),t=p.get(g,`year`);let _=p.getDaysInMonth(g),v=[];for(let o=1;o<=_;o++){let s=a(p.toDate(p.set(g,`day`,o)),n,r,i,l,u,p,m,!1,h,e,t);v.push(s)}let y=p.toDate(p.startOf(g,`month`)),b=p.toDate(p.endOf(g,`month`)),x=o({firstDayOfMonth:y,minDate:l,maxDate:u,selectedDates:n,disabledDates:r,modifiers:i,firstDayOfWeek:d,showOutsideDays:f,adapter:p,selectionMode:m,hoveredDate:h,month:e,year:t}),S=s({lastDayOfMonth:b,minDate:l,maxDate:u,selectedDates:n,disabledDates:r,modifiers:i,firstDayOfWeek:d,showOutsideDays:f,adapter:p,selectionMode:m,hoveredDate:h,month:e,year:t});v.unshift(...x),v.push(...S);let C=c(v);return{firstDayOfMonth:y,lastDayOfMonth:b,month:e,year:t,weeks:C}}function a(e,t,n,r,i,a,o,s,c=!1,d,f,p){let{selected:m,isRangeStart:h,isRangeEnd:g,isRangeBetween:_,isRangeHovering:v,isRangeActive:y}=l(t,e,o,s,d),b=o.isSame(o.date(e),o.date(),`day`),x=c&&o.isBefore(o.date(e),o.startOf(o.date(e),`month`)),S=c&&o.isAfter(o.date(e),o.endOf(o.date(e),`month`)),C={"text-brand-gold border border-brand-gold":e=>o.isSame(o.date(e),o.date(),`day`),"text-white cursor-default!":(e,t)=>o.get(o.date(e),`month`)!==t,...r},w=Object.keys(C).filter(t=>C[t](e,f??o.get(o.date(e),`month`),p??o.get(o.date(e),`year`)));return b&&w.push(`today`),c&&w.push(`outside`),x&&w.push(`prev-month`),S&&w.push(`next-month`),{date:e,selected:m,modifiers:w,selectable:u(i,a,n,e,o),today:b,prevMonth:x,nextMonth:S,isRangeStart:h,isRangeEnd:g,isRangeBetween:_,isRangeHovering:v,isRangeActive:y}}function o({firstDayOfMonth:e,minDate:t,maxDate:n,selectedDates:r,disabledDates:i,modifiers:o,firstDayOfWeek:s,showOutsideDays:c,adapter:l,selectionMode:u,hoveredDate:d,month:f,year:p}){let m=[],h=(l.toDate(l.date(e)).getDay()+7-s)%7,g=l.subtract(l.date(e),1,`day`);for(let e=0;e<h;e++){let e=a(l.toDate(g),r,i,o,t,n,l,u,!0,d,f,p);e.prevMonth=!0,c||(e.selectable=!1),m.unshift(e),g=l.subtract(g,1,`day`)}return m}function s({lastDayOfMonth:e,minDate:t,maxDate:n,selectedDates:r,disabledDates:i,modifiers:o,firstDayOfWeek:s,showOutsideDays:c,adapter:l,selectionMode:u,hoveredDate:d,month:f,year:p}){let m=[],h=(l.toDate(l.date(e)).getDay()+7-s)%7,g=l.add(l.date(e),1,`day`);for(let e=0;e<6-h;e++){let e=a(l.toDate(g),r,i,o,t,n,l,u,!0,d,f,p);e.nextMonth=!0,c||(e.selectable=!1),m.push(e),g=l.add(g,1,`day`)}return m}function c(e){let t=Math.ceil(e.length/7),n=[];for(let r=0;r<t;r++){n[r]=[];for(let t=0;t<7;t++)n[r].push(e[r*7+t])}return n}function l(e,t,n,r,i){if(!e&&!i)return{selected:!1};let a=n.date(t);if(r===`single`&&e instanceof Date)return{selected:n.isSame(a,n.date(e),`day`)};if(r===`multiple`&&Array.isArray(e))return{selected:e.some(e=>n.isSame(a,n.date(e),`day`))};if(r===`range`){let{start:t,end:r}=e&&typeof e==`object`&&!(e instanceof Date)&&!Array.isArray(e)?e:{start:void 0,end:void 0},o=t?n.isSame(a,n.date(t),`day`):!1,s=r?n.isSame(a,n.date(r),`day`):!1,c=t&&r?n.isAfter(a,n.date(t),`day`)&&n.isBefore(a,n.date(r),`day`):!1,l=!1;if(t&&!r&&i){let e=n.date(i),r=n.date(t);n.isAfter(e,r,`day`)?(l=n.isAfter(a,r,`day`)&&n.isBefore(a,e,`day`)||n.isSame(a,e,`day`),n.isSame(a,e,`day`)&&(s=!0)):n.isBefore(e,r,`day`)&&(l=n.isAfter(a,e,`day`)&&n.isBefore(a,r,`day`)||n.isSame(a,e,`day`),n.isSame(a,e,`day`)&&(o=!0),n.isSame(a,r,`day`)&&(o=!1,s=!0))}let u=!!(t&&r&&!n.isSame(n.date(t),n.date(r),`day`)||t&&!r&&i&&!n.isSame(n.date(t),n.date(i),`day`));return{selected:o||s||c,isRangeStart:o,isRangeEnd:s,isRangeBetween:c,isRangeHovering:l,isRangeActive:u}}return Array.isArray(e)&&e.length===1&&r===`single`?{selected:n.isSame(a,n.date(e[0]),`day`)}:{selected:!1}}function u(e,t,n,r,i){let a=i.date(r),o=e&&i.isBefore(a,i.date(e),`day`),s=t&&i.isAfter(a,i.date(t),`day`),c=n?.some(e=>i.isSame(a,i.date(e),`day`));return!o&&!s&&!c}function d({calendars:e,minDate:t,adapter:n}){if(!t)return!1;let r=e[0].firstDayOfMonth;return n.isSame(n.startOf(n.date(r),`month`),n.startOf(n.date(t),`month`),`month`)||n.isBefore(n.date(r),n.date(t),`month`)}function f({calendars:e,maxDate:t,adapter:n}){if(!t)return!1;let r=e[e.length-1].firstDayOfMonth;return n.isSame(n.startOf(n.date(r),`month`),n.startOf(n.date(t),`month`),`month`)||n.isAfter(n.date(r),n.date(t),`month`)}exports.addMonth=n,exports.composeEventHandlers=e,exports.getCalendars=r,exports.isBackDisabled=d,exports.isForwardDisabled=f,exports.subtractMonth=t;
2
2
  //# sourceMappingURL=utils.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.cjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { DateAdapter, DateObj, SelectionMode, Calendar } from './types';\n\nexport function composeEventHandlers(...fns: any[]) {\n return (event: any, ...args: any[]) =>\n fns.some(fn => {\n if (fn) {\n fn(event, ...args);\n }\n return event && event.defaultPrevented;\n });\n}\n\n\nexport function subtractMonth({\n calendars,\n offset,\n minDate,\n adapter\n}: {\n calendars: Calendar[],\n offset: number,\n minDate?: Date,\n adapter: DateAdapter\n}): number {\n const firstDay = calendars[0].firstDayOfMonth;\n const newDate = adapter.subtract(adapter.date(firstDay), offset, 'month');\n\n if (minDate && adapter.isBefore(newDate, adapter.startOf(adapter.date(minDate), 'month'))) {\n return adapter.diff(adapter.startOf(adapter.date(firstDay), 'month'), adapter.startOf(adapter.date(minDate), 'month'), 'month');\n }\n return offset;\n}\n\nexport function addMonth({\n calendars,\n offset,\n maxDate,\n adapter\n}: {\n calendars: Calendar[],\n offset: number,\n maxDate?: Date,\n adapter: DateAdapter\n}): number {\n const lastDay = calendars[calendars.length - 1].firstDayOfMonth;\n const newDate = adapter.add(adapter.date(lastDay), offset, 'month');\n\n if (maxDate && adapter.isAfter(newDate, adapter.startOf(adapter.date(maxDate), 'month'))) {\n return adapter.diff(adapter.startOf(adapter.date(maxDate), 'month'), adapter.startOf(adapter.date(lastDay), 'month'), 'month');\n }\n return offset;\n}\n\nexport function getCalendars({\n date,\n selected,\n disabledDates,\n modifiers,\n monthsToDisplay,\n minDate,\n maxDate,\n offset,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate\n}: {\n date: Date,\n selected?: Date | Date[] | { start?: Date, end?: Date },\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n monthsToDisplay: number,\n minDate?: Date,\n maxDate?: Date,\n offset: number,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: SelectionMode,\n hoveredDate?: Date\n}): Calendar[] {\n const calendars: Calendar[] = [];\n const startDate = adapter.add(adapter.startOf(adapter.date(date), 'month'), offset, 'month');\n\n for (let i = 0; i < monthsToDisplay; i++) {\n const currentMonth = adapter.add(startDate, i, 'month');\n calendars.push(getMonthData({\n month: adapter.get(currentMonth, 'month'),\n year: adapter.get(currentMonth, 'year'),\n selectedDates: selected,\n disabledDates,\n modifiers,\n minDate,\n maxDate,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate\n }));\n }\n\n return calendars;\n}\n\nfunction getMonthData({\n month,\n year,\n selectedDates,\n disabledDates,\n modifiers,\n minDate,\n maxDate,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate\n}: {\n month: number,\n year: number,\n selectedDates?: Date | Date[] | { start?: Date, end?: Date },\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n minDate?: Date,\n maxDate?: Date,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: 'single' | 'range' | 'multiple',\n hoveredDate?: Date\n}): Calendar {\n let currentMonth = adapter.set(adapter.set(adapter.date(), 'year', year), 'month', month);\n month = adapter.get(currentMonth, 'month');\n year = adapter.get(currentMonth, 'year');\n\n const daysInMonth = adapter.getDaysInMonth(currentMonth);\n const dates: (DateObj | null)[] = [];\n\n for (let day = 1; day <= daysInMonth; day++) {\n const date = adapter.toDate(adapter.set(currentMonth, 'day', day));\n const dateObj = createDateObj(date, selectedDates, disabledDates, modifiers, minDate, maxDate, adapter, selectionMode, false, hoveredDate, month, year);\n dates.push(dateObj);\n }\n\n const firstDayOfMonth = adapter.toDate(adapter.startOf(currentMonth, 'month'));\n const lastDayOfMonth = adapter.toDate(adapter.endOf(currentMonth, 'month'));\n\n const frontWeekBuffer = fillFrontWeek({\n firstDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n });\n\n const backWeekBuffer = fillBackWeek({\n lastDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n });\n\n dates.unshift(...frontWeekBuffer);\n dates.push(...backWeekBuffer);\n\n const weeks = getWeeks(dates);\n\n return {\n firstDayOfMonth,\n lastDayOfMonth,\n month,\n year,\n weeks\n };\n}\n\nfunction createDateObj(\n date: Date,\n selectedDates: Date | Date[] | { start?: Date, end?: Date } | undefined,\n disabledDates: Date[] | undefined,\n modifiers: Record<string, (date: Date, month: number, year: number) => boolean> | undefined,\n minDate: Date | undefined,\n maxDate: Date | undefined,\n adapter: DateAdapter,\n selectionMode: 'single' | 'range' | 'multiple',\n isOutside = false,\n hoveredDate?: Date,\n month?: number,\n year?: number\n): DateObj {\n const { selected, isRangeStart, isRangeEnd, isRangeBetween, isRangeHovering, isRangeActive } = isSelected(selectedDates, date, adapter, selectionMode, hoveredDate);\n const isToday = adapter.isSame(adapter.date(date), adapter.date(), \"day\");\n const isPrevMonth = isOutside && adapter.isBefore(adapter.date(date), adapter.startOf(adapter.date(date), 'month'));\n const isNextMonth = isOutside && adapter.isAfter(adapter.date(date), adapter.endOf(adapter.date(date), 'month'));\n\n const defaultModifiers: Record<string, (d: Date, m: number, y: number) => boolean> = {\n 'text-brand-gold border border-brand-gold': (d: Date) =>\n adapter.isSame(adapter.date(d), adapter.date(), 'day'),\n 'text-gray-400 opacity-50': (d: Date, m: number) =>\n adapter.get(adapter.date(d), 'month') !== m\n };\n const mergedModifiers: Record<string, (d: Date, m: number, y: number) => boolean> = { ...defaultModifiers, ...modifiers };\n\n const activeModifiers = Object.keys(mergedModifiers).filter(key =>\n mergedModifiers[key](date, month ?? adapter.get(adapter.date(date), 'month'), year ?? adapter.get(adapter.date(date), 'year'))\n );\n\n if (isToday) activeModifiers.push('today');\n if (isOutside) activeModifiers.push('outside');\n if (isPrevMonth) activeModifiers.push('prev-month');\n if (isNextMonth) activeModifiers.push('next-month');\n\n return {\n date,\n selected,\n modifiers: activeModifiers,\n selectable: isSelectable(minDate, maxDate, disabledDates, date, adapter),\n today: isToday,\n prevMonth: isPrevMonth,\n nextMonth: isNextMonth,\n isRangeStart,\n isRangeEnd,\n isRangeBetween,\n isRangeHovering,\n isRangeActive\n };\n}\n\nfunction fillFrontWeek({\n firstDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n}: {\n firstDayOfMonth: Date,\n minDate?: Date,\n maxDate?: Date,\n selectedDates?: any,\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: any,\n hoveredDate?: Date,\n month: number,\n year: number\n}): (DateObj | null)[] {\n const dates: (DateObj | null)[] = [];\n let firstDay = (adapter.toDate(adapter.date(firstDayOfMonth)).getDay() + 7 - firstDayOfWeek) % 7;\n\n let current = adapter.subtract(adapter.date(firstDayOfMonth), 1, \"day\");\n for (let i = 0; i < firstDay; i++) {\n const date = adapter.toDate(current);\n const dateObj = createDateObj(date, selectedDates, disabledDates, modifiers, minDate, maxDate, adapter, selectionMode, true, hoveredDate, month, year);\n dateObj.prevMonth = true;\n if (!showOutsideDays) {\n dateObj.selectable = false;\n }\n dates.unshift(dateObj);\n current = adapter.subtract(current, 1, \"day\");\n }\n\n return dates;\n}\n\nfunction fillBackWeek({\n lastDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n}: {\n lastDayOfMonth: Date,\n minDate?: Date,\n maxDate?: Date,\n selectedDates?: any,\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: any,\n hoveredDate?: Date,\n month: number,\n year: number\n}): (DateObj | null)[] {\n const dates: (DateObj | null)[] = [];\n let lastDay = (adapter.toDate(adapter.date(lastDayOfMonth)).getDay() + 7 - firstDayOfWeek) % 7;\n\n let current = adapter.add(adapter.date(lastDayOfMonth), 1, \"day\");\n for (let i = 0; i < 6 - lastDay; i++) {\n const date = adapter.toDate(current);\n const dateObj = createDateObj(date, selectedDates, disabledDates, modifiers, minDate, maxDate, adapter, selectionMode, true, hoveredDate, month, year);\n dateObj.nextMonth = true;\n if (!showOutsideDays) {\n dateObj.selectable = false;\n }\n dates.push(dateObj);\n current = adapter.add(current, 1, \"day\");\n }\n\n return dates;\n}\n\nfunction getWeeks(dates: (DateObj | null)[]): (DateObj | null)[][] {\n const weeksLength = Math.ceil(dates.length / 7);\n const weeks: (DateObj | null)[][] = [];\n for (let i = 0; i < weeksLength; i++) {\n weeks[i] = [];\n for (let x = 0; x < 7; x++) {\n weeks[i].push(dates[i * 7 + x]);\n }\n }\n return weeks;\n}\n\nfunction isSelected(\n selectedDates: Date | Date[] | { start?: Date, end?: Date } | undefined,\n date: Date,\n adapter: DateAdapter,\n selectionMode: 'single' | 'range' | 'multiple',\n hoveredDate?: Date\n): { selected: boolean, isRangeStart?: boolean, isRangeEnd?: boolean, isRangeBetween?: boolean, isRangeHovering?: boolean, isRangeActive?: boolean } {\n if (!selectedDates && !hoveredDate) return { selected: false };\n\n const d = adapter.date(date);\n\n if (selectionMode === 'single' && selectedDates instanceof Date) {\n return { selected: adapter.isSame(d, adapter.date(selectedDates), 'day') };\n }\n\n if (selectionMode === 'multiple' && Array.isArray(selectedDates)) {\n return { selected: selectedDates.some(sd => adapter.isSame(d, adapter.date(sd), 'day')) };\n }\n\n if (selectionMode === 'range') {\n const range = (selectedDates && typeof selectedDates === 'object' && !(selectedDates instanceof Date) && !Array.isArray(selectedDates)) ? (selectedDates as { start?: Date, end?: Date }) : { start: undefined, end: undefined };\n const { start, end } = range;\n\n let isStart = start ? adapter.isSame(d, adapter.date(start), 'day') : false;\n let isEnd = end ? adapter.isSame(d, adapter.date(end), 'day') : false;\n const isBetween = (start && end) ? (adapter.isAfter(d, adapter.date(start), 'day') && adapter.isBefore(d, adapter.date(end), 'day')) : false;\n\n let isHovering = false;\n if (start && !end && hoveredDate) {\n const h = adapter.date(hoveredDate);\n const s = adapter.date(start);\n if (adapter.isAfter(h, s, 'day')) {\n isHovering = (adapter.isAfter(d, s, 'day') && adapter.isBefore(d, h, 'day')) || adapter.isSame(d, h, 'day');\n if (adapter.isSame(d, h, 'day')) isEnd = true;\n } else if (adapter.isBefore(h, s, 'day')) {\n isHovering = (adapter.isAfter(d, h, 'day') && adapter.isBefore(d, s, 'day')) || adapter.isSame(d, h, 'day');\n if (adapter.isSame(d, h, 'day')) {\n isStart = true;\n }\n if (adapter.isSame(d, s, 'day')) {\n isStart = false;\n isEnd = true;\n }\n }\n }\n\n const isRangeActive = !!(\n (start && end && !adapter.isSame(adapter.date(start), adapter.date(end), 'day')) ||\n (start && !end && hoveredDate && !adapter.isSame(adapter.date(start), adapter.date(hoveredDate), 'day'))\n );\n\n return {\n selected: isStart || isEnd || isBetween,\n isRangeStart: isStart,\n isRangeEnd: isEnd,\n isRangeBetween: isBetween,\n isRangeHovering: isHovering,\n isRangeActive\n };\n }\n\n if (Array.isArray(selectedDates) && selectedDates.length === 1 && selectionMode === 'single') {\n return { selected: adapter.isSame(d, adapter.date(selectedDates[0]), 'day') };\n }\n\n return { selected: false };\n}\n\nfunction isSelectable(minDate: Date | undefined, maxDate: Date | undefined, disabledDates: Date[] | undefined, date: Date, adapter: DateAdapter): boolean {\n const d = adapter.date(date);\n const isMinDateInvalid = minDate && adapter.isBefore(d, adapter.date(minDate), 'day');\n const isMaxDateInvalid = maxDate && adapter.isAfter(d, adapter.date(maxDate), 'day');\n const isDisabled = disabledDates?.some(disabledDate => adapter.isSame(d, adapter.date(disabledDate), 'day'));\n return !isMinDateInvalid && !isMaxDateInvalid && !isDisabled;\n}\n\nexport function isBackDisabled({\n calendars,\n minDate,\n adapter\n}: {\n calendars: Calendar[],\n minDate?: Date,\n adapter: DateAdapter\n}): boolean {\n if (!minDate) {\n return false;\n }\n const firstDay = calendars[0].firstDayOfMonth;\n return adapter.isSame(adapter.startOf(adapter.date(firstDay), 'month'), adapter.startOf(adapter.date(minDate), 'month'), 'month') || adapter.isBefore(adapter.date(firstDay), adapter.date(minDate), 'month');\n}\n\nexport function isForwardDisabled({\n calendars,\n maxDate,\n adapter\n}: {\n calendars: Calendar[],\n maxDate?: Date,\n adapter: DateAdapter\n}): boolean {\n if (!maxDate) {\n return false;\n }\n const lastDay = calendars[calendars.length - 1].firstDayOfMonth;\n return adapter.isSame(adapter.startOf(adapter.date(lastDay), 'month'), adapter.startOf(adapter.date(maxDate), 'month'), 'month') || adapter.isAfter(adapter.date(lastDay), adapter.date(maxDate), 'month');\n}\n"],"mappings":"mEAEA,SAAgB,EAAqB,GAAG,EAAY,CAChD,OAAQ,EAAY,GAAG,IACnB,EAAI,KAAK,IACD,GACA,EAAG,EAAO,GAAG,CAAI,EAEd,GAAS,EAAM,iBACzB,CACT,CAGA,SAAgB,EAAc,CAC1B,YACA,SACA,UACA,WAMO,CACP,IAAM,EAAW,EAAU,EAAE,CAAC,gBACxB,EAAU,EAAQ,SAAS,EAAQ,KAAK,CAAQ,EAAG,EAAQ,OAAO,EAKxE,OAHI,GAAW,EAAQ,SAAS,EAAS,EAAQ,QAAQ,EAAQ,KAAK,CAAO,EAAG,OAAO,CAAC,EAC7E,EAAQ,KAAK,EAAQ,QAAQ,EAAQ,KAAK,CAAQ,EAAG,OAAO,EAAG,EAAQ,QAAQ,EAAQ,KAAK,CAAO,EAAG,OAAO,EAAG,OAAO,EAE3H,CACX,CAEA,SAAgB,EAAS,CACrB,YACA,SACA,UACA,WAMO,CACP,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AO,EAAG,OAAO,GAAK,EAAQ,QAAQ,EAAQ,KAAK,CAAO,EAAG,EAAQ,KAAK,CAAO,EAAG,OAAO,CAC7M"}
1
+ {"version":3,"file":"utils.cjs","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { Calendar, DateAdapter, DateObj, SelectionMode } from './types';\n\nexport function composeEventHandlers(...fns: any[]) {\n return (event: any, ...args: any[]) =>\n fns.some(fn => {\n if (fn) {\n fn(event, ...args);\n }\n return event && event.defaultPrevented;\n });\n}\n\n\nexport function subtractMonth({\n calendars,\n offset,\n minDate,\n adapter\n}: {\n calendars: Calendar[],\n offset: number,\n minDate?: Date,\n adapter: DateAdapter\n}): number {\n const firstDay = calendars[0].firstDayOfMonth;\n const newDate = adapter.subtract(adapter.date(firstDay), offset, 'month');\n\n if (minDate && adapter.isBefore(newDate, adapter.startOf(adapter.date(minDate), 'month'))) {\n return adapter.diff(adapter.startOf(adapter.date(firstDay), 'month'), adapter.startOf(adapter.date(minDate), 'month'), 'month');\n }\n return offset;\n}\n\nexport function addMonth({\n calendars,\n offset,\n maxDate,\n adapter\n}: {\n calendars: Calendar[],\n offset: number,\n maxDate?: Date,\n adapter: DateAdapter\n}): number {\n const lastDay = calendars[calendars.length - 1].firstDayOfMonth;\n const newDate = adapter.add(adapter.date(lastDay), offset, 'month');\n\n if (maxDate && adapter.isAfter(newDate, adapter.startOf(adapter.date(maxDate), 'month'))) {\n return adapter.diff(adapter.startOf(adapter.date(maxDate), 'month'), adapter.startOf(adapter.date(lastDay), 'month'), 'month');\n }\n return offset;\n}\n\nexport function getCalendars({\n date,\n selected,\n disabledDates,\n modifiers,\n monthsToDisplay,\n minDate,\n maxDate,\n offset,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate\n}: {\n date: Date,\n selected?: Date | Date[] | { start?: Date, end?: Date },\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n monthsToDisplay: number,\n minDate?: Date,\n maxDate?: Date,\n offset: number,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: SelectionMode,\n hoveredDate?: Date\n}): Calendar[] {\n const calendars: Calendar[] = [];\n const startDate = adapter.add(adapter.startOf(adapter.date(date), 'month'), offset, 'month');\n\n for (let i = 0; i < monthsToDisplay; i++) {\n const currentMonth = adapter.add(startDate, i, 'month');\n calendars.push(getMonthData({\n month: adapter.get(currentMonth, 'month'),\n year: adapter.get(currentMonth, 'year'),\n selectedDates: selected,\n disabledDates,\n modifiers,\n minDate,\n maxDate,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate\n }));\n }\n\n return calendars;\n}\n\nfunction getMonthData({\n month,\n year,\n selectedDates,\n disabledDates,\n modifiers,\n minDate,\n maxDate,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate\n}: {\n month: number,\n year: number,\n selectedDates?: Date | Date[] | { start?: Date, end?: Date },\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n minDate?: Date,\n maxDate?: Date,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: 'single' | 'range' | 'multiple',\n hoveredDate?: Date\n}): Calendar {\n let currentMonth = adapter.set(adapter.set(adapter.date(), 'year', year), 'month', month);\n month = adapter.get(currentMonth, 'month');\n year = adapter.get(currentMonth, 'year');\n\n const daysInMonth = adapter.getDaysInMonth(currentMonth);\n const dates: (DateObj | null)[] = [];\n\n for (let day = 1; day <= daysInMonth; day++) {\n const date = adapter.toDate(adapter.set(currentMonth, 'day', day));\n const dateObj = createDateObj(date, selectedDates, disabledDates, modifiers, minDate, maxDate, adapter, selectionMode, false, hoveredDate, month, year);\n dates.push(dateObj);\n }\n\n const firstDayOfMonth = adapter.toDate(adapter.startOf(currentMonth, 'month'));\n const lastDayOfMonth = adapter.toDate(adapter.endOf(currentMonth, 'month'));\n\n const frontWeekBuffer = fillFrontWeek({\n firstDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n });\n\n const backWeekBuffer = fillBackWeek({\n lastDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n });\n\n dates.unshift(...frontWeekBuffer);\n dates.push(...backWeekBuffer);\n\n const weeks = getWeeks(dates);\n\n return {\n firstDayOfMonth,\n lastDayOfMonth,\n month,\n year,\n weeks\n };\n}\n\nfunction createDateObj(\n date: Date,\n selectedDates: Date | Date[] | { start?: Date, end?: Date } | undefined,\n disabledDates: Date[] | undefined,\n modifiers: Record<string, (date: Date, month: number, year: number) => boolean> | undefined,\n minDate: Date | undefined,\n maxDate: Date | undefined,\n adapter: DateAdapter,\n selectionMode: 'single' | 'range' | 'multiple',\n isOutside = false,\n hoveredDate?: Date,\n month?: number,\n year?: number\n): DateObj {\n const { selected, isRangeStart, isRangeEnd, isRangeBetween, isRangeHovering, isRangeActive } = isSelected(selectedDates, date, adapter, selectionMode, hoveredDate);\n const isToday = adapter.isSame(adapter.date(date), adapter.date(), \"day\");\n const isPrevMonth = isOutside && adapter.isBefore(adapter.date(date), adapter.startOf(adapter.date(date), 'month'));\n const isNextMonth = isOutside && adapter.isAfter(adapter.date(date), adapter.endOf(adapter.date(date), 'month'));\n\n const defaultModifiers: Record<string, (d: Date, m: number, y: number) => boolean> = {\n 'text-brand-gold border border-brand-gold': (d: Date) =>\n adapter.isSame(adapter.date(d), adapter.date(), 'day'),\n 'text-white cursor-default!': (d: Date, m: number) =>\n adapter.get(adapter.date(d), 'month') !== m\n };\n const mergedModifiers: Record<string, (d: Date, m: number, y: number) => boolean> = { ...defaultModifiers, ...modifiers };\n\n const activeModifiers = Object.keys(mergedModifiers).filter(key =>\n mergedModifiers[key](date, month ?? adapter.get(adapter.date(date), 'month'), year ?? adapter.get(adapter.date(date), 'year'))\n );\n\n if (isToday) activeModifiers.push('today');\n if (isOutside) activeModifiers.push('outside');\n if (isPrevMonth) activeModifiers.push('prev-month');\n if (isNextMonth) activeModifiers.push('next-month');\n\n return {\n date,\n selected,\n modifiers: activeModifiers,\n selectable: isSelectable(minDate, maxDate, disabledDates, date, adapter),\n today: isToday,\n prevMonth: isPrevMonth,\n nextMonth: isNextMonth,\n isRangeStart,\n isRangeEnd,\n isRangeBetween,\n isRangeHovering,\n isRangeActive\n };\n}\n\nfunction fillFrontWeek({\n firstDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n}: {\n firstDayOfMonth: Date,\n minDate?: Date,\n maxDate?: Date,\n selectedDates?: any,\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: any,\n hoveredDate?: Date,\n month: number,\n year: number\n}): (DateObj | null)[] {\n const dates: (DateObj | null)[] = [];\n let firstDay = (adapter.toDate(adapter.date(firstDayOfMonth)).getDay() + 7 - firstDayOfWeek) % 7;\n\n let current = adapter.subtract(adapter.date(firstDayOfMonth), 1, \"day\");\n for (let i = 0; i < firstDay; i++) {\n const date = adapter.toDate(current);\n const dateObj = createDateObj(date, selectedDates, disabledDates, modifiers, minDate, maxDate, adapter, selectionMode, true, hoveredDate, month, year);\n dateObj.prevMonth = true;\n if (!showOutsideDays) {\n dateObj.selectable = false;\n }\n dates.unshift(dateObj);\n current = adapter.subtract(current, 1, \"day\");\n }\n\n return dates;\n}\n\nfunction fillBackWeek({\n lastDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n}: {\n lastDayOfMonth: Date,\n minDate?: Date,\n maxDate?: Date,\n selectedDates?: any,\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: any,\n hoveredDate?: Date,\n month: number,\n year: number\n}): (DateObj | null)[] {\n const dates: (DateObj | null)[] = [];\n let lastDay = (adapter.toDate(adapter.date(lastDayOfMonth)).getDay() + 7 - firstDayOfWeek) % 7;\n\n let current = adapter.add(adapter.date(lastDayOfMonth), 1, \"day\");\n for (let i = 0; i < 6 - lastDay; i++) {\n const date = adapter.toDate(current);\n const dateObj = createDateObj(date, selectedDates, disabledDates, modifiers, minDate, maxDate, adapter, selectionMode, true, hoveredDate, month, year);\n dateObj.nextMonth = true;\n if (!showOutsideDays) {\n dateObj.selectable = false;\n }\n dates.push(dateObj);\n current = adapter.add(current, 1, \"day\");\n }\n\n return dates;\n}\n\nfunction getWeeks(dates: (DateObj | null)[]): (DateObj | null)[][] {\n const weeksLength = Math.ceil(dates.length / 7);\n const weeks: (DateObj | null)[][] = [];\n for (let i = 0; i < weeksLength; i++) {\n weeks[i] = [];\n for (let x = 0; x < 7; x++) {\n weeks[i].push(dates[i * 7 + x]);\n }\n }\n return weeks;\n}\n\nfunction isSelected(\n selectedDates: Date | Date[] | { start?: Date, end?: Date } | undefined,\n date: Date,\n adapter: DateAdapter,\n selectionMode: 'single' | 'range' | 'multiple',\n hoveredDate?: Date\n): { selected: boolean, isRangeStart?: boolean, isRangeEnd?: boolean, isRangeBetween?: boolean, isRangeHovering?: boolean, isRangeActive?: boolean } {\n if (!selectedDates && !hoveredDate) return { selected: false };\n\n const d = adapter.date(date);\n\n if (selectionMode === 'single' && selectedDates instanceof Date) {\n return { selected: adapter.isSame(d, adapter.date(selectedDates), 'day') };\n }\n\n if (selectionMode === 'multiple' && Array.isArray(selectedDates)) {\n return { selected: selectedDates.some(sd => adapter.isSame(d, adapter.date(sd), 'day')) };\n }\n\n if (selectionMode === 'range') {\n const range = (selectedDates && typeof selectedDates === 'object' && !(selectedDates instanceof Date) && !Array.isArray(selectedDates)) ? (selectedDates as { start?: Date, end?: Date }) : { start: undefined, end: undefined };\n const { start, end } = range;\n\n let isStart = start ? adapter.isSame(d, adapter.date(start), 'day') : false;\n let isEnd = end ? adapter.isSame(d, adapter.date(end), 'day') : false;\n const isBetween = (start && end) ? (adapter.isAfter(d, adapter.date(start), 'day') && adapter.isBefore(d, adapter.date(end), 'day')) : false;\n\n let isHovering = false;\n if (start && !end && hoveredDate) {\n const h = adapter.date(hoveredDate);\n const s = adapter.date(start);\n if (adapter.isAfter(h, s, 'day')) {\n isHovering = (adapter.isAfter(d, s, 'day') && adapter.isBefore(d, h, 'day')) || adapter.isSame(d, h, 'day');\n if (adapter.isSame(d, h, 'day')) isEnd = true;\n } else if (adapter.isBefore(h, s, 'day')) {\n isHovering = (adapter.isAfter(d, h, 'day') && adapter.isBefore(d, s, 'day')) || adapter.isSame(d, h, 'day');\n if (adapter.isSame(d, h, 'day')) {\n isStart = true;\n }\n if (adapter.isSame(d, s, 'day')) {\n isStart = false;\n isEnd = true;\n }\n }\n }\n\n const isRangeActive = !!(\n (start && end && !adapter.isSame(adapter.date(start), adapter.date(end), 'day')) ||\n (start && !end && hoveredDate && !adapter.isSame(adapter.date(start), adapter.date(hoveredDate), 'day'))\n );\n\n return {\n selected: isStart || isEnd || isBetween,\n isRangeStart: isStart,\n isRangeEnd: isEnd,\n isRangeBetween: isBetween,\n isRangeHovering: isHovering,\n isRangeActive\n };\n }\n\n if (Array.isArray(selectedDates) && selectedDates.length === 1 && selectionMode === 'single') {\n return { selected: adapter.isSame(d, adapter.date(selectedDates[0]), 'day') };\n }\n\n return { selected: false };\n}\n\nfunction isSelectable(minDate: Date | undefined, maxDate: Date | undefined, disabledDates: Date[] | undefined, date: Date, adapter: DateAdapter): boolean {\n const d = adapter.date(date);\n const isMinDateInvalid = minDate && adapter.isBefore(d, adapter.date(minDate), 'day');\n const isMaxDateInvalid = maxDate && adapter.isAfter(d, adapter.date(maxDate), 'day');\n const isDisabled = disabledDates?.some(disabledDate => adapter.isSame(d, adapter.date(disabledDate), 'day'));\n return !isMinDateInvalid && !isMaxDateInvalid && !isDisabled;\n}\n\nexport function isBackDisabled({\n calendars,\n minDate,\n adapter\n}: {\n calendars: Calendar[],\n minDate?: Date,\n adapter: DateAdapter\n}): boolean {\n if (!minDate) {\n return false;\n }\n const firstDay = calendars[0].firstDayOfMonth;\n return adapter.isSame(adapter.startOf(adapter.date(firstDay), 'month'), adapter.startOf(adapter.date(minDate), 'month'), 'month') || adapter.isBefore(adapter.date(firstDay), adapter.date(minDate), 'month');\n}\n\nexport function isForwardDisabled({\n calendars,\n maxDate,\n adapter\n}: {\n calendars: Calendar[],\n maxDate?: Date,\n adapter: DateAdapter\n}): boolean {\n if (!maxDate) {\n return false;\n }\n const lastDay = calendars[calendars.length - 1].firstDayOfMonth;\n return adapter.isSame(adapter.startOf(adapter.date(lastDay), 'month'), adapter.startOf(adapter.date(maxDate), 'month'), 'month') || adapter.isAfter(adapter.date(lastDay), adapter.date(maxDate), 'month');\n}\n"],"mappings":"mEAEA,SAAgB,EAAqB,GAAG,EAAY,CAChD,OAAQ,EAAY,GAAG,IACnB,EAAI,KAAK,IACD,GACA,EAAG,EAAO,GAAG,CAAI,EAEd,GAAS,EAAM,iBACzB,CACT,CAGA,SAAgB,EAAc,CAC1B,YACA,SACA,UACA,WAMO,CACP,IAAM,EAAW,EAAU,EAAE,CAAC,gBACxB,EAAU,EAAQ,SAAS,EAAQ,KAAK,CAAQ,EAAG,EAAQ,OAAO,EAKxE,OAHI,GAAW,EAAQ,SAAS,EAAS,EAAQ,QAAQ,EAAQ,KAAK,CAAO,EAAG,OAAO,CAAC,EAC7E,EAAQ,KAAK,EAAQ,QAAQ,EAAQ,KAAK,CAAQ,EAAG,OAAO,EAAG,EAAQ,QAAQ,EAAQ,KAAK,CAAO,EAAG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EAAQ,KAAK,CAAO,EAAG,OAAO,EAAG,EAAQ,QAAQ,EAAQ,KAAK,CAAO,EAAG,OAAO,EAAG,OAAO,GAAK,EAAQ,QAAQ,EAAQ,KAAK,CAAO,EAAG,EAAQ,KAAK,CAAO,EAAG,OAAO,CAC7M"}
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DateAdapter, SelectionMode, Calendar } from './types';
1
+ import { Calendar, DateAdapter, SelectionMode } from './types';
2
2
  export declare function composeEventHandlers(...fns: any[]): (event: any, ...args: any[]) => boolean;
3
3
  export declare function subtractMonth({ calendars, offset, minDate, adapter }: {
4
4
  calendars: Calendar[];
package/dist/utils.js CHANGED
@@ -81,7 +81,7 @@ function i({ month: e, year: t, selectedDates: n, disabledDates: r, modifiers: i
81
81
  function a(e, t, n, r, i, a, o, s, c = !1, d, f, p) {
82
82
  let { selected: m, isRangeStart: h, isRangeEnd: g, isRangeBetween: _, isRangeHovering: v, isRangeActive: y } = l(t, e, o, s, d), b = o.isSame(o.date(e), o.date(), "day"), x = c && o.isBefore(o.date(e), o.startOf(o.date(e), "month")), S = c && o.isAfter(o.date(e), o.endOf(o.date(e), "month")), C = {
83
83
  "text-brand-gold border border-brand-gold": (e) => o.isSame(o.date(e), o.date(), "day"),
84
- "text-gray-400 opacity-50": (e, t) => o.get(o.date(e), "month") !== t,
84
+ "text-white cursor-default!": (e, t) => o.get(o.date(e), "month") !== t,
85
85
  ...r
86
86
  }, w = Object.keys(C).filter((t) => C[t](e, f ?? o.get(o.date(e), "month"), p ?? o.get(o.date(e), "year")));
87
87
  return b && w.push("today"), c && w.push("outside"), x && w.push("prev-month"), S && w.push("next-month"), {
package/dist/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import type { DateAdapter, DateObj, SelectionMode, Calendar } from './types';\n\nexport function composeEventHandlers(...fns: any[]) {\n return (event: any, ...args: any[]) =>\n fns.some(fn => {\n if (fn) {\n fn(event, ...args);\n }\n return event && event.defaultPrevented;\n });\n}\n\n\nexport function subtractMonth({\n calendars,\n offset,\n minDate,\n adapter\n}: {\n calendars: Calendar[],\n offset: number,\n minDate?: Date,\n adapter: DateAdapter\n}): number {\n const firstDay = calendars[0].firstDayOfMonth;\n const newDate = adapter.subtract(adapter.date(firstDay), offset, 'month');\n\n if (minDate && adapter.isBefore(newDate, adapter.startOf(adapter.date(minDate), 'month'))) {\n return adapter.diff(adapter.startOf(adapter.date(firstDay), 'month'), adapter.startOf(adapter.date(minDate), 'month'), 'month');\n }\n return offset;\n}\n\nexport function addMonth({\n calendars,\n offset,\n maxDate,\n adapter\n}: {\n calendars: Calendar[],\n offset: number,\n maxDate?: Date,\n adapter: DateAdapter\n}): number {\n const lastDay = calendars[calendars.length - 1].firstDayOfMonth;\n const newDate = adapter.add(adapter.date(lastDay), offset, 'month');\n\n if (maxDate && adapter.isAfter(newDate, adapter.startOf(adapter.date(maxDate), 'month'))) {\n return adapter.diff(adapter.startOf(adapter.date(maxDate), 'month'), adapter.startOf(adapter.date(lastDay), 'month'), 'month');\n }\n return offset;\n}\n\nexport function getCalendars({\n date,\n selected,\n disabledDates,\n modifiers,\n monthsToDisplay,\n minDate,\n maxDate,\n offset,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate\n}: {\n date: Date,\n selected?: Date | Date[] | { start?: Date, end?: Date },\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n monthsToDisplay: number,\n minDate?: Date,\n maxDate?: Date,\n offset: number,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: SelectionMode,\n hoveredDate?: Date\n}): Calendar[] {\n const calendars: Calendar[] = [];\n const startDate = adapter.add(adapter.startOf(adapter.date(date), 'month'), offset, 'month');\n\n for (let i = 0; i < monthsToDisplay; i++) {\n const currentMonth = adapter.add(startDate, i, 'month');\n calendars.push(getMonthData({\n month: adapter.get(currentMonth, 'month'),\n year: adapter.get(currentMonth, 'year'),\n selectedDates: selected,\n disabledDates,\n modifiers,\n minDate,\n maxDate,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate\n }));\n }\n\n return calendars;\n}\n\nfunction getMonthData({\n month,\n year,\n selectedDates,\n disabledDates,\n modifiers,\n minDate,\n maxDate,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate\n}: {\n month: number,\n year: number,\n selectedDates?: Date | Date[] | { start?: Date, end?: Date },\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n minDate?: Date,\n maxDate?: Date,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: 'single' | 'range' | 'multiple',\n hoveredDate?: Date\n}): Calendar {\n let currentMonth = adapter.set(adapter.set(adapter.date(), 'year', year), 'month', month);\n month = adapter.get(currentMonth, 'month');\n year = adapter.get(currentMonth, 'year');\n\n const daysInMonth = adapter.getDaysInMonth(currentMonth);\n const dates: (DateObj | null)[] = [];\n\n for (let day = 1; day <= daysInMonth; day++) {\n const date = adapter.toDate(adapter.set(currentMonth, 'day', day));\n const dateObj = createDateObj(date, selectedDates, disabledDates, modifiers, minDate, maxDate, adapter, selectionMode, false, hoveredDate, month, year);\n dates.push(dateObj);\n }\n\n const firstDayOfMonth = adapter.toDate(adapter.startOf(currentMonth, 'month'));\n const lastDayOfMonth = adapter.toDate(adapter.endOf(currentMonth, 'month'));\n\n const frontWeekBuffer = fillFrontWeek({\n firstDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n });\n\n const backWeekBuffer = fillBackWeek({\n lastDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n });\n\n dates.unshift(...frontWeekBuffer);\n dates.push(...backWeekBuffer);\n\n const weeks = getWeeks(dates);\n\n return {\n firstDayOfMonth,\n lastDayOfMonth,\n month,\n year,\n weeks\n };\n}\n\nfunction createDateObj(\n date: Date,\n selectedDates: Date | Date[] | { start?: Date, end?: Date } | undefined,\n disabledDates: Date[] | undefined,\n modifiers: Record<string, (date: Date, month: number, year: number) => boolean> | undefined,\n minDate: Date | undefined,\n maxDate: Date | undefined,\n adapter: DateAdapter,\n selectionMode: 'single' | 'range' | 'multiple',\n isOutside = false,\n hoveredDate?: Date,\n month?: number,\n year?: number\n): DateObj {\n const { selected, isRangeStart, isRangeEnd, isRangeBetween, isRangeHovering, isRangeActive } = isSelected(selectedDates, date, adapter, selectionMode, hoveredDate);\n const isToday = adapter.isSame(adapter.date(date), adapter.date(), \"day\");\n const isPrevMonth = isOutside && adapter.isBefore(adapter.date(date), adapter.startOf(adapter.date(date), 'month'));\n const isNextMonth = isOutside && adapter.isAfter(adapter.date(date), adapter.endOf(adapter.date(date), 'month'));\n\n const defaultModifiers: Record<string, (d: Date, m: number, y: number) => boolean> = {\n 'text-brand-gold border border-brand-gold': (d: Date) =>\n adapter.isSame(adapter.date(d), adapter.date(), 'day'),\n 'text-gray-400 opacity-50': (d: Date, m: number) =>\n adapter.get(adapter.date(d), 'month') !== m\n };\n const mergedModifiers: Record<string, (d: Date, m: number, y: number) => boolean> = { ...defaultModifiers, ...modifiers };\n\n const activeModifiers = Object.keys(mergedModifiers).filter(key =>\n mergedModifiers[key](date, month ?? adapter.get(adapter.date(date), 'month'), year ?? adapter.get(adapter.date(date), 'year'))\n );\n\n if (isToday) activeModifiers.push('today');\n if (isOutside) activeModifiers.push('outside');\n if (isPrevMonth) activeModifiers.push('prev-month');\n if (isNextMonth) activeModifiers.push('next-month');\n\n return {\n date,\n selected,\n modifiers: activeModifiers,\n selectable: isSelectable(minDate, maxDate, disabledDates, date, adapter),\n today: isToday,\n prevMonth: isPrevMonth,\n nextMonth: isNextMonth,\n isRangeStart,\n isRangeEnd,\n isRangeBetween,\n isRangeHovering,\n isRangeActive\n };\n}\n\nfunction fillFrontWeek({\n firstDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n}: {\n firstDayOfMonth: Date,\n minDate?: Date,\n maxDate?: Date,\n selectedDates?: any,\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: any,\n hoveredDate?: Date,\n month: number,\n year: number\n}): (DateObj | null)[] {\n const dates: (DateObj | null)[] = [];\n let firstDay = (adapter.toDate(adapter.date(firstDayOfMonth)).getDay() + 7 - firstDayOfWeek) % 7;\n\n let current = adapter.subtract(adapter.date(firstDayOfMonth), 1, \"day\");\n for (let i = 0; i < firstDay; i++) {\n const date = adapter.toDate(current);\n const dateObj = createDateObj(date, selectedDates, disabledDates, modifiers, minDate, maxDate, adapter, selectionMode, true, hoveredDate, month, year);\n dateObj.prevMonth = true;\n if (!showOutsideDays) {\n dateObj.selectable = false;\n }\n dates.unshift(dateObj);\n current = adapter.subtract(current, 1, \"day\");\n }\n\n return dates;\n}\n\nfunction fillBackWeek({\n lastDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n}: {\n lastDayOfMonth: Date,\n minDate?: Date,\n maxDate?: Date,\n selectedDates?: any,\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: any,\n hoveredDate?: Date,\n month: number,\n year: number\n}): (DateObj | null)[] {\n const dates: (DateObj | null)[] = [];\n let lastDay = (adapter.toDate(adapter.date(lastDayOfMonth)).getDay() + 7 - firstDayOfWeek) % 7;\n\n let current = adapter.add(adapter.date(lastDayOfMonth), 1, \"day\");\n for (let i = 0; i < 6 - lastDay; i++) {\n const date = adapter.toDate(current);\n const dateObj = createDateObj(date, selectedDates, disabledDates, modifiers, minDate, maxDate, adapter, selectionMode, true, hoveredDate, month, year);\n dateObj.nextMonth = true;\n if (!showOutsideDays) {\n dateObj.selectable = false;\n }\n dates.push(dateObj);\n current = adapter.add(current, 1, \"day\");\n }\n\n return dates;\n}\n\nfunction getWeeks(dates: (DateObj | null)[]): (DateObj | null)[][] {\n const weeksLength = Math.ceil(dates.length / 7);\n const weeks: (DateObj | null)[][] = [];\n for (let i = 0; i < weeksLength; i++) {\n weeks[i] = [];\n for (let x = 0; x < 7; x++) {\n weeks[i].push(dates[i * 7 + x]);\n }\n }\n return weeks;\n}\n\nfunction isSelected(\n selectedDates: Date | Date[] | { start?: Date, end?: Date } | undefined,\n date: Date,\n adapter: DateAdapter,\n selectionMode: 'single' | 'range' | 'multiple',\n hoveredDate?: Date\n): { selected: boolean, isRangeStart?: boolean, isRangeEnd?: boolean, isRangeBetween?: boolean, isRangeHovering?: boolean, isRangeActive?: boolean } {\n if (!selectedDates && !hoveredDate) return { selected: false };\n\n const d = adapter.date(date);\n\n if (selectionMode === 'single' && selectedDates instanceof Date) {\n return { selected: adapter.isSame(d, adapter.date(selectedDates), 'day') };\n }\n\n if (selectionMode === 'multiple' && Array.isArray(selectedDates)) {\n return { selected: selectedDates.some(sd => adapter.isSame(d, adapter.date(sd), 'day')) };\n }\n\n if (selectionMode === 'range') {\n const range = (selectedDates && typeof selectedDates === 'object' && !(selectedDates instanceof Date) && !Array.isArray(selectedDates)) ? (selectedDates as { start?: Date, end?: Date }) : { start: undefined, end: undefined };\n const { start, end } = range;\n\n let isStart = start ? adapter.isSame(d, adapter.date(start), 'day') : false;\n let isEnd = end ? adapter.isSame(d, adapter.date(end), 'day') : false;\n const isBetween = (start && end) ? (adapter.isAfter(d, adapter.date(start), 'day') && adapter.isBefore(d, adapter.date(end), 'day')) : false;\n\n let isHovering = false;\n if (start && !end && hoveredDate) {\n const h = adapter.date(hoveredDate);\n const s = adapter.date(start);\n if (adapter.isAfter(h, s, 'day')) {\n isHovering = (adapter.isAfter(d, s, 'day') && adapter.isBefore(d, h, 'day')) || adapter.isSame(d, h, 'day');\n if (adapter.isSame(d, h, 'day')) isEnd = true;\n } else if (adapter.isBefore(h, s, 'day')) {\n isHovering = (adapter.isAfter(d, h, 'day') && adapter.isBefore(d, s, 'day')) || adapter.isSame(d, h, 'day');\n if (adapter.isSame(d, h, 'day')) {\n isStart = true;\n }\n if (adapter.isSame(d, s, 'day')) {\n isStart = false;\n isEnd = true;\n }\n }\n }\n\n const isRangeActive = !!(\n (start && end && !adapter.isSame(adapter.date(start), adapter.date(end), 'day')) ||\n (start && !end && hoveredDate && !adapter.isSame(adapter.date(start), adapter.date(hoveredDate), 'day'))\n );\n\n return {\n selected: isStart || isEnd || isBetween,\n isRangeStart: isStart,\n isRangeEnd: isEnd,\n isRangeBetween: isBetween,\n isRangeHovering: isHovering,\n isRangeActive\n };\n }\n\n if (Array.isArray(selectedDates) && selectedDates.length === 1 && selectionMode === 'single') {\n return { selected: adapter.isSame(d, adapter.date(selectedDates[0]), 'day') };\n }\n\n return { selected: false };\n}\n\nfunction isSelectable(minDate: Date | undefined, maxDate: Date | undefined, disabledDates: Date[] | undefined, date: Date, adapter: DateAdapter): boolean {\n const d = adapter.date(date);\n const isMinDateInvalid = minDate && adapter.isBefore(d, adapter.date(minDate), 'day');\n const isMaxDateInvalid = maxDate && adapter.isAfter(d, adapter.date(maxDate), 'day');\n const isDisabled = disabledDates?.some(disabledDate => adapter.isSame(d, adapter.date(disabledDate), 'day'));\n return !isMinDateInvalid && !isMaxDateInvalid && !isDisabled;\n}\n\nexport function isBackDisabled({\n calendars,\n minDate,\n adapter\n}: {\n calendars: Calendar[],\n minDate?: Date,\n adapter: DateAdapter\n}): boolean {\n if (!minDate) {\n return false;\n }\n const firstDay = calendars[0].firstDayOfMonth;\n return adapter.isSame(adapter.startOf(adapter.date(firstDay), 'month'), adapter.startOf(adapter.date(minDate), 'month'), 'month') || adapter.isBefore(adapter.date(firstDay), adapter.date(minDate), 'month');\n}\n\nexport function isForwardDisabled({\n calendars,\n maxDate,\n adapter\n}: {\n calendars: Calendar[],\n maxDate?: Date,\n adapter: DateAdapter\n}): boolean {\n if (!maxDate) {\n return false;\n }\n const lastDay = calendars[calendars.length - 1].firstDayOfMonth;\n return adapter.isSame(adapter.startOf(adapter.date(lastDay), 'month'), adapter.startOf(adapter.date(maxDate), 'month'), 'month') || adapter.isAfter(adapter.date(lastDay), adapter.date(maxDate), 'month');\n}\n"],"mappings":";AAEA,SAAgB,EAAqB,GAAG,GAAY;CAChD,QAAQ,GAAY,GAAG,MACnB,EAAI,MAAK,OACD,KACA,EAAG,GAAO,GAAG,CAAI,GAEd,KAAS,EAAM,iBACzB;AACT;AAGA,SAAgB,EAAc,EAC1B,cACA,WACA,YACA,cAMO;CACP,IAAM,IAAW,EAAU,EAAE,CAAC,iBACxB,IAAU,EAAQ,SAAS,EAAQ,KAAK,CAAQ,GAAG,GAAQ,OAAO;CAKxE,OAHI,KAAW,EAAQ,SAAS,GAAS,EAAQ,QAAQ,EAAQ,KAAK,CAAO,GAAG,OAAO,CAAC,IAC7E,EAAQ,KAAK,EAAQ,QAAQ,EAAQ,KAAK,CAAQ,GAAG,OAAO,GAAG,EAAQ,QAAQ,EAAQ,KAAK,CAAO,GAAG,OAAO,GAAG,OAAO,IAE3H;AACX;AAEA,SAAgB,EAAS,EACrB,cACA,WACA,YACA,cAMO;CACP,IAAM,IAAU,EAAU,EAAU,SAAS,EAAE,CAAC,iBAC1C,IAAU,EAAQ,IAAI,EAAQ,KAAK,CAAO,GAAG,GAAQ,OAAO;CAKlE,OAHI,KAAW,EAAQ,QAAQ,GAAS,EAAQ,QAAQ,EAAQ,KAAK,CAAO,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Adapter, DateObj, SelectionMode } from './types';\n\nexport function composeEventHandlers(...fns: any[]) {\n return (event: any, ...args: any[]) =>\n fns.some(fn => {\n if (fn) {\n fn(event, ...args);\n }\n return event && event.defaultPrevented;\n });\n}\n\n\nexport function subtractMonth({\n calendars,\n offset,\n minDate,\n adapter\n}: {\n calendars: Calendar[],\n offset: number,\n minDate?: Date,\n adapter: DateAdapter\n}): number {\n const firstDay = calendars[0].firstDayOfMonth;\n const newDate = adapter.subtract(adapter.date(firstDay), offset, 'month');\n\n if (minDate && adapter.isBefore(newDate, adapter.startOf(adapter.date(minDate), 'month'))) {\n return adapter.diff(adapter.startOf(adapter.date(firstDay), 'month'), adapter.startOf(adapter.date(minDate), 'month'), 'month');\n }\n return offset;\n}\n\nexport function addMonth({\n calendars,\n offset,\n maxDate,\n adapter\n}: {\n calendars: Calendar[],\n offset: number,\n maxDate?: Date,\n adapter: DateAdapter\n}): number {\n const lastDay = calendars[calendars.length - 1].firstDayOfMonth;\n const newDate = adapter.add(adapter.date(lastDay), offset, 'month');\n\n if (maxDate && adapter.isAfter(newDate, adapter.startOf(adapter.date(maxDate), 'month'))) {\n return adapter.diff(adapter.startOf(adapter.date(maxDate), 'month'), adapter.startOf(adapter.date(lastDay), 'month'), 'month');\n }\n return offset;\n}\n\nexport function getCalendars({\n date,\n selected,\n disabledDates,\n modifiers,\n monthsToDisplay,\n minDate,\n maxDate,\n offset,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate\n}: {\n date: Date,\n selected?: Date | Date[] | { start?: Date, end?: Date },\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n monthsToDisplay: number,\n minDate?: Date,\n maxDate?: Date,\n offset: number,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: SelectionMode,\n hoveredDate?: Date\n}): Calendar[] {\n const calendars: Calendar[] = [];\n const startDate = adapter.add(adapter.startOf(adapter.date(date), 'month'), offset, 'month');\n\n for (let i = 0; i < monthsToDisplay; i++) {\n const currentMonth = adapter.add(startDate, i, 'month');\n calendars.push(getMonthData({\n month: adapter.get(currentMonth, 'month'),\n year: adapter.get(currentMonth, 'year'),\n selectedDates: selected,\n disabledDates,\n modifiers,\n minDate,\n maxDate,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate\n }));\n }\n\n return calendars;\n}\n\nfunction getMonthData({\n month,\n year,\n selectedDates,\n disabledDates,\n modifiers,\n minDate,\n maxDate,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate\n}: {\n month: number,\n year: number,\n selectedDates?: Date | Date[] | { start?: Date, end?: Date },\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n minDate?: Date,\n maxDate?: Date,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: 'single' | 'range' | 'multiple',\n hoveredDate?: Date\n}): Calendar {\n let currentMonth = adapter.set(adapter.set(adapter.date(), 'year', year), 'month', month);\n month = adapter.get(currentMonth, 'month');\n year = adapter.get(currentMonth, 'year');\n\n const daysInMonth = adapter.getDaysInMonth(currentMonth);\n const dates: (DateObj | null)[] = [];\n\n for (let day = 1; day <= daysInMonth; day++) {\n const date = adapter.toDate(adapter.set(currentMonth, 'day', day));\n const dateObj = createDateObj(date, selectedDates, disabledDates, modifiers, minDate, maxDate, adapter, selectionMode, false, hoveredDate, month, year);\n dates.push(dateObj);\n }\n\n const firstDayOfMonth = adapter.toDate(adapter.startOf(currentMonth, 'month'));\n const lastDayOfMonth = adapter.toDate(adapter.endOf(currentMonth, 'month'));\n\n const frontWeekBuffer = fillFrontWeek({\n firstDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n });\n\n const backWeekBuffer = fillBackWeek({\n lastDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n });\n\n dates.unshift(...frontWeekBuffer);\n dates.push(...backWeekBuffer);\n\n const weeks = getWeeks(dates);\n\n return {\n firstDayOfMonth,\n lastDayOfMonth,\n month,\n year,\n weeks\n };\n}\n\nfunction createDateObj(\n date: Date,\n selectedDates: Date | Date[] | { start?: Date, end?: Date } | undefined,\n disabledDates: Date[] | undefined,\n modifiers: Record<string, (date: Date, month: number, year: number) => boolean> | undefined,\n minDate: Date | undefined,\n maxDate: Date | undefined,\n adapter: DateAdapter,\n selectionMode: 'single' | 'range' | 'multiple',\n isOutside = false,\n hoveredDate?: Date,\n month?: number,\n year?: number\n): DateObj {\n const { selected, isRangeStart, isRangeEnd, isRangeBetween, isRangeHovering, isRangeActive } = isSelected(selectedDates, date, adapter, selectionMode, hoveredDate);\n const isToday = adapter.isSame(adapter.date(date), adapter.date(), \"day\");\n const isPrevMonth = isOutside && adapter.isBefore(adapter.date(date), adapter.startOf(adapter.date(date), 'month'));\n const isNextMonth = isOutside && adapter.isAfter(adapter.date(date), adapter.endOf(adapter.date(date), 'month'));\n\n const defaultModifiers: Record<string, (d: Date, m: number, y: number) => boolean> = {\n 'text-brand-gold border border-brand-gold': (d: Date) =>\n adapter.isSame(adapter.date(d), adapter.date(), 'day'),\n 'text-white cursor-default!': (d: Date, m: number) =>\n adapter.get(adapter.date(d), 'month') !== m\n };\n const mergedModifiers: Record<string, (d: Date, m: number, y: number) => boolean> = { ...defaultModifiers, ...modifiers };\n\n const activeModifiers = Object.keys(mergedModifiers).filter(key =>\n mergedModifiers[key](date, month ?? adapter.get(adapter.date(date), 'month'), year ?? adapter.get(adapter.date(date), 'year'))\n );\n\n if (isToday) activeModifiers.push('today');\n if (isOutside) activeModifiers.push('outside');\n if (isPrevMonth) activeModifiers.push('prev-month');\n if (isNextMonth) activeModifiers.push('next-month');\n\n return {\n date,\n selected,\n modifiers: activeModifiers,\n selectable: isSelectable(minDate, maxDate, disabledDates, date, adapter),\n today: isToday,\n prevMonth: isPrevMonth,\n nextMonth: isNextMonth,\n isRangeStart,\n isRangeEnd,\n isRangeBetween,\n isRangeHovering,\n isRangeActive\n };\n}\n\nfunction fillFrontWeek({\n firstDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n}: {\n firstDayOfMonth: Date,\n minDate?: Date,\n maxDate?: Date,\n selectedDates?: any,\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: any,\n hoveredDate?: Date,\n month: number,\n year: number\n}): (DateObj | null)[] {\n const dates: (DateObj | null)[] = [];\n let firstDay = (adapter.toDate(adapter.date(firstDayOfMonth)).getDay() + 7 - firstDayOfWeek) % 7;\n\n let current = adapter.subtract(adapter.date(firstDayOfMonth), 1, \"day\");\n for (let i = 0; i < firstDay; i++) {\n const date = adapter.toDate(current);\n const dateObj = createDateObj(date, selectedDates, disabledDates, modifiers, minDate, maxDate, adapter, selectionMode, true, hoveredDate, month, year);\n dateObj.prevMonth = true;\n if (!showOutsideDays) {\n dateObj.selectable = false;\n }\n dates.unshift(dateObj);\n current = adapter.subtract(current, 1, \"day\");\n }\n\n return dates;\n}\n\nfunction fillBackWeek({\n lastDayOfMonth,\n minDate,\n maxDate,\n selectedDates,\n disabledDates,\n modifiers,\n firstDayOfWeek,\n showOutsideDays,\n adapter,\n selectionMode,\n hoveredDate,\n month,\n year\n}: {\n lastDayOfMonth: Date,\n minDate?: Date,\n maxDate?: Date,\n selectedDates?: any,\n disabledDates?: Date[],\n modifiers?: Record<string, (date: Date, month: number, year: number) => boolean>,\n firstDayOfWeek: number,\n showOutsideDays: boolean,\n adapter: DateAdapter,\n selectionMode: any,\n hoveredDate?: Date,\n month: number,\n year: number\n}): (DateObj | null)[] {\n const dates: (DateObj | null)[] = [];\n let lastDay = (adapter.toDate(adapter.date(lastDayOfMonth)).getDay() + 7 - firstDayOfWeek) % 7;\n\n let current = adapter.add(adapter.date(lastDayOfMonth), 1, \"day\");\n for (let i = 0; i < 6 - lastDay; i++) {\n const date = adapter.toDate(current);\n const dateObj = createDateObj(date, selectedDates, disabledDates, modifiers, minDate, maxDate, adapter, selectionMode, true, hoveredDate, month, year);\n dateObj.nextMonth = true;\n if (!showOutsideDays) {\n dateObj.selectable = false;\n }\n dates.push(dateObj);\n current = adapter.add(current, 1, \"day\");\n }\n\n return dates;\n}\n\nfunction getWeeks(dates: (DateObj | null)[]): (DateObj | null)[][] {\n const weeksLength = Math.ceil(dates.length / 7);\n const weeks: (DateObj | null)[][] = [];\n for (let i = 0; i < weeksLength; i++) {\n weeks[i] = [];\n for (let x = 0; x < 7; x++) {\n weeks[i].push(dates[i * 7 + x]);\n }\n }\n return weeks;\n}\n\nfunction isSelected(\n selectedDates: Date | Date[] | { start?: Date, end?: Date } | undefined,\n date: Date,\n adapter: DateAdapter,\n selectionMode: 'single' | 'range' | 'multiple',\n hoveredDate?: Date\n): { selected: boolean, isRangeStart?: boolean, isRangeEnd?: boolean, isRangeBetween?: boolean, isRangeHovering?: boolean, isRangeActive?: boolean } {\n if (!selectedDates && !hoveredDate) return { selected: false };\n\n const d = adapter.date(date);\n\n if (selectionMode === 'single' && selectedDates instanceof Date) {\n return { selected: adapter.isSame(d, adapter.date(selectedDates), 'day') };\n }\n\n if (selectionMode === 'multiple' && Array.isArray(selectedDates)) {\n return { selected: selectedDates.some(sd => adapter.isSame(d, adapter.date(sd), 'day')) };\n }\n\n if (selectionMode === 'range') {\n const range = (selectedDates && typeof selectedDates === 'object' && !(selectedDates instanceof Date) && !Array.isArray(selectedDates)) ? (selectedDates as { start?: Date, end?: Date }) : { start: undefined, end: undefined };\n const { start, end } = range;\n\n let isStart = start ? adapter.isSame(d, adapter.date(start), 'day') : false;\n let isEnd = end ? adapter.isSame(d, adapter.date(end), 'day') : false;\n const isBetween = (start && end) ? (adapter.isAfter(d, adapter.date(start), 'day') && adapter.isBefore(d, adapter.date(end), 'day')) : false;\n\n let isHovering = false;\n if (start && !end && hoveredDate) {\n const h = adapter.date(hoveredDate);\n const s = adapter.date(start);\n if (adapter.isAfter(h, s, 'day')) {\n isHovering = (adapter.isAfter(d, s, 'day') && adapter.isBefore(d, h, 'day')) || adapter.isSame(d, h, 'day');\n if (adapter.isSame(d, h, 'day')) isEnd = true;\n } else if (adapter.isBefore(h, s, 'day')) {\n isHovering = (adapter.isAfter(d, h, 'day') && adapter.isBefore(d, s, 'day')) || adapter.isSame(d, h, 'day');\n if (adapter.isSame(d, h, 'day')) {\n isStart = true;\n }\n if (adapter.isSame(d, s, 'day')) {\n isStart = false;\n isEnd = true;\n }\n }\n }\n\n const isRangeActive = !!(\n (start && end && !adapter.isSame(adapter.date(start), adapter.date(end), 'day')) ||\n (start && !end && hoveredDate && !adapter.isSame(adapter.date(start), adapter.date(hoveredDate), 'day'))\n );\n\n return {\n selected: isStart || isEnd || isBetween,\n isRangeStart: isStart,\n isRangeEnd: isEnd,\n isRangeBetween: isBetween,\n isRangeHovering: isHovering,\n isRangeActive\n };\n }\n\n if (Array.isArray(selectedDates) && selectedDates.length === 1 && selectionMode === 'single') {\n return { selected: adapter.isSame(d, adapter.date(selectedDates[0]), 'day') };\n }\n\n return { selected: false };\n}\n\nfunction isSelectable(minDate: Date | undefined, maxDate: Date | undefined, disabledDates: Date[] | undefined, date: Date, adapter: DateAdapter): boolean {\n const d = adapter.date(date);\n const isMinDateInvalid = minDate && adapter.isBefore(d, adapter.date(minDate), 'day');\n const isMaxDateInvalid = maxDate && adapter.isAfter(d, adapter.date(maxDate), 'day');\n const isDisabled = disabledDates?.some(disabledDate => adapter.isSame(d, adapter.date(disabledDate), 'day'));\n return !isMinDateInvalid && !isMaxDateInvalid && !isDisabled;\n}\n\nexport function isBackDisabled({\n calendars,\n minDate,\n adapter\n}: {\n calendars: Calendar[],\n minDate?: Date,\n adapter: DateAdapter\n}): boolean {\n if (!minDate) {\n return false;\n }\n const firstDay = calendars[0].firstDayOfMonth;\n return adapter.isSame(adapter.startOf(adapter.date(firstDay), 'month'), adapter.startOf(adapter.date(minDate), 'month'), 'month') || adapter.isBefore(adapter.date(firstDay), adapter.date(minDate), 'month');\n}\n\nexport function isForwardDisabled({\n calendars,\n maxDate,\n adapter\n}: {\n calendars: Calendar[],\n maxDate?: Date,\n adapter: DateAdapter\n}): boolean {\n if (!maxDate) {\n return false;\n }\n const lastDay = calendars[calendars.length - 1].firstDayOfMonth;\n return adapter.isSame(adapter.startOf(adapter.date(lastDay), 'month'), adapter.startOf(adapter.date(maxDate), 'month'), 'month') || adapter.isAfter(adapter.date(lastDay), adapter.date(maxDate), 'month');\n}\n"],"mappings":";AAEA,SAAgB,EAAqB,GAAG,GAAY;CAChD,QAAQ,GAAY,GAAG,MACnB,EAAI,MAAK,OACD,KACA,EAAG,GAAO,GAAG,CAAI,GAEd,KAAS,EAAM,iBACzB;AACT;AAGA,SAAgB,EAAc,EAC1B,cACA,WACA,YACA,cAMO;CACP,IAAM,IAAW,EAAU,EAAE,CAAC,iBACxB,IAAU,EAAQ,SAAS,EAAQ,KAAK,CAAQ,GAAG,GAAQ,OAAO;CAKxE,OAHI,KAAW,EAAQ,SAAS,GAAS,EAAQ,QAAQ,EAAQ,KAAK,CAAO,GAAG,OAAO,CAAC,IAC7E,EAAQ,KAAK,EAAQ,QAAQ,EAAQ,KAAK,CAAQ,GAAG,OAAO,GAAG,EAAQ,QAAQ,EAAQ,KAAK,CAAO,GAAG,OAAO,GAAG,OAAO,IAE3H;AACX;AAEA,SAAgB,EAAS,EACrB,cACA,WACA,YACA,cAMO;CACP,IAAM,IAAU,EAAU,EAAU,SAAS,EAAE,CAAC,iBAC1C,IAAU,EAAQ,IAAI,EAAQ,KAAK,CAAO,GAA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G,OAAO;AAC7M"}
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "react-modular-datepicker",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "A modular, lightweight, and type-safe React datepicker and calendar component with headless hooks for single, multiple, and range selection.",
5
5
  "author": "",
6
6
  "license": "MIT",
7
- "homepage": "https://react-modular-datepicker.vercel.app/",
7
+ "homepage": "https://react-modular-datepicker.vercel.app",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/Dragate/react-modular-datepicker.git"
@@ -43,9 +43,28 @@
43
43
  "sideEffects": [
44
44
  "*.css"
45
45
  ],
46
- "main": "./dist/index.js",
47
- "module": "./dist/index.mjs",
46
+ "main": "./dist/index.cjs",
47
+ "module": "./dist/index.js",
48
48
  "types": "./dist/index.d.ts",
49
+ "exports": {
50
+ ".": {
51
+ "types": "./dist/index.d.ts",
52
+ "import": "./dist/index.js",
53
+ "require": "./dist/index.cjs"
54
+ },
55
+ "./useDates": {
56
+ "types": "./dist/useDates.d.ts",
57
+ "import": "./dist/useDates.js",
58
+ "require": "./dist/useDates.cjs"
59
+ },
60
+ "./utils": {
61
+ "types": "./dist/utils.d.ts",
62
+ "import": "./dist/utils.js",
63
+ "require": "./dist/utils.cjs"
64
+ },
65
+ "./dist/*": "./dist/*",
66
+ "./package.json": "./package.json"
67
+ },
49
68
  "peerDependencies": {
50
69
  "dayjs": "^1.11.20",
51
70
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",