carbon-react 94.6.2 → 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.
Files changed (24) hide show
  1. package/lib/__internal__/checkable-input/checkable-input.component.js +1 -1
  2. package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +6 -2
  3. package/lib/__internal__/checkable-input/hidden-checkable-input.d.ts +2 -0
  4. package/lib/components/button/button.component.js +17 -8
  5. package/lib/components/button-toggle/button-toggle-icon.component.js +3 -4
  6. package/lib/components/button-toggle/button-toggle.style.js +2 -0
  7. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +7 -2
  8. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.d.ts +2 -0
  9. package/lib/components/heading/heading.style.js +1 -0
  10. package/lib/components/icon/icon-config.js +1 -5
  11. package/lib/components/icon/icon.component.js +2 -21
  12. package/lib/components/icon/icon.d.ts +3 -18
  13. package/lib/components/icon/icon.style.js +18 -76
  14. package/lib/components/link/link.component.js +8 -2
  15. package/lib/components/link/link.style.js +1 -0
  16. package/lib/components/message/type-icon/type-icon.component.js +1 -2
  17. package/lib/components/pill/pill.component.js +1 -3
  18. package/lib/components/pill/pill.style.js +2 -0
  19. package/lib/components/popover-container/popover-container.component.js +25 -7
  20. package/lib/components/popover-container/popover-container.d.ts +6 -0
  21. package/lib/components/popover-container/popover-container.style.js +2 -2
  22. package/lib/components/split-button/split-button.component.js +11 -4
  23. package/lib/style/design-tokens/theme-compatibility.util.js +14 -10
  24. package/package.json +2 -2
@@ -58,7 +58,7 @@ const CheckableInput = ({
58
58
  const {
59
59
  current: id
60
60
  } = (0, _react.useRef)(inputId || (0, _guid.default)());
61
- const labelId = `${id}-label`;
61
+ const labelId = label ? `${id}-label` : undefined;
62
62
  const helpId = [error, warning, info, labelHelp].filter(validation => typeof validation === "string").length ? `${id}-help` : undefined;
63
63
  const fieldHelpId = fieldHelp ? `${id}-field-help` : undefined;
64
64
  const isRadio = type === "radio";
@@ -32,6 +32,7 @@ const HiddenCheckableInput = ({
32
32
  inputRef,
33
33
  onChange,
34
34
  autoFocus,
35
+ ariaLabelledBy,
35
36
  ...props
36
37
  }) => {
37
38
  const {
@@ -76,7 +77,7 @@ const HiddenCheckableInput = ({
76
77
  autoFocus: autoFocus,
77
78
  "aria-checked": checked,
78
79
  checked: checked,
79
- "aria-labelledby": labelId,
80
+ "aria-labelledby": ariaLabelledBy || labelId,
80
81
  "aria-describedby": ariaDescribedBy,
81
82
  name: name,
82
83
  role: type,
@@ -135,7 +136,10 @@ HiddenCheckableInput.propTypes = {
135
136
  /** A callback to retrieve the input reference */
136
137
  inputRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
137
138
  current: _propTypes.default.instanceOf(Element)
138
- })])
139
+ })]),
140
+
141
+ /** The id of the element that labels the input */
142
+ ariaLabelledBy: _propTypes.default.string
139
143
  };
140
144
 
141
145
  var _default = /*#__PURE__*/_react.default.memo(HiddenCheckableInput);
@@ -37,6 +37,8 @@ export interface HiddenCheckableInputProps
37
37
  fieldHelpId?: string;
38
38
  /** Element id for aria-labelledby */
39
39
  labelId?: string;
40
+ /** The id of the element that labels the input */
41
+ ariaLabelledBy?: string;
40
42
  }
41
43
 
42
44
  declare function HiddenCheckableInput(
@@ -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: "on-dark-background",
44
- secondary: "business-color",
45
- tertiary: "business-color",
46
- darkBackground: "business-color"
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
- bgTheme: "none",
52
- iconColor: iconColorMap[buttonType]
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
- }, props, {
24
- bgTheme: "none"
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 {
@@ -27,7 +27,8 @@ const FlatTableCheckbox = ({
27
27
  onClick,
28
28
  leftPosition,
29
29
  cellIndex,
30
- reportCellWidth
30
+ reportCellWidth,
31
+ ariaLabelledBy
31
32
  }) => {
32
33
  const ref = (0, _react.useRef)(null);
33
34
  (0, _react.useLayoutEffect)(() => {
@@ -47,7 +48,8 @@ const FlatTableCheckbox = ({
47
48
  checked: checked,
48
49
  onChange: onChange,
49
50
  name: "flat-table-checkbox",
50
- mb: 0
51
+ mb: 0,
52
+ ariaLabelledBy: ariaLabelledBy
51
53
  }));
52
54
  };
53
55
 
@@ -67,6 +69,9 @@ FlatTableCheckbox.propTypes = {
67
69
  /** Whether to render the checkbox or not, defaults to true */
68
70
  selectable: _propTypes.default.bool,
69
71
 
72
+ /** The id of the element that labels the input */
73
+ ariaLabelledBy: _propTypes.default.string,
74
+
70
75
  /**
71
76
  * @private
72
77
  * @ignore
@@ -11,6 +11,8 @@ export interface FlatTableCheckboxProps {
11
11
  selectable?: boolean;
12
12
  /** Callback function to be called when click event received */
13
13
  onClick?: (ev: React.MouseEvent<HTMLElement>) => void;
14
+ /** The id of the element that labels the input */
15
+ ariaLabelledBy?: string;
14
16
  }
15
17
 
16
18
  declare function FlatTableCheckbox(props: FlatTableCheckboxProps): JSX.Element;
@@ -85,6 +85,7 @@ const StyledHeadingBackButton = (0, _styledComponents.default)(_link.default)`
85
85
 
86
86
  ${_icon2.default} {
87
87
  margin-right: 0;
88
+ display: inline-flex;
88
89
  }
89
90
  }
90
91
  `;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = exports.ICONS = exports.ICON_COLORS = exports.ICON_BACKGROUNDS = exports.ICON_SIZES = exports.ICON_SHAPES = exports.ICON_TOOLTIP_POSITIONS = void 0;
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
- /** Override bgTheme, provide any color from palette or any valid css color value. */
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
- export type BackgroundTheme =
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
- /** Override bgTheme, provide any color from palette or any valid css color value. */
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 (color) {
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 = getIconColor(bgTheme, theme, iconColor, disabled, false);
145
- finalHoverColor = getIconColor(bgTheme, theme, iconColor, disabled, true);
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 = getBackgroundColor(theme, bgTheme, disabled, false);
159
- bgHoverColor = getBackgroundColor(theme, bgTheme, disabled, true);
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
- bgTheme: _propTypes.default.oneOf([..._iconConfig.ICON_COLORS, ..._iconConfig.ICON_BACKGROUNDS, ""]),
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
- bgTheme: "none",
70
- iconColor: "business-color",
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)`
@@ -23,8 +23,7 @@ const TypeIcon = ({
23
23
  variant: variant,
24
24
  transparent: transparent
25
25
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
26
- type: variant,
27
- bgTheme: "none"
26
+ type: variant
28
27
  }));
29
28
  };
30
29
 
@@ -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 = ({
@@ -173,6 +173,8 @@ const PillStyle = _styledComponents.default.span`
173
173
  ${_icon.default} {
174
174
  font-size: 12px;
175
175
  padding: 0 4px;
176
+ height: unset;
177
+ width: unset;
176
178
 
177
179
  &:hover,
178
180
  &:focus {
@@ -42,6 +42,9 @@ const PopoverContainer = ({
42
42
  renderCloseComponent,
43
43
  shouldCoverButton,
44
44
  ariaDescribedBy,
45
+ openButtonAriaLabel,
46
+ closeButtonAriaLabel = "close",
47
+ containerAriaLabel,
45
48
  ...rest
46
49
  }) => {
47
50
  const isControlled = open !== undefined;
@@ -49,7 +52,7 @@ const PopoverContainer = ({
49
52
  const closeButtonRef = (0, _react.useRef)();
50
53
  const openButtonRef = (0, _react.useRef)();
51
54
  const guid = (0, _react.useRef)((0, _guid.default)());
52
- const popoverContainerId = `PopoverContainer_${guid.current}`;
55
+ const popoverContainerId = title ? `PopoverContainer_${guid.current}` : undefined;
53
56
  const isOpen = isControlled ? open : isOpenInternal;
54
57
  (0, _react.useEffect)(() => {
55
58
  if (isOpen && closeButtonRef.current) closeButtonRef.current.focus();
@@ -75,18 +78,19 @@ const PopoverContainer = ({
75
78
  dataElement: "popover-container-open-component",
76
79
  onClick: handleOpenButtonClick,
77
80
  ref: openButtonRef,
78
- ariaLabel: title
81
+ ariaLabel: openButtonAriaLabel || title
79
82
  };
80
83
  const renderCloseComponentProps = {
81
84
  dataElement: "popover-container-close-component",
82
85
  tabIndex: 0,
83
86
  onClick: handleCloseButtonClick,
84
87
  ref: closeButtonRef,
85
- ariaLabel: "close"
88
+ ariaLabel: closeButtonAriaLabel
86
89
  };
87
90
  return /*#__PURE__*/_react.default.createElement(_popoverContainer.PopoverContainerWrapperStyle, {
88
91
  "data-component": "popover-container",
89
- "aria-labelledby": popoverContainerId
92
+ role: "region",
93
+ "aria-labelledby": isOpen ? popoverContainerId : undefined
90
94
  }, renderOpenComponent(renderOpenComponentProps), /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.Transition, {
91
95
  in: isOpen,
92
96
  timeout: {
@@ -102,6 +106,7 @@ const PopoverContainer = ({
102
106
  position: position,
103
107
  shouldCoverButton: shouldCoverButton,
104
108
  "aria-labelledby": popoverContainerId,
109
+ "aria-label": containerAriaLabel,
105
110
  "aria-describedby": ariaDescribedBy,
106
111
  p: "16px 24px"
107
112
  }, (0, _utils.filterStyledSystemPaddingProps)(rest)), /*#__PURE__*/_react.default.createElement(_popoverContainer.PopoverContainerHeaderStyle, null, /*#__PURE__*/_react.default.createElement(_popoverContainer.PopoverContainerTitleStyle, {
@@ -148,18 +153,29 @@ PopoverContainer.propTypes = { ...paddingPropTypes,
148
153
  children: _propTypes.default.node,
149
154
 
150
155
  /** The id of the element that describes the dialog */
151
- ariaDescribedBy: _propTypes.default.string
156
+ ariaDescribedBy: _propTypes.default.string,
157
+
158
+ /** Open button aria label */
159
+ openButtonAriaLabel: _propTypes.default.string,
160
+
161
+ /** Close button aria label */
162
+ closeButtonAriaLabel: _propTypes.default.string,
163
+
164
+ /** Container aria label */
165
+ containerAriaLabel: _propTypes.default.string
152
166
  };
153
167
  PopoverContainer.defaultProps = {
154
168
  position: "right",
155
169
  shouldCoverButton: false,
156
170
  renderOpenComponent: ({
157
- // eslint-disable-next-line react/prop-types
171
+ /* eslint-disable react/prop-types */
158
172
  tabIndex,
159
173
  onClick,
160
174
  dataElement,
161
175
  ref,
162
176
  ariaLabel
177
+ /* eslint-enable react/prop-types */
178
+
163
179
  }) => /*#__PURE__*/_react.default.createElement(_popoverContainer.PopoverContainerOpenIcon, {
164
180
  tabIndex: tabIndex,
165
181
  onAction: onClick,
@@ -171,12 +187,14 @@ PopoverContainer.defaultProps = {
171
187
  type: "settings"
172
188
  })),
173
189
  renderCloseComponent: ({
174
- // eslint-disable-next-line react/prop-types
190
+ /* eslint-disable react/prop-types */
175
191
  dataElement,
176
192
  tabIndex,
177
193
  onClick,
178
194
  ref,
179
195
  ariaLabel
196
+ /* eslint-enable react/prop-types */
197
+
180
198
  }) => /*#__PURE__*/_react.default.createElement(_popoverContainer.PopoverContainerCloseIcon, {
181
199
  "data-element": dataElement,
182
200
  tabIndex: tabIndex,
@@ -22,6 +22,12 @@ export interface PopoverContainerProps extends PaddingProps {
22
22
  shouldCoverButton?: boolean;
23
23
  /** The id of the element that describe the dialog. */
24
24
  ariaDescribedBy?: string;
25
+ /** Open button aria label */
26
+ openButtonAriaLabel?: string;
27
+ /** Close button aria label */
28
+ closeButtonAriaLabel?: string;
29
+ /** Container aria label */
30
+ containerAriaLabel?: string;
25
31
  }
26
32
 
27
33
  declare function PopoverContainer(props: PopoverContainerProps): JSX.Element;
@@ -27,7 +27,7 @@ const PopoverContainerIcon = (0, _styledComponents.default)(_iconButton.default)
27
27
  color: ${({
28
28
  theme
29
29
  }) => theme.popoverContainer.iconColor};
30
- } ;
30
+ }
31
31
  `;
32
32
  exports.PopoverContainerIcon = PopoverContainerIcon;
33
33
  const PopoverContainerHeaderStyle = _styledComponents.default.div`
@@ -107,7 +107,7 @@ const PopoverContainerCloseIcon = (0, _styledComponents.default)(_iconButton.def
107
107
  color: ${({
108
108
  theme
109
109
  }) => theme.popoverContainer.iconColor};
110
- } ;
110
+ }
111
111
  `;
112
112
  exports.PopoverContainerCloseIcon = PopoverContainerCloseIcon;
113
113
  const PopoverContainerTitleStyle = _styledComponents.default.div`
@@ -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: "on-dark-background",
165
- secondary: "business-color"
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
- bgTheme: "none",
184
- iconColor: getIconColor(),
189
+ bgSize: "extra-small",
190
+ color: getIconColor(),
191
+ bg: "transparent",
185
192
  disabled: disabled
186
193
  }))];
187
194
  }
@@ -23,6 +23,10 @@ var _default = theme => ({ ...theme,
23
23
  metaName: "Base Theme",
24
24
  metaPublic: "true",
25
25
  colorsLogo: "#00D639",
26
+ colorsYin030: "rgba(0,0,0,0.3)",
27
+ colorsYin055: "rgba(0,0,0,0.55)",
28
+ colorsYin065: "rgba(0,0,0,0.65)",
29
+ colorsYin090: "rgba(0,0,0,0.9)",
26
30
  colorsComponentsNavigation500: "#008146",
27
31
  colorsComponentsNavigation600: "#006738",
28
32
  colorsComponentsNavigation700: "#004D2A",
@@ -126,31 +130,31 @@ var _default = theme => ({ ...theme,
126
130
  sizing050: "4px",
127
131
  sizing075: "6px",
128
132
  sizingLogowidth: "40px",
129
- spacing000: theme.space[0],
133
+ spacing000: `${theme.space[0]}px`,
130
134
  // 0px
131
135
  spacing025: "2px",
132
136
  spacing050: "4px",
133
137
  spacing075: "6px",
134
- spacing100: theme.space[1],
138
+ spacing100: `${theme.space[1]}px`,
135
139
  // 8px
136
140
  spacing125: "10px",
137
141
  spacing150: "12px",
138
- spacing200: theme.space[2],
142
+ spacing200: `${theme.space[2]}px`,
139
143
  // 16px
140
144
  spacing250: "20px",
141
- spacing300: theme.space[3],
145
+ spacing300: `${theme.space[3]}px`,
142
146
  // 24px
143
- spacing400: theme.space[4],
147
+ spacing400: `${theme.space[4]}px`,
144
148
  // 32px
145
- spacing500: theme.space[5],
149
+ spacing500: `${theme.space[5]}px`,
146
150
  // 40px
147
- spacing600: theme.space[6],
151
+ spacing600: `${theme.space[6]}px`,
148
152
  // 48px
149
- spacing700: theme.space[7],
153
+ spacing700: `${theme.space[7]}px`,
150
154
  // 56px
151
- spacing800: theme.space[8],
155
+ spacing800: `${theme.space[8]}px`,
152
156
  // 64px
153
- spacing900: theme.space[9],
157
+ spacing900: `${theme.space[9]}px`,
154
158
  // 72px
155
159
  borderWidth100: "1px",
156
160
  borderWidth200: "2px",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "94.6.2",
3
+ "version": "95.0.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {
@@ -133,7 +133,7 @@
133
133
  },
134
134
  "dependencies": {
135
135
  "@popperjs/core": "^2.9.0",
136
- "@sage/design-tokens": "^1.65.0",
136
+ "@sage/design-tokens": "^1.73.0",
137
137
  "@styled-system/prop-types": "^5.1.5",
138
138
  "@tippyjs/react": "^4.2.5",
139
139
  "classnames": "~2.2.6",