funda-ui 4.7.195 → 4.7.197

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.
Files changed (38) hide show
  1. package/Accordion/index.js +126 -37
  2. package/LiveSearch/index.js +234 -184
  3. package/MultipleCheckboxes/index.js +234 -184
  4. package/MultipleSelect/index.js +234 -184
  5. package/NativeSelect/index.js +234 -184
  6. package/Radio/index.js +234 -184
  7. package/Select/index.js +234 -184
  8. package/Utils/anim.js +101 -25
  9. package/Utils/formdata.d.ts +13 -0
  10. package/Utils/formdata.js +131 -0
  11. package/Utils/initDefaultOptions.d.ts +1 -12
  12. package/Utils/initDefaultOptions.js +154 -48
  13. package/Utils/validate.d.ts +49 -0
  14. package/Utils/validate.js +166 -0
  15. package/lib/cjs/Accordion/index.js +126 -37
  16. package/lib/cjs/LiveSearch/index.js +234 -184
  17. package/lib/cjs/MultipleCheckboxes/index.js +234 -184
  18. package/lib/cjs/MultipleSelect/index.js +234 -184
  19. package/lib/cjs/NativeSelect/index.js +234 -184
  20. package/lib/cjs/Radio/index.js +234 -184
  21. package/lib/cjs/Select/index.js +234 -184
  22. package/lib/cjs/Utils/anim.js +101 -25
  23. package/lib/cjs/Utils/formdata.d.ts +13 -0
  24. package/lib/cjs/Utils/formdata.js +131 -0
  25. package/lib/cjs/Utils/initDefaultOptions.d.ts +1 -12
  26. package/lib/cjs/Utils/initDefaultOptions.js +154 -48
  27. package/lib/cjs/Utils/validate.d.ts +49 -0
  28. package/lib/cjs/Utils/validate.js +166 -0
  29. package/lib/esm/LiveSearch/index.tsx +1 -1
  30. package/lib/esm/MultipleCheckboxes/index.tsx +1 -1
  31. package/lib/esm/MultipleSelect/index.tsx +1 -1
  32. package/lib/esm/NativeSelect/index.tsx +1 -1
  33. package/lib/esm/Radio/index.tsx +1 -1
  34. package/lib/esm/Select/index.tsx +1 -1
  35. package/lib/esm/Utils/libs/formdata.ts +93 -0
  36. package/lib/esm/Utils/libs/initDefaultOptions.ts +1 -62
  37. package/lib/esm/Utils/libs/validate.ts +120 -0
  38. package/package.json +1 -1
@@ -201,7 +201,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
201
201
  }
202
202
  /* harmony export */
203
203
  });
204
- /* unused harmony exports isJSON, isValidNumeric */
204
+ /* harmony import */
205
+ var _validate__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_8432__(258);
205
206
  function _typeof(obj) {
206
207
  "@babel/helpers - typeof";
207
208
 
@@ -211,6 +212,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
211
212
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
212
213
  }, _typeof(obj);
213
214
  }
215
+
214
216
  /**
215
217
  * Set a default JSON format configuration
216
218
  *
@@ -221,7 +223,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
221
223
  function _setDefaultOptions(props, options) {
222
224
  if (_typeof(options) === ( true ? "undefined" : 0) || options === null || options === false) options = {};
223
225
  //Set a default configuration
224
- if (isJSON(props)) {
226
+ if ((0, _validate__WEBPACK_IMPORTED_MODULE_0__.isJSON)(props)) {
225
227
  var defaultConfigValues = Object.values(props);
226
228
  Object.keys(props).forEach(function (prop, index) {
227
229
  // Well-formed string type
@@ -230,8 +232,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
230
232
  var _v = options[prop2];
231
233
  if (_v == 'true') _v = true;
232
234
  if (_v == 'false') _v = false;
233
- if (isValidNumeric(_v)) _v = parseFloat(_v);
234
- if (isJSON(_v)) _v = Object.prototype.toString.call(_v) === '[object Object]' ? _v : JSON.parse(_v);
235
+ if ((0, _validate__WEBPACK_IMPORTED_MODULE_0__.isValidNumeric)(_v)) _v = parseFloat(_v);
236
+ if ((0, _validate__WEBPACK_IMPORTED_MODULE_0__.isJSON)(_v)) _v = Object.prototype.toString.call(_v) === '[object Object]' ? _v : JSON.parse(_v);
235
237
  options[prop2] = _v;
236
238
  }
237
239
  });
@@ -243,46 +245,133 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
243
245
  return options;
244
246
  }
245
247
 
248
+ /***/
249
+ },
250
+
251
+ /***/258: /***/function _(__unused_webpack_module, __webpack_exports__, __nested_webpack_require_11060__) {
252
+ /* harmony export */__nested_webpack_require_11060__.d(__webpack_exports__, {
253
+ /* harmony export */"isJSON": function isJSON() {
254
+ return (/* binding */_isJSON
255
+ );
256
+ },
257
+ /* harmony export */"isValidNumeric": function isValidNumeric() {
258
+ return (/* binding */_isValidNumeric
259
+ );
260
+ }
261
+ /* harmony export */
262
+ });
263
+ /* unused harmony exports isEmpty, isNumber, isInt, isEmail, isTel, isMobile */
264
+ function _typeof(obj) {
265
+ "@babel/helpers - typeof";
266
+
267
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
268
+ return typeof obj;
269
+ } : function (obj) {
270
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
271
+ }, _typeof(obj);
272
+ }
246
273
  /**
247
- * Check if a string is a valid number
248
- * @param {*} str
249
- * @returns
250
- */
251
- function isValidNumeric(str) {
252
- if (typeof str != "string") return false; // we only process strings!
274
+ * Check if a string is a valid number
275
+ * @param str - The string to check
276
+ * @returns boolean indicating if the string is a valid number
277
+ */
278
+ function _isValidNumeric(str) {
279
+ if (typeof str !== "string") return false; // we only process strings!
253
280
  if (!isNaN(Number(str)) &&
254
- // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)
281
+ // use type coercion to parse the _entirety_ of the string
255
282
  !isNaN(parseFloat(str)) // ensure strings of whitespace fail
256
283
  ) {
257
284
  return true;
258
- } else {
259
- return false;
260
285
  }
286
+ return false;
261
287
  }
262
288
 
263
289
  /**
264
290
  * Determine whether it is in JSON format
265
- * @param {*} str
266
- * @returns
291
+ * @param str - The value to check
292
+ * @returns boolean indicating if the value is valid JSON
267
293
  */
268
- function isJSON(str) {
294
+ function _isJSON(str) {
269
295
  if (typeof str === 'string' && str.length > 0) {
270
- if (str.replace(/\"\"/g, '').replace(/\,/g, '') == '[{}]') {
296
+ if (str.replace(/\"\"/g, '').replace(/\,/g, '') === '[{}]') {
271
297
  return false;
272
- } else {
273
- if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
274
- return true;
275
- } else {
276
- return false;
277
- }
278
298
  }
279
- } else {
280
- if (_typeof(str) === 'object' && Object.prototype.toString.call(str) === '[object Object]' && !str.length) {
299
+ if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
281
300
  return true;
282
- } else {
283
- return false;
284
301
  }
302
+ return false;
285
303
  }
304
+ if (_typeof(str) === 'object' && Object.prototype.toString.call(str) === '[object Object]' && !str.length) {
305
+ return true;
306
+ }
307
+ return false;
308
+ }
309
+
310
+ /**
311
+ * Check if input is empty
312
+ * @param input - The input to check (string or array of strings)
313
+ * @returns boolean indicating if the input is empty
314
+ */
315
+ function isEmpty(input) {
316
+ if (Array.isArray(input)) {
317
+ return input.some(function (str) {
318
+ return !str.replace(/\s/g, '').length === true;
319
+ });
320
+ }
321
+ return !input.replace(/\s/g, '').length === true;
322
+ }
323
+
324
+ /**
325
+ * Check if input is a valid number
326
+ * @param input - The input to check
327
+ * @returns boolean indicating if the input is a valid number
328
+ */
329
+ function isNumber(input) {
330
+ var reg = /^[\d|\.|,]+$/;
331
+ return reg.test(input);
332
+ }
333
+
334
+ /**
335
+ * Check if input is a valid integer
336
+ * @param input - The input to check
337
+ * @returns boolean indicating if the input is a valid integer
338
+ */
339
+ function isInt(input) {
340
+ if (input === "") {
341
+ return false;
342
+ }
343
+ var reg = /\D+/;
344
+ return !reg.test(input);
345
+ }
346
+
347
+ /**
348
+ * Check if input is a valid email address
349
+ * @param input - The input to check
350
+ * @returns boolean indicating if the input is a valid email
351
+ */
352
+ function isEmail(input) {
353
+ var reg = /^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
354
+ return reg.test(input);
355
+ }
356
+
357
+ /**
358
+ * Check if input is a valid telephone number
359
+ * @param input - The input to check
360
+ * @returns boolean indicating if the input is a valid telephone number
361
+ */
362
+ function isTel(input) {
363
+ var reg = /^[0-9- ]{7,20}$/;
364
+ return reg.test(input);
365
+ }
366
+
367
+ /**
368
+ * Check if input is a valid mobile number
369
+ * @param input - The input to check
370
+ * @returns boolean indicating if the input is a valid mobile number
371
+ */
372
+ function isMobile(input) {
373
+ var reg = /^1[0-9]{10}$/;
374
+ return reg.test(input);
286
375
  }
287
376
 
288
377
  /***/
@@ -297,7 +386,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
297
386
  /******/
298
387
  /******/ // The require function
299
388
  /******/
300
- function __nested_webpack_require_12605__(moduleId) {
389
+ function __nested_webpack_require_16046__(moduleId) {
301
390
  /******/ // Check if module is in cache
302
391
  /******/var cachedModule = __webpack_module_cache__[moduleId];
303
392
  /******/
@@ -316,7 +405,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
316
405
  /******/
317
406
  /******/ // Execute the module function
318
407
  /******/
319
- __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_12605__);
408
+ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_16046__);
320
409
  /******/
321
410
  /******/ // Return the exports of the module
322
411
  /******/
@@ -329,9 +418,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
329
418
  /******/
330
419
  (function () {
331
420
  /******/ // define getter functions for harmony exports
332
- /******/__nested_webpack_require_12605__.d = function (exports, definition) {
421
+ /******/__nested_webpack_require_16046__.d = function (exports, definition) {
333
422
  /******/for (var key in definition) {
334
- /******/if (__nested_webpack_require_12605__.o(definition, key) && !__nested_webpack_require_12605__.o(exports, key)) {
423
+ /******/if (__nested_webpack_require_16046__.o(definition, key) && !__nested_webpack_require_16046__.o(exports, key)) {
335
424
  /******/Object.defineProperty(exports, key, {
336
425
  enumerable: true,
337
426
  get: definition[key]
@@ -348,7 +437,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
348
437
  /******/ /* webpack/runtime/hasOwnProperty shorthand */
349
438
  /******/
350
439
  (function () {
351
- /******/__nested_webpack_require_12605__.o = function (obj, prop) {
440
+ /******/__nested_webpack_require_16046__.o = function (obj, prop) {
352
441
  return Object.prototype.hasOwnProperty.call(obj, prop);
353
442
  };
354
443
  /******/
@@ -358,7 +447,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
358
447
  /******/
359
448
  (function () {
360
449
  /******/ // define __esModule on exports
361
- /******/__nested_webpack_require_12605__.r = function (exports) {
450
+ /******/__nested_webpack_require_16046__.r = function (exports) {
362
451
  /******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
363
452
  /******/Object.defineProperty(exports, Symbol.toStringTag, {
364
453
  value: 'Module'
@@ -378,18 +467,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
378
467
  var __webpack_exports__ = {};
379
468
  // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
380
469
  (function () {
381
- __nested_webpack_require_12605__.r(__webpack_exports__);
470
+ __nested_webpack_require_16046__.r(__webpack_exports__);
382
471
  /* harmony export */
383
- __nested_webpack_require_12605__.d(__webpack_exports__, {
472
+ __nested_webpack_require_16046__.d(__webpack_exports__, {
384
473
  /* harmony export */"default": function _default() {
385
474
  return __WEBPACK_DEFAULT_EXPORT__;
386
475
  }
387
476
  /* harmony export */
388
477
  });
389
478
  /* harmony import */
390
- var _easing__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_12605__(357);
479
+ var _easing__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_16046__(357);
391
480
  /* harmony import */
392
- var _initDefaultOptions__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_12605__(65);
481
+ var _initDefaultOptions__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_16046__(65);
393
482
  function _typeof(obj) {
394
483
  "@babel/helpers - typeof";
395
484