Jesus sucks
This commit is contained in:
149
backend/frontend/node_modules/@mui/material/legacy/Hidden/Hidden.js
generated
vendored
Normal file
149
backend/frontend/node_modules/@mui/material/legacy/Hidden/Hidden.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
'use client';
|
||||
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import HiddenJs from './HiddenJs';
|
||||
import HiddenCss from './HiddenCss';
|
||||
|
||||
/**
|
||||
* Responsively hides children based on the selected implementation.
|
||||
*
|
||||
* @deprecated The Hidden component was deprecated in Material UI v5. To learn more, see [the Hidden section](/material-ui/migration/v5-component-changes/#hidden) of the migration docs.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
function Hidden(props) {
|
||||
var _props$implementation = props.implementation,
|
||||
implementation = _props$implementation === void 0 ? 'js' : _props$implementation,
|
||||
_props$lgDown = props.lgDown,
|
||||
lgDown = _props$lgDown === void 0 ? false : _props$lgDown,
|
||||
_props$lgUp = props.lgUp,
|
||||
lgUp = _props$lgUp === void 0 ? false : _props$lgUp,
|
||||
_props$mdDown = props.mdDown,
|
||||
mdDown = _props$mdDown === void 0 ? false : _props$mdDown,
|
||||
_props$mdUp = props.mdUp,
|
||||
mdUp = _props$mdUp === void 0 ? false : _props$mdUp,
|
||||
_props$smDown = props.smDown,
|
||||
smDown = _props$smDown === void 0 ? false : _props$smDown,
|
||||
_props$smUp = props.smUp,
|
||||
smUp = _props$smUp === void 0 ? false : _props$smUp,
|
||||
_props$xlDown = props.xlDown,
|
||||
xlDown = _props$xlDown === void 0 ? false : _props$xlDown,
|
||||
_props$xlUp = props.xlUp,
|
||||
xlUp = _props$xlUp === void 0 ? false : _props$xlUp,
|
||||
_props$xsDown = props.xsDown,
|
||||
xsDown = _props$xsDown === void 0 ? false : _props$xsDown,
|
||||
_props$xsUp = props.xsUp,
|
||||
xsUp = _props$xsUp === void 0 ? false : _props$xsUp,
|
||||
other = _objectWithoutProperties(props, ["implementation", "lgDown", "lgUp", "mdDown", "mdUp", "smDown", "smUp", "xlDown", "xlUp", "xsDown", "xsUp"]);
|
||||
if (implementation === 'js') {
|
||||
return /*#__PURE__*/_jsx(HiddenJs, _extends({
|
||||
lgDown: lgDown,
|
||||
lgUp: lgUp,
|
||||
mdDown: mdDown,
|
||||
mdUp: mdUp,
|
||||
smDown: smDown,
|
||||
smUp: smUp,
|
||||
xlDown: xlDown,
|
||||
xlUp: xlUp,
|
||||
xsDown: xsDown,
|
||||
xsUp: xsUp
|
||||
}, other));
|
||||
}
|
||||
return /*#__PURE__*/_jsx(HiddenCss, _extends({
|
||||
lgDown: lgDown,
|
||||
lgUp: lgUp,
|
||||
mdDown: mdDown,
|
||||
mdUp: mdUp,
|
||||
smDown: smDown,
|
||||
smUp: smUp,
|
||||
xlDown: xlDown,
|
||||
xlUp: xlUp,
|
||||
xsDown: xsDown,
|
||||
xsUp: xsUp
|
||||
}, other));
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? Hidden.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`. │
|
||||
// └─────────────────────────────────────────────────────────────────────┘
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* Specify which implementation to use. 'js' is the default, 'css' works better for
|
||||
* server-side rendering.
|
||||
* @default 'js'
|
||||
*/
|
||||
implementation: PropTypes.oneOf(['css', 'js']),
|
||||
/**
|
||||
* You can use this prop when choosing the `js` implementation with server-side rendering.
|
||||
*
|
||||
* As `window.innerWidth` is unavailable on the server,
|
||||
* we default to rendering an empty component during the first mount.
|
||||
* You might want to use a heuristic to approximate
|
||||
* the screen width of the client browser screen width.
|
||||
*
|
||||
* For instance, you could be using the user-agent or the client-hints.
|
||||
* https://caniuse.com/#search=client%20hint
|
||||
*/
|
||||
initialWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
|
||||
/**
|
||||
* If `true`, component is hidden on screens below (but not including) this size.
|
||||
* @default false
|
||||
*/
|
||||
lgDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, component is hidden on screens this size and above.
|
||||
* @default false
|
||||
*/
|
||||
lgUp: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, component is hidden on screens below (but not including) this size.
|
||||
* @default false
|
||||
*/
|
||||
mdDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, component is hidden on screens this size and above.
|
||||
* @default false
|
||||
*/
|
||||
mdUp: PropTypes.bool,
|
||||
/**
|
||||
* Hide the given breakpoint(s).
|
||||
*/
|
||||
only: PropTypes.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']), PropTypes.arrayOf(PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']).isRequired)]),
|
||||
/**
|
||||
* If `true`, component is hidden on screens below (but not including) this size.
|
||||
* @default false
|
||||
*/
|
||||
smDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, component is hidden on screens this size and above.
|
||||
* @default false
|
||||
*/
|
||||
smUp: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, component is hidden on screens below (but not including) this size.
|
||||
* @default false
|
||||
*/
|
||||
xlDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, component is hidden on screens this size and above.
|
||||
* @default false
|
||||
*/
|
||||
xlUp: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, component is hidden on screens below (but not including) this size.
|
||||
* @default false
|
||||
*/
|
||||
xsDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, component is hidden on screens this size and above.
|
||||
* @default false
|
||||
*/
|
||||
xsUp: PropTypes.bool
|
||||
} : void 0;
|
||||
export default Hidden;
|
||||
168
backend/frontend/node_modules/@mui/material/legacy/Hidden/HiddenCss.js
generated
vendored
Normal file
168
backend/frontend/node_modules/@mui/material/legacy/Hidden/HiddenCss.js
generated
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
'use client';
|
||||
|
||||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
||||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
||||
import * as React from 'react';
|
||||
import clsx from 'clsx';
|
||||
import PropTypes from 'prop-types';
|
||||
import composeClasses from '@mui/utils/composeClasses';
|
||||
import capitalize from '../utils/capitalize';
|
||||
import styled from '../styles/styled';
|
||||
import useTheme from '../styles/useTheme';
|
||||
import { getHiddenCssUtilityClass } from './hiddenCssClasses';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
||||
var classes = ownerState.classes,
|
||||
breakpoints = ownerState.breakpoints;
|
||||
var slots = {
|
||||
root: ['root'].concat(_toConsumableArray(breakpoints.map(function (_ref) {
|
||||
var breakpoint = _ref.breakpoint,
|
||||
dir = _ref.dir;
|
||||
return dir === 'only' ? "".concat(dir).concat(capitalize(breakpoint)) : "".concat(breakpoint).concat(capitalize(dir));
|
||||
})))
|
||||
};
|
||||
return composeClasses(slots, getHiddenCssUtilityClass, classes);
|
||||
};
|
||||
var HiddenCssRoot = styled('div', {
|
||||
name: 'PrivateHiddenCss',
|
||||
slot: 'Root'
|
||||
})(function (_ref2) {
|
||||
var theme = _ref2.theme,
|
||||
ownerState = _ref2.ownerState;
|
||||
var hidden = {
|
||||
display: 'none'
|
||||
};
|
||||
return _extends({}, ownerState.breakpoints.map(function (_ref3) {
|
||||
var breakpoint = _ref3.breakpoint,
|
||||
dir = _ref3.dir;
|
||||
if (dir === 'only') {
|
||||
return _defineProperty({}, theme.breakpoints.only(breakpoint), hidden);
|
||||
}
|
||||
return dir === 'up' ? _defineProperty({}, theme.breakpoints.up(breakpoint), hidden) : _defineProperty({}, theme.breakpoints.down(breakpoint), hidden);
|
||||
}).reduce(function (r, o) {
|
||||
Object.keys(o).forEach(function (k) {
|
||||
r[k] = o[k];
|
||||
});
|
||||
return r;
|
||||
}, {}));
|
||||
});
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
function HiddenCss(props) {
|
||||
var children = props.children,
|
||||
className = props.className,
|
||||
only = props.only,
|
||||
other = _objectWithoutProperties(props, ["children", "className", "only"]);
|
||||
var theme = useTheme();
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
var unknownProps = Object.keys(other).filter(function (propName) {
|
||||
var isUndeclaredBreakpoint = !theme.breakpoints.keys.some(function (breakpoint) {
|
||||
return "".concat(breakpoint, "Up") === propName || "".concat(breakpoint, "Down") === propName;
|
||||
});
|
||||
return !['classes', 'theme', 'isRtl', 'sx'].includes(propName) && isUndeclaredBreakpoint;
|
||||
});
|
||||
if (unknownProps.length > 0) {
|
||||
console.error("MUI: Unsupported props received by `<Hidden implementation=\"css\" />`: ".concat(unknownProps.join(', '), ". Did you forget to wrap this component in a ThemeProvider declaring these breakpoints?"));
|
||||
}
|
||||
}
|
||||
var breakpoints = [];
|
||||
for (var i = 0; i < theme.breakpoints.keys.length; i += 1) {
|
||||
var breakpoint = theme.breakpoints.keys[i];
|
||||
var breakpointUp = other["".concat(breakpoint, "Up")];
|
||||
var breakpointDown = other["".concat(breakpoint, "Down")];
|
||||
if (breakpointUp) {
|
||||
breakpoints.push({
|
||||
breakpoint: breakpoint,
|
||||
dir: 'up'
|
||||
});
|
||||
}
|
||||
if (breakpointDown) {
|
||||
breakpoints.push({
|
||||
breakpoint: breakpoint,
|
||||
dir: 'down'
|
||||
});
|
||||
}
|
||||
}
|
||||
if (only) {
|
||||
var onlyBreakpoints = Array.isArray(only) ? only : [only];
|
||||
onlyBreakpoints.forEach(function (breakpoint) {
|
||||
breakpoints.push({
|
||||
breakpoint: breakpoint,
|
||||
dir: 'only'
|
||||
});
|
||||
});
|
||||
}
|
||||
var ownerState = _extends({}, props, {
|
||||
breakpoints: breakpoints
|
||||
});
|
||||
var classes = useUtilityClasses(ownerState);
|
||||
return /*#__PURE__*/_jsx(HiddenCssRoot, {
|
||||
className: clsx(classes.root, className),
|
||||
ownerState: ownerState,
|
||||
children: children
|
||||
});
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? HiddenCss.propTypes = {
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* Specify which implementation to use. 'js' is the default, 'css' works better for
|
||||
* server-side rendering.
|
||||
*/
|
||||
implementation: PropTypes.oneOf(['js', 'css']),
|
||||
/**
|
||||
* If `true`, screens this size and down are hidden.
|
||||
*/
|
||||
lgDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and up are hidden.
|
||||
*/
|
||||
lgUp: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and down are hidden.
|
||||
*/
|
||||
mdDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and up are hidden.
|
||||
*/
|
||||
mdUp: PropTypes.bool,
|
||||
/**
|
||||
* Hide the given breakpoint(s).
|
||||
*/
|
||||
only: PropTypes.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']), PropTypes.arrayOf(PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']))]),
|
||||
/**
|
||||
* If `true`, screens this size and down are hidden.
|
||||
*/
|
||||
smDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and up are hidden.
|
||||
*/
|
||||
smUp: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and down are hidden.
|
||||
*/
|
||||
xlDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and up are hidden.
|
||||
*/
|
||||
xlUp: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and down are hidden.
|
||||
*/
|
||||
xsDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and up are hidden.
|
||||
*/
|
||||
xsUp: PropTypes.bool
|
||||
} : void 0;
|
||||
export default HiddenCss;
|
||||
123
backend/frontend/node_modules/@mui/material/legacy/Hidden/HiddenJs.js
generated
vendored
Normal file
123
backend/frontend/node_modules/@mui/material/legacy/Hidden/HiddenJs.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import exactProp from '@mui/utils/exactProp';
|
||||
import withWidth, { isWidthDown, isWidthUp } from './withWidth';
|
||||
import useTheme from '../styles/useTheme';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
function HiddenJs(props) {
|
||||
var children = props.children,
|
||||
only = props.only,
|
||||
width = props.width;
|
||||
var theme = useTheme();
|
||||
var visible = true;
|
||||
|
||||
// `only` check is faster to get out sooner if used.
|
||||
if (only) {
|
||||
if (Array.isArray(only)) {
|
||||
for (var i = 0; i < only.length; i += 1) {
|
||||
var breakpoint = only[i];
|
||||
if (width === breakpoint) {
|
||||
visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (only && width === only) {
|
||||
visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Allow `only` to be combined with other props. If already hidden, no need to check others.
|
||||
if (visible) {
|
||||
// determine visibility based on the smallest size up
|
||||
for (var _i = 0; _i < theme.breakpoints.keys.length; _i += 1) {
|
||||
var _breakpoint = theme.breakpoints.keys[_i];
|
||||
var breakpointUp = props["".concat(_breakpoint, "Up")];
|
||||
var breakpointDown = props["".concat(_breakpoint, "Down")];
|
||||
if (breakpointUp && isWidthUp(_breakpoint, width) || breakpointDown && isWidthDown(_breakpoint, width)) {
|
||||
visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!visible) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/_jsx(React.Fragment, {
|
||||
children: children
|
||||
});
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? HiddenJs.propTypes = {
|
||||
/**
|
||||
* The content of the component.
|
||||
*/
|
||||
children: PropTypes.node,
|
||||
/**
|
||||
* If `true`, screens this size and down are hidden.
|
||||
*/
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
lgDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and up are hidden.
|
||||
*/
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
lgUp: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and down are hidden.
|
||||
*/
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
mdDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and up are hidden.
|
||||
*/
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
mdUp: PropTypes.bool,
|
||||
/**
|
||||
* Hide the given breakpoint(s).
|
||||
*/
|
||||
only: PropTypes.oneOfType([PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']), PropTypes.arrayOf(PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']))]),
|
||||
/**
|
||||
* If `true`, screens this size and down are hidden.
|
||||
*/
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
smDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and up are hidden.
|
||||
*/
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
smUp: PropTypes.bool,
|
||||
/**
|
||||
* @ignore
|
||||
* width prop provided by withWidth decorator.
|
||||
*/
|
||||
width: PropTypes.string.isRequired,
|
||||
/**
|
||||
* If `true`, screens this size and down are hidden.
|
||||
*/
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
xlDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and up are hidden.
|
||||
*/
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
xlUp: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and down are hidden.
|
||||
*/
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
xsDown: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, screens this size and up are hidden.
|
||||
*/
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
xsUp: PropTypes.bool
|
||||
} : void 0;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
process.env.NODE_ENV !== "production" ? HiddenJs.propTypes = exactProp(HiddenJs.propTypes) : void 0;
|
||||
}
|
||||
export default withWidth()(HiddenJs);
|
||||
7
backend/frontend/node_modules/@mui/material/legacy/Hidden/hiddenCssClasses.js
generated
vendored
Normal file
7
backend/frontend/node_modules/@mui/material/legacy/Hidden/hiddenCssClasses.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
||||
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
||||
export function getHiddenCssUtilityClass(slot) {
|
||||
return generateUtilityClass('PrivateHiddenCss', slot);
|
||||
}
|
||||
var hiddenCssClasses = generateUtilityClasses('PrivateHiddenCss', ['root', 'xlDown', 'xlUp', 'onlyXl', 'lgDown', 'lgUp', 'onlyLg', 'mdDown', 'mdUp', 'onlyMd', 'smDown', 'smUp', 'onlySm', 'xsDown', 'xsUp', 'onlyXs']);
|
||||
export default hiddenCssClasses;
|
||||
3
backend/frontend/node_modules/@mui/material/legacy/Hidden/index.js
generated
vendored
Normal file
3
backend/frontend/node_modules/@mui/material/legacy/Hidden/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use client';
|
||||
|
||||
export { default } from './Hidden';
|
||||
110
backend/frontend/node_modules/@mui/material/legacy/Hidden/withWidth.js
generated
vendored
Normal file
110
backend/frontend/node_modules/@mui/material/legacy/Hidden/withWidth.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import getDisplayName from '@mui/utils/getDisplayName';
|
||||
import { getThemeProps } from '@mui/system/useThemeProps';
|
||||
import useTheme from '../styles/useTheme';
|
||||
import useEnhancedEffect from '../utils/useEnhancedEffect';
|
||||
import useMediaQuery from '../useMediaQuery';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
var breakpointKeys = ['xs', 'sm', 'md', 'lg', 'xl'];
|
||||
|
||||
// By default, returns true if screen width is the same or greater than the given breakpoint.
|
||||
export var isWidthUp = function isWidthUp(breakpoint, width) {
|
||||
var inclusive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
||||
if (inclusive) {
|
||||
return breakpointKeys.indexOf(breakpoint) <= breakpointKeys.indexOf(width);
|
||||
}
|
||||
return breakpointKeys.indexOf(breakpoint) < breakpointKeys.indexOf(width);
|
||||
};
|
||||
|
||||
// By default, returns true if screen width is less than the given breakpoint.
|
||||
export var isWidthDown = function isWidthDown(breakpoint, width) {
|
||||
var inclusive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
if (inclusive) {
|
||||
return breakpointKeys.indexOf(width) <= breakpointKeys.indexOf(breakpoint);
|
||||
}
|
||||
return breakpointKeys.indexOf(width) < breakpointKeys.indexOf(breakpoint);
|
||||
};
|
||||
var withWidth = function withWidth() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
return function (Component) {
|
||||
var _options$withTheme = options.withTheme,
|
||||
withThemeOption = _options$withTheme === void 0 ? false : _options$withTheme,
|
||||
_options$noSSR = options.noSSR,
|
||||
noSSR = _options$noSSR === void 0 ? false : _options$noSSR,
|
||||
initialWidthOption = options.initialWidth;
|
||||
function WithWidth(props) {
|
||||
var contextTheme = useTheme();
|
||||
var theme = props.theme || contextTheme;
|
||||
var _getThemeProps = getThemeProps({
|
||||
theme: theme,
|
||||
name: 'MuiWithWidth',
|
||||
props: props
|
||||
}),
|
||||
initialWidth = _getThemeProps.initialWidth,
|
||||
width = _getThemeProps.width,
|
||||
other = _objectWithoutProperties(_getThemeProps, ["initialWidth", "width"]);
|
||||
var _React$useState = React.useState(false),
|
||||
mountedState = _React$useState[0],
|
||||
setMountedState = _React$useState[1];
|
||||
useEnhancedEffect(function () {
|
||||
setMountedState(true);
|
||||
}, []);
|
||||
|
||||
/**
|
||||
* innerWidth |xs sm md lg xl
|
||||
* |-------|-------|-------|-------|------>
|
||||
* width | xs | sm | md | lg | xl
|
||||
*/
|
||||
var keys = theme.breakpoints.keys.slice().reverse();
|
||||
var widthComputed = keys.reduce(function (output, key) {
|
||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||
var matches = useMediaQuery(theme.breakpoints.up(key));
|
||||
return !output && matches ? key : output;
|
||||
}, null);
|
||||
var more = _extends({
|
||||
width: width || (mountedState || noSSR ? widthComputed : undefined) || initialWidth || initialWidthOption
|
||||
}, withThemeOption ? {
|
||||
theme: theme
|
||||
} : {}, other);
|
||||
|
||||
// When rendering the component on the server,
|
||||
// we have no idea about the client browser screen width.
|
||||
// In order to prevent blinks and help the reconciliation of the React tree
|
||||
// we are not rendering the child component.
|
||||
//
|
||||
// An alternative is to use the `initialWidth` property.
|
||||
if (more.width === undefined) {
|
||||
return null;
|
||||
}
|
||||
return /*#__PURE__*/_jsx(Component, _extends({}, more));
|
||||
}
|
||||
process.env.NODE_ENV !== "production" ? WithWidth.propTypes = {
|
||||
/**
|
||||
* As `window.innerWidth` is unavailable on the server,
|
||||
* we default to rendering an empty component during the first mount.
|
||||
* You might want to use a heuristic to approximate
|
||||
* the screen width of the client browser screen width.
|
||||
*
|
||||
* For instance, you could be using the user-agent or the client-hints.
|
||||
* https://caniuse.com/#search=client%20hint
|
||||
*/
|
||||
initialWidth: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl']),
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
theme: PropTypes.object,
|
||||
/**
|
||||
* Bypass the width calculation logic.
|
||||
*/
|
||||
width: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl'])
|
||||
} : void 0;
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
WithWidth.displayName = "WithWidth(".concat(getDisplayName(Component), ")");
|
||||
}
|
||||
return WithWidth;
|
||||
};
|
||||
};
|
||||
export default withWidth;
|
||||
Reference in New Issue
Block a user