@@ -7,7 +7,7 @@ import ChevronRightIcon from '../../../icons/arrows/ChevronRightIcon';
77import * as Styled from './Calendar.styled' ;
88
99type Props = React . ComponentProps < typeof DayPicker > & {
10- selectionType ?: 'single' | 'range' ;
10+ selectionType ?: 'single' | 'range' | 'multiple' ;
1111 visibleMonths ?: 1 | 2 | 3 ;
1212} ;
1313
@@ -45,12 +45,20 @@ function Calendar({
4545 }
4646 } satisfies Omit < React . ComponentProps < typeof DayPicker > , 'mode' > ;
4747
48+ const modeProps = ( ( ) => {
49+ switch ( selectionType ) {
50+ case 'range' :
51+ return { mode : 'range' } as const ;
52+ case 'multiple' :
53+ return { mode : 'multiple' } as const ;
54+ default :
55+ return { mode : 'single' } as const ;
56+ }
57+ } ) ( ) ;
58+
4859 return (
4960 < Styled . Container className = { className } >
50- < DayPicker
51- { ...common }
52- { ...( selectionType === 'range' ? ( { mode : 'range' } as const ) : ( { mode : 'single' } as const ) ) }
53- />
61+ < DayPicker { ...common } { ...modeProps } />
5462 </ Styled . Container >
5563 ) ;
5664}
@@ -74,6 +82,9 @@ function CalendarDayButton({ day, modifiers, ...props }: React.ComponentProps<ty
7482 data-selected-single = {
7583 modifiers . selected && ! modifiers . range_start && ! modifiers . range_end && ! modifiers . range_middle
7684 }
85+ data-selected-multiple = {
86+ modifiers . selected && ! modifiers . range_start && ! modifiers . range_end && ! modifiers . range_middle
87+ }
7788 data-selected = { modifiers . selected }
7889 data-today = { modifiers . today }
7990 data-outside = { modifiers . outside }
0 commit comments