@mui/material 5.2.8 → 5.3.0
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/accordionClasses.d.ts +18 -18
- package/AccordionActions/accordionActionsClasses.d.ts +10 -10
- package/AccordionDetails/accordionDetailsClasses.d.ts +8 -8
- package/AccordionSummary/accordionSummaryClasses.d.ts +22 -22
- package/Alert/alertClasses.d.ts +44 -44
- package/AlertTitle/alertTitleClasses.d.ts +8 -8
- package/AppBar/appBarClasses.d.ts +28 -28
- package/Autocomplete/Autocomplete.d.ts +2 -0
- package/Autocomplete/Autocomplete.js +8 -6
- package/Autocomplete/autocompleteClasses.d.ts +54 -54
- package/Avatar/avatarClasses.d.ts +20 -20
- package/AvatarGroup/avatarGroupClasses.d.ts +10 -10
- package/Badge/Badge.js +2 -6
- package/BottomNavigation/BottomNavigation.js +0 -0
- package/BottomNavigation/bottomNavigationClasses.d.ts +8 -8
- package/BottomNavigationAction/bottomNavigationActionClasses.d.ts +14 -14
- package/Breadcrumbs/breadcrumbsClasses.d.ts +14 -14
- package/Button/buttonClasses.d.ts +76 -76
- package/ButtonBase/buttonBaseClasses.d.ts +12 -12
- package/ButtonBase/touchRippleClasses.d.ts +20 -20
- package/ButtonGroup/ButtonGroupContext.d.ts +18 -18
- package/ButtonGroup/buttonGroupClasses.d.ts +58 -58
- package/CHANGELOG.md +73 -0
- package/Card/cardClasses.d.ts +8 -8
- package/CardActionArea/cardActionAreaClasses.d.ts +12 -12
- package/CardActions/cardActionsClasses.d.ts +10 -10
- package/CardContent/cardContentClasses.d.ts +8 -8
- package/CardHeader/cardHeaderClasses.d.ts +18 -18
- package/CardMedia/cardMediaClasses.d.ts +12 -12
- package/Checkbox/checkboxClasses.d.ts +18 -18
- package/Chip/chipClasses.d.ts +80 -80
- package/CircularProgress/circularProgressClasses.d.ts +26 -26
- package/ClickAwayListener/index.d.ts +2 -2
- package/Collapse/collapseClasses.d.ts +18 -18
- package/Container/containerClasses.d.ts +22 -22
- package/Dialog/DialogContext.d.ts +6 -6
- package/Dialog/dialogClasses.d.ts +36 -36
- package/DialogActions/dialogActionsClasses.d.ts +10 -10
- package/DialogContent/dialogContentClasses.d.ts +10 -10
- package/DialogContentText/dialogContentTextClasses.d.ts +8 -8
- package/DialogTitle/dialogTitleClasses.d.ts +8 -8
- package/Divider/dividerClasses.d.ts +34 -34
- package/Drawer/drawerClasses.d.ts +30 -30
- package/Fab/fabClasses.d.ts +26 -26
- package/FilledInput/filledInputClasses.d.ts +40 -40
- package/FormControl/formControlClasses.d.ts +14 -14
- package/FormControlLabel/formControlLabelClasses.d.ts +18 -18
- package/FormGroup/formGroupClasses.d.ts +10 -10
- package/FormHelperText/formHelperTextClasses.d.ts +22 -22
- package/FormLabel/formLabelClasses.d.ts +22 -22
- package/Grid/gridClasses.d.ts +48 -48
- package/Icon/iconClasses.d.ts +24 -24
- package/IconButton/iconButtonClasses.d.ts +26 -26
- package/ImageList/imageListClasses.d.ts +16 -16
- package/ImageListItem/imageListItemClasses.d.ts +18 -18
- package/ImageListItemBar/imageListItemBarClasses.d.ts +30 -30
- package/Input/inputClasses.d.ts +34 -34
- package/InputAdornment/inputAdornmentClasses.d.ts +24 -24
- package/InputBase/inputBaseClasses.d.ts +44 -44
- package/InputLabel/inputLabelClasses.d.ts +32 -32
- package/LinearProgress/linearProgressClasses.d.ts +42 -42
- package/Link/linkClasses.d.ts +18 -18
- package/List/listClasses.d.ts +14 -14
- package/ListItem/listItemClasses.d.ts +30 -30
- package/ListItemAvatar/listItemAvatarClasses.d.ts +10 -10
- package/ListItemButton/listItemButtonClasses.d.ts +22 -22
- package/ListItemIcon/listItemIconClasses.d.ts +10 -10
- package/ListItemSecondaryAction/listItemSecondaryActionClasses.d.ts +10 -10
- package/ListItemText/listItemTextClasses.d.ts +18 -18
- package/ListSubheader/listSubheaderClasses.d.ts +18 -18
- package/Menu/menuClasses.d.ts +12 -12
- package/MenuItem/menuItemClasses.d.ts +20 -20
- package/MobileStepper/mobileStepperClasses.d.ts +22 -22
- package/NativeSelect/nativeSelectClasses.d.ts +32 -32
- package/OutlinedInput/outlinedInputClasses.d.ts +36 -36
- package/Pagination/paginationClasses.d.ts +14 -14
- package/PaginationItem/paginationItemClasses.d.ts +42 -42
- package/Paper/paperClasses.d.ts +39 -39
- package/Popover/popoverClasses.d.ts +10 -10
- package/Popper/Popper.d.ts +17 -17
- package/README.md +3 -3
- package/Radio/radioClasses.d.ts +16 -16
- package/RadioGroup/RadioGroupContext.d.ts +11 -11
- package/RadioGroup/useRadioGroup.d.ts +4 -4
- package/Rating/ratingClasses.d.ts +40 -40
- package/ScopedCssBaseline/scopedCssBaselineClasses.d.ts +8 -8
- package/Select/Select.d.ts +9 -1
- package/Select/Select.js +10 -1
- package/Select/SelectInput.d.ts +1 -0
- package/Select/SelectInput.js +25 -4
- package/Select/selectClasses.d.ts +30 -30
- package/Skeleton/skeletonClasses.d.ts +24 -24
- package/Slider/Slider.js +109 -54
- package/Snackbar/snackbarClasses.d.ts +20 -20
- package/SnackbarContent/snackbarContentClasses.d.ts +12 -12
- package/SpeedDial/speedDialClasses.d.ts +22 -22
- package/SpeedDialAction/speedDialActionClasses.d.ts +20 -20
- package/SpeedDialIcon/speedDialIconClasses.d.ts +18 -18
- package/Step/stepClasses.d.ts +16 -16
- package/StepButton/stepButtonClasses.d.ts +14 -14
- package/StepConnector/stepConnectorClasses.d.ts +26 -26
- package/StepContent/stepContentClasses.d.ts +12 -12
- package/StepIcon/stepIconClasses.d.ts +16 -16
- package/StepLabel/stepLabelClasses.d.ts +28 -28
- package/Stepper/stepperClasses.d.ts +14 -14
- package/SvgIcon/svgIconClasses.d.ts +24 -24
- package/Switch/switchClasses.d.ts +32 -32
- package/Tab/tabClasses.d.ts +26 -26
- package/TabScrollButton/tabScrollButtonClasses.d.ts +12 -12
- package/Table/tableClasses.d.ts +10 -10
- package/TableBody/tableBodyClasses.d.ts +8 -8
- package/TableCell/tableCellClasses.d.ts +32 -32
- package/TableContainer/tableContainerClasses.d.ts +8 -8
- package/TableFooter/tableFooterClasses.d.ts +8 -8
- package/TableHead/tableHeadClasses.d.ts +8 -8
- package/TablePagination/tablePaginationClasses.d.ts +28 -28
- package/TableRow/tableRowClasses.d.ts +16 -16
- package/TableSortLabel/tableSortLabelClasses.d.ts +16 -16
- package/Tabs/tabsClasses.d.ts +32 -32
- package/TextField/textFieldClasses.d.ts +8 -8
- package/ToggleButton/toggleButtonClasses.d.ts +24 -24
- package/ToggleButtonGroup/toggleButtonGroupClasses.d.ts +18 -18
- package/Toolbar/toolbarClasses.d.ts +14 -14
- package/Tooltip/tooltipClasses.d.ts +30 -30
- package/Typography/typographyClasses.d.ts +50 -50
- package/darkScrollbar/index.d.ts +28 -28
- package/index.js +1 -1
- package/internal/switchBaseClasses.d.ts +12 -12
- package/legacy/Autocomplete/Autocomplete.js +8 -6
- package/legacy/Badge/Badge.js +2 -6
- package/legacy/BottomNavigation/BottomNavigation.js +0 -0
- package/legacy/Select/Select.js +11 -1
- package/legacy/Select/SelectInput.js +29 -7
- package/legacy/Slider/Slider.js +110 -55
- package/legacy/index.js +1 -1
- package/legacy/utils/shouldSpreadAdditionalProps.js +7 -0
- package/locale/index.d.ts +68 -68
- package/modern/Autocomplete/Autocomplete.js +7 -5
- package/modern/Badge/Badge.js +2 -6
- package/modern/BottomNavigation/BottomNavigation.js +0 -0
- package/modern/Select/Select.js +10 -1
- package/modern/Select/SelectInput.js +25 -4
- package/modern/Slider/Slider.js +109 -54
- package/modern/index.js +1 -1
- package/modern/utils/shouldSpreadAdditionalProps.js +7 -0
- package/node/Autocomplete/Autocomplete.js +8 -6
- package/node/Badge/Badge.js +4 -7
- package/node/BottomNavigation/BottomNavigation.js +0 -0
- package/node/Select/Select.js +10 -1
- package/node/Select/SelectInput.js +25 -4
- package/node/Slider/Slider.js +95 -46
- package/node/index.js +1 -1
- package/node/utils/shouldSpreadAdditionalProps.js +15 -0
- package/package.json +7 -7
- package/styles/components.d.ts +452 -113
- package/styles/createTheme.d.ts +12 -6
- package/styles/overrides.d.ts +16 -4
- package/styles/useThemeProps.d.ts +2 -1
- package/transitions/index.d.ts +1 -1
- package/transitions/transition.d.ts +13 -13
- package/transitions/utils.d.ts +23 -23
- package/umd/material-ui.development.js +464 -255
- package/umd/material-ui.production.min.js +21 -21
- package/useMediaQuery/useMediaQuery.d.ts +27 -27
- package/useTouchRipple/index.d.ts +1 -1
- package/useTouchRipple/useTouchRipple.d.ts +28 -28
- package/utils/getScrollbarSize.d.ts +2 -2
- package/utils/ownerDocument.d.ts +2 -2
- package/utils/ownerWindow.d.ts +2 -2
- package/utils/setRef.d.ts +2 -2
- package/utils/shouldSpreadAdditionalProps.js +7 -0
package/modern/Slider/Slider.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["components", "componentsProps", "color", "size"];
|
|
3
|
+
const _excluded = ["component", "components", "componentsProps", "color", "size"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { chainPropTypes } from '@mui/utils';
|
|
8
|
-
import { generateUtilityClasses
|
|
8
|
+
import { generateUtilityClasses } from '@mui/base';
|
|
9
9
|
import SliderUnstyled, { SliderValueLabelUnstyled, sliderUnstyledClasses, getSliderUtilityClass } from '@mui/base/SliderUnstyled';
|
|
10
10
|
import { alpha, lighten, darken } from '@mui/system';
|
|
11
11
|
import useThemeProps from '../styles/useThemeProps';
|
|
12
12
|
import styled, { slotShouldForwardProp } from '../styles/styled';
|
|
13
13
|
import useTheme from '../styles/useTheme';
|
|
14
|
+
import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
|
|
14
15
|
import capitalize from '../utils/capitalize';
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
export const sliderClasses = _extends({}, sliderUnstyledClasses, generateUtilityClasses('MuiSlider', ['colorPrimary', 'colorSecondary', 'thumbColorPrimary', 'thumbColorSecondary', 'sizeSmall', 'thumbSizeSmall']));
|
|
17
|
-
|
|
18
|
+
const SliderRoot = styled('span', {
|
|
18
19
|
name: 'MuiSlider',
|
|
19
20
|
slot: 'Root',
|
|
20
21
|
overridesResolver: (props, styles) => {
|
|
@@ -80,7 +81,21 @@ export const SliderRoot = styled('span', {
|
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
}));
|
|
83
|
-
|
|
84
|
+
process.env.NODE_ENV !== "production" ? SliderRoot.propTypes
|
|
85
|
+
/* remove-proptypes */
|
|
86
|
+
= {
|
|
87
|
+
// ----------------------------- Warning --------------------------------
|
|
88
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
89
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
90
|
+
// ----------------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @ignore
|
|
94
|
+
*/
|
|
95
|
+
children: PropTypes.node
|
|
96
|
+
} : void 0;
|
|
97
|
+
export { SliderRoot };
|
|
98
|
+
const SliderRail = styled('span', {
|
|
84
99
|
name: 'MuiSlider',
|
|
85
100
|
slot: 'Rail',
|
|
86
101
|
overridesResolver: (props, styles) => styles.rail
|
|
@@ -105,7 +120,21 @@ export const SliderRail = styled('span', {
|
|
|
105
120
|
}, ownerState.track === 'inverted' && {
|
|
106
121
|
opacity: 1
|
|
107
122
|
}));
|
|
108
|
-
|
|
123
|
+
process.env.NODE_ENV !== "production" ? SliderRail.propTypes
|
|
124
|
+
/* remove-proptypes */
|
|
125
|
+
= {
|
|
126
|
+
// ----------------------------- Warning --------------------------------
|
|
127
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
128
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
129
|
+
// ----------------------------------------------------------------------
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @ignore
|
|
133
|
+
*/
|
|
134
|
+
children: PropTypes.node
|
|
135
|
+
} : void 0;
|
|
136
|
+
export { SliderRail };
|
|
137
|
+
const SliderTrack = styled('span', {
|
|
109
138
|
name: 'MuiSlider',
|
|
110
139
|
slot: 'Track',
|
|
111
140
|
overridesResolver: (props, styles) => styles.track
|
|
@@ -141,7 +170,21 @@ export const SliderTrack = styled('span', {
|
|
|
141
170
|
borderColor: color
|
|
142
171
|
});
|
|
143
172
|
});
|
|
144
|
-
|
|
173
|
+
process.env.NODE_ENV !== "production" ? SliderTrack.propTypes
|
|
174
|
+
/* remove-proptypes */
|
|
175
|
+
= {
|
|
176
|
+
// ----------------------------- Warning --------------------------------
|
|
177
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
178
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
179
|
+
// ----------------------------------------------------------------------
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @ignore
|
|
183
|
+
*/
|
|
184
|
+
children: PropTypes.node
|
|
185
|
+
} : void 0;
|
|
186
|
+
export { SliderTrack };
|
|
187
|
+
const SliderThumb = styled('span', {
|
|
145
188
|
name: 'MuiSlider',
|
|
146
189
|
slot: 'Thumb',
|
|
147
190
|
overridesResolver: (props, styles) => {
|
|
@@ -213,7 +256,21 @@ export const SliderThumb = styled('span', {
|
|
|
213
256
|
}
|
|
214
257
|
}
|
|
215
258
|
}));
|
|
216
|
-
|
|
259
|
+
process.env.NODE_ENV !== "production" ? SliderThumb.propTypes
|
|
260
|
+
/* remove-proptypes */
|
|
261
|
+
= {
|
|
262
|
+
// ----------------------------- Warning --------------------------------
|
|
263
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
264
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
265
|
+
// ----------------------------------------------------------------------
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* @ignore
|
|
269
|
+
*/
|
|
270
|
+
children: PropTypes.node
|
|
271
|
+
} : void 0;
|
|
272
|
+
export { SliderThumb };
|
|
273
|
+
const SliderValueLabel = styled(SliderValueLabelUnstyled, {
|
|
217
274
|
name: 'MuiSlider',
|
|
218
275
|
slot: 'ValueLabel',
|
|
219
276
|
overridesResolver: (props, styles) => styles.valueLabel
|
|
@@ -257,7 +314,21 @@ export const SliderValueLabel = styled(SliderValueLabelUnstyled, {
|
|
|
257
314
|
backgroundColor: 'inherit'
|
|
258
315
|
}
|
|
259
316
|
}));
|
|
260
|
-
|
|
317
|
+
process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes
|
|
318
|
+
/* remove-proptypes */
|
|
319
|
+
= {
|
|
320
|
+
// ----------------------------- Warning --------------------------------
|
|
321
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
322
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
323
|
+
// ----------------------------------------------------------------------
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* @ignore
|
|
327
|
+
*/
|
|
328
|
+
children: PropTypes.node
|
|
329
|
+
} : void 0;
|
|
330
|
+
export { SliderValueLabel };
|
|
331
|
+
const SliderMark = styled('span', {
|
|
261
332
|
name: 'MuiSlider',
|
|
262
333
|
slot: 'Mark',
|
|
263
334
|
shouldForwardProp: prop => slotShouldForwardProp(prop) && prop !== 'markActive',
|
|
@@ -282,7 +353,21 @@ export const SliderMark = styled('span', {
|
|
|
282
353
|
backgroundColor: theme.palette.background.paper,
|
|
283
354
|
opacity: 0.8
|
|
284
355
|
}));
|
|
285
|
-
|
|
356
|
+
process.env.NODE_ENV !== "production" ? SliderMark.propTypes
|
|
357
|
+
/* remove-proptypes */
|
|
358
|
+
= {
|
|
359
|
+
// ----------------------------- Warning --------------------------------
|
|
360
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
361
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
362
|
+
// ----------------------------------------------------------------------
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* @ignore
|
|
366
|
+
*/
|
|
367
|
+
children: PropTypes.node
|
|
368
|
+
} : void 0;
|
|
369
|
+
export { SliderMark };
|
|
370
|
+
const SliderMarkLabel = styled('span', {
|
|
286
371
|
name: 'MuiSlider',
|
|
287
372
|
slot: 'MarkLabel',
|
|
288
373
|
shouldForwardProp: prop => slotShouldForwardProp(prop) && prop !== 'markLabelActive',
|
|
@@ -310,7 +395,9 @@ export const SliderMarkLabel = styled('span', {
|
|
|
310
395
|
}, markLabelActive && {
|
|
311
396
|
color: theme.palette.text.primary
|
|
312
397
|
}));
|
|
313
|
-
|
|
398
|
+
process.env.NODE_ENV !== "production" ? SliderMarkLabel.propTypes
|
|
399
|
+
/* remove-proptypes */
|
|
400
|
+
= {
|
|
314
401
|
// ----------------------------- Warning --------------------------------
|
|
315
402
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
316
403
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
@@ -319,40 +406,9 @@ SliderRoot.propTypes = {
|
|
|
319
406
|
/**
|
|
320
407
|
* @ignore
|
|
321
408
|
*/
|
|
322
|
-
children: PropTypes.node
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
* @ignore
|
|
326
|
-
*/
|
|
327
|
-
ownerState: PropTypes.shape({
|
|
328
|
-
'aria-label': PropTypes.string,
|
|
329
|
-
'aria-labelledby': PropTypes.string,
|
|
330
|
-
'aria-valuetext': PropTypes.string,
|
|
331
|
-
classes: PropTypes.object,
|
|
332
|
-
color: PropTypes.oneOf(['primary', 'secondary']),
|
|
333
|
-
defaultValue: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number]),
|
|
334
|
-
disabled: PropTypes.bool,
|
|
335
|
-
getAriaLabel: PropTypes.func,
|
|
336
|
-
getAriaValueText: PropTypes.func,
|
|
337
|
-
isRtl: PropTypes.bool,
|
|
338
|
-
marks: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.shape({
|
|
339
|
-
label: PropTypes.node,
|
|
340
|
-
value: PropTypes.number.isRequired
|
|
341
|
-
})), PropTypes.bool]),
|
|
342
|
-
max: PropTypes.number,
|
|
343
|
-
min: PropTypes.number,
|
|
344
|
-
name: PropTypes.string,
|
|
345
|
-
onChange: PropTypes.func,
|
|
346
|
-
onChangeCommitted: PropTypes.func,
|
|
347
|
-
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
348
|
-
scale: PropTypes.func,
|
|
349
|
-
step: PropTypes.number,
|
|
350
|
-
track: PropTypes.oneOf(['inverted', 'normal', false]),
|
|
351
|
-
value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number]),
|
|
352
|
-
valueLabelDisplay: PropTypes.oneOf(['auto', 'off', 'on']),
|
|
353
|
-
valueLabelFormat: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
|
|
354
|
-
})
|
|
355
|
-
};
|
|
409
|
+
children: PropTypes.node
|
|
410
|
+
} : void 0;
|
|
411
|
+
export { SliderMarkLabel };
|
|
356
412
|
|
|
357
413
|
const extendUtilityClasses = ownerState => {
|
|
358
414
|
const {
|
|
@@ -366,19 +422,17 @@ const extendUtilityClasses = ownerState => {
|
|
|
366
422
|
});
|
|
367
423
|
};
|
|
368
424
|
|
|
369
|
-
const
|
|
370
|
-
return !Component || !isHostComponent(Component);
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
const Slider = /*#__PURE__*/React.forwardRef(function Slider(sliderProps, ref) {
|
|
425
|
+
const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
|
|
374
426
|
const props = useThemeProps({
|
|
375
|
-
props:
|
|
427
|
+
props: inputProps,
|
|
376
428
|
name: 'MuiSlider'
|
|
377
429
|
});
|
|
378
430
|
const theme = useTheme();
|
|
379
431
|
const isRtl = theme.direction === 'rtl';
|
|
380
432
|
|
|
381
433
|
const {
|
|
434
|
+
// eslint-disable-next-line react/prop-types
|
|
435
|
+
component = 'span',
|
|
382
436
|
components = {},
|
|
383
437
|
componentsProps = {},
|
|
384
438
|
color = 'primary',
|
|
@@ -404,25 +458,26 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(sliderProps, ref) {
|
|
|
404
458
|
MarkLabel: SliderMarkLabel
|
|
405
459
|
}, components),
|
|
406
460
|
componentsProps: _extends({}, componentsProps, {
|
|
407
|
-
root: _extends({}, componentsProps.root,
|
|
461
|
+
root: _extends({}, componentsProps.root, shouldSpreadAdditionalProps(components.Root) && {
|
|
462
|
+
as: component,
|
|
408
463
|
ownerState: _extends({}, componentsProps.root?.ownerState, {
|
|
409
464
|
color,
|
|
410
465
|
size
|
|
411
466
|
})
|
|
412
467
|
}),
|
|
413
|
-
thumb: _extends({}, componentsProps.thumb,
|
|
468
|
+
thumb: _extends({}, componentsProps.thumb, shouldSpreadAdditionalProps(components.Thumb) && {
|
|
414
469
|
ownerState: _extends({}, componentsProps.thumb?.ownerState, {
|
|
415
470
|
color,
|
|
416
471
|
size
|
|
417
472
|
})
|
|
418
473
|
}),
|
|
419
|
-
track: _extends({}, componentsProps.track,
|
|
474
|
+
track: _extends({}, componentsProps.track, shouldSpreadAdditionalProps(components.Track) && {
|
|
420
475
|
ownerState: _extends({}, componentsProps.track?.ownerState, {
|
|
421
476
|
color,
|
|
422
477
|
size
|
|
423
478
|
})
|
|
424
479
|
}),
|
|
425
|
-
valueLabel: _extends({}, componentsProps.valueLabel,
|
|
480
|
+
valueLabel: _extends({}, componentsProps.valueLabel, shouldSpreadAdditionalProps(components.ValueLabel) && {
|
|
426
481
|
ownerState: _extends({}, componentsProps.valueLabel?.ownerState, {
|
|
427
482
|
color,
|
|
428
483
|
size
|
package/modern/index.js
CHANGED
|
@@ -389,7 +389,7 @@ const AutocompleteGroupUl = (0, _styled.default)('ul', {
|
|
|
389
389
|
}
|
|
390
390
|
});
|
|
391
391
|
const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps, ref) {
|
|
392
|
-
var _componentsProps$clea;
|
|
392
|
+
var _componentsProps$clea, _componentsProps$pape;
|
|
393
393
|
|
|
394
394
|
const props = (0, _useThemeProps.default)({
|
|
395
395
|
props: inProps,
|
|
@@ -607,10 +607,11 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
607
607
|
role: "presentation",
|
|
608
608
|
anchorEl: anchorEl,
|
|
609
609
|
open: true,
|
|
610
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(AutocompletePaper, {
|
|
611
|
-
as: PaperComponent,
|
|
612
|
-
className: classes.paper,
|
|
610
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(AutocompletePaper, (0, _extends2.default)({
|
|
613
611
|
ownerState: ownerState,
|
|
612
|
+
as: PaperComponent
|
|
613
|
+
}, componentsProps.paper, {
|
|
614
|
+
className: (0, _clsx.default)(classes.paper, (_componentsProps$pape = componentsProps.paper) == null ? void 0 : _componentsProps$pape.className),
|
|
614
615
|
children: [loading && groupedOptions.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(AutocompleteLoading, {
|
|
615
616
|
className: classes.loading,
|
|
616
617
|
ownerState: ownerState,
|
|
@@ -641,7 +642,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
641
642
|
return renderListOption(option, index);
|
|
642
643
|
})
|
|
643
644
|
})) : null]
|
|
644
|
-
})
|
|
645
|
+
}))
|
|
645
646
|
}) : null]
|
|
646
647
|
});
|
|
647
648
|
});
|
|
@@ -743,7 +744,8 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes
|
|
|
743
744
|
* @default {}
|
|
744
745
|
*/
|
|
745
746
|
componentsProps: _propTypes.default.shape({
|
|
746
|
-
clearIndicator: _propTypes.default.object
|
|
747
|
+
clearIndicator: _propTypes.default.object,
|
|
748
|
+
paper: _propTypes.default.object
|
|
747
749
|
}),
|
|
748
750
|
|
|
749
751
|
/**
|
package/node/Badge/Badge.js
CHANGED
|
@@ -27,6 +27,8 @@ var _styled = _interopRequireDefault(require("../styles/styled"));
|
|
|
27
27
|
|
|
28
28
|
var _useThemeProps = _interopRequireDefault(require("../styles/useThemeProps"));
|
|
29
29
|
|
|
30
|
+
var _shouldSpreadAdditionalProps = _interopRequireDefault(require("../utils/shouldSpreadAdditionalProps"));
|
|
31
|
+
|
|
30
32
|
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
31
33
|
|
|
32
34
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -179,11 +181,6 @@ const BadgeBadge = (0, _styled.default)('span', {
|
|
|
179
181
|
duration: theme.transitions.duration.leavingScreen
|
|
180
182
|
})
|
|
181
183
|
}));
|
|
182
|
-
|
|
183
|
-
const shouldSpreadAdditionalProps = Slot => {
|
|
184
|
-
return !Slot || !(0, _base.isHostComponent)(Slot);
|
|
185
|
-
};
|
|
186
|
-
|
|
187
184
|
const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
188
185
|
var _componentsProps$root, _componentsProps$badg;
|
|
189
186
|
|
|
@@ -242,14 +239,14 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
242
239
|
Badge: BadgeBadge
|
|
243
240
|
}, components),
|
|
244
241
|
componentsProps: {
|
|
245
|
-
root: (0, _extends2.default)({}, componentsProps.root,
|
|
242
|
+
root: (0, _extends2.default)({}, componentsProps.root, (0, _shouldSpreadAdditionalProps.default)(components.Root) && {
|
|
246
243
|
as: component,
|
|
247
244
|
ownerState: (0, _extends2.default)({}, (_componentsProps$root = componentsProps.root) == null ? void 0 : _componentsProps$root.ownerState, {
|
|
248
245
|
color,
|
|
249
246
|
overlap
|
|
250
247
|
})
|
|
251
248
|
}),
|
|
252
|
-
badge: (0, _extends2.default)({}, componentsProps.badge,
|
|
249
|
+
badge: (0, _extends2.default)({}, componentsProps.badge, (0, _shouldSpreadAdditionalProps.default)(components.Badge) && {
|
|
253
250
|
ownerState: (0, _extends2.default)({}, (_componentsProps$badg = componentsProps.badge) == null ? void 0 : _componentsProps$badg.ownerState, {
|
|
254
251
|
color,
|
|
255
252
|
overlap
|
|
File without changes
|
package/node/Select/Select.js
CHANGED
|
@@ -43,7 +43,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
43
43
|
|
|
44
44
|
var _Input, _FilledInput;
|
|
45
45
|
|
|
46
|
-
const _excluded = ["autoWidth", "children", "classes", "className", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"];
|
|
46
|
+
const _excluded = ["autoWidth", "children", "classes", "className", "defaultOpen", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"];
|
|
47
47
|
|
|
48
48
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
49
49
|
|
|
@@ -66,6 +66,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
66
66
|
children,
|
|
67
67
|
classes: classesProp = {},
|
|
68
68
|
className,
|
|
69
|
+
defaultOpen = false,
|
|
69
70
|
displayEmpty = false,
|
|
70
71
|
IconComponent = _ArrowDropDown.default,
|
|
71
72
|
id,
|
|
@@ -119,6 +120,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
119
120
|
id
|
|
120
121
|
} : {
|
|
121
122
|
autoWidth,
|
|
123
|
+
defaultOpen,
|
|
122
124
|
displayEmpty,
|
|
123
125
|
labelId,
|
|
124
126
|
MenuProps,
|
|
@@ -173,6 +175,13 @@ process.env.NODE_ENV !== "production" ? Select.propTypes
|
|
|
173
175
|
*/
|
|
174
176
|
className: _propTypes.default.string,
|
|
175
177
|
|
|
178
|
+
/**
|
|
179
|
+
* If `true`, the component is initially open. Use when the component open state is not controlled (i.e. the `open` prop is not defined).
|
|
180
|
+
* You can only use it when the `native` prop is `false` (default).
|
|
181
|
+
* @default false
|
|
182
|
+
*/
|
|
183
|
+
defaultOpen: _propTypes.default.bool,
|
|
184
|
+
|
|
176
185
|
/**
|
|
177
186
|
* The default value. Use when the component is not controlled.
|
|
178
187
|
*/
|
|
@@ -43,7 +43,7 @@ var _selectClasses = _interopRequireWildcard(require("./selectClasses"));
|
|
|
43
43
|
|
|
44
44
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
45
45
|
|
|
46
|
-
const _excluded = ["aria-describedby", "aria-label", "autoFocus", "autoWidth", "children", "className", "defaultValue", "disabled", "displayEmpty", "IconComponent", "inputRef", "labelId", "MenuProps", "multiple", "name", "onBlur", "onChange", "onClose", "onFocus", "onOpen", "open", "readOnly", "renderValue", "SelectDisplayProps", "tabIndex", "type", "value", "variant"];
|
|
46
|
+
const _excluded = ["aria-describedby", "aria-label", "autoFocus", "autoWidth", "children", "className", "defaultOpen", "defaultValue", "disabled", "displayEmpty", "IconComponent", "inputRef", "labelId", "MenuProps", "multiple", "name", "onBlur", "onChange", "onClose", "onFocus", "onOpen", "open", "readOnly", "renderValue", "SelectDisplayProps", "tabIndex", "type", "value", "variant"];
|
|
47
47
|
|
|
48
48
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
49
49
|
|
|
@@ -143,6 +143,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
143
143
|
autoWidth,
|
|
144
144
|
children,
|
|
145
145
|
className,
|
|
146
|
+
defaultOpen,
|
|
146
147
|
defaultValue,
|
|
147
148
|
disabled,
|
|
148
149
|
displayEmpty,
|
|
@@ -171,6 +172,11 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
171
172
|
default: defaultValue,
|
|
172
173
|
name: 'Select'
|
|
173
174
|
});
|
|
175
|
+
const [openState, setOpenState] = (0, _useControlled.default)({
|
|
176
|
+
controlled: openProp,
|
|
177
|
+
default: defaultOpen,
|
|
178
|
+
name: 'Select'
|
|
179
|
+
});
|
|
174
180
|
const inputRef = React.useRef(null);
|
|
175
181
|
const displayRef = React.useRef(null);
|
|
176
182
|
const [displayNode, setDisplayNode] = React.useState(null);
|
|
@@ -178,7 +184,6 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
178
184
|
current: isOpenControlled
|
|
179
185
|
} = React.useRef(openProp != null);
|
|
180
186
|
const [menuMinWidthState, setMenuMinWidthState] = React.useState();
|
|
181
|
-
const [openState, setOpenState] = React.useState(false);
|
|
182
187
|
const handleRef = (0, _useForkRef.default)(ref, inputRefProp);
|
|
183
188
|
const handleDisplayRef = React.useCallback(node => {
|
|
184
189
|
displayRef.current = node;
|
|
@@ -193,7 +198,17 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
193
198
|
},
|
|
194
199
|
node: inputRef.current,
|
|
195
200
|
value
|
|
196
|
-
}), [value]);
|
|
201
|
+
}), [value]); // Resize menu on `defaultOpen` automatic toggle.
|
|
202
|
+
|
|
203
|
+
React.useEffect(() => {
|
|
204
|
+
if (defaultOpen && openState && displayNode && !isOpenControlled) {
|
|
205
|
+
setMenuMinWidthState(autoWidth ? null : displayNode.clientWidth);
|
|
206
|
+
displayRef.current.focus();
|
|
207
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
208
|
+
|
|
209
|
+
}, [displayNode, autoWidth]); // `isOpenControlled` is ignored because the component should never switch between controlled and uncontrolled modes.
|
|
210
|
+
// `defaultOpen` and `openState` are ignored to avoid unnecessary callbacks.
|
|
211
|
+
|
|
197
212
|
React.useEffect(() => {
|
|
198
213
|
if (autoFocus) {
|
|
199
214
|
displayRef.current.focus();
|
|
@@ -329,7 +344,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
329
344
|
}
|
|
330
345
|
};
|
|
331
346
|
|
|
332
|
-
const open = displayNode !== null &&
|
|
347
|
+
const open = displayNode !== null && openState;
|
|
333
348
|
|
|
334
349
|
const handleBlur = event => {
|
|
335
350
|
// if open event.stopImmediatePropagation
|
|
@@ -586,6 +601,12 @@ process.env.NODE_ENV !== "production" ? SelectInput.propTypes = {
|
|
|
586
601
|
*/
|
|
587
602
|
className: _propTypes.default.string,
|
|
588
603
|
|
|
604
|
+
/**
|
|
605
|
+
* If `true`, the component is toggled on mount. Use when the component open state is not controlled.
|
|
606
|
+
* You can only use it when the `native` prop is `false` (default).
|
|
607
|
+
*/
|
|
608
|
+
defaultOpen: _propTypes.default.bool,
|
|
609
|
+
|
|
589
610
|
/**
|
|
590
611
|
* The default value. Use when the component is not controlled.
|
|
591
612
|
*/
|