carbon-react 94.6.1 → 94.8.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.
@@ -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(
@@ -95,7 +95,8 @@ const FlatTableBodyDraggable = ({
95
95
  id: `${item.props.id}`,
96
96
  moveItem,
97
97
  findItem,
98
- draggable: true
98
+ draggable: true,
99
+ key: `${item.props.id}`
99
100
  }, [/*#__PURE__*/_react.default.createElement(_flatTableCell.default, {
100
101
  key: item.props.id
101
102
  }, /*#__PURE__*/_react.default.createElement(_icon.default, {
@@ -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;
@@ -242,7 +242,7 @@ const StyledFlatTableRow = _styledComponents.default.tr`
242
242
  ${_flatTableCell.StyledFlatTableCell}:first-child > div,
243
243
  ${_flatTableRowHeader.StyledFlatTableRowHeader}:first-child > div,
244
244
  ${_flatTableCheckbox.default} + ${_flatTableCell.StyledFlatTableCell} > div {
245
- ${_icon.default} {
245
+ ${_icon.default}[type="chevron_down_thick"]:first-of-type {
246
246
  transition: transform 0.3s;
247
247
  ${!isExpanded && (0, _styledComponents.css)`
248
248
  transform: rotate(-90deg);
@@ -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`
@@ -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.1",
3
+ "version": "94.8.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",