Skip to content

Commit

Permalink
add disabled prop to EuiComboBoxOption (#650)
Browse files Browse the repository at this point in the history
* add disabled prop to EuiComboBox option

* update readme

* override hover state, add disabled to example label
  • Loading branch information
nreese authored Apr 10, 2018
1 parent 1e41642 commit e4ec1cd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [`master`](https://github.com/elastic/eui/tree/master)

No public interface changes since `0.0.40`.
- add disabled prop to `EuiComboBoxOption` ([#650](https://github.com/elastic/eui/pull/650))

# [`0.0.40`](https://github.com/elastic/eui/tree/v0.0.40)

Expand Down
3 changes: 2 additions & 1 deletion src-docs/src/views/combo_box/combo_box.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export default class extends Component {
label: 'Titan',
'data-test-subj': 'titanOption',
}, {
label: 'Enceladus',
label: 'Enceladus is disabled',
disabled: true,
}, {
label: 'Mimas',
}, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,11 @@
color: $euiColorPrimary;
background-color: $euiFocusBackgroundColor;
}
&:disabled {
color: $euiColorMediumShade;
cursor: not-allowed;
&:hover {
text-decoration: none;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class EuiComboBoxOption extends Component {
optionRef: PropTypes.func,
onClick: PropTypes.func.isRequired,
onEnterKey: PropTypes.func.isRequired,
disabled: PropTypes.bool,
}

onClick = () => {
Expand All @@ -38,6 +39,7 @@ export class EuiComboBoxOption extends Component {
option, // eslint-disable-line no-unused-vars
onClick, // eslint-disable-line no-unused-vars
onEnterKey, // eslint-disable-line no-unused-vars
disabled,
...rest
} = this.props;

Expand All @@ -54,6 +56,7 @@ export class EuiComboBoxOption extends Component {
onKeyDown={this.onKeyDown}
ref={optionRef}
tabIndex="-1"
disabled={disabled}
{...rest}
>
{children}
Expand Down

0 comments on commit e4ec1cd

Please sign in to comment.