@smart-react-components/ui
Version:
SRC UI includes React and Styled components.
33 lines (32 loc) • 2.73 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const element_props_1 = __importDefault(require("@smart-react-components/core/element-props"));
const intrinsic_styled_size_props_1 = __importDefault(require("@smart-react-components/core/element-props/intrinsic-styled-size-props"));
const CSSTransition_1 = __importDefault(require("@smart-react-components/transition/CSSTransition"));
const react_1 = __importDefault(require("react"));
const styled_components_1 = require("styled-components");
const ModalElement_1 = __importDefault(require("../components/Modal/ModalElement"));
const OverlayElement_1 = __importDefault(require("../components/Modal/OverlayElement"));
const Overlay_1 = __importDefault(require("../Overlay"));
const Modal = (props) => {
var _a, _b, _c;
const theme = react_1.default.useContext(styled_components_1.ThemeContext);
return (react_1.default.createElement(CSSTransition_1.default, { afterHide: props.afterHide, afterShow: props.afterShow, beforeHide: props.beforeHide, beforeShow: props.beforeShow, className: (_a = props.transitionClassName) !== null && _a !== void 0 ? _a : 'src-modal', duration: (_b = props.transitionDuration) !== null && _b !== void 0 ? _b : theme.$.transition.modalDuration, hasHideAnimation: props.hasHideAnimation, hasShowAnimation: props.hasShowAnimation, status: props.status },
react_1.default.createElement(Overlay_1.default, Object.assign({ hasBackground: props.hasOverlayBackground, hasBlurEffect: props.hasOverlayBlurEffect, template: react_1.default.createElement(OverlayElement_1.default, { duration: (_c = props.transitionDuration) !== null && _c !== void 0 ? _c : theme.$.transition.modalDuration, isFullScreen: props.isFullScreen }) }, (props.isDismissible && { onClick: () => props.setStatus(false) })),
react_1.default.createElement(ModalElement_1.default, Object.assign({}, (0, element_props_1.default)(props, [intrinsic_styled_size_props_1.default]), props.elementProps, { isBlock: props.isBlock, isCentered: props.isCentered, isStretched: props.isStretched, isFullScreen: props.isFullScreen, hasBorder: props.hasBorder, modalSize: props.size, modalSizeSm: props.sizeSm, modalSizeMd: props.sizeMd, modalSizeLg: props.sizeLg, modalSizeXl: props.sizeXl, shape: props.shape }), props.children))));
};
Modal.defaultProps = {
elementProps: {},
hasBorder: true,
hasHideAnimation: true,
hasShowAnimation: true,
hasOverlayBackground: true,
isDismissible: true,
size: 'medium',
shape: 'rectangle',
status: true,
};
exports.default = Modal;