@elastic/eui 113.2.1 → 114.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/basic_table/collapsed_item_actions.js +2 -0
- package/es/components/button/split_button/split_button.js +13 -0
- package/es/components/button/split_button/split_button_actions.js +15 -0
- package/es/components/collapsible_nav/collapsible_nav.js +5 -0
- package/es/components/color_picker/color_picker.js +31 -8
- package/es/components/context_menu/context_menu_item.js +9 -3
- package/es/components/context_menu/context_menu_item.styles.js +6 -2
- package/es/components/datagrid/utils/scrolling.js +39 -10
- package/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/es/components/flyout/_flyout_overlay.js +34 -4
- package/es/components/flyout/const.js +10 -0
- package/es/components/flyout/flyout.component.js +49 -57
- package/es/components/flyout/flyout.js +10 -2
- package/es/components/flyout/flyout.styles.js +2 -2
- package/es/components/flyout/flyout_menu.js +19 -5
- package/es/components/flyout/flyout_resizable.js +5 -0
- package/es/components/flyout/manager/actions.js +12 -5
- package/es/components/flyout/manager/flyout_child.js +9 -2
- package/es/components/flyout/manager/flyout_managed.js +27 -14
- package/es/components/flyout/manager/reducer.js +251 -54
- package/es/components/flyout/manager/store.js +74 -12
- package/es/components/flyout/use_flyout_menu.js +70 -0
- package/es/components/form/file_picker/file_picker.js +46 -18
- package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/es/components/overlay_mask/overlay_mask.js +10 -3
- package/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/es/services/hooks/index.js +8 -8
- package/es/services/hooks/useIsPointerDown.js +6 -15
- package/es/services/index.js +1 -1
- package/eui.d.ts +477 -63
- package/i18ntokens.json +661 -643
- package/lib/components/basic_table/collapsed_item_actions.js +2 -0
- package/lib/components/button/split_button/split_button.js +13 -0
- package/lib/components/button/split_button/split_button_actions.js +15 -0
- package/lib/components/collapsible_nav/collapsible_nav.js +5 -0
- package/lib/components/color_picker/color_picker.js +30 -7
- package/lib/components/context_menu/context_menu_item.js +9 -3
- package/lib/components/context_menu/context_menu_item.styles.js +5 -1
- package/lib/components/datagrid/utils/scrolling.js +37 -8
- package/lib/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/lib/components/flyout/_flyout_overlay.js +33 -3
- package/lib/components/flyout/const.js +11 -1
- package/lib/components/flyout/flyout.component.js +48 -56
- package/lib/components/flyout/flyout.js +15 -1
- package/lib/components/flyout/flyout.styles.js +2 -2
- package/lib/components/flyout/flyout_menu.js +19 -5
- package/lib/components/flyout/flyout_resizable.js +5 -0
- package/lib/components/flyout/manager/actions.js +12 -5
- package/lib/components/flyout/manager/flyout_child.js +9 -2
- package/lib/components/flyout/manager/flyout_managed.js +19 -12
- package/lib/components/flyout/manager/reducer.js +250 -53
- package/lib/components/flyout/manager/store.js +74 -14
- package/lib/components/flyout/use_flyout_menu.js +75 -0
- package/lib/components/form/file_picker/file_picker.js +46 -18
- package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/lib/components/overlay_mask/overlay_mask.js +10 -3
- package/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/lib/services/hooks/index.js +60 -91
- package/lib/services/hooks/useIsPointerDown.js +7 -14
- package/lib/services/index.js +70 -11
- package/optimize/es/components/basic_table/collapsed_item_actions.js +2 -0
- package/optimize/es/components/color_picker/color_picker.js +31 -8
- package/optimize/es/components/context_menu/context_menu_item.js +3 -2
- package/optimize/es/components/context_menu/context_menu_item.styles.js +6 -2
- package/optimize/es/components/datagrid/utils/scrolling.js +39 -10
- package/optimize/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/optimize/es/components/flyout/_flyout_overlay.js +34 -4
- package/optimize/es/components/flyout/const.js +10 -0
- package/optimize/es/components/flyout/flyout.component.js +49 -57
- package/optimize/es/components/flyout/flyout.js +5 -2
- package/optimize/es/components/flyout/flyout.styles.js +2 -2
- package/optimize/es/components/flyout/flyout_menu.js +7 -3
- package/optimize/es/components/flyout/manager/actions.js +12 -5
- package/optimize/es/components/flyout/manager/flyout_managed.js +18 -12
- package/optimize/es/components/flyout/manager/reducer.js +251 -54
- package/optimize/es/components/flyout/manager/store.js +69 -12
- package/optimize/es/components/flyout/use_flyout_menu.js +69 -0
- package/optimize/es/components/form/file_picker/file_picker.js +35 -18
- package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/optimize/es/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/es/services/hooks/index.js +8 -8
- package/optimize/es/services/hooks/useIsPointerDown.js +6 -10
- package/optimize/es/services/index.js +1 -1
- package/optimize/lib/components/basic_table/collapsed_item_actions.js +2 -0
- package/optimize/lib/components/color_picker/color_picker.js +30 -7
- package/optimize/lib/components/context_menu/context_menu_item.js +3 -2
- package/optimize/lib/components/context_menu/context_menu_item.styles.js +5 -1
- package/optimize/lib/components/datagrid/utils/scrolling.js +37 -8
- package/optimize/lib/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/optimize/lib/components/flyout/_flyout_overlay.js +33 -3
- package/optimize/lib/components/flyout/const.js +11 -1
- package/optimize/lib/components/flyout/flyout.component.js +48 -56
- package/optimize/lib/components/flyout/flyout.js +10 -1
- package/optimize/lib/components/flyout/flyout.styles.js +2 -2
- package/optimize/lib/components/flyout/flyout_menu.js +7 -3
- package/optimize/lib/components/flyout/manager/actions.js +12 -5
- package/optimize/lib/components/flyout/manager/flyout_managed.js +18 -12
- package/optimize/lib/components/flyout/manager/reducer.js +250 -53
- package/optimize/lib/components/flyout/manager/store.js +70 -12
- package/optimize/lib/components/flyout/use_flyout_menu.js +74 -0
- package/optimize/lib/components/form/file_picker/file_picker.js +35 -18
- package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/optimize/lib/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/lib/services/hooks/index.js +60 -91
- package/optimize/lib/services/hooks/useIsPointerDown.js +5 -10
- package/optimize/lib/services/index.js +70 -11
- package/package.json +4 -4
- package/test-env/components/basic_table/collapsed_item_actions.js +2 -0
- package/test-env/components/button/split_button/split_button.js +13 -0
- package/test-env/components/button/split_button/split_button_actions.js +15 -0
- package/test-env/components/collapsible_nav/collapsible_nav.js +5 -0
- package/test-env/components/color_picker/color_picker.js +30 -7
- package/test-env/components/context_menu/context_menu_item.js +9 -3
- package/test-env/components/context_menu/context_menu_item.styles.js +5 -1
- package/test-env/components/datagrid/utils/scrolling.js +37 -8
- package/test-env/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/test-env/components/flyout/_flyout_overlay.js +33 -3
- package/test-env/components/flyout/const.js +11 -1
- package/test-env/components/flyout/flyout.component.js +48 -56
- package/test-env/components/flyout/flyout.styles.js +2 -2
- package/test-env/components/flyout/flyout_menu.js +19 -5
- package/test-env/components/flyout/flyout_resizable.js +5 -0
- package/test-env/components/flyout/manager/actions.js +12 -5
- package/test-env/components/flyout/manager/flyout_child.js +9 -2
- package/test-env/components/flyout/manager/flyout_managed.js +19 -12
- package/test-env/components/flyout/manager/reducer.js +250 -53
- package/test-env/components/flyout/manager/store.js +70 -12
- package/test-env/components/flyout/use_flyout_menu.js +74 -0
- package/test-env/components/form/file_picker/file_picker.js +46 -18
- package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/test-env/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/test-env/components/overlay_mask/overlay_mask.js +10 -3
- package/test-env/components/tree_view/tree_view_item.styles.js +1 -1
- package/test-env/services/hooks/index.js +60 -91
- package/test-env/services/hooks/useIsPointerDown.js +5 -10
- package/test-env/services/index.js +70 -11
package/lib/services/index.js
CHANGED
|
@@ -69,6 +69,16 @@ var _exportNames = {
|
|
|
69
69
|
formatDate: true,
|
|
70
70
|
formatNumber: true,
|
|
71
71
|
formatText: true,
|
|
72
|
+
useDependentState: true,
|
|
73
|
+
useCombinedRefs: true,
|
|
74
|
+
setMultipleRefs: true,
|
|
75
|
+
useForceRender: true,
|
|
76
|
+
useLatest: true,
|
|
77
|
+
useDeepEqual: true,
|
|
78
|
+
isMouseEvent: true,
|
|
79
|
+
useMouseMove: true,
|
|
80
|
+
useUpdateEffect: true,
|
|
81
|
+
useEuiDisabledElement: true,
|
|
72
82
|
isEvenlyDivisibleBy: true,
|
|
73
83
|
isWithinRange: true,
|
|
74
84
|
Pager: true,
|
|
@@ -426,6 +436,12 @@ Object.defineProperty(exports, "isEvenlyDivisibleBy", {
|
|
|
426
436
|
return _number.isEvenlyDivisibleBy;
|
|
427
437
|
}
|
|
428
438
|
});
|
|
439
|
+
Object.defineProperty(exports, "isMouseEvent", {
|
|
440
|
+
enumerable: true,
|
|
441
|
+
get: function get() {
|
|
442
|
+
return _hooks.isMouseEvent;
|
|
443
|
+
}
|
|
444
|
+
});
|
|
429
445
|
Object.defineProperty(exports, "isValidHex", {
|
|
430
446
|
enumerable: true,
|
|
431
447
|
get: function get() {
|
|
@@ -481,6 +497,12 @@ Object.defineProperty(exports, "saturate", {
|
|
|
481
497
|
return _color.saturate;
|
|
482
498
|
}
|
|
483
499
|
});
|
|
500
|
+
Object.defineProperty(exports, "setMultipleRefs", {
|
|
501
|
+
enumerable: true,
|
|
502
|
+
get: function get() {
|
|
503
|
+
return _hooks.setMultipleRefs;
|
|
504
|
+
}
|
|
505
|
+
});
|
|
484
506
|
Object.defineProperty(exports, "shade", {
|
|
485
507
|
enumerable: true,
|
|
486
508
|
get: function get() {
|
|
@@ -547,18 +569,48 @@ Object.defineProperty(exports, "useColorStopsState", {
|
|
|
547
569
|
return _color_picker.useColorStopsState;
|
|
548
570
|
}
|
|
549
571
|
});
|
|
572
|
+
Object.defineProperty(exports, "useCombinedRefs", {
|
|
573
|
+
enumerable: true,
|
|
574
|
+
get: function get() {
|
|
575
|
+
return _hooks.useCombinedRefs;
|
|
576
|
+
}
|
|
577
|
+
});
|
|
550
578
|
Object.defineProperty(exports, "useCurrentEuiBreakpoint", {
|
|
551
579
|
enumerable: true,
|
|
552
580
|
get: function get() {
|
|
553
581
|
return _breakpoint.useCurrentEuiBreakpoint;
|
|
554
582
|
}
|
|
555
583
|
});
|
|
584
|
+
Object.defineProperty(exports, "useDeepEqual", {
|
|
585
|
+
enumerable: true,
|
|
586
|
+
get: function get() {
|
|
587
|
+
return _hooks.useDeepEqual;
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
Object.defineProperty(exports, "useDependentState", {
|
|
591
|
+
enumerable: true,
|
|
592
|
+
get: function get() {
|
|
593
|
+
return _hooks.useDependentState;
|
|
594
|
+
}
|
|
595
|
+
});
|
|
556
596
|
Object.defineProperty(exports, "useEuiContainerQuery", {
|
|
557
597
|
enumerable: true,
|
|
558
598
|
get: function get() {
|
|
559
599
|
return _container_query_hook.useEuiContainerQuery;
|
|
560
600
|
}
|
|
561
601
|
});
|
|
602
|
+
Object.defineProperty(exports, "useEuiDisabledElement", {
|
|
603
|
+
enumerable: true,
|
|
604
|
+
get: function get() {
|
|
605
|
+
return _hooks.useEuiDisabledElement;
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
Object.defineProperty(exports, "useForceRender", {
|
|
609
|
+
enumerable: true,
|
|
610
|
+
get: function get() {
|
|
611
|
+
return _hooks.useForceRender;
|
|
612
|
+
}
|
|
613
|
+
});
|
|
562
614
|
Object.defineProperty(exports, "useGeneratedHtmlId", {
|
|
563
615
|
enumerable: true,
|
|
564
616
|
get: function get() {
|
|
@@ -583,6 +635,24 @@ Object.defineProperty(exports, "useIsWithinMinBreakpoint", {
|
|
|
583
635
|
return _breakpoint.useIsWithinMinBreakpoint;
|
|
584
636
|
}
|
|
585
637
|
});
|
|
638
|
+
Object.defineProperty(exports, "useLatest", {
|
|
639
|
+
enumerable: true,
|
|
640
|
+
get: function get() {
|
|
641
|
+
return _hooks.useLatest;
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
Object.defineProperty(exports, "useMouseMove", {
|
|
645
|
+
enumerable: true,
|
|
646
|
+
get: function get() {
|
|
647
|
+
return _hooks.useMouseMove;
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
Object.defineProperty(exports, "useUpdateEffect", {
|
|
651
|
+
enumerable: true,
|
|
652
|
+
get: function get() {
|
|
653
|
+
return _hooks.useUpdateEffect;
|
|
654
|
+
}
|
|
655
|
+
});
|
|
586
656
|
Object.defineProperty(exports, "wcagContrastMin", {
|
|
587
657
|
enumerable: true,
|
|
588
658
|
get: function get() {
|
|
@@ -661,17 +731,6 @@ Object.keys(_findElement).forEach(function (key) {
|
|
|
661
731
|
var _focus_trap = require("./focus_trap");
|
|
662
732
|
var _format = require("./format");
|
|
663
733
|
var _hooks = require("./hooks");
|
|
664
|
-
Object.keys(_hooks).forEach(function (key) {
|
|
665
|
-
if (key === "default" || key === "__esModule") return;
|
|
666
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
667
|
-
if (key in exports && exports[key] === _hooks[key]) return;
|
|
668
|
-
Object.defineProperty(exports, key, {
|
|
669
|
-
enumerable: true,
|
|
670
|
-
get: function get() {
|
|
671
|
-
return _hooks[key];
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
});
|
|
675
734
|
var _number = require("./number");
|
|
676
735
|
var _paging = require("./paging");
|
|
677
736
|
var _popover = require("./popover");
|
|
@@ -59,6 +59,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
59
59
|
var toolTipContent = callWithItemIfFunction(item)(action.description);
|
|
60
60
|
var href = callWithItemIfFunction(item)(action.href);
|
|
61
61
|
var dataTestSubj = callWithItemIfFunction(item)(action['data-test-subj']);
|
|
62
|
+
var color = action.color ? callWithItemIfFunction(item)(action.color) : undefined;
|
|
62
63
|
var _onClick = action.onClick,
|
|
63
64
|
target = action.target;
|
|
64
65
|
controls.push(___EmotionJSX(EuiContextMenuItem, {
|
|
@@ -68,6 +69,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
|
|
|
68
69
|
href: href,
|
|
69
70
|
target: target,
|
|
70
71
|
icon: icon,
|
|
72
|
+
color: color,
|
|
71
73
|
"data-test-subj": dataTestSubj,
|
|
72
74
|
onClick: function onClick(event) {
|
|
73
75
|
event.persist();
|
|
@@ -12,7 +12,7 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
12
12
|
import React, { cloneElement, useEffect, useMemo, useRef, useState } from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import chroma from 'chroma-js';
|
|
15
|
-
import { useEuiMemoizedStyles, keys, useEuiPaletteColorBlind } from '../../services';
|
|
15
|
+
import { useEuiMemoizedStyles, keys, useEuiPaletteColorBlind, useGeneratedHtmlId } from '../../services';
|
|
16
16
|
import { EuiFieldText, EuiFormControlLayout, EuiFormRow, EuiRange } from '../form';
|
|
17
17
|
import { useEuiI18n } from '../i18n';
|
|
18
18
|
import { EuiPopover } from '../popover';
|
|
@@ -85,9 +85,12 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
|
|
|
85
85
|
_ref$isClearable = _ref.isClearable,
|
|
86
86
|
isClearable = _ref$isClearable === void 0 ? false : _ref$isClearable,
|
|
87
87
|
placeholder = _ref.placeholder,
|
|
88
|
-
dataTestSubj = _ref['data-test-subj']
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
dataTestSubj = _ref['data-test-subj'],
|
|
89
|
+
_ariaLabel = _ref['aria-label'],
|
|
90
|
+
ariaLabelledby = _ref['aria-labelledby'],
|
|
91
|
+
ariaDescribedby = _ref['aria-describedby'];
|
|
92
|
+
var _useEuiI18n = useEuiI18n(['euiColorPicker.popoverLabel', 'euiColorPicker.colorLabel', 'euiColorPicker.selectedColorLabel', 'euiColorPicker.colorErrorMessage', 'euiColorPicker.transparent', 'euiColorPicker.alphaLabel', 'euiColorPicker.openLabel', 'euiColorPicker.closeLabel', 'euiColorPicker.ariaLabel'], ['Color selection dialog', 'Color value', 'Selected color', 'Invalid color value', 'Transparent', 'Alpha channel (opacity) value', 'Press the escape key to close the popover', 'Press the down key to open a popover containing color options', 'Select a color']),
|
|
93
|
+
_useEuiI18n2 = _slicedToArray(_useEuiI18n, 9),
|
|
91
94
|
popoverLabel = _useEuiI18n2[0],
|
|
92
95
|
colorLabel = _useEuiI18n2[1],
|
|
93
96
|
selectedColorLabel = _useEuiI18n2[2],
|
|
@@ -95,7 +98,16 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
|
|
|
95
98
|
transparent = _useEuiI18n2[4],
|
|
96
99
|
alphaLabel = _useEuiI18n2[5],
|
|
97
100
|
openLabel = _useEuiI18n2[6],
|
|
98
|
-
closeLabel = _useEuiI18n2[7]
|
|
101
|
+
closeLabel = _useEuiI18n2[7],
|
|
102
|
+
ariaLabel = _useEuiI18n2[8];
|
|
103
|
+
var openLabelId = useGeneratedHtmlId({
|
|
104
|
+
prefix: 'colorPicker',
|
|
105
|
+
suffix: 'openLabel'
|
|
106
|
+
});
|
|
107
|
+
var closeLabelId = useGeneratedHtmlId({
|
|
108
|
+
prefix: 'colorPicker',
|
|
109
|
+
suffix: 'closeLabel'
|
|
110
|
+
});
|
|
99
111
|
var defaultSwatches = useEuiPaletteColorBlind();
|
|
100
112
|
var swatches = _swatches !== null && _swatches !== void 0 ? _swatches : defaultSwatches;
|
|
101
113
|
var preferredFormat = useMemo(function () {
|
|
@@ -424,10 +436,21 @@ export var EuiColorPicker = function EuiColorPicker(_ref) {
|
|
|
424
436
|
readOnly: readOnly,
|
|
425
437
|
fullWidth: fullWidth,
|
|
426
438
|
autoComplete: "off",
|
|
427
|
-
"data-test-subj": testSubjAnchor
|
|
428
|
-
|
|
439
|
+
"data-test-subj": testSubjAnchor
|
|
440
|
+
// if an id is provided it might be used in combination with `htmlFor` on a label,
|
|
441
|
+
// so we don't want to override it with a fallback `aria-label`
|
|
442
|
+
,
|
|
443
|
+
"aria-label": _ariaLabel ? _ariaLabel : id || ariaLabelledby ? undefined : ariaLabel,
|
|
444
|
+
"aria-labelledby": ariaLabelledby,
|
|
445
|
+
"aria-describedby": classNames(isColorSelectorShown ? openLabelId : closeLabelId, ariaDescribedby),
|
|
429
446
|
controlOnly: true // Don't need two EuiFormControlwrappers
|
|
430
|
-
})
|
|
447
|
+
}), ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("span", null, ___EmotionJSX("span", {
|
|
448
|
+
id: openLabelId,
|
|
449
|
+
"aria-hidden": !isColorSelectorShown
|
|
450
|
+
}, openLabel), ___EmotionJSX("span", {
|
|
451
|
+
id: closeLabelId,
|
|
452
|
+
"aria-hidden": isColorSelectorShown
|
|
453
|
+
}, closeLabel))));
|
|
431
454
|
}
|
|
432
455
|
return display === 'inline' ? ___EmotionJSX("div", {
|
|
433
456
|
css: styles.euiColorPicker,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "className", "hasPanel", "icon", "buttonRef", "disabled", "layoutAlign", "toolTipContent", "toolTipProps", "href", "target", "rel", "size"];
|
|
3
|
+
var _excluded = ["children", "className", "hasPanel", "icon", "buttonRef", "disabled", "layoutAlign", "toolTipContent", "toolTipProps", "href", "target", "rel", "size", "color"];
|
|
4
4
|
/*
|
|
5
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -41,12 +41,13 @@ export var EuiContextMenuItem = function EuiContextMenuItem(_ref) {
|
|
|
41
41
|
rel = _ref.rel,
|
|
42
42
|
_ref$size = _ref.size,
|
|
43
43
|
size = _ref$size === void 0 ? 'm' : _ref$size,
|
|
44
|
+
color = _ref.color,
|
|
44
45
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
45
46
|
var isHrefValid = !href || validateHref(href);
|
|
46
47
|
var disabled = _disabled || !isHrefValid;
|
|
47
48
|
var classes = classNames('euiContextMenuItem', className);
|
|
48
49
|
var styles = useEuiMemoizedStyles(euiContextMenuItemStyles);
|
|
49
|
-
var cssStyles = [styles.euiContextMenuItem, styles.sizes[size], styles.layoutAlign[layoutAlign], disabled && styles.disabled];
|
|
50
|
+
var cssStyles = [styles.euiContextMenuItem, styles.sizes[size], styles.layoutAlign[layoutAlign], disabled && styles.disabled, !disabled && color && styles.colors[color]];
|
|
50
51
|
var iconInstance = icon && (typeof icon === 'string' ? ___EmotionJSX(EuiIcon, {
|
|
51
52
|
type: icon,
|
|
52
53
|
size: "m",
|
|
@@ -8,7 +8,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
|
-
import { logicalCSS, logicalTextAlignCSS, euiFontSize } from '../../global_styling';
|
|
11
|
+
import { logicalCSS, logicalTextAlignCSS, euiFontSize, EXTENDED_BUTTON_COLORS, euiButtonEmptyColor } from '../../global_styling';
|
|
12
12
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
13
13
|
name: "4ak4s8-euiContextMenuItem__arrow",
|
|
14
14
|
styles: "align-self:flex-end;label:euiContextMenuItem__arrow;"
|
|
@@ -77,6 +77,10 @@ export var euiContextMenuItemStyles = function euiContextMenuItemStyles(euiTheme
|
|
|
77
77
|
euiContextMenuItem__text: _ref2,
|
|
78
78
|
s: /*#__PURE__*/css(euiFontSize(euiThemeContext, 's'), ";;label:s;")
|
|
79
79
|
},
|
|
80
|
-
euiContextMenuItem__arrow: _ref
|
|
80
|
+
euiContextMenuItem__arrow: _ref,
|
|
81
|
+
// Colors - maps button color names to text color overrides
|
|
82
|
+
colors: Object.fromEntries(EXTENDED_BUTTON_COLORS.map(function (color) {
|
|
83
|
+
return [color, /*#__PURE__*/css("color:", euiButtonEmptyColor(euiThemeContext, color).color, ";;label:colors;")];
|
|
84
|
+
}))
|
|
81
85
|
};
|
|
82
86
|
};
|
|
@@ -8,8 +8,9 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
8
8
|
* Side Public License, v 1.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import React, { useContext, useEffect, useCallback, useMemo } from 'react';
|
|
12
|
-
import { useEuiMemoizedStyles
|
|
11
|
+
import React, { useContext, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
12
|
+
import { useEuiMemoizedStyles } from '../../../services';
|
|
13
|
+
import { useIsPointerDown } from '../../../services/hooks';
|
|
13
14
|
import { logicalStyles } from '../../../global_styling';
|
|
14
15
|
import { DataGridCellPopoverContext } from '../body/cell';
|
|
15
16
|
import { DataGridFocusContext } from './focus';
|
|
@@ -27,20 +28,48 @@ export var useScroll = function useScroll(args) {
|
|
|
27
28
|
scrollCellIntoView = _useScrollCellIntoVie.scrollCellIntoView;
|
|
28
29
|
var _useContext = useContext(DataGridFocusContext),
|
|
29
30
|
focusedCell = _useContext.focusedCell;
|
|
30
|
-
var
|
|
31
|
+
var isPointerDownRef = useIsPointerDown(args.outerGridRef);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Set when `focusedCell` changes while the pointer is held down (e.g. clicking a cell).
|
|
35
|
+
* Allows the `pointerup` listener below to scroll on release without
|
|
36
|
+
* causing snap-back when the user scrolls the grid without changing focus.
|
|
37
|
+
*/
|
|
38
|
+
var pendingScrollRef = useRef(false);
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
if (!focusedCell) return;
|
|
41
|
+
if (isPointerDownRef.current) {
|
|
42
|
+
// Pointer is down - defer scroll decision to the pointerup listener
|
|
43
|
+
pendingScrollRef.current = true;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
scrollCellIntoView({
|
|
47
|
+
rowIndex: focusedCell[1],
|
|
48
|
+
colIndex: focusedCell[0]
|
|
49
|
+
});
|
|
50
|
+
}, [focusedCell, scrollCellIntoView, isPointerDownRef]);
|
|
31
51
|
useEffect(function () {
|
|
32
|
-
|
|
52
|
+
var handlePointerUp = function handlePointerUp() {
|
|
33
53
|
var _window;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
54
|
+
if (!pendingScrollRef.current || !focusedCell) return;
|
|
55
|
+
pendingScrollRef.current = false;
|
|
56
|
+
|
|
57
|
+
// Skip if the interaction resulted in text being selected
|
|
58
|
+
if (((_window = window) === null || _window === void 0 || (_window = _window.getSelection()) === null || _window === void 0 ? void 0 : _window.type) === 'Range') return;
|
|
38
59
|
scrollCellIntoView({
|
|
39
60
|
rowIndex: focusedCell[1],
|
|
40
61
|
colIndex: focusedCell[0]
|
|
41
62
|
});
|
|
42
|
-
}
|
|
43
|
-
|
|
63
|
+
};
|
|
64
|
+
document.addEventListener('pointerup', handlePointerUp, {
|
|
65
|
+
capture: true
|
|
66
|
+
});
|
|
67
|
+
return function () {
|
|
68
|
+
return document.removeEventListener('pointerup', handlePointerUp, {
|
|
69
|
+
capture: true
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
}, [focusedCell, scrollCellIntoView]);
|
|
44
73
|
var _useContext2 = useContext(DataGridCellPopoverContext),
|
|
45
74
|
popoverIsOpen = _useContext2.popoverIsOpen,
|
|
46
75
|
cellLocation = _useContext2.cellLocation;
|
|
@@ -152,11 +152,20 @@ export var EuiTimeWindowButtons = function EuiTimeWindowButtons(_ref) {
|
|
|
152
152
|
export function useEuiTimeWindow(start, end, apply, options) {
|
|
153
153
|
var _options$zoomFactor;
|
|
154
154
|
var min = dateMath.parse(start);
|
|
155
|
+
|
|
156
|
+
/* `roundUp: true` will result in an "inclusive" time (e.g. 23:59:59.999 for 'now/d').
|
|
157
|
+
It only changes the value for relative expressions (e.g. 'now/d') but not absolute ISO strings. */
|
|
155
158
|
var max = dateMath.parse(end, {
|
|
156
159
|
roundUp: true
|
|
157
160
|
});
|
|
158
161
|
var isInvalid = !min || !min.isValid() || !max || !max.isValid();
|
|
159
|
-
|
|
162
|
+
/* An end at .999ms is always considered an inclusive boundary (either as result of `roundUp: true`
|
|
163
|
+
or entered manually).
|
|
164
|
+
To avoid a 1ms drift on every time window or zoom step, windowDuration has to be increased by 1ms.
|
|
165
|
+
This ensures the window is always at a clean boundary (e.g. 00:00:00.000 - 23:59:59.999). */
|
|
166
|
+
var isInclusiveBoundary = !isInvalid && max.milliseconds() === 999;
|
|
167
|
+
var endBoundary = !isInvalid ? isInclusiveBoundary ? moment(max).add(1, 'ms') : moment(max) : null;
|
|
168
|
+
var windowDuration = isInvalid || !endBoundary ? -1 : endBoundary.diff(min);
|
|
160
169
|
var isWindowDurationZero = windowDuration === 0;
|
|
161
170
|
var zoomFactor = getPercentageMultiplier((_options$zoomFactor = options === null || options === void 0 ? void 0 : options.zoomFactor) !== null && _options$zoomFactor !== void 0 ? _options$zoomFactor : ZOOM_FACTOR_DEFAULT);
|
|
162
171
|
var zoomDelta = windowDuration * (zoomFactor / 2); // Gets added to each end, that's why it's split in half
|
|
@@ -177,7 +186,10 @@ export function useEuiTimeWindow(start, end, apply, options) {
|
|
|
177
186
|
function stepForward() {
|
|
178
187
|
if (isInvalid || isWindowDurationZero) return;
|
|
179
188
|
apply({
|
|
180
|
-
|
|
189
|
+
/* Prevent 1ms drifts for inclusive boundaries by using the exclusive max (+ 1ms)
|
|
190
|
+
as the start of the next window (e.g. 00:00:00.000 instead of 23:59:59.999) */
|
|
191
|
+
start: (isInclusiveBoundary ? endBoundary // `!` is safe here because we early return on `isInvalid`
|
|
192
|
+
: moment(max)).toISOString(),
|
|
181
193
|
end: moment(max).add(windowDuration, 'ms').toISOString()
|
|
182
194
|
});
|
|
183
195
|
}
|
|
@@ -185,7 +197,9 @@ export function useEuiTimeWindow(start, end, apply, options) {
|
|
|
185
197
|
if (isInvalid || isWindowDurationZero) return;
|
|
186
198
|
apply({
|
|
187
199
|
start: moment(min).subtract(windowDuration, 'ms').toISOString(),
|
|
188
|
-
|
|
200
|
+
/* Prevent 1ms drifts for inclusive boundaries by using the exclusive min (- 1ms)
|
|
201
|
+
as the end of the previous window (e.g. 23:59:59.999 instead of 00:00:00.000) */
|
|
202
|
+
end: (isInclusiveBoundary ? moment(min).subtract(1, 'ms') : moment(min)).toISOString()
|
|
189
203
|
});
|
|
190
204
|
}
|
|
191
205
|
function expandWindow() {
|
|
@@ -7,8 +7,9 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
7
7
|
* Side Public License, v 1.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import React, { useMemo } from 'react';
|
|
10
|
+
import React, { useEffect, useMemo, useRef } from 'react';
|
|
11
11
|
import { css, cx } from '@emotion/css';
|
|
12
|
+
import { useCombinedRefs } from '../../services';
|
|
12
13
|
import { EuiOverlayMask } from '../overlay_mask';
|
|
13
14
|
import { EuiPortal } from '../portal';
|
|
14
15
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -16,8 +17,7 @@ var getEuiFlyoutOverlayStyles = function getEuiFlyoutOverlayStyles(zIndex) {
|
|
|
16
17
|
/*
|
|
17
18
|
This needs to have !important to override the default EuiOverlayMask
|
|
18
19
|
z-index based on the headerZindexLocation prop. Using the style attribute
|
|
19
|
-
doesn't work since EuiOverlayMask requires
|
|
20
|
-
causes React errors in the test environment.
|
|
20
|
+
doesn't work since EuiOverlayMask requires the styles to be provided via className
|
|
21
21
|
*/
|
|
22
22
|
return /*#__PURE__*/css("z-index:", zIndex, "!important;;label:getEuiFlyoutOverlayStyles;");
|
|
23
23
|
};
|
|
@@ -38,10 +38,39 @@ export var EuiFlyoutOverlay = function EuiFlyoutOverlay(_ref) {
|
|
|
38
38
|
hasOverlayMask = _ref.hasOverlayMask,
|
|
39
39
|
maskZIndex = _ref.maskZIndex,
|
|
40
40
|
_ref$headerZindexLoca = _ref.headerZindexLocation,
|
|
41
|
-
headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'below' : _ref$headerZindexLoca
|
|
41
|
+
headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'below' : _ref$headerZindexLoca,
|
|
42
|
+
containerRect = _ref.containerRect;
|
|
42
43
|
var styles = useMemo(function () {
|
|
43
44
|
return getEuiFlyoutOverlayStyles(maskZIndex);
|
|
44
45
|
}, [maskZIndex]);
|
|
46
|
+
|
|
47
|
+
// Internal ref so we can apply containerRect positioning directly on the DOM
|
|
48
|
+
// node, avoiding new Emotion CSS class generation on every scroll/resize.
|
|
49
|
+
var internalMaskRef = useRef(null);
|
|
50
|
+
var combinedMaskRef = useCombinedRefs([internalMaskRef, maskProps === null || maskProps === void 0 ? void 0 : maskProps.maskRef]);
|
|
51
|
+
useEffect(function () {
|
|
52
|
+
var node = internalMaskRef.current;
|
|
53
|
+
if (!node) return;
|
|
54
|
+
|
|
55
|
+
// containerRect positioning must be applied via node.style.setProperty rather than
|
|
56
|
+
// through the style prop - EuiOverlayMask requires styles to be passed via className
|
|
57
|
+
if (containerRect) {
|
|
58
|
+
node.style.setProperty('inset-block-start', "".concat(containerRect.top, "px"));
|
|
59
|
+
node.style.setProperty('inset-inline-start', "".concat(containerRect.left, "px"));
|
|
60
|
+
node.style.setProperty('inline-size', "".concat(containerRect.width, "px"));
|
|
61
|
+
node.style.setProperty('block-size', "".concat(containerRect.height, "px"));
|
|
62
|
+
node.style.setProperty('inset-inline-end', 'auto');
|
|
63
|
+
node.style.setProperty('inset-block-end', 'auto');
|
|
64
|
+
} else {
|
|
65
|
+
node.style.removeProperty('inset-block-start');
|
|
66
|
+
node.style.removeProperty('inset-inline-start');
|
|
67
|
+
node.style.removeProperty('inline-size');
|
|
68
|
+
node.style.removeProperty('block-size');
|
|
69
|
+
node.style.removeProperty('inset-inline-end');
|
|
70
|
+
node.style.removeProperty('inset-block-end');
|
|
71
|
+
}
|
|
72
|
+
}, [containerRect, hasOverlayMask]); // toggling ownFocus while the flyout is already open should cause re-render
|
|
73
|
+
|
|
45
74
|
var content = children;
|
|
46
75
|
if (!isPushed || hasOverlayMask) {
|
|
47
76
|
content = ___EmotionJSX(EuiPortal, null, content);
|
|
@@ -50,6 +79,7 @@ export var EuiFlyoutOverlay = function EuiFlyoutOverlay(_ref) {
|
|
|
50
79
|
return ___EmotionJSX(React.Fragment, null, hasOverlayMask && ___EmotionJSX(EuiOverlayMask, _extends({
|
|
51
80
|
headerZindexLocation: (_maskProps$headerZind = maskProps === null || maskProps === void 0 ? void 0 : maskProps.headerZindexLocation) !== null && _maskProps$headerZind !== void 0 ? _maskProps$headerZind : headerZindexLocation
|
|
52
81
|
}, maskProps, {
|
|
82
|
+
maskRef: combinedMaskRef,
|
|
53
83
|
className: classes
|
|
54
84
|
})), content);
|
|
55
85
|
};
|
|
@@ -18,6 +18,14 @@ export var FLYOUT_SIDES = ['left', 'right'];
|
|
|
18
18
|
export var FLYOUT_SIZES = ['s', 'm', 'l', 'fill'];
|
|
19
19
|
/** Type representing a supported named flyout size. */
|
|
20
20
|
|
|
21
|
+
/** Menu display mode: always render menu when flyoutMenuProps is provided. */
|
|
22
|
+
export var MENU_DISPLAY_ALWAYS = 'always';
|
|
23
|
+
/** Menu display mode: only render menu when it has content (back button, history, title, or custom actions). */
|
|
24
|
+
export var MENU_DISPLAY_AUTO = 'auto';
|
|
25
|
+
/** Allowed flyout menu display modes. */
|
|
26
|
+
export var FLYOUT_MENU_DISPLAY_MODES = [MENU_DISPLAY_ALWAYS, MENU_DISPLAY_AUTO];
|
|
27
|
+
/** Type representing a supported flyout menu display mode. */
|
|
28
|
+
|
|
21
29
|
/** Allowed padding sizes for flyout content. */
|
|
22
30
|
export var FLYOUT_PADDING_SIZES = ['none', 's', 'm', 'l'];
|
|
23
31
|
/** Type representing a supported flyout padding size. */
|
|
@@ -32,6 +40,8 @@ export var DEFAULT_SIDE = 'right';
|
|
|
32
40
|
export var DEFAULT_SIZE = 'm';
|
|
33
41
|
/** Default padding size inside flyouts. */
|
|
34
42
|
export var DEFAULT_PADDING_SIZE = 'l';
|
|
43
|
+
/** Default flyout menu display mode. */
|
|
44
|
+
export var DEFAULT_MENU_DISPLAY_MODE = MENU_DISPLAY_AUTO;
|
|
35
45
|
|
|
36
46
|
/**
|
|
37
47
|
* Custom type checker for named flyout sizes since the prop
|