@skbkontur/ui-kit
Version:
37 lines • 1.44 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var react_1 = tslib_1.__importDefault(require("react"));
var ButtonView_1 = require("./ButtonView");
var Button = /** @class */ (function (_super) {
tslib_1.__extends(Button, _super);
function Button() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.innerNode = null;
_this.refButton = function (node) {
_this.innerNode = node;
if (_this.props.buttonRef) {
_this.props.buttonRef(node);
}
};
return _this;
}
Button.prototype.focus = function () {
if (this.innerNode) {
this.innerNode.focus();
}
};
Button.prototype.blur = function () {
if (this.innerNode) {
this.innerNode.blur();
}
};
Button.prototype.render = function () {
var _a = this.props, buttonRef = _a.buttonRef, children = _a.children, rest = tslib_1.__rest(_a, ["buttonRef", "children"]);
return (react_1.default.createElement(ButtonView_1.ButtonView, tslib_1.__assign({}, rest, { tabIndex: rest.disabled ? -1 : 0, clickableRef: this.refButton }),
react_1.default.createElement(ButtonView_1.Caption, null, children)));
};
return Button;
}(react_1.default.Component));
exports.default = Button;
//# sourceMappingURL=Button.js.map
;