Začetni commit projekta rezervacije

This commit is contained in:
Mark Poljanšek committed 2025-04-23 20:19:33 +02:00
commit 328731b32f
56062 files changed
+2485242

No files matched your search

+72
View File
@@ -0,0 +1,72 @@
import * as React from 'react';
import { OverridableComponent, OverrideProps } from '@mui/types';
import { Theme as SystemTheme } from "../createTheme/index.js";
import { SxProps, AllSystemCSSProperties, ResponsiveStyleValue, OverwriteCSSProperties, AliasesCSSProperties } from "../styleFunctionSx/index.js";
export type PropsFor<SomeStyleFunction> = SomeStyleFunction extends StyleFunction<infer Props> ? Props : never;
export type StyleFunction<Props> = (props: Props) => any;
export type SimpleStyleFunction<PropKey extends keyof any> = StyleFunction<Partial<Record<PropKey, any>>> & {
filterProps: string[];
};
// borders.js
export declare const borders: SimpleStyleFunction<'border' | 'borderTop' | 'borderRight' | 'borderBottom' | 'borderLeft' | 'borderColor' | 'borderRadius'>;
export declare const display: SimpleStyleFunction<'display' | 'displayPrint' | 'overflow' | 'textOverflow' | 'visibility' | 'whiteSpace'>;
export declare const flexbox: SimpleStyleFunction<'flexBasis' | 'flexDirection' | 'flexWrap' | 'justifyContent' | 'alignItems' | 'alignContent' | 'order' | 'flex' | 'flexGrow' | 'flexShrink' | 'alignSelf' | 'justifyItems' | 'justifySelf'>;
export declare const grid: SimpleStyleFunction<'gap' | 'columnGap' | 'rowGap' | 'gridColumn' | 'gridRow' | 'gridAutoFlow' | 'gridAutoColumns' | 'gridAutoRows' | 'gridTemplateColumns' | 'gridTemplateRows' | 'gridTemplateAreas' | 'gridArea'>;
export declare const palette: SimpleStyleFunction<'bgcolor' | 'color'>;
export declare const positions: SimpleStyleFunction<'zIndex' | 'position' | 'top' | 'right' | 'bottom' | 'left'>;
export declare const shadows: SimpleStyleFunction<'boxShadow'>;
export declare const sizing: SimpleStyleFunction<'width' | 'maxWidth' | 'minWidth' | 'height' | 'maxHeight' | 'minHeight' | 'sizeWidth' | 'sizeHeight' | 'boxSizing'>;
export declare const spacing: SimpleStyleFunction<'m' | 'mt' | 'mr' | 'mb' | 'ml' | 'mx' | 'my' | 'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'marginX' | 'marginY' | 'marginInline' | 'marginInlineStart' | 'marginInlineEnd' | 'marginBlock' | 'marginBlockStart' | 'marginBlockEnd' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'paddingX' | 'paddingY' | 'paddingInline' | 'paddingInlineStart' | 'paddingInlineEnd' | 'paddingBlock' | 'paddingBlockStart' | 'paddingBlockEnd'>;
export declare const typography: SimpleStyleFunction<'typography' | 'fontFamily' | 'fontSize' | 'fontStyle' | 'fontWeight' | 'letterSpacing' | 'lineHeight' | 'textAlign' | 'textTransform'>;
// compose.js
/**
* given a list of StyleFunction return the intersection of the props each individual
* StyleFunction requires.
*
* If `firstFn` requires { color: string } and `secondFn` requires { spacing: number }
* their composed function requires { color: string, spacing: number }
*/
type ComposedArg<T> = T extends Array<(arg: infer P) => any> ? P : never;
type ComposedOwnerState<T> = ComposedArg<T>;
export type ComposedStyleFunction<T extends Array<StyleFunction<any>>> = StyleFunction<ComposedOwnerState<T>> & {
filterProps: string[];
};
export interface CustomSystemProps extends AliasesCSSProperties, OverwriteCSSProperties {}
export type SimpleSystemKeys = keyof PropsFor<ComposedStyleFunction<[typeof borders, typeof display, typeof flexbox, typeof grid, typeof palette, typeof positions, typeof shadows, typeof sizing, typeof spacing, typeof typography]>>;
// The SimpleSystemKeys are subset of the AllSystemCSSProperties, so this should be ok
// This is needed as these are used as keys inside AllSystemCSSProperties
type StandardSystemKeys = Extract<SimpleSystemKeys, keyof AllSystemCSSProperties>;
export type SystemProps<Theme extends object = {}> = { [K in StandardSystemKeys]?: ResponsiveStyleValue<AllSystemCSSProperties[K]> | ((theme: Theme) => ResponsiveStyleValue<AllSystemCSSProperties[K]>) };
export interface BoxOwnProps<Theme extends object = SystemTheme> extends SystemProps<Theme> {
children?: React.ReactNode;
ref?: React.Ref<unknown>;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme>;
}
export interface BoxTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'div', Theme extends object = SystemTheme> {
props: AdditionalProps & BoxOwnProps<Theme>;
defaultComponent: RootComponent;
}
/**
*
* Demos:
*
* - [Box (Joy UI)](https://mui.com/joy-ui/react-box/)
* - [Box (Material UI)](https://mui.com/material-ui/react-box/)
* - [Box (MUI System)](https://mui.com/system/react-box/)
*
* API:
*
* - [Box API](https://mui.com/system/api/box/)
*/
declare const Box: OverridableComponent<BoxTypeMap>;
export type BoxProps<RootComponent extends React.ElementType = BoxTypeMap['defaultComponent'], AdditionalProps = {}> = OverrideProps<BoxTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
component?: React.ElementType;
};
export default Box;
+7
View File
@@ -0,0 +1,7 @@
export interface BoxClasses {
/** Styles applied to the root element. */
root: string;
}
export type BoxClassKey = keyof BoxClasses;
declare const boxClasses: BoxClasses;
export default boxClasses;
+4
View File
@@ -0,0 +1,4 @@
export { default } from "./Box.js";
export * from "./Box.js";
export { default as boxClasses } from "./boxClasses.js";
export * from "./boxClasses.js";
+7
View File
@@ -0,0 +1,7 @@
import * as CSS from 'csstype';
/**
* All non-vendor-prefixed CSS properties. (Also allows `number` in order to support CSS-in-JS libs,
* since they are converted to `px`.)
*/
export interface CSSProperties extends CSS.StandardProperties<number | string>, CSS.SvgProperties<number | string> {}
+13
View File
@@ -0,0 +1,13 @@
/**
*
* Demos:
*
* - [Container (Material UI)](https://mui.com/material-ui/react-container/)
* - [Container (MUI System)](https://mui.com/system/react-container/)
*
* API:
*
* - [Container API](https://mui.com/system/api/container/)
*/
declare const Container: import("@mui/types").OverridableComponent<import("./ContainerProps.js").ContainerTypeMap<{}, "div">>;
export default Container;
+40
View File
@@ -0,0 +1,40 @@
import * as React from 'react';
import { OverrideProps } from '@mui/types';
import { SxProps } from "../styleFunctionSx/index.js";
import { Theme, Breakpoint } from "../createTheme/index.js";
import { ContainerClasses } from "./containerClasses.js";
export interface ContainerTypeMap<AdditionalProps = {}, DefaultComponent extends React.ElementType = 'div'> {
props: AdditionalProps & {
children?: React.ReactNode;
/**
* Override or extend the styles applied to the component.
*/
classes?: Partial<ContainerClasses>;
/**
* If `true`, the left and right padding is removed.
* @default false
*/
disableGutters?: boolean;
/**
* Set the max-width to match the min-width of the current breakpoint.
* This is useful if you'd prefer to design for a fixed set of sizes
* instead of trying to accommodate a fully fluid viewport.
* It's fluid by default.
* @default false
*/
fixed?: boolean;
/**
* Determine the max-width of the container.
* The container width grows with the size of the screen.
* Set to `false` to disable `maxWidth`.
* @default 'lg'
*/
maxWidth?: Breakpoint | false;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme>;
};
defaultComponent: DefaultComponent;
}
export type ContainerProps<RootComponent extends React.ElementType = ContainerTypeMap['defaultComponent'], AdditionalProps = {}> = OverrideProps<ContainerTypeMap<AdditionalProps, RootComponent>, RootComponent>;
+22
View File
@@ -0,0 +1,22 @@
export interface ContainerClasses {
/** Styles applied to the root element. */
root: string;
/** Styles applied to the root element if `disableGutters={true}`. */
disableGutters: string;
/** Styles applied to the root element if `fixed={true}`. */
fixed: string;
/** Styles applied to the root element if `maxWidth="xs"`. */
maxWidthXs: string;
/** Styles applied to the root element if `maxWidth="sm"`. */
maxWidthSm: string;
/** Styles applied to the root element if `maxWidth="md"`. */
maxWidthMd: string;
/** Styles applied to the root element if `maxWidth="lg"`. */
maxWidthLg: string;
/** Styles applied to the root element if `maxWidth="xl"`. */
maxWidthXl: string;
}
export type ContainerClassKey = keyof ContainerClasses;
export declare function getContainerUtilityClass(slot: string): string;
declare const containerClasses: ContainerClasses;
export default containerClasses;
+18
View File
@@ -0,0 +1,18 @@
import * as React from 'react';
import { Interpolation, MUIStyledComponent as StyledComponent } from '@mui/styled-engine';
import { OverridableComponent } from '@mui/types';
import { ContainerProps, ContainerTypeMap } from "./ContainerProps.js";
import { Theme as DefaultTheme } from "../createTheme/index.js";
interface StyleFnProps<Theme> extends ContainerProps {
theme: Theme;
ownerState: ContainerProps;
}
type RequiredThemeStructure = Pick<DefaultTheme, 'breakpoints' | 'spacing'>;
export default function createContainer<Theme extends RequiredThemeStructure = DefaultTheme>(options?: {
createStyledComponent?: (...styles: Array<Interpolation<StyleFnProps<Theme>>>) => StyledComponent<ContainerProps>;
useThemeProps?: (inProps: ContainerProps) => ContainerProps & {
component?: React.ElementType;
};
componentName?: string;
}): OverridableComponent<ContainerTypeMap<{}, "div">>;
export {};
+4
View File
@@ -0,0 +1,4 @@
export { default } from "./Container.js";
export * from "./ContainerProps.js";
export { default as containerClasses } from "./containerClasses.js";
export * from "./containerClasses.js";
@@ -0,0 +1,18 @@
import * as React from 'react';
declare function DefaultPropsProvider({
value,
children
}: React.PropsWithChildren<{
value: Record<string, any> | undefined;
}>): React.JSX.Element;
declare namespace DefaultPropsProvider {
var propTypes: any;
}
export declare function useDefaultProps<Props>({
props,
name
}: {
props: Props;
name: string;
}): Props;
export default DefaultPropsProvider;
+1
View File
@@ -0,0 +1 @@
export { default, useDefaultProps } from "./DefaultPropsProvider.js";
+17
View File
@@ -0,0 +1,17 @@
import * as React from 'react';
import { Interpolation } from '@mui/styled-engine';
import { Theme as SystemTheme } from "../createTheme/index.js";
export interface GlobalStylesProps<Theme = SystemTheme> {
styles: Interpolation<Theme>;
defaultTheme?: object;
themeId?: string;
}
declare function GlobalStyles<Theme = SystemTheme>({
styles,
themeId,
defaultTheme
}: GlobalStylesProps<Theme>): React.JSX.Element;
declare namespace GlobalStyles {
var propTypes: any;
}
export default GlobalStyles;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./GlobalStyles.js";
export * from "./GlobalStyles.js";
+13
View File
@@ -0,0 +1,13 @@
/**
*
* Demos:
*
* - [Grid (Joy UI)](https://mui.com/joy-ui/react-grid/)
* - [Grid (Material UI)](https://mui.com/material-ui/react-grid/)
*
* API:
*
* - [Grid API](https://mui.com/system/api/grid/)
*/
declare const Grid: import("@mui/types").OverridableComponent<import("./GridProps.js").GridTypeMap<{}, "div">>;
export default Grid;
+103
View File
@@ -0,0 +1,103 @@
import * as React from 'react';
import { OverrideProps, PartiallyRequired } from '@mui/types';
import { SxProps } from "../styleFunctionSx/index.js";
import { Theme, Breakpoint } from "../createTheme/index.js";
import { SystemProps } from "../Box/index.js";
type ResponsiveStyleValue<T> = T | Array<T | null> | { [key in Breakpoint]?: T | null };
export type GridDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';
export type GridSpacing = number | string;
export type GridWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
export type GridSize = 'auto' | 'grow' | number | false;
export type GridOffset = 'auto' | number;
export interface GridBaseProps {
/**
* The content of the component.
*/
children?: React.ReactNode;
/**
* The number of columns.
* @default 12
*/
columns?: ResponsiveStyleValue<number>;
/**
* Defines the horizontal space between the type `item` components.
* It overrides the value of the `spacing` prop.
*/
columnSpacing?: ResponsiveStyleValue<GridSpacing>;
/**
* If `true`, the component will have the flex *container* behavior.
* You should be wrapping *items* with a *container*.
* @default false
*/
container?: boolean;
/**
* Defines the `flex-direction` style property.
* It is applied for all screen sizes.
* @default 'row'
*/
direction?: ResponsiveStyleValue<GridDirection>;
/**
* Defines the offset value for the type `item` components.
*/
offset?: ResponsiveStyleValue<GridOffset>;
/**
* @internal
* The level of the grid starts from `0` and increases when the grid nests
* inside another grid. Nesting is defined as a container Grid being a direct
* child of a container Grid.
*
* ```js
* <Grid container> // level 0
* <Grid container> // level 1
* <Grid container> // level 2
* ```
*
* Only consecutive grid is considered nesting. A grid container will start at
* `0` if there are non-Grid container element above it.
*
* ```js
* <Grid container> // level 0
* <div>
* <Grid container> // level 0
* ```
*
* ```js
* <Grid container> // level 0
* <Grid>
* <Grid container> // level 0
* ```
*/
unstable_level?: number;
/**
* Defines the vertical space between the type `item` components.
* It overrides the value of the `spacing` prop.
*/
rowSpacing?: ResponsiveStyleValue<GridSpacing>;
/**
* Defines the size of the the type `item` components.
*/
size?: ResponsiveStyleValue<GridSize>;
/**
* Defines the space between the type `item` components.
* It can only be used on a type `container` component.
* @default 0
*/
spacing?: ResponsiveStyleValue<GridSpacing> | undefined;
/**
* Defines the `flex-wrap` style property.
* It's applied for all screen sizes.
* @default 'wrap'
*/
wrap?: GridWrap;
}
export type GridOwnerState = PartiallyRequired<GridBaseProps, 'size' | 'offset' | 'unstable_level'>;
export interface GridTypeMap<AdditionalProps = {}, DefaultComponent extends React.ElementType = 'div'> {
props: AdditionalProps & GridBaseProps & {
sx?: SxProps<Theme>;
} & SystemProps<Theme>;
defaultComponent: DefaultComponent;
}
export type GridProps<RootComponent extends React.ElementType = GridTypeMap['defaultComponent'], AdditionalProps = {
component?: React.ElementType;
}> = OverrideProps<GridTypeMap<AdditionalProps, RootComponent>, RootComponent>;
export {};
+13
View File
@@ -0,0 +1,13 @@
import * as React from 'react';
import { OverridableComponent } from '@mui/types';
import useThemeSystem from "../useTheme/index.js";
import { GridTypeMap } from "./GridProps.js";
declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("../createStyled/index.js").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
declare function useThemePropsDefault<T extends {}>(props: T): T;
export default function createGrid(options?: {
createStyledComponent?: typeof defaultCreateStyledComponent;
useThemeProps?: typeof useThemePropsDefault;
useTheme?: typeof useThemeSystem;
componentName?: string;
}): OverridableComponent<GridTypeMap<{}, "div">>;
export {};
+11
View File
@@ -0,0 +1,11 @@
import { Breakpoint, Breakpoints } from "../createTheme/index.js";
/**
* Deletes the legacy Grid component props from the `props` object and warns once about them if found.
*
* @param {object} props The props object to remove the legacy Grid props from.
* @param {Breakpoints} breakpoints The breakpoints object.
*/
export default function deleteLegacyGridProps(props: {
item?: boolean;
zeroMinWidth?: boolean;
} & Partial<Record<Breakpoint, 'auto' | number | boolean>> & Record<string, any>, breakpoints: Breakpoints): void;
+20
View File
@@ -0,0 +1,20 @@
export interface GridClasses {
/** Styles applied to the root element. */
root: string;
/** Styles applied to the root element if `container={true}`. */
container: string;
/** Styles applied to the root element if `direction="column"`. */
'direction-xs-column': string;
/** Styles applied to the root element if `direction="column-reverse"`. */
'direction-xs-column-reverse': string;
/** Styles applied to the root element if `direction="row-reverse"`. */
'direction-xs-row-reverse': string;
/** Styles applied to the root element if `wrap="nowrap"`. */
'wrap-xs-nowrap': string;
/** Styles applied to the root element if `wrap="reverse"`. */
'wrap-xs-wrap-reverse': string;
}
export type GridClassKey = keyof GridClasses;
export declare function getGridUtilityClass(slot: string): string;
declare const gridClasses: GridClasses;
export default gridClasses;
+42
View File
@@ -0,0 +1,42 @@
import { Breakpoints } from "../createBreakpoints/createBreakpoints.js";
import { Spacing } from "../createTheme/createSpacing.js";
import { ResponsiveStyleValue } from "../styleFunctionSx/index.js";
import { GridDirection, GridOwnerState } from "./GridProps.js";
interface Props {
theme: {
breakpoints: Breakpoints;
spacing?: Spacing;
};
ownerState: GridOwnerState;
}
export declare const generateGridSizeStyles: ({
theme,
ownerState
}: Props) => {};
export declare const generateGridOffsetStyles: ({
theme,
ownerState
}: Props) => {};
export declare const generateGridColumnsStyles: ({
theme,
ownerState
}: Props) => {};
export declare const generateGridRowSpacingStyles: ({
theme,
ownerState
}: Props) => {};
export declare const generateGridColumnSpacingStyles: ({
theme,
ownerState
}: Props) => {};
export declare const generateGridDirectionStyles: ({
theme,
ownerState
}: Props) => {};
export declare const generateGridStyles: ({
ownerState
}: Props) => {};
export declare const generateSizeClassNames: (size: GridOwnerState["size"]) => string[];
export declare const generateSpacingClassNames: (spacing: GridOwnerState["spacing"], smallestBreakpoint?: string) => string[];
export declare const generateDirectionClasses: (direction: ResponsiveStyleValue<GridDirection> | undefined) => string[];
export {};
+7
View File
@@ -0,0 +1,7 @@
export { default } from "./Grid.js";
export { default as createGrid } from "./createGrid.js";
export * from "./GridProps.js";
export { default as gridClasses } from "./gridClasses.js";
export * from "./gridClasses.js";
export { traverseBreakpoints as unstable_traverseBreakpoints } from "./traverseBreakpoints.js";
export { generateDirectionClasses as unstable_generateDirectionClasses, generateSizeClassNames as unstable_generateSizeClassNames, generateSpacingClassNames as unstable_generateSpacingClassNames } from "./gridGenerator.js";
+7
View File
@@ -0,0 +1,7 @@
import { Breakpoints, Breakpoint } from "../createBreakpoints/createBreakpoints.js";
export declare const filterBreakpointKeys: (breakpointsKeys: Breakpoint[], responsiveKeys: string[]) => Breakpoint[];
interface Iterator<T> {
(appendStyle: (responsiveStyles: Record<string, any>, style: object) => void, value: T): void;
}
export declare const traverseBreakpoints: <T = unknown>(breakpoints: Breakpoints, responsive: T | T[] | Record<string, any> | undefined, iterator: Iterator<T>) => void;
export {};
@@ -0,0 +1,51 @@
/**
* Split this component for RSC import
*/
import * as React from 'react';
export declare const DEFAULT_MODE_STORAGE_KEY = "mode";
export declare const DEFAULT_COLOR_SCHEME_STORAGE_KEY = "color-scheme";
export declare const DEFAULT_ATTRIBUTE = "data-color-scheme";
export interface InitColorSchemeScriptProps {
/**
* The default mode when the storage is empty (user's first visit).
* @default 'system'
*/
defaultMode?: 'system' | 'light' | 'dark';
/**
* The default color scheme to be used on the light mode.
* @default 'light'
*/
defaultLightColorScheme?: string;
/**
* The default color scheme to be used on the dark mode.
* * @default 'dark'
*/
defaultDarkColorScheme?: string;
/**
* The node (provided as string) used to attach the color-scheme attribute.
* @default 'document.documentElement'
*/
colorSchemeNode?: string;
/**
* localStorage key used to store `mode`.
* @default 'mode'
*/
modeStorageKey?: string;
/**
* localStorage key used to store `colorScheme`.
* @default 'color-scheme'
*/
colorSchemeStorageKey?: string;
/**
* DOM attribute for applying color scheme.
* @default 'data-color-scheme'
* @example '.mode-%s' // for class based color scheme
* @example '[data-mode-%s]' // for data-attribute without '='
*/
attribute?: 'class' | 'data' | string;
/**
* Nonce string to pass to the inline script for CSP headers.
*/
nonce?: string | undefined;
}
export default function InitColorSchemeScript(options?: InitColorSchemeScriptProps): React.JSX.Element;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./InitColorSchemeScript.js";
export type { InitColorSchemeScriptProps } from "./InitColorSchemeScript.js";
+8
View File
@@ -0,0 +1,8 @@
import * as React from 'react';
interface RtlProviderProps {
children?: React.ReactNode;
value?: boolean;
}
declare const RtlProvider: React.FC<RtlProviderProps>;
export const useRtl: () => boolean;
export default RtlProvider;
+14
View File
@@ -0,0 +1,14 @@
/**
*
* Demos:
*
* - [Stack (Joy UI)](https://mui.com/joy-ui/react-stack/)
* - [Stack (Material UI)](https://mui.com/material-ui/react-stack/)
* - [Stack (MUI System)](https://mui.com/system/react-stack/)
*
* API:
*
* - [Stack API](https://mui.com/system/api/stack/)
*/
declare const Stack: import("@mui/types").OverridableComponent<import("./StackProps.js").StackTypeMap<{}, "div">>;
export default Stack;
+53
View File
@@ -0,0 +1,53 @@
import * as React from 'react';
import { OverrideProps } from '@mui/types';
import { ResponsiveStyleValue, SxProps } from "../styleFunctionSx/index.js";
import { SystemProps } from "../Box/index.js";
import { Theme } from "../createTheme/index.js";
export interface StackBaseProps {
/**
* The content of the component.
*/
children?: React.ReactNode;
/**
* Defines the `flex-direction` style property.
* It is applied for all screen sizes.
* @default 'column'
*/
direction?: ResponsiveStyleValue<'row' | 'row-reverse' | 'column' | 'column-reverse'>;
/**
* Defines the space between immediate children.
* @default 0
*/
spacing?: ResponsiveStyleValue<number | string>;
/**
* Add an element between each child.
*/
divider?: React.ReactNode;
/**
* If `true`, the CSS flexbox `gap` is used instead of applying `margin` to children.
*
* While CSS `gap` removes the [known limitations](https://mui.com/joy-ui/react-stack/#limitations),
* it is not fully supported in some browsers. We recommend checking https://caniuse.com/?search=flex%20gap before using this flag.
*
* To enable this flag globally, follow the theme's default props configuration.
* @default false
*/
useFlexGap?: boolean;
}
export interface StackTypeMap<AdditionalProps = {}, DefaultComponent extends React.ElementType = 'div'> {
props: AdditionalProps & StackBaseProps & {
/**
* The system prop, which allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps<Theme>;
} & SystemProps<Theme>;
defaultComponent: DefaultComponent;
}
export type StackProps<RootComponent extends React.ElementType = StackTypeMap['defaultComponent'], AdditionalProps = {
component?: React.ElementType;
}> = OverrideProps<StackTypeMap<AdditionalProps, RootComponent>, RootComponent>;
export interface StackOwnerState {
direction: StackProps['direction'];
spacing: StackProps['spacing'];
useFlexGap: boolean;
}
+24
View File
@@ -0,0 +1,24 @@
import * as React from 'react';
import { OverridableComponent } from '@mui/types';
import { StackTypeMap, StackOwnerState } from "./StackProps.js";
import { Breakpoints } from "../createBreakpoints/createBreakpoints.js";
import { Spacing } from "../createTheme/createSpacing.js";
interface StyleFunctionProps {
theme: {
breakpoints: Breakpoints;
spacing: Spacing;
};
ownerState: StackOwnerState;
}
declare const defaultCreateStyledComponent: import("@mui/styled-engine").CreateStyledComponent<import("../createStyled/index.js").MUIStyledCommonProps<any>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}, any>;
declare function useThemePropsDefault<T extends {}>(props: T): T;
export declare const style: ({
ownerState,
theme
}: StyleFunctionProps) => any;
export default function createStack(options?: {
createStyledComponent?: typeof defaultCreateStyledComponent;
useThemeProps?: typeof useThemePropsDefault;
componentName?: string;
}): OverridableComponent<StackTypeMap<{}, "div">>;
export {};
+5
View File
@@ -0,0 +1,5 @@
export { default } from "./Stack.js";
export { default as createStack } from "./createStack.js";
export * from "./StackProps.js";
export { default as stackClasses } from "./stackClasses.js";
export * from "./stackClasses.js";
+8
View File
@@ -0,0 +1,8 @@
export interface StackClasses {
/** Styles applied to the root element. */
root: string;
}
export type StackClassKey = keyof StackClasses;
export declare function getStackUtilityClass(slot: string): string;
declare const stackClasses: StackClasses;
export default stackClasses;
+24
View File
@@ -0,0 +1,24 @@
import { DefaultTheme } from '@mui/private-theming';
export interface ThemeProviderProps<Theme = DefaultTheme> {
/**
* Your component tree.
*/
children?: React.ReactNode;
/**
* The design system's unique id for getting the corresponded theme when there are multiple design systems.
*/
themeId?: string;
/**
* A theme object. You can provide a function to extend the outer theme.
*/
theme: Partial<Theme> | ((outerTheme: Theme) => Theme);
}
/**
* This component makes the `theme` available down the React tree.
* It should preferably be used at **the root of your component tree**.
* API:
*
* - [ThemeProvider API](https://mui.com/material-ui/customization/theming/#themeprovider)
*/
export default function ThemeProvider<T = DefaultTheme>(props: ThemeProviderProps<T>): React.ReactElement<ThemeProviderProps<T>>;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./ThemeProvider.js";
export * from "./ThemeProvider.js";
+14
View File
@@ -0,0 +1,14 @@
import { PropsFor, borders, SimpleStyleFunction } from "../Box/index.js";
export const border: SimpleStyleFunction<'border'>;
export const borderTop: SimpleStyleFunction<'borderTop'>;
export const borderRight: SimpleStyleFunction<'borderRight'>;
export const borderBottom: SimpleStyleFunction<'borderBottom'>;
export const borderLeft: SimpleStyleFunction<'borderLeft'>;
export const borderColor: SimpleStyleFunction<'borderColor'>;
export const borderTopColor: SimpleStyleFunction<'borderTopColor'>;
export const borderRightColor: SimpleStyleFunction<'borderRightColor'>;
export const borderBottomColor: SimpleStyleFunction<'borderBottomColor'>;
export const borderLeftColor: SimpleStyleFunction<'borderLeftColor'>;
export const borderRadius: SimpleStyleFunction<'borderRadius'>;
export type BordersProps = PropsFor<typeof borders>;
export default borders;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./borders.js";
export * from "./borders.js";
+19
View File
@@ -0,0 +1,19 @@
import { CSSObject } from '@mui/styled-engine';
import { Breakpoints } from "../createBreakpoints/createBreakpoints.js";
import type { Breakpoint } from "../createTheme/index.js";
import { ResponsiveStyleValue } from "../styleFunctionSx/index.js";
import { StyleFunction } from "../Box/index.js";
export interface ResolveBreakpointValuesOptions<T> {
values: ResponsiveStyleValue<T>;
breakpoints?: Breakpoints['values'];
base?: Record<string, boolean>;
}
export function resolveBreakpointValues<T>(options: ResolveBreakpointValuesOptions<T>): Record<string, T>;
export function mergeBreakpointsInOrder(breakpoints: Breakpoints, styles: CSSObject[]): CSSObject;
export function handleBreakpoints<Props>(props: Props, propValue: any, styleFromPropValue: (value: any, breakpoint?: Breakpoint) => any): any;
type DefaultBreakPoints = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
/**
* @returns An enhanced stylefunction that considers breakpoints
*/
export default function breakpoints<Props, Breakpoints extends string = DefaultBreakPoints>(styleFunction: StyleFunction<Props>): StyleFunction<Partial<Record<Breakpoints, Props>> & Props>;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./breakpoints.js";
export * from "./breakpoints.js";
+25
View File
@@ -0,0 +1,25 @@
/* eslint-disable @typescript-eslint/naming-convention */
export type ColorFormat = 'rgb' | 'rgba' | 'hsl' | 'hsla' | 'color';
export interface ColorObject {
type: ColorFormat;
values: [number, number, number] | [number, number, number, number];
colorSpace?: 'srgb' | 'display-p3' | 'a98-rgb' | 'prophoto-rgb' | 'rec-2020';
}
export function hexToRgb(hex: string): string;
export function rgbToHex(color: string): string;
export function hslToRgb(color: string): string;
export function decomposeColor(color: string): ColorObject;
export function colorChannel(color: string): string;
export function private_safeColorChannel(color: string, warning?: string): string;
export function recomposeColor(color: ColorObject): string;
export function getContrastRatio(foreground: string, background: string): number;
export function getLuminance(color: string): number;
export function emphasize(color: string, coefficient?: number): string;
export function private_safeEmphasize(color: string, coefficient?: number, warning?: string): string;
export function alpha(color: string, value: number): string;
export function private_safeAlpha(color: string, value: number, warning?: string): string;
export function darken(color: string, coefficient: number): string;
export function private_safeDarken(color: string, coefficient: number, warning?: string): string;
export function lighten(color: string, coefficient: number): string;
export function private_safeLighten(color: string, coefficient: number, warning?: string): string;
export function blend(background: string, overlay: string, opacity: number, gamma?: number): string;
+1
View File
@@ -0,0 +1 @@
export * from "./colorManipulator.js";
+2
View File
@@ -0,0 +1,2 @@
import { ComposedStyleFunction, StyleFunction } from "../Box/index.js";
export default function compose<T extends Array<StyleFunction<any>>>(...args: T): ComposedStyleFunction<T>;
+1
View File
@@ -0,0 +1 @@
export { default } from "./compose.js";
+9
View File
@@ -0,0 +1,9 @@
import { OverridableComponent } from '@mui/types';
import { BoxTypeMap } from "../Box/index.js";
import { Theme as SystemTheme } from "../createTheme/index.js";
export default function createBox<T extends object = SystemTheme, AdditionalProps extends Record<string, unknown> = {}>(options?: {
themeId?: string;
defaultTheme: T;
defaultClassName?: string;
generateClassName?: (componentName: string) => string;
}): OverridableComponent<BoxTypeMap<AdditionalProps, 'div', T>>;
+1
View File
@@ -0,0 +1 @@
export { default } from "./createBox.js";
@@ -0,0 +1,78 @@
import { OverridableStringUnion } from '@mui/types';
export interface BreakpointOverrides {}
export type Breakpoint = OverridableStringUnion<'xs' | 'sm' | 'md' | 'lg' | 'xl', BreakpointOverrides>;
export const keys: Breakpoint[];
// Keep in sync with docs/src/pages/customization/breakpoints/breakpoints.md
// #host-reference
export interface Breakpoints {
keys: Breakpoint[];
/**
* Each breakpoint (a key) matches with a fixed screen width (a value).
* @default {
* // extra-small
* xs: 0,
* // small
* sm: 600,
* // medium
* md: 900,
* // large
* lg: 1200,
* // extra-large
* xl: 1536,
* }
*/
values: { [key in Breakpoint]: number };
/**
* @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
* @returns A media query string ready to be used with most styling solutions, which matches screen widths greater than the screen size given by the breakpoint key (inclusive).
* @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-up-key-media-query)
*/
up: (key: Breakpoint | number) => string;
/**
* @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
* @returns A media query string ready to be used with most styling solutions, which matches screen widths less than the screen size given by the breakpoint key (exclusive).
* @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-down-key-media-query)
*/
down: (key: Breakpoint | number) => string;
/**
* @param start - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
* @param end - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
* @returns A media query string ready to be used with most styling solutions, which matches screen widths greater than
* the screen size given by the breakpoint key in the first argument (inclusive) and less than the screen size given by the breakpoint key in the second argument (exclusive).
* @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-between-start-end-media-query)
*/
between: (start: Breakpoint | number, end: Breakpoint | number) => string;
/**
* @param key - A breakpoint key (`xs`, `sm`, etc.) or a screen width number in px.
* @returns A media query string ready to be used with most styling solutions, which matches screen widths starting from
* the screen size given by the breakpoint key (inclusive) and stopping at the screen size given by the next breakpoint key (exclusive).
* @see [API documentation](https://mui.com/material-ui/customization/breakpoints/#theme-breakpoints-only-key-media-query)
*/
only: (key: Breakpoint) => string;
/**
* @param key - A breakpoint key (`xs`, `sm`, etc.).
* @returns A media query string ready to be used with most styling solutions, which matches screen widths stopping at
* the screen size given by the breakpoint key (exclusive) and starting at the screen size given by the next breakpoint key (inclusive).
*/
not: (key: Breakpoint) => string;
/**
* The unit used for the breakpoint's values.
* @default 'px'
*/
unit?: string | undefined;
}
export interface BreakpointsOptions extends Partial<Breakpoints> {
/**
* The increment divided by 100 used to implement exclusive breakpoints.
* For example, `step: 5` means that `down(500)` will result in `'(max-width: 499.95px)'`.
* @default 5
*/
step?: number | undefined;
/**
* The unit used for the breakpoint's values.
* @default 'px'
*/
unit?: string | undefined;
}
export default function createBreakpoints(options: BreakpointsOptions): Breakpoints;
+3
View File
@@ -0,0 +1,3 @@
/** This export is intended for internal integration with Pigment CSS */
/* eslint-disable import/prefer-default-export */
export { default as unstable_createBreakpoints } from "./createBreakpoints.js";
+27
View File
@@ -0,0 +1,27 @@
import * as React from 'react';
import { CreateMUIStyled as CreateMUIStyledStyledEngine, CSSInterpolation } from '@mui/styled-engine';
import styleFunctionSx, { SxProps } from "../styleFunctionSx/index.js";
import { Theme as DefaultTheme } from "../createTheme/index.js";
export function shouldForwardProp(propName: PropertyKey): boolean;
export interface MUIStyledCommonProps<Theme extends object = DefaultTheme> {
theme?: Theme;
as?: React.ElementType;
sx?: SxProps<Theme>;
}
export interface MuiStyledOptions {
name?: string;
slot?: string;
// The difference between Interpolation and CSSInterpolation is that the former supports functions based on props
// If we want to support props in the overrides, we will need to change the CSSInterpolation to Interpolation<Props>
overridesResolver?: (props: any, styles: Record<string, CSSInterpolation>) => CSSInterpolation;
skipVariantsResolver?: boolean;
skipSx?: boolean;
}
export type CreateMUIStyled<Theme extends object = DefaultTheme> = CreateMUIStyledStyledEngine<MUIStyledCommonProps<Theme>, MuiStyledOptions, Theme>;
export default function createStyled<Theme extends object = DefaultTheme>(options?: {
themeId?: string;
defaultTheme?: Theme;
rootShouldForwardProp?: (prop: PropertyKey) => boolean;
slotShouldForwardProp?: (prop: PropertyKey) => boolean;
styleFunctionSx?: typeof styleFunctionSx;
}): CreateMUIStyled<Theme>;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./createStyled.js";
export * from "./createStyled.js";
+67
View File
@@ -0,0 +1,67 @@
import { CSSObject } from '@mui/styled-engine';
export interface ApplyStyles<K extends string> {
(key: K, styles: CSSObject): CSSObject;
}
/**
* A universal utility to style components with multiple color modes. Always use it from the theme object.
* It works with:
* - [Basic theme](https://mui.com/material-ui/customization/dark-mode/)
* - [CSS theme variables](https://mui.com/material-ui/customization/css-theme-variables/overview/)
* - Zero-runtime engine
*
* Tips: Use an array over object spread and place `theme.applyStyles()` last.
*
* With the styled function:
* ✅ [{ background: '#e5e5e5' }, theme.applyStyles('dark', { background: '#1c1c1c' })]
* 🚫 { background: '#e5e5e5', ...theme.applyStyles('dark', { background: '#1c1c1c' })}
*
* With the sx prop:
* ✅ [{ background: '#e5e5e5' }, theme => theme.applyStyles('dark', { background: '#1c1c1c' })]
* 🚫 { background: '#e5e5e5', ...theme => theme.applyStyles('dark', { background: '#1c1c1c' })}
*
* @example
* 1. using with `styled`:
* ```jsx
* const Component = styled('div')(({ theme }) => [
* { background: '#e5e5e5' },
* theme.applyStyles('dark', {
* background: '#1c1c1c',
* color: '#fff',
* }),
* ]);
* ```
*
* @example
* 2. using with `sx` prop:
* ```jsx
* <Box sx={[
* { background: '#e5e5e5' },
* theme => theme.applyStyles('dark', {
* background: '#1c1c1c',
* color: '#fff',
* }),
* ]}
* />
* ```
*
* @example
* 3. theming a component:
* ```jsx
* extendTheme({
* components: {
* MuiButton: {
* styleOverrides: {
* root: ({ theme }) => [
* { background: '#e5e5e5' },
* theme.applyStyles('dark', {
* background: '#1c1c1c',
* color: '#fff',
* }),
* ],
* },
* }
* }
* })
*```
*/
export default function applyStyles<K extends string>(key: K, styles: CSSObject): CSSObject;
+10
View File
@@ -0,0 +1,10 @@
export type SpacingOptions = number | string | Spacing | ((abs: number) => number | string) | ((abs: number | string) => number | string) | ReadonlyArray<string | number>;
export type SpacingArgument = number | string;
export interface Spacing {
(): string;
(value: SpacingArgument): string;
(topBottom: SpacingArgument, rightLeft: SpacingArgument): string;
(top: SpacingArgument, rightLeft: SpacingArgument, bottom: SpacingArgument): string;
(top: SpacingArgument, right: SpacingArgument, bottom: SpacingArgument, left: SpacingArgument): string;
}
export default function createSpacing(spacingInput?: SpacingOptions, transform?: Spacing | (() => undefined) | ((abs: number | string) => number | number)): Spacing;
+54
View File
@@ -0,0 +1,54 @@
import { CSSObject } from '@mui/styled-engine';
import { Breakpoints, BreakpointsOptions } from "../createBreakpoints/createBreakpoints.js";
import { Shape, ShapeOptions } from "./shape.js";
import { Spacing, SpacingOptions } from "./createSpacing.js";
import { SxConfig, SxProps } from "../styleFunctionSx/index.js";
import { ApplyStyles } from "./applyStyles.js";
import { CssContainerQueries } from "../cssContainerQueries/index.js";
export { Breakpoint, Breakpoints, BreakpointOverrides } from "../createBreakpoints/createBreakpoints.js";
export type Direction = 'ltr' | 'rtl';
export interface Typography {}
export interface Mixins {}
export interface Shadows {}
export interface Transitions {}
export interface ZIndex {}
export interface ThemeOptions {
shape?: ShapeOptions;
breakpoints?: BreakpointsOptions;
direction?: Direction;
mixins?: Mixins;
palette?: Record<string, any>;
shadows?: Shadows;
spacing?: SpacingOptions;
transitions?: Transitions;
components?: Record<string, any>;
typography?: Typography;
zIndex?: ZIndex;
unstable_sxConfig?: SxConfig;
}
export interface Theme extends CssContainerQueries {
shape: Shape;
breakpoints: Breakpoints;
direction: Direction;
palette: Record<string, any> & {
mode: 'light' | 'dark';
};
shadows?: Shadows;
spacing: Spacing;
transitions?: Transitions;
components?: Record<string, any>;
mixins?: Mixins;
typography?: Typography;
zIndex?: ZIndex;
applyStyles: ApplyStyles<'light' | 'dark'>;
unstable_sxConfig: SxConfig;
unstable_sx: (props: SxProps<Theme>) => CSSObject;
}
/**
* Generate a theme base on the options received.
* @param options Takes an incomplete theme object and adds the missing parts.
* @param args Deep merge the arguments with the about to be returned theme.
* @returns A complete, ready-to-use theme object.
*/
export default function createTheme(options?: ThemeOptions, ...args: object[]): Theme;
+4
View File
@@ -0,0 +1,4 @@
export { default } from "./createTheme.js";
export * from "./createTheme.js";
export { default as unstable_applyStyles } from "./applyStyles.js";
export * from "./applyStyles.js";
+6
View File
@@ -0,0 +1,6 @@
export interface Shape {
borderRadius: number;
}
export type ShapeOptions = Partial<Shape>;
declare const shape: Shape;
export default shape;
@@ -0,0 +1,23 @@
import { Breakpoints } from "../createBreakpoints/createBreakpoints.js";
export interface ContainerQueries {
up: Breakpoints['up'];
down: Breakpoints['down'];
between: Breakpoints['between'];
only: Breakpoints['only'];
not: Breakpoints['not'];
}
export interface CssContainerQueries {
containerQueries: ((name: string) => ContainerQueries) & ContainerQueries;
}
/**
* For using in `sx` prop to sort the breakpoint from low to high.
* Note: this function does not work and will not support multiple units.
* e.g. input: { '@container (min-width:300px)': '1rem', '@container (min-width:40rem)': '2rem' }
* output: { '@container (min-width:40rem)': '2rem', '@container (min-width:300px)': '1rem' } // since 40 < 300 eventhough 40rem > 300px
*/
export declare function sortContainerQueries(theme: Partial<CssContainerQueries>, css: Record<string, any>): Record<string, any>;
export declare function isCqShorthand(breakpointKeys: string[], value: string): boolean;
export declare function getContainerQuery(theme: CssContainerQueries, shorthand: string): string | null;
export default function cssContainerQueries<T extends {
breakpoints: Breakpoints;
}>(themeInput: T): T & CssContainerQueries;
+3
View File
@@ -0,0 +1,3 @@
export { default } from "./cssContainerQueries.js";
export { isCqShorthand, getContainerQuery, sortContainerQueries } from "./cssContainerQueries.js";
export type { CssContainerQueries } from "./cssContainerQueries.js";
+15
View File
@@ -0,0 +1,15 @@
import { PropsFor, grid, SimpleStyleFunction } from "../Box/index.js";
export const gap: SimpleStyleFunction<'gap'>;
export const columnGap: SimpleStyleFunction<'columnGap'>;
export const rowGap: SimpleStyleFunction<'rowGap'>;
export const gridColumn: SimpleStyleFunction<'gridColumn'>;
export const gridRow: SimpleStyleFunction<'gridRow'>;
export const gridAutoFlow: SimpleStyleFunction<'gridAutoFlow'>;
export const gridAutoColumns: SimpleStyleFunction<'gridAutoColumns'>;
export const gridAutoRows: SimpleStyleFunction<'gridAutoRows'>;
export const gridTemplateColumns: SimpleStyleFunction<'gridTemplateColumns'>;
export const gridTemplateRows: SimpleStyleFunction<'gridTemplateRows'>;
export const gridTemplateAreas: SimpleStyleFunction<'gridTemplateAreas'>;
export const gridArea: SimpleStyleFunction<'gridArea'>;
export type CssGridProps = PropsFor<typeof grid>;
export default grid;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./cssGrid.js";
export * from "./cssGrid.js";
+141
View File
@@ -0,0 +1,141 @@
import * as React from 'react';
import InitColorSchemeScript from "../InitColorSchemeScript/index.js";
import { Result } from "./useCurrentColorScheme.js";
import type { StorageManager } from "./localStorageManager.js";
export interface ColorSchemeContextValue<SupportedColorScheme extends string> extends Result<SupportedColorScheme> {
allColorSchemes: SupportedColorScheme[];
}
export interface CssVarsProviderConfig<ColorScheme extends string> {
/**
* DOM attribute for applying color scheme
* @default 'data-color-scheme'
*/
attribute?: string;
/**
* localStorage key used to store application `mode`
* @default 'mode'
*/
modeStorageKey?: string;
/**
* localStorage key used to store `colorScheme`
* @default 'color-scheme'
*/
colorSchemeStorageKey?: string;
/**
* Design system default color scheme.
* - provides string if the design system has one default color scheme (either light or dark)
* - provides object if the design system has default light & dark color schemes
*/
defaultColorScheme: ColorScheme | {
light: ColorScheme;
dark: ColorScheme;
};
/**
* Disable CSS transitions when switching between modes or color schemes
* @default false
*/
disableTransitionOnChange?: boolean;
/**
* If `true`, theme values are recalculated when the mode changes.
* The `theme.colorSchemes.{mode}.*` nodes will be shallow merged to the top-level of the theme.
* @default false
*/
forceThemeRerender?: boolean;
}
type Identify<I extends string | undefined, T> = I extends string ? T | { [k in I]: T } : T;
export interface CreateCssVarsProviderResult<ColorScheme extends string, Identifier extends string | undefined = undefined> {
CssVarsProvider: (props: React.PropsWithChildren<Partial<CssVarsProviderConfig<ColorScheme>> & {
theme?: Identify<Identifier, {
cssVariables?: false;
cssVarPrefix?: string;
colorSchemes: Partial<Record<ColorScheme, any>>;
colorSchemeSelector?: 'media' | 'class' | 'data' | string;
}>;
/**
* The default mode when the storage is empty,
* require the theme to have `colorSchemes` with light and dark.
* @default 'system'
*/
defaultMode?: 'light' | 'dark' | 'system';
/**
* The document used to perform `disableTransitionOnChange` feature
* @default document
*/
documentNode?: Document | null;
/**
* The node used to attach the color-scheme attribute
* @default document
*/
colorSchemeNode?: Element | null;
/**
* The storage manager to be used for storing the mode and color scheme.
* @default using `window.localStorage`
*/
storageManager?: StorageManager | null;
/**
* The window that attaches the 'storage' event listener
* @default window
*/
storageWindow?: Window | null;
/**
* If `true`, the provider creates its own context and generate stylesheet as if it is a root `CssVarsProvider`.
*/
disableNestedContext?: boolean;
/**
* If `true`, the style sheet won't be generated.
*
* This is useful for controlling nested CssVarsProvider behavior.
* @default false
*/
disableStyleSheetGeneration?: boolean;
}>) => React.JSX.Element;
useColorScheme: () => ColorSchemeContextValue<ColorScheme>;
getInitColorSchemeScript: typeof InitColorSchemeScript;
}
export default function createCssVarsProvider<ColorScheme extends string, Identifier extends string | undefined = undefined>(options: CssVarsProviderConfig<ColorScheme> & {
/**
* The design system's unique id for getting the corresponded theme when there are multiple design systems.
*/
themeId?: Identifier;
/**
* Design system default theme
*
* - The structure inside `theme.colorSchemes[colorScheme]` should be exactly the same in all color schemes because
* those object of the color scheme will be used when the color scheme is active.
*
* {
* colorSchemes: {
* light: { ...lightColorSchemeValues },
* dark: { ...darkColorSchemeValues }
* }
* }
*
* - If colorScheme is 'light', the `lightColorSchemeValues` will be merged to theme as `{ ...theme, ...lightColorSchemeValues }`
* likewise, if colorScheme is 'dark', the `darkColorSchemeValues` will be merged to theme as `{ ...theme, ...darkColorSchemeValues }`
*
* - If the theme contains the same keys as the color scheme, their values will be merged.
* Ex. {
* colorSchemes: {
* light: { palette: { primary: { ... } } },
* dark: { palette: { primary: { ...} } }
* },
* palette: { shared: { ... } }
* }
*
* becomes: {
* colorSchemes: { ... },
* palette: { shared: { ... }, primary: { ... } }
* }
*/
theme: any;
/**
* A function to be called after the CSS variables are attached. The result of this function will be the final theme pass to ThemeProvider.
*
* The example usage is the variant generation in Joy. We need to combine the token from user-input and the default theme first, then generate
* variants from those tokens.
*/
resolveTheme?: (theme: any) => any; // the type is any because it depends on the design system.
}): CreateCssVarsProviderResult<ColorScheme, Identifier>;
// disable automatic export
export {};
+15
View File
@@ -0,0 +1,15 @@
import { DefaultCssVarsTheme } from "./prepareCssVars.js";
interface Theme extends DefaultCssVarsTheme {
cssVarPrefix?: string;
colorSchemeSelector?: 'media' | string;
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
}
declare function createCssVarsTheme<T extends Theme, ThemeVars extends Record<string, any>>({
colorSchemeSelector,
...theme
}: T): T & {
vars: ThemeVars;
generateThemeVars: () => ThemeVars;
generateStyleSheets: () => Record<string, any>[];
};
export default createCssVarsTheme;
+5
View File
@@ -0,0 +1,5 @@
/**
* The benefit of this function is to help developers get CSS var from theme without specifying the whole variable
* and they does not need to remember the prefix (defined once).
*/
export default function createGetCssVar<T extends string = string>(prefix?: string): <AdditionalVars extends string = never>(field: T | AdditionalVars, ...fallbacks: (T | AdditionalVars)[]) => string;
+64
View File
@@ -0,0 +1,64 @@
type NestedRecord<V = any> = {
[k: string | number]: NestedRecord<V> | V;
};
/**
* This function create an object from keys, value and then assign to target
*
* @param {Object} obj : the target object to be assigned
* @param {string[]} keys
* @param {string | number} value
*
* @example
* const source = {}
* assignNestedKeys(source, ['palette', 'primary'], 'var(--palette-primary)')
* console.log(source) // { palette: { primary: 'var(--palette-primary)' } }
*
* @example
* const source = { palette: { primary: 'var(--palette-primary)' } }
* assignNestedKeys(source, ['palette', 'secondary'], 'var(--palette-secondary)')
* console.log(source) // { palette: { primary: 'var(--palette-primary)', secondary: 'var(--palette-secondary)' } }
*/
export declare const assignNestedKeys: <T extends Record<string, any> | null | undefined | string = NestedRecord, Value = any>(obj: T, keys: Array<string>, value: Value, arrayKeys?: Array<string>) => void;
/**
*
* @param {Object} obj : source object
* @param {Function} callback : a function that will be called when
* - the deepest key in source object is reached
* - the value of the deepest key is NOT `undefined` | `null`
*
* @example
* walkObjectDeep({ palette: { primary: { main: '#000000' } } }, console.log)
* // ['palette', 'primary', 'main'] '#000000'
*/
export declare const walkObjectDeep: <Value, T = Record<string, any>>(obj: T, callback: (keys: Array<string>, value: Value, arrayKeys: Array<string>) => void, shouldSkipPaths?: (keys: Array<string>) => boolean) => void;
/**
* a function that parse theme and return { css, vars }
*
* @param {Object} theme
* @param {{
* prefix?: string,
* shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean
* }} options.
* `prefix`: The prefix of the generated CSS variables. This function does not change the value.
*
* @returns {{ css: Object, vars: Object }} `css` is the stylesheet, `vars` is an object to get css variable (same structure as theme).
*
* @example
* const { css, vars } = parser({
* fontSize: 12,
* lineHeight: 1.2,
* palette: { primary: { 500: 'var(--color)' } }
* }, { prefix: 'foo' })
*
* console.log(css) // { '--foo-fontSize': '12px', '--foo-lineHeight': 1.2, '--foo-palette-primary-500': 'var(--color)' }
* console.log(vars) // { fontSize: 'var(--foo-fontSize)', lineHeight: 'var(--foo-lineHeight)', palette: { primary: { 500: 'var(--foo-palette-primary-500)' } } }
*/
export default function cssVarsParser<T extends Record<string, any>>(theme: Record<string, any>, options?: {
prefix?: string;
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
}): {
css: Record<string, string | number>;
vars: T;
varsWithDefaults: {};
};
export {};
+1
View File
@@ -0,0 +1 @@
export declare function createGetColorSchemeSelector<T extends string>(selector: 'media' | 'class' | 'data' | string): (colorScheme: T) => string;
+8
View File
@@ -0,0 +1,8 @@
export { default } from "./createCssVarsProvider.js";
export type { CreateCssVarsProviderResult, CssVarsProviderConfig, ColorSchemeContextValue } from "./createCssVarsProvider.js";
export { default as prepareCssVars } from "./prepareCssVars.js";
export { default as prepareTypographyVars } from "./prepareTypographyVars.js";
export type { ExtractTypographyTokens } from "./prepareTypographyVars.js";
export { default as createCssVarsTheme } from "./createCssVarsTheme.js";
export { createGetColorSchemeSelector } from "./getColorSchemeSelector.js";
export type { StorageManager } from "./localStorageManager.js";
+34
View File
@@ -0,0 +1,34 @@
export interface StorageManager {
(options: {
key: string;
storageWindow?: Window | null;
}): {
/**
* Function to get the value from the storage
* @param defaultValue The default value to be returned if the key is not found
* @returns The value from the storage or the default value
*/
get(defaultValue: any): any;
/**
* Function to set the value in the storage
* @param value The value to be set
* @returns void
*/
set(value: any): void;
/**
* Function to subscribe to the value of the specified key triggered by external events
* @param handler The function to be called when the value changes
* @returns A function to unsubscribe the handler
* @example
* React.useEffect(() => {
* const unsubscribe = storageManager.subscribe((value) => {
* console.log(value);
* });
* return unsubscribe;
* }, []);
*/
subscribe(handler: (value: any) => void): () => void;
};
}
declare const localStorageManager: StorageManager;
export default localStorageManager;
+16
View File
@@ -0,0 +1,16 @@
export interface DefaultCssVarsTheme {
colorSchemes?: Record<string, any>;
defaultColorScheme?: string;
}
declare function prepareCssVars<T extends DefaultCssVarsTheme, ThemeVars extends Record<string, any>>(theme: T, parserConfig?: {
prefix?: string;
colorSchemeSelector?: 'media' | 'class' | 'data' | string;
disableCssColorScheme?: boolean;
shouldSkipGeneratingVar?: (objectPathKeys: Array<string>, value: string | number) => boolean;
getSelector?: (colorScheme: keyof T['colorSchemes'] | undefined, css: Record<string, any>) => string | Record<string, any>;
}): {
vars: ThemeVars;
generateThemeVars: () => ThemeVars;
generateStyleSheets: () => Record<string, any>[];
};
export default prepareCssVars;
+4
View File
@@ -0,0 +1,4 @@
type RecordPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? never : T[K] extends Record<string, any> ? K : never }[keyof T];
export type ExtractTypographyTokens<T> = { [K in RecordPropertyNames<T>]: string };
export default function prepareTypographyVars<T extends Record<string, any>>(typography: T): ExtractTypographyTokens<T>;
export {};
+56
View File
@@ -0,0 +1,56 @@
import type { StorageManager } from "./localStorageManager.js";
export type Mode = 'light' | 'dark' | 'system';
export type SystemMode = Exclude<Mode, 'system'>;
export interface State<SupportedColorScheme extends string> {
/**
* User selected mode.
* Note: on the server, mode is always undefined
*/
mode: 'light' | 'dark' | 'system' | undefined;
/**
* Only valid if `mode: 'system'`, either 'light' | 'dark'.
*/
systemMode: 'light' | 'dark' | undefined;
/**
* The color scheme for the light mode.
*/
lightColorScheme: SupportedColorScheme;
/**
* The color scheme for the dark mode.
*/
darkColorScheme: SupportedColorScheme;
}
export type Result<SupportedColorScheme extends string> = State<SupportedColorScheme> & {
/**
* The current application color scheme. It is always `undefined` on the server.
*/
colorScheme: SupportedColorScheme | undefined;
/**
* `mode` is saved to internal state and localStorage
* If `mode` is null, it will be reset to the defaultMode
*/
setMode: (mode: Mode | null) => void;
/**
* `colorScheme` is saved to internal state and localStorage
* If `colorScheme` is null, it will be reset to the defaultColorScheme (light | dark)
*/
setColorScheme: (colorScheme: SupportedColorScheme | Partial<{
light: SupportedColorScheme | null;
dark: SupportedColorScheme | null;
}> | null) => void;
};
export declare function getSystemMode(mode: undefined | string): SystemMode | undefined;
export declare function getColorScheme<SupportedColorScheme extends string>(state: State<SupportedColorScheme>): SupportedColorScheme | undefined;
interface UseCurrentColoSchemeOptions<SupportedColorScheme extends string> {
defaultLightColorScheme: SupportedColorScheme;
defaultDarkColorScheme: SupportedColorScheme;
supportedColorSchemes: Array<SupportedColorScheme>;
defaultMode?: Mode;
modeStorageKey?: string;
colorSchemeStorageKey?: string;
storageWindow?: Window | null;
storageManager?: StorageManager | null;
noSsr?: boolean;
}
export default function useCurrentColorScheme<SupportedColorScheme extends string>(options: UseCurrentColoSchemeOptions<SupportedColorScheme>): Result<SupportedColorScheme>;
export {};
+3
View File
@@ -0,0 +1,3 @@
import { PropsFor, display } from "../Box/index.js";
export type DisplayProps = PropsFor<typeof display>;
export default display;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./display.js";
export * from "./display.js";
+3
View File
@@ -0,0 +1,3 @@
import { PropsFor, flexbox } from "../Box/index.js";
export type FlexboxProps = PropsFor<typeof flexbox>;
export default flexbox;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./flexbox.js";
export * from "./flexbox.js";
+1
View File
@@ -0,0 +1 @@
export default function getThemeValue(prop: string, value: any, theme: object): any;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./getThemeValue.js";
export * from "./getThemeValue.js";
+80
View File
@@ -0,0 +1,80 @@
// disable automatic export
export {};
export * from "./borders/index.js";
export { default as breakpoints, handleBreakpoints, mergeBreakpointsInOrder } from "./breakpoints/index.js";
export { default as cssContainerQueries, type CssContainerQueries } from "./cssContainerQueries/index.js";
export { default as compose } from "./compose/index.js";
export * from "./display/index.js";
export * from "./flexbox/index.js";
export * from "./cssGrid/index.js";
export * from "./palette/index.js";
export * from "./positions/index.js";
export * from "./shadows/index.js";
export * from "./sizing/index.js";
export * from "./typography/index.js";
export { default as unstable_getThemeValue } from "./getThemeValue/index.js";
/**
* The `css` function accepts arrays as values for mobile-first responsive styles.
* Note that this extends to non-theme values also. For example `display=['none', 'block']`
* will also works.
*/
export type ResponsiveStyleValue<T> = T | Array<T | null> | {
[key: string]: T | null;
};
export { DefaultTheme } from '@mui/private-theming';
export { css, keyframes, StyledEngineProvider, Interpolation, CSSInterpolation, CSSObject } from '@mui/styled-engine';
export { default as GlobalStyles } from "./GlobalStyles/index.js";
export type { GlobalStylesProps } from "./GlobalStyles/index.js";
export * from "./style/index.js";
export { default as style } from "./style/index.js";
export * from "./spacing/index.js";
export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp, unstable_defaultSxConfig } from "./styleFunctionSx/index.js";
export * from "./styleFunctionSx/index.js";
// TODO: Remove this function in v6.
// eslint-disable-next-line @typescript-eslint/naming-convention
export function experimental_sx(): any;
export { default as Box } from "./Box/index.js";
export * from "./Box/index.js";
export { default as createBox } from "./createBox/index.js";
export * from "./createBox/index.js";
export { default as createStyled } from "./createStyled/index.js";
export * from "./createStyled/index.js";
export { default as styled } from "./styled/index.js";
export * from "./styled/index.js";
export { default as createTheme } from "./createTheme/index.js";
export * from "./createTheme/index.js";
export { default as createBreakpoints } from "./createBreakpoints/createBreakpoints.js";
export * from "./createBreakpoints/createBreakpoints.js";
export { default as createSpacing } from "./createTheme/createSpacing.js";
export { SpacingOptions, Spacing } from "./createTheme/createSpacing.js";
export { default as shape } from "./createTheme/shape.js";
export * from "./createTheme/shape.js";
export { default as useThemeProps, getThemeProps } from "./useThemeProps/index.js";
export { default as useTheme } from "./useTheme/index.js";
export * from "./useTheme/index.js";
export { default as useThemeWithoutDefault } from "./useThemeWithoutDefault/index.js";
export * from "./useThemeWithoutDefault/index.js";
export { default as useMediaQuery } from "./useMediaQuery/index.js";
export * from "./useMediaQuery/index.js";
export * from "./colorManipulator/index.js";
export { default as ThemeProvider } from "./ThemeProvider/index.js";
export * from "./ThemeProvider/index.js";
export { default as unstable_memoTheme } from "./memoTheme.js";
export { default as unstable_createCssVarsProvider, CreateCssVarsProviderResult } from "./cssVars/index.js";
export { default as unstable_createGetCssVar } from "./cssVars/createGetCssVar.js";
export { default as unstable_cssVarsParser } from "./cssVars/cssVarsParser.js";
export { default as unstable_prepareCssVars } from "./cssVars/prepareCssVars.js";
export { default as unstable_createCssVarsTheme } from "./cssVars/createCssVarsTheme.js";
export * from "./cssVars/index.js";
export { default as responsivePropType } from "./responsivePropType/index.js";
export { default as createContainer } from "./Container/createContainer.js";
export * from "./Container/createContainer.js";
export { default as Container } from "./Container/index.js";
export * from "./Container/index.js";
export { default as Grid } from "./Grid/index.js";
export * from "./Grid/index.js";
export { default as Stack } from "./Stack/index.js";
export * from "./Stack/index.js";
export * from "./version/index.js";
+12
View File
@@ -0,0 +1,12 @@
import { CSSInterpolation } from '@mui/styled-engine';
type ThemeStyleFunction<T> = (props: {
theme: T;
}) => CSSInterpolation;
/**
* Memoize style function on theme.
* Intended to be used in styled() calls that only need access to the theme.
*/
export default function unstable_memoTheme<T>(styleFn: ThemeStyleFunction<T>): (props: {
theme: T;
}) => string | number | boolean | import("@mui/styled-engine").ComponentSelector | import("@mui/styled-engine").Keyframes | import("@mui/styled-engine").SerializedStyles | import("@mui/styled-engine").CSSObject | import("@mui/styled-engine").ArrayCSSInterpolation | null;
export {};
+1
View File
@@ -0,0 +1 @@
export { default } from "./memoize.js";
+1
View File
@@ -0,0 +1 @@
export default function memoize<ArgType = any, ReturnType = any>(fn: (arg: ArgType) => ReturnType): (arg: ArgType) => ReturnType;
+1
View File
@@ -0,0 +1 @@
export { default } from "./merge.js";
+1
View File
@@ -0,0 +1 @@
export default function merge(acc: object, item: object): object;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./palette.js";
export * from "./palette.js";
+5
View File
@@ -0,0 +1,5 @@
import { PropsFor, SimpleStyleFunction, palette } from "../Box/index.js";
export const color: SimpleStyleFunction<'color'>;
export const bgcolor: SimpleStyleFunction<'bgcolor'>;
export type PaletteProps = PropsFor<typeof palette>;
export default palette;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./positions.js";
export * from "./positions.js";
+3
View File
@@ -0,0 +1,3 @@
import { PropsFor, positions } from "../Box/index.js";
export type PositionsProps = PropsFor<typeof positions>;
export default positions;
+5
View File
@@ -0,0 +1,5 @@
export default function preprocessStyles(input: any): {
variants: any;
style: any;
isProcessed: boolean;
};
+1
View File
@@ -0,0 +1 @@
export { default } from "./propsToClassKey.js";
+1
View File
@@ -0,0 +1 @@
export default function propsToClassKey(props: object): string;
+1
View File
@@ -0,0 +1 @@
export { default } from "./responsivePropType.js";
@@ -0,0 +1,2 @@
declare const responsivePropType: object;
export default responsivePropType;
+1
View File
@@ -0,0 +1 @@
export { default } from "./shadows.js";
+3
View File
@@ -0,0 +1,3 @@
import { PropsFor, shadows } from "../Box/index.js";
export type ShadowsProps = PropsFor<typeof shadows>;
export default shadows;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./sizing.js";
export * from "./sizing.js";
+12
View File
@@ -0,0 +1,12 @@
import { PropsFor, SimpleStyleFunction, sizing } from "../Box/index.js";
export const width: SimpleStyleFunction<'width'>;
export const maxWidth: SimpleStyleFunction<'maxWidth'>;
export const minWidth: SimpleStyleFunction<'minWidth'>;
export const height: SimpleStyleFunction<'height'>;
export const maxHeight: SimpleStyleFunction<'maxHeight'>;
export const minHeight: SimpleStyleFunction<'minHeight'>;
export const sizeWidth: SimpleStyleFunction<'sizeWidth'>;
export const sizeHeight: SimpleStyleFunction<'sizeHeight'>;
export const boxSizing: SimpleStyleFunction<'boxSizing'>;
export type SizingProps = PropsFor<typeof sizing>;
export default sizing;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./spacing.js";
export * from "./spacing.js";
+19
View File
@@ -0,0 +1,19 @@
import { SimpleStyleFunction, spacing, PropsFor } from "../Box/index.js";
export type SpacingValueType = string | number | null | undefined;
export type SpacingProps = PropsFor<typeof spacing>;
export function createUnarySpacing<Spacing>(theme: {
spacing: Spacing;
}): Spacing extends number ? (abs: number | string) => number | number : Spacing extends any[] ? <Index extends number>(abs: Index | string) => Spacing[Index] | string : Spacing extends ((...args: unknown[]) => unknown) ? Spacing :
// warns in Dev
() => undefined;
export function createUnaryUnit<Spacing>(theme: {
spacing: Spacing;
}, themeKey: string, defaultValue: Spacing, propName: string): Spacing extends number ? (abs: SpacingValueType) => number | number : Spacing extends any[] ? <Index extends number>(abs: Index | string) => Spacing[Index] | string : Spacing extends ((...args: unknown[]) => unknown) ? Spacing :
// warns in Dev
() => undefined;
export const margin: SimpleStyleFunction<'m' | 'mt' | 'mr' | 'mb' | 'ml' | 'mx' | 'my' | 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft' | 'marginX' | 'marginY' | 'marginInline' | 'marginInlineStart' | 'marginInlineEnd' | 'marginBlock' | 'marginBlockStart' | 'marginBlockEnd'>;
export type MarginProps = PropsFor<typeof margin>;
export const padding: SimpleStyleFunction<'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'paddingX' | 'paddingY' | 'paddingInline' | 'paddingInlineStart' | 'paddingInlineEnd' | 'paddingBlock' | 'paddingBlockStart' | 'paddingBlockEnd'>;
export function getValue(transformer: (prop: SpacingValueType) => SpacingValueType, propValue: SpacingValueType): SpacingValueType;
export type PaddingProps = PropsFor<typeof padding>;
export default spacing;
+2
View File
@@ -0,0 +1,2 @@
export { default } from "./style.js";
export * from "./style.js";
+19
View File
@@ -0,0 +1,19 @@
import { CSSObject } from '@mui/styled-engine';
import { StyleFunction } from "../Box/index.js";
export type TransformFunction = (cssValue: unknown, userValue: unknown) => number | string | React.CSSProperties | CSSObject;
export interface StyleOptions<PropKey> {
cssProperty?: PropKey | keyof React.CSSProperties | false;
prop: PropKey;
/**
* dot access in `Theme`
*/
themeKey?: string;
transform?: TransformFunction;
}
export function getPath<T>(obj: T, path: string | undefined, checkVars?: boolean): null | unknown;
export function getStyleValue(themeMapping: object | ((arg: any) => any), transform: TransformFunction | null, propValueFinal: unknown, userValue?: unknown): any;
export default function style<PropKey extends string, Theme extends object>(options: StyleOptions<PropKey>): StyleFunction<{ [K in PropKey]?: unknown } & {
theme?: Theme;
}> & {
filterProps: string[];
};
@@ -0,0 +1,269 @@
import { StandardCSSProperties } from "./StandardCssProperties.js";
export interface AliasesCSSProperties {
/**
* The **`background-color`** CSS property sets the background color of an element.
*
* **Initial value**: `transparent`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/background-color
*/
bgcolor?: StandardCSSProperties['backgroundColor'];
/**
* The **`margin`** CSS property sets the margin on all four sides of an element. It is a shorthand for `margin-top`, `margin-right`, `margin-bottom`, and `margin-left`.
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **3** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/margin
*/
m?: StandardCSSProperties['margin'];
/**
* The **`margin-top`** CSS property sets the margin on the top of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **3** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/margin-top
*/
mt?: StandardCSSProperties['marginTop'];
/**
* The **`margin-right`** CSS property sets the margin on the right side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **3** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/margin-right
*/
mr?: StandardCSSProperties['marginRight'];
/**
* The **`margin-bottom`** CSS property sets the margin on the bottom of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **3** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/margin-bottom
*/
mb?: StandardCSSProperties['marginBottom'];
/**
* The **`margin-left`** CSS property sets the margin on the left side of an element. A positive value places it farther from its neighbors, while a negative value places it closer.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **3** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/margin-left
*/
ml?: StandardCSSProperties['marginLeft'];
/**
* The **`mx`** property is shorthand for using both **`margin-left`** and **`margin-right`** CSS properties. They set the margin on the left and right side of an element. A positive value places it
* farther from its neighbors, while a negative value places it closer.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **3** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/margin-left
* @see https://developer.mozilla.org/docs/Web/CSS/margin-right
*/
mx?: StandardCSSProperties['marginLeft'];
/**
* The **`marginX`** property is shorthand for using both **`margin-left`** and **`margin-right`** CSS properties. They set the margin on the left and right side of an element. A positive value
* places it farther from its neighbors, while a negative value places it closer.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **3** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/margin-left
* @see https://developer.mozilla.org/docs/Web/CSS/margin-right
*/
marginX?: StandardCSSProperties['marginLeft'];
/**
* The **`my`** property is shorthand for using both **`margin-top`** and **`margin-bottom`** CSS properties. They set the margin on the top and bottom of an element. A positive value places it
* farther from its neighbors, while a negative value places it closer.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **3** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/margin-top
* @see https://developer.mozilla.org/docs/Web/CSS/margin-bottom
*/
my?: StandardCSSProperties['marginTop'];
/**
* The **`marginY`** property is shorthand for using both **`margin-top`** and **`margin-bottom`** CSS properties. They set the margin on the top and bottom of an element. A positive value places
* it farther from its neighbors, while a negative value places it closer.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **3** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/margin-top
* @see https://developer.mozilla.org/docs/Web/CSS/margin-bottom
*/
marginY?: StandardCSSProperties['marginTop'];
/**
* The **`padding`** CSS property sets the padding on all four sides of an element. It is a shorthand for `padding-top`, `padding-right`, `padding-bottom`, and `padding-left`.
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/padding
*/
p?: StandardCSSProperties['padding'];
/**
* The **`padding-top`** CSS property sets the height of the padding at the top of an element.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/padding-top
*/
pt?: StandardCSSProperties['paddingTop'];
/**
* The **`padding-right`** CSS property sets the width of the padding at the right side of an element.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/padding-right
*/
pr?: StandardCSSProperties['paddingRight'];
/**
* The **`padding-bottom`** CSS property sets the height of the padding on the bottom of an element.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/padding-bottom
*/
pb?: StandardCSSProperties['paddingBottom'];
/**
* The **`padding-left`** CSS property sets the width of the padding at the left side of an element.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/padding-left
*/
pl?: StandardCSSProperties['paddingLeft'];
/**
* The **`px`** property is shorthand for the CSS properties **`padding-left`** and **`padding-right`**. They set the width of the padding at the left and right side of an element.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/padding-left
* @see https://developer.mozilla.org/docs/Web/CSS/padding-right
*/
px?: StandardCSSProperties['paddingLeft'];
/**
* The **`paddingX`** property is shorthand for the CSS properties **`padding-left`** and **`padding-right`**. They set the width of the padding at the left and right sides of an element.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/padding-left
* @see https://developer.mozilla.org/docs/Web/CSS/padding-right
*/
paddingX?: StandardCSSProperties['paddingLeft'];
/**
* The **`py`** property is shorthand for the CSS properties **`padding-top`** and **`padding-bottom`**. They set the width of the padding at the top and bottom of an element.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/padding-top
* @see https://developer.mozilla.org/docs/Web/CSS/padding-bottom
*/
py?: StandardCSSProperties['paddingTop'];
/**
* The **`paddingY`** property is shorthand for the CSS properties **`padding-top`** and **`padding-bottom`**. They set the width of the padding at the top and bottom of an element.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/padding-top
* @see https://developer.mozilla.org/docs/Web/CSS/padding-bottom
*/
paddingY?: StandardCSSProperties['paddingTop'];
/**
* The **`typography`** property is shorthand for the CSS properties **`font-family`**, **`font-weight`**, **`font-size`**, **`line-height`**, **`letter-spacing`** and **`text-transform``**.
* It takes the values defined under `theme.typography` and spreads them on the element.
*
* **Initial value**: `0`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **2** | **1** | **1** | **12** | **5.5** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/font-family
* @see https://developer.mozilla.org/docs/Web/CSS/font-weight
* @see https://developer.mozilla.org/docs/Web/CSS/font-size
* @see https://developer.mozilla.org/docs/Web/CSS/line-height
* @see https://developer.mozilla.org/docs/Web/CSS/letter-spacing
* @see https://developer.mozilla.org/docs/Web/CSS/text-transform
*/
typography?: string;
/**
* The **`displayPrint`** property sets the display value for the element when the page is printed.
*
* **Initial value**: `inline`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/display
*/
displayPrint?: StandardCSSProperties['display'];
}
@@ -0,0 +1,54 @@
import * as CSS from 'csstype';
export interface OverwriteCSSProperties {
/**
* The **`border`** CSS property is shorthand for the CSS properties **`border-width`**, **`border-style`**, and **`border-color`**. It sets an element's border.
*
* **Initial value**: `none`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/border
*/
border?: CSS.Property.Border | number;
/**
* The **`box-shadow`** CSS property adds shadow effects around an element's frame. You can set multiple effects separated by commas. A box shadow is described by X and Y offsets relative to the
* element for blur and spread radii, and by its color.
*
* **Initial value**: `none`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :-----: | :-----: | :-----: | :----: | :---: |
* | **10** | **4** | **5.1** | **12** | **9** |
* | 1 _-x-_ | | 3 _-x-_ | | |
*
* @see https://developer.mozilla.org/docs/Web/CSS/box-shadow
*/
boxShadow?: CSS.Property.BoxShadow | number;
/**
* The **`font-weight`** CSS property specifies the weight (or boldness) of the font. The font weights available to you will depend on the `font-family` you are using. Some fonts are only
* available in `normal` and `bold`.
*
* **Initial value**: `normal`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **2** | **1** | **1** | **12** | **3** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/font-weight
*/
fontWeight?: CSS.Property.FontWeight | string;
/**
* The **`z-index`** CSS property sets the z-order of a positioned element and its descendants or flex items. Overlapping elements with a higher z-index cover those with a lower one.
*
* **Initial value**: `auto`
*
* | Chrome | Firefox | Safari | Edge | IE |
* | :----: | :-----: | :----: | :----: | :---: |
* | **1** | **1** | **1** | **12** | **4** |
*
* @see https://developer.mozilla.org/docs/Web/CSS/z-index
*/
zIndex?: CSS.Property.ZIndex | string;
}
@@ -0,0 +1,2 @@
import * as CSS from 'csstype';
export type StandardCSSProperties = CSS.PropertiesFallback<number | string>;
+15
View File
@@ -0,0 +1,15 @@
import { StyleFunction } from "../Box/index.js";
import { TransformFunction } from "../style/index.js";
type SimpleStyleFunction<PropKey extends keyof any> = StyleFunction<Partial<Record<PropKey, any>>>;
export interface SxConfigRecord {
cssProperty?: keyof React.CSSProperties | false;
/**
* dot access in `Theme`
*/
themeKey?: string;
transform?: TransformFunction;
style?: SimpleStyleFunction<any>;
}
export type SxConfig = Record<string, SxConfigRecord>;
declare const defaultSxConfig: SxConfig;
export default defaultSxConfig;
+4
View File
@@ -0,0 +1,4 @@
import { SxProps } from "./styleFunctionSx.js";
export default function extendSxProp<Props extends {
sx?: SxProps<any>;
} = {}>(props: Props): Props;
+9
View File
@@ -0,0 +1,9 @@
export { default } from "./styleFunctionSx.js";
export * from "./styleFunctionSx.js";
export * from "./AliasesCSSProperties.js";
export * from "./OverwriteCSSProperties.js";
export * from "./StandardCssProperties.js";
export { default as extendSxProp } from "./extendSxProp.js";
export { default as unstable_defaultSxConfig } from "./defaultSxConfig.js";
export * from "./defaultSxConfig.js";
export * from "./extendSxProp.js";
+62
View File
@@ -0,0 +1,62 @@
import * as CSS from 'csstype';
import { CSSObject } from '@mui/styled-engine';
import { StandardCSSProperties } from "./StandardCssProperties.js";
import { AliasesCSSProperties } from "./AliasesCSSProperties.js";
import { OverwriteCSSProperties } from "./OverwriteCSSProperties.js";
/**
* The `css` function accepts arrays as values for mobile-first responsive styles.
* Note that this extends to non-theme values also. For example `display=['none', 'block']`
* will also works.
*/
export type ResponsiveStyleValue<T> = T | ReadonlyArray<T | null> | {
[key: string]: T | null;
};
/**
* Map of all CSS pseudo selectors (`:hover`, `:focus`, ...).
*/
export type CSSPseudoSelectorProps<Theme extends object = {}> = { [K in CSS.Pseudos]?: ((theme: Theme) => SystemStyleObject<Theme>) | SystemStyleObject<Theme> };
/**
* Map all nested selectors.
*/
export interface CSSSelectorObject<Theme extends object = {}> {
[cssSelector: string]: ((theme: Theme) => SystemStyleObject<Theme>) | SystemStyleObject<Theme>;
}
type CssVariableType = string | number;
/**
* Map all nested selectors and CSS variables.
*/
export interface CSSSelectorObjectOrCssVariables<Theme extends object = {}> {
[cssSelectorOrVariable: string]: ((theme: Theme) => SystemStyleObject<Theme> | string | number) | SystemStyleObject<Theme> | CssVariableType;
}
/**
* Map of all available CSS properties (including aliases) and their raw value.
* Only used internally to map CSS properties to input types (responsive value,
* theme function or nested) in `SystemCssProperties`.
*/
export interface AllSystemCSSProperties extends Omit<StandardCSSProperties, keyof OverwriteCSSProperties>, OverwriteCSSProperties, AliasesCSSProperties {}
export type SystemCssProperties<Theme extends object = {}> = { [K in keyof AllSystemCSSProperties]: ResponsiveStyleValue<AllSystemCSSProperties[K]> | ((theme: Theme) => ResponsiveStyleValue<AllSystemCSSProperties[K]>) | null };
/**
* The `SystemStyleObject` defines custom properties that will be transformed to
* their corresponding values from the `Theme`. Other valid CSS properties are also allowed.
*/
export type SystemStyleObject<Theme extends object = {}> = SystemCssProperties<Theme> | CSSPseudoSelectorProps<Theme> | CSSSelectorObjectOrCssVariables<Theme> | null;
/**
* The `SxProps` can be either object or function
*/
export type SxProps<Theme extends object = {}> = SystemStyleObject<Theme> | ((theme: Theme) => SystemStyleObject<Theme>) | ReadonlyArray<boolean | SystemStyleObject<Theme> | ((theme: Theme) => SystemStyleObject<Theme>)>;
export interface StyleFunctionSx {
(props: object): CSSObject;
filterProps?: string[];
}
// eslint-disable-next-line @typescript-eslint/naming-convention
export function unstable_createStyleFunctionSx(styleFunctionMapping: Record<string, StyleFunctionSx>): StyleFunctionSx;
declare const styleFunctionSx: StyleFunctionSx;
export default styleFunctionSx;
Loaded 100 of 56062 files, more files were not shown because too many files have changed in this diff. Show more