wini-web-components 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,6 +7,7 @@ interface TextFieldProps {
|
|
|
7
7
|
maxLength?: number;
|
|
8
8
|
defaultValue?: string;
|
|
9
9
|
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
10
|
+
onComplete?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
10
11
|
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
11
12
|
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
12
13
|
placeholder?: string;
|
|
@@ -64,11 +64,32 @@ var TextField = /** @class */ (function (_super) {
|
|
|
64
64
|
return _this;
|
|
65
65
|
}
|
|
66
66
|
TextField.prototype.render = function () {
|
|
67
|
+
var _this = this;
|
|
67
68
|
var _a, _b, _c, _d, _e, _f;
|
|
68
69
|
return react_1.default.createElement("div", { ref: this.containerRef, id: this.props.id, className: "text-field-container row ".concat((_a = this.props.className) !== null && _a !== void 0 ? _a : 'body-3', " ").concat(((_b = this.props.helperText) === null || _b === void 0 ? void 0 : _b.length) && 'helper-text'), "helper-text": this.props.helperText, style: this.props.style ? __assign(__assign({}, { '--helper-text-color': (_c = this.props.helperTextColor) !== null && _c !== void 0 ? _c : '#e14337' }), this.props.style) : { '--helper-text-color': (_d = this.props.helperTextColor) !== null && _d !== void 0 ? _d : '#e14337' } },
|
|
69
70
|
this.props.prefix,
|
|
70
71
|
this.props.register ?
|
|
71
|
-
react_1.default.createElement("input", __assign({}, this.props.register, { autoFocus: this.props.autoFocus, maxLength: this.props.maxLength, name: this.props.name, type: (_e = this.props.type) !== null && _e !== void 0 ? _e : 'text', placeholder: this.props.placeholder, readOnly: this.props.readOnly, disabled: this.props.disabled, onFocus: this.props.onFocus
|
|
72
|
+
react_1.default.createElement("input", __assign({}, this.props.register, { autoFocus: this.props.autoFocus, maxLength: this.props.maxLength, name: this.props.name, type: (_e = this.props.type) !== null && _e !== void 0 ? _e : 'text', placeholder: this.props.placeholder, readOnly: this.props.readOnly, disabled: this.props.disabled, onFocus: this.props.onFocus, onKeyDown: this.props.onComplete ? function (ev) {
|
|
73
|
+
if (_this.props.onComplete) {
|
|
74
|
+
switch (ev.key.toLowerCase()) {
|
|
75
|
+
case "enter":
|
|
76
|
+
_this.props.onComplete(ev);
|
|
77
|
+
break;
|
|
78
|
+
default:
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} : undefined })) : react_1.default.createElement("input", { autoFocus: this.props.autoFocus, maxLength: this.props.maxLength, name: this.props.name, type: (_f = this.props.type) !== null && _f !== void 0 ? _f : 'text', defaultValue: this.props.defaultValue, value: this.props.value, placeholder: this.props.placeholder, readOnly: this.props.readOnly, disabled: this.props.disabled, onChange: this.props.onChange, onFocus: this.props.onFocus, onBlur: this.props.onBlur, onKeyDown: this.props.onComplete ? function (ev) {
|
|
83
|
+
if (_this.props.onComplete) {
|
|
84
|
+
switch (ev.key.toLowerCase()) {
|
|
85
|
+
case "enter":
|
|
86
|
+
_this.props.onComplete(ev);
|
|
87
|
+
break;
|
|
88
|
+
default:
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
} : undefined }),
|
|
72
93
|
this.props.suffix);
|
|
73
94
|
};
|
|
74
95
|
return TextField;
|