Skip to content

Commit

Permalink
fix(selectable-tile): don't require deprecated property "value"
Browse files Browse the repository at this point in the history
Refs carbon-design-system#13537, carbon-design-system#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.
  • Loading branch information
wkeese committed Nov 18, 2024
1 parent 6972097 commit c8e1309
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
19 changes: 2 additions & 17 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6984,9 +6984,7 @@ Map {
"type": "string",
},
"light": [Function],
"name": Object {
"type": "string",
},
"name": [Function],
"onChange": Object {
"type": "func",
},
Expand All @@ -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],
},
Expand Down
10 changes: 8 additions & 2 deletions packages/react/src/components/Tile/Tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,10 @@ SelectableTile.propTypes = {
* The `name` of the `<input>`.
* @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 `<input>`.
Expand Down Expand Up @@ -602,7 +605,10 @@ SelectableTile.propTypes = {
* The value of the `<input>`.
* @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<HTMLDivElement> {
Expand Down

0 comments on commit c8e1309

Please sign in to comment.