import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import React from "react";
import Row from "./Row";
import { ReactComponent as RowIcon } from "@svgr/webpack!../../../assets/icons/row-icon.svg";
import { PreviewBox } from "../../../utils";
import { i18n } from '@fishx/i18n';
export default (function () {
  return {
    name: "pb-editor-page-element-row",
    type: "pb-editor-page-element",
    elementType: "row",
    toolbar: {
      title: i18n('PAGEBUIDER_ELEMENT_SORT_ROW'),
      group: "pb-editor-element-group-layout",
      toolBarPreview: /*#__PURE__*/React.createElement(RowIcon, null),
      // Render element preview
      preview: function preview() {
        return /*#__PURE__*/React.createElement(PreviewBox, null, /*#__PURE__*/React.createElement(RowIcon, null));
      }
    },
    settings: ["pb-editor-page-element-settings-style-set"],
    // Target drop zones that will accept this type
    target: ["block", "form", "placeholder", "row"],
    // This function is called when `createElement` is called for this plugin
    create: function create() {
      var _options$data, _options$data2;

      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      var row = _objectSpread(_objectSpread({
        type: "row"
      }, options), {}, {
        elements: options.elements || [],
        data: {
          settings: _objectSpread({
            cols: {
              span: 24,
              offset: 0
            }
          }, ((_options$data = options.data) === null || _options$data === void 0 ? void 0 : _options$data.settings) || {}),
          componentSettings: _objectSpread({}, ((_options$data2 = options.data) === null || _options$data2 === void 0 ? void 0 : _options$data2.componentSettings) || {})
        }
      });

      return row;
    },
    // Render element in editor
    render: function render(props) {
      return /*#__PURE__*/React.createElement(Row, props);
    }
  };
});
//# sourceMappingURL=index.js.map