-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: S2 DateField/DatePicker/Calendar #8428
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
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
# Conflicts: # yarn.lock
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
@@ -14,6 +14,7 @@ export {useCalendar} from './useCalendar'; | |||
export {useRangeCalendar} from './useRangeCalendar'; | |||
export {useCalendarGrid} from './useCalendarGrid'; | |||
export {useCalendarCell} from './useCalendarCell'; | |||
export {getEraFormat} from './utils'; |
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.
another way to do this? see RangeCalendar implementation for use
@@ -27,7 +27,8 @@ interface ContentProps extends UnsafeStyles, SlotProps { | |||
id?: string | |||
} | |||
|
|||
interface HeadingProps extends ContentProps { | |||
interface HeadingProps extends Omit<ContentProps, 'children'> { | |||
children?: ReactNode, |
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.
Needed to replace children in RangeCalendar
@@ -187,10 +188,11 @@ const fieldGroupStyles = style({ | |||
}); | |||
|
|||
export const FieldGroup = forwardRef(function FieldGroup(props: FieldGroupProps, ref: ForwardedRef<HTMLDivElement>) { | |||
let {shouldTurnOffFocusRing, ...otherProps} = 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.
date picker's button is focusable, and it's also inside the group, so needed a way to turn off the focus ring when the button has focus and has its own ring
* Whether the cell is today. | ||
* @selector [data-today] | ||
*/ | ||
isToday: boolean |
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.
figured this was a nice thing to expose, i could do it in Calendar directly though if we don't like it
@@ -448,7 +453,7 @@ export {CalendarHeaderCellForwardRef as CalendarHeaderCell}; | |||
|
|||
export interface CalendarGridBodyProps extends StyleProps { | |||
/** A function to render a `<CalendarCell>` for a given date. */ | |||
children: (date: CalendarDate) => ReactElement | |||
children: (date: CalendarDate, weekIndex: number, dayIndex: number) => ReactElement |
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.
needed to be able to determine what column a day was in for styling purposes so we can have a dashed border around ranges
better way to pass it along?
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.
hmm couldn't you calculate this from the date itself?
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.
I could, but the information already exists, so it seemed to make more sense not to do that calculation
I'll see how bad it is to calculate though
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.
Check commit aa7701d#diff-08206439985c4bfe014f71e8aa5df9fbe4cbcf4c478f4923e9f551cb2b4b2af7R473 to see if you like this better, or if you think of a better way to account for all the edge cases
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.
hmm yeah it is a bit complicated. maybe it is useful info to add to RAC. we should just consider the API. Probably should have passed an object to that function to make it extensible but would be a breaking change. I guess we could add a second options argument at least.
date: CalendarDate | ||
date: CalendarDate, | ||
/** The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the element. A function may be provided to compute the class based on component state. */ | ||
cellClassName?: string | ((values: CalendarCellRenderProps & {defaultClassName: string | undefined}) => string), |
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.
this has been asked for before, i forget where. right now there is no way to get styles or classnames on the td element of the table with all the days in it, so this adds that
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.
hmm this is weird. is there a way to avoid it?
# Conflicts: # packages/react-aria-components/src/Calendar.tsx
Build successful! 🎉 |
# Conflicts: # packages/@react-spectrum/s2/stories/utils.tsx
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
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.
The stories now freeze/crash for me when interacting (past 35ba8078c6a45223f7c11e49b0f30570858bbfe7) on Chrome Mac.
EDIT: Looks like this issue came from main, via #8327
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
## API Changes
react-aria-components/react-aria-components:CalendarCellRenderProps CalendarCellRenderProps {
date: CalendarDate
formattedDate: string
isDisabled: boolean
isFocusVisible: boolean
isFocused: boolean
isHovered: boolean
isInvalid: boolean
isOutsideMonth: boolean
isOutsideVisibleRange: boolean
isPressed: boolean
isSelected: boolean
isSelectionEnd: boolean
isSelectionStart: boolean
+ isToday: boolean
isUnavailable: boolean
} @react-aria/calendar/@react-aria/calendar:getEraFormat+getEraFormat {
+ date: CalendarDate | undefined
+ returnVal: undefined
+} @react-spectrum/s2/@react-spectrum/s2:Heading Heading {
UNSAFE_className?: UnsafeClassName
UNSAFE_style?: CSSProperties
- children: ReactNode
+ children?: ReactNode
id?: string
isHidden?: boolean
level?: number
slot?: string | null
} /@react-spectrum/s2:Calendar+Calendar <T extends DateValue> {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean = false
+ children?: ChildrenOrFunction<CalendarRenderProps>
+ createCalendar?: (CalendarIdentifier) => Calendar
+ defaultFocusedValue?: DateValue | null
+ defaultValue?: DateValue | null
+ errorMessage?: ReactNode
+ firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'
+ focusedValue?: DateValue | null
+ id?: string
+ isDateUnavailable?: (DateValue) => boolean
+ isDisabled?: boolean = false
+ isInvalid?: boolean
+ isReadOnly?: boolean = false
+ maxValue?: DateValue | null
+ minValue?: DateValue | null
+ onChange?: (MappedDateValue<DateValue>) => void
+ onFocusChange?: (CalendarDate) => void
+ pageBehavior?: PageBehavior = visible
+ slot?: string | null
+ styles?: StylesProp
+ value?: DateValue | null
+ visibleMonths?: number = 1
+} /@react-spectrum/s2:CalendarContext+CalendarContext {
+ UNTYPED
+} /@react-spectrum/s2:DateField+DateField <T extends DateValue> {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean
+ contextualHelp?: ReactNode
+ defaultValue?: DateValue | null
+ description?: ReactNode
+ errorMessage?: ReactNode | (ValidationResult) => ReactNode
+ form?: string
+ granularity?: Granularity
+ hideTimeZone?: boolean = false
+ hourCycle?: number | number
+ id?: string
+ isDateUnavailable?: (DateValue) => boolean
+ isDisabled?: boolean
+ isInvalid?: boolean
+ isReadOnly?: boolean
+ isRequired?: boolean
+ label?: ReactNode
+ labelAlign?: Alignment = 'start'
+ labelPosition?: LabelPosition = 'top'
+ maxValue?: DateValue | null
+ minValue?: DateValue | null
+ name?: string
+ necessityIndicator?: NecessityIndicator = 'icon'
+ onBlur?: (FocusEvent<Target>) => void
+ onChange?: (MappedDateValue<DateValue> | null) => void
+ onFocus?: (FocusEvent<Target>) => void
+ onFocusChange?: (boolean) => void
+ onKeyDown?: (KeyboardEvent) => void
+ onKeyUp?: (KeyboardEvent) => void
+ placeholderValue?: DateValue | null
+ shouldForceLeadingZeros?: boolean
+ size?: 'S' | 'M' | 'L' | 'XL' = 'M'
+ slot?: string | null
+ styles?: StylesProp
+ validate?: (MappedDateValue<DateValue>) => ValidationError | boolean | null | undefined
+ validationBehavior?: 'native' | 'aria' = 'native'
+ value?: DateValue | null
+} /@react-spectrum/s2:DateFieldContext+DateFieldContext {
+ UNTYPED
+} /@react-spectrum/s2:DatePicker+DatePicker <T extends DateValue> {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean
+ contextualHelp?: ReactNode
+ createCalendar?: (CalendarIdentifier) => Calendar
+ defaultOpen?: boolean
+ defaultValue?: DateValue | null
+ description?: ReactNode
+ errorMessage?: ReactNode | (ValidationResult) => ReactNode
+ firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'
+ form?: string
+ granularity?: Granularity
+ hideTimeZone?: boolean = false
+ hourCycle?: number | number
+ id?: string
+ isDateUnavailable?: (DateValue) => boolean
+ isDisabled?: boolean
+ isInvalid?: boolean
+ isOpen?: boolean
+ isReadOnly?: boolean
+ isRequired?: boolean
+ label?: ReactNode
+ labelAlign?: Alignment = 'start'
+ labelPosition?: LabelPosition = 'top'
+ maxValue?: DateValue | null
+ minValue?: DateValue | null
+ name?: string
+ necessityIndicator?: NecessityIndicator = 'icon'
+ onBlur?: (FocusEvent<Target>) => void
+ onChange?: (MappedDateValue<DateValue> | null) => void
+ onFocus?: (FocusEvent<Target>) => void
+ onFocusChange?: (boolean) => void
+ onKeyDown?: (KeyboardEvent) => void
+ onKeyUp?: (KeyboardEvent) => void
+ onOpenChange?: (boolean) => void
+ pageBehavior?: PageBehavior = visible
+ placeholderValue?: DateValue | null
+ shouldCloseOnSelect?: boolean | () => boolean = true
+ shouldForceLeadingZeros?: boolean
+ size?: 'S' | 'M' | 'L' | 'XL' = 'M'
+ slot?: string | null
+ styles?: StylesProp
+ validate?: (MappedDateValue<DateValue>) => ValidationError | boolean | null | undefined
+ validationBehavior?: 'native' | 'aria' = 'native'
+ value?: DateValue | null
+ visibleMonths?: number = 1
+} /@react-spectrum/s2:DatePickerContext+DatePickerContext {
+ UNTYPED
+} /@react-spectrum/s2:DateRangePicker+DateRangePicker <T extends DateValue> extends RangeCalendarProps {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ allowsNonContiguousRanges?: boolean
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean
+ contextualHelp?: ReactNode
+ defaultOpen?: boolean
+ defaultValue?: RangeValue<DateValue> | null
+ description?: ReactNode
+ endName?: string
+ errorMessage?: ReactNode | (ValidationResult) => ReactNode
+ firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'
+ form?: string
+ granularity?: Granularity
+ hideTimeZone?: boolean = false
+ hourCycle?: number | number
+ id?: string
+ isDateUnavailable?: (DateValue) => boolean
+ isDisabled?: boolean
+ isInvalid?: boolean
+ isOpen?: boolean
+ isReadOnly?: boolean
+ isRequired?: boolean
+ label?: ReactNode
+ labelAlign?: Alignment = 'start'
+ labelPosition?: LabelPosition = 'top'
+ maxValue?: DateValue | null
+ minValue?: DateValue | null
+ necessityIndicator?: NecessityIndicator = 'icon'
+ onBlur?: (FocusEvent<Target>) => void
+ onChange?: (RangeValue<MappedDateValue<DateValue>> | null) => void
+ onFocus?: (FocusEvent<Target>) => void
+ onFocusChange?: (boolean) => void
+ onKeyDown?: (KeyboardEvent) => void
+ onKeyUp?: (KeyboardEvent) => void
+ onOpenChange?: (boolean) => void
+ pageBehavior?: PageBehavior = visible
+ placeholderValue?: DateValue | null
+ shouldCloseOnSelect?: boolean | () => boolean = true
+ shouldForceLeadingZeros?: boolean
+ size?: 'S' | 'M' | 'L' | 'XL' = 'M'
+ slot?: string | null
+ startName?: string
+ styles?: StylesProp
+ validate?: (RangeValue<MappedDateValue<DateValue>>) => ValidationError | boolean | null | undefined
+ validationBehavior?: 'native' | 'aria' = 'native'
+ value?: RangeValue<DateValue> | null
+} /@react-spectrum/s2:DateRangePickerContext+DateRangePickerContext {
+ UNTYPED
+} /@react-spectrum/s2:RangeCalendar+RangeCalendar <T extends DateValue> {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ allowsNonContiguousRanges?: boolean
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean = false
+ children?: ChildrenOrFunction<RangeCalendarRenderProps>
+ createCalendar?: (CalendarIdentifier) => Calendar
+ defaultFocusedValue?: DateValue | null
+ defaultValue?: RangeValue<DateValue> | null
+ errorMessage?: ReactNode
+ firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'
+ focusedValue?: DateValue | null
+ id?: string
+ isDateUnavailable?: (DateValue) => boolean
+ isDisabled?: boolean = false
+ isInvalid?: boolean
+ isReadOnly?: boolean = false
+ maxValue?: DateValue | null
+ minValue?: DateValue | null
+ onChange?: (RangeValue<MappedDateValue<DateValue>>) => void
+ onFocusChange?: (CalendarDate) => void
+ pageBehavior?: PageBehavior = visible
+ slot?: string | null
+ styles?: StylesProp
+ value?: RangeValue<DateValue> | null
+ visibleMonths?: number = 1
+} /@react-spectrum/s2:RangeCalendarContext+RangeCalendarContext {
+ UNTYPED
+} /@react-spectrum/s2:TimeField+TimeField <T extends TimeValue> {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean
+ contextualHelp?: ReactNode
+ defaultValue?: TimeValue | null
+ description?: ReactNode
+ errorMessage?: ReactNode | (ValidationResult) => ReactNode
+ form?: string
+ granularity?: 'hour' | 'minute' | 'second' = 'minute'
+ hideTimeZone?: boolean
+ hourCycle?: number | number
+ id?: string
+ isDisabled?: boolean
+ isInvalid?: boolean
+ isReadOnly?: boolean
+ isRequired?: boolean
+ label?: ReactNode
+ labelAlign?: Alignment = 'start'
+ labelPosition?: LabelPosition = 'top'
+ maxValue?: TimeValue | null
+ minValue?: TimeValue | null
+ name?: string
+ necessityIndicator?: NecessityIndicator = 'icon'
+ onBlur?: (FocusEvent<Target>) => void
+ onChange?: (MappedTimeValue<TimeValue> | null) => void
+ onFocus?: (FocusEvent<Target>) => void
+ onFocusChange?: (boolean) => void
+ onKeyDown?: (KeyboardEvent) => void
+ onKeyUp?: (KeyboardEvent) => void
+ placeholderValue?: TimeValue
+ shouldForceLeadingZeros?: boolean
+ size?: 'S' | 'M' | 'L' | 'XL' = 'M'
+ slot?: string | null
+ styles?: StylesProp
+ validate?: (MappedTimeValue<TimeValue>) => ValidationError | boolean | null | undefined
+ validationBehavior?: 'native' | 'aria' = 'native'
+ value?: TimeValue | null
+} /@react-spectrum/s2:TimeFieldContext+TimeFieldContext {
+ UNTYPED
+} /@react-spectrum/s2:CalendarProps+CalendarProps <T extends DateValue> {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean = false
+ children?: ChildrenOrFunction<CalendarRenderProps>
+ createCalendar?: (CalendarIdentifier) => Calendar
+ defaultFocusedValue?: DateValue | null
+ defaultValue?: DateValue | null
+ errorMessage?: ReactNode
+ firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'
+ focusedValue?: DateValue | null
+ id?: string
+ isDateUnavailable?: (DateValue) => boolean
+ isDisabled?: boolean = false
+ isInvalid?: boolean
+ isReadOnly?: boolean = false
+ maxValue?: DateValue | null
+ minValue?: DateValue | null
+ onChange?: (MappedDateValue<DateValue>) => void
+ onFocusChange?: (CalendarDate) => void
+ pageBehavior?: PageBehavior = visible
+ slot?: string | null
+ styles?: StylesProp
+ value?: DateValue | null
+ visibleMonths?: number = 1
+} /@react-spectrum/s2:DateFieldProps+DateFieldProps <T extends DateValue> {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean
+ contextualHelp?: ReactNode
+ defaultValue?: DateValue | null
+ description?: ReactNode
+ errorMessage?: ReactNode | (ValidationResult) => ReactNode
+ form?: string
+ granularity?: Granularity
+ hideTimeZone?: boolean = false
+ hourCycle?: number | number
+ id?: string
+ isDateUnavailable?: (DateValue) => boolean
+ isDisabled?: boolean
+ isInvalid?: boolean
+ isReadOnly?: boolean
+ isRequired?: boolean
+ label?: ReactNode
+ labelAlign?: Alignment = 'start'
+ labelPosition?: LabelPosition = 'top'
+ maxValue?: DateValue | null
+ minValue?: DateValue | null
+ name?: string
+ necessityIndicator?: NecessityIndicator = 'icon'
+ onBlur?: (FocusEvent<Target>) => void
+ onChange?: (MappedDateValue<DateValue> | null) => void
+ onFocus?: (FocusEvent<Target>) => void
+ onFocusChange?: (boolean) => void
+ onKeyDown?: (KeyboardEvent) => void
+ onKeyUp?: (KeyboardEvent) => void
+ placeholderValue?: DateValue | null
+ shouldForceLeadingZeros?: boolean
+ size?: 'S' | 'M' | 'L' | 'XL' = 'M'
+ slot?: string | null
+ styles?: StylesProp
+ validate?: (MappedDateValue<DateValue>) => ValidationError | boolean | null | undefined
+ validationBehavior?: 'native' | 'aria' = 'native'
+ value?: DateValue | null
+} /@react-spectrum/s2:DatePickerProps+DatePickerProps <T extends DateValue> {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean
+ contextualHelp?: ReactNode
+ createCalendar?: (CalendarIdentifier) => Calendar
+ defaultOpen?: boolean
+ defaultValue?: DateValue | null
+ description?: ReactNode
+ errorMessage?: ReactNode | (ValidationResult) => ReactNode
+ firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'
+ form?: string
+ granularity?: Granularity
+ hideTimeZone?: boolean = false
+ hourCycle?: number | number
+ id?: string
+ isDateUnavailable?: (DateValue) => boolean
+ isDisabled?: boolean
+ isInvalid?: boolean
+ isOpen?: boolean
+ isReadOnly?: boolean
+ isRequired?: boolean
+ label?: ReactNode
+ labelAlign?: Alignment = 'start'
+ labelPosition?: LabelPosition = 'top'
+ maxValue?: DateValue | null
+ minValue?: DateValue | null
+ name?: string
+ necessityIndicator?: NecessityIndicator = 'icon'
+ onBlur?: (FocusEvent<Target>) => void
+ onChange?: (MappedDateValue<DateValue> | null) => void
+ onFocus?: (FocusEvent<Target>) => void
+ onFocusChange?: (boolean) => void
+ onKeyDown?: (KeyboardEvent) => void
+ onKeyUp?: (KeyboardEvent) => void
+ onOpenChange?: (boolean) => void
+ pageBehavior?: PageBehavior = visible
+ placeholderValue?: DateValue | null
+ shouldCloseOnSelect?: boolean | () => boolean = true
+ shouldForceLeadingZeros?: boolean
+ size?: 'S' | 'M' | 'L' | 'XL' = 'M'
+ slot?: string | null
+ styles?: StylesProp
+ validate?: (MappedDateValue<DateValue>) => ValidationError | boolean | null | undefined
+ validationBehavior?: 'native' | 'aria' = 'native'
+ value?: DateValue | null
+ visibleMonths?: number = 1
+} /@react-spectrum/s2:DateRangePickerProps+DateRangePickerProps <T extends DateValue> {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ allowsNonContiguousRanges?: boolean
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean
+ contextualHelp?: ReactNode
+ defaultOpen?: boolean
+ defaultValue?: RangeValue<DateValue> | null
+ description?: ReactNode
+ endName?: string
+ errorMessage?: ReactNode | (ValidationResult) => ReactNode
+ firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'
+ form?: string
+ granularity?: Granularity
+ hideTimeZone?: boolean = false
+ hourCycle?: number | number
+ id?: string
+ isDateUnavailable?: (DateValue) => boolean
+ isDisabled?: boolean
+ isInvalid?: boolean
+ isOpen?: boolean
+ isReadOnly?: boolean
+ isRequired?: boolean
+ label?: ReactNode
+ labelAlign?: Alignment = 'start'
+ labelPosition?: LabelPosition = 'top'
+ maxValue?: DateValue | null
+ minValue?: DateValue | null
+ necessityIndicator?: NecessityIndicator = 'icon'
+ onBlur?: (FocusEvent<Target>) => void
+ onChange?: (RangeValue<MappedDateValue<DateValue>> | null) => void
+ onFocus?: (FocusEvent<Target>) => void
+ onFocusChange?: (boolean) => void
+ onKeyDown?: (KeyboardEvent) => void
+ onKeyUp?: (KeyboardEvent) => void
+ onOpenChange?: (boolean) => void
+ pageBehavior?: PageBehavior = visible
+ placeholderValue?: DateValue | null
+ shouldCloseOnSelect?: boolean | () => boolean = true
+ shouldForceLeadingZeros?: boolean
+ size?: 'S' | 'M' | 'L' | 'XL' = 'M'
+ slot?: string | null
+ startName?: string
+ styles?: StylesProp
+ validate?: (RangeValue<MappedDateValue<DateValue>>) => ValidationError | boolean | null | undefined
+ validationBehavior?: 'native' | 'aria' = 'native'
+ value?: RangeValue<DateValue> | null
+} /@react-spectrum/s2:RangeCalendarProps+RangeCalendarProps <T extends DateValue> {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ allowsNonContiguousRanges?: boolean
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean = false
+ children?: ChildrenOrFunction<RangeCalendarRenderProps>
+ createCalendar?: (CalendarIdentifier) => Calendar
+ defaultFocusedValue?: DateValue | null
+ defaultValue?: RangeValue<DateValue> | null
+ errorMessage?: ReactNode
+ firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'
+ focusedValue?: DateValue | null
+ id?: string
+ isDateUnavailable?: (DateValue) => boolean
+ isDisabled?: boolean = false
+ isInvalid?: boolean
+ isReadOnly?: boolean = false
+ maxValue?: DateValue | null
+ minValue?: DateValue | null
+ onChange?: (RangeValue<MappedDateValue<DateValue>>) => void
+ onFocusChange?: (CalendarDate) => void
+ pageBehavior?: PageBehavior = visible
+ slot?: string | null
+ styles?: StylesProp
+ value?: RangeValue<DateValue> | null
+ visibleMonths?: number = 1
+} /@react-spectrum/s2:TimeFieldProps+TimeFieldProps <T extends TimeValue> {
+ UNSAFE_className?: UnsafeClassName
+ UNSAFE_style?: CSSProperties
+ aria-describedby?: string
+ aria-details?: string
+ aria-label?: string
+ aria-labelledby?: string
+ autoFocus?: boolean
+ contextualHelp?: ReactNode
+ defaultValue?: TimeValue | null
+ description?: ReactNode
+ errorMessage?: ReactNode | (ValidationResult) => ReactNode
+ form?: string
+ granularity?: 'hour' | 'minute' | 'second' = 'minute'
+ hideTimeZone?: boolean
+ hourCycle?: number | number
+ id?: string
+ isDisabled?: boolean
+ isInvalid?: boolean
+ isReadOnly?: boolean
+ isRequired?: boolean
+ label?: ReactNode
+ labelAlign?: Alignment = 'start'
+ labelPosition?: LabelPosition = 'top'
+ maxValue?: TimeValue | null
+ minValue?: TimeValue | null
+ name?: string
+ necessityIndicator?: NecessityIndicator = 'icon'
+ onBlur?: (FocusEvent<Target>) => void
+ onChange?: (MappedTimeValue<TimeValue> | null) => void
+ onFocus?: (FocusEvent<Target>) => void
+ onFocusChange?: (boolean) => void
+ onKeyDown?: (KeyboardEvent) => void
+ onKeyUp?: (KeyboardEvent) => void
+ placeholderValue?: TimeValue
+ shouldForceLeadingZeros?: boolean
+ size?: 'S' | 'M' | 'L' | 'XL' = 'M'
+ slot?: string | null
+ styles?: StylesProp
+ validate?: (MappedTimeValue<TimeValue>) => ValidationError | boolean | null | undefined
+ validationBehavior?: 'native' | 'aria' = 'native'
+ value?: TimeValue | null
+} |
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.
So now there's one extra px of padding around the cells in S2?
Ok if you want to get it merged but let's make sure to resolve the API questions before release.
@@ -502,6 +507,8 @@ export const CalendarCell = /*#__PURE__*/ (forwardRef as forwardRefType)(functio | |||
let state = calendarState ?? rangeCalendarState!; | |||
let {startDate: currentMonth} = useContext(InternalCalendarGridContext) ?? {startDate: state.visibleRange.start}; | |||
let isOutsideMonth = !isSameMonth(currentMonth, date); | |||
// TODO: check api with team, this seemed useful though |
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.
these kinds of comments are better on the PR itself, that way you don't need to update the code to remove it 😉
@@ -73,7 +73,7 @@ export const DatePickerStateContext = createContext<DatePickerState | null>(null | |||
export const DateRangePickerStateContext = createContext<DateRangePickerState | null>(null); | |||
|
|||
// Contexts to clear inside the popover. | |||
const CLEAR_CONTEXTS = [GroupContext, ButtonContext, LabelContext, TextContext]; | |||
const CLEAR_CONTEXTS = [GroupContext, ButtonContext, LabelContext, TextContext, OverlayTriggerStateContext]; |
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.
how is OverlayTriggerStateContext related to the hover state?
@devongovett
I figured it was pretty safe to stop the context, however, i could see an argument that s2 should be the one to stop it, or that we should use something else to set that hovered state in s2 |
Closes
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: