diginet-core-ui 1.3.33 → 1.3.34
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/assets/avatar/default.svg +2 -2
- package/assets/images/menu/dhr/ALL.svg +6 -0
- package/assets/images/menu/dhr/D00.svg +12 -0
- package/assets/images/menu/dhr/D09.svg +8 -0
- package/assets/images/menu/dhr/D13.svg +10 -0
- package/assets/images/menu/dhr/D15.svg +10 -0
- package/assets/images/menu/dhr/D21.svg +10 -0
- package/assets/images/menu/dhr/D25.svg +11 -0
- package/assets/images/menu/dhr/D29.svg +11 -0
- package/assets/images/menu/dhr/D38.svg +6 -0
- package/assets/images/menu/dhr/D39.svg +10 -0
- package/assets/images/menu/dhr/D51.svg +12 -0
- package/assets/images/menu/dhr/D52.svg +16 -0
- package/assets/images/menu/dhr/D77.svg +16 -0
- package/assets/images/menu/dhr/D84.svg +12 -0
- package/assets/images/menu/dhr/D89.svg +8 -0
- package/components/avatar/index.js +153 -204
- package/components/badge/index.js +120 -80
- package/components/button/icon.js +193 -170
- package/components/button/index.js +16 -9
- package/components/button/ripple-effect.js +2 -0
- package/components/chip/index.js +139 -137
- package/components/form-control/dropdown/index.js +337 -316
- package/components/form-control/dropdown-box/index.js +3 -3
- package/components/form-control/toggle/index.js +5 -12
- package/components/typography/index.js +92 -47
- package/icons/basic.js +74 -0
- package/icons/effect.js +51 -23
- package/package.json +1 -1
- package/readme.md +21 -0
- package/styles/colors.js +2 -2
- package/styles/general.js +15 -2
|
@@ -132,7 +132,7 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
132
132
|
};
|
|
133
133
|
|
|
134
134
|
const onClickOutsideOfInput = event => {
|
|
135
|
-
if (
|
|
135
|
+
if (ref.current && !ref.current.contains(event.target) && dropdownBoxRef.current && !dropdownBoxRef.current.contains(event.target)) {
|
|
136
136
|
closeDropdownBox();
|
|
137
137
|
}
|
|
138
138
|
};
|
|
@@ -157,7 +157,7 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
157
157
|
dropdownBoxRef.current.style.opacity = 1; // window.addEventListener('resize', customizeWidthDropdown);
|
|
158
158
|
// window.addEventListener('scroll', updatePositionDropdown);
|
|
159
159
|
|
|
160
|
-
document.addEventListener('
|
|
160
|
+
document.addEventListener('mousedown', onClickOutsideOfInput);
|
|
161
161
|
document.addEventListener('keydown', pressESCHandler);
|
|
162
162
|
!!onOpened && onOpened(ref.current);
|
|
163
163
|
}, 10);
|
|
@@ -181,7 +181,7 @@ const DropdownBox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
181
181
|
// inputBaseRef.current.classList.remove('dropdown-focus');
|
|
182
182
|
// }
|
|
183
183
|
|
|
184
|
-
document.removeEventListener('
|
|
184
|
+
document.removeEventListener('mousedown', onClickOutsideOfInput);
|
|
185
185
|
timing[unique + 'Box'] = setTimeout(() => {
|
|
186
186
|
clearTimeout(timing[unique + 'Box']);
|
|
187
187
|
timing[unique + 'Box'] = null;
|
|
@@ -26,7 +26,7 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
26
26
|
inputRef = useRef(null);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
const [checkedState, setCheckedState] = useState(checked
|
|
29
|
+
const [checkedState, setCheckedState] = useState(Boolean(checked !== undefined ? checked : defaultChecked));
|
|
30
30
|
|
|
31
31
|
if (size === 'small') {
|
|
32
32
|
height = 10;
|
|
@@ -147,7 +147,7 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
147
147
|
|
|
148
148
|
const handleChange = () => {
|
|
149
149
|
if (disabled) return;
|
|
150
|
-
|
|
150
|
+
setCheckedState(checked !== undefined ? Boolean(checked) : !checkedState);
|
|
151
151
|
const e = {
|
|
152
152
|
value: !checkedState,
|
|
153
153
|
target: { ...inputRef.current,
|
|
@@ -170,15 +170,8 @@ const Toggle = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
172
|
}, [disabled, onChange]);
|
|
173
|
-
|
|
174
|
-
const setChecked = check => {
|
|
175
|
-
if (typeof check === 'boolean') {
|
|
176
|
-
setCheckedState(check);
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
|
-
|
|
180
173
|
useEffect(() => {
|
|
181
|
-
if (checked !== undefined)
|
|
174
|
+
if (checked !== undefined) setCheckedState(Boolean(checked));
|
|
182
175
|
}, [checked]);
|
|
183
176
|
return useMemo(() => jsx("div", {
|
|
184
177
|
id: 'DGN-Core-Toggle-' + (id ? id : idDefault),
|
|
@@ -218,10 +211,10 @@ Toggle.propTypes = {
|
|
|
218
211
|
disabled: PropTypes.bool,
|
|
219
212
|
|
|
220
213
|
/** If `true`, the component is defaultChecked. */
|
|
221
|
-
defaultChecked: PropTypes.bool,
|
|
214
|
+
defaultChecked: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf([0, 1])]),
|
|
222
215
|
|
|
223
216
|
/** If `true`, the component is checked. */
|
|
224
|
-
checked: PropTypes.bool,
|
|
217
|
+
checked: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf([0, 1])]),
|
|
225
218
|
|
|
226
219
|
/** the size options default and small */
|
|
227
220
|
size: PropTypes.string,
|
|
@@ -1,13 +1,43 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
|
-
import { memo, useRef, forwardRef } from 'react';
|
|
2
|
+
import { memo, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { css } from '@emotion/core';
|
|
5
5
|
import { renderHTML } from '../../utils';
|
|
6
|
-
import { useTheme } from '../../theme';
|
|
7
6
|
import { typography } from '../../styles/typography';
|
|
7
|
+
import { breakWord, displayBlock, displayInlineBlock, overflowHidden, positionRelative, textCapitalize, textCenter, textUppercase } from '../../styles/general';
|
|
8
|
+
import { color as colors } from '../../styles/colors';
|
|
8
9
|
const {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
title1,
|
|
11
|
+
title2,
|
|
12
|
+
title3,
|
|
13
|
+
title4,
|
|
14
|
+
heading1,
|
|
15
|
+
heading2,
|
|
16
|
+
heading3,
|
|
17
|
+
heading4,
|
|
18
|
+
heading5,
|
|
19
|
+
heading6,
|
|
20
|
+
paragraph1,
|
|
21
|
+
paragraph2,
|
|
22
|
+
paragraph3
|
|
23
|
+
} = typography;
|
|
24
|
+
const {
|
|
25
|
+
system: {
|
|
26
|
+
active,
|
|
27
|
+
rest
|
|
28
|
+
},
|
|
29
|
+
semantic: {
|
|
30
|
+
success,
|
|
31
|
+
warning,
|
|
32
|
+
danger,
|
|
33
|
+
info
|
|
34
|
+
},
|
|
35
|
+
text: {
|
|
36
|
+
main
|
|
37
|
+
}
|
|
38
|
+
} = colors;
|
|
39
|
+
const typographyMap = new Map([['t1', title1], ['t2', title2], ['t3', title3], ['t4', title4], ['h1', heading1], ['h2', heading2], ['h3', heading3], ['h4', heading4], ['h5', heading5], ['h6', heading6], ['p1', paragraph1], ['p2', paragraph2], ['p3', paragraph3]]);
|
|
40
|
+
const colorMap = new Map([['default', main], ['primary', active], ['secondary', rest], ['success', success], ['warning', warning], ['danger', danger], ['info', info]]);
|
|
11
41
|
const Typography = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
12
42
|
type,
|
|
13
43
|
color,
|
|
@@ -17,42 +47,54 @@ const Typography = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
17
47
|
fullWidth,
|
|
18
48
|
mapping,
|
|
19
49
|
className,
|
|
50
|
+
lineClamp,
|
|
20
51
|
children,
|
|
21
52
|
...props
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
ref = useRef(null);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const typographyMap = new Map([['title1', typography.title1], ['title2', typography.title2], ['title3', typography.title3], ['title4', typography.title4], ['h1', typography.heading1], ['h2', typography.heading2], ['h3', typography.heading3], ['h4', typography.heading4], ['h5', typography.heading5], ['h6', typography.heading6], ['p1', typography.paragraph1], ['p2', typography.paragraph2], ['p3', typography.paragraph3]]);
|
|
53
|
+
}, reference) => {
|
|
54
|
+
const typographyRef = useRef(null);
|
|
28
55
|
const TextRoot = css`
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
${
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
${displayInlineBlock}
|
|
57
|
+
${positionRelative}
|
|
58
|
+
${breakWord}
|
|
59
|
+
${paragraph1};
|
|
60
|
+
white-space: normal;
|
|
61
|
+
color: ${colorMap.get(color) || colors[color] || color};
|
|
62
|
+
max-width: max-content;
|
|
63
|
+
&.DGN-Typography-${type} {
|
|
64
|
+
${typographyMap.get(type.charAt(0) + type.slice(-1))}; //Get first and last character of type
|
|
65
|
+
}
|
|
66
|
+
&.DGN-Typography-center {
|
|
67
|
+
${textCenter}
|
|
68
|
+
}
|
|
69
|
+
&.DGN-Typography-fullWidth {
|
|
70
|
+
${displayBlock}
|
|
71
|
+
max-width: initial;
|
|
72
|
+
}
|
|
73
|
+
&.DGN-Typography-Uppercase {
|
|
74
|
+
${textUppercase}
|
|
75
|
+
}
|
|
76
|
+
&.DGN-Typography-Capitalize {
|
|
77
|
+
${textCapitalize}
|
|
78
|
+
}
|
|
79
|
+
&.DGN-Typography-Clamp {
|
|
80
|
+
${overflowHidden}
|
|
81
|
+
display: -webkit-box;
|
|
82
|
+
-webkit-line-clamp: ${lineClamp};
|
|
83
|
+
-webkit-box-orient: vertical;
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
useImperativeHandle(reference, () => {
|
|
87
|
+
const currentRef = typographyRef.current || {};
|
|
88
|
+
const _instance = {}; // methods
|
|
89
|
+
|
|
90
|
+
_instance.__proto__ = {}; // hidden methods
|
|
91
|
+
|
|
92
|
+
currentRef.instance = _instance;
|
|
93
|
+
return currentRef;
|
|
94
|
+
});
|
|
95
|
+
const classNames = ['DGN-UI-Typography', center && 'DGN-Typography-center', fullWidth && 'DGN-Typography-fullWidth', `DGN-Typography-${type}`, uppercase && `DGN-Typography-Uppercase`, capitalize && 'DGN-Typography-Capitalize', lineClamp && 'DGN-Typography-Clamp', className].join(' ').trim().replace(/\s+/g, ' ');
|
|
54
96
|
return renderHTML(Array.isArray(children) && !children.some(node => node && String(node.$$typeof) === 'Symbol(react.element)') ? children.join('') : children, mapping, {
|
|
55
|
-
ref,
|
|
97
|
+
ref: typographyRef,
|
|
56
98
|
css: TextRoot,
|
|
57
99
|
className: classNames,
|
|
58
100
|
...props
|
|
@@ -66,19 +108,19 @@ Typography.defaultProps = {
|
|
|
66
108
|
mapping: 'span',
|
|
67
109
|
className: ''
|
|
68
110
|
};
|
|
69
|
-
/** type of text<br/>
|
|
70
|
-
* h1: Title <br/>
|
|
71
|
-
* h2: Header Popup <br/>
|
|
72
|
-
* h3: Header popup <br/>
|
|
73
|
-
* h4: Button, Tab, Title group <br/>
|
|
74
|
-
* h5: Label column, Title group <br/>
|
|
75
|
-
* h6: Label form <br/>
|
|
76
|
-
* p1: Body text <br/>
|
|
77
|
-
* p2: Body text <br/>
|
|
78
|
-
* p3: Notice, Tooltip <br/>
|
|
111
|
+
/** type of text<br/>
|
|
112
|
+
* h1: Title <br/>
|
|
113
|
+
* h2: Header Popup <br/>
|
|
114
|
+
* h3: Header popup <br/>
|
|
115
|
+
* h4: Button, Tab, Title group <br/>
|
|
116
|
+
* h5: Label column, Title group <br/>
|
|
117
|
+
* h6: Label form <br/>
|
|
118
|
+
* p1: Body text <br/>
|
|
119
|
+
* p2: Body text <br/>
|
|
120
|
+
* p3: Notice, Tooltip <br/>
|
|
79
121
|
*/
|
|
80
122
|
|
|
81
|
-
export const arrTypeTypography = ['
|
|
123
|
+
export const arrTypeTypography = ['t1', 't2', 't3', 't4', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p1', 'p2', 'p3', 'title1', 'title2', 'title3', 'title4', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6', 'paragraph1', 'paragraph2', 'paragraph3'];
|
|
82
124
|
Typography.propTypes = {
|
|
83
125
|
type: PropTypes.oneOf(arrTypeTypography),
|
|
84
126
|
|
|
@@ -100,6 +142,9 @@ Typography.propTypes = {
|
|
|
100
142
|
/** text-transform is capitalize if true (and uppercase is false) */
|
|
101
143
|
capitalize: PropTypes.bool,
|
|
102
144
|
|
|
145
|
+
/** The line-clamp property truncates text at a specific number of lines. */
|
|
146
|
+
lineClamp: PropTypes.number,
|
|
147
|
+
|
|
103
148
|
/** allows maximum screen width if true */
|
|
104
149
|
fullWidth: PropTypes.bool,
|
|
105
150
|
|
package/icons/basic.js
CHANGED
|
@@ -3862,6 +3862,52 @@ export const PaperView = /*#__PURE__*/memo(({
|
|
|
3862
3862
|
fill: colors[color] || color
|
|
3863
3863
|
}));
|
|
3864
3864
|
});
|
|
3865
|
+
export const PaperZoom = /*#__PURE__*/memo(({
|
|
3866
|
+
width,
|
|
3867
|
+
height,
|
|
3868
|
+
color = '#7F828E',
|
|
3869
|
+
viewBox = false
|
|
3870
|
+
}) => {
|
|
3871
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
3872
|
+
width: width || 24,
|
|
3873
|
+
height: height || 24,
|
|
3874
|
+
viewBox: "0 0 24 24",
|
|
3875
|
+
fill: "none"
|
|
3876
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
3877
|
+
fillRule: "evenodd",
|
|
3878
|
+
clipRule: "evenodd",
|
|
3879
|
+
d: "M18.5763 17.5472H18.0343L17.8422 17.3619C18.5146 16.5798 18.9194 15.5643 18.9194 14.4597C18.9194 11.9966 16.9228 10 14.4597 10C11.9966 10 10 11.9966 10 14.4597C10 16.9228 11.9966 18.9194 14.4597 18.9194C15.5643 18.9194 16.5798 18.5146 17.3619 17.8422L17.5472 18.0343V18.5763L20.9777 22L22 20.9777L18.5763 17.5472ZM14.4597 17.5472C12.7513 17.5472 11.3722 16.1681 11.3722 14.4597C11.3722 12.7513 12.7513 11.3722 14.4597 11.3722C16.1681 11.3722 17.5472 12.7513 17.5472 14.4597C17.5472 16.1681 16.1681 17.5472 14.4597 17.5472ZM14.1166 14.1166V12.7444H14.8027V14.1166H16.175V14.8027H14.8027V16.175H14.1166V14.8027H12.7444V14.1166H14.1166Z",
|
|
3880
|
+
fill: colors[color] || color
|
|
3881
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3882
|
+
d: "M17 4H5V20H17V19.443L18.6665 21.1062C18.3082 21.645 17.6956 22 17 22H5C3.89545 22 3 21.1046 3 20V4C3 2.89539 3.89545 2 5 2H17C18.1046 2 19 2.89539 19 4V11.4265C18.4951 10.6722 17.8073 10.0509 17 9.62573V4Z",
|
|
3883
|
+
fill: colors[color] || color
|
|
3884
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3885
|
+
d: "M11.3093 10H7V12H9.58411C9.98828 11.2004 10.5833 10.5138 11.3093 10Z",
|
|
3886
|
+
fill: colors[color] || color
|
|
3887
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3888
|
+
d: "M7 6H15V8H7V6Z",
|
|
3889
|
+
fill: colors[color] || color
|
|
3890
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
3891
|
+
width: width || 19,
|
|
3892
|
+
height: height || 20,
|
|
3893
|
+
viewBox: "0 0 19 20",
|
|
3894
|
+
fill: "none"
|
|
3895
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
3896
|
+
fillRule: "evenodd",
|
|
3897
|
+
clipRule: "evenodd",
|
|
3898
|
+
d: "M15.5763 15.5472H15.0343L14.8422 15.3619C15.5146 14.5798 15.9194 13.5643 15.9194 12.4597C15.9194 9.99657 13.9228 8 11.4597 8C8.99657 8 7 9.99657 7 12.4597C7 14.9228 8.99657 16.9194 11.4597 16.9194C12.5643 16.9194 13.5798 16.5146 14.3619 15.8422L14.5472 16.0343V16.5763L17.9777 20L19 18.9777L15.5763 15.5472ZM11.4597 15.5472C9.75129 15.5472 8.37221 14.1681 8.37221 12.4597C8.37221 10.7513 9.75129 9.37221 11.4597 9.37221C13.1681 9.37221 14.5472 10.7513 14.5472 12.4597C14.5472 14.1681 13.1681 15.5472 11.4597 15.5472ZM11.1166 12.1166V10.7444H11.8027V12.1166H13.175V12.8027H11.8027V14.175H11.1166V12.8027H9.74443V12.1166H11.1166Z",
|
|
3899
|
+
fill: colors[color] || color
|
|
3900
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3901
|
+
d: "M14 2H2V18H14V17.443L15.6665 19.1062C15.3082 19.645 14.6956 20 14 20H2C0.895447 20 0 19.1046 0 18V2C0 0.895386 0.895447 0 2 0H14C15.1046 0 16 0.895386 16 2V9.42651C15.4951 8.67224 14.8073 8.0509 14 7.62573V2Z",
|
|
3902
|
+
fill: colors[color] || color
|
|
3903
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3904
|
+
d: "M8.30933 8H4V10H6.58411C6.98828 9.20044 7.58331 8.51379 8.30933 8Z",
|
|
3905
|
+
fill: colors[color] || color
|
|
3906
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
3907
|
+
d: "M4 4H12V6H4V4Z",
|
|
3908
|
+
fill: colors[color] || color
|
|
3909
|
+
}));
|
|
3910
|
+
});
|
|
3865
3911
|
export const Pen = /*#__PURE__*/memo(({
|
|
3866
3912
|
width,
|
|
3867
3913
|
height,
|
|
@@ -5925,6 +5971,34 @@ export const ArrowUpFilled = /*#__PURE__*/memo(({
|
|
|
5925
5971
|
fill: colors[color] || color
|
|
5926
5972
|
}));
|
|
5927
5973
|
});
|
|
5974
|
+
export const ArrowSwapHoriz = /*#__PURE__*/memo(({
|
|
5975
|
+
width,
|
|
5976
|
+
height,
|
|
5977
|
+
color = '#7F828E',
|
|
5978
|
+
viewBox = false
|
|
5979
|
+
}) => {
|
|
5980
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
5981
|
+
width: width || 24,
|
|
5982
|
+
height: height || 24,
|
|
5983
|
+
viewBox: "0 0 24 24",
|
|
5984
|
+
fill: "none"
|
|
5985
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
5986
|
+
fillRule: "evenodd",
|
|
5987
|
+
clipRule: "evenodd",
|
|
5988
|
+
d: "M17.01 5L21 9L17.01 13V10H10V8H17.01V5ZM3 15L6.99 11V14H14V16H6.99V19L3 15Z",
|
|
5989
|
+
fill: colors[color] || color
|
|
5990
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
5991
|
+
width: width || 18,
|
|
5992
|
+
height: height || 14,
|
|
5993
|
+
viewBox: "0 0 18 14",
|
|
5994
|
+
fill: "none"
|
|
5995
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
5996
|
+
fillRule: "evenodd",
|
|
5997
|
+
clipRule: "evenodd",
|
|
5998
|
+
d: "M14.01 0L18 4L14.01 8V5H7V3H14.01V0ZM0 10L3.99 6V9H11V11H3.99V14L0 10Z",
|
|
5999
|
+
fill: colors[color] || color
|
|
6000
|
+
}));
|
|
6001
|
+
});
|
|
5928
6002
|
export const BackFilled = /*#__PURE__*/memo(({
|
|
5929
6003
|
width,
|
|
5930
6004
|
height,
|
package/icons/effect.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { memo, useRef, useMemo, forwardRef } from 'react';
|
|
4
|
+
import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
|
+
import OptionWrapper from '../components/others/option-wrapper';
|
|
7
8
|
import { color as colors } from '../styles/colors';
|
|
8
9
|
import * as Icons from './basic';
|
|
9
10
|
import { capitalize } from '../utils';
|
|
11
|
+
import { alignCenter, borderBox, flexRow, justifyCenter, outlineNone, userSelectNone } from '../styles/general';
|
|
10
12
|
const {
|
|
11
13
|
system: {
|
|
12
14
|
rest
|
|
@@ -24,30 +26,36 @@ const Icon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
24
26
|
disabled,
|
|
25
27
|
onClick,
|
|
26
28
|
...props
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
}, reference) => {
|
|
30
|
+
const ref = useRef(null);
|
|
31
|
+
const IconCss = css`
|
|
32
|
+
${flexRow}
|
|
33
|
+
${justifyCenter}
|
|
34
|
+
${alignCenter}
|
|
35
|
+
${borderBox}
|
|
36
|
+
${outlineNone}
|
|
37
|
+
${userSelectNone}
|
|
36
38
|
width: max-content;
|
|
37
39
|
height: max-content;
|
|
38
40
|
min-width: ${width ? isNaN(width) ? width : width + 'px' : '24px'};
|
|
39
41
|
min-height: ${width ? isNaN(height) ? height : height + 'px' : '24px'};
|
|
40
|
-
outline: none;
|
|
41
|
-
box-sizing: border-box;
|
|
42
|
-
user-select: none;
|
|
43
42
|
`;
|
|
44
43
|
const NotFoundIcon = css`
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
${flexRow}
|
|
45
|
+
${borderBox}
|
|
47
46
|
width: ${width ? isNaN(width) ? width : width + 'px' : '24px'};
|
|
48
47
|
height: ${width ? isNaN(width) ? width : width + 'px' : '24px'};
|
|
49
48
|
border: 1px dashed ${rest};
|
|
50
49
|
`;
|
|
50
|
+
useImperativeHandle(reference, () => {
|
|
51
|
+
const currentRef = ref.current || {};
|
|
52
|
+
const _instance = {}; // methods
|
|
53
|
+
|
|
54
|
+
_instance.__proto__ = {}; // hidden methods
|
|
55
|
+
|
|
56
|
+
currentRef.instance = _instance;
|
|
57
|
+
return currentRef;
|
|
58
|
+
});
|
|
51
59
|
return useMemo(() => {
|
|
52
60
|
if (!name) return null;
|
|
53
61
|
let node = null;
|
|
@@ -57,7 +65,7 @@ const Icon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
57
65
|
node = jsx(IconComp, {
|
|
58
66
|
width: width,
|
|
59
67
|
height: height,
|
|
60
|
-
color: color,
|
|
68
|
+
color: colors[color] || color,
|
|
61
69
|
viewBox: viewBox
|
|
62
70
|
});
|
|
63
71
|
} else {
|
|
@@ -69,7 +77,7 @@ const Icon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
69
77
|
return jsx("span", {
|
|
70
78
|
className: 'DGN-UI-Icon ' + className,
|
|
71
79
|
style: style,
|
|
72
|
-
css:
|
|
80
|
+
css: IconCss,
|
|
73
81
|
ref: ref,
|
|
74
82
|
onClick: onClick,
|
|
75
83
|
...props
|
|
@@ -78,15 +86,16 @@ const Icon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
78
86
|
}));
|
|
79
87
|
Icon.defaultProps = {
|
|
80
88
|
className: '',
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
style: {},
|
|
90
|
+
color: 'dark6',
|
|
91
|
+
viewBox: true,
|
|
92
|
+
width: 24,
|
|
93
|
+
height: 24
|
|
83
94
|
};
|
|
84
95
|
Icon.propTypes = {
|
|
85
96
|
/** name of icon in icons store */
|
|
86
97
|
name: PropTypes.string.isRequired,
|
|
87
98
|
|
|
88
|
-
/** the width of icon */
|
|
89
|
-
|
|
90
99
|
/** color of icon<br />
|
|
91
100
|
* default: #7F828E
|
|
92
101
|
*/
|
|
@@ -108,6 +117,25 @@ Icon.propTypes = {
|
|
|
108
117
|
viewBox: PropTypes.bool,
|
|
109
118
|
|
|
110
119
|
/** have view box if true */
|
|
111
|
-
onClick: PropTypes.func
|
|
120
|
+
onClick: PropTypes.func,
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* ref methods
|
|
124
|
+
*
|
|
125
|
+
* * option(): Gets all UI component properties
|
|
126
|
+
* * Returns value - object
|
|
127
|
+
* * option(optionName): Gets the value of a single property
|
|
128
|
+
* * @param {optionName} - string
|
|
129
|
+
* * Returns value - any
|
|
130
|
+
* * option(optionName, optionValue): Updates the value of a single property
|
|
131
|
+
* * @param {optionName} - string
|
|
132
|
+
* * @param {optionValue} - any
|
|
133
|
+
* * option(options): Updates the values of several properties
|
|
134
|
+
* * @param {options} - object
|
|
135
|
+
*/
|
|
136
|
+
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
137
|
+
current: PropTypes.instanceOf(Element)
|
|
138
|
+
})])
|
|
112
139
|
};
|
|
113
|
-
export
|
|
140
|
+
export { Icon };
|
|
141
|
+
export default OptionWrapper(Icon);
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -38,6 +38,27 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.34
|
|
42
|
+
- \[Added\]: Icon - ArrowSwapHoriz, PaperZoom
|
|
43
|
+
- \[Added\]: MenuIcon - ALL, D00, D09, D13, D15, D21, D25, D29, D38, D39, D51, D52, D77, D84, D89
|
|
44
|
+
- \[Changed\]: Typography - Add case ellipsis, multiple lines
|
|
45
|
+
- \[Changed\]: Badge - Phát triển lại component Badge
|
|
46
|
+
- \[Changed\]: Typography - Add type options ( full & short)
|
|
47
|
+
- \[Changed\]: ButtonIcon - Change UI color of viewType ghost (Design update)
|
|
48
|
+
- \[Changed\]: Chip - startIcon, endIcon accept string as CORE icon
|
|
49
|
+
- \[Changed\]: Dropdown - Allow use prop valueObjectDefault without prop onLoadMore
|
|
50
|
+
- \[Changed\]: Icon - Allow using CORE colors, replace general css, add OptionWrapper
|
|
51
|
+
- \[Changed\]: DropdownBox - Fix bug event onClickOutside
|
|
52
|
+
- \[Fixed\]: Change css, typography, colors
|
|
53
|
+
- \[Fixed\]: Avatar - Fix default svg viewBox
|
|
54
|
+
- \[Fixed\]: ButtonIcon - Fix custom width height for viewType ghost
|
|
55
|
+
- \[Fixed\]: ButtonIcon - Remove overflow hidden, fix Ripple when use circular ButtonIcon
|
|
56
|
+
- \[Fixed\]: Button - Fix warning `ref` is not a prop
|
|
57
|
+
- \[Fixed\]: Avatar - Fix actionIconWidth, actionIconHeight; Optimize code
|
|
58
|
+
- \[Fixed\]: Toggle - Fix case value, defaultValue input is number 0,1
|
|
59
|
+
- \[Fixed\]: ButtonIcon - Add min-width, min-height
|
|
60
|
+
- \[Fixed\]: Dropdown - Fix bug cannot select data in editCellRender of DataGrid
|
|
61
|
+
|
|
41
62
|
## 1.3.33
|
|
42
63
|
- \[Fixed\]: Dropdown - Fix show wrong when valueObjectDefault is empty object
|
|
43
64
|
- \[Fixed\]: Button, ButtonIcon - Fix classname
|
package/styles/colors.js
CHANGED
|
@@ -104,7 +104,7 @@ export const warning4 = '#FFC53F';
|
|
|
104
104
|
export const warning5 = '#FFAA00';
|
|
105
105
|
export const warning6 = '#DB8A00';
|
|
106
106
|
export const warning7 = '#B76D00';
|
|
107
|
-
export const warning8 = '#
|
|
107
|
+
export const warning8 = '#935300';
|
|
108
108
|
export const warning9 = '#7A4000'; //danger
|
|
109
109
|
|
|
110
110
|
export const danger1 = '#FFDCD8';
|
|
@@ -210,7 +210,7 @@ export const color = {
|
|
|
210
210
|
warning5: '#FFAA00',
|
|
211
211
|
warning6: '#DB8A00',
|
|
212
212
|
warning7: '#B76D00',
|
|
213
|
-
warning8: '#
|
|
213
|
+
warning8: '#935300',
|
|
214
214
|
warning9: '#7A4000',
|
|
215
215
|
//danger
|
|
216
216
|
danger1: '#FFDCD8',
|
package/styles/general.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css, jsx } from '@emotion/core';
|
|
2
|
-
import { color } from
|
|
3
|
-
import { parseToPixel } from
|
|
2
|
+
import { color } from './colors';
|
|
3
|
+
import { parseToPixel } from './utils';
|
|
4
4
|
export const rootSpacing = 4;
|
|
5
5
|
export const flexRow = css`
|
|
6
6
|
display: flex;
|
|
@@ -98,6 +98,9 @@ export const pointerEventsNone = css`
|
|
|
98
98
|
export const borderNone = css`
|
|
99
99
|
border: none;
|
|
100
100
|
`;
|
|
101
|
+
export const displayNone = css`
|
|
102
|
+
display: none;
|
|
103
|
+
`;
|
|
101
104
|
export const textCenter = css`
|
|
102
105
|
text-align: center;
|
|
103
106
|
`;
|
|
@@ -112,4 +115,14 @@ export const noBorder = css`
|
|
|
112
115
|
`;
|
|
113
116
|
export const border = (withVl, colorVl) => css`
|
|
114
117
|
border: ${parseToPixel(withVl)} solid ${colorVl || color.dark};
|
|
118
|
+
`;
|
|
119
|
+
export const parseWidth = width => css`
|
|
120
|
+
width: ${isNaN(width) ? width : width + 'px'};
|
|
121
|
+
`;
|
|
122
|
+
export const parseHeight = height => css`
|
|
123
|
+
height: ${isNaN(height) ? height : height + 'px'};
|
|
124
|
+
`;
|
|
125
|
+
export const parseWidthHeight = (width, height) => css`
|
|
126
|
+
width: ${isNaN(width) ? width : width + 'px'};
|
|
127
|
+
height: ${isNaN(height) ? height : height + 'px'};
|
|
115
128
|
`;
|