UNPKG

@zohodesk/components

Version:

Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development

787 lines (696 loc) • 33.2 kB
"use strict"; function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _react = _interopRequireDefault(require("react")); var _EmptySearch = _interopRequireDefault(require("@zohodesk/svg/lib/emptystate/version3/EmptySearch")); var _Tab = _interopRequireDefault(require("./Tab")); var _defaultProps = require("./props/defaultProps"); var _propTypes = require("./props/propTypes"); var _Common = require("../utils/Common"); var _Layout = require("../Layout"); var _ResizeObserver = _interopRequireDefault(require("../Responsive/ResizeObserver")); var _ListItem = _interopRequireDefault(require("../ListItem/ListItem")); var _icons = require("@zohodesk/icons"); var _TabsModule = _interopRequireDefault(require("./Tabs.module.css")); var _Popup = _interopRequireDefault(require("../Popup/Popup")); var _TextBoxIcon = _interopRequireDefault(require("../TextBoxIcon/TextBoxIcon")); var _ResponsiveDropBox = _interopRequireDefault(require("../ResponsiveDropBox/ResponsiveDropBox")); var _CustomResponsive = require("../Responsive/CustomResponsive"); var _tabConfigs = require("./utils/tabConfigs"); var _semanticButtonModule = _interopRequireDefault(require("../semantic/Button/semanticButton.module.css")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } 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 _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } 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; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var Tabs = /*#__PURE__*/function (_React$Component) { _inherits(Tabs, _React$Component); var _super = _createSuper(Tabs); function Tabs(props) { var _this; _classCallCheck(this, Tabs); _this = _super.call(this, props); _this.state = { totalDimension: null, tabDimensions: {}, highlightInitialDimension: null, renderVirtualTabs: true, tabKeys: [], searchValue: '' }; _Common.bind.apply(_assertThisInitialized(_this), ['moreTabSelect', 'onResize', 'onTabResize', 'getHighlightRef', 'getTabsRef', 'getTabRef', 'getHighlightDim', 'onSizeChange', 'onScroll', 'togglePopup', 'setMaxDim', 'handleChange', 'handleSearchValueClear', 'getMoreList', 'renderEmptyState']); _this.tabsObserver = new _ResizeObserver["default"](_this.onResize); _this.tabObserver = {}; return _this; } _createClass(Tabs, [{ key: "onTabResize", value: function onTabResize(size, target) { var align = this.props.align; var tabDimensions = this.state.tabDimensions; var newDim = Object.assign({}, tabDimensions); var elemDim = (0, _Common.getTotalDimension)(target, align); if (elemDim !== 0) { newDim[target.dataset.key] = elemDim; } this.setState({ tabDimensions: newDim }); } }, { key: "componentDidMount", value: function componentDidMount() { var _this2 = this; var _this$props = this.props, children = _this$props.children, childType = _this$props.childType; var totalDimension = this.getTotalDimension(); var tabDimensions = this.getTabDimensions(); var tabKeys = []; var restrictedKeys = ['state', 'props', 'refs', 'context']; _react["default"].Children.toArray(children).forEach(function (child) { if (child && child.props.id && child.type === childType) { if (restrictedKeys.includes(child.props.id)) { throw new Error('Restricted id name found in Tabs, Please avoid these names => ' + restrictedKeys.toString()); } else { tabKeys.push(child.props.id); } } }); this.setState({ totalDimension: totalDimension, tabDimensions: tabDimensions, renderVirtualTabs: false, tabKeys: tabKeys }); this.highlight && this.setState({ highlightInitialDimension: this.getHighlightDim() }, function () { _this2.moveHighlight(); }); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { var _this3 = this; if (this.tabsObserver) { this.tabsObserver.disconnect(); this.tabsObserver = null; } if (this.tabObserver) { Object.keys(this.tabObserver).forEach(function (observer) { _this3.tabObserver[observer] && _this3.tabObserver[observer].disconnect(); }); this.tabObserver = null; } } }, { key: "setMaxDim", value: function setMaxDim() { var totalDimension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var selectedTab = this.props.selectedTab; // let actual = Object.keys(tabDimensions).reduce( // (sum, tab) => sum + (tabDimensions[tab] || 0), // 0 // ); if (totalDimension && this[selectedTab]) { var align = this.props.align; var newDim = "".concat((0, _Common.remConvert)(totalDimension), "rem"); _tabConfigs.TAB_DIRECTION_MAPPING[align] === 'column' ? this[selectedTab].style.maxWidth = newDim : this[selectedTab].style.maxHeight = newDim; } } }, { key: "getHighlightDim", value: function getHighlightDim() { var align = this.props.align; return _tabConfigs.TAB_DIRECTION_MAPPING[align] === 'column' ? this.highlight.offsetLeft : this.highlight.offsetTop; } }, { key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { var _this4 = this; var _this$props2 = this.props, children = _this$props2.children, selectedTab = _this$props2.selectedTab, childType = _this$props2.childType, isPopupOpen = _this$props2.isPopupOpen; var _this$state = this.state, tabDimensions = _this$state.tabDimensions, totalDimension = _this$state.totalDimension, tabKeys = _this$state.tabKeys, searchValue = _this$state.searchValue; if (prevProps.children && children) { /** * To recalculate the dimensions of tabs we are checking the children length. * and also checking the tab id and their order. */ var newTabKeys = []; _react["default"].Children.toArray(children).forEach(function (child) { if (child && child.props.id && child.type === childType) { newTabKeys.push(child.props.id); } }); var isSameTabKeys = newTabKeys.every(function (current, index) { return tabKeys[index] === current; }); if (newTabKeys.length !== tabKeys.length || !isSameTabKeys) { this.setState({ renderVirtualTabs: true, tabKeys: newTabKeys }, function () { totalDimension = _this4.getTotalDimension(); tabDimensions = _this4.getTabDimensions(); _this4.setState({ tabDimensions: tabDimensions, totalDimension: totalDimension, renderVirtualTabs: false }); }); } if (prevProps.selectedTab !== selectedTab || newTabKeys.length === 1) { this.moveHighlight(); } if (prevProps.isPopupOpen != isPopupOpen && searchValue.length) { this.handleSearchValueClear(); } } } }, { key: "moveHighlight", value: function moveHighlight() { var _this$props3 = this.props, isAnimate = _this$props3.isAnimate, needTabBorder = _this$props3.needTabBorder, selectedTab = _this$props3.selectedTab, align = _this$props3.align; var highlightInitialDimension = this.state.highlightInitialDimension; var node = this.highlight; if (isAnimate && needTabBorder && node) { var tabActive = this[selectedTab]; if (tabActive) { var position, dimension; if (_tabConfigs.TAB_DIRECTION_MAPPING[align] === 'column') { position = tabActive.offsetLeft; dimension = tabActive.offsetWidth; node.style.transform = "translateX(".concat((0, _Common.remConvert)(position - highlightInitialDimension), "rem)"); node.style.width = "".concat((0, _Common.remConvert)(dimension), "rem"); } else if (_tabConfigs.TAB_DIRECTION_MAPPING[align] === 'row') { position = tabActive.offsetTop; dimension = tabActive.offsetHeight; node.style.transform = "translateY(".concat((0, _Common.remConvert)(position - highlightInitialDimension), "rem)"); node.style.height = "".concat((0, _Common.remConvert)(dimension), "rem"); } } } } }, { key: "getHighlightRef", value: function getHighlightRef(ele) { this.highlight = ele; } }, { key: "getTabsRef", value: function getTabsRef(ele) { this.tabsEle = ele; if (ele) { this.tabsObserver.observe(ele); } else { this.tabsObserver && this.tabsObserver.disconnect(); } } }, { key: "onSizeChange", value: function onSizeChange() { var _this5 = this; var totalDimension = this.getTotalDimension(); this.setState({ totalDimension: totalDimension }); this.highlight && this.setState({ highlightInitialDimension: this.getHighlightDim() }, function () { _this5.moveHighlight(); }); } }, { key: "onResize", value: function onResize(timer) { var _this6 = this; var isResponsive = this.props.isResponsive; if (this.tabsEle && isResponsive) { if (!timer) { this.onSizeChange(); } else { setTimeout(function () { _this6.onSizeChange(); }, timer); } } } }, { key: "getTotalDimension", value: function getTotalDimension() { var align = this.props.align; var totalDimension = this.tabsEle && (0, _Common.getTotalDimension)(this.tabsEle, align); return totalDimension; } }, { key: "getTabDimensions", value: function getTabDimensions() { var _this7 = this; var _this$props4 = this.props, children = _this$props4.children, align = _this$props4.align, childType = _this$props4.childType; var tabDimensions = {}; _react["default"].Children.forEach(children, function (child) { return /*#__PURE__*/_react["default"].isValidElement(child) && child.type === childType && _this7[child.props.id] && Object.assign(tabDimensions, _defineProperty({}, child.props.id, _this7[child.props.id] && (0, _Common.getTotalDimension)(_this7[child.props.id], align))); }); return tabDimensions; } }, { key: "responsiveTab", value: function responsiveTab(totalDimension, tabDimensions) { var _this$props5 = this.props, children = _this$props5.children, maxTabsCount = _this$props5.maxTabsCount, minTabsCount = _this$props5.minTabsCount, isResponsive = _this$props5.isResponsive; var mainTabs = [], moreTabs = [], otherTabs = []; if (totalDimension && isResponsive) { var _this$props6 = this.props, childType = _this$props6.childType, selectedTab = _this$props6.selectedTab; var selectedTabDimension = tabDimensions[selectedTab] || 0; var remainingDimension = totalDimension - selectedTabDimension; var maxTabsTobeVisible = maxTabsCount - 1; var minTabsToBeVisible = 1; _react["default"].Children.forEach(children, function (child) { if (child && child.type === childType && child.props.id) { var elemDimension = tabDimensions[child.props.id]; var isMaxCountExceeded = maxTabsTobeVisible <= 0 ? true : false; var isMinCountNotExceeded = minTabsToBeVisible < minTabsCount ? true : false; if (child.props.id === selectedTab) { mainTabs.push(child); } else if (isMinCountNotExceeded) { mainTabs.push(child); remainingDimension -= tabDimensions[child.props.id]; minTabsToBeVisible++; maxTabsTobeVisible--; } else if (remainingDimension - elemDimension >= 20 && !moreTabs.length && !isMaxCountExceeded) { mainTabs.push(child); remainingDimension -= tabDimensions[child.props.id]; maxTabsTobeVisible--; } else { moreTabs.push(child); } } else if ( /*#__PURE__*/_react["default"].isValidElement(child)) { otherTabs.push(child); } }); if (selectedTabDimension > totalDimension) { /* let { align } = this.props; let newDim = `${remConvert(totalDimension)}rem`; let newTabs; if (align === 'vertical') { newTabs = mainTabs.map(tab => React.cloneElement(tab, { style: { maxWidth: newDim } })); } else { newTabs = mainTabs.map(tab => React.cloneElement(tab, { style: { maxHeight: newDim } })); } mainTabs = newTabs; */ this.setMaxDim(totalDimension); } } else if (!isResponsive) { var _childType = this.props.childType; _react["default"].Children.forEach(children, function (child) { if (child && child.type === _childType && child.props.id) { mainTabs.push(child); } else { otherTabs.push(child); } }); } else { moreTabs = children; } return { mainTabs: mainTabs, moreTabs: moreTabs, otherTabs: otherTabs }; } }, { key: "getTabRef", value: function getTabRef(refName, ele, isVirtual) { this[refName] = ele; var key = isVirtual ? "virtual_".concat(refName) : refName; if (ele) { this.tabObserver[key] = new _ResizeObserver["default"](this.onTabResize); this.tabObserver[key].observe(ele); } else { if (this.tabObserver && this.tabObserver[key]) { this.tabObserver[key].disconnect(); } } } }, { key: "moreTabSelect", value: function moreTabSelect(tab, value, index, e) { var _this$props7 = this.props, onSelect = _this$props7.onSelect, closePopupOnly = _this$props7.closePopupOnly; if (e && e.target && e.target.parentElement.tagName === 'A' && (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)) { (0, _Common.cancelBubblingEffect)(e); return; } e.preventDefault(); onSelect(tab); closePopupOnly(); } }, { key: "onScroll", value: function onScroll(e) { e.persist(); var onScroll = this.props.onScroll; onScroll && (0, _Common.throttle)(onScroll, 100, e); } }, { key: "togglePopup", value: function togglePopup(e) { var _this$props8 = this.props, boxPosition = _this$props8.boxPosition, togglePopup = _this$props8.togglePopup, align = _this$props8.align, removeClose = _this$props8.removeClose; removeClose && removeClose(e); boxPosition = boxPosition ? boxPosition : _tabConfigs.TAB_POPUP_POSITION_MAPPING[align]; togglePopup(e, boxPosition); } }, { key: "responsiveFunc", value: function responsiveFunc(_ref) { var mediaQueryOR = _ref.mediaQueryOR; return { tabletMode: mediaQueryOR([{ maxWidth: 700 }]) }; } }, { key: "handleChange", value: function handleChange(value, e) { this.setState({ searchValue: value }); } }, { key: "handleSearchValueClear", value: function handleSearchValueClear(e) { this.setState({ searchValue: '' }); } }, { key: "getMoreList", value: function getMoreList(_ref2) { var moreTabs = _ref2.moreTabs; var validElements = []; _react["default"].Children.map(moreTabs, function (child) { var isValidElement = /*#__PURE__*/_react["default"].isValidElement(child); if (isValidElement) { validElements.push(child.props); } }); return validElements; } }, { key: "handleFilterSuggestions", value: function handleFilterSuggestions(_ref3) { var moreTabs = _ref3.moreTabs; var showTitleInMoreOptions = this.props.showTitleInMoreOptions; var searchValue = this.state.searchValue; var options = this.getMoreList({ moreTabs: moreTabs }); var filteredOptions = options.filter(function (list) { var text = list.text, title = list.title; var value = text ? text : showTitleInMoreOptions ? title : ''; return value.toLowerCase().includes(searchValue.toLowerCase()); }); return filteredOptions; } }, { key: "renderEmptyState", value: function renderEmptyState() { var searchErrorText = this.props.searchErrorText; return /*#__PURE__*/_react["default"].createElement("div", { className: _TabsModule["default"].emptyStateContainer }, /*#__PURE__*/_react["default"].createElement(_EmptySearch["default"], { size: "small" }), /*#__PURE__*/_react["default"].createElement("div", { className: _TabsModule["default"].emptyStateTitle }, searchErrorText)); } }, { key: "renderTabs", value: function renderTabs(mainTabs, moreTabs, isVirtual) { var _this8 = this; var _this$props9 = this.props, selectedTab = _this$props9.selectedTab, moreButtonClass = _this$props9.moreButtonClass, moreButtonActiveClass = _this$props9.moreButtonActiveClass, moreBoxClass = _this$props9.moreBoxClass, menuItemClass = _this$props9.menuItemClass, itemClass = _this$props9.itemClass, itemActiveClass = _this$props9.itemActiveClass, iconName = _this$props9.iconName, isPopupReady = _this$props9.isPopupReady, isPopupOpen = _this$props9.isPopupOpen, getContainerRef = _this$props9.getContainerRef, showTitleInMoreOptions = _this$props9.showTitleInMoreOptions, onSelect = _this$props9.onSelect, moreContainerClass = _this$props9.moreContainerClass, align = _this$props9.align, type = _this$props9.type, isAnimate = _this$props9.isAnimate, needTabBorder = _this$props9.needTabBorder, needAppearance = _this$props9.needAppearance, iconSize = _this$props9.iconSize, getTargetRef = _this$props9.getTargetRef, position = _this$props9.position, customProps = _this$props9.customProps, getCustomDropBoxHeaderPlaceHolder = _this$props9.getCustomDropBoxHeaderPlaceHolder, dataSelectorId = _this$props9.dataSelectorId, dataId = _this$props9.dataId, placeHolderText = _this$props9.placeHolderText, searchBoxSize = _this$props9.searchBoxSize, removeClose = _this$props9.removeClose, isAbsolutePositioningNeeded = _this$props9.isAbsolutePositioningNeeded, isRestrictScroll = _this$props9.isRestrictScroll, positionsOffset = _this$props9.positionsOffset, targetOffset = _this$props9.targetOffset; var searchValue = this.state.searchValue; var _customProps$DropBoxP = customProps.DropBoxProps, DropBoxProps = _customProps$DropBoxP === void 0 ? {} : _customProps$DropBoxP, _customProps$ListItem = customProps.ListItemProps, ListItemProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem, _customProps$MoreButt = customProps.MoreButtonProps, MoreButtonProps = _customProps$MoreButt === void 0 ? {} : _customProps$MoreButt, _customProps$TextBoxI = customProps.TextBoxIconProps, TextBoxIconProps = _customProps$TextBoxI === void 0 ? {} : _customProps$TextBoxI; var popupClass = _tabConfigs.TAB_DIRECTION_MAPPING[align] === 'column' ? _TabsModule["default"][position] ? _TabsModule["default"][position] : '' : ''; var moreTabsListItems = this.handleFilterSuggestions({ moreTabs: moreTabs }); var hasSearch = moreTabs.length > 4; return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _react["default"].Children.map(mainTabs, function (child) { if (!child) { return null; } var MainTab = child.type; var classProps = {}; if (itemActiveClass) { classProps.activeClass = itemActiveClass; } if (itemClass) { classProps.className = itemClass; } return /*#__PURE__*/_react["default"].isValidElement(child) && /*#__PURE__*/_react["default"].createElement(MainTab, _extends({}, child.props, { key: child.props.id, getTabRef: _this8.getTabRef, onSelect: onSelect, recalculateDimension: _this8.recalculateDimension, isActive: child.props.id === selectedTab, type: type, isAnimate: isAnimate, needBorder: needTabBorder, needAppearance: needAppearance, align: align, isVirtual: isVirtual }, classProps)); }), _react["default"].Children.count(moreTabs) ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, { className: "".concat(_TabsModule["default"].menu, " "), dataSelectorId: "".concat(dataSelectorId, "_moreIcon") }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, _extends({ className: "".concat(_semanticButtonModule["default"].buttonReset, " ").concat(moreButtonClass, " ").concat(isPopupOpen ? moreButtonActiveClass : ''), align: "both", onClick: this.togglePopup, dataId: "moreTabs", eleRef: getTargetRef }, MoreButtonProps, { "aria-label": "MoreTabs", role: "link", tagName: "button" }), /*#__PURE__*/_react["default"].createElement(_icons.Icon, { name: iconName, size: iconSize })), isPopupOpen && /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, { query: this.responsiveFunc, responsiveId: "Helmet" }, function (_ref4) { var tabletMode = _ref4.tabletMode; return /*#__PURE__*/_react["default"].createElement(_ResponsiveDropBox["default"], _extends({ isActive: isPopupReady, isAnimate: true, size: "medium", customClass: { customDropBoxWrap: "".concat(moreContainerClass, " ").concat(popupClass) }, boxPosition: position, getRef: getContainerRef, isBoxPaddingNeed: false, isArrow: false, isAbsolutePositioningNeeded: isAbsolutePositioningNeeded, isRestrictScroll: isRestrictScroll, positionsOffset: positionsOffset, targetOffset: targetOffset }, DropBoxProps, { isResponsivePadding: true, needFocusScope: true, dataId: "".concat(dataId, "_dropbox"), onClick: removeClose, onClose: _this8.togglePopup }), getCustomDropBoxHeaderPlaceHolder && getCustomDropBoxHeaderPlaceHolder(_this8.props), hasSearch ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, { className: _TabsModule["default"].search }, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], _extends({ placeHolder: placeHolderText, onChange: _this8.handleChange, value: searchValue, onClear: _this8.handleSearchValueClear, size: searchBoxSize, customProps: { TextBoxProps: { 'data-a11y-autofocus': true } }, dataId: "".concat(dataId, "_search"), autoComplete: false, name: "search" }, TextBoxIconProps))) : null, /*#__PURE__*/_react["default"].createElement(_Layout.Box, { flexible: true, shrink: true, scroll: "vertical", className: "".concat(_TabsModule["default"].listWrapper, " ").concat(tabletMode ? '' : _TabsModule["default"].menuBox, " ").concat(moreBoxClass), onScroll: _this8.onScroll, dataId: "".concat(dataId, "_Tabs") }, moreTabsListItems.length ? moreTabsListItems.map(function (data) { var text = data.text, id = data.id, title = data.title, isLink = data.isLink, href = data.href, children = data.children, dataId = data.dataId; var value = text ? text : showTitleInMoreOptions ? title : null; return /*#__PURE__*/_react["default"].createElement(_ListItem["default"], _extends({ key: id, value: value, onClick: _this8.moreTabSelect, id: id, title: title || text, isLink: isLink, href: href, autoHover: true, customClass: { customListItem: menuItemClass }, target: "self", dataId: "".concat(dataId, "_Tab") }, ListItemProps), !showTitleInMoreOptions ? children : null); }) : _this8.renderEmptyState())); })) : null); } }, { key: "render", value: function render() { var _this$props10 = this.props, style = _this$props10.style, className = _this$props10.className, dataId = _this$props10.dataId, highlightClass = _this$props10.highlightClass, type = _this$props10.type, isAnimate = _this$props10.isAnimate, needTabBorder = _this$props10.needTabBorder, needBorder = _this$props10.needBorder, needPadding = _this$props10.needPadding, align = _this$props10.align, needAppearance = _this$props10.needAppearance, children = _this$props10.children, containerClass = _this$props10.containerClass, dataSelectorId = _this$props10.dataSelectorId; var _this$state2 = this.state, totalDimension = _this$state2.totalDimension, tabDimensions = _this$state2.tabDimensions, renderVirtualTabs = _this$state2.renderVirtualTabs; var _this$responsiveTab = this.responsiveTab(totalDimension, tabDimensions), mainTabs = _this$responsiveTab.mainTabs, moreTabs = _this$responsiveTab.moreTabs, otherTabs = _this$responsiveTab.otherTabs; var appearanceClass = (0, _Common.cs)([_TabsModule["default"][type], needBorder && _TabsModule["default"]["".concat(type, "_border")], needPadding && _TabsModule["default"]["".concat(type, "_padding")]]); var tabsClass = (0, _Common.cs)([_TabsModule["default"].tab, className, needAppearance && appearanceClass]); var hlClass = (0, _Common.cs)([_TabsModule["default"].highlight, highlightClass, isAnimate && _TabsModule["default"].lineAnimate]); return /*#__PURE__*/_react["default"].createElement(_Layout.Box, { className: containerClass, dataSelectorId: dataSelectorId }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, { alignBox: _tabConfigs.TAB_DIRECTION_MAPPING[align] === 'column' ? 'row' : 'column', className: tabsClass, style: style }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, { eleRef: this.getTabsRef, flexible: true }, renderVirtualTabs && /*#__PURE__*/_react["default"].createElement(_Layout.Container, { alignBox: _tabConfigs.TAB_DIRECTION_MAPPING[align] === 'column' ? 'row' : 'column', className: _TabsModule["default"].hidden }, this.renderTabs(children, [], true)), /*#__PURE__*/_react["default"].createElement(_Layout.Container, { alignBox: _tabConfigs.TAB_DIRECTION_MAPPING[align] === 'column' ? 'row' : 'column' }, this.renderTabs(mainTabs, moreTabs, false))), otherTabs.length ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, null, otherTabs) : null, isAnimate && needTabBorder && needAppearance && /*#__PURE__*/_react["default"].createElement("div", { className: hlClass, ref: this.getHighlightRef, "data-id": dataId, "data-test-id": dataId }))); } }]); return Tabs; }(_react["default"].Component); Tabs.propTypes = _propTypes.Tabs_propTypes; Tabs.defaultProps = _objectSpread(_objectSpread({}, _defaultProps.Tabs_defaultProps), {}, { childType: _Tab["default"] }); var _default = (0, _Popup["default"])(Tabs); exports["default"] = _default;