@elastic/eui 95.11.0 → 95.12.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/README.md +1 -69
- package/es/components/basic_table/basic_table.js +39 -32
- package/es/components/datagrid/body/cell/data_grid_cell.js +121 -15
- package/es/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/es/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/es/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/es/components/datagrid/body/footer/data_grid_footer_row.js +17 -9
- package/es/components/datagrid/body/header/data_grid_control_header_cell.js +5 -2
- package/es/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/es/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +6 -3
- package/es/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/es/components/datagrid/data_grid.js +3 -3
- package/es/components/datagrid/data_grid.stories.utils.js +65 -29
- package/es/components/datagrid/utils/row_heights.js +9 -33
- package/es/components/date_picker/date_picker.js +1 -1
- package/es/components/provider/provider.js +16 -13
- package/es/components/provider/system_color_mode/index.js +9 -0
- package/es/components/provider/system_color_mode/system_color_mode_provider.js +49 -0
- package/es/components/resizable_container/resizable_button.js +9 -2
- package/es/components/resizable_container/resizable_button.styles.js +19 -6
- package/es/components/table/table_header_cell.js +10 -3
- package/es/components/table/table_header_cell_checkbox.js +5 -3
- package/es/components/table/table_row_cell.js +10 -3
- package/es/components/table/table_row_cell_checkbox.js +5 -3
- package/es/services/copy/index.js +10 -0
- package/es/services/copy/tabular_copy.js +103 -0
- package/es/services/index.js +1 -1
- package/eui.d.ts +162 -67
- package/i18ntokens.json +90 -90
- package/lib/components/basic_table/basic_table.js +38 -31
- package/lib/components/datagrid/body/cell/data_grid_cell.js +120 -14
- package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/lib/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/lib/components/datagrid/body/footer/data_grid_footer_row.js +13 -5
- package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +5 -2
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +5 -2
- package/lib/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/lib/components/datagrid/data_grid.js +2 -2
- package/lib/components/datagrid/data_grid.stories.utils.js +66 -31
- package/lib/components/datagrid/utils/row_heights.js +8 -32
- package/lib/components/date_picker/date_picker.js +1 -1
- package/lib/components/provider/provider.js +16 -13
- package/lib/components/provider/system_color_mode/index.js +12 -0
- package/lib/components/provider/system_color_mode/system_color_mode_provider.js +54 -0
- package/lib/components/resizable_container/resizable_button.js +9 -2
- package/lib/components/resizable_container/resizable_button.styles.js +19 -6
- package/lib/components/table/table_header_cell.js +10 -3
- package/lib/components/table/table_header_cell_checkbox.js +5 -3
- package/lib/components/table/table_row_cell.js +10 -3
- package/lib/components/table/table_row_cell_checkbox.js +5 -3
- package/lib/services/copy/index.js +25 -0
- package/lib/services/copy/tabular_copy.js +111 -0
- package/lib/services/index.js +12 -8
- package/optimize/es/components/basic_table/basic_table.js +39 -32
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +18 -14
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +17 -9
- package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +4 -2
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +5 -3
- package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/optimize/es/components/datagrid/data_grid.js +3 -3
- package/optimize/es/components/datagrid/data_grid.stories.utils.js +65 -29
- package/optimize/es/components/datagrid/utils/row_heights.js +9 -33
- package/optimize/es/components/date_picker/date_picker.js +1 -1
- package/optimize/es/components/provider/provider.js +16 -13
- package/optimize/es/components/provider/system_color_mode/index.js +9 -0
- package/optimize/es/components/provider/system_color_mode/system_color_mode_provider.js +40 -0
- package/optimize/es/components/resizable_container/resizable_button.js +3 -2
- package/optimize/es/components/resizable_container/resizable_button.styles.js +19 -6
- package/optimize/es/components/table/table_header_cell.js +3 -2
- package/optimize/es/components/table/table_header_cell_checkbox.js +3 -2
- package/optimize/es/components/table/table_row_cell.js +4 -3
- package/optimize/es/components/table/table_row_cell_checkbox.js +3 -2
- package/optimize/es/services/copy/index.js +10 -0
- package/optimize/es/services/copy/tabular_copy.js +103 -0
- package/optimize/es/services/index.js +1 -1
- package/optimize/lib/components/basic_table/basic_table.js +38 -31
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +17 -13
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +13 -5
- package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +4 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +4 -2
- package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/optimize/lib/components/datagrid/data_grid.js +2 -2
- package/optimize/lib/components/datagrid/data_grid.stories.utils.js +70 -37
- package/optimize/lib/components/datagrid/utils/row_heights.js +8 -32
- package/optimize/lib/components/date_picker/date_picker.js +1 -1
- package/optimize/lib/components/provider/provider.js +16 -13
- package/optimize/lib/components/provider/system_color_mode/index.js +12 -0
- package/optimize/lib/components/provider/system_color_mode/system_color_mode_provider.js +47 -0
- package/optimize/lib/components/resizable_container/resizable_button.js +3 -2
- package/optimize/lib/components/resizable_container/resizable_button.styles.js +19 -6
- package/optimize/lib/components/table/table_header_cell.js +3 -2
- package/optimize/lib/components/table/table_header_cell_checkbox.js +3 -2
- package/optimize/lib/components/table/table_row_cell.js +4 -3
- package/optimize/lib/components/table/table_row_cell_checkbox.js +3 -2
- package/optimize/lib/services/copy/index.js +25 -0
- package/optimize/lib/services/copy/tabular_copy.js +111 -0
- package/optimize/lib/services/index.js +12 -8
- package/package.json +1 -1
- package/test-env/components/basic_table/basic_table.js +38 -31
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +120 -14
- package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +5 -2
- package/test-env/components/datagrid/body/data_grid_body_custom.js +5 -2
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +5 -2
- package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +13 -5
- package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +5 -2
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +3 -1
- package/test-env/components/datagrid/body/header/data_grid_header_cell.styles.js +0 -2
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +5 -2
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +5 -1
- package/test-env/components/datagrid/data_grid.js +2 -2
- package/test-env/components/datagrid/data_grid.stories.utils.js +70 -37
- package/test-env/components/datagrid/utils/row_heights.js +8 -32
- package/test-env/components/date_picker/date_picker.js +1 -1
- package/test-env/components/provider/provider.js +16 -13
- package/test-env/components/provider/system_color_mode/index.js +12 -0
- package/test-env/components/provider/system_color_mode/system_color_mode_provider.js +51 -0
- package/test-env/components/resizable_container/resizable_button.js +9 -2
- package/test-env/components/resizable_container/resizable_button.styles.js +19 -6
- package/test-env/components/table/table_header_cell.js +10 -3
- package/test-env/components/table/table_header_cell_checkbox.js +5 -3
- package/test-env/components/table/table_row_cell.js +10 -3
- package/test-env/components/table/table_row_cell_checkbox.js +5 -3
- package/test-env/services/copy/index.js +25 -0
- package/test-env/services/copy/tabular_copy.js +30 -0
- package/test-env/services/index.js +12 -8
- /package/es/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
- /package/lib/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
- /package/optimize/es/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
- /package/optimize/lib/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
- /package/test-env/services/{copy_to_clipboard.js → copy/copy_to_clipboard.js} +0 -0
|
@@ -14,7 +14,8 @@ import { EuiDataGridHeaderCellWrapper } from './data_grid_header_cell_wrapper';
|
|
|
14
14
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
15
15
|
export var EuiDataGridControlHeaderCell = /*#__PURE__*/memo(function (_ref) {
|
|
16
16
|
var controlColumn = _ref.controlColumn,
|
|
17
|
-
index = _ref.index
|
|
17
|
+
index = _ref.index,
|
|
18
|
+
visibleColCount = _ref.visibleColCount;
|
|
18
19
|
var HeaderCellRender = controlColumn.headerCellRender,
|
|
19
20
|
headerCellProps = controlColumn.headerCellProps,
|
|
20
21
|
width = controlColumn.width,
|
|
@@ -23,11 +24,13 @@ export var EuiDataGridControlHeaderCell = /*#__PURE__*/memo(function (_ref) {
|
|
|
23
24
|
className: classNames('euiDataGridHeaderCell--controlColumn', headerCellProps === null || headerCellProps === void 0 ? void 0 : headerCellProps.className),
|
|
24
25
|
id: id,
|
|
25
26
|
index: index,
|
|
26
|
-
width: width
|
|
27
|
+
width: width,
|
|
28
|
+
visibleColCount: visibleColCount
|
|
27
29
|
}), ___EmotionJSX(HeaderCellRender, null));
|
|
28
30
|
});
|
|
29
31
|
EuiDataGridControlHeaderCell.propTypes = {
|
|
30
32
|
index: PropTypes.number.isRequired,
|
|
33
|
+
visibleColCount: PropTypes.number.isRequired,
|
|
31
34
|
controlColumn: PropTypes.shape({
|
|
32
35
|
/**
|
|
33
36
|
* Used as the React `key` when rendering content
|
|
@@ -40,6 +40,7 @@ export var EuiDataGridHeaderCell = /*#__PURE__*/memo(function (_ref) {
|
|
|
40
40
|
columnWidths = _ref.columnWidths,
|
|
41
41
|
defaultColumnWidth = _ref.defaultColumnWidth,
|
|
42
42
|
setColumnWidth = _ref.setColumnWidth,
|
|
43
|
+
visibleColCount = _ref.visibleColCount,
|
|
43
44
|
setVisibleColumns = _ref.setVisibleColumns,
|
|
44
45
|
switchColumnPos = _ref.switchColumnPos,
|
|
45
46
|
sorting = _ref.sorting,
|
|
@@ -124,11 +125,12 @@ export var EuiDataGridHeaderCell = /*#__PURE__*/memo(function (_ref) {
|
|
|
124
125
|
*/
|
|
125
126
|
var classes = classnames(_defineProperty(_defineProperty(_defineProperty({}, "euiDataGridHeaderCell--".concat(columnType), columnType), 'euiDataGridHeaderCell--hasColumnActions', showColumnActions), 'euiDataGridHeaderCell--isActionsPopoverOpen', isPopoverOpen), displayHeaderCellProps === null || displayHeaderCellProps === void 0 ? void 0 : displayHeaderCellProps.className);
|
|
126
127
|
var styles = useEuiMemoizedStyles(euiDataGridHeaderCellStyles);
|
|
127
|
-
var contentStyles = [styles.euiDataGridHeaderCell__content, columnType === 'numeric' || columnType === 'currency'
|
|
128
|
+
var contentStyles = [styles.euiDataGridHeaderCell__content, (columnType === 'numeric' || columnType === 'currency') && styles.right];
|
|
128
129
|
return ___EmotionJSX(EuiDataGridHeaderCellWrapper, _extends({}, displayHeaderCellProps, {
|
|
129
130
|
className: classes,
|
|
130
131
|
id: id,
|
|
131
132
|
index: index,
|
|
133
|
+
visibleColCount: visibleColCount,
|
|
132
134
|
width: width,
|
|
133
135
|
"aria-sort": ariaSort,
|
|
134
136
|
hasActionsPopover: showColumnActions,
|
|
@@ -19,8 +19,6 @@ export var euiDataGridHeaderCellStyles = function euiDataGridHeaderCellStyles(eu
|
|
|
19
19
|
header = _euiDataGridCellOutli.header;
|
|
20
20
|
return {
|
|
21
21
|
euiDataGridHeaderCell__content: /*#__PURE__*/css("flex-grow:1;", euiTextTruncate(), ";;label:euiDataGridHeaderCell__content;"),
|
|
22
|
-
// Overwrite inherited 'center' styles from <button>
|
|
23
|
-
left: /*#__PURE__*/css(logicalTextAlignCSS('left'), ";;label:left;"),
|
|
24
22
|
// Numeric and currency schemas are aligned to the right
|
|
25
23
|
right: /*#__PURE__*/css(logicalTextAlignCSS('right'), ";;label:right;"),
|
|
26
24
|
euiDataGridHeaderCell__popover: /*#__PURE__*/css(logicalCSS('margin-left', 'auto'), "line-height:0;;label:euiDataGridHeaderCell__popover;"),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["id", "index", "width", "className", "children", "hasActionsPopover", "openActionsPopover", "aria-label"];
|
|
1
|
+
var _excluded = ["id", "index", "visibleColCount", "width", "className", "children", "hasActionsPopover", "openActionsPopover", "aria-label"];
|
|
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
4
4
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -19,7 +19,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
19
19
|
import React, { useContext, useEffect, useState, useCallback } from 'react';
|
|
20
20
|
import PropTypes from "prop-types";
|
|
21
21
|
import classnames from 'classnames';
|
|
22
|
-
import { keys, useEuiMemoizedStyles } from '../../../../services';
|
|
22
|
+
import { keys, tabularCopyMarkers, useEuiMemoizedStyles } from '../../../../services';
|
|
23
23
|
import { DataGridFocusContext } from '../../utils/focus';
|
|
24
24
|
import { HandleInteractiveChildren } from '../cell/focus_utils';
|
|
25
25
|
import { euiDataGridHeaderCellWrapperStyles } from './data_grid_header_cell_wrapper.styles';
|
|
@@ -33,6 +33,7 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
|
33
33
|
export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(_ref) {
|
|
34
34
|
var id = _ref.id,
|
|
35
35
|
index = _ref.index,
|
|
36
|
+
visibleColCount = _ref.visibleColCount,
|
|
36
37
|
width = _ref.width,
|
|
37
38
|
className = _ref.className,
|
|
38
39
|
children = _ref.children,
|
|
@@ -88,6 +89,7 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
|
|
|
88
89
|
openActionsPopover === null || openActionsPopover === void 0 || openActionsPopover();
|
|
89
90
|
}
|
|
90
91
|
}, [hasActionsPopover, openActionsPopover, renderFocusTrap, headerEl]);
|
|
92
|
+
var isLastColumn = index === visibleColCount - 1;
|
|
91
93
|
return ___EmotionJSX("div", _extends({
|
|
92
94
|
role: "columnheader",
|
|
93
95
|
ref: setHeaderEl,
|
|
@@ -109,12 +111,13 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
|
|
|
109
111
|
updateCellFocusContext: updateCellFocusContext,
|
|
110
112
|
renderFocusTrap: renderFocusTrap,
|
|
111
113
|
onInteractiveChildrenFound: setInteractiveChildren
|
|
112
|
-
}, typeof children === 'function' ? children(renderFocusTrap) : children));
|
|
114
|
+
}, typeof children === 'function' ? children(renderFocusTrap) : children), isLastColumn ? tabularCopyMarkers.hiddenNewline : tabularCopyMarkers.hiddenTab);
|
|
113
115
|
};
|
|
114
116
|
EuiDataGridHeaderCellWrapper.propTypes = {
|
|
115
117
|
children: PropTypes.oneOfType([PropTypes.node.isRequired, PropTypes.func.isRequired]).isRequired,
|
|
116
118
|
id: PropTypes.string.isRequired,
|
|
117
119
|
index: PropTypes.number.isRequired,
|
|
120
|
+
visibleColCount: PropTypes.number.isRequired,
|
|
118
121
|
width: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.oneOf([null])]),
|
|
119
122
|
className: PropTypes.string,
|
|
120
123
|
"aria-label": PropTypes.any,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["className", "data-test-subj", "leadingControlColumns", "trailingControlColumns", "columns", "columnWidths", "defaultColumnWidth", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "sorting", "schema", "schemaDetectors", "gridStyles"];
|
|
1
|
+
var _excluded = ["className", "data-test-subj", "leadingControlColumns", "trailingControlColumns", "columns", "columnWidths", "defaultColumnWidth", "setColumnWidth", "visibleColCount", "setVisibleColumns", "switchColumnPos", "sorting", "schema", "schemaDetectors", "gridStyles"];
|
|
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; }
|
|
@@ -29,6 +29,7 @@ var EuiDataGridHeaderRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
29
29
|
columnWidths = props.columnWidths,
|
|
30
30
|
defaultColumnWidth = props.defaultColumnWidth,
|
|
31
31
|
setColumnWidth = props.setColumnWidth,
|
|
32
|
+
visibleColCount = props.visibleColCount,
|
|
32
33
|
setVisibleColumns = props.setVisibleColumns,
|
|
33
34
|
switchColumnPos = props.switchColumnPos,
|
|
34
35
|
sorting = props.sorting,
|
|
@@ -50,6 +51,7 @@ var EuiDataGridHeaderRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
50
51
|
return ___EmotionJSX(EuiDataGridControlHeaderCell, {
|
|
51
52
|
key: controlColumn.id,
|
|
52
53
|
index: index,
|
|
54
|
+
visibleColCount: visibleColCount,
|
|
53
55
|
controlColumn: controlColumn
|
|
54
56
|
});
|
|
55
57
|
}), columns.map(function (column, index) {
|
|
@@ -61,6 +63,7 @@ var EuiDataGridHeaderRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
61
63
|
columnWidths: columnWidths,
|
|
62
64
|
defaultColumnWidth: defaultColumnWidth,
|
|
63
65
|
setColumnWidth: setColumnWidth,
|
|
66
|
+
visibleColCount: visibleColCount,
|
|
64
67
|
setVisibleColumns: setVisibleColumns,
|
|
65
68
|
switchColumnPos: switchColumnPos,
|
|
66
69
|
sorting: sorting,
|
|
@@ -71,6 +74,7 @@ var EuiDataGridHeaderRow = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (
|
|
|
71
74
|
return ___EmotionJSX(EuiDataGridControlHeaderCell, {
|
|
72
75
|
key: controlColumn.id,
|
|
73
76
|
index: index + leadingControlColumns.length + columns.length,
|
|
77
|
+
visibleColCount: visibleColCount,
|
|
74
78
|
controlColumn: controlColumn
|
|
75
79
|
});
|
|
76
80
|
}));
|
|
@@ -28,7 +28,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
28
28
|
|
|
29
29
|
import classNames from 'classnames';
|
|
30
30
|
import React, { forwardRef, useMemo, useRef, useState, memo, useCallback } from 'react';
|
|
31
|
-
import { useGeneratedHtmlId, useEuiMemoizedStyles } from '../../services';
|
|
31
|
+
import { useGeneratedHtmlId, useEuiMemoizedStyles, OverrideCopiedTabularContent } from '../../services';
|
|
32
32
|
import { useEuiTablePaginationDefaults } from '../table/table_pagination';
|
|
33
33
|
import { EuiFocusTrap } from '../focus_trap';
|
|
34
34
|
import { EuiI18n, useEuiI18n } from '../i18n';
|
|
@@ -376,7 +376,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
376
376
|
role: "grid",
|
|
377
377
|
"aria-rowcount": rowCount,
|
|
378
378
|
id: gridId
|
|
379
|
-
}, wrappingDivFocusProps, gridAriaProps), ___EmotionJSX(EuiDataGridBody, {
|
|
379
|
+
}, wrappingDivFocusProps, gridAriaProps), ___EmotionJSX(OverrideCopiedTabularContent, null, ___EmotionJSX(EuiDataGridBody, {
|
|
380
380
|
columns: orderedVisibleColumns,
|
|
381
381
|
visibleColCount: visibleColCount,
|
|
382
382
|
leadingControlColumns: leadingControlColumns,
|
|
@@ -404,7 +404,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
404
404
|
gridItemsRendered: gridItemsRendered,
|
|
405
405
|
wrapperRef: contentRef,
|
|
406
406
|
renderCustomGridBody: renderCustomGridBody
|
|
407
|
-
})), showPagination && props['aria-labelledby'] && ___EmotionJSX("p", {
|
|
407
|
+
}))), showPagination && props['aria-labelledby'] && ___EmotionJSX("p", {
|
|
408
408
|
id: ariaLabelledById,
|
|
409
409
|
hidden: true
|
|
410
410
|
}, ariaLabelledBy), showPagination && ___EmotionJSX(EuiDataGridPagination, _extends({}, pagination, {
|
|
@@ -15,6 +15,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
15
15
|
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; }
|
|
16
16
|
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; }
|
|
17
17
|
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); }
|
|
18
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
18
19
|
/*
|
|
19
20
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
20
21
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -26,10 +27,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
26
27
|
/* eslint-disable storybook/default-exports, storybook/prefer-pascal-case */
|
|
27
28
|
|
|
28
29
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
30
|
+
import { css } from '@emotion/react';
|
|
29
31
|
import { faker } from '@faker-js/faker';
|
|
30
32
|
import { EuiLink } from '../link';
|
|
31
33
|
import { EuiScreenReaderOnly } from '../accessibility';
|
|
32
34
|
import { EuiButtonIcon } from '../button';
|
|
35
|
+
import { EuiCheckbox } from '../form';
|
|
36
|
+
import { EuiBadge } from '../badge';
|
|
33
37
|
import { MINIMUM_WIDTH_FOR_GRID_CONTROLS } from './controls/data_grid_toolbar';
|
|
34
38
|
import { EuiDataGrid } from './data_grid';
|
|
35
39
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -42,6 +46,14 @@ faker.seed(42);
|
|
|
42
46
|
// which then invalidates the VRT
|
|
43
47
|
var staticDates = [new Date('Tue Mar 19 2024 18:54:51 GMT+0100'), new Date('Mon Mar 25 2024 19:27:35 GMT+0100'), new Date('Sat Sep 09 2023 00:32:42 GMT+0200'), new Date('Wed Jun 14 2023 06:48:29 GMT+0200'), new Date('Mon Mar 04 2024 04:40:36 GMT+0100'), new Date('Mon Feb 05 2024 10:51:48 GMT+0100'), new Date('Mon Jun 19 2023 12:08:38 GMT+0200'), new Date('Wed Jul 26 2023 01:15:02 GMT+0200'), new Date('Wed Nov 08 2023 08:49:13 GMT+0100'), new Date('Sun Nov 19 2023 01:49:12 GMT+0100')];
|
|
44
48
|
var dataKeys = ['name', 'email', 'account', 'location', 'date', 'version'];
|
|
49
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
50
|
+
name: "1u596ek-version",
|
|
51
|
+
styles: "vertical-align:text-bottom;label:version;"
|
|
52
|
+
} : {
|
|
53
|
+
name: "1u596ek-version",
|
|
54
|
+
styles: "vertical-align:text-bottom;label:version;",
|
|
55
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
56
|
+
};
|
|
45
57
|
export var raw_data = Array.from({
|
|
46
58
|
length: 10
|
|
47
59
|
}).map(function (_, i) {
|
|
@@ -57,24 +69,28 @@ export var raw_data = Array.from({
|
|
|
57
69
|
email: {
|
|
58
70
|
formatted: ___EmotionJSX(EuiLink, {
|
|
59
71
|
href: ""
|
|
60
|
-
},
|
|
72
|
+
}, email),
|
|
61
73
|
raw: email
|
|
62
74
|
},
|
|
63
75
|
location: ___EmotionJSX(React.Fragment, null, "".concat(faker.location.city(), ", "), ___EmotionJSX(EuiLink, {
|
|
64
76
|
href: "https://google.com"
|
|
65
77
|
}, faker.location.country())),
|
|
66
|
-
date:
|
|
78
|
+
date: date,
|
|
67
79
|
account: faker.finance.accountNumber(),
|
|
68
|
-
version:
|
|
80
|
+
version: ___EmotionJSX(EuiBadge
|
|
81
|
+
// Tweak the badge's vertical centering
|
|
82
|
+
, {
|
|
83
|
+
css: _ref
|
|
84
|
+
}, faker.system.semver())
|
|
69
85
|
};
|
|
70
86
|
});
|
|
71
87
|
var columns = [{
|
|
72
88
|
id: 'name',
|
|
73
89
|
displayAsText: 'Name',
|
|
74
90
|
defaultSortDirection: 'asc',
|
|
75
|
-
cellActions: [function (
|
|
76
|
-
var rowIndex =
|
|
77
|
-
Component =
|
|
91
|
+
cellActions: [function (_ref2) {
|
|
92
|
+
var rowIndex = _ref2.rowIndex,
|
|
93
|
+
Component = _ref2.Component;
|
|
78
94
|
var data = raw_data;
|
|
79
95
|
var value = data[rowIndex].name.raw;
|
|
80
96
|
return ___EmotionJSX(Component, {
|
|
@@ -89,9 +105,9 @@ var columns = [{
|
|
|
89
105
|
id: 'email',
|
|
90
106
|
displayAsText: 'Email address',
|
|
91
107
|
initialWidth: 130,
|
|
92
|
-
cellActions: [function (
|
|
93
|
-
var rowIndex =
|
|
94
|
-
Component =
|
|
108
|
+
cellActions: [function (_ref3) {
|
|
109
|
+
var rowIndex = _ref3.rowIndex,
|
|
110
|
+
Component = _ref3.Component;
|
|
95
111
|
var data = raw_data;
|
|
96
112
|
var value = data[rowIndex].email.raw;
|
|
97
113
|
return ___EmotionJSX(Component, {
|
|
@@ -122,10 +138,10 @@ var columns = [{
|
|
|
122
138
|
color: 'text'
|
|
123
139
|
}]
|
|
124
140
|
},
|
|
125
|
-
cellActions: [function (
|
|
126
|
-
var rowIndex =
|
|
127
|
-
Component =
|
|
128
|
-
isExpanded =
|
|
141
|
+
cellActions: [function (_ref4) {
|
|
142
|
+
var rowIndex = _ref4.rowIndex,
|
|
143
|
+
Component = _ref4.Component,
|
|
144
|
+
isExpanded = _ref4.isExpanded;
|
|
129
145
|
var data = raw_data;
|
|
130
146
|
var value = data[rowIndex].account;
|
|
131
147
|
var onClick = isExpanded ? function () {
|
|
@@ -149,11 +165,12 @@ var columns = [{
|
|
|
149
165
|
defaultSortDirection: 'desc',
|
|
150
166
|
initialWidth: 70,
|
|
151
167
|
isResizable: false,
|
|
152
|
-
actions: false
|
|
168
|
+
actions: false,
|
|
169
|
+
schema: 'version' // Custom schema + CSS
|
|
153
170
|
}];
|
|
154
|
-
var RenderCellValue = function RenderCellValue(
|
|
155
|
-
var rowIndex =
|
|
156
|
-
columnId =
|
|
171
|
+
var RenderCellValue = function RenderCellValue(_ref5) {
|
|
172
|
+
var rowIndex = _ref5.rowIndex,
|
|
173
|
+
columnId = _ref5.columnId;
|
|
157
174
|
var data = raw_data;
|
|
158
175
|
var row = data[rowIndex];
|
|
159
176
|
var columnName = columnId;
|
|
@@ -169,30 +186,49 @@ var RenderCellValue = function RenderCellValue(_ref4) {
|
|
|
169
186
|
};
|
|
170
187
|
export var defaultStorybookArgs = {
|
|
171
188
|
'aria-label': 'EuiDataGrid',
|
|
189
|
+
css: process.env.NODE_ENV === "production" ? {
|
|
190
|
+
name: "1h7lf59-css",
|
|
191
|
+
styles: ".euiDataGridRowCell--version,.euiDataGridHeaderCell--version{text-align:center;};label:css;"
|
|
192
|
+
} : {
|
|
193
|
+
name: "1h7lf59-css",
|
|
194
|
+
styles: ".euiDataGridRowCell--version,.euiDataGridHeaderCell--version{text-align:center;};label:css;",
|
|
195
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
196
|
+
},
|
|
172
197
|
columns: columns,
|
|
173
198
|
rowCount: 10,
|
|
174
199
|
renderCellValue: RenderCellValue,
|
|
175
200
|
trailingControlColumns: [{
|
|
176
201
|
id: 'trailing-actions',
|
|
177
|
-
width:
|
|
202
|
+
width: 64,
|
|
178
203
|
headerCellRender: function headerCellRender() {
|
|
179
|
-
return ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, "
|
|
204
|
+
return ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, "Row actions"));
|
|
180
205
|
},
|
|
181
206
|
rowCellRender: function rowCellRender() {
|
|
182
|
-
return ___EmotionJSX(EuiButtonIcon, {
|
|
183
|
-
iconType: "
|
|
184
|
-
|
|
207
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiButtonIcon, {
|
|
208
|
+
iconType: "indexEdit",
|
|
209
|
+
"aria-label": "Edit row"
|
|
210
|
+
}), ___EmotionJSX(EuiButtonIcon, {
|
|
211
|
+
iconType: "boxesHorizontal",
|
|
212
|
+
"aria-label": "Open actions popover"
|
|
213
|
+
}));
|
|
185
214
|
}
|
|
186
215
|
}],
|
|
187
216
|
leadingControlColumns: [{
|
|
188
217
|
id: 'leading-actions',
|
|
189
|
-
width:
|
|
218
|
+
width: 32,
|
|
190
219
|
headerCellRender: function headerCellRender() {
|
|
191
|
-
return ___EmotionJSX(
|
|
220
|
+
return ___EmotionJSX(EuiCheckbox, {
|
|
221
|
+
id: "selectAll",
|
|
222
|
+
"aria-label": "Select all rows",
|
|
223
|
+
onChange: function onChange() {}
|
|
224
|
+
});
|
|
192
225
|
},
|
|
193
|
-
rowCellRender: function rowCellRender() {
|
|
194
|
-
|
|
195
|
-
|
|
226
|
+
rowCellRender: function rowCellRender(_ref6) {
|
|
227
|
+
var rowIndex = _ref6.rowIndex;
|
|
228
|
+
return ___EmotionJSX(EuiCheckbox, {
|
|
229
|
+
id: "selectRow".concat(rowIndex),
|
|
230
|
+
"aria-label": "Select row ".concat(rowIndex + 1),
|
|
231
|
+
onChange: function onChange() {}
|
|
196
232
|
});
|
|
197
233
|
}
|
|
198
234
|
}],
|
|
@@ -294,8 +330,8 @@ export var StatefulDataGrid = function StatefulDataGrid(props) {
|
|
|
294
330
|
}, [sorting]);
|
|
295
331
|
|
|
296
332
|
// Column visibility
|
|
297
|
-
var _useState5 = useState((_columnVisibility$vis = columnVisibility === null || columnVisibility === void 0 ? void 0 : columnVisibility.visibleColumns) !== null && _columnVisibility$vis !== void 0 ? _columnVisibility$vis : columns.map(function (
|
|
298
|
-
var id =
|
|
333
|
+
var _useState5 = useState((_columnVisibility$vis = columnVisibility === null || columnVisibility === void 0 ? void 0 : columnVisibility.visibleColumns) !== null && _columnVisibility$vis !== void 0 ? _columnVisibility$vis : columns.map(function (_ref7) {
|
|
334
|
+
var id = _ref7.id;
|
|
299
335
|
return id;
|
|
300
336
|
}) // initialize to the full set of columns
|
|
301
337
|
),
|
|
@@ -29,9 +29,8 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
32
|
-
import { useForceRender, useLatest
|
|
32
|
+
import { useForceRender, useLatest } from '../../../services';
|
|
33
33
|
import { isNumber, isObject } from '../../../services/predicate';
|
|
34
|
-
import { euiDataGridVariables } from '../data_grid.styles';
|
|
35
34
|
import { DataGridSortedContext } from './sorting';
|
|
36
35
|
var AUTO_HEIGHT = 'auto';
|
|
37
36
|
var DEFAULT_ROW_HEIGHT = 34;
|
|
@@ -39,13 +38,6 @@ export var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
39
38
|
function RowHeightUtils() {
|
|
40
39
|
var _this = this;
|
|
41
40
|
_classCallCheck(this, RowHeightUtils);
|
|
42
|
-
/**
|
|
43
|
-
* Styles utils
|
|
44
|
-
*/
|
|
45
|
-
_defineProperty(this, "styles", {
|
|
46
|
-
paddingTop: 0,
|
|
47
|
-
paddingBottom: 0
|
|
48
|
-
});
|
|
49
41
|
/**
|
|
50
42
|
* Height types
|
|
51
43
|
*/
|
|
@@ -56,8 +48,9 @@ export var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
56
48
|
if (option === AUTO_HEIGHT) {
|
|
57
49
|
return 'auto';
|
|
58
50
|
}
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
var lineCount = _this.getLineCount(option);
|
|
52
|
+
if (lineCount != null) {
|
|
53
|
+
return lineCount > 1 ? 'lineCount' : 'default';
|
|
61
54
|
}
|
|
62
55
|
return 'numerical';
|
|
63
56
|
});
|
|
@@ -100,17 +93,6 @@ export var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
100
93
|
}
|
|
101
94
|
return defaultHeight;
|
|
102
95
|
}
|
|
103
|
-
}, {
|
|
104
|
-
key: "cacheStyles",
|
|
105
|
-
value: function cacheStyles(gridStyles, cellPaddingsMap) {
|
|
106
|
-
var _gridStyles$cellPaddi;
|
|
107
|
-
var paddingSize = (_gridStyles$cellPaddi = gridStyles.cellPadding) !== null && _gridStyles$cellPaddi !== void 0 ? _gridStyles$cellPaddi : 'm';
|
|
108
|
-
var padding = parseFloat(cellPaddingsMap[paddingSize]);
|
|
109
|
-
this.styles = {
|
|
110
|
-
paddingTop: padding,
|
|
111
|
-
paddingBottom: padding
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
96
|
}, {
|
|
115
97
|
key: "getLineCount",
|
|
116
98
|
value:
|
|
@@ -123,11 +105,14 @@ export var RowHeightUtils = /*#__PURE__*/function () {
|
|
|
123
105
|
}
|
|
124
106
|
}, {
|
|
125
107
|
key: "calculateHeightForLineCount",
|
|
126
|
-
value: function calculateHeightForLineCount(cellRef, lineCount
|
|
108
|
+
value: function calculateHeightForLineCount(cellRef, lineCount) {
|
|
127
109
|
var computedStyles = window.getComputedStyle(cellRef, null);
|
|
128
110
|
var lineHeight = parseInt(computedStyles.lineHeight, 10);
|
|
129
111
|
var contentHeight = Math.ceil(lineCount * lineHeight);
|
|
130
|
-
|
|
112
|
+
var padding = parseInt(computedStyles.paddingTop, 10);
|
|
113
|
+
|
|
114
|
+
// Assumes both padding-top and bottom are the same
|
|
115
|
+
return contentHeight + padding * 2;
|
|
131
116
|
}
|
|
132
117
|
|
|
133
118
|
/**
|
|
@@ -285,7 +270,6 @@ export var RowHeightVirtualizationUtils = /*#__PURE__*/function (_RowHeightUtils
|
|
|
285
270
|
export var useRowHeightUtils = function useRowHeightUtils(_ref2) {
|
|
286
271
|
var virtualization = _ref2.virtualization,
|
|
287
272
|
rowHeightsOptions = _ref2.rowHeightsOptions,
|
|
288
|
-
gridStyles = _ref2.gridStyles,
|
|
289
273
|
columns = _ref2.columns;
|
|
290
274
|
var forceRenderRef = useLatest(useForceRender());
|
|
291
275
|
var _useState = useState(function () {
|
|
@@ -313,14 +297,6 @@ export var useRowHeightUtils = function useRowHeightUtils(_ref2) {
|
|
|
313
297
|
// Dependencies
|
|
314
298
|
rowHeightUtils, forceRenderRef]);
|
|
315
299
|
|
|
316
|
-
// Re-cache styles whenever grid density changes
|
|
317
|
-
var styleVars = useEuiMemoizedStyles(euiDataGridVariables);
|
|
318
|
-
useEffect(function () {
|
|
319
|
-
rowHeightUtils.cacheStyles({
|
|
320
|
-
cellPadding: gridStyles.cellPadding
|
|
321
|
-
}, styleVars.cellPadding);
|
|
322
|
-
}, [gridStyles.cellPadding, rowHeightUtils, styleVars.cellPadding]);
|
|
323
|
-
|
|
324
300
|
// Update row heights map to remove hidden columns whenever orderedVisibleColumns change
|
|
325
301
|
useEffect(function () {
|
|
326
302
|
rowHeightUtils.pruneHiddenColumnHeights(columns);
|
|
@@ -200,7 +200,7 @@ export var EuiDatePicker = function EuiDatePicker(_ref) {
|
|
|
200
200
|
className: classes
|
|
201
201
|
}, ___EmotionJSX(EuiFormControlLayout, _extends({
|
|
202
202
|
icon: optionalIcon,
|
|
203
|
-
clear: selected && onClear ? {
|
|
203
|
+
clear: selected && !disabled && onClear ? {
|
|
204
204
|
onClick: onClear
|
|
205
205
|
} : undefined,
|
|
206
206
|
isLoading: isLoading,
|
|
@@ -14,6 +14,7 @@ import { EuiGlobalStyles } from '../../global_styling/reset/global_styles';
|
|
|
14
14
|
import { EuiUtilityClasses } from '../../global_styling/utility/utility';
|
|
15
15
|
import { EuiThemeAmsterdam } from '../../themes';
|
|
16
16
|
import { EuiCacheProvider } from './cache';
|
|
17
|
+
import { EuiSystemColorModeProvider } from './system_color_mode';
|
|
17
18
|
import { EuiProviderNestedCheck, useIsNestedEuiProvider } from './nested';
|
|
18
19
|
import { EuiComponentDefaultsProvider } from './component_defaults';
|
|
19
20
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -64,17 +65,19 @@ export var EuiProvider = function EuiProvider(_ref) {
|
|
|
64
65
|
}
|
|
65
66
|
return ___EmotionJSX(EuiProviderNestedCheck, null, ___EmotionJSX(EuiCacheProvider, {
|
|
66
67
|
cache: (_defaultCache = defaultCache) !== null && _defaultCache !== void 0 ? _defaultCache : fallbackCache
|
|
67
|
-
}, ___EmotionJSX(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
}, ___EmotionJSX(EuiSystemColorModeProvider, null, function (systemColorMode) {
|
|
69
|
+
return ___EmotionJSX(EuiThemeProvider, {
|
|
70
|
+
theme: theme !== null && theme !== void 0 ? theme : undefined,
|
|
71
|
+
colorMode: colorMode !== null && colorMode !== void 0 ? colorMode : systemColorMode,
|
|
72
|
+
modify: modify
|
|
73
|
+
}, theme && ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiCacheProvider, {
|
|
74
|
+
cache: globalCache,
|
|
75
|
+
children: Globals && ___EmotionJSX(Globals, null)
|
|
76
|
+
}), ___EmotionJSX(EuiCacheProvider, {
|
|
77
|
+
cache: utilityCache,
|
|
78
|
+
children: Utilities && ___EmotionJSX(Utilities, null)
|
|
79
|
+
})), ___EmotionJSX(EuiComponentDefaultsProvider, {
|
|
80
|
+
componentDefaults: componentDefaults
|
|
81
|
+
}, children));
|
|
82
|
+
})));
|
|
80
83
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export { EuiSystemColorModeProvider } from './system_color_mode_provider';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
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; } }
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
/*
|
|
8
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
9
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
10
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
11
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
12
|
+
* Side Public License, v 1.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { useState, useEffect } from 'react';
|
|
16
|
+
import PropTypes from "prop-types";
|
|
17
|
+
export var COLOR_MODE_MEDIA_QUERY = '(prefers-color-scheme: dark)';
|
|
18
|
+
export var EuiSystemColorModeProvider = function EuiSystemColorModeProvider(_ref) {
|
|
19
|
+
var children = _ref.children;
|
|
20
|
+
// Use optional chaining here for SSR or test environments
|
|
21
|
+
var _useState = useState(function () {
|
|
22
|
+
var _window, _window$matchMedia;
|
|
23
|
+
return (_window = window) !== null && _window !== void 0 && (_window$matchMedia = _window.matchMedia) !== null && _window$matchMedia !== void 0 && _window$matchMedia.call(_window, COLOR_MODE_MEDIA_QUERY).matches ? 'DARK' : 'LIGHT';
|
|
24
|
+
}),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
systemColorMode = _useState2[0],
|
|
27
|
+
setSystemColorMode = _useState2[1];
|
|
28
|
+
|
|
29
|
+
// Listen for system changes
|
|
30
|
+
useEffect(function () {
|
|
31
|
+
var _window$matchMedia2, _window2, _window$matchMedia2$c, _window$matchMedia2$c2;
|
|
32
|
+
var eventListener = function eventListener(event) {
|
|
33
|
+
setSystemColorMode(event.matches ? 'DARK' : 'LIGHT');
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Optional chaining here is for test environments - SSR should not run useEffect
|
|
37
|
+
(_window$matchMedia2 = (_window2 = window).matchMedia) === null || _window$matchMedia2 === void 0 || (_window$matchMedia2$c = (_window$matchMedia2$c2 = _window$matchMedia2.call(_window2, COLOR_MODE_MEDIA_QUERY)).addEventListener) === null || _window$matchMedia2$c === void 0 || _window$matchMedia2$c.call(_window$matchMedia2$c2, 'change', eventListener);
|
|
38
|
+
|
|
39
|
+
// Clean up the listener on unmount
|
|
40
|
+
return function () {
|
|
41
|
+
var _window$matchMedia3, _window3, _window$matchMedia3$c, _window$matchMedia3$c2;
|
|
42
|
+
(_window$matchMedia3 = (_window3 = window).matchMedia) === null || _window$matchMedia3 === void 0 || (_window$matchMedia3$c = (_window$matchMedia3$c2 = _window$matchMedia3.call(_window3, COLOR_MODE_MEDIA_QUERY)).removeEventListener) === null || _window$matchMedia3$c === void 0 || _window$matchMedia3$c.call(_window$matchMedia3$c2, 'change', eventListener);
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
return children(systemColorMode);
|
|
46
|
+
};
|
|
47
|
+
EuiSystemColorModeProvider.propTypes = {
|
|
48
|
+
children: PropTypes.func.isRequired
|
|
49
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["isHorizontal", "indicator", "alignIndicator", "className"],
|
|
1
|
+
var _excluded = ["isHorizontal", "indicator", "alignIndicator", "accountForScrollbars", "className"],
|
|
2
2
|
_excluded2 = ["registration", "id", "disabled", "onFocus"];
|
|
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
@@ -35,12 +35,13 @@ export var EuiResizableButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
35
35
|
indicator = _ref$indicator === void 0 ? 'handle' : _ref$indicator,
|
|
36
36
|
_ref$alignIndicator = _ref.alignIndicator,
|
|
37
37
|
alignIndicator = _ref$alignIndicator === void 0 ? 'center' : _ref$alignIndicator,
|
|
38
|
+
accountForScrollbars = _ref.accountForScrollbars,
|
|
38
39
|
className = _ref.className,
|
|
39
40
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
40
41
|
var classes = classNames('euiResizableButton', className);
|
|
41
42
|
var resizeDirection = isHorizontal ? 'horizontal' : 'vertical';
|
|
42
43
|
var styles = useEuiMemoizedStyles(euiResizableButtonStyles);
|
|
43
|
-
var cssStyles = [styles.euiResizableButton, styles[indicator], styles["".concat(indicator, "Direction")][resizeDirection], styles[resizeDirection], indicator === 'handle' && styles.alignIndicator[alignIndicator]];
|
|
44
|
+
var cssStyles = [styles.euiResizableButton, styles[indicator], styles["".concat(indicator, "Direction")][resizeDirection], styles[resizeDirection], indicator === 'handle' && styles.alignIndicator[alignIndicator], styles.accountForScrollbars[resizeDirection][accountForScrollbars !== null && accountForScrollbars !== void 0 ? accountForScrollbars : 'none']];
|
|
44
45
|
return ___EmotionJSX(EuiI18n, {
|
|
45
46
|
tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
|
|
46
47
|
defaults: ['Press the left or right arrow keys to adjust panels size', 'Press the up or down arrow keys to adjust panels size']
|
|
@@ -79,6 +80,12 @@ EuiResizableButton.propTypes = {
|
|
|
79
80
|
* tall content that scrolls off-screen
|
|
80
81
|
*/
|
|
81
82
|
alignIndicator: PropTypes.oneOf(["center", "start", "end"]),
|
|
83
|
+
/**
|
|
84
|
+
* By default, EuiResizableButton will overlap into the panels before/after it.
|
|
85
|
+
* This can occasionally occlude interactive elements like scrollbars. To prevent
|
|
86
|
+
* this overlap, use this prop to remove the overlap for the specified side.
|
|
87
|
+
*/
|
|
88
|
+
accountForScrollbars: PropTypes.oneOf(["before", "after", "both"]),
|
|
82
89
|
/**
|
|
83
90
|
* When disabled, the resizer button will be completely hidden
|
|
84
91
|
*/
|
|
@@ -37,6 +37,9 @@ var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
|
37
37
|
export var euiResizableButtonStyles = function euiResizableButtonStyles(euiThemeContext) {
|
|
38
38
|
var euiTheme = euiThemeContext.euiTheme;
|
|
39
39
|
var buttonSize = euiTheme.size.base;
|
|
40
|
+
var negativeMargin = mathWithUnits(buttonSize, function (x) {
|
|
41
|
+
return x / -2;
|
|
42
|
+
});
|
|
40
43
|
var grabHandleWidth = euiTheme.size.m;
|
|
41
44
|
var grabHandleHeight = euiTheme.border.width.thin;
|
|
42
45
|
var transitionSpeed = euiTheme.animation.fast;
|
|
@@ -49,12 +52,22 @@ export var euiResizableButtonStyles = function euiResizableButtonStyles(euiTheme
|
|
|
49
52
|
euiResizableButton: /*#__PURE__*/css("z-index:1;flex-shrink:0;display:flex;justify-content:center;&:disabled{display:none;}&::before,&::after{content:'';display:block;", euiCanAnimate, "{transition:width ", transition, ",height ", transition, ",margin ", transition, ",background-color ", transition, ";}}&:hover{&::before,&::after{background-color:", euiTheme.colors.mediumShade, ";}}&:focus,&:active{background-color:", transparentize(euiTheme.colors.primary, 0.1), ";&::before,&::after{background-color:", euiTheme.colors.primary, ";", euiCanAnimate, "{transition:width ", transition, ",height ", transition, ";transition-delay:", mathWithUnits(transitionSpeed, function (x) {
|
|
50
53
|
return x / 2;
|
|
51
54
|
}), ";}}};label:euiResizableButton;"),
|
|
52
|
-
horizontal: /*#__PURE__*/css("cursor:col-resize;", logicalCSS('height', '100%'), " ", logicalCSS('width', buttonSize), "
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
horizontal: /*#__PURE__*/css("cursor:col-resize;", logicalCSS('height', '100%'), " ", logicalCSS('width', buttonSize), ";;label:horizontal;"),
|
|
56
|
+
vertical: /*#__PURE__*/css("flex-direction:column;cursor:row-resize;", logicalCSS('width', '100%'), " ", logicalCSS('height', buttonSize), ";;label:vertical;"),
|
|
57
|
+
accountForScrollbars: {
|
|
58
|
+
horizontal: {
|
|
59
|
+
both: /*#__PURE__*/css(";label:both;"),
|
|
60
|
+
before: /*#__PURE__*/css(logicalCSS('margin-right', negativeMargin), ";label:before;"),
|
|
61
|
+
after: /*#__PURE__*/css(logicalCSS('margin-left', negativeMargin), ";label:after;"),
|
|
62
|
+
none: /*#__PURE__*/css(logicalCSS('margin-horizontal', negativeMargin), ";label:none;")
|
|
63
|
+
},
|
|
64
|
+
vertical: {
|
|
65
|
+
both: /*#__PURE__*/css(";label:both;"),
|
|
66
|
+
before: /*#__PURE__*/css(logicalCSS('margin-bottom', negativeMargin), ";label:before;"),
|
|
67
|
+
after: /*#__PURE__*/css(logicalCSS('margin-top', negativeMargin), ";label:after;"),
|
|
68
|
+
none: /*#__PURE__*/css(logicalCSS('margin-vertical', negativeMargin), ";label:none;")
|
|
69
|
+
}
|
|
70
|
+
},
|
|
58
71
|
border: /*#__PURE__*/css("&::before,&::after{background-color:", euiTheme.border.color, ";};label:border;"),
|
|
59
72
|
borderDirection: {
|
|
60
73
|
horizontal: /*#__PURE__*/css("&::before{", logicalCSS('width', euiTheme.border.width.thin), " ", logicalCSS('height', '100%'), ";}&:hover,&:focus,&:active{&::after{", logicalCSS('width', euiTheme.border.width.thin), " ", logicalCSS('height', '100%'), ";}};label:horizontal;"),
|