"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _designSystem = require("@wix/design-system");
var _reactHookForm = require("react-hook-form");
var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/cairo/dist/cjs/test-utils/ExtensionWidget.tsx";
function ExtensionWidget({
  form,
  entity
}) {
  return /*#__PURE__*/_react.default.createElement(_designSystem.Card, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 13,
      columnNumber: 5
    }
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Card.Header, {
    title: "Extension Widget",
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 14,
      columnNumber: 7
    }
  }), /*#__PURE__*/_react.default.createElement(_designSystem.Card.Divider, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 15,
      columnNumber: 7
    }
  }), /*#__PURE__*/_react.default.createElement(_designSystem.Card.Content, {
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 16,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react.default.createElement(_reactHookForm.Controller, {
    control: form.control,
    name: "createdDate",
    defaultValue: (entity == null ? void 0 : entity.createdDate) || undefined,
    rules: {
      validate: value => {
        return (value == null ? void 0 : value.getDay()) !== 6 ? true : `${value.toLocaleString('en', {
          weekday: 'long'
        })} is Shabbat, please choose a different day.`;
      }
    },
    render: ({
      field: {
        onChange,
        onBlur,
        value,
        ref
      },
      fieldState: {
        invalid,
        error
      }
    }) => /*#__PURE__*/_react.default.createElement(_designSystem.FormField, {
      label: "Created At",
      status: invalid ? 'error' : undefined,
      statusMessage: error == null ? void 0 : error.message,
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 34,
        columnNumber: 13
      }
    }, /*#__PURE__*/_react.default.createElement(_designSystem.DatePicker, {
      onClose: onBlur,
      onChange: onChange,
      value: value,
      inputProps: {
        inputRef: ref
      },
      __self: this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 39,
        columnNumber: 15
      }
    })),
    __self: this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 17,
      columnNumber: 9
    }
  })));
}
var _default = exports.default = ExtensionWidget;
//# sourceMappingURL=ExtensionWidget.js.map