"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.FieldTypeSelect = void 0;
var _react = _interopRequireDefault(require("react"));
var _designSystem = require("@wix/design-system");
var _fieldTypePrefixIcons = require("../../../utils/fieldTypePrefixIcons");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CmsFieldManagement/formFields/FieldTypeSelect.tsx";
const OPTIONS = [(0, _designSystem.listItemSectionBuilder)({
  title: 'Essentials',
  id: 'section-essentials',
  type: 'subheader'
}), (0, _designSystem.listItemSelectBuilder)({
  id: 'SHORT_TEXT',
  title: 'Text',
  label: 'Text',
  prefix: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 23,
      columnNumber: 7
    }
  }, (0, _fieldTypePrefixIcons.getFieldTypeIcon)({
    fieldType: 'SHORT_TEXT',
    size: 'medium'
  }))
}), (0, _designSystem.listItemSelectBuilder)({
  id: 'NUMBER',
  title: 'Number',
  label: 'Number',
  prefix: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 31,
      columnNumber: 7
    }
  }, (0, _fieldTypePrefixIcons.getFieldTypeIcon)({
    fieldType: 'NUMBER',
    size: 'medium'
  }))
}), (0, _designSystem.listItemSelectBuilder)({
  id: 'BOOLEAN',
  title: 'Boolean',
  label: 'Boolean',
  prefix: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 39,
      columnNumber: 7
    }
  }, (0, _fieldTypePrefixIcons.getFieldTypeIcon)({
    fieldType: 'BOOLEAN',
    size: 'medium'
  }))
}), (0, _designSystem.listItemSelectBuilder)({
  id: 'DATE',
  title: 'Date',
  label: 'Date',
  prefix: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 47,
      columnNumber: 7
    }
  }, (0, _fieldTypePrefixIcons.getFieldTypeIcon)({
    fieldType: 'DATE',
    size: 'medium'
  }))
})];
const FieldTypeSelect = ({
  label,
  value,
  onChange,
  disabled,
  error
}) => /*#__PURE__*/_react.default.createElement(_designSystem.FormField, {
  required: true,
  stretchContent: true,
  label: label,
  status: error ? 'error' : undefined,
  statusMessage: error,
  __self: void 0,
  __source: {
    fileName: _jsxFileName,
    lineNumber: 67,
    columnNumber: 3
  }
}, /*#__PURE__*/_react.default.createElement(_designSystem.Dropdown, {
  popoverProps: {
    zIndex: 10000,
    appendTo: 'window'
  },
  placeholder: "Choose a type",
  valueParser: option => option.label,
  prefix: value ? (0, _fieldTypePrefixIcons.getFieldTypeIcon)({
    fieldType: value,
    size: 'medium'
  }) : undefined,
  options: OPTIONS,
  selectedId: value,
  onSelect: option => onChange(option.id),
  disabled: disabled,
  __self: void 0,
  __source: {
    fileName: _jsxFileName,
    lineNumber: 74,
    columnNumber: 5
  }
}));
exports.FieldTypeSelect = FieldTypeSelect;
//# sourceMappingURL=FieldTypeSelect.js.map