@elastic/eui 77.2.2 → 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 (46) 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/form/form.styles.js +2 -2
  9. package/es/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
  10. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +7 -0
  11. package/es/test/rtl/custom_render.js +11 -1
  12. package/es/test/rtl/index.d.ts +1 -1
  13. package/es/test/rtl/index.js +1 -1
  14. package/eui.d.ts +14 -1
  15. package/lib/components/avatar/avatar.js +17 -4
  16. package/lib/components/avatar/avatar.styles.js +46 -9
  17. package/lib/components/form/form.styles.js +2 -2
  18. package/lib/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
  19. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +7 -0
  20. package/lib/test/rtl/custom_render.js +11 -2
  21. package/lib/test/rtl/index.d.ts +1 -1
  22. package/lib/test/rtl/index.js +8 -1
  23. package/optimize/es/components/avatar/avatar.js +8 -3
  24. package/optimize/es/components/avatar/avatar.styles.js +46 -9
  25. package/optimize/es/components/form/form.styles.js +2 -2
  26. package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
  27. package/optimize/es/test/rtl/custom_render.js +11 -1
  28. package/optimize/es/test/rtl/index.d.ts +1 -1
  29. package/optimize/es/test/rtl/index.js +1 -1
  30. package/optimize/lib/components/avatar/avatar.js +10 -4
  31. package/optimize/lib/components/avatar/avatar.styles.js +46 -9
  32. package/optimize/lib/components/form/form.styles.js +2 -2
  33. package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
  34. package/optimize/lib/test/rtl/custom_render.js +11 -2
  35. package/optimize/lib/test/rtl/index.d.ts +1 -1
  36. package/optimize/lib/test/rtl/index.js +8 -1
  37. package/package.json +2 -2
  38. package/src/components/form/switch/_switch.scss +30 -26
  39. package/src/global_styling/variables/_form.scss +2 -2
  40. package/test-env/components/avatar/avatar.js +17 -4
  41. package/test-env/components/avatar/avatar.styles.js +46 -9
  42. package/test-env/components/form/form.styles.js +2 -2
  43. package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +2 -2
  44. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +7 -0
  45. package/test-env/test/rtl/custom_render.js +11 -2
  46. 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
  };
@@ -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
@@ -8394,6 +8394,10 @@ declare module '@elastic/eui/src/components/avatar/avatar.styles' {
8394
8394
  m: import("@emotion/utils").SerializedStyles;
8395
8395
  l: import("@emotion/utils").SerializedStyles;
8396
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;
8397
8401
  };
8398
8402
 
8399
8403
  }
@@ -8404,7 +8408,9 @@ declare module '@elastic/eui/src/components/avatar/avatar' {
8404
8408
  export const SIZES: readonly ["s", "m", "l", "xl"];
8405
8409
  export type EuiAvatarSize = typeof SIZES[number];
8406
8410
  export const TYPES: readonly ["space", "user"];
8407
- 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<{
8408
8414
  /**
8409
8415
  * Custom initials (max 2 characters).
8410
8416
  * By default will take the first character (of each word).
@@ -8451,6 +8457,13 @@ declare module '@elastic/eui/src/components/avatar/avatar' {
8451
8457
  */
8452
8458
  type?: EuiAvatarType;
8453
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;
8454
8467
  /**
8455
8468
  * Grays out the avatar to simulate being disabled
8456
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;
@@ -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';
@@ -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
- rest = _objectWithoutProperties(_ref, _excluded);
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[type], isPlain && styles.plain, isSubdued && styles.subdued, isDisabled && styles.isDisabled];
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(_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
  };