@mui/material 6.4.6 → 6.4.7
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/CHANGELOG.md +20 -0
- package/Radio/Radio.js +3 -1
- package/Rating/Rating.d.ts +59 -1
- package/Rating/Rating.js +131 -45
- package/index.js +1 -1
- package/modern/Radio/Radio.js +3 -1
- package/modern/Rating/Rating.js +131 -45
- package/modern/index.js +1 -1
- package/modern/version/index.js +2 -2
- package/node/Radio/Radio.js +3 -1
- package/node/Rating/Rating.js +132 -46
- package/node/index.js +1 -1
- package/node/version/index.js +2 -2
- package/package.json +5 -5
- package/styles/ThemeProvider.d.ts +6 -0
- package/styles/ThemeProviderWithVars.d.ts +1 -0
- package/styles/index.d.ts +1 -0
- package/version/index.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 6.4.7
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.4.6..v6.x -->
|
|
6
|
+
|
|
7
|
+
_Mar 5, 2025_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 3 contributors who made this release possible.
|
|
10
|
+
|
|
11
|
+
### `@mui/material@6.4.7`
|
|
12
|
+
|
|
13
|
+
- [ThemeProvider] Add `storageManager` prop to `ThemeProvider` (@siriwatknp) (#45437) @siriwatknp
|
|
14
|
+
- [Rating] Deprecate \*Props and complete slots, slotProps (#45295) (#45398) @DiegoAndai
|
|
15
|
+
- [Radio] Fix `inputProps` not forwarded (@siriwatknp) (#45475) @siriwatknp
|
|
16
|
+
|
|
17
|
+
### Core
|
|
18
|
+
|
|
19
|
+
- [blog] React 19 migration for MUI X (#45440) @arminmeh
|
|
20
|
+
|
|
21
|
+
All contributors of this release in alphabetical order: @arminmeh, @DiegoAndai, @siriwatknp
|
|
22
|
+
|
|
3
23
|
## 6.4.6
|
|
4
24
|
|
|
5
25
|
<!-- generated comparing v6.4.5..v6.x -->
|
package/Radio/Radio.js
CHANGED
|
@@ -128,6 +128,7 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
128
128
|
disableRipple = false,
|
|
129
129
|
slots = {},
|
|
130
130
|
slotProps = {},
|
|
131
|
+
inputProps,
|
|
131
132
|
...other
|
|
132
133
|
} = props;
|
|
133
134
|
const muiFormControl = useFormControl();
|
|
@@ -158,6 +159,7 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
158
159
|
name = radioGroup.name;
|
|
159
160
|
}
|
|
160
161
|
}
|
|
162
|
+
const externalInputProps = slotProps.input ?? inputProps;
|
|
161
163
|
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
162
164
|
ref,
|
|
163
165
|
elementType: RadioRoot,
|
|
@@ -190,7 +192,7 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
190
192
|
slots,
|
|
191
193
|
slotProps: {
|
|
192
194
|
// Do not forward `slotProps.root` again because it's already handled by the `RootSlot` in this file.
|
|
193
|
-
input: typeof
|
|
195
|
+
input: typeof externalInputProps === 'function' ? externalInputProps(ownerState) : externalInputProps
|
|
194
196
|
}
|
|
195
197
|
}
|
|
196
198
|
});
|
package/Rating/Rating.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { OverridableStringUnion } from '@mui/types';
|
|
|
4
4
|
import { Theme } from '..';
|
|
5
5
|
import { RatingClasses } from './ratingClasses';
|
|
6
6
|
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
|
|
7
|
+
import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
|
|
7
8
|
|
|
8
9
|
export interface IconContainerProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
9
10
|
value: number;
|
|
@@ -11,7 +12,61 @@ export interface IconContainerProps extends React.HTMLAttributes<HTMLSpanElement
|
|
|
11
12
|
|
|
12
13
|
export interface RatingPropsSizeOverrides {}
|
|
13
14
|
|
|
14
|
-
export interface
|
|
15
|
+
export interface RatingRootSlotPropsOverrides {}
|
|
16
|
+
export interface RatingLabelSlotPropsOverrides {}
|
|
17
|
+
export interface RatingIconSlotPropsOverrides {}
|
|
18
|
+
export interface RatingDecimalSlotPropsOverrides {}
|
|
19
|
+
|
|
20
|
+
export interface RatingSlots {
|
|
21
|
+
/**
|
|
22
|
+
* The component used for the root slot.
|
|
23
|
+
* @default 'span'
|
|
24
|
+
*/
|
|
25
|
+
root: React.ElementType;
|
|
26
|
+
/**
|
|
27
|
+
* The component used for the label slot.
|
|
28
|
+
* @default 'label'
|
|
29
|
+
*/
|
|
30
|
+
label: React.ElementType;
|
|
31
|
+
/**
|
|
32
|
+
* The component used for the icon slot.
|
|
33
|
+
* @default 'span'
|
|
34
|
+
*/
|
|
35
|
+
icon: React.ElementType;
|
|
36
|
+
/**
|
|
37
|
+
* The component used fo r the decimal slot.
|
|
38
|
+
* @default 'span'
|
|
39
|
+
*/
|
|
40
|
+
decimal: React.ElementType;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type RatingSlotsAndSlotProps = CreateSlotsAndSlotProps<
|
|
44
|
+
RatingSlots,
|
|
45
|
+
{
|
|
46
|
+
/**
|
|
47
|
+
* Props forwarded to the root slot.
|
|
48
|
+
* By default, the avaible props are based on the span element.
|
|
49
|
+
*/
|
|
50
|
+
root: SlotProps<'span', RatingRootSlotPropsOverrides, RatingOwnerState>;
|
|
51
|
+
/**
|
|
52
|
+
* Props forwarded to the label slot.
|
|
53
|
+
* By default, the avaible props are based on the label element.
|
|
54
|
+
*/
|
|
55
|
+
label: SlotProps<'label', RatingLabelSlotPropsOverrides, RatingOwnerState>;
|
|
56
|
+
/**
|
|
57
|
+
* Props forwarded to the icon slot.
|
|
58
|
+
* By default, the avaible props are based on the span element.
|
|
59
|
+
*/
|
|
60
|
+
icon: SlotProps<'span', RatingIconSlotPropsOverrides, RatingOwnerState>;
|
|
61
|
+
/**
|
|
62
|
+
* Props forwarded to the decimal slot.
|
|
63
|
+
* By default, the avaible props are based on the span element.
|
|
64
|
+
*/
|
|
65
|
+
decimal: SlotProps<'span', RatingDecimalSlotPropsOverrides, RatingOwnerState>;
|
|
66
|
+
}
|
|
67
|
+
>;
|
|
68
|
+
|
|
69
|
+
export interface RatingOwnProps extends RatingSlotsAndSlotProps {
|
|
15
70
|
/**
|
|
16
71
|
* Override or extend the styles applied to the component.
|
|
17
72
|
*/
|
|
@@ -60,6 +115,7 @@ export interface RatingOwnProps {
|
|
|
60
115
|
icon?: React.ReactNode;
|
|
61
116
|
/**
|
|
62
117
|
* The component containing the icon.
|
|
118
|
+
* @deprecated Use `slotProps.icon.component` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
63
119
|
* @default function IconContainer(props) {
|
|
64
120
|
* const { value, ...other } = props;
|
|
65
121
|
* return <span {...other} />;
|
|
@@ -114,6 +170,8 @@ export interface RatingOwnProps {
|
|
|
114
170
|
value?: number | null;
|
|
115
171
|
}
|
|
116
172
|
|
|
173
|
+
export interface RatingOwnerState extends Omit<RatingProps, 'slots' | 'slotProps'> {}
|
|
174
|
+
|
|
117
175
|
export type RatingTypeMap<
|
|
118
176
|
AdditionalProps = {},
|
|
119
177
|
RootComponent extends React.ElementType = 'span',
|
package/Rating/Rating.js
CHANGED
|
@@ -17,7 +17,9 @@ import memoTheme from "../utils/memoTheme.js";
|
|
|
17
17
|
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
18
18
|
import slotShouldForwardProp from "../styles/slotShouldForwardProp.js";
|
|
19
19
|
import ratingClasses, { getRatingUtilityClass } from "./ratingClasses.js";
|
|
20
|
+
import useSlot from "../utils/useSlot.js";
|
|
20
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
import { createElement as _createElement } from "react";
|
|
21
23
|
function getDecimalPrecision(num) {
|
|
22
24
|
const decimalPart = num.toString().split('.')[1];
|
|
23
25
|
return decimalPart ? decimalPart.length : 0;
|
|
@@ -220,7 +222,9 @@ function RatingItem(props) {
|
|
|
220
222
|
readOnly,
|
|
221
223
|
ownerState,
|
|
222
224
|
ratingValue,
|
|
223
|
-
ratingValueRounded
|
|
225
|
+
ratingValueRounded,
|
|
226
|
+
slots = {},
|
|
227
|
+
slotProps = {}
|
|
224
228
|
} = props;
|
|
225
229
|
const isFilled = highlightSelectedOnly ? itemValue === ratingValue : itemValue <= ratingValue;
|
|
226
230
|
const isHovered = itemValue <= hover;
|
|
@@ -232,10 +236,14 @@ function RatingItem(props) {
|
|
|
232
236
|
// Update to const id = useId(); when React 17 support is dropped.
|
|
233
237
|
// More details: https://github.com/mui/material-ui/issues/40997
|
|
234
238
|
const id = `${name}-${useId()}`;
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
239
|
+
const externalForwardedProps = {
|
|
240
|
+
slots,
|
|
241
|
+
slotProps
|
|
242
|
+
};
|
|
243
|
+
const [IconSlot, iconSlotProps] = useSlot('icon', {
|
|
244
|
+
elementType: RatingIcon,
|
|
238
245
|
className: clsx(classes.icon, isFilled ? classes.iconFilled : classes.iconEmpty, isHovered && classes.iconHover, isFocused && classes.iconFocus, isActive && classes.iconActive),
|
|
246
|
+
externalForwardedProps,
|
|
239
247
|
ownerState: {
|
|
240
248
|
...ownerState,
|
|
241
249
|
iconEmpty: !isFilled,
|
|
@@ -244,6 +252,29 @@ function RatingItem(props) {
|
|
|
244
252
|
iconFocus: isFocused,
|
|
245
253
|
iconActive: isActive
|
|
246
254
|
},
|
|
255
|
+
additionalProps: {
|
|
256
|
+
value: itemValue
|
|
257
|
+
},
|
|
258
|
+
internalForwardedProps: {
|
|
259
|
+
// TODO: remove this in v7 because `IconContainerComponent` is deprecated
|
|
260
|
+
// only forward if `slots.icon` is NOT provided
|
|
261
|
+
as: IconContainerComponent
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
const [LabelSlot, labelSlotProps] = useSlot('label', {
|
|
265
|
+
elementType: RatingLabel,
|
|
266
|
+
externalForwardedProps,
|
|
267
|
+
ownerState: {
|
|
268
|
+
...ownerState,
|
|
269
|
+
emptyValueFocused: undefined
|
|
270
|
+
},
|
|
271
|
+
additionalProps: {
|
|
272
|
+
style: labelProps?.style,
|
|
273
|
+
htmlFor: id
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
const container = /*#__PURE__*/_jsx(IconSlot, {
|
|
277
|
+
...iconSlotProps,
|
|
247
278
|
children: emptyIcon && !isFilled ? emptyIcon : icon
|
|
248
279
|
});
|
|
249
280
|
if (readOnly) {
|
|
@@ -253,13 +284,8 @@ function RatingItem(props) {
|
|
|
253
284
|
});
|
|
254
285
|
}
|
|
255
286
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
256
|
-
children: [/*#__PURE__*/_jsxs(
|
|
257
|
-
|
|
258
|
-
...ownerState,
|
|
259
|
-
emptyValueFocused: undefined
|
|
260
|
-
},
|
|
261
|
-
htmlFor: id,
|
|
262
|
-
...labelProps,
|
|
287
|
+
children: [/*#__PURE__*/_jsxs(LabelSlot, {
|
|
288
|
+
...labelSlotProps,
|
|
263
289
|
children: [container, /*#__PURE__*/_jsx("span", {
|
|
264
290
|
className: classes.visuallyHidden,
|
|
265
291
|
children: getLabelText(itemValue)
|
|
@@ -300,7 +326,9 @@ process.env.NODE_ENV !== "production" ? RatingItem.propTypes = {
|
|
|
300
326
|
ownerState: PropTypes.object.isRequired,
|
|
301
327
|
ratingValue: PropTypes.number,
|
|
302
328
|
ratingValueRounded: PropTypes.number,
|
|
303
|
-
readOnly: PropTypes.bool.isRequired
|
|
329
|
+
readOnly: PropTypes.bool.isRequired,
|
|
330
|
+
slotProps: PropTypes.object,
|
|
331
|
+
slots: PropTypes.object
|
|
304
332
|
} : void 0;
|
|
305
333
|
const defaultIcon = /*#__PURE__*/_jsx(Star, {
|
|
306
334
|
fontSize: "inherit"
|
|
@@ -337,6 +365,8 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
337
365
|
readOnly = false,
|
|
338
366
|
size = 'medium',
|
|
339
367
|
value: valueProp,
|
|
368
|
+
slots = {},
|
|
369
|
+
slotProps = {},
|
|
340
370
|
...other
|
|
341
371
|
} = props;
|
|
342
372
|
const name = useId(nameProp);
|
|
@@ -474,16 +504,50 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
474
504
|
size
|
|
475
505
|
};
|
|
476
506
|
const classes = useUtilityClasses(ownerState);
|
|
477
|
-
|
|
478
|
-
|
|
507
|
+
const externalForwardedProps = {
|
|
508
|
+
slots,
|
|
509
|
+
slotProps
|
|
510
|
+
};
|
|
511
|
+
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
479
512
|
ref: handleRef,
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
513
|
+
className: clsx(classes.root, className),
|
|
514
|
+
elementType: RatingRoot,
|
|
515
|
+
externalForwardedProps: {
|
|
516
|
+
...externalForwardedProps,
|
|
517
|
+
...other,
|
|
518
|
+
component
|
|
519
|
+
},
|
|
520
|
+
getSlotProps: handlers => ({
|
|
521
|
+
...handlers,
|
|
522
|
+
onMouseMove: event => {
|
|
523
|
+
handleMouseMove(event);
|
|
524
|
+
handlers.onMouseMove?.(event);
|
|
525
|
+
},
|
|
526
|
+
onMouseLeave: event => {
|
|
527
|
+
handleMouseLeave(event);
|
|
528
|
+
handlers.onMouseLeave?.(event);
|
|
529
|
+
}
|
|
530
|
+
}),
|
|
531
|
+
ownerState,
|
|
532
|
+
additionalProps: {
|
|
533
|
+
role: readOnly ? 'img' : null,
|
|
534
|
+
'aria-label': readOnly ? getLabelText(value) : null
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
const [LabelSlot, labelSlotProps] = useSlot('label', {
|
|
538
|
+
className: clsx(classes.label, classes.labelEmptyValue),
|
|
539
|
+
elementType: RatingLabel,
|
|
540
|
+
externalForwardedProps,
|
|
541
|
+
ownerState
|
|
542
|
+
});
|
|
543
|
+
const [DecimalSlot, decimalSlotProps] = useSlot('decimal', {
|
|
544
|
+
className: classes.decimal,
|
|
545
|
+
elementType: RatingDecimal,
|
|
546
|
+
externalForwardedProps,
|
|
547
|
+
ownerState
|
|
548
|
+
});
|
|
549
|
+
return /*#__PURE__*/_jsxs(RootSlot, {
|
|
550
|
+
...rootSlotProps,
|
|
487
551
|
children: [Array.from(new Array(max)).map((_, index) => {
|
|
488
552
|
const itemValue = index + 1;
|
|
489
553
|
const ratingItemProps = {
|
|
@@ -504,41 +568,42 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
504
568
|
ratingValue: value,
|
|
505
569
|
ratingValueRounded: valueRounded,
|
|
506
570
|
readOnly,
|
|
507
|
-
ownerState
|
|
571
|
+
ownerState,
|
|
572
|
+
slots,
|
|
573
|
+
slotProps
|
|
508
574
|
};
|
|
509
575
|
const isActive = itemValue === Math.ceil(value) && (hover !== -1 || focus !== -1);
|
|
510
576
|
if (precision < 1) {
|
|
511
577
|
const items = Array.from(new Array(1 / precision));
|
|
512
|
-
return /*#__PURE__*/
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
578
|
+
return /*#__PURE__*/_createElement(DecimalSlot, {
|
|
579
|
+
...decimalSlotProps,
|
|
580
|
+
key: itemValue,
|
|
581
|
+
className: clsx(decimalSlotProps.className, isActive && classes.iconActive),
|
|
582
|
+
iconActive: isActive
|
|
583
|
+
}, items.map(($, indexDecimal) => {
|
|
584
|
+
const itemDecimalValue = roundValueToPrecision(itemValue - 1 + (indexDecimal + 1) * precision, precision);
|
|
585
|
+
return /*#__PURE__*/_jsx(RatingItem, {
|
|
586
|
+
...ratingItemProps,
|
|
587
|
+
// The icon is already displayed as active
|
|
588
|
+
isActive: false,
|
|
589
|
+
itemValue: itemDecimalValue,
|
|
590
|
+
labelProps: {
|
|
591
|
+
style: items.length - 1 === indexDecimal ? {} : {
|
|
592
|
+
width: itemDecimalValue === value ? `${(indexDecimal + 1) * precision * 100}%` : '0%',
|
|
593
|
+
overflow: 'hidden',
|
|
594
|
+
position: 'absolute'
|
|
529
595
|
}
|
|
530
|
-
}
|
|
531
|
-
})
|
|
532
|
-
}
|
|
596
|
+
}
|
|
597
|
+
}, itemDecimalValue);
|
|
598
|
+
}));
|
|
533
599
|
}
|
|
534
600
|
return /*#__PURE__*/_jsx(RatingItem, {
|
|
535
601
|
...ratingItemProps,
|
|
536
602
|
isActive: isActive,
|
|
537
603
|
itemValue: itemValue
|
|
538
604
|
}, itemValue);
|
|
539
|
-
}), !readOnly && !disabled && /*#__PURE__*/_jsxs(
|
|
540
|
-
|
|
541
|
-
ownerState: ownerState,
|
|
605
|
+
}), !readOnly && !disabled && /*#__PURE__*/_jsxs(LabelSlot, {
|
|
606
|
+
...labelSlotProps,
|
|
542
607
|
children: [/*#__PURE__*/_jsx("input", {
|
|
543
608
|
className: classes.visuallyHidden,
|
|
544
609
|
value: "",
|
|
@@ -622,6 +687,7 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
|
|
|
622
687
|
icon: PropTypes.node,
|
|
623
688
|
/**
|
|
624
689
|
* The component containing the icon.
|
|
690
|
+
* @deprecated Use `slotProps.icon.component` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
625
691
|
* @default function IconContainer(props) {
|
|
626
692
|
* const { value, ...other } = props;
|
|
627
693
|
* return <span {...other} />;
|
|
@@ -679,6 +745,26 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
|
|
|
679
745
|
* @default 'medium'
|
|
680
746
|
*/
|
|
681
747
|
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['small', 'medium', 'large']), PropTypes.string]),
|
|
748
|
+
/**
|
|
749
|
+
* The props used for each slot inside.
|
|
750
|
+
* @default {}
|
|
751
|
+
*/
|
|
752
|
+
slotProps: PropTypes.shape({
|
|
753
|
+
decimal: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
754
|
+
icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
755
|
+
label: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
756
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
757
|
+
}),
|
|
758
|
+
/**
|
|
759
|
+
* The components used for each slot inside.
|
|
760
|
+
* @default {}
|
|
761
|
+
*/
|
|
762
|
+
slots: PropTypes.shape({
|
|
763
|
+
decimal: PropTypes.elementType,
|
|
764
|
+
icon: PropTypes.elementType,
|
|
765
|
+
label: PropTypes.elementType,
|
|
766
|
+
root: PropTypes.elementType
|
|
767
|
+
}),
|
|
682
768
|
/**
|
|
683
769
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
684
770
|
*/
|
package/index.js
CHANGED
package/modern/Radio/Radio.js
CHANGED
|
@@ -128,6 +128,7 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
128
128
|
disableRipple = false,
|
|
129
129
|
slots = {},
|
|
130
130
|
slotProps = {},
|
|
131
|
+
inputProps,
|
|
131
132
|
...other
|
|
132
133
|
} = props;
|
|
133
134
|
const muiFormControl = useFormControl();
|
|
@@ -158,6 +159,7 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
158
159
|
name = radioGroup.name;
|
|
159
160
|
}
|
|
160
161
|
}
|
|
162
|
+
const externalInputProps = slotProps.input ?? inputProps;
|
|
161
163
|
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
162
164
|
ref,
|
|
163
165
|
elementType: RadioRoot,
|
|
@@ -190,7 +192,7 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
190
192
|
slots,
|
|
191
193
|
slotProps: {
|
|
192
194
|
// Do not forward `slotProps.root` again because it's already handled by the `RootSlot` in this file.
|
|
193
|
-
input: typeof
|
|
195
|
+
input: typeof externalInputProps === 'function' ? externalInputProps(ownerState) : externalInputProps
|
|
194
196
|
}
|
|
195
197
|
}
|
|
196
198
|
});
|
package/modern/Rating/Rating.js
CHANGED
|
@@ -17,7 +17,9 @@ import memoTheme from "../utils/memoTheme.js";
|
|
|
17
17
|
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
18
18
|
import slotShouldForwardProp from "../styles/slotShouldForwardProp.js";
|
|
19
19
|
import ratingClasses, { getRatingUtilityClass } from "./ratingClasses.js";
|
|
20
|
+
import useSlot from "../utils/useSlot.js";
|
|
20
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
import { createElement as _createElement } from "react";
|
|
21
23
|
function getDecimalPrecision(num) {
|
|
22
24
|
const decimalPart = num.toString().split('.')[1];
|
|
23
25
|
return decimalPart ? decimalPart.length : 0;
|
|
@@ -220,7 +222,9 @@ function RatingItem(props) {
|
|
|
220
222
|
readOnly,
|
|
221
223
|
ownerState,
|
|
222
224
|
ratingValue,
|
|
223
|
-
ratingValueRounded
|
|
225
|
+
ratingValueRounded,
|
|
226
|
+
slots = {},
|
|
227
|
+
slotProps = {}
|
|
224
228
|
} = props;
|
|
225
229
|
const isFilled = highlightSelectedOnly ? itemValue === ratingValue : itemValue <= ratingValue;
|
|
226
230
|
const isHovered = itemValue <= hover;
|
|
@@ -232,10 +236,14 @@ function RatingItem(props) {
|
|
|
232
236
|
// Update to const id = useId(); when React 17 support is dropped.
|
|
233
237
|
// More details: https://github.com/mui/material-ui/issues/40997
|
|
234
238
|
const id = `${name}-${useId()}`;
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
239
|
+
const externalForwardedProps = {
|
|
240
|
+
slots,
|
|
241
|
+
slotProps
|
|
242
|
+
};
|
|
243
|
+
const [IconSlot, iconSlotProps] = useSlot('icon', {
|
|
244
|
+
elementType: RatingIcon,
|
|
238
245
|
className: clsx(classes.icon, isFilled ? classes.iconFilled : classes.iconEmpty, isHovered && classes.iconHover, isFocused && classes.iconFocus, isActive && classes.iconActive),
|
|
246
|
+
externalForwardedProps,
|
|
239
247
|
ownerState: {
|
|
240
248
|
...ownerState,
|
|
241
249
|
iconEmpty: !isFilled,
|
|
@@ -244,6 +252,29 @@ function RatingItem(props) {
|
|
|
244
252
|
iconFocus: isFocused,
|
|
245
253
|
iconActive: isActive
|
|
246
254
|
},
|
|
255
|
+
additionalProps: {
|
|
256
|
+
value: itemValue
|
|
257
|
+
},
|
|
258
|
+
internalForwardedProps: {
|
|
259
|
+
// TODO: remove this in v7 because `IconContainerComponent` is deprecated
|
|
260
|
+
// only forward if `slots.icon` is NOT provided
|
|
261
|
+
as: IconContainerComponent
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
const [LabelSlot, labelSlotProps] = useSlot('label', {
|
|
265
|
+
elementType: RatingLabel,
|
|
266
|
+
externalForwardedProps,
|
|
267
|
+
ownerState: {
|
|
268
|
+
...ownerState,
|
|
269
|
+
emptyValueFocused: undefined
|
|
270
|
+
},
|
|
271
|
+
additionalProps: {
|
|
272
|
+
style: labelProps?.style,
|
|
273
|
+
htmlFor: id
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
const container = /*#__PURE__*/_jsx(IconSlot, {
|
|
277
|
+
...iconSlotProps,
|
|
247
278
|
children: emptyIcon && !isFilled ? emptyIcon : icon
|
|
248
279
|
});
|
|
249
280
|
if (readOnly) {
|
|
@@ -253,13 +284,8 @@ function RatingItem(props) {
|
|
|
253
284
|
});
|
|
254
285
|
}
|
|
255
286
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
256
|
-
children: [/*#__PURE__*/_jsxs(
|
|
257
|
-
|
|
258
|
-
...ownerState,
|
|
259
|
-
emptyValueFocused: undefined
|
|
260
|
-
},
|
|
261
|
-
htmlFor: id,
|
|
262
|
-
...labelProps,
|
|
287
|
+
children: [/*#__PURE__*/_jsxs(LabelSlot, {
|
|
288
|
+
...labelSlotProps,
|
|
263
289
|
children: [container, /*#__PURE__*/_jsx("span", {
|
|
264
290
|
className: classes.visuallyHidden,
|
|
265
291
|
children: getLabelText(itemValue)
|
|
@@ -300,7 +326,9 @@ process.env.NODE_ENV !== "production" ? RatingItem.propTypes = {
|
|
|
300
326
|
ownerState: PropTypes.object.isRequired,
|
|
301
327
|
ratingValue: PropTypes.number,
|
|
302
328
|
ratingValueRounded: PropTypes.number,
|
|
303
|
-
readOnly: PropTypes.bool.isRequired
|
|
329
|
+
readOnly: PropTypes.bool.isRequired,
|
|
330
|
+
slotProps: PropTypes.object,
|
|
331
|
+
slots: PropTypes.object
|
|
304
332
|
} : void 0;
|
|
305
333
|
const defaultIcon = /*#__PURE__*/_jsx(Star, {
|
|
306
334
|
fontSize: "inherit"
|
|
@@ -337,6 +365,8 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
337
365
|
readOnly = false,
|
|
338
366
|
size = 'medium',
|
|
339
367
|
value: valueProp,
|
|
368
|
+
slots = {},
|
|
369
|
+
slotProps = {},
|
|
340
370
|
...other
|
|
341
371
|
} = props;
|
|
342
372
|
const name = useId(nameProp);
|
|
@@ -474,16 +504,50 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
474
504
|
size
|
|
475
505
|
};
|
|
476
506
|
const classes = useUtilityClasses(ownerState);
|
|
477
|
-
|
|
478
|
-
|
|
507
|
+
const externalForwardedProps = {
|
|
508
|
+
slots,
|
|
509
|
+
slotProps
|
|
510
|
+
};
|
|
511
|
+
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
479
512
|
ref: handleRef,
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
513
|
+
className: clsx(classes.root, className),
|
|
514
|
+
elementType: RatingRoot,
|
|
515
|
+
externalForwardedProps: {
|
|
516
|
+
...externalForwardedProps,
|
|
517
|
+
...other,
|
|
518
|
+
component
|
|
519
|
+
},
|
|
520
|
+
getSlotProps: handlers => ({
|
|
521
|
+
...handlers,
|
|
522
|
+
onMouseMove: event => {
|
|
523
|
+
handleMouseMove(event);
|
|
524
|
+
handlers.onMouseMove?.(event);
|
|
525
|
+
},
|
|
526
|
+
onMouseLeave: event => {
|
|
527
|
+
handleMouseLeave(event);
|
|
528
|
+
handlers.onMouseLeave?.(event);
|
|
529
|
+
}
|
|
530
|
+
}),
|
|
531
|
+
ownerState,
|
|
532
|
+
additionalProps: {
|
|
533
|
+
role: readOnly ? 'img' : null,
|
|
534
|
+
'aria-label': readOnly ? getLabelText(value) : null
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
const [LabelSlot, labelSlotProps] = useSlot('label', {
|
|
538
|
+
className: clsx(classes.label, classes.labelEmptyValue),
|
|
539
|
+
elementType: RatingLabel,
|
|
540
|
+
externalForwardedProps,
|
|
541
|
+
ownerState
|
|
542
|
+
});
|
|
543
|
+
const [DecimalSlot, decimalSlotProps] = useSlot('decimal', {
|
|
544
|
+
className: classes.decimal,
|
|
545
|
+
elementType: RatingDecimal,
|
|
546
|
+
externalForwardedProps,
|
|
547
|
+
ownerState
|
|
548
|
+
});
|
|
549
|
+
return /*#__PURE__*/_jsxs(RootSlot, {
|
|
550
|
+
...rootSlotProps,
|
|
487
551
|
children: [Array.from(new Array(max)).map((_, index) => {
|
|
488
552
|
const itemValue = index + 1;
|
|
489
553
|
const ratingItemProps = {
|
|
@@ -504,41 +568,42 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
504
568
|
ratingValue: value,
|
|
505
569
|
ratingValueRounded: valueRounded,
|
|
506
570
|
readOnly,
|
|
507
|
-
ownerState
|
|
571
|
+
ownerState,
|
|
572
|
+
slots,
|
|
573
|
+
slotProps
|
|
508
574
|
};
|
|
509
575
|
const isActive = itemValue === Math.ceil(value) && (hover !== -1 || focus !== -1);
|
|
510
576
|
if (precision < 1) {
|
|
511
577
|
const items = Array.from(new Array(1 / precision));
|
|
512
|
-
return /*#__PURE__*/
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
578
|
+
return /*#__PURE__*/_createElement(DecimalSlot, {
|
|
579
|
+
...decimalSlotProps,
|
|
580
|
+
key: itemValue,
|
|
581
|
+
className: clsx(decimalSlotProps.className, isActive && classes.iconActive),
|
|
582
|
+
iconActive: isActive
|
|
583
|
+
}, items.map(($, indexDecimal) => {
|
|
584
|
+
const itemDecimalValue = roundValueToPrecision(itemValue - 1 + (indexDecimal + 1) * precision, precision);
|
|
585
|
+
return /*#__PURE__*/_jsx(RatingItem, {
|
|
586
|
+
...ratingItemProps,
|
|
587
|
+
// The icon is already displayed as active
|
|
588
|
+
isActive: false,
|
|
589
|
+
itemValue: itemDecimalValue,
|
|
590
|
+
labelProps: {
|
|
591
|
+
style: items.length - 1 === indexDecimal ? {} : {
|
|
592
|
+
width: itemDecimalValue === value ? `${(indexDecimal + 1) * precision * 100}%` : '0%',
|
|
593
|
+
overflow: 'hidden',
|
|
594
|
+
position: 'absolute'
|
|
529
595
|
}
|
|
530
|
-
}
|
|
531
|
-
})
|
|
532
|
-
}
|
|
596
|
+
}
|
|
597
|
+
}, itemDecimalValue);
|
|
598
|
+
}));
|
|
533
599
|
}
|
|
534
600
|
return /*#__PURE__*/_jsx(RatingItem, {
|
|
535
601
|
...ratingItemProps,
|
|
536
602
|
isActive: isActive,
|
|
537
603
|
itemValue: itemValue
|
|
538
604
|
}, itemValue);
|
|
539
|
-
}), !readOnly && !disabled && /*#__PURE__*/_jsxs(
|
|
540
|
-
|
|
541
|
-
ownerState: ownerState,
|
|
605
|
+
}), !readOnly && !disabled && /*#__PURE__*/_jsxs(LabelSlot, {
|
|
606
|
+
...labelSlotProps,
|
|
542
607
|
children: [/*#__PURE__*/_jsx("input", {
|
|
543
608
|
className: classes.visuallyHidden,
|
|
544
609
|
value: "",
|
|
@@ -622,6 +687,7 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
|
|
|
622
687
|
icon: PropTypes.node,
|
|
623
688
|
/**
|
|
624
689
|
* The component containing the icon.
|
|
690
|
+
* @deprecated Use `slotProps.icon.component` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
625
691
|
* @default function IconContainer(props) {
|
|
626
692
|
* const { value, ...other } = props;
|
|
627
693
|
* return <span {...other} />;
|
|
@@ -679,6 +745,26 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
|
|
|
679
745
|
* @default 'medium'
|
|
680
746
|
*/
|
|
681
747
|
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['small', 'medium', 'large']), PropTypes.string]),
|
|
748
|
+
/**
|
|
749
|
+
* The props used for each slot inside.
|
|
750
|
+
* @default {}
|
|
751
|
+
*/
|
|
752
|
+
slotProps: PropTypes.shape({
|
|
753
|
+
decimal: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
754
|
+
icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
755
|
+
label: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
756
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
757
|
+
}),
|
|
758
|
+
/**
|
|
759
|
+
* The components used for each slot inside.
|
|
760
|
+
* @default {}
|
|
761
|
+
*/
|
|
762
|
+
slots: PropTypes.shape({
|
|
763
|
+
decimal: PropTypes.elementType,
|
|
764
|
+
icon: PropTypes.elementType,
|
|
765
|
+
label: PropTypes.elementType,
|
|
766
|
+
root: PropTypes.elementType
|
|
767
|
+
}),
|
|
682
768
|
/**
|
|
683
769
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
684
770
|
*/
|
package/modern/index.js
CHANGED
package/modern/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.4.
|
|
1
|
+
export const version = "6.4.7";
|
|
2
2
|
export const major = Number("6");
|
|
3
3
|
export const minor = Number("4");
|
|
4
|
-
export const patch = Number("
|
|
4
|
+
export const patch = Number("7");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|
package/node/Radio/Radio.js
CHANGED
|
@@ -135,6 +135,7 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
135
135
|
disableRipple = false,
|
|
136
136
|
slots = {},
|
|
137
137
|
slotProps = {},
|
|
138
|
+
inputProps,
|
|
138
139
|
...other
|
|
139
140
|
} = props;
|
|
140
141
|
const muiFormControl = (0, _useFormControl.default)();
|
|
@@ -165,6 +166,7 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
165
166
|
name = radioGroup.name;
|
|
166
167
|
}
|
|
167
168
|
}
|
|
169
|
+
const externalInputProps = slotProps.input ?? inputProps;
|
|
168
170
|
const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
|
|
169
171
|
ref,
|
|
170
172
|
elementType: RadioRoot,
|
|
@@ -197,7 +199,7 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
197
199
|
slots,
|
|
198
200
|
slotProps: {
|
|
199
201
|
// Do not forward `slotProps.root` again because it's already handled by the `RootSlot` in this file.
|
|
200
|
-
input: typeof
|
|
202
|
+
input: typeof externalInputProps === 'function' ? externalInputProps(ownerState) : externalInputProps
|
|
201
203
|
}
|
|
202
204
|
}
|
|
203
205
|
});
|
package/node/Rating/Rating.js
CHANGED
|
@@ -7,7 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.default = void 0;
|
|
10
|
-
var
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var React = _react;
|
|
11
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
14
|
var _clamp = _interopRequireDefault(require("@mui/utils/clamp"));
|
|
@@ -24,6 +25,7 @@ var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
|
24
25
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
25
26
|
var _slotShouldForwardProp = _interopRequireDefault(require("../styles/slotShouldForwardProp"));
|
|
26
27
|
var _ratingClasses = _interopRequireWildcard(require("./ratingClasses"));
|
|
28
|
+
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
27
29
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
30
|
function getDecimalPrecision(num) {
|
|
29
31
|
const decimalPart = num.toString().split('.')[1];
|
|
@@ -227,7 +229,9 @@ function RatingItem(props) {
|
|
|
227
229
|
readOnly,
|
|
228
230
|
ownerState,
|
|
229
231
|
ratingValue,
|
|
230
|
-
ratingValueRounded
|
|
232
|
+
ratingValueRounded,
|
|
233
|
+
slots = {},
|
|
234
|
+
slotProps = {}
|
|
231
235
|
} = props;
|
|
232
236
|
const isFilled = highlightSelectedOnly ? itemValue === ratingValue : itemValue <= ratingValue;
|
|
233
237
|
const isHovered = itemValue <= hover;
|
|
@@ -239,10 +243,14 @@ function RatingItem(props) {
|
|
|
239
243
|
// Update to const id = useId(); when React 17 support is dropped.
|
|
240
244
|
// More details: https://github.com/mui/material-ui/issues/40997
|
|
241
245
|
const id = `${name}-${(0, _utils.unstable_useId)()}`;
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
246
|
+
const externalForwardedProps = {
|
|
247
|
+
slots,
|
|
248
|
+
slotProps
|
|
249
|
+
};
|
|
250
|
+
const [IconSlot, iconSlotProps] = (0, _useSlot.default)('icon', {
|
|
251
|
+
elementType: RatingIcon,
|
|
245
252
|
className: (0, _clsx.default)(classes.icon, isFilled ? classes.iconFilled : classes.iconEmpty, isHovered && classes.iconHover, isFocused && classes.iconFocus, isActive && classes.iconActive),
|
|
253
|
+
externalForwardedProps,
|
|
246
254
|
ownerState: {
|
|
247
255
|
...ownerState,
|
|
248
256
|
iconEmpty: !isFilled,
|
|
@@ -251,6 +259,29 @@ function RatingItem(props) {
|
|
|
251
259
|
iconFocus: isFocused,
|
|
252
260
|
iconActive: isActive
|
|
253
261
|
},
|
|
262
|
+
additionalProps: {
|
|
263
|
+
value: itemValue
|
|
264
|
+
},
|
|
265
|
+
internalForwardedProps: {
|
|
266
|
+
// TODO: remove this in v7 because `IconContainerComponent` is deprecated
|
|
267
|
+
// only forward if `slots.icon` is NOT provided
|
|
268
|
+
as: IconContainerComponent
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
const [LabelSlot, labelSlotProps] = (0, _useSlot.default)('label', {
|
|
272
|
+
elementType: RatingLabel,
|
|
273
|
+
externalForwardedProps,
|
|
274
|
+
ownerState: {
|
|
275
|
+
...ownerState,
|
|
276
|
+
emptyValueFocused: undefined
|
|
277
|
+
},
|
|
278
|
+
additionalProps: {
|
|
279
|
+
style: labelProps?.style,
|
|
280
|
+
htmlFor: id
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
const container = /*#__PURE__*/(0, _jsxRuntime.jsx)(IconSlot, {
|
|
284
|
+
...iconSlotProps,
|
|
254
285
|
children: emptyIcon && !isFilled ? emptyIcon : icon
|
|
255
286
|
});
|
|
256
287
|
if (readOnly) {
|
|
@@ -260,13 +291,8 @@ function RatingItem(props) {
|
|
|
260
291
|
});
|
|
261
292
|
}
|
|
262
293
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
263
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
264
|
-
|
|
265
|
-
...ownerState,
|
|
266
|
-
emptyValueFocused: undefined
|
|
267
|
-
},
|
|
268
|
-
htmlFor: id,
|
|
269
|
-
...labelProps,
|
|
294
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(LabelSlot, {
|
|
295
|
+
...labelSlotProps,
|
|
270
296
|
children: [container, /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
271
297
|
className: classes.visuallyHidden,
|
|
272
298
|
children: getLabelText(itemValue)
|
|
@@ -307,7 +333,9 @@ process.env.NODE_ENV !== "production" ? RatingItem.propTypes = {
|
|
|
307
333
|
ownerState: _propTypes.default.object.isRequired,
|
|
308
334
|
ratingValue: _propTypes.default.number,
|
|
309
335
|
ratingValueRounded: _propTypes.default.number,
|
|
310
|
-
readOnly: _propTypes.default.bool.isRequired
|
|
336
|
+
readOnly: _propTypes.default.bool.isRequired,
|
|
337
|
+
slotProps: _propTypes.default.object,
|
|
338
|
+
slots: _propTypes.default.object
|
|
311
339
|
} : void 0;
|
|
312
340
|
const defaultIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Star.default, {
|
|
313
341
|
fontSize: "inherit"
|
|
@@ -344,6 +372,8 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
344
372
|
readOnly = false,
|
|
345
373
|
size = 'medium',
|
|
346
374
|
value: valueProp,
|
|
375
|
+
slots = {},
|
|
376
|
+
slotProps = {},
|
|
347
377
|
...other
|
|
348
378
|
} = props;
|
|
349
379
|
const name = (0, _utils.unstable_useId)(nameProp);
|
|
@@ -481,16 +511,50 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
481
511
|
size
|
|
482
512
|
};
|
|
483
513
|
const classes = useUtilityClasses(ownerState);
|
|
484
|
-
|
|
485
|
-
|
|
514
|
+
const externalForwardedProps = {
|
|
515
|
+
slots,
|
|
516
|
+
slotProps
|
|
517
|
+
};
|
|
518
|
+
const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
|
|
486
519
|
ref: handleRef,
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
520
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
521
|
+
elementType: RatingRoot,
|
|
522
|
+
externalForwardedProps: {
|
|
523
|
+
...externalForwardedProps,
|
|
524
|
+
...other,
|
|
525
|
+
component
|
|
526
|
+
},
|
|
527
|
+
getSlotProps: handlers => ({
|
|
528
|
+
...handlers,
|
|
529
|
+
onMouseMove: event => {
|
|
530
|
+
handleMouseMove(event);
|
|
531
|
+
handlers.onMouseMove?.(event);
|
|
532
|
+
},
|
|
533
|
+
onMouseLeave: event => {
|
|
534
|
+
handleMouseLeave(event);
|
|
535
|
+
handlers.onMouseLeave?.(event);
|
|
536
|
+
}
|
|
537
|
+
}),
|
|
538
|
+
ownerState,
|
|
539
|
+
additionalProps: {
|
|
540
|
+
role: readOnly ? 'img' : null,
|
|
541
|
+
'aria-label': readOnly ? getLabelText(value) : null
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
const [LabelSlot, labelSlotProps] = (0, _useSlot.default)('label', {
|
|
545
|
+
className: (0, _clsx.default)(classes.label, classes.labelEmptyValue),
|
|
546
|
+
elementType: RatingLabel,
|
|
547
|
+
externalForwardedProps,
|
|
548
|
+
ownerState
|
|
549
|
+
});
|
|
550
|
+
const [DecimalSlot, decimalSlotProps] = (0, _useSlot.default)('decimal', {
|
|
551
|
+
className: classes.decimal,
|
|
552
|
+
elementType: RatingDecimal,
|
|
553
|
+
externalForwardedProps,
|
|
554
|
+
ownerState
|
|
555
|
+
});
|
|
556
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, {
|
|
557
|
+
...rootSlotProps,
|
|
494
558
|
children: [Array.from(new Array(max)).map((_, index) => {
|
|
495
559
|
const itemValue = index + 1;
|
|
496
560
|
const ratingItemProps = {
|
|
@@ -511,41 +575,42 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
511
575
|
ratingValue: value,
|
|
512
576
|
ratingValueRounded: valueRounded,
|
|
513
577
|
readOnly,
|
|
514
|
-
ownerState
|
|
578
|
+
ownerState,
|
|
579
|
+
slots,
|
|
580
|
+
slotProps
|
|
515
581
|
};
|
|
516
582
|
const isActive = itemValue === Math.ceil(value) && (hover !== -1 || focus !== -1);
|
|
517
583
|
if (precision < 1) {
|
|
518
584
|
const items = Array.from(new Array(1 / precision));
|
|
519
|
-
return /*#__PURE__*/(0,
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
585
|
+
return /*#__PURE__*/(0, _react.createElement)(DecimalSlot, {
|
|
586
|
+
...decimalSlotProps,
|
|
587
|
+
key: itemValue,
|
|
588
|
+
className: (0, _clsx.default)(decimalSlotProps.className, isActive && classes.iconActive),
|
|
589
|
+
iconActive: isActive
|
|
590
|
+
}, items.map(($, indexDecimal) => {
|
|
591
|
+
const itemDecimalValue = roundValueToPrecision(itemValue - 1 + (indexDecimal + 1) * precision, precision);
|
|
592
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingItem, {
|
|
593
|
+
...ratingItemProps,
|
|
594
|
+
// The icon is already displayed as active
|
|
595
|
+
isActive: false,
|
|
596
|
+
itemValue: itemDecimalValue,
|
|
597
|
+
labelProps: {
|
|
598
|
+
style: items.length - 1 === indexDecimal ? {} : {
|
|
599
|
+
width: itemDecimalValue === value ? `${(indexDecimal + 1) * precision * 100}%` : '0%',
|
|
600
|
+
overflow: 'hidden',
|
|
601
|
+
position: 'absolute'
|
|
536
602
|
}
|
|
537
|
-
}
|
|
538
|
-
})
|
|
539
|
-
}
|
|
603
|
+
}
|
|
604
|
+
}, itemDecimalValue);
|
|
605
|
+
}));
|
|
540
606
|
}
|
|
541
607
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingItem, {
|
|
542
608
|
...ratingItemProps,
|
|
543
609
|
isActive: isActive,
|
|
544
610
|
itemValue: itemValue
|
|
545
611
|
}, itemValue);
|
|
546
|
-
}), !readOnly && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
547
|
-
|
|
548
|
-
ownerState: ownerState,
|
|
612
|
+
}), !readOnly && !disabled && /*#__PURE__*/(0, _jsxRuntime.jsxs)(LabelSlot, {
|
|
613
|
+
...labelSlotProps,
|
|
549
614
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
550
615
|
className: classes.visuallyHidden,
|
|
551
616
|
value: "",
|
|
@@ -629,6 +694,7 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
|
|
|
629
694
|
icon: _propTypes.default.node,
|
|
630
695
|
/**
|
|
631
696
|
* The component containing the icon.
|
|
697
|
+
* @deprecated Use `slotProps.icon.component` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
632
698
|
* @default function IconContainer(props) {
|
|
633
699
|
* const { value, ...other } = props;
|
|
634
700
|
* return <span {...other} />;
|
|
@@ -686,6 +752,26 @@ process.env.NODE_ENV !== "production" ? Rating.propTypes /* remove-proptypes */
|
|
|
686
752
|
* @default 'medium'
|
|
687
753
|
*/
|
|
688
754
|
size: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['small', 'medium', 'large']), _propTypes.default.string]),
|
|
755
|
+
/**
|
|
756
|
+
* The props used for each slot inside.
|
|
757
|
+
* @default {}
|
|
758
|
+
*/
|
|
759
|
+
slotProps: _propTypes.default.shape({
|
|
760
|
+
decimal: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
761
|
+
icon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
762
|
+
label: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
763
|
+
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
764
|
+
}),
|
|
765
|
+
/**
|
|
766
|
+
* The components used for each slot inside.
|
|
767
|
+
* @default {}
|
|
768
|
+
*/
|
|
769
|
+
slots: _propTypes.default.shape({
|
|
770
|
+
decimal: _propTypes.default.elementType,
|
|
771
|
+
icon: _propTypes.default.elementType,
|
|
772
|
+
label: _propTypes.default.elementType,
|
|
773
|
+
root: _propTypes.default.elementType
|
|
774
|
+
}),
|
|
689
775
|
/**
|
|
690
776
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
691
777
|
*/
|
package/node/index.js
CHANGED
package/node/version/index.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.prerelease = exports.patch = exports.minor = exports.major = exports.default = void 0;
|
|
7
|
-
const version = exports.version = "6.4.
|
|
7
|
+
const version = exports.version = "6.4.7";
|
|
8
8
|
const major = exports.major = Number("6");
|
|
9
9
|
const minor = exports.minor = Number("4");
|
|
10
|
-
const patch = exports.patch = Number("
|
|
10
|
+
const patch = exports.patch = Number("7");
|
|
11
11
|
const prerelease = exports.prerelease = undefined;
|
|
12
12
|
var _default = exports.default = version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/material",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"prop-types": "^15.8.1",
|
|
36
36
|
"react-is": "^19.0.0",
|
|
37
37
|
"react-transition-group": "^4.4.5",
|
|
38
|
-
"@mui/core-downloads-tracker": "^6.4.6",
|
|
39
|
-
"@mui/system": "^6.4.6",
|
|
40
38
|
"@mui/utils": "^6.4.6",
|
|
41
|
-
"@mui/
|
|
39
|
+
"@mui/system": "^6.4.7",
|
|
40
|
+
"@mui/types": "^7.2.21",
|
|
41
|
+
"@mui/core-downloads-tracker": "^6.4.7"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@emotion/react": "^11.5.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
47
47
|
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
48
48
|
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
49
|
-
"@mui/material-pigment-css": "^6.4.
|
|
49
|
+
"@mui/material-pigment-css": "^6.4.7"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"@types/react": {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DefaultTheme } from '@mui/system';
|
|
3
|
+
import { StorageManager } from '@mui/system/cssVars';
|
|
3
4
|
import { CssThemeVariables } from './createThemeNoVars';
|
|
4
5
|
type ThemeProviderCssVariablesProps = CssThemeVariables extends {
|
|
5
6
|
enabled: true;
|
|
@@ -40,6 +41,11 @@ export interface ThemeProviderProps<Theme = DefaultTheme> extends ThemeProviderC
|
|
|
40
41
|
* @default window
|
|
41
42
|
*/
|
|
42
43
|
storageWindow?: Window | null;
|
|
44
|
+
/**
|
|
45
|
+
* The storage manager to be used for storing the mode and color scheme
|
|
46
|
+
* @default using `window.localStorage`
|
|
47
|
+
*/
|
|
48
|
+
storageManager?: StorageManager | null;
|
|
43
49
|
/**
|
|
44
50
|
* localStorage key used to store application `mode`
|
|
45
51
|
* @default 'mui-mode'
|
|
@@ -43,6 +43,7 @@ export declare const CssVarsProvider: (props: React.PropsWithChildren<Partial<im
|
|
|
43
43
|
defaultMode?: "light" | "dark" | "system";
|
|
44
44
|
documentNode?: Document | null;
|
|
45
45
|
colorSchemeNode?: Element | null;
|
|
46
|
+
storageManager?: import("@mui/system").StorageManager | null;
|
|
46
47
|
storageWindow?: Window | null;
|
|
47
48
|
disableNestedContext?: boolean;
|
|
48
49
|
disableStyleSheetGeneration?: boolean;
|
package/styles/index.d.ts
CHANGED
|
@@ -103,6 +103,7 @@ export { default as withStyles } from './withStyles';
|
|
|
103
103
|
export { default as withTheme } from './withTheme';
|
|
104
104
|
|
|
105
105
|
export * from './ThemeProviderWithVars';
|
|
106
|
+
export type { StorageManager } from '@mui/system/cssVars';
|
|
106
107
|
|
|
107
108
|
export { default as extendTheme } from './createThemeWithVars';
|
|
108
109
|
|
package/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "6.4.
|
|
1
|
+
export const version = "6.4.7";
|
|
2
2
|
export const major = Number("6");
|
|
3
3
|
export const minor = Number("4");
|
|
4
|
-
export const patch = Number("
|
|
4
|
+
export const patch = Number("7");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|