@mui/types 7.1.5 → 7.2.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/OverridableComponentAugmentation.ts +44 -0
- package/package.json +3 -2
- package/CHANGELOG.md +0 -8981
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare module '@mui/types' {
|
|
4
|
+
/**
|
|
5
|
+
* A component whose root component can be controlled via a `component` prop.
|
|
6
|
+
*
|
|
7
|
+
* Adjusts valid props based on the type of `component`.
|
|
8
|
+
*/
|
|
9
|
+
interface OverridableComponent<M extends OverridableTypeMap> {
|
|
10
|
+
<C extends React.ElementType>(
|
|
11
|
+
props: {
|
|
12
|
+
/**
|
|
13
|
+
* The component used for the root node.
|
|
14
|
+
* Either a string to use a HTML element or a component.
|
|
15
|
+
*/
|
|
16
|
+
component: C;
|
|
17
|
+
} & OverridePropsVer2<M, C>,
|
|
18
|
+
): JSX.Element;
|
|
19
|
+
(props: DefaultComponentPropsVer2<M>): JSX.Element;
|
|
20
|
+
propTypes?: any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Props of the component if `component={Component}` is used.
|
|
25
|
+
*/
|
|
26
|
+
// prettier-ignore
|
|
27
|
+
type OverridePropsVer2<
|
|
28
|
+
M extends OverridableTypeMap,
|
|
29
|
+
C extends React.ElementType
|
|
30
|
+
> = (
|
|
31
|
+
& BaseProps<M>
|
|
32
|
+
& DistributiveOmit<React.ComponentPropsWithoutRef<C>, keyof BaseProps<M>>
|
|
33
|
+
& { ref?: React.Ref<Element> }
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Props if `component={Component}` is NOT used.
|
|
38
|
+
*/
|
|
39
|
+
// prettier-ignore
|
|
40
|
+
type DefaultComponentPropsVer2<M extends OverridableTypeMap> =
|
|
41
|
+
& BaseProps<M>
|
|
42
|
+
& DistributiveOmit<React.ComponentPropsWithoutRef<M['defaultComponent']>, keyof BaseProps<M>>
|
|
43
|
+
& { ref?: React.Ref<Element> };
|
|
44
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/types",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"description": "Utility types for MUI.",
|
|
7
7
|
"types": "./index.d.ts",
|
|
8
8
|
"files": [
|
|
9
|
-
"index.d.ts"
|
|
9
|
+
"index.d.ts",
|
|
10
|
+
"OverridableComponentAugmentation.ts"
|
|
10
11
|
],
|
|
11
12
|
"keywords": [
|
|
12
13
|
"react",
|