@mui/x-date-pickers 7.0.0-beta.4 → 7.0.0-beta.6

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 (41) hide show
  1. package/CHANGELOG.md +271 -61
  2. package/DatePicker/DatePickerToolbar.js +4 -1
  3. package/DateTimePicker/DateTimePickerToolbar.d.ts +2 -2
  4. package/DateTimePicker/DateTimePickerToolbar.js +3 -0
  5. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +4 -4
  6. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +6 -4
  7. package/TimePicker/TimePickerToolbar.js +3 -0
  8. package/index.js +1 -1
  9. package/internals/components/PickersToolbar.js +13 -9
  10. package/internals/hooks/useField/useFieldCharacterEditing.js +1 -1
  11. package/internals/hooks/useField/useFieldV6TextField.js +5 -3
  12. package/internals/hooks/useField/useFieldV7TextField.js +2 -2
  13. package/internals/models/props/toolbar.d.ts +3 -0
  14. package/locales/koKR.js +1 -2
  15. package/locales/zhCN.js +16 -20
  16. package/modern/DatePicker/DatePickerToolbar.js +4 -1
  17. package/modern/DateTimePicker/DateTimePickerToolbar.js +3 -0
  18. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +4 -4
  19. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +5 -3
  20. package/modern/TimePicker/TimePickerToolbar.js +3 -0
  21. package/modern/index.js +1 -1
  22. package/modern/internals/components/PickersToolbar.js +13 -9
  23. package/modern/internals/hooks/useField/useFieldCharacterEditing.js +1 -1
  24. package/modern/internals/hooks/useField/useFieldV6TextField.js +5 -3
  25. package/modern/internals/hooks/useField/useFieldV7TextField.js +2 -2
  26. package/modern/locales/koKR.js +1 -2
  27. package/modern/locales/zhCN.js +16 -20
  28. package/node/DatePicker/DatePickerToolbar.js +4 -1
  29. package/node/DateTimePicker/DateTimePickerToolbar.js +3 -0
  30. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +4 -4
  31. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +5 -3
  32. package/node/TimePicker/TimePickerToolbar.js +3 -0
  33. package/node/index.js +1 -1
  34. package/node/internals/components/PickersToolbar.js +13 -9
  35. package/node/internals/hooks/useField/useFieldCharacterEditing.js +1 -1
  36. package/node/internals/hooks/useField/useFieldV6TextField.js +5 -3
  37. package/node/internals/hooks/useField/useFieldV7TextField.js +2 -2
  38. package/node/locales/koKR.js +1 -2
  39. package/node/locales/zhCN.js +16 -20
  40. package/package.json +2 -2
  41. package/themeAugmentation/props.d.ts +9 -10
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["value", "isLandscape", "onChange", "toolbarFormat", "toolbarPlaceholder", "views", "className"];
3
+ const _excluded = ["value", "isLandscape", "onChange", "toolbarFormat", "toolbarPlaceholder", "views", "className", "onViewChange", "view"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import PropTypes from 'prop-types';
@@ -133,5 +133,8 @@ process.env.NODE_ENV !== "production" ? DatePickerToolbar.propTypes = {
133
133
  * Currently visible picker view.
134
134
  */
135
135
  view: PropTypes.oneOf(['day', 'month', 'year']).isRequired,
136
+ /**
137
+ * Available views.
138
+ */
136
139
  views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired).isRequired
137
140
  } : void 0;
@@ -5,8 +5,6 @@ import { DateOrTimeViewWithMeridiem, WrapperVariant } from '../internals/models'
5
5
  import { MakeOptional } from '../internals/models/helpers';
6
6
  import { PickerValidDate } from '../models';
7
7
  export interface ExportedDateTimePickerToolbarProps extends ExportedBaseToolbarProps {
8
- ampm?: boolean;
9
- ampmInClock?: boolean;
10
8
  /**
11
9
  * Override or extend the styles applied to the component.
12
10
  */
@@ -18,6 +16,8 @@ export interface DateTimePickerToolbarProps<TDate extends PickerValidDate> exten
18
16
  * If provided, it will be used instead of `dateTimePickerToolbarTitle` from localization.
19
17
  */
20
18
  toolbarTitle?: React.ReactNode;
19
+ ampm?: boolean;
20
+ ampmInClock?: boolean;
21
21
  }
22
22
  /**
23
23
  * Demos:
@@ -360,6 +360,9 @@ process.env.NODE_ENV !== "production" ? DateTimePickerToolbar.propTypes = {
360
360
  * Currently visible picker view.
361
361
  */
362
362
  view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
363
+ /**
364
+ * Available views.
365
+ */
363
366
  views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
364
367
  } : void 0;
365
368
  export { DateTimePickerToolbar };
@@ -229,7 +229,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
229
229
  value,
230
230
  ampm,
231
231
  utils,
232
- isDisabled: hours => disabled || isTimeDisabled(hours, 'hours'),
232
+ isDisabled: hours => isTimeDisabled(hours, 'hours'),
233
233
  timeStep: timeSteps.hours,
234
234
  resolveAriaLabel: localeText.hoursClockNumberText,
235
235
  valueOrReferenceDate
@@ -245,7 +245,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
245
245
  items: getTimeSectionOptions({
246
246
  value: utils.getMinutes(valueOrReferenceDate),
247
247
  utils,
248
- isDisabled: minutes => disabled || isTimeDisabled(minutes, 'minutes'),
248
+ isDisabled: minutes => isTimeDisabled(minutes, 'minutes'),
249
249
  resolveLabel: minutes => utils.format(utils.setMinutes(now, minutes), 'minutes'),
250
250
  timeStep: timeSteps.minutes,
251
251
  hasValue: !!value,
@@ -262,7 +262,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
262
262
  items: getTimeSectionOptions({
263
263
  value: utils.getSeconds(valueOrReferenceDate),
264
264
  utils,
265
- isDisabled: seconds => disabled || isTimeDisabled(seconds, 'seconds'),
265
+ isDisabled: seconds => isTimeDisabled(seconds, 'seconds'),
266
266
  resolveLabel: seconds => utils.format(utils.setSeconds(now, seconds), 'seconds'),
267
267
  timeStep: timeSteps.seconds,
268
268
  hasValue: !!value,
@@ -294,7 +294,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
294
294
  default:
295
295
  throw new Error(`Unknown view: ${viewToBuild} found.`);
296
296
  }
297
- }, [now, value, ampm, utils, timeSteps.hours, timeSteps.minutes, timeSteps.seconds, localeText.hoursClockNumberText, localeText.minutesClockNumberText, localeText.secondsClockNumberText, meridiemMode, setValueAndGoToNextView, valueOrReferenceDate, disabled, isTimeDisabled, handleMeridiemChange]);
297
+ }, [now, value, ampm, utils, timeSteps.hours, timeSteps.minutes, timeSteps.seconds, localeText.hoursClockNumberText, localeText.minutesClockNumberText, localeText.secondsClockNumberText, meridiemMode, setValueAndGoToNextView, valueOrReferenceDate, isTimeDisabled, handleMeridiemChange]);
298
298
  const viewTimeOptions = React.useMemo(() => {
299
299
  return views.reduce((result, currentView) => {
300
300
  return _extends({}, result, {
@@ -138,8 +138,10 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
138
138
  role: "listbox"
139
139
  }, other, {
140
140
  children: items.map((option, index) => {
141
- var _option$isDisabled, _option$isDisabled2;
142
- if (skipDisabled && (_option$isDisabled = option.isDisabled) != null && _option$isDisabled.call(option, option.value)) {
141
+ var _option$isDisabled;
142
+ const isItemDisabled = (_option$isDisabled = option.isDisabled) == null ? void 0 : _option$isDisabled.call(option, option.value);
143
+ const isDisabled = disabled || isItemDisabled;
144
+ if (skipDisabled && isDisabled) {
143
145
  return null;
144
146
  }
145
147
  const isSelected = option.isSelected(option.value);
@@ -147,12 +149,12 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
147
149
  return /*#__PURE__*/_jsx(DigitalClockSectionItem, _extends({
148
150
  onClick: () => !readOnly && onChange(option.value),
149
151
  selected: isSelected,
150
- disabled: disabled || ((_option$isDisabled2 = option.isDisabled) == null ? void 0 : _option$isDisabled2.call(option, option.value)),
152
+ disabled: isDisabled,
151
153
  disableRipple: readOnly,
152
154
  role: "option"
153
155
  // aria-readonly is not supported here and does not have any effect
154
156
  ,
155
- "aria-disabled": readOnly,
157
+ "aria-disabled": readOnly || isDisabled || undefined,
156
158
  "aria-label": option.ariaLabel,
157
159
  "aria-selected": isSelected,
158
160
  tabIndex: tabIndex,
@@ -254,6 +254,9 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
254
254
  * Currently visible picker view.
255
255
  */
256
256
  view: PropTypes.oneOf(['hours', 'meridiem', 'minutes', 'seconds']).isRequired,
257
+ /**
258
+ * Available views.
259
+ */
257
260
  views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'meridiem', 'minutes', 'seconds']).isRequired).isRequired
258
261
  } : void 0;
259
262
  export { TimePickerToolbar };
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.0.0-beta.4
2
+ * @mui/x-date-pickers v7.0.0-beta.6
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,4 +1,6 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
1
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["children", "className", "toolbarTitle", "hidden", "titleId", "isLandscape", "classes", "landscapeDirection"];
2
4
  import * as React from 'react';
3
5
  import clsx from 'clsx';
4
6
  import Typography from '@mui/material/Typography';
@@ -63,21 +65,23 @@ export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersTool
63
65
  name: 'MuiPickersToolbar'
64
66
  });
65
67
  const {
66
- children,
67
- className,
68
- toolbarTitle,
69
- hidden,
70
- titleId
71
- } = props;
68
+ children,
69
+ className,
70
+ toolbarTitle,
71
+ hidden,
72
+ titleId
73
+ } = props,
74
+ other = _objectWithoutPropertiesLoose(props, _excluded);
72
75
  const ownerState = props;
73
76
  const classes = useUtilityClasses(ownerState);
74
77
  if (hidden) {
75
78
  return null;
76
79
  }
77
- return /*#__PURE__*/_jsxs(PickersToolbarRoot, {
80
+ return /*#__PURE__*/_jsxs(PickersToolbarRoot, _extends({
78
81
  ref: ref,
79
82
  className: clsx(classes.root, className),
80
- ownerState: ownerState,
83
+ ownerState: ownerState
84
+ }, other, {
81
85
  children: [/*#__PURE__*/_jsx(Typography, {
82
86
  color: "text.secondary",
83
87
  variant: "overline",
@@ -88,5 +92,5 @@ export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersTool
88
92
  ownerState: ownerState,
89
93
  children: children
90
94
  })]
91
- });
95
+ }));
92
96
  });
@@ -57,7 +57,7 @@ export const useFieldCharacterEditing = ({
57
57
  if (query != null) {
58
58
  const timeout = setTimeout(() => resetQuery(), QUERY_LIFE_DURATION_MS);
59
59
  return () => {
60
- window.clearTimeout(timeout);
60
+ clearTimeout(timeout);
61
61
  };
62
62
  }
63
63
  return () => {};
@@ -36,7 +36,7 @@ export const addPositionPropertiesToSections = (sections, localizedDigits, isRTL
36
36
  export const useFieldV6TextField = params => {
37
37
  const theme = useTheme();
38
38
  const isRTL = theme.direction === 'rtl';
39
- const focusTimeoutRef = React.useRef(undefined);
39
+ const focusTimeoutRef = React.useRef();
40
40
  const {
41
41
  forwardedProps: {
42
42
  onFocus,
@@ -151,7 +151,7 @@ export const useFieldV6TextField = params => {
151
151
  onFocus == null || onFocus(...args);
152
152
  // The ref is guaranteed to be resolved at this point.
153
153
  const input = inputRef.current;
154
- window.clearTimeout(focusTimeoutRef.current);
154
+ clearTimeout(focusTimeoutRef.current);
155
155
  focusTimeoutRef.current = setTimeout(() => {
156
156
  // The ref changed, the component got remounted, the focus event is no longer relevant.
157
157
  if (!input || input !== inputRef.current) {
@@ -288,7 +288,9 @@ export const useFieldV6TextField = params => {
288
288
  if (inputRef.current && inputRef.current === getActiveElement(document)) {
289
289
  setSelectedSections('all');
290
290
  }
291
- return () => window.clearTimeout(focusTimeoutRef.current);
291
+ return () => {
292
+ clearTimeout(focusTimeoutRef.current);
293
+ };
292
294
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
293
295
 
294
296
  const inputMode = React.useMemo(() => {
@@ -134,7 +134,7 @@ export const useFieldV7TextField = params => {
134
134
  setFocused(true);
135
135
  onClick == null || onClick(event, ...args);
136
136
  if (parsedSelectedSections === 'all') {
137
- window.setTimeout(() => {
137
+ setTimeout(() => {
138
138
  const cursorPosition = document.getSelection().getRangeAt(0).startOffset;
139
139
  if (cursorPosition === 0) {
140
140
  setSelectedSections(sectionOrder.startIndex);
@@ -206,7 +206,7 @@ export const useFieldV7TextField = params => {
206
206
  });
207
207
  const handleContainerBlur = useEventCallback((...args) => {
208
208
  onBlur == null || onBlur(...args);
209
- window.setTimeout(() => {
209
+ setTimeout(() => {
210
210
  if (!sectionListRef.current) {
211
211
  return;
212
212
  }
@@ -16,6 +16,9 @@ export interface BaseToolbarProps<TValue, TView extends DateOrTimeViewWithMeridi
16
16
  * @param {TView} view The view to open
17
17
  */
18
18
  onViewChange: (view: TView) => void;
19
+ /**
20
+ * Available views.
21
+ */
19
22
  views: readonly TView[];
20
23
  disabled?: boolean;
21
24
  readOnly?: boolean;
package/locales/koKR.js CHANGED
@@ -46,8 +46,7 @@ const koKRPickers = {
46
46
  // Open picker labels
47
47
  openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `날짜를 선택하세요. 현재 선택된 날짜는 ${utils.format(value, 'fullDate')}입니다.` : '날짜를 선택하세요',
48
48
  openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `시간을 선택하세요. 현재 선택된 시간은 ${utils.format(value, 'fullTime')}입니다.` : '시간을 선택하세요',
49
- // fieldClearLabel: 'Clear value',
50
-
49
+ fieldClearLabel: '지우기',
51
50
  // Table labels
52
51
  timeTableLabel: '선택한 시간',
53
52
  dateTableLabel: '선택한 날짜',
package/locales/zhCN.js CHANGED
@@ -3,7 +3,7 @@ const views = {
3
3
  hours: '小时',
4
4
  minutes: '分钟',
5
5
  seconds: '秒',
6
- meridiem: '子午线'
6
+ meridiem: '十二小时制'
7
7
  };
8
8
  const zhCNPickers = {
9
9
  // Calendar navigation
@@ -16,11 +16,10 @@ const zhCNPickers = {
16
16
  // DateRange labels
17
17
  start: '开始',
18
18
  end: '结束',
19
- // startDate: 'Start date',
20
- // startTime: 'Start time',
21
- // endDate: 'End date',
22
- // endTime: 'End time',
23
-
19
+ startDate: '开始日期',
20
+ startTime: '开始时间',
21
+ endDate: '结束日期',
22
+ endTime: '结束时间',
24
23
  // Action bar
25
24
  cancelButtonLabel: '取消',
26
25
  clearButtonLabel: '清除',
@@ -46,8 +45,7 @@ const zhCNPickers = {
46
45
  // Open picker labels
47
46
  openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `选择日期,已选择${utils.format(value, 'fullDate')}` : '选择日期',
48
47
  openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `选择时间,已选择${utils.format(value, 'fullTime')}` : '选择时间',
49
- // fieldClearLabel: 'Clear value',
50
-
48
+ fieldClearLabel: '清除',
51
49
  // Table labels
52
50
  timeTableLabel: '选择时间',
53
51
  dateTableLabel: '选择日期',
@@ -59,19 +57,17 @@ const zhCNPickers = {
59
57
  fieldHoursPlaceholder: () => 'hh',
60
58
  fieldMinutesPlaceholder: () => 'mm',
61
59
  fieldSecondsPlaceholder: () => 'ss',
62
- fieldMeridiemPlaceholder: () => 'aa'
63
-
60
+ fieldMeridiemPlaceholder: () => 'aa',
64
61
  // View names
65
- // year: 'Year',
66
- // month: 'Month',
67
- // day: 'Day',
68
- // weekDay: 'Week day',
69
- // hours: 'Hours',
70
- // minutes: 'Minutes',
71
- // seconds: 'Seconds',
72
- // meridiem: 'Meridiem',
73
-
62
+ year: '年份',
63
+ month: '月份',
64
+ day: '日期',
65
+ weekDay: '星期',
66
+ hours: '',
67
+ minutes: '',
68
+ seconds: '',
69
+ meridiem: '十二小时制',
74
70
  // Common
75
- // empty: 'Empty',
71
+ empty: ''
76
72
  };
77
73
  export const zhCN = getPickersLocalization(zhCNPickers);
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["value", "isLandscape", "onChange", "toolbarFormat", "toolbarPlaceholder", "views", "className"];
3
+ const _excluded = ["value", "isLandscape", "onChange", "toolbarFormat", "toolbarPlaceholder", "views", "className", "onViewChange", "view"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import PropTypes from 'prop-types';
@@ -133,5 +133,8 @@ process.env.NODE_ENV !== "production" ? DatePickerToolbar.propTypes = {
133
133
  * Currently visible picker view.
134
134
  */
135
135
  view: PropTypes.oneOf(['day', 'month', 'year']).isRequired,
136
+ /**
137
+ * Available views.
138
+ */
136
139
  views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'month', 'year']).isRequired).isRequired
137
140
  } : void 0;
@@ -360,6 +360,9 @@ process.env.NODE_ENV !== "production" ? DateTimePickerToolbar.propTypes = {
360
360
  * Currently visible picker view.
361
361
  */
362
362
  view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
363
+ /**
364
+ * Available views.
365
+ */
363
366
  views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
364
367
  } : void 0;
365
368
  export { DateTimePickerToolbar };
@@ -229,7 +229,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
229
229
  value,
230
230
  ampm,
231
231
  utils,
232
- isDisabled: hours => disabled || isTimeDisabled(hours, 'hours'),
232
+ isDisabled: hours => isTimeDisabled(hours, 'hours'),
233
233
  timeStep: timeSteps.hours,
234
234
  resolveAriaLabel: localeText.hoursClockNumberText,
235
235
  valueOrReferenceDate
@@ -245,7 +245,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
245
245
  items: getTimeSectionOptions({
246
246
  value: utils.getMinutes(valueOrReferenceDate),
247
247
  utils,
248
- isDisabled: minutes => disabled || isTimeDisabled(minutes, 'minutes'),
248
+ isDisabled: minutes => isTimeDisabled(minutes, 'minutes'),
249
249
  resolveLabel: minutes => utils.format(utils.setMinutes(now, minutes), 'minutes'),
250
250
  timeStep: timeSteps.minutes,
251
251
  hasValue: !!value,
@@ -262,7 +262,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
262
262
  items: getTimeSectionOptions({
263
263
  value: utils.getSeconds(valueOrReferenceDate),
264
264
  utils,
265
- isDisabled: seconds => disabled || isTimeDisabled(seconds, 'seconds'),
265
+ isDisabled: seconds => isTimeDisabled(seconds, 'seconds'),
266
266
  resolveLabel: seconds => utils.format(utils.setSeconds(now, seconds), 'seconds'),
267
267
  timeStep: timeSteps.seconds,
268
268
  hasValue: !!value,
@@ -294,7 +294,7 @@ export const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function M
294
294
  default:
295
295
  throw new Error(`Unknown view: ${viewToBuild} found.`);
296
296
  }
297
- }, [now, value, ampm, utils, timeSteps.hours, timeSteps.minutes, timeSteps.seconds, localeText.hoursClockNumberText, localeText.minutesClockNumberText, localeText.secondsClockNumberText, meridiemMode, setValueAndGoToNextView, valueOrReferenceDate, disabled, isTimeDisabled, handleMeridiemChange]);
297
+ }, [now, value, ampm, utils, timeSteps.hours, timeSteps.minutes, timeSteps.seconds, localeText.hoursClockNumberText, localeText.minutesClockNumberText, localeText.secondsClockNumberText, meridiemMode, setValueAndGoToNextView, valueOrReferenceDate, isTimeDisabled, handleMeridiemChange]);
298
298
  const viewTimeOptions = React.useMemo(() => {
299
299
  return views.reduce((result, currentView) => {
300
300
  return _extends({}, result, {
@@ -137,7 +137,9 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
137
137
  role: "listbox"
138
138
  }, other, {
139
139
  children: items.map((option, index) => {
140
- if (skipDisabled && option.isDisabled?.(option.value)) {
140
+ const isItemDisabled = option.isDisabled?.(option.value);
141
+ const isDisabled = disabled || isItemDisabled;
142
+ if (skipDisabled && isDisabled) {
141
143
  return null;
142
144
  }
143
145
  const isSelected = option.isSelected(option.value);
@@ -145,12 +147,12 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
145
147
  return /*#__PURE__*/_jsx(DigitalClockSectionItem, _extends({
146
148
  onClick: () => !readOnly && onChange(option.value),
147
149
  selected: isSelected,
148
- disabled: disabled || option.isDisabled?.(option.value),
150
+ disabled: isDisabled,
149
151
  disableRipple: readOnly,
150
152
  role: "option"
151
153
  // aria-readonly is not supported here and does not have any effect
152
154
  ,
153
- "aria-disabled": readOnly,
155
+ "aria-disabled": readOnly || isDisabled || undefined,
154
156
  "aria-label": option.ariaLabel,
155
157
  "aria-selected": isSelected,
156
158
  tabIndex: tabIndex,
@@ -254,6 +254,9 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
254
254
  * Currently visible picker view.
255
255
  */
256
256
  view: PropTypes.oneOf(['hours', 'meridiem', 'minutes', 'seconds']).isRequired,
257
+ /**
258
+ * Available views.
259
+ */
257
260
  views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'meridiem', 'minutes', 'seconds']).isRequired).isRequired
258
261
  } : void 0;
259
262
  export { TimePickerToolbar };
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.0.0-beta.4
2
+ * @mui/x-date-pickers v7.0.0-beta.6
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,4 +1,6 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
1
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["children", "className", "toolbarTitle", "hidden", "titleId", "isLandscape", "classes", "landscapeDirection"];
2
4
  import * as React from 'react';
3
5
  import clsx from 'clsx';
4
6
  import Typography from '@mui/material/Typography';
@@ -60,21 +62,23 @@ export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersTool
60
62
  name: 'MuiPickersToolbar'
61
63
  });
62
64
  const {
63
- children,
64
- className,
65
- toolbarTitle,
66
- hidden,
67
- titleId
68
- } = props;
65
+ children,
66
+ className,
67
+ toolbarTitle,
68
+ hidden,
69
+ titleId
70
+ } = props,
71
+ other = _objectWithoutPropertiesLoose(props, _excluded);
69
72
  const ownerState = props;
70
73
  const classes = useUtilityClasses(ownerState);
71
74
  if (hidden) {
72
75
  return null;
73
76
  }
74
- return /*#__PURE__*/_jsxs(PickersToolbarRoot, {
77
+ return /*#__PURE__*/_jsxs(PickersToolbarRoot, _extends({
75
78
  ref: ref,
76
79
  className: clsx(classes.root, className),
77
- ownerState: ownerState,
80
+ ownerState: ownerState
81
+ }, other, {
78
82
  children: [/*#__PURE__*/_jsx(Typography, {
79
83
  color: "text.secondary",
80
84
  variant: "overline",
@@ -85,5 +89,5 @@ export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersTool
85
89
  ownerState: ownerState,
86
90
  children: children
87
91
  })]
88
- });
92
+ }));
89
93
  });
@@ -56,7 +56,7 @@ export const useFieldCharacterEditing = ({
56
56
  if (query != null) {
57
57
  const timeout = setTimeout(() => resetQuery(), QUERY_LIFE_DURATION_MS);
58
58
  return () => {
59
- window.clearTimeout(timeout);
59
+ clearTimeout(timeout);
60
60
  };
61
61
  }
62
62
  return () => {};
@@ -36,7 +36,7 @@ export const addPositionPropertiesToSections = (sections, localizedDigits, isRTL
36
36
  export const useFieldV6TextField = params => {
37
37
  const theme = useTheme();
38
38
  const isRTL = theme.direction === 'rtl';
39
- const focusTimeoutRef = React.useRef(undefined);
39
+ const focusTimeoutRef = React.useRef();
40
40
  const {
41
41
  forwardedProps: {
42
42
  onFocus,
@@ -148,7 +148,7 @@ export const useFieldV6TextField = params => {
148
148
  onFocus?.(...args);
149
149
  // The ref is guaranteed to be resolved at this point.
150
150
  const input = inputRef.current;
151
- window.clearTimeout(focusTimeoutRef.current);
151
+ clearTimeout(focusTimeoutRef.current);
152
152
  focusTimeoutRef.current = setTimeout(() => {
153
153
  // The ref changed, the component got remounted, the focus event is no longer relevant.
154
154
  if (!input || input !== inputRef.current) {
@@ -282,7 +282,9 @@ export const useFieldV6TextField = params => {
282
282
  if (inputRef.current && inputRef.current === getActiveElement(document)) {
283
283
  setSelectedSections('all');
284
284
  }
285
- return () => window.clearTimeout(focusTimeoutRef.current);
285
+ return () => {
286
+ clearTimeout(focusTimeoutRef.current);
287
+ };
286
288
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
287
289
 
288
290
  const inputMode = React.useMemo(() => {
@@ -134,7 +134,7 @@ export const useFieldV7TextField = params => {
134
134
  setFocused(true);
135
135
  onClick?.(event, ...args);
136
136
  if (parsedSelectedSections === 'all') {
137
- window.setTimeout(() => {
137
+ setTimeout(() => {
138
138
  const cursorPosition = document.getSelection().getRangeAt(0).startOffset;
139
139
  if (cursorPosition === 0) {
140
140
  setSelectedSections(sectionOrder.startIndex);
@@ -205,7 +205,7 @@ export const useFieldV7TextField = params => {
205
205
  });
206
206
  const handleContainerBlur = useEventCallback((...args) => {
207
207
  onBlur?.(...args);
208
- window.setTimeout(() => {
208
+ setTimeout(() => {
209
209
  if (!sectionListRef.current) {
210
210
  return;
211
211
  }
@@ -46,8 +46,7 @@ const koKRPickers = {
46
46
  // Open picker labels
47
47
  openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `날짜를 선택하세요. 현재 선택된 날짜는 ${utils.format(value, 'fullDate')}입니다.` : '날짜를 선택하세요',
48
48
  openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `시간을 선택하세요. 현재 선택된 시간은 ${utils.format(value, 'fullTime')}입니다.` : '시간을 선택하세요',
49
- // fieldClearLabel: 'Clear value',
50
-
49
+ fieldClearLabel: '지우기',
51
50
  // Table labels
52
51
  timeTableLabel: '선택한 시간',
53
52
  dateTableLabel: '선택한 날짜',
@@ -3,7 +3,7 @@ const views = {
3
3
  hours: '小时',
4
4
  minutes: '分钟',
5
5
  seconds: '秒',
6
- meridiem: '子午线'
6
+ meridiem: '十二小时制'
7
7
  };
8
8
  const zhCNPickers = {
9
9
  // Calendar navigation
@@ -16,11 +16,10 @@ const zhCNPickers = {
16
16
  // DateRange labels
17
17
  start: '开始',
18
18
  end: '结束',
19
- // startDate: 'Start date',
20
- // startTime: 'Start time',
21
- // endDate: 'End date',
22
- // endTime: 'End time',
23
-
19
+ startDate: '开始日期',
20
+ startTime: '开始时间',
21
+ endDate: '结束日期',
22
+ endTime: '结束时间',
24
23
  // Action bar
25
24
  cancelButtonLabel: '取消',
26
25
  clearButtonLabel: '清除',
@@ -46,8 +45,7 @@ const zhCNPickers = {
46
45
  // Open picker labels
47
46
  openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `选择日期,已选择${utils.format(value, 'fullDate')}` : '选择日期',
48
47
  openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `选择时间,已选择${utils.format(value, 'fullTime')}` : '选择时间',
49
- // fieldClearLabel: 'Clear value',
50
-
48
+ fieldClearLabel: '清除',
51
49
  // Table labels
52
50
  timeTableLabel: '选择时间',
53
51
  dateTableLabel: '选择日期',
@@ -59,19 +57,17 @@ const zhCNPickers = {
59
57
  fieldHoursPlaceholder: () => 'hh',
60
58
  fieldMinutesPlaceholder: () => 'mm',
61
59
  fieldSecondsPlaceholder: () => 'ss',
62
- fieldMeridiemPlaceholder: () => 'aa'
63
-
60
+ fieldMeridiemPlaceholder: () => 'aa',
64
61
  // View names
65
- // year: 'Year',
66
- // month: 'Month',
67
- // day: 'Day',
68
- // weekDay: 'Week day',
69
- // hours: 'Hours',
70
- // minutes: 'Minutes',
71
- // seconds: 'Seconds',
72
- // meridiem: 'Meridiem',
73
-
62
+ year: '年份',
63
+ month: '月份',
64
+ day: '日期',
65
+ weekDay: '星期',
66
+ hours: '',
67
+ minutes: '',
68
+ seconds: '',
69
+ meridiem: '十二小时制',
74
70
  // Common
75
- // empty: 'Empty',
71
+ empty: ''
76
72
  };
77
73
  export const zhCN = getPickersLocalization(zhCNPickers);
@@ -18,7 +18,7 @@ var _useUtils = require("../internals/hooks/useUtils");
18
18
  var _datePickerToolbarClasses = require("./datePickerToolbarClasses");
19
19
  var _dateUtils = require("../internals/utils/date-utils");
20
20
  var _jsxRuntime = require("react/jsx-runtime");
21
- const _excluded = ["value", "isLandscape", "onChange", "toolbarFormat", "toolbarPlaceholder", "views", "className"];
21
+ const _excluded = ["value", "isLandscape", "onChange", "toolbarFormat", "toolbarPlaceholder", "views", "className", "onViewChange", "view"];
22
22
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
23
23
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
24
24
  const useUtilityClasses = ownerState => {
@@ -142,5 +142,8 @@ process.env.NODE_ENV !== "production" ? DatePickerToolbar.propTypes = {
142
142
  * Currently visible picker view.
143
143
  */
144
144
  view: _propTypes.default.oneOf(['day', 'month', 'year']).isRequired,
145
+ /**
146
+ * Available views.
147
+ */
145
148
  views: _propTypes.default.arrayOf(_propTypes.default.oneOf(['day', 'month', 'year']).isRequired).isRequired
146
149
  } : void 0;