@elastic/eui 109.2.0 → 110.0.0-snapshot.1764684698664

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 (95) hide show
  1. package/es/components/basic_table/in_memory_table.js +86 -233
  2. package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +5 -1
  3. package/es/components/date_picker/super_date_picker/date_popover/relative_tab.js +5 -1
  4. package/es/components/date_picker/super_date_picker/date_popover/timezone_display.js +3 -1
  5. package/es/components/date_picker/super_date_picker/quick_select_popover/index.js +1 -0
  6. package/es/components/date_picker/super_date_picker/time_window_buttons.js +1 -1
  7. package/es/components/filter_group/filter_group.a11y.js +1 -1
  8. package/es/components/header/header_logo/header_logo.js +6 -1
  9. package/es/components/header/header_logo/header_logo.styles.js +1 -1
  10. package/es/components/icon/icon.styles.js +4 -4
  11. package/es/components/page/page.js +11 -3
  12. package/es/components/page/page.styles.js +1 -2
  13. package/es/components/page/page_header/page_header.js +11 -3
  14. package/es/components/page_template/outer/page_outer.js +2 -3
  15. package/es/components/page_template/outer/page_outer.styles.js +29 -35
  16. package/es/components/page_template/page_template.js +8 -2
  17. package/es/components/search_bar/search_bar.js +4 -4
  18. package/es/components/selectable/selectable.js +7 -2
  19. package/es/services/string/to_initials.js +26 -4
  20. package/eui.d.ts +38 -21
  21. package/lib/components/basic_table/in_memory_table.js +85 -234
  22. package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +5 -1
  23. package/lib/components/date_picker/super_date_picker/date_popover/relative_tab.js +5 -1
  24. package/lib/components/date_picker/super_date_picker/date_popover/timezone_display.js +3 -1
  25. package/lib/components/date_picker/super_date_picker/quick_select_popover/index.js +7 -0
  26. package/lib/components/date_picker/super_date_picker/time_window_buttons.js +1 -1
  27. package/lib/components/filter_group/filter_group.a11y.js +1 -1
  28. package/lib/components/header/header_logo/header_logo.js +6 -1
  29. package/lib/components/header/header_logo/header_logo.styles.js +1 -1
  30. package/lib/components/icon/icon.styles.js +4 -4
  31. package/lib/components/page/page.js +10 -2
  32. package/lib/components/page/page.styles.js +1 -2
  33. package/lib/components/page/page_header/page_header.js +10 -2
  34. package/lib/components/page_template/outer/page_outer.js +1 -2
  35. package/lib/components/page_template/outer/page_outer.styles.js +29 -35
  36. package/lib/components/page_template/page_template.js +8 -2
  37. package/lib/components/search_bar/search_bar.js +4 -4
  38. package/lib/components/selectable/selectable.js +7 -2
  39. package/lib/services/string/to_initials.js +26 -4
  40. package/optimize/es/components/basic_table/in_memory_table.js +73 -46
  41. package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +5 -1
  42. package/optimize/es/components/date_picker/super_date_picker/date_popover/relative_tab.js +5 -1
  43. package/optimize/es/components/date_picker/super_date_picker/date_popover/timezone_display.js +3 -1
  44. package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/index.js +1 -0
  45. package/optimize/es/components/date_picker/super_date_picker/time_window_buttons.js +1 -1
  46. package/optimize/es/components/filter_group/filter_group.a11y.js +1 -1
  47. package/optimize/es/components/header/header_logo/header_logo.js +6 -1
  48. package/optimize/es/components/header/header_logo/header_logo.styles.js +1 -1
  49. package/optimize/es/components/icon/icon.styles.js +4 -4
  50. package/optimize/es/components/page/page.js +6 -3
  51. package/optimize/es/components/page/page.styles.js +1 -2
  52. package/optimize/es/components/page/page_header/page_header.js +6 -3
  53. package/optimize/es/components/page_template/outer/page_outer.js +2 -3
  54. package/optimize/es/components/page_template/outer/page_outer.styles.js +29 -35
  55. package/optimize/es/components/page_template/page_template.js +2 -1
  56. package/optimize/es/components/selectable/selectable.js +7 -2
  57. package/optimize/es/services/string/to_initials.js +26 -4
  58. package/optimize/lib/components/basic_table/in_memory_table.js +72 -47
  59. package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +5 -1
  60. package/optimize/lib/components/date_picker/super_date_picker/date_popover/relative_tab.js +5 -1
  61. package/optimize/lib/components/date_picker/super_date_picker/date_popover/timezone_display.js +3 -1
  62. package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/index.js +7 -0
  63. package/optimize/lib/components/date_picker/super_date_picker/time_window_buttons.js +1 -1
  64. package/optimize/lib/components/filter_group/filter_group.a11y.js +1 -1
  65. package/optimize/lib/components/header/header_logo/header_logo.js +6 -1
  66. package/optimize/lib/components/header/header_logo/header_logo.styles.js +1 -1
  67. package/optimize/lib/components/icon/icon.styles.js +4 -4
  68. package/optimize/lib/components/page/page.js +5 -2
  69. package/optimize/lib/components/page/page.styles.js +1 -2
  70. package/optimize/lib/components/page/page_header/page_header.js +5 -2
  71. package/optimize/lib/components/page_template/outer/page_outer.js +1 -2
  72. package/optimize/lib/components/page_template/outer/page_outer.styles.js +29 -35
  73. package/optimize/lib/components/page_template/page_template.js +2 -1
  74. package/optimize/lib/components/selectable/selectable.js +7 -2
  75. package/optimize/lib/services/string/to_initials.js +26 -4
  76. package/package.json +3 -2
  77. package/test-env/components/basic_table/in_memory_table.js +85 -234
  78. package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +5 -1
  79. package/test-env/components/date_picker/super_date_picker/date_popover/relative_tab.js +5 -1
  80. package/test-env/components/date_picker/super_date_picker/date_popover/timezone_display.js +3 -1
  81. package/test-env/components/date_picker/super_date_picker/quick_select_popover/index.js +7 -0
  82. package/test-env/components/date_picker/super_date_picker/time_window_buttons.js +1 -1
  83. package/test-env/components/filter_group/filter_group.a11y.js +1 -1
  84. package/test-env/components/header/header_logo/header_logo.js +6 -1
  85. package/test-env/components/header/header_logo/header_logo.styles.js +1 -1
  86. package/test-env/components/icon/icon.styles.js +4 -4
  87. package/test-env/components/page/page.js +10 -2
  88. package/test-env/components/page/page.styles.js +1 -2
  89. package/test-env/components/page/page_header/page_header.js +10 -2
  90. package/test-env/components/page_template/outer/page_outer.js +1 -2
  91. package/test-env/components/page_template/outer/page_outer.styles.js +29 -35
  92. package/test-env/components/page_template/page_template.js +8 -2
  93. package/test-env/components/search_bar/search_bar.js +4 -4
  94. package/test-env/components/selectable/selectable.js +7 -2
  95. package/test-env/services/string/to_initials.js +26 -4
@@ -1,4 +1,4 @@
1
- var _excluded = ["children", "restrictWidth", "className", "paddingSize", "grow", "direction"];
1
+ var _excluded = ["children", "restrictWidth", "className", "paddingSize", "grow", "direction", "color"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
4
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
@@ -14,7 +14,7 @@ import React from 'react';
14
14
  import PropTypes from "prop-types";
15
15
  import classNames from 'classnames';
16
16
  import { setStyleForRestrictedPageWidth } from './_restrict_width';
17
- import { useEuiPaddingCSS } from '../../global_styling';
17
+ import { useEuiPaddingCSS, useEuiBackgroundColorCSS } from '../../global_styling';
18
18
  import { euiPageStyles } from './page.styles';
19
19
  import { useEuiTheme } from '../../services';
20
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
@@ -29,13 +29,16 @@ export var EuiPage = function EuiPage(_ref) {
29
29
  grow = _ref$grow === void 0 ? true : _ref$grow,
30
30
  _ref$direction = _ref.direction,
31
31
  direction = _ref$direction === void 0 ? 'row' : _ref$direction,
32
+ _ref$color = _ref.color,
33
+ color = _ref$color === void 0 ? 'transparent' : _ref$color,
32
34
  rest = _objectWithoutProperties(_ref, _excluded);
33
35
  // Set max-width as a style prop
34
36
  var widthStyles = setStyleForRestrictedPageWidth(restrictWidth, rest === null || rest === void 0 ? void 0 : rest.style);
35
37
  var euiTheme = useEuiTheme();
36
38
  var styles = euiPageStyles(euiTheme);
37
39
  var padding = useEuiPaddingCSS()[paddingSize];
38
- var stylesCSS = [styles.euiPage, styles[direction], grow && styles.grow, padding, restrictWidth && styles.restrictWidth];
40
+ var backgroundColor = useEuiBackgroundColorCSS()[color];
41
+ var stylesCSS = [styles.euiPage, styles[direction], backgroundColor, grow && styles.grow, padding, restrictWidth && styles.restrictWidth];
39
42
  var classes = classNames('euiPage', className);
40
43
  return ___EmotionJSX("div", _extends({
41
44
  css: stylesCSS,
@@ -60,6 +63,11 @@ EuiPage.propTypes = {
60
63
  * Flip to `column` when not including a sidebar.
61
64
  */
62
65
  direction: PropTypes.oneOf(["row", "column"]),
66
+ /**
67
+ * Defines the page background color.
68
+ * @default 'transparent'
69
+ */
70
+ color: PropTypes.oneOf(["plain", "transparent"]),
63
71
  className: PropTypes.string,
64
72
  "aria-label": PropTypes.string,
65
73
  "data-test-subj": PropTypes.string,
@@ -26,9 +26,8 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
26
26
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
27
27
  };
28
28
  export var euiPageStyles = function euiPageStyles(euiThemeContext) {
29
- var euiTheme = euiThemeContext.euiTheme;
30
29
  return {
31
- euiPage: /*#__PURE__*/css("display:flex;background-color:", euiTheme.colors.body, ";flex-shrink:0;", logicalCSS('max-width', '100%'), ";;label:euiPage;"),
30
+ euiPage: /*#__PURE__*/css("display:flex;flex-shrink:0;", logicalCSS('max-width', '100%'), ";;label:euiPage;"),
32
31
  // Grow
33
32
  grow: _ref2,
34
33
  // Direction
@@ -1,4 +1,4 @@
1
- var _excluded = ["className", "restrictWidth", "paddingSize", "bottomBorder", "alignItems", "responsive", "children", "pageTitle", "pageTitleProps", "iconType", "iconProps", "tabs", "tabsProps", "breadcrumbs", "breadcrumbProps", "description", "rightSideItems", "rightSideGroupProps"];
1
+ var _excluded = ["className", "restrictWidth", "paddingSize", "bottomBorder", "color", "alignItems", "responsive", "children", "pageTitle", "pageTitleProps", "iconType", "iconProps", "tabs", "tabsProps", "breadcrumbs", "breadcrumbProps", "description", "rightSideItems", "rightSideGroupProps"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
4
4
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
@@ -14,7 +14,7 @@ import React from 'react';
14
14
  import PropTypes from "prop-types";
15
15
  import classNames from 'classnames';
16
16
  import { useEuiTheme } from '../../../services';
17
- import { useEuiPaddingCSS } from '../../../global_styling';
17
+ import { useEuiPaddingCSS, useEuiBackgroundColorCSS } from '../../../global_styling';
18
18
  import { EuiPageHeaderContent } from './page_header_content';
19
19
  import { euiPageHeaderStyles } from './page_header.styles';
20
20
  import { jsx as ___EmotionJSX } from "@emotion/react";
@@ -25,6 +25,8 @@ export var EuiPageHeader = function EuiPageHeader(_ref) {
25
25
  _ref$paddingSize = _ref.paddingSize,
26
26
  paddingSize = _ref$paddingSize === void 0 ? 'none' : _ref$paddingSize,
27
27
  bottomBorder = _ref.bottomBorder,
28
+ _ref$color = _ref.color,
29
+ color = _ref$color === void 0 ? 'transparent' : _ref$color,
28
30
  alignItems = _ref.alignItems,
29
31
  _ref$responsive = _ref.responsive,
30
32
  responsive = _ref$responsive === void 0 ? true : _ref$responsive,
@@ -44,7 +46,8 @@ export var EuiPageHeader = function EuiPageHeader(_ref) {
44
46
  var useTheme = useEuiTheme();
45
47
  var styles = euiPageHeaderStyles(useTheme);
46
48
  var inlinePadding = useEuiPaddingCSS('horizontal');
47
- var cssStyles = [styles.euiPageHeader, inlinePadding[paddingSize], bottomBorder === 'extended' && styles.border];
49
+ var backgroundColor = useEuiBackgroundColorCSS()[color];
50
+ var cssStyles = [styles.euiPageHeader, inlinePadding[paddingSize], bottomBorder === 'extended' && styles.border, backgroundColor];
48
51
  var classes = classNames('euiPageHeader', className);
49
52
  var contentProps = {
50
53
  restrictWidth: restrictWidth,
@@ -76,6 +79,11 @@ EuiPageHeader.propTypes = {
76
79
  * Adjust the overall padding.
77
80
  */
78
81
  paddingSize: PropTypes.any,
82
+ /**
83
+ * Define the header background color
84
+ * @default 'transparent'
85
+ */
86
+ color: PropTypes.oneOf(["plain", "transparent"]),
79
87
  className: PropTypes.string,
80
88
  "aria-label": PropTypes.string,
81
89
  "data-test-subj": PropTypes.string,
@@ -12,7 +12,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
12
12
 
13
13
  import React from 'react';
14
14
  import PropTypes from "prop-types";
15
- import { useEuiTheme, useIsWithinBreakpoints } from '../../../services';
15
+ import { useIsWithinBreakpoints } from '../../../services';
16
16
  import { euiPageOuterStyles } from './page_outer.styles';
17
17
  import { jsx as ___EmotionJSX } from "@emotion/react";
18
18
  export var PAGE_DIRECTIONS = ['row', 'column'];
@@ -25,8 +25,7 @@ export var _EuiPageOuter = function _EuiPageOuter(_ref) {
25
25
  _ref$responsive = _ref.responsive,
26
26
  responsive = _ref$responsive === void 0 ? ['xs', 's'] : _ref$responsive,
27
27
  rest = _objectWithoutProperties(_ref, _excluded);
28
- var themeContext = useEuiTheme();
29
- var styles = euiPageOuterStyles(themeContext);
28
+ var styles = euiPageOuterStyles;
30
29
  var isResponding = useIsWithinBreakpoints(responsive);
31
30
  var cssStyles = [styles.euiPageOuter, styles[isResponding ? 'column' : direction], grow && styles.grow];
32
31
  return ___EmotionJSX("div", _extends({
@@ -9,39 +9,33 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
9
9
 
10
10
  import { css } from '@emotion/react';
11
11
  import { logicalCSS } from '../../../global_styling';
12
- var _ref = process.env.NODE_ENV === "production" ? {
13
- name: "15mvjmo-row",
14
- styles: "flex-direction:row;label:row;"
15
- } : {
16
- name: "15mvjmo-row",
17
- styles: "flex-direction:row;label:row;",
18
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
19
- };
20
- var _ref2 = process.env.NODE_ENV === "production" ? {
21
- name: "ll8kmq-column",
22
- styles: "flex-direction:column;label:column;"
23
- } : {
24
- name: "ll8kmq-column",
25
- styles: "flex-direction:column;label:column;",
26
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
27
- };
28
- var _ref3 = process.env.NODE_ENV === "production" ? {
29
- name: "122lw0e-grow",
30
- styles: "flex-grow:1;label:grow;"
31
- } : {
32
- name: "122lw0e-grow",
33
- styles: "flex-grow:1;label:grow;",
34
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
35
- };
36
- export var euiPageOuterStyles = function euiPageOuterStyles(_ref4) {
37
- var euiTheme = _ref4.euiTheme;
38
- return {
39
- euiPageOuter: /*#__PURE__*/css("display:flex;background-color:", euiTheme.colors.body, ";flex-shrink:0;", logicalCSS('max-width', '100%' // Ensures Firefox doesn't expand width beyond bounds
40
- ), ";;label:euiPageOuter;"),
41
- // Grow
42
- grow: _ref3,
43
- // Direction
44
- column: _ref2,
45
- row: _ref
46
- };
12
+ export var euiPageOuterStyles = {
13
+ euiPageOuter: /*#__PURE__*/css("display:flex;flex-shrink:0;", logicalCSS('max-width', '100%' // Ensures Firefox doesn't expand width beyond bounds
14
+ ), ";;label:euiPageOuter;"),
15
+ // Grow
16
+ grow: process.env.NODE_ENV === "production" ? {
17
+ name: "122lw0e-grow",
18
+ styles: "flex-grow:1;label:grow;"
19
+ } : {
20
+ name: "122lw0e-grow",
21
+ styles: "flex-grow:1;label:grow;",
22
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
23
+ },
24
+ // Direction
25
+ column: process.env.NODE_ENV === "production" ? {
26
+ name: "ll8kmq-column",
27
+ styles: "flex-direction:column;label:column;"
28
+ } : {
29
+ name: "ll8kmq-column",
30
+ styles: "flex-direction:column;label:column;",
31
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
32
+ },
33
+ row: process.env.NODE_ENV === "production" ? {
34
+ name: "15mvjmo-row",
35
+ styles: "flex-direction:row;label:row;"
36
+ } : {
37
+ name: "15mvjmo-row",
38
+ styles: "flex-direction:row;label:row;",
39
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
40
+ }
47
41
  };
@@ -108,7 +108,8 @@ export var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
108
108
  header: {
109
109
  restrictWidth: restrictWidth,
110
110
  paddingSize: paddingSize,
111
- bottomBorder: headerBottomBorder
111
+ bottomBorder: headerBottomBorder,
112
+ color: panelled === false ? 'transparent' : 'plain'
112
113
  },
113
114
  section: {
114
115
  restrictWidth: restrictWidth,
@@ -165,7 +166,7 @@ _EuiPageTemplate.propTypes = {
165
166
  "data-test-subj": PropTypes.string,
166
167
  css: PropTypes.any,
167
168
  /**
168
- * Adds a white background and shadow to define the area.
169
+ * Adds a background and shadow to define the area.
169
170
  */
170
171
  panelled: PropTypes.bool,
171
172
  /**
@@ -313,6 +314,11 @@ _EuiPageHeader.propTypes = {
313
314
  * Adjust the overall padding.
314
315
  */
315
316
  paddingSize: PropTypes.any,
317
+ /**
318
+ * Define the header background color
319
+ * @default 'transparent'
320
+ */
321
+ color: PropTypes.oneOf(["plain", "transparent"]),
316
322
  className: PropTypes.string,
317
323
  "aria-label": PropTypes.string,
318
324
  "data-test-subj": PropTypes.string,
@@ -242,15 +242,15 @@ _defineProperty(EuiSearchBar, "Query", Query);
242
242
  EuiSearchBar.propTypes = {
243
243
  onChange: PropTypes.func,
244
244
  /**
245
- The initial query the bar will hold when first mounted
245
+ * The initial query the bar will hold when first mounted
246
246
  */
247
247
  defaultQuery: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]),
248
248
  /**
249
- If you wish to use the search bar as a controlled component, continuously pass the query via this prop.
249
+ * If you wish to use the search bar as a controlled component, continuously pass the query via this prop.
250
250
  */
251
251
  query: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]),
252
252
  /**
253
- Configures the search box. Set `placeholder` to change the placeholder text in the box and `incremental` to support incremental (as you type) search.
253
+ * Configures the search box. Set `placeholder` to change the placeholder text in the box and `incremental` to support incremental (as you type) search.
254
254
  */
255
255
  box: PropTypes.shape({
256
256
  name: PropTypes.string,
@@ -310,7 +310,7 @@ EuiSearchBar.propTypes = {
310
310
  }).isRequired, PropTypes.bool.isRequired])
311
311
  }),
312
312
  /**
313
- An array of search filters. See {@link SearchFilterConfig}.
313
+ * An array of search filters. See {@link SearchFilterConfig}.
314
314
  */
315
315
  filters: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
316
316
  type: PropTypes.oneOf(["is"]).isRequired,
@@ -91,6 +91,12 @@ export var EuiSelectable = /*#__PURE__*/function (_Component) {
91
91
  _this.preventOnFocus = false;
92
92
  return;
93
93
  }
94
+ if (event && _this.props.searchable && event.target === _this.inputRef) {
95
+ _this.setState({
96
+ isFocused: true
97
+ });
98
+ return;
99
+ }
94
100
  if (!_this.state.visibleOptions.length || _this.state.activeOptionIndex != null) {
95
101
  return;
96
102
  }
@@ -466,8 +472,7 @@ export var EuiSelectable = /*#__PURE__*/function (_Component) {
466
472
  onChange: _this2.onSearchChange,
467
473
  listId: _this2.optionsListRef.current ? _this2.listId : undefined // Only pass the listId if it exists on the page
468
474
  ,
469
- "aria-activedescendant": _this2.makeOptionId(activeOptionIndex) // the current faux-focused option
470
- ,
475
+ "aria-activedescendant": activeOptionIndex != null ? _this2.makeOptionId(activeOptionIndex) : undefined,
471
476
  placeholder: placeholderName,
472
477
  isPreFiltered: !!isPreFiltered,
473
478
  optionMatcher: optionMatcher,
@@ -6,6 +6,8 @@
6
6
  * Side Public License, v 1.
7
7
  */
8
8
 
9
+ export var MAX_INITIALS = 2;
10
+
9
11
  /**
10
12
  * This function calculates the initials/acronym for a given name.
11
13
  * It defaults to only 2 characters and will take the first character (of each word).
@@ -17,11 +19,20 @@
17
19
  * @param {string} name The full name of the item to turn into initials
18
20
  * @param {number} initialsLength (Optional) How many characters to show (max 2 allowed)
19
21
  * @param {string} initials (Optional) Custom initials (max 2 characters)
20
- * @returns {string} True if the color is dark, false otherwise.
21
22
  */
22
-
23
- export var MAX_INITIALS = 2;
24
23
  export function toInitials(name, initialsLength, initials) {
24
+ // If `initials` provided, check if it's a single emoji
25
+ // in order to support complex, "multi-character" ones
26
+ if (initials && typeof Intl !== 'undefined' && 'Segmenter' in Intl) {
27
+ var segmenter = new Intl.Segmenter('en', {
28
+ granularity: 'grapheme'
29
+ });
30
+ var segments = Array.from(segmenter.segment(initials));
31
+ if (segments.length === 1 && isEmoji(segments[0].segment)) {
32
+ return segments[0].segment;
33
+ }
34
+ }
35
+
25
36
  // Calculate the number of initials to show, maxing out at MAX_INITIALS
26
37
  var calculatedInitialsLength = initials ? initials.split('').length : name.split(' ').length;
27
38
  calculatedInitialsLength = calculatedInitialsLength > MAX_INITIALS ? MAX_INITIALS : calculatedInitialsLength;
@@ -44,5 +55,16 @@ export function toInitials(name, initialsLength, initials) {
44
55
  calculatedInitials = name.substring(0, calculatedInitialsLength);
45
56
  }
46
57
  }
47
- return calculatedInitials;
58
+ return calculatedInitials || '';
59
+ }
60
+ function isEmoji(str) {
61
+ /**
62
+ * The \p escape sequence allows matching a character based on its Unicode properties
63
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape
64
+ * @see https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt
65
+ * @see https://www.unicode.org/reports/tr51/#Definitions
66
+ * @see https://util.unicode.org/UnicodeJsps/character.jsp?a=1F440&B1=Show
67
+ */
68
+ var emojiRegex = /(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDFF\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFF]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])/;
69
+ return emojiRegex.test(str);
48
70
  }
package/eui.d.ts CHANGED
@@ -8916,6 +8916,7 @@ declare module '@elastic/eui/src/services/sort' {
8916
8916
 
8917
8917
  }
8918
8918
  declare module '@elastic/eui/src/services/string/to_initials' {
8919
+ export const MAX_INITIALS = 2;
8919
8920
  /**
8920
8921
  * This function calculates the initials/acronym for a given name.
8921
8922
  * It defaults to only 2 characters and will take the first character (of each word).
@@ -8927,10 +8928,8 @@ declare module '@elastic/eui/src/services/string/to_initials' {
8927
8928
  * @param {string} name The full name of the item to turn into initials
8928
8929
  * @param {number} initialsLength (Optional) How many characters to show (max 2 allowed)
8929
8930
  * @param {string} initials (Optional) Custom initials (max 2 characters)
8930
- * @returns {string} True if the color is dark, false otherwise.
8931
8931
  */
8932
- export const MAX_INITIALS = 2;
8933
- export function toInitials(name: string, initialsLength?: 1 | 2, initials?: string): string | null;
8932
+ export function toInitials(name: string, initialsLength?: 1 | 2, initials?: string): string;
8934
8933
 
8935
8934
  }
8936
8935
  declare module '@elastic/eui/src/services/string/to_case' {
@@ -18421,7 +18420,12 @@ declare module '@elastic/eui/src/components/date_picker/super_date_picker/date_p
18421
18420
  * `customRender` render function.
18422
18421
  */
18423
18422
  type TimeZoneCustomDisplayRenderOptions = {
18423
+ /** Name with UTC offset and an icon */
18424
18424
  nameDisplay?: ReactNode;
18425
+ /** UTC offset in hours, in plain text e.g. UTC+1 */
18426
+ utcOffset?: string;
18427
+ /** Time zone name e.g. Europe/Brussels */
18428
+ timeZoneName?: string;
18425
18429
  };
18426
18430
  export type EuiTimeZoneDisplayProps = ComponentPropsWithoutRef<'div'> & {
18427
18431
  /**
@@ -18857,6 +18861,7 @@ declare module '@elastic/eui/src/components/date_picker/super_date_picker/quick_
18857
18861
  export { EuiQuickSelectPopover } from '@elastic/eui/src/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover';
18858
18862
  export type { EuiQuickSelectProps } from '@elastic/eui/src/components/date_picker/super_date_picker/quick_select_popover/quick_select';
18859
18863
  export { EuiQuickSelect } from '@elastic/eui/src/components/date_picker/super_date_picker/quick_select_popover/quick_select';
18864
+ export { EuiQuickSelectPanel } from '@elastic/eui/src/components/date_picker/super_date_picker/quick_select_popover/quick_select_panel';
18860
18865
  export type { EuiRecentlyUsedProps } from '@elastic/eui/src/components/date_picker/super_date_picker/quick_select_popover/recently_used';
18861
18866
  export { EuiRecentlyUsed } from '@elastic/eui/src/components/date_picker/super_date_picker/quick_select_popover/recently_used';
18862
18867
 
@@ -21926,6 +21931,11 @@ declare module '@elastic/eui/src/components/page/page' {
21926
21931
  * Flip to `column` when not including a sidebar.
21927
21932
  */
21928
21933
  direction?: 'row' | 'column';
21934
+ /**
21935
+ * Defines the page background color.
21936
+ * @default 'transparent'
21937
+ */
21938
+ color?: 'plain' | 'transparent';
21929
21939
  }
21930
21940
  export const EuiPage: FunctionComponent<EuiPageProps>;
21931
21941
 
@@ -22133,6 +22143,11 @@ declare module '@elastic/eui/src/components/page/page_header/page_header' {
22133
22143
  * Adjust the overall padding.
22134
22144
  */
22135
22145
  paddingSize?: EuiPaddingSize;
22146
+ /**
22147
+ * Define the header background color
22148
+ * @default 'transparent'
22149
+ */
22150
+ color?: 'plain' | 'transparent';
22136
22151
  }
22137
22152
  export const EuiPageHeader: FunctionComponent<EuiPageHeaderProps>;
22138
22153
 
@@ -22279,8 +22294,7 @@ declare module '@elastic/eui/src/components/page' {
22279
22294
 
22280
22295
  }
22281
22296
  declare module '@elastic/eui/src/components/page_template/outer/page_outer.styles' {
22282
- import { UseEuiTheme } from '@elastic/eui/src/services';
22283
- export const euiPageOuterStyles: ({ euiTheme }: UseEuiTheme) => {
22297
+ export const euiPageOuterStyles: {
22284
22298
  euiPageOuter: import("@emotion/react").SerializedStyles;
22285
22299
  grow: import("@emotion/react").SerializedStyles;
22286
22300
  column: import("@emotion/react").SerializedStyles;
@@ -22342,7 +22356,7 @@ declare module '@elastic/eui/src/components/page_template/inner/page_inner' {
22342
22356
  */
22343
22357
  component?: T;
22344
22358
  /**
22345
- * Adds a white background and shadow to define the area.
22359
+ * Adds a background and shadow to define the area.
22346
22360
  */
22347
22361
  panelled?: boolean;
22348
22362
  /**
@@ -24653,21 +24667,21 @@ declare module '@elastic/eui/src/components/search_bar/search_bar' {
24653
24667
  export interface EuiSearchBarProps extends CommonProps {
24654
24668
  onChange?: (args: EuiSearchBarOnChangeArgs) => void | boolean;
24655
24669
  /**
24656
- The initial query the bar will hold when first mounted
24670
+ * The initial query the bar will hold when first mounted
24657
24671
  */
24658
24672
  defaultQuery?: QueryType;
24659
24673
  /**
24660
- If you wish to use the search bar as a controlled component, continuously pass the query via this prop.
24674
+ * If you wish to use the search bar as a controlled component, continuously pass the query via this prop.
24661
24675
  */
24662
24676
  query?: QueryType;
24663
24677
  /**
24664
- Configures the search box. Set `placeholder` to change the placeholder text in the box and `incremental` to support incremental (as you type) search.
24678
+ * Configures the search box. Set `placeholder` to change the placeholder text in the box and `incremental` to support incremental (as you type) search.
24665
24679
  */
24666
24680
  box?: EuiFieldSearchProps & {
24667
24681
  schema?: SchemaType | boolean;
24668
24682
  };
24669
24683
  /**
24670
- An array of search filters. See {@link SearchFilterConfig}.
24684
+ * An array of search filters. See {@link SearchFilterConfig}.
24671
24685
  */
24672
24686
  filters?: SearchFilterConfig[];
24673
24687
  /**
@@ -25735,12 +25749,15 @@ declare module '@elastic/eui/src/components/basic_table/in_memory_table' {
25735
25749
  import { CommonProps } from '@elastic/eui/src/components/common';
25736
25750
  import { EuiTablePaginationProps } from '@elastic/eui/src/components/table/table_pagination';
25737
25751
  import { EuiComponentDefaults } from '@elastic/eui/src/components/provider/component_defaults';
25738
- interface onChangeArgument {
25752
+ export interface EuiInMemoryTableSearchBarOnChangeArgs {
25739
25753
  query: Query | null;
25740
25754
  queryText: string;
25741
25755
  error: Error | null;
25742
25756
  }
25743
- export type Search = boolean | EuiSearchBarProps;
25757
+ export interface EuiInMemoryTableSearchBarProps extends Omit<EuiSearchBarProps, 'onChange'> {
25758
+ onChange?: (args: EuiInMemoryTableSearchBarOnChangeArgs) => void | boolean;
25759
+ }
25760
+ export type Search = boolean | EuiInMemoryTableSearchBarProps;
25744
25761
  interface PaginationOptions extends EuiTablePaginationProps {
25745
25762
  pageSizeOptions?: number[];
25746
25763
  initialPageIndex?: number;
@@ -25754,17 +25771,16 @@ declare module '@elastic/eui/src/components/basic_table/in_memory_table' {
25754
25771
  }
25755
25772
  type Sorting = boolean | SortingOptions;
25756
25773
  type InMemoryTableProps<T extends object> = Omit<EuiBasicTableProps<T>, 'pagination' | 'sorting' | 'noItemsMessage' | 'onChange'> & {
25757
- /**
25758
- * Message to display if table is empty
25759
- * @deprecated Use `noItemsMessage` instead.
25760
- */
25761
- message?: ReactNode;
25762
25774
  /**
25763
25775
  * Message to display if table is empty
25764
25776
  */
25765
25777
  noItemsMessage?: ReactNode;
25766
25778
  /**
25767
- * Configures {@link Search}.
25779
+ * Configures the search bar. Can be `true` for defaults,
25780
+ * or an {@link EuiSearchBarProps} object.
25781
+ *
25782
+ * When `searchFormat="text"`, `query` and `defaultQuery` must be strings
25783
+ * ({@link Query} objects are ignored).
25768
25784
  */
25769
25785
  search?: Search;
25770
25786
  /**
@@ -25772,6 +25788,7 @@ declare module '@elastic/eui/src/components/basic_table/in_memory_table' {
25772
25788
  *
25773
25789
  * However, certain special characters (such as quotes, parentheses, and colons)
25774
25790
  * are reserved for EQL syntax and will error if used.
25791
+ *
25775
25792
  * If your table does not require filter search and instead requires searching for certain
25776
25793
  * symbols, use a plain `text` search format instead (note that filters will be ignored
25777
25794
  * in this format).
@@ -25831,7 +25848,7 @@ declare module '@elastic/eui/src/components/basic_table/in_memory_table' {
25831
25848
  search?: Search;
25832
25849
  };
25833
25850
  search?: Search;
25834
- query: Query | null;
25851
+ query: Query | string | null;
25835
25852
  pageIndex: number;
25836
25853
  pageSize?: number;
25837
25854
  pageSizeOptions?: number[];
@@ -25849,7 +25866,7 @@ declare module '@elastic/eui/src/components/basic_table/in_memory_table' {
25849
25866
  static getDerivedStateFromProps<T extends object>(nextProps: EuiInMemoryTableProps<T>, prevState: State<T>): State<T> | null;
25850
25867
  constructor(props: EuiInMemoryTableProps<T>, context: EuiComponentDefaults);
25851
25868
  onTableChange: ({ page, sort }: Criteria<T>) => void;
25852
- onQueryChange: ({ query, queryText, error }: onChangeArgument) => void;
25869
+ onQueryChange: ({ query, queryText, error, }: EuiInMemoryTableSearchBarOnChangeArgs) => void;
25853
25870
  onPlainTextSearch: (searchValue: string) => void;
25854
25871
  renderSearchBar(): React.JSX.Element | undefined;
25855
25872
  resolveSearchSchema(): SchemaType;
@@ -25866,7 +25883,7 @@ declare module '@elastic/eui/src/components/basic_table/in_memory_table' {
25866
25883
  declare module '@elastic/eui/src/components/basic_table' {
25867
25884
  export type { EuiBasicTableProps, EuiBasicTableColumn, Criteria, CriteriaWithPagination, } from '@elastic/eui/src/components/basic_table/basic_table';
25868
25885
  export { EuiBasicTable } from '@elastic/eui/src/components/basic_table/basic_table';
25869
- export type { EuiInMemoryTableProps, Search } from '@elastic/eui/src/components/basic_table/in_memory_table';
25886
+ export type { EuiInMemoryTableProps, EuiInMemoryTableSearchBarOnChangeArgs, EuiInMemoryTableSearchBarProps, Search, } from '@elastic/eui/src/components/basic_table/in_memory_table';
25870
25887
  export { EuiInMemoryTable } from '@elastic/eui/src/components/basic_table/in_memory_table';
25871
25888
  export type { EuiTableDataType, EuiTableFooterProps, EuiTableFieldDataColumnType, EuiTableComputedColumnType, EuiTableActionsColumnType, EuiTableSelectionType, EuiTableSortingType, } from '@elastic/eui/src/components/basic_table/table_types';
25872
25889
  export type { Pagination } from '@elastic/eui/src/components/basic_table/pagination_bar';