diginet-core-ui 1.3.78 → 1.3.79

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 (209) hide show
  1. package/components/accordion/details.js +2 -6
  2. package/components/accordion/group.js +2 -9
  3. package/components/accordion/index.js +2 -15
  4. package/components/accordion/summary.js +4 -27
  5. package/components/alert/index.js +98 -137
  6. package/components/alert/notify.js +97 -166
  7. package/components/avatar/index.js +4 -63
  8. package/components/badge/index.js +7 -34
  9. package/components/button/icon.js +120 -186
  10. package/components/button/index.js +136 -205
  11. package/components/button/more.js +0 -12
  12. package/components/button/ripple-effect.js +46 -44
  13. package/components/card/body.js +2 -7
  14. package/components/card/extra.js +2 -7
  15. package/components/card/footer.js +2 -7
  16. package/components/card/header.js +2 -7
  17. package/components/card/index.js +2 -22
  18. package/components/chart/Pie/Circle.js +0 -1
  19. package/components/chart/Pie/Sector.js +0 -17
  20. package/components/chart/Pie/Sectors.js +0 -10
  21. package/components/chart/Pie/index.js +4 -36
  22. package/components/chart/Pie-v2/Circle.js +0 -1
  23. package/components/chart/Pie-v2/Sector.js +0 -13
  24. package/components/chart/Pie-v2/Sectors.js +0 -20
  25. package/components/chart/Pie-v2/index.js +11 -38
  26. package/components/chart/bar/Axis.js +0 -12
  27. package/components/chart/bar/Bar.js +13 -35
  28. package/components/chart/bar/Grid.js +0 -18
  29. package/components/chart/bar/Labels.js +0 -18
  30. package/components/chart/bar/Points.js +0 -17
  31. package/components/chart/bar/index.js +6 -26
  32. package/components/chart/bar-v2/Axis.js +0 -12
  33. package/components/chart/bar-v2/Bar.js +15 -36
  34. package/components/chart/bar-v2/Grid.js +0 -18
  35. package/components/chart/bar-v2/Labels.js +0 -18
  36. package/components/chart/bar-v2/Points.js +0 -17
  37. package/components/chart/bar-v2/index.js +6 -26
  38. package/components/chart/line/Axis.js +4 -16
  39. package/components/chart/line/Grid.js +2 -19
  40. package/components/chart/line/Labels.js +0 -18
  41. package/components/chart/line/Path.js +23 -33
  42. package/components/chart/line/Point.js +6 -40
  43. package/components/chart/line/Title.js +0 -3
  44. package/components/chart/line/index.js +12 -35
  45. package/components/chart/line-v2/Axis.js +0 -13
  46. package/components/chart/line-v2/Grid.js +0 -18
  47. package/components/chart/line-v2/Labels.js +0 -18
  48. package/components/chart/line-v2/Path.js +23 -33
  49. package/components/chart/line-v2/Point.js +6 -35
  50. package/components/chart/line-v2/Title.js +0 -3
  51. package/components/chart/line-v2/index.js +12 -30
  52. package/components/check-text/index.js +0 -8
  53. package/components/check-text/interview-confirmation.js +0 -7
  54. package/components/check-text/interview-status.js +0 -7
  55. package/components/chip/attach.js +4 -17
  56. package/components/chip/index.js +6 -33
  57. package/components/collapse/index.js +0 -13
  58. package/components/divider/index.js +0 -8
  59. package/components/form-control/attachment/index.js +24 -202
  60. package/components/form-control/calendar/function.js +40 -94
  61. package/components/form-control/calendar/index.js +5 -30
  62. package/components/form-control/calendar/range.js +11 -28
  63. package/components/form-control/checkbox/index.js +4 -37
  64. package/components/form-control/control/index.js +3 -13
  65. package/components/form-control/date-picker/index-old.js +18 -0
  66. package/components/form-control/date-picker/index.js +23 -99
  67. package/components/form-control/date-range-picker/index.js +86 -221
  68. package/components/form-control/dropdown/index.js +72 -289
  69. package/components/form-control/dropdown-box/index.js +6 -35
  70. package/components/form-control/form/index.js +0 -2
  71. package/components/form-control/form-group/index.js +1 -6
  72. package/components/form-control/helper-text/index.js +2 -9
  73. package/components/form-control/input-base/index.js +218 -399
  74. package/components/form-control/label/index.js +2 -12
  75. package/components/form-control/money-input/index.js +43 -132
  76. package/components/form-control/number-input/index.js +15 -113
  77. package/components/form-control/number-input/index2.js +78 -119
  78. package/components/form-control/phone-input/index.js +16 -78
  79. package/components/form-control/radio/index.js +4 -23
  80. package/components/form-control/text-input/index.js +33 -256
  81. package/components/form-control/time-picker/index.js +14 -71
  82. package/components/form-control/time-picker/swiper.js +21 -73
  83. package/components/form-control/toggle/index.js +4 -19
  84. package/components/form-view/helper-text.js +2 -2
  85. package/components/form-view/index.js +0 -14
  86. package/components/form-view/input.js +2 -13
  87. package/components/form-view/label.js +0 -2
  88. package/components/grid/Col.js +2 -15
  89. package/components/grid/Container.js +2 -21
  90. package/components/grid/Row.js +2 -21
  91. package/components/grid/index.js +2 -43
  92. package/components/image/index.js +2 -22
  93. package/components/index.js +62 -31
  94. package/components/list/list-item-action.js +0 -9
  95. package/components/list/list-item-icon.js +0 -9
  96. package/components/list/list-item-text.js +0 -5
  97. package/components/list/list-item.js +0 -11
  98. package/components/list/list.js +0 -13
  99. package/components/list/sub-header.js +0 -4
  100. package/components/modal/body.js +2 -6
  101. package/components/modal/footer.js +2 -11
  102. package/components/modal/header.js +2 -12
  103. package/components/modal/index.js +2 -10
  104. package/components/modal/modal.js +11 -52
  105. package/components/others/extra/index.js +3 -10
  106. package/components/others/import/index.js +0 -7
  107. package/components/others/option-wrapper/index.js +4 -7
  108. package/components/others/scrollbar/index.js +0 -3
  109. package/components/paging/page-info.js +39 -101
  110. package/components/paging/page-selector.js +7 -35
  111. package/components/paging/page-selector2.js +35 -74
  112. package/components/paper/index.js +0 -11
  113. package/components/popover/body.js +2 -6
  114. package/components/popover/footer.js +2 -11
  115. package/components/popover/header.js +2 -7
  116. package/components/popover/index.js +39 -123
  117. package/components/popup/danger_popup.js +0 -19
  118. package/components/popup/index.js +2 -48
  119. package/components/popup/proposals_popup.js +10 -49
  120. package/components/popup/v2/index.js +0 -31
  121. package/components/progress/circular.js +19 -81
  122. package/components/progress/linear.js +4 -20
  123. package/components/rating/index.js +0 -24
  124. package/components/slider/slider-container.js +3 -40
  125. package/components/slider/slider-item.js +10 -25
  126. package/components/status/index.js +2 -16
  127. package/components/tab/tab-container.js +2 -16
  128. package/components/tab/tab-header.js +4 -24
  129. package/components/tab/tab-panel.js +4 -16
  130. package/components/tab/tab.js +4 -28
  131. package/components/tooltip/index.js +12 -97
  132. package/components/tooltip/portal.js +0 -2
  133. package/components/transfer/index.js +22 -67
  134. package/components/tree-view/index.js +62 -202
  135. package/components/typography/index.js +3 -31
  136. package/global/index.js +0 -8
  137. package/icons/basic.js +0 -48
  138. package/icons/effect.js +17 -29
  139. package/icons/general/clock/clock.js +0 -2
  140. package/icons/general/color-handler/background.js +0 -2
  141. package/icons/general/color-handler/text.js +0 -2
  142. package/icons/general/emoji/emoji.js +0 -2
  143. package/icons/general/font-properties/bold.js +0 -2
  144. package/icons/general/font-properties/font-family.js +0 -2
  145. package/icons/general/font-properties/font-size.js +0 -2
  146. package/icons/general/font-properties/italic.js +0 -2
  147. package/icons/general/font-properties/underline.js +0 -2
  148. package/icons/general/hyperlink/hyperlink.js +0 -2
  149. package/icons/general/indent/decrease.js +0 -2
  150. package/icons/general/indent/increase.js +0 -2
  151. package/icons/general/list/bullets.js +0 -2
  152. package/icons/general/list/numbering.js +0 -2
  153. package/icons/general/picture/picture.js +0 -2
  154. package/icons/general/steps/redo.js +0 -2
  155. package/icons/general/steps/undo.js +0 -2
  156. package/icons/general/text-align/center.js +0 -2
  157. package/icons/general/text-align/justify.js +0 -2
  158. package/icons/general/text-align/left.js +0 -2
  159. package/icons/general/text-align/right.js +0 -2
  160. package/icons/menu/dhr.js +2 -1
  161. package/icons/menu/index.js +2 -2
  162. package/icons/menu/v2/index.js +0 -10
  163. package/package.json +1 -1
  164. package/readme.md +11 -1
  165. package/styles/animation.js +15 -58
  166. package/styles/color-helper.js +24 -54
  167. package/styles/colors.js +17 -9
  168. package/styles/general.js +6 -2
  169. package/styles/typography.js +4 -4
  170. package/styles/utils.js +2 -2
  171. package/theme/createBreakpoints.js +7 -18
  172. package/theme/make-styles.js +2 -5
  173. package/theme/set-theme.js +3 -6
  174. package/theme/settings.js +3 -2
  175. package/theme/theme-provider.js +0 -1
  176. package/utils/array/array.js +14 -23
  177. package/utils/classNames.js +0 -5
  178. package/utils/console.js +0 -6
  179. package/utils/date.js +13 -82
  180. package/utils/error/error.js +1 -9
  181. package/utils/error/errors.js +1 -48
  182. package/utils/getFileType.js +0 -9
  183. package/utils/handleBreakpoints.js +0 -5
  184. package/utils/intersectionObserver.js +0 -5
  185. package/utils/iterator.js +0 -9
  186. package/utils/map-parent.js +3 -10
  187. package/utils/object/extend.js +0 -10
  188. package/utils/object/object.js +12 -11
  189. package/utils/parseHTML.js +0 -1
  190. package/utils/promisify.js +0 -5
  191. package/utils/randomString.js +0 -7
  192. package/utils/remove-unicode.js +0 -1
  193. package/utils/render-portal.js +1 -9
  194. package/utils/renderHTML.js +4 -6
  195. package/utils/renderIcon.js +4 -14
  196. package/utils/sb-template.js +6 -5
  197. package/utils/string/capitalize.js +0 -1
  198. package/utils/string/capitalizeSentenceCase.js +0 -2
  199. package/utils/string/string.js +0 -13
  200. package/utils/type.js +0 -21
  201. package/utils/updatePosition.js +4 -5
  202. package/utils/useDelayUnmount.js +0 -4
  203. package/utils/useElementSize.js +9 -3
  204. package/utils/useEventListener.js +12 -6
  205. package/utils/useInput.js +0 -6
  206. package/utils/useMediaQuery.js +8 -10
  207. package/utils/useOnClickOutside.js +0 -2
  208. package/utils/usePortal.js +3 -10
  209. package/utils/validate.js +6 -20
package/utils/validate.js CHANGED
@@ -1,26 +1,25 @@
1
1
  import { getGlobal } from '../global';
2
2
  import { isEmail as isEmailHandler } from './';
3
+
3
4
  /**
4
5
  * Validation the string is an valid email
5
6
  * @param {String} str The string to check an email
6
7
  * @param {String} message the error will return if str is not an email
7
8
  * @returns {Boolean} true if value is an email, message or default error if value is not an email
8
9
  */
9
-
10
10
  export const isEmail = (str, _, message) => {
11
11
  if (!nonNullish(str) || str === '') return true;
12
12
  return isEmailHandler(str) || (nonNullish(message) ? message : getGlobal(['validate', 'isEmail']));
13
13
  };
14
+
14
15
  /**
15
16
  * Validation value is not an empty string, array or object
16
17
  * @param {String|Object|Array} value the value to validate not empty
17
18
  * @param {String} message the error will return if value is empty
18
19
  * @returns {Boolean} true if value is not empty, message or default error if value is empty
19
20
  */
20
-
21
21
  export const isNotEmpty = (value, _, message) => {
22
22
  if (!nonNullish(value)) return getGlobal(['validate', 'invalidInput']);
23
-
24
23
  if (typeof value === 'string') {
25
24
  return value !== '' || message || getGlobal(['validate', 'isNotEmptyString']);
26
25
  } else if (typeof value === 'object') {
@@ -30,9 +29,9 @@ export const isNotEmpty = (value, _, message) => {
30
29
  return Object.keys(value).length || message || getGlobal(['validate', 'isNotEmptyObject']);
31
30
  }
32
31
  }
33
-
34
32
  return true;
35
33
  };
34
+
36
35
  /**
37
36
  * Check a number is less than or equal the maximum allowed
38
37
  * @param {Number} value the value to compare with maximum
@@ -40,12 +39,12 @@ export const isNotEmpty = (value, _, message) => {
40
39
  * @param {String} message the error will return if value > maximum
41
40
  * @returns {Boolean|String} true if value is valid, message or default error if invalid (both value and maximum)
42
41
  */
43
-
44
42
  export const max = (value, maximum, message) => {
45
43
  if (!nonNullish([value, maximum]) || value === '') return true;
46
44
  if (isNaN(value) || isNaN(maximum)) return getGlobal(['validate', 'invalidInput']);
47
45
  return value <= maximum || (nonNullish(message) ? message : `${getGlobal(['validate', 'max'])} (${maximum})`);
48
46
  };
47
+
49
48
  /**
50
49
  * check a number is greater than or equal the minimum allowed
51
50
  * @param {Number} value the value to compare with minimize
@@ -53,31 +52,27 @@ export const max = (value, maximum, message) => {
53
52
  * @param {String} message the error will return if value < minimize
54
53
  * @returns {Boolean|String} true if value is valid, message or default error if invalid (both value and minimize)
55
54
  */
56
-
57
55
  export const min = (value, minimize, message) => {
58
56
  if (!nonNullish([value, minimize]) || value === '') return true;
59
57
  if (isNaN(value) || isNaN(minimize)) return getGlobal(['validate', 'invalidInput']);
60
58
  return value >= minimize || (nonNullish(message) ? message : `${getGlobal(['validate', 'min'])} (${minimize})`);
61
59
  };
60
+
62
61
  /**
63
62
  * check value has anything
64
63
  * @param {String|Number|Object} value the value to check
65
64
  * @param {String} message the error will return if undefined|null|empty
66
65
  * @returns {Boolean|String} true if value is valid, message input or default error if value invalid
67
66
  */
68
-
69
67
  export const required = (value, message) => {
70
68
  return nonNullish(value) && value !== '' || (nonNullish(message) ? message : getGlobal(['validate', 'required']));
71
69
  };
72
-
73
70
  const nonNullish = value => {
74
71
  if (Array.isArray(value)) {
75
72
  return value.every(v => v !== undefined && v !== null);
76
73
  }
77
-
78
74
  return value !== undefined && value !== null;
79
75
  };
80
-
81
76
  const validations = {
82
77
  isEmail,
83
78
  isNotEmpty,
@@ -85,6 +80,7 @@ const validations = {
85
80
  min,
86
81
  required
87
82
  };
83
+
88
84
  /**
89
85
  * validation value follow rule(s)
90
86
  * @param {String|Number|Object|Array} value the value to validate
@@ -92,41 +88,34 @@ const validations = {
92
88
  * @param {Boolean} returnOneError only return first error if have errors
93
89
  * @returns {Boolean|String|Array} true if value is valid, error text or an array error if invalid value
94
90
  */
95
-
96
91
  const onValidate = (value, rules, returnOneError) => {
97
92
  if (!rules) return true;
98
93
  let result = true;
99
-
100
94
  if (typeof rules === 'function') {
101
95
  result = rules(value);
102
96
  } else if (typeof rules === 'object') {
103
97
  if (Array.isArray(rules)) {
104
98
  rules.forEach(rule => {
105
99
  let res;
106
-
107
100
  if (typeof rule === 'string') {
108
101
  res = validations[rule](value);
109
102
  } else {
110
103
  const name = rule.name || Object.keys(rule)[0];
111
104
  const compareValue = rule.compareValue !== undefined ? rule.compareValue : rule[name];
112
-
113
105
  if (name && validations[name]) {
114
106
  res = validations[name](value, compareValue, rule.message);
115
107
  }
116
108
  }
117
-
118
109
  if (res !== true) {
119
110
  if (result === true) {
120
111
  result = [];
121
112
  }
122
-
123
113
  result.push(res);
124
114
  }
125
115
  });
126
116
  } else {
127
117
  const name = rules.name || Object.keys(rules)[0];
128
118
  const compareValue = rules.compareValue !== undefined ? rules.compareValue : rules[name];
129
-
130
119
  if (name) {
131
120
  result = validations[name](value, compareValue, rules.message);
132
121
  }
@@ -134,7 +123,6 @@ const onValidate = (value, rules, returnOneError) => {
134
123
  } else if (validations[rules]) {
135
124
  result = validations[rules](value);
136
125
  }
137
-
138
126
  if (returnOneError) {
139
127
  if (result === true) {
140
128
  return false;
@@ -142,8 +130,6 @@ const onValidate = (value, rules, returnOneError) => {
142
130
  return result;
143
131
  } else return result[0];
144
132
  }
145
-
146
133
  return result;
147
134
  };
148
-
149
135
  export default onValidate;