UNPKG

@carbon/ibm-security

Version:

Carbon for Cloud & Cognitive IBM Security UI components

52 lines (51 loc) 1.94 kB
import _extends from "@babel/runtime/helpers/extends"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; var _excluded = ["active", "children", "className", "small", "withOverlay"]; /** * @file Loading message. * @copyright IBM Security 2019 - 2021 */ import classnames from 'classnames'; import { bool, node, string } from 'prop-types'; import React from 'react'; import Loading from '..'; import { carbonPrefix, getComponentNamespace } from '../../../globals/namespace'; var namespace = getComponentNamespace('loading-message'); var overlayNamespace = "".concat(carbonPrefix, "--loading-overlay"); var LoadingMessage = function LoadingMessage(_ref) { var active = _ref.active, children = _ref.children, className = _ref.className, small = _ref.small, withOverlay = _ref.withOverlay, other = _objectWithoutProperties(_ref, _excluded); return /*#__PURE__*/React.createElement("div", { className: classnames(namespace, className, _defineProperty(_defineProperty({}, overlayNamespace, withOverlay), "".concat(overlayNamespace, "--stop"), withOverlay && !active)) }, /*#__PURE__*/React.createElement(Loading, _extends({ className: "".concat(namespace, "__loading"), active: active, small: small, withOverlay: false }, other)), children); }; LoadingMessage.defaultProps = { children: null, active: true, withOverlay: true, small: false, className: null }; LoadingMessage.propTypes = { /** Specify whether the `Loading` is active */ active: bool, /** Provide the contents of the `LoadingMessage` */ children: node, /** Provide an optional class to be applied to the containing node */ className: string, /** Specify whether to use the small variation */ small: bool, /** Specify whether to use an overlay */ withOverlay: bool }; export default LoadingMessage;