'use strict';

var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
var _extends = require('@babel/runtime/helpers/extends');
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var pick = require('../../../node_modules/lodash-es/pick.js');
var isNil = require('../../../node_modules/lodash-es/isNil.js');
require('core-js/modules/es.symbol.js');
require('core-js/modules/es.array.concat.js');
require('core-js/modules/es.array.filter.js');
require('core-js/modules/es.array.from.js');
require('core-js/modules/es.array.includes.js');
require('core-js/modules/es.array.map.js');
require('core-js/modules/es.array.slice.js');
require('core-js/modules/es.function.name.js');
require('core-js/modules/es.object.get-own-property-descriptor.js');
require('core-js/modules/es.object.get-own-property-descriptors.js');
require('core-js/modules/es.object.keys.js');
require('core-js/modules/es.object.to-string.js');
require('core-js/modules/es.promise.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.string.includes.js');
require('core-js/modules/es.string.iterator.js');
require('core-js/modules/es.string.search.js');
require('core-js/modules/web.dom-collections.for-each.js');
var React = require('react');
var PropTypes = require('prop-types');
var react = require('@carbon/react');
var classnames = require('classnames');
var useLangDirection = require('../../../utils/useLangDirection.js');
var index = require('../../Tooltip/index.js');
var index$1 = require('../../OverflowMenu/index.js');
var Button = require('../../Button/Button.js');
var deprecate = require('../../../internal/deprecate.js');
var TablePropTypes = require('../TablePropTypes.js');
var componentUtilityFunctions = require('../../../utils/componentUtilityFunctions.js');
var Settings = require('../../../constants/Settings.js');
var RuleBuilderPropTypes = require('../../RuleBuilder/RuleBuilderPropTypes.js');
var useDynamicOverflowMenuItems = require('../../../hooks/useDynamicOverflowMenuItems.js');
var useResponsiveInlineCount = require('../../../hooks/useResponsiveInlineCount.js');
var tableUtilities = require('../tableUtilities.js');
var TableToolbarAdvancedFilterFlyout = require('./TableToolbarAdvancedFilterFlyout.js');
var TableToolbarSVGButton = require('./TableToolbarSVGButton.js');
var TableToolbarSearch = require('./TableToolbarSearch.js');
var iconsReact = require('@carbon/icons-react');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var _objectWithoutProperties__default = /*#__PURE__*/_interopDefault(_objectWithoutProperties);
var _extends__default = /*#__PURE__*/_interopDefault(_extends);
var _toConsumableArray__default = /*#__PURE__*/_interopDefault(_toConsumableArray);
var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
var React__default = /*#__PURE__*/_interopDefault(React);
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
var classnames__default = /*#__PURE__*/_interopDefault(classnames);

var _excluded = ["id", "labelText", "disabled"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var iotPrefix = Settings.settings.iotPrefix;
var FOCUSABLE_ELEMENTS_SELECTOR = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])';
var propTypes = {
  /** id of table */
  tableId: PropTypes__default.default.string.isRequired,
  secondaryTitle: PropTypes__default.default.string,
  tooltip: PropTypes__default.default.node,
  /** global table options */
  options: PropTypes__default.default.shape({
    hasAdvancedFilter: PropTypes__default.default.bool,
    hasAggregations: PropTypes__default.default.bool,
    /* option to hide batch action toolbar */
    hasBatchActionToolbar: PropTypes__default.default.bool,
    /** If true, search is applied as typed. If false, only after 'Enter' is pressed */
    hasFastSearch: PropTypes__default.default.bool,
    hasFilter: PropTypes__default.default.bool,
    hasSearch: PropTypes__default.default.bool,
    hasColumnSelection: PropTypes__default.default.bool,
    hasRowEdit: PropTypes__default.default.bool,
    hasRowSelection: PropTypes__default.default.oneOf(['multi', 'single', false]),
    onApplySearch: PropTypes__default.default.func,
    onDownloadCSV: PropTypes__default.default.func,
    onApplyAdvancedFilter: PropTypes__default.default.func,
    /** Optional boolean to render rowCount in header
     *  NOTE: Deprecated in favor of secondaryTitle for custom use
     */
    hasRowCountInHeader: deprecate(PropTypes__default.default.bool, '\n The prop `hasRowCountInHeader` has been deprecated in favor `secondaryTitle`'),
    // True if use can save/load views
    hasUserViewManagement: PropTypes__default.default.bool
  }).isRequired,
  /** internationalized labels */
  i18n: PropTypes__default.default.shape({
    clearAllFilters: PropTypes__default.default.string,
    columnSelectionButtonAria: PropTypes__default.default.string,
    filterButtonAria: PropTypes__default.default.string,
    editButtonAria: PropTypes__default.default.string,
    searchLabel: PropTypes__default.default.string,
    searchPlaceholder: PropTypes__default.default.string,
    batchCancel: PropTypes__default.default.string,
    itemsSelected: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.func]),
    itemSelected: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.func]),
    filterNone: PropTypes__default.default.string,
    filterAscending: PropTypes__default.default.string,
    filterDescending: PropTypes__default.default.string,
    toggleAggregations: PropTypes__default.default.string,
    toolbarLabelAria: PropTypes__default.default.string,
    rowCountInHeader: PropTypes__default.default.func,
    downloadIconDescription: PropTypes__default.default.string,
    /** aria-label applied to the tooltip in the toolbar (if given) */
    toolbarTooltipLabel: PropTypes__default.default.string,
    /** button label for batch action overflow menu */
    batchActionsOverflowMenuText: PropTypes__default.default.string,
    /** I18N label for search icon in toolbar */
    toolbarSearchIconDescription: PropTypes__default.default.string
  }),
  /**
   * Action callbacks to update tableState
   */
  actions: PropTypes__default.default.shape({
    onCancelBatchAction: PropTypes__default.default.func,
    onApplyBatchAction: PropTypes__default.default.func,
    onClearAllFilters: PropTypes__default.default.func,
    onToggleAggregations: PropTypes__default.default.func,
    onToggleColumnSelection: PropTypes__default.default.func,
    onToggleFilter: PropTypes__default.default.func,
    onToggleAdvancedFilter: PropTypes__default.default.func,
    onCreateAdvancedFilter: PropTypes__default.default.func,
    onChangeAdvancedFilter: PropTypes__default.default.func,
    onCancelAdvancedFilter: PropTypes__default.default.func,
    onApplyAdvancedFilter: PropTypes__default.default.func,
    onShowRowEdit: PropTypes__default.default.func,
    onApplySearch: PropTypes__default.default.func,
    onDownloadCSV: PropTypes__default.default.func,
    onApplyToolbarAction: PropTypes__default.default.func,
    onSearchExpand: PropTypes__default.default.func
  }).isRequired,
  /**
   * Inbound tableState
   */
  tableState: PropTypes__default.default.shape({
    /** is the toolbar currently disabled */
    isDisabled: PropTypes__default.default.bool,
    /** Which toolbar is currently active */
    activeBar: TablePropTypes.ActiveTableToolbarPropType,
    /** total number of selected rows */
    totalSelected: PropTypes__default.default.number,
    totalItemsCount: PropTypes__default.default.number,
    advancedFilterFlyoutOpen: PropTypes__default.default.bool,
    totalFilters: PropTypes__default.default.number,
    filters: TablePropTypes.TableFiltersPropType,
    columns: TablePropTypes.TableColumnsPropTypes,
    ordering: TablePropTypes.TableOrderingPropType,
    /** row selection option */
    hasRowSelection: PropTypes__default.default.oneOf(['multi', 'single', false]),
    /** optional content to render inside the toolbar  */
    customToolbarContent: PropTypes__default.default.node,
    /** available batch actions */
    batchActions: PropTypes__default.default.arrayOf(PropTypes__default.default.oneOfType([PropTypes__default.default.shape(_objectSpread(_objectSpread({}, TablePropTypes.TableSharedActionPropTypes), {}, {
      iconDescription: PropTypes__default.default.string
    })), PropTypes__default.default.shape(_objectSpread(_objectSpread({}, TablePropTypes.TableSharedOverflowMenuPropTypes), {}, {
      iconDescription: PropTypes__default.default.string
    }))])),
    search: TablePropTypes.TableSearchPropTypes,
    /** buttons to be shown with when activeBar is 'rowEdit' */
    rowEditBarButtons: PropTypes__default.default.node,
    /** a stripped down version of the RuleBuilderFilterPropType */
    advancedFilters: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
      /** Unique id for particular filter */
      filterId: PropTypes__default.default.string.isRequired,
      /** Text for main title of page */
      filterTitleText: PropTypes__default.default.string.isRequired,
      filterRules: RuleBuilderPropTypes.RuleGroupPropType.isRequired
    })),
    /** currently selected advanced filters */
    selectedAdvancedFilterIds: PropTypes__default.default.arrayOf(PropTypes__default.default.string),
    /** toolbar actions that can appear in an overflow menu in the toolbar (same menu as toggle aggregations) */
    toolbarActions: TablePropTypes.TableToolbarActionsPropType,
    /** force hide Clear all filters button in toolbar */
    hideClearAllFiltersButton: PropTypes__default.default.bool
  }).isRequired,
  /** Row value data for the body of the table */
  data: TablePropTypes.TableRowsPropTypes.isRequired,
  // TODO: remove deprecated 'testID' in v3
  // eslint-disable-next-line react/require-default-props
  testID: deprecate(PropTypes__default.default.string, "The 'testID' prop has been deprecated. Please use 'testId' instead."),
  testId: PropTypes__default.default.string
};
var defaultProps = {
  i18n: _objectSpread({}, TablePropTypes.defaultI18NPropTypes),
  secondaryTitle: null,
  tooltip: null,
  testId: ''
};
var TableToolbar = function TableToolbar(_ref) {
  var tableId = _ref.tableId,
    className = _ref.className,
    i18n = _ref.i18n,
    secondaryTitle = _ref.secondaryTitle,
    tooltip = _ref.tooltip,
    _ref$options = _ref.options,
    hasAdvancedFilter = _ref$options.hasAdvancedFilter,
    hasAggregations = _ref$options.hasAggregations,
    hasColumnSelection = _ref$options.hasColumnSelection,
    hasFastSearch = _ref$options.hasFastSearch,
    hasFilter = _ref$options.hasFilter,
    hasSearch = _ref$options.hasSearch,
    hasRowSelection = _ref$options.hasRowSelection,
    hasRowCountInHeader = _ref$options.hasRowCountInHeader,
    hasRowEdit = _ref$options.hasRowEdit,
    hasUserViewManagement = _ref$options.hasUserViewManagement,
    hasBatchActionToolbar = _ref$options.hasBatchActionToolbar,
    _ref$actions = _ref.actions,
    onCancelBatchAction = _ref$actions.onCancelBatchAction,
    onApplyBatchAction = _ref$actions.onApplyBatchAction,
    onClearAllFilters = _ref$actions.onClearAllFilters,
    onToggleAggregations = _ref$actions.onToggleAggregations,
    onToggleColumnSelection = _ref$actions.onToggleColumnSelection,
    onToggleFilter = _ref$actions.onToggleFilter,
    onShowRowEdit = _ref$actions.onShowRowEdit,
    onApplySearch = _ref$actions.onApplySearch,
    onDownloadCSV = _ref$actions.onDownloadCSV,
    onApplyAdvancedFilter = _ref$actions.onApplyAdvancedFilter,
    onCancelAdvancedFilter = _ref$actions.onCancelAdvancedFilter,
    onCreateAdvancedFilter = _ref$actions.onCreateAdvancedFilter,
    onChangeAdvancedFilter = _ref$actions.onChangeAdvancedFilter,
    onToggleAdvancedFilter = _ref$actions.onToggleAdvancedFilter,
    onApplyToolbarAction = _ref$actions.onApplyToolbarAction,
    onSearchExpand = _ref$actions.onSearchExpand,
    _ref$tableState = _ref.tableState,
    advancedFilterFlyoutOpen = _ref$tableState.advancedFilterFlyoutOpen,
    advancedFilters = _ref$tableState.advancedFilters,
    totalSelected = _ref$tableState.totalSelected,
    totalFilters = _ref$tableState.totalFilters,
    batchActions = _ref$tableState.batchActions,
    searchProp = _ref$tableState.search,
    activeBar = _ref$tableState.activeBar,
    customToolbarContent = _ref$tableState.customToolbarContent,
    isDisabled = _ref$tableState.isDisabled,
    totalItemsCount = _ref$tableState.totalItemsCount,
    rowEditBarButtons = _ref$tableState.rowEditBarButtons,
    filters = _ref$tableState.filters,
    selectedAdvancedFilterIds = _ref$tableState.selectedAdvancedFilterIds,
    columns = _ref$tableState.columns,
    ordering = _ref$tableState.ordering,
    toolbarActions = _ref$tableState.toolbarActions,
    hideClearAllFiltersButton = _ref$tableState.hideClearAllFiltersButton,
    data = _ref.data,
    testID = _ref.testID,
    testId = _ref.testId;
  var shouldShowBatchActions = hasRowSelection === 'multi' && totalSelected > 0;
  var langDir = useLangDirection.useLangDirection();
  var tableToolbarRef = React.useRef(null);
  var batchActionsRef = React.useRef(null);
  var previousFocusedElement = React.useRef(null);
  var toolbarContentRef = React.useRef(null);
  var batchOverflowMenuRef = React.useRef(null);
  var batchActionsVisibleRef = React.useRef(null);
  var batchActionsLayoutRef = React.useRef(null);
  var _React$useState = React__default.default.useState(false),
    _React$useState2 = _slicedToArray__default.default(_React$useState, 2),
    isBatchOverflowOpen = _React$useState2[0],
    setIsBatchOverflowOpen = _React$useState2[1];

  // Function to restore focus to the previous element
  var restoreFocus = function restoreFocus() {
    if (previousFocusedElement.current) {
      previousFocusedElement.current.focus();
      previousFocusedElement.current = null;
    }
  };

  // Handle focus management when batch actions appear/disappear
  React.useEffect(function () {
    if (shouldShowBatchActions && batchActionsRef.current) {
      // Store the currently focused element before switching to batch actions
      previousFocusedElement.current = document.activeElement;

      // Hide toolbar content from screen readers when batch actions are visible
      if (toolbarContentRef.current) {
        toolbarContentRef.current.setAttribute('aria-hidden', 'true');
      }

      // Find the first focusable element in batch actions
      var focusable = batchActionsRef.current.querySelector(FOCUSABLE_ELEMENTS_SELECTOR);
      if (focusable) {
        focusable.focus();
      }
    } else if (!shouldShowBatchActions) {
      // Remove aria-hidden immediately when batch actions are hidden
      if (toolbarContentRef.current) {
        toolbarContentRef.current.removeAttribute('aria-hidden');
      }

      // Restore focus when batch actions are hidden
      if (previousFocusedElement.current) {
        // Use setTimeout to ensure the DOM has updated before restoring focus
        setTimeout(function () {
          if (previousFocusedElement.current) {
            // Check if the previous element is still in the document and focusable
            if (document.contains(previousFocusedElement.current)) {
              previousFocusedElement.current.focus();
            } else if (toolbarContentRef.current) {
              // If previous element is no longer available, focus the first focusable element in toolbar
              var firstFocusable = toolbarContentRef.current.querySelector(FOCUSABLE_ELEMENTS_SELECTOR);
              if (firstFocusable) {
                firstFocusable.focus();
              }
            }
            previousFocusedElement.current = null;
          }
        }, 0);
      }
    }
  }, [shouldShowBatchActions]);

  // Handle keyboard navigation for batch overflow menu
  React.useEffect(function () {
    if (!isBatchOverflowOpen || !shouldShowBatchActions) {
      return undefined;
    }
    var handleKeyDown = function handleKeyDown(e) {
      var _activeElement$classL;
      // Only handle Shift+Tab
      if (!e.shiftKey || e.key !== 'Tab') return;

      // Check if the active element is within a menu
      var _document = document,
        activeElement = _document.activeElement;

      // Multiple ways to detect if we're in an overflow menu
      var isInOverflowMenu =
      // Check role
      (activeElement === null || activeElement === void 0 ? void 0 : activeElement.getAttribute('role')) === 'menuitem' || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.closest('[role="menuitem"]')) !== null || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.closest('[role="menu"]')) !== null ||
      // Check Carbon classes
      (activeElement === null || activeElement === void 0 ? void 0 : activeElement.closest('.cds--overflow-menu-options')) !== null || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.closest('.cds--overflow-menu-options__option')) !== null || (activeElement === null || activeElement === void 0 || (_activeElement$classL = activeElement.classList) === null || _activeElement$classL === void 0 ? void 0 : _activeElement$classL.contains('cds--overflow-menu-options__option')) ||
      // Check for batch actions overflow menu specifically
      (activeElement === null || activeElement === void 0 ? void 0 : activeElement.closest(".".concat(iotPrefix, "--table-overflow-batch-actions"))) !== null ||
      // Check our test IDs
      (activeElement === null || activeElement === void 0 ? void 0 : activeElement.closest("[data-testid^=\"".concat(testID || testId, "-batch-actions-overflow-menu-item\"]"))) !== null;
      if (!isInOverflowMenu) {
        return;
      }

      // Prevent the default tab behavior
      e.preventDefault();
      e.stopPropagation();
      e.stopImmediatePropagation();

      // Close the menu
      setIsBatchOverflowOpen(false);

      // Return focus to the overflow button
      setTimeout(function () {
        if (batchOverflowMenuRef.current) {
          var overflowButton = batchOverflowMenuRef.current.querySelector('button');
          if (overflowButton) {
            overflowButton.focus();
          }
        }
      }, 100);
    };

    // Add event listener with capture phase to intercept before default behavior
    document.addEventListener('keydown', handleKeyDown, true);
    return function () {
      document.removeEventListener('keydown', handleKeyDown, true);
    };
  }, [isBatchOverflowOpen, shouldShowBatchActions, testID, testId]);
  var _useDynamicOverflowMe = useDynamicOverflowMenuItems({
      actions: toolbarActions,
      className: "".concat(iotPrefix, "--table-toolbar-aggregations__overflow-menu-content"),
      isDisabled: isDisabled,
      onClick: onApplyToolbarAction,
      testId: testID || testId
    }),
    _useDynamicOverflowMe2 = _slicedToArray__default.default(_useDynamicOverflowMe, 3),
    isOpen = _useDynamicOverflowMe2[0],
    setIsOpen = _useDynamicOverflowMe2[1],
    renderToolbarOverflowActions = _useDynamicOverflowMe2[2];
  var actions = React.useMemo(function () {
    var renderedActions = typeof toolbarActions === 'function' ? toolbarActions() : toolbarActions;
    return renderedActions !== null && renderedActions !== void 0 && renderedActions.length ? renderedActions : [];
  }, [toolbarActions]);
  var hasToolbarOverflowActions = actions.filter(function (action) {
    return action.isOverflow && action.hidden !== true;
  }).length > 0;
  var visibleToolbarActions = actions.filter(function (action) {
    return !action.isOverflow && action.hidden !== true;
  });

  // Extract TableViewDropdown from customToolbarContent
  var _useMemo = React.useMemo(function () {
      var _customToolbarContent;
      if (!customToolbarContent) {
        return {
          tableViewDropdown: null,
          otherToolbarContent: null
        };
      }

      // Helper function to check if a child is TableViewDropdown
      var isTableViewDropdown = function isTableViewDropdown(child) {
        if (!child) return false;

        // Check by key (most reliable for wrapped components)
        if (child.key && typeof child.key === 'string' && child.key.includes('table-view-dropdown')) {
          return true;
        }

        // Check by type properties
        if (child.type) {
          // Check by displayName
          if (child.type.displayName === 'TableViewDropdown') return true;

          // Check by function name
          if (child.type.name === 'TableViewDropdown') return true;
        }

        // Check by props (TableViewDropdown has specific props like 'views', 'selectedViewId')
        if (child.props && (child.props.views !== undefined || child.props.selectedViewId !== undefined || child.props.selectedViewEdited !== undefined)) {
          return true;
        }
        return false;
      };

      // Extract children from Fragment if present
      var contentToProcess = customToolbarContent;

      // Check if it's a Fragment (React.Fragment has type as Symbol or Fragment)
      if (customToolbarContent.type === React__default.default.Fragment && (_customToolbarContent = customToolbarContent.props) !== null && _customToolbarContent !== void 0 && _customToolbarContent.children) {
        contentToProcess = customToolbarContent.props.children;
      }

      // Convert to array (handles both single element and multiple children)
      var contentArray = React__default.default.Children.toArray(contentToProcess);

      // Always check the first element
      var firstElement = contentArray[0];
      if (isTableViewDropdown(firstElement)) {
        // First element is TableViewDropdown - extract it, rest is other content
        var remainingContent = contentArray.slice(1);
        return {
          tableViewDropdown: firstElement,
          otherToolbarContent: remainingContent.length > 0 ? remainingContent : null
        };
      }

      // First element is not TableViewDropdown - all content is other content
      return {
        tableViewDropdown: null,
        otherToolbarContent: contentArray.length > 0 ? contentArray : null
      };
    }, [customToolbarContent]),
    tableViewDropdown = _useMemo.tableViewDropdown,
    otherToolbarContent = _useMemo.otherToolbarContent;
  var visibleBatchActionCandidates = React.useMemo(function () {
    return batchActions.filter(function (action) {
      return !action.isOverflow && action.hidden !== true;
    });
  }, [batchActions]);
  var staticOverflowBatchActions = React.useMemo(function () {
    return batchActions.filter(function (action) {
      return action.isOverflow && action.hidden !== true;
    });
  }, [batchActions]);
  var batchActionExcludedWidthSelectors = React.useMemo(function () {
    return ['.cds--batch-summary', '.cds--batch-summary__cancel'];
  }, []);
  var responsiveBatchActionCount = useResponsiveInlineCount({
    enabled: hasBatchActionToolbar && (visibleBatchActionCandidates.length > 0 || staticOverflowBatchActions.length > 0),
    items: visibleBatchActionCandidates,
    containerRef: batchActionsVisibleRef,
    overflowTriggerRef: batchOverflowMenuRef,
    itemSelector: '[data-batch-action-visible="true"]',
    staticOverflowCount: staticOverflowBatchActions.length,
    layoutRef: tableToolbarRef,
    excludedWidthSelector: batchActionExcludedWidthSelectors
  });
  var visibleOverflowBatchActions = [].concat(_toConsumableArray__default.default(visibleBatchActionCandidates.slice(responsiveBatchActionCount !== null && responsiveBatchActionCount !== void 0 ? responsiveBatchActionCount : visibleBatchActionCandidates.length)), _toConsumableArray__default.default(staticOverflowBatchActions));
  var hasVisibleOverflowBatchActions = visibleOverflowBatchActions.length > 0;
  var hasStaticOverflowBatchActions = staticOverflowBatchActions.length > 0;
  var shouldRenderBatchOverflowTrigger = hasStaticOverflowBatchActions || responsiveBatchActionCount !== null && responsiveBatchActionCount < visibleBatchActionCandidates.length || hasVisibleOverflowBatchActions;
  var totalSelectedText = React.useMemo(function () {
    if (totalSelected > 1) {
      if (typeof i18n.itemsSelected === 'function') {
        return i18n.itemsSelected(totalSelected);
      }
      return "".concat(totalSelected, " ").concat(i18n.itemsSelected);
    }
    if (typeof i18n.itemSelected === 'function') {
      return i18n.itemSelected(totalSelected);
    }
    return "".concat(totalSelected, " ").concat(i18n.itemSelected);
    /* eslint-disable-next-line react-hooks/exhaustive-deps */
  }, [i18n.itemSelected, i18n.itemsSelected, totalSelected]);

  /** If all option are false then hide entire row for toolbar, without this its allocated height remain and blank space was visible */
  var allFalse = [hasAdvancedFilter, hasAggregations, hasColumnSelection, hasFilter, hasSearch, hasRowCountInHeader, hasRowEdit, hasUserViewManagement, hasBatchActionToolbar, hasRowSelection].every(function (flag) {
    return !flag;
  });
  if (allFalse) {
    return null;
  }
  return /*#__PURE__*/React__default.default.createElement(react.TableToolbar, {
    ref: tableToolbarRef
    // TODO: remove deprecated 'testID' in v3
    ,
    "data-testid": testID || testId,
    className: classnames__default.default("".concat(iotPrefix, "--table-toolbar"), className),
    "aria-label": i18n.toolbarLabelAria
  }, secondaryTitle ?
  /*#__PURE__*/
  // eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for
  React__default.default.createElement("label", {
    className: "".concat(iotPrefix, "--table-toolbar-secondary-title")
  }, secondaryTitle) : !hasBatchActionToolbar && shouldShowBatchActions ?
  /*#__PURE__*/
  // eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for
  React__default.default.createElement("label", {
    className: "".concat(iotPrefix, "--table-toolbar-secondary-title"),
    "aria-live": "polite",
    "aria-atomic": "true",
    role: "status"
  }, totalSelectedText) : null,
  // Deprecated in favor of secondaryTitle for a more general use-case
  hasRowCountInHeader ?
  /*#__PURE__*/
  // eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for
  React__default.default.createElement("label", {
    className: "".concat(iotPrefix, "--table-toolbar-secondary-title")
  }, i18n.rowCountInHeader(totalItemsCount)) : null, tooltip && /*#__PURE__*/React__default.default.createElement("div", {
    className: "".concat(iotPrefix, "--table-tooltip-container")
  }, /*#__PURE__*/React__default.default.createElement(index.Tooltip, {
    triggerId: "card-tooltip-trigger-".concat(tableId),
    tooltipId: "card-tooltip-".concat(tableId),
    triggerText: "",
    iconDescription: i18n.toolbarTooltipLabel
  }, tooltip)), activeBar === 'rowEdit' ? /*#__PURE__*/React__default.default.createElement("div", {
    className: "".concat(iotPrefix, "--table-row-edit-actions")
  }, rowEditBarButtons) : /*#__PURE__*/React__default.default.createElement(react.TableToolbarContent, {
    ref: toolbarContentRef
    // TODO: remove deprecated 'testID' in v3
    ,
    "data-testid": "".concat(testID || testId, "-content"),
    className: "".concat(iotPrefix, "--table-toolbar-content")
  }, tableViewDropdown || null, hasSearch ? /*#__PURE__*/React__default.default.createElement(TableToolbarSearch, {
    tableId: tableId,
    i18n: i18n,
    options: {
      hasFastSearch: hasFastSearch,
      hasUserViewManagement: hasUserViewManagement
    },
    actions: {
      onApplySearch: onApplySearch,
      onSearchExpand: onSearchExpand
    },
    tableState: {
      search: searchProp,
      isDisabled: isDisabled
    },
    testId: testID || testId,
    langDir: langDir
  }) : null, totalFilters > 0 && !hideClearAllFiltersButton ? /*#__PURE__*/React__default.default.createElement(Button, {
    kind: "secondary",
    onClick: onClearAllFilters,
    disabled: isDisabled,
    testId: "".concat(testId, "-clear-filters-button")
  }, i18n.clearAllFilters) : null, onDownloadCSV ? /*#__PURE__*/React__default.default.createElement(TableToolbarSVGButton, {
    onClick: function onClick() {
      // hand back the filtered data
      onDownloadCSV(data);
    },
    description: i18n.downloadIconDescription,
    testId: "download-button",
    renderIcon: iconsReact.Download,
    disabled: isDisabled,
    langDir: langDir
  }) : null, hasColumnSelection ? /*#__PURE__*/React__default.default.createElement(TableToolbarSVGButton, {
    isActive: activeBar === 'column',
    onClick: onToggleColumnSelection,
    description: i18n.columnSelectionButtonAria,
    testId: "column-selection-button",
    renderIcon: iconsReact.Column,
    disabled: isDisabled,
    langDir: langDir
  }) : null, hasFilter ? /*#__PURE__*/React__default.default.createElement(TableToolbarSVGButton, {
    isActive: activeBar === 'filter',
    onClick: onToggleFilter,
    description: i18n.filterButtonAria,
    testId: "filter-button",
    renderIcon: iconsReact.Filter,
    disabled: isDisabled,
    langDir: langDir
  }) : null, hasAdvancedFilter ? /*#__PURE__*/React__default.default.createElement(TableToolbarAdvancedFilterFlyout, {
    actions: {
      onApplyAdvancedFilter: onApplyAdvancedFilter,
      onCancelAdvancedFilter: onCancelAdvancedFilter,
      onCreateAdvancedFilter: onCreateAdvancedFilter,
      onChangeAdvancedFilter: onChangeAdvancedFilter,
      onToggleAdvancedFilter: onToggleAdvancedFilter
    },
    columns: columns.map(function (column) {
      var _column$filter, _column$filter2;
      return _objectSpread(_objectSpread({}, column.filter), {}, {
        id: column.id,
        name: column.name,
        isDate: (_column$filter = column.filter) === null || _column$filter === void 0 ? void 0 : _column$filter.isDate,
        isFilterable: !isNil(column.filter),
        isMultiselect: (_column$filter2 = column.filter) === null || _column$filter2 === void 0 ? void 0 : _column$filter2.isMultiselect
      });
    }),
    tableState: {
      filters: filters,
      advancedFilters: advancedFilters,
      selectedAdvancedFilterIds: selectedAdvancedFilterIds,
      advancedFilterFlyoutOpen: advancedFilterFlyoutOpen,
      ordering: ordering,
      hasFastFilter: hasAdvancedFilter === 'onKeyPress',
      isDisabled: isDisabled
    },
    i18n: _objectSpread({}, pick(i18n, 'filterText', 'clearFilterText', 'clearSelectionText', 'openMenuText', 'closeMenuText', 'applyButtonText', 'cancelButtonText', 'advancedFilterLabelText', 'createNewAdvancedFilterText', 'advancedFilterPlaceholderText', 'simpleFiltersTabLabel', 'advancedFiltersTabLabel'))
  }) : null, hasRowEdit ? /*#__PURE__*/React__default.default.createElement(TableToolbarSVGButton, {
    isActive: activeBar === 'rowEdit',
    description: i18n.editButtonAria,
    onClick: onShowRowEdit,
    testId: "row-edit-button",
    renderIcon: function renderIcon(props) {
      return /*#__PURE__*/React__default.default.createElement(iconsReact.Edit, _extends__default.default({
        size: 16
      }, props));
    },
    disabled: isDisabled,
    langDir: langDir
  }) : null, visibleToolbarActions.map(function (action) {
    return /*#__PURE__*/React__default.default.createElement(TableToolbarSVGButton, {
      isActive: action.isActive,
      description: action.labelText || action.iconDescription,
      onClick: function onClick(e) {
        e.stopPropagation();
        onApplyToolbarAction(action);
      },
      testId: "".concat(tableId, "-toolbar-actions-button-").concat(action.id),
      key: "".concat(tableId, "-toolbar-actions-button-").concat(action.id),
      renderIcon: action.renderIcon,
      disabled: isDisabled || action.disabled,
      langDir: langDir
    });
  }), hasAggregations || hasToolbarOverflowActions ? /*#__PURE__*/React__default.default.createElement(index$1.OverflowMenu, {
    className: "".concat(iotPrefix, "--table-toolbar-aggregations__overflow-menu"),
    direction: "bottom",
    flipped: langDir === 'ltr',
    "data-testid": "table-head--overflow",
    onClick: function onClick(e) {
      return e.stopPropagation();
    },
    renderIcon: function renderIcon(props) {
      return /*#__PURE__*/React__default.default.createElement(iconsReact.OverflowMenuVertical, _extends__default.default({
        size: 16
      }, props));
    },
    iconClass: "".concat(iotPrefix, "--table-toolbar-aggregations__overflow-icon"),
    onOpen: function onOpen() {
      return setIsOpen(true);
    },
    onClose: function onClose() {
      return setIsOpen(false);
    },
    onKeyDown: function onKeyDown(e) {
      // Handle Shift+Tab to keep focus within toolbar
      if (e.shiftKey && e.key === 'Tab' && isOpen) {
        e.preventDefault();
        setIsOpen(false);
        // Focus will naturally return to the overflow menu button
      }
    },
    withCarbonTooltip: true,
    tooltipPosition: "bottom"
  }, hasAggregations && /*#__PURE__*/React__default.default.createElement(react.OverflowMenuItem, {
    "data-testid": "".concat(testID || testId, "-toolbar-overflow-menu-item-aggregations"),
    itemText: i18n.toggleAggregations,
    key: "table-aggregations-overflow-item",
    onClick: function onClick() {
      setIsOpen(false);
      onToggleAggregations();
    },
    disabled: isDisabled
  }), isOpen && renderToolbarOverflowActions(),
  /**
   * a placeholder node to ensure the menu will always open. If there are no children,
   * the renderToolbarOverflowAction method above will never fire, because the
   * OverflowMenu doesn't open properly if no children are provided.
   */
  !isOpen && /*#__PURE__*/React__default.default.createElement(react.OverflowMenuItem, {
    itemText: "",
    disabled: true
  })) : null,
  // Render other custom toolbar content
  otherToolbarContent || null), hasBatchActionToolbar ? /*#__PURE__*/React__default.default.createElement(react.TableBatchActions, {
    ref: function ref(node) {
      batchActionsRef.current = node;
      batchActionsLayoutRef.current = node;
    },
    role: "region",
    "aria-live": "polite",
    "aria-label": totalSelectedText
    // TODO: remove deprecated 'testID' in v3
    ,
    "data-testid": "".concat(testID || testId, "-batch-actions"),
    id: "".concat(tableId, "-batch-actions-root"),
    className: "".concat(iotPrefix, "--table-batch-actions"),
    style: {
      width: '100%',
      maxWidth: '100%',
      minWidth: 0,
      overflow: 'hidden'
    },
    onCancel: function onCancel() {
      if (onCancelBatchAction) {
        onCancelBatchAction();
      }
      restoreFocus();
    },
    shouldShowBatchActions: shouldShowBatchActions,
    totalSelected: totalSelected,
    translateWithId: function translateWithId() {
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
      return componentUtilityFunctions.tableTranslateWithId.apply(void 0, [i18n].concat(args));
    }
  }, /*#__PURE__*/React__default.default.createElement("div", {
    id: "".concat(tableId, "-batch-actions-visible"),
    ref: batchActionsVisibleRef,
    style: {
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'flex-end',
      minWidth: 0,
      flex: '1 1 auto',
      overflow: 'visible'
    }
  }, visibleBatchActionCandidates.map(function (_ref2, index) {
    var id = _ref2.id,
      labelText = _ref2.labelText,
      disabled = _ref2.disabled,
      others = _objectWithoutProperties__default.default(_ref2, _excluded);
    var isVisibleInline = responsiveBatchActionCount === null || index < responsiveBatchActionCount;
    return /*#__PURE__*/React__default.default.createElement(react.TableBatchAction, _extends__default.default({
      key: id,
      id: "".concat(tableId, "-batch-action-").concat(id),
      "data-batch-action-visible": "true",
      onClick: function onClick() {
        onApplyBatchAction(id);
        restoreFocus();
      },
      tabIndex: isVisibleInline && shouldShowBatchActions ? 0 : -1,
      disabled: !shouldShowBatchActions || disabled
    }, others, {
      "aria-hidden": !isVisibleInline,
      style: isVisibleInline ? {
        flex: '0 0 auto'
      } : {
        flex: '0 0 auto',
        position: 'absolute',
        visibility: 'hidden',
        pointerEvents: 'none'
      }
    }), labelText);
  }), shouldRenderBatchOverflowTrigger ? /*#__PURE__*/React__default.default.createElement("div", {
    id: "".concat(tableId, "-batch-actions-overflow-trigger"),
    role: "presentation",
    ref: batchOverflowMenuRef,
    "data-batch-overflow-visible": "true",
    style: {
      display: 'inline-flex',
      flexShrink: 0
    },
    onKeyDown: function onKeyDown(e) {
      if (!shouldShowBatchActions) return;

      // Handle Shift+Tab from within the batch overflow menu
      if (e.shiftKey && e.key === 'Tab') {
        var _batchOverflowMenuRef;
        var menuItems = (_batchOverflowMenuRef = batchOverflowMenuRef.current) === null || _batchOverflowMenuRef === void 0 ? void 0 : _batchOverflowMenuRef.querySelectorAll('[role="menuitem"]:not([disabled])');
        var firstMenuItem = menuItems === null || menuItems === void 0 ? void 0 : menuItems[0];

        // If we're on the first menu item, move focus to previous batch action
        if (firstMenuItem && document.activeElement === firstMenuItem) {
          e.preventDefault();
          // Find previous focusable element in batch actions
          if (batchActionsRef.current) {
            var _batchOverflowMenuRef2;
            var focusableElements = batchActionsRef.current.querySelectorAll(FOCUSABLE_ELEMENTS_SELECTOR);
            var overflowButton = (_batchOverflowMenuRef2 = batchOverflowMenuRef.current) === null || _batchOverflowMenuRef2 === void 0 ? void 0 : _batchOverflowMenuRef2.querySelector('button');
            var currentIndex = Array.from(focusableElements).indexOf(overflowButton);
            var prevElement = focusableElements[currentIndex - 1];
            if (prevElement) {
              prevElement.focus();
            }
          }
        }
      }
      // Handle Tab from the last menu item
      else if (e.key === 'Tab' && !e.shiftKey) {
        var _batchOverflowMenuRef3;
        var _menuItems = (_batchOverflowMenuRef3 = batchOverflowMenuRef.current) === null || _batchOverflowMenuRef3 === void 0 ? void 0 : _batchOverflowMenuRef3.querySelectorAll('[role="menuitem"]:not([disabled])');
        var lastMenuItem = _menuItems === null || _menuItems === void 0 ? void 0 : _menuItems[_menuItems.length - 1];

        // If we're on the last menu item, move to Clear selections button
        if (lastMenuItem && document.activeElement === lastMenuItem) {
          e.preventDefault();
          // Find the Clear selections button or next focusable element
          if (batchActionsRef.current) {
            var _batchOverflowMenuRef4;
            var _focusableElements = batchActionsRef.current.querySelectorAll(FOCUSABLE_ELEMENTS_SELECTOR);
            var _overflowButton = (_batchOverflowMenuRef4 = batchOverflowMenuRef.current) === null || _batchOverflowMenuRef4 === void 0 ? void 0 : _batchOverflowMenuRef4.querySelector('button');
            var _currentIndex = Array.from(_focusableElements).indexOf(_overflowButton);
            var nextElement = _focusableElements[_currentIndex + 1];
            if (nextElement) {
              nextElement.focus();
            }
          }
        }
      }
    }
  }, /*#__PURE__*/React__default.default.createElement(index$1.OverflowMenu, {
    "data-testid": "".concat(testID || testId, "-batch-actions-overflow-menu"),
    className: "".concat(iotPrefix, "--table-overflow-batch-actions"),
    flipped: langDir === 'ltr',
    direction: "bottom",
    onClick: function onClick(e) {
      return e.stopPropagation();
    },
    renderIcon: function renderIcon(props) {
      return /*#__PURE__*/React__default.default.createElement(iconsReact.OverflowMenuVertical, _extends__default.default({
        size: 16
      }, props));
    },
    tabIndex: shouldShowBatchActions ? 0 : -1,
    size: "md",
    menuOptionsClass: "".concat(iotPrefix, "--table-overflow-batch-actions__menu"),
    withCarbonTooltip: true,
    tooltipPosition: "bottom",
    buttonLabel: i18n.batchActionsOverflowMenuText,
    open: isBatchOverflowOpen,
    onOpen: function onOpen() {
      return setIsBatchOverflowOpen(true);
    },
    onClose: function onClose() {
      return setIsBatchOverflowOpen(false);
    }
  }, visibleOverflowBatchActions.map(function (_ref3) {
    var id = _ref3.id,
      labelText = _ref3.labelText,
      disabled = _ref3.disabled,
      hasDivider = _ref3.hasDivider,
      isDelete = _ref3.isDelete,
      renderIcon = _ref3.renderIcon,
      iconDescription = _ref3.iconDescription;
    return /*#__PURE__*/React__default.default.createElement(react.OverflowMenuItem, {
      "data-testid": "".concat(testID || testId, "-batch-actions-overflow-menu-item-").concat(id),
      itemText: tableUtilities.renderTableOverflowItemText({
        action: {
          renderIcon: renderIcon,
          labelText: labelText || iconDescription
        },
        className: "".concat(iotPrefix, "--table-toolbar-aggregations__overflow-menu-content")
      }),
      disabled: !shouldShowBatchActions || disabled,
      onClick: function onClick() {
        onApplyBatchAction(id);
        restoreFocus();
      },
      key: "table-batch-actions-overflow-menu-".concat(id),
      requireTitle: !renderIcon,
      hasDivider: hasDivider,
      isDelete: isDelete,
      "aria-label": labelText
    });
  }))) : null)) : null);
};
TableToolbar.propTypes = propTypes;
TableToolbar.defaultProps = defaultProps;
TableToolbar.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "TableToolbar",
  "props": {
    "i18n": {
      "defaultValue": {
        "value": "{\n  ...defaultI18NPropTypes,\n}",
        "computed": false
      },
      "description": "internationalized labels",
      "type": {
        "name": "shape",
        "value": {
          "clearAllFilters": {
            "name": "string",
            "required": false
          },
          "columnSelectionButtonAria": {
            "name": "string",
            "required": false
          },
          "filterButtonAria": {
            "name": "string",
            "required": false
          },
          "editButtonAria": {
            "name": "string",
            "required": false
          },
          "searchLabel": {
            "name": "string",
            "required": false
          },
          "searchPlaceholder": {
            "name": "string",
            "required": false
          },
          "batchCancel": {
            "name": "string",
            "required": false
          },
          "itemsSelected": {
            "name": "union",
            "value": [{
              "name": "string"
            }, {
              "name": "func"
            }],
            "required": false
          },
          "itemSelected": {
            "name": "union",
            "value": [{
              "name": "string"
            }, {
              "name": "func"
            }],
            "required": false
          },
          "filterNone": {
            "name": "string",
            "required": false
          },
          "filterAscending": {
            "name": "string",
            "required": false
          },
          "filterDescending": {
            "name": "string",
            "required": false
          },
          "toggleAggregations": {
            "name": "string",
            "required": false
          },
          "toolbarLabelAria": {
            "name": "string",
            "required": false
          },
          "rowCountInHeader": {
            "name": "func",
            "required": false
          },
          "downloadIconDescription": {
            "name": "string",
            "required": false
          },
          "toolbarTooltipLabel": {
            "name": "string",
            "description": "aria-label applied to the tooltip in the toolbar (if given)",
            "required": false
          },
          "batchActionsOverflowMenuText": {
            "name": "string",
            "description": "button label for batch action overflow menu",
            "required": false
          },
          "toolbarSearchIconDescription": {
            "name": "string",
            "description": "I18N label for search icon in toolbar",
            "required": false
          }
        }
      },
      "required": false
    },
    "secondaryTitle": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "tooltip": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "node"
      },
      "required": false
    },
    "testId": {
      "defaultValue": {
        "value": "''",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "tableId": {
      "description": "id of table",
      "type": {
        "name": "string"
      },
      "required": true
    },
    "options": {
      "description": "global table options",
      "type": {
        "name": "shape",
        "value": {
          "hasAdvancedFilter": {
            "name": "bool",
            "required": false
          },
          "hasAggregations": {
            "name": "bool",
            "required": false
          },
          "hasBatchActionToolbar": {
            "name": "bool",
            "required": false
          },
          "hasFastSearch": {
            "name": "bool",
            "description": "If true, search is applied as typed. If false, only after 'Enter' is pressed",
            "required": false
          },
          "hasFilter": {
            "name": "bool",
            "required": false
          },
          "hasSearch": {
            "name": "bool",
            "required": false
          },
          "hasColumnSelection": {
            "name": "bool",
            "required": false
          },
          "hasRowEdit": {
            "name": "bool",
            "required": false
          },
          "hasRowSelection": {
            "name": "enum",
            "value": [{
              "value": "'multi'",
              "computed": false
            }, {
              "value": "'single'",
              "computed": false
            }, {
              "value": "false",
              "computed": false
            }],
            "required": false
          },
          "onApplySearch": {
            "name": "func",
            "required": false
          },
          "onDownloadCSV": {
            "name": "func",
            "required": false
          },
          "onApplyAdvancedFilter": {
            "name": "func",
            "required": false
          },
          "hasRowCountInHeader": {
            "name": "custom",
            "raw": "deprecate(\n  PropTypes.bool,\n  '\\n The prop `hasRowCountInHeader` has been deprecated in favor `secondaryTitle`'\n)",
            "description": "Optional boolean to render rowCount in header\n NOTE: Deprecated in favor of secondaryTitle for custom use",
            "required": false
          },
          "hasUserViewManagement": {
            "name": "bool",
            "required": false
          }
        }
      },
      "required": true
    },
    "actions": {
      "description": "Action callbacks to update tableState",
      "type": {
        "name": "shape",
        "value": {
          "onCancelBatchAction": {
            "name": "func",
            "required": false
          },
          "onApplyBatchAction": {
            "name": "func",
            "required": false
          },
          "onClearAllFilters": {
            "name": "func",
            "required": false
          },
          "onToggleAggregations": {
            "name": "func",
            "required": false
          },
          "onToggleColumnSelection": {
            "name": "func",
            "required": false
          },
          "onToggleFilter": {
            "name": "func",
            "required": false
          },
          "onToggleAdvancedFilter": {
            "name": "func",
            "required": false
          },
          "onCreateAdvancedFilter": {
            "name": "func",
            "required": false
          },
          "onChangeAdvancedFilter": {
            "name": "func",
            "required": false
          },
          "onCancelAdvancedFilter": {
            "name": "func",
            "required": false
          },
          "onApplyAdvancedFilter": {
            "name": "func",
            "required": false
          },
          "onShowRowEdit": {
            "name": "func",
            "required": false
          },
          "onApplySearch": {
            "name": "func",
            "required": false
          },
          "onDownloadCSV": {
            "name": "func",
            "required": false
          },
          "onApplyToolbarAction": {
            "name": "func",
            "required": false
          },
          "onSearchExpand": {
            "name": "func",
            "required": false
          }
        }
      },
      "required": true
    },
    "tableState": {
      "description": "Inbound tableState",
      "type": {
        "name": "shape",
        "value": {
          "isDisabled": {
            "name": "bool",
            "description": "is the toolbar currently disabled",
            "required": false
          },
          "activeBar": {
            "name": "custom",
            "raw": "ActiveTableToolbarPropType",
            "description": "Which toolbar is currently active",
            "required": false
          },
          "totalSelected": {
            "name": "number",
            "description": "total number of selected rows",
            "required": false
          },
          "totalItemsCount": {
            "name": "number",
            "required": false
          },
          "advancedFilterFlyoutOpen": {
            "name": "bool",
            "required": false
          },
          "totalFilters": {
            "name": "number",
            "required": false
          },
          "filters": {
            "name": "custom",
            "raw": "TableFiltersPropType",
            "required": false
          },
          "columns": {
            "name": "custom",
            "raw": "TableColumnsPropTypes",
            "required": false
          },
          "ordering": {
            "name": "custom",
            "raw": "TableOrderingPropType",
            "required": false
          },
          "hasRowSelection": {
            "name": "enum",
            "value": [{
              "value": "'multi'",
              "computed": false
            }, {
              "value": "'single'",
              "computed": false
            }, {
              "value": "false",
              "computed": false
            }],
            "description": "row selection option",
            "required": false
          },
          "customToolbarContent": {
            "name": "node",
            "description": "optional content to render inside the toolbar",
            "required": false
          },
          "batchActions": {
            "name": "arrayOf",
            "value": {
              "name": "union",
              "value": [{
                "name": "shape",
                "value": {
                  "iconDescription": {
                    "name": "string",
                    "required": false
                  }
                }
              }, {
                "name": "shape",
                "value": {
                  "iconDescription": {
                    "name": "string",
                    "required": false
                  }
                }
              }]
            },
            "description": "available batch actions",
            "required": false
          },
          "search": {
            "name": "custom",
            "raw": "TableSearchPropTypes",
            "required": false
          },
          "rowEditBarButtons": {
            "name": "node",
            "description": "buttons to be shown with when activeBar is 'rowEdit'",
            "required": false
          },
          "advancedFilters": {
            "name": "arrayOf",
            "value": {
              "name": "shape",
              "value": {
                "filterId": {
                  "name": "string",
                  "description": "Unique id for particular filter",
                  "required": true
                },
                "filterTitleText": {
                  "name": "string",
                  "description": "Text for main title of page",
                  "required": true
                },
                "filterRules": {
                  "name": "custom",
                  "raw": "RuleGroupPropType.isRequired",
                  "required": true
                }
              }
            },
            "description": "a stripped down version of the RuleBuilderFilterPropType",
            "required": false
          },
          "selectedAdvancedFilterIds": {
            "name": "arrayOf",
            "value": {
              "name": "string"
            },
            "description": "currently selected advanced filters",
            "required": false
          },
          "toolbarActions": {
            "name": "custom",
            "raw": "TableToolbarActionsPropType",
            "description": "toolbar actions that can appear in an overflow menu in the toolbar (same menu as toggle aggregations)",
            "required": false
          },
          "hideClearAllFiltersButton": {
            "name": "bool",
            "description": "force hide Clear all filters button in toolbar",
            "required": false
          }
        }
      },
      "required": true
    },
    "data": {
      "description": "Row value data for the body of the table",
      "type": {
        "name": "custom",
        "raw": "TableRowsPropTypes.isRequired"
      },
      "required": false
    },
    "testID": {
      "description": "",
      "type": {
        "name": "custom",
        "raw": "deprecate(\n  PropTypes.string,\n  `The 'testID' prop has been deprecated. Please use 'testId' instead.`\n)"
      },
      "required": false
    }
  }
};
var TableToolbar$1 = TableToolbar;

module.exports = TableToolbar$1;
