@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.
Files changed (75) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/DateField/DateField.js +1 -0
  3. package/DateTimeField/DateTimeField.js +1 -0
  4. package/DateTimePicker/DateTimePickerToolbar.js +4 -3
  5. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -2
  6. package/PickersDay/PickersDay.js +1 -0
  7. package/PickersShortcuts/PickersShortcuts.js +1 -0
  8. package/TimeField/TimeField.js +1 -0
  9. package/TimePicker/TimePickerToolbar.js +3 -2
  10. package/index.js +1 -1
  11. package/internals/hooks/useField/useField.js +1 -1
  12. package/internals/hooks/usePicker/usePickerValue.js +1 -1
  13. package/internals/utils/date-utils.d.ts +1 -0
  14. package/internals/utils/date-utils.js +4 -0
  15. package/legacy/DateField/DateField.js +1 -0
  16. package/legacy/DateTimeField/DateTimeField.js +1 -0
  17. package/legacy/DateTimePicker/DateTimePickerToolbar.js +4 -3
  18. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -2
  19. package/legacy/PickersDay/PickersDay.js +1 -0
  20. package/legacy/PickersShortcuts/PickersShortcuts.js +1 -0
  21. package/legacy/TimeField/TimeField.js +1 -0
  22. package/legacy/TimePicker/TimePickerToolbar.js +3 -2
  23. package/legacy/index.js +1 -1
  24. package/legacy/internals/hooks/useField/useField.js +1 -1
  25. package/legacy/internals/hooks/usePicker/usePickerValue.js +1 -1
  26. package/legacy/internals/utils/date-utils.js +4 -0
  27. package/legacy/locales/fiFI.js +8 -5
  28. package/legacy/locales/isIS.js +33 -16
  29. package/legacy/tests/describeValue/describeValue.js +2 -1
  30. package/legacy/tests/describeValue/testPickerActionBar.js +12 -28
  31. package/legacy/tests/describeValue/testShortcuts.js +119 -0
  32. package/locales/fiFI.js +4 -5
  33. package/locales/isIS.js +13 -16
  34. package/models/adapters.d.ts +1 -0
  35. package/modern/DateField/DateField.js +1 -0
  36. package/modern/DateTimeField/DateTimeField.js +1 -0
  37. package/modern/DateTimePicker/DateTimePickerToolbar.js +4 -3
  38. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -2
  39. package/modern/PickersDay/PickersDay.js +1 -0
  40. package/modern/PickersShortcuts/PickersShortcuts.js +1 -0
  41. package/modern/TimeField/TimeField.js +1 -0
  42. package/modern/TimePicker/TimePickerToolbar.js +3 -2
  43. package/modern/index.js +1 -1
  44. package/modern/internals/hooks/useField/useField.js +1 -1
  45. package/modern/internals/hooks/usePicker/usePickerValue.js +1 -1
  46. package/modern/internals/utils/date-utils.js +4 -0
  47. package/modern/locales/fiFI.js +4 -5
  48. package/modern/locales/isIS.js +13 -16
  49. package/modern/tests/describeValue/describeValue.js +2 -1
  50. package/modern/tests/describeValue/testPickerActionBar.js +12 -28
  51. package/modern/tests/describeValue/testShortcuts.js +112 -0
  52. package/node/DateField/DateField.js +1 -0
  53. package/node/DateTimeField/DateTimeField.js +1 -0
  54. package/node/DateTimePicker/DateTimePickerToolbar.js +4 -3
  55. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -2
  56. package/node/PickersDay/PickersDay.js +1 -0
  57. package/node/PickersShortcuts/PickersShortcuts.js +1 -0
  58. package/node/TimeField/TimeField.js +1 -0
  59. package/node/TimePicker/TimePickerToolbar.js +3 -2
  60. package/node/index.js +1 -1
  61. package/node/internals/hooks/useField/useField.js +1 -1
  62. package/node/internals/hooks/usePicker/usePickerValue.js +1 -1
  63. package/node/internals/utils/date-utils.js +6 -1
  64. package/node/locales/fiFI.js +4 -5
  65. package/node/locales/isIS.js +13 -16
  66. package/node/tests/describeValue/describeValue.js +2 -1
  67. package/node/tests/describeValue/testPickerActionBar.js +12 -28
  68. package/node/tests/describeValue/testShortcuts.js +122 -0
  69. package/package.json +3 -3
  70. package/tests/describeValue/describeValue.js +2 -1
  71. package/tests/describeValue/testPickerActionBar.js +12 -28
  72. package/tests/describeValue/testShortcuts.js +112 -0
  73. package/themeAugmentation/components.d.ts +6 -14
  74. package/themeAugmentation/overrides.d.ts +0 -20
  75. 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` [![pro](https://mui.com/r/x-pro-svg)](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` [![premium](https://mui.com/r/x-premium-svg)](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` [![pro](https://mui.com/r/x-pro-svg)](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_
@@ -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.getMeridiemText('am'),
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.getMeridiemText('pm'),
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.getMeridiemText(meridiemMode) : '--',
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.getMeridiemText('am');
273
- const pmLabel = utils.getMeridiemText('pm');
273
+ const amLabel = formatMeridiem(utils, 'am');
274
+ const pmLabel = formatMeridiem(utils, 'pm');
274
275
  return {
275
276
  onChange: handleMeridiemChange,
276
277
  items: [{
@@ -224,6 +224,7 @@ process.env.NODE_ENV !== "production" ? PickersDayRaw.propTypes = {
224
224
  */
225
225
  classes: PropTypes.object,
226
226
  className: PropTypes.string,
227
+ component: PropTypes.elementType,
227
228
  /**
228
229
  * The date to show.
229
230
  */
@@ -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.
@@ -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.getMeridiemText('am'),
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.getMeridiemText('pm'),
191
+ value: formatMeridiem(utils, 'pm'),
191
192
  onClick: readOnly ? undefined : () => handleMeridiemChange('pm'),
192
193
  disabled: disabled
193
194
  })]
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v6.11.0
2
+ * @mui/x-date-pickers v6.11.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -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 'tel';
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' && action.changeImportance === 'accept') {
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.getMeridiemText('am'),
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.getMeridiemText('pm'),
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.getMeridiemText(meridiemMode) : '--',
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.getMeridiemText('am');
291
- var pmLabel = utils.getMeridiemText('pm');
291
+ var amLabel = formatMeridiem(utils, 'am');
292
+ var pmLabel = formatMeridiem(utils, 'pm');
292
293
  return {
293
294
  onChange: handleMeridiemChange,
294
295
  items: [{
@@ -239,6 +239,7 @@ process.env.NODE_ENV !== "production" ? PickersDayRaw.propTypes = {
239
239
  */
240
240
  classes: PropTypes.object,
241
241
  className: PropTypes.string,
242
+ component: PropTypes.elementType,
242
243
  /**
243
244
  * The date to show.
244
245
  */
@@ -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.getMeridiemText('am'),
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.getMeridiemText('pm'),
199
+ value: formatMeridiem(utils, 'pm'),
199
200
  onClick: readOnly ? undefined : function () {
200
201
  return handleMeridiemChange('pm');
201
202
  },
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v6.11.0
2
+ * @mui/x-date-pickers v6.11.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -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 'tel';
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' && action.changeImportance === 'accept') {
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);
@@ -46,11 +46,14 @@ var fiFIPickers = {
46
46
  return "Valitse ".concat(views[view]);
47
47
  },
48
48
  // Calendar labels
49
- // calendarWeekNumberHeaderLabel: 'Week number',
50
- // calendarWeekNumberHeaderText: '#',
51
- // calendarWeekNumberAriaLabelText: weekNumber => `Week ${weekNumber}`,
52
- // calendarWeekNumberText: weekNumber => `${weekNumber}`,
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ä';
@@ -46,11 +46,14 @@ var isISPickers = {
46
46
  return "Velja ".concat(timeViews[view]);
47
47
  },
48
48
  // Calendar labels
49
- // calendarWeekNumberHeaderLabel: 'Week number',
50
- // calendarWeekNumberHeaderText: '#',
51
- // calendarWeekNumberAriaLabelText: weekNumber => `Week ${weekNumber}`,
52
- // calendarWeekNumberText: weekNumber => `${weekNumber}`,
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
- // fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
67
- // fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
68
- // fieldDayPlaceholder: () => 'DD',
69
- // fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
70
- // fieldHoursPlaceholder: () => 'hh',
71
- // fieldMinutesPlaceholder: () => 'mm',
72
- // fieldSecondsPlaceholder: () => 'ss',
73
- // fieldMeridiemPlaceholder: () => 'aa',
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
- if (pickerParams.type === 'date-range') {
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
- if (pickerParams.type === 'date-range') {
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 = pickerParams.type === 'date' ? adapterToUse.startOfDay(adapterToUse.date()) : adapterToUse.date();
247
- expect(onChange.callCount).to.equal(1);
248
- if (pickerParams.type === 'date-range') {
249
- onChange.lastCall.args[0].forEach(function (value) {
250
- expect(value).toEqualDateTime(startOfToday);
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
- expect(onChange.lastCall.args[0]).toEqualDateTime(startOfToday);
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
- if (pickerParams.type === 'date-range') {
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
  });