Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Dropdown): allow number as a valid proptype for selecteditems #9421

Merged
merged 5 commits into from
Aug 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,9 @@ Map {
Object {
"type": "string",
},
Object {
"type": "number",
},
],
],
"type": "oneOfType",
Expand Down Expand Up @@ -653,6 +656,9 @@ Map {
Object {
"type": "string",
},
Object {
"type": "number",
},
],
],
"type": "oneOfType",
Expand Down Expand Up @@ -2446,6 +2452,9 @@ Map {
Object {
"type": "string",
},
Object {
"type": "number",
},
],
],
"type": "oneOfType",
Expand Down Expand Up @@ -2486,6 +2495,9 @@ Map {
Object {
"type": "string",
},
Object {
"type": "number",
},
],
],
"type": "oneOfType",
Expand Down
7 changes: 6 additions & 1 deletion packages/react/src/components/ComboBox/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ ComboBox.propTypes = {
initialSelectedItem: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.number,
]),

/**
Expand Down Expand Up @@ -498,7 +499,11 @@ ComboBox.propTypes = {
/**
* For full control of the selection
*/
selectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
selectedItem: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.number,
]),

/**
* Specify your own filtering logic by passing in a `shouldFilterItem`
Expand Down
7 changes: 6 additions & 1 deletion packages/react/src/components/Dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ Dropdown.propTypes = {
initialSelectedItem: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.number,
]),

/**
Expand Down Expand Up @@ -319,7 +320,11 @@ Dropdown.propTypes = {
/**
* In the case you want to control the dropdown selection entirely.
*/
selectedItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
selectedItem: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.number,
]),

/**
* Specify the size of the ListBox. Currently supports either `sm`, `md` or `lg` as an option.
Expand Down