@elastic/eui 91.3.1 → 92.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 (160) hide show
  1. package/dist/eui_charts_theme.js.map +1 -1
  2. package/dist/eui_theme_dark.css +0 -513
  3. package/dist/eui_theme_dark.min.css +1 -1
  4. package/dist/eui_theme_light.css +0 -513
  5. package/dist/eui_theme_light.min.css +1 -1
  6. package/es/components/basic_table/basic_table.js +5 -5
  7. package/es/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  8. package/es/components/filter_group/filter_button.js +20 -13
  9. package/es/components/filter_group/filter_button.styles.js +11 -20
  10. package/es/components/flyout/flyout.js +4 -4
  11. package/es/components/flyout/flyout_resizable.js +127 -0
  12. package/es/components/flyout/flyout_resizable.styles.js +27 -0
  13. package/es/components/flyout/index.js +2 -1
  14. package/es/components/form/range/dual_range.js +15 -66
  15. package/es/components/form/range/range.js +6 -5
  16. package/es/components/form/range/range_slider.js +28 -22
  17. package/es/components/form/text_area/text_area.js +39 -3
  18. package/es/components/index.js +0 -2
  19. package/es/components/markdown_editor/markdown_editor.js +12 -13
  20. package/es/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  21. package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  22. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +5 -0
  23. package/es/components/tree_view/tree_view.js +23 -25
  24. package/es/utils/prop_types/is.js +2 -2
  25. package/eui.d.ts +825 -1141
  26. package/i18ntokens.json +68 -338
  27. package/lib/components/basic_table/basic_table.js +5 -5
  28. package/lib/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  29. package/lib/components/filter_group/filter_button.js +20 -13
  30. package/lib/components/filter_group/filter_button.styles.js +11 -20
  31. package/lib/components/flyout/flyout.js +4 -4
  32. package/lib/components/flyout/flyout_resizable.js +136 -0
  33. package/lib/components/flyout/flyout_resizable.styles.js +32 -0
  34. package/lib/components/flyout/index.js +8 -1
  35. package/lib/components/form/range/dual_range.js +15 -66
  36. package/lib/components/form/range/range.js +6 -5
  37. package/lib/components/form/range/range_slider.js +27 -21
  38. package/lib/components/form/text_area/text_area.js +42 -3
  39. package/lib/components/index.js +0 -22
  40. package/lib/components/markdown_editor/markdown_editor.js +12 -13
  41. package/lib/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  42. package/lib/components/pagination/pagination_button.js +79 -2
  43. package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  44. package/lib/components/tree_view/tree_view.js +23 -25
  45. package/lib/utils/prop_types/is.js +2 -2
  46. package/optimize/es/components/basic_table/basic_table.js +5 -5
  47. package/optimize/es/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  48. package/optimize/es/components/filter_group/filter_button.js +20 -13
  49. package/optimize/es/components/filter_group/filter_button.styles.js +11 -20
  50. package/optimize/es/components/flyout/flyout.js +4 -4
  51. package/optimize/es/components/flyout/flyout_resizable.js +121 -0
  52. package/optimize/es/components/flyout/flyout_resizable.styles.js +27 -0
  53. package/optimize/es/components/flyout/index.js +2 -1
  54. package/optimize/es/components/form/range/dual_range.js +15 -66
  55. package/optimize/es/components/form/range/range.js +6 -5
  56. package/optimize/es/components/form/range/range_slider.js +26 -21
  57. package/optimize/es/components/form/text_area/text_area.js +29 -3
  58. package/optimize/es/components/index.js +0 -2
  59. package/optimize/es/components/markdown_editor/markdown_editor.js +12 -13
  60. package/optimize/es/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  61. package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  62. package/optimize/es/components/tree_view/tree_view.js +23 -25
  63. package/optimize/es/utils/prop_types/is.js +2 -2
  64. package/optimize/lib/components/basic_table/basic_table.js +5 -5
  65. package/optimize/lib/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  66. package/optimize/lib/components/filter_group/filter_button.js +20 -13
  67. package/optimize/lib/components/filter_group/filter_button.styles.js +11 -20
  68. package/optimize/lib/components/flyout/flyout.js +4 -4
  69. package/optimize/lib/components/flyout/flyout_resizable.js +131 -0
  70. package/optimize/lib/components/flyout/flyout_resizable.styles.js +32 -0
  71. package/optimize/lib/components/flyout/index.js +8 -1
  72. package/optimize/lib/components/form/range/dual_range.js +15 -66
  73. package/optimize/lib/components/form/range/range.js +6 -5
  74. package/optimize/lib/components/form/range/range_slider.js +26 -21
  75. package/optimize/lib/components/form/text_area/text_area.js +32 -3
  76. package/optimize/lib/components/index.js +0 -22
  77. package/optimize/lib/components/markdown_editor/markdown_editor.js +12 -13
  78. package/optimize/lib/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  79. package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  80. package/optimize/lib/components/tree_view/tree_view.js +23 -25
  81. package/optimize/lib/utils/prop_types/is.js +2 -2
  82. package/package.json +2 -2
  83. package/src/components/index.scss +0 -2
  84. package/test-env/components/basic_table/basic_table.js +5 -5
  85. package/test-env/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
  86. package/test-env/components/filter_group/filter_button.js +20 -13
  87. package/test-env/components/filter_group/filter_button.styles.js +11 -20
  88. package/test-env/components/flyout/flyout_resizable.js +131 -0
  89. package/test-env/components/flyout/flyout_resizable.styles.js +32 -0
  90. package/test-env/components/flyout/index.js +8 -1
  91. package/test-env/components/form/range/dual_range.js +15 -66
  92. package/test-env/components/form/range/range.js +6 -5
  93. package/test-env/components/form/range/range_slider.js +27 -21
  94. package/test-env/components/form/text_area/text_area.js +42 -3
  95. package/test-env/components/index.js +0 -22
  96. package/test-env/components/markdown_editor/markdown_editor.js +12 -13
  97. package/test-env/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
  98. package/test-env/components/pagination/pagination_button.js +79 -2
  99. package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
  100. package/test-env/components/tree_view/tree_view.js +23 -25
  101. package/test-env/utils/prop_types/is.js +2 -2
  102. package/es/components/control_bar/control_bar.a11y.js +0 -133
  103. package/es/components/control_bar/control_bar.js +0 -609
  104. package/es/components/control_bar/index.js +0 -9
  105. package/es/components/notification/index.js +0 -9
  106. package/es/components/notification/notification_event.a11y.js +0 -104
  107. package/es/components/notification/notification_event.js +0 -288
  108. package/es/components/notification/notification_event_messages.js +0 -79
  109. package/es/components/notification/notification_event_meta.js +0 -148
  110. package/es/components/notification/notification_event_read_button.js +0 -86
  111. package/es/components/notification/notification_event_read_icon.js +0 -77
  112. package/lib/components/control_bar/control_bar.a11y.js +0 -134
  113. package/lib/components/control_bar/control_bar.js +0 -441
  114. package/lib/components/control_bar/index.js +0 -12
  115. package/lib/components/notification/index.js +0 -12
  116. package/lib/components/notification/notification_event.a11y.js +0 -105
  117. package/lib/components/notification/notification_event.js +0 -297
  118. package/lib/components/notification/notification_event_messages.js +0 -88
  119. package/lib/components/notification/notification_event_meta.js +0 -157
  120. package/lib/components/notification/notification_event_read_button.js +0 -93
  121. package/lib/components/notification/notification_event_read_icon.js +0 -64
  122. package/optimize/es/components/control_bar/control_bar.a11y.js +0 -128
  123. package/optimize/es/components/control_bar/control_bar.js +0 -308
  124. package/optimize/es/components/control_bar/index.js +0 -9
  125. package/optimize/es/components/notification/index.js +0 -9
  126. package/optimize/es/components/notification/notification_event.a11y.js +0 -99
  127. package/optimize/es/components/notification/notification_event.js +0 -114
  128. package/optimize/es/components/notification/notification_event_messages.js +0 -63
  129. package/optimize/es/components/notification/notification_event_meta.js +0 -106
  130. package/optimize/es/components/notification/notification_event_read_button.js +0 -44
  131. package/optimize/es/components/notification/notification_event_read_icon.js +0 -44
  132. package/optimize/lib/components/control_bar/control_bar.a11y.js +0 -134
  133. package/optimize/lib/components/control_bar/control_bar.js +0 -301
  134. package/optimize/lib/components/control_bar/index.js +0 -12
  135. package/optimize/lib/components/notification/index.js +0 -12
  136. package/optimize/lib/components/notification/notification_event.a11y.js +0 -105
  137. package/optimize/lib/components/notification/notification_event.js +0 -123
  138. package/optimize/lib/components/notification/notification_event_messages.js +0 -74
  139. package/optimize/lib/components/notification/notification_event_meta.js +0 -117
  140. package/optimize/lib/components/notification/notification_event_read_button.js +0 -51
  141. package/optimize/lib/components/notification/notification_event_read_icon.js +0 -51
  142. package/src/components/control_bar/_control_bar.scss +0 -232
  143. package/src/components/control_bar/_index.scss +0 -2
  144. package/src/components/control_bar/_variables.scss +0 -12
  145. package/src/components/notification/_index.scss +0 -5
  146. package/src/components/notification/_notification_event.scss +0 -40
  147. package/src/components/notification/_notification_event_messages.scss +0 -17
  148. package/src/components/notification/_notification_event_meta.scss +0 -44
  149. package/src/components/notification/_notification_event_read_button.scss +0 -5
  150. package/src/components/notification/_notification_event_read_icon.scss +0 -12
  151. package/test-env/components/control_bar/control_bar.a11y.js +0 -134
  152. package/test-env/components/control_bar/control_bar.js +0 -436
  153. package/test-env/components/control_bar/index.js +0 -12
  154. package/test-env/components/notification/index.js +0 -12
  155. package/test-env/components/notification/notification_event.a11y.js +0 -105
  156. package/test-env/components/notification/notification_event.js +0 -296
  157. package/test-env/components/notification/notification_event_messages.js +0 -85
  158. package/test-env/components/notification/notification_event_meta.js +0 -154
  159. package/test-env/components/notification/notification_event_read_button.js +0 -92
  160. package/test-env/components/notification/notification_event_read_icon.js +0 -63
@@ -1,441 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.EuiControlBar = void 0;
7
- var _classnames = _interopRequireDefault(require("classnames"));
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _services = require("../../services");
11
- var _accessibility = require("../accessibility");
12
- var _breadcrumbs = require("../breadcrumbs");
13
- var _button = require("../button");
14
- var _i18n = require("../i18n");
15
- var _icon = require("../icon");
16
- var _portal = require("../portal");
17
- var _react2 = require("@emotion/react");
18
- var _excluded = ["children", "className", "showContent", "controls", "size", "leftOffset", "rightOffset", "maxHeight", "showOnMobile", "style", "position", "bodyClassName", "landmarkHeading"],
19
- _excluded2 = ["controlType", "id", "color", "label", "className"],
20
- _excluded3 = ["controlType", "id", "iconType", "className", "color", "onClick", "href"],
21
- _excluded4 = ["controlType", "id", "text", "className"],
22
- _excluded5 = ["controlType", "id", "label", "onClick", "className"],
23
- _excluded6 = ["controlType", "id"];
24
- 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); }
25
- 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; }
26
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
- 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); }
28
- 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); }
29
- 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; }
30
- 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; }
31
- 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; }
32
- 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; }
33
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
34
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
35
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
36
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
37
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
38
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
39
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
40
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
42
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
- 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; }
44
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
45
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*
46
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
47
- * or more contributor license agreements. Licensed under the Elastic License
48
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
49
- * in compliance with, at your election, the Elastic License 2.0 or the Server
50
- * Side Public License, v 1.
51
- */ /**
52
- * Extends EuiButton excluding `size`. Requires `label` as the `children`.
53
- */ /**
54
- * Creates a `button` visually styles as a tab.
55
- * Requires `label` as the `children`.
56
- * `onClick` must be provided to handle the content swapping.
57
- */ /**
58
- * Extends EuiBreadcrumbs
59
- */ /**
60
- * Simple div controlling color and size text output.
61
- * Requires `label` as the `children`.
62
- */ /**
63
- * Custom props specific to the icon control type
64
- */ /**
65
- * Icon can extend EuiIcon
66
- * Had to omit `onClick` as it's a valid prop of SVGElement
67
- * Also omits `type` and `id` as these are also specific to icon control
68
- */ /**
69
- * Icon can extend EuiButtonIcon
70
- * Also omits `iconType` and `id` as these are also specific to icon control
71
- */ /**
72
- * @deprecated
73
- */
74
- /**
75
- * @deprecated - EuiControlBar is scheduled for deprecation due to low internal usage and high
76
- * overlap with other existing EUI components. We recommend using EuiBottomBar instead,
77
- * or copying this component into your own application for usage if necessary.
78
- *
79
- * The component will be permanently removed in December 2023.
80
- */
81
- var EuiControlBar = /*#__PURE__*/function (_Component) {
82
- _inherits(EuiControlBar, _Component);
83
- var _super = _createSuper(EuiControlBar);
84
- function EuiControlBar() {
85
- var _this;
86
- _classCallCheck(this, EuiControlBar);
87
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
88
- args[_key] = arguments[_key];
89
- }
90
- _this = _super.call.apply(_super, [this].concat(args));
91
- _defineProperty(_assertThisInitialized(_this), "bar", null);
92
- _defineProperty(_assertThisInitialized(_this), "state", {
93
- selectedTab: ''
94
- });
95
- return _this;
96
- }
97
- _createClass(EuiControlBar, [{
98
- key: "componentDidMount",
99
- value: function componentDidMount() {
100
- if (this.props.position === 'fixed') {
101
- var height = this.bar ? this.bar.clientHeight : -1;
102
- document.body.style.paddingBottom = "".concat(height, "px");
103
- if (this.props.bodyClassName) {
104
- document.body.classList.add(this.props.bodyClassName);
105
- }
106
- }
107
- }
108
- }, {
109
- key: "componentWillUnmount",
110
- value: function componentWillUnmount() {
111
- document.body.style.paddingBottom = '';
112
- if (this.props.bodyClassName) {
113
- document.body.classList.remove(this.props.bodyClassName);
114
- }
115
- }
116
- }, {
117
- key: "render",
118
- value: function render() {
119
- var _this2 = this;
120
- var _this$props = this.props,
121
- children = _this$props.children,
122
- className = _this$props.className,
123
- showContent = _this$props.showContent,
124
- controls = _this$props.controls,
125
- size = _this$props.size,
126
- leftOffset = _this$props.leftOffset,
127
- rightOffset = _this$props.rightOffset,
128
- maxHeight = _this$props.maxHeight,
129
- showOnMobile = _this$props.showOnMobile,
130
- style = _this$props.style,
131
- position = _this$props.position,
132
- bodyClassName = _this$props.bodyClassName,
133
- landmarkHeading = _this$props.landmarkHeading,
134
- rest = _objectWithoutProperties(_this$props, _excluded);
135
- var styles = _objectSpread(_objectSpread({}, style), {}, {
136
- left: leftOffset,
137
- right: rightOffset,
138
- maxHeight: maxHeight
139
- });
140
- var classes = (0, _classnames.default)('euiControlBar', className, {
141
- 'euiControlBar-isOpen': showContent,
142
- 'euiControlBar--large': size === 'l',
143
- 'euiControlBar--medium': size === 'm',
144
- 'euiControlBar--small': size === 's',
145
- 'euiControlBar--fixed': position === 'fixed',
146
- 'euiControlBar--absolute': position === 'absolute',
147
- 'euiControlBar--relative': position === 'relative',
148
- 'euiControlBar--showOnMobile': showOnMobile
149
- });
150
- var handleTabClick = function handleTabClick(control, e) {
151
- _this2.setState({
152
- selectedTab: control.id
153
- }, function () {
154
- control.onClick(e);
155
- });
156
- };
157
- var controlItem = function controlItem(control, index) {
158
- switch (control.controlType) {
159
- case 'button':
160
- {
161
- var controlType = control.controlType,
162
- id = control.id,
163
- color = control.color,
164
- label = control.label,
165
- _className = control.className,
166
- _rest = _objectWithoutProperties(control, _excluded2);
167
- return (0, _react2.jsx)(_button.EuiButton, _extends({
168
- key: id + index,
169
- className: (0, _classnames.default)('euiControlBar__button', _className),
170
- color: color
171
- }, _rest, {
172
- size: "s"
173
- }), label);
174
- }
175
- case 'icon':
176
- {
177
- var _controlType = control.controlType,
178
- _id = control.id,
179
- iconType = control.iconType,
180
- _className2 = control.className,
181
- _control$color = control.color,
182
- _color = _control$color === void 0 ? 'text' : _control$color,
183
- onClick = control.onClick,
184
- href = control.href,
185
- _rest2 = _objectWithoutProperties(control, _excluded3);
186
- return onClick || href ? (0, _react2.jsx)(_button.EuiButtonIcon, _extends({
187
- key: _id + index,
188
- className: (0, _classnames.default)('euiControlBar__buttonIcon', _className2),
189
- onClick: onClick,
190
- href: href,
191
- color: _color
192
- }, _rest2, {
193
- iconType: iconType
194
- })) : (0, _react2.jsx)(_icon.EuiIcon, _extends({
195
- key: _id + index,
196
- className: (0, _classnames.default)('euiControlBar__icon', _className2),
197
- type: iconType,
198
- color: _color
199
- }, _rest2));
200
- }
201
- case 'divider':
202
- return (0, _react2.jsx)("div", {
203
- key: control.controlType + index,
204
- className: "euiControlBar__divider"
205
- });
206
- case 'spacer':
207
- return (0, _react2.jsx)("div", {
208
- key: control.controlType + index,
209
- className: "euiControlBar__spacer"
210
- });
211
- case 'text':
212
- {
213
- var _controlType2 = control.controlType,
214
- _id2 = control.id,
215
- text = control.text,
216
- _className3 = control.className,
217
- _rest3 = _objectWithoutProperties(control, _excluded4);
218
- return (0, _react2.jsx)("div", _extends({
219
- key: _id2,
220
- className: (0, _classnames.default)('euiControlBar__text', _className3)
221
- }, _rest3), text);
222
- }
223
- case 'tab':
224
- {
225
- var _controlType3 = control.controlType,
226
- _id3 = control.id,
227
- _label = control.label,
228
- _onClick = control.onClick,
229
- _className4 = control.className,
230
- _rest4 = _objectWithoutProperties(control, _excluded5);
231
- var tabClasses = (0, _classnames.default)('euiControlBar__tab', {
232
- 'euiControlBar__tab--active': showContent && _id3 === _this2.state.selectedTab
233
- }, _className4);
234
- return (0, _react2.jsx)("button", _extends({
235
- key: _id3 + index,
236
- className: tabClasses,
237
- onClick: function onClick(event) {
238
- return handleTabClick(control, event);
239
- }
240
- }, _rest4), _label);
241
- }
242
- case 'breadcrumbs':
243
- {
244
- var _controlType4 = control.controlType,
245
- _id4 = control.id,
246
- _rest5 = _objectWithoutProperties(control, _excluded6);
247
- return (0, _react2.jsx)(_breadcrumbs.EuiBreadcrumbs, _extends({
248
- className: "euiControlBar__breadcrumbs",
249
- key: control.id
250
- }, _rest5));
251
- }
252
- }
253
- };
254
- var controlBar = (0, _react2.jsx)(_i18n.EuiI18n, {
255
- token: "euiControlBar.screenReaderHeading",
256
- default: "Page level controls"
257
- }, function (screenReaderHeading) {
258
- return (0, _react2.jsx)(_services.EuiThemeProvider, {
259
- colorMode: "dark",
260
- wrapperProps: {
261
- cloneElement: true
262
- }
263
- }, (0, _react2.jsx)("section", _extends({
264
- className: classes
265
- // Though it would be better to use aria-labelledby than aria-label
266
- // and not repeat the same string twice, a bug in voiceover won't list
267
- // some landmarks in the rotor without an aria-label
268
- ,
269
- "aria-label": landmarkHeading ? landmarkHeading : screenReaderHeading
270
- }, rest, {
271
- style: styles
272
- }), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("h2", null, landmarkHeading ? landmarkHeading : screenReaderHeading)), (0, _react2.jsx)("div", {
273
- className: "euiControlBar__controls",
274
- ref: function ref(node) {
275
- _this2.bar = node;
276
- }
277
- }, controls.map(function (control, index) {
278
- return controlItem(control, index);
279
- })), _this2.props.showContent ? (0, _react2.jsx)("div", {
280
- className: "euiControlBar__content"
281
- }, children) : null));
282
- });
283
- return position === 'fixed' ? (0, _react2.jsx)(_portal.EuiPortal, null, controlBar, (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
284
- "aria-live": "assertive"
285
- }, landmarkHeading ? (0, _react2.jsx)(_i18n.EuiI18n, {
286
- token: "euiControlBar.customScreenReaderAnnouncement",
287
- default: "There is a new region landmark called {landmarkHeading} with page level controls at the end of the document.",
288
- values: {
289
- landmarkHeading: landmarkHeading
290
- }
291
- }) : (0, _react2.jsx)(_i18n.EuiI18n, {
292
- token: "euiControlBar.screenReaderAnnouncement",
293
- default: "There is a new region landmark with page level controls at the end of the document."
294
- })))) : controlBar;
295
- }
296
- }]);
297
- return EuiControlBar;
298
- }(_react.Component);
299
- exports.EuiControlBar = EuiControlBar;
300
- _defineProperty(EuiControlBar, "defaultProps", {
301
- leftOffset: 0,
302
- rightOffset: 0,
303
- position: 'fixed',
304
- size: 'l',
305
- showContent: false,
306
- showOnMobile: false
307
- });
308
- EuiControlBar.propTypes = {
309
- className: _propTypes.default.string,
310
- "aria-label": _propTypes.default.string,
311
- "data-test-subj": _propTypes.default.string,
312
- css: _propTypes.default.any,
313
- /**
314
- * Show or hide the content area containing the `children`
315
- */
316
- showContent: _propTypes.default.bool,
317
- /**
318
- * An array of controls, actions, and layout spacers to display.
319
- * Accepts `'button' | 'tab' | 'breadcrumbs' | 'text' | 'icon' | 'spacer' | 'divider'`
320
- */
321
- controls: _propTypes.default.arrayOf(_propTypes.default.shape({
322
- href: _propTypes.default.string,
323
- onClick: _propTypes.default.func,
324
- id: _propTypes.default.string,
325
- label: _propTypes.default.oneOfType([_propTypes.default.node.isRequired, _propTypes.default.node]),
326
- buttonRef: _propTypes.default.any,
327
- controlType: _propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.oneOfType([_propTypes.default.oneOf(["button"]).isRequired, _propTypes.default.oneOfType([_propTypes.default.oneOf(["breadcrumbs"]).isRequired, _propTypes.default.oneOf(["tab"]).isRequired]).isRequired]).isRequired, _propTypes.default.oneOf(["text"]).isRequired]).isRequired, _propTypes.default.oneOf(["icon"]).isRequired]).isRequired, _propTypes.default.oneOf(["divider"]).isRequired]).isRequired, _propTypes.default.oneOf(["spacer"]).isRequired]).isRequired,
328
- className: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string]),
329
- "aria-label": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string]),
330
- "data-test-subj": _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.string]),
331
- css: _propTypes.default.oneOfType([_propTypes.default.any, _propTypes.default.any]),
332
- /**
333
- * Hides extra (above the max) breadcrumbs under a collapsed item as the window gets smaller.
334
- * Pass a custom #EuiBreadcrumbResponsiveMaxCount object to change the number of breadcrumbs to show at the particular breakpoints.
335
- *
336
- * Pass `false` to turn this behavior off.
337
- *
338
- * Default: `{ xs: 1, s: 2, m: 4 }`
339
- */
340
- responsive: _propTypes.default.oneOfType([_propTypes.default.bool.isRequired, _propTypes.default.any.isRequired]),
341
- /**
342
- * Forces all breadcrumbs to single line and
343
- * truncates each breadcrumb to a particular width,
344
- * except for the last item
345
- */
346
- truncate: _propTypes.default.bool,
347
- /**
348
- * Collapses the inner items past the maximum set here
349
- * into a single ellipses item.
350
- * Omitting or passing a `0` value will show all breadcrumbs.
351
- */
352
- max: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.oneOf([null])]),
353
- /**
354
- * The array of individual #EuiBreadcrumb items
355
- */
356
- breadcrumbs: _propTypes.default.arrayOf(_propTypes.default.shape({
357
- className: _propTypes.default.string,
358
- "aria-label": _propTypes.default.string,
359
- "data-test-subj": _propTypes.default.string,
360
- css: _propTypes.default.any,
361
- href: _propTypes.default.string,
362
- rel: _propTypes.default.string,
363
- onClick: _propTypes.default.func,
364
- /**
365
- * Visible label of the breadcrumb
366
- */
367
- text: _propTypes.default.node.isRequired,
368
- /**
369
- * Force a max-width on the breadcrumb text
370
- */
371
- truncate: _propTypes.default.bool,
372
- /**
373
- * Accepts any EuiLink `color` when rendered as one (has `href`, `onClick`, or `popoverContent`)
374
- */
375
- color: _propTypes.default.any,
376
- /**
377
- * Override the existing `aria-current` which defaults to `page` for the last breadcrumb
378
- */
379
- "aria-current": _propTypes.default.any,
380
- /**
381
- * Creates a breadcrumb that toggles a popover dialog
382
- *
383
- * If passed, both `href` and `onClick` will be ignored - the breadcrumb's
384
- * click behavior should only trigger a popover.
385
- */
386
- popoverContent: _propTypes.default.node,
387
- /**
388
- * Allows customizing the popover if necessary. Accepts any props that
389
- * [EuiPopover](/#/layout/popover) accepts, except for props that control state.
390
- */
391
- popoverProps: _propTypes.default.any
392
- }).isRequired),
393
- /**
394
- * Determines breadcrumbs appearance, with `page` being the default styling.
395
- * Application breadcrumbs should only be once per page, in (e.g.) EuiHeader
396
- */
397
- type: _propTypes.default.oneOf(["page", "application"]),
398
- /**
399
- * Whether the last breadcrumb should visually (and accessibly, to screen readers)
400
- * be highlighted as the current page. Defaults to true.
401
- */
402
- lastBreadcrumbIsCurrentPage: _propTypes.default.bool,
403
- text: _propTypes.default.node,
404
- iconType: _propTypes.default.string
405
- }).isRequired).isRequired,
406
- /**
407
- * The default height of the content area.
408
- */
409
- size: _propTypes.default.oneOf(["s", "m", "l"]),
410
- /**
411
- * Customize the max height.
412
- * Best when used with `size=l` as this will ensure the actual height equals the max height set.
413
- */
414
- maxHeight: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.string.isRequired]),
415
- /**
416
- * Set the offset from the left side of the screen.
417
- */
418
- leftOffset: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.string.isRequired]),
419
- /**
420
- * Set the offset from the left side of the screen.
421
- */
422
- rightOffset: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.string.isRequired]),
423
- /**
424
- * The control bar is hidden on mobile by default. Use the `showOnMobile` prop to force it's display on mobile screens.
425
- * You'll need to ensure that the content you place into the bar renders as expected on mobile.
426
- */
427
- showOnMobile: _propTypes.default.bool,
428
- /**
429
- * By default EuiControlBar will live in a portal, fixed position to the browser window.
430
- * Change the position of the bar to live inside a container and be positioned against its parent.
431
- */
432
- position: _propTypes.default.oneOf(["fixed", "relative", "absolute"]),
433
- /**
434
- * Optional class applied to the body used when `position = fixed`
435
- */
436
- bodyClassName: _propTypes.default.string,
437
- /**
438
- * Customize the screen reader heading that helps users find this control. Default is "Page level controls".
439
- */
440
- landmarkHeading: _propTypes.default.string
441
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "EuiControlBar", {
7
- enumerable: true,
8
- get: function get() {
9
- return _control_bar.EuiControlBar;
10
- }
11
- });
12
- var _control_bar = require("./control_bar");
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "EuiNotificationEvent", {
7
- enumerable: true,
8
- get: function get() {
9
- return _notification_event.EuiNotificationEvent;
10
- }
11
- });
12
- var _notification_event = require("./notification_event");
@@ -1,105 +0,0 @@
1
- "use strict";
2
-
3
- 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); }
4
- var _react = _interopRequireWildcard(require("react"));
5
- var _context_menu = require("../context_menu");
6
- var _notification_event = require("./notification_event");
7
- var _panel = require("../panel");
8
- var _react2 = require("@emotion/react");
9
- 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); }
10
- 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; }
11
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
- 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."); }
13
- 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); }
14
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
16
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } /*
17
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
18
- * or more contributor license agreements. Licensed under the Elastic License
19
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
20
- * in compliance with, at your election, the Elastic License 2.0 or the Server
21
- * Side Public License, v 1.
22
- */ /// <reference types="cypress" />
23
- /// <reference types="cypress-real-events" />
24
- /// <reference types="../../../cypress/support" />
25
- var NotificationEvent = function NotificationEvent() {
26
- var _useState = (0, _react.useState)(false),
27
- _useState2 = _slicedToArray(_useState, 2),
28
- isRead = _useState2[0],
29
- setIsRead = _useState2[1];
30
- var onRead = function onRead(id, isRead) {
31
- setIsRead(!isRead);
32
- };
33
- var onOpenContextMenu = function onOpenContextMenu(id) {
34
- return [(0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
35
- key: "contextMenuItemA",
36
- onClick: function onClick() {
37
- return onRead(id, isRead);
38
- }
39
- }, isRead ? 'Mark as unread' : 'Mark as read'), (0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
40
- key: "contextMenuItemB",
41
- onClick: function onClick() {}
42
- }, "View messages like this"), (0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
43
- key: "contextMenuItemC",
44
- onClick: function onClick() {}
45
- }, "Don\u2019t notify me about this")];
46
- };
47
- return (0, _react2.jsx)(_panel.EuiPanel, {
48
- paddingSize: "none",
49
- hasShadow: true,
50
- style: {
51
- maxWidth: '540px'
52
- }
53
- }, (0, _react2.jsx)(_notification_event.EuiNotificationEvent, {
54
- id: "cy-eui-notification-1",
55
- type: "Report",
56
- iconType: "logoKibana",
57
- iconAriaLabel: "Kibana",
58
- time: "1 min ago",
59
- title: "[Error Monitoring Report] is generated",
60
- primaryAction: "Download",
61
- primaryActionProps: {
62
- iconType: 'download'
63
- },
64
- messages: ['The reported was generated at 17:12:16 GMT+4'],
65
- isRead: isRead,
66
- onRead: onRead,
67
- onOpenContextMenu: onOpenContextMenu,
68
- onClickPrimaryAction: function onClickPrimaryAction() {},
69
- onClickTitle: function onClickTitle() {}
70
- }));
71
- };
72
- describe('EuiNotificationEvent', function () {
73
- beforeEach(function () {
74
- cy.viewport(1024, 768); // medium breakpoint
75
- cy.realMount((0, _react2.jsx)(NotificationEvent, null));
76
- cy.get('article.euiNotificationEvent').should('exist');
77
- });
78
- describe('Automated accessibility check', function () {
79
- it('has zero violations on first render', function () {
80
- cy.checkAxe();
81
- });
82
- it('has zero violations when popover is open', function () {
83
- cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').realClick();
84
- cy.get('div.euiPopover__panel').should('exist');
85
- cy.checkAxe();
86
- });
87
- it('has zero violations after the Mark as read button is clicked', function () {
88
- cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').realClick();
89
- cy.get('div.euiPopover__panel').should('exist');
90
- cy.get('div.euiPopover__panel button').first().realClick();
91
- cy.checkAxe();
92
- });
93
- });
94
- describe('Keyboard accessibility', function () {
95
- it('has zero violations when the popover is opened by keyboard', function () {
96
- cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').focus();
97
- cy.realPress('Enter');
98
- cy.get('div.euiPopover__panel').should('exist');
99
- cy.checkAxe();
100
- cy.realPress('Escape');
101
- cy.get('div.euiPopover__panel').should('not.exist');
102
- cy.checkAxe();
103
- });
104
- });
105
- });