From c8e1309dac0744dcc945f79946db693a09cea16b Mon Sep 17 00:00:00 2001 From: Bill Keese Date: Mon, 18 Nov 2024 14:09:39 +0900 Subject: [PATCH] fix(selectable-tile): don't require deprecated property "value" Refs #13537, #13631. Update PropTypes so "name" and "value" are reported as deprecated. (The description already included @deprecated, but that's different.) More importantly, stop marking "value" as required. Properties cannot be deprecated and required at the same time. --- .../__snapshots__/PublicAPI-test.js.snap | 19 ++----------------- packages/react/src/components/Tile/Tile.tsx | 10 ++++++++-- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap index ca1928c973db..06553f4f2f63 100644 --- a/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap +++ b/packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap @@ -6984,9 +6984,7 @@ Map { "type": "string", }, "light": [Function], - "name": Object { - "type": "string", - }, + "name": [Function], "onChange": Object { "type": "func", }, @@ -7008,20 +7006,7 @@ Map { "title": Object { "type": "string", }, - "value": Object { - "args": Array [ - Array [ - Object { - "type": "string", - }, - Object { - "type": "number", - }, - ], - ], - "isRequired": true, - "type": "oneOfType", - }, + "value": [Function], }, "render": [Function], }, diff --git a/packages/react/src/components/Tile/Tile.tsx b/packages/react/src/components/Tile/Tile.tsx index 389af4ab0efb..7848daa6c06b 100644 --- a/packages/react/src/components/Tile/Tile.tsx +++ b/packages/react/src/components/Tile/Tile.tsx @@ -561,7 +561,10 @@ SelectableTile.propTypes = { * The `name` of the ``. * @deprecated */ - name: PropTypes.string, + name: deprecate( + PropTypes.string, + 'The `name` property is no longer used. It will be removed in the next major release.' + ), /** * The empty handler of the ``. @@ -602,7 +605,10 @@ SelectableTile.propTypes = { * The value of the ``. * @deprecated */ - value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired, + value: deprecate( + PropTypes.oneOfType([PropTypes.string, PropTypes.number]), + 'The `value` property is no longer used. It will be removed in the next major release.`' + ), }; export interface ExpandableTileProps extends HTMLAttributes {