oolib 2.29.5 → 2.29.6

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.
@@ -204,8 +204,9 @@ var EmailInput = function (_a) {
204
204
  var errorObj = regEx.test(value)
205
205
  ? ''
206
206
  : { type: 'error', msg: 'Enter a valid email address' };
207
- if (errorObj && passValidationErrorToFormValidation)
208
- passValidationErrorToFormValidation(errorObj);
207
+ if (passValidationErrorToFormValidation) {
208
+ passValidationErrorToFormValidation((errorObj === null || errorObj === void 0 ? void 0 : errorObj.type) || 'success');
209
+ }
209
210
  return errorObj;
210
211
  };
211
212
  return (react_1.default.createElement(exports.TextInput, __assign({ type: "email", placeholder: 'Enter email...', validateOnBlur: handleValidation }, props)));
@@ -218,15 +219,18 @@ var PhoneInput = function (_a) {
218
219
  if (isNaN(value)) {
219
220
  errorObj = { type: 'error', msg: 'Enter a valid phone number' };
220
221
  if (passValidationErrorToFormValidation)
221
- passValidationErrorToFormValidation(errorObj);
222
+ passValidationErrorToFormValidation(errorObj.type);
222
223
  return errorObj;
223
224
  }
224
225
  if (value.length < 10) {
225
226
  errorObj = { type: 'error', msg: 'Enter a valid phone number' };
226
227
  if (passValidationErrorToFormValidation)
227
- passValidationErrorToFormValidation(errorObj);
228
+ passValidationErrorToFormValidation(errorObj.type);
228
229
  return errorObj;
229
230
  }
231
+ //else
232
+ if (passValidationErrorToFormValidation)
233
+ passValidationErrorToFormValidation('success');
230
234
  };
231
235
  return (react_1.default.createElement(exports.TextInput, __assign({ type: "tel", placeholder: 'Enter Phone...', validateOnBlur: handleValidation, maxLength: 10 }, props)));
232
236
  };
@@ -235,7 +239,7 @@ var URLInput = function (_a) {
235
239
  var _b = _a.routesAreValidInputs, routesAreValidInputs = _b === void 0 ? false : _b, //if we want react route declarations to be considered as 'valid' then set this to true
236
240
  validationPlugin = _a.validationPlugin, passValidationErrorToFormValidation = _a.passValidationErrorToFormValidation, content = _a.content, props = __rest(_a, ["routesAreValidInputs", "validationPlugin", "passValidationErrorToFormValidation", "content"]);
237
241
  var handleValidation = function (value) { return __awaiter(void 0, void 0, void 0, function () {
238
- var pluginResponse, response, err_1, errorObj;
242
+ var pluginResponse, successObj, response, successObj, err_1, successObj, errorObj;
239
243
  return __generator(this, function (_a) {
240
244
  switch (_a.label) {
241
245
  case 0:
@@ -250,7 +254,10 @@ var URLInput = function (_a) {
250
254
  //else
251
255
  //if routesAreValidInputs, then first validate for a route
252
256
  if (routesAreValidInputs && value.substring(0, 1) === '/') {
253
- return [2 /*return*/, { type: 'success', msg: 'valid route' }];
257
+ successObj = { type: 'success', msg: 'valid route' };
258
+ if (passValidationErrorToFormValidation)
259
+ passValidationErrorToFormValidation(successObj.type);
260
+ return [2 /*return*/, successObj];
254
261
  }
255
262
  //else validate for a url
256
263
  if (!/^https?:\/\//i.test(value)) {
@@ -264,15 +271,21 @@ var URLInput = function (_a) {
264
271
  response = _a.sent();
265
272
  if (response.status !== 200)
266
273
  throw new Error('');
267
- return [2 /*return*/, { type: 'success', msg: 'valid url' }];
274
+ successObj = { type: 'success', msg: 'valid url' };
275
+ if (passValidationErrorToFormValidation)
276
+ passValidationErrorToFormValidation(successObj.type);
277
+ return [2 /*return*/, successObj];
268
278
  case 5:
269
279
  err_1 = _a.sent();
270
280
  if (/[(http(s)?):\/\/(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/ig.test(value)) {
271
- return [2 /*return*/, { type: 'success', msg: 'valid url' }];
281
+ successObj = { type: 'success', msg: 'valid url' };
282
+ if (passValidationErrorToFormValidation)
283
+ passValidationErrorToFormValidation(successObj.type);
284
+ return [2 /*return*/, successObj];
272
285
  }
273
286
  errorObj = { type: 'error', msg: 'Enter a valid url...' };
274
287
  if (passValidationErrorToFormValidation)
275
- passValidationErrorToFormValidation(errorObj);
288
+ passValidationErrorToFormValidation(errorObj.type);
276
289
  return [2 /*return*/, errorObj];
277
290
  case 6: return [2 /*return*/];
278
291
  }
@@ -289,21 +302,24 @@ var NumberInput = function (_a) {
289
302
  if (isNaN(value)) {
290
303
  errorObj = { type: 'error', msg: 'Enter a number' };
291
304
  if (passValidationErrorToFormValidation)
292
- passValidationErrorToFormValidation(errorObj);
305
+ passValidationErrorToFormValidation(errorObj.type);
293
306
  return errorObj;
294
307
  }
295
308
  if (min && value < min) {
296
309
  errorObj = { type: 'error', msg: "Enter value greater than ".concat(min) };
297
310
  if (passValidationErrorToFormValidation)
298
- passValidationErrorToFormValidation(errorObj);
311
+ passValidationErrorToFormValidation(errorObj.type);
299
312
  return errorObj;
300
313
  }
301
314
  if (max && value > max) {
302
315
  errorObj = { type: 'error', msg: "Enter value less than ".concat(max) };
303
316
  if (passValidationErrorToFormValidation)
304
- passValidationErrorToFormValidation(errorObj);
317
+ passValidationErrorToFormValidation(errorObj.type);
305
318
  return errorObj;
306
319
  }
320
+ //else
321
+ if (passValidationErrorToFormValidation)
322
+ passValidationErrorToFormValidation('success');
307
323
  };
308
324
  return (react_1.default.createElement(exports.TextInput
309
325
  // type="number"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.29.5",
3
+ "version": "2.29.6",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",