UNPKG

@elastic/eui

Version:

Elastic UI Component Library

87 lines (86 loc) 4.36 kB
var _excluded = ["className", "children", "headingElement", "step", "title", "titleSize", "status"]; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ import classNames from 'classnames'; import PropTypes from "prop-types"; import React, { createElement } from 'react'; import { EuiTitle } from '../title'; import { EuiStepNumber } from './step_number'; import { useEuiTheme } from '../../services'; import { euiStepStyles, euiStepContentStyles, euiStepTitleStyles } from './step.styles'; import { jsx as ___EmotionJSX } from "@emotion/react"; export var EuiStep = function EuiStep(_ref) { var className = _ref.className, children = _ref.children, _ref$headingElement = _ref.headingElement, headingElement = _ref$headingElement === void 0 ? 'p' : _ref$headingElement, _ref$step = _ref.step, step = _ref$step === void 0 ? 1 : _ref$step, title = _ref.title, _ref$titleSize = _ref.titleSize, titleSize = _ref$titleSize === void 0 ? 's' : _ref$titleSize, status = _ref.status, rest = _objectWithoutProperties(_ref, _excluded); var classes = classNames('euiStep', className); var euiTheme = useEuiTheme(); var styles = euiStepStyles(euiTheme); var cssStyles = [styles.euiStep, styles[titleSize]]; var contentStyles = euiStepContentStyles(euiTheme); var cssContentStyles = [contentStyles.euiStep__content, contentStyles[titleSize]]; var titleStyles = euiStepTitleStyles(euiTheme); var cssStepTitleStyles = [titleStyles.euiStep__title, status === 'disabled' && titleStyles.isDisabled, titleStyles[titleSize]]; var cssTitleWrapperStyles = titleStyles.euiStep__titleWrapper; return ___EmotionJSX("div", _extends({ className: classes, css: cssStyles }, rest), ___EmotionJSX("div", { className: "euiStep__titleWrapper", css: cssTitleWrapperStyles }, ___EmotionJSX(EuiStepNumber, { number: step, status: status, titleSize: titleSize }), ___EmotionJSX(EuiTitle, { size: titleSize, className: "euiStep__title", css: cssStepTitleStyles }, /*#__PURE__*/createElement(headingElement, null, title))), ___EmotionJSX("div", { className: "euiStep__content", css: cssContentStyles }, children)); }; EuiStep.propTypes = { className: PropTypes.string, "aria-label": PropTypes.string, "data-test-subj": PropTypes.string, css: PropTypes.any, /** * ReactNode to render as this component's content */ children: PropTypes.node.isRequired, /** * The HTML tag used for the title */ headingElement: PropTypes.string, /** * The number of the step in the list of steps */ step: PropTypes.number, title: PropTypes.string.isRequired, /** * May replace the number provided in props.step with alternate styling. */ status: PropTypes.any, /** * Title sizing equivalent to EuiTitle, but only `m`, `s` and `xs`. Defaults to `s` */ titleSize: PropTypes.any };