carbon-react 104.50.0 → 104.52.1

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 (51) hide show
  1. package/esm/components/button/button.component.js +4 -4
  2. package/esm/components/dismissible-box/dismissible-box.component.js +2 -2
  3. package/esm/components/flat-table/flat-table-body/flat-table-body.component.js +6 -3
  4. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.d.ts +2 -1
  5. package/esm/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +4 -3
  6. package/esm/components/flat-table/flat-table-cell/flat-table-cell.component.js +1 -1
  7. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.d.ts +2 -1
  8. package/esm/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +6 -3
  9. package/esm/components/flat-table/flat-table-head/flat-table-head.component.d.ts +2 -1
  10. package/esm/components/flat-table/flat-table-head/flat-table-head.component.js +4 -3
  11. package/esm/components/flat-table/flat-table-row/flat-table-row.component.js +5 -4
  12. package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +1 -1
  13. package/esm/components/icon/icon.component.js +4 -4
  14. package/esm/components/icon/icon.style.js +3 -5
  15. package/esm/components/link/link.component.js +2 -5
  16. package/esm/components/pill/pill.component.js +1 -1
  17. package/esm/components/pill/pill.style.js +3 -2
  18. package/esm/components/portrait/portrait.component.js +2 -2
  19. package/esm/components/select/filterable-select/filterable-select.component.js +5 -3
  20. package/esm/components/select/select-textbox/select-textbox.component.d.ts +3 -3
  21. package/esm/components/select/select-textbox/select-textbox.component.js +6 -3
  22. package/esm/components/tooltip/tooltip.component.js +2 -2
  23. package/esm/style/utils/color.js +5 -0
  24. package/esm/style/utils/get-color-value.d.ts +2 -0
  25. package/esm/style/utils/get-color-value.js +8 -0
  26. package/lib/components/button/button.component.js +4 -4
  27. package/lib/components/dismissible-box/dismissible-box.component.js +2 -2
  28. package/lib/components/flat-table/flat-table-body/flat-table-body.component.js +6 -3
  29. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.d.ts +2 -1
  30. package/lib/components/flat-table/flat-table-body-draggable/flat-table-body-draggable.component.js +4 -3
  31. package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.js +1 -1
  32. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.d.ts +2 -1
  33. package/lib/components/flat-table/flat-table-checkbox/flat-table-checkbox.component.js +6 -3
  34. package/lib/components/flat-table/flat-table-head/flat-table-head.component.d.ts +2 -1
  35. package/lib/components/flat-table/flat-table-head/flat-table-head.component.js +4 -3
  36. package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +5 -4
  37. package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +1 -1
  38. package/lib/components/icon/icon.component.js +4 -4
  39. package/lib/components/icon/icon.style.js +4 -5
  40. package/lib/components/link/link.component.js +1 -8
  41. package/lib/components/pill/pill.component.js +1 -1
  42. package/lib/components/pill/pill.style.js +4 -2
  43. package/lib/components/portrait/portrait.component.js +2 -2
  44. package/lib/components/select/filterable-select/filterable-select.component.js +5 -3
  45. package/lib/components/select/select-textbox/select-textbox.component.d.ts +3 -3
  46. package/lib/components/select/select-textbox/select-textbox.component.js +6 -3
  47. package/lib/components/tooltip/tooltip.component.js +2 -2
  48. package/lib/style/utils/color.js +8 -0
  49. package/lib/style/utils/get-color-value.d.ts +2 -0
  50. package/lib/style/utils/get-color-value.js +20 -0
  51. package/package.json +1 -1
@@ -24,10 +24,10 @@ function renderChildren({
24
24
 
25
25
  }) {
26
26
  const iconColorMap = {
27
- primary: "var(--colorsActionMajorYang100)",
28
- secondary: "var(--colorsActionMajor500)",
29
- tertiary: "var(--colorsActionMajor500)",
30
- darkBackground: "var(--colorsActionMajor500)"
27
+ primary: "--colorsActionMajorYang100",
28
+ secondary: "--colorsActionMajor500",
29
+ tertiary: "--colorsActionMajor500",
30
+ darkBackground: "--colorsActionMajor500"
31
31
  };
32
32
  const iconProps = {
33
33
  "aria-hidden": true,
@@ -11,7 +11,7 @@ const variantStyles = {
11
11
  backgroundColor: "#FFFFFF"
12
12
  },
13
13
  dark: {
14
- backgroundColor: "var(--colorsUtilityMajor050)"
14
+ backgroundColor: "--colorsUtilityMajor050"
15
15
  }
16
16
  };
17
17
 
@@ -34,7 +34,7 @@ const DismissibleBox = ({
34
34
  ml: 3
35
35
  }, /*#__PURE__*/React.createElement(Icon, {
36
36
  type: "close",
37
- color: "var(--colorsActionMinor500)"
37
+ color: "--colorsActionMinor500"
38
38
  }))));
39
39
 
40
40
  DismissibleBox.propTypes = { ...propTypes.space,
@@ -1,11 +1,14 @@
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
+
1
3
  import React from "react";
2
4
  import PropTypes from "prop-types";
3
5
  const FlatTableBody = /*#__PURE__*/React.forwardRef(({
4
- children
6
+ children,
7
+ ...rest
5
8
  }, ref) => {
6
- return /*#__PURE__*/React.createElement("tbody", {
9
+ return /*#__PURE__*/React.createElement("tbody", _extends({
7
10
  ref: ref
8
- }, children);
11
+ }, rest), children);
9
12
  });
10
13
  FlatTableBody.propTypes = {
11
14
  /** Array of FlatTableRow. */
@@ -1,5 +1,6 @@
1
1
  export default FlatTableBodyDraggable;
2
- declare function FlatTableBodyDraggable({ children, getOrder }: {
2
+ declare function FlatTableBodyDraggable({ children, getOrder, ...rest }: {
3
+ [x: string]: any;
3
4
  children: any;
4
5
  getOrder: any;
5
6
  }): JSX.Element;
@@ -33,7 +33,8 @@ DropTarget.propTypes = {
33
33
 
34
34
  const FlatTableBodyDraggable = ({
35
35
  children,
36
- getOrder
36
+ getOrder,
37
+ ...rest
37
38
  }) => {
38
39
  const [draggableItems, setDraggableItems] = useState(React.Children.toArray(children));
39
40
  const isFirstRender = useRef(true);
@@ -76,9 +77,9 @@ const FlatTableBodyDraggable = ({
76
77
 
77
78
  return /*#__PURE__*/React.createElement(DndProvider, {
78
79
  backend: HTML5Backend
79
- }, /*#__PURE__*/React.createElement(DropTarget, {
80
+ }, /*#__PURE__*/React.createElement(DropTarget, _extends({
80
81
  getOrder: getItemsId
81
- }, draggableItems.map(item => /*#__PURE__*/React.cloneElement(item, {
82
+ }, rest), draggableItems.map(item => /*#__PURE__*/React.cloneElement(item, {
82
83
  id: `${item.props.id}`,
83
84
  moveItem,
84
85
  findItem,
@@ -121,7 +121,7 @@ FlatTableCell.propTypes = {
121
121
  /** Sets a custom vertical right border */
122
122
  verticalBorder: PropTypes.oneOf(["small", "medium", "large"]),
123
123
 
124
- /** Sets a custom vertical right border */
124
+ /** Sets a vertical right border color, provide design token, any color from palette or any valid css color value. */
125
125
  verticalBorderColor: PropTypes.string
126
126
  };
127
127
  export default FlatTableCell;
@@ -1,5 +1,6 @@
1
1
  export default FlatTableCheckbox;
2
- declare function FlatTableCheckbox({ as, checked, onChange, selectable, onClick, leftPosition, cellIndex, reportCellWidth, ariaLabelledBy, }: {
2
+ declare function FlatTableCheckbox({ as, checked, onChange, selectable, onClick, leftPosition, cellIndex, reportCellWidth, ariaLabelledBy, ...rest }: {
3
+ [x: string]: any;
3
4
  as?: string | undefined;
4
5
  checked: any;
5
6
  onChange: any;
@@ -1,3 +1,5 @@
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
+
1
3
  import React, { useLayoutEffect, useRef } from "react";
2
4
  import PropTypes from "prop-types";
3
5
  import StyledFlatTableCheckbox from "./flat-table-checkbox.style";
@@ -12,7 +14,8 @@ const FlatTableCheckbox = ({
12
14
  leftPosition,
13
15
  cellIndex,
14
16
  reportCellWidth,
15
- ariaLabelledBy
17
+ ariaLabelledBy,
18
+ ...rest
16
19
  }) => {
17
20
  const ref = useRef(null);
18
21
  useLayoutEffect(() => {
@@ -31,13 +34,13 @@ const FlatTableCheckbox = ({
31
34
  event.stopPropagation();
32
35
  };
33
36
 
34
- return /*#__PURE__*/React.createElement(StyledFlatTableCheckbox, {
37
+ return /*#__PURE__*/React.createElement(StyledFlatTableCheckbox, _extends({
35
38
  ref: ref,
36
39
  makeCellSticky: !!reportCellWidth,
37
40
  leftPosition: leftPosition || 0,
38
41
  "data-element": dataElement,
39
42
  as: as
40
- }, selectable && /*#__PURE__*/React.createElement(Checkbox, {
43
+ }, rest), selectable && /*#__PURE__*/React.createElement(Checkbox, {
41
44
  checked: checked,
42
45
  onChange: onChange,
43
46
  name: "flat-table-checkbox",
@@ -1,5 +1,6 @@
1
1
  export default FlatTableHead;
2
- declare function FlatTableHead({ children }: {
2
+ declare function FlatTableHead({ children, ...rest }: {
3
+ [x: string]: any;
3
4
  children: any;
4
5
  }): JSX.Element;
5
6
  declare namespace FlatTableHead {
@@ -8,7 +8,8 @@ const getRefs = length => Array.from({
8
8
  }, () => /*#__PURE__*/React.createRef());
9
9
 
10
10
  const FlatTableHead = ({
11
- children
11
+ children,
12
+ ...rest
12
13
  }) => {
13
14
  const [rowHeights, setRowHeights] = useState([]);
14
15
  const refs = getRefs(React.Children.count(children));
@@ -21,10 +22,10 @@ const FlatTableHead = ({
21
22
  }, []);
22
23
 
23
24
  if (React.Children.count(children) === 1) {
24
- return /*#__PURE__*/React.createElement(StyledFlatTableHead, null, children);
25
+ return /*#__PURE__*/React.createElement(StyledFlatTableHead, rest, children);
25
26
  }
26
27
 
27
- return /*#__PURE__*/React.createElement(StyledFlatTableHead, null, React.Children.map(children, (child, index) => {
28
+ return /*#__PURE__*/React.createElement(StyledFlatTableHead, rest, React.Children.map(children, (child, index) => {
28
29
  /* Applies left border if preceding row has a FlatTableRowHeader and current one does not.
29
30
  This is only needed when the preceding row has rowSpans applied,
30
31
  as in any other use case the rows will all have FlatTableRowHeaders */
@@ -28,7 +28,8 @@ const FlatTableRow = /*#__PURE__*/React.forwardRef(({
28
28
  id,
29
29
  draggable,
30
30
  findItem,
31
- moveItem
31
+ moveItem,
32
+ ...rest
32
33
  }, ref) => {
33
34
  const [isExpanded, setIsExpanded] = useState(expanded);
34
35
  let rowRef = useRef();
@@ -127,7 +128,7 @@ const FlatTableRow = /*#__PURE__*/React.forwardRef(({
127
128
  horizontalBorderSize: horizontalBorderSize,
128
129
  applyBorderLeft: applyBorderLeft,
129
130
  draggable: draggable
130
- }, interactiveRowProps), React.Children.map(children, (child, index) => {
131
+ }, interactiveRowProps, rest), React.Children.map(children, (child, index) => {
131
132
  return child && /*#__PURE__*/React.cloneElement(child, {
132
133
  expandable: expandable && index === firstCellIndex(),
133
134
  onClick: expandable && index === firstCellIndex() && firstColumnExpandable ? () => toggleExpanded() : undefined,
@@ -154,7 +155,7 @@ const FlatTableRow = /*#__PURE__*/React.forwardRef(({
154
155
  }))));
155
156
  });
156
157
  FlatTableRow.propTypes = {
157
- /** Overrides default cell color */
158
+ /** Overrides default cell color, provide design token, any color from palette or any valid css color value. */
158
159
  bgColor: PropTypes.string,
159
160
 
160
161
  /** Array of FlatTableHeader or FlatTableCell. FlatTableRowHeader could also be passed. */
@@ -181,7 +182,7 @@ FlatTableRow.propTypes = {
181
182
  /** Sets an expandable row to be expanded on start */
182
183
  expanded: PropTypes.bool,
183
184
 
184
- /** Sets the color of the bottom border in the row */
185
+ /** Sets the color of the bottom border in the row, provide design token, any color from palette or any valid css color value. */
185
186
  horizontalBorderColor: PropTypes.string,
186
187
 
187
188
  /** Sets the weight of the bottom border in the row */
@@ -82,7 +82,7 @@ FlatTableRowHeader.propTypes = {
82
82
  /** Sets a custom vertical right border */
83
83
  verticalBorder: PropTypes.oneOf(["small", "medium", "large"]),
84
84
 
85
- /** Sets a custom vertical right border */
85
+ /** Sets a vertical right border color, provide design token, any color from palette or any valid css color value. */
86
86
  verticalBorderColor: PropTypes.string
87
87
  };
88
88
  export default FlatTableRowHeader;
@@ -140,10 +140,10 @@ Icon.propTypes = { ...marginPropTypes,
140
140
  /** Icon font size */
141
141
  fontSize: PropTypes.oneOf(["small", "medium", "large", "extra-large"]),
142
142
 
143
- /** Icon colour, provide any color from palette or any valid css color value. */
143
+ /** Icon colour, provide design token, any color from palette or any valid css color value. */
144
144
  color: PropTypes.string,
145
145
 
146
- /** Background colour, provide any color from palette or any valid css color value. */
146
+ /** Background colour, provide design token, any color from palette, or any valid css color value. */
147
147
  bg: PropTypes.string,
148
148
 
149
149
  /** Sets the icon in the disabled state */
@@ -164,10 +164,10 @@ Icon.propTypes = { ...marginPropTypes,
164
164
  /** Control whether the tooltip is visible */
165
165
  tooltipVisible: PropTypes.bool,
166
166
 
167
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
167
+ /** Override background color of the Tooltip, provide design token, any color from palette or any valid css color value. */
168
168
  tooltipBgColor: PropTypes.string,
169
169
 
170
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
170
+ /** Override font color of the Tooltip, provide design token, any color from palette or any valid css color value. */
171
171
  tooltipFontColor: PropTypes.string,
172
172
 
173
173
  /** Id passed to the tooltip container, used for accessibility purposes. */
@@ -7,6 +7,7 @@ import baseTheme from "../../style/themes/base";
7
7
  import iconSizeConfig, { ICON_SHAPES } from "./icon-config";
8
8
  import browserTypeCheck, { isSafari } from "../../__internal__/utils/helpers/browser-type-check";
9
9
  import styledColor from "../../style/utils/color";
10
+ import getColorValue from "../../style/utils/get-color-value";
10
11
 
11
12
  function adjustIconBgSize(fontSize, bgSize) {
12
13
  var _replacements$fontSiz;
@@ -56,9 +57,6 @@ const StyledIcon = styled.span`
56
57
  if (disabled) {
57
58
  finalColor = "var(--colorsYin030)";
58
59
  finalHoverColor = "var(--colorsYin030)";
59
- } else if (typeof color === "string" && color.startsWith("var")) {
60
- finalColor = color;
61
- finalHoverColor = shade(0.2, theme.compatibility[color.replace("var(--", "").replace(")", "")]);
62
60
  } else if (color) {
63
61
  const {
64
62
  color: renderedColor
@@ -67,7 +65,7 @@ const StyledIcon = styled.span`
67
65
  theme
68
66
  });
69
67
  finalColor = renderedColor;
70
- finalHoverColor = shade(0.2, renderedColor);
68
+ finalHoverColor = shade(0.2, getColorValue(renderedColor));
71
69
  } else {
72
70
  finalColor = "var(--colorsYin090)";
73
71
  finalHoverColor = "var(--colorsYin090)";
@@ -81,7 +79,7 @@ const StyledIcon = styled.span`
81
79
  theme
82
80
  });
83
81
  bgColor = backgroundColor;
84
- bgHoverColor = shade(0.2, backgroundColor);
82
+ bgHoverColor = shade(0.2, getColorValue(backgroundColor));
85
83
  } else {
86
84
  bgColor = "transparent";
87
85
  bgHoverColor = "transparent";
@@ -1,13 +1,11 @@
1
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
2
 
3
- import React, { useContext, useMemo } from "react";
4
- import { ThemeContext } from "styled-components";
3
+ import React, { useMemo } from "react";
5
4
  import PropTypes from "prop-types";
6
5
  import Icon from "../icon";
7
6
  import Event from "../../__internal__/utils/helpers/events";
8
7
  import { StyledLink, StyledContent } from "./link.style";
9
8
  import tagComponent from "../../__internal__/utils/helpers/tags/tags";
10
- import { baseTheme } from "../../style/themes";
11
9
  import useLocale from "../../hooks/__internal__/useLocale";
12
10
  const Link = /*#__PURE__*/React.forwardRef(({
13
11
  children,
@@ -29,7 +27,6 @@ const Link = /*#__PURE__*/React.forwardRef(({
29
27
  ...rest
30
28
  }, ref) => {
31
29
  const l = useLocale();
32
- const theme = useContext(ThemeContext) || baseTheme;
33
30
  const tabIndex = tabbable && !disabled ? "0" : "-1";
34
31
 
35
32
  const handleOnKeyDown = ev => {
@@ -53,7 +50,7 @@ const Link = /*#__PURE__*/React.forwardRef(({
53
50
  return hasProperAlignment ? /*#__PURE__*/React.createElement(Icon, {
54
51
  type: icon,
55
52
  bgSize: "extra-small",
56
- color: theme.colors.primary,
53
+ color: "--colorsActionMajor500",
57
54
  disabled: disabled,
58
55
  ariaLabel: ariaLabel,
59
56
  tooltipMessage: tooltipMessage,
@@ -45,7 +45,7 @@ Pill.propTypes = {
45
45
  /** Change the color of a status pill. */
46
46
  colorVariant: PropTypes.oneOf(["neutral", "negative", "positive", "warning"]),
47
47
 
48
- /** Override color variant, provide any color from palette or any valid css color value. */
48
+ /** Override color variant, provide design token, any color from palette or any valid css color value. */
49
49
  borderColor: PropTypes.string,
50
50
 
51
51
  /** The content to display inside of the pill. */
@@ -6,6 +6,7 @@ import styleConfig from "./pill.style.config";
6
6
  import { baseTheme } from "../../style/themes";
7
7
  import StyledIcon from "../icon/icon.style";
8
8
  import { toColor } from "../../style/utils/color.js";
9
+ import getColorValue from "../../style/utils/get-color-value";
9
10
 
10
11
  function addStyleToPillIcon(fontSize) {
11
12
  return `
@@ -37,8 +38,8 @@ const PillStyle = styled.span`
37
38
  try {
38
39
  if (borderColor) {
39
40
  pillColor = toColor(theme, borderColor);
40
- buttonFocusColor = shade(0.2, pillColor);
41
- contentColor = meetsContrastGuidelines(pillColor, theme.compatibility.colorsUtilityYin090).AAA ? "var(--colorsUtilityYin090)" : "var(--colorsUtilityYang100)";
41
+ buttonFocusColor = shade(0.2, getColorValue(pillColor));
42
+ contentColor = meetsContrastGuidelines(getColorValue(pillColor), theme.compatibility.colorsUtilityYin090).AAA ? "var(--colorsUtilityYin090)" : "var(--colorsUtilityYang100)";
42
43
  } else {
43
44
  const {
44
45
  varietyColor,
@@ -152,10 +152,10 @@ Portrait.propTypes = { ...marginPropTypes,
152
152
  /** Defines the size of the tooltip content */
153
153
  tooltipSize: PropTypes.oneOf(["medium", "large"]),
154
154
 
155
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
155
+ /** Override background color of the Tooltip, provide design token, any color from palette or any valid css color value. */
156
156
  tooltipBgColor: PropTypes.string,
157
157
 
158
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
158
+ /** Override font color of the Tooltip, provide design token, any color from palette or any valid css color value. */
159
159
  tooltipFontColor: PropTypes.string
160
160
  };
161
161
  Portrait.defaultProps = {
@@ -16,6 +16,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
16
16
  defaultValue,
17
17
  id,
18
18
  name,
19
+ label,
19
20
  children,
20
21
  onOpen,
21
22
  onChange,
@@ -45,7 +46,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
45
46
  }, inputRef) => {
46
47
  const [activeDescendantId, setActiveDescendantId] = useState();
47
48
  const selectListId = useRef(guid());
48
- const labelId = useRef(guid());
49
+ const labelId = useRef(label ? guid() : undefined);
49
50
  const containerRef = useRef();
50
51
  const listboxRef = useRef();
51
52
  const isControlled = useRef(value !== undefined);
@@ -366,6 +367,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
366
367
  return {
367
368
  id,
368
369
  name,
370
+ label,
369
371
  disabled,
370
372
  readOnly,
371
373
  inputRef: assignInput,
@@ -391,7 +393,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
391
393
  const selectList = /*#__PURE__*/React.createElement(FilterableSelectList, {
392
394
  ref: listboxRef,
393
395
  id: selectListId.current,
394
- labelId: labelId.current,
396
+ labelId: label ? labelId.current : undefined,
395
397
  anchorElement: textboxRef && textboxRef.parentElement,
396
398
  onSelect: onSelectOption,
397
399
  onSelectListClose: onSelectListClose,
@@ -426,10 +428,10 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
426
428
  ref: containerRef
427
429
  }, /*#__PURE__*/React.createElement(SelectTextbox, _extends({
428
430
  activeDescendantId: activeDescendantId,
431
+ labelId: label ? labelId.current : undefined,
429
432
  "aria-controls": isOpen ? selectListId.current : undefined,
430
433
  isOpen: isOpen,
431
434
  hasTextCursor: true,
432
- labelId: labelId.current,
433
435
  textboxRef: textboxRef
434
436
  }, getTextboxProps()))), isOpen && selectList);
435
437
  });
@@ -1,14 +1,14 @@
1
1
  export default SelectTextbox;
2
- declare function SelectTextbox({ accessibilityLabelId, "aria-controls": ariaControls, value, disabled, isOpen, readOnly, placeholder, labelId, size, onClick, onFocus, onBlur, onChange, selectedValue, required, textboxRef, hasTextCursor, transparent, activeDescendantId, ...restProps }: {
2
+ declare function SelectTextbox({ accessibilityLabelId, labelId, "aria-controls": ariaControls, value, disabled, isOpen, readOnly, placeholder, size, onClick, onFocus, onBlur, onChange, selectedValue, required, textboxRef, hasTextCursor, transparent, activeDescendantId, ...restProps }: {
3
3
  [x: string]: any;
4
- accessibilityLabelId?: string | undefined;
4
+ accessibilityLabelId: any;
5
+ labelId: any;
5
6
  "aria-controls": any;
6
7
  value: any;
7
8
  disabled: any;
8
9
  isOpen: any;
9
10
  readOnly: any;
10
11
  placeholder: any;
11
- labelId: any;
12
12
  size: any;
13
13
  onClick: any;
14
14
  onFocus: any;
@@ -45,14 +45,14 @@ const modifiers = [{
45
45
  }];
46
46
 
47
47
  const SelectTextbox = ({
48
- accessibilityLabelId = "",
48
+ accessibilityLabelId,
49
+ labelId,
49
50
  "aria-controls": ariaControls,
50
51
  value,
51
52
  disabled,
52
53
  isOpen,
53
54
  readOnly,
54
55
  placeholder,
55
- labelId,
56
56
  size,
57
57
  onClick,
58
58
  onFocus,
@@ -133,9 +133,12 @@ const SelectTextbox = ({
133
133
  }
134
134
 
135
135
  function getInputAriaAttributes() {
136
+ const joinIds = (...ids) => ids.filter(item => item !== undefined).join(" ");
137
+
138
+ const ariaLabelledby = hasTextCursor ? joinIds(labelId, accessibilityLabelId) : joinIds(labelId, textId.current);
136
139
  return {
137
140
  "aria-expanded": isOpen,
138
- "aria-labelledby": hasTextCursor ? `${labelId} ${accessibilityLabelId}` : `${labelId} ${textId.current}`,
141
+ "aria-labelledby": ariaLabelledby || undefined,
139
142
  "aria-activedescendant": activeDescendantId,
140
143
  "aria-controls": ariaControls,
141
144
  "aria-autocomplete": hasTextCursor ? "both" : undefined,
@@ -102,10 +102,10 @@ Tooltip.propTypes = {
102
102
  // Reference element, tooltip will be positioned in relation to this element
103
103
  target: PropTypes.instanceOf(Element),
104
104
 
105
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
105
+ /** Override background color of the Tooltip, provide design token, any color from palette or any valid css color value. */
106
106
  bgColor: PropTypes.string,
107
107
 
108
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
108
+ /** Override font color of the Tooltip, provide design token, any color from palette or any valid css color value. */
109
109
  fontColor: PropTypes.string,
110
110
 
111
111
  /** @ignore @private */
@@ -1,5 +1,6 @@
1
1
  // eslint-disable-next-line no-restricted-imports
2
2
  import { color as styledColor } from "styled-system";
3
+ import tokens from "@sage/design-tokens/js/base/common";
3
4
  /*
4
5
  * styled-system/color allows users to use a color from the theme, from the `colors` object.
5
6
  *
@@ -21,6 +22,10 @@ import { color as styledColor } from "styled-system";
21
22
  */
22
23
 
23
24
  export const toColor = (theme, color) => {
25
+ if (color.startsWith("--") && color.slice(2) in tokens) {
26
+ return `var(${color})`;
27
+ }
28
+
24
29
  const {
25
30
  palette
26
31
  } = theme;
@@ -0,0 +1,2 @@
1
+ declare const _default: (color: string) => string;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import tokens from "@sage/design-tokens/js/base/common";
2
+ export default (color => {
3
+ if (color.startsWith("var")) {
4
+ return tokens[color.replace("var(--", "").replace(")", "")];
5
+ }
6
+
7
+ return color;
8
+ });
@@ -43,10 +43,10 @@ function renderChildren({
43
43
 
44
44
  }) {
45
45
  const iconColorMap = {
46
- primary: "var(--colorsActionMajorYang100)",
47
- secondary: "var(--colorsActionMajor500)",
48
- tertiary: "var(--colorsActionMajor500)",
49
- darkBackground: "var(--colorsActionMajor500)"
46
+ primary: "--colorsActionMajorYang100",
47
+ secondary: "--colorsActionMajor500",
48
+ tertiary: "--colorsActionMajor500",
49
+ darkBackground: "--colorsActionMajor500"
50
50
  };
51
51
  const iconProps = {
52
52
  "aria-hidden": true,
@@ -26,7 +26,7 @@ const variantStyles = {
26
26
  backgroundColor: "#FFFFFF"
27
27
  },
28
28
  dark: {
29
- backgroundColor: "var(--colorsUtilityMajor050)"
29
+ backgroundColor: "--colorsUtilityMajor050"
30
30
  }
31
31
  };
32
32
 
@@ -49,7 +49,7 @@ const DismissibleBox = ({
49
49
  ml: 3
50
50
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
51
51
  type: "close",
52
- color: "var(--colorsActionMinor500)"
52
+ color: "--colorsActionMinor500"
53
53
  }))));
54
54
 
55
55
  DismissibleBox.propTypes = { ..._propTypes2.default.space,
@@ -11,12 +11,15 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
+ 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); }
15
+
14
16
  const FlatTableBody = /*#__PURE__*/_react.default.forwardRef(({
15
- children
17
+ children,
18
+ ...rest
16
19
  }, ref) => {
17
- return /*#__PURE__*/_react.default.createElement("tbody", {
20
+ return /*#__PURE__*/_react.default.createElement("tbody", _extends({
18
21
  ref: ref
19
- }, children);
22
+ }, rest), children);
20
23
  });
21
24
 
22
25
  FlatTableBody.propTypes = {
@@ -1,5 +1,6 @@
1
1
  export default FlatTableBodyDraggable;
2
- declare function FlatTableBodyDraggable({ children, getOrder }: {
2
+ declare function FlatTableBodyDraggable({ children, getOrder, ...rest }: {
3
+ [x: string]: any;
3
4
  children: any;
4
5
  getOrder: any;
5
6
  }): JSX.Element;
@@ -52,7 +52,8 @@ DropTarget.propTypes = {
52
52
 
53
53
  const FlatTableBodyDraggable = ({
54
54
  children,
55
- getOrder
55
+ getOrder,
56
+ ...rest
56
57
  }) => {
57
58
  const [draggableItems, setDraggableItems] = (0, _react.useState)(_react.default.Children.toArray(children));
58
59
  const isFirstRender = (0, _react.useRef)(true);
@@ -95,9 +96,9 @@ const FlatTableBodyDraggable = ({
95
96
 
96
97
  return /*#__PURE__*/_react.default.createElement(_reactDnd.DndProvider, {
97
98
  backend: _reactDndHtml5Backend.HTML5Backend
98
- }, /*#__PURE__*/_react.default.createElement(DropTarget, {
99
+ }, /*#__PURE__*/_react.default.createElement(DropTarget, _extends({
99
100
  getOrder: getItemsId
100
- }, draggableItems.map(item => /*#__PURE__*/_react.default.cloneElement(item, {
101
+ }, rest), draggableItems.map(item => /*#__PURE__*/_react.default.cloneElement(item, {
101
102
  id: `${item.props.id}`,
102
103
  moveItem,
103
104
  findItem,
@@ -140,7 +140,7 @@ FlatTableCell.propTypes = {
140
140
  /** Sets a custom vertical right border */
141
141
  verticalBorder: _propTypes.default.oneOf(["small", "medium", "large"]),
142
142
 
143
- /** Sets a custom vertical right border */
143
+ /** Sets a vertical right border color, provide design token, any color from palette or any valid css color value. */
144
144
  verticalBorderColor: _propTypes.default.string
145
145
  };
146
146
  var _default = FlatTableCell;
@@ -1,5 +1,6 @@
1
1
  export default FlatTableCheckbox;
2
- declare function FlatTableCheckbox({ as, checked, onChange, selectable, onClick, leftPosition, cellIndex, reportCellWidth, ariaLabelledBy, }: {
2
+ declare function FlatTableCheckbox({ as, checked, onChange, selectable, onClick, leftPosition, cellIndex, reportCellWidth, ariaLabelledBy, ...rest }: {
3
+ [x: string]: any;
3
4
  as?: string | undefined;
4
5
  checked: any;
5
6
  onChange: any;
@@ -19,6 +19,8 @@ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return
19
19
 
20
20
  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; }
21
21
 
22
+ 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); }
23
+
22
24
  const FlatTableCheckbox = ({
23
25
  as = "td",
24
26
  checked,
@@ -28,7 +30,8 @@ const FlatTableCheckbox = ({
28
30
  leftPosition,
29
31
  cellIndex,
30
32
  reportCellWidth,
31
- ariaLabelledBy
33
+ ariaLabelledBy,
34
+ ...rest
32
35
  }) => {
33
36
  const ref = (0, _react.useRef)(null);
34
37
  (0, _react.useLayoutEffect)(() => {
@@ -47,13 +50,13 @@ const FlatTableCheckbox = ({
47
50
  event.stopPropagation();
48
51
  };
49
52
 
50
- return /*#__PURE__*/_react.default.createElement(_flatTableCheckbox.default, {
53
+ return /*#__PURE__*/_react.default.createElement(_flatTableCheckbox.default, _extends({
51
54
  ref: ref,
52
55
  makeCellSticky: !!reportCellWidth,
53
56
  leftPosition: leftPosition || 0,
54
57
  "data-element": dataElement,
55
58
  as: as
56
- }, selectable && /*#__PURE__*/_react.default.createElement(_checkbox.Checkbox, {
59
+ }, rest), selectable && /*#__PURE__*/_react.default.createElement(_checkbox.Checkbox, {
57
60
  checked: checked,
58
61
  onChange: onChange,
59
62
  name: "flat-table-checkbox",
@@ -1,5 +1,6 @@
1
1
  export default FlatTableHead;
2
- declare function FlatTableHead({ children }: {
2
+ declare function FlatTableHead({ children, ...rest }: {
3
+ [x: string]: any;
3
4
  children: any;
4
5
  }): JSX.Element;
5
6
  declare namespace FlatTableHead {
@@ -24,7 +24,8 @@ const getRefs = length => Array.from({
24
24
  }, () => /*#__PURE__*/_react.default.createRef());
25
25
 
26
26
  const FlatTableHead = ({
27
- children
27
+ children,
28
+ ...rest
28
29
  }) => {
29
30
  const [rowHeights, setRowHeights] = (0, _react.useState)([]);
30
31
  const refs = getRefs(_react.default.Children.count(children));
@@ -37,10 +38,10 @@ const FlatTableHead = ({
37
38
  }, []);
38
39
 
39
40
  if (_react.default.Children.count(children) === 1) {
40
- return /*#__PURE__*/_react.default.createElement(_flatTableHead.default, null, children);
41
+ return /*#__PURE__*/_react.default.createElement(_flatTableHead.default, rest, children);
41
42
  }
42
43
 
43
- return /*#__PURE__*/_react.default.createElement(_flatTableHead.default, null, _react.default.Children.map(children, (child, index) => {
44
+ return /*#__PURE__*/_react.default.createElement(_flatTableHead.default, rest, _react.default.Children.map(children, (child, index) => {
44
45
  /* Applies left border if preceding row has a FlatTableRowHeader and current one does not.
45
46
  This is only needed when the preceding row has rowSpans applied,
46
47
  as in any other use case the rows will all have FlatTableRowHeaders */
@@ -50,7 +50,8 @@ const FlatTableRow = /*#__PURE__*/_react.default.forwardRef(({
50
50
  id,
51
51
  draggable,
52
52
  findItem,
53
- moveItem
53
+ moveItem,
54
+ ...rest
54
55
  }, ref) => {
55
56
  const [isExpanded, setIsExpanded] = (0, _react.useState)(expanded);
56
57
  let rowRef = (0, _react.useRef)();
@@ -151,7 +152,7 @@ const FlatTableRow = /*#__PURE__*/_react.default.forwardRef(({
151
152
  horizontalBorderSize: horizontalBorderSize,
152
153
  applyBorderLeft: applyBorderLeft,
153
154
  draggable: draggable
154
- }, interactiveRowProps), _react.default.Children.map(children, (child, index) => {
155
+ }, interactiveRowProps, rest), _react.default.Children.map(children, (child, index) => {
155
156
  return child && /*#__PURE__*/_react.default.cloneElement(child, {
156
157
  expandable: expandable && index === firstCellIndex(),
157
158
  onClick: expandable && index === firstCellIndex() && firstColumnExpandable ? () => toggleExpanded() : undefined,
@@ -179,7 +180,7 @@ const FlatTableRow = /*#__PURE__*/_react.default.forwardRef(({
179
180
  });
180
181
 
181
182
  FlatTableRow.propTypes = {
182
- /** Overrides default cell color */
183
+ /** Overrides default cell color, provide design token, any color from palette or any valid css color value. */
183
184
  bgColor: _propTypes.default.string,
184
185
 
185
186
  /** Array of FlatTableHeader or FlatTableCell. FlatTableRowHeader could also be passed. */
@@ -206,7 +207,7 @@ FlatTableRow.propTypes = {
206
207
  /** Sets an expandable row to be expanded on start */
207
208
  expanded: _propTypes.default.bool,
208
209
 
209
- /** Sets the color of the bottom border in the row */
210
+ /** Sets the color of the bottom border in the row, provide design token, any color from palette or any valid css color value. */
210
211
  horizontalBorderColor: _propTypes.default.string,
211
212
 
212
213
  /** Sets the weight of the bottom border in the row */
@@ -97,7 +97,7 @@ FlatTableRowHeader.propTypes = {
97
97
  /** Sets a custom vertical right border */
98
98
  verticalBorder: _propTypes.default.oneOf(["small", "medium", "large"]),
99
99
 
100
- /** Sets a custom vertical right border */
100
+ /** Sets a vertical right border color, provide design token, any color from palette or any valid css color value. */
101
101
  verticalBorderColor: _propTypes.default.string
102
102
  };
103
103
  var _default = FlatTableRowHeader;
@@ -165,10 +165,10 @@ Icon.propTypes = { ...marginPropTypes,
165
165
  /** Icon font size */
166
166
  fontSize: _propTypes.default.oneOf(["small", "medium", "large", "extra-large"]),
167
167
 
168
- /** Icon colour, provide any color from palette or any valid css color value. */
168
+ /** Icon colour, provide design token, any color from palette or any valid css color value. */
169
169
  color: _propTypes.default.string,
170
170
 
171
- /** Background colour, provide any color from palette or any valid css color value. */
171
+ /** Background colour, provide design token, any color from palette, or any valid css color value. */
172
172
  bg: _propTypes.default.string,
173
173
 
174
174
  /** Sets the icon in the disabled state */
@@ -189,10 +189,10 @@ Icon.propTypes = { ...marginPropTypes,
189
189
  /** Control whether the tooltip is visible */
190
190
  tooltipVisible: _propTypes.default.bool,
191
191
 
192
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
192
+ /** Override background color of the Tooltip, provide design token, any color from palette or any valid css color value. */
193
193
  tooltipBgColor: _propTypes.default.string,
194
194
 
195
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
195
+ /** Override font color of the Tooltip, provide design token, any color from palette or any valid css color value. */
196
196
  tooltipFontColor: _propTypes.default.string,
197
197
 
198
198
  /** Id passed to the tooltip container, used for accessibility purposes. */
@@ -23,6 +23,8 @@ var _browserTypeCheck = _interopRequireWildcard(require("../../__internal__/util
23
23
 
24
24
  var _color = _interopRequireDefault(require("../../style/utils/color"));
25
25
 
26
+ var _getColorValue = _interopRequireDefault(require("../../style/utils/get-color-value"));
27
+
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
29
 
28
30
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -77,9 +79,6 @@ const StyledIcon = _styledComponents.default.span`
77
79
  if (disabled) {
78
80
  finalColor = "var(--colorsYin030)";
79
81
  finalHoverColor = "var(--colorsYin030)";
80
- } else if (typeof color === "string" && color.startsWith("var")) {
81
- finalColor = color;
82
- finalHoverColor = (0, _polished.shade)(0.2, theme.compatibility[color.replace("var(--", "").replace(")", "")]);
83
82
  } else if (color) {
84
83
  const {
85
84
  color: renderedColor
@@ -88,7 +87,7 @@ const StyledIcon = _styledComponents.default.span`
88
87
  theme
89
88
  });
90
89
  finalColor = renderedColor;
91
- finalHoverColor = (0, _polished.shade)(0.2, renderedColor);
90
+ finalHoverColor = (0, _polished.shade)(0.2, (0, _getColorValue.default)(renderedColor));
92
91
  } else {
93
92
  finalColor = "var(--colorsYin090)";
94
93
  finalHoverColor = "var(--colorsYin090)";
@@ -102,7 +101,7 @@ const StyledIcon = _styledComponents.default.span`
102
101
  theme
103
102
  });
104
103
  bgColor = backgroundColor;
105
- bgHoverColor = (0, _polished.shade)(0.2, backgroundColor);
104
+ bgHoverColor = (0, _polished.shade)(0.2, (0, _getColorValue.default)(backgroundColor));
106
105
  } else {
107
106
  bgColor = "transparent";
108
107
  bgHoverColor = "transparent";
@@ -7,8 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
10
- var _styledComponents = require("styled-components");
11
-
12
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
11
 
14
12
  var _icon = _interopRequireDefault(require("../icon"));
@@ -19,8 +17,6 @@ var _link = require("./link.style");
19
17
 
20
18
  var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
21
19
 
22
- var _themes = require("../../style/themes");
23
-
24
20
  var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
25
21
 
26
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -51,9 +47,6 @@ const Link = /*#__PURE__*/_react.default.forwardRef(({
51
47
  ...rest
52
48
  }, ref) => {
53
49
  const l = (0, _useLocale.default)();
54
-
55
- const theme = (0, _react.useContext)(_styledComponents.ThemeContext) || _themes.baseTheme;
56
-
57
50
  const tabIndex = tabbable && !disabled ? "0" : "-1";
58
51
 
59
52
  const handleOnKeyDown = ev => {
@@ -77,7 +70,7 @@ const Link = /*#__PURE__*/_react.default.forwardRef(({
77
70
  return hasProperAlignment ? /*#__PURE__*/_react.default.createElement(_icon.default, {
78
71
  type: icon,
79
72
  bgSize: "extra-small",
80
- color: theme.colors.primary,
73
+ color: "--colorsActionMajor500",
81
74
  disabled: disabled,
82
75
  ariaLabel: ariaLabel,
83
76
  tooltipMessage: tooltipMessage,
@@ -62,7 +62,7 @@ Pill.propTypes = {
62
62
  /** Change the color of a status pill. */
63
63
  colorVariant: _propTypes.default.oneOf(["neutral", "negative", "positive", "warning"]),
64
64
 
65
- /** Override color variant, provide any color from palette or any valid css color value. */
65
+ /** Override color variant, provide design token, any color from palette or any valid css color value. */
66
66
  borderColor: _propTypes.default.string,
67
67
 
68
68
  /** The content to display inside of the pill. */
@@ -21,6 +21,8 @@ var _icon = _interopRequireDefault(require("../icon/icon.style"));
21
21
 
22
22
  var _color = require("../../style/utils/color.js");
23
23
 
24
+ var _getColorValue = _interopRequireDefault(require("../../style/utils/get-color-value"));
25
+
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
27
 
26
28
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -57,8 +59,8 @@ const PillStyle = _styledComponents.default.span`
57
59
  try {
58
60
  if (borderColor) {
59
61
  pillColor = (0, _color.toColor)(theme, borderColor);
60
- buttonFocusColor = (0, _polished.shade)(0.2, pillColor);
61
- contentColor = (0, _polished.meetsContrastGuidelines)(pillColor, theme.compatibility.colorsUtilityYin090).AAA ? "var(--colorsUtilityYin090)" : "var(--colorsUtilityYang100)";
62
+ buttonFocusColor = (0, _polished.shade)(0.2, (0, _getColorValue.default)(pillColor));
63
+ contentColor = (0, _polished.meetsContrastGuidelines)((0, _getColorValue.default)(pillColor), theme.compatibility.colorsUtilityYin090).AAA ? "var(--colorsUtilityYin090)" : "var(--colorsUtilityYang100)";
62
64
  } else {
63
65
  const {
64
66
  varietyColor,
@@ -174,10 +174,10 @@ Portrait.propTypes = { ...marginPropTypes,
174
174
  /** Defines the size of the tooltip content */
175
175
  tooltipSize: _propTypes.default.oneOf(["medium", "large"]),
176
176
 
177
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
177
+ /** Override background color of the Tooltip, provide design token, any color from palette or any valid css color value. */
178
178
  tooltipBgColor: _propTypes.default.string,
179
179
 
180
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
180
+ /** Override font color of the Tooltip, provide design token, any color from palette or any valid css color value. */
181
181
  tooltipFontColor: _propTypes.default.string
182
182
  };
183
183
  Portrait.defaultProps = {
@@ -40,6 +40,7 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
40
40
  defaultValue,
41
41
  id,
42
42
  name,
43
+ label,
43
44
  children,
44
45
  onOpen,
45
46
  onChange,
@@ -69,7 +70,7 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
69
70
  }, inputRef) => {
70
71
  const [activeDescendantId, setActiveDescendantId] = (0, _react.useState)();
71
72
  const selectListId = (0, _react.useRef)((0, _guid.default)());
72
- const labelId = (0, _react.useRef)((0, _guid.default)());
73
+ const labelId = (0, _react.useRef)(label ? (0, _guid.default)() : undefined);
73
74
  const containerRef = (0, _react.useRef)();
74
75
  const listboxRef = (0, _react.useRef)();
75
76
  const isControlled = (0, _react.useRef)(value !== undefined);
@@ -390,6 +391,7 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
390
391
  return {
391
392
  id,
392
393
  name,
394
+ label,
393
395
  disabled,
394
396
  readOnly,
395
397
  inputRef: assignInput,
@@ -415,7 +417,7 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
415
417
  const selectList = /*#__PURE__*/_react.default.createElement(FilterableSelectList, {
416
418
  ref: listboxRef,
417
419
  id: selectListId.current,
418
- labelId: labelId.current,
420
+ labelId: label ? labelId.current : undefined,
419
421
  anchorElement: textboxRef && textboxRef.parentElement,
420
422
  onSelect: onSelectOption,
421
423
  onSelectListClose: onSelectListClose,
@@ -451,10 +453,10 @@ const FilterableSelect = /*#__PURE__*/_react.default.forwardRef(({
451
453
  ref: containerRef
452
454
  }, /*#__PURE__*/_react.default.createElement(_selectTextbox.default, _extends({
453
455
  activeDescendantId: activeDescendantId,
456
+ labelId: label ? labelId.current : undefined,
454
457
  "aria-controls": isOpen ? selectListId.current : undefined,
455
458
  isOpen: isOpen,
456
459
  hasTextCursor: true,
457
- labelId: labelId.current,
458
460
  textboxRef: textboxRef
459
461
  }, getTextboxProps()))), isOpen && selectList);
460
462
  });
@@ -1,14 +1,14 @@
1
1
  export default SelectTextbox;
2
- declare function SelectTextbox({ accessibilityLabelId, "aria-controls": ariaControls, value, disabled, isOpen, readOnly, placeholder, labelId, size, onClick, onFocus, onBlur, onChange, selectedValue, required, textboxRef, hasTextCursor, transparent, activeDescendantId, ...restProps }: {
2
+ declare function SelectTextbox({ accessibilityLabelId, labelId, "aria-controls": ariaControls, value, disabled, isOpen, readOnly, placeholder, size, onClick, onFocus, onBlur, onChange, selectedValue, required, textboxRef, hasTextCursor, transparent, activeDescendantId, ...restProps }: {
3
3
  [x: string]: any;
4
- accessibilityLabelId?: string | undefined;
4
+ accessibilityLabelId: any;
5
+ labelId: any;
5
6
  "aria-controls": any;
6
7
  value: any;
7
8
  disabled: any;
8
9
  isOpen: any;
9
10
  readOnly: any;
10
11
  placeholder: any;
11
- labelId: any;
12
12
  size: any;
13
13
  onClick: any;
14
14
  onFocus: any;
@@ -66,14 +66,14 @@ const modifiers = [{
66
66
  }];
67
67
 
68
68
  const SelectTextbox = ({
69
- accessibilityLabelId = "",
69
+ accessibilityLabelId,
70
+ labelId,
70
71
  "aria-controls": ariaControls,
71
72
  value,
72
73
  disabled,
73
74
  isOpen,
74
75
  readOnly,
75
76
  placeholder,
76
- labelId,
77
77
  size,
78
78
  onClick,
79
79
  onFocus,
@@ -154,9 +154,12 @@ const SelectTextbox = ({
154
154
  }
155
155
 
156
156
  function getInputAriaAttributes() {
157
+ const joinIds = (...ids) => ids.filter(item => item !== undefined).join(" ");
158
+
159
+ const ariaLabelledby = hasTextCursor ? joinIds(labelId, accessibilityLabelId) : joinIds(labelId, textId.current);
157
160
  return {
158
161
  "aria-expanded": isOpen,
159
- "aria-labelledby": hasTextCursor ? `${labelId} ${accessibilityLabelId}` : `${labelId} ${textId.current}`,
162
+ "aria-labelledby": ariaLabelledby || undefined,
160
163
  "aria-activedescendant": activeDescendantId,
161
164
  "aria-controls": ariaControls,
162
165
  "aria-autocomplete": hasTextCursor ? "both" : undefined,
@@ -124,10 +124,10 @@ Tooltip.propTypes = {
124
124
  // Reference element, tooltip will be positioned in relation to this element
125
125
  target: _propTypes.default.instanceOf(Element),
126
126
 
127
- /** Override background color of the Tooltip, provide any color from palette or any valid css color value. */
127
+ /** Override background color of the Tooltip, provide design token, any color from palette or any valid css color value. */
128
128
  bgColor: _propTypes.default.string,
129
129
 
130
- /** Override font color of the Tooltip, provide any color from palette or any valid css color value. */
130
+ /** Override font color of the Tooltip, provide design token, any color from palette or any valid css color value. */
131
131
  fontColor: _propTypes.default.string,
132
132
 
133
133
  /** @ignore @private */
@@ -7,6 +7,10 @@ exports.default = exports.toColor = void 0;
7
7
 
8
8
  var _styledSystem = require("styled-system");
9
9
 
10
+ var _common = _interopRequireDefault(require("@sage/design-tokens/js/base/common"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  // eslint-disable-next-line no-restricted-imports
11
15
 
12
16
  /*
@@ -29,6 +33,10 @@ var _styledSystem = require("styled-system");
29
33
  * This allows us to keep our themes as plain objects.
30
34
  */
31
35
  const toColor = (theme, color) => {
36
+ if (color.startsWith("--") && color.slice(2) in _common.default) {
37
+ return `var(${color})`;
38
+ }
39
+
32
40
  const {
33
41
  palette
34
42
  } = theme;
@@ -0,0 +1,2 @@
1
+ declare const _default: (color: string) => string;
2
+ export default _default;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _common = _interopRequireDefault(require("@sage/design-tokens/js/base/common"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var _default = color => {
13
+ if (color.startsWith("var")) {
14
+ return _common.default[color.replace("var(--", "").replace(")", "")];
15
+ }
16
+
17
+ return color;
18
+ };
19
+
20
+ exports.default = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "104.50.0",
3
+ "version": "104.52.1",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {