wix-style-react
Version:
82 lines (61 loc) • 3.44 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
import React from 'react';
import PropTypes from 'prop-types';
import SidebarItemNext from '../SidebarItemNext/SidebarItemNext';
import ChevronRight from 'wix-ui-icons-common/ChevronRight';
import { dataHooks } from './constants';
/** A sub menu item in the sidebar */
var SidebarSubMenuNext = /*#__PURE__*/function (_React$PureComponent) {
_inherits(SidebarSubMenuNext, _React$PureComponent);
var _super = _createSuper(SidebarSubMenuNext);
function SidebarSubMenuNext() {
var _this;
_classCallCheck(this, SidebarSubMenuNext);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "_getChevron", function () {
return /*#__PURE__*/React.createElement(ChevronRight, {
"data-hook": dataHooks.chevronRight
});
});
return _this;
}
_createClass(SidebarSubMenuNext, [{
key: "render",
value: function render() {
var children = this.props.children;
return /*#__PURE__*/React.createElement(SidebarItemNext, _extends({
"data-expanded": false,
suffix: this._getChevron()
}, this.props), children);
}
}]);
return SidebarSubMenuNext;
}(React.PureComponent);
_defineProperty(SidebarSubMenuNext, "displayName", 'SidebarSubMenuNext');
_defineProperty(SidebarSubMenuNext, "propTypes", {
/** Applied as data-hook HTML attribute that can be used in the tests */
dataHook: PropTypes.string,
/** A css class to be applied to the component's root element */
className: PropTypes.string,
/** Indicates whether to display the item as disabled */
disabled: PropTypes.bool,
/** render as some other component or DOM tag */
as: PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.string]),
/** A callback to be triggered on click */
onClick: PropTypes.func,
/** unique identifier per item, used to mark it for navigation and selection */
itemKey: PropTypes.string
});
export { SidebarSubMenuNext as default };