Skip to content
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

Input groups #961

Merged
merged 28 commits into from
Jul 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f5f82c6
Updating filter buttons and group styles
Jun 26, 2018
8c01c96
Using form layout and notifications
Jun 26, 2018
27f04ae
Fixing icon padding
Jun 26, 2018
70bc54d
Control groups
Jun 27, 2018
c1b5c24
Simplifying from control styles
Jun 27, 2018
abc855f
form control layout children
Jun 28, 2018
c2e8a73
Simplifying form control styles
Jun 28, 2018
66647f0
Revert commit of filter_button.scss
Jun 28, 2018
2eea143
Get rid of terrible IE highlight when select is focused
Jun 28, 2018
d48cd3e
Squashed commit of the following:
Jun 28, 2018
37899c3
Updating to use prepend/append props
Jun 28, 2018
88b2fdd
Adding options to select, text, and number controls
Jun 28, 2018
15d201b
changelog
Jun 29, 2018
a4c2760
Merge remote-tracking branch 'cchaos/form-controls-styles' into filte…
Jun 29, 2018
6ea467c
Merge remote-tracking branch 'upstream/master' into filter-input-groups
Jun 29, 2018
9802500
Removing FormControlGroup
Jun 29, 2018
75b5e13
Merge remote-tracking branch 'upstream/master' into filter-input-groups
Jun 29, 2018
0af05cb
Get rid of console error
Jun 29, 2018
7c656a0
Updating filter groups
Jun 29, 2018
d19c365
Updating `EuiSearchBar`’s usage of filters
Jul 2, 2018
e0c9bfd
Added `DatePickerRange` component
Jul 2, 2018
130d872
Forgot to remove one more part of non-existent comp
Jul 2, 2018
96c2c0c
Merge remote-tracking branch 'upstream/master' into filter-input-groups
Jul 2, 2018
b7af0dd
changelog
Jul 2, 2018
39ab710
Merge remote-tracking branch 'upstream/master' into filter-input-groups
Jul 10, 2018
de21e4d
Merge remote-tracking branch 'upstream/master' into filter-input-groups
Jul 10, 2018
a5d4106
Merge remote-tracking branch 'upstream/master' into filter-input-groups
Jul 13, 2018
9ba5136
Addressed PR feedback
Jul 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Fixed `EuiHeader` responsive styles ([#1009](https://github.com/elastic/eui/pull/1009))
- Added `prepend` and `append` props to `EuiFormControlLayout` ([#961](https://github.com/elastic/eui/pull/961))
- Updated style implementation of `EuiFilterGroup` and `EuiFilterGroupButton` ([#961](https://github.com/elastic/eui/pull/961))
- Added `EuiDatePickerRange` as a way to layout two `EuiDatePicker`s. ([#961](https://github.com/elastic/eui/pull/961))

**Breaking changes**

Expand Down
4 changes: 2 additions & 2 deletions src-docs/src/views/button/button_icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const colors = [
export default () => (
<EuiFlexGroup gutterSize="s" alignItems="center">
{
colors.map(color => (
<EuiFlexItem grow={false}>
colors.map((color) => (
<EuiFlexItem key={color} grow={false}>
<EuiButtonIcon
size="s"
color={color}
Expand Down
7 changes: 6 additions & 1 deletion src-docs/src/views/date_picker/date_picker_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
EuiCode,
EuiLink,
EuiDatePicker,
EuiDatePickerRange,
} from '../../../../src/components';

import DatePicker from './date_picker';
Expand Down Expand Up @@ -144,10 +145,14 @@ export const DatePickerExample = {
text: (
<p>
By passing <EuiCode>startDate</EuiCode> and <EuiCode>endDate</EuiCode> props
you can provide styling the range in between two dates.
you can provide styling the range in between two dates. To further style the
group as a single control, use <EuiCode>EuiDatePickerRange</EuiCode> and pass
the date picker controls into
the <EuiCode>startDateControl</EuiCode> and <EuiCode>endDateControl</EuiCode> props.
</p>
),
demo: <Range />,
props: { EuiDatePickerRange },
}, {
title: 'Only allow specific dates and times',
source: [{
Expand Down
52 changes: 25 additions & 27 deletions src-docs/src/views/date_picker/range.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import moment from 'moment';

import {
EuiDatePicker,
EuiFlexGroup,
EuiFlexItem,
EuiFormRow,
EuiDatePickerRange,
} from '../../../../src/components';

export default class extends Component {
Expand Down Expand Up @@ -39,30 +37,30 @@ export default class extends Component {

render() {
return (
<EuiFlexGroup gutterSize="none">
<EuiFlexItem grow={false}>
<EuiFormRow label="Start date">
<EuiDatePicker
selected={this.state.startDate}
onChange={this.handleChangeStart}
startDate={this.state.startDate}
endDate={this.state.endDate}
showTimeSelect
/>
</EuiFormRow>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiFormRow label="End date">
<EuiDatePicker
selected={this.state.endDate}
onChange={this.handleChangeEnd}
startDate={this.state.startDate}
endDate={this.state.endDate}
showTimeSelect
/>
</EuiFormRow>
</EuiFlexItem>
</EuiFlexGroup>
<EuiDatePickerRange
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add simple validation to ensure the start date is before end date?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for the doc example?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, since validation lives outside the controls. Would be good to have a reference example.

startDateControl={
<EuiDatePicker
selected={this.state.startDate}
onChange={this.handleChangeStart}
startDate={this.state.startDate}
endDate={this.state.endDate}
isInvalid={this.state.startDate > this.state.endDate}
aria-label="Start date"
showTimeSelect
/>
}
endDateControl={
<EuiDatePicker
selected={this.state.endDate}
onChange={this.handleChangeEnd}
startDate={this.state.startDate}
endDate={this.state.endDate}
isInvalid={this.state.startDate > this.state.endDate}
aria-label="End date"
showTimeSelect
/>
}
/>
);
}
}
36 changes: 32 additions & 4 deletions src-docs/src/views/filter_group/filter_group.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,32 @@ export default class extends Component {

this.state = {
isPopoverOpen: false,
isFilterOn: false,
isOnFilterOn: false,
isOffFilterOn: false,
};
}

toggleFilter = () => {
this.setState(prevState => ({
isFilterOn: !prevState.isFilterOn,
}));
}

toggleOnFilter = () => {
this.setState(prevState => ({
isOnFilterOn: !prevState.isOnFilterOn,
isOffFilterOn: prevState.isOffFilterOn && !prevState.isOnFilterOn ? false : prevState.isOffFilterOn,
}));
}

toggleOffFilter = () => {
this.setState(prevState => ({
isOffFilterOn: !prevState.isOffFilterOn,
isOnFilterOn: prevState.isOnFilterOn && !prevState.isOffFilterOn ? false : prevState.isOnFilterOn,
}));
}

onButtonClick() {
this.setState({
isPopoverOpen: !this.state.isPopoverOpen,
Expand Down Expand Up @@ -66,18 +89,23 @@ export default class extends Component {
onClick={this.onButtonClick.bind(this)}
isSelected={this.state.isPopoverOpen}
hasActiveFilters={true}
numFilters={2}
grow={true}
>
Composers
</EuiFilterButton>
);

return (
<EuiFilterGroup>
<EuiFilterButton>
Filter on
<EuiFilterButton hasActiveFilters={this.state.isFilterOn} onClick={this.toggleFilter}>
Filter
</EuiFilterButton>
<EuiFilterButton noDivider hasActiveFilters={this.state.isOnFilterOn} onClick={this.toggleOnFilter}>
On
</EuiFilterButton>
<EuiFilterButton>
Filter off
<EuiFilterButton hasActiveFilters={this.state.isOffFilterOn} onClick={this.toggleOffFilter}>
Off
</EuiFilterButton>
<EuiPopover
id="popover"
Expand Down
12 changes: 12 additions & 0 deletions src-docs/src/views/form_controls/field_number.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React, {
import {
EuiFieldNumber,
EuiSpacer,
EuiText,
} from '../../../../src/components';

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

<EuiSpacer size="m" />

<EuiFieldNumber
style={{ textAlign: 'right' }}
append={<EuiText size="xs"><strong>%</strong></EuiText>}
placeholder="0 - 100"
value={this.state.value}
onChange={this.onChange}
aria-label="Use aria labels when no actual label is in use"
/>
</Fragment>
);
}
Expand Down
29 changes: 29 additions & 0 deletions src-docs/src/views/form_controls/form_control_layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import React, {
import {
EuiFormControlLayout,
EuiSpacer,
EuiFormLabel,
EuiButtonEmpty,
EuiText,
} from '../../../../src/components';

export default () => (
Expand Down Expand Up @@ -106,5 +109,31 @@ export default () => (
>
<input type="text" className="euiFieldText" />
</EuiFormControlLayout>

<EuiSpacer size="m" />

<EuiFormControlLayout
prepend={<EuiFormLabel htmlFor="textField19">Label</EuiFormLabel>}
>
<input type="text" className="euiFieldText euiFieldText--inGroup" id="textField19" />
</EuiFormControlLayout>

<EuiSpacer size="m" />

<EuiFormControlLayout
append={<EuiText size="xs"><strong>%</strong></EuiText>}
>
<input type="number" className="euiFieldNumber euiFieldNumber--inGroup" />
</EuiFormControlLayout>

<EuiSpacer size="m" />

<EuiFormControlLayout
isLoading
clear={{ onClick: () => {} }}
prepend={<EuiButtonEmpty size="xs" iconType="arrowDown" iconSide="right">Button</EuiButtonEmpty>}
>
<input type="text" className="euiFieldText euiFieldText--inGroup" />
</EuiFormControlLayout>
</Fragment>
);
7 changes: 5 additions & 2 deletions src/components/button/button_empty/_button_empty.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
/**
* 1. We don't want any of the animations that come inherited from the mixin.
* These should act like normal links instead.
* 2. Change the easing, quickness to not bounce so lighter backgrounds don't flash
*/
.euiButtonEmpty {
@include euiButton;

border-color: transparent;
background-color: transparent;
box-shadow: none;
transform: none !important; // 1
animation: none !important; // 1
transform: none !important; /* 1 */
animation: none !important; /* 1 */
transition-timing-function: ease-in; /* 2 */
transition-duration: $euiAnimSpeedFast; /* 2 */

.euiButtonEmpty__content {
@include euiButtonContent;
Expand Down
2 changes: 2 additions & 0 deletions src/components/button/button_empty/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export {
COLORS,
ICON_SIDES,
EuiButtonEmpty,
} from './button_empty';
5 changes: 4 additions & 1 deletion src/components/button/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export { EuiButton } from './button';
export {
COLORS,
EuiButton
} from './button';

export {
EuiButtonEmpty,
Expand Down
84 changes: 44 additions & 40 deletions src/components/combo_box/__snapshots__/combo_box.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,58 @@ exports[`EuiComboBox is rendered 1`] = `
class="euiFormControlLayout"
>
<div
class="euiComboBox__inputWrap"
data-test-subj="comboBoxInput"
class="euiFormControlLayout__childrenWrapper"
>
<div
class="euiComboBox__input"
style="font-size:14px;display:inline-block"
class="euiComboBox__inputWrap"
data-test-subj="comboBoxInput"
>
<input
aria-hidden="true"
data-test-subj="comboBoxSearchInput"
style="box-sizing:content-box;width:1px"
value=""
/>
<div
style="position:absolute;top:0;left:0;visibility:hidden;height:0;overflow:scroll;white-space:pre"
/>
class="euiComboBox__input"
style="font-size:14px;display:inline-block"
>
<input
aria-hidden="true"
data-test-subj="comboBoxSearchInput"
style="box-sizing:content-box;width:1px"
value=""
/>
<div
style="position:absolute;top:0;left:0;visibility:hidden;height:0;overflow:scroll;white-space:pre"
/>
</div>
</div>
</div>
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
>
<button
aria-label="Open list of options"
class="euiFormControlLayoutCustomIcon euiFormControlLayoutCustomIcon--clickable"
data-test-subj="comboBoxToggleListButton"
<div
class="euiFormControlLayoutIcons euiFormControlLayoutIcons--right"
>
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiFormControlLayoutCustomIcon__icon"
focusable="false"
height="16"
viewBox="0 0 16 16"
width="16"
xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
<button
aria-label="Open list of options"
class="euiFormControlLayoutCustomIcon euiFormControlLayoutCustomIcon--clickable"
data-test-subj="comboBoxToggleListButton"
>
<defs>
<path
d="M13.069 5.157L8.384 9.768a.546.546 0 0 1-.768 0L2.93 5.158a.552.552 0 0 0-.771 0 .53.53 0 0 0 0 .759l4.684 4.61c.641.631 1.672.63 2.312 0l4.684-4.61a.53.53 0 0 0 0-.76.552.552 0 0 0-.771 0z"
id="arrow_down-a"
<svg
aria-hidden="true"
class="euiIcon euiIcon--medium euiFormControlLayoutCustomIcon__icon"
focusable="false"
height="16"
viewBox="0 0 16 16"
width="16"
xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
>
<defs>
<path
d="M13.069 5.157L8.384 9.768a.546.546 0 0 1-.768 0L2.93 5.158a.552.552 0 0 0-.771 0 .53.53 0 0 0 0 .759l4.684 4.61c.641.631 1.672.63 2.312 0l4.684-4.61a.53.53 0 0 0 0-.76.552.552 0 0 0-.771 0z"
id="arrow_down-a"
/>
</defs>
<use
fill-rule="nonzero"
href="#arrow_down-a"
/>
</defs>
<use
fill-rule="nonzero"
href="#arrow_down-a"
/>
</svg>
</button>
</svg>
</button>
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/combo_box/_combo_box.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 3. The height on combo can be larger than normal text inputs.
*/
.euiComboBox__inputWrap {
@include euiFormControlStyle($includeStates: false);
@include euiFormControlStyle($includeStates: false, $includeSizes:false);
@include euiFormControlWithIcon($isIconOptional: true);
@include euiFormControlSize(auto); /* 3 */

Expand Down
Loading