@elastic/eui 77.2.1 → 78.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -21
- package/dist/eui_theme_dark.css +28 -29
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +28 -29
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/avatar/avatar.js +15 -3
- package/es/components/avatar/avatar.styles.js +46 -9
- package/es/components/focus_trap/focus_trap.js +21 -5
- package/es/components/form/form.styles.js +2 -2
- package/es/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +7 -0
- package/es/test/rtl/custom_render.js +11 -1
- package/es/test/rtl/index.d.ts +1 -1
- package/es/test/rtl/index.js +1 -1
- package/eui.d.ts +21 -1
- package/lib/components/avatar/avatar.js +17 -4
- package/lib/components/avatar/avatar.styles.js +46 -9
- package/lib/components/focus_trap/focus_trap.js +21 -5
- package/lib/components/form/form.styles.js +2 -2
- package/lib/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +7 -0
- package/lib/test/rtl/custom_render.js +11 -2
- package/lib/test/rtl/index.d.ts +1 -1
- package/lib/test/rtl/index.js +8 -1
- package/optimize/es/components/avatar/avatar.js +8 -3
- package/optimize/es/components/avatar/avatar.styles.js +46 -9
- package/optimize/es/components/focus_trap/focus_trap.js +15 -5
- package/optimize/es/components/form/form.styles.js +2 -2
- package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
- package/optimize/es/test/rtl/custom_render.js +11 -1
- package/optimize/es/test/rtl/index.d.ts +1 -1
- package/optimize/es/test/rtl/index.js +1 -1
- package/optimize/lib/components/avatar/avatar.js +10 -4
- package/optimize/lib/components/avatar/avatar.styles.js +46 -9
- package/optimize/lib/components/focus_trap/focus_trap.js +15 -5
- package/optimize/lib/components/form/form.styles.js +2 -2
- package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
- package/optimize/lib/test/rtl/custom_render.js +11 -2
- package/optimize/lib/test/rtl/index.d.ts +1 -1
- package/optimize/lib/test/rtl/index.js +8 -1
- package/package.json +3 -2
- package/src/components/form/switch/_switch.scss +30 -26
- package/src/global_styling/variables/_form.scss +2 -2
- package/test-env/components/avatar/avatar.js +17 -4
- package/test-env/components/avatar/avatar.styles.js +46 -9
- package/test-env/components/form/form.styles.js +2 -2
- package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +7 -0
- package/test-env/test/rtl/custom_render.js +11 -2
- package/test-env/test/rtl/index.js +8 -1
package/lib/test/rtl/index.js
CHANGED
|
@@ -11,7 +11,8 @@ var _exportNames = {
|
|
|
11
11
|
findAllByTestSubject: true,
|
|
12
12
|
findByTestSubject: true,
|
|
13
13
|
render: true,
|
|
14
|
-
screen: true
|
|
14
|
+
screen: true,
|
|
15
|
+
within: true
|
|
15
16
|
};
|
|
16
17
|
Object.defineProperty(exports, "findAllByTestSubject", {
|
|
17
18
|
enumerable: true,
|
|
@@ -61,6 +62,12 @@ Object.defineProperty(exports, "screen", {
|
|
|
61
62
|
return _custom_render.screen;
|
|
62
63
|
}
|
|
63
64
|
});
|
|
65
|
+
Object.defineProperty(exports, "within", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function get() {
|
|
68
|
+
return _custom_render.within;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
64
71
|
var _component_helpers = require("./component_helpers");
|
|
65
72
|
Object.keys(_component_helpers).forEach(function (key) {
|
|
66
73
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -2,7 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"]
|
|
5
|
+
var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"],
|
|
6
|
+
_excluded2 = ["casing"];
|
|
6
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
9
|
/*
|
|
@@ -22,6 +23,7 @@ import { euiAvatarStyles } from './avatar.styles';
|
|
|
22
23
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
23
24
|
export var SIZES = ['s', 'm', 'l', 'xl'];
|
|
24
25
|
export var TYPES = ['space', 'user'];
|
|
26
|
+
export var CASING = ['capitalize', 'uppercase', 'lowercase', 'none'];
|
|
25
27
|
export var EuiAvatar = function EuiAvatar(_ref) {
|
|
26
28
|
var _classNames;
|
|
27
29
|
var className = _ref.className,
|
|
@@ -40,14 +42,17 @@ export var EuiAvatar = function EuiAvatar(_ref) {
|
|
|
40
42
|
_ref$isDisabled = _ref.isDisabled,
|
|
41
43
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
42
44
|
style = _ref.style,
|
|
43
|
-
|
|
45
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
46
|
+
var _props$casing = props.casing,
|
|
47
|
+
casing = _props$casing === void 0 ? type === 'space' ? 'none' : 'uppercase' : _props$casing,
|
|
48
|
+
rest = _objectWithoutProperties(props, _excluded2);
|
|
44
49
|
var euiTheme = useEuiTheme();
|
|
45
50
|
var styles = euiAvatarStyles(euiTheme);
|
|
46
51
|
var visColors = euiPaletteColorBlindBehindText();
|
|
47
52
|
var isPlain = color === 'plain';
|
|
48
53
|
var isSubdued = color === 'subdued';
|
|
49
54
|
var classes = classNames('euiAvatar', (_classNames = {}, _defineProperty(_classNames, "euiAvatar--".concat(size), size), _defineProperty(_classNames, "euiAvatar--".concat(type), type), _defineProperty(_classNames, 'euiAvatar-isDisabled', isDisabled), _classNames), className);
|
|
50
|
-
var cssStyles = [styles.euiAvatar, styles[size], styles[
|
|
55
|
+
var cssStyles = [styles.euiAvatar, styles[type], styles[size], styles[casing], isPlain && styles.plain, isSubdued && styles.subdued, isDisabled && styles.isDisabled];
|
|
51
56
|
checkValidInitials(initials);
|
|
52
57
|
var avatarStyle = _objectSpread({}, style);
|
|
53
58
|
var iconCustomColor = iconColor;
|
|
@@ -9,12 +9,44 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
9
9
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { logicalCSS, logicalTextAlignCSS } from '../../global_styling';
|
|
12
|
-
var _avatarSize = function _avatarSize(
|
|
13
|
-
var size =
|
|
14
|
-
fontSize =
|
|
12
|
+
var _avatarSize = function _avatarSize(_ref7) {
|
|
13
|
+
var size = _ref7.size,
|
|
14
|
+
fontSize = _ref7.fontSize;
|
|
15
15
|
return "\n ".concat(logicalCSS('width', size), ";\n ").concat(logicalCSS('height', size), ";\n line-height: ").concat(size, ";\n font-size: ").concat(fontSize, ";\n ");
|
|
16
16
|
};
|
|
17
17
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
18
|
+
name: "4wfy2n-none",
|
|
19
|
+
styles: "text-transform:none;label:none;"
|
|
20
|
+
} : {
|
|
21
|
+
name: "4wfy2n-none",
|
|
22
|
+
styles: "text-transform:none;label:none;",
|
|
23
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
24
|
+
};
|
|
25
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
26
|
+
name: "5xhpzh-lowercase",
|
|
27
|
+
styles: "text-transform:lowercase;label:lowercase;"
|
|
28
|
+
} : {
|
|
29
|
+
name: "5xhpzh-lowercase",
|
|
30
|
+
styles: "text-transform:lowercase;label:lowercase;",
|
|
31
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
32
|
+
};
|
|
33
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
34
|
+
name: "1x2qsb1-uppercase",
|
|
35
|
+
styles: "text-transform:uppercase;label:uppercase;"
|
|
36
|
+
} : {
|
|
37
|
+
name: "1x2qsb1-uppercase",
|
|
38
|
+
styles: "text-transform:uppercase;label:uppercase;",
|
|
39
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
40
|
+
};
|
|
41
|
+
var _ref4 = process.env.NODE_ENV === "production" ? {
|
|
42
|
+
name: "mxeh3g-capitalize",
|
|
43
|
+
styles: "text-transform:capitalize;label:capitalize;"
|
|
44
|
+
} : {
|
|
45
|
+
name: "mxeh3g-capitalize",
|
|
46
|
+
styles: "text-transform:capitalize;label:capitalize;",
|
|
47
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
48
|
+
};
|
|
49
|
+
var _ref5 = process.env.NODE_ENV === "production" ? {
|
|
18
50
|
name: "14sj6wh-isDisabled",
|
|
19
51
|
styles: "cursor:not-allowed;filter:grayscale(100%);label:isDisabled;"
|
|
20
52
|
} : {
|
|
@@ -22,7 +54,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
22
54
|
styles: "cursor:not-allowed;filter:grayscale(100%);label:isDisabled;",
|
|
23
55
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
24
56
|
};
|
|
25
|
-
var
|
|
57
|
+
var _ref6 = process.env.NODE_ENV === "production" ? {
|
|
26
58
|
name: "ont6vs-user",
|
|
27
59
|
styles: "border-radius:50%;label:user;"
|
|
28
60
|
} : {
|
|
@@ -30,18 +62,18 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
30
62
|
styles: "border-radius:50%;label:user;",
|
|
31
63
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
32
64
|
};
|
|
33
|
-
export var euiAvatarStyles = function euiAvatarStyles(
|
|
34
|
-
var euiTheme =
|
|
65
|
+
export var euiAvatarStyles = function euiAvatarStyles(_ref8) {
|
|
66
|
+
var euiTheme = _ref8.euiTheme;
|
|
35
67
|
return {
|
|
36
68
|
// Base
|
|
37
69
|
euiAvatar: /*#__PURE__*/css("flex-shrink:0;display:inline-flex;justify-content:center;align-items:center;vertical-align:middle;background-size:cover;", logicalTextAlignCSS('center'), ";", logicalCSS('overflow-x', 'hidden'), "font-weight:", euiTheme.font.weight.medium, ";;label:euiAvatar;"),
|
|
38
70
|
// Variants
|
|
39
71
|
plain: /*#__PURE__*/css("background-color:", euiTheme.colors.emptyShade, ";;label:plain;"),
|
|
40
72
|
subdued: /*#__PURE__*/css("background-color:", euiTheme.colors.lightestShade, ";;label:subdued;"),
|
|
41
|
-
user:
|
|
73
|
+
user: _ref6,
|
|
42
74
|
space: /*#__PURE__*/css("border-radius:", euiTheme.border.radius.medium, ";;label:space;"),
|
|
43
75
|
// States
|
|
44
|
-
isDisabled:
|
|
76
|
+
isDisabled: _ref5,
|
|
45
77
|
// Sizes
|
|
46
78
|
s: /*#__PURE__*/css(_avatarSize({
|
|
47
79
|
size: euiTheme.size.l,
|
|
@@ -58,6 +90,11 @@ export var euiAvatarStyles = function euiAvatarStyles(_ref4) {
|
|
|
58
90
|
xl: /*#__PURE__*/css(_avatarSize({
|
|
59
91
|
size: "calc(".concat(euiTheme.size.base, " * 4)"),
|
|
60
92
|
fontSize: "calc(".concat(euiTheme.size.xl, " * 0.8)")
|
|
61
|
-
}), ";label:xl;")
|
|
93
|
+
}), ";label:xl;"),
|
|
94
|
+
// Casing
|
|
95
|
+
capitalize: _ref4,
|
|
96
|
+
uppercase: _ref3,
|
|
97
|
+
lowercase: _ref2,
|
|
98
|
+
none: _ref
|
|
62
99
|
};
|
|
63
100
|
};
|
|
@@ -6,7 +6,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
var _excluded = ["children", "clickOutsideDisables", "disabled", "returnFocus", "noIsolation", "scrollLock"];
|
|
9
|
+
var _excluded = ["children", "clickOutsideDisables", "disabled", "returnFocus", "noIsolation", "scrollLock", "gapMode"];
|
|
10
10
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
11
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
12
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -21,6 +21,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
21
21
|
|
|
22
22
|
import React, { Component } from 'react';
|
|
23
23
|
import { FocusOn } from 'react-focus-on';
|
|
24
|
+
import { RemoveScrollBar } from 'react-remove-scroll-bar';
|
|
24
25
|
import { findElementBySelectorOrRef } from '../../services';
|
|
25
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
26
27
|
export var EuiFocusTrap = /*#__PURE__*/function (_Component) {
|
|
@@ -109,17 +110,25 @@ export var EuiFocusTrap = /*#__PURE__*/function (_Component) {
|
|
|
109
110
|
returnFocus = _this$props3.returnFocus,
|
|
110
111
|
noIsolation = _this$props3.noIsolation,
|
|
111
112
|
scrollLock = _this$props3.scrollLock,
|
|
113
|
+
gapMode = _this$props3.gapMode,
|
|
112
114
|
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
113
115
|
var isDisabled = disabled || this.state.hasBeenDisabledByClick;
|
|
114
116
|
var focusOnProps = _objectSpread(_objectSpread({
|
|
115
117
|
returnFocus: returnFocus,
|
|
116
118
|
noIsolation: noIsolation,
|
|
117
|
-
scrollLock: scrollLock,
|
|
118
119
|
enabled: !isDisabled
|
|
119
120
|
}, rest), {}, {
|
|
120
|
-
onClickOutside: this.handleOutsideClick
|
|
121
|
+
onClickOutside: this.handleOutsideClick,
|
|
122
|
+
/**
|
|
123
|
+
* `scrollLock` should always be unset on FocusOn, as it can prevent scrolling on
|
|
124
|
+
* portals (i.e. popovers, comboboxes, dropdown menus, etc.) within modals & flyouts
|
|
125
|
+
* @see https://github.com/theKashey/react-focus-on/issues/49
|
|
126
|
+
*/
|
|
127
|
+
scrollLock: false
|
|
121
128
|
});
|
|
122
|
-
return ___EmotionJSX(FocusOn, focusOnProps, children
|
|
129
|
+
return ___EmotionJSX(FocusOn, focusOnProps, children, scrollLock && ___EmotionJSX(RemoveScrollBar, {
|
|
130
|
+
gapMode: gapMode
|
|
131
|
+
}));
|
|
123
132
|
}
|
|
124
133
|
}]);
|
|
125
134
|
return EuiFocusTrap;
|
|
@@ -129,5 +138,6 @@ _defineProperty(EuiFocusTrap, "defaultProps", {
|
|
|
129
138
|
disabled: false,
|
|
130
139
|
returnFocus: true,
|
|
131
140
|
noIsolation: true,
|
|
132
|
-
scrollLock: false
|
|
141
|
+
scrollLock: false,
|
|
142
|
+
gapMode: 'padding' // EUI defaults to padding because Kibana's body/layout CSS ignores `margin`
|
|
133
143
|
});
|
|
@@ -42,10 +42,10 @@ export var euiFormVariables = function euiFormVariables(euiThemeContext) {
|
|
|
42
42
|
inputGroupBorder: 'none'
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
// Colors - specific
|
|
45
|
+
// Colors - specific to checkboxes, radios, switches, and range thumbs
|
|
46
46
|
var customControlColors = {
|
|
47
47
|
customControlDisabledIconColor: isColorDark ? shade(euiTheme.colors.mediumShade, 0.38) : tint(euiTheme.colors.mediumShade, 0.485),
|
|
48
|
-
customControlBorderColor: isColorDark ? shade(euiTheme.colors.lightestShade, 0.
|
|
48
|
+
customControlBorderColor: isColorDark ? shade(euiTheme.colors.lightestShade, 0.4) : tint(euiTheme.colors.lightestShade, 0.31)
|
|
49
49
|
};
|
|
50
50
|
var controlLayout = {
|
|
51
51
|
controlLayoutGroupInputHeight: mathWithUnits(controlHeight, function (x) {
|
|
@@ -62,9 +62,9 @@ export var _termValuesToQuery = function _termValuesToQuery(values, options) {
|
|
|
62
62
|
var body = {
|
|
63
63
|
query: values.map(function (value) {
|
|
64
64
|
if (isString(value) && value.match(/\s/)) {
|
|
65
|
-
return "
|
|
65
|
+
return "+\"".concat(value, "\"");
|
|
66
66
|
}
|
|
67
|
-
return value;
|
|
67
|
+
return "+".concat(value);
|
|
68
68
|
}).join(' ')
|
|
69
69
|
};
|
|
70
70
|
if (body.query === '') {
|
|
@@ -40,4 +40,14 @@ export { customRender as render };
|
|
|
40
40
|
* @see https://github.com/testing-library/dom-testing-library/issues/516
|
|
41
41
|
*/
|
|
42
42
|
var customScreen = _objectSpread(_objectSpread({}, screen), within(document.body, dataTestSubjQueries));
|
|
43
|
-
export { customScreen as screen };
|
|
43
|
+
export { customScreen as screen };
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Custom within util with EUI query helpers
|
|
47
|
+
*
|
|
48
|
+
* @see https://testing-library.com/docs/dom-testing-library/api-within/
|
|
49
|
+
*/
|
|
50
|
+
var customWithin = function customWithin(element) {
|
|
51
|
+
return within(element, _objectSpread(_objectSpread({}, queries), dataTestSubjQueries));
|
|
52
|
+
};
|
|
53
|
+
export { customWithin as within };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './component_helpers';
|
|
2
2
|
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, } from './data_test_subj_queries';
|
|
3
|
-
export { render, screen } from './custom_render';
|
|
3
|
+
export { render, screen, within } from './custom_render';
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
|
|
9
9
|
export * from './component_helpers';
|
|
10
10
|
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject } from './data_test_subj_queries';
|
|
11
|
-
export { render, screen } from './custom_render';
|
|
11
|
+
export { render, screen, within } from './custom_render';
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.checkValidColor = exports.TYPES = exports.SIZES = exports.EuiAvatar = void 0;
|
|
7
|
+
exports.checkValidColor = exports.TYPES = exports.SIZES = exports.EuiAvatar = exports.CASING = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -16,13 +16,16 @@ var _services = require("../../services");
|
|
|
16
16
|
var _icon = require("../icon");
|
|
17
17
|
var _avatar = require("./avatar.styles");
|
|
18
18
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"]
|
|
19
|
+
var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"],
|
|
20
|
+
_excluded2 = ["casing"];
|
|
20
21
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
23
|
var SIZES = ['s', 'm', 'l', 'xl'];
|
|
23
24
|
exports.SIZES = SIZES;
|
|
24
25
|
var TYPES = ['space', 'user'];
|
|
25
26
|
exports.TYPES = TYPES;
|
|
27
|
+
var CASING = ['capitalize', 'uppercase', 'lowercase', 'none'];
|
|
28
|
+
exports.CASING = CASING;
|
|
26
29
|
var EuiAvatar = function EuiAvatar(_ref) {
|
|
27
30
|
var _classNames;
|
|
28
31
|
var className = _ref.className,
|
|
@@ -41,14 +44,17 @@ var EuiAvatar = function EuiAvatar(_ref) {
|
|
|
41
44
|
_ref$isDisabled = _ref.isDisabled,
|
|
42
45
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
43
46
|
style = _ref.style,
|
|
44
|
-
|
|
47
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
48
|
+
var _props$casing = props.casing,
|
|
49
|
+
casing = _props$casing === void 0 ? type === 'space' ? 'none' : 'uppercase' : _props$casing,
|
|
50
|
+
rest = (0, _objectWithoutProperties2.default)(props, _excluded2);
|
|
45
51
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
46
52
|
var styles = (0, _avatar.euiAvatarStyles)(euiTheme);
|
|
47
53
|
var visColors = (0, _services.euiPaletteColorBlindBehindText)();
|
|
48
54
|
var isPlain = color === 'plain';
|
|
49
55
|
var isSubdued = color === 'subdued';
|
|
50
56
|
var classes = (0, _classnames.default)('euiAvatar', (_classNames = {}, (0, _defineProperty2.default)(_classNames, "euiAvatar--".concat(size), size), (0, _defineProperty2.default)(_classNames, "euiAvatar--".concat(type), type), (0, _defineProperty2.default)(_classNames, 'euiAvatar-isDisabled', isDisabled), _classNames), className);
|
|
51
|
-
var cssStyles = [styles.euiAvatar, styles[size], styles[
|
|
57
|
+
var cssStyles = [styles.euiAvatar, styles[type], styles[size], styles[casing], isPlain && styles.plain, isSubdued && styles.subdued, isDisabled && styles.isDisabled];
|
|
52
58
|
checkValidInitials(initials);
|
|
53
59
|
var avatarStyle = _objectSpread({}, style);
|
|
54
60
|
var iconCustomColor = iconColor;
|
|
@@ -7,12 +7,44 @@ exports.euiAvatarStyles = void 0;
|
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _global_styling = require("../../global_styling");
|
|
9
9
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
10
|
-
var _avatarSize = function _avatarSize(
|
|
11
|
-
var size =
|
|
12
|
-
fontSize =
|
|
10
|
+
var _avatarSize = function _avatarSize(_ref7) {
|
|
11
|
+
var size = _ref7.size,
|
|
12
|
+
fontSize = _ref7.fontSize;
|
|
13
13
|
return "\n ".concat((0, _global_styling.logicalCSS)('width', size), ";\n ").concat((0, _global_styling.logicalCSS)('height', size), ";\n line-height: ").concat(size, ";\n font-size: ").concat(fontSize, ";\n ");
|
|
14
14
|
};
|
|
15
15
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
16
|
+
name: "4wfy2n-none",
|
|
17
|
+
styles: "text-transform:none;label:none;"
|
|
18
|
+
} : {
|
|
19
|
+
name: "4wfy2n-none",
|
|
20
|
+
styles: "text-transform:none;label:none;",
|
|
21
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
|
+
};
|
|
23
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
24
|
+
name: "5xhpzh-lowercase",
|
|
25
|
+
styles: "text-transform:lowercase;label:lowercase;"
|
|
26
|
+
} : {
|
|
27
|
+
name: "5xhpzh-lowercase",
|
|
28
|
+
styles: "text-transform:lowercase;label:lowercase;",
|
|
29
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
30
|
+
};
|
|
31
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
32
|
+
name: "1x2qsb1-uppercase",
|
|
33
|
+
styles: "text-transform:uppercase;label:uppercase;"
|
|
34
|
+
} : {
|
|
35
|
+
name: "1x2qsb1-uppercase",
|
|
36
|
+
styles: "text-transform:uppercase;label:uppercase;",
|
|
37
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
38
|
+
};
|
|
39
|
+
var _ref4 = process.env.NODE_ENV === "production" ? {
|
|
40
|
+
name: "mxeh3g-capitalize",
|
|
41
|
+
styles: "text-transform:capitalize;label:capitalize;"
|
|
42
|
+
} : {
|
|
43
|
+
name: "mxeh3g-capitalize",
|
|
44
|
+
styles: "text-transform:capitalize;label:capitalize;",
|
|
45
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
46
|
+
};
|
|
47
|
+
var _ref5 = process.env.NODE_ENV === "production" ? {
|
|
16
48
|
name: "14sj6wh-isDisabled",
|
|
17
49
|
styles: "cursor:not-allowed;filter:grayscale(100%);label:isDisabled;"
|
|
18
50
|
} : {
|
|
@@ -20,7 +52,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
20
52
|
styles: "cursor:not-allowed;filter:grayscale(100%);label:isDisabled;",
|
|
21
53
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
54
|
};
|
|
23
|
-
var
|
|
55
|
+
var _ref6 = process.env.NODE_ENV === "production" ? {
|
|
24
56
|
name: "ont6vs-user",
|
|
25
57
|
styles: "border-radius:50%;label:user;"
|
|
26
58
|
} : {
|
|
@@ -28,18 +60,18 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
28
60
|
styles: "border-radius:50%;label:user;",
|
|
29
61
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
30
62
|
};
|
|
31
|
-
var euiAvatarStyles = function euiAvatarStyles(
|
|
32
|
-
var euiTheme =
|
|
63
|
+
var euiAvatarStyles = function euiAvatarStyles(_ref8) {
|
|
64
|
+
var euiTheme = _ref8.euiTheme;
|
|
33
65
|
return {
|
|
34
66
|
// Base
|
|
35
67
|
euiAvatar: /*#__PURE__*/(0, _react.css)("flex-shrink:0;display:inline-flex;justify-content:center;align-items:center;vertical-align:middle;background-size:cover;", (0, _global_styling.logicalTextAlignCSS)('center'), ";", (0, _global_styling.logicalCSS)('overflow-x', 'hidden'), "font-weight:", euiTheme.font.weight.medium, ";;label:euiAvatar;"),
|
|
36
68
|
// Variants
|
|
37
69
|
plain: /*#__PURE__*/(0, _react.css)("background-color:", euiTheme.colors.emptyShade, ";;label:plain;"),
|
|
38
70
|
subdued: /*#__PURE__*/(0, _react.css)("background-color:", euiTheme.colors.lightestShade, ";;label:subdued;"),
|
|
39
|
-
user:
|
|
71
|
+
user: _ref6,
|
|
40
72
|
space: /*#__PURE__*/(0, _react.css)("border-radius:", euiTheme.border.radius.medium, ";;label:space;"),
|
|
41
73
|
// States
|
|
42
|
-
isDisabled:
|
|
74
|
+
isDisabled: _ref5,
|
|
43
75
|
// Sizes
|
|
44
76
|
s: /*#__PURE__*/(0, _react.css)(_avatarSize({
|
|
45
77
|
size: euiTheme.size.l,
|
|
@@ -56,7 +88,12 @@ var euiAvatarStyles = function euiAvatarStyles(_ref4) {
|
|
|
56
88
|
xl: /*#__PURE__*/(0, _react.css)(_avatarSize({
|
|
57
89
|
size: "calc(".concat(euiTheme.size.base, " * 4)"),
|
|
58
90
|
fontSize: "calc(".concat(euiTheme.size.xl, " * 0.8)")
|
|
59
|
-
}), ";label:xl;")
|
|
91
|
+
}), ";label:xl;"),
|
|
92
|
+
// Casing
|
|
93
|
+
capitalize: _ref4,
|
|
94
|
+
uppercase: _ref3,
|
|
95
|
+
lowercase: _ref2,
|
|
96
|
+
none: _ref
|
|
60
97
|
};
|
|
61
98
|
};
|
|
62
99
|
exports.euiAvatarStyles = euiAvatarStyles;
|
|
@@ -16,9 +16,10 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
17
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
18
|
var _reactFocusOn = require("react-focus-on");
|
|
19
|
+
var _reactRemoveScrollBar = require("react-remove-scroll-bar");
|
|
19
20
|
var _services = require("../../services");
|
|
20
21
|
var _react2 = require("@emotion/react");
|
|
21
|
-
var _excluded = ["children", "clickOutsideDisables", "disabled", "returnFocus", "noIsolation", "scrollLock"];
|
|
22
|
+
var _excluded = ["children", "clickOutsideDisables", "disabled", "returnFocus", "noIsolation", "scrollLock", "gapMode"];
|
|
22
23
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
25
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -111,17 +112,25 @@ var EuiFocusTrap = /*#__PURE__*/function (_Component) {
|
|
|
111
112
|
returnFocus = _this$props3.returnFocus,
|
|
112
113
|
noIsolation = _this$props3.noIsolation,
|
|
113
114
|
scrollLock = _this$props3.scrollLock,
|
|
115
|
+
gapMode = _this$props3.gapMode,
|
|
114
116
|
rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
115
117
|
var isDisabled = disabled || this.state.hasBeenDisabledByClick;
|
|
116
118
|
var focusOnProps = _objectSpread(_objectSpread({
|
|
117
119
|
returnFocus: returnFocus,
|
|
118
120
|
noIsolation: noIsolation,
|
|
119
|
-
scrollLock: scrollLock,
|
|
120
121
|
enabled: !isDisabled
|
|
121
122
|
}, rest), {}, {
|
|
122
|
-
onClickOutside: this.handleOutsideClick
|
|
123
|
+
onClickOutside: this.handleOutsideClick,
|
|
124
|
+
/**
|
|
125
|
+
* `scrollLock` should always be unset on FocusOn, as it can prevent scrolling on
|
|
126
|
+
* portals (i.e. popovers, comboboxes, dropdown menus, etc.) within modals & flyouts
|
|
127
|
+
* @see https://github.com/theKashey/react-focus-on/issues/49
|
|
128
|
+
*/
|
|
129
|
+
scrollLock: false
|
|
123
130
|
});
|
|
124
|
-
return (0, _react2.jsx)(_reactFocusOn.FocusOn, focusOnProps, children)
|
|
131
|
+
return (0, _react2.jsx)(_reactFocusOn.FocusOn, focusOnProps, children, scrollLock && (0, _react2.jsx)(_reactRemoveScrollBar.RemoveScrollBar, {
|
|
132
|
+
gapMode: gapMode
|
|
133
|
+
}));
|
|
125
134
|
}
|
|
126
135
|
}]);
|
|
127
136
|
return EuiFocusTrap;
|
|
@@ -132,5 +141,6 @@ exports.EuiFocusTrap = EuiFocusTrap;
|
|
|
132
141
|
disabled: false,
|
|
133
142
|
returnFocus: true,
|
|
134
143
|
noIsolation: true,
|
|
135
|
-
scrollLock: false
|
|
144
|
+
scrollLock: false,
|
|
145
|
+
gapMode: 'padding' // EUI defaults to padding because Kibana's body/layout CSS ignores `margin`
|
|
136
146
|
});
|
|
@@ -41,10 +41,10 @@ var euiFormVariables = function euiFormVariables(euiThemeContext) {
|
|
|
41
41
|
inputGroupBorder: 'none'
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
// Colors - specific
|
|
44
|
+
// Colors - specific to checkboxes, radios, switches, and range thumbs
|
|
45
45
|
var customControlColors = {
|
|
46
46
|
customControlDisabledIconColor: isColorDark ? (0, _services.shade)(euiTheme.colors.mediumShade, 0.38) : (0, _services.tint)(euiTheme.colors.mediumShade, 0.485),
|
|
47
|
-
customControlBorderColor: isColorDark ? (0, _services.shade)(euiTheme.colors.lightestShade, 0.
|
|
47
|
+
customControlBorderColor: isColorDark ? (0, _services.shade)(euiTheme.colors.lightestShade, 0.4) : (0, _services.tint)(euiTheme.colors.lightestShade, 0.31)
|
|
48
48
|
};
|
|
49
49
|
var controlLayout = {
|
|
50
50
|
controlLayoutGroupInputHeight: (0, _global_styling.mathWithUnits)(controlHeight, function (x) {
|
|
@@ -61,9 +61,9 @@ var _termValuesToQuery = function _termValuesToQuery(values, options) {
|
|
|
61
61
|
var body = {
|
|
62
62
|
query: values.map(function (value) {
|
|
63
63
|
if ((0, _predicate.isString)(value) && value.match(/\s/)) {
|
|
64
|
-
return "
|
|
64
|
+
return "+\"".concat(value, "\"");
|
|
65
65
|
}
|
|
66
|
-
return value;
|
|
66
|
+
return "+".concat(value);
|
|
67
67
|
}).join(' ')
|
|
68
68
|
};
|
|
69
69
|
if (body.query === '') {
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.screen = exports.render = void 0;
|
|
8
|
+
exports.within = exports.screen = exports.render = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = require("@testing-library/react");
|
|
@@ -40,4 +40,13 @@ exports.render = customRender;
|
|
|
40
40
|
* @see https://github.com/testing-library/dom-testing-library/issues/516
|
|
41
41
|
*/
|
|
42
42
|
var customScreen = _objectSpread(_objectSpread({}, _react.screen), (0, _react.within)(document.body, dataTestSubjQueries));
|
|
43
|
-
exports.screen = customScreen;
|
|
43
|
+
exports.screen = customScreen;
|
|
44
|
+
/**
|
|
45
|
+
* Custom within util with EUI query helpers
|
|
46
|
+
*
|
|
47
|
+
* @see https://testing-library.com/docs/dom-testing-library/api-within/
|
|
48
|
+
*/
|
|
49
|
+
var customWithin = function customWithin(element) {
|
|
50
|
+
return (0, _react.within)(element, _objectSpread(_objectSpread({}, _react.queries), dataTestSubjQueries));
|
|
51
|
+
};
|
|
52
|
+
exports.within = customWithin;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from './component_helpers';
|
|
2
2
|
export { queryByTestSubject, queryAllByTestSubject, getByTestSubject, getAllByTestSubject, findAllByTestSubject, findByTestSubject, } from './data_test_subj_queries';
|
|
3
|
-
export { render, screen } from './custom_render';
|
|
3
|
+
export { render, screen, within } from './custom_render';
|
|
@@ -11,7 +11,8 @@ var _exportNames = {
|
|
|
11
11
|
findAllByTestSubject: true,
|
|
12
12
|
findByTestSubject: true,
|
|
13
13
|
render: true,
|
|
14
|
-
screen: true
|
|
14
|
+
screen: true,
|
|
15
|
+
within: true
|
|
15
16
|
};
|
|
16
17
|
Object.defineProperty(exports, "findAllByTestSubject", {
|
|
17
18
|
enumerable: true,
|
|
@@ -61,6 +62,12 @@ Object.defineProperty(exports, "screen", {
|
|
|
61
62
|
return _custom_render.screen;
|
|
62
63
|
}
|
|
63
64
|
});
|
|
65
|
+
Object.defineProperty(exports, "within", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function get() {
|
|
68
|
+
return _custom_render.within;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
64
71
|
var _component_helpers = require("./component_helpers");
|
|
65
72
|
Object.keys(_component_helpers).forEach(function (key) {
|
|
66
73
|
if (key === "default" || key === "__esModule") return;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/eui",
|
|
3
3
|
"description": "Elastic UI Component Library",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "78.0.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "lib",
|
|
7
7
|
"module": "es",
|
|
8
8
|
"types": "eui.d.ts",
|
|
9
|
-
"docker_image": "node:16.
|
|
9
|
+
"docker_image": "node:16.19.1",
|
|
10
10
|
"sideEffects": [
|
|
11
11
|
"*.css",
|
|
12
12
|
"*.scss"
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"react-focus-on": "^3.7.0",
|
|
81
81
|
"react-input-autosize": "^3.0.0",
|
|
82
82
|
"react-is": "^17.0.2",
|
|
83
|
+
"react-remove-scroll-bar": "^2.3.4",
|
|
83
84
|
"react-virtualized-auto-sizer": "^1.0.6",
|
|
84
85
|
"react-window": "^1.8.6",
|
|
85
86
|
"refractor": "^3.5.0",
|