@mui/material 9.0.0-beta.0 → 9.0.0-beta.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/Accordion/Accordion.d.mts +1 -1
- package/Accordion/Accordion.d.ts +1 -1
- package/AccordionSummary/AccordionSummary.js +1 -0
- package/AccordionSummary/AccordionSummary.mjs +1 -0
- package/Backdrop/Backdrop.d.mts +1 -1
- package/Backdrop/Backdrop.d.ts +1 -1
- package/BottomNavigationAction/BottomNavigationAction.js +1 -0
- package/BottomNavigationAction/BottomNavigationAction.mjs +1 -0
- package/Breadcrumbs/BreadcrumbCollapsed.js +5 -1
- package/Breadcrumbs/BreadcrumbCollapsed.mjs +5 -1
- package/Button/Button.js +1 -0
- package/Button/Button.mjs +1 -0
- package/ButtonBase/ButtonBase.d.mts +5 -0
- package/ButtonBase/ButtonBase.d.ts +5 -0
- package/ButtonBase/ButtonBase.js +84 -85
- package/ButtonBase/ButtonBase.mjs +84 -85
- package/ButtonBase/useButtonBase.d.mts +91 -0
- package/ButtonBase/useButtonBase.d.ts +91 -0
- package/ButtonBase/useButtonBase.js +174 -0
- package/ButtonBase/useButtonBase.mjs +167 -0
- package/CHANGELOG.md +48 -0
- package/CardActionArea/CardActionArea.js +1 -0
- package/CardActionArea/CardActionArea.mjs +1 -0
- package/Chip/Chip.d.mts +7 -0
- package/Chip/Chip.d.ts +7 -0
- package/Chip/Chip.js +18 -1
- package/Chip/Chip.mjs +18 -1
- package/Dialog/Dialog.d.mts +8 -1
- package/Dialog/Dialog.d.ts +8 -1
- package/Dialog/Dialog.js +9 -1
- package/Dialog/Dialog.mjs +9 -1
- package/Divider/Divider.js +0 -8
- package/Divider/Divider.mjs +0 -8
- package/Drawer/Drawer.d.mts +1 -1
- package/Drawer/Drawer.d.ts +1 -1
- package/Fab/Fab.js +1 -0
- package/Fab/Fab.mjs +1 -0
- package/FilledInput/FilledInput.js +1 -1
- package/FilledInput/FilledInput.mjs +1 -1
- package/Grid/Grid.d.mts +8 -3
- package/Grid/Grid.d.ts +8 -3
- package/Grid/Grid.js +8 -3
- package/Grid/Grid.mjs +8 -3
- package/Grid/gridClasses.js +1 -1
- package/Grid/gridClasses.mjs +1 -1
- package/IconButton/IconButton.js +1 -0
- package/IconButton/IconButton.mjs +1 -0
- package/Input/Input.js +1 -1
- package/Input/Input.mjs +1 -1
- package/InputAdornment/inputAdornmentClasses.d.mts +2 -2
- package/InputAdornment/inputAdornmentClasses.d.ts +2 -2
- package/ListItemButton/ListItemButton.js +1 -0
- package/ListItemButton/ListItemButton.mjs +1 -0
- package/ListItemIcon/ListItemIcon.js +1 -1
- package/ListItemIcon/ListItemIcon.mjs +1 -1
- package/ListSubheader/ListSubheader.js +0 -3
- package/ListSubheader/ListSubheader.mjs +0 -3
- package/Menu/Menu.d.mts +1 -1
- package/Menu/Menu.d.ts +1 -1
- package/Menu/Menu.js +15 -32
- package/Menu/Menu.mjs +15 -32
- package/MenuItem/MenuItem.js +36 -26
- package/MenuItem/MenuItem.mjs +34 -26
- package/MenuList/MenuList.js +136 -101
- package/MenuList/MenuList.mjs +135 -100
- package/MenuList/MenuListContext.d.mts +11 -0
- package/MenuList/MenuListContext.d.ts +11 -0
- package/MenuList/MenuListContext.js +25 -0
- package/MenuList/MenuListContext.mjs +19 -0
- package/PaginationItem/PaginationItem.d.mts +5 -0
- package/PaginationItem/PaginationItem.d.ts +5 -0
- package/PaginationItem/PaginationItem.js +6 -0
- package/PaginationItem/PaginationItem.mjs +6 -0
- package/PigmentGrid/PigmentGrid.d.mts +1 -1
- package/PigmentGrid/PigmentGrid.d.ts +1 -1
- package/PigmentGrid/PigmentGrid.js +1 -1
- package/PigmentGrid/PigmentGrid.mjs +1 -1
- package/Popover/Popover.d.mts +1 -1
- package/Popover/Popover.d.ts +1 -1
- package/Popover/Popover.js +19 -7
- package/Popover/Popover.mjs +18 -6
- package/Snackbar/Snackbar.d.mts +1 -1
- package/Snackbar/Snackbar.d.ts +1 -1
- package/SpeedDial/SpeedDial.d.mts +1 -1
- package/SpeedDial/SpeedDial.d.ts +1 -1
- package/StepButton/StepButton.js +44 -14
- package/StepButton/StepButton.mjs +44 -14
- package/StepContent/StepContent.d.mts +1 -1
- package/StepContent/StepContent.d.ts +1 -1
- package/Stepper/Stepper.js +54 -22
- package/Stepper/Stepper.mjs +54 -22
- package/Stepper/StepperContext.d.mts +0 -5
- package/Stepper/StepperContext.d.ts +0 -5
- package/Stepper/StepperContext.js +1 -2
- package/Stepper/StepperContext.mjs +0 -1
- package/Tab/Tab.js +17 -1
- package/Tab/Tab.mjs +17 -1
- package/TabScrollButton/TabScrollButton.d.mts +1 -1
- package/TabScrollButton/TabScrollButton.d.ts +1 -1
- package/TabScrollButton/TabScrollButton.js +6 -2
- package/TabScrollButton/TabScrollButton.mjs +6 -2
- package/TableSortLabel/TableSortLabel.js +4 -1
- package/TableSortLabel/TableSortLabel.mjs +4 -1
- package/Tabs/Tabs.js +30 -21
- package/Tabs/Tabs.mjs +29 -20
- package/ToggleButton/ToggleButton.js +1 -0
- package/ToggleButton/ToggleButton.mjs +1 -0
- package/Tooltip/Tooltip.d.mts +1 -1
- package/Tooltip/Tooltip.d.ts +1 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internal/SwitchBase.d.mts +2 -2
- package/internal/SwitchBase.d.ts +2 -2
- package/internal/SwitchBase.js +5 -1
- package/internal/SwitchBase.mjs +5 -1
- package/locale/psAF.js +1 -1
- package/locale/psAF.mjs +1 -1
- package/package.json +5 -5
- package/styles/createThemeWithVars.js +9 -9
- package/styles/createThemeWithVars.mjs +9 -9
- package/useAutocomplete/useAutocomplete.js +8 -0
- package/useAutocomplete/useAutocomplete.mjs +8 -0
- package/utils/focusWithVisible.js +24 -0
- package/utils/focusWithVisible.mjs +19 -0
- package/utils/index.d.mts +0 -1
- package/utils/index.d.ts +0 -1
- package/utils/index.js +0 -7
- package/utils/index.mjs +0 -1
- package/utils/useFocusableWhenDisabled.d.mts +30 -0
- package/utils/useFocusableWhenDisabled.d.ts +30 -0
- package/utils/useFocusableWhenDisabled.js +47 -0
- package/utils/useFocusableWhenDisabled.mjs +41 -0
- package/utils/useRovingTabIndex.d.mts +1 -2
- package/utils/useRovingTabIndex.d.ts +1 -2
- package/utils/useRovingTabIndex.js +25 -4
- package/utils/useRovingTabIndex.mjs +1 -2
- package/version/index.js +2 -2
- package/version/index.mjs +2 -2
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.MenuListContext = void 0;
|
|
9
|
+
exports.useMenuListContext = useMenuListContext;
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
/**
|
|
12
|
+
* @ignore - internal component.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const MenuListContext = exports.MenuListContext = /*#__PURE__*/React.createContext(undefined);
|
|
16
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
17
|
+
MenuListContext.displayName = 'MenuListContext';
|
|
18
|
+
}
|
|
19
|
+
function useMenuListContext() {
|
|
20
|
+
const context = React.useContext(MenuListContext);
|
|
21
|
+
if (context === undefined) {
|
|
22
|
+
throw new Error('MUI: MenuListContext is missing. MenuItems must be placed within Menu or MenuList.');
|
|
23
|
+
}
|
|
24
|
+
return context;
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @ignore - internal component.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const MenuListContext = /*#__PURE__*/React.createContext(undefined);
|
|
10
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
11
|
+
MenuListContext.displayName = 'MenuListContext';
|
|
12
|
+
}
|
|
13
|
+
export function useMenuListContext() {
|
|
14
|
+
const context = React.useContext(MenuListContext);
|
|
15
|
+
if (context === undefined) {
|
|
16
|
+
throw new Error('MUI: MenuListContext is missing. MenuItems must be placed within Menu or MenuList.');
|
|
17
|
+
}
|
|
18
|
+
return context;
|
|
19
|
+
}
|
|
@@ -71,6 +71,11 @@ export interface PaginationItemOwnProps extends PaginationItemSlotsAndSlotProps
|
|
|
71
71
|
* @default false
|
|
72
72
|
*/
|
|
73
73
|
disabled?: boolean | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Whether the custom component should render a native `<button>` element when
|
|
76
|
+
* rendering a React component with the `component` or `slots` prop.
|
|
77
|
+
*/
|
|
78
|
+
nativeButton?: boolean | undefined;
|
|
74
79
|
/**
|
|
75
80
|
* The current page number.
|
|
76
81
|
*/
|
|
@@ -71,6 +71,11 @@ export interface PaginationItemOwnProps extends PaginationItemSlotsAndSlotProps
|
|
|
71
71
|
* @default false
|
|
72
72
|
*/
|
|
73
73
|
disabled?: boolean | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Whether the custom component should render a native `<button>` element when
|
|
76
|
+
* rendering a React component with the `component` or `slots` prop.
|
|
77
|
+
*/
|
|
78
|
+
nativeButton?: boolean | undefined;
|
|
74
79
|
/**
|
|
75
80
|
* The current page number.
|
|
76
81
|
*/
|
|
@@ -355,6 +355,7 @@ const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inP
|
|
|
355
355
|
ref: ref,
|
|
356
356
|
ownerState: ownerState,
|
|
357
357
|
component: component,
|
|
358
|
+
internalNativeButton: true,
|
|
358
359
|
disabled: disabled,
|
|
359
360
|
className: (0, _clsx.default)(classes.root, className),
|
|
360
361
|
...other,
|
|
@@ -399,6 +400,11 @@ process.env.NODE_ENV !== "production" ? PaginationItem.propTypes /* remove-propt
|
|
|
399
400
|
* @default false
|
|
400
401
|
*/
|
|
401
402
|
disabled: _propTypes.default.bool,
|
|
403
|
+
/**
|
|
404
|
+
* Whether the custom component should render a native `<button>` element when
|
|
405
|
+
* rendering a React component with the `component` or `slots` prop.
|
|
406
|
+
*/
|
|
407
|
+
nativeButton: _propTypes.default.bool,
|
|
402
408
|
/**
|
|
403
409
|
* The current page number.
|
|
404
410
|
*/
|
|
@@ -348,6 +348,7 @@ const PaginationItem = /*#__PURE__*/React.forwardRef(function PaginationItem(inP
|
|
|
348
348
|
ref: ref,
|
|
349
349
|
ownerState: ownerState,
|
|
350
350
|
component: component,
|
|
351
|
+
internalNativeButton: true,
|
|
351
352
|
disabled: disabled,
|
|
352
353
|
className: clsx(classes.root, className),
|
|
353
354
|
...other,
|
|
@@ -392,6 +393,11 @@ process.env.NODE_ENV !== "production" ? PaginationItem.propTypes /* remove-propt
|
|
|
392
393
|
* @default false
|
|
393
394
|
*/
|
|
394
395
|
disabled: PropTypes.bool,
|
|
396
|
+
/**
|
|
397
|
+
* Whether the custom component should render a native `<button>` element when
|
|
398
|
+
* rendering a React component with the `component` or `slots` prop.
|
|
399
|
+
*/
|
|
400
|
+
nativeButton: PropTypes.bool,
|
|
395
401
|
/**
|
|
396
402
|
* The current page number.
|
|
397
403
|
*/
|
|
@@ -3,7 +3,7 @@ import { OverridableComponent, OverrideProps } from '@mui/types';
|
|
|
3
3
|
import { SxProps } from '@mui/system';
|
|
4
4
|
import { Breakpoint, Theme } from "../styles/index.mjs";
|
|
5
5
|
type ResponsiveStyleValue<T> = T | Array<T | null> | { [key in Breakpoint]?: T | null };
|
|
6
|
-
export type GridDirection = 'row' | 'row-reverse'
|
|
6
|
+
export type GridDirection = 'row' | 'row-reverse';
|
|
7
7
|
export type GridSpacing = number | string;
|
|
8
8
|
export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
9
9
|
export type GridSize = 'auto' | 'grow' | number;
|
|
@@ -3,7 +3,7 @@ import { OverridableComponent, OverrideProps } from '@mui/types';
|
|
|
3
3
|
import { SxProps } from '@mui/system';
|
|
4
4
|
import { Breakpoint, Theme } from "../styles/index.js";
|
|
5
5
|
type ResponsiveStyleValue<T> = T | Array<T | null> | { [key in Breakpoint]?: T | null };
|
|
6
|
-
export type GridDirection = 'row' | 'row-reverse'
|
|
6
|
+
export type GridDirection = 'row' | 'row-reverse';
|
|
7
7
|
export type GridSpacing = number | string;
|
|
8
8
|
export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
9
9
|
export type GridSize = 'auto' | 'grow' | number;
|
|
@@ -99,7 +99,7 @@ process.env.NODE_ENV !== "production" ? PigmentGrid.propTypes /* remove-proptype
|
|
|
99
99
|
* It is applied for all screen sizes.
|
|
100
100
|
* @default 'row'
|
|
101
101
|
*/
|
|
102
|
-
direction: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['
|
|
102
|
+
direction: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['row', 'row-reverse']), _propTypes.default.arrayOf(_propTypes.default.oneOf(['row', 'row-reverse'])), _propTypes.default.object]),
|
|
103
103
|
/**
|
|
104
104
|
* Defines the offset of the grid.
|
|
105
105
|
*/
|
|
@@ -91,7 +91,7 @@ process.env.NODE_ENV !== "production" ? PigmentGrid.propTypes /* remove-proptype
|
|
|
91
91
|
* It is applied for all screen sizes.
|
|
92
92
|
* @default 'row'
|
|
93
93
|
*/
|
|
94
|
-
direction: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['
|
|
94
|
+
direction: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['row', 'row-reverse']), PropTypes.arrayOf(PropTypes.oneOf(['row', 'row-reverse'])), PropTypes.object]),
|
|
95
95
|
/**
|
|
96
96
|
* Defines the offset of the grid.
|
|
97
97
|
*/
|
package/Popover/Popover.d.mts
CHANGED
|
@@ -52,7 +52,7 @@ export type PopoverSlotsAndSlotProps = CreateSlotsAndSlotProps<PopoverSlots, {
|
|
|
52
52
|
*/
|
|
53
53
|
transition: SlotComponentProps<
|
|
54
54
|
// use SlotComponentProps because transition slot does not support `component` and `sx` prop
|
|
55
|
-
React.ElementType
|
|
55
|
+
React.ElementType<TransitionProps>, TransitionProps & PopoverTransitionSlotPropsOverrides, PopoverOwnerState>;
|
|
56
56
|
/**
|
|
57
57
|
* Props forwarded to the backdrop slot.
|
|
58
58
|
* By default, the available props are based on the [Backdrop](https://mui.com/material-ui/api/backdrop/#props) component.
|
package/Popover/Popover.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export type PopoverSlotsAndSlotProps = CreateSlotsAndSlotProps<PopoverSlots, {
|
|
|
52
52
|
*/
|
|
53
53
|
transition: SlotComponentProps<
|
|
54
54
|
// use SlotComponentProps because transition slot does not support `component` and `sx` prop
|
|
55
|
-
React.ElementType
|
|
55
|
+
React.ElementType<TransitionProps>, TransitionProps & PopoverTransitionSlotPropsOverrides, PopoverOwnerState>;
|
|
56
56
|
/**
|
|
57
57
|
* Props forwarded to the backdrop slot.
|
|
58
58
|
* By default, the available props are based on the [Backdrop](https://mui.com/material-ui/api/backdrop/#props) component.
|
package/Popover/Popover.js
CHANGED
|
@@ -29,7 +29,7 @@ var _Modal = _interopRequireDefault(require("../Modal"));
|
|
|
29
29
|
var _Paper = _interopRequireDefault(require("../Paper"));
|
|
30
30
|
var _popoverClasses = require("./popoverClasses");
|
|
31
31
|
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
32
|
-
var
|
|
32
|
+
var _mergeSlotProps = _interopRequireDefault(require("../utils/mergeSlotProps"));
|
|
33
33
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
34
34
|
function getOffsetTop(rect, vertical) {
|
|
35
35
|
let offset = 0;
|
|
@@ -106,6 +106,7 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
106
106
|
children,
|
|
107
107
|
className,
|
|
108
108
|
container: containerProp,
|
|
109
|
+
disableAutoFocus = false,
|
|
109
110
|
elevation = 8,
|
|
110
111
|
marginThreshold = 16,
|
|
111
112
|
open,
|
|
@@ -199,11 +200,11 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
199
200
|
const widthThreshold = containerWindow.innerWidth - marginThreshold;
|
|
200
201
|
|
|
201
202
|
// Check if the vertical axis needs shifting
|
|
202
|
-
if (marginThreshold
|
|
203
|
+
if (marginThreshold != null && top < marginThreshold) {
|
|
203
204
|
const diff = top - marginThreshold;
|
|
204
205
|
top -= diff;
|
|
205
206
|
elemTransformOrigin.vertical += diff;
|
|
206
|
-
} else if (marginThreshold
|
|
207
|
+
} else if (marginThreshold != null && bottom > heightThreshold) {
|
|
207
208
|
const diff = bottom - heightThreshold;
|
|
208
209
|
top -= diff;
|
|
209
210
|
elemTransformOrigin.vertical += diff;
|
|
@@ -215,7 +216,7 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
215
216
|
}
|
|
216
217
|
|
|
217
218
|
// Check if the horizontal axis needs shifting
|
|
218
|
-
if (marginThreshold
|
|
219
|
+
if (marginThreshold != null && left < marginThreshold) {
|
|
219
220
|
const diff = left - marginThreshold;
|
|
220
221
|
left -= diff;
|
|
221
222
|
elemTransformOrigin.horizontal += diff;
|
|
@@ -237,10 +238,10 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
237
238
|
return;
|
|
238
239
|
}
|
|
239
240
|
const positioning = getPositioningStyle(element);
|
|
240
|
-
if (positioning.top
|
|
241
|
+
if (positioning.top != null) {
|
|
241
242
|
element.style.setProperty('top', positioning.top);
|
|
242
243
|
}
|
|
243
|
-
if (positioning.left
|
|
244
|
+
if (positioning.left != null) {
|
|
244
245
|
element.style.left = positioning.left;
|
|
245
246
|
}
|
|
246
247
|
element.style.transformOrigin = positioning.transformOrigin;
|
|
@@ -332,7 +333,7 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
332
333
|
backdrop: slots.backdrop
|
|
333
334
|
},
|
|
334
335
|
slotProps: {
|
|
335
|
-
backdrop: (0,
|
|
336
|
+
backdrop: (0, _mergeSlotProps.default)(typeof slotProps.backdrop === 'function' ? slotProps.backdrop(ownerState) : slotProps.backdrop, {
|
|
336
337
|
invisible: true
|
|
337
338
|
})
|
|
338
339
|
},
|
|
@@ -361,6 +362,7 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
361
362
|
...(!(0, _isHostComponent.default)(RootSlot) && {
|
|
362
363
|
slots: rootSlotsProp,
|
|
363
364
|
slotProps: rootSlotPropsProp,
|
|
365
|
+
disableAutoFocus,
|
|
364
366
|
disableScrollLock
|
|
365
367
|
}),
|
|
366
368
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionSlot, {
|
|
@@ -455,6 +457,16 @@ process.env.NODE_ENV !== "production" ? Popover.propTypes /* remove-proptypes */
|
|
|
455
457
|
* so it's simply `document.body` most of the time.
|
|
456
458
|
*/
|
|
457
459
|
container: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_HTMLElementType.default, _propTypes.default.func]),
|
|
460
|
+
/**
|
|
461
|
+
* If `true`, the modal will not automatically shift focus to itself when it opens, and
|
|
462
|
+
* replace it to the last focused element when it closes.
|
|
463
|
+
* This also works correctly with any modal children that have the `disableAutoFocus` prop.
|
|
464
|
+
*
|
|
465
|
+
* Generally this should never be set to `true` as it makes the modal less
|
|
466
|
+
* accessible to assistive technologies, like screen readers.
|
|
467
|
+
* @default false
|
|
468
|
+
*/
|
|
469
|
+
disableAutoFocus: _propTypes.default.bool,
|
|
458
470
|
/**
|
|
459
471
|
* Disable the scroll lock behavior.
|
|
460
472
|
* @default false
|
package/Popover/Popover.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import Modal from "../Modal/index.mjs";
|
|
|
20
20
|
import PaperBase from "../Paper/index.mjs";
|
|
21
21
|
import { getPopoverUtilityClass } from "./popoverClasses.mjs";
|
|
22
22
|
import useSlot from "../utils/useSlot.mjs";
|
|
23
|
-
import
|
|
23
|
+
import mergeSlotProps from "../utils/mergeSlotProps.mjs";
|
|
24
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
25
|
export function getOffsetTop(rect, vertical) {
|
|
26
26
|
let offset = 0;
|
|
@@ -97,6 +97,7 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
97
97
|
children,
|
|
98
98
|
className,
|
|
99
99
|
container: containerProp,
|
|
100
|
+
disableAutoFocus = false,
|
|
100
101
|
elevation = 8,
|
|
101
102
|
marginThreshold = 16,
|
|
102
103
|
open,
|
|
@@ -190,11 +191,11 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
190
191
|
const widthThreshold = containerWindow.innerWidth - marginThreshold;
|
|
191
192
|
|
|
192
193
|
// Check if the vertical axis needs shifting
|
|
193
|
-
if (marginThreshold
|
|
194
|
+
if (marginThreshold != null && top < marginThreshold) {
|
|
194
195
|
const diff = top - marginThreshold;
|
|
195
196
|
top -= diff;
|
|
196
197
|
elemTransformOrigin.vertical += diff;
|
|
197
|
-
} else if (marginThreshold
|
|
198
|
+
} else if (marginThreshold != null && bottom > heightThreshold) {
|
|
198
199
|
const diff = bottom - heightThreshold;
|
|
199
200
|
top -= diff;
|
|
200
201
|
elemTransformOrigin.vertical += diff;
|
|
@@ -206,7 +207,7 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
206
207
|
}
|
|
207
208
|
|
|
208
209
|
// Check if the horizontal axis needs shifting
|
|
209
|
-
if (marginThreshold
|
|
210
|
+
if (marginThreshold != null && left < marginThreshold) {
|
|
210
211
|
const diff = left - marginThreshold;
|
|
211
212
|
left -= diff;
|
|
212
213
|
elemTransformOrigin.horizontal += diff;
|
|
@@ -228,10 +229,10 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
228
229
|
return;
|
|
229
230
|
}
|
|
230
231
|
const positioning = getPositioningStyle(element);
|
|
231
|
-
if (positioning.top
|
|
232
|
+
if (positioning.top != null) {
|
|
232
233
|
element.style.setProperty('top', positioning.top);
|
|
233
234
|
}
|
|
234
|
-
if (positioning.left
|
|
235
|
+
if (positioning.left != null) {
|
|
235
236
|
element.style.left = positioning.left;
|
|
236
237
|
}
|
|
237
238
|
element.style.transformOrigin = positioning.transformOrigin;
|
|
@@ -352,6 +353,7 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(inProps, ref) {
|
|
|
352
353
|
...(!isHostComponent(RootSlot) && {
|
|
353
354
|
slots: rootSlotsProp,
|
|
354
355
|
slotProps: rootSlotPropsProp,
|
|
356
|
+
disableAutoFocus,
|
|
355
357
|
disableScrollLock
|
|
356
358
|
}),
|
|
357
359
|
children: /*#__PURE__*/_jsx(TransitionSlot, {
|
|
@@ -446,6 +448,16 @@ process.env.NODE_ENV !== "production" ? Popover.propTypes /* remove-proptypes */
|
|
|
446
448
|
* so it's simply `document.body` most of the time.
|
|
447
449
|
*/
|
|
448
450
|
container: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.func]),
|
|
451
|
+
/**
|
|
452
|
+
* If `true`, the modal will not automatically shift focus to itself when it opens, and
|
|
453
|
+
* replace it to the last focused element when it closes.
|
|
454
|
+
* This also works correctly with any modal children that have the `disableAutoFocus` prop.
|
|
455
|
+
*
|
|
456
|
+
* Generally this should never be set to `true` as it makes the modal less
|
|
457
|
+
* accessible to assistive technologies, like screen readers.
|
|
458
|
+
* @default false
|
|
459
|
+
*/
|
|
460
|
+
disableAutoFocus: PropTypes.bool,
|
|
449
461
|
/**
|
|
450
462
|
* Disable the scroll lock behavior.
|
|
451
463
|
* @default false
|
package/Snackbar/Snackbar.d.mts
CHANGED
|
@@ -54,7 +54,7 @@ export type SnackbarSlotsAndSlotProps = CreateSlotsAndSlotProps<SnackbarSlots, {
|
|
|
54
54
|
* Props applied to the transition element.
|
|
55
55
|
* By default, the element is based on the [Grow](https://mui.com/material-ui/api/grow/#props) component.
|
|
56
56
|
*/
|
|
57
|
-
transition: SlotComponentProps<React.ElementType
|
|
57
|
+
transition: SlotComponentProps<React.ElementType<TransitionProps>, TransitionProps & SnackbarTransitionSlotPropsOverrides, SnackbarOwnerState>;
|
|
58
58
|
}>;
|
|
59
59
|
export interface SnackbarOrigin {
|
|
60
60
|
vertical: 'top' | 'bottom';
|
package/Snackbar/Snackbar.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export type SnackbarSlotsAndSlotProps = CreateSlotsAndSlotProps<SnackbarSlots, {
|
|
|
54
54
|
* Props applied to the transition element.
|
|
55
55
|
* By default, the element is based on the [Grow](https://mui.com/material-ui/api/grow/#props) component.
|
|
56
56
|
*/
|
|
57
|
-
transition: SlotComponentProps<React.ElementType
|
|
57
|
+
transition: SlotComponentProps<React.ElementType<TransitionProps>, TransitionProps & SnackbarTransitionSlotPropsOverrides, SnackbarOwnerState>;
|
|
58
58
|
}>;
|
|
59
59
|
export interface SnackbarOrigin {
|
|
60
60
|
vertical: 'top' | 'bottom';
|
|
@@ -31,7 +31,7 @@ export type SpeedDialSlotsAndSlotProps = CreateSlotsAndSlotProps<SpeedDialSlots,
|
|
|
31
31
|
* Props forwarded to the transition slot.
|
|
32
32
|
* By default, the available props are based on the [Zoom](https://mui.com/material-ui/api/zoom/#props) component.
|
|
33
33
|
*/
|
|
34
|
-
transition: SlotComponentProps<React.ElementType
|
|
34
|
+
transition: SlotComponentProps<React.ElementType<TransitionProps>, TransitionProps, SpeedDialOwnerState>;
|
|
35
35
|
}>;
|
|
36
36
|
export interface SpeedDialProps extends Omit<StandardProps<React.HTMLAttributes<HTMLDivElement>, 'children'>, 'slots' | 'slotProps'>, SpeedDialSlotsAndSlotProps {
|
|
37
37
|
/**
|
package/SpeedDial/SpeedDial.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type SpeedDialSlotsAndSlotProps = CreateSlotsAndSlotProps<SpeedDialSlots,
|
|
|
31
31
|
* Props forwarded to the transition slot.
|
|
32
32
|
* By default, the available props are based on the [Zoom](https://mui.com/material-ui/api/zoom/#props) component.
|
|
33
33
|
*/
|
|
34
|
-
transition: SlotComponentProps<React.ElementType
|
|
34
|
+
transition: SlotComponentProps<React.ElementType<TransitionProps>, TransitionProps, SpeedDialOwnerState>;
|
|
35
35
|
}>;
|
|
36
36
|
export interface SpeedDialProps extends Omit<StandardProps<React.HTMLAttributes<HTMLDivElement>, 'children'>, 'slots' | 'slotProps'>, SpeedDialSlotsAndSlotProps {
|
|
37
37
|
/**
|
package/StepButton/StepButton.js
CHANGED
|
@@ -16,6 +16,7 @@ var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
|
16
16
|
var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
|
|
17
17
|
var _StepLabel = _interopRequireDefault(require("../StepLabel"));
|
|
18
18
|
var _isMuiElement = _interopRequireDefault(require("../utils/isMuiElement"));
|
|
19
|
+
var _useRovingTabIndex = require("../utils/useRovingTabIndex");
|
|
19
20
|
var _StepperContext = require("../Stepper/StepperContext");
|
|
20
21
|
var _StepContext = _interopRequireDefault(require("../Step/StepContext"));
|
|
21
22
|
var _stepButtonClasses = _interopRequireWildcard(require("./stepButtonClasses"));
|
|
@@ -61,6 +62,26 @@ const StepButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
|
|
|
61
62
|
}
|
|
62
63
|
}]
|
|
63
64
|
});
|
|
65
|
+
const RovingStepButton = /*#__PURE__*/React.forwardRef(function RovingStepButton(props, ref) {
|
|
66
|
+
// eslint-disable-next-line react/prop-types
|
|
67
|
+
const {
|
|
68
|
+
children,
|
|
69
|
+
disabled,
|
|
70
|
+
index,
|
|
71
|
+
...other
|
|
72
|
+
} = props;
|
|
73
|
+
const rovingItemProps = (0, _useRovingTabIndex.useRovingTabIndexItem)({
|
|
74
|
+
id: index,
|
|
75
|
+
ref,
|
|
76
|
+
disabled
|
|
77
|
+
});
|
|
78
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StepButtonRoot, {
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
...rovingItemProps,
|
|
81
|
+
...other,
|
|
82
|
+
children: children
|
|
83
|
+
});
|
|
84
|
+
});
|
|
64
85
|
const StepButton = /*#__PURE__*/React.forwardRef(function StepButton(inProps, ref) {
|
|
65
86
|
const props = (0, _DefaultPropsProvider.useDefaultProps)({
|
|
66
87
|
props: inProps,
|
|
@@ -81,7 +102,7 @@ const StepButton = /*#__PURE__*/React.forwardRef(function StepButton(inProps, re
|
|
|
81
102
|
const {
|
|
82
103
|
orientation,
|
|
83
104
|
totalSteps,
|
|
84
|
-
|
|
105
|
+
isTabList
|
|
85
106
|
} = (0, _StepperContext.useStepperContext)();
|
|
86
107
|
const ownerState = {
|
|
87
108
|
...props,
|
|
@@ -96,24 +117,33 @@ const StepButton = /*#__PURE__*/React.forwardRef(function StepButton(inProps, re
|
|
|
96
117
|
...childProps,
|
|
97
118
|
children: children
|
|
98
119
|
});
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
tabIndex: active ? 0 : -1
|
|
102
|
-
};
|
|
103
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StepButtonRoot, {
|
|
120
|
+
const stepButtonProps = {
|
|
121
|
+
internalNativeButton: true,
|
|
104
122
|
focusRipple: true,
|
|
105
|
-
disabled
|
|
123
|
+
disabled,
|
|
106
124
|
TouchRippleProps: {
|
|
107
125
|
className: classes.touchRipple
|
|
108
126
|
},
|
|
109
127
|
className: (0, _clsx.default)(classes.root, className),
|
|
110
|
-
ownerState
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
role:
|
|
115
|
-
...
|
|
116
|
-
|
|
128
|
+
ownerState,
|
|
129
|
+
'aria-selected': active,
|
|
130
|
+
'aria-posinset': index + 1,
|
|
131
|
+
'aria-setsize': totalSteps,
|
|
132
|
+
role: 'tab',
|
|
133
|
+
...other
|
|
134
|
+
};
|
|
135
|
+
if (isTabList) {
|
|
136
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RovingStepButton, {
|
|
137
|
+
...stepButtonProps,
|
|
138
|
+
index: index,
|
|
139
|
+
ref: ref,
|
|
140
|
+
children: child
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StepButtonRoot, {
|
|
144
|
+
ref: ref,
|
|
145
|
+
tabIndex: active ? 0 : -1,
|
|
146
|
+
...stepButtonProps,
|
|
117
147
|
children: child
|
|
118
148
|
});
|
|
119
149
|
});
|
|
@@ -9,6 +9,7 @@ import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
|
9
9
|
import ButtonBase from "../ButtonBase/index.mjs";
|
|
10
10
|
import StepLabel from "../StepLabel/index.mjs";
|
|
11
11
|
import isMuiElement from "../utils/isMuiElement.mjs";
|
|
12
|
+
import { useRovingTabIndexItem } from "../utils/useRovingTabIndex.mjs";
|
|
12
13
|
import { useStepperContext } from "../Stepper/StepperContext.mjs";
|
|
13
14
|
import StepContext from "../Step/StepContext.mjs";
|
|
14
15
|
import stepButtonClasses, { getStepButtonUtilityClass } from "./stepButtonClasses.mjs";
|
|
@@ -54,6 +55,26 @@ const StepButtonRoot = styled(ButtonBase, {
|
|
|
54
55
|
}
|
|
55
56
|
}]
|
|
56
57
|
});
|
|
58
|
+
const RovingStepButton = /*#__PURE__*/React.forwardRef(function RovingStepButton(props, ref) {
|
|
59
|
+
// eslint-disable-next-line react/prop-types
|
|
60
|
+
const {
|
|
61
|
+
children,
|
|
62
|
+
disabled,
|
|
63
|
+
index,
|
|
64
|
+
...other
|
|
65
|
+
} = props;
|
|
66
|
+
const rovingItemProps = useRovingTabIndexItem({
|
|
67
|
+
id: index,
|
|
68
|
+
ref,
|
|
69
|
+
disabled
|
|
70
|
+
});
|
|
71
|
+
return /*#__PURE__*/_jsx(StepButtonRoot, {
|
|
72
|
+
disabled: disabled,
|
|
73
|
+
...rovingItemProps,
|
|
74
|
+
...other,
|
|
75
|
+
children: children
|
|
76
|
+
});
|
|
77
|
+
});
|
|
57
78
|
const StepButton = /*#__PURE__*/React.forwardRef(function StepButton(inProps, ref) {
|
|
58
79
|
const props = useDefaultProps({
|
|
59
80
|
props: inProps,
|
|
@@ -74,7 +95,7 @@ const StepButton = /*#__PURE__*/React.forwardRef(function StepButton(inProps, re
|
|
|
74
95
|
const {
|
|
75
96
|
orientation,
|
|
76
97
|
totalSteps,
|
|
77
|
-
|
|
98
|
+
isTabList
|
|
78
99
|
} = useStepperContext();
|
|
79
100
|
const ownerState = {
|
|
80
101
|
...props,
|
|
@@ -89,24 +110,33 @@ const StepButton = /*#__PURE__*/React.forwardRef(function StepButton(inProps, re
|
|
|
89
110
|
...childProps,
|
|
90
111
|
children: children
|
|
91
112
|
});
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
tabIndex: active ? 0 : -1
|
|
95
|
-
};
|
|
96
|
-
return /*#__PURE__*/_jsx(StepButtonRoot, {
|
|
113
|
+
const stepButtonProps = {
|
|
114
|
+
internalNativeButton: true,
|
|
97
115
|
focusRipple: true,
|
|
98
|
-
disabled
|
|
116
|
+
disabled,
|
|
99
117
|
TouchRippleProps: {
|
|
100
118
|
className: classes.touchRipple
|
|
101
119
|
},
|
|
102
120
|
className: clsx(classes.root, className),
|
|
103
|
-
ownerState
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
role:
|
|
108
|
-
...
|
|
109
|
-
|
|
121
|
+
ownerState,
|
|
122
|
+
'aria-selected': active,
|
|
123
|
+
'aria-posinset': index + 1,
|
|
124
|
+
'aria-setsize': totalSteps,
|
|
125
|
+
role: 'tab',
|
|
126
|
+
...other
|
|
127
|
+
};
|
|
128
|
+
if (isTabList) {
|
|
129
|
+
return /*#__PURE__*/_jsx(RovingStepButton, {
|
|
130
|
+
...stepButtonProps,
|
|
131
|
+
index: index,
|
|
132
|
+
ref: ref,
|
|
133
|
+
children: child
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return /*#__PURE__*/_jsx(StepButtonRoot, {
|
|
137
|
+
ref: ref,
|
|
138
|
+
tabIndex: active ? 0 : -1,
|
|
139
|
+
...stepButtonProps,
|
|
110
140
|
children: child
|
|
111
141
|
});
|
|
112
142
|
});
|
|
@@ -21,7 +21,7 @@ export type StepContentSlotsAndSlotProps = CreateSlotsAndSlotProps<StepContentSl
|
|
|
21
21
|
* Props forwarded to the transition slot.
|
|
22
22
|
* By default, the available props are based on the [Collapse](https://mui.com/material-ui/api/collapse/#props) component
|
|
23
23
|
*/
|
|
24
|
-
transition: SlotComponentProps<React.ElementType
|
|
24
|
+
transition: SlotComponentProps<React.ElementType<CollapseProps>, CollapseProps, StepContentOwnerState>;
|
|
25
25
|
}>;
|
|
26
26
|
export interface StepContentOwnerState extends StepContentProps {}
|
|
27
27
|
export interface StepContentProps extends StandardProps<React.HTMLAttributes<HTMLDivElement>>, StepContentSlotsAndSlotProps {
|
|
@@ -21,7 +21,7 @@ export type StepContentSlotsAndSlotProps = CreateSlotsAndSlotProps<StepContentSl
|
|
|
21
21
|
* Props forwarded to the transition slot.
|
|
22
22
|
* By default, the available props are based on the [Collapse](https://mui.com/material-ui/api/collapse/#props) component
|
|
23
23
|
*/
|
|
24
|
-
transition: SlotComponentProps<React.ElementType
|
|
24
|
+
transition: SlotComponentProps<React.ElementType<CollapseProps>, CollapseProps, StepContentOwnerState>;
|
|
25
25
|
}>;
|
|
26
26
|
export interface StepContentOwnerState extends StepContentProps {}
|
|
27
27
|
export interface StepContentProps extends StandardProps<React.HTMLAttributes<HTMLDivElement>>, StepContentSlotsAndSlotProps {
|