import type { BaseTheme, ComponentTheme, ComponentThemeMap, DeepPartial } from '@instructure/shared-types'; import type { Theme, SharedTokens } from '@instructure/ui-themes'; /** * A theme object where every prop is optional */ type PartialTheme = DeepPartial>; /** * Keys are component IDs, values are their theme props. * Key can be an arbitrary string to support custom components */ type ComponentOverride = { [otherComponent: string]: ComponentTheme; } & DeepPartial; /** * Overrides for a specific theme, e.g. Canvas * The `ComponentOverride` type as value is needed to be able to type * componentOverrides properly, see * https://www.typescriptlang.org/docs/handbook/2/objects.html#index-signatures */ type SpecificThemeOverride = { [key: string]: undefined | ComponentOverride | (PartialTheme & { componentOverrides?: ComponentOverride; }); componentOverrides?: ComponentOverride; }; /** * Can take up one of more of the following: * - parts of a theme object like `{typography: {fontFamily: 'Arial'}}` * - overrides for specific components in a `componentOverrides` prop * - overrides for a specific theme like `{canvas: {...}}` */ type ThemeOverride = PartialTheme | SpecificThemeOverride; type Overrides = { /** * Override theme variables, Keys are props of theme objects, values are their * overridden values, e.g.: * ``` * themeOverrides: { * typography: { * fontFamily: 'Brush Script MT' * }, * colors: { * contrasts: { * white1010: '#ff00ff' * } * }, * componentOverrides: { * 'Tabs.Tab': { * fontSize: '5rem' * } * } * } * ``` */ themeOverrides?: ThemeOverride; /** * Override individual components. Keys are component IDs, * values are objects with the theme variables for the given object, e.g. * ``` * componentOverrides: { * 'Tabs.Tab': { * fontSize: '5rem' * } * } * ``` */ componentOverrides?: ComponentOverride; }; type BaseThemeOrOverride = Theme | PartialTheme | Overrides; type ThemeOrOverride = BaseThemeOrOverride | ((theme: BaseTheme) => BaseThemeOrOverride); type Props = Record; type State = Record; type GenerateComponentTheme = (theme: BaseTheme | PartialTheme) => ComponentTheme; type GenerateStyle = (componentTheme: ComponentTheme, props: Props, state?: State) => StyleObject; type GenerateStyleRework = (componentTheme: ComponentTheme, props: Props, sharedTokens: SharedTokens, state?: State) => StyleObject; type GenerateStyleFunctional = (componentTheme: ComponentTheme, params: Record) => StyleObject; type ComponentStyle = Record; /** * Style object returned by the generateStyle method of the components */ export interface StyleObject { [key: string]: StyleObject | string | number | undefined; } export type { BaseThemeOrOverride, ThemeOrOverride, Overrides, ComponentOverride, SpecificThemeOverride, ThemeOverride, PartialTheme, Props, State, GenerateComponentTheme, GenerateStyle, GenerateStyleRework, GenerateStyleFunctional, ComponentStyle }; //# sourceMappingURL=EmotionTypes.d.ts.map