UNPKG

@mopinion/survey

Version:

Collect customer feedback with the Mopinion survey library

47 lines (46 loc) 1.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _preact = require("preact"); var _compat = require("preact/compat"); var _elements = require("../../elements"); var _utils = require("../../../utils"); var _ConfigStore = require("../stores/ConfigStore"); var _SvgIcon = _interopRequireDefault(require("./SvgIcon")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } var _default = exports["default"] = (0, _compat.forwardRef)(function ActionButton(_ref, ref) { var children = _ref.children, type = _ref.type, id = _ref.id, _ref$onClick = _ref.onClick, onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick, loading = _ref.loading, _ref$style = _ref.style, style = _ref$style === void 0 ? {} : _ref$style; var _useFormProps = (0, _ConfigStore.useFormProps)(), formKey = _useFormProps.formKey; var _useConfigStore = (0, _ConfigStore.useConfigStore)(), properties = _useConfigStore.properties; return (0, _preact.h)(_elements.HandleTabIndex, { component: "button", ref: ref, className: "btn ".concat(type === 'submit' ? 'btn-primary btn-submit pull-right' : type === 'next' ? 'btn-next pull-right' : 'btn-previous', " ").concat(loading ? 'is-submitting' : ''), id: type !== 'submit' ? "btn_".concat(type, "_").concat(id) : "surveySubmitBtn-".concat(formKey), type: "button", onClick: onClick, style: style, "data-testid": type, disabled: loading }, loading && (0, _preact.h)("div", { className: (0, _utils.makeClassName)('btn-overlay') }, (0, _preact.h)(_SvgIcon["default"], { icon: "refresh", className: "is-refresh-icon", alt: "refresh icon" })), (0, _preact.h)("div", { className: (0, _utils.makeClassName)('btn-content') }, children)); }); //# sourceMappingURL=ActionButton.js.map