@mui/material 5.15.0 → 5.15.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/AccordionActions/AccordionActions.js +1 -1
- package/Autocomplete/Autocomplete.js +4 -4
- package/CHANGELOG.md +42 -0
- package/CardActions/CardActions.js +1 -1
- package/TablePagination/TablePagination.d.ts +8 -0
- package/TablePagination/TablePagination.js +27 -4
- package/TablePagination/TablePaginationActions.d.ts +49 -0
- package/TablePagination/TablePaginationActions.js +54 -19
- package/index.js +1 -1
- package/legacy/AccordionActions/AccordionActions.js +1 -1
- package/legacy/Autocomplete/Autocomplete.js +4 -4
- package/legacy/CardActions/CardActions.js +1 -1
- package/legacy/TablePagination/TablePagination.js +29 -4
- package/legacy/TablePagination/TablePaginationActions.js +56 -19
- package/legacy/index.js +1 -1
- package/legacy/styles/experimental_extendTheme.js +12 -6
- package/modern/AccordionActions/AccordionActions.js +1 -1
- package/modern/Autocomplete/Autocomplete.js +4 -4
- package/modern/CardActions/CardActions.js +1 -1
- package/modern/TablePagination/TablePagination.js +27 -4
- package/modern/TablePagination/TablePaginationActions.js +53 -18
- package/modern/index.js +1 -1
- package/modern/styles/experimental_extendTheme.js +12 -6
- package/node/AccordionActions/AccordionActions.js +1 -1
- package/node/Autocomplete/Autocomplete.js +4 -4
- package/node/CardActions/CardActions.js +1 -1
- package/node/TablePagination/TablePagination.js +27 -4
- package/node/TablePagination/TablePaginationActions.js +54 -19
- package/node/index.js +1 -1
- package/node/styles/experimental_extendTheme.js +11 -5
- package/package.json +6 -6
- package/styles/experimental_extendTheme.js +12 -6
- package/umd/material-ui.development.js +103 -39
- package/umd/material-ui.production.min.js +20 -20
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
5
|
import { deepmerge } from '@mui/utils';
|
|
6
|
-
import { private_safeColorChannel as safeColorChannel, private_safeAlpha as safeAlpha, private_safeDarken as safeDarken, private_safeLighten as safeLighten, private_safeEmphasize as safeEmphasize, unstable_createGetCssVar as systemCreateGetCssVar, unstable_defaultSxConfig as defaultSxConfig, unstable_styleFunctionSx as styleFunctionSx, unstable_prepareCssVars as prepareCssVars } from '@mui/system';
|
|
6
|
+
import { private_safeColorChannel as safeColorChannel, private_safeAlpha as safeAlpha, private_safeDarken as safeDarken, private_safeLighten as safeLighten, private_safeEmphasize as safeEmphasize, unstable_createGetCssVar as systemCreateGetCssVar, unstable_defaultSxConfig as defaultSxConfig, unstable_styleFunctionSx as styleFunctionSx, unstable_prepareCssVars as prepareCssVars, hslToRgb } from '@mui/system';
|
|
7
7
|
import defaultShouldSkipGeneratingVar from './shouldSkipGeneratingVar';
|
|
8
8
|
import createThemeWithoutVars from './createTheme';
|
|
9
9
|
import getOverlayAlpha from './getOverlayAlpha';
|
|
@@ -26,11 +26,17 @@ function setColor(obj, key, defaultValue) {
|
|
|
26
26
|
obj[key] = defaultValue;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
function toRgb(color) {
|
|
30
|
+
if (!color || !color.startsWith('hsl')) {
|
|
31
|
+
return color;
|
|
32
|
+
}
|
|
33
|
+
return hslToRgb(color);
|
|
34
|
+
}
|
|
29
35
|
function setColorChannel(obj, key) {
|
|
30
36
|
if (!("".concat(key, "Channel") in obj)) {
|
|
31
37
|
// custom channel token is not provided, generate one.
|
|
32
38
|
// if channel token can't be generated, show a warning.
|
|
33
|
-
obj["".concat(key, "Channel")] = safeColorChannel(obj[key], "MUI: Can't create `palette.".concat(key, "Channel` because `palette.").concat(key, "` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().") + '\n' + "To suppress this warning, you need to explicitly provide the `palette.".concat(key, "Channel` as a string (in rgb format, e.g. \"12 12 12\") or undefined if you want to remove the channel token."));
|
|
39
|
+
obj["".concat(key, "Channel")] = safeColorChannel(toRgb(obj[key]), "MUI: Can't create `palette.".concat(key, "Channel` because `palette.").concat(key, "` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().") + '\n' + "To suppress this warning, you need to explicitly provide the `palette.".concat(key, "Channel` as a string (in rgb format, e.g. \"12 12 12\") or undefined if you want to remove the channel token."));
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
var silent = function silent(fn) {
|
|
@@ -270,16 +276,16 @@ export default function extendTheme() {
|
|
|
270
276
|
if (colors && _typeof(colors) === 'object') {
|
|
271
277
|
// Silent the error for custom palettes.
|
|
272
278
|
if (colors.main) {
|
|
273
|
-
setColor(palette[color], 'mainChannel', safeColorChannel(colors.main));
|
|
279
|
+
setColor(palette[color], 'mainChannel', safeColorChannel(toRgb(colors.main)));
|
|
274
280
|
}
|
|
275
281
|
if (colors.light) {
|
|
276
|
-
setColor(palette[color], 'lightChannel', safeColorChannel(colors.light));
|
|
282
|
+
setColor(palette[color], 'lightChannel', safeColorChannel(toRgb(colors.light)));
|
|
277
283
|
}
|
|
278
284
|
if (colors.dark) {
|
|
279
|
-
setColor(palette[color], 'darkChannel', safeColorChannel(colors.dark));
|
|
285
|
+
setColor(palette[color], 'darkChannel', safeColorChannel(toRgb(colors.dark)));
|
|
280
286
|
}
|
|
281
287
|
if (colors.contrastText) {
|
|
282
|
-
setColor(palette[color], 'contrastTextChannel', safeColorChannel(colors.contrastText));
|
|
288
|
+
setColor(palette[color], 'contrastTextChannel', safeColorChannel(toRgb(colors.contrastText)));
|
|
283
289
|
}
|
|
284
290
|
if (color === 'text') {
|
|
285
291
|
// Text colors: text.primary, text.secondary
|
|
@@ -656,7 +656,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
|
|
|
656
656
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
657
657
|
// ----------------------------------------------------------------------
|
|
658
658
|
/**
|
|
659
|
-
* If `true`, the portion of the selected suggestion that
|
|
659
|
+
* If `true`, the portion of the selected suggestion that the user hasn't typed,
|
|
660
660
|
* known as the completion string, appears inline after the input cursor in the textbox.
|
|
661
661
|
* The inline completion string is visually highlighted and has a selected state.
|
|
662
662
|
* @default false
|
|
@@ -672,7 +672,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
|
|
|
672
672
|
* when the Autocomplete loses focus unless the user chooses
|
|
673
673
|
* a different option or changes the character string in the input.
|
|
674
674
|
*
|
|
675
|
-
* When using `freeSolo` mode, the typed value will be the input value
|
|
675
|
+
* When using the `freeSolo` mode, the typed value will be the input value
|
|
676
676
|
* if the Autocomplete loses focus without highlighting an option.
|
|
677
677
|
* @default false
|
|
678
678
|
*/
|
|
@@ -707,8 +707,8 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
|
|
|
707
707
|
/**
|
|
708
708
|
* If `true`, the input's text is cleared on blur if no value is selected.
|
|
709
709
|
*
|
|
710
|
-
* Set to `true` if you want to help the user enter a new value.
|
|
711
|
-
* Set to `false` if you want to help the user resume their search.
|
|
710
|
+
* Set it to `true` if you want to help the user enter a new value.
|
|
711
|
+
* Set it to `false` if you want to help the user resume their search.
|
|
712
712
|
* @default !props.freeSolo
|
|
713
713
|
*/
|
|
714
714
|
clearOnBlur: PropTypes.bool,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
5
|
var _InputBase;
|
|
6
|
-
const _excluded = ["ActionsComponent", "backIconButtonProps", "className", "colSpan", "component", "count", "disabled", "getItemAriaLabel", "labelDisplayedRows", "labelRowsPerPage", "nextIconButtonProps", "onPageChange", "onRowsPerPageChange", "page", "rowsPerPage", "rowsPerPageOptions", "SelectProps", "showFirstButton", "showLastButton", "slotProps"];
|
|
6
|
+
const _excluded = ["ActionsComponent", "backIconButtonProps", "className", "colSpan", "component", "count", "disabled", "getItemAriaLabel", "labelDisplayedRows", "labelRowsPerPage", "nextIconButtonProps", "onPageChange", "onRowsPerPageChange", "page", "rowsPerPage", "rowsPerPageOptions", "SelectProps", "showFirstButton", "showLastButton", "slotProps", "slots"];
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import clsx from 'clsx';
|
|
@@ -167,7 +167,8 @@ const TablePagination = /*#__PURE__*/React.forwardRef(function TablePagination(i
|
|
|
167
167
|
SelectProps = {},
|
|
168
168
|
showFirstButton = false,
|
|
169
169
|
showLastButton = false,
|
|
170
|
-
slotProps
|
|
170
|
+
slotProps = {},
|
|
171
|
+
slots = {}
|
|
171
172
|
} = props,
|
|
172
173
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
173
174
|
const ownerState = props;
|
|
@@ -244,7 +245,8 @@ const TablePagination = /*#__PURE__*/React.forwardRef(function TablePagination(i
|
|
|
244
245
|
rowsPerPage: rowsPerPage,
|
|
245
246
|
showFirstButton: showFirstButton,
|
|
246
247
|
showLastButton: showLastButton,
|
|
247
|
-
slotProps: slotProps
|
|
248
|
+
slotProps: slotProps.actions,
|
|
249
|
+
slots: slots.actions,
|
|
248
250
|
getItemAriaLabel: getItemAriaLabel,
|
|
249
251
|
disabled: disabled
|
|
250
252
|
})]
|
|
@@ -406,12 +408,33 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
|
|
|
406
408
|
slotProps: PropTypes.shape({
|
|
407
409
|
actions: PropTypes.shape({
|
|
408
410
|
firstButton: PropTypes.object,
|
|
411
|
+
firstButtonIcon: PropTypes.object,
|
|
409
412
|
lastButton: PropTypes.object,
|
|
413
|
+
lastButtonIcon: PropTypes.object,
|
|
410
414
|
nextButton: PropTypes.object,
|
|
411
|
-
|
|
415
|
+
nextButtonIcon: PropTypes.object,
|
|
416
|
+
previousButton: PropTypes.object,
|
|
417
|
+
previousButtonIcon: PropTypes.object
|
|
412
418
|
}),
|
|
413
419
|
select: PropTypes.object
|
|
414
420
|
}),
|
|
421
|
+
/**
|
|
422
|
+
* The components used for each slot inside the TablePagination.
|
|
423
|
+
* Either a string to use a HTML element or a component.
|
|
424
|
+
* @default {}
|
|
425
|
+
*/
|
|
426
|
+
slots: PropTypes.shape({
|
|
427
|
+
actions: PropTypes.shape({
|
|
428
|
+
firstButton: PropTypes.elementType,
|
|
429
|
+
firstButtonIcon: PropTypes.elementType,
|
|
430
|
+
lastButton: PropTypes.elementType,
|
|
431
|
+
lastButtonIcon: PropTypes.elementType,
|
|
432
|
+
nextButton: PropTypes.elementType,
|
|
433
|
+
nextButtonIcon: PropTypes.elementType,
|
|
434
|
+
previousButton: PropTypes.elementType,
|
|
435
|
+
previousButtonIcon: PropTypes.elementType
|
|
436
|
+
})
|
|
437
|
+
}),
|
|
415
438
|
/**
|
|
416
439
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
417
440
|
*/
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
|
|
6
|
-
const _excluded = ["backIconButtonProps", "count", "disabled", "getItemAriaLabel", "nextIconButtonProps", "onPageChange", "page", "rowsPerPage", "showFirstButton", "showLastButton", "slotProps"];
|
|
5
|
+
const _excluded = ["backIconButtonProps", "count", "disabled", "getItemAriaLabel", "nextIconButtonProps", "onPageChange", "page", "rowsPerPage", "showFirstButton", "showLastButton", "slots", "slotProps"];
|
|
7
6
|
import * as React from 'react';
|
|
8
7
|
import PropTypes from 'prop-types';
|
|
9
8
|
import KeyboardArrowLeft from '../internal/svg-icons/KeyboardArrowLeft';
|
|
10
9
|
import KeyboardArrowRight from '../internal/svg-icons/KeyboardArrowRight';
|
|
11
10
|
import useTheme from '../styles/useTheme';
|
|
12
11
|
import IconButton from '../IconButton';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
12
|
+
import LastPageIconDefault from '../internal/svg-icons/LastPage';
|
|
13
|
+
import FirstPageIconDefault from '../internal/svg-icons/FirstPage';
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* @ignore - internal component.
|
|
@@ -30,7 +29,8 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
|
|
|
30
29
|
rowsPerPage,
|
|
31
30
|
showFirstButton,
|
|
32
31
|
showLastButton,
|
|
33
|
-
|
|
32
|
+
slots = {},
|
|
33
|
+
slotProps = {}
|
|
34
34
|
} = props,
|
|
35
35
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
36
36
|
const theme = useTheme();
|
|
@@ -46,39 +46,55 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
|
|
|
46
46
|
const handleLastPageButtonClick = event => {
|
|
47
47
|
onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
|
|
48
48
|
};
|
|
49
|
+
const FirstButton = slots.firstButton ?? IconButton;
|
|
50
|
+
const LastButton = slots.lastButton ?? IconButton;
|
|
51
|
+
const NextButton = slots.nextButton ?? IconButton;
|
|
52
|
+
const PreviousButton = slots.previousButton ?? IconButton;
|
|
53
|
+
const FirstButtonIcon = slots.firstButtonIcon ?? FirstPageIconDefault;
|
|
54
|
+
const LastButtonIcon = slots.lastButtonIcon ?? LastPageIconDefault;
|
|
55
|
+
const NextButtonIcon = slots.nextButtonIcon ?? KeyboardArrowRight;
|
|
56
|
+
const PreviousButtonIcon = slots.previousButtonIcon ?? KeyboardArrowLeft;
|
|
57
|
+
const FirstButtonSlot = theme.direction === 'rtl' ? LastButton : FirstButton;
|
|
58
|
+
const PreviousButtonSlot = theme.direction === 'rtl' ? NextButton : PreviousButton;
|
|
59
|
+
const NextButtonSlot = theme.direction === 'rtl' ? PreviousButton : NextButton;
|
|
60
|
+
const LastButtonSlot = theme.direction === 'rtl' ? FirstButton : LastButton;
|
|
61
|
+
const firstButtonSlotProps = theme.direction === 'rtl' ? slotProps.lastButton : slotProps.firstButton;
|
|
62
|
+
const previousButtonSlotProps = theme.direction === 'rtl' ? slotProps.nextButton : slotProps.previousButton;
|
|
63
|
+
const nextButtonSlotProps = theme.direction === 'rtl' ? slotProps.previousButton : slotProps.nextButton;
|
|
64
|
+
const lastButtonSlotProps = theme.direction === 'rtl' ? slotProps.firstButton : slotProps.lastButton;
|
|
49
65
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
50
66
|
ref: ref
|
|
51
67
|
}, other, {
|
|
52
|
-
children: [showFirstButton && /*#__PURE__*/_jsx(
|
|
68
|
+
children: [showFirstButton && /*#__PURE__*/_jsx(FirstButtonSlot, _extends({
|
|
53
69
|
onClick: handleFirstPageButtonClick,
|
|
54
70
|
disabled: disabled || page === 0,
|
|
55
71
|
"aria-label": getItemAriaLabel('first', page),
|
|
56
72
|
title: getItemAriaLabel('first', page)
|
|
57
|
-
},
|
|
58
|
-
children: theme.direction === 'rtl' ?
|
|
59
|
-
})), /*#__PURE__*/_jsx(
|
|
73
|
+
}, firstButtonSlotProps, {
|
|
74
|
+
children: theme.direction === 'rtl' ? /*#__PURE__*/_jsx(LastButtonIcon, _extends({}, slotProps.lastButtonIcon)) : /*#__PURE__*/_jsx(FirstButtonIcon, _extends({}, slotProps.firstButtonIcon))
|
|
75
|
+
})), /*#__PURE__*/_jsx(PreviousButtonSlot, _extends({
|
|
60
76
|
onClick: handleBackButtonClick,
|
|
61
77
|
disabled: disabled || page === 0,
|
|
62
78
|
color: "inherit",
|
|
63
79
|
"aria-label": getItemAriaLabel('previous', page),
|
|
64
80
|
title: getItemAriaLabel('previous', page)
|
|
65
|
-
},
|
|
66
|
-
children: theme.direction === 'rtl' ?
|
|
67
|
-
})), /*#__PURE__*/_jsx(
|
|
81
|
+
}, previousButtonSlotProps ?? backIconButtonProps, {
|
|
82
|
+
children: theme.direction === 'rtl' ? /*#__PURE__*/_jsx(NextButtonIcon, _extends({}, slotProps.nextButtonIcon)) : /*#__PURE__*/_jsx(PreviousButtonIcon, _extends({}, slotProps.previousButtonIcon))
|
|
83
|
+
})), /*#__PURE__*/_jsx(NextButtonSlot, _extends({
|
|
68
84
|
onClick: handleNextButtonClick,
|
|
69
85
|
disabled: disabled || (count !== -1 ? page >= Math.ceil(count / rowsPerPage) - 1 : false),
|
|
70
86
|
color: "inherit",
|
|
71
87
|
"aria-label": getItemAriaLabel('next', page),
|
|
72
88
|
title: getItemAriaLabel('next', page)
|
|
73
|
-
},
|
|
74
|
-
children: theme.direction === 'rtl' ?
|
|
75
|
-
})), showLastButton && /*#__PURE__*/_jsx(
|
|
89
|
+
}, nextButtonSlotProps ?? nextIconButtonProps, {
|
|
90
|
+
children: theme.direction === 'rtl' ? /*#__PURE__*/_jsx(PreviousButtonIcon, _extends({}, slotProps.previousButtonIcon)) : /*#__PURE__*/_jsx(NextButtonIcon, _extends({}, slotProps.nextButtonIcon))
|
|
91
|
+
})), showLastButton && /*#__PURE__*/_jsx(LastButtonSlot, _extends({
|
|
76
92
|
onClick: handleLastPageButtonClick,
|
|
77
93
|
disabled: disabled || page >= Math.ceil(count / rowsPerPage) - 1,
|
|
78
94
|
"aria-label": getItemAriaLabel('last', page),
|
|
79
95
|
title: getItemAriaLabel('last', page)
|
|
80
|
-
},
|
|
81
|
-
children: theme.direction === 'rtl' ?
|
|
96
|
+
}, lastButtonSlotProps, {
|
|
97
|
+
children: theme.direction === 'rtl' ? /*#__PURE__*/_jsx(FirstButtonIcon, _extends({}, slotProps.firstButtonIcon)) : /*#__PURE__*/_jsx(LastButtonIcon, _extends({}, slotProps.lastButtonIcon))
|
|
82
98
|
}))]
|
|
83
99
|
}));
|
|
84
100
|
});
|
|
@@ -139,9 +155,28 @@ process.env.NODE_ENV !== "production" ? TablePaginationActions.propTypes = {
|
|
|
139
155
|
*/
|
|
140
156
|
slotProps: PropTypes.shape({
|
|
141
157
|
firstButton: PropTypes.object,
|
|
158
|
+
firstButtonIcon: PropTypes.object,
|
|
142
159
|
lastButton: PropTypes.object,
|
|
160
|
+
lastButtonIcon: PropTypes.object,
|
|
143
161
|
nextButton: PropTypes.object,
|
|
144
|
-
|
|
162
|
+
nextButtonIcon: PropTypes.object,
|
|
163
|
+
previousButton: PropTypes.object,
|
|
164
|
+
previousButtonIcon: PropTypes.object
|
|
165
|
+
}),
|
|
166
|
+
/**
|
|
167
|
+
* The components used for each slot inside the TablePaginationActions.
|
|
168
|
+
* Either a string to use a HTML element or a component.
|
|
169
|
+
* @default {}
|
|
170
|
+
*/
|
|
171
|
+
slots: PropTypes.shape({
|
|
172
|
+
firstButton: PropTypes.elementType,
|
|
173
|
+
firstButtonIcon: PropTypes.elementType,
|
|
174
|
+
lastButton: PropTypes.elementType,
|
|
175
|
+
lastButtonIcon: PropTypes.elementType,
|
|
176
|
+
nextButton: PropTypes.elementType,
|
|
177
|
+
nextButtonIcon: PropTypes.elementType,
|
|
178
|
+
previousButton: PropTypes.elementType,
|
|
179
|
+
previousButtonIcon: PropTypes.elementType
|
|
145
180
|
})
|
|
146
181
|
} : void 0;
|
|
147
182
|
export default TablePaginationActions;
|
package/modern/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["colorSchemes", "cssVarPrefix", "shouldSkipGeneratingVar"],
|
|
4
4
|
_excluded2 = ["palette"];
|
|
5
5
|
import { deepmerge } from '@mui/utils';
|
|
6
|
-
import { private_safeColorChannel as safeColorChannel, private_safeAlpha as safeAlpha, private_safeDarken as safeDarken, private_safeLighten as safeLighten, private_safeEmphasize as safeEmphasize, unstable_createGetCssVar as systemCreateGetCssVar, unstable_defaultSxConfig as defaultSxConfig, unstable_styleFunctionSx as styleFunctionSx, unstable_prepareCssVars as prepareCssVars } from '@mui/system';
|
|
6
|
+
import { private_safeColorChannel as safeColorChannel, private_safeAlpha as safeAlpha, private_safeDarken as safeDarken, private_safeLighten as safeLighten, private_safeEmphasize as safeEmphasize, unstable_createGetCssVar as systemCreateGetCssVar, unstable_defaultSxConfig as defaultSxConfig, unstable_styleFunctionSx as styleFunctionSx, unstable_prepareCssVars as prepareCssVars, hslToRgb } from '@mui/system';
|
|
7
7
|
import defaultShouldSkipGeneratingVar from './shouldSkipGeneratingVar';
|
|
8
8
|
import createThemeWithoutVars from './createTheme';
|
|
9
9
|
import getOverlayAlpha from './getOverlayAlpha';
|
|
@@ -26,11 +26,17 @@ function setColor(obj, key, defaultValue) {
|
|
|
26
26
|
obj[key] = defaultValue;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
function toRgb(color) {
|
|
30
|
+
if (!color || !color.startsWith('hsl')) {
|
|
31
|
+
return color;
|
|
32
|
+
}
|
|
33
|
+
return hslToRgb(color);
|
|
34
|
+
}
|
|
29
35
|
function setColorChannel(obj, key) {
|
|
30
36
|
if (!(`${key}Channel` in obj)) {
|
|
31
37
|
// custom channel token is not provided, generate one.
|
|
32
38
|
// if channel token can't be generated, show a warning.
|
|
33
|
-
obj[`${key}Channel`] = safeColorChannel(obj[key], `MUI: Can't create \`palette.${key}Channel\` because \`palette.${key}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` + '\n' + `To suppress this warning, you need to explicitly provide the \`palette.${key}Channel\` as a string (in rgb format, e.g. "12 12 12") or undefined if you want to remove the channel token.`);
|
|
39
|
+
obj[`${key}Channel`] = safeColorChannel(toRgb(obj[key]), `MUI: Can't create \`palette.${key}Channel\` because \`palette.${key}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` + '\n' + `To suppress this warning, you need to explicitly provide the \`palette.${key}Channel\` as a string (in rgb format, e.g. "12 12 12") or undefined if you want to remove the channel token.`);
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
const silent = fn => {
|
|
@@ -247,16 +253,16 @@ export default function extendTheme(options = {}, ...args) {
|
|
|
247
253
|
if (colors && typeof colors === 'object') {
|
|
248
254
|
// Silent the error for custom palettes.
|
|
249
255
|
if (colors.main) {
|
|
250
|
-
setColor(palette[color], 'mainChannel', safeColorChannel(colors.main));
|
|
256
|
+
setColor(palette[color], 'mainChannel', safeColorChannel(toRgb(colors.main)));
|
|
251
257
|
}
|
|
252
258
|
if (colors.light) {
|
|
253
|
-
setColor(palette[color], 'lightChannel', safeColorChannel(colors.light));
|
|
259
|
+
setColor(palette[color], 'lightChannel', safeColorChannel(toRgb(colors.light)));
|
|
254
260
|
}
|
|
255
261
|
if (colors.dark) {
|
|
256
|
-
setColor(palette[color], 'darkChannel', safeColorChannel(colors.dark));
|
|
262
|
+
setColor(palette[color], 'darkChannel', safeColorChannel(toRgb(colors.dark)));
|
|
257
263
|
}
|
|
258
264
|
if (colors.contrastText) {
|
|
259
|
-
setColor(palette[color], 'contrastTextChannel', safeColorChannel(colors.contrastText));
|
|
265
|
+
setColor(palette[color], 'contrastTextChannel', safeColorChannel(toRgb(colors.contrastText)));
|
|
260
266
|
}
|
|
261
267
|
if (color === 'text') {
|
|
262
268
|
// Text colors: text.primary, text.secondary
|
|
@@ -672,7 +672,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
|
|
|
672
672
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
673
673
|
// ----------------------------------------------------------------------
|
|
674
674
|
/**
|
|
675
|
-
* If `true`, the portion of the selected suggestion that
|
|
675
|
+
* If `true`, the portion of the selected suggestion that the user hasn't typed,
|
|
676
676
|
* known as the completion string, appears inline after the input cursor in the textbox.
|
|
677
677
|
* The inline completion string is visually highlighted and has a selected state.
|
|
678
678
|
* @default false
|
|
@@ -688,7 +688,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
|
|
|
688
688
|
* when the Autocomplete loses focus unless the user chooses
|
|
689
689
|
* a different option or changes the character string in the input.
|
|
690
690
|
*
|
|
691
|
-
* When using `freeSolo` mode, the typed value will be the input value
|
|
691
|
+
* When using the `freeSolo` mode, the typed value will be the input value
|
|
692
692
|
* if the Autocomplete loses focus without highlighting an option.
|
|
693
693
|
* @default false
|
|
694
694
|
*/
|
|
@@ -723,8 +723,8 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes /* remove-proptyp
|
|
|
723
723
|
/**
|
|
724
724
|
* If `true`, the input's text is cleared on blur if no value is selected.
|
|
725
725
|
*
|
|
726
|
-
* Set to `true` if you want to help the user enter a new value.
|
|
727
|
-
* Set to `false` if you want to help the user resume their search.
|
|
726
|
+
* Set it to `true` if you want to help the user enter a new value.
|
|
727
|
+
* Set it to `false` if you want to help the user resume their search.
|
|
728
728
|
* @default !props.freeSolo
|
|
729
729
|
*/
|
|
730
730
|
clearOnBlur: _propTypes.default.bool,
|
|
@@ -26,7 +26,7 @@ var _useId = _interopRequireDefault(require("../utils/useId"));
|
|
|
26
26
|
var _tablePaginationClasses = _interopRequireWildcard(require("./tablePaginationClasses"));
|
|
27
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
28
|
var _InputBase;
|
|
29
|
-
const _excluded = ["ActionsComponent", "backIconButtonProps", "className", "colSpan", "component", "count", "disabled", "getItemAriaLabel", "labelDisplayedRows", "labelRowsPerPage", "nextIconButtonProps", "onPageChange", "onRowsPerPageChange", "page", "rowsPerPage", "rowsPerPageOptions", "SelectProps", "showFirstButton", "showLastButton", "slotProps"];
|
|
29
|
+
const _excluded = ["ActionsComponent", "backIconButtonProps", "className", "colSpan", "component", "count", "disabled", "getItemAriaLabel", "labelDisplayedRows", "labelRowsPerPage", "nextIconButtonProps", "onPageChange", "onRowsPerPageChange", "page", "rowsPerPage", "rowsPerPageOptions", "SelectProps", "showFirstButton", "showLastButton", "slotProps", "slots"];
|
|
30
30
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
31
31
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
32
32
|
const TablePaginationRoot = (0, _styled.default)(_TableCell.default, {
|
|
@@ -175,7 +175,8 @@ const TablePagination = /*#__PURE__*/React.forwardRef(function TablePagination(i
|
|
|
175
175
|
SelectProps = {},
|
|
176
176
|
showFirstButton = false,
|
|
177
177
|
showLastButton = false,
|
|
178
|
-
slotProps
|
|
178
|
+
slotProps = {},
|
|
179
|
+
slots = {}
|
|
179
180
|
} = props,
|
|
180
181
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
181
182
|
const ownerState = props;
|
|
@@ -252,7 +253,8 @@ const TablePagination = /*#__PURE__*/React.forwardRef(function TablePagination(i
|
|
|
252
253
|
rowsPerPage: rowsPerPage,
|
|
253
254
|
showFirstButton: showFirstButton,
|
|
254
255
|
showLastButton: showLastButton,
|
|
255
|
-
slotProps: slotProps
|
|
256
|
+
slotProps: slotProps.actions,
|
|
257
|
+
slots: slots.actions,
|
|
256
258
|
getItemAriaLabel: getItemAriaLabel,
|
|
257
259
|
disabled: disabled
|
|
258
260
|
})]
|
|
@@ -414,12 +416,33 @@ process.env.NODE_ENV !== "production" ? TablePagination.propTypes /* remove-prop
|
|
|
414
416
|
slotProps: _propTypes.default.shape({
|
|
415
417
|
actions: _propTypes.default.shape({
|
|
416
418
|
firstButton: _propTypes.default.object,
|
|
419
|
+
firstButtonIcon: _propTypes.default.object,
|
|
417
420
|
lastButton: _propTypes.default.object,
|
|
421
|
+
lastButtonIcon: _propTypes.default.object,
|
|
418
422
|
nextButton: _propTypes.default.object,
|
|
419
|
-
|
|
423
|
+
nextButtonIcon: _propTypes.default.object,
|
|
424
|
+
previousButton: _propTypes.default.object,
|
|
425
|
+
previousButtonIcon: _propTypes.default.object
|
|
420
426
|
}),
|
|
421
427
|
select: _propTypes.default.object
|
|
422
428
|
}),
|
|
429
|
+
/**
|
|
430
|
+
* The components used for each slot inside the TablePagination.
|
|
431
|
+
* Either a string to use a HTML element or a component.
|
|
432
|
+
* @default {}
|
|
433
|
+
*/
|
|
434
|
+
slots: _propTypes.default.shape({
|
|
435
|
+
actions: _propTypes.default.shape({
|
|
436
|
+
firstButton: _propTypes.default.elementType,
|
|
437
|
+
firstButtonIcon: _propTypes.default.elementType,
|
|
438
|
+
lastButton: _propTypes.default.elementType,
|
|
439
|
+
lastButtonIcon: _propTypes.default.elementType,
|
|
440
|
+
nextButton: _propTypes.default.elementType,
|
|
441
|
+
nextButtonIcon: _propTypes.default.elementType,
|
|
442
|
+
previousButton: _propTypes.default.elementType,
|
|
443
|
+
previousButtonIcon: _propTypes.default.elementType
|
|
444
|
+
})
|
|
445
|
+
}),
|
|
423
446
|
/**
|
|
424
447
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
425
448
|
*/
|
|
@@ -10,22 +10,21 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var _KeyboardArrowLeft = _interopRequireDefault(require("../internal/svg-icons/KeyboardArrowLeft"));
|
|
14
|
+
var _KeyboardArrowRight = _interopRequireDefault(require("../internal/svg-icons/KeyboardArrowRight"));
|
|
15
15
|
var _useTheme = _interopRequireDefault(require("../styles/useTheme"));
|
|
16
16
|
var _IconButton = _interopRequireDefault(require("../IconButton"));
|
|
17
17
|
var _LastPage = _interopRequireDefault(require("../internal/svg-icons/LastPage"));
|
|
18
18
|
var _FirstPage = _interopRequireDefault(require("../internal/svg-icons/FirstPage"));
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
|
|
21
|
-
const _excluded = ["backIconButtonProps", "count", "disabled", "getItemAriaLabel", "nextIconButtonProps", "onPageChange", "page", "rowsPerPage", "showFirstButton", "showLastButton", "slotProps"];
|
|
20
|
+
const _excluded = ["backIconButtonProps", "count", "disabled", "getItemAriaLabel", "nextIconButtonProps", "onPageChange", "page", "rowsPerPage", "showFirstButton", "showLastButton", "slots", "slotProps"];
|
|
22
21
|
/**
|
|
23
22
|
* @ignore - internal component.
|
|
24
23
|
*/
|
|
25
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
26
25
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
27
26
|
const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePaginationActions(props, ref) {
|
|
28
|
-
var
|
|
27
|
+
var _slots$firstButton, _slots$lastButton, _slots$nextButton, _slots$previousButton, _slots$firstButtonIco, _slots$lastButtonIcon, _slots$nextButtonIcon, _slots$previousButton2;
|
|
29
28
|
const {
|
|
30
29
|
backIconButtonProps,
|
|
31
30
|
count,
|
|
@@ -37,7 +36,8 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
|
|
|
37
36
|
rowsPerPage,
|
|
38
37
|
showFirstButton,
|
|
39
38
|
showLastButton,
|
|
40
|
-
|
|
39
|
+
slots = {},
|
|
40
|
+
slotProps = {}
|
|
41
41
|
} = props,
|
|
42
42
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
43
43
|
const theme = (0, _useTheme.default)();
|
|
@@ -53,39 +53,55 @@ const TablePaginationActions = /*#__PURE__*/React.forwardRef(function TablePagin
|
|
|
53
53
|
const handleLastPageButtonClick = event => {
|
|
54
54
|
onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
|
|
55
55
|
};
|
|
56
|
+
const FirstButton = (_slots$firstButton = slots.firstButton) != null ? _slots$firstButton : _IconButton.default;
|
|
57
|
+
const LastButton = (_slots$lastButton = slots.lastButton) != null ? _slots$lastButton : _IconButton.default;
|
|
58
|
+
const NextButton = (_slots$nextButton = slots.nextButton) != null ? _slots$nextButton : _IconButton.default;
|
|
59
|
+
const PreviousButton = (_slots$previousButton = slots.previousButton) != null ? _slots$previousButton : _IconButton.default;
|
|
60
|
+
const FirstButtonIcon = (_slots$firstButtonIco = slots.firstButtonIcon) != null ? _slots$firstButtonIco : _FirstPage.default;
|
|
61
|
+
const LastButtonIcon = (_slots$lastButtonIcon = slots.lastButtonIcon) != null ? _slots$lastButtonIcon : _LastPage.default;
|
|
62
|
+
const NextButtonIcon = (_slots$nextButtonIcon = slots.nextButtonIcon) != null ? _slots$nextButtonIcon : _KeyboardArrowRight.default;
|
|
63
|
+
const PreviousButtonIcon = (_slots$previousButton2 = slots.previousButtonIcon) != null ? _slots$previousButton2 : _KeyboardArrowLeft.default;
|
|
64
|
+
const FirstButtonSlot = theme.direction === 'rtl' ? LastButton : FirstButton;
|
|
65
|
+
const PreviousButtonSlot = theme.direction === 'rtl' ? NextButton : PreviousButton;
|
|
66
|
+
const NextButtonSlot = theme.direction === 'rtl' ? PreviousButton : NextButton;
|
|
67
|
+
const LastButtonSlot = theme.direction === 'rtl' ? FirstButton : LastButton;
|
|
68
|
+
const firstButtonSlotProps = theme.direction === 'rtl' ? slotProps.lastButton : slotProps.firstButton;
|
|
69
|
+
const previousButtonSlotProps = theme.direction === 'rtl' ? slotProps.nextButton : slotProps.previousButton;
|
|
70
|
+
const nextButtonSlotProps = theme.direction === 'rtl' ? slotProps.previousButton : slotProps.nextButton;
|
|
71
|
+
const lastButtonSlotProps = theme.direction === 'rtl' ? slotProps.firstButton : slotProps.lastButton;
|
|
56
72
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _extends2.default)({
|
|
57
73
|
ref: ref
|
|
58
74
|
}, other, {
|
|
59
|
-
children: [showFirstButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
75
|
+
children: [showFirstButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(FirstButtonSlot, (0, _extends2.default)({
|
|
60
76
|
onClick: handleFirstPageButtonClick,
|
|
61
77
|
disabled: disabled || page === 0,
|
|
62
78
|
"aria-label": getItemAriaLabel('first', page),
|
|
63
79
|
title: getItemAriaLabel('first', page)
|
|
64
|
-
},
|
|
65
|
-
children: theme.direction === 'rtl' ?
|
|
66
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
80
|
+
}, firstButtonSlotProps, {
|
|
81
|
+
children: theme.direction === 'rtl' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(LastButtonIcon, (0, _extends2.default)({}, slotProps.lastButtonIcon)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(FirstButtonIcon, (0, _extends2.default)({}, slotProps.firstButtonIcon))
|
|
82
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(PreviousButtonSlot, (0, _extends2.default)({
|
|
67
83
|
onClick: handleBackButtonClick,
|
|
68
84
|
disabled: disabled || page === 0,
|
|
69
85
|
color: "inherit",
|
|
70
86
|
"aria-label": getItemAriaLabel('previous', page),
|
|
71
87
|
title: getItemAriaLabel('previous', page)
|
|
72
|
-
},
|
|
73
|
-
children: theme.direction === 'rtl' ?
|
|
74
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
88
|
+
}, previousButtonSlotProps != null ? previousButtonSlotProps : backIconButtonProps, {
|
|
89
|
+
children: theme.direction === 'rtl' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(NextButtonIcon, (0, _extends2.default)({}, slotProps.nextButtonIcon)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PreviousButtonIcon, (0, _extends2.default)({}, slotProps.previousButtonIcon))
|
|
90
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(NextButtonSlot, (0, _extends2.default)({
|
|
75
91
|
onClick: handleNextButtonClick,
|
|
76
92
|
disabled: disabled || (count !== -1 ? page >= Math.ceil(count / rowsPerPage) - 1 : false),
|
|
77
93
|
color: "inherit",
|
|
78
94
|
"aria-label": getItemAriaLabel('next', page),
|
|
79
95
|
title: getItemAriaLabel('next', page)
|
|
80
|
-
},
|
|
81
|
-
children: theme.direction === 'rtl' ?
|
|
82
|
-
})), showLastButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
96
|
+
}, nextButtonSlotProps != null ? nextButtonSlotProps : nextIconButtonProps, {
|
|
97
|
+
children: theme.direction === 'rtl' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(PreviousButtonIcon, (0, _extends2.default)({}, slotProps.previousButtonIcon)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(NextButtonIcon, (0, _extends2.default)({}, slotProps.nextButtonIcon))
|
|
98
|
+
})), showLastButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(LastButtonSlot, (0, _extends2.default)({
|
|
83
99
|
onClick: handleLastPageButtonClick,
|
|
84
100
|
disabled: disabled || page >= Math.ceil(count / rowsPerPage) - 1,
|
|
85
101
|
"aria-label": getItemAriaLabel('last', page),
|
|
86
102
|
title: getItemAriaLabel('last', page)
|
|
87
|
-
},
|
|
88
|
-
children: theme.direction === 'rtl' ?
|
|
103
|
+
}, lastButtonSlotProps, {
|
|
104
|
+
children: theme.direction === 'rtl' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(FirstButtonIcon, (0, _extends2.default)({}, slotProps.firstButtonIcon)) : /*#__PURE__*/(0, _jsxRuntime.jsx)(LastButtonIcon, (0, _extends2.default)({}, slotProps.lastButtonIcon))
|
|
89
105
|
}))]
|
|
90
106
|
}));
|
|
91
107
|
});
|
|
@@ -146,9 +162,28 @@ process.env.NODE_ENV !== "production" ? TablePaginationActions.propTypes = {
|
|
|
146
162
|
*/
|
|
147
163
|
slotProps: _propTypes.default.shape({
|
|
148
164
|
firstButton: _propTypes.default.object,
|
|
165
|
+
firstButtonIcon: _propTypes.default.object,
|
|
149
166
|
lastButton: _propTypes.default.object,
|
|
167
|
+
lastButtonIcon: _propTypes.default.object,
|
|
150
168
|
nextButton: _propTypes.default.object,
|
|
151
|
-
|
|
169
|
+
nextButtonIcon: _propTypes.default.object,
|
|
170
|
+
previousButton: _propTypes.default.object,
|
|
171
|
+
previousButtonIcon: _propTypes.default.object
|
|
172
|
+
}),
|
|
173
|
+
/**
|
|
174
|
+
* The components used for each slot inside the TablePaginationActions.
|
|
175
|
+
* Either a string to use a HTML element or a component.
|
|
176
|
+
* @default {}
|
|
177
|
+
*/
|
|
178
|
+
slots: _propTypes.default.shape({
|
|
179
|
+
firstButton: _propTypes.default.elementType,
|
|
180
|
+
firstButtonIcon: _propTypes.default.elementType,
|
|
181
|
+
lastButton: _propTypes.default.elementType,
|
|
182
|
+
lastButtonIcon: _propTypes.default.elementType,
|
|
183
|
+
nextButton: _propTypes.default.elementType,
|
|
184
|
+
nextButtonIcon: _propTypes.default.elementType,
|
|
185
|
+
previousButton: _propTypes.default.elementType,
|
|
186
|
+
previousButtonIcon: _propTypes.default.elementType
|
|
152
187
|
})
|
|
153
188
|
} : void 0;
|
|
154
189
|
var _default = exports.default = TablePaginationActions;
|
package/node/index.js
CHANGED