diginet-core-ui 1.3.66 → 1.3.67
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/storybook/avatar01.svg +9 -0
- package/assets/storybook/cover01.svg +9 -0
- package/components/accordion/css.js +6 -6
- package/components/accordion/details.js +13 -18
- package/components/accordion/group.js +16 -17
- package/components/accordion/index.js +17 -22
- package/components/accordion/summary.js +55 -32
- package/components/avatar/index.js +23 -28
- package/components/badge/index.js +9 -14
- package/components/button/icon.js +25 -30
- package/components/button/index.js +275 -280
- package/components/card/body.js +47 -0
- package/components/card/extra.js +47 -0
- package/components/card/footer.js +47 -0
- package/components/card/header.js +50 -0
- package/components/card/index.js +175 -37
- package/components/chart/Pie-v2/Sector.js +2 -2
- package/components/chip/attach.js +5 -5
- package/components/form-control/attachment/index.js +26 -24
- package/components/form-control/calendar/function.js +133 -123
- package/components/form-control/calendar/index.js +16 -16
- package/components/form-control/dropdown/index.js +71 -10
- package/components/form-control/helper-text/index.js +8 -3
- package/components/form-control/number-input/index.js +11 -11
- package/components/form-control/phone-input/index.js +7 -7
- package/components/grid/Container.js +110 -0
- package/components/grid/Row.js +1 -1
- package/components/grid/index.js +35 -5
- package/components/index.js +7 -2
- package/components/others/option-wrapper/index.js +21 -27
- package/components/paging/page-info.js +31 -40
- package/components/popover/index.js +29 -27
- package/components/progress/circular.js +12 -12
- package/components/transfer/index.js +3 -3
- package/components/tree-view/index.js +10 -6
- package/icons/basic.js +120 -0
- package/icons/effect.js +4 -9
- package/package.json +1 -1
- package/readme.md +14 -0
- package/styles/color-helper.js +103 -103
- package/styles/utils.js +17 -5
- package/utils/error/error.js +2 -2
- package/utils/renderIcon.js +5 -5
- package/components/card/body-card.js +0 -65
- package/components/card/card.js +0 -125
- package/components/card/context.js +0 -6
|
@@ -6,38 +6,35 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
7
|
import OptionWrapper from '../others/option-wrapper';
|
|
8
8
|
import * as allColors from '../../styles/colors';
|
|
9
|
-
import { color as colors } from '../../styles/colors';
|
|
10
9
|
import { Typography } from '../';
|
|
11
10
|
import { detectColor, fade, hslToRgb, isColor, isColorName, rgbaToHexA, rgbToHex, hexToRGBA } from '../../styles/color-helper';
|
|
12
11
|
import Ripple from './ripple-effect';
|
|
13
12
|
import CircularProgress from '../progress/circular';
|
|
14
13
|
import Icon from '../../icons';
|
|
15
14
|
import { flexRow, alignCenter, justifyCenter, positionRelative, borderRadius4px, borderBox, noPadding, noBorder, cursorPointer, overflowHidden, pointerEventsNone, outlineNone, userSelectNone, backgroundTransparent, inlineFlex, noMargin } from '../../styles/general';
|
|
16
|
-
import
|
|
15
|
+
import theme from '../../theme/settings';
|
|
17
16
|
const {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
danger,
|
|
35
|
-
info
|
|
17
|
+
colors: {
|
|
18
|
+
system: {
|
|
19
|
+
active,
|
|
20
|
+
disabled: systemDisabled,
|
|
21
|
+
rest,
|
|
22
|
+
white
|
|
23
|
+
},
|
|
24
|
+
semantic: {
|
|
25
|
+
success,
|
|
26
|
+
warning,
|
|
27
|
+
danger,
|
|
28
|
+
info
|
|
29
|
+
},
|
|
30
|
+
fill: {
|
|
31
|
+
disabled: fillDisabled
|
|
32
|
+
}
|
|
36
33
|
},
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
typography: {
|
|
35
|
+
uppercase
|
|
39
36
|
}
|
|
40
|
-
} =
|
|
37
|
+
} = theme;
|
|
41
38
|
export const getRippleColor = (color, viewType, colors) => {
|
|
42
39
|
if (!isColor(color) && !isColorName(color)) {
|
|
43
40
|
let level = 3;
|
|
@@ -90,7 +87,7 @@ const iconSizeMap = new Map([['tiny', '16px'], ['small', '20px'], ['medium', '24
|
|
|
90
87
|
const paddingSizeMap = new Map([['tiny', '4px 8px'], ['small', '6px 12px'], ['medium', '8px 16px'], ['large', '8px 20px'], ['giant', '8px 24px']]);
|
|
91
88
|
const outlinedPaddingSizeMap = new Map([['tiny', '3px 7px'], ['small', '5px 11px'], ['medium', '7px 15px'], ['large', '7px 19px'], ['giant', '7px 23px']]);
|
|
92
89
|
const iconMarginSizeMap = new Map([['tiny', '4px'], ['small', '4px'], ['medium', '4px'], ['large', '6px'], ['giant', '8px']]);
|
|
93
|
-
const typographySizeMap = new Map([['tiny', heading5], ['small', heading5], ['medium', heading4], ['large', heading2], ['giant', heading1]]);
|
|
90
|
+
const typographySizeMap = new Map([['tiny', 'heading5'], ['small', 'heading5'], ['medium', 'heading4'], ['large', 'heading2'], ['giant', 'heading1']]);
|
|
94
91
|
const minHeightSizeMap = new Map([['tiny', '24px'], ['small', '32px'], ['medium', '40px'], ['large', '48px'], ['giant', '56px']]);
|
|
95
92
|
const alphaArr = {
|
|
96
93
|
hover: 0.1,
|
|
@@ -99,19 +96,21 @@ const alphaArr = {
|
|
|
99
96
|
};
|
|
100
97
|
const alphaLoading = 0.2;
|
|
101
98
|
const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
102
|
-
|
|
103
|
-
viewType,
|
|
104
|
-
color,
|
|
105
|
-
size,
|
|
106
|
-
label,
|
|
107
|
-
text,
|
|
99
|
+
children,
|
|
108
100
|
className,
|
|
101
|
+
color,
|
|
109
102
|
disabled,
|
|
110
|
-
onClick,
|
|
111
|
-
startIcon,
|
|
112
103
|
endIcon,
|
|
113
|
-
|
|
104
|
+
id,
|
|
105
|
+
label,
|
|
114
106
|
loading,
|
|
107
|
+
onClick,
|
|
108
|
+
size,
|
|
109
|
+
startIcon,
|
|
110
|
+
stopPropagation,
|
|
111
|
+
text,
|
|
112
|
+
type,
|
|
113
|
+
viewType,
|
|
115
114
|
...props
|
|
116
115
|
}, reference) => {
|
|
117
116
|
const ref = useRef(null);
|
|
@@ -122,219 +121,15 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
122
121
|
const typographySize = typographySizeMap.get(size);
|
|
123
122
|
const iconMarginSize = iconMarginSizeMap.get(size);
|
|
124
123
|
const minHeightSize = minHeightSizeMap.get(size);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
color: inherit;
|
|
135
|
-
margin: 0 ${loading ? iconMarginSize : 0};
|
|
136
|
-
`;
|
|
137
|
-
const ButtonRoot = css`
|
|
138
|
-
${inlineFlex}
|
|
139
|
-
${alignCenter}
|
|
140
|
-
${justifyCenter}
|
|
141
|
-
${positionRelative}
|
|
142
|
-
${borderRadius4px}
|
|
143
|
-
${borderBox}
|
|
144
|
-
${uppercase}
|
|
145
|
-
${cursorPointer}
|
|
146
|
-
${overflowHidden}
|
|
147
|
-
${outlineNone}
|
|
148
|
-
${userSelectNone}
|
|
149
|
-
height: max-content;
|
|
150
|
-
transition: all 0.5s;
|
|
151
|
-
&.button--disabled {
|
|
152
|
-
cursor: not-allowed !important;
|
|
153
|
-
color: ${systemDisabled} !important;
|
|
154
|
-
&.outlined {
|
|
155
|
-
border-color: ${systemDisabled} !important;
|
|
156
|
-
background-color: transparent !important;
|
|
157
|
-
}
|
|
158
|
-
&.filled {
|
|
159
|
-
background-color: ${fillDisabled} !important;
|
|
160
|
-
filter: brightness(1) !important;
|
|
161
|
-
}
|
|
162
|
-
&.text {
|
|
163
|
-
background-color: transparent !important;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
/* &:not(:disabled):focus {
|
|
167
|
-
box-shadow: ${viewType === 'outlined' ? '0 0 0 2px ' + hexToRGBA(active, 0.13) : 'none'};
|
|
168
|
-
} */
|
|
169
|
-
&.button--loading {
|
|
170
|
-
${pointerEventsNone}
|
|
171
|
-
}
|
|
172
|
-
&.${size} {
|
|
173
|
-
padding: ${paddingSize};
|
|
174
|
-
min-height: ${minHeightSize};
|
|
175
|
-
min-width: max-content;
|
|
176
|
-
&.outlined {
|
|
177
|
-
padding: ${outlinedPaddingSize};
|
|
178
|
-
}
|
|
179
|
-
.css-${ButtonText.name} {
|
|
180
|
-
${typographySize};
|
|
181
|
-
}
|
|
182
|
-
.css-${ButtonIcon.name} {
|
|
183
|
-
margin-right: ${endIcon || label ? iconMarginSize : 0};
|
|
184
|
-
&.DGN-UI-Button-End-Icon,
|
|
185
|
-
&.DGN-UI-Button-Custom-End-Icon {
|
|
186
|
-
margin-right: unset;
|
|
187
|
-
margin-left: ${startIcon || label ? iconMarginSize : 0};
|
|
188
|
-
}
|
|
189
|
-
&.DGN-UI-Button-Start-Icon,
|
|
190
|
-
&.DGN-UI-Button-End-Icon {
|
|
191
|
-
height: ${iconSize};
|
|
192
|
-
width: ${iconSize};
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
.no-icon {
|
|
196
|
-
${noMargin}
|
|
197
|
-
height: ${iconSize};
|
|
198
|
-
min-width: 0;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
&.outlined {
|
|
202
|
-
${backgroundTransparent}
|
|
203
|
-
&.default {
|
|
204
|
-
border: 1px solid ${rest};
|
|
205
|
-
color: ${rest};
|
|
206
|
-
&.button--loading,
|
|
207
|
-
&:hover,
|
|
208
|
-
&:focus,
|
|
209
|
-
&:active {
|
|
210
|
-
color: ${active};
|
|
211
|
-
border-color: ${active};
|
|
212
|
-
}
|
|
213
|
-
&.button--loading {
|
|
214
|
-
background-color: ${hexToRGBA(active, alphaLoading)};
|
|
215
|
-
}
|
|
216
|
-
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
217
|
-
background-color: ${hexToRGBA(active, alphaArr[key])};
|
|
218
|
-
}`)}// &:hover | &:focus | &:active
|
|
219
|
-
}
|
|
220
|
-
&.${color} {
|
|
221
|
-
border: 1px solid ${colorMap.get(color)};
|
|
222
|
-
color: ${colorMap.get(color)};
|
|
223
|
-
&.button--loading {
|
|
224
|
-
background-color: ${hexToRGBA(colorMap.get(color), alphaLoading)};
|
|
225
|
-
}
|
|
226
|
-
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
227
|
-
background-color: ${hexToRGBA(colorMap.get(color), alphaArr[key])};
|
|
228
|
-
}`)}
|
|
229
|
-
}
|
|
230
|
-
&.custom-color {
|
|
231
|
-
border: 1px solid ${color};
|
|
232
|
-
color: ${color};
|
|
233
|
-
&.button--loading {
|
|
234
|
-
background-color: ${hexToRGBA(color, alphaLoading)};
|
|
235
|
-
}
|
|
236
|
-
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
237
|
-
background-color: ${hexToRGBA(color, alphaArr[key])};
|
|
238
|
-
}`)}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
&.filled {
|
|
242
|
-
border: none;
|
|
243
|
-
color: ${white};
|
|
244
|
-
font-weight: bold;
|
|
245
|
-
&.button--loading,
|
|
246
|
-
&:hover,
|
|
247
|
-
&:focus {
|
|
248
|
-
filter: brightness(0.85);
|
|
249
|
-
}
|
|
250
|
-
&:active {
|
|
251
|
-
filter: brightness(0.7);
|
|
252
|
-
}
|
|
253
|
-
&.default {
|
|
254
|
-
background-color: ${rest};
|
|
255
|
-
&.button--loading {
|
|
256
|
-
background-color: ${active};
|
|
257
|
-
}
|
|
258
|
-
&:hover,
|
|
259
|
-
&:focus,
|
|
260
|
-
&:active {
|
|
261
|
-
background-color: ${active};
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
&.${color} {
|
|
265
|
-
background-color: ${colorMap.get(color)};
|
|
266
|
-
}
|
|
267
|
-
&.custom-color {
|
|
268
|
-
background-color: ${color};
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
&.text {
|
|
272
|
-
${backgroundTransparent}
|
|
273
|
-
${noBorder}
|
|
274
|
-
&.default {
|
|
275
|
-
color: ${rest};
|
|
276
|
-
&:hover,
|
|
277
|
-
&:focus,
|
|
278
|
-
&:active {
|
|
279
|
-
color: ${active};
|
|
280
|
-
}
|
|
281
|
-
&.button--loading {
|
|
282
|
-
color: ${active};
|
|
283
|
-
background-color: ${hexToRGBA(active, alphaLoading)};
|
|
284
|
-
}
|
|
285
|
-
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
286
|
-
background-color: ${hexToRGBA(active, alphaArr[key])};
|
|
287
|
-
}`)}
|
|
288
|
-
}
|
|
289
|
-
&.${color} {
|
|
290
|
-
color: ${colorMap.get(color)};
|
|
291
|
-
&.button--loading {
|
|
292
|
-
background-color: ${hexToRGBA(colorMap.get(color), alphaLoading)};
|
|
293
|
-
}
|
|
294
|
-
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
295
|
-
background-color: ${hexToRGBA(colorMap.get(color), alphaArr[key])};
|
|
296
|
-
}`)}
|
|
297
|
-
}
|
|
298
|
-
&.custom-color {
|
|
299
|
-
color: ${color};
|
|
300
|
-
&.button--loading {
|
|
301
|
-
background-color: ${hexToRGBA(color, alphaLoading)};
|
|
302
|
-
}
|
|
303
|
-
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
304
|
-
background-color: ${hexToRGBA(color, alphaArr[key])};
|
|
305
|
-
}`)}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
&.link {
|
|
309
|
-
${backgroundTransparent}
|
|
310
|
-
${noBorder}
|
|
311
|
-
${noPadding}
|
|
312
|
-
color: ${info};
|
|
313
|
-
&.button--loading,
|
|
314
|
-
&:hover,
|
|
315
|
-
&:focus {
|
|
316
|
-
filter: brightness(0.85);
|
|
317
|
-
}
|
|
318
|
-
&:active {
|
|
319
|
-
filter: brightness(0.7);
|
|
320
|
-
}
|
|
321
|
-
&.${color} {
|
|
322
|
-
color: ${colorMap.get(color)};
|
|
323
|
-
}
|
|
324
|
-
&.custom-color {
|
|
325
|
-
color: ${color};
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
`;
|
|
329
|
-
useImperativeHandle(reference, () => {
|
|
330
|
-
const currentRef = ref.current || {};
|
|
331
|
-
const _instance = {}; // methods
|
|
332
|
-
|
|
333
|
-
_instance.__proto__ = {}; // hidden methods
|
|
334
|
-
|
|
335
|
-
currentRef.instance = _instance;
|
|
336
|
-
return currentRef;
|
|
337
|
-
});
|
|
124
|
+
|
|
125
|
+
const _ButtonText = ButtonText(loading, iconMarginSize);
|
|
126
|
+
|
|
127
|
+
const _ButtonRoot = ButtonRoot(viewType, size, paddingSize, minHeightSize, outlinedPaddingSize, endIcon, label, iconMarginSize, startIcon, iconSize, color);
|
|
128
|
+
|
|
129
|
+
useImperativeHandle(reference, () => ({
|
|
130
|
+
element: ref.current,
|
|
131
|
+
instance: {}
|
|
132
|
+
}));
|
|
338
133
|
const StartIcon = useMemo(() => {
|
|
339
134
|
let node = startIcon;
|
|
340
135
|
|
|
@@ -391,7 +186,7 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
391
186
|
};
|
|
392
187
|
|
|
393
188
|
const _onClick = event => {
|
|
394
|
-
onClick && event.stopPropagation();
|
|
189
|
+
onClick && stopPropagation && event.stopPropagation();
|
|
395
190
|
if (disabled || loading) return;
|
|
396
191
|
onClick && onClick(event);
|
|
397
192
|
};
|
|
@@ -419,21 +214,226 @@ const Button = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
419
214
|
}
|
|
420
215
|
|
|
421
216
|
return jsx("button", {
|
|
422
|
-
css:
|
|
423
|
-
onClick: _onClick,
|
|
217
|
+
css: _ButtonRoot,
|
|
424
218
|
ref: ref,
|
|
219
|
+
onClick: _onClick,
|
|
220
|
+
id: id,
|
|
425
221
|
type: type,
|
|
426
222
|
className: ['DGN-UI-Button', viewType, getClassNameFromColor(color), size, loading && 'button--loading', disabled && 'button--disabled', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
427
223
|
...props
|
|
428
224
|
}, start, jsx(Typography, {
|
|
429
|
-
css:
|
|
430
|
-
type:
|
|
225
|
+
css: _ButtonText,
|
|
226
|
+
type: typographySize,
|
|
431
227
|
className: 'button-text'
|
|
432
228
|
}, children || label), end && end, !disabled && !loading && viewType !== 'link' && jsx(Ripple, {
|
|
433
229
|
color: getRippleColor(color, viewType, allColors)
|
|
434
230
|
}));
|
|
435
|
-
}, [size, viewType, color, disabled, onClick, loading, startIcon, endIcon, label]);
|
|
231
|
+
}, [size, viewType, color, disabled, onClick, loading, startIcon, endIcon, label, type, className, children, id]);
|
|
436
232
|
}));
|
|
233
|
+
const ButtonIcon = css`
|
|
234
|
+
${flexRow};
|
|
235
|
+
${alignCenter};
|
|
236
|
+
${justifyCenter};
|
|
237
|
+
${positionRelative};
|
|
238
|
+
${borderBox};
|
|
239
|
+
`;
|
|
240
|
+
|
|
241
|
+
const ButtonText = (loading, iconMarginSize) => css`
|
|
242
|
+
white-space: nowrap;
|
|
243
|
+
color: inherit;
|
|
244
|
+
margin: 0 ${loading ? iconMarginSize : 0};
|
|
245
|
+
`;
|
|
246
|
+
|
|
247
|
+
const ButtonRoot = (viewType, size, paddingSize, minHeightSize, outlinedPaddingSize, endIcon, label, iconMarginSize, startIcon, iconSize, color) => css`
|
|
248
|
+
${inlineFlex};
|
|
249
|
+
${alignCenter};
|
|
250
|
+
${justifyCenter};
|
|
251
|
+
${positionRelative};
|
|
252
|
+
${borderRadius4px};
|
|
253
|
+
${borderBox};
|
|
254
|
+
${uppercase};
|
|
255
|
+
${cursorPointer};
|
|
256
|
+
${overflowHidden};
|
|
257
|
+
${outlineNone};
|
|
258
|
+
${userSelectNone};
|
|
259
|
+
height: max-content;
|
|
260
|
+
transition: all 0.5s;
|
|
261
|
+
&.button--disabled {
|
|
262
|
+
cursor: not-allowed !important;
|
|
263
|
+
color: ${systemDisabled} !important;
|
|
264
|
+
&.outlined {
|
|
265
|
+
border-color: ${systemDisabled} !important;
|
|
266
|
+
background-color: transparent !important;
|
|
267
|
+
}
|
|
268
|
+
&.filled {
|
|
269
|
+
background-color: ${fillDisabled} !important;
|
|
270
|
+
filter: brightness(1) !important;
|
|
271
|
+
}
|
|
272
|
+
&.text {
|
|
273
|
+
background-color: transparent !important;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/* &:not(:disabled):focus {
|
|
277
|
+
box-shadow: ${viewType === 'outlined' ? '0 0 0 2px ' + hexToRGBA(active, 0.13) : 'none'};
|
|
278
|
+
} */
|
|
279
|
+
&.button--loading {
|
|
280
|
+
${pointerEventsNone};
|
|
281
|
+
}
|
|
282
|
+
&.${size} {
|
|
283
|
+
padding: ${paddingSize};
|
|
284
|
+
min-height: ${minHeightSize};
|
|
285
|
+
min-width: max-content;
|
|
286
|
+
&.outlined {
|
|
287
|
+
padding: ${outlinedPaddingSize};
|
|
288
|
+
}
|
|
289
|
+
.css-${ButtonIcon.name} {
|
|
290
|
+
margin-right: ${endIcon || label ? iconMarginSize : 0};
|
|
291
|
+
&.DGN-UI-Button-End-Icon,
|
|
292
|
+
&.DGN-UI-Button-Custom-End-Icon {
|
|
293
|
+
margin-right: unset;
|
|
294
|
+
margin-left: ${startIcon || label ? iconMarginSize : 0};
|
|
295
|
+
}
|
|
296
|
+
&.DGN-UI-Button-Start-Icon,
|
|
297
|
+
&.DGN-UI-Button-End-Icon {
|
|
298
|
+
height: ${iconSize};
|
|
299
|
+
width: ${iconSize};
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
.no-icon {
|
|
303
|
+
${noMargin};
|
|
304
|
+
height: ${iconSize};
|
|
305
|
+
min-width: 0;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
&.outlined {
|
|
309
|
+
${backgroundTransparent}
|
|
310
|
+
&.default {
|
|
311
|
+
border: 1px solid ${rest};
|
|
312
|
+
color: ${rest};
|
|
313
|
+
&.button--loading,
|
|
314
|
+
&:hover,
|
|
315
|
+
&:focus,
|
|
316
|
+
&:active {
|
|
317
|
+
color: ${active};
|
|
318
|
+
border-color: ${active};
|
|
319
|
+
}
|
|
320
|
+
&.button--loading {
|
|
321
|
+
background-color: ${hexToRGBA(active, alphaLoading)};
|
|
322
|
+
}
|
|
323
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
324
|
+
background-color: ${hexToRGBA(active, alphaArr[key])};
|
|
325
|
+
}`)}// &:hover | &:focus | &:active
|
|
326
|
+
}
|
|
327
|
+
&.${color} {
|
|
328
|
+
border: 1px solid ${colorMap.get(color)};
|
|
329
|
+
color: ${colorMap.get(color)};
|
|
330
|
+
&.button--loading {
|
|
331
|
+
background-color: ${hexToRGBA(colorMap.get(color), alphaLoading)};
|
|
332
|
+
}
|
|
333
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
334
|
+
background-color: ${hexToRGBA(colorMap.get(color), alphaArr[key])};
|
|
335
|
+
}`)}
|
|
336
|
+
}
|
|
337
|
+
&.custom-color {
|
|
338
|
+
border: 1px solid ${color};
|
|
339
|
+
color: ${color};
|
|
340
|
+
&.button--loading {
|
|
341
|
+
background-color: ${hexToRGBA(color, alphaLoading)};
|
|
342
|
+
}
|
|
343
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
344
|
+
background-color: ${hexToRGBA(color, alphaArr[key])};
|
|
345
|
+
}`)}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
&.filled {
|
|
349
|
+
border: none;
|
|
350
|
+
color: ${white};
|
|
351
|
+
font-weight: bold;
|
|
352
|
+
&.button--loading,
|
|
353
|
+
&:hover,
|
|
354
|
+
&:focus {
|
|
355
|
+
filter: brightness(0.85);
|
|
356
|
+
}
|
|
357
|
+
&:active {
|
|
358
|
+
filter: brightness(0.7);
|
|
359
|
+
}
|
|
360
|
+
&.default {
|
|
361
|
+
background-color: ${rest};
|
|
362
|
+
&.button--loading {
|
|
363
|
+
background-color: ${active};
|
|
364
|
+
}
|
|
365
|
+
&:hover,
|
|
366
|
+
&:focus,
|
|
367
|
+
&:active {
|
|
368
|
+
background-color: ${active};
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
&.${color} {
|
|
372
|
+
background-color: ${colorMap.get(color)};
|
|
373
|
+
}
|
|
374
|
+
&.custom-color {
|
|
375
|
+
background-color: ${color};
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
&.text {
|
|
379
|
+
${backgroundTransparent};
|
|
380
|
+
${noBorder};
|
|
381
|
+
&.default {
|
|
382
|
+
color: ${rest};
|
|
383
|
+
&:hover,
|
|
384
|
+
&:focus,
|
|
385
|
+
&:active {
|
|
386
|
+
color: ${active};
|
|
387
|
+
}
|
|
388
|
+
&.button--loading {
|
|
389
|
+
color: ${active};
|
|
390
|
+
background-color: ${hexToRGBA(active, alphaLoading)};
|
|
391
|
+
}
|
|
392
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
393
|
+
background-color: ${hexToRGBA(active, alphaArr[key])};
|
|
394
|
+
}`)}
|
|
395
|
+
}
|
|
396
|
+
&.${color} {
|
|
397
|
+
color: ${colorMap.get(color)};
|
|
398
|
+
&.button--loading {
|
|
399
|
+
background-color: ${hexToRGBA(colorMap.get(color), alphaLoading)};
|
|
400
|
+
}
|
|
401
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
402
|
+
background-color: ${hexToRGBA(colorMap.get(color), alphaArr[key])};
|
|
403
|
+
}`)}
|
|
404
|
+
}
|
|
405
|
+
&.custom-color {
|
|
406
|
+
color: ${color};
|
|
407
|
+
&.button--loading {
|
|
408
|
+
background-color: ${hexToRGBA(color, alphaLoading)};
|
|
409
|
+
}
|
|
410
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
411
|
+
background-color: ${hexToRGBA(color, alphaArr[key])};
|
|
412
|
+
}`)}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
&.link {
|
|
416
|
+
${backgroundTransparent};
|
|
417
|
+
${noBorder};
|
|
418
|
+
${noPadding};
|
|
419
|
+
color: ${info};
|
|
420
|
+
&.button--loading,
|
|
421
|
+
&:hover,
|
|
422
|
+
&:focus {
|
|
423
|
+
filter: brightness(0.85);
|
|
424
|
+
}
|
|
425
|
+
&:active {
|
|
426
|
+
filter: brightness(0.7);
|
|
427
|
+
}
|
|
428
|
+
&.${color} {
|
|
429
|
+
color: ${colorMap.get(color)};
|
|
430
|
+
}
|
|
431
|
+
&.custom-color {
|
|
432
|
+
color: ${color};
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
`;
|
|
436
|
+
|
|
437
437
|
Button.defaultProps = {
|
|
438
438
|
viewType: 'text',
|
|
439
439
|
color: 'default',
|
|
@@ -441,50 +441,45 @@ Button.defaultProps = {
|
|
|
441
441
|
label: '',
|
|
442
442
|
className: '',
|
|
443
443
|
disabled: false,
|
|
444
|
-
loading: false
|
|
444
|
+
loading: false,
|
|
445
|
+
stopPropagation: true
|
|
445
446
|
};
|
|
446
447
|
Button.propTypes = {
|
|
447
|
-
/** The
|
|
448
|
-
|
|
448
|
+
/** The content of the component. */
|
|
449
|
+
children: PropTypes.node,
|
|
449
450
|
|
|
450
|
-
/**
|
|
451
|
-
|
|
451
|
+
/** Class for component. */
|
|
452
|
+
className: PropTypes.string,
|
|
452
453
|
|
|
453
|
-
/** color
|
|
454
|
+
/** The color of the component. */
|
|
454
455
|
color: PropTypes.string,
|
|
455
456
|
|
|
456
|
-
/**
|
|
457
|
-
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant']),
|
|
458
|
-
|
|
459
|
-
/** the content to display in button (like text prop) */
|
|
460
|
-
label: PropTypes.string,
|
|
461
|
-
|
|
462
|
-
/** the class for button */
|
|
463
|
-
className: PropTypes.string,
|
|
464
|
-
|
|
465
|
-
/** prevent all event if true */
|
|
457
|
+
/** If `true`, the component is disabled. */
|
|
466
458
|
disabled: PropTypes.bool,
|
|
467
459
|
|
|
468
|
-
/** icon
|
|
469
|
-
|
|
460
|
+
/** [Icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic--basic) or element placed after the children. */
|
|
461
|
+
endIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
470
462
|
|
|
471
|
-
/**
|
|
472
|
-
|
|
463
|
+
/** The content of the component. */
|
|
464
|
+
label: PropTypes.string,
|
|
473
465
|
|
|
474
|
-
/**
|
|
475
|
-
|
|
466
|
+
/** If `true`, the loading indicator is shown. */
|
|
467
|
+
loading: PropTypes.bool,
|
|
476
468
|
|
|
477
|
-
/**
|
|
469
|
+
/** Callback fired when the component is clicked. */
|
|
478
470
|
onClick: PropTypes.func,
|
|
479
471
|
|
|
480
|
-
/**
|
|
481
|
-
|
|
472
|
+
/** The size of the component. */
|
|
473
|
+
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant']),
|
|
482
474
|
|
|
483
|
-
/**
|
|
484
|
-
|
|
475
|
+
/** [Icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic--basic) or element placed before the children. */
|
|
476
|
+
startIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
477
|
+
|
|
478
|
+
/** The variant to use. */
|
|
479
|
+
viewType: PropTypes.oneOf(['text', 'outlined', 'filled', 'link']),
|
|
485
480
|
|
|
486
481
|
/**
|
|
487
|
-
* ref methods
|
|
482
|
+
* ref methods (ref.current.instance.*method*)
|
|
488
483
|
*
|
|
489
484
|
* * option(): Gets all UI component properties
|
|
490
485
|
* * Returns value - object
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** @jsxRuntime classic */
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { jsx } from '@emotion/core';
|
|
7
|
+
import OptionWrapper from '../others/option-wrapper';
|
|
8
|
+
const CardBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
id,
|
|
12
|
+
style,
|
|
13
|
+
title
|
|
14
|
+
}, reference) => {
|
|
15
|
+
const ref = useRef(null);
|
|
16
|
+
useImperativeHandle(reference, () => ({
|
|
17
|
+
element: ref.current,
|
|
18
|
+
instance: {}
|
|
19
|
+
}));
|
|
20
|
+
return useMemo(() => {
|
|
21
|
+
return jsx("div", {
|
|
22
|
+
id: id,
|
|
23
|
+
ref: ref,
|
|
24
|
+
style: style,
|
|
25
|
+
className: [`DGN-UI-Card-Body`, className].join(' ').trim().replace(/\s+/g, ' ')
|
|
26
|
+
}, children);
|
|
27
|
+
}, [children, className, id, style, title]);
|
|
28
|
+
}));
|
|
29
|
+
CardBody.defaultProps = {
|
|
30
|
+
className: '',
|
|
31
|
+
style: {}
|
|
32
|
+
};
|
|
33
|
+
CardBody.propTypes = {
|
|
34
|
+
/** The content of the component. */
|
|
35
|
+
children: PropTypes.node,
|
|
36
|
+
|
|
37
|
+
/** Class for component. ({container: '', header: '', body: '', footer: ''}) */
|
|
38
|
+
className: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
39
|
+
|
|
40
|
+
/** If `true`, will have divider between body and footer. */
|
|
41
|
+
style: PropTypes.object,
|
|
42
|
+
|
|
43
|
+
/** The title of the component's header. */
|
|
44
|
+
title: PropTypes.string
|
|
45
|
+
};
|
|
46
|
+
export { CardBody };
|
|
47
|
+
export default OptionWrapper(CardBody);
|