diginet-core-ui 1.3.34 → 1.3.35
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/images/menu/dhr/MHRP09N0032.svg +7 -0
- package/components/avatar/index.js +19 -19
- package/components/badge/index.js +61 -64
- package/components/button/icon.js +21 -21
- package/components/button/index.js +180 -180
- package/components/button/ripple-effect.js +23 -23
- package/components/chart/Pie-v2/index.js +40 -42
- package/components/chip/index.js +129 -134
- package/components/form-control/attachment/index.js +431 -435
- package/components/form-control/calendar/function.js +69 -46
- package/components/form-control/calendar/index.js +12 -3
- package/components/form-control/control/index.js +35 -23
- package/components/form-control/date-picker/index.js +36 -36
- package/components/form-control/date-range-picker/index.js +84 -86
- package/components/form-control/dropdown/index.js +462 -431
- package/components/form-control/dropdown-box/index.js +53 -53
- package/components/form-control/label/index.js +16 -15
- package/components/form-control/money-input/index.js +106 -7
- package/components/form-control/radio/index.js +129 -132
- package/components/form-control/text-input/index.js +25 -28
- package/components/form-control/toggle/index.js +106 -107
- package/components/modal/modal.js +43 -46
- package/components/popover/index.js +27 -29
- package/components/popup/index.js +73 -77
- package/components/popup/proposals_popup.js +46 -48
- package/components/popup/v2/index.js +108 -110
- package/components/progress/circular.js +65 -66
- package/components/tab/tab-container.js +32 -14
- package/components/tab/tab-header.js +81 -56
- package/components/tab/tab-panel.js +46 -17
- package/components/tab/tab.js +105 -87
- package/components/tooltip/index.js +24 -26
- package/components/typography/index.js +10 -10
- package/icons/basic.js +148 -27
- package/icons/effect.js +26 -26
- package/package.json +1 -1
- package/readme.md +17 -0
- package/theme/settings.js +7 -5
- package/utils/number.js +11 -12
package/components/chip/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { memo, useRef, forwardRef,
|
|
4
|
+
import { memo, useRef, forwardRef, useMemo, useImperativeHandle } from 'react';
|
|
5
5
|
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, borderBox, flexRow, inlineFlex, justifyCenter, positionRelative, userSelectNone } from '../../styles/general';
|
|
9
|
+
import { alignCenter, border, borderBox, flexRow, inlineFlex, justifyCenter, positionRelative, userSelectNone, whiteSpaceNoWrap } from '../../styles/general';
|
|
10
10
|
import { color as colors } from '../../styles/colors';
|
|
11
11
|
import { darken } from '../../styles/color-helper';
|
|
12
12
|
const {
|
|
@@ -37,7 +37,6 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
37
37
|
size,
|
|
38
38
|
label,
|
|
39
39
|
className,
|
|
40
|
-
refs,
|
|
41
40
|
onRemove,
|
|
42
41
|
onClick,
|
|
43
42
|
onDbClick,
|
|
@@ -53,118 +52,7 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
53
52
|
}, reference) => {
|
|
54
53
|
const ref = useRef(null);
|
|
55
54
|
const IconRef = useRef(null);
|
|
56
|
-
|
|
57
|
-
${flexRow}
|
|
58
|
-
${justifyCenter}
|
|
59
|
-
${alignCenter}
|
|
60
|
-
${positionRelative}
|
|
61
|
-
${borderBox}
|
|
62
|
-
padding: 0 2px;
|
|
63
|
-
color: inherit;
|
|
64
|
-
img {
|
|
65
|
-
border-radius: 50%;
|
|
66
|
-
}
|
|
67
|
-
&.small {
|
|
68
|
-
width: 24px;
|
|
69
|
-
height: 24px;
|
|
70
|
-
img {
|
|
71
|
-
width: 20px;
|
|
72
|
-
height: 20px;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
&.medium {
|
|
76
|
-
max-width: 32px;
|
|
77
|
-
max-height: 32px;
|
|
78
|
-
img {
|
|
79
|
-
min-width: 24px;
|
|
80
|
-
min-height: 24px;
|
|
81
|
-
}
|
|
82
|
-
&:not(.end-icon) {
|
|
83
|
-
margin-right: 4px;
|
|
84
|
-
}
|
|
85
|
-
&.end-icon {
|
|
86
|
-
width: 32px;
|
|
87
|
-
height: 26px;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
`;
|
|
91
|
-
const ChipLabel = css`
|
|
92
|
-
${flexRow}
|
|
93
|
-
${alignCenter}
|
|
94
|
-
${positionRelative}
|
|
95
|
-
${userSelectNone}
|
|
96
|
-
padding-right: ${endIcon || clearAble ? 2 : 10}px;
|
|
97
|
-
padding-left: ${startIcon ? 2 : 10}px;
|
|
98
|
-
white-space: nowrap;
|
|
99
|
-
&.small {
|
|
100
|
-
max-height: 24px;
|
|
101
|
-
}
|
|
102
|
-
&.medium {
|
|
103
|
-
max-height: 32px;
|
|
104
|
-
}
|
|
105
|
-
`;
|
|
106
|
-
const ChipRoot = css`
|
|
107
|
-
${inlineFlex}
|
|
108
|
-
${alignCenter}
|
|
109
|
-
${positionRelative}
|
|
110
|
-
${borderBox}
|
|
111
|
-
width: max-content;
|
|
112
|
-
margin-right: 15px;
|
|
113
|
-
padding: 0 6px;
|
|
114
|
-
color: ${rest};
|
|
115
|
-
background: ${white};
|
|
116
|
-
border: 1px solid ${normal};
|
|
117
|
-
border-radius: 20px;
|
|
118
|
-
cursor: ${onClick || onDbClick ? 'pointer' : 'unset'};
|
|
119
|
-
&.small {
|
|
120
|
-
height: 24px;
|
|
121
|
-
}
|
|
122
|
-
&.medium {
|
|
123
|
-
min-height: 32px;
|
|
124
|
-
padding-top: 2px;
|
|
125
|
-
padding-bottom: 2px;
|
|
126
|
-
}
|
|
127
|
-
&:hover {
|
|
128
|
-
background: ${fillHover};
|
|
129
|
-
border-color: ${active};
|
|
130
|
-
}
|
|
131
|
-
&.chip--disabled {
|
|
132
|
-
color: ${textDisabled} !important;
|
|
133
|
-
background-color: ${fillDisabled} !important;
|
|
134
|
-
border-color: ${lineDisabled} !important;
|
|
135
|
-
pointer-events: none !important;
|
|
136
|
-
.css-${ChipIcon.name} {
|
|
137
|
-
path {
|
|
138
|
-
fill: ${textDisabled} !important;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
&.chip--readOnly {
|
|
143
|
-
cursor: unset !important;
|
|
144
|
-
.css-${ChipIcon.name} {
|
|
145
|
-
pointer-events: none !important;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
&.outlined {
|
|
149
|
-
&.${color} {
|
|
150
|
-
color: ${colors[color] || color};
|
|
151
|
-
border-color: ${colors[color] || color};
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
&.filled {
|
|
155
|
-
color: ${white};
|
|
156
|
-
.clear-icon {
|
|
157
|
-
color: ${white};
|
|
158
|
-
&:hover {
|
|
159
|
-
color: ${danger};
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
&.${color} {
|
|
163
|
-
background-color: ${colors[color] || color};
|
|
164
|
-
border-color: ${darken(colors[color] || color, 0.22)};
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
`;
|
|
55
|
+
if (!onDbClick && onDoubleClick) onDbClick = onDoubleClick;
|
|
168
56
|
|
|
169
57
|
const onRemoveHandler = () => {
|
|
170
58
|
if (onRemove) onRemove(ref.current);
|
|
@@ -175,19 +63,14 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
175
63
|
|
|
176
64
|
const _onClick = event => {
|
|
177
65
|
onClick && event.stopPropagation();
|
|
178
|
-
if (disabled
|
|
66
|
+
if (disabled) return;
|
|
179
67
|
onClick && onClick(event);
|
|
180
68
|
};
|
|
181
69
|
|
|
182
70
|
const _onDbClick = event => {
|
|
183
|
-
|
|
184
|
-
if (disabled
|
|
185
|
-
|
|
186
|
-
if (onDbClick) {
|
|
187
|
-
onDbClick && onDbClick(event);
|
|
188
|
-
} else if (onDoubleClick) {
|
|
189
|
-
onDoubleClick && onDoubleClick(event);
|
|
190
|
-
}
|
|
71
|
+
onDbClick && event.stopPropagation();
|
|
72
|
+
if (disabled) return;
|
|
73
|
+
onDbClick && onDbClick(event);
|
|
191
74
|
};
|
|
192
75
|
|
|
193
76
|
const renderLabel = () => {
|
|
@@ -198,9 +81,6 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
198
81
|
return label;
|
|
199
82
|
};
|
|
200
83
|
|
|
201
|
-
useEffect(() => {
|
|
202
|
-
if (refs) refs(ref);
|
|
203
|
-
}, []);
|
|
204
84
|
useImperativeHandle(reference, () => {
|
|
205
85
|
const currentRef = ref.current || {};
|
|
206
86
|
const _instance = {}; // methods
|
|
@@ -224,19 +104,19 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
224
104
|
}
|
|
225
105
|
|
|
226
106
|
return jsx("div", {
|
|
227
|
-
css:
|
|
107
|
+
css: ChipIconCSS,
|
|
228
108
|
className: size
|
|
229
109
|
}, node);
|
|
230
110
|
}, [startIcon, size]);
|
|
231
111
|
const labelView = useMemo(() => {
|
|
232
112
|
return jsx("div", {
|
|
233
|
-
css:
|
|
113
|
+
css: ChipLabelCSS(startIcon, endIcon, clearAble),
|
|
234
114
|
className: size
|
|
235
115
|
}, jsx(Typography, {
|
|
236
116
|
type: size === 'small' ? 'p2' : 'p1',
|
|
237
117
|
color: 'inherit'
|
|
238
118
|
}, renderLabel()));
|
|
239
|
-
}, [label]);
|
|
119
|
+
}, [label, size, startIcon, endIcon, clearAble]);
|
|
240
120
|
const endIconView = useMemo(() => {
|
|
241
121
|
let node = endIcon;
|
|
242
122
|
|
|
@@ -251,7 +131,7 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
251
131
|
}
|
|
252
132
|
|
|
253
133
|
return clearAble ? jsx("div", {
|
|
254
|
-
css:
|
|
134
|
+
css: ChipIconCSS,
|
|
255
135
|
className: 'end-icon ' + size,
|
|
256
136
|
ref: IconRef
|
|
257
137
|
}, jsx(ButtonIcon, {
|
|
@@ -260,13 +140,13 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
260
140
|
color: viewType === 'outlined' && color ? 'inherit' : undefined,
|
|
261
141
|
onClick: onRemoveHandler
|
|
262
142
|
})) : endIcon && jsx("div", {
|
|
263
|
-
css:
|
|
143
|
+
css: ChipIconCSS,
|
|
264
144
|
className: 'end-icon ' + size,
|
|
265
145
|
ref: IconRef
|
|
266
146
|
}, node);
|
|
267
|
-
}, [clearAble, endIcon, size]);
|
|
147
|
+
}, [clearAble, viewType, color, endIcon, size]);
|
|
268
148
|
return jsx("div", {
|
|
269
|
-
css:
|
|
149
|
+
css: ChipRootCSS(onClick, onDbClick, color),
|
|
270
150
|
ref: ref,
|
|
271
151
|
className: ['DGN-UI-Chip', size, className, color && color !== 'default' && color, color && color !== 'default' && viewType, disabled && 'chip--disabled', readOnly && 'chip--readOnly'].join(' ').trim().replace(/\s+/g, ' '),
|
|
272
152
|
onClick: _onClick,
|
|
@@ -274,6 +154,121 @@ const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
274
154
|
...props
|
|
275
155
|
}, startIconView, labelView, endIconView, children);
|
|
276
156
|
}));
|
|
157
|
+
const ChipIconCSS = css`
|
|
158
|
+
${flexRow};
|
|
159
|
+
${justifyCenter};
|
|
160
|
+
${alignCenter};
|
|
161
|
+
${positionRelative};
|
|
162
|
+
${borderBox};
|
|
163
|
+
padding: 0 2px;
|
|
164
|
+
color: inherit;
|
|
165
|
+
img {
|
|
166
|
+
border-radius: 50%;
|
|
167
|
+
}
|
|
168
|
+
&.small {
|
|
169
|
+
width: 24px;
|
|
170
|
+
height: 24px;
|
|
171
|
+
img {
|
|
172
|
+
width: 20px;
|
|
173
|
+
height: 20px;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
&.medium {
|
|
177
|
+
max-width: 32px;
|
|
178
|
+
max-height: 32px;
|
|
179
|
+
img {
|
|
180
|
+
min-width: 24px;
|
|
181
|
+
min-height: 24px;
|
|
182
|
+
}
|
|
183
|
+
&:not(.end-icon) {
|
|
184
|
+
margin-right: 4px;
|
|
185
|
+
}
|
|
186
|
+
&.end-icon {
|
|
187
|
+
width: 32px;
|
|
188
|
+
height: 26px;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
`;
|
|
192
|
+
|
|
193
|
+
const ChipLabelCSS = (startIcon, endIcon, clearAble) => css`
|
|
194
|
+
${flexRow};
|
|
195
|
+
${alignCenter};
|
|
196
|
+
${positionRelative};
|
|
197
|
+
${userSelectNone};
|
|
198
|
+
${whiteSpaceNoWrap};
|
|
199
|
+
padding-right: ${endIcon || clearAble ? 2 : 10}px;
|
|
200
|
+
padding-left: ${startIcon ? 2 : 10}px;
|
|
201
|
+
&.small {
|
|
202
|
+
max-height: 24px;
|
|
203
|
+
}
|
|
204
|
+
&.medium {
|
|
205
|
+
max-height: 32px;
|
|
206
|
+
}
|
|
207
|
+
`;
|
|
208
|
+
|
|
209
|
+
const ChipRootCSS = (onClick, onDbClick, color) => css`
|
|
210
|
+
${inlineFlex};
|
|
211
|
+
${alignCenter};
|
|
212
|
+
${positionRelative};
|
|
213
|
+
${borderBox};
|
|
214
|
+
${border(1, normal)};
|
|
215
|
+
width: max-content;
|
|
216
|
+
margin-right: 15px;
|
|
217
|
+
padding: 0 6px;
|
|
218
|
+
color: ${rest};
|
|
219
|
+
background: ${white};
|
|
220
|
+
border-radius: 20px;
|
|
221
|
+
cursor: ${onClick || onDbClick ? 'pointer' : 'unset'};
|
|
222
|
+
&.small {
|
|
223
|
+
height: 24px;
|
|
224
|
+
}
|
|
225
|
+
&.medium {
|
|
226
|
+
min-height: 32px;
|
|
227
|
+
padding-top: 2px;
|
|
228
|
+
padding-bottom: 2px;
|
|
229
|
+
}
|
|
230
|
+
&:hover {
|
|
231
|
+
background: ${fillHover};
|
|
232
|
+
border-color: ${active};
|
|
233
|
+
}
|
|
234
|
+
&.chip--disabled {
|
|
235
|
+
color: ${textDisabled} !important;
|
|
236
|
+
background-color: ${fillDisabled} !important;
|
|
237
|
+
border-color: ${lineDisabled} !important;
|
|
238
|
+
pointer-events: none !important;
|
|
239
|
+
.css-${ChipIconCSS.name} {
|
|
240
|
+
path {
|
|
241
|
+
fill: ${textDisabled} !important;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
&.chip--readOnly {
|
|
246
|
+
cursor: unset !important;
|
|
247
|
+
.css-${ChipIconCSS.name} {
|
|
248
|
+
pointer-events: none !important;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
&.outlined {
|
|
252
|
+
&.${color} {
|
|
253
|
+
color: ${colors[color] || color};
|
|
254
|
+
border-color: ${colors[color] || color};
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
&.filled {
|
|
258
|
+
color: ${white};
|
|
259
|
+
.clear-icon {
|
|
260
|
+
color: ${white};
|
|
261
|
+
&:hover {
|
|
262
|
+
color: ${danger};
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
&.${color} {
|
|
266
|
+
background-color: ${colors[color] || color};
|
|
267
|
+
border-color: ${darken(colors[color] || color, 0.22)};
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
`;
|
|
271
|
+
|
|
277
272
|
Chip.defaultProps = {
|
|
278
273
|
label: '',
|
|
279
274
|
className: '',
|