@elastic/eui 80.0.0 → 81.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 (78) hide show
  1. package/dist/eui_charts_theme.js.map +1 -1
  2. package/es/components/bottom_bar/bottom_bar.js +4 -1
  3. package/es/components/bottom_bar/bottom_bar.styles.js +2 -2
  4. package/es/components/button/button.js +4 -1
  5. package/es/components/button/button_empty/button_empty.js +4 -1
  6. package/es/components/button/button_icon/button_icon.js +4 -1
  7. package/es/components/filter_group/filter_group.a11y.js +2 -2
  8. package/es/components/overlay_mask/overlay_mask.js +25 -9
  9. package/es/components/portal/portal.js +17 -0
  10. package/es/components/selectable/selectable.a11y.js +39 -23
  11. package/es/components/selectable/selectable.js +4 -4
  12. package/es/components/selectable/selectable_list/selectable_list.js +5 -5
  13. package/es/components/selectable/selectable_list/selectable_list_item.js +119 -57
  14. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +4 -4
  15. package/es/services/theme/context.js +7 -1
  16. package/es/services/theme/index.js +1 -1
  17. package/es/services/theme/provider.js +47 -4
  18. package/eui.d.ts +44 -21
  19. package/i18ntokens.json +88 -52
  20. package/lib/components/bottom_bar/bottom_bar.js +4 -1
  21. package/lib/components/bottom_bar/bottom_bar.styles.js +2 -2
  22. package/lib/components/button/button.js +4 -1
  23. package/lib/components/button/button_empty/button_empty.js +4 -1
  24. package/lib/components/button/button_icon/button_icon.js +4 -1
  25. package/lib/components/filter_group/filter_group.a11y.js +2 -2
  26. package/lib/components/overlay_mask/overlay_mask.js +25 -4
  27. package/lib/components/portal/portal.js +17 -0
  28. package/lib/components/selectable/selectable.a11y.js +39 -23
  29. package/lib/components/selectable/selectable.js +4 -4
  30. package/lib/components/selectable/selectable_list/selectable_list.js +5 -5
  31. package/lib/components/selectable/selectable_list/selectable_list_item.js +119 -57
  32. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +4 -4
  33. package/lib/services/theme/context.js +9 -2
  34. package/lib/services/theme/index.js +6 -0
  35. package/lib/services/theme/provider.js +45 -2
  36. package/optimize/es/components/bottom_bar/bottom_bar.js +4 -1
  37. package/optimize/es/components/bottom_bar/bottom_bar.styles.js +2 -2
  38. package/optimize/es/components/button/button.js +4 -1
  39. package/optimize/es/components/button/button_empty/button_empty.js +4 -1
  40. package/optimize/es/components/button/button_icon/button_icon.js +4 -1
  41. package/optimize/es/components/filter_group/filter_group.a11y.js +2 -2
  42. package/optimize/es/components/overlay_mask/overlay_mask.js +22 -9
  43. package/optimize/es/components/portal/portal.js +18 -1
  44. package/optimize/es/components/selectable/selectable.a11y.js +39 -23
  45. package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +117 -54
  46. package/optimize/es/services/theme/context.js +7 -1
  47. package/optimize/es/services/theme/index.js +1 -1
  48. package/optimize/es/services/theme/provider.js +46 -4
  49. package/optimize/lib/components/bottom_bar/bottom_bar.js +4 -1
  50. package/optimize/lib/components/bottom_bar/bottom_bar.styles.js +2 -2
  51. package/optimize/lib/components/button/button.js +4 -1
  52. package/optimize/lib/components/button/button_empty/button_empty.js +4 -1
  53. package/optimize/lib/components/button/button_icon/button_icon.js +4 -1
  54. package/optimize/lib/components/filter_group/filter_group.a11y.js +2 -2
  55. package/optimize/lib/components/overlay_mask/overlay_mask.js +22 -4
  56. package/optimize/lib/components/portal/portal.js +18 -1
  57. package/optimize/lib/components/selectable/selectable.a11y.js +39 -23
  58. package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +117 -54
  59. package/optimize/lib/services/theme/context.js +9 -2
  60. package/optimize/lib/services/theme/index.js +6 -0
  61. package/optimize/lib/services/theme/provider.js +44 -2
  62. package/package.json +2 -5
  63. package/test-env/components/bottom_bar/bottom_bar.js +4 -1
  64. package/test-env/components/bottom_bar/bottom_bar.styles.js +2 -2
  65. package/test-env/components/button/button.js +4 -1
  66. package/test-env/components/button/button_empty/button_empty.js +4 -1
  67. package/test-env/components/button/button_icon/button_icon.js +4 -1
  68. package/test-env/components/filter_group/filter_group.a11y.js +2 -2
  69. package/test-env/components/overlay_mask/overlay_mask.js +22 -4
  70. package/test-env/components/portal/portal.js +17 -0
  71. package/test-env/components/selectable/selectable.a11y.js +39 -23
  72. package/test-env/components/selectable/selectable.js +4 -4
  73. package/test-env/components/selectable/selectable_list/selectable_list.js +5 -5
  74. package/test-env/components/selectable/selectable_list/selectable_list_item.js +120 -57
  75. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +4 -4
  76. package/test-env/services/theme/context.js +9 -2
  77. package/test-env/services/theme/index.js +6 -0
  78. package/test-env/services/theme/provider.js +44 -2
@@ -1,4 +1,8 @@
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 = ["cloneElement", "className"];
3
+ 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
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
2
6
  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; }
3
7
  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; }
4
8
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -18,9 +22,11 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
22
  * Side Public License, v 1.
19
23
  */
20
24
 
21
- import React, { useContext, useEffect, useRef, useState } from 'react';
25
+ import React, { useContext, useEffect, useRef, useMemo, useState } from 'react';
26
+ import classNames from 'classnames';
27
+ import { css } from '@emotion/css';
22
28
  import isEqual from 'lodash/isEqual';
23
- import { EuiSystemContext, EuiThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
29
+ import { EuiSystemContext, EuiThemeContext, EuiNestedThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
24
30
  import { buildTheme, getColorMode, getComputed, mergeDeep } from './utils';
25
31
  import { jsx as ___EmotionJSX } from "@emotion/react";
26
32
  var providerWarning = undefined;
@@ -34,7 +40,11 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
34
40
  var _system = _ref.theme,
35
41
  _colorMode = _ref.colorMode,
36
42
  _modifications = _ref.modify,
37
- children = _ref.children;
43
+ children = _ref.children,
44
+ wrapperProps = _ref.wrapperProps;
45
+ var _useContext = useContext(EuiNestedThemeContext),
46
+ isGlobalTheme = _useContext.isGlobalTheme,
47
+ bodyColor = _useContext.bodyColor;
38
48
  var parentSystem = useContext(EuiSystemContext);
39
49
  var parentModifications = useContext(EuiModificationsContext);
40
50
  var parentColorMode = useContext(EuiColorModeContext);
@@ -89,6 +99,37 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
89
99
  setTheme(getComputed(system, buildTheme(modifications, "_".concat(system.key)), colorMode));
90
100
  }
91
101
  }, [colorMode, system, modifications]);
102
+ var nestedThemeContext = useMemo(function () {
103
+ return {
104
+ isGlobalTheme: false,
105
+ // The theme that determines the global body styles
106
+ bodyColor: isGlobalTheme ? theme.colors.text : bodyColor,
107
+ hasDifferentColorFromGlobalTheme: isGlobalTheme ? false : bodyColor !== theme.colors.text,
108
+ colorClassName: /*#__PURE__*/css("label:euiColorMode-", _colorMode, ";color:", theme.colors.text, ";;label:colorClassName;")
109
+ };
110
+ }, [theme, isGlobalTheme, bodyColor, _colorMode]);
111
+ var renderedChildren = useMemo(function () {
112
+ if (isGlobalTheme) {
113
+ return children; // No wrapper
114
+ }
115
+
116
+ var _ref2 = wrapperProps || {},
117
+ cloneElement = _ref2.cloneElement,
118
+ className = _ref2.className,
119
+ rest = _objectWithoutProperties(_ref2, _excluded);
120
+ var props = _objectSpread(_objectSpread({}, rest), {}, {
121
+ className: classNames(className, nestedThemeContext.colorClassName)
122
+ });
123
+ if (cloneElement) {
124
+ return /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, props), {}, {
125
+ className: classNames(children.props.className, props.className)
126
+ }));
127
+ } else {
128
+ return ___EmotionJSX("span", _extends({}, props, {
129
+ className: classNames('euiThemeProvider', props.className)
130
+ }), children);
131
+ }
132
+ }, [isGlobalTheme, nestedThemeContext, wrapperProps, children]);
92
133
  return ___EmotionJSX(EuiColorModeContext.Provider, {
93
134
  value: colorMode
94
135
  }, ___EmotionJSX(EuiSystemContext.Provider, {
@@ -97,5 +138,7 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
97
138
  value: modifications
98
139
  }, ___EmotionJSX(EuiThemeContext.Provider, {
99
140
  value: theme
100
- }, children))));
141
+ }, ___EmotionJSX(EuiNestedThemeContext.Provider, {
142
+ value: nestedThemeContext
143
+ }, renderedChildren)))));
101
144
  };
package/eui.d.ts CHANGED
@@ -638,6 +638,12 @@ declare module '@elastic/eui/src/services/theme/types' {
638
638
  export type EuiThemeComputed<T = {}> = ComputedThemeShape<EuiThemeShape & T> & {
639
639
  themeName: string;
640
640
  };
641
+ export type EuiThemeNested = {
642
+ isGlobalTheme: boolean;
643
+ hasDifferentColorFromGlobalTheme: boolean;
644
+ bodyColor: string;
645
+ colorClassName: string;
646
+ };
641
647
 
642
648
  }
643
649
  declare module '@elastic/eui/src/services/theme/utils' {
@@ -4156,10 +4162,12 @@ declare module '@elastic/eui/src/components/portal/portal' {
4156
4162
  portalRef?: (ref: HTMLDivElement | null) => void;
4157
4163
  }
4158
4164
  export class EuiPortal extends Component<EuiPortalProps> {
4165
+ static contextType: import("react").Context<import ("@elastic/eui/src/services/theme/types").EuiThemeNested>;
4159
4166
  portalNode: HTMLDivElement | null;
4160
4167
  constructor(props: EuiPortalProps);
4161
4168
  componentDidMount(): void;
4162
4169
  componentWillUnmount(): void;
4170
+ setThemeColor(): void;
4163
4171
  updatePortalRef(ref: HTMLDivElement | null): void;
4164
4172
  render(): import("react").ReactPortal | null;
4165
4173
  }
@@ -6968,7 +6976,8 @@ declare module '@elastic/eui/src/global_styling/functions/size' {
6968
6976
 
6969
6977
  }
6970
6978
  declare module '@elastic/eui/src/services/theme/provider' {
6971
- import React, { PropsWithChildren } from 'react';
6979
+ import React, { PropsWithChildren, HTMLAttributes } from 'react';
6980
+ import type { CommonProps } from '@elastic/eui/src/components/common';
6972
6981
  import { EuiThemeColorMode, EuiThemeSystem, EuiThemeModifications } from '@elastic/eui/src/services/theme/types'; type LEVELS = 'log' | 'warn' | 'error';
6973
6982
  export const setEuiDevProviderWarning: (level: LEVELS | undefined) => LEVELS | undefined;
6974
6983
  export const getEuiDevProviderWarning: () => LEVELS | undefined;
@@ -6977,8 +6986,21 @@ declare module '@elastic/eui/src/services/theme/provider' {
6977
6986
  colorMode?: EuiThemeColorMode;
6978
6987
  modify?: EuiThemeModifications<T>;
6979
6988
  children: any;
6989
+ /**
6990
+ * Nested theme providers will receive a wrapping `span` tag in order to correctly
6991
+ * set the default text `color` that all nested children will inherit.
6992
+ *
6993
+ * If an extra wrapper is not desired, pass `{ cloneElement: true }`.
6994
+ * This requires a **single** child component that the correct color class can be passed to.
6995
+ *
6996
+ * The parent level `EuiProvider`/`EuiThemeProvider` will **not** render a wrapper element, as
6997
+ * the default inherited text color will be set on the page `body`.
6998
+ */
6999
+ wrapperProps?: HTMLAttributes<HTMLElement> & CommonProps & {
7000
+ cloneElement?: boolean;
7001
+ };
6980
7002
  }
6981
- export const EuiThemeProvider: <T extends {} = {}>({ theme: _system, colorMode: _colorMode, modify: _modifications, children, }: React.PropsWithChildren<EuiThemeProviderProps<T>>) => JSX.Element;
7003
+ export const EuiThemeProvider: <T extends {} = {}>({ theme: _system, colorMode: _colorMode, modify: _modifications, children, wrapperProps, }: React.PropsWithChildren<EuiThemeProviderProps<T>>) => JSX.Element;
6982
7004
  export {};
6983
7005
 
6984
7006
  }
@@ -7105,16 +7127,17 @@ declare module '@elastic/eui/src/themes/amsterdam/theme' {
7105
7127
  }
7106
7128
  declare module '@elastic/eui/src/services/theme/context' {
7107
7129
 
7108
- import { EuiThemeColorModeStandard, EuiThemeSystem, EuiThemeComputed } from '@elastic/eui/src/services/theme/types';
7130
+ import { EuiThemeColorModeStandard, EuiThemeSystem, EuiThemeComputed, EuiThemeNested } from '@elastic/eui/src/services/theme/types';
7109
7131
  export const EuiSystemContext: import("react").Context<EuiThemeSystem<{}>>;
7110
7132
  export const EuiModificationsContext: import("react").Context<import ("@elastic/eui").RecursivePartial<import ("@elastic/eui/src/services/theme/types").EuiThemeShape>>;
7111
7133
  export const EuiColorModeContext: import("react").Context<EuiThemeColorModeStandard>;
7112
7134
  export const defaultComputedTheme: EuiThemeComputed<import ("@elastic/eui/src/services/theme/types").EuiThemeShape>;
7113
7135
  export const EuiThemeContext: import("react").Context<EuiThemeComputed<{}>>;
7136
+ export const EuiNestedThemeContext: import("react").Context<EuiThemeNested>;
7114
7137
 
7115
7138
  }
7116
7139
  declare module '@elastic/eui/src/services/theme' {
7117
- export { EuiSystemContext, EuiThemeContext, EuiModificationsContext, EuiColorModeContext, } from '@elastic/eui/src/services/theme/context';
7140
+ export { EuiSystemContext, EuiThemeContext, EuiNestedThemeContext, EuiModificationsContext, EuiColorModeContext, } from '@elastic/eui/src/services/theme/context';
7118
7141
  export type { UseEuiTheme, WithEuiThemeProps } from '@elastic/eui/src/services/theme/hooks';
7119
7142
  export { useEuiTheme, withEuiTheme, RenderWithEuiTheme } from '@elastic/eui/src/services/theme/hooks';
7120
7143
  export type { EuiThemeProviderProps } from '@elastic/eui/src/services/theme/provider';
@@ -9305,10 +9328,6 @@ declare module '@elastic/eui/src/components/overlay_mask/overlay_mask_body.style
9305
9328
 
9306
9329
  }
9307
9330
  declare module '@elastic/eui/src/components/overlay_mask/overlay_mask' {
9308
- /**
9309
- * NOTE: We can't test this component because Enzyme doesn't support rendering
9310
- * into portals.
9311
- */
9312
9331
  import { FunctionComponent, HTMLAttributes, MutableRefObject, ReactNode, Ref } from 'react';
9313
9332
  import { CommonProps } from '@elastic/eui/src/components/common';
9314
9333
  export interface EuiOverlayMaskInterface {
@@ -17996,7 +18015,7 @@ declare module '@elastic/eui/src/components/search_bar/filters/is_filter' {
17996
18015
  declare module '@elastic/eui/src/components/selectable/selectable_option' {
17997
18016
  import React, { HTMLAttributes } from 'react';
17998
18017
  import { CommonProps, ExclusiveUnion } from '@elastic/eui/src/components/common';
17999
- export type EuiSelectableOptionCheckedType = 'on' | 'off' | undefined;
18018
+ export type EuiSelectableOptionCheckedType = 'on' | 'off' | 'mixed' | undefined;
18000
18019
  export type EuiSelectableOptionBase = CommonProps & {
18001
18020
  /**
18002
18021
  * Visible label of option.
@@ -18014,9 +18033,9 @@ declare module '@elastic/eui/src/components/selectable/selectable_option' {
18014
18033
  */
18015
18034
  key?: string;
18016
18035
  /**
18017
- * Leave `undefined` to indicate not selected,
18018
- * 'on' to indicate inclusion and
18019
- * 'off' to indicate exclusion
18036
+ * Leave `undefined` to indicate not selected. Pass a string of
18037
+ * 'on' to indicate inclusion, 'off' to indicate exclusion,
18038
+ * or 'mixed' to indicate inclusion for some.
18020
18039
  */
18021
18040
  checked?: EuiSelectableOptionCheckedType;
18022
18041
  disabled?: boolean;
@@ -18152,8 +18171,8 @@ declare module '@elastic/eui/src/components/selectable/selectable_list/selectabl
18152
18171
  searchable?: boolean;
18153
18172
  /**
18154
18173
  * Attribute applied the option `<li>`.
18155
- * If configured to something besides the default value of `option`,
18156
- * other ARIA attributes such as `aria-checked` will not be automatically configured.
18174
+ * If set to a role that allows [aria-checked](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked),
18175
+ * `aria-checked` will be automatically configured.
18157
18176
  */
18158
18177
  role?: LiHTMLAttributes<HTMLLIElement>['role'];
18159
18178
  /**
@@ -18169,6 +18188,7 @@ declare module '@elastic/eui/src/components/selectable/selectable_list/selectabl
18169
18188
  textWrap: string;
18170
18189
  };
18171
18190
  constructor(props: EuiSelectableListItemProps);
18191
+ isChecked: (role: string, checked: EuiSelectableOptionCheckedType) => boolean | "mixed" | undefined;
18172
18192
  render(): JSX.Element;
18173
18193
  }
18174
18194
 
@@ -18570,6 +18590,7 @@ declare module '@elastic/eui/src/components/selectable' {
18570
18590
  }
18571
18591
  declare module '@elastic/eui/src/components/search_bar/filters/field_value_selection_filter' {
18572
18592
  import { Component, ReactNode } from 'react';
18593
+ import { EuiSelectableOptionCheckedType } from '@elastic/eui/src/components/selectable/selectable_option';
18573
18594
  import { Query } from '@elastic/eui/src/components/search_bar/query';
18574
18595
  import { Clause, OperatorType, Value } from '@elastic/eui/src/components/search_bar/query/ast';
18575
18596
  export interface FieldValueOptionType {
@@ -18621,7 +18642,7 @@ declare module '@elastic/eui/src/components/search_bar/filters/field_value_selec
18621
18642
  getOptionFilter(): OptionsFilter;
18622
18643
  resolveOptionsLoader: () => OptionsLoader;
18623
18644
  resolveOptionName(option: FieldValueOptionType): string;
18624
- onOptionClick(field: string, value: Value, checked: 'on' | 'off' | undefined): void;
18645
+ onOptionClick(field: string, value: Value, checked?: Omit<EuiSelectableOptionCheckedType, 'mixed'>): void;
18625
18646
  resolveMultiSelect(): MultiSelect;
18626
18647
  componentDidMount(): void;
18627
18648
  componentDidUpdate(prevProps: FieldValueSelectionFilterProps): void;
@@ -26573,13 +26594,15 @@ declare module '@elastic/eui' {
26573
26594
  "euiResizableButton.horizontalResizerAriaLabel": any;
26574
26595
  "euiResizableButton.verticalResizerAriaLabel": any;
26575
26596
  "euiResizablePanel.toggleButtonAriaLabel": any;
26576
- "euiSelectableListItem.includedOption": any;
26577
- "euiSelectableListItem.includedOptionInstructions": any;
26578
- "euiSelectableListItem.excludedOption": any;
26579
- "euiSelectableListItem.excludedOptionInstructions": any;
26580
- "euiSelectableListItem.unckeckedOptionInstructions": any;
26581
26597
  "euiSelectableListItem.checkedOption": any;
26582
- "euiSelectableListItem.checkedOptionInstructions": any;
26598
+ "euiSelectableListItem.checkOptionInstructions": any;
26599
+ "euiSelectableListItem.uncheckOptionInstructions": any;
26600
+ "euiSelectableListItem.excludedOption": any;
26601
+ "euiSelectableListItem.excludeOptionInstructions": any;
26602
+ "euiSelectableListItem.mixedOption": any;
26603
+ "euiSelectableListItem.mixedOptionInstructions": any;
26604
+ "euiSelectableListItem.mixedOptionUncheckInstructions": any;
26605
+ "euiSelectableListItem.mixedOptionExcludeInstructions": any;
26583
26606
  "euiSelectableTemplateSitewide.searchPlaceholder": any;
26584
26607
  "euiSelectableTemplateSitewide.loadingResults": any;
26585
26608
  "euiSelectableTemplateSitewide.noResults": any;
package/i18ntokens.json CHANGED
@@ -5976,37 +5976,55 @@
5976
5976
  "filepath": "src/components/resizable_container/resizable_panel.tsx"
5977
5977
  },
5978
5978
  {
5979
- "token": "euiSelectableListItem.includedOption",
5980
- "defString": "Selected option.",
5979
+ "token": "euiSelectableListItem.checkedOption",
5980
+ "defString": "Checked option.",
5981
5981
  "highlighting": "string",
5982
5982
  "loc": {
5983
5983
  "start": {
5984
- "line": 146,
5985
- "column": 8,
5986
- "index": 4547
5984
+ "line": 181,
5985
+ "column": 10,
5986
+ "index": 5657
5987
5987
  },
5988
5988
  "end": {
5989
- "line": 149,
5990
- "column": 10,
5991
- "index": 4658
5989
+ "line": 184,
5990
+ "column": 12,
5991
+ "index": 5772
5992
5992
  }
5993
5993
  },
5994
5994
  "filepath": "src/components/selectable/selectable_list/selectable_list_item.tsx"
5995
5995
  },
5996
5996
  {
5997
- "token": "euiSelectableListItem.includedOptionInstructions",
5998
- "defString": "To exclude this option, press enter.",
5997
+ "token": "euiSelectableListItem.checkOptionInstructions",
5998
+ "defString": "To check this option, press Enter.",
5999
5999
  "highlighting": "string",
6000
6000
  "loc": {
6001
6001
  "start": {
6002
- "line": 152,
6003
- "column": 8,
6004
- "index": 4698
6002
+ "line": 187,
6003
+ "column": 10,
6004
+ "index": 5818
6005
6005
  },
6006
6006
  "end": {
6007
- "line": 155,
6007
+ "line": 190,
6008
+ "column": 12,
6009
+ "index": 5962
6010
+ }
6011
+ },
6012
+ "filepath": "src/components/selectable/selectable_list/selectable_list_item.tsx"
6013
+ },
6014
+ {
6015
+ "token": "euiSelectableListItem.uncheckOptionInstructions",
6016
+ "defString": "To uncheck this option, press Enter.",
6017
+ "highlighting": "string",
6018
+ "loc": {
6019
+ "start": {
6020
+ "line": 195,
6008
6021
  "column": 10,
6009
- "index": 4841
6022
+ "index": 6036
6023
+ },
6024
+ "end": {
6025
+ "line": 198,
6026
+ "column": 12,
6027
+ "index": 6184
6010
6028
  }
6011
6029
  },
6012
6030
  "filepath": "src/components/selectable/selectable_list/selectable_list_item.tsx"
@@ -6017,86 +6035,104 @@
6017
6035
  "highlighting": "string",
6018
6036
  "loc": {
6019
6037
  "start": {
6020
- "line": 159,
6021
- "column": 8,
6022
- "index": 4930
6038
+ "line": 203,
6039
+ "column": 10,
6040
+ "index": 6250
6023
6041
  },
6024
6042
  "end": {
6025
- "line": 162,
6026
- "column": 10,
6027
- "index": 5041
6043
+ "line": 206,
6044
+ "column": 12,
6045
+ "index": 6367
6028
6046
  }
6029
6047
  },
6030
6048
  "filepath": "src/components/selectable/selectable_list/selectable_list_item.tsx"
6031
6049
  },
6032
6050
  {
6033
- "token": "euiSelectableListItem.excludedOptionInstructions",
6034
- "defString": "To uncheck this option, press enter.",
6051
+ "token": "euiSelectableListItem.excludeOptionInstructions",
6052
+ "defString": "To exclude this option, press Enter.",
6035
6053
  "highlighting": "string",
6036
6054
  "loc": {
6037
6055
  "start": {
6038
- "line": 165,
6039
- "column": 8,
6040
- "index": 5081
6056
+ "line": 209,
6057
+ "column": 10,
6058
+ "index": 6413
6041
6059
  },
6042
6060
  "end": {
6043
- "line": 168,
6044
- "column": 10,
6045
- "index": 5224
6061
+ "line": 212,
6062
+ "column": 12,
6063
+ "index": 6561
6046
6064
  }
6047
6065
  },
6048
6066
  "filepath": "src/components/selectable/selectable_list/selectable_list_item.tsx"
6049
6067
  },
6050
6068
  {
6051
- "token": "euiSelectableListItem.unckeckedOptionInstructions",
6052
- "defString": "To select this option, press enter.",
6069
+ "token": "euiSelectableListItem.mixedOption",
6070
+ "defString": "Mixed (indeterminate) option.",
6053
6071
  "highlighting": "string",
6054
6072
  "loc": {
6055
6073
  "start": {
6056
- "line": 172,
6057
- "column": 8,
6058
- "index": 5310
6074
+ "line": 217,
6075
+ "column": 10,
6076
+ "index": 6624
6059
6077
  },
6060
6078
  "end": {
6061
- "line": 175,
6062
- "column": 10,
6063
- "index": 5453
6079
+ "line": 220,
6080
+ "column": 12,
6081
+ "index": 6751
6064
6082
  }
6065
6083
  },
6066
6084
  "filepath": "src/components/selectable/selectable_list/selectable_list_item.tsx"
6067
6085
  },
6068
6086
  {
6069
- "token": "euiSelectableListItem.checkedOption",
6070
- "defString": "Checked option.",
6087
+ "token": "euiSelectableListItem.mixedOptionInstructions",
6088
+ "defString": "To check this option for all, press Enter once.",
6071
6089
  "highlighting": "string",
6072
6090
  "loc": {
6073
6091
  "start": {
6074
- "line": 182,
6075
- "column": 8,
6076
- "index": 5599
6092
+ "line": 223,
6093
+ "column": 10,
6094
+ "index": 6797
6077
6095
  },
6078
6096
  "end": {
6079
- "line": 185,
6080
- "column": 10,
6081
- "index": 5708
6097
+ "line": 226,
6098
+ "column": 12,
6099
+ "index": 6954
6082
6100
  }
6083
6101
  },
6084
6102
  "filepath": "src/components/selectable/selectable_list/selectable_list_item.tsx"
6085
6103
  },
6086
6104
  {
6087
- "token": "euiSelectableListItem.checkedOptionInstructions",
6088
- "defString": "To uncheck this option, press enter.",
6105
+ "token": "euiSelectableListItem.mixedOptionUncheckInstructions",
6106
+ "defString": "To uncheck this option for all, press Enter twice.",
6089
6107
  "highlighting": "string",
6090
6108
  "loc": {
6091
6109
  "start": {
6092
- "line": 188,
6093
- "column": 8,
6094
- "index": 5761
6110
+ "line": 229,
6111
+ "column": 10,
6112
+ "index": 7007
6095
6113
  },
6096
6114
  "end": {
6097
- "line": 191,
6115
+ "line": 232,
6116
+ "column": 12,
6117
+ "index": 7174
6118
+ }
6119
+ },
6120
+ "filepath": "src/components/selectable/selectable_list/selectable_list_item.tsx"
6121
+ },
6122
+ {
6123
+ "token": "euiSelectableListItem.mixedOptionExcludeInstructions",
6124
+ "defString": "To exclude this option for all, press Enter twice.",
6125
+ "highlighting": "string",
6126
+ "loc": {
6127
+ "start": {
6128
+ "line": 235,
6098
6129
  "column": 10,
6099
- "index": 5903
6130
+ "index": 7227
6131
+ },
6132
+ "end": {
6133
+ "line": 238,
6134
+ "column": 12,
6135
+ "index": 7394
6100
6136
  }
6101
6137
  },
6102
6138
  "filepath": "src/components/selectable/selectable_list/selectable_list_item.tsx"
@@ -202,7 +202,10 @@ _EuiBottomBar.propTypes = {
202
202
  var EuiBottomBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
203
203
  var BottomBar = _EuiBottomBar;
204
204
  return (0, _react2.jsx)(_provider.EuiThemeProvider, {
205
- colorMode: 'dark'
205
+ colorMode: 'dark',
206
+ wrapperProps: {
207
+ cloneElement: true
208
+ }
206
209
  }, (0, _react2.jsx)(BottomBar, _extends({
207
210
  ref: ref
208
211
  }, props)));
@@ -15,8 +15,8 @@ var euiBottomBarStyles = function euiBottomBarStyles(euiThemeContext) {
15
15
  var euiTheme = euiThemeContext.euiTheme;
16
16
  return {
17
17
  // Base
18
- // Text color needs to be reapplied to properly scope the forced `colorMode`
19
- euiBottomBar: /*#__PURE__*/(0, _react.css)((0, _mixins.euiShadowFlat)(euiThemeContext), ";background:", (0, _services.shade)(euiTheme.colors.lightestShade, 0.5), ";color:", euiTheme.colors.text, ";", _global_styling.euiCanAnimate, "{animation:", euiBottomBarAppear, " ", euiTheme.animation.slow, " ", euiTheme.animation.resistance, ";};label:euiBottomBar;"),
18
+ // `color` is inherited from the wrapping `EuiThemeProvider colorMode="dark"`
19
+ euiBottomBar: /*#__PURE__*/(0, _react.css)((0, _mixins.euiShadowFlat)(euiThemeContext), ";background:", (0, _services.shade)(euiTheme.colors.lightestShade, 0.5), ";", _global_styling.euiCanAnimate, "{animation:", euiBottomBarAppear, " ", euiTheme.animation.slow, " ", euiTheme.animation.resistance, ";};label:euiBottomBar;"),
20
20
  static: /*#__PURE__*/(0, _react.css)(";label:static;"),
21
21
  fixed: /*#__PURE__*/(0, _react.css)("z-index:", Number(euiTheme.levels.header) - 2, ";;label:fixed;"),
22
22
  sticky: /*#__PURE__*/(0, _react.css)("z-index:", Number(euiTheme.levels.header) - 2, ";;label:sticky;"),
@@ -62,7 +62,10 @@ var EuiButton = function EuiButton(props) {
62
62
  if (_color === 'ghost') {
63
63
  // INCEPTION: If `ghost`, re-implement with a wrapping dark mode theme provider
64
64
  return (0, _react2.jsx)(_services.EuiThemeProvider, {
65
- colorMode: "dark"
65
+ colorMode: "dark",
66
+ wrapperProps: {
67
+ cloneElement: true
68
+ }
66
69
  }, (0, _react2.jsx)(EuiButton, _extends({}, props, {
67
70
  color: "text"
68
71
  })));
@@ -83,7 +83,10 @@ var EuiButtonEmpty = function EuiButtonEmpty(props) {
83
83
  if (_color === 'ghost') {
84
84
  // INCEPTION: If `ghost`, re-implement with a wrapping dark mode theme provider
85
85
  return (0, _react2.jsx)(_services.EuiThemeProvider, {
86
- colorMode: "dark"
86
+ colorMode: "dark",
87
+ wrapperProps: {
88
+ cloneElement: true
89
+ }
87
90
  }, (0, _react2.jsx)(EuiButtonEmpty, _extends({}, props, {
88
91
  color: "text"
89
92
  })));
@@ -82,7 +82,10 @@ var EuiButtonIcon = function EuiButtonIcon(props) {
82
82
  if (_color === 'ghost') {
83
83
  // INCEPTION: If `ghost`, re-implement with a wrapping dark mode theme provider
84
84
  return (0, _react2.jsx)(_services.EuiThemeProvider, {
85
- colorMode: "dark"
85
+ colorMode: "dark",
86
+ wrapperProps: {
87
+ cloneElement: true
88
+ }
86
89
  }, (0, _react2.jsx)(EuiButtonIcon, _extends({}, props, {
87
90
  color: "text"
88
91
  })));
@@ -231,10 +231,10 @@ describe('EuiFilterGroup multiselect example', function () {
231
231
  cy.realPress('Tab');
232
232
  cy.repeatRealPress('ArrowDown', 3);
233
233
  cy.realPress('Enter');
234
- cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich - Selected option. To exclude this option, press enter.');
234
+ cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich - Checked option. To exclude this option, press Enter.');
235
235
  cy.realPress('ArrowDown');
236
236
  cy.repeatRealPress('Enter');
237
- cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Felix Mendelssohn-Bartholdy - Excluded option. To uncheck this option, press enter.');
237
+ cy.get('li[aria-selected="true"]').find('span.euiSelectableListItem__text').should('have.text', 'Felix Mendelssohn-Bartholdy - Excluded option. To uncheck this option, press Enter.');
238
238
  cy.checkAxe();
239
239
  });
240
240
  it('has zero violations when filtering by searchbox', function () {
@@ -18,6 +18,10 @@ var _excluded = ["className", "children", "headerZindexLocation", "maskRef"];
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
  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); }
20
20
  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; }
21
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
22
+ 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."); }
23
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
24
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
21
25
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
22
26
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
23
27
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -53,11 +57,28 @@ var EuiOverlayMask = function EuiOverlayMask(_ref) {
53
57
  });
54
58
  }, [overlayMaskNode]); // eslint-disable-line react-hooks/exhaustive-deps
55
59
 
60
+ // Note: Use `classList.add/remove` instead of setting the entire `className`
61
+ // so as not to override any existing classes set by `EuiPortal`
56
62
  (0, _react.useEffect)(function () {
57
- if (!overlayMaskNode) return;
58
- overlayMaskNode.className = (0, _css.cx)('euiOverlayMask', cssStyles, className);
59
- overlayMaskNode.dataset.relativeToHeader = headerZindexLocation;
60
- }, [overlayMaskNode, className, cssStyles, headerZindexLocation]);
63
+ if (overlayMaskNode) {
64
+ overlayMaskNode.classList.add('euiOverlayMask', cssStyles);
65
+ overlayMaskNode.dataset.relativeToHeader = headerZindexLocation;
66
+ return function () {
67
+ return overlayMaskNode.classList.remove(cssStyles);
68
+ };
69
+ }
70
+ }, [overlayMaskNode, cssStyles, headerZindexLocation]);
71
+ (0, _react.useEffect)(function () {
72
+ if (className && overlayMaskNode) {
73
+ var _overlayMaskNode$clas;
74
+ var classNameArgs = className.split(' '); // The `classList` API doesn't support multiple classes in the same string
75
+ (_overlayMaskNode$clas = overlayMaskNode.classList).add.apply(_overlayMaskNode$clas, _toConsumableArray(classNameArgs));
76
+ return function () {
77
+ var _overlayMaskNode$clas2;
78
+ return (_overlayMaskNode$clas2 = overlayMaskNode.classList).remove.apply(_overlayMaskNode$clas2, _toConsumableArray(classNameArgs));
79
+ };
80
+ }
81
+ }, [overlayMaskNode, className]);
61
82
  return (0, _react2.jsx)(_portal.EuiPortal, {
62
83
  portalRef: combinedMaskRef
63
84
  }, (0, _react2.jsx)(_react2.Global, {
@@ -7,6 +7,7 @@ exports.insertPositions = exports.INSERT_POSITIONS = exports.EuiPortal = void 0;
7
7
  var _react = require("react");
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _reactDom = require("react-dom");
10
+ var _services = require("../../services");
10
11
  var _common = require("../common");
11
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
13
  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); }
@@ -57,6 +58,7 @@ var EuiPortal = /*#__PURE__*/function (_Component) {
57
58
  _createClass(EuiPortal, [{
58
59
  key: "componentDidMount",
59
60
  value: function componentDidMount() {
61
+ this.setThemeColor();
60
62
  this.updatePortalRef(this.portalNode);
61
63
  }
62
64
  }, {
@@ -68,6 +70,20 @@ var EuiPortal = /*#__PURE__*/function (_Component) {
68
70
  }
69
71
  this.updatePortalRef(null);
70
72
  }
73
+
74
+ // Set the inherited color of the portal based on the wrapping EuiThemeProvider
75
+ }, {
76
+ key: "setThemeColor",
77
+ value: function setThemeColor() {
78
+ if (this.portalNode && this.context) {
79
+ var _this$context = this.context,
80
+ hasDifferentColorFromGlobalTheme = _this$context.hasDifferentColorFromGlobalTheme,
81
+ colorClassName = _this$context.colorClassName;
82
+ if (hasDifferentColorFromGlobalTheme && this.props.insert == null) {
83
+ this.portalNode.classList.add(colorClassName);
84
+ }
85
+ }
86
+ }
71
87
  }, {
72
88
  key: "updatePortalRef",
73
89
  value: function updatePortalRef(ref) {
@@ -84,6 +100,7 @@ var EuiPortal = /*#__PURE__*/function (_Component) {
84
100
  return EuiPortal;
85
101
  }(_react.Component);
86
102
  exports.EuiPortal = EuiPortal;
103
+ _defineProperty(EuiPortal, "contextType", _services.EuiNestedThemeContext);
87
104
  EuiPortal.propTypes = {
88
105
  /**
89
106
  * ReactNode to render as this component's content