@mui/x-date-pickers 8.0.0-alpha.12 → 8.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts +1 -1
- package/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +96 -94
- package/AdapterDateFnsV2/AdapterDateFnsV2.d.ts +1 -1
- package/AdapterDateFnsV2/AdapterDateFnsV2.js +96 -94
- package/AdapterDayjs/AdapterDayjs.js +11 -5
- package/CHANGELOG.md +299 -0
- package/DateCalendar/DateCalendar.js +1 -1
- package/DateField/useDateField.d.ts +1 -1
- package/DatePicker/DatePicker.types.d.ts +2 -2
- package/DateTimeField/useDateTimeField.d.ts +1 -1
- package/DateTimePicker/DateTimePicker.types.d.ts +2 -2
- package/TimeClock/Clock.js +2 -2
- package/TimeClock/ClockPointer.js +1 -1
- package/TimeField/useTimeField.d.ts +1 -1
- package/TimePicker/TimePicker.types.d.ts +2 -2
- package/esm/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts +1 -1
- package/esm/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +47 -45
- package/esm/AdapterDateFnsV2/AdapterDateFnsV2.d.ts +1 -1
- package/esm/AdapterDateFnsV2/AdapterDateFnsV2.js +47 -45
- package/esm/AdapterDayjs/AdapterDayjs.js +9 -5
- package/esm/DateCalendar/DateCalendar.js +1 -1
- package/esm/DateField/useDateField.d.ts +1 -1
- package/esm/DatePicker/DatePicker.types.d.ts +2 -2
- package/esm/DateTimeField/useDateTimeField.d.ts +1 -1
- package/esm/DateTimePicker/DateTimePicker.types.d.ts +2 -2
- package/esm/TimeClock/Clock.js +2 -2
- package/esm/TimeClock/ClockPointer.js +1 -1
- package/esm/TimeField/useTimeField.d.ts +1 -1
- package/esm/TimePicker/TimePicker.types.d.ts +2 -2
- package/esm/hooks/useSplitFieldProps.d.ts +1 -1
- package/esm/hooks/useSplitFieldProps.js +1 -1
- package/esm/index.js +1 -1
- package/esm/internals/components/PickerFieldUI.d.ts +7 -0
- package/esm/internals/components/PickerFieldUI.js +2 -2
- package/esm/internals/components/PickerPopper/PickerPopper.d.ts +0 -3
- package/esm/internals/components/PickerPopper/PickerPopper.js +26 -14
- package/esm/internals/components/PickerProvider.d.ts +21 -1
- package/esm/internals/components/PickerProvider.js +7 -2
- package/esm/internals/demo/DemoContainer.js +3 -3
- package/esm/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -22
- package/esm/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +0 -5
- package/esm/internals/hooks/useField/index.d.ts +1 -2
- package/esm/internals/hooks/useField/useField.types.d.ts +10 -4
- package/esm/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +9 -9
- package/esm/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +16 -8
- package/esm/internals/hooks/useField/useFieldV6TextField.js +8 -6
- package/esm/internals/hooks/useField/useFieldV7TextField.js +7 -7
- package/esm/internals/hooks/useMobilePicker/useMobilePicker.js +5 -21
- package/esm/internals/hooks/useNullableFieldPrivateContext.d.ts +6 -0
- package/esm/internals/hooks/useNullableFieldPrivateContext.js +5 -0
- package/esm/internals/hooks/usePicker/usePicker.d.ts +1 -1
- package/esm/internals/hooks/usePicker/usePicker.js +2 -2
- package/esm/internals/hooks/usePicker/usePicker.types.d.ts +1 -1
- package/esm/internals/hooks/usePicker/usePickerProvider.d.ts +8 -3
- package/esm/internals/hooks/usePicker/usePickerProvider.js +20 -6
- package/esm/internals/hooks/usePicker/usePickerViews.d.ts +20 -3
- package/esm/internals/hooks/usePicker/usePickerViews.js +20 -8
- package/esm/internals/hooks/useStaticPicker/useStaticPicker.js +3 -2
- package/esm/internals/index.d.ts +4 -3
- package/esm/internals/index.js +2 -1
- package/esm/internals/models/fields.d.ts +3 -10
- package/esm/locales/bnBD.d.ts +80 -0
- package/esm/locales/bnBD.js +73 -0
- package/esm/locales/index.d.ts +1 -0
- package/esm/locales/index.js +1 -0
- package/esm/models/fields.d.ts +2 -2
- package/esm/validation/extractValidationProps.d.ts +1 -1
- package/esm/validation/index.d.ts +1 -1
- package/esm/validation/useValidation.d.ts +1 -1
- package/hooks/useSplitFieldProps.d.ts +1 -1
- package/hooks/useSplitFieldProps.js +1 -1
- package/index.js +1 -1
- package/internals/components/PickerFieldUI.d.ts +7 -0
- package/internals/components/PickerFieldUI.js +3 -1
- package/internals/components/PickerPopper/PickerPopper.d.ts +0 -3
- package/internals/components/PickerPopper/PickerPopper.js +25 -13
- package/internals/components/PickerProvider.d.ts +21 -1
- package/internals/components/PickerProvider.js +8 -3
- package/internals/demo/DemoContainer.js +3 -3
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -22
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +0 -5
- package/internals/hooks/useField/index.d.ts +1 -2
- package/internals/hooks/useField/useField.types.d.ts +10 -4
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +9 -9
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +16 -10
- package/internals/hooks/useField/useFieldV6TextField.js +8 -6
- package/internals/hooks/useField/useFieldV7TextField.js +7 -7
- package/internals/hooks/useMobilePicker/useMobilePicker.js +5 -21
- package/internals/hooks/useNullableFieldPrivateContext.d.ts +6 -0
- package/internals/hooks/useNullableFieldPrivateContext.js +13 -0
- package/internals/hooks/usePicker/usePicker.d.ts +1 -1
- package/internals/hooks/usePicker/usePicker.js +2 -2
- package/internals/hooks/usePicker/usePicker.types.d.ts +1 -1
- package/internals/hooks/usePicker/usePickerProvider.d.ts +8 -3
- package/internals/hooks/usePicker/usePickerProvider.js +20 -6
- package/internals/hooks/usePicker/usePickerViews.d.ts +20 -3
- package/internals/hooks/usePicker/usePickerViews.js +20 -8
- package/internals/hooks/useStaticPicker/useStaticPicker.js +3 -2
- package/internals/index.d.ts +4 -3
- package/internals/index.js +19 -0
- package/internals/models/fields.d.ts +3 -10
- package/locales/bnBD.d.ts +80 -0
- package/locales/bnBD.js +79 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +11 -0
- package/models/fields.d.ts +2 -2
- package/modern/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts +1 -1
- package/modern/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +47 -45
- package/modern/AdapterDateFnsV2/AdapterDateFnsV2.d.ts +1 -1
- package/modern/AdapterDateFnsV2/AdapterDateFnsV2.js +47 -45
- package/modern/AdapterDayjs/AdapterDayjs.js +9 -5
- package/modern/DateCalendar/DateCalendar.js +1 -1
- package/modern/DateField/useDateField.d.ts +1 -1
- package/modern/DatePicker/DatePicker.types.d.ts +2 -2
- package/modern/DateTimeField/useDateTimeField.d.ts +1 -1
- package/modern/DateTimePicker/DateTimePicker.types.d.ts +2 -2
- package/modern/TimeClock/Clock.js +2 -2
- package/modern/TimeClock/ClockPointer.js +1 -1
- package/modern/TimeField/useTimeField.d.ts +1 -1
- package/modern/TimePicker/TimePicker.types.d.ts +2 -2
- package/modern/hooks/useSplitFieldProps.d.ts +1 -1
- package/modern/hooks/useSplitFieldProps.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickerFieldUI.d.ts +7 -0
- package/modern/internals/components/PickerFieldUI.js +2 -2
- package/modern/internals/components/PickerPopper/PickerPopper.d.ts +0 -3
- package/modern/internals/components/PickerPopper/PickerPopper.js +26 -14
- package/modern/internals/components/PickerProvider.d.ts +21 -1
- package/modern/internals/components/PickerProvider.js +7 -2
- package/modern/internals/demo/DemoContainer.js +3 -3
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -22
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +0 -5
- package/modern/internals/hooks/useField/index.d.ts +1 -2
- package/modern/internals/hooks/useField/useField.types.d.ts +10 -4
- package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +9 -9
- package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +16 -8
- package/modern/internals/hooks/useField/useFieldV6TextField.js +8 -6
- package/modern/internals/hooks/useField/useFieldV7TextField.js +7 -7
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +5 -21
- package/modern/internals/hooks/useNullableFieldPrivateContext.d.ts +6 -0
- package/modern/internals/hooks/useNullableFieldPrivateContext.js +5 -0
- package/modern/internals/hooks/usePicker/usePicker.d.ts +1 -1
- package/modern/internals/hooks/usePicker/usePicker.js +2 -2
- package/modern/internals/hooks/usePicker/usePicker.types.d.ts +1 -1
- package/modern/internals/hooks/usePicker/usePickerProvider.d.ts +8 -3
- package/modern/internals/hooks/usePicker/usePickerProvider.js +20 -6
- package/modern/internals/hooks/usePicker/usePickerViews.d.ts +20 -3
- package/modern/internals/hooks/usePicker/usePickerViews.js +20 -8
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +3 -2
- package/modern/internals/index.d.ts +4 -3
- package/modern/internals/index.js +2 -1
- package/modern/internals/models/fields.d.ts +3 -10
- package/modern/locales/bnBD.d.ts +80 -0
- package/modern/locales/bnBD.js +73 -0
- package/modern/locales/index.d.ts +1 -0
- package/modern/locales/index.js +1 -0
- package/modern/models/fields.d.ts +2 -2
- package/modern/validation/extractValidationProps.d.ts +1 -1
- package/modern/validation/index.d.ts +1 -1
- package/modern/validation/useValidation.d.ts +1 -1
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/validation/extractValidationProps.d.ts +1 -1
- package/validation/index.d.ts +1 -1
- package/validation/useValidation.d.ts +1 -1
|
@@ -96,6 +96,10 @@ export interface UseFieldInternalProps<TValue extends PickerValidValue, TEnableA
|
|
|
96
96
|
* @default false
|
|
97
97
|
*/
|
|
98
98
|
autoFocus?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* If `true`, the component is displayed in focused state.
|
|
101
|
+
*/
|
|
102
|
+
focused?: boolean;
|
|
99
103
|
}
|
|
100
104
|
export interface UseFieldCommonAdditionalProps extends Required<Pick<UseFieldInternalProps<any, any, any>, 'disabled' | 'readOnly' | 'autoFocus'>> {
|
|
101
105
|
/**
|
|
@@ -110,21 +114,22 @@ export interface UseFieldCommonForwardedProps extends Pick<ExportedPickerFieldUI
|
|
|
110
114
|
export type UseFieldForwardedProps<TEnableAccessibleFieldDOMStructure extends boolean> = UseFieldCommonForwardedProps & (TEnableAccessibleFieldDOMStructure extends false ? UseFieldV6ForwardedProps : UseFieldV7ForwardedProps);
|
|
111
115
|
export interface UseFieldV6ForwardedProps {
|
|
112
116
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
113
|
-
onBlur?:
|
|
117
|
+
onBlur?: React.FocusEventHandler;
|
|
114
118
|
onClick?: React.MouseEventHandler;
|
|
115
|
-
onFocus?:
|
|
119
|
+
onFocus?: React.FocusEventHandler;
|
|
116
120
|
onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
|
|
117
121
|
placeholder?: string;
|
|
118
122
|
}
|
|
119
123
|
interface UseFieldV6AdditionalProps extends Required<Pick<React.InputHTMLAttributes<HTMLInputElement>, 'inputMode' | 'placeholder' | 'value' | 'onChange' | 'autoComplete'>> {
|
|
120
124
|
enableAccessibleFieldDOMStructure: false;
|
|
125
|
+
focused?: boolean;
|
|
121
126
|
}
|
|
122
127
|
export interface UseFieldV7ForwardedProps {
|
|
123
128
|
focused?: boolean;
|
|
124
129
|
sectionListRef?: React.Ref<PickersSectionListRef>;
|
|
125
|
-
onBlur?:
|
|
130
|
+
onBlur?: React.FocusEventHandler;
|
|
126
131
|
onClick?: React.MouseEventHandler;
|
|
127
|
-
onFocus?:
|
|
132
|
+
onFocus?: React.FocusEventHandler;
|
|
128
133
|
onInput?: React.FormEventHandler<HTMLDivElement>;
|
|
129
134
|
onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
|
|
130
135
|
}
|
|
@@ -136,6 +141,7 @@ interface UseFieldV7AdditionalProps {
|
|
|
136
141
|
value: string;
|
|
137
142
|
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
138
143
|
areAllSectionsEmpty: boolean;
|
|
144
|
+
focused: boolean;
|
|
139
145
|
}
|
|
140
146
|
export type UseFieldResponse<TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends UseFieldCommonForwardedProps & {
|
|
141
147
|
[key: string]: any;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { UseFieldInternalProps } from './useField.types';
|
|
3
1
|
import { PickerAnyManager, PickerManagerFieldInternalProps, PickerManagerFieldInternalPropsWithDefaults } from "../../models/index.js";
|
|
4
|
-
export declare const PickerFieldPrivateContext: React.Context<PickerFieldPrivateContextValue | null>;
|
|
5
2
|
/**
|
|
6
3
|
* Applies the default values to the field internal props.
|
|
7
4
|
* This is a temporary hook that will be removed during a follow up when `useField` will receive the internal props without the defaults.
|
|
8
5
|
* It is only here to allow the migration to be done in smaller steps.
|
|
9
6
|
*/
|
|
10
|
-
export declare function useFieldInternalPropsWithDefaults<TManager extends PickerAnyManager>(
|
|
11
|
-
|
|
12
|
-
internalProps
|
|
13
|
-
}: {
|
|
7
|
+
export declare function useFieldInternalPropsWithDefaults<TManager extends PickerAnyManager>(parameters: UseFieldInternalPropsWithDefaultsParameters<TManager>): PickerManagerFieldInternalPropsWithDefaults<TManager>;
|
|
8
|
+
interface UseFieldInternalPropsWithDefaultsParameters<TManager extends PickerAnyManager> {
|
|
14
9
|
manager: TManager;
|
|
15
10
|
internalProps: PickerManagerFieldInternalProps<TManager>;
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Hack to make sure that on multi input range field, the `useNullableFieldPrivateContext().fieldRef` is only bound to the field matching the range position.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
skipContextFieldRefAssignment?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
3
4
|
import { useLocalizationContext } from "../useUtils.js";
|
|
4
5
|
import { useNullablePickerContext } from "../useNullablePickerContext.js";
|
|
5
|
-
|
|
6
|
+
import { useNullableFieldPrivateContext } from "../useNullableFieldPrivateContext.js";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Applies the default values to the field internal props.
|
|
9
10
|
* This is a temporary hook that will be removed during a follow up when `useField` will receive the internal props without the defaults.
|
|
10
11
|
* It is only here to allow the migration to be done in smaller steps.
|
|
11
12
|
*/
|
|
12
|
-
export function useFieldInternalPropsWithDefaults({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
export function useFieldInternalPropsWithDefaults(parameters) {
|
|
14
|
+
const {
|
|
15
|
+
manager,
|
|
16
|
+
internalProps,
|
|
17
|
+
skipContextFieldRefAssignment
|
|
18
|
+
} = parameters;
|
|
16
19
|
const localizationContext = useLocalizationContext();
|
|
17
20
|
const pickerContext = useNullablePickerContext();
|
|
18
|
-
const fieldPrivateContext =
|
|
21
|
+
const fieldPrivateContext = useNullableFieldPrivateContext();
|
|
22
|
+
const handleFieldRef = useForkRef(internalProps.unstableFieldRef, skipContextFieldRefAssignment ? null : fieldPrivateContext?.fieldRef);
|
|
19
23
|
const setValue = pickerContext?.setValue;
|
|
20
24
|
const handleChangeFromPicker = React.useCallback((newValue, ctx) => {
|
|
21
25
|
return setValue?.(newValue, {
|
|
@@ -33,15 +37,19 @@ export function useFieldInternalPropsWithDefaults({
|
|
|
33
37
|
onChange: handleChangeFromPicker,
|
|
34
38
|
timezone: pickerContext.timezone,
|
|
35
39
|
disabled: pickerContext.disabled,
|
|
40
|
+
readOnly: pickerContext.readOnly,
|
|
41
|
+
autoFocus: pickerContext.autoFocus && !pickerContext.open,
|
|
42
|
+
focused: pickerContext.open ? true : undefined,
|
|
36
43
|
format: pickerContext.fieldFormat,
|
|
37
44
|
formatDensity: fieldPrivateContext.formatDensity,
|
|
38
45
|
enableAccessibleFieldDOMStructure: fieldPrivateContext.enableAccessibleFieldDOMStructure,
|
|
39
46
|
selectedSections: fieldPrivateContext.selectedSections,
|
|
40
|
-
onSelectedSectionsChange: fieldPrivateContext.onSelectedSectionsChange
|
|
47
|
+
onSelectedSectionsChange: fieldPrivateContext.onSelectedSectionsChange,
|
|
48
|
+
unstableFieldRef: handleFieldRef
|
|
41
49
|
}, internalProps);
|
|
42
50
|
}
|
|
43
51
|
return manager.internal_applyDefaultsToFieldInternalProps(_extends({}, localizationContext, {
|
|
44
52
|
internalProps: internalPropsWithDefaultsFromContext
|
|
45
53
|
}));
|
|
46
|
-
}, [manager, localizationContext, pickerContext, fieldPrivateContext, internalProps, handleChangeFromPicker]);
|
|
54
|
+
}, [manager, localizationContext, pickerContext, fieldPrivateContext, internalProps, handleChangeFromPicker, handleFieldRef]);
|
|
47
55
|
}
|
|
@@ -48,7 +48,8 @@ export const useFieldV6TextField = params => {
|
|
|
48
48
|
},
|
|
49
49
|
internalProps: {
|
|
50
50
|
readOnly = false,
|
|
51
|
-
disabled = false
|
|
51
|
+
disabled = false,
|
|
52
|
+
focused
|
|
52
53
|
},
|
|
53
54
|
parsedSelectedSections,
|
|
54
55
|
activeSectionIndex,
|
|
@@ -156,8 +157,8 @@ export const useFieldV6TextField = params => {
|
|
|
156
157
|
const sectionIndex = nextSectionIndex === -1 ? sections.length - 1 : nextSectionIndex - 1;
|
|
157
158
|
setSelectedSections(sectionIndex);
|
|
158
159
|
};
|
|
159
|
-
const handleInputFocus = useEventCallback(
|
|
160
|
-
onFocus?.(
|
|
160
|
+
const handleInputFocus = useEventCallback(event => {
|
|
161
|
+
onFocus?.(event);
|
|
161
162
|
// The ref is guaranteed to be resolved at this point.
|
|
162
163
|
const input = inputRef.current;
|
|
163
164
|
clearTimeout(focusTimeoutRef.current);
|
|
@@ -220,8 +221,8 @@ export const useFieldV6TextField = params => {
|
|
|
220
221
|
resetCharacterQuery();
|
|
221
222
|
updateValueFromValueStr(pastedValue);
|
|
222
223
|
});
|
|
223
|
-
const handleContainerBlur = useEventCallback(
|
|
224
|
-
onBlur?.(
|
|
224
|
+
const handleContainerBlur = useEventCallback(event => {
|
|
225
|
+
onBlur?.(event);
|
|
225
226
|
setSelectedSections(null);
|
|
226
227
|
});
|
|
227
228
|
const handleInputChange = useEventCallback(event => {
|
|
@@ -334,7 +335,8 @@ export const useFieldV6TextField = params => {
|
|
|
334
335
|
inputMode,
|
|
335
336
|
autoComplete: 'off',
|
|
336
337
|
value: shouldShowPlaceholder ? '' : valueStr,
|
|
337
|
-
onChange: handleInputChange
|
|
338
|
+
onChange: handleInputChange,
|
|
339
|
+
focused
|
|
338
340
|
}
|
|
339
341
|
};
|
|
340
342
|
};
|
|
@@ -12,7 +12,8 @@ export const useFieldV7TextField = params => {
|
|
|
12
12
|
internalProps: {
|
|
13
13
|
disabled,
|
|
14
14
|
readOnly = false,
|
|
15
|
-
autoFocus = false
|
|
15
|
+
autoFocus = false,
|
|
16
|
+
focused: focusedProp
|
|
16
17
|
},
|
|
17
18
|
forwardedProps: {
|
|
18
19
|
sectionListRef: inSectionListRef,
|
|
@@ -20,8 +21,7 @@ export const useFieldV7TextField = params => {
|
|
|
20
21
|
onClick,
|
|
21
22
|
onFocus,
|
|
22
23
|
onInput,
|
|
23
|
-
onPaste
|
|
24
|
-
focused: focusedProp
|
|
24
|
+
onPaste
|
|
25
25
|
},
|
|
26
26
|
fieldValueManager,
|
|
27
27
|
applyCharacterEditing,
|
|
@@ -198,8 +198,8 @@ export const useFieldV7TextField = params => {
|
|
|
198
198
|
resetCharacterQuery();
|
|
199
199
|
updateValueFromValueStr(pastedValue);
|
|
200
200
|
});
|
|
201
|
-
const handleContainerFocus = useEventCallback(
|
|
202
|
-
onFocus?.(
|
|
201
|
+
const handleContainerFocus = useEventCallback(event => {
|
|
202
|
+
onFocus?.(event);
|
|
203
203
|
if (focused || !sectionListRef.current) {
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
@@ -210,8 +210,8 @@ export const useFieldV7TextField = params => {
|
|
|
210
210
|
setSelectedSections(sectionOrder.startIndex);
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
|
-
const handleContainerBlur = useEventCallback(
|
|
214
|
-
onBlur?.(
|
|
213
|
+
const handleContainerBlur = useEventCallback(event => {
|
|
214
|
+
onBlur?.(event);
|
|
215
215
|
setTimeout(() => {
|
|
216
216
|
if (!sectionListRef.current) {
|
|
217
217
|
return;
|
|
@@ -4,8 +4,6 @@ const _excluded = ["props"],
|
|
|
4
4
|
_excluded2 = ["ownerState"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
7
|
-
import useForkRef from '@mui/utils/useForkRef';
|
|
8
|
-
import useId from '@mui/utils/useId';
|
|
9
7
|
import { PickersModalDialog } from "../../components/PickersModalDialog.js";
|
|
10
8
|
import { usePicker } from "../usePicker/index.js";
|
|
11
9
|
import { PickersLayout } from "../../../PickersLayout/index.js";
|
|
@@ -29,35 +27,26 @@ export const useMobilePicker = _ref => {
|
|
|
29
27
|
slotProps: innerSlotProps,
|
|
30
28
|
label,
|
|
31
29
|
inputRef,
|
|
32
|
-
readOnly,
|
|
33
|
-
autoFocus,
|
|
34
30
|
localeText
|
|
35
31
|
} = props;
|
|
36
|
-
const fieldRef = React.useRef(null);
|
|
37
|
-
const labelId = useId();
|
|
38
|
-
const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
|
|
39
32
|
const {
|
|
40
33
|
providerProps,
|
|
41
34
|
renderCurrentView,
|
|
42
35
|
ownerState
|
|
43
36
|
} = usePicker(_extends({}, pickerParams, {
|
|
44
37
|
props,
|
|
45
|
-
fieldRef,
|
|
46
38
|
localeText,
|
|
47
39
|
autoFocusView: true,
|
|
40
|
+
viewContainerRole: 'dialog',
|
|
48
41
|
variant: 'mobile'
|
|
49
42
|
}));
|
|
43
|
+
const labelId = providerProps.privateContextValue.labelId;
|
|
44
|
+
const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
|
|
50
45
|
const Field = slots.field;
|
|
51
46
|
const _useSlotProps = useSlotProps({
|
|
52
47
|
elementType: Field,
|
|
53
48
|
externalSlotProps: innerSlotProps?.field,
|
|
54
|
-
additionalProps: _extends({
|
|
55
|
-
// Internal props
|
|
56
|
-
readOnly,
|
|
57
|
-
autoFocus: autoFocus && !props.open,
|
|
58
|
-
// Forwarded props
|
|
59
|
-
focused: providerProps.contextValue.open ? true : undefined
|
|
60
|
-
}, isToolbarHidden && {
|
|
49
|
+
additionalProps: _extends({}, isToolbarHidden && {
|
|
61
50
|
id: labelId
|
|
62
51
|
}),
|
|
63
52
|
ownerState
|
|
@@ -80,17 +69,12 @@ export const useMobilePicker = _ref => {
|
|
|
80
69
|
'aria-labelledby': labelledById
|
|
81
70
|
}, innerSlotProps?.mobilePaper)
|
|
82
71
|
});
|
|
83
|
-
|
|
84
|
-
// TODO: This `as any` will go away once the field ref is handled by the context.
|
|
85
|
-
const handleFieldRef = useForkRef(fieldRef, fieldProps.unstableFieldRef);
|
|
86
72
|
const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
|
|
87
73
|
children: /*#__PURE__*/_jsxs(PickerFieldUIContextProvider, {
|
|
88
74
|
slots: slots,
|
|
89
75
|
slotProps: slotProps,
|
|
90
76
|
inputRef: inputRef,
|
|
91
|
-
children: [/*#__PURE__*/_jsx(Field, _extends({}, fieldProps, {
|
|
92
|
-
unstableFieldRef: handleFieldRef
|
|
93
|
-
})), /*#__PURE__*/_jsx(PickersModalDialog, {
|
|
77
|
+
children: [/*#__PURE__*/_jsx(Field, _extends({}, fieldProps)), /*#__PURE__*/_jsx(PickersModalDialog, {
|
|
94
78
|
slots: slots,
|
|
95
79
|
slotProps: slotProps,
|
|
96
80
|
children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { UseFieldInternalProps } from './useField';
|
|
3
|
+
import { UsePickerViewsFieldPrivateContextValue } from "./usePicker/usePickerViews.js";
|
|
4
|
+
export declare const PickerFieldPrivateContext: React.Context<PickerFieldPrivateContextValue | null>;
|
|
5
|
+
export declare function useNullableFieldPrivateContext(): PickerFieldPrivateContextValue | null;
|
|
6
|
+
export interface PickerFieldPrivateContextValue extends Pick<UseFieldInternalProps<any, any, any>, 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange'>, UsePickerViewsFieldPrivateContextValue {}
|
|
@@ -8,7 +8,7 @@ export declare const usePicker: <TValue extends PickerValidValue, TView extends
|
|
|
8
8
|
variant,
|
|
9
9
|
validator,
|
|
10
10
|
autoFocusView,
|
|
11
|
+
viewContainerRole,
|
|
11
12
|
rendererInterceptor,
|
|
12
|
-
fieldRef,
|
|
13
13
|
localeText
|
|
14
14
|
}: UsePickerParams<TValue, TView, TExternalProps>) => UsePickerReturnValue<TValue>;
|
|
@@ -10,8 +10,8 @@ export const usePicker = ({
|
|
|
10
10
|
variant,
|
|
11
11
|
validator,
|
|
12
12
|
autoFocusView,
|
|
13
|
+
viewContainerRole,
|
|
13
14
|
rendererInterceptor,
|
|
14
|
-
fieldRef,
|
|
15
15
|
localeText
|
|
16
16
|
}) => {
|
|
17
17
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -28,7 +28,7 @@ export const usePicker = ({
|
|
|
28
28
|
const pickerViewsResponse = usePickerViews({
|
|
29
29
|
props,
|
|
30
30
|
autoFocusView,
|
|
31
|
-
|
|
31
|
+
viewContainerRole,
|
|
32
32
|
propsFromPickerValue: pickerValueResponse.viewProps,
|
|
33
33
|
rendererInterceptor
|
|
34
34
|
});
|
|
@@ -8,7 +8,7 @@ import { UsePickerProviderParameters, UsePickerProviderProps, UsePickerProviderR
|
|
|
8
8
|
*/
|
|
9
9
|
export interface UsePickerBaseProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<TValue, TView, any>> extends UsePickerValueBaseProps<TValue, TError>, UsePickerViewsBaseProps<TValue, TView, TExternalProps>, UsePickerProviderProps {}
|
|
10
10
|
export interface UsePickerProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<TValue, TView, any>> extends UsePickerValueProps<TValue, TError>, UsePickerViewsProps<TValue, TView, TExternalProps>, UsePickerProviderProps {}
|
|
11
|
-
export interface UsePickerParams<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UsePickerProps<TValue, TView, any, any>> extends Pick<UsePickerValueParams<TValue, TExternalProps>, 'valueManager' | 'valueType' | 'validator'>, Pick<UsePickerViewParams<TValue, TView, TExternalProps>, 'autoFocusView' | '
|
|
11
|
+
export interface UsePickerParams<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UsePickerProps<TValue, TView, any, any>> extends Pick<UsePickerValueParams<TValue, TExternalProps>, 'valueManager' | 'valueType' | 'validator'>, Pick<UsePickerViewParams<TValue, TView, TExternalProps>, 'autoFocusView' | 'viewContainerRole' | 'rendererInterceptor'>, Pick<UsePickerProviderParameters<TValue, TView, InferError<TExternalProps>>, 'localeText' | 'variant' | 'ref'> {
|
|
12
12
|
props: TExternalProps;
|
|
13
13
|
}
|
|
14
14
|
export interface UsePickerReturnValue<TValue extends PickerValidValue> {
|
|
@@ -4,12 +4,17 @@ import { PickerProviderProps } from "../../components/PickerProvider.js";
|
|
|
4
4
|
import type { UsePickerProps } from './usePicker.types';
|
|
5
5
|
import { DateOrTimeViewWithMeridiem, FormProps, PickerOrientation, PickerValidValue, PickerVariant } from "../../models/index.js";
|
|
6
6
|
import { UsePickerViewsProviderParams } from "./usePickerViews.js";
|
|
7
|
-
import {
|
|
7
|
+
import type { UseFieldInternalProps } from '../useField';
|
|
8
|
+
import { ExportedBaseToolbarProps } from "../../models/props/toolbar.js";
|
|
8
9
|
export declare const usePickerOrientation: (views: readonly DateOrTimeViewWithMeridiem[], customOrientation: PickerOrientation | undefined) => PickerOrientation;
|
|
9
10
|
export declare function usePickerProvider<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError>(parameters: UsePickerProviderParameters<TValue, TView, TError>): UsePickerProviderReturnValue<TValue>;
|
|
10
11
|
export interface UsePickerProviderParameters<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError> extends Pick<PickerProviderProps<TValue>, 'localeText'> {
|
|
11
12
|
ref: React.ForwardedRef<HTMLDivElement> | undefined;
|
|
12
|
-
props: UsePickerProps<TValue, any, any, any> & UsePickerProviderNonStaticProps
|
|
13
|
+
props: UsePickerProps<TValue, any, any, any> & UsePickerProviderNonStaticProps & {
|
|
14
|
+
slotProps?: {
|
|
15
|
+
toolbar?: ExportedBaseToolbarProps;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
13
18
|
valueManager: PickerValueManager<TValue, any>;
|
|
14
19
|
variant: PickerVariant;
|
|
15
20
|
paramsFromUsePickerValue: UsePickerValueProviderParams<TValue, TError>;
|
|
@@ -34,7 +39,7 @@ export interface UsePickerProviderProps extends FormProps {
|
|
|
34
39
|
/**
|
|
35
40
|
* Props used to create the picker's contexts and that are not available on static pickers.
|
|
36
41
|
*/
|
|
37
|
-
export interface UsePickerProviderNonStaticProps extends
|
|
42
|
+
export interface UsePickerProviderNonStaticProps extends Pick<UseFieldInternalProps<any, any, any>, 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange'> {
|
|
38
43
|
/**
|
|
39
44
|
* Format of the date when rendered in the input(s).
|
|
40
45
|
* Defaults to localized format based on the used `views`.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
4
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
5
|
+
import useId from '@mui/utils/useId';
|
|
4
6
|
import { useUtils } from "../useUtils.js";
|
|
5
7
|
import { arrayIncludes } from "../../utils/utils.js";
|
|
6
8
|
import { useReduceAnimations } from "../useReduceAnimations.js";
|
|
@@ -49,6 +51,14 @@ export function usePickerProvider(parameters) {
|
|
|
49
51
|
const orientation = usePickerOrientation(paramsFromUsePickerViews.views, props.orientation);
|
|
50
52
|
const reduceAnimations = useReduceAnimations(props.reduceAnimations);
|
|
51
53
|
const triggerRef = React.useRef(null);
|
|
54
|
+
const popupRef = React.useRef(null);
|
|
55
|
+
const rootRefObject = React.useRef(null);
|
|
56
|
+
const rootRef = useForkRef(ref, rootRefObject);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* TODO: Improve how we generate the aria-label and aria-labelledby attributes.
|
|
60
|
+
*/
|
|
61
|
+
const labelId = useId();
|
|
52
62
|
const ownerState = React.useMemo(() => ({
|
|
53
63
|
isPickerValueEmpty: valueManager.areValuesEqual(utils, paramsFromUsePickerValue.value, valueManager.emptyValue),
|
|
54
64
|
isPickerOpen: paramsFromUsePickerValue.contextValue.open,
|
|
@@ -69,8 +79,10 @@ export function usePickerProvider(parameters) {
|
|
|
69
79
|
const contextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.contextValue, paramsFromUsePickerViews.contextValue, {
|
|
70
80
|
disabled: props.disabled ?? false,
|
|
71
81
|
readOnly: props.readOnly ?? false,
|
|
82
|
+
autoFocus: props.autoFocus ?? false,
|
|
72
83
|
variant,
|
|
73
84
|
orientation,
|
|
85
|
+
popupRef,
|
|
74
86
|
reduceAnimations,
|
|
75
87
|
triggerRef,
|
|
76
88
|
triggerStatus,
|
|
@@ -78,19 +90,21 @@ export function usePickerProvider(parameters) {
|
|
|
78
90
|
name: props.name,
|
|
79
91
|
label: props.label,
|
|
80
92
|
rootSx: props.sx,
|
|
81
|
-
rootRef
|
|
93
|
+
rootRef,
|
|
82
94
|
rootClassName: props.className
|
|
83
|
-
}), [paramsFromUsePickerValue.contextValue, paramsFromUsePickerViews.contextValue,
|
|
95
|
+
}), [paramsFromUsePickerValue.contextValue, paramsFromUsePickerViews.contextValue, rootRef, variant, orientation, reduceAnimations, props.disabled, props.readOnly, props.autoFocus, props.format, props.className, props.name, props.label, props.sx, triggerRef, triggerStatus]);
|
|
84
96
|
const privateContextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.privateContextValue, paramsFromUsePickerViews.privateContextValue, {
|
|
85
|
-
ownerState
|
|
86
|
-
|
|
97
|
+
ownerState,
|
|
98
|
+
rootRefObject,
|
|
99
|
+
labelId
|
|
100
|
+
}), [paramsFromUsePickerValue.privateContextValue, paramsFromUsePickerViews.privateContextValue, ownerState, labelId]);
|
|
87
101
|
const actionsContextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.actionsContextValue, paramsFromUsePickerViews.actionsContextValue), [paramsFromUsePickerValue.actionsContextValue, paramsFromUsePickerViews.actionsContextValue]);
|
|
88
|
-
const fieldPrivateContextValue = React.useMemo(() => ({
|
|
102
|
+
const fieldPrivateContextValue = React.useMemo(() => _extends({}, paramsFromUsePickerViews.fieldPrivateContextValue, {
|
|
89
103
|
formatDensity: props.formatDensity,
|
|
90
104
|
enableAccessibleFieldDOMStructure: props.enableAccessibleFieldDOMStructure,
|
|
91
105
|
selectedSections: props.selectedSections,
|
|
92
106
|
onSelectedSectionsChange: props.onSelectedSectionsChange
|
|
93
|
-
}), [props.formatDensity, props.enableAccessibleFieldDOMStructure, props.selectedSections, props.onSelectedSectionsChange]);
|
|
107
|
+
}), [paramsFromUsePickerViews.fieldPrivateContextValue, props.formatDensity, props.enableAccessibleFieldDOMStructure, props.selectedSections, props.onSelectedSectionsChange]);
|
|
94
108
|
return {
|
|
95
109
|
localeText,
|
|
96
110
|
contextValue,
|
|
@@ -42,7 +42,7 @@ export interface UsePickerViewParams<TValue extends PickerValidValue, TView exte
|
|
|
42
42
|
props: TExternalProps;
|
|
43
43
|
propsFromPickerValue: UsePickerValueViewsResponse<TValue>;
|
|
44
44
|
autoFocusView: boolean;
|
|
45
|
-
|
|
45
|
+
viewContainerRole: 'dialog' | 'tooltip' | null;
|
|
46
46
|
/**
|
|
47
47
|
* A function that intercepts the regular picker rendering.
|
|
48
48
|
* Can be used to consume the provided `viewRenderers` and render a custom component wrapping them.
|
|
@@ -86,6 +86,10 @@ export interface UsePickerViewsContextValue<TView extends DateOrTimeViewWithMeri
|
|
|
86
86
|
* The view currently rendered.
|
|
87
87
|
*/
|
|
88
88
|
view: TView | null;
|
|
89
|
+
/**
|
|
90
|
+
* The view showed when first opening the picker.
|
|
91
|
+
*/
|
|
92
|
+
initialView: TView | null;
|
|
89
93
|
}
|
|
90
94
|
export interface UsePickerViewsPrivateContextValue {
|
|
91
95
|
/**
|
|
@@ -97,6 +101,18 @@ export interface UsePickerViewsPrivateContextValue {
|
|
|
97
101
|
* @returns {boolean} Whether the current view has an UI.
|
|
98
102
|
*/
|
|
99
103
|
doesTheCurrentViewHasAnUI: () => boolean;
|
|
104
|
+
/**
|
|
105
|
+
* The aria role associated with the view container.
|
|
106
|
+
* It is equal to "dialog" when the view is rendered inside a `@mui/material/Dialog`.
|
|
107
|
+
* It is equal to "dialog" when the view is rendered inside a `@mui/material/Popper` and the focus is trapped inside the view.
|
|
108
|
+
* It is equal to "tooltip" when the view is rendered inside a `@mui/material/Popper` and the focus remains inside the field.
|
|
109
|
+
* It is always equal to null if the picker does not have a field (static pickers).
|
|
110
|
+
* It is always equal to null if the component you are accessing the context from is not wrapped by a picker.
|
|
111
|
+
*/
|
|
112
|
+
viewContainerRole: 'dialog' | 'tooltip' | null;
|
|
113
|
+
}
|
|
114
|
+
export interface UsePickerViewsFieldPrivateContextValue {
|
|
115
|
+
fieldRef: React.RefObject<FieldRef<PickerValue> | FieldRef<PickerRangeValue> | null>;
|
|
100
116
|
}
|
|
101
117
|
export interface UsePickerViewsProviderParams<TView extends DateOrTimeViewWithMeridiem> {
|
|
102
118
|
hasUIView: boolean;
|
|
@@ -104,6 +120,7 @@ export interface UsePickerViewsProviderParams<TView extends DateOrTimeViewWithMe
|
|
|
104
120
|
contextValue: UsePickerViewsContextValue<TView>;
|
|
105
121
|
actionsContextValue: UsePickerViewsActionsContextValue<TView>;
|
|
106
122
|
privateContextValue: UsePickerViewsPrivateContextValue;
|
|
123
|
+
fieldPrivateContextValue: UsePickerViewsFieldPrivateContextValue;
|
|
107
124
|
}
|
|
108
125
|
/**
|
|
109
126
|
* Manage the views of all the pickers:
|
|
@@ -115,6 +132,6 @@ export declare const usePickerViews: <TValue extends PickerValidValue, TView ext
|
|
|
115
132
|
props,
|
|
116
133
|
propsFromPickerValue,
|
|
117
134
|
autoFocusView,
|
|
118
|
-
|
|
119
|
-
|
|
135
|
+
viewContainerRole,
|
|
136
|
+
rendererInterceptor: RendererInterceptor
|
|
120
137
|
}: UsePickerViewParams<TValue, TView, TExternalProps>) => UsePickerViewsResponse<TView>;
|
|
@@ -25,8 +25,8 @@ export const usePickerViews = ({
|
|
|
25
25
|
props,
|
|
26
26
|
propsFromPickerValue,
|
|
27
27
|
autoFocusView,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
viewContainerRole,
|
|
29
|
+
rendererInterceptor: RendererInterceptor
|
|
30
30
|
}) => {
|
|
31
31
|
const {
|
|
32
32
|
onChange,
|
|
@@ -43,6 +43,7 @@ export const usePickerViews = ({
|
|
|
43
43
|
timezone
|
|
44
44
|
} = props;
|
|
45
45
|
const propsToForwardToView = _objectWithoutPropertiesLoose(props, _excluded);
|
|
46
|
+
const fieldRef = React.useRef(null);
|
|
46
47
|
const {
|
|
47
48
|
view,
|
|
48
49
|
setView,
|
|
@@ -126,20 +127,27 @@ export const usePickerViews = ({
|
|
|
126
127
|
const actionsContextValue = React.useMemo(() => ({
|
|
127
128
|
setView
|
|
128
129
|
}), [setView]);
|
|
130
|
+
const initialViewRef = React.useRef(openTo ?? null);
|
|
129
131
|
const contextValue = React.useMemo(() => _extends({}, actionsContextValue, {
|
|
130
132
|
views,
|
|
131
|
-
view: popperView
|
|
133
|
+
view: popperView,
|
|
134
|
+
initialView: initialViewRef.current
|
|
132
135
|
}), [actionsContextValue, views, popperView]);
|
|
133
136
|
const privateContextValue = React.useMemo(() => ({
|
|
134
137
|
hasUIView,
|
|
135
|
-
doesTheCurrentViewHasAnUI
|
|
136
|
-
|
|
138
|
+
doesTheCurrentViewHasAnUI,
|
|
139
|
+
viewContainerRole
|
|
140
|
+
}), [hasUIView, doesTheCurrentViewHasAnUI, viewContainerRole]);
|
|
141
|
+
const fieldPrivateContextValue = React.useMemo(() => ({
|
|
142
|
+
fieldRef
|
|
143
|
+
}), []);
|
|
137
144
|
const providerParams = {
|
|
138
145
|
hasUIView,
|
|
139
146
|
views,
|
|
140
147
|
contextValue,
|
|
141
148
|
actionsContextValue,
|
|
142
|
-
privateContextValue
|
|
149
|
+
privateContextValue,
|
|
150
|
+
fieldPrivateContextValue
|
|
143
151
|
};
|
|
144
152
|
return {
|
|
145
153
|
provider: providerParams,
|
|
@@ -158,10 +166,14 @@ export const usePickerViews = ({
|
|
|
158
166
|
onChange: setValueAndGoToNextView,
|
|
159
167
|
view: popperView,
|
|
160
168
|
onViewChange: setView,
|
|
161
|
-
focusedView,
|
|
162
|
-
onFocusedViewChange: setFocusedView,
|
|
163
169
|
showViewSwitcher: timeViewsCount > 1,
|
|
164
170
|
timeViewsCount
|
|
171
|
+
}, viewContainerRole === 'tooltip' ? {
|
|
172
|
+
focusedView: null,
|
|
173
|
+
onFocusedViewChange: () => {}
|
|
174
|
+
} : {
|
|
175
|
+
focusedView,
|
|
176
|
+
onFocusedViewChange: setFocusedView
|
|
165
177
|
});
|
|
166
178
|
if (RendererInterceptor) {
|
|
167
179
|
return /*#__PURE__*/_jsx(RendererInterceptor, {
|
|
@@ -41,9 +41,10 @@ export const useStaticPicker = _ref => {
|
|
|
41
41
|
renderCurrentView
|
|
42
42
|
} = usePicker(_extends({}, pickerParams, {
|
|
43
43
|
props,
|
|
44
|
+
variant: displayStaticWrapperAs,
|
|
44
45
|
autoFocusView: autoFocus ?? false,
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
viewContainerRole: null,
|
|
47
|
+
localeText
|
|
47
48
|
}));
|
|
48
49
|
const Layout = slots?.layout ?? PickerStaticLayout;
|
|
49
50
|
const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { PickersArrowSwitcher } from "./components/PickersArrowSwitcher/PickersArrowSwitcher.js";
|
|
2
2
|
export type { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps } from './components/PickersArrowSwitcher';
|
|
3
|
-
export { PickerFieldUI, PickerFieldUIContextProvider, cleanFieldResponse, useFieldTextFieldProps } from "./components/PickerFieldUI.js";
|
|
4
|
-
export type { ExportedPickerFieldUIProps, PickerFieldUISlots, PickerFieldUISlotProps } from './components/PickerFieldUI';
|
|
3
|
+
export { PickerFieldUI, PickerFieldUIContextProvider, cleanFieldResponse, useFieldTextFieldProps, PickerFieldUIContext, mergeSlotProps } from "./components/PickerFieldUI.js";
|
|
4
|
+
export type { ExportedPickerFieldUIProps, PickerFieldUISlots, PickerFieldUISlotProps, PickerFieldUISlotsFromContext, PickerFieldUISlotPropsFromContext } from './components/PickerFieldUI';
|
|
5
5
|
export { PickerProvider } from "./components/PickerProvider.js";
|
|
6
6
|
export type { PickerContextValue } from './components/PickerProvider';
|
|
7
7
|
export { PickersModalDialog } from "./components/PickersModalDialog.js";
|
|
@@ -25,9 +25,10 @@ export { DAY_MARGIN, DIALOG_WIDTH, VIEW_HEIGHT } from "./constants/dimensions.js
|
|
|
25
25
|
export { useControlledValueWithTimezone } from "./hooks/useValueWithTimezone.js";
|
|
26
26
|
export type { DesktopOnlyPickerProps } from './hooks/useDesktopPicker';
|
|
27
27
|
export { useField, useFieldInternalPropsWithDefaults, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./hooks/useField/index.js";
|
|
28
|
-
export type { UseFieldInternalProps, UseFieldParams, UseFieldResponse, FieldValueManager, FieldChangeHandler, FieldChangeHandlerContext
|
|
28
|
+
export type { UseFieldInternalProps, UseFieldParams, UseFieldResponse, FieldValueManager, FieldChangeHandler, FieldChangeHandlerContext } from './hooks/useField';
|
|
29
29
|
export { useFieldOwnerState } from "./hooks/useFieldOwnerState.js";
|
|
30
30
|
export type { MobileOnlyPickerProps } from './hooks/useMobilePicker';
|
|
31
|
+
export { useNullableFieldPrivateContext } from "./hooks/useNullableFieldPrivateContext.js";
|
|
31
32
|
export { useNullablePickerContext } from "./hooks/useNullablePickerContext.js";
|
|
32
33
|
export { usePicker } from "./hooks/usePicker/index.js";
|
|
33
34
|
export type { UsePickerParams, UsePickerProps, UsePickerValueFieldResponse, PickerViewsRendererProps } from './hooks/usePicker';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { PickersArrowSwitcher } from "./components/PickersArrowSwitcher/PickersArrowSwitcher.js";
|
|
2
|
-
export { PickerFieldUI, PickerFieldUIContextProvider, cleanFieldResponse, useFieldTextFieldProps } from "./components/PickerFieldUI.js";
|
|
2
|
+
export { PickerFieldUI, PickerFieldUIContextProvider, cleanFieldResponse, useFieldTextFieldProps, PickerFieldUIContext, mergeSlotProps } from "./components/PickerFieldUI.js";
|
|
3
3
|
export { PickerProvider } from "./components/PickerProvider.js";
|
|
4
4
|
export { PickersModalDialog } from "./components/PickersModalDialog.js";
|
|
5
5
|
export { PickerPopper } from "./components/PickerPopper/PickerPopper.js";
|
|
@@ -13,6 +13,7 @@ export { DAY_MARGIN, DIALOG_WIDTH, VIEW_HEIGHT } from "./constants/dimensions.js
|
|
|
13
13
|
export { useControlledValueWithTimezone } from "./hooks/useValueWithTimezone.js";
|
|
14
14
|
export { useField, useFieldInternalPropsWithDefaults, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./hooks/useField/index.js";
|
|
15
15
|
export { useFieldOwnerState } from "./hooks/useFieldOwnerState.js";
|
|
16
|
+
export { useNullableFieldPrivateContext } from "./hooks/useNullableFieldPrivateContext.js";
|
|
16
17
|
export { useNullablePickerContext } from "./hooks/useNullablePickerContext.js";
|
|
17
18
|
export { usePicker } from "./hooks/usePicker/index.js";
|
|
18
19
|
export { usePickerPrivateContext } from "./hooks/usePickerPrivateContext.js";
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import type { FieldSection } from '../../models';
|
|
2
|
-
import type { UseFieldInternalProps } from '../hooks/useField';
|
|
3
2
|
import { RangePosition } from "./pickers.js";
|
|
4
|
-
import { PickerValidValue } from "./value.js";
|
|
5
3
|
export interface FieldRangeSection extends FieldSection {
|
|
6
4
|
dateName: RangePosition;
|
|
7
5
|
}
|
|
8
|
-
export interface BaseForwardedSingleInputFieldProps {
|
|
9
|
-
id?: string;
|
|
10
|
-
focused?: boolean;
|
|
11
|
-
onKeyDown?: React.KeyboardEventHandler;
|
|
12
|
-
onBlur?: React.FocusEventHandler;
|
|
13
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
14
|
-
}
|
|
15
6
|
/**
|
|
16
7
|
* Props the single input field can receive when used inside a picker.
|
|
17
8
|
* Only contains what the MUI components are passing to the field, not what users can pass using the `props.slotProps.field`.
|
|
18
9
|
*/
|
|
19
|
-
export
|
|
10
|
+
export interface BaseSingleInputFieldProps {
|
|
11
|
+
id?: string;
|
|
12
|
+
}
|