@@ -24,17 +24,10 @@ type Preset = {
24
24
} ;
25
25
26
26
type DateSelectionType = 'single' | 'range' ;
27
+ type MantineInternalProps = '__onDayMouseEnter' | '__onDayClick' | 'getDayProps' | 'onMouseLeave' ;
27
28
type CalendarProps < SelectionType extends DateSelectionType > = Pick <
28
29
MantineDatePickerProps < SelectionType extends 'single' ? 'default' : 'range' > ,
29
- | '__onDayMouseEnter'
30
- | '__onDayClick'
31
- | 'getDayProps'
32
- | 'onMouseLeave'
33
- | 'value'
34
- | 'defaultValue'
35
- | 'onChange'
36
- | 'onMonthSelect'
37
- | 'onYearSelect'
30
+ MantineInternalProps | 'value' | 'defaultValue' | 'onChange' | 'onMonthSelect' | 'onYearSelect'
38
31
> & {
39
32
/**
40
33
* Sets the selection mode of the calendar
@@ -46,12 +39,26 @@ type CalendarProps<SelectionType extends DateSelectionType> = Pick<
46
39
* @default 'date'
47
40
*/
48
41
picker ?: PickerType ;
42
+ /**
43
+ * Sets the default picker type
44
+ */
49
45
defaultPicker ?: PickerType ;
46
+ /**
47
+ * Callback which fires when picker type changes
48
+ */
50
49
onPickerChange ?: ( picker : PickerType ) => void ;
51
50
52
- // Standard controlled/uncontrolled state props
51
+ /**
52
+ * Controlled isOpen state
53
+ */
53
54
isOpen ?: boolean ;
55
+ /**
56
+ * Uncontrolled isOpen state
57
+ */
54
58
defaultIsOpen ?: boolean ;
59
+ /**
60
+ * Callback which fires when isOpen state changes
61
+ */
55
62
onOpenChange ?: ( { isOpen } : { isOpen : boolean } ) => void ;
56
63
57
64
/**
@@ -85,6 +92,9 @@ type CalendarProps<SelectionType extends DateSelectionType> = Pick<
85
92
* Sets the maximum date that can be selected.
86
93
*/
87
94
maxDate ?: Date ;
95
+ /**
96
+ * Disables dates that do not pass the function.
97
+ */
88
98
excludeDate ?: ( date : Date ) => boolean ;
89
99
/**
90
100
* Determines whether single date can be selected as range, applicable only when type="range"
@@ -98,7 +108,7 @@ type CalendarProps<SelectionType extends DateSelectionType> = Pick<
98
108
*/
99
109
locale ?: string ;
100
110
101
- // Basic selection props
111
+ // Basic event props
102
112
onNext ?: ( date : Date ) => void ;
103
113
onNextMonth ?: ( date : Date ) => void ;
104
114
onNextYear ?: ( date : Date ) => void ;
@@ -109,7 +119,10 @@ type CalendarProps<SelectionType extends DateSelectionType> = Pick<
109
119
onPreviousDecade ?: ( date : Date ) => void ;
110
120
} ;
111
121
112
- type DatePickerProps < Type extends DateSelectionType > = CalendarProps < Type > &
122
+ type DatePickerProps < Type extends DateSelectionType > = Omit <
123
+ CalendarProps < Type > ,
124
+ MantineInternalProps
125
+ > &
113
126
Omit < DatePickerCommonInputProps , 'inputRef' | 'referenceProps' | 'labelPosition' > & {
114
127
label ?: Type extends 'single' ? string : { start : string ; end ?: string } ;
115
128
labelPosition ?: BaseInputProps [ 'labelPosition' ] ;
0 commit comments