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

Updates form controls to use the Amsterdam border radius. #3741

Merged
merged 11 commits into from
Sep 8, 2020
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
- Changed `value` prop in `EuiExpression` to not required ([#4014](https://github.com/elastic/eui/pull/4014))
- Added `fold` and `unfold` glyphs to `EuiIcon` ([#3994](https://github.com/elastic/eui/pull/3994))

**Theme: Amsterdam**

- Updated `EuiFormControl` styles for Amsterdam. Elements now use a uniform border-radius. ([#3741](https://github.com/elastic/eui/pull/3741))

**Bug fixes**

- Fix incorrect `euiCodeBlockNameColor` variable usage for `.hljs-name` in SCSS ([#3991](https://github.com/elastic/eui/pull/3991))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
> .euiDatePickerRange {
max-width: none;
width: auto;
border-radius: 0 $euiFormControlBorderRadius $euiFormControlBorderRadius 0;
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/components/form/file_picker/_file_picker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@
position: relative;

&.euiFilePicker--large {
border-radius: $euiFormControlBorderRadius;
overflow: hidden;
height: auto;
}

&.euiFilePicker--large.euiFilePicker--compressed {
border-radius: $euiFormControlCompressedBorderRadius;
}
}

// The input is an invisiable dropzone / button
Expand Down Expand Up @@ -65,6 +71,7 @@
padding-right: $euiFormControlPadding;
padding-bottom: $euiFormControlPadding;
pointer-events: none; /* 1 */
border-radius: $euiFormControlBorderRadius;

// sass-lint:disable-block indentation
transition:
Expand All @@ -77,6 +84,7 @@
@include euiFormControlStyleCompressed($includeStates: false);
@include euiFormControlWithIcon($compressed: true); /* 2 */
height: $euiFormControlCompressedHeight;
border-radius: $euiFormControlCompressedBorderRadius;
}

.euiFilePicker--large & {
Expand Down
32 changes: 14 additions & 18 deletions src/components/suggest/__snapshots__/suggest.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,25 @@
exports[`EuiSuggest is rendered 1`] = `
<div>
<div
class="euiSuggestInput testClass1 testClass2"
class="euiPopover euiPopover--anchorDownLeft euiPopover--displayBlock euiInputPopover euiInputPopover--fullWidth euiSuggestInput testClass1 testClass2"
>
<div
class="euiPopover euiPopover--anchorDownLeft euiPopover--displayBlock euiInputPopover euiInputPopover--fullWidth"
class="euiPopover__anchor"
>
<div
class="euiPopover__anchor"
>
<div>
<div>
<div
class="euiFormControlLayout euiFormControlLayout--fullWidth"
>
<div
class="euiFormControlLayout euiFormControlLayout--fullWidth euiFormControlLayout--group"
class="euiFormControlLayout__childrenWrapper"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<input
aria-label="aria-label"
class="euiFieldText euiFieldText--fullWidth euiFieldText--inGroup"
data-test-subj="test subject string"
type="text"
value=""
/>
</div>
<input
aria-label="aria-label"
class="euiFieldText euiFieldText--fullWidth"
data-test-subj="test subject string"
type="text"
value=""
/>
</div>
</div>
</div>
Expand Down
50 changes: 23 additions & 27 deletions src/components/suggest/__snapshots__/suggest_input.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,35 @@

exports[`EuiSuggestInput is rendered 1`] = `
<div
class="euiSuggestInput testClass1 testClass2"
class="euiPopover euiPopover--anchorDownLeft euiPopover--displayBlock euiInputPopover euiInputPopover--fullWidth euiSuggestInput testClass1 testClass2"
>
<div
class="euiPopover euiPopover--anchorDownLeft euiPopover--displayBlock euiInputPopover euiInputPopover--fullWidth"
class="euiPopover__anchor"
>
<div
class="euiPopover__anchor"
>
<div>
<div>
<div
class="euiFormControlLayout euiFormControlLayout--fullWidth euiFormControlLayout--group"
>
<div
class="euiFormControlLayout euiFormControlLayout--fullWidth euiFormControlLayout--group"
class="euiFormControlLayout__childrenWrapper"
>
<div
class="euiFormControlLayout__childrenWrapper"
>
<input
aria-label="aria-label"
class="euiFieldText euiFieldText--fullWidth euiFieldText--inGroup"
data-test-subj="test subject string"
type="text"
value=""
/>
</div>
<span
class="euiToolTipAnchor"
>
<div
class="euiSuggestInput__statusIcon"
color="accent"
data-euiicon-type="dot"
/>
</span>
<input
aria-label="aria-label"
class="euiFieldText euiFieldText--fullWidth euiFieldText--inGroup"
data-test-subj="test subject string"
type="text"
value=""
/>
</div>
<span
class="euiToolTipAnchor"
>
<div
class="euiSuggestInput__statusIcon"
color="accent"
data-euiicon-type="dot"
/>
</span>
</div>
</div>
</div>
Expand Down
11 changes: 3 additions & 8 deletions src/components/suggest/_suggest_input.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
.euiSuggestInput {
font-size: $euiFontSizeS;
color: $euiColorPrimary;

.euiSuggestInput__statusIcon {
// sass-lint:disable-block no-important
background-color: transparent !important; // Override typical append coloring
}
.euiSuggestInput__statusIcon {
// sass-lint:disable-block no-important
background-color: transparent !important; // Override typical append coloring
}
21 changes: 10 additions & 11 deletions src/components/suggest/suggest_input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,22 @@ export const EuiSuggestInput: FunctionComponent<EuiSuggestInputProps> = props =>
<EuiFieldText
value={value}
fullWidth
append={appendArray}
append={appendArray.length ? appendArray : undefined}
isLoading={status === 'loading' ? true : false}
onChange={onFieldChange}
{...rest}
/>
);

return (
<div className={classes}>
<EuiInputPopover
input={customInput}
isOpen={isPopoverOpen}
panelPaddingSize="none"
fullWidth
closePopover={closePopover}>
<div>{suggestions}</div>
</EuiInputPopover>
</div>
<EuiInputPopover
className={classes}
input={customInput}
isOpen={isPopoverOpen}
panelPaddingSize="none"
fullWidth
closePopover={closePopover}>
{suggestions}
</EuiInputPopover>
);
};
4 changes: 2 additions & 2 deletions src/global_styling/mixins/_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
@include euiFormControlText;

border: none;
border-radius: 0;
border-radius: $euiFormControlBorderRadius;
padding: $euiFormControlPadding;

@if ($includeStates) {
Expand Down Expand Up @@ -301,7 +301,7 @@
@if $type == 'round' {
border-radius: $size;
} @else if $type == 'square' {
border-radius: $euiBorderRadius;
border-radius: $euiCheckboxBorderRadius;
}
// sass-lint:disable-block indentation
transition: background-color $euiAnimSpeedFast ease-in,
Expand Down
2 changes: 2 additions & 0 deletions src/global_styling/variables/_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ $euiFormControlHeight: $euiSizeXXL !default;
$euiFormControlCompressedHeight: $euiSizeXL !default;
$euiFormControlPadding: $euiSizeM !default;
$euiFormControlCompressedPadding: $euiSizeS !default;
$euiFormControlBorderRadius: 0 !default;
$euiFormControlCompressedBorderRadius: $euiBorderRadius / 2 !default;

$euiRadioSize: $euiSize !default;
$euiCheckBoxSize: $euiSize !default;
$euiCheckboxBorderRadius: $euiBorderRadius !default;

// Switch
$euiSwitchHeight: $euiSize * 1.25 !default;
Expand Down
34 changes: 34 additions & 0 deletions src/themes/eui-amsterdam/global_styling/mixins/_form.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Removes some box-shadows
@mixin euiFormControlFocusStyle($borderOnly: false) {
// sass-lint:disable-block indentation, empty-args
background-color: tintOrShade($euiColorEmptyShade, 0%, 40%);
background-image: euiFormControlGradient();
background-size: 100% 100%; // 1

@if ($borderOnly) {
box-shadow: inset 0 0 0 1px $euiFormBorderColor;
} @else {
box-shadow:
inset 0 0 0 1px $euiFormBorderColor;
}
}

// Removes euiSlightShadow
@mixin euiCustomControl($type: null, $size: $euiSize) {
@if $size {
$size: $size - 2px; // subtract 2px from size to account for border size
padding: $size / 2;
}

border: 1px solid $euiFormCustomControlBorderColor;
background: $euiColorEmptyShade no-repeat center;

@if $type == 'round' {
border-radius: $size;
} @else if $type == 'square' {
border-radius: $euiCheckboxBorderRadius;
}
// sass-lint:disable-block indentation
transition: background-color $euiAnimSpeedFast ease-in,
border-color $euiAnimSpeedFast ease-in;
}
1 change: 1 addition & 0 deletions src/themes/eui-amsterdam/global_styling/mixins/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
@import 'button';
@import 'panel';
@import 'shadow';
@import 'form';
6 changes: 6 additions & 0 deletions src/themes/eui-amsterdam/global_styling/variables/_form.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$euiFormControlBorderRadius: $euiBorderRadius;
$euiFormControlCompressedBorderRadius: $euiBorderRadiusSmall;

$euiFormControlBoxShadow: 0 0;

$euiCheckboxBorderRadius: $euiBorderRadiusSmall;
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@import 'buttons';
@import 'borders';
@import 'flyout';
@import 'form';
@import 'header';
@import 'typography';
@import 'shadows';
@import 'shadows';
78 changes: 78 additions & 0 deletions src/themes/eui-amsterdam/overrides/_form_control_layout.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
.euiFormControlLayout--group {
$leftSideRadius: $euiFormControlBorderRadius 0 0 $euiFormControlBorderRadius;
$rightSideRadius: 0 $euiFormControlBorderRadius $euiFormControlBorderRadius 0;
$leftSideRadiusSmall: $euiFormControlCompressedBorderRadius 0 0 $euiFormControlCompressedBorderRadius;
$rightSideRadiusSmall: 0 $euiFormControlCompressedBorderRadius $euiFormControlCompressedBorderRadius 0;

border-radius: $euiFormControlBorderRadius;

.euiFormControlLayout__prepend:first-child {
border-radius: $leftSideRadius;

[class*='euiButton'] {
border-radius: $leftSideRadius;
}
}

.euiFormControlLayout__append:last-child {
border-radius: $rightSideRadius;

[class*='euiButton'] {
border-radius: $rightSideRadius;
}
}

.euiToolTipAnchor:first-child [class*='euiButton'] {
border-radius: $leftSideRadius;
}

.euiToolTipAnchor:last-child [class*='euiButton'] {
border-radius: $rightSideRadius;
}

.euiFormControlLayout__childrenWrapper:nth-child(2) [class*='euiField'],
.euiFormControlLayout__childrenWrapper:nth-child(3) [class*='euiField'] {
border-radius: 0;
}

.euiFormControlLayout__childrenWrapper:first-child [class*='euiField'] {
border-radius: $leftSideRadius;
}

.euiFormControlLayout__childrenWrapper:last-child [class*='euiField'] {
border-radius: $rightSideRadius;
}

&.euiFormControlLayout--compressed {
border-radius: $euiBorderRadiusSmall;

.euiFormControlLayout__prepend:first-child {
border-radius: $leftSideRadiusSmall;

[class*='euiButton'] {
border-radius: $leftSideRadiusSmall;
}
}

.euiFormControlLayout__append:last-child {
border-radius: $rightSideRadiusSmall;

[class*='euiButton'] {
border-radius: $rightSideRadiusSmall;
}
}

.euiFormControlLayout__childrenWrapper:nth-child(2) [class*='euiField'],
.euiFormControlLayout__childrenWrapper:nth-child(3) [class*='euiField'] {
border-radius: 0;
}

.euiFormControlLayout__childrenWrapper:first-child [class*='euiField'] {
border-radius: $leftSideRadiusSmall;
}

.euiFormControlLayout__childrenWrapper:last-child [class*='euiField'] {
border-radius: $rightSideRadiusSmall;
}
}
}
Loading