import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import isNil from '../../node_modules/lodash-es/isNil.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.flat-map.js';
import 'core-js/modules/es.array.includes.js';
import 'core-js/modules/es.array.map.js';
import 'core-js/modules/es.array.unscopables.flat-map.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, { useCallback, useMemo, useState } from 'react';
import PropTypes from 'prop-types';
import warning from 'warning';
import HierarchyList from '../List/HierarchyList/HierarchyList.js';
import { settings } from '../../constants/Settings.js';
import Button from '../Button/Button.js';
import deprecate from '../../internal/deprecate.js';
import List from '../List/List.js';
import { ButtonIconPropType } from '../../constants/SharedPropTypes.js';
import { EditingStyle } from '../../utils/DragAndDropUtils.js';
import { ArrowRight, Reset, Subtract } from '@carbon/icons-react';

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 ListBuilderItemPropTypes = {
  /** the id of this item */
  id: PropTypes.string,
  content: PropTypes.shape({
    /** the value of this item */
    value: PropTypes.string,
    /**
     * a function that returns an array of elements to trigger actions if the list builder has complex structure or logic
     * otherwise, this will be populated by the ListBuilder as a simple add or remove button.
     */
    rowActions: PropTypes.func
  }),
  /** is this item disabled */
  disabled: PropTypes.bool,
  /** allows for groups or categories, see SelectUsersModal for a complex example */
  isCategory: PropTypes.bool,
  /** allows for groups or categories, see SelectUsersModal for a complex example */
  children: PropTypes.arrayOf(PropTypes.object)
};
var propTypes = {
  /** an array of the ids of the items in the "all list" that should be expanded  */
  allDefaultExpandedIds: 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,
  // TODO: remove deprecated testID in v3.
  // eslint-disable-next-line react/require-default-props
  testID: deprecate(PropTypes.string, "The 'testID' prop has been deprecated. Please use 'testId' instead."),
  testId: PropTypes.string,
  /** will increase the height of the list items to make to room for a secondary value */
  isLargeRow: PropTypes.bool,
  /** the list of all items available to select in the ListBuilder */
  items: PropTypes.arrayOf(PropTypes.shape(ListBuilderItemPropTypes)),
  /** current search value of the items search */
  itemsSearchValue: PropTypes.string,
  /** if the items contain children or groups, a proper count can be passed here. */
  itemCount: PropTypes.number,
  /** callback function returned before an item in the selected list is repositioned.
   * Returning false cancels the move */
  itemWillMove: PropTypes.func,
  /** the ids of locked items that cannot be reordered in the selected list */
  lockedIds: PropTypes.arrayOf(PropTypes.string),
  /** RowIds for rows currently loading more rows */
  loadingMoreIds: PropTypes.arrayOf(PropTypes.string),
  /** an array of all selected items */
  selectedItems: PropTypes.arrayOf(PropTypes.shape(ListBuilderItemPropTypes)),
  /** an array of the ids of the selected items that should be expanded  */
  selectedDefaultExpandedIds: PropTypes.arrayOf(PropTypes.string),
  /** (event, id) => void */
  onAdd: PropTypes.func,
  /** receives an updated array of the selected items after reordering */
  onSelectedListReordered: PropTypes.func,
  /** (event, id) => void */
  onRemove: PropTypes.func,
  /** Called when the items search value changes. Receives the latest value as a string.
   * Required when useCheckboxes is true */
  onItemsSearchChange: PropTypes.func,
  /** Called when the reset button is clicked */
  onReset: PropTypes.func,
  /** if true checkboxes will be used for selection so selected items can stay in the left list */
  useCheckboxes: PropTypes.bool,
  /** call back function for when load more row is clicked  (rowId) => {} */
  handleLoadMore: PropTypes.func,
  /** true if the items list should have search */
  hasItemsSearch: PropTypes.bool,
  /** true if the selected items list should have search */
  hasSelectedItemsSearch: PropTypes.bool,
  /** true if the reset button should be shown */
  hasReset: PropTypes.bool,
  i18n: PropTypes.shape({
    /** (count) => `Items (${count} available)` */
    allListTitle: PropTypes.func,
    /** (count) => `${count} items selected` */
    selectedListTitle: PropTypes.func,
    /** remove icons description on selected items */
    removeIconDescription: PropTypes.string,
    /** add aria label on unselected items */
    addLabel: PropTypes.string,
    /** placeholder text for the search box for all items */
    allListSearchPlaceholderText: PropTypes.string,
    /** placeholder text for the search box for selected items */
    selectedListSearchPlaceholderText: PropTypes.string,
    /** expand icon description when using nested groups */
    expandIconDescription: PropTypes.string,
    /** collapse icon description when using nested groups */
    collapseIconDescription: PropTypes.string,
    /** reset button label */
    resetLabel: PropTypes.string,
    /** label for the "Load more" button */
    loadMoreButtonLabel: PropTypes.string,
    /** message shown if the all items list is empty */
    allListEmptyText: PropTypes.string,
    /** message shown if selected list is empty */
    selectedListEmptyText: PropTypes.string,
    /** icon description label for the clear search icon */
    clearSearchIconDescription: PropTypes.string,
    expand: deprecate(PropTypes.string, "The 'expand' prop has been deprecated. Please use 'expandIconDescription' instead."),
    close: deprecate(PropTypes.string, "The 'close' prop has been deprecated. Please use 'collapseIconDescription' instead.")
  }),
  /** the icon used as button to remove items from the selected list */
  removeIcon: ButtonIconPropType,
  /** the editing style of the hirerchy list showing the selected items */
  selectedEditingStyle: PropTypes.oneOf([EditingStyle.Single, EditingStyle.SingleNesting]),
  /** if true the list for available columns will show a loader only */
  showLoaderInAvailableList: PropTypes.bool,
  /** if true the list for selected columns will show a loader only */
  showLoaderInSelectedList: PropTypes.bool
};
var defaultProps = {
  allDefaultExpandedIds: [],
  getAllowedDropIds: null,
  handleLoadMore: undefined,
  hasItemsSearch: true,
  hasSelectedItemsSearch: true,
  hasReset: false,
  testId: 'list-builder',
  isLargeRow: false,
  items: [],
  itemsSearchValue: null,
  itemCount: null,
  itemWillMove: function itemWillMove() {
    return true;
  },
  loadingMoreIds: [],
  lockedIds: [],
  selectedItems: [],
  selectedDefaultExpandedIds: [],
  onAdd: null,
  onSelectedListReordered: function onSelectedListReordered() {},
  onRemove: null,
  onReset: function onReset() {},
  onItemsSearchChange: null,
  i18n: {
    allListTitle: function allListTitle(count) {
      return "Items (".concat(count, " available)");
    },
    selectedListTitle: function selectedListTitle(count) {
      return "".concat(count, " Selected");
    },
    removeIconDescription: 'Remove item from list',
    addLabel: 'Add item to list',
    allListSearchPlaceholderText: 'Enter a value to search all items',
    selectedListSearchPlaceholderText: 'Enter a value to search selected items',
    expandIconDescription: 'Expand',
    collapseIconDescription: 'Collapse',
    resetLabel: 'Reset',
    loadMoreButtonLabel: 'Load more...'
  },
  useCheckboxes: false,
  removeIcon: Subtract,
  selectedEditingStyle: undefined,
  showLoaderInAvailableList: false,
  showLoaderInSelectedList: false
};
var getSelectedItemIds = function getSelectedItemIds(nestedSelectedItems) {
  return nestedSelectedItems.flatMap(function (selectedItem) {
    return selectedItem.isCategory ? getSelectedItemIds(selectedItem.children) : selectedItem.id;
  });
};
var getSelectedParentIds = function getSelectedParentIds(nestedSelectedItems, selectedChildIds, allListItems) {
  var parentsWithChildSelection = nestedSelectedItems.filter(function (item) {
    var _item$children;
    return item.isCategory && ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length);
  });
  return parentsWithChildSelection.flatMap(function (currentParent) {
    var originalParent = allListItems.find(function (_ref) {
      var id = _ref.id;
      return currentParent.id === id;
    });
    return originalParent.children.every(function (_ref2) {
      var id = _ref2.id;
      return selectedChildIds.includes(id);
    }) ? [currentParent.id] : [];
  });
};
var ListBuilder = function ListBuilder(_ref3) {
  var allDefaultExpandedIds = _ref3.allDefaultExpandedIds,
    getAllowedDropIds = _ref3.getAllowedDropIds,
    handleLoadMore = _ref3.handleLoadMore,
    hasItemsSearch = _ref3.hasItemsSearch,
    hasSelectedItemsSearch = _ref3.hasSelectedItemsSearch,
    hasReset = _ref3.hasReset,
    testID = _ref3.testID,
    testId = _ref3.testId,
    isLargeRow = _ref3.isLargeRow,
    items = _ref3.items,
    itemsSearchValue = _ref3.itemsSearchValue,
    itemCount = _ref3.itemCount,
    itemWillMove = _ref3.itemWillMove,
    loadingMoreIds = _ref3.loadingMoreIds,
    lockedIds = _ref3.lockedIds,
    selectedItems = _ref3.selectedItems,
    selectedDefaultExpandedIds = _ref3.selectedDefaultExpandedIds,
    i18n = _ref3.i18n,
    onAdd = _ref3.onAdd,
    onSelectedListReordered = _ref3.onSelectedListReordered,
    onRemove = _ref3.onRemove,
    onItemsSearchChange = _ref3.onItemsSearchChange,
    onReset = _ref3.onReset,
    useCheckboxes = _ref3.useCheckboxes,
    removeIcon = _ref3.removeIcon,
    selectedEditingStyle = _ref3.selectedEditingStyle,
    showLoaderInAvailableList = _ref3.showLoaderInAvailableList,
    showLoaderInSelectedList = _ref3.showLoaderInSelectedList;
  // When the checkbox design is used there are currently a few restrictions
  // and additional requirements
  if (useCheckboxes) {
    if (!onItemsSearchChange) {
      warning(false, 'The `onItemsSearchChange` prop must be provided when `useCheckboxes` is true.') ;
    }
  }
  var mergedI18n = _objectSpread(_objectSpread({}, defaultProps.i18n), i18n);
  var allListTitle = mergedI18n.allListTitle,
    selectedListTitle = mergedI18n.selectedListTitle,
    resetLabel = mergedI18n.resetLabel,
    allListEmptyText = mergedI18n.allListEmptyText,
    selectedListEmptyText = mergedI18n.selectedListEmptyText,
    clearSearchIconDescription = mergedI18n.clearSearchIconDescription;
  var handleAdd = useCallback(function (id) {
    return function (event) {
      event.persist();
      onAdd(event, id);
    };
  }, [onAdd]);
  var handleRemove = useCallback(function (id) {
    return function (event) {
      event.persist();
      onRemove(event, id);
    };
  }, [onRemove]);
  var allListItems = useMemo(function () {
    var _items$map;
    return (_items$map = items === null || items === void 0 ? void 0 : items.map(function (item) {
      var rowActions = !useCheckboxes ? item.content.rowActions !== undefined ? item.content.rowActions :
      // The "Select" button from the old design. New design uses checkboxes.
      function () {
        return [/*#__PURE__*/React__default.createElement(Button, {
          key: "".concat(item.id, "-list-item-button")
          // TODO: remove deprecated testID in v3.
          ,
          testId: "".concat(testID || testId, "-add-button-").concat(item.id),
          role: "button",
          "aria-label": mergedI18n.addLabel,
          renderIcon: ArrowRight,
          hasIconOnly: true,
          kind: "ghost",
          size: "sm",
          onClick: handleAdd(item.id),
          iconDescription: mergedI18n.addLabel
        })];
      } : undefined;
      return _objectSpread(_objectSpread({}, item), {}, {
        isSelectable: useCheckboxes ? item.hasOwnProperty('isSelectable') ? item.isSelectable : true : undefined,
        content: _objectSpread(_objectSpread({}, item.content), {}, {
          rowActions: rowActions
        })
      });
    })) !== null && _items$map !== void 0 ? _items$map : [];
  }, [handleAdd, items, mergedI18n.addLabel, testID, testId, useCheckboxes]);
  var filteredListItems = useMemo(function () {
    var lowerCaseSearchValue = typeof itemsSearchValue === 'string' && itemsSearchValue.toLowerCase();
    var isMatch = function isMatch(_ref4) {
      var id = _ref4.id,
        value = _ref4.content.value;
      return id.toLowerCase().includes(lowerCaseSearchValue) || value.toLowerCase().includes(lowerCaseSearchValue);
    };
    return useCheckboxes && !isNil(itemsSearchValue) && itemsSearchValue !== '' ? allListItems.flatMap(function (item) {
      var _item$children2;
      var directMatch = isMatch(item);
      var matchingChildren = ((_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.length) && item.children.filter(isMatch);
      var matchingItem = directMatch || matchingChildren !== null && matchingChildren !== void 0 && matchingChildren.length ? _objectSpread({}, item) : [];
      return matchingChildren !== null && matchingChildren !== void 0 && matchingChildren.length ? _objectSpread(_objectSpread({}, matchingItem), {}, {
        children: matchingChildren
      }) : matchingItem;
    }) : allListItems;
  }, [allListItems, itemsSearchValue, useCheckboxes]);
  var selectedListItems = useMemo(function () {
    var _selectedItems$map;
    var appendRemoveAction = function appendRemoveAction(item) {
      var rowActions = item.content.rowActions !== undefined ? item.content.rowActions : function () {
        return [/*#__PURE__*/React__default.createElement(Button, {
          key: "".concat(item.id, "-list-item-button")
          // TODO: remove deprecated testID in v3.
          ,
          testId: "".concat(testID || testId, "-remove-button-").concat(item.id),
          renderIcon: removeIcon,
          hasIconOnly: true,
          kind: "ghost",
          size: "sm",
          onClick: handleRemove(item.id),
          iconDescription: mergedI18n.removeIconDescription
        })];
      };
      var modifiedChildren = item.children ? item.children.map(function (child) {
        return appendRemoveAction(child);
      }) : undefined;
      return _objectSpread(_objectSpread({}, item), {}, {
        content: _objectSpread(_objectSpread({}, item.content), {}, {
          rowActions: rowActions
        })
      }, modifiedChildren ? {
        children: modifiedChildren
      } : {});
    };
    return (_selectedItems$map = selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map(function (item) {
      return appendRemoveAction(item);
    })) !== null && _selectedItems$map !== void 0 ? _selectedItems$map : [];
  }, [handleRemove, mergedI18n.removeIconDescription, selectedItems, testID, testId, removeIcon]);
  var flattenedSelectedIds = useMemo(function () {
    if (!useCheckboxes) return [];
    var selectedChildIds = getSelectedItemIds(selectedItems);
    var selectedParentIds = getSelectedParentIds(selectedItems, selectedChildIds, allListItems);
    return [].concat(_toConsumableArray(selectedChildIds), _toConsumableArray(selectedParentIds));
  }, [selectedItems, allListItems, useCheckboxes]);
  var indeterminateIds = useMemo(function () {
    if (!useCheckboxes) return [];
    return allListItems.filter(function (parent) {
      return parent.children && parent.children.some(function (sibling) {
        return flattenedSelectedIds.includes(sibling.id);
      }) && parent.children.some(function (sibling) {
        return !flattenedSelectedIds.includes(sibling.id);
      });
    }).map(function (parent) {
      return parent.id;
    });
  }, [allListItems, flattenedSelectedIds, useCheckboxes]);
  var _useState = useState(allDefaultExpandedIds),
    _useState2 = _slicedToArray(_useState, 2),
    checkboxListExpandedIds = _useState2[0],
    setCheckboxListExpandedIds = _useState2[1];
  var renderCheckboxList = function renderCheckboxList() {
    return /*#__PURE__*/React__default.createElement(List, {
      toggleExpansion: function toggleExpansion(id) {
        setCheckboxListExpandedIds(function (prev) {
          return prev.includes(id) ? prev.filter(function (expId) {
            return id !== expId;
          }) : [].concat(_toConsumableArray(prev), [id]);
        });
      },
      expandedIds: checkboxListExpandedIds,
      isLargeRow: isLargeRow,
      isLoading: showLoaderInAvailableList,
      indeterminateIds: indeterminateIds,
      emptyState: allListEmptyText,
      handleLoadMore: handleLoadMore,
      loadingMoreIds: loadingMoreIds,
      title: allListTitle(itemCount !== null && itemCount !== void 0 ? itemCount : allListItems.length),
      items: filteredListItems,
      isVirtualList: true,
      selectedIds: flattenedSelectedIds,
      isCheckboxMultiSelect: true,
      handleSelect: function handleSelect(id) {
        // Stay backwards compatible with the non-checkbox design where an event was
        // passed before the selected id
        return flattenedSelectedIds.find(function (selectedId) {
          return selectedId === id;
        }) ? onRemove(null, id) : onAdd(null, id);
      },
      search: hasItemsSearch ? {
        onChange: function onChange(evt) {
          onItemsSearchChange(evt.target.value, evt);
        }
      } : undefined,
      i18n: {
        clearSearchIconDescription: clearSearchIconDescription,
        searchPlaceHolderText: mergedI18n.allListSearchPlaceholderText,
        loadMore: mergedI18n.loadMoreButtonLabel
      }
    });
  };
  return /*#__PURE__*/React__default.createElement("div", {
    "data-testid": testID || testId,
    className: "".concat(iotPrefix, "--list-builder__container")
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "".concat(iotPrefix, "--list-builder__all")
    // TODO: remove deprecated testID in v3.
    ,
    "data-testid": "".concat(testID || testId, "__all")
  }, useCheckboxes ? renderCheckboxList() : /*#__PURE__*/React__default.createElement(HierarchyList, {
    defaultExpandedIds: allDefaultExpandedIds,
    isLargeRow: isLargeRow,
    isLoading: showLoaderInAvailableList,
    emptyState: allListEmptyText,
    title: allListTitle(itemCount !== null && itemCount !== void 0 ? itemCount : allListItems.length),
    items: allListItems,
    hasSearch: hasItemsSearch,
    hasPagination: false,
    searchId: "".concat(iotPrefix, "--list-builder__all--search"),
    i18n: {
      clearSearchIconDescription: clearSearchIconDescription,
      searchPlaceHolderText: mergedI18n.allListSearchPlaceholderText,
      expand: mergedI18n.expandIconDescription || mergedI18n.expand,
      close: mergedI18n.collapseIconDescription || mergedI18n.close
    }
  })), /*#__PURE__*/React__default.createElement("div", {
    className: "".concat(iotPrefix, "--list-builder__selected")
    // TODO: remove deprecated testID in v3.
    ,
    "data-testid": "".concat(testID || testId, "__selected")
  }, /*#__PURE__*/React__default.createElement(HierarchyList, {
    isLargeRow: isLargeRow,
    isLoading: showLoaderInSelectedList,
    emptyState: selectedListEmptyText,
    buttons: hasReset ? [/*#__PURE__*/React__default.createElement(Button, {
      className: "".concat(iotPrefix, "--list-builder__reset-button"),
      testId: "".concat(testId, "__selected__reset-button"),
      renderIcon: Reset,
      kind: "ghost",
      size: "sm",
      iconDescription: resetLabel,
      key: "hierarchy-list-button-add",
      onClick: onReset
    }, resetLabel)] : [],
    editingStyle: selectedEditingStyle,
    defaultExpandedIds: selectedDefaultExpandedIds,
    getAllowedDropIds: getAllowedDropIds,
    title: selectedListTitle(selectedListItems.length),
    items: selectedListItems,
    itemWillMove: itemWillMove,
    onListUpdated: onSelectedListReordered,
    lockedIds: lockedIds,
    hasSearch: hasSelectedItemsSearch,
    hasPagination: false,
    searchId: "".concat(iotPrefix, "--list-builder__selected--search"),
    i18n: {
      searchPlaceHolderText: mergedI18n.selectedListSearchPlaceholderText,
      expand: mergedI18n.expandIconDescription || mergedI18n.expand,
      close: mergedI18n.collapseIconDescription || mergedI18n.close
    }
  })));
};
ListBuilder.propTypes = propTypes;
ListBuilder.defaultProps = defaultProps;
ListBuilder.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "ListBuilder",
  "props": {
    "allDefaultExpandedIds": {
      "defaultValue": {
        "value": "[]",
        "computed": false
      },
      "description": "an array of the ids of the items in the \"all list\" that should be expanded",
      "type": {
        "name": "arrayOf",
        "value": {
          "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
    },
    "handleLoadMore": {
      "defaultValue": {
        "value": "undefined",
        "computed": true
      },
      "description": "call back function for when load more row is clicked  (rowId) => {}",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "hasItemsSearch": {
      "defaultValue": {
        "value": "true",
        "computed": false
      },
      "description": "true if the items list should have search",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "hasSelectedItemsSearch": {
      "defaultValue": {
        "value": "true",
        "computed": false
      },
      "description": "true if the selected items list should have search",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "hasReset": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "true if the reset button should be shown",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "testId": {
      "defaultValue": {
        "value": "'list-builder'",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "isLargeRow": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "will increase the height of the list items to make to room for a secondary value",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "items": {
      "defaultValue": {
        "value": "[]",
        "computed": false
      },
      "description": "the list of all items available to select in the ListBuilder",
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "shape",
          "value": {
            "id": {
              "name": "string",
              "description": "the id of this item",
              "required": false
            },
            "content": {
              "name": "shape",
              "value": {
                "value": {
                  "name": "string",
                  "description": "the value of this item",
                  "required": false
                },
                "rowActions": {
                  "name": "func",
                  "description": "a function that returns an array of elements to trigger actions if the list builder has complex structure or logic\notherwise, this will be populated by the ListBuilder as a simple add or remove button.",
                  "required": false
                }
              },
              "required": false
            },
            "disabled": {
              "name": "bool",
              "description": "is this item disabled",
              "required": false
            },
            "isCategory": {
              "name": "bool",
              "description": "allows for groups or categories, see SelectUsersModal for a complex example",
              "required": false
            },
            "children": {
              "name": "arrayOf",
              "value": {
                "name": "object"
              },
              "description": "allows for groups or categories, see SelectUsersModal for a complex example",
              "required": false
            }
          }
        }
      },
      "required": false
    },
    "itemsSearchValue": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "current search value of the items search",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "itemCount": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "if the items contain children or groups, a proper count can be passed here.",
      "type": {
        "name": "number"
      },
      "required": false
    },
    "itemWillMove": {
      "defaultValue": {
        "value": "() => true",
        "computed": false
      },
      "description": "callback function returned before an item in the selected list is repositioned.\nReturning false cancels the move",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "loadingMoreIds": {
      "defaultValue": {
        "value": "[]",
        "computed": false
      },
      "description": "RowIds for rows currently loading more rows",
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "string"
        }
      },
      "required": false
    },
    "lockedIds": {
      "defaultValue": {
        "value": "[]",
        "computed": false
      },
      "description": "the ids of locked items that cannot be reordered in the selected list",
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "string"
        }
      },
      "required": false
    },
    "selectedItems": {
      "defaultValue": {
        "value": "[]",
        "computed": false
      },
      "description": "an array of all selected items",
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "shape",
          "value": {
            "id": {
              "name": "string",
              "description": "the id of this item",
              "required": false
            },
            "content": {
              "name": "shape",
              "value": {
                "value": {
                  "name": "string",
                  "description": "the value of this item",
                  "required": false
                },
                "rowActions": {
                  "name": "func",
                  "description": "a function that returns an array of elements to trigger actions if the list builder has complex structure or logic\notherwise, this will be populated by the ListBuilder as a simple add or remove button.",
                  "required": false
                }
              },
              "required": false
            },
            "disabled": {
              "name": "bool",
              "description": "is this item disabled",
              "required": false
            },
            "isCategory": {
              "name": "bool",
              "description": "allows for groups or categories, see SelectUsersModal for a complex example",
              "required": false
            },
            "children": {
              "name": "arrayOf",
              "value": {
                "name": "object"
              },
              "description": "allows for groups or categories, see SelectUsersModal for a complex example",
              "required": false
            }
          }
        }
      },
      "required": false
    },
    "selectedDefaultExpandedIds": {
      "defaultValue": {
        "value": "[]",
        "computed": false
      },
      "description": "an array of the ids of the selected items that should be expanded",
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "string"
        }
      },
      "required": false
    },
    "onAdd": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "(event, id) => void",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "onSelectedListReordered": {
      "defaultValue": {
        "value": "() => {}",
        "computed": false
      },
      "description": "receives an updated array of the selected items after reordering",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "onRemove": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "(event, id) => void",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "onReset": {
      "defaultValue": {
        "value": "() => {}",
        "computed": false
      },
      "description": "Called when the reset button is clicked",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "onItemsSearchChange": {
      "defaultValue": {
        "value": "null",
        "computed": false
      },
      "description": "Called when the items search value changes. Receives the latest value as a string.\nRequired when useCheckboxes is true",
      "type": {
        "name": "func"
      },
      "required": false
    },
    "i18n": {
      "defaultValue": {
        "value": "{\n  allListTitle: (count) => {\n    return `Items (${count} available)`;\n  },\n  selectedListTitle: (count) => {\n    return `${count} Selected`;\n  },\n  removeIconDescription: 'Remove item from list',\n  addLabel: 'Add item to list',\n  allListSearchPlaceholderText: 'Enter a value to search all items',\n  selectedListSearchPlaceholderText: 'Enter a value to search selected items',\n  expandIconDescription: 'Expand',\n  collapseIconDescription: 'Collapse',\n  resetLabel: 'Reset',\n  loadMoreButtonLabel: 'Load more...',\n}",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "shape",
        "value": {
          "allListTitle": {
            "name": "func",
            "description": "(count) => `Items (${count} available)`",
            "required": false
          },
          "selectedListTitle": {
            "name": "func",
            "description": "(count) => `${count} items selected`",
            "required": false
          },
          "removeIconDescription": {
            "name": "string",
            "description": "remove icons description on selected items",
            "required": false
          },
          "addLabel": {
            "name": "string",
            "description": "add aria label on unselected items",
            "required": false
          },
          "allListSearchPlaceholderText": {
            "name": "string",
            "description": "placeholder text for the search box for all items",
            "required": false
          },
          "selectedListSearchPlaceholderText": {
            "name": "string",
            "description": "placeholder text for the search box for selected items",
            "required": false
          },
          "expandIconDescription": {
            "name": "string",
            "description": "expand icon description when using nested groups",
            "required": false
          },
          "collapseIconDescription": {
            "name": "string",
            "description": "collapse icon description when using nested groups",
            "required": false
          },
          "resetLabel": {
            "name": "string",
            "description": "reset button label",
            "required": false
          },
          "loadMoreButtonLabel": {
            "name": "string",
            "description": "label for the \"Load more\" button",
            "required": false
          },
          "allListEmptyText": {
            "name": "string",
            "description": "message shown if the all items list is empty",
            "required": false
          },
          "selectedListEmptyText": {
            "name": "string",
            "description": "message shown if selected list is empty",
            "required": false
          },
          "clearSearchIconDescription": {
            "name": "string",
            "description": "icon description label for the clear search icon",
            "required": false
          },
          "expand": {
            "name": "custom",
            "raw": "deprecate(\n  PropTypes.string,\n  `The 'expand' prop has been deprecated. Please use 'expandIconDescription' instead.`\n)",
            "required": false
          },
          "close": {
            "name": "custom",
            "raw": "deprecate(\n  PropTypes.string,\n  `The 'close' prop has been deprecated. Please use 'collapseIconDescription' instead.`\n)",
            "required": false
          }
        }
      },
      "required": false
    },
    "useCheckboxes": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "if true checkboxes will be used for selection so selected items can stay in the left list",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "removeIcon": {
      "defaultValue": {
        "value": "Subtract",
        "computed": true
      },
      "description": "the icon used as button to remove items from the selected list",
      "type": {
        "name": "custom",
        "raw": "ButtonIconPropType"
      },
      "required": false
    },
    "selectedEditingStyle": {
      "defaultValue": {
        "value": "undefined",
        "computed": true
      },
      "description": "the editing style of the hirerchy list showing the selected items",
      "type": {
        "name": "enum",
        "value": [{
          "value": "EditingStyle.Single",
          "computed": true
        }, {
          "value": "EditingStyle.SingleNesting",
          "computed": true
        }]
      },
      "required": false
    },
    "showLoaderInAvailableList": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "if true the list for available columns will show a loader only",
      "type": {
        "name": "bool"
      },
      "required": false
    },
    "showLoaderInSelectedList": {
      "defaultValue": {
        "value": "false",
        "computed": false
      },
      "description": "if true the list for selected columns will show a loader only",
      "type": {
        "name": "bool"
      },
      "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 ListBuilder$1 = ListBuilder;

export { ListBuilderItemPropTypes, ListBuilder$1 as default };
