diginet-core-ui 1.3.24 → 1.3.29
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/fonts/SF-Pro-Display-Bold.otf +0 -0
- package/assets/fonts/SF-Pro-Display-Medium.otf +0 -0
- package/assets/fonts/SF-Pro-Display-Regular.otf +0 -0
- package/assets/images/icons/wifi.svg +3 -0
- package/assets/images/menu/dhr/MHRM09N0004.svg +14 -0
- package/assets/images/menu/dhr/MHRP09N0028.svg +6 -0
- package/assets/images/menu/dhr/MHRP09N0029.svg +14 -0
- package/assets/images/menu/dhr/MHRP09N0030.svg +4 -0
- package/assets/images/menu/dhr/MHRP09N0031.svg +5 -0
- package/assets/images/menu/dhr/MHRP29N0012.svg +7 -0
- package/assets/images/menu/dhr/MHRP29N0021.svg +8 -0
- package/assets/images/menu/dhr/MHRP29N0022.svg +9 -0
- package/assets/images/menu/dhr/MHRP29N0023.svg +22 -0
- package/assets/images/menu/dhr/MHRP39N0015.svg +5 -0
- package/assets/images/menu/dhr/TASK.svg +9 -0
- package/assets/images/menu/erp/D05.svg +8 -0
- package/assets/images/menu/erp/D06.svg +4 -0
- package/assets/images/menu/erp/D90R.svg +9 -0
- package/assets/images/menu/erp/DBC.svg +9 -0
- package/assets/images/menu/erp/{W05F0006.svg → W05F0006N0000.svg} +0 -0
- package/assets/images/menu/erp/{W05F0008.svg → W05F0008N0000.svg} +0 -0
- package/assets/images/menu/erp/{W05F4000.svg → W05F4000N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0005.svg → W06F0005N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0006.svg → W06F0006N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0008.svg → W06F0008N0000.svg} +0 -0
- package/assets/images/menu/erp/W94F1000N0000.svg +9 -0
- package/assets/images/menu/erp/W94F1000N0001.svg +9 -0
- package/components/accordion/css.js +42 -33
- package/components/accordion/details.js +29 -17
- package/components/accordion/group.js +23 -23
- package/components/accordion/index.js +36 -27
- package/components/accordion/summary.js +10 -11
- package/components/alert/index.js +97 -91
- package/components/alert/notify.js +10 -8
- package/components/avatar/index.js +19 -17
- package/components/badge/index.js +122 -139
- package/components/button/icon.js +242 -334
- package/components/button/index.js +272 -427
- package/components/button/more.js +4 -5
- package/components/button/ripple-effect.js +4 -6
- package/components/card/body-card.js +4 -6
- package/components/card/card.js +4 -8
- package/components/card/index.js +4 -5
- package/components/chart/Pie/Sector.js +4 -5
- package/components/chart/Pie/Sectors.js +5 -5
- package/components/chart/Pie/index.js +8 -9
- package/components/chart/Pie-v2/Sector.js +4 -5
- package/components/chart/Pie-v2/Sectors.js +7 -8
- package/components/chart/Pie-v2/index.js +11 -16
- package/components/chart/bar/Bar.js +2 -3
- package/components/chart/bar/Labels.js +9 -11
- package/components/chart/bar/index.js +17 -9
- package/components/chart/bar-v2/Bar.js +2 -3
- package/components/chart/bar-v2/Labels.js +9 -11
- package/components/chart/bar-v2/index.js +17 -9
- package/components/chart/line/Labels.js +8 -10
- package/components/chart/line/Point.js +2 -3
- package/components/chart/line/index.js +17 -9
- package/components/chart/line-v2/Labels.js +8 -10
- package/components/chart/line-v2/Point.js +2 -3
- package/components/chart/line-v2/index.js +17 -9
- package/components/chip/attach.js +12 -16
- package/components/chip/index.js +8 -11
- package/components/collapse/index.js +4 -5
- package/components/divider/index.js +27 -14
- package/components/form-control/attachment/index.js +143 -87
- package/components/form-control/calendar/function.js +24 -23
- package/components/form-control/calendar/index.js +2 -4
- package/components/form-control/calendar/range.js +3 -4
- package/components/form-control/checkbox/index.js +85 -71
- package/components/form-control/control/index.js +4 -6
- package/components/form-control/date-picker/index-old.js +0 -2
- package/components/form-control/date-picker/index.js +39 -43
- package/components/form-control/date-range-picker/index.js +26 -28
- package/components/form-control/dropdown/index.js +173 -202
- package/components/form-control/dropdown-box/index.js +72 -49
- package/components/form-control/form-group/index.js +4 -5
- package/components/form-control/helper-text/index.js +4 -5
- package/components/form-control/input-base/index.js +28 -38
- package/components/form-control/label/index.js +23 -13
- package/components/form-control/money-input/index.js +6 -6
- package/components/form-control/number-input/index.js +12 -14
- package/components/form-control/phone-input/index.js +4 -5
- package/components/form-control/radio/index.js +7 -15
- package/components/form-control/text-input/index.js +14 -24
- package/components/form-control/time-picker/index.js +15 -26
- package/components/form-control/time-picker/swiper.js +2 -4
- package/components/form-control/toggle/index.js +22 -18
- package/components/form-view/helper-text.js +4 -5
- package/components/form-view/index.js +4 -5
- package/components/form-view/input.js +5 -7
- package/components/form-view/label.js +2 -6
- package/components/list/list-item-action.js +7 -8
- package/components/list/list-item-icon.js +4 -5
- package/components/list/list-item-text.js +4 -5
- package/components/list/list-item.js +4 -5
- package/components/list/list.js +4 -5
- package/components/list/sub-header.js +4 -5
- package/components/modal/body.js +4 -6
- package/components/modal/footer.js +4 -6
- package/components/modal/header.js +8 -14
- package/components/modal/index.js +4 -5
- package/components/modal/modal.js +6 -13
- package/components/others/extra/index.js +4 -8
- package/components/others/option-wrapper/index.js +57 -0
- package/components/others/scrollbar/index.js +4 -5
- package/components/paging/page-info.js +282 -231
- package/components/paging/page-selector.js +4 -7
- package/components/popover/index.js +6 -7
- package/components/popup/danger_popup.js +8 -18
- package/components/popup/index.js +26 -34
- package/components/popup/proposals_popup.js +9 -16
- package/components/popup/v2/danger-popup.js +4 -6
- package/components/popup/v2/index.js +116 -98
- package/components/popup/v2/info-popup.js +4 -6
- package/components/popup/v2/success-popup.js +4 -6
- package/components/popup/v2/warning-popup.js +4 -6
- package/components/popup/v2/yes-no-popup.js +4 -6
- package/components/progress/circular.js +17 -26
- package/components/progress/linear.js +11 -13
- package/components/rating/index.js +114 -233
- package/components/slider/slider-container.js +15 -10
- package/components/slider/slider-item.js +10 -12
- package/components/status/index.js +63 -57
- package/components/tab/tab-container.js +26 -24
- package/components/tab/tab-header.js +36 -27
- package/components/tab/tab-panel.js +32 -15
- package/components/tab/tab.js +79 -80
- package/components/tooltip/index.js +4 -4
- package/components/transfer/index.js +10 -11
- package/components/tree-view/css.js +2 -0
- package/components/tree-view/index.js +14 -13
- package/components/typography/index.js +6 -112
- package/css/styles.css +1 -1
- package/css/styles.css.map +1 -1
- package/global/index.js +2 -0
- package/icons/basic.js +1648 -959
- package/icons/effect.js +45 -103
- package/package.json +1 -1
- package/readme.md +66 -0
- package/styles/color-helper.js +7 -146
- package/styles/colors.js +6 -2
- package/styles/font.js +9 -0
- package/styles/general.js +100 -7
- package/styles/typography.js +25 -26
- package/theme/settings.js +9 -2
- package/theme/theme-provider.js +15 -7
- package/theme/with-styles.js +2 -4
- package/theme/with-theme.js +2 -4
- package/utils/isMobile.js +21 -0
- package/utils/renderHTML.js +4 -5
- package/utils/renderIcon.js +15 -11
- package/utils/updatePosition.js +2 -2
|
@@ -1,19 +1,66 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
6
|
-
import { memo, useRef,
|
|
4
|
+
import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
|
|
7
5
|
import PropTypes from 'prop-types';
|
|
8
6
|
import { jsx, css } from '@emotion/core';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
7
|
+
import OptionWrapper from '../others/option-wrapper';
|
|
8
|
+
import * as allColors from '../../styles/colors';
|
|
9
|
+
import { color as colors } from '../../styles/colors';
|
|
10
|
+
import { hexToRGBA } from '../../styles/color-helper';
|
|
11
11
|
import { capitalize } from '../../utils';
|
|
12
|
-
import
|
|
12
|
+
import Icon from '../../icons';
|
|
13
13
|
import Ripple from './ripple-effect';
|
|
14
|
-
import theme from '../../theme/settings';
|
|
15
14
|
import { getClassNameFromColor, getRippleColor } from '.';
|
|
16
|
-
import CircularProgress from
|
|
15
|
+
import CircularProgress from '../progress/circular';
|
|
16
|
+
import { alignCenter, backgroundTransparent, border, borderBox, borderNone, cursorPointer, flexRow, inlineFlex, justifyCenter, noBorder, outlineNone, overflowHidden, pointerEventsNone, positionRelative, userSelectNone } from '../../styles/general';
|
|
17
|
+
const {
|
|
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
|
+
}
|
|
33
|
+
} = colors;
|
|
34
|
+
const colorMap = new Map([['primary', active], ['success', success], ['warning', warning], ['danger', danger], ['info', info]]);
|
|
35
|
+
const sizeMap = new Map([['tiny', {
|
|
36
|
+
buttonSize: '24px',
|
|
37
|
+
iconSize: '16px'
|
|
38
|
+
}], ['small', {
|
|
39
|
+
buttonSize: '32px',
|
|
40
|
+
iconSize: '20px'
|
|
41
|
+
}], ['medium', {
|
|
42
|
+
buttonSize: '40px',
|
|
43
|
+
iconSize: '24px'
|
|
44
|
+
}], ['large', {
|
|
45
|
+
buttonSize: '48px',
|
|
46
|
+
iconSize: '32px'
|
|
47
|
+
}], ['giant', {
|
|
48
|
+
buttonSize: '56px',
|
|
49
|
+
iconSize: '40px'
|
|
50
|
+
}]]);
|
|
51
|
+
const iconColorMap = new Map([['Close', danger], ['Cancel', danger], ['Approval', success], ['Delete', warning], ['Trash', warning], ['Edit', info], ['EditV2', info], ['View', info]]);
|
|
52
|
+
const alphaArr = {
|
|
53
|
+
hover: 0.1,
|
|
54
|
+
focus: 0.2,
|
|
55
|
+
active: 0.3
|
|
56
|
+
};
|
|
57
|
+
const alphaLoading = 0.2; // customIconSize calculated based on design size
|
|
58
|
+
// Button size <= 24 => icon size = Button size - 8
|
|
59
|
+
// Button size > 24 && <= 32 => icon size = Button size - 12
|
|
60
|
+
// Button size > 32 => icon size = Button size - 16
|
|
61
|
+
|
|
62
|
+
const customIconSize = width => width <= 24 ? width - 8 : width <= 32 ? width - 12 : width - 16;
|
|
63
|
+
|
|
17
64
|
const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
18
65
|
type,
|
|
19
66
|
viewType,
|
|
@@ -32,364 +79,214 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
32
79
|
children,
|
|
33
80
|
refs,
|
|
34
81
|
loading,
|
|
82
|
+
colorHover,
|
|
35
83
|
...props
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
ref = useRef(null);
|
|
39
|
-
}
|
|
84
|
+
}, reference) => {
|
|
85
|
+
var _sizeMap$get, _sizeMap$get2;
|
|
40
86
|
|
|
87
|
+
const ref = useRef(null);
|
|
88
|
+
const buttonSize = ((_sizeMap$get = sizeMap.get(size)) === null || _sizeMap$get === void 0 ? void 0 : _sizeMap$get.buttonSize) || '40px';
|
|
89
|
+
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';
|
|
90
|
+
colorHover = colorMap.get(colorHover) || colorHover;
|
|
41
91
|
const ButtonRoot = css`
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
92
|
+
${inlineFlex}
|
|
93
|
+
${positionRelative}
|
|
94
|
+
${justifyCenter}
|
|
95
|
+
${alignCenter}
|
|
96
|
+
${outlineNone}
|
|
97
|
+
${borderBox}
|
|
98
|
+
${overflowHidden}
|
|
99
|
+
${cursorPointer}
|
|
100
|
+
${userSelectNone}
|
|
101
|
+
padding: 0;
|
|
49
102
|
border-radius: ${circular ? '50%' : '4px'};
|
|
50
103
|
transition: background-color 0.5s, filter 0.5s;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
padding: 3px;
|
|
58
|
-
}
|
|
59
|
-
.DGN-UI-ButtonIcon-Icon {
|
|
60
|
-
height: 16px;
|
|
61
|
-
width: 16px;
|
|
62
|
-
}
|
|
104
|
+
.DGN-UI-ButtonIcon-Icon {
|
|
105
|
+
${flexRow}
|
|
106
|
+
${positionRelative}
|
|
107
|
+
${borderBox}
|
|
108
|
+
${justifyCenter}
|
|
109
|
+
${alignCenter}
|
|
63
110
|
}
|
|
64
|
-
&.
|
|
65
|
-
|
|
111
|
+
&.disabled {
|
|
112
|
+
cursor: not-allowed !important;
|
|
113
|
+
color: ${systemDisabled} !important;
|
|
66
114
|
&.outlined {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
.DGN-UI-ButtonIcon-Icon {
|
|
70
|
-
height: 20px;
|
|
71
|
-
width: 20px;
|
|
115
|
+
border-color: ${systemDisabled} !important;
|
|
116
|
+
background-color: transparent !important;
|
|
72
117
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
&.outlined {
|
|
77
|
-
padding: 7px;
|
|
118
|
+
&.filled {
|
|
119
|
+
background-color: ${fillDisabled} !important;
|
|
120
|
+
filter: brightness(1) !important;
|
|
78
121
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
width: 24px;
|
|
122
|
+
&.text {
|
|
123
|
+
background-color: transparent !important;
|
|
82
124
|
}
|
|
83
125
|
}
|
|
84
|
-
&.
|
|
85
|
-
|
|
86
|
-
&.outlined {
|
|
87
|
-
padding: 7px;
|
|
88
|
-
}
|
|
89
|
-
.DGN-UI-ButtonIcon-Icon {
|
|
90
|
-
height: 32px;
|
|
91
|
-
width: 32px;
|
|
92
|
-
}
|
|
126
|
+
&.loading {
|
|
127
|
+
${pointerEventsNone}
|
|
93
128
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
padding: 7px;
|
|
98
|
-
}
|
|
129
|
+
&.${size} {
|
|
130
|
+
width: ${width ? isNaN(width) ? width : width + 'px' : buttonSize};
|
|
131
|
+
height: ${height ? isNaN(height) ? height : height + 'px' : buttonSize};
|
|
99
132
|
.DGN-UI-ButtonIcon-Icon {
|
|
100
|
-
height:
|
|
101
|
-
width:
|
|
133
|
+
height: ${iconSize};
|
|
134
|
+
width: ${iconSize};
|
|
102
135
|
}
|
|
103
136
|
}
|
|
104
137
|
&.outlined {
|
|
105
|
-
|
|
106
|
-
font-weight : bold;
|
|
138
|
+
${backgroundTransparent}
|
|
107
139
|
&.default {
|
|
108
|
-
border
|
|
109
|
-
color
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
&:focus {
|
|
114
|
-
background-color: ${lighten(theme.colors.default, 0.8)};
|
|
115
|
-
}
|
|
140
|
+
${border(1, rest)}
|
|
141
|
+
color: ${rest};
|
|
142
|
+
&.loading,
|
|
143
|
+
&:hover,
|
|
144
|
+
&:focus,
|
|
116
145
|
&:active {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
&.primary {
|
|
121
|
-
border: 1px solid ${theme.colors.primary};
|
|
122
|
-
color : ${theme.colors.primary};
|
|
123
|
-
&:hover {
|
|
124
|
-
background-color: ${lighten(theme.colors.primary, 0.9)};
|
|
125
|
-
}
|
|
126
|
-
&:focus {
|
|
127
|
-
background-color: ${lighten(theme.colors.primary, 0.8)};
|
|
128
|
-
}
|
|
129
|
-
&:active {
|
|
130
|
-
background-color: ${lighten(theme.colors.primary, 0.7)};
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
&.success {
|
|
134
|
-
border: 1px solid ${theme.colors.success};
|
|
135
|
-
color : ${theme.colors.success};
|
|
136
|
-
&:hover {
|
|
137
|
-
background-color: ${lighten(theme.colors.success, 0.9)};
|
|
138
|
-
}
|
|
139
|
-
&:focus {
|
|
140
|
-
background-color: ${lighten(theme.colors.success, 0.8)};
|
|
141
|
-
}
|
|
142
|
-
&:active {
|
|
143
|
-
background-color: ${lighten(theme.colors.success, 0.7)};
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
&.warning {
|
|
147
|
-
border: 1px solid ${theme.colors.warning};
|
|
148
|
-
color : ${theme.colors.warning};
|
|
149
|
-
&:hover {
|
|
150
|
-
background-color: ${lighten(theme.colors.warning, 0.9)};
|
|
146
|
+
color: ${colorHover};
|
|
147
|
+
border-color: ${colorHover};
|
|
151
148
|
}
|
|
152
|
-
|
|
153
|
-
background-color: ${
|
|
154
|
-
}
|
|
155
|
-
&:active {
|
|
156
|
-
background-color: ${lighten(theme.colors.warning, 0.7)};
|
|
149
|
+
&.loading {
|
|
150
|
+
background-color: ${hexToRGBA(colorHover, alphaLoading)};
|
|
157
151
|
}
|
|
152
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
153
|
+
background-color: ${hexToRGBA(colorHover, alphaArr[key])};
|
|
154
|
+
}`)}// &:hover | &:focus | &:active
|
|
158
155
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
color
|
|
162
|
-
|
|
163
|
-
background-color: ${
|
|
164
|
-
}
|
|
165
|
-
&:focus {
|
|
166
|
-
background-color: ${lighten(theme.colors.danger, 0.8)};
|
|
167
|
-
}
|
|
168
|
-
&:active {
|
|
169
|
-
background-color: ${lighten(theme.colors.danger, 0.7)};
|
|
156
|
+
&.${color} {
|
|
157
|
+
${color !== 'default' && border(1, colorMap.get(color))}
|
|
158
|
+
color: ${colorMap.get(color)};
|
|
159
|
+
&.loading {
|
|
160
|
+
background-color: ${hexToRGBA(colorMap.get(color), alphaLoading)};
|
|
170
161
|
}
|
|
162
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
163
|
+
background-color: ${hexToRGBA(colorMap.get(color), alphaArr[key])};
|
|
164
|
+
}`)}
|
|
171
165
|
}
|
|
172
|
-
&.
|
|
173
|
-
border
|
|
174
|
-
color
|
|
175
|
-
|
|
176
|
-
background-color: ${
|
|
177
|
-
}
|
|
178
|
-
&:focus {
|
|
179
|
-
background-color: ${lighten(theme.colors.info, 0.8)};
|
|
180
|
-
}
|
|
181
|
-
&:active {
|
|
182
|
-
background-color: ${lighten(theme.colors.info, 0.7)};
|
|
166
|
+
&.custom-color {
|
|
167
|
+
${border(1, color)}
|
|
168
|
+
color: ${color};
|
|
169
|
+
&.loading {
|
|
170
|
+
background-color: ${hexToRGBA(color, alphaLoading)};
|
|
183
171
|
}
|
|
172
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
173
|
+
background-color: ${hexToRGBA(color, alphaArr[key])};
|
|
174
|
+
}`)}
|
|
184
175
|
}
|
|
185
|
-
${isColor(color) && `&.custom-color {
|
|
186
|
-
border: 1px solid ${color};
|
|
187
|
-
color : ${color};
|
|
188
|
-
&:hover {
|
|
189
|
-
background-color: ${lighten(color, 0.9)};
|
|
190
|
-
}
|
|
191
|
-
&:focus {
|
|
192
|
-
background-color: ${lighten(color, 0.8)};
|
|
193
|
-
}
|
|
194
|
-
&:active {
|
|
195
|
-
background-color: ${lighten(color, 0.7)};
|
|
196
|
-
}
|
|
197
|
-
}`}
|
|
198
|
-
${isColorName(color) && `&.custom-color {
|
|
199
|
-
border: 1px solid ${isColorName(color)};
|
|
200
|
-
color : ${isColorName(color)};
|
|
201
|
-
&:hover {
|
|
202
|
-
background-color: ${lighten(isColorName(color), 0.9)};
|
|
203
|
-
}
|
|
204
|
-
&:focus {
|
|
205
|
-
background-color: ${lighten(isColorName(color), 0.8)};
|
|
206
|
-
}
|
|
207
|
-
&:active {
|
|
208
|
-
background-color: ${lighten(isColorName(color), 0.7)};
|
|
209
|
-
}
|
|
210
|
-
}`}
|
|
211
176
|
}
|
|
212
177
|
&.filled {
|
|
213
|
-
|
|
214
|
-
color
|
|
178
|
+
${borderNone}
|
|
179
|
+
color: ${white};
|
|
215
180
|
font-weight: bold;
|
|
216
|
-
|
|
181
|
+
&.loading,
|
|
182
|
+
&:hover,
|
|
183
|
+
&:focus {
|
|
217
184
|
filter: brightness(0.85);
|
|
218
185
|
}
|
|
219
186
|
&:active {
|
|
220
187
|
filter: brightness(0.7);
|
|
221
188
|
}
|
|
222
189
|
&.default {
|
|
223
|
-
background-color: ${
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
&.warning {
|
|
232
|
-
background-color: ${theme.colors.warning};
|
|
233
|
-
}
|
|
234
|
-
&.danger {
|
|
235
|
-
background-color: ${theme.colors.danger};
|
|
190
|
+
background-color: ${rest};
|
|
191
|
+
&.loading,
|
|
192
|
+
&:hover,
|
|
193
|
+
&:focus,
|
|
194
|
+
&:active {
|
|
195
|
+
background-color: ${colorHover};
|
|
196
|
+
}
|
|
236
197
|
}
|
|
237
|
-
|
|
238
|
-
background-color: ${
|
|
198
|
+
&.${color} {
|
|
199
|
+
background-color: ${colorMap.get(color)};
|
|
239
200
|
}
|
|
240
|
-
|
|
201
|
+
&.custom-color {
|
|
241
202
|
background-color: ${color};
|
|
242
|
-
}
|
|
243
|
-
${isColorName(color) && `&.custom-color {
|
|
244
|
-
background-color: ${isColorName(color)};
|
|
245
|
-
}`}
|
|
203
|
+
}
|
|
246
204
|
}
|
|
247
205
|
&.text {
|
|
248
|
-
|
|
249
|
-
|
|
206
|
+
${noBorder}
|
|
207
|
+
${backgroundTransparent}
|
|
250
208
|
&.default {
|
|
251
|
-
color
|
|
252
|
-
&:hover
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
&:focus {
|
|
256
|
-
background-color: ${lighten(theme.colors.secondary, 0.8)};
|
|
257
|
-
}
|
|
209
|
+
color: ${rest};
|
|
210
|
+
&:hover,
|
|
211
|
+
&:focus,
|
|
258
212
|
&:active {
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
&.primary {
|
|
263
|
-
color : ${theme.colors.primary};
|
|
264
|
-
&:hover {
|
|
265
|
-
background-color: ${lighten(theme.colors.primary, 0.9)};
|
|
266
|
-
}
|
|
267
|
-
&:focus {
|
|
268
|
-
background-color: ${lighten(theme.colors.primary, 0.8)};
|
|
213
|
+
color: ${colorHover};
|
|
269
214
|
}
|
|
270
|
-
|
|
271
|
-
|
|
215
|
+
&.loading {
|
|
216
|
+
color: ${active};
|
|
217
|
+
background-color: ${hexToRGBA(colorHover, alphaLoading)};
|
|
272
218
|
}
|
|
219
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
220
|
+
background-color: ${hexToRGBA(colorHover, alphaArr[key])};
|
|
221
|
+
}`)}
|
|
273
222
|
}
|
|
274
|
-
|
|
275
|
-
color
|
|
276
|
-
|
|
277
|
-
background-color: ${
|
|
278
|
-
}
|
|
279
|
-
&:focus {
|
|
280
|
-
background-color: ${lighten(theme.colors.success, 0.8)};
|
|
281
|
-
}
|
|
282
|
-
&:active {
|
|
283
|
-
background-color: ${lighten(theme.colors.success, 0.7)};
|
|
223
|
+
&.${color} {
|
|
224
|
+
color: ${colorMap.get(color)};
|
|
225
|
+
&.loading {
|
|
226
|
+
background-color: ${hexToRGBA(colorMap.get(color), alphaLoading)};
|
|
284
227
|
}
|
|
228
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
229
|
+
background-color: ${hexToRGBA(colorMap.get(color), alphaArr[key])};
|
|
230
|
+
}`)}
|
|
285
231
|
}
|
|
286
|
-
&.
|
|
287
|
-
color
|
|
288
|
-
|
|
289
|
-
background-color: ${
|
|
290
|
-
}
|
|
291
|
-
&:focus {
|
|
292
|
-
background-color: ${lighten(theme.colors.warning, 0.8)};
|
|
293
|
-
}
|
|
294
|
-
&:active {
|
|
295
|
-
background-color: ${lighten(theme.colors.warning, 0.7)};
|
|
232
|
+
&.custom-color {
|
|
233
|
+
color: ${color};
|
|
234
|
+
&.loading {
|
|
235
|
+
background-color: ${hexToRGBA(color, alphaLoading)};
|
|
296
236
|
}
|
|
237
|
+
${Object.keys(alphaArr).map(key => `&:${key} {
|
|
238
|
+
background-color: ${hexToRGBA(color, alphaArr[key])};
|
|
239
|
+
}`)}
|
|
297
240
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}
|
|
306
|
-
&:active {
|
|
307
|
-
background-color: ${lighten(theme.colors.danger, 0.7)};
|
|
308
|
-
}
|
|
241
|
+
}
|
|
242
|
+
&.ghost {
|
|
243
|
+
${backgroundTransparent}
|
|
244
|
+
${noBorder}
|
|
245
|
+
color: ${rest};
|
|
246
|
+
&.${size} {
|
|
247
|
+
height: ${iconSize};
|
|
248
|
+
width: ${iconSize};
|
|
309
249
|
}
|
|
310
|
-
&.
|
|
311
|
-
|
|
312
|
-
&:
|
|
313
|
-
background-color: ${lighten(theme.colors.info, 0.9)};
|
|
314
|
-
}
|
|
315
|
-
&:focus {
|
|
316
|
-
background-color: ${lighten(theme.colors.info, 0.8)};
|
|
317
|
-
}
|
|
250
|
+
&.default {
|
|
251
|
+
&:hover,
|
|
252
|
+
&:focus,
|
|
318
253
|
&:active {
|
|
319
|
-
|
|
254
|
+
color: ${iconColorMap.get(capitalize(name)) || colorHover};
|
|
320
255
|
}
|
|
321
256
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
&:
|
|
325
|
-
background-color: ${lighten(color, 0.9)};
|
|
326
|
-
}
|
|
327
|
-
&:focus {
|
|
328
|
-
background-color: ${lighten(color, 0.8)};
|
|
329
|
-
}
|
|
257
|
+
&.${color} {
|
|
258
|
+
&:hover,
|
|
259
|
+
&:focus,
|
|
330
260
|
&:active {
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
}`}
|
|
334
|
-
${isColorName(color) && `&.custom-color {
|
|
335
|
-
color : ${isColorName(color)};
|
|
336
|
-
&:hover {
|
|
337
|
-
background-color: ${lighten(isColorName(color), 0.9)};
|
|
338
|
-
}
|
|
339
|
-
&:focus {
|
|
340
|
-
background-color: ${lighten(isColorName(color), 0.8)};
|
|
261
|
+
color: ${colorMap.get(color)};
|
|
341
262
|
}
|
|
263
|
+
}
|
|
264
|
+
&.custom-color {
|
|
265
|
+
&:hover,
|
|
266
|
+
&:focus,
|
|
342
267
|
&:active {
|
|
343
|
-
|
|
268
|
+
color: ${color};
|
|
344
269
|
}
|
|
345
|
-
}`}
|
|
346
|
-
}
|
|
347
|
-
&:disabled {
|
|
348
|
-
pointer-events: none;
|
|
349
|
-
color: ${colors.dark4} !important;
|
|
350
|
-
&.filled, &.outlined {
|
|
351
|
-
background-color: ${theme.colors.bgDisabled} !important;
|
|
352
|
-
filter: brightness(1);
|
|
353
|
-
}
|
|
354
|
-
&.outlined {
|
|
355
|
-
border-color: ${theme.colors.disabled};
|
|
356
|
-
}
|
|
357
|
-
&.text {
|
|
358
|
-
background-color: transparent !important;
|
|
359
|
-
}
|
|
360
|
-
.DGN-UI-ButtonIcon-Icon {
|
|
361
|
-
pointer-events: auto;
|
|
362
|
-
cursor: no-drop;
|
|
363
270
|
}
|
|
364
271
|
}
|
|
365
|
-
&:not(:disabled):focus {
|
|
366
|
-
box-shadow: ${viewType !== 'text' ? '0 0 0 2px ' + hexToRgb(colors.brand + '20') : 'none'};
|
|
367
|
-
}
|
|
368
|
-
.DGN-UI-ButtonIcon-Icon {
|
|
369
|
-
display: flex;
|
|
370
|
-
position: relative;
|
|
371
|
-
box-sizing: border-box;
|
|
372
|
-
justify-content: center;
|
|
373
|
-
align-items: center;
|
|
374
|
-
}
|
|
375
272
|
`;
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
273
|
+
useImperativeHandle(reference, () => {
|
|
274
|
+
const currentRef = ref.current || {};
|
|
275
|
+
const _instance = {}; // methods
|
|
276
|
+
|
|
277
|
+
_instance.__proto__ = {}; // hidden methods
|
|
278
|
+
|
|
279
|
+
currentRef.instance = _instance;
|
|
280
|
+
return currentRef;
|
|
281
|
+
});
|
|
385
282
|
|
|
386
283
|
const iconLoading = () => {
|
|
387
284
|
return jsx(CircularProgress, {
|
|
388
|
-
size:
|
|
389
|
-
background:
|
|
285
|
+
size: 'extraSmall',
|
|
286
|
+
background: 'transparent',
|
|
390
287
|
color: 'currentColor',
|
|
391
288
|
strokeWidth: 3,
|
|
392
|
-
width:
|
|
289
|
+
width: parseInt(iconSize)
|
|
393
290
|
});
|
|
394
291
|
};
|
|
395
292
|
|
|
@@ -398,63 +295,66 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
398
295
|
onClick && onClick(event);
|
|
399
296
|
};
|
|
400
297
|
|
|
401
|
-
|
|
298
|
+
return useMemo(() => {
|
|
402
299
|
let node = children;
|
|
403
300
|
|
|
404
301
|
if (!node) {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
viewBox: viewBox
|
|
413
|
-
});
|
|
414
|
-
} else {
|
|
415
|
-
node = jsx("span", {
|
|
416
|
-
css: NotFoundIcon
|
|
417
|
-
});
|
|
418
|
-
}
|
|
302
|
+
node = jsx(Icon, {
|
|
303
|
+
name: name,
|
|
304
|
+
width: iconSize,
|
|
305
|
+
height: iconSize,
|
|
306
|
+
color: 'currentColor',
|
|
307
|
+
viewBox: true
|
|
308
|
+
});
|
|
419
309
|
}
|
|
420
310
|
|
|
421
|
-
return jsx("button",
|
|
311
|
+
return jsx("button", {
|
|
422
312
|
css: ButtonRoot,
|
|
423
313
|
style: style,
|
|
424
314
|
ref: ref,
|
|
425
315
|
type: type,
|
|
426
316
|
onClick: _onClick,
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
},
|
|
317
|
+
className: ['DGN-UI-ButtonIcon', viewType, getClassNameFromColor(color), size, loading && 'loading', disabled && 'disabled', className].join(' ').trim().replace(/\s+/g, ' '),
|
|
318
|
+
...props
|
|
319
|
+
}, loading && iconLoading(), !loading && jsx("span", {
|
|
430
320
|
className: 'DGN-UI-ButtonIcon-Icon'
|
|
431
|
-
}, " ", node, " "), !disabled && jsx(Ripple, {
|
|
432
|
-
color: getRippleColor(color, viewType,
|
|
321
|
+
}, " ", node, " "), !disabled && !loading && viewType !== 'ghost' && jsx(Ripple, {
|
|
322
|
+
color: getRippleColor(color, viewType, allColors)
|
|
433
323
|
}));
|
|
434
|
-
}, [size, viewType, color, disabled, name, children, onClick, loading, circular, viewBox]);
|
|
435
|
-
return ButtonView;
|
|
324
|
+
}, [size, viewType, color, colorHover, disabled, name, children, onClick, loading, circular, viewBox, width, height]);
|
|
436
325
|
}));
|
|
437
326
|
ButtonIcon.defaultProps = {
|
|
438
327
|
viewType: 'outlined',
|
|
439
328
|
color: 'default',
|
|
329
|
+
colorHover: active,
|
|
440
330
|
size: 'medium',
|
|
441
331
|
className: '',
|
|
442
|
-
width: '100%',
|
|
443
|
-
height: '100%',
|
|
444
332
|
circular: false,
|
|
445
|
-
disabled: false
|
|
333
|
+
disabled: false,
|
|
334
|
+
viewBox: true
|
|
446
335
|
};
|
|
447
336
|
ButtonIcon.propTypes = {
|
|
448
337
|
/** The type attribute specifies the type of tag button */
|
|
449
338
|
type: PropTypes.oneOf(['button', 'submit', 'reset']),
|
|
450
339
|
|
|
451
340
|
/** used to fill background for button */
|
|
452
|
-
viewType: PropTypes.oneOf(['text', 'outlined', 'filled']),
|
|
341
|
+
viewType: PropTypes.oneOf(['text', 'outlined', 'filled', 'ghost']),
|
|
453
342
|
|
|
454
343
|
/** color for button */
|
|
455
344
|
color: PropTypes.string,
|
|
456
345
|
|
|
457
|
-
/**
|
|
346
|
+
/** custom hover color for button with color 'default' */
|
|
347
|
+
colorHover: PropTypes.string,
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* size of button
|
|
351
|
+
*
|
|
352
|
+
* * tiny (button 24px, icon 16px)
|
|
353
|
+
* * small (button 32px, icon 20px)
|
|
354
|
+
* * medium (button 40px, icon 24px)
|
|
355
|
+
* * large (button 48px, icon 32px)
|
|
356
|
+
* * giant (button 56px, icon 40px)
|
|
357
|
+
* */
|
|
458
358
|
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant']),
|
|
459
359
|
|
|
460
360
|
/** name of icon in icons store */
|
|
@@ -463,10 +363,10 @@ ButtonIcon.propTypes = {
|
|
|
463
363
|
/** the class for button */
|
|
464
364
|
className: PropTypes.string,
|
|
465
365
|
|
|
466
|
-
/** the width of
|
|
366
|
+
/** the width of button */
|
|
467
367
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
468
368
|
|
|
469
|
-
/** the height of
|
|
369
|
+
/** the height of button */
|
|
470
370
|
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
471
371
|
|
|
472
372
|
/** has view box if true */
|
|
@@ -488,6 +388,14 @@ ButtonIcon.propTypes = {
|
|
|
488
388
|
props: PropTypes.any,
|
|
489
389
|
|
|
490
390
|
/** status loading of button */
|
|
491
|
-
loading: PropTypes.bool
|
|
391
|
+
loading: PropTypes.bool,
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* ref methods
|
|
395
|
+
*
|
|
396
|
+
* * onClick
|
|
397
|
+
*/
|
|
398
|
+
reference: PropTypes.func
|
|
492
399
|
};
|
|
493
|
-
export
|
|
400
|
+
export { ButtonIcon };
|
|
401
|
+
export default OptionWrapper(ButtonIcon);
|