@elastic/eui 103.0.0 → 103.1.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 (56) hide show
  1. package/dist/eui_theme_amsterdam_dark.json +8 -8
  2. package/dist/eui_theme_amsterdam_light.json +8 -8
  3. package/es/components/card/checkable_card/checkable_card.js +4 -2
  4. package/es/components/combo_box/combo_box.js +4 -2
  5. package/es/components/combo_box/combo_box_input/combo_box_input.js +4 -1
  6. package/es/components/datagrid/controls/fullscreen_selector.js +11 -6
  7. package/es/components/datagrid/data_grid.js +3 -2
  8. package/es/components/form/checkbox/checkbox.js +1 -1
  9. package/es/themes/amsterdam/global_styling/variables/_colors.js +200 -216
  10. package/es/themes/amsterdam/global_styling/variables/_colors_vis.js +1 -1
  11. package/es/themes/json/eui_theme_amsterdam_dark.json +8 -8
  12. package/es/themes/json/eui_theme_amsterdam_light.json +8 -8
  13. package/eui.d.ts +8 -3
  14. package/lib/components/card/checkable_card/checkable_card.js +4 -2
  15. package/lib/components/combo_box/combo_box.js +4 -2
  16. package/lib/components/combo_box/combo_box_input/combo_box_input.js +4 -1
  17. package/lib/components/datagrid/controls/fullscreen_selector.js +11 -6
  18. package/lib/components/datagrid/data_grid.js +3 -2
  19. package/lib/components/form/checkbox/checkbox.js +1 -1
  20. package/lib/themes/amsterdam/global_styling/variables/_colors.js +200 -216
  21. package/lib/themes/amsterdam/global_styling/variables/_colors_vis.js +5 -5
  22. package/lib/themes/json/eui_theme_amsterdam_dark.json +8 -8
  23. package/lib/themes/json/eui_theme_amsterdam_light.json +8 -8
  24. package/optimize/es/components/card/checkable_card/checkable_card.js +4 -2
  25. package/optimize/es/components/combo_box/combo_box.js +4 -2
  26. package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +3 -1
  27. package/optimize/es/components/datagrid/controls/fullscreen_selector.js +11 -6
  28. package/optimize/es/components/datagrid/data_grid.js +3 -2
  29. package/optimize/es/themes/amsterdam/global_styling/variables/_colors.js +200 -216
  30. package/optimize/es/themes/amsterdam/global_styling/variables/_colors_vis.js +1 -1
  31. package/optimize/es/themes/json/eui_theme_amsterdam_dark.json +8 -8
  32. package/optimize/es/themes/json/eui_theme_amsterdam_light.json +8 -8
  33. package/optimize/lib/components/card/checkable_card/checkable_card.js +4 -2
  34. package/optimize/lib/components/combo_box/combo_box.js +4 -2
  35. package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +3 -1
  36. package/optimize/lib/components/datagrid/controls/fullscreen_selector.js +11 -6
  37. package/optimize/lib/components/datagrid/data_grid.js +3 -2
  38. package/optimize/lib/themes/amsterdam/global_styling/variables/_colors.js +200 -216
  39. package/optimize/lib/themes/amsterdam/global_styling/variables/_colors_vis.js +5 -5
  40. package/optimize/lib/themes/json/eui_theme_amsterdam_dark.json +8 -8
  41. package/optimize/lib/themes/json/eui_theme_amsterdam_light.json +8 -8
  42. package/package.json +2 -2
  43. package/src/themes/amsterdam/_colors_dark.scss +8 -8
  44. package/src/themes/amsterdam/_colors_light.scss +8 -8
  45. package/test-env/components/card/checkable_card/checkable_card.js +4 -2
  46. package/test-env/components/combo_box/combo_box.js +4 -2
  47. package/test-env/components/combo_box/combo_box_input/combo_box_input.js +4 -1
  48. package/test-env/components/datagrid/controls/fullscreen_selector.js +11 -6
  49. package/test-env/components/datagrid/data_grid.js +3 -2
  50. package/test-env/components/form/checkbox/checkbox.js +1 -1
  51. package/test-env/themes/amsterdam/global_styling/variables/_colors.js +200 -216
  52. package/test-env/themes/amsterdam/global_styling/variables/_colors_vis.js +5 -5
  53. package/test-env/themes/json/eui_theme_amsterdam_dark.json +8 -8
  54. package/test-env/themes/json/eui_theme_amsterdam_light.json +8 -8
  55. package/package/eui.d.ts +0 -29802
  56. package/temp/package/eui.d.ts +0 -29802
package/eui.d.ts CHANGED
@@ -9191,13 +9191,13 @@ declare module '@elastic/eui/src/components/form/checkbox/checkbox.styles' {
9191
9191
 
9192
9192
  }
9193
9193
  declare module '@elastic/eui/src/components/form/checkbox/checkbox' {
9194
- import { FunctionComponent, ChangeEventHandler, ReactNode, InputHTMLAttributes, LabelHTMLAttributes } from 'react';
9194
+ import { FunctionComponent, ChangeEventHandler, ReactNode, InputHTMLAttributes, LabelHTMLAttributes, Ref } from 'react';
9195
9195
  import { CommonProps } from '@elastic/eui/src/components/common';
9196
9196
  export interface EuiCheckboxProps extends CommonProps, InputHTMLAttributes<HTMLInputElement> {
9197
9197
  id: string;
9198
9198
  checked?: boolean;
9199
9199
  onChange: ChangeEventHandler<HTMLInputElement>;
9200
- inputRef?: (element: HTMLInputElement) => void;
9200
+ inputRef?: Ref<HTMLInputElement> | ((element: HTMLInputElement) => void);
9201
9201
  label?: ReactNode;
9202
9202
  disabled?: boolean;
9203
9203
  indeterminate?: boolean;
@@ -13865,6 +13865,7 @@ declare module '@elastic/eui/src/components/combo_box/combo_box_input/combo_box_
13865
13865
  autoFocus?: boolean;
13866
13866
  'aria-label'?: string;
13867
13867
  'aria-labelledby'?: string;
13868
+ 'aria-describedby'?: string;
13868
13869
  }
13869
13870
  interface EuiComboBoxInputState {
13870
13871
  inputWidth: number;
@@ -15158,6 +15159,10 @@ declare module '@elastic/eui/src/components/datagrid/data_grid_types' {
15158
15159
  * Settings provided may be overwritten or merged with user defined preferences if `toolbarVisibility.showDisplaySelector.allowRowHeight = true` (which is the default).
15159
15160
  */
15160
15161
  rowHeightsOptions?: EuiDataGridRowHeightsOptions;
15162
+ /**
15163
+ * A callback for when the fullscreen state changes. Callback receives `isFullScreen: boolean`.
15164
+ */
15165
+ onFullScreenChange?: (isFullScreen: boolean) => void;
15161
15166
  };
15162
15167
  export type EuiDataGridProps = OneOf<CommonGridProps, 'aria-label' | 'aria-labelledby'>;
15163
15168
  export interface EuiDataGridRefProps {
@@ -17072,7 +17077,7 @@ declare module '@elastic/eui/src/components/datagrid/controls/fullscreen_selecto
17072
17077
  }
17073
17078
  declare module '@elastic/eui/src/components/datagrid/controls/fullscreen_selector' {
17074
17079
  import { ReactNode, KeyboardEventHandler } from 'react';
17075
- export const useDataGridFullScreenSelector: () => {
17080
+ export const useDataGridFullScreenSelector: (onFullScreenChange?: (isFullScreen: boolean) => void) => {
17076
17081
  isFullScreen: boolean;
17077
17082
  setIsFullScreen: (isFullScreen: boolean) => void;
17078
17083
  fullScreenSelector: ReactNode;
@@ -50,6 +50,7 @@ var EuiCheckableCard = exports.EuiCheckableCard = function EuiCheckableCard(_ref
50
50
  var childStyles = [styles.euiCheckableCard__children];
51
51
  var id = rest.id;
52
52
  var labelEl = (0, _react.useRef)(null);
53
+ var inputEl = (0, _react.useRef)(null);
53
54
  var classes = (0, _classnames.default)('euiCheckableCard', className);
54
55
  var checkableElement;
55
56
  if (checkableType === 'radio') {
@@ -59,13 +60,14 @@ var EuiCheckableCard = exports.EuiCheckableCard = function EuiCheckableCard(_ref
59
60
  }, rest));
60
61
  } else {
61
62
  checkableElement = (0, _react2.jsx)(_form.EuiCheckbox, _extends({
63
+ inputRef: inputEl,
62
64
  checked: checked,
63
65
  disabled: disabled
64
66
  }, rest));
65
67
  }
66
68
  var labelClasses = (0, _classnames.default)('euiCheckableCard__label');
67
- var onChangeAffordance = function onChangeAffordance() {
68
- if (labelEl.current) {
69
+ var onChangeAffordance = function onChangeAffordance(e) {
70
+ if (labelEl.current && e.target !== inputEl.current) {
69
71
  labelEl.current.click();
70
72
  }
71
73
  };
@@ -17,7 +17,7 @@ var _combo_box_input = require("./combo_box_input/combo_box_input");
17
17
  var _combo_box_options_list = require("./combo_box_options_list");
18
18
  var _combo_box = require("./combo_box.styles");
19
19
  var _react2 = require("@emotion/react");
20
- var _excluded = ["data-test-subj", "async", "className", "compressed", "customOptionText", "fullWidth", "id", "inputRef", "isCaseSensitive", "isClearable", "isDisabled", "isInvalid", "isLoading", "noSuggestions", "onBlur", "onChange", "onCreateOption", "onSearchChange", "options", "placeholder", "renderOption", "rowHeight", "selectedOptions", "singleSelection", "prepend", "sortMatchesBy", "delimiter", "append", "autoFocus", "truncationProps", "inputPopoverProps", "optionMatcher", "aria-label", "aria-labelledby"];
20
+ var _excluded = ["data-test-subj", "async", "className", "compressed", "customOptionText", "fullWidth", "id", "inputRef", "isCaseSensitive", "isClearable", "isDisabled", "isInvalid", "isLoading", "noSuggestions", "onBlur", "onChange", "onCreateOption", "onSearchChange", "options", "placeholder", "renderOption", "rowHeight", "selectedOptions", "singleSelection", "prepend", "sortMatchesBy", "delimiter", "append", "autoFocus", "truncationProps", "inputPopoverProps", "optionMatcher", "aria-label", "aria-labelledby", "aria-describedby"];
21
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
22
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
23
23
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -494,6 +494,7 @@ var EuiComboBox = exports.EuiComboBox = /*#__PURE__*/function (_Component) {
494
494
  optionMatcher = _this$props11.optionMatcher,
495
495
  ariaLabel = _this$props11['aria-label'],
496
496
  ariaLabelledby = _this$props11['aria-labelledby'],
497
+ ariaDescribedby = _this$props11['aria-describedby'],
497
498
  rest = _objectWithoutProperties(_this$props11, _excluded);
498
499
  var _this$state2 = this.state,
499
500
  activeOptionIndex = _this$state2.activeOptionIndex,
@@ -613,7 +614,8 @@ var EuiComboBox = exports.EuiComboBox = /*#__PURE__*/function (_Component) {
613
614
  isInvalid: markAsInvalid,
614
615
  autoFocus: autoFocus,
615
616
  "aria-label": ariaLabel,
616
- "aria-labelledby": ariaLabelledby
617
+ "aria-labelledby": ariaLabelledby,
618
+ "aria-describedby": ariaDescribedby
617
619
  })
618
620
  }), optionsList));
619
621
  })
@@ -213,7 +213,8 @@ var EuiComboBoxInput = exports.EuiComboBoxInput = /*#__PURE__*/function (_Compon
213
213
  isInvalid = _this$props5.isInvalid,
214
214
  autoFocus = _this$props5.autoFocus,
215
215
  ariaLabel = _this$props5['aria-label'],
216
- ariaLabelledby = _this$props5['aria-labelledby'];
216
+ ariaLabelledby = _this$props5['aria-labelledby'],
217
+ ariaDescribedby = _this$props5['aria-describedby'];
217
218
  var removeOptionMessage;
218
219
  var removeOptionMessageId;
219
220
  if (this.state.hasFocus) {
@@ -287,6 +288,7 @@ var EuiComboBoxInput = exports.EuiComboBoxInput = /*#__PURE__*/function (_Compon
287
288
  "aria-expanded": isListOpen,
288
289
  "aria-label": ariaLabel,
289
290
  "aria-labelledby": ariaLabelledby,
291
+ "aria-describedby": ariaDescribedby,
290
292
  "aria-invalid": isInvalid,
291
293
  "aria-haspopup": "listbox",
292
294
  css: styles.euiComboBoxInput,
@@ -393,6 +395,7 @@ EuiComboBoxInput.propTypes = {
393
395
  autoFocus: _propTypes.default.bool,
394
396
  "aria-label": _propTypes.default.string,
395
397
  "aria-labelledby": _propTypes.default.string,
398
+ "aria-describedby": _propTypes.default.string,
396
399
  className: _propTypes.default.string,
397
400
  "data-test-subj": _propTypes.default.string,
398
401
  css: _propTypes.default.any
@@ -27,11 +27,17 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /*
27
27
  * Side Public License, v 1.
28
28
  */
29
29
  var GRID_IS_FULLSCREEN_CLASSNAME = 'euiDataGrid__restrictBody';
30
- var useDataGridFullScreenSelector = exports.useDataGridFullScreenSelector = function useDataGridFullScreenSelector() {
30
+ var useDataGridFullScreenSelector = exports.useDataGridFullScreenSelector = function useDataGridFullScreenSelector(onFullScreenChange) {
31
31
  var _useState = (0, _react.useState)(false),
32
32
  _useState2 = _slicedToArray(_useState, 2),
33
33
  isFullScreen = _useState2[0],
34
34
  setIsFullScreen = _useState2[1];
35
+ var toggleFullScreen = (0, _react.useCallback)(function () {
36
+ setIsFullScreen(function (prevValue) {
37
+ onFullScreenChange === null || onFullScreenChange === void 0 || onFullScreenChange(!prevValue);
38
+ return !prevValue;
39
+ });
40
+ }, [onFullScreenChange]);
35
41
  var _useEuiI18n = (0, _i18n.useEuiI18n)(['euiFullscreenSelector.fullscreenButton', 'euiFullscreenSelector.fullscreenButtonActive'], ['Enter fullscreen', 'Exit fullscreen']),
36
42
  _useEuiI18n2 = _slicedToArray(_useEuiI18n, 2),
37
43
  fullScreenButton = _useEuiI18n2[0],
@@ -46,22 +52,21 @@ var useDataGridFullScreenSelector = exports.useDataGridFullScreenSelector = func
46
52
  color: "text",
47
53
  "aria-pressed": isFullScreen,
48
54
  "data-test-subj": "dataGridFullScreenButton",
49
- onClick: function onClick() {
50
- return setIsFullScreen(!isFullScreen);
51
- },
55
+ onClick: toggleFullScreen,
52
56
  "aria-label": isFullScreen ? fullScreenButtonActive : fullScreenButton
53
57
  }));
54
- }, [isFullScreen, fullScreenButton, fullScreenButtonActive]);
58
+ }, [isFullScreen, fullScreenButtonActive, fullScreenButton, toggleFullScreen]);
55
59
  var handleGridKeyDown = (0, _react.useCallback)(function (event) {
56
60
  switch (event.key) {
57
61
  case _services.keys.ESCAPE:
58
62
  if (isFullScreen) {
59
63
  event.preventDefault();
60
64
  setIsFullScreen(false);
65
+ onFullScreenChange === null || onFullScreenChange === void 0 || onFullScreenChange(false);
61
66
  }
62
67
  break;
63
68
  }
64
- }, [isFullScreen]);
69
+ }, [isFullScreen, onFullScreenChange]);
65
70
  var styles = (0, _services.useEuiMemoizedStyles)(_fullscreen_selector.euiDataGridFullScreenStyles);
66
71
  (0, _react.useEffect)(function () {
67
72
  // When the data grid is fullscreen, we add a class to the body to remove the extra scrollbar and stay above any fixed headers
@@ -26,7 +26,7 @@ var _ref = require("./utils/ref");
26
26
  var _data_grid_types = require("./data_grid_types");
27
27
  var _data_grid = require("./data_grid.styles");
28
28
  var _react2 = require("@emotion/react");
29
- var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "cellContext", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody", "renderCustomToolbar"];
29
+ var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "cellContext", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody", "renderCustomToolbar", "onFullScreenChange"];
30
30
  /*
31
31
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
32
32
  * or more contributor license agreements. Licensed under the Elastic License
@@ -113,6 +113,7 @@ var EuiDataGrid = exports.EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE
113
113
  virtualizationOptions = props.virtualizationOptions,
114
114
  renderCustomGridBody = props.renderCustomGridBody,
115
115
  renderCustomToolbar = props.renderCustomToolbar,
116
+ onFullScreenChange = props.onFullScreenChange,
116
117
  rest = _objectWithoutProperties(props, _excluded);
117
118
 
118
119
  /**
@@ -255,7 +256,7 @@ var EuiDataGrid = exports.EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE
255
256
  var showToolbar = !!toolbarVisibility;
256
257
  var _useDataGridKeyboardS = (0, _controls.useDataGridKeyboardShortcuts)(),
257
258
  keyboardShortcuts = _useDataGridKeyboardS.keyboardShortcuts;
258
- var _useDataGridFullScree = (0, _controls.useDataGridFullScreenSelector)(),
259
+ var _useDataGridFullScree = (0, _controls.useDataGridFullScreenSelector)(onFullScreenChange),
259
260
  isFullScreen = _useDataGridFullScree.isFullScreen,
260
261
  setIsFullScreen = _useDataGridFullScree.setIsFullScreen,
261
262
  fullScreenSelector = _useDataGridFullScree.fullScreenSelector,
@@ -85,7 +85,7 @@ EuiCheckbox.propTypes = {
85
85
  checked: _propTypes.default.bool,
86
86
  onChange: _propTypes.default.any.isRequired,
87
87
  // overriding to make it required
88
- inputRef: _propTypes.default.func,
88
+ inputRef: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.func.isRequired]),
89
89
  label: _propTypes.default.node,
90
90
  disabled: _propTypes.default.bool,
91
91
  indeterminate: _propTypes.default.bool,