@mui/x-date-pickers 8.8.0 → 8.9.2
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.d.ts +28 -31
- package/AdapterDayjs/AdapterDayjs.js +25 -31
- package/CHANGELOG.md +225 -24
- package/DateCalendar/DateCalendar.js +2 -2
- package/DatePicker/DatePicker.js +1 -1
- package/DateTimePicker/DateTimePicker.js +3 -3
- package/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -3
- package/DesktopTimePicker/DesktopTimePicker.js +3 -3
- package/DigitalClock/DigitalClock.js +2 -2
- package/MobileDatePicker/MobileDatePicker.js +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +3 -3
- package/MobileTimePicker/MobileTimePicker.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -3
- package/PickerDay2/PickerDay2.js +1 -0
- package/PickersDay/PickersDay.js +1 -0
- package/PickersLayout/PickersLayout.js +1 -1
- package/StaticDatePicker/StaticDatePicker.js +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +3 -3
- package/StaticTimePicker/StaticTimePicker.js +1 -1
- package/TimeClock/TimeClock.js +2 -2
- package/TimePicker/TimePicker.js +3 -3
- package/esm/AdapterDayjs/AdapterDayjs.d.ts +28 -31
- package/esm/AdapterDayjs/AdapterDayjs.js +37 -43
- package/esm/DateCalendar/DateCalendar.js +2 -2
- package/esm/DatePicker/DatePicker.js +1 -1
- package/esm/DateTimePicker/DateTimePicker.js +3 -3
- package/esm/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/esm/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -3
- package/esm/DesktopTimePicker/DesktopTimePicker.js +3 -3
- package/esm/DigitalClock/DigitalClock.js +2 -2
- package/esm/MobileDatePicker/MobileDatePicker.js +1 -1
- package/esm/MobileDateTimePicker/MobileDateTimePicker.js +3 -3
- package/esm/MobileTimePicker/MobileTimePicker.js +1 -1
- package/esm/MultiSectionDigitalClock/MultiSectionDigitalClock.js +3 -3
- package/esm/PickerDay2/PickerDay2.js +1 -0
- package/esm/PickersDay/PickersDay.js +1 -0
- package/esm/PickersLayout/PickersLayout.js +1 -1
- package/esm/StaticDatePicker/StaticDatePicker.js +1 -1
- package/esm/StaticDateTimePicker/StaticDateTimePicker.js +3 -3
- package/esm/StaticTimePicker/StaticTimePicker.js +1 -1
- package/esm/TimeClock/TimeClock.js +2 -2
- package/esm/TimePicker/TimePicker.js +3 -3
- package/esm/index.js +1 -1
- package/esm/internals/components/PickerPopper/PickerPopper.js +12 -9
- package/esm/internals/hooks/useField/syncSelectionToDOM.js +3 -2
- package/esm/internals/hooks/useField/useFieldRootProps.js +2 -2
- package/esm/internals/hooks/useField/useFieldV6TextField.js +7 -7
- package/esm/internals/hooks/useField/useFieldV7TextField.js +2 -2
- package/esm/internals/hooks/useViews.d.ts +2 -2
- package/esm/internals/models/props/time.d.ts +3 -3
- package/esm/internals/utils/utils.d.ts +7 -1
- package/esm/internals/utils/utils.js +14 -3
- package/esm/locales/koKR.js +3 -5
- package/index.js +1 -1
- package/internals/components/PickerPopper/PickerPopper.js +12 -9
- package/internals/hooks/useField/syncSelectionToDOM.js +4 -2
- package/internals/hooks/useField/useFieldRootProps.js +2 -2
- package/internals/hooks/useField/useFieldV6TextField.js +7 -7
- package/internals/hooks/useField/useFieldV7TextField.js +2 -2
- package/internals/hooks/useViews.d.ts +2 -2
- package/internals/models/props/time.d.ts +3 -3
- package/internals/utils/utils.d.ts +7 -1
- package/internals/utils/utils.js +15 -3
- package/locales/koKR.js +3 -5
- package/package.json +4 -5
|
@@ -122,7 +122,7 @@ function useFieldRootProps(parameters) {
|
|
|
122
122
|
if (focused || disabled || !domGetters.isReady()) {
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
const activeElement = (0, _utils.getActiveElement)(
|
|
125
|
+
const activeElement = (0, _utils.getActiveElement)(domGetters.getRoot());
|
|
126
126
|
setFocused(true);
|
|
127
127
|
const isFocusInsideASection = domGetters.getSectionIndexFromDOMElement(activeElement) != null;
|
|
128
128
|
if (!isFocusInsideASection) {
|
|
@@ -134,7 +134,7 @@ function useFieldRootProps(parameters) {
|
|
|
134
134
|
if (!domGetters.isReady()) {
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
const activeElement = (0, _utils.getActiveElement)(
|
|
137
|
+
const activeElement = (0, _utils.getActiveElement)(domGetters.getRoot());
|
|
138
138
|
const shouldBlur = !domGetters.getRoot().contains(activeElement);
|
|
139
139
|
if (shouldBlur) {
|
|
140
140
|
setFocused(false);
|
|
@@ -141,7 +141,7 @@ const useFieldV6TextField = parameters => {
|
|
|
141
141
|
setSelectedSections(sectionIndex);
|
|
142
142
|
}
|
|
143
143
|
function focusField(newSelectedSection = 0) {
|
|
144
|
-
if ((0, _utils.getActiveElement)(
|
|
144
|
+
if ((0, _utils.getActiveElement)(inputRef.current) === inputRef.current) {
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
147
|
inputRef.current?.focus();
|
|
@@ -306,7 +306,7 @@ const useFieldV6TextField = parameters => {
|
|
|
306
306
|
const valueStr = React.useMemo(() => state.tempValueStrAndroid ?? fieldValueManager.getV6InputValueFromSections(state.sections, localizedDigits, isRtl), [state.sections, fieldValueManager, state.tempValueStrAndroid, localizedDigits, isRtl]);
|
|
307
307
|
React.useEffect(() => {
|
|
308
308
|
// Select all the sections when focused on mount (`autoFocus = true` on the input)
|
|
309
|
-
if (inputRef.current && inputRef.current === (0, _utils.getActiveElement)(
|
|
309
|
+
if (inputRef.current && inputRef.current === (0, _utils.getActiveElement)(inputRef.current)) {
|
|
310
310
|
setSelectedSections('all');
|
|
311
311
|
}
|
|
312
312
|
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
|
@@ -329,7 +329,7 @@ const useFieldV6TextField = parameters => {
|
|
|
329
329
|
// On multi input range pickers we want to update selection range only for the active input
|
|
330
330
|
// This helps to avoid the focus jumping on Safari https://github.com/mui/mui-x/issues/9003
|
|
331
331
|
// because WebKit implements the `setSelectionRange` based on the spec: https://bugs.webkit.org/show_bug.cgi?id=224425
|
|
332
|
-
if (inputRef.current !== (0, _utils.getActiveElement)(
|
|
332
|
+
if (inputRef.current !== (0, _utils.getActiveElement)(inputRef.current)) {
|
|
333
333
|
return;
|
|
334
334
|
}
|
|
335
335
|
|
|
@@ -342,14 +342,14 @@ const useFieldV6TextField = parameters => {
|
|
|
342
342
|
const selectionStart = selectedSection.type === 'empty' ? selectedSection.startInInput - selectedSection.startSeparator.length : selectedSection.startInInput;
|
|
343
343
|
const selectionEnd = selectedSection.type === 'empty' ? selectedSection.endInInput + selectedSection.endSeparator.length : selectedSection.endInInput;
|
|
344
344
|
if (selectionStart !== inputRef.current.selectionStart || selectionEnd !== inputRef.current.selectionEnd) {
|
|
345
|
-
if (inputRef.current === (0, _utils.getActiveElement)(
|
|
345
|
+
if (inputRef.current === (0, _utils.getActiveElement)(inputRef.current)) {
|
|
346
346
|
inputRef.current.setSelectionRange(selectionStart, selectionEnd);
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
selectionSyncTimeout.start(0, () => {
|
|
350
350
|
// handle case when the selection is not updated correctly
|
|
351
351
|
// could happen on Android
|
|
352
|
-
if (inputRef.current && inputRef.current === (0, _utils.getActiveElement)(
|
|
352
|
+
if (inputRef.current && inputRef.current === (0, _utils.getActiveElement)(inputRef.current) &&
|
|
353
353
|
// The section might loose all selection, where `selectionStart === selectionEnd`
|
|
354
354
|
// https://github.com/mui/mui-x/pull/13652
|
|
355
355
|
inputRef.current.selectionStart === inputRef.current.selectionEnd && (inputRef.current.selectionStart !== selectionStart || inputRef.current.selectionEnd !== selectionEnd)) {
|
|
@@ -372,7 +372,7 @@ const useFieldV6TextField = parameters => {
|
|
|
372
372
|
}
|
|
373
373
|
return 'numeric';
|
|
374
374
|
}, [activeSectionIndex, state.sections]);
|
|
375
|
-
const inputHasFocus = inputRef.current && inputRef.current === (0, _utils.getActiveElement)(
|
|
375
|
+
const inputHasFocus = inputRef.current && inputRef.current === (0, _utils.getActiveElement)(inputRef.current);
|
|
376
376
|
const shouldShowPlaceholder = !inputHasFocus && areAllSectionsEmpty;
|
|
377
377
|
React.useImperativeHandle(unstableFieldRef, () => ({
|
|
378
378
|
getSections: () => state.sections,
|
|
@@ -416,5 +416,5 @@ const useFieldV6TextField = parameters => {
|
|
|
416
416
|
};
|
|
417
417
|
exports.useFieldV6TextField = useFieldV6TextField;
|
|
418
418
|
function isFieldFocused(inputRef) {
|
|
419
|
-
return inputRef.current === (0, _utils.getActiveElement)(
|
|
419
|
+
return inputRef.current === (0, _utils.getActiveElement)(inputRef.current);
|
|
420
420
|
}
|
|
@@ -251,13 +251,13 @@ const useFieldV7TextField = parameters => {
|
|
|
251
251
|
};
|
|
252
252
|
exports.useFieldV7TextField = useFieldV7TextField;
|
|
253
253
|
function getActiveSectionIndex(sectionListRef) {
|
|
254
|
-
const activeElement = (0, _utils.getActiveElement)(
|
|
254
|
+
const activeElement = (0, _utils.getActiveElement)(sectionListRef.current?.getRoot());
|
|
255
255
|
if (!activeElement || !sectionListRef.current || !sectionListRef.current.getRoot().contains(activeElement)) {
|
|
256
256
|
return null;
|
|
257
257
|
}
|
|
258
258
|
return sectionListRef.current.getSectionIndexFromDOMElement(activeElement);
|
|
259
259
|
}
|
|
260
260
|
function isFieldFocused(sectionListRef) {
|
|
261
|
-
const activeElement = (0, _utils.getActiveElement)(
|
|
261
|
+
const activeElement = (0, _utils.getActiveElement)(sectionListRef.current?.getRoot());
|
|
262
262
|
return !!sectionListRef.current && sectionListRef.current.getRoot().contains(activeElement);
|
|
263
263
|
}
|
|
@@ -16,7 +16,7 @@ export interface UseViewsOptions<TValue extends PickerValidValue, TView extends
|
|
|
16
16
|
onChange: (value: TValue, selectionState?: PickerSelectionState, selectedView?: TView) => void;
|
|
17
17
|
/**
|
|
18
18
|
* Callback fired on view change.
|
|
19
|
-
* @template TView
|
|
19
|
+
* @template TView Type of the view. It will vary based on the Picker type and the `views` it uses.
|
|
20
20
|
* @param {TView} view The new view.
|
|
21
21
|
*/
|
|
22
22
|
onViewChange?: (view: TView) => void;
|
|
@@ -49,7 +49,7 @@ export interface UseViewsOptions<TValue extends PickerValidValue, TView extends
|
|
|
49
49
|
focusedView?: TView | null;
|
|
50
50
|
/**
|
|
51
51
|
* Callback fired on focused view change.
|
|
52
|
-
* @template TView
|
|
52
|
+
* @template TView Type of the view. It will vary based on the Picker type and the `views` it uses.
|
|
53
53
|
* @param {TView} view The new view to focus or not.
|
|
54
54
|
* @param {boolean} hasFocus `true` if the view should be focused.
|
|
55
55
|
*/
|
|
@@ -45,8 +45,8 @@ export interface DigitalTimePickerProps extends Omit<ExportedDigitalClockProps,
|
|
|
45
45
|
thresholdToRenderTimeInASingleColumn?: number;
|
|
46
46
|
/**
|
|
47
47
|
* The time steps between two time unit options.
|
|
48
|
-
* For example, if `
|
|
49
|
-
* When single column time renderer is used, only `
|
|
48
|
+
* For example, if `timeSteps.minutes = 8`, then the available minute options will be `[0, 8, 16, 24, 32, 40, 48, 56]`.
|
|
49
|
+
* When single column time renderer is used, only `timeSteps.minutes` will be used.
|
|
50
50
|
* @default{ hours: 1, minutes: 5, seconds: 5 }
|
|
51
51
|
*/
|
|
52
52
|
timeSteps?: TimeStepOptions;
|
|
@@ -69,7 +69,7 @@ export interface DigitalClockOnlyProps extends DigitalClockOnlyBaseProps {
|
|
|
69
69
|
export interface MultiSectionDigitalClockOnlyProps extends DigitalClockOnlyBaseProps {
|
|
70
70
|
/**
|
|
71
71
|
* The time steps between two time unit options.
|
|
72
|
-
* For example, if `
|
|
72
|
+
* For example, if `timeSteps.minutes = 8`, then the available minute options will be `[0, 8, 16, 24, 32, 40, 48, 56]`.
|
|
73
73
|
* @default{ hours: 1, minutes: 5, seconds: 5 }
|
|
74
74
|
*/
|
|
75
75
|
timeSteps?: TimeStepOptions;
|
|
@@ -4,7 +4,13 @@ import * as React from 'react';
|
|
|
4
4
|
export declare function arrayIncludes<T>(array: T[] | readonly T[], itemOrItems: T | T[]): boolean;
|
|
5
5
|
export declare const onSpaceOrEnter: (innerFn: (ev: React.MouseEvent<any> | React.KeyboardEvent<any>) => void, externalEvent?: (event: React.KeyboardEvent<any>) => void) => (event: React.KeyboardEvent) => void;
|
|
6
6
|
export declare const executeInTheNextEventLoopTick: (fn: () => void) => void;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Gets the currently active element within a given node's document.
|
|
9
|
+
* This function traverses shadow DOM if necessary.
|
|
10
|
+
* @param node - The node from which to get the active element.
|
|
11
|
+
* @returns The currently active element, or null if none is found.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getActiveElement: (node: Node | null | undefined) => Element | null;
|
|
8
14
|
/**
|
|
9
15
|
* Gets the index of the focused list item in a given ul list element.
|
|
10
16
|
*
|
package/internals/utils/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -8,6 +9,7 @@ exports.arrayIncludes = arrayIncludes;
|
|
|
8
9
|
exports.getFocusedListItemIndex = exports.getActiveElement = exports.executeInTheNextEventLoopTick = void 0;
|
|
9
10
|
exports.mergeSx = mergeSx;
|
|
10
11
|
exports.onSpaceOrEnter = void 0;
|
|
12
|
+
var _ownerDocument = _interopRequireDefault(require("@mui/utils/ownerDocument"));
|
|
11
13
|
/* Use it instead of .includes method for IE support */
|
|
12
14
|
function arrayIncludes(array, itemOrItems) {
|
|
13
15
|
if (Array.isArray(itemOrItems)) {
|
|
@@ -34,17 +36,27 @@ const executeInTheNextEventLoopTick = fn => {
|
|
|
34
36
|
|
|
35
37
|
// https://www.abeautifulsite.net/posts/finding-the-active-element-in-a-shadow-root/
|
|
36
38
|
exports.executeInTheNextEventLoopTick = executeInTheNextEventLoopTick;
|
|
37
|
-
const
|
|
39
|
+
const getActiveElementInternal = (root = document) => {
|
|
38
40
|
const activeEl = root.activeElement;
|
|
39
41
|
if (!activeEl) {
|
|
40
42
|
return null;
|
|
41
43
|
}
|
|
42
44
|
if (activeEl.shadowRoot) {
|
|
43
|
-
return
|
|
45
|
+
return getActiveElementInternal(activeEl.shadowRoot);
|
|
44
46
|
}
|
|
45
47
|
return activeEl;
|
|
46
48
|
};
|
|
47
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Gets the currently active element within a given node's document.
|
|
52
|
+
* This function traverses shadow DOM if necessary.
|
|
53
|
+
* @param node - The node from which to get the active element.
|
|
54
|
+
* @returns The currently active element, or null if none is found.
|
|
55
|
+
*/
|
|
56
|
+
const getActiveElement = node => {
|
|
57
|
+
return getActiveElementInternal((0, _ownerDocument.default)(node));
|
|
58
|
+
};
|
|
59
|
+
|
|
48
60
|
/**
|
|
49
61
|
* Gets the index of the focused list item in a given ul list element.
|
|
50
62
|
*
|
|
@@ -54,7 +66,7 @@ const getActiveElement = (root = document) => {
|
|
|
54
66
|
exports.getActiveElement = getActiveElement;
|
|
55
67
|
const getFocusedListItemIndex = listElement => {
|
|
56
68
|
const children = Array.from(listElement.children);
|
|
57
|
-
return children.indexOf(getActiveElement(
|
|
69
|
+
return children.indexOf(getActiveElement(listElement));
|
|
58
70
|
};
|
|
59
71
|
exports.getFocusedListItemIndex = getFocusedListItemIndex;
|
|
60
72
|
const DEFAULT_DESKTOP_MODE_MEDIA_QUERY = exports.DEFAULT_DESKTOP_MODE_MEDIA_QUERY = '@media (pointer: fine)';
|
package/locales/koKR.js
CHANGED
|
@@ -37,8 +37,7 @@ const koKRPickers = {
|
|
|
37
37
|
dateTimePickerToolbarTitle: '날짜 & 시간 선택하기',
|
|
38
38
|
timePickerToolbarTitle: '시간 선택하기',
|
|
39
39
|
dateRangePickerToolbarTitle: '날짜 범위 선택하기',
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
timeRangePickerToolbarTitle: '시간 범위 선택하기',
|
|
42
41
|
// Clock labels
|
|
43
42
|
clockLabelText: (view, formattedTime) => `${views[view]} 선택하세요. ${!formattedTime ? '시간을 선택하지 않았습니다.' : `현재 선택된 시간은 ${formattedTime}입니다.`}`,
|
|
44
43
|
hoursClockNumberText: hours => `${hours}시`,
|
|
@@ -54,7 +53,7 @@ const koKRPickers = {
|
|
|
54
53
|
// Open Picker labels
|
|
55
54
|
openDatePickerDialogue: formattedDate => formattedDate ? `날짜를 선택하세요. 현재 선택된 날짜는 ${formattedDate}입니다.` : '날짜를 선택하세요',
|
|
56
55
|
openTimePickerDialogue: formattedTime => formattedTime ? `시간을 선택하세요. 현재 선택된 시간은 ${formattedTime}입니다.` : '시간을 선택하세요',
|
|
57
|
-
|
|
56
|
+
openRangePickerDialogue: formattedRange => formattedRange ? `범위를 선택하세요. 현재 선택된 범위는 ${formattedRange}입니다.` : '범위를 선택하세요',
|
|
58
57
|
fieldClearLabel: '지우기',
|
|
59
58
|
// Table labels
|
|
60
59
|
timeTableLabel: '선택한 시간',
|
|
@@ -76,8 +75,7 @@ const koKRPickers = {
|
|
|
76
75
|
hours: '시간',
|
|
77
76
|
minutes: '분',
|
|
78
77
|
seconds: '초',
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
meridiem: '오전/오후',
|
|
81
79
|
// Common
|
|
82
80
|
empty: '공란'
|
|
83
81
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.2",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The community edition of the MUI X Date and Time Picker components.",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"publishConfig": {
|
|
18
|
-
"access": "public"
|
|
19
|
-
"directory": "build"
|
|
18
|
+
"access": "public"
|
|
20
19
|
},
|
|
21
20
|
"keywords": [
|
|
22
21
|
"react",
|
|
@@ -35,13 +34,13 @@
|
|
|
35
34
|
"directory": "packages/x-date-pickers"
|
|
36
35
|
},
|
|
37
36
|
"dependencies": {
|
|
38
|
-
"@babel/runtime": "^7.
|
|
37
|
+
"@babel/runtime": "^7.28.2",
|
|
39
38
|
"@mui/utils": "^7.2.0",
|
|
40
39
|
"@types/react-transition-group": "^4.4.12",
|
|
41
40
|
"clsx": "^2.1.1",
|
|
42
41
|
"prop-types": "^15.8.1",
|
|
43
42
|
"react-transition-group": "^4.4.5",
|
|
44
|
-
"@mui/x-internals": "8.
|
|
43
|
+
"@mui/x-internals": "8.9.2"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
46
|
"@emotion/react": "^11.9.0",
|