paradiego
This commit is contained in:
17
node_modules/@mui/system/useThemeProps/getThemeProps.d.ts
generated
vendored
Normal file
17
node_modules/@mui/system/useThemeProps/getThemeProps.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export {};
|
||||
|
||||
interface ThemeWithProps<Components> {
|
||||
components?: { [K in keyof Components]: { defaultProps?: Partial<Components[K]> } };
|
||||
}
|
||||
|
||||
type ThemedProps<Theme, Name extends keyof any> = Theme extends {
|
||||
components: Record<Name, { defaultProps: infer Props }>;
|
||||
}
|
||||
? Props
|
||||
: {};
|
||||
|
||||
export default function getThemeProps<Theme, Props, Name extends keyof any>(params: {
|
||||
props: Props;
|
||||
name: Name;
|
||||
theme?: Theme;
|
||||
}): Props & ThemedProps<Theme, Name>;
|
||||
12
node_modules/@mui/system/useThemeProps/getThemeProps.js
generated
vendored
Normal file
12
node_modules/@mui/system/useThemeProps/getThemeProps.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import resolveProps from '@mui/utils/resolveProps';
|
||||
export default function getThemeProps(params) {
|
||||
const {
|
||||
theme,
|
||||
name,
|
||||
props
|
||||
} = params;
|
||||
if (!theme || !theme.components || !theme.components[name] || !theme.components[name].defaultProps) {
|
||||
return props;
|
||||
}
|
||||
return resolveProps(theme.components[name].defaultProps, props);
|
||||
}
|
||||
4
node_modules/@mui/system/useThemeProps/index.d.ts
generated
vendored
Normal file
4
node_modules/@mui/system/useThemeProps/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { default } from './useThemeProps';
|
||||
export * from './useThemeProps';
|
||||
|
||||
export { default as getThemeProps } from './getThemeProps';
|
||||
2
node_modules/@mui/system/useThemeProps/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/useThemeProps/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./useThemeProps.js";
|
||||
export { default as getThemeProps } from "./getThemeProps.js";
|
||||
6
node_modules/@mui/system/useThemeProps/package.json
generated
vendored
Normal file
6
node_modules/@mui/system/useThemeProps/package.json
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"sideEffects": false,
|
||||
"module": "./index.js",
|
||||
"main": "../node/useThemeProps/index.js",
|
||||
"types": "./index.d.ts"
|
||||
}
|
||||
20
node_modules/@mui/system/useThemeProps/useThemeProps.d.ts
generated
vendored
Normal file
20
node_modules/@mui/system/useThemeProps/useThemeProps.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
export interface ThemeWithProps {
|
||||
components?: any;
|
||||
}
|
||||
|
||||
export type ThemedProps<Theme, Name extends keyof any> = Theme extends {
|
||||
components: Record<Name, { defaultProps: infer Props }>;
|
||||
}
|
||||
? Props
|
||||
: {};
|
||||
|
||||
export default function useThemeProps<
|
||||
Theme extends ThemeWithProps,
|
||||
Props,
|
||||
Name extends keyof any,
|
||||
>(params: {
|
||||
props: Props;
|
||||
name: Name;
|
||||
defaultTheme?: Theme;
|
||||
themeId?: string;
|
||||
}): Props & ThemedProps<Theme, Name>;
|
||||
20
node_modules/@mui/system/useThemeProps/useThemeProps.js
generated
vendored
Normal file
20
node_modules/@mui/system/useThemeProps/useThemeProps.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use client';
|
||||
|
||||
import getThemeProps from "./getThemeProps.js";
|
||||
import useTheme from "../useTheme/index.js";
|
||||
export default function useThemeProps({
|
||||
props,
|
||||
name,
|
||||
defaultTheme,
|
||||
themeId
|
||||
}) {
|
||||
let theme = useTheme(defaultTheme);
|
||||
if (themeId) {
|
||||
theme = theme[themeId] || theme;
|
||||
}
|
||||
return getThemeProps({
|
||||
theme,
|
||||
name,
|
||||
props
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user