diginet-core-ui 1.3.93 → 1.3.94

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.
@@ -1,43 +1,42 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
3
  import { css, jsx } from '@emotion/core';
4
- import { ButtonIcon, Typography } from "./..";
5
- import { Icon } from "../../icons/effect";
4
+ import { ButtonMore, Typography } from "./..";
6
5
  import OptionWrapper from "../others/option-wrapper";
6
+ import { Icon } from "../../icons/effect";
7
7
  import PropTypes from 'prop-types';
8
8
  import React, { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
9
- import { displayFlex, flexWrap, itemsCenter, mg, mgx, pd, userSelectNone } from "../../styles/general";
9
+ import { hexToRGBA } from "../../styles/color-helper";
10
+ import { alphaPseudo, bgColor, borderRadius, cursorPointer, displayFlex, flexWrap, gap, itemsCenter, listNone, mg, pd, pdl, pdr, textColor, userSelectNone } from "../../styles/general";
11
+ import { useTypography as typography } from "../../theme";
10
12
  import { classNames } from "../../utils";
11
- const insertSeparators = (items, separator) => {
12
- return items.reduce((acc, current, index) => {
13
- if (index < items.length - 1) {
14
- acc = acc.concat(current, jsx("li", {
15
- css: BreadcrumbSeparatorCSS,
16
- "aria-hidden": true,
17
- key: `separator-${index}`,
18
- className: 'DGN-UI-Breadcrumb-separator'
19
- }, separator));
20
- } else {
21
- acc.push(current);
22
- }
23
- return acc;
24
- }, []);
25
- };
13
+ const sizeIconMap = new Map([['tiny', 16], ['small', 18], ['medium', 20]]);
14
+ const sizeTypographyPMap = new Map([['tiny', 'p3'], ['small', 'p2'], ['medium', 'p1']]);
15
+ const sizeTypographyHMap = new Map([['tiny', 'h5'], ['small', 'h4'], ['medium', 'h3']]);
26
16
  const Breadcrumb = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
27
17
  action = {},
28
18
  children,
29
19
  className,
20
+ color,
30
21
  data,
31
22
  id,
32
23
  itemsAfterCollapse,
33
24
  itemsBeforeCollapse,
34
25
  maxItems,
35
26
  separator,
27
+ size,
36
28
  style
37
29
  }, reference) => {
38
30
  if (!reference) reference = useRef(null);
31
+ if (color === 'default') color = 'system/rest';
39
32
  const ref = useRef(null);
40
- const [expanded, setExpanded] = React.useState(false);
33
+ const sizeIcon = sizeIconMap.get(size);
34
+ const sizeTypographyP = sizeTypographyPMap.get(size);
35
+ const sizeTypographyH = sizeTypographyHMap.get(size);
36
+
37
+ // const [expanded, setExpanded] = React.useState(false);
38
+
39
+ const _BreadcrumbLiCSS = BreadcrumbLiCSS(color, sizeTypographyP, sizeTypographyH);
41
40
  useImperativeHandle(reference, () => {
42
41
  const currentRef = ref.current || {};
43
42
  currentRef.element = ref.current;
@@ -48,39 +47,78 @@ const Breadcrumb = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
48
47
  currentRef.instance = _instance;
49
48
  return currentRef;
50
49
  });
50
+ const renderSeparator = typeof separator === 'string' ? jsx(Icon, {
51
+ name: separator,
52
+ width: sizeIcon,
53
+ height: sizeIcon,
54
+ color: color,
55
+ viewBox: true
56
+ }) : separator;
51
57
  const renderItemsBeforeAndAfter = allItems => {
52
- const handleClickExpand = () => {
53
- setExpanded(true);
54
- };
58
+ // const handleClickExpand = () => {
59
+ // setExpanded(true);
60
+ // };
61
+
55
62
  if (itemsBeforeCollapse + itemsAfterCollapse >= allItems.length) {
56
63
  return allItems;
57
64
  }
58
- return [...allItems.slice(0, itemsBeforeCollapse), jsx(ButtonIcon, {
65
+ let options = [];
66
+ data.slice(itemsBeforeCollapse, allItems.length - itemsAfterCollapse).map(item => {
67
+ var _item$onClick;
68
+ return options = [...options, {
69
+ label: (item === null || item === void 0 ? void 0 : item.label) || (item === null || item === void 0 ? void 0 : item.name),
70
+ icon: item === null || item === void 0 ? void 0 : item.icon,
71
+ action: item === null || item === void 0 ? void 0 : (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item)
72
+ }];
73
+ });
74
+ return [...allItems.slice(0, itemsBeforeCollapse), jsx(ButtonMore, {
59
75
  key: "ellipsis",
60
- name: 'MoreHoriz',
61
- width: 24,
62
- height: 16,
63
- onClick: handleClickExpand
64
- }), ...allItems.slice(allItems.length - itemsAfterCollapse, allItems.length)];
76
+ options: options,
77
+ anchor: jsx("li", {
78
+ key: "ellipsis",
79
+ css: _BreadcrumbLiCSS
80
+ }, jsx(Icon, {
81
+ name: 'MoreHoriz',
82
+ width: sizeIcon,
83
+ height: sizeIcon,
84
+ color: color
85
+ }), renderSeparator)
86
+ }),
87
+ // <ButtonIcon key="ellipsis" name={'MoreHoriz'} width={24} height={16} onClick={handleClickExpand} />,
88
+ ...allItems.slice(allItems.length - itemsAfterCollapse, allItems.length)];
65
89
  };
66
90
  const allItems = data !== null && data !== void 0 && data.length ? data.map((item, idx) => {
67
- var _data$onClick;
91
+ var _item$onClick2;
68
92
  return jsx("li", {
93
+ css: _BreadcrumbLiCSS,
69
94
  className: 'DGN-UI-Breadcrumb-li',
70
95
  key: `child-${idx}`
71
- }, jsx(Typography, {
72
- type: (data === null || data === void 0 ? void 0 : data.length) === idx + 1 ? 'h5' : 'p3',
96
+ }, item !== null && item !== void 0 && item.icon ? jsx(Icon, {
97
+ className: 'DGN-UI-Breadcrumb-li-icon',
98
+ name: item === null || item === void 0 ? void 0 : item.icon,
99
+ color: color,
100
+ width: sizeIcon,
101
+ height: sizeIcon
102
+ }) : null, jsx(Typography, {
103
+ className: 'DGN-UI-Breadcrumb-li-label',
104
+ type: (data === null || data === void 0 ? void 0 : data.length) === idx + 1 ? sizeTypographyH : sizeTypographyP,
73
105
  mapping: 'a',
74
- color: 'text.sub',
75
- href: data === null || data === void 0 ? void 0 : data.href,
76
- onClick: data === null || data === void 0 ? void 0 : (_data$onClick = data.onClick) === null || _data$onClick === void 0 ? void 0 : _data$onClick.call(data)
77
- }, item === null || item === void 0 ? void 0 : item.name));
106
+ color: 'currentColor',
107
+ href: item === null || item === void 0 ? void 0 : item.href,
108
+ onClick: item === null || item === void 0 ? void 0 : (_item$onClick2 = item.onClick) === null || _item$onClick2 === void 0 ? void 0 : _item$onClick2.call(item)
109
+ }, (item === null || item === void 0 ? void 0 : item.label) || (item === null || item === void 0 ? void 0 : item.name)), (data === null || data === void 0 ? void 0 : data.length) !== idx + 1 ? renderSeparator : null);
78
110
  }) : React.Children.toArray(children).filter(child => {
79
111
  return /*#__PURE__*/React.isValidElement(child);
80
- }).map((child, idx) => jsx("li", {
81
- className: 'DGN-UI-Breadcrumb-li',
82
- key: `child-${idx}`
83
- }, child));
112
+ }).map((child, idx) => {
113
+ var _React$Children$toArr;
114
+ return jsx("li", {
115
+ css: _BreadcrumbLiCSS,
116
+ className: 'DGN-UI-Breadcrumb-li',
117
+ key: `child-${idx}`
118
+ }, child, ((_React$Children$toArr = React.Children.toArray(children).filter(child => {
119
+ return /*#__PURE__*/React.isValidElement(child);
120
+ })) === null || _React$Children$toArr === void 0 ? void 0 : _React$Children$toArr.length) !== idx + 1 ? renderSeparator : null);
121
+ });
84
122
  return useMemo(() => {
85
123
  return jsx("nav", {
86
124
  ref: ref,
@@ -88,34 +126,52 @@ const Breadcrumb = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
88
126
  style: style,
89
127
  className: classNames('DGN-UI-Breadcrumb', className)
90
128
  }, jsx("ol", {
91
- css: BreadcrumbOlCSS,
129
+ css: BreadcrumbOlCSS(color),
92
130
  className: 'DGN-UI-Breadcrumb-ol'
93
- }, insertSeparators(expanded || maxItems && allItems.length <= maxItems ? allItems : renderItemsBeforeAndAfter(allItems), separator)));
94
- }, [children, className, data, id, itemsAfterCollapse, itemsBeforeCollapse, maxItems, separator, style, expanded]);
131
+ },
132
+ // expanded ||
133
+ maxItems && allItems.length <= maxItems ? allItems : renderItemsBeforeAndAfter(allItems)));
134
+ }, [children, className, color, data, id, itemsAfterCollapse, itemsBeforeCollapse, maxItems, separator, size, style
135
+ // expanded,
136
+ ]);
95
137
  }));
96
- const BreadcrumbOlCSS = css`
138
+
139
+ const BreadcrumbOlCSS = color => css`
97
140
  ${displayFlex};
98
141
  ${flexWrap};
99
142
  ${itemsCenter};
100
143
  ${pd(0)};
101
144
  ${mg(0)};
102
- list-style: none;
145
+ ${listNone};
146
+ ${textColor(color)};
103
147
  `;
104
- const BreadcrumbSeparatorCSS = css`
148
+ const BreadcrumbLiCSS = (color, sizeTypographyP, sizeTypographyH) => css`
149
+ ${typography[sizeTypographyP]};
105
150
  ${displayFlex};
151
+ ${itemsCenter};
152
+ ${gap('4px')};
153
+ ${pdl([1])};
154
+ ${borderRadius(4)};
155
+ ${cursorPointer};
106
156
  ${userSelectNone};
107
- ${mgx([2])};
157
+ &:last-child {
158
+ ${pdr([1])};
159
+ ${typography[sizeTypographyH]};
160
+ }
161
+ ${Object.keys(alphaPseudo).map(key => css`
162
+ &: ${key} {
163
+ ${bgColor(hexToRGBA(color, alphaPseudo[key]))};
164
+ }
165
+ `)}
108
166
  `;
109
167
  Breadcrumb.defaultProps = {
110
168
  className: '',
111
- itemsBeforeCollapse: 1,
169
+ color: 'default',
112
170
  itemsAfterCollapse: 1,
171
+ itemsBeforeCollapse: 1,
113
172
  maxItems: 8,
114
- separator: jsx(Icon, {
115
- name: 'ArrowRight',
116
- width: 16,
117
- height: 16
118
- }),
173
+ separator: 'ArrowRight',
174
+ size: 'medium',
119
175
  style: {}
120
176
  };
121
177
  Breadcrumb.propTypes = {
@@ -123,9 +179,11 @@ Breadcrumb.propTypes = {
123
179
  children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
124
180
  /** Class for component. */
125
181
  className: PropTypes.string,
182
+ /** The color of the component. */
183
+ color: PropTypes.string,
126
184
  /** Class for component. */
127
- data: PropTypes.PropTypes.arrayOf(PropTypes.shape({
128
- name: PropTypes.string,
185
+ data: PropTypes.arrayOf(PropTypes.shape({
186
+ label: PropTypes.string,
129
187
  href: PropTypes.string,
130
188
  onClick: PropTypes.func
131
189
  })),
@@ -136,7 +194,9 @@ Breadcrumb.propTypes = {
136
194
  /** Class for component. */
137
195
  maxItems: PropTypes.number,
138
196
  /** Custom separator node. */
139
- separator: PropTypes.node,
197
+ separator: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
198
+ /** The size of the component. */
199
+ size: PropTypes.oneOf(['tiny', 'small', 'medium']),
140
200
  /** Style inline of component. */
141
201
  style: PropTypes.object
142
202
  };
@@ -1,37 +1,17 @@
1
1
  /** @jsxRuntime classic */
2
2
  /** @jsx jsx */
3
- import { memo, useRef, useMemo, forwardRef, useImperativeHandle } from 'react';
4
- import PropTypes from 'prop-types';
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 * as allColors from "../../styles/colors";
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 Icon from "../../icons";
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', semanticDanger], ['Cancel', semanticDanger], ['Approval', semanticSuccess], ['Delete', semanticWarning], ['Trash', semanticWarning], ['Edit', semanticInfo], ['EditV2', semanticInfo], ['View', semanticInfo]]);
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 isViewTypeGhost = viewType === 'ghost';
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, disabled && ButtonDisabledCSS],
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, getClassNameFromColor(colorProp), size, loading && 'button-icon--loading', className)
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, colorProp, colorHover, disabled, height, id, loading, name, onClick, size, style, viewBox, viewType, width]);
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 ? borderRadius50 : borderRadius4px};
189
- padding: 0;
148
+ ${borderRadius(circular ? '50%' : 4)};
149
+ ${pd(0)};
190
150
  transition: background-color 0.5s, filter 0.5s;
191
- &.button-icon--loading {
192
- ${pointerEventsNone};
193
- }
194
- &.outlined {
195
- ${bgTransparent};
196
- ${border(1, color)}
197
- color: ${color};
198
- &.button-icon--loading {
199
- background-color: ${hexToRGBA(color, alphaLoading)};
200
- }
201
- ${Object.keys(alphaArr).map(key => `&:${key} {
202
- background-color: ${hexToRGBA(color, alphaArr[key])};
203
- }`)}
204
- &.default {
205
- ${border(1, systemRest)};
206
- color: ${systemRest};
207
- &.button-icon--loading,
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
- color: ${colorHover};
212
- border-color: ${colorHover};
213
- }
214
- &.button-icon--loading {
215
- background-color: ${hexToRGBA(colorHover, alphaLoading)};
175
+ ${textColor(colorHover)};
176
+ ${borderColor(colorHover)};
216
177
  }
217
- ${Object.keys(alphaArr).map(key => `&:${key} {
218
- background-color: ${hexToRGBA(colorHover, alphaArr[key])};
219
- }`)}// &:hover | &:focus | &:active
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
- &.filled {
188
+ `}
189
+ ${viewType === 'filled' && css`
223
190
  ${borderNone};
224
- background-color: ${color};
225
- color: ${color === systemWhite ? systemRest : systemWhite};
191
+ ${textColor(color === getColor('system.white') ? 'system.rest' : 'system.white')};
192
+ ${bgColor(color)};
226
193
  font-weight: bold;
227
- &.button-icon--loading,
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
- &.default {
236
- background-color: ${systemRest};
237
- &.button-icon--loading,
204
+ ${isColorDefault && css`
205
+ ${bgColor('system/rest')};
206
+ ${loading && bgColor('system/active')};
238
207
  &:hover,
239
208
  &:focus,
240
209
  &:active {
241
- background-color: ${colorHover};
210
+ ${bgColor(colorHover)};
242
211
  }
212
+ `}
213
+ :disabled {
214
+ ${bgColor('fill/disabled')};
215
+ filter: brightness(1);
243
216
  }
244
- }
245
- &.text {
217
+ `}
218
+ ${viewType === 'text' && css`
246
219
  ${borderNone};
247
- ${bgTransparent};
248
- color: ${color};
249
- &.button-icon--loading {
250
- background-color: ${hexToRGBA(color, alphaLoading)};
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
- ${Object.keys(alphaArr).map(key => `&:${key} {
253
- background-color: ${hexToRGBA(color, alphaArr[key])};
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
- color: ${color};
275
- &.loading,
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
- &.default {
284
- color: ${systemRest};
259
+ ${isColorDefault && css`
260
+ ${textColor('system/rest')};
285
261
  &:hover,
286
262
  &:focus,
287
263
  &:active {
288
- color: ${iconColorMap.get(capitalize(name)) || colorHover};
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,