@elastic/eui 92.0.0 → 92.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui_theme_dark.css +3 -18
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +3 -18
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/aspect_ratio/aspect_ratio.js +1 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
- package/es/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
- package/es/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +111 -244
- package/es/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
- package/es/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
- package/es/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
- package/es/components/datagrid/body/cell/focus_utils.js +166 -0
- package/es/components/datagrid/body/cell/index.js +11 -0
- package/es/components/datagrid/body/data_grid_body.js +0 -2
- package/es/components/datagrid/body/data_grid_body_custom.js +1 -7
- package/es/components/datagrid/body/data_grid_body_virtualized.js +1 -7
- package/es/components/datagrid/body/footer/data_grid_footer_row.js +1 -2
- package/es/components/datagrid/body/header/data_grid_control_header_cell.js +3 -6
- package/es/components/datagrid/body/header/data_grid_header_cell.js +27 -12
- package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +45 -116
- package/es/components/datagrid/body/header/data_grid_header_row.js +5 -10
- package/es/components/datagrid/body/header/use_data_grid_header.js +3 -14
- package/es/components/datagrid/data_grid.js +2 -12
- package/es/components/datagrid/utils/focus.js +25 -54
- package/es/components/datagrid/utils/scrolling.js +1 -1
- package/es/components/flyout/flyout_resizable.js +10 -10
- package/es/components/flyout/flyout_resizable.styles.js +12 -6
- package/es/components/resizable_container/helpers.js +5 -6
- package/es/components/resizable_container/resizable_button.js +13 -4
- package/es/components/resizable_container/resizable_button.styles.js +18 -8
- package/es/components/resizable_container/resizable_container.js +28 -22
- package/es/components/steps/step_number.styles.js +6 -7
- package/es/components/tree_view/tree_view.js +9 -2
- package/eui.d.ts +130 -90
- package/i18ntokens.json +108 -72
- package/lib/components/aspect_ratio/aspect_ratio.js +1 -1
- package/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
- package/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
- package/lib/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +111 -244
- package/lib/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
- package/lib/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
- package/lib/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
- package/lib/components/datagrid/body/cell/focus_utils.js +174 -0
- package/lib/components/datagrid/body/cell/index.js +32 -0
- package/lib/components/datagrid/body/data_grid_body.js +0 -2
- package/lib/components/datagrid/body/data_grid_body_custom.js +2 -8
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +2 -8
- package/lib/components/datagrid/body/footer/data_grid_footer_row.js +5 -6
- package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +3 -6
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +35 -20
- package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +47 -119
- package/lib/components/datagrid/body/header/data_grid_header_row.js +5 -10
- package/lib/components/datagrid/body/header/use_data_grid_header.js +10 -24
- package/lib/components/datagrid/data_grid.js +4 -14
- package/lib/components/datagrid/utils/focus.js +26 -56
- package/lib/components/datagrid/utils/scrolling.js +2 -2
- package/lib/components/flyout/flyout_resizable.js +10 -10
- package/lib/components/flyout/flyout_resizable.styles.js +12 -6
- package/lib/components/resizable_container/helpers.js +7 -7
- package/lib/components/resizable_container/resizable_button.js +13 -4
- package/lib/components/resizable_container/resizable_button.styles.js +18 -8
- package/lib/components/resizable_container/resizable_container.js +28 -22
- package/lib/components/steps/step_number.styles.js +6 -7
- package/lib/components/tree_view/tree_view.js +9 -2
- package/optimize/es/components/aspect_ratio/aspect_ratio.js +1 -1
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
- package/optimize/es/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +111 -244
- package/optimize/es/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
- package/optimize/es/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
- package/optimize/es/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
- package/optimize/es/components/datagrid/body/cell/focus_utils.js +153 -0
- package/optimize/es/components/datagrid/body/cell/index.js +11 -0
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +1 -5
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +1 -5
- package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +1 -2
- package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -4
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +25 -10
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +41 -115
- package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +4 -8
- package/optimize/es/components/datagrid/body/header/use_data_grid_header.js +3 -13
- package/optimize/es/components/datagrid/data_grid.js +2 -12
- package/optimize/es/components/datagrid/utils/focus.js +25 -54
- package/optimize/es/components/datagrid/utils/scrolling.js +1 -1
- package/optimize/es/components/flyout/flyout_resizable.js +10 -10
- package/optimize/es/components/flyout/flyout_resizable.styles.js +12 -6
- package/optimize/es/components/resizable_container/helpers.js +5 -6
- package/optimize/es/components/resizable_container/resizable_button.js +5 -2
- package/optimize/es/components/resizable_container/resizable_button.styles.js +18 -8
- package/optimize/es/components/resizable_container/resizable_container.js +28 -22
- package/optimize/es/components/steps/step_number.styles.js +6 -7
- package/optimize/es/components/tree_view/tree_view.js +9 -2
- package/optimize/lib/components/aspect_ratio/aspect_ratio.js +1 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
- package/optimize/lib/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +111 -244
- package/optimize/lib/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
- package/optimize/lib/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
- package/optimize/lib/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
- package/optimize/lib/components/datagrid/body/cell/focus_utils.js +163 -0
- package/optimize/lib/components/datagrid/body/cell/index.js +32 -0
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +2 -6
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +2 -6
- package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +5 -6
- package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -4
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +25 -10
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +41 -115
- package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +4 -8
- package/optimize/lib/components/datagrid/body/header/use_data_grid_header.js +4 -14
- package/optimize/lib/components/datagrid/data_grid.js +4 -14
- package/optimize/lib/components/datagrid/utils/focus.js +26 -56
- package/optimize/lib/components/datagrid/utils/scrolling.js +2 -2
- package/optimize/lib/components/flyout/flyout_resizable.js +10 -10
- package/optimize/lib/components/flyout/flyout_resizable.styles.js +12 -6
- package/optimize/lib/components/resizable_container/helpers.js +7 -7
- package/optimize/lib/components/resizable_container/resizable_button.js +5 -2
- package/optimize/lib/components/resizable_container/resizable_button.styles.js +18 -8
- package/optimize/lib/components/resizable_container/resizable_container.js +28 -22
- package/optimize/lib/components/steps/step_number.styles.js +6 -7
- package/optimize/lib/components/tree_view/tree_view.js +9 -2
- package/package.json +1 -1
- package/src/components/datagrid/body/header/_data_grid_header_row.scss +8 -7
- package/test-env/components/aspect_ratio/aspect_ratio.js +1 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
- package/test-env/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
- package/test-env/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +111 -244
- package/test-env/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
- package/test-env/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
- package/test-env/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
- package/test-env/components/datagrid/body/cell/focus_utils.js +172 -0
- package/test-env/components/datagrid/body/cell/index.js +32 -0
- package/test-env/components/datagrid/body/data_grid_body.js +0 -2
- package/test-env/components/datagrid/body/data_grid_body_custom.js +2 -8
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +2 -8
- package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +5 -6
- package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +3 -6
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +25 -10
- package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +44 -116
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +5 -10
- package/test-env/components/datagrid/body/header/use_data_grid_header.js +4 -14
- package/test-env/components/datagrid/data_grid.js +4 -14
- package/test-env/components/datagrid/utils/focus.js +26 -56
- package/test-env/components/datagrid/utils/scrolling.js +2 -2
- package/test-env/components/flyout/flyout_resizable.js +10 -10
- package/test-env/components/flyout/flyout_resizable.styles.js +12 -6
- package/test-env/components/resizable_container/helpers.js +7 -7
- package/test-env/components/resizable_container/resizable_button.js +13 -4
- package/test-env/components/resizable_container/resizable_button.styles.js +18 -8
- package/test-env/components/resizable_container/resizable_container.js +28 -22
- package/test-env/components/steps/step_number.styles.js +6 -7
- package/test-env/components/tree_view/tree_view.js +9 -2
- package/es/components/datagrid/body/header/header_is_interactive.js +0 -58
- package/lib/components/datagrid/body/header/header_is_interactive.js +0 -63
- package/optimize/es/components/datagrid/body/header/header_is_interactive.js +0 -53
- package/optimize/lib/components/datagrid/body/header/header_is_interactive.js +0 -61
- package/test-env/components/datagrid/body/header/header_is_interactive.js +0 -61
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "schemaDetectors", "columnWidths", "defaultColumnWidth", "className", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "
|
|
1
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "schemaDetectors", "columnWidths", "defaultColumnWidth", "className", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "data-test-subj"];
|
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -31,7 +31,6 @@ var EuiDataGridHeaderRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
31
31
|
setColumnWidth = props.setColumnWidth,
|
|
32
32
|
setVisibleColumns = props.setVisibleColumns,
|
|
33
33
|
switchColumnPos = props.switchColumnPos,
|
|
34
|
-
headerIsInteractive = props.headerIsInteractive,
|
|
35
34
|
_dataTestSubj = props['data-test-subj'],
|
|
36
35
|
rest = _objectWithoutProperties(props, _excluded);
|
|
37
36
|
var classes = classnames('euiDataGridHeader', className);
|
|
@@ -45,8 +44,7 @@ var EuiDataGridHeaderRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
45
44
|
return ___EmotionJSX(EuiDataGridControlHeaderCell, {
|
|
46
45
|
key: controlColumn.id,
|
|
47
46
|
index: index,
|
|
48
|
-
controlColumn: controlColumn
|
|
49
|
-
headerIsInteractive: headerIsInteractive
|
|
47
|
+
controlColumn: controlColumn
|
|
50
48
|
});
|
|
51
49
|
}), columns.map(function (column, index) {
|
|
52
50
|
return ___EmotionJSX(EuiDataGridHeaderCell, {
|
|
@@ -60,15 +58,13 @@ var EuiDataGridHeaderRow = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
60
58
|
setColumnWidth: setColumnWidth,
|
|
61
59
|
setVisibleColumns: setVisibleColumns,
|
|
62
60
|
switchColumnPos: switchColumnPos,
|
|
63
|
-
defaultColumnWidth: defaultColumnWidth
|
|
64
|
-
headerIsInteractive: headerIsInteractive
|
|
61
|
+
defaultColumnWidth: defaultColumnWidth
|
|
65
62
|
});
|
|
66
63
|
}), trailingControlColumns.map(function (controlColumn, index) {
|
|
67
64
|
return ___EmotionJSX(EuiDataGridControlHeaderCell, {
|
|
68
65
|
key: controlColumn.id,
|
|
69
66
|
index: index + leadingControlColumns.length + columns.length,
|
|
70
|
-
controlColumn: controlColumn
|
|
71
|
-
headerIsInteractive: headerIsInteractive
|
|
67
|
+
controlColumn: controlColumn
|
|
72
68
|
});
|
|
73
69
|
}));
|
|
74
70
|
});
|
|
@@ -607,8 +603,7 @@ EuiDataGridHeaderRow.propTypes = {
|
|
|
607
603
|
defaultColumnWidth: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.oneOf([null])]),
|
|
608
604
|
setColumnWidth: PropTypes.func.isRequired,
|
|
609
605
|
setVisibleColumns: PropTypes.func.isRequired,
|
|
610
|
-
switchColumnPos: PropTypes.func.isRequired
|
|
611
|
-
headerIsInteractive: PropTypes.bool.isRequired
|
|
606
|
+
switchColumnPos: PropTypes.func.isRequired
|
|
612
607
|
};
|
|
613
608
|
EuiDataGridHeaderRow.displayName = 'EuiDataGridHeaderRow';
|
|
614
609
|
export { EuiDataGridHeaderRow };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _excluded = ["handleHeaderMutation"];
|
|
2
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
2
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
3
|
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."); }
|
|
@@ -6,8 +5,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
6
5
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
6
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
8
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
8
|
/*
|
|
12
9
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
13
10
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -17,25 +14,18 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
17
14
|
*/
|
|
18
15
|
|
|
19
16
|
import React, { useState, useMemo } from 'react';
|
|
20
|
-
import { useMutationObserver } from '../../../observer/mutation_observer';
|
|
21
17
|
import { useResizeObserver } from '../../../observer/resize_observer';
|
|
22
|
-
import { useHeaderFocusWorkaround } from '../../utils/focus';
|
|
23
18
|
import { EuiDataGridHeaderRow } from './data_grid_header_row';
|
|
24
|
-
|
|
19
|
+
|
|
25
20
|
/**
|
|
26
21
|
* DRY out setting up the grid header and its refs & observers
|
|
27
22
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
24
|
+
export var useDataGridHeader = function useDataGridHeader(props) {
|
|
31
25
|
var _useState = useState(null),
|
|
32
26
|
_useState2 = _slicedToArray(_useState, 2),
|
|
33
27
|
headerRowRef = _useState2[0],
|
|
34
28
|
setHeaderRowRef = _useState2[1];
|
|
35
|
-
useMutationObserver(headerRowRef, handleHeaderMutation, {
|
|
36
|
-
subtree: true,
|
|
37
|
-
childList: true
|
|
38
|
-
});
|
|
39
29
|
var _useResizeObserver = useResizeObserver(headerRowRef, 'height'),
|
|
40
30
|
headerRowHeight = _useResizeObserver.height;
|
|
41
31
|
var headerRow = useMemo(function () {
|
|
@@ -44,7 +34,6 @@ export var useDataGridHeader = function useDataGridHeader(_ref) {
|
|
|
44
34
|
}, props));
|
|
45
35
|
}, Object.values(props)); // eslint-disable-line react-hooks/exhaustive-deps
|
|
46
36
|
|
|
47
|
-
useHeaderFocusWorkaround(props.headerIsInteractive);
|
|
48
37
|
return {
|
|
49
38
|
headerRow: headerRow,
|
|
50
39
|
headerRowHeight: headerRowHeight
|
|
@@ -40,8 +40,7 @@ import { useDataGridColumnSelector, useDataGridColumnSorting, useDataGridDisplay
|
|
|
40
40
|
import { DataGridSortingContext, useSorting } from './utils/sorting';
|
|
41
41
|
import { DataGridFocusContext, useFocus, createKeyDownHandler, preventTabbing } from './utils/focus';
|
|
42
42
|
import { useInMemoryValues, EuiDataGridInMemoryRenderer } from './utils/in_memory';
|
|
43
|
-
import {
|
|
44
|
-
import { DataGridCellPopoverContext, useCellPopover } from './body/data_grid_cell_popover';
|
|
43
|
+
import { DataGridCellPopoverContext, useCellPopover } from './body/cell';
|
|
45
44
|
import { computeVisibleRows } from './utils/row_count';
|
|
46
45
|
import { EuiDataGridPaginationRenderer } from './utils/data_grid_pagination';
|
|
47
46
|
import { schemaDetectors as providedSchemaDetectors, useMergedSchema } from './utils/data_grid_schema';
|
|
@@ -211,13 +210,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
211
210
|
/**
|
|
212
211
|
* Focus
|
|
213
212
|
*/
|
|
214
|
-
var
|
|
215
|
-
headerIsInteractive = _useHeaderIsInteracti.headerIsInteractive,
|
|
216
|
-
handleHeaderMutation = _useHeaderIsInteracti.handleHeaderMutation;
|
|
217
|
-
var _useFocus = useFocus({
|
|
218
|
-
headerIsInteractive: headerIsInteractive,
|
|
219
|
-
gridItemsRendered: gridItemsRendered
|
|
220
|
-
}),
|
|
213
|
+
var _useFocus = useFocus(),
|
|
221
214
|
wrappingDivFocusProps = _useFocus.focusProps,
|
|
222
215
|
focusContext = _objectWithoutProperties(_useFocus, _excluded2);
|
|
223
216
|
|
|
@@ -345,7 +338,6 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
345
338
|
rowCount: rowCount,
|
|
346
339
|
pagination: pagination,
|
|
347
340
|
hasFooter: !!renderFooterCellValue,
|
|
348
|
-
headerIsInteractive: headerIsInteractive,
|
|
349
341
|
focusContext: focusContext
|
|
350
342
|
}),
|
|
351
343
|
"data-test-subj": "euiDataGridBody",
|
|
@@ -362,8 +354,6 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
362
354
|
setVisibleColumns: setVisibleColumns,
|
|
363
355
|
switchColumnPos: switchColumnPos,
|
|
364
356
|
onColumnResize: onColumnResize,
|
|
365
|
-
headerIsInteractive: headerIsInteractive,
|
|
366
|
-
handleHeaderMutation: handleHeaderMutation,
|
|
367
357
|
schemaDetectors: allSchemaDetectors,
|
|
368
358
|
pagination: pagination,
|
|
369
359
|
renderCellValue: renderCellValue,
|
|
@@ -12,7 +12,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
12
12
|
* Side Public License, v 1.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import { createContext,
|
|
15
|
+
import { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
16
16
|
import { tabbable } from 'tabbable';
|
|
17
17
|
import { keys } from '../../../services';
|
|
18
18
|
export var DataGridFocusContext = /*#__PURE__*/createContext({
|
|
@@ -27,9 +27,7 @@ export var DataGridFocusContext = /*#__PURE__*/createContext({
|
|
|
27
27
|
/**
|
|
28
28
|
* Main focus context and overarching focus state management
|
|
29
29
|
*/
|
|
30
|
-
export var useFocus = function useFocus(
|
|
31
|
-
var headerIsInteractive = _ref.headerIsInteractive,
|
|
32
|
-
gridItemsRendered = _ref.gridItemsRendered;
|
|
30
|
+
export var useFocus = function useFocus() {
|
|
33
31
|
// Maintain a map of focus cell state callbacks
|
|
34
32
|
var cellsUpdateFocus = useRef(new Map());
|
|
35
33
|
var onFocusUpdate = useCallback(function (cell, updateFocus) {
|
|
@@ -50,14 +48,17 @@ export var useFocus = function useFocus(_ref) {
|
|
|
50
48
|
focusedCell = _useState4[0],
|
|
51
49
|
_setFocusedCell = _useState4[1];
|
|
52
50
|
var setFocusedCell = useCallback(function (nextFocusedCell) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
_setFocusedCell(function (prevFocusedCell) {
|
|
52
|
+
// If the x/y coordinates remained the same, don't update. This keeps the focusedCell
|
|
53
|
+
// reference stable, and allows it to be used in places that need reference equality.
|
|
54
|
+
if (nextFocusedCell[0] === (prevFocusedCell === null || prevFocusedCell === void 0 ? void 0 : prevFocusedCell[0]) && nextFocusedCell[1] === (prevFocusedCell === null || prevFocusedCell === void 0 ? void 0 : prevFocusedCell[1])) {
|
|
55
|
+
return prevFocusedCell;
|
|
56
|
+
} else {
|
|
57
|
+
setIsFocusedCellInView(true); // scrolling.ts ensures focused cells are fully in view
|
|
58
|
+
return nextFocusedCell;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}, []);
|
|
61
62
|
var previousCell = useRef(undefined);
|
|
62
63
|
useEffect(function () {
|
|
63
64
|
if (previousCell.current) {
|
|
@@ -69,19 +70,8 @@ export var useFocus = function useFocus(_ref) {
|
|
|
69
70
|
}
|
|
70
71
|
}, [cellsUpdateFocus, focusedCell]);
|
|
71
72
|
var focusFirstVisibleInteractiveCell = useCallback(function () {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
setFocusedCell([0, -1]);
|
|
75
|
-
} else if (gridItemsRendered.current) {
|
|
76
|
-
var _gridItemsRendered$cu = gridItemsRendered.current,
|
|
77
|
-
visibleColumnStartIndex = _gridItemsRendered$cu.visibleColumnStartIndex,
|
|
78
|
-
visibleRowStartIndex = _gridItemsRendered$cu.visibleRowStartIndex;
|
|
79
|
-
setFocusedCell([visibleColumnStartIndex, visibleRowStartIndex]);
|
|
80
|
-
} else {
|
|
81
|
-
// If the header is non-interactive and there are no rendered cells,
|
|
82
|
-
// there's nothing to do - we might as well leave focus on the grid body wrapper
|
|
83
|
-
}
|
|
84
|
-
}, [setFocusedCell, headerIsInteractive, gridItemsRendered]);
|
|
73
|
+
setFocusedCell([0, -1]);
|
|
74
|
+
}, [setFocusedCell]);
|
|
85
75
|
var focusProps = useMemo(function () {
|
|
86
76
|
return isFocusedCellInView ? {
|
|
87
77
|
// FireFox allows tabbing to a div that is scrollable, while Chrome does not
|
|
@@ -122,16 +112,15 @@ export var notifyCellOfFocusState = function notifyCellOfFocusState(cellsUpdateF
|
|
|
122
112
|
/**
|
|
123
113
|
* Keydown handler for connecting focus state with keyboard navigation
|
|
124
114
|
*/
|
|
125
|
-
export var createKeyDownHandler = function createKeyDownHandler(
|
|
126
|
-
var gridElement =
|
|
127
|
-
visibleColCount =
|
|
128
|
-
visibleRowCount =
|
|
129
|
-
visibleRowStartIndex =
|
|
130
|
-
rowCount =
|
|
131
|
-
pagination =
|
|
132
|
-
hasFooter =
|
|
133
|
-
|
|
134
|
-
focusContext = _ref2.focusContext;
|
|
115
|
+
export var createKeyDownHandler = function createKeyDownHandler(_ref) {
|
|
116
|
+
var gridElement = _ref.gridElement,
|
|
117
|
+
visibleColCount = _ref.visibleColCount,
|
|
118
|
+
visibleRowCount = _ref.visibleRowCount,
|
|
119
|
+
visibleRowStartIndex = _ref.visibleRowStartIndex,
|
|
120
|
+
rowCount = _ref.rowCount,
|
|
121
|
+
pagination = _ref.pagination,
|
|
122
|
+
hasFooter = _ref.hasFooter,
|
|
123
|
+
focusContext = _ref.focusContext;
|
|
135
124
|
return function (event) {
|
|
136
125
|
var focusedCell = focusContext.focusedCell,
|
|
137
126
|
setFocusedCell = focusContext.setFocusedCell;
|
|
@@ -165,8 +154,7 @@ export var createKeyDownHandler = function createKeyDownHandler(_ref2) {
|
|
|
165
154
|
}
|
|
166
155
|
} else if (key === keys.ARROW_UP) {
|
|
167
156
|
event.preventDefault();
|
|
168
|
-
|
|
169
|
-
if (y > minimumIndex) {
|
|
157
|
+
if (y > -1) {
|
|
170
158
|
setFocusedCell([x, y - 1]);
|
|
171
159
|
}
|
|
172
160
|
} else if (key === keys.ARROW_RIGHT) {
|
|
@@ -253,21 +241,4 @@ export var getParentCellContent = function getParentCellContent(_element) {
|
|
|
253
241
|
element = element.parentElement;
|
|
254
242
|
}
|
|
255
243
|
return element;
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Focus fixes & workarounds
|
|
260
|
-
*/
|
|
261
|
-
|
|
262
|
-
// If the focus is on the header, and the header is no longer interactive,
|
|
263
|
-
// move the focus down to the first row
|
|
264
|
-
export var useHeaderFocusWorkaround = function useHeaderFocusWorkaround(headerIsInteractive) {
|
|
265
|
-
var _useContext = useContext(DataGridFocusContext),
|
|
266
|
-
focusedCell = _useContext.focusedCell,
|
|
267
|
-
setFocusedCell = _useContext.setFocusedCell;
|
|
268
|
-
useEffect(function () {
|
|
269
|
-
if (!headerIsInteractive && focusedCell && focusedCell[1] === -1) {
|
|
270
|
-
setFocusedCell([focusedCell[0], 0]);
|
|
271
|
-
}
|
|
272
|
-
}, [headerIsInteractive, focusedCell, setFocusedCell]);
|
|
273
244
|
};
|
|
@@ -11,7 +11,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import React, { useContext, useEffect, useCallback, useMemo } from 'react';
|
|
14
|
-
import { DataGridCellPopoverContext } from '../body/
|
|
14
|
+
import { DataGridCellPopoverContext } from '../body/cell';
|
|
15
15
|
import { DataGridFocusContext } from './focus';
|
|
16
16
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
17
17
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["size", "maxWidth", "minWidth", "side", "children"];
|
|
1
|
+
var _excluded = ["size", "maxWidth", "minWidth", "side", "type", "children"];
|
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _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,6 +19,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
19
19
|
import React, { forwardRef, useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
20
20
|
import { keys, useCombinedRefs, useEuiTheme } from '../../services';
|
|
21
21
|
import { EuiResizableButton } from '../resizable_container';
|
|
22
|
+
import { getPosition } from '../resizable_container/helpers';
|
|
22
23
|
import { EuiFlyout } from './flyout';
|
|
23
24
|
import { euiFlyoutResizableButtonStyles } from './flyout_resizable.styles';
|
|
24
25
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -29,11 +30,13 @@ export var EuiFlyoutResizable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
29
30
|
minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
|
|
30
31
|
_ref$side = _ref.side,
|
|
31
32
|
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
33
|
+
_ref$type = _ref.type,
|
|
34
|
+
type = _ref$type === void 0 ? 'overlay' : _ref$type,
|
|
32
35
|
children = _ref.children,
|
|
33
36
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
37
|
var euiTheme = useEuiTheme();
|
|
35
38
|
var styles = euiFlyoutResizableButtonStyles(euiTheme);
|
|
36
|
-
var cssStyles = [styles.euiFlyoutResizableButton, styles[side]];
|
|
39
|
+
var cssStyles = [styles.euiFlyoutResizableButton, styles[type][side]];
|
|
37
40
|
var getFlyoutMinMaxWidth = useCallback(function (width) {
|
|
38
41
|
return Math.min(Math.max(width, minWidth), maxWidth || Infinity, window.innerWidth - 20 // Leave some offset
|
|
39
42
|
);
|
|
@@ -67,7 +70,7 @@ export var EuiFlyoutResizable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
67
70
|
return modifier;
|
|
68
71
|
}, [side, flyoutRef]);
|
|
69
72
|
var onMouseMove = useCallback(function (e) {
|
|
70
|
-
var mouseOffset =
|
|
73
|
+
var mouseOffset = getPosition(e, true) - initialMouseX.current;
|
|
71
74
|
var changedFlyoutWidth = initialWidth.current + mouseOffset * direction;
|
|
72
75
|
setFlyoutWidth(getFlyoutMinMaxWidth(changedFlyoutWidth));
|
|
73
76
|
}, [getFlyoutMinMaxWidth, direction]);
|
|
@@ -80,7 +83,7 @@ export var EuiFlyoutResizable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
80
83
|
}, [onMouseMove]);
|
|
81
84
|
var onMouseDown = useCallback(function (e) {
|
|
82
85
|
var _flyoutRef$offsetWidt;
|
|
83
|
-
initialMouseX.current =
|
|
86
|
+
initialMouseX.current = getPosition(e, true);
|
|
84
87
|
initialWidth.current = (_flyoutRef$offsetWidt = flyoutRef === null || flyoutRef === void 0 ? void 0 : flyoutRef.offsetWidth) !== null && _flyoutRef$offsetWidt !== void 0 ? _flyoutRef$offsetWidt : 0;
|
|
85
88
|
|
|
86
89
|
// Window event listeners instead of React events are used
|
|
@@ -110,18 +113,15 @@ export var EuiFlyoutResizable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
110
113
|
size: flyoutWidth || size,
|
|
111
114
|
maxWidth: maxWidth,
|
|
112
115
|
side: side,
|
|
116
|
+
type: type,
|
|
113
117
|
ref: setRefs
|
|
114
118
|
}), ___EmotionJSX(EuiResizableButton, {
|
|
115
119
|
isHorizontal: true,
|
|
120
|
+
indicator: "border",
|
|
116
121
|
css: cssStyles,
|
|
117
122
|
onMouseDown: onMouseDown,
|
|
118
123
|
onTouchStart: onMouseDown,
|
|
119
124
|
onKeyDown: onKeyDown
|
|
120
125
|
}), children);
|
|
121
126
|
});
|
|
122
|
-
EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
|
|
123
|
-
var getMouseOrTouchX = function getMouseOrTouchX(e) {
|
|
124
|
-
// Some Typescript fooling is needed here
|
|
125
|
-
var x = e.targetTouches ? e.targetTouches[0].pageX : e.pageX;
|
|
126
|
-
return x;
|
|
127
|
-
};
|
|
127
|
+
EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
|
|
@@ -10,18 +10,24 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { logicalCSS } from '../../global_styling';
|
|
12
12
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
13
|
-
name: "
|
|
14
|
-
styles: "position:absolute
|
|
13
|
+
name: "1gfwqnd-euiFlyoutResizableButton",
|
|
14
|
+
styles: "position:absolute;label:euiFlyoutResizableButton;"
|
|
15
15
|
} : {
|
|
16
|
-
name: "
|
|
17
|
-
styles: "position:absolute
|
|
16
|
+
name: "1gfwqnd-euiFlyoutResizableButton",
|
|
17
|
+
styles: "position:absolute;label:euiFlyoutResizableButton;",
|
|
18
18
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
19
19
|
};
|
|
20
20
|
export var euiFlyoutResizableButtonStyles = function euiFlyoutResizableButtonStyles(_ref2) {
|
|
21
21
|
var euiTheme = _ref2.euiTheme;
|
|
22
22
|
return {
|
|
23
23
|
euiFlyoutResizableButton: _ref,
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
overlay: {
|
|
25
|
+
left: /*#__PURE__*/css(logicalCSS('right', 0), ";;label:left;"),
|
|
26
|
+
right: /*#__PURE__*/css(logicalCSS('left', 0), ";;label:right;")
|
|
27
|
+
},
|
|
28
|
+
push: {
|
|
29
|
+
left: /*#__PURE__*/css(logicalCSS('right', "-".concat(euiTheme.border.width.thin)), ";;label:left;"),
|
|
30
|
+
right: /*#__PURE__*/css(logicalCSS('left', "-".concat(euiTheme.border.width.thin)), ";;label:right;")
|
|
31
|
+
}
|
|
26
32
|
};
|
|
27
33
|
};
|
|
@@ -20,9 +20,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
20
20
|
|
|
21
21
|
import { useMemo, useReducer } from 'react';
|
|
22
22
|
import { assertNever } from '../common';
|
|
23
|
-
function
|
|
24
|
-
return _typeof(event) === 'object' && '
|
|
25
|
-
}
|
|
23
|
+
export var isTouchEvent = function isTouchEvent(event) {
|
|
24
|
+
return _typeof(event) === 'object' && 'targetTouches' in event;
|
|
25
|
+
};
|
|
26
26
|
export var pxToPercent = function pxToPercent(proportion, whole) {
|
|
27
27
|
if (whole < 1 || proportion < 0) return 0;
|
|
28
28
|
return proportion / whole * 100;
|
|
@@ -49,9 +49,8 @@ export var getPanelMinSize = function getPanelMinSize(panelMinSize, containerSiz
|
|
|
49
49
|
return Math.max(configMin, paddingMin);
|
|
50
50
|
};
|
|
51
51
|
export var getPosition = function getPosition(event, isHorizontal) {
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
return isHorizontal ? clientX : clientY;
|
|
52
|
+
var direction = isHorizontal ? 'clientX' : 'clientY';
|
|
53
|
+
return isTouchEvent(event) ? event.targetTouches[0][direction] : event[direction];
|
|
55
54
|
};
|
|
56
55
|
var getSiblingPanel = function getSiblingPanel(element, adjacency) {
|
|
57
56
|
if (!element) return null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["isHorizontal", "alignIndicator", "className"],
|
|
1
|
+
var _excluded = ["isHorizontal", "indicator", "alignIndicator", "className"],
|
|
2
2
|
_excluded2 = ["registration", "id", "disabled", "onFocus"];
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -31,14 +31,17 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
|
31
31
|
*/
|
|
32
32
|
export var EuiResizableButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
33
33
|
var isHorizontal = _ref.isHorizontal,
|
|
34
|
+
_ref$indicator = _ref.indicator,
|
|
35
|
+
indicator = _ref$indicator === void 0 ? 'handle' : _ref$indicator,
|
|
34
36
|
_ref$alignIndicator = _ref.alignIndicator,
|
|
35
37
|
alignIndicator = _ref$alignIndicator === void 0 ? 'center' : _ref$alignIndicator,
|
|
36
38
|
className = _ref.className,
|
|
37
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
40
|
var classes = classNames('euiResizableButton', className);
|
|
41
|
+
var resizeDirection = isHorizontal ? 'horizontal' : 'vertical';
|
|
39
42
|
var euiTheme = useEuiTheme();
|
|
40
43
|
var styles = euiResizableButtonStyles(euiTheme);
|
|
41
|
-
var cssStyles = [styles.euiResizableButton,
|
|
44
|
+
var cssStyles = [styles.euiResizableButton, styles[indicator], styles["".concat(indicator, "Direction")][resizeDirection], styles[resizeDirection], indicator === 'handle' && styles.alignIndicator[alignIndicator]];
|
|
42
45
|
return ___EmotionJSX(EuiI18n, {
|
|
43
46
|
tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
|
|
44
47
|
defaults: ['Press the left or right arrow keys to adjust panels size', 'Press the up or down arrow keys to adjust panels size']
|
|
@@ -67,8 +70,14 @@ EuiResizableButton.propTypes = {
|
|
|
67
70
|
*/
|
|
68
71
|
isHorizontal: PropTypes.bool,
|
|
69
72
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
73
|
+
* By default, EuiResizableButton will show a grab handle to indicate resizability.
|
|
74
|
+
* This indicator can be optionally hidden to show a plain border instead.
|
|
75
|
+
*/
|
|
76
|
+
indicator: PropTypes.oneOf(["handle", "border"]),
|
|
77
|
+
/**
|
|
78
|
+
* Allows customizing the alignment of grab `handle` indicators (does nothing for
|
|
79
|
+
* border indicators). Defaults to `center`, but consider using `start` for extremely
|
|
80
|
+
* tall content that scrolls off-screen
|
|
72
81
|
*/
|
|
73
82
|
alignIndicator: PropTypes.oneOf(["center", "start", "end"]),
|
|
74
83
|
/**
|
|
@@ -42,21 +42,31 @@ export var euiResizableButtonStyles = function euiResizableButtonStyles(euiTheme
|
|
|
42
42
|
var transitionSpeed = euiTheme.animation.fast;
|
|
43
43
|
var transition = "".concat(transitionSpeed, " ease");
|
|
44
44
|
return {
|
|
45
|
-
//
|
|
46
|
-
// 1. The "grab"
|
|
47
|
-
// 2. Start/end aligned handles should have a slight margin offset that disappears on hover/focus
|
|
45
|
+
// Creates a resizable indicator (either a grab handle or a plain border) with CSS psuedo-elements.
|
|
46
|
+
// 1. The "grab" handle transforms into a thicker straight line on :hover and :focus
|
|
47
|
+
// 2. Start/end aligned grab handles should have a slight margin offset that disappears on hover/focus
|
|
48
48
|
// 3. CSS hack to smooth out/anti-alias the 1px wide handles at various zoom levels
|
|
49
|
-
euiResizableButton: /*#__PURE__*/css("z-index:1;flex-shrink:0;display:flex;justify-content:center;
|
|
50
|
-
return x * 2;
|
|
51
|
-
}), ";&:disabled{display:none;}&:hover,&:focus{gap:0;justify-content:center;}", euiCanAnimate, "{transition:gap ", transition, ",justify-content ", transition, ";}&::before,&::after{content:'';display:block;background-color:", euiTheme.colors.darkestShade, ";transform:translateZ(0);", euiCanAnimate, "{transition:width ", transition, ",height ", transition, ",margin ", transition, ",background-color ", transition, ";}}&:hover{&::before,&::after{background-color:", euiTheme.colors.mediumShade, ";", euiCanAnimate, "{transition-delay:", transitionSpeed, ";}}}&: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) {
|
|
49
|
+
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) {
|
|
52
50
|
return x / 2;
|
|
53
51
|
}), ";}}};label:euiResizableButton;"),
|
|
54
52
|
horizontal: /*#__PURE__*/css("cursor:col-resize;", logicalCSS('height', '100%'), " ", logicalCSS('width', buttonSize), " margin-inline:", mathWithUnits(buttonSize, function (x) {
|
|
55
53
|
return x / -2;
|
|
56
|
-
}), "
|
|
54
|
+
}), ";;label:horizontal;"),
|
|
57
55
|
vertical: /*#__PURE__*/css("flex-direction:column;cursor:row-resize;", logicalCSS('width', '100%'), " ", logicalCSS('height', buttonSize), " margin-block:", mathWithUnits(buttonSize, function (x) {
|
|
58
56
|
return x / -2;
|
|
59
|
-
}), "
|
|
57
|
+
}), ";;label:vertical;"),
|
|
58
|
+
border: /*#__PURE__*/css("&::before,&::after{background-color:", euiTheme.border.color, ";};label:border;"),
|
|
59
|
+
borderDirection: {
|
|
60
|
+
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;"),
|
|
61
|
+
vertical: /*#__PURE__*/css("&::before{", logicalCSS('height', euiTheme.border.width.thin), " ", logicalCSS('width', '100%'), ";}&:hover,&:focus,&:active{&::after{", logicalCSS('height', euiTheme.border.width.thin), " ", logicalCSS('width', '100%'), ";}};label:vertical;")
|
|
62
|
+
},
|
|
63
|
+
handle: /*#__PURE__*/css("gap:", mathWithUnits(grabHandleHeight, function (x) {
|
|
64
|
+
return x * 2;
|
|
65
|
+
}), ";&:hover,&:focus,&:active{gap:0;}", euiCanAnimate, "{transition:gap ", transition, ";}&::before,&::after{background-color:", euiTheme.colors.darkestShade, ";transform:translateZ(0);}&:hover{&::before,&::after{", euiCanAnimate, "{transition-delay:", transitionSpeed, ";}}};label:handle;"),
|
|
66
|
+
handleDirection: {
|
|
67
|
+
horizontal: /*#__PURE__*/css("&::before,&::after{", logicalCSS('width', grabHandleHeight), " ", logicalCSS('height', grabHandleWidth), " margin-block:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", logicalCSS('height', '100%'), " margin-block:0;transform:none;}};label:horizontal;"),
|
|
68
|
+
vertical: /*#__PURE__*/css("&::before,&::after{", logicalCSS('height', grabHandleHeight), " ", logicalCSS('width', grabHandleWidth), " margin-inline:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", logicalCSS('width', '100%'), " margin-inline:0;transform:none;}};label:vertical;")
|
|
69
|
+
},
|
|
60
70
|
alignIndicator: {
|
|
61
71
|
center: _ref3,
|
|
62
72
|
start: _ref2,
|
|
@@ -109,16 +109,33 @@ export var EuiResizableContainer = function EuiResizableContainer(_ref) {
|
|
|
109
109
|
prevPanelId: prevPanelId,
|
|
110
110
|
nextPanelId: nextPanelId
|
|
111
111
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
position
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
112
|
+
|
|
113
|
+
// Window event listeners instead of React events are used to continue
|
|
114
|
+
// detecting movement even if the user's mouse leaves the container
|
|
115
|
+
|
|
116
|
+
var onMouseMove = function onMouseMove(event) {
|
|
117
|
+
var position = getPosition(event, isHorizontal);
|
|
118
|
+
actions.dragMove({
|
|
119
|
+
position: position,
|
|
120
|
+
prevPanelId: prevPanelId,
|
|
121
|
+
nextPanelId: nextPanelId
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
var onMouseUp = function onMouseUp() {
|
|
125
|
+
if (resizeContext.current.trigger === 'pointer') {
|
|
126
|
+
resizeEnd();
|
|
127
|
+
}
|
|
128
|
+
actions.reset();
|
|
129
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
130
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
131
|
+
window.removeEventListener('touchmove', onMouseMove);
|
|
132
|
+
window.removeEventListener('touchend', onMouseUp);
|
|
133
|
+
};
|
|
134
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
135
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
136
|
+
window.addEventListener('touchmove', onMouseMove);
|
|
137
|
+
window.addEventListener('touchend', onMouseUp);
|
|
138
|
+
}, [actions, isHorizontal, resizeStart, resizeEnd]);
|
|
122
139
|
var getKeyMoveDirection = useCallback(function (key) {
|
|
123
140
|
var direction = null;
|
|
124
141
|
if (isHorizontal && key === keys.ARROW_LEFT || !isHorizontal && key === keys.ARROW_UP) {
|
|
@@ -156,12 +173,6 @@ export var EuiResizableContainer = function EuiResizableContainer(_ref) {
|
|
|
156
173
|
resizeEnd();
|
|
157
174
|
}
|
|
158
175
|
}, [getKeyMoveDirection, resizeEnd]);
|
|
159
|
-
var onMouseUp = useCallback(function () {
|
|
160
|
-
if (resizeContext.current.trigger === 'pointer') {
|
|
161
|
-
resizeEnd();
|
|
162
|
-
}
|
|
163
|
-
actions.reset();
|
|
164
|
-
}, [actions, resizeEnd]);
|
|
165
176
|
var onBlur = useCallback(function () {
|
|
166
177
|
if (resizeContext.current.trigger === 'key') {
|
|
167
178
|
resizeEnd();
|
|
@@ -220,12 +231,7 @@ export var EuiResizableContainer = function EuiResizableContainer(_ref) {
|
|
|
220
231
|
}, ___EmotionJSX("div", _extends({
|
|
221
232
|
css: cssStyles,
|
|
222
233
|
className: classes,
|
|
223
|
-
ref: containerRef
|
|
224
|
-
onMouseMove: reducerState.isDragging ? onMouseMove : undefined,
|
|
225
|
-
onMouseUp: onMouseUp,
|
|
226
|
-
onMouseLeave: onMouseUp,
|
|
227
|
-
onTouchMove: onMouseMove,
|
|
228
|
-
onTouchEnd: onMouseUp
|
|
234
|
+
ref: containerRef
|
|
229
235
|
}, rest), render()));
|
|
230
236
|
};
|
|
231
237
|
EuiResizableContainer.propTypes = {
|
|
@@ -9,7 +9,6 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
9
9
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { mathWithUnits, logicalCSS, euiFontSizeFromScale, euiCanAnimate, euiAnimScale } from '../../global_styling';
|
|
12
|
-
import { makeHighContrastColor } from '../../services';
|
|
13
12
|
import { euiStepVariables } from './step.styles';
|
|
14
13
|
import { euiButtonFillColor } from '../../themes/amsterdam/global_styling/mixins';
|
|
15
14
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
@@ -42,12 +41,12 @@ export var euiStepNumberStyles = function euiStepNumberStyles(euiThemeContext) {
|
|
|
42
41
|
xs: /*#__PURE__*/css(createStepsNumber(euiStep.numberXSSize, euiFontSizeFromScale('xs', euiTheme)), ";;label:xs;"),
|
|
43
42
|
// status
|
|
44
43
|
incomplete: /*#__PURE__*/css("background-color:transparent;color:", euiTheme.colors.text, ";border:", euiTheme.border.thick, ";;label:incomplete;"),
|
|
45
|
-
disabled: /*#__PURE__*/css(
|
|
44
|
+
disabled: /*#__PURE__*/css(euiButtonFillColor(euiThemeContext, 'disabled'), ";;label:disabled;"),
|
|
46
45
|
loading: _ref,
|
|
47
|
-
warning: /*#__PURE__*/css(
|
|
48
|
-
danger: /*#__PURE__*/css(
|
|
49
|
-
complete: /*#__PURE__*/css(
|
|
50
|
-
current: /*#__PURE__*/css("border:
|
|
46
|
+
warning: /*#__PURE__*/css(euiButtonFillColor(euiThemeContext, 'warning'), " ", euiCanAnimate, "{animation:", euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:warning;"),
|
|
47
|
+
danger: /*#__PURE__*/css(euiButtonFillColor(euiThemeContext, 'danger'), " ", euiCanAnimate, "{animation:", euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:danger;"),
|
|
48
|
+
complete: /*#__PURE__*/css(euiButtonFillColor(euiThemeContext, 'success'), " ", euiCanAnimate, "{animation:", euiAnimScale, " ", euiTheme.animation.fast, " ", euiTheme.animation.bounce, ";};label:complete;"),
|
|
49
|
+
current: /*#__PURE__*/css("border:", euiTheme.border.width.thick, " solid ", euiTheme.colors.body, ";box-shadow:0 0 0 ", euiTheme.border.width.thick, " ", euiTheme.colors.primary, ";;label:current;")
|
|
51
50
|
};
|
|
52
51
|
};
|
|
53
52
|
export var euiStepNumberContentStyles = function euiStepNumberContentStyles(_ref3) {
|
|
@@ -67,6 +66,6 @@ export var euiStepNumberContentStyles = function euiStepNumberContentStyles(_ref
|
|
|
67
66
|
incomplete: /*#__PURE__*/css("display:unset;position:relative;inset-block-start:-", euiTheme.border.width.thick, ";;label:incomplete;"),
|
|
68
67
|
loading: /*#__PURE__*/css(";label:loading;"),
|
|
69
68
|
disabled: /*#__PURE__*/css(";label:disabled;"),
|
|
70
|
-
current: /*#__PURE__*/css(";label:current;")
|
|
69
|
+
current: /*#__PURE__*/css("display:inline-block;transform:translateY(-", euiTheme.border.width.thick, ");;label:current;")
|
|
71
70
|
};
|
|
72
71
|
};
|