carbon-react 94.8.0 → 95.0.0
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/lib/components/button/button.component.js +17 -8
- package/lib/components/button-toggle/button-toggle-icon.component.js +3 -4
- package/lib/components/button-toggle/button-toggle.style.js +2 -0
- package/lib/components/heading/heading.style.js +1 -0
- package/lib/components/icon/icon-config.js +1 -5
- package/lib/components/icon/icon.component.js +2 -21
- package/lib/components/icon/icon.d.ts +3 -18
- package/lib/components/icon/icon.style.js +18 -76
- package/lib/components/link/link.component.js +8 -2
- package/lib/components/link/link.style.js +1 -0
- package/lib/components/message/type-icon/type-icon.component.js +1 -2
- package/lib/components/pill/pill.component.js +1 -3
- package/lib/components/pill/pill.style.js +2 -0
- package/lib/components/split-button/split-button.component.js +11 -4
- package/package.json +1 -1
|
@@ -7,6 +7,8 @@ exports.default = exports.ButtonWithForwardRef = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
+
var _styledComponents = require("styled-components");
|
|
11
|
+
|
|
10
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
13
|
|
|
12
14
|
var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
|
|
@@ -17,6 +19,8 @@ var _button = _interopRequireWildcard(require("./button.style"));
|
|
|
17
19
|
|
|
18
20
|
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
19
21
|
|
|
22
|
+
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
23
|
+
|
|
20
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
25
|
|
|
22
26
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -35,21 +39,23 @@ function renderChildren({
|
|
|
35
39
|
disabled,
|
|
36
40
|
buttonType,
|
|
37
41
|
iconTooltipMessage,
|
|
38
|
-
iconTooltipPosition
|
|
42
|
+
iconTooltipPosition,
|
|
43
|
+
theme
|
|
39
44
|
/* eslint-enable */
|
|
40
45
|
|
|
41
46
|
}) {
|
|
42
47
|
const iconColorMap = {
|
|
43
|
-
primary:
|
|
44
|
-
secondary:
|
|
45
|
-
tertiary:
|
|
46
|
-
darkBackground:
|
|
48
|
+
primary: theme.colors.white,
|
|
49
|
+
secondary: theme.colors.primary,
|
|
50
|
+
tertiary: theme.colors.primary,
|
|
51
|
+
darkBackground: theme.colors.primary
|
|
47
52
|
};
|
|
48
53
|
const iconProps = {
|
|
49
54
|
type: iconType,
|
|
50
55
|
disabled,
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
bgSize: "extra-small",
|
|
57
|
+
color: iconColorMap[buttonType],
|
|
58
|
+
bg: "transparent"
|
|
53
59
|
};
|
|
54
60
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, iconType && iconPosition === "before" && children && /*#__PURE__*/_react.default.createElement(_icon.default, iconProps), /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement("span", {
|
|
55
61
|
"data-element": "main-text"
|
|
@@ -129,6 +135,8 @@ const renderStyledButton = buttonProps => {
|
|
|
129
135
|
};
|
|
130
136
|
|
|
131
137
|
const Button = props => {
|
|
138
|
+
const theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _base.default;
|
|
139
|
+
|
|
132
140
|
const {
|
|
133
141
|
size,
|
|
134
142
|
subtext
|
|
@@ -142,7 +150,8 @@ const Button = props => {
|
|
|
142
150
|
} = props;
|
|
143
151
|
const propsWithoutAs = { ...rest,
|
|
144
152
|
buttonType: buttonType || as,
|
|
145
|
-
ref: forwardRef || linkRef
|
|
153
|
+
ref: forwardRef || linkRef,
|
|
154
|
+
theme
|
|
146
155
|
};
|
|
147
156
|
|
|
148
157
|
if (subtext.length > 0 && size !== "large") {
|
|
@@ -19,10 +19,9 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
19
19
|
|
|
20
20
|
const ButtonToggleIcon = props => /*#__PURE__*/_react.default.createElement(_buttonToggle.StyledButtonToggleIcon, props, /*#__PURE__*/_react.default.createElement(_icon.default, _extends({
|
|
21
21
|
type: props.buttonIcon,
|
|
22
|
-
fontSize: props.buttonIconSize
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
})));
|
|
22
|
+
fontSize: props.buttonIconSize,
|
|
23
|
+
bgSize: "extra-small"
|
|
24
|
+
}, props)));
|
|
26
25
|
|
|
27
26
|
ButtonToggleIcon.propTypes = {
|
|
28
27
|
/**
|
|
@@ -144,6 +144,8 @@ const StyledButtonToggleIcon = _styledComponents.default.div`
|
|
|
144
144
|
${_icon.default} {
|
|
145
145
|
margin-right: 0;
|
|
146
146
|
margin-bottom: 8px;
|
|
147
|
+
height: ${`${iconFontSizes.largeIcon}px`};
|
|
148
|
+
width: ${`${iconFontSizes.largeIcon}px`};
|
|
147
149
|
}
|
|
148
150
|
|
|
149
151
|
${_icon.default}::before {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.ICONS = exports.
|
|
6
|
+
exports.default = exports.ICONS = exports.ICON_SIZES = exports.ICON_SHAPES = exports.ICON_TOOLTIP_POSITIONS = void 0;
|
|
7
7
|
const dlsConfig = {
|
|
8
8
|
backgroundSize: {
|
|
9
9
|
"extra-small": "16px",
|
|
@@ -30,10 +30,6 @@ const ICON_SHAPES = ["circle", "rounded-rect", "square"];
|
|
|
30
30
|
exports.ICON_SHAPES = ICON_SHAPES;
|
|
31
31
|
const ICON_SIZES = ["extra-small", "small", "medium", "large", "extra-large"];
|
|
32
32
|
exports.ICON_SIZES = ICON_SIZES;
|
|
33
|
-
const ICON_BACKGROUNDS = ["info", "error", "success", "warning", "business", "none"];
|
|
34
|
-
exports.ICON_BACKGROUNDS = ICON_BACKGROUNDS;
|
|
35
|
-
const ICON_COLORS = ["default", "on-light-background", "on-dark-background", "business-color"];
|
|
36
|
-
exports.ICON_COLORS = ICON_COLORS;
|
|
37
33
|
const ICONS = ["add", "alert", "analysis", "arrow_down", "arrow_left", "arrow_left_boxed", "arrow_left_right_small", "arrow_left_small", "arrow_right", "arrow_right_small", "arrow_up", "attach", "bank", "basket", "basket_with_squares", "bin", "blocked", "blocked_square", "block_arrow_right", "bold", "boxed_shapes", "bulk_destroy", "bullet_list", "bullet_list_dotted", "bullet_list_numbers", "business", "calendar", "calendar_today", "call", "camera", "card_view", "caret_down", "caret_left", "caret_right", "caret_up", "caret_large_down", "caret_large_left", "caret_large_right", "caret_large_up", "cart", "chat", "chart_bar", "chart_line", "chart_pie", "chat_notes", "chevron_down", "chevron_left", "chevron_right", "chevron_up", "chevron_down_thick", "chevron_left_thick", "chevron_right_thick", "chevron_up_thick", "circle_with_dots", "circles_connection", "clock", "close", "coins", "collaborate", "computer_clock", "connect", "copy", "credit_card", "credit_card_slash", "cross", "cross_circle", "csv", "delete", "delivery", "disputed", "document_right_align", "document_tick", "document_vertical_lines", "download", "drag", "drag_vertical", "draft", "dropdown", "duplicate", "edit", "edited", "email", "email_switch", "ellipsis_horizontal", "ellipsis_vertical", "envelope_dollar", "envelope_euro", "error", "error_square", "euro", "expand", "factory", "favourite", "favourite_lined", "fax", "feedback", "file_excel", "file_generic", "file_image", "file_pdf", "file_word", "files_leaning", "filter", "filter_new", "fit_height", "fit_width", "flag", "folder", "gift", "graph", "grid", "help", "hide", "home", "image", "in_progress", "in_transit", "individual", "info", "italic", "key", "ledger", "ledger_arrow_left", "ledger_arrow_right", "link", "list_view", "locked", "location", "logout", "lookup", "marker", "message", "messages", "minus", "minus_large", "mobile", "money_bag", "pause", "pause_circle", "pdf", "people", "people_switch", "person", "person_info", "person_tick", "phone", "play", "play_circle", "plus", "plus_large", "pound", "print", "progress", "progressed", "question", "refresh", "refresh_clock", "remove", "sage_coin", "save", "scan", "search", "services", "settings", "share", "shop", "sort_down", "sort_up", "spanner", "split", "split_container", "square_dot", "squares_nine", "stacked_boxes", "stacked_squares", "submitted", "sync", "tag", "three_boxes", "tick", "tick_circle", "undo", "unlocked", "upload", "uploaded", "video", "view", "warning", "admin", "arrow", "contacts", "create", "disconnect", "entry", "go", "lightbulb_off", "lightbulb_on", "none", "old_warning", "piggy_bank", "question_hollow", "question_mark", "settings_old", "talk", "true_tick"];
|
|
38
34
|
exports.ICONS = ICONS;
|
|
39
35
|
var _default = dlsConfig;
|
|
@@ -19,8 +19,6 @@ var _tooltip = _interopRequireDefault(require("../tooltip"));
|
|
|
19
19
|
|
|
20
20
|
var _utils = require("../../style/utils");
|
|
21
21
|
|
|
22
|
-
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
23
|
-
|
|
24
22
|
var _iconConfig = require("./icon-config");
|
|
25
23
|
|
|
26
24
|
var _tooltipProvider = require("../../__internal__/tooltip-provider");
|
|
@@ -33,19 +31,16 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
|
|
|
33
31
|
|
|
34
32
|
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); }
|
|
35
33
|
|
|
36
|
-
let deprecatedWarnTriggered = false;
|
|
37
34
|
const marginPropTypes = (0, _utils.filterStyledSystemMarginProps)(_propTypes2.default.space);
|
|
38
35
|
|
|
39
36
|
const Icon = /*#__PURE__*/_react.default.forwardRef(({
|
|
40
37
|
bg,
|
|
41
38
|
bgShape,
|
|
42
39
|
bgSize,
|
|
43
|
-
bgTheme,
|
|
44
40
|
className,
|
|
45
41
|
color,
|
|
46
42
|
disabled,
|
|
47
43
|
fontSize,
|
|
48
|
-
iconColor,
|
|
49
44
|
type,
|
|
50
45
|
tooltipMessage,
|
|
51
46
|
tooltipPosition,
|
|
@@ -58,12 +53,6 @@ const Icon = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
58
53
|
inputSize,
|
|
59
54
|
...rest
|
|
60
55
|
}, ref) => {
|
|
61
|
-
if (!deprecatedWarnTriggered && (iconColor || bgTheme)) {
|
|
62
|
-
deprecatedWarnTriggered = true;
|
|
63
|
-
|
|
64
|
-
_logger.default.deprecate("`iconColor` and `bgTheme` props are deprecated and will soon be removed");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
56
|
const isInteractive = !!tooltipMessage && !disabled;
|
|
68
57
|
/** Return Icon type with overrides */
|
|
69
58
|
|
|
@@ -93,14 +82,12 @@ const Icon = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
93
82
|
|
|
94
83
|
const styleProps = {
|
|
95
84
|
bg,
|
|
96
|
-
bgTheme,
|
|
97
85
|
bgSize,
|
|
98
86
|
bgShape,
|
|
99
87
|
color,
|
|
100
88
|
disabled,
|
|
101
89
|
fontSize,
|
|
102
90
|
isInteractive,
|
|
103
|
-
iconColor,
|
|
104
91
|
tabIndex,
|
|
105
92
|
type: iconType(),
|
|
106
93
|
...(0, _utils.filterStyledSystemMarginProps)(rest)
|
|
@@ -157,19 +144,13 @@ Icon.propTypes = { ...marginPropTypes,
|
|
|
157
144
|
/** Background shape */
|
|
158
145
|
bgShape: _propTypes.default.oneOf(["circle", "rounded-rect", "square"]),
|
|
159
146
|
|
|
160
|
-
/** Background color theme */
|
|
161
|
-
bgTheme: _propTypes.default.oneOf(["info", "error", "success", "warning", "business", "none"]),
|
|
162
|
-
|
|
163
147
|
/** Icon font size */
|
|
164
148
|
fontSize: _propTypes.default.oneOf(["small", "medium", "large", "extra-large"]),
|
|
165
149
|
|
|
166
|
-
/** Icon color */
|
|
167
|
-
iconColor: _propTypes.default.oneOf(["default", "on-light-background", "on-dark-background", "business-color"]),
|
|
168
|
-
|
|
169
|
-
/** Override iconColor, provide any color from palette or any valid css color value. */
|
|
150
|
+
/** Icon colour, provide any color from palette or any valid css color value. */
|
|
170
151
|
color: _propTypes.default.string,
|
|
171
152
|
|
|
172
|
-
/**
|
|
153
|
+
/** Background colour, provide any color from palette or any valid css color value. */
|
|
173
154
|
bg: _propTypes.default.string,
|
|
174
155
|
|
|
175
156
|
/** Sets the icon in the disabled state */
|
|
@@ -15,13 +15,7 @@ export type FontSize =
|
|
|
15
15
|
| "large"
|
|
16
16
|
| "extra-large";
|
|
17
17
|
export type BackgroundShape = "circle" | "rounded-rect" | "square";
|
|
18
|
-
|
|
19
|
-
| "info"
|
|
20
|
-
| "error"
|
|
21
|
-
| "success"
|
|
22
|
-
| "warning"
|
|
23
|
-
| "business"
|
|
24
|
-
| "none";
|
|
18
|
+
|
|
25
19
|
export type IconType =
|
|
26
20
|
| "add"
|
|
27
21
|
| "alert"
|
|
@@ -209,11 +203,6 @@ export type IconType =
|
|
|
209
203
|
| "video"
|
|
210
204
|
| "view"
|
|
211
205
|
| "warning";
|
|
212
|
-
export type IconColor =
|
|
213
|
-
| "default"
|
|
214
|
-
| "on-light-background"
|
|
215
|
-
| "on-dark-background"
|
|
216
|
-
| "business-color";
|
|
217
206
|
|
|
218
207
|
export interface IconProps extends MarginProps {
|
|
219
208
|
/** Icon type */
|
|
@@ -222,15 +211,11 @@ export interface IconProps extends MarginProps {
|
|
|
222
211
|
bgSize?: BgSize;
|
|
223
212
|
/** Background shape */
|
|
224
213
|
bgShape?: BackgroundShape;
|
|
225
|
-
/** Background color theme */
|
|
226
|
-
bgTheme?: BackgroundTheme;
|
|
227
214
|
/** Icon font size */
|
|
228
215
|
fontSize?: FontSize;
|
|
229
|
-
/** Icon color */
|
|
230
|
-
iconColor?: IconColor;
|
|
231
|
-
/** Override iconColor, provide any color from palette or any valid css color value. */
|
|
216
|
+
/** Icon colour, provide any color from palette or any valid css color value. */
|
|
232
217
|
color?: string;
|
|
233
|
-
/**
|
|
218
|
+
/** Background colour, provide any color from palette or any valid css color value. */
|
|
234
219
|
bg?: string;
|
|
235
220
|
/** Sets the icon in the disabled state */
|
|
236
221
|
disabled?: boolean;
|
|
@@ -17,8 +17,6 @@ var _iconUnicodes = _interopRequireDefault(require("./icon-unicodes"));
|
|
|
17
17
|
|
|
18
18
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
19
19
|
|
|
20
|
-
var _palette = _interopRequireDefault(require("../../style/palette"));
|
|
21
|
-
|
|
22
20
|
var _iconConfig = _interopRequireWildcard(require("./icon-config"));
|
|
23
21
|
|
|
24
22
|
var _browserTypeCheck = _interopRequireWildcard(require("../../__internal__/utils/helpers/browser-type-check"));
|
|
@@ -31,60 +29,6 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
|
|
|
31
29
|
|
|
32
30
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
31
|
|
|
34
|
-
const getBackgroundColor = (theme, bgTheme, disabled, isHover) => {
|
|
35
|
-
if (bgTheme !== "none") {
|
|
36
|
-
if (disabled) return theme.icon.disabled;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const palette = (0, _palette.default)({
|
|
40
|
-
statusColor: theme.colors[bgTheme],
|
|
41
|
-
businessColor: theme.colors.primary
|
|
42
|
-
});
|
|
43
|
-
const statuses = ["info", "error", "success", "warning"];
|
|
44
|
-
|
|
45
|
-
if (statuses.includes(bgTheme)) {
|
|
46
|
-
return isHover ? palette.statusColorShade(20) : theme.colors[bgTheme];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (bgTheme === "business") {
|
|
50
|
-
return isHover ? palette.businessColorShade(20) : theme.colors.primary;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return "transparent";
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const getIconColor = (bgTheme, theme, iconColor, disabled, isHover) => {
|
|
57
|
-
if (disabled) return theme.icon.disabled;
|
|
58
|
-
|
|
59
|
-
if (bgTheme !== "none") {
|
|
60
|
-
const whiteIconBackgrounds = ["error", "info", "business"];
|
|
61
|
-
const darkIconBackgrounds = ["success", "warning"];
|
|
62
|
-
if (whiteIconBackgrounds.includes(bgTheme)) return theme.colors.white;
|
|
63
|
-
|
|
64
|
-
if (darkIconBackgrounds.includes(bgTheme)) {
|
|
65
|
-
return isHover ? theme.icon.defaultHover : theme.icon.default;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const palette = (0, _palette.default)({
|
|
70
|
-
businessColor: theme.colors.primary
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
switch (iconColor) {
|
|
74
|
-
case "on-dark-background":
|
|
75
|
-
return theme.colors.white;
|
|
76
|
-
|
|
77
|
-
case "on-light-background":
|
|
78
|
-
return isHover ? theme.icon.onLightBackgroundHover : theme.icon.onLightBackground;
|
|
79
|
-
|
|
80
|
-
case "business-color":
|
|
81
|
-
return isHover ? palette.businessColorShade(20) : theme.colors.primary;
|
|
82
|
-
|
|
83
|
-
default:
|
|
84
|
-
return isHover ? theme.icon.defaultHover : theme.icon.default;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
32
|
function adjustIconBgSize(fontSize, bgSize) {
|
|
89
33
|
var _replacements$fontSiz;
|
|
90
34
|
|
|
@@ -113,12 +57,10 @@ function adjustIconBgSize(fontSize, bgSize) {
|
|
|
113
57
|
|
|
114
58
|
const StyledIcon = _styledComponents.default.span`
|
|
115
59
|
${({
|
|
116
|
-
bgTheme,
|
|
117
60
|
theme,
|
|
118
61
|
color,
|
|
119
62
|
bg,
|
|
120
63
|
isInteractive,
|
|
121
|
-
iconColor,
|
|
122
64
|
bgSize,
|
|
123
65
|
bgShape,
|
|
124
66
|
type,
|
|
@@ -131,7 +73,10 @@ const StyledIcon = _styledComponents.default.span`
|
|
|
131
73
|
let bgHoverColor;
|
|
132
74
|
|
|
133
75
|
try {
|
|
134
|
-
if (
|
|
76
|
+
if (disabled) {
|
|
77
|
+
finalColor = theme.icon.disabled;
|
|
78
|
+
finalHoverColor = theme.icon.disabled;
|
|
79
|
+
} else if (color) {
|
|
135
80
|
const {
|
|
136
81
|
color: renderedColor
|
|
137
82
|
} = (0, _color.default)({
|
|
@@ -141,8 +86,8 @@ const StyledIcon = _styledComponents.default.span`
|
|
|
141
86
|
finalColor = renderedColor;
|
|
142
87
|
finalHoverColor = (0, _polished.shade)(0.2, renderedColor);
|
|
143
88
|
} else {
|
|
144
|
-
finalColor =
|
|
145
|
-
finalHoverColor =
|
|
89
|
+
finalColor = theme.icon.default;
|
|
90
|
+
finalHoverColor = theme.icon.defaultHover;
|
|
146
91
|
}
|
|
147
92
|
|
|
148
93
|
if (bg) {
|
|
@@ -154,9 +99,12 @@ const StyledIcon = _styledComponents.default.span`
|
|
|
154
99
|
});
|
|
155
100
|
bgColor = backgroundColor;
|
|
156
101
|
bgHoverColor = (0, _polished.shade)(0.2, backgroundColor);
|
|
102
|
+
} else if (disabled) {
|
|
103
|
+
bgColor = theme.icon.disabled;
|
|
104
|
+
bgHoverColor = theme.icon.disabled;
|
|
157
105
|
} else {
|
|
158
|
-
bgColor =
|
|
159
|
-
bgHoverColor =
|
|
106
|
+
bgColor = "transparent";
|
|
107
|
+
bgHoverColor = "transparent";
|
|
160
108
|
}
|
|
161
109
|
} catch (e) {
|
|
162
110
|
// eslint-disable-next-line no-console
|
|
@@ -164,11 +112,16 @@ const StyledIcon = _styledComponents.default.span`
|
|
|
164
112
|
}
|
|
165
113
|
|
|
166
114
|
return (0, _styledComponents.css)`
|
|
167
|
-
display: inline-block;
|
|
168
115
|
position: relative;
|
|
169
116
|
color: ${finalColor};
|
|
170
117
|
background-color: ${bgColor};
|
|
171
118
|
vertical-align: middle;
|
|
119
|
+
align-items: center;
|
|
120
|
+
display: inline-flex;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
height: ${adjustIconBgSize(fontSize, bgSize)};
|
|
123
|
+
width: ${adjustIconBgSize(fontSize, bgSize)};
|
|
124
|
+
border-radius: ${_iconConfig.default.backgroundShape[bgShape]};
|
|
172
125
|
|
|
173
126
|
${isInteractive && (0, _styledComponents.css)`
|
|
174
127
|
&:hover {
|
|
@@ -177,15 +130,6 @@ const StyledIcon = _styledComponents.default.span`
|
|
|
177
130
|
}
|
|
178
131
|
`}
|
|
179
132
|
|
|
180
|
-
${bgTheme !== "none" && (0, _styledComponents.css)`
|
|
181
|
-
align-items: center;
|
|
182
|
-
display: inline-flex;
|
|
183
|
-
justify-content: center;
|
|
184
|
-
height: ${adjustIconBgSize(fontSize, bgSize)};
|
|
185
|
-
width: ${adjustIconBgSize(fontSize, bgSize)};
|
|
186
|
-
border-radius: ${_iconConfig.default.backgroundShape[bgShape]};
|
|
187
|
-
`}
|
|
188
|
-
|
|
189
133
|
&::before {
|
|
190
134
|
-webkit-font-smoothing: antialiased;
|
|
191
135
|
-moz-osx-font-smoothing: grayscale;
|
|
@@ -220,9 +164,7 @@ StyledIcon.propTypes = {
|
|
|
220
164
|
disabled: _propTypes.default.bool,
|
|
221
165
|
bgSize: _propTypes.default.oneOf(["extra-small", "small", "medium", "large", "extra-large"]),
|
|
222
166
|
bgShape: _propTypes.default.oneOf(_iconConfig.ICON_SHAPES),
|
|
223
|
-
|
|
224
|
-
fontSize: _propTypes.default.oneOf(["small", "medium", "large", "extra-large"]),
|
|
225
|
-
iconColor: _propTypes.default.oneOf(_iconConfig.ICON_COLORS)
|
|
167
|
+
fontSize: _propTypes.default.oneOf(["small", "medium", "large", "extra-large"])
|
|
226
168
|
};
|
|
227
169
|
StyledIcon.defaultProps = {
|
|
228
170
|
theme: _base.default
|
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
+
var _styledComponents = require("styled-components");
|
|
11
|
+
|
|
10
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
13
|
|
|
12
14
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
@@ -17,6 +19,8 @@ var _link = require("./link.style");
|
|
|
17
19
|
|
|
18
20
|
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
19
21
|
|
|
22
|
+
var _themes = require("../../style/themes");
|
|
23
|
+
|
|
20
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
25
|
|
|
22
26
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -44,6 +48,8 @@ const Link = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
44
48
|
target,
|
|
45
49
|
...rest
|
|
46
50
|
}, ref) => {
|
|
51
|
+
const theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _themes.baseTheme;
|
|
52
|
+
|
|
47
53
|
const tabIndex = tabbable && !disabled ? "0" : "-1";
|
|
48
54
|
|
|
49
55
|
const handleOnKeyDown = ev => {
|
|
@@ -66,8 +72,8 @@ const Link = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
66
72
|
const hasProperAlignment = icon && iconAlign === currentAlignment;
|
|
67
73
|
return hasProperAlignment ? /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
68
74
|
type: icon,
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
bgSize: "extra-small",
|
|
76
|
+
color: theme.colors.primary,
|
|
71
77
|
disabled: disabled,
|
|
72
78
|
ariaLabel: ariaLabel,
|
|
73
79
|
tooltipMessage: tooltipMessage,
|
|
@@ -54,6 +54,7 @@ const StyledLink = _styledComponents.default.span`
|
|
|
54
54
|
color: ${isSkipLink ? theme.text.color : theme.colors.primary};
|
|
55
55
|
display: inline-block;
|
|
56
56
|
${_icon.default} {
|
|
57
|
+
display: inline-block;
|
|
57
58
|
position: relative;
|
|
58
59
|
vertical-align: middle;
|
|
59
60
|
${iconAlign === "left" && (0, _styledComponents.css)`
|
|
@@ -32,9 +32,7 @@ const renderCloseIcon = onDelete => /*#__PURE__*/_react.default.createElement(_i
|
|
|
32
32
|
"data-element": "close",
|
|
33
33
|
"aria-label": "close"
|
|
34
34
|
}, /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
35
|
-
type: "cross"
|
|
36
|
-
bgSize: "small",
|
|
37
|
-
bgTheme: "none"
|
|
35
|
+
type: "cross"
|
|
38
36
|
}));
|
|
39
37
|
|
|
40
38
|
const Pill = ({
|
|
@@ -7,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
+
var _styledComponents = require("styled-components");
|
|
11
|
+
|
|
10
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
13
|
|
|
12
14
|
var _propTypes2 = _interopRequireDefault(require("@styled-system/prop-types"));
|
|
@@ -29,6 +31,8 @@ var _popover = _interopRequireDefault(require("../../__internal__/popover"));
|
|
|
29
31
|
|
|
30
32
|
var _utils = require("../../style/utils");
|
|
31
33
|
|
|
34
|
+
var _themes = require("../../style/themes");
|
|
35
|
+
|
|
32
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
37
|
|
|
34
38
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
@@ -54,6 +58,8 @@ const SplitButton = ({
|
|
|
54
58
|
text,
|
|
55
59
|
...rest
|
|
56
60
|
}) => {
|
|
61
|
+
const theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _themes.baseTheme;
|
|
62
|
+
|
|
57
63
|
const isToggleButtonFocused = (0, _react.useRef)(false);
|
|
58
64
|
const buttonLabelId = (0, _react.useRef)((0, _guid.default)());
|
|
59
65
|
const additionalButtons = (0, _react.useRef)([]);
|
|
@@ -161,8 +167,8 @@ const SplitButton = ({
|
|
|
161
167
|
|
|
162
168
|
function getIconColor() {
|
|
163
169
|
const colorsMap = {
|
|
164
|
-
primary:
|
|
165
|
-
secondary:
|
|
170
|
+
primary: theme.colors.white,
|
|
171
|
+
secondary: theme.colors.primary
|
|
166
172
|
};
|
|
167
173
|
return colorsMap[buttonType || as];
|
|
168
174
|
}
|
|
@@ -180,8 +186,9 @@ const SplitButton = ({
|
|
|
180
186
|
key: "toggle-button"
|
|
181
187
|
}, toggleButtonProps()), /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
182
188
|
type: "dropdown",
|
|
183
|
-
|
|
184
|
-
|
|
189
|
+
bgSize: "extra-small",
|
|
190
|
+
color: getIconColor(),
|
|
191
|
+
bg: "transparent",
|
|
185
192
|
disabled: disabled
|
|
186
193
|
}))];
|
|
187
194
|
}
|