funda-ui 4.7.125 → 4.7.150

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 (60) hide show
  1. package/CascadingSelect/index.css +15 -4
  2. package/CascadingSelect/index.d.ts +2 -0
  3. package/CascadingSelect/index.js +294 -22
  4. package/CascadingSelectE2E/index.css +15 -4
  5. package/CascadingSelectE2E/index.d.ts +2 -0
  6. package/CascadingSelectE2E/index.js +300 -28
  7. package/Checkbox/index.js +4 -2
  8. package/LiveSearch/index.js +2 -1
  9. package/README.md +1 -2
  10. package/Refresher/index.d.ts +22 -0
  11. package/Refresher/index.js +564 -0
  12. package/Select/index.css +33 -0
  13. package/Select/index.d.ts +1 -0
  14. package/Select/index.js +350 -39
  15. package/SplitterPanel/index.js +67 -3
  16. package/Switch/index.js +4 -2
  17. package/Utils/format-string.d.ts +2 -1
  18. package/Utils/format-string.js +22 -12
  19. package/Utils/time.d.ts +3 -3
  20. package/Utils/useIsMobile.js +67 -3
  21. package/all.d.ts +1 -0
  22. package/all.js +1 -0
  23. package/lib/cjs/CascadingSelect/index.d.ts +2 -0
  24. package/lib/cjs/CascadingSelect/index.js +294 -22
  25. package/lib/cjs/CascadingSelectE2E/index.d.ts +2 -0
  26. package/lib/cjs/CascadingSelectE2E/index.js +300 -28
  27. package/lib/cjs/Checkbox/index.js +4 -2
  28. package/lib/cjs/LiveSearch/index.js +2 -1
  29. package/lib/cjs/Refresher/index.d.ts +22 -0
  30. package/lib/cjs/Refresher/index.js +564 -0
  31. package/lib/cjs/Select/index.d.ts +1 -0
  32. package/lib/cjs/Select/index.js +350 -39
  33. package/lib/cjs/SplitterPanel/index.js +67 -3
  34. package/lib/cjs/Switch/index.js +4 -2
  35. package/lib/cjs/Utils/format-string.d.ts +2 -1
  36. package/lib/cjs/Utils/format-string.js +22 -12
  37. package/lib/cjs/Utils/time.d.ts +3 -3
  38. package/lib/cjs/Utils/useIsMobile.js +67 -3
  39. package/lib/cjs/index.d.ts +1 -0
  40. package/lib/cjs/index.js +1 -0
  41. package/lib/css/CascadingSelect/index.css +15 -4
  42. package/lib/css/CascadingSelectE2E/index.css +15 -4
  43. package/lib/css/Select/index.css +33 -0
  44. package/lib/esm/CascadingSelect/index.scss +22 -7
  45. package/lib/esm/CascadingSelect/index.tsx +49 -1
  46. package/lib/esm/CascadingSelectE2E/Group.tsx +1 -0
  47. package/lib/esm/CascadingSelectE2E/index.scss +23 -6
  48. package/lib/esm/CascadingSelectE2E/index.tsx +53 -1
  49. package/lib/esm/Checkbox/index.tsx +5 -3
  50. package/lib/esm/LiveSearch/index.tsx +2 -1
  51. package/lib/esm/Refresher/index.tsx +121 -0
  52. package/lib/esm/Select/index.scss +43 -2
  53. package/lib/esm/Select/index.tsx +81 -24
  54. package/lib/esm/Select/utils/func.ts +0 -10
  55. package/lib/esm/Switch/index.tsx +4 -2
  56. package/lib/esm/Utils/hooks/useIsMobile.tsx +88 -5
  57. package/lib/esm/Utils/libs/format-string.ts +22 -12
  58. package/lib/esm/Utils/libs/time.ts +6 -6
  59. package/lib/esm/index.js +1 -0
  60. package/package.json +1 -1
@@ -446,7 +446,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
446
446
  */
447
447
 
448
448
  var useIsMobile = function useIsMobile() {
449
- var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 768;
449
+ var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 600;
450
450
  var _useState = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
451
451
  _useState2 = _slicedToArray(_useState, 2),
452
452
  isMobile = _useState2[0],
@@ -459,8 +459,72 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
459
459
  // Set the mounted state to true after the component has mounted
460
460
  setIsMounted(true);
461
461
  var handleResize = function handleResize() {
462
- if (window) {
463
- setIsMobile(window.innerWidth <= breakpoint);
462
+ if (typeof window !== 'undefined') {
463
+ var detectDeviceType = function detectDeviceType() {
464
+ // 1. First check if window and navigator are available (SSR compatibility)
465
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
466
+ return 'desktop'; // Default to desktop
467
+ }
468
+
469
+ // 2. Get user agent string
470
+ var ua = navigator.userAgent.toLowerCase();
471
+
472
+ // 3. Get platform info
473
+ var platform = navigator.platform ? navigator.platform.toLowerCase() : '';
474
+
475
+ // 4. Check screen characteristics using window.matchMedia
476
+ var isTouch = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
477
+ var isPortrait = window.matchMedia('(orientation: portrait)').matches;
478
+ var isLandscape = window.matchMedia('(orientation: landscape)').matches;
479
+
480
+ // 5. Get screen dimensions
481
+ var screenWidth = window.screen.width;
482
+ var screenHeight = window.screen.height;
483
+ var minScreenSize = Math.min(screenWidth, screenHeight);
484
+ var maxScreenSize = Math.max(screenWidth, screenHeight);
485
+
486
+ // Define device characteristics
487
+ var isTablet =
488
+ // Traditional UA detection
489
+ /ipad/.test(ua) || /android/.test(ua) && !/mobile/.test(ua) || /tablet/.test(ua) || /playbook/.test(ua) || /nexus (7|9|10)/.test(ua) || /sm-t/.test(ua) || /huawei(.*)mediapad/.test(ua) ||
490
+ // Special detection for iPad Pro and newer iPads
491
+ navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 ||
492
+ // Screen size characteristics (tablets typically fall within this range)
493
+ minScreenSize >= breakpoint && maxScreenSize <= 1366 && isTouch ||
494
+ // Specific device detection
495
+ /kindle|silk|kftt|kfot|kfjwa|kfjwi|kfsowi|kfthwa|kfthwi|kfapwa|kfapwi/i.test(ua);
496
+ var isMobile = !isTablet && (
497
+ // Prevent tablets from being detected as phones
498
+ // Traditional mobile device detection
499
+ /iphone|ipod|android.*mobile|windows phone|mobi/.test(ua) ||
500
+ // Screen size characteristics (phones typically smaller than 600px)
501
+ minScreenSize < breakpoint && isTouch ||
502
+ // Additional mobile device detection
503
+ /blackberry|\bbb\d+|meego|webos|palm|phone|pocket|mobile|mini|iemobile/i.test(ua));
504
+
505
+ // 6. Comprehensive decision logic
506
+ if (isMobile) {
507
+ // Additional check for small tablets
508
+ if (maxScreenSize >= 1024 && isTouch) {
509
+ return 'tablet';
510
+ }
511
+ return 'mobile';
512
+ }
513
+ if (isTablet) {
514
+ // Additional check for touch-enabled laptops
515
+ if (maxScreenSize > 1366 && /windows/.test(ua)) {
516
+ return 'desktop';
517
+ }
518
+ return 'tablet';
519
+ }
520
+
521
+ // 7. Check for touch-enabled laptops
522
+ if (isTouch && /windows/.test(ua) && maxScreenSize > 1366) {
523
+ return 'desktop';
524
+ }
525
+ return 'desktop';
526
+ };
527
+ setIsMobile(detectDeviceType() === 'mobile');
464
528
  }
465
529
  };
466
530
 
package/Switch/index.js CHANGED
@@ -533,7 +533,7 @@ var Switch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(func
533
533
  var uniqueID = funda_utils_dist_cjs_useComId__WEBPACK_IMPORTED_MODULE_1___default()();
534
534
  var idRes = id || uniqueID;
535
535
  var rootRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
536
- var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)( false || false),
536
+ var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
537
537
  _useState2 = _slicedToArray(_useState, 2),
538
538
  val = _useState2[0],
539
539
  setVal = _useState2[1]; // Avoid the error "react checkbox changing an uncontrolled input to be controlled"
@@ -569,7 +569,9 @@ var Switch = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(func
569
569
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
570
570
  }
571
571
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
572
- setVal(checked);
572
+ if (typeof checked === 'boolean') {
573
+ setVal(checked);
574
+ }
573
575
  }, [checked]);
574
576
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
575
577
  className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.clsWrite)(wrapperClassName, 'mb-3 position-relative'),
@@ -32,13 +32,14 @@ declare function trimAll(input: string): string;
32
32
  */
33
33
  declare function multiSpacesToSingle(input: string): string;
34
34
  /**
35
- * Convert HTML text to plain text
35
+ * Convert HTML text to plain text (Remove html tag content)
36
36
  * @param {string} input - The input string to process
37
37
  * @returns {string} The processed string
38
38
  */
39
39
  declare function htmlToPlain(input: string): string;
40
40
  /**
41
41
  * Strip HTML tags and their content
42
+ * !!!Important: It will remove nested tags
42
43
  * @param {string} input - The input string to process
43
44
  * @returns {string} The processed string
44
45
  */
@@ -67,7 +67,7 @@ __webpack_require__.r(__webpack_exports__);
67
67
  * @returns {string} The processed string
68
68
  */
69
69
  function rmSpec(input) {
70
- return input.replace(/[^a-zA-Z0-9 \u4E00-\u9FFF]/g, "");
70
+ return input === null || input === void 0 ? void 0 : input.replace(/[^a-zA-Z0-9 \u4E00-\u9FFF]/g, "");
71
71
  }
72
72
 
73
73
  /**
@@ -76,7 +76,7 @@ function rmSpec(input) {
76
76
  * @returns {string} The processed string
77
77
  */
78
78
  function onlyNumAndLetter(input) {
79
- return input.replace(/[^a-zA-Z0-9 ]/g, "");
79
+ return input === null || input === void 0 ? void 0 : input.replace(/[^a-zA-Z0-9 ]/g, "");
80
80
  }
81
81
 
82
82
  /**
@@ -85,7 +85,7 @@ function onlyNumAndLetter(input) {
85
85
  * @returns {string} The processed string
86
86
  */
87
87
  function rmAllSpace(input) {
88
- return input.replace(/\s/g, "");
88
+ return input === null || input === void 0 ? void 0 : input.replace(/\s/g, "");
89
89
  }
90
90
 
91
91
  /**
@@ -94,7 +94,7 @@ function rmAllSpace(input) {
94
94
  * @returns {string} The processed string
95
95
  */
96
96
  function trimAll(input) {
97
- return input.replace(/(^\s+)|(\s+$)/g, "");
97
+ return input === null || input === void 0 ? void 0 : input.replace(/(^\s+)|(\s+$)/g, "");
98
98
  }
99
99
 
100
100
  /**
@@ -103,25 +103,35 @@ function trimAll(input) {
103
103
  * @returns {string} The processed string
104
104
  */
105
105
  function multiSpacesToSingle(input) {
106
- return input.replace(/\s+(\W)/g, ' ');
106
+ return input === null || input === void 0 ? void 0 : input.replace(/\s+(\W)/g, ' ');
107
107
  }
108
108
 
109
109
  /**
110
- * Convert HTML text to plain text
110
+ * Convert HTML text to plain text (Remove html tag content)
111
111
  * @param {string} input - The input string to process
112
112
  * @returns {string} The processed string
113
113
  */
114
+ /*
115
+ Examples:
116
+ console.log(htmlToPlain("<p>Hello <b>World</b></p>")); // Hello World
117
+ */
114
118
  function htmlToPlain(input) {
115
- return input.replace(/(<([^>]+)>)/ig, '');
119
+ return input === null || input === void 0 ? void 0 : input.replace(/(<([^>]+)>)/ig, '');
116
120
  }
117
121
 
118
122
  /**
119
- * Strip HTML tags and their content
123
+ * Strip HTML tags and their content
124
+ * !!!Important: It will remove nested tags
120
125
  * @param {string} input - The input string to process
121
126
  * @returns {string} The processed string
122
127
  */
128
+ /*
129
+ Examples:
130
+ console.log(stripTagsAndContent("<p>Hello <b>World</b></p>")); // World
131
+ console.log(stripTagsAndContent("Hello <b>World</b>")); // Hello
132
+ */
123
133
  function stripTagsAndContent(input) {
124
- return input.replace(/<\/?[^>]+(>|$)(.*?)<\/?[^>]+(>|$)/ig, '');
134
+ return input === null || input === void 0 ? void 0 : input.replace(/<\/?[^>]+(>|$)(.*?)<\/?[^>]+(>|$)/ig, '');
125
135
  }
126
136
 
127
137
  /**
@@ -130,7 +140,7 @@ function stripTagsAndContent(input) {
130
140
  * @returns {string} The processed URL
131
141
  */
132
142
  function removeFirstLastSlash(input) {
133
- return input.replace(/^\/|\/$/g, '');
143
+ return input === null || input === void 0 ? void 0 : input.replace(/^\/|\/$/g, '');
134
144
  }
135
145
 
136
146
  /**
@@ -139,7 +149,7 @@ function removeFirstLastSlash(input) {
139
149
  * @returns {string} The processed URL
140
150
  */
141
151
  function removeTrailingSlash(input) {
142
- return input.replace(/\/+$/, '');
152
+ return input === null || input === void 0 ? void 0 : input.replace(/\/+$/, '');
143
153
  }
144
154
 
145
155
  /**
@@ -148,7 +158,7 @@ function removeTrailingSlash(input) {
148
158
  * @returns {string} The processed URL
149
159
  */
150
160
  function removeFirstSlash(input) {
151
- return input.replace(/\//, '');
161
+ return input === null || input === void 0 ? void 0 : input.replace(/\//, '');
152
162
  }
153
163
 
154
164
  /******/ return __webpack_exports__;
package/Utils/time.d.ts CHANGED
@@ -17,18 +17,18 @@ declare function getTimeslots(startTime: string, endTime: string, timeInterval:
17
17
  * @param {Date} endDate - ebd date
18
18
  * @returns Number
19
19
  */
20
- declare function getMinutesBetweenDates(startDate: any, endDate: any): number;
20
+ declare function getMinutesBetweenDates(startDate: Date, endDate: Date): number;
21
21
  /**
22
22
  * Get minutes between two time
23
23
  * @param {String} startTime - start time
24
24
  * @param {String} endTime - ebd time
25
25
  * @returns Number
26
26
  */
27
- declare function getMinutesBetweenTime(startTime: any, endTime: any): string;
27
+ declare function getMinutesBetweenTime(startTime: string, endTime: string): string;
28
28
  /**
29
29
  * Convert HH:MM:SS into minute
30
30
  * @param {String} timeStr - time string
31
31
  * @returns Number
32
32
  */
33
- declare function convertTimeToMin(timeStr: any): number;
33
+ declare function convertTimeToMin(timeStr: string): number;
34
34
  export { getTimeslots, getMinutesBetweenDates, getMinutesBetweenTime, convertTimeToMin };
@@ -127,7 +127,7 @@ const App = () => {
127
127
  */
128
128
 
129
129
  var useIsMobile = function useIsMobile() {
130
- var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 768;
130
+ var breakpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 600;
131
131
  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
132
132
  _useState2 = _slicedToArray(_useState, 2),
133
133
  isMobile = _useState2[0],
@@ -140,8 +140,72 @@ var useIsMobile = function useIsMobile() {
140
140
  // Set the mounted state to true after the component has mounted
141
141
  setIsMounted(true);
142
142
  var handleResize = function handleResize() {
143
- if (window) {
144
- setIsMobile(window.innerWidth <= breakpoint);
143
+ if (typeof window !== 'undefined') {
144
+ var detectDeviceType = function detectDeviceType() {
145
+ // 1. First check if window and navigator are available (SSR compatibility)
146
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
147
+ return 'desktop'; // Default to desktop
148
+ }
149
+
150
+ // 2. Get user agent string
151
+ var ua = navigator.userAgent.toLowerCase();
152
+
153
+ // 3. Get platform info
154
+ var platform = navigator.platform ? navigator.platform.toLowerCase() : '';
155
+
156
+ // 4. Check screen characteristics using window.matchMedia
157
+ var isTouch = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
158
+ var isPortrait = window.matchMedia('(orientation: portrait)').matches;
159
+ var isLandscape = window.matchMedia('(orientation: landscape)').matches;
160
+
161
+ // 5. Get screen dimensions
162
+ var screenWidth = window.screen.width;
163
+ var screenHeight = window.screen.height;
164
+ var minScreenSize = Math.min(screenWidth, screenHeight);
165
+ var maxScreenSize = Math.max(screenWidth, screenHeight);
166
+
167
+ // Define device characteristics
168
+ var isTablet =
169
+ // Traditional UA detection
170
+ /ipad/.test(ua) || /android/.test(ua) && !/mobile/.test(ua) || /tablet/.test(ua) || /playbook/.test(ua) || /nexus (7|9|10)/.test(ua) || /sm-t/.test(ua) || /huawei(.*)mediapad/.test(ua) ||
171
+ // Special detection for iPad Pro and newer iPads
172
+ navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 ||
173
+ // Screen size characteristics (tablets typically fall within this range)
174
+ minScreenSize >= breakpoint && maxScreenSize <= 1366 && isTouch ||
175
+ // Specific device detection
176
+ /kindle|silk|kftt|kfot|kfjwa|kfjwi|kfsowi|kfthwa|kfthwi|kfapwa|kfapwi/i.test(ua);
177
+ var isMobile = !isTablet && (
178
+ // Prevent tablets from being detected as phones
179
+ // Traditional mobile device detection
180
+ /iphone|ipod|android.*mobile|windows phone|mobi/.test(ua) ||
181
+ // Screen size characteristics (phones typically smaller than 600px)
182
+ minScreenSize < breakpoint && isTouch ||
183
+ // Additional mobile device detection
184
+ /blackberry|\bbb\d+|meego|webos|palm|phone|pocket|mobile|mini|iemobile/i.test(ua));
185
+
186
+ // 6. Comprehensive decision logic
187
+ if (isMobile) {
188
+ // Additional check for small tablets
189
+ if (maxScreenSize >= 1024 && isTouch) {
190
+ return 'tablet';
191
+ }
192
+ return 'mobile';
193
+ }
194
+ if (isTablet) {
195
+ // Additional check for touch-enabled laptops
196
+ if (maxScreenSize > 1366 && /windows/.test(ua)) {
197
+ return 'desktop';
198
+ }
199
+ return 'tablet';
200
+ }
201
+
202
+ // 7. Check for touch-enabled laptops
203
+ if (isTouch && /windows/.test(ua) && maxScreenSize > 1366) {
204
+ return 'desktop';
205
+ }
206
+ return 'desktop';
207
+ };
208
+ setIsMobile(detectDeviceType() === 'mobile');
145
209
  }
146
210
  };
147
211
 
package/all.d.ts CHANGED
@@ -29,6 +29,7 @@ export const NumberInput: any;
29
29
  export const Pagination: any;
30
30
  export const Radio: any;
31
31
  export const RangeSlider: any;
32
+ export const Refresher: any;
32
33
  export const RootPortal: any;
33
34
  export const ScrollReveal: any;
34
35
  export const Scrollbar: any;
package/all.js CHANGED
@@ -31,6 +31,7 @@ exports.NumberInput = _interopRequireDefault(require("./NumberInput")).default;
31
31
  exports.Pagination = _interopRequireDefault(require("./Pagination")).default;
32
32
  exports.Radio = _interopRequireDefault(require("./Radio")).default;
33
33
  exports.RangeSlider = _interopRequireDefault(require("./RangeSlider")).default;
34
+ exports.Refresher = _interopRequireDefault(require("./Refresher")).default;
34
35
  exports.RootPortal = _interopRequireDefault(require("./RootPortal")).default;
35
36
  exports.ScrollReveal = _interopRequireDefault(require("./ScrollReveal")).default;
36
37
  exports.Scrollbar = _interopRequireDefault(require("./Scrollbar")).default;
@@ -5,6 +5,8 @@ export declare type CascadingSelectProps = {
5
5
  wrapperClassName?: string;
6
6
  controlClassName?: string;
7
7
  controlExClassName?: string;
8
+ searchable?: boolean;
9
+ searchPlaceholder?: string;
8
10
  perColumnHeadersShow?: boolean;
9
11
  exceededSidePosOffset?: number;
10
12
  value?: string;