140 lines
4.9 KiB
JavaScript
140 lines
4.9 KiB
JavaScript
|
|
"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 _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 = /*#__PURE__*/React.forwardRef(function StepContent(props, ref) {
|
||
|
|
var active = props.active,
|
||
|
|
alternativeLabel = props.alternativeLabel,
|
||
|
|
children = props.children,
|
||
|
|
classes = props.classes,
|
||
|
|
className = props.className,
|
||
|
|
completed = props.completed,
|
||
|
|
expanded = props.expanded,
|
||
|
|
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", "expanded", "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 /*#__PURE__*/React.createElement("div", (0, _extends2.default)({
|
||
|
|
className: (0, _clsx.default)(classes.root, className, last && classes.last),
|
||
|
|
ref: ref
|
||
|
|
}, other), /*#__PURE__*/React.createElement(TransitionComponent, (0, _extends2.default)({
|
||
|
|
in: active || expanded,
|
||
|
|
className: classes.transition,
|
||
|
|
timeout: transitionDuration,
|
||
|
|
unmountOnExit: true
|
||
|
|
}, TransitionProps), children));
|
||
|
|
});
|
||
|
|
process.env.NODE_ENV !== "production" ? StepContent.propTypes = {
|
||
|
|
// ----------------------------- Warning --------------------------------
|
||
|
|
// | These PropTypes are generated from the TypeScript type definitions |
|
||
|
|
// | To update them edit the d.ts file and run "yarn proptypes" |
|
||
|
|
// ----------------------------------------------------------------------
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 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,
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @ignore
|
||
|
|
*/
|
||
|
|
className: _propTypes.default.string,
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The component used for the transition.
|
||
|
|
* [Follow this guide](/components/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
||
|
|
*/
|
||
|
|
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.oneOf(['auto']), _propTypes.default.number, _propTypes.default.shape({
|
||
|
|
appear: _propTypes.default.number,
|
||
|
|
enter: _propTypes.default.number,
|
||
|
|
exit: _propTypes.default.number
|
||
|
|
})]),
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Props applied to the [`Transition`](http://reactcommunity.org/react-transition-group/transition#Transition-props) element.
|
||
|
|
*/
|
||
|
|
TransitionProps: _propTypes.default.object
|
||
|
|
} : void 0;
|
||
|
|
|
||
|
|
var _default = (0, _withStyles.default)(styles, {
|
||
|
|
name: 'MuiStepContent'
|
||
|
|
})(StepContent);
|
||
|
|
|
||
|
|
exports.default = _default;
|