@elastic/eui 109.1.0 → 110.0.0-snapshot.1764684698664
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/basic_table/basic_table.js +4 -1
- package/es/components/basic_table/in_memory_table.js +86 -233
- package/es/components/breadcrumbs/_breadcrumb_content.js +3 -0
- package/es/components/breadcrumbs/breadcrumbs.js +3 -0
- package/es/components/button/button_group/button_group.styles.js +2 -2
- package/es/components/button/button_group/button_group_button.styles.js +1 -1
- package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +12 -2
- package/es/components/date_picker/super_date_picker/date_popover/relative_tab.js +5 -1
- package/es/components/date_picker/super_date_picker/date_popover/timezone_display.js +3 -1
- package/es/components/date_picker/super_date_picker/quick_select_popover/index.js +1 -0
- package/es/components/date_picker/super_date_picker/super_date_picker.js +35 -17
- package/es/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -3
- package/es/components/date_picker/super_date_picker/time_window_buttons.js +1 -1
- package/es/components/filter_group/filter_group.a11y.js +1 -1
- package/es/components/flex/flex_item.js +6 -4
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -0
- package/es/components/header/header_links/header_links.js +3 -0
- package/es/components/header/header_logo/header_logo.js +6 -1
- package/es/components/header/header_logo/header_logo.styles.js +1 -1
- package/es/components/icon/icon.styles.js +4 -4
- package/es/components/page/page.js +11 -3
- package/es/components/page/page.styles.js +1 -2
- package/es/components/page/page_header/page_header.js +11 -3
- package/es/components/page/page_header/page_header_content.js +3 -0
- package/es/components/page_template/outer/page_outer.js +2 -3
- package/es/components/page_template/outer/page_outer.styles.js +29 -35
- package/es/components/page_template/page_template.js +8 -2
- package/es/components/popover/input_popover.js +4 -1
- package/es/components/popover/popover.js +7 -4
- package/es/components/search_bar/search_bar.js +4 -4
- package/es/components/selectable/selectable.js +7 -2
- package/es/components/selectable/selectable_templates/selectable_template_sitewide_popover.js +1 -0
- package/es/components/table/_table_cell_content.styles.js +4 -4
- package/es/components/table/table.js +16 -3
- package/es/components/table/table.styles.js +2 -1
- package/es/components/table/table_cells_shared.styles.js +4 -1
- package/es/components/table/table_context.js +12 -0
- package/es/components/table/table_footer_cell.js +6 -2
- package/es/components/table/table_row.js +5 -2
- package/es/components/table/table_row.styles.js +22 -6
- package/es/components/table/table_row_cell.styles.js +3 -3
- package/es/components/tool_tip/tool_tip_anchor.js +8 -0
- package/es/components/tour/tour_step.js +9 -3
- package/es/global_styling/mixins/_button.js +4 -3
- package/es/global_styling/mixins/_typography.js +9 -0
- package/es/services/string/to_initials.js +26 -4
- package/eui.d.ts +75 -29
- package/lib/components/basic_table/basic_table.js +4 -1
- package/lib/components/basic_table/in_memory_table.js +85 -234
- package/lib/components/breadcrumbs/_breadcrumb_content.js +3 -0
- package/lib/components/button/button_group/button_group.styles.js +1 -1
- package/lib/components/button/button_group/button_group_button.styles.js +1 -1
- package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +12 -2
- package/lib/components/date_picker/super_date_picker/date_popover/relative_tab.js +5 -1
- package/lib/components/date_picker/super_date_picker/date_popover/timezone_display.js +3 -1
- package/lib/components/date_picker/super_date_picker/quick_select_popover/index.js +7 -0
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +34 -16
- package/lib/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -3
- package/lib/components/date_picker/super_date_picker/time_window_buttons.js +1 -1
- package/lib/components/filter_group/filter_group.a11y.js +1 -1
- package/lib/components/flex/flex_item.js +6 -4
- package/lib/components/header/header_logo/header_logo.js +6 -1
- package/lib/components/header/header_logo/header_logo.styles.js +1 -1
- package/lib/components/icon/icon.styles.js +4 -4
- package/lib/components/page/page.js +10 -2
- package/lib/components/page/page.styles.js +1 -2
- package/lib/components/page/page_header/page_header.js +10 -2
- package/lib/components/page_template/outer/page_outer.js +1 -2
- package/lib/components/page_template/outer/page_outer.styles.js +29 -35
- package/lib/components/page_template/page_template.js +8 -2
- package/lib/components/popover/input_popover.js +4 -1
- package/lib/components/popover/popover.js +7 -4
- package/lib/components/search_bar/search_bar.js +4 -4
- package/lib/components/selectable/selectable.js +7 -2
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide_popover.js +1 -0
- package/lib/components/table/_table_cell_content.styles.js +4 -4
- package/lib/components/table/table.js +16 -3
- package/lib/components/table/table.styles.js +2 -1
- package/lib/components/table/table_cells_shared.styles.js +4 -1
- package/lib/components/table/table_context.js +18 -0
- package/lib/components/table/table_footer_cell.js +9 -2
- package/lib/components/table/table_row.js +8 -2
- package/lib/components/table/table_row.styles.js +20 -4
- package/lib/components/table/table_row_cell.styles.js +3 -3
- package/lib/components/tool_tip/tool_tip_anchor.js +8 -0
- package/lib/components/tour/tour_step.js +6 -3
- package/lib/global_styling/mixins/_button.js +4 -3
- package/lib/global_styling/mixins/_typography.js +10 -1
- package/lib/services/string/to_initials.js +26 -4
- package/optimize/es/components/basic_table/basic_table.js +4 -1
- package/optimize/es/components/basic_table/in_memory_table.js +73 -46
- package/optimize/es/components/button/button_group/button_group.styles.js +2 -2
- package/optimize/es/components/button/button_group/button_group_button.styles.js +1 -1
- package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +12 -2
- package/optimize/es/components/date_picker/super_date_picker/date_popover/relative_tab.js +5 -1
- package/optimize/es/components/date_picker/super_date_picker/date_popover/timezone_display.js +3 -1
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/index.js +1 -0
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +35 -17
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -3
- package/optimize/es/components/date_picker/super_date_picker/time_window_buttons.js +1 -1
- package/optimize/es/components/filter_group/filter_group.a11y.js +1 -1
- package/optimize/es/components/flex/flex_item.js +6 -4
- package/optimize/es/components/header/header_logo/header_logo.js +6 -1
- package/optimize/es/components/header/header_logo/header_logo.styles.js +1 -1
- package/optimize/es/components/icon/icon.styles.js +4 -4
- package/optimize/es/components/page/page.js +6 -3
- package/optimize/es/components/page/page.styles.js +1 -2
- package/optimize/es/components/page/page_header/page_header.js +6 -3
- package/optimize/es/components/page_template/outer/page_outer.js +2 -3
- package/optimize/es/components/page_template/outer/page_outer.styles.js +29 -35
- package/optimize/es/components/page_template/page_template.js +2 -1
- package/optimize/es/components/popover/input_popover.js +4 -1
- package/optimize/es/components/popover/popover.js +4 -4
- package/optimize/es/components/selectable/selectable.js +7 -2
- package/optimize/es/components/selectable/selectable_templates/selectable_template_sitewide_popover.js +1 -0
- package/optimize/es/components/table/_table_cell_content.styles.js +4 -4
- package/optimize/es/components/table/table.js +10 -3
- package/optimize/es/components/table/table.styles.js +2 -1
- package/optimize/es/components/table/table_cells_shared.styles.js +4 -1
- package/optimize/es/components/table/table_context.js +12 -0
- package/optimize/es/components/table/table_footer_cell.js +6 -2
- package/optimize/es/components/table/table_row.js +5 -2
- package/optimize/es/components/table/table_row.styles.js +22 -6
- package/optimize/es/components/table/table_row_cell.styles.js +3 -3
- package/optimize/es/components/tool_tip/tool_tip_anchor.js +8 -0
- package/optimize/es/components/tour/tour_step.js +4 -2
- package/optimize/es/global_styling/mixins/_button.js +4 -3
- package/optimize/es/global_styling/mixins/_typography.js +9 -0
- package/optimize/es/services/string/to_initials.js +26 -4
- package/optimize/lib/components/basic_table/basic_table.js +4 -1
- package/optimize/lib/components/basic_table/in_memory_table.js +72 -47
- package/optimize/lib/components/button/button_group/button_group.styles.js +1 -1
- package/optimize/lib/components/button/button_group/button_group_button.styles.js +1 -1
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +12 -2
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/relative_tab.js +5 -1
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/timezone_display.js +3 -1
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/index.js +7 -0
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +34 -16
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -3
- package/optimize/lib/components/date_picker/super_date_picker/time_window_buttons.js +1 -1
- package/optimize/lib/components/filter_group/filter_group.a11y.js +1 -1
- package/optimize/lib/components/flex/flex_item.js +6 -4
- package/optimize/lib/components/header/header_logo/header_logo.js +6 -1
- package/optimize/lib/components/header/header_logo/header_logo.styles.js +1 -1
- package/optimize/lib/components/icon/icon.styles.js +4 -4
- package/optimize/lib/components/page/page.js +5 -2
- package/optimize/lib/components/page/page.styles.js +1 -2
- package/optimize/lib/components/page/page_header/page_header.js +5 -2
- package/optimize/lib/components/page_template/outer/page_outer.js +1 -2
- package/optimize/lib/components/page_template/outer/page_outer.styles.js +29 -35
- package/optimize/lib/components/page_template/page_template.js +2 -1
- package/optimize/lib/components/popover/input_popover.js +4 -1
- package/optimize/lib/components/popover/popover.js +4 -4
- package/optimize/lib/components/selectable/selectable.js +7 -2
- package/optimize/lib/components/selectable/selectable_templates/selectable_template_sitewide_popover.js +1 -0
- package/optimize/lib/components/table/_table_cell_content.styles.js +4 -4
- package/optimize/lib/components/table/table.js +10 -3
- package/optimize/lib/components/table/table.styles.js +2 -1
- package/optimize/lib/components/table/table_cells_shared.styles.js +4 -1
- package/optimize/lib/components/table/table_context.js +18 -0
- package/optimize/lib/components/table/table_footer_cell.js +9 -2
- package/optimize/lib/components/table/table_row.js +8 -2
- package/optimize/lib/components/table/table_row.styles.js +20 -4
- package/optimize/lib/components/table/table_row_cell.styles.js +3 -3
- package/optimize/lib/components/tool_tip/tool_tip_anchor.js +8 -0
- package/optimize/lib/components/tour/tour_step.js +4 -2
- package/optimize/lib/global_styling/mixins/_button.js +4 -3
- package/optimize/lib/global_styling/mixins/_typography.js +10 -1
- package/optimize/lib/services/string/to_initials.js +26 -4
- package/package.json +6 -5
- package/test-env/components/basic_table/basic_table.js +4 -1
- package/test-env/components/basic_table/in_memory_table.js +85 -234
- package/test-env/components/breadcrumbs/_breadcrumb_content.js +3 -0
- package/test-env/components/button/button_group/button_group.styles.js +1 -1
- package/test-env/components/button/button_group/button_group_button.styles.js +1 -1
- package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +12 -2
- package/test-env/components/date_picker/super_date_picker/date_popover/relative_tab.js +5 -1
- package/test-env/components/date_picker/super_date_picker/date_popover/timezone_display.js +3 -1
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/index.js +7 -0
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +34 -16
- package/test-env/components/date_picker/super_date_picker/super_date_picker.styles.js +1 -3
- package/test-env/components/date_picker/super_date_picker/time_window_buttons.js +1 -1
- package/test-env/components/filter_group/filter_group.a11y.js +1 -1
- package/test-env/components/flex/flex_item.js +6 -4
- package/test-env/components/header/header_logo/header_logo.js +6 -1
- package/test-env/components/header/header_logo/header_logo.styles.js +1 -1
- package/test-env/components/icon/icon.styles.js +4 -4
- package/test-env/components/page/page.js +10 -2
- package/test-env/components/page/page.styles.js +1 -2
- package/test-env/components/page/page_header/page_header.js +10 -2
- package/test-env/components/page_template/outer/page_outer.js +1 -2
- package/test-env/components/page_template/outer/page_outer.styles.js +29 -35
- package/test-env/components/page_template/page_template.js +8 -2
- package/test-env/components/popover/input_popover.js +4 -1
- package/test-env/components/popover/popover.js +7 -4
- package/test-env/components/search_bar/search_bar.js +4 -4
- package/test-env/components/selectable/selectable.js +7 -2
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide_popover.js +1 -0
- package/test-env/components/table/_table_cell_content.styles.js +4 -4
- package/test-env/components/table/table.js +16 -3
- package/test-env/components/table/table.styles.js +2 -1
- package/test-env/components/table/table_cells_shared.styles.js +4 -1
- package/test-env/components/table/table_context.js +18 -0
- package/test-env/components/table/table_footer_cell.js +9 -2
- package/test-env/components/table/table_row.js +8 -2
- package/test-env/components/table/table_row.styles.js +20 -4
- package/test-env/components/table/table_row_cell.styles.js +3 -3
- package/test-env/components/tool_tip/tool_tip_anchor.js +8 -0
- package/test-env/components/tour/tour_step.js +6 -3
- package/test-env/global_styling/mixins/_button.js +4 -3
- package/test-env/global_styling/mixins/_typography.js +10 -1
- package/test-env/services/string/to_initials.js +26 -4
|
@@ -10,11 +10,11 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { euiTextTruncate, euiTextBreakWord, logicalTextAlignCSS } from '../../global_styling';
|
|
12
12
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
13
|
-
name: "
|
|
14
|
-
styles: "flex-direction:column;
|
|
13
|
+
name: "7d9p9x-mobile",
|
|
14
|
+
styles: "flex-direction:column;label:mobile;"
|
|
15
15
|
} : {
|
|
16
|
-
name: "
|
|
17
|
-
styles: "flex-direction:column;
|
|
16
|
+
name: "7d9p9x-mobile",
|
|
17
|
+
styles: "flex-direction:column;label:mobile;",
|
|
18
18
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
19
19
|
};
|
|
20
20
|
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["children", "className", "compressed", "tableLayout", "responsiveBreakpoint"];
|
|
1
|
+
var _excluded = ["children", "className", "compressed", "tableLayout", "hasBackground", "responsiveBreakpoint"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
@@ -15,6 +15,7 @@ import PropTypes from "prop-types";
|
|
|
15
15
|
import classNames from 'classnames';
|
|
16
16
|
import { useEuiMemoizedStyles } from '../../services';
|
|
17
17
|
import { useIsEuiTableResponsive, EuiTableIsResponsiveContext } from './mobile/responsive_context';
|
|
18
|
+
import { EuiTableVariantContext } from './table_context';
|
|
18
19
|
import { euiTableStyles } from './table.styles';
|
|
19
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
21
|
export var EuiTable = function EuiTable(_ref) {
|
|
@@ -23,19 +24,25 @@ export var EuiTable = function EuiTable(_ref) {
|
|
|
23
24
|
compressed = _ref.compressed,
|
|
24
25
|
_ref$tableLayout = _ref.tableLayout,
|
|
25
26
|
tableLayout = _ref$tableLayout === void 0 ? 'fixed' : _ref$tableLayout,
|
|
27
|
+
_ref$hasBackground = _ref.hasBackground,
|
|
28
|
+
hasBackground = _ref$hasBackground === void 0 ? true : _ref$hasBackground,
|
|
26
29
|
responsiveBreakpoint = _ref.responsiveBreakpoint,
|
|
27
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
31
|
var isResponsive = useIsEuiTableResponsive(responsiveBreakpoint);
|
|
29
32
|
var classes = classNames('euiTable', className);
|
|
30
33
|
var styles = useEuiMemoizedStyles(euiTableStyles);
|
|
31
|
-
var cssStyles = [styles.euiTable, styles.layout[tableLayout], (!compressed || isResponsive) && styles.uncompressed, compressed && !isResponsive && styles.compressed, isResponsive ? styles.mobile : styles.desktop];
|
|
34
|
+
var cssStyles = [styles.euiTable, styles.layout[tableLayout], (!compressed || isResponsive) && styles.uncompressed, compressed && !isResponsive && styles.compressed, hasBackground && styles.hasBackground, isResponsive ? styles.mobile : styles.desktop];
|
|
32
35
|
return ___EmotionJSX("table", _extends({
|
|
33
36
|
tabIndex: -1,
|
|
34
37
|
css: cssStyles,
|
|
35
38
|
className: classes
|
|
36
39
|
}, rest), ___EmotionJSX(EuiTableIsResponsiveContext.Provider, {
|
|
37
40
|
value: isResponsive
|
|
38
|
-
},
|
|
41
|
+
}, ___EmotionJSX(EuiTableVariantContext.Provider, {
|
|
42
|
+
value: {
|
|
43
|
+
hasBackground: hasBackground
|
|
44
|
+
}
|
|
45
|
+
}, children)));
|
|
39
46
|
};
|
|
40
47
|
EuiTable.propTypes = {
|
|
41
48
|
compressed: PropTypes.bool,
|
|
@@ -51,8 +58,14 @@ EuiTable.propTypes = {
|
|
|
51
58
|
responsiveBreakpoint: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.bool.isRequired]),
|
|
52
59
|
/**
|
|
53
60
|
* Sets the table-layout CSS property
|
|
61
|
+
* @default 'fixed'
|
|
54
62
|
*/
|
|
55
63
|
tableLayout: PropTypes.oneOf(["fixed", "auto"]),
|
|
64
|
+
/**
|
|
65
|
+
* Toggle the table's background
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
hasBackground: PropTypes.bool,
|
|
56
69
|
className: PropTypes.string,
|
|
57
70
|
"aria-label": PropTypes.string,
|
|
58
71
|
"data-test-subj": PropTypes.string,
|
|
@@ -67,11 +67,12 @@ export var euiTableStyles = function euiTableStyles(euiThemeContext) {
|
|
|
67
67
|
cellContentPadding = _euiTableVariables.cellContentPadding,
|
|
68
68
|
compressedCellContentPadding = _euiTableVariables.compressedCellContentPadding;
|
|
69
69
|
return {
|
|
70
|
-
euiTable: /*#__PURE__*/css(euiNumberFormat(euiThemeContext), " ", logicalCSS('width', '100%'), " border:none;border-collapse:collapse
|
|
70
|
+
euiTable: /*#__PURE__*/css(euiNumberFormat(euiThemeContext), " ", logicalCSS('width', '100%'), " border:none;border-collapse:collapse;;label:euiTable;"),
|
|
71
71
|
layout: {
|
|
72
72
|
fixed: _ref3,
|
|
73
73
|
auto: _ref2
|
|
74
74
|
},
|
|
75
|
+
hasBackground: /*#__PURE__*/css("background-color:", euiTheme.colors.backgroundBasePlain, ";;label:hasBackground;"),
|
|
75
76
|
/**
|
|
76
77
|
* 1. The padding on the `.euiTableCellContent` div allows the ellipsis to show if the
|
|
77
78
|
* content is truncated. If the padding was on the cell, the ellipsis would be cropped.
|
|
@@ -28,7 +28,10 @@ export var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellSty
|
|
|
28
28
|
euiTableHeaderCell: /*#__PURE__*/css(sharedStyles, ";;label:euiTableHeaderCell;"),
|
|
29
29
|
euiTableHeaderCell__content: /*#__PURE__*/css("gap:", euiTheme.size.xs, ";;label:euiTableHeaderCell__content;"),
|
|
30
30
|
euiTableHeaderCell__button: /*#__PURE__*/css(logicalCSS('width', '100%'), " font-weight:inherit;line-height:inherit;.euiTableSortIcon--sortable{color:", euiTheme.components.tableCellSortableIconColor, ";}&:hover,&:focus{color:", euiTheme.colors.textPrimary, ";text-decoration:underline;.euiTableSortIcon--sortable{color:", euiTheme.colors.textPrimary, ";}};label:euiTableHeaderCell__button;"),
|
|
31
|
-
euiTableFooterCell:
|
|
31
|
+
euiTableFooterCell: {
|
|
32
|
+
euiTableFooterCell: /*#__PURE__*/css(sharedStyles, ";;label:euiTableFooterCell;"),
|
|
33
|
+
hasBackground: /*#__PURE__*/css("background-color:", euiTheme.components.tableFooterBackground, ";;label:hasBackground;")
|
|
34
|
+
}
|
|
32
35
|
};
|
|
33
36
|
};
|
|
34
37
|
export var euiTableCellCheckboxStyles = function euiTableCellCheckboxStyles(euiThemeContext) {
|
|
@@ -0,0 +1,12 @@
|
|
|
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 { createContext } from 'react';
|
|
10
|
+
export var EuiTableVariantContext = /*#__PURE__*/createContext({
|
|
11
|
+
hasBackground: true
|
|
12
|
+
});
|
|
@@ -10,13 +10,14 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
10
|
* Side Public License, v 1.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import React from 'react';
|
|
13
|
+
import React, { useContext } from 'react';
|
|
14
14
|
import PropTypes from "prop-types";
|
|
15
15
|
import classNames from 'classnames';
|
|
16
16
|
import { useEuiMemoizedStyles, LEFT_ALIGNMENT } from '../../services';
|
|
17
17
|
import { resolveWidthAsStyle } from './utils';
|
|
18
18
|
import { EuiTableCellContent } from './_table_cell_content';
|
|
19
19
|
import { euiTableHeaderFooterCellStyles } from './table_cells_shared.styles';
|
|
20
|
+
import { EuiTableVariantContext } from './table_context';
|
|
20
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
21
22
|
export var EuiTableFooterCell = function EuiTableFooterCell(_ref) {
|
|
22
23
|
var children = _ref.children,
|
|
@@ -26,11 +27,14 @@ export var EuiTableFooterCell = function EuiTableFooterCell(_ref) {
|
|
|
26
27
|
width = _ref.width,
|
|
27
28
|
style = _ref.style,
|
|
28
29
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
var _useContext = useContext(EuiTableVariantContext),
|
|
31
|
+
hasBackground = _useContext.hasBackground;
|
|
29
32
|
var classes = classNames('euiTableFooterCell', className);
|
|
30
33
|
var inlineStyles = resolveWidthAsStyle(style, width);
|
|
31
34
|
var styles = useEuiMemoizedStyles(euiTableHeaderFooterCellStyles);
|
|
35
|
+
var cssStyles = [styles.euiTableFooterCell.euiTableFooterCell, hasBackground && styles.euiTableFooterCell.hasBackground];
|
|
32
36
|
return ___EmotionJSX("td", _extends({
|
|
33
|
-
css:
|
|
37
|
+
css: cssStyles,
|
|
34
38
|
className: classes,
|
|
35
39
|
style: inlineStyles
|
|
36
40
|
}, rest), ___EmotionJSX(EuiTableCellContent, {
|
|
@@ -10,11 +10,12 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
10
|
* Side Public License, v 1.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import React from 'react';
|
|
13
|
+
import React, { useContext } from 'react';
|
|
14
14
|
import PropTypes from "prop-types";
|
|
15
15
|
import classNames from 'classnames';
|
|
16
16
|
import { keys, useEuiMemoizedStyles } from '../../services';
|
|
17
17
|
import { useEuiTableIsResponsive } from './mobile/responsive_context';
|
|
18
|
+
import { EuiTableVariantContext } from './table_context';
|
|
18
19
|
import { euiTableRowStyles } from './table_row.styles';
|
|
19
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
21
|
export var EuiTableRow = function EuiTableRow(_ref) {
|
|
@@ -29,8 +30,10 @@ export var EuiTableRow = function EuiTableRow(_ref) {
|
|
|
29
30
|
onClick = _ref.onClick,
|
|
30
31
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
32
|
var isResponsive = useEuiTableIsResponsive();
|
|
33
|
+
var _useContext = useContext(EuiTableVariantContext),
|
|
34
|
+
hasBackground = _useContext.hasBackground;
|
|
32
35
|
var styles = useEuiMemoizedStyles(euiTableRowStyles);
|
|
33
|
-
var cssStyles = isResponsive ? [styles.euiTableRow, styles.mobile.mobile, isSelected && styles.mobile.selected, isExpandedRow && styles.mobile.expanded, (hasActions === true || isExpandable || isExpandedRow) && styles.mobile.hasRightColumn, hasSelection && styles.mobile.hasLeftColumn] : [styles.euiTableRow, styles.desktop.desktop, onClick && styles.desktop.clickable, isSelected && styles.desktop.selected, isExpandedRow && styles.desktop.expanded, isExpandedRow && hasSelection && styles.desktop.checkboxOffset];
|
|
36
|
+
var cssStyles = isResponsive ? [styles.euiTableRow, styles.mobile.mobile, !hasBackground && styles.mobile.hasBorder, hasBackground && styles.mobile.hasBackground, isSelected && styles.mobile.selected, isExpandedRow && styles.mobile.expanded, (hasActions === true || isExpandable || isExpandedRow) && styles.mobile.hasRightColumn, hasSelection && styles.mobile.hasLeftColumn] : [styles.euiTableRow, styles.desktop.desktop, onClick && styles.desktop.clickable, isSelected && styles.desktop.selected, isExpandedRow && styles.desktop.expanded.expanded, isExpandedRow && hasBackground && styles.desktop.expanded.hasBackground, isExpandedRow && hasSelection && styles.desktop.checkboxOffset];
|
|
34
37
|
var classes = classNames('euiTableRow', className, {
|
|
35
38
|
'euiTableRow-isSelectable': isSelectable,
|
|
36
39
|
'euiTableRow-isSelected': isSelected,
|
|
@@ -9,8 +9,8 @@ function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.fre
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { css, keyframes } from '@emotion/react';
|
|
12
|
-
import { euiShadow } from '@elastic/eui-theme-common';
|
|
13
|
-
import { euiCanAnimate, logicalCSS, mathWithUnits } from '../../global_styling';
|
|
12
|
+
import { euiBorderStyles, euiShadow } from '@elastic/eui-theme-common';
|
|
13
|
+
import { euiCanAnimate, highContrastModeStyles, logicalCSS, mathWithUnits } from '../../global_styling';
|
|
14
14
|
import { cssSupportsHasWithNextSibling } from '../../global_styling/functions/supports';
|
|
15
15
|
import { euiTableVariables } from './table.styles';
|
|
16
16
|
export var euiTableRowStyles = function euiTableRowStyles(euiThemeContext) {
|
|
@@ -26,7 +26,11 @@ export var euiTableRowStyles = function euiTableRowStyles(euiThemeContext) {
|
|
|
26
26
|
euiTableRow: /*#__PURE__*/css(":where(&.euiTableRow--marked){background-color:", rowColors.marked.background, ";};label:euiTableRow;"),
|
|
27
27
|
desktop: {
|
|
28
28
|
desktop: /*#__PURE__*/css("&:hover{background-color:", rowColors.hover, ";}", markedStyles, ";;label:desktop;"),
|
|
29
|
-
expanded:
|
|
29
|
+
expanded: {
|
|
30
|
+
expanded: /*#__PURE__*/css(expandedAnimationCss, ";;label:expanded;"),
|
|
31
|
+
// skipping adding a css class as it's a default style when expanded
|
|
32
|
+
hasBackground: "\n background-color: ".concat(rowColors.hover, ";\n ")
|
|
33
|
+
},
|
|
30
34
|
clickable: /*#__PURE__*/css("&:hover{background-color:", rowColors.clickable.hover, ";cursor:pointer;}", markedStyles, " &:focus{background-color:", rowColors.clickable.focus, ";};label:clickable;"),
|
|
31
35
|
selected: /*#__PURE__*/css("&,&+.euiTableRow-isExpandedRow{background-color:", rowColors.selected.background, ";}&:hover,&:hover+.euiTableRow-isExpandedRow{background-color:", rowColors.selected.hover, ";};label:selected;"),
|
|
32
36
|
// Offset expanded & selectable rows by the checkbox width to line up content with the 2nd column
|
|
@@ -34,9 +38,21 @@ export var euiTableRowStyles = function euiTableRowStyles(euiThemeContext) {
|
|
|
34
38
|
checkboxOffset: /*#__PURE__*/css("&>.euiTableRowCell:first-child{", logicalCSS('padding-left', checkboxSize), ";};label:checkboxOffset;")
|
|
35
39
|
},
|
|
36
40
|
mobile: {
|
|
37
|
-
mobile: /*#__PURE__*/css("position:relative;display:flex;flex-wrap:wrap;padding:", cellContentPadding, ";", logicalCSS('margin-bottom', cellContentPadding),
|
|
41
|
+
mobile: /*#__PURE__*/css("position:relative;display:flex;flex-wrap:wrap;padding:", cellContentPadding, ";", logicalCSS('margin-bottom', cellContentPadding), " border-radius:", euiTheme.border.radius.medium, ";", cssSupportsHasWithNextSibling("\n &:has(+ .euiTableRow-isExpandedRow) {\n ".concat(logicalCSS('border-bottom-left-radius', 0), "\n ").concat(logicalCSS('border-bottom-right-radius', 0), "\n }\n ")), ";;label:mobile;"),
|
|
42
|
+
/* Omitting adding a class via css here as it's a default style on mobile, not a standalone prop-related style.
|
|
43
|
+
Adding it separate allows better appliance control via props without the need to override the styles. */
|
|
44
|
+
hasBorder: "\n ".concat(highContrastModeStyles(euiThemeContext, {
|
|
45
|
+
// uses pseudo-border to align dimensions with shadows applied by `hasBackground`
|
|
46
|
+
none: "\n ".concat(euiBorderStyles(euiThemeContext, {
|
|
47
|
+
side: 'all'
|
|
48
|
+
}), "\n transform: translateZ(0);\n "),
|
|
49
|
+
preferred: "\n border: ".concat(euiTheme.border.thin, "\n ")
|
|
50
|
+
}), "\n "),
|
|
51
|
+
hasBackground: /*#__PURE__*/css(euiShadow(euiThemeContext, 's', {
|
|
38
52
|
borderAllInHighContrastMode: true
|
|
39
|
-
}), " background-color:", euiTheme.colors.backgroundBasePlain, ";
|
|
53
|
+
}), " background-color:", euiTheme.colors.backgroundBasePlain, ";", highContrastModeStyles(euiThemeContext, {
|
|
54
|
+
none: "\n border: none;\n "
|
|
55
|
+
}), ";;label:hasBackground;"),
|
|
40
56
|
selected: /*#__PURE__*/css("&,&+.euiTableRow-isExpandedRow{background-color:", rowColors.selected.background, ";};label:selected;"),
|
|
41
57
|
/**
|
|
42
58
|
* Left column offset (no border)
|
|
@@ -55,7 +71,7 @@ export var euiTableRowStyles = function euiTableRowStyles(euiThemeContext) {
|
|
|
55
71
|
// On mobile, visually move the expanded row to join up with the
|
|
56
72
|
// preceding table row via negative margins
|
|
57
73
|
'margin-top', mathWithUnits([cellContentPadding, euiTheme.border.width.thin], function (x, y) {
|
|
58
|
-
return (x + y
|
|
74
|
+
return (x + y) * -1;
|
|
59
75
|
})), logicalCSS('padding-left', cellContentPadding), " ", logicalCSS('border-top', euiTheme.border.thin), " ", logicalCSS('border-top-left-radius', 0), " ", logicalCSS('border-top-right-radius', 0), " &:after{", logicalCSS('border-top', 'none'), ";}clip-path:polygon(-50% 0, 150% 0, 150% 150%, -50% 150%);>.euiTableRowCell{", logicalCSS('width', '100%'), ";}", expandedAnimationCss, ";;label:expanded;")
|
|
60
76
|
}
|
|
61
77
|
};
|
|
@@ -70,10 +70,10 @@ export var euiTableRowCellStyles = function euiTableRowCellStyles(euiThemeContex
|
|
|
70
70
|
rightColumnContent: "\n position: absolute;\n ".concat(logicalCSS('right', 0), "\n ").concat(logicalCSS('min-width', '0'), "\n ").concat(logicalCSS('width', mobileSizes.actions.width), "\n "),
|
|
71
71
|
get actions() {
|
|
72
72
|
// Note: Visible-on-hover actions on desktop always show on mobile
|
|
73
|
-
return /*#__PURE__*/css(this.rightColumnContent, " ", logicalCSS('top', mobileSizes.actions.offset), "
|
|
73
|
+
return /*#__PURE__*/css(this.rightColumnContent, " ", logicalCSS('top', mobileSizes.actions.offset), ".euiTableCellContent{padding:0;};label:actions;");
|
|
74
74
|
},
|
|
75
75
|
get expander() {
|
|
76
|
-
return /*#__PURE__*/css(this.rightColumnContent, "
|
|
76
|
+
return /*#__PURE__*/css(this.rightColumnContent, ";;label:expander;");
|
|
77
77
|
},
|
|
78
78
|
/**
|
|
79
79
|
* Custom actions may not be icons and therefore may not fit in a column
|
|
@@ -84,6 +84,6 @@ export var euiTableRowCellStyles = function euiTableRowCellStyles(euiThemeContex
|
|
|
84
84
|
},
|
|
85
85
|
euiTableRowCell__mobileHeader: /*#__PURE__*/css(euiTextTruncate(), " font-size:", euiFontSize(euiThemeContext, 's', {
|
|
86
86
|
customScale: 'xxs'
|
|
87
|
-
}).fontSize, ";display:block;color:", euiTheme.colors.
|
|
87
|
+
}).fontSize, ";display:block;color:", euiTheme.colors.textSubdued, ";padding:", euiTheme.size.s, ";padding-block-end:0;margin-block-end:-", euiTheme.size.s, ";.euiTableRowCell:not(:only-child) &{", logicalCSS('min-height', euiTheme.size.l), ";};label:euiTableRowCell__mobileHeader;")
|
|
88
88
|
};
|
|
89
89
|
};
|
|
@@ -13,6 +13,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
13
13
|
import React, { cloneElement, forwardRef } from 'react';
|
|
14
14
|
import PropTypes from "prop-types";
|
|
15
15
|
import classNames from 'classnames';
|
|
16
|
+
import { useGeneratedHtmlId } from '../../services';
|
|
16
17
|
import { euiToolTipAnchorStyles } from './tool_tip.styles';
|
|
17
18
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
18
19
|
export var EuiToolTipAnchor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
@@ -29,11 +30,18 @@ export var EuiToolTipAnchor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
29
30
|
var anchorCss = euiToolTipAnchorStyles();
|
|
30
31
|
var cssStyles = [anchorCss.euiToolTipAnchor, anchorCss[display]];
|
|
31
32
|
var classes = classNames('euiToolTipAnchor', className);
|
|
33
|
+
var anchorId = useGeneratedHtmlId({
|
|
34
|
+
suffix: 'euiToolTipAnchor',
|
|
35
|
+
conditionalId: id ? "".concat(id, "-wrapper") : undefined
|
|
36
|
+
});
|
|
32
37
|
return (
|
|
33
38
|
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
34
39
|
___EmotionJSX("span", _extends({
|
|
35
40
|
ref: ref,
|
|
36
41
|
css: cssStyles
|
|
42
|
+
/* A11y: NVDA combines elements with identical markup into a single navigational stop. ¯\_(ツ)_/¯
|
|
43
|
+
The `id` ensures the wrappers are unique and navigated as standalone elements. (data- attributes don't work) */,
|
|
44
|
+
id: anchorId
|
|
37
45
|
}, rest, {
|
|
38
46
|
className: classes,
|
|
39
47
|
onMouseOver: onMouseOver,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["anchorPosition", "anchor", "children", "className", "css", "closePopover", "content", "isStepOpen", "minWidth", "maxWidth", "onFinish", "step", "stepsTotal", "subtitle", "title", "decoration", "footerAction", "panelProps", "panelClassName"];
|
|
2
|
+
var _excluded = ["anchorPosition", "anchor", "children", "className", "css", "closePopover", "content", "isStepOpen", "minWidth", "maxWidth", "onFinish", "step", "stepsTotal", "subtitle", "title", "decoration", "hasArrow", "footerAction", "panelProps", "panelClassName"];
|
|
3
3
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -57,6 +57,7 @@ export var EuiTourStep = function EuiTourStep(_ref) {
|
|
|
57
57
|
title = _ref.title,
|
|
58
58
|
_ref$decoration = _ref.decoration,
|
|
59
59
|
decoration = _ref$decoration === void 0 ? 'beacon' : _ref$decoration,
|
|
60
|
+
hasArrow = _ref.hasArrow,
|
|
60
61
|
footerAction = _ref.footerAction,
|
|
61
62
|
panelProps = _ref.panelProps,
|
|
62
63
|
panelClassName = _ref.panelClassName,
|
|
@@ -118,8 +119,9 @@ export var EuiTourStep = function EuiTourStep(_ref) {
|
|
|
118
119
|
panelProps: _objectSpread(_objectSpread({}, panelProps), {}, {
|
|
119
120
|
css: [tourStyles.euiTour, css, panelProps === null || panelProps === void 0 ? void 0 : panelProps.css]
|
|
120
121
|
}),
|
|
121
|
-
offset: hasBeacon ? 10 :
|
|
122
|
+
offset: hasBeacon && hasArrow !== false ? 10 : undefined,
|
|
122
123
|
"aria-labelledby": titleId,
|
|
124
|
+
hasArrow: hasArrow !== null && hasArrow !== void 0 ? hasArrow : hasBeacon,
|
|
123
125
|
arrowChildren: hasBeacon && ___EmotionJSX(EuiBeacon, {
|
|
124
126
|
css: beaconCss,
|
|
125
127
|
className: "euiTour__beacon"
|
|
@@ -150,6 +152,7 @@ EuiTourStep.propTypes = {
|
|
|
150
152
|
css: PropTypes.any,
|
|
151
153
|
/**
|
|
152
154
|
* Alignment of the popover and arrow relative to the button
|
|
155
|
+
* @default downLeft
|
|
153
156
|
*/
|
|
154
157
|
anchorPosition: PropTypes.any,
|
|
155
158
|
/**
|
|
@@ -171,6 +174,7 @@ EuiTourStep.propTypes = {
|
|
|
171
174
|
focusTrapProps: PropTypes.any,
|
|
172
175
|
/**
|
|
173
176
|
* Show arrow indicating to originating button
|
|
177
|
+
* @default false
|
|
174
178
|
*/
|
|
175
179
|
hasArrow: PropTypes.bool,
|
|
176
180
|
/**
|
|
@@ -263,6 +267,7 @@ EuiTourStep.propTypes = {
|
|
|
263
267
|
zIndex: PropTypes.number,
|
|
264
268
|
/**
|
|
265
269
|
* Distance away from the anchor that the popover will render
|
|
270
|
+
* @default 4 (0 when `hasArrow=true`)
|
|
266
271
|
*/
|
|
267
272
|
offset: PropTypes.number,
|
|
268
273
|
/**
|
|
@@ -327,7 +332,8 @@ EuiTourStep.propTypes = {
|
|
|
327
332
|
*/
|
|
328
333
|
title: PropTypes.node.isRequired,
|
|
329
334
|
/**
|
|
330
|
-
* Extra visual indication of step location
|
|
335
|
+
* Extra visual indication of step location.
|
|
336
|
+
* It does not apply when `hasArrow=false`
|
|
331
337
|
*/
|
|
332
338
|
decoration: PropTypes.oneOf(["none", "beacon"]),
|
|
333
339
|
/**
|
|
@@ -22,6 +22,7 @@ import { css } from '@emotion/react';
|
|
|
22
22
|
import { getTokenName, mathWithUnits } from '@elastic/eui-theme-common';
|
|
23
23
|
import { makeHighContrastColor, useEuiMemoizedStyles } from '../../services';
|
|
24
24
|
import { highContrastModeStyles, logicalCSS } from '../functions';
|
|
25
|
+
import { euiDisabledSelector } from '../utility/selectors';
|
|
25
26
|
|
|
26
27
|
/** Tentative usage; these exist only to be used as button directly when used within other components */
|
|
27
28
|
export var SEVERITY_COLORS = ['neutral', 'risk'];
|
|
@@ -212,11 +213,11 @@ var _interactionStyles = function _interactionStyles(euiThemeContext, buttonColo
|
|
|
212
213
|
var baseStyles = function baseStyles() {
|
|
213
214
|
// button hover is applied as pseudo element with a transparent background-color
|
|
214
215
|
if (type === 'overlay') {
|
|
215
|
-
return "\n position: relative;\n overflow: hidden;\n\n &:hover:not(
|
|
216
|
+
return "\n position: relative;\n overflow: hidden;\n\n &:hover:not(".concat(euiDisabledSelector, ") {\n &::before {\n content: '';\n position: absolute;\n /* should stay under the content */\n z-index: 0;\n inset: 0;\n background-color: ").concat(buttonColors.backgroundHover, ";\n pointer-events: none;\n }\n }\n\n &:active:not(").concat(euiDisabledSelector, ") {\n &::before {\n ").concat(logicalCSS('width', '100%'), "\n ").concat(logicalCSS('height', '100%'), "\n\n content: '';\n position: absolute;\n inset: 0;\n background-color: ").concat(buttonColors.backgroundActive, ";\n }\n }\n ");
|
|
216
217
|
}
|
|
217
218
|
|
|
218
219
|
// button hover is applied as opaque color
|
|
219
|
-
return "\n &:hover:not(
|
|
220
|
+
return "\n &:hover:not(".concat(euiDisabledSelector, ") {\n background-color: ").concat(buttonColors.backgroundHover, ";\n }\n\n &:active:not(").concat(euiDisabledSelector, ") {\n background-color: ").concat(buttonColors.backgroundActive, ";\n }\n ");
|
|
220
221
|
};
|
|
221
222
|
return " \n ".concat(highContrastModeStyles(euiThemeContext, {
|
|
222
223
|
none: baseStyles(),
|
|
@@ -229,7 +230,7 @@ var _interactionStyles = function _interactionStyles(euiThemeContext, buttonColo
|
|
|
229
230
|
*/
|
|
230
231
|
export var highContrastHoverIndicatorStyles = function highContrastHoverIndicatorStyles(_ref2) {
|
|
231
232
|
var euiTheme = _ref2.euiTheme;
|
|
232
|
-
return "\n &:hover:not(
|
|
233
|
+
return "\n &:hover:not(".concat(euiDisabledSelector, ") {\n transition: none;\n\n /* using pseudo border to be able to control the color */\n &::after {\n content: '';\n position: absolute;\n inset: ").concat(euiTheme.border.width.thin, ";\n border: ").concat(euiTheme.border.width.thick, " solid var(--highContrastHoverIndicatorColor, ").concat(euiTheme.border.color, ");\n border-radius: ").concat(mathWithUnits(euiTheme.border.radius.small, function (x) {
|
|
233
234
|
return x / 2;
|
|
234
235
|
}), ";\n background-color: transparent;\n pointer-events: none;\n }\n }\n");
|
|
235
236
|
};
|
|
@@ -12,6 +12,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
12
12
|
* Side Public License, v 1.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
+
import { css } from '@emotion/react';
|
|
15
16
|
import { euiLineHeightFromBaseline, euiFontSizeFromScale } from '../functions/typography';
|
|
16
17
|
import { useEuiMemoizedStyles, useEuiTheme } from '../../services/theme';
|
|
17
18
|
import { EuiThemeFontScales } from '../variables/typography';
|
|
@@ -56,6 +57,14 @@ export var euiTextTruncate = function euiTextTruncate() {
|
|
|
56
57
|
, "\n overflow: hidden !important;\n text-overflow: ellipsis !important;\n white-space: nowrap !important;\n");
|
|
57
58
|
};
|
|
58
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Emotion CSS wrapper around `euiTextTruncate` style.
|
|
62
|
+
*/
|
|
63
|
+
export var euiTextTruncateCSS = function euiTextTruncateCSS() {
|
|
64
|
+
var maxWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '100%';
|
|
65
|
+
return /*#__PURE__*/css(euiTextTruncate(maxWidth), ";;label:euiTextTruncateCSS;");
|
|
66
|
+
};
|
|
67
|
+
|
|
59
68
|
/**
|
|
60
69
|
* Fixed-width numbers for tabular data
|
|
61
70
|
*/
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
export var MAX_INITIALS = 2;
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* This function calculates the initials/acronym for a given name.
|
|
11
13
|
* It defaults to only 2 characters and will take the first character (of each word).
|
|
@@ -17,11 +19,20 @@
|
|
|
17
19
|
* @param {string} name The full name of the item to turn into initials
|
|
18
20
|
* @param {number} initialsLength (Optional) How many characters to show (max 2 allowed)
|
|
19
21
|
* @param {string} initials (Optional) Custom initials (max 2 characters)
|
|
20
|
-
* @returns {string} True if the color is dark, false otherwise.
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
|
-
export var MAX_INITIALS = 2;
|
|
24
23
|
export function toInitials(name, initialsLength, initials) {
|
|
24
|
+
// If `initials` provided, check if it's a single emoji
|
|
25
|
+
// in order to support complex, "multi-character" ones
|
|
26
|
+
if (initials && typeof Intl !== 'undefined' && 'Segmenter' in Intl) {
|
|
27
|
+
var segmenter = new Intl.Segmenter('en', {
|
|
28
|
+
granularity: 'grapheme'
|
|
29
|
+
});
|
|
30
|
+
var segments = Array.from(segmenter.segment(initials));
|
|
31
|
+
if (segments.length === 1 && isEmoji(segments[0].segment)) {
|
|
32
|
+
return segments[0].segment;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
25
36
|
// Calculate the number of initials to show, maxing out at MAX_INITIALS
|
|
26
37
|
var calculatedInitialsLength = initials ? initials.split('').length : name.split(' ').length;
|
|
27
38
|
calculatedInitialsLength = calculatedInitialsLength > MAX_INITIALS ? MAX_INITIALS : calculatedInitialsLength;
|
|
@@ -44,5 +55,16 @@ export function toInitials(name, initialsLength, initials) {
|
|
|
44
55
|
calculatedInitials = name.substring(0, calculatedInitialsLength);
|
|
45
56
|
}
|
|
46
57
|
}
|
|
47
|
-
return calculatedInitials;
|
|
58
|
+
return calculatedInitials || '';
|
|
59
|
+
}
|
|
60
|
+
function isEmoji(str) {
|
|
61
|
+
/**
|
|
62
|
+
* The \p escape sequence allows matching a character based on its Unicode properties
|
|
63
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Unicode_character_class_escape
|
|
64
|
+
* @see https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt
|
|
65
|
+
* @see https://www.unicode.org/reports/tr51/#Definitions
|
|
66
|
+
* @see https://util.unicode.org/UnicodeJsps/character.jsp?a=1F440&B1=Show
|
|
67
|
+
*/
|
|
68
|
+
var emojiRegex = /(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2605\u2607-\u2612\u2614-\u2685\u2690-\u2705\u2708-\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763-\u2767\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC00-\uDCFF\uDD0D-\uDD0F\uDD2F\uDD6C-\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDAD-\uDDFF\uDE01-\uDE0F\uDE1A\uDE2F\uDE32-\uDE3A\uDE3C-\uDE3F\uDE49-\uDFFF]|\uD83D[\uDC00-\uDD3D\uDD46-\uDE4F\uDE80-\uDEFF\uDF74-\uDF7F\uDFD5-\uDFFF]|\uD83E[\uDC0C-\uDC0F\uDC48-\uDC4F\uDC5A-\uDC5F\uDC88-\uDC8F\uDCAE-\uDCFF\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDEFF]|\uD83F[\uDC00-\uDFFD])/;
|
|
69
|
+
return emojiRegex.test(str);
|
|
48
70
|
}
|