@mui/x-date-pickers 7.18.0 → 7.20.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/AdapterDateFnsBase/AdapterDateFnsBase.js +1 -0
- package/AdapterMoment/AdapterMoment.js +1 -0
- package/CHANGELOG.md +213 -11
- package/DateCalendar/DateCalendar.js +1 -1
- package/DateCalendar/DateCalendar.types.d.ts +1 -1
- package/DateField/DateField.types.d.ts +2 -7
- package/DateField/index.d.ts +1 -1
- package/DateField/useDateField.d.ts +1 -1
- package/DatePicker/DatePicker.js +1 -1
- package/DatePicker/DatePicker.types.d.ts +8 -1
- package/DatePicker/index.d.ts +1 -1
- package/DateTimeField/DateTimeField.types.d.ts +2 -7
- package/DateTimeField/index.d.ts +1 -1
- package/DateTimeField/useDateTimeField.d.ts +1 -1
- package/DateTimePicker/DateTimePicker.js +1 -1
- package/DateTimePicker/DateTimePicker.types.d.ts +9 -1
- package/DateTimePicker/index.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -1
- package/DigitalClock/DigitalClock.js +39 -0
- package/MobileDatePicker/MobileDatePicker.js +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +38 -1
- package/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
- package/PickersLayout/PickersLayout.d.ts +2 -2
- package/PickersLayout/PickersLayout.js +1 -1
- package/PickersSectionList/PickersSectionList.d.ts +4 -4
- package/PickersTextField/PickersInputBase/PickersInputBase.d.ts +2 -2
- package/StaticDatePicker/StaticDatePicker.js +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/TimeClock/Clock.js +9 -1
- package/TimeClock/ClockNumber.js +1 -1
- package/TimeClock/ClockPointer.js +1 -1
- package/TimeField/TimeField.types.d.ts +2 -7
- package/TimeField/index.d.ts +1 -1
- package/TimeField/useTimeField.d.ts +1 -1
- package/TimePicker/TimePicker.types.d.ts +9 -1
- package/TimePicker/index.d.ts +1 -1
- package/YearCalendar/YearCalendar.js +1 -1
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +3 -1
- package/hooks/useParsedFormat.d.ts +15 -0
- package/hooks/useParsedFormat.js +43 -0
- package/hooks/usePickersContext.d.ts +4 -0
- package/hooks/usePickersContext.js +15 -0
- package/index.js +1 -1
- package/internals/components/PickerViewRoot/PickerViewRoot.d.ts +1 -1
- package/internals/components/PickersProvider.d.ts +34 -0
- package/internals/components/PickersProvider.js +26 -0
- package/internals/components/PickersToolbarButton.js +1 -1
- package/internals/components/PickersToolbarText.js +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +7 -4
- package/internals/hooks/useField/buildSectionsFromFormat.d.ts +1 -2
- package/internals/hooks/useField/buildSectionsFromFormat.js +4 -5
- package/internals/hooks/useField/useField.utils.d.ts +3 -3
- package/internals/hooks/useField/useField.utils.js +13 -13
- package/internals/hooks/useField/useFieldCharacterEditing.js +2 -2
- package/internals/hooks/useField/useFieldState.js +3 -5
- package/internals/hooks/useMobilePicker/useMobilePicker.js +7 -4
- package/internals/hooks/usePicker/usePicker.js +3 -1
- package/internals/hooks/usePicker/usePickerValue.js +7 -2
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +2 -0
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/internals/utils/utils.d.ts +7 -0
- package/internals/utils/utils.js +11 -0
- package/locales/bgBG.d.ts +80 -0
- package/locales/bgBG.js +73 -0
- package/locales/csCZ.js +16 -20
- package/locales/hrHR.d.ts +80 -0
- package/locales/hrHR.js +90 -0
- package/locales/index.d.ts +3 -0
- package/locales/index.js +3 -0
- package/locales/ptBR.js +3 -4
- package/locales/ptPT.d.ts +80 -0
- package/locales/ptPT.js +73 -0
- package/models/pickers.d.ts +1 -1
- package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +1 -0
- package/modern/AdapterMoment/AdapterMoment.js +1 -0
- package/modern/DateCalendar/DateCalendar.js +1 -1
- package/modern/DatePicker/DatePicker.js +1 -1
- package/modern/DateTimePicker/DateTimePicker.js +1 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -1
- package/modern/DigitalClock/DigitalClock.js +39 -0
- package/modern/MobileDatePicker/MobileDatePicker.js +1 -1
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +38 -1
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
- package/modern/PickersLayout/PickersLayout.js +1 -1
- package/modern/StaticDatePicker/StaticDatePicker.js +1 -1
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/modern/TimeClock/Clock.js +9 -1
- package/modern/TimeClock/ClockNumber.js +1 -1
- package/modern/TimeClock/ClockPointer.js +1 -1
- package/modern/YearCalendar/YearCalendar.js +1 -1
- package/modern/hooks/index.js +3 -1
- package/modern/hooks/useParsedFormat.js +43 -0
- package/modern/hooks/usePickersContext.js +15 -0
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersProvider.js +26 -0
- package/modern/internals/components/PickersToolbarButton.js +1 -1
- package/modern/internals/components/PickersToolbarText.js +1 -1
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +7 -4
- package/modern/internals/hooks/useField/buildSectionsFromFormat.js +4 -5
- package/modern/internals/hooks/useField/useField.utils.js +13 -13
- package/modern/internals/hooks/useField/useFieldCharacterEditing.js +2 -2
- package/modern/internals/hooks/useField/useFieldState.js +3 -5
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +7 -4
- package/modern/internals/hooks/usePicker/usePicker.js +3 -1
- package/modern/internals/hooks/usePicker/usePickerValue.js +7 -2
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/utils.js +11 -0
- package/modern/locales/bgBG.js +73 -0
- package/modern/locales/csCZ.js +16 -20
- package/modern/locales/hrHR.js +90 -0
- package/modern/locales/index.js +3 -0
- package/modern/locales/ptBR.js +3 -4
- package/modern/locales/ptPT.js +73 -0
- package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +1 -0
- package/node/AdapterMoment/AdapterMoment.js +1 -0
- package/node/DateCalendar/DateCalendar.js +1 -1
- package/node/DatePicker/DatePicker.js +1 -1
- package/node/DateTimePicker/DateTimePicker.js +1 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -1
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -1
- package/node/DigitalClock/DigitalClock.js +39 -0
- package/node/MobileDatePicker/MobileDatePicker.js +1 -1
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +38 -1
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
- package/node/PickersLayout/PickersLayout.js +1 -1
- package/node/StaticDatePicker/StaticDatePicker.js +1 -1
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +1 -1
- package/node/TimeClock/Clock.js +9 -1
- package/node/TimeClock/ClockNumber.js +1 -1
- package/node/TimeClock/ClockPointer.js +1 -1
- package/node/YearCalendar/YearCalendar.js +1 -1
- package/node/hooks/index.js +15 -1
- package/node/hooks/useParsedFormat.js +50 -0
- package/node/hooks/usePickersContext.js +21 -0
- package/node/index.js +1 -1
- package/node/internals/components/PickersProvider.js +34 -0
- package/node/internals/components/PickersToolbarButton.js +1 -1
- package/node/internals/components/PickersToolbarText.js +1 -1
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -3
- package/node/internals/hooks/useField/buildSectionsFromFormat.js +4 -5
- package/node/internals/hooks/useField/useField.utils.js +13 -13
- package/node/internals/hooks/useField/useFieldCharacterEditing.js +2 -2
- package/node/internals/hooks/useField/useFieldState.js +3 -5
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +5 -3
- package/node/internals/hooks/usePicker/usePicker.js +3 -1
- package/node/internals/hooks/usePicker/usePickerValue.js +7 -1
- package/node/internals/index.js +7 -0
- package/node/internals/utils/utils.js +13 -1
- package/node/locales/bgBG.js +79 -0
- package/node/locales/csCZ.js +16 -20
- package/node/locales/hrHR.js +96 -0
- package/node/locales/index.js +33 -0
- package/node/locales/ptBR.js +3 -4
- package/node/locales/ptPT.js +79 -0
- package/package.json +4 -4
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.PickersContext = void 0;
|
|
8
|
+
exports.PickersProvider = PickersProvider;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _LocalizationProvider = require("../../LocalizationProvider");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
const PickersContext = exports.PickersContext = /*#__PURE__*/React.createContext(null);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Provides the context for the various parts of a picker component:
|
|
16
|
+
* - contextValue: the context for the picker sub-components.
|
|
17
|
+
* - localizationProvider: the translations passed through the props and through a parent LocalizationProvider.
|
|
18
|
+
*
|
|
19
|
+
* @ignore - do not document.
|
|
20
|
+
*/
|
|
21
|
+
function PickersProvider(props) {
|
|
22
|
+
const {
|
|
23
|
+
contextValue,
|
|
24
|
+
localeText,
|
|
25
|
+
children
|
|
26
|
+
} = props;
|
|
27
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersContext.Provider, {
|
|
28
|
+
value: contextValue,
|
|
29
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LocalizationProvider.LocalizationProvider, {
|
|
30
|
+
localeText: localeText,
|
|
31
|
+
children: children
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -54,7 +54,7 @@ const PickersToolbarButton = exports.PickersToolbarButton = /*#__PURE__*/React.f
|
|
|
54
54
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersToolbarButtonRoot, (0, _extends2.default)({
|
|
55
55
|
variant: "text",
|
|
56
56
|
ref: ref,
|
|
57
|
-
className: (0, _clsx.default)(
|
|
57
|
+
className: (0, _clsx.default)(classes.root, className)
|
|
58
58
|
}, width ? {
|
|
59
59
|
sx: {
|
|
60
60
|
width
|
|
@@ -54,7 +54,7 @@ const PickersToolbarText = exports.PickersToolbarText = /*#__PURE__*/React.forwa
|
|
|
54
54
|
const classes = useUtilityClasses(props);
|
|
55
55
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickersToolbarTextRoot, (0, _extends2.default)({
|
|
56
56
|
ref: ref,
|
|
57
|
-
className: (0, _clsx.default)(
|
|
57
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
58
58
|
component: "span"
|
|
59
59
|
}, other, {
|
|
60
60
|
children: value
|
|
@@ -16,8 +16,8 @@ var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
|
16
16
|
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
17
17
|
var _PickersPopper = require("../../components/PickersPopper");
|
|
18
18
|
var _usePicker = require("../usePicker");
|
|
19
|
-
var _LocalizationProvider = require("../../../LocalizationProvider");
|
|
20
19
|
var _PickersLayout = require("../../../PickersLayout");
|
|
20
|
+
var _PickersProvider = require("../../components/PickersProvider");
|
|
21
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
22
|
const _excluded = ["props", "getOpenDialogAriaText"],
|
|
23
23
|
_excluded2 = ["ownerState"],
|
|
@@ -65,7 +65,8 @@ const useDesktopPicker = _ref => {
|
|
|
65
65
|
layoutProps,
|
|
66
66
|
renderCurrentView,
|
|
67
67
|
shouldRestoreFocus,
|
|
68
|
-
fieldProps: pickerFieldProps
|
|
68
|
+
fieldProps: pickerFieldProps,
|
|
69
|
+
contextValue
|
|
69
70
|
} = (0, _usePicker.usePicker)((0, _extends2.default)({}, pickerParams, {
|
|
70
71
|
props,
|
|
71
72
|
fieldRef,
|
|
@@ -169,7 +170,8 @@ const useDesktopPicker = _ref => {
|
|
|
169
170
|
}, innerSlotProps?.popper)
|
|
170
171
|
});
|
|
171
172
|
const handleFieldRef = (0, _useForkRef.default)(fieldRef, fieldProps.unstableFieldRef);
|
|
172
|
-
const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
173
|
+
const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PickersProvider.PickersProvider, {
|
|
174
|
+
contextValue: contextValue,
|
|
173
175
|
localeText: localeText,
|
|
174
176
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Field, (0, _extends2.default)({}, fieldProps, {
|
|
175
177
|
slots: slotsForField,
|
|
@@ -45,12 +45,12 @@ const getEscapedPartsFromFormat = ({
|
|
|
45
45
|
}
|
|
46
46
|
return escapedParts;
|
|
47
47
|
};
|
|
48
|
-
const getSectionPlaceholder = (utils,
|
|
48
|
+
const getSectionPlaceholder = (utils, localeText, sectionConfig, sectionFormat) => {
|
|
49
49
|
switch (sectionConfig.type) {
|
|
50
50
|
case 'year':
|
|
51
51
|
{
|
|
52
52
|
return localeText.fieldYearPlaceholder({
|
|
53
|
-
digitAmount: utils.formatByString(utils.date(undefined,
|
|
53
|
+
digitAmount: utils.formatByString(utils.date(undefined, 'default'), sectionFormat).length,
|
|
54
54
|
format: sectionFormat
|
|
55
55
|
});
|
|
56
56
|
}
|
|
@@ -106,7 +106,6 @@ const getSectionPlaceholder = (utils, timezone, localeText, sectionConfig, secti
|
|
|
106
106
|
};
|
|
107
107
|
const createSection = ({
|
|
108
108
|
utils,
|
|
109
|
-
timezone,
|
|
110
109
|
date,
|
|
111
110
|
shouldRespectLeadingZeros,
|
|
112
111
|
localeText,
|
|
@@ -119,7 +118,7 @@ const createSection = ({
|
|
|
119
118
|
throw new Error('MUI X: Should not call `commitToken` with an empty token');
|
|
120
119
|
}
|
|
121
120
|
const sectionConfig = (0, _useField.getDateSectionConfigFromFormatToken)(utils, token);
|
|
122
|
-
const hasLeadingZerosInFormat = (0, _useField.doesSectionFormatHaveLeadingZeros)(utils,
|
|
121
|
+
const hasLeadingZerosInFormat = (0, _useField.doesSectionFormatHaveLeadingZeros)(utils, sectionConfig.contentType, sectionConfig.type, token);
|
|
123
122
|
const hasLeadingZerosInInput = shouldRespectLeadingZeros ? hasLeadingZerosInFormat : sectionConfig.contentType === 'digit';
|
|
124
123
|
const isValidDate = date != null && utils.isValid(date);
|
|
125
124
|
let sectionValue = isValidDate ? utils.formatByString(date, token) : '';
|
|
@@ -141,7 +140,7 @@ const createSection = ({
|
|
|
141
140
|
format: token,
|
|
142
141
|
maxLength,
|
|
143
142
|
value: sectionValue,
|
|
144
|
-
placeholder: getSectionPlaceholder(utils,
|
|
143
|
+
placeholder: getSectionPlaceholder(utils, localeText, sectionConfig, token),
|
|
145
144
|
hasLeadingZerosInFormat,
|
|
146
145
|
hasLeadingZerosInInput,
|
|
147
146
|
startSeparator,
|
|
@@ -38,9 +38,9 @@ const getDeltaFromKeyCode = keyCode => {
|
|
|
38
38
|
return 0;
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
const getDaysInWeekStr = (utils,
|
|
41
|
+
const getDaysInWeekStr = (utils, format) => {
|
|
42
42
|
const elements = [];
|
|
43
|
-
const now = utils.date(undefined,
|
|
43
|
+
const now = utils.date(undefined, 'default');
|
|
44
44
|
const startDate = utils.startOfWeek(now);
|
|
45
45
|
const endDate = utils.endOfWeek(now);
|
|
46
46
|
let current = startDate;
|
|
@@ -59,7 +59,7 @@ const getLetterEditingOptions = (utils, timezone, sectionType, format) => {
|
|
|
59
59
|
}
|
|
60
60
|
case 'weekDay':
|
|
61
61
|
{
|
|
62
|
-
return getDaysInWeekStr(utils,
|
|
62
|
+
return getDaysInWeekStr(utils, format);
|
|
63
63
|
}
|
|
64
64
|
case 'meridiem':
|
|
65
65
|
{
|
|
@@ -252,17 +252,17 @@ const changeSectionValueFormat = (utils, valueStr, currentFormat, newFormat) =>
|
|
|
252
252
|
return utils.formatByString(utils.parse(valueStr, currentFormat), newFormat);
|
|
253
253
|
};
|
|
254
254
|
exports.changeSectionValueFormat = changeSectionValueFormat;
|
|
255
|
-
const isFourDigitYearFormat = (utils,
|
|
256
|
-
const doesSectionFormatHaveLeadingZeros = (utils,
|
|
255
|
+
const isFourDigitYearFormat = (utils, format) => utils.formatByString(utils.date(undefined, 'system'), format).length === 4;
|
|
256
|
+
const doesSectionFormatHaveLeadingZeros = (utils, contentType, sectionType, format) => {
|
|
257
257
|
if (contentType !== 'digit') {
|
|
258
258
|
return false;
|
|
259
259
|
}
|
|
260
|
-
const now = utils.date(undefined,
|
|
260
|
+
const now = utils.date(undefined, 'default');
|
|
261
261
|
switch (sectionType) {
|
|
262
262
|
// We can't use `changeSectionValueFormat`, because `utils.parse('1', 'YYYY')` returns `1971` instead of `1`.
|
|
263
263
|
case 'year':
|
|
264
264
|
{
|
|
265
|
-
if (isFourDigitYearFormat(utils,
|
|
265
|
+
if (isFourDigitYearFormat(utils, format)) {
|
|
266
266
|
const formatted0001 = utils.formatByString(utils.setYear(now, 1), format);
|
|
267
267
|
return formatted0001 === '0001';
|
|
268
268
|
}
|
|
@@ -372,7 +372,7 @@ const getSectionsBoundaries = (utils, localizedDigits, timezone) => {
|
|
|
372
372
|
format
|
|
373
373
|
}) => ({
|
|
374
374
|
minimum: 0,
|
|
375
|
-
maximum: isFourDigitYearFormat(utils,
|
|
375
|
+
maximum: isFourDigitYearFormat(utils, format) ? 9999 : 99
|
|
376
376
|
}),
|
|
377
377
|
month: () => ({
|
|
378
378
|
minimum: 1,
|
|
@@ -391,7 +391,7 @@ const getSectionsBoundaries = (utils, localizedDigits, timezone) => {
|
|
|
391
391
|
contentType
|
|
392
392
|
}) => {
|
|
393
393
|
if (contentType === 'digit') {
|
|
394
|
-
const daysInWeek = getDaysInWeekStr(utils,
|
|
394
|
+
const daysInWeek = getDaysInWeekStr(utils, format).map(Number);
|
|
395
395
|
return {
|
|
396
396
|
minimum: Math.min(...daysInWeek),
|
|
397
397
|
maximum: Math.max(...daysInWeek)
|
|
@@ -459,7 +459,7 @@ const validateSections = (sections, valueType) => {
|
|
|
459
459
|
}
|
|
460
460
|
};
|
|
461
461
|
exports.validateSections = validateSections;
|
|
462
|
-
const transferDateSectionValue = (utils,
|
|
462
|
+
const transferDateSectionValue = (utils, section, dateToTransferFrom, dateToTransferTo) => {
|
|
463
463
|
switch (section.type) {
|
|
464
464
|
case 'year':
|
|
465
465
|
{
|
|
@@ -471,7 +471,7 @@ const transferDateSectionValue = (utils, timezone, section, dateToTransferFrom,
|
|
|
471
471
|
}
|
|
472
472
|
case 'weekDay':
|
|
473
473
|
{
|
|
474
|
-
const formattedDaysInWeek = getDaysInWeekStr(utils,
|
|
474
|
+
const formattedDaysInWeek = getDaysInWeekStr(utils, section.format);
|
|
475
475
|
const dayInWeekStrOfActiveDate = utils.formatByString(dateToTransferFrom, section.format);
|
|
476
476
|
const dayInWeekOfActiveDate = formattedDaysInWeek.indexOf(dayInWeekStrOfActiveDate);
|
|
477
477
|
const dayInWeekOfNewSectionValue = formattedDaysInWeek.indexOf(section.value);
|
|
@@ -523,11 +523,11 @@ const reliableSectionModificationOrder = {
|
|
|
523
523
|
meridiem: 8,
|
|
524
524
|
empty: 9
|
|
525
525
|
};
|
|
526
|
-
const mergeDateIntoReferenceDate = (utils,
|
|
526
|
+
const mergeDateIntoReferenceDate = (utils, dateToTransferFrom, sections, referenceDate, shouldLimitToEditedSections) =>
|
|
527
527
|
// cloning sections before sort to avoid mutating it
|
|
528
528
|
[...sections].sort((a, b) => reliableSectionModificationOrder[a.type] - reliableSectionModificationOrder[b.type]).reduce((mergedDate, section) => {
|
|
529
529
|
if (!shouldLimitToEditedSections || section.modified) {
|
|
530
|
-
return transferDateSectionValue(utils,
|
|
530
|
+
return transferDateSectionValue(utils, section, dateToTransferFrom, mergedDate);
|
|
531
531
|
}
|
|
532
532
|
return mergedDate;
|
|
533
533
|
}, referenceDate);
|
|
@@ -206,7 +206,7 @@ const useFieldCharacterEditing = ({
|
|
|
206
206
|
// When editing a letter-format month and the user presses a digit,
|
|
207
207
|
// We can support the numeric editing by using the digit-format month and re-formatting the result.
|
|
208
208
|
if (activeSection.type === 'month') {
|
|
209
|
-
const hasLeadingZerosInFormat = (0, _useField.doesSectionFormatHaveLeadingZeros)(utils,
|
|
209
|
+
const hasLeadingZerosInFormat = (0, _useField.doesSectionFormatHaveLeadingZeros)(utils, 'digit', 'month', 'MM');
|
|
210
210
|
const response = getNewSectionValue(queryValue, {
|
|
211
211
|
type: activeSection.type,
|
|
212
212
|
format: 'MM',
|
|
@@ -231,7 +231,7 @@ const useFieldCharacterEditing = ({
|
|
|
231
231
|
if (isQueryResponseWithoutValue(response)) {
|
|
232
232
|
return response;
|
|
233
233
|
}
|
|
234
|
-
const formattedValue = (0, _useField.getDaysInWeekStr)(utils,
|
|
234
|
+
const formattedValue = (0, _useField.getDaysInWeekStr)(utils, activeSection.format)[Number(response.sectionValue) - 1];
|
|
235
235
|
return (0, _extends2.default)({}, response, {
|
|
236
236
|
sectionValue: formattedValue
|
|
237
237
|
});
|
|
@@ -56,7 +56,6 @@ const useFieldState = params => {
|
|
|
56
56
|
const sectionsValueBoundaries = React.useMemo(() => (0, _useField.getSectionsBoundaries)(utils, localizedDigits, timezone), [utils, localizedDigits, timezone]);
|
|
57
57
|
const getSectionsFromValue = React.useCallback((value, fallbackSections = null) => fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, date => (0, _buildSectionsFromFormat.buildSectionsFromFormat)({
|
|
58
58
|
utils,
|
|
59
|
-
timezone,
|
|
60
59
|
localeText: translations,
|
|
61
60
|
localizedDigits,
|
|
62
61
|
format,
|
|
@@ -65,7 +64,7 @@ const useFieldState = params => {
|
|
|
65
64
|
shouldRespectLeadingZeros,
|
|
66
65
|
enableAccessibleFieldDOMStructure,
|
|
67
66
|
isRtl
|
|
68
|
-
})), [fieldValueManager, format, translations, localizedDigits, isRtl, shouldRespectLeadingZeros, utils, formatDensity,
|
|
67
|
+
})), [fieldValueManager, format, translations, localizedDigits, isRtl, shouldRespectLeadingZeros, utils, formatDensity, enableAccessibleFieldDOMStructure]);
|
|
69
68
|
const [state, setState] = React.useState(() => {
|
|
70
69
|
const sections = getSectionsFromValue(valueFromTheOutside);
|
|
71
70
|
(0, _useField.validateSections)(sections, valueType);
|
|
@@ -162,7 +161,6 @@ const useFieldState = params => {
|
|
|
162
161
|
}
|
|
163
162
|
const sections = (0, _buildSectionsFromFormat.buildSectionsFromFormat)({
|
|
164
163
|
utils,
|
|
165
|
-
timezone,
|
|
166
164
|
localeText: translations,
|
|
167
165
|
localizedDigits,
|
|
168
166
|
format,
|
|
@@ -172,7 +170,7 @@ const useFieldState = params => {
|
|
|
172
170
|
enableAccessibleFieldDOMStructure,
|
|
173
171
|
isRtl
|
|
174
172
|
});
|
|
175
|
-
return (0, _useField.mergeDateIntoReferenceDate)(utils,
|
|
173
|
+
return (0, _useField.mergeDateIntoReferenceDate)(utils, date, sections, referenceDate, false);
|
|
176
174
|
};
|
|
177
175
|
const newValue = fieldValueManager.parseValueStr(valueStr, state.referenceValue, parseDateStr);
|
|
178
176
|
const newReferenceValue = fieldValueManager.updateReferenceValue(utils, newValue, state.referenceValue);
|
|
@@ -210,7 +208,7 @@ const useFieldState = params => {
|
|
|
210
208
|
* This makes sure that we don't lose some information of the initial date (like the time on a date field).
|
|
211
209
|
*/
|
|
212
210
|
if (newActiveDate != null && utils.isValid(newActiveDate)) {
|
|
213
|
-
const mergedDate = (0, _useField.mergeDateIntoReferenceDate)(utils,
|
|
211
|
+
const mergedDate = (0, _useField.mergeDateIntoReferenceDate)(utils, newActiveDate, newActiveDateSections, activeDateManager.referenceDate, true);
|
|
214
212
|
values = activeDateManager.getNewValuesFromNewActiveDate(mergedDate);
|
|
215
213
|
shouldPublish = true;
|
|
216
214
|
} else {
|
|
@@ -15,8 +15,8 @@ var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
|
15
15
|
var _PickersModalDialog = require("../../components/PickersModalDialog");
|
|
16
16
|
var _usePicker = require("../usePicker");
|
|
17
17
|
var _utils = require("../../utils/utils");
|
|
18
|
-
var _LocalizationProvider = require("../../../LocalizationProvider");
|
|
19
18
|
var _PickersLayout = require("../../../PickersLayout");
|
|
19
|
+
var _PickersProvider = require("../../components/PickersProvider");
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
21
|
const _excluded = ["props", "getOpenDialogAriaText"];
|
|
22
22
|
/**
|
|
@@ -57,7 +57,8 @@ const useMobilePicker = _ref => {
|
|
|
57
57
|
actions,
|
|
58
58
|
layoutProps,
|
|
59
59
|
renderCurrentView,
|
|
60
|
-
fieldProps: pickerFieldProps
|
|
60
|
+
fieldProps: pickerFieldProps,
|
|
61
|
+
contextValue
|
|
61
62
|
} = (0, _usePicker.usePicker)((0, _extends2.default)({}, pickerParams, {
|
|
62
63
|
props,
|
|
63
64
|
fieldRef,
|
|
@@ -118,7 +119,8 @@ const useMobilePicker = _ref => {
|
|
|
118
119
|
}, innerSlotProps?.mobilePaper)
|
|
119
120
|
});
|
|
120
121
|
const handleFieldRef = (0, _useForkRef.default)(fieldRef, fieldProps.unstableFieldRef);
|
|
121
|
-
const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
122
|
+
const renderPicker = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_PickersProvider.PickersProvider, {
|
|
123
|
+
contextValue: contextValue,
|
|
122
124
|
localeText: localeText,
|
|
123
125
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Field, (0, _extends2.default)({}, fieldProps, {
|
|
124
126
|
slots: slotsForField,
|
|
@@ -55,7 +55,9 @@ const usePicker = ({
|
|
|
55
55
|
hasUIView: pickerViewsResponse.hasUIView,
|
|
56
56
|
shouldRestoreFocus: pickerViewsResponse.shouldRestoreFocus,
|
|
57
57
|
// Picker layout
|
|
58
|
-
layoutProps: pickerLayoutResponse.layoutProps
|
|
58
|
+
layoutProps: pickerLayoutResponse.layoutProps,
|
|
59
|
+
// Picker context
|
|
60
|
+
contextValue: pickerValueResponse.contextValue
|
|
59
61
|
};
|
|
60
62
|
};
|
|
61
63
|
exports.usePicker = usePicker;
|
|
@@ -341,12 +341,18 @@ const usePickerValue = ({
|
|
|
341
341
|
onSelectShortcut: handleSelectShortcut,
|
|
342
342
|
isValid
|
|
343
343
|
});
|
|
344
|
+
const contextValue = React.useMemo(() => ({
|
|
345
|
+
onOpen: handleOpen,
|
|
346
|
+
onClose: handleClose,
|
|
347
|
+
open: isOpen
|
|
348
|
+
}), [isOpen, handleClose, handleOpen]);
|
|
344
349
|
return {
|
|
345
350
|
open: isOpen,
|
|
346
351
|
fieldProps: fieldResponse,
|
|
347
352
|
viewProps: viewResponse,
|
|
348
353
|
layoutProps: layoutResponse,
|
|
349
|
-
actions
|
|
354
|
+
actions,
|
|
355
|
+
contextValue
|
|
350
356
|
};
|
|
351
357
|
};
|
|
352
358
|
exports.usePickerValue = usePickerValue;
|
package/node/internals/index.js
CHANGED
|
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "PickersPopper", {
|
|
|
45
45
|
return _PickersPopper.PickersPopper;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "PickersProvider", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _PickersProvider.PickersProvider;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
48
54
|
Object.defineProperty(exports, "PickersToolbar", {
|
|
49
55
|
enumerable: true,
|
|
50
56
|
get: function () {
|
|
@@ -304,6 +310,7 @@ Object.defineProperty(exports, "useViews", {
|
|
|
304
310
|
}
|
|
305
311
|
});
|
|
306
312
|
var _PickersArrowSwitcher = require("./components/PickersArrowSwitcher/PickersArrowSwitcher");
|
|
313
|
+
var _PickersProvider = require("./components/PickersProvider");
|
|
307
314
|
var _PickersModalDialog = require("./components/PickersModalDialog");
|
|
308
315
|
var _PickersPopper = require("./components/PickersPopper");
|
|
309
316
|
var _PickersToolbar = require("./components/PickersToolbar");
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.DEFAULT_DESKTOP_MODE_MEDIA_QUERY = void 0;
|
|
7
7
|
exports.arrayIncludes = arrayIncludes;
|
|
8
|
-
exports.onSpaceOrEnter = exports.getActiveElement = exports.executeInTheNextEventLoopTick = void 0;
|
|
8
|
+
exports.onSpaceOrEnter = exports.getFocusedListItemIndex = exports.getActiveElement = exports.executeInTheNextEventLoopTick = void 0;
|
|
9
9
|
/* Use it instead of .includes method for IE support */
|
|
10
10
|
function arrayIncludes(array, itemOrItems) {
|
|
11
11
|
if (Array.isArray(itemOrItems)) {
|
|
@@ -42,5 +42,17 @@ const getActiveElement = (root = document) => {
|
|
|
42
42
|
}
|
|
43
43
|
return activeEl;
|
|
44
44
|
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Gets the index of the focused list item in a given ul list element.
|
|
48
|
+
*
|
|
49
|
+
* @param {HTMLUListElement} listElement - The list element to search within.
|
|
50
|
+
* @returns {number} The index of the focused list item, or -1 if none is focused.
|
|
51
|
+
*/
|
|
45
52
|
exports.getActiveElement = getActiveElement;
|
|
53
|
+
const getFocusedListItemIndex = listElement => {
|
|
54
|
+
const children = listElement.children;
|
|
55
|
+
return Array.from(children).findIndex(child => child === getActiveElement(document));
|
|
56
|
+
};
|
|
57
|
+
exports.getFocusedListItemIndex = getFocusedListItemIndex;
|
|
46
58
|
const DEFAULT_DESKTOP_MODE_MEDIA_QUERY = exports.DEFAULT_DESKTOP_MODE_MEDIA_QUERY = '@media (pointer: fine)';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.bgBG = void 0;
|
|
7
|
+
var _getPickersLocalization = require("./utils/getPickersLocalization");
|
|
8
|
+
const views = {
|
|
9
|
+
hours: 'часове',
|
|
10
|
+
minutes: 'минути',
|
|
11
|
+
seconds: 'секунди',
|
|
12
|
+
meridiem: 'преди обяд/след обяд'
|
|
13
|
+
};
|
|
14
|
+
const bgBGPickers = {
|
|
15
|
+
// Calendar navigation
|
|
16
|
+
previousMonth: 'Предишен месец',
|
|
17
|
+
nextMonth: 'Следващ месец',
|
|
18
|
+
// View navigation
|
|
19
|
+
openPreviousView: 'Отвори предишен изглед',
|
|
20
|
+
openNextView: 'Отвори следващ изглед',
|
|
21
|
+
calendarViewSwitchingButtonAriaLabel: view => view === 'year' ? 'отворен е изглед на година, премини на изглед на календар' : 'отворен е изглед на календар, премини на изглед на година',
|
|
22
|
+
// DateRange labels
|
|
23
|
+
start: 'Начало',
|
|
24
|
+
end: 'Край',
|
|
25
|
+
startDate: 'Начална дата',
|
|
26
|
+
startTime: 'Начален час',
|
|
27
|
+
endDate: 'Крайна дата',
|
|
28
|
+
endTime: 'Краен час',
|
|
29
|
+
// Action bar
|
|
30
|
+
cancelButtonLabel: 'Отказ',
|
|
31
|
+
clearButtonLabel: 'Изчисти',
|
|
32
|
+
okButtonLabel: 'ОК',
|
|
33
|
+
todayButtonLabel: 'Днес',
|
|
34
|
+
// Toolbar titles
|
|
35
|
+
datePickerToolbarTitle: 'Избери дата',
|
|
36
|
+
dateTimePickerToolbarTitle: 'Избери дата и час',
|
|
37
|
+
timePickerToolbarTitle: 'Избери час',
|
|
38
|
+
dateRangePickerToolbarTitle: 'Избери времеви период',
|
|
39
|
+
// Clock labels
|
|
40
|
+
clockLabelText: (view, time, adapter) => `Избери ${views[view]}. ${time === null ? 'Не е избран час' : `Избраният час е ${adapter.format(time, 'fullTime')}`}`,
|
|
41
|
+
hoursClockNumberText: hours => `${hours} часа`,
|
|
42
|
+
minutesClockNumberText: minutes => `${minutes} минути`,
|
|
43
|
+
secondsClockNumberText: seconds => `${seconds} секунди`,
|
|
44
|
+
// Digital clock labels
|
|
45
|
+
selectViewText: view => `Избери ${views[view]}`,
|
|
46
|
+
// Calendar labels
|
|
47
|
+
calendarWeekNumberHeaderLabel: 'Седмица',
|
|
48
|
+
calendarWeekNumberHeaderText: '#',
|
|
49
|
+
calendarWeekNumberAriaLabelText: weekNumber => `Седмица ${weekNumber}`,
|
|
50
|
+
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
51
|
+
// Open picker labels
|
|
52
|
+
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Избери дата, избраната дата е ${utils.format(value, 'fullDate')}` : 'Избери дата',
|
|
53
|
+
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Избери час, избраният час е ${utils.format(value, 'fullTime')}` : 'Избери час',
|
|
54
|
+
fieldClearLabel: 'Изчисти стойност',
|
|
55
|
+
// Table labels
|
|
56
|
+
timeTableLabel: 'избери час',
|
|
57
|
+
dateTableLabel: 'избери дата',
|
|
58
|
+
// Field section placeholders
|
|
59
|
+
fieldYearPlaceholder: params => 'Г'.repeat(params.digitAmount),
|
|
60
|
+
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'ММММ' : 'ММ',
|
|
61
|
+
fieldDayPlaceholder: () => 'ДД',
|
|
62
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'СССС' : 'СС',
|
|
63
|
+
fieldHoursPlaceholder: () => 'чч',
|
|
64
|
+
fieldMinutesPlaceholder: () => 'мм',
|
|
65
|
+
fieldSecondsPlaceholder: () => 'сс',
|
|
66
|
+
fieldMeridiemPlaceholder: () => 'пс',
|
|
67
|
+
// View names
|
|
68
|
+
year: 'Година',
|
|
69
|
+
month: 'Месец',
|
|
70
|
+
day: 'Ден',
|
|
71
|
+
weekDay: 'Ден от седмицата',
|
|
72
|
+
hours: 'Часове',
|
|
73
|
+
minutes: 'Минути',
|
|
74
|
+
seconds: 'Секунди',
|
|
75
|
+
meridiem: 'Преди обяд/след обяд',
|
|
76
|
+
// Common
|
|
77
|
+
empty: 'Празно'
|
|
78
|
+
};
|
|
79
|
+
const bgBG = exports.bgBG = (0, _getPickersLocalization.getPickersLocalization)(bgBGPickers);
|
package/node/locales/csCZ.js
CHANGED
|
@@ -23,11 +23,10 @@ const csCZPickers = {
|
|
|
23
23
|
// DateRange labels
|
|
24
24
|
start: 'Začátek',
|
|
25
25
|
end: 'Konec',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
startDate: 'Datum začátku',
|
|
27
|
+
startTime: 'Čas začátku',
|
|
28
|
+
endDate: 'Datum konce',
|
|
29
|
+
endTime: 'Čas konce',
|
|
31
30
|
// Action bar
|
|
32
31
|
cancelButtonLabel: 'Zrušit',
|
|
33
32
|
clearButtonLabel: 'Vymazat',
|
|
@@ -53,8 +52,7 @@ const csCZPickers = {
|
|
|
53
52
|
// Open picker labels
|
|
54
53
|
openDatePickerDialogue: (value, utils, formattedDate) => formattedDate || value !== null && utils.isValid(value) ? `Vyberte datum, vybrané datum je ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Vyberte datum',
|
|
55
54
|
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `Vyberte čas, vybraný čas je ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Vyberte čas',
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
fieldClearLabel: 'Vymazat',
|
|
58
56
|
// Table labels
|
|
59
57
|
timeTableLabel: 'vyberte čas',
|
|
60
58
|
dateTableLabel: 'vyberte datum',
|
|
@@ -62,23 +60,21 @@ const csCZPickers = {
|
|
|
62
60
|
fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
|
|
63
61
|
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
64
62
|
fieldDayPlaceholder: () => 'DD',
|
|
65
|
-
|
|
63
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
|
|
66
64
|
fieldHoursPlaceholder: () => 'hh',
|
|
67
65
|
fieldMinutesPlaceholder: () => 'mm',
|
|
68
66
|
fieldSecondsPlaceholder: () => 'ss',
|
|
69
|
-
fieldMeridiemPlaceholder: () => 'aa'
|
|
70
|
-
|
|
67
|
+
fieldMeridiemPlaceholder: () => 'aa',
|
|
71
68
|
// View names
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
69
|
+
year: 'Rok',
|
|
70
|
+
month: 'Měsíc',
|
|
71
|
+
day: 'Den',
|
|
72
|
+
weekDay: 'Pracovní den',
|
|
73
|
+
hours: 'Hodiny',
|
|
74
|
+
minutes: 'Minuty',
|
|
75
|
+
seconds: 'Sekundy',
|
|
76
|
+
meridiem: 'Odpoledne',
|
|
81
77
|
// Common
|
|
82
|
-
|
|
78
|
+
empty: 'Prázdný'
|
|
83
79
|
};
|
|
84
80
|
const csCZ = exports.csCZ = (0, _getPickersLocalization.getPickersLocalization)(csCZPickers);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.hrHR = void 0;
|
|
7
|
+
var _getPickersLocalization = require("./utils/getPickersLocalization");
|
|
8
|
+
// maps TimeView to its translation
|
|
9
|
+
const timeViews = {
|
|
10
|
+
hours: 'sati',
|
|
11
|
+
minutes: 'minute',
|
|
12
|
+
seconds: 'sekunde',
|
|
13
|
+
meridiem: 'meridiem'
|
|
14
|
+
};
|
|
15
|
+
const hrHRPickers = {
|
|
16
|
+
// Calendar navigation
|
|
17
|
+
previousMonth: 'Prethodni mjesec',
|
|
18
|
+
nextMonth: 'Naredni mjesec',
|
|
19
|
+
// View navigation
|
|
20
|
+
openPreviousView: 'Otvori prethodni prikaz',
|
|
21
|
+
openNextView: 'Otvori naredni prikaz',
|
|
22
|
+
calendarViewSwitchingButtonAriaLabel: view => view === 'year' ? 'Otvoren je godišnji prikaz, promijeni na kalendarski prikaz' : 'Otvoren je kalendarski prikaz, promijeni na godišnji prikaz',
|
|
23
|
+
// DateRange labels
|
|
24
|
+
start: 'Početak',
|
|
25
|
+
end: 'Kraj',
|
|
26
|
+
startDate: 'Početni datum',
|
|
27
|
+
startTime: 'Početno vrijeme',
|
|
28
|
+
endDate: 'Krajnji datum',
|
|
29
|
+
endTime: 'Krajnje vrijeme',
|
|
30
|
+
// Action bar
|
|
31
|
+
cancelButtonLabel: 'Otkaži',
|
|
32
|
+
clearButtonLabel: 'Izbriši',
|
|
33
|
+
okButtonLabel: 'U redu',
|
|
34
|
+
todayButtonLabel: 'Danas',
|
|
35
|
+
// Toolbar titles
|
|
36
|
+
datePickerToolbarTitle: 'Odaberi datum',
|
|
37
|
+
dateTimePickerToolbarTitle: 'Odaberi datum i vrijeme',
|
|
38
|
+
timePickerToolbarTitle: 'Odaberi vrijeme',
|
|
39
|
+
dateRangePickerToolbarTitle: 'Odaberi vremenski okvir',
|
|
40
|
+
// Clock labels
|
|
41
|
+
clockLabelText: (view, time, utils, formattedTime) => `Odaberi ${timeViews[view] ?? view}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Vrijeme nije odabrano' : `Odabrano vrijeme je ${formattedTime ?? utils.format(time, 'fullTime')}`}`,
|
|
42
|
+
hoursClockNumberText: hours => {
|
|
43
|
+
let suffix = 'sati';
|
|
44
|
+
if (Number(hours) === 1) {
|
|
45
|
+
suffix = 'sat';
|
|
46
|
+
} else if (Number(hours) < 5) {
|
|
47
|
+
suffix = 'sata';
|
|
48
|
+
}
|
|
49
|
+
return `${hours} ${suffix}`;
|
|
50
|
+
},
|
|
51
|
+
minutesClockNumberText: minutes => `${minutes} ${Number(minutes) > 1 && Number(minutes) < 5 ? 'minute' : 'minuta'}`,
|
|
52
|
+
secondsClockNumberText: seconds => {
|
|
53
|
+
let suffix = 'sekundi';
|
|
54
|
+
if (Number(seconds) === 1) {
|
|
55
|
+
suffix = 'sekunda';
|
|
56
|
+
} else if (Number(seconds) < 5) {
|
|
57
|
+
suffix = 'sekunde';
|
|
58
|
+
}
|
|
59
|
+
return `${seconds} ${suffix}`;
|
|
60
|
+
},
|
|
61
|
+
// Digital clock labels
|
|
62
|
+
selectViewText: view => `Odaberi ${timeViews[view]}`,
|
|
63
|
+
// Calendar labels
|
|
64
|
+
calendarWeekNumberHeaderLabel: 'Broj tjedna',
|
|
65
|
+
calendarWeekNumberHeaderText: '#',
|
|
66
|
+
calendarWeekNumberAriaLabelText: weekNumber => `Tjedan ${weekNumber}`,
|
|
67
|
+
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
68
|
+
// Open picker labels
|
|
69
|
+
openDatePickerDialogue: (value, utils, formattedDate) => formattedDate || value !== null && utils.isValid(value) ? `Odaberi datum, odabrani datum je ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Odaberi datum',
|
|
70
|
+
openTimePickerDialogue: (value, utils, formattedTime) => formattedTime || value !== null && utils.isValid(value) ? `Odaberi vrijeme, odabrano vrijeme je ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Odaberi vrijeme',
|
|
71
|
+
fieldClearLabel: 'Izbriši',
|
|
72
|
+
// Table labels
|
|
73
|
+
timeTableLabel: 'Odaberi vrijeme',
|
|
74
|
+
dateTableLabel: 'Odaberi datum',
|
|
75
|
+
// Field section placeholders
|
|
76
|
+
fieldYearPlaceholder: params => 'G'.repeat(params.digitAmount),
|
|
77
|
+
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
78
|
+
fieldDayPlaceholder: () => 'DD',
|
|
79
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
|
|
80
|
+
fieldHoursPlaceholder: () => 'hh',
|
|
81
|
+
fieldMinutesPlaceholder: () => 'mm',
|
|
82
|
+
fieldSecondsPlaceholder: () => 'ss',
|
|
83
|
+
fieldMeridiemPlaceholder: () => 'aa',
|
|
84
|
+
// View names
|
|
85
|
+
year: 'Godina',
|
|
86
|
+
month: 'Mjesec',
|
|
87
|
+
day: 'Dan',
|
|
88
|
+
weekDay: 'Dan u tjednu',
|
|
89
|
+
hours: 'Sati',
|
|
90
|
+
minutes: 'Minute',
|
|
91
|
+
seconds: 'Sekunde',
|
|
92
|
+
meridiem: 'Meridiem',
|
|
93
|
+
// Common
|
|
94
|
+
empty: 'Isprazni'
|
|
95
|
+
};
|
|
96
|
+
const hrHR = exports.hrHR = (0, _getPickersLocalization.getPickersLocalization)(hrHRPickers);
|