Skip to content

Commit

Permalink
Remove unused mixins from overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
daveyholler committed Jul 28, 2020
1 parent 686eb3e commit 15d87fe
Showing 1 changed file with 1 addition and 258 deletions.
259 changes: 1 addition & 258 deletions src/themes/eui-amsterdam/global_styling/mixins/_form.scss
Original file line number Diff line number Diff line change
@@ -1,140 +1,3 @@
// Labels
@mixin euiFormLabel {
@include euiFontSizeXS;
color: $euiTitleColor;
font-weight: $euiFontWeightSemiBold;
}

@mixin euiFormControlLayoutPadding($numOfIcons, $side: 'right', $compressed: false) {
$iconSize: $euiSize;
$iconPadding: $euiFormControlPadding;
$marginBetweenIcons: $euiFormControlPadding / 2;

@if ($compressed) {
$iconPadding: $euiFormControlCompressedPadding;
}

@if variable-exists(numOfIcons) == false {
@error '$numOfIcons:integer (1-3) must be provided to @mixin euiFormControlLayoutPadding().';
} @else if $numOfIcons == 1 {
padding-#{$side}: $iconPadding + $iconSize + $iconPadding;
} @else if $numOfIcons == 2 {
padding-#{$side}: $iconPadding + $iconSize + $marginBetweenIcons + $iconSize + $iconPadding;
} @else if $numOfIcons == 3 {
padding-#{$side}: $iconPadding + $iconSize + $marginBetweenIcons + $iconSize + $marginBetweenIcons + $iconSize + $iconPadding;
}
}

@mixin euiFormControlLayoutClearIcon($iconClass) {
$clearSize: $euiSize;
@include size($clearSize);

pointer-events: all;
background-color: lightOrDarkTheme($euiColorMediumShade, $euiColorDarkShade);
border-radius: $clearSize;
line-height: 0; // ensures the icon stays vertically centered

&:focus {
@include euiFocusRing;
}

#{$iconClass} {
@include size($euiSizeS);
fill: $euiColorEmptyShade;
stroke: $euiColorEmptyShade;
stroke-width: 2px; // increase thickness of icon at such a small size
}
}

@mixin euiPlaceholderPerBrowser {
// sass-lint:disable-block no-vendor-prefixes
// Each prefix must be its own content block
&::-webkit-input-placeholder { @content; }
&::-moz-placeholder { @content; }
&:-ms-input-placeholder { @content; }
&:-moz-placeholder { @content; }
&::placeholder { @content; }
}

@function euiFormControlGradient($color: $euiColorPrimary) {
@return linear-gradient(to top,
$color,
$color 2px,
transparent 2px,
transparent 100%
);
}

@mixin euiFormControlText {
@include euiFont;
font-size: $euiFontSizeS;
line-height: 1em; // fixes text alignment in IE
color: $euiTextColor;

// sass-lint:disable-block mixins-before-declarations
@include euiPlaceholderPerBrowser {
color: $euiColorDarkShade;
}
}

@mixin euiFormControlSize(
$height: $euiFormControlHeight,
$includeAlternates: false
) {
// Default
max-width: $euiFormMaxWidth;
width: 100%;
height: $height;

@if ($includeAlternates) {
&--fullWidth {
max-width: 100%;
}

&--compressed {
height: $euiFormControlCompressedHeight;
}

&--inGroup {
height: 100%;
}
}
}

@mixin euiFormControlWithIcon($isIconOptional: false, $side: 'left', $compressed: false) {
@if ($isIconOptional) {
@at-root {
#{&}--withIcon {
@include euiFormControlLayoutPadding(1, $side, $compressed);
}
}
} @else {
@include euiFormControlLayoutPadding(1, $side, $compressed);
}
}

@mixin euiFormControlIsLoading($isNextToIcon: false) {
@at-root {
#{&}-isLoading {
@if ($isNextToIcon) {
@include euiFormControlLayoutPadding(2);
} @else {
@include euiFormControlLayoutPadding(1);
}
}

#{&}-isLoading#{&}--compressed {
@if ($isNextToIcon) {
@include euiFormControlLayoutPadding(2, $compressed: true);
} @else {
@include euiFormControlLayoutPadding(1, $compressed: true);
}
}
}
}

// 1. Must supply both values to background-size or some browsers apply the single value to both directions

@mixin euiFormControlDefaultShadow($borderOnly: false) {
// sass-lint:disable-block indentation
background-color: $euiFormBackgroundColor;
Expand Down Expand Up @@ -162,46 +25,6 @@
}
}

@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;
}
}

@mixin euiFormControlInvalidStyle {
background-image: euiFormControlGradient($euiColorDanger);
background-size: 100%;
}

@mixin euiFormControlDisabledStyle {
cursor: not-allowed;
color: $euiFormControlDisabledColor;
background: $euiFormBackgroundDisabledColor;
box-shadow: inset 0 0 0 1px $euiFormBorderDisabledColor;

// sass-lint:disable-block mixins-before-declarations
@include euiPlaceholderPerBrowser {
color: $euiFormControlDisabledColor;
}
}

@mixin euiFormControlReadOnlyStyle {
cursor: default;
// Use transparency since there is no border and in case form is on a non-white background
background: $euiFormBackgroundReadOnlyColor;
border-color: transparent;
box-shadow: inset 0 0 0 1px $euiFormBorderDisabledColor;
}


// 2. Override invalid state with focus state.

@mixin euiFormControlStyle($borderOnly: false, $includeStates: true, $includeSizes: true) {
Expand Down Expand Up @@ -252,84 +75,4 @@
box-shadow: none !important;
}
}
}

@mixin euiFormControlStyleCompressed($borderOnly: false, $includeStates: true) {
@include euiFormControlDefaultShadow($borderOnly: true);
padding: $euiFormControlCompressedPadding;
border-radius: $euiFormControlCompressedBorderRadius;

@if ($includeStates) {
&:invalid { // 2
@include euiFormControlInvalidStyle;
}

&:focus { // 2
@include euiFormControlFocusStyle($borderOnly: true);
}

&:disabled {
@include euiFormControlDisabledStyle;
}

&[readOnly] {
@include euiFormControlReadOnlyStyle;
}
}
}

// Custom styles and states for checkboxes and radios

@mixin euiCustomControl($type: null, $size: $euiSize) {
@include euiSlightShadow;

@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: $euiBorderRadius;
}
// sass-lint:disable-block indentation
transition: background-color $euiAnimSpeedFast ease-in,
border-color $euiAnimSpeedFast ease-in;
}

@mixin euiCustomControlSelected($type: null) {
border-color: $euiColorPrimary;
background-color: $euiColorPrimary;

@if $type != null {
@include euiIconBackground($type, $euiColorEmptyShade);
}
}

@mixin euiCustomControlDisabled($type: null) {
border-color: $euiColorLightShade;
background-color: $euiColorLightShade;
box-shadow: none;
@if $type != null {
@include euiIconBackground($type, $euiFormCustomControlDisabledIconColor);
}
}

@mixin euiCustomControlFocused {
@include euiFocusRing;
border-color: $euiColorPrimary;
}

@mixin euiHiddenSelectableInput {
position: absolute;
// sass-lint:disable no-important
opacity: 0 !important; // Make sure it's still hidden when :disabled
width: 100%;
height: 100%;
cursor: pointer;
}

}

0 comments on commit 15d87fe

Please sign in to comment.