-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix type regression in calendar #6790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -21,7 +21,7 @@ type MappedDateValue<T> = | |||
T extends CalendarDate ? CalendarDate : | |||
never; | |||
|
|||
export interface CalendarPropsBase { | |||
export interface CalendarPropsBase extends AriaLabelingProps { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to have AriaLabelingProps here? It get added when AriaCalendarProps
/etc gets defined, typically the base props don't extend the aria props
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, might've added it at the wrong level, however, I'm not seeing it as a prop here https://react-spectrum.adobe.com/react-aria/Calendar.html#props and it was throwing an error in the tests trying to use the prop, I'll see about why it might not be exposed up higher
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, guess we've been missing the ability to pass those aria attributes to Calendar all this time haha
## API Changes
RangeCalendarProps already in set react-aria-componentsCalendarchanged by:
Calendar <T extends DateValue> {
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
autoFocus?: boolean = false
children?: ReactNode | ((CalendarRenderProps & {
defaultChildren: ReactNode | undefined
})) => ReactNode
className?: string | ((CalendarRenderProps & {
defaultClassName: string | undefined
})) => string
defaultFocusedValue?: DateValue
- defaultValue?: DateValue | null | null
+ defaultValue?: DateValue | null
focusedValue?: DateValue
+ id?: string
isDateUnavailable?: (DateValue) => boolean
isDisabled?: boolean = false
isInvalid?: boolean
isReadOnly?: boolean = false
maxValue?: DateValue | null
minValue?: DateValue | null
- onChange?: (MappedDateValue<DateValue | null>) => void
+ onChange?: (MappedDateValue<DateValue>) => void
onFocusChange?: (CalendarDate) => void
pageBehavior?: PageBehavior = visible
slot?: string | null
style?: CSSProperties | ((CalendarRenderProps & {
defaultStyle: CSSProperties
})) => CSSProperties
- value?: DateValue | null | null
+ value?: DateValue | null
visibleDuration?: DateDuration = {months: 1}
} it changed:
RangeCalendar RangeCalendar <T extends DateValue> {
allowsNonContiguousRanges?: boolean
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
autoFocus?: boolean = false
children?: ReactNode | ((RangeCalendarRenderProps & {
defaultChildren: ReactNode | undefined
})) => ReactNode
className?: string | ((RangeCalendarRenderProps & {
defaultClassName: string | undefined
})) => string
defaultFocusedValue?: DateValue
- defaultValue?: RangeValue<DateValue | null>
+ defaultValue?: RangeValue<DateValue> | null
focusedValue?: DateValue
+ id?: string
isDateUnavailable?: (DateValue) => boolean
isDisabled?: boolean = false
isInvalid?: boolean
isReadOnly?: boolean = false
maxValue?: DateValue | null
minValue?: DateValue | null
onChange?: (T) => void
onFocusChange?: (CalendarDate) => void
pageBehavior?: PageBehavior = visible
slot?: string | null
style?: CSSProperties | ((RangeCalendarRenderProps & {
defaultStyle: CSSProperties
})) => CSSProperties
- value?: RangeValue<DateValue | null>
+ value?: RangeValue<DateValue> | null
visibleDuration?: DateDuration = {months: 1}
} CalendarProps CalendarProps <T extends DateValue> {
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
autoFocus?: boolean = false
children?: ReactNode | ((CalendarRenderProps & {
defaultChildren: ReactNode | undefined
})) => ReactNode
className?: string | ((CalendarRenderProps & {
defaultClassName: string | undefined
})) => string
defaultFocusedValue?: DateValue
- defaultValue?: DateValue | null | null
+ defaultValue?: DateValue | null
focusedValue?: DateValue
+ id?: string
isDateUnavailable?: (DateValue) => boolean
isDisabled?: boolean = false
isInvalid?: boolean
isReadOnly?: boolean = false
maxValue?: DateValue | null
minValue?: DateValue | null
- onChange?: (MappedDateValue<DateValue | null>) => void
+ onChange?: (MappedDateValue<DateValue>) => void
onFocusChange?: (CalendarDate) => void
pageBehavior?: PageBehavior = visible
slot?: string | null
style?: CSSProperties | ((CalendarRenderProps & {
defaultStyle: CSSProperties
})) => CSSProperties
- value?: DateValue | null | null
+ value?: DateValue | null
visibleDuration?: DateDuration = {months: 1}
} it changed:
RangeCalendarProps RangeCalendarProps <T extends DateValue> {
allowsNonContiguousRanges?: boolean
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
autoFocus?: boolean = false
children?: ReactNode | ((RangeCalendarRenderProps & {
defaultChildren: ReactNode | undefined
})) => ReactNode
className?: string | ((RangeCalendarRenderProps & {
defaultClassName: string | undefined
})) => string
defaultFocusedValue?: DateValue
- defaultValue?: RangeValue<DateValue | null>
+ defaultValue?: RangeValue<DateValue> | null
focusedValue?: DateValue
+ id?: string
isDateUnavailable?: (DateValue) => boolean
isDisabled?: boolean = false
isInvalid?: boolean
isReadOnly?: boolean = false
maxValue?: DateValue | null
minValue?: DateValue | null
onChange?: (T) => void
onFocusChange?: (CalendarDate) => void
pageBehavior?: PageBehavior = visible
slot?: string | null
style?: CSSProperties | ((RangeCalendarRenderProps & {
defaultStyle: CSSProperties
})) => CSSProperties
- value?: RangeValue<DateValue | null>
+ value?: RangeValue<DateValue> | null
visibleDuration?: DateDuration = {months: 1}
} it changed:
@react-aria/calendarAriaRangeCalendarProps AriaRangeCalendarProps <T extends DateValue> {
allowsNonContiguousRanges?: boolean
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
autoFocus?: boolean = false
defaultFocusedValue?: DateValue
- defaultValue?: RangeValue<DateValue>
+ defaultValue?: RangeValue<DateValue> | null
errorMessage?: ReactNode
focusedValue?: DateValue
id?: string
isDateUnavailable?: (DateValue) => boolean
isDisabled?: boolean = false
isInvalid?: boolean
isReadOnly?: boolean = false
maxValue?: DateValue | null
minValue?: DateValue | null
onChange?: (T) => void
onFocusChange?: (CalendarDate) => void
pageBehavior?: PageBehavior = visible
- value?: RangeValue<DateValue>
+ value?: RangeValue<DateValue> | null
} it changed:
RangeCalendarProps RangeCalendarProps <T extends DateValue | null> {
allowsNonContiguousRanges?: boolean
autoFocus?: boolean = false
defaultFocusedValue?: DateValue
- defaultValue?: RangeValue<DateValue | null>
+ defaultValue?: RangeValue<DateValue | null> | null
errorMessage?: ReactNode
focusedValue?: DateValue
isDateUnavailable?: (DateValue) => boolean
isDisabled?: boolean = false
isInvalid?: boolean
isReadOnly?: boolean = false
maxValue?: DateValue | null
minValue?: DateValue | null
onChange?: (T) => void
onFocusChange?: (CalendarDate) => void
pageBehavior?: PageBehavior = visible
- value?: RangeValue<DateValue | null>
+ value?: RangeValue<DateValue | null> | null
} it changed:
@react-spectrum/calendarRangeCalendar RangeCalendar <T extends DateValue> {
UNSAFE_className?: string
UNSAFE_style?: CSSProperties
alignSelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'center' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'stretch'>
allowsNonContiguousRanges?: boolean
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
autoFocus?: boolean = false
bottom?: Responsive<DimensionValue>
defaultFocusedValue?: DateValue
- defaultValue?: RangeValue<DateValue>
+ defaultValue?: RangeValue<DateValue> | null
end?: Responsive<DimensionValue>
errorMessage?: ReactNode
flex?: Responsive<string | number | boolean>
flexBasis?: Responsive<number | string>
flexGrow?: Responsive<number>
flexShrink?: Responsive<number>
focusedValue?: DateValue
gridArea?: Responsive<string>
gridColumn?: Responsive<string>
gridColumnEnd?: Responsive<string>
gridColumnStart?: Responsive<string>
gridRow?: Responsive<string>
gridRowEnd?: Responsive<string>
gridRowStart?: Responsive<string>
height?: Responsive<DimensionValue>
id?: string
isDateUnavailable?: (DateValue) => boolean
isDisabled?: boolean = false
isHidden?: Responsive<boolean>
isInvalid?: boolean
isReadOnly?: boolean = false
justifySelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'center' | 'left' | 'right' | 'stretch'>
left?: Responsive<DimensionValue>
margin?: Responsive<DimensionValue>
marginBottom?: Responsive<DimensionValue>
marginEnd?: Responsive<DimensionValue>
marginStart?: Responsive<DimensionValue>
marginTop?: Responsive<DimensionValue>
marginX?: Responsive<DimensionValue>
marginY?: Responsive<DimensionValue>
maxHeight?: Responsive<DimensionValue>
maxValue?: DateValue | null
maxWidth?: Responsive<DimensionValue>
minHeight?: Responsive<DimensionValue>
minValue?: DateValue | null
minWidth?: Responsive<DimensionValue>
onChange?: (DateValue) => void
onFocusChange?: (CalendarDate) => void
order?: Responsive<number>
pageBehavior?: PageBehavior = visible
position?: Responsive<'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'>
right?: Responsive<DimensionValue>
start?: Responsive<DimensionValue>
top?: Responsive<DimensionValue>
- value?: RangeValue<DateValue>
+ value?: RangeValue<DateValue> | null
visibleMonths?: number = 1
width?: Responsive<DimensionValue>
zIndex?: Responsive<number>
} SpectrumRangeCalendarProps SpectrumRangeCalendarProps <T extends DateValue> {
UNSAFE_className?: string
UNSAFE_style?: CSSProperties
alignSelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'center' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'stretch'>
allowsNonContiguousRanges?: boolean
aria-describedby?: string
aria-details?: string
aria-label?: string
aria-labelledby?: string
autoFocus?: boolean = false
bottom?: Responsive<DimensionValue>
defaultFocusedValue?: DateValue
- defaultValue?: RangeValue<DateValue>
+ defaultValue?: RangeValue<DateValue> | null
end?: Responsive<DimensionValue>
errorMessage?: ReactNode
flex?: Responsive<string | number | boolean>
flexBasis?: Responsive<number | string>
flexGrow?: Responsive<number>
flexShrink?: Responsive<number>
focusedValue?: DateValue
gridArea?: Responsive<string>
gridColumn?: Responsive<string>
gridColumnEnd?: Responsive<string>
gridColumnStart?: Responsive<string>
gridRow?: Responsive<string>
gridRowEnd?: Responsive<string>
gridRowStart?: Responsive<string>
height?: Responsive<DimensionValue>
id?: string
isDateUnavailable?: (DateValue) => boolean
isDisabled?: boolean = false
isHidden?: Responsive<boolean>
isInvalid?: boolean
isReadOnly?: boolean = false
justifySelf?: Responsive<'auto' | 'normal' | 'start' | 'end' | 'flex-start' | 'flex-end' | 'self-start' | 'self-end' | 'center' | 'left' | 'right' | 'stretch'>
left?: Responsive<DimensionValue>
margin?: Responsive<DimensionValue>
marginBottom?: Responsive<DimensionValue>
marginEnd?: Responsive<DimensionValue>
marginStart?: Responsive<DimensionValue>
marginTop?: Responsive<DimensionValue>
marginX?: Responsive<DimensionValue>
marginY?: Responsive<DimensionValue>
maxHeight?: Responsive<DimensionValue>
maxValue?: DateValue | null
maxWidth?: Responsive<DimensionValue>
minHeight?: Responsive<DimensionValue>
minValue?: DateValue | null
minWidth?: Responsive<DimensionValue>
onChange?: (T) => void
onFocusChange?: (CalendarDate) => void
order?: Responsive<number>
pageBehavior?: PageBehavior = visible
position?: Responsive<'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'>
right?: Responsive<DimensionValue>
start?: Responsive<DimensionValue>
top?: Responsive<DimensionValue>
- value?: RangeValue<DateValue>
+ value?: RangeValue<DateValue> | null
visibleMonths?: number = 1
width?: Responsive<DimensionValue>
zIndex?: Responsive<number>
} @react-stately/calendarRangeCalendarStateOptionschanged by:
RangeCalendarStateOptions <T extends DateValue = DateValue> {
allowsNonContiguousRanges?: boolean
autoFocus?: boolean = false
createCalendar: (string) => Calendar
defaultFocusedValue?: DateValue
- defaultValue?: RangeValue<DateValue | null>
+ defaultValue?: RangeValue<DateValue | null> | null
errorMessage?: ReactNode
focusedValue?: DateValue
isDateUnavailable?: (DateValue) => boolean
isDisabled?: boolean = false
isInvalid?: boolean
isReadOnly?: boolean = false
locale: string
maxValue?: DateValue | null
minValue?: DateValue | null
onChange?: (DateValue) => void
onFocusChange?: (CalendarDate) => void
pageBehavior?: PageBehavior = visible
- value?: RangeValue<DateValue | null>
+ value?: RangeValue<DateValue | null> | null
visibleDuration?: DateDuration = {months: 1}
} it changed:
|
Closes #6776
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: