UNPKG

@material-ui/core

Version:

React components that implement Google's Material Design.

165 lines (133 loc) 4.86 kB
"use strict"; 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 = _interopRequireDefault(require("react")); var _propTypes = _interopRequireDefault(require("prop-types")); var _clsx = _interopRequireDefault(require("clsx")); var _Collapse = _interopRequireDefault(require("../Collapse")); var _withStyles = _interopRequireDefault(require("../styles/withStyles")); var styles = function styles(theme) { return { /* Styles applied to the root element. */ root: { marginTop: 8, marginLeft: 12, // half icon paddingLeft: 8 + 12, // margin + half icon paddingRight: 8, borderLeft: "1px solid ".concat(theme.palette.type === 'light' ? theme.palette.grey[400] : theme.palette.grey[600]) }, /* Styles applied to the root element if `last={true}` (controlled by `Step`). */ last: { borderLeft: 'none' }, /* Styles applied to the Transition component. */ transition: {} }; }; exports.styles = styles; var StepContent = _react.default.forwardRef(function StepContent(props, ref) { var active = props.active, alternativeLabel = props.alternativeLabel, children = props.children, classes = props.classes, className = props.className, completed = props.completed, last = props.last, optional = props.optional, orientation = props.orientation, _props$TransitionComp = props.TransitionComponent, TransitionComponent = _props$TransitionComp === void 0 ? _Collapse.default : _props$TransitionComp, _props$transitionDura = props.transitionDuration, transitionDurationProp = _props$transitionDura === void 0 ? 'auto' : _props$transitionDura, TransitionProps = props.TransitionProps, other = (0, _objectWithoutProperties2.default)(props, ["active", "alternativeLabel", "children", "classes", "className", "completed", "last", "optional", "orientation", "TransitionComponent", "transitionDuration", "TransitionProps"]); if (process.env.NODE_ENV !== 'production') { if (orientation !== 'vertical') { console.error('Material-UI: <StepContent /> is only designed for use with the vertical stepper.'); } } var transitionDuration = transitionDurationProp; if (transitionDurationProp === 'auto' && !TransitionComponent.muiSupportAuto) { transitionDuration = undefined; } return _react.default.createElement("div", (0, _extends2.default)({ className: (0, _clsx.default)(classes.root, className, last && classes.last), ref: ref }, other), _react.default.createElement(TransitionComponent, (0, _extends2.default)({ in: active, className: classes.transition, timeout: transitionDuration, unmountOnExit: true }, TransitionProps), children)); }); process.env.NODE_ENV !== "production" ? StepContent.propTypes = { /** * @ignore * Expands the content. */ active: _propTypes.default.bool, /** * @ignore * Set internally by Step when it's supplied with the alternativeLabel prop. */ alternativeLabel: _propTypes.default.bool, /** * Step content. */ children: _propTypes.default.node, /** * Override or extend the styles applied to the component. * See [CSS API](#css) below for more details. */ classes: _propTypes.default.object.isRequired, /** * @ignore */ className: _propTypes.default.string, /** * @ignore */ completed: _propTypes.default.bool, /** * @ignore */ last: _propTypes.default.bool, /** * @ignore * Set internally by Step when it's supplied with the optional prop. */ optional: _propTypes.default.bool, /** * @ignore */ orientation: _propTypes.default.oneOf(['horizontal', 'vertical']), /** * The component used for the transition. */ TransitionComponent: _propTypes.default.elementType, /** * Adjust the duration of the content expand transition. * Passed as a prop to the transition component. * * Set to 'auto' to automatically calculate transition time based on height. */ transitionDuration: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({ enter: _propTypes.default.number, exit: _propTypes.default.number }), _propTypes.default.oneOf(['auto'])]), /** * Props applied to the `Transition` element. */ TransitionProps: _propTypes.default.object } : void 0; var _default = (0, _withStyles.default)(styles, { name: 'MuiStepContent' })(StepContent); exports.default = _default;