@elastic/eui 85.0.0 → 85.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 (137) hide show
  1. package/dist/eui_charts_theme.js +13 -16
  2. package/dist/eui_charts_theme.js.map +1 -1
  3. package/dist/eui_theme_dark.css +47 -90
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +47 -90
  6. package/dist/eui_theme_light.min.css +1 -1
  7. package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +26 -0
  8. package/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +16 -0
  9. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +202 -0
  10. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +33 -0
  11. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +296 -0
  12. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +58 -0
  13. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +93 -0
  14. package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.styles.js +28 -0
  15. package/es/components/collapsible_nav_beta/collapsible_nav_item/index.js +9 -0
  16. package/es/components/collapsible_nav_beta/index.js +15 -0
  17. package/es/components/color_picker/saturation.js +2 -1
  18. package/es/components/combo_box/combo_box_input/combo_box_input.js +7 -1
  19. package/es/components/combo_box/combo_box_input/combo_box_pill.js +16 -4
  20. package/es/components/combo_box/combo_box_options_list/combo_box_option.js +4 -0
  21. package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +21 -3
  22. package/es/components/error_boundary/error_boundary.js +1 -1
  23. package/es/components/filter_group/filter_group.styles.js +2 -2
  24. package/es/components/filter_group/filter_select_item.js +31 -15
  25. package/es/components/filter_group/filter_select_item.styles.js +19 -0
  26. package/es/components/form/range/range_highlight.js +1 -0
  27. package/es/components/highlight/highlight.js +4 -4
  28. package/es/components/index.js +1 -0
  29. package/es/components/inline_edit/inline_edit_form.js +2 -1
  30. package/es/components/markdown_editor/markdown_editor.js +2 -2
  31. package/es/themes/amsterdam/global_styling/variables/_states.js +13 -16
  32. package/eui.d.ts +362 -129
  33. package/i18ntokens.json +50 -50
  34. package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +30 -0
  35. package/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +23 -0
  36. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +211 -0
  37. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +40 -0
  38. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +304 -0
  39. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +63 -0
  40. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +100 -0
  41. package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.styles.js +35 -0
  42. package/lib/components/collapsible_nav_beta/collapsible_nav_item/index.js +12 -0
  43. package/lib/components/collapsible_nav_beta/index.js +19 -0
  44. package/lib/components/color_picker/saturation.js +2 -1
  45. package/lib/components/combo_box/combo_box_input/combo_box_input.js +7 -1
  46. package/lib/components/combo_box/combo_box_input/combo_box_pill.js +16 -4
  47. package/lib/components/combo_box/combo_box_options_list/combo_box_option.js +4 -0
  48. package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +21 -3
  49. package/lib/components/error_boundary/error_boundary.js +1 -1
  50. package/lib/components/filter_group/filter_group.styles.js +1 -1
  51. package/lib/components/filter_group/filter_select_item.js +33 -17
  52. package/lib/components/filter_group/filter_select_item.styles.js +26 -0
  53. package/lib/components/form/range/range_highlight.js +1 -0
  54. package/lib/components/highlight/highlight.js +4 -4
  55. package/lib/components/index.js +11 -0
  56. package/lib/components/inline_edit/inline_edit_form.js +2 -1
  57. package/lib/components/markdown_editor/markdown_editor.js +2 -2
  58. package/lib/themes/amsterdam/global_styling/variables/_states.js +13 -16
  59. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +26 -0
  60. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +16 -0
  61. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +113 -0
  62. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +33 -0
  63. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +117 -0
  64. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +55 -0
  65. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +59 -0
  66. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.styles.js +28 -0
  67. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/index.js +9 -0
  68. package/optimize/es/components/collapsible_nav_beta/index.js +15 -0
  69. package/optimize/es/components/color_picker/saturation.js +2 -1
  70. package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +3 -1
  71. package/optimize/es/components/combo_box/combo_box_input/combo_box_pill.js +12 -4
  72. package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +9 -3
  73. package/optimize/es/components/error_boundary/error_boundary.js +1 -1
  74. package/optimize/es/components/filter_group/filter_group.styles.js +2 -2
  75. package/optimize/es/components/filter_group/filter_select_item.js +30 -14
  76. package/optimize/es/components/filter_group/filter_select_item.styles.js +19 -0
  77. package/optimize/es/components/form/range/range_highlight.js +1 -0
  78. package/optimize/es/components/highlight/highlight.js +4 -4
  79. package/optimize/es/components/index.js +1 -0
  80. package/optimize/es/components/inline_edit/inline_edit_form.js +2 -1
  81. package/optimize/es/components/markdown_editor/markdown_editor.js +2 -2
  82. package/optimize/es/themes/amsterdam/global_styling/variables/_states.js +13 -16
  83. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +33 -0
  84. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +23 -0
  85. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +123 -0
  86. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +40 -0
  87. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +124 -0
  88. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +61 -0
  89. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +66 -0
  90. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.styles.js +35 -0
  91. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/index.js +12 -0
  92. package/optimize/lib/components/collapsible_nav_beta/index.js +19 -0
  93. package/optimize/lib/components/color_picker/saturation.js +2 -1
  94. package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +3 -1
  95. package/optimize/lib/components/combo_box/combo_box_input/combo_box_pill.js +12 -4
  96. package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +9 -3
  97. package/optimize/lib/components/error_boundary/error_boundary.js +1 -1
  98. package/optimize/lib/components/filter_group/filter_group.styles.js +1 -1
  99. package/optimize/lib/components/filter_group/filter_select_item.js +32 -16
  100. package/optimize/lib/components/filter_group/filter_select_item.styles.js +26 -0
  101. package/optimize/lib/components/form/range/range_highlight.js +1 -0
  102. package/optimize/lib/components/highlight/highlight.js +4 -4
  103. package/optimize/lib/components/index.js +11 -0
  104. package/optimize/lib/components/inline_edit/inline_edit_form.js +2 -1
  105. package/optimize/lib/components/markdown_editor/markdown_editor.js +2 -2
  106. package/optimize/lib/themes/amsterdam/global_styling/variables/_states.js +13 -16
  107. package/package.json +1 -1
  108. package/src/components/combo_box/combo_box_input/_combo_box_pill.scss +24 -3
  109. package/src/components/combo_box/combo_box_options_list/_combo_box_option.scss +34 -14
  110. package/src/components/index.scss +0 -1
  111. package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +33 -0
  112. package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +23 -0
  113. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +208 -0
  114. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +40 -0
  115. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +303 -0
  116. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +61 -0
  117. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +96 -0
  118. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.styles.js +35 -0
  119. package/test-env/components/collapsible_nav_beta/collapsible_nav_item/index.js +12 -0
  120. package/test-env/components/collapsible_nav_beta/index.js +19 -0
  121. package/test-env/components/color_picker/saturation.js +2 -1
  122. package/test-env/components/combo_box/combo_box_input/combo_box_input.js +7 -1
  123. package/test-env/components/combo_box/combo_box_input/combo_box_pill.js +16 -4
  124. package/test-env/components/combo_box/combo_box_options_list/combo_box_option.js +4 -0
  125. package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +21 -3
  126. package/test-env/components/error_boundary/error_boundary.js +1 -1
  127. package/test-env/components/filter_group/filter_group.styles.js +1 -1
  128. package/test-env/components/filter_group/filter_select_item.js +33 -17
  129. package/test-env/components/filter_group/filter_select_item.styles.js +26 -0
  130. package/test-env/components/form/range/range_highlight.js +1 -0
  131. package/test-env/components/highlight/highlight.js +4 -4
  132. package/test-env/components/index.js +11 -0
  133. package/test-env/components/inline_edit/inline_edit_form.js +2 -1
  134. package/test-env/components/markdown_editor/markdown_editor.js +2 -2
  135. package/test-env/themes/amsterdam/global_styling/variables/_states.js +13 -16
  136. package/src/components/filter_group/_filter_select_item.scss +0 -43
  137. package/src/components/filter_group/_index.scss +0 -1
@@ -14,7 +14,7 @@ var _form_control_layout = require("../../form/form_control_layout");
14
14
  var _num_icons = require("../../form/form_control_layout/_num_icons");
15
15
  var _combo_box_pill = require("./combo_box_pill");
16
16
  var _react2 = require("@emotion/react");
17
- var _excluded = ["key", "label", "color", "onClick"];
17
+ var _excluded = ["key", "label", "color", "onClick", "append", "prepend"];
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; }
@@ -159,6 +159,8 @@ var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
159
159
  label = option.label,
160
160
  color = option.color,
161
161
  onClick = option.onClick,
162
+ append = option.append,
163
+ prepend = option.prepend,
162
164
  rest = _objectWithoutProperties(option, _excluded);
163
165
  var pillOnClose = isDisabled || singleSelection || onClick ? undefined : onRemoveOption;
164
166
  return (0, _react2.jsx)(_combo_box_pill.EuiComboBoxPill, _extends({
@@ -302,12 +304,16 @@ EuiComboBoxInput.propTypes = {
302
304
  key: _propTypes.default.string,
303
305
  options: _propTypes.default.arrayOf(_propTypes.default.any.isRequired),
304
306
  value: _propTypes.default.any,
307
+ prepend: _propTypes.default.node,
308
+ append: _propTypes.default.node,
305
309
  className: _propTypes.default.string,
306
310
  "aria-label": _propTypes.default.string,
307
311
  "data-test-subj": _propTypes.default.string,
308
312
  css: _propTypes.default.any
309
313
  }).isRequired),
310
314
  value: _propTypes.default.any,
315
+ prepend: _propTypes.default.node,
316
+ append: _propTypes.default.node,
311
317
  className: _propTypes.default.string,
312
318
  "aria-label": _propTypes.default.string,
313
319
  "data-test-subj": _propTypes.default.string,
@@ -78,6 +78,11 @@ var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
78
78
  onClick: onClick,
79
79
  onClickAriaLabel: onClickAriaLabel
80
80
  } : {};
81
+ var content = (0, _react2.jsx)(_react.default.Fragment, null, option.prepend && (0, _react2.jsx)("span", {
82
+ className: "euiComboBoxPill__prepend"
83
+ }, option.prepend), children, option.append && (0, _react2.jsx)("span", {
84
+ className: "euiComboBoxPill__append"
85
+ }, option.append));
81
86
  if (onClose) {
82
87
  return (0, _react2.jsx)(_i18n.EuiI18n, {
83
88
  token: "euiComboBoxPill.removeSelection",
@@ -89,24 +94,27 @@ var EuiComboBoxPill = /*#__PURE__*/function (_Component) {
89
94
  return (0, _react2.jsx)(_badge.EuiBadge, _extends({
90
95
  className: classes,
91
96
  color: color,
97
+ "data-test-subj": "euiComboBoxPill",
92
98
  iconOnClick: _this2.onCloseButtonClick,
93
99
  iconOnClickAriaLabel: removeSelection,
94
100
  iconSide: "right",
95
101
  iconType: "cross",
96
102
  title: children
97
- }, onClickProps, rest), children);
103
+ }, onClickProps, rest), content);
98
104
  });
99
105
  }
100
106
  if (asPlainText) {
101
107
  return (0, _react2.jsx)("span", _extends({
102
- className: classes
103
- }, rest), children);
108
+ className: classes,
109
+ "data-test-subj": "euiComboBoxPill"
110
+ }, rest), content);
104
111
  }
105
112
  return (0, _react2.jsx)(_badge.EuiBadge, _extends({
106
113
  className: classes,
107
114
  color: color,
115
+ "data-test-subj": "euiComboBoxPill",
108
116
  title: children
109
- }, rest, onClickProps), children);
117
+ }, rest, onClickProps), content);
110
118
  }
111
119
  }]);
112
120
  return EuiComboBoxPill;
@@ -133,12 +141,16 @@ EuiComboBoxPill.propTypes = {
133
141
  key: _propTypes.default.string,
134
142
  options: _propTypes.default.arrayOf(_propTypes.default.any.isRequired),
135
143
  value: _propTypes.default.any,
144
+ prepend: _propTypes.default.node,
145
+ append: _propTypes.default.node,
136
146
  className: _propTypes.default.string,
137
147
  "aria-label": _propTypes.default.string,
138
148
  "data-test-subj": _propTypes.default.string,
139
149
  css: _propTypes.default.any
140
150
  }).isRequired),
141
151
  value: _propTypes.default.any,
152
+ prepend: _propTypes.default.node,
153
+ append: _propTypes.default.node,
142
154
  className: _propTypes.default.string,
143
155
  "aria-label": _propTypes.default.string,
144
156
  "data-test-subj": _propTypes.default.string,
@@ -123,12 +123,16 @@ EuiComboBoxOption.propTypes = {
123
123
  key: _propTypes.default.string,
124
124
  options: _propTypes.default.arrayOf(_propTypes.default.any.isRequired),
125
125
  value: _propTypes.default.any,
126
+ prepend: _propTypes.default.node,
127
+ append: _propTypes.default.node,
126
128
  className: _propTypes.default.string,
127
129
  "aria-label": _propTypes.default.string,
128
130
  "data-test-subj": _propTypes.default.string,
129
131
  css: _propTypes.default.any
130
132
  }).isRequired),
131
133
  value: _propTypes.default.any,
134
+ prepend: _propTypes.default.node,
135
+ append: _propTypes.default.node,
132
136
  className: _propTypes.default.string,
133
137
  "aria-label": _propTypes.default.string,
134
138
  "data-test-subj": _propTypes.default.string,
@@ -18,7 +18,7 @@ var _filter_select_item = require("../../filter_group/filter_select_item");
18
18
  var _badge = require("../../badge");
19
19
  var _popover_panel = require("../../popover/popover_panel");
20
20
  var _react2 = require("@emotion/react");
21
- var _excluded = ["key", "isGroupLabelOption", "label", "value"],
21
+ var _excluded = ["key", "isGroupLabelOption", "label", "value", "prepend", "append"],
22
22
  _excluded2 = ["data-test-subj", "activeOptionIndex", "areAllOptionsSelected", "customOptionText", "fullWidth", "getSelectedOptionForSearchValue", "isCaseSensitive", "isLoading", "listRef", "matchingOptions", "onCloseList", "onCreateOption", "onOptionClick", "onOptionEnterKey", "onScroll", "optionRef", "options", "position", "renderOption", "rootId", "rowHeight", "scrollToIndex", "searchValue", "selectedOptions", "singleSelection", "updatePosition", "width", "delimiter", "zIndex", "style", "listboxAriaLabel"];
23
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
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); }
@@ -107,6 +107,8 @@ var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
107
107
  isGroupLabelOption = option.isGroupLabelOption,
108
108
  label = option.label,
109
109
  value = option.value,
110
+ prepend = option.prepend,
111
+ append = option.append,
110
112
  rest = _objectWithoutProperties(option, _excluded);
111
113
  var _this$props = _this.props,
112
114
  singleSelection = _this$props.singleSelection,
@@ -145,13 +147,17 @@ var EuiComboBoxOptionsList = /*#__PURE__*/function (_Component) {
145
147
  title: label
146
148
  }, rest), (0, _react2.jsx)("span", {
147
149
  className: "euiComboBoxOption__contentWrapper"
148
- }, renderOption ? (0, _react2.jsx)("span", {
150
+ }, prepend && (0, _react2.jsx)("span", {
151
+ className: "euiComboBoxOption__prepend"
152
+ }, prepend), renderOption ? (0, _react2.jsx)("span", {
149
153
  className: OPTION_CONTENT_CLASSNAME
150
154
  }, renderOption(option, searchValue, 'euiComboBoxOption__renderOption')) : (0, _react2.jsx)(_highlight.EuiHighlight, {
151
155
  search: searchValue,
152
156
  strict: _this.props.isCaseSensitive,
153
157
  className: OPTION_CONTENT_CLASSNAME
154
- }, label), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
158
+ }, label), append && (0, _react2.jsx)("span", {
159
+ className: "euiComboBoxOption__append"
160
+ }, append), optionIsFocused && !optionIsDisabled ? hitEnterBadge : null));
155
161
  });
156
162
  return _this;
157
163
  }
@@ -406,12 +412,16 @@ EuiComboBoxOptionsList.propTypes = {
406
412
  key: _propTypes.default.string,
407
413
  options: _propTypes.default.arrayOf(_propTypes.default.any.isRequired),
408
414
  value: _propTypes.default.any,
415
+ prepend: _propTypes.default.node,
416
+ append: _propTypes.default.node,
409
417
  className: _propTypes.default.string,
410
418
  "aria-label": _propTypes.default.string,
411
419
  "data-test-subj": _propTypes.default.string,
412
420
  css: _propTypes.default.any
413
421
  }).isRequired),
414
422
  value: _propTypes.default.any,
423
+ prepend: _propTypes.default.node,
424
+ append: _propTypes.default.node,
415
425
  className: _propTypes.default.string,
416
426
  "aria-label": _propTypes.default.string,
417
427
  "data-test-subj": _propTypes.default.string,
@@ -436,12 +446,16 @@ EuiComboBoxOptionsList.propTypes = {
436
446
  key: _propTypes.default.string,
437
447
  options: _propTypes.default.arrayOf(_propTypes.default.any.isRequired),
438
448
  value: _propTypes.default.any,
449
+ prepend: _propTypes.default.node,
450
+ append: _propTypes.default.node,
439
451
  className: _propTypes.default.string,
440
452
  "aria-label": _propTypes.default.string,
441
453
  "data-test-subj": _propTypes.default.string,
442
454
  css: _propTypes.default.any
443
455
  }).isRequired),
444
456
  value: _propTypes.default.any,
457
+ prepend: _propTypes.default.node,
458
+ append: _propTypes.default.node,
445
459
  className: _propTypes.default.string,
446
460
  "aria-label": _propTypes.default.string,
447
461
  "data-test-subj": _propTypes.default.string,
@@ -463,12 +477,16 @@ EuiComboBoxOptionsList.propTypes = {
463
477
  key: _propTypes.default.string,
464
478
  options: _propTypes.default.arrayOf(_propTypes.default.any.isRequired),
465
479
  value: _propTypes.default.any,
480
+ prepend: _propTypes.default.node,
481
+ append: _propTypes.default.node,
466
482
  className: _propTypes.default.string,
467
483
  "aria-label": _propTypes.default.string,
468
484
  "data-test-subj": _propTypes.default.string,
469
485
  css: _propTypes.default.any
470
486
  }).isRequired),
471
487
  value: _propTypes.default.any,
488
+ prepend: _propTypes.default.node,
489
+ append: _propTypes.default.node,
472
490
  className: _propTypes.default.string,
473
491
  "aria-label": _propTypes.default.string,
474
492
  "data-test-subj": _propTypes.default.string,
@@ -64,7 +64,7 @@ var EuiErrorBoundary = /*#__PURE__*/function (_Component) {
64
64
  var message = error.message,
65
65
  stack = error.stack;
66
66
  var idx = (stack === null || stack === void 0 ? void 0 : stack.indexOf(message)) || -1;
67
- var stackStr = idx > -1 ? stack === null || stack === void 0 ? void 0 : stack.substr(idx + message.length + 1) : stack;
67
+ var stackStr = idx > -1 ? stack === null || stack === void 0 ? void 0 : stack.substring(idx + message.length + 1) : stack;
68
68
  var errorMessage = "Error: ".concat(message, "\n").concat(stackStr);
69
69
  this.setState({
70
70
  hasError: true,
@@ -32,7 +32,7 @@ var euiFilterGroupStyles = function euiFilterGroupStyles(euiThemeContext) {
32
32
  controlCompressedBorderRadius = _euiFormVariables.controlCompressedBorderRadius,
33
33
  controlCompressedHeight = _euiFormVariables.controlCompressedHeight;
34
34
  return {
35
- euiFilterGroup: /*#__PURE__*/(0, _react.css)("display:inline-flex;", (0, _global_styling.logicalCSS)('max-width', '100%'), " overflow:hidden;background-color:", backgroundColor, ";box-shadow:inset 0 0 0 ", euiTheme.border.width.thin, " ", borderColor, ";>*:not(.euiFilterButton){", (0, _filter_button.euiFilterButtonDisplay)(euiThemeContext), ";}.euiPopover__anchor{display:block;.euiFilterButton{", (0, _global_styling.logicalCSS)('width', '100%'), ";}}", (0, _global_styling.euiMaxBreakpoint)(euiThemeContext, 's'), "{flex-wrap:wrap;}", (0, _global_styling.euiMaxBreakpoint)(euiThemeContext, 'xs'), "{display:flex;.euiFilterButton{flex-grow:1;}};label:euiFilterGroup;"),
35
+ euiFilterGroup: /*#__PURE__*/(0, _react.css)("display:inline-flex;", (0, _global_styling.logicalCSS)('max-width', '100%'), " overflow:hidden;background-color:", backgroundColor, ";box-shadow:inset 0 0 0 ", euiTheme.border.width.thin, " ", borderColor, ";>*:not(.euiFilterButton){", (0, _filter_button.euiFilterButtonDisplay)(euiThemeContext), ";}.euiPopover__anchor{display:block;.euiFilterButton{", (0, _global_styling.logicalCSS)('width', '100%'), ";}}", (0, _global_styling.euiBreakpoint)(euiThemeContext, ['xs', 's']), "{flex-wrap:wrap;}", (0, _global_styling.euiBreakpoint)(euiThemeContext, ['xs']), "{display:flex;.euiFilterButton{flex-grow:1;}};label:euiFilterGroup;"),
36
36
  fullWidth: _ref,
37
37
  uncompressed: /*#__PURE__*/(0, _react.css)("border-radius:", controlBorderRadius, ";", buttonChildrenBorderRadii(controlBorderRadius), ";;label:uncompressed;"),
38
38
  compressed: /*#__PURE__*/(0, _react.css)("border-radius:", controlCompressedBorderRadius, ";", buttonChildrenBorderRadii(controlCompressedBorderRadius), " .euiFilterButton{", (0, _global_styling.logicalCSS)('height', controlCompressedHeight), ";};label:compressed;"),
@@ -3,14 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.EuiFilterSelectItem = void 0;
6
+ exports.EuiFilterSelectItemClass = exports.EuiFilterSelectItem = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _services = require("../../services");
10
11
  var _flex = require("../flex");
11
12
  var _icon = require("../icon");
13
+ var _filter_select_item = require("./filter_select_item.styles");
12
14
  var _react2 = require("@emotion/react");
13
- var _excluded = ["children", "className", "disabled", "checked", "isFocused", "showIcons"];
15
+ var _excluded = ["theme", "children", "className", "disabled", "checked", "isFocused", "showIcons"];
14
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
17
  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); }
16
18
  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; }
@@ -51,12 +53,19 @@ var resolveIconAndColor = function resolveIconAndColor(checked) {
51
53
  color: 'text'
52
54
  };
53
55
  };
54
- var EuiFilterSelectItem = /*#__PURE__*/function (_Component) {
55
- _inherits(EuiFilterSelectItem, _Component);
56
- var _super = _createSuper(EuiFilterSelectItem);
57
- function EuiFilterSelectItem() {
56
+
57
+ /**
58
+ * TODO: This component should removed in favor of EuiSelectable usage
59
+ * once EuiComboBox has been converted to dogfood EuiSelectable.
60
+ *
61
+ * @deprecated - Use EuiSelectable instead
62
+ */
63
+ var EuiFilterSelectItemClass = /*#__PURE__*/function (_Component) {
64
+ _inherits(EuiFilterSelectItemClass, _Component);
65
+ var _super = _createSuper(EuiFilterSelectItemClass);
66
+ function EuiFilterSelectItemClass() {
58
67
  var _this;
59
- _classCallCheck(this, EuiFilterSelectItem);
68
+ _classCallCheck(this, EuiFilterSelectItemClass);
60
69
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
61
70
  args[_key] = arguments[_key];
62
71
  }
@@ -75,11 +84,12 @@ var EuiFilterSelectItem = /*#__PURE__*/function (_Component) {
75
84
  });
76
85
  return _this;
77
86
  }
78
- _createClass(EuiFilterSelectItem, [{
87
+ _createClass(EuiFilterSelectItemClass, [{
79
88
  key: "render",
80
89
  value: function render() {
81
90
  var _this2 = this;
82
91
  var _this$props = this.props,
92
+ theme = _this$props.theme,
83
93
  children = _this$props.children,
84
94
  className = _this$props.className,
85
95
  disabled = _this$props.disabled,
@@ -87,9 +97,9 @@ var EuiFilterSelectItem = /*#__PURE__*/function (_Component) {
87
97
  isFocused = _this$props.isFocused,
88
98
  showIcons = _this$props.showIcons,
89
99
  rest = _objectWithoutProperties(_this$props, _excluded);
90
- var classes = (0, _classnames.default)('euiFilterSelectItem', {
91
- 'euiFilterSelectItem-isFocused': isFocused
92
- }, className);
100
+ var styles = (0, _filter_select_item.euiFilterSelectItemStyles)(theme);
101
+ var cssStyles = [styles.euiFilterSelectItem, isFocused && styles.isFocused];
102
+ var classes = (0, _classnames.default)('euiFilterSelectItem', className);
93
103
  var iconNode;
94
104
  if (showIcons) {
95
105
  var _resolveIconAndColor = resolveIconAndColor(checked),
@@ -110,6 +120,7 @@ var EuiFilterSelectItem = /*#__PURE__*/function (_Component) {
110
120
  type: "button",
111
121
  "aria-selected": isFocused,
112
122
  className: classes,
123
+ css: cssStyles,
113
124
  disabled: disabled,
114
125
  "aria-disabled": disabled
115
126
  }, rest), (0, _react2.jsx)(_flex.EuiFlexGroup, {
@@ -118,18 +129,21 @@ var EuiFilterSelectItem = /*#__PURE__*/function (_Component) {
118
129
  component: "span",
119
130
  responsive: false
120
131
  }, iconNode, (0, _react2.jsx)(_flex.EuiFlexItem, {
121
- className: "euiFilterSelectItem__content",
132
+ className: "euiFilterSelectItem__content eui-textTruncate",
122
133
  component: "span"
123
134
  }, children)));
124
135
  }
125
136
  }]);
126
- return EuiFilterSelectItem;
137
+ return EuiFilterSelectItemClass;
127
138
  }(_react.Component);
128
- exports.EuiFilterSelectItem = EuiFilterSelectItem;
129
- _defineProperty(EuiFilterSelectItem, "defaultProps", {
139
+ /**
140
+ * @deprecated - Use EuiSelectable instead
141
+ */
142
+ exports.EuiFilterSelectItemClass = EuiFilterSelectItemClass;
143
+ _defineProperty(EuiFilterSelectItemClass, "defaultProps", {
130
144
  showIcons: true
131
145
  });
132
- EuiFilterSelectItem.propTypes = {
146
+ EuiFilterSelectItemClass.propTypes = {
133
147
  checked: _propTypes.default.oneOf(["on", "off"]),
134
148
  showIcons: _propTypes.default.bool,
135
149
  isFocused: _propTypes.default.bool,
@@ -137,4 +151,6 @@ EuiFilterSelectItem.propTypes = {
137
151
  "aria-label": _propTypes.default.string,
138
152
  "data-test-subj": _propTypes.default.string,
139
153
  css: _propTypes.default.any
140
- };
154
+ };
155
+ var EuiFilterSelectItem = (0, _services.withEuiTheme)(EuiFilterSelectItemClass);
156
+ exports.EuiFilterSelectItem = EuiFilterSelectItem;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiFilterSelectItemStyles = void 0;
7
+ var _react = require("@emotion/react");
8
+ var _services = require("../../services");
9
+ var _global_styling = require("../../global_styling");
10
+ /*
11
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
12
+ * or more contributor license agreements. Licensed under the Elastic License
13
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
14
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
15
+ * Side Public License, v 1.
16
+ */
17
+
18
+ var euiFilterSelectItemStyles = function euiFilterSelectItemStyles(euiThemeContext) {
19
+ var euiTheme = euiThemeContext.euiTheme;
20
+ var focusStyles = "\n color: ".concat(euiTheme.colors.primary, ";\n background-color: ").concat(euiTheme.focus.backgroundColor, ";\n outline-offset: -").concat(euiTheme.focus.width, ";\n text-decoration: underline;\n\n &:disabled {\n background-color: ").concat((0, _services.transparentize)(euiTheme.colors.disabled, 0.1), ";\n }\n ");
21
+ return {
22
+ euiFilterSelectItem: /*#__PURE__*/(0, _react.css)("display:block;", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalShorthandCSS)('padding', "".concat(euiTheme.size.xs, " ").concat(euiTheme.size.m)), " ", (0, _global_styling.euiFontSize)(euiThemeContext, 's'), " ", (0, _global_styling.logicalTextAlignCSS)('left'), " color:", euiTheme.colors.text, ";", (0, _global_styling.logicalCSS)('border-bottom', "".concat(euiTheme.border.width.thin, " solid ").concat(euiTheme.colors.lightestShade)), " &:hover{cursor:pointer;text-decoration:underline;}&:focus{", focusStyles, ";}&:disabled{cursor:not-allowed;text-decoration:none;color:", euiTheme.colors.disabledText, ";};label:euiFilterSelectItem;"),
23
+ isFocused: /*#__PURE__*/(0, _react.css)(focusStyles, ";;label:isFocused;")
24
+ };
25
+ };
26
+ exports.euiFilterSelectItemStyles = euiFilterSelectItemStyles;
@@ -76,6 +76,7 @@ var EuiRangeHighlight = function EuiRangeHighlight(_ref) {
76
76
  css: cssStyles,
77
77
  onClick: onClick
78
78
  }, (levels && levels.length === 0 || !levels) && (0, _react2.jsx)("div", {
79
+ "data-test-subj": "euiRangeHighlightProgress",
79
80
  className: "euiRangeHighlight__progress",
80
81
  css: cssProgressStyles,
81
82
  style: progressStyle
@@ -36,7 +36,7 @@ var highlight = function highlight(searchSubject, searchValue, isStrict, highlig
36
36
  var end = chunk.end,
37
37
  highlight = chunk.highlight,
38
38
  start = chunk.start;
39
- var value = searchSubject.substr(start, end - start);
39
+ var value = searchSubject.substring(start, end);
40
40
  if (highlight) {
41
41
  return (0, _react2.jsx)(_mark.EuiMark, {
42
42
  key: start,
@@ -52,9 +52,9 @@ var highlight = function highlight(searchSubject, searchValue, isStrict, highlig
52
52
  if (indexOfMatch === -1) {
53
53
  return searchSubject;
54
54
  }
55
- var preMatch = searchSubject.substr(0, indexOfMatch);
56
- var match = searchSubject.substr(indexOfMatch, searchValue.length);
57
- var postMatch = searchSubject.substr(indexOfMatch + searchValue.length);
55
+ var preMatch = searchSubject.substring(0, indexOfMatch);
56
+ var match = searchSubject.substring(indexOfMatch, indexOfMatch + searchValue.length);
57
+ var postMatch = searchSubject.substring(indexOfMatch + searchValue.length);
58
58
  return (0, _react2.jsx)(_react.Fragment, null, preMatch, (0, _react2.jsx)(_mark.EuiMark, {
59
59
  hasScreenReaderHelpText: hasScreenReaderHelpText
60
60
  }, match), postMatch);
@@ -157,6 +157,17 @@ Object.keys(_collapsible_nav).forEach(function (key) {
157
157
  }
158
158
  });
159
159
  });
160
+ var _collapsible_nav_beta = require("./collapsible_nav_beta");
161
+ Object.keys(_collapsible_nav_beta).forEach(function (key) {
162
+ if (key === "default" || key === "__esModule") return;
163
+ if (key in exports && exports[key] === _collapsible_nav_beta[key]) return;
164
+ Object.defineProperty(exports, key, {
165
+ enumerable: true,
166
+ get: function get() {
167
+ return _collapsible_nav_beta[key];
168
+ }
169
+ });
170
+ });
160
171
  var _color_picker = require("./color_picker");
161
172
  Object.keys(_color_picker).forEach(function (key) {
162
173
  if (key === "default" || key === "__esModule") return;
@@ -272,7 +272,8 @@ var EuiInlineEditForm = function EuiInlineEditForm(_ref) {
272
272
  size: sizes.buttonSize,
273
273
  "data-test-subj": "euiInlineReadModeButton",
274
274
  disabled: isReadOnly,
275
- css: readModeCssStyles
275
+ css: readModeCssStyles,
276
+ title: readModeValue || placeholder
276
277
  }, readModeProps, {
277
278
  buttonRef: setReadModeRefs,
278
279
  "aria-describedby": (0, _classnames.default)(readModeDescribedById, readModeProps === null || readModeProps === void 0 ? void 0 : readModeProps['aria-describedby']),
@@ -166,8 +166,8 @@ var EuiMarkdownEditor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
166
166
  var isPreviewing = viewMode === _markdown_modes.MODE_VIEWING;
167
167
  var isEditing = viewMode === _markdown_modes.MODE_EDITING;
168
168
  var replaceNode = (0, _react.useCallback)(function (position, next) {
169
- var leading = value.substr(0, position.start.offset);
170
- var trailing = value.substr(position.end.offset);
169
+ var leading = value.substring(0, position.start.offset);
170
+ var trailing = value.substring(position.end.offset);
171
171
  _onChange("".concat(leading).concat(next).concat(trailing));
172
172
  }, [value, _onChange]);
173
173
  var contextValue = (0, _react.useMemo)(function () {
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.focus = void 0;
7
7
  var _utils = require("../../../../services/theme/utils");
8
+ var _manipulation = require("../../../../services/color/manipulation");
8
9
  var _size = require("../../../../global_styling/functions/size");
9
10
  /*
10
11
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -14,23 +15,19 @@ var _size = require("../../../../global_styling/functions/size");
14
15
  * Side Public License, v 1.
15
16
  */
16
17
 
17
- /**
18
- * NOTE: These were quick conversions of their Sass counterparts.
19
- * The commented out keys have not been established as necessary yet.
20
- */
21
-
22
18
  var focus = {
19
+ // Focus ring
23
20
  color: 'currentColor',
24
- width: (0, _utils.computed)((0, _size.sizeToPixel)(0.125))
25
-
26
- // transparency: { LIGHT: 0.9, DARK: 0.7 },
27
- // backgroundColor: computed(({ colors, focus }) =>
28
- // transparentize(colors.primary, focus!.transparency)
29
- // ),
30
-
31
- // Outline
32
- // outline: {
33
- // outline: computed(({ focus }) => `${focus!.width} solid ${focus!.color}`),
34
- // },
21
+ width: (0, _utils.computed)((0, _size.sizeToPixel)(0.125)),
22
+ // Focus background
23
+ transparency: {
24
+ LIGHT: 0.1,
25
+ DARK: 0.2
26
+ },
27
+ backgroundColor: (0, _utils.computed)(function (_ref) {
28
+ var colors = _ref.colors,
29
+ focus = _ref.focus;
30
+ return (0, _manipulation.transparentize)(colors.primary, focus.transparency);
31
+ })
35
32
  };
36
33
  exports.focus = focus;
@@ -0,0 +1,26 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /*
3
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
+ * or more contributor license agreements. Licensed under the Elastic License
5
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
6
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
7
+ * Side Public License, v 1.
8
+ */
9
+
10
+ import React from 'react';
11
+ import { useEuiTheme } from '../../services';
12
+ import { EuiCollapsibleNav } from '../collapsible_nav/collapsible_nav';
13
+ import { euiCollapsibleNavBetaStyles } from './collapsible_nav_beta.styles';
14
+
15
+ /**
16
+ * TODO: Actual component in a follow-up PR
17
+ */
18
+ import { jsx as ___EmotionJSX } from "@emotion/react";
19
+ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(props) {
20
+ var euiTheme = useEuiTheme();
21
+ var styles = euiCollapsibleNavBetaStyles(euiTheme);
22
+ return ___EmotionJSX(EuiCollapsibleNav, _extends({
23
+ css: styles.euiCollapsibleNavBeta,
24
+ size: 248
25
+ }, props));
26
+ };
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+
9
+ import { css } from '@emotion/react';
10
+ import { logicalCSS } from '../../global_styling';
11
+ export var euiCollapsibleNavBetaStyles = function euiCollapsibleNavBetaStyles(euiThemeContext) {
12
+ var euiTheme = euiThemeContext.euiTheme;
13
+ return {
14
+ euiCollapsibleNavBeta: /*#__PURE__*/css(logicalCSS('border-top', euiTheme.border.thin), " ", logicalCSS('border-right', euiTheme.border.thin), " .euiFlyoutFooter{background-color:", euiTheme.colors.emptyShade, ";", logicalCSS('border-top', euiTheme.border.thin), ";};label:euiCollapsibleNavBeta;")
15
+ };
16
+ };
@@ -0,0 +1,113 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
+ var _excluded = ["id", "className", "items", "href", "isSubItem", "isSelected", "linkProps", "accordionProps", "buttonContent", "children"];
5
+ 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; }
6
+ 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; }
7
+ /*
8
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
9
+ * or more contributor license agreements. Licensed under the Elastic License
10
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
11
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
12
+ * Side Public License, v 1.
13
+ */
14
+
15
+ import React, { useCallback, useMemo } from 'react';
16
+ import classNames from 'classnames';
17
+ import { useEuiTheme, useGeneratedHtmlId } from '../../../services';
18
+ import { EuiAccordion } from '../../accordion';
19
+ import { EuiCollapsibleNavSubItem } from './collapsible_nav_item';
20
+ import { EuiCollapsibleNavLink } from './collapsible_nav_link';
21
+ import { euiCollapsibleNavAccordionStyles } from './collapsible_nav_accordion.styles';
22
+ import { jsx as ___EmotionJSX } from "@emotion/react";
23
+ /**
24
+ * Internal nav accordion component.
25
+ *
26
+ * Renders children as either a nav link or any number/nesting of more nav accordions.
27
+ * Triggering the open/closed state is handled only by the accordion `arrow` for
28
+ * UX consistency, as accordion/nav titles can be their own links to pages.
29
+ */
30
+ export var EuiCollapsibleNavAccordion = function EuiCollapsibleNavAccordion(_ref) {
31
+ var _accordionProps$arrow;
32
+ var id = _ref.id,
33
+ className = _ref.className,
34
+ items = _ref.items,
35
+ href = _ref.href,
36
+ isSubItem = _ref.isSubItem,
37
+ isSelected = _ref.isSelected,
38
+ linkProps = _ref.linkProps,
39
+ accordionProps = _ref.accordionProps,
40
+ buttonContent = _ref.buttonContent,
41
+ _children = _ref.children,
42
+ rest = _objectWithoutProperties(_ref, _excluded);
43
+ var classes = classNames('euiCollapsibleNavAccordion', className);
44
+ var groupID = useGeneratedHtmlId({
45
+ conditionalId: id
46
+ });
47
+ var euiTheme = useEuiTheme();
48
+ var styles = euiCollapsibleNavAccordionStyles(euiTheme);
49
+ var cssStyles = [styles.euiCollapsibleNavAccordion, isSubItem ? styles.isSubItem : styles.isTopItem, isSelected && styles.isSelected, accordionProps === null || accordionProps === void 0 ? void 0 : accordionProps.css];
50
+
51
+ /**
52
+ * Title / accordion trigger
53
+ */
54
+ var isTitleInteractive = !!(href || linkProps !== null && linkProps !== void 0 && linkProps.onClick);
55
+
56
+ // Stop propagation on the title so that the accordion toggle doesn't occur on click
57
+ // (should only occur on accordion arrow click for UX consistency)
58
+ var stopPropagationClick = useCallback(function (e) {
59
+ var _linkProps$onClick;
60
+ e.stopPropagation();
61
+ linkProps === null || linkProps === void 0 ? void 0 : (_linkProps$onClick = linkProps.onClick) === null || _linkProps$onClick === void 0 ? void 0 : _linkProps$onClick.call(linkProps, e);
62
+ }, [linkProps === null || linkProps === void 0 ? void 0 : linkProps.onClick] // eslint-disable-line react-hooks/exhaustive-deps
63
+ );
64
+
65
+ /**
66
+ * Child items
67
+ */
68
+ // If any of the sub items have an icon, default to an
69
+ // icon of `empty` so that all text lines up vertically
70
+ var itemsHaveIcons = useMemo(function () {
71
+ return items.some(function (item) {
72
+ return !!item.icon;
73
+ });
74
+ }, [items]);
75
+ var icon = itemsHaveIcons ? 'empty' : undefined;
76
+ var childrenCssStyles = [styles.children.euiCollapsibleNavAccordion__children, isSubItem ? styles.children.isSubItem : styles.children.isTopItem];
77
+ var children = ___EmotionJSX("div", {
78
+ css: childrenCssStyles,
79
+ className: "euiCollapsibleNavAccordion__children"
80
+ }, items.map(function (item, index) {
81
+ return (
82
+ // This is an intentional circular dependency between the accordion & parent item display.
83
+ // EuiSideNavItem is purposely recursive to support any amount of nested sub items,
84
+ // and split up into separate files/components for better dev readability
85
+ ___EmotionJSX(EuiCollapsibleNavSubItem, _extends({
86
+ key: index,
87
+ icon: icon
88
+ }, item))
89
+ );
90
+ }));
91
+ return ___EmotionJSX(EuiAccordion, _extends({
92
+ id: groupID,
93
+ className: classes,
94
+ initialIsOpen: isSelected,
95
+ buttonElement: "div",
96
+ buttonContent: ___EmotionJSX(EuiCollapsibleNavLink, _extends({
97
+ href: href
98
+ }, linkProps, {
99
+ isSelected: isSelected,
100
+ isSubItem: isSubItem,
101
+ onClick: stopPropagationClick,
102
+ isInteractive: isTitleInteractive
103
+ }), buttonContent),
104
+ arrowDisplay: "right"
105
+ }, rest, accordionProps, {
106
+ css: cssStyles,
107
+ arrowProps: _objectSpread(_objectSpread({
108
+ iconSize: 's'
109
+ }, accordionProps === null || accordionProps === void 0 ? void 0 : accordionProps.arrowProps), {}, {
110
+ css: [styles.euiCollapsibleNavAccordion__arrow, accordionProps === null || accordionProps === void 0 ? void 0 : (_accordionProps$arrow = accordionProps.arrowProps) === null || _accordionProps$arrow === void 0 ? void 0 : _accordionProps$arrow.css]
111
+ })
112
+ }), children);
113
+ };