"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.Sizes = exports.DifferentPopupLenghts = exports.Default = void 0;

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

var SelectMenuStories = _interopRequireWildcard(require("./SelectMenu.stories.mdx"));

var _utils = require("../../chromatic/utils");

var _SelectMenu = _interopRequireWildcard(require("./SelectMenu"));

var _Text = _interopRequireDefault(require("../text/Text"));

var _Flex = _interopRequireDefault(require("../flex/Flex"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(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; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

var onOptionChange = function onOptionChange() {
  return null;
};

var Sizes = function Sizes(args) {
  return /*#__PURE__*/React.createElement("div", {
    style: {
      display: 'flex',
      flexDirection: 'row'
    }
  }, Object.values(_SelectMenu.SIZE).map(function (size) {
    return /*#__PURE__*/React.createElement("div", {
      style: {
        width: '200px'
      },
      key: size
    }, /*#__PURE__*/React.createElement(_SelectMenu.default, _extends({}, args, {
      defaultExpanded: true,
      size: size,
      onOptionChange: onOptionChange
    })));
  }));
};

exports.Sizes = Sizes;

var DifferentPopupLenghts = function DifferentPopupLenghts(args) {
  return /*#__PURE__*/React.createElement(_Flex.default, {
    direction: "row",
    style: {
      gap: '40px'
    }
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      width: '320px'
    }
  }, /*#__PURE__*/React.createElement("div", {
    style: {
      width: '230px'
    }
  }, /*#__PURE__*/React.createElement(_Text.default, null, "Popup with wide content:"), /*#__PURE__*/React.createElement(_SelectMenu.default, {
    options: [{
      value: 'tv',
      label: 'I heard about Brainly in a TV commercial',
      icon: {
        name: 'physics',
        isSubjectIcon: true
      }
    }, {
      value: 'fb',
      label: 'Social media',
      icon: {
        name: 'history',
        isSubjectIcon: true
      }
    }, {
      value: 'search',
      label: 'Search engine',
      icon: {
        name: 'science',
        isSubjectIcon: true
      }
    }],
    defaultExpanded: true,
    onOptionChange: onOptionChange
  }))), /*#__PURE__*/React.createElement("div", {
    style: {
      width: '320px'
    }
  }, /*#__PURE__*/React.createElement(_Text.default, null, "Popup with short content that stretches to 70% of the input:"), /*#__PURE__*/React.createElement(_SelectMenu.default, _extends({}, args, {
    withIcons: false,
    defaultExpanded: true,
    options: [{
      value: 'tv',
      label: '1'
    }, {
      value: 'fb',
      label: '2'
    }, {
      value: 'search',
      label: '3'
    }],
    placeholder: "Select something from the list",
    onOptionChange: onOptionChange
  }))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Text.default, null, "Popup with short content and short input:"), /*#__PURE__*/React.createElement("div", {
    style: {
      width: '120px'
    }
  }, /*#__PURE__*/React.createElement(_SelectMenu.default, _extends({}, args, {
    withIcons: false,
    defaultExpanded: true,
    options: [{
      value: 'tv',
      label: '1'
    }, {
      value: 'fb',
      label: '2'
    }, {
      value: 'search',
      label: '3'
    }],
    placeholder: "Age",
    onOptionChange: onOptionChange
  })))));
};

exports.DifferentPopupLenghts = DifferentPopupLenghts;

var Hovers = function Hovers(args) {
  var types = [{
    name: 'default'
  }, {
    disabled: true,
    name: 'disabled'
  }];
  return /*#__PURE__*/React.createElement(_Flex.default, {
    direction: "column",
    style: {
      gap: '10px'
    }
  }, types.map(function (t) {
    return /*#__PURE__*/React.createElement(_Flex.default, {
      key: t.name,
      style: {
        width: '500px',
        padding: '10px'
      },
      justifyContent: "space-between",
      alignItems: "center"
    }, t.name, /*#__PURE__*/React.createElement(_SelectMenu.default, _extends({}, args, t, {
      onOptionChange: onOptionChange
    })));
  }), types.map(function (t) {
    return /*#__PURE__*/React.createElement("div", {
      key: t.name,
      style: {
        background: 'black'
      }
    }, /*#__PURE__*/React.createElement(_Flex.default, {
      style: {
        width: '500px',
        padding: '10px'
      },
      justifyContent: "space-between",
      alignItems: "center"
    }, /*#__PURE__*/React.createElement("span", {
      style: {
        color: 'white'
      }
    }, "White: ", t.name), /*#__PURE__*/React.createElement(_SelectMenu.default, _extends({}, args, t, {
      color: "white",
      onOptionChange: onOptionChange
    }))));
  }));
};

var Default = (0, _utils.generateChromaticStory)(_objectSpread({}, SelectMenuStories), {
  storiesToHover: [Hovers]
});
exports.Default = Default;

var _SelectMenuStories$de = SelectMenuStories.default,
    includeStories = _SelectMenuStories$de.includeStories,
    meta = _objectWithoutProperties(_SelectMenuStories$de, ["includeStories"]);

var _default = meta;
exports.default = _default;