UNPKG

wix-style-react

Version:
75 lines (65 loc) 3.52 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _inherits from "@babel/runtime/helpers/inherits"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } import React from 'react'; import Check from 'wix-ui-icons-common/Check'; import X from 'wix-ui-icons-common/X'; import { st, classes } from './RichTextInputAreaForm.st.css'; import { RichTextInputAreaContext } from '../RichTextInputAreaContext'; import Tooltip from '../../Tooltip'; import Box from '../../Box'; import IconButton from '../../IconButton'; var RichTextInputAreaForm = /*#__PURE__*/function (_React$PureComponent) { _inherits(RichTextInputAreaForm, _React$PureComponent); var _super = _createSuper(RichTextInputAreaForm); function RichTextInputAreaForm() { _classCallCheck(this, RichTextInputAreaForm); return _super.apply(this, arguments); } _createClass(RichTextInputAreaForm, [{ key: "render", value: function render() { var _this$props = this.props, dataHook = _this$props.dataHook, children = _this$props.children, onSubmit = _this$props.onSubmit, onCancel = _this$props.onCancel, isDisabled = _this$props.isDisabled; return /*#__PURE__*/React.createElement(RichTextInputAreaContext.Consumer, null, function (_ref) { var texts = _ref.texts; return /*#__PURE__*/React.createElement("form", { "data-hook": dataHook, onSubmit: onSubmit, className: classes.root }, children, /*#__PURE__*/React.createElement("div", { className: classes.footer }, /*#__PURE__*/React.createElement(Tooltip, { content: texts.insertionForm.confirmButtonLabel }, /*#__PURE__*/React.createElement(IconButton, { dataHook: "richtextarea-form-confirm-button", type: "submit", size: "small", onClick: onSubmit, disabled: isDisabled }, /*#__PURE__*/React.createElement(Check, null))), /*#__PURE__*/React.createElement(Box, { inline: true, marginRight: 1, marginLeft: 1 }, /*#__PURE__*/React.createElement(Tooltip, { content: texts.insertionForm.cancelButtonLabel }, /*#__PURE__*/React.createElement(IconButton, { dataHook: "richtextarea-form-cancel-button", priority: "secondary", size: "small", onClick: onCancel }, /*#__PURE__*/React.createElement(X, null)))))); }); } }]); return RichTextInputAreaForm; }(React.PureComponent); export default RichTextInputAreaForm;