diginet-core-ui 1.3.93-beta.1 → 1.3.93-beta.3
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 +19 -19
- package/components/breadcrumb/index.js +7 -14
- package/components/button/icon.js +135 -155
- package/components/button/index.js +42 -50
- package/components/button/more.js +25 -30
- package/components/button/ripple-effect.js +5 -13
- package/components/form-control/number-input/index2.js +18 -18
- package/components/form-control/radio/index.js +5 -5
- package/components/form-control/toggle/index.js +4 -4
- package/components/popover/body.js +10 -18
- package/components/popover/footer.js +7 -14
- package/components/popover/header.js +7 -15
- package/components/popover/index.js +1 -1
- package/components/popup/v2/index.js +13 -13
- package/components/rating/index.js +8 -8
- package/components/tab/tab-container.js +2 -2
- package/components/tab/tab-header.js +2 -2
- package/components/tab/tab-panel.js +2 -2
- package/components/tab/tab.js +2 -2
- package/components/transfer/index.js +3 -3
- package/components/tree-view/index.js +34 -34
- package/package.json +1 -1
- package/styles/general.js +9 -1
- package/styles/utils.js +1 -1
|
@@ -319,14 +319,14 @@ Avatar.propTypes = {
|
|
|
319
319
|
className: PropTypes.string,
|
|
320
320
|
/** If `true`, display remove avatar icon. */
|
|
321
321
|
clearAble: PropTypes.bool,
|
|
322
|
-
/**
|
|
323
|
-
* data to display when hoverAble is true<br />
|
|
324
|
-
* data is an object or function return a jsx element
|
|
322
|
+
/**
|
|
323
|
+
* data to display when hoverAble is true<br />
|
|
324
|
+
* data is an object or function return a jsx element
|
|
325
325
|
*/
|
|
326
326
|
data: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.node]),
|
|
327
|
-
/**
|
|
328
|
-
* it is used to display the default if there is no src<br />
|
|
329
|
-
* if undefined, will display icons available in the icons store
|
|
327
|
+
/**
|
|
328
|
+
* it is used to display the default if there is no src<br />
|
|
329
|
+
* if undefined, will display icons available in the icons store
|
|
330
330
|
*/
|
|
331
331
|
defaultSrc: PropTypes.string,
|
|
332
332
|
/** the direction to display more info */
|
|
@@ -363,19 +363,19 @@ Avatar.propTypes = {
|
|
|
363
363
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
364
364
|
/** the error to show on wrong type */
|
|
365
365
|
wrongTypeError: PropTypes.string,
|
|
366
|
-
/**
|
|
367
|
-
* ref methods
|
|
368
|
-
*
|
|
369
|
-
* * option(): Gets all UI component properties
|
|
370
|
-
* * Returns value - object
|
|
371
|
-
* * option(optionName): Gets the value of a single property
|
|
372
|
-
* * @param {optionName} - string
|
|
373
|
-
* * Returns value - any
|
|
374
|
-
* * option(optionName, optionValue): Updates the value of a single property
|
|
375
|
-
* * @param {optionName} - string
|
|
376
|
-
* * @param {optionValue} - any
|
|
377
|
-
* * option(options): Updates the values of several properties
|
|
378
|
-
* * @param {options} - object
|
|
366
|
+
/**
|
|
367
|
+
* ref methods
|
|
368
|
+
*
|
|
369
|
+
* * option(): Gets all UI component properties
|
|
370
|
+
* * Returns value - object
|
|
371
|
+
* * option(optionName): Gets the value of a single property
|
|
372
|
+
* * @param {optionName} - string
|
|
373
|
+
* * Returns value - any
|
|
374
|
+
* * option(optionName, optionValue): Updates the value of a single property
|
|
375
|
+
* * @param {optionName} - string
|
|
376
|
+
* * @param {optionValue} - any
|
|
377
|
+
* * option(options): Updates the values of several properties
|
|
378
|
+
* * @param {options} - object
|
|
379
379
|
*/
|
|
380
380
|
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
381
381
|
current: PropTypes.instanceOf(Element)
|
|
@@ -7,7 +7,7 @@ import { Icon } from "../../icons/effect";
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import React, { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
9
9
|
import { hexToRGBA } from "../../styles/color-helper";
|
|
10
|
-
import { bgColor, borderRadius, cursorPointer, displayFlex, flexWrap, gap, itemsCenter, mg, pd, pdl, pdr, textColor, userSelectNone } from "../../styles/general";
|
|
10
|
+
import { alphaPseudo, bgColor, borderRadius, cursorPointer, displayFlex, flexWrap, gap, itemsCenter, listNone, mg, pd, pdl, pdr, textColor, userSelectNone } from "../../styles/general";
|
|
11
11
|
import { useTypography as typography } from "../../theme";
|
|
12
12
|
import { classNames } from "../../utils";
|
|
13
13
|
const sizeIconMap = new Map([['tiny', 16], ['small', 18], ['medium', 20]]);
|
|
@@ -28,7 +28,7 @@ const Breadcrumb = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
28
28
|
style
|
|
29
29
|
}, reference) => {
|
|
30
30
|
if (!reference) reference = useRef(null);
|
|
31
|
-
if (color === 'default') color = 'system
|
|
31
|
+
if (color === 'default') color = 'system/rest';
|
|
32
32
|
const ref = useRef(null);
|
|
33
33
|
const sizeIcon = sizeIconMap.get(size);
|
|
34
34
|
const sizeTypographyP = sizeTypographyPMap.get(size);
|
|
@@ -136,25 +136,17 @@ const Breadcrumb = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
136
136
|
]);
|
|
137
137
|
}));
|
|
138
138
|
|
|
139
|
-
const alphaArr = {
|
|
140
|
-
hover: 0.1,
|
|
141
|
-
focus: 0.2,
|
|
142
|
-
active: 0.3
|
|
143
|
-
};
|
|
144
139
|
const BreadcrumbOlCSS = color => css`
|
|
145
140
|
${displayFlex};
|
|
146
141
|
${flexWrap};
|
|
147
142
|
${itemsCenter};
|
|
148
143
|
${pd(0)};
|
|
149
144
|
${mg(0)};
|
|
150
|
-
|
|
145
|
+
${listNone};
|
|
151
146
|
${textColor(color)};
|
|
152
147
|
`;
|
|
153
148
|
const BreadcrumbLiCSS = (color, sizeTypographyP, sizeTypographyH) => css`
|
|
154
149
|
${typography[sizeTypographyP]};
|
|
155
|
-
&:last-child {
|
|
156
|
-
${typography[sizeTypographyH]};
|
|
157
|
-
}
|
|
158
150
|
${displayFlex};
|
|
159
151
|
${itemsCenter};
|
|
160
152
|
${gap('4px')};
|
|
@@ -164,10 +156,11 @@ const BreadcrumbLiCSS = (color, sizeTypographyP, sizeTypographyH) => css`
|
|
|
164
156
|
${userSelectNone};
|
|
165
157
|
&:last-child {
|
|
166
158
|
${pdr([1])};
|
|
159
|
+
${typography[sizeTypographyH]};
|
|
167
160
|
}
|
|
168
|
-
${Object.keys(
|
|
161
|
+
${Object.keys(alphaPseudo).map(key => css`
|
|
169
162
|
&: ${key} {
|
|
170
|
-
${bgColor(hexToRGBA(color,
|
|
163
|
+
${bgColor(hexToRGBA(color, alphaPseudo[key]))};
|
|
171
164
|
}
|
|
172
165
|
`)}
|
|
173
166
|
`;
|
|
@@ -189,7 +182,7 @@ Breadcrumb.propTypes = {
|
|
|
189
182
|
/** The color of the component. */
|
|
190
183
|
color: PropTypes.string,
|
|
191
184
|
/** Class for component. */
|
|
192
|
-
data: PropTypes.
|
|
185
|
+
data: PropTypes.arrayOf(PropTypes.shape({
|
|
193
186
|
label: PropTypes.string,
|
|
194
187
|
href: PropTypes.string,
|
|
195
188
|
onClick: PropTypes.func
|
|
@@ -1,37 +1,17 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { jsx, css } from '@emotion/core';
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { CircularProgress, Icon } from "./..";
|
|
6
5
|
import OptionWrapper from "../others/option-wrapper";
|
|
7
|
-
import
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
8
8
|
import { hexToRGBA } from "../../styles/color-helper";
|
|
9
|
+
import * as allColors from "../../styles/colors";
|
|
10
|
+
import { alphaPseudo, bgColor, border, borderColor, borderNone, borderRadius, boxBorder, cursorNotAllowed, cursorPointer, displayFlex, displayInlineFlex, flexRow, itemsCenter, justifyCenter, outlineNone, parseMinWidthHeight, parseWidthHeight, pd, pointerEventsNone, positionRelative, textColor, userSelectNone } from "../../styles/general";
|
|
11
|
+
import { getColor } from "../../styles/utils";
|
|
9
12
|
import { capitalize, classNames, refType as ref } from "../../utils";
|
|
10
|
-
import
|
|
13
|
+
import { getRippleColor } from '.';
|
|
11
14
|
import Ripple from "./ripple-effect";
|
|
12
|
-
import { getClassNameFromColor, getRippleColor } from '.';
|
|
13
|
-
import CircularProgress from "../progress/circular";
|
|
14
|
-
import { itemsCenter, bgTransparent, border, boxBorder, borderNone, borderRadius4px, borderRadius50, cursorPointer, flexRow, displayInlineFlex, justifyCenter, outlineNone, parseMinWidthHeight, parseWidthHeight, pointerEventsNone, positionRelative, userSelectNone } from "../../styles/general";
|
|
15
|
-
import { useColor as colors, useTheme } from "../../theme";
|
|
16
|
-
const {
|
|
17
|
-
colors: {
|
|
18
|
-
system: {
|
|
19
|
-
active,
|
|
20
|
-
disabled: systemDisabled,
|
|
21
|
-
rest: systemRest,
|
|
22
|
-
white: systemWhite
|
|
23
|
-
},
|
|
24
|
-
semantic: {
|
|
25
|
-
success: semanticSuccess,
|
|
26
|
-
warning: semanticWarning,
|
|
27
|
-
danger: semanticDanger,
|
|
28
|
-
info: semanticInfo
|
|
29
|
-
},
|
|
30
|
-
fill: {
|
|
31
|
-
disabled: fillDisabled
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
} = useTheme();
|
|
35
15
|
const sizeMap = new Map([['tiny', {
|
|
36
16
|
buttonSize: '24px',
|
|
37
17
|
iconSize: '16px'
|
|
@@ -51,12 +31,7 @@ const sizeMap = new Map([['tiny', {
|
|
|
51
31
|
buttonSize: '96px',
|
|
52
32
|
iconSize: '56px'
|
|
53
33
|
}]]);
|
|
54
|
-
const iconColorMap = new Map([['Close',
|
|
55
|
-
const alphaArr = {
|
|
56
|
-
hover: 0.1,
|
|
57
|
-
focus: 0.2,
|
|
58
|
-
active: 0.3
|
|
59
|
-
};
|
|
34
|
+
const iconColorMap = new Map([['Close', 'semantic.danger'], ['Cancel', 'semantic.danger'], ['Approval', 'semantic.success'], ['Delete', 'semantic.warning'], ['Trash', 'semantic.warning'], ['Edit', 'semantic.info'], ['EditV2', 'semantic.info'], ['View', 'semantic.info']]);
|
|
60
35
|
const alphaLoading = 0.2;
|
|
61
36
|
// customIconSize calculated based on design size
|
|
62
37
|
// Button size <= 24 => icon size = Button size - 8
|
|
@@ -94,14 +69,20 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
94
69
|
var _sizeMap$get, _sizeMap$get2;
|
|
95
70
|
const ref = useRef(null);
|
|
96
71
|
const rippleRef = useRef(null);
|
|
72
|
+
const isColorDefault = colorProp === 'default';
|
|
73
|
+
const isViewTypeGhost = viewType === 'ghost';
|
|
97
74
|
const buttonSize = ((_sizeMap$get = sizeMap.get(size)) === null || _sizeMap$get === void 0 ? void 0 : _sizeMap$get.buttonSize) || '40px';
|
|
98
75
|
const iconSize = width ? isNaN(width) ? '60%' : customIconSize(parseInt(width)) + 'px' : ((_sizeMap$get2 = sizeMap.get(size)) === null || _sizeMap$get2 === void 0 ? void 0 : _sizeMap$get2.iconSize) || '24px';
|
|
99
|
-
const
|
|
100
|
-
const color = colors[colorProp] || colorProp;
|
|
101
|
-
colorHover = colors[colorHover] || colorHover;
|
|
102
|
-
const _ButtonRootCSS = ButtonRootCSS(circular, colorHover, color, name);
|
|
76
|
+
const _ButtonRootCSS = ButtonRootCSS(circular, colorHover, colorProp, name, isColorDefault, viewType, loading);
|
|
103
77
|
const _ButtonSizeCSS = ButtonSizeCSS(width, height, buttonSize, iconSize);
|
|
104
78
|
const _ButtonIconCSS = ButtonIconCSS(iconSize);
|
|
79
|
+
const _onClick = event => {
|
|
80
|
+
event.persist();
|
|
81
|
+
onClick && event.stopPropagation();
|
|
82
|
+
if (disabled || loading) return;
|
|
83
|
+
if (!isViewTypeGhost) rippleRef.current.start(event);
|
|
84
|
+
onClick && onClick(event);
|
|
85
|
+
};
|
|
105
86
|
useImperativeHandle(reference, () => {
|
|
106
87
|
const currentRef = ref.current || {};
|
|
107
88
|
currentRef.element = ref.current;
|
|
@@ -112,22 +93,15 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
112
93
|
currentRef.instance = _instance;
|
|
113
94
|
return currentRef;
|
|
114
95
|
});
|
|
115
|
-
const _onClick = event => {
|
|
116
|
-
event.persist();
|
|
117
|
-
onClick && event.stopPropagation();
|
|
118
|
-
if (disabled || loading) return;
|
|
119
|
-
if (!isViewTypeGhost) rippleRef.current.start(event);
|
|
120
|
-
onClick && onClick(event);
|
|
121
|
-
};
|
|
122
96
|
return useMemo(() => {
|
|
123
97
|
return jsx("button", {
|
|
124
|
-
css: [_ButtonRootCSS, _ButtonSizeCSS
|
|
98
|
+
css: [_ButtonRootCSS, _ButtonSizeCSS],
|
|
125
99
|
ref: ref,
|
|
126
100
|
id: id,
|
|
127
101
|
disabled: disabled,
|
|
128
102
|
style: style,
|
|
129
103
|
onClick: _onClick,
|
|
130
|
-
className: classNames('DGN-UI-ButtonIcon', viewType,
|
|
104
|
+
className: classNames('DGN-UI-ButtonIcon', viewType, size, className)
|
|
131
105
|
}, loading && IconLoadingView(iconSize), !loading && jsx("span", {
|
|
132
106
|
className: 'DGN-UI-ButtonIcon-Icon',
|
|
133
107
|
css: _ButtonIconCSS
|
|
@@ -142,9 +116,10 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
142
116
|
color: getRippleColor(colorProp, viewType, allColors),
|
|
143
117
|
circular: circular
|
|
144
118
|
}));
|
|
145
|
-
}, [children, circular, className,
|
|
119
|
+
}, [children, circular, className, colorHover, colorProp, disabled, height, id, loading, name, onClick, size, style, viewBox, viewType, width]);
|
|
146
120
|
}));
|
|
147
121
|
const ButtonIconCSS = iconSize => css`
|
|
122
|
+
${displayFlex};
|
|
148
123
|
${flexRow};
|
|
149
124
|
${positionRelative};
|
|
150
125
|
${boxBorder};
|
|
@@ -153,21 +128,6 @@ const ButtonIconCSS = iconSize => css`
|
|
|
153
128
|
${parseWidthHeight(iconSize)};
|
|
154
129
|
${parseMinWidthHeight(iconSize)};
|
|
155
130
|
`;
|
|
156
|
-
const ButtonDisabledCSS = `
|
|
157
|
-
cursor: not-allowed !important;
|
|
158
|
-
color: ${systemDisabled} !important;
|
|
159
|
-
&.outlined {
|
|
160
|
-
border-color: ${systemDisabled} !important;
|
|
161
|
-
background-color: transparent !important;
|
|
162
|
-
}
|
|
163
|
-
&.filled {
|
|
164
|
-
background-color: ${fillDisabled} !important;
|
|
165
|
-
filter: brightness(1) !important;
|
|
166
|
-
}
|
|
167
|
-
&.text {
|
|
168
|
-
background-color: transparent !important;
|
|
169
|
-
}
|
|
170
|
-
`;
|
|
171
131
|
const ButtonSizeCSS = (width, height, buttonSize, iconSize) => css`
|
|
172
132
|
${parseWidthHeight(width || buttonSize, height || buttonSize)};
|
|
173
133
|
${parseMinWidthHeight(width || buttonSize, height || buttonSize)};
|
|
@@ -176,7 +136,7 @@ const ButtonSizeCSS = (width, height, buttonSize, iconSize) => css`
|
|
|
176
136
|
${parseMinWidthHeight(width || iconSize, height || iconSize)};
|
|
177
137
|
}
|
|
178
138
|
`;
|
|
179
|
-
const ButtonRootCSS = (circular, colorHover, color, name) => css`
|
|
139
|
+
const ButtonRootCSS = (circular, colorHover, color, name, isColorDefault, viewType, loading) => css`
|
|
180
140
|
${displayInlineFlex};
|
|
181
141
|
${positionRelative};
|
|
182
142
|
${justifyCenter};
|
|
@@ -185,46 +145,55 @@ const ButtonRootCSS = (circular, colorHover, color, name) => css`
|
|
|
185
145
|
${boxBorder};
|
|
186
146
|
${cursorPointer};
|
|
187
147
|
${userSelectNone};
|
|
188
|
-
${circular ?
|
|
189
|
-
|
|
148
|
+
${borderRadius(circular ? '50%' : 4)};
|
|
149
|
+
${pd(0)};
|
|
190
150
|
transition: background-color 0.5s, filter 0.5s;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
${
|
|
196
|
-
${
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
${border(1,
|
|
206
|
-
|
|
207
|
-
|
|
151
|
+
${loading && pointerEventsNone};
|
|
152
|
+
${viewType === 'outlined' && css`
|
|
153
|
+
${bgColor('transparent')};
|
|
154
|
+
${border(1, color)};
|
|
155
|
+
${textColor(color)};
|
|
156
|
+
${loading && css`
|
|
157
|
+
${bgColor(hexToRGBA(color, alphaLoading))};
|
|
158
|
+
`}
|
|
159
|
+
${Object.keys(alphaPseudo).map(key => css`
|
|
160
|
+
&: ${key} {
|
|
161
|
+
${bgColor(hexToRGBA(color, alphaPseudo[key]))};
|
|
162
|
+
}
|
|
163
|
+
`)}
|
|
164
|
+
${isColorDefault && css`
|
|
165
|
+
${border(1, 'system/rest')};
|
|
166
|
+
${textColor('system/rest')};
|
|
167
|
+
${loading && css`
|
|
168
|
+
${textColor(colorHover)};
|
|
169
|
+
${borderColor(colorHover)};
|
|
170
|
+
${bgColor(hexToRGBA(colorHover, alphaLoading))};
|
|
171
|
+
`}
|
|
208
172
|
&:hover,
|
|
209
173
|
&:focus,
|
|
210
174
|
&:active {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
&.button-icon--loading {
|
|
215
|
-
background-color: ${hexToRGBA(colorHover, alphaLoading)};
|
|
175
|
+
${textColor(colorHover)};
|
|
176
|
+
${borderColor(colorHover)};
|
|
216
177
|
}
|
|
217
|
-
${Object.keys(
|
|
218
|
-
|
|
219
|
-
|
|
178
|
+
${Object.keys(alphaPseudo).map(key => css`
|
|
179
|
+
&: ${key} {
|
|
180
|
+
${bgColor(hexToRGBA(colorHover, alphaPseudo[key]))};
|
|
181
|
+
}
|
|
182
|
+
`)}// &:hover | &:focus | &:active
|
|
183
|
+
`}
|
|
184
|
+
:disabled {
|
|
185
|
+
${borderColor('system/disabled')};
|
|
186
|
+
${bgColor('transparent')};
|
|
220
187
|
}
|
|
221
|
-
}
|
|
222
|
-
|
|
188
|
+
`}
|
|
189
|
+
${viewType === 'filled' && css`
|
|
223
190
|
${borderNone};
|
|
224
|
-
|
|
225
|
-
|
|
191
|
+
${textColor(color === getColor('system.white') ? 'system.rest' : 'system.white')};
|
|
192
|
+
${bgColor(color)};
|
|
226
193
|
font-weight: bold;
|
|
227
|
-
|
|
194
|
+
${loading && css`
|
|
195
|
+
filter: brightness(0.85);
|
|
196
|
+
`}
|
|
228
197
|
&:hover,
|
|
229
198
|
&:focus {
|
|
230
199
|
filter: brightness(0.85);
|
|
@@ -232,47 +201,54 @@ const ButtonRootCSS = (circular, colorHover, color, name) => css`
|
|
|
232
201
|
&:active {
|
|
233
202
|
filter: brightness(0.7);
|
|
234
203
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
204
|
+
${isColorDefault && css`
|
|
205
|
+
${bgColor('system/rest')};
|
|
206
|
+
${loading && bgColor('system/active')};
|
|
238
207
|
&:hover,
|
|
239
208
|
&:focus,
|
|
240
209
|
&:active {
|
|
241
|
-
|
|
210
|
+
${bgColor(colorHover)};
|
|
242
211
|
}
|
|
212
|
+
`}
|
|
213
|
+
:disabled {
|
|
214
|
+
${bgColor('fill/disabled')};
|
|
215
|
+
filter: brightness(1);
|
|
243
216
|
}
|
|
244
|
-
}
|
|
245
|
-
|
|
217
|
+
`}
|
|
218
|
+
${viewType === 'text' && css`
|
|
246
219
|
${borderNone};
|
|
247
|
-
${
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
220
|
+
${textColor(color)};
|
|
221
|
+
${bgColor('transparent')};
|
|
222
|
+
${loading && bgColor(hexToRGBA(color, alphaLoading))};
|
|
223
|
+
${Object.keys(alphaPseudo).map(key => css`
|
|
224
|
+
&: ${key} {
|
|
225
|
+
${bgColor(hexToRGBA(color, alphaPseudo[key]))};
|
|
226
|
+
}
|
|
227
|
+
`)}
|
|
228
|
+
${isColorDefault && css`
|
|
229
|
+
${textColor('system/rest')};
|
|
230
|
+
${loading && css`
|
|
231
|
+
${textColor('system/active')};
|
|
232
|
+
${bgColor(hexToRGBA(colorHover, alphaLoading))};
|
|
233
|
+
`}
|
|
234
|
+
${Object.keys(alphaPseudo).map(key => css`
|
|
235
|
+
&: ${key} {
|
|
236
|
+
${textColor(colorHover)};
|
|
237
|
+
${bgColor(hexToRGBA(colorHover, alphaPseudo[key]))};
|
|
238
|
+
}
|
|
239
|
+
`)}
|
|
240
|
+
`}
|
|
241
|
+
:disabled {
|
|
242
|
+
${bgColor('transparent')};
|
|
251
243
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}`)}
|
|
255
|
-
&.default {
|
|
256
|
-
color: ${systemRest};
|
|
257
|
-
&:hover,
|
|
258
|
-
&:focus,
|
|
259
|
-
&:active {
|
|
260
|
-
color: ${colorHover};
|
|
261
|
-
}
|
|
262
|
-
&.button-icon--loading {
|
|
263
|
-
color: ${active};
|
|
264
|
-
background-color: ${hexToRGBA(colorHover, alphaLoading)};
|
|
265
|
-
}
|
|
266
|
-
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
267
|
-
background-color: ${hexToRGBA(colorHover, alphaArr[key])};
|
|
268
|
-
}`)}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
&.ghost {
|
|
272
|
-
${bgTransparent};
|
|
244
|
+
`}
|
|
245
|
+
${viewType === 'ghost' && css`
|
|
273
246
|
${borderNone};
|
|
274
|
-
|
|
275
|
-
|
|
247
|
+
${bgColor('transparent')};
|
|
248
|
+
${textColor(color)};
|
|
249
|
+
${loading && css`
|
|
250
|
+
filter: brightness(0.85);
|
|
251
|
+
`}
|
|
276
252
|
&:hover,
|
|
277
253
|
&:focus {
|
|
278
254
|
filter: brightness(0.85);
|
|
@@ -280,21 +256,25 @@ const ButtonRootCSS = (circular, colorHover, color, name) => css`
|
|
|
280
256
|
&:active {
|
|
281
257
|
filter: brightness(0.7);
|
|
282
258
|
}
|
|
283
|
-
|
|
284
|
-
|
|
259
|
+
${isColorDefault && css`
|
|
260
|
+
${textColor('system/rest')};
|
|
285
261
|
&:hover,
|
|
286
262
|
&:focus,
|
|
287
263
|
&:active {
|
|
288
|
-
|
|
264
|
+
${textColor(iconColorMap.get(capitalize(name)) || colorHover)};
|
|
289
265
|
}
|
|
290
|
-
}
|
|
266
|
+
`}
|
|
267
|
+
`}
|
|
268
|
+
:disabled {
|
|
269
|
+
${cursorNotAllowed};
|
|
270
|
+
${textColor('system/disabled')};
|
|
291
271
|
}
|
|
292
272
|
`;
|
|
293
273
|
ButtonIcon.defaultProps = {
|
|
294
274
|
circular: false,
|
|
295
275
|
className: '',
|
|
296
276
|
color: 'default',
|
|
297
|
-
colorHover: active,
|
|
277
|
+
colorHover: 'system/active',
|
|
298
278
|
disabled: false,
|
|
299
279
|
size: 'medium',
|
|
300
280
|
viewBox: true,
|
|
@@ -321,14 +301,14 @@ ButtonIcon.propTypes = {
|
|
|
321
301
|
onClick: PropTypes.func,
|
|
322
302
|
/** Name of [icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic). */
|
|
323
303
|
name: PropTypes.string,
|
|
324
|
-
/**
|
|
325
|
-
* The size of the component.
|
|
326
|
-
*
|
|
327
|
-
* * tiny (button 24px, icon 16px)
|
|
328
|
-
* * small (button 32px, icon 20px)
|
|
329
|
-
* * medium (button 40px, icon 24px)
|
|
330
|
-
* * large (button 48px, icon 32px)
|
|
331
|
-
* * giant (button 56px, icon 40px)
|
|
304
|
+
/**
|
|
305
|
+
* The size of the component.
|
|
306
|
+
*
|
|
307
|
+
* * tiny (button 24px, icon 16px)
|
|
308
|
+
* * small (button 32px, icon 20px)
|
|
309
|
+
* * medium (button 40px, icon 24px)
|
|
310
|
+
* * large (button 48px, icon 32px)
|
|
311
|
+
* * giant (button 56px, icon 40px)
|
|
332
312
|
* */
|
|
333
313
|
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant', 'extraGiant']),
|
|
334
314
|
/** Style inline of component. */
|
|
@@ -339,19 +319,19 @@ ButtonIcon.propTypes = {
|
|
|
339
319
|
viewType: PropTypes.oneOf(['text', 'outlined', 'filled', 'ghost']),
|
|
340
320
|
/** Width of the component. */
|
|
341
321
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
342
|
-
/**
|
|
343
|
-
* ref methods (ref.current.instance.*method*)
|
|
344
|
-
*
|
|
345
|
-
* * option(): Gets all UI component properties
|
|
346
|
-
* * Returns value - object
|
|
347
|
-
* * option(optionName): Gets the value of a single property
|
|
348
|
-
* * @param {optionName} - string
|
|
349
|
-
* * Returns value - any
|
|
350
|
-
* * option(optionName, optionValue): Updates the value of a single property
|
|
351
|
-
* * @param {optionName} - string
|
|
352
|
-
* * @param {optionValue} - any
|
|
353
|
-
* * option(options): Updates the values of several properties
|
|
354
|
-
* * @param {options} - object
|
|
322
|
+
/**
|
|
323
|
+
* ref methods (ref.current.instance.*method*)
|
|
324
|
+
*
|
|
325
|
+
* * option(): Gets all UI component properties
|
|
326
|
+
* * Returns value - object
|
|
327
|
+
* * option(optionName): Gets the value of a single property
|
|
328
|
+
* * @param {optionName} - string
|
|
329
|
+
* * Returns value - any
|
|
330
|
+
* * option(optionName, optionValue): Updates the value of a single property
|
|
331
|
+
* * @param {optionName} - string
|
|
332
|
+
* * @param {optionValue} - any
|
|
333
|
+
* * option(options): Updates the values of several properties
|
|
334
|
+
* * @param {options} - object
|
|
355
335
|
*/
|
|
356
336
|
reference: ref
|
|
357
337
|
};
|