Skip to content

Commit

Permalink
fix(tabletoolbarsearch): update default size to be lg (#11621)
Browse files Browse the repository at this point in the history
* fix(tabletoolbarsearch): update default size to be lg

* chore: update snaps
  • Loading branch information
tay1orjones authored Jun 22, 2022
1 parent 8a9c11e commit 9ca13ee
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
20 changes: 20 additions & 0 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1961,6 +1961,16 @@ Map {
"searchContainerClass": Object {
"type": "string",
},
"size": Object {
"args": Array [
Array [
"sm",
"md",
"lg",
],
],
"type": "oneOf",
},
"tabIndex": Object {
"args": Array [
Array [
Expand Down Expand Up @@ -7062,6 +7072,16 @@ Map {
"searchContainerClass": Object {
"type": "string",
},
"size": Object {
"args": Array [
Array [
"sm",
"md",
"lg",
],
],
"type": "oneOf",
},
"tabIndex": Object {
"args": Array [
Array [
Expand Down
7 changes: 7 additions & 0 deletions packages/react/src/components/DataTable/TableToolbarSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const TableToolbarSearch = ({
id,
onBlur,
onFocus,
size = 'lg',
...rest
}) => {
const { current: controlled } = useRef(expandedProp !== undefined);
Expand Down Expand Up @@ -111,6 +112,7 @@ const TableToolbarSearch = ({
onFocus ? (event) => onFocus(event, handleExpand) : handleOnFocus
}
onBlur={onBlur ? (event) => onBlur(event, handleExpand) : handleOnBlur}
size={size}
{...rest}
/>
);
Expand Down Expand Up @@ -198,6 +200,11 @@ TableToolbarSearch.propTypes = {
*/
searchContainerClass: PropTypes.string,

/**
* Specify the size of the Search
*/
size: PropTypes.oneOf(['sm', 'md', 'lg']),

/**
* Optional prop to specify the tabIndex of the <Search> (in expanded state) or the container (in collapsed state)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2317,13 +2317,14 @@ exports[`DataTable should render 1`] = `
onClear={[Function]}
onFocus={[Function]}
placeholder="Filter table"
size="lg"
tabIndex="0"
type="text"
value=""
>
<div
aria-labelledby="custom-id-search"
className="cds--search cds--search--xl cds--toolbar-search-container-persistent"
className="cds--search cds--search--lg cds--toolbar-search-container-persistent"
role="search"
>
<div
Expand Down Expand Up @@ -3335,13 +3336,14 @@ exports[`DataTable sticky header should render 1`] = `
onClear={[Function]}
onFocus={[Function]}
placeholder="Filter table"
size="lg"
tabIndex="0"
type="text"
value=""
>
<div
aria-labelledby="custom-id-search"
className="cds--search cds--search--xl cds--toolbar-search-container-persistent"
className="cds--search cds--search--lg cds--toolbar-search-container-persistent"
role="search"
>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ exports[`DataTable.TableToolbarSearch should render 1`] = `
onClear={[Function]}
onFocus={[Function]}
placeholder="Filter table"
size="lg"
tabIndex="0"
type="text"
value=""
>
<div
aria-labelledby="custom-id-search"
className="cds--search cds--search--xl custom-class cds--toolbar-search-container-expandable"
className="cds--search cds--search--lg custom-class cds--toolbar-search-container-expandable"
role="search"
>
<div
Expand Down

0 comments on commit 9ca13ee

Please sign in to comment.