diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index 248de768906b..7390b283f019 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -1212,21 +1212,46 @@ Map { }, "TableExpandHeader": Object { "propTypes": Object { - "ariaLabel": [Function], + "ariaLabel": Object { + "args": Array [ + Array [ + [Function], + [Function], + ], + ], + "type": "oneOfType", + }, "children": Object { "type": "node", }, "className": Object { "type": "string", }, - "enableExpando": Object { + "enableExpando": [Function], + "enableToggle": Object { "type": "bool", }, "expandIconDescription": Object { "type": "string", }, - "isExpanded": [Function], - "onExpand": [Function], + "isExpanded": Object { + "args": Array [ + Array [ + [Function], + [Function], + ], + ], + "type": "oneOfType", + }, + "onExpand": Object { + "args": Array [ + Array [ + [Function], + [Function], + ], + ], + "type": "oneOfType", + }, }, }, "TableExpandRow": Object { @@ -1852,21 +1877,46 @@ Map { }, "TableExpandHeader" => Object { "propTypes": Object { - "ariaLabel": [Function], + "ariaLabel": Object { + "args": Array [ + Array [ + [Function], + [Function], + ], + ], + "type": "oneOfType", + }, "children": Object { "type": "node", }, "className": Object { "type": "string", }, - "enableExpando": Object { + "enableExpando": [Function], + "enableToggle": Object { "type": "bool", }, "expandIconDescription": Object { "type": "string", }, - "isExpanded": [Function], - "onExpand": [Function], + "isExpanded": Object { + "args": Array [ + Array [ + [Function], + [Function], + ], + ], + "type": "oneOfType", + }, + "onExpand": Object { + "args": Array [ + Array [ + [Function], + [Function], + ], + ], + "type": "oneOfType", + }, }, }, "TableExpandRow" => Object { diff --git a/packages/react/src/components/Accordion/AccordionItem.js b/packages/react/src/components/Accordion/AccordionItem.js index 79aa438a913d..c2c8a472f8cf 100644 --- a/packages/react/src/components/Accordion/AccordionItem.js +++ b/packages/react/src/components/Accordion/AccordionItem.js @@ -13,7 +13,7 @@ import React, { useState } from 'react'; import { Text } from '../Text'; import { match, keys } from '../../internal/keyboard'; import { useId } from '../../internal/useId'; -import deprecate from '../../prop-types/deprecate.js'; +import deprecate from '../../prop-types/deprecate'; const { prefix } = settings; const defaultRenderExpando = (props) => ; diff --git a/packages/react/src/components/DataTable/TableExpandHeader.js b/packages/react/src/components/DataTable/TableExpandHeader.js index a77e902948f5..a1793c10ed58 100644 --- a/packages/react/src/components/DataTable/TableExpandHeader.js +++ b/packages/react/src/components/DataTable/TableExpandHeader.js @@ -8,6 +8,7 @@ import cx from 'classnames'; import PropTypes from 'prop-types'; import requiredIfGivenPropIsTruthy from '../../prop-types/requiredIfGivenPropIsTruthy'; +import deprecate from '../../prop-types/deprecate'; import React from 'react'; import { ChevronRight16 } from '@carbon/icons-react'; import { settings } from 'carbon-components'; @@ -18,6 +19,7 @@ const TableExpandHeader = ({ ariaLabel, className: headerClassName, enableExpando, + enableToggle, isExpanded, onExpand, expandIconDescription, @@ -33,7 +35,7 @@ const TableExpandHeader = ({ className={className} data-previous-value={previousValue} {...rest}> - {!enableExpando ? null : ( + {enableExpando || enableToggle ? ( - )} + ) : null} {children} ); @@ -56,15 +58,27 @@ TableExpandHeader.propTypes = { * Specify the string read by a voice reader when the expand trigger is * focused */ - ariaLabel: requiredIfGivenPropIsTruthy('enableExpando', PropTypes.string), + ariaLabel: PropTypes.oneOfType([ + requiredIfGivenPropIsTruthy('enableExpando', PropTypes.string), + requiredIfGivenPropIsTruthy('enableToggle', PropTypes.string), + ]), + children: PropTypes.node, className: PropTypes.string, + /** + * The enableExpando prop is being replaced by enableToggle + */ + enableExpando: deprecate( + PropTypes.bool, + 'The `enableExpando` prop has been deprecated in favor of `enableToggle`. This prop will be removed in the next major release.' + ), + /** * Specify whether an expand all button should be displayed */ - enableExpando: PropTypes.bool, + enableToggle: PropTypes.bool, /** * The description of the chevron right icon, to be put in its SVG `