mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 21:52:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
83
web/node_modules/@material-ui/core/Modal/Modal.d.ts
generated
vendored
Normal file
83
web/node_modules/@material-ui/core/Modal/Modal.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
import * as React from 'react';
|
||||
import { StandardProps, ModalManager } from '..';
|
||||
import { BackdropProps } from '../Backdrop';
|
||||
import { PortalProps } from '../Portal';
|
||||
|
||||
export interface ModalProps
|
||||
extends StandardProps<React.HTMLAttributes<HTMLDivElement>, never, 'children'> {
|
||||
BackdropComponent?: React.ElementType<BackdropProps>;
|
||||
BackdropProps?: Partial<BackdropProps>;
|
||||
children: React.ReactElement;
|
||||
closeAfterTransition?: boolean;
|
||||
container?: PortalProps['container'];
|
||||
disableAutoFocus?: boolean;
|
||||
/**
|
||||
* If `true`, clicking the backdrop will not fire the `onClose` callback.
|
||||
* @deprecated Use the onClose prop with the `reason` argument to filter the `backdropClick` events.
|
||||
*/
|
||||
disableBackdropClick?: boolean;
|
||||
disableEnforceFocus?: boolean;
|
||||
disableEscapeKeyDown?: boolean;
|
||||
disablePortal?: PortalProps['disablePortal'];
|
||||
disableRestoreFocus?: boolean;
|
||||
disableScrollLock?: boolean;
|
||||
hideBackdrop?: boolean;
|
||||
keepMounted?: boolean;
|
||||
manager?: ModalManager;
|
||||
/**
|
||||
* Callback fired when the backdrop is clicked.
|
||||
* @deprecated Use the onClose prop with the `reason` argument to handle the `backdropClick` events.
|
||||
*/
|
||||
onBackdropClick?: React.ReactEventHandler<{}>;
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
* @param {string} reason Can be: `"escapeKeyDown"`, `"backdropClick"`.
|
||||
*/
|
||||
onClose?: {
|
||||
bivarianceHack(event: {}, reason: 'backdropClick' | 'escapeKeyDown'): void;
|
||||
}['bivarianceHack'];
|
||||
/**
|
||||
* Callback fired when the escape key is pressed,
|
||||
* `disableKeyboard` is false and the modal is in focus.
|
||||
* @deprecated Use the onClose prop with the `reason` argument to handle the `escapeKeyDown` events.
|
||||
*/
|
||||
onEscapeKeyDown?: React.ReactEventHandler<{}>;
|
||||
/**
|
||||
* Callback fired once the children has been mounted into the `container`.
|
||||
* It signals that the `open={true}` prop took effect.
|
||||
*
|
||||
* This prop will be removed in v5, the ref can be used instead.
|
||||
* @deprecated Use the ref instead.
|
||||
*/
|
||||
onRendered?: PortalProps['onRendered'];
|
||||
/**
|
||||
* If `true`, the modal is open.
|
||||
*/
|
||||
open: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modal is a lower-level construct that is leveraged by the following components:
|
||||
*
|
||||
* - [Dialog](https://material-ui.com/api/dialog/)
|
||||
* - [Drawer](https://material-ui.com/api/drawer/)
|
||||
* - [Menu](https://material-ui.com/api/menu/)
|
||||
* - [Popover](https://material-ui.com/api/popover/)
|
||||
*
|
||||
* If you are creating a modal dialog, you probably want to use the [Dialog](https://material-ui.com/api/dialog/) component
|
||||
* rather than directly using Modal.
|
||||
*
|
||||
* This component shares many concepts with [react-overlays](https://react-bootstrap.github.io/react-overlays/#modals).
|
||||
* Demos:
|
||||
*
|
||||
* - [Modal](https://material-ui.com/components/modal/)
|
||||
*
|
||||
* API:
|
||||
*
|
||||
* - [Modal API](https://material-ui.com/api/modal/)
|
||||
*/
|
||||
declare const Modal: React.ComponentType<ModalProps>;
|
||||
|
||||
export default Modal;
|
426
web/node_modules/@material-ui/core/Modal/Modal.js
generated
vendored
Normal file
426
web/node_modules/@material-ui/core/Modal/Modal.js
generated
vendored
Normal file
|
@ -0,0 +1,426 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.styles = void 0;
|
||||
|
||||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
||||
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var ReactDOM = _interopRequireWildcard(require("react-dom"));
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
var _styles = require("@material-ui/styles");
|
||||
|
||||
var _utils = require("@material-ui/utils");
|
||||
|
||||
var _deprecatedPropType = _interopRequireDefault(require("../utils/deprecatedPropType"));
|
||||
|
||||
var _ownerDocument = _interopRequireDefault(require("../utils/ownerDocument"));
|
||||
|
||||
var _Portal = _interopRequireDefault(require("../Portal"));
|
||||
|
||||
var _createChainedFunction = _interopRequireDefault(require("../utils/createChainedFunction"));
|
||||
|
||||
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
||||
|
||||
var _useEventCallback = _interopRequireDefault(require("../utils/useEventCallback"));
|
||||
|
||||
var _zIndex = _interopRequireDefault(require("../styles/zIndex"));
|
||||
|
||||
var _ModalManager = _interopRequireWildcard(require("./ModalManager"));
|
||||
|
||||
var _Unstable_TrapFocus = _interopRequireDefault(require("../Unstable_TrapFocus"));
|
||||
|
||||
var _SimpleBackdrop = _interopRequireDefault(require("./SimpleBackdrop"));
|
||||
|
||||
function getContainer(container) {
|
||||
container = typeof container === 'function' ? container() : container;
|
||||
return ReactDOM.findDOMNode(container);
|
||||
}
|
||||
|
||||
function getHasTransition(props) {
|
||||
return props.children ? props.children.props.hasOwnProperty('in') : false;
|
||||
} // A modal manager used to track and manage the state of open Modals.
|
||||
// Modals don't open on the server so this won't conflict with concurrent requests.
|
||||
|
||||
|
||||
var defaultManager = new _ModalManager.default();
|
||||
|
||||
var styles = function styles(theme) {
|
||||
return {
|
||||
/* Styles applied to the root element. */
|
||||
root: {
|
||||
position: 'fixed',
|
||||
zIndex: theme.zIndex.modal,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
left: 0
|
||||
},
|
||||
|
||||
/* Styles applied to the root element if the `Modal` has exited. */
|
||||
hidden: {
|
||||
visibility: 'hidden'
|
||||
}
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Modal is a lower-level construct that is leveraged by the following components:
|
||||
*
|
||||
* - [Dialog](/api/dialog/)
|
||||
* - [Drawer](/api/drawer/)
|
||||
* - [Menu](/api/menu/)
|
||||
* - [Popover](/api/popover/)
|
||||
*
|
||||
* If you are creating a modal dialog, you probably want to use the [Dialog](/api/dialog/) component
|
||||
* rather than directly using Modal.
|
||||
*
|
||||
* This component shares many concepts with [react-overlays](https://react-bootstrap.github.io/react-overlays/#modals).
|
||||
*/
|
||||
|
||||
|
||||
exports.styles = styles;
|
||||
var Modal = /*#__PURE__*/React.forwardRef(function Modal(inProps, ref) {
|
||||
var theme = (0, _styles.useTheme)();
|
||||
var props = (0, _styles.getThemeProps)({
|
||||
name: 'MuiModal',
|
||||
props: (0, _extends2.default)({}, inProps),
|
||||
theme: theme
|
||||
});
|
||||
var _props$BackdropCompon = props.BackdropComponent,
|
||||
BackdropComponent = _props$BackdropCompon === void 0 ? _SimpleBackdrop.default : _props$BackdropCompon,
|
||||
BackdropProps = props.BackdropProps,
|
||||
children = props.children,
|
||||
_props$closeAfterTran = props.closeAfterTransition,
|
||||
closeAfterTransition = _props$closeAfterTran === void 0 ? false : _props$closeAfterTran,
|
||||
container = props.container,
|
||||
_props$disableAutoFoc = props.disableAutoFocus,
|
||||
disableAutoFocus = _props$disableAutoFoc === void 0 ? false : _props$disableAutoFoc,
|
||||
_props$disableBackdro = props.disableBackdropClick,
|
||||
disableBackdropClick = _props$disableBackdro === void 0 ? false : _props$disableBackdro,
|
||||
_props$disableEnforce = props.disableEnforceFocus,
|
||||
disableEnforceFocus = _props$disableEnforce === void 0 ? false : _props$disableEnforce,
|
||||
_props$disableEscapeK = props.disableEscapeKeyDown,
|
||||
disableEscapeKeyDown = _props$disableEscapeK === void 0 ? false : _props$disableEscapeK,
|
||||
_props$disablePortal = props.disablePortal,
|
||||
disablePortal = _props$disablePortal === void 0 ? false : _props$disablePortal,
|
||||
_props$disableRestore = props.disableRestoreFocus,
|
||||
disableRestoreFocus = _props$disableRestore === void 0 ? false : _props$disableRestore,
|
||||
_props$disableScrollL = props.disableScrollLock,
|
||||
disableScrollLock = _props$disableScrollL === void 0 ? false : _props$disableScrollL,
|
||||
_props$hideBackdrop = props.hideBackdrop,
|
||||
hideBackdrop = _props$hideBackdrop === void 0 ? false : _props$hideBackdrop,
|
||||
_props$keepMounted = props.keepMounted,
|
||||
keepMounted = _props$keepMounted === void 0 ? false : _props$keepMounted,
|
||||
_props$manager = props.manager,
|
||||
manager = _props$manager === void 0 ? defaultManager : _props$manager,
|
||||
onBackdropClick = props.onBackdropClick,
|
||||
onClose = props.onClose,
|
||||
onEscapeKeyDown = props.onEscapeKeyDown,
|
||||
onRendered = props.onRendered,
|
||||
open = props.open,
|
||||
other = (0, _objectWithoutProperties2.default)(props, ["BackdropComponent", "BackdropProps", "children", "closeAfterTransition", "container", "disableAutoFocus", "disableBackdropClick", "disableEnforceFocus", "disableEscapeKeyDown", "disablePortal", "disableRestoreFocus", "disableScrollLock", "hideBackdrop", "keepMounted", "manager", "onBackdropClick", "onClose", "onEscapeKeyDown", "onRendered", "open"]);
|
||||
|
||||
var _React$useState = React.useState(true),
|
||||
exited = _React$useState[0],
|
||||
setExited = _React$useState[1];
|
||||
|
||||
var modal = React.useRef({});
|
||||
var mountNodeRef = React.useRef(null);
|
||||
var modalRef = React.useRef(null);
|
||||
var handleRef = (0, _useForkRef.default)(modalRef, ref);
|
||||
var hasTransition = getHasTransition(props);
|
||||
|
||||
var getDoc = function getDoc() {
|
||||
return (0, _ownerDocument.default)(mountNodeRef.current);
|
||||
};
|
||||
|
||||
var getModal = function getModal() {
|
||||
modal.current.modalRef = modalRef.current;
|
||||
modal.current.mountNode = mountNodeRef.current;
|
||||
return modal.current;
|
||||
};
|
||||
|
||||
var handleMounted = function handleMounted() {
|
||||
manager.mount(getModal(), {
|
||||
disableScrollLock: disableScrollLock
|
||||
}); // Fix a bug on Chrome where the scroll isn't initially 0.
|
||||
|
||||
modalRef.current.scrollTop = 0;
|
||||
};
|
||||
|
||||
var handleOpen = (0, _useEventCallback.default)(function () {
|
||||
var resolvedContainer = getContainer(container) || getDoc().body;
|
||||
manager.add(getModal(), resolvedContainer); // The element was already mounted.
|
||||
|
||||
if (modalRef.current) {
|
||||
handleMounted();
|
||||
}
|
||||
});
|
||||
var isTopModal = React.useCallback(function () {
|
||||
return manager.isTopModal(getModal());
|
||||
}, [manager]);
|
||||
var handlePortalRef = (0, _useEventCallback.default)(function (node) {
|
||||
mountNodeRef.current = node;
|
||||
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (onRendered) {
|
||||
onRendered();
|
||||
}
|
||||
|
||||
if (open && isTopModal()) {
|
||||
handleMounted();
|
||||
} else {
|
||||
(0, _ModalManager.ariaHidden)(modalRef.current, true);
|
||||
}
|
||||
});
|
||||
var handleClose = React.useCallback(function () {
|
||||
manager.remove(getModal());
|
||||
}, [manager]);
|
||||
React.useEffect(function () {
|
||||
return function () {
|
||||
handleClose();
|
||||
};
|
||||
}, [handleClose]);
|
||||
React.useEffect(function () {
|
||||
if (open) {
|
||||
handleOpen();
|
||||
} else if (!hasTransition || !closeAfterTransition) {
|
||||
handleClose();
|
||||
}
|
||||
}, [open, handleClose, hasTransition, closeAfterTransition, handleOpen]);
|
||||
|
||||
if (!keepMounted && !open && (!hasTransition || exited)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var handleEnter = function handleEnter() {
|
||||
setExited(false);
|
||||
};
|
||||
|
||||
var handleExited = function handleExited() {
|
||||
setExited(true);
|
||||
|
||||
if (closeAfterTransition) {
|
||||
handleClose();
|
||||
}
|
||||
};
|
||||
|
||||
var handleBackdropClick = function handleBackdropClick(event) {
|
||||
if (event.target !== event.currentTarget) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (onBackdropClick) {
|
||||
onBackdropClick(event);
|
||||
}
|
||||
|
||||
if (!disableBackdropClick && onClose) {
|
||||
onClose(event, 'backdropClick');
|
||||
}
|
||||
};
|
||||
|
||||
var handleKeyDown = function handleKeyDown(event) {
|
||||
// The handler doesn't take event.defaultPrevented into account:
|
||||
//
|
||||
// event.preventDefault() is meant to stop default behaviours like
|
||||
// clicking a checkbox to check it, hitting a button to submit a form,
|
||||
// and hitting left arrow to move the cursor in a text input etc.
|
||||
// Only special HTML elements have these default behaviors.
|
||||
if (event.key !== 'Escape' || !isTopModal()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (onEscapeKeyDown) {
|
||||
onEscapeKeyDown(event);
|
||||
}
|
||||
|
||||
if (!disableEscapeKeyDown) {
|
||||
// Swallow the event, in case someone is listening for the escape key on the body.
|
||||
event.stopPropagation();
|
||||
|
||||
if (onClose) {
|
||||
onClose(event, 'escapeKeyDown');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var inlineStyle = styles(theme || {
|
||||
zIndex: _zIndex.default
|
||||
});
|
||||
var childProps = {};
|
||||
|
||||
if (children.props.tabIndex === undefined) {
|
||||
childProps.tabIndex = children.props.tabIndex || '-1';
|
||||
} // It's a Transition like component
|
||||
|
||||
|
||||
if (hasTransition) {
|
||||
childProps.onEnter = (0, _createChainedFunction.default)(handleEnter, children.props.onEnter);
|
||||
childProps.onExited = (0, _createChainedFunction.default)(handleExited, children.props.onExited);
|
||||
}
|
||||
|
||||
return /*#__PURE__*/React.createElement(_Portal.default, {
|
||||
ref: handlePortalRef,
|
||||
container: container,
|
||||
disablePortal: disablePortal
|
||||
}, /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
|
||||
ref: handleRef,
|
||||
onKeyDown: handleKeyDown,
|
||||
role: "presentation"
|
||||
}, other, {
|
||||
style: (0, _extends2.default)({}, inlineStyle.root, !open && exited ? inlineStyle.hidden : {}, other.style)
|
||||
}), hideBackdrop ? null : /*#__PURE__*/React.createElement(BackdropComponent, (0, _extends2.default)({
|
||||
open: open,
|
||||
onClick: handleBackdropClick
|
||||
}, BackdropProps)), /*#__PURE__*/React.createElement(_Unstable_TrapFocus.default, {
|
||||
disableEnforceFocus: disableEnforceFocus,
|
||||
disableAutoFocus: disableAutoFocus,
|
||||
disableRestoreFocus: disableRestoreFocus,
|
||||
getDoc: getDoc,
|
||||
isEnabled: isTopModal,
|
||||
open: open
|
||||
}, /*#__PURE__*/React.cloneElement(children, childProps))));
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? Modal.propTypes = {
|
||||
/**
|
||||
* A backdrop component. This prop enables custom backdrop rendering.
|
||||
*/
|
||||
BackdropComponent: _propTypes.default.elementType,
|
||||
|
||||
/**
|
||||
* Props applied to the [`Backdrop`](/api/backdrop/) element.
|
||||
*/
|
||||
BackdropProps: _propTypes.default.object,
|
||||
|
||||
/**
|
||||
* A single child content element.
|
||||
*/
|
||||
children: _utils.elementAcceptingRef.isRequired,
|
||||
|
||||
/**
|
||||
* When set to true the Modal waits until a nested Transition is completed before closing.
|
||||
*/
|
||||
closeAfterTransition: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* A HTML element, component instance, or function that returns either.
|
||||
* The `container` will have the portal children appended to it.
|
||||
*
|
||||
* By default, it uses the body of the top-level document object,
|
||||
* so it's simply `document.body` most of the time.
|
||||
*/
|
||||
container: _propTypes.default
|
||||
/* @typescript-to-proptypes-ignore */
|
||||
.oneOfType([_utils.HTMLElementType, _propTypes.default.instanceOf(React.Component), _propTypes.default.func]),
|
||||
|
||||
/**
|
||||
* If `true`, the modal will not automatically shift focus to itself when it opens, and
|
||||
* replace it to the last focused element when it closes.
|
||||
* This also works correctly with any modal children that have the `disableAutoFocus` prop.
|
||||
*
|
||||
* Generally this should never be set to `true` as it makes the modal less
|
||||
* accessible to assistive technologies, like screen readers.
|
||||
*/
|
||||
disableAutoFocus: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* If `true`, clicking the backdrop will not fire `onClose`.
|
||||
*/
|
||||
disableBackdropClick: (0, _deprecatedPropType.default)(_propTypes.default.bool, 'Use the onClose prop with the `reason` argument to filter the `backdropClick` events.'),
|
||||
|
||||
/**
|
||||
* If `true`, the modal will not prevent focus from leaving the modal while open.
|
||||
*
|
||||
* Generally this should never be set to `true` as it makes the modal less
|
||||
* accessible to assistive technologies, like screen readers.
|
||||
*/
|
||||
disableEnforceFocus: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* If `true`, hitting escape will not fire `onClose`.
|
||||
*/
|
||||
disableEscapeKeyDown: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* Disable the portal behavior.
|
||||
* The children stay within it's parent DOM hierarchy.
|
||||
*/
|
||||
disablePortal: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* If `true`, the modal will not restore focus to previously focused element once
|
||||
* modal is hidden.
|
||||
*/
|
||||
disableRestoreFocus: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* Disable the scroll lock behavior.
|
||||
*/
|
||||
disableScrollLock: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* If `true`, the backdrop is not rendered.
|
||||
*/
|
||||
hideBackdrop: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* Always keep the children in the DOM.
|
||||
* This prop can be useful in SEO situation or
|
||||
* when you want to maximize the responsiveness of the Modal.
|
||||
*/
|
||||
keepMounted: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
manager: _propTypes.default.object,
|
||||
|
||||
/**
|
||||
* Callback fired when the backdrop is clicked.
|
||||
*/
|
||||
onBackdropClick: (0, _deprecatedPropType.default)(_propTypes.default.func, 'Use the onClose prop with the `reason` argument to handle the `backdropClick` events.'),
|
||||
|
||||
/**
|
||||
* Callback fired when the component requests to be closed.
|
||||
* The `reason` parameter can optionally be used to control the response to `onClose`.
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
* @param {string} reason Can be: `"escapeKeyDown"`, `"backdropClick"`.
|
||||
*/
|
||||
onClose: _propTypes.default.func,
|
||||
|
||||
/**
|
||||
* Callback fired when the escape key is pressed,
|
||||
* `disableEscapeKeyDown` is false and the modal is in focus.
|
||||
*/
|
||||
onEscapeKeyDown: (0, _deprecatedPropType.default)(_propTypes.default.func, 'Use the onClose prop with the `reason` argument to handle the `escapeKeyDown` events.'),
|
||||
|
||||
/**
|
||||
* Callback fired once the children has been mounted into the `container`.
|
||||
* It signals that the `open={true}` prop took effect.
|
||||
*
|
||||
* This prop will be removed in v5, the ref can be used instead.
|
||||
*/
|
||||
onRendered: (0, _deprecatedPropType.default)(_propTypes.default.func, 'Use the ref instead.'),
|
||||
|
||||
/**
|
||||
* If `true`, the modal is open.
|
||||
*/
|
||||
open: _propTypes.default.bool.isRequired
|
||||
} : void 0;
|
||||
var _default = Modal;
|
||||
exports.default = _default;
|
8
web/node_modules/@material-ui/core/Modal/ModalManager.d.ts
generated
vendored
Normal file
8
web/node_modules/@material-ui/core/Modal/ModalManager.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
declare class ModalManager {
|
||||
constructor(opts?: { hideSiblingNodes?: boolean; handleContainerOverflow?: boolean });
|
||||
add(modal: any, container: any): number;
|
||||
remove(modal: any): void;
|
||||
isTopModal(modal: any): boolean;
|
||||
}
|
||||
|
||||
export default ModalManager;
|
266
web/node_modules/@material-ui/core/Modal/ModalManager.js
generated
vendored
Normal file
266
web/node_modules/@material-ui/core/Modal/ModalManager.js
generated
vendored
Normal file
|
@ -0,0 +1,266 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ariaHidden = ariaHidden;
|
||||
exports.default = void 0;
|
||||
|
||||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
||||
|
||||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
||||
|
||||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
||||
|
||||
var _getScrollbarSize = _interopRequireDefault(require("../utils/getScrollbarSize"));
|
||||
|
||||
var _ownerDocument = _interopRequireDefault(require("../utils/ownerDocument"));
|
||||
|
||||
var _ownerWindow = _interopRequireDefault(require("../utils/ownerWindow"));
|
||||
|
||||
// Is a vertical scrollbar displayed?
|
||||
function isOverflowing(container) {
|
||||
var doc = (0, _ownerDocument.default)(container);
|
||||
|
||||
if (doc.body === container) {
|
||||
return (0, _ownerWindow.default)(doc).innerWidth > doc.documentElement.clientWidth;
|
||||
}
|
||||
|
||||
return container.scrollHeight > container.clientHeight;
|
||||
}
|
||||
|
||||
function ariaHidden(node, show) {
|
||||
if (show) {
|
||||
node.setAttribute('aria-hidden', 'true');
|
||||
} else {
|
||||
node.removeAttribute('aria-hidden');
|
||||
}
|
||||
}
|
||||
|
||||
function getPaddingRight(node) {
|
||||
return parseInt(window.getComputedStyle(node)['padding-right'], 10) || 0;
|
||||
}
|
||||
|
||||
function ariaHiddenSiblings(container, mountNode, currentNode) {
|
||||
var nodesToExclude = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
||||
var show = arguments.length > 4 ? arguments[4] : undefined;
|
||||
var blacklist = [mountNode, currentNode].concat((0, _toConsumableArray2.default)(nodesToExclude));
|
||||
var blacklistTagNames = ['TEMPLATE', 'SCRIPT', 'STYLE'];
|
||||
[].forEach.call(container.children, function (node) {
|
||||
if (node.nodeType === 1 && blacklist.indexOf(node) === -1 && blacklistTagNames.indexOf(node.tagName) === -1) {
|
||||
ariaHidden(node, show);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function findIndexOf(containerInfo, callback) {
|
||||
var idx = -1;
|
||||
containerInfo.some(function (item, index) {
|
||||
if (callback(item)) {
|
||||
idx = index;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
return idx;
|
||||
}
|
||||
|
||||
function handleContainer(containerInfo, props) {
|
||||
var restoreStyle = [];
|
||||
var restorePaddings = [];
|
||||
var container = containerInfo.container;
|
||||
var fixedNodes;
|
||||
|
||||
if (!props.disableScrollLock) {
|
||||
if (isOverflowing(container)) {
|
||||
// Compute the size before applying overflow hidden to avoid any scroll jumps.
|
||||
var scrollbarSize = (0, _getScrollbarSize.default)();
|
||||
restoreStyle.push({
|
||||
value: container.style.paddingRight,
|
||||
key: 'padding-right',
|
||||
el: container
|
||||
}); // Use computed style, here to get the real padding to add our scrollbar width.
|
||||
|
||||
container.style['padding-right'] = "".concat(getPaddingRight(container) + scrollbarSize, "px"); // .mui-fixed is a global helper.
|
||||
|
||||
fixedNodes = (0, _ownerDocument.default)(container).querySelectorAll('.mui-fixed');
|
||||
[].forEach.call(fixedNodes, function (node) {
|
||||
restorePaddings.push(node.style.paddingRight);
|
||||
node.style.paddingRight = "".concat(getPaddingRight(node) + scrollbarSize, "px");
|
||||
});
|
||||
} // Improve Gatsby support
|
||||
// https://css-tricks.com/snippets/css/force-vertical-scrollbar/
|
||||
|
||||
|
||||
var parent = container.parentElement;
|
||||
var scrollContainer = parent.nodeName === 'HTML' && window.getComputedStyle(parent)['overflow-y'] === 'scroll' ? parent : container; // Block the scroll even if no scrollbar is visible to account for mobile keyboard
|
||||
// screensize shrink.
|
||||
|
||||
restoreStyle.push({
|
||||
value: scrollContainer.style.overflow,
|
||||
key: 'overflow',
|
||||
el: scrollContainer
|
||||
});
|
||||
scrollContainer.style.overflow = 'hidden';
|
||||
}
|
||||
|
||||
var restore = function restore() {
|
||||
if (fixedNodes) {
|
||||
[].forEach.call(fixedNodes, function (node, i) {
|
||||
if (restorePaddings[i]) {
|
||||
node.style.paddingRight = restorePaddings[i];
|
||||
} else {
|
||||
node.style.removeProperty('padding-right');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
restoreStyle.forEach(function (_ref) {
|
||||
var value = _ref.value,
|
||||
el = _ref.el,
|
||||
key = _ref.key;
|
||||
|
||||
if (value) {
|
||||
el.style.setProperty(key, value);
|
||||
} else {
|
||||
el.style.removeProperty(key);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return restore;
|
||||
}
|
||||
|
||||
function getHiddenSiblings(container) {
|
||||
var hiddenSiblings = [];
|
||||
[].forEach.call(container.children, function (node) {
|
||||
if (node.getAttribute && node.getAttribute('aria-hidden') === 'true') {
|
||||
hiddenSiblings.push(node);
|
||||
}
|
||||
});
|
||||
return hiddenSiblings;
|
||||
}
|
||||
/**
|
||||
* @ignore - do not document.
|
||||
*
|
||||
* Proper state management for containers and the modals in those containers.
|
||||
* Simplified, but inspired by react-overlay's ModalManager class.
|
||||
* Used by the Modal to ensure proper styling of containers.
|
||||
*/
|
||||
|
||||
|
||||
var ModalManager = /*#__PURE__*/function () {
|
||||
function ModalManager() {
|
||||
(0, _classCallCheck2.default)(this, ModalManager);
|
||||
// this.modals[modalIndex] = modal
|
||||
this.modals = []; // this.containers[containerIndex] = {
|
||||
// modals: [],
|
||||
// container,
|
||||
// restore: null,
|
||||
// }
|
||||
|
||||
this.containers = [];
|
||||
}
|
||||
|
||||
(0, _createClass2.default)(ModalManager, [{
|
||||
key: "add",
|
||||
value: function add(modal, container) {
|
||||
var modalIndex = this.modals.indexOf(modal);
|
||||
|
||||
if (modalIndex !== -1) {
|
||||
return modalIndex;
|
||||
}
|
||||
|
||||
modalIndex = this.modals.length;
|
||||
this.modals.push(modal); // If the modal we are adding is already in the DOM.
|
||||
|
||||
if (modal.modalRef) {
|
||||
ariaHidden(modal.modalRef, false);
|
||||
}
|
||||
|
||||
var hiddenSiblingNodes = getHiddenSiblings(container);
|
||||
ariaHiddenSiblings(container, modal.mountNode, modal.modalRef, hiddenSiblingNodes, true);
|
||||
var containerIndex = findIndexOf(this.containers, function (item) {
|
||||
return item.container === container;
|
||||
});
|
||||
|
||||
if (containerIndex !== -1) {
|
||||
this.containers[containerIndex].modals.push(modal);
|
||||
return modalIndex;
|
||||
}
|
||||
|
||||
this.containers.push({
|
||||
modals: [modal],
|
||||
container: container,
|
||||
restore: null,
|
||||
hiddenSiblingNodes: hiddenSiblingNodes
|
||||
});
|
||||
return modalIndex;
|
||||
}
|
||||
}, {
|
||||
key: "mount",
|
||||
value: function mount(modal, props) {
|
||||
var containerIndex = findIndexOf(this.containers, function (item) {
|
||||
return item.modals.indexOf(modal) !== -1;
|
||||
});
|
||||
var containerInfo = this.containers[containerIndex];
|
||||
|
||||
if (!containerInfo.restore) {
|
||||
containerInfo.restore = handleContainer(containerInfo, props);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "remove",
|
||||
value: function remove(modal) {
|
||||
var modalIndex = this.modals.indexOf(modal);
|
||||
|
||||
if (modalIndex === -1) {
|
||||
return modalIndex;
|
||||
}
|
||||
|
||||
var containerIndex = findIndexOf(this.containers, function (item) {
|
||||
return item.modals.indexOf(modal) !== -1;
|
||||
});
|
||||
var containerInfo = this.containers[containerIndex];
|
||||
containerInfo.modals.splice(containerInfo.modals.indexOf(modal), 1);
|
||||
this.modals.splice(modalIndex, 1); // If that was the last modal in a container, clean up the container.
|
||||
|
||||
if (containerInfo.modals.length === 0) {
|
||||
// The modal might be closed before it had the chance to be mounted in the DOM.
|
||||
if (containerInfo.restore) {
|
||||
containerInfo.restore();
|
||||
}
|
||||
|
||||
if (modal.modalRef) {
|
||||
// In case the modal wasn't in the DOM yet.
|
||||
ariaHidden(modal.modalRef, true);
|
||||
}
|
||||
|
||||
ariaHiddenSiblings(containerInfo.container, modal.mountNode, modal.modalRef, containerInfo.hiddenSiblingNodes, false);
|
||||
this.containers.splice(containerIndex, 1);
|
||||
} else {
|
||||
// Otherwise make sure the next top modal is visible to a screen reader.
|
||||
var nextTop = containerInfo.modals[containerInfo.modals.length - 1]; // as soon as a modal is adding its modalRef is undefined. it can't set
|
||||
// aria-hidden because the dom element doesn't exist either
|
||||
// when modal was unmounted before modalRef gets null
|
||||
|
||||
if (nextTop.modalRef) {
|
||||
ariaHidden(nextTop.modalRef, false);
|
||||
}
|
||||
}
|
||||
|
||||
return modalIndex;
|
||||
}
|
||||
}, {
|
||||
key: "isTopModal",
|
||||
value: function isTopModal(modal) {
|
||||
return this.modals.length > 0 && this.modals[this.modals.length - 1] === modal;
|
||||
}
|
||||
}]);
|
||||
return ModalManager;
|
||||
}();
|
||||
|
||||
exports.default = ModalManager;
|
68
web/node_modules/@material-ui/core/Modal/SimpleBackdrop.js
generated
vendored
Normal file
68
web/node_modules/@material-ui/core/Modal/SimpleBackdrop.js
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.styles = void 0;
|
||||
|
||||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
||||
|
||||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
||||
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
|
||||
var styles = {
|
||||
/* Styles applied to the root element. */
|
||||
root: {
|
||||
zIndex: -1,
|
||||
position: 'fixed',
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
left: 0,
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
||||
WebkitTapHighlightColor: 'transparent'
|
||||
},
|
||||
|
||||
/* Styles applied to the root element if `invisible={true}`. */
|
||||
invisible: {
|
||||
backgroundColor: 'transparent'
|
||||
}
|
||||
};
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
|
||||
exports.styles = styles;
|
||||
var SimpleBackdrop = /*#__PURE__*/React.forwardRef(function SimpleBackdrop(props, ref) {
|
||||
var _props$invisible = props.invisible,
|
||||
invisible = _props$invisible === void 0 ? false : _props$invisible,
|
||||
open = props.open,
|
||||
other = (0, _objectWithoutProperties2.default)(props, ["invisible", "open"]);
|
||||
return open ? /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
|
||||
"aria-hidden": true,
|
||||
ref: ref
|
||||
}, other, {
|
||||
style: (0, _extends2.default)({}, styles.root, invisible ? styles.invisible : {}, other.style)
|
||||
})) : null;
|
||||
});
|
||||
process.env.NODE_ENV !== "production" ? SimpleBackdrop.propTypes = {
|
||||
/**
|
||||
* If `true`, the backdrop is invisible.
|
||||
* It can be used when rendering a popover or a custom select component.
|
||||
*/
|
||||
invisible: _propTypes.default.bool,
|
||||
|
||||
/**
|
||||
* If `true`, the backdrop is open.
|
||||
*/
|
||||
open: _propTypes.default.bool.isRequired
|
||||
} : void 0;
|
||||
var _default = SimpleBackdrop;
|
||||
exports.default = _default;
|
4
web/node_modules/@material-ui/core/Modal/index.d.ts
generated
vendored
Normal file
4
web/node_modules/@material-ui/core/Modal/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
export { default } from './Modal';
|
||||
export * from './Modal';
|
||||
export { default as ModalManager } from './ModalManager';
|
||||
export * from './ModalManager';
|
23
web/node_modules/@material-ui/core/Modal/index.js
generated
vendored
Normal file
23
web/node_modules/@material-ui/core/Modal/index.js
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _Modal.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ModalManager", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _ModalManager.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _Modal = _interopRequireDefault(require("./Modal"));
|
||||
|
||||
var _ModalManager = _interopRequireDefault(require("./ModalManager"));
|
5
web/node_modules/@material-ui/core/Modal/package.json
generated
vendored
Normal file
5
web/node_modules/@material-ui/core/Modal/package.json
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"sideEffects": false,
|
||||
"module": "../esm/Modal/index.js",
|
||||
"typings": "./index.d.ts"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue