@elastic/eui 60.3.0 → 61.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 (274) hide show
  1. package/dist/eui_theme_dark.css +9 -173
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +9 -173
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/accessibility/skip_link/skip_link.js +1 -1
  6. package/es/components/avatar/avatar.js +1 -1
  7. package/es/components/badge/badge.js +1 -1
  8. package/es/components/badge/beta_badge/beta_badge.js +1 -1
  9. package/es/components/basic_table/basic_table.js +1 -1
  10. package/es/components/basic_table/collapsed_item_actions.js +1 -1
  11. package/es/components/basic_table/in_memory_table.js +1 -1
  12. package/es/components/button/_button_content_deprecated.js +1 -1
  13. package/es/components/button/button.js +2 -2
  14. package/es/components/button/button_display/_button_display.js +1 -1
  15. package/es/components/button/button_display/_button_display_content.js +1 -1
  16. package/es/components/button/button_empty/button_empty.js +1 -1
  17. package/es/components/button/button_group/button_group.js +1 -1
  18. package/es/components/button/button_group/button_group_button.js +1 -1
  19. package/es/components/button/button_icon/button_icon.js +1 -1
  20. package/es/components/call_out/call_out.js +1 -1
  21. package/es/components/card/card.js +1 -1
  22. package/es/components/card/card_select.js +1 -1
  23. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
  24. package/es/components/comment_list/comment.js +45 -24
  25. package/es/components/comment_list/comment_event.js +104 -33
  26. package/es/components/comment_list/comment_event.styles.js +78 -0
  27. package/es/components/comment_list/comment_list.js +38 -13
  28. package/es/components/comment_list/comment_timeline.js +22 -34
  29. package/es/components/datagrid/body/data_grid_body.js +14 -14
  30. package/es/components/datagrid/body/data_grid_cell.js +24 -24
  31. package/es/components/datagrid/body/header/data_grid_header_cell.js +12 -12
  32. package/es/components/datagrid/body/header/data_grid_header_row.js +13 -13
  33. package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
  34. package/es/components/datagrid/data_grid.js +13 -13
  35. package/es/components/datagrid/utils/in_memory.js +12 -12
  36. package/es/components/datagrid/utils/row_heights.js +27 -33
  37. package/es/components/date_picker/date_picker.js +2 -2
  38. package/es/components/date_picker/date_picker_range.js +1 -1
  39. package/es/components/empty_prompt/empty_prompt.js +1 -1
  40. package/es/components/form/field_number/field_number.js +1 -1
  41. package/es/components/form/field_text/field_text.js +2 -2
  42. package/es/components/form/form_control_layout/form_control_layout.js +2 -2
  43. package/es/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  44. package/es/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  45. package/es/components/header/header_links/header_link.js +1 -1
  46. package/es/components/header/header_links/header_links.js +1 -1
  47. package/es/components/header/header_logo.js +1 -1
  48. package/es/components/icon/assets/{keyboard_shortcut.js → keyboard.js} +5 -5
  49. package/es/components/icon/icon.js +1 -1
  50. package/es/components/icon/icon_map.js +1 -1
  51. package/es/components/key_pad_menu/key_pad_menu_item.js +1 -1
  52. package/es/components/list_group/list_group.js +2 -2
  53. package/es/components/list_group/list_group_item.js +2 -2
  54. package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  55. package/es/components/loading/loading_logo.js +1 -1
  56. package/es/components/markdown_editor/markdown_editor.js +1 -1
  57. package/es/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  58. package/es/components/markdown_editor/markdown_editor_footer.js +1 -1
  59. package/es/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  60. package/es/components/notification/notification_event.js +2 -2
  61. package/es/components/notification/notification_event_meta.js +1 -1
  62. package/es/components/page/page_header/page_header.js +1 -1
  63. package/es/components/page/page_header/page_header_content.js +1 -1
  64. package/es/components/page/page_template.js +1 -1
  65. package/es/components/pagination/pagination_button.js +1 -1
  66. package/es/components/selectable/selectable_list/selectable_list.js +1 -1
  67. package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  68. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  69. package/es/components/suggest/suggest.js +1 -1
  70. package/es/components/suggest/suggest_item.js +1 -1
  71. package/es/components/table/table_header_button.js +1 -1
  72. package/es/components/text/text.styles.js +5 -4
  73. package/es/components/timeline/timeline_item.js +1 -2
  74. package/es/components/timeline/timeline_item_icon.js +1 -1
  75. package/es/components/toast/global_toast_list.js +1 -1
  76. package/es/components/toast/toast.js +1 -1
  77. package/es/components/token/token.js +1 -1
  78. package/es/components/tool_tip/icon_tip.js +1 -1
  79. package/es/services/hooks/index.js +1 -0
  80. package/es/services/hooks/useLatest.js +18 -0
  81. package/es/test/emotion-prefix.js +1 -1
  82. package/eui.d.ts +198 -153
  83. package/lib/components/accessibility/skip_link/skip_link.js +1 -1
  84. package/lib/components/avatar/avatar.js +1 -1
  85. package/lib/components/badge/badge.js +1 -1
  86. package/lib/components/badge/beta_badge/beta_badge.js +1 -1
  87. package/lib/components/basic_table/basic_table.js +1 -1
  88. package/lib/components/basic_table/collapsed_item_actions.js +1 -1
  89. package/lib/components/basic_table/in_memory_table.js +1 -1
  90. package/lib/components/button/_button_content_deprecated.js +1 -1
  91. package/lib/components/button/button.js +2 -2
  92. package/lib/components/button/button_display/_button_display.js +1 -1
  93. package/lib/components/button/button_display/_button_display_content.js +1 -1
  94. package/lib/components/button/button_empty/button_empty.js +1 -1
  95. package/lib/components/button/button_group/button_group.js +1 -1
  96. package/lib/components/button/button_group/button_group_button.js +1 -1
  97. package/lib/components/button/button_icon/button_icon.js +1 -1
  98. package/lib/components/call_out/call_out.js +1 -1
  99. package/lib/components/card/card.js +1 -1
  100. package/lib/components/card/card_select.js +1 -1
  101. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
  102. package/lib/components/comment_list/comment.js +44 -25
  103. package/lib/components/comment_list/comment_event.js +105 -42
  104. package/lib/components/comment_list/comment_event.styles.js +86 -0
  105. package/lib/components/comment_list/comment_list.js +39 -13
  106. package/lib/components/comment_list/comment_timeline.js +23 -46
  107. package/lib/components/datagrid/body/data_grid_body.js +14 -14
  108. package/lib/components/datagrid/body/data_grid_cell.js +24 -24
  109. package/lib/components/datagrid/body/header/data_grid_header_cell.js +12 -12
  110. package/lib/components/datagrid/body/header/data_grid_header_row.js +13 -13
  111. package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
  112. package/lib/components/datagrid/data_grid.js +13 -13
  113. package/lib/components/datagrid/utils/in_memory.js +12 -12
  114. package/lib/components/datagrid/utils/row_heights.js +26 -32
  115. package/lib/components/date_picker/date_picker.js +2 -2
  116. package/lib/components/date_picker/date_picker_range.js +1 -1
  117. package/lib/components/empty_prompt/empty_prompt.js +1 -1
  118. package/lib/components/form/field_number/field_number.js +1 -1
  119. package/lib/components/form/field_text/field_text.js +2 -2
  120. package/lib/components/form/form_control_layout/form_control_layout.js +2 -2
  121. package/lib/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  122. package/lib/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  123. package/lib/components/header/header_links/header_link.js +1 -1
  124. package/lib/components/header/header_links/header_links.js +1 -1
  125. package/lib/components/header/header_logo.js +1 -1
  126. package/lib/components/icon/assets/{keyboard_shortcut.js → keyboard.js} +5 -5
  127. package/lib/components/icon/icon.js +1 -1
  128. package/lib/components/icon/icon_map.js +1 -1
  129. package/lib/components/icon/svgs/keyboard.svg +3 -0
  130. package/lib/components/key_pad_menu/key_pad_menu_item.js +1 -1
  131. package/lib/components/list_group/list_group.js +2 -2
  132. package/lib/components/list_group/list_group_item.js +2 -2
  133. package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  134. package/lib/components/loading/loading_logo.js +1 -1
  135. package/lib/components/markdown_editor/markdown_editor.js +1 -1
  136. package/lib/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  137. package/lib/components/markdown_editor/markdown_editor_footer.js +1 -1
  138. package/lib/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  139. package/lib/components/notification/notification_event.js +2 -2
  140. package/lib/components/notification/notification_event_meta.js +1 -1
  141. package/lib/components/page/page_header/page_header.js +1 -1
  142. package/lib/components/page/page_header/page_header_content.js +1 -1
  143. package/lib/components/page/page_template.js +1 -1
  144. package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
  145. package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  146. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  147. package/lib/components/suggest/suggest.js +1 -1
  148. package/lib/components/suggest/suggest_item.js +1 -1
  149. package/lib/components/table/table_header_button.js +1 -1
  150. package/lib/components/text/text.styles.js +4 -3
  151. package/lib/components/timeline/timeline_item.js +1 -2
  152. package/lib/components/timeline/timeline_item_icon.js +1 -1
  153. package/lib/components/toast/global_toast_list.js +1 -1
  154. package/lib/components/toast/toast.js +1 -1
  155. package/lib/components/token/token.js +1 -1
  156. package/lib/components/tool_tip/icon_tip.js +1 -1
  157. package/lib/services/hooks/index.js +13 -0
  158. package/lib/services/hooks/useLatest.js +26 -0
  159. package/lib/test/emotion-prefix.js +1 -1
  160. package/optimize/es/components/comment_list/comment.js +22 -17
  161. package/optimize/es/components/comment_list/comment_event.js +83 -28
  162. package/optimize/es/components/comment_list/comment_event.styles.js +78 -0
  163. package/optimize/es/components/comment_list/comment_list.js +7 -3
  164. package/optimize/es/components/comment_list/comment_timeline.js +19 -31
  165. package/optimize/es/components/datagrid/body/data_grid_body.js +1 -1
  166. package/optimize/es/components/datagrid/utils/row_heights.js +27 -33
  167. package/optimize/es/components/icon/assets/{keyboard_shortcut.js → keyboard.js} +5 -5
  168. package/optimize/es/components/icon/icon_map.js +1 -1
  169. package/optimize/es/components/text/text.styles.js +5 -4
  170. package/optimize/es/components/timeline/timeline_item.js +1 -2
  171. package/optimize/es/services/hooks/index.js +1 -0
  172. package/optimize/es/services/hooks/useLatest.js +18 -0
  173. package/optimize/es/test/emotion-prefix.js +1 -1
  174. package/optimize/lib/components/comment_list/comment.js +21 -17
  175. package/optimize/lib/components/comment_list/comment_event.js +85 -31
  176. package/optimize/lib/components/comment_list/comment_event.styles.js +86 -0
  177. package/optimize/lib/components/comment_list/comment_list.js +8 -3
  178. package/optimize/lib/components/comment_list/comment_timeline.js +21 -37
  179. package/optimize/lib/components/datagrid/body/data_grid_body.js +1 -1
  180. package/optimize/lib/components/datagrid/utils/row_heights.js +25 -30
  181. package/optimize/lib/components/icon/assets/{keyboard_shortcut.js → keyboard.js} +5 -5
  182. package/optimize/lib/components/icon/icon_map.js +1 -1
  183. package/optimize/lib/components/icon/svgs/keyboard.svg +3 -0
  184. package/optimize/lib/components/text/text.styles.js +4 -3
  185. package/optimize/lib/components/timeline/timeline_item.js +1 -2
  186. package/optimize/lib/services/hooks/index.js +13 -0
  187. package/optimize/lib/services/hooks/useLatest.js +26 -0
  188. package/optimize/lib/test/emotion-prefix.js +1 -1
  189. package/package.json +2 -2
  190. package/src/components/index.scss +0 -1
  191. package/src/components/markdown_editor/_markdown_editor.scss +3 -2
  192. package/src/themes/amsterdam/overrides/_index.scss +0 -1
  193. package/test-env/components/accessibility/skip_link/skip_link.js +1 -1
  194. package/test-env/components/avatar/avatar.js +1 -1
  195. package/test-env/components/badge/badge.js +1 -1
  196. package/test-env/components/badge/beta_badge/beta_badge.js +1 -1
  197. package/test-env/components/basic_table/basic_table.js +1 -1
  198. package/test-env/components/basic_table/collapsed_item_actions.js +1 -1
  199. package/test-env/components/basic_table/in_memory_table.js +1 -1
  200. package/test-env/components/button/_button_content_deprecated.js +1 -1
  201. package/test-env/components/button/button.js +2 -2
  202. package/test-env/components/button/button_display/_button_display.js +1 -1
  203. package/test-env/components/button/button_display/_button_display_content.js +1 -1
  204. package/test-env/components/button/button_empty/button_empty.js +1 -1
  205. package/test-env/components/button/button_group/button_group.js +1 -1
  206. package/test-env/components/button/button_group/button_group_button.js +1 -1
  207. package/test-env/components/button/button_icon/button_icon.js +1 -1
  208. package/test-env/components/call_out/call_out.js +1 -1
  209. package/test-env/components/card/card.js +1 -1
  210. package/test-env/components/card/card_select.js +1 -1
  211. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
  212. package/test-env/components/comment_list/comment.js +44 -24
  213. package/test-env/components/comment_list/comment_event.js +106 -36
  214. package/test-env/components/comment_list/comment_event.styles.js +86 -0
  215. package/test-env/components/comment_list/comment_list.js +39 -13
  216. package/test-env/components/comment_list/comment_timeline.js +23 -39
  217. package/test-env/components/datagrid/body/data_grid_body.js +14 -14
  218. package/test-env/components/datagrid/body/data_grid_cell.js +24 -24
  219. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +12 -12
  220. package/test-env/components/datagrid/body/header/data_grid_header_row.js +13 -13
  221. package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
  222. package/test-env/components/datagrid/data_grid.js +13 -13
  223. package/test-env/components/datagrid/utils/in_memory.js +12 -12
  224. package/test-env/components/datagrid/utils/row_heights.js +25 -30
  225. package/test-env/components/date_picker/date_picker.js +2 -2
  226. package/test-env/components/date_picker/date_picker_range.js +1 -1
  227. package/test-env/components/empty_prompt/empty_prompt.js +1 -1
  228. package/test-env/components/form/field_number/field_number.js +1 -1
  229. package/test-env/components/form/field_text/field_text.js +2 -2
  230. package/test-env/components/form/form_control_layout/form_control_layout.js +2 -2
  231. package/test-env/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  232. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  233. package/test-env/components/header/header_links/header_link.js +1 -1
  234. package/test-env/components/header/header_links/header_links.js +1 -1
  235. package/test-env/components/header/header_logo.js +1 -1
  236. package/test-env/components/icon/assets/{keyboard_shortcut.js → keyboard.js} +5 -5
  237. package/test-env/components/icon/icon_map.js +1 -1
  238. package/test-env/components/key_pad_menu/key_pad_menu_item.js +1 -1
  239. package/test-env/components/list_group/list_group.js +2 -2
  240. package/test-env/components/list_group/list_group_item.js +2 -2
  241. package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  242. package/test-env/components/loading/loading_logo.js +1 -1
  243. package/test-env/components/markdown_editor/markdown_editor.js +1 -1
  244. package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  245. package/test-env/components/markdown_editor/markdown_editor_footer.js +1 -1
  246. package/test-env/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  247. package/test-env/components/notification/notification_event.js +2 -2
  248. package/test-env/components/notification/notification_event_meta.js +1 -1
  249. package/test-env/components/page/page_header/page_header.js +1 -1
  250. package/test-env/components/page/page_header/page_header_content.js +1 -1
  251. package/test-env/components/page/page_template.js +1 -1
  252. package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
  253. package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
  254. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  255. package/test-env/components/suggest/suggest.js +1 -1
  256. package/test-env/components/suggest/suggest_item.js +1 -1
  257. package/test-env/components/table/table_header_button.js +1 -1
  258. package/test-env/components/text/text.styles.js +4 -3
  259. package/test-env/components/timeline/timeline_item.js +1 -2
  260. package/test-env/components/timeline/timeline_item_icon.js +1 -1
  261. package/test-env/components/toast/global_toast_list.js +1 -1
  262. package/test-env/components/toast/toast.js +1 -1
  263. package/test-env/components/token/token.js +1 -1
  264. package/test-env/components/tool_tip/icon_tip.js +1 -1
  265. package/test-env/services/hooks/index.js +13 -0
  266. package/test-env/services/hooks/useLatest.js +26 -0
  267. package/test-env/test/emotion-prefix.js +1 -1
  268. package/lib/components/icon/svgs/keyboard_shortcut.svg +0 -3
  269. package/optimize/lib/components/icon/svgs/keyboard_shortcut.svg +0 -3
  270. package/src/components/comment_list/_comment.scss +0 -38
  271. package/src/components/comment_list/_comment_event.scss +0 -77
  272. package/src/components/comment_list/_comment_timeline.scss +0 -27
  273. package/src/components/comment_list/_index.scss +0 -3
  274. package/src/themes/amsterdam/overrides/_comment.scss +0 -3
@@ -1,3 +1,5 @@
1
+ import _typeof from "@babel/runtime/helpers/typeof";
2
+
1
3
  /*
2
4
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
5
  * or more contributor license agreements. Licensed under the Elastic License
@@ -6,45 +8,31 @@
6
8
  * Side Public License, v 1.
7
9
  */
8
10
  import React from 'react';
9
- import { keysOf } from '../common';
10
- import classNames from 'classnames';
11
- import { EuiIcon } from '../icon';
11
+ import { EuiAvatar } from '../avatar';
12
12
  import { jsx as ___EmotionJSX } from "@emotion/react";
13
- var typeToClassNameMap = {
14
- regular: 'euiCommentTimeline__icon--regular',
15
- update: 'euiCommentTimeline__icon--update'
16
- };
17
- export var TYPES = keysOf(typeToClassNameMap);
18
13
  export var EuiCommentTimeline = function EuiCommentTimeline(_ref) {
19
- var className = _ref.className,
20
- timelineIcon = _ref.timelineIcon,
21
- _ref$type = _ref.type,
22
- type = _ref$type === void 0 ? 'regular' : _ref$type;
23
- var classes = classNames('euiCommentTimeline', className);
24
- var iconClasses = classNames({
25
- 'euiCommentTimeline__icon--default': !timelineIcon || typeof timelineIcon === 'string'
26
- }, typeToClassNameMap[type]);
14
+ var timelineIcon = _ref.timelineIcon,
15
+ username = _ref.username;
27
16
  var iconRender;
17
+ var avatarClassName = 'euiCommentAvatar';
18
+ var iconIsString = typeof timelineIcon === 'string';
19
+ var iconIsNode = _typeof(timelineIcon) === 'object';
28
20
 
29
- if (typeof timelineIcon === 'string') {
30
- iconRender = ___EmotionJSX(EuiIcon, {
31
- size: type === 'update' ? 'm' : 'l',
32
- type: timelineIcon
21
+ if (iconIsString) {
22
+ iconRender = ___EmotionJSX(EuiAvatar, {
23
+ className: avatarClassName,
24
+ name: username,
25
+ iconType: timelineIcon,
26
+ color: "subdued"
33
27
  });
34
- } else if (timelineIcon) {
28
+ } else if (iconIsNode) {
35
29
  iconRender = timelineIcon;
36
30
  } else {
37
- iconRender = ___EmotionJSX(EuiIcon, {
38
- type: type === 'update' ? 'dot' : 'user',
39
- size: type === 'update' ? 's' : 'l'
31
+ iconRender = ___EmotionJSX(EuiAvatar, {
32
+ className: avatarClassName,
33
+ name: username
40
34
  });
41
35
  }
42
36
 
43
- return ___EmotionJSX("div", {
44
- className: classes
45
- }, ___EmotionJSX("div", {
46
- className: "euiCommentTimeline__content"
47
- }, ___EmotionJSX("div", {
48
- className: iconClasses
49
- }, iconRender)));
37
+ return ___EmotionJSX(React.Fragment, null, iconRender);
50
38
  };
@@ -319,7 +319,7 @@ export var EuiDataGridBody = function EuiDataGridBody(props) {
319
319
  */
320
320
 
321
321
  var rowHeightUtils = useRowHeightUtils({
322
- gridRef: gridRef.current,
322
+ gridRef: gridRef,
323
323
  gridStyles: gridStyles,
324
324
  columns: columns,
325
325
  rowHeightsOptions: rowHeightsOptions
@@ -13,7 +13,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
13
13
  */
14
14
  import { useEffect, useState, useMemo, useCallback, useContext } from 'react';
15
15
  import { isObject, isNumber } from '../../../services/predicate';
16
- import { useForceRender } from '../../../services';
16
+ import { useForceRender, useLatest } from '../../../services';
17
17
  import { DataGridSortingContext } from './sorting'; // TODO: Once JS variables are available, use them here instead of hard-coded maps
18
18
 
19
19
  export var cellPaddingsMap = {
@@ -24,11 +24,14 @@ export var cellPaddingsMap = {
24
24
  export var AUTO_HEIGHT = 'auto';
25
25
  export var DEFAULT_ROW_HEIGHT = 34;
26
26
  export var RowHeightUtils = /*#__PURE__*/function () {
27
- function RowHeightUtils() {
27
+ function RowHeightUtils(gridRef, rerenderGridBodyRef) {
28
28
  var _this = this;
29
29
 
30
30
  _classCallCheck(this, RowHeightUtils);
31
31
 
32
+ this.gridRef = gridRef;
33
+ this.rerenderGridBodyRef = rerenderGridBodyRef;
34
+
32
35
  _defineProperty(this, "styles", {
33
36
  paddingTop: 0,
34
37
  paddingBottom: 0
@@ -63,11 +66,7 @@ export var RowHeightUtils = /*#__PURE__*/function () {
63
66
 
64
67
  _defineProperty(this, "timerId", void 0);
65
68
 
66
- _defineProperty(this, "grid", void 0);
67
-
68
69
  _defineProperty(this, "lastUpdatedRow", Infinity);
69
-
70
- _defineProperty(this, "rerenderGridBody", function () {});
71
70
  }
72
71
 
73
72
  _createClass(RowHeightUtils, [{
@@ -165,6 +164,8 @@ export var RowHeightUtils = /*#__PURE__*/function () {
165
164
  }, {
166
165
  key: "setRowHeight",
167
166
  value: function setRowHeight(rowIndex, colId) {
167
+ var _this$rerenderGridBod, _this$rerenderGridBod2;
168
+
168
169
  var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_ROW_HEIGHT;
169
170
  var visibleRowIndex = arguments.length > 3 ? arguments[3] : undefined;
170
171
  var rowHeights = this.heightsCache.get(rowIndex) || new Map();
@@ -179,7 +180,7 @@ export var RowHeightUtils = /*#__PURE__*/function () {
179
180
  this.resetRow(visibleRowIndex); // When an auto row height is updated, force a re-render
180
181
  // of the grid body to update the unconstrained height
181
182
 
182
- this.rerenderGridBody();
183
+ (_this$rerenderGridBod = (_this$rerenderGridBod2 = this.rerenderGridBodyRef).current) === null || _this$rerenderGridBod === void 0 ? void 0 : _this$rerenderGridBod.call(_this$rerenderGridBod2);
183
184
  }
184
185
  }, {
185
186
  key: "pruneHiddenColumnHeights",
@@ -219,21 +220,11 @@ export var RowHeightUtils = /*#__PURE__*/function () {
219
220
  }, {
220
221
  key: "resetGrid",
221
222
  value: function resetGrid() {
222
- var _this$grid;
223
+ var _this$gridRef$current;
223
224
 
224
- (_this$grid = this.grid) === null || _this$grid === void 0 ? void 0 : _this$grid.resetAfterRowIndex(this.lastUpdatedRow);
225
+ (_this$gridRef$current = this.gridRef.current) === null || _this$gridRef$current === void 0 ? void 0 : _this$gridRef$current.resetAfterRowIndex(this.lastUpdatedRow);
225
226
  this.lastUpdatedRow = Infinity;
226
227
  }
227
- }, {
228
- key: "setGrid",
229
- value: function setGrid(grid) {
230
- this.grid = grid;
231
- }
232
- }, {
233
- key: "setRerenderGridBody",
234
- value: function setRerenderGridBody(rerenderGridBody) {
235
- this.rerenderGridBody = rerenderGridBody;
236
- }
237
228
  }]);
238
229
 
239
230
  return RowHeightUtils;
@@ -248,22 +239,25 @@ export var useRowHeightUtils = function useRowHeightUtils(_ref2) {
248
239
  gridStyles = _ref2.gridStyles,
249
240
  columns = _ref2.columns,
250
241
  rowHeightsOptions = _ref2.rowHeightsOptions;
251
- var rowHeightUtils = useMemo(function () {
252
- return new RowHeightUtils();
253
- }, []); // Update rowHeightUtils with internal vars from outside dependencies
242
+ var forceRenderRef = useLatest(useForceRender());
254
243
 
255
- var forceRender = useForceRender();
256
- useEffect(function () {
257
- if (gridRef) rowHeightUtils.setGrid(gridRef);
258
- rowHeightUtils.setRerenderGridBody(forceRender);
259
- }, [gridRef, forceRender, rowHeightUtils]); // Forces a rerender whenever the row heights change, as this can cause the
244
+ var _useState = useState(function () {
245
+ return new RowHeightUtils(gridRef, forceRenderRef);
246
+ }),
247
+ _useState2 = _slicedToArray(_useState, 1),
248
+ rowHeightUtils = _useState2[0]; // Forces a rerender whenever the row heights change, as this can cause the
260
249
  // grid to change height/have scrollbars. Without this, grid rerendering is stale
261
250
 
251
+
262
252
  useEffect(function () {
263
- requestAnimationFrame(forceRender);
253
+ if (forceRenderRef.current == null) {
254
+ return;
255
+ }
256
+
257
+ requestAnimationFrame(forceRenderRef.current);
264
258
  }, [// Effects that should cause rerendering
265
259
  rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : rowHeightsOptions.defaultHeight, rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : rowHeightsOptions.rowHeights, // Dependencies
266
- rowHeightUtils, forceRender]); // Re-cache styles whenever grid density changes
260
+ rowHeightUtils, forceRenderRef]); // Re-cache styles whenever grid density changes
267
261
 
268
262
  useEffect(function () {
269
263
  rowHeightUtils.cacheStyles({
@@ -285,10 +279,10 @@ export var useDefaultRowHeight = function useDefaultRowHeight(_ref3) {
285
279
  // and ignored by auto & static heights (unless the static height is < the min)
286
280
 
287
281
 
288
- var _useState = useState(DEFAULT_ROW_HEIGHT),
289
- _useState2 = _slicedToArray(_useState, 2),
290
- minRowHeight = _useState2[0],
291
- setRowHeight = _useState2[1]; // Default/fallback height for all rows
282
+ var _useState3 = useState(DEFAULT_ROW_HEIGHT),
283
+ _useState4 = _slicedToArray(_useState3, 2),
284
+ minRowHeight = _useState4[0],
285
+ setRowHeight = _useState4[1]; // Default/fallback height for all rows
292
286
 
293
287
 
294
288
  var defaultRowHeight = useMemo(function () {
@@ -13,22 +13,22 @@ var _excluded = ["title", "titleId"];
13
13
  import * as React from 'react';
14
14
  import { jsx as ___EmotionJSX } from "@emotion/react";
15
15
 
16
- var EuiIconKeyboardShortcut = function EuiIconKeyboardShortcut(_ref) {
16
+ var EuiIconKeyboard = function EuiIconKeyboard(_ref) {
17
17
  var title = _ref.title,
18
18
  titleId = _ref.titleId,
19
19
  props = _objectWithoutProperties(_ref, _excluded);
20
20
 
21
21
  return ___EmotionJSX("svg", _extends({
22
22
  xmlns: "http://www.w3.org/2000/svg",
23
- width: 16,
24
- height: 16,
25
23
  viewBox: "0 0 16 16",
26
24
  "aria-labelledby": titleId
27
25
  }, props), title ? ___EmotionJSX("title", {
28
26
  id: titleId
29
27
  }, title) : null, ___EmotionJSX("path", {
30
- d: "M15 9a1 1 0 01.993.883L16 10v5a1 1 0 01-.883.993L15 16H7a1 1 0 01-.993-.883L6 15v-5a1 1 0 01.883-.993L7 9h8zM2.5 10a.5.5 0 01.492.41L3 10.5V12h1.5a.5.5 0 01.09.992L4.5 13H3v1.5a.5.5 0 01-.992.09L2 14.5V13H.5a.5.5 0 01-.09-.992L.5 12H2v-1.5a.5.5 0 01.5-.5zM15 10H7v5h8v-5zm-1 3v1H8v-1h6zm1-13a1 1 0 011 1v5a1 1 0 01-1 1H1a1 1 0 01-1-1V1a1 1 0 011-1h14zm0 1H1v5h14V1zM8 4v1H2V4h6z"
28
+ fillRule: "evenodd",
29
+ clipRule: "evenodd",
30
+ d: "M0 3h16v11H0V3zm15 10V4H1v9h14zM2 5h2v1H2V5zm2 7v-1H2v1h2zm10-1v1h-2v-1h2zm-3 1v-1H5v1h6zM5 5h1v1H5V5zM3 7H2v1h1V7zm3 0h1v1H6V7zM3 9H2v1h1V9zm3 0h1v1H6V9zm2-4H7v1h1V5zM4 7h1v1H4V7zm5 0H8v1h1V7zm1 0h1v1h-1V7zM5 9H4v1h1V9zm3 0h1v1H8V9zm3 0h-1v1h1V9zM9 5h1v1H9V5zm3 0h-1v1h1V5zm1 0h1v1h-1V5zm1 2h-2v3h2V7z"
31
31
  }));
32
32
  };
33
33
 
34
- export var icon = EuiIconKeyboardShortcut;
34
+ export var icon = EuiIconKeyboard;
@@ -176,7 +176,7 @@ export var typeToPathMap = {
176
176
  inspect: 'inspect',
177
177
  invert: 'invert',
178
178
  ip: 'ip',
179
- keyboardShortcut: 'keyboard_shortcut',
179
+ keyboard: 'keyboard',
180
180
  kqlField: 'kql_field',
181
181
  kqlFunction: 'kql_function',
182
182
  kqlOperand: 'kql_operand',
@@ -6,7 +6,7 @@
6
6
  * Side Public License, v 1.
7
7
  */
8
8
  import { css } from '@emotion/react';
9
- import { logicalCSS, euiFontSize, euiBackgroundColor } from '../../global_styling';
9
+ import { logicalCSS, logicalTextAlignCSS, euiFontSize, euiBackgroundColor } from '../../global_styling';
10
10
  import { euiLinkCSS } from '../link/link.styles';
11
11
  import { euiTitle } from '../title/title.styles';
12
12
  /**
@@ -47,7 +47,8 @@ var euiScaleText = function euiScaleText(euiThemeContext, options) {
47
47
  var customScale = _customScale === 'xxxs' ? 'xxs' : _customScale || 'm';
48
48
  var headingMarginTop = "".concat(parseFloat(euiTheme.size[customScale]) * 2, "px");
49
49
  var headingMarginBottom = euiTheme.size[customScale];
50
- return "\n font-size: ".concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n\n h1 {\n font-size: ").concat(headings.h1.fontSize, ";\n line-height: ").concat(headings.h1.lineHeight, ";\n }\n h1:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n\n h2 {\n font-size: ").concat(headings.h2.fontSize, ";\n line-height: ").concat(headings.h2.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n h3 {\n font-size: ").concat(headings.h3.fontSize, ";\n line-height: ").concat(headings.h3.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n h4 {\n font-size: ").concat(headings.h4.fontSize, ";\n line-height: ").concat(headings.h4.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n h5 {\n font-size: ").concat(headings.h5.fontSize, ";\n line-height: ").concat(headings.h5.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n h6 {\n font-size: ").concat(headings.h6.fontSize, ";\n line-height: ").concat(headings.h6.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n p,\n ul,\n ol,\n dl,\n blockquote,\n img,\n pre {\n ").concat(logicalCSS('margin-bottom', lineHeightSize), "\n }\n\n ul,\n ol {\n ").concat(logicalCSS('margin-left', lineHeightSize), "\n }\n \n blockquote {\n font-size: ").concat(fontSize, ";\n padding: ").concat(lineHeightSize, ";\n }\n\n dd + dt {\n ").concat(logicalCSS('margin-top', fontSize), "\n }\n\n dt,\n .eui-definitionListReverse dd {\n font-size: ").concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n }\n\n .eui-definitionListReverse dt {\n font-size: ").concat(euiFontSize(euiThemeContext, 'xs', options).fontSize, ";\n color: ").concat(euiTheme.colors.text, ";\n }\n\n small {\n font-size: ").concat(euiFontSize(euiThemeContext, 's', options).fontSize, ";\n }\n\n pre:not(.euiCodeBlock__pre) {\n padding: ").concat(lineHeightSize, ";\n }\n\n code:not(.euiCode):not(.euiCodeBlock__code) {\n font-size: .9em; // 90% of parent font size\n }\n ");
50
+ return "\n font-size: ".concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n\n h1 {\n font-size: ").concat(headings.h1.fontSize, ";\n line-height: ").concat(headings.h1.lineHeight, ";\n }\n h1:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n\n h2 {\n font-size: ").concat(headings.h2.fontSize, ";\n line-height: ").concat(headings.h2.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n h3 {\n font-size: ").concat(headings.h3.fontSize, ";\n line-height: ").concat(headings.h3.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n h4 {\n font-size: ").concat(headings.h4.fontSize, ";\n line-height: ").concat(headings.h4.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n h5 {\n font-size: ").concat(headings.h5.fontSize, ";\n line-height: ").concat(headings.h5.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n h6 {\n font-size: ").concat(headings.h6.fontSize, ";\n line-height: ").concat(headings.h6.lineHeight, ";\n\n &:not(:first-child) {\n ").concat(logicalCSS('margin-top', headingMarginTop), "\n }\n\n &:not(:last-child) {\n ").concat(logicalCSS('margin-bottom', headingMarginBottom), "\n }\n }\n\n p,\n ul,\n ol,\n dl,\n blockquote,\n img,\n pre {\n ").concat(logicalCSS('margin-bottom', lineHeightSize), "\n }\n\n ul,\n ol {\n ").concat(logicalCSS('margin-left', lineHeightSize), "\n }\n \n blockquote {\n font-size: ").concat(fontSize, ";\n padding: ").concat(lineHeightSize, ";\n }\n\n dd + dt {\n ").concat(logicalCSS('margin-top', fontSize), "\n }\n\n dt,\n .eui-definitionListReverse dd {\n font-size: ").concat(fontSize, ";\n line-height: ").concat(lineHeight, ";\n }\n\n .eui-definitionListReverse dt {\n font-size: ").concat(euiFontSize(euiThemeContext, 'xs', options).fontSize, ";\n color: ").concat(euiTheme.colors.text, ";\n }\n\n small {\n font-size: ").concat(euiFontSize(euiThemeContext, 's', options).fontSize, ";\n }\n\n pre:not(.euiCodeBlock__pre) {\n padding: ").concat(lineHeightSize, ";\n }\n\n code:not(.euiCode):not(.euiCodeBlock__code) {\n font-size: .9em; // 90% of parent font size\n }\n ").concat( // when textSize is 'm', the 'kbd' element gets a line between the text and the border-bottom
51
+ _customScale === 'm' ? "\n kbd {\n ".concat(logicalCSS('padding-bottom', euiTheme.size.xs), "\n // ensures when only one character the shape looks like a square\n ").concat(logicalCSS('min-width', euiTheme.size.l), "\n ").concat(logicalTextAlignCSS('center'), "\n }\n \n kbd::after {\n content: '';\n ").concat(logicalCSS('border-bottom', "".concat(euiTheme.border.width.thin, " solid ").concat(euiTheme.colors.text)), "\n position: absolute;\n ").concat(logicalCSS('bottom', euiTheme.size.xxs), "\n ").concat(logicalCSS('left', 0), "\n ").concat(logicalCSS('width', '100%'), "\n }") : '', "\n ");
51
52
  };
52
53
  /**
53
54
  * Styles
@@ -57,8 +58,8 @@ var euiScaleText = function euiScaleText(euiThemeContext, options) {
57
58
  export var euiTextStyles = function euiTextStyles(euiThemeContext) {
58
59
  var euiTheme = euiThemeContext.euiTheme;
59
60
  return {
60
- euiText: /*#__PURE__*/css(euiText(euiTheme, true), ";clear:both;a:not([class]){", euiLinkCSS(euiTheme), ";}img{display:block;width:100%;}ul{list-style:disc;}ol{list-style:decimal;}blockquote:not(.euiMarkdownFormat__blockquote){position:relative;text-align:center;", logicalCSS('margin-horizontal', 'auto'), " font-family:", euiTheme.font.familySerif, ";font-style:italic;letter-spacing:normal;p:last-child{margin-bottom:0;}&:before,&:after{position:absolute;content:'';height:", euiTheme.border.width.thick, ";width:50%;right:0;transform:translateX(-50%);background:", euiTheme.colors.darkShade, ";}&:before{top:0;}&:after{bottom:0;}}h1{", euiTitle(euiThemeContext, 'l'), ";}h2{", euiTitle(euiThemeContext, 'm'), ";}h3{", euiTitle(euiThemeContext, 's'), ";}h4,dt{", euiTitle(euiThemeContext, 'xs'), ";}h5{", euiTitle(euiThemeContext, 'xxs'), ";}h6{", euiTitle(euiThemeContext, 'xxxs'), " text-transform:uppercase;}h1,h2,h3,h4,h5,h6,dt{color:inherit;}pre:not(.euiCodeBlock__pre){white-space:pre-wrap;background:", euiBackgroundColor(euiThemeContext, 'subdued'), ";color:", euiTheme.colors.text, ";}pre:not(.euiCodeBlock__pre),pre:not(.euiCodeBlock__pre) code{display:block;}>:last-child{margin-bottom:0!important;};label:euiText;"),
61
- constrainedWidth: /*#__PURE__*/css("max-width:", euiTextConstrainedMaxWidth, ";;label:constrainedWidth;"),
61
+ euiText: /*#__PURE__*/css(euiText(euiTheme, true), ";clear:both;a:not([class]){", euiLinkCSS(euiTheme), ";}img{display:block;width:100%;}ul{list-style:disc;}ol{list-style:decimal;}blockquote:not(.euiMarkdownFormat__blockquote){position:relative;", logicalTextAlignCSS('center'), " ", logicalCSS('margin-horizontal', 'auto'), " font-family:", euiTheme.font.familySerif, ";font-style:italic;letter-spacing:normal;p:last-child{", logicalCSS('margin-bottom', '0'), ";}&:before,&:after{position:absolute;content:'';", logicalCSS('height', euiTheme.border.width.thick), " ", logicalCSS('width', '50%'), " ", logicalCSS('left', '25%'), " ", logicalCSS('right', '25%'), " background:", euiTheme.colors.darkShade, ";}&:before{", logicalCSS('top', '0'), ";}&:after{", logicalCSS('bottom', '0'), ";}}h1{", euiTitle(euiThemeContext, 'l'), ";}h2{", euiTitle(euiThemeContext, 'm'), ";}h3{", euiTitle(euiThemeContext, 's'), ";}h4,dt{", euiTitle(euiThemeContext, 'xs'), ";}h5{", euiTitle(euiThemeContext, 'xxs'), ";}h6{", euiTitle(euiThemeContext, 'xxxs'), " text-transform:uppercase;}h1,h2,h3,h4,h5,h6,dt{color:inherit;}pre:not(.euiCodeBlock__pre){white-space:pre-wrap;background:", euiBackgroundColor(euiThemeContext, 'subdued'), ";color:", euiTheme.colors.text, ";}pre:not(.euiCodeBlock__pre),pre:not(.euiCodeBlock__pre) code{display:block;}>:last-child{", logicalCSS('margin-bottom', '0 !important'), ";}kbd{position:relative;display:inline-block;", logicalCSS('padding-vertical', euiTheme.size.xxs), " ", logicalCSS('padding-horizontal', euiTheme.size.xs), " line-height:1;border:", euiTheme.border.width.thin, " solid ", euiTheme.colors.text, ";border-radius:calc(", euiTheme.border.radius.small, " / 2);};label:euiText;"),
62
+ constrainedWidth: /*#__PURE__*/css(logicalCSS('max-width', euiTextConstrainedMaxWidth), ";;label:constrainedWidth;"),
62
63
  // Sizes
63
64
  m: /*#__PURE__*/css(euiScaleText(euiThemeContext, {
64
65
  measurement: 'rem',
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "verticalAlign", "icon", "iconAriaLabel", "className"];
3
+ var _excluded = ["children", "verticalAlign", "icon", "iconAriaLabel"];
4
4
 
5
5
  /*
6
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -21,7 +21,6 @@ export var EuiTimelineItem = function EuiTimelineItem(_ref) {
21
21
  verticalAlign = _ref$verticalAlign === void 0 ? 'center' : _ref$verticalAlign,
22
22
  icon = _ref.icon,
23
23
  iconAriaLabel = _ref.iconAriaLabel,
24
- className = _ref.className,
25
24
  rest = _objectWithoutProperties(_ref, _excluded);
26
25
 
27
26
  var styles = euiTimelineItemStyles();
@@ -9,5 +9,6 @@ export * from './useDependentState';
9
9
  export * from './useCombinedRefs';
10
10
  export * from './useForceRender';
11
11
  export * from './useIsWithinBreakpoints';
12
+ export * from './useLatest';
12
13
  export * from './useMouseMove';
13
14
  export * from './useUpdateEffect';
@@ -0,0 +1,18 @@
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
+ import { useRef } from 'react';
9
+ /**
10
+ * Wraps the given `value` into a `MutableRefObject` and keeps the `current`
11
+ * value up-to-date on every render cycle.
12
+ */
13
+
14
+ export function useLatest(value) {
15
+ var latestValueRef = useRef(value);
16
+ latestValueRef.current = value;
17
+ return latestValueRef;
18
+ }
@@ -18,7 +18,7 @@ export var replaceEmotionPrefix = function replaceEmotionPrefix(selector) {
18
18
  // Starts with `css-[hash]-`.
19
19
  // Contains `eui[ComponentName] or `Eui[ComponentName]`.
20
20
  // Capture the component name (from above) and all variant additions until the end of the string.
21
- var euiMatch = selector.match( /*#__PURE__*/_wrapRegExp(/css\x2D[0-9A-Z_a-z]{6,}\x2D([Ee]ui[A-Z][\x2D0-9A-Z_a-z]*$)/, {
21
+ var euiMatch = selector.match( /*#__PURE__*/_wrapRegExp(/css\x2D[0-9A-Z_a-z]{5,}\x2D([Ee]ui[A-Z][\x2D0-9A-Z_a-z]*$)/, {
22
22
  euiComponent: 1
23
23
  })); // Use the captured group (`euiComponent`) if available and prepend with `emotion-`,
24
24
  // otherwise use the full selector.
@@ -15,17 +15,15 @@ var _react = _interopRequireDefault(require("react"));
15
15
 
16
16
  var _classnames = _interopRequireDefault(require("classnames"));
17
17
 
18
+ var _timeline = require("../timeline");
19
+
18
20
  var _comment_event = require("./comment_event");
19
21
 
20
22
  var _comment_timeline = require("./comment_timeline");
21
23
 
22
24
  var _react2 = require("@emotion/react");
23
25
 
24
- var _excluded = ["children", "className", "username", "event", "actions", "timelineIcon", "type", "timestamp"];
25
- var typeToClassNameMap = {
26
- regular: '',
27
- update: 'euiComment--update'
28
- };
26
+ var _excluded = ["children", "className", "username", "event", "actions", "timestamp", "timelineIcon", "eventColor", "eventIcon", "eventIconAriaLabel"];
29
27
 
30
28
  var EuiComment = function EuiComment(_ref) {
31
29
  var children = _ref.children,
@@ -33,25 +31,31 @@ var EuiComment = function EuiComment(_ref) {
33
31
  username = _ref.username,
34
32
  event = _ref.event,
35
33
  actions = _ref.actions,
36
- timelineIcon = _ref.timelineIcon,
37
- _ref$type = _ref.type,
38
- type = _ref$type === void 0 ? 'regular' : _ref$type,
39
34
  timestamp = _ref.timestamp,
35
+ timelineIcon = _ref.timelineIcon,
36
+ eventColor = _ref.eventColor,
37
+ eventIcon = _ref.eventIcon,
38
+ eventIconAriaLabel = _ref.eventIconAriaLabel,
40
39
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
41
- var classes = (0, _classnames.default)('euiComment', typeToClassNameMap[type], {
42
- 'euiComment--hasBody': children
43
- }, className);
44
- return (0, _react2.jsx)("div", (0, _extends2.default)({
45
- className: classes
46
- }, rest), (0, _react2.jsx)(_comment_timeline.EuiCommentTimeline, {
47
- type: type,
40
+ var classes = (0, _classnames.default)('euiComment', className);
41
+ var isTypeUpdate = !children;
42
+ var verticalAlign = isTypeUpdate ? 'center' : 'top';
43
+ var mainIcon = (0, _react2.jsx)(_comment_timeline.EuiCommentTimeline, {
44
+ username: username,
48
45
  timelineIcon: timelineIcon
49
- }), (0, _react2.jsx)(_comment_event.EuiCommentEvent, {
46
+ });
47
+ return (0, _react2.jsx)(_timeline.EuiTimelineItem, (0, _extends2.default)({
48
+ verticalAlign: verticalAlign,
49
+ className: classes,
50
+ icon: mainIcon
51
+ }, rest), (0, _react2.jsx)(_comment_event.EuiCommentEvent, {
50
52
  username: username,
51
53
  actions: actions,
52
54
  event: event,
53
55
  timestamp: timestamp,
54
- type: type
56
+ eventColor: eventColor,
57
+ eventIcon: eventIcon,
58
+ eventIconAriaLabel: eventIconAriaLabel
55
59
  }, children));
56
60
  };
57
61
 
@@ -5,14 +5,22 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.TYPES = exports.EuiCommentEvent = void 0;
8
+ exports.EuiCommentEvent = void 0;
9
+
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
11
 
10
12
  var _react = _interopRequireDefault(require("react"));
11
13
 
12
- var _common = require("../common");
14
+ var _services = require("../../services");
13
15
 
14
16
  var _classnames = _interopRequireDefault(require("classnames"));
15
17
 
18
+ var _panel = require("../panel");
19
+
20
+ var _avatar = require("../avatar");
21
+
22
+ var _comment_event = require("./comment_event.styles");
23
+
16
24
  var _react2 = require("@emotion/react");
17
25
 
18
26
  /*
@@ -22,43 +30,89 @@ var _react2 = require("@emotion/react");
22
30
  * in compliance with, at your election, the Elastic License 2.0 or the Server
23
31
  * Side Public License, v 1.
24
32
  */
25
- var typeToClassNameMap = {
26
- regular: 'euiCommentEvent--regular',
27
- update: 'euiCommentEvent--update'
28
- };
29
- var TYPES = (0, _common.keysOf)(typeToClassNameMap);
30
- exports.TYPES = TYPES;
31
-
32
33
  var EuiCommentEvent = function EuiCommentEvent(_ref) {
33
34
  var children = _ref.children,
34
35
  className = _ref.className,
36
+ eventIcon = _ref.eventIcon,
37
+ eventIconAriaLabel = _ref.eventIconAriaLabel,
35
38
  username = _ref.username,
36
39
  timestamp = _ref.timestamp,
37
- _ref$type = _ref.type,
38
- type = _ref$type === void 0 ? 'regular' : _ref$type,
39
40
  event = _ref.event,
40
- actions = _ref.actions;
41
- var classes = (0, _classnames.default)('euiCommentEvent', typeToClassNameMap[type], className);
42
- var isFigure = type === 'regular' || type === 'update' && typeof children !== 'undefined';
41
+ actions = _ref.actions,
42
+ eventColor = _ref.eventColor;
43
+ var classes = (0, _classnames.default)('euiCommentEvent', className); // the username is required so we only check if other elements are define
44
+
45
+ var hasEventElements = eventIcon || timestamp || event || actions;
46
+ var isTypeRegular = children && hasEventElements;
47
+ var isTypeUpdate = !children && hasEventElements;
48
+ var type;
49
+
50
+ if (isTypeRegular) {
51
+ type = 'regular';
52
+ } else if (isTypeUpdate) {
53
+ type = 'update';
54
+ } else {
55
+ type = 'custom';
56
+ }
57
+
58
+ var euiTheme = (0, _services.useEuiTheme)();
59
+ var styles = (0, _comment_event.euiCommentEventStyles)(euiTheme);
60
+ var cssStyles = [styles.euiCommentEvent, styles[type]];
61
+ var headerStyles = (0, _comment_event.euiCommentEventHeaderStyles)(euiTheme);
62
+ var cssHeaderStyles = [headerStyles.euiCommentEvent__header, eventColor && headerStyles.hasEventColor, isTypeRegular && headerStyles.regular];
63
+ var cssHeaderPanelStyles = headerStyles.euiCommentEvent__headerPanel;
64
+ var cssHeaderEventIconStyles = headerStyles.euiCommentEvent__headerEventIcon;
65
+ var cssHeaderUsernameStyles = headerStyles.euiCommentEvent__headerUsername;
66
+ var cssHeaderEventStyles = headerStyles.euiCommentEvent__headerEvent;
67
+ var cssHeaderTimestampStyles = headerStyles.euiCommentEvent__headerTimestamp;
68
+ var cssHeaderMainStyles = headerStyles.euiCommentEvent__headerMain;
69
+ var cssHeaderDataStyles = headerStyles.euiCommentEvent__headerData;
70
+ var cssHeaderActionsStyles = headerStyles.euiCommentEvent__headerActions;
71
+ var bodyStyles = (0, _comment_event.euiCommentEventBodyStyles)(euiTheme);
72
+ var cssBodyStyles = [bodyStyles.euiCommentEvent__body, bodyStyles[type]];
73
+ var isFigure = isTypeRegular;
43
74
  var Element = isFigure ? 'figure' : 'div';
44
- var HeaderElement = isFigure ? 'figcaption' : 'div';
45
- return (0, _react2.jsx)(Element, {
46
- className: classes
47
- }, (0, _react2.jsx)(HeaderElement, {
48
- className: "euiCommentEvent__header"
49
- }, (0, _react2.jsx)("div", {
50
- className: "euiCommentEvent__headerData"
75
+ var HeaderElement = isFigure ? 'figcaption' : 'div'; // The 'plain' color creates a shadow and adds a border radius that we don't want.
76
+ // So for these cases we use the transparent color instead.
77
+
78
+ var finalEventColor = eventColor === 'plain' ? 'transparent' : eventColor;
79
+ var panelProps = finalEventColor ? {
80
+ color: finalEventColor,
81
+ paddingSize: 's'
82
+ } : {
83
+ color: 'transparent',
84
+ paddingSize: 'none'
85
+ };
86
+ var eventHeader = (0, _react2.jsx)(HeaderElement, {
87
+ css: cssHeaderStyles
88
+ }, (0, _react2.jsx)(_panel.EuiPanel, (0, _extends2.default)({}, panelProps, {
89
+ css: cssHeaderPanelStyles
90
+ }), (0, _react2.jsx)("div", {
91
+ css: cssHeaderMainStyles
51
92
  }, (0, _react2.jsx)("div", {
52
- className: "euiCommentEvent__headerUsername"
53
- }, username), (0, _react2.jsx)("div", {
54
- className: "euiCommentEvent__headerEvent"
55
- }, event), timestamp ? (0, _react2.jsx)("div", {
56
- className: "euiCommentEvent__headerTimestamp"
57
- }, (0, _react2.jsx)("time", null, timestamp)) : undefined), actions ? (0, _react2.jsx)("div", {
58
- className: "euiCommentEvent__headerActions"
59
- }, actions) : undefined), children ? (0, _react2.jsx)("div", {
60
- className: "euiCommentEvent__body"
61
- }, children) : undefined);
93
+ css: cssHeaderDataStyles
94
+ }, eventIcon && (0, _react2.jsx)(_avatar.EuiAvatar, {
95
+ css: cssHeaderEventIconStyles,
96
+ size: "s",
97
+ iconType: eventIcon,
98
+ name: eventIconAriaLabel ? eventIconAriaLabel : '',
99
+ color: "subdued",
100
+ "aria-hidden": !eventIconAriaLabel
101
+ }), username && (0, _react2.jsx)("div", {
102
+ css: cssHeaderUsernameStyles
103
+ }, username), event && (0, _react2.jsx)("div", {
104
+ css: cssHeaderEventStyles
105
+ }, event), timestamp && (0, _react2.jsx)("div", {
106
+ css: cssHeaderTimestampStyles
107
+ }, (0, _react2.jsx)("time", null, timestamp))), actions && (0, _react2.jsx)("div", {
108
+ css: cssHeaderActionsStyles
109
+ }, actions))));
110
+ return (0, _react2.jsx)(Element, {
111
+ className: classes,
112
+ css: cssStyles
113
+ }, hasEventElements && eventHeader, children && (0, _react2.jsx)("div", {
114
+ css: cssBodyStyles
115
+ }, children));
62
116
  };
63
117
 
64
118
  exports.EuiCommentEvent = EuiCommentEvent;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiCommentEventStyles = exports.euiCommentEventHeaderStyles = exports.euiCommentEventBodyStyles = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ var _global_styling = require("../../global_styling");
11
+
12
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
13
+
14
+ var _ref3 = process.env.NODE_ENV === "production" ? {
15
+ name: "yoyozp-euiCommentEvent",
16
+ styles: "overflow:hidden;label:euiCommentEvent;"
17
+ } : {
18
+ name: "yoyozp-euiCommentEvent",
19
+ styles: "overflow:hidden;label:euiCommentEvent;",
20
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
21
+ };
22
+
23
+ var euiCommentEventStyles = function euiCommentEventStyles(_ref4) {
24
+ var euiTheme = _ref4.euiTheme;
25
+ return {
26
+ euiCommentEvent: _ref3,
27
+ // types
28
+ regular: /*#__PURE__*/(0, _react.css)("border:", euiTheme.border.thin, ";border-radius:", euiTheme.border.radius.medium, ";;label:regular;"),
29
+ update: /*#__PURE__*/(0, _react.css)(";label:update;"),
30
+ custom: /*#__PURE__*/(0, _react.css)(";label:custom;")
31
+ };
32
+ };
33
+
34
+ exports.euiCommentEventStyles = euiCommentEventStyles;
35
+
36
+ var _ref = process.env.NODE_ENV === "production" ? {
37
+ name: "bqgcpj-hasEventColor",
38
+ styles: "padding:0;label:hasEventColor;"
39
+ } : {
40
+ name: "bqgcpj-hasEventColor",
41
+ styles: "padding:0;label:hasEventColor;",
42
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
43
+ };
44
+
45
+ var _ref2 = process.env.NODE_ENV === "production" ? {
46
+ name: "ui5tce-euiCommentEvent__headerEvent",
47
+ styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;"
48
+ } : {
49
+ name: "ui5tce-euiCommentEvent__headerEvent",
50
+ styles: "align-items:center;display:inline-flex;white-space:pre-wrap;flex-wrap:wrap;label:euiCommentEvent__headerEvent;",
51
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
52
+ };
53
+
54
+ var euiCommentEventHeaderStyles = function euiCommentEventHeaderStyles(_ref5) {
55
+ var euiTheme = _ref5.euiTheme;
56
+ return {
57
+ euiCommentEvent__header: /*#__PURE__*/(0, _react.css)(";label:euiCommentEvent__header;"),
58
+ euiCommentEvent__headerPanel: /*#__PURE__*/(0, _react.css)(";label:euiCommentEvent__headerPanel;"),
59
+ euiCommentEvent__headerMain: /*#__PURE__*/(0, _react.css)("display:flex;flex:1;gap:", euiTheme.size.s, ";;label:euiCommentEvent__headerMain;"),
60
+ euiCommentEvent__headerData: /*#__PURE__*/(0, _react.css)("display:flex;flex:1;align-items:center;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerData;"),
61
+ euiCommentEvent__headerEventIcon: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-right', euiTheme.size.xs), ";;label:euiCommentEvent__headerEventIcon;"),
62
+ euiCommentEvent__headerUsername: /*#__PURE__*/(0, _react.css)("font-weight:", euiTheme.font.weight.semiBold, ";;label:euiCommentEvent__headerUsername;"),
63
+ euiCommentEvent__headerEvent: _ref2,
64
+ euiCommentEvent__headerTimestamp: /*#__PURE__*/(0, _react.css)(";label:euiCommentEvent__headerTimestamp;"),
65
+ euiCommentEvent__headerActions: /*#__PURE__*/(0, _react.css)("display:flex;flex-wrap:wrap;gap:", euiTheme.size.xs, ";;label:euiCommentEvent__headerActions;"),
66
+ // types
67
+ regular: /*#__PURE__*/(0, _react.css)("background:", euiTheme.colors.lightestShade, ";border-bottom:", euiTheme.border.thin, ";padding:", euiTheme.size.s, ";;label:regular;"),
68
+ // variants
69
+ hasEventColor: _ref
70
+ };
71
+ };
72
+
73
+ exports.euiCommentEventHeaderStyles = euiCommentEventHeaderStyles;
74
+
75
+ var euiCommentEventBodyStyles = function euiCommentEventBodyStyles(_ref6) {
76
+ var euiTheme = _ref6.euiTheme;
77
+ return {
78
+ euiCommentEvent__body: /*#__PURE__*/(0, _react.css)(";label:euiCommentEvent__body;"),
79
+ // types
80
+ regular: /*#__PURE__*/(0, _react.css)("padding:", euiTheme.size.s, ";;label:regular;"),
81
+ update: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-top', euiTheme.size.xs), ";;label:update;"),
82
+ custom: /*#__PURE__*/(0, _react.css)(";label:custom;")
83
+ };
84
+ };
85
+
86
+ exports.euiCommentEventBodyStyles = euiCommentEventBodyStyles;