import 'core-js/modules/es.symbol.js';
import 'core-js/modules/es.array.filter.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.to-string.js';
import 'core-js/modules/web.dom-collections.for-each.js';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import 'core-js/modules/es.array.map.js';
import 'core-js/modules/es.object.keys.js';
import React__default from 'react';
import PropTypes from 'prop-types';
import SimpleList from '../../List/SimpleList/SimpleList.js';
import { settings } from '../../../constants/Settings.js';
import { DASHBOARD_EDITOR_CARD_TYPES } from '../../../constants/LayoutConstants.js';
import LineGraphIcon from '../../../icons/components/LineGraphIcon.js';
import SimpleBarGraphIcon from '../../../icons/components/SimpleBarGraphIcon.js';
import BarGroupedGraphIcon from '../../../icons/components/BarGroupedGraphIcon.js';
import BarStackGraphIcon from '../../../icons/components/BarStackGraphIcon.js';
import ValueKpiIcon from '../../../icons/components/ValueKpiIcon.js';
import ImageIcon from '../../../icons/components/ImageIcon.js';
import DataTableIcon from '../../../icons/components/DataTableIcon.js';
import ListIcon from '../../../icons/components/ListIcon.js';
import CustomCardIcon from '../../../icons/components/CustomCardIcon.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 = {
  supportedCardTypes: PropTypes.arrayOf(PropTypes.string),
  onAddCard: PropTypes.func.isRequired,
  icons: PropTypes.objectOf(PropTypes.node),
  i18n: PropTypes.shape({
    galleryHeader: PropTypes.string,
    searchPlaceHolderText: PropTypes.string,
    TIMESERIES: PropTypes.string,
    SIMPLE_BAR: PropTypes.string,
    GROUPED_BAR: PropTypes.string,
    STACKED_BAR: PropTypes.string,
    VALUE: PropTypes.string,
    IMAGE: PropTypes.string,
    TABLE: PropTypes.string,
    LIST: PropTypes.string,
    CUSTOM: PropTypes.string
  }),
  testId: PropTypes.string
};
var defaultProps = {
  supportedCardTypes: Object.keys(DASHBOARD_EDITOR_CARD_TYPES),
  i18n: {
    galleryHeader: 'Gallery',
    searchPlaceHolderText: 'Enter a search',
    TIMESERIES: 'Time series line',
    SIMPLE_BAR: 'Simple bar',
    GROUPED_BAR: 'Grouped bar',
    STACKED_BAR: 'Stacked bar',
    VALUE: 'Value / KPI',
    IMAGE: 'Image',
    TABLE: 'Data table',
    LIST: 'List',
    CUSTOM: 'Custom'
    // additional card type names can be provided using the convention of `TYPE` in supportedCardTypes
  },
  icons: {
    TIMESERIES: /*#__PURE__*/React__default.createElement(LineGraphIcon, null),
    SIMPLE_BAR: /*#__PURE__*/React__default.createElement(SimpleBarGraphIcon, null),
    GROUPED_BAR: /*#__PURE__*/React__default.createElement(BarGroupedGraphIcon, null),
    STACKED_BAR: /*#__PURE__*/React__default.createElement(BarStackGraphIcon, null),
    VALUE: /*#__PURE__*/React__default.createElement(ValueKpiIcon, null),
    IMAGE: /*#__PURE__*/React__default.createElement(ImageIcon, null),
    TABLE: /*#__PURE__*/React__default.createElement(DataTableIcon, null),
    LIST: /*#__PURE__*/React__default.createElement(ListIcon, null),
    CUSTOM: /*#__PURE__*/React__default.createElement(CustomCardIcon, null)
  },
  testId: 'card-gallery-list'
};
var CardGalleryList = function CardGalleryList(_ref) {
  var supportedCardTypes = _ref.supportedCardTypes,
    onAddCard = _ref.onAddCard,
    icons = _ref.icons,
    i18n = _ref.i18n,
    testId = _ref.testId;
  var mergedI18n = _objectSpread(_objectSpread({}, defaultProps.i18n), i18n);
  var mergedIcons = _objectSpread(_objectSpread({}, defaultProps.icons), icons);
  return /*#__PURE__*/React__default.createElement(SimpleList, {
    testId: testId,
    title: "",
    isFullHeight: true,
    hasSearch: true,
    hasPagination: false,
    items: supportedCardTypes.map(function (cardType) {
      return {
        id: cardType,
        content: {
          value: mergedI18n[cardType] || cardType,
          icon: /*#__PURE__*/React__default.createElement("div", {
            className: "".concat(iotPrefix, "--card-gallery-list__icon")
          }, mergedIcons[cardType])
        },
        isSelectable: true
      };
    }),
    onSelect: function onSelect(cardType) {
      onAddCard(cardType);
    },
    i18n: {
      searchPlaceHolderText: mergedI18n.searchPlaceHolderText
    }
  });
};
CardGalleryList.defaultProps = defaultProps;
CardGalleryList.propTypes = propTypes;
CardGalleryList.__docgenInfo = {
  "description": "",
  "methods": [],
  "displayName": "CardGalleryList",
  "props": {
    "supportedCardTypes": {
      "defaultValue": {
        "value": "Object.keys(DASHBOARD_EDITOR_CARD_TYPES)",
        "computed": true
      },
      "description": "",
      "type": {
        "name": "arrayOf",
        "value": {
          "name": "string"
        }
      },
      "required": false
    },
    "i18n": {
      "defaultValue": {
        "value": "{\n  galleryHeader: 'Gallery',\n  searchPlaceHolderText: 'Enter a search',\n  TIMESERIES: 'Time series line',\n  SIMPLE_BAR: 'Simple bar',\n  GROUPED_BAR: 'Grouped bar',\n  STACKED_BAR: 'Stacked bar',\n  VALUE: 'Value / KPI',\n  IMAGE: 'Image',\n  TABLE: 'Data table',\n  LIST: 'List',\n  CUSTOM: 'Custom',\n  // additional card type names can be provided using the convention of `TYPE` in supportedCardTypes\n}",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "shape",
        "value": {
          "galleryHeader": {
            "name": "string",
            "required": false
          },
          "searchPlaceHolderText": {
            "name": "string",
            "required": false
          },
          "TIMESERIES": {
            "name": "string",
            "required": false
          },
          "SIMPLE_BAR": {
            "name": "string",
            "required": false
          },
          "GROUPED_BAR": {
            "name": "string",
            "required": false
          },
          "STACKED_BAR": {
            "name": "string",
            "required": false
          },
          "VALUE": {
            "name": "string",
            "required": false
          },
          "IMAGE": {
            "name": "string",
            "required": false
          },
          "TABLE": {
            "name": "string",
            "required": false
          },
          "LIST": {
            "name": "string",
            "required": false
          },
          "CUSTOM": {
            "name": "string",
            "required": false
          }
        }
      },
      "required": false
    },
    "icons": {
      "defaultValue": {
        "value": "{\n  TIMESERIES: <LineGraphIcon />,\n  SIMPLE_BAR: <SimpleBarGraphIcon />,\n  GROUPED_BAR: <BarGroupedGraphIcon />,\n  STACKED_BAR: <BarStackGraphIcon />,\n  VALUE: <ValueKpiIcon />,\n  IMAGE: <ImageIcon />,\n  TABLE: <DataTableIcon />,\n  LIST: <ListIcon />,\n  CUSTOM: <CustomCardIcon />,\n}",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "objectOf",
        "value": {
          "name": "node"
        }
      },
      "required": false
    },
    "testId": {
      "defaultValue": {
        "value": "'card-gallery-list'",
        "computed": false
      },
      "description": "",
      "type": {
        "name": "string"
      },
      "required": false
    },
    "onAddCard": {
      "description": "",
      "type": {
        "name": "func"
      },
      "required": true
    }
  }
};
var CardGalleryList$1 = CardGalleryList;

export { CardGalleryList$1 as default };
