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

Move shared component mixins to global_styles #2551

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b830e70
Move euiPanel mixin to global_styling for easier overriding
johnbarrierwilson Nov 20, 2019
557923c
Move button mixin to global_styling
johnbarrierwilson Nov 22, 2019
54fce1a
Move loading mixin to global_styling
johnbarrierwilson Nov 25, 2019
f2bae9e
Move popover mixin to global_styling
johnbarrierwilson Nov 25, 2019
d0a59b7
Move form, switch, and range mixins and variables to global_styling
johnbarrierwilson Nov 25, 2019
b122095
Add changelog entry
johnbarrierwilson Nov 26, 2019
fbcef8b
Merge branch 'master' into eui-amsterdam/architecture
johnbarrierwilson Nov 26, 2019
9678361
Merge from elastic/eui:master
johnbarrierwilson Dec 3, 2019
6de15c5
Move changelog item to "breaking changes" heading
johnbarrierwilson Dec 3, 2019
7d33eb0
Move buttons variables to global_styling
johnbarrierwilson Dec 3, 2019
f019ba1
Move buttons variables to global_styling
johnbarrierwilson Dec 3, 2019
a48e501
Merge branch 'eui-amsterdam/architecture' of github.com:johnbarrierwi…
johnbarrierwilson Dec 3, 2019
bd77848
Consolidate form variables files
johnbarrierwilson Dec 3, 2019
d86676d
Remove form variable imports in form mixin file
johnbarrierwilson Dec 3, 2019
6fe5da0
Move beta_badge mixins to global_styling
johnbarrierwilson Dec 3, 2019
3eaf91a
Move tooltip variables and mixins to global_styling
johnbarrierwilson Dec 3, 2019
7c29ff6
Refactor panel mixin to require entire selector
johnbarrierwilson Dec 3, 2019
84e0c7e
Add note to changelog about panel mixin selector
johnbarrierwilson Dec 3, 2019
6c75e79
Remove $euiPanelBorderColor as it was not used
johnbarrierwilson Dec 3, 2019
4c79b40
Renaming mixin `fasBetaBadge` to `euiHasBetaBadge`
Dec 3, 2019
757f843
Combined `form_control_layout` mixins into `form` file
Dec 3, 2019
4eafed5
Adding `!default`s to global variables
Dec 4, 2019
5be1b7c
Move panel variables to global
Dec 4, 2019
de0e216
Cleanup
Dec 4, 2019
b0eb3a1
Update tense in the CL
johnbarrierwilson Dec 5, 2019
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

- Fixed `EuiSwitch` clicking on disabled label ([#2575](https://github.com/elastic/eui/pull/2575))

**Breaking Changes**

- Moved any shared component-level Sass variables and mixins into the `global_styling` directory ([#2551](https://github.com/elastic/eui/pull/2551))
- Rework panel mixin to require the entirety of a selector (i.e. require the '.' in addition to the string) ([#2551](https://github.com/elastic/eui/pull/2551))
johnbarrierwilson marked this conversation as resolved.
Show resolved Hide resolved

## [`16.1.0`](https://github.com/elastic/eui/tree/v16.1.0)

- Updated compressed styles for `EuiButtonGroup` to include a background color ([#2568](https://github.com/elastic/eui/pull/2568))
Expand Down
2 changes: 0 additions & 2 deletions src/components/badge/_badge.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../button/variables';

/**
* 1. Accounts for the border
*/
Expand Down
1 change: 0 additions & 1 deletion src/components/badge/beta_badge/_index.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@import 'mixins';
@import 'beta_badge';
3 changes: 0 additions & 3 deletions src/components/button/_button.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../loading/mixins';

// This file has lots of modifiers and is somewhat nesty by nature
//sass-lint:disable nesting-depth

Expand Down Expand Up @@ -79,7 +77,6 @@
// Create button modifiers based upon the map.
@each $name, $color in $euiButtonTypes {
.euiButton--#{$name} {

@if ($name == 'ghost') {
// Ghost is unique and ALWAYS sits against a dark background.
color: $color;
Expand Down
3 changes: 0 additions & 3 deletions src/components/button/_index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
@import 'variables';
@import 'mixins';

@import 'button';
@import 'button_empty/index';
@import 'button_icon/index';
Expand Down
2 changes: 0 additions & 2 deletions src/components/button/button_group/_button_group.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../../form/variables';

.euiButtonGroup {
max-width: 100%;
display: flex;
Expand Down
6 changes: 1 addition & 5 deletions src/components/card/_card.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
@import '../panel/mixins';
@import '../badge/beta_badge/mixins';

// Start with a base of EuiPanel styles
@include euiPanel($selector: 'euiCard');
@include euiPanel($selector: '.euiCard');

/**
* 1. Footer is always at the bottom.
Expand Down Expand Up @@ -212,4 +209,3 @@
.euiCard--hasChildren .euiCard__description {
margin-bottom: $euiCardSpacing;
}

4 changes: 1 addition & 3 deletions src/components/card/checkable_card/_checkable_card.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@import '../../panel/mixins';

@include euiPanel('euiCheckableCard');
@include euiPanel($selector: '.euiCheckableCard');

.euiCheckableCard {
transition: border-color $euiAnimSpeedNormal ease-in;
Expand Down
2 changes: 0 additions & 2 deletions src/components/color_picker/_color_picker.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../form/mixins';

.euiColorPicker {
position: relative;
width: $euiColorPickerWidth;
Expand Down
4 changes: 0 additions & 4 deletions src/components/color_picker/_hue.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
@import '../form/_mixins';
@import '../form/range/_variables';
@import '../form/range/_mixins';

// This wraps the range. It is needed because there is no way to do a linear gradeint in ie11 for the track
.euiHue {
// sass-lint:disable-block no-color-literals
Expand Down
2 changes: 0 additions & 2 deletions src/components/color_picker/color_stops/_color_stops.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../../form/range/_variables';

.euiColorStops:not(.euiColorStops-isDisabled) {
&:focus {
outline: 2px solid $euiFocusRingColor;
Expand Down
2 changes: 0 additions & 2 deletions src/components/combo_box/_combo_box.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../form/form_control_layout/mixins';

.euiComboBox {
@include euiFormControlSize(auto, $includeAlternates: true);
position: relative;
Expand Down
4 changes: 0 additions & 4 deletions src/components/combo_box/_index.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
@import '../form/variables';
@import '../form/mixins';
@import '../form/form_control_layout/mixins';

@import 'combo_box';
@import 'combo_box_input/index';
@import 'combo_box_options_list/index';
2 changes: 0 additions & 2 deletions src/components/context_menu/_context_menu_panel.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../popover/mixins';

.euiContextMenuPanel {
width: 100%;
visibility: visible;
Expand Down
1 change: 0 additions & 1 deletion src/components/control_bar/_index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import '../header/variables';
@import '../button/variables';
@import '../nav_drawer/variables';
@import 'variables';
@import 'control_bar';
4 changes: 0 additions & 4 deletions src/components/date_picker/_date_picker_range.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
@import '../form/variables';
@import '../form/mixins';
@import '../form/form_control_layout/variables';

/**
* 1. Account for inner box-shadow style border
*/
Expand Down
2 changes: 0 additions & 2 deletions src/components/date_picker/super_date_picker/_mixins.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../../form/form_control_layout/variables';

@mixin euiSuperDatePickerText {
@include euiFormControlText;
display: block;
Expand Down
4 changes: 1 addition & 3 deletions src/components/drag_and_drop/_droppable.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../panel/mixins';

.euiDroppable {
$euiDroppableColor: $euiColorSecondary;
transition: background-color $euiAnimSpeedExtraSlow ease;
Expand All @@ -20,7 +18,7 @@
}
}

@include euiPanel('euiDroppable--withPanel');
@include euiPanel($selector: '.euiDroppable--withPanel');

.euiDroppable--noGrow {
flex-grow: 0;
Expand Down
3 changes: 0 additions & 3 deletions src/components/facet/_index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
@import '../button/variables';
@import '../button/mixins';

@import 'facet_button';
@import 'facet_group';
2 changes: 0 additions & 2 deletions src/components/filter_group/_filter_button.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../form/variables';

.euiFilterButton {
background-color: $euiFormBackgroundColor;
height: $euiFormControlHeight;
Expand Down
2 changes: 0 additions & 2 deletions src/components/filter_group/_filter_group.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../form/variables';

.euiFilterGroup {
display: inline-flex;
max-width: 100%;
Expand Down
3 changes: 0 additions & 3 deletions src/components/filter_group/_index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
@import '../form/variables';
@import '../form/mixins';

@import 'filter_group';
@import 'filter_button';
@import 'filter_select_item';
2 changes: 0 additions & 2 deletions src/components/flyout/_flyout.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../form/variables';

.euiFlyout {
border-left: $euiBorderThin;
// The mixin augments the above
Expand Down
3 changes: 0 additions & 3 deletions src/components/form/_index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
@import 'variables';
@import 'mixins';

@import 'checkbox/index';
@import 'described_form_group/index';
@import 'field_number/index';
Expand Down
1 change: 0 additions & 1 deletion src/components/form/checkbox/_index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@import '../variables';
@import 'checkbox';
@import 'checkbox_group';
2 changes: 0 additions & 2 deletions src/components/form/file_picker/_file_picker.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../form_control_layout/mixins';

/**
* REMEMBER: --large modifiers must come last to override --compressed
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
@import '../variables';
@import '../mixins';

.euiFormControlLayout {
// Let the height expand as needed
@include euiFormControlSize($includeAlternates: true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
@import '../variables';
@import '../mixins';

.euiFormControlLayoutDelimited {
// Match just the regular drop shadow of inputs
@include euiFormControlDefaultShadow;
Expand Down
2 changes: 0 additions & 2 deletions src/components/form/form_control_layout/_index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import 'variables';
@import 'mixins';
@import 'form_control_layout';
@import 'form_control_layout_delimited';
@import 'form_control_layout_icons';
Expand Down
9 changes: 0 additions & 9 deletions src/components/form/form_control_layout/_variables.scss

This file was deleted.

1 change: 0 additions & 1 deletion src/components/form/radio/_index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@import '../variables';
@import 'radio';
@import 'radio_group';
3 changes: 0 additions & 3 deletions src/components/form/range/_index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
@import 'variables';
@import 'mixins';

@import 'range';
@import 'range_highlight';
@import 'range_input';
Expand Down
2 changes: 0 additions & 2 deletions src/components/form/range/_range_tooltip.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../../tool_tip/variables';

.euiRangeTooltip {
// Keeps tooltip (value) aligned to percentage of actual slider
display: block;
Expand Down
1 change: 0 additions & 1 deletion src/components/form/switch/_index.scss
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@import '../variables';
@import 'switch';
1 change: 0 additions & 1 deletion src/components/loading/_index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import 'variables';
@import 'mixins';
@import 'loading_kibana';
@import 'loading_chart';
@import 'loading_content';
Expand Down
2 changes: 0 additions & 2 deletions src/components/modal/_index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
@import '../form/variables';

@import 'modal';
1 change: 0 additions & 1 deletion src/components/panel/_index.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@import 'variables';
@import 'mixins';
@import 'panel';
4 changes: 1 addition & 3 deletions src/components/panel/_panel.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@import '../badge/beta_badge/mixins';

// Export basic class & modifiers
@include euiPanel($selector: 'euiPanel');
@include euiPanel($selector: '.euiPanel');

.euiPanel {
@include hasBetaBadge($selector: 'euiPanel');
Expand Down
2 changes: 0 additions & 2 deletions src/components/panel/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ $euiPanelPaddingModifiers: (
'paddingMedium': $euiSize,
'paddingLarge': $euiSizeL
) !default;

$euiPanelBorderColor: tintOrShade($euiShadowColor, 40%, 0%) !default; // match shadow
1 change: 0 additions & 1 deletion src/components/popover/_index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import 'variables';
@import 'mixins';
@import 'popover';
@import 'popover_title';
@import 'popover_footer';
Expand Down
2 changes: 0 additions & 2 deletions src/components/search_bar/_search_bar.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../form/variables';

.euiSearchBar__searchHolder {
min-width: $euiFormMaxWidth / 2;
}
Expand Down
4 changes: 1 addition & 3 deletions src/components/table/_responsive.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../panel/mixins';

.euiTableRowCell__mobileHeader {
// Don't display by default unless table is responsive
display: none;
Expand Down Expand Up @@ -33,7 +31,7 @@
}

// Make each row a Panel
@include euiPanel($selector: 'euiTableRow');
@include euiPanel($selector: '.euiTableRow');

.euiTableRowCell__mobileHeader {
// Always truncate
Expand Down
2 changes: 0 additions & 2 deletions src/components/toggle/_toggle.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../form/switch/mixins';

.euiToggle {
position: relative;

Expand Down
3 changes: 0 additions & 3 deletions src/components/tool_tip/_index.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
@import 'variables';
@import 'mixins';

@import 'tool_tip';
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
@import 'variables';
@import 'form_control_layout/variables';
@import 'form_control_layout/mixins';
@import 'form_control_layout';

@mixin euiPlaceholderPerBrowser {
// sass-lint:disable-block no-vendor-prefixes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@import '../variables';

@mixin euiFormControlLayoutPadding($numOfIcons, $side: 'right', $compressed: false) {
$firstIconSize: $euiFormControlPadding + $euiSize + $euiFormControlPadding;
$secondIconSize: $euiFormControlPadding + $euiSize;
Expand Down Expand Up @@ -39,4 +37,4 @@
stroke: $euiColorEmptyShade;
stroke-width: 2px; // increase thickness of icon at such a small size
}
}
}
11 changes: 11 additions & 0 deletions src/global_styling/mixins/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,14 @@
@import 'helpers';
@import 'states';
@import 'icons';

@import 'beta_badge';
@import 'button';
@import 'form';
@import 'form_control_layout';
@import 'loading';
@import 'panel';
@import 'popover';
@import 'range';
@import 'switch';
@import 'tool_tip';
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
@if variable-exists(selector) == false {
@error 'A $selector must be provided to @mixin euiPanel().';
} @else {
.#{$selector} {
#{$selector} {

@include euiBottomShadowSmall;
background-color: $euiColorEmptyShade;
border: $euiBorderThin;
border-radius: $euiBorderRadius;
flex-grow: 1;

&.#{$selector}--flexGrowZero {
&#{$selector}--flexGrowZero {
flex-grow: 0;
}

&.#{$selector}--isClickable {
&#{$selector}--isClickable {
// in case of button wrapper which inherently is inline-block and no width
display: block;
width: 100%;
Expand All @@ -36,7 +36,7 @@
}
}

&.#{$selector}--shadow {
&#{$selector}--shadow {
@include euiBottomShadowMedium;

@if (lightness($euiTextColor) < 50) {
Expand All @@ -46,8 +46,8 @@
border-bottom-color: $euiBorderColor;
}

&.#{$selector}--isClickable:hover,
&.#{$selector}--isClickable:focus {
&#{$selector}--isClickable:hover,
&#{$selector}--isClickable:focus {
@include euiBottomShadow($color: $euiShadowColor, $opacity: .2);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ $euiFormControlBoxShadow: 0 1px 1px -1px transparentize($euiShadowColor, .8), 0
$euiFormInputGroupLabelBackground: tintOrShade($euiColorLightShade, 50%, 40%) !default;
$euiFormInputGroupBorder: 1px solid shadeOrTint($euiFormInputGroupLabelBackground, 2%, 4%) !default;
$euiSwitchOffColor: lightOrDarkTheme(transparentize($euiColorMediumShade, .8), transparentize($euiColorMediumShade, .3)) !default;

// Control Layout
$euiFormControlLayoutGroupInputHeight: $euiFormControlHeight - 2px; /* 1 */
$euiFormControlLayoutGroupInputCompressedHeight: $euiFormControlCompressedHeight - 2px; /* 1 */
$euiFormControlLayoutGroupInputCompressedBorderRadius: $euiFormControlCompressedBorderRadius / 2;
Loading