* + * {
- border-left: $euiBorderThin;
+ // Match just the regular drop shadow of inputs
+ @include euiFormControlDefaultShadow;
+ @include euiFormControlSize;
+ max-width: none;
+ display: flex;
+ align-items: center;
+ padding: 1px; /* 1 */
+
+ > * {
+ // defaults to growing children
+ // though filter buttons don't grow by default
+ flex-grow: 1;
+ }
+
+ // Force popover anchors to expand for now
+ .euiPopover__anchor {
+ display: block;
}
}
.euiFilterGroup__popoverPanel {
- width: $euiSize * 20;
+ max-width: $euiSize * 20;
}
diff --git a/src/components/filter_group/filter_button.js b/src/components/filter_group/filter_button.js
index 7050f750934..433099ccaf2 100644
--- a/src/components/filter_group/filter_button.js
+++ b/src/components/filter_group/filter_button.js
@@ -2,30 +2,18 @@ import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
-import { getSecureRelForTarget } from '../../services';
+// import { getSecureRelForTarget } from '../../services';
+import { EuiNotificationBadge } from '../badge/notification_badge';
+import {
+ COLORS,
+ ICON_SIDES,
+ EuiButtonEmpty,
+} from '../button/button_empty';
import {
ICON_TYPES,
- EuiIcon,
} from '../icon';
-const colorToClassNameMap = {
- primary: 'euiFilterButton--primary',
- danger: 'euiFilterButton--danger',
- disabled: 'euiFilterButton--disabled',
- text: 'euiFilterButton--text',
- ghost: 'euiFilterButton--ghost',
-};
-
-export const COLORS = Object.keys(colorToClassNameMap);
-
-const iconSideToClassNameMap = {
- left: '',
- right: 'euiFilterButton--iconRight',
-};
-
-export const ICON_SIDES = Object.keys(iconSideToClassNameMap);
-
export const EuiFilterButton = ({
children,
className,
@@ -33,72 +21,48 @@ export const EuiFilterButton = ({
iconSide,
color,
hasActiveFilters,
+ numFilters,
isDisabled,
isSelected,
- href,
- target,
- rel,
type,
+ grow,
+ noDivider,
...rest
}) => {
const classes = classNames(
'euiFilterButton',
- colorToClassNameMap[color],
- iconSideToClassNameMap[iconSide],
{
'euiFilterButton-isSelected': isSelected,
'euiFilterButton-hasActiveFilters': hasActiveFilters,
+ 'euiFilterButton--grow': grow,
+ 'euiFilterButton--noDivider': noDivider,
},
className,
);
- // Add an icon to the button if one exists.
- let buttonIcon;
-
- if (iconType) {
- buttonIcon = (
-
- );
- }
-
- if (href) {
- const secureRel = getSecureRelForTarget(target, rel);
+ const buttonContents = (
+
+ {children}
+ {numFilters &&
+ {numFilters}
+ }
+
+ );
- return (
-
-
- {buttonIcon}
- {children}
-
-
- );
- } else {
- return (
-
-
- {buttonIcon}
- {children}
-
-
- );
- }
+ return (
+
+ {buttonContents}
+
+ );
};
EuiFilterButton.propTypes = {
@@ -115,31 +79,32 @@ EuiFilterButton.propTypes = {
* Bolds the button if true
*/
hasActiveFilters: PropTypes.bool,
+ /**
+ * Adds a notification with number
+ */
+ numFilters: PropTypes.number,
/**
* Applies a visual state to the button useful when using with a popover.
*/
isSelected: PropTypes.bool,
isDisabled: PropTypes.bool,
/**
- * If passed, changes the button to an anchor tag
- */
- href: PropTypes.string,
- /**
- * Used along with href
+ * Defines html button input type
*/
- target: PropTypes.string,
+ type: PropTypes.string,
/**
- * Used along with href
+ * Should the button grow to fill it's container, best used for dropdown buttons
*/
- rel: PropTypes.string,
+ grow: PropTypes.bool,
/**
- * Defines html button input type
+ * Remove border after button, good for opposite filters
*/
- type: PropTypes.string,
+ noDivider: PropTypes.bool,
};
EuiFilterButton.defaultProps = {
type: 'button',
iconSide: 'right',
color: 'text',
+ grow: false,
};
diff --git a/src/components/filter_group/filter_select_item.js b/src/components/filter_group/filter_select_item.js
index 04761c62785..0514925f66c 100644
--- a/src/components/filter_group/filter_select_item.js
+++ b/src/components/filter_group/filter_select_item.js
@@ -68,6 +68,7 @@ export class EuiFilterSelectItem extends Component {
alignItems="center"
gutterSize="s"
component="span"
+ responsive={false}
>
diff --git a/src/components/form/_mixins.scss b/src/components/form/_mixins.scss
index a90cf28d92a..b8eb064eb50 100644
--- a/src/components/form/_mixins.scss
+++ b/src/components/form/_mixins.scss
@@ -10,13 +10,36 @@
/**
* 1. Ensure the icon padding remains when in readOnly mode
- * 2. Must supply both values to background-size or some browsers apply the single value to both directions
+ * 2. Account for inner box-shadow style border when in group
+ * 3. Must supply both values to background-size or some browsers apply the single value to both directions
*/
-@mixin euiFormControlSize($height: $euiFormControlHeight) {
+@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: $euiFormControlHeight - 2px; /* 2 */
+ }
+
+ &--inGroup#{&}--compressed {
+ height: $euiFormControlCompressedHeight - 2px; /* 2 */
+ }
+ }
}
@mixin euiFormControlWithIcon($isIconOptional: false, $side: "left") {
@@ -50,7 +73,7 @@
@mixin euiFormControlDefaultShadow($borderOnly: false) {
background-color: $euiFormBackgroundColor;
background-repeat: no-repeat;
- background-size: 0% 100%; /* 2 */
+ background-size: 0% 100%; /* 3 */
@if ($borderOnly) {
box-shadow: inset 0 0 0 1px $euiFormBorderColor;
@@ -71,7 +94,7 @@
@mixin euiFormControlFocusStyle($borderOnly: false) {
background-color: tintOrShade($euiColorEmptyShade, 0%, 50%);
background-image: euiFormControlGradient();
- background-size: 100% 100%; /* 2 */
+ background-size: 100% 100%; /* 3 */
@if ($borderOnly) {
box-shadow: inset 0 0 0 1px transparentize($euiColorFullShade, .84);
@@ -108,12 +131,12 @@
}
/**
- * 2. Override invalid state with focus state.
+ * 4. Override invalid state with focus state.
*/
-@mixin euiFormControlStyle($borderOnly: false, $includeStates: true) {
- @include euiFormControlSize;
- @include euiFormControlDefaultShadow($borderOnly);
+@mixin euiFormControlStyle($borderOnly: false, $includeStates: true, $includeSizes: true) {
+ @include euiFormControlSize($includeAlternates: $includeSizes);
+ @include euiFormControlDefaultShadow();
border: none;
font-size: $euiFontSizeS;
@@ -123,23 +146,24 @@
color: $euiTextColor;
border-radius: 0;
- &--fullWidth {
- max-width: 100%;
- }
+ @if ($includeSizes) {
+ &--compressed {
+ padding-top: $euiFormControlCompressedPadding;
+ padding-bottom: $euiFormControlCompressedPadding;
+ }
- &--compressed {
- padding-top: $euiFormControlCompressedPadding;
- padding-bottom: $euiFormControlCompressedPadding;
- height: $euiFormControlCompressedHeight;
+ &--inGroup {
+ box-shadow: none !important;
+ }
}
@if ($includeStates) {
- &:invalid { /* 2 */
+ &:invalid { /* 4 */
@include euiFormControlInvalidStyle;
}
- &:focus { /* 2 */
- @include euiFormControlFocusStyle($borderOnly);
+ &:focus { /* 4 */
+ @include euiFormControlFocusStyle();
}
&:disabled {
diff --git a/src/components/form/field_number/field_number.js b/src/components/form/field_number/field_number.js
index a75471e455a..352ec8bd026 100644
--- a/src/components/form/field_number/field_number.js
+++ b/src/components/form/field_number/field_number.js
@@ -23,12 +23,15 @@ export const EuiFieldNumber = ({
fullWidth,
isLoading,
compressed,
+ prepend,
+ append,
...rest
}) => {
const classes = classNames('euiFieldNumber', className, {
'euiFieldNumber--withIcon': icon,
'euiFieldNumber--fullWidth': fullWidth,
'euiFieldNumber--compressed': compressed,
+ 'euiFieldNumber--inGroup': prepend || append,
'euiFieldNumber-isLoading': isLoading,
});
@@ -38,6 +41,8 @@ export const EuiFieldNumber = ({
fullWidth={fullWidth}
isLoading={isLoading}
compressed={compressed}
+ prepend={prepend}
+ append={append}
>
{
const classes = classNames('euiFieldText', className, {
'euiFieldText--withIcon': icon,
'euiFieldText--fullWidth': fullWidth,
'euiFieldText--compressed': compressed,
+ 'euiFieldText--inGroup': prepend || append,
'euiFieldText-isLoading': isLoading,
});
@@ -37,6 +40,8 @@ export const EuiFieldText = ({
fullWidth={fullWidth}
isLoading={isLoading}
compressed={compressed}
+ prepend={prepend}
+ append={append}
>
-
+
+
+
`;
@@ -15,34 +19,38 @@ exports[`EuiFormControlLayout props clear onClick is rendered 1`] = `
class="euiFormControlLayout"
>