@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
|
@@ -1,49 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
// date-fns@<3 has no exports field defined
|
|
2
|
+
// See https://github.com/date-fns/date-fns/issues/1781
|
|
3
|
+
/* eslint-disable import/extensions, class-methods-use-this */
|
|
2
4
|
// @ts-nocheck
|
|
3
|
-
import addDays from 'date-fns/addDays';
|
|
4
|
-
import addSeconds from 'date-fns/addSeconds';
|
|
5
|
-
import addMinutes from 'date-fns/addMinutes';
|
|
6
|
-
import addHours from 'date-fns/addHours';
|
|
7
|
-
import addWeeks from 'date-fns/addWeeks';
|
|
8
|
-
import addMonths from 'date-fns/addMonths';
|
|
9
|
-
import addYears from 'date-fns/addYears';
|
|
10
|
-
import endOfDay from 'date-fns/endOfDay';
|
|
11
|
-
import endOfWeek from 'date-fns/endOfWeek';
|
|
12
|
-
import endOfYear from 'date-fns/endOfYear';
|
|
13
|
-
import dateFnsFormat from 'date-fns/format';
|
|
14
|
-
import getDate from 'date-fns/getDate';
|
|
15
|
-
import getDaysInMonth from 'date-fns/getDaysInMonth';
|
|
16
|
-
import getHours from 'date-fns/getHours';
|
|
17
|
-
import getMinutes from 'date-fns/getMinutes';
|
|
18
|
-
import getMonth from 'date-fns/getMonth';
|
|
19
|
-
import getSeconds from 'date-fns/getSeconds';
|
|
20
|
-
import getMilliseconds from 'date-fns/getMilliseconds';
|
|
21
|
-
import getWeek from 'date-fns/getWeek';
|
|
22
|
-
import getYear from 'date-fns/getYear';
|
|
23
|
-
import isAfter from 'date-fns/isAfter';
|
|
24
|
-
import isBefore from 'date-fns/isBefore';
|
|
25
|
-
import isEqual from 'date-fns/isEqual';
|
|
26
|
-
import isSameDay from 'date-fns/isSameDay';
|
|
27
|
-
import isSameYear from 'date-fns/isSameYear';
|
|
28
|
-
import isSameMonth from 'date-fns/isSameMonth';
|
|
29
|
-
import isSameHour from 'date-fns/isSameHour';
|
|
30
|
-
import isValid from 'date-fns/isValid';
|
|
31
|
-
import dateFnsParse from 'date-fns/parse';
|
|
32
|
-
import setDate from 'date-fns/setDate';
|
|
33
|
-
import setHours from 'date-fns/setHours';
|
|
34
|
-
import setMinutes from 'date-fns/setMinutes';
|
|
35
|
-
import setMonth from 'date-fns/setMonth';
|
|
36
|
-
import setSeconds from 'date-fns/setSeconds';
|
|
37
|
-
import setMilliseconds from 'date-fns/setMilliseconds';
|
|
38
|
-
import setYear from 'date-fns/setYear';
|
|
39
|
-
import startOfDay from 'date-fns/startOfDay';
|
|
40
|
-
import startOfMonth from 'date-fns/startOfMonth';
|
|
41
|
-
import endOfMonth from 'date-fns/endOfMonth';
|
|
42
|
-
import startOfWeek from 'date-fns/startOfWeek';
|
|
43
|
-
import startOfYear from 'date-fns/startOfYear';
|
|
44
|
-
import isWithinInterval from 'date-fns/isWithinInterval';
|
|
45
|
-
import defaultLocale from 'date-fns/locale/en-US';
|
|
46
|
-
import longFormatters from 'date-fns/_lib/format/longFormatters';
|
|
5
|
+
import addDays from 'date-fns/addDays/index.js';
|
|
6
|
+
import addSeconds from 'date-fns/addSeconds/index.js';
|
|
7
|
+
import addMinutes from 'date-fns/addMinutes/index.js';
|
|
8
|
+
import addHours from 'date-fns/addHours/index.js';
|
|
9
|
+
import addWeeks from 'date-fns/addWeeks/index.js';
|
|
10
|
+
import addMonths from 'date-fns/addMonths/index.js';
|
|
11
|
+
import addYears from 'date-fns/addYears/index.js';
|
|
12
|
+
import endOfDay from 'date-fns/endOfDay/index.js';
|
|
13
|
+
import endOfWeek from 'date-fns/endOfWeek/index.js';
|
|
14
|
+
import endOfYear from 'date-fns/endOfYear/index.js';
|
|
15
|
+
import dateFnsFormat from 'date-fns/format/index.js';
|
|
16
|
+
import getDate from 'date-fns/getDate/index.js';
|
|
17
|
+
import getDaysInMonth from 'date-fns/getDaysInMonth/index.js';
|
|
18
|
+
import getHours from 'date-fns/getHours/index.js';
|
|
19
|
+
import getMinutes from 'date-fns/getMinutes/index.js';
|
|
20
|
+
import getMonth from 'date-fns/getMonth/index.js';
|
|
21
|
+
import getSeconds from 'date-fns/getSeconds/index.js';
|
|
22
|
+
import getMilliseconds from 'date-fns/getMilliseconds/index.js';
|
|
23
|
+
import getWeek from 'date-fns/getWeek/index.js';
|
|
24
|
+
import getYear from 'date-fns/getYear/index.js';
|
|
25
|
+
import isAfter from 'date-fns/isAfter/index.js';
|
|
26
|
+
import isBefore from 'date-fns/isBefore/index.js';
|
|
27
|
+
import isEqual from 'date-fns/isEqual/index.js';
|
|
28
|
+
import isSameDay from 'date-fns/isSameDay/index.js';
|
|
29
|
+
import isSameYear from 'date-fns/isSameYear/index.js';
|
|
30
|
+
import isSameMonth from 'date-fns/isSameMonth/index.js';
|
|
31
|
+
import isSameHour from 'date-fns/isSameHour/index.js';
|
|
32
|
+
import isValid from 'date-fns/isValid/index.js';
|
|
33
|
+
import dateFnsParse from 'date-fns/parse/index.js';
|
|
34
|
+
import setDate from 'date-fns/setDate/index.js';
|
|
35
|
+
import setHours from 'date-fns/setHours/index.js';
|
|
36
|
+
import setMinutes from 'date-fns/setMinutes/index.js';
|
|
37
|
+
import setMonth from 'date-fns/setMonth/index.js';
|
|
38
|
+
import setSeconds from 'date-fns/setSeconds/index.js';
|
|
39
|
+
import setMilliseconds from 'date-fns/setMilliseconds/index.js';
|
|
40
|
+
import setYear from 'date-fns/setYear/index.js';
|
|
41
|
+
import startOfDay from 'date-fns/startOfDay/index.js';
|
|
42
|
+
import startOfMonth from 'date-fns/startOfMonth/index.js';
|
|
43
|
+
import endOfMonth from 'date-fns/endOfMonth/index.js';
|
|
44
|
+
import startOfWeek from 'date-fns/startOfWeek/index.js';
|
|
45
|
+
import startOfYear from 'date-fns/startOfYear/index.js';
|
|
46
|
+
import isWithinInterval from 'date-fns/isWithinInterval/index.js';
|
|
47
|
+
import defaultLocale from 'date-fns/locale/en-US/index.js';
|
|
48
|
+
import longFormatters from 'date-fns/_lib/format/longFormatters/index.js';
|
|
47
49
|
import { AdapterDateFnsBase } from "../AdapterDateFnsBase/index.js";
|
|
48
50
|
/**
|
|
49
51
|
* Based on `@date-io/date-fns`
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
/* eslint-disable class-methods-use-this */
|
|
3
3
|
import defaultDayjs from 'dayjs';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
4
|
+
// dayjs has no exports field defined
|
|
5
|
+
// See https://github.com/iamkun/dayjs/issues/2562
|
|
6
|
+
/* eslint-disable import/extensions */
|
|
7
|
+
import weekOfYearPlugin from 'dayjs/plugin/weekOfYear.js';
|
|
8
|
+
import customParseFormatPlugin from 'dayjs/plugin/customParseFormat.js';
|
|
9
|
+
import localizedFormatPlugin from 'dayjs/plugin/localizedFormat.js';
|
|
10
|
+
import isBetweenPlugin from 'dayjs/plugin/isBetween.js';
|
|
11
|
+
import advancedFormatPlugin from 'dayjs/plugin/advancedFormat.js';
|
|
12
|
+
/* eslint-enable import/extensions */
|
|
9
13
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
10
14
|
defaultDayjs.extend(localizedFormatPlugin);
|
|
11
15
|
defaultDayjs.extend(weekOfYearPlugin);
|
|
@@ -344,6 +344,7 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
|
|
|
344
344
|
referenceDate: referenceDate
|
|
345
345
|
})), view === 'day' && /*#__PURE__*/_jsx(DayCalendar, _extends({}, calendarState, baseDateValidationProps, commonViewProps, {
|
|
346
346
|
onMonthSwitchingAnimationEnd: onMonthSwitchingAnimationEnd,
|
|
347
|
+
hasFocus: hasFocus,
|
|
347
348
|
onFocusedDayChange: focusedDate => setVisibleDate({
|
|
348
349
|
target: focusedDate,
|
|
349
350
|
reason: 'cell-interaction'
|
|
@@ -354,7 +355,6 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
|
|
|
354
355
|
shouldDisableDate: shouldDisableDate,
|
|
355
356
|
shouldDisableMonth: shouldDisableMonth,
|
|
356
357
|
shouldDisableYear: shouldDisableYear,
|
|
357
|
-
hasFocus: hasFocus,
|
|
358
358
|
onFocusedViewChange: isViewFocused => setFocusedView('day', isViewFocused),
|
|
359
359
|
showDaysOutsideCurrentMonth: showDaysOutsideCurrentMonth,
|
|
360
360
|
fixedWeekNumber: fixedWeekNumber,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UseDateFieldProps } from "./DateField.types.js";
|
|
2
|
-
export declare const useDateField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseDateFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "autoFocus" | "onChange" | "onError" | "format" | "
|
|
2
|
+
export declare const useDateField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseDateFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "autoFocus" | "onChange" | "onError" | "format" | "focused" | keyof import("../internals").BaseDateValidationProps | "shouldDisableYear" | "shouldDisableMonth" | "shouldDisableDate" | "referenceDate" | "formatDensity" | "timezone" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "unstableStartFieldRef" | "unstableEndFieldRef" | "enableAccessibleFieldDOMStructure" | "dateSeparator">>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DesktopDatePickerProps, DesktopDatePickerSlots, DesktopDatePickerSlotProps } from "../DesktopDatePicker/index.js";
|
|
2
|
-
import { BaseSingleInputFieldProps
|
|
2
|
+
import { BaseSingleInputFieldProps } from "../internals/models/index.js";
|
|
3
3
|
import { MobileDatePickerProps, MobileDatePickerSlots, MobileDatePickerSlotProps } from "../MobileDatePicker/index.js";
|
|
4
4
|
import { ValidateDateProps } from "../validation/validateDate.js";
|
|
5
5
|
export interface DatePickerSlots extends DesktopDatePickerSlots, MobileDatePickerSlots {}
|
|
@@ -35,4 +35,4 @@ export interface DatePickerProps<TEnableAccessibleFieldDOMStructure extends bool
|
|
|
35
35
|
/**
|
|
36
36
|
* Props the field can receive when used inside a date picker (<DatePicker />, <DesktopDatePicker /> or <MobileDatePicker /> component).
|
|
37
37
|
*/
|
|
38
|
-
export type DatePickerFieldProps = ValidateDateProps & BaseSingleInputFieldProps
|
|
38
|
+
export type DatePickerFieldProps = ValidateDateProps & BaseSingleInputFieldProps;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UseDateTimeFieldProps } from "./DateTimeField.types.js";
|
|
2
|
-
export declare const useDateTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "autoFocus" | "onChange" | "onError" | "format" | "
|
|
2
|
+
export declare const useDateTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "autoFocus" | "onChange" | "onError" | "format" | "focused" | "maxDate" | "minDate" | "disablePast" | "disableFuture" | "shouldDisableYear" | "shouldDisableMonth" | "shouldDisableDate" | "minTime" | "maxTime" | "minutesStep" | "shouldDisableTime" | "disableIgnoringDatePartForTimeValidation" | "ampm" | "minDateTime" | "maxDateTime" | "referenceDate" | "formatDensity" | "timezone" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "unstableStartFieldRef" | "unstableEndFieldRef" | "enableAccessibleFieldDOMStructure" | "dateSeparator">>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DesktopDateTimePickerProps, DesktopDateTimePickerSlots, DesktopDateTimePickerSlotProps } from "../DesktopDateTimePicker/index.js";
|
|
2
|
-
import { BaseSingleInputFieldProps, DateOrTimeViewWithMeridiem
|
|
2
|
+
import { BaseSingleInputFieldProps, DateOrTimeViewWithMeridiem } from "../internals/models/index.js";
|
|
3
3
|
import { MobileDateTimePickerProps, MobileDateTimePickerSlots, MobileDateTimePickerSlotProps } from "../MobileDateTimePicker/index.js";
|
|
4
4
|
import { ValidateDateTimeProps } from "../validation/index.js";
|
|
5
5
|
import { ExportedYearCalendarProps } from "../YearCalendar/YearCalendar.types.js";
|
|
@@ -31,4 +31,4 @@ export interface DateTimePickerProps<TEnableAccessibleFieldDOMStructure extends
|
|
|
31
31
|
/**
|
|
32
32
|
* Props the field can receive when used inside a date time picker (<DateTimePicker />, <DesktopDateTimePicker /> or <MobileDateTimePicker /> component).
|
|
33
33
|
*/
|
|
34
|
-
export type DateTimePickerFieldProps = ValidateDateTimeProps & BaseSingleInputFieldProps
|
|
34
|
+
export type DateTimePickerFieldProps = ValidateDateTimeProps & BaseSingleInputFieldProps;
|
|
@@ -104,7 +104,7 @@ const ClockPin = styled('div', {
|
|
|
104
104
|
left: '50%',
|
|
105
105
|
transform: 'translate(-50%, -50%)'
|
|
106
106
|
}));
|
|
107
|
-
const meridiemButtonCommonStyles = (theme,
|
|
107
|
+
const meridiemButtonCommonStyles = (theme, clockMeridiemMode) => ({
|
|
108
108
|
zIndex: 1,
|
|
109
109
|
bottom: 8,
|
|
110
110
|
paddingLeft: 4,
|
|
@@ -112,7 +112,7 @@ const meridiemButtonCommonStyles = (theme, meridiemMode) => ({
|
|
|
112
112
|
width: CLOCK_HOUR_WIDTH,
|
|
113
113
|
variants: [{
|
|
114
114
|
props: {
|
|
115
|
-
|
|
115
|
+
clockMeridiemMode
|
|
116
116
|
},
|
|
117
117
|
style: {
|
|
118
118
|
backgroundColor: (theme.vars || theme).palette.primary.main,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UseTimeFieldProps } from "./TimeField.types.js";
|
|
2
|
-
export declare const useTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "autoFocus" | "onChange" | "onError" | "format" | "
|
|
2
|
+
export declare const useTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "autoFocus" | "onChange" | "onError" | "format" | "focused" | keyof import("../internals").BaseTimeValidationProps | keyof import("../internals").TimeValidationProps | "ampm" | "referenceDate" | "formatDensity" | "timezone" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "unstableStartFieldRef" | "unstableEndFieldRef" | "enableAccessibleFieldDOMStructure" | "dateSeparator">>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DesktopTimePickerProps, DesktopTimePickerSlots, DesktopTimePickerSlotProps } from "../DesktopTimePicker/index.js";
|
|
2
|
-
import { BaseSingleInputFieldProps,
|
|
2
|
+
import { BaseSingleInputFieldProps, TimeViewWithMeridiem } from "../internals/models/index.js";
|
|
3
3
|
import { MobileTimePickerProps, MobileTimePickerSlots, MobileTimePickerSlotProps } from "../MobileTimePicker/index.js";
|
|
4
4
|
import { ValidateTimeProps } from "../validation/validateTime.js";
|
|
5
5
|
export interface TimePickerSlots extends DesktopTimePickerSlots, MobileTimePickerSlots {}
|
|
@@ -25,4 +25,4 @@ export interface TimePickerProps<TEnableAccessibleFieldDOMStructure extends bool
|
|
|
25
25
|
/**
|
|
26
26
|
* Props the field can receive when used inside a time picker (<TimePicker />, <DesktopTimePicker /> or <MobileTimePicker /> component).
|
|
27
27
|
*/
|
|
28
|
-
export type TimePickerFieldProps = ValidateTimeProps & BaseSingleInputFieldProps
|
|
28
|
+
export type TimePickerFieldProps = ValidateTimeProps & BaseSingleInputFieldProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DATE_TIME_VALIDATION_PROP_NAMES, DATE_VALIDATION_PROP_NAMES, TIME_VALIDATION_PROP_NAMES } from "../validation/extractValidationProps.js";
|
|
2
2
|
import { PickerValueType } from "../models/common.js";
|
|
3
|
-
declare const SHARED_FIELD_INTERNAL_PROP_NAMES: readonly ["value", "defaultValue", "referenceDate", "format", "formatDensity", "onChange", "timezone", "onError", "shouldRespectLeadingZeros", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef", "unstableStartFieldRef", "unstableEndFieldRef", "enableAccessibleFieldDOMStructure", "disabled", "readOnly", "dateSeparator", "autoFocus"];
|
|
3
|
+
declare const SHARED_FIELD_INTERNAL_PROP_NAMES: readonly ["value", "defaultValue", "referenceDate", "format", "formatDensity", "onChange", "timezone", "onError", "shouldRespectLeadingZeros", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef", "unstableStartFieldRef", "unstableEndFieldRef", "enableAccessibleFieldDOMStructure", "disabled", "readOnly", "dateSeparator", "autoFocus", "focused"];
|
|
4
4
|
type InternalPropNames<TValueType extends PickerValueType> = (typeof SHARED_FIELD_INTERNAL_PROP_NAMES)[number] | (TValueType extends 'date' | 'date-time' ? (typeof DATE_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'time' | 'date-time' ? (typeof TIME_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'date-time' ? (typeof DATE_TIME_VALIDATION_PROP_NAMES)[number] : never);
|
|
5
5
|
/**
|
|
6
6
|
* Split the props received by the field component into:
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { DATE_TIME_VALIDATION_PROP_NAMES, DATE_VALIDATION_PROP_NAMES, TIME_VALIDATION_PROP_NAMES } from "../validation/extractValidationProps.js";
|
|
6
|
-
const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'unstableStartFieldRef', 'unstableEndFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly', 'dateSeparator', 'autoFocus'];
|
|
6
|
+
const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'unstableStartFieldRef', 'unstableEndFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly', 'dateSeparator', 'autoFocus', 'focused'];
|
|
7
7
|
/**
|
|
8
8
|
* Split the props received by the field component into:
|
|
9
9
|
* - `internalProps` which are used by the various hooks called by the field component.
|
package/modern/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export declare const cleanFieldResponse: <TFieldResponse extends MakeOptional<Us
|
|
|
17
17
|
openPickerAriaLabel: string;
|
|
18
18
|
textFieldProps: TextFieldProps | PickersTextFieldProps;
|
|
19
19
|
};
|
|
20
|
+
export declare const PickerFieldUIContext: React.Context<PickerFieldUIContextValue>;
|
|
20
21
|
/**
|
|
21
22
|
* Adds the button to open the picker and the button to clear the value of the field.
|
|
22
23
|
* @ignore - internal component.
|
|
@@ -111,6 +112,12 @@ export interface PickerFieldUISlotPropsFromContext extends PickerFieldUISlotProp
|
|
|
111
112
|
interface FieldInputAdornmentOwnerState extends FieldOwnerState {
|
|
112
113
|
position: 'start' | 'end';
|
|
113
114
|
}
|
|
115
|
+
interface PickerFieldUIContextValue {
|
|
116
|
+
inputRef: React.Ref<HTMLInputElement> | undefined;
|
|
117
|
+
slots: PickerFieldUISlotsFromContext;
|
|
118
|
+
slotProps: PickerFieldUISlotPropsFromContext;
|
|
119
|
+
}
|
|
120
|
+
export declare function mergeSlotProps<TProps extends {}, TOwnerState extends FieldOwnerState>(slotPropsA: SlotComponentPropsFromProps<TProps, {}, TOwnerState> | undefined, slotPropsB: SlotComponentPropsFromProps<TProps, {}, TOwnerState> | undefined): Partial<TProps> | ((ownerState: TOwnerState) => {}) | undefined;
|
|
114
121
|
/**
|
|
115
122
|
* The `textField` slot props cannot be handled inside `PickerFieldUI` because it would be a breaking change to not pass the enriched props to `useField`.
|
|
116
123
|
* Once the non-accessible DOM structure will be removed, we will be able to remove the `textField` slot and clean this logic.
|
|
@@ -85,7 +85,7 @@ export const cleanFieldResponse = _ref => {
|
|
|
85
85
|
})
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
|
-
const PickerFieldUIContext = /*#__PURE__*/React.createContext({
|
|
88
|
+
export const PickerFieldUIContext = /*#__PURE__*/React.createContext({
|
|
89
89
|
slots: {},
|
|
90
90
|
slotProps: {},
|
|
91
91
|
inputRef: undefined
|
|
@@ -234,7 +234,7 @@ export function PickerFieldUI(props) {
|
|
|
234
234
|
}
|
|
235
235
|
return /*#__PURE__*/_jsx(TextField, _extends({}, textFieldProps));
|
|
236
236
|
}
|
|
237
|
-
function mergeSlotProps(slotPropsA, slotPropsB) {
|
|
237
|
+
export function mergeSlotProps(slotPropsA, slotPropsB) {
|
|
238
238
|
if (!slotPropsA) {
|
|
239
239
|
return slotPropsB;
|
|
240
240
|
}
|
|
@@ -60,10 +60,7 @@ export interface ExportedPickerPopperProps {
|
|
|
60
60
|
placement?: MuiPopperProps['placement'];
|
|
61
61
|
}
|
|
62
62
|
export interface PickerPopperProps extends ExportedPickerPopperProps {
|
|
63
|
-
role: 'tooltip' | 'dialog';
|
|
64
|
-
containerRef?: React.Ref<HTMLDivElement>;
|
|
65
63
|
children?: React.ReactNode;
|
|
66
|
-
onBlur?: () => void;
|
|
67
64
|
slots?: PickerPopperSlots;
|
|
68
65
|
slotProps?: PickerPopperSlotProps;
|
|
69
66
|
}
|
|
@@ -11,7 +11,7 @@ import BaseFocusTrap from '@mui/material/Unstable_TrapFocus';
|
|
|
11
11
|
import { unstable_useForkRef as useForkRef, unstable_useEventCallback as useEventCallback, unstable_ownerDocument as ownerDocument, unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
12
12
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
13
13
|
import { getPickerPopperUtilityClass } from "./pickerPopperClasses.js";
|
|
14
|
-
import { getActiveElement } from "../../utils/utils.js";
|
|
14
|
+
import { executeInTheNextEventLoopTick, getActiveElement } from "../../utils/utils.js";
|
|
15
15
|
import { usePickerPrivateContext } from "../../hooks/usePickerPrivateContext.js";
|
|
16
16
|
import { usePickerContext } from "../../../hooks/index.js";
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -206,9 +206,6 @@ export function PickerPopper(inProps) {
|
|
|
206
206
|
});
|
|
207
207
|
const {
|
|
208
208
|
children,
|
|
209
|
-
containerRef = null,
|
|
210
|
-
onBlur,
|
|
211
|
-
role,
|
|
212
209
|
placement = 'bottom-start',
|
|
213
210
|
slots,
|
|
214
211
|
slotProps,
|
|
@@ -217,11 +214,13 @@ export function PickerPopper(inProps) {
|
|
|
217
214
|
const {
|
|
218
215
|
open,
|
|
219
216
|
triggerRef,
|
|
217
|
+
popupRef,
|
|
220
218
|
reduceAnimations
|
|
221
219
|
} = usePickerContext();
|
|
222
220
|
const {
|
|
223
221
|
dismissViews,
|
|
224
|
-
doesTheCurrentViewHasAnUI
|
|
222
|
+
doesTheCurrentViewHasAnUI,
|
|
223
|
+
viewContainerRole
|
|
225
224
|
} = usePickerPrivateContext();
|
|
226
225
|
React.useEffect(() => {
|
|
227
226
|
function handleKeyDown(nativeEvent) {
|
|
@@ -236,7 +235,7 @@ export function PickerPopper(inProps) {
|
|
|
236
235
|
}, [dismissViews, open]);
|
|
237
236
|
const lastFocusedElementRef = React.useRef(null);
|
|
238
237
|
React.useEffect(() => {
|
|
239
|
-
if (
|
|
238
|
+
if (viewContainerRole === 'tooltip' || !doesTheCurrentViewHasAnUI()) {
|
|
240
239
|
return;
|
|
241
240
|
}
|
|
242
241
|
if (open) {
|
|
@@ -250,18 +249,31 @@ export function PickerPopper(inProps) {
|
|
|
250
249
|
}
|
|
251
250
|
});
|
|
252
251
|
}
|
|
253
|
-
}, [open,
|
|
254
|
-
const [clickAwayRef, onPaperClick, onPaperTouchStart] = useClickAwayListener(open, onBlur ?? dismissViews);
|
|
255
|
-
const paperRef = React.useRef(null);
|
|
256
|
-
const handleRef = useForkRef(paperRef, containerRef);
|
|
257
|
-
const handlePaperRef = useForkRef(handleRef, clickAwayRef);
|
|
252
|
+
}, [open, viewContainerRole, doesTheCurrentViewHasAnUI]);
|
|
258
253
|
const classes = useUtilityClasses(classesProp);
|
|
259
254
|
const {
|
|
260
|
-
ownerState: pickerOwnerState
|
|
255
|
+
ownerState: pickerOwnerState,
|
|
256
|
+
rootRefObject
|
|
261
257
|
} = usePickerPrivateContext();
|
|
262
258
|
const ownerState = _extends({}, pickerOwnerState, {
|
|
263
259
|
popperPlacement: placement
|
|
264
260
|
});
|
|
261
|
+
const handleClickAway = useEventCallback(() => {
|
|
262
|
+
if (viewContainerRole === 'tooltip') {
|
|
263
|
+
executeInTheNextEventLoopTick(() => {
|
|
264
|
+
if (rootRefObject.current?.contains(getActiveElement(document)) || popupRef.current?.contains(getActiveElement(document))) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
dismissViews();
|
|
268
|
+
});
|
|
269
|
+
} else {
|
|
270
|
+
dismissViews();
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
const [clickAwayRef, onPaperClick, onPaperTouchStart] = useClickAwayListener(open, handleClickAway);
|
|
274
|
+
const paperRef = React.useRef(null);
|
|
275
|
+
const handleRef = useForkRef(paperRef, popupRef);
|
|
276
|
+
const handlePaperRef = useForkRef(handleRef, clickAwayRef);
|
|
265
277
|
const handleKeyDown = event => {
|
|
266
278
|
if (event.key === 'Escape') {
|
|
267
279
|
// stop the propagation to avoid closing parent modal
|
|
@@ -278,7 +290,7 @@ export function PickerPopper(inProps) {
|
|
|
278
290
|
externalSlotProps: slotProps?.popper,
|
|
279
291
|
additionalProps: {
|
|
280
292
|
transition: true,
|
|
281
|
-
role,
|
|
293
|
+
role: viewContainerRole == null ? undefined : viewContainerRole,
|
|
282
294
|
open,
|
|
283
295
|
placement,
|
|
284
296
|
anchorEl: triggerRef.current,
|
|
@@ -298,7 +310,7 @@ export function PickerPopper(inProps) {
|
|
|
298
310
|
// which would force screen readers to read too old label
|
|
299
311
|
,
|
|
300
312
|
disableRestoreFocus: true,
|
|
301
|
-
disableEnforceFocus:
|
|
313
|
+
disableEnforceFocus: viewContainerRole === 'tooltip',
|
|
302
314
|
isEnabled: () => true
|
|
303
315
|
}, slotProps?.desktopTrapFocus, {
|
|
304
316
|
children: /*#__PURE__*/_jsx(Transition, _extends({}, TransitionProps, slotProps?.desktopTransition, {
|
|
@@ -6,7 +6,7 @@ import { PickersInputLocaleText } from "../../locales/index.js";
|
|
|
6
6
|
import { DateOrTimeViewWithMeridiem, PickerOrientation, PickerValidValue, PickerVariant } from "../models/index.js";
|
|
7
7
|
import type { UsePickerValueActionsContextValue, UsePickerValueContextValue, UsePickerValuePrivateContextValue } from '../hooks/usePicker/usePickerValue.types';
|
|
8
8
|
import { UsePickerViewsActionsContextValue, UsePickerViewsContextValue, UsePickerViewsPrivateContextValue } from "../hooks/usePicker/usePickerViews.js";
|
|
9
|
-
import { PickerFieldPrivateContextValue } from "../hooks/
|
|
9
|
+
import { PickerFieldPrivateContextValue } from "../hooks/useNullableFieldPrivateContext.js";
|
|
10
10
|
export declare const PickerActionsContext: React.Context<PickerActionsContextValue<any, any, any> | null>;
|
|
11
11
|
export declare const PickerPrivateContext: React.Context<PickerPrivateContextValue>;
|
|
12
12
|
/**
|
|
@@ -35,6 +35,12 @@ export interface PickerContextValue<TValue extends PickerValidValue, TView exten
|
|
|
35
35
|
* Whether the picker is read-only.
|
|
36
36
|
*/
|
|
37
37
|
readOnly: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the picker should be focused on mount.
|
|
40
|
+
* If the picker has a field and is not open, the field should be focused.
|
|
41
|
+
* If the picker does not have a field (if it is a static picker) or is not open, the view should be focused.
|
|
42
|
+
*/
|
|
43
|
+
autoFocus: boolean;
|
|
38
44
|
/**
|
|
39
45
|
* The responsive variant of the picker.
|
|
40
46
|
* It is equal to "desktop" when using a desktop picker (like <DesktopDatePicker />).
|
|
@@ -68,6 +74,11 @@ export interface PickerContextValue<TValue extends PickerValidValue, TView exten
|
|
|
68
74
|
* If it is "enabled", the field should render an interactive UI to open the Picker.
|
|
69
75
|
*/
|
|
70
76
|
triggerStatus: 'hidden' | 'disabled' | 'enabled';
|
|
77
|
+
/**
|
|
78
|
+
* The ref to attach to the popup's outermost element that contains the view, if any.
|
|
79
|
+
* When using a built-in popup component, this property is automatically attached to the appropriate element.
|
|
80
|
+
*/
|
|
81
|
+
popupRef: React.RefObject<any>;
|
|
71
82
|
/**
|
|
72
83
|
* The format to use when rendering the value in the field.
|
|
73
84
|
* It is equal to the picker `format` prop if defined.
|
|
@@ -117,4 +128,13 @@ export interface PickerPrivateContextValue extends UsePickerValuePrivateContextV
|
|
|
117
128
|
* The ownerState of the picker.
|
|
118
129
|
*/
|
|
119
130
|
ownerState: PickerOwnerState;
|
|
131
|
+
/**
|
|
132
|
+
* The ref of the root element.
|
|
133
|
+
* This is the object counterpart of the `usePickerContext().rootRef` property which can be a function.
|
|
134
|
+
*/
|
|
135
|
+
rootRefObject: React.RefObject<HTMLDivElement | null>;
|
|
136
|
+
/**
|
|
137
|
+
* The id of the label element.
|
|
138
|
+
*/
|
|
139
|
+
labelId: string | undefined;
|
|
120
140
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { LocalizationProvider } from "../../LocalizationProvider/index.js";
|
|
3
3
|
import { IsValidValueContext } from "../../hooks/useIsValidValue.js";
|
|
4
|
-
import { PickerFieldPrivateContext } from "../hooks/
|
|
4
|
+
import { PickerFieldPrivateContext } from "../hooks/useNullableFieldPrivateContext.js";
|
|
5
5
|
import { PickerContext } from "../../hooks/usePickerContext.js";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
export const PickerActionsContext = /*#__PURE__*/React.createContext(null);
|
|
@@ -16,7 +16,12 @@ export const PickerPrivateContext = /*#__PURE__*/React.createContext({
|
|
|
16
16
|
},
|
|
17
17
|
dismissViews: () => {},
|
|
18
18
|
hasUIView: true,
|
|
19
|
-
doesTheCurrentViewHasAnUI: () => true
|
|
19
|
+
doesTheCurrentViewHasAnUI: () => true,
|
|
20
|
+
rootRefObject: {
|
|
21
|
+
current: null
|
|
22
|
+
},
|
|
23
|
+
viewContainerRole: null,
|
|
24
|
+
labelId: undefined
|
|
20
25
|
});
|
|
21
26
|
|
|
22
27
|
/**
|
|
@@ -15,10 +15,10 @@ const getChildTypeFromChildName = childName => {
|
|
|
15
15
|
if (childName.match(/^Static([A-Za-z]+)/) || childName.match(/^([A-Za-z]+)(Calendar|Clock)$/)) {
|
|
16
16
|
return 'UI-view';
|
|
17
17
|
}
|
|
18
|
-
if (childName.match(/^MultiInput([A-Za-z]+)RangeField$/)
|
|
18
|
+
if (childName.match(/^MultiInput([A-Za-z]+)RangeField$/)) {
|
|
19
19
|
return 'multi-input-range-field';
|
|
20
20
|
}
|
|
21
|
-
if (childName.match(/^SingleInput([A-Za-z]+)RangeField$/)) {
|
|
21
|
+
if (childName.match(/^SingleInput([A-Za-z]+)RangeField$/) || childName.match(/^([A-Za-z]+)RangePicker$/)) {
|
|
22
22
|
return 'single-input-range-field';
|
|
23
23
|
}
|
|
24
24
|
return 'single-input-field';
|
|
@@ -133,7 +133,7 @@ export function DemoContainer(props) {
|
|
|
133
133
|
minWidth: {
|
|
134
134
|
xs: 300,
|
|
135
135
|
// If demo also contains MultiInputDateTimeRangeField, increase width to avoid cutting off the value.
|
|
136
|
-
md: childrenTypes.has('multi-input-range-field') ? 460 :
|
|
136
|
+
md: childrenTypes.has('multi-input-range-field') ? 460 : 440
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
};
|
|
@@ -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 { PickerPopper } from "../../components/PickerPopper/PickerPopper.js";
|
|
10
8
|
import { usePicker } from "../usePicker/index.js";
|
|
11
9
|
import { PickersLayout } from "../../../PickersLayout/index.js";
|
|
@@ -29,35 +27,26 @@ export const useDesktopPicker = _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: 'desktop'
|
|
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,18 +69,12 @@ export const useDesktopPicker = _ref => {
|
|
|
80
69
|
'aria-labelledby': labelledById
|
|
81
70
|
}, innerSlotProps?.popper)
|
|
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(PickerPopper, {
|
|
94
|
-
role: "dialog",
|
|
77
|
+
children: [/*#__PURE__*/_jsx(Field, _extends({}, fieldProps)), /*#__PURE__*/_jsx(PickerPopper, {
|
|
95
78
|
slots: slots,
|
|
96
79
|
slotProps: slotProps,
|
|
97
80
|
children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
|
|
@@ -15,11 +15,6 @@ export interface UseDesktopPickerSlots extends Pick<PickerPopperSlots, 'desktopP
|
|
|
15
15
|
* Component used to enter the date with the keyboard.
|
|
16
16
|
*/
|
|
17
17
|
field: React.ElementType;
|
|
18
|
-
/**
|
|
19
|
-
* Form control with an input to render the value inside the default field.
|
|
20
|
-
* @default TextField from '@mui/material' or PickersTextField if `enableAccessibleFieldDOMStructure` is `true`.
|
|
21
|
-
*/
|
|
22
|
-
textField?: React.ElementType;
|
|
23
18
|
}
|
|
24
19
|
export interface ExportedUseDesktopPickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends PickerPopperSlotProps, ExportedPickersLayoutSlotProps<PickerValue>, PickerFieldUISlotPropsFromContext {
|
|
25
20
|
field?: SlotComponentPropsFromProps<PickerFieldSlotProps<PickerValue, TEnableAccessibleFieldDOMStructure>, {}, PickerOwnerState>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { useField } from "./useField.js";
|
|
2
2
|
export type { FieldValueManager, UseFieldInternalProps, UseFieldParams, UseFieldResponse, FieldChangeHandler, FieldChangeHandlerContext } from './useField.types';
|
|
3
3
|
export { createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./useField.utils.js";
|
|
4
|
-
export { useFieldInternalPropsWithDefaults } from "./useFieldInternalPropsWithDefaults.js";
|
|
5
|
-
export type { PickerFieldPrivateContextValue } from './useFieldInternalPropsWithDefaults';
|
|
4
|
+
export { useFieldInternalPropsWithDefaults } from "./useFieldInternalPropsWithDefaults.js";
|