1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | exports.AnchorButton = exports.Button = void 0;
|
19 | var tslib_1 = require("tslib");
|
20 |
|
21 |
|
22 | var React = tslib_1.__importStar(require("react"));
|
23 | var props_1 = require("../../common/props");
|
24 | var refs_1 = require("../../common/refs");
|
25 | var abstractButton_1 = require("./abstractButton");
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | var Button = (function (_super) {
|
32 | tslib_1.__extends(Button, _super);
|
33 | function Button() {
|
34 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
35 |
|
36 | _this.buttonRef = null;
|
37 | _this.handleRef = (0, refs_1.refHandler)(_this, "buttonRef", _this.props.elementRef);
|
38 | return _this;
|
39 | }
|
40 | Button.prototype.render = function () {
|
41 | return (React.createElement("button", tslib_1.__assign({ type: "button", ref: this.handleRef }, (0, props_1.removeNonHTMLProps)(this.props), this.getCommonButtonProps()), this.renderChildren()));
|
42 | };
|
43 | Button.prototype.componentDidUpdate = function (prevProps) {
|
44 | if (prevProps.elementRef !== this.props.elementRef) {
|
45 | (0, refs_1.setRef)(prevProps.elementRef, null);
|
46 | this.handleRef = (0, refs_1.refHandler)(this, "buttonRef", this.props.elementRef);
|
47 | (0, refs_1.setRef)(this.props.elementRef, this.buttonRef);
|
48 | }
|
49 | };
|
50 | Button.displayName = "".concat(props_1.DISPLAYNAME_PREFIX, ".Button");
|
51 | return Button;
|
52 | }(abstractButton_1.AbstractButton));
|
53 | exports.Button = Button;
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | var AnchorButton = (function (_super) {
|
60 | tslib_1.__extends(AnchorButton, _super);
|
61 | function AnchorButton() {
|
62 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
63 |
|
64 | _this.buttonRef = null;
|
65 | _this.handleRef = (0, refs_1.refHandler)(_this, "buttonRef", _this.props.elementRef);
|
66 | return _this;
|
67 | }
|
68 | AnchorButton.prototype.render = function () {
|
69 | var _a = this.props, href = _a.href, _b = _a.tabIndex, tabIndex = _b === void 0 ? 0 : _b;
|
70 | var commonProps = this.getCommonButtonProps();
|
71 | return (React.createElement("a", tslib_1.__assign({ role: "button", ref: this.handleRef }, (0, props_1.removeNonHTMLProps)(this.props), commonProps, { href: commonProps.disabled ? undefined : href, tabIndex: commonProps.disabled ? -1 : tabIndex }), this.renderChildren()));
|
72 | };
|
73 | AnchorButton.prototype.componentDidUpdate = function (prevProps) {
|
74 | if (prevProps.elementRef !== this.props.elementRef) {
|
75 | (0, refs_1.setRef)(prevProps.elementRef, null);
|
76 | this.handleRef = (0, refs_1.refHandler)(this, "buttonRef", this.props.elementRef);
|
77 | (0, refs_1.setRef)(this.props.elementRef, this.buttonRef);
|
78 | }
|
79 | };
|
80 | AnchorButton.displayName = "".concat(props_1.DISPLAYNAME_PREFIX, ".AnchorButton");
|
81 | return AnchorButton;
|
82 | }(abstractButton_1.AbstractButton));
|
83 | exports.AnchorButton = AnchorButton;
|
84 |
|
\ | No newline at end of file |