@mui/x-date-pickers 8.5.3 → 8.6.0
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 +107 -0
- package/DateCalendar/DateCalendar.js +16 -16
- package/DateCalendar/DayCalendar.js +48 -48
- package/DateCalendar/useCalendarState.js +25 -25
- package/DateCalendar/useIsDateDisabled.js +2 -2
- package/DatePicker/DatePickerToolbar.js +7 -9
- package/DateTimeField/DateTimeField.js +1 -1
- package/DateTimePicker/DateTimePicker.js +1 -1
- package/DateTimePicker/DateTimePickerToolbar.js +12 -13
- package/DateTimePicker/shared.js +3 -3
- package/DesktopDatePicker/DesktopDatePicker.js +3 -3
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +4 -4
- package/DesktopTimePicker/DesktopTimePicker.js +4 -4
- package/DigitalClock/DigitalClock.d.ts +1 -1
- package/DigitalClock/DigitalClock.js +16 -16
- package/LocalizationProvider/LocalizationProvider.d.ts +9 -3
- package/LocalizationProvider/LocalizationProvider.js +28 -19
- package/MobileDatePicker/MobileDatePicker.js +3 -3
- package/MobileDateTimePicker/MobileDateTimePicker.js +4 -4
- package/MobileTimePicker/MobileTimePicker.js +4 -4
- package/MonthCalendar/MonthCalendar.js +19 -18
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +32 -32
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +4 -4
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +7 -7
- package/PickerDay2/PickerDay2.js +3 -3
- package/PickersActionBar/PickersActionBar.d.ts +2 -2
- package/PickersActionBar/PickersActionBar.js +2 -2
- package/PickersCalendarHeader/PickersCalendarHeader.js +7 -8
- package/PickersDay/PickersDay.js +3 -3
- package/PickersDay/usePickerDayOwnerState.js +5 -5
- package/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/StaticTimePicker/StaticTimePicker.js +1 -1
- package/TimeClock/Clock.js +8 -9
- package/TimeClock/ClockNumbers.d.ts +3 -3
- package/TimeClock/ClockNumbers.js +5 -5
- package/TimeClock/TimeClock.js +29 -29
- package/TimeField/TimeField.js +1 -1
- package/TimePicker/TimePicker.js +1 -1
- package/TimePicker/TimePickerToolbar.js +7 -9
- package/TimePicker/shared.js +3 -3
- package/YearCalendar/YearCalendar.js +19 -18
- package/esm/DateCalendar/DateCalendar.js +16 -16
- package/esm/DateCalendar/DayCalendar.js +48 -48
- package/esm/DateCalendar/useCalendarState.js +25 -25
- package/esm/DateCalendar/useIsDateDisabled.js +2 -2
- package/esm/DatePicker/DatePickerToolbar.js +6 -8
- package/esm/DateTimeField/DateTimeField.js +1 -1
- package/esm/DateTimePicker/DateTimePicker.js +1 -1
- package/esm/DateTimePicker/DateTimePickerToolbar.js +11 -12
- package/esm/DateTimePicker/shared.js +3 -3
- package/esm/DesktopDatePicker/DesktopDatePicker.js +3 -3
- package/esm/DesktopDateTimePicker/DesktopDateTimePicker.js +4 -4
- package/esm/DesktopTimePicker/DesktopTimePicker.js +4 -4
- package/esm/DigitalClock/DigitalClock.d.ts +1 -1
- package/esm/DigitalClock/DigitalClock.js +16 -16
- package/esm/LocalizationProvider/LocalizationProvider.d.ts +9 -3
- package/esm/LocalizationProvider/LocalizationProvider.js +27 -18
- package/esm/MobileDatePicker/MobileDatePicker.js +3 -3
- package/esm/MobileDateTimePicker/MobileDateTimePicker.js +4 -4
- package/esm/MobileTimePicker/MobileTimePicker.js +4 -4
- package/esm/MonthCalendar/MonthCalendar.js +20 -19
- package/esm/MultiSectionDigitalClock/MultiSectionDigitalClock.js +32 -32
- package/esm/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +4 -4
- package/esm/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +7 -7
- package/esm/PickerDay2/PickerDay2.js +3 -3
- package/esm/PickersActionBar/PickersActionBar.d.ts +2 -2
- package/esm/PickersActionBar/PickersActionBar.js +2 -2
- package/esm/PickersCalendarHeader/PickersCalendarHeader.js +6 -7
- package/esm/PickersDay/PickersDay.js +3 -3
- package/esm/PickersDay/usePickerDayOwnerState.js +5 -5
- package/esm/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/esm/StaticTimePicker/StaticTimePicker.js +1 -1
- package/esm/TimeClock/Clock.js +7 -8
- package/esm/TimeClock/ClockNumbers.d.ts +3 -3
- package/esm/TimeClock/ClockNumbers.js +5 -5
- package/esm/TimeClock/TimeClock.js +29 -29
- package/esm/TimeField/TimeField.js +1 -1
- package/esm/TimePicker/TimePicker.js +1 -1
- package/esm/TimePicker/TimePickerToolbar.js +6 -8
- package/esm/TimePicker/shared.js +3 -3
- package/esm/YearCalendar/YearCalendar.js +20 -19
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/hooks/useParsedFormat.js +6 -6
- package/esm/hooks/usePickerAdapter.d.ts +7 -0
- package/esm/hooks/usePickerAdapter.js +20 -0
- package/esm/hooks/usePickerTranslations.js +1 -1
- package/esm/index.js +1 -1
- package/esm/internals/components/pickersToolbarClasses.d.ts +1 -1
- package/esm/internals/demo/DemoContainer.d.ts +2 -3
- package/esm/internals/demo/DemoContainer.js +3 -2
- package/esm/internals/hooks/date-helpers-hooks.js +16 -16
- package/esm/internals/hooks/useClockReferenceDate.d.ts +2 -2
- package/esm/internals/hooks/useClockReferenceDate.js +3 -3
- package/esm/internals/hooks/useControlledValue.js +8 -7
- package/esm/internals/hooks/useField/buildSectionsFromFormat.d.ts +1 -1
- package/esm/internals/hooks/useField/buildSectionsFromFormat.js +17 -17
- package/esm/internals/hooks/useField/useField.types.d.ts +2 -2
- package/esm/internals/hooks/useField/useField.utils.d.ts +10 -10
- package/esm/internals/hooks/useField/useField.utils.js +69 -69
- package/esm/internals/hooks/useField/useFieldCharacterEditing.js +11 -11
- package/esm/internals/hooks/useField/useFieldRootHandleKeyDown.js +7 -7
- package/esm/internals/hooks/useField/useFieldSectionContentProps.js +15 -16
- package/esm/internals/hooks/useField/useFieldState.js +22 -24
- package/esm/internals/hooks/usePicker/hooks/useValueAndOpenStates.js +6 -6
- package/esm/internals/hooks/usePicker/usePicker.js +5 -6
- package/esm/internals/hooks/useUtils.d.ts +1 -8
- package/esm/internals/hooks/useUtils.js +3 -19
- package/esm/internals/index.d.ts +2 -1
- package/esm/internals/index.js +2 -1
- package/esm/internals/models/manager.d.ts +14 -14
- package/esm/internals/models/props/time.d.ts +1 -1
- package/esm/internals/utils/date-time-utils.d.ts +1 -1
- package/esm/internals/utils/date-time-utils.js +5 -5
- package/esm/internals/utils/date-utils.d.ts +11 -11
- package/esm/internals/utils/date-utils.js +34 -34
- package/esm/internals/utils/getDefaultReferenceDate.d.ts +2 -2
- package/esm/internals/utils/getDefaultReferenceDate.js +16 -16
- package/esm/internals/utils/time-utils.d.ts +5 -5
- package/esm/internals/utils/time-utils.js +12 -12
- package/esm/internals/utils/valueManagers.js +4 -4
- package/esm/managers/useDateManager.js +12 -12
- package/esm/managers/useDateTimeManager.js +13 -13
- package/esm/managers/useTimeManager.js +9 -10
- package/esm/validation/useValidation.d.ts +2 -3
- package/esm/validation/useValidation.js +2 -2
- package/esm/validation/validateDate.js +6 -6
- package/esm/validation/validateTime.js +6 -6
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +8 -1
- package/hooks/useParsedFormat.js +6 -6
- package/hooks/usePickerAdapter.d.ts +7 -0
- package/hooks/usePickerAdapter.js +29 -0
- package/hooks/usePickerTranslations.js +2 -2
- package/index.js +1 -1
- package/internals/components/pickersToolbarClasses.d.ts +1 -1
- package/internals/demo/DemoContainer.d.ts +2 -3
- package/internals/demo/DemoContainer.js +3 -2
- package/internals/hooks/date-helpers-hooks.js +16 -16
- package/internals/hooks/useClockReferenceDate.d.ts +2 -2
- package/internals/hooks/useClockReferenceDate.js +3 -3
- package/internals/hooks/useControlledValue.js +7 -7
- package/internals/hooks/useField/buildSectionsFromFormat.d.ts +1 -1
- package/internals/hooks/useField/buildSectionsFromFormat.js +17 -17
- package/internals/hooks/useField/useField.types.d.ts +2 -2
- package/internals/hooks/useField/useField.utils.d.ts +10 -10
- package/internals/hooks/useField/useField.utils.js +69 -69
- package/internals/hooks/useField/useFieldCharacterEditing.js +11 -11
- package/internals/hooks/useField/useFieldRootHandleKeyDown.js +7 -7
- package/internals/hooks/useField/useFieldSectionContentProps.js +14 -15
- package/internals/hooks/useField/useFieldState.js +23 -25
- package/internals/hooks/usePicker/hooks/useValueAndOpenStates.js +6 -6
- package/internals/hooks/usePicker/usePicker.js +5 -6
- package/internals/hooks/useUtils.d.ts +1 -8
- package/internals/hooks/useUtils.js +5 -24
- package/internals/index.d.ts +2 -1
- package/internals/index.js +2 -7
- package/internals/models/manager.d.ts +14 -14
- package/internals/models/props/time.d.ts +1 -1
- package/internals/utils/date-time-utils.d.ts +1 -1
- package/internals/utils/date-time-utils.js +5 -5
- package/internals/utils/date-utils.d.ts +11 -11
- package/internals/utils/date-utils.js +34 -34
- package/internals/utils/getDefaultReferenceDate.d.ts +2 -2
- package/internals/utils/getDefaultReferenceDate.js +16 -16
- package/internals/utils/time-utils.d.ts +5 -5
- package/internals/utils/time-utils.js +12 -12
- package/internals/utils/valueManagers.js +4 -4
- package/managers/useDateManager.js +12 -12
- package/managers/useDateTimeManager.js +13 -13
- package/managers/useTimeManager.js +10 -11
- package/package.json +2 -2
- package/validation/useValidation.d.ts +2 -3
- package/validation/useValidation.js +2 -2
- package/validation/validateDate.js +6 -6
- package/validation/validateTime.js +6 -6
|
@@ -16,7 +16,7 @@ var _RtlProvider = require("@mui/system/RtlProvider");
|
|
|
16
16
|
var _styles = require("@mui/material/styles");
|
|
17
17
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
18
18
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
19
|
-
var
|
|
19
|
+
var _hooks = require("../hooks");
|
|
20
20
|
var _useUtils = require("../internals/hooks/useUtils");
|
|
21
21
|
var _timeUtils = require("../internals/utils/time-utils");
|
|
22
22
|
var _useViews = require("../internals/hooks/useViews");
|
|
@@ -59,14 +59,14 @@ const MultiSectionDigitalClockRoot = (0, _styles.styled)(_PickerViewRoot.PickerV
|
|
|
59
59
|
* - [MultiSectionDigitalClock API](https://mui.com/x/api/date-pickers/multi-section-digital-clock/)
|
|
60
60
|
*/
|
|
61
61
|
const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function MultiSectionDigitalClock(inProps, ref) {
|
|
62
|
-
const
|
|
62
|
+
const adapter = (0, _hooks.usePickerAdapter)();
|
|
63
63
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
64
64
|
const props = (0, _styles.useThemeProps)({
|
|
65
65
|
props: inProps,
|
|
66
66
|
name: 'MuiMultiSectionDigitalClock'
|
|
67
67
|
});
|
|
68
68
|
const {
|
|
69
|
-
ampm =
|
|
69
|
+
ampm = adapter.is12HourCycleInCurrentLocale(),
|
|
70
70
|
timeSteps: inTimeSteps,
|
|
71
71
|
autoFocus,
|
|
72
72
|
slots,
|
|
@@ -109,7 +109,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
109
109
|
onChange,
|
|
110
110
|
valueManager: _valueManagers.singleItemValueManager
|
|
111
111
|
});
|
|
112
|
-
const translations = (0,
|
|
112
|
+
const translations = (0, _hooks.usePickerTranslations)();
|
|
113
113
|
const now = (0, _useUtils.useNow)(timezone);
|
|
114
114
|
const timeSteps = React.useMemo(() => (0, _extends2.default)({
|
|
115
115
|
hours: 1,
|
|
@@ -119,7 +119,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
119
119
|
const valueOrReferenceDate = (0, _useClockReferenceDate.useClockReferenceDate)({
|
|
120
120
|
value,
|
|
121
121
|
referenceDate: referenceDateProp,
|
|
122
|
-
|
|
122
|
+
adapter,
|
|
123
123
|
props,
|
|
124
124
|
timezone
|
|
125
125
|
});
|
|
@@ -151,7 +151,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
151
151
|
handleMeridiemChange
|
|
152
152
|
} = (0, _dateHelpersHooks.useMeridiemMode)(valueOrReferenceDate, ampm, handleMeridiemValueChange, 'finish');
|
|
153
153
|
const isTimeDisabled = React.useCallback((rawValue, viewType) => {
|
|
154
|
-
const isAfter = (0, _timeUtils.createIsAfterIgnoreDatePart)(disableIgnoringDatePartForTimeValidation,
|
|
154
|
+
const isAfter = (0, _timeUtils.createIsAfterIgnoreDatePart)(disableIgnoringDatePartForTimeValidation, adapter);
|
|
155
155
|
const shouldCheckPastEnd = viewType === 'hours' || viewType === 'minutes' && views.includes('seconds');
|
|
156
156
|
const containsValidTime = ({
|
|
157
157
|
start,
|
|
@@ -178,11 +178,11 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
178
178
|
if (shouldDisableTime) {
|
|
179
179
|
switch (viewType) {
|
|
180
180
|
case 'hours':
|
|
181
|
-
return !shouldDisableTime(
|
|
181
|
+
return !shouldDisableTime(adapter.setHours(valueOrReferenceDate, timeValue), 'hours');
|
|
182
182
|
case 'minutes':
|
|
183
|
-
return !shouldDisableTime(
|
|
183
|
+
return !shouldDisableTime(adapter.setMinutes(valueOrReferenceDate, timeValue), 'minutes');
|
|
184
184
|
case 'seconds':
|
|
185
|
-
return !shouldDisableTime(
|
|
185
|
+
return !shouldDisableTime(adapter.setSeconds(valueOrReferenceDate, timeValue), 'seconds');
|
|
186
186
|
default:
|
|
187
187
|
return false;
|
|
188
188
|
}
|
|
@@ -193,12 +193,12 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
193
193
|
case 'hours':
|
|
194
194
|
{
|
|
195
195
|
const valueWithMeridiem = (0, _timeUtils.convertValueToMeridiem)(rawValue, meridiemMode, ampm);
|
|
196
|
-
const dateWithNewHours =
|
|
197
|
-
if (
|
|
196
|
+
const dateWithNewHours = adapter.setHours(valueOrReferenceDate, valueWithMeridiem);
|
|
197
|
+
if (adapter.getHours(dateWithNewHours) !== valueWithMeridiem) {
|
|
198
198
|
return true;
|
|
199
199
|
}
|
|
200
|
-
const start =
|
|
201
|
-
const end =
|
|
200
|
+
const start = adapter.setSeconds(adapter.setMinutes(dateWithNewHours, 0), 0);
|
|
201
|
+
const end = adapter.setSeconds(adapter.setMinutes(dateWithNewHours, 59), 59);
|
|
202
202
|
return !containsValidTime({
|
|
203
203
|
start,
|
|
204
204
|
end
|
|
@@ -206,9 +206,9 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
206
206
|
}
|
|
207
207
|
case 'minutes':
|
|
208
208
|
{
|
|
209
|
-
const dateWithNewMinutes =
|
|
210
|
-
const start =
|
|
211
|
-
const end =
|
|
209
|
+
const dateWithNewMinutes = adapter.setMinutes(valueOrReferenceDate, rawValue);
|
|
210
|
+
const start = adapter.setSeconds(dateWithNewMinutes, 0);
|
|
211
|
+
const end = adapter.setSeconds(dateWithNewMinutes, 59);
|
|
212
212
|
return !containsValidTime({
|
|
213
213
|
start,
|
|
214
214
|
end
|
|
@@ -216,7 +216,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
216
216
|
}
|
|
217
217
|
case 'seconds':
|
|
218
218
|
{
|
|
219
|
-
const dateWithNewSeconds =
|
|
219
|
+
const dateWithNewSeconds = adapter.setSeconds(valueOrReferenceDate, rawValue);
|
|
220
220
|
const start = dateWithNewSeconds;
|
|
221
221
|
const end = dateWithNewSeconds;
|
|
222
222
|
return !containsValidTime({
|
|
@@ -227,7 +227,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
227
227
|
default:
|
|
228
228
|
throw new Error('not supported');
|
|
229
229
|
}
|
|
230
|
-
}, [ampm, valueOrReferenceDate, disableIgnoringDatePartForTimeValidation, maxTime, meridiemMode, minTime, minutesStep, shouldDisableTime,
|
|
230
|
+
}, [ampm, valueOrReferenceDate, disableIgnoringDatePartForTimeValidation, maxTime, meridiemMode, minTime, minutesStep, shouldDisableTime, adapter, disableFuture, disablePast, now, views]);
|
|
231
231
|
const buildViewProps = React.useCallback(viewToBuild => {
|
|
232
232
|
switch (viewToBuild) {
|
|
233
233
|
case 'hours':
|
|
@@ -235,13 +235,13 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
235
235
|
return {
|
|
236
236
|
onChange: hours => {
|
|
237
237
|
const valueWithMeridiem = (0, _timeUtils.convertValueToMeridiem)(hours, meridiemMode, ampm);
|
|
238
|
-
setValueAndGoToNextView(
|
|
238
|
+
setValueAndGoToNextView(adapter.setHours(valueOrReferenceDate, valueWithMeridiem), 'finish', 'hours');
|
|
239
239
|
},
|
|
240
240
|
items: (0, _MultiSectionDigitalClock2.getHourSectionOptions)({
|
|
241
241
|
now,
|
|
242
242
|
value,
|
|
243
243
|
ampm,
|
|
244
|
-
|
|
244
|
+
adapter,
|
|
245
245
|
isDisabled: hours => isTimeDisabled(hours, 'hours'),
|
|
246
246
|
timeStep: timeSteps.hours,
|
|
247
247
|
resolveAriaLabel: translations.hoursClockNumberText,
|
|
@@ -253,13 +253,13 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
253
253
|
{
|
|
254
254
|
return {
|
|
255
255
|
onChange: minutes => {
|
|
256
|
-
setValueAndGoToNextView(
|
|
256
|
+
setValueAndGoToNextView(adapter.setMinutes(valueOrReferenceDate, minutes), 'finish', 'minutes');
|
|
257
257
|
},
|
|
258
258
|
items: (0, _MultiSectionDigitalClock2.getTimeSectionOptions)({
|
|
259
|
-
value:
|
|
260
|
-
|
|
259
|
+
value: adapter.getMinutes(valueOrReferenceDate),
|
|
260
|
+
adapter,
|
|
261
261
|
isDisabled: minutes => isTimeDisabled(minutes, 'minutes'),
|
|
262
|
-
resolveLabel: minutes =>
|
|
262
|
+
resolveLabel: minutes => adapter.format(adapter.setMinutes(now, minutes), 'minutes'),
|
|
263
263
|
timeStep: timeSteps.minutes,
|
|
264
264
|
hasValue: !!value,
|
|
265
265
|
resolveAriaLabel: translations.minutesClockNumberText
|
|
@@ -270,13 +270,13 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
270
270
|
{
|
|
271
271
|
return {
|
|
272
272
|
onChange: seconds => {
|
|
273
|
-
setValueAndGoToNextView(
|
|
273
|
+
setValueAndGoToNextView(adapter.setSeconds(valueOrReferenceDate, seconds), 'finish', 'seconds');
|
|
274
274
|
},
|
|
275
275
|
items: (0, _MultiSectionDigitalClock2.getTimeSectionOptions)({
|
|
276
|
-
value:
|
|
277
|
-
|
|
276
|
+
value: adapter.getSeconds(valueOrReferenceDate),
|
|
277
|
+
adapter,
|
|
278
278
|
isDisabled: seconds => isTimeDisabled(seconds, 'seconds'),
|
|
279
|
-
resolveLabel: seconds =>
|
|
279
|
+
resolveLabel: seconds => adapter.format(adapter.setSeconds(now, seconds), 'seconds'),
|
|
280
280
|
timeStep: timeSteps.seconds,
|
|
281
281
|
hasValue: !!value,
|
|
282
282
|
resolveAriaLabel: translations.secondsClockNumberText
|
|
@@ -285,8 +285,8 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
285
285
|
}
|
|
286
286
|
case 'meridiem':
|
|
287
287
|
{
|
|
288
|
-
const amLabel = (0, _dateUtils.formatMeridiem)(
|
|
289
|
-
const pmLabel = (0, _dateUtils.formatMeridiem)(
|
|
288
|
+
const amLabel = (0, _dateUtils.formatMeridiem)(adapter, 'am');
|
|
289
|
+
const pmLabel = (0, _dateUtils.formatMeridiem)(adapter, 'pm');
|
|
290
290
|
return {
|
|
291
291
|
onChange: handleMeridiemChange,
|
|
292
292
|
items: [{
|
|
@@ -307,7 +307,7 @@ const MultiSectionDigitalClock = exports.MultiSectionDigitalClock = /*#__PURE__*
|
|
|
307
307
|
default:
|
|
308
308
|
throw new Error(`Unknown view: ${viewToBuild} found.`);
|
|
309
309
|
}
|
|
310
|
-
}, [now, value, ampm,
|
|
310
|
+
}, [now, value, ampm, adapter, timeSteps.hours, timeSteps.minutes, timeSteps.seconds, translations.hoursClockNumberText, translations.minutesClockNumberText, translations.secondsClockNumberText, meridiemMode, setValueAndGoToNextView, valueOrReferenceDate, isTimeDisabled, handleMeridiemChange]);
|
|
311
311
|
const viewsToRender = React.useMemo(() => {
|
|
312
312
|
if (!isRtl) {
|
|
313
313
|
return views;
|
|
@@ -358,7 +358,7 @@ process.env.NODE_ENV !== "production" ? MultiSectionDigitalClock.propTypes = {
|
|
|
358
358
|
// ----------------------------------------------------------------------
|
|
359
359
|
/**
|
|
360
360
|
* 12h/24h view for hour selection clock.
|
|
361
|
-
* @default
|
|
361
|
+
* @default adapter.is12HourCycleInCurrentLocale()
|
|
362
362
|
*/
|
|
363
363
|
ampm: _propTypes.default.bool,
|
|
364
364
|
/**
|
|
@@ -3,7 +3,7 @@ import { MultiSectionDigitalClockOption } from "./MultiSectionDigitalClock.types
|
|
|
3
3
|
interface GetHoursSectionOptionsParameters {
|
|
4
4
|
now: PickerValidDate;
|
|
5
5
|
value: PickerValidDate | null;
|
|
6
|
-
|
|
6
|
+
adapter: MuiPickersAdapter;
|
|
7
7
|
ampm: boolean;
|
|
8
8
|
isDisabled: (value: number) => boolean;
|
|
9
9
|
timeStep: number;
|
|
@@ -13,7 +13,7 @@ interface GetHoursSectionOptionsParameters {
|
|
|
13
13
|
export declare const getHourSectionOptions: ({
|
|
14
14
|
now,
|
|
15
15
|
value,
|
|
16
|
-
|
|
16
|
+
adapter,
|
|
17
17
|
ampm,
|
|
18
18
|
isDisabled,
|
|
19
19
|
resolveAriaLabel,
|
|
@@ -22,7 +22,7 @@ export declare const getHourSectionOptions: ({
|
|
|
22
22
|
}: GetHoursSectionOptionsParameters) => MultiSectionDigitalClockOption<number>[];
|
|
23
23
|
interface GetTimeSectionOptionsParameters {
|
|
24
24
|
value: number | null;
|
|
25
|
-
|
|
25
|
+
adapter: MuiPickersAdapter;
|
|
26
26
|
isDisabled: (value: number) => boolean;
|
|
27
27
|
timeStep: number;
|
|
28
28
|
resolveLabel: (value: number) => string;
|
|
@@ -31,7 +31,7 @@ interface GetTimeSectionOptionsParameters {
|
|
|
31
31
|
}
|
|
32
32
|
export declare const getTimeSectionOptions: ({
|
|
33
33
|
value,
|
|
34
|
-
|
|
34
|
+
adapter,
|
|
35
35
|
isDisabled,
|
|
36
36
|
timeStep,
|
|
37
37
|
resolveLabel,
|
|
@@ -7,14 +7,14 @@ exports.getTimeSectionOptions = exports.getHourSectionOptions = void 0;
|
|
|
7
7
|
const getHourSectionOptions = ({
|
|
8
8
|
now,
|
|
9
9
|
value,
|
|
10
|
-
|
|
10
|
+
adapter,
|
|
11
11
|
ampm,
|
|
12
12
|
isDisabled,
|
|
13
13
|
resolveAriaLabel,
|
|
14
14
|
timeStep,
|
|
15
15
|
valueOrReferenceDate
|
|
16
16
|
}) => {
|
|
17
|
-
const currentHours = value ?
|
|
17
|
+
const currentHours = value ? adapter.getHours(value) : null;
|
|
18
18
|
const result = [];
|
|
19
19
|
const isSelected = (hour, overriddenCurrentHours) => {
|
|
20
20
|
const resolvedCurrentHours = overriddenCurrentHours ?? currentHours;
|
|
@@ -30,13 +30,13 @@ const getHourSectionOptions = ({
|
|
|
30
30
|
return resolvedCurrentHours === hour;
|
|
31
31
|
};
|
|
32
32
|
const isFocused = hour => {
|
|
33
|
-
return isSelected(hour,
|
|
33
|
+
return isSelected(hour, adapter.getHours(valueOrReferenceDate));
|
|
34
34
|
};
|
|
35
35
|
const endHour = ampm ? 11 : 23;
|
|
36
36
|
for (let hour = 0; hour <= endHour; hour += timeStep) {
|
|
37
|
-
let label =
|
|
37
|
+
let label = adapter.format(adapter.setHours(now, hour), ampm ? 'hours12h' : 'hours24h');
|
|
38
38
|
const ariaLabel = resolveAriaLabel(parseInt(label, 10).toString());
|
|
39
|
-
label =
|
|
39
|
+
label = adapter.formatNumber(label);
|
|
40
40
|
result.push({
|
|
41
41
|
value: hour,
|
|
42
42
|
label,
|
|
@@ -51,7 +51,7 @@ const getHourSectionOptions = ({
|
|
|
51
51
|
exports.getHourSectionOptions = getHourSectionOptions;
|
|
52
52
|
const getTimeSectionOptions = ({
|
|
53
53
|
value,
|
|
54
|
-
|
|
54
|
+
adapter,
|
|
55
55
|
isDisabled,
|
|
56
56
|
timeStep,
|
|
57
57
|
resolveLabel,
|
|
@@ -73,7 +73,7 @@ const getTimeSectionOptions = ({
|
|
|
73
73
|
const timeValue = timeStep * index;
|
|
74
74
|
return {
|
|
75
75
|
value: timeValue,
|
|
76
|
-
label:
|
|
76
|
+
label: adapter.formatNumber(resolveLabel(timeValue)),
|
|
77
77
|
isDisabled,
|
|
78
78
|
isSelected,
|
|
79
79
|
isFocused,
|
package/PickerDay2/PickerDay2.js
CHANGED
|
@@ -18,7 +18,7 @@ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"
|
|
|
18
18
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
19
19
|
var _dimensions = require("../internals/constants/dimensions");
|
|
20
20
|
var _pickerDay2Classes = require("./pickerDay2Classes");
|
|
21
|
-
var
|
|
21
|
+
var _usePickerAdapter = require("../hooks/usePickerAdapter");
|
|
22
22
|
var _usePickerDayOwnerState = require("../PickersDay/usePickerDayOwnerState");
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
24
|
const _excluded = ["autoFocus", "className", "classes", "hidden", "isAnimating", "onClick", "onDaySelect", "onFocus", "onBlur", "onKeyDown", "onMouseDown", "onMouseEnter", "children", "isFirstVisibleCell", "isLastVisibleCell", "day", "selected", "disabled", "today", "outsideCurrentMonth", "disableMargin", "disableHighlightToday", "showDaysOutsideCurrentMonth", "isVisuallySelected"];
|
|
@@ -128,7 +128,7 @@ const PickerDay2Raw = /*#__PURE__*/React.forwardRef(function PickerDay2(inProps,
|
|
|
128
128
|
props: inProps,
|
|
129
129
|
name: 'MuiPickerDay2'
|
|
130
130
|
});
|
|
131
|
-
const
|
|
131
|
+
const adapter = (0, _usePickerAdapter.usePickerAdapter)();
|
|
132
132
|
const {
|
|
133
133
|
autoFocus = false,
|
|
134
134
|
className,
|
|
@@ -215,7 +215,7 @@ const PickerDay2Raw = /*#__PURE__*/React.forwardRef(function PickerDay2(inProps,
|
|
|
215
215
|
}, other, {
|
|
216
216
|
ownerState: ownerState,
|
|
217
217
|
className: (0, _clsx.default)(classes.root, className),
|
|
218
|
-
children: children ?? (ownerState.isDayFillerCell ? null :
|
|
218
|
+
children: children ?? (ownerState.isDayFillerCell ? null : adapter.format(day, 'dayOfMonth'))
|
|
219
219
|
}));
|
|
220
220
|
});
|
|
221
221
|
if (process.env.NODE_ENV !== "production") PickerDay2Raw.displayName = "PickerDay2Raw";
|
|
@@ -6,8 +6,8 @@ export interface PickersActionBarProps extends DialogActionsProps {
|
|
|
6
6
|
* Ordered array of actions to display.
|
|
7
7
|
* If empty, does not display that action bar.
|
|
8
8
|
* @default
|
|
9
|
-
* - `[]` for
|
|
10
|
-
* - `['cancel', '
|
|
9
|
+
* - `[]` for Pickers with one selection step which `closeOnSelect`.
|
|
10
|
+
* - `['cancel', 'nextOrAccept']` for all other Pickers.
|
|
11
11
|
*/
|
|
12
12
|
actions?: PickersActionBarAction[];
|
|
13
13
|
}
|
|
@@ -105,8 +105,8 @@ process.env.NODE_ENV !== "production" ? PickersActionBarComponent.propTypes = {
|
|
|
105
105
|
* Ordered array of actions to display.
|
|
106
106
|
* If empty, does not display that action bar.
|
|
107
107
|
* @default
|
|
108
|
-
* - `[]` for
|
|
109
|
-
* - `['cancel', '
|
|
108
|
+
* - `[]` for Pickers with one selection step which `closeOnSelect`.
|
|
109
|
+
* - `['cancel', 'nextOrAccept']` for all other Pickers.
|
|
110
110
|
*/
|
|
111
111
|
actions: _propTypes.default.arrayOf(_propTypes.default.oneOf(['accept', 'cancel', 'clear', 'next', 'nextOrAccept', 'today']).isRequired),
|
|
112
112
|
/**
|
|
@@ -17,8 +17,7 @@ var _styles = require("@mui/material/styles");
|
|
|
17
17
|
var _useSlotProps2 = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
18
18
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
19
19
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
20
|
-
var
|
|
21
|
-
var _useUtils = require("../internals/hooks/useUtils");
|
|
20
|
+
var _hooks = require("../hooks");
|
|
22
21
|
var _PickersFadeTransitionGroup = require("../DateCalendar/PickersFadeTransitionGroup");
|
|
23
22
|
var _icons = require("../icons");
|
|
24
23
|
var _PickersArrowSwitcher = require("../internals/components/PickersArrowSwitcher");
|
|
@@ -110,8 +109,8 @@ const PickersCalendarHeaderSwitchViewIcon = (0, _styles.styled)(_icons.ArrowDrop
|
|
|
110
109
|
* - [PickersCalendarHeader API](https://mui.com/x/api/date-pickers/pickers-calendar-header/)
|
|
111
110
|
*/
|
|
112
111
|
const PickersCalendarHeader = exports.PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCalendarHeader(inProps, ref) {
|
|
113
|
-
const translations = (0,
|
|
114
|
-
const
|
|
112
|
+
const translations = (0, _hooks.usePickerTranslations)();
|
|
113
|
+
const adapter = (0, _hooks.usePickerAdapter)();
|
|
115
114
|
const props = (0, _styles.useThemeProps)({
|
|
116
115
|
props: inProps,
|
|
117
116
|
name: 'MuiPickersCalendarHeader'
|
|
@@ -134,7 +133,7 @@ const PickersCalendarHeader = exports.PickersCalendarHeader = /*#__PURE__*/React
|
|
|
134
133
|
className,
|
|
135
134
|
classes: classesProp,
|
|
136
135
|
timezone,
|
|
137
|
-
format = `${
|
|
136
|
+
format = `${adapter.formats.month} ${adapter.formats.year}`
|
|
138
137
|
} = props,
|
|
139
138
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
140
139
|
const {
|
|
@@ -163,8 +162,8 @@ const PickersCalendarHeader = exports.PickersCalendarHeader = /*#__PURE__*/React
|
|
|
163
162
|
className: classes.switchViewIcon
|
|
164
163
|
}),
|
|
165
164
|
switchViewIconProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded2);
|
|
166
|
-
const selectNextMonth = () => onMonthChange(
|
|
167
|
-
const selectPreviousMonth = () => onMonthChange(
|
|
165
|
+
const selectNextMonth = () => onMonthChange(adapter.addMonths(month, 1));
|
|
166
|
+
const selectPreviousMonth = () => onMonthChange(adapter.addMonths(month, -1));
|
|
168
167
|
const isNextMonthDisabled = (0, _dateHelpersHooks.useNextMonthDisabled)(month, {
|
|
169
168
|
disableFuture,
|
|
170
169
|
maxDate,
|
|
@@ -192,7 +191,7 @@ const PickersCalendarHeader = exports.PickersCalendarHeader = /*#__PURE__*/React
|
|
|
192
191
|
if (views.length === 1 && views[0] === 'year') {
|
|
193
192
|
return null;
|
|
194
193
|
}
|
|
195
|
-
const label =
|
|
194
|
+
const label = adapter.formatByString(month, format);
|
|
196
195
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PickersCalendarHeaderRoot, (0, _extends2.default)({}, other, {
|
|
197
196
|
ownerState: ownerState,
|
|
198
197
|
className: (0, _clsx.default)(classes.root, className),
|
package/PickersDay/PickersDay.js
CHANGED
|
@@ -17,7 +17,7 @@ var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedE
|
|
|
17
17
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
18
18
|
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
19
19
|
var _styles = require("@mui/material/styles");
|
|
20
|
-
var
|
|
20
|
+
var _usePickerAdapter = require("../hooks/usePickerAdapter");
|
|
21
21
|
var _dimensions = require("../internals/constants/dimensions");
|
|
22
22
|
var _pickersDayClasses = require("./pickersDayClasses");
|
|
23
23
|
var _usePickerDayOwnerState = require("./usePickerDayOwnerState");
|
|
@@ -171,7 +171,7 @@ const PickersDayRaw = /*#__PURE__*/React.forwardRef(function PickersDay(inProps,
|
|
|
171
171
|
showDaysOutsideCurrentMonth
|
|
172
172
|
});
|
|
173
173
|
const classes = useUtilityClasses(classesProp, ownerState);
|
|
174
|
-
const
|
|
174
|
+
const adapter = (0, _usePickerAdapter.usePickerAdapter)();
|
|
175
175
|
const ref = React.useRef(null);
|
|
176
176
|
const handleRef = (0, _useForkRef.default)(ref, forwardedRef);
|
|
177
177
|
|
|
@@ -224,7 +224,7 @@ const PickersDayRaw = /*#__PURE__*/React.forwardRef(function PickersDay(inProps,
|
|
|
224
224
|
onMouseDown: handleMouseDown
|
|
225
225
|
}, other, {
|
|
226
226
|
ownerState: ownerState,
|
|
227
|
-
children: children ??
|
|
227
|
+
children: children ?? adapter.format(day, 'dayOfMonth')
|
|
228
228
|
}));
|
|
229
229
|
});
|
|
230
230
|
if (process.env.NODE_ENV !== "production") PickersDayRaw.displayName = "PickersDayRaw";
|
|
@@ -9,7 +9,7 @@ exports.usePickerDayOwnerState = usePickerDayOwnerState;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
|
|
12
|
-
var
|
|
12
|
+
var _usePickerAdapter = require("../hooks/usePickerAdapter");
|
|
13
13
|
function usePickerDayOwnerState(parameters) {
|
|
14
14
|
const {
|
|
15
15
|
disabled,
|
|
@@ -21,7 +21,7 @@ function usePickerDayOwnerState(parameters) {
|
|
|
21
21
|
disableHighlightToday,
|
|
22
22
|
showDaysOutsideCurrentMonth
|
|
23
23
|
} = parameters;
|
|
24
|
-
const
|
|
24
|
+
const adapter = (0, _usePickerAdapter.usePickerAdapter)();
|
|
25
25
|
const {
|
|
26
26
|
ownerState: pickerOwnerState
|
|
27
27
|
} = (0, _usePickerPrivateContext.usePickerPrivateContext)();
|
|
@@ -31,10 +31,10 @@ function usePickerDayOwnerState(parameters) {
|
|
|
31
31
|
isDayDisabled: disabled ?? false,
|
|
32
32
|
isDayCurrent: today ?? false,
|
|
33
33
|
isDayOutsideMonth: outsideCurrentMonth ?? false,
|
|
34
|
-
isDayStartOfWeek:
|
|
35
|
-
isDayEndOfWeek:
|
|
34
|
+
isDayStartOfWeek: adapter.isSameDay(day, adapter.startOfWeek(day)),
|
|
35
|
+
isDayEndOfWeek: adapter.isSameDay(day, adapter.endOfWeek(day)),
|
|
36
36
|
disableMargin: disableMargin ?? false,
|
|
37
37
|
disableHighlightToday: disableHighlightToday ?? false,
|
|
38
38
|
showDaysOutsideCurrentMonth: showDaysOutsideCurrentMonth ?? false
|
|
39
|
-
}), [
|
|
39
|
+
}), [adapter, pickerOwnerState, day, selected, disabled, today, outsideCurrentMonth, disableMargin, disableHighlightToday, showDaysOutsideCurrentMonth]);
|
|
40
40
|
}
|
|
@@ -114,7 +114,7 @@ StaticDateTimePicker.propTypes = {
|
|
|
114
114
|
// ----------------------------------------------------------------------
|
|
115
115
|
/**
|
|
116
116
|
* 12h/24h view for hour selection clock.
|
|
117
|
-
* @default
|
|
117
|
+
* @default adapter.is12HourCycleInCurrentLocale()
|
|
118
118
|
*/
|
|
119
119
|
ampm: _propTypes.default.bool,
|
|
120
120
|
/**
|
|
@@ -67,7 +67,7 @@ StaticTimePicker.propTypes = {
|
|
|
67
67
|
// ----------------------------------------------------------------------
|
|
68
68
|
/**
|
|
69
69
|
* 12h/24h view for hour selection clock.
|
|
70
|
-
* @default
|
|
70
|
+
* @default adapter.is12HourCycleInCurrentLocale()
|
|
71
71
|
*/
|
|
72
72
|
ampm: _propTypes.default.bool,
|
|
73
73
|
/**
|
package/TimeClock/Clock.js
CHANGED
|
@@ -15,8 +15,7 @@ var _styles = require("@mui/material/styles");
|
|
|
15
15
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
16
16
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
17
17
|
var _ClockPointer = require("./ClockPointer");
|
|
18
|
-
var
|
|
19
|
-
var _useUtils = require("../internals/hooks/useUtils");
|
|
18
|
+
var _hooks = require("../hooks");
|
|
20
19
|
var _shared = require("./shared");
|
|
21
20
|
var _clockClasses = require("./clockClasses");
|
|
22
21
|
var _dateUtils = require("../internals/utils/date-utils");
|
|
@@ -184,8 +183,8 @@ function Clock(inProps) {
|
|
|
184
183
|
className,
|
|
185
184
|
classes: classesProp
|
|
186
185
|
} = props;
|
|
187
|
-
const
|
|
188
|
-
const translations = (0,
|
|
186
|
+
const adapter = (0, _hooks.usePickerAdapter)();
|
|
187
|
+
const translations = (0, _hooks.usePickerTranslations)();
|
|
189
188
|
const {
|
|
190
189
|
ownerState: pickerOwnerState
|
|
191
190
|
} = (0, _usePickerPrivateContext.usePickerPrivateContext)();
|
|
@@ -318,7 +317,7 @@ function Clock(inProps) {
|
|
|
318
317
|
})]
|
|
319
318
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ClockWrapper, {
|
|
320
319
|
"aria-activedescendant": selectedId,
|
|
321
|
-
"aria-label": translations.clockLabelText(type, value == null ? null :
|
|
320
|
+
"aria-label": translations.clockLabelText(type, value == null ? null : adapter.format(value, ampm ? 'fullTime12h' : 'fullTime24h')),
|
|
322
321
|
ref: listboxRef,
|
|
323
322
|
role: "listbox",
|
|
324
323
|
onKeyDown: handleKeyDown,
|
|
@@ -332,22 +331,22 @@ function Clock(inProps) {
|
|
|
332
331
|
disabled: disabled || meridiemMode === null,
|
|
333
332
|
ownerState: ownerState,
|
|
334
333
|
className: classes.amButton,
|
|
335
|
-
title: (0, _dateUtils.formatMeridiem)(
|
|
334
|
+
title: (0, _dateUtils.formatMeridiem)(adapter, 'am'),
|
|
336
335
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ClockMeridiemText, {
|
|
337
336
|
variant: "caption",
|
|
338
337
|
className: classes.meridiemText,
|
|
339
|
-
children: (0, _dateUtils.formatMeridiem)(
|
|
338
|
+
children: (0, _dateUtils.formatMeridiem)(adapter, 'am')
|
|
340
339
|
})
|
|
341
340
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ClockPmButton, {
|
|
342
341
|
disabled: disabled || meridiemMode === null,
|
|
343
342
|
onClick: readOnly ? undefined : () => handleMeridiemChange('pm'),
|
|
344
343
|
ownerState: ownerState,
|
|
345
344
|
className: classes.pmButton,
|
|
346
|
-
title: (0, _dateUtils.formatMeridiem)(
|
|
345
|
+
title: (0, _dateUtils.formatMeridiem)(adapter, 'pm'),
|
|
347
346
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ClockMeridiemText, {
|
|
348
347
|
variant: "caption",
|
|
349
348
|
className: classes.meridiemText,
|
|
350
|
-
children: (0, _dateUtils.formatMeridiem)(
|
|
349
|
+
children: (0, _dateUtils.formatMeridiem)(adapter, 'pm')
|
|
351
350
|
})
|
|
352
351
|
})]
|
|
353
352
|
})]
|
|
@@ -12,7 +12,7 @@ interface GetHourNumbersOptions {
|
|
|
12
12
|
* Should only be `undefined` on the server
|
|
13
13
|
*/
|
|
14
14
|
selectedId: string | undefined;
|
|
15
|
-
|
|
15
|
+
adapter: MuiPickersAdapter;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* @ignore - internal component.
|
|
@@ -23,10 +23,10 @@ export declare const getHourNumbers: ({
|
|
|
23
23
|
getClockNumberText,
|
|
24
24
|
isDisabled,
|
|
25
25
|
selectedId,
|
|
26
|
-
|
|
26
|
+
adapter
|
|
27
27
|
}: GetHourNumbersOptions) => React.JSX.Element[];
|
|
28
28
|
export declare const getMinutesNumbers: ({
|
|
29
|
-
|
|
29
|
+
adapter,
|
|
30
30
|
value,
|
|
31
31
|
isDisabled,
|
|
32
32
|
getClockNumberText,
|
|
@@ -17,9 +17,9 @@ const getHourNumbers = ({
|
|
|
17
17
|
getClockNumberText,
|
|
18
18
|
isDisabled,
|
|
19
19
|
selectedId,
|
|
20
|
-
|
|
20
|
+
adapter
|
|
21
21
|
}) => {
|
|
22
|
-
const currentHours = value ?
|
|
22
|
+
const currentHours = value ? adapter.getHours(value) : null;
|
|
23
23
|
const hourNumbers = [];
|
|
24
24
|
const startHour = ampm ? 1 : 0;
|
|
25
25
|
const endHour = ampm ? 12 : 23;
|
|
@@ -41,7 +41,7 @@ const getHourNumbers = ({
|
|
|
41
41
|
label = '00';
|
|
42
42
|
}
|
|
43
43
|
const inner = !ampm && (hour === 0 || hour > 12);
|
|
44
|
-
label =
|
|
44
|
+
label = adapter.formatNumber(label);
|
|
45
45
|
const selected = isSelected(hour);
|
|
46
46
|
hourNumbers.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_ClockNumber.ClockNumber, {
|
|
47
47
|
id: selected ? selectedId : undefined,
|
|
@@ -57,13 +57,13 @@ const getHourNumbers = ({
|
|
|
57
57
|
};
|
|
58
58
|
exports.getHourNumbers = getHourNumbers;
|
|
59
59
|
const getMinutesNumbers = ({
|
|
60
|
-
|
|
60
|
+
adapter,
|
|
61
61
|
value,
|
|
62
62
|
isDisabled,
|
|
63
63
|
getClockNumberText,
|
|
64
64
|
selectedId
|
|
65
65
|
}) => {
|
|
66
|
-
const f =
|
|
66
|
+
const f = adapter.formatNumber;
|
|
67
67
|
return [[5, f('05')], [10, f('10')], [15, f('15')], [20, f('20')], [25, f('25')], [30, f('30')], [35, f('35')], [40, f('40')], [45, f('45')], [50, f('50')], [55, f('55')], [0, f('00')]].map(([numberValue, label], index) => {
|
|
68
68
|
const selected = numberValue === value;
|
|
69
69
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClockNumber.ClockNumber, {
|