@elastic/eui 94.0.0 → 94.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/basic_table/basic_table.js +6 -2
- package/es/components/basic_table/collapsed_item_actions.js +11 -20
- package/es/components/basic_table/default_item_action.js +9 -16
- package/es/components/basic_table/in_memory_table.js +6 -2
- package/es/components/table/table_cells_shared.styles.js +7 -2
- package/es/components/table/table_header_cell.js +31 -33
- package/eui.d.ts +5 -3
- package/i18ntokens.json +14 -14
- package/lib/components/basic_table/basic_table.js +6 -2
- package/lib/components/basic_table/collapsed_item_actions.js +11 -20
- package/lib/components/basic_table/default_item_action.js +12 -17
- package/lib/components/basic_table/in_memory_table.js +6 -2
- package/lib/components/table/table_cells_shared.styles.js +7 -2
- package/lib/components/table/table_header_cell.js +31 -33
- package/optimize/es/components/basic_table/collapsed_item_actions.js +11 -20
- package/optimize/es/components/basic_table/default_item_action.js +9 -16
- package/optimize/es/components/table/table_cells_shared.styles.js +7 -2
- package/optimize/es/components/table/table_header_cell.js +31 -33
- package/optimize/lib/components/basic_table/collapsed_item_actions.js +11 -20
- package/optimize/lib/components/basic_table/default_item_action.js +12 -17
- package/optimize/lib/components/table/table_cells_shared.styles.js +7 -2
- package/optimize/lib/components/table/table_header_cell.js +31 -33
- package/package.json +2 -2
- package/test-env/components/basic_table/basic_table.js +6 -2
- package/test-env/components/basic_table/collapsed_item_actions.js +11 -20
- package/test-env/components/basic_table/default_item_action.js +12 -17
- package/test-env/components/basic_table/in_memory_table.js +6 -2
- package/test-env/components/table/table_cells_shared.styles.js +7 -2
- package/test-env/components/table/table_header_cell.js +31 -33
- package/src/components/date_picker/react-datepicker/LICENSE +0 -21
- package/src/components/date_picker/react-datepicker/README.md +0 -168
- package/src/services/theme/README.md +0 -153
- package/src/test/README.md +0 -44
|
@@ -34,9 +34,9 @@ var CellContents = function CellContents(_ref) {
|
|
|
34
34
|
align = _ref.align,
|
|
35
35
|
description = _ref.description,
|
|
36
36
|
children = _ref.children,
|
|
37
|
+
canSort = _ref.canSort,
|
|
37
38
|
isSorted = _ref.isSorted,
|
|
38
|
-
isSortAscending = _ref.isSortAscending
|
|
39
|
-
showSortMsg = _ref.showSortMsg;
|
|
39
|
+
isSortAscending = _ref.isSortAscending;
|
|
40
40
|
return (0, _react2.jsx)(_table_cell_content.EuiTableCellContent, {
|
|
41
41
|
className: className,
|
|
42
42
|
align: align,
|
|
@@ -57,11 +57,16 @@ var CellContents = function CellContents(_ref) {
|
|
|
57
57
|
className: "eui-textTruncate"
|
|
58
58
|
}, children);
|
|
59
59
|
});
|
|
60
|
-
}), description && (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("span", null, description)),
|
|
60
|
+
}), description && (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("span", null, description)), isSorted ? (0, _react2.jsx)(_icon.EuiIcon, {
|
|
61
61
|
className: "euiTableSortIcon",
|
|
62
62
|
type: isSortAscending ? 'sortUp' : 'sortDown',
|
|
63
63
|
size: "m"
|
|
64
|
-
}))
|
|
64
|
+
}) : canSort ? (0, _react2.jsx)(_icon.EuiIcon, {
|
|
65
|
+
className: "euiTableSortIcon euiTableSortIcon--sortable",
|
|
66
|
+
type: "sortable",
|
|
67
|
+
size: "m",
|
|
68
|
+
color: "subdued" // Tinted a bit further via CSS
|
|
69
|
+
}) : null);
|
|
65
70
|
};
|
|
66
71
|
var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
67
72
|
var children = _ref2.children,
|
|
@@ -88,45 +93,38 @@ var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
|
88
93
|
var CellComponent = children ? 'th' : 'td';
|
|
89
94
|
var cellScope = CellComponent === 'th' ? scope !== null && scope !== void 0 ? scope : 'col' : undefined; // `scope` is only valid on `th` elements
|
|
90
95
|
|
|
91
|
-
var
|
|
96
|
+
var canSort = !!(onSort && !readOnly);
|
|
97
|
+
var ariaSortValue;
|
|
98
|
+
if (isSorted) {
|
|
99
|
+
ariaSortValue = isSortAscending ? 'ascending' : 'descending';
|
|
100
|
+
} else if (canSort) {
|
|
101
|
+
ariaSortValue = 'none';
|
|
102
|
+
}
|
|
103
|
+
var cellContentsProps = {
|
|
92
104
|
css: styles.euiTableHeaderCell__content,
|
|
93
105
|
align: align,
|
|
94
106
|
description: description,
|
|
95
|
-
|
|
107
|
+
canSort: canSort,
|
|
96
108
|
isSorted: isSorted,
|
|
97
|
-
isSortAscending: isSortAscending
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
var buttonClasses = (0, _classnames.default)('euiTableHeaderButton', {
|
|
101
|
-
'euiTableHeaderButton-isSorted': isSorted
|
|
102
|
-
});
|
|
103
|
-
var ariaSortValue = 'none';
|
|
104
|
-
if (isSorted) {
|
|
105
|
-
ariaSortValue = isSortAscending ? 'ascending' : 'descending';
|
|
106
|
-
}
|
|
107
|
-
return (0, _react2.jsx)(CellComponent, _extends({
|
|
108
|
-
css: styles.euiTableHeaderCell,
|
|
109
|
-
className: classes,
|
|
110
|
-
scope: cellScope,
|
|
111
|
-
role: "columnheader",
|
|
112
|
-
"aria-sort": ariaSortValue,
|
|
113
|
-
"aria-live": "polite",
|
|
114
|
-
style: inlineStyles
|
|
115
|
-
}, rest), onSort && !readOnly ? (0, _react2.jsx)("button", {
|
|
116
|
-
type: "button",
|
|
117
|
-
css: styles.euiTableHeaderCell__button,
|
|
118
|
-
className: buttonClasses,
|
|
119
|
-
onClick: onSort,
|
|
120
|
-
"data-test-subj": "tableHeaderSortButton"
|
|
121
|
-
}, cellContents) : cellContents);
|
|
122
|
-
}
|
|
109
|
+
isSortAscending: isSortAscending,
|
|
110
|
+
children: children
|
|
111
|
+
};
|
|
123
112
|
return (0, _react2.jsx)(CellComponent, _extends({
|
|
124
113
|
css: styles.euiTableHeaderCell,
|
|
125
114
|
className: classes,
|
|
126
115
|
scope: cellScope,
|
|
127
116
|
role: "columnheader",
|
|
117
|
+
"aria-sort": ariaSortValue,
|
|
128
118
|
style: inlineStyles
|
|
129
|
-
}, rest),
|
|
119
|
+
}, rest), canSort ? (0, _react2.jsx)("button", {
|
|
120
|
+
type: "button",
|
|
121
|
+
css: styles.euiTableHeaderCell__button,
|
|
122
|
+
className: (0, _classnames.default)('euiTableHeaderButton', {
|
|
123
|
+
'euiTableHeaderButton-isSorted': isSorted
|
|
124
|
+
}),
|
|
125
|
+
onClick: onSort,
|
|
126
|
+
"data-test-subj": "tableHeaderSortButton"
|
|
127
|
+
}, (0, _react2.jsx)(CellContents, cellContentsProps)) : (0, _react2.jsx)(CellContents, cellContentsProps));
|
|
130
128
|
};
|
|
131
129
|
exports.EuiTableHeaderCell = EuiTableHeaderCell;
|
|
132
130
|
EuiTableHeaderCell.propTypes = {
|
|
@@ -8,7 +8,6 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import React, { useState, useCallback, useMemo } from 'react';
|
|
11
|
-
import { isString } from '../../services/predicate';
|
|
12
11
|
import { EuiContextMenuItem, EuiContextMenuPanel } from '../context_menu';
|
|
13
12
|
import { EuiPopover } from '../popover';
|
|
14
13
|
import { EuiButtonIcon } from '../button';
|
|
@@ -26,9 +25,8 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
26
25
|
_useState2 = _slicedToArray(_useState, 2),
|
|
27
26
|
popoverOpen = _useState2[0],
|
|
28
27
|
setPopoverOpen = _useState2[1];
|
|
29
|
-
var
|
|
30
|
-
setPopoverOpen(false);
|
|
31
|
-
onClickAction === null || onClickAction === void 0 ? void 0 : onClickAction();
|
|
28
|
+
var closePopover = useCallback(function () {
|
|
29
|
+
return setPopoverOpen(false);
|
|
32
30
|
}, []);
|
|
33
31
|
var controls = useMemo(function () {
|
|
34
32
|
return actions.reduce(function (controls, action, index) {
|
|
@@ -47,16 +45,10 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
47
45
|
key: index,
|
|
48
46
|
className: "euiBasicTable__collapsedCustomAction"
|
|
49
47
|
}, ___EmotionJSX("span", {
|
|
50
|
-
onClick:
|
|
51
|
-
return onClickItem();
|
|
52
|
-
}
|
|
48
|
+
onClick: closePopover
|
|
53
49
|
}, actionControl)));
|
|
54
50
|
} else {
|
|
55
|
-
var
|
|
56
|
-
var icon;
|
|
57
|
-
if (buttonIcon) {
|
|
58
|
-
icon = isString(buttonIcon) ? buttonIcon : buttonIcon(item);
|
|
59
|
-
}
|
|
51
|
+
var icon = action.icon ? callWithItemIfFunction(item)(action.icon) : undefined;
|
|
60
52
|
var buttonContent = callWithItemIfFunction(item)(action.name);
|
|
61
53
|
var toolTipContent = callWithItemIfFunction(item)(action.description);
|
|
62
54
|
var href = callWithItemIfFunction(item)(action.href);
|
|
@@ -71,10 +63,11 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
71
63
|
target: target,
|
|
72
64
|
icon: icon,
|
|
73
65
|
"data-test-subj": dataTestSubj,
|
|
74
|
-
onClick: function onClick() {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
66
|
+
onClick: function onClick(event) {
|
|
67
|
+
event.persist();
|
|
68
|
+
_onClick === null || _onClick === void 0 ? void 0 : _onClick(item, event);
|
|
69
|
+
// Allow consumer events to prevent the popover from closing if necessary
|
|
70
|
+
if (!event.isPropagationStopped()) closePopover();
|
|
78
71
|
},
|
|
79
72
|
toolTipContent: toolTipContent,
|
|
80
73
|
toolTipProps: {
|
|
@@ -84,7 +77,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
84
77
|
}
|
|
85
78
|
return controls;
|
|
86
79
|
}, []);
|
|
87
|
-
}, [actions, actionsDisabled, item,
|
|
80
|
+
}, [actions, actionsDisabled, item, closePopover]);
|
|
88
81
|
var popoverButton = ___EmotionJSX(EuiI18n, {
|
|
89
82
|
tokens: ['euiCollapsedItemActions.allActions', 'euiCollapsedItemActions.allActionsDisabled'],
|
|
90
83
|
defaults: ['All actions', 'Individual item actions are disabled when rows are being selected.']
|
|
@@ -121,9 +114,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
121
114
|
id: "".concat(itemId, "-actions"),
|
|
122
115
|
isOpen: popoverOpen,
|
|
123
116
|
button: withTooltip || popoverButton,
|
|
124
|
-
closePopover:
|
|
125
|
-
return setPopoverOpen(false);
|
|
126
|
-
},
|
|
117
|
+
closePopover: closePopover,
|
|
127
118
|
panelPaddingSize: "none",
|
|
128
119
|
anchorPosition: "leftCenter"
|
|
129
120
|
}, ___EmotionJSX(EuiContextMenuPanel, {
|
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { isString } from '../../services/predicate';
|
|
9
|
+
import React, { useCallback } from 'react';
|
|
11
10
|
import { EuiButtonEmpty, EuiButtonIcon } from '../button';
|
|
12
11
|
import { EuiToolTip } from '../tool_tip';
|
|
13
12
|
import { useGeneratedHtmlId } from '../../services/accessibility';
|
|
@@ -22,26 +21,20 @@ export var DefaultItemAction = function DefaultItemAction(_ref) {
|
|
|
22
21
|
if (!action.onClick && !action.href) {
|
|
23
22
|
throw new Error("Cannot render item action [".concat(action.name, "]. Missing required 'onClick' callback\n or 'href' string. If you want to provide a custom action control, make sure to define the 'render' callback"));
|
|
24
23
|
}
|
|
25
|
-
var onClick =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
var buttonIcon = action.icon;
|
|
34
|
-
var icon;
|
|
35
|
-
if (buttonIcon) {
|
|
36
|
-
icon = isString(buttonIcon) ? buttonIcon : buttonIcon(item);
|
|
37
|
-
}
|
|
38
|
-
var button;
|
|
24
|
+
var onClick = useCallback(function (event) {
|
|
25
|
+
if (!action.onClick) return;
|
|
26
|
+
event.persist(); // TODO: Remove once React 16 support is dropped
|
|
27
|
+
action.onClick(item, event);
|
|
28
|
+
}, [action.onClick, item]);
|
|
29
|
+
var color = action.color ? callWithItemIfFunction(item)(action.color) : 'primary';
|
|
30
|
+
var icon = action.icon ? callWithItemIfFunction(item)(action.icon) : undefined;
|
|
39
31
|
var actionContent = callWithItemIfFunction(item)(action.name);
|
|
40
32
|
var tooltipContent = callWithItemIfFunction(item)(action.description);
|
|
41
33
|
var href = callWithItemIfFunction(item)(action.href);
|
|
42
34
|
var dataTestSubj = callWithItemIfFunction(item)(action['data-test-subj']);
|
|
43
35
|
var ariaLabelId = useGeneratedHtmlId();
|
|
44
36
|
var ariaLabelledBy;
|
|
37
|
+
var button;
|
|
45
38
|
if (action.type === 'icon') {
|
|
46
39
|
if (!icon) {
|
|
47
40
|
throw new Error("Cannot render item action [".concat(action.name, "]. It is configured to render as an icon but no\n icon is provided. Make sure to set the 'icon' property of the action"));
|
|
@@ -10,10 +10,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { css } from '@emotion/react';
|
|
13
|
+
import { makeHighContrastColor, tintOrShade } from '../../services';
|
|
13
14
|
import { euiFontSize, logicalCSS, logicalTextAlignCSS } from '../../global_styling';
|
|
14
15
|
import { euiTableVariables } from './table.styles';
|
|
15
16
|
export var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellStyles(euiThemeContext) {
|
|
16
|
-
var euiTheme = euiThemeContext.euiTheme
|
|
17
|
+
var euiTheme = euiThemeContext.euiTheme,
|
|
18
|
+
colorMode = euiThemeContext.colorMode;
|
|
17
19
|
|
|
18
20
|
// euiFontSize returns an object, so we keep object notation here to merge into css``
|
|
19
21
|
var sharedStyles = _objectSpread(_objectSpread({}, euiFontSize(euiThemeContext, 'xs')), {}, {
|
|
@@ -24,7 +26,10 @@ export var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellSty
|
|
|
24
26
|
return {
|
|
25
27
|
euiTableHeaderCell: /*#__PURE__*/css(sharedStyles, ";;label:euiTableHeaderCell;"),
|
|
26
28
|
euiTableHeaderCell__content: /*#__PURE__*/css("gap:", euiTheme.size.xs, ";;label:euiTableHeaderCell__content;"),
|
|
27
|
-
euiTableHeaderCell__button: /*#__PURE__*/css(logicalCSS('width', '100%'), " font-weight:inherit
|
|
29
|
+
euiTableHeaderCell__button: /*#__PURE__*/css(logicalCSS('width', '100%'), " font-weight:inherit;line-height:inherit;.euiTableSortIcon--sortable{color:", makeHighContrastColor(
|
|
30
|
+
// Tint it arbitrarily high, the contrast util will take care of lowering back down to WCAG
|
|
31
|
+
tintOrShade(euiTheme.colors.subduedText, 0.9, colorMode), 3 // 3:1 ratio from https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html
|
|
32
|
+
)(euiTheme.colors.emptyShade), ";}&:hover,&:focus{color:", euiTheme.colors.primaryText, ";text-decoration:underline;.euiTableSortIcon--sortable{color:", euiTheme.colors.primaryText, ";}};label:euiTableHeaderCell__button;"),
|
|
28
33
|
euiTableFooterCell: /*#__PURE__*/css(sharedStyles, " background-color:", euiTheme.colors.lightestShade, ";;label:euiTableFooterCell;")
|
|
29
34
|
};
|
|
30
35
|
};
|
|
@@ -26,9 +26,9 @@ var CellContents = function CellContents(_ref) {
|
|
|
26
26
|
align = _ref.align,
|
|
27
27
|
description = _ref.description,
|
|
28
28
|
children = _ref.children,
|
|
29
|
+
canSort = _ref.canSort,
|
|
29
30
|
isSorted = _ref.isSorted,
|
|
30
|
-
isSortAscending = _ref.isSortAscending
|
|
31
|
-
showSortMsg = _ref.showSortMsg;
|
|
31
|
+
isSortAscending = _ref.isSortAscending;
|
|
32
32
|
return ___EmotionJSX(EuiTableCellContent, {
|
|
33
33
|
className: className,
|
|
34
34
|
align: align,
|
|
@@ -49,11 +49,16 @@ var CellContents = function CellContents(_ref) {
|
|
|
49
49
|
className: "eui-textTruncate"
|
|
50
50
|
}, children);
|
|
51
51
|
});
|
|
52
|
-
}), description && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, description)),
|
|
52
|
+
}), description && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, description)), isSorted ? ___EmotionJSX(EuiIcon, {
|
|
53
53
|
className: "euiTableSortIcon",
|
|
54
54
|
type: isSortAscending ? 'sortUp' : 'sortDown',
|
|
55
55
|
size: "m"
|
|
56
|
-
})
|
|
56
|
+
}) : canSort ? ___EmotionJSX(EuiIcon, {
|
|
57
|
+
className: "euiTableSortIcon euiTableSortIcon--sortable",
|
|
58
|
+
type: "sortable",
|
|
59
|
+
size: "m",
|
|
60
|
+
color: "subdued" // Tinted a bit further via CSS
|
|
61
|
+
}) : null);
|
|
57
62
|
};
|
|
58
63
|
export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
59
64
|
var children = _ref2.children,
|
|
@@ -80,43 +85,36 @@ export var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
|
80
85
|
var CellComponent = children ? 'th' : 'td';
|
|
81
86
|
var cellScope = CellComponent === 'th' ? scope !== null && scope !== void 0 ? scope : 'col' : undefined; // `scope` is only valid on `th` elements
|
|
82
87
|
|
|
83
|
-
var
|
|
88
|
+
var canSort = !!(onSort && !readOnly);
|
|
89
|
+
var ariaSortValue;
|
|
90
|
+
if (isSorted) {
|
|
91
|
+
ariaSortValue = isSortAscending ? 'ascending' : 'descending';
|
|
92
|
+
} else if (canSort) {
|
|
93
|
+
ariaSortValue = 'none';
|
|
94
|
+
}
|
|
95
|
+
var cellContentsProps = {
|
|
84
96
|
css: styles.euiTableHeaderCell__content,
|
|
85
97
|
align: align,
|
|
86
98
|
description: description,
|
|
87
|
-
|
|
99
|
+
canSort: canSort,
|
|
88
100
|
isSorted: isSorted,
|
|
89
|
-
isSortAscending: isSortAscending
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
var buttonClasses = classNames('euiTableHeaderButton', {
|
|
93
|
-
'euiTableHeaderButton-isSorted': isSorted
|
|
94
|
-
});
|
|
95
|
-
var ariaSortValue = 'none';
|
|
96
|
-
if (isSorted) {
|
|
97
|
-
ariaSortValue = isSortAscending ? 'ascending' : 'descending';
|
|
98
|
-
}
|
|
99
|
-
return ___EmotionJSX(CellComponent, _extends({
|
|
100
|
-
css: styles.euiTableHeaderCell,
|
|
101
|
-
className: classes,
|
|
102
|
-
scope: cellScope,
|
|
103
|
-
role: "columnheader",
|
|
104
|
-
"aria-sort": ariaSortValue,
|
|
105
|
-
"aria-live": "polite",
|
|
106
|
-
style: inlineStyles
|
|
107
|
-
}, rest), onSort && !readOnly ? ___EmotionJSX("button", {
|
|
108
|
-
type: "button",
|
|
109
|
-
css: styles.euiTableHeaderCell__button,
|
|
110
|
-
className: buttonClasses,
|
|
111
|
-
onClick: onSort,
|
|
112
|
-
"data-test-subj": "tableHeaderSortButton"
|
|
113
|
-
}, cellContents) : cellContents);
|
|
114
|
-
}
|
|
101
|
+
isSortAscending: isSortAscending,
|
|
102
|
+
children: children
|
|
103
|
+
};
|
|
115
104
|
return ___EmotionJSX(CellComponent, _extends({
|
|
116
105
|
css: styles.euiTableHeaderCell,
|
|
117
106
|
className: classes,
|
|
118
107
|
scope: cellScope,
|
|
119
108
|
role: "columnheader",
|
|
109
|
+
"aria-sort": ariaSortValue,
|
|
120
110
|
style: inlineStyles
|
|
121
|
-
}, rest),
|
|
111
|
+
}, rest), canSort ? ___EmotionJSX("button", {
|
|
112
|
+
type: "button",
|
|
113
|
+
css: styles.euiTableHeaderCell__button,
|
|
114
|
+
className: classNames('euiTableHeaderButton', {
|
|
115
|
+
'euiTableHeaderButton-isSorted': isSorted
|
|
116
|
+
}),
|
|
117
|
+
onClick: onSort,
|
|
118
|
+
"data-test-subj": "tableHeaderSortButton"
|
|
119
|
+
}, ___EmotionJSX(CellContents, cellContentsProps)) : ___EmotionJSX(CellContents, cellContentsProps));
|
|
122
120
|
};
|
|
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.CollapsedItemActions = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _predicate = require("../../services/predicate");
|
|
12
11
|
var _context_menu = require("../context_menu");
|
|
13
12
|
var _popover = require("../popover");
|
|
14
13
|
var _button = require("../button");
|
|
@@ -36,9 +35,8 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
36
35
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
37
36
|
popoverOpen = _useState2[0],
|
|
38
37
|
setPopoverOpen = _useState2[1];
|
|
39
|
-
var
|
|
40
|
-
setPopoverOpen(false);
|
|
41
|
-
onClickAction === null || onClickAction === void 0 ? void 0 : onClickAction();
|
|
38
|
+
var closePopover = (0, _react.useCallback)(function () {
|
|
39
|
+
return setPopoverOpen(false);
|
|
42
40
|
}, []);
|
|
43
41
|
var controls = (0, _react.useMemo)(function () {
|
|
44
42
|
return actions.reduce(function (controls, action, index) {
|
|
@@ -57,16 +55,10 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
57
55
|
key: index,
|
|
58
56
|
className: "euiBasicTable__collapsedCustomAction"
|
|
59
57
|
}, (0, _react2.jsx)("span", {
|
|
60
|
-
onClick:
|
|
61
|
-
return onClickItem();
|
|
62
|
-
}
|
|
58
|
+
onClick: closePopover
|
|
63
59
|
}, actionControl)));
|
|
64
60
|
} else {
|
|
65
|
-
var
|
|
66
|
-
var icon;
|
|
67
|
-
if (buttonIcon) {
|
|
68
|
-
icon = (0, _predicate.isString)(buttonIcon) ? buttonIcon : buttonIcon(item);
|
|
69
|
-
}
|
|
61
|
+
var icon = action.icon ? (0, _action_types.callWithItemIfFunction)(item)(action.icon) : undefined;
|
|
70
62
|
var buttonContent = (0, _action_types.callWithItemIfFunction)(item)(action.name);
|
|
71
63
|
var toolTipContent = (0, _action_types.callWithItemIfFunction)(item)(action.description);
|
|
72
64
|
var href = (0, _action_types.callWithItemIfFunction)(item)(action.href);
|
|
@@ -81,10 +73,11 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
81
73
|
target: target,
|
|
82
74
|
icon: icon,
|
|
83
75
|
"data-test-subj": dataTestSubj,
|
|
84
|
-
onClick: function onClick() {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
onClick: function onClick(event) {
|
|
77
|
+
event.persist();
|
|
78
|
+
_onClick === null || _onClick === void 0 ? void 0 : _onClick(item, event);
|
|
79
|
+
// Allow consumer events to prevent the popover from closing if necessary
|
|
80
|
+
if (!event.isPropagationStopped()) closePopover();
|
|
88
81
|
},
|
|
89
82
|
toolTipContent: toolTipContent,
|
|
90
83
|
toolTipProps: {
|
|
@@ -94,7 +87,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
94
87
|
}
|
|
95
88
|
return controls;
|
|
96
89
|
}, []);
|
|
97
|
-
}, [actions, actionsDisabled, item,
|
|
90
|
+
}, [actions, actionsDisabled, item, closePopover]);
|
|
98
91
|
var popoverButton = (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
99
92
|
tokens: ['euiCollapsedItemActions.allActions', 'euiCollapsedItemActions.allActionsDisabled'],
|
|
100
93
|
defaults: ['All actions', 'Individual item actions are disabled when rows are being selected.']
|
|
@@ -131,9 +124,7 @@ var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
131
124
|
id: "".concat(itemId, "-actions"),
|
|
132
125
|
isOpen: popoverOpen,
|
|
133
126
|
button: withTooltip || popoverButton,
|
|
134
|
-
closePopover:
|
|
135
|
-
return setPopoverOpen(false);
|
|
136
|
-
},
|
|
127
|
+
closePopover: closePopover,
|
|
137
128
|
panelPaddingSize: "none",
|
|
138
129
|
anchorPosition: "leftCenter"
|
|
139
130
|
}, (0, _react2.jsx)(_context_menu.EuiContextMenuPanel, {
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.DefaultItemAction = void 0;
|
|
8
|
-
var _react =
|
|
9
|
-
var _predicate = require("../../services/predicate");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _button = require("../button");
|
|
11
10
|
var _tool_tip = require("../tool_tip");
|
|
12
11
|
var _accessibility = require("../../services/accessibility");
|
|
13
12
|
var _accessibility2 = require("../accessibility");
|
|
14
13
|
var _action_types = require("./action_types");
|
|
15
14
|
var _react2 = require("@emotion/react");
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
17
|
/*
|
|
17
18
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
18
19
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -29,26 +30,20 @@ var DefaultItemAction = function DefaultItemAction(_ref) {
|
|
|
29
30
|
if (!action.onClick && !action.href) {
|
|
30
31
|
throw new Error("Cannot render item action [".concat(action.name, "]. Missing required 'onClick' callback\n or 'href' string. If you want to provide a custom action control, make sure to define the 'render' callback"));
|
|
31
32
|
}
|
|
32
|
-
var onClick =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
var buttonIcon = action.icon;
|
|
41
|
-
var icon;
|
|
42
|
-
if (buttonIcon) {
|
|
43
|
-
icon = (0, _predicate.isString)(buttonIcon) ? buttonIcon : buttonIcon(item);
|
|
44
|
-
}
|
|
45
|
-
var button;
|
|
33
|
+
var onClick = (0, _react.useCallback)(function (event) {
|
|
34
|
+
if (!action.onClick) return;
|
|
35
|
+
event.persist(); // TODO: Remove once React 16 support is dropped
|
|
36
|
+
action.onClick(item, event);
|
|
37
|
+
}, [action.onClick, item]);
|
|
38
|
+
var color = action.color ? (0, _action_types.callWithItemIfFunction)(item)(action.color) : 'primary';
|
|
39
|
+
var icon = action.icon ? (0, _action_types.callWithItemIfFunction)(item)(action.icon) : undefined;
|
|
46
40
|
var actionContent = (0, _action_types.callWithItemIfFunction)(item)(action.name);
|
|
47
41
|
var tooltipContent = (0, _action_types.callWithItemIfFunction)(item)(action.description);
|
|
48
42
|
var href = (0, _action_types.callWithItemIfFunction)(item)(action.href);
|
|
49
43
|
var dataTestSubj = (0, _action_types.callWithItemIfFunction)(item)(action['data-test-subj']);
|
|
50
44
|
var ariaLabelId = (0, _accessibility.useGeneratedHtmlId)();
|
|
51
45
|
var ariaLabelledBy;
|
|
46
|
+
var button;
|
|
52
47
|
if (action.type === 'icon') {
|
|
53
48
|
if (!icon) {
|
|
54
49
|
throw new Error("Cannot render item action [".concat(action.name, "]. It is configured to render as an icon but no\n icon is provided. Make sure to set the 'icon' property of the action"));
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.euiTableHeaderFooterCellStyles = exports.euiTableCellCheckboxStyles = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
|
+
var _services = require("../../services");
|
|
10
11
|
var _global_styling = require("../../global_styling");
|
|
11
12
|
var _table = require("./table.styles");
|
|
12
13
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -18,7 +19,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
18
19
|
* Side Public License, v 1.
|
|
19
20
|
*/
|
|
20
21
|
var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellStyles(euiThemeContext) {
|
|
21
|
-
var euiTheme = euiThemeContext.euiTheme
|
|
22
|
+
var euiTheme = euiThemeContext.euiTheme,
|
|
23
|
+
colorMode = euiThemeContext.colorMode;
|
|
22
24
|
|
|
23
25
|
// euiFontSize returns an object, so we keep object notation here to merge into css``
|
|
24
26
|
var sharedStyles = _objectSpread(_objectSpread({}, (0, _global_styling.euiFontSize)(euiThemeContext, 'xs')), {}, {
|
|
@@ -29,7 +31,10 @@ var euiTableHeaderFooterCellStyles = function euiTableHeaderFooterCellStyles(eui
|
|
|
29
31
|
return {
|
|
30
32
|
euiTableHeaderCell: /*#__PURE__*/(0, _react.css)(sharedStyles, ";;label:euiTableHeaderCell;"),
|
|
31
33
|
euiTableHeaderCell__content: /*#__PURE__*/(0, _react.css)("gap:", euiTheme.size.xs, ";;label:euiTableHeaderCell__content;"),
|
|
32
|
-
euiTableHeaderCell__button: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('width', '100%'), " font-weight:inherit
|
|
34
|
+
euiTableHeaderCell__button: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('width', '100%'), " font-weight:inherit;line-height:inherit;.euiTableSortIcon--sortable{color:", (0, _services.makeHighContrastColor)(
|
|
35
|
+
// Tint it arbitrarily high, the contrast util will take care of lowering back down to WCAG
|
|
36
|
+
(0, _services.tintOrShade)(euiTheme.colors.subduedText, 0.9, colorMode), 3 // 3:1 ratio from https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html
|
|
37
|
+
)(euiTheme.colors.emptyShade), ";}&:hover,&:focus{color:", euiTheme.colors.primaryText, ";text-decoration:underline;.euiTableSortIcon--sortable{color:", euiTheme.colors.primaryText, ";}};label:euiTableHeaderCell__button;"),
|
|
33
38
|
euiTableFooterCell: /*#__PURE__*/(0, _react.css)(sharedStyles, " background-color:", euiTheme.colors.lightestShade, ";;label:euiTableFooterCell;")
|
|
34
39
|
};
|
|
35
40
|
};
|
|
@@ -32,9 +32,9 @@ var CellContents = function CellContents(_ref) {
|
|
|
32
32
|
align = _ref.align,
|
|
33
33
|
description = _ref.description,
|
|
34
34
|
children = _ref.children,
|
|
35
|
+
canSort = _ref.canSort,
|
|
35
36
|
isSorted = _ref.isSorted,
|
|
36
|
-
isSortAscending = _ref.isSortAscending
|
|
37
|
-
showSortMsg = _ref.showSortMsg;
|
|
37
|
+
isSortAscending = _ref.isSortAscending;
|
|
38
38
|
return (0, _react2.jsx)(_table_cell_content.EuiTableCellContent, {
|
|
39
39
|
className: className,
|
|
40
40
|
align: align,
|
|
@@ -55,11 +55,16 @@ var CellContents = function CellContents(_ref) {
|
|
|
55
55
|
className: "eui-textTruncate"
|
|
56
56
|
}, children);
|
|
57
57
|
});
|
|
58
|
-
}), description && (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("span", null, description)),
|
|
58
|
+
}), description && (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("span", null, description)), isSorted ? (0, _react2.jsx)(_icon.EuiIcon, {
|
|
59
59
|
className: "euiTableSortIcon",
|
|
60
60
|
type: isSortAscending ? 'sortUp' : 'sortDown',
|
|
61
61
|
size: "m"
|
|
62
|
-
}))
|
|
62
|
+
}) : canSort ? (0, _react2.jsx)(_icon.EuiIcon, {
|
|
63
|
+
className: "euiTableSortIcon euiTableSortIcon--sortable",
|
|
64
|
+
type: "sortable",
|
|
65
|
+
size: "m",
|
|
66
|
+
color: "subdued" // Tinted a bit further via CSS
|
|
67
|
+
}) : null);
|
|
63
68
|
};
|
|
64
69
|
var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
65
70
|
var children = _ref2.children,
|
|
@@ -86,44 +91,37 @@ var EuiTableHeaderCell = function EuiTableHeaderCell(_ref2) {
|
|
|
86
91
|
var CellComponent = children ? 'th' : 'td';
|
|
87
92
|
var cellScope = CellComponent === 'th' ? scope !== null && scope !== void 0 ? scope : 'col' : undefined; // `scope` is only valid on `th` elements
|
|
88
93
|
|
|
89
|
-
var
|
|
94
|
+
var canSort = !!(onSort && !readOnly);
|
|
95
|
+
var ariaSortValue;
|
|
96
|
+
if (isSorted) {
|
|
97
|
+
ariaSortValue = isSortAscending ? 'ascending' : 'descending';
|
|
98
|
+
} else if (canSort) {
|
|
99
|
+
ariaSortValue = 'none';
|
|
100
|
+
}
|
|
101
|
+
var cellContentsProps = {
|
|
90
102
|
css: styles.euiTableHeaderCell__content,
|
|
91
103
|
align: align,
|
|
92
104
|
description: description,
|
|
93
|
-
|
|
105
|
+
canSort: canSort,
|
|
94
106
|
isSorted: isSorted,
|
|
95
|
-
isSortAscending: isSortAscending
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var buttonClasses = (0, _classnames.default)('euiTableHeaderButton', {
|
|
99
|
-
'euiTableHeaderButton-isSorted': isSorted
|
|
100
|
-
});
|
|
101
|
-
var ariaSortValue = 'none';
|
|
102
|
-
if (isSorted) {
|
|
103
|
-
ariaSortValue = isSortAscending ? 'ascending' : 'descending';
|
|
104
|
-
}
|
|
105
|
-
return (0, _react2.jsx)(CellComponent, (0, _extends2.default)({
|
|
106
|
-
css: styles.euiTableHeaderCell,
|
|
107
|
-
className: classes,
|
|
108
|
-
scope: cellScope,
|
|
109
|
-
role: "columnheader",
|
|
110
|
-
"aria-sort": ariaSortValue,
|
|
111
|
-
"aria-live": "polite",
|
|
112
|
-
style: inlineStyles
|
|
113
|
-
}, rest), onSort && !readOnly ? (0, _react2.jsx)("button", {
|
|
114
|
-
type: "button",
|
|
115
|
-
css: styles.euiTableHeaderCell__button,
|
|
116
|
-
className: buttonClasses,
|
|
117
|
-
onClick: onSort,
|
|
118
|
-
"data-test-subj": "tableHeaderSortButton"
|
|
119
|
-
}, cellContents) : cellContents);
|
|
120
|
-
}
|
|
107
|
+
isSortAscending: isSortAscending,
|
|
108
|
+
children: children
|
|
109
|
+
};
|
|
121
110
|
return (0, _react2.jsx)(CellComponent, (0, _extends2.default)({
|
|
122
111
|
css: styles.euiTableHeaderCell,
|
|
123
112
|
className: classes,
|
|
124
113
|
scope: cellScope,
|
|
125
114
|
role: "columnheader",
|
|
115
|
+
"aria-sort": ariaSortValue,
|
|
126
116
|
style: inlineStyles
|
|
127
|
-
}, rest),
|
|
117
|
+
}, rest), canSort ? (0, _react2.jsx)("button", {
|
|
118
|
+
type: "button",
|
|
119
|
+
css: styles.euiTableHeaderCell__button,
|
|
120
|
+
className: (0, _classnames.default)('euiTableHeaderButton', {
|
|
121
|
+
'euiTableHeaderButton-isSorted': isSorted
|
|
122
|
+
}),
|
|
123
|
+
onClick: onSort,
|
|
124
|
+
"data-test-subj": "tableHeaderSortButton"
|
|
125
|
+
}, (0, _react2.jsx)(CellContents, cellContentsProps)) : (0, _react2.jsx)(CellContents, cellContentsProps));
|
|
128
126
|
};
|
|
129
127
|
exports.EuiTableHeaderCell = EuiTableHeaderCell;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elastic/eui",
|
|
3
3
|
"description": "Elastic UI Component Library",
|
|
4
|
-
"version": "94.
|
|
4
|
+
"version": "94.1.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "lib",
|
|
7
7
|
"module": "es",
|
|
8
8
|
"types": "eui.d.ts",
|
|
9
|
-
"docker_image": "20.
|
|
9
|
+
"docker_image": "20.12.1",
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": "16.x || 18.x || >=20.x"
|
|
12
12
|
},
|
|
@@ -1162,10 +1162,14 @@ EuiBasicTable.propTypes = {
|
|
|
1162
1162
|
*/
|
|
1163
1163
|
description: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired]).isRequired,
|
|
1164
1164
|
/**
|
|
1165
|
-
* A handler function to execute the action
|
|
1165
|
+
* A handler function to execute the action. Passes back the current row
|
|
1166
|
+
* item as the first argument, and the originating React click event
|
|
1167
|
+
* as a second argument.
|
|
1166
1168
|
*/
|
|
1167
1169
|
/**
|
|
1168
|
-
* A handler function to execute the action
|
|
1170
|
+
* A handler function to execute the action. Passes back the current row
|
|
1171
|
+
* item as the first argument, and the originating React click event
|
|
1172
|
+
* as a second argument.
|
|
1169
1173
|
*/
|
|
1170
1174
|
onClick: _propTypes.default.func,
|
|
1171
1175
|
href: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.func.isRequired]),
|