chayns-components
Version:
A set of beautiful React components for developing chayns® applications.
74 lines (71 loc) • 3.22 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _clsx = _interopRequireDefault(require("clsx"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = _interopRequireWildcard(require("react"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
/**
* @component
*/
/**
* A small circular loading indicator.
*/
class SmallWaitCursor extends _react.PureComponent {
render() {
const {
show,
style,
showBackground,
inline,
className
} = this.props;
if (showBackground) {
return /*#__PURE__*/_react.default.createElement("div", {
className: (0, _clsx.default)('wait-cursor', className, !show && "hidden"),
style: style
}, /*#__PURE__*/_react.default.createElement("div", {
className: "wait-cursor__spinner"
}));
}
return /*#__PURE__*/_react.default.createElement("div", {
className: (0, _clsx.default)('wait-cursor__spinner', className, inline && 'wait-cursor__spinner--inline', !show && "hidden")
});
}
}
exports.default = SmallWaitCursor;
SmallWaitCursor.propTypes = {
/**
* Wether the wait cursor should be shown.
*/
show: _propTypes.default.bool,
/**
* A React style object that will be applied to the wrapper.
*/
style: _propTypes.default.objectOf(_propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])),
/**
* Wether a background should be shown behind the spinner.
*/
showBackground: _propTypes.default.bool,
/**
* Wether the spinner should be rendered with `display: inline-block;`. This
* does not work when `showBackground` is `true`
*/
inline: _propTypes.default.bool,
/**
* A classname sring that will be applied to the container element of the
* spinner.
*/
className: _propTypes.default.string
};
SmallWaitCursor.defaultProps = {
show: false,
style: null,
showBackground: true,
inline: false,
className: null
};
SmallWaitCursor.displayName = 'SmallWaitCursor';
//# sourceMappingURL=SmallWaitCursor.js.map