@@ -14,6 +14,7 @@ import {ActionButton, Header, HeaderContext, Heading, HeadingContext, pressScale
1414import {
1515 Calendar as AriaCalendar ,
1616 CalendarCell as AriaCalendarCell ,
17+ CalendarContext as AriaCalendarContext ,
1718 CalendarGrid as AriaCalendarGrid ,
1819 CalendarHeaderCell as AriaCalendarHeaderCell ,
1920 CalendarProps as AriaCalendarProps ,
@@ -28,9 +29,11 @@ import {
2829 ContextValue ,
2930 DateValue ,
3031 Provider ,
32+ RangeCalendarContext ,
3133 RangeCalendarState ,
3234 RangeCalendarStateContext ,
33- Text
35+ Text ,
36+ useSlottedContext
3437} from 'react-aria-components' ;
3538import { AriaCalendarGridProps } from '@react-aria/calendar' ;
3639import { baseColor , focusRing , lightDark , style } from '../style' with { type : 'macro' } ;
@@ -371,7 +374,7 @@ export const Calendar = /*#__PURE__*/ (forwardRef as forwardRefType)(function Ca
371374 alignItems : 'start'
372375 } ) } >
373376 { Array . from ( { length : visibleMonths } ) . map ( ( _ , i ) => (
374- < CalendarGrid months = { i } key = { i } firstDayOfWeek = { props . firstDayOfWeek } />
377+ < CalendarGrid months = { i } key = { i } />
375378 ) ) }
376379 </ div >
377380 { isInvalid && (
@@ -387,7 +390,11 @@ export const Calendar = /*#__PURE__*/ (forwardRef as forwardRefType)(function Ca
387390} ) ;
388391
389392export const CalendarGrid = ( props : Omit < AriaCalendarGridProps , 'children' > & PropsWithChildren & { months : number } ) : ReactElement => {
390- // use isolation to start a new stacking context so that we can use zIndex -1 for the selection span.
393+ let rangeCalendarProps = useSlottedContext ( RangeCalendarContext ) ;
394+ let calendarProps = useSlottedContext ( AriaCalendarContext ) ;
395+ let firstDayOfWeek = rangeCalendarProps ?. firstDayOfWeek ?? calendarProps ?. firstDayOfWeek ;
396+
397+ // use isolation to start a new stacking context so that we can use zIndex -1 for the selection span.
391398 return (
392399 < AriaCalendarGrid
393400 className = { style ( {
@@ -405,7 +412,7 @@ export const CalendarGrid = (props: Omit<AriaCalendarGridProps, 'children'> & Pr
405412 </ CalendarGridHeader >
406413 < CalendarGridBody className = "" >
407414 { ( date ) => (
408- < CalendarCell date = { date } firstDayOfWeek = { props . firstDayOfWeek } />
415+ < CalendarCell date = { date } firstDayOfWeek = { firstDayOfWeek } />
409416 ) }
410417 </ CalendarGridBody >
411418 </ AriaCalendarGrid >
@@ -510,6 +517,7 @@ const CalendarCell = (props: Omit<CalendarCellProps, 'children'> & {firstDayOfWe
510517 let isFirstWeek = weekIndex === 0 ;
511518 let isFirstChild = dayIndex === 0 ;
512519 let isLastChild = dayIndex === 6 ;
520+
513521 return (
514522 < AriaCalendarCell
515523 date = { props . date }
0 commit comments