@mui/x-date-pickers 6.11.0 → 6.11.1
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 +62 -0
- package/DateField/DateField.js +1 -0
- package/DateTimeField/DateTimeField.js +1 -0
- package/DateTimePicker/DateTimePickerToolbar.js +4 -3
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -2
- package/PickersDay/PickersDay.js +1 -0
- package/PickersShortcuts/PickersShortcuts.js +1 -0
- package/TimeField/TimeField.js +1 -0
- package/TimePicker/TimePickerToolbar.js +3 -2
- package/index.js +1 -1
- package/internals/hooks/useField/useField.js +1 -1
- package/internals/hooks/usePicker/usePickerValue.js +1 -1
- package/internals/utils/date-utils.d.ts +1 -0
- package/internals/utils/date-utils.js +4 -0
- package/legacy/DateField/DateField.js +1 -0
- package/legacy/DateTimeField/DateTimeField.js +1 -0
- package/legacy/DateTimePicker/DateTimePickerToolbar.js +4 -3
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -2
- package/legacy/PickersDay/PickersDay.js +1 -0
- package/legacy/PickersShortcuts/PickersShortcuts.js +1 -0
- package/legacy/TimeField/TimeField.js +1 -0
- package/legacy/TimePicker/TimePickerToolbar.js +3 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/hooks/useField/useField.js +1 -1
- package/legacy/internals/hooks/usePicker/usePickerValue.js +1 -1
- 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/tests/describeValue/describeValue.js +2 -1
- package/legacy/tests/describeValue/testPickerActionBar.js +12 -28
- 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/modern/DateField/DateField.js +1 -0
- package/modern/DateTimeField/DateTimeField.js +1 -0
- package/modern/DateTimePicker/DateTimePickerToolbar.js +4 -3
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -2
- package/modern/PickersDay/PickersDay.js +1 -0
- package/modern/PickersShortcuts/PickersShortcuts.js +1 -0
- package/modern/TimeField/TimeField.js +1 -0
- package/modern/TimePicker/TimePickerToolbar.js +3 -2
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useField/useField.js +1 -1
- package/modern/internals/hooks/usePicker/usePickerValue.js +1 -1
- 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/tests/describeValue/describeValue.js +2 -1
- package/modern/tests/describeValue/testPickerActionBar.js +12 -28
- package/modern/tests/describeValue/testShortcuts.js +112 -0
- package/node/DateField/DateField.js +1 -0
- package/node/DateTimeField/DateTimeField.js +1 -0
- package/node/DateTimePicker/DateTimePickerToolbar.js +4 -3
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -2
- package/node/PickersDay/PickersDay.js +1 -0
- package/node/PickersShortcuts/PickersShortcuts.js +1 -0
- package/node/TimeField/TimeField.js +1 -0
- package/node/TimePicker/TimePickerToolbar.js +3 -2
- package/node/index.js +1 -1
- package/node/internals/hooks/useField/useField.js +1 -1
- package/node/internals/hooks/usePicker/usePickerValue.js +1 -1
- 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/tests/describeValue/describeValue.js +2 -1
- package/node/tests/describeValue/testPickerActionBar.js +12 -28
- package/node/tests/describeValue/testShortcuts.js +122 -0
- package/package.json +3 -3
- package/tests/describeValue/describeValue.js +2 -1
- package/tests/describeValue/testPickerActionBar.js +12 -28
- 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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,68 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 6.11.1
|
|
7
|
+
|
|
8
|
+
_Aug 11, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 💫 Add theme augmentation to `@mui/x-tree-view`
|
|
13
|
+
- 📈 Enable charts customization using `slot` and `slotProps` props
|
|
14
|
+
- 🌍 Improve Finnish (fi-FI) and Icelandic (is-IS) locales on the pickers
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
- 📚 Documentation improvements
|
|
17
|
+
|
|
18
|
+
### Data Grid
|
|
19
|
+
|
|
20
|
+
#### `@mui/x-data-grid@6.11.1`
|
|
21
|
+
|
|
22
|
+
- [DataGrid] `getCellAggregationResult`: Handle `null` `rowNode` case (#9915) @romgrk
|
|
23
|
+
|
|
24
|
+
#### `@mui/x-data-grid-pro@6.11.1` [](https://mui.com/r/x-pro-svg-link)
|
|
25
|
+
|
|
26
|
+
Same changes as in `@mui/x-data-grid@6.11.1`.
|
|
27
|
+
|
|
28
|
+
#### `@mui/x-data-grid-premium@6.11.1` [](https://mui.com/r/x-premium-svg-link)
|
|
29
|
+
|
|
30
|
+
Same changes as in `@mui/x-data-grid-pro@6.11.1`.
|
|
31
|
+
|
|
32
|
+
### Date Pickers
|
|
33
|
+
|
|
34
|
+
#### `@mui/x-date-pickers@6.11.1`
|
|
35
|
+
|
|
36
|
+
- [fields] Use `numeric` `inputmode` instead of `tel` (#9918) @LukasTy
|
|
37
|
+
- [pickers] Always respect locale when formatting meridiem (#9979) @flaviendelangle
|
|
38
|
+
- [pickers] Call `onChange` when selecting a shortcut with `changeImportance="set"` (#9974) @flaviendelangle
|
|
39
|
+
- [pickers] Refactor `themeAugmentation` `styleOverrides` (#9978) @LukasTy
|
|
40
|
+
- [l10n] Improve Finnish (fi-FI) locale (#9795) @kurkle
|
|
41
|
+
- [l10n] Improve Icelandic (is-IS) locale (#9639) @magnimarels
|
|
42
|
+
|
|
43
|
+
#### `@mui/x-date-pickers-pro@6.11.1` [](https://mui.com/r/x-pro-svg-link)
|
|
44
|
+
|
|
45
|
+
Same changes as in `@mui/x-date-pickers@6.11.1`.
|
|
46
|
+
|
|
47
|
+
### Charts / `@mui/x-charts@v6.0.0-alpha.7`
|
|
48
|
+
|
|
49
|
+
- [charts] Fix label and tick alignment (#9952) @LukasTy
|
|
50
|
+
- [charts] Remove not functional component `styleOverrides` (#9996) @LukasTy
|
|
51
|
+
- [charts] Set custom ticks number (#9922) @alexfauquette
|
|
52
|
+
- [charts] Use `slot`/`slotProps` for customization (#9744) @alexfauquette
|
|
53
|
+
- [charts] Extend cheerful fiesta palette (#9980) @noraleonte
|
|
54
|
+
|
|
55
|
+
### Tree View / `@mui/x-tree-view@v6.0.0-alpha.1`
|
|
56
|
+
|
|
57
|
+
- [TreeView] Add theme augmentation (#9967) @flaviendelangle
|
|
58
|
+
|
|
59
|
+
### Docs
|
|
60
|
+
|
|
61
|
+
- [docs] Clarify the `shouldDisableClock` migration code options (#9920) @LukasTy
|
|
62
|
+
|
|
63
|
+
### Core
|
|
64
|
+
|
|
65
|
+
- [core] Port GitHub workflow for ensuring triage label is present (#9924) @DanailH
|
|
66
|
+
- [docs-infra] Fix the import samples in Api pages (#9898) @alexfauquette
|
|
67
|
+
|
|
6
68
|
## 6.11.0
|
|
7
69
|
|
|
8
70
|
_Aug 4, 2023_
|
package/DateField/DateField.js
CHANGED
|
@@ -85,6 +85,7 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
85
85
|
* @default 'primary'
|
|
86
86
|
*/
|
|
87
87
|
color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
|
|
88
|
+
component: PropTypes.elementType,
|
|
88
89
|
/**
|
|
89
90
|
* Overridable components.
|
|
90
91
|
* @default {}
|
|
@@ -90,6 +90,7 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
90
90
|
* @default 'primary'
|
|
91
91
|
*/
|
|
92
92
|
color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
|
|
93
|
+
component: PropTypes.elementType,
|
|
93
94
|
/**
|
|
94
95
|
* Overridable components.
|
|
95
96
|
* @default {}
|
|
@@ -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
|
})]
|
|
@@ -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: [{
|
package/PickersDay/PickersDay.js
CHANGED
|
@@ -59,6 +59,7 @@ process.env.NODE_ENV !== "production" ? PickersShortcuts.propTypes = {
|
|
|
59
59
|
*/
|
|
60
60
|
changeImportance: PropTypes.oneOf(['accept', 'set']),
|
|
61
61
|
className: PropTypes.string,
|
|
62
|
+
component: PropTypes.elementType,
|
|
62
63
|
/**
|
|
63
64
|
* If `true`, compact vertical padding designed for keyboard and mouse input is used for
|
|
64
65
|
* the list and list items.
|
package/TimeField/TimeField.js
CHANGED
|
@@ -90,6 +90,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
90
90
|
* @default 'primary'
|
|
91
91
|
*/
|
|
92
92
|
color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
|
|
93
|
+
component: PropTypes.elementType,
|
|
93
94
|
/**
|
|
94
95
|
* Overridable components.
|
|
95
96
|
* @default {}
|
|
@@ -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/index.js
CHANGED
|
@@ -370,7 +370,7 @@ export const useField = params => {
|
|
|
370
370
|
if (state.sections[selectedSectionIndexes.startIndex].contentType === 'letter') {
|
|
371
371
|
return 'text';
|
|
372
372
|
}
|
|
373
|
-
return '
|
|
373
|
+
return 'numeric';
|
|
374
374
|
}, [selectedSectionIndexes, state.sections]);
|
|
375
375
|
const inputHasFocus = inputRef.current && inputRef.current === getActiveElement(document);
|
|
376
376
|
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) {
|
|
@@ -17,6 +17,7 @@ export declare const areDatesEqual: <TDate>(utils: MuiPickersAdapter<TDate, any>
|
|
|
17
17
|
export declare const getMonthsInYear: <TDate>(utils: MuiPickersAdapter<TDate, any>, year: TDate) => TDate[];
|
|
18
18
|
export declare const mergeDateAndTime: <TDate>(utils: MuiPickersAdapter<TDate, any>, dateParam: TDate, timeParam: TDate) => TDate;
|
|
19
19
|
export declare const getTodayDate: <TDate>(utils: MuiPickersAdapter<TDate, any>, timezone: PickersTimezone, valueType?: FieldValueType) => TDate;
|
|
20
|
+
export declare const formatMeridiem: <TDate>(utils: MuiPickersAdapter<TDate, any>, meridiem: 'am' | 'pm') => string;
|
|
20
21
|
export declare const isDatePickerView: (view: DateOrTimeViewWithMeridiem) => view is DateView;
|
|
21
22
|
export declare const resolveDateFormat: (utils: MuiPickersAdapter<any>, { format, views }: {
|
|
22
23
|
format?: string | undefined;
|
|
@@ -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, {
|
|
@@ -79,6 +79,7 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
79
79
|
* @default 'primary'
|
|
80
80
|
*/
|
|
81
81
|
color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
|
|
82
|
+
component: PropTypes.elementType,
|
|
82
83
|
/**
|
|
83
84
|
* Overridable components.
|
|
84
85
|
* @default {}
|
|
@@ -84,6 +84,7 @@ process.env.NODE_ENV !== "production" ? DateTimeField.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 {}
|
|
@@ -13,6 +13,7 @@ import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
|
|
|
13
13
|
import { dateTimePickerToolbarClasses, getDateTimePickerToolbarUtilityClass } from './dateTimePickerToolbarClasses';
|
|
14
14
|
import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks';
|
|
15
15
|
import { MULTI_SECTION_CLOCK_SECTION_WIDTH } from '../internals/constants/dimensions';
|
|
16
|
+
import { formatMeridiem } from '../internals/utils/date-utils';
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -283,7 +284,7 @@ function DateTimePickerToolbar(inProps) {
|
|
|
283
284
|
variant: "subtitle2",
|
|
284
285
|
selected: meridiemMode === 'am',
|
|
285
286
|
typographyClassName: classes.ampmLabel,
|
|
286
|
-
value: utils
|
|
287
|
+
value: formatMeridiem(utils, 'am'),
|
|
287
288
|
onClick: readOnly ? undefined : function () {
|
|
288
289
|
return handleMeridiemChange('am');
|
|
289
290
|
},
|
|
@@ -292,7 +293,7 @@ function DateTimePickerToolbar(inProps) {
|
|
|
292
293
|
variant: "subtitle2",
|
|
293
294
|
selected: meridiemMode === 'pm',
|
|
294
295
|
typographyClassName: classes.ampmLabel,
|
|
295
|
-
value: utils
|
|
296
|
+
value: formatMeridiem(utils, 'pm'),
|
|
296
297
|
onClick: readOnly ? undefined : function () {
|
|
297
298
|
return handleMeridiemChange('pm');
|
|
298
299
|
},
|
|
@@ -304,7 +305,7 @@ function DateTimePickerToolbar(inProps) {
|
|
|
304
305
|
return onViewChange('meridiem');
|
|
305
306
|
},
|
|
306
307
|
selected: view === 'meridiem',
|
|
307
|
-
value: value && meridiemMode ? utils
|
|
308
|
+
value: value && meridiemMode ? formatMeridiem(utils, meridiemMode) : '--',
|
|
308
309
|
width: MULTI_SECTION_CLOCK_SECTION_WIDTH
|
|
309
310
|
})]
|
|
310
311
|
})]
|
|
@@ -21,6 +21,7 @@ import { getHourSectionOptions, getTimeSectionOptions } from './MultiSectionDigi
|
|
|
21
21
|
import { useControlledValueWithTimezone } from '../internals/hooks/useValueWithTimezone';
|
|
22
22
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
23
23
|
import { useClockReferenceDate } from '../internals/hooks/useClockReferenceDate';
|
|
24
|
+
import { formatMeridiem } from '../internals/utils/date-utils';
|
|
24
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
26
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
26
27
|
var classes = ownerState.classes;
|
|
@@ -287,8 +288,8 @@ export var MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function Mul
|
|
|
287
288
|
}
|
|
288
289
|
case 'meridiem':
|
|
289
290
|
{
|
|
290
|
-
var amLabel = utils
|
|
291
|
-
var pmLabel = utils
|
|
291
|
+
var amLabel = formatMeridiem(utils, 'am');
|
|
292
|
+
var pmLabel = formatMeridiem(utils, 'pm');
|
|
292
293
|
return {
|
|
293
294
|
onChange: handleMeridiemChange,
|
|
294
295
|
items: [{
|
|
@@ -59,6 +59,7 @@ process.env.NODE_ENV !== "production" ? PickersShortcuts.propTypes = {
|
|
|
59
59
|
*/
|
|
60
60
|
changeImportance: PropTypes.oneOf(['accept', 'set']),
|
|
61
61
|
className: PropTypes.string,
|
|
62
|
+
component: PropTypes.elementType,
|
|
62
63
|
/**
|
|
63
64
|
* If `true`, compact vertical padding designed for keyboard and mouse input is used for
|
|
64
65
|
* the list and list items.
|
|
@@ -84,6 +84,7 @@ process.env.NODE_ENV !== "production" ? TimeField.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 {}
|
|
@@ -13,6 +13,7 @@ import { arrayIncludes } from '../internals/utils/utils';
|
|
|
13
13
|
import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
|
|
14
14
|
import { useMeridiemMode } from '../internals/hooks/date-helpers-hooks';
|
|
15
15
|
import { getTimePickerToolbarUtilityClass, timePickerToolbarClasses } from './timePickerToolbarClasses';
|
|
16
|
+
import { formatMeridiem } from '../internals/utils/date-utils';
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -185,7 +186,7 @@ function TimePickerToolbar(inProps) {
|
|
|
185
186
|
variant: "subtitle2",
|
|
186
187
|
selected: meridiemMode === 'am',
|
|
187
188
|
typographyClassName: classes.ampmLabel,
|
|
188
|
-
value: utils
|
|
189
|
+
value: formatMeridiem(utils, 'am'),
|
|
189
190
|
onClick: readOnly ? undefined : function () {
|
|
190
191
|
return handleMeridiemChange('am');
|
|
191
192
|
},
|
|
@@ -195,7 +196,7 @@ function TimePickerToolbar(inProps) {
|
|
|
195
196
|
variant: "subtitle2",
|
|
196
197
|
selected: meridiemMode === 'pm',
|
|
197
198
|
typographyClassName: classes.ampmLabel,
|
|
198
|
-
value: utils
|
|
199
|
+
value: formatMeridiem(utils, 'pm'),
|
|
199
200
|
onClick: readOnly ? undefined : function () {
|
|
200
201
|
return handleMeridiemChange('pm');
|
|
201
202
|
},
|
package/legacy/index.js
CHANGED
|
@@ -381,7 +381,7 @@ export var useField = function useField(params) {
|
|
|
381
381
|
if (state.sections[selectedSectionIndexes.startIndex].contentType === 'letter') {
|
|
382
382
|
return 'text';
|
|
383
383
|
}
|
|
384
|
-
return '
|
|
384
|
+
return 'numeric';
|
|
385
385
|
}, [selectedSectionIndexes, state.sections]);
|
|
386
386
|
var inputHasFocus = inputRef.current && inputRef.current === getActiveElement(document);
|
|
387
387
|
var shouldShowPlaceholder = !inputHasFocus && valueManager.areValuesEqual(utils, state.value, valueManager.emptyValue);
|
|
@@ -39,7 +39,7 @@ var shouldPublishValue = function shouldPublishValue(params) {
|
|
|
39
39
|
}
|
|
40
40
|
return hasChanged(dateState.lastPublishedValue);
|
|
41
41
|
}
|
|
42
|
-
if (action.name === 'setValueFromShortcut'
|
|
42
|
+
if (action.name === 'setValueFromShortcut') {
|
|
43
43
|
// On the first view,
|
|
44
44
|
// If the value is not controlled, then clicking on any value (including the one equal to `defaultValue`) should call `onChange`
|
|
45
45
|
if (isCurrentValueTheDefaultValue) {
|
|
@@ -83,6 +83,10 @@ export var mergeDateAndTime = function mergeDateAndTime(utils, dateParam, timePa
|
|
|
83
83
|
export var getTodayDate = function getTodayDate(utils, timezone, valueType) {
|
|
84
84
|
return valueType === 'date' ? utils.startOfDay(utils.dateWithTimezone(undefined, timezone)) : utils.dateWithTimezone(undefined, timezone);
|
|
85
85
|
};
|
|
86
|
+
export var formatMeridiem = function formatMeridiem(utils, meridiem) {
|
|
87
|
+
var date = utils.setHours(utils.date(), meridiem === 'am' ? 2 : 14);
|
|
88
|
+
return utils.format(date, 'meridiem');
|
|
89
|
+
};
|
|
86
90
|
var dateViews = ['year', 'month', 'day'];
|
|
87
91
|
export var isDatePickerView = function isDatePickerView(view) {
|
|
88
92
|
return dateViews.includes(view);
|
package/legacy/locales/fiFI.js
CHANGED
|
@@ -46,11 +46,14 @@ var fiFIPickers = {
|
|
|
46
46
|
return "Valitse ".concat(views[view]);
|
|
47
47
|
},
|
|
48
48
|
// Calendar labels
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
calendarWeekNumberHeaderLabel: 'Viikko',
|
|
50
|
+
calendarWeekNumberHeaderText: '#',
|
|
51
|
+
calendarWeekNumberAriaLabelText: function calendarWeekNumberAriaLabelText(weekNumber) {
|
|
52
|
+
return "Viikko ".concat(weekNumber);
|
|
53
|
+
},
|
|
54
|
+
calendarWeekNumberText: function calendarWeekNumberText(weekNumber) {
|
|
55
|
+
return "".concat(weekNumber);
|
|
56
|
+
},
|
|
54
57
|
// Open picker labels
|
|
55
58
|
openDatePickerDialogue: function openDatePickerDialogue(value, utils) {
|
|
56
59
|
return value !== null && utils.isValid(value) ? "Valitse p\xE4iv\xE4, valittu p\xE4iv\xE4 on ".concat(utils.format(value, 'fullDate')) : 'Valitse päivä';
|
package/legacy/locales/isIS.js
CHANGED
|
@@ -46,11 +46,14 @@ var isISPickers = {
|
|
|
46
46
|
return "Velja ".concat(timeViews[view]);
|
|
47
47
|
},
|
|
48
48
|
// Calendar labels
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
calendarWeekNumberHeaderLabel: 'Vikunúmer',
|
|
50
|
+
calendarWeekNumberHeaderText: '#',
|
|
51
|
+
calendarWeekNumberAriaLabelText: function calendarWeekNumberAriaLabelText(weekNumber) {
|
|
52
|
+
return "Vika ".concat(weekNumber);
|
|
53
|
+
},
|
|
54
|
+
calendarWeekNumberText: function calendarWeekNumberText(weekNumber) {
|
|
55
|
+
return "".concat(weekNumber);
|
|
56
|
+
},
|
|
54
57
|
// Open picker labels
|
|
55
58
|
openDatePickerDialogue: function openDatePickerDialogue(value, utils) {
|
|
56
59
|
return value !== null && utils.isValid(value) ? "Velja dagsetningu, valin dagsetning er ".concat(utils.format(value, 'fullDate')) : 'Velja dagsetningu';
|
|
@@ -60,17 +63,31 @@ var isISPickers = {
|
|
|
60
63
|
},
|
|
61
64
|
// Table labels
|
|
62
65
|
timeTableLabel: 'velja tíma',
|
|
63
|
-
dateTableLabel: 'velja dagsetningu'
|
|
64
|
-
|
|
66
|
+
dateTableLabel: 'velja dagsetningu',
|
|
65
67
|
// Field section placeholders
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
fieldYearPlaceholder: function fieldYearPlaceholder(params) {
|
|
69
|
+
return 'Á'.repeat(params.digitAmount);
|
|
70
|
+
},
|
|
71
|
+
fieldMonthPlaceholder: function fieldMonthPlaceholder(params) {
|
|
72
|
+
return params.contentType === 'letter' ? 'MMMM' : 'MM';
|
|
73
|
+
},
|
|
74
|
+
fieldDayPlaceholder: function fieldDayPlaceholder() {
|
|
75
|
+
return 'DD';
|
|
76
|
+
},
|
|
77
|
+
fieldWeekDayPlaceholder: function fieldWeekDayPlaceholder(params) {
|
|
78
|
+
return params.contentType === 'letter' ? 'EEEE' : 'EE';
|
|
79
|
+
},
|
|
80
|
+
fieldHoursPlaceholder: function fieldHoursPlaceholder() {
|
|
81
|
+
return 'kk';
|
|
82
|
+
},
|
|
83
|
+
fieldMinutesPlaceholder: function fieldMinutesPlaceholder() {
|
|
84
|
+
return 'mm';
|
|
85
|
+
},
|
|
86
|
+
fieldSecondsPlaceholder: function fieldSecondsPlaceholder() {
|
|
87
|
+
return 'ss';
|
|
88
|
+
},
|
|
89
|
+
fieldMeridiemPlaceholder: function fieldMeridiemPlaceholder() {
|
|
90
|
+
return 'ee';
|
|
91
|
+
}
|
|
74
92
|
};
|
|
75
|
-
|
|
76
93
|
export var isIS = getPickersLocalization(isISPickers);
|
|
@@ -7,8 +7,9 @@ import { buildFieldInteractions } from 'test/utils/pickers-utils';
|
|
|
7
7
|
import { testControlledUnControlled } from './testControlledUnControlled';
|
|
8
8
|
import { testPickerOpenCloseLifeCycle } from './testPickerOpenCloseLifeCycle';
|
|
9
9
|
import { testPickerActionBar } from './testPickerActionBar';
|
|
10
|
+
import { testShortcuts } from './testShortcuts';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
var TEST_SUITES = [testControlledUnControlled, testPickerOpenCloseLifeCycle, testPickerActionBar];
|
|
12
|
+
var TEST_SUITES = [testControlledUnControlled, testPickerOpenCloseLifeCycle, testPickerActionBar, testShortcuts];
|
|
12
13
|
function innerDescribeValue(ElementToTest, getOptions) {
|
|
13
14
|
var options = getOptions();
|
|
14
15
|
var defaultProps = options.defaultProps,
|
|
@@ -5,6 +5,7 @@ import { expect } from 'chai';
|
|
|
5
5
|
import { spy } from 'sinon';
|
|
6
6
|
import { screen, userEvent } from '@mui/monorepo/test/utils';
|
|
7
7
|
import { adapterToUse, getExpectedOnChangeCount } from 'test/utils/pickers-utils';
|
|
8
|
+
import { expectPickerChangeHandlerValue } from 'test/utils/pickers/assertions';
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
export var testPickerActionBar = function testPickerActionBar(ElementToTest, options) {
|
|
10
11
|
var componentFamily = options.componentFamily,
|
|
@@ -39,21 +40,9 @@ export var testPickerActionBar = function testPickerActionBar(ElementToTest, opt
|
|
|
39
40
|
// Clear the date
|
|
40
41
|
userEvent.mousePress(screen.getByText(/clear/i));
|
|
41
42
|
expect(onChange.callCount).to.equal(1);
|
|
42
|
-
|
|
43
|
-
onChange.lastCall.args[0].forEach(function (value, index) {
|
|
44
|
-
expect(value).to.deep.equal(emptyValue[index]);
|
|
45
|
-
});
|
|
46
|
-
} else {
|
|
47
|
-
expect(onChange.lastCall.args[0]).to.deep.equal(emptyValue);
|
|
48
|
-
}
|
|
43
|
+
expectPickerChangeHandlerValue(pickerParams.type, onChange, emptyValue);
|
|
49
44
|
expect(onAccept.callCount).to.equal(1);
|
|
50
|
-
|
|
51
|
-
onAccept.lastCall.args[0].forEach(function (value, index) {
|
|
52
|
-
expect(value).to.deep.equal(emptyValue[index]);
|
|
53
|
-
});
|
|
54
|
-
} else {
|
|
55
|
-
expect(onAccept.lastCall.args[0]).to.deep.equal(emptyValue);
|
|
56
|
-
}
|
|
45
|
+
expectPickerChangeHandlerValue(pickerParams.type, onAccept, emptyValue);
|
|
57
46
|
expect(onClose.callCount).to.equal(1);
|
|
58
47
|
});
|
|
59
48
|
it('should not call onChange or onAccept if the value is already empty value', function () {
|
|
@@ -243,23 +232,18 @@ export var testPickerActionBar = function testPickerActionBar(ElementToTest, opt
|
|
|
243
232
|
}
|
|
244
233
|
}));
|
|
245
234
|
userEvent.mousePress(screen.getByText(/today/i));
|
|
246
|
-
var startOfToday
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
});
|
|
235
|
+
var startOfToday;
|
|
236
|
+
if (pickerParams.type === 'date') {
|
|
237
|
+
startOfToday = adapterToUse.startOfDay(adapterToUse.date());
|
|
238
|
+
} else if (pickerParams.type === 'date-range') {
|
|
239
|
+
startOfToday = [adapterToUse.date(), adapterToUse.date()];
|
|
252
240
|
} else {
|
|
253
|
-
|
|
241
|
+
startOfToday = adapterToUse.date();
|
|
254
242
|
}
|
|
243
|
+
expect(onChange.callCount).to.equal(1);
|
|
244
|
+
expectPickerChangeHandlerValue(pickerParams.type, onChange, startOfToday);
|
|
255
245
|
expect(onAccept.callCount).to.equal(1);
|
|
256
|
-
|
|
257
|
-
onAccept.lastCall.args[0].forEach(function (value) {
|
|
258
|
-
expect(value).toEqualDateTime(startOfToday);
|
|
259
|
-
});
|
|
260
|
-
} else {
|
|
261
|
-
expect(onAccept.lastCall.args[0]).toEqualDateTime(startOfToday);
|
|
262
|
-
}
|
|
246
|
+
expectPickerChangeHandlerValue(pickerParams.type, onAccept, startOfToday);
|
|
263
247
|
expect(onClose.callCount).to.equal(1);
|
|
264
248
|
});
|
|
265
249
|
});
|