paradiego

This commit is contained in:
2024-09-18 13:34:19 -03:00
commit 3f0e204289
12510 changed files with 1486101 additions and 0 deletions

View 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>;

View 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
View 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
View 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
View File

@@ -0,0 +1,6 @@
{
"sideEffects": false,
"module": "./index.js",
"main": "../node/useThemeProps/index.js",
"types": "./index.d.ts"
}

View 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>;

View 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
});
}