diginet-core-ui 1.3.69-beta.5 → 1.3.69-beta.7
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/avatar/index.js +12 -4
- package/components/badge/index.js +12 -4
- package/components/button/icon.js +12 -4
- package/components/button/index.js +12 -4
- package/components/card/body.js +12 -4
- package/components/card/extra.js +12 -4
- package/components/card/footer.js +12 -4
- package/components/card/header.js +12 -4
- package/components/card/index.js +12 -4
- package/components/form-control/label/index.js +12 -4
- package/components/form-control/money-input/index.js +9 -3
- package/components/form-control/number-input/index2.js +18 -18
- package/components/form-control/phone-input/index.js +7 -7
- package/components/form-control/text-input/index.js +131 -168
- package/components/others/option-wrapper/index.js +5 -12
- package/components/paging/page-info.js +45 -33
- package/components/paging/page-selector2.js +45 -33
- package/components/popover/body.js +12 -4
- package/components/popover/footer.js +12 -4
- package/components/popover/header.js +12 -4
- package/components/popover/index.js +22 -11
- package/components/status/index.js +12 -4
- package/icons/effect.js +29 -21
- package/package.json +2 -2
|
@@ -51,6 +51,7 @@ const checkFileType = (type, matchType) => {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
54
|
+
action = {},
|
|
54
55
|
src,
|
|
55
56
|
defaultSrc,
|
|
56
57
|
outlined,
|
|
@@ -241,10 +242,17 @@ const Avatar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
241
242
|
}
|
|
242
243
|
}
|
|
243
244
|
}, [src]);
|
|
244
|
-
useImperativeHandle(reference, () =>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
245
|
+
useImperativeHandle(reference, () => {
|
|
246
|
+
const currentRef = ref.current || {};
|
|
247
|
+
currentRef.element = ref.current;
|
|
248
|
+
const _instance = { ...action
|
|
249
|
+
}; // methods
|
|
250
|
+
|
|
251
|
+
_instance.__proto__ = {}; // hidden methods
|
|
252
|
+
|
|
253
|
+
currentRef.instance = _instance;
|
|
254
|
+
return currentRef;
|
|
255
|
+
});
|
|
248
256
|
return useMemo(() => {
|
|
249
257
|
return jsx(Fragment, null, jsx("div", {
|
|
250
258
|
css: _AvatarContainerCSS,
|
|
@@ -72,6 +72,7 @@ const calDotPos = (anchorOrigin, contentDirection, dotSize, hasContent, size) =>
|
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
75
|
+
action = {},
|
|
75
76
|
anchorOrigin,
|
|
76
77
|
contentDirection,
|
|
77
78
|
content,
|
|
@@ -98,10 +99,17 @@ const Badge = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
98
99
|
|
|
99
100
|
const _BadgeRootCSS = BadgeRootCSS(children, name, dotPos, _BadgeNumberCSS);
|
|
100
101
|
|
|
101
|
-
useImperativeHandle(reference, () =>
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
useImperativeHandle(reference, () => {
|
|
103
|
+
const currentRef = ref.current || {};
|
|
104
|
+
currentRef.element = ref.current;
|
|
105
|
+
const _instance = { ...action
|
|
106
|
+
}; // methods
|
|
107
|
+
|
|
108
|
+
_instance.__proto__ = {}; // hidden methods
|
|
109
|
+
|
|
110
|
+
currentRef.instance = _instance;
|
|
111
|
+
return currentRef;
|
|
112
|
+
});
|
|
105
113
|
return useMemo(() => {
|
|
106
114
|
let node = children;
|
|
107
115
|
|
|
@@ -71,6 +71,7 @@ const renderIconLoading = iconSize => {
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
74
|
+
action = {},
|
|
74
75
|
viewType,
|
|
75
76
|
color,
|
|
76
77
|
size,
|
|
@@ -104,10 +105,17 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
104
105
|
|
|
105
106
|
const _ButtonRootCSS = ButtonRootCSS(circular, size, width, _width, height, _height, buttonSize, iconSize, colorHover, color, _color, name);
|
|
106
107
|
|
|
107
|
-
useImperativeHandle(reference, () =>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
useImperativeHandle(reference, () => {
|
|
109
|
+
const currentRef = ref.current || {};
|
|
110
|
+
currentRef.element = ref.current;
|
|
111
|
+
const _instance = { ...action
|
|
112
|
+
}; // methods
|
|
113
|
+
|
|
114
|
+
_instance.__proto__ = {}; // hidden methods
|
|
115
|
+
|
|
116
|
+
currentRef.instance = _instance;
|
|
117
|
+
return currentRef;
|
|
118
|
+
});
|
|
111
119
|
|
|
112
120
|
const _onClick = event => {
|
|
113
121
|
event.persist();
|
|
@@ -99,6 +99,7 @@ const alphaArr = {
|
|
|
99
99
|
};
|
|
100
100
|
const alphaLoading = 0.2;
|
|
101
101
|
const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
102
|
+
action = {},
|
|
102
103
|
children,
|
|
103
104
|
className,
|
|
104
105
|
color,
|
|
@@ -130,10 +131,17 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
130
131
|
|
|
131
132
|
const _ButtonRoot = ButtonRoot(viewType, size, paddingSize, minHeightSize, minHeightSizeLink, outlinedPaddingSize, endIcon, label, iconMarginSize, startIcon, iconSize, color);
|
|
132
133
|
|
|
133
|
-
useImperativeHandle(reference, () =>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
useImperativeHandle(reference, () => {
|
|
135
|
+
const currentRef = ref.current || {};
|
|
136
|
+
currentRef.element = ref.current;
|
|
137
|
+
const _instance = { ...action
|
|
138
|
+
}; // methods
|
|
139
|
+
|
|
140
|
+
_instance.__proto__ = {}; // hidden methods
|
|
141
|
+
|
|
142
|
+
currentRef.instance = _instance;
|
|
143
|
+
return currentRef;
|
|
144
|
+
});
|
|
137
145
|
const StartIcon = useMemo(() => {
|
|
138
146
|
let node = startIcon;
|
|
139
147
|
|
package/components/card/body.js
CHANGED
|
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { jsx } from '@emotion/core';
|
|
7
7
|
import OptionWrapper from '../others/option-wrapper';
|
|
8
8
|
const CardBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
9
|
+
action = {},
|
|
9
10
|
children,
|
|
10
11
|
className,
|
|
11
12
|
id,
|
|
@@ -13,10 +14,17 @@ const CardBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
13
14
|
title
|
|
14
15
|
}, reference) => {
|
|
15
16
|
const ref = useRef(null);
|
|
16
|
-
useImperativeHandle(reference, () =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
useImperativeHandle(reference, () => {
|
|
18
|
+
const currentRef = ref.current || {};
|
|
19
|
+
currentRef.element = ref.current;
|
|
20
|
+
const _instance = { ...action
|
|
21
|
+
}; // methods
|
|
22
|
+
|
|
23
|
+
_instance.__proto__ = {}; // hidden methods
|
|
24
|
+
|
|
25
|
+
currentRef.instance = _instance;
|
|
26
|
+
return currentRef;
|
|
27
|
+
});
|
|
20
28
|
return useMemo(() => {
|
|
21
29
|
return jsx("div", {
|
|
22
30
|
id: id,
|
package/components/card/extra.js
CHANGED
|
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { jsx } from '@emotion/core';
|
|
7
7
|
import OptionWrapper from '../others/option-wrapper';
|
|
8
8
|
const CardExtra = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
9
|
+
action = {},
|
|
9
10
|
children,
|
|
10
11
|
className,
|
|
11
12
|
id,
|
|
@@ -13,10 +14,17 @@ const CardExtra = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
13
14
|
title
|
|
14
15
|
}, reference) => {
|
|
15
16
|
const ref = useRef(null);
|
|
16
|
-
useImperativeHandle(reference, () =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
useImperativeHandle(reference, () => {
|
|
18
|
+
const currentRef = ref.current || {};
|
|
19
|
+
currentRef.element = ref.current;
|
|
20
|
+
const _instance = { ...action
|
|
21
|
+
}; // methods
|
|
22
|
+
|
|
23
|
+
_instance.__proto__ = {}; // hidden methods
|
|
24
|
+
|
|
25
|
+
currentRef.instance = _instance;
|
|
26
|
+
return currentRef;
|
|
27
|
+
});
|
|
20
28
|
return useMemo(() => {
|
|
21
29
|
return jsx("div", {
|
|
22
30
|
id: id,
|
|
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { jsx } from '@emotion/core';
|
|
7
7
|
import OptionWrapper from '../others/option-wrapper';
|
|
8
8
|
const CardFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
9
|
+
action = {},
|
|
9
10
|
children,
|
|
10
11
|
className,
|
|
11
12
|
id,
|
|
@@ -13,10 +14,17 @@ const CardFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
13
14
|
title
|
|
14
15
|
}, reference) => {
|
|
15
16
|
const ref = useRef(null);
|
|
16
|
-
useImperativeHandle(reference, () =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
useImperativeHandle(reference, () => {
|
|
18
|
+
const currentRef = ref.current || {};
|
|
19
|
+
currentRef.element = ref.current;
|
|
20
|
+
const _instance = { ...action
|
|
21
|
+
}; // methods
|
|
22
|
+
|
|
23
|
+
_instance.__proto__ = {}; // hidden methods
|
|
24
|
+
|
|
25
|
+
currentRef.instance = _instance;
|
|
26
|
+
return currentRef;
|
|
27
|
+
});
|
|
20
28
|
return useMemo(() => {
|
|
21
29
|
return jsx("div", {
|
|
22
30
|
id: id,
|
|
@@ -7,6 +7,7 @@ import { jsx } from '@emotion/core';
|
|
|
7
7
|
import OptionWrapper from '../others/option-wrapper';
|
|
8
8
|
import Typography from '../typography';
|
|
9
9
|
const CardHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
10
|
+
action = {},
|
|
10
11
|
children,
|
|
11
12
|
className,
|
|
12
13
|
id,
|
|
@@ -14,10 +15,17 @@ const CardHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
14
15
|
title
|
|
15
16
|
}, reference) => {
|
|
16
17
|
const ref = useRef(null);
|
|
17
|
-
useImperativeHandle(reference, () =>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
useImperativeHandle(reference, () => {
|
|
19
|
+
const currentRef = ref.current || {};
|
|
20
|
+
currentRef.element = ref.current;
|
|
21
|
+
const _instance = { ...action
|
|
22
|
+
}; // methods
|
|
23
|
+
|
|
24
|
+
_instance.__proto__ = {}; // hidden methods
|
|
25
|
+
|
|
26
|
+
currentRef.instance = _instance;
|
|
27
|
+
return currentRef;
|
|
28
|
+
});
|
|
21
29
|
return useMemo(() => {
|
|
22
30
|
return jsx("div", {
|
|
23
31
|
id: id,
|
package/components/card/index.js
CHANGED
|
@@ -23,6 +23,7 @@ const {
|
|
|
23
23
|
spacing
|
|
24
24
|
} = theme;
|
|
25
25
|
const Card = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
26
|
+
action = {},
|
|
26
27
|
body: bodyProp,
|
|
27
28
|
bodyStyle,
|
|
28
29
|
children,
|
|
@@ -44,10 +45,17 @@ const Card = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
44
45
|
|
|
45
46
|
const _CardCSS = CardCSS(width, height, headerDivider, footerDivider, dividerColor);
|
|
46
47
|
|
|
47
|
-
useImperativeHandle(reference, () =>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
useImperativeHandle(reference, () => {
|
|
49
|
+
const currentRef = ref.current || {};
|
|
50
|
+
currentRef.element = ref.current;
|
|
51
|
+
const _instance = { ...action
|
|
52
|
+
}; // methods
|
|
53
|
+
|
|
54
|
+
_instance.__proto__ = {}; // hidden methods
|
|
55
|
+
|
|
56
|
+
currentRef.instance = _instance;
|
|
57
|
+
return currentRef;
|
|
58
|
+
});
|
|
51
59
|
const head = header || title ? jsx(CardHeader, {
|
|
52
60
|
className: (className === null || className === void 0 ? void 0 : className.header) || '',
|
|
53
61
|
style: headerStyle,
|
|
@@ -22,6 +22,7 @@ const {
|
|
|
22
22
|
}
|
|
23
23
|
} = theme;
|
|
24
24
|
const Label = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
25
|
+
action = {},
|
|
25
26
|
disabled,
|
|
26
27
|
readOnly,
|
|
27
28
|
required,
|
|
@@ -35,10 +36,17 @@ const Label = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
35
36
|
...props
|
|
36
37
|
}, reference) => {
|
|
37
38
|
const ref = useRef(null);
|
|
38
|
-
useImperativeHandle(reference, () =>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
useImperativeHandle(reference, () => {
|
|
40
|
+
const currentRef = ref.current || {};
|
|
41
|
+
currentRef.element = ref.current;
|
|
42
|
+
const _instance = { ...action
|
|
43
|
+
}; // methods
|
|
44
|
+
|
|
45
|
+
_instance.__proto__ = {}; // hidden methods
|
|
46
|
+
|
|
47
|
+
currentRef.instance = _instance;
|
|
48
|
+
return currentRef;
|
|
49
|
+
});
|
|
42
50
|
return useMemo(() => jsx("div", {
|
|
43
51
|
css: LabelContainerCSS,
|
|
44
52
|
className: 'DGN-UI-Label-Container'
|
|
@@ -124,6 +124,7 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
124
124
|
prefix,
|
|
125
125
|
suffix,
|
|
126
126
|
labelProps,
|
|
127
|
+
helperTextProps,
|
|
127
128
|
...props
|
|
128
129
|
}, reference) => {
|
|
129
130
|
const ref = useRef(null);
|
|
@@ -446,9 +447,11 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
446
447
|
onKeyUp: onKeyUp,
|
|
447
448
|
onPaste: onPasteHandler
|
|
448
449
|
}), isError && jsx(HelperText, {
|
|
449
|
-
disabled: disabled
|
|
450
|
+
disabled: disabled,
|
|
451
|
+
...helperTextProps
|
|
450
452
|
}, error), !isError && validateResult && jsx(HelperText, {
|
|
451
|
-
disabled: disabled
|
|
453
|
+
disabled: disabled,
|
|
454
|
+
...helperTextProps
|
|
452
455
|
}, validateResult));
|
|
453
456
|
}));
|
|
454
457
|
const MoneyInputRoot = css`
|
|
@@ -585,6 +588,9 @@ MoneyInput.propTypes = {
|
|
|
585
588
|
inputRef: PropTypes.any,
|
|
586
589
|
|
|
587
590
|
/** [Props](https://core.diginet.com.vn/ui/?path=/docs/form-control-text-label) of label. */
|
|
588
|
-
labelProps: PropTypes.object
|
|
591
|
+
labelProps: PropTypes.object,
|
|
592
|
+
|
|
593
|
+
/** [Props](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) of helper text. */
|
|
594
|
+
helperTextProps: PropTypes.object
|
|
589
595
|
};
|
|
590
596
|
export default MoneyInput;
|
|
@@ -79,13 +79,13 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
79
79
|
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
|
|
80
80
|
|
|
81
81
|
if (valueProps || valueProps === 0) valueProps = clamp(valueProps, min, max);
|
|
82
|
-
/**
|
|
83
|
-
* Convert number to format money
|
|
84
|
-
* @param vl {number} - value
|
|
85
|
-
* @type {function(*): number}
|
|
86
|
-
* @return {string}
|
|
87
|
-
* @example 1200300.123 => 1,200,300.123
|
|
88
|
-
* @example 1200300,123 => 1.200.300,123
|
|
82
|
+
/**
|
|
83
|
+
* Convert number to format money
|
|
84
|
+
* @param vl {number} - value
|
|
85
|
+
* @type {function(*): number}
|
|
86
|
+
* @return {string}
|
|
87
|
+
* @example 1200300.123 => 1,200,300.123
|
|
88
|
+
* @example 1200300,123 => 1.200.300,123
|
|
89
89
|
*/
|
|
90
90
|
|
|
91
91
|
const parseNumberToMoney = useCallback((vl, isNumber) => {
|
|
@@ -119,13 +119,13 @@ const NumberInput = /*#__PURE__*/forwardRef(({
|
|
|
119
119
|
|
|
120
120
|
return number;
|
|
121
121
|
}, [decimalSymbol, max, value]);
|
|
122
|
-
/**
|
|
123
|
-
* Convert money to format number
|
|
124
|
-
* @param vl {string} - value
|
|
125
|
-
* @type {function(*): number}
|
|
126
|
-
* @return {number}
|
|
127
|
-
* @example 1,200,300.123 => 1200300.123
|
|
128
|
-
* @example 1.200.300,123 => 1200300.123
|
|
122
|
+
/**
|
|
123
|
+
* Convert money to format number
|
|
124
|
+
* @param vl {string} - value
|
|
125
|
+
* @type {function(*): number}
|
|
126
|
+
* @return {number}
|
|
127
|
+
* @example 1,200,300.123 => 1200300.123
|
|
128
|
+
* @example 1.200.300,123 => 1200300.123
|
|
129
129
|
*/
|
|
130
130
|
|
|
131
131
|
const convertMoneyToNumber = useCallback((vl, isNumber) => {
|
|
@@ -397,10 +397,10 @@ NumberInput.propTypes = {
|
|
|
397
397
|
/** style inline of input in NumberInput component */
|
|
398
398
|
inputStyle: PropTypes.object,
|
|
399
399
|
|
|
400
|
-
/** validation value, argument can:<br/>
|
|
401
|
-
* * string: the validation rule. Example required.<br/>
|
|
402
|
-
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
403
|
-
* * array: the validation rule list, insist object/string
|
|
400
|
+
/** validation value, argument can:<br/>
|
|
401
|
+
* * string: the validation rule. Example required.<br/>
|
|
402
|
+
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
403
|
+
* * array: the validation rule list, insist object/string
|
|
404
404
|
*/
|
|
405
405
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
406
406
|
|
|
@@ -397,13 +397,13 @@ PhoneInput.propTypes = {
|
|
|
397
397
|
/** on input function */
|
|
398
398
|
onInput: PropTypes.func,
|
|
399
399
|
|
|
400
|
-
/**
|
|
401
|
-
* on change function. Return a object, example:<br/>
|
|
402
|
-
* {<br/>
|
|
403
|
-
* target: {value: "(+84) 123 456 789", ...}<br/>
|
|
404
|
-
* value: 0123456789<br/>
|
|
405
|
-
* countryCode: 84<br/>
|
|
406
|
-
* }
|
|
400
|
+
/**
|
|
401
|
+
* on change function. Return a object, example:<br/>
|
|
402
|
+
* {<br/>
|
|
403
|
+
* target: {value: "(+84) 123 456 789", ...}<br/>
|
|
404
|
+
* value: 0123456789<br/>
|
|
405
|
+
* countryCode: 84<br/>
|
|
406
|
+
* }
|
|
407
407
|
*/
|
|
408
408
|
onChange: PropTypes.func,
|
|
409
409
|
|