import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import isEqual from '../../../node_modules/lodash-es/isEqual.js';
import isNil from '../../../node_modules/lodash-es/isNil.js';
import debounce from '../../../node_modules/lodash-es/debounce.js';
import 'core-js/modules/es.symbol.js';
import 'core-js/modules/es.array.concat.js';
import 'core-js/modules/es.array.filter.js';
import 'core-js/modules/es.array.find.js';
import 'core-js/modules/es.array.includes.js';
import 'core-js/modules/es.array.slice.js';
import 'core-js/modules/es.number.is-nan.js';
import 'core-js/modules/es.object.get-own-property-descriptor.js';
import 'core-js/modules/es.object.get-own-property-descriptors.js';
import 'core-js/modules/es.object.keys.js';
import 'core-js/modules/es.object.to-string.js';
import 'core-js/modules/es.string.includes.js';
import 'core-js/modules/web.dom-collections.for-each.js';
import React__default, { useMemo, useState, useRef, useEffect, useCallback } from 'react';
import PropTypes from 'prop-types';
import scrollIntoView from 'scroll-into-view-if-needed';
import { caseInsensitiveSearch } from '../../../utils/componentUtilityFunctions.js';
import List from '../List.js';
import { ListItemPropTypes } from '../ListPropTypes.js';
import { EditingStyle, handleEditModeIndeterminateIds, DropLocation, handleEditModeSelect, moveItemsInList } from '../../../utils/DragAndDropUtils.js';
import { settings } from '../../../constants/Settings.js';
import { usePrevious } from '../../../hooks/usePrevious.js';
import HierarchyListReorderModal from './HierarchyListReorderModal/HierarchyListReorderModal.js';
import BulkActionHeader from './BulkActionHeader.js';

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(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.iotPrefix;
var propTypes = {
  /** list editing style */
  editingStyle: PropTypes.oneOf([EditingStyle.Single, EditingStyle.Multiple, EditingStyle.SingleNesting, EditingStyle.MultipleNesting]),
  /** an array of user controlled expanded ids */
  expandedIds: PropTypes.arrayOf(PropTypes.string),
  /** List heading */
  title: PropTypes.string,
  /** Determines whether the search function is enabled */
  hasSearch: PropTypes.bool,
  /** Determines whether the pagination should appear */
  hasPagination: PropTypes.bool,
  /** Determines if multi-select is enabled */
  hasMultiSelect: PropTypes.bool,
  /** Determines if items can be deselected, meaning once an item is selected,
   * it can only be deselected by selecting another item */
  hasDeselection: PropTypes.bool,
  /** optional prop to use a virtualized version of the list instead of rendering all items */
  isVirtualList: PropTypes.bool,
  /** Buttons to be presented in List header */
  buttons: PropTypes.arrayOf(PropTypes.node),
  /** ListItems to be displayed */
  items: PropTypes.arrayOf(PropTypes.shape(ListItemPropTypes)),
  /** Internationalization text */
  i18n: PropTypes.shape({
    /** Text displayed in search bar */
    searchPlaceHolderText: PropTypes.string,
    clearSearchIconDescription: PropTypes.string,
    expand: PropTypes.string,
    close: PropTypes.string,
    itemSelected: PropTypes.string,
    /** String e.g. '%d items selected' that gets %d replaced by selected count or
     * function receiving the selectedCount as param:
     * (selectedCount) => `${selectedCount} items selected` */
    itemsSelected: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
    move: PropTypes.string,
    cancel: PropTypes.string,
    allRows: PropTypes.string,
    modalTitle: PropTypes.string,
    modalDescription: PropTypes.string,
    itemTitle: PropTypes.string,
    /** String e.g. 'Move %d items underneath' that gets %d replaced by items count or
     * function receiving the selectedCount as param:
     * (itemsCount) => `Move ${itemsCount} items underneath` */
    itemsTitle: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
  }),
  /** Displays the List as full height */
  isFullHeight: PropTypes.bool,
  /** optional skeleton to be rendered while loading data */
  isLoading: PropTypes.bool,
  /** optionally makings each list item a large / fat row */
  isLargeRow: PropTypes.bool,
  /** the ids of locked items that cannot be reordered */
  lockedIds: PropTypes.arrayOf(PropTypes.string),
  /** Determines the number of rows per page */
  pageSize: PropTypes.string,
  /** Item id to be pre-selected */
  defaultSelectedId: PropTypes.string,
  /** Item ids to be pre-expanded */
  defaultExpandedIds: PropTypes.arrayOf(PropTypes.string),
  /** callback used to limit which items that should get drop targets rendered.
   * receives the id of the item that is being dragged and returns a list of ids. */
  getAllowedDropIds: PropTypes.func,
  /** a callback used to notify when the expanded items in the list change. */
  onExpandedChange: PropTypes.func,
  /** Optional function to be called when item is selected */
  onSelect: PropTypes.func,
  /** callback function returned a modified list */
  onListUpdated: PropTypes.func,
  /** callback function returned before a list is modified */
  itemWillMove: PropTypes.func,
  /** callback function to exit edit mode */
  cancelMoveClicked: PropTypes.func,
  /**  Is data currently being sent to the backend */
  sendingData: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
  /** optional classname to be passed to the dom element */
  className: PropTypes.string,
  /** an optional id string passed to the list search field */
  searchId: PropTypes.string,
  /** content shown if list is empty */
  emptyState: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
  /** content shown if list is empty on search */
  emptySearchState: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
  /** enables horizontal scrollbar to appear if content is wider then container */
  enableHorizontalScrollbar: PropTypes.bool
};
var defaultProps = {
  editingStyle: null,
  expandedIds: [],
  title: null,
  hasSearch: false,
  hasPagination: true,
  hasMultiSelect: false,
  hasDeselection: true,
  buttons: null,
  i18n: {
    searchPlaceHolderText: 'Enter a value',
    expand: 'Expand',
    close: 'Close',
    itemSelected: '1 item selected',
    itemsSelected: function itemsSelected(selectedCount) {
      return "".concat(selectedCount, " items selected");
    },
    move: 'Move',
    cancel: 'Cancel',
    allRows: 'All rows',
    itemTitle: 'Move 1 item underneath',
    itemsTitle: function itemsTitle(itemsCount) {
      return "Move ".concat(itemsCount, " items underneath");
    },
    modalDescription: 'Select a destination'
  },
  isFullHeight: false,
  isLoading: false,
  isLargeRow: false,
  isVirtualList: false,
  lockedIds: [],
  pageSize: null,
  defaultSelectedId: null,
  defaultExpandedIds: [],
  onSelect: null,
  sendingData: null,
  getAllowedDropIds: null,
  onListUpdated: function onListUpdated() {},
  cancelMoveClicked: function cancelMoveClicked() {},
  onExpandedChange: function onExpandedChange() {},
  itemWillMove: function itemWillMove() {
    return true;
  },
  className: null,
  items: [],
  searchId: null,
  emptyState: 'No list items to show',
  emptySearchState: 'No results found',
  enableHorizontalScrollbar: false
};

/**
 * Assumes that the first level of items is not searchable and is only uses to categorize the
 * items. Because of that, only search through the children. If a child is found while filtering,
 * it needs to be returned to the filtered array. Deep clone is required because spread syntax is
 * only a shallow clone
 * @param {Array<Object>} items
 * @param {String} value what to search for
 * @returns {Array<Object>}
 */
var searchForNestedItemValues = function searchForNestedItemValues(items, value) {
  var filteredItems = [];
  items.forEach(function (item) {
    // if the item has children, recurse and search children
    if (item.children) {
      // if the parent matches the search then add the parent and all children
      if (caseInsensitiveSearch([item.content.value], value)) {
        filteredItems.push(item);
      } else {
        var matchingChildren = searchForNestedItemValues(item.children, value);
        // if it's children did, we still need the item
        if (matchingChildren.length > 0) {
          filteredItems.push(_objectSpread(_objectSpread({}, item), {}, {
            children: matchingChildren
          }));
        }
      }
    } // if the item matches, add it to the filterItems array
    else if (!isNil(item.content.secondaryValue) && typeof item.content.secondaryValue === 'string' && caseInsensitiveSearch([item.content.value, item.content.secondaryValue], value)) {
      filteredItems.push(item);
    } else if (caseInsensitiveSearch([item.content.value], value)) {
      filteredItems.push(item);
    }
  });
  return filteredItems;
};

/**
 * Assumes that the first level of items is not searchable and is only uses to categorize the
 * items. Because of that, only search through the children. If a child is found while filtering,
 * it needs to be returned to the filtered array. Deep clone is required because spread syntax is
 * only a shallow clone
 * @param {Array<Object>} items
 * @param {String} value what to search for
 * @returns {Array<Object>}
 */
var searchForNestedItemIds = function searchForNestedItemIds(items, value) {
  var filteredItems = [];
  items.forEach(function (item) {
    // if the item has children, recurse and search children
    if (item.children) {
      var matchingChildren = searchForNestedItemIds(item.children, value);
      // if it's children did, we still need the item
      if (matchingChildren.length > 0) {
        filteredItems.push(_objectSpread(_objectSpread({}, item), {}, {
          children: matchingChildren
        }));
      }
    } // if the item matches, add it to the filterItems array
    else if (item.id === value) {
      filteredItems.push(item);
    }
  });
  return filteredItems;
};
var reduceItems = function reduceItems(items) {
  return items.reduce(function (carry, _ref) {
    var id = _ref.id,
      children = _ref.children;
    return [].concat(_toConsumableArray(carry), [{
      id: id,
      children: children ? reduceItems(children) : undefined
    }]);
  }, []);
};
var HierarchyList = function HierarchyList(_ref2) {
  var editingStyle = _ref2.editingStyle,
    expandedIdsProp = _ref2.expandedIds,
    title = _ref2.title,
    hasSearch = _ref2.hasSearch,
    hasPagination = _ref2.hasPagination,
    hasMultiSelect = _ref2.hasMultiSelect,
    hasDeselection = _ref2.hasDeselection,
    buttons = _ref2.buttons,
    items = _ref2.items,
    i18n = _ref2.i18n,
    isFullHeight = _ref2.isFullHeight,
    isLoading = _ref2.isLoading,
    isLargeRow = _ref2.isLargeRow,
    isVirtualList = _ref2.isVirtualList,
    lockedIds = _ref2.lockedIds,
    pageSize = _ref2.pageSize,
    defaultSelectedId = _ref2.defaultSelectedId,
    defaultExpandedIds = _ref2.defaultExpandedIds,
    getAllowedDropIds = _ref2.getAllowedDropIds,
    onExpandedChange = _ref2.onExpandedChange,
    onSelect = _ref2.onSelect,
    onListUpdated = _ref2.onListUpdated,
    itemWillMove = _ref2.itemWillMove,
    cancelMoveClicked = _ref2.cancelMoveClicked,
    sendingData = _ref2.sendingData,
    className = _ref2.className,
    searchId = _ref2.searchId,
    emptyState = _ref2.emptyState,
    emptySearchState = _ref2.emptySearchState,
    enableHorizontalScrollbar = _ref2.enableHorizontalScrollbar;
  var mergedI18n = useMemo(function () {
    return _objectSpread(_objectSpread({}, defaultProps.i18n), i18n);
  }, [i18n]);
  var initialExpandedIds = (expandedIdsProp === null || expandedIdsProp === void 0 ? void 0 : expandedIdsProp.length) > 0 ? expandedIdsProp : defaultExpandedIds;
  var _useState = useState(initialExpandedIds),
    _useState2 = _slicedToArray(_useState, 2),
    expandedIds = _useState2[0],
    setExpandedIds = _useState2[1];
  var _useState3 = useState(''),
    _useState4 = _slicedToArray(_useState3, 2),
    searchValue = _useState4[0],
    setSearchValue = _useState4[1];
  var _useState5 = useState(items),
    _useState6 = _slicedToArray(_useState5, 2),
    filteredItems = _useState6[0],
    setFilteredItems = _useState6[1];
  var _useState7 = useState(1),
    _useState8 = _slicedToArray(_useState7, 2),
    currentPageNumber = _useState8[0],
    setCurrentPageNumber = _useState8[1];
  var _useState9 = useState([]),
    _useState10 = _slicedToArray(_useState9, 2),
    selectedIds = _useState10[0],
    setSelectedIds = _useState10[1];
  var _useState11 = useState([]),
    _useState12 = _slicedToArray(_useState11, 2),
    editModeSelectedIds = _useState12[0],
    setEditModeSelectedIds = _useState12[1];
  var _useState13 = useState(false),
    _useState14 = _slicedToArray(_useState13, 2),
    showModal = _useState14[0],
    setShowModal = _useState14[1];
  var isFirstRender = useRef(true);
  var _useState15 = useState([]),
    _useState16 = _slicedToArray(_useState15, 2),
    indeterminateIds = _useState16[0],
    setIndeterminateIds = _useState16[1];

  // these are used in filtering, and since items may contain nodes or react elements
  // we don't want to do equality checks against those, so we strip the items down to
  // the basics need for filtering checks and memoize them for use in the useEffect below
  var itemsStrippedOfNodeElements = useMemo(function () {
    return reduceItems(items);
  }, [items]);
  var previousItems = usePrevious(items);
  var previousExpandedIds = usePrevious(expandedIds);
  useEffect(function () {
    if (!isEqual(items, previousItems)) {
      setFilteredItems(items);
      setSearchValue('');
      setCurrentPageNumber(1);
    }
  }, [items, previousItems]);

  /**
   * Effect to change the currently expanded hierarchies. Ignore it on the first render to allow
   * defaultExpandedIds to work, but fire it on all other changes
   */
  useEffect(function () {
    if (!isFirstRender.current) {
      setExpandedIds(expandedIdsProp);
    }
    isFirstRender.current = false;
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [expandedIdsProp]);

  /**
   * effect to trigger calling the onExpandedChange callback. Ignore it on the initial render
   * when previousExpandedIds is undefined, but fire it on every change afterward when using a
   * virtualList. The regular list triggers the onExpandedChange callback in the handleAfterExpand
   * function below.
   */
  useEffect(function () {
    if (previousExpandedIds !== undefined && !isEqual(previousExpandedIds, expandedIds) && isVirtualList) {
      onExpandedChange(expandedIds);
    }
  }, [expandedIds, isVirtualList, onExpandedChange, previousExpandedIds]);

  /**
   * Effect to handle indeterminate state for parent checkboxes. If we're in an editMode and
   * the selected ids changes, fire this effect to determine the currently indeterminate ids
   * in the list.
   */
  useEffect(function () {
    if (editingStyle) {
      setIndeterminateIds(handleEditModeIndeterminateIds(items, editModeSelectedIds));
    }
  }, [editModeSelectedIds, editingStyle, items]);
  var selectedItemRef = useCallback(function (node) {
    if (node && node.parentNode && !isVirtualList) {
      scrollIntoView(node.parentNode, {
        scrollMode: 'if-needed',
        block: 'nearest',
        inline: 'nearest'
      });
    }
  }, [isVirtualList]);
  var setSelected = function setSelected(id) {
    var parentId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
    if (editingStyle) {
      setEditModeSelectedIds(handleEditModeSelect(items, editModeSelectedIds, id, parentId, lockedIds));
    } else if (selectedIds.includes(id) && hasDeselection) {
      setSelectedIds(selectedIds.filter(function (item) {
        return item !== id;
      }));
      // else, no-op because the item can't be deselected
    } else if (hasMultiSelect) {
      setSelectedIds([].concat(_toConsumableArray(selectedIds), [id]));
    } else {
      setSelectedIds([id]);
    }
  };
  var handleSelect = function handleSelect(id) {
    var parentId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
    setSelected(id, parentId);

    // only select if the item is not already selected
    if (onSelect && (!selectedIds.includes(id) || hasDeselection)) {
      onSelect(id);
    }
  };
  var handleBulkModalCancel = function handleBulkModalCancel() {
    setEditModeSelectedIds([]);
    cancelMoveClicked();
  };
  useEffect(function () {
    // Expand the parent elements of the defaultSelectedId
    if (defaultSelectedId) {
      var tempFilteredItems = searchForNestedItemIds(itemsStrippedOfNodeElements, defaultSelectedId);
      var tempExpandedIds = _toConsumableArray(expandedIds);
      // Expand the categories that have found results
      tempFilteredItems.forEach(function (categoryItem) {
        tempExpandedIds.push(categoryItem.id);
      });
      setExpandedIds(tempExpandedIds);
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [defaultSelectedId, itemsStrippedOfNodeElements]);
  useEffect(function () {
    // If the defaultSelectedId prop is updated from the outside, we need to use it
    setSelected(defaultSelectedId);
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [defaultSelectedId]);
  var numberOfItems = filteredItems.length;
  var rowsPerPage;
  switch (pageSize) {
    case 'sm':
      rowsPerPage = 5;
      break;
    case 'lg':
      rowsPerPage = 10;
      break;
    case 'xl':
      rowsPerPage = 20;
      break;
    default:
      rowsPerPage = numberOfItems;
  }
  var _useState17 = useState(filteredItems.slice(0, rowsPerPage)),
    _useState18 = _slicedToArray(_useState17, 2),
    itemsToShow = _useState18[0],
    setItemsToShow = _useState18[1];

  // Needed for updates to the filteredItems state on pageSize change
  useEffect(function () {
    var startIndex = (currentPageNumber - 1) * rowsPerPage;
    setItemsToShow(filteredItems.slice(startIndex, startIndex + rowsPerPage));
  }, [currentPageNumber, filteredItems, rowsPerPage]);
  var maxPage = !Number.isNaN(Math.ceil(numberOfItems / rowsPerPage)) ? Math.ceil(numberOfItems / rowsPerPage) : 1;
  var onPage = useCallback(function (page) {
    var rowUpperLimit = page * rowsPerPage;
    var currentItemsOnPage = filteredItems.slice(rowUpperLimit - rowsPerPage, rowUpperLimit);
    setCurrentPageNumber(page);
    setItemsToShow(currentItemsOnPage);
  }, [filteredItems, rowsPerPage]);

  /**
   * If we were on a higher page and the number of items drop, we need to ensure we
   * reset to the first page when the number of items drops below our previous max page.
   */
  useEffect(function () {
    if (currentPageNumber > maxPage) {
      onPage(1);
    } else {
      onPage(currentPageNumber);
    }
  }, [currentPageNumber, maxPage, onPage, pageSize]);
  var pagination = {
    page: currentPageNumber,
    onPage: onPage,
    maxPage: maxPage,
    pageOfPagesText: function pageOfPagesText(page) {
      return "Page ".concat(page);
    }
  };

  /**
   * Once the array is finished, the category needs to be expanded to show
   * the found results and the filter children array needs to be added to
   * the total filtered array. The next category's children then needs to
   * be searched in the same fashion.
   * @param {String} text keyed values from search input
   * @param {Array} searchItems the current state of items. Used to maintain state when the list
   *     is updated (drag and drop) and there's a current search value
   */
  var handleSearch = function handleSearch(text, searchItems) {
    var tempFilteredItems = searchForNestedItemValues(searchItems, text);
    var tempExpandedIds = [];
    // Expand the categories that have found results
    tempFilteredItems.forEach(function (categoryItem) {
      tempExpandedIds.push(categoryItem.id);
    });
    setExpandedIds(tempExpandedIds);
    setFilteredItems(tempFilteredItems);
    if (pageSize !== null) {
      setItemsToShow(tempFilteredItems.slice(0, rowsPerPage));
    }
  };

  /**
   * Searching the nested items array is computationally expensive so delay the
   * search by 150ms which is a reasonable amount of time for a single word to
   * be typed.
   */
  var delayedSearch = useCallback(debounce(function (textInput) {
    return handleSearch(textInput, items);
  }, 150), [items]);
  var handleMove = function handleMove(dragIds, hoverId, target) {
    var updatedList = moveItemsInList(items, dragIds, hoverId, target);
    onListUpdated(updatedList);
    setFilteredItems(updatedList);
    if (searchValue) {
      handleSearch(searchValue, updatedList);
    }
  };
  var handleDrag = function handleDrag(dragId, hoverId, target) {
    if (editModeSelectedIds.length > 0 && editModeSelectedIds.find(function (selectionId) {
      return selectionId === dragId;
    })) {
      handleMove(editModeSelectedIds, hoverId, target);
    } else {
      handleMove([dragId], hoverId, target);
    }
  };
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, editingStyle === EditingStyle.MultipleNesting && editModeSelectedIds.length > 0 ? /*#__PURE__*/React__default.createElement(HierarchyListReorderModal, {
    open: showModal,
    items: items,
    selectedIds: editModeSelectedIds,
    i18n: mergedI18n,
    onClose: function onClose() {
      setShowModal(false);
    },
    onSubmit: function onSubmit(dropId) {
      if (dropId !== null) {
        handleMove(editModeSelectedIds, dropId, DropLocation.Nested);
      }
      setShowModal(false);
    },
    sendingData: sendingData
  }) : null, /*#__PURE__*/React__default.createElement(List, {
    title: title,
    buttons: buttons,
    editingStyle: editingStyle,
    search: hasSearch ? {
      id: searchId,
      value: searchValue,
      onChange: function onChange(evt) {
        setSearchValue(evt.target.value);
        delayedSearch(evt.target.value);
      }
    } : null,
    items: pageSize !== null ? itemsToShow : filteredItems,
    expandedIds: expandedIds,
    toggleExpansion: function toggleExpansion(id) {
      if (expandedIds.filter(function (rowId) {
        return rowId === id;
      }).length > 0) {
        // remove id from array
        setExpandedIds(expandedIds.filter(function (rowId) {
          return rowId !== id;
        }));
      } else {
        setExpandedIds(expandedIds.concat([id]));
      }
    },
    overrides: {
      header: {
        component: editingStyle === EditingStyle.MultipleNesting && editModeSelectedIds.length > 0 ? BulkActionHeader : null,
        props: {
          mergedI18n: mergedI18n,
          editModeSelectedIds: editModeSelectedIds,
          cancelMoveClicked: handleBulkModalCancel,
          setShowModal: setShowModal,
          className: "".concat(iotPrefix, "--hierarchy-list-bulk-header")
        }
      }
    },
    i18n: mergedI18n,
    pagination: hasPagination ? pagination : null,
    indeterminateIds: indeterminateIds,
    isFiltering: !!searchValue,
    isFullHeight: isFullHeight,
    isLoading: isLoading,
    isLargeRow: isLargeRow,
    isVirtualList: isVirtualList,
    itemWillMove: itemWillMove,
    lockedIds: lockedIds,
    selectedIds: editingStyle ? editModeSelectedIds : selectedIds,
    getAllowedDropIds: getAllowedDropIds,
    handleSelect: handleSelect,
    ref: selectedItemRef,
    onItemMoved: handleDrag,
    className: className,
    emptyState: emptyState,
    emptySearchState: emptySearchState,
    onExpandedChange: onExpandedChange,
    enableHorizontalScrollbar: enableHorizontalScrollbar
  }));
};
HierarchyList.propTypes = propTypes;
HierarchyList.defaultProps = defaultProps;
HierarchyList.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "HierarchyList",
  "props": {
    "editingStyle": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "list editing style",
      "type": {
        "name": "enum",
        "value": [{
          "value": "EditingStyle.Single",
          "computed": true
        }, {
          "value": "EditingStyle.Multiple",
          "computed": true
        }, {
          "value": "EditingStyle.SingleNesting",
          "computed": true
        }, {
          "value": "EditingStyle.MultipleNesting",
          "computed": true
        }]
      },
      "required": false
    },
    "expandedIds": {
      "defaultValue": {
        "value": "[]",
        "computed": false
      },
      "description": "an array of user controlled expanded ids",
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "string"
        }
      },
      "required": false
    },
    "title": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "List heading",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "hasSearch": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "Determines whether the search function is enabled",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "hasPagination": {
      "defaultValue": {
        "value": "true",
        "computed": false
      },
      "description": "Determines whether the pagination should appear",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "hasMultiSelect": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "Determines if multi-select is enabled",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "hasDeselection": {
      "defaultValue": {
        "value": "true",
        "computed": false
      },
      "description": "Determines if items can be deselected, meaning once an item is selected,\nit can only be deselected by selecting another item",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "buttons": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "Buttons to be presented in List header",
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "node"
        }
      },
      "required": false
    },
    "i18n": {
      "defaultValue": {
        "value": "{\n  searchPlaceHolderText: 'Enter a value',\n  expand: 'Expand',\n  close: 'Close',\n  itemSelected: '1 item selected',\n  itemsSelected: (selectedCount) => `${selectedCount} items selected`,\n  move: 'Move',\n  cancel: 'Cancel',\n  allRows: 'All rows',\n  itemTitle: 'Move 1 item underneath',\n  itemsTitle: (itemsCount) => `Move ${itemsCount} items underneath`,\n  modalDescription: 'Select a destination',\n}",
        "computed": false
      },
      "description": "Internationalization text",
      "type": {
        "name": "shape",
        "value": {
          "searchPlaceHolderText": {
            "name": "string",
            "description": "Text displayed in search bar",
            "required": false
          },
          "clearSearchIconDescription": {
            "name": "string",
            "required": false
          },
          "expand": {
            "name": "string",
            "required": false
          },
          "close": {
            "name": "string",
            "required": false
          },
          "itemSelected": {
            "name": "string",
            "required": false
          },
          "itemsSelected": {
            "name": "union",
            "value": [{
              "name": "func"
            }, {
              "name": "string"
            }],
            "description": "String e.g. '%d items selected' that gets %d replaced by selected count or\nfunction receiving the selectedCount as param:\n(selectedCount) => `${selectedCount} items selected`",
            "required": false
          },
          "move": {
            "name": "string",
            "required": false
          },
          "cancel": {
            "name": "string",
            "required": false
          },
          "allRows": {
            "name": "string",
            "required": false
          },
          "modalTitle": {
            "name": "string",
            "required": false
          },
          "modalDescription": {
            "name": "string",
            "required": false
          },
          "itemTitle": {
            "name": "string",
            "required": false
          },
          "itemsTitle": {
            "name": "union",
            "value": [{
              "name": "func"
            }, {
              "name": "string"
            }],
            "description": "String e.g. 'Move %d items underneath' that gets %d replaced by items count or\nfunction receiving the selectedCount as param:\n(itemsCount) => `Move ${itemsCount} items underneath`",
            "required": false
          }
        }
      },
      "required": false
    },
    "isFullHeight": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "Displays the List as full height",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "isLoading": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "optional skeleton to be rendered while loading data",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "isLargeRow": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "optionally makings each list item a large / fat row",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "isVirtualList": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "optional prop to use a virtualized version of the list instead of rendering all items",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "lockedIds": {
      "defaultValue": {
        "value": "[]",
        "computed": false
      },
      "description": "the ids of locked items that cannot be reordered",
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "string"
        }
      },
      "required": false
    },
    "pageSize": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "Determines the number of rows per page",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "defaultSelectedId": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "Item id to be pre-selected",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "defaultExpandedIds": {
      "defaultValue": {
        "value": "[]",
        "computed": false
      },
      "description": "Item ids to be pre-expanded",
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "string"
        }
      },
      "required": false
    },
    "onSelect": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "Optional function to be called when item is selected",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "sendingData": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "Is data currently being sent to the backend",
      "type": {
        "name": "union",
        "value": [{
          "name": "bool"
        }, {
          "name": "string"
        }]
      },
      "required": false
    },
    "getAllowedDropIds": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "callback used to limit which items that should get drop targets rendered.\nreceives the id of the item that is being dragged and returns a list of ids.",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "onListUpdated": {
      "defaultValue": {
        "value": "() => {}",
        "computed": false
      },
      "description": "callback function returned a modified list",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "cancelMoveClicked": {
      "defaultValue": {
        "value": "() => {}",
        "computed": false
      },
      "description": "callback function to exit edit mode",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "onExpandedChange": {
      "defaultValue": {
        "value": "() => {}",
        "computed": false
      },
      "description": "a callback used to notify when the expanded items in the list change.",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "itemWillMove": {
      "defaultValue": {
        "value": "() => true",
        "computed": false
      },
      "description": "callback function returned before a list is modified",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "className": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "optional classname to be passed to the dom element",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "items": {
      "defaultValue": {
        "value": "[]",
        "computed": false
      },
      "description": "ListItems to be displayed",
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "shape",
          "value": "import { ListItemPropTypes } from '../ListPropTypes';",
          "computed": true
        }
      },
      "required": false
    },
    "searchId": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "an optional id string passed to the list search field",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "emptyState": {
      "defaultValue": {
        "value": "'No list items to show'",
        "computed": false
      },
      "description": "content shown if list is empty",
      "type": {
        "name": "union",
        "value": [{
          "name": "node"
        }, {
          "name": "string"
        }]
      },
      "required": false
    },
    "emptySearchState": {
      "defaultValue": {
        "value": "'No results found'",
        "computed": false
      },
      "description": "content shown if list is empty on search",
      "type": {
        "name": "union",
        "value": [{
          "name": "node"
        }, {
          "name": "string"
        }]
      },
      "required": false
    },
    "enableHorizontalScrollbar": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "enables horizontal scrollbar to appear if content is wider then container",
      "type": {
        "name": "bool"
      },
      "required": false
    }
  }
};
var HierarchyList$1 = HierarchyList;

export { HierarchyList$1 as default, searchForNestedItemIds, searchForNestedItemValues };
