funda-ui 4.4.15 → 4.5.12

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 (77) hide show
  1. package/Date/index.js +1078 -77
  2. package/EventCalendar/index.css +114 -114
  3. package/EventCalendar/index.d.ts +1 -0
  4. package/EventCalendar/index.js +124 -86
  5. package/EventCalendarTimeline/index.css +274 -270
  6. package/EventCalendarTimeline/index.d.ts +3 -0
  7. package/EventCalendarTimeline/index.js +673 -225
  8. package/Input/index.d.ts +7 -0
  9. package/Input/index.js +699 -57
  10. package/MasonryLayout/index.js +11 -1
  11. package/MultipleCheckboxes/index.js +11 -11
  12. package/MultipleSelect/index.d.ts +1 -0
  13. package/MultipleSelect/index.js +18 -16
  14. package/NativeSelect/index.js +11 -11
  15. package/Radio/index.js +11 -11
  16. package/RangeSlider/index.js +1078 -77
  17. package/Select/index.js +45 -13
  18. package/Table/index.css +1 -0
  19. package/Table/index.js +36 -7
  20. package/TagInput/index.d.ts +1 -0
  21. package/TagInput/index.js +20 -2
  22. package/Textarea/index.d.ts +7 -0
  23. package/Textarea/index.js +707 -10
  24. package/Tree/index.js +13 -11
  25. package/Utils/inputsCalculation.d.ts +18 -1
  26. package/Utils/inputsCalculation.js +26 -0
  27. package/Utils/object.js +11 -11
  28. package/Utils/os.d.ts +2 -0
  29. package/Utils/os.js +104 -0
  30. package/lib/cjs/Date/index.js +1078 -77
  31. package/lib/cjs/EventCalendar/index.d.ts +1 -0
  32. package/lib/cjs/EventCalendar/index.js +124 -86
  33. package/lib/cjs/EventCalendarTimeline/index.d.ts +3 -0
  34. package/lib/cjs/EventCalendarTimeline/index.js +673 -225
  35. package/lib/cjs/Input/index.d.ts +7 -0
  36. package/lib/cjs/Input/index.js +699 -57
  37. package/lib/cjs/MasonryLayout/index.js +11 -1
  38. package/lib/cjs/MultipleCheckboxes/index.js +11 -11
  39. package/lib/cjs/MultipleSelect/index.d.ts +1 -0
  40. package/lib/cjs/MultipleSelect/index.js +18 -16
  41. package/lib/cjs/NativeSelect/index.js +11 -11
  42. package/lib/cjs/Radio/index.js +11 -11
  43. package/lib/cjs/RangeSlider/index.js +1078 -77
  44. package/lib/cjs/Select/index.js +45 -13
  45. package/lib/cjs/Table/index.js +36 -7
  46. package/lib/cjs/TagInput/index.d.ts +1 -0
  47. package/lib/cjs/TagInput/index.js +20 -2
  48. package/lib/cjs/Textarea/index.d.ts +7 -0
  49. package/lib/cjs/Textarea/index.js +707 -10
  50. package/lib/cjs/Tree/index.js +13 -11
  51. package/lib/cjs/Utils/inputsCalculation.d.ts +18 -1
  52. package/lib/cjs/Utils/inputsCalculation.js +26 -0
  53. package/lib/cjs/Utils/object.js +11 -11
  54. package/lib/cjs/Utils/os.d.ts +2 -0
  55. package/lib/cjs/Utils/os.js +104 -0
  56. package/lib/css/EventCalendar/index.css +114 -114
  57. package/lib/css/EventCalendarTimeline/index.css +274 -270
  58. package/lib/css/Table/index.css +1 -0
  59. package/lib/esm/EventCalendar/index.scss +81 -81
  60. package/lib/esm/EventCalendar/index.tsx +144 -104
  61. package/lib/esm/EventCalendarTimeline/index.scss +226 -221
  62. package/lib/esm/EventCalendarTimeline/index.tsx +791 -517
  63. package/lib/esm/Input/index.tsx +299 -77
  64. package/lib/esm/MasonryLayout/index.tsx +9 -2
  65. package/lib/esm/ModalDialog/index.tsx +0 -1
  66. package/lib/esm/MultipleSelect/index.tsx +6 -4
  67. package/lib/esm/Table/Table.tsx +0 -1
  68. package/lib/esm/Table/index.scss +2 -0
  69. package/lib/esm/Table/utils/hooks/useTableDraggable.tsx +47 -6
  70. package/lib/esm/TagInput/index.tsx +23 -1
  71. package/lib/esm/Textarea/index.tsx +332 -39
  72. package/lib/esm/Tree/TreeList.tsx +4 -1
  73. package/lib/esm/Tree/index.tsx +1 -0
  74. package/lib/esm/Utils/libs/inputsCalculation.ts +60 -31
  75. package/lib/esm/Utils/libs/object.ts +67 -67
  76. package/lib/esm/Utils/libs/os.ts +63 -0
  77. package/package.json +1 -1
@@ -1,4 +1,21 @@
1
1
 
2
+
3
+ /**
4
+ * Gets the relative upside of the text
5
+ * @param {Element} el - A DOM node containing one selector to match against.
6
+ * @returns {Number} - Returns a pure number.
7
+ */
8
+ function getTextTop(el: HTMLElement) {
9
+ const styles = window.getComputedStyle(el);
10
+ const fontSize = parseFloat(styles.fontSize);
11
+ const lineHeight = parseFloat(styles.lineHeight) || fontSize;
12
+ const paddingTop = parseFloat(styles.paddingTop);
13
+ const borderWidth = parseFloat(styles.borderWidth);
14
+
15
+ const textTop = paddingTop + (lineHeight - fontSize) / 2 - borderWidth*2;
16
+ return textTop;
17
+ }
18
+
2
19
  /**
3
20
  * Get the actual value with user specific methed
4
21
  * it can be 'width', 'height', 'outerWidth', 'outerHeight'
@@ -9,14 +26,14 @@
9
26
  takes effect when set to true
10
27
  * @return {Number} - Returns a pure number.
11
28
  */
12
- function actualPropertyValue(el: any, prop: string, config: any = undefined ) {
29
+ function actualPropertyValue(el: any, prop: string, config: any = undefined) {
13
30
  if (el === null) return 0;
14
31
 
15
- const style = window.getComputedStyle ? window.getComputedStyle(el) : el.currentStyle,
16
- display = style.display,
17
- position = style.position,
32
+ const style = window.getComputedStyle ? window.getComputedStyle(el) : el.currentStyle,
33
+ display = style.display,
34
+ position = style.position,
18
35
  visibility = style.visibility;
19
-
36
+
20
37
  let marginWidth = 0;
21
38
  let marginHeight = 0;
22
39
 
@@ -24,55 +41,65 @@ function actualPropertyValue(el: any, prop: string, config: any = undefined ) {
24
41
  let actualVal: any;
25
42
 
26
43
 
27
- if ( config && config.includeMargin === true ) {
44
+ if (config && config.includeMargin === true) {
28
45
  marginWidth = parseFloat(style.marginLeft) + parseFloat(style.marginRight);
29
46
  marginHeight = parseFloat(style.marginTop) + parseFloat(style.marginBottom);
30
47
  }
31
48
 
32
-
33
- if ( prop === 'width' ) {
34
- maxVal = parseFloat( style.maxWidth );
49
+ if (prop === 'fontSize') {
50
+ actualVal = parseFloat(style.fontSize);
51
+ }
52
+
53
+ if (prop === 'fontFamily') {
54
+ actualVal = style.fontFamily;
55
+ }
56
+
57
+ if (prop === 'letterSpacing') {
58
+ actualVal = style.letterSpacing;
59
+ }
60
+ if (prop === 'width') {
61
+ maxVal = parseFloat(style.maxWidth);
35
62
 
36
63
  // if its not hidden we just return normal height
37
- if(display !== 'none' && maxVal !== 0) {
64
+ if (display !== 'none' && maxVal !== 0) {
38
65
  return el.clientWidth;
39
66
  }
40
67
  }
41
- if ( prop === 'height' ) {
42
- maxVal = parseFloat( style.maxHeight );
43
- if(display !== 'none' && maxVal !== 0) {
68
+ if (prop === 'height') {
69
+ maxVal = parseFloat(style.maxHeight);
70
+ if (display !== 'none' && maxVal !== 0) {
44
71
  return el.clientHeight;
45
- }
72
+ }
46
73
  }
47
-
48
- if ( prop === 'outerWidth' ) {
49
- maxVal = parseFloat( style.maxWidth );
50
- if(display !== 'none' && maxVal !== 0) {
74
+
75
+ if (prop === 'outerWidth') {
76
+ maxVal = parseFloat(style.maxWidth);
77
+ if (display !== 'none' && maxVal !== 0) {
51
78
  return el.offsetWidth + marginWidth;
52
79
  }
53
80
  }
54
- if ( prop === 'outerHeight' ) {
55
- maxVal = parseFloat( style.maxHeight );
56
- if(display !== 'none' && maxVal !== 0) {
81
+ if (prop === 'outerHeight') {
82
+ maxVal = parseFloat(style.maxHeight);
83
+ if (display !== 'none' && maxVal !== 0) {
57
84
  return el.offsetHeight + marginHeight;
58
- }
85
+ }
59
86
  }
60
87
 
61
88
  // the element is hidden so:
62
89
  // making the el block so we can meassure its height but still be hidden
63
- el.style.position = 'absolute';
90
+ el.style.position = 'absolute';
64
91
  el.style.visibility = 'hidden';
65
- el.style.display = 'block';
92
+ el.style.display = 'block';
66
93
 
67
94
 
68
- if ( prop === 'width' ) actualVal = el.clientWidth;
69
- if ( prop === 'height' ) actualVal = el.clientHeight;
70
- if ( prop === 'outerWidth' ) actualVal = el.offsetWidth + marginWidth;
71
- if ( prop === 'outerHeight' ) actualVal = el.offsetHeight + marginHeight;
95
+ if (prop === 'width') actualVal = el.clientWidth;
96
+ if (prop === 'height') actualVal = el.clientHeight;
97
+ if (prop === 'outerWidth') actualVal = el.offsetWidth + marginWidth;
98
+ if (prop === 'outerHeight') actualVal = el.offsetHeight + marginHeight;
72
99
 
73
100
  // reverting to the original values
74
- el.style.display = display;
75
- el.style.position = position;
101
+ el.style.display = display;
102
+ el.style.position = position;
76
103
  el.style.visibility = visibility;
77
104
 
78
105
  return actualVal;
@@ -119,11 +146,13 @@ function getTextWidth(input: HTMLInputElement, fauxContainer: HTMLSpanElement, r
119
146
  _faux.textContent = input.value.substring(0, _off).replace(/\s/g, "\u00a0");
120
147
  return actualPropertyValue(_faux, 'outerWidth');
121
148
  }
122
-
149
+
123
150
  }
124
151
 
125
152
 
126
153
  export {
154
+ getTextTop,
155
+ actualPropertyValue,
127
156
  getTextWidth
128
157
  };
129
158
 
@@ -1,68 +1,68 @@
1
-
2
- /**
3
- * Remove Duplicate objects from JSON Array
4
- * @param {Array} obj
5
- * @param {String} fieldName
6
- */
7
- function removeArrDuplicateItems(obj: any[], fieldName: string): any[] {
8
- if (!Array.isArray(obj)) return [];
9
-
10
- const clean = obj.filter((item, index, self) => index === self.findIndex((t) => (t[fieldName] === item[fieldName])));
11
- return clean;
12
- };
13
-
14
-
15
- /**
16
- * Deep clone
17
- * @param {*} obj
18
- */
19
- function deepClone(obj: any): any {
20
- if (Array.isArray(obj)) {
21
- return (obj).map((item) => deepClone(item));
22
- } else if (typeof obj === 'object' && obj !== null) {
23
- const clone: any = {};
24
- for (let key in obj) {
25
- if (obj.hasOwnProperty(key)) {
26
- clone[key] = deepClone(obj[key]);
27
- }
28
- }
29
- return clone;
30
- } else {
31
- return obj;
32
- }
33
- }
34
-
35
-
36
- /**
37
- * Flat Data
38
- * @param {*} data
39
- * @returns
40
- */
41
- function flatData(data: any): any[] {
42
- const result: any[] = [];
43
- const iterate = (obj: any) => {
44
- if (!obj) {
45
- return;
46
- }
47
- obj.forEach((item: any) => {
48
- result.push(item);
49
- if (item.children) {
50
- iterate(item.children);
51
- }
52
-
53
- // delete current item children
54
- delete item.children;
55
-
56
- })
57
- }
58
-
59
- iterate(data);
60
- return result;
61
- }
62
-
63
-
64
- export {
65
- removeArrDuplicateItems,
66
- deepClone,
67
- flatData
1
+
2
+ /**
3
+ * Remove Duplicate objects from JSON Array
4
+ * @param {Array} obj
5
+ * @param {String} fieldName
6
+ */
7
+ function removeArrDuplicateItems(obj: any[], fieldName: string): any[] {
8
+ if (!Array.isArray(obj)) return [];
9
+
10
+ const clean = obj.filter((item, index, self) => index === self.findIndex((t) => (t[fieldName] === item[fieldName])));
11
+ return clean;
12
+ };
13
+
14
+
15
+ /**
16
+ * Deep clone
17
+ * @param {*} obj
18
+ */
19
+ function deepClone(obj: any): any {
20
+ if (Array.isArray(obj)) {
21
+ return (obj).map((item) => deepClone(item));
22
+ } else if (typeof obj === 'object' && obj !== null) {
23
+ const clone: any = {};
24
+ for (let key in obj) {
25
+ if (obj.hasOwnProperty(key)) {
26
+ clone[key] = deepClone(obj[key]);
27
+ }
28
+ }
29
+ return clone;
30
+ } else {
31
+ return obj;
32
+ }
33
+ }
34
+
35
+
36
+ /**
37
+ * Flat Data
38
+ * @param {*} data
39
+ * @returns
40
+ */
41
+ function flatData(data: any): any[] {
42
+ const result: any[] = [];
43
+ const iterate = (obj: any) => {
44
+ if (!obj) {
45
+ return;
46
+ }
47
+ obj.forEach((item: any) => {
48
+ result.push(item);
49
+ if (item.children) {
50
+ iterate(item.children);
51
+ }
52
+
53
+ // delete current item children
54
+ delete item.children;
55
+
56
+ })
57
+ }
58
+
59
+ iterate(data);
60
+ return result;
61
+ }
62
+
63
+
64
+ export {
65
+ removeArrDuplicateItems,
66
+ deepClone,
67
+ flatData
68
68
  }
@@ -0,0 +1,63 @@
1
+
2
+
3
+ /*
4
+ * Determine whether it is a special platform
5
+ *
6
+ * @private
7
+ */
8
+ function getOs() {
9
+ if (typeof window === 'undefined') return {};
10
+
11
+ let os;
12
+
13
+ if ( typeof window !== "undefined" ) {
14
+
15
+ const getOs = () => {
16
+ const _navigator: any = window.navigator;
17
+ const platform = () => {
18
+ // 2022 way of detecting. Note : this userAgentData feature is available only in secure contexts (HTTPS)
19
+ if (typeof _navigator.userAgentData !== 'undefined' && _navigator.userAgentData != null) {
20
+ return _navigator.userAgentData.platform;
21
+ }
22
+ // Deprecated but still works for most of the browser
23
+ if (typeof _navigator.platform !== 'undefined') {
24
+ if (typeof _navigator.userAgent !== 'undefined' && /android/.test(_navigator.userAgent.toLowerCase())) {
25
+ // android device’s _navigator.platform is often set as 'linux', so const’s use userAgent for them
26
+ return 'android';
27
+ }
28
+ return _navigator.platform;
29
+ }
30
+ return 'unknown';
31
+ }
32
+
33
+ const _platform = platform().toLowerCase();
34
+
35
+ const isOSX = /mac/.test(_platform); // Mac desktop
36
+ const isIOS = ['iphone', 'ipad', 'ipod'].indexOf(_platform) === -1 ? false : true; // Mac iOs
37
+ const isApple = isOSX || isIOS; // Apple device (desktop or iOS)
38
+ const isWindows = /win/.test(_platform); // Windows
39
+ const isAndroid = /android/.test(_platform); // Android
40
+ const isLinux = /linux/.test(_platform); // Linux
41
+
42
+ return {
43
+ isOSX,
44
+ isIOS,
45
+ isApple,
46
+ isWindows,
47
+ isAndroid,
48
+ isLinux
49
+ }
50
+
51
+ };
52
+
53
+ os = getOs();
54
+
55
+ } else {
56
+ os = {};
57
+ }
58
+ return os;
59
+
60
+ }
61
+
62
+
63
+ export default getOs;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "UIUX Lab",
3
3
  "email": "uiuxlab@gmail.com",
4
4
  "name": "funda-ui",
5
- "version": "4.4.15",
5
+ "version": "4.5.12",
6
6
  "description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
7
7
  "repository": {
8
8
  "type": "git",