@mui/material 9.0.0-alpha.1 → 9.0.0-alpha.3
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/Autocomplete/Autocomplete.d.mts +16 -0
- package/Autocomplete/Autocomplete.d.ts +16 -0
- package/Autocomplete/Autocomplete.js +48 -25
- package/Autocomplete/Autocomplete.mjs +48 -25
- package/Box/Box.d.mts +1 -0
- package/Box/Box.d.ts +1 -0
- package/Button/Button.d.mts +1 -0
- package/Button/Button.d.ts +1 -0
- package/CHANGELOG.md +65 -0
- package/CardHeader/CardHeader.js +1 -0
- package/CardHeader/CardHeader.mjs +1 -0
- package/Divider/Divider.d.mts +1 -0
- package/Divider/Divider.d.ts +1 -0
- package/List/List.d.mts +1 -0
- package/List/List.d.ts +1 -0
- package/ListItemButton/ListItemButton.d.mts +1 -0
- package/ListItemButton/ListItemButton.d.ts +1 -0
- package/ListItemIcon/ListItemIcon.d.mts +1 -0
- package/ListItemIcon/ListItemIcon.d.ts +1 -0
- package/ListItemText/ListItemText.d.mts +1 -0
- package/ListItemText/ListItemText.d.ts +1 -0
- package/ListItemText/ListItemText.js +1 -0
- package/ListItemText/ListItemText.mjs +1 -0
- package/ListSubheader/ListSubheader.d.mts +1 -0
- package/ListSubheader/ListSubheader.d.ts +1 -0
- package/MenuList/MenuList.js +76 -106
- package/MenuList/MenuList.mjs +76 -106
- package/Paper/Paper.d.mts +1 -0
- package/Paper/Paper.d.ts +1 -0
- package/SpeedDialIcon/SpeedDialIcon.js +4 -10
- package/SpeedDialIcon/SpeedDialIcon.mjs +4 -10
- package/Step/Step.js +7 -5
- package/Step/Step.mjs +7 -5
- package/StepButton/StepButton.js +16 -6
- package/StepButton/StepButton.mjs +16 -6
- package/StepConnector/StepConnector.js +2 -2
- package/StepConnector/StepConnector.mjs +2 -2
- package/StepContent/StepContent.js +2 -2
- package/StepContent/StepContent.mjs +2 -2
- package/StepIcon/StepIcon.js +1 -4
- package/StepIcon/StepIcon.mjs +1 -4
- package/StepLabel/StepLabel.js +3 -7
- package/StepLabel/StepLabel.mjs +3 -7
- package/Stepper/Stepper.js +44 -7
- package/Stepper/Stepper.mjs +44 -7
- package/Stepper/StepperContext.d.mts +7 -0
- package/Stepper/StepperContext.d.ts +7 -0
- package/Stepper/StepperContext.js +2 -1
- package/Stepper/StepperContext.mjs +1 -0
- package/Stepper/index.d.mts +0 -1
- package/Stepper/index.d.ts +0 -1
- package/Tab/Tab.js +0 -1
- package/Tab/Tab.mjs +0 -1
- package/Tabs/Tabs.js +46 -97
- package/Tabs/Tabs.mjs +46 -97
- package/Typography/Typography.d.mts +1 -0
- package/Typography/Typography.d.ts +1 -0
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +20 -6
- package/themeCssVarsAugmentation/index.js +5 -0
- package/themeCssVarsAugmentation/index.mjs +5 -0
- package/useAutocomplete/useAutocomplete.js +24 -0
- package/useAutocomplete/useAutocomplete.mjs +24 -0
- package/utils/index.d.mts +2 -0
- package/utils/index.d.ts +2 -0
- package/utils/index.js +14 -0
- package/utils/index.mjs +2 -0
- package/utils/useRovingTabIndex.d.mts +2 -0
- package/utils/useRovingTabIndex.d.ts +2 -0
- package/utils/useRovingTabIndex.js +9 -0
- package/utils/useRovingTabIndex.mjs +2 -0
- package/version/index.js +2 -2
- package/version/index.mjs +2 -2
package/Tabs/Tabs.js
CHANGED
|
@@ -24,53 +24,11 @@ var _ScrollbarSize = _interopRequireDefault(require("./ScrollbarSize"));
|
|
|
24
24
|
var _TabScrollButton = _interopRequireDefault(require("../TabScrollButton"));
|
|
25
25
|
var _useEventCallback = _interopRequireDefault(require("../utils/useEventCallback"));
|
|
26
26
|
var _tabsClasses = _interopRequireWildcard(require("./tabsClasses"));
|
|
27
|
-
var _ownerDocument = _interopRequireDefault(require("../utils/ownerDocument"));
|
|
28
27
|
var _ownerWindow = _interopRequireDefault(require("../utils/ownerWindow"));
|
|
29
|
-
var _getActiveElement = _interopRequireDefault(require("../utils/getActiveElement"));
|
|
30
28
|
var _isLayoutSupported = _interopRequireDefault(require("../utils/isLayoutSupported"));
|
|
31
29
|
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
30
|
+
var _utils = require("../utils");
|
|
32
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
|
-
const nextItem = (list, item) => {
|
|
34
|
-
if (list === item) {
|
|
35
|
-
return list.firstChild;
|
|
36
|
-
}
|
|
37
|
-
if (item && item.nextElementSibling) {
|
|
38
|
-
return item.nextElementSibling;
|
|
39
|
-
}
|
|
40
|
-
return list.firstChild;
|
|
41
|
-
};
|
|
42
|
-
const previousItem = (list, item) => {
|
|
43
|
-
if (list === item) {
|
|
44
|
-
return list.lastChild;
|
|
45
|
-
}
|
|
46
|
-
if (item && item.previousElementSibling) {
|
|
47
|
-
return item.previousElementSibling;
|
|
48
|
-
}
|
|
49
|
-
return list.lastChild;
|
|
50
|
-
};
|
|
51
|
-
const moveFocus = (list, currentFocus, traversalFunction) => {
|
|
52
|
-
let wrappedOnce = false;
|
|
53
|
-
let nextFocus = traversalFunction(list, currentFocus);
|
|
54
|
-
while (nextFocus) {
|
|
55
|
-
// Prevent infinite loop.
|
|
56
|
-
if (nextFocus === list.firstChild) {
|
|
57
|
-
if (wrappedOnce) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
wrappedOnce = true;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Same logic as useAutocomplete.js
|
|
64
|
-
const nextFocusDisabled = nextFocus.disabled || nextFocus.getAttribute('aria-disabled') === 'true';
|
|
65
|
-
if (!nextFocus.hasAttribute('tabindex') || nextFocusDisabled) {
|
|
66
|
-
// Move to the next element.
|
|
67
|
-
nextFocus = traversalFunction(list, nextFocus);
|
|
68
|
-
} else {
|
|
69
|
-
nextFocus.focus();
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
32
|
const useUtilityClasses = ownerState => {
|
|
75
33
|
const {
|
|
76
34
|
vertical,
|
|
@@ -673,20 +631,37 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
673
631
|
const indicator = /*#__PURE__*/(0, _jsxRuntime.jsx)(IndicatorSlot, {
|
|
674
632
|
...indicatorSlotProps
|
|
675
633
|
});
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
679
|
-
return null;
|
|
680
|
-
}
|
|
634
|
+
const validChildren = React.Children.toArray(childrenProp).filter(React.isValidElement).map((child, index) => {
|
|
635
|
+
const childValue = child.props.value === undefined ? index : child.props.value;
|
|
681
636
|
if (process.env.NODE_ENV !== 'production') {
|
|
682
637
|
if ((0, _reactIs.isFragment)(child)) {
|
|
683
638
|
console.error(["MUI: The Tabs component doesn't accept a Fragment as a child.", 'Consider providing an array instead.'].join('\n'));
|
|
684
639
|
}
|
|
685
640
|
}
|
|
686
|
-
|
|
687
|
-
|
|
641
|
+
valueToIndex.set(childValue, index);
|
|
642
|
+
return {
|
|
643
|
+
child,
|
|
644
|
+
index,
|
|
645
|
+
childValue
|
|
646
|
+
};
|
|
647
|
+
});
|
|
648
|
+
const focusableIndex = valueToIndex.get(value);
|
|
649
|
+
const {
|
|
650
|
+
getContainerProps,
|
|
651
|
+
getItemProps
|
|
652
|
+
} = (0, _utils.useRovingTabIndex)({
|
|
653
|
+
focusableIndex,
|
|
654
|
+
orientation,
|
|
655
|
+
isRtl
|
|
656
|
+
});
|
|
657
|
+
const rovingTabIndexContainerProps = getContainerProps();
|
|
658
|
+
const children = validChildren.map(({
|
|
659
|
+
child,
|
|
660
|
+
index,
|
|
661
|
+
childValue
|
|
662
|
+
}) => {
|
|
688
663
|
const selected = childValue === value;
|
|
689
|
-
|
|
664
|
+
const rovingTabIndexItemProps = getItemProps(index, child.ref);
|
|
690
665
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
691
666
|
fullWidth: variant === 'fullWidth',
|
|
692
667
|
indicator: selected && !mounted && indicator,
|
|
@@ -695,53 +670,10 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
695
670
|
onChange,
|
|
696
671
|
textColor,
|
|
697
672
|
value: childValue,
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
} : {})
|
|
673
|
+
ref: rovingTabIndexItemProps.ref,
|
|
674
|
+
tabIndex: child.props.tabIndex ?? rovingTabIndexItemProps.tabIndex
|
|
701
675
|
});
|
|
702
676
|
});
|
|
703
|
-
const handleKeyDown = event => {
|
|
704
|
-
// Check if a modifier key (Alt, Shift, Ctrl, Meta) is pressed
|
|
705
|
-
if (event.altKey || event.shiftKey || event.ctrlKey || event.metaKey) {
|
|
706
|
-
return;
|
|
707
|
-
}
|
|
708
|
-
const list = tabListRef.current;
|
|
709
|
-
const currentFocus = (0, _getActiveElement.default)((0, _ownerDocument.default)(list));
|
|
710
|
-
// Keyboard navigation assumes that [role="tab"] are siblings
|
|
711
|
-
// though we might warn in the future about nested, interactive elements
|
|
712
|
-
// as a a11y violation
|
|
713
|
-
const role = currentFocus?.getAttribute('role');
|
|
714
|
-
if (role !== 'tab') {
|
|
715
|
-
return;
|
|
716
|
-
}
|
|
717
|
-
let previousItemKey = orientation === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';
|
|
718
|
-
let nextItemKey = orientation === 'horizontal' ? 'ArrowRight' : 'ArrowDown';
|
|
719
|
-
if (orientation === 'horizontal' && isRtl) {
|
|
720
|
-
// swap previousItemKey with nextItemKey
|
|
721
|
-
previousItemKey = 'ArrowRight';
|
|
722
|
-
nextItemKey = 'ArrowLeft';
|
|
723
|
-
}
|
|
724
|
-
switch (event.key) {
|
|
725
|
-
case previousItemKey:
|
|
726
|
-
event.preventDefault();
|
|
727
|
-
moveFocus(list, currentFocus, previousItem);
|
|
728
|
-
break;
|
|
729
|
-
case nextItemKey:
|
|
730
|
-
event.preventDefault();
|
|
731
|
-
moveFocus(list, currentFocus, nextItem);
|
|
732
|
-
break;
|
|
733
|
-
case 'Home':
|
|
734
|
-
event.preventDefault();
|
|
735
|
-
moveFocus(list, null, nextItem);
|
|
736
|
-
break;
|
|
737
|
-
case 'End':
|
|
738
|
-
event.preventDefault();
|
|
739
|
-
moveFocus(list, null, previousItem);
|
|
740
|
-
break;
|
|
741
|
-
default:
|
|
742
|
-
break;
|
|
743
|
-
}
|
|
744
|
-
};
|
|
745
677
|
const conditionalElements = getConditionalElements();
|
|
746
678
|
const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
|
|
747
679
|
ref,
|
|
@@ -767,8 +699,21 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
767
699
|
}
|
|
768
700
|
}
|
|
769
701
|
});
|
|
702
|
+
const mergedRef = (0, _utils.useForkRef)(rovingTabIndexContainerProps.ref, tabListRef);
|
|
703
|
+
const handleKeyDown = event => {
|
|
704
|
+
const list = tabListRef.current;
|
|
705
|
+
const currentFocus = (0, _utils.getActiveElement)((0, _utils.ownerDocument)(list));
|
|
706
|
+
// Keyboard navigation assumes that [role="tab"] are siblings
|
|
707
|
+
// though we might warn in the future about nested, interactive elements
|
|
708
|
+
// as a a11y violation
|
|
709
|
+
const role = currentFocus?.getAttribute('role');
|
|
710
|
+
if (role !== 'tab') {
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
rovingTabIndexContainerProps.onKeyDown(event);
|
|
714
|
+
};
|
|
770
715
|
const [ListSlot, listSlotProps] = (0, _useSlot.default)('list', {
|
|
771
|
-
ref:
|
|
716
|
+
ref: mergedRef,
|
|
772
717
|
className: (0, _clsx.default)(classes.list, classes.flexContainer),
|
|
773
718
|
elementType: List,
|
|
774
719
|
externalForwardedProps,
|
|
@@ -778,6 +723,10 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
778
723
|
onKeyDown: event => {
|
|
779
724
|
handleKeyDown(event);
|
|
780
725
|
handlers.onKeyDown?.(event);
|
|
726
|
+
},
|
|
727
|
+
onFocus: event => {
|
|
728
|
+
rovingTabIndexContainerProps.onFocus(event);
|
|
729
|
+
handlers.onFocus?.(event);
|
|
781
730
|
}
|
|
782
731
|
})
|
|
783
732
|
});
|
package/Tabs/Tabs.mjs
CHANGED
|
@@ -17,53 +17,11 @@ import ScrollbarSize from "./ScrollbarSize.mjs";
|
|
|
17
17
|
import TabScrollButton from "../TabScrollButton/index.mjs";
|
|
18
18
|
import useEventCallback from "../utils/useEventCallback.mjs";
|
|
19
19
|
import tabsClasses, { getTabsUtilityClass } from "./tabsClasses.mjs";
|
|
20
|
-
import ownerDocument from "../utils/ownerDocument.mjs";
|
|
21
20
|
import ownerWindow from "../utils/ownerWindow.mjs";
|
|
22
|
-
import getActiveElement from "../utils/getActiveElement.mjs";
|
|
23
21
|
import isLayoutSupported from "../utils/isLayoutSupported.mjs";
|
|
24
22
|
import useSlot from "../utils/useSlot.mjs";
|
|
23
|
+
import { ownerDocument, useForkRef, getActiveElement, useRovingTabIndex } from "../utils/index.mjs";
|
|
25
24
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
-
const nextItem = (list, item) => {
|
|
27
|
-
if (list === item) {
|
|
28
|
-
return list.firstChild;
|
|
29
|
-
}
|
|
30
|
-
if (item && item.nextElementSibling) {
|
|
31
|
-
return item.nextElementSibling;
|
|
32
|
-
}
|
|
33
|
-
return list.firstChild;
|
|
34
|
-
};
|
|
35
|
-
const previousItem = (list, item) => {
|
|
36
|
-
if (list === item) {
|
|
37
|
-
return list.lastChild;
|
|
38
|
-
}
|
|
39
|
-
if (item && item.previousElementSibling) {
|
|
40
|
-
return item.previousElementSibling;
|
|
41
|
-
}
|
|
42
|
-
return list.lastChild;
|
|
43
|
-
};
|
|
44
|
-
const moveFocus = (list, currentFocus, traversalFunction) => {
|
|
45
|
-
let wrappedOnce = false;
|
|
46
|
-
let nextFocus = traversalFunction(list, currentFocus);
|
|
47
|
-
while (nextFocus) {
|
|
48
|
-
// Prevent infinite loop.
|
|
49
|
-
if (nextFocus === list.firstChild) {
|
|
50
|
-
if (wrappedOnce) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
wrappedOnce = true;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Same logic as useAutocomplete.js
|
|
57
|
-
const nextFocusDisabled = nextFocus.disabled || nextFocus.getAttribute('aria-disabled') === 'true';
|
|
58
|
-
if (!nextFocus.hasAttribute('tabindex') || nextFocusDisabled) {
|
|
59
|
-
// Move to the next element.
|
|
60
|
-
nextFocus = traversalFunction(list, nextFocus);
|
|
61
|
-
} else {
|
|
62
|
-
nextFocus.focus();
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
25
|
const useUtilityClasses = ownerState => {
|
|
68
26
|
const {
|
|
69
27
|
vertical,
|
|
@@ -666,20 +624,37 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
666
624
|
const indicator = /*#__PURE__*/_jsx(IndicatorSlot, {
|
|
667
625
|
...indicatorSlotProps
|
|
668
626
|
});
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
672
|
-
return null;
|
|
673
|
-
}
|
|
627
|
+
const validChildren = React.Children.toArray(childrenProp).filter(React.isValidElement).map((child, index) => {
|
|
628
|
+
const childValue = child.props.value === undefined ? index : child.props.value;
|
|
674
629
|
if (process.env.NODE_ENV !== 'production') {
|
|
675
630
|
if (isFragment(child)) {
|
|
676
631
|
console.error(["MUI: The Tabs component doesn't accept a Fragment as a child.", 'Consider providing an array instead.'].join('\n'));
|
|
677
632
|
}
|
|
678
633
|
}
|
|
679
|
-
|
|
680
|
-
|
|
634
|
+
valueToIndex.set(childValue, index);
|
|
635
|
+
return {
|
|
636
|
+
child,
|
|
637
|
+
index,
|
|
638
|
+
childValue
|
|
639
|
+
};
|
|
640
|
+
});
|
|
641
|
+
const focusableIndex = valueToIndex.get(value);
|
|
642
|
+
const {
|
|
643
|
+
getContainerProps,
|
|
644
|
+
getItemProps
|
|
645
|
+
} = useRovingTabIndex({
|
|
646
|
+
focusableIndex,
|
|
647
|
+
orientation,
|
|
648
|
+
isRtl
|
|
649
|
+
});
|
|
650
|
+
const rovingTabIndexContainerProps = getContainerProps();
|
|
651
|
+
const children = validChildren.map(({
|
|
652
|
+
child,
|
|
653
|
+
index,
|
|
654
|
+
childValue
|
|
655
|
+
}) => {
|
|
681
656
|
const selected = childValue === value;
|
|
682
|
-
|
|
657
|
+
const rovingTabIndexItemProps = getItemProps(index, child.ref);
|
|
683
658
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
684
659
|
fullWidth: variant === 'fullWidth',
|
|
685
660
|
indicator: selected && !mounted && indicator,
|
|
@@ -688,53 +663,10 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
688
663
|
onChange,
|
|
689
664
|
textColor,
|
|
690
665
|
value: childValue,
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
} : {})
|
|
666
|
+
ref: rovingTabIndexItemProps.ref,
|
|
667
|
+
tabIndex: child.props.tabIndex ?? rovingTabIndexItemProps.tabIndex
|
|
694
668
|
});
|
|
695
669
|
});
|
|
696
|
-
const handleKeyDown = event => {
|
|
697
|
-
// Check if a modifier key (Alt, Shift, Ctrl, Meta) is pressed
|
|
698
|
-
if (event.altKey || event.shiftKey || event.ctrlKey || event.metaKey) {
|
|
699
|
-
return;
|
|
700
|
-
}
|
|
701
|
-
const list = tabListRef.current;
|
|
702
|
-
const currentFocus = getActiveElement(ownerDocument(list));
|
|
703
|
-
// Keyboard navigation assumes that [role="tab"] are siblings
|
|
704
|
-
// though we might warn in the future about nested, interactive elements
|
|
705
|
-
// as a a11y violation
|
|
706
|
-
const role = currentFocus?.getAttribute('role');
|
|
707
|
-
if (role !== 'tab') {
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
let previousItemKey = orientation === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';
|
|
711
|
-
let nextItemKey = orientation === 'horizontal' ? 'ArrowRight' : 'ArrowDown';
|
|
712
|
-
if (orientation === 'horizontal' && isRtl) {
|
|
713
|
-
// swap previousItemKey with nextItemKey
|
|
714
|
-
previousItemKey = 'ArrowRight';
|
|
715
|
-
nextItemKey = 'ArrowLeft';
|
|
716
|
-
}
|
|
717
|
-
switch (event.key) {
|
|
718
|
-
case previousItemKey:
|
|
719
|
-
event.preventDefault();
|
|
720
|
-
moveFocus(list, currentFocus, previousItem);
|
|
721
|
-
break;
|
|
722
|
-
case nextItemKey:
|
|
723
|
-
event.preventDefault();
|
|
724
|
-
moveFocus(list, currentFocus, nextItem);
|
|
725
|
-
break;
|
|
726
|
-
case 'Home':
|
|
727
|
-
event.preventDefault();
|
|
728
|
-
moveFocus(list, null, nextItem);
|
|
729
|
-
break;
|
|
730
|
-
case 'End':
|
|
731
|
-
event.preventDefault();
|
|
732
|
-
moveFocus(list, null, previousItem);
|
|
733
|
-
break;
|
|
734
|
-
default:
|
|
735
|
-
break;
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
670
|
const conditionalElements = getConditionalElements();
|
|
739
671
|
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
740
672
|
ref,
|
|
@@ -760,8 +692,21 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
760
692
|
}
|
|
761
693
|
}
|
|
762
694
|
});
|
|
695
|
+
const mergedRef = useForkRef(rovingTabIndexContainerProps.ref, tabListRef);
|
|
696
|
+
const handleKeyDown = event => {
|
|
697
|
+
const list = tabListRef.current;
|
|
698
|
+
const currentFocus = getActiveElement(ownerDocument(list));
|
|
699
|
+
// Keyboard navigation assumes that [role="tab"] are siblings
|
|
700
|
+
// though we might warn in the future about nested, interactive elements
|
|
701
|
+
// as a a11y violation
|
|
702
|
+
const role = currentFocus?.getAttribute('role');
|
|
703
|
+
if (role !== 'tab') {
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
rovingTabIndexContainerProps.onKeyDown(event);
|
|
707
|
+
};
|
|
763
708
|
const [ListSlot, listSlotProps] = useSlot('list', {
|
|
764
|
-
ref:
|
|
709
|
+
ref: mergedRef,
|
|
765
710
|
className: clsx(classes.list, classes.flexContainer),
|
|
766
711
|
elementType: List,
|
|
767
712
|
externalForwardedProps,
|
|
@@ -771,6 +716,10 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
771
716
|
onKeyDown: event => {
|
|
772
717
|
handleKeyDown(event);
|
|
773
718
|
handlers.onKeyDown?.(event);
|
|
719
|
+
},
|
|
720
|
+
onFocus: event => {
|
|
721
|
+
rovingTabIndexContainerProps.onFocus(event);
|
|
722
|
+
handlers.onFocus?.(event);
|
|
774
723
|
}
|
|
775
724
|
})
|
|
776
725
|
});
|
|
@@ -86,6 +86,7 @@ export interface TypographyTypeMap<AdditionalProps = {}, RootComponent extends R
|
|
|
86
86
|
* Demos:
|
|
87
87
|
*
|
|
88
88
|
* - [Breadcrumbs](https://next.mui.com/material-ui/react-breadcrumbs/)
|
|
89
|
+
* - [Menubar](https://next.mui.com/material-ui/react-menubar/)
|
|
89
90
|
* - [Typography](https://next.mui.com/material-ui/react-typography/)
|
|
90
91
|
*
|
|
91
92
|
* API:
|
|
@@ -86,6 +86,7 @@ export interface TypographyTypeMap<AdditionalProps = {}, RootComponent extends R
|
|
|
86
86
|
* Demos:
|
|
87
87
|
*
|
|
88
88
|
* - [Breadcrumbs](https://next.mui.com/material-ui/react-breadcrumbs/)
|
|
89
|
+
* - [Menubar](https://next.mui.com/material-ui/react-menubar/)
|
|
89
90
|
* - [Typography](https://next.mui.com/material-ui/react-typography/)
|
|
90
91
|
*
|
|
91
92
|
* API:
|
package/index.js
CHANGED
package/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/material",
|
|
3
|
-
"version": "9.0.0-alpha.
|
|
3
|
+
"version": "9.0.0-alpha.3",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
|
|
6
6
|
"keywords": [
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"prop-types": "^15.8.1",
|
|
34
34
|
"react-is": "^19.2.4",
|
|
35
35
|
"react-transition-group": "^4.4.5",
|
|
36
|
-
"@mui/core-downloads-tracker": "^9.0.0-alpha.
|
|
37
|
-
"@mui/
|
|
38
|
-
"@mui/utils": "9.0.0-alpha.
|
|
39
|
-
"@mui/
|
|
36
|
+
"@mui/core-downloads-tracker": "^9.0.0-alpha.3",
|
|
37
|
+
"@mui/system": "9.0.0-alpha.3",
|
|
38
|
+
"@mui/utils": "9.0.0-alpha.3",
|
|
39
|
+
"@mui/types": "^9.0.0-alpha.3"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@emotion/react": "^11.5.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
45
45
|
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
46
46
|
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
47
|
-
"@mui/material-pigment-css": "9.0.0-alpha.
|
|
47
|
+
"@mui/material-pigment-css": "9.0.0-alpha.3"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"@types/react": {
|
|
@@ -320,6 +320,20 @@
|
|
|
320
320
|
"default": "./PigmentStack/index.mjs"
|
|
321
321
|
}
|
|
322
322
|
},
|
|
323
|
+
"./themeCssVarsAugmentation": {
|
|
324
|
+
"import": {
|
|
325
|
+
"types": "./themeCssVarsAugmentation/index.d.mts",
|
|
326
|
+
"default": "./themeCssVarsAugmentation/index.mjs"
|
|
327
|
+
},
|
|
328
|
+
"require": {
|
|
329
|
+
"types": "./themeCssVarsAugmentation/index.d.ts",
|
|
330
|
+
"default": "./themeCssVarsAugmentation/index.js"
|
|
331
|
+
},
|
|
332
|
+
"default": {
|
|
333
|
+
"types": "./themeCssVarsAugmentation/index.d.mts",
|
|
334
|
+
"default": "./themeCssVarsAugmentation/index.mjs"
|
|
335
|
+
}
|
|
336
|
+
},
|
|
323
337
|
"./transitions": {
|
|
324
338
|
"import": {
|
|
325
339
|
"types": "./transitions/index.d.mts",
|
|
@@ -134,6 +134,7 @@ function useAutocomplete(props) {
|
|
|
134
134
|
const firstFocus = React.useRef(true);
|
|
135
135
|
const inputRef = React.useRef(null);
|
|
136
136
|
const listboxRef = React.useRef(null);
|
|
137
|
+
const windowLostFocus = React.useRef(false);
|
|
137
138
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
138
139
|
const [focusedItem, setFocusedItem] = React.useState(-1);
|
|
139
140
|
const defaultHighlighted = autoHighlight ? 0 : -1;
|
|
@@ -498,6 +499,21 @@ function useAutocomplete(props) {
|
|
|
498
499
|
syncHighlightedIndex();
|
|
499
500
|
}
|
|
500
501
|
}, [syncHighlightedIndex, filteredOptionsChanged, popupOpen, disableCloseOnSelect]);
|
|
502
|
+
|
|
503
|
+
// Listen for browser window blur to detect when the user switches tabs or windows.
|
|
504
|
+
// This helps prevent the popup from reopening automatically when the window regains focus.
|
|
505
|
+
React.useEffect(() => {
|
|
506
|
+
if (typeof window === 'undefined') {
|
|
507
|
+
return undefined;
|
|
508
|
+
}
|
|
509
|
+
const handleWindowBlur = () => {
|
|
510
|
+
windowLostFocus.current = true;
|
|
511
|
+
};
|
|
512
|
+
window.addEventListener('blur', handleWindowBlur);
|
|
513
|
+
return () => {
|
|
514
|
+
window.removeEventListener('blur', handleWindowBlur);
|
|
515
|
+
};
|
|
516
|
+
}, []);
|
|
501
517
|
const handleOpen = event => {
|
|
502
518
|
if (open) {
|
|
503
519
|
return;
|
|
@@ -833,6 +849,14 @@ function useAutocomplete(props) {
|
|
|
833
849
|
// Ensure DOM focus lands on the input
|
|
834
850
|
focusItem(-1);
|
|
835
851
|
}
|
|
852
|
+
|
|
853
|
+
// If the window previously lost focus while the popup was open,
|
|
854
|
+
// ignore this focus event to prevent unintended reopening.
|
|
855
|
+
// Reset the flag so normal focus behavior resumes.
|
|
856
|
+
if (windowLostFocus.current) {
|
|
857
|
+
windowLostFocus.current = false;
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
836
860
|
if (openOnFocus && !ignoreFocus.current) {
|
|
837
861
|
handleOpen(event);
|
|
838
862
|
}
|
|
@@ -126,6 +126,7 @@ function useAutocomplete(props) {
|
|
|
126
126
|
const firstFocus = React.useRef(true);
|
|
127
127
|
const inputRef = React.useRef(null);
|
|
128
128
|
const listboxRef = React.useRef(null);
|
|
129
|
+
const windowLostFocus = React.useRef(false);
|
|
129
130
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
130
131
|
const [focusedItem, setFocusedItem] = React.useState(-1);
|
|
131
132
|
const defaultHighlighted = autoHighlight ? 0 : -1;
|
|
@@ -490,6 +491,21 @@ function useAutocomplete(props) {
|
|
|
490
491
|
syncHighlightedIndex();
|
|
491
492
|
}
|
|
492
493
|
}, [syncHighlightedIndex, filteredOptionsChanged, popupOpen, disableCloseOnSelect]);
|
|
494
|
+
|
|
495
|
+
// Listen for browser window blur to detect when the user switches tabs or windows.
|
|
496
|
+
// This helps prevent the popup from reopening automatically when the window regains focus.
|
|
497
|
+
React.useEffect(() => {
|
|
498
|
+
if (typeof window === 'undefined') {
|
|
499
|
+
return undefined;
|
|
500
|
+
}
|
|
501
|
+
const handleWindowBlur = () => {
|
|
502
|
+
windowLostFocus.current = true;
|
|
503
|
+
};
|
|
504
|
+
window.addEventListener('blur', handleWindowBlur);
|
|
505
|
+
return () => {
|
|
506
|
+
window.removeEventListener('blur', handleWindowBlur);
|
|
507
|
+
};
|
|
508
|
+
}, []);
|
|
493
509
|
const handleOpen = event => {
|
|
494
510
|
if (open) {
|
|
495
511
|
return;
|
|
@@ -825,6 +841,14 @@ function useAutocomplete(props) {
|
|
|
825
841
|
// Ensure DOM focus lands on the input
|
|
826
842
|
focusItem(-1);
|
|
827
843
|
}
|
|
844
|
+
|
|
845
|
+
// If the window previously lost focus while the popup was open,
|
|
846
|
+
// ignore this focus event to prevent unintended reopening.
|
|
847
|
+
// Reset the flag so normal focus behavior resumes.
|
|
848
|
+
if (windowLostFocus.current) {
|
|
849
|
+
windowLostFocus.current = false;
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
828
852
|
if (openOnFocus && !ignoreFocus.current) {
|
|
829
853
|
handleOpen(event);
|
|
830
854
|
}
|
package/utils/index.d.mts
CHANGED
|
@@ -5,6 +5,7 @@ export { default as createSvgIcon } from "./createSvgIcon.mjs";
|
|
|
5
5
|
export { default as debounce } from "./debounce.mjs";
|
|
6
6
|
export { default as deprecatedPropType } from "./deprecatedPropType.mjs";
|
|
7
7
|
export { default as isMuiElement } from "./isMuiElement.mjs";
|
|
8
|
+
export { default as getActiveElement } from "./getActiveElement.mjs";
|
|
8
9
|
export { default as unstable_memoTheme } from "./memoTheme.mjs";
|
|
9
10
|
export { default as ownerDocument } from "./ownerDocument.mjs";
|
|
10
11
|
export { default as ownerWindow } from "./ownerWindow.mjs";
|
|
@@ -15,6 +16,7 @@ export { default as unstable_useId } from "./useId.mjs";
|
|
|
15
16
|
export { default as unsupportedProp } from "./unsupportedProp.mjs";
|
|
16
17
|
export { default as useControlled } from "./useControlled.mjs";
|
|
17
18
|
export { default as useEventCallback } from "./useEventCallback.mjs";
|
|
19
|
+
export { default as useRovingTabIndex } from "./useRovingTabIndex.mjs";
|
|
18
20
|
export { default as useForkRef } from "./useForkRef.mjs";
|
|
19
21
|
export { default as mergeSlotProps } from "./mergeSlotProps.mjs";
|
|
20
22
|
export * from "./types.mjs";
|
package/utils/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { default as createSvgIcon } from "./createSvgIcon.js";
|
|
|
5
5
|
export { default as debounce } from "./debounce.js";
|
|
6
6
|
export { default as deprecatedPropType } from "./deprecatedPropType.js";
|
|
7
7
|
export { default as isMuiElement } from "./isMuiElement.js";
|
|
8
|
+
export { default as getActiveElement } from "./getActiveElement.js";
|
|
8
9
|
export { default as unstable_memoTheme } from "./memoTheme.js";
|
|
9
10
|
export { default as ownerDocument } from "./ownerDocument.js";
|
|
10
11
|
export { default as ownerWindow } from "./ownerWindow.js";
|
|
@@ -15,6 +16,7 @@ export { default as unstable_useId } from "./useId.js";
|
|
|
15
16
|
export { default as unsupportedProp } from "./unsupportedProp.js";
|
|
16
17
|
export { default as useControlled } from "./useControlled.js";
|
|
17
18
|
export { default as useEventCallback } from "./useEventCallback.js";
|
|
19
|
+
export { default as useRovingTabIndex } from "./useRovingTabIndex.js";
|
|
18
20
|
export { default as useForkRef } from "./useForkRef.js";
|
|
19
21
|
export { default as mergeSlotProps } from "./mergeSlotProps.js";
|
|
20
22
|
export * from "./types.js";
|
package/utils/index.js
CHANGED
|
@@ -35,6 +35,12 @@ Object.defineProperty(exports, "deprecatedPropType", {
|
|
|
35
35
|
return _deprecatedPropType.default;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
+
Object.defineProperty(exports, "getActiveElement", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _getActiveElement.default;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
38
44
|
Object.defineProperty(exports, "isMuiElement", {
|
|
39
45
|
enumerable: true,
|
|
40
46
|
get: function () {
|
|
@@ -114,6 +120,12 @@ Object.defineProperty(exports, "useForkRef", {
|
|
|
114
120
|
return _useForkRef.default;
|
|
115
121
|
}
|
|
116
122
|
});
|
|
123
|
+
Object.defineProperty(exports, "useRovingTabIndex", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
get: function () {
|
|
126
|
+
return _useRovingTabIndex.default;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
117
129
|
var _ClassNameGenerator = _interopRequireDefault(require("@mui/utils/ClassNameGenerator"));
|
|
118
130
|
var _capitalize = _interopRequireDefault(require("./capitalize"));
|
|
119
131
|
var _createChainedFunction = _interopRequireDefault(require("./createChainedFunction"));
|
|
@@ -121,6 +133,7 @@ var _createSvgIcon = _interopRequireDefault(require("./createSvgIcon"));
|
|
|
121
133
|
var _debounce = _interopRequireDefault(require("./debounce"));
|
|
122
134
|
var _deprecatedPropType = _interopRequireDefault(require("./deprecatedPropType"));
|
|
123
135
|
var _isMuiElement = _interopRequireDefault(require("./isMuiElement"));
|
|
136
|
+
var _getActiveElement = _interopRequireDefault(require("./getActiveElement"));
|
|
124
137
|
var _memoTheme = _interopRequireDefault(require("./memoTheme"));
|
|
125
138
|
var _ownerDocument = _interopRequireDefault(require("./ownerDocument"));
|
|
126
139
|
var _ownerWindow = _interopRequireDefault(require("./ownerWindow"));
|
|
@@ -131,6 +144,7 @@ var _useId = _interopRequireDefault(require("./useId"));
|
|
|
131
144
|
var _unsupportedProp = _interopRequireDefault(require("./unsupportedProp"));
|
|
132
145
|
var _useControlled = _interopRequireDefault(require("./useControlled"));
|
|
133
146
|
var _useEventCallback = _interopRequireDefault(require("./useEventCallback"));
|
|
147
|
+
var _useRovingTabIndex = _interopRequireDefault(require("./useRovingTabIndex"));
|
|
134
148
|
var _useForkRef = _interopRequireDefault(require("./useForkRef"));
|
|
135
149
|
var _mergeSlotProps = _interopRequireDefault(require("./mergeSlotProps"));
|
|
136
150
|
// TODO: remove this export once ClassNameGenerator is stable
|
package/utils/index.mjs
CHANGED
|
@@ -7,6 +7,7 @@ export { default as createSvgIcon } from "./createSvgIcon.mjs";
|
|
|
7
7
|
export { default as debounce } from "./debounce.mjs";
|
|
8
8
|
export { default as deprecatedPropType } from "./deprecatedPropType.mjs";
|
|
9
9
|
export { default as isMuiElement } from "./isMuiElement.mjs";
|
|
10
|
+
export { default as getActiveElement } from "./getActiveElement.mjs";
|
|
10
11
|
export { default as unstable_memoTheme } from "./memoTheme.mjs";
|
|
11
12
|
export { default as ownerDocument } from "./ownerDocument.mjs";
|
|
12
13
|
export { default as ownerWindow } from "./ownerWindow.mjs";
|
|
@@ -17,6 +18,7 @@ export { default as unstable_useId } from "./useId.mjs";
|
|
|
17
18
|
export { default as unsupportedProp } from "./unsupportedProp.mjs";
|
|
18
19
|
export { default as useControlled } from "./useControlled.mjs";
|
|
19
20
|
export { default as useEventCallback } from "./useEventCallback.mjs";
|
|
21
|
+
export { default as useRovingTabIndex } from "./useRovingTabIndex.mjs";
|
|
20
22
|
export { default as useForkRef } from "./useForkRef.mjs";
|
|
21
23
|
export { default as mergeSlotProps } from "./mergeSlotProps.mjs";
|
|
22
24
|
// TODO: remove this export once ClassNameGenerator is stable
|