-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[pickers] New MobileDateRangePicker
, DesktopDateRangePicker
, DateRangePicker
and StaticDateRangePicker
based on MultiInputDateRangeField
#6888
Conversation
…ePicker and StaticDateRangePicker based on MultiInputDateRangeField
These are the results for the performance tests:
|
* We don't pass all the props down to `DateRangeCalendar`, | ||
* because otherwise some unwanted props would be passed to the HTML element. | ||
*/ | ||
export const renderDateRangeView = <TDate extends unknown>({ |
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.
If you have a better solution here, I'm interested
At least it is centralized 😬
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.
Not sure their is a better way than listing the props that can be passed. The other options would be to stop them when rendering the HTML element which does not seems better
controlled: inValue, | ||
default: defaultValue ?? valueManager.emptyValue, | ||
name: 'usePickerState2', | ||
state: 'value', | ||
}); | ||
|
||
const value = React.useMemo( |
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 forgot to apply this change on the new pickers when doing #6170 and it causes a bug on the range picker when the date is not valid
import { SlotComponentProps } from '@mui/base/utils'; | ||
import TextField, { TextFieldProps } from '@mui/material/TextField'; | ||
import type { UseFieldInternalProps } from '../hooks/useField'; | ||
|
||
export interface BaseFieldProps<TValue, TError> | ||
extends Omit<UseFieldInternalProps<TValue, TError>, 'format'> { | ||
className?: 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.
Not related to this PR, I forgot to extract it
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.
Seems to work well 👍
API changes
MobileDateRangePicker
Remove mask related props
acceptRegex
disableMaskedInput
ignoreInvalidInputs
mask
rifmFormatter
Use component slots everywhere
InputProps
=>componentsProps.input.InputProps
renderInput
=>components.Field
/components.Input
/components.FieldRoot
/components.FieldSeparator
depending on the use caseRemove props already not used in v5
children
InputAdornmentProps
OpenPickerButtonProps
OpenPickerIcon
inputRef
label
onViewChange
getOpenDialogAriaText
shouldDisableMonth
shouldDisableYear
Prop renaming
inputFormat
=>format
DesktopDateRangePicker
Remove mask related props
acceptRegex
disableMaskedInput
ignoreInvalidInputs
mask
rifmFormatter
Use component slots everywhere
InputProps
=>componentsProps.input.InputProps
renderInput
=>components.Field
/components.Input
/components.FieldRoot
/components.FieldSeparator
depending on the use caseRemove props already not used in v5
children
InputAdornmentProps
OpenPickerButtonProps
OpenPickerIcon
inputRef
label
onViewChange
getOpenDialogAriaText
shouldDisableMonth
shouldDisableYear
Prop renaming
inputFormat
=>format
DateRangePicker
Remove mask related props
acceptRegex
disableMaskedInput
ignoreInvalidInputs
mask
rifmFormatter
Use component slots everywhere
InputProps
=>componentsProps.input.InputProps
renderInput
=>components.Field
/components.Input
/components.FieldRoot
/components.FieldSeparator
depending on the use caseRemove props already not used in v5
children
InputAdornmentProps
OpenPickerButtonProps
OpenPickerIcon
inputRef
label
onViewChange
getOpenDialogAriaText
shouldDisableMonth
shouldDisableYear
Prop renaming
inputFormat
=>format
StaticDateRangePicker
Remove mask related props
acceptRegex
disableMaskedInput
ignoreInvalidInputs
mask
rifmFormatter
Remove keyboard editing related props (no more keyboard mode on the mobile toolbar)
renderInput
InputProps
inputFormat
Remove props already not used in v5
InputAdornmentProps
OpenPickerButtonProps
OpenPickerIcon
inputRef
label
onViewChange
getOpenDialogAriaText
shouldDisableMonth
shouldDisableYear
closeOnSelect
disableOpenPicker