"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports._CustomFieldTypeDropdown = exports.CustomFieldTypeDropdown = void 0;
var _react = _interopRequireDefault(require("react"));
var _mobxReactLite = require("mobx-react-lite");
var _designSystem = require("@wix/design-system");
var _wixUiIconsCommon = require("@wix/wix-ui-icons-common");
var _react2 = require("@wix/bex-core/react");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/components/CustomFieldModal/CustomFieldTypeDropdown.tsx";
const _CustomFieldTypeDropdown = props => {
  const {
    state: {
      form: {
        $: {
          type,
          name
        }
      },
      mode,
      generateUniqueKey,
      setKeyFieldIfNotDirty
    }
  } = props;
  const {
    translate: t
  } = (0, _react2.useWixPatternsContainer)();
  const [fieldTypeOptions] = _react.default.useState(() => [(0, _designSystem.listItemSelectBuilder)({
    dataHook: 'custom-field-modal-type-shortText',
    id: 'shortText',
    prefix: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 40,
        columnNumber: 9
      }
    }, /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.Rename, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 41,
        columnNumber: 11
      }
    })),
    title: t('cairo.customFields.fieldType.shortText'),
    label: t('cairo.customFields.fieldType.shortText')
  }), (0, _designSystem.listItemSelectBuilder)({
    dataHook: 'custom-field-modal-type-longText',
    id: 'longText',
    prefix: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 51,
        columnNumber: 9
      }
    }, /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.Rename, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 52,
        columnNumber: 11
      }
    })),
    title: t('cairo.customFields.fieldType.longText'),
    label: t('cairo.customFields.fieldType.longText')
  }), (0, _designSystem.listItemSelectBuilder)({
    dataHook: 'custom-field-modal-type-date',
    id: 'date',
    prefix: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 62,
        columnNumber: 9
      }
    }, /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.Date, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 63,
        columnNumber: 11
      }
    })),
    title: t('cairo.customFields.fieldType.date'),
    label: t('cairo.customFields.fieldType.date')
  }), (0, _designSystem.listItemSelectBuilder)({
    dataHook: 'custom-field-modal-type-dateTime',
    id: 'dateTime',
    prefix: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 73,
        columnNumber: 9
      }
    }, /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.DateAndTime, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 74,
        columnNumber: 11
      }
    })),
    title: t('cairo.customFields.fieldType.dateAndTime'),
    label: t('cairo.customFields.fieldType.dateAndTime')
  }), (0, _designSystem.listItemSelectBuilder)({
    dataHook: 'custom-field-modal-type-integer',
    id: 'integer',
    prefix: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 84,
        columnNumber: 9
      }
    }, /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.Number, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 85,
        columnNumber: 11
      }
    })),
    title: t('cairo.customFields.fieldType.numberInteger'),
    label: t('cairo.customFields.fieldType.numberInteger')
  }), (0, _designSystem.listItemSelectBuilder)({
    dataHook: 'custom-field-modal-type-decimal',
    id: 'decimal',
    prefix: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 95,
        columnNumber: 9
      }
    }, /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.Number, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 96,
        columnNumber: 11
      }
    })),
    title: t('cairo.customFields.fieldType.numberDecimal'),
    label: t('cairo.customFields.fieldType.numberDecimal')
  }), (0, _designSystem.listItemSelectBuilder)({
    dataHook: 'custom-field-modal-type-checkbox',
    id: 'checkbox',
    prefix: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 106,
        columnNumber: 9
      }
    }, /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.Checkbox, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 107,
        columnNumber: 11
      }
    })),
    title: t('cairo.customFields.fieldType.checkbox'),
    label: t('cairo.customFields.fieldType.checkbox')
  }), (0, _designSystem.listItemSelectBuilder)({
    dataHook: 'custom-field-modal-type-url',
    id: 'url',
    prefix: /*#__PURE__*/_react.default.createElement(_designSystem.Box, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 117,
        columnNumber: 9
      }
    }, /*#__PURE__*/_react.default.createElement(_wixUiIconsCommon.Link, {
      __self: void 0,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 118,
        columnNumber: 11
      }
    })),
    title: t('cairo.customFields.fieldType.url'),
    label: t('cairo.customFields.fieldType.url')
  })
  /* listItemSelectBuilder({
    dataHook: 'custom-field-modal-type-dropdown',
    id: 'dropdown',
    prefix: (
      <Box>
        <DropdownIcon />
      </Box>
    ),
    title: t('cairo.customFields.fieldType.dropdownList'),
    label: t('cairo.customFields.fieldType.dropdownList'),
  }),*/]);
  return /*#__PURE__*/_react.default.createElement(_designSystem.Dropdown, {
    dataHook: "custom-field-modal-type",
    disabled: mode === 'edit',
    valueParser: option => option.label,
    selectedId: type.value,
    onSelect: ({
      id
    }) => {
      type.onChange(id);
      setKeyFieldIfNotDirty(generateUniqueKey(name.value));
    },
    popoverProps: {
      appendTo: 'window',
      zIndex: 5001
    },
    dropdownWidth: "258px",
    placeholder: t('cairo.customFields.addCustomField.modal.fieldType.placeholder'),
    options: fieldTypeOptions,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 138,
      columnNumber: 5
    }
  });
};
exports._CustomFieldTypeDropdown = _CustomFieldTypeDropdown;
const CustomFieldTypeDropdown = exports.CustomFieldTypeDropdown = (0, _mobxReactLite.observer)(_CustomFieldTypeDropdown);
//# sourceMappingURL=CustomFieldTypeDropdown.js.map