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.
- package/components/accordion/details.js +2 -6
- package/components/accordion/group.js +2 -9
- package/components/accordion/index.js +2 -15
- package/components/accordion/summary.js +4 -27
- package/components/alert/index.js +98 -137
- package/components/alert/notify.js +97 -166
- package/components/avatar/index.js +4 -63
- package/components/badge/index.js +7 -34
- package/components/button/icon.js +120 -186
- package/components/button/index.js +136 -205
- package/components/button/more.js +0 -12
- package/components/button/ripple-effect.js +46 -44
- package/components/card/body.js +2 -7
- package/components/card/extra.js +2 -7
- package/components/card/footer.js +2 -7
- package/components/card/header.js +2 -7
- package/components/card/index.js +2 -22
- package/components/chart/Pie/Circle.js +0 -1
- package/components/chart/Pie/Sector.js +0 -17
- package/components/chart/Pie/Sectors.js +0 -10
- package/components/chart/Pie/index.js +4 -36
- package/components/chart/Pie-v2/Circle.js +0 -1
- package/components/chart/Pie-v2/Sector.js +0 -13
- package/components/chart/Pie-v2/Sectors.js +0 -20
- package/components/chart/Pie-v2/index.js +11 -38
- package/components/chart/bar/Axis.js +0 -12
- package/components/chart/bar/Bar.js +13 -35
- package/components/chart/bar/Grid.js +0 -18
- package/components/chart/bar/Labels.js +0 -18
- package/components/chart/bar/Points.js +0 -17
- package/components/chart/bar/index.js +6 -26
- package/components/chart/bar-v2/Axis.js +0 -12
- package/components/chart/bar-v2/Bar.js +15 -36
- package/components/chart/bar-v2/Grid.js +0 -18
- package/components/chart/bar-v2/Labels.js +0 -18
- package/components/chart/bar-v2/Points.js +0 -17
- package/components/chart/bar-v2/index.js +6 -26
- package/components/chart/line/Axis.js +4 -16
- package/components/chart/line/Grid.js +2 -19
- package/components/chart/line/Labels.js +0 -18
- package/components/chart/line/Path.js +23 -33
- package/components/chart/line/Point.js +6 -40
- package/components/chart/line/Title.js +0 -3
- package/components/chart/line/index.js +12 -35
- package/components/chart/line-v2/Axis.js +0 -13
- package/components/chart/line-v2/Grid.js +0 -18
- package/components/chart/line-v2/Labels.js +0 -18
- package/components/chart/line-v2/Path.js +23 -33
- package/components/chart/line-v2/Point.js +6 -35
- package/components/chart/line-v2/Title.js +0 -3
- package/components/chart/line-v2/index.js +12 -30
- package/components/check-text/index.js +0 -8
- package/components/check-text/interview-confirmation.js +0 -7
- package/components/check-text/interview-status.js +0 -7
- package/components/chip/attach.js +4 -17
- package/components/chip/index.js +6 -33
- package/components/collapse/index.js +0 -13
- package/components/divider/index.js +0 -8
- package/components/form-control/attachment/index.js +24 -202
- package/components/form-control/calendar/function.js +40 -94
- package/components/form-control/calendar/index.js +5 -30
- package/components/form-control/calendar/range.js +11 -28
- package/components/form-control/checkbox/index.js +4 -37
- package/components/form-control/control/index.js +3 -13
- package/components/form-control/date-picker/index-old.js +18 -0
- package/components/form-control/date-picker/index.js +23 -99
- package/components/form-control/date-range-picker/index.js +86 -221
- package/components/form-control/dropdown/index.js +72 -289
- package/components/form-control/dropdown-box/index.js +6 -35
- package/components/form-control/form/index.js +0 -2
- package/components/form-control/form-group/index.js +1 -6
- package/components/form-control/helper-text/index.js +2 -9
- package/components/form-control/input-base/index.js +218 -399
- package/components/form-control/label/index.js +2 -12
- package/components/form-control/money-input/index.js +43 -132
- package/components/form-control/number-input/index.js +15 -113
- package/components/form-control/number-input/index2.js +78 -119
- package/components/form-control/phone-input/index.js +16 -78
- package/components/form-control/radio/index.js +4 -23
- package/components/form-control/text-input/index.js +33 -256
- package/components/form-control/time-picker/index.js +14 -71
- package/components/form-control/time-picker/swiper.js +21 -73
- package/components/form-control/toggle/index.js +4 -19
- package/components/form-view/helper-text.js +2 -2
- package/components/form-view/index.js +0 -14
- package/components/form-view/input.js +2 -13
- package/components/form-view/label.js +0 -2
- package/components/grid/Col.js +2 -15
- package/components/grid/Container.js +2 -21
- package/components/grid/Row.js +2 -21
- package/components/grid/index.js +2 -43
- package/components/image/index.js +2 -22
- package/components/index.js +62 -31
- package/components/list/list-item-action.js +0 -9
- package/components/list/list-item-icon.js +0 -9
- package/components/list/list-item-text.js +0 -5
- package/components/list/list-item.js +0 -11
- package/components/list/list.js +0 -13
- package/components/list/sub-header.js +0 -4
- package/components/modal/body.js +2 -6
- package/components/modal/footer.js +2 -11
- package/components/modal/header.js +2 -12
- package/components/modal/index.js +2 -10
- package/components/modal/modal.js +11 -52
- package/components/others/extra/index.js +3 -10
- package/components/others/import/index.js +0 -7
- package/components/others/option-wrapper/index.js +4 -7
- package/components/others/scrollbar/index.js +0 -3
- package/components/paging/page-info.js +39 -101
- package/components/paging/page-selector.js +7 -35
- package/components/paging/page-selector2.js +35 -74
- package/components/paper/index.js +0 -11
- package/components/popover/body.js +2 -6
- package/components/popover/footer.js +2 -11
- package/components/popover/header.js +2 -7
- package/components/popover/index.js +39 -123
- package/components/popup/danger_popup.js +0 -19
- package/components/popup/index.js +2 -48
- package/components/popup/proposals_popup.js +10 -49
- package/components/popup/v2/index.js +0 -31
- package/components/progress/circular.js +19 -81
- package/components/progress/linear.js +4 -20
- package/components/rating/index.js +0 -24
- package/components/slider/slider-container.js +3 -40
- package/components/slider/slider-item.js +10 -25
- package/components/status/index.js +2 -16
- package/components/tab/tab-container.js +2 -16
- package/components/tab/tab-header.js +4 -24
- package/components/tab/tab-panel.js +4 -16
- package/components/tab/tab.js +4 -28
- package/components/tooltip/index.js +12 -97
- package/components/tooltip/portal.js +0 -2
- package/components/transfer/index.js +22 -67
- package/components/tree-view/index.js +62 -202
- package/components/typography/index.js +3 -31
- package/global/index.js +0 -8
- package/icons/basic.js +0 -48
- package/icons/effect.js +17 -29
- package/icons/general/clock/clock.js +0 -2
- package/icons/general/color-handler/background.js +0 -2
- package/icons/general/color-handler/text.js +0 -2
- package/icons/general/emoji/emoji.js +0 -2
- package/icons/general/font-properties/bold.js +0 -2
- package/icons/general/font-properties/font-family.js +0 -2
- package/icons/general/font-properties/font-size.js +0 -2
- package/icons/general/font-properties/italic.js +0 -2
- package/icons/general/font-properties/underline.js +0 -2
- package/icons/general/hyperlink/hyperlink.js +0 -2
- package/icons/general/indent/decrease.js +0 -2
- package/icons/general/indent/increase.js +0 -2
- package/icons/general/list/bullets.js +0 -2
- package/icons/general/list/numbering.js +0 -2
- package/icons/general/picture/picture.js +0 -2
- package/icons/general/steps/redo.js +0 -2
- package/icons/general/steps/undo.js +0 -2
- package/icons/general/text-align/center.js +0 -2
- package/icons/general/text-align/justify.js +0 -2
- package/icons/general/text-align/left.js +0 -2
- package/icons/general/text-align/right.js +0 -2
- package/icons/menu/dhr.js +2 -1
- package/icons/menu/index.js +2 -2
- package/icons/menu/v2/index.js +0 -10
- package/package.json +1 -1
- package/readme.md +11 -1
- package/styles/animation.js +15 -58
- package/styles/color-helper.js +24 -54
- package/styles/colors.js +17 -9
- package/styles/general.js +6 -2
- package/styles/typography.js +4 -4
- package/styles/utils.js +2 -2
- package/theme/createBreakpoints.js +7 -18
- package/theme/make-styles.js +2 -5
- package/theme/set-theme.js +3 -6
- package/theme/settings.js +3 -2
- package/theme/theme-provider.js +0 -1
- package/utils/array/array.js +14 -23
- package/utils/classNames.js +0 -5
- package/utils/console.js +0 -6
- package/utils/date.js +13 -82
- package/utils/error/error.js +1 -9
- package/utils/error/errors.js +1 -48
- package/utils/getFileType.js +0 -9
- package/utils/handleBreakpoints.js +0 -5
- package/utils/intersectionObserver.js +0 -5
- package/utils/iterator.js +0 -9
- package/utils/map-parent.js +3 -10
- package/utils/object/extend.js +0 -10
- package/utils/object/object.js +12 -11
- package/utils/parseHTML.js +0 -1
- package/utils/promisify.js +0 -5
- package/utils/randomString.js +0 -7
- package/utils/remove-unicode.js +0 -1
- package/utils/render-portal.js +1 -9
- package/utils/renderHTML.js +4 -6
- package/utils/renderIcon.js +4 -14
- package/utils/sb-template.js +6 -5
- package/utils/string/capitalize.js +0 -1
- package/utils/string/capitalizeSentenceCase.js +0 -2
- package/utils/string/string.js +0 -13
- package/utils/type.js +0 -21
- package/utils/updatePosition.js +4 -5
- package/utils/useDelayUnmount.js +0 -4
- package/utils/useElementSize.js +9 -3
- package/utils/useEventListener.js +12 -6
- package/utils/useInput.js +0 -6
- package/utils/useMediaQuery.js +8 -10
- package/utils/useOnClickOutside.js +0 -2
- package/utils/usePortal.js +3 -10
- 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;
|