react-modular-datepicker 0.0.8 → 0.0.9
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/README.md +2 -2
- package/dist/classNames.d.ts +0 -39
- package/dist/components/CalendarHeader.d.ts +3 -5
- package/dist/components/Day.d.ts +8 -2
- package/dist/components/MonthSelection.d.ts +1 -1
- package/dist/components/YearSelection.d.ts +1 -1
- package/dist/i18n.d.ts +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2 -473
- package/dist/index.js +404 -214
- package/dist/index.js.map +1 -1
- package/dist/{useDates-CjPuu-VA.js → useDates-BVAPuyDo.js} +46 -44
- package/dist/useDates-BVAPuyDo.js.map +1 -0
- package/dist/{useDates-c17u4Qfs.cjs → useDates-DqKgwgF7.cjs} +2 -2
- package/dist/useDates-DqKgwgF7.cjs.map +1 -0
- package/dist/useDates.cjs +1 -1
- package/dist/useDates.d.ts +2 -3
- package/dist/useDates.js +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +1 -2
- package/dist/utils.js +52 -48
- package/dist/utils.js.map +1 -1
- package/package.json +10 -8
- package/dist/useDates-CjPuu-VA.js.map +0 -1
- package/dist/useDates-c17u4Qfs.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
A modular, lightweight, and type-safe React datepicker library. Whether you need a fully-featured calendar component or a headless hook to build your own UI, `react-modular-datepicker` has you covered.
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
<img src="
|
|
6
|
+
<img src="https://react-modular-datepicker.vercel.app/opengraph-image" alt="react-modular-datepicker preview" width="800" />
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
## Features
|
|
@@ -86,7 +86,7 @@ For full API reference, recipes, and interactive demos, check out the documentat
|
|
|
86
86
|
|
|
87
87
|
To run the documentation site locally:
|
|
88
88
|
```bash
|
|
89
|
-
pnpm run dev
|
|
89
|
+
pnpm run dev
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
---
|
package/dist/classNames.d.ts
CHANGED
|
@@ -10,44 +10,6 @@ export interface DayClassNames {
|
|
|
10
10
|
rangeHovering?: string;
|
|
11
11
|
[key: string]: string | undefined;
|
|
12
12
|
}
|
|
13
|
-
export declare const defaultClassNames: {
|
|
14
|
-
root: string;
|
|
15
|
-
header: string;
|
|
16
|
-
headerMultiMonth: string;
|
|
17
|
-
calendarsContainer: string;
|
|
18
|
-
calendarContainer: string;
|
|
19
|
-
navButtonSlotStart: string;
|
|
20
|
-
navButtonSlotEnd: string;
|
|
21
|
-
headerTitleContainer: string;
|
|
22
|
-
weekdayGrid: string;
|
|
23
|
-
weekday: string;
|
|
24
|
-
daysGrid: string;
|
|
25
|
-
footer: string;
|
|
26
|
-
navButton: string;
|
|
27
|
-
navButtonHidden: string;
|
|
28
|
-
monthYearContainer: string;
|
|
29
|
-
monthYearLabel: string;
|
|
30
|
-
monthYearButton: string;
|
|
31
|
-
day: {
|
|
32
|
-
day: string;
|
|
33
|
-
selected: string;
|
|
34
|
-
unselected: string;
|
|
35
|
-
disabled: string;
|
|
36
|
-
empty: string;
|
|
37
|
-
rangeStart: string;
|
|
38
|
-
rangeEnd: string;
|
|
39
|
-
rangeBetween: string;
|
|
40
|
-
rangeHovering: string;
|
|
41
|
-
};
|
|
42
|
-
monthsGrid: string;
|
|
43
|
-
monthButton: string;
|
|
44
|
-
monthButtonSelected: string;
|
|
45
|
-
monthButtonUnselected: string;
|
|
46
|
-
yearsGrid: string;
|
|
47
|
-
yearButton: string;
|
|
48
|
-
yearButtonSelected: string;
|
|
49
|
-
yearButtonUnselected: string;
|
|
50
|
-
};
|
|
51
13
|
export interface CalendarClassNames {
|
|
52
14
|
root?: string;
|
|
53
15
|
header?: string;
|
|
@@ -76,4 +38,3 @@ export interface CalendarClassNames {
|
|
|
76
38
|
yearButtonSelected?: string;
|
|
77
39
|
yearButtonUnselected?: string;
|
|
78
40
|
}
|
|
79
|
-
export declare const mergeClassNames: (custom?: CalendarClassNames) => Required<CalendarClassNames>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { Translations } from '../i18n';
|
|
2
3
|
import { Calendar, CalendarClassNames } from '../types';
|
|
3
4
|
export interface HeaderProps {
|
|
4
5
|
calendars: Calendar[];
|
|
@@ -6,11 +7,8 @@ export interface HeaderProps {
|
|
|
6
7
|
getForwardProps: (args: any) => any;
|
|
7
8
|
setView: (view: 'days' | 'months' | 'years') => void;
|
|
8
9
|
monthNames: string[];
|
|
9
|
-
t:
|
|
10
|
-
|
|
11
|
-
forward: string;
|
|
12
|
-
};
|
|
13
|
-
classNames: Required<CalendarClassNames>;
|
|
10
|
+
t: Translations;
|
|
11
|
+
classNames?: CalendarClassNames;
|
|
14
12
|
slideDirection?: 'left' | 'right' | null;
|
|
15
13
|
currentView?: 'days' | 'months' | 'years';
|
|
16
14
|
}
|
package/dist/components/Day.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { CalendarClassNames, DateObj } from '../types';
|
|
2
|
+
import { CalendarClassNames, DateAdapter, DateObj } from '../types';
|
|
3
3
|
interface DayProps {
|
|
4
4
|
dateObj: DateObj | null;
|
|
5
5
|
getDateProps: (args: {
|
|
@@ -7,7 +7,13 @@ interface DayProps {
|
|
|
7
7
|
[key: string]: any;
|
|
8
8
|
}) => any;
|
|
9
9
|
dayProps?: Record<string, any>;
|
|
10
|
-
classNames
|
|
10
|
+
classNames?: CalendarClassNames;
|
|
11
|
+
tabIndex?: number;
|
|
12
|
+
adapter?: DateAdapter;
|
|
13
|
+
locale?: string;
|
|
14
|
+
onKeyDown?: (e: React.KeyboardEvent, dateObj: DateObj) => void;
|
|
15
|
+
onFocus?: (dateObj: DateObj) => void;
|
|
16
|
+
buttonRef?: (el: HTMLButtonElement | null) => void;
|
|
11
17
|
}
|
|
12
18
|
export declare const Day: React.FC<DayProps>;
|
|
13
19
|
export {};
|
|
@@ -7,7 +7,7 @@ interface MonthSelectionProps {
|
|
|
7
7
|
minDate?: Date | null;
|
|
8
8
|
maxDate?: Date | null;
|
|
9
9
|
onMonthSelect: (month: number) => void;
|
|
10
|
-
classNames
|
|
10
|
+
classNames?: CalendarClassNames;
|
|
11
11
|
}
|
|
12
12
|
export declare const MonthSelection: React.FC<MonthSelectionProps>;
|
|
13
13
|
export {};
|
|
@@ -6,7 +6,7 @@ interface YearSelectionProps {
|
|
|
6
6
|
maxDate?: Date | null;
|
|
7
7
|
adapter: DateAdapter;
|
|
8
8
|
onYearSelect: (year: number) => void;
|
|
9
|
-
classNames
|
|
9
|
+
classNames?: CalendarClassNames;
|
|
10
10
|
}
|
|
11
11
|
export declare const YearSelection: React.FC<YearSelectionProps>;
|
|
12
12
|
export {};
|
package/dist/i18n.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export interface Translations {
|
|
|
4
4
|
weekdays: string[];
|
|
5
5
|
back: string;
|
|
6
6
|
forward: string;
|
|
7
|
+
selectMonth?: string;
|
|
8
|
+
selectYear?: string;
|
|
7
9
|
}
|
|
8
10
|
export declare function getDefaults(adapter?: DateAdapter, locale?: string): Translations;
|
|
9
11
|
export declare function getTranslations(adapter?: DateAdapter, locale?: string, custom?: Partial<Translations>): Translations;
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useDates-c17u4Qfs.cjs"),t=require("./utils.cjs");let n=require("react");n=e.i(n,1);let r=require("react/jsx-runtime");var i={root:`w-fit flex flex-col p-4 bg-white rounded-lg shadow-lg`,header:`flex items-center justify-between border-b-2 border-brand-gray-light/40 pb-2`,headerMultiMonth:`border-b-0 pb-0`,calendarsContainer:`flex flex-wrap gap-4`,calendarContainer:`flex-1 min-w-[280px] max-w-full`,navButtonSlotStart:`w-9 flex justify-start`,navButtonSlotEnd:`w-9 flex justify-end`,headerTitleContainer:`font-semibold text-brand-text text-center flex-1`,weekdayGrid:`grid grid-cols-7 gap-1 mb-1 border-b border-brand-gray-light/40`,weekday:`text-center text-xs text-gray-400 py-2`,daysGrid:`grid grid-cols-7 gap-px bg-brand-gray-light/20`,footer:`mt-4`,navButton:`p-2 text-brand-text hover:bg-gray-100 rounded-full transition-colors cursor-pointer disabled:opacity-30 disabled:pointer-events-none`,navButtonHidden:`invisible pointer-events-none`,monthYearContainer:`flex gap-8`,monthYearLabel:`flex gap-1 items-center font-semibold text-brand-text`,monthYearButton:`hover:bg-gray-100 px-2 py-1 rounded cursor-pointer`,day:{day:`rmdp-day group`,selected:`rmdp-day-selected`,unselected:`rmdp-day-unselected`,disabled:`rmdp-day-disabled`,empty:`rmdp-day-empty`,rangeStart:`rmdp-day-range-start`,rangeEnd:`rmdp-day-range-end`,rangeBetween:`rmdp-day-range-between`,rangeHovering:`rmdp-day-range-hovering`},monthsGrid:`grid grid-cols-3 gap-2 animate-slide-in-top`,monthButton:`py-3 rounded-lg hover:bg-brand-gray-light transition-colors cursor-pointer disabled:opacity-30 disabled:pointer-events-none`,monthButtonSelected:`bg-brand-gold text-white`,monthButtonUnselected:`text-brand-text`,yearsGrid:`grid grid-cols-3 gap-2 max-h-[210px] overflow-y-auto pr-2 animate-slide-in-top rmdp-scrollbar`,yearButton:`py-3 rounded-lg hover:bg-brand-gray-light transition-colors cursor-pointer disabled:opacity-30 disabled:pointer-events-none`,yearButtonSelected:`bg-brand-gold text-white`,yearButtonUnselected:`text-brand-text`},a=e=>{let t={...i};if(!e)return t;for(let n in e){let r=n;r===`day`&&e.day?t.day={...i.day,...e.day}:e[r]&&(t[r]=e[r])}return t};function o(t=e.r,n){return{months:t.getMonths(n),weekdays:t.getWeekdays(n),back:`Previous month`,forward:`Next month`}}function s(t=e.r,n,r){return{...o(t,n),...r}}var c=()=>(0,r.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,r.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),l=()=>(0,r.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,r.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),u=({calendars:e,getBackProps:t,getForwardProps:n,setView:i,monthNames:a,t:o,classNames:s,slideDirection:u,currentView:d})=>{if(e.length>1&&e.length<12)return null;let f=e[0],p=e[e.length-1],m=[s.header,e.length>1?s.headerMultiMonth:``].filter(Boolean).join(` `),h=e=>[s.navButton,e?s.navButtonHidden:``].filter(Boolean).join(` `),g=!!(d&&d!==`days`);return(0,r.jsxs)(`div`,{className:m,children:[(0,r.jsx)(`button`,{...t({calendars:e}),onMouseDown:e=>e.preventDefault(),className:h(g),"aria-label":o.back,children:(0,r.jsx)(c,{})}),(0,r.jsx)(`div`,{className:s.monthYearContainer,children:e.length===1?(0,r.jsxs)(`div`,{className:`${s.monthYearLabel} ${u===`left`?`animate-slide-in-left`:u===`right`?`animate-slide-in-right`:``}`,children:[(0,r.jsx)(`button`,{onMouseDown:e=>e.preventDefault(),onClick:()=>i(d===`months`?`days`:`months`),className:s.monthYearButton,children:a[e[0].month]}),(0,r.jsx)(`button`,{onMouseDown:e=>e.preventDefault(),onClick:()=>i(d===`years`?`days`:`years`),className:s.monthYearButton,children:e[0].year})]},`${e[0].month}-${e[0].year}`):(0,r.jsx)(`div`,{className:`${s.monthYearLabel} ${u===`left`?`animate-slide-in-left`:u===`right`?`animate-slide-in-right`:``}`,children:(0,r.jsx)(`span`,{children:f.year===p.year?f.year:`${f.year} - ${p.year}`})})}),(0,r.jsx)(`button`,{...n({calendars:e}),onMouseDown:e=>e.preventDefault(),className:h(g),"aria-label":o.forward,children:(0,r.jsx)(l,{})})]})},d=({dateObj:e,getDateProps:t,dayProps:n,classNames:i})=>{if(!e)return(0,r.jsx)(`div`,{className:i.day.empty});let{date:a,selected:o,selectable:s,isRangeStart:c,isRangeEnd:l,isRangeBetween:u,isRangeHovering:d,isRangeActive:f}=e,p=i.day,m=`rounded-full`;m=c&&l?`${p.selected} rounded-full`:c?`${p.rangeStart} ${f?`rounded-l-full rounded-r-none`:`rounded-full`}`:l?`${p.rangeEnd} ${f?`rounded-r-full rounded-l-none`:`rounded-full`}`:u?p.rangeBetween||``:d?p.rangeHovering||``:o?p.selected||``:s?p.unselected||``:p.disabled||``;let h=(e.modifiers||[]).map(e=>p[e]||e).filter(Boolean).join(` `),g=[p.day,m,h].filter(Boolean).join(` `);return(0,r.jsx)(`button`,{...t({dateObj:e,...n}),className:g,children:a.getDate()})},f=({year:e,month:t,monthNames:n,minDate:i,maxDate:a,onMonthSelect:o,classNames:s})=>{let c=t=>!!(i&&e===i.getFullYear()&&t<i.getMonth()||a&&e===a.getFullYear()&&t>a.getMonth());return(0,r.jsx)(`div`,{className:s.monthsGrid,children:n.map((e,n)=>{let i=c(n);return(0,r.jsx)(`button`,{onMouseDown:e=>e.preventDefault(),onClick:()=>!i&&o(n),className:`${s.monthButton} ${n===t?s.monthButtonSelected:s.monthButtonUnselected}`,disabled:i,children:e},e)})})},p=({year:e,minDate:t,maxDate:i,adapter:a,onYearSelect:o,classNames:s})=>{let c=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(c.current){let e=c.current.querySelector(`[data-selected="true"]`);e&&e.scrollIntoView({block:`center`})}},[]);let l=t?a.get(a.date(t),`year`):e-50,u=i?a.get(a.date(i),`year`):e+50,d=[];for(let e=l;e<=u;e++)d.push(e);return(0,r.jsx)(`div`,{ref:c,className:s.yearsGrid,children:d.map(t=>(0,r.jsx)(`button`,{"data-selected":t===e,onMouseDown:e=>e.preventDefault(),onClick:()=>o(t),className:`${s.yearButton} ${t===e?s.yearButtonSelected:s.yearButtonUnselected}`,children:t},t))})},m=t=>{let{classNames:i,locale:o,translations:m,adapter:h=e.r,firstDayOfWeek:g=0,header:_,footer:v,getDayProps:y,...b}=t,x=a(i),[S,C]=(0,n.useState)(`days`),[w,T]=(0,n.useState)(null),E=s(h,o,m),D=E.weekdays,O=E.months,{calendars:k,getBackProps:A,getForwardProps:j,getDateProps:M,setOffset:N}=e.t({...b,adapter:h,firstDayOfWeek:g}),P=[...D.slice(g),...D.slice(0,g)],{month:F,year:I}=k[0],L=e=>{let n=h.set(h.set(h.date(t.date||new Date),`year`,I),`month`,F),r=h.set(n,`month`,e),i=h.startOf(h.date(t.date||new Date),`month`),a=h.diff(r,i,`month`);T(null),N(a),C(`days`)},R=e=>{let n=h.set(h.set(h.date(t.date||new Date),`year`,I),`month`,F),r=h.set(n,`year`,e),i=h.startOf(h.date(t.date||new Date),`month`),a=h.diff(r,i,`month`);T(null),N(a),C(`days`)},z=b.monthsToDisplay||1,B=e=>{let t=A({offset:z,...e});return{...t,onClick:e=>{T(`left`),t.onClick?.(e)}}},V=e=>{let t=j({offset:z,...e});return{...t,onClick:e=>{T(`right`),t.onClick?.(e)}}};return(0,r.jsxs)(`div`,{className:`rmdp ${x.root}`,children:[typeof _==`function`?_({calendars:k,getBackProps:B,getForwardProps:V,setView:C,monthNames:O,t:E,slideDirection:w,currentView:S}):_||(0,r.jsx)(u,{calendars:k,getBackProps:B,getForwardProps:V,setView:C,monthNames:O,t:E,classNames:x,slideDirection:w,currentView:S}),(0,r.jsxs)(`div`,{className:x.calendarsContainer,children:[S===`months`&&k.map(e=>(0,r.jsx)(`div`,{className:x.calendarContainer,children:(0,r.jsx)(f,{year:e.year,month:e.month,monthNames:O,minDate:t.minDate,maxDate:t.maxDate,onMonthSelect:L,classNames:x})},`months-${e.year}`)),S===`years`&&k.map(e=>(0,r.jsx)(`div`,{className:x.calendarContainer,children:(0,r.jsx)(p,{year:e.year,minDate:t.minDate,maxDate:t.maxDate,adapter:h,onYearSelect:R,classNames:x})},`years-${e.year}`)),S===`days`&&k.map((e,t)=>(0,r.jsxs)(`div`,{className:x.calendarContainer,children:[k.length>1&&(0,r.jsxs)(`div`,{className:x.header,children:[(0,r.jsx)(`div`,{className:x.navButtonSlotStart,children:t===0&&k.length<12&&(0,r.jsx)(`button`,{...B({calendars:k}),onMouseDown:e=>e.preventDefault(),className:x.navButton,"aria-label":E.back,children:(0,r.jsx)(c,{})})}),(0,r.jsxs)(`span`,{className:x.headerTitleContainer,children:[O[e.month],k.length<12?` ${e.year}`:``]}),(0,r.jsx)(`div`,{className:x.navButtonSlotEnd,children:t===k.length-1&&k.length<12&&(0,r.jsx)(`button`,{...V({calendars:k}),onMouseDown:e=>e.preventDefault(),className:x.navButton,"aria-label":E.forward,children:(0,r.jsx)(l,{})})})]}),(0,r.jsx)(`div`,{className:x.weekdayGrid,children:P.map(e=>(0,r.jsx)(`div`,{className:x.weekday,children:e},e))}),(0,r.jsx)(`div`,{className:`${x.daysGrid} ${w===`left`?`animate-slide-in-left`:w===`right`?`animate-slide-in-right`:``}`,children:e.weeks.map((e,t)=>e.map((e,n)=>(0,r.jsx)(d,{dateObj:e,getDateProps:M,dayProps:e?y?.(e):void 0,classNames:x},`${t}-${n}`)))},`daysGrid-${e.month}-${e.year}`)]},`${e.month}-${e.year}`))]}),v&&(0,r.jsx)(`div`,{className:x.footer,children:v})]})};exports.Calendar=m,exports.CalendarHeader=u,exports.ChevronLeftIcon=c,exports.ChevronRightIcon=l,exports.Day=d,exports.DayjsAdapter=e.n,exports.MonthSelection=f,exports.YearSelection=p,exports.addMonth=t.addMonth,exports.composeEventHandlers=t.composeEventHandlers,exports.defaultAdapter=e.r,exports.defaultClassNames=i,exports.getCalendars=t.getCalendars,exports.getDefaults=o,exports.getTranslations=s,exports.isBackDisabled=t.isBackDisabled,exports.isForwardDisabled=t.isForwardDisabled,exports.mergeClassNames=a,exports.subtractMonth=t.subtractMonth,exports.useDates=e.t;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useDates-DqKgwgF7.cjs"),t=require("./utils.cjs");let n=require("react");n=e.i(n,1);let r=require("react/jsx-runtime");function i(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=i(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function a(){for(var e,t,n=0,r=``,a=arguments.length;n<a;n++)(e=arguments[n])&&(t=i(e))&&(r&&(r+=` `),r+=t);return r}function o(t=e.r,n){return{months:t.getMonths(n),weekdays:t.getWeekdays(n),back:`Previous month`,forward:`Next month`,selectMonth:`Select month`,selectYear:`Select year`}}function s(t=e.r,n,r){return{...o(t,n),...r}}var c=()=>(0,r.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,r.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),l=()=>(0,r.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,r.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),u=({calendars:e,getBackProps:t,getForwardProps:n,setView:i,monthNames:o,t:s,classNames:u,slideDirection:d,currentView:f})=>{if(e.length>1&&e.length<12)return null;let p=e[0],m=e[e.length-1],h=!!(f&&f!==`days`),g=a(`rmd-nav-button`,h&&`rmd-nav-button-hidden`,u?.navButton,h&&u?.navButtonHidden),_=a(`rmd-month-year-label`,d===`left`&&`rmd-slide-left`,d===`right`&&`rmd-slide-right`,u?.monthYearLabel);return(0,r.jsxs)(`div`,{className:a(`rmd-header`,e.length>1&&`rmd-header-multi-month`,u?.header,e.length>1&&u?.headerMultiMonth),children:[(0,r.jsx)(`button`,{...t({calendars:e}),className:g,"aria-label":s.back,children:(0,r.jsx)(c,{})}),(0,r.jsx)(`div`,{className:a(`rmd-month-year-container`,u?.monthYearContainer),children:e.length===1?(0,r.jsxs)(`div`,{className:_,children:[(0,r.jsx)(`button`,{onClick:()=>i(f===`months`?`days`:`months`),className:a(`rmd-month-year-button`,u?.monthYearButton),"aria-label":`${o[e[0].month]}, ${s.selectMonth||`Select month`}`,"aria-expanded":f===`months`,children:o[e[0].month]}),(0,r.jsx)(`button`,{onClick:()=>i(f===`years`?`days`:`years`),className:a(`rmd-month-year-button`,u?.monthYearButton),"aria-label":`${e[0].year}, ${s.selectYear||`Select year`}`,"aria-expanded":f===`years`,children:e[0].year})]},`${e[0].month}-${e[0].year}`):(0,r.jsx)(`div`,{className:_,children:(0,r.jsx)(`span`,{children:p.year===m.year?p.year:`${p.year} - ${m.year}`})})}),(0,r.jsx)(`button`,{...n({calendars:e}),className:g,"aria-label":s.forward,children:(0,r.jsx)(l,{})})]})},d=({dateObj:e,getDateProps:t,dayProps:n,classNames:i,tabIndex:o=-1,adapter:s,locale:c,onKeyDown:l,onFocus:u,buttonRef:d})=>{if(!e)return(0,r.jsx)(`div`,{role:`gridcell`,"aria-hidden":`true`,className:a(`rmd-day-empty`,i?.day?.empty)});let{date:f,selected:p,selectable:m,isRangeStart:h,isRangeEnd:g,isRangeBetween:_,isRangeHovering:v,isRangeActive:y}=e,b=i?.day,x=``,S=``;h&&g?(x=`rmd-day-selected`,S=b?.selected||``):h?(x=a(`rmd-day-range-start`,y&&`rmd-day-range-active`),S=b?.rangeStart||``):g?(x=a(`rmd-day-range-end`,y&&`rmd-day-range-active`),S=b?.rangeEnd||``):_?(x=`rmd-day-range-between`,S=b?.rangeBetween||``):v?(x=`rmd-day-range-hovering`,S=b?.rangeHovering||``):p?(x=`rmd-day-selected`,S=b?.selected||``):m?(x=`rmd-day-unselected`,S=b?.unselected||``):(x=`rmd-day-disabled`,S=b?.disabled||``);let C=(e.modifiers||[]).map(e=>b?.[e]||e).filter(Boolean),w=s?s.format(s.date(f),`dddd, MMMM D, YYYY`,c):f.toDateString(),T=!!(p||h||g),E=t({dateObj:e,...n});return(0,r.jsx)(`button`,{role:`gridcell`,"aria-selected":T,"aria-disabled":!m,"aria-label":w,tabIndex:o,...E,ref:d,onKeyDown:t=>{E.onKeyDown?.(t),l?.(t,e)},onFocus:t=>{E.onFocus?.(t),u?.(e)},className:a(`rmd-day`,b?.day,x,S,C),children:f.getDate()})},f=({year:e,month:t,monthNames:i,minDate:o,maxDate:s,onMonthSelect:c,classNames:l})=>{let[u,d]=(0,n.useState)(t),f=(0,n.useRef)([]);(0,n.useEffect)(()=>{f.current[u]?.focus()},[u]);let p=t=>!!(o&&e===o.getFullYear()&&t<o.getMonth()||s&&e===s.getFullYear()&&t>s.getMonth()),m=(e,t)=>{let n=u;switch(e.key){case`ArrowLeft`:e.preventDefault(),n=(t-1+12)%12;break;case`ArrowRight`:e.preventDefault(),n=(t+1)%12;break;case`ArrowUp`:e.preventDefault(),n=(t-3+12)%12;break;case`ArrowDown`:e.preventDefault(),n=(t+3)%12;break;case`Home`:e.preventDefault(),n=0;break;case`End`:e.preventDefault(),n=11;break;case`Enter`:case` `:e.preventDefault(),p(t)||c(t);return;default:return}d(n)},h=a(`rmd-months-grid`,l?.monthsGrid);return(0,r.jsx)(`div`,{role:`grid`,"aria-label":`Select month`,className:h,children:i.map((e,n)=>{let i=p(n),o=n===t,s=n===u,h=a(`rmd-month-button`,o?`rmd-month-button-selected`:`rmd-month-button-unselected`,l?.monthButton,o?l?.monthButtonSelected:l?.monthButtonUnselected);return(0,r.jsx)(`button`,{ref:e=>{f.current[n]=e},role:`gridcell`,"aria-selected":o,"aria-disabled":i,tabIndex:s?0:-1,onClick:()=>!i&&c(n),onKeyDown:e=>m(e,n),onFocus:()=>d(n),className:h,disabled:i,children:e},e)})})},p=({year:e,minDate:t,maxDate:i,adapter:o,onYearSelect:s,classNames:c})=>{let l=(0,n.useRef)(null),[u,d]=(0,n.useState)(e),f=(0,n.useRef)(new Map),p=t?o.get(o.date(t),`year`):e-50,m=i?o.get(o.date(i),`year`):e+50,h=[];for(let e=p;e<=m;e++)h.push(e);(0,n.useEffect)(()=>{if(l.current){let e=l.current,t=e.querySelector(`[data-selected="true"]`);if(t){let n=t.offsetTop-e.clientHeight/2+t.clientHeight/2;e.scrollTop=Math.max(0,n)}}},[]),(0,n.useEffect)(()=>{let e=f.current.get(u);e&&e.focus()},[u]);let g=(e,t)=>{let n=u;switch(e.key){case`ArrowLeft`:e.preventDefault(),n=Math.max(p,t-1);break;case`ArrowRight`:e.preventDefault(),n=Math.min(m,t+1);break;case`ArrowUp`:e.preventDefault(),n=Math.max(p,t-3);break;case`ArrowDown`:e.preventDefault(),n=Math.min(m,t+3);break;case`PageUp`:e.preventDefault(),n=Math.max(p,t-10);break;case`PageDown`:e.preventDefault(),n=Math.min(m,t+10);break;case`Home`:e.preventDefault(),n=p;break;case`End`:e.preventDefault(),n=m;break;case`Enter`:case` `:e.preventDefault(),s(t);return;default:return}d(n)};return(0,r.jsx)(`div`,{ref:l,role:`grid`,"aria-label":`Select year`,className:a(`rmd-years-grid`,c?.yearsGrid),children:h.map(t=>{let n=t===e,i=t===u,o=a(`rmd-year-button`,n?`rmd-year-button-selected`:`rmd-year-button-unselected`,c?.yearButton,n?c?.yearButtonSelected:c?.yearButtonUnselected);return(0,r.jsx)(`button`,{ref:e=>{e?f.current.set(t,e):f.current.delete(t)},"data-selected":n,role:`gridcell`,"aria-selected":n,tabIndex:i?0:-1,onClick:()=>s(t),onKeyDown:e=>g(e,t),onFocus:()=>d(t),className:o,children:t},t)})})},m=e=>`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`,h=t=>{let{classNames:i,locale:o,translations:h,adapter:g=e.r,firstDayOfWeek:_=0,header:v,footer:y,getDayProps:b,...x}=t,[S,C]=(0,n.useState)(`days`),[w,T]=(0,n.useState)(null),[E,D]=(0,n.useState)(null),[O,k]=(0,n.useState)(null),[A,j]=(0,n.useState)(``),M=(0,n.useRef)(null),N=(0,n.useRef)(null),P=(0,n.useRef)(new Map),F=(0,n.useRef)(!1),I=s(g,o,h),L=I.weekdays,R=I.months,{calendars:z,getBackProps:B,getForwardProps:V,getDateProps:H,setOffset:U}=e.t({...x,adapter:g,firstDayOfWeek:_});(0,n.useEffect)(()=>{if(S===`days`&&M.current){let e=M.current,t=()=>{e.offsetHeight>0&&D(e.offsetHeight)};if(t(),typeof ResizeObserver<`u`){let n=new ResizeObserver(()=>{t()});return n.observe(e),()=>n.disconnect()}}},[S,z]),(0,n.useEffect)(()=>{S===`days`&&z.length>0?z.length===1?j(`${R[z[0].month]} ${z[0].year}`):j(`${R[z[0].month]} ${z[0].year} to ${R[z[z.length-1].month]} ${z[z.length-1].year}`):S===`months`?j(`Month selection view`):S===`years`&&j(`Year selection view`)},[S,z,R]);let W=(0,n.useMemo)(()=>{for(let e of z)for(let t of e.weeks)for(let e of t)if(e?.selectable&&e.selected)return e.date;for(let e of z)for(let t of e.weeks)for(let e of t)if(e?.selectable&&e.today)return e.date;for(let e of z)for(let t of e.weeks)for(let e of t)if(e?.selectable&&!e.prevMonth&&!e.nextMonth)return e.date;return z[0]?.weeks[0]?.find(e=>e?.selectable)?.date||new Date},[z]),G=O||W;(0,n.useEffect)(()=>{if(S===`days`&&G&&F.current){let e=m(G),t=P.current.get(e);t&&t.focus()}},[G,z,S]);let K=[...L.slice(_),...L.slice(0,_)],{month:q,year:J}=z[0],Y=e=>{let n=g.set(g.set(g.date(t.date||new Date),`year`,J),`month`,q),r=g.set(n,`month`,e),i=g.startOf(g.date(t.date||new Date),`month`),a=g.diff(r,i,`month`);T(null),U(a),C(`days`)},X=e=>{let n=g.set(g.set(g.date(t.date||new Date),`year`,J),`month`,q),r=g.set(n,`year`,e),i=g.startOf(g.date(t.date||new Date),`month`),a=g.diff(r,i,`month`);T(null),U(a),C(`days`)},Z=x.monthsToDisplay||1,Q=e=>{let t=B({offset:Z,...e});return{...t,onClick:e=>{T(`left`),t.onClick?.(e)}}},$=e=>{let t=V({offset:Z,...e});return{...t,onClick:e=>{T(`right`),t.onClick?.(e)}}},ee=(e,n)=>{let r=!!(N.current?.closest(`[dir="rtl"]`)||typeof document<`u`&&document.documentElement.dir===`rtl`),i=null,a=g.date(n.date);switch(e.key){case`ArrowLeft`:e.preventDefault(),i=g.toDate(g.add(a,r?1:-1,`day`));break;case`ArrowRight`:e.preventDefault(),i=g.toDate(g.add(a,r?-1:1,`day`));break;case`ArrowUp`:e.preventDefault(),i=g.toDate(g.subtract(a,7,`day`));break;case`ArrowDown`:e.preventDefault(),i=g.toDate(g.add(a,7,`day`));break;case`Home`:{e.preventDefault();let t=(g.toDate(a).getDay()-_+7)%7;i=g.toDate(g.subtract(a,t,`day`));break}case`End`:{e.preventDefault();let t=6-(g.toDate(a).getDay()-_+7)%7;i=g.toDate(g.add(a,t,`day`));break}case`PageUp`:{e.preventDefault();let t=e.shiftKey?`year`:`month`;i=g.toDate(g.subtract(a,1,t));break}case`PageDown`:{e.preventDefault();let t=e.shiftKey?`year`:`month`;i=g.toDate(g.add(a,1,t));break}case`Enter`:case` `:return;default:return}if(i){F.current=!0,k(i);let e=g.startOf(g.date(t.date||new Date),`month`),n=g.startOf(g.date(i),`month`),r=g.diff(n,e,`month`);U(r)}};return(0,r.jsxs)(`div`,{ref:N,className:a(`rmd`,`rmd-root`,i?.root),children:[(0,r.jsx)(`div`,{className:`rmd-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:A}),typeof v==`function`?v({calendars:z,getBackProps:Q,getForwardProps:$,setView:C,monthNames:R,t:I,slideDirection:w,currentView:S}):v||(0,r.jsx)(u,{calendars:z,getBackProps:Q,getForwardProps:$,setView:C,monthNames:R,t:I,classNames:i,slideDirection:w,currentView:S}),(0,r.jsxs)(`div`,{className:a(`rmd-calendars-container`,i?.calendarsContainer),children:[S===`months`&&z.map(e=>(0,r.jsx)(`div`,{className:a(`rmd-calendar-container`,i?.calendarContainer),style:E?{height:`${E}px`}:void 0,children:(0,r.jsx)(f,{year:e.year,month:e.month,monthNames:R,minDate:t.minDate,maxDate:t.maxDate,onMonthSelect:Y,classNames:i})},`months-${e.year}`)),S===`years`&&z.map(e=>(0,r.jsx)(`div`,{className:a(`rmd-calendar-container`,i?.calendarContainer),style:E?{height:`${E}px`}:void 0,children:(0,r.jsx)(p,{year:e.year,minDate:t.minDate,maxDate:t.maxDate,adapter:g,onYearSelect:X,classNames:i})},`years-${e.year}`)),S===`days`&&z.map((e,t)=>(0,r.jsxs)(`div`,{ref:t===0?M:void 0,role:`grid`,"aria-label":`${R[e.month]} ${e.year}`,className:a(`rmd-calendar-container`,i?.calendarContainer),children:[z.length>1&&(0,r.jsxs)(`div`,{className:a(`rmd-header`,i?.header),children:[(0,r.jsx)(`div`,{className:a(`rmd-nav-button-slot-start`,i?.navButtonSlotStart),children:t===0&&z.length<12&&(0,r.jsx)(`button`,{...Q({calendars:z}),className:a(`rmd-nav-button`,i?.navButton),"aria-label":I.back,children:(0,r.jsx)(c,{})})}),(0,r.jsxs)(`span`,{className:a(`rmd-header-title-container`,i?.headerTitleContainer),children:[R[e.month],z.length<12?` ${e.year}`:``]}),(0,r.jsx)(`div`,{className:a(`rmd-nav-button-slot-end`,i?.navButtonSlotEnd),children:t===z.length-1&&z.length<12&&(0,r.jsx)(`button`,{...$({calendars:z}),className:a(`rmd-nav-button`,i?.navButton),"aria-label":I.forward,children:(0,r.jsx)(l,{})})})]}),(0,r.jsx)(`div`,{role:`row`,className:a(`rmd-weekday-grid`,i?.weekdayGrid),children:K.map(e=>(0,r.jsx)(`div`,{role:`columnheader`,"aria-label":e,className:a(`rmd-weekday`,i?.weekday),children:e},e))}),(0,r.jsx)(`div`,{role:`row`,className:a(`rmd-days-grid`,w===`left`&&`rmd-slide-left`,w===`right`&&`rmd-slide-right`,i?.daysGrid),children:e.weeks.map((e,t)=>e.map((e,n)=>{if(!e)return(0,r.jsx)(d,{dateObj:null,getDateProps:H,classNames:i},`${t}-${n}`);let a=m(e.date),s=g.isSame(g.date(e.date),g.date(G),`day`);return(0,r.jsx)(d,{dateObj:e,getDateProps:H,dayProps:b?.(e),classNames:i,tabIndex:s?0:-1,adapter:g,locale:o,onKeyDown:ee,onFocus:e=>{k(e.date)},buttonRef:e=>{e?P.current.set(a,e):P.current.delete(a)}},`${t}-${n}`)}))},`daysGrid-${e.month}-${e.year}`)]},`${e.month}-${e.year}`))]}),y&&(0,r.jsx)(`div`,{className:a(`rmd-footer`,i?.footer),children:y})]})};exports.Calendar=h,exports.CalendarHeader=u,exports.ChevronLeftIcon=c,exports.ChevronRightIcon=l,exports.Day=d,exports.DayjsAdapter=e.n,exports.MonthSelection=f,exports.YearSelection=p,exports.addMonth=t.addMonth,exports.composeEventHandlers=t.composeEventHandlers,exports.defaultAdapter=e.r,exports.getCalendars=t.getCalendars,exports.getDefaults=o,exports.getTranslations=s,exports.isBackDisabled=t.isBackDisabled,exports.isForwardDisabled=t.isForwardDisabled,exports.subtractMonth=t.subtractMonth,exports.useDates=e.t;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","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":"4MAaA,IAAa,EAAoB,CAC/B,KAAM,wDACN,OAAQ,+EACR,iBAAkB,kBAClB,mBAAoB,uBACpB,kBAAmB,kCACnB,mBAAoB,yBACpB,iBAAkB,uBAClB,qBAAsB,mDACtB,YAAa,kEACb,QAAS,yCACT,SAAU,iDACV,OAAQ,OAER,UAAW,uIACX,gBAAiB,gCACjB,mBAAoB,aACpB,eAAgB,wDAChB,gBAAiB,qDAEjB,IAAK,CACH,IAAK,iBACL,SAAU,oBACV,WAAY,sBACZ,SAAU,oBACV,MAAO,iBACP,WAAY,uBACZ,SAAU,qBACV,aAAc,yBACd,cAAe,yBACjB,EAEA,WAAY,8CACZ,YAAa,8HACb,oBAAqB,2BACrB,sBAAuB,kBAEvB,UAAW,gGACX,WAAY,8HACZ,mBAAoB,2BACpB,qBAAsB,iBACxB,EAmCa,EAAmB,GAA8D,CAC5F,IAAM,EAAS,CAAE,GAAG,CAAkB,EACtC,GAAI,CAAC,EAAQ,OAAO,EAEpB,IAAK,IAAM,KAAO,EAAQ,CACxB,IAAM,EAAI,EACN,IAAM,OAAS,EAAO,IACxB,EAAO,IAAM,CAAE,GAAG,EAAkB,IAAK,GAAG,EAAO,GAAI,EAC9C,EAAO,KAChB,EAAgB,GAAK,EAAO,GAEhC,CACA,OAAO,CACT,EC5FA,SAAgB,EAAY,EAAuB,EAAA,EAAgB,EAA+B,CAChG,MAAO,CACL,OAAQ,EAAQ,UAAU,CAAM,EAChC,SAAU,EAAQ,YAAY,CAAM,EACpC,KAAM,iBACN,QAAS,YACX,CACF,CAEA,SAAgB,EACZ,EAAuB,EAAA,EACvB,EACA,EACY,CAEd,MAAO,CAAE,GADI,EAAY,EAAS,CACtB,EAAM,GAAG,CAAO,CAC9B,CCXA,IAAa,OACX,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,MAA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AAA,GAAG,EAAS,MAAM,GAAG,EAAS,MAmDnC,CACN,CACE,IACJ,IAAU,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAW,EAAW,OAAS,SAAA,CAAY,CAAA,CACxD,GAET"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs","../src/i18n.ts","../src/components/CalendarHeader.tsx","../src/components/Day.tsx","../src/components/MonthSelection.tsx","../src/components/YearSelection.tsx","../src/components/Calendar.tsx"],"sourcesContent":["function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f)}else for(f in e)e[f]&&(n&&(n+=\" \"),n+=f);return n}export function clsx(){for(var e,t,f=0,n=\"\",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","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 selectMonth?: string;\n selectYear?: 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 selectMonth: 'Select month',\n selectYear: 'Select year'\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 clsx from 'clsx';\nimport React from 'react';\nimport { Translations } from '../i18n';\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: Translations;\n classNames?: 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 isNavHidden = !!(currentView && currentView !== 'days');\n const navButtonClassName = clsx(\n 'rmd-nav-button',\n isNavHidden && 'rmd-nav-button-hidden',\n classNames?.navButton,\n isNavHidden && classNames?.navButtonHidden\n );\n\n const monthYearLabelClassName = clsx(\n 'rmd-month-year-label',\n slideDirection === 'left' && 'rmd-slide-left',\n slideDirection === 'right' && 'rmd-slide-right',\n classNames?.monthYearLabel\n );\n\n return (\n <div className={clsx(\n 'rmd-header',\n calendars.length > 1 && 'rmd-header-multi-month',\n classNames?.header,\n calendars.length > 1 && classNames?.headerMultiMonth\n )}>\n <button\n {...getBackProps({ calendars })}\n className={navButtonClassName}\n aria-label={t.back}\n >\n <ChevronLeftIcon />\n </button>\n\n <div className={clsx('rmd-month-year-container', classNames?.monthYearContainer)}>\n {calendars.length === 1 ? (\n <div key={`${calendars[0].month}-${calendars[0].year}`} className={monthYearLabelClassName}>\n <button\n onClick={() => setView(currentView === 'months' ? 'days' : 'months')}\n className={clsx('rmd-month-year-button', classNames?.monthYearButton)}\n aria-label={`${monthNames[calendars[0].month]}, ${t.selectMonth || 'Select month'}`}\n aria-expanded={currentView === 'months'}\n >\n {monthNames[calendars[0].month]}\n </button>\n <button\n onClick={() => setView(currentView === 'years' ? 'days' : 'years')}\n className={clsx('rmd-month-year-button', classNames?.monthYearButton)}\n aria-label={`${calendars[0].year}, ${t.selectYear || 'Select year'}`}\n aria-expanded={currentView === 'years'}\n >\n {calendars[0].year}\n </button>\n </div>\n ) : (\n <div className={monthYearLabelClassName}>\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 className={navButtonClassName}\n aria-label={t.forward}\n >\n <ChevronRightIcon />\n </button>\n </div>\n );\n};\n","import React from 'react';\nimport clsx from 'clsx';\nimport type { CalendarClassNames, DateAdapter, 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?: CalendarClassNames;\n tabIndex?: number;\n adapter?: DateAdapter;\n locale?: string;\n onKeyDown?: (e: React.KeyboardEvent, dateObj: DateObj) => void;\n onFocus?: (dateObj: DateObj) => void;\n buttonRef?: (el: HTMLButtonElement | null) => void;\n}\n\nexport const Day: React.FC<DayProps> = ({\n dateObj,\n getDateProps,\n dayProps,\n classNames,\n tabIndex = -1,\n adapter,\n locale,\n onKeyDown,\n onFocus,\n buttonRef\n}) => {\n if (!dateObj) {\n return <div role=\"gridcell\" aria-hidden=\"true\" className={clsx('rmd-day-empty', classNames?.day?.empty)} />;\n }\n\n const { date, selected, selectable, isRangeStart, isRangeEnd, isRangeBetween, isRangeHovering, isRangeActive } = dateObj;\n const dayClasses = classNames?.day;\n\n let semanticStateClass = '';\n let customStateClass = '';\n\n if (isRangeStart && isRangeEnd) {\n semanticStateClass = 'rmd-day-selected';\n customStateClass = dayClasses?.selected || '';\n } else if (isRangeStart) {\n semanticStateClass = clsx('rmd-day-range-start', isRangeActive && 'rmd-day-range-active');\n customStateClass = dayClasses?.rangeStart || '';\n } else if (isRangeEnd) {\n semanticStateClass = clsx('rmd-day-range-end', isRangeActive && 'rmd-day-range-active');\n customStateClass = dayClasses?.rangeEnd || '';\n } else if (isRangeBetween) {\n semanticStateClass = 'rmd-day-range-between';\n customStateClass = dayClasses?.rangeBetween || '';\n } else if (isRangeHovering) {\n semanticStateClass = 'rmd-day-range-hovering';\n customStateClass = dayClasses?.rangeHovering || '';\n } else if (selected) {\n semanticStateClass = 'rmd-day-selected';\n customStateClass = dayClasses?.selected || '';\n } else if (!selectable) {\n semanticStateClass = 'rmd-day-disabled';\n customStateClass = dayClasses?.disabled || '';\n } else {\n semanticStateClass = 'rmd-day-unselected';\n customStateClass = dayClasses?.unselected || '';\n }\n\n const modifierClasses = (dateObj.modifiers || [])\n .map(m => (dayClasses as any)?.[m] || m)\n .filter(Boolean);\n\n const formattedDateLabel = adapter\n ? adapter.format(adapter.date(date), 'dddd, MMMM D, YYYY', locale)\n : date.toDateString();\n\n const isSelected = !!(selected || isRangeStart || isRangeEnd);\n\n const baseProps = getDateProps({ dateObj, ...dayProps });\n\n return (\n <button\n role=\"gridcell\"\n aria-selected={isSelected}\n aria-disabled={!selectable}\n aria-label={formattedDateLabel}\n tabIndex={tabIndex}\n {...baseProps}\n ref={buttonRef}\n onKeyDown={(e) => {\n baseProps.onKeyDown?.(e);\n onKeyDown?.(e, dateObj);\n }}\n onFocus={(e) => {\n baseProps.onFocus?.(e);\n onFocus?.(dateObj);\n }}\n className={clsx(\n 'rmd-day',\n dayClasses?.day,\n semanticStateClass,\n customStateClass,\n modifierClasses\n )}\n >\n {date.getDate()}\n </button>\n );\n};\n","import React, { useState, useRef, useEffect } from 'react';\nimport clsx from 'clsx';\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?: 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 [focusedMonth, setFocusedMonth] = useState<number>(month);\n const buttonRefs = useRef<(HTMLButtonElement | null)[]>([]);\n\n useEffect(() => {\n buttonRefs.current[focusedMonth]?.focus();\n }, [focusedMonth]);\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 const handleKeyDown = (e: React.KeyboardEvent, idx: number) => {\n let nextIndex = focusedMonth;\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n nextIndex = (idx - 1 + 12) % 12;\n break;\n case 'ArrowRight':\n e.preventDefault();\n nextIndex = (idx + 1) % 12;\n break;\n case 'ArrowUp':\n e.preventDefault();\n nextIndex = (idx - 3 + 12) % 12;\n break;\n case 'ArrowDown':\n e.preventDefault();\n nextIndex = (idx + 3) % 12;\n break;\n case 'Home':\n e.preventDefault();\n nextIndex = 0;\n break;\n case 'End':\n e.preventDefault();\n nextIndex = 11;\n break;\n case 'Enter':\n case ' ':\n e.preventDefault();\n if (!isMonthDisabled(idx)) {\n onMonthSelect(idx);\n }\n return;\n default:\n return;\n }\n\n setFocusedMonth(nextIndex);\n };\n\n const gridClassName = clsx('rmd-months-grid', classNames?.monthsGrid);\n\n return (\n <div\n role=\"grid\"\n aria-label=\"Select month\"\n className={gridClassName}\n >\n {monthNames.map((name, idx) => {\n const disabled = isMonthDisabled(idx);\n const isSelected = idx === month;\n const isFocused = idx === focusedMonth;\n const buttonClassName = clsx(\n 'rmd-month-button',\n isSelected ? 'rmd-month-button-selected' : 'rmd-month-button-unselected',\n classNames?.monthButton,\n isSelected ? classNames?.monthButtonSelected : classNames?.monthButtonUnselected\n );\n\n return (\n <button\n key={name}\n ref={(el) => {\n buttonRefs.current[idx] = el;\n }}\n role=\"gridcell\"\n aria-selected={isSelected}\n aria-disabled={disabled}\n tabIndex={isFocused ? 0 : -1}\n onClick={() => !disabled && onMonthSelect(idx)}\n onKeyDown={(e) => handleKeyDown(e, idx)}\n onFocus={() => setFocusedMonth(idx)}\n className={buttonClassName}\n disabled={disabled}\n >\n {name}\n </button>\n );\n })}\n </div>\n );\n};\n","import React, { useEffect, useRef, useState } from 'react';\nimport clsx from 'clsx';\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?: 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 const [focusedYear, setFocusedYear] = useState<number>(year);\n const buttonRefs = useRef<Map<number, HTMLButtonElement>>(new Map());\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: number[] = [];\n for (let y = startYear; y <= endYear; y++) {\n years.push(y);\n }\n\n useEffect(() => {\n if (yearListRef.current) {\n const container = yearListRef.current;\n const selectedYearBtn = container.querySelector('[data-selected=\"true\"]') as HTMLElement | null;\n if (selectedYearBtn) {\n const targetScrollTop =\n selectedYearBtn.offsetTop - container.clientHeight / 2 + selectedYearBtn.clientHeight / 2;\n container.scrollTop = Math.max(0, targetScrollTop);\n }\n }\n }, []);\n\n useEffect(() => {\n const btn = buttonRefs.current.get(focusedYear);\n if (btn) {\n btn.focus();\n }\n }, [focusedYear]);\n\n const handleKeyDown = (e: React.KeyboardEvent, y: number) => {\n let nextYear = focusedYear;\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n nextYear = Math.max(startYear, y - 1);\n break;\n case 'ArrowRight':\n e.preventDefault();\n nextYear = Math.min(endYear, y + 1);\n break;\n case 'ArrowUp':\n e.preventDefault();\n nextYear = Math.max(startYear, y - 3);\n break;\n case 'ArrowDown':\n e.preventDefault();\n nextYear = Math.min(endYear, y + 3);\n break;\n case 'PageUp':\n e.preventDefault();\n nextYear = Math.max(startYear, y - 10);\n break;\n case 'PageDown':\n e.preventDefault();\n nextYear = Math.min(endYear, y + 10);\n break;\n case 'Home':\n e.preventDefault();\n nextYear = startYear;\n break;\n case 'End':\n e.preventDefault();\n nextYear = endYear;\n break;\n case 'Enter':\n case ' ':\n e.preventDefault();\n onYearSelect(y);\n return;\n default:\n return;\n }\n\n setFocusedYear(nextYear);\n };\n\n return (\n <div\n ref={yearListRef}\n role=\"grid\"\n aria-label=\"Select year\"\n className={clsx('rmd-years-grid', classNames?.yearsGrid)}\n >\n {years.map((y) => {\n const isSelected = y === year;\n const isFocused = y === focusedYear;\n const buttonClassName = clsx(\n 'rmd-year-button',\n isSelected ? 'rmd-year-button-selected' : 'rmd-year-button-unselected',\n classNames?.yearButton,\n isSelected ? classNames?.yearButtonSelected : classNames?.yearButtonUnselected\n );\n\n return (\n <button\n key={y}\n ref={(el) => {\n if (el) buttonRefs.current.set(y, el);\n else buttonRefs.current.delete(y);\n }}\n data-selected={isSelected}\n role=\"gridcell\"\n aria-selected={isSelected}\n tabIndex={isFocused ? 0 : -1}\n onClick={() => onYearSelect(y)}\n onKeyDown={(e) => handleKeyDown(e, y)}\n onFocus={() => setFocusedYear(y)}\n className={buttonClassName}\n >\n {y}\n </button>\n );\n })}\n </div>\n );\n};\n","import React, { useState, useRef, useEffect, useMemo } from 'react';\nimport clsx from 'clsx';\nimport { defaultAdapter } from '../adapters/dayjs';\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\nconst getDateKey = (d: Date): string =>\n `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;\n\nexport const Calendar: React.FC<CalendarProps> = (props) => {\n const {\n classNames,\n locale,\n translations: customTranslations,\n adapter = defaultAdapter,\n firstDayOfWeek = 0,\n header,\n footer,\n getDayProps,\n ...useDatesProps\n } = props;\n\n const [view, setView] = useState<CalendarView>('days');\n const [slideDirection, setSlideDirection] = useState<'left' | 'right' | null>(null);\n const [daysHeight, setDaysHeight] = useState<number | null>(null);\n const [focusedDate, setFocusedDate] = useState<Date | null>(null);\n const [announcement, setAnnouncement] = useState<string>('');\n\n const daysContainerRef = useRef<HTMLDivElement | null>(null);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const dayButtonRefs = useRef<Map<string, HTMLButtonElement>>(new Map());\n const isKeyboardNavigating = useRef<boolean>(false);\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 useEffect(() => {\n if (view === 'days' && daysContainerRef.current) {\n const el = daysContainerRef.current;\n const updateHeight = () => {\n if (el.offsetHeight > 0) {\n setDaysHeight(el.offsetHeight);\n }\n };\n updateHeight();\n\n if (typeof ResizeObserver !== 'undefined') {\n const observer = new ResizeObserver(() => {\n updateHeight();\n });\n observer.observe(el);\n return () => observer.disconnect();\n }\n }\n }, [view, calendars]);\n\n useEffect(() => {\n if (view === 'days' && calendars.length > 0) {\n if (calendars.length === 1) {\n setAnnouncement(`${monthNames[calendars[0].month]} ${calendars[0].year}`);\n } else {\n setAnnouncement(\n `${monthNames[calendars[0].month]} ${calendars[0].year} to ${\n monthNames[calendars[calendars.length - 1].month]\n } ${calendars[calendars.length - 1].year}`\n );\n }\n } else if (view === 'months') {\n setAnnouncement('Month selection view');\n } else if (view === 'years') {\n setAnnouncement('Year selection view');\n }\n }, [view, calendars, monthNames]);\n\n // Determine default active focused date if focusedDate is not set\n const defaultFocusedDate = useMemo(() => {\n for (const cal of calendars) {\n for (const week of cal.weeks) {\n for (const dateObj of week) {\n if (dateObj?.selectable && dateObj.selected) {\n return dateObj.date;\n }\n }\n }\n }\n for (const cal of calendars) {\n for (const week of cal.weeks) {\n for (const dateObj of week) {\n if (dateObj?.selectable && dateObj.today) {\n return dateObj.date;\n }\n }\n }\n }\n for (const cal of calendars) {\n for (const week of cal.weeks) {\n for (const dateObj of week) {\n if (dateObj?.selectable && !dateObj.prevMonth && !dateObj.nextMonth) {\n return dateObj.date;\n }\n }\n }\n }\n return calendars[0]?.weeks[0]?.find((d) => d?.selectable)?.date || new Date();\n }, [calendars]);\n\n const currentFocusedDate = focusedDate || defaultFocusedDate;\n\n useEffect(() => {\n if (view === 'days' && currentFocusedDate && isKeyboardNavigating.current) {\n const key = getDateKey(currentFocusedDate);\n const btn = dayButtonRefs.current.get(key);\n if (btn) {\n btn.focus();\n }\n }\n }, [currentFocusedDate, calendars, view]);\n\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 handleDayKeyDown = (e: React.KeyboardEvent, dateObj: DateObj) => {\n const isRTL = Boolean(\n rootRef.current?.closest('[dir=\"rtl\"]') ||\n (typeof document !== 'undefined' && document.documentElement.dir === 'rtl')\n );\n\n let newDate: Date | null = null;\n const current = adapter.date(dateObj.date);\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n newDate = adapter.toDate(adapter.add(current, isRTL ? 1 : -1, 'day'));\n break;\n case 'ArrowRight':\n e.preventDefault();\n newDate = adapter.toDate(adapter.add(current, isRTL ? -1 : 1, 'day'));\n break;\n case 'ArrowUp':\n e.preventDefault();\n newDate = adapter.toDate(adapter.subtract(current, 7, 'day'));\n break;\n case 'ArrowDown':\n e.preventDefault();\n newDate = adapter.toDate(adapter.add(current, 7, 'day'));\n break;\n case 'Home': {\n e.preventDefault();\n const currentDayOfWeek = adapter.toDate(current).getDay();\n const diff = (currentDayOfWeek - firstDayOfWeek + 7) % 7;\n newDate = adapter.toDate(adapter.subtract(current, diff, 'day'));\n break;\n }\n case 'End': {\n e.preventDefault();\n const currentDayOfWeek = adapter.toDate(current).getDay();\n const diff = 6 - ((currentDayOfWeek - firstDayOfWeek + 7) % 7);\n newDate = adapter.toDate(adapter.add(current, diff, 'day'));\n break;\n }\n case 'PageUp': {\n e.preventDefault();\n const unit = e.shiftKey ? 'year' : 'month';\n newDate = adapter.toDate(adapter.subtract(current, 1, unit));\n break;\n }\n case 'PageDown': {\n e.preventDefault();\n const unit = e.shiftKey ? 'year' : 'month';\n newDate = adapter.toDate(adapter.add(current, 1, unit));\n break;\n }\n case 'Enter':\n case ' ': {\n // Native button press handles click event\n return;\n }\n default:\n return;\n }\n\n if (newDate) {\n isKeyboardNavigating.current = true;\n setFocusedDate(newDate);\n\n const baseMonth = adapter.startOf(adapter.date(props.date || new Date()), 'month');\n const targetMonth = adapter.startOf(adapter.date(newDate), 'month');\n const newOffset = adapter.diff(targetMonth, baseMonth, 'month');\n setOffset(newOffset);\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 ref={rootRef} className={clsx('rmd', 'rmd-root', classNames?.root)}>\n <div className=\"rmd-sr-only\" aria-live=\"polite\" aria-atomic=\"true\">\n {announcement}\n </div>\n\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={clsx('rmd-calendars-container', classNames?.calendarsContainer)}>\n {view === 'months' && calendars.map((calendar) => (\n <div\n key={`months-${calendar.year}`}\n className={clsx('rmd-calendar-container', classNames?.calendarContainer)}\n style={daysHeight ? { height: `${daysHeight}px` } : undefined}\n >\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\n key={`years-${calendar.year}`}\n className={clsx('rmd-calendar-container', classNames?.calendarContainer)}\n style={daysHeight ? { height: `${daysHeight}px` } : undefined}\n >\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\n key={`${calendar.month}-${calendar.year}`}\n ref={index === 0 ? daysContainerRef : undefined}\n role=\"grid\"\n aria-label={`${monthNames[calendar.month]} ${calendar.year}`}\n className={clsx('rmd-calendar-container', classNames?.calendarContainer)}\n >\n {calendars.length > 1 && (\n <div className={clsx('rmd-header', classNames?.header)}>\n <div className={clsx('rmd-nav-button-slot-start', classNames?.navButtonSlotStart)}>\n {index === 0 && calendars.length < 12 && (\n <button\n {...wrappedGetBackProps({ calendars })}\n className={clsx('rmd-nav-button', classNames?.navButton)}\n aria-label={t.back}\n >\n <ChevronLeftIcon />\n </button>\n )}\n </div>\n <span className={clsx('rmd-header-title-container', classNames?.headerTitleContainer)}>\n {monthNames[calendar.month]}\n {calendars.length < 12 ? ` ${calendar.year}` : ''}\n </span>\n <div className={clsx('rmd-nav-button-slot-end', classNames?.navButtonSlotEnd)}>\n {index === calendars.length - 1 && calendars.length < 12 && (\n <button\n {...wrappedGetForwardProps({ calendars })}\n className={clsx('rmd-nav-button', classNames?.navButton)}\n aria-label={t.forward}\n >\n <ChevronRightIcon />\n </button>\n )}\n </div>\n </div>\n )}\n <div role=\"row\" className={clsx('rmd-weekday-grid', classNames?.weekdayGrid)}>\n {sortedWeekdays.map((day) => (\n <div\n key={day}\n role=\"columnheader\"\n aria-label={day}\n className={clsx('rmd-weekday', classNames?.weekday)}\n >\n {day}\n </div>\n ))}\n </div>\n <div\n key={`daysGrid-${calendar.month}-${calendar.year}`}\n role=\"row\"\n className={clsx(\n 'rmd-days-grid',\n slideDirection === 'left' && 'rmd-slide-left',\n slideDirection === 'right' && 'rmd-slide-right',\n classNames?.daysGrid\n )}\n >\n {calendar.weeks.map((week, wi) =>\n week.map((dateObj, di) => {\n if (!dateObj) {\n return (\n <Day\n key={`${wi}-${di}`}\n dateObj={null}\n getDateProps={getDateProps}\n classNames={classNames}\n />\n );\n }\n\n const dateKey = getDateKey(dateObj.date);\n const isFocused = adapter.isSame(\n adapter.date(dateObj.date),\n adapter.date(currentFocusedDate),\n 'day'\n );\n\n return (\n <Day\n key={`${wi}-${di}`}\n dateObj={dateObj}\n getDateProps={getDateProps}\n dayProps={getDayProps?.(dateObj)}\n classNames={classNames}\n tabIndex={isFocused ? 0 : -1}\n adapter={adapter}\n locale={locale}\n onKeyDown={handleDayKeyDown}\n onFocus={(dObj) => {\n setFocusedDate(dObj.date);\n }}\n buttonRef={(el) => {\n if (el) {\n dayButtonRefs.current.set(dateKey, el);\n } else {\n dayButtonRefs.current.delete(dateKey);\n }\n }}\n />\n );\n })\n )}\n </div>\n </div>\n ))}\n </div>\n {footer && <div className={clsx('rmd-footer', classNames?.footer)}>{footer}</div>}\n </div>\n );\n};\n"],"x_google_ignoreList":[0],"mappings":"4MAAA,SAAS,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,GAAa,OAAO,GAAjB,UAA8B,OAAO,GAAjB,SAAmB,GAAG,OAAO,GAAa,OAAO,GAAjB,SAAmB,IAAG,MAAM,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,OAAO,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,IAAI,GAAG,KAAK,GAAG,EAAE,MAAM,IAAI,KAAK,EAAE,EAAE,KAAK,IAAI,GAAG,KAAK,GAAG,EAAA,CAAG,OAAO,CAAC,CAAC,SAAgB,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