@mui/x-date-pickers 6.11.0 → 6.11.2
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/CHANGELOG.md +119 -1
- package/DateCalendar/DateCalendar.js +2 -2
- package/DateCalendar/DateCalendar.types.d.ts +2 -2
- package/DateField/DateField.js +1 -0
- package/DatePicker/DatePicker.js +2 -2
- package/DateTimeField/DateTimeField.js +1 -0
- package/DateTimePicker/DateTimePicker.js +2 -2
- package/DateTimePicker/DateTimePickerToolbar.js +4 -3
- package/DesktopDatePicker/DesktopDatePicker.js +2 -2
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
- package/DesktopTimePicker/DesktopTimePicker.js +5 -0
- package/DigitalClock/DigitalClock.js +3 -1
- package/MobileDatePicker/MobileDatePicker.js +2 -2
- package/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/MobileTimePicker/MobileTimePicker.js +5 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -1
- package/PickersDay/PickersDay.js +1 -0
- package/PickersShortcuts/PickersShortcuts.d.ts +2 -1
- package/PickersShortcuts/PickersShortcuts.js +10 -4
- package/PickersShortcuts/index.d.ts +1 -1
- package/StaticDatePicker/StaticDatePicker.js +2 -2
- package/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
- package/StaticTimePicker/StaticTimePicker.js +5 -0
- package/TimeField/TimeField.js +1 -0
- package/TimePicker/TimePicker.js +5 -0
- package/TimePicker/TimePickerToolbar.js +3 -2
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -11
- package/internals/components/PickersPopper.d.ts +2 -1
- package/internals/components/PickersPopper.js +7 -2
- package/internals/components/PickersToolbar.js +13 -13
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
- package/internals/hooks/useField/useField.js +1 -1
- package/internals/hooks/usePicker/usePickerValue.js +11 -3
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +3 -5
- package/internals/hooks/usePicker/usePickerViews.d.ts +5 -0
- package/internals/utils/date-utils.d.ts +1 -0
- package/internals/utils/date-utils.js +4 -0
- package/legacy/DateCalendar/DateCalendar.js +2 -2
- package/legacy/DateField/DateField.js +1 -0
- package/legacy/DatePicker/DatePicker.js +2 -2
- package/legacy/DateTimeField/DateTimeField.js +1 -0
- package/legacy/DateTimePicker/DateTimePicker.js +2 -2
- package/legacy/DateTimePicker/DateTimePickerToolbar.js +4 -3
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +2 -2
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +5 -0
- package/legacy/DigitalClock/DigitalClock.js +3 -1
- package/legacy/MobileDatePicker/MobileDatePicker.js +2 -2
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/legacy/MobileTimePicker/MobileTimePicker.js +5 -0
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -2
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -1
- package/legacy/PickersDay/PickersDay.js +1 -0
- package/legacy/PickersShortcuts/PickersShortcuts.js +8 -4
- package/legacy/StaticDatePicker/StaticDatePicker.js +2 -2
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
- package/legacy/StaticTimePicker/StaticTimePicker.js +5 -0
- package/legacy/TimeField/TimeField.js +1 -0
- package/legacy/TimePicker/TimePicker.js +5 -0
- package/legacy/TimePicker/TimePickerToolbar.js +3 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -15
- package/legacy/internals/components/PickersPopper.js +7 -2
- package/legacy/internals/components/PickersToolbar.js +11 -14
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
- package/legacy/internals/hooks/useField/useField.js +1 -1
- package/legacy/internals/hooks/usePicker/usePickerValue.js +11 -3
- package/legacy/internals/utils/date-utils.js +4 -0
- package/legacy/locales/fiFI.js +8 -5
- package/legacy/locales/isIS.js +33 -16
- package/legacy/models/index.js +2 -1
- package/legacy/models/pickers.js +1 -0
- package/legacy/tests/describeAdapters/describeAdapters.js +1 -1
- package/legacy/tests/describeGregorianAdapter/testCalculations.js +1 -1
- package/legacy/tests/describeGregorianAdapter/testLocalization.js +1 -1
- package/legacy/tests/describeValidation/testDayViewValidation.js +1 -1
- package/legacy/tests/describeValidation/testMinutesViewValidation.js +2 -2
- package/legacy/tests/describeValidation/testMonthViewValidation.js +1 -1
- package/legacy/tests/describeValidation/testTextFieldValidation.js +1 -1
- package/legacy/tests/describeValidation/testYearViewValidation.js +1 -1
- package/legacy/tests/describeValue/describeValue.js +3 -2
- package/legacy/tests/describeValue/testControlledUnControlled.js +1 -1
- package/legacy/tests/describeValue/testPickerActionBar.js +12 -29
- package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +1 -1
- package/legacy/tests/describeValue/testShortcuts.js +119 -0
- package/locales/fiFI.js +4 -5
- package/locales/isIS.js +13 -16
- package/models/adapters.d.ts +1 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/models/pickers.d.ts +9 -0
- package/models/pickers.js +1 -0
- package/modern/DateCalendar/DateCalendar.js +2 -2
- package/modern/DateField/DateField.js +1 -0
- package/modern/DatePicker/DatePicker.js +2 -2
- package/modern/DateTimeField/DateTimeField.js +1 -0
- package/modern/DateTimePicker/DateTimePicker.js +2 -2
- package/modern/DateTimePicker/DateTimePickerToolbar.js +4 -3
- package/modern/DesktopDatePicker/DesktopDatePicker.js +2 -2
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
- package/modern/DesktopTimePicker/DesktopTimePicker.js +5 -0
- package/modern/DigitalClock/DigitalClock.js +3 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +2 -2
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/modern/MobileTimePicker/MobileTimePicker.js +5 -0
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -2
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -1
- package/modern/PickersDay/PickersDay.js +1 -0
- package/modern/PickersShortcuts/PickersShortcuts.js +10 -4
- package/modern/StaticDatePicker/StaticDatePicker.js +2 -2
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
- package/modern/StaticTimePicker/StaticTimePicker.js +5 -0
- package/modern/TimeField/TimeField.js +1 -0
- package/modern/TimePicker/TimePicker.js +5 -0
- package/modern/TimePicker/TimePickerToolbar.js +3 -2
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -11
- package/modern/internals/components/PickersPopper.js +7 -2
- package/modern/internals/components/PickersToolbar.js +9 -12
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
- package/modern/internals/hooks/useField/useField.js +1 -1
- package/modern/internals/hooks/usePicker/usePickerValue.js +11 -3
- package/modern/internals/utils/date-utils.js +4 -0
- package/modern/locales/fiFI.js +4 -5
- package/modern/locales/isIS.js +13 -16
- package/modern/models/index.js +2 -1
- package/modern/models/pickers.js +1 -0
- package/modern/tests/describeAdapters/describeAdapters.js +1 -1
- package/modern/tests/describeGregorianAdapter/testCalculations.js +1 -1
- package/modern/tests/describeGregorianAdapter/testLocalization.js +1 -1
- package/modern/tests/describeValidation/testDayViewValidation.js +1 -1
- package/modern/tests/describeValidation/testMinutesViewValidation.js +2 -2
- package/modern/tests/describeValidation/testMonthViewValidation.js +1 -1
- package/modern/tests/describeValidation/testTextFieldValidation.js +1 -1
- package/modern/tests/describeValidation/testYearViewValidation.js +1 -1
- package/modern/tests/describeValue/describeValue.js +3 -2
- package/modern/tests/describeValue/testControlledUnControlled.js +1 -1
- package/modern/tests/describeValue/testPickerActionBar.js +12 -29
- package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +1 -1
- package/modern/tests/describeValue/testShortcuts.js +112 -0
- package/node/DateCalendar/DateCalendar.js +2 -2
- package/node/DateField/DateField.js +1 -0
- package/node/DatePicker/DatePicker.js +2 -2
- package/node/DateTimeField/DateTimeField.js +1 -0
- package/node/DateTimePicker/DateTimePicker.js +2 -2
- package/node/DateTimePicker/DateTimePickerToolbar.js +4 -3
- package/node/DesktopDatePicker/DesktopDatePicker.js +2 -2
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
- package/node/DesktopTimePicker/DesktopTimePicker.js +5 -0
- package/node/DigitalClock/DigitalClock.js +3 -1
- package/node/MobileDatePicker/MobileDatePicker.js +2 -2
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/node/MobileTimePicker/MobileTimePicker.js +5 -0
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -2
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -1
- package/node/PickersDay/PickersDay.js +1 -0
- package/node/PickersShortcuts/PickersShortcuts.js +10 -4
- package/node/StaticDatePicker/StaticDatePicker.js +2 -2
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
- package/node/StaticTimePicker/StaticTimePicker.js +5 -0
- package/node/TimeField/TimeField.js +1 -0
- package/node/TimePicker/TimePicker.js +5 -0
- package/node/TimePicker/TimePickerToolbar.js +3 -2
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -11
- package/node/internals/components/PickersPopper.js +7 -2
- package/node/internals/components/PickersToolbar.js +9 -12
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
- package/node/internals/hooks/useField/useField.js +1 -1
- package/node/internals/hooks/usePicker/usePickerValue.js +11 -3
- package/node/internals/utils/date-utils.js +6 -1
- package/node/locales/fiFI.js +4 -5
- package/node/locales/isIS.js +13 -16
- package/node/models/index.js +11 -0
- package/node/models/pickers.js +5 -0
- package/node/tests/describeAdapters/describeAdapters.js +3 -3
- package/node/tests/describeGregorianAdapter/testCalculations.js +2 -2
- package/node/tests/describeGregorianAdapter/testLocalization.js +4 -4
- package/node/tests/describeValidation/testDayViewValidation.js +33 -33
- package/node/tests/describeValidation/testMinutesViewValidation.js +14 -14
- package/node/tests/describeValidation/testMonthViewValidation.js +22 -22
- package/node/tests/describeValidation/testTextFieldValidation.js +54 -54
- package/node/tests/describeValidation/testYearViewValidation.js +18 -18
- package/node/tests/describeValue/describeValue.js +4 -3
- package/node/tests/describeValue/testControlledUnControlled.js +3 -3
- package/node/tests/describeValue/testPickerActionBar.js +14 -31
- package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +10 -10
- package/node/tests/describeValue/testShortcuts.js +122 -0
- package/package.json +3 -3
- package/tests/describeAdapters/describeAdapters.js +1 -1
- package/tests/describeGregorianAdapter/testCalculations.js +1 -1
- package/tests/describeGregorianAdapter/testLocalization.js +1 -1
- package/tests/describeValidation/testDayViewValidation.js +1 -1
- package/tests/describeValidation/testMinutesViewValidation.js +2 -2
- package/tests/describeValidation/testMonthViewValidation.js +1 -1
- package/tests/describeValidation/testTextFieldValidation.js +1 -1
- package/tests/describeValidation/testYearViewValidation.js +1 -1
- package/tests/describeValue/describeValue.js +3 -2
- package/tests/describeValue/testControlledUnControlled.js +1 -1
- package/tests/describeValue/testPickerActionBar.js +12 -29
- package/tests/describeValue/testPickerOpenCloseLifeCycle.js +1 -1
- package/tests/describeValue/testShortcuts.js +112 -0
- package/themeAugmentation/components.d.ts +6 -14
- package/themeAugmentation/overrides.d.ts +0 -20
- package/themeAugmentation/props.d.ts +4 -0
package/models/adapters.d.ts
CHANGED
|
@@ -710,6 +710,7 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
710
710
|
getYearRange(start: TDate, end: TDate): TDate[];
|
|
711
711
|
/**
|
|
712
712
|
* Allow to customize how the "am"` and "pm" strings are rendered.
|
|
713
|
+
* @deprecated Use `utils.format(utils.setHours(utils.date()!, meridiem === 'am' ? 2 : 14), 'meridiem')` instead.
|
|
713
714
|
* @param {"am" | "pm"} meridiem The string to render.
|
|
714
715
|
* @return {string} The formatted string.
|
|
715
716
|
*/
|
package/models/index.d.ts
CHANGED
package/models/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PickersShortcutsItemContext } from '../PickersShortcuts';
|
|
2
|
+
export interface PickerChangeHandlerContext<TError> {
|
|
3
|
+
validationError: TError;
|
|
4
|
+
/**
|
|
5
|
+
* Shortcut causing this `onChange` call.
|
|
6
|
+
* If the call has not been caused by a shortcut selection, this property will be `undefined`.
|
|
7
|
+
*/
|
|
8
|
+
shortcut?: PickersShortcutsItemContext;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -484,8 +484,8 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
|
|
|
484
484
|
*/
|
|
485
485
|
readOnly: PropTypes.bool,
|
|
486
486
|
/**
|
|
487
|
-
*
|
|
488
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
487
|
+
* If `true`, disable heavy animations.
|
|
488
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
489
489
|
*/
|
|
490
490
|
reduceAnimations: PropTypes.bool,
|
|
491
491
|
/**
|
|
@@ -84,6 +84,7 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
84
84
|
* @default 'primary'
|
|
85
85
|
*/
|
|
86
86
|
color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
|
|
87
|
+
component: PropTypes.elementType,
|
|
87
88
|
/**
|
|
88
89
|
* Overridable components.
|
|
89
90
|
* @default {}
|
|
@@ -241,8 +241,8 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
241
241
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
242
242
|
readOnly: PropTypes.bool,
|
|
243
243
|
/**
|
|
244
|
-
*
|
|
245
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
244
|
+
* If `true`, disable heavy animations.
|
|
245
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
246
246
|
*/
|
|
247
247
|
reduceAnimations: PropTypes.bool,
|
|
248
248
|
/**
|
|
@@ -89,6 +89,7 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
89
89
|
* @default 'primary'
|
|
90
90
|
*/
|
|
91
91
|
color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
|
|
92
|
+
component: PropTypes.elementType,
|
|
92
93
|
/**
|
|
93
94
|
* Overridable components.
|
|
94
95
|
* @default {}
|
|
@@ -279,8 +279,8 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
279
279
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
280
280
|
readOnly: PropTypes.bool,
|
|
281
281
|
/**
|
|
282
|
-
*
|
|
283
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
282
|
+
* If `true`, disable heavy animations.
|
|
283
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
284
284
|
*/
|
|
285
285
|
reduceAnimations: PropTypes.bool,
|
|
286
286
|
/**
|
|
@@ -12,6 +12,7 @@ import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
|
|
|
12
12
|
import { dateTimePickerToolbarClasses, getDateTimePickerToolbarUtilityClass } from './dateTimePickerToolbarClasses';
|
|
13
13
|
import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks';
|
|
14
14
|
import { MULTI_SECTION_CLOCK_SECTION_WIDTH } from '../internals/constants/dimensions';
|
|
15
|
+
import { formatMeridiem } from '../internals/utils/date-utils';
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
const useUtilityClasses = ownerState => {
|
|
@@ -264,14 +265,14 @@ function DateTimePickerToolbar(inProps) {
|
|
|
264
265
|
variant: "subtitle2",
|
|
265
266
|
selected: meridiemMode === 'am',
|
|
266
267
|
typographyClassName: classes.ampmLabel,
|
|
267
|
-
value: utils
|
|
268
|
+
value: formatMeridiem(utils, 'am'),
|
|
268
269
|
onClick: readOnly ? undefined : () => handleMeridiemChange('am'),
|
|
269
270
|
disabled: disabled
|
|
270
271
|
}), /*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
271
272
|
variant: "subtitle2",
|
|
272
273
|
selected: meridiemMode === 'pm',
|
|
273
274
|
typographyClassName: classes.ampmLabel,
|
|
274
|
-
value: utils
|
|
275
|
+
value: formatMeridiem(utils, 'pm'),
|
|
275
276
|
onClick: readOnly ? undefined : () => handleMeridiemChange('pm'),
|
|
276
277
|
disabled: disabled
|
|
277
278
|
})]
|
|
@@ -279,7 +280,7 @@ function DateTimePickerToolbar(inProps) {
|
|
|
279
280
|
variant: "h5",
|
|
280
281
|
onClick: () => onViewChange('meridiem'),
|
|
281
282
|
selected: view === 'meridiem',
|
|
282
|
-
value: value && meridiemMode ? utils
|
|
283
|
+
value: value && meridiemMode ? formatMeridiem(utils, meridiemMode) : '--',
|
|
283
284
|
width: MULTI_SECTION_CLOCK_SECTION_WIDTH
|
|
284
285
|
})]
|
|
285
286
|
})]
|
|
@@ -255,8 +255,8 @@ DesktopDatePicker.propTypes = {
|
|
|
255
255
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
256
256
|
readOnly: PropTypes.bool,
|
|
257
257
|
/**
|
|
258
|
-
*
|
|
259
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
258
|
+
* If `true`, disable heavy animations.
|
|
259
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
260
260
|
*/
|
|
261
261
|
reduceAnimations: PropTypes.bool,
|
|
262
262
|
/**
|
|
@@ -329,8 +329,8 @@ DesktopDateTimePicker.propTypes = {
|
|
|
329
329
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
330
330
|
readOnly: PropTypes.bool,
|
|
331
331
|
/**
|
|
332
|
-
*
|
|
333
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
332
|
+
* If `true`, disable heavy animations.
|
|
333
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
334
334
|
*/
|
|
335
335
|
reduceAnimations: PropTypes.bool,
|
|
336
336
|
/**
|
|
@@ -250,6 +250,11 @@ DesktopTimePicker.propTypes = {
|
|
|
250
250
|
*/
|
|
251
251
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
252
252
|
readOnly: PropTypes.bool,
|
|
253
|
+
/**
|
|
254
|
+
* If `true`, disable heavy animations.
|
|
255
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
256
|
+
*/
|
|
257
|
+
reduceAnimations: PropTypes.bool,
|
|
253
258
|
/**
|
|
254
259
|
* The currently selected sections.
|
|
255
260
|
* This prop accept four formats:
|
|
@@ -41,7 +41,9 @@ const DigitalClockRoot = styled(PickerViewRoot, {
|
|
|
41
41
|
}) => ({
|
|
42
42
|
overflowY: 'auto',
|
|
43
43
|
width: '100%',
|
|
44
|
-
|
|
44
|
+
'@media (prefers-reduced-motion: no-preference)': {
|
|
45
|
+
scrollBehavior: ownerState.alreadyRendered ? 'smooth' : 'auto'
|
|
46
|
+
},
|
|
45
47
|
maxHeight: DIGITAL_CLOCK_VIEW_HEIGHT
|
|
46
48
|
}));
|
|
47
49
|
const DigitalClockList = styled(MenuList, {
|
|
@@ -252,8 +252,8 @@ MobileDatePicker.propTypes = {
|
|
|
252
252
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
253
253
|
readOnly: PropTypes.bool,
|
|
254
254
|
/**
|
|
255
|
-
*
|
|
256
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
255
|
+
* If `true`, disable heavy animations.
|
|
256
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
257
257
|
*/
|
|
258
258
|
reduceAnimations: PropTypes.bool,
|
|
259
259
|
/**
|
|
@@ -301,8 +301,8 @@ MobileDateTimePicker.propTypes = {
|
|
|
301
301
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
302
302
|
readOnly: PropTypes.bool,
|
|
303
303
|
/**
|
|
304
|
-
*
|
|
305
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
304
|
+
* If `true`, disable heavy animations.
|
|
305
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
306
306
|
*/
|
|
307
307
|
reduceAnimations: PropTypes.bool,
|
|
308
308
|
/**
|
|
@@ -228,6 +228,11 @@ MobileTimePicker.propTypes = {
|
|
|
228
228
|
*/
|
|
229
229
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
230
230
|
readOnly: PropTypes.bool,
|
|
231
|
+
/**
|
|
232
|
+
* If `true`, disable heavy animations.
|
|
233
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
234
|
+
*/
|
|
235
|
+
reduceAnimations: PropTypes.bool,
|
|
231
236
|
/**
|
|
232
237
|
* The currently selected sections.
|
|
233
238
|
* This prop accept four formats:
|
|
@@ -18,6 +18,7 @@ import { getHourSectionOptions, getTimeSectionOptions } from './MultiSectionDigi
|
|
|
18
18
|
import { useControlledValueWithTimezone } from '../internals/hooks/useValueWithTimezone';
|
|
19
19
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
20
20
|
import { useClockReferenceDate } from '../internals/hooks/useClockReferenceDate';
|
|
21
|
+
import { formatMeridiem } from '../internals/utils/date-utils';
|
|
21
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
23
|
const useUtilityClasses = ownerState => {
|
|
23
24
|
const {
|
|
@@ -269,8 +270,8 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
|
|
|
269
270
|
}
|
|
270
271
|
case 'meridiem':
|
|
271
272
|
{
|
|
272
|
-
const amLabel = utils
|
|
273
|
-
const pmLabel = utils
|
|
273
|
+
const amLabel = formatMeridiem(utils, 'am');
|
|
274
|
+
const pmLabel = formatMeridiem(utils, 'pm');
|
|
274
275
|
return {
|
|
275
276
|
onChange: handleMeridiemChange,
|
|
276
277
|
items: [{
|
|
@@ -33,7 +33,9 @@ const MultiSectionDigitalClockSectionRoot = styled(MenuList, {
|
|
|
33
33
|
width: 56,
|
|
34
34
|
padding: 0,
|
|
35
35
|
overflow: 'hidden',
|
|
36
|
-
|
|
36
|
+
'@media (prefers-reduced-motion: no-preference)': {
|
|
37
|
+
scrollBehavior: ownerState.alreadyRendered ? 'smooth' : 'auto'
|
|
38
|
+
},
|
|
37
39
|
'&:hover': {
|
|
38
40
|
overflowY: 'auto'
|
|
39
41
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["items", "changeImportance", "isLandscape", "onChange", "isValid"]
|
|
3
|
+
const _excluded = ["items", "changeImportance", "isLandscape", "onChange", "isValid"],
|
|
4
|
+
_excluded2 = ["getValue"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import List from '@mui/material/List';
|
|
@@ -19,14 +20,18 @@ function PickersShortcuts(props) {
|
|
|
19
20
|
if (items == null || items.length === 0) {
|
|
20
21
|
return null;
|
|
21
22
|
}
|
|
22
|
-
const resolvedItems = items.map(
|
|
23
|
-
|
|
23
|
+
const resolvedItems = items.map(_ref => {
|
|
24
|
+
let {
|
|
25
|
+
getValue
|
|
26
|
+
} = _ref,
|
|
27
|
+
item = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
28
|
+
const newValue = getValue({
|
|
24
29
|
isValid
|
|
25
30
|
});
|
|
26
31
|
return {
|
|
27
32
|
label: item.label,
|
|
28
33
|
onClick: () => {
|
|
29
|
-
onChange(newValue, changeImportance);
|
|
34
|
+
onChange(newValue, changeImportance, item);
|
|
30
35
|
},
|
|
31
36
|
disabled: !isValid(newValue)
|
|
32
37
|
};
|
|
@@ -59,6 +64,7 @@ process.env.NODE_ENV !== "production" ? PickersShortcuts.propTypes = {
|
|
|
59
64
|
*/
|
|
60
65
|
changeImportance: PropTypes.oneOf(['accept', 'set']),
|
|
61
66
|
className: PropTypes.string,
|
|
67
|
+
component: PropTypes.elementType,
|
|
62
68
|
/**
|
|
63
69
|
* If `true`, compact vertical padding designed for keyboard and mouse input is used for
|
|
64
70
|
* the list and list items.
|
|
@@ -200,8 +200,8 @@ StaticDatePicker.propTypes = {
|
|
|
200
200
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
201
201
|
readOnly: PropTypes.bool,
|
|
202
202
|
/**
|
|
203
|
-
*
|
|
204
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
203
|
+
* If `true`, disable heavy animations.
|
|
204
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
205
205
|
*/
|
|
206
206
|
reduceAnimations: PropTypes.bool,
|
|
207
207
|
/**
|
|
@@ -248,8 +248,8 @@ StaticDateTimePicker.propTypes = {
|
|
|
248
248
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
249
249
|
readOnly: PropTypes.bool,
|
|
250
250
|
/**
|
|
251
|
-
*
|
|
252
|
-
* @default typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
251
|
+
* If `true`, disable heavy animations.
|
|
252
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
253
253
|
*/
|
|
254
254
|
reduceAnimations: PropTypes.bool,
|
|
255
255
|
/**
|
|
@@ -174,6 +174,11 @@ StaticTimePicker.propTypes = {
|
|
|
174
174
|
*/
|
|
175
175
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
176
176
|
readOnly: PropTypes.bool,
|
|
177
|
+
/**
|
|
178
|
+
* If `true`, disable heavy animations.
|
|
179
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
180
|
+
*/
|
|
181
|
+
reduceAnimations: PropTypes.bool,
|
|
177
182
|
/**
|
|
178
183
|
* Disable specific clock time.
|
|
179
184
|
* @param {number} clockValue The value to check.
|
|
@@ -89,6 +89,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
89
89
|
* @default 'primary'
|
|
90
90
|
*/
|
|
91
91
|
color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
|
|
92
|
+
component: PropTypes.elementType,
|
|
92
93
|
/**
|
|
93
94
|
* Overridable components.
|
|
94
95
|
* @default {}
|
|
@@ -213,6 +213,11 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
213
213
|
*/
|
|
214
214
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
215
215
|
readOnly: PropTypes.bool,
|
|
216
|
+
/**
|
|
217
|
+
* If `true`, disable heavy animations.
|
|
218
|
+
* @default `@media(prefers-reduced-motion: reduce)` || typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent)
|
|
219
|
+
*/
|
|
220
|
+
reduceAnimations: PropTypes.bool,
|
|
216
221
|
/**
|
|
217
222
|
* The currently selected sections.
|
|
218
223
|
* This prop accept four formats:
|
|
@@ -12,6 +12,7 @@ import { arrayIncludes } from '../internals/utils/utils';
|
|
|
12
12
|
import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
|
|
13
13
|
import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks';
|
|
14
14
|
import { getTimePickerToolbarUtilityClass, timePickerToolbarClasses } from './timePickerToolbarClasses';
|
|
15
|
+
import { formatMeridiem } from '../internals/utils/date-utils';
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
const useUtilityClasses = ownerState => {
|
|
@@ -179,7 +180,7 @@ function TimePickerToolbar(inProps) {
|
|
|
179
180
|
variant: "subtitle2",
|
|
180
181
|
selected: meridiemMode === 'am',
|
|
181
182
|
typographyClassName: classes.ampmLabel,
|
|
182
|
-
value: utils
|
|
183
|
+
value: formatMeridiem(utils, 'am'),
|
|
183
184
|
onClick: readOnly ? undefined : () => handleMeridiemChange('am'),
|
|
184
185
|
disabled: disabled
|
|
185
186
|
}), /*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
@@ -187,7 +188,7 @@ function TimePickerToolbar(inProps) {
|
|
|
187
188
|
variant: "subtitle2",
|
|
188
189
|
selected: meridiemMode === 'pm',
|
|
189
190
|
typographyClassName: classes.ampmLabel,
|
|
190
|
-
value: utils
|
|
191
|
+
value: formatMeridiem(utils, 'pm'),
|
|
191
192
|
onClick: readOnly ? undefined : () => handleMeridiemChange('pm'),
|
|
192
193
|
disabled: disabled
|
|
193
194
|
})]
|
package/modern/index.js
CHANGED
|
@@ -86,21 +86,20 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
86
86
|
goTo: onGoToPrevious,
|
|
87
87
|
label: previousLabel
|
|
88
88
|
};
|
|
89
|
-
const [leftProps, rightProps] = isRTL ? [nextProps, previousProps] : [previousProps, nextProps];
|
|
90
89
|
const PreviousIconButton = slots?.previousIconButton ?? PickersArrowSwitcherButton;
|
|
91
90
|
const previousIconButtonProps = useSlotProps({
|
|
92
91
|
elementType: PreviousIconButton,
|
|
93
92
|
externalSlotProps: slotProps?.previousIconButton,
|
|
94
93
|
additionalProps: {
|
|
95
94
|
size: 'medium',
|
|
96
|
-
title:
|
|
97
|
-
'aria-label':
|
|
98
|
-
disabled:
|
|
95
|
+
title: previousProps.label,
|
|
96
|
+
'aria-label': previousProps.label,
|
|
97
|
+
disabled: previousProps.isDisabled,
|
|
99
98
|
edge: 'end',
|
|
100
|
-
onClick:
|
|
99
|
+
onClick: previousProps.goTo
|
|
101
100
|
},
|
|
102
101
|
ownerState: _extends({}, ownerState, {
|
|
103
|
-
hidden:
|
|
102
|
+
hidden: previousProps.isHidden
|
|
104
103
|
}),
|
|
105
104
|
className: classes.button
|
|
106
105
|
});
|
|
@@ -110,14 +109,14 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
110
109
|
externalSlotProps: slotProps?.nextIconButton,
|
|
111
110
|
additionalProps: {
|
|
112
111
|
size: 'medium',
|
|
113
|
-
title:
|
|
114
|
-
'aria-label':
|
|
115
|
-
disabled:
|
|
112
|
+
title: nextProps.label,
|
|
113
|
+
'aria-label': nextProps.label,
|
|
114
|
+
disabled: nextProps.isDisabled,
|
|
116
115
|
edge: 'start',
|
|
117
|
-
onClick:
|
|
116
|
+
onClick: nextProps.goTo
|
|
118
117
|
},
|
|
119
118
|
ownerState: _extends({}, ownerState, {
|
|
120
|
-
hidden:
|
|
119
|
+
hidden: nextProps.isHidden
|
|
121
120
|
}),
|
|
122
121
|
className: classes.button
|
|
123
122
|
});
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useSlotProps } from '@mui/base/utils';
|
|
4
4
|
import Grow from '@mui/material/Grow';
|
|
5
|
+
import Fade from '@mui/material/Fade';
|
|
5
6
|
import MuiPaper from '@mui/material/Paper';
|
|
6
7
|
import MuiPopper from '@mui/material/Popper';
|
|
7
8
|
import MuiTrapFocus from '@mui/material/Unstable_TrapFocus';
|
|
@@ -9,6 +10,7 @@ import { unstable_useForkRef as useForkRef, unstable_useEventCallback as useEven
|
|
|
9
10
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
10
11
|
import { getPickersPopperUtilityClass } from './pickersPopperClasses';
|
|
11
12
|
import { getActiveElement } from '../utils/utils';
|
|
13
|
+
import { useDefaultReduceAnimations } from '../hooks/useDefaultReduceAnimations';
|
|
12
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
15
|
const useUtilityClasses = ownerState => {
|
|
14
16
|
const {
|
|
@@ -172,7 +174,8 @@ export function PickersPopper(inProps) {
|
|
|
172
174
|
role,
|
|
173
175
|
placement,
|
|
174
176
|
slots,
|
|
175
|
-
slotProps
|
|
177
|
+
slotProps,
|
|
178
|
+
reduceAnimations: inReduceAnimations
|
|
176
179
|
} = props;
|
|
177
180
|
React.useEffect(() => {
|
|
178
181
|
function handleKeyDown(nativeEvent) {
|
|
@@ -209,6 +212,8 @@ export function PickersPopper(inProps) {
|
|
|
209
212
|
const handlePaperRef = useForkRef(handleRef, clickAwayRef);
|
|
210
213
|
const ownerState = props;
|
|
211
214
|
const classes = useUtilityClasses(ownerState);
|
|
215
|
+
const defaultReduceAnimations = useDefaultReduceAnimations();
|
|
216
|
+
const reduceAnimations = inReduceAnimations ?? defaultReduceAnimations;
|
|
212
217
|
const handleKeyDown = event => {
|
|
213
218
|
if (event.key === 'Escape') {
|
|
214
219
|
// stop the propagation to avoid closing parent modal
|
|
@@ -216,7 +221,7 @@ export function PickersPopper(inProps) {
|
|
|
216
221
|
onDismiss();
|
|
217
222
|
}
|
|
218
223
|
};
|
|
219
|
-
const Transition = slots?.desktopTransition ?? Grow;
|
|
224
|
+
const Transition = slots?.desktopTransition ?? reduceAnimations ? Fade : Grow;
|
|
220
225
|
const TrapFocus = slots?.desktopTrapFocus ?? MuiTrapFocus;
|
|
221
226
|
const Paper = slots?.desktopPaper ?? PickersPopperPaper;
|
|
222
227
|
const paperProps = useSlotProps({
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import Grid from '@mui/material/Grid';
|
|
5
4
|
import Typography from '@mui/material/Typography';
|
|
6
5
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
7
6
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
@@ -40,16 +39,20 @@ const PickersToolbarRoot = styled('div', {
|
|
|
40
39
|
justifyContent: 'flex-start',
|
|
41
40
|
flexWrap: 'wrap'
|
|
42
41
|
}));
|
|
43
|
-
const PickersToolbarContent = styled(
|
|
42
|
+
const PickersToolbarContent = styled('div', {
|
|
44
43
|
name: 'MuiPickersToolbar',
|
|
45
44
|
slot: 'Content',
|
|
46
45
|
overridesResolver: (props, styles) => styles.content
|
|
47
46
|
})(({
|
|
48
47
|
ownerState
|
|
49
|
-
}) =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
}) => ({
|
|
49
|
+
display: 'flex',
|
|
50
|
+
flexWrap: 'wrap',
|
|
51
|
+
width: '100%',
|
|
52
|
+
justifyContent: ownerState.isLandscape ? 'flex-start' : 'space-between',
|
|
53
|
+
flexDirection: ownerState.isLandscape ? ownerState.landscapeDirection ?? 'column' : 'row',
|
|
54
|
+
flex: 1,
|
|
55
|
+
alignItems: ownerState.isLandscape ? 'flex-start' : 'center'
|
|
53
56
|
}));
|
|
54
57
|
export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersToolbar(inProps, ref) {
|
|
55
58
|
const props = useThemeProps({
|
|
@@ -59,8 +62,6 @@ export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersTool
|
|
|
59
62
|
const {
|
|
60
63
|
children,
|
|
61
64
|
className,
|
|
62
|
-
isLandscape,
|
|
63
|
-
landscapeDirection = 'column',
|
|
64
65
|
toolbarTitle,
|
|
65
66
|
hidden,
|
|
66
67
|
titleId
|
|
@@ -80,12 +81,8 @@ export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersTool
|
|
|
80
81
|
id: titleId,
|
|
81
82
|
children: toolbarTitle
|
|
82
83
|
}), /*#__PURE__*/_jsx(PickersToolbarContent, {
|
|
83
|
-
container: true,
|
|
84
|
-
justifyContent: isLandscape ? 'flex-start' : 'space-between',
|
|
85
84
|
className: classes.content,
|
|
86
85
|
ownerState: ownerState,
|
|
87
|
-
direction: isLandscape ? landscapeDirection : 'row',
|
|
88
|
-
alignItems: isLandscape ? 'flex-start' : 'flex-end',
|
|
89
86
|
children: children
|
|
90
87
|
})]
|
|
91
88
|
});
|
|
@@ -41,7 +41,8 @@ export const useDesktopPicker = _ref => {
|
|
|
41
41
|
readOnly,
|
|
42
42
|
disabled,
|
|
43
43
|
autoFocus,
|
|
44
|
-
localeText
|
|
44
|
+
localeText,
|
|
45
|
+
reduceAnimations
|
|
45
46
|
} = props;
|
|
46
47
|
const utils = useUtils();
|
|
47
48
|
const internalInputRef = React.useRef(null);
|
|
@@ -155,6 +156,7 @@ export const useDesktopPicker = _ref => {
|
|
|
155
156
|
slots: slots,
|
|
156
157
|
slotProps: slotProps,
|
|
157
158
|
shouldRestoreFocus: shouldRestoreFocus,
|
|
159
|
+
reduceAnimations: reduceAnimations,
|
|
158
160
|
children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
|
|
159
161
|
slots: slots,
|
|
160
162
|
slotProps: slotProps,
|
|
@@ -366,7 +366,7 @@ export const useField = params => {
|
|
|
366
366
|
if (state.sections[selectedSectionIndexes.startIndex].contentType === 'letter') {
|
|
367
367
|
return 'text';
|
|
368
368
|
}
|
|
369
|
-
return '
|
|
369
|
+
return 'numeric';
|
|
370
370
|
}, [selectedSectionIndexes, state.sections]);
|
|
371
371
|
const inputHasFocus = inputRef.current && inputRef.current === getActiveElement(document);
|
|
372
372
|
const shouldShowPlaceholder = !inputHasFocus && valueManager.areValuesEqual(utils, state.value, valueManager.emptyValue);
|
|
@@ -40,7 +40,7 @@ const shouldPublishValue = params => {
|
|
|
40
40
|
}
|
|
41
41
|
return hasChanged(dateState.lastPublishedValue);
|
|
42
42
|
}
|
|
43
|
-
if (action.name === 'setValueFromShortcut'
|
|
43
|
+
if (action.name === 'setValueFromShortcut') {
|
|
44
44
|
// On the first view,
|
|
45
45
|
// If the value is not controlled, then clicking on any value (including the one equal to `defaultValue`) should call `onChange`
|
|
46
46
|
if (isCurrentValueTheDefaultValue) {
|
|
@@ -221,6 +221,11 @@ export const usePickerValue = ({
|
|
|
221
221
|
const context = {
|
|
222
222
|
validationError
|
|
223
223
|
};
|
|
224
|
+
|
|
225
|
+
// TODO v7: Remove 2nd condition
|
|
226
|
+
if (action.name === 'setValueFromShortcut' && action.shortcut != null) {
|
|
227
|
+
context.shortcut = action.shortcut;
|
|
228
|
+
}
|
|
224
229
|
handleValueChange(action.value, context);
|
|
225
230
|
}
|
|
226
231
|
if (shouldCommit && onAccept) {
|
|
@@ -283,10 +288,13 @@ export const usePickerValue = ({
|
|
|
283
288
|
value: newValue,
|
|
284
289
|
selectionState
|
|
285
290
|
}));
|
|
286
|
-
|
|
291
|
+
|
|
292
|
+
// TODO v7: Make changeImportance and label mandatory.
|
|
293
|
+
const handleSelectShortcut = useEventCallback((newValue, changeImportance, shortcut) => updateDate({
|
|
287
294
|
name: 'setValueFromShortcut',
|
|
288
295
|
value: newValue,
|
|
289
|
-
changeImportance: changeImportance ?? 'accept'
|
|
296
|
+
changeImportance: changeImportance ?? 'accept',
|
|
297
|
+
shortcut
|
|
290
298
|
}));
|
|
291
299
|
const handleChangeFromField = useEventCallback((newValue, context) => updateDate({
|
|
292
300
|
name: 'setValueFromField',
|
|
@@ -80,6 +80,10 @@ export const mergeDateAndTime = (utils, dateParam, timeParam) => {
|
|
|
80
80
|
return mergedDate;
|
|
81
81
|
};
|
|
82
82
|
export const getTodayDate = (utils, timezone, valueType) => valueType === 'date' ? utils.startOfDay(utils.dateWithTimezone(undefined, timezone)) : utils.dateWithTimezone(undefined, timezone);
|
|
83
|
+
export const formatMeridiem = (utils, meridiem) => {
|
|
84
|
+
const date = utils.setHours(utils.date(), meridiem === 'am' ? 2 : 14);
|
|
85
|
+
return utils.format(date, 'meridiem');
|
|
86
|
+
};
|
|
83
87
|
const dateViews = ['year', 'month', 'day'];
|
|
84
88
|
export const isDatePickerView = view => dateViews.includes(view);
|
|
85
89
|
export const resolveDateFormat = (utils, {
|
package/modern/locales/fiFI.js
CHANGED
|
@@ -34,11 +34,10 @@ const fiFIPickers = {
|
|
|
34
34
|
// Digital clock labels
|
|
35
35
|
selectViewText: view => `Valitse ${views[view]}`,
|
|
36
36
|
// Calendar labels
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
calendarWeekNumberHeaderLabel: 'Viikko',
|
|
38
|
+
calendarWeekNumberHeaderText: '#',
|
|
39
|
+
calendarWeekNumberAriaLabelText: weekNumber => `Viikko ${weekNumber}`,
|
|
40
|
+
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
42
41
|
// Open picker labels
|
|
43
42
|
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Valitse päivä, valittu päivä on ${utils.format(value, 'fullDate')}` : 'Valitse päivä',
|
|
44
43
|
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Valitse aika, valittu aika on ${utils.format(value, 'fullTime')}` : 'Valitse aika',
|