Skip to content

Commit

Permalink
Allowing label to be passed from EuiFormGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
cchaos committed Aug 10, 2018
1 parent 95e87e0 commit e8c3fa0
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 11 deletions.
11 changes: 11 additions & 0 deletions src-docs/src/views/super_select/super_select.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React, {
import {
EuiSuperSelect,
EuiSpacer,
EuiFormRow,
} from '../../../../src/components';

export default class extends Component {
Expand Down Expand Up @@ -83,6 +84,16 @@ export default class extends Component {
onChange={this.onChange}
compressed
/>

<EuiSpacer size="m" />

<EuiFormRow label="With label">
<EuiSuperSelect
options={this.options}
valueOfSelected={this.state.value}
onChange={this.onChange}
/>
</EuiFormRow>
</Fragment>
);
}
Expand Down
1 change: 1 addition & 0 deletions src/components/form/checkbox/checkbox_group.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const EuiCheckboxGroup = ({
className,
disabled,
compressed,
label, // eslint-disable-line no-unused-vars
...rest
}) => (
<div className={className} {...rest}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ exports[`EuiDescribedFormGroup ties together parts for accessibility 1`] = `
<input
aria-describedby="test-id generated-id-help generated-id-error-0 generated-id-error-1"
id="generated-id"
label="Label"
onBlur={[Function]}
onFocus={[Function]}
/>
Expand Down
1 change: 1 addition & 0 deletions src/components/form/field_number/field_number.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const EuiFieldNumber = ({
compressed,
prepend,
append,
label, // eslint-disable-line no-unused-vars
...rest
}) => {
const classes = classNames('euiFieldNumber', className, {
Expand Down
1 change: 1 addition & 0 deletions src/components/form/field_password/field_password.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const EuiFieldPassword = ({
isLoading,
compressed,
inputRef,
label, // eslint-disable-line no-unused-vars
...rest
}) => {
const classes = classNames(
Expand Down
1 change: 1 addition & 0 deletions src/components/form/field_search/field_search.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export class EuiFieldSearch extends Component {
incremental,
compressed,
onSearch,
label, // eslint-disable-line no-unused-vars
...rest } = this.props;

const classes = classNames(
Expand Down
1 change: 1 addition & 0 deletions src/components/form/field_text/field_text.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const EuiFieldText = ({
compressed,
prepend,
append,
label, // eslint-disable-line no-unused-vars
...rest
}) => {
const classes = classNames('euiFieldText', className, {
Expand Down
1 change: 1 addition & 0 deletions src/components/form/file_picker/file_picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export class EuiFilePicker extends Component {
disabled,
compressed,
onChange, // eslint-disable-line no-unused-vars
label, // eslint-disable-line no-unused-vars
...rest
} = this.props;

Expand Down
22 changes: 22 additions & 0 deletions src/components/form/form_row/__snapshots__/form_row.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ exports[`EuiFormRow behavior onBlur is called in child 1`] = `
</EuiFormLabel>
<input
id="generated-id"
label={
<span>
Label
</span>
}
onBlur={[Function]}
onFocus={[Function]}
/>
Expand Down Expand Up @@ -67,6 +72,11 @@ exports[`EuiFormRow behavior onBlur works in parent even if not in child 1`] = `
</EuiFormLabel>
<input
id="generated-id"
label={
<span>
Label
</span>
}
onBlur={[Function]}
onFocus={[Function]}
/>
Expand Down Expand Up @@ -104,6 +114,11 @@ exports[`EuiFormRow behavior onFocus is called in child 1`] = `
</EuiFormLabel>
<input
id="generated-id"
label={
<span>
Label
</span>
}
onBlur={[Function]}
onFocus={[Function]}
/>
Expand Down Expand Up @@ -141,6 +156,11 @@ exports[`EuiFormRow behavior onFocus works in parent even if not in child 1`] =
</EuiFormLabel>
<input
id="generated-id"
label={
<span>
Label
</span>
}
onBlur={[Function]}
onFocus={[Function]}
/>
Expand Down Expand Up @@ -298,6 +318,7 @@ exports[`EuiFormRow props isInvalid is rendered 1`] = `
</label>
<input
id="generated-id"
label="label"
/>
</div>
`;
Expand All @@ -315,6 +336,7 @@ exports[`EuiFormRow props label is rendered 1`] = `
</EuiFormLabel>
<input
id="generated-id"
label="label"
onBlur={[Function]}
onFocus={[Function]}
/>
Expand Down
1 change: 1 addition & 0 deletions src/components/form/form_row/form_row.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export class EuiFormRow extends Component {
onFocus: this.onFocus,
onBlur: this.onBlur,
compressed: compressed,
label: label,
...optionalProps
});

Expand Down
1 change: 1 addition & 0 deletions src/components/form/radio/radio_group.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const EuiRadioGroup = ({
className,
disabled,
compressed,
label, // eslint-disable-line no-unused-vars
...rest
}) => (
<div className={className} {...rest}>
Expand Down
1 change: 1 addition & 0 deletions src/components/form/range/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class EuiRange extends Component {
onChange,
value,
style,
label, // eslint-disable-line no-unused-vars
...rest
} = this.props;

Expand Down
1 change: 1 addition & 0 deletions src/components/form/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const EuiSelect = ({
value,
prepend,
append,
label, // eslint-disable-line no-unused-vars
...rest
}) => {
const classes = classNames(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exports[`EuiSuperSelect is rendered 1`] = `
class="euiScreenReaderOnly"
id="generated-id"
>
Select an option: , is selected
Select an option: , is selected
</span>
<button
aria-haspopup="true"
Expand Down Expand Up @@ -97,7 +97,7 @@ exports[`EuiSuperSelect props custom display is propagated to dropdown 1`] = `
class="euiScreenReaderOnly"
id="generated-id"
>
Select an option: , is selected
Select an option: , is selected
</span>
<button
aria-haspopup="true"
Expand Down Expand Up @@ -169,7 +169,7 @@ exports[`EuiSuperSelect props options are rendered 1`] = `
class="euiScreenReaderOnly"
id="generated-id"
>
Select an option: , is selected
Select an option: , is selected
</span>
<button
aria-haspopup="true"
Expand Down Expand Up @@ -242,7 +242,7 @@ exports[`EuiSuperSelect props valueSelected is rendered 1`] = `
class="euiScreenReaderOnly"
id="generated-id"
>
Select an option: Option #1, is selected
Select an option: Option #1, is selected
</span>
<button
aria-haspopup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Array [
class="euiScreenReaderOnly"
id="generated-id"
>
Select an option: , is selected
Select an option: , is selected
</span>
<button
aria-haspopup="true"
Expand Down Expand Up @@ -79,7 +79,7 @@ Array [
class="euiScreenReaderOnly"
id="generated-id"
>
Select an option: , is selected
Select an option: , is selected
</span>
<button
aria-haspopup="true"
Expand Down Expand Up @@ -145,7 +145,7 @@ Array [
class="euiScreenReaderOnly"
id="generated-id"
>
Select an option: , is selected
Select an option: , is selected
</span>
<button
aria-haspopup="true"
Expand Down Expand Up @@ -204,7 +204,7 @@ Array [
class="euiScreenReaderOnly"
id="generated-id"
>
Select an option: , is selected
Select an option: , is selected
</span>
<button
aria-haspopup="true"
Expand Down Expand Up @@ -263,7 +263,7 @@ Array [
class="euiScreenReaderOnly"
id="generated-id"
>
Select an option: , is selected
Select an option: , is selected
</span>
<button
aria-haspopup="true"
Expand Down Expand Up @@ -332,7 +332,7 @@ Array [
class="euiScreenReaderOnly"
id="generated-id"
>
Select an option: , is selected
Select an option: , is selected
</span>
<button
aria-haspopup="true"
Expand Down Expand Up @@ -399,7 +399,7 @@ Array [
class="euiScreenReaderOnly"
id="generated-id"
>
Select an option: Option #1, is selected
Select an option: Option #1, is selected
</span>
<button
aria-haspopup="true"
Expand Down
2 changes: 2 additions & 0 deletions src/components/form/super_select/super_select_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const EuiSuperSelectControl = ({
defaultValue,
compressed,
value,
label,
...rest
}) => {
const classes = classNames(
Expand Down Expand Up @@ -94,6 +95,7 @@ export const EuiSuperSelectControl = ({
*/}
<EuiScreenReaderOnly>
<span id={screenReaderId}>
{label ? `${label}, ` : null}{' '}
Select an option: {selectedValue}, is selected
</span>
</EuiScreenReaderOnly>
Expand Down
1 change: 1 addition & 0 deletions src/components/form/text_area/text_area.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const EuiTextArea = ({
placeholder,
resize,
rows,
label, // eslint-disable-line no-unused-vars
...rest
}) => {
const classes = classNames(
Expand Down

0 comments on commit e8c3fa0

Please sign in to comment.