paradiego
This commit is contained in:
30
node_modules/@mui/system/modern/Box/Box.js
generated
vendored
Normal file
30
node_modules/@mui/system/modern/Box/Box.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use client';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import ClassNameGenerator from '@mui/utils/ClassNameGenerator';
|
||||
import createBox from "../createBox/index.js";
|
||||
import boxClasses from "./boxClasses.js";
|
||||
const Box = createBox({
|
||||
defaultClassName: boxClasses.root,
|
||||
generateClassName: ClassNameGenerator.generate
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? Box.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* The component used for the root node.
|
||||
* Either a string to use a HTML element or a component.
|
||||
*/
|
||||
component: PropTypes.elementType,
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
||||
} : void 0;
|
||||
export default Box;
|
||||
3
node_modules/@mui/system/modern/Box/boxClasses.js
generated
vendored
Normal file
3
node_modules/@mui/system/modern/Box/boxClasses.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
||||
const boxClasses = generateUtilityClasses('MuiBox', ['root']);
|
||||
export default boxClasses;
|
||||
3
node_modules/@mui/system/modern/Box/index.js
generated
vendored
Normal file
3
node_modules/@mui/system/modern/Box/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default } from "./Box.js";
|
||||
export { default as boxClasses } from "./boxClasses.js";
|
||||
export * from "./boxClasses.js";
|
||||
61
node_modules/@mui/system/modern/Container/Container.js
generated
vendored
Normal file
61
node_modules/@mui/system/modern/Container/Container.js
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
'use client';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import createContainer from "./createContainer.js";
|
||||
|
||||
/**
|
||||
*
|
||||
* 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/)
|
||||
*/
|
||||
const Container = createContainer();
|
||||
process.env.NODE_ENV !== "production" ? Container.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes: PropTypes.object,
|
||||
/**
|
||||
* The component used for the root node.
|
||||
* Either a string to use a HTML element or a component.
|
||||
*/
|
||||
component: PropTypes.elementType,
|
||||
/**
|
||||
* If `true`, the left and right padding is removed.
|
||||
* @default false
|
||||
*/
|
||||
disableGutters: PropTypes.bool,
|
||||
/**
|
||||
* 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: PropTypes.bool,
|
||||
/**
|
||||
* 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: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', false]), PropTypes.string]),
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
||||
} : void 0;
|
||||
export default Container;
|
||||
1
node_modules/@mui/system/modern/Container/ContainerProps.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/Container/ContainerProps.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
7
node_modules/@mui/system/modern/Container/containerClasses.js
generated
vendored
Normal file
7
node_modules/@mui/system/modern/Container/containerClasses.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
||||
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
||||
export function getContainerUtilityClass(slot) {
|
||||
return generateUtilityClass('MuiContainer', slot);
|
||||
}
|
||||
const containerClasses = generateUtilityClasses('MuiContainer', ['root', 'disableGutters', 'fixed', 'maxWidthXs', 'maxWidthSm', 'maxWidthMd', 'maxWidthLg', 'maxWidthXl']);
|
||||
export default containerClasses;
|
||||
147
node_modules/@mui/system/modern/Container/createContainer.js
generated
vendored
Normal file
147
node_modules/@mui/system/modern/Container/createContainer.js
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import clsx from 'clsx';
|
||||
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
||||
import composeClasses from '@mui/utils/composeClasses';
|
||||
import capitalize from '@mui/utils/capitalize';
|
||||
import useThemePropsSystem from "../useThemeProps/index.js";
|
||||
import systemStyled from "../styled/index.js";
|
||||
import createTheme from "../createTheme/index.js";
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
const defaultTheme = createTheme();
|
||||
const defaultCreateStyledComponent = systemStyled('div', {
|
||||
name: 'MuiContainer',
|
||||
slot: 'Root',
|
||||
overridesResolver: (props, styles) => {
|
||||
const {
|
||||
ownerState
|
||||
} = props;
|
||||
return [styles.root, styles[`maxWidth${capitalize(String(ownerState.maxWidth))}`], ownerState.fixed && styles.fixed, ownerState.disableGutters && styles.disableGutters];
|
||||
}
|
||||
});
|
||||
const useThemePropsDefault = inProps => useThemePropsSystem({
|
||||
props: inProps,
|
||||
name: 'MuiContainer',
|
||||
defaultTheme
|
||||
});
|
||||
const useUtilityClasses = (ownerState, componentName) => {
|
||||
const getContainerUtilityClass = slot => {
|
||||
return generateUtilityClass(componentName, slot);
|
||||
};
|
||||
const {
|
||||
classes,
|
||||
fixed,
|
||||
disableGutters,
|
||||
maxWidth
|
||||
} = ownerState;
|
||||
const slots = {
|
||||
root: ['root', maxWidth && `maxWidth${capitalize(String(maxWidth))}`, fixed && 'fixed', disableGutters && 'disableGutters']
|
||||
};
|
||||
return composeClasses(slots, getContainerUtilityClass, classes);
|
||||
};
|
||||
export default function createContainer(options = {}) {
|
||||
const {
|
||||
// This will allow adding custom styled fn (for example for custom sx style function)
|
||||
createStyledComponent = defaultCreateStyledComponent,
|
||||
useThemeProps = useThemePropsDefault,
|
||||
componentName = 'MuiContainer'
|
||||
} = options;
|
||||
const ContainerRoot = createStyledComponent(({
|
||||
theme,
|
||||
ownerState
|
||||
}) => ({
|
||||
width: '100%',
|
||||
marginLeft: 'auto',
|
||||
boxSizing: 'border-box',
|
||||
marginRight: 'auto',
|
||||
...(!ownerState.disableGutters && {
|
||||
paddingLeft: theme.spacing(2),
|
||||
paddingRight: theme.spacing(2),
|
||||
// @ts-ignore module augmentation fails if custom breakpoints are used
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
paddingLeft: theme.spacing(3),
|
||||
paddingRight: theme.spacing(3)
|
||||
}
|
||||
})
|
||||
}), ({
|
||||
theme,
|
||||
ownerState
|
||||
}) => ownerState.fixed && Object.keys(theme.breakpoints.values).reduce((acc, breakpointValueKey) => {
|
||||
const breakpoint = breakpointValueKey;
|
||||
const value = theme.breakpoints.values[breakpoint];
|
||||
if (value !== 0) {
|
||||
// @ts-ignore
|
||||
acc[theme.breakpoints.up(breakpoint)] = {
|
||||
maxWidth: `${value}${theme.breakpoints.unit}`
|
||||
};
|
||||
}
|
||||
return acc;
|
||||
}, {}), ({
|
||||
theme,
|
||||
ownerState
|
||||
}) => ({
|
||||
// @ts-ignore module augmentation fails if custom breakpoints are used
|
||||
...(ownerState.maxWidth === 'xs' && {
|
||||
// @ts-ignore module augmentation fails if custom breakpoints are used
|
||||
[theme.breakpoints.up('xs')]: {
|
||||
// @ts-ignore module augmentation fails if custom breakpoints are used
|
||||
maxWidth: Math.max(theme.breakpoints.values.xs, 444)
|
||||
}
|
||||
}),
|
||||
...(ownerState.maxWidth &&
|
||||
// @ts-ignore module augmentation fails if custom breakpoints are used
|
||||
ownerState.maxWidth !== 'xs' && {
|
||||
// @ts-ignore module augmentation fails if custom breakpoints are used
|
||||
[theme.breakpoints.up(ownerState.maxWidth)]: {
|
||||
// @ts-ignore module augmentation fails if custom breakpoints are used
|
||||
maxWidth: `${theme.breakpoints.values[ownerState.maxWidth]}${theme.breakpoints.unit}`
|
||||
}
|
||||
})
|
||||
}));
|
||||
const Container = /*#__PURE__*/React.forwardRef(function Container(inProps, ref) {
|
||||
const props = useThemeProps(inProps);
|
||||
const {
|
||||
className,
|
||||
component = 'div',
|
||||
disableGutters = false,
|
||||
fixed = false,
|
||||
maxWidth = 'lg',
|
||||
classes: classesProp,
|
||||
...other
|
||||
} = props;
|
||||
const ownerState = {
|
||||
...props,
|
||||
component,
|
||||
disableGutters,
|
||||
fixed,
|
||||
maxWidth
|
||||
};
|
||||
|
||||
// @ts-ignore module augmentation fails if custom breakpoints are used
|
||||
const classes = useUtilityClasses(ownerState, componentName);
|
||||
return (
|
||||
/*#__PURE__*/
|
||||
// @ts-ignore theme is injected by the styled util
|
||||
_jsx(ContainerRoot, {
|
||||
as: component
|
||||
// @ts-ignore module augmentation fails if custom breakpoints are used
|
||||
,
|
||||
ownerState: ownerState,
|
||||
className: clsx(classes.root, className),
|
||||
ref: ref,
|
||||
...other
|
||||
})
|
||||
);
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? Container.propTypes /* remove-proptypes */ = {
|
||||
children: PropTypes.node,
|
||||
classes: PropTypes.object,
|
||||
className: PropTypes.string,
|
||||
component: PropTypes.elementType,
|
||||
disableGutters: PropTypes.bool,
|
||||
fixed: PropTypes.bool,
|
||||
maxWidth: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', false]), PropTypes.string]),
|
||||
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
||||
} : void 0;
|
||||
return Container;
|
||||
}
|
||||
3
node_modules/@mui/system/modern/Container/index.js
generated
vendored
Normal file
3
node_modules/@mui/system/modern/Container/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default } from "./Container.js";
|
||||
export { default as containerClasses } from "./containerClasses.js";
|
||||
export * from "./containerClasses.js";
|
||||
64
node_modules/@mui/system/modern/DefaultPropsProvider/DefaultPropsProvider.js
generated
vendored
Normal file
64
node_modules/@mui/system/modern/DefaultPropsProvider/DefaultPropsProvider.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import resolveProps from '@mui/utils/resolveProps';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
const PropsContext = /*#__PURE__*/React.createContext(undefined);
|
||||
function DefaultPropsProvider({
|
||||
value,
|
||||
children
|
||||
}) {
|
||||
return /*#__PURE__*/_jsx(PropsContext.Provider, {
|
||||
value: value,
|
||||
children: children
|
||||
});
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? DefaultPropsProvider.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
value: PropTypes.object
|
||||
} : void 0;
|
||||
function getThemeProps(params) {
|
||||
const {
|
||||
theme,
|
||||
name,
|
||||
props
|
||||
} = params;
|
||||
if (!theme || !theme.components || !theme.components[name]) {
|
||||
return props;
|
||||
}
|
||||
const config = theme.components[name];
|
||||
if (config.defaultProps) {
|
||||
// compatible with v5 signature
|
||||
return resolveProps(config.defaultProps, props);
|
||||
}
|
||||
if (!config.styleOverrides && !config.variants) {
|
||||
// v6 signature, no property 'defaultProps'
|
||||
return resolveProps(config, props);
|
||||
}
|
||||
return props;
|
||||
}
|
||||
export function useDefaultProps({
|
||||
props,
|
||||
name
|
||||
}) {
|
||||
const ctx = React.useContext(PropsContext);
|
||||
return getThemeProps({
|
||||
props,
|
||||
name,
|
||||
theme: {
|
||||
components: ctx
|
||||
}
|
||||
});
|
||||
}
|
||||
export default DefaultPropsProvider;
|
||||
1
node_modules/@mui/system/modern/DefaultPropsProvider/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/DefaultPropsProvider/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default, useDefaultProps } from "./DefaultPropsProvider.js";
|
||||
37
node_modules/@mui/system/modern/GlobalStyles/GlobalStyles.js
generated
vendored
Normal file
37
node_modules/@mui/system/modern/GlobalStyles/GlobalStyles.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { GlobalStyles as MuiGlobalStyles } from '@mui/styled-engine';
|
||||
import useTheme from "../useTheme/index.js";
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
function GlobalStyles({
|
||||
styles,
|
||||
themeId,
|
||||
defaultTheme = {}
|
||||
}) {
|
||||
const upperTheme = useTheme(defaultTheme);
|
||||
const globalStyles = typeof styles === 'function' ? styles(themeId ? upperTheme[themeId] || upperTheme : upperTheme) : styles;
|
||||
return /*#__PURE__*/_jsx(MuiGlobalStyles, {
|
||||
styles: globalStyles
|
||||
});
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? GlobalStyles.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
defaultTheme: PropTypes.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
styles: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.array, PropTypes.func, PropTypes.number, PropTypes.object, PropTypes.string, PropTypes.bool]),
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
themeId: PropTypes.string
|
||||
} : void 0;
|
||||
export default GlobalStyles;
|
||||
2
node_modules/@mui/system/modern/GlobalStyles/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/GlobalStyles/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./GlobalStyles.js";
|
||||
export * from "./GlobalStyles.js";
|
||||
101
node_modules/@mui/system/modern/Grid/Grid.js
generated
vendored
Normal file
101
node_modules/@mui/system/modern/Grid/Grid.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
'use client';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import createGrid from "./createGrid.js";
|
||||
/**
|
||||
*
|
||||
* 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/)
|
||||
*/
|
||||
const Grid = createGrid();
|
||||
process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* The number of columns.
|
||||
* @default 12
|
||||
*/
|
||||
columns: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
||||
/**
|
||||
* Defines the horizontal space between the type `item` components.
|
||||
* It overrides the value of the `spacing` prop.
|
||||
*/
|
||||
columnSpacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
||||
/**
|
||||
* If `true`, the component will have the flex *container* behavior.
|
||||
* You should be wrapping *items* with a *container*.
|
||||
* @default false
|
||||
*/
|
||||
container: PropTypes.bool,
|
||||
/**
|
||||
* Defines the `flex-direction` style property.
|
||||
* It is applied for all screen sizes.
|
||||
* @default 'row'
|
||||
*/
|
||||
direction: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
||||
/**
|
||||
* Defines the offset value for the type `item` components.
|
||||
*/
|
||||
offset: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), PropTypes.object]),
|
||||
/**
|
||||
* Defines the vertical space between the type `item` components.
|
||||
* It overrides the value of the `spacing` prop.
|
||||
*/
|
||||
rowSpacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
||||
/**
|
||||
* Defines the size of the the type `item` components.
|
||||
*/
|
||||
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.number])), PropTypes.object]),
|
||||
/**
|
||||
* Defines the space between the type `item` components.
|
||||
* It can only be used on a type `container` component.
|
||||
* @default 0
|
||||
*/
|
||||
spacing: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
||||
/**
|
||||
* @internal
|
||||
* The level of the grid starts from `0`
|
||||
* and increases when the grid nests inside another grid regardless of container or item.
|
||||
*
|
||||
* ```js
|
||||
* <Grid> // level 0
|
||||
* <Grid> // level 1
|
||||
* <Grid> // level 2
|
||||
* <Grid> // level 1
|
||||
* ```
|
||||
*
|
||||
* Only consecutive grid is considered nesting.
|
||||
* A grid container will start at `0` if there are non-Grid element above it.
|
||||
*
|
||||
* ```js
|
||||
* <Grid> // level 0
|
||||
* <div>
|
||||
* <Grid> // level 0
|
||||
* <Grid> // level 1
|
||||
* ```
|
||||
*/
|
||||
unstable_level: PropTypes.number,
|
||||
/**
|
||||
* Defines the `flex-wrap` style property.
|
||||
* It's applied for all screen sizes.
|
||||
* @default 'wrap'
|
||||
*/
|
||||
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
|
||||
} : void 0;
|
||||
export default Grid;
|
||||
1
node_modules/@mui/system/modern/Grid/GridProps.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/Grid/GridProps.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
148
node_modules/@mui/system/modern/Grid/createGrid.js
generated
vendored
Normal file
148
node_modules/@mui/system/modern/Grid/createGrid.js
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import clsx from 'clsx';
|
||||
import isMuiElement from '@mui/utils/isMuiElement';
|
||||
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
||||
import composeClasses from '@mui/utils/composeClasses';
|
||||
import systemStyled from "../styled/index.js";
|
||||
import useThemePropsSystem from "../useThemeProps/index.js";
|
||||
import useTheme from "../useTheme/index.js";
|
||||
import { extendSxProp } from "../styleFunctionSx/index.js";
|
||||
import createTheme from "../createTheme/index.js";
|
||||
import { generateGridStyles, generateGridSizeStyles, generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridDirectionStyles, generateGridOffsetStyles, generateSizeClassNames, generateSpacingClassNames, generateDirectionClasses } from "./gridGenerator.js";
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
const defaultTheme = createTheme();
|
||||
|
||||
// widening Theme to any so that the consumer can own the theme structure.
|
||||
const defaultCreateStyledComponent = systemStyled('div', {
|
||||
name: 'MuiGrid',
|
||||
slot: 'Root',
|
||||
overridesResolver: (props, styles) => styles.root
|
||||
});
|
||||
function useThemePropsDefault(props) {
|
||||
return useThemePropsSystem({
|
||||
props,
|
||||
name: 'MuiGrid',
|
||||
defaultTheme
|
||||
});
|
||||
}
|
||||
export default function createGrid(options = {}) {
|
||||
const {
|
||||
// This will allow adding custom styled fn (for example for custom sx style function)
|
||||
createStyledComponent = defaultCreateStyledComponent,
|
||||
useThemeProps = useThemePropsDefault,
|
||||
componentName = 'MuiGrid'
|
||||
} = options;
|
||||
const useUtilityClasses = (ownerState, theme) => {
|
||||
const {
|
||||
container,
|
||||
direction,
|
||||
spacing,
|
||||
wrap,
|
||||
size
|
||||
} = ownerState;
|
||||
const slots = {
|
||||
root: ['root', container && 'container', wrap !== 'wrap' && `wrap-xs-${String(wrap)}`, ...generateDirectionClasses(direction), ...generateSizeClassNames(size), ...(container ? generateSpacingClassNames(spacing, theme.breakpoints.keys[0]) : [])]
|
||||
};
|
||||
return composeClasses(slots, slot => generateUtilityClass(componentName, slot), {});
|
||||
};
|
||||
function parseResponsiveProp(propValue, breakpoints, shouldUseValue = () => true) {
|
||||
const parsedProp = {};
|
||||
if (propValue === null) {
|
||||
return parsedProp;
|
||||
}
|
||||
if (Array.isArray(propValue)) {
|
||||
propValue.forEach((value, index) => {
|
||||
if (value !== null && shouldUseValue(value) && breakpoints.keys[index]) {
|
||||
parsedProp[breakpoints.keys[index]] = value;
|
||||
}
|
||||
});
|
||||
} else if (typeof propValue === 'object') {
|
||||
Object.keys(propValue).forEach(key => {
|
||||
const value = propValue[key];
|
||||
if (value !== null && value !== undefined && shouldUseValue(value)) {
|
||||
parsedProp[key] = value;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
parsedProp[breakpoints.keys[0]] = propValue;
|
||||
}
|
||||
return parsedProp;
|
||||
}
|
||||
const GridRoot = createStyledComponent(generateGridColumnsStyles, generateGridColumnSpacingStyles, generateGridRowSpacingStyles, generateGridSizeStyles, generateGridDirectionStyles, generateGridStyles, generateGridOffsetStyles);
|
||||
const Grid = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
|
||||
const theme = useTheme();
|
||||
const themeProps = useThemeProps(inProps);
|
||||
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
||||
const {
|
||||
className,
|
||||
children,
|
||||
columns: columnsProp = 12,
|
||||
container = false,
|
||||
component = 'div',
|
||||
direction = 'row',
|
||||
wrap = 'wrap',
|
||||
size: sizeProp = {},
|
||||
offset: offsetProp = {},
|
||||
spacing: spacingProp = 0,
|
||||
rowSpacing: rowSpacingProp = spacingProp,
|
||||
columnSpacing: columnSpacingProp = spacingProp,
|
||||
unstable_level: level = 0,
|
||||
...other
|
||||
} = props;
|
||||
const size = parseResponsiveProp(sizeProp, theme.breakpoints, val => val !== false);
|
||||
const offset = parseResponsiveProp(offsetProp, theme.breakpoints);
|
||||
const columns = inProps.columns ?? (level ? undefined : columnsProp);
|
||||
const spacing = inProps.spacing ?? (level ? undefined : spacingProp);
|
||||
const rowSpacing = inProps.rowSpacing ?? inProps.spacing ?? (level ? undefined : rowSpacingProp);
|
||||
const columnSpacing = inProps.columnSpacing ?? inProps.spacing ?? (level ? undefined : columnSpacingProp);
|
||||
const ownerState = {
|
||||
...props,
|
||||
level,
|
||||
columns,
|
||||
container,
|
||||
direction,
|
||||
wrap,
|
||||
spacing,
|
||||
rowSpacing,
|
||||
columnSpacing,
|
||||
size,
|
||||
offset
|
||||
};
|
||||
const classes = useUtilityClasses(ownerState, theme);
|
||||
return /*#__PURE__*/_jsx(GridRoot, {
|
||||
ref: ref,
|
||||
as: component,
|
||||
ownerState: ownerState,
|
||||
className: clsx(classes.root, className),
|
||||
...other,
|
||||
children: React.Children.map(children, child => {
|
||||
if (/*#__PURE__*/React.isValidElement(child) && isMuiElement(child, ['Grid'])) {
|
||||
return /*#__PURE__*/React.cloneElement(child, {
|
||||
unstable_level: child.props?.unstable_level ?? level + 1
|
||||
});
|
||||
}
|
||||
return child;
|
||||
})
|
||||
});
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? Grid.propTypes /* remove-proptypes */ = {
|
||||
children: PropTypes.node,
|
||||
className: PropTypes.string,
|
||||
columns: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number, PropTypes.object]),
|
||||
columnSpacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
||||
component: PropTypes.elementType,
|
||||
container: PropTypes.bool,
|
||||
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
||||
offset: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), PropTypes.object]),
|
||||
rowSpacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
||||
size: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.number])), PropTypes.object]),
|
||||
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
||||
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
||||
wrap: PropTypes.oneOf(['nowrap', 'wrap-reverse', 'wrap'])
|
||||
} : void 0;
|
||||
|
||||
// @ts-ignore internal logic for nested grid
|
||||
Grid.muiName = 'Grid';
|
||||
return Grid;
|
||||
}
|
||||
19
node_modules/@mui/system/modern/Grid/gridClasses.js
generated
vendored
Normal file
19
node_modules/@mui/system/modern/Grid/gridClasses.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
||||
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
||||
export function getGridUtilityClass(slot) {
|
||||
return generateUtilityClass('MuiGrid', slot);
|
||||
}
|
||||
const SPACINGS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
const DIRECTIONS = ['column-reverse', 'column', 'row-reverse', 'row'];
|
||||
const WRAPS = ['nowrap', 'wrap-reverse', 'wrap'];
|
||||
const GRID_SIZES = ['auto', 'grow', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
||||
const gridClasses = generateUtilityClasses('MuiGrid', ['root', 'container', 'item',
|
||||
// spacings
|
||||
...SPACINGS.map(spacing => `spacing-xs-${spacing}`),
|
||||
// direction values
|
||||
...DIRECTIONS.map(direction => `direction-xs-${direction}`),
|
||||
// wrap values
|
||||
...WRAPS.map(wrap => `wrap-xs-${wrap}`),
|
||||
// grid sizes for all breakpoints
|
||||
...GRID_SIZES.map(size => `grid-xs-${size}`), ...GRID_SIZES.map(size => `grid-sm-${size}`), ...GRID_SIZES.map(size => `grid-md-${size}`), ...GRID_SIZES.map(size => `grid-lg-${size}`), ...GRID_SIZES.map(size => `grid-xl-${size}`)]);
|
||||
export default gridClasses;
|
||||
216
node_modules/@mui/system/modern/Grid/gridGenerator.js
generated
vendored
Normal file
216
node_modules/@mui/system/modern/Grid/gridGenerator.js
generated
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
import { traverseBreakpoints } from "./traverseBreakpoints.js";
|
||||
function appendLevel(level) {
|
||||
if (!level) {
|
||||
return '';
|
||||
}
|
||||
return `Level${level}`;
|
||||
}
|
||||
function isNestedContainer(ownerState) {
|
||||
return ownerState.unstable_level > 0 && ownerState.container;
|
||||
}
|
||||
function createGetSelfSpacing(ownerState) {
|
||||
return function getSelfSpacing(axis) {
|
||||
return `var(--Grid-${axis}Spacing${appendLevel(ownerState.unstable_level)})`;
|
||||
};
|
||||
}
|
||||
function createGetParentSpacing(ownerState) {
|
||||
return function getParentSpacing(axis) {
|
||||
if (ownerState.unstable_level === 0) {
|
||||
return `var(--Grid-${axis}Spacing)`;
|
||||
}
|
||||
return `var(--Grid-${axis}Spacing${appendLevel(ownerState.unstable_level - 1)})`;
|
||||
};
|
||||
}
|
||||
function getParentColumns(ownerState) {
|
||||
if (ownerState.unstable_level === 0) {
|
||||
return `var(--Grid-columns)`;
|
||||
}
|
||||
return `var(--Grid-columns${appendLevel(ownerState.unstable_level - 1)})`;
|
||||
}
|
||||
export const generateGridSizeStyles = ({
|
||||
theme,
|
||||
ownerState
|
||||
}) => {
|
||||
const getParentSpacing = createGetParentSpacing(ownerState);
|
||||
const styles = {};
|
||||
traverseBreakpoints(theme.breakpoints, ownerState.size, (appendStyle, value) => {
|
||||
let style = {};
|
||||
if (value === 'grow') {
|
||||
style = {
|
||||
flexBasis: 0,
|
||||
flexGrow: 1,
|
||||
maxWidth: '100%'
|
||||
};
|
||||
}
|
||||
if (value === 'auto') {
|
||||
style = {
|
||||
flexBasis: 'auto',
|
||||
flexGrow: 0,
|
||||
flexShrink: 0,
|
||||
maxWidth: 'none',
|
||||
width: 'auto'
|
||||
};
|
||||
}
|
||||
if (typeof value === 'number') {
|
||||
style = {
|
||||
flexGrow: 0,
|
||||
flexBasis: 'auto',
|
||||
width: `calc(100% * ${value} / ${getParentColumns(ownerState)} - (${getParentColumns(ownerState)} - ${value}) * (${getParentSpacing('column')} / ${getParentColumns(ownerState)}))`
|
||||
};
|
||||
}
|
||||
appendStyle(styles, style);
|
||||
});
|
||||
return styles;
|
||||
};
|
||||
export const generateGridOffsetStyles = ({
|
||||
theme,
|
||||
ownerState
|
||||
}) => {
|
||||
const getParentSpacing = createGetParentSpacing(ownerState);
|
||||
const styles = {};
|
||||
traverseBreakpoints(theme.breakpoints, ownerState.offset, (appendStyle, value) => {
|
||||
let style = {};
|
||||
if (value === 'auto') {
|
||||
style = {
|
||||
marginLeft: 'auto'
|
||||
};
|
||||
}
|
||||
if (typeof value === 'number') {
|
||||
style = {
|
||||
marginLeft: value === 0 ? '0px' : `calc(100% * ${value} / ${getParentColumns(ownerState)} + ${getParentSpacing('column')} * ${value} / ${getParentColumns(ownerState)})`
|
||||
};
|
||||
}
|
||||
appendStyle(styles, style);
|
||||
});
|
||||
return styles;
|
||||
};
|
||||
export const generateGridColumnsStyles = ({
|
||||
theme,
|
||||
ownerState
|
||||
}) => {
|
||||
if (!ownerState.container) {
|
||||
return {};
|
||||
}
|
||||
const styles = isNestedContainer(ownerState) ? {
|
||||
[`--Grid-columns${appendLevel(ownerState.unstable_level)}`]: getParentColumns(ownerState)
|
||||
} : {
|
||||
'--Grid-columns': 12
|
||||
};
|
||||
traverseBreakpoints(theme.breakpoints, ownerState.columns, (appendStyle, value) => {
|
||||
appendStyle(styles, {
|
||||
[`--Grid-columns${appendLevel(ownerState.unstable_level)}`]: value
|
||||
});
|
||||
});
|
||||
return styles;
|
||||
};
|
||||
export const generateGridRowSpacingStyles = ({
|
||||
theme,
|
||||
ownerState
|
||||
}) => {
|
||||
if (!ownerState.container) {
|
||||
return {};
|
||||
}
|
||||
const getParentSpacing = createGetParentSpacing(ownerState);
|
||||
const styles = isNestedContainer(ownerState) ? {
|
||||
// Set the default spacing as its parent spacing.
|
||||
// It will be overridden if spacing props are provided
|
||||
[`--Grid-rowSpacing${appendLevel(ownerState.unstable_level)}`]: getParentSpacing('row')
|
||||
} : {};
|
||||
traverseBreakpoints(theme.breakpoints, ownerState.rowSpacing, (appendStyle, value) => {
|
||||
appendStyle(styles, {
|
||||
[`--Grid-rowSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value : theme.spacing?.(value)
|
||||
});
|
||||
});
|
||||
return styles;
|
||||
};
|
||||
export const generateGridColumnSpacingStyles = ({
|
||||
theme,
|
||||
ownerState
|
||||
}) => {
|
||||
if (!ownerState.container) {
|
||||
return {};
|
||||
}
|
||||
const getParentSpacing = createGetParentSpacing(ownerState);
|
||||
const styles = isNestedContainer(ownerState) ? {
|
||||
// Set the default spacing as its parent spacing.
|
||||
// It will be overridden if spacing props are provided
|
||||
[`--Grid-columnSpacing${appendLevel(ownerState.unstable_level)}`]: getParentSpacing('column')
|
||||
} : {};
|
||||
traverseBreakpoints(theme.breakpoints, ownerState.columnSpacing, (appendStyle, value) => {
|
||||
appendStyle(styles, {
|
||||
[`--Grid-columnSpacing${appendLevel(ownerState.unstable_level)}`]: typeof value === 'string' ? value : theme.spacing?.(value)
|
||||
});
|
||||
});
|
||||
return styles;
|
||||
};
|
||||
export const generateGridDirectionStyles = ({
|
||||
theme,
|
||||
ownerState
|
||||
}) => {
|
||||
if (!ownerState.container) {
|
||||
return {};
|
||||
}
|
||||
const styles = {};
|
||||
traverseBreakpoints(theme.breakpoints, ownerState.direction, (appendStyle, value) => {
|
||||
appendStyle(styles, {
|
||||
flexDirection: value
|
||||
});
|
||||
});
|
||||
return styles;
|
||||
};
|
||||
export const generateGridStyles = ({
|
||||
ownerState
|
||||
}) => {
|
||||
const getSelfSpacing = createGetSelfSpacing(ownerState);
|
||||
return {
|
||||
minWidth: 0,
|
||||
boxSizing: 'border-box',
|
||||
...(ownerState.container && {
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
...(ownerState.wrap && ownerState.wrap !== 'wrap' && {
|
||||
flexWrap: ownerState.wrap
|
||||
}),
|
||||
gap: `${getSelfSpacing('row')} ${getSelfSpacing('column')}`
|
||||
})
|
||||
};
|
||||
};
|
||||
export const generateSizeClassNames = size => {
|
||||
const classNames = [];
|
||||
Object.entries(size).forEach(([key, value]) => {
|
||||
if (value !== false && value !== undefined) {
|
||||
classNames.push(`grid-${key}-${String(value)}`);
|
||||
}
|
||||
});
|
||||
return classNames;
|
||||
};
|
||||
export const generateSpacingClassNames = (spacing, smallestBreakpoint = 'xs') => {
|
||||
function isValidSpacing(val) {
|
||||
if (val === undefined) {
|
||||
return false;
|
||||
}
|
||||
return typeof val === 'string' && !Number.isNaN(Number(val)) || typeof val === 'number' && val > 0;
|
||||
}
|
||||
if (isValidSpacing(spacing)) {
|
||||
return [`spacing-${smallestBreakpoint}-${String(spacing)}`];
|
||||
}
|
||||
if (typeof spacing === 'object' && !Array.isArray(spacing)) {
|
||||
const classNames = [];
|
||||
Object.entries(spacing).forEach(([key, value]) => {
|
||||
if (isValidSpacing(value)) {
|
||||
classNames.push(`spacing-${key}-${String(value)}`);
|
||||
}
|
||||
});
|
||||
return classNames;
|
||||
}
|
||||
return [];
|
||||
};
|
||||
export const generateDirectionClasses = direction => {
|
||||
if (direction === undefined) {
|
||||
return [];
|
||||
}
|
||||
if (typeof direction === 'object') {
|
||||
return Object.entries(direction).map(([key, value]) => `direction-${key}-${value}`);
|
||||
}
|
||||
return [`direction-xs-${String(direction)}`];
|
||||
};
|
||||
6
node_modules/@mui/system/modern/Grid/index.js
generated
vendored
Normal file
6
node_modules/@mui/system/modern/Grid/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
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";
|
||||
42
node_modules/@mui/system/modern/Grid/traverseBreakpoints.js
generated
vendored
Normal file
42
node_modules/@mui/system/modern/Grid/traverseBreakpoints.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
export const filterBreakpointKeys = (breakpointsKeys, responsiveKeys) => breakpointsKeys.filter(key => responsiveKeys.includes(key));
|
||||
export const traverseBreakpoints = (breakpoints, responsive, iterator) => {
|
||||
const smallestBreakpoint = breakpoints.keys[0]; // the keys is sorted from smallest to largest by `createBreakpoints`.
|
||||
|
||||
if (Array.isArray(responsive)) {
|
||||
responsive.forEach((breakpointValue, index) => {
|
||||
iterator((responsiveStyles, style) => {
|
||||
if (index <= breakpoints.keys.length - 1) {
|
||||
if (index === 0) {
|
||||
Object.assign(responsiveStyles, style);
|
||||
} else {
|
||||
responsiveStyles[breakpoints.up(breakpoints.keys[index])] = style;
|
||||
}
|
||||
}
|
||||
}, breakpointValue);
|
||||
});
|
||||
} else if (responsive && typeof responsive === 'object') {
|
||||
// prevent null
|
||||
// responsive could be a very big object, pick the smallest responsive values
|
||||
|
||||
const keys = Object.keys(responsive).length > breakpoints.keys.length ? breakpoints.keys : filterBreakpointKeys(breakpoints.keys, Object.keys(responsive));
|
||||
keys.forEach(key => {
|
||||
if (breakpoints.keys.includes(key)) {
|
||||
// @ts-ignore already checked that responsive is an object
|
||||
const breakpointValue = responsive[key];
|
||||
if (breakpointValue !== undefined) {
|
||||
iterator((responsiveStyles, style) => {
|
||||
if (smallestBreakpoint === key) {
|
||||
Object.assign(responsiveStyles, style);
|
||||
} else {
|
||||
responsiveStyles[breakpoints.up(key)] = style;
|
||||
}
|
||||
}, breakpointValue);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (typeof responsive === 'number' || typeof responsive === 'string') {
|
||||
iterator((responsiveStyles, style) => {
|
||||
Object.assign(responsiveStyles, style);
|
||||
}, responsive);
|
||||
}
|
||||
};
|
||||
77
node_modules/@mui/system/modern/InitColorSchemeScript/InitColorSchemeScript.js
generated
vendored
Normal file
77
node_modules/@mui/system/modern/InitColorSchemeScript/InitColorSchemeScript.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* Split this component for RSC import
|
||||
*/
|
||||
import * as React from 'react';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export const DEFAULT_MODE_STORAGE_KEY = 'mode';
|
||||
export const DEFAULT_COLOR_SCHEME_STORAGE_KEY = 'color-scheme';
|
||||
export const DEFAULT_ATTRIBUTE = 'data-color-scheme';
|
||||
export default function InitColorSchemeScript(options) {
|
||||
const {
|
||||
defaultLightColorScheme = 'light',
|
||||
defaultDarkColorScheme = 'dark',
|
||||
modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
||||
colorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
|
||||
attribute: initialAttribute = DEFAULT_ATTRIBUTE,
|
||||
colorSchemeNode = 'document.documentElement',
|
||||
nonce
|
||||
} = options || {};
|
||||
let setter = '';
|
||||
let attribute = initialAttribute;
|
||||
if (initialAttribute === 'class') {
|
||||
attribute = '.%s';
|
||||
}
|
||||
if (initialAttribute === 'data') {
|
||||
attribute = '[data-%s]';
|
||||
}
|
||||
if (attribute.startsWith('.')) {
|
||||
const selector = attribute.substring(1);
|
||||
setter += `${colorSchemeNode}.classList.remove('${selector}'.replace('%s', light), '${selector}'.replace('%s', dark));
|
||||
${colorSchemeNode}.classList.add('${selector}'.replace('%s', colorScheme));`;
|
||||
}
|
||||
const matches = attribute.match(/\[([^\]]+)\]/); // case [data-color-scheme=%s] or [data-color-scheme]
|
||||
if (matches) {
|
||||
const [attr, value] = matches[1].split('=');
|
||||
if (!value) {
|
||||
setter += `${colorSchemeNode}.removeAttribute('${attr}'.replace('%s', light));
|
||||
${colorSchemeNode}.removeAttribute('${attr}'.replace('%s', dark));`;
|
||||
}
|
||||
setter += `
|
||||
${colorSchemeNode}.setAttribute('${attr}'.replace('%s', colorScheme), ${value ? `${value}.replace('%s', colorScheme)` : '""'});`;
|
||||
} else {
|
||||
setter += `${colorSchemeNode}.setAttribute('${attribute}', colorScheme);`;
|
||||
}
|
||||
return /*#__PURE__*/_jsx("script", {
|
||||
suppressHydrationWarning: true,
|
||||
nonce: typeof window === 'undefined' ? nonce : ''
|
||||
// eslint-disable-next-line react/no-danger
|
||||
,
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: `(function() {
|
||||
try {
|
||||
let colorScheme = '';
|
||||
const mode = localStorage.getItem('${modeStorageKey}') || 'system';
|
||||
const dark = localStorage.getItem('${colorSchemeStorageKey}-dark') || '${defaultDarkColorScheme}';
|
||||
const light = localStorage.getItem('${colorSchemeStorageKey}-light') || '${defaultLightColorScheme}';
|
||||
if (mode === 'system') {
|
||||
// handle system mode
|
||||
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
if (mql.matches) {
|
||||
colorScheme = dark
|
||||
} else {
|
||||
colorScheme = light
|
||||
}
|
||||
}
|
||||
if (mode === 'light') {
|
||||
colorScheme = light;
|
||||
}
|
||||
if (mode === 'dark') {
|
||||
colorScheme = dark;
|
||||
}
|
||||
if (colorScheme) {
|
||||
${setter}
|
||||
}
|
||||
} catch(e){}})();`
|
||||
}
|
||||
}, "mui-color-scheme-init");
|
||||
}
|
||||
1
node_modules/@mui/system/modern/InitColorSchemeScript/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/InitColorSchemeScript/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./InitColorSchemeScript.js";
|
||||
22
node_modules/@mui/system/modern/RtlProvider/index.js
generated
vendored
Normal file
22
node_modules/@mui/system/modern/RtlProvider/index.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
const RtlContext = /*#__PURE__*/React.createContext();
|
||||
function RtlProvider({
|
||||
value,
|
||||
...props
|
||||
}) {
|
||||
return /*#__PURE__*/_jsx(RtlContext.Provider, {
|
||||
value: value ?? true,
|
||||
...props
|
||||
});
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? RtlProvider.propTypes = {
|
||||
children: PropTypes.node,
|
||||
value: PropTypes.bool
|
||||
} : void 0;
|
||||
export const useRtl = () => {
|
||||
const value = React.useContext(RtlContext);
|
||||
return value ?? false;
|
||||
};
|
||||
export default RtlProvider;
|
||||
62
node_modules/@mui/system/modern/Stack/Stack.js
generated
vendored
Normal file
62
node_modules/@mui/system/modern/Stack/Stack.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
'use client';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import createStack from "./createStack.js";
|
||||
/**
|
||||
*
|
||||
* 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/)
|
||||
*/
|
||||
const Stack = createStack();
|
||||
process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* The component used for the root node.
|
||||
* Either a string to use a HTML element or a component.
|
||||
*/
|
||||
component: PropTypes.elementType,
|
||||
/**
|
||||
* Defines the `flex-direction` style property.
|
||||
* It is applied for all screen sizes.
|
||||
* @default 'column'
|
||||
*/
|
||||
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
||||
/**
|
||||
* Add an element between each child.
|
||||
*/
|
||||
divider: PropTypes.node,
|
||||
/**
|
||||
* Defines the space between immediate children.
|
||||
* @default 0
|
||||
*/
|
||||
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
||||
/**
|
||||
* The system prop, which allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
||||
/**
|
||||
* 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: PropTypes.bool
|
||||
} : void 0;
|
||||
export default Stack;
|
||||
1
node_modules/@mui/system/modern/Stack/StackProps.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/Stack/StackProps.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
171
node_modules/@mui/system/modern/Stack/createStack.js
generated
vendored
Normal file
171
node_modules/@mui/system/modern/Stack/createStack.js
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import clsx from 'clsx';
|
||||
import deepmerge from '@mui/utils/deepmerge';
|
||||
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
||||
import composeClasses from '@mui/utils/composeClasses';
|
||||
import systemStyled from "../styled/index.js";
|
||||
import useThemePropsSystem from "../useThemeProps/index.js";
|
||||
import { extendSxProp } from "../styleFunctionSx/index.js";
|
||||
import createTheme from "../createTheme/index.js";
|
||||
import { handleBreakpoints, mergeBreakpointsInOrder, resolveBreakpointValues } from "../breakpoints/index.js";
|
||||
import { createUnarySpacing, getValue } from "../spacing/index.js";
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
const defaultTheme = createTheme();
|
||||
// widening Theme to any so that the consumer can own the theme structure.
|
||||
const defaultCreateStyledComponent = systemStyled('div', {
|
||||
name: 'MuiStack',
|
||||
slot: 'Root',
|
||||
overridesResolver: (props, styles) => styles.root
|
||||
});
|
||||
function useThemePropsDefault(props) {
|
||||
return useThemePropsSystem({
|
||||
props,
|
||||
name: 'MuiStack',
|
||||
defaultTheme
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array with the separator React element interspersed between
|
||||
* each React node of the input children.
|
||||
*
|
||||
* > joinChildren([1,2,3], 0)
|
||||
* [1,0,2,0,3]
|
||||
*/
|
||||
function joinChildren(children, separator) {
|
||||
const childrenArray = React.Children.toArray(children).filter(Boolean);
|
||||
return childrenArray.reduce((output, child, index) => {
|
||||
output.push(child);
|
||||
if (index < childrenArray.length - 1) {
|
||||
output.push(/*#__PURE__*/React.cloneElement(separator, {
|
||||
key: `separator-${index}`
|
||||
}));
|
||||
}
|
||||
return output;
|
||||
}, []);
|
||||
}
|
||||
const getSideFromDirection = direction => {
|
||||
return {
|
||||
row: 'Left',
|
||||
'row-reverse': 'Right',
|
||||
column: 'Top',
|
||||
'column-reverse': 'Bottom'
|
||||
}[direction];
|
||||
};
|
||||
export const style = ({
|
||||
ownerState,
|
||||
theme
|
||||
}) => {
|
||||
let styles = {
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
...handleBreakpoints({
|
||||
theme
|
||||
}, resolveBreakpointValues({
|
||||
values: ownerState.direction,
|
||||
breakpoints: theme.breakpoints.values
|
||||
}), propValue => ({
|
||||
flexDirection: propValue
|
||||
}))
|
||||
};
|
||||
if (ownerState.spacing) {
|
||||
const transformer = createUnarySpacing(theme);
|
||||
const base = Object.keys(theme.breakpoints.values).reduce((acc, breakpoint) => {
|
||||
if (typeof ownerState.spacing === 'object' && ownerState.spacing[breakpoint] != null || typeof ownerState.direction === 'object' && ownerState.direction[breakpoint] != null) {
|
||||
acc[breakpoint] = true;
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
const directionValues = resolveBreakpointValues({
|
||||
values: ownerState.direction,
|
||||
base
|
||||
});
|
||||
const spacingValues = resolveBreakpointValues({
|
||||
values: ownerState.spacing,
|
||||
base
|
||||
});
|
||||
if (typeof directionValues === 'object') {
|
||||
Object.keys(directionValues).forEach((breakpoint, index, breakpoints) => {
|
||||
const directionValue = directionValues[breakpoint];
|
||||
if (!directionValue) {
|
||||
const previousDirectionValue = index > 0 ? directionValues[breakpoints[index - 1]] : 'column';
|
||||
directionValues[breakpoint] = previousDirectionValue;
|
||||
}
|
||||
});
|
||||
}
|
||||
const styleFromPropValue = (propValue, breakpoint) => {
|
||||
if (ownerState.useFlexGap) {
|
||||
return {
|
||||
gap: getValue(transformer, propValue)
|
||||
};
|
||||
}
|
||||
return {
|
||||
// The useFlexGap={false} implement relies on each child to give up control of the margin.
|
||||
// We need to reset the margin to avoid double spacing.
|
||||
'& > :not(style):not(style)': {
|
||||
margin: 0
|
||||
},
|
||||
'& > :not(style) ~ :not(style)': {
|
||||
[`margin${getSideFromDirection(breakpoint ? directionValues[breakpoint] : ownerState.direction)}`]: getValue(transformer, propValue)
|
||||
}
|
||||
};
|
||||
};
|
||||
styles = deepmerge(styles, handleBreakpoints({
|
||||
theme
|
||||
}, spacingValues, styleFromPropValue));
|
||||
}
|
||||
styles = mergeBreakpointsInOrder(theme.breakpoints, styles);
|
||||
return styles;
|
||||
};
|
||||
export default function createStack(options = {}) {
|
||||
const {
|
||||
// This will allow adding custom styled fn (for example for custom sx style function)
|
||||
createStyledComponent = defaultCreateStyledComponent,
|
||||
useThemeProps = useThemePropsDefault,
|
||||
componentName = 'MuiStack'
|
||||
} = options;
|
||||
const useUtilityClasses = () => {
|
||||
const slots = {
|
||||
root: ['root']
|
||||
};
|
||||
return composeClasses(slots, slot => generateUtilityClass(componentName, slot), {});
|
||||
};
|
||||
const StackRoot = createStyledComponent(style);
|
||||
const Stack = /*#__PURE__*/React.forwardRef(function Grid(inProps, ref) {
|
||||
const themeProps = useThemeProps(inProps);
|
||||
const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
|
||||
const {
|
||||
component = 'div',
|
||||
direction = 'column',
|
||||
spacing = 0,
|
||||
divider,
|
||||
children,
|
||||
className,
|
||||
useFlexGap = false,
|
||||
...other
|
||||
} = props;
|
||||
const ownerState = {
|
||||
direction,
|
||||
spacing,
|
||||
useFlexGap
|
||||
};
|
||||
const classes = useUtilityClasses();
|
||||
return /*#__PURE__*/_jsx(StackRoot, {
|
||||
as: component,
|
||||
ownerState: ownerState,
|
||||
ref: ref,
|
||||
className: clsx(classes.root, className),
|
||||
...other,
|
||||
children: divider ? joinChildren(children, divider) : children
|
||||
});
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? Stack.propTypes /* remove-proptypes */ = {
|
||||
children: PropTypes.node,
|
||||
direction: PropTypes.oneOfType([PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row']), PropTypes.arrayOf(PropTypes.oneOf(['column-reverse', 'column', 'row-reverse', 'row'])), PropTypes.object]),
|
||||
divider: PropTypes.node,
|
||||
spacing: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string])), PropTypes.number, PropTypes.object, PropTypes.string]),
|
||||
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
||||
} : void 0;
|
||||
return Stack;
|
||||
}
|
||||
5
node_modules/@mui/system/modern/Stack/index.js
generated
vendored
Normal file
5
node_modules/@mui/system/modern/Stack/index.js
generated
vendored
Normal 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";
|
||||
7
node_modules/@mui/system/modern/Stack/stackClasses.js
generated
vendored
Normal file
7
node_modules/@mui/system/modern/Stack/stackClasses.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
||||
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
||||
export function getStackUtilityClass(slot) {
|
||||
return generateUtilityClass('MuiStack', slot);
|
||||
}
|
||||
const stackClasses = generateUtilityClasses('MuiStack', ['root']);
|
||||
export default stackClasses;
|
||||
97
node_modules/@mui/system/modern/ThemeProvider/ThemeProvider.js
generated
vendored
Normal file
97
node_modules/@mui/system/modern/ThemeProvider/ThemeProvider.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ThemeProvider as MuiThemeProvider, useTheme as usePrivateTheme } from '@mui/private-theming';
|
||||
import exactProp from '@mui/utils/exactProp';
|
||||
import { ThemeContext as StyledEngineThemeContext } from '@mui/styled-engine';
|
||||
import useThemeWithoutDefault from "../useThemeWithoutDefault/index.js";
|
||||
import RtlProvider from "../RtlProvider/index.js";
|
||||
import DefaultPropsProvider from "../DefaultPropsProvider/index.js";
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
const EMPTY_THEME = {};
|
||||
function useThemeScoping(themeId, upperTheme, localTheme, isPrivate = false) {
|
||||
return React.useMemo(() => {
|
||||
const resolvedTheme = themeId ? upperTheme[themeId] || upperTheme : upperTheme;
|
||||
if (typeof localTheme === 'function') {
|
||||
const mergedTheme = localTheme(resolvedTheme);
|
||||
const result = themeId ? {
|
||||
...upperTheme,
|
||||
[themeId]: mergedTheme
|
||||
} : mergedTheme;
|
||||
// must return a function for the private theme to NOT merge with the upper theme.
|
||||
// see the test case "use provided theme from a callback" in ThemeProvider.test.js
|
||||
if (isPrivate) {
|
||||
return () => result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return themeId ? {
|
||||
...upperTheme,
|
||||
[themeId]: localTheme
|
||||
} : {
|
||||
...upperTheme,
|
||||
...localTheme
|
||||
};
|
||||
}, [themeId, upperTheme, localTheme, isPrivate]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This component makes the `theme` available down the React tree.
|
||||
* It should preferably be used at **the root of your component tree**.
|
||||
*
|
||||
* <ThemeProvider theme={theme}> // existing use case
|
||||
* <ThemeProvider theme={{ id: theme }}> // theme scoping
|
||||
*/
|
||||
function ThemeProvider(props) {
|
||||
const {
|
||||
children,
|
||||
theme: localTheme,
|
||||
themeId
|
||||
} = props;
|
||||
const upperTheme = useThemeWithoutDefault(EMPTY_THEME);
|
||||
const upperPrivateTheme = usePrivateTheme() || EMPTY_THEME;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (upperTheme === null && typeof localTheme === 'function' || themeId && upperTheme && !upperTheme[themeId] && typeof localTheme === 'function') {
|
||||
console.error(['MUI: You are providing a theme function prop to the ThemeProvider component:', '<ThemeProvider theme={outerTheme => outerTheme} />', '', 'However, no outer theme is present.', 'Make sure a theme is already injected higher in the React tree ' + 'or provide a theme object.'].join('\n'));
|
||||
}
|
||||
}
|
||||
const engineTheme = useThemeScoping(themeId, upperTheme, localTheme);
|
||||
const privateTheme = useThemeScoping(themeId, upperPrivateTheme, localTheme, true);
|
||||
const rtlValue = engineTheme.direction === 'rtl';
|
||||
return /*#__PURE__*/_jsx(MuiThemeProvider, {
|
||||
theme: privateTheme,
|
||||
children: /*#__PURE__*/_jsx(StyledEngineThemeContext.Provider, {
|
||||
value: engineTheme,
|
||||
children: /*#__PURE__*/_jsx(RtlProvider, {
|
||||
value: rtlValue,
|
||||
children: /*#__PURE__*/_jsx(DefaultPropsProvider, {
|
||||
value: engineTheme?.components,
|
||||
children: children
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes /* remove-proptypes */ = {
|
||||
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
||||
// │ These PropTypes are generated from the TypeScript type definitions. │
|
||||
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* Your component tree.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* A theme object. You can provide a function to extend the outer theme.
|
||||
*/
|
||||
theme: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).isRequired,
|
||||
/**
|
||||
* The design system's unique id for getting the corresponded theme when there are multiple design systems.
|
||||
*/
|
||||
themeId: PropTypes.string
|
||||
} : void 0;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
process.env.NODE_ENV !== "production" ? ThemeProvider.propTypes = exactProp(ThemeProvider.propTypes) : void 0;
|
||||
}
|
||||
export default ThemeProvider;
|
||||
1
node_modules/@mui/system/modern/ThemeProvider/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/ThemeProvider/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./ThemeProvider.js";
|
||||
49
node_modules/@mui/system/modern/borders/borders.js
generated
vendored
Normal file
49
node_modules/@mui/system/modern/borders/borders.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import responsivePropType from "../responsivePropType/index.js";
|
||||
import style from "../style/index.js";
|
||||
import compose from "../compose/index.js";
|
||||
import { createUnaryUnit, getValue } from "../spacing/index.js";
|
||||
import { handleBreakpoints } from "../breakpoints/index.js";
|
||||
export function borderTransform(value) {
|
||||
if (typeof value !== 'number') {
|
||||
return value;
|
||||
}
|
||||
return `${value}px solid`;
|
||||
}
|
||||
function createBorderStyle(prop, transform) {
|
||||
return style({
|
||||
prop,
|
||||
themeKey: 'borders',
|
||||
transform
|
||||
});
|
||||
}
|
||||
export const border = createBorderStyle('border', borderTransform);
|
||||
export const borderTop = createBorderStyle('borderTop', borderTransform);
|
||||
export const borderRight = createBorderStyle('borderRight', borderTransform);
|
||||
export const borderBottom = createBorderStyle('borderBottom', borderTransform);
|
||||
export const borderLeft = createBorderStyle('borderLeft', borderTransform);
|
||||
export const borderColor = createBorderStyle('borderColor');
|
||||
export const borderTopColor = createBorderStyle('borderTopColor');
|
||||
export const borderRightColor = createBorderStyle('borderRightColor');
|
||||
export const borderBottomColor = createBorderStyle('borderBottomColor');
|
||||
export const borderLeftColor = createBorderStyle('borderLeftColor');
|
||||
export const outline = createBorderStyle('outline', borderTransform);
|
||||
export const outlineColor = createBorderStyle('outlineColor');
|
||||
|
||||
// false positive
|
||||
// eslint-disable-next-line react/function-component-definition
|
||||
export const borderRadius = props => {
|
||||
if (props.borderRadius !== undefined && props.borderRadius !== null) {
|
||||
const transformer = createUnaryUnit(props.theme, 'shape.borderRadius', 4, 'borderRadius');
|
||||
const styleFromPropValue = propValue => ({
|
||||
borderRadius: getValue(transformer, propValue)
|
||||
});
|
||||
return handleBreakpoints(props, props.borderRadius, styleFromPropValue);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
borderRadius.propTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
borderRadius: responsivePropType
|
||||
} : {};
|
||||
borderRadius.filterProps = ['borderRadius'];
|
||||
const borders = compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderRadius, outline, outlineColor);
|
||||
export default borders;
|
||||
2
node_modules/@mui/system/modern/borders/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/borders/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./borders.js";
|
||||
export * from "./borders.js";
|
||||
171
node_modules/@mui/system/modern/breakpoints/breakpoints.js
generated
vendored
Normal file
171
node_modules/@mui/system/modern/breakpoints/breakpoints.js
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import deepmerge from '@mui/utils/deepmerge';
|
||||
import merge from "../merge/index.js";
|
||||
import { isCqShorthand, getContainerQuery } from "../cssContainerQueries/index.js";
|
||||
|
||||
// The breakpoint **start** at this value.
|
||||
// For instance with the first breakpoint xs: [xs, sm[.
|
||||
export const values = {
|
||||
xs: 0,
|
||||
// phone
|
||||
sm: 600,
|
||||
// tablet
|
||||
md: 900,
|
||||
// small laptop
|
||||
lg: 1200,
|
||||
// desktop
|
||||
xl: 1536 // large screen
|
||||
};
|
||||
const defaultBreakpoints = {
|
||||
// Sorted ASC by size. That's important.
|
||||
// It can't be configured as it's used statically for propTypes.
|
||||
keys: ['xs', 'sm', 'md', 'lg', 'xl'],
|
||||
up: key => `@media (min-width:${values[key]}px)`
|
||||
};
|
||||
const defaultContainerQueries = {
|
||||
containerQueries: containerName => ({
|
||||
up: key => {
|
||||
let result = typeof key === 'number' ? key : values[key] || key;
|
||||
if (typeof result === 'number') {
|
||||
result = `${result}px`;
|
||||
}
|
||||
return containerName ? `@container ${containerName} (min-width:${result})` : `@container (min-width:${result})`;
|
||||
}
|
||||
})
|
||||
};
|
||||
export function handleBreakpoints(props, propValue, styleFromPropValue) {
|
||||
const theme = props.theme || {};
|
||||
if (Array.isArray(propValue)) {
|
||||
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
||||
return propValue.reduce((acc, item, index) => {
|
||||
acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]);
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
if (typeof propValue === 'object') {
|
||||
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
||||
return Object.keys(propValue).reduce((acc, breakpoint) => {
|
||||
if (isCqShorthand(themeBreakpoints.keys, breakpoint)) {
|
||||
const containerKey = getContainerQuery(theme.containerQueries ? theme : defaultContainerQueries, breakpoint);
|
||||
if (containerKey) {
|
||||
acc[containerKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
|
||||
}
|
||||
}
|
||||
// key is breakpoint
|
||||
else if (Object.keys(themeBreakpoints.values || values).includes(breakpoint)) {
|
||||
const mediaKey = themeBreakpoints.up(breakpoint);
|
||||
acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
|
||||
} else {
|
||||
const cssKey = breakpoint;
|
||||
acc[cssKey] = propValue[cssKey];
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
const output = styleFromPropValue(propValue);
|
||||
return output;
|
||||
}
|
||||
function breakpoints(styleFunction) {
|
||||
// false positive
|
||||
// eslint-disable-next-line react/function-component-definition
|
||||
const newStyleFunction = props => {
|
||||
const theme = props.theme || {};
|
||||
const base = styleFunction(props);
|
||||
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
||||
const extended = themeBreakpoints.keys.reduce((acc, key) => {
|
||||
if (props[key]) {
|
||||
acc = acc || {};
|
||||
acc[themeBreakpoints.up(key)] = styleFunction({
|
||||
theme,
|
||||
...props[key]
|
||||
});
|
||||
}
|
||||
return acc;
|
||||
}, null);
|
||||
return merge(base, extended);
|
||||
};
|
||||
newStyleFunction.propTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
...styleFunction.propTypes,
|
||||
xs: PropTypes.object,
|
||||
sm: PropTypes.object,
|
||||
md: PropTypes.object,
|
||||
lg: PropTypes.object,
|
||||
xl: PropTypes.object
|
||||
} : {};
|
||||
newStyleFunction.filterProps = ['xs', 'sm', 'md', 'lg', 'xl', ...styleFunction.filterProps];
|
||||
return newStyleFunction;
|
||||
}
|
||||
export function createEmptyBreakpointObject(breakpointsInput = {}) {
|
||||
const breakpointsInOrder = breakpointsInput.keys?.reduce((acc, key) => {
|
||||
const breakpointStyleKey = breakpointsInput.up(key);
|
||||
acc[breakpointStyleKey] = {};
|
||||
return acc;
|
||||
}, {});
|
||||
return breakpointsInOrder || {};
|
||||
}
|
||||
export function removeUnusedBreakpoints(breakpointKeys, style) {
|
||||
return breakpointKeys.reduce((acc, key) => {
|
||||
const breakpointOutput = acc[key];
|
||||
const isBreakpointUnused = !breakpointOutput || Object.keys(breakpointOutput).length === 0;
|
||||
if (isBreakpointUnused) {
|
||||
delete acc[key];
|
||||
}
|
||||
return acc;
|
||||
}, style);
|
||||
}
|
||||
export function mergeBreakpointsInOrder(breakpointsInput, ...styles) {
|
||||
const emptyBreakpoints = createEmptyBreakpointObject(breakpointsInput);
|
||||
const mergedOutput = [emptyBreakpoints, ...styles].reduce((prev, next) => deepmerge(prev, next), {});
|
||||
return removeUnusedBreakpoints(Object.keys(emptyBreakpoints), mergedOutput);
|
||||
}
|
||||
|
||||
// compute base for responsive values; e.g.,
|
||||
// [1,2,3] => {xs: true, sm: true, md: true}
|
||||
// {xs: 1, sm: 2, md: 3} => {xs: true, sm: true, md: true}
|
||||
export function computeBreakpointsBase(breakpointValues, themeBreakpoints) {
|
||||
// fixed value
|
||||
if (typeof breakpointValues !== 'object') {
|
||||
return {};
|
||||
}
|
||||
const base = {};
|
||||
const breakpointsKeys = Object.keys(themeBreakpoints);
|
||||
if (Array.isArray(breakpointValues)) {
|
||||
breakpointsKeys.forEach((breakpoint, i) => {
|
||||
if (i < breakpointValues.length) {
|
||||
base[breakpoint] = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
breakpointsKeys.forEach(breakpoint => {
|
||||
if (breakpointValues[breakpoint] != null) {
|
||||
base[breakpoint] = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
return base;
|
||||
}
|
||||
export function resolveBreakpointValues({
|
||||
values: breakpointValues,
|
||||
breakpoints: themeBreakpoints,
|
||||
base: customBase
|
||||
}) {
|
||||
const base = customBase || computeBreakpointsBase(breakpointValues, themeBreakpoints);
|
||||
const keys = Object.keys(base);
|
||||
if (keys.length === 0) {
|
||||
return breakpointValues;
|
||||
}
|
||||
let previous;
|
||||
return keys.reduce((acc, breakpoint, i) => {
|
||||
if (Array.isArray(breakpointValues)) {
|
||||
acc[breakpoint] = breakpointValues[i] != null ? breakpointValues[i] : breakpointValues[previous];
|
||||
previous = i;
|
||||
} else if (typeof breakpointValues === 'object') {
|
||||
acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous];
|
||||
previous = breakpoint;
|
||||
} else {
|
||||
acc[breakpoint] = breakpointValues;
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
export default breakpoints;
|
||||
2
node_modules/@mui/system/modern/breakpoints/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/breakpoints/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./breakpoints.js";
|
||||
export * from "./breakpoints.js";
|
||||
345
node_modules/@mui/system/modern/colorManipulator/colorManipulator.js
generated
vendored
Normal file
345
node_modules/@mui/system/modern/colorManipulator/colorManipulator.js
generated
vendored
Normal file
@@ -0,0 +1,345 @@
|
||||
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import clamp from '@mui/utils/clamp';
|
||||
/**
|
||||
* Returns a number whose value is limited to the given range.
|
||||
* @param {number} value The value to be clamped
|
||||
* @param {number} min The lower boundary of the output range
|
||||
* @param {number} max The upper boundary of the output range
|
||||
* @returns {number} A number in the range [min, max]
|
||||
*/
|
||||
function clampWrapper(value, min = 0, max = 1) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (value < min || value > max) {
|
||||
console.error(`MUI: The value provided ${value} is out of range [${min}, ${max}].`);
|
||||
}
|
||||
}
|
||||
return clamp(value, min, max);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a color from CSS hex format to CSS rgb format.
|
||||
* @param {string} color - Hex color, i.e. #nnn or #nnnnnn
|
||||
* @returns {string} A CSS rgb color string
|
||||
*/
|
||||
export function hexToRgb(color) {
|
||||
color = color.slice(1);
|
||||
const re = new RegExp(`.{1,${color.length >= 6 ? 2 : 1}}`, 'g');
|
||||
let colors = color.match(re);
|
||||
if (colors && colors[0].length === 1) {
|
||||
colors = colors.map(n => n + n);
|
||||
}
|
||||
return colors ? `rgb${colors.length === 4 ? 'a' : ''}(${colors.map((n, index) => {
|
||||
return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1000) / 1000;
|
||||
}).join(', ')})` : '';
|
||||
}
|
||||
function intToHex(int) {
|
||||
const hex = int.toString(16);
|
||||
return hex.length === 1 ? `0${hex}` : hex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an object with the type and values of a color.
|
||||
*
|
||||
* Note: Does not support rgb % values.
|
||||
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
|
||||
* @returns {object} - A MUI color object: {type: string, values: number[]}
|
||||
*/
|
||||
export function decomposeColor(color) {
|
||||
// Idempotent
|
||||
if (color.type) {
|
||||
return color;
|
||||
}
|
||||
if (color.charAt(0) === '#') {
|
||||
return decomposeColor(hexToRgb(color));
|
||||
}
|
||||
const marker = color.indexOf('(');
|
||||
const type = color.substring(0, marker);
|
||||
if (!['rgb', 'rgba', 'hsl', 'hsla', 'color'].includes(type)) {
|
||||
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported \`${color}\` color.
|
||||
The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` : _formatMuiErrorMessage(9, color));
|
||||
}
|
||||
let values = color.substring(marker + 1, color.length - 1);
|
||||
let colorSpace;
|
||||
if (type === 'color') {
|
||||
values = values.split(' ');
|
||||
colorSpace = values.shift();
|
||||
if (values.length === 4 && values[3].charAt(0) === '/') {
|
||||
values[3] = values[3].slice(1);
|
||||
}
|
||||
if (!['srgb', 'display-p3', 'a98-rgb', 'prophoto-rgb', 'rec-2020'].includes(colorSpace)) {
|
||||
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${colorSpace}\` color space.
|
||||
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.` : _formatMuiErrorMessage(10, colorSpace));
|
||||
}
|
||||
} else {
|
||||
values = values.split(',');
|
||||
}
|
||||
values = values.map(value => parseFloat(value));
|
||||
return {
|
||||
type,
|
||||
values,
|
||||
colorSpace
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a channel created from the input color.
|
||||
*
|
||||
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
|
||||
* @returns {string} - The channel for the color, that can be used in rgba or hsla colors
|
||||
*/
|
||||
export const colorChannel = color => {
|
||||
const decomposedColor = decomposeColor(color);
|
||||
return decomposedColor.values.slice(0, 3).map((val, idx) => decomposedColor.type.includes('hsl') && idx !== 0 ? `${val}%` : val).join(' ');
|
||||
};
|
||||
export const private_safeColorChannel = (color, warning) => {
|
||||
try {
|
||||
return colorChannel(color);
|
||||
} catch (error) {
|
||||
if (warning && process.env.NODE_ENV !== 'production') {
|
||||
console.warn(warning);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a color object with type and values to a string.
|
||||
* @param {object} color - Decomposed color
|
||||
* @param {string} color.type - One of: 'rgb', 'rgba', 'hsl', 'hsla', 'color'
|
||||
* @param {array} color.values - [n,n,n] or [n,n,n,n]
|
||||
* @returns {string} A CSS color string
|
||||
*/
|
||||
export function recomposeColor(color) {
|
||||
const {
|
||||
type,
|
||||
colorSpace
|
||||
} = color;
|
||||
let {
|
||||
values
|
||||
} = color;
|
||||
if (type.includes('rgb')) {
|
||||
// Only convert the first 3 values to int (i.e. not alpha)
|
||||
values = values.map((n, i) => i < 3 ? parseInt(n, 10) : n);
|
||||
} else if (type.includes('hsl')) {
|
||||
values[1] = `${values[1]}%`;
|
||||
values[2] = `${values[2]}%`;
|
||||
}
|
||||
if (type.includes('color')) {
|
||||
values = `${colorSpace} ${values.join(' ')}`;
|
||||
} else {
|
||||
values = `${values.join(', ')}`;
|
||||
}
|
||||
return `${type}(${values})`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a color from CSS rgb format to CSS hex format.
|
||||
* @param {string} color - RGB color, i.e. rgb(n, n, n)
|
||||
* @returns {string} A CSS rgb color string, i.e. #nnnnnn
|
||||
*/
|
||||
export function rgbToHex(color) {
|
||||
// Idempotent
|
||||
if (color.startsWith('#')) {
|
||||
return color;
|
||||
}
|
||||
const {
|
||||
values
|
||||
} = decomposeColor(color);
|
||||
return `#${values.map((n, i) => intToHex(i === 3 ? Math.round(255 * n) : n)).join('')}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a color from hsl format to rgb format.
|
||||
* @param {string} color - HSL color values
|
||||
* @returns {string} rgb color values
|
||||
*/
|
||||
export function hslToRgb(color) {
|
||||
color = decomposeColor(color);
|
||||
const {
|
||||
values
|
||||
} = color;
|
||||
const h = values[0];
|
||||
const s = values[1] / 100;
|
||||
const l = values[2] / 100;
|
||||
const a = s * Math.min(l, 1 - l);
|
||||
const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
||||
let type = 'rgb';
|
||||
const rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];
|
||||
if (color.type === 'hsla') {
|
||||
type += 'a';
|
||||
rgb.push(values[3]);
|
||||
}
|
||||
return recomposeColor({
|
||||
type,
|
||||
values: rgb
|
||||
});
|
||||
}
|
||||
/**
|
||||
* The relative brightness of any point in a color space,
|
||||
* normalized to 0 for darkest black and 1 for lightest white.
|
||||
*
|
||||
* Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
|
||||
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
|
||||
* @returns {number} The relative brightness of the color in the range 0 - 1
|
||||
*/
|
||||
export function getLuminance(color) {
|
||||
color = decomposeColor(color);
|
||||
let rgb = color.type === 'hsl' || color.type === 'hsla' ? decomposeColor(hslToRgb(color)).values : color.values;
|
||||
rgb = rgb.map(val => {
|
||||
if (color.type !== 'color') {
|
||||
val /= 255; // normalized
|
||||
}
|
||||
return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;
|
||||
});
|
||||
|
||||
// Truncate at 3 digits
|
||||
return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the contrast ratio between two colors.
|
||||
*
|
||||
* Formula: https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
|
||||
* @param {string} foreground - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
|
||||
* @param {string} background - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla()
|
||||
* @returns {number} A contrast ratio value in the range 0 - 21.
|
||||
*/
|
||||
export function getContrastRatio(foreground, background) {
|
||||
const lumA = getLuminance(foreground);
|
||||
const lumB = getLuminance(background);
|
||||
return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the absolute transparency of a color.
|
||||
* Any existing alpha values are overwritten.
|
||||
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
|
||||
* @param {number} value - value to set the alpha channel to in the range 0 - 1
|
||||
* @returns {string} A CSS color string. Hex input values are returned as rgb
|
||||
*/
|
||||
export function alpha(color, value) {
|
||||
color = decomposeColor(color);
|
||||
value = clampWrapper(value);
|
||||
if (color.type === 'rgb' || color.type === 'hsl') {
|
||||
color.type += 'a';
|
||||
}
|
||||
if (color.type === 'color') {
|
||||
color.values[3] = `/${value}`;
|
||||
} else {
|
||||
color.values[3] = value;
|
||||
}
|
||||
return recomposeColor(color);
|
||||
}
|
||||
export function private_safeAlpha(color, value, warning) {
|
||||
try {
|
||||
return alpha(color, value);
|
||||
} catch (error) {
|
||||
if (warning && process.env.NODE_ENV !== 'production') {
|
||||
console.warn(warning);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Darkens a color.
|
||||
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
|
||||
* @param {number} coefficient - multiplier in the range 0 - 1
|
||||
* @returns {string} A CSS color string. Hex input values are returned as rgb
|
||||
*/
|
||||
export function darken(color, coefficient) {
|
||||
color = decomposeColor(color);
|
||||
coefficient = clampWrapper(coefficient);
|
||||
if (color.type.includes('hsl')) {
|
||||
color.values[2] *= 1 - coefficient;
|
||||
} else if (color.type.includes('rgb') || color.type.includes('color')) {
|
||||
for (let i = 0; i < 3; i += 1) {
|
||||
color.values[i] *= 1 - coefficient;
|
||||
}
|
||||
}
|
||||
return recomposeColor(color);
|
||||
}
|
||||
export function private_safeDarken(color, coefficient, warning) {
|
||||
try {
|
||||
return darken(color, coefficient);
|
||||
} catch (error) {
|
||||
if (warning && process.env.NODE_ENV !== 'production') {
|
||||
console.warn(warning);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lightens a color.
|
||||
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
|
||||
* @param {number} coefficient - multiplier in the range 0 - 1
|
||||
* @returns {string} A CSS color string. Hex input values are returned as rgb
|
||||
*/
|
||||
export function lighten(color, coefficient) {
|
||||
color = decomposeColor(color);
|
||||
coefficient = clampWrapper(coefficient);
|
||||
if (color.type.includes('hsl')) {
|
||||
color.values[2] += (100 - color.values[2]) * coefficient;
|
||||
} else if (color.type.includes('rgb')) {
|
||||
for (let i = 0; i < 3; i += 1) {
|
||||
color.values[i] += (255 - color.values[i]) * coefficient;
|
||||
}
|
||||
} else if (color.type.includes('color')) {
|
||||
for (let i = 0; i < 3; i += 1) {
|
||||
color.values[i] += (1 - color.values[i]) * coefficient;
|
||||
}
|
||||
}
|
||||
return recomposeColor(color);
|
||||
}
|
||||
export function private_safeLighten(color, coefficient, warning) {
|
||||
try {
|
||||
return lighten(color, coefficient);
|
||||
} catch (error) {
|
||||
if (warning && process.env.NODE_ENV !== 'production') {
|
||||
console.warn(warning);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Darken or lighten a color, depending on its luminance.
|
||||
* Light colors are darkened, dark colors are lightened.
|
||||
* @param {string} color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()
|
||||
* @param {number} coefficient=0.15 - multiplier in the range 0 - 1
|
||||
* @returns {string} A CSS color string. Hex input values are returned as rgb
|
||||
*/
|
||||
export function emphasize(color, coefficient = 0.15) {
|
||||
return getLuminance(color) > 0.5 ? darken(color, coefficient) : lighten(color, coefficient);
|
||||
}
|
||||
export function private_safeEmphasize(color, coefficient, warning) {
|
||||
try {
|
||||
return emphasize(color, coefficient);
|
||||
} catch (error) {
|
||||
if (warning && process.env.NODE_ENV !== 'production') {
|
||||
console.warn(warning);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Blend a transparent overlay color with a background color, resulting in a single
|
||||
* RGB color.
|
||||
* @param {string} background - CSS color
|
||||
* @param {string} overlay - CSS color
|
||||
* @param {number} opacity - Opacity multiplier in the range 0 - 1
|
||||
* @param {number} [gamma=1.0] - Gamma correction factor. For gamma-correct blending, 2.2 is usual.
|
||||
*/
|
||||
export function blend(background, overlay, opacity, gamma = 1.0) {
|
||||
const blendChannel = (b, o) => Math.round((b ** (1 / gamma) * (1 - opacity) + o ** (1 / gamma) * opacity) ** gamma);
|
||||
const backgroundColor = decomposeColor(background);
|
||||
const overlayColor = decomposeColor(overlay);
|
||||
const rgb = [blendChannel(backgroundColor.values[0], overlayColor.values[0]), blendChannel(backgroundColor.values[1], overlayColor.values[1]), blendChannel(backgroundColor.values[2], overlayColor.values[2])];
|
||||
return recomposeColor({
|
||||
type: 'rgb',
|
||||
values: rgb
|
||||
});
|
||||
}
|
||||
1
node_modules/@mui/system/modern/colorManipulator/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/colorManipulator/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./colorManipulator.js";
|
||||
24
node_modules/@mui/system/modern/compose/compose.js
generated
vendored
Normal file
24
node_modules/@mui/system/modern/compose/compose.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import merge from "../merge/index.js";
|
||||
function compose(...styles) {
|
||||
const handlers = styles.reduce((acc, style) => {
|
||||
style.filterProps.forEach(prop => {
|
||||
acc[prop] = style;
|
||||
});
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
// false positive
|
||||
// eslint-disable-next-line react/function-component-definition
|
||||
const fn = props => {
|
||||
return Object.keys(props).reduce((acc, prop) => {
|
||||
if (handlers[prop]) {
|
||||
return merge(acc, handlers[prop](props));
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
};
|
||||
fn.propTypes = process.env.NODE_ENV !== 'production' ? styles.reduce((acc, style) => Object.assign(acc, style.propTypes), {}) : {};
|
||||
fn.filterProps = styles.reduce((acc, style) => acc.concat(style.filterProps), []);
|
||||
return fn;
|
||||
}
|
||||
export default compose;
|
||||
1
node_modules/@mui/system/modern/compose/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/compose/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./compose.js";
|
||||
35
node_modules/@mui/system/modern/createBox/createBox.js
generated
vendored
Normal file
35
node_modules/@mui/system/modern/createBox/createBox.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import styled from '@mui/styled-engine';
|
||||
import styleFunctionSx, { extendSxProp } from "../styleFunctionSx/index.js";
|
||||
import useTheme from "../useTheme/index.js";
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default function createBox(options = {}) {
|
||||
const {
|
||||
themeId,
|
||||
defaultTheme,
|
||||
defaultClassName = 'MuiBox-root',
|
||||
generateClassName
|
||||
} = options;
|
||||
const BoxRoot = styled('div', {
|
||||
shouldForwardProp: prop => prop !== 'theme' && prop !== 'sx' && prop !== 'as'
|
||||
})(styleFunctionSx);
|
||||
const Box = /*#__PURE__*/React.forwardRef(function Box(inProps, ref) {
|
||||
const theme = useTheme(defaultTheme);
|
||||
const {
|
||||
className,
|
||||
component = 'div',
|
||||
...other
|
||||
} = extendSxProp(inProps);
|
||||
return /*#__PURE__*/_jsx(BoxRoot, {
|
||||
as: component,
|
||||
ref: ref,
|
||||
className: clsx(className, generateClassName ? generateClassName(defaultClassName) : defaultClassName),
|
||||
theme: themeId ? theme[themeId] || theme : theme,
|
||||
...other
|
||||
});
|
||||
});
|
||||
return Box;
|
||||
}
|
||||
1
node_modules/@mui/system/modern/createBox/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/createBox/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./createBox.js";
|
||||
81
node_modules/@mui/system/modern/createBreakpoints/createBreakpoints.js
generated
vendored
Normal file
81
node_modules/@mui/system/modern/createBreakpoints/createBreakpoints.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
// Sorted ASC by size. That's important.
|
||||
// It can't be configured as it's used statically for propTypes.
|
||||
export const breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
|
||||
const sortBreakpointsValues = values => {
|
||||
const breakpointsAsArray = Object.keys(values).map(key => ({
|
||||
key,
|
||||
val: values[key]
|
||||
})) || [];
|
||||
// Sort in ascending order
|
||||
breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
|
||||
return breakpointsAsArray.reduce((acc, obj) => {
|
||||
return {
|
||||
...acc,
|
||||
[obj.key]: obj.val
|
||||
};
|
||||
}, {});
|
||||
};
|
||||
|
||||
// Keep in mind that @media is inclusive by the CSS specification.
|
||||
export default function createBreakpoints(breakpoints) {
|
||||
const {
|
||||
// The breakpoint **start** at this value.
|
||||
// For instance with the first breakpoint xs: [xs, sm).
|
||||
values = {
|
||||
xs: 0,
|
||||
// phone
|
||||
sm: 600,
|
||||
// tablet
|
||||
md: 900,
|
||||
// small laptop
|
||||
lg: 1200,
|
||||
// desktop
|
||||
xl: 1536 // large screen
|
||||
},
|
||||
unit = 'px',
|
||||
step = 5,
|
||||
...other
|
||||
} = breakpoints;
|
||||
const sortedValues = sortBreakpointsValues(values);
|
||||
const keys = Object.keys(sortedValues);
|
||||
function up(key) {
|
||||
const value = typeof values[key] === 'number' ? values[key] : key;
|
||||
return `@media (min-width:${value}${unit})`;
|
||||
}
|
||||
function down(key) {
|
||||
const value = typeof values[key] === 'number' ? values[key] : key;
|
||||
return `@media (max-width:${value - step / 100}${unit})`;
|
||||
}
|
||||
function between(start, end) {
|
||||
const endIndex = keys.indexOf(end);
|
||||
return `@media (min-width:${typeof values[start] === 'number' ? values[start] : start}${unit}) and ` + `(max-width:${(endIndex !== -1 && typeof values[keys[endIndex]] === 'number' ? values[keys[endIndex]] : end) - step / 100}${unit})`;
|
||||
}
|
||||
function only(key) {
|
||||
if (keys.indexOf(key) + 1 < keys.length) {
|
||||
return between(key, keys[keys.indexOf(key) + 1]);
|
||||
}
|
||||
return up(key);
|
||||
}
|
||||
function not(key) {
|
||||
// handle first and last key separately, for better readability
|
||||
const keyIndex = keys.indexOf(key);
|
||||
if (keyIndex === 0) {
|
||||
return up(keys[1]);
|
||||
}
|
||||
if (keyIndex === keys.length - 1) {
|
||||
return down(keys[keyIndex]);
|
||||
}
|
||||
return between(key, keys[keys.indexOf(key) + 1]).replace('@media', '@media not all and');
|
||||
}
|
||||
return {
|
||||
keys,
|
||||
values: sortedValues,
|
||||
up,
|
||||
down,
|
||||
between,
|
||||
only,
|
||||
not,
|
||||
unit,
|
||||
...other
|
||||
};
|
||||
}
|
||||
3
node_modules/@mui/system/modern/createBreakpoints/index.js
generated
vendored
Normal file
3
node_modules/@mui/system/modern/createBreakpoints/index.js
generated
vendored
Normal 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";
|
||||
241
node_modules/@mui/system/modern/createStyled/createStyled.js
generated
vendored
Normal file
241
node_modules/@mui/system/modern/createStyled/createStyled.js
generated
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
import styledEngineStyled, { internal_processStyles as processStyles } from '@mui/styled-engine';
|
||||
import { isPlainObject } from '@mui/utils/deepmerge';
|
||||
import capitalize from '@mui/utils/capitalize';
|
||||
import getDisplayName from '@mui/utils/getDisplayName';
|
||||
import createTheme from "../createTheme/index.js";
|
||||
import styleFunctionSx from "../styleFunctionSx/index.js";
|
||||
export const systemDefaultTheme = createTheme();
|
||||
|
||||
// Update /system/styled/#api in case if this changes
|
||||
export function shouldForwardProp(prop) {
|
||||
return prop !== 'ownerState' && prop !== 'theme' && prop !== 'sx' && prop !== 'as';
|
||||
}
|
||||
function resolveTheme(themeId, theme, defaultTheme) {
|
||||
return isObjectEmpty(theme) ? defaultTheme : theme[themeId] || theme;
|
||||
}
|
||||
const PROCESSED_PROPS = Symbol('mui.processed_props');
|
||||
function attachTheme(props, themeId, defaultTheme) {
|
||||
if (PROCESSED_PROPS in props) {
|
||||
return props[PROCESSED_PROPS];
|
||||
}
|
||||
const processedProps = {
|
||||
...props,
|
||||
theme: resolveTheme(themeId, props.theme, defaultTheme)
|
||||
};
|
||||
props[PROCESSED_PROPS] = processedProps;
|
||||
processedProps[PROCESSED_PROPS] = processedProps;
|
||||
return processedProps;
|
||||
}
|
||||
function defaultOverridesResolver(slot) {
|
||||
if (!slot) {
|
||||
return null;
|
||||
}
|
||||
return (_props, styles) => styles[slot];
|
||||
}
|
||||
function processStyle(style, props) {
|
||||
const resolvedStyle = typeof style === 'function' ? style(props) : style;
|
||||
if (Array.isArray(resolvedStyle)) {
|
||||
return resolvedStyle.flatMap(subStyle => processStyle(subStyle, props));
|
||||
}
|
||||
if (Array.isArray(resolvedStyle?.variants)) {
|
||||
const {
|
||||
variants,
|
||||
...otherStyles
|
||||
} = resolvedStyle;
|
||||
let result = otherStyles;
|
||||
let mergedState; // We might not need it, initalized lazily
|
||||
|
||||
/* eslint-disable no-labels */
|
||||
variantLoop: for (let i = 0; i < variants.length; i += 1) {
|
||||
const variant = variants[i];
|
||||
if (typeof variant.props === 'function') {
|
||||
mergedState ?? (mergedState = {
|
||||
...props,
|
||||
...props.ownerState,
|
||||
ownerState: props.ownerState
|
||||
});
|
||||
if (!variant.props(mergedState)) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
for (const key in variant.props) {
|
||||
if (props[key] !== variant.props[key] && props.ownerState?.[key] !== variant.props[key]) {
|
||||
continue variantLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!Array.isArray(result)) {
|
||||
result = [result];
|
||||
}
|
||||
if (typeof variant.style === 'function') {
|
||||
mergedState ?? (mergedState = {
|
||||
...props,
|
||||
...props.ownerState,
|
||||
ownerState: props.ownerState
|
||||
});
|
||||
result.push(variant.style(mergedState));
|
||||
} else {
|
||||
result.push(variant.style);
|
||||
}
|
||||
}
|
||||
/* eslint-enable no-labels */
|
||||
|
||||
return result;
|
||||
}
|
||||
return resolvedStyle;
|
||||
}
|
||||
export default function createStyled(input = {}) {
|
||||
const {
|
||||
themeId,
|
||||
defaultTheme = systemDefaultTheme,
|
||||
rootShouldForwardProp = shouldForwardProp,
|
||||
slotShouldForwardProp = shouldForwardProp
|
||||
} = input;
|
||||
const systemSx = props => {
|
||||
return styleFunctionSx(attachTheme(props, themeId, defaultTheme));
|
||||
};
|
||||
systemSx.__mui_systemSx = true;
|
||||
const styled = (tag, inputOptions = {}) => {
|
||||
// Filter out the `sx` style function from the previous styled component to prevent unnecessary styles generated by the composite components.
|
||||
processStyles(tag, styles => styles.filter(style => !style?.__mui_systemSx));
|
||||
const {
|
||||
name: componentName,
|
||||
slot: componentSlot,
|
||||
skipVariantsResolver: inputSkipVariantsResolver,
|
||||
skipSx: inputSkipSx,
|
||||
// TODO v6: remove `lowercaseFirstLetter()` in the next major release
|
||||
// For more details: https://github.com/mui/material-ui/pull/37908
|
||||
overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot)),
|
||||
...options
|
||||
} = inputOptions;
|
||||
|
||||
// if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
|
||||
const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver :
|
||||
// TODO v6: remove `Root` in the next major release
|
||||
// For more details: https://github.com/mui/material-ui/pull/37908
|
||||
componentSlot && componentSlot !== 'Root' && componentSlot !== 'root' || false;
|
||||
const skipSx = inputSkipSx || false;
|
||||
let label;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (componentName) {
|
||||
// TODO v6: remove `lowercaseFirstLetter()` in the next major release
|
||||
// For more details: https://github.com/mui/material-ui/pull/37908
|
||||
label = `${componentName}-${lowercaseFirstLetter(componentSlot || 'Root')}`;
|
||||
}
|
||||
}
|
||||
let shouldForwardPropOption = shouldForwardProp;
|
||||
|
||||
// TODO v6: remove `Root` in the next major release
|
||||
// For more details: https://github.com/mui/material-ui/pull/37908
|
||||
if (componentSlot === 'Root' || componentSlot === 'root') {
|
||||
shouldForwardPropOption = rootShouldForwardProp;
|
||||
} else if (componentSlot) {
|
||||
// any other slot specified
|
||||
shouldForwardPropOption = slotShouldForwardProp;
|
||||
} else if (isStringTag(tag)) {
|
||||
// for string (html) tag, preserve the behavior in emotion & styled-components.
|
||||
shouldForwardPropOption = undefined;
|
||||
}
|
||||
const defaultStyledResolver = styledEngineStyled(tag, {
|
||||
shouldForwardProp: shouldForwardPropOption,
|
||||
label,
|
||||
...options
|
||||
});
|
||||
const transformStyleArg = style => {
|
||||
// On the server Emotion doesn't use React.forwardRef for creating components, so the created
|
||||
// component stays as a function. This condition makes sure that we do not interpolate functions
|
||||
// which are basically components used as a selectors.
|
||||
if (typeof style === 'function' && style.__emotion_real !== style || isPlainObject(style)) {
|
||||
return props => processStyle(style, attachTheme(props, themeId, defaultTheme));
|
||||
}
|
||||
return style;
|
||||
};
|
||||
const muiStyledResolver = (style, ...expressions) => {
|
||||
let transformedStyle = transformStyleArg(style);
|
||||
const expressionsWithDefaultTheme = expressions ? expressions.map(transformStyleArg) : [];
|
||||
if (componentName && overridesResolver) {
|
||||
expressionsWithDefaultTheme.push(props => {
|
||||
const theme = resolveTheme(themeId, props.theme, defaultTheme);
|
||||
if (!theme.components || !theme.components[componentName] || !theme.components[componentName].styleOverrides) {
|
||||
return null;
|
||||
}
|
||||
const styleOverrides = theme.components[componentName].styleOverrides;
|
||||
const resolvedStyleOverrides = {};
|
||||
const propsWithTheme = attachTheme(props, themeId, defaultTheme);
|
||||
|
||||
// TODO: v7 remove iteration and use `resolveStyleArg(styleOverrides[slot])` directly
|
||||
// eslint-disable-next-line guard-for-in
|
||||
for (const slotKey in styleOverrides) {
|
||||
resolvedStyleOverrides[slotKey] = processStyle(styleOverrides[slotKey], propsWithTheme);
|
||||
}
|
||||
return overridesResolver(props, resolvedStyleOverrides);
|
||||
});
|
||||
}
|
||||
if (componentName && !skipVariantsResolver) {
|
||||
expressionsWithDefaultTheme.push(props => {
|
||||
const theme = resolveTheme(themeId, props.theme, defaultTheme);
|
||||
const themeVariants = theme?.components?.[componentName]?.variants;
|
||||
if (!themeVariants) {
|
||||
return null;
|
||||
}
|
||||
return processStyle({
|
||||
variants: themeVariants
|
||||
}, attachTheme(props, themeId, defaultTheme));
|
||||
});
|
||||
}
|
||||
if (!skipSx) {
|
||||
expressionsWithDefaultTheme.push(systemSx);
|
||||
}
|
||||
const numOfCustomFnsApplied = expressionsWithDefaultTheme.length - expressions.length;
|
||||
if (Array.isArray(style) && numOfCustomFnsApplied > 0) {
|
||||
const placeholders = new Array(numOfCustomFnsApplied).fill('');
|
||||
// If the type is array, than we need to add placeholders in the template for the overrides, variants and the sx styles.
|
||||
transformedStyle = [...style, ...placeholders];
|
||||
transformedStyle.raw = [...style.raw, ...placeholders];
|
||||
}
|
||||
const Component = defaultStyledResolver(transformedStyle, ...expressionsWithDefaultTheme);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
let displayName;
|
||||
if (componentName) {
|
||||
displayName = `${componentName}${capitalize(componentSlot || '')}`;
|
||||
}
|
||||
if (displayName === undefined) {
|
||||
displayName = `Styled(${getDisplayName(tag)})`;
|
||||
}
|
||||
Component.displayName = displayName;
|
||||
}
|
||||
if (tag.muiName) {
|
||||
Component.muiName = tag.muiName;
|
||||
}
|
||||
return Component;
|
||||
};
|
||||
if (defaultStyledResolver.withConfig) {
|
||||
muiStyledResolver.withConfig = defaultStyledResolver.withConfig;
|
||||
}
|
||||
return muiStyledResolver;
|
||||
};
|
||||
return styled;
|
||||
}
|
||||
function isObjectEmpty(object) {
|
||||
// eslint-disable-next-line
|
||||
for (const _ in object) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// https://github.com/emotion-js/emotion/blob/26ded6109fcd8ca9875cc2ce4564fee678a3f3c5/packages/styled/src/utils.js#L40
|
||||
function isStringTag(tag) {
|
||||
return typeof tag === 'string' &&
|
||||
// 96 is one less than the char code
|
||||
// for "a" so this is checking that
|
||||
// it's a lowercase character
|
||||
tag.charCodeAt(0) > 96;
|
||||
}
|
||||
function lowercaseFirstLetter(string) {
|
||||
if (!string) {
|
||||
return string;
|
||||
}
|
||||
return string.charAt(0).toLowerCase() + string.slice(1);
|
||||
}
|
||||
2
node_modules/@mui/system/modern/createStyled/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/createStyled/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./createStyled.js";
|
||||
export * from "./createStyled.js";
|
||||
83
node_modules/@mui/system/modern/createTheme/applyStyles.js
generated
vendored
Normal file
83
node_modules/@mui/system/modern/createTheme/applyStyles.js
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* ✅ [{ background: '#e5e5e5' }, theme.applyStyles('dark', { background: '#1c1c1c' })]
|
||||
*
|
||||
* 🚫 { background: '#e5e5e5', ...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={theme => [
|
||||
* { background: '#e5e5e5' },
|
||||
* 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(key, styles) {
|
||||
// @ts-expect-error this is 'any' type
|
||||
const theme = this;
|
||||
if (theme.vars) {
|
||||
if (!theme.colorSchemes?.[key] || typeof theme.getColorSchemeSelector !== 'function') {
|
||||
return {};
|
||||
}
|
||||
// If CssVarsProvider is used as a provider, returns '*:where({selector}) &'
|
||||
let selector = theme.getColorSchemeSelector(key);
|
||||
if (selector === '&') {
|
||||
return styles;
|
||||
}
|
||||
if (selector.includes('data-') || selector.includes('.')) {
|
||||
// '*' is required as a workaround for Emotion issue (https://github.com/emotion-js/emotion/issues/2836)
|
||||
selector = `*:where(${selector.replace(/\s*&$/, '')}) &`;
|
||||
}
|
||||
return {
|
||||
[selector]: styles
|
||||
};
|
||||
}
|
||||
if (theme.palette.mode === key) {
|
||||
return styles;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
31
node_modules/@mui/system/modern/createTheme/createSpacing.js
generated
vendored
Normal file
31
node_modules/@mui/system/modern/createTheme/createSpacing.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import { createUnarySpacing } from "../spacing/index.js";
|
||||
|
||||
// The different signatures imply different meaning for their arguments that can't be expressed structurally.
|
||||
// We express the difference with variable names.
|
||||
|
||||
export default function createSpacing(spacingInput = 8,
|
||||
// Material Design layouts are visually balanced. Most measurements align to an 8dp grid, which aligns both spacing and the overall layout.
|
||||
// Smaller components, such as icons, can align to a 4dp grid.
|
||||
// https://m2.material.io/design/layout/understanding-layout.html
|
||||
transform = createUnarySpacing({
|
||||
spacing: spacingInput
|
||||
})) {
|
||||
// Already transformed.
|
||||
if (spacingInput.mui) {
|
||||
return spacingInput;
|
||||
}
|
||||
const spacing = (...argsInput) => {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!(argsInput.length <= 4)) {
|
||||
console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${argsInput.length}`);
|
||||
}
|
||||
}
|
||||
const args = argsInput.length === 0 ? [1] : argsInput;
|
||||
return args.map(argument => {
|
||||
const output = transform(argument);
|
||||
return typeof output === 'number' ? `${output}px` : output;
|
||||
}).join(' ');
|
||||
};
|
||||
spacing.mui = true;
|
||||
return spacing;
|
||||
}
|
||||
49
node_modules/@mui/system/modern/createTheme/createTheme.js
generated
vendored
Normal file
49
node_modules/@mui/system/modern/createTheme/createTheme.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import deepmerge from '@mui/utils/deepmerge';
|
||||
import createBreakpoints from "../createBreakpoints/createBreakpoints.js";
|
||||
import cssContainerQueries from "../cssContainerQueries/index.js";
|
||||
import shape from "./shape.js";
|
||||
import createSpacing from "./createSpacing.js";
|
||||
import styleFunctionSx from "../styleFunctionSx/styleFunctionSx.js";
|
||||
import defaultSxConfig from "../styleFunctionSx/defaultSxConfig.js";
|
||||
import applyStyles from "./applyStyles.js";
|
||||
function createTheme(options = {}, ...args) {
|
||||
const {
|
||||
breakpoints: breakpointsInput = {},
|
||||
palette: paletteInput = {},
|
||||
spacing: spacingInput,
|
||||
shape: shapeInput = {},
|
||||
...other
|
||||
} = options;
|
||||
const breakpoints = createBreakpoints(breakpointsInput);
|
||||
const spacing = createSpacing(spacingInput);
|
||||
let muiTheme = deepmerge({
|
||||
breakpoints,
|
||||
direction: 'ltr',
|
||||
components: {},
|
||||
// Inject component definitions.
|
||||
palette: {
|
||||
mode: 'light',
|
||||
...paletteInput
|
||||
},
|
||||
spacing,
|
||||
shape: {
|
||||
...shape,
|
||||
...shapeInput
|
||||
}
|
||||
}, other);
|
||||
muiTheme = cssContainerQueries(muiTheme);
|
||||
muiTheme.applyStyles = applyStyles;
|
||||
muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
|
||||
muiTheme.unstable_sxConfig = {
|
||||
...defaultSxConfig,
|
||||
...other?.unstable_sxConfig
|
||||
};
|
||||
muiTheme.unstable_sx = function sx(props) {
|
||||
return styleFunctionSx({
|
||||
sx: props,
|
||||
theme: this
|
||||
});
|
||||
};
|
||||
return muiTheme;
|
||||
}
|
||||
export default createTheme;
|
||||
3
node_modules/@mui/system/modern/createTheme/index.js
generated
vendored
Normal file
3
node_modules/@mui/system/modern/createTheme/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default } from "./createTheme.js";
|
||||
export { default as private_createBreakpoints } from "../createBreakpoints/createBreakpoints.js";
|
||||
export { default as unstable_applyStyles } from "./applyStyles.js";
|
||||
4
node_modules/@mui/system/modern/createTheme/shape.js
generated
vendored
Normal file
4
node_modules/@mui/system/modern/createTheme/shape.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
const shape = {
|
||||
borderRadius: 4
|
||||
};
|
||||
export default shape;
|
||||
70
node_modules/@mui/system/modern/cssContainerQueries/cssContainerQueries.js
generated
vendored
Normal file
70
node_modules/@mui/system/modern/cssContainerQueries/cssContainerQueries.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
||||
/**
|
||||
* 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 function sortContainerQueries(theme, css) {
|
||||
if (!theme.containerQueries) {
|
||||
return css;
|
||||
}
|
||||
const sorted = Object.keys(css).filter(key => key.startsWith('@container')).sort((a, b) => {
|
||||
const regex = /min-width:\s*([0-9.]+)/;
|
||||
return +(a.match(regex)?.[1] || 0) - +(b.match(regex)?.[1] || 0);
|
||||
});
|
||||
if (!sorted.length) {
|
||||
return css;
|
||||
}
|
||||
return sorted.reduce((acc, key) => {
|
||||
const value = css[key];
|
||||
delete acc[key];
|
||||
acc[key] = value;
|
||||
return acc;
|
||||
}, {
|
||||
...css
|
||||
});
|
||||
}
|
||||
export function isCqShorthand(breakpointKeys, value) {
|
||||
return value === '@' || value.startsWith('@') && (breakpointKeys.some(key => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
||||
}
|
||||
export function getContainerQuery(theme, shorthand) {
|
||||
const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
|
||||
if (!matches) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
|
||||
For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.` : _formatMuiErrorMessage(18, `(${shorthand})`));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
const [, containerQuery, containerName] = matches;
|
||||
const value = Number.isNaN(+containerQuery) ? containerQuery || 0 : +containerQuery;
|
||||
return theme.containerQueries(containerName).up(value);
|
||||
}
|
||||
export default function cssContainerQueries(themeInput) {
|
||||
const toContainerQuery = (mediaQuery, name) => mediaQuery.replace('@media', name ? `@container ${name}` : '@container');
|
||||
function attachCq(node, name) {
|
||||
node.up = (...args) => toContainerQuery(themeInput.breakpoints.up(...args), name);
|
||||
node.down = (...args) => toContainerQuery(themeInput.breakpoints.down(...args), name);
|
||||
node.between = (...args) => toContainerQuery(themeInput.breakpoints.between(...args), name);
|
||||
node.only = (...args) => toContainerQuery(themeInput.breakpoints.only(...args), name);
|
||||
node.not = (...args) => {
|
||||
const result = toContainerQuery(themeInput.breakpoints.not(...args), name);
|
||||
if (result.includes('not all and')) {
|
||||
// `@container` does not work with `not all and`, so need to invert the logic
|
||||
return result.replace('not all and ', '').replace('min-width:', 'width<').replace('max-width:', 'width>').replace('and', 'or');
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
const node = {};
|
||||
const containerQueries = name => {
|
||||
attachCq(node, name);
|
||||
return node;
|
||||
};
|
||||
attachCq(containerQueries);
|
||||
return {
|
||||
...themeInput,
|
||||
containerQueries
|
||||
};
|
||||
}
|
||||
2
node_modules/@mui/system/modern/cssContainerQueries/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/cssContainerQueries/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./cssContainerQueries.js";
|
||||
export { isCqShorthand, getContainerQuery, sortContainerQueries } from "./cssContainerQueries.js";
|
||||
85
node_modules/@mui/system/modern/cssGrid/cssGrid.js
generated
vendored
Normal file
85
node_modules/@mui/system/modern/cssGrid/cssGrid.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
import style from "../style/index.js";
|
||||
import compose from "../compose/index.js";
|
||||
import { createUnaryUnit, getValue } from "../spacing/index.js";
|
||||
import { handleBreakpoints } from "../breakpoints/index.js";
|
||||
import responsivePropType from "../responsivePropType/index.js";
|
||||
|
||||
// false positive
|
||||
// eslint-disable-next-line react/function-component-definition
|
||||
export const gap = props => {
|
||||
if (props.gap !== undefined && props.gap !== null) {
|
||||
const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'gap');
|
||||
const styleFromPropValue = propValue => ({
|
||||
gap: getValue(transformer, propValue)
|
||||
});
|
||||
return handleBreakpoints(props, props.gap, styleFromPropValue);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
gap.propTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
gap: responsivePropType
|
||||
} : {};
|
||||
gap.filterProps = ['gap'];
|
||||
|
||||
// false positive
|
||||
// eslint-disable-next-line react/function-component-definition
|
||||
export const columnGap = props => {
|
||||
if (props.columnGap !== undefined && props.columnGap !== null) {
|
||||
const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'columnGap');
|
||||
const styleFromPropValue = propValue => ({
|
||||
columnGap: getValue(transformer, propValue)
|
||||
});
|
||||
return handleBreakpoints(props, props.columnGap, styleFromPropValue);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
columnGap.propTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
columnGap: responsivePropType
|
||||
} : {};
|
||||
columnGap.filterProps = ['columnGap'];
|
||||
|
||||
// false positive
|
||||
// eslint-disable-next-line react/function-component-definition
|
||||
export const rowGap = props => {
|
||||
if (props.rowGap !== undefined && props.rowGap !== null) {
|
||||
const transformer = createUnaryUnit(props.theme, 'spacing', 8, 'rowGap');
|
||||
const styleFromPropValue = propValue => ({
|
||||
rowGap: getValue(transformer, propValue)
|
||||
});
|
||||
return handleBreakpoints(props, props.rowGap, styleFromPropValue);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
rowGap.propTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
rowGap: responsivePropType
|
||||
} : {};
|
||||
rowGap.filterProps = ['rowGap'];
|
||||
export const gridColumn = style({
|
||||
prop: 'gridColumn'
|
||||
});
|
||||
export const gridRow = style({
|
||||
prop: 'gridRow'
|
||||
});
|
||||
export const gridAutoFlow = style({
|
||||
prop: 'gridAutoFlow'
|
||||
});
|
||||
export const gridAutoColumns = style({
|
||||
prop: 'gridAutoColumns'
|
||||
});
|
||||
export const gridAutoRows = style({
|
||||
prop: 'gridAutoRows'
|
||||
});
|
||||
export const gridTemplateColumns = style({
|
||||
prop: 'gridTemplateColumns'
|
||||
});
|
||||
export const gridTemplateRows = style({
|
||||
prop: 'gridTemplateRows'
|
||||
});
|
||||
export const gridTemplateAreas = style({
|
||||
prop: 'gridTemplateAreas'
|
||||
});
|
||||
export const gridArea = style({
|
||||
prop: 'gridArea'
|
||||
});
|
||||
const grid = compose(gap, columnGap, rowGap, gridColumn, gridRow, gridAutoFlow, gridAutoColumns, gridAutoRows, gridTemplateColumns, gridTemplateRows, gridTemplateAreas, gridArea);
|
||||
export default grid;
|
||||
2
node_modules/@mui/system/modern/cssGrid/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/cssGrid/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./cssGrid.js";
|
||||
export * from "./cssGrid.js";
|
||||
295
node_modules/@mui/system/modern/cssVars/createCssVarsProvider.js
generated
vendored
Normal file
295
node_modules/@mui/system/modern/cssVars/createCssVarsProvider.js
generated
vendored
Normal file
@@ -0,0 +1,295 @@
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { GlobalStyles } from '@mui/styled-engine';
|
||||
import { useTheme as muiUseTheme } from '@mui/private-theming';
|
||||
import ThemeProvider from "../ThemeProvider/index.js";
|
||||
import InitColorSchemeScript, { DEFAULT_COLOR_SCHEME_STORAGE_KEY, DEFAULT_MODE_STORAGE_KEY } from "../InitColorSchemeScript/InitColorSchemeScript.js";
|
||||
import useCurrentColorScheme from "./useCurrentColorScheme.js";
|
||||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
||||
export const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}';
|
||||
export default function createCssVarsProvider(options) {
|
||||
const {
|
||||
themeId,
|
||||
/**
|
||||
* This `theme` object needs to follow a certain structure to
|
||||
* be used correctly by the finel `CssVarsProvider`. It should have a
|
||||
* `colorSchemes` key with the light and dark (and any other) palette.
|
||||
* It should also ideally have a vars object created using `prepareCssVars`.
|
||||
*/
|
||||
theme: defaultTheme = {},
|
||||
modeStorageKey: defaultModeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
||||
colorSchemeStorageKey: defaultColorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
|
||||
disableTransitionOnChange: designSystemTransitionOnChange = false,
|
||||
defaultColorScheme,
|
||||
resolveTheme
|
||||
} = options;
|
||||
const defaultContext = {
|
||||
allColorSchemes: [],
|
||||
colorScheme: undefined,
|
||||
darkColorScheme: undefined,
|
||||
lightColorScheme: undefined,
|
||||
mode: undefined,
|
||||
setColorScheme: () => {},
|
||||
setMode: () => {},
|
||||
systemMode: undefined
|
||||
};
|
||||
const ColorSchemeContext = /*#__PURE__*/React.createContext(undefined);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
ColorSchemeContext.displayName = 'ColorSchemeContext';
|
||||
}
|
||||
const useColorScheme = () => React.useContext(ColorSchemeContext) || defaultContext;
|
||||
function CssVarsProvider(props) {
|
||||
const {
|
||||
children,
|
||||
theme: themeProp,
|
||||
modeStorageKey = defaultModeStorageKey,
|
||||
colorSchemeStorageKey = defaultColorSchemeStorageKey,
|
||||
disableTransitionOnChange = designSystemTransitionOnChange,
|
||||
storageWindow = typeof window === 'undefined' ? undefined : window,
|
||||
documentNode = typeof document === 'undefined' ? undefined : document,
|
||||
colorSchemeNode = typeof document === 'undefined' ? undefined : document.documentElement,
|
||||
disableNestedContext = false,
|
||||
disableStyleSheetGeneration = false
|
||||
} = props;
|
||||
const hasMounted = React.useRef(false);
|
||||
const upperTheme = muiUseTheme();
|
||||
const ctx = React.useContext(ColorSchemeContext);
|
||||
const nested = !!ctx && !disableNestedContext;
|
||||
const initialTheme = React.useMemo(() => {
|
||||
if (themeProp) {
|
||||
return themeProp;
|
||||
}
|
||||
return typeof defaultTheme === 'function' ? defaultTheme() : defaultTheme;
|
||||
}, [themeProp]);
|
||||
const scopedTheme = initialTheme[themeId];
|
||||
const {
|
||||
colorSchemes = {},
|
||||
components = {},
|
||||
cssVarPrefix,
|
||||
...restThemeProp
|
||||
} = scopedTheme || initialTheme;
|
||||
const joinedColorSchemes = Object.keys(colorSchemes).filter(k => !!colorSchemes[k]).join(',');
|
||||
const allColorSchemes = React.useMemo(() => joinedColorSchemes.split(','), [joinedColorSchemes]);
|
||||
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
||||
const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
|
||||
const defaultMode = colorSchemes[defaultLightColorScheme] && colorSchemes[defaultDarkColorScheme] ? 'system' : colorSchemes[restThemeProp.defaultColorScheme]?.palette?.mode || restThemeProp.palette?.mode;
|
||||
|
||||
// 1. Get the data about the `mode`, `colorScheme`, and setter functions.
|
||||
const {
|
||||
mode: stateMode,
|
||||
setMode,
|
||||
systemMode,
|
||||
lightColorScheme,
|
||||
darkColorScheme,
|
||||
colorScheme: stateColorScheme,
|
||||
setColorScheme
|
||||
} = useCurrentColorScheme({
|
||||
supportedColorSchemes: allColorSchemes,
|
||||
defaultLightColorScheme,
|
||||
defaultDarkColorScheme,
|
||||
modeStorageKey,
|
||||
colorSchemeStorageKey,
|
||||
defaultMode,
|
||||
storageWindow
|
||||
});
|
||||
let mode = stateMode;
|
||||
let colorScheme = stateColorScheme;
|
||||
if (nested) {
|
||||
mode = ctx.mode;
|
||||
colorScheme = ctx.colorScheme;
|
||||
}
|
||||
|
||||
// `colorScheme` is undefined on the server and hydration phase
|
||||
const calculatedColorScheme = colorScheme || restThemeProp.defaultColorScheme;
|
||||
|
||||
// 2. get the `vars` object that refers to the CSS custom properties
|
||||
const themeVars = restThemeProp.generateThemeVars?.() || restThemeProp.vars;
|
||||
|
||||
// 3. Start composing the theme object
|
||||
const theme = {
|
||||
...restThemeProp,
|
||||
components,
|
||||
colorSchemes,
|
||||
cssVarPrefix,
|
||||
vars: themeVars
|
||||
};
|
||||
if (typeof theme.generateSpacing === 'function') {
|
||||
theme.spacing = theme.generateSpacing();
|
||||
}
|
||||
|
||||
// 4. Resolve the color scheme and merge it to the theme
|
||||
if (calculatedColorScheme) {
|
||||
const scheme = colorSchemes[calculatedColorScheme];
|
||||
if (scheme && typeof scheme === 'object') {
|
||||
// 4.1 Merge the selected color scheme to the theme
|
||||
Object.keys(scheme).forEach(schemeKey => {
|
||||
if (scheme[schemeKey] && typeof scheme[schemeKey] === 'object') {
|
||||
// shallow merge the 1st level structure of the theme.
|
||||
theme[schemeKey] = {
|
||||
...theme[schemeKey],
|
||||
...scheme[schemeKey]
|
||||
};
|
||||
} else {
|
||||
theme[schemeKey] = scheme[schemeKey];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Declaring effects
|
||||
// 5.1 Updates the selector value to use the current color scheme which tells CSS to use the proper stylesheet.
|
||||
const colorSchemeSelector = restThemeProp.colorSchemeSelector;
|
||||
React.useEffect(() => {
|
||||
if (colorScheme && colorSchemeNode && colorSchemeSelector && colorSchemeSelector !== 'media') {
|
||||
const selector = colorSchemeSelector;
|
||||
let rule = colorSchemeSelector;
|
||||
if (selector === 'class') {
|
||||
rule = `.%s`;
|
||||
}
|
||||
if (selector === 'data') {
|
||||
rule = `[data-%s]`;
|
||||
}
|
||||
if (selector?.startsWith('data-') && !selector.includes('%s')) {
|
||||
// 'data-mui-color-scheme' -> '[data-mui-color-scheme="%s"]'
|
||||
rule = `[${selector}="%s"]`;
|
||||
}
|
||||
if (rule.startsWith('.')) {
|
||||
colorSchemeNode.classList.remove(...allColorSchemes.map(scheme => rule.substring(1).replace('%s', scheme)));
|
||||
colorSchemeNode.classList.add(rule.substring(1).replace('%s', colorScheme));
|
||||
} else {
|
||||
const matches = rule.replace('%s', colorScheme).match(/\[([^\]]+)\]/);
|
||||
if (matches) {
|
||||
const [attr, value] = matches[1].split('=');
|
||||
if (!value) {
|
||||
// for attributes like `data-theme-dark`, `data-theme-light`
|
||||
// remove all the existing data attributes before setting the new one
|
||||
allColorSchemes.forEach(scheme => {
|
||||
colorSchemeNode.removeAttribute(attr.replace(colorScheme, scheme));
|
||||
});
|
||||
}
|
||||
colorSchemeNode.setAttribute(attr, value ? value.replace(/"|'/g, '') : '');
|
||||
} else {
|
||||
colorSchemeNode.setAttribute(rule, colorScheme);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [colorScheme, colorSchemeSelector, colorSchemeNode, allColorSchemes]);
|
||||
|
||||
// 5.2 Remove the CSS transition when color scheme changes to create instant experience.
|
||||
// credit: https://github.com/pacocoursey/next-themes/blob/b5c2bad50de2d61ad7b52a9c5cdc801a78507d7a/index.tsx#L313
|
||||
React.useEffect(() => {
|
||||
let timer;
|
||||
if (disableTransitionOnChange && hasMounted.current && documentNode) {
|
||||
const css = documentNode.createElement('style');
|
||||
css.appendChild(documentNode.createTextNode(DISABLE_CSS_TRANSITION));
|
||||
documentNode.head.appendChild(css);
|
||||
|
||||
// Force browser repaint
|
||||
(() => window.getComputedStyle(documentNode.body))();
|
||||
timer = setTimeout(() => {
|
||||
documentNode.head.removeChild(css);
|
||||
}, 1);
|
||||
}
|
||||
return () => {
|
||||
clearTimeout(timer);
|
||||
};
|
||||
}, [colorScheme, disableTransitionOnChange, documentNode]);
|
||||
React.useEffect(() => {
|
||||
hasMounted.current = true;
|
||||
return () => {
|
||||
hasMounted.current = false;
|
||||
};
|
||||
}, []);
|
||||
const contextValue = React.useMemo(() => ({
|
||||
allColorSchemes,
|
||||
colorScheme,
|
||||
darkColorScheme,
|
||||
lightColorScheme,
|
||||
mode,
|
||||
setColorScheme,
|
||||
setMode,
|
||||
systemMode
|
||||
}), [allColorSchemes, colorScheme, darkColorScheme, lightColorScheme, mode, setColorScheme, setMode, systemMode]);
|
||||
let shouldGenerateStyleSheet = true;
|
||||
if (disableStyleSheetGeneration || restThemeProp.cssVariables === false || nested && upperTheme?.cssVarPrefix === cssVarPrefix) {
|
||||
shouldGenerateStyleSheet = false;
|
||||
}
|
||||
const element = /*#__PURE__*/_jsxs(React.Fragment, {
|
||||
children: [shouldGenerateStyleSheet && /*#__PURE__*/_jsx(React.Fragment, {
|
||||
children: (theme.generateStyleSheets?.() || []).map((styles, index) => /*#__PURE__*/_jsx(GlobalStyles, {
|
||||
styles: styles
|
||||
}, index))
|
||||
}), /*#__PURE__*/_jsx(ThemeProvider, {
|
||||
themeId: scopedTheme ? themeId : undefined,
|
||||
theme: resolveTheme ? resolveTheme(theme) : theme,
|
||||
children: children
|
||||
})]
|
||||
});
|
||||
if (nested) {
|
||||
return element;
|
||||
}
|
||||
return /*#__PURE__*/_jsx(ColorSchemeContext.Provider, {
|
||||
value: contextValue,
|
||||
children: element
|
||||
});
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? CssVarsProvider.propTypes = {
|
||||
/**
|
||||
* The component tree.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* The node used to attach the color-scheme attribute
|
||||
*/
|
||||
colorSchemeNode: PropTypes.any,
|
||||
/**
|
||||
* localStorage key used to store `colorScheme`
|
||||
*/
|
||||
colorSchemeStorageKey: PropTypes.string,
|
||||
/**
|
||||
* If `true`, the provider creates its own context and generate stylesheet as if it is a root `CssVarsProvider`.
|
||||
*/
|
||||
disableNestedContext: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the style sheet won't be generated.
|
||||
*
|
||||
* This is useful for controlling nested CssVarsProvider behavior.
|
||||
*/
|
||||
disableStyleSheetGeneration: PropTypes.bool,
|
||||
/**
|
||||
* Disable CSS transitions when switching between modes or color schemes.
|
||||
*/
|
||||
disableTransitionOnChange: PropTypes.bool,
|
||||
/**
|
||||
* The document to attach the attribute to.
|
||||
*/
|
||||
documentNode: PropTypes.any,
|
||||
/**
|
||||
* The key in the local storage used to store current color scheme.
|
||||
*/
|
||||
modeStorageKey: PropTypes.string,
|
||||
/**
|
||||
* The window that attaches the 'storage' event listener.
|
||||
* @default window
|
||||
*/
|
||||
storageWindow: PropTypes.any,
|
||||
/**
|
||||
* The calculated theme object that will be passed through context.
|
||||
*/
|
||||
theme: PropTypes.object
|
||||
} : void 0;
|
||||
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
||||
const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
|
||||
const getInitColorSchemeScript = params => InitColorSchemeScript({
|
||||
colorSchemeStorageKey: defaultColorSchemeStorageKey,
|
||||
defaultLightColorScheme,
|
||||
defaultDarkColorScheme,
|
||||
modeStorageKey: defaultModeStorageKey,
|
||||
...params
|
||||
});
|
||||
return {
|
||||
CssVarsProvider,
|
||||
useColorScheme,
|
||||
getInitColorSchemeScript
|
||||
};
|
||||
}
|
||||
21
node_modules/@mui/system/modern/cssVars/createCssVarsTheme.js
generated
vendored
Normal file
21
node_modules/@mui/system/modern/cssVars/createCssVarsTheme.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import prepareCssVars from "./prepareCssVars.js";
|
||||
import { createGetColorSchemeSelector } from "./getColorSchemeSelector.js";
|
||||
import { DEFAULT_ATTRIBUTE } from "../InitColorSchemeScript/InitColorSchemeScript.js";
|
||||
function createCssVarsTheme({
|
||||
colorSchemeSelector = `[${DEFAULT_ATTRIBUTE}="%s"]`,
|
||||
...theme
|
||||
}) {
|
||||
const output = theme;
|
||||
const result = prepareCssVars(output, {
|
||||
...theme,
|
||||
prefix: theme.cssVarPrefix,
|
||||
colorSchemeSelector
|
||||
});
|
||||
output.vars = result.vars;
|
||||
output.generateThemeVars = result.generateThemeVars;
|
||||
output.generateStyleSheets = result.generateStyleSheets;
|
||||
output.colorSchemeSelector = colorSchemeSelector;
|
||||
output.getColorSchemeSelector = createGetColorSchemeSelector(colorSchemeSelector);
|
||||
return output;
|
||||
}
|
||||
export default createCssVarsTheme;
|
||||
22
node_modules/@mui/system/modern/cssVars/createGetCssVar.js
generated
vendored
Normal file
22
node_modules/@mui/system/modern/cssVars/createGetCssVar.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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(prefix = '') {
|
||||
function appendVar(...vars) {
|
||||
if (!vars.length) {
|
||||
return '';
|
||||
}
|
||||
const value = vars[0];
|
||||
if (typeof value === 'string' && !value.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)) {
|
||||
return `, var(--${prefix ? `${prefix}-` : ''}${value}${appendVar(...vars.slice(1))})`;
|
||||
}
|
||||
return `, ${value}`;
|
||||
}
|
||||
|
||||
// AdditionalVars makes `getCssVar` less strict, so it can be use like this `getCssVar('non-mui-variable')` without type error.
|
||||
const getCssVar = (field, ...fallbacks) => {
|
||||
return `var(--${prefix ? `${prefix}-` : ''}${field}${appendVar(...fallbacks)})`;
|
||||
};
|
||||
return getCssVar;
|
||||
}
|
||||
129
node_modules/@mui/system/modern/cssVars/cssVarsParser.js
generated
vendored
Normal file
129
node_modules/@mui/system/modern/cssVars/cssVarsParser.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
/**
|
||||
* 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 const assignNestedKeys = (obj, keys, value, arrayKeys = []) => {
|
||||
let temp = obj;
|
||||
keys.forEach((k, index) => {
|
||||
if (index === keys.length - 1) {
|
||||
if (Array.isArray(temp)) {
|
||||
temp[Number(k)] = value;
|
||||
} else if (temp && typeof temp === 'object') {
|
||||
temp[k] = value;
|
||||
}
|
||||
} else if (temp && typeof temp === 'object') {
|
||||
if (!temp[k]) {
|
||||
temp[k] = arrayKeys.includes(k) ? [] : {};
|
||||
}
|
||||
temp = temp[k];
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @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 const walkObjectDeep = (obj, callback, shouldSkipPaths) => {
|
||||
function recurse(object, parentKeys = [], arrayKeys = []) {
|
||||
Object.entries(object).forEach(([key, value]) => {
|
||||
if (!shouldSkipPaths || shouldSkipPaths && !shouldSkipPaths([...parentKeys, key])) {
|
||||
if (value !== undefined && value !== null) {
|
||||
if (typeof value === 'object' && Object.keys(value).length > 0) {
|
||||
recurse(value, [...parentKeys, key], Array.isArray(value) ? [...arrayKeys, key] : arrayKeys);
|
||||
} else {
|
||||
callback([...parentKeys, key], value, arrayKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
recurse(obj);
|
||||
};
|
||||
const getCssValue = (keys, value) => {
|
||||
if (typeof value === 'number') {
|
||||
if (['lineHeight', 'fontWeight', 'opacity', 'zIndex'].some(prop => keys.includes(prop))) {
|
||||
// CSS property that are unitless
|
||||
return value;
|
||||
}
|
||||
const lastKey = keys[keys.length - 1];
|
||||
if (lastKey.toLowerCase().indexOf('opacity') >= 0) {
|
||||
// opacity values are unitless
|
||||
return value;
|
||||
}
|
||||
return `${value}px`;
|
||||
}
|
||||
return value;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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(theme, options) {
|
||||
const {
|
||||
prefix,
|
||||
shouldSkipGeneratingVar
|
||||
} = options || {};
|
||||
const css = {};
|
||||
const vars = {};
|
||||
const varsWithDefaults = {};
|
||||
walkObjectDeep(theme, (keys, value, arrayKeys) => {
|
||||
if (typeof value === 'string' || typeof value === 'number') {
|
||||
if (!shouldSkipGeneratingVar || !shouldSkipGeneratingVar(keys, value)) {
|
||||
// only create css & var if `shouldSkipGeneratingVar` return false
|
||||
const cssVar = `--${prefix ? `${prefix}-` : ''}${keys.join('-')}`;
|
||||
const resolvedValue = getCssValue(keys, value);
|
||||
Object.assign(css, {
|
||||
[cssVar]: resolvedValue
|
||||
});
|
||||
assignNestedKeys(vars, keys, `var(${cssVar})`, arrayKeys);
|
||||
assignNestedKeys(varsWithDefaults, keys, `var(${cssVar}, ${resolvedValue})`, arrayKeys);
|
||||
}
|
||||
}
|
||||
}, keys => keys[0] === 'vars' // skip 'vars/*' paths
|
||||
);
|
||||
return {
|
||||
css,
|
||||
vars,
|
||||
varsWithDefaults
|
||||
};
|
||||
}
|
||||
26
node_modules/@mui/system/modern/cssVars/getColorSchemeSelector.js
generated
vendored
Normal file
26
node_modules/@mui/system/modern/cssVars/getColorSchemeSelector.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
export function createGetColorSchemeSelector(selector) {
|
||||
return function getColorSchemeSelector(colorScheme) {
|
||||
if (selector === 'media') {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (colorScheme !== 'light' && colorScheme !== 'dark') {
|
||||
console.error(`MUI: @media (prefers-color-scheme) supports only 'light' or 'dark', but receive '${colorScheme}'.`);
|
||||
}
|
||||
}
|
||||
return `@media (prefers-color-scheme: ${colorScheme})`;
|
||||
}
|
||||
if (selector) {
|
||||
if (selector.startsWith('data-') && !selector.includes('%s')) {
|
||||
return `[${selector}="${colorScheme}"] &`;
|
||||
}
|
||||
if (selector === 'class') {
|
||||
return `.${colorScheme} &`;
|
||||
}
|
||||
if (selector === 'data') {
|
||||
return `[data-${colorScheme}] &`;
|
||||
}
|
||||
return `${selector.replace('%s', colorScheme)} &`;
|
||||
}
|
||||
return '&';
|
||||
};
|
||||
}
|
||||
5
node_modules/@mui/system/modern/cssVars/index.js
generated
vendored
Normal file
5
node_modules/@mui/system/modern/cssVars/index.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export { default } from "./createCssVarsProvider.js";
|
||||
export { default as prepareCssVars } from "./prepareCssVars.js";
|
||||
export { default as prepareTypographyVars } from "./prepareTypographyVars.js";
|
||||
export { default as createCssVarsTheme } from "./createCssVarsTheme.js";
|
||||
export { createGetColorSchemeSelector } from "./getColorSchemeSelector.js";
|
||||
153
node_modules/@mui/system/modern/cssVars/prepareCssVars.js
generated
vendored
Normal file
153
node_modules/@mui/system/modern/cssVars/prepareCssVars.js
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
import deepmerge from '@mui/utils/deepmerge';
|
||||
import cssVarsParser from "./cssVarsParser.js";
|
||||
function prepareCssVars(theme, parserConfig = {}) {
|
||||
const {
|
||||
getSelector = defaultGetSelector,
|
||||
disableCssColorScheme,
|
||||
colorSchemeSelector: selector
|
||||
} = parserConfig;
|
||||
// @ts-ignore - ignore components do not exist
|
||||
const {
|
||||
colorSchemes = {},
|
||||
components,
|
||||
defaultColorScheme = 'light',
|
||||
...otherTheme
|
||||
} = theme;
|
||||
const {
|
||||
vars: rootVars,
|
||||
css: rootCss,
|
||||
varsWithDefaults: rootVarsWithDefaults
|
||||
} = cssVarsParser(otherTheme, parserConfig);
|
||||
let themeVars = rootVarsWithDefaults;
|
||||
const colorSchemesMap = {};
|
||||
const {
|
||||
[defaultColorScheme]: defaultScheme,
|
||||
...otherColorSchemes
|
||||
} = colorSchemes;
|
||||
Object.entries(otherColorSchemes || {}).forEach(([key, scheme]) => {
|
||||
const {
|
||||
vars,
|
||||
css,
|
||||
varsWithDefaults
|
||||
} = cssVarsParser(scheme, parserConfig);
|
||||
themeVars = deepmerge(themeVars, varsWithDefaults);
|
||||
colorSchemesMap[key] = {
|
||||
css,
|
||||
vars
|
||||
};
|
||||
});
|
||||
if (defaultScheme) {
|
||||
// default color scheme vars should be merged last to set as default
|
||||
const {
|
||||
css,
|
||||
vars,
|
||||
varsWithDefaults
|
||||
} = cssVarsParser(defaultScheme, parserConfig);
|
||||
themeVars = deepmerge(themeVars, varsWithDefaults);
|
||||
colorSchemesMap[defaultColorScheme] = {
|
||||
css,
|
||||
vars
|
||||
};
|
||||
}
|
||||
function defaultGetSelector(colorScheme, cssObject) {
|
||||
let rule = selector;
|
||||
if (selector === 'class') {
|
||||
rule = '.%s';
|
||||
}
|
||||
if (selector === 'data') {
|
||||
rule = '[data-%s]';
|
||||
}
|
||||
if (selector?.startsWith('data-') && !selector.includes('%s')) {
|
||||
// 'data-joy-color-scheme' -> '[data-joy-color-scheme="%s"]'
|
||||
rule = `[${selector}="%s"]`;
|
||||
}
|
||||
if (colorScheme) {
|
||||
if (rule === 'media') {
|
||||
if (theme.defaultColorScheme === colorScheme) {
|
||||
return ':root';
|
||||
}
|
||||
const mode = colorSchemes[colorScheme]?.palette?.mode || colorScheme;
|
||||
return {
|
||||
[`@media (prefers-color-scheme: ${mode})`]: {
|
||||
':root': cssObject
|
||||
}
|
||||
};
|
||||
}
|
||||
if (rule) {
|
||||
if (theme.defaultColorScheme === colorScheme) {
|
||||
return `:root, ${rule.replace('%s', String(colorScheme))}`;
|
||||
}
|
||||
return rule.replace('%s', String(colorScheme));
|
||||
}
|
||||
}
|
||||
return ':root';
|
||||
}
|
||||
const generateThemeVars = () => {
|
||||
let vars = {
|
||||
...rootVars
|
||||
};
|
||||
Object.entries(colorSchemesMap).forEach(([, {
|
||||
vars: schemeVars
|
||||
}]) => {
|
||||
vars = deepmerge(vars, schemeVars);
|
||||
});
|
||||
return vars;
|
||||
};
|
||||
const generateStyleSheets = () => {
|
||||
const stylesheets = [];
|
||||
const colorScheme = theme.defaultColorScheme || 'light';
|
||||
function insertStyleSheet(key, css) {
|
||||
if (Object.keys(css).length) {
|
||||
stylesheets.push(typeof key === 'string' ? {
|
||||
[key]: {
|
||||
...css
|
||||
}
|
||||
} : key);
|
||||
}
|
||||
}
|
||||
insertStyleSheet(getSelector(undefined, {
|
||||
...rootCss
|
||||
}), rootCss);
|
||||
const {
|
||||
[colorScheme]: defaultSchemeVal,
|
||||
...other
|
||||
} = colorSchemesMap;
|
||||
if (defaultSchemeVal) {
|
||||
// default color scheme has to come before other color schemes
|
||||
const {
|
||||
css
|
||||
} = defaultSchemeVal;
|
||||
const cssColorSheme = colorSchemes[colorScheme]?.palette?.mode;
|
||||
const finalCss = !disableCssColorScheme && cssColorSheme ? {
|
||||
colorScheme: cssColorSheme,
|
||||
...css
|
||||
} : {
|
||||
...css
|
||||
};
|
||||
insertStyleSheet(getSelector(colorScheme, {
|
||||
...finalCss
|
||||
}), finalCss);
|
||||
}
|
||||
Object.entries(other).forEach(([key, {
|
||||
css
|
||||
}]) => {
|
||||
const cssColorSheme = colorSchemes[key]?.palette?.mode;
|
||||
const finalCss = !disableCssColorScheme && cssColorSheme ? {
|
||||
colorScheme: cssColorSheme,
|
||||
...css
|
||||
} : {
|
||||
...css
|
||||
};
|
||||
insertStyleSheet(getSelector(key, {
|
||||
...finalCss
|
||||
}), finalCss);
|
||||
});
|
||||
return stylesheets;
|
||||
};
|
||||
return {
|
||||
vars: themeVars,
|
||||
generateThemeVars,
|
||||
generateStyleSheets
|
||||
};
|
||||
}
|
||||
export default prepareCssVars;
|
||||
11
node_modules/@mui/system/modern/cssVars/prepareTypographyVars.js
generated
vendored
Normal file
11
node_modules/@mui/system/modern/cssVars/prepareTypographyVars.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export default function prepareTypographyVars(typography) {
|
||||
const vars = {};
|
||||
const entries = Object.entries(typography);
|
||||
entries.forEach(entry => {
|
||||
const [key, value] = entry;
|
||||
if (typeof value === 'object') {
|
||||
vars[key] = `${value.fontStyle ? `${value.fontStyle} ` : ''}${value.fontVariant ? `${value.fontVariant} ` : ''}${value.fontWeight ? `${value.fontWeight} ` : ''}${value.fontStretch ? `${value.fontStretch} ` : ''}${value.fontSize || ''}${value.lineHeight ? `/${value.lineHeight} ` : ''}${value.fontFamily || ''}`;
|
||||
}
|
||||
});
|
||||
return vars;
|
||||
}
|
||||
252
node_modules/@mui/system/modern/cssVars/useCurrentColorScheme.js
generated
vendored
Normal file
252
node_modules/@mui/system/modern/cssVars/useCurrentColorScheme.js
generated
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import { DEFAULT_MODE_STORAGE_KEY, DEFAULT_COLOR_SCHEME_STORAGE_KEY } from "../InitColorSchemeScript/InitColorSchemeScript.js";
|
||||
export function getSystemMode(mode) {
|
||||
if (typeof window !== 'undefined' && typeof window.matchMedia === 'function' && mode === 'system') {
|
||||
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
if (mql.matches) {
|
||||
return 'dark';
|
||||
}
|
||||
return 'light';
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
function processState(state, callback) {
|
||||
if (state.mode === 'light' || state.mode === 'system' && state.systemMode === 'light') {
|
||||
return callback('light');
|
||||
}
|
||||
if (state.mode === 'dark' || state.mode === 'system' && state.systemMode === 'dark') {
|
||||
return callback('dark');
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
export function getColorScheme(state) {
|
||||
return processState(state, mode => {
|
||||
if (mode === 'light') {
|
||||
return state.lightColorScheme;
|
||||
}
|
||||
if (mode === 'dark') {
|
||||
return state.darkColorScheme;
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
function initializeValue(key, defaultValue) {
|
||||
if (typeof window === 'undefined') {
|
||||
return undefined;
|
||||
}
|
||||
let value;
|
||||
try {
|
||||
value = localStorage.getItem(key) || undefined;
|
||||
if (!value) {
|
||||
// the first time that user enters the site.
|
||||
localStorage.setItem(key, defaultValue);
|
||||
}
|
||||
} catch (e) {
|
||||
// Unsupported
|
||||
}
|
||||
return value || defaultValue;
|
||||
}
|
||||
export default function useCurrentColorScheme(options) {
|
||||
const {
|
||||
defaultMode = 'light',
|
||||
defaultLightColorScheme,
|
||||
defaultDarkColorScheme,
|
||||
supportedColorSchemes = [],
|
||||
modeStorageKey = DEFAULT_MODE_STORAGE_KEY,
|
||||
colorSchemeStorageKey = DEFAULT_COLOR_SCHEME_STORAGE_KEY,
|
||||
storageWindow = typeof window === 'undefined' ? undefined : window
|
||||
} = options;
|
||||
const joinedColorSchemes = supportedColorSchemes.join(',');
|
||||
const isMultiSchemes = supportedColorSchemes.length > 1;
|
||||
const [state, setState] = React.useState(() => {
|
||||
const initialMode = initializeValue(modeStorageKey, defaultMode);
|
||||
const lightColorScheme = initializeValue(`${colorSchemeStorageKey}-light`, defaultLightColorScheme);
|
||||
const darkColorScheme = initializeValue(`${colorSchemeStorageKey}-dark`, defaultDarkColorScheme);
|
||||
return {
|
||||
mode: initialMode,
|
||||
systemMode: getSystemMode(initialMode),
|
||||
lightColorScheme,
|
||||
darkColorScheme
|
||||
};
|
||||
});
|
||||
// This could be improved with `React.useSyncExternalStore` in the future.
|
||||
const [, setHasMounted] = React.useState(false);
|
||||
const hasMounted = React.useRef(false);
|
||||
React.useEffect(() => {
|
||||
if (isMultiSchemes) {
|
||||
setHasMounted(true); // to rerender the component after hydration
|
||||
}
|
||||
hasMounted.current = true;
|
||||
}, [isMultiSchemes]);
|
||||
const colorScheme = getColorScheme(state);
|
||||
const setMode = React.useCallback(mode => {
|
||||
setState(currentState => {
|
||||
if (mode === currentState.mode) {
|
||||
// do nothing if mode does not change
|
||||
return currentState;
|
||||
}
|
||||
const newMode = mode ?? defaultMode;
|
||||
try {
|
||||
localStorage.setItem(modeStorageKey, newMode);
|
||||
} catch (e) {
|
||||
// Unsupported
|
||||
}
|
||||
return {
|
||||
...currentState,
|
||||
mode: newMode,
|
||||
systemMode: getSystemMode(newMode)
|
||||
};
|
||||
});
|
||||
}, [modeStorageKey, defaultMode]);
|
||||
const setColorScheme = React.useCallback(value => {
|
||||
if (!value) {
|
||||
setState(currentState => {
|
||||
try {
|
||||
localStorage.setItem(`${colorSchemeStorageKey}-light`, defaultLightColorScheme);
|
||||
localStorage.setItem(`${colorSchemeStorageKey}-dark`, defaultDarkColorScheme);
|
||||
} catch (e) {
|
||||
// Unsupported
|
||||
}
|
||||
return {
|
||||
...currentState,
|
||||
lightColorScheme: defaultLightColorScheme,
|
||||
darkColorScheme: defaultDarkColorScheme
|
||||
};
|
||||
});
|
||||
} else if (typeof value === 'string') {
|
||||
if (value && !joinedColorSchemes.includes(value)) {
|
||||
console.error(`\`${value}\` does not exist in \`theme.colorSchemes\`.`);
|
||||
} else {
|
||||
setState(currentState => {
|
||||
const newState = {
|
||||
...currentState
|
||||
};
|
||||
processState(currentState, mode => {
|
||||
try {
|
||||
localStorage.setItem(`${colorSchemeStorageKey}-${mode}`, value);
|
||||
} catch (e) {
|
||||
// Unsupported
|
||||
}
|
||||
if (mode === 'light') {
|
||||
newState.lightColorScheme = value;
|
||||
}
|
||||
if (mode === 'dark') {
|
||||
newState.darkColorScheme = value;
|
||||
}
|
||||
});
|
||||
return newState;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
setState(currentState => {
|
||||
const newState = {
|
||||
...currentState
|
||||
};
|
||||
const newLightColorScheme = value.light === null ? defaultLightColorScheme : value.light;
|
||||
const newDarkColorScheme = value.dark === null ? defaultDarkColorScheme : value.dark;
|
||||
if (newLightColorScheme) {
|
||||
if (!joinedColorSchemes.includes(newLightColorScheme)) {
|
||||
console.error(`\`${newLightColorScheme}\` does not exist in \`theme.colorSchemes\`.`);
|
||||
} else {
|
||||
newState.lightColorScheme = newLightColorScheme;
|
||||
try {
|
||||
localStorage.setItem(`${colorSchemeStorageKey}-light`, newLightColorScheme);
|
||||
} catch (error) {
|
||||
// Unsupported
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newDarkColorScheme) {
|
||||
if (!joinedColorSchemes.includes(newDarkColorScheme)) {
|
||||
console.error(`\`${newDarkColorScheme}\` does not exist in \`theme.colorSchemes\`.`);
|
||||
} else {
|
||||
newState.darkColorScheme = newDarkColorScheme;
|
||||
try {
|
||||
localStorage.setItem(`${colorSchemeStorageKey}-dark`, newDarkColorScheme);
|
||||
} catch (error) {
|
||||
// Unsupported
|
||||
}
|
||||
}
|
||||
}
|
||||
return newState;
|
||||
});
|
||||
}
|
||||
}, [joinedColorSchemes, colorSchemeStorageKey, defaultLightColorScheme, defaultDarkColorScheme]);
|
||||
const handleMediaQuery = React.useCallback(event => {
|
||||
if (state.mode === 'system') {
|
||||
setState(currentState => {
|
||||
const systemMode = event?.matches ? 'dark' : 'light';
|
||||
|
||||
// Early exit, nothing changed.
|
||||
if (currentState.systemMode === systemMode) {
|
||||
return currentState;
|
||||
}
|
||||
return {
|
||||
...currentState,
|
||||
systemMode
|
||||
};
|
||||
});
|
||||
}
|
||||
}, [state.mode]);
|
||||
|
||||
// Ref hack to avoid adding handleMediaQuery as a dep
|
||||
const mediaListener = React.useRef(handleMediaQuery);
|
||||
mediaListener.current = handleMediaQuery;
|
||||
React.useEffect(() => {
|
||||
if (typeof window.matchMedia !== 'function' || !isMultiSchemes) {
|
||||
return undefined;
|
||||
}
|
||||
const handler = (...args) => mediaListener.current(...args);
|
||||
|
||||
// Always listen to System preference
|
||||
const media = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
|
||||
// Intentionally use deprecated listener methods to support iOS & old browsers
|
||||
media.addListener(handler);
|
||||
handler(media);
|
||||
return () => {
|
||||
media.removeListener(handler);
|
||||
};
|
||||
}, [isMultiSchemes]);
|
||||
|
||||
// Handle when localStorage has changed
|
||||
React.useEffect(() => {
|
||||
if (storageWindow && isMultiSchemes) {
|
||||
const handleStorage = event => {
|
||||
const value = event.newValue;
|
||||
if (typeof event.key === 'string' && event.key.startsWith(colorSchemeStorageKey) && (!value || joinedColorSchemes.match(value))) {
|
||||
// If the key is deleted, value will be null then reset color scheme to the default one.
|
||||
if (event.key.endsWith('light')) {
|
||||
setColorScheme({
|
||||
light: value
|
||||
});
|
||||
}
|
||||
if (event.key.endsWith('dark')) {
|
||||
setColorScheme({
|
||||
dark: value
|
||||
});
|
||||
}
|
||||
}
|
||||
if (event.key === modeStorageKey && (!value || ['light', 'dark', 'system'].includes(value))) {
|
||||
setMode(value || defaultMode);
|
||||
}
|
||||
};
|
||||
// For syncing color-scheme changes between iframes
|
||||
storageWindow.addEventListener('storage', handleStorage);
|
||||
return () => {
|
||||
storageWindow.removeEventListener('storage', handleStorage);
|
||||
};
|
||||
}
|
||||
return undefined;
|
||||
}, [setColorScheme, setMode, modeStorageKey, colorSchemeStorageKey, joinedColorSchemes, defaultMode, storageWindow, isMultiSchemes]);
|
||||
return {
|
||||
...state,
|
||||
mode: hasMounted.current || !isMultiSchemes ? state.mode : undefined,
|
||||
systemMode: hasMounted.current || !isMultiSchemes ? state.systemMode : undefined,
|
||||
colorScheme: hasMounted.current || !isMultiSchemes ? colorScheme : undefined,
|
||||
setMode,
|
||||
setColorScheme
|
||||
};
|
||||
}
|
||||
27
node_modules/@mui/system/modern/display/display.js
generated
vendored
Normal file
27
node_modules/@mui/system/modern/display/display.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import style from "../style/index.js";
|
||||
import compose from "../compose/index.js";
|
||||
export const displayPrint = style({
|
||||
prop: 'displayPrint',
|
||||
cssProperty: false,
|
||||
transform: value => ({
|
||||
'@media print': {
|
||||
display: value
|
||||
}
|
||||
})
|
||||
});
|
||||
export const displayRaw = style({
|
||||
prop: 'display'
|
||||
});
|
||||
export const overflow = style({
|
||||
prop: 'overflow'
|
||||
});
|
||||
export const textOverflow = style({
|
||||
prop: 'textOverflow'
|
||||
});
|
||||
export const visibility = style({
|
||||
prop: 'visibility'
|
||||
});
|
||||
export const whiteSpace = style({
|
||||
prop: 'whiteSpace'
|
||||
});
|
||||
export default compose(displayPrint, displayRaw, overflow, textOverflow, visibility, whiteSpace);
|
||||
2
node_modules/@mui/system/modern/display/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/display/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./display.js";
|
||||
export * from "./display.js";
|
||||
43
node_modules/@mui/system/modern/flexbox/flexbox.js
generated
vendored
Normal file
43
node_modules/@mui/system/modern/flexbox/flexbox.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import style from "../style/index.js";
|
||||
import compose from "../compose/index.js";
|
||||
export const flexBasis = style({
|
||||
prop: 'flexBasis'
|
||||
});
|
||||
export const flexDirection = style({
|
||||
prop: 'flexDirection'
|
||||
});
|
||||
export const flexWrap = style({
|
||||
prop: 'flexWrap'
|
||||
});
|
||||
export const justifyContent = style({
|
||||
prop: 'justifyContent'
|
||||
});
|
||||
export const alignItems = style({
|
||||
prop: 'alignItems'
|
||||
});
|
||||
export const alignContent = style({
|
||||
prop: 'alignContent'
|
||||
});
|
||||
export const order = style({
|
||||
prop: 'order'
|
||||
});
|
||||
export const flex = style({
|
||||
prop: 'flex'
|
||||
});
|
||||
export const flexGrow = style({
|
||||
prop: 'flexGrow'
|
||||
});
|
||||
export const flexShrink = style({
|
||||
prop: 'flexShrink'
|
||||
});
|
||||
export const alignSelf = style({
|
||||
prop: 'alignSelf'
|
||||
});
|
||||
export const justifyItems = style({
|
||||
prop: 'justifyItems'
|
||||
});
|
||||
export const justifySelf = style({
|
||||
prop: 'justifySelf'
|
||||
});
|
||||
const flexbox = compose(flexBasis, flexDirection, flexWrap, justifyContent, alignItems, alignContent, order, flex, flexGrow, flexShrink, alignSelf, justifyItems, justifySelf);
|
||||
export default flexbox;
|
||||
2
node_modules/@mui/system/modern/flexbox/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/flexbox/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./flexbox.js";
|
||||
export * from "./flexbox.js";
|
||||
51
node_modules/@mui/system/modern/getThemeValue/getThemeValue.js
generated
vendored
Normal file
51
node_modules/@mui/system/modern/getThemeValue/getThemeValue.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import borders from "../borders/index.js";
|
||||
import display from "../display/index.js";
|
||||
import flexbox from "../flexbox/index.js";
|
||||
import grid from "../cssGrid/index.js";
|
||||
import positions from "../positions/index.js";
|
||||
import palette from "../palette/index.js";
|
||||
import shadows from "../shadows/index.js";
|
||||
import sizing from "../sizing/index.js";
|
||||
import spacing from "../spacing/index.js";
|
||||
import typography from "../typography/index.js";
|
||||
const filterPropsMapping = {
|
||||
borders: borders.filterProps,
|
||||
display: display.filterProps,
|
||||
flexbox: flexbox.filterProps,
|
||||
grid: grid.filterProps,
|
||||
positions: positions.filterProps,
|
||||
palette: palette.filterProps,
|
||||
shadows: shadows.filterProps,
|
||||
sizing: sizing.filterProps,
|
||||
spacing: spacing.filterProps,
|
||||
typography: typography.filterProps
|
||||
};
|
||||
export const styleFunctionMapping = {
|
||||
borders,
|
||||
display,
|
||||
flexbox,
|
||||
grid,
|
||||
positions,
|
||||
palette,
|
||||
shadows,
|
||||
sizing,
|
||||
spacing,
|
||||
typography
|
||||
};
|
||||
export const propToStyleFunction = Object.keys(filterPropsMapping).reduce((acc, styleFnName) => {
|
||||
filterPropsMapping[styleFnName].forEach(propName => {
|
||||
acc[propName] = styleFunctionMapping[styleFnName];
|
||||
});
|
||||
return acc;
|
||||
}, {});
|
||||
function getThemeValue(prop, value, theme) {
|
||||
const inputProps = {
|
||||
[prop]: value,
|
||||
theme
|
||||
};
|
||||
const styleFunction = propToStyleFunction[prop];
|
||||
return styleFunction ? styleFunction(inputProps) : {
|
||||
[prop]: value
|
||||
};
|
||||
}
|
||||
export default getThemeValue;
|
||||
2
node_modules/@mui/system/modern/getThemeValue/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/getThemeValue/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./getThemeValue.js";
|
||||
export * from "./getThemeValue.js";
|
||||
74
node_modules/@mui/system/modern/index.js
generated
vendored
Normal file
74
node_modules/@mui/system/modern/index.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @mui/system v6.1.0
|
||||
*
|
||||
* @license MIT
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
||||
export { css, keyframes, StyledEngineProvider } from '@mui/styled-engine';
|
||||
export { default as GlobalStyles } from "./GlobalStyles/index.js";
|
||||
export { default as borders } from "./borders/index.js";
|
||||
export * from "./borders/index.js";
|
||||
export { default as breakpoints } from "./breakpoints/index.js";
|
||||
export { default as cssContainerQueries } from "./cssContainerQueries/index.js";
|
||||
export { handleBreakpoints, mergeBreakpointsInOrder, resolveBreakpointValues as unstable_resolveBreakpointValues } from "./breakpoints/index.js";
|
||||
export { default as compose } from "./compose/index.js";
|
||||
export { default as display } from "./display/index.js";
|
||||
export { default as flexbox } from "./flexbox/index.js";
|
||||
export * from "./flexbox/index.js";
|
||||
export { default as grid } from "./cssGrid/index.js";
|
||||
export * from "./cssGrid/index.js";
|
||||
export { default as palette } from "./palette/index.js";
|
||||
export * from "./palette/index.js";
|
||||
export { default as positions } from "./positions/index.js";
|
||||
export * from "./positions/index.js";
|
||||
export { default as shadows } from "./shadows/index.js";
|
||||
export { default as sizing } from "./sizing/index.js";
|
||||
export * from "./sizing/index.js";
|
||||
export { default as spacing } from "./spacing/index.js";
|
||||
export * from "./spacing/index.js";
|
||||
export { default as style, getPath, getStyleValue } from "./style/index.js";
|
||||
export { default as typography } from "./typography/index.js";
|
||||
export * from "./typography/index.js";
|
||||
export { default as unstable_styleFunctionSx, unstable_createStyleFunctionSx, extendSxProp as unstable_extendSxProp, unstable_defaultSxConfig } from "./styleFunctionSx/index.js";
|
||||
// TODO: Remove this function in v6
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
export function experimental_sx() {
|
||||
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`experimental_sx\` has been moved to \`theme.unstable_sx\`.For more details, see https://github.com/mui/material-ui/pull/35150.` : _formatMuiErrorMessage(19));
|
||||
}
|
||||
export { default as unstable_getThemeValue } from "./getThemeValue/index.js";
|
||||
export { default as Box } from "./Box/index.js";
|
||||
export { default as createBox } 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 { default as createTheme } from "./createTheme/index.js";
|
||||
export { default as createBreakpoints } from "./createBreakpoints/createBreakpoints.js";
|
||||
export { default as createSpacing } from "./createTheme/createSpacing.js";
|
||||
export { default as shape } from "./createTheme/shape.js";
|
||||
export { default as useThemeProps, getThemeProps } from "./useThemeProps/index.js";
|
||||
export { default as useTheme } from "./useTheme/index.js";
|
||||
export { default as useThemeWithoutDefault } from "./useThemeWithoutDefault/index.js";
|
||||
export { default as useMediaQuery } from "./useMediaQuery/index.js";
|
||||
export * from "./colorManipulator/index.js";
|
||||
export { default as ThemeProvider } from "./ThemeProvider/index.js";
|
||||
export { default as unstable_createCssVarsProvider } from "./cssVars/createCssVarsProvider.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 { default as responsivePropType } from "./responsivePropType/index.js";
|
||||
export { default as RtlProvider } from "./RtlProvider/index.js";
|
||||
export * from "./RtlProvider/index.js";
|
||||
export * from "./version/index.js";
|
||||
|
||||
/** ----------------- */
|
||||
/** Layout components */
|
||||
export { default as createContainer } from "./Container/createContainer.js";
|
||||
export { default as Container } from "./Container/index.js";
|
||||
export * from "./Container/index.js";
|
||||
export { default as Grid } from "./Grid/Grid.js";
|
||||
export * from "./Grid/index.js";
|
||||
export { default as Stack } from "./Stack/Stack.js";
|
||||
export * from "./Stack/index.js";
|
||||
1
node_modules/@mui/system/modern/memoize/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/memoize/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./memoize.js";
|
||||
9
node_modules/@mui/system/modern/memoize/memoize.js
generated
vendored
Normal file
9
node_modules/@mui/system/modern/memoize/memoize.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export default function memoize(fn) {
|
||||
const cache = {};
|
||||
return arg => {
|
||||
if (cache[arg] === undefined) {
|
||||
cache[arg] = fn(arg);
|
||||
}
|
||||
return cache[arg];
|
||||
};
|
||||
}
|
||||
1
node_modules/@mui/system/modern/merge/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/merge/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./merge.js";
|
||||
10
node_modules/@mui/system/modern/merge/merge.js
generated
vendored
Normal file
10
node_modules/@mui/system/modern/merge/merge.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import deepmerge from '@mui/utils/deepmerge';
|
||||
function merge(acc, item) {
|
||||
if (!item) {
|
||||
return acc;
|
||||
}
|
||||
return deepmerge(acc, item, {
|
||||
clone: false // No need to clone deep, it's way faster.
|
||||
});
|
||||
}
|
||||
export default merge;
|
||||
2
node_modules/@mui/system/modern/palette/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/palette/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./palette.js";
|
||||
export * from "./palette.js";
|
||||
26
node_modules/@mui/system/modern/palette/palette.js
generated
vendored
Normal file
26
node_modules/@mui/system/modern/palette/palette.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import style from "../style/index.js";
|
||||
import compose from "../compose/index.js";
|
||||
export function paletteTransform(value, userValue) {
|
||||
if (userValue === 'grey') {
|
||||
return userValue;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
export const color = style({
|
||||
prop: 'color',
|
||||
themeKey: 'palette',
|
||||
transform: paletteTransform
|
||||
});
|
||||
export const bgcolor = style({
|
||||
prop: 'bgcolor',
|
||||
cssProperty: 'backgroundColor',
|
||||
themeKey: 'palette',
|
||||
transform: paletteTransform
|
||||
});
|
||||
export const backgroundColor = style({
|
||||
prop: 'backgroundColor',
|
||||
themeKey: 'palette',
|
||||
transform: paletteTransform
|
||||
});
|
||||
const palette = compose(color, bgcolor, backgroundColor);
|
||||
export default palette;
|
||||
2
node_modules/@mui/system/modern/positions/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/positions/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./positions.js";
|
||||
export * from "./positions.js";
|
||||
22
node_modules/@mui/system/modern/positions/positions.js
generated
vendored
Normal file
22
node_modules/@mui/system/modern/positions/positions.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import style from "../style/index.js";
|
||||
import compose from "../compose/index.js";
|
||||
export const position = style({
|
||||
prop: 'position'
|
||||
});
|
||||
export const zIndex = style({
|
||||
prop: 'zIndex',
|
||||
themeKey: 'zIndex'
|
||||
});
|
||||
export const top = style({
|
||||
prop: 'top'
|
||||
});
|
||||
export const right = style({
|
||||
prop: 'right'
|
||||
});
|
||||
export const bottom = style({
|
||||
prop: 'bottom'
|
||||
});
|
||||
export const left = style({
|
||||
prop: 'left'
|
||||
});
|
||||
export default compose(position, zIndex, top, right, bottom, left);
|
||||
1
node_modules/@mui/system/modern/propsToClassKey/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/propsToClassKey/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./propsToClassKey.js";
|
||||
25
node_modules/@mui/system/modern/propsToClassKey/propsToClassKey.js
generated
vendored
Normal file
25
node_modules/@mui/system/modern/propsToClassKey/propsToClassKey.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import capitalize from '@mui/utils/capitalize';
|
||||
function isEmpty(string) {
|
||||
return string.length === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates string classKey based on the properties provided. It starts with the
|
||||
* variant if defined, and then it appends all other properties in alphabetical order.
|
||||
* @param {object} props - the properties for which the classKey should be created.
|
||||
*/
|
||||
export default function propsToClassKey(props) {
|
||||
const {
|
||||
variant,
|
||||
...other
|
||||
} = props;
|
||||
let classKey = variant || '';
|
||||
Object.keys(other).sort().forEach(key => {
|
||||
if (key === 'color') {
|
||||
classKey += isEmpty(classKey) ? props[key] : capitalize(props[key]);
|
||||
} else {
|
||||
classKey += `${isEmpty(classKey) ? key : capitalize(key)}${capitalize(props[key].toString())}`;
|
||||
}
|
||||
});
|
||||
return classKey;
|
||||
}
|
||||
1
node_modules/@mui/system/modern/responsivePropType/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/responsivePropType/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./responsivePropType.js";
|
||||
3
node_modules/@mui/system/modern/responsivePropType/responsivePropType.js
generated
vendored
Normal file
3
node_modules/@mui/system/modern/responsivePropType/responsivePropType.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import PropTypes from 'prop-types';
|
||||
const responsivePropType = process.env.NODE_ENV !== 'production' ? PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.object, PropTypes.array]) : {};
|
||||
export default responsivePropType;
|
||||
1
node_modules/@mui/system/modern/shadows/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/shadows/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./shadows.js";
|
||||
6
node_modules/@mui/system/modern/shadows/shadows.js
generated
vendored
Normal file
6
node_modules/@mui/system/modern/shadows/shadows.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import style from "../style/index.js";
|
||||
const boxShadow = style({
|
||||
prop: 'boxShadow',
|
||||
themeKey: 'shadows'
|
||||
});
|
||||
export default boxShadow;
|
||||
2
node_modules/@mui/system/modern/sizing/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/sizing/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./sizing.js";
|
||||
export * from "./sizing.js";
|
||||
64
node_modules/@mui/system/modern/sizing/sizing.js
generated
vendored
Normal file
64
node_modules/@mui/system/modern/sizing/sizing.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
import style from "../style/index.js";
|
||||
import compose from "../compose/index.js";
|
||||
import { handleBreakpoints, values as breakpointsValues } from "../breakpoints/index.js";
|
||||
export function sizingTransform(value) {
|
||||
return value <= 1 && value !== 0 ? `${value * 100}%` : value;
|
||||
}
|
||||
export const width = style({
|
||||
prop: 'width',
|
||||
transform: sizingTransform
|
||||
});
|
||||
export const maxWidth = props => {
|
||||
if (props.maxWidth !== undefined && props.maxWidth !== null) {
|
||||
const styleFromPropValue = propValue => {
|
||||
const breakpoint = props.theme?.breakpoints?.values?.[propValue] || breakpointsValues[propValue];
|
||||
if (!breakpoint) {
|
||||
return {
|
||||
maxWidth: sizingTransform(propValue)
|
||||
};
|
||||
}
|
||||
if (props.theme?.breakpoints?.unit !== 'px') {
|
||||
return {
|
||||
maxWidth: `${breakpoint}${props.theme.breakpoints.unit}`
|
||||
};
|
||||
}
|
||||
return {
|
||||
maxWidth: breakpoint
|
||||
};
|
||||
};
|
||||
return handleBreakpoints(props, props.maxWidth, styleFromPropValue);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
maxWidth.filterProps = ['maxWidth'];
|
||||
export const minWidth = style({
|
||||
prop: 'minWidth',
|
||||
transform: sizingTransform
|
||||
});
|
||||
export const height = style({
|
||||
prop: 'height',
|
||||
transform: sizingTransform
|
||||
});
|
||||
export const maxHeight = style({
|
||||
prop: 'maxHeight',
|
||||
transform: sizingTransform
|
||||
});
|
||||
export const minHeight = style({
|
||||
prop: 'minHeight',
|
||||
transform: sizingTransform
|
||||
});
|
||||
export const sizeWidth = style({
|
||||
prop: 'size',
|
||||
cssProperty: 'width',
|
||||
transform: sizingTransform
|
||||
});
|
||||
export const sizeHeight = style({
|
||||
prop: 'size',
|
||||
cssProperty: 'height',
|
||||
transform: sizingTransform
|
||||
});
|
||||
export const boxSizing = style({
|
||||
prop: 'boxSizing'
|
||||
});
|
||||
const sizing = compose(width, maxWidth, minWidth, height, maxHeight, minHeight, boxSizing);
|
||||
export default sizing;
|
||||
2
node_modules/@mui/system/modern/spacing/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/spacing/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./spacing.js";
|
||||
export * from "./spacing.js";
|
||||
148
node_modules/@mui/system/modern/spacing/spacing.js
generated
vendored
Normal file
148
node_modules/@mui/system/modern/spacing/spacing.js
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
import responsivePropType from "../responsivePropType/index.js";
|
||||
import { handleBreakpoints } from "../breakpoints/index.js";
|
||||
import { getPath } from "../style/index.js";
|
||||
import merge from "../merge/index.js";
|
||||
import memoize from "../memoize/index.js";
|
||||
const properties = {
|
||||
m: 'margin',
|
||||
p: 'padding'
|
||||
};
|
||||
const directions = {
|
||||
t: 'Top',
|
||||
r: 'Right',
|
||||
b: 'Bottom',
|
||||
l: 'Left',
|
||||
x: ['Left', 'Right'],
|
||||
y: ['Top', 'Bottom']
|
||||
};
|
||||
const aliases = {
|
||||
marginX: 'mx',
|
||||
marginY: 'my',
|
||||
paddingX: 'px',
|
||||
paddingY: 'py'
|
||||
};
|
||||
|
||||
// memoize() impact:
|
||||
// From 300,000 ops/sec
|
||||
// To 350,000 ops/sec
|
||||
const getCssProperties = memoize(prop => {
|
||||
// It's not a shorthand notation.
|
||||
if (prop.length > 2) {
|
||||
if (aliases[prop]) {
|
||||
prop = aliases[prop];
|
||||
} else {
|
||||
return [prop];
|
||||
}
|
||||
}
|
||||
const [a, b] = prop.split('');
|
||||
const property = properties[a];
|
||||
const direction = directions[b] || '';
|
||||
return Array.isArray(direction) ? direction.map(dir => property + dir) : [property + direction];
|
||||
});
|
||||
export const marginKeys = ['m', 'mt', 'mr', 'mb', 'ml', 'mx', 'my', 'margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft', 'marginX', 'marginY', 'marginInline', 'marginInlineStart', 'marginInlineEnd', 'marginBlock', 'marginBlockStart', 'marginBlockEnd'];
|
||||
export const paddingKeys = ['p', 'pt', 'pr', 'pb', 'pl', 'px', 'py', 'padding', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'paddingX', 'paddingY', 'paddingInline', 'paddingInlineStart', 'paddingInlineEnd', 'paddingBlock', 'paddingBlockStart', 'paddingBlockEnd'];
|
||||
const spacingKeys = [...marginKeys, ...paddingKeys];
|
||||
export function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
||||
const themeSpacing = getPath(theme, themeKey, true) ?? defaultValue;
|
||||
if (typeof themeSpacing === 'number' || typeof themeSpacing === 'string') {
|
||||
return val => {
|
||||
if (typeof val === 'string') {
|
||||
return val;
|
||||
}
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof val !== 'number') {
|
||||
console.error(`MUI: Expected ${propName} argument to be a number or a string, got ${val}.`);
|
||||
}
|
||||
}
|
||||
if (typeof themeSpacing === 'string') {
|
||||
return `calc(${val} * ${themeSpacing})`;
|
||||
}
|
||||
return themeSpacing * val;
|
||||
};
|
||||
}
|
||||
if (Array.isArray(themeSpacing)) {
|
||||
return val => {
|
||||
if (typeof val === 'string') {
|
||||
return val;
|
||||
}
|
||||
const abs = Math.abs(val);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!Number.isInteger(abs)) {
|
||||
console.error([`MUI: The \`theme.${themeKey}\` array type cannot be combined with non integer values.` + `You should either use an integer value that can be used as index, or define the \`theme.${themeKey}\` as a number.`].join('\n'));
|
||||
} else if (abs > themeSpacing.length - 1) {
|
||||
console.error([`MUI: The value provided (${abs}) overflows.`, `The supported values are: ${JSON.stringify(themeSpacing)}.`, `${abs} > ${themeSpacing.length - 1}, you need to add the missing values.`].join('\n'));
|
||||
}
|
||||
}
|
||||
const transformed = themeSpacing[abs];
|
||||
if (val >= 0) {
|
||||
return transformed;
|
||||
}
|
||||
if (typeof transformed === 'number') {
|
||||
return -transformed;
|
||||
}
|
||||
return `-${transformed}`;
|
||||
};
|
||||
}
|
||||
if (typeof themeSpacing === 'function') {
|
||||
return themeSpacing;
|
||||
}
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
console.error([`MUI: The \`theme.${themeKey}\` value (${themeSpacing}) is invalid.`, 'It should be a number, an array or a function.'].join('\n'));
|
||||
}
|
||||
return () => undefined;
|
||||
}
|
||||
export function createUnarySpacing(theme) {
|
||||
return createUnaryUnit(theme, 'spacing', 8, 'spacing');
|
||||
}
|
||||
export function getValue(transformer, propValue) {
|
||||
if (typeof propValue === 'string' || propValue == null) {
|
||||
return propValue;
|
||||
}
|
||||
return transformer(propValue);
|
||||
}
|
||||
export function getStyleFromPropValue(cssProperties, transformer) {
|
||||
return propValue => cssProperties.reduce((acc, cssProperty) => {
|
||||
acc[cssProperty] = getValue(transformer, propValue);
|
||||
return acc;
|
||||
}, {});
|
||||
}
|
||||
function resolveCssProperty(props, keys, prop, transformer) {
|
||||
// Using a hash computation over an array iteration could be faster, but with only 28 items,
|
||||
// it's doesn't worth the bundle size.
|
||||
if (!keys.includes(prop)) {
|
||||
return null;
|
||||
}
|
||||
const cssProperties = getCssProperties(prop);
|
||||
const styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);
|
||||
const propValue = props[prop];
|
||||
return handleBreakpoints(props, propValue, styleFromPropValue);
|
||||
}
|
||||
function style(props, keys) {
|
||||
const transformer = createUnarySpacing(props.theme);
|
||||
return Object.keys(props).map(prop => resolveCssProperty(props, keys, prop, transformer)).reduce(merge, {});
|
||||
}
|
||||
export function margin(props) {
|
||||
return style(props, marginKeys);
|
||||
}
|
||||
margin.propTypes = process.env.NODE_ENV !== 'production' ? marginKeys.reduce((obj, key) => {
|
||||
obj[key] = responsivePropType;
|
||||
return obj;
|
||||
}, {}) : {};
|
||||
margin.filterProps = marginKeys;
|
||||
export function padding(props) {
|
||||
return style(props, paddingKeys);
|
||||
}
|
||||
padding.propTypes = process.env.NODE_ENV !== 'production' ? paddingKeys.reduce((obj, key) => {
|
||||
obj[key] = responsivePropType;
|
||||
return obj;
|
||||
}, {}) : {};
|
||||
padding.filterProps = paddingKeys;
|
||||
function spacing(props) {
|
||||
return style(props, spacingKeys);
|
||||
}
|
||||
spacing.propTypes = process.env.NODE_ENV !== 'production' ? spacingKeys.reduce((obj, key) => {
|
||||
obj[key] = responsivePropType;
|
||||
return obj;
|
||||
}, {}) : {};
|
||||
spacing.filterProps = spacingKeys;
|
||||
export default spacing;
|
||||
2
node_modules/@mui/system/modern/style/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/style/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./style.js";
|
||||
export * from "./style.js";
|
||||
75
node_modules/@mui/system/modern/style/style.js
generated
vendored
Normal file
75
node_modules/@mui/system/modern/style/style.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
import capitalize from '@mui/utils/capitalize';
|
||||
import responsivePropType from "../responsivePropType/index.js";
|
||||
import { handleBreakpoints } from "../breakpoints/index.js";
|
||||
export function getPath(obj, path, checkVars = true) {
|
||||
if (!path || typeof path !== 'string') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Check if CSS variables are used
|
||||
if (obj && obj.vars && checkVars) {
|
||||
const val = `vars.${path}`.split('.').reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
|
||||
if (val != null) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return path.split('.').reduce((acc, item) => {
|
||||
if (acc && acc[item] != null) {
|
||||
return acc[item];
|
||||
}
|
||||
return null;
|
||||
}, obj);
|
||||
}
|
||||
export function getStyleValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
|
||||
let value;
|
||||
if (typeof themeMapping === 'function') {
|
||||
value = themeMapping(propValueFinal);
|
||||
} else if (Array.isArray(themeMapping)) {
|
||||
value = themeMapping[propValueFinal] || userValue;
|
||||
} else {
|
||||
value = getPath(themeMapping, propValueFinal) || userValue;
|
||||
}
|
||||
if (transform) {
|
||||
value = transform(value, userValue, themeMapping);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function style(options) {
|
||||
const {
|
||||
prop,
|
||||
cssProperty = options.prop,
|
||||
themeKey,
|
||||
transform
|
||||
} = options;
|
||||
|
||||
// false positive
|
||||
// eslint-disable-next-line react/function-component-definition
|
||||
const fn = props => {
|
||||
if (props[prop] == null) {
|
||||
return null;
|
||||
}
|
||||
const propValue = props[prop];
|
||||
const theme = props.theme;
|
||||
const themeMapping = getPath(theme, themeKey) || {};
|
||||
const styleFromPropValue = propValueFinal => {
|
||||
let value = getStyleValue(themeMapping, transform, propValueFinal);
|
||||
if (propValueFinal === value && typeof propValueFinal === 'string') {
|
||||
// Haven't found value
|
||||
value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : capitalize(propValueFinal)}`, propValueFinal);
|
||||
}
|
||||
if (cssProperty === false) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
[cssProperty]: value
|
||||
};
|
||||
};
|
||||
return handleBreakpoints(props, propValue, styleFromPropValue);
|
||||
};
|
||||
fn.propTypes = process.env.NODE_ENV !== 'production' ? {
|
||||
[prop]: responsivePropType
|
||||
} : {};
|
||||
fn.filterProps = [prop];
|
||||
return fn;
|
||||
}
|
||||
export default style;
|
||||
294
node_modules/@mui/system/modern/styleFunctionSx/defaultSxConfig.js
generated
vendored
Normal file
294
node_modules/@mui/system/modern/styleFunctionSx/defaultSxConfig.js
generated
vendored
Normal file
@@ -0,0 +1,294 @@
|
||||
import { padding, margin } from "../spacing/index.js";
|
||||
import { borderRadius, borderTransform } from "../borders/index.js";
|
||||
import { gap, rowGap, columnGap } from "../cssGrid/index.js";
|
||||
import { paletteTransform } from "../palette/index.js";
|
||||
import { maxWidth, sizingTransform } from "../sizing/index.js";
|
||||
const defaultSxConfig = {
|
||||
// borders
|
||||
border: {
|
||||
themeKey: 'borders',
|
||||
transform: borderTransform
|
||||
},
|
||||
borderTop: {
|
||||
themeKey: 'borders',
|
||||
transform: borderTransform
|
||||
},
|
||||
borderRight: {
|
||||
themeKey: 'borders',
|
||||
transform: borderTransform
|
||||
},
|
||||
borderBottom: {
|
||||
themeKey: 'borders',
|
||||
transform: borderTransform
|
||||
},
|
||||
borderLeft: {
|
||||
themeKey: 'borders',
|
||||
transform: borderTransform
|
||||
},
|
||||
borderColor: {
|
||||
themeKey: 'palette'
|
||||
},
|
||||
borderTopColor: {
|
||||
themeKey: 'palette'
|
||||
},
|
||||
borderRightColor: {
|
||||
themeKey: 'palette'
|
||||
},
|
||||
borderBottomColor: {
|
||||
themeKey: 'palette'
|
||||
},
|
||||
borderLeftColor: {
|
||||
themeKey: 'palette'
|
||||
},
|
||||
outline: {
|
||||
themeKey: 'borders',
|
||||
transform: borderTransform
|
||||
},
|
||||
outlineColor: {
|
||||
themeKey: 'palette'
|
||||
},
|
||||
borderRadius: {
|
||||
themeKey: 'shape.borderRadius',
|
||||
style: borderRadius
|
||||
},
|
||||
// palette
|
||||
color: {
|
||||
themeKey: 'palette',
|
||||
transform: paletteTransform
|
||||
},
|
||||
bgcolor: {
|
||||
themeKey: 'palette',
|
||||
cssProperty: 'backgroundColor',
|
||||
transform: paletteTransform
|
||||
},
|
||||
backgroundColor: {
|
||||
themeKey: 'palette',
|
||||
transform: paletteTransform
|
||||
},
|
||||
// spacing
|
||||
p: {
|
||||
style: padding
|
||||
},
|
||||
pt: {
|
||||
style: padding
|
||||
},
|
||||
pr: {
|
||||
style: padding
|
||||
},
|
||||
pb: {
|
||||
style: padding
|
||||
},
|
||||
pl: {
|
||||
style: padding
|
||||
},
|
||||
px: {
|
||||
style: padding
|
||||
},
|
||||
py: {
|
||||
style: padding
|
||||
},
|
||||
padding: {
|
||||
style: padding
|
||||
},
|
||||
paddingTop: {
|
||||
style: padding
|
||||
},
|
||||
paddingRight: {
|
||||
style: padding
|
||||
},
|
||||
paddingBottom: {
|
||||
style: padding
|
||||
},
|
||||
paddingLeft: {
|
||||
style: padding
|
||||
},
|
||||
paddingX: {
|
||||
style: padding
|
||||
},
|
||||
paddingY: {
|
||||
style: padding
|
||||
},
|
||||
paddingInline: {
|
||||
style: padding
|
||||
},
|
||||
paddingInlineStart: {
|
||||
style: padding
|
||||
},
|
||||
paddingInlineEnd: {
|
||||
style: padding
|
||||
},
|
||||
paddingBlock: {
|
||||
style: padding
|
||||
},
|
||||
paddingBlockStart: {
|
||||
style: padding
|
||||
},
|
||||
paddingBlockEnd: {
|
||||
style: padding
|
||||
},
|
||||
m: {
|
||||
style: margin
|
||||
},
|
||||
mt: {
|
||||
style: margin
|
||||
},
|
||||
mr: {
|
||||
style: margin
|
||||
},
|
||||
mb: {
|
||||
style: margin
|
||||
},
|
||||
ml: {
|
||||
style: margin
|
||||
},
|
||||
mx: {
|
||||
style: margin
|
||||
},
|
||||
my: {
|
||||
style: margin
|
||||
},
|
||||
margin: {
|
||||
style: margin
|
||||
},
|
||||
marginTop: {
|
||||
style: margin
|
||||
},
|
||||
marginRight: {
|
||||
style: margin
|
||||
},
|
||||
marginBottom: {
|
||||
style: margin
|
||||
},
|
||||
marginLeft: {
|
||||
style: margin
|
||||
},
|
||||
marginX: {
|
||||
style: margin
|
||||
},
|
||||
marginY: {
|
||||
style: margin
|
||||
},
|
||||
marginInline: {
|
||||
style: margin
|
||||
},
|
||||
marginInlineStart: {
|
||||
style: margin
|
||||
},
|
||||
marginInlineEnd: {
|
||||
style: margin
|
||||
},
|
||||
marginBlock: {
|
||||
style: margin
|
||||
},
|
||||
marginBlockStart: {
|
||||
style: margin
|
||||
},
|
||||
marginBlockEnd: {
|
||||
style: margin
|
||||
},
|
||||
// display
|
||||
displayPrint: {
|
||||
cssProperty: false,
|
||||
transform: value => ({
|
||||
'@media print': {
|
||||
display: value
|
||||
}
|
||||
})
|
||||
},
|
||||
display: {},
|
||||
overflow: {},
|
||||
textOverflow: {},
|
||||
visibility: {},
|
||||
whiteSpace: {},
|
||||
// flexbox
|
||||
flexBasis: {},
|
||||
flexDirection: {},
|
||||
flexWrap: {},
|
||||
justifyContent: {},
|
||||
alignItems: {},
|
||||
alignContent: {},
|
||||
order: {},
|
||||
flex: {},
|
||||
flexGrow: {},
|
||||
flexShrink: {},
|
||||
alignSelf: {},
|
||||
justifyItems: {},
|
||||
justifySelf: {},
|
||||
// grid
|
||||
gap: {
|
||||
style: gap
|
||||
},
|
||||
rowGap: {
|
||||
style: rowGap
|
||||
},
|
||||
columnGap: {
|
||||
style: columnGap
|
||||
},
|
||||
gridColumn: {},
|
||||
gridRow: {},
|
||||
gridAutoFlow: {},
|
||||
gridAutoColumns: {},
|
||||
gridAutoRows: {},
|
||||
gridTemplateColumns: {},
|
||||
gridTemplateRows: {},
|
||||
gridTemplateAreas: {},
|
||||
gridArea: {},
|
||||
// positions
|
||||
position: {},
|
||||
zIndex: {
|
||||
themeKey: 'zIndex'
|
||||
},
|
||||
top: {},
|
||||
right: {},
|
||||
bottom: {},
|
||||
left: {},
|
||||
// shadows
|
||||
boxShadow: {
|
||||
themeKey: 'shadows'
|
||||
},
|
||||
// sizing
|
||||
width: {
|
||||
transform: sizingTransform
|
||||
},
|
||||
maxWidth: {
|
||||
style: maxWidth
|
||||
},
|
||||
minWidth: {
|
||||
transform: sizingTransform
|
||||
},
|
||||
height: {
|
||||
transform: sizingTransform
|
||||
},
|
||||
maxHeight: {
|
||||
transform: sizingTransform
|
||||
},
|
||||
minHeight: {
|
||||
transform: sizingTransform
|
||||
},
|
||||
boxSizing: {},
|
||||
// typography
|
||||
font: {
|
||||
themeKey: 'font'
|
||||
},
|
||||
fontFamily: {
|
||||
themeKey: 'typography'
|
||||
},
|
||||
fontSize: {
|
||||
themeKey: 'typography'
|
||||
},
|
||||
fontStyle: {
|
||||
themeKey: 'typography'
|
||||
},
|
||||
fontWeight: {
|
||||
themeKey: 'typography'
|
||||
},
|
||||
letterSpacing: {},
|
||||
textTransform: {},
|
||||
lineHeight: {},
|
||||
textAlign: {},
|
||||
typography: {
|
||||
cssProperty: false,
|
||||
themeKey: 'typography'
|
||||
}
|
||||
};
|
||||
export default defaultSxConfig;
|
||||
51
node_modules/@mui/system/modern/styleFunctionSx/extendSxProp.js
generated
vendored
Normal file
51
node_modules/@mui/system/modern/styleFunctionSx/extendSxProp.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import { isPlainObject } from '@mui/utils/deepmerge';
|
||||
import defaultSxConfig from "./defaultSxConfig.js";
|
||||
const splitProps = props => {
|
||||
const result = {
|
||||
systemProps: {},
|
||||
otherProps: {}
|
||||
};
|
||||
const config = props?.theme?.unstable_sxConfig ?? defaultSxConfig;
|
||||
Object.keys(props).forEach(prop => {
|
||||
if (config[prop]) {
|
||||
result.systemProps[prop] = props[prop];
|
||||
} else {
|
||||
result.otherProps[prop] = props[prop];
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
export default function extendSxProp(props) {
|
||||
const {
|
||||
sx: inSx,
|
||||
...other
|
||||
} = props;
|
||||
const {
|
||||
systemProps,
|
||||
otherProps
|
||||
} = splitProps(other);
|
||||
let finalSx;
|
||||
if (Array.isArray(inSx)) {
|
||||
finalSx = [systemProps, ...inSx];
|
||||
} else if (typeof inSx === 'function') {
|
||||
finalSx = (...args) => {
|
||||
const result = inSx(...args);
|
||||
if (!isPlainObject(result)) {
|
||||
return systemProps;
|
||||
}
|
||||
return {
|
||||
...systemProps,
|
||||
...result
|
||||
};
|
||||
};
|
||||
} else {
|
||||
finalSx = {
|
||||
...systemProps,
|
||||
...inSx
|
||||
};
|
||||
}
|
||||
return {
|
||||
...otherProps,
|
||||
sx: finalSx
|
||||
};
|
||||
}
|
||||
4
node_modules/@mui/system/modern/styleFunctionSx/index.js
generated
vendored
Normal file
4
node_modules/@mui/system/modern/styleFunctionSx/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export { default } from "./styleFunctionSx.js";
|
||||
export { unstable_createStyleFunctionSx } from "./styleFunctionSx.js";
|
||||
export { default as extendSxProp } from "./extendSxProp.js";
|
||||
export { default as unstable_defaultSxConfig } from "./defaultSxConfig.js";
|
||||
127
node_modules/@mui/system/modern/styleFunctionSx/styleFunctionSx.js
generated
vendored
Normal file
127
node_modules/@mui/system/modern/styleFunctionSx/styleFunctionSx.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
import capitalize from '@mui/utils/capitalize';
|
||||
import merge from "../merge/index.js";
|
||||
import { getPath, getStyleValue as getValue } from "../style/index.js";
|
||||
import { handleBreakpoints, createEmptyBreakpointObject, removeUnusedBreakpoints } from "../breakpoints/index.js";
|
||||
import { sortContainerQueries } from "../cssContainerQueries/index.js";
|
||||
import defaultSxConfig from "./defaultSxConfig.js";
|
||||
function objectsHaveSameKeys(...objects) {
|
||||
const allKeys = objects.reduce((keys, object) => keys.concat(Object.keys(object)), []);
|
||||
const union = new Set(allKeys);
|
||||
return objects.every(object => union.size === Object.keys(object).length);
|
||||
}
|
||||
function callIfFn(maybeFn, arg) {
|
||||
return typeof maybeFn === 'function' ? maybeFn(arg) : maybeFn;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
export function unstable_createStyleFunctionSx() {
|
||||
function getThemeValue(prop, val, theme, config) {
|
||||
const props = {
|
||||
[prop]: val,
|
||||
theme
|
||||
};
|
||||
const options = config[prop];
|
||||
if (!options) {
|
||||
return {
|
||||
[prop]: val
|
||||
};
|
||||
}
|
||||
const {
|
||||
cssProperty = prop,
|
||||
themeKey,
|
||||
transform,
|
||||
style
|
||||
} = options;
|
||||
if (val == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO v6: remove, see https://github.com/mui/material-ui/pull/38123
|
||||
if (themeKey === 'typography' && val === 'inherit') {
|
||||
return {
|
||||
[prop]: val
|
||||
};
|
||||
}
|
||||
const themeMapping = getPath(theme, themeKey) || {};
|
||||
if (style) {
|
||||
return style(props);
|
||||
}
|
||||
const styleFromPropValue = propValueFinal => {
|
||||
let value = getValue(themeMapping, transform, propValueFinal);
|
||||
if (propValueFinal === value && typeof propValueFinal === 'string') {
|
||||
// Haven't found value
|
||||
value = getValue(themeMapping, transform, `${prop}${propValueFinal === 'default' ? '' : capitalize(propValueFinal)}`, propValueFinal);
|
||||
}
|
||||
if (cssProperty === false) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
[cssProperty]: value
|
||||
};
|
||||
};
|
||||
return handleBreakpoints(props, val, styleFromPropValue);
|
||||
}
|
||||
function styleFunctionSx(props) {
|
||||
const {
|
||||
sx,
|
||||
theme = {}
|
||||
} = props || {};
|
||||
if (!sx) {
|
||||
return null; // Emotion & styled-components will neglect null
|
||||
}
|
||||
const config = theme.unstable_sxConfig ?? defaultSxConfig;
|
||||
|
||||
/*
|
||||
* Receive `sxInput` as object or callback
|
||||
* and then recursively check keys & values to create media query object styles.
|
||||
* (the result will be used in `styled`)
|
||||
*/
|
||||
function traverse(sxInput) {
|
||||
let sxObject = sxInput;
|
||||
if (typeof sxInput === 'function') {
|
||||
sxObject = sxInput(theme);
|
||||
} else if (typeof sxInput !== 'object') {
|
||||
// value
|
||||
return sxInput;
|
||||
}
|
||||
if (!sxObject) {
|
||||
return null;
|
||||
}
|
||||
const emptyBreakpoints = createEmptyBreakpointObject(theme.breakpoints);
|
||||
const breakpointsKeys = Object.keys(emptyBreakpoints);
|
||||
let css = emptyBreakpoints;
|
||||
Object.keys(sxObject).forEach(styleKey => {
|
||||
const value = callIfFn(sxObject[styleKey], theme);
|
||||
if (value !== null && value !== undefined) {
|
||||
if (typeof value === 'object') {
|
||||
if (config[styleKey]) {
|
||||
css = merge(css, getThemeValue(styleKey, value, theme, config));
|
||||
} else {
|
||||
const breakpointsValues = handleBreakpoints({
|
||||
theme
|
||||
}, value, x => ({
|
||||
[styleKey]: x
|
||||
}));
|
||||
if (objectsHaveSameKeys(breakpointsValues, value)) {
|
||||
css[styleKey] = styleFunctionSx({
|
||||
sx: value,
|
||||
theme
|
||||
});
|
||||
} else {
|
||||
css = merge(css, breakpointsValues);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
css = merge(css, getThemeValue(styleKey, value, theme, config));
|
||||
}
|
||||
}
|
||||
});
|
||||
return sortContainerQueries(theme, removeUnusedBreakpoints(breakpointsKeys, css));
|
||||
}
|
||||
return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);
|
||||
}
|
||||
return styleFunctionSx;
|
||||
}
|
||||
const styleFunctionSx = unstable_createStyleFunctionSx();
|
||||
styleFunctionSx.filterProps = ['sx'];
|
||||
export default styleFunctionSx;
|
||||
1
node_modules/@mui/system/modern/styled/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/modern/styled/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./styled.js";
|
||||
3
node_modules/@mui/system/modern/styled/styled.js
generated
vendored
Normal file
3
node_modules/@mui/system/modern/styled/styled.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import createStyled from "../createStyled/index.js";
|
||||
const styled = createStyled();
|
||||
export default styled;
|
||||
2
node_modules/@mui/system/modern/typography/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/typography/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./typography.js";
|
||||
export * from "./typography.js";
|
||||
37
node_modules/@mui/system/modern/typography/typography.js
generated
vendored
Normal file
37
node_modules/@mui/system/modern/typography/typography.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
import style from "../style/index.js";
|
||||
import compose from "../compose/index.js";
|
||||
export const fontFamily = style({
|
||||
prop: 'fontFamily',
|
||||
themeKey: 'typography'
|
||||
});
|
||||
export const fontSize = style({
|
||||
prop: 'fontSize',
|
||||
themeKey: 'typography'
|
||||
});
|
||||
export const fontStyle = style({
|
||||
prop: 'fontStyle',
|
||||
themeKey: 'typography'
|
||||
});
|
||||
export const fontWeight = style({
|
||||
prop: 'fontWeight',
|
||||
themeKey: 'typography'
|
||||
});
|
||||
export const letterSpacing = style({
|
||||
prop: 'letterSpacing'
|
||||
});
|
||||
export const textTransform = style({
|
||||
prop: 'textTransform'
|
||||
});
|
||||
export const lineHeight = style({
|
||||
prop: 'lineHeight'
|
||||
});
|
||||
export const textAlign = style({
|
||||
prop: 'textAlign'
|
||||
});
|
||||
export const typographyVariant = style({
|
||||
prop: 'typography',
|
||||
cssProperty: false,
|
||||
themeKey: 'typography'
|
||||
});
|
||||
const typography = compose(typographyVariant, fontFamily, fontSize, fontStyle, fontWeight, letterSpacing, lineHeight, textAlign, textTransform);
|
||||
export default typography;
|
||||
2
node_modules/@mui/system/modern/useMediaQuery/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/useMediaQuery/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./useMediaQuery.js";
|
||||
export * from "./useMediaQuery.js";
|
||||
104
node_modules/@mui/system/modern/useMediaQuery/useMediaQuery.js
generated
vendored
Normal file
104
node_modules/@mui/system/modern/useMediaQuery/useMediaQuery.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
||||
import { getThemeProps } from "../useThemeProps/index.js";
|
||||
import useTheme from "../useThemeWithoutDefault/index.js";
|
||||
function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
|
||||
const [match, setMatch] = React.useState(() => {
|
||||
if (noSsr && matchMedia) {
|
||||
return matchMedia(query).matches;
|
||||
}
|
||||
if (ssrMatchMedia) {
|
||||
return ssrMatchMedia(query).matches;
|
||||
}
|
||||
|
||||
// Once the component is mounted, we rely on the
|
||||
// event listeners to return the correct matches value.
|
||||
return defaultMatches;
|
||||
});
|
||||
useEnhancedEffect(() => {
|
||||
if (!matchMedia) {
|
||||
return undefined;
|
||||
}
|
||||
const queryList = matchMedia(query);
|
||||
const updateMatch = () => {
|
||||
setMatch(queryList.matches);
|
||||
};
|
||||
updateMatch();
|
||||
queryList.addEventListener('change', updateMatch);
|
||||
return () => {
|
||||
queryList.removeEventListener('change', updateMatch);
|
||||
};
|
||||
}, [query, matchMedia]);
|
||||
return match;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
|
||||
const maybeReactUseSyncExternalStore = React['useSyncExternalStore' + ''];
|
||||
function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
|
||||
const getDefaultSnapshot = React.useCallback(() => defaultMatches, [defaultMatches]);
|
||||
const getServerSnapshot = React.useMemo(() => {
|
||||
if (noSsr && matchMedia) {
|
||||
return () => matchMedia(query).matches;
|
||||
}
|
||||
if (ssrMatchMedia !== null) {
|
||||
const {
|
||||
matches
|
||||
} = ssrMatchMedia(query);
|
||||
return () => matches;
|
||||
}
|
||||
return getDefaultSnapshot;
|
||||
}, [getDefaultSnapshot, query, ssrMatchMedia, noSsr, matchMedia]);
|
||||
const [getSnapshot, subscribe] = React.useMemo(() => {
|
||||
if (matchMedia === null) {
|
||||
return [getDefaultSnapshot, () => () => {}];
|
||||
}
|
||||
const mediaQueryList = matchMedia(query);
|
||||
return [() => mediaQueryList.matches, notify => {
|
||||
mediaQueryList.addEventListener('change', notify);
|
||||
return () => {
|
||||
mediaQueryList.removeEventListener('change', notify);
|
||||
};
|
||||
}];
|
||||
}, [getDefaultSnapshot, matchMedia, query]);
|
||||
const match = maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
||||
return match;
|
||||
}
|
||||
export default function useMediaQuery(queryInput, options = {}) {
|
||||
const theme = useTheme();
|
||||
// Wait for jsdom to support the match media feature.
|
||||
// All the browsers MUI support have this built-in.
|
||||
// This defensive check is here for simplicity.
|
||||
// Most of the time, the match media logic isn't central to people tests.
|
||||
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
||||
const {
|
||||
defaultMatches = false,
|
||||
matchMedia = supportMatchMedia ? window.matchMedia : null,
|
||||
ssrMatchMedia = null,
|
||||
noSsr = false
|
||||
} = getThemeProps({
|
||||
name: 'MuiUseMediaQuery',
|
||||
props: options,
|
||||
theme
|
||||
});
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (typeof queryInput === 'function' && theme === null) {
|
||||
console.error(['MUI: The `query` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\n'));
|
||||
}
|
||||
}
|
||||
let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
|
||||
query = query.replace(/^@media( ?)/m, '');
|
||||
|
||||
// TODO: Drop `useMediaQueryOld` and use `use-sync-external-store` shim in `useMediaQueryNew` once the package is stable
|
||||
const useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
|
||||
const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
React.useDebugValue({
|
||||
query,
|
||||
match
|
||||
});
|
||||
}
|
||||
return match;
|
||||
}
|
||||
2
node_modules/@mui/system/modern/useTheme/index.js
generated
vendored
Normal file
2
node_modules/@mui/system/modern/useTheme/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default } from "./useTheme.js";
|
||||
export * from "./useTheme.js";
|
||||
9
node_modules/@mui/system/modern/useTheme/useTheme.js
generated
vendored
Normal file
9
node_modules/@mui/system/modern/useTheme/useTheme.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
'use client';
|
||||
|
||||
import createTheme from "../createTheme/index.js";
|
||||
import useThemeWithoutDefault from "../useThemeWithoutDefault/index.js";
|
||||
export const systemDefaultTheme = createTheme();
|
||||
function useTheme(defaultTheme = systemDefaultTheme) {
|
||||
return useThemeWithoutDefault(defaultTheme);
|
||||
}
|
||||
export default useTheme;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user