rsuite
Version:
A suite of react components
52 lines • 2.25 kB
JavaScript
'use client';
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
var _excluded = ["as", "className", "width", "height", "style", "active", "classPrefix"];
import React from 'react';
import PropTypes from 'prop-types';
import { useClassNames } from "../internals/hooks/index.js";
import { useCustom } from "../CustomProvider/index.js";
/**
* The `Placeholder.Graph` component is used to display the loading state of the block.
* @see https://rsuitejs.com/components/placeholder
*/
var PlaceholderGraph = /*#__PURE__*/React.forwardRef(function (props, ref) {
var _useCustom = useCustom('PlaceholderGraph', props),
propsWithDefaults = _useCustom.propsWithDefaults;
var _propsWithDefaults$as = propsWithDefaults.as,
Component = _propsWithDefaults$as === void 0 ? 'div' : _propsWithDefaults$as,
className = propsWithDefaults.className,
width = propsWithDefaults.width,
_propsWithDefaults$he = propsWithDefaults.height,
height = _propsWithDefaults$he === void 0 ? 200 : _propsWithDefaults$he,
style = propsWithDefaults.style,
active = propsWithDefaults.active,
_propsWithDefaults$cl = propsWithDefaults.classPrefix,
classPrefix = _propsWithDefaults$cl === void 0 ? 'placeholder' : _propsWithDefaults$cl,
rest = _objectWithoutPropertiesLoose(propsWithDefaults, _excluded);
var _useClassNames = useClassNames(classPrefix),
merge = _useClassNames.merge,
withClassPrefix = _useClassNames.withClassPrefix;
var classes = merge(className, withClassPrefix('graph', {
active: active
}));
var styles = _extends({
width: width || '100%',
height: height
}, style);
return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
ref: ref,
className: classes,
style: styles
}));
});
PlaceholderGraph.displayName = 'PlaceholderGraph';
PlaceholderGraph.propTypes = {
className: PropTypes.string,
style: PropTypes.object,
classPrefix: PropTypes.string,
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
active: PropTypes.bool
};
export default PlaceholderGraph;