oolib 2.227.7 → 2.227.8
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function TextInput({ S, id, disabled, icon, type, placeholder, value, onChange, onFocus, onBlur, readOnly, iconOnClick, iconAfter, handleValidation, validateOnMount, actionBtn, clearBtn, className, maxLength, maxNumLimiter: DEPRECATED_maxNumLimiter, forceFocus, validateOnlyOnBlur, validationStatus: _validationStatus, displayValidationMsg, content, passValidationErrorToFormValidation, plugin, }: {
|
|
1
|
+
export function TextInput({ S, id, disabled, icon, type, placeholder, value, onChange, onFocus, onBlur, readOnly, iconOnClick, iconAfter, handleValidation, validateOnMount, actionBtn, clearBtn, className, style, maxLength, maxNumLimiter: DEPRECATED_maxNumLimiter, forceFocus, validateOnlyOnBlur, validationStatus: _validationStatus, displayValidationMsg, content, passValidationErrorToFormValidation, plugin, }: {
|
|
2
2
|
S: any;
|
|
3
3
|
id: any;
|
|
4
4
|
disabled: any;
|
|
@@ -16,7 +16,8 @@ export function TextInput({ S, id, disabled, icon, type, placeholder, value, onC
|
|
|
16
16
|
validateOnMount?: boolean;
|
|
17
17
|
actionBtn: any;
|
|
18
18
|
clearBtn: any;
|
|
19
|
-
className
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: {};
|
|
20
21
|
maxLength: any;
|
|
21
22
|
maxNumLimiter: any;
|
|
22
23
|
forceFocus: any;
|
|
@@ -110,13 +110,13 @@ var BadgeVetted = icons_1.icons.BadgeVetted;
|
|
|
110
110
|
function TextInput(_a) {
|
|
111
111
|
var _this = this;
|
|
112
112
|
var S = _a.S, id = _a.id, disabled = _a.disabled, icon = _a.icon, type = _a.type, _b = _a.placeholder, placeholder = _b === void 0 ? "Enter Text..." : _b, _c = _a.value, value = _c === void 0 ? "" : _c, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, readOnly = _a.readOnly, iconOnClick = _a.iconOnClick, iconAfter = _a.iconAfter, handleValidation = _a.handleValidation, _d = _a.validateOnMount, validateOnMount = _d === void 0 ? true : _d, // i think it makes sense to always run validation the minute the comp mounts, but we will see if this has sideeffects
|
|
113
|
-
actionBtn = _a.actionBtn, clearBtn = _a.clearBtn,
|
|
114
|
-
|
|
115
|
-
validateOnlyOnBlur =
|
|
116
|
-
_validationStatus = _a.validationStatus,
|
|
113
|
+
actionBtn = _a.actionBtn, clearBtn = _a.clearBtn, _e = _a.className, className = _e === void 0 ? '' : _e, _f = _a.style, style = _f === void 0 ? {} : _f, maxLength = _a.maxLength, DEPRECATED_maxNumLimiter = _a.maxNumLimiter, forceFocus = _a.forceFocus, //sometimes, when some other elem is clicked, we wanna trigger focus on the textinput. eg. when on mobile, the search icon is clicked on the listingpage
|
|
114
|
+
_g = _a.validateOnlyOnBlur, //sometimes, when some other elem is clicked, we wanna trigger focus on the textinput. eg. when on mobile, the search icon is clicked on the listingpage
|
|
115
|
+
validateOnlyOnBlur = _g === void 0 ? false : _g, //for example, in the login form we want validation to only run, once the text input is blurred. else it can be irritating
|
|
116
|
+
_validationStatus = _a.validationStatus, _h = _a.displayValidationMsg, displayValidationMsg = _h === void 0 ? true : _h, content = _a.content, passValidationErrorToFormValidation = _a.passValidationErrorToFormValidation, plugin = _a.plugin;
|
|
117
117
|
var props = arguments[0];
|
|
118
118
|
var theme = (0, styled_components_1.useTheme)();
|
|
119
|
-
var
|
|
119
|
+
var _j = (0, react_1.useState)(_validationStatus), validationStatus = _j[0], setValidationStatus = _j[1];
|
|
120
120
|
(0, react_1.useEffect)(function () {
|
|
121
121
|
setValidationStatus(_validationStatus);
|
|
122
122
|
}, [_validationStatus]);
|
|
@@ -193,7 +193,7 @@ function TextInput(_a) {
|
|
|
193
193
|
forceFocus && inputRef.current && inputRef.current.focus();
|
|
194
194
|
}, [forceFocus]);
|
|
195
195
|
var localize = (0, utilsOolib_1.useLocale)();
|
|
196
|
-
return (react_1.default.createElement("div", { className: className },
|
|
196
|
+
return (react_1.default.createElement("div", { style: style, className: className },
|
|
197
197
|
react_1.default.createElement(BlockLabel_1.BlockLabel, __assign({}, (0, _EXPORTS_1.getBlockLabelProps)(props))),
|
|
198
198
|
readOnly ? (type === "url"
|
|
199
199
|
? react_1.default.createElement(OKELink_1.OKELink, { text: value, to: value })
|