@helpscout/hsds-react
Version:
React component library for Help Scout's Design System
76 lines (56 loc) • 2.53 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = exports.DropdownBlock = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = require("prop-types");
var _getValidProps = _interopRequireDefault(require("@helpscout/react-utils/dist/getValidProps"));
var _Dropdown = require("./Dropdown.css");
var _classnames = _interopRequireDefault(require("classnames"));
var _jsxRuntime = require("react/jsx-runtime");
// Deprecated
/* istanbul ignore file */
function noop() {}
var DropdownBlock = /*#__PURE__*/function (_React$PureComponent) {
(0, _inheritsLoose2.default)(DropdownBlock, _React$PureComponent);
function DropdownBlock() {
return _React$PureComponent.apply(this, arguments) || this;
}
var _proto = DropdownBlock.prototype;
_proto.render = function render() {
var _this$props = this.props,
children = _this$props.children,
className = _this$props.className,
innerRef = _this$props.innerRef,
isSeamless = _this$props.isSeamless,
isStretchy = _this$props.isStretchy,
rest = (0, _objectWithoutPropertiesLoose2.default)(_this$props, ["children", "className", "innerRef", "isSeamless", "isStretchy"]);
var componentClassName = (0, _classnames.default)('c-DropdownBlock', isSeamless && 'is-seamless', isStretchy && 'is-stretchy', className);
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Dropdown.BlockUI, (0, _extends2.default)({}, (0, _getValidProps.default)(rest), {
className: componentClassName,
ref: innerRef,
children: children
}));
};
return DropdownBlock;
}(_react.default.PureComponent);
exports.DropdownBlock = DropdownBlock;
DropdownBlock.defaultProps = {
'data-cy': 'DropdownBlock',
innerRef: noop,
isSeamless: false,
isStretchy: false
};
DropdownBlock.propTypes = {
className: _propTypes.PropTypes.string,
/** Data attr for Cypress tests. */
'data-cy': _propTypes.PropTypes.string,
innerRef: _propTypes.PropTypes.func,
isSeamless: _propTypes.PropTypes.bool,
isStretchy: _propTypes.PropTypes.bool
};
var _default = DropdownBlock;
exports.default = _default;