@mui/material 5.14.13 → 5.14.14
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/AppBar/AppBar.d.ts +4 -1
- package/AppBar/AppBar.js +1 -1
- package/AppBar/appBarClasses.d.ts +8 -0
- package/AppBar/appBarClasses.js +1 -1
- package/AvatarGroup/AvatarGroup.d.ts +6 -0
- package/AvatarGroup/AvatarGroup.js +12 -3
- package/CHANGELOG.md +73 -0
- package/Pagination/Pagination.d.ts +3 -6
- package/Pagination/Pagination.js +1 -1
- package/Tabs/Tabs.js +30 -5
- package/index.js +1 -1
- package/legacy/AppBar/AppBar.js +1 -1
- package/legacy/AppBar/appBarClasses.js +1 -1
- package/legacy/AvatarGroup/AvatarGroup.js +12 -3
- package/legacy/Pagination/Pagination.js +1 -1
- package/legacy/Tabs/Tabs.js +30 -5
- package/legacy/index.js +1 -1
- package/modern/AppBar/AppBar.js +1 -1
- package/modern/AppBar/appBarClasses.js +1 -1
- package/modern/AvatarGroup/AvatarGroup.js +12 -3
- package/modern/Pagination/Pagination.js +1 -1
- package/modern/Tabs/Tabs.js +27 -5
- package/modern/index.js +1 -1
- package/node/AppBar/AppBar.js +1 -1
- package/node/AppBar/appBarClasses.js +1 -1
- package/node/AvatarGroup/AvatarGroup.js +11 -3
- package/node/Pagination/Pagination.js +1 -1
- package/node/Tabs/Tabs.js +30 -5
- package/node/index.js +1 -1
- package/package.json +4 -4
- package/umd/material-ui.development.js +45 -17
- package/umd/material-ui.production.min.js +3 -3
package/AppBar/AppBar.d.ts
CHANGED
|
@@ -19,7 +19,10 @@ export interface AppBarOwnProps {
|
|
|
19
19
|
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
20
20
|
* @default 'primary'
|
|
21
21
|
*/
|
|
22
|
-
color?: OverridableStringUnion<
|
|
22
|
+
color?: OverridableStringUnion<
|
|
23
|
+
PropTypes.Color | 'transparent' | 'error' | 'info' | 'success' | 'warning',
|
|
24
|
+
AppBarPropsColorOverrides
|
|
25
|
+
>;
|
|
23
26
|
/**
|
|
24
27
|
* If true, the `color` prop is applied in dark mode.
|
|
25
28
|
* @default false
|
package/AppBar/AppBar.js
CHANGED
|
@@ -157,7 +157,7 @@ process.env.NODE_ENV !== "production" ? AppBar.propTypes /* remove-proptypes */
|
|
|
157
157
|
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
158
158
|
* @default 'primary'
|
|
159
159
|
*/
|
|
160
|
-
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent']), PropTypes.string]),
|
|
160
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
161
161
|
/**
|
|
162
162
|
* If true, the `color` prop is applied in dark mode.
|
|
163
163
|
* @default false
|
|
@@ -21,6 +21,14 @@ export interface AppBarClasses {
|
|
|
21
21
|
colorInherit: string;
|
|
22
22
|
/** Styles applied to the root element if `color="transparent"`. */
|
|
23
23
|
colorTransparent: string;
|
|
24
|
+
/** Styles applied to the root element if `color="error"`. */
|
|
25
|
+
colorError: string;
|
|
26
|
+
/** Styles applied to the root element if `color="info"`. */
|
|
27
|
+
colorInfo: string;
|
|
28
|
+
/** Styles applied to the root element if `color="success"`. */
|
|
29
|
+
colorSuccess: string;
|
|
30
|
+
/** Styles applied to the root element if `color="warning"`. */
|
|
31
|
+
colorWarning: string;
|
|
24
32
|
}
|
|
25
33
|
export type AppBarClassKey = keyof AppBarClasses;
|
|
26
34
|
export declare function getAppBarUtilityClass(slot: string): string;
|
package/AppBar/appBarClasses.js
CHANGED
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '../generateUtilityClass';
|
|
|
3
3
|
export function getAppBarUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiAppBar', slot);
|
|
5
5
|
}
|
|
6
|
-
const appBarClasses = generateUtilityClasses('MuiAppBar', ['root', 'positionFixed', 'positionAbsolute', 'positionSticky', 'positionStatic', 'positionRelative', 'colorDefault', 'colorPrimary', 'colorSecondary', 'colorInherit', 'colorTransparent']);
|
|
6
|
+
const appBarClasses = generateUtilityClasses('MuiAppBar', ['root', 'positionFixed', 'positionAbsolute', 'positionSticky', 'positionStatic', 'positionRelative', 'colorDefault', 'colorPrimary', 'colorSecondary', 'colorInherit', 'colorTransparent', 'colorError', 'colorInfo', 'colorSuccess', 'colorWarning']);
|
|
7
7
|
export default appBarClasses;
|
|
@@ -40,6 +40,12 @@ export interface AvatarGroupProps extends StandardProps<React.HTMLAttributes<HTM
|
|
|
40
40
|
* @default 5
|
|
41
41
|
*/
|
|
42
42
|
max?: number;
|
|
43
|
+
/**
|
|
44
|
+
* custom renderer of extraAvatars
|
|
45
|
+
* @param {number} surplus number of extra avatars
|
|
46
|
+
* @returns {React.ReactNode} custom element to display
|
|
47
|
+
*/
|
|
48
|
+
renderSurplus?: (surplus: number) => React.ReactNode;
|
|
43
49
|
/**
|
|
44
50
|
* The extra props for the slot components.
|
|
45
51
|
* You can override the existing props or add new ones.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["children", "className", "component", "componentsProps", "max", "slotProps", "spacing", "total", "variant"];
|
|
5
|
+
const _excluded = ["children", "className", "component", "componentsProps", "max", "renderSurplus", "slotProps", "spacing", "total", "variant"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { isFragment } from 'react-is';
|
|
@@ -13,6 +13,7 @@ import styled from '../styles/styled';
|
|
|
13
13
|
import useThemeProps from '../styles/useThemeProps';
|
|
14
14
|
import Avatar, { avatarClasses } from '../Avatar';
|
|
15
15
|
import avatarGroupClasses, { getAvatarGroupUtilityClass } from './avatarGroupClasses';
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
const SPACINGS = {
|
|
18
19
|
small: -16,
|
|
@@ -74,6 +75,7 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
|
|
|
74
75
|
component = 'div',
|
|
75
76
|
componentsProps = {},
|
|
76
77
|
max = 5,
|
|
78
|
+
renderSurplus,
|
|
77
79
|
slotProps = {},
|
|
78
80
|
spacing = 'medium',
|
|
79
81
|
total,
|
|
@@ -103,6 +105,7 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
|
|
|
103
105
|
clampedMax = Math.min(totalAvatars + 1, clampedMax);
|
|
104
106
|
const maxAvatars = Math.min(children.length, clampedMax - 1);
|
|
105
107
|
const extraAvatars = Math.max(totalAvatars - clampedMax, totalAvatars - maxAvatars, 0);
|
|
108
|
+
const extraAvatarsElement = renderSurplus ? renderSurplus(extraAvatars) : `+${extraAvatars}`;
|
|
106
109
|
const marginLeft = spacing && SPACINGS[spacing] !== undefined ? SPACINGS[spacing] : -spacing;
|
|
107
110
|
const additionalAvatarSlotProps = (_slotProps$additional = slotProps.additionalAvatar) != null ? _slotProps$additional : componentsProps.additionalAvatar;
|
|
108
111
|
return /*#__PURE__*/_jsxs(AvatarGroupRoot, _extends({
|
|
@@ -111,7 +114,7 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
|
|
|
111
114
|
className: clsx(classes.root, className),
|
|
112
115
|
ref: ref
|
|
113
116
|
}, other, {
|
|
114
|
-
children: [extraAvatars ? /*#__PURE__*/
|
|
117
|
+
children: [extraAvatars ? /*#__PURE__*/_jsx(AvatarGroupAvatar, _extends({
|
|
115
118
|
ownerState: ownerState,
|
|
116
119
|
variant: variant
|
|
117
120
|
}, additionalAvatarSlotProps, {
|
|
@@ -119,7 +122,7 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
|
|
|
119
122
|
style: _extends({
|
|
120
123
|
marginLeft
|
|
121
124
|
}, additionalAvatarSlotProps == null ? void 0 : additionalAvatarSlotProps.style),
|
|
122
|
-
children:
|
|
125
|
+
children: extraAvatarsElement
|
|
123
126
|
})) : null, children.slice(0, maxAvatars).reverse().map((child, index) => {
|
|
124
127
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
125
128
|
className: clsx(child.props.className, classes.avatar),
|
|
@@ -177,6 +180,12 @@ process.env.NODE_ENV !== "production" ? AvatarGroup.propTypes /* remove-proptype
|
|
|
177
180
|
}
|
|
178
181
|
return null;
|
|
179
182
|
}),
|
|
183
|
+
/**
|
|
184
|
+
* custom renderer of extraAvatars
|
|
185
|
+
* @param {number} surplus number of extra avatars
|
|
186
|
+
* @returns {React.ReactNode} custom element to display
|
|
187
|
+
*/
|
|
188
|
+
renderSurplus: PropTypes.func,
|
|
180
189
|
/**
|
|
181
190
|
* The extra props for the slot components.
|
|
182
191
|
* You can override the existing props or add new ones.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,78 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 5.14.14
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v5.14.13..master -->
|
|
6
|
+
|
|
7
|
+
_Oct 17, 2023_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 24 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
This release was mostly about 🐛 bug fixes and 📚 documentation improvements.
|
|
11
|
+
|
|
12
|
+
### `@mui/material@5.14.14`
|
|
13
|
+
|
|
14
|
+
- ​<!-- 29 -->[material-ui][AppBar] Support all default palette colors in TypeScript (#39389) @BreakBB
|
|
15
|
+
- ​<!-- 28 -->[material-ui][AvatarGroup] Add `renderSurplus` prop (#39283) @uuxxx
|
|
16
|
+
- ​<!-- 25 -->[material-ui][Box] Fix system properties has incorrect `Theme` interface when applied directly (#39404) @Semigradsky
|
|
17
|
+
- ​<!-- 04 -->[material-ui][Pagination] Update `type` parameter of `getItemAriaLabel` prop (#39390) @Simer13
|
|
18
|
+
- ​<!-- 06 -->[material][tab] Show/hide scroll buttons for dynamically added children (#39415) @brijeshb42
|
|
19
|
+
|
|
20
|
+
### `@mui/base@5.0.0-beta.20`
|
|
21
|
+
|
|
22
|
+
- ​<!-- 26 -->[base-ui][Menu] Do not reopen the menu after clicking on a trigger in Safari (#39393) @michaldudak
|
|
23
|
+
|
|
24
|
+
### `@mui/material-next@6.0.0-alpha.106`
|
|
25
|
+
|
|
26
|
+
- ​<!-- 23 -->[Divider][material-next] Add Divider component (#39179) @Best-Sardar
|
|
27
|
+
|
|
28
|
+
### `@mui/joy@5.0.0-beta.11`
|
|
29
|
+
|
|
30
|
+
- ​<!-- 08 -->[joy-ui][List] Add the `marker` prop (#39313) @siriwatknp
|
|
31
|
+
- ​<!-- 07 -->[joy-ui][Skeleton] Fix semi-transparent scenario when with surface components and color inversion (#39400) @TheNatkat
|
|
32
|
+
- ​<!-- 06 -->[joy-ui][Textarea] Fix focus ring for error state (#39391) @vineetjk
|
|
33
|
+
|
|
34
|
+
### `@mui/icons-material@5.14.14`
|
|
35
|
+
|
|
36
|
+
- ​<!-- 09 -->[icons] Fix VoiceChatOutlined showing the wrong icon (#39418) @devuser200
|
|
37
|
+
|
|
38
|
+
### `@mui/system@5.14.14`
|
|
39
|
+
|
|
40
|
+
- ​<!-- 03 -->[mui-system][style] bug fix for style value check color in nullable object (#39457) @DarhkVoyd
|
|
41
|
+
|
|
42
|
+
### `@mui/styled-engine-sc@6.0.0-alpha.2`
|
|
43
|
+
|
|
44
|
+
- ​<!-- 05 -->[styled-engine-sc] Fix TS issues because of missing types (#39395) @mnajdova
|
|
45
|
+
|
|
46
|
+
### Docs
|
|
47
|
+
|
|
48
|
+
- ​<!-- 27 -->[docs][base-ui] Renaming demos to BaseXxx (#39104) @christophermorin
|
|
49
|
+
- ​<!-- 26 -->[docs] Accessibility in Base UI (#39264) @michaldudak
|
|
50
|
+
- ​<!-- 22 -->[docs] Fix 301 redirection @oliviertassinari
|
|
51
|
+
- ​<!-- 21 -->[docs] Improve Base UI table of contents for APIs (#39412) @ZeeshanTamboli
|
|
52
|
+
- ​<!-- 20 -->[docs] Adjust design kits-related content (#39367) @danilo-leal
|
|
53
|
+
- ​<!-- 19 -->[docs] Revise the Contributing Guide (#39190) @samuelsycamore
|
|
54
|
+
- ​<!-- 12 -->[docs][joy-ui] Fix row hover prop name in the Table page (#39431) @adrienbrault
|
|
55
|
+
- ​<!-- 11 -->[docs][joy-ui] Fix color inversion demos (#39403) @danilo-leal
|
|
56
|
+
- ​<!-- 10 -->[docs][material-ui] Remove irrelevant TODO from Snackbar demo (#39396) @ZeeshanTamboli
|
|
57
|
+
- ​<!-- 06 -->[docs][material-ui][Table] Bug in "Sorting & Selecting" demo (#39426) @codewithrabeeh
|
|
58
|
+
- ​<!-- 05 -->[docs][joy-ui][typography] Update docs after lineHeight changes (#39366) @zanivan
|
|
59
|
+
|
|
60
|
+
### Core
|
|
61
|
+
|
|
62
|
+
- ​<!-- 24 -->[core] Fix multiple typos across the repo (#39422) @parikshitadhikari
|
|
63
|
+
- ​<!-- 18 -->[docs-infra] Add refinements to the API content design (#39425) @danilo-leal
|
|
64
|
+
- ​<!-- 17 -->[docs-infra] Add a min height to the layout component (#39416) @danilo-leal
|
|
65
|
+
- ​<!-- 16 -->[docs-infra] Prevent horizontal scroll in the TOC (#39417) @danilo-leal
|
|
66
|
+
- ​<!-- 15 -->[docs-infra] Add a collapsible list & table views to the API content display (#38265) @alexfauquette
|
|
67
|
+
- ​<!-- 14 -->[docs-infra] Adjust the `kbd` tag styles (#39397) @danilo-leal
|
|
68
|
+
- ​<!-- 13 -->[docs-infra] Fix strong style regression (#39384) @oliviertassinari
|
|
69
|
+
- ​<!-- 04 -->[website] Add the LinkedIn profile to the contributors section on the About page (#39455) @chhawinder
|
|
70
|
+
- ​<!-- 03 -->[website] Update new role template (#39386) @oliviertassinari
|
|
71
|
+
- ​<!-- 02 -->[website] Add stray design fine-tunning to the Pricing page (#39472) @danilo-leal
|
|
72
|
+
- ​<!-- 01 -->[website] Fix career anchor link to perks & benefits @oliviertassinari
|
|
73
|
+
|
|
74
|
+
All contributors of this release in alphabetical order: @adrienbrault, @alexfauquette, @Best-Sardar, @BreakBB, @brijeshb42, @chhawinder, @christophermorin, @codewithrabeeh, @danilo-leal, @DarhkVoyd, @devuser200, @michaldudak, @mnajdova, @oliviertassinari, @parikshitadhikari, @samuelsycamore, @Semigradsky, @Simer13, @siriwatknp, @TheNatkat, @uuxxx, @vineetjk, @zanivan, @ZeeshanTamboli
|
|
75
|
+
|
|
3
76
|
## 5.14.13
|
|
4
77
|
|
|
5
78
|
<!-- generated comparing v5.14.12..master -->
|
|
@@ -41,16 +41,13 @@ export interface PaginationProps
|
|
|
41
41
|
* This is important for screen reader users.
|
|
42
42
|
*
|
|
43
43
|
* For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).
|
|
44
|
-
* @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous'). Defaults to 'page'.
|
|
44
|
+
* @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous' | 'start-ellipsis' | 'end-ellipsis'). Defaults to 'page'.
|
|
45
45
|
* @param {number} page The page number to format.
|
|
46
46
|
* @param {bool} selected If true, the current page is selected.
|
|
47
47
|
* @returns {string}
|
|
48
48
|
*/
|
|
49
|
-
getItemAriaLabel?: (
|
|
50
|
-
|
|
51
|
-
page: number,
|
|
52
|
-
selected: boolean,
|
|
53
|
-
) => string;
|
|
49
|
+
getItemAriaLabel?: (type: UsePaginationItem['type'], page: number, selected: boolean) => string;
|
|
50
|
+
|
|
54
51
|
/**
|
|
55
52
|
* Render the item.
|
|
56
53
|
* @param {PaginationRenderItemParams} params The props to spread on a PaginationItem.
|
package/Pagination/Pagination.js
CHANGED
|
@@ -169,7 +169,7 @@ process.env.NODE_ENV !== "production" ? Pagination.propTypes /* remove-proptypes
|
|
|
169
169
|
* This is important for screen reader users.
|
|
170
170
|
*
|
|
171
171
|
* For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).
|
|
172
|
-
* @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous'). Defaults to 'page'.
|
|
172
|
+
* @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous' | 'start-ellipsis' | 'end-ellipsis'). Defaults to 'page'.
|
|
173
173
|
* @param {number} page The page number to format.
|
|
174
174
|
* @param {bool} selected If true, the current page is selected.
|
|
175
175
|
* @returns {string}
|
package/Tabs/Tabs.js
CHANGED
|
@@ -501,23 +501,48 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
501
501
|
updateIndicatorState();
|
|
502
502
|
}
|
|
503
503
|
});
|
|
504
|
+
let resizeObserver;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* @type {MutationCallback}
|
|
508
|
+
*/
|
|
509
|
+
const handleMutation = records => {
|
|
510
|
+
records.forEach(record => {
|
|
511
|
+
record.removedNodes.forEach(item => {
|
|
512
|
+
var _resizeObserver;
|
|
513
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.unobserve(item);
|
|
514
|
+
});
|
|
515
|
+
record.addedNodes.forEach(item => {
|
|
516
|
+
var _resizeObserver2;
|
|
517
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.observe(item);
|
|
518
|
+
});
|
|
519
|
+
});
|
|
520
|
+
handleResize();
|
|
521
|
+
updateScrollButtonState();
|
|
522
|
+
};
|
|
504
523
|
const win = ownerWindow(tabsRef.current);
|
|
505
524
|
win.addEventListener('resize', handleResize);
|
|
506
|
-
let
|
|
525
|
+
let mutationObserver;
|
|
507
526
|
if (typeof ResizeObserver !== 'undefined') {
|
|
508
527
|
resizeObserver = new ResizeObserver(handleResize);
|
|
509
528
|
Array.from(tabListRef.current.children).forEach(child => {
|
|
510
529
|
resizeObserver.observe(child);
|
|
511
530
|
});
|
|
512
531
|
}
|
|
532
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
533
|
+
mutationObserver = new MutationObserver(handleMutation);
|
|
534
|
+
mutationObserver.observe(tabListRef.current, {
|
|
535
|
+
childList: true
|
|
536
|
+
});
|
|
537
|
+
}
|
|
513
538
|
return () => {
|
|
539
|
+
var _mutationObserver, _resizeObserver3;
|
|
514
540
|
handleResize.clear();
|
|
515
541
|
win.removeEventListener('resize', handleResize);
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
}
|
|
542
|
+
(_mutationObserver = mutationObserver) == null || _mutationObserver.disconnect();
|
|
543
|
+
(_resizeObserver3 = resizeObserver) == null || _resizeObserver3.disconnect();
|
|
519
544
|
};
|
|
520
|
-
}, [updateIndicatorState]);
|
|
545
|
+
}, [updateIndicatorState, updateScrollButtonState]);
|
|
521
546
|
|
|
522
547
|
/**
|
|
523
548
|
* Toggle visibility of start and end scroll buttons
|
package/index.js
CHANGED
package/legacy/AppBar/AppBar.js
CHANGED
|
@@ -154,7 +154,7 @@ process.env.NODE_ENV !== "production" ? AppBar.propTypes /* remove-proptypes */
|
|
|
154
154
|
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
155
155
|
* @default 'primary'
|
|
156
156
|
*/
|
|
157
|
-
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent']), PropTypes.string]),
|
|
157
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
158
158
|
/**
|
|
159
159
|
* If true, the `color` prop is applied in dark mode.
|
|
160
160
|
* @default false
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '../generateUtilityClass';
|
|
|
3
3
|
export function getAppBarUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiAppBar', slot);
|
|
5
5
|
}
|
|
6
|
-
var appBarClasses = generateUtilityClasses('MuiAppBar', ['root', 'positionFixed', 'positionAbsolute', 'positionSticky', 'positionStatic', 'positionRelative', 'colorDefault', 'colorPrimary', 'colorSecondary', 'colorInherit', 'colorTransparent']);
|
|
6
|
+
var appBarClasses = generateUtilityClasses('MuiAppBar', ['root', 'positionFixed', 'positionAbsolute', 'positionSticky', 'positionStatic', 'positionRelative', 'colorDefault', 'colorPrimary', 'colorSecondary', 'colorInherit', 'colorTransparent', 'colorError', 'colorInfo', 'colorSuccess', 'colorWarning']);
|
|
7
7
|
export default appBarClasses;
|
|
@@ -13,6 +13,7 @@ import styled from '../styles/styled';
|
|
|
13
13
|
import useThemeProps from '../styles/useThemeProps';
|
|
14
14
|
import Avatar, { avatarClasses } from '../Avatar';
|
|
15
15
|
import avatarGroupClasses, { getAvatarGroupUtilityClass } from './avatarGroupClasses';
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
var SPACINGS = {
|
|
18
19
|
small: -16,
|
|
@@ -75,6 +76,7 @@ var AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps, re
|
|
|
75
76
|
componentsProps = _props$componentsProp === void 0 ? {} : _props$componentsProp,
|
|
76
77
|
_props$max = props.max,
|
|
77
78
|
max = _props$max === void 0 ? 5 : _props$max,
|
|
79
|
+
renderSurplus = props.renderSurplus,
|
|
78
80
|
_props$slotProps = props.slotProps,
|
|
79
81
|
slotProps = _props$slotProps === void 0 ? {} : _props$slotProps,
|
|
80
82
|
_props$spacing = props.spacing,
|
|
@@ -82,7 +84,7 @@ var AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps, re
|
|
|
82
84
|
total = props.total,
|
|
83
85
|
_props$variant = props.variant,
|
|
84
86
|
variant = _props$variant === void 0 ? 'circular' : _props$variant,
|
|
85
|
-
other = _objectWithoutProperties(props, ["children", "className", "component", "componentsProps", "max", "slotProps", "spacing", "total", "variant"]);
|
|
87
|
+
other = _objectWithoutProperties(props, ["children", "className", "component", "componentsProps", "max", "renderSurplus", "slotProps", "spacing", "total", "variant"]);
|
|
86
88
|
var clampedMax = max < 2 ? 2 : max;
|
|
87
89
|
var ownerState = _extends({}, props, {
|
|
88
90
|
max: max,
|
|
@@ -106,6 +108,7 @@ var AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps, re
|
|
|
106
108
|
clampedMax = Math.min(totalAvatars + 1, clampedMax);
|
|
107
109
|
var maxAvatars = Math.min(children.length, clampedMax - 1);
|
|
108
110
|
var extraAvatars = Math.max(totalAvatars - clampedMax, totalAvatars - maxAvatars, 0);
|
|
111
|
+
var extraAvatarsElement = renderSurplus ? renderSurplus(extraAvatars) : "+".concat(extraAvatars);
|
|
109
112
|
var marginLeft = spacing && SPACINGS[spacing] !== undefined ? SPACINGS[spacing] : -spacing;
|
|
110
113
|
var additionalAvatarSlotProps = (_slotProps$additional = slotProps.additionalAvatar) != null ? _slotProps$additional : componentsProps.additionalAvatar;
|
|
111
114
|
return /*#__PURE__*/_jsxs(AvatarGroupRoot, _extends({
|
|
@@ -114,7 +117,7 @@ var AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps, re
|
|
|
114
117
|
className: clsx(classes.root, className),
|
|
115
118
|
ref: ref
|
|
116
119
|
}, other, {
|
|
117
|
-
children: [extraAvatars ? /*#__PURE__*/
|
|
120
|
+
children: [extraAvatars ? /*#__PURE__*/_jsx(AvatarGroupAvatar, _extends({
|
|
118
121
|
ownerState: ownerState,
|
|
119
122
|
variant: variant
|
|
120
123
|
}, additionalAvatarSlotProps, {
|
|
@@ -122,7 +125,7 @@ var AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps, re
|
|
|
122
125
|
style: _extends({
|
|
123
126
|
marginLeft: marginLeft
|
|
124
127
|
}, additionalAvatarSlotProps == null ? void 0 : additionalAvatarSlotProps.style),
|
|
125
|
-
children:
|
|
128
|
+
children: extraAvatarsElement
|
|
126
129
|
})) : null, children.slice(0, maxAvatars).reverse().map(function (child, index) {
|
|
127
130
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
128
131
|
className: clsx(child.props.className, classes.avatar),
|
|
@@ -180,6 +183,12 @@ process.env.NODE_ENV !== "production" ? AvatarGroup.propTypes /* remove-proptype
|
|
|
180
183
|
}
|
|
181
184
|
return null;
|
|
182
185
|
}),
|
|
186
|
+
/**
|
|
187
|
+
* custom renderer of extraAvatars
|
|
188
|
+
* @param {number} surplus number of extra avatars
|
|
189
|
+
* @returns {React.ReactNode} custom element to display
|
|
190
|
+
*/
|
|
191
|
+
renderSurplus: PropTypes.func,
|
|
183
192
|
/**
|
|
184
193
|
* The extra props for the slot components.
|
|
185
194
|
* You can override the existing props or add new ones.
|
|
@@ -184,7 +184,7 @@ process.env.NODE_ENV !== "production" ? Pagination.propTypes /* remove-proptypes
|
|
|
184
184
|
* This is important for screen reader users.
|
|
185
185
|
*
|
|
186
186
|
* For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).
|
|
187
|
-
* @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous'). Defaults to 'page'.
|
|
187
|
+
* @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous' | 'start-ellipsis' | 'end-ellipsis'). Defaults to 'page'.
|
|
188
188
|
* @param {number} page The page number to format.
|
|
189
189
|
* @param {bool} selected If true, the current page is selected.
|
|
190
190
|
* @returns {string}
|
package/legacy/Tabs/Tabs.js
CHANGED
|
@@ -511,23 +511,48 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
511
511
|
updateIndicatorState();
|
|
512
512
|
}
|
|
513
513
|
});
|
|
514
|
+
var resizeObserver;
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* @type {MutationCallback}
|
|
518
|
+
*/
|
|
519
|
+
var handleMutation = function handleMutation(records) {
|
|
520
|
+
records.forEach(function (record) {
|
|
521
|
+
record.removedNodes.forEach(function (item) {
|
|
522
|
+
var _resizeObserver;
|
|
523
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.unobserve(item);
|
|
524
|
+
});
|
|
525
|
+
record.addedNodes.forEach(function (item) {
|
|
526
|
+
var _resizeObserver2;
|
|
527
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.observe(item);
|
|
528
|
+
});
|
|
529
|
+
});
|
|
530
|
+
handleResize();
|
|
531
|
+
updateScrollButtonState();
|
|
532
|
+
};
|
|
514
533
|
var win = ownerWindow(tabsRef.current);
|
|
515
534
|
win.addEventListener('resize', handleResize);
|
|
516
|
-
var
|
|
535
|
+
var mutationObserver;
|
|
517
536
|
if (typeof ResizeObserver !== 'undefined') {
|
|
518
537
|
resizeObserver = new ResizeObserver(handleResize);
|
|
519
538
|
Array.from(tabListRef.current.children).forEach(function (child) {
|
|
520
539
|
resizeObserver.observe(child);
|
|
521
540
|
});
|
|
522
541
|
}
|
|
542
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
543
|
+
mutationObserver = new MutationObserver(handleMutation);
|
|
544
|
+
mutationObserver.observe(tabListRef.current, {
|
|
545
|
+
childList: true
|
|
546
|
+
});
|
|
547
|
+
}
|
|
523
548
|
return function () {
|
|
549
|
+
var _mutationObserver, _resizeObserver3;
|
|
524
550
|
handleResize.clear();
|
|
525
551
|
win.removeEventListener('resize', handleResize);
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
552
|
+
(_mutationObserver = mutationObserver) == null || _mutationObserver.disconnect();
|
|
553
|
+
(_resizeObserver3 = resizeObserver) == null || _resizeObserver3.disconnect();
|
|
529
554
|
};
|
|
530
|
-
}, [updateIndicatorState]);
|
|
555
|
+
}, [updateIndicatorState, updateScrollButtonState]);
|
|
531
556
|
|
|
532
557
|
/**
|
|
533
558
|
* Toggle visibility of start and end scroll buttons
|
package/legacy/index.js
CHANGED
package/modern/AppBar/AppBar.js
CHANGED
|
@@ -157,7 +157,7 @@ process.env.NODE_ENV !== "production" ? AppBar.propTypes /* remove-proptypes */
|
|
|
157
157
|
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
158
158
|
* @default 'primary'
|
|
159
159
|
*/
|
|
160
|
-
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent']), PropTypes.string]),
|
|
160
|
+
color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent', 'error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
161
161
|
/**
|
|
162
162
|
* If true, the `color` prop is applied in dark mode.
|
|
163
163
|
* @default false
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '../generateUtilityClass';
|
|
|
3
3
|
export function getAppBarUtilityClass(slot) {
|
|
4
4
|
return generateUtilityClass('MuiAppBar', slot);
|
|
5
5
|
}
|
|
6
|
-
const appBarClasses = generateUtilityClasses('MuiAppBar', ['root', 'positionFixed', 'positionAbsolute', 'positionSticky', 'positionStatic', 'positionRelative', 'colorDefault', 'colorPrimary', 'colorSecondary', 'colorInherit', 'colorTransparent']);
|
|
6
|
+
const appBarClasses = generateUtilityClasses('MuiAppBar', ['root', 'positionFixed', 'positionAbsolute', 'positionSticky', 'positionStatic', 'positionRelative', 'colorDefault', 'colorPrimary', 'colorSecondary', 'colorInherit', 'colorTransparent', 'colorError', 'colorInfo', 'colorSuccess', 'colorWarning']);
|
|
7
7
|
export default appBarClasses;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["children", "className", "component", "componentsProps", "max", "slotProps", "spacing", "total", "variant"];
|
|
5
|
+
const _excluded = ["children", "className", "component", "componentsProps", "max", "renderSurplus", "slotProps", "spacing", "total", "variant"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { isFragment } from 'react-is';
|
|
@@ -13,6 +13,7 @@ import styled from '../styles/styled';
|
|
|
13
13
|
import useThemeProps from '../styles/useThemeProps';
|
|
14
14
|
import Avatar, { avatarClasses } from '../Avatar';
|
|
15
15
|
import avatarGroupClasses, { getAvatarGroupUtilityClass } from './avatarGroupClasses';
|
|
16
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
const SPACINGS = {
|
|
18
19
|
small: -16,
|
|
@@ -73,6 +74,7 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
|
|
|
73
74
|
component = 'div',
|
|
74
75
|
componentsProps = {},
|
|
75
76
|
max = 5,
|
|
77
|
+
renderSurplus,
|
|
76
78
|
slotProps = {},
|
|
77
79
|
spacing = 'medium',
|
|
78
80
|
total,
|
|
@@ -102,6 +104,7 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
|
|
|
102
104
|
clampedMax = Math.min(totalAvatars + 1, clampedMax);
|
|
103
105
|
const maxAvatars = Math.min(children.length, clampedMax - 1);
|
|
104
106
|
const extraAvatars = Math.max(totalAvatars - clampedMax, totalAvatars - maxAvatars, 0);
|
|
107
|
+
const extraAvatarsElement = renderSurplus ? renderSurplus(extraAvatars) : `+${extraAvatars}`;
|
|
105
108
|
const marginLeft = spacing && SPACINGS[spacing] !== undefined ? SPACINGS[spacing] : -spacing;
|
|
106
109
|
const additionalAvatarSlotProps = slotProps.additionalAvatar ?? componentsProps.additionalAvatar;
|
|
107
110
|
return /*#__PURE__*/_jsxs(AvatarGroupRoot, _extends({
|
|
@@ -110,7 +113,7 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
|
|
|
110
113
|
className: clsx(classes.root, className),
|
|
111
114
|
ref: ref
|
|
112
115
|
}, other, {
|
|
113
|
-
children: [extraAvatars ? /*#__PURE__*/
|
|
116
|
+
children: [extraAvatars ? /*#__PURE__*/_jsx(AvatarGroupAvatar, _extends({
|
|
114
117
|
ownerState: ownerState,
|
|
115
118
|
variant: variant
|
|
116
119
|
}, additionalAvatarSlotProps, {
|
|
@@ -118,7 +121,7 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
|
|
|
118
121
|
style: _extends({
|
|
119
122
|
marginLeft
|
|
120
123
|
}, additionalAvatarSlotProps?.style),
|
|
121
|
-
children:
|
|
124
|
+
children: extraAvatarsElement
|
|
122
125
|
})) : null, children.slice(0, maxAvatars).reverse().map((child, index) => {
|
|
123
126
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
124
127
|
className: clsx(child.props.className, classes.avatar),
|
|
@@ -176,6 +179,12 @@ process.env.NODE_ENV !== "production" ? AvatarGroup.propTypes /* remove-proptype
|
|
|
176
179
|
}
|
|
177
180
|
return null;
|
|
178
181
|
}),
|
|
182
|
+
/**
|
|
183
|
+
* custom renderer of extraAvatars
|
|
184
|
+
* @param {number} surplus number of extra avatars
|
|
185
|
+
* @returns {React.ReactNode} custom element to display
|
|
186
|
+
*/
|
|
187
|
+
renderSurplus: PropTypes.func,
|
|
179
188
|
/**
|
|
180
189
|
* The extra props for the slot components.
|
|
181
190
|
* You can override the existing props or add new ones.
|
|
@@ -169,7 +169,7 @@ process.env.NODE_ENV !== "production" ? Pagination.propTypes /* remove-proptypes
|
|
|
169
169
|
* This is important for screen reader users.
|
|
170
170
|
*
|
|
171
171
|
* For localization purposes, you can use the provided [translations](/material-ui/guides/localization/).
|
|
172
|
-
* @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous'). Defaults to 'page'.
|
|
172
|
+
* @param {string} type The link or button type to format ('page' | 'first' | 'last' | 'next' | 'previous' | 'start-ellipsis' | 'end-ellipsis'). Defaults to 'page'.
|
|
173
173
|
* @param {number} page The page number to format.
|
|
174
174
|
* @param {bool} selected If true, the current page is selected.
|
|
175
175
|
* @returns {string}
|
package/modern/Tabs/Tabs.js
CHANGED
|
@@ -501,23 +501,45 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
|
|
|
501
501
|
updateIndicatorState();
|
|
502
502
|
}
|
|
503
503
|
});
|
|
504
|
+
let resizeObserver;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* @type {MutationCallback}
|
|
508
|
+
*/
|
|
509
|
+
const handleMutation = records => {
|
|
510
|
+
records.forEach(record => {
|
|
511
|
+
record.removedNodes.forEach(item => {
|
|
512
|
+
resizeObserver?.unobserve(item);
|
|
513
|
+
});
|
|
514
|
+
record.addedNodes.forEach(item => {
|
|
515
|
+
resizeObserver?.observe(item);
|
|
516
|
+
});
|
|
517
|
+
});
|
|
518
|
+
handleResize();
|
|
519
|
+
updateScrollButtonState();
|
|
520
|
+
};
|
|
504
521
|
const win = ownerWindow(tabsRef.current);
|
|
505
522
|
win.addEventListener('resize', handleResize);
|
|
506
|
-
let
|
|
523
|
+
let mutationObserver;
|
|
507
524
|
if (typeof ResizeObserver !== 'undefined') {
|
|
508
525
|
resizeObserver = new ResizeObserver(handleResize);
|
|
509
526
|
Array.from(tabListRef.current.children).forEach(child => {
|
|
510
527
|
resizeObserver.observe(child);
|
|
511
528
|
});
|
|
512
529
|
}
|
|
530
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
531
|
+
mutationObserver = new MutationObserver(handleMutation);
|
|
532
|
+
mutationObserver.observe(tabListRef.current, {
|
|
533
|
+
childList: true
|
|
534
|
+
});
|
|
535
|
+
}
|
|
513
536
|
return () => {
|
|
514
537
|
handleResize.clear();
|
|
515
538
|
win.removeEventListener('resize', handleResize);
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
}
|
|
539
|
+
mutationObserver?.disconnect();
|
|
540
|
+
resizeObserver?.disconnect();
|
|
519
541
|
};
|
|
520
|
-
}, [updateIndicatorState]);
|
|
542
|
+
}, [updateIndicatorState, updateScrollButtonState]);
|
|
521
543
|
|
|
522
544
|
/**
|
|
523
545
|
* Toggle visibility of start and end scroll buttons
|
package/modern/index.js
CHANGED
package/node/AppBar/AppBar.js
CHANGED
|
@@ -165,7 +165,7 @@ process.env.NODE_ENV !== "production" ? AppBar.propTypes /* remove-proptypes */
|
|
|
165
165
|
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
166
166
|
* @default 'primary'
|
|
167
167
|
*/
|
|
168
|
-
color: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent']), _propTypes.default.string]),
|
|
168
|
+
color: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent', 'error', 'info', 'success', 'warning']), _propTypes.default.string]),
|
|
169
169
|
/**
|
|
170
170
|
* If true, the `color` prop is applied in dark mode.
|
|
171
171
|
* @default false
|
|
@@ -11,5 +11,5 @@ var _generateUtilityClass = _interopRequireDefault(require("../generateUtilityCl
|
|
|
11
11
|
function getAppBarUtilityClass(slot) {
|
|
12
12
|
return (0, _generateUtilityClass.default)('MuiAppBar', slot);
|
|
13
13
|
}
|
|
14
|
-
const appBarClasses = (0, _utils.unstable_generateUtilityClasses)('MuiAppBar', ['root', 'positionFixed', 'positionAbsolute', 'positionSticky', 'positionStatic', 'positionRelative', 'colorDefault', 'colorPrimary', 'colorSecondary', 'colorInherit', 'colorTransparent']);
|
|
14
|
+
const appBarClasses = (0, _utils.unstable_generateUtilityClasses)('MuiAppBar', ['root', 'positionFixed', 'positionAbsolute', 'positionSticky', 'positionStatic', 'positionRelative', 'colorDefault', 'colorPrimary', 'colorSecondary', 'colorInherit', 'colorTransparent', 'colorError', 'colorInfo', 'colorSuccess', 'colorWarning']);
|
|
15
15
|
var _default = exports.default = appBarClasses;
|