From fd8d3adc770268787357a11692fea8eefaba8f09 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 10 Apr 2018 13:53:41 -0600 Subject: [PATCH 1/3] add disabled prop to EuiComboBox option --- src-docs/src/views/combo_box/combo_box.js | 1 + .../combo_box/combo_box_options_list/_combo_box_option.scss | 4 ++++ .../combo_box/combo_box_options_list/combo_box_option.js | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src-docs/src/views/combo_box/combo_box.js b/src-docs/src/views/combo_box/combo_box.js index bd01a4bae0b..db4e89f720b 100644 --- a/src-docs/src/views/combo_box/combo_box.js +++ b/src-docs/src/views/combo_box/combo_box.js @@ -13,6 +13,7 @@ export default class extends Component { 'data-test-subj': 'titanOption', }, { label: 'Enceladus', + disabled: true, }, { label: 'Mimas', }, { diff --git a/src/components/combo_box/combo_box_options_list/_combo_box_option.scss b/src/components/combo_box/combo_box_options_list/_combo_box_option.scss index 7f37487eb80..6afefe9431a 100644 --- a/src/components/combo_box/combo_box_options_list/_combo_box_option.scss +++ b/src/components/combo_box/combo_box_options_list/_combo_box_option.scss @@ -16,4 +16,8 @@ color: $euiColorPrimary; background-color: $euiFocusBackgroundColor; } + &:disabled { + color: $euiColorMediumShade; + cursor: not-allowed; + } } diff --git a/src/components/combo_box/combo_box_options_list/combo_box_option.js b/src/components/combo_box/combo_box_options_list/combo_box_option.js index e3f9a77b568..e09d7219e1f 100644 --- a/src/components/combo_box/combo_box_options_list/combo_box_option.js +++ b/src/components/combo_box/combo_box_options_list/combo_box_option.js @@ -38,6 +38,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; @@ -54,6 +55,7 @@ export class EuiComboBoxOption extends Component { onKeyDown={this.onKeyDown} ref={optionRef} tabIndex="-1" + disabled={disabled} {...rest} > {children} From c57ed7d0a6f42014fca3712e87e028c363703dcd Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 10 Apr 2018 13:59:18 -0600 Subject: [PATCH 2/3] update readme --- CHANGELOG.md | 2 +- .../combo_box/combo_box_options_list/combo_box_option.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 569f32036f1..8a5f2f7a59b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/components/combo_box/combo_box_options_list/combo_box_option.js b/src/components/combo_box/combo_box_options_list/combo_box_option.js index e09d7219e1f..184712686a9 100644 --- a/src/components/combo_box/combo_box_options_list/combo_box_option.js +++ b/src/components/combo_box/combo_box_options_list/combo_box_option.js @@ -14,6 +14,7 @@ export class EuiComboBoxOption extends Component { optionRef: PropTypes.func, onClick: PropTypes.func.isRequired, onEnterKey: PropTypes.func.isRequired, + disabled: PropTypes.bool, } onClick = () => { From 84ca9e4ec86ef2567536a228fc1e0c4e4e2d0a1c Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 10 Apr 2018 15:05:45 -0600 Subject: [PATCH 3/3] override hover state, add disabled to example label --- src-docs/src/views/combo_box/combo_box.js | 2 +- .../combo_box/combo_box_options_list/_combo_box_option.scss | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src-docs/src/views/combo_box/combo_box.js b/src-docs/src/views/combo_box/combo_box.js index db4e89f720b..647af621fbb 100644 --- a/src-docs/src/views/combo_box/combo_box.js +++ b/src-docs/src/views/combo_box/combo_box.js @@ -12,7 +12,7 @@ export default class extends Component { label: 'Titan', 'data-test-subj': 'titanOption', }, { - label: 'Enceladus', + label: 'Enceladus is disabled', disabled: true, }, { label: 'Mimas', diff --git a/src/components/combo_box/combo_box_options_list/_combo_box_option.scss b/src/components/combo_box/combo_box_options_list/_combo_box_option.scss index 6afefe9431a..f38453417b4 100644 --- a/src/components/combo_box/combo_box_options_list/_combo_box_option.scss +++ b/src/components/combo_box/combo_box_options_list/_combo_box_option.scss @@ -19,5 +19,8 @@ &:disabled { color: $euiColorMediumShade; cursor: not-allowed; + &:hover { + text-decoration: none; + } } }