diginet-core-ui 1.3.67-beta.1 → 1.3.69-beta.1
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/button/index.js +13 -8
- package/components/chart/Pie-v2/Sector.js +2 -2
- package/components/chip/attach.js +5 -5
- package/components/chip/index.js +155 -185
- package/components/form-control/calendar/index.js +16 -16
- package/components/form-control/number-input/index.js +11 -11
- package/components/form-control/number-input/index2.js +22 -22
- package/components/form-control/phone-input/index.js +8 -8
- package/components/form-control/radio/index.js +5 -5
- package/components/others/option-wrapper/index.js +2 -8
- package/components/paging/page-info.js +24 -23
- package/components/paging/page-selector2.js +23 -23
- package/components/popover/index.js +138 -88
- package/components/progress/circular.js +12 -12
- package/components/tab/tab-header.js +14 -7
- package/components/tab/tab.js +1 -1
- package/components/transfer/index.js +3 -3
- package/package.json +5 -2
- package/readme.md +10 -0
- package/styles/color-helper.js +103 -103
- package/utils/error/error.js +2 -2
- package/utils/index.js +1 -0
- package/utils/refType.js +5 -0
- package/utils/renderIcon.js +5 -5
- package/utils/sb-teamplate.js +105 -0
|
@@ -12,6 +12,7 @@ import Ripple from './ripple-effect';
|
|
|
12
12
|
import CircularProgress from '../progress/circular';
|
|
13
13
|
import Icon from '../../icons';
|
|
14
14
|
import { flexRow, alignCenter, justifyCenter, positionRelative, borderRadius4px, borderBox, noPadding, noBorder, cursorPointer, overflowHidden, pointerEventsNone, outlineNone, userSelectNone, backgroundTransparent, inlineFlex, noMargin } from '../../styles/general';
|
|
15
|
+
import { classNames } from '../../utils';
|
|
15
16
|
import theme from '../../theme/settings';
|
|
16
17
|
const {
|
|
17
18
|
colors: {
|
|
@@ -33,7 +34,8 @@ const {
|
|
|
33
34
|
},
|
|
34
35
|
typography: {
|
|
35
36
|
uppercase
|
|
36
|
-
}
|
|
37
|
+
},
|
|
38
|
+
spacing
|
|
37
39
|
} = theme;
|
|
38
40
|
export const getRippleColor = (color, viewType, colors) => {
|
|
39
41
|
if (!isColor(color) && !isColorName(color)) {
|
|
@@ -83,12 +85,13 @@ export const getClassNameFromColor = color => {
|
|
|
83
85
|
return !isColor(color) && !isColorName(color) ? color : 'custom-color';
|
|
84
86
|
};
|
|
85
87
|
const colorMap = new Map([['primary', active], ['success', success], ['warning', warning], ['danger', danger], ['info', info]]);
|
|
86
|
-
const iconSizeMap = new Map([['tiny',
|
|
87
|
-
const paddingSizeMap = new Map([['tiny',
|
|
88
|
-
const outlinedPaddingSizeMap = new Map([['tiny',
|
|
88
|
+
const iconSizeMap = new Map([['tiny', spacing([4])], ['small', spacing([5])], ['medium', spacing([6])], ['large', spacing([8])], ['giant', spacing([10])]]);
|
|
89
|
+
const paddingSizeMap = new Map([['tiny', spacing([1, 2])], ['small', spacing([1.5, 3])], ['medium', spacing([2, 4])], ['large', spacing([2, 5])], ['giant', spacing([2, 6])]]);
|
|
90
|
+
const outlinedPaddingSizeMap = new Map([['tiny', spacing([0.75, 1.75])], ['small', spacing([1.25, 2.75])], ['medium', spacing([1.75, 3.75])], ['large', spacing([1.75, 4.75])], ['giant', spacing([1.75, 5.75])]]);
|
|
89
91
|
const iconMarginSizeMap = new Map([['tiny', '4px'], ['small', '4px'], ['medium', '4px'], ['large', '6px'], ['giant', '8px']]);
|
|
90
92
|
const typographySizeMap = new Map([['tiny', 'heading5'], ['small', 'heading5'], ['medium', 'heading4'], ['large', 'heading2'], ['giant', 'heading1']]);
|
|
91
93
|
const minHeightSizeMap = new Map([['tiny', '24px'], ['small', '32px'], ['medium', '40px'], ['large', '48px'], ['giant', '56px']]);
|
|
94
|
+
const minHeightSizeLinkMap = new Map([['tiny', '16px'], ['small', '20px'], ['medium', '24px'], ['large', '32px'], ['giant', '40px']]);
|
|
92
95
|
const alphaArr = {
|
|
93
96
|
hover: 0.1,
|
|
94
97
|
focus: 0.2,
|
|
@@ -121,10 +124,11 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
121
124
|
const typographySize = typographySizeMap.get(size);
|
|
122
125
|
const iconMarginSize = iconMarginSizeMap.get(size);
|
|
123
126
|
const minHeightSize = minHeightSizeMap.get(size);
|
|
127
|
+
const minHeightSizeLink = minHeightSizeLinkMap.get(size);
|
|
124
128
|
|
|
125
129
|
const _ButtonText = ButtonText(loading, iconMarginSize);
|
|
126
130
|
|
|
127
|
-
const _ButtonRoot = ButtonRoot(viewType, size, paddingSize, minHeightSize, outlinedPaddingSize, endIcon, label, iconMarginSize, startIcon, iconSize, color);
|
|
131
|
+
const _ButtonRoot = ButtonRoot(viewType, size, paddingSize, minHeightSize, minHeightSizeLink, outlinedPaddingSize, endIcon, label, iconMarginSize, startIcon, iconSize, color);
|
|
128
132
|
|
|
129
133
|
useImperativeHandle(reference, () => ({
|
|
130
134
|
element: ref.current,
|
|
@@ -219,7 +223,7 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
219
223
|
onClick: _onClick,
|
|
220
224
|
id: id,
|
|
221
225
|
type: type,
|
|
222
|
-
className:
|
|
226
|
+
className: classNames('DGN-UI-Button', viewType, getClassNameFromColor(color), size, loading && 'button--loading', disabled && 'button--disabled', className),
|
|
223
227
|
...props
|
|
224
228
|
}, start, jsx(Typography, {
|
|
225
229
|
css: _ButtonText,
|
|
@@ -228,7 +232,7 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
228
232
|
}, children || label), end && end, !disabled && !loading && viewType !== 'link' && jsx(Ripple, {
|
|
229
233
|
color: getRippleColor(color, viewType, allColors)
|
|
230
234
|
}));
|
|
231
|
-
}, [
|
|
235
|
+
}, [children, className, color, disabled, endIcon, id, label, loading, onClick, size, startIcon, type, viewType]);
|
|
232
236
|
}));
|
|
233
237
|
const ButtonIcon = css`
|
|
234
238
|
${flexRow};
|
|
@@ -244,7 +248,7 @@ const ButtonText = (loading, iconMarginSize) => css`
|
|
|
244
248
|
margin: 0 ${loading ? iconMarginSize : 0};
|
|
245
249
|
`;
|
|
246
250
|
|
|
247
|
-
const ButtonRoot = (viewType, size, paddingSize, minHeightSize, outlinedPaddingSize, endIcon, label, iconMarginSize, startIcon, iconSize, color) => css`
|
|
251
|
+
const ButtonRoot = (viewType, size, paddingSize, minHeightSize, minHeightSizeLink, outlinedPaddingSize, endIcon, label, iconMarginSize, startIcon, iconSize, color) => css`
|
|
248
252
|
${inlineFlex};
|
|
249
253
|
${alignCenter};
|
|
250
254
|
${justifyCenter};
|
|
@@ -413,6 +417,7 @@ const ButtonRoot = (viewType, size, paddingSize, minHeightSize, outlinedPaddingS
|
|
|
413
417
|
}
|
|
414
418
|
}
|
|
415
419
|
&.link {
|
|
420
|
+
min-height: ${minHeightSizeLink};
|
|
416
421
|
${backgroundTransparent};
|
|
417
422
|
${noBorder};
|
|
418
423
|
${noPadding};
|
|
@@ -94,8 +94,8 @@ Sector.propTypes = {
|
|
|
94
94
|
onTouchEnd: PropTypes.func,
|
|
95
95
|
onTouchStart: PropTypes.func,
|
|
96
96
|
|
|
97
|
-
/** function displays selected items by custom, example:<br/>
|
|
98
|
-
* renderItem={(data, index) => index + ' - ' + data.name}<br/>
|
|
97
|
+
/** function displays selected items by custom, example:<br/>
|
|
98
|
+
* renderItem={(data, index) => index + ' - ' + data.name}<br/>
|
|
99
99
|
*/
|
|
100
100
|
renderSelectedItem: PropTypes.func,
|
|
101
101
|
path: PropTypes.string.isRequired,
|
|
@@ -156,11 +156,11 @@ const AttachChip = /*#__PURE__*/memo(({
|
|
|
156
156
|
}))), attachView);
|
|
157
157
|
});
|
|
158
158
|
AttachChip.propTypes = {
|
|
159
|
-
/** the file info, such as:<br/>
|
|
160
|
-
* {<br/>
|
|
161
|
-
* URL: https://url.com/pathname,<br/>
|
|
162
|
-
* FileName: file.name,<br/>
|
|
163
|
-
* }
|
|
159
|
+
/** the file info, such as:<br/>
|
|
160
|
+
* {<br/>
|
|
161
|
+
* URL: https://url.com/pathname,<br/>
|
|
162
|
+
* FileName: file.name,<br/>
|
|
163
|
+
* }
|
|
164
164
|
*/
|
|
165
165
|
file: PropTypes.shape({
|
|
166
166
|
URL: PropTypes.string.isRequired,
|
package/components/chip/index.js
CHANGED
|
@@ -6,34 +6,33 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
7
|
import { ButtonIcon, Typography } from '../';
|
|
8
8
|
import Icon from '../../icons';
|
|
9
|
-
import { alignCenter, border, borderBox, flexRow, inlineFlex, justifyCenter, positionRelative, userSelectNone, whiteSpaceNoWrap } from '../../styles/general';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { alignCenter, border, borderBox, flexRow, inlineFlex, justifyCenter, positionRelative, userSelectNone, whiteSpaceNoWrap, cursorNotAllowed, positionAbsolute } from '../../styles/general';
|
|
10
|
+
import { hexToRGBA } from '../../styles/color-helper';
|
|
11
|
+
import { useTheme } from '../../theme';
|
|
12
12
|
const {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
line: {
|
|
26
|
-
normal,
|
|
27
|
-
disabled: lineDisabled
|
|
13
|
+
colors: {
|
|
14
|
+
danger,
|
|
15
|
+
info,
|
|
16
|
+
success,
|
|
17
|
+
warning,
|
|
18
|
+
system: {
|
|
19
|
+
active,
|
|
20
|
+
rest,
|
|
21
|
+
white,
|
|
22
|
+
disabled: disabledCl,
|
|
23
|
+
dark
|
|
24
|
+
}
|
|
28
25
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
26
|
+
spacing
|
|
27
|
+
} = useTheme();
|
|
28
|
+
const colorMap = new Map([['default', active], ['primary', active], ['success', success], ['warning', warning], ['danger', danger], ['info', info]]);
|
|
29
|
+
const iconSizeMap = new Map([['small', `${spacing(4)}px`], ['medium', `${spacing(5)}px`], ['large', `${spacing(6)}px`]]);
|
|
30
|
+
const typographySizeMap = new Map([['small', 'p3'], ['medium', 'p2'], ['large', 'p1']]);
|
|
31
|
+
const paddingSizeMap = new Map([['small', `0px ${spacing(1.5)}px`], ['medium', `0px ${spacing(2)}px`], ['large', `0px ${spacing(2.5)}px`]]);
|
|
32
|
+
const minHeightSizeMap = new Map([['small', `${spacing(5)}px`], ['medium', `${spacing(6)}px`], ['large', `${spacing(7)}px`]]);
|
|
34
33
|
const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
35
34
|
viewType,
|
|
36
|
-
color,
|
|
35
|
+
color: colorProps,
|
|
37
36
|
size,
|
|
38
37
|
label,
|
|
39
38
|
className,
|
|
@@ -41,21 +40,44 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
41
40
|
onClick,
|
|
42
41
|
onDbClick,
|
|
43
42
|
onDoubleClick,
|
|
44
|
-
maxLength,
|
|
45
43
|
startIcon,
|
|
46
44
|
endIcon,
|
|
47
45
|
clearAble,
|
|
48
46
|
disabled,
|
|
49
47
|
readOnly,
|
|
50
48
|
children,
|
|
51
|
-
style
|
|
49
|
+
style,
|
|
50
|
+
labelProps
|
|
52
51
|
}, reference) => {
|
|
53
52
|
const ref = useRef(null);
|
|
54
53
|
const IconRef = useRef(null);
|
|
55
54
|
if (!onDbClick && onDoubleClick) onDbClick = onDoubleClick;
|
|
55
|
+
const color = colorMap.get(colorProps) || colorProps;
|
|
56
|
+
const infoChip = {
|
|
57
|
+
color: colorMap.get(colorProps) || colorProps,
|
|
58
|
+
contentColor: viewType !== 'filled' ? color : white,
|
|
59
|
+
backgroundColor: viewType !== 'filled' ? white : color,
|
|
60
|
+
iconSize: iconSizeMap.get(size),
|
|
61
|
+
paddingSize: paddingSizeMap.get(size),
|
|
62
|
+
typographySize: typographySizeMap.get(size),
|
|
63
|
+
minHeightSize: minHeightSizeMap.get(size),
|
|
64
|
+
viewType
|
|
65
|
+
};
|
|
66
|
+
infoChip.border = viewType === 'ghost' ? 'transparent !important' : colorProps === 'default' ? rest : infoChip === null || infoChip === void 0 ? void 0 : infoChip.color;
|
|
67
|
+
infoChip.contentColor = colorProps === 'default' && viewType === 'outlined' ? rest : infoChip === null || infoChip === void 0 ? void 0 : infoChip.contentColor;
|
|
68
|
+
infoChip.backgroundColor = colorProps === 'default' && viewType === 'filled' ? rest : infoChip === null || infoChip === void 0 ? void 0 : infoChip.backgroundColor;
|
|
69
|
+
useImperativeHandle(reference, () => {
|
|
70
|
+
const currentRef = ref.current || {};
|
|
71
|
+
const _instance = {}; // methods
|
|
72
|
+
|
|
73
|
+
_instance.__proto__ = {}; // hidden methods
|
|
74
|
+
|
|
75
|
+
currentRef.instance = _instance;
|
|
76
|
+
return currentRef;
|
|
77
|
+
});
|
|
56
78
|
|
|
57
79
|
const onRemoveHandler = () => {
|
|
58
|
-
if (onRemove) onRemove(ref.current);
|
|
80
|
+
if (onRemove || disabled) onRemove(ref.current);
|
|
59
81
|
setTimeout(() => {
|
|
60
82
|
ref.current && ref.current.remove();
|
|
61
83
|
}, 0);
|
|
@@ -71,212 +93,158 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
71
93
|
onDbClick && event.stopPropagation();
|
|
72
94
|
if (disabled) return;
|
|
73
95
|
onDbClick && onDbClick(event);
|
|
74
|
-
};
|
|
96
|
+
}; // Start Icon
|
|
75
97
|
|
|
76
|
-
const renderLabel = () => {
|
|
77
|
-
if (maxLength && label && label.length > maxLength) {
|
|
78
|
-
label = label.slice(0, maxLength) + '...';
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return label;
|
|
82
|
-
};
|
|
83
98
|
|
|
84
|
-
useImperativeHandle(reference, () => {
|
|
85
|
-
const currentRef = ref.current || {};
|
|
86
|
-
const _instance = {}; // methods
|
|
87
|
-
|
|
88
|
-
_instance.__proto__ = {}; // hidden methods
|
|
89
|
-
|
|
90
|
-
currentRef.instance = _instance;
|
|
91
|
-
return currentRef;
|
|
92
|
-
});
|
|
93
99
|
const startIconView = useMemo(() => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
height: iconSizeMap.get(size),
|
|
101
|
-
color: 'currentColor',
|
|
102
|
-
viewBox: false
|
|
100
|
+
if (typeof startIcon === 'string') {
|
|
101
|
+
return jsx(Icon, {
|
|
102
|
+
name: startIcon,
|
|
103
|
+
width: infoChip.iconSize,
|
|
104
|
+
height: infoChip.iconSize,
|
|
105
|
+
color: 'currentColor'
|
|
103
106
|
});
|
|
104
|
-
}
|
|
107
|
+
} else return jsx("div", {
|
|
108
|
+
css: ChipIconCSS(info)
|
|
109
|
+
}, startIcon);
|
|
110
|
+
}, [startIcon, size]); // Label
|
|
105
111
|
|
|
106
|
-
return startIcon && jsx("div", {
|
|
107
|
-
css: ChipIconCSS,
|
|
108
|
-
className: size
|
|
109
|
-
}, node);
|
|
110
|
-
}, [startIcon, size]);
|
|
111
112
|
const labelView = useMemo(() => {
|
|
112
|
-
return jsx(
|
|
113
|
-
css: ChipLabelCSS
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
}, [label, size, startIcon, endIcon, clearAble]);
|
|
113
|
+
return jsx(Typography, {
|
|
114
|
+
css: ChipLabelCSS,
|
|
115
|
+
type: infoChip.typographySize,
|
|
116
|
+
color: 'inherit',
|
|
117
|
+
lineClamp: 1,
|
|
118
|
+
...labelProps
|
|
119
|
+
}, label);
|
|
120
|
+
}, [label, size, startIcon, endIcon, clearAble]); // End Icon
|
|
121
|
+
|
|
120
122
|
const endIconView = useMemo(() => {
|
|
121
123
|
let node = endIcon;
|
|
122
124
|
|
|
123
125
|
if (typeof node === 'string') {
|
|
124
|
-
|
|
126
|
+
return jsx(Icon, {
|
|
125
127
|
name: node,
|
|
126
|
-
width:
|
|
127
|
-
height:
|
|
128
|
-
color:
|
|
129
|
-
viewBox:
|
|
128
|
+
width: infoChip.iconSize,
|
|
129
|
+
height: infoChip.iconSize,
|
|
130
|
+
color: infoChip.contentColor,
|
|
131
|
+
viewBox: true
|
|
130
132
|
});
|
|
131
133
|
}
|
|
132
134
|
|
|
133
|
-
return clearAble ? jsx(
|
|
134
|
-
|
|
135
|
-
className: 'end-icon
|
|
136
|
-
ref: IconRef
|
|
137
|
-
}, jsx(ButtonIcon, {
|
|
135
|
+
return clearAble ? jsx(ButtonIcon, {
|
|
136
|
+
ref: IconRef,
|
|
137
|
+
className: 'end-icon',
|
|
138
138
|
viewType: 'ghost',
|
|
139
139
|
name: 'Close',
|
|
140
|
-
|
|
140
|
+
width: infoChip.iconSize,
|
|
141
|
+
height: infoChip.iconSize,
|
|
142
|
+
color: infoChip.contentColor,
|
|
141
143
|
disabled: disabled,
|
|
144
|
+
viewBox: true,
|
|
142
145
|
onClick: onRemoveHandler
|
|
143
|
-
})
|
|
144
|
-
css: ChipIconCSS,
|
|
146
|
+
}) : node && jsx("div", {
|
|
147
|
+
css: ChipIconCSS(size),
|
|
145
148
|
className: 'end-icon ' + size,
|
|
146
149
|
ref: IconRef
|
|
147
150
|
}, node);
|
|
148
151
|
}, [clearAble, viewType, color, endIcon, size, disabled]);
|
|
149
152
|
return jsx("div", {
|
|
150
|
-
css: ChipRootCSS(onClick, onDbClick,
|
|
153
|
+
css: ChipRootCSS(onClick, onDbClick, colorProps, infoChip),
|
|
151
154
|
ref: ref,
|
|
152
|
-
className: ['DGN-UI-Chip',
|
|
155
|
+
className: ['DGN-UI-Chip', className, disabled && 'chip--disabled', readOnly && 'chip--readOnly', viewType === 'filled' && 'chip--filled'].join(' '),
|
|
153
156
|
style: style,
|
|
154
157
|
onClick: _onClick,
|
|
155
158
|
onDoubleClick: _onDbClick
|
|
156
|
-
}, startIconView, labelView, endIconView, children);
|
|
159
|
+
}, !!startIcon && startIconView, !!label && labelView, (!!endIcon || !!clearAble) && endIconView, children);
|
|
157
160
|
}));
|
|
158
|
-
const
|
|
159
|
-
${flexRow};
|
|
160
|
-
${justifyCenter};
|
|
161
|
-
${alignCenter};
|
|
162
|
-
${positionRelative};
|
|
163
|
-
${borderBox};
|
|
164
|
-
padding: 0 2px;
|
|
165
|
-
color: inherit;
|
|
166
|
-
img {
|
|
167
|
-
border-radius: 50%;
|
|
168
|
-
}
|
|
169
|
-
&.small {
|
|
170
|
-
width: 24px;
|
|
171
|
-
height: 24px;
|
|
172
|
-
img {
|
|
173
|
-
width: 20px;
|
|
174
|
-
height: 20px;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
&.medium {
|
|
178
|
-
max-width: 32px;
|
|
179
|
-
max-height: 32px;
|
|
180
|
-
img {
|
|
181
|
-
min-width: 24px;
|
|
182
|
-
min-height: 24px;
|
|
183
|
-
}
|
|
184
|
-
&:not(.end-icon) {
|
|
185
|
-
margin-right: 4px;
|
|
186
|
-
}
|
|
187
|
-
&.end-icon {
|
|
188
|
-
width: 32px;
|
|
189
|
-
height: 26px;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
`;
|
|
193
|
-
|
|
194
|
-
const ChipLabelCSS = (startIcon, endIcon, clearAble) => css`
|
|
161
|
+
const ChipLabelCSS = css`
|
|
195
162
|
${flexRow};
|
|
196
163
|
${alignCenter};
|
|
197
164
|
${positionRelative};
|
|
198
165
|
${userSelectNone};
|
|
199
166
|
${whiteSpaceNoWrap};
|
|
200
|
-
padding-right: ${endIcon || clearAble ? 2 : 10}px;
|
|
201
|
-
padding-left: ${startIcon ? 2 : 10}px;
|
|
202
|
-
&.small {
|
|
203
|
-
max-height: 24px;
|
|
204
|
-
}
|
|
205
|
-
&.medium {
|
|
206
|
-
max-height: 32px;
|
|
207
|
-
}
|
|
208
167
|
`;
|
|
209
168
|
|
|
210
|
-
const ChipRootCSS = (onClick, onDbClick,
|
|
169
|
+
const ChipRootCSS = (onClick, onDbClick, colorProps, info) => css`
|
|
211
170
|
${inlineFlex};
|
|
212
171
|
${alignCenter};
|
|
213
172
|
${positionRelative};
|
|
214
173
|
${borderBox};
|
|
215
|
-
${border(
|
|
174
|
+
${border('1px', info.border)};
|
|
216
175
|
width: max-content;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
border-radius: 20px;
|
|
176
|
+
padding: ${info === null || info === void 0 ? void 0 : info.paddingSize};
|
|
177
|
+
color: ${info === null || info === void 0 ? void 0 : info.contentColor};
|
|
178
|
+
background: ${info === null || info === void 0 ? void 0 : info.backgroundColor};
|
|
179
|
+
border-radius: ${spacing(4)}px;
|
|
222
180
|
cursor: ${onClick || onDbClick ? 'pointer' : 'unset'};
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
&.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
181
|
+
height: ${info === null || info === void 0 ? void 0 : info.minHeightSize};
|
|
182
|
+
min-height: ${info === null || info === void 0 ? void 0 : info.minHeightSize};
|
|
183
|
+
gap: ${spacing()}px;
|
|
184
|
+
&.chip--filled {
|
|
185
|
+
&:not(.chip--disabled):not(.chip--readOnly) {
|
|
186
|
+
&::after {
|
|
187
|
+
border-radius: ${spacing(4)}px;
|
|
188
|
+
${positionAbsolute};
|
|
189
|
+
top: 0;
|
|
190
|
+
left: 0;
|
|
191
|
+
content: '';
|
|
192
|
+
width: 100%;
|
|
193
|
+
height: 100%;
|
|
194
|
+
}
|
|
195
|
+
&:hover::after,
|
|
196
|
+
&:focus::after {
|
|
197
|
+
background: ${hexToRGBA(dark, 0.15)};
|
|
198
|
+
}
|
|
199
|
+
&:active::after {
|
|
200
|
+
background: ${hexToRGBA(dark, 0.3)};
|
|
243
201
|
}
|
|
244
202
|
}
|
|
245
203
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
204
|
+
&:not(.chip--filled) {
|
|
205
|
+
&:not(.chip--disabled):not(.chip--readOnly):hover {
|
|
206
|
+
${border('1px', info === null || info === void 0 ? void 0 : info.color)};
|
|
207
|
+
background: ${hexToRGBA(info === null || info === void 0 ? void 0 : info.color, 0.1)};
|
|
208
|
+
color: ${info === null || info === void 0 ? void 0 : info.color};
|
|
250
209
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
color: ${
|
|
255
|
-
border-color: ${colors[color] || color};
|
|
210
|
+
&:not(.chip--disabled):not(.chip--readOnly):active {
|
|
211
|
+
${border('1px', info === null || info === void 0 ? void 0 : info.color)};
|
|
212
|
+
background: ${hexToRGBA(info === null || info === void 0 ? void 0 : info.color, 0.3)};
|
|
213
|
+
color: ${info === null || info === void 0 ? void 0 : info.color};
|
|
256
214
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
color: ${white};
|
|
262
|
-
&:hover {
|
|
263
|
-
color: ${danger};
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
&.${color} {
|
|
267
|
-
background-color: ${colors[color] || color};
|
|
268
|
-
border-color: ${darken(colors[color] || color, 0.22)};
|
|
215
|
+
&:not(.chip--disabled):not(.chip--readOnly):focus {
|
|
216
|
+
${border('1px', info === null || info === void 0 ? void 0 : info.color)};
|
|
217
|
+
background: ${hexToRGBA(info === null || info === void 0 ? void 0 : info.color, 0.2)};
|
|
218
|
+
color: ${info === null || info === void 0 ? void 0 : info.color};
|
|
269
219
|
}
|
|
270
220
|
}
|
|
221
|
+
&.chip--disabled {
|
|
222
|
+
color: ${disabledCl} !important;
|
|
223
|
+
background-color: ${white} !important;
|
|
224
|
+
${border('1px', disabledCl)};
|
|
225
|
+
}
|
|
226
|
+
&.chip--readOnly,
|
|
227
|
+
&.chip--disabled {
|
|
228
|
+
${cursorNotAllowed}
|
|
229
|
+
}
|
|
230
|
+
`;
|
|
231
|
+
|
|
232
|
+
const ChipIconCSS = info => css`
|
|
233
|
+
${flexRow};
|
|
234
|
+
${justifyCenter};
|
|
235
|
+
${alignCenter};
|
|
236
|
+
${positionRelative};
|
|
237
|
+
${borderBox};
|
|
238
|
+
width: ${info === null || info === void 0 ? void 0 : info.iconSize};
|
|
239
|
+
min-width: ${info === null || info === void 0 ? void 0 : info.iconSize};
|
|
240
|
+
height: ${info === null || info === void 0 ? void 0 : info.iconSize};
|
|
241
|
+
min-height: ${info === null || info === void 0 ? void 0 : info.iconSize};
|
|
271
242
|
`;
|
|
272
243
|
|
|
273
244
|
Chip.defaultProps = {
|
|
274
|
-
label: '',
|
|
275
|
-
className: '',
|
|
276
|
-
style: {},
|
|
277
245
|
viewType: 'outlined',
|
|
278
|
-
size: '
|
|
279
|
-
|
|
246
|
+
size: 'medium',
|
|
247
|
+
color: 'default'
|
|
280
248
|
};
|
|
281
249
|
Chip.propTypes = {
|
|
282
250
|
/** content to display in Chip */
|
|
@@ -289,7 +257,6 @@ Chip.propTypes = {
|
|
|
289
257
|
|
|
290
258
|
/** style inline of component */
|
|
291
259
|
style: PropTypes.object,
|
|
292
|
-
maxLength: PropTypes.number,
|
|
293
260
|
|
|
294
261
|
/** the icon display at head of Chip */
|
|
295
262
|
startIcon: PropTypes.any,
|
|
@@ -298,13 +265,13 @@ Chip.propTypes = {
|
|
|
298
265
|
endIcon: PropTypes.any,
|
|
299
266
|
|
|
300
267
|
/** type of chip */
|
|
301
|
-
viewType: PropTypes.oneOf(['outlined', 'filled']),
|
|
268
|
+
viewType: PropTypes.oneOf(['ghost', 'outlined', 'filled']),
|
|
302
269
|
|
|
303
270
|
/** color for text or background of Chip */
|
|
304
271
|
color: PropTypes.oneOf(['default', 'primary', 'info', 'success', 'warning', 'danger']),
|
|
305
272
|
|
|
306
273
|
/** size of Chip */
|
|
307
|
-
size: PropTypes.oneOf(['small', 'medium']),
|
|
274
|
+
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
308
275
|
|
|
309
276
|
/** show clear icon if true */
|
|
310
277
|
clearAble: PropTypes.bool,
|
|
@@ -331,6 +298,9 @@ Chip.propTypes = {
|
|
|
331
298
|
onDoubleClick: PropTypes.func,
|
|
332
299
|
|
|
333
300
|
/** content to display on Chip (the same to label) */
|
|
334
|
-
children: PropTypes.node
|
|
301
|
+
children: PropTypes.node,
|
|
302
|
+
|
|
303
|
+
/** props for Typography of label */
|
|
304
|
+
labelProps: PropTypes.object
|
|
335
305
|
};
|
|
336
306
|
export default Chip;
|
|
@@ -41,8 +41,8 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
41
41
|
limit: 'DGN-UI-Calendar-Day-limit'
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
/**
|
|
45
|
-
* START REFERENCE
|
|
44
|
+
/**
|
|
45
|
+
* START REFERENCE
|
|
46
46
|
*/
|
|
47
47
|
|
|
48
48
|
const ref = useRef(null);
|
|
@@ -61,12 +61,12 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
61
61
|
};
|
|
62
62
|
const firstDayOfMax = new Date(new Date(max).setDate(1)).setHours(0, 0, 0, 0);
|
|
63
63
|
const firstDayOfMin = new Date(new Date(min).setDate(1)).setHours(0, 0, 0, 0);
|
|
64
|
-
/**
|
|
65
|
-
* END REFERENCE
|
|
64
|
+
/**
|
|
65
|
+
* END REFERENCE
|
|
66
66
|
*/
|
|
67
67
|
|
|
68
|
-
/**
|
|
69
|
-
* START FUNCTION
|
|
68
|
+
/**
|
|
69
|
+
* START FUNCTION
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
72
|
const onUpdateNavigatorValue = useCallback(value => {
|
|
@@ -152,12 +152,12 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
152
152
|
onUpdateCalendar(time, navigatorRefs, min, max, tableRef.current, activeValue.current, unique, displayAnotherMonth, onDayClick, onUpdateNavigatorValue);
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
|
-
/**
|
|
156
|
-
* END FUNCTION
|
|
155
|
+
/**
|
|
156
|
+
* END FUNCTION
|
|
157
157
|
*/
|
|
158
158
|
|
|
159
|
-
/**
|
|
160
|
-
* START EFFECT
|
|
159
|
+
/**
|
|
160
|
+
* START EFFECT
|
|
161
161
|
*/
|
|
162
162
|
|
|
163
163
|
|
|
@@ -198,12 +198,12 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
198
198
|
onUpdate(activeValue.current);
|
|
199
199
|
}
|
|
200
200
|
}, [onClick, min, max]);
|
|
201
|
-
/**
|
|
202
|
-
* END FUNCTION
|
|
201
|
+
/**
|
|
202
|
+
* END FUNCTION
|
|
203
203
|
*/
|
|
204
204
|
|
|
205
|
-
/**
|
|
206
|
-
* START COMPONENT
|
|
205
|
+
/**
|
|
206
|
+
* START COMPONENT
|
|
207
207
|
*/
|
|
208
208
|
|
|
209
209
|
const tableMemo = jsx("div", {
|
|
@@ -212,8 +212,8 @@ const Calendar = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
212
212
|
className: unique.table.table,
|
|
213
213
|
ref: tableRef
|
|
214
214
|
}, renderHeader(unique), jsx("tbody", null)));
|
|
215
|
-
/**
|
|
216
|
-
* END COMPONENT
|
|
215
|
+
/**
|
|
216
|
+
* END COMPONENT
|
|
217
217
|
*/
|
|
218
218
|
|
|
219
219
|
return jsx("div", { ...props,
|