@elastic/eui 94.3.0 → 94.4.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/README.md +3 -0
- package/dist/eui_charts_theme.js +1519 -1519
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +41 -497
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +41 -497
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/es/components/form/form.styles.js +26 -3
- package/es/components/markdown_editor/markdown_editor.js +12 -8
- package/es/components/markdown_editor/markdown_editor.styles.js +29 -0
- package/es/components/markdown_editor/markdown_editor_drop_zone.js +22 -9
- package/es/components/markdown_editor/markdown_editor_drop_zone.styles.js +33 -0
- package/es/components/markdown_editor/markdown_editor_footer.js +11 -2
- package/es/components/markdown_editor/markdown_editor_footer.styles.js +26 -0
- package/es/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/es/components/markdown_editor/markdown_editor_text_area.styles.js +22 -0
- package/es/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/es/components/markdown_editor/markdown_editor_toolbar.styles.js +21 -0
- package/es/components/markdown_editor/markdown_format.js +9 -6
- package/es/components/markdown_editor/markdown_format.styles.js +25 -10
- package/es/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -3
- package/es/components/markdown_editor/plugins/markdown_tooltip/renderer.js +13 -2
- package/es/components/selectable/selectable.js +10 -2
- package/es/components/selectable/selectable_list/selectable_list.js +95 -42
- package/es/components/selectable/selectable_list/selectable_list_item.js +234 -204
- package/es/components/selectable/selectable_option.js +9 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +10 -2
- package/es/components/text/text_color.js +4 -1
- package/es/components/toast/global_toast_list_item.js +5 -5
- package/eui.d.ts +332 -234
- package/i18ntokens.json +124 -106
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/lib/components/form/form.styles.js +30 -4
- package/lib/components/markdown_editor/markdown_editor.js +12 -8
- package/lib/components/markdown_editor/markdown_editor.styles.js +37 -0
- package/lib/components/markdown_editor/markdown_editor_drop_zone.js +20 -8
- package/lib/components/markdown_editor/markdown_editor_drop_zone.styles.js +38 -0
- package/lib/components/markdown_editor/markdown_editor_footer.js +10 -1
- package/lib/components/markdown_editor/markdown_editor_footer.styles.js +33 -0
- package/lib/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/lib/components/markdown_editor/markdown_editor_text_area.styles.js +29 -0
- package/lib/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/lib/components/markdown_editor/markdown_editor_toolbar.styles.js +28 -0
- package/lib/components/markdown_editor/markdown_format.js +8 -5
- package/lib/components/markdown_editor/markdown_format.styles.js +25 -10
- package/lib/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -4
- package/lib/components/markdown_editor/plugins/markdown_tooltip/renderer.js +19 -10
- package/lib/components/selectable/selectable.js +10 -2
- package/lib/components/selectable/selectable_list/selectable_list.js +95 -42
- package/lib/components/selectable/selectable_list/selectable_list_item.js +241 -210
- package/lib/components/selectable/selectable_option.js +12 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +10 -2
- package/lib/components/text/text_color.js +6 -2
- package/lib/components/toast/global_toast_list_item.js +5 -5
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/optimize/es/components/form/form.styles.js +26 -3
- package/optimize/es/components/markdown_editor/markdown_editor.js +12 -8
- package/optimize/es/components/markdown_editor/markdown_editor.styles.js +29 -0
- package/optimize/es/components/markdown_editor/markdown_editor_drop_zone.js +19 -9
- package/optimize/es/components/markdown_editor/markdown_editor_drop_zone.styles.js +33 -0
- package/optimize/es/components/markdown_editor/markdown_editor_footer.js +11 -2
- package/optimize/es/components/markdown_editor/markdown_editor_footer.styles.js +26 -0
- package/optimize/es/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/optimize/es/components/markdown_editor/markdown_editor_text_area.styles.js +22 -0
- package/optimize/es/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/optimize/es/components/markdown_editor/markdown_editor_toolbar.styles.js +21 -0
- package/optimize/es/components/markdown_editor/markdown_format.js +9 -6
- package/optimize/es/components/markdown_editor/markdown_format.styles.js +25 -10
- package/optimize/es/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -3
- package/optimize/es/components/markdown_editor/plugins/markdown_tooltip/renderer.js +13 -2
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +81 -38
- package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +217 -198
- package/optimize/es/components/selectable/selectable_option.js +9 -1
- package/optimize/es/components/text/text_color.js +4 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/optimize/lib/components/form/form.styles.js +30 -4
- package/optimize/lib/components/markdown_editor/markdown_editor.js +12 -8
- package/optimize/lib/components/markdown_editor/markdown_editor.styles.js +37 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_drop_zone.js +24 -16
- package/optimize/lib/components/markdown_editor/markdown_editor_drop_zone.styles.js +38 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_footer.js +10 -1
- package/optimize/lib/components/markdown_editor/markdown_editor_footer.styles.js +33 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/optimize/lib/components/markdown_editor/markdown_editor_text_area.styles.js +29 -0
- package/optimize/lib/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/optimize/lib/components/markdown_editor/markdown_editor_toolbar.styles.js +28 -0
- package/optimize/lib/components/markdown_editor/markdown_format.js +8 -5
- package/optimize/lib/components/markdown_editor/markdown_format.styles.js +25 -10
- package/optimize/lib/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -4
- package/optimize/lib/components/markdown_editor/plugins/markdown_tooltip/renderer.js +19 -10
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +81 -38
- package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +224 -204
- package/optimize/lib/components/selectable/selectable_option.js +12 -1
- package/optimize/lib/components/text/text_color.js +6 -2
- package/package.json +5 -12
- package/src/components/date_picker/react-datepicker/LICENSE +21 -0
- package/src/components/date_picker/react-datepicker/README.md +168 -0
- package/src/components/date_picker/super_date_picker/date_popover/_absolute_tab.scss +13 -18
- package/src/components/form/checkbox/_checkbox.scss +23 -6
- package/src/components/index.scss +0 -1
- package/src/components/selectable/selectable_list/_selectable_list_item.scss +4 -0
- package/src/components/selectable/selectable_templates/_selectable_template_sitewide_option.scss +5 -1
- package/src/services/theme/README.md +153 -0
- package/src/test/README.md +44 -0
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +5 -1
- package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +25 -11
- package/test-env/components/form/form.styles.js +30 -4
- package/test-env/components/markdown_editor/markdown_editor.js +12 -8
- package/test-env/components/markdown_editor/markdown_editor.styles.js +37 -0
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +24 -16
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.styles.js +38 -0
- package/test-env/components/markdown_editor/markdown_editor_footer.js +10 -1
- package/test-env/components/markdown_editor/markdown_editor_footer.styles.js +33 -0
- package/test-env/components/markdown_editor/markdown_editor_text_area.js +6 -1
- package/test-env/components/markdown_editor/markdown_editor_text_area.styles.js +29 -0
- package/test-env/components/markdown_editor/markdown_editor_toolbar.js +10 -2
- package/test-env/components/markdown_editor/markdown_editor_toolbar.styles.js +28 -0
- package/test-env/components/markdown_editor/markdown_format.js +8 -5
- package/test-env/components/markdown_editor/markdown_format.styles.js +25 -10
- package/test-env/components/markdown_editor/plugins/markdown_checkbox/renderer.js +9 -4
- package/test-env/components/markdown_editor/plugins/markdown_tooltip/renderer.js +19 -10
- package/test-env/components/selectable/selectable.js +10 -2
- package/test-env/components/selectable/selectable_list/selectable_list.js +95 -42
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +233 -205
- package/test-env/components/selectable/selectable_option.js +12 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +10 -2
- package/test-env/components/text/text_color.js +6 -2
- package/test-env/components/toast/global_toast_list_item.js +5 -5
- package/src/components/markdown_editor/_index.scss +0 -9
- package/src/components/markdown_editor/_markdown_editor.scss +0 -22
- package/src/components/markdown_editor/_markdown_editor_drop_zone.scss +0 -58
- package/src/components/markdown_editor/_markdown_editor_footer.scss +0 -42
- package/src/components/markdown_editor/_markdown_editor_preview.scss +0 -20
- package/src/components/markdown_editor/_markdown_editor_text_area.scss +0 -43
- package/src/components/markdown_editor/_markdown_editor_toolbar.scss +0 -29
- package/src/components/markdown_editor/_markdown_format.scss +0 -78
- package/src/components/markdown_editor/_variables.scss +0 -1
- package/src/components/markdown_editor/plugins/markdown_tooltip.scss +0 -4
- package/src/themes/amsterdam/overrides/_markdown_editor.scss +0 -18
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { css } from '@emotion/react';
|
|
10
|
+
import { transparentize } from '../../services';
|
|
10
11
|
import { logicalCSS, euiFontSize, mathWithUnits } from '../../global_styling';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -15,10 +16,7 @@ import { logicalCSS, euiFontSize, mathWithUnits } from '../../global_styling';
|
|
|
15
16
|
// Internal utility for text scales/sizes
|
|
16
17
|
var euiScaleMarkdownFormatText = function euiScaleMarkdownFormatText(euiTheme, options) {
|
|
17
18
|
var _euiFontSize = euiFontSize(euiTheme, 'm', options),
|
|
18
|
-
fontSize = _euiFontSize.fontSize
|
|
19
|
-
lineHeight = _euiFontSize.lineHeight;
|
|
20
|
-
var unit = options.unit;
|
|
21
|
-
var lineHeightSize = unit === 'em' ? "".concat(lineHeight, "em") : lineHeight;
|
|
19
|
+
fontSize = _euiFontSize.fontSize;
|
|
22
20
|
|
|
23
21
|
// Custom scales
|
|
24
22
|
var tablePaddingVertical = mathWithUnits(fontSize, function (x) {
|
|
@@ -27,7 +25,14 @@ var euiScaleMarkdownFormatText = function euiScaleMarkdownFormatText(euiTheme, o
|
|
|
27
25
|
var tablePaddingHorizontal = mathWithUnits(fontSize, function (x) {
|
|
28
26
|
return x / 2;
|
|
29
27
|
});
|
|
30
|
-
return "\n .
|
|
28
|
+
return "\n .euiMarkdownFormat__codeblockWrapper {\n ".concat(logicalCSS('margin-bottom', fontSize), "\n }\n\n .euiMarkdownFormat__table {\n ").concat(logicalCSS('margin-bottom', fontSize), "\n }\n\n .euiMarkdownFormat__table th,\n .euiMarkdownFormat__table td {\n ").concat(logicalCSS('padding-vertical', tablePaddingVertical), "\n ").concat(logicalCSS('padding-horizontal', tablePaddingHorizontal), "\n }\n ");
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Internal utility for generating border colors based on EuiText colors
|
|
32
|
+
var euiMarkdownAdjustBorderColors = function euiMarkdownAdjustBorderColors(_ref, color) {
|
|
33
|
+
var euiTheme = _ref.euiTheme;
|
|
34
|
+
var border = "".concat(euiTheme.border.width.thin, " solid ").concat(color);
|
|
35
|
+
return "\n .euiMarkdownFormat__blockquote {\n ".concat(logicalCSS('border-left-color', color), "\n }\n\n .euiHorizontalRule {\n background-color: ").concat(color, ";\n color: ").concat(color, "; /* ensure that firefox gets the currentColor */\n }\n\n /* Tables */\n\n .euiMarkdownFormat__table {\n display: block;\n ").concat(logicalCSS('width', '100%'), "\n overflow: auto;\n border-spacing: 0;\n border-collapse: collapse;\n ").concat(logicalCSS('border-left', border), "\n }\n\n .euiMarkdownFormat__table th,\n .euiMarkdownFormat__table td {\n ").concat(logicalCSS('border-vertical', border), "\n\n &:last-child {\n ").concat(logicalCSS('border-right', border), "\n }\n }\n\n .euiMarkdownFormat__table tr {\n ").concat(logicalCSS('border-top', border), "\n }\n ");
|
|
31
36
|
};
|
|
32
37
|
|
|
33
38
|
/**
|
|
@@ -35,20 +40,30 @@ var euiScaleMarkdownFormatText = function euiScaleMarkdownFormatText(euiTheme, o
|
|
|
35
40
|
*/
|
|
36
41
|
export var euiMarkdownFormatStyles = function euiMarkdownFormatStyles(euiTheme) {
|
|
37
42
|
return {
|
|
38
|
-
// TODO: Remaining _markdown_format.scss styles
|
|
39
43
|
euiMarkdownFormat: /*#__PURE__*/css(";label:euiMarkdownFormat;"),
|
|
40
44
|
// Text sizes
|
|
41
45
|
m: /*#__PURE__*/css(euiScaleMarkdownFormatText(euiTheme, {
|
|
42
46
|
customScale: 'm'
|
|
43
|
-
}), "
|
|
47
|
+
}), ";label:m;"),
|
|
44
48
|
s: /*#__PURE__*/css(euiScaleMarkdownFormatText(euiTheme, {
|
|
45
49
|
customScale: 's'
|
|
46
|
-
}), "
|
|
50
|
+
}), ";label:s;"),
|
|
47
51
|
xs: /*#__PURE__*/css(euiScaleMarkdownFormatText(euiTheme, {
|
|
48
52
|
customScale: 'xs'
|
|
49
|
-
}), "
|
|
53
|
+
}), ";label:xs;"),
|
|
50
54
|
relative: /*#__PURE__*/css(euiScaleMarkdownFormatText(euiTheme, {
|
|
51
55
|
unit: 'em'
|
|
52
|
-
}), "
|
|
56
|
+
}), ";label:relative;"),
|
|
57
|
+
colors: {
|
|
58
|
+
default: /*#__PURE__*/css(euiMarkdownAdjustBorderColors(euiTheme, transparentize(euiTheme.euiTheme.colors.fullShade, 0.15)), ";label:default;"),
|
|
59
|
+
subdued: /*#__PURE__*/css(euiMarkdownAdjustBorderColors(euiTheme, euiTheme.euiTheme.colors.subduedText), ";label:subdued;"),
|
|
60
|
+
success: /*#__PURE__*/css(euiMarkdownAdjustBorderColors(euiTheme, euiTheme.euiTheme.colors.success), ";label:success;"),
|
|
61
|
+
accent: /*#__PURE__*/css(euiMarkdownAdjustBorderColors(euiTheme, euiTheme.euiTheme.colors.accent), ";label:accent;"),
|
|
62
|
+
warning: /*#__PURE__*/css(euiMarkdownAdjustBorderColors(euiTheme, euiTheme.euiTheme.colors.warning), ";label:warning;"),
|
|
63
|
+
danger: /*#__PURE__*/css(euiMarkdownAdjustBorderColors(euiTheme, euiTheme.euiTheme.colors.danger), ";label:danger;"),
|
|
64
|
+
ghost: /*#__PURE__*/css(euiMarkdownAdjustBorderColors(euiTheme, euiTheme.euiTheme.colors.ghost), ";label:ghost;"),
|
|
65
|
+
inherit: /*#__PURE__*/css(euiMarkdownAdjustBorderColors(euiTheme, 'currentColor'), ";label:inherit;"),
|
|
66
|
+
custom: /*#__PURE__*/css(euiMarkdownAdjustBorderColors(euiTheme, 'currentColor'), ";label:custom;")
|
|
67
|
+
}
|
|
53
68
|
};
|
|
54
69
|
};
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import React, { useContext } from 'react';
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import { logicalCSS } from '../../../../global_styling';
|
|
10
12
|
import { EuiCheckbox } from '../../../form/checkbox';
|
|
11
13
|
import { EuiMarkdownContext } from '../../markdown_context';
|
|
12
14
|
import { useGeneratedHtmlId } from '../../../../services/accessibility';
|
|
@@ -18,13 +20,17 @@ export var CheckboxMarkdownRenderer = function CheckboxMarkdownRenderer(_ref) {
|
|
|
18
20
|
isChecked = _ref.isChecked,
|
|
19
21
|
children = _ref.children;
|
|
20
22
|
var _useContext = useContext(EuiMarkdownContext),
|
|
21
|
-
replaceNode = _useContext.replaceNode
|
|
23
|
+
replaceNode = _useContext.replaceNode,
|
|
24
|
+
readOnly = _useContext.readOnly;
|
|
22
25
|
return ___EmotionJSX(EuiCheckbox, {
|
|
23
26
|
id: useGeneratedHtmlId(),
|
|
24
27
|
checked: isChecked,
|
|
25
28
|
label: children,
|
|
26
29
|
onChange: function onChange() {
|
|
27
30
|
replaceNode(position, "".concat(lead, "[").concat(isChecked ? ' ' : 'x', "]").concat(label));
|
|
28
|
-
}
|
|
31
|
+
},
|
|
32
|
+
css: markdownCheckboxStyles,
|
|
33
|
+
readOnly: readOnly
|
|
29
34
|
});
|
|
30
|
-
};
|
|
35
|
+
};
|
|
36
|
+
var markdownCheckboxStyles = /*#__PURE__*/css("&&{.euiCheckbox__input~.euiCheckbox__label{font-size:inherit;line-height:inherit;", logicalCSS('padding-left', '1.5em'), ";}&:has(+ :not(.euiCheckbox)){", logicalCSS('margin-bottom', '1em'), ";}.euiCheckbox__input+.euiCheckbox__square{", logicalCSS('top', '50%'), " transform:translateY(-50%);}};label:markdownCheckboxStyles;");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
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)."; }
|
|
1
2
|
/*
|
|
2
3
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
4
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -10,13 +11,23 @@ import React from 'react';
|
|
|
10
11
|
import { EuiToolTip } from '../../../tool_tip';
|
|
11
12
|
import { EuiIcon } from '../../../icon';
|
|
12
13
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
14
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
15
|
+
name: "blrk0m-tooltipMarkdownRenderer",
|
|
16
|
+
styles: "transform:translateY(-1px);label:tooltipMarkdownRenderer;"
|
|
17
|
+
} : {
|
|
18
|
+
name: "blrk0m-tooltipMarkdownRenderer",
|
|
19
|
+
styles: "transform:translateY(-1px);label:tooltipMarkdownRenderer;",
|
|
20
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
21
|
+
};
|
|
13
22
|
export var tooltipMarkdownRenderer = function tooltipMarkdownRenderer(_ref) {
|
|
14
23
|
var content = _ref.content,
|
|
15
24
|
children = _ref.children;
|
|
16
25
|
return ___EmotionJSX("span", null, ___EmotionJSX(EuiToolTip, {
|
|
17
26
|
content: content
|
|
18
27
|
}, ___EmotionJSX("span", null, ___EmotionJSX("strong", null, children), ___EmotionJSX(EuiIcon, {
|
|
19
|
-
type: "questionInCircle"
|
|
20
|
-
|
|
28
|
+
type: "questionInCircle"
|
|
29
|
+
// This is to offset the tooltip icon, which isn't perfectly centered
|
|
30
|
+
,
|
|
31
|
+
css: _ref2
|
|
21
32
|
}))));
|
|
22
33
|
};
|
|
@@ -41,6 +41,9 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
41
41
|
var _this;
|
|
42
42
|
_classCallCheck(this, EuiSelectableList);
|
|
43
43
|
_this = _super.call(this, props);
|
|
44
|
+
_defineProperty(_assertThisInitialized(_this), "animationFrameId", void 0);
|
|
45
|
+
// counter for tracking list renders and ensuring rerenders
|
|
46
|
+
_defineProperty(_assertThisInitialized(_this), "listRowRerender", 0);
|
|
44
47
|
_defineProperty(_assertThisInitialized(_this), "listRef", null);
|
|
45
48
|
_defineProperty(_assertThisInitialized(_this), "listBoxRef", null);
|
|
46
49
|
_defineProperty(_assertThisInitialized(_this), "setListRef", function (ref) {
|
|
@@ -165,7 +168,6 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
165
168
|
event.persist(); // NOTE: This is needed for React v16 backwards compatibility
|
|
166
169
|
_this.onAddOrRemoveOption(option, event);
|
|
167
170
|
},
|
|
168
|
-
ref: ref ? ref.bind(null, index) : undefined,
|
|
169
171
|
isFocused: isFocused,
|
|
170
172
|
title: searchableLabel || label,
|
|
171
173
|
checked: checked,
|
|
@@ -266,7 +268,7 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
266
268
|
_this.focusBadgeOffset = _this.props.onFocusBadge === false ? 0 : 46;
|
|
267
269
|
|
|
268
270
|
// Wait a tick for the listbox ref to update before proceeding
|
|
269
|
-
requestAnimationFrame(function () {
|
|
271
|
+
_this.animationFrameId = requestAnimationFrame(function () {
|
|
270
272
|
var scrollbarOffset = _this.listBoxRef ? containerWidth - _this.listBoxRef.offsetWidth : 0;
|
|
271
273
|
_this.setState({
|
|
272
274
|
defaultOptionWidth: containerWidth - scrollbarOffset - paddingOffset - checkedIconOffset
|
|
@@ -418,13 +420,47 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
418
420
|
return _this;
|
|
419
421
|
}
|
|
420
422
|
_createClass(EuiSelectableList, [{
|
|
423
|
+
key: "componentWillUnmount",
|
|
424
|
+
value: function componentWillUnmount() {
|
|
425
|
+
// ensure requestAnimationFrame is canceled on unmount as
|
|
426
|
+
// it could potentially run on a next tick otherwise
|
|
427
|
+
if (this.animationFrameId !== undefined) {
|
|
428
|
+
cancelAnimationFrame(this.animationFrameId);
|
|
429
|
+
this.animationFrameId = undefined;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}, {
|
|
433
|
+
key: "shouldComponentUpdate",
|
|
434
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
435
|
+
var _this$props9 = this.props,
|
|
436
|
+
allowExclusions = _this$props9.allowExclusions,
|
|
437
|
+
showIcons = _this$props9.showIcons,
|
|
438
|
+
paddingSize = _this$props9.paddingSize,
|
|
439
|
+
textWrap = _this$props9.textWrap,
|
|
440
|
+
onFocusBadge = _this$props9.onFocusBadge,
|
|
441
|
+
searchable = _this$props9.searchable;
|
|
442
|
+
|
|
443
|
+
// using shouldComponentUpdate to determine needed rerender before actual rerender
|
|
444
|
+
// without needing state updates or lagging behind on updates
|
|
445
|
+
if (nextProps.allowExclusions !== allowExclusions || nextProps.showIcons !== showIcons || nextProps.paddingSize !== paddingSize || nextProps.textWrap !== textWrap || nextProps.onFocusBadge !== onFocusBadge || nextProps.searchable !== searchable) {
|
|
446
|
+
this.listRowRerender += 1;
|
|
447
|
+
}
|
|
448
|
+
return true;
|
|
449
|
+
}
|
|
450
|
+
}, {
|
|
421
451
|
key: "componentDidUpdate",
|
|
422
452
|
value: function componentDidUpdate(prevProps) {
|
|
423
|
-
var _this$
|
|
424
|
-
isVirtualized = _this$
|
|
425
|
-
activeOptionIndex = _this$
|
|
426
|
-
visibleOptions = _this$
|
|
427
|
-
options = _this$
|
|
453
|
+
var _this$props10 = this.props,
|
|
454
|
+
isVirtualized = _this$props10.isVirtualized,
|
|
455
|
+
activeOptionIndex = _this$props10.activeOptionIndex,
|
|
456
|
+
visibleOptions = _this$props10.visibleOptions,
|
|
457
|
+
options = _this$props10.options,
|
|
458
|
+
allowExclusions = _this$props10.allowExclusions,
|
|
459
|
+
showIcons = _this$props10.showIcons,
|
|
460
|
+
paddingSize = _this$props10.paddingSize,
|
|
461
|
+
textWrap = _this$props10.textWrap,
|
|
462
|
+
onFocusBadge = _this$props10.onFocusBadge,
|
|
463
|
+
searchable = _this$props10.searchable;
|
|
428
464
|
if (prevProps.activeOptionIndex !== activeOptionIndex) {
|
|
429
465
|
var makeOptionId = this.props.makeOptionId;
|
|
430
466
|
if (this.listBoxRef && this.props.searchable !== true) {
|
|
@@ -456,41 +492,48 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
456
492
|
itemData: _objectSpread({}, optionArray)
|
|
457
493
|
}, this.calculateAriaSetAttrs(optionArray)));
|
|
458
494
|
}
|
|
495
|
+
|
|
496
|
+
// ensure that ListRow updates based on item props
|
|
497
|
+
if (isVirtualized) {
|
|
498
|
+
if (prevProps.allowExclusions !== allowExclusions || prevProps.showIcons !== showIcons || prevProps.paddingSize !== paddingSize || prevProps.textWrap !== textWrap || prevProps.onFocusBadge !== onFocusBadge || prevProps.searchable !== searchable) {
|
|
499
|
+
this.forceVirtualizedListRowRerender();
|
|
500
|
+
}
|
|
501
|
+
}
|
|
459
502
|
}
|
|
460
503
|
}, {
|
|
461
504
|
key: "render",
|
|
462
505
|
value: function render() {
|
|
463
506
|
var _this2 = this;
|
|
464
|
-
var _this$
|
|
465
|
-
className = _this$
|
|
466
|
-
options = _this$
|
|
467
|
-
searchValue = _this$
|
|
468
|
-
onOptionClick = _this$
|
|
469
|
-
renderOption = _this$
|
|
470
|
-
forcedHeight = _this$
|
|
471
|
-
windowProps = _this$
|
|
472
|
-
rowHeight = _this$
|
|
473
|
-
activeOptionIndex = _this$
|
|
474
|
-
makeOptionId = _this$
|
|
475
|
-
showIcons = _this$
|
|
476
|
-
singleSelection = _this$
|
|
477
|
-
visibleOptions = _this$
|
|
478
|
-
allowExclusions = _this$
|
|
479
|
-
bordered = _this$
|
|
480
|
-
paddingSize = _this$
|
|
481
|
-
searchable = _this$
|
|
482
|
-
onFocusBadge = _this$
|
|
483
|
-
listId = _this$
|
|
484
|
-
setActiveOptionIndex = _this$
|
|
485
|
-
ariaLabel = _this$
|
|
486
|
-
ariaLabelledby = _this$
|
|
487
|
-
ariaDescribedby = _this$
|
|
488
|
-
role = _this$
|
|
489
|
-
isPreFiltered = _this$
|
|
490
|
-
isVirtualized = _this$
|
|
491
|
-
textWrap = _this$
|
|
492
|
-
truncationProps = _this$
|
|
493
|
-
rest = _objectWithoutProperties(_this$
|
|
507
|
+
var _this$props11 = this.props,
|
|
508
|
+
className = _this$props11.className,
|
|
509
|
+
options = _this$props11.options,
|
|
510
|
+
searchValue = _this$props11.searchValue,
|
|
511
|
+
onOptionClick = _this$props11.onOptionClick,
|
|
512
|
+
renderOption = _this$props11.renderOption,
|
|
513
|
+
forcedHeight = _this$props11.height,
|
|
514
|
+
windowProps = _this$props11.windowProps,
|
|
515
|
+
rowHeight = _this$props11.rowHeight,
|
|
516
|
+
activeOptionIndex = _this$props11.activeOptionIndex,
|
|
517
|
+
makeOptionId = _this$props11.makeOptionId,
|
|
518
|
+
showIcons = _this$props11.showIcons,
|
|
519
|
+
singleSelection = _this$props11.singleSelection,
|
|
520
|
+
visibleOptions = _this$props11.visibleOptions,
|
|
521
|
+
allowExclusions = _this$props11.allowExclusions,
|
|
522
|
+
bordered = _this$props11.bordered,
|
|
523
|
+
paddingSize = _this$props11.paddingSize,
|
|
524
|
+
searchable = _this$props11.searchable,
|
|
525
|
+
onFocusBadge = _this$props11.onFocusBadge,
|
|
526
|
+
listId = _this$props11.listId,
|
|
527
|
+
setActiveOptionIndex = _this$props11.setActiveOptionIndex,
|
|
528
|
+
ariaLabel = _this$props11['aria-label'],
|
|
529
|
+
ariaLabelledby = _this$props11['aria-labelledby'],
|
|
530
|
+
ariaDescribedby = _this$props11['aria-describedby'],
|
|
531
|
+
role = _this$props11.role,
|
|
532
|
+
isPreFiltered = _this$props11.isPreFiltered,
|
|
533
|
+
isVirtualized = _this$props11.isVirtualized,
|
|
534
|
+
textWrap = _this$props11.textWrap,
|
|
535
|
+
truncationProps = _this$props11.truncationProps,
|
|
536
|
+
rest = _objectWithoutProperties(_this$props11, _excluded3);
|
|
494
537
|
var heightIsFull = forcedHeight === 'full';
|
|
495
538
|
var classes = classNames('euiSelectableList', {
|
|
496
539
|
'euiSelectableList-fullHeight': heightIsFull,
|
|
@@ -508,7 +551,7 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
508
551
|
ref: this.setListBoxRef
|
|
509
552
|
}, this.state.optionArray.map(function (_, index) {
|
|
510
553
|
return /*#__PURE__*/React.createElement(_this2.ListRow, {
|
|
511
|
-
key: index,
|
|
554
|
+
key: "".concat(index, "-").concat(_this2.listRowRerender),
|
|
512
555
|
data: _this2.state.optionArray,
|
|
513
556
|
index: index
|
|
514
557
|
}, null);
|