-
Notifications
You must be signed in to change notification settings - Fork 879
Ensure unique ID in combobox with prepended or appended labels #5229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
7c66cc2
73378d9
3ffdd53
6e93b4a
f32728a
974165a
e70a6b1
948b5c0
3c096fa
679f0a5
5014b77
0b3ec95
ccd4f7e
4d13fd7
0f5082a
47aea43
953d91e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import React, { useState } from 'react'; | ||
|
|
||
| import { EuiComboBox } from '../../../../src/components'; | ||
|
|
||
| const options = [ | ||
| { | ||
| label: 'Titan', | ||
| 'data-test-subj': 'titanOption', | ||
| }, | ||
| { | ||
| label: 'Enceladus', | ||
| }, | ||
| { | ||
| label: 'Mimas', | ||
| }, | ||
| { | ||
| label: 'Dione', | ||
| }, | ||
| { | ||
| label: 'Iapetus', | ||
| }, | ||
| { | ||
| label: 'Phoebe', | ||
| }, | ||
| { | ||
| label: 'Rhea', | ||
| }, | ||
| { | ||
| label: | ||
| "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology", | ||
| }, | ||
| { | ||
| label: 'Tethys', | ||
| }, | ||
| { | ||
| label: 'Hyperion', | ||
| }, | ||
| ]; | ||
|
|
||
| export default () => { | ||
| const [selectedOptions, setSelected] = useState([options[2]]); | ||
|
|
||
| const onChange = (selectedOptions) => { | ||
| // We should only get back either 0 or 1 options. | ||
| setSelected(selectedOptions); | ||
| }; | ||
|
|
||
| return ( | ||
| <EuiComboBox | ||
| prepend="Prepend" | ||
| singleSelection={{ asPlainText: true }} | ||
| options={options} | ||
| selectedOptions={selectedOptions} | ||
| onChange={onChange} | ||
| /> | ||
| ); | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,37 @@ | ||
| .euiComboBox { | ||
| // Round the left border when we append a label | ||
| &--appended { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cchaos I found a better way to isolate these rounded corners from your original comment, and was able to include the smaller rounded border for compressed views.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That it is. I didn't anticipate this scenario, so I'll pick it up in the morning for another look. Thanks Caroline!
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cchaos I've posted a fix and added a Visual Testing Matrix comment to the description. I think we should have them all bracketed this time. |
||
| .euiFormControlLayout__childrenWrapper { | ||
| border-top-left-radius: $euiFormControlBorderRadius; | ||
| border-bottom-left-radius: $euiFormControlBorderRadius; | ||
| } | ||
|
|
||
| // Half size rounded left corners | ||
| .euiFormControlLayout--compressed { | ||
| .euiFormControlLayout__childrenWrapper { | ||
| border-top-left-radius: $euiFormControlCompressedBorderRadius; | ||
| border-bottom-left-radius: $euiFormControlCompressedBorderRadius; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Round the right border when we prepend a label | ||
| &--prepended { | ||
| .euiFormControlLayout__childrenWrapper { | ||
| border-top-right-radius: $euiFormControlBorderRadius; | ||
| border-bottom-right-radius: $euiFormControlBorderRadius; | ||
| } | ||
|
|
||
| // Half size rounded right corners | ||
| .euiFormControlLayout--compressed { | ||
| .euiFormControlLayout__childrenWrapper { | ||
| border-top-right-radius: $euiFormControlCompressedBorderRadius; | ||
| border-bottom-right-radius: $euiFormControlCompressedBorderRadius; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| .euiFormControlLayout--group { | ||
| border-radius: $euiFormControlBorderRadius; | ||
| background-color: $euiFormInputGroupLabelBackground; | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.