UNPKG

acud

Version:

acg react 组件库

63 lines • 2.49 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; import * as React from 'react'; // import omit from 'rc-util/lib/omit'; import RcSteps from './src/steps'; import classNames from 'classnames'; import { ConfigContext } from '../config-provider'; // Progress组件依赖 目前已满足UE要求,不需要使用进度条 // import Progress from '../progress'; import OutlinedCloseSmall from "acud-icon/es/icons/OutlinedCloseSmall"; import OutlinedCheckSmall from "acud-icon/es/icons/OutlinedCheckSmall"; import useBreakpoint from '../grid/hooks/useBreakpoint'; var Steps = function Steps(props) { var className = props.className, direction = props.direction, responsive = props.responsive; var _useBreakpoint = useBreakpoint(), xs = _useBreakpoint.xs; var _React$useContext = React.useContext(ConfigContext), getPrefixCls = _React$useContext.getPrefixCls, rtlDirection = _React$useContext.direction; var getDirection = React.useCallback(function () { return responsive && xs ? 'vertical' : direction; }, [responsive, xs, direction]); var prefixCls = getPrefixCls('steps', props.prefixCls); var iconPrefix = getPrefixCls('', props.iconPrefix); var stepsClassName = classNames(_defineProperty({}, "".concat(prefixCls, "-rtl"), rtlDirection === 'rtl'), className); var icons = { finish: /*#__PURE__*/React.createElement(OutlinedCheckSmall, { className: "".concat(prefixCls, "-finish-icon") }), error: /*#__PURE__*/React.createElement(OutlinedCloseSmall, { className: "".concat(prefixCls, "-error-icon") }) }; var stepIconRender = function stepIconRender(_ref) { var node = _ref.node, status = _ref.status; if (status === 'process') { // currently it's hard-coded, since we can't easily read the actually width of icon // const progressWidth = size === 'small' ? 32 : 40; var iconWithProgress = /*#__PURE__*/React.createElement("div", { className: "".concat(prefixCls, "-progress-icon") }, node); return iconWithProgress; } return node; }; return /*#__PURE__*/React.createElement(RcSteps, _extends({ icons: icons }, props, { direction: getDirection(), stepIcon: stepIconRender, prefixCls: prefixCls, iconPrefix: iconPrefix, className: stepsClassName })); }; Steps.Step = RcSteps.Step; Steps.defaultProps = { current: 0 }; export default Steps;