@mui/material 5.2.5 → 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/Autocomplete/Autocomplete.d.ts +2 -0
- package/Autocomplete/Autocomplete.js +10 -6
- package/Avatar/Avatar.d.ts +3 -1
- package/Backdrop/Backdrop.js +3 -1
- package/Badge/Badge.d.ts +25 -0
- package/Badge/Badge.js +31 -15
- package/ButtonGroup/ButtonGroupContext.d.ts +1 -1
- package/CHANGELOG.md +245 -32
- package/FilledInput/FilledInput.js +4 -1
- package/FormControlLabel/FormControlLabel.js +3 -1
- package/Input/Input.js +4 -1
- package/InputBase/InputBase.js +4 -1
- package/InputLabel/InputLabel.js +4 -0
- package/ListItem/ListItem.js +3 -1
- package/Modal/Modal.js +3 -1
- package/README.md +19 -24
- 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/Slider/Slider.d.ts +2 -0
- package/Slider/Slider.js +126 -53
- package/StepLabel/StepLabel.js +3 -1
- package/SvgIcon/SvgIcon.d.ts +8 -0
- package/SvgIcon/SvgIcon.js +19 -3
- package/TextField/TextField.d.ts +1 -0
- package/TextField/TextField.js +1 -0
- package/Tooltip/Tooltip.js +6 -1
- package/index.js +1 -1
- package/legacy/Autocomplete/Autocomplete.js +10 -6
- package/legacy/Backdrop/Backdrop.js +3 -1
- package/legacy/Badge/Badge.js +36 -16
- package/legacy/FilledInput/FilledInput.js +4 -1
- package/legacy/FormControlLabel/FormControlLabel.js +3 -1
- package/legacy/Input/Input.js +4 -1
- package/legacy/InputBase/InputBase.js +4 -1
- package/legacy/InputLabel/InputLabel.js +4 -0
- package/legacy/ListItem/ListItem.js +3 -1
- package/legacy/Modal/Modal.js +3 -1
- package/legacy/Select/Select.js +11 -1
- package/legacy/Select/SelectInput.js +29 -7
- package/legacy/Slider/Slider.js +127 -54
- package/legacy/StepLabel/StepLabel.js +3 -1
- package/legacy/SvgIcon/SvgIcon.js +20 -3
- package/legacy/TextField/TextField.js +1 -0
- package/legacy/Tooltip/Tooltip.js +6 -1
- package/legacy/index.js +1 -1
- package/legacy/locale/index.js +224 -130
- package/legacy/utils/shouldSpreadAdditionalProps.js +7 -0
- package/locale/index.d.ts +1 -0
- package/locale/index.js +140 -50
- package/modern/Autocomplete/Autocomplete.js +9 -5
- package/modern/Backdrop/Backdrop.js +3 -1
- package/modern/Badge/Badge.js +31 -15
- package/modern/FilledInput/FilledInput.js +4 -1
- package/modern/FormControlLabel/FormControlLabel.js +3 -1
- package/modern/Input/Input.js +4 -1
- package/modern/InputBase/InputBase.js +4 -1
- package/modern/InputLabel/InputLabel.js +4 -0
- package/modern/ListItem/ListItem.js +3 -1
- package/modern/Modal/Modal.js +3 -1
- package/modern/Select/Select.js +10 -1
- package/modern/Select/SelectInput.js +25 -4
- package/modern/Slider/Slider.js +126 -53
- package/modern/StepLabel/StepLabel.js +3 -1
- package/modern/SvgIcon/SvgIcon.js +19 -3
- package/modern/TextField/TextField.js +1 -0
- package/modern/Tooltip/Tooltip.js +6 -1
- package/modern/index.js +1 -1
- package/modern/locale/index.js +140 -50
- package/modern/utils/shouldSpreadAdditionalProps.js +7 -0
- package/node/Autocomplete/Autocomplete.js +10 -6
- package/node/Backdrop/Backdrop.js +3 -1
- package/node/Badge/Badge.js +33 -16
- package/node/FilledInput/FilledInput.js +4 -1
- package/node/FormControlLabel/FormControlLabel.js +3 -1
- package/node/Input/Input.js +4 -1
- package/node/InputBase/InputBase.js +4 -1
- package/node/InputLabel/InputLabel.js +4 -0
- package/node/ListItem/ListItem.js +3 -1
- package/node/Modal/Modal.js +3 -1
- package/node/Select/Select.js +10 -1
- package/node/Select/SelectInput.js +25 -4
- package/node/Slider/Slider.js +112 -45
- package/node/StepLabel/StepLabel.js +3 -1
- package/node/SvgIcon/SvgIcon.js +19 -3
- package/node/TextField/TextField.js +1 -0
- package/node/Tooltip/Tooltip.js +6 -1
- package/node/index.js +1 -1
- package/node/locale/index.js +142 -51
- 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/umd/material-ui.development.js +703 -332
- package/umd/material-ui.production.min.js +21 -21
- package/utils/shouldSpreadAdditionalProps.js +7 -0
package/locale/index.js
CHANGED
|
@@ -888,7 +888,7 @@ export const enUS = {
|
|
|
888
888
|
MuiBreadcrumbs: { defaultProps: {
|
|
889
889
|
expandText: 'Show path',
|
|
890
890
|
}},
|
|
891
|
-
MuiTablePagination: { defaultProps: {
|
|
891
|
+
MuiTablePagination: { defaultProps: {
|
|
892
892
|
getItemAriaLabel: (type) => {
|
|
893
893
|
if (type === 'first') {
|
|
894
894
|
return 'Go to first page';
|
|
@@ -906,21 +906,21 @@ export const enUS = {
|
|
|
906
906
|
labelDisplayedRows: ({ from, to, count }) =>
|
|
907
907
|
`${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`,
|
|
908
908
|
}},
|
|
909
|
-
MuiRating: { defaultProps: {
|
|
909
|
+
MuiRating: { defaultProps: {
|
|
910
910
|
getLabelText: value => `${value} Star${value !== 1 ? 's' : ''}`,
|
|
911
911
|
emptyLabelText: 'Empty',
|
|
912
912
|
}},
|
|
913
|
-
MuiAutocomplete: { defaultProps: {
|
|
913
|
+
MuiAutocomplete: { defaultProps: {
|
|
914
914
|
clearText: 'Clear',
|
|
915
915
|
closeText: 'Close',
|
|
916
916
|
loadingText: 'Loading…',
|
|
917
917
|
noOptionsText: 'No options',
|
|
918
918
|
openText: 'Open',
|
|
919
919
|
}},
|
|
920
|
-
MuiAlert: { defaultProps: {
|
|
920
|
+
MuiAlert: { defaultProps: {
|
|
921
921
|
closeText: 'Close',
|
|
922
922
|
}},
|
|
923
|
-
MuiPagination: { defaultProps: {
|
|
923
|
+
MuiPagination: { defaultProps: {
|
|
924
924
|
'aria-label': 'Pagination navigation',
|
|
925
925
|
getItemAriaLabel: (type, page, selected) => {
|
|
926
926
|
if (type === 'page') {
|
|
@@ -938,7 +938,7 @@ export const enUS = {
|
|
|
938
938
|
// if (type === 'previous') {
|
|
939
939
|
return 'Go to previous page';
|
|
940
940
|
},
|
|
941
|
-
},
|
|
941
|
+
}},
|
|
942
942
|
},
|
|
943
943
|
*/
|
|
944
944
|
};
|
|
@@ -1206,9 +1206,12 @@ export const fiFI = {
|
|
|
1206
1206
|
|
|
1207
1207
|
return 'Mene edelliselle sivulle';
|
|
1208
1208
|
},
|
|
1209
|
-
labelRowsPerPage: 'Rivejä per sivu:'
|
|
1210
|
-
|
|
1211
|
-
|
|
1209
|
+
labelRowsPerPage: 'Rivejä per sivu:',
|
|
1210
|
+
labelDisplayedRows: ({
|
|
1211
|
+
from,
|
|
1212
|
+
to,
|
|
1213
|
+
count
|
|
1214
|
+
}) => `${from}–${to} / ${count !== -1 ? count : `enemmän kuin ${to}`}`
|
|
1212
1215
|
}
|
|
1213
1216
|
},
|
|
1214
1217
|
MuiRating: {
|
|
@@ -2186,6 +2189,86 @@ export const kzKZ = {
|
|
|
2186
2189
|
}
|
|
2187
2190
|
}
|
|
2188
2191
|
};
|
|
2192
|
+
export const nbNO = {
|
|
2193
|
+
components: {
|
|
2194
|
+
MuiBreadcrumbs: {
|
|
2195
|
+
defaultProps: {
|
|
2196
|
+
expandText: 'Vis sti'
|
|
2197
|
+
}
|
|
2198
|
+
},
|
|
2199
|
+
MuiTablePagination: {
|
|
2200
|
+
defaultProps: {
|
|
2201
|
+
getItemAriaLabel: type => {
|
|
2202
|
+
if (type === 'first') {
|
|
2203
|
+
return 'Gå til første side';
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
if (type === 'last') {
|
|
2207
|
+
return 'Gå til siste side';
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
if (type === 'next') {
|
|
2211
|
+
return 'Gå til neste side';
|
|
2212
|
+
} // if (type === 'previous') {
|
|
2213
|
+
|
|
2214
|
+
|
|
2215
|
+
return 'Gå til forrige side';
|
|
2216
|
+
},
|
|
2217
|
+
labelRowsPerPage: 'Rader per side:',
|
|
2218
|
+
labelDisplayedRows: ({
|
|
2219
|
+
from,
|
|
2220
|
+
to,
|
|
2221
|
+
count
|
|
2222
|
+
}) => `${from}–${to} av ${count !== -1 ? count : `mer enn ${to}`}`
|
|
2223
|
+
}
|
|
2224
|
+
},
|
|
2225
|
+
MuiRating: {
|
|
2226
|
+
defaultProps: {
|
|
2227
|
+
getLabelText: value => `${value} Stjerne${value !== 1 ? 'r' : ''}`,
|
|
2228
|
+
emptyLabelText: 'Tom'
|
|
2229
|
+
}
|
|
2230
|
+
},
|
|
2231
|
+
MuiAutocomplete: {
|
|
2232
|
+
defaultProps: {
|
|
2233
|
+
clearText: 'Tøm',
|
|
2234
|
+
closeText: 'Lukk',
|
|
2235
|
+
loadingText: 'Laster inn…',
|
|
2236
|
+
noOptionsText: 'Ingen alternativer',
|
|
2237
|
+
openText: 'Åpne'
|
|
2238
|
+
}
|
|
2239
|
+
},
|
|
2240
|
+
MuiAlert: {
|
|
2241
|
+
defaultProps: {
|
|
2242
|
+
closeText: 'Lukk'
|
|
2243
|
+
}
|
|
2244
|
+
},
|
|
2245
|
+
MuiPagination: {
|
|
2246
|
+
defaultProps: {
|
|
2247
|
+
'aria-label': 'Paginering navigasjon',
|
|
2248
|
+
getItemAriaLabel: (type, page, selected) => {
|
|
2249
|
+
if (type === 'page') {
|
|
2250
|
+
return `${selected ? '' : 'Gå til '}side ${page}`;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
if (type === 'first') {
|
|
2254
|
+
return 'Gå til første side';
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
if (type === 'last') {
|
|
2258
|
+
return 'Gå til siste side';
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
if (type === 'next') {
|
|
2262
|
+
return 'Gå til neste side';
|
|
2263
|
+
} // if (type === 'previous') {
|
|
2264
|
+
|
|
2265
|
+
|
|
2266
|
+
return 'Gå til forrige side';
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
};
|
|
2189
2272
|
export const nlNL = {
|
|
2190
2273
|
components: {
|
|
2191
2274
|
MuiBreadcrumbs: {
|
|
@@ -3186,26 +3269,29 @@ export const ukUA = {
|
|
|
3186
3269
|
};
|
|
3187
3270
|
export const viVN = {
|
|
3188
3271
|
components: {
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3272
|
+
MuiBreadcrumbs: {
|
|
3273
|
+
defaultProps: {
|
|
3274
|
+
expandText: 'Mở ra'
|
|
3275
|
+
}
|
|
3276
|
+
},
|
|
3194
3277
|
MuiTablePagination: {
|
|
3195
3278
|
defaultProps: {
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3279
|
+
getItemAriaLabel: type => {
|
|
3280
|
+
if (type === 'first') {
|
|
3281
|
+
return 'Tới trang đầu tiên';
|
|
3282
|
+
}
|
|
3283
|
+
|
|
3284
|
+
if (type === 'last') {
|
|
3285
|
+
return 'Tới trang cuối cùng';
|
|
3286
|
+
}
|
|
3287
|
+
|
|
3288
|
+
if (type === 'next') {
|
|
3289
|
+
return 'Tới trang tiếp theo';
|
|
3290
|
+
} // if (type === 'previous') {
|
|
3291
|
+
|
|
3292
|
+
|
|
3293
|
+
return 'Về trang trước đó';
|
|
3294
|
+
},
|
|
3209
3295
|
labelRowsPerPage: 'Số hàng mỗi trang:',
|
|
3210
3296
|
labelDisplayedRows: ({
|
|
3211
3297
|
from,
|
|
@@ -3217,7 +3303,7 @@ export const viVN = {
|
|
|
3217
3303
|
MuiRating: {
|
|
3218
3304
|
defaultProps: {
|
|
3219
3305
|
getLabelText: value => `${value} sao`,
|
|
3220
|
-
emptyLabelText: '
|
|
3306
|
+
emptyLabelText: 'Không có dữ liệu'
|
|
3221
3307
|
}
|
|
3222
3308
|
},
|
|
3223
3309
|
MuiAutocomplete: {
|
|
@@ -3225,7 +3311,7 @@ export const viVN = {
|
|
|
3225
3311
|
clearText: 'Xóa',
|
|
3226
3312
|
closeText: 'Đóng',
|
|
3227
3313
|
loadingText: 'Đang tải…',
|
|
3228
|
-
noOptionsText: 'Không có lựa chọn',
|
|
3314
|
+
noOptionsText: 'Không có lựa chọn nào',
|
|
3229
3315
|
openText: 'Mở'
|
|
3230
3316
|
}
|
|
3231
3317
|
},
|
|
@@ -3233,28 +3319,32 @@ export const viVN = {
|
|
|
3233
3319
|
defaultProps: {
|
|
3234
3320
|
closeText: 'Đóng'
|
|
3235
3321
|
}
|
|
3236
|
-
}
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
// return 'Go to first page';
|
|
3245
|
-
// }
|
|
3246
|
-
// if (type === 'last') {
|
|
3247
|
-
// return 'Go to last page';
|
|
3248
|
-
// }
|
|
3249
|
-
// if (type === 'next') {
|
|
3250
|
-
// return 'Go to next page';
|
|
3251
|
-
// }
|
|
3252
|
-
// // if (type === 'previous') {
|
|
3253
|
-
// return 'Go to previous page';
|
|
3254
|
-
// },
|
|
3255
|
-
// },
|
|
3256
|
-
// },
|
|
3322
|
+
},
|
|
3323
|
+
MuiPagination: {
|
|
3324
|
+
defaultProps: {
|
|
3325
|
+
'aria-label': 'Thanh điều khiển trang',
|
|
3326
|
+
getItemAriaLabel: (type, page, selected) => {
|
|
3327
|
+
if (type === 'page') {
|
|
3328
|
+
return `${selected ? '' : 'Tới '}trang ${page}`;
|
|
3329
|
+
}
|
|
3257
3330
|
|
|
3331
|
+
if (type === 'first') {
|
|
3332
|
+
return 'Tới trang đầu tiên';
|
|
3333
|
+
}
|
|
3334
|
+
|
|
3335
|
+
if (type === 'last') {
|
|
3336
|
+
return 'Tới trang cuối cùng';
|
|
3337
|
+
}
|
|
3338
|
+
|
|
3339
|
+
if (type === 'next') {
|
|
3340
|
+
return 'Tới trang tiếp theo';
|
|
3341
|
+
} // if (type === 'previous') {
|
|
3342
|
+
|
|
3343
|
+
|
|
3344
|
+
return 'Về trang trước đó';
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3258
3348
|
}
|
|
3259
3349
|
};
|
|
3260
3350
|
export const zhCN = {
|
|
@@ -564,10 +564,11 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
564
564
|
role: "presentation",
|
|
565
565
|
anchorEl: anchorEl,
|
|
566
566
|
open: true,
|
|
567
|
-
children: /*#__PURE__*/_jsxs(AutocompletePaper, {
|
|
568
|
-
as: PaperComponent,
|
|
569
|
-
className: classes.paper,
|
|
567
|
+
children: /*#__PURE__*/_jsxs(AutocompletePaper, _extends({
|
|
570
568
|
ownerState: ownerState,
|
|
569
|
+
as: PaperComponent
|
|
570
|
+
}, componentsProps.paper, {
|
|
571
|
+
className: clsx(classes.paper, componentsProps.paper?.className),
|
|
571
572
|
children: [loading && groupedOptions.length === 0 ? /*#__PURE__*/_jsx(AutocompleteLoading, {
|
|
572
573
|
className: classes.loading,
|
|
573
574
|
ownerState: ownerState,
|
|
@@ -598,7 +599,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
598
599
|
return renderListOption(option, index);
|
|
599
600
|
})
|
|
600
601
|
})) : null]
|
|
601
|
-
})
|
|
602
|
+
}))
|
|
602
603
|
}) : null]
|
|
603
604
|
});
|
|
604
605
|
});
|
|
@@ -699,7 +700,10 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes
|
|
|
699
700
|
* The props used for each slot inside.
|
|
700
701
|
* @default {}
|
|
701
702
|
*/
|
|
702
|
-
componentsProps: PropTypes.
|
|
703
|
+
componentsProps: PropTypes.shape({
|
|
704
|
+
clearIndicator: PropTypes.object,
|
|
705
|
+
paper: PropTypes.object
|
|
706
|
+
}),
|
|
703
707
|
|
|
704
708
|
/**
|
|
705
709
|
* The default value. Use when the component is not controlled.
|
|
@@ -124,7 +124,9 @@ process.env.NODE_ENV !== "production" ? Backdrop.propTypes
|
|
|
124
124
|
* The props used for each slot inside the Backdrop.
|
|
125
125
|
* @default {}
|
|
126
126
|
*/
|
|
127
|
-
componentsProps: PropTypes.
|
|
127
|
+
componentsProps: PropTypes.shape({
|
|
128
|
+
root: PropTypes.object
|
|
129
|
+
}),
|
|
128
130
|
|
|
129
131
|
/**
|
|
130
132
|
* If `true`, the backdrop is invisible.
|
package/modern/Badge/Badge.js
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["component", "components", "componentsProps", "color", "invisible", "badgeContent", "showZero", "variant"];
|
|
3
|
+
const _excluded = ["anchorOrigin", "component", "components", "componentsProps", "overlap", "color", "invisible", "badgeContent", "showZero", "variant"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { usePreviousProps } from '@mui/utils';
|
|
8
|
-
import { generateUtilityClasses
|
|
8
|
+
import { generateUtilityClasses } from '@mui/base';
|
|
9
9
|
import BadgeUnstyled, { badgeUnstyledClasses, getBadgeUtilityClass } from '@mui/base/BadgeUnstyled';
|
|
10
10
|
import styled from '../styles/styled';
|
|
11
11
|
import useThemeProps from '../styles/useThemeProps';
|
|
12
|
+
import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
|
|
12
13
|
import capitalize from '../utils/capitalize';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
export const badgeClasses = _extends({}, badgeUnstyledClasses, generateUtilityClasses('MuiBadge', ['colorError', 'colorInfo', 'colorPrimary', 'colorSecondary', 'colorSuccess', 'colorWarning'
|
|
15
|
+
export const badgeClasses = _extends({}, badgeUnstyledClasses, generateUtilityClasses('MuiBadge', ['colorError', 'colorInfo', 'colorPrimary', 'colorSecondary', 'colorSuccess', 'colorWarning', 'overlapRectangular', 'overlapCircular', // TODO: v6 remove the overlap value from these class keys
|
|
16
|
+
'anchorOriginTopLeftCircular', 'anchorOriginTopLeftRectangular', 'anchorOriginTopRightCircular', 'anchorOriginTopRightRectangular', 'anchorOriginBottomLeftCircular', 'anchorOriginBottomLeftRectangular', 'anchorOriginBottomRightCircular', 'anchorOriginBottomRightRectangular']));
|
|
15
17
|
const RADIUS_STANDARD = 10;
|
|
16
18
|
const RADIUS_DOT = 4;
|
|
17
19
|
|
|
18
20
|
const extendUtilityClasses = ownerState => {
|
|
19
21
|
const {
|
|
20
22
|
color,
|
|
23
|
+
anchorOrigin,
|
|
24
|
+
overlap,
|
|
21
25
|
classes = {}
|
|
22
26
|
} = ownerState;
|
|
23
27
|
return _extends({}, classes, {
|
|
24
|
-
badge: clsx(classes.badge, color !== 'default' && [getBadgeUtilityClass(`color${capitalize(color)}`), classes[`color${capitalize(color)}`]])
|
|
28
|
+
badge: clsx(classes.badge, getBadgeUtilityClass(`anchorOrigin${capitalize(anchorOrigin.vertical)}${capitalize(anchorOrigin.horizontal)}${capitalize(overlap)}`), getBadgeUtilityClass(`overlap${capitalize(overlap)}`), color !== 'default' && [getBadgeUtilityClass(`color${capitalize(color)}`), classes[`color${capitalize(color)}`]])
|
|
25
29
|
});
|
|
26
30
|
};
|
|
27
31
|
|
|
@@ -149,11 +153,6 @@ const BadgeBadge = styled('span', {
|
|
|
149
153
|
duration: theme.transitions.duration.leavingScreen
|
|
150
154
|
})
|
|
151
155
|
}));
|
|
152
|
-
|
|
153
|
-
const shouldSpreadAdditionalProps = Slot => {
|
|
154
|
-
return !Slot || !isHostComponent(Slot);
|
|
155
|
-
};
|
|
156
|
-
|
|
157
156
|
const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
158
157
|
const props = useThemeProps({
|
|
159
158
|
props: inProps,
|
|
@@ -161,9 +160,14 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
161
160
|
});
|
|
162
161
|
|
|
163
162
|
const {
|
|
163
|
+
anchorOrigin: anchorOriginProp = {
|
|
164
|
+
vertical: 'top',
|
|
165
|
+
horizontal: 'right'
|
|
166
|
+
},
|
|
164
167
|
component = 'span',
|
|
165
168
|
components = {},
|
|
166
169
|
componentsProps = {},
|
|
170
|
+
overlap: overlapProp = 'rectangular',
|
|
167
171
|
color: colorProp = 'default',
|
|
168
172
|
invisible: invisibleProp,
|
|
169
173
|
badgeContent: badgeContentProp,
|
|
@@ -173,7 +177,9 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
173
177
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
174
178
|
|
|
175
179
|
const prevProps = usePreviousProps({
|
|
176
|
-
|
|
180
|
+
anchorOrigin: anchorOriginProp,
|
|
181
|
+
color: colorProp,
|
|
182
|
+
overlap: overlapProp
|
|
177
183
|
});
|
|
178
184
|
let invisible = invisibleProp;
|
|
179
185
|
|
|
@@ -182,16 +188,21 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
182
188
|
}
|
|
183
189
|
|
|
184
190
|
const {
|
|
185
|
-
color = colorProp
|
|
191
|
+
color = colorProp,
|
|
192
|
+
overlap = overlapProp,
|
|
193
|
+
anchorOrigin = anchorOriginProp
|
|
186
194
|
} = invisible ? prevProps : props;
|
|
187
195
|
|
|
188
196
|
const ownerState = _extends({}, props, {
|
|
197
|
+
anchorOrigin,
|
|
189
198
|
invisible,
|
|
190
|
-
color
|
|
199
|
+
color,
|
|
200
|
+
overlap
|
|
191
201
|
});
|
|
192
202
|
|
|
193
203
|
const classes = extendUtilityClasses(ownerState);
|
|
194
204
|
return /*#__PURE__*/_jsx(BadgeUnstyled, _extends({
|
|
205
|
+
anchorOrigin: anchorOrigin,
|
|
195
206
|
invisible: invisibleProp,
|
|
196
207
|
badgeContent: badgeContentProp,
|
|
197
208
|
showZero: showZero,
|
|
@@ -205,12 +216,14 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
205
216
|
root: _extends({}, componentsProps.root, shouldSpreadAdditionalProps(components.Root) && {
|
|
206
217
|
as: component,
|
|
207
218
|
ownerState: _extends({}, componentsProps.root?.ownerState, {
|
|
208
|
-
color
|
|
219
|
+
color,
|
|
220
|
+
overlap
|
|
209
221
|
})
|
|
210
222
|
}),
|
|
211
223
|
badge: _extends({}, componentsProps.badge, shouldSpreadAdditionalProps(components.Badge) && {
|
|
212
224
|
ownerState: _extends({}, componentsProps.badge?.ownerState, {
|
|
213
|
-
color
|
|
225
|
+
color,
|
|
226
|
+
overlap
|
|
214
227
|
})
|
|
215
228
|
})
|
|
216
229
|
},
|
|
@@ -281,7 +294,10 @@ process.env.NODE_ENV !== "production" ? Badge.propTypes
|
|
|
281
294
|
* The props used for each slot inside the Badge.
|
|
282
295
|
* @default {}
|
|
283
296
|
*/
|
|
284
|
-
componentsProps: PropTypes.
|
|
297
|
+
componentsProps: PropTypes.shape({
|
|
298
|
+
badge: PropTypes.object,
|
|
299
|
+
root: PropTypes.object
|
|
300
|
+
}),
|
|
285
301
|
|
|
286
302
|
/**
|
|
287
303
|
* If `true`, the badge is invisible.
|
|
@@ -257,7 +257,10 @@ process.env.NODE_ENV !== "production" ? FilledInput.propTypes
|
|
|
257
257
|
* The props used for each slot inside the Input.
|
|
258
258
|
* @default {}
|
|
259
259
|
*/
|
|
260
|
-
componentsProps: PropTypes.
|
|
260
|
+
componentsProps: PropTypes.shape({
|
|
261
|
+
input: PropTypes.object,
|
|
262
|
+
root: PropTypes.object
|
|
263
|
+
}),
|
|
261
264
|
|
|
262
265
|
/**
|
|
263
266
|
* The default value. Use when the component is not controlled.
|
|
@@ -162,7 +162,9 @@ process.env.NODE_ENV !== "production" ? FormControlLabel.propTypes
|
|
|
162
162
|
* The props used for each slot inside.
|
|
163
163
|
* @default {}
|
|
164
164
|
*/
|
|
165
|
-
componentsProps: PropTypes.
|
|
165
|
+
componentsProps: PropTypes.shape({
|
|
166
|
+
typography: PropTypes.object
|
|
167
|
+
}),
|
|
166
168
|
|
|
167
169
|
/**
|
|
168
170
|
* A control element. For instance, it can be a `Radio`, a `Switch` or a `Checkbox`.
|
package/modern/Input/Input.js
CHANGED
|
@@ -192,7 +192,10 @@ process.env.NODE_ENV !== "production" ? Input.propTypes
|
|
|
192
192
|
* The props used for each slot inside the Input.
|
|
193
193
|
* @default {}
|
|
194
194
|
*/
|
|
195
|
-
componentsProps: PropTypes.
|
|
195
|
+
componentsProps: PropTypes.shape({
|
|
196
|
+
input: PropTypes.object,
|
|
197
|
+
root: PropTypes.object
|
|
198
|
+
}),
|
|
196
199
|
|
|
197
200
|
/**
|
|
198
201
|
* The default value. Use when the component is not controlled.
|
|
@@ -552,7 +552,10 @@ process.env.NODE_ENV !== "production" ? InputBase.propTypes
|
|
|
552
552
|
* The props used for each slot inside the Input.
|
|
553
553
|
* @default {}
|
|
554
554
|
*/
|
|
555
|
-
componentsProps: PropTypes.
|
|
555
|
+
componentsProps: PropTypes.shape({
|
|
556
|
+
input: PropTypes.object,
|
|
557
|
+
root: PropTypes.object
|
|
558
|
+
}),
|
|
556
559
|
|
|
557
560
|
/**
|
|
558
561
|
* The default value. Use when the component is not controlled.
|
|
@@ -82,6 +82,8 @@ const InputLabelRoot = styled(FormLabel, {
|
|
|
82
82
|
}, ownerState.size === 'small' && {
|
|
83
83
|
transform: 'translate(12px, 13px) scale(1)'
|
|
84
84
|
}, ownerState.shrink && _extends({
|
|
85
|
+
userSelect: 'none',
|
|
86
|
+
pointerEvents: 'auto',
|
|
85
87
|
transform: 'translate(12px, 7px) scale(0.75)',
|
|
86
88
|
maxWidth: 'calc(133% - 24px)'
|
|
87
89
|
}, ownerState.size === 'small' && {
|
|
@@ -95,6 +97,8 @@ const InputLabelRoot = styled(FormLabel, {
|
|
|
95
97
|
}, ownerState.size === 'small' && {
|
|
96
98
|
transform: 'translate(14px, 9px) scale(1)'
|
|
97
99
|
}, ownerState.shrink && {
|
|
100
|
+
userSelect: 'none',
|
|
101
|
+
pointerEvents: 'auto',
|
|
98
102
|
maxWidth: 'calc(133% - 24px)',
|
|
99
103
|
transform: 'translate(14px, -9px) scale(0.75)'
|
|
100
104
|
})));
|
|
@@ -346,7 +346,9 @@ process.env.NODE_ENV !== "production" ? ListItem.propTypes
|
|
|
346
346
|
* The props used for each slot inside the Input.
|
|
347
347
|
* @default {}
|
|
348
348
|
*/
|
|
349
|
-
componentsProps: PropTypes.
|
|
349
|
+
componentsProps: PropTypes.shape({
|
|
350
|
+
root: PropTypes.object
|
|
351
|
+
}),
|
|
350
352
|
|
|
351
353
|
/**
|
|
352
354
|
* The container component used when a `ListItemSecondaryAction` is the last child.
|
package/modern/Modal/Modal.js
CHANGED
|
@@ -177,7 +177,9 @@ process.env.NODE_ENV !== "production" ? Modal.propTypes
|
|
|
177
177
|
* The props used for each slot inside the Modal.
|
|
178
178
|
* @default {}
|
|
179
179
|
*/
|
|
180
|
-
componentsProps: PropTypes.
|
|
180
|
+
componentsProps: PropTypes.shape({
|
|
181
|
+
root: PropTypes.object
|
|
182
|
+
}),
|
|
181
183
|
|
|
182
184
|
/**
|
|
183
185
|
* An HTML element or function that returns one.
|
package/modern/Select/Select.js
CHANGED
|
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
|
|
4
4
|
var _Input, _FilledInput;
|
|
5
5
|
|
|
6
|
-
const _excluded = ["autoWidth", "children", "classes", "className", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"];
|
|
6
|
+
const _excluded = ["autoWidth", "children", "classes", "className", "defaultOpen", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"];
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import clsx from 'clsx';
|
|
@@ -38,6 +38,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
38
38
|
children,
|
|
39
39
|
classes: classesProp = {},
|
|
40
40
|
className,
|
|
41
|
+
defaultOpen = false,
|
|
41
42
|
displayEmpty = false,
|
|
42
43
|
IconComponent = ArrowDropDownIcon,
|
|
43
44
|
id,
|
|
@@ -94,6 +95,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
94
95
|
id
|
|
95
96
|
} : {
|
|
96
97
|
autoWidth,
|
|
98
|
+
defaultOpen,
|
|
97
99
|
displayEmpty,
|
|
98
100
|
labelId,
|
|
99
101
|
MenuProps,
|
|
@@ -148,6 +150,13 @@ process.env.NODE_ENV !== "production" ? Select.propTypes
|
|
|
148
150
|
*/
|
|
149
151
|
className: PropTypes.string,
|
|
150
152
|
|
|
153
|
+
/**
|
|
154
|
+
* If `true`, the component is initially open. Use when the component open state is not controlled (i.e. the `open` prop is not defined).
|
|
155
|
+
* You can only use it when the `native` prop is `false` (default).
|
|
156
|
+
* @default false
|
|
157
|
+
*/
|
|
158
|
+
defaultOpen: PropTypes.bool,
|
|
159
|
+
|
|
151
160
|
/**
|
|
152
161
|
* The default value. Use when the component is not controlled.
|
|
153
162
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
|
|
4
|
-
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"];
|
|
4
|
+
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"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { isFragment } from 'react-is';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
@@ -113,6 +113,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
113
113
|
autoWidth,
|
|
114
114
|
children,
|
|
115
115
|
className,
|
|
116
|
+
defaultOpen,
|
|
116
117
|
defaultValue,
|
|
117
118
|
disabled,
|
|
118
119
|
displayEmpty,
|
|
@@ -142,6 +143,11 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
142
143
|
default: defaultValue,
|
|
143
144
|
name: 'Select'
|
|
144
145
|
});
|
|
146
|
+
const [openState, setOpenState] = useControlled({
|
|
147
|
+
controlled: openProp,
|
|
148
|
+
default: defaultOpen,
|
|
149
|
+
name: 'Select'
|
|
150
|
+
});
|
|
145
151
|
const inputRef = React.useRef(null);
|
|
146
152
|
const displayRef = React.useRef(null);
|
|
147
153
|
const [displayNode, setDisplayNode] = React.useState(null);
|
|
@@ -149,7 +155,6 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
149
155
|
current: isOpenControlled
|
|
150
156
|
} = React.useRef(openProp != null);
|
|
151
157
|
const [menuMinWidthState, setMenuMinWidthState] = React.useState();
|
|
152
|
-
const [openState, setOpenState] = React.useState(false);
|
|
153
158
|
const handleRef = useForkRef(ref, inputRefProp);
|
|
154
159
|
const handleDisplayRef = React.useCallback(node => {
|
|
155
160
|
displayRef.current = node;
|
|
@@ -164,7 +169,17 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
164
169
|
},
|
|
165
170
|
node: inputRef.current,
|
|
166
171
|
value
|
|
167
|
-
}), [value]);
|
|
172
|
+
}), [value]); // Resize menu on `defaultOpen` automatic toggle.
|
|
173
|
+
|
|
174
|
+
React.useEffect(() => {
|
|
175
|
+
if (defaultOpen && openState && displayNode && !isOpenControlled) {
|
|
176
|
+
setMenuMinWidthState(autoWidth ? null : displayNode.clientWidth);
|
|
177
|
+
displayRef.current.focus();
|
|
178
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
179
|
+
|
|
180
|
+
}, [displayNode, autoWidth]); // `isOpenControlled` is ignored because the component should never switch between controlled and uncontrolled modes.
|
|
181
|
+
// `defaultOpen` and `openState` are ignored to avoid unnecessary callbacks.
|
|
182
|
+
|
|
168
183
|
React.useEffect(() => {
|
|
169
184
|
if (autoFocus) {
|
|
170
185
|
displayRef.current.focus();
|
|
@@ -300,7 +315,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
300
315
|
}
|
|
301
316
|
};
|
|
302
317
|
|
|
303
|
-
const open = displayNode !== null &&
|
|
318
|
+
const open = displayNode !== null && openState;
|
|
304
319
|
|
|
305
320
|
const handleBlur = event => {
|
|
306
321
|
// if open event.stopImmediatePropagation
|
|
@@ -559,6 +574,12 @@ process.env.NODE_ENV !== "production" ? SelectInput.propTypes = {
|
|
|
559
574
|
*/
|
|
560
575
|
className: PropTypes.string,
|
|
561
576
|
|
|
577
|
+
/**
|
|
578
|
+
* If `true`, the component is toggled on mount. Use when the component open state is not controlled.
|
|
579
|
+
* You can only use it when the `native` prop is `false` (default).
|
|
580
|
+
*/
|
|
581
|
+
defaultOpen: PropTypes.bool,
|
|
582
|
+
|
|
562
583
|
/**
|
|
563
584
|
* The default value. Use when the component is not controlled.
|
|
564
585
|
*/
|