@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.
Files changed (50) hide show
  1. package/README.md +7 -21
  2. package/dist/eui_theme_dark.css +28 -29
  3. package/dist/eui_theme_dark.min.css +1 -1
  4. package/dist/eui_theme_light.css +28 -29
  5. package/dist/eui_theme_light.min.css +1 -1
  6. package/es/components/avatar/avatar.js +15 -3
  7. package/es/components/avatar/avatar.styles.js +46 -9
  8. package/es/components/focus_trap/focus_trap.js +21 -5
  9. package/es/components/form/form.styles.js +2 -2
  10. package/es/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
  11. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +7 -0
  12. package/es/test/rtl/custom_render.js +11 -1
  13. package/es/test/rtl/index.d.ts +1 -1
  14. package/es/test/rtl/index.js +1 -1
  15. package/eui.d.ts +21 -1
  16. package/lib/components/avatar/avatar.js +17 -4
  17. package/lib/components/avatar/avatar.styles.js +46 -9
  18. package/lib/components/focus_trap/focus_trap.js +21 -5
  19. package/lib/components/form/form.styles.js +2 -2
  20. package/lib/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
  21. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +7 -0
  22. package/lib/test/rtl/custom_render.js +11 -2
  23. package/lib/test/rtl/index.d.ts +1 -1
  24. package/lib/test/rtl/index.js +8 -1
  25. package/optimize/es/components/avatar/avatar.js +8 -3
  26. package/optimize/es/components/avatar/avatar.styles.js +46 -9
  27. package/optimize/es/components/focus_trap/focus_trap.js +15 -5
  28. package/optimize/es/components/form/form.styles.js +2 -2
  29. package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
  30. package/optimize/es/test/rtl/custom_render.js +11 -1
  31. package/optimize/es/test/rtl/index.d.ts +1 -1
  32. package/optimize/es/test/rtl/index.js +1 -1
  33. package/optimize/lib/components/avatar/avatar.js +10 -4
  34. package/optimize/lib/components/avatar/avatar.styles.js +46 -9
  35. package/optimize/lib/components/focus_trap/focus_trap.js +15 -5
  36. package/optimize/lib/components/form/form.styles.js +2 -2
  37. package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
  38. package/optimize/lib/test/rtl/custom_render.js +11 -2
  39. package/optimize/lib/test/rtl/index.d.ts +1 -1
  40. package/optimize/lib/test/rtl/index.js +8 -1
  41. package/package.json +3 -2
  42. package/src/components/form/switch/_switch.scss +30 -26
  43. package/src/global_styling/variables/_form.scss +2 -2
  44. package/test-env/components/avatar/avatar.js +17 -4
  45. package/test-env/components/avatar/avatar.styles.js +46 -9
  46. package/test-env/components/form/form.styles.js +2 -2
  47. package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
  48. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +7 -0
  49. package/test-env/test/rtl/custom_render.js +11 -2
  50. package/test-env/test/rtl/index.js +8 -1
@@ -1,5 +1,6 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"];
2
+ var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"],
3
+ _excluded2 = ["casing"];
3
4
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
5
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
6
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -32,6 +33,7 @@ import { euiAvatarStyles } from './avatar.styles';
32
33
  import { jsx as ___EmotionJSX } from "@emotion/react";
33
34
  export var SIZES = ['s', 'm', 'l', 'xl'];
34
35
  export var TYPES = ['space', 'user'];
36
+ export var CASING = ['capitalize', 'uppercase', 'lowercase', 'none'];
35
37
  export var EuiAvatar = function EuiAvatar(_ref) {
36
38
  var _classNames;
37
39
  var className = _ref.className,
@@ -50,14 +52,17 @@ export var EuiAvatar = function EuiAvatar(_ref) {
50
52
  _ref$isDisabled = _ref.isDisabled,
51
53
  isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
52
54
  style = _ref.style,
53
- rest = _objectWithoutProperties(_ref, _excluded);
55
+ props = _objectWithoutProperties(_ref, _excluded);
56
+ var _props$casing = props.casing,
57
+ casing = _props$casing === void 0 ? type === 'space' ? 'none' : 'uppercase' : _props$casing,
58
+ rest = _objectWithoutProperties(props, _excluded2);
54
59
  var euiTheme = useEuiTheme();
55
60
  var styles = euiAvatarStyles(euiTheme);
56
61
  var visColors = euiPaletteColorBlindBehindText();
57
62
  var isPlain = color === 'plain';
58
63
  var isSubdued = color === 'subdued';
59
64
  var classes = classNames('euiAvatar', (_classNames = {}, _defineProperty(_classNames, "euiAvatar--".concat(size), size), _defineProperty(_classNames, "euiAvatar--".concat(type), type), _defineProperty(_classNames, 'euiAvatar-isDisabled', isDisabled), _classNames), className);
60
- var cssStyles = [styles.euiAvatar, styles[size], styles[type], isPlain && styles.plain, isSubdued && styles.subdued, isDisabled && styles.isDisabled];
65
+ var cssStyles = [styles.euiAvatar, styles[type], styles[size], styles[casing], isPlain && styles.plain, isSubdued && styles.subdued, isDisabled && styles.isDisabled];
61
66
  checkValidInitials(initials);
62
67
  var avatarStyle = _objectSpread({}, style);
63
68
  var iconCustomColor = iconColor;
@@ -149,6 +154,13 @@ EuiAvatar.propTypes = {
149
154
  */
150
155
  type: PropTypes.any,
151
156
  size: PropTypes.any,
157
+ /**
158
+ * Sets the letter casing of the displayed initials.
159
+ * Defaults to `uppercase` for `type="user"` avatars.
160
+ * Defaults to `none` (uses the existing casing of the passed `name` or `initials`) for `type="space"` avatars.
161
+ * @default uppercase
162
+ */
163
+ casing: PropTypes.any,
152
164
  /**
153
165
  * Grays out the avatar to simulate being disabled
154
166
  */
@@ -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(_ref3) {
13
- var size = _ref3.size,
14
- fontSize = _ref3.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 _ref2 = process.env.NODE_ENV === "production" ? {
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(_ref4) {
34
- var euiTheme = _ref4.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: _ref2,
73
+ user: _ref6,
42
74
  space: /*#__PURE__*/css("border-radius:", euiTheme.border.radius.medium, ";;label:space;"),
43
75
  // States
44
- isDisabled: _ref,
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
  };
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "clickOutsideDisables", "disabled", "returnFocus", "noIsolation", "scrollLock"];
1
+ var _excluded = ["children", "clickOutsideDisables", "disabled", "returnFocus", "noIsolation", "scrollLock", "gapMode"];
2
2
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
3
  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; }
4
4
  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; }
@@ -28,6 +28,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
28
28
  import React, { Component } from 'react';
29
29
  import PropTypes from "prop-types";
30
30
  import { FocusOn } from 'react-focus-on';
31
+ import { RemoveScrollBar } from 'react-remove-scroll-bar';
31
32
  import { findElementBySelectorOrRef } from '../../services';
32
33
  import { jsx as ___EmotionJSX } from "@emotion/react";
33
34
  export var EuiFocusTrap = /*#__PURE__*/function (_Component) {
@@ -116,17 +117,25 @@ export var EuiFocusTrap = /*#__PURE__*/function (_Component) {
116
117
  returnFocus = _this$props3.returnFocus,
117
118
  noIsolation = _this$props3.noIsolation,
118
119
  scrollLock = _this$props3.scrollLock,
120
+ gapMode = _this$props3.gapMode,
119
121
  rest = _objectWithoutProperties(_this$props3, _excluded);
120
122
  var isDisabled = disabled || this.state.hasBeenDisabledByClick;
121
123
  var focusOnProps = _objectSpread(_objectSpread({
122
124
  returnFocus: returnFocus,
123
125
  noIsolation: noIsolation,
124
- scrollLock: scrollLock,
125
126
  enabled: !isDisabled
126
127
  }, rest), {}, {
127
- onClickOutside: this.handleOutsideClick
128
+ onClickOutside: this.handleOutsideClick,
129
+ /**
130
+ * `scrollLock` should always be unset on FocusOn, as it can prevent scrolling on
131
+ * portals (i.e. popovers, comboboxes, dropdown menus, etc.) within modals & flyouts
132
+ * @see https://github.com/theKashey/react-focus-on/issues/49
133
+ */
134
+ scrollLock: false
128
135
  });
129
- return ___EmotionJSX(FocusOn, focusOnProps, children);
136
+ return ___EmotionJSX(FocusOn, focusOnProps, children, scrollLock && ___EmotionJSX(RemoveScrollBar, {
137
+ gapMode: gapMode
138
+ }));
130
139
  }
131
140
  }]);
132
141
  return EuiFocusTrap;
@@ -136,7 +145,8 @@ _defineProperty(EuiFocusTrap, "defaultProps", {
136
145
  disabled: false,
137
146
  returnFocus: true,
138
147
  noIsolation: true,
139
- scrollLock: false
148
+ scrollLock: false,
149
+ gapMode: 'padding' // EUI defaults to padding because Kibana's body/layout CSS ignores `margin`
140
150
  });
141
151
  EuiFocusTrap.propTypes = {
142
152
  className: PropTypes.string,
@@ -157,5 +167,11 @@ EuiFocusTrap.propTypes = {
157
167
  */
158
168
  initialFocus: PropTypes.any,
159
169
  style: PropTypes.any,
170
+ /**
171
+ * if `scrollLock` is set to true, the body's scrollbar width will be preserved on lock
172
+ * via the `gapMode` CSS property. Depending on your custom CSS, you may prefer to use
173
+ * `margin` instead of `padding`.
174
+ */
175
+ gapMode: PropTypes.oneOf(["padding", "margin"]),
160
176
  disabled: PropTypes.bool
161
177
  };
@@ -45,10 +45,10 @@ export var euiFormVariables = function euiFormVariables(euiThemeContext) {
45
45
  inputGroupBorder: 'none'
46
46
  };
47
47
 
48
- // Colors - specific for checkboxes and radios
48
+ // Colors - specific to checkboxes, radios, switches, and range thumbs
49
49
  var customControlColors = {
50
50
  customControlDisabledIconColor: isColorDark ? shade(euiTheme.colors.mediumShade, 0.38) : tint(euiTheme.colors.mediumShade, 0.485),
51
- customControlBorderColor: isColorDark ? shade(euiTheme.colors.lightestShade, 0.18) : tint(euiTheme.colors.lightestShade, 0.3)
51
+ customControlBorderColor: isColorDark ? shade(euiTheme.colors.lightestShade, 0.4) : tint(euiTheme.colors.lightestShade, 0.31)
52
52
  };
53
53
  var controlLayout = {
54
54
  controlLayoutGroupInputHeight: mathWithUnits(controlHeight, function (x) {
@@ -68,9 +68,9 @@ export var _termValuesToQuery = function _termValuesToQuery(values, options) {
68
68
  var body = {
69
69
  query: values.map(function (value) {
70
70
  if (isString(value) && value.match(/\s/)) {
71
- return "\"".concat(value, "\"");
71
+ return "+\"".concat(value, "\"");
72
72
  }
73
- return value;
73
+ return "+".concat(value);
74
74
  }).join(' ')
75
75
  };
76
76
  if (body.query === '') {
@@ -303,6 +303,13 @@ EuiSelectableTemplateSitewide.propTypes = {
303
303
  */
304
304
  type: PropTypes.any,
305
305
  size: PropTypes.any,
306
+ /**
307
+ * Sets the letter casing of the displayed initials.
308
+ * Defaults to `uppercase` for `type="user"` avatars.
309
+ * Defaults to `none` (uses the existing casing of the passed `name` or `initials`) for `type="space"` avatars.
310
+ * @default uppercase
311
+ */
312
+ casing: PropTypes.any,
306
313
  /**
307
314
  * Grays out the avatar to simulate being disabled
308
315
  */
@@ -44,4 +44,14 @@ export { customRender as render };
44
44
  * @see https://github.com/testing-library/dom-testing-library/issues/516
45
45
  */
46
46
  var customScreen = _objectSpread(_objectSpread({}, screen), within(document.body, dataTestSubjQueries));
47
- export { customScreen as screen };
47
+ export { customScreen as screen };
48
+
49
+ /**
50
+ * Custom within util with EUI query helpers
51
+ *
52
+ * @see https://testing-library.com/docs/dom-testing-library/api-within/
53
+ */
54
+ var customWithin = function customWithin(element) {
55
+ return within(element, _objectSpread(_objectSpread({}, queries), dataTestSubjQueries));
56
+ };
57
+ 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';
package/eui.d.ts CHANGED
@@ -4266,6 +4266,12 @@ declare module '@elastic/eui/src/components/focus_trap/focus_trap' {
4266
4266
  */
4267
4267
  initialFocus?: FocusTarget;
4268
4268
  style?: CSSProperties;
4269
+ /**
4270
+ * if `scrollLock` is set to true, the body's scrollbar width will be preserved on lock
4271
+ * via the `gapMode` CSS property. Depending on your custom CSS, you may prefer to use
4272
+ * `margin` instead of `padding`.
4273
+ */
4274
+ gapMode?: 'padding' | 'margin';
4269
4275
  disabled?: boolean;
4270
4276
  }
4271
4277
  export interface EuiFocusTrapProps extends CommonProps, Omit<ReactFocusOnProps, 'enabled'>, // Inverted `disabled` prop used instead
@@ -4281,6 +4287,7 @@ declare module '@elastic/eui/src/components/focus_trap/focus_trap' {
4281
4287
  returnFocus: boolean;
4282
4288
  noIsolation: boolean;
4283
4289
  scrollLock: boolean;
4290
+ gapMode: string;
4284
4291
  };
4285
4292
  state: State;
4286
4293
  lastInterceptedEvent: Event | null;
@@ -8387,6 +8394,10 @@ declare module '@elastic/eui/src/components/avatar/avatar.styles' {
8387
8394
  m: import("@emotion/utils").SerializedStyles;
8388
8395
  l: import("@emotion/utils").SerializedStyles;
8389
8396
  xl: import("@emotion/utils").SerializedStyles;
8397
+ capitalize: import("@emotion/utils").SerializedStyles;
8398
+ uppercase: import("@emotion/utils").SerializedStyles;
8399
+ lowercase: import("@emotion/utils").SerializedStyles;
8400
+ none: import("@emotion/utils").SerializedStyles;
8390
8401
  };
8391
8402
 
8392
8403
  }
@@ -8397,7 +8408,9 @@ declare module '@elastic/eui/src/components/avatar/avatar' {
8397
8408
  export const SIZES: readonly ["s", "m", "l", "xl"];
8398
8409
  export type EuiAvatarSize = typeof SIZES[number];
8399
8410
  export const TYPES: readonly ["space", "user"];
8400
- export type EuiAvatarType = typeof TYPES[number]; type _EuiAvatarContent = ExclusiveUnion<ExclusiveUnion<{
8411
+ export type EuiAvatarType = typeof TYPES[number];
8412
+ export const CASING: readonly ["capitalize", "uppercase", "lowercase", "none"];
8413
+ export type EuiAvatarCasing = typeof CASING[number]; type _EuiAvatarContent = ExclusiveUnion<ExclusiveUnion<{
8401
8414
  /**
8402
8415
  * Custom initials (max 2 characters).
8403
8416
  * By default will take the first character (of each word).
@@ -8444,6 +8457,13 @@ declare module '@elastic/eui/src/components/avatar/avatar' {
8444
8457
  */
8445
8458
  type?: EuiAvatarType;
8446
8459
  size?: EuiAvatarSize;
8460
+ /**
8461
+ * Sets the letter casing of the displayed initials.
8462
+ * Defaults to `uppercase` for `type="user"` avatars.
8463
+ * Defaults to `none` (uses the existing casing of the passed `name` or `initials`) for `type="space"` avatars.
8464
+ * @default uppercase
8465
+ */
8466
+ casing?: EuiAvatarCasing;
8447
8467
  /**
8448
8468
  * Grays out the avatar to simulate being disabled
8449
8469
  */
@@ -4,7 +4,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
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 _react = _interopRequireDefault(require("react"));
9
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
@@ -13,7 +13,8 @@ var _services = require("../../services");
13
13
  var _icon = require("../icon");
14
14
  var _avatar = require("./avatar.styles");
15
15
  var _react2 = require("@emotion/react");
16
- var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"];
16
+ var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"],
17
+ _excluded2 = ["casing"];
17
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
19
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
20
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
@@ -33,6 +34,8 @@ var SIZES = ['s', 'm', 'l', 'xl'];
33
34
  exports.SIZES = SIZES;
34
35
  var TYPES = ['space', 'user'];
35
36
  exports.TYPES = TYPES;
37
+ var CASING = ['capitalize', 'uppercase', 'lowercase', 'none'];
38
+ exports.CASING = CASING;
36
39
  var EuiAvatar = function EuiAvatar(_ref) {
37
40
  var _classNames;
38
41
  var className = _ref.className,
@@ -51,14 +54,17 @@ var EuiAvatar = function EuiAvatar(_ref) {
51
54
  _ref$isDisabled = _ref.isDisabled,
52
55
  isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
53
56
  style = _ref.style,
54
- rest = _objectWithoutProperties(_ref, _excluded);
57
+ props = _objectWithoutProperties(_ref, _excluded);
58
+ var _props$casing = props.casing,
59
+ casing = _props$casing === void 0 ? type === 'space' ? 'none' : 'uppercase' : _props$casing,
60
+ rest = _objectWithoutProperties(props, _excluded2);
55
61
  var euiTheme = (0, _services.useEuiTheme)();
56
62
  var styles = (0, _avatar.euiAvatarStyles)(euiTheme);
57
63
  var visColors = (0, _services.euiPaletteColorBlindBehindText)();
58
64
  var isPlain = color === 'plain';
59
65
  var isSubdued = color === 'subdued';
60
66
  var classes = (0, _classnames.default)('euiAvatar', (_classNames = {}, _defineProperty(_classNames, "euiAvatar--".concat(size), size), _defineProperty(_classNames, "euiAvatar--".concat(type), type), _defineProperty(_classNames, 'euiAvatar-isDisabled', isDisabled), _classNames), className);
61
- var cssStyles = [styles.euiAvatar, styles[size], styles[type], isPlain && styles.plain, isSubdued && styles.subdued, isDisabled && styles.isDisabled];
67
+ var cssStyles = [styles.euiAvatar, styles[type], styles[size], styles[casing], isPlain && styles.plain, isSubdued && styles.subdued, isDisabled && styles.isDisabled];
62
68
  checkValidInitials(initials);
63
69
  var avatarStyle = _objectSpread({}, style);
64
70
  var iconCustomColor = iconColor;
@@ -151,6 +157,13 @@ EuiAvatar.propTypes = {
151
157
  */
152
158
  type: _propTypes.default.any,
153
159
  size: _propTypes.default.any,
160
+ /**
161
+ * Sets the letter casing of the displayed initials.
162
+ * Defaults to `uppercase` for `type="user"` avatars.
163
+ * Defaults to `none` (uses the existing casing of the passed `name` or `initials`) for `type="space"` avatars.
164
+ * @default uppercase
165
+ */
166
+ casing: _propTypes.default.any,
154
167
  /**
155
168
  * Grays out the avatar to simulate being disabled
156
169
  */
@@ -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(_ref3) {
11
- var size = _ref3.size,
12
- fontSize = _ref3.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 _ref2 = process.env.NODE_ENV === "production" ? {
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(_ref4) {
32
- var euiTheme = _ref4.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: _ref2,
71
+ user: _ref6,
40
72
  space: /*#__PURE__*/(0, _react.css)("border-radius:", euiTheme.border.radius.medium, ";;label:space;"),
41
73
  // States
42
- isDisabled: _ref,
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;
@@ -7,9 +7,10 @@ exports.EuiFocusTrap = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _reactFocusOn = require("react-focus-on");
10
+ var _reactRemoveScrollBar = require("react-remove-scroll-bar");
10
11
  var _services = require("../../services");
11
12
  var _react2 = require("@emotion/react");
12
- var _excluded = ["children", "clickOutsideDisables", "disabled", "returnFocus", "noIsolation", "scrollLock"];
13
+ var _excluded = ["children", "clickOutsideDisables", "disabled", "returnFocus", "noIsolation", "scrollLock", "gapMode"];
13
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
15
  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); }
15
16
  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; }
@@ -117,17 +118,25 @@ var EuiFocusTrap = /*#__PURE__*/function (_Component) {
117
118
  returnFocus = _this$props3.returnFocus,
118
119
  noIsolation = _this$props3.noIsolation,
119
120
  scrollLock = _this$props3.scrollLock,
121
+ gapMode = _this$props3.gapMode,
120
122
  rest = _objectWithoutProperties(_this$props3, _excluded);
121
123
  var isDisabled = disabled || this.state.hasBeenDisabledByClick;
122
124
  var focusOnProps = _objectSpread(_objectSpread({
123
125
  returnFocus: returnFocus,
124
126
  noIsolation: noIsolation,
125
- scrollLock: scrollLock,
126
127
  enabled: !isDisabled
127
128
  }, rest), {}, {
128
- onClickOutside: this.handleOutsideClick
129
+ onClickOutside: this.handleOutsideClick,
130
+ /**
131
+ * `scrollLock` should always be unset on FocusOn, as it can prevent scrolling on
132
+ * portals (i.e. popovers, comboboxes, dropdown menus, etc.) within modals & flyouts
133
+ * @see https://github.com/theKashey/react-focus-on/issues/49
134
+ */
135
+ scrollLock: false
129
136
  });
130
- return (0, _react2.jsx)(_reactFocusOn.FocusOn, focusOnProps, children);
137
+ return (0, _react2.jsx)(_reactFocusOn.FocusOn, focusOnProps, children, scrollLock && (0, _react2.jsx)(_reactRemoveScrollBar.RemoveScrollBar, {
138
+ gapMode: gapMode
139
+ }));
131
140
  }
132
141
  }]);
133
142
  return EuiFocusTrap;
@@ -138,7 +147,8 @@ _defineProperty(EuiFocusTrap, "defaultProps", {
138
147
  disabled: false,
139
148
  returnFocus: true,
140
149
  noIsolation: true,
141
- scrollLock: false
150
+ scrollLock: false,
151
+ gapMode: 'padding' // EUI defaults to padding because Kibana's body/layout CSS ignores `margin`
142
152
  });
143
153
  EuiFocusTrap.propTypes = {
144
154
  className: _propTypes.default.string,
@@ -159,5 +169,11 @@ EuiFocusTrap.propTypes = {
159
169
  */
160
170
  initialFocus: _propTypes.default.any,
161
171
  style: _propTypes.default.any,
172
+ /**
173
+ * if `scrollLock` is set to true, the body's scrollbar width will be preserved on lock
174
+ * via the `gapMode` CSS property. Depending on your custom CSS, you may prefer to use
175
+ * `margin` instead of `padding`.
176
+ */
177
+ gapMode: _propTypes.default.oneOf(["padding", "margin"]),
162
178
  disabled: _propTypes.default.bool
163
179
  };
@@ -43,10 +43,10 @@ var euiFormVariables = function euiFormVariables(euiThemeContext) {
43
43
  inputGroupBorder: 'none'
44
44
  };
45
45
 
46
- // Colors - specific for checkboxes and radios
46
+ // Colors - specific to checkboxes, radios, switches, and range thumbs
47
47
  var customControlColors = {
48
48
  customControlDisabledIconColor: isColorDark ? (0, _services.shade)(euiTheme.colors.mediumShade, 0.38) : (0, _services.tint)(euiTheme.colors.mediumShade, 0.485),
49
- customControlBorderColor: isColorDark ? (0, _services.shade)(euiTheme.colors.lightestShade, 0.18) : (0, _services.tint)(euiTheme.colors.lightestShade, 0.3)
49
+ customControlBorderColor: isColorDark ? (0, _services.shade)(euiTheme.colors.lightestShade, 0.4) : (0, _services.tint)(euiTheme.colors.lightestShade, 0.31)
50
50
  };
51
51
  var controlLayout = {
52
52
  controlLayoutGroupInputHeight: (0, _global_styling.mathWithUnits)(controlHeight, function (x) {
@@ -66,9 +66,9 @@ var _termValuesToQuery = function _termValuesToQuery(values, options) {
66
66
  var body = {
67
67
  query: values.map(function (value) {
68
68
  if ((0, _predicate.isString)(value) && value.match(/\s/)) {
69
- return "\"".concat(value, "\"");
69
+ return "+\"".concat(value, "\"");
70
70
  }
71
- return value;
71
+ return "+".concat(value);
72
72
  }).join(' ')
73
73
  };
74
74
  if (body.query === '') {
@@ -310,6 +310,13 @@ EuiSelectableTemplateSitewide.propTypes = {
310
310
  */
311
311
  type: _propTypes.default.any,
312
312
  size: _propTypes.default.any,
313
+ /**
314
+ * Sets the letter casing of the displayed initials.
315
+ * Defaults to `uppercase` for `type="user"` avatars.
316
+ * Defaults to `none` (uses the existing casing of the passed `name` or `initials`) for `type="space"` avatars.
317
+ * @default uppercase
318
+ */
319
+ casing: _propTypes.default.any,
313
320
  /**
314
321
  * Grays out the avatar to simulate being disabled
315
322
  */
@@ -4,7 +4,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.screen = exports.render = void 0;
7
+ exports.within = exports.screen = exports.render = void 0;
8
8
  var _react = require("@testing-library/react");
9
9
  var _components = require("../../components");
10
10
  var dataTestSubjQueries = _interopRequireWildcard(require("./data_test_subj_queries"));
@@ -42,4 +42,13 @@ exports.render = customRender;
42
42
  * @see https://github.com/testing-library/dom-testing-library/issues/516
43
43
  */
44
44
  var customScreen = _objectSpread(_objectSpread({}, _react.screen), (0, _react.within)(document.body, dataTestSubjQueries));
45
- exports.screen = customScreen;
45
+ exports.screen = customScreen;
46
+ /**
47
+ * Custom within util with EUI query helpers
48
+ *
49
+ * @see https://testing-library.com/docs/dom-testing-library/api-within/
50
+ */
51
+ var customWithin = function customWithin(element) {
52
+ return (0, _react.within)(element, _objectSpread(_objectSpread({}, _react.queries), dataTestSubjQueries));
53
+ };
54
+ 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';