@mui/x-date-pickers 7.10.0 → 7.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AdapterDayjs/AdapterDayjs.js +4 -3
- package/CHANGELOG.md +169 -0
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +4 -4
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +2 -3
- package/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +1 -1
- package/PickersLayout/PickersLayout.d.ts +4 -4
- package/PickersLayout/PickersLayout.js +2 -4
- package/PickersLayout/PickersLayout.types.d.ts +0 -4
- package/PickersTextField/PickersInput/pickersInputClasses.d.ts +1 -1
- package/TimeClock/Clock.js +21 -32
- package/TimeClock/clockClasses.d.ts +2 -0
- package/TimeClock/clockClasses.js +1 -1
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -5
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +2 -2
- package/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.d.ts +9 -1
- package/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -1
- package/internals/hooks/useField/useField.js +3 -1
- package/internals/hooks/useField/useFieldV6TextField.js +3 -2
- package/internals/hooks/useField/useFieldV7TextField.js +1 -1
- package/internals/hooks/usePicker/usePicker.js +2 -3
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/internals/utils/warning.d.ts +2 -4
- package/internals/utils/warning.js +17 -24
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/koKR.js +14 -16
- package/locales/nnNO.d.ts +80 -0
- package/locales/nnNO.js +73 -0
- package/locales/ruRU.js +15 -18
- package/models/pickers.d.ts +1 -1
- package/modern/AdapterDayjs/AdapterDayjs.js +4 -3
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +2 -3
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
- package/modern/PickersLayout/PickersLayout.js +2 -4
- package/modern/TimeClock/Clock.js +21 -32
- package/modern/TimeClock/clockClasses.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -5
- package/modern/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -1
- package/modern/internals/hooks/useField/useField.js +3 -1
- package/modern/internals/hooks/useField/useFieldV6TextField.js +3 -2
- package/modern/internals/hooks/useField/useFieldV7TextField.js +1 -1
- package/modern/internals/hooks/usePicker/usePicker.js +2 -3
- package/modern/internals/index.js +1 -1
- package/modern/internals/utils/warning.js +17 -24
- package/modern/locales/index.js +1 -0
- package/modern/locales/koKR.js +14 -16
- package/modern/locales/nnNO.js +73 -0
- package/modern/locales/ruRU.js +15 -18
- package/node/AdapterDayjs/AdapterDayjs.js +3 -2
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +3 -4
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +1 -1
- package/node/PickersLayout/PickersLayout.js +2 -4
- package/node/TimeClock/Clock.js +21 -32
- package/node/TimeClock/clockClasses.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -5
- package/node/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -1
- package/node/internals/hooks/useField/useField.js +3 -1
- package/node/internals/hooks/useField/useFieldV6TextField.js +3 -2
- package/node/internals/hooks/useField/useFieldV7TextField.js +1 -1
- package/node/internals/hooks/usePicker/usePicker.js +1 -2
- package/node/internals/index.js +6 -12
- package/node/internals/utils/warning.js +19 -27
- package/node/locales/index.js +11 -0
- package/node/locales/koKR.js +14 -16
- package/node/locales/nnNO.js +79 -0
- package/node/locales/ruRU.js +15 -18
- package/package.json +4 -4
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { usePickerValue } from './usePickerValue';
|
|
2
2
|
import { usePickerViews } from './usePickerViews';
|
|
3
3
|
import { usePickerLayoutProps } from './usePickerLayoutProps';
|
|
4
|
-
import {
|
|
5
|
-
const warnRenderInputIsDefined = buildWarning(['The `renderInput` prop has been removed in version 6.0 of the Date and Time Pickers.', 'You can replace it with the `textField` component slot in most cases.', 'For more information, please have a look at the migration guide (https://mui.com/x/migration/migration-pickers-v5/#input-renderer-required-in-v5).']);
|
|
4
|
+
import { warnOnce } from '../../utils/warning';
|
|
6
5
|
export const usePicker = ({
|
|
7
6
|
props,
|
|
8
7
|
valueManager,
|
|
@@ -16,7 +15,7 @@ export const usePicker = ({
|
|
|
16
15
|
}) => {
|
|
17
16
|
if (process.env.NODE_ENV !== 'production') {
|
|
18
17
|
if (props.renderInput != null) {
|
|
19
|
-
|
|
18
|
+
warnOnce(['MUI X: The `renderInput` prop has been removed in version 6.0 of the Date and Time Pickers.', 'You can replace it with the `textField` component slot in most cases.', 'For more information, please have a look at the migration guide (https://mui.com/x/migration/migration-pickers-v5/#input-renderer-required-in-v5).']);
|
|
20
19
|
}
|
|
21
20
|
}
|
|
22
21
|
const pickerValueResponse = usePickerValue({
|
|
@@ -30,7 +30,7 @@ export { validateDate } from './utils/validation/validateDate';
|
|
|
30
30
|
export { validateDateTime } from './utils/validation/validateDateTime';
|
|
31
31
|
export { validateTime } from './utils/validation/validateTime';
|
|
32
32
|
export { applyDefaultViewProps } from './utils/views';
|
|
33
|
-
export {
|
|
33
|
+
export { warnOnce } from './utils/warning';
|
|
34
34
|
export { DayCalendar } from '../DateCalendar/DayCalendar';
|
|
35
35
|
export { useCalendarState } from '../DateCalendar/useCalendarState';
|
|
36
36
|
export { isInternalTimeView, isTimeView } from './utils/time-utils';
|
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const warnedOnceCache = new Set();
|
|
2
|
+
|
|
3
|
+
// TODO move to @mui/x-internals
|
|
4
|
+
// TODO eventually move to @base_ui/internals. Base UI, etc. too need this helper.
|
|
5
|
+
export function warnOnce(message, gravity = 'warning') {
|
|
3
6
|
if (process.env.NODE_ENV === 'production') {
|
|
4
|
-
return
|
|
7
|
+
return;
|
|
5
8
|
}
|
|
6
9
|
const cleanMessage = Array.isArray(message) ? message.join('\n') : message;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
if (!warnedOnceCache.has(cleanMessage)) {
|
|
11
|
+
warnedOnceCache.add(cleanMessage);
|
|
12
|
+
if (gravity === 'error') {
|
|
13
|
+
console.error(cleanMessage);
|
|
14
|
+
} else {
|
|
15
|
+
console.warn(cleanMessage);
|
|
12
16
|
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return () => {
|
|
19
|
-
if (!alreadyWarned) {
|
|
20
|
-
alreadyWarned = true;
|
|
21
|
-
if (gravity === 'error') {
|
|
22
|
-
console.error(cleanMessage);
|
|
23
|
-
} else {
|
|
24
|
-
console.warn(cleanMessage);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function clearWarningsCache() {
|
|
20
|
+
warnedOnceCache.clear();
|
|
21
|
+
}
|
package/modern/locales/index.js
CHANGED
package/modern/locales/koKR.js
CHANGED
|
@@ -16,11 +16,10 @@ const koKRPickers = {
|
|
|
16
16
|
// DateRange labels
|
|
17
17
|
start: '시작',
|
|
18
18
|
end: '종료',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
startDate: '시작 날짜',
|
|
20
|
+
startTime: '시작 시간',
|
|
21
|
+
endDate: '종료 날짜',
|
|
22
|
+
endTime: '종료 시간',
|
|
24
23
|
// Action bar
|
|
25
24
|
cancelButtonLabel: '취소',
|
|
26
25
|
clearButtonLabel: '초기화',
|
|
@@ -54,23 +53,22 @@ const koKRPickers = {
|
|
|
54
53
|
fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
|
|
55
54
|
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
56
55
|
fieldDayPlaceholder: () => 'DD',
|
|
57
|
-
|
|
56
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
|
|
58
57
|
fieldHoursPlaceholder: () => 'hh',
|
|
59
58
|
fieldMinutesPlaceholder: () => 'mm',
|
|
60
59
|
fieldSecondsPlaceholder: () => 'ss',
|
|
61
|
-
fieldMeridiemPlaceholder: () => 'aa'
|
|
62
|
-
|
|
60
|
+
fieldMeridiemPlaceholder: () => 'aa',
|
|
63
61
|
// View names
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
year: '년',
|
|
63
|
+
month: '월',
|
|
64
|
+
day: '일',
|
|
65
|
+
weekDay: '평일',
|
|
66
|
+
hours: '시간',
|
|
67
|
+
minutes: '분',
|
|
68
|
+
seconds: '초',
|
|
71
69
|
// meridiem: 'Meridiem',
|
|
72
70
|
|
|
73
71
|
// Common
|
|
74
|
-
|
|
72
|
+
empty: '공란'
|
|
75
73
|
};
|
|
76
74
|
export const koKR = getPickersLocalization(koKRPickers);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { getPickersLocalization } from './utils/getPickersLocalization';
|
|
2
|
+
const timeViews = {
|
|
3
|
+
hours: 'timar',
|
|
4
|
+
minutes: 'minuttar',
|
|
5
|
+
seconds: 'sekundar',
|
|
6
|
+
meridiem: 'meridiem'
|
|
7
|
+
};
|
|
8
|
+
const nnNOPickers = {
|
|
9
|
+
// Calendar navigation
|
|
10
|
+
previousMonth: 'Forrige månad',
|
|
11
|
+
nextMonth: 'Neste månad',
|
|
12
|
+
// View navigation
|
|
13
|
+
openPreviousView: 'Opne forrige visning',
|
|
14
|
+
openNextView: 'Opne neste visning',
|
|
15
|
+
calendarViewSwitchingButtonAriaLabel: view => view === 'year' ? 'årsvisning er open, byt til kalendervisning' : 'kalendervisning er open, byt til årsvisning',
|
|
16
|
+
// DateRange labels
|
|
17
|
+
start: 'Start',
|
|
18
|
+
end: 'Slutt',
|
|
19
|
+
startDate: 'Startdato',
|
|
20
|
+
startTime: 'Starttid',
|
|
21
|
+
endDate: 'Sluttdato',
|
|
22
|
+
endTime: 'Slutttid',
|
|
23
|
+
// Action bar
|
|
24
|
+
cancelButtonLabel: 'Avbryt',
|
|
25
|
+
clearButtonLabel: 'Fjern',
|
|
26
|
+
okButtonLabel: 'OK',
|
|
27
|
+
todayButtonLabel: 'I dag',
|
|
28
|
+
// Toolbar titles
|
|
29
|
+
datePickerToolbarTitle: 'Vel dato',
|
|
30
|
+
dateTimePickerToolbarTitle: 'Vel dato & klokkeslett',
|
|
31
|
+
timePickerToolbarTitle: 'Vel klokkeslett',
|
|
32
|
+
dateRangePickerToolbarTitle: 'Vel datoperiode',
|
|
33
|
+
// Clock labels
|
|
34
|
+
clockLabelText: (view, time, adapter) => `Vel ${timeViews[view]}. ${time === null ? 'Ingen tid vald' : `Vald tid er ${adapter.format(time, 'fullTime')}`}`,
|
|
35
|
+
hoursClockNumberText: hours => `${hours} timar`,
|
|
36
|
+
minutesClockNumberText: minutes => `${minutes} minuttar`,
|
|
37
|
+
secondsClockNumberText: seconds => `${seconds} sekundar`,
|
|
38
|
+
// Digital clock labels
|
|
39
|
+
selectViewText: view => `Vel ${timeViews[view]}`,
|
|
40
|
+
// Calendar labels
|
|
41
|
+
calendarWeekNumberHeaderLabel: 'Vekenummer',
|
|
42
|
+
calendarWeekNumberHeaderText: '#',
|
|
43
|
+
calendarWeekNumberAriaLabelText: weekNumber => `Veke ${weekNumber}`,
|
|
44
|
+
calendarWeekNumberText: weekNumber => `${weekNumber}`,
|
|
45
|
+
// Open picker labels
|
|
46
|
+
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Vel dato, vald dato er ${utils.format(value, 'fullDate')}` : 'Vel dato',
|
|
47
|
+
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Vel tid, vald tid er ${utils.format(value, 'fullTime')}` : 'Vel tid',
|
|
48
|
+
fieldClearLabel: 'Fjern verdi',
|
|
49
|
+
// Table labels
|
|
50
|
+
timeTableLabel: 'vel tid',
|
|
51
|
+
dateTableLabel: 'vel dato',
|
|
52
|
+
// Field section placeholders
|
|
53
|
+
fieldYearPlaceholder: params => 'Å'.repeat(params.digitAmount),
|
|
54
|
+
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
|
|
55
|
+
fieldDayPlaceholder: () => 'DD',
|
|
56
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
|
|
57
|
+
fieldHoursPlaceholder: () => 'tt',
|
|
58
|
+
fieldMinutesPlaceholder: () => 'mm',
|
|
59
|
+
fieldSecondsPlaceholder: () => 'ss',
|
|
60
|
+
fieldMeridiemPlaceholder: () => 'aa',
|
|
61
|
+
// View names
|
|
62
|
+
year: 'År',
|
|
63
|
+
month: 'Månad',
|
|
64
|
+
day: 'Dag',
|
|
65
|
+
weekDay: 'Vekedag',
|
|
66
|
+
hours: 'Timar',
|
|
67
|
+
minutes: 'Minuttar',
|
|
68
|
+
seconds: 'Sekundar',
|
|
69
|
+
meridiem: 'Meridiem',
|
|
70
|
+
// Common
|
|
71
|
+
empty: 'Tom'
|
|
72
|
+
};
|
|
73
|
+
export const nnNO = getPickersLocalization(nnNOPickers);
|
package/modern/locales/ruRU.js
CHANGED
|
@@ -17,11 +17,10 @@ const ruRUPickers = {
|
|
|
17
17
|
// DateRange labels
|
|
18
18
|
start: 'Начало',
|
|
19
19
|
end: 'Конец',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
startDate: 'Начальная дата',
|
|
21
|
+
startTime: 'Начальное время',
|
|
22
|
+
endDate: 'Конечная дата',
|
|
23
|
+
endTime: 'Конечное время',
|
|
25
24
|
// Action bar
|
|
26
25
|
cancelButtonLabel: 'Отмена',
|
|
27
26
|
clearButtonLabel: 'Очистить',
|
|
@@ -55,23 +54,21 @@ const ruRUPickers = {
|
|
|
55
54
|
fieldYearPlaceholder: params => 'Г'.repeat(params.digitAmount),
|
|
56
55
|
fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'ММММ' : 'ММ',
|
|
57
56
|
fieldDayPlaceholder: () => 'ДД',
|
|
58
|
-
|
|
57
|
+
fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'ДДДД' : 'ДД',
|
|
59
58
|
fieldHoursPlaceholder: () => 'чч',
|
|
60
59
|
fieldMinutesPlaceholder: () => 'мм',
|
|
61
60
|
fieldSecondsPlaceholder: () => 'сс',
|
|
62
|
-
fieldMeridiemPlaceholder: () => '(д|п)п'
|
|
63
|
-
|
|
61
|
+
fieldMeridiemPlaceholder: () => '(д|п)п',
|
|
64
62
|
// View names
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
year: 'Год',
|
|
64
|
+
month: 'Месяц',
|
|
65
|
+
day: 'День',
|
|
66
|
+
weekDay: 'День недели',
|
|
67
|
+
hours: 'Часы',
|
|
68
|
+
minutes: 'Минуты',
|
|
69
|
+
seconds: 'Секунды',
|
|
70
|
+
meridiem: 'Меридием',
|
|
74
71
|
// Common
|
|
75
|
-
|
|
72
|
+
empty: 'Пустой'
|
|
76
73
|
};
|
|
77
74
|
export const ruRU = getPickersLocalization(ruRUPickers);
|
|
@@ -19,7 +19,6 @@ _dayjs.default.extend(_localizedFormat.default);
|
|
|
19
19
|
_dayjs.default.extend(_weekOfYear.default);
|
|
20
20
|
_dayjs.default.extend(_isBetween.default);
|
|
21
21
|
_dayjs.default.extend(_advancedFormat.default);
|
|
22
|
-
const localeNotFoundWarning = (0, _warning.buildWarning)(['Your locale has not been found.', 'Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale', "Or you forget to import the locale from 'dayjs/locale/{localeUsed}'", 'fallback on English locale']);
|
|
23
22
|
const formatTokenMap = {
|
|
24
23
|
// Year
|
|
25
24
|
YY: 'year',
|
|
@@ -242,7 +241,9 @@ class AdapterDayjs {
|
|
|
242
241
|
const locale = this.locale || 'en';
|
|
243
242
|
let localeObject = locales[locale];
|
|
244
243
|
if (localeObject === undefined) {
|
|
245
|
-
|
|
244
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
245
|
+
(0, _warning.warnOnce)(['MUI X: Your locale has not been found.', 'Either the locale key is not a supported one. Locales supported by dayjs are available here: https://github.com/iamkun/dayjs/tree/dev/src/locale.', "Or you forget to import the locale from 'dayjs/locale/{localeUsed}'", 'fallback on English locale.']);
|
|
246
|
+
}
|
|
246
247
|
localeObject = locales.en;
|
|
247
248
|
}
|
|
248
249
|
return localeObject.formats;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.DesktopDateTimePickerLayout =
|
|
7
|
+
exports.DesktopDateTimePickerLayout = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -18,7 +18,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
18
18
|
/**
|
|
19
19
|
* @ignore - internal component.
|
|
20
20
|
*/
|
|
21
|
-
function DesktopDateTimePickerLayout(props) {
|
|
21
|
+
const DesktopDateTimePickerLayout = exports.DesktopDateTimePickerLayout = /*#__PURE__*/React.forwardRef(function DesktopDateTimePickerLayout(props, ref) {
|
|
22
22
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
23
23
|
const {
|
|
24
24
|
toolbar,
|
|
@@ -31,7 +31,6 @@ function DesktopDateTimePickerLayout(props) {
|
|
|
31
31
|
sx,
|
|
32
32
|
className,
|
|
33
33
|
isLandscape,
|
|
34
|
-
ref,
|
|
35
34
|
classes
|
|
36
35
|
} = props;
|
|
37
36
|
const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
|
|
@@ -64,7 +63,7 @@ function DesktopDateTimePickerLayout(props) {
|
|
|
64
63
|
})]
|
|
65
64
|
}), actionBar]
|
|
66
65
|
});
|
|
67
|
-
}
|
|
66
|
+
});
|
|
68
67
|
process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes = {
|
|
69
68
|
// ----------------------------- Warning --------------------------------
|
|
70
69
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -161,7 +161,7 @@ const PickersCalendarHeader = exports.PickersCalendarHeader = /*#__PURE__*/React
|
|
|
161
161
|
const _useSlotProps = (0, _utils.useSlotProps)({
|
|
162
162
|
elementType: SwitchViewIcon,
|
|
163
163
|
externalSlotProps: slotProps?.switchViewIcon,
|
|
164
|
-
ownerState
|
|
164
|
+
ownerState,
|
|
165
165
|
className: classes.switchViewIcon
|
|
166
166
|
}),
|
|
167
167
|
switchViewIconProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded2);
|
|
@@ -98,7 +98,6 @@ const PickersLayoutContentWrapper = exports.PickersLayoutContentWrapper = (0, _s
|
|
|
98
98
|
display: 'flex',
|
|
99
99
|
flexDirection: 'column'
|
|
100
100
|
});
|
|
101
|
-
|
|
102
101
|
/**
|
|
103
102
|
* Demos:
|
|
104
103
|
*
|
|
@@ -108,7 +107,7 @@ const PickersLayoutContentWrapper = exports.PickersLayoutContentWrapper = (0, _s
|
|
|
108
107
|
*
|
|
109
108
|
* - [PickersLayout API](https://mui.com/x/api/date-pickers/pickers-layout/)
|
|
110
109
|
*/
|
|
111
|
-
const PickersLayout = exports.PickersLayout = function PickersLayout(inProps) {
|
|
110
|
+
const PickersLayout = exports.PickersLayout = /*#__PURE__*/React.forwardRef(function PickersLayout(inProps, ref) {
|
|
112
111
|
const props = (0, _styles.useThemeProps)({
|
|
113
112
|
props: inProps,
|
|
114
113
|
name: 'MuiPickersLayout'
|
|
@@ -124,7 +123,6 @@ const PickersLayout = exports.PickersLayout = function PickersLayout(inProps) {
|
|
|
124
123
|
sx,
|
|
125
124
|
className,
|
|
126
125
|
isLandscape,
|
|
127
|
-
ref,
|
|
128
126
|
wrapperVariant
|
|
129
127
|
} = props;
|
|
130
128
|
const classes = useUtilityClasses(props);
|
|
@@ -142,7 +140,7 @@ const PickersLayout = exports.PickersLayout = function PickersLayout(inProps) {
|
|
|
142
140
|
})
|
|
143
141
|
}), actionBar]
|
|
144
142
|
});
|
|
145
|
-
};
|
|
143
|
+
});
|
|
146
144
|
process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
|
|
147
145
|
// ----------------------------- Warning --------------------------------
|
|
148
146
|
// | These PropTypes are generated from the TypeScript type definitions |
|
package/node/TimeClock/Clock.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.Clock = Clock;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
9
|
var React = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
11
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
@@ -22,7 +23,8 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
22
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 && {}.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; }
|
|
23
24
|
const useUtilityClasses = ownerState => {
|
|
24
25
|
const {
|
|
25
|
-
classes
|
|
26
|
+
classes,
|
|
27
|
+
meridiemMode
|
|
26
28
|
} = ownerState;
|
|
27
29
|
const slots = {
|
|
28
30
|
root: ['root'],
|
|
@@ -30,8 +32,8 @@ const useUtilityClasses = ownerState => {
|
|
|
30
32
|
wrapper: ['wrapper'],
|
|
31
33
|
squareMask: ['squareMask'],
|
|
32
34
|
pin: ['pin'],
|
|
33
|
-
amButton: ['amButton'],
|
|
34
|
-
pmButton: ['pmButton'],
|
|
35
|
+
amButton: ['amButton', meridiemMode === 'am' && 'selected'],
|
|
36
|
+
pmButton: ['pmButton', meridiemMode === 'pm' && 'selected'],
|
|
35
37
|
meridiemText: ['meridiemText']
|
|
36
38
|
};
|
|
37
39
|
return (0, _utils.unstable_composeClasses)(slots, _clockClasses.getClockUtilityClass, classes);
|
|
@@ -114,23 +116,15 @@ const ClockPin = (0, _styles.styled)('div', {
|
|
|
114
116
|
left: '50%',
|
|
115
117
|
transform: 'translate(-50%, -50%)'
|
|
116
118
|
}));
|
|
117
|
-
const
|
|
118
|
-
name: 'MuiClock',
|
|
119
|
-
slot: 'AmButton',
|
|
120
|
-
overridesResolver: (_, styles) => styles.amButton
|
|
121
|
-
})(({
|
|
122
|
-
theme
|
|
123
|
-
}) => ({
|
|
119
|
+
const meridiemButtonCommonStyles = (theme, meridiemMode) => ({
|
|
124
120
|
zIndex: 1,
|
|
125
|
-
position: 'absolute',
|
|
126
121
|
bottom: 8,
|
|
127
|
-
left: 8,
|
|
128
122
|
paddingLeft: 4,
|
|
129
123
|
paddingRight: 4,
|
|
130
124
|
width: _shared.CLOCK_HOUR_WIDTH,
|
|
131
125
|
variants: [{
|
|
132
126
|
props: {
|
|
133
|
-
meridiemMode
|
|
127
|
+
meridiemMode
|
|
134
128
|
},
|
|
135
129
|
style: {
|
|
136
130
|
backgroundColor: (theme.vars || theme).palette.primary.main,
|
|
@@ -140,6 +134,17 @@ const ClockAmButton = (0, _styles.styled)(_IconButton.default, {
|
|
|
140
134
|
}
|
|
141
135
|
}
|
|
142
136
|
}]
|
|
137
|
+
});
|
|
138
|
+
const ClockAmButton = (0, _styles.styled)(_IconButton.default, {
|
|
139
|
+
name: 'MuiClock',
|
|
140
|
+
slot: 'AmButton',
|
|
141
|
+
overridesResolver: (_, styles) => styles.amButton
|
|
142
|
+
})(({
|
|
143
|
+
theme
|
|
144
|
+
}) => (0, _extends2.default)({}, meridiemButtonCommonStyles(theme, 'am'), {
|
|
145
|
+
// keeping it here to make TS happy
|
|
146
|
+
position: 'absolute',
|
|
147
|
+
left: 8
|
|
143
148
|
}));
|
|
144
149
|
const ClockPmButton = (0, _styles.styled)(_IconButton.default, {
|
|
145
150
|
name: 'MuiClock',
|
|
@@ -147,26 +152,10 @@ const ClockPmButton = (0, _styles.styled)(_IconButton.default, {
|
|
|
147
152
|
overridesResolver: (_, styles) => styles.pmButton
|
|
148
153
|
})(({
|
|
149
154
|
theme
|
|
150
|
-
}) => ({
|
|
151
|
-
|
|
155
|
+
}) => (0, _extends2.default)({}, meridiemButtonCommonStyles(theme, 'pm'), {
|
|
156
|
+
// keeping it here to make TS happy
|
|
152
157
|
position: 'absolute',
|
|
153
|
-
|
|
154
|
-
right: 8,
|
|
155
|
-
paddingLeft: 4,
|
|
156
|
-
paddingRight: 4,
|
|
157
|
-
width: _shared.CLOCK_HOUR_WIDTH,
|
|
158
|
-
variants: [{
|
|
159
|
-
props: {
|
|
160
|
-
meridiemMode: 'pm'
|
|
161
|
-
},
|
|
162
|
-
style: {
|
|
163
|
-
backgroundColor: (theme.vars || theme).palette.primary.main,
|
|
164
|
-
color: (theme.vars || theme).palette.primary.contrastText,
|
|
165
|
-
'&:hover': {
|
|
166
|
-
backgroundColor: (theme.vars || theme).palette.primary.light
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}]
|
|
158
|
+
right: 8
|
|
170
159
|
}));
|
|
171
160
|
const ClockMeridiemText = (0, _styles.styled)(_Typography.default, {
|
|
172
161
|
name: 'MuiClock',
|
|
@@ -9,4 +9,4 @@ var _utils = require("@mui/utils");
|
|
|
9
9
|
function getClockUtilityClass(slot) {
|
|
10
10
|
return (0, _utils.unstable_generateUtilityClass)('MuiClock', slot);
|
|
11
11
|
}
|
|
12
|
-
const clockClasses = exports.clockClasses = (0, _utils.unstable_generateUtilityClasses)('MuiClock', ['root', 'clock', 'wrapper', 'squareMask', 'pin', 'amButton', 'pmButton', 'meridiemText']);
|
|
12
|
+
const clockClasses = exports.clockClasses = (0, _utils.unstable_generateUtilityClasses)('MuiClock', ['root', 'clock', 'wrapper', 'squareMask', 'pin', 'amButton', 'pmButton', 'meridiemText', 'selected']);
|
package/node/index.js
CHANGED
|
@@ -60,7 +60,11 @@ const useUtilityClasses = ownerState => {
|
|
|
60
60
|
const slots = {
|
|
61
61
|
root: ['root'],
|
|
62
62
|
spacer: ['spacer'],
|
|
63
|
-
button: ['button']
|
|
63
|
+
button: ['button'],
|
|
64
|
+
previousIconButton: ['previousIconButton'],
|
|
65
|
+
nextIconButton: ['nextIconButton'],
|
|
66
|
+
leftArrowIcon: ['leftArrowIcon'],
|
|
67
|
+
rightArrowIcon: ['rightArrowIcon']
|
|
64
68
|
};
|
|
65
69
|
return (0, _utils.unstable_composeClasses)(slots, _pickersArrowSwitcherClasses.getPickersArrowSwitcherUtilityClass, classes);
|
|
66
70
|
};
|
|
@@ -115,7 +119,7 @@ const PickersArrowSwitcher = exports.PickersArrowSwitcher = /*#__PURE__*/React.f
|
|
|
115
119
|
ownerState: (0, _extends2.default)({}, ownerState, {
|
|
116
120
|
hidden: previousProps.isHidden
|
|
117
121
|
}),
|
|
118
|
-
className: classes.button
|
|
122
|
+
className: (0, _clsx.default)(classes.button, classes.previousIconButton)
|
|
119
123
|
});
|
|
120
124
|
const NextIconButton = slots?.nextIconButton ?? PickersArrowSwitcherButton;
|
|
121
125
|
const nextIconButtonProps = (0, _utils2.useSlotProps)({
|
|
@@ -132,7 +136,7 @@ const PickersArrowSwitcher = exports.PickersArrowSwitcher = /*#__PURE__*/React.f
|
|
|
132
136
|
ownerState: (0, _extends2.default)({}, ownerState, {
|
|
133
137
|
hidden: nextProps.isHidden
|
|
134
138
|
}),
|
|
135
|
-
className: classes.button
|
|
139
|
+
className: (0, _clsx.default)(classes.button, classes.nextIconButton)
|
|
136
140
|
});
|
|
137
141
|
const LeftArrowIcon = slots?.leftArrowIcon ?? _icons.ArrowLeftIcon;
|
|
138
142
|
// The spread is here to avoid this bug mui/material-ui#34056
|
|
@@ -142,7 +146,8 @@ const PickersArrowSwitcher = exports.PickersArrowSwitcher = /*#__PURE__*/React.f
|
|
|
142
146
|
additionalProps: {
|
|
143
147
|
fontSize: 'inherit'
|
|
144
148
|
},
|
|
145
|
-
ownerState
|
|
149
|
+
ownerState,
|
|
150
|
+
className: classes.leftArrowIcon
|
|
146
151
|
}),
|
|
147
152
|
leftArrowIconProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded2);
|
|
148
153
|
const RightArrowIcon = slots?.rightArrowIcon ?? _icons.ArrowRightIcon;
|
|
@@ -153,7 +158,8 @@ const PickersArrowSwitcher = exports.PickersArrowSwitcher = /*#__PURE__*/React.f
|
|
|
153
158
|
additionalProps: {
|
|
154
159
|
fontSize: 'inherit'
|
|
155
160
|
},
|
|
156
|
-
ownerState
|
|
161
|
+
ownerState,
|
|
162
|
+
className: classes.rightArrowIcon
|
|
157
163
|
}),
|
|
158
164
|
rightArrowIconProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps2, _excluded3);
|
|
159
165
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PickersArrowSwitcherRoot, (0, _extends2.default)({
|
|
@@ -9,4 +9,4 @@ var _utils = require("@mui/utils");
|
|
|
9
9
|
function getPickersArrowSwitcherUtilityClass(slot) {
|
|
10
10
|
return (0, _utils.unstable_generateUtilityClass)('MuiPickersArrowSwitcher', slot);
|
|
11
11
|
}
|
|
12
|
-
const pickersArrowSwitcherClasses = exports.pickersArrowSwitcherClasses = (0, _utils.unstable_generateUtilityClasses)('MuiPickersArrowSwitcher', ['root', 'spacer', 'button']);
|
|
12
|
+
const pickersArrowSwitcherClasses = exports.pickersArrowSwitcherClasses = (0, _utils.unstable_generateUtilityClasses)('MuiPickersArrowSwitcher', ['root', 'spacer', 'button', 'previousIconButton', 'nextIconButton', 'leftArrowIcon', 'rightArrowIcon']);
|
|
@@ -57,7 +57,8 @@ const useFieldV6TextField = params => {
|
|
|
57
57
|
placeholder: inPlaceholder
|
|
58
58
|
},
|
|
59
59
|
internalProps: {
|
|
60
|
-
readOnly = false
|
|
60
|
+
readOnly = false,
|
|
61
|
+
disabled = false
|
|
61
62
|
},
|
|
62
63
|
parsedSelectedSections,
|
|
63
64
|
activeSectionIndex,
|
|
@@ -198,7 +199,7 @@ const useFieldV6TextField = params => {
|
|
|
198
199
|
|
|
199
200
|
// prevent default to avoid the input `onChange` handler being called
|
|
200
201
|
event.preventDefault();
|
|
201
|
-
if (readOnly) {
|
|
202
|
+
if (readOnly || disabled) {
|
|
202
203
|
return;
|
|
203
204
|
}
|
|
204
205
|
const pastedValue = event.clipboardData.getData('text');
|
|
@@ -245,7 +245,7 @@ const useFieldV7TextField = params => {
|
|
|
245
245
|
const handleInputContentPaste = (0, _useEventCallback.default)(event => {
|
|
246
246
|
// prevent default to avoid the input `onInput` handler being called
|
|
247
247
|
event.preventDefault();
|
|
248
|
-
if (readOnly || typeof parsedSelectedSections !== 'number') {
|
|
248
|
+
if (readOnly || disabled || typeof parsedSelectedSections !== 'number') {
|
|
249
249
|
return;
|
|
250
250
|
}
|
|
251
251
|
const activeSection = state.sections[parsedSelectedSections];
|
|
@@ -8,7 +8,6 @@ var _usePickerValue = require("./usePickerValue");
|
|
|
8
8
|
var _usePickerViews = require("./usePickerViews");
|
|
9
9
|
var _usePickerLayoutProps = require("./usePickerLayoutProps");
|
|
10
10
|
var _warning = require("../../utils/warning");
|
|
11
|
-
const warnRenderInputIsDefined = (0, _warning.buildWarning)(['The `renderInput` prop has been removed in version 6.0 of the Date and Time Pickers.', 'You can replace it with the `textField` component slot in most cases.', 'For more information, please have a look at the migration guide (https://mui.com/x/migration/migration-pickers-v5/#input-renderer-required-in-v5).']);
|
|
12
11
|
const usePicker = ({
|
|
13
12
|
props,
|
|
14
13
|
valueManager,
|
|
@@ -22,7 +21,7 @@ const usePicker = ({
|
|
|
22
21
|
}) => {
|
|
23
22
|
if (process.env.NODE_ENV !== 'production') {
|
|
24
23
|
if (props.renderInput != null) {
|
|
25
|
-
|
|
24
|
+
(0, _warning.warnOnce)(['MUI X: The `renderInput` prop has been removed in version 6.0 of the Date and Time Pickers.', 'You can replace it with the `textField` component slot in most cases.', 'For more information, please have a look at the migration guide (https://mui.com/x/migration/migration-pickers-v5/#input-renderer-required-in-v5).']);
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
const pickerValueResponse = (0, _usePickerValue.usePickerValue)({
|
package/node/internals/index.js
CHANGED
|
@@ -81,18 +81,6 @@ Object.defineProperty(exports, "areDatesEqual", {
|
|
|
81
81
|
return _dateUtils.areDatesEqual;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
Object.defineProperty(exports, "buildDeprecatedPropsWarning", {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
get: function () {
|
|
87
|
-
return _warning.buildDeprecatedPropsWarning;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
Object.defineProperty(exports, "buildWarning", {
|
|
91
|
-
enumerable: true,
|
|
92
|
-
get: function () {
|
|
93
|
-
return _warning.buildWarning;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
84
|
Object.defineProperty(exports, "convertFieldResponseIntoMuiTextFieldProps", {
|
|
97
85
|
enumerable: true,
|
|
98
86
|
get: function () {
|
|
@@ -351,6 +339,12 @@ Object.defineProperty(exports, "validateTime", {
|
|
|
351
339
|
return _validateTime.validateTime;
|
|
352
340
|
}
|
|
353
341
|
});
|
|
342
|
+
Object.defineProperty(exports, "warnOnce", {
|
|
343
|
+
enumerable: true,
|
|
344
|
+
get: function () {
|
|
345
|
+
return _warning.warnOnce;
|
|
346
|
+
}
|
|
347
|
+
});
|
|
354
348
|
var _PickersArrowSwitcher = require("./components/PickersArrowSwitcher/PickersArrowSwitcher");
|
|
355
349
|
var _PickersModalDialog = require("./components/PickersModalDialog");
|
|
356
350
|
var _PickersPopper = require("./components/PickersPopper");
|