funda-ui 4.7.565 → 4.7.582

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 (47) hide show
  1. package/Chatbox/index.js +14 -12
  2. package/Checkbox/index.d.ts +1 -1
  3. package/Checkbox/index.js +3 -3
  4. package/Date/index.js +73 -50
  5. package/EventCalendar/index.js +3 -2
  6. package/EventCalendarTimeline/index.js +6 -4
  7. package/Input/index.d.ts +23 -23
  8. package/Input/index.js +71 -45
  9. package/NumberInput/index.d.ts +4 -4
  10. package/Radio/index.d.ts +1 -1
  11. package/Radio/index.js +12 -6
  12. package/RangeSlider/index.js +71 -45
  13. package/Select/index.d.ts +1 -1
  14. package/Select/index.js +22 -0
  15. package/TagInput/index.d.ts +1 -1
  16. package/Textarea/index.d.ts +17 -17
  17. package/Textarea/index.js +14 -12
  18. package/lib/cjs/Chatbox/index.js +14 -12
  19. package/lib/cjs/Checkbox/index.d.ts +1 -1
  20. package/lib/cjs/Checkbox/index.js +3 -3
  21. package/lib/cjs/Date/index.js +73 -50
  22. package/lib/cjs/EventCalendar/index.js +3 -2
  23. package/lib/cjs/EventCalendarTimeline/index.js +6 -4
  24. package/lib/cjs/Input/index.d.ts +23 -23
  25. package/lib/cjs/Input/index.js +71 -45
  26. package/lib/cjs/NumberInput/index.d.ts +4 -4
  27. package/lib/cjs/Radio/index.d.ts +1 -1
  28. package/lib/cjs/Radio/index.js +12 -6
  29. package/lib/cjs/RangeSlider/index.js +71 -45
  30. package/lib/cjs/Select/index.d.ts +1 -1
  31. package/lib/cjs/Select/index.js +22 -0
  32. package/lib/cjs/TagInput/index.d.ts +1 -1
  33. package/lib/cjs/Textarea/index.d.ts +17 -17
  34. package/lib/cjs/Textarea/index.js +14 -12
  35. package/lib/esm/Chatbox/index.tsx +1 -1
  36. package/lib/esm/Checkbox/index.tsx +4 -4
  37. package/lib/esm/Date/index.tsx +2 -4
  38. package/lib/esm/EventCalendar/index.tsx +2 -2
  39. package/lib/esm/EventCalendarTimeline/index.tsx +6 -4
  40. package/lib/esm/Input/index.tsx +101 -83
  41. package/lib/esm/ModalDialog/index.tsx +1 -0
  42. package/lib/esm/NumberInput/index.tsx +7 -3
  43. package/lib/esm/Radio/index.tsx +16 -8
  44. package/lib/esm/Select/index.tsx +34 -1
  45. package/lib/esm/TagInput/index.tsx +1 -1
  46. package/lib/esm/Textarea/index.tsx +75 -70
  47. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ChangeEvent, KeyboardEvent, FocusEvent } from 'react';
2
2
  export declare type TextareaProps = {
3
3
  contentRef?: React.ForwardedRef<any>;
4
4
  wrapperClassName?: string;
@@ -11,13 +11,13 @@ export declare type TextareaProps = {
11
11
  requiredLabel?: React.ReactNode | string;
12
12
  label?: React.ReactNode | string;
13
13
  name?: string;
14
- minLength?: any;
15
- maxLength?: any;
14
+ minLength?: number;
15
+ maxLength?: number;
16
16
  cols?: number;
17
17
  rows?: number;
18
- disabled?: any;
19
- required?: any;
20
- readOnly?: any;
18
+ disabled?: boolean;
19
+ required?: boolean;
20
+ readOnly?: boolean;
21
21
  placeholder?: string;
22
22
  autoSize?: boolean;
23
23
  autoSizeMaxHeight?: number;
@@ -28,23 +28,23 @@ export declare type TextareaProps = {
28
28
  aiPredictConfirmKey?: Array<string[]>;
29
29
  aiPredictFetchFuncAsync?: any;
30
30
  aiPredictFetchFuncMethod?: string;
31
- aiPredictFetchFuncMethodParams?: any[];
31
+ aiPredictFetchFuncMethodParams?: unknown[];
32
32
  aiPredictFetchCallback?: (data: any) => void;
33
33
  /** -- */
34
34
  id?: string;
35
35
  style?: React.CSSProperties;
36
36
  tabIndex?: number;
37
37
  [key: `data-${string}`]: string | undefined;
38
- onChangeCallback?: (e: any, el: any) => void;
39
- onInputCallback?: (e: any, el: any) => void;
40
- onKeyPressedCallback?: (e: any, el: any) => void;
41
- onChange?: (e: any, el: any, value: string) => void;
42
- onBlur?: (e: any, el: any) => void;
43
- onFocus?: (e: any, el: any) => void;
44
- onPressEnter?: (e: any, el: any) => void;
45
- onKeyDown?: (e: any, el: any) => void;
46
- onKeyUp?: (e: any, el: any) => void;
47
- onResize?: (el: any, params: number[]) => void;
38
+ onChangeCallback?: (e: ChangeEvent<HTMLTextAreaElement> | FocusEvent, el: HTMLTextAreaElement) => string | void;
39
+ onInputCallback?: (e: ChangeEvent<HTMLTextAreaElement> | KeyboardEvent<HTMLTextAreaElement>, el: HTMLTextAreaElement) => string | void;
40
+ onKeyPressedCallback?: (e: KeyboardEvent<HTMLTextAreaElement>, el: HTMLTextAreaElement) => string | void;
41
+ onChange?: (e: ChangeEvent<HTMLTextAreaElement> | KeyboardEvent<HTMLTextAreaElement> | null, el: HTMLTextAreaElement, value: string) => void;
42
+ onBlur?: (e: FocusEvent, el: HTMLTextAreaElement) => void;
43
+ onFocus?: (e: FocusEvent, el: HTMLTextAreaElement) => void;
44
+ onPressEnter?: (e: KeyboardEvent<HTMLTextAreaElement>, el: HTMLTextAreaElement) => void;
45
+ onKeyDown?: (e: KeyboardEvent<HTMLTextAreaElement>, el: HTMLTextAreaElement) => void;
46
+ onKeyUp?: (e: KeyboardEvent<HTMLTextAreaElement>, el: HTMLTextAreaElement) => void;
47
+ onResize?: (el: HTMLTextAreaElement, params: number[]) => void;
48
48
  };
49
49
  declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<unknown>>;
50
50
  export default Textarea;
package/Textarea/index.js CHANGED
@@ -1392,7 +1392,7 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1392
1392
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1393
1393
  while (1) switch (_context.prev = _context.next) {
1394
1394
  case 0:
1395
- if (!(_typeof(aiPredictFetchFuncAsync) === 'object')) {
1395
+ if (!(_typeof(aiPredictFetchFuncAsync) === 'object' && aiPredictFetchFuncMethod)) {
1396
1396
  _context.next = 11;
1397
1397
  break;
1398
1398
  }
@@ -1429,8 +1429,10 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1429
1429
  if (valRef.current) {
1430
1430
  var canvas = document.createElement('canvas');
1431
1431
  var context = canvas.getContext('2d');
1432
- context.font = "".concat(originInputComputedStyle.current.fontSize, "px ").concat(originInputComputedStyle.current.fontFamily);
1433
- return context.measureText(text).width;
1432
+ if (context) {
1433
+ context.font = "".concat(originInputComputedStyle.current.fontSize, "px ").concat(originInputComputedStyle.current.fontFamily);
1434
+ return context.measureText(text).width;
1435
+ }
1434
1436
  }
1435
1437
  return 0;
1436
1438
  };
@@ -1449,7 +1451,7 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1449
1451
  // Match exactly from the start
1450
1452
  //----------------
1451
1453
  var preciseMatch = function preciseMatch(input, suggestions) {
1452
- if (!input) return '';
1454
+ if (!input) return [];
1453
1455
  var filtered = suggestions.filter(function (s) {
1454
1456
  return s.toLowerCase().startsWith(input.toLowerCase());
1455
1457
  });
@@ -1460,7 +1462,7 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1460
1462
  // Fuzzy matching
1461
1463
  //----------------
1462
1464
  var fuzzyMatch = function fuzzyMatch(input, suggestions) {
1463
- if (!input) return '';
1465
+ if (!input) return [];
1464
1466
 
1465
1467
  // Convert input to a regular expression pattern with support for arbitrary position matching
1466
1468
  var pattern = input.split('').map(function (_char) {
@@ -1580,7 +1582,7 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1580
1582
  onChange === null || onChange === void 0 ? void 0 : onChange(event, valRef.current, curVal);
1581
1583
 
1582
1584
  // It fires in real time as the user enters
1583
- if (typeof onInputCallback === 'function') {
1585
+ if (typeof onInputCallback === 'function' && event) {
1584
1586
  var newData = onInputCallback(event, valRef.current);
1585
1587
  if (newData) setChangedVal(newData); // Avoid the error "react checkbox changing an uncontrolled input to be controlled"
1586
1588
  }
@@ -1588,7 +1590,7 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1588
1590
 
1589
1591
  function handleBlur(event) {
1590
1592
  var el = event.target;
1591
- var val = event.target.value;
1593
+ var val = el.value;
1592
1594
 
1593
1595
  //----
1594
1596
  //remove focus style
@@ -1743,8 +1745,8 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1743
1745
  placeholder: placeholder || '',
1744
1746
  defaultValue: defaultValue,
1745
1747
  value: changedVal,
1746
- minLength: minLength || null,
1747
- maxLength: maxLength || null,
1748
+ minLength: minLength || undefined,
1749
+ maxLength: maxLength || undefined,
1748
1750
  onFocus: handleFocus,
1749
1751
  onBlur: handleBlur,
1750
1752
  onChange: function onChange(e) {
@@ -1757,9 +1759,9 @@ var Textarea = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
1757
1759
  },
1758
1760
  onKeyDown: handleKeyPressed,
1759
1761
  onKeyUp: handleKeyUp,
1760
- disabled: disabled || null,
1761
- required: required || null,
1762
- readOnly: readOnly || null,
1762
+ disabled: disabled || undefined,
1763
+ required: required || undefined,
1764
+ readOnly: readOnly || undefined,
1763
1765
  cols: cols || 20,
1764
1766
  rows: rows || 2,
1765
1767
  style: style
@@ -2120,7 +2120,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
2120
2120
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2121
2121
  while (1) switch (_context.prev = _context.next) {
2122
2122
  case 0:
2123
- if (!(_typeof(aiPredictFetchFuncAsync) === 'object')) {
2123
+ if (!(_typeof(aiPredictFetchFuncAsync) === 'object' && aiPredictFetchFuncMethod)) {
2124
2124
  _context.next = 11;
2125
2125
  break;
2126
2126
  }
@@ -2157,8 +2157,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
2157
2157
  if (valRef.current) {
2158
2158
  var canvas = document.createElement('canvas');
2159
2159
  var context = canvas.getContext('2d');
2160
- context.font = "".concat(originInputComputedStyle.current.fontSize, "px ").concat(originInputComputedStyle.current.fontFamily);
2161
- return context.measureText(text).width;
2160
+ if (context) {
2161
+ context.font = "".concat(originInputComputedStyle.current.fontSize, "px ").concat(originInputComputedStyle.current.fontFamily);
2162
+ return context.measureText(text).width;
2163
+ }
2162
2164
  }
2163
2165
  return 0;
2164
2166
  };
@@ -2177,7 +2179,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
2177
2179
  // Match exactly from the start
2178
2180
  //----------------
2179
2181
  var preciseMatch = function preciseMatch(input, suggestions) {
2180
- if (!input) return '';
2182
+ if (!input) return [];
2181
2183
  var filtered = suggestions.filter(function (s) {
2182
2184
  return s.toLowerCase().startsWith(input.toLowerCase());
2183
2185
  });
@@ -2188,7 +2190,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
2188
2190
  // Fuzzy matching
2189
2191
  //----------------
2190
2192
  var fuzzyMatch = function fuzzyMatch(input, suggestions) {
2191
- if (!input) return '';
2193
+ if (!input) return [];
2192
2194
 
2193
2195
  // Convert input to a regular expression pattern with support for arbitrary position matching
2194
2196
  var pattern = input.split('').map(function (_char) {
@@ -2308,7 +2310,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
2308
2310
  onChange === null || onChange === void 0 ? void 0 : onChange(event, valRef.current, curVal);
2309
2311
 
2310
2312
  // It fires in real time as the user enters
2311
- if (typeof onInputCallback === 'function') {
2313
+ if (typeof onInputCallback === 'function' && event) {
2312
2314
  var newData = onInputCallback(event, valRef.current);
2313
2315
  if (newData) setChangedVal(newData); // Avoid the error "react checkbox changing an uncontrolled input to be controlled"
2314
2316
  }
@@ -2316,7 +2318,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
2316
2318
 
2317
2319
  function handleBlur(event) {
2318
2320
  var el = event.target;
2319
- var val = event.target.value;
2321
+ var val = el.value;
2320
2322
 
2321
2323
  //----
2322
2324
  //remove focus style
@@ -2471,8 +2473,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
2471
2473
  placeholder: placeholder || '',
2472
2474
  defaultValue: defaultValue,
2473
2475
  value: changedVal,
2474
- minLength: minLength || null,
2475
- maxLength: maxLength || null,
2476
+ minLength: minLength || undefined,
2477
+ maxLength: maxLength || undefined,
2476
2478
  onFocus: handleFocus,
2477
2479
  onBlur: handleBlur,
2478
2480
  onChange: function onChange(e) {
@@ -2485,9 +2487,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
2485
2487
  },
2486
2488
  onKeyDown: handleKeyPressed,
2487
2489
  onKeyUp: handleKeyUp,
2488
- disabled: disabled || null,
2489
- required: required || null,
2490
- readOnly: readOnly || null,
2490
+ disabled: disabled || undefined,
2491
+ required: required || undefined,
2492
+ readOnly: readOnly || undefined,
2491
2493
  cols: cols || 20,
2492
2494
  rows: rows || 2,
2493
2495
  style: style
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type CheckboxOptionChangeFnType = (arg1: any, arg2: any) => void;
2
+ export declare type CheckboxOptionChangeFnType = (e: React.ChangeEvent<HTMLInputElement> | null, val: boolean, element: HTMLElement) => void;
3
3
  export declare type CheckboxProps = {
4
4
  contentRef?: React.ForwardedRef<any>;
5
5
  wrapperClassName?: string;
@@ -555,14 +555,14 @@ var Checkbox = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
555
555
  setVal(false);
556
556
  cb === null || cb === void 0 ? void 0 : cb();
557
557
  if (typeof onChange === 'function') {
558
- onChange(null, false);
558
+ onChange(null, false, valRef.current);
559
559
  }
560
560
  },
561
561
  set: function set(value, cb) {
562
562
  setVal(value);
563
563
  cb === null || cb === void 0 ? void 0 : cb();
564
564
  if (typeof onChange === 'function') {
565
- onChange(null, value);
565
+ onChange(null, value, valRef.current);
566
566
  }
567
567
  }
568
568
  };
@@ -585,7 +585,7 @@ var Checkbox = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(fu
585
585
 
586
586
  //
587
587
  if (typeof onChange === 'function') {
588
- onChange(event, _val);
588
+ onChange(event, _val, valRef.current);
589
589
  }
590
590
  }
591
591
  function handleBlur(event) {
@@ -1598,14 +1598,17 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1598
1598
  _useState12 = _slicedToArray(_useState11, 2),
1599
1599
  hasErr = _useState12[0],
1600
1600
  setHasErr = _useState12[1];
1601
- var currentSuggestionIndex = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0);
1601
+ var _useState13 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(0),
1602
+ _useState14 = _slicedToArray(_useState13, 2),
1603
+ currentSuggestionIndex = _useState14[0],
1604
+ setCurrentSuggestionIndex = _useState14[1];
1602
1605
 
1603
1606
  // A list of suggestions
1604
1607
  //----------------
1605
- var _useState13 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
1606
- _useState14 = _slicedToArray(_useState13, 2),
1607
- suggestions = _useState14[0],
1608
- setSuggestions = _useState14[1];
1608
+ var _useState15 = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
1609
+ _useState16 = _slicedToArray(_useState15, 2),
1610
+ suggestions = _useState16[0],
1611
+ setSuggestions = _useState16[1];
1609
1612
 
1610
1613
  //performance
1611
1614
  var handleChangeSuggestionsFetchSafe = funda_utils_dist_cjs_useDebounce__WEBPACK_IMPORTED_MODULE_4___default()(function (e, curVal) {
@@ -1623,12 +1626,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1623
1626
  //----------------
1624
1627
  function _fetchSuggestionsData() {
1625
1628
  _fetchSuggestionsData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
1626
- var response, _ORGIN_DATA;
1629
+ var response, _ORGIN_DATA, suggestionsArray;
1627
1630
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1628
1631
  while (1) switch (_context.prev = _context.next) {
1629
1632
  case 0:
1630
1633
  if (!(_typeof(aiPredictFetchFuncAsync) === 'object')) {
1631
- _context.next = 11;
1634
+ _context.next = 12;
1632
1635
  break;
1633
1636
  }
1634
1637
  _context.next = 3;
@@ -1647,12 +1650,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1647
1650
  _ORGIN_DATA = [];
1648
1651
  }
1649
1652
 
1650
- //
1651
- setSuggestions(_ORGIN_DATA);
1652
- return _context.abrupt("return", _ORGIN_DATA);
1653
- case 11:
1654
- return _context.abrupt("return", []);
1653
+ // Type assertion since we've verified it's an array
1654
+ suggestionsArray = _ORGIN_DATA; //
1655
+ setSuggestions(suggestionsArray);
1656
+ return _context.abrupt("return", suggestionsArray);
1655
1657
  case 12:
1658
+ return _context.abrupt("return", []);
1659
+ case 13:
1656
1660
  case "end":
1657
1661
  return _context.stop();
1658
1662
  }
@@ -1664,8 +1668,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1664
1668
  if (valRef.current) {
1665
1669
  var canvas = document.createElement('canvas');
1666
1670
  var context = canvas.getContext('2d');
1667
- context.font = "".concat(originInputComputedStyle.current.fontSize, "px ").concat(originInputComputedStyle.current.fontFamily);
1668
- return context.measureText(text).width;
1671
+ if (context) {
1672
+ context.font = "".concat(originInputComputedStyle.current.fontSize, "px ").concat(originInputComputedStyle.current.fontFamily);
1673
+ return context.measureText(text).width;
1674
+ }
1669
1675
  }
1670
1676
  return 0;
1671
1677
  };
@@ -1761,12 +1767,16 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1761
1767
  clear: function clear(cb) {
1762
1768
  setChangedVal('');
1763
1769
  cb === null || cb === void 0 ? void 0 : cb();
1764
- onChange === null || onChange === void 0 ? void 0 : onChange(null, onComposition, valRef.current, '');
1770
+ if (valRef.current) {
1771
+ onChange === null || onChange === void 0 ? void 0 : onChange(null, onComposition, valRef.current, '');
1772
+ }
1765
1773
  },
1766
1774
  set: function set(value, cb) {
1767
1775
  setChangedVal("".concat(value));
1768
1776
  cb === null || cb === void 0 ? void 0 : cb();
1769
- onChange === null || onChange === void 0 ? void 0 : onChange(null, onComposition, valRef.current, "".concat(value));
1777
+ if (valRef.current) {
1778
+ onChange === null || onChange === void 0 ? void 0 : onChange(null, onComposition, valRef.current, "".concat(value));
1779
+ }
1770
1780
  },
1771
1781
  aiPredictReset: function aiPredictReset() {
1772
1782
  setTimeout(function () {
@@ -1792,7 +1802,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1792
1802
  (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.classList.add('focus');
1793
1803
 
1794
1804
  //
1795
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(event, onComposition, valRef.current);
1805
+ if (valRef.current) {
1806
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(event, onComposition, valRef.current);
1807
+ }
1796
1808
  }
1797
1809
  function handleChange(event, curVal) {
1798
1810
  setChangedVal(curVal);
@@ -1805,10 +1817,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1805
1817
  }
1806
1818
 
1807
1819
  //
1808
- onChange === null || onChange === void 0 ? void 0 : onChange(event, onComposition, valRef.current, curVal);
1820
+ if (valRef.current) {
1821
+ onChange === null || onChange === void 0 ? void 0 : onChange(event, onComposition, valRef.current, curVal);
1822
+ }
1809
1823
 
1810
1824
  // It fires in real time as the user enters
1811
- if (typeof onInputCallback === 'function') {
1825
+ if (typeof onInputCallback === 'function' && event && valRef.current) {
1812
1826
  var newData = onInputCallback(event, valRef.current);
1813
1827
  if (newData) setChangedVal(newData); // Avoid the error "react checkbox changing an uncontrolled input to be controlled"
1814
1828
  }
@@ -1826,25 +1840,31 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1826
1840
  }
1827
1841
 
1828
1842
  //
1829
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(event, onComposition, valRef.current);
1843
+ if (valRef.current) {
1844
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event, onComposition, valRef.current);
1845
+ }
1830
1846
 
1831
1847
  // It fires when focus is lost
1832
- if (typeof onChangeCallback === 'function') {
1848
+ if (typeof onChangeCallback === 'function' && valRef.current) {
1833
1849
  var newData = onChangeCallback(event, valRef.current);
1834
1850
  if (newData) setChangedVal(newData); // Avoid the error "react checkbox changing an uncontrolled input to be controlled"
1835
1851
  }
1836
1852
  }
1837
1853
 
1838
1854
  function handleKeyPressed(event) {
1839
- onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event, valRef.current);
1840
- if (typeof onKeyPressedCallback === 'function') {
1855
+ if (valRef.current) {
1856
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event, valRef.current);
1857
+ }
1858
+ if (typeof onKeyPressedCallback === 'function' && valRef.current) {
1841
1859
  var newData = onKeyPressedCallback(event, valRef.current);
1842
1860
  if (newData) setChangedVal(newData); // Avoid the error "react checkbox changing an uncontrolled input to be controlled"
1843
1861
  }
1844
1862
 
1845
1863
  if (event.key === 'Enter' || event.key === 'NumpadEnter') {
1846
1864
  // DO NOT USE "preventDefault()"
1847
- onPressEnter === null || onPressEnter === void 0 ? void 0 : onPressEnter(event, valRef.current);
1865
+ if (valRef.current) {
1866
+ onPressEnter === null || onPressEnter === void 0 ? void 0 : onPressEnter(event, valRef.current);
1867
+ }
1848
1868
  }
1849
1869
 
1850
1870
  // AI Predict
@@ -1872,16 +1892,22 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1872
1892
 
1873
1893
  // switch result of suggestions
1874
1894
  if (event.code === 'ArrowUp') {
1875
- currentSuggestionIndex.current = (currentSuggestionIndex.current - 1 + tempMatchedSuggestion.length) % tempMatchedSuggestion.length;
1895
+ setCurrentSuggestionIndex(function (prev) {
1896
+ return (prev - 1 + tempMatchedSuggestion.length) % tempMatchedSuggestion.length;
1897
+ });
1876
1898
  }
1877
1899
  if (event.code === 'ArrowDown') {
1878
- currentSuggestionIndex.current = (currentSuggestionIndex.current + 1) % tempMatchedSuggestion.length;
1900
+ setCurrentSuggestionIndex(function (prev) {
1901
+ return (prev + 1) % tempMatchedSuggestion.length;
1902
+ });
1879
1903
  }
1880
- setCurrentSuggestion(tempMatchedSuggestion[currentSuggestionIndex.current] || '');
1904
+ setCurrentSuggestion(tempMatchedSuggestion[currentSuggestionIndex] || '');
1881
1905
  }
1882
1906
  }
1883
1907
  function handleKeyUp(event) {
1884
- onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(event, valRef.current);
1908
+ if (valRef.current) {
1909
+ onKeyUp === null || onKeyUp === void 0 ? void 0 : onKeyUp(event, valRef.current);
1910
+ }
1885
1911
  }
1886
1912
  (0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
1887
1913
  // update default value
@@ -1948,18 +1974,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1948
1974
  }),
1949
1975
  id: idRes,
1950
1976
  name: name,
1951
- step: step || null,
1952
- min: min || null,
1953
- max: max || null,
1954
- src: src || null,
1955
- size: size || null,
1956
- alt: alt || null,
1977
+ step: step || undefined,
1978
+ min: min || undefined,
1979
+ max: max || undefined,
1980
+ src: src || undefined,
1981
+ size: typeof size === 'number' ? size : undefined,
1982
+ alt: alt || undefined,
1957
1983
  inputMode: inputMode || undefined,
1958
- pattern: pattern || null,
1984
+ pattern: pattern || undefined,
1959
1985
  placeholder: placeholder || '',
1960
1986
  value: changedVal,
1961
- minLength: minLength || null,
1962
- maxLength: maxLength || null,
1987
+ minLength: typeof minLength === 'number' ? minLength : undefined,
1988
+ maxLength: typeof maxLength === 'number' ? maxLength : undefined,
1963
1989
  autoComplete: typeof autoComplete === 'undefined' ? 'on' : autoComplete,
1964
1990
  autoCapitalize: typeof autoCapitalize === 'undefined' ? 'off' : autoCapitalize,
1965
1991
  spellCheck: typeof spellCheck === 'undefined' ? false : spellCheck,
@@ -1978,22 +2004,22 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
1978
2004
  onCompositionStart: handleComposition,
1979
2005
  onCompositionUpdate: handleComposition,
1980
2006
  onCompositionEnd: handleComposition,
1981
- disabled: disabled || null,
1982
- required: required || null,
1983
- readOnly: readOnly || null,
2007
+ disabled: disabled || undefined,
2008
+ required: required || undefined,
2009
+ readOnly: readOnly || undefined,
1984
2010
  style: style
1985
2011
  }, attributes)), appendControl || '', aiPredict && remainingText && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
1986
2012
  ref: aiInputRef,
1987
2013
  className: "position-absolute z-1",
1988
2014
  "data-ai": "predict",
1989
2015
  style: {
1990
- left: "".concat(originInputComputedStyle.current.fontSize + textWidth, "px"),
1991
- top: originInputComputedStyle.current.textTop + 'px',
2016
+ left: "".concat((typeof originInputComputedStyle.current.fontSize === 'number' ? originInputComputedStyle.current.fontSize : 16) + textWidth, "px"),
2017
+ top: (typeof originInputComputedStyle.current.textTop === 'number' ? originInputComputedStyle.current.textTop : 10) + 'px',
1992
2018
  color: "rgba(".concat(aiPredictRemainingTextRGB[0], ", ").concat(aiPredictRemainingTextRGB[1], ", ").concat(aiPredictRemainingTextRGB[2], ", ").concat(calculateOpacity(), ")"),
1993
2019
  pointerEvents: 'none',
1994
- fontSize: originInputComputedStyle.current.fontSize + 'px',
1995
- fontFamily: originInputComputedStyle.current.fontFamily,
1996
- letterSpacing: originInputComputedStyle.current.letterSpacing
2020
+ fontSize: (typeof originInputComputedStyle.current.fontSize === 'number' ? originInputComputedStyle.current.fontSize : 16) + 'px',
2021
+ fontFamily: typeof originInputComputedStyle.current.fontFamily === 'string' ? originInputComputedStyle.current.fontFamily : 'inherit',
2022
+ letterSpacing: typeof originInputComputedStyle.current.letterSpacing === 'string' ? originInputComputedStyle.current.letterSpacing : 'normal'
1997
2023
  }
1998
2024
  }, remainingText), required ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, requiredLabel || requiredLabel === '' ? requiredLabel : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
1999
2025
  className: "position-absolute end-0 top-0 my-2 mx-2"
@@ -5405,11 +5431,8 @@ var src_Date = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
5405
5431
  //
5406
5432
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(inputRef.current, getAllSplittingInputs());
5407
5433
  }
5408
- function handleChange(event) {
5409
- var val = event.target.value;
5410
-
5411
- //
5412
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(inputRef.current, val, (0,cjs_date.isValidDate)(val), getAllSplittingInputs());
5434
+ function handleChange(e, isComposition, el, value) {
5435
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(inputRef.current, value, (0,cjs_date.isValidDate)(value), getAllSplittingInputs());
5413
5436
  }
5414
5437
  function handleBlur(event) {
5415
5438
  var _rootRef$current3;
@@ -3602,9 +3602,10 @@ var EventCalendar = function EventCalendar(props) {
3602
3602
  className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)('custom-event-cal__cell custom-event-cal__day', {
3603
3603
  'empty': !isInteractive,
3604
3604
  'today': d === now.getDate(),
3605
- 'selected': d === day,
3605
+ 'selected': d === day && isInteractive,
3606
3606
  'last-cell': isLastCell,
3607
- 'last-row': isLastRow
3607
+ 'last-row': isLastRow,
3608
+ 'disabled': !isInteractive
3608
3609
  }),
3609
3610
  key: "col" + i,
3610
3611
  "data-date": (0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_1__.getCalendarDate)(_dateShow),
@@ -5090,8 +5090,9 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5090
5090
  className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_7__.combinedCls)('custom-event-tl-table__cell-cushion-headercontent__container', {
5091
5091
  'empty': !isInteractive,
5092
5092
  'today': d === now.getDate(),
5093
- 'selected': "".concat(year, "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(month + 1), "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(day)) === "".concat(year, "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(month + 1), "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(d)),
5094
- 'last-cell': isLastCol
5093
+ 'selected': "".concat(year, "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(month + 1), "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(day)) === "".concat(year, "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(month + 1), "-").concat((0,funda_utils_dist_cjs_date__WEBPACK_IMPORTED_MODULE_6__.padZero)(d)) && isInteractive,
5094
+ 'last-cell': isLastCol,
5095
+ 'disabled': !isInteractive
5095
5096
  }),
5096
5097
  key: "col" + i,
5097
5098
  "data-index": colIndex - 1,
@@ -5314,8 +5315,9 @@ var EventCalendarTimeline = function EventCalendarTimeline(props) {
5314
5315
  'has-event': eventSourcesData && _currentData.length > 0,
5315
5316
  'empty': !isInteractive,
5316
5317
  'today': d === now.getDate(),
5317
- 'selected': isCellSelected(rowIndex, dayIndex),
5318
- 'last-cell': isLastCol
5318
+ 'selected': isCellSelected(rowIndex, dayIndex) && isInteractive,
5319
+ 'last-cell': isLastCol,
5320
+ 'disabled': !isInteractive
5319
5321
  }),
5320
5322
  key: "col" + i,
5321
5323
  "data-index": colIndex - 1,
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { ChangeEvent, KeyboardEvent, FocusEvent } from 'react';
2
2
  export declare type InputProps = {
3
3
  contentRef?: React.ForwardedRef<any>;
4
4
  wrapperClassName?: string;
@@ -13,20 +13,20 @@ export declare type InputProps = {
13
13
  label?: React.ReactNode | string;
14
14
  units?: React.ReactNode | string;
15
15
  name?: string;
16
- step?: any;
17
- min?: any;
18
- max?: any;
19
- src?: any;
20
- size?: any;
21
- minLength?: any;
22
- maxLength?: any;
23
- alt?: any;
16
+ step?: string | number;
17
+ min?: string | number;
18
+ max?: string | number;
19
+ src?: string;
20
+ size?: string | number;
21
+ minLength?: string | number;
22
+ maxLength?: string | number;
23
+ alt?: string;
24
24
  inputMode?: "search" | "text" | "email" | "tel" | "url" | "none" | "numeric" | "decimal" | undefined;
25
- disabled?: any;
26
- required?: any;
27
- readOnly?: any;
25
+ disabled?: boolean;
26
+ required?: boolean;
27
+ readOnly?: boolean;
28
28
  placeholder?: string;
29
- pattern?: any;
29
+ pattern?: string;
30
30
  iconLeft?: React.ReactNode | string;
31
31
  iconRight?: React.ReactNode | string;
32
32
  appendControl?: React.ReactNode;
@@ -35,7 +35,7 @@ export declare type InputProps = {
35
35
  aiPredictConfirmKey?: Array<string[]>;
36
36
  aiPredictFetchFuncAsync?: any;
37
37
  aiPredictFetchFuncMethod?: string;
38
- aiPredictFetchFuncMethodParams?: any[];
38
+ aiPredictFetchFuncMethodParams?: (string | number)[];
39
39
  aiPredictFetchCallback?: (data: any) => void;
40
40
  /** -- */
41
41
  id?: string;
@@ -45,15 +45,15 @@ export declare type InputProps = {
45
45
  spellCheck?: boolean;
46
46
  tabIndex?: number;
47
47
  [key: `data-${string}`]: string | undefined;
48
- onChangeCallback?: (e: any, el: any) => void;
49
- onInputCallback?: (e: any, el: any) => void;
50
- onKeyPressedCallback?: (e: any, el: any) => void;
51
- onChange?: (e: any, param: any, el: any, value: string) => void;
52
- onBlur?: (e: any, param: any, el: any) => void;
53
- onFocus?: (e: any, param: any, el: any) => void;
54
- onPressEnter?: (e: any, el: any) => void;
55
- onKeyDown?: (e: any, el: any) => void;
56
- onKeyUp?: (e: any, el: any) => void;
48
+ onChangeCallback?: (e: ChangeEvent<HTMLInputElement> | FocusEvent<HTMLInputElement>, el: HTMLInputElement) => string | void;
49
+ onInputCallback?: (e: ChangeEvent<HTMLInputElement>, el: HTMLInputElement) => string | void;
50
+ onKeyPressedCallback?: (e: KeyboardEvent<HTMLInputElement>, el: HTMLInputElement) => string | void;
51
+ onChange?: (e: ChangeEvent<HTMLInputElement> | KeyboardEvent<HTMLInputElement> | null, isComposition: boolean, el: HTMLInputElement, value: string) => void;
52
+ onBlur?: (e: FocusEvent<HTMLInputElement>, param: boolean, el: HTMLInputElement) => void;
53
+ onFocus?: (e: FocusEvent<HTMLInputElement>, param: boolean, el: HTMLInputElement) => void;
54
+ onPressEnter?: (e: KeyboardEvent<HTMLInputElement>, el: HTMLInputElement) => void;
55
+ onKeyDown?: (e: KeyboardEvent<HTMLInputElement>, el: HTMLInputElement) => void;
56
+ onKeyUp?: (e: KeyboardEvent<HTMLInputElement>, el: HTMLInputElement) => void;
57
57
  };
58
58
  declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<unknown>>;
59
59
  export default Input;