@carbon/react 1.50.0-rc.0 → 1.50.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 (30) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +985 -936
  2. package/es/components/Accordion/AccordionItem.js +10 -15
  3. package/es/components/ChatButton/ChatButton.Skeleton.js +40 -0
  4. package/es/components/ChatButton/ChatButton.js +81 -0
  5. package/es/components/DataTable/DataTable.d.ts +21 -0
  6. package/es/components/DataTable/DataTable.js +19 -0
  7. package/es/components/DataTable/TableCell.d.ts +28 -3
  8. package/es/components/DataTable/TableCell.js +22 -5
  9. package/es/components/DataTable/TableExpandRow.js +1 -1
  10. package/es/components/DataTable/TableHeader.js +2 -2
  11. package/es/components/DataTable/TableRow.js +12 -1
  12. package/es/components/DataTable/tools/normalize.js +3 -1
  13. package/es/index.d.ts +1 -0
  14. package/es/index.js +2 -0
  15. package/lib/components/Accordion/AccordionItem.js +9 -14
  16. package/lib/components/ChatButton/ChatButton.Skeleton.js +50 -0
  17. package/lib/components/ChatButton/ChatButton.js +91 -0
  18. package/lib/components/DataTable/DataTable.d.ts +21 -0
  19. package/lib/components/DataTable/DataTable.js +19 -0
  20. package/lib/components/DataTable/TableCell.d.ts +28 -3
  21. package/lib/components/DataTable/TableCell.js +27 -5
  22. package/lib/components/DataTable/TableExpandRow.js +1 -1
  23. package/lib/components/DataTable/TableHeader.js +2 -2
  24. package/lib/components/DataTable/TableRow.js +12 -1
  25. package/lib/components/DataTable/tools/normalize.js +3 -1
  26. package/lib/index.d.ts +1 -0
  27. package/lib/index.js +4 -0
  28. package/package.json +5 -5
  29. package/scss/components/chat-button/_chat-button.scss +9 -0
  30. package/scss/components/chat-button/_index.scss +9 -0
@@ -113,6 +113,7 @@ class DataTable extends React__default["default"].Component {
113
113
  sortDirection,
114
114
  isSortable,
115
115
  isSortHeader: sortHeaderKey === header.key,
116
+ slug: header.slug,
116
117
  onClick: event => {
117
118
  const nextSortState = sorting.getNextSortState(this.props, this.state, {
118
119
  key: header.key
@@ -349,6 +350,23 @@ class DataTable extends React__default["default"].Component {
349
350
  useStaticWidth
350
351
  };
351
352
  });
353
+ /**
354
+ * Get the props associated with the given table cell.
355
+ *
356
+ * @param {object} config
357
+ * @param {object} config.cell the cell we want the props for
358
+ * @returns {object}
359
+ */
360
+ _rollupPluginBabelHelpers.defineProperty(this, "getCellProps", _ref4 => {
361
+ let {
362
+ cell,
363
+ ...rest
364
+ } = _ref4;
365
+ return {
366
+ ...rest,
367
+ hasSlugHeader: cell.hasSlugHeader
368
+ };
369
+ });
352
370
  /**
353
371
  * Helper utility to get all the currently selected rows
354
372
  * @returns {Array<string>} the array of rowIds that are currently selected
@@ -622,6 +640,7 @@ class DataTable extends React__default["default"].Component {
622
640
  getBatchActionProps: this.getBatchActionProps,
623
641
  getTableProps: this.getTableProps,
624
642
  getTableContainerProps: this.getTableContainerProps,
643
+ getCellProps: this.getCellProps,
625
644
  // Custom event handlers
626
645
  onInputChange: this.handleOnInputValueChange,
627
646
  // Expose internal state change actions
@@ -4,7 +4,32 @@
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { TdHTMLAttributes } from 'react';
8
- export type TableCellProps = TdHTMLAttributes<HTMLTableCellElement>;
9
- declare const TableCell: React.FC<TableCellProps>;
7
+ import React from 'react';
8
+ import { ReactAttr } from '../../types/common';
9
+ interface TableCellProps extends ReactAttr<HTMLTableCellElement> {
10
+ /**
11
+ * Pass in children that will be embedded in the table header label
12
+ */
13
+ children?: React.ReactNode;
14
+ /**
15
+ * Specify an optional className to be applied to the container node
16
+ */
17
+ className?: string;
18
+ /**
19
+ * The width of the expanded row's internal cell
20
+ */
21
+ colSpan?: number;
22
+ /**
23
+ * Specify if the table cell is in an AI column
24
+ */
25
+ hasSlugHeader?: boolean;
26
+ /**
27
+ * The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43
28
+ */
29
+ headers?: string;
30
+ }
31
+ declare const TableCell: {
32
+ ({ children, className, hasSlugHeader, colSpan, ...rest }: TableCellProps): import("react/jsx-runtime").JSX.Element;
33
+ displayName: string;
34
+ };
10
35
  export default TableCell;
@@ -9,11 +9,33 @@
9
9
 
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
- var wrapComponent = require('../../tools/wrapComponent.js');
12
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
+ var React = require('react');
14
+ var cx = require('classnames');
15
+ var usePrefix = require('../../internal/usePrefix.js');
13
16
 
14
- const TableCell = wrapComponent["default"]({
15
- name: 'TableCell',
16
- type: 'td'
17
- });
17
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
18
+
19
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
20
+ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
21
+
22
+ const TableCell = _ref => {
23
+ let {
24
+ children,
25
+ className,
26
+ hasSlugHeader,
27
+ colSpan,
28
+ ...rest
29
+ } = _ref;
30
+ const prefix = usePrefix.usePrefix();
31
+ const tableCellClassNames = cx__default["default"](className, {
32
+ [`${prefix}--table-cell--column-slug`]: hasSlugHeader
33
+ });
34
+ return /*#__PURE__*/React__default["default"].createElement("td", _rollupPluginBabelHelpers["extends"]({
35
+ className: tableCellClassNames ? tableCellClassNames : undefined,
36
+ colSpan: colSpan
37
+ }, rest), children);
38
+ };
39
+ TableCell.displayName = 'TableCell';
18
40
 
19
41
  exports["default"] = TableCell;
@@ -58,7 +58,7 @@ const TableExpandRow = /*#__PURE__*/React__default["default"].forwardRef((_ref,
58
58
  [`${prefix}--parent-row`]: true,
59
59
  [`${prefix}--expandable-row`]: isExpanded,
60
60
  [`${prefix}--data-table--selected`]: isSelected,
61
- [`${prefix}--parent-row--slug`]: rowHasSlug
61
+ [`${prefix}--data-table--slug-row`]: rowHasSlug
62
62
  }, rowClassName);
63
63
  const previousValue = isExpanded ? 'collapsed' : undefined;
64
64
  return /*#__PURE__*/React__default["default"].createElement("tr", _rollupPluginBabelHelpers["extends"]({}, rest, {
@@ -134,13 +134,13 @@ const TableHeader = /*#__PURE__*/React__default["default"].forwardRef(function T
134
134
  className: `${prefix}--table-sort__flex`
135
135
  }, /*#__PURE__*/React__default["default"].createElement("div", {
136
136
  className: `${prefix}--table-header-label`
137
- }, children), normalizedSlug, /*#__PURE__*/React__default["default"].createElement(iconsReact.ArrowUp, {
137
+ }, children), /*#__PURE__*/React__default["default"].createElement(iconsReact.ArrowUp, {
138
138
  size: 20,
139
139
  className: `${prefix}--table-sort__icon`
140
140
  }), /*#__PURE__*/React__default["default"].createElement(iconsReact.ArrowsVertical, {
141
141
  size: 20,
142
142
  className: `${prefix}--table-sort__icon-unsorted`
143
- }))));
143
+ }), normalizedSlug)));
144
144
  });
145
145
  TableHeader.propTypes = {
146
146
  /**
@@ -24,10 +24,21 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
24
 
25
25
  const TableRow = props => {
26
26
  const prefix = usePrefix.usePrefix();
27
+ let rowHasSlug;
28
+ if (props?.children) {
29
+ React__default["default"].Children.toArray(props.children).map(child => {
30
+ if (child.type?.displayName === 'TableSlugRow') {
31
+ if (child.props.slug) {
32
+ rowHasSlug = true;
33
+ }
34
+ }
35
+ });
36
+ }
27
37
  // Remove unnecessary props if provided to this component, these are
28
38
  // only useful in `TableExpandRow`
29
39
  const className = cx__default["default"](props.className, {
30
- [`${prefix}--data-table--selected`]: props.isSelected
40
+ [`${prefix}--data-table--selected`]: props.isSelected,
41
+ [`${prefix}--data-table--slug-row`]: rowHasSlug
31
42
  });
32
43
  const cleanProps = {
33
44
  ...omit__default["default"](props, ['ariaLabel', 'aria-label', 'aria-controls', 'onExpand', 'isExpanded', 'isSelected']),
@@ -52,7 +52,8 @@ const normalize = function (rows, headers) {
52
52
  }
53
53
  headers.forEach((_ref, i) => {
54
54
  let {
55
- key
55
+ key,
56
+ slug
56
57
  } = _ref;
57
58
  const id = cells.getCellId(row.id, key);
58
59
  // Initialize the cell info and state values, namely for editing
@@ -63,6 +64,7 @@ const normalize = function (rows, headers) {
63
64
  isEditing: false,
64
65
  isValid: true,
65
66
  errors: null,
67
+ hasSlugHeader: !!slug,
66
68
  info: {
67
69
  header: key
68
70
  }
package/lib/index.d.ts CHANGED
@@ -115,6 +115,7 @@ export { PageSelector as unstable_PageSelector, Pagination as unstable_Paginatio
115
115
  export * from './components/Popover';
116
116
  export * from './components/ProgressBar';
117
117
  export { Slug as unstable__Slug, SlugContent as unstable__SlugContent, SlugActions as unstable__SlugActions, } from './components/Slug';
118
+ export { ChatButton as unstable__ChatButton, ChatButtonSkeleton as unstable__ChatButtonSkeleton, } from './components/ChatButton';
118
119
  export * from './components/Stack';
119
120
  export * from './components/Tooltip';
120
121
  export { Text as unstable_Text, TextDirection as unstable_TextDirection, } from './components/Text';
package/lib/index.js CHANGED
@@ -193,6 +193,8 @@ var FluidTimePicker_Skeleton = require('./components/FluidTimePicker/FluidTimePi
193
193
  var FluidTimePickerSelect = require('./components/FluidTimePickerSelect/FluidTimePickerSelect.js');
194
194
  var LayoutDirection = require('./components/LayoutDirection/LayoutDirection.js');
195
195
  var useLayoutDirection = require('./components/LayoutDirection/useLayoutDirection.js');
196
+ var ChatButton = require('./components/ChatButton/ChatButton.js');
197
+ var ChatButton_Skeleton = require('./components/ChatButton/ChatButton.Skeleton.js');
196
198
  var Text = require('./components/Text/Text.js');
197
199
  var TextDirection = require('./components/Text/TextDirection.js');
198
200
  var DataTable = require('./components/DataTable/DataTable.js');
@@ -457,6 +459,8 @@ exports.unstable__FluidTimePickerSkeleton = FluidTimePicker_Skeleton["default"];
457
459
  exports.unstable__FluidTimePickerSelect = FluidTimePickerSelect["default"];
458
460
  exports.unstable_LayoutDirection = LayoutDirection.LayoutDirection;
459
461
  exports.unstable_useLayoutDirection = useLayoutDirection.useLayoutDirection;
462
+ exports.unstable__ChatButton = ChatButton["default"];
463
+ exports.unstable__ChatButtonSkeleton = ChatButton_Skeleton["default"];
460
464
  exports.unstable_Text = Text.Text;
461
465
  exports.unstable_TextDirection = TextDirection.TextDirection;
462
466
  exports.DataTable = DataTable["default"];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/react",
3
3
  "description": "React components for the Carbon Design System",
4
- "version": "1.50.0-rc.0",
4
+ "version": "1.50.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -49,9 +49,9 @@
49
49
  "dependencies": {
50
50
  "@babel/runtime": "^7.18.3",
51
51
  "@carbon/feature-flags": "^0.16.0",
52
- "@carbon/icons-react": "^11.36.0-rc.0",
52
+ "@carbon/icons-react": "^11.36.0",
53
53
  "@carbon/layout": "^11.20.0",
54
- "@carbon/styles": "^1.50.0-rc.0",
54
+ "@carbon/styles": "^1.50.0",
55
55
  "@ibm/telemetry-js": "^1.2.0",
56
56
  "classnames": "2.5.1",
57
57
  "copy-to-clipboard": "^3.3.1",
@@ -79,7 +79,7 @@
79
79
  "@babel/preset-react": "^7.22.3",
80
80
  "@babel/preset-typescript": "^7.21.5",
81
81
  "@carbon/test-utils": "^10.30.0",
82
- "@carbon/themes": "^11.30.0",
82
+ "@carbon/themes": "^11.31.0",
83
83
  "@rollup/plugin-babel": "^6.0.0",
84
84
  "@rollup/plugin-commonjs": "^25.0.0",
85
85
  "@rollup/plugin-node-resolve": "^15.0.0",
@@ -139,5 +139,5 @@
139
139
  "**/*.scss",
140
140
  "**/*.css"
141
141
  ],
142
- "gitHead": "fbec0e13b29a1c9b19ed22a1ae9b6f87107ba920"
142
+ "gitHead": "eb7d66891262363368b48211b9fd1caa78fa58f9"
143
143
  }
@@ -0,0 +1,9 @@
1
+ // Code generated by @carbon/react. DO NOT EDIT.
2
+ //
3
+ // Copyright IBM Corp. 2018, 2023
4
+ //
5
+ // This source code is licensed under the Apache-2.0 license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ @forward '@carbon/styles/scss/components/chat-button/chat-button';
@@ -0,0 +1,9 @@
1
+ // Code generated by @carbon/react. DO NOT EDIT.
2
+ //
3
+ // Copyright IBM Corp. 2018, 2023
4
+ //
5
+ // This source code is licensed under the Apache-2.0 license found in the
6
+ // LICENSE file in the root directory of this source tree.
7
+ //
8
+
9
+ @forward '@carbon/styles/scss/components/chat-button';