@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
|
};
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
import React, { useContext } from 'react';
|
|
10
10
|
import PropTypes from "prop-types";
|
|
11
|
+
import { css } from '@emotion/react';
|
|
12
|
+
import { logicalCSS } from '../../../../global_styling';
|
|
11
13
|
import { EuiCheckbox } from '../../../form/checkbox';
|
|
12
14
|
import { EuiMarkdownContext } from '../../markdown_context';
|
|
13
15
|
import { useGeneratedHtmlId } from '../../../../services/accessibility';
|
|
@@ -19,14 +21,17 @@ export var CheckboxMarkdownRenderer = function CheckboxMarkdownRenderer(_ref) {
|
|
|
19
21
|
isChecked = _ref.isChecked,
|
|
20
22
|
children = _ref.children;
|
|
21
23
|
var _useContext = useContext(EuiMarkdownContext),
|
|
22
|
-
replaceNode = _useContext.replaceNode
|
|
24
|
+
replaceNode = _useContext.replaceNode,
|
|
25
|
+
readOnly = _useContext.readOnly;
|
|
23
26
|
return ___EmotionJSX(EuiCheckbox, {
|
|
24
27
|
id: useGeneratedHtmlId(),
|
|
25
28
|
checked: isChecked,
|
|
26
29
|
label: children,
|
|
27
30
|
onChange: function onChange() {
|
|
28
31
|
replaceNode(position, "".concat(lead, "[").concat(isChecked ? ' ' : 'x', "]").concat(label));
|
|
29
|
-
}
|
|
32
|
+
},
|
|
33
|
+
css: markdownCheckboxStyles,
|
|
34
|
+
readOnly: readOnly
|
|
30
35
|
});
|
|
31
36
|
};
|
|
32
37
|
CheckboxMarkdownRenderer.propTypes = {
|
|
@@ -46,4 +51,5 @@ CheckboxMarkdownRenderer.propTypes = {
|
|
|
46
51
|
offset: PropTypes.number.isRequired
|
|
47
52
|
}).isRequired
|
|
48
53
|
}).isRequired
|
|
49
|
-
};
|
|
54
|
+
};
|
|
55
|
+
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
|
|
@@ -11,14 +12,24 @@ import PropTypes from "prop-types";
|
|
|
11
12
|
import { EuiToolTip } from '../../../tool_tip';
|
|
12
13
|
import { EuiIcon } from '../../../icon';
|
|
13
14
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
15
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
16
|
+
name: "blrk0m-tooltipMarkdownRenderer",
|
|
17
|
+
styles: "transform:translateY(-1px);label:tooltipMarkdownRenderer;"
|
|
18
|
+
} : {
|
|
19
|
+
name: "blrk0m-tooltipMarkdownRenderer",
|
|
20
|
+
styles: "transform:translateY(-1px);label:tooltipMarkdownRenderer;",
|
|
21
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
|
+
};
|
|
14
23
|
export var tooltipMarkdownRenderer = function tooltipMarkdownRenderer(_ref) {
|
|
15
24
|
var content = _ref.content,
|
|
16
25
|
children = _ref.children;
|
|
17
26
|
return ___EmotionJSX("span", null, ___EmotionJSX(EuiToolTip, {
|
|
18
27
|
content: content
|
|
19
28
|
}, ___EmotionJSX("span", null, ___EmotionJSX("strong", null, children), ___EmotionJSX(EuiIcon, {
|
|
20
|
-
type: "questionInCircle"
|
|
21
|
-
|
|
29
|
+
type: "questionInCircle"
|
|
30
|
+
// This is to offset the tooltip icon, which isn't perfectly centered
|
|
31
|
+
,
|
|
32
|
+
css: _ref2
|
|
22
33
|
}))));
|
|
23
34
|
};
|
|
24
35
|
tooltipMarkdownRenderer.propTypes = {
|
|
@@ -634,7 +634,7 @@ EuiSelectable.propTypes = {
|
|
|
634
634
|
* 'on' to indicate inclusion, 'off' to indicate exclusion,
|
|
635
635
|
* or 'mixed' to indicate inclusion for some.
|
|
636
636
|
*/
|
|
637
|
-
checked: PropTypes.
|
|
637
|
+
checked: PropTypes.any,
|
|
638
638
|
disabled: PropTypes.bool,
|
|
639
639
|
/**
|
|
640
640
|
* Node to add between the selection icon and the label
|
|
@@ -664,7 +664,15 @@ EuiSelectable.propTypes = {
|
|
|
664
664
|
* Note: when searching, custom truncation props are ignored. The highlighted search
|
|
665
665
|
* text will always take precedence.
|
|
666
666
|
*/
|
|
667
|
-
truncationProps: PropTypes.any
|
|
667
|
+
truncationProps: PropTypes.any,
|
|
668
|
+
/**
|
|
669
|
+
* Optional custom tooltip content for the button
|
|
670
|
+
*/
|
|
671
|
+
toolTipContent: PropTypes.node,
|
|
672
|
+
/**
|
|
673
|
+
* Optional props to pass to the underlying **[EuiToolTip](/#/display/tooltip)**
|
|
674
|
+
*/
|
|
675
|
+
toolTipProps: PropTypes.any
|
|
668
676
|
}).isRequired).isRequired,
|
|
669
677
|
/**
|
|
670
678
|
* Passes back the altered `options` array with selected options having `checked: 'on'`.
|
|
@@ -47,6 +47,9 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
47
47
|
var _this;
|
|
48
48
|
_classCallCheck(this, EuiSelectableList);
|
|
49
49
|
_this = _super.call(this, props);
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "animationFrameId", void 0);
|
|
51
|
+
// counter for tracking list renders and ensuring rerenders
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "listRowRerender", 0);
|
|
50
53
|
_defineProperty(_assertThisInitialized(_this), "listRef", null);
|
|
51
54
|
_defineProperty(_assertThisInitialized(_this), "listBoxRef", null);
|
|
52
55
|
_defineProperty(_assertThisInitialized(_this), "setListRef", function (ref) {
|
|
@@ -171,7 +174,6 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
171
174
|
event.persist(); // NOTE: This is needed for React v16 backwards compatibility
|
|
172
175
|
_this.onAddOrRemoveOption(option, event);
|
|
173
176
|
},
|
|
174
|
-
ref: ref ? ref.bind(null, index) : undefined,
|
|
175
177
|
isFocused: isFocused,
|
|
176
178
|
title: searchableLabel || label,
|
|
177
179
|
checked: checked,
|
|
@@ -272,7 +274,7 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
272
274
|
_this.focusBadgeOffset = _this.props.onFocusBadge === false ? 0 : 46;
|
|
273
275
|
|
|
274
276
|
// Wait a tick for the listbox ref to update before proceeding
|
|
275
|
-
requestAnimationFrame(function () {
|
|
277
|
+
_this.animationFrameId = requestAnimationFrame(function () {
|
|
276
278
|
var scrollbarOffset = _this.listBoxRef ? containerWidth - _this.listBoxRef.offsetWidth : 0;
|
|
277
279
|
_this.setState({
|
|
278
280
|
defaultOptionWidth: containerWidth - scrollbarOffset - paddingOffset - checkedIconOffset
|
|
@@ -424,13 +426,47 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
424
426
|
return _this;
|
|
425
427
|
}
|
|
426
428
|
_createClass(EuiSelectableList, [{
|
|
429
|
+
key: "componentWillUnmount",
|
|
430
|
+
value: function componentWillUnmount() {
|
|
431
|
+
// ensure requestAnimationFrame is canceled on unmount as
|
|
432
|
+
// it could potentially run on a next tick otherwise
|
|
433
|
+
if (this.animationFrameId !== undefined) {
|
|
434
|
+
cancelAnimationFrame(this.animationFrameId);
|
|
435
|
+
this.animationFrameId = undefined;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}, {
|
|
439
|
+
key: "shouldComponentUpdate",
|
|
440
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
441
|
+
var _this$props9 = this.props,
|
|
442
|
+
allowExclusions = _this$props9.allowExclusions,
|
|
443
|
+
showIcons = _this$props9.showIcons,
|
|
444
|
+
paddingSize = _this$props9.paddingSize,
|
|
445
|
+
textWrap = _this$props9.textWrap,
|
|
446
|
+
onFocusBadge = _this$props9.onFocusBadge,
|
|
447
|
+
searchable = _this$props9.searchable;
|
|
448
|
+
|
|
449
|
+
// using shouldComponentUpdate to determine needed rerender before actual rerender
|
|
450
|
+
// without needing state updates or lagging behind on updates
|
|
451
|
+
if (nextProps.allowExclusions !== allowExclusions || nextProps.showIcons !== showIcons || nextProps.paddingSize !== paddingSize || nextProps.textWrap !== textWrap || nextProps.onFocusBadge !== onFocusBadge || nextProps.searchable !== searchable) {
|
|
452
|
+
this.listRowRerender += 1;
|
|
453
|
+
}
|
|
454
|
+
return true;
|
|
455
|
+
}
|
|
456
|
+
}, {
|
|
427
457
|
key: "componentDidUpdate",
|
|
428
458
|
value: function componentDidUpdate(prevProps) {
|
|
429
|
-
var _this$
|
|
430
|
-
isVirtualized = _this$
|
|
431
|
-
activeOptionIndex = _this$
|
|
432
|
-
visibleOptions = _this$
|
|
433
|
-
options = _this$
|
|
459
|
+
var _this$props10 = this.props,
|
|
460
|
+
isVirtualized = _this$props10.isVirtualized,
|
|
461
|
+
activeOptionIndex = _this$props10.activeOptionIndex,
|
|
462
|
+
visibleOptions = _this$props10.visibleOptions,
|
|
463
|
+
options = _this$props10.options,
|
|
464
|
+
allowExclusions = _this$props10.allowExclusions,
|
|
465
|
+
showIcons = _this$props10.showIcons,
|
|
466
|
+
paddingSize = _this$props10.paddingSize,
|
|
467
|
+
textWrap = _this$props10.textWrap,
|
|
468
|
+
onFocusBadge = _this$props10.onFocusBadge,
|
|
469
|
+
searchable = _this$props10.searchable;
|
|
434
470
|
if (prevProps.activeOptionIndex !== activeOptionIndex) {
|
|
435
471
|
var makeOptionId = this.props.makeOptionId;
|
|
436
472
|
if (this.listBoxRef && this.props.searchable !== true) {
|
|
@@ -462,41 +498,48 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
462
498
|
itemData: _objectSpread({}, optionArray)
|
|
463
499
|
}, this.calculateAriaSetAttrs(optionArray)));
|
|
464
500
|
}
|
|
501
|
+
|
|
502
|
+
// ensure that ListRow updates based on item props
|
|
503
|
+
if (isVirtualized) {
|
|
504
|
+
if (prevProps.allowExclusions !== allowExclusions || prevProps.showIcons !== showIcons || prevProps.paddingSize !== paddingSize || prevProps.textWrap !== textWrap || prevProps.onFocusBadge !== onFocusBadge || prevProps.searchable !== searchable) {
|
|
505
|
+
this.forceVirtualizedListRowRerender();
|
|
506
|
+
}
|
|
507
|
+
}
|
|
465
508
|
}
|
|
466
509
|
}, {
|
|
467
510
|
key: "render",
|
|
468
511
|
value: function render() {
|
|
469
512
|
var _this2 = this;
|
|
470
|
-
var _this$
|
|
471
|
-
className = _this$
|
|
472
|
-
options = _this$
|
|
473
|
-
searchValue = _this$
|
|
474
|
-
onOptionClick = _this$
|
|
475
|
-
renderOption = _this$
|
|
476
|
-
forcedHeight = _this$
|
|
477
|
-
windowProps = _this$
|
|
478
|
-
rowHeight = _this$
|
|
479
|
-
activeOptionIndex = _this$
|
|
480
|
-
makeOptionId = _this$
|
|
481
|
-
showIcons = _this$
|
|
482
|
-
singleSelection = _this$
|
|
483
|
-
visibleOptions = _this$
|
|
484
|
-
allowExclusions = _this$
|
|
485
|
-
bordered = _this$
|
|
486
|
-
paddingSize = _this$
|
|
487
|
-
searchable = _this$
|
|
488
|
-
onFocusBadge = _this$
|
|
489
|
-
listId = _this$
|
|
490
|
-
setActiveOptionIndex = _this$
|
|
491
|
-
ariaLabel = _this$
|
|
492
|
-
ariaLabelledby = _this$
|
|
493
|
-
ariaDescribedby = _this$
|
|
494
|
-
role = _this$
|
|
495
|
-
isPreFiltered = _this$
|
|
496
|
-
isVirtualized = _this$
|
|
497
|
-
textWrap = _this$
|
|
498
|
-
truncationProps = _this$
|
|
499
|
-
rest = _objectWithoutProperties(_this$
|
|
513
|
+
var _this$props11 = this.props,
|
|
514
|
+
className = _this$props11.className,
|
|
515
|
+
options = _this$props11.options,
|
|
516
|
+
searchValue = _this$props11.searchValue,
|
|
517
|
+
onOptionClick = _this$props11.onOptionClick,
|
|
518
|
+
renderOption = _this$props11.renderOption,
|
|
519
|
+
forcedHeight = _this$props11.height,
|
|
520
|
+
windowProps = _this$props11.windowProps,
|
|
521
|
+
rowHeight = _this$props11.rowHeight,
|
|
522
|
+
activeOptionIndex = _this$props11.activeOptionIndex,
|
|
523
|
+
makeOptionId = _this$props11.makeOptionId,
|
|
524
|
+
showIcons = _this$props11.showIcons,
|
|
525
|
+
singleSelection = _this$props11.singleSelection,
|
|
526
|
+
visibleOptions = _this$props11.visibleOptions,
|
|
527
|
+
allowExclusions = _this$props11.allowExclusions,
|
|
528
|
+
bordered = _this$props11.bordered,
|
|
529
|
+
paddingSize = _this$props11.paddingSize,
|
|
530
|
+
searchable = _this$props11.searchable,
|
|
531
|
+
onFocusBadge = _this$props11.onFocusBadge,
|
|
532
|
+
listId = _this$props11.listId,
|
|
533
|
+
setActiveOptionIndex = _this$props11.setActiveOptionIndex,
|
|
534
|
+
ariaLabel = _this$props11['aria-label'],
|
|
535
|
+
ariaLabelledby = _this$props11['aria-labelledby'],
|
|
536
|
+
ariaDescribedby = _this$props11['aria-describedby'],
|
|
537
|
+
role = _this$props11.role,
|
|
538
|
+
isPreFiltered = _this$props11.isPreFiltered,
|
|
539
|
+
isVirtualized = _this$props11.isVirtualized,
|
|
540
|
+
textWrap = _this$props11.textWrap,
|
|
541
|
+
truncationProps = _this$props11.truncationProps,
|
|
542
|
+
rest = _objectWithoutProperties(_this$props11, _excluded3);
|
|
500
543
|
var heightIsFull = forcedHeight === 'full';
|
|
501
544
|
var classes = classNames('euiSelectableList', {
|
|
502
545
|
'euiSelectableList-fullHeight': heightIsFull,
|
|
@@ -514,7 +557,7 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
514
557
|
ref: this.setListBoxRef
|
|
515
558
|
}, this.state.optionArray.map(function (_, index) {
|
|
516
559
|
return /*#__PURE__*/React.createElement(_this2.ListRow, {
|
|
517
|
-
key: index,
|
|
560
|
+
key: "".concat(index, "-").concat(_this2.listRowRerender),
|
|
518
561
|
data: _this2.state.optionArray,
|
|
519
562
|
index: index
|
|
520
563
|
}, null);
|
|
@@ -664,7 +707,7 @@ EuiSelectableList.propTypes = {
|
|
|
664
707
|
* 'on' to indicate inclusion, 'off' to indicate exclusion,
|
|
665
708
|
* or 'mixed' to indicate inclusion for some.
|
|
666
709
|
*/
|
|
667
|
-
checked: PropTypes.
|
|
710
|
+
checked: PropTypes.any,
|
|
668
711
|
disabled: PropTypes.bool,
|
|
669
712
|
/**
|
|
670
713
|
* Node to add between the selection icon and the label
|
|
@@ -694,7 +737,15 @@ EuiSelectableList.propTypes = {
|
|
|
694
737
|
* Note: when searching, custom truncation props are ignored. The highlighted search
|
|
695
738
|
* text will always take precedence.
|
|
696
739
|
*/
|
|
697
|
-
truncationProps: PropTypes.any
|
|
740
|
+
truncationProps: PropTypes.any,
|
|
741
|
+
/**
|
|
742
|
+
* Optional custom tooltip content for the button
|
|
743
|
+
*/
|
|
744
|
+
toolTipContent: PropTypes.node,
|
|
745
|
+
/**
|
|
746
|
+
* Optional props to pass to the underlying **[EuiToolTip](/#/display/tooltip)**
|
|
747
|
+
*/
|
|
748
|
+
toolTipProps: PropTypes.any
|
|
698
749
|
}).isRequired).isRequired,
|
|
699
750
|
/**
|
|
700
751
|
* Filtered options list (if applicable)
|
|
@@ -708,14 +759,16 @@ EuiSelectableList.propTypes = {
|
|
|
708
759
|
label: PropTypes.string,
|
|
709
760
|
searchableLabel: PropTypes.string,
|
|
710
761
|
key: PropTypes.string,
|
|
711
|
-
checked: PropTypes.
|
|
762
|
+
checked: PropTypes.any,
|
|
712
763
|
disabled: PropTypes.bool,
|
|
713
764
|
prepend: PropTypes.node,
|
|
714
765
|
append: PropTypes.node,
|
|
715
766
|
ref: PropTypes.func,
|
|
716
767
|
data: PropTypes.shape({}),
|
|
717
768
|
textWrap: PropTypes.oneOf(["truncate", "wrap"]),
|
|
718
|
-
truncationProps: PropTypes.any
|
|
769
|
+
truncationProps: PropTypes.any,
|
|
770
|
+
toolTipContent: PropTypes.node,
|
|
771
|
+
toolTipProps: PropTypes.any
|
|
719
772
|
}).isRequired),
|
|
720
773
|
/**
|
|
721
774
|
* Search value to highlight on the option render
|