Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Custom placeholder removed
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishkumbhare116 authored and KV106606Viswanath committed Oct 31, 2023
1 parent b701e56 commit 649218f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
3 changes: 3 additions & 0 deletions packages/terra-form-select/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

*Fixed
*Fixed the `combobox` won't take custom placeholder text and only string `-Select- ` will be shown.

## 6.49.0 - (October 23, 2023)

* Changed
Expand Down
21 changes: 3 additions & 18 deletions packages/terra-form-select/src/Combobox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ const propTypes = {
* Callback function invoked for each option on search change. function(searchValue, option)
*/
optionFilter: PropTypes.func,
/**
* Placeholder text.
*/
placeholder: PropTypes.string,
/**
* Whether the field is required.
*/
Expand Down Expand Up @@ -122,7 +118,6 @@ const defaultProps = {
onSearch: undefined,
onSelect: undefined,
optionFilter: undefined,
placeholder: undefined,
required: false,
value: undefined,
inputId: undefined,
Expand Down Expand Up @@ -200,20 +195,10 @@ class Combobox extends React.Component {

render() {
const {
allowClear, children, defaultValue, onChange, placeholder, required, value, intl, inputId, ...otherProps
allowClear, children, defaultValue, onChange, required, value, intl, inputId, ...otherProps
} = this.props;

const defaultPlaceholder = intl.formatMessage({ id: 'Terra.form.select.defaultDisplay' });
const selectPlaceholder = placeholder === undefined ? defaultPlaceholder : placeholder;
let clearOptionDisplay;

if (allowClear) {
if (selectPlaceholder.length === 0) {
clearOptionDisplay = defaultPlaceholder;
} else {
clearOptionDisplay = selectPlaceholder;
}
}

return (
<Frame
Expand All @@ -223,10 +208,10 @@ class Combobox extends React.Component {
display={this.display()}
onDeselect={this.handleDeselect}
onSelect={this.handleSelect}
placeholder={selectPlaceholder}
placeholder={defaultPlaceholder}
required={required}
totalOptions={SelectUtil.getTotalNumberOfOptions(children)}
clearOptionDisplay={clearOptionDisplay}
clearOptionDisplay={defaultPlaceholder}
inputId={inputId}
>
{this.state.tags}
Expand Down

0 comments on commit 649218f

Please sign in to comment.