"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Selectables = exports.Reorderables = exports.HoverableItems = exports.HoverableItemList = exports.Cards = exports.Basic = void 0;

var _react = _interopRequireWildcard(require("react"));

var _ItemList = _interopRequireDefault(require("./ItemList"));

var _Item = _interopRequireDefault(require("../Item"));

var _Icon = _interopRequireDefault(require("../Icon"));

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

// Copyright 1999-2021. Plesk International GmbH. All rights reserved.
const Basic = args => /*#__PURE__*/_react.default.createElement(_ItemList.default, args);

exports.Basic = Basic;
Basic.args = {
  minColumnWidth: 220,
  gap: 'md',
  children: [/*#__PURE__*/_react.default.createElement(_Item.default, {
    key: "1",
    value: "1",
    title: "Title 1",
    description: "Description 1",
    "data-test": "item1",
    icon: /*#__PURE__*/_react.default.createElement(_Icon.default, {
      name: "star-circle-filled",
      intent: "info"
    }),
    onClick: () => {}
  }, 'Content 1'), /*#__PURE__*/_react.default.createElement(_Item.default, {
    key: "2",
    value: "2",
    title: "Title 2",
    description: "Description 2",
    "data-test": "item2",
    icon: /*#__PURE__*/_react.default.createElement(_Icon.default, {
      name: "star-circle-filled",
      intent: "success"
    }),
    onClick: () => {}
  }, 'Content 2'), /*#__PURE__*/_react.default.createElement(_Item.default, {
    key: "3",
    value: "3",
    title: "Title 3",
    description: "Description 3",
    "data-test": "item3",
    icon: /*#__PURE__*/_react.default.createElement(_Icon.default, {
      name: "star-circle-filled",
      intent: "warning"
    }),
    onClick: () => {},
    hoverable: true
  }, 'Content 3'), /*#__PURE__*/_react.default.createElement(_Item.default, {
    key: "4",
    value: "4",
    title: "Title 4",
    description: "Description 4",
    "data-test": "item4",
    icon: /*#__PURE__*/_react.default.createElement(_Icon.default, {
      name: "star-circle-filled",
      intent: "danger"
    }),
    onClick: () => {},
    disabled: true,
    hoverable: true
  }, 'Content 4')]
};
const Cards = Basic.bind(null);
exports.Cards = Cards;
Cards.args = { ...Basic.args,
  children: Basic.args.children.map(child => {
    return child ? /*#__PURE__*/(0, _react.cloneElement)(child, {
      view: 'card',
      footer: `Footer ${child.props.value}`
    }) : null;
  })
};
const Reorderables = Basic.bind(null);
exports.Reorderables = Reorderables;
Reorderables.args = { ...Basic.args,
  reorderable: true
};
const Selectables = Basic.bind(null);
exports.Selectables = Selectables;
Selectables.args = { ...Basic.args,
  selectable: true,
  defaultValue: '2'
};
const HoverableItemList = Basic.bind(null);
exports.HoverableItemList = HoverableItemList;
HoverableItemList.args = { ...Basic.args,
  hoverable: true,
  defaultValue: '2',
  children: Basic.args.children.map((child, index) => {
    if (!child) {
      return null;
    }

    return /*#__PURE__*/(0, _react.cloneElement)(child, {
      hoverable: index === 0 ? false : undefined
    });
  })
};
const HoverableItems = Basic.bind(null);
exports.HoverableItems = HoverableItems;
HoverableItems.args = { ...Basic.args,
  hoverable: false,
  defaultValue: '2',
  children: Basic.args.children.map((child, index) => {
    if (!child) {
      return null;
    }

    return /*#__PURE__*/(0, _react.cloneElement)(child, {
      hoverable: index % 2 === 0
    });
  })
};