@elastic/eui 116.2.0 → 116.3.1
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.
- package/es/components/avatar/avatar.js +18 -5
- package/es/components/avatar/avatar.styles.js +16 -16
- package/es/components/banner/banner.js +202 -0
- package/es/components/banner/banner.styles.js +76 -0
- package/es/components/banner/index.js +9 -0
- package/es/components/basic_table/basic_table.js +21 -10
- package/es/components/basic_table/collapsed_item_actions.js +5 -4
- package/es/components/basic_table/default_item_action.js +3 -5
- package/es/components/breadcrumbs/_breadcrumb_content.js +29 -19
- package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +2 -1
- package/es/components/context_menu/context_menu_panel_title.js +0 -12
- package/es/components/datagrid/body/cell/data_grid_cell_actions.js +11 -7
- package/es/components/datagrid/controls/display_selector.js +2 -1
- package/es/components/datagrid/controls/keyboard_shortcuts.js +2 -1
- package/es/components/date_picker/auto_refresh/auto_refresh.js +7 -4
- package/es/components/date_picker/react-datepicker/src/index.js +1 -5
- package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +6 -3
- package/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +10 -2
- package/es/components/date_picker/super_date_picker/date_popover/date_popover_button.styles.js +2 -1
- package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +8 -5
- package/es/components/form/field_password/field_password.js +6 -3
- package/es/components/header/header.a11y.js +1 -1
- package/es/components/index.js +1 -0
- package/es/components/markdown_editor/markdown_editor_help_button.js +7 -4
- package/es/components/pagination/pagination_button_arrow.js +6 -2
- package/es/components/panel/panel.styles.js +4 -4
- package/es/components/panel/split_panel/split_panel.styles.js +1 -1
- package/es/components/search_bar/search_bar.js +20 -16
- package/es/components/search_bar/search_box.js +4 -2
- package/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list.styles.js +1 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +2 -1
- package/es/components/table/sticky_header/context.js +32 -0
- package/es/components/table/sticky_header/index.js +10 -0
- package/es/components/table/sticky_header/sticky_header.js +151 -0
- package/es/components/table/sticky_header/sticky_header.styles.js +43 -0
- package/es/components/table/store/provider.js +37 -0
- package/es/components/table/store/store.js +82 -0
- package/es/components/table/store/use_unique_column_id.js +25 -0
- package/es/components/table/table.js +28 -3
- package/es/components/table/table.styles.js +4 -4
- package/es/components/table/table_header_cell.js +115 -48
- package/es/components/table/table_header_cell_checkbox.js +58 -25
- package/es/components/text_truncate/text_truncate.js +8 -3
- package/es/components/tool_tip/tool_tip.js +1 -1
- package/es/components/tool_tip/tool_tip.styles.js +14 -5
- package/es/utils/publisher.js +53 -0
- package/eui.d.ts +1284 -975
- package/i18ntokens.json +2390 -2372
- package/lib/components/avatar/avatar.js +18 -5
- package/lib/components/avatar/avatar.styles.js +16 -16
- package/lib/components/banner/banner.js +211 -0
- package/lib/components/banner/banner.styles.js +80 -0
- package/lib/components/banner/index.js +12 -0
- package/lib/components/basic_table/basic_table.js +21 -10
- package/lib/components/basic_table/collapsed_item_actions.js +5 -4
- package/lib/components/basic_table/default_item_action.js +3 -5
- package/lib/components/breadcrumbs/_breadcrumb_content.js +29 -19
- package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +2 -1
- package/lib/components/context_menu/context_menu_panel_title.js +0 -12
- package/lib/components/datagrid/body/cell/data_grid_cell_actions.js +11 -7
- package/lib/components/datagrid/controls/display_selector.js +2 -1
- package/lib/components/datagrid/controls/keyboard_shortcuts.js +2 -1
- package/lib/components/date_picker/auto_refresh/auto_refresh.js +7 -4
- package/lib/components/date_picker/react-datepicker/src/index.js +0 -4
- package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +6 -3
- package/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +10 -2
- package/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.styles.js +2 -1
- package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +8 -5
- package/lib/components/form/field_password/field_password.js +6 -3
- package/lib/components/header/header.a11y.js +1 -1
- package/lib/components/index.js +11 -0
- package/lib/components/markdown_editor/markdown_editor_help_button.js +7 -4
- package/lib/components/pagination/pagination_button_arrow.js +6 -2
- package/lib/components/panel/panel.styles.js +4 -4
- package/lib/components/panel/split_panel/split_panel.styles.js +1 -1
- package/lib/components/search_bar/search_bar.js +20 -16
- package/lib/components/search_bar/search_box.js +4 -2
- package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/lib/components/selectable/selectable_list/selectable_list.styles.js +1 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +2 -1
- package/lib/components/table/sticky_header/context.js +41 -0
- package/lib/components/table/sticky_header/index.js +19 -0
- package/lib/components/table/sticky_header/sticky_header.js +156 -0
- package/lib/components/table/sticky_header/sticky_header.styles.js +47 -0
- package/lib/components/table/store/provider.js +46 -0
- package/lib/components/table/store/store.js +87 -0
- package/lib/components/table/store/use_unique_column_id.js +34 -0
- package/lib/components/table/table.js +28 -3
- package/lib/components/table/table.styles.js +4 -4
- package/lib/components/table/table_header_cell.js +117 -48
- package/lib/components/table/table_header_cell_checkbox.js +61 -25
- package/lib/components/text_truncate/text_truncate.js +8 -3
- package/lib/components/tool_tip/tool_tip.js +1 -1
- package/lib/components/tool_tip/tool_tip.styles.js +14 -5
- package/lib/utils/publisher.js +59 -0
- package/optimize/es/components/avatar/avatar.js +16 -4
- package/optimize/es/components/avatar/avatar.styles.js +16 -16
- package/optimize/es/components/banner/banner.js +112 -0
- package/optimize/es/components/banner/banner.styles.js +76 -0
- package/optimize/es/components/banner/index.js +9 -0
- package/optimize/es/components/basic_table/basic_table.js +21 -10
- package/optimize/es/components/basic_table/collapsed_item_actions.js +5 -4
- package/optimize/es/components/basic_table/default_item_action.js +3 -5
- package/optimize/es/components/breadcrumbs/_breadcrumb_content.js +27 -18
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +2 -1
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_actions.js +11 -7
- package/optimize/es/components/datagrid/controls/display_selector.js +2 -1
- package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +2 -1
- package/optimize/es/components/date_picker/auto_refresh/auto_refresh.js +7 -4
- package/optimize/es/components/date_picker/react-datepicker/src/index.js +1 -5
- package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +6 -3
- package/optimize/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +10 -2
- package/optimize/es/components/date_picker/super_date_picker/date_popover/date_popover_button.styles.js +2 -1
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +8 -5
- package/optimize/es/components/form/field_password/field_password.js +6 -3
- package/optimize/es/components/header/header.a11y.js +1 -1
- package/optimize/es/components/index.js +1 -0
- package/optimize/es/components/markdown_editor/markdown_editor_help_button.js +7 -4
- package/optimize/es/components/pagination/pagination_button_arrow.js +6 -2
- package/optimize/es/components/panel/panel.styles.js +4 -4
- package/optimize/es/components/panel/split_panel/split_panel.styles.js +1 -1
- package/optimize/es/components/search_bar/search_bar.js +20 -16
- package/optimize/es/components/search_bar/search_box.js +4 -2
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/optimize/es/components/selectable/selectable_list/selectable_list.styles.js +1 -1
- package/optimize/es/components/table/sticky_header/context.js +32 -0
- package/optimize/es/components/table/sticky_header/index.js +10 -0
- package/optimize/es/components/table/sticky_header/sticky_header.js +146 -0
- package/optimize/es/components/table/sticky_header/sticky_header.styles.js +43 -0
- package/optimize/es/components/table/store/provider.js +37 -0
- package/optimize/es/components/table/store/store.js +82 -0
- package/optimize/es/components/table/store/use_unique_column_id.js +25 -0
- package/optimize/es/components/table/table.js +15 -3
- package/optimize/es/components/table/table.styles.js +4 -4
- package/optimize/es/components/table/table_header_cell.js +115 -48
- package/optimize/es/components/table/table_header_cell_checkbox.js +58 -25
- package/optimize/es/components/text_truncate/text_truncate.js +8 -3
- package/optimize/es/components/tool_tip/tool_tip.js +1 -1
- package/optimize/es/components/tool_tip/tool_tip.styles.js +14 -5
- package/optimize/es/utils/publisher.js +53 -0
- package/optimize/lib/components/avatar/avatar.js +16 -4
- package/optimize/lib/components/avatar/avatar.styles.js +16 -16
- package/optimize/lib/components/banner/banner.js +121 -0
- package/optimize/lib/components/banner/banner.styles.js +80 -0
- package/optimize/lib/components/banner/index.js +12 -0
- package/optimize/lib/components/basic_table/basic_table.js +21 -10
- package/optimize/lib/components/basic_table/collapsed_item_actions.js +5 -4
- package/optimize/lib/components/basic_table/default_item_action.js +3 -5
- package/optimize/lib/components/breadcrumbs/_breadcrumb_content.js +27 -18
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +2 -1
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_actions.js +11 -7
- package/optimize/lib/components/datagrid/controls/display_selector.js +2 -1
- package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +2 -1
- package/optimize/lib/components/date_picker/auto_refresh/auto_refresh.js +7 -4
- package/optimize/lib/components/date_picker/react-datepicker/src/index.js +0 -4
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +6 -3
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +10 -2
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.styles.js +2 -1
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +8 -5
- package/optimize/lib/components/form/field_password/field_password.js +6 -3
- package/optimize/lib/components/header/header.a11y.js +1 -1
- package/optimize/lib/components/index.js +11 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_help_button.js +7 -4
- package/optimize/lib/components/pagination/pagination_button_arrow.js +6 -2
- package/optimize/lib/components/panel/panel.styles.js +4 -4
- package/optimize/lib/components/panel/split_panel/split_panel.styles.js +1 -1
- package/optimize/lib/components/search_bar/search_bar.js +20 -16
- package/optimize/lib/components/search_bar/search_box.js +4 -2
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/optimize/lib/components/selectable/selectable_list/selectable_list.styles.js +1 -1
- package/optimize/lib/components/table/sticky_header/context.js +41 -0
- package/optimize/lib/components/table/sticky_header/index.js +19 -0
- package/optimize/lib/components/table/sticky_header/sticky_header.js +156 -0
- package/optimize/lib/components/table/sticky_header/sticky_header.styles.js +47 -0
- package/optimize/lib/components/table/store/provider.js +46 -0
- package/optimize/lib/components/table/store/store.js +87 -0
- package/optimize/lib/components/table/store/use_unique_column_id.js +34 -0
- package/optimize/lib/components/table/table.js +15 -3
- package/optimize/lib/components/table/table.styles.js +4 -4
- package/optimize/lib/components/table/table_header_cell.js +118 -48
- package/optimize/lib/components/table/table_header_cell_checkbox.js +61 -25
- package/optimize/lib/components/text_truncate/text_truncate.js +8 -3
- package/optimize/lib/components/tool_tip/tool_tip.js +1 -1
- package/optimize/lib/components/tool_tip/tool_tip.styles.js +14 -5
- package/optimize/lib/utils/publisher.js +59 -0
- package/package.json +2 -2
- package/test-env/components/avatar/avatar.js +18 -5
- package/test-env/components/avatar/avatar.styles.js +16 -16
- package/test-env/components/banner/banner.js +210 -0
- package/test-env/components/banner/banner.styles.js +80 -0
- package/test-env/components/banner/index.js +12 -0
- package/test-env/components/basic_table/basic_table.js +21 -10
- package/test-env/components/basic_table/collapsed_item_actions.js +5 -4
- package/test-env/components/basic_table/default_item_action.js +3 -5
- package/test-env/components/breadcrumbs/_breadcrumb_content.js +29 -19
- package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +2 -1
- package/test-env/components/context_menu/context_menu_panel_title.js +0 -12
- package/test-env/components/datagrid/body/cell/data_grid_cell_actions.js +11 -7
- package/test-env/components/datagrid/controls/display_selector.js +2 -1
- package/test-env/components/datagrid/controls/keyboard_shortcuts.js +2 -1
- package/test-env/components/date_picker/auto_refresh/auto_refresh.js +7 -4
- package/test-env/components/date_picker/react-datepicker/src/index.js +0 -4
- package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +6 -3
- package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_button.js +10 -2
- package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_button.styles.js +2 -1
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +8 -5
- package/test-env/components/form/field_password/field_password.js +6 -3
- package/test-env/components/header/header.a11y.js +1 -1
- package/test-env/components/index.js +11 -0
- package/test-env/components/markdown_editor/markdown_editor_help_button.js +7 -4
- package/test-env/components/pagination/pagination_button_arrow.js +6 -2
- package/test-env/components/panel/panel.styles.js +4 -4
- package/test-env/components/panel/split_panel/split_panel.styles.js +1 -1
- package/test-env/components/search_bar/search_bar.js +20 -16
- package/test-env/components/search_bar/search_box.js +4 -2
- package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
- package/test-env/components/selectable/selectable_list/selectable_list.styles.js +1 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +2 -1
- package/test-env/components/table/sticky_header/context.js +41 -0
- package/test-env/components/table/sticky_header/index.js +19 -0
- package/test-env/components/table/sticky_header/sticky_header.js +156 -0
- package/test-env/components/table/sticky_header/sticky_header.styles.js +47 -0
- package/test-env/components/table/store/provider.js +46 -0
- package/test-env/components/table/store/store.js +87 -0
- package/test-env/components/table/store/use_unique_column_id.js +34 -0
- package/test-env/components/table/table.js +28 -3
- package/test-env/components/table/table.styles.js +4 -4
- package/test-env/components/table/table_header_cell.js +118 -48
- package/test-env/components/table/table_header_cell_checkbox.js +61 -25
- package/test-env/components/text_truncate/text_truncate.js +8 -3
- package/test-env/components/tool_tip/tool_tip.js +1 -1
- package/test-env/components/tool_tip/tool_tip.styles.js +14 -5
- package/test-env/utils/publisher.js +59 -0
|
@@ -0,0 +1,82 @@
|
|
|
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 { createPublisher } from '../../../utils/publisher';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* EuiTable store that helps with column and width synchronization between
|
|
21
|
+
* the original table and the "virtual" sticky header table.
|
|
22
|
+
*
|
|
23
|
+
* This store is currently only used for these synchronization purposes, but
|
|
24
|
+
* that may extend as we implement resizable columns.
|
|
25
|
+
* If that's not implemented by the time per-axis `position: sticky`
|
|
26
|
+
* is supported in all browsers natively, this can be removed.
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
export var createEuiTableStore = function createEuiTableStore() {
|
|
31
|
+
var columns = new Map();
|
|
32
|
+
var columnsPublisher = createPublisher();
|
|
33
|
+
var columnWidths = new Map();
|
|
34
|
+
var columnWidthsPublisher = createPublisher();
|
|
35
|
+
var registerColumn = function registerColumn(id, data) {
|
|
36
|
+
var _data$currentWidth;
|
|
37
|
+
if (columns.has(id)) {
|
|
38
|
+
throw new Error("[EuiTableStore] Column '".concat(id, "' already registered"));
|
|
39
|
+
}
|
|
40
|
+
columns.set(id, data);
|
|
41
|
+
// Initialize column in the columnWidths map to keep both maps in sync
|
|
42
|
+
columnWidths.set(id, (_data$currentWidth = data.currentWidth) !== null && _data$currentWidth !== void 0 ? _data$currentWidth : 0);
|
|
43
|
+
columnsPublisher.notify(columns);
|
|
44
|
+
return function () {
|
|
45
|
+
columns.delete(id);
|
|
46
|
+
columnWidths.delete(id);
|
|
47
|
+
columnsPublisher.notify(columns);
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
var updateColumn = function updateColumn(id, data) {
|
|
51
|
+
var currentData = columns.get(id);
|
|
52
|
+
if (!currentData) {
|
|
53
|
+
throw new Error("[EuiTableStore] Column '".concat(id, "' not found"));
|
|
54
|
+
}
|
|
55
|
+
columns.set(id, data);
|
|
56
|
+
columnsPublisher.notify(columns);
|
|
57
|
+
};
|
|
58
|
+
var updateColumnWidth = function updateColumnWidth(id, width) {
|
|
59
|
+
var currentWidth = columnWidths.get(id);
|
|
60
|
+
if (currentWidth === undefined) {
|
|
61
|
+
throw new Error("[EuiTableStore] No width stored for column '".concat(id, "'"));
|
|
62
|
+
}
|
|
63
|
+
if (currentWidth === width) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
columnWidths.set(id, width);
|
|
67
|
+
columnWidthsPublisher.notify(columnWidths);
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
registerColumn: registerColumn,
|
|
71
|
+
updateColumn: updateColumn,
|
|
72
|
+
updateColumnWidth: updateColumnWidth,
|
|
73
|
+
subscribe: columnsPublisher.subscribe,
|
|
74
|
+
subscribeToColumnWidths: columnWidthsPublisher.subscribe,
|
|
75
|
+
getColumns: function getColumns() {
|
|
76
|
+
return columns;
|
|
77
|
+
},
|
|
78
|
+
getColumnWidths: function getColumnWidths() {
|
|
79
|
+
return columnWidths;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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 React, { useId, useRef } from 'react';
|
|
10
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
11
|
+
var useEuiTableStoreUniqueColumnIdFallback = function useEuiTableStoreUniqueColumnIdFallback() {
|
|
12
|
+
var ref = useRef(uuidv4());
|
|
13
|
+
return ref.current;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Returns a stable unique column ID to be used when registering columns.
|
|
18
|
+
* It uses `React.useId()` when available and falls back to UUID v4 on React 17.
|
|
19
|
+
*
|
|
20
|
+
* This is needed so that static `uuid` mocks don't break column registration
|
|
21
|
+
* (at least in React 18+; in older versions this function would need
|
|
22
|
+
* to be mocked to return something unique, but stable).
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export var useEuiTableStoreUniqueColumnId = 'useId' in React ? useId : useEuiTableStoreUniqueColumnIdFallback;
|
|
@@ -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", "className", "compressed", "tableLayout", "hasBackground", "responsiveBreakpoint", "scrollableInline", "stickyScrollbar"];
|
|
3
|
+
var _excluded = ["children", "className", "compressed", "tableLayout", "hasBackground", "responsiveBreakpoint", "scrollableInline", "stickyScrollbar", "stickyHeader"];
|
|
4
4
|
/*
|
|
5
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -19,6 +19,8 @@ import { usePropsWithComponentDefaults } from '../provider/component_defaults';
|
|
|
19
19
|
import { euiContainerCSS } from '../../global_styling';
|
|
20
20
|
import { EUI_TABLE_CSS_CONTAINER_NAME } from './const';
|
|
21
21
|
import { EuiTableStickyScrollbar } from './sticky_scrollbar';
|
|
22
|
+
import { EuiTableStickyHeader } from './sticky_header/sticky_header';
|
|
23
|
+
import { EuiTableStoreProvider } from './store/provider';
|
|
22
24
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
23
25
|
/**
|
|
24
26
|
* EuiTable is a low-level building block component used to render tabular data
|
|
@@ -44,20 +46,30 @@ export var EuiTable = function EuiTable(originalProps) {
|
|
|
44
46
|
scrollableInline = _usePropsWithComponen4 === void 0 ? false : _usePropsWithComponen4,
|
|
45
47
|
_usePropsWithComponen5 = _usePropsWithComponen.stickyScrollbar,
|
|
46
48
|
stickyScrollbar = _usePropsWithComponen5 === void 0 ? false : _usePropsWithComponen5,
|
|
49
|
+
_usePropsWithComponen6 = _usePropsWithComponen.stickyHeader,
|
|
50
|
+
stickyHeader = _usePropsWithComponen6 === void 0 ? false : _usePropsWithComponen6,
|
|
47
51
|
rest = _objectWithoutProperties(_usePropsWithComponen, _excluded);
|
|
48
52
|
var tableWrapperRef = useRef(null);
|
|
53
|
+
var tableRef = useRef(null);
|
|
49
54
|
var isResponsive = useIsEuiTableResponsive(responsiveBreakpoint);
|
|
50
55
|
var classes = classNames('euiTable', className);
|
|
51
56
|
var styles = useEuiMemoizedStyles(euiTableStyles);
|
|
52
57
|
var tableStyles = [styles.euiTable, scrollableInline && styles.euiTableScrollableInline, styles.layout[tableLayout], (!compressed || isResponsive) && styles.uncompressed, compressed && !isResponsive && styles.compressed, hasBackground && styles.hasBackground, isResponsive ? styles.mobile : styles.desktop];
|
|
53
58
|
var cssStyles = [euiContainerCSS('normal', EUI_TABLE_CSS_CONTAINER_NAME, true), scrollableInline && styles.scrollableWrapper];
|
|
54
|
-
return ___EmotionJSX(
|
|
59
|
+
return ___EmotionJSX(EuiTableStoreProvider, null, stickyHeader && ___EmotionJSX(EuiTableStickyHeader, {
|
|
60
|
+
scrollableInline: scrollableInline,
|
|
61
|
+
tableRef: tableRef,
|
|
62
|
+
tableWrapperRef: tableWrapperRef,
|
|
63
|
+
compressed: compressed,
|
|
64
|
+
isResponsive: isResponsive
|
|
65
|
+
}), ___EmotionJSX("div", {
|
|
55
66
|
css: cssStyles,
|
|
56
67
|
ref: tableWrapperRef
|
|
57
68
|
}, ___EmotionJSX("table", _extends({
|
|
58
69
|
tabIndex: -1,
|
|
59
70
|
css: tableStyles,
|
|
60
|
-
className: classes
|
|
71
|
+
className: classes,
|
|
72
|
+
ref: tableRef
|
|
61
73
|
}, rest), ___EmotionJSX(EuiTableIsResponsiveContext.Provider, {
|
|
62
74
|
value: isResponsive
|
|
63
75
|
}, ___EmotionJSX(EuiTableVariantContext.Provider, {
|
|
@@ -38,11 +38,11 @@ export var euiTableVariables = function euiTableVariables(_ref6) {
|
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
41
|
-
name: "
|
|
42
|
-
styles: "overflow-inline:auto;label:scrollableWrapper;"
|
|
41
|
+
name: "l8gzfy-scrollableWrapper",
|
|
42
|
+
styles: "overflow-inline:auto;overscroll-behavior-inline:none;label:scrollableWrapper;"
|
|
43
43
|
} : {
|
|
44
|
-
name: "
|
|
45
|
-
styles: "overflow-inline:auto;label:scrollableWrapper;",
|
|
44
|
+
name: "l8gzfy-scrollableWrapper",
|
|
45
|
+
styles: "overflow-inline:auto;overscroll-behavior-inline:none;label:scrollableWrapper;",
|
|
46
46
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
47
47
|
};
|
|
48
48
|
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
@@ -12,7 +12,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
12
12
|
* Side Public License, v 1.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import React from 'react';
|
|
15
|
+
import React, { useEffect, useCallback, useRef } from 'react';
|
|
16
16
|
import classNames from 'classnames';
|
|
17
17
|
import { useEuiMemoizedStyles, LEFT_ALIGNMENT } from '../../services';
|
|
18
18
|
import { EuiI18n } from '../i18n';
|
|
@@ -24,6 +24,9 @@ import { resolveWidthPropsAsStyle } from './utils';
|
|
|
24
24
|
import { useEuiTableIsResponsive } from './mobile/responsive_context';
|
|
25
25
|
import { EuiTableCellContent } from './_table_cell_content';
|
|
26
26
|
import { euiTableHeaderFooterCellStyles, _useEuiTableStickyCellStyles } from './table_cells_shared.styles';
|
|
27
|
+
import { useEuiTableColumnDataStore } from './store/provider';
|
|
28
|
+
import { useEuiTableWithinStickyHeader } from './sticky_header';
|
|
29
|
+
import { useEuiTableStoreUniqueColumnId } from './store/use_unique_column_id';
|
|
27
30
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
28
31
|
var CellContents = function CellContents(_ref) {
|
|
29
32
|
var className = _ref.className,
|
|
@@ -100,58 +103,122 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
|
100
103
|
append = _ref2.append,
|
|
101
104
|
sticky = _ref2.sticky,
|
|
102
105
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
106
|
+
var selfRef = useRef(null);
|
|
107
|
+
var storeCellId = useEuiTableStoreUniqueColumnId();
|
|
108
|
+
var store = useEuiTableColumnDataStore();
|
|
109
|
+
var isWithinStickyHeader = useEuiTableWithinStickyHeader();
|
|
103
110
|
var styles = useEuiMemoizedStyles(euiTableHeaderFooterCellStyles);
|
|
104
111
|
var stickyStyles = _useEuiTableStickyCellStyles(sticky);
|
|
105
112
|
var isResponsive = useEuiTableIsResponsive();
|
|
106
113
|
var hideForDesktop = !isResponsive && (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.only);
|
|
107
114
|
var hideForMobile = isResponsive && (mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.show) === false;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
var renderHeaderCellRef = useRef();
|
|
116
|
+
renderHeaderCellRef.current = function (extraProps) {
|
|
117
|
+
if (hideForDesktop || hideForMobile) return null;
|
|
118
|
+
var classes = classNames('euiTableHeaderCell', className);
|
|
119
|
+
var cssStyles = [styles.euiTableHeaderCell, !isResponsive && stickyStyles];
|
|
120
|
+
var inlineWidthStyles = resolveWidthPropsAsStyle(_style, {
|
|
121
|
+
width: width,
|
|
122
|
+
minWidth: minWidth,
|
|
123
|
+
maxWidth: maxWidth
|
|
124
|
+
});
|
|
125
|
+
var CellComponent = children ? 'th' : 'td';
|
|
126
|
+
var cellScope = CellComponent === 'th' ? scope !== null && scope !== void 0 ? scope : 'col' : undefined; // `scope` is only valid on `th` elements
|
|
118
127
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
var canSort = !!(onSort && !readOnly);
|
|
129
|
+
var ariaSortValue;
|
|
130
|
+
if (isSorted) {
|
|
131
|
+
ariaSortValue = isSortAscending ? 'ascending' : 'descending';
|
|
132
|
+
} else if (canSort) {
|
|
133
|
+
ariaSortValue = 'none';
|
|
134
|
+
}
|
|
135
|
+
var cellContentsProps = {
|
|
136
|
+
css: styles.euiTableHeaderCell__content,
|
|
137
|
+
align: align,
|
|
138
|
+
tooltipProps: tooltipProps,
|
|
139
|
+
description: description,
|
|
140
|
+
canSort: canSort,
|
|
141
|
+
isSorted: isSorted,
|
|
142
|
+
isSortAscending: isSortAscending,
|
|
143
|
+
children: children
|
|
144
|
+
};
|
|
145
|
+
return ___EmotionJSX(CellComponent, _extends({
|
|
146
|
+
css: cssStyles,
|
|
147
|
+
className: classes,
|
|
148
|
+
scope: cellScope,
|
|
149
|
+
role: "columnheader",
|
|
150
|
+
"aria-sort": ariaSortValue,
|
|
151
|
+
"data-sticky": !isResponsive && (sticky === null || sticky === void 0 ? void 0 : sticky.side) || undefined,
|
|
152
|
+
style: _objectSpread(_objectSpread({}, _style), inlineWidthStyles)
|
|
153
|
+
}, rest, extraProps), canSort ? ___EmotionJSX(EuiToolTip, _extends({
|
|
154
|
+
content: tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.content
|
|
155
|
+
}, tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.tooltipProps, {
|
|
156
|
+
display: "block"
|
|
157
|
+
}), ___EmotionJSX("button", {
|
|
158
|
+
type: "button",
|
|
159
|
+
css: styles.euiTableHeaderCell__button,
|
|
160
|
+
className: classNames('euiTableHeaderButton', {
|
|
161
|
+
'euiTableHeaderButton-isSorted': isSorted
|
|
162
|
+
}),
|
|
163
|
+
onClick: onSort,
|
|
164
|
+
"data-test-subj": "tableHeaderSortButton"
|
|
165
|
+
}, ___EmotionJSX(CellContents, cellContentsProps))) : ___EmotionJSX(CellContents, cellContentsProps), append);
|
|
135
166
|
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
167
|
+
var handleResize = useCallback(function (entries) {
|
|
168
|
+
var entry = entries[0];
|
|
169
|
+
if (!entry) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
store.updateColumnWidth(storeCellId, entry.contentRect.width);
|
|
173
|
+
}, [store, storeCellId]);
|
|
174
|
+
useEffect(function () {
|
|
175
|
+
// Don't register the column inside the sticky header as the original
|
|
176
|
+
// column is already registered. This would cause an infinite loop.
|
|
177
|
+
if (isWithinStickyHeader || !selfRef.current || !renderHeaderCellRef.current) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
var unregisterColumn = store.registerColumn(storeCellId, {
|
|
181
|
+
renderHeaderCellRef: renderHeaderCellRef,
|
|
182
|
+
// getBoundingClientRect is not the cheapest, but we call it only once
|
|
183
|
+
currentWidth: selfRef.current.getBoundingClientRect().width
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// ResizeObserver is available in all supported browsers,
|
|
187
|
+
// but jsdom and jest don't provide a polyfill for it.
|
|
188
|
+
var resizeObserver;
|
|
189
|
+
if (typeof window.ResizeObserver !== 'undefined') {
|
|
190
|
+
resizeObserver = new ResizeObserver(handleResize);
|
|
191
|
+
|
|
192
|
+
// Note: This _could_ be optimized by using a single ResizeObserver
|
|
193
|
+
// for the whole EuiTable, but it would need to be changed back to this
|
|
194
|
+
// if/when we implement resizable columns
|
|
195
|
+
resizeObserver.observe(selfRef.current);
|
|
196
|
+
}
|
|
197
|
+
return function () {
|
|
198
|
+
var _resizeObserver;
|
|
199
|
+
unregisterColumn();
|
|
200
|
+
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 || _resizeObserver.disconnect();
|
|
201
|
+
};
|
|
202
|
+
}, [store, isWithinStickyHeader, handleResize, storeCellId]);
|
|
203
|
+
|
|
204
|
+
// Notify the store on every render so the sticky header stays in sync.
|
|
205
|
+
// React's reconciliation will efficiently handle any duplicate renders.
|
|
206
|
+
useEffect(function () {
|
|
207
|
+
// Don't update the store if the component is rendered within EuiTableStickyHeader
|
|
208
|
+
if (isWithinStickyHeader) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Don't update the store if the element doesn't exist. The render function
|
|
213
|
+
// in `renderHeaderCellRef` sometimes renders null - e.g., in mobile layout
|
|
214
|
+
if (!selfRef.current) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
store.updateColumn(storeCellId, {
|
|
218
|
+
renderHeaderCellRef: renderHeaderCellRef
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
return renderHeaderCellRef.current({
|
|
222
|
+
ref: selfRef
|
|
223
|
+
});
|
|
157
224
|
};
|
|
@@ -9,36 +9,69 @@ var _excluded = ["children", "className", "scope", "style", "width", "minWidth",
|
|
|
9
9
|
* Side Public License, v 1.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import React from 'react';
|
|
12
|
+
import React, { useEffect, useRef } from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import { useEuiMemoizedStyles } from '../../services';
|
|
15
15
|
import { resolveWidthPropsAsStyle } from './utils';
|
|
16
16
|
import { euiTableCellCheckboxStyles } from './table_cells_shared.styles';
|
|
17
|
+
import { useEuiTableColumnDataStore } from './store/provider';
|
|
18
|
+
import { useEuiTableWithinStickyHeader } from './sticky_header';
|
|
19
|
+
import { useEuiTableStoreUniqueColumnId } from './store/use_unique_column_id';
|
|
17
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
18
|
-
export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(
|
|
19
|
-
var children =
|
|
20
|
-
className =
|
|
21
|
-
|
|
22
|
-
scope =
|
|
23
|
-
_style =
|
|
24
|
-
width =
|
|
25
|
-
minWidth =
|
|
26
|
-
maxWidth =
|
|
27
|
-
append =
|
|
28
|
-
rest = _objectWithoutProperties(
|
|
29
|
-
var
|
|
21
|
+
export var EuiTableHeaderCellCheckbox = function EuiTableHeaderCellCheckbox(props) {
|
|
22
|
+
var children = props.children,
|
|
23
|
+
className = props.className,
|
|
24
|
+
_props$scope = props.scope,
|
|
25
|
+
scope = _props$scope === void 0 ? 'col' : _props$scope,
|
|
26
|
+
_style = props.style,
|
|
27
|
+
width = props.width,
|
|
28
|
+
minWidth = props.minWidth,
|
|
29
|
+
maxWidth = props.maxWidth,
|
|
30
|
+
append = props.append,
|
|
31
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
32
|
+
var storeCellId = useEuiTableStoreUniqueColumnId();
|
|
33
|
+
var store = useEuiTableColumnDataStore();
|
|
34
|
+
var isWithinStickyHeader = useEuiTableWithinStickyHeader();
|
|
30
35
|
var styles = useEuiMemoizedStyles(euiTableCellCheckboxStyles);
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
var renderHeaderCellRef = useRef();
|
|
37
|
+
renderHeaderCellRef.current = function (extraProps) {
|
|
38
|
+
var classes = classNames('euiTableHeaderCellCheckbox', className);
|
|
39
|
+
var style = resolveWidthPropsAsStyle(_style, {
|
|
40
|
+
width: width,
|
|
41
|
+
minWidth: minWidth,
|
|
42
|
+
maxWidth: maxWidth
|
|
43
|
+
});
|
|
44
|
+
return ___EmotionJSX("th", _extends({
|
|
45
|
+
css: styles.euiTableHeaderCellCheckbox,
|
|
46
|
+
className: classes,
|
|
47
|
+
scope: scope,
|
|
48
|
+
style: style
|
|
49
|
+
}, rest, extraProps), ___EmotionJSX("div", {
|
|
50
|
+
className: "euiTableCellContent"
|
|
51
|
+
}, children), append);
|
|
52
|
+
};
|
|
53
|
+
useEffect(function () {
|
|
54
|
+
// Don't register the column inside the sticky header as the original
|
|
55
|
+
// column is already registered. This would cause an infinite loop.
|
|
56
|
+
if (isWithinStickyHeader) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
var unregisterColumn = store.registerColumn(storeCellId, {
|
|
60
|
+
renderHeaderCellRef: renderHeaderCellRef
|
|
61
|
+
});
|
|
62
|
+
return function () {
|
|
63
|
+
unregisterColumn();
|
|
64
|
+
};
|
|
65
|
+
}, [store, isWithinStickyHeader, storeCellId]);
|
|
66
|
+
useEffect(function () {
|
|
67
|
+
// Notify the store on every render so the sticky header stays in sync.
|
|
68
|
+
// React's reconciliation will efficiently handle any duplicate renders.
|
|
69
|
+
if (isWithinStickyHeader) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
store.updateColumn(storeCellId, {
|
|
73
|
+
renderHeaderCellRef: renderHeaderCellRef
|
|
74
|
+
});
|
|
35
75
|
});
|
|
36
|
-
return
|
|
37
|
-
css: styles.euiTableHeaderCellCheckbox,
|
|
38
|
-
className: classes,
|
|
39
|
-
scope: scope,
|
|
40
|
-
style: style
|
|
41
|
-
}, rest), ___EmotionJSX("div", {
|
|
42
|
-
className: "euiTableCellContent"
|
|
43
|
-
}, children), append);
|
|
76
|
+
return renderHeaderCellRef.current({});
|
|
44
77
|
};
|
|
@@ -16,6 +16,7 @@ import React, { useState, useMemo, useCallback, useEffect } from 'react';
|
|
|
16
16
|
import classNames from 'classnames';
|
|
17
17
|
import { useCombinedRefs, useEuiMemoizedStyles } from '../../services';
|
|
18
18
|
import { EuiResizeObserver } from '../observer/resize_observer';
|
|
19
|
+
import { EuiToolTip } from '../tool_tip';
|
|
19
20
|
import { TruncationUtils } from './utils';
|
|
20
21
|
import { euiTextTruncateStyles } from './text_truncate.styles';
|
|
21
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -128,11 +129,10 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
128
129
|
}, [ready, width, text, truncation, truncationOffset, truncationPosition, ellipsis, containerEl]);
|
|
129
130
|
var isTruncating = truncatedText !== text;
|
|
130
131
|
var styles = useEuiMemoizedStyles(euiTextTruncateStyles);
|
|
131
|
-
|
|
132
|
+
var content = ___EmotionJSX("div", _extends({
|
|
132
133
|
className: classNames('euiTextTruncate', className),
|
|
133
134
|
css: styles.euiTextTruncate,
|
|
134
|
-
ref: refs
|
|
135
|
-
title: isTruncating ? text : undefined
|
|
135
|
+
ref: refs
|
|
136
136
|
}, rest), isTruncating ? ___EmotionJSX(React.Fragment, null, ___EmotionJSX("span", {
|
|
137
137
|
className: "euiTextTruncate__truncatedText",
|
|
138
138
|
css: styles.euiTextTruncate__truncatedText,
|
|
@@ -146,6 +146,11 @@ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
|
|
|
146
146
|
className: "euiTextTruncate__fullText",
|
|
147
147
|
"data-test-subj": "fullText"
|
|
148
148
|
}, children ? children(text) : text));
|
|
149
|
+
return isTruncating ? ___EmotionJSX(EuiToolTip, {
|
|
150
|
+
content: text,
|
|
151
|
+
disableScreenReaderOutput: true,
|
|
152
|
+
display: "block"
|
|
153
|
+
}, content) : content;
|
|
149
154
|
};
|
|
150
155
|
var EuiTextTruncateWithResizeObserver = function EuiTextTruncateWithResizeObserver(_ref3) {
|
|
151
156
|
var _onResize = _ref3.onResize,
|
|
@@ -23,7 +23,7 @@ import { EuiToolTipArrow } from './tool_tip_arrow';
|
|
|
23
23
|
import { toolTipManager } from './tool_tip_manager';
|
|
24
24
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
25
25
|
export var POSITIONS = ['top', 'right', 'bottom', 'left'];
|
|
26
|
-
var DISPLAYS = ['inlineBlock', 'block'];
|
|
26
|
+
var DISPLAYS = ['inlineBlock', 'block', 'flex'];
|
|
27
27
|
export var DEFAULT_TOOLTIP_OFFSET = 16;
|
|
28
28
|
|
|
29
29
|
/**
|
|
@@ -43,6 +43,14 @@ export var euiToolTipStyles = function euiToolTipStyles(euiThemeContext) {
|
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
46
|
+
name: "1cjglks-flex",
|
|
47
|
+
styles: "display:flex;label:flex;"
|
|
48
|
+
} : {
|
|
49
|
+
name: "1cjglks-flex",
|
|
50
|
+
styles: "display:flex;label:flex;",
|
|
51
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
52
|
+
};
|
|
53
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
46
54
|
name: "fzilnk-inlineBlock",
|
|
47
55
|
styles: "display:inline-block;label:inlineBlock;"
|
|
48
56
|
} : {
|
|
@@ -50,7 +58,7 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
50
58
|
styles: "display:inline-block;label:inlineBlock;",
|
|
51
59
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
52
60
|
};
|
|
53
|
-
var
|
|
61
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
54
62
|
name: "14aceuy-block",
|
|
55
63
|
styles: "display:block;label:block;"
|
|
56
64
|
} : {
|
|
@@ -58,7 +66,7 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
58
66
|
styles: "display:block;label:block;",
|
|
59
67
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
60
68
|
};
|
|
61
|
-
var
|
|
69
|
+
var _ref4 = process.env.NODE_ENV === "production" ? {
|
|
62
70
|
name: "1s3i3p5-euiToolTipAnchor",
|
|
63
71
|
styles: "*[disabled]{pointer-events:none;};label:euiToolTipAnchor;"
|
|
64
72
|
} : {
|
|
@@ -69,9 +77,10 @@ var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
|
69
77
|
export var euiToolTipAnchorStyles = function euiToolTipAnchorStyles() {
|
|
70
78
|
return {
|
|
71
79
|
// Elements
|
|
72
|
-
euiToolTipAnchor:
|
|
80
|
+
euiToolTipAnchor: _ref4,
|
|
73
81
|
// Variants
|
|
74
|
-
block:
|
|
75
|
-
inlineBlock:
|
|
82
|
+
block: _ref3,
|
|
83
|
+
inlineBlock: _ref2,
|
|
84
|
+
flex: _ref
|
|
76
85
|
};
|
|
77
86
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4
|
+
/*
|
|
5
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
7
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
8
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
9
|
+
* Side Public License, v 1.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export var createPublisher = function createPublisher() {
|
|
24
|
+
var subscribers = new Set();
|
|
25
|
+
var unsubscribe = function unsubscribe(subscriber) {
|
|
26
|
+
subscribers.delete(subscriber);
|
|
27
|
+
};
|
|
28
|
+
var subscribe = function subscribe(subscriber) {
|
|
29
|
+
subscribers.add(subscriber);
|
|
30
|
+
return function () {
|
|
31
|
+
return unsubscribe(subscriber);
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
var notify = function notify(subject) {
|
|
35
|
+
var _iterator = _createForOfIteratorHelper(subscribers),
|
|
36
|
+
_step;
|
|
37
|
+
try {
|
|
38
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
39
|
+
var _subscriber = _step.value;
|
|
40
|
+
_subscriber(subject);
|
|
41
|
+
}
|
|
42
|
+
} catch (err) {
|
|
43
|
+
_iterator.e(err);
|
|
44
|
+
} finally {
|
|
45
|
+
_iterator.f();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
subscribe: subscribe,
|
|
50
|
+
unsubscribe: unsubscribe,
|
|
51
|
+
notify: notify
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -16,6 +16,7 @@ var _contrast = require("../../services/color/contrast");
|
|
|
16
16
|
var _color = require("../../services/color");
|
|
17
17
|
var _services = require("../../services");
|
|
18
18
|
var _icon = require("../icon");
|
|
19
|
+
var _tool_tip = require("../tool_tip");
|
|
19
20
|
var _avatar = require("./avatar.styles");
|
|
20
21
|
var _react2 = require("@emotion/react");
|
|
21
22
|
var _excluded = ["className", "color", "imageUrl", "initials", "initialsLength", "iconType", "iconSize", "iconColor", "name", "size", "type", "isDisabled", "style"],
|
|
@@ -73,6 +74,7 @@ var EuiAvatar = exports.EuiAvatar = function EuiAvatar(_ref) {
|
|
|
73
74
|
var classes = (0, _classnames.default)('euiAvatar', (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "euiAvatar--".concat(size), size), "euiAvatar--".concat(type), type), 'euiAvatar-isDisabled', isDisabled), className);
|
|
74
75
|
var styles = (0, _services.useEuiMemoizedStyles)(_avatar.euiAvatarStyles);
|
|
75
76
|
var cssStyles = [styles.euiAvatar, styles[type], styles[size], styles[casing], isPlain && styles.plain, isSubdued && styles.subdued, isDisabled && styles.isDisabled];
|
|
77
|
+
var tooltipCssStyles = [styles.tooltip[type]];
|
|
76
78
|
var avatarStyle = (0, _react.useMemo)(function () {
|
|
77
79
|
if (imageUrl) {
|
|
78
80
|
return {
|
|
@@ -107,21 +109,31 @@ var EuiAvatar = exports.EuiAvatar = function EuiAvatar(_ref) {
|
|
|
107
109
|
// Fall back to the adjusted text color if it exists
|
|
108
110
|
return avatarStyle === null || avatarStyle === void 0 ? void 0 : avatarStyle.color;
|
|
109
111
|
}, [iconColor, avatarStyle === null || avatarStyle === void 0 ? void 0 : avatarStyle.color, isForcedColors, euiTheme]);
|
|
110
|
-
|
|
112
|
+
var avatarNode = (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
111
113
|
css: cssStyles,
|
|
112
114
|
className: classes,
|
|
113
115
|
style: _objectSpread(_objectSpread(_objectSpread({}, style), avatarStyle), highContrastBorder),
|
|
114
116
|
"aria-label": isDisabled ? undefined : name,
|
|
115
|
-
role: isDisabled ? 'presentation' : 'img'
|
|
116
|
-
title: name
|
|
117
|
+
role: isDisabled ? 'presentation' : 'img'
|
|
117
118
|
}, rest), !imageUrl && (iconType ? (0, _react2.jsx)(_icon.EuiIcon, {
|
|
118
119
|
className: "euiAvatar__icon",
|
|
119
120
|
size: iconSize || size,
|
|
120
121
|
type: iconType,
|
|
121
|
-
color: iconCustomColor
|
|
122
|
+
color: iconCustomColor,
|
|
123
|
+
"aria-hidden": true
|
|
122
124
|
}) : (0, _react2.jsx)("span", {
|
|
123
125
|
"aria-hidden": "true"
|
|
124
126
|
}, (0, _services.toInitials)(name, initialsLength, initials))));
|
|
127
|
+
|
|
128
|
+
// `EuiAvatar` is not interactive so we don't need to add a `tabIndex`.
|
|
129
|
+
// It already has `aria-label`, the tooltip is only visual.
|
|
130
|
+
return name ? (0, _react2.jsx)(_tool_tip.EuiToolTip, {
|
|
131
|
+
content: name,
|
|
132
|
+
anchorProps: {
|
|
133
|
+
css: tooltipCssStyles
|
|
134
|
+
},
|
|
135
|
+
disableScreenReaderOutput: true
|
|
136
|
+
}, avatarNode) : avatarNode;
|
|
125
137
|
};
|
|
126
138
|
|
|
127
139
|
// TODO: Migrate to a service
|