Skip to content

Commit

Permalink
Consume the className prop in OuiSearchBar (#1381)
Browse files Browse the repository at this point in the history
Also:
* deprecate `aria-label` and `data-test-subj` which have never been consumed despite being defined

Signed-off-by: Miki <[email protected]>
  • Loading branch information
AMoo-Miki authored Sep 4, 2024
1 parent 47c2960 commit 9e8cf07
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

### Deprecations

- Deprecate `aria-label` and `data-test-subj` of OuiSearchBar which have never been consumed despite being defined ([#1381](https://github.com/opensearch-project/oui/pull/1381))

### 🛡 Security

### 📈 Features/Enhancements
Expand All @@ -13,6 +15,7 @@
### 🐛 Bug Fixes

- Fix `compressed` styling of OuiDatePickerRange ([#1380](https://github.com/opensearch-project/oui/pull/1380))
- Make OuiSearchBar consume a provided `className` ([#1381](https://github.com/opensearch-project/oui/pull/1381))

### 🚞 Infrastructure

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ exports[`SearchBar render - box 1`] = `
exports[`SearchBar render - no config, no query 1`] = `
<OuiFlexGroup
alignItems="center"
className="testClass1 testClass2"
gutterSize="m"
wrap={true}
>
Expand All @@ -48,6 +49,7 @@ exports[`SearchBar render - no config, no query 1`] = `
exports[`SearchBar render - provided query, filters 1`] = `
<OuiFlexGroup
alignItems="center"
className="testClass1 testClass2"
gutterSize="m"
wrap={true}
>
Expand Down Expand Up @@ -153,6 +155,7 @@ exports[`SearchBar render - provided query, filters 1`] = `
exports[`SearchBar render - tools 1`] = `
<OuiFlexGroup
alignItems="center"
className="testClass1 testClass2"
gutterSize="m"
wrap={true}
>
Expand Down
13 changes: 12 additions & 1 deletion src/components/search_bar/search_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ export interface OuiSearchBarProps extends CommonProps {
dateFormat?: object;

compressed?: boolean;

// @deprecated This property has never been consumed despite being defined
'aria-label'?: string;

// @deprecated This property has never been consumed despite being defined
'data-test-subj'?: string;
}

const parseQuery = (
Expand Down Expand Up @@ -234,6 +240,7 @@ export class OuiSearchBar extends Component<OuiSearchBarProps, State> {
toolsLeft,
toolsRight,
compressed,
className,
} = this.props;

const toolsLeftEl = this.renderTools(toolsLeft);
Expand All @@ -252,7 +259,11 @@ export class OuiSearchBar extends Component<OuiSearchBarProps, State> {
const toolsRightEl = this.renderTools(toolsRight);

return (
<OuiFlexGroup gutterSize="m" alignItems="center" wrap>
<OuiFlexGroup
gutterSize="m"
alignItems="center"
className={className}
wrap>
{toolsLeftEl}
<OuiFlexItem className="ouiSearchBar__searchHolder" grow={true}>
<OuiSearchBox
Expand Down

0 comments on commit 9e8cf07

Please sign in to comment.