Skip to content
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] Move the opening logic to the range fields #16175

Draft
wants to merge 221 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
221 commits
Select commit Hold shift + click to select a range
5d145b6
[pickers] Replace TValue and TSection generics with TIsRange
flaviendelangle Nov 5, 2024
a8f316d
Merge branch 'master' into tisrange
flaviendelangle Nov 6, 2024
6ed4952
Fix CI
flaviendelangle Nov 6, 2024
5904738
Merge
flaviendelangle Nov 6, 2024
5419886
Merge branch 'master' into tisrange
flaviendelangle Nov 7, 2024
5c34425
Merge branch 'master' into tisrange
flaviendelangle Nov 8, 2024
bbd4fe2
[pickers] Introduce an improved version of the value manager
flaviendelangle Nov 8, 2024
7821632
Work on value manager usage
flaviendelangle Nov 12, 2024
3a73dd3
Merge
flaviendelangle Nov 12, 2024
dc89d3c
Merge branch 'tisrange' into v8-value-manager
flaviendelangle Nov 12, 2024
eda4787
Work
flaviendelangle Nov 13, 2024
f7ee409
Fix
flaviendelangle Nov 13, 2024
b04e5bb
Merge branch 'master' into tisrange
flaviendelangle Nov 13, 2024
cae8762
Work
flaviendelangle Nov 13, 2024
f06c8ca
Work
flaviendelangle Nov 13, 2024
48c9261
Merge branch 'tisrange' into v8-value-manager
flaviendelangle Nov 13, 2024
20805bd
Fix'
flaviendelangle Nov 13, 2024
f6b78d9
Work
flaviendelangle Nov 13, 2024
d47da98
Fix
flaviendelangle Nov 13, 2024
7eebeb7
Merge
flaviendelangle Nov 14, 2024
3493484
Merge branch 'tisrange' into v8-value-manager
flaviendelangle Nov 14, 2024
3a52a82
Review: Lukas
flaviendelangle Nov 14, 2024
3e18240
Review: Lukas
flaviendelangle Nov 14, 2024
8aae145
Remove as
flaviendelangle Nov 14, 2024
49b7030
Merge branch 'tisrange' into v8-value-manager
flaviendelangle Nov 14, 2024
ae71f10
Move value manager to hookss
flaviendelangle Nov 14, 2024
4dbfd03
xImprove internals
flaviendelangle Nov 14, 2024
6993047
Merge branch 'master' into tisrange
flaviendelangle Nov 14, 2024
9e7e9aa
Fix
flaviendelangle Nov 14, 2024
0d6562c
Merge branch 'master' into tisrange
flaviendelangle Nov 15, 2024
6066a59
Work
flaviendelangle Nov 15, 2024
d1ca6a4
Fix
flaviendelangle Nov 15, 2024
407ec45
[pickers] Remove TSection and stictly type TValue
flaviendelangle Nov 15, 2024
d7661ae
Merge
flaviendelangle Nov 15, 2024
b7ac3ee
Fix
flaviendelangle Nov 18, 2024
db88d0e
Fix
flaviendelangle Nov 18, 2024
8c30f22
Merge branch 'tvalue' into v8-value-manager
flaviendelangle Nov 18, 2024
78df9d0
Fix
flaviendelangle Nov 18, 2024
5625c29
Merge branch 'master' into tvalue
flaviendelangle Nov 18, 2024
25bb456
Fix
flaviendelangle Nov 18, 2024
2bab784
Add migration guide
flaviendelangle Nov 18, 2024
3f8e296
Improve migration guide
flaviendelangle Nov 18, 2024
24dbb6d
Merge branch 'master' into v8-value-manager
flaviendelangle Nov 18, 2024
b866d81
Remove useless changes
flaviendelangle Nov 18, 2024
bea99a0
Merge branch 'tvalue' into v8-value-manager
flaviendelangle Nov 18, 2024
c39d33f
Fix
flaviendelangle Nov 18, 2024
0429717
Work
flaviendelangle Nov 18, 2024
59dc346
Improve JSDoc
flaviendelangle Nov 18, 2024
f895380
Merge branch 'master' into tvalue
flaviendelangle Nov 18, 2024
81643d9
Merge branch 'tvalue' into v8-value-manager
flaviendelangle Nov 18, 2024
21c8518
Work
flaviendelangle Nov 18, 2024
74df222
WOrk
flaviendelangle Nov 18, 2024
fe6d825
Merge branch 'master' into tvalue
flaviendelangle Nov 19, 2024
0d60ce3
Merge branch 'tvalue' into v8-value-manager
flaviendelangle Nov 19, 2024
b0e3265
Merge
flaviendelangle Nov 19, 2024
c0c7db8
Merge branch 'tvalue' into v8-value-manager
flaviendelangle Nov 19, 2024
e7f5500
Fix
flaviendelangle Nov 19, 2024
eb563eb
Merge branch 'tvalue' into v8-value-manager
flaviendelangle Nov 19, 2024
f6b087a
Merge
flaviendelangle Nov 20, 2024
4dd3038
Merge branch 'tvalue' into v8-value-manager
flaviendelangle Nov 20, 2024
3eb5a04
Fix
flaviendelangle Nov 20, 2024
dfb54b7
[pickers] POC: Use the new managers for the multi input range fields
flaviendelangle Nov 20, 2024
86d64e2
Clean
flaviendelangle Nov 20, 2024
2466fe5
Fix
flaviendelangle Nov 21, 2024
cca2a37
Fix
flaviendelangle Nov 21, 2024
745524d
Merge
flaviendelangle Nov 22, 2024
18b3087
Merge branch 'tvalue' into v8-value-manager
flaviendelangle Nov 22, 2024
04657b1
Merge
flaviendelangle Nov 22, 2024
01fd0cb
Merge branch 'master' into tvalue
flaviendelangle Nov 25, 2024
f941b8e
Merge branch 'tvalue' into v8-value-manager
flaviendelangle Nov 25, 2024
a1a048d
Fix
flaviendelangle Nov 25, 2024
6acfe09
Merge
flaviendelangle Nov 25, 2024
b86cfc0
Fix
flaviendelangle Nov 25, 2024
8b742d8
Merge
flaviendelangle Nov 26, 2024
43b1180
Merge
flaviendelangle Nov 26, 2024
a6c60c3
Merge branch 'v8-value-manager' into use-managert-for-multi-input-ran…
flaviendelangle Nov 26, 2024
e47e9fd
Update docs/data/migration/migration-pickers-v7/migration-pickers-v7.md
flaviendelangle Nov 28, 2024
4452039
Merge branch 'master' into tvalue
flaviendelangle Nov 28, 2024
e5406e7
Fix
flaviendelangle Nov 28, 2024
2823188
Merge branch 'master' into tvalue
flaviendelangle Nov 28, 2024
f653f35
Merge branch 'tvalue' into v8-value-manager
flaviendelangle Nov 28, 2024
4efb66d
Merge
flaviendelangle Nov 28, 2024
45ec78d
Merge branch 'master' into v8-value-manager
flaviendelangle Nov 28, 2024
0d7063a
Merge branch 'master' into v8-value-manager
flaviendelangle Nov 28, 2024
00b9085
Merge branch 'master' into v8-value-manager
flaviendelangle Dec 4, 2024
317cbcf
Merge remote-tracking branch 'origin/v8-value-manager' into v8-value-…
flaviendelangle Dec 4, 2024
fb5d76a
Merge
flaviendelangle Dec 4, 2024
fd2637f
Work
flaviendelangle Dec 4, 2024
33ff5bd
Fix CI
flaviendelangle Dec 4, 2024
141bc7b
Work
flaviendelangle Dec 4, 2024
d945591
Work
flaviendelangle Dec 4, 2024
95fff46
Fix
flaviendelangle Dec 4, 2024
bca78fa
Fix
flaviendelangle Dec 4, 2024
b74367c
Work
flaviendelangle Dec 4, 2024
314b084
Work
flaviendelangle Dec 4, 2024
206b96b
Work on doc multi input examples
flaviendelangle Dec 4, 2024
c57bd09
Fix
flaviendelangle Dec 4, 2024
4192ee3
Merge branch 'master' into use-managert-for-multi-input-range-picker
flaviendelangle Dec 4, 2024
bc5a2d4
Work
flaviendelangle Dec 4, 2024
ca36470
Merge branch 'master' into v8-value-manager
flaviendelangle Dec 4, 2024
03bdcb0
Merge branch 'v8-value-manager' into use-managert-for-multi-input-ran…
flaviendelangle Dec 4, 2024
392a906
Work
flaviendelangle Dec 5, 2024
9973be5
Work
flaviendelangle Dec 5, 2024
5c4f636
Merge branch 'master' into use-managert-for-multi-input-range-picker
flaviendelangle Dec 5, 2024
e281a09
Work
flaviendelangle Dec 5, 2024
5ace66e
Fix
flaviendelangle Dec 5, 2024
f7ab06b
Fix
flaviendelangle Dec 5, 2024
9c98c1e
Fix
flaviendelangle Dec 5, 2024
4adc5c9
Fix
flaviendelangle Dec 5, 2024
2cf885b
Fix tests
flaviendelangle Dec 5, 2024
6f7c7f3
Merge branch 'master' into v8-value-manager
flaviendelangle Dec 9, 2024
d1039ff
Merge branch 'v8-value-manager' into use-managert-for-multi-input-ran…
flaviendelangle Dec 9, 2024
f1527a1
Fix
flaviendelangle Dec 9, 2024
a2ebfed
Merge branch 'master' into v8-value-manager
flaviendelangle Dec 13, 2024
1904587
Merge branch 'v8-value-manager' into use-managert-for-multi-input-ran…
flaviendelangle Dec 13, 2024
3230e1d
Merge
flaviendelangle Dec 19, 2024
8efb2ce
Merge branch 'v8-value-manager' into use-managert-for-multi-input-ran…
flaviendelangle Dec 19, 2024
4d63e80
Merge
flaviendelangle Dec 30, 2024
e8303e9
Merge
flaviendelangle Dec 30, 2024
245c08f
Merge branch 'master' into v8-value-manager
flaviendelangle Dec 31, 2024
9aa4af7
Merge
flaviendelangle Dec 31, 2024
de8daed
Merge
flaviendelangle Dec 31, 2024
e002b5d
Merge
flaviendelangle Dec 31, 2024
79c03d6
Merge
flaviendelangle Dec 31, 2024
f197ce6
Merge branch 'master' into use-managert-for-multi-input-range-picker
flaviendelangle Dec 31, 2024
6302799
Merge branch 'master' into use-managert-for-multi-input-range-picker
flaviendelangle Jan 2, 2025
552d4a9
Change the approach
flaviendelangle Jan 3, 2025
7ea3bbf
Work
flaviendelangle Jan 3, 2025
96ef4b3
Work
flaviendelangle Jan 3, 2025
3945121
Work
flaviendelangle Jan 3, 2025
076f2d8
Fix
flaviendelangle Jan 3, 2025
612bd88
Fix
flaviendelangle Jan 3, 2025
c024190
Fix
flaviendelangle Jan 3, 2025
c40d198
Revert test changes
flaviendelangle Jan 3, 2025
5862c49
Revert test changes
flaviendelangle Jan 3, 2025
963271c
Revert changes
flaviendelangle Jan 3, 2025
b9cd954
Add migration guide
flaviendelangle Jan 3, 2025
aba3fd4
Fix
flaviendelangle Jan 3, 2025
f21f874
Mergeg
flaviendelangle Jan 10, 2025
e3629be
Fix
flaviendelangle Jan 10, 2025
b04de7b
Merge branch 'master' into use-managert-for-multi-input-range-picker
flaviendelangle Jan 10, 2025
83af35e
Merge branch 'master' into use-managert-for-multi-input-range-picker
flaviendelangle Jan 10, 2025
70fdc9b
Merge
flaviendelangle Jan 14, 2025
78e83f8
[pickers] Move the opening logic to the range fields
flaviendelangle Jan 14, 2025
e786718
Merge
flaviendelangle Jan 15, 2025
03c7211
Fix merge
flaviendelangle Jan 15, 2025
e2c9609
Work
flaviendelangle Jan 15, 2025
1a6a31a
Work
flaviendelangle Jan 15, 2025
5f402b7
Merge branch 'master' into multi-input-opening-logic
flaviendelangle Jan 20, 2025
7dc45de
Work
flaviendelangle Jan 20, 2025
c6c74f7
Merge branch 'master' into multi-input-opening-logic
flaviendelangle Jan 20, 2025
a4f8bc7
Work on day calendar keyboard navigation
flaviendelangle Jan 20, 2025
81d2f01
Work
flaviendelangle Jan 20, 2025
251f18c
Merge branch 'master' into multi-input-opening-logic
flaviendelangle Jan 20, 2025
baed3a9
Work
flaviendelangle Jan 20, 2025
62da49a
Work
flaviendelangle Jan 20, 2025
495c291
Work
flaviendelangle Jan 20, 2025
994dae6
Work
flaviendelangle Jan 20, 2025
bf17eb3
Work
flaviendelangle Jan 20, 2025
598dc70
Work
flaviendelangle Jan 20, 2025
5baa3b8
Work
flaviendelangle Jan 20, 2025
e24ecb1
Work
flaviendelangle Jan 20, 2025
bfa75db
Work
flaviendelangle Jan 20, 2025
24f825a
Work
flaviendelangle Jan 20, 2025
daef6a9
Work
flaviendelangle Jan 20, 2025
cca3454
Merge branch 'master' into multi-input-opening-logic
flaviendelangle Jan 21, 2025
51c48be
Fix
flaviendelangle Jan 21, 2025
0b2a9a2
[pickers] Move more field props to the context
flaviendelangle Jan 21, 2025
8b82734
Work
flaviendelangle Jan 21, 2025
81815c1
Work
flaviendelangle Jan 21, 2025
3eb36a4
Work
flaviendelangle Jan 21, 2025
adbee54
Add migration guide
flaviendelangle Jan 21, 2025
e8b185e
Work on demos
flaviendelangle Jan 21, 2025
f3127ec
Work
flaviendelangle Jan 21, 2025
961ae6a
Merge branch 'master' into field-context-ui
flaviendelangle Jan 21, 2025
deb5dc3
Fix
flaviendelangle Jan 21, 2025
d6e49f1
Fix
flaviendelangle Jan 21, 2025
f0bb11a
Fix
flaviendelangle Jan 21, 2025
39ae9ae
Fix more docs demos
flaviendelangle Jan 21, 2025
ed58d9a
Fix
flaviendelangle Jan 21, 2025
2e85d2e
Merge
flaviendelangle Jan 22, 2025
252f111
Fix
flaviendelangle Jan 22, 2025
47b669f
Fix
flaviendelangle Jan 22, 2025
de95aea
Fix
flaviendelangle Jan 22, 2025
7d6fbd3
Remove field ownerState
flaviendelangle Jan 22, 2025
d78b026
Merge branch 'master' into field-context-ui
flaviendelangle Jan 23, 2025
52e7629
Fix CI
flaviendelangle Jan 23, 2025
4702701
Merge branch 'master' into field-context-ui
flaviendelangle Jan 23, 2025
6944ac4
Merge remote-tracking branch 'origin/multi-input-opening-logic' into …
flaviendelangle Jan 23, 2025
3c30a96
Work
flaviendelangle Jan 23, 2025
a5c4a08
Fix
flaviendelangle Jan 24, 2025
17b6154
Move ref to context
flaviendelangle Jan 24, 2025
f645dc7
Add migration-guide
flaviendelangle Jan 24, 2025
c5a6b8c
Work
flaviendelangle Jan 24, 2025
51ef7a0
Work
flaviendelangle Jan 24, 2025
9b9ea88
Fix
flaviendelangle Jan 24, 2025
b252aef
Merge branch 'master' into field-context-ui
flaviendelangle Jan 24, 2025
251e001
Merge
flaviendelangle Jan 24, 2025
2fe7d1a
Improve JSDoc
flaviendelangle Jan 24, 2025
1ac0c16
Merge branch 'field-context-ui' into multi-input-opening-logic
flaviendelangle Jan 24, 2025
2d049b1
Merge
flaviendelangle Jan 28, 2025
8c9a839
Fix
flaviendelangle Jan 28, 2025
07cf56b
[DateRangeCalendar] Add proper keyboard navigation
flaviendelangle Jan 28, 2025
71fa5b2
Work
flaviendelangle Jan 28, 2025
4148130
Work
flaviendelangle Jan 28, 2025
59f87f2
Work
flaviendelangle Jan 28, 2025
e086759
Work
flaviendelangle Jan 28, 2025
a0a095c
Fix
flaviendelangle Jan 29, 2025
85692b1
Merge branch 'master' into multi-input-opening-logic
flaviendelangle Jan 29, 2025
a94cad8
Merge branch 'master' into date-range-calendar-keyboard
flaviendelangle Jan 29, 2025
25b6e84
Work
flaviendelangle Jan 29, 2025
0b0296f
Fix
flaviendelangle Jan 29, 2025
2686194
Fix
flaviendelangle Jan 29, 2025
b66fac5
Merge branch 'date-range-calendar-keyboard' into multi-input-opening-…
flaviendelangle Jan 29, 2025
037d336
Work
flaviendelangle Jan 29, 2025
85e9e54
Fi
flaviendelangle Jan 29, 2025
734a9e2
Fix
flaviendelangle Jan 29, 2025
c7be2b8
Fix
flaviendelangle Jan 29, 2025
1c62890
Clean
flaviendelangle Jan 29, 2025
c5b6ff3
Merge branch 'date-range-calendar-keyboard' into multi-input-opening-…
flaviendelangle Jan 29, 2025
a1ff657
Work
flaviendelangle Jan 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/data/date-pickers/calendar-systems/AdapterHijri.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const cacheRtl = createCache({

function ButtonDateTimeField(props) {
const { internalProps, forwardedProps } = useSplitFieldProps(props, 'date');
const { focused, ...other } = forwardedProps;

const pickerContext = usePickerContext();
const parsedFormat = useParsedFormat();
Expand All @@ -42,7 +41,7 @@ function ButtonDateTimeField(props) {

return (
<Button
{...other}
{...forwardedProps}
variant="outlined"
color={hasValidationError ? 'error' : 'primary'}
className={pickerContext.rootClassName}
Expand Down
3 changes: 1 addition & 2 deletions docs/data/date-pickers/calendar-systems/AdapterHijri.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const cacheRtl = createCache({

function ButtonDateTimeField(props: DateTimePickerFieldProps) {
const { internalProps, forwardedProps } = useSplitFieldProps(props, 'date');
const { focused, ...other } = forwardedProps;

const pickerContext = usePickerContext();
const parsedFormat = useParsedFormat();
Expand All @@ -46,7 +45,7 @@ function ButtonDateTimeField(props: DateTimePickerFieldProps) {

return (
<Button
{...other}
{...forwardedProps}
variant="outlined"
color={hasValidationError ? 'error' : 'primary'}
className={pickerContext.rootClassName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { styled } from '@mui/material/styles';
import Stack from '@mui/material/Stack';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { usePickerContext, useSplitFieldProps } from '@mui/x-date-pickers/hooks';
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';
import { useDateRangeManager } from '@mui/x-date-pickers-pro/managers';
import { unstable_useMultiInputRangeField as useMultiInputRangeField } from '@mui/x-date-pickers-pro/hooks';
Expand Down Expand Up @@ -75,7 +75,6 @@ function BrowserTextField(props) {
}

function BrowserMultiInputDateRangeField(props) {
const pickerContext = usePickerContext();
const manager = useDateRangeManager();
const { internalProps, forwardedProps } = useSplitFieldProps(props, 'date');
const { slotProps, ...otherForwardedProps } = forwardedProps;
Expand All @@ -95,21 +94,21 @@ function BrowserMultiInputDateRangeField(props) {
const fieldResponse = useMultiInputRangeField({
manager,
internalProps,
startForwardedProps: startTextFieldProps,
endForwardedProps: endTextFieldProps,
startTextFieldProps,
endTextFieldProps,
rootProps: {
spacing: 2,
direction: 'row',
overflow: 'auto',
...otherForwardedProps,
},
});

return (
<Stack
ref={pickerContext.rootRef}
spacing={2}
direction="row"
overflow="auto"
{...otherForwardedProps}
>
<BrowserTextField {...fieldResponse.startDate} />
<Stack {...fieldResponse.root}>
<BrowserTextField {...fieldResponse.startTextField} />
<span>–</span>
<BrowserTextField {...fieldResponse.endDate} />
<BrowserTextField {...fieldResponse.endTextField} />
</Stack>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ interface BrowserMultiInputDateRangeFieldProps
function BrowserMultiInputDateRangeField(
props: BrowserMultiInputDateRangeFieldProps,
) {
const pickerContext = usePickerContext();
const manager = useDateRangeManager();
const { internalProps, forwardedProps } = useSplitFieldProps(props, 'date');
const { slotProps, ...otherForwardedProps } = forwardedProps;
Expand All @@ -129,21 +128,23 @@ function BrowserMultiInputDateRangeField(
const fieldResponse = useMultiInputRangeField({
manager,
internalProps,
startForwardedProps: startTextFieldProps,
endForwardedProps: endTextFieldProps,
startTextFieldProps,
endTextFieldProps,
rootProps: {
spacing: 2,
direction: 'row' as const,
overflow: 'auto',
...otherForwardedProps,
},
});

return (
<Stack
ref={pickerContext.rootRef}
spacing={2}
direction="row"
overflow="auto"
{...otherForwardedProps}
>
<BrowserTextField {...(fieldResponse.startDate as BrowserTextFieldProps)} />
<Stack {...fieldResponse.root}>
<BrowserTextField
{...(fieldResponse.startTextField as BrowserTextFieldProps)}
/>
<span>–</span>
<BrowserTextField {...(fieldResponse.endDate as BrowserTextFieldProps)} />
<BrowserTextField {...(fieldResponse.endTextField as BrowserTextFieldProps)} />
</Stack>
);
}
Expand Down
1 change: 0 additions & 1 deletion docs/data/date-pickers/custom-field/JoyV6Field.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ function JoyDateField(props) {
// Can be used to style the component
disabled,
readOnly,
focused,
error,
inputRef,
// The rest can be passed to the root element
Expand Down
1 change: 0 additions & 1 deletion docs/data/date-pickers/custom-field/JoyV6Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ function JoyDateField(props: DatePickerFieldProps) {
// Can be used to style the component
disabled,
readOnly,
focused,
error,
inputRef,

Expand Down
27 changes: 15 additions & 12 deletions docs/data/date-pickers/custom-field/JoyV6MultiInputRangeField.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,36 +79,39 @@ function JoyMultiInputDateRangeField(props) {
const startTextFieldProps = useSlotProps({
elementType: 'input',
externalSlotProps: slotProps?.textField,
additionalProps: { label: 'Start' },
ownerState: { position: 'start' },
});

const endTextFieldProps = useSlotProps({
elementType: 'input',
externalSlotProps: slotProps?.textField,
additionalProps: { label: 'End' },
ownerState: { position: 'end' },
});

const fieldResponse = useMultiInputRangeField({
manager,
internalProps: { ...internalProps, enableAccessibleFieldDOMStructure: false },
startForwardedProps: startTextFieldProps,
endForwardedProps: endTextFieldProps,
rootProps: {
ref: pickerContext.rootRef,
spacing: 2,
overflow: 'auto',
direction: 'row',
alignItems: 'center',
...otherForwardedProps,
},
startTextFieldProps,
endTextFieldProps,
});

return (
<Stack
spacing={2}
overflow="auto"
direction="row"
alignItems="center"
{...otherForwardedProps}
ref={pickerContext.rootRef}
>
<JoyField {...fieldResponse.startDate} />
<Stack {...fieldResponse.root}>
<JoyField {...fieldResponse.startTextField} />
<FormControl>
<Typography sx={{ marginTop: '25px' }}>{' – '}</Typography>
</FormControl>
<JoyField {...fieldResponse.endDate} />
<JoyField {...fieldResponse.endTextField} />
</Stack>
);
}
Expand Down
27 changes: 15 additions & 12 deletions docs/data/date-pickers/custom-field/JoyV6MultiInputRangeField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,36 +110,39 @@ function JoyMultiInputDateRangeField(props: JoyMultiInputDateRangeFieldProps) {
const startTextFieldProps = useSlotProps({
elementType: 'input',
externalSlotProps: slotProps?.textField,
additionalProps: { label: 'Start' },
ownerState: { position: 'start' } as any,
}) as MultiInputFieldSlotTextFieldProps;

const endTextFieldProps = useSlotProps({
elementType: 'input',
externalSlotProps: slotProps?.textField,
additionalProps: { label: 'End' },
ownerState: { position: 'end' } as any,
}) as MultiInputFieldSlotTextFieldProps;

const fieldResponse = useMultiInputRangeField({
manager,
internalProps: { ...internalProps, enableAccessibleFieldDOMStructure: false },
startForwardedProps: startTextFieldProps,
endForwardedProps: endTextFieldProps,
rootProps: {
ref: pickerContext.rootRef,
spacing: 2,
overflow: 'auto',
direction: 'row' as const,
alignItems: 'center',
...otherForwardedProps,
},
startTextFieldProps,
endTextFieldProps,
});

return (
<Stack
spacing={2}
overflow="auto"
direction="row"
alignItems="center"
{...otherForwardedProps}
ref={pickerContext.rootRef}
>
<JoyField {...fieldResponse.startDate} />
<Stack {...fieldResponse.root}>
<JoyField {...fieldResponse.startTextField} />
<FormControl>
<Typography sx={{ marginTop: '25px' }}>{' – '}</Typography>
</FormControl>
<JoyField {...fieldResponse.endDate} />
<JoyField {...fieldResponse.endTextField} />
</Stack>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useValidation, validateDate } from '@mui/x-date-pickers/validation';
function AutocompleteField(props) {
const { forwardedProps, internalProps } = useSplitFieldProps(props, 'date');
const { timezone, value, setValue } = usePickerContext();
const { focused, options = [], ...other } = forwardedProps;
const { options = [], ...other } = forwardedProps;
const pickerContext = usePickerContext();

const { hasValidationError, getValidationErrorForNewValue } = useValidation({
Expand Down Expand Up @@ -43,6 +43,7 @@ function AutocompleteField(props) {
<TextField
{...params}
error={hasValidationError}
focused={pickerContext.open}
label={pickerContext.label}
name={pickerContext.name}
InputProps={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface AutocompleteFieldProps extends DatePickerFieldProps {
function AutocompleteField(props: AutocompleteFieldProps) {
const { forwardedProps, internalProps } = useSplitFieldProps(props, 'date');
const { timezone, value, setValue } = usePickerContext();
const { focused, options = [], ...other } = forwardedProps;
const { options = [], ...other } = forwardedProps;
const pickerContext = usePickerContext();

const { hasValidationError, getValidationErrorForNewValue } = useValidation({
Expand Down Expand Up @@ -55,6 +55,7 @@ function AutocompleteField(props: AutocompleteFieldProps) {
<TextField
{...params}
error={hasValidationError}
focused={pickerContext.open}
label={pickerContext.label}
name={pickerContext.name}
InputProps={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {

function ButtonDateField(props) {
const { internalProps, forwardedProps } = useSplitFieldProps(props, 'date');
const { focused, ...other } = forwardedProps;

const pickerContext = usePickerContext();
const handleRef = useForkRef(pickerContext.triggerRef, pickerContext.rootRef);
Expand All @@ -32,7 +31,7 @@ function ButtonDateField(props) {

return (
<Button
{...other}
{...forwardedProps}
variant="outlined"
color={hasValidationError ? 'error' : 'primary'}
ref={handleRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {

function ButtonDateField(props: DatePickerFieldProps) {
const { internalProps, forwardedProps } = useSplitFieldProps(props, 'date');
const { focused, ...other } = forwardedProps;

const pickerContext = usePickerContext();
const handleRef = useForkRef(pickerContext.triggerRef, pickerContext.rootRef);
Expand All @@ -36,7 +35,7 @@ function ButtonDateField(props: DatePickerFieldProps) {

return (
<Button
{...other}
{...forwardedProps}
variant="outlined"
color={hasValidationError ? 'error' : 'primary'}
ref={handleRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {

function ButtonDateRangeField(props) {
const { internalProps, forwardedProps } = useSplitFieldProps(props, 'date');
const { focused, ...other } = forwardedProps;

const pickerContext = usePickerContext();
const handleRef = useForkRef(pickerContext.triggerRef, pickerContext.rootRef);
Expand All @@ -35,7 +34,7 @@ function ButtonDateRangeField(props) {

return (
<Button
{...other}
{...forwardedProps}
variant="outlined"
color={hasValidationError ? 'error' : 'primary'}
ref={handleRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {

function ButtonDateRangeField(props: DateRangePickerFieldProps) {
const { internalProps, forwardedProps } = useSplitFieldProps(props, 'date');
const { focused, ...other } = forwardedProps;

const pickerContext = usePickerContext();
const handleRef = useForkRef(pickerContext.triggerRef, pickerContext.rootRef);
Expand All @@ -39,7 +38,7 @@ function ButtonDateRangeField(props: DateRangePickerFieldProps) {

return (
<Button
{...other}
{...forwardedProps}
variant="outlined"
color={hasValidationError ? 'error' : 'primary'}
ref={handleRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ function MaskedDateField(props) {
<TextField
placeholder={parsedFormat}
error={hasValidationError}
focused={pickerContext.open}
name={pickerContext.name}
label={pickerContext.label}
className={pickerContext.rootClassName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ function MaskedDateField(props: DatePickerFieldProps) {
<TextField
placeholder={parsedFormat}
error={hasValidationError}
focused={pickerContext.open}
name={pickerContext.name}
label={pickerContext.label}
className={pickerContext.rootClassName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function ReadOnlyDateField(props) {
sx: { cursor: 'pointer', '& *': { cursor: 'inherit' } },
}}
error={hasValidationError}
focused={pickerContext.open}
onClick={() => pickerContext.setOpen((prev) => !prev)}
name={pickerContext.name}
label={pickerContext.label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function ReadOnlyDateField(props: DatePickerFieldProps) {
sx: { cursor: 'pointer', '& *': { cursor: 'inherit' } },
}}
error={hasValidationError}
focused={pickerContext.open}
onClick={() => pickerContext.setOpen((prev) => !prev)}
name={pickerContext.name}
label={pickerContext.label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function ReadOnlyDateField(props) {
sx: { cursor: 'pointer', '& *': { cursor: 'inherit' } },
}}
error={hasValidationError}
focused={pickerContext.open}
onClick={() => pickerContext.setOpen((prev) => !prev)}
className={pickerContext.rootClassName}
sx={pickerContext.rootSx}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function ReadOnlyDateField(props: DatePickerFieldProps) {
sx: { cursor: 'pointer', '& *': { cursor: 'inherit' } },
}}
error={hasValidationError}
focused={pickerContext.open}
onClick={() => pickerContext.setOpen((prev) => !prev)}
className={pickerContext.rootClassName}
sx={pickerContext.rootSx}
Expand Down
Loading