@elastic/eui 87.2.0 → 88.1.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/dist/eui_charts_theme.js +9 -8
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +2 -159
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +2 -159
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +9 -2
- package/es/components/color_picker/color_palette_display/color_palette_display.js +3 -6
- package/es/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -5
- package/es/components/color_picker/color_palette_display/color_palette_display_gradient.js +2 -5
- package/es/components/color_picker/color_palette_picker/color_palette_picker.js +3 -3
- package/es/components/color_picker/color_stops/color_stops.js +11 -0
- package/es/components/control_bar/control_bar.js +11 -0
- package/es/components/datagrid/controls/keyboard_shortcuts.js +1 -1
- package/es/components/description_list/description_list.js +66 -13
- package/es/components/description_list/description_list.styles.js +19 -6
- package/es/components/description_list/description_list_context.js +1 -1
- package/es/components/description_list/description_list_description.js +3 -9
- package/es/components/description_list/description_list_description.styles.js +3 -9
- package/es/components/description_list/description_list_title.js +7 -4
- package/es/components/description_list/description_list_title.styles.js +3 -6
- package/es/components/description_list/description_list_types.js +4 -2
- package/es/components/key_pad_menu/key_pad_menu_item.js +37 -34
- package/es/components/key_pad_menu/key_pad_menu_item.styles.js +41 -0
- package/es/components/markdown_editor/markdown_format.styles.js +3 -6
- package/es/components/notification/notification_event.js +10 -0
- package/es/components/suggest/suggest.js +16 -0
- package/es/components/suggest/suggest_item.js +12 -0
- package/es/components/text/text.styles.js +3 -6
- package/es/global_styling/functions/typography.js +8 -8
- package/es/global_styling/variables/typography.js +1 -1
- package/es/services/color_picker/color_picker.js +4 -0
- package/es/themes/amsterdam/global_styling/variables/_typography.js +1 -0
- package/eui.d.ts +2226 -2104
- package/i18ntokens.json +96 -96
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +9 -2
- package/lib/components/color_picker/color_palette_display/color_palette_display.js +3 -6
- package/lib/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -5
- package/lib/components/color_picker/color_palette_display/color_palette_display_gradient.js +2 -5
- package/lib/components/color_picker/color_palette_picker/color_palette_picker.js +3 -3
- package/lib/components/color_picker/color_stops/color_stops.js +10 -1
- package/lib/components/control_bar/control_bar.js +10 -1
- package/lib/components/datagrid/controls/keyboard_shortcuts.js +1 -1
- package/lib/components/description_list/description_list.js +68 -13
- package/lib/components/description_list/description_list.styles.js +24 -13
- package/lib/components/description_list/description_list_context.js +1 -1
- package/lib/components/description_list/description_list_description.js +2 -8
- package/lib/components/description_list/description_list_description.styles.js +2 -8
- package/lib/components/description_list/description_list_title.js +7 -4
- package/lib/components/description_list/description_list_title.styles.js +2 -5
- package/lib/components/description_list/description_list_types.js +8 -4
- package/lib/components/key_pad_menu/key_pad_menu_item.js +40 -34
- package/lib/components/key_pad_menu/key_pad_menu_item.styles.js +49 -0
- package/lib/components/markdown_editor/markdown_format.styles.js +3 -6
- package/lib/components/notification/notification_event.js +9 -0
- package/lib/components/suggest/suggest.js +16 -0
- package/lib/components/suggest/suggest_item.js +11 -0
- package/lib/components/text/text.styles.js +3 -6
- package/lib/global_styling/functions/typography.js +8 -8
- package/lib/global_styling/variables/typography.js +3 -3
- package/lib/services/color_picker/color_picker.js +4 -0
- package/lib/themes/amsterdam/global_styling/variables/_typography.js +1 -0
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +4 -2
- package/optimize/es/components/color_picker/color_stops/color_stops.js +11 -0
- package/optimize/es/components/control_bar/control_bar.js +11 -0
- package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +1 -1
- package/optimize/es/components/description_list/description_list.js +41 -11
- package/optimize/es/components/description_list/description_list.styles.js +19 -6
- package/optimize/es/components/description_list/description_list_context.js +1 -1
- package/optimize/es/components/description_list/description_list_description.js +3 -9
- package/optimize/es/components/description_list/description_list_description.styles.js +3 -9
- package/optimize/es/components/description_list/description_list_title.js +7 -4
- package/optimize/es/components/description_list/description_list_title.styles.js +3 -6
- package/optimize/es/components/description_list/description_list_types.js +4 -2
- package/optimize/es/components/key_pad_menu/key_pad_menu_item.js +37 -34
- package/optimize/es/components/key_pad_menu/key_pad_menu_item.styles.js +41 -0
- package/optimize/es/components/markdown_editor/markdown_format.styles.js +3 -6
- package/optimize/es/components/notification/notification_event.js +10 -0
- package/optimize/es/components/suggest/suggest.js +16 -0
- package/optimize/es/components/suggest/suggest_item.js +12 -0
- package/optimize/es/components/text/text.styles.js +3 -6
- package/optimize/es/global_styling/functions/typography.js +8 -8
- package/optimize/es/global_styling/variables/typography.js +1 -1
- package/optimize/es/services/color_picker/color_picker.js +4 -0
- package/optimize/es/themes/amsterdam/global_styling/variables/_typography.js +1 -0
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +4 -2
- package/optimize/lib/components/color_picker/color_stops/color_stops.js +10 -1
- package/optimize/lib/components/control_bar/control_bar.js +10 -1
- package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +1 -1
- package/optimize/lib/components/description_list/description_list.js +44 -11
- package/optimize/lib/components/description_list/description_list.styles.js +24 -13
- package/optimize/lib/components/description_list/description_list_context.js +1 -1
- package/optimize/lib/components/description_list/description_list_description.js +2 -8
- package/optimize/lib/components/description_list/description_list_description.styles.js +2 -8
- package/optimize/lib/components/description_list/description_list_title.js +7 -4
- package/optimize/lib/components/description_list/description_list_title.styles.js +2 -5
- package/optimize/lib/components/description_list/description_list_types.js +8 -4
- package/optimize/lib/components/key_pad_menu/key_pad_menu_item.js +40 -34
- package/optimize/lib/components/key_pad_menu/key_pad_menu_item.styles.js +49 -0
- package/optimize/lib/components/markdown_editor/markdown_format.styles.js +3 -6
- package/optimize/lib/components/notification/notification_event.js +9 -0
- package/optimize/lib/components/suggest/suggest.js +16 -0
- package/optimize/lib/components/suggest/suggest_item.js +11 -0
- package/optimize/lib/components/text/text.styles.js +3 -6
- package/optimize/lib/global_styling/functions/typography.js +8 -8
- package/optimize/lib/global_styling/variables/typography.js +3 -3
- package/optimize/lib/services/color_picker/color_picker.js +4 -0
- package/optimize/lib/themes/amsterdam/global_styling/variables/_typography.js +1 -0
- package/package.json +6 -6
- package/src/components/datagrid/controls/_data_grid_keyboard_shortcuts.scss +1 -7
- package/src/components/index.scss +0 -1
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +9 -2
- package/test-env/components/color_picker/color_palette_display/color_palette_display.js +3 -6
- package/test-env/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -5
- package/test-env/components/color_picker/color_palette_display/color_palette_display_gradient.js +2 -5
- package/test-env/components/color_picker/color_palette_picker/color_palette_picker.js +3 -3
- package/test-env/components/color_picker/color_stops/color_stops.js +10 -1
- package/test-env/components/control_bar/control_bar.js +10 -1
- package/test-env/components/datagrid/controls/keyboard_shortcuts.js +1 -1
- package/test-env/components/description_list/description_list.js +66 -13
- package/test-env/components/description_list/description_list.styles.js +24 -13
- package/test-env/components/description_list/description_list_context.js +1 -1
- package/test-env/components/description_list/description_list_description.js +2 -8
- package/test-env/components/description_list/description_list_description.styles.js +2 -8
- package/test-env/components/description_list/description_list_title.js +7 -4
- package/test-env/components/description_list/description_list_title.styles.js +2 -5
- package/test-env/components/description_list/description_list_types.js +8 -4
- package/test-env/components/key_pad_menu/key_pad_menu_item.js +40 -34
- package/test-env/components/key_pad_menu/key_pad_menu_item.styles.js +49 -0
- package/test-env/components/markdown_editor/markdown_format.styles.js +3 -6
- package/test-env/components/notification/notification_event.js +9 -0
- package/test-env/components/suggest/suggest.js +16 -0
- package/test-env/components/suggest/suggest_item.js +11 -0
- package/test-env/components/text/text.styles.js +3 -6
- package/test-env/global_styling/functions/typography.js +8 -8
- package/test-env/global_styling/variables/typography.js +3 -3
- package/test-env/services/color_picker/color_picker.js +4 -0
- package/test-env/themes/amsterdam/global_styling/variables/_typography.js +1 -0
- package/src/components/key_pad_menu/_index.scss +0 -5
- package/src/components/key_pad_menu/_key_pad_menu_item.scss +0 -123
- package/src/components/key_pad_menu/_variables.scss +0 -2
- package/src/themes/amsterdam/overrides/_key_pad_menu.scss +0 -46
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["id", "children", "className", "style", "initialIsCollapsed", "width", "side", "focusTrapProps"];
|
|
2
|
+
var _excluded = ["id", "children", "className", "style", "initialIsCollapsed", "onCollapseToggle", "width", "side", "focusTrapProps"];
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
5
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -45,6 +45,7 @@ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
45
45
|
style = _ref.style,
|
|
46
46
|
_ref$initialIsCollaps = _ref.initialIsCollapsed,
|
|
47
47
|
initialIsCollapsed = _ref$initialIsCollaps === void 0 ? false : _ref$initialIsCollaps,
|
|
48
|
+
onCollapseToggle = _ref.onCollapseToggle,
|
|
48
49
|
_ref$width = _ref.width,
|
|
49
50
|
_width = _ref$width === void 0 ? 248 : _ref$width,
|
|
50
51
|
_ref$side = _ref.side,
|
|
@@ -63,9 +64,10 @@ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
63
64
|
setIsCollapsed = _useState2[1];
|
|
64
65
|
var toggleCollapsed = useCallback(function () {
|
|
65
66
|
return setIsCollapsed(function (isCollapsed) {
|
|
67
|
+
onCollapseToggle === null || onCollapseToggle === void 0 ? void 0 : onCollapseToggle(!isCollapsed);
|
|
66
68
|
return !isCollapsed;
|
|
67
69
|
});
|
|
68
|
-
}, []);
|
|
70
|
+
}, [onCollapseToggle]);
|
|
69
71
|
var onClose = useCallback(function () {
|
|
70
72
|
return setIsCollapsed(true);
|
|
71
73
|
}, []);
|
|
@@ -202,6 +204,11 @@ EuiCollapsibleNavBeta.propTypes = {
|
|
|
202
204
|
* Whether the navigation flyout should default to initially collapsed or expanded
|
|
203
205
|
*/
|
|
204
206
|
initialIsCollapsed: PropTypes.bool,
|
|
207
|
+
/**
|
|
208
|
+
* Optional callback that fires when the user toggles the nav between
|
|
209
|
+
* collapsed and uncollapsed states
|
|
210
|
+
*/
|
|
211
|
+
onCollapseToggle: PropTypes.func,
|
|
205
212
|
/**
|
|
206
213
|
* Defaults to 248px wide. The navigation width determines behavior at
|
|
207
214
|
* various responsive breakpoints.
|
|
@@ -58,13 +58,10 @@ EuiColorPaletteDisplay.propTypes = {
|
|
|
58
58
|
"data-test-subj": PropTypes.string,
|
|
59
59
|
css: PropTypes.any,
|
|
60
60
|
/**
|
|
61
|
-
* Array of color `strings` or an array of #
|
|
61
|
+
* Array of color `strings` or an array of #PaletteColorStop. The stops must be numbers in an ordered range.
|
|
62
62
|
*/
|
|
63
63
|
/**
|
|
64
|
-
* Array of color `strings` or an array of #
|
|
64
|
+
* Array of color `strings` or an array of #PaletteColorStop. The stops must be numbers in an ordered range.
|
|
65
65
|
*/
|
|
66
|
-
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, PropTypes.arrayOf(PropTypes.
|
|
67
|
-
stop: PropTypes.number.isRequired,
|
|
68
|
-
color: PropTypes.string.isRequired
|
|
69
|
-
}).isRequired).isRequired]).isRequired
|
|
66
|
+
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, PropTypes.arrayOf(PropTypes.any.isRequired).isRequired]).isRequired
|
|
70
67
|
};
|
|
@@ -41,10 +41,7 @@ EuiColorPaletteDisplayFixed.propTypes = {
|
|
|
41
41
|
"data-test-subj": PropTypes.string,
|
|
42
42
|
css: PropTypes.any,
|
|
43
43
|
/**
|
|
44
|
-
* Array of color `strings` or an array of #
|
|
44
|
+
* Array of color `strings` or an array of #PaletteColorStop. The stops must be numbers in an ordered range.
|
|
45
45
|
*/
|
|
46
|
-
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, PropTypes.arrayOf(PropTypes.
|
|
47
|
-
stop: PropTypes.number.isRequired,
|
|
48
|
-
color: PropTypes.string.isRequired
|
|
49
|
-
}).isRequired).isRequired]).isRequired
|
|
46
|
+
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, PropTypes.arrayOf(PropTypes.any.isRequired).isRequired]).isRequired
|
|
50
47
|
};
|
|
@@ -43,10 +43,7 @@ EuiColorPaletteDisplayGradient.propTypes = {
|
|
|
43
43
|
"data-test-subj": PropTypes.string,
|
|
44
44
|
css: PropTypes.any,
|
|
45
45
|
/**
|
|
46
|
-
* Array of color `strings` or an array of #
|
|
46
|
+
* Array of color `strings` or an array of #PaletteColorStop. The stops must be numbers in an ordered range.
|
|
47
47
|
*/
|
|
48
|
-
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, PropTypes.arrayOf(PropTypes.
|
|
49
|
-
stop: PropTypes.number.isRequired,
|
|
50
|
-
color: PropTypes.string.isRequired
|
|
51
|
-
}).isRequired).isRequired]).isRequired
|
|
48
|
+
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, PropTypes.arrayOf(PropTypes.any.isRequired).isRequired]).isRequired
|
|
52
49
|
};
|
|
@@ -173,7 +173,7 @@ EuiColorPalettePicker.propTypes = {
|
|
|
173
173
|
*/
|
|
174
174
|
type: PropTypes.oneOf(["text"]).isRequired,
|
|
175
175
|
/**
|
|
176
|
-
* Array of color `strings` or an array of #
|
|
176
|
+
* Array of color `strings` or an array of #PaletteColorStop. The stops must be numbers in an ordered range.
|
|
177
177
|
*/
|
|
178
178
|
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, PropTypes.arrayOf(PropTypes.shape({
|
|
179
179
|
stop: PropTypes.number.isRequired,
|
|
@@ -197,7 +197,7 @@ EuiColorPalettePicker.propTypes = {
|
|
|
197
197
|
*/
|
|
198
198
|
type: PropTypes.oneOf(["fixed"]).isRequired,
|
|
199
199
|
/**
|
|
200
|
-
* Array of color `strings` or an array of #
|
|
200
|
+
* Array of color `strings` or an array of #PaletteColorStop. The stops must be numbers in an ordered range.
|
|
201
201
|
*/
|
|
202
202
|
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, PropTypes.arrayOf(PropTypes.shape({
|
|
203
203
|
stop: PropTypes.number.isRequired,
|
|
@@ -221,7 +221,7 @@ EuiColorPalettePicker.propTypes = {
|
|
|
221
221
|
*/
|
|
222
222
|
type: PropTypes.oneOf(["gradient"]).isRequired,
|
|
223
223
|
/**
|
|
224
|
-
* Array of color `strings` or an array of #
|
|
224
|
+
* Array of color `strings` or an array of #PaletteColorStop. The stops must be numbers in an ordered range.
|
|
225
225
|
*/
|
|
226
226
|
palette: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, PropTypes.arrayOf(PropTypes.shape({
|
|
227
227
|
stop: PropTypes.number.isRequired,
|
|
@@ -39,6 +39,10 @@ import { EuiRangeHighlight } from '../../form/range/range_highlight';
|
|
|
39
39
|
import { EuiRangeTrack } from '../../form/range/range_track';
|
|
40
40
|
import { EuiRangeWrapper } from '../../form/range/range_wrapper';
|
|
41
41
|
import { euiColorStopsStyles, euiColorStopsAddContainerStyles } from './color_stops.styles';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated
|
|
45
|
+
*/
|
|
42
46
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
43
47
|
// Because of how the thumbs are rendered in the popover, using ref results in an infinite loop.
|
|
44
48
|
// We'll instead use old fashioned namespaced DOM selectors to get references
|
|
@@ -94,6 +98,13 @@ function getRangeMax(colorStops, max) {
|
|
|
94
98
|
}
|
|
95
99
|
return DEFAULT_MAX;
|
|
96
100
|
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @deprecated - EuiColorStops is scheduled for deprecation due to low internal usage and high
|
|
104
|
+
* maintenance requirements. If necessary, we recommend copying this component into your own application.
|
|
105
|
+
*
|
|
106
|
+
* The component will be permanently removed in October 2023.
|
|
107
|
+
*/
|
|
97
108
|
export var EuiColorStops = function EuiColorStops(_ref) {
|
|
98
109
|
var _ref$addColor = _ref.addColor,
|
|
99
110
|
addColor = _ref$addColor === void 0 ? DEFAULT_VISUALIZATION_COLOR : _ref$addColor,
|
|
@@ -74,7 +74,18 @@ import { EuiPortal } from '../portal';
|
|
|
74
74
|
* Icon can extend EuiButtonIcon
|
|
75
75
|
* Also omits `iconType` and `id` as these are also specific to icon control
|
|
76
76
|
*/
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @deprecated
|
|
80
|
+
*/
|
|
77
81
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
82
|
+
/**
|
|
83
|
+
* @deprecated - EuiControlBar is scheduled for deprecation due to low internal usage and high
|
|
84
|
+
* overlap with other existing EUI components. We recommend using EuiBottomBar instead,
|
|
85
|
+
* or copying this component into your own application for usage if necessary.
|
|
86
|
+
*
|
|
87
|
+
* The component will be permanently removed in December 2023.
|
|
88
|
+
*/
|
|
78
89
|
export var EuiControlBar = /*#__PURE__*/function (_Component) {
|
|
79
90
|
_inherits(EuiControlBar, _Component);
|
|
80
91
|
var _super = _createSuper(EuiControlBar);
|
|
@@ -59,9 +59,9 @@ export var useDataGridKeyboardShortcuts = function useDataGridKeyboardShortcuts(
|
|
|
59
59
|
}, ___EmotionJSX(EuiDescriptionList, {
|
|
60
60
|
"aria-labelledby": titleId,
|
|
61
61
|
type: "column",
|
|
62
|
+
columnWidths: [1, 3],
|
|
62
63
|
align: "center",
|
|
63
64
|
compressed: true,
|
|
64
|
-
gutterSize: "s",
|
|
65
65
|
listItems: [{
|
|
66
66
|
title: ___EmotionJSX("kbd", null, ___EmotionJSX(EuiI18n, {
|
|
67
67
|
token: "euiKeyboardShortcuts.upArrowTitle",
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["align", "children", "className", "style", "compressed", "descriptionProps", "listItems", "textStyle", "titleProps", "type", "rowGutterSize", "columnGutterSize", "columnWidths"];
|
|
2
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
11
|
/*
|
|
@@ -10,20 +16,21 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
10
16
|
* Side Public License, v 1.
|
|
11
17
|
*/
|
|
12
18
|
|
|
13
|
-
import React from 'react';
|
|
19
|
+
import React, { useMemo } from 'react';
|
|
14
20
|
import PropTypes from "prop-types";
|
|
15
21
|
import classNames from 'classnames';
|
|
22
|
+
import { useEuiTheme, useIsWithinBreakpoints } from '../../services';
|
|
23
|
+
import { EuiDescriptionListContext } from './description_list_context';
|
|
16
24
|
import { EuiDescriptionListTitle } from './description_list_title';
|
|
17
25
|
import { EuiDescriptionListDescription } from './description_list_description';
|
|
18
|
-
import { useEuiTheme } from '../../services';
|
|
19
26
|
import { euiDescriptionListStyles } from './description_list.styles';
|
|
20
|
-
import { EuiDescriptionListContext } from './description_list_context';
|
|
21
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
22
28
|
export var EuiDescriptionList = function EuiDescriptionList(_ref) {
|
|
23
29
|
var _ref$align = _ref.align,
|
|
24
30
|
align = _ref$align === void 0 ? 'left' : _ref$align,
|
|
25
31
|
children = _ref.children,
|
|
26
32
|
className = _ref.className,
|
|
33
|
+
style = _ref.style,
|
|
27
34
|
_ref$compressed = _ref.compressed,
|
|
28
35
|
compressed = _ref$compressed === void 0 ? false : _ref$compressed,
|
|
29
36
|
descriptionProps = _ref.descriptionProps,
|
|
@@ -32,13 +39,38 @@ export var EuiDescriptionList = function EuiDescriptionList(_ref) {
|
|
|
32
39
|
textStyle = _ref$textStyle === void 0 ? 'normal' : _ref$textStyle,
|
|
33
40
|
titleProps = _ref.titleProps,
|
|
34
41
|
_ref$type = _ref.type,
|
|
35
|
-
|
|
36
|
-
_ref$
|
|
37
|
-
|
|
42
|
+
_type = _ref$type === void 0 ? 'row' : _ref$type,
|
|
43
|
+
_ref$rowGutterSize = _ref.rowGutterSize,
|
|
44
|
+
rowGutterSize = _ref$rowGutterSize === void 0 ? 's' : _ref$rowGutterSize,
|
|
45
|
+
_ref$columnGutterSize = _ref.columnGutterSize,
|
|
46
|
+
columnGutterSize = _ref$columnGutterSize === void 0 ? 's' : _ref$columnGutterSize,
|
|
47
|
+
columnWidths = _ref.columnWidths,
|
|
38
48
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
49
|
+
var showResponsiveColumns = useIsWithinBreakpoints(['xs', 's']);
|
|
50
|
+
var type = useMemo(function () {
|
|
51
|
+
if (_type === 'responsiveColumn') {
|
|
52
|
+
return showResponsiveColumns ? 'row' : 'column';
|
|
53
|
+
} else {
|
|
54
|
+
return _type;
|
|
55
|
+
}
|
|
56
|
+
}, [_type, showResponsiveColumns]);
|
|
39
57
|
var euiTheme = useEuiTheme();
|
|
40
58
|
var styles = euiDescriptionListStyles(euiTheme);
|
|
41
|
-
var cssStyles = [styles.euiDescriptionList, styles[type], styles[align]];
|
|
59
|
+
var cssStyles = [styles.euiDescriptionList, styles[type], styles[align], type === 'column' && styles.rowGap[rowGutterSize], type === 'column' && styles.columnGap[columnGutterSize]];
|
|
60
|
+
var inlineStyles = useMemo(function () {
|
|
61
|
+
if (type === 'column' && columnWidths) {
|
|
62
|
+
// Leave string values as is - e.g. if a consumer passes in a specific '200px' or 'minmax()'
|
|
63
|
+
var convertNumbersToFr = function convertNumbersToFr(value) {
|
|
64
|
+
return typeof value === 'number' ? "".concat(value, "fr") : value;
|
|
65
|
+
};
|
|
66
|
+
var titleWidth = convertNumbersToFr(columnWidths[0]);
|
|
67
|
+
var descriptionWidth = convertNumbersToFr(columnWidths[1]);
|
|
68
|
+
return _objectSpread({
|
|
69
|
+
gridTemplateColumns: "".concat(titleWidth, " ").concat(descriptionWidth)
|
|
70
|
+
}, style);
|
|
71
|
+
}
|
|
72
|
+
return style;
|
|
73
|
+
}, [style, type, columnWidths]);
|
|
42
74
|
var classes = classNames('euiDescriptionList', className);
|
|
43
75
|
var childrenOrListItems = null;
|
|
44
76
|
if (listItems) {
|
|
@@ -58,13 +90,14 @@ export var EuiDescriptionList = function EuiDescriptionList(_ref) {
|
|
|
58
90
|
compressed: compressed,
|
|
59
91
|
textStyle: textStyle,
|
|
60
92
|
align: align,
|
|
61
|
-
|
|
93
|
+
rowGutterSize: rowGutterSize
|
|
62
94
|
}
|
|
63
95
|
}, ___EmotionJSX("dl", _extends({
|
|
64
96
|
className: classes,
|
|
65
|
-
css: cssStyles
|
|
97
|
+
css: cssStyles,
|
|
98
|
+
style: inlineStyles
|
|
66
99
|
}, rest, {
|
|
67
|
-
"data-type":
|
|
100
|
+
"data-type": _type
|
|
68
101
|
}), childrenOrListItems));
|
|
69
102
|
};
|
|
70
103
|
EuiDescriptionList.propTypes = {
|
|
@@ -112,7 +145,27 @@ EuiDescriptionList.propTypes = {
|
|
|
112
145
|
css: PropTypes.any
|
|
113
146
|
}),
|
|
114
147
|
/**
|
|
115
|
-
*
|
|
148
|
+
* Allows customizing the vertical spacing between rows.
|
|
149
|
+
*/
|
|
150
|
+
rowGutterSize: PropTypes.any,
|
|
151
|
+
/**
|
|
152
|
+
* Allows customizing the horizontal spacing between columns.
|
|
153
|
+
*
|
|
154
|
+
* Only applies to `column` and `responsiveColumn` types.
|
|
155
|
+
*/
|
|
156
|
+
columnGutterSize: PropTypes.any,
|
|
157
|
+
/**
|
|
158
|
+
* Allows customizing specific column widths (e.g. `['100px', '200px']`). The first
|
|
159
|
+
* array value applies to the title column, and the second applies to the description column.
|
|
160
|
+
*
|
|
161
|
+
* Passing numbers instead of CSS width strings will use a ratio of widths.
|
|
162
|
+
* For example, [1, 3] will render a description column 3x the width of the title column.
|
|
163
|
+
* In other words, descriptions will have a width of `75%` and titles will have a width of `25%`.
|
|
164
|
+
*
|
|
165
|
+
* Only applies to `column` and `responsiveColumn` types.
|
|
166
|
+
*
|
|
167
|
+
* _Advanced usage note:_ column width strings also accept [CSS grid special units,
|
|
168
|
+
* sizing, keywords, and sizing functions](https://css-tricks.com/snippets/css/complete-guide-grid/#aa-special-units-functions).
|
|
116
169
|
*/
|
|
117
|
-
|
|
170
|
+
columnWidths: PropTypes.any
|
|
118
171
|
};
|
|
@@ -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
|
|
@@ -7,18 +8,30 @@
|
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import { css } from '@emotion/react';
|
|
10
|
-
import { logicalTextAlignCSS
|
|
11
|
+
import { logicalTextAlignCSS } from '../../global_styling';
|
|
12
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
13
|
+
name: "zr5fhc-column",
|
|
14
|
+
styles: "display:grid;grid-template-columns:minmax(auto, max-content) minmax(auto, max-content);align-items:baseline;label:column;"
|
|
15
|
+
} : {
|
|
16
|
+
name: "zr5fhc-column",
|
|
17
|
+
styles: "display:grid;grid-template-columns:minmax(auto, max-content) minmax(auto, max-content);align-items:baseline;label:column;",
|
|
18
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
19
|
+
};
|
|
11
20
|
export var euiDescriptionListStyles = function euiDescriptionListStyles(euiThemeContext) {
|
|
12
|
-
// Flex display for column and responsive column
|
|
13
|
-
var columnDisplay = "\n display: flex;\n align-items: baseline;\n flex-wrap: wrap; \n ";
|
|
14
21
|
return {
|
|
15
22
|
euiDescriptionList: /*#__PURE__*/css(";label:euiDescriptionList;"),
|
|
16
23
|
// Types
|
|
17
24
|
row: /*#__PURE__*/css(";label:row;"),
|
|
18
25
|
inline: /*#__PURE__*/css(";label:inline;"),
|
|
19
|
-
column:
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
column: _ref,
|
|
27
|
+
columnGap: {
|
|
28
|
+
s: /*#__PURE__*/css("column-gap:", euiThemeContext.euiTheme.size.s, ";;label:s;"),
|
|
29
|
+
m: /*#__PURE__*/css("column-gap:", euiThemeContext.euiTheme.size.xl, ";;label:m;")
|
|
30
|
+
},
|
|
31
|
+
rowGap: {
|
|
32
|
+
s: /*#__PURE__*/css("row-gap:", euiThemeContext.euiTheme.size.s, ";;label:s;"),
|
|
33
|
+
m: /*#__PURE__*/css("row-gap:", euiThemeContext.euiTheme.size.m, ";;label:m;")
|
|
34
|
+
},
|
|
22
35
|
// Alignment
|
|
23
36
|
center: /*#__PURE__*/css(logicalTextAlignCSS('center'), ";;label:center;"),
|
|
24
37
|
left: /*#__PURE__*/css(logicalTextAlignCSS('left'), ";;label:left;")
|
|
@@ -19,9 +19,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
19
19
|
import React, { useContext } from 'react';
|
|
20
20
|
import PropTypes from "prop-types";
|
|
21
21
|
import classNames from 'classnames';
|
|
22
|
-
import { useEuiTheme
|
|
23
|
-
import { euiDescriptionListDescriptionStyles } from './description_list_description.styles';
|
|
22
|
+
import { useEuiTheme } from '../../services';
|
|
24
23
|
import { EuiDescriptionListContext } from './description_list_context';
|
|
24
|
+
import { euiDescriptionListDescriptionStyles } from './description_list_description.styles';
|
|
25
25
|
|
|
26
26
|
// Export required for correct inference by HOCs
|
|
27
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -33,9 +33,7 @@ export var EuiDescriptionListDescription = function EuiDescriptionListDescriptio
|
|
|
33
33
|
type = _useContext.type,
|
|
34
34
|
textStyle = _useContext.textStyle,
|
|
35
35
|
compressed = _useContext.compressed,
|
|
36
|
-
align = _useContext.align
|
|
37
|
-
gutterSize = _useContext.gutterSize;
|
|
38
|
-
var showResponsiveColumns = useIsWithinMinBreakpoint('m');
|
|
36
|
+
align = _useContext.align;
|
|
39
37
|
var theme = useEuiTheme();
|
|
40
38
|
var styles = euiDescriptionListDescriptionStyles(theme);
|
|
41
39
|
var conditionalStyles = compressed && textStyle === 'reverse' ? [styles.fontStyles.compressed] : [styles.fontStyles[textStyle]];
|
|
@@ -43,14 +41,10 @@ export var EuiDescriptionListDescription = function EuiDescriptionListDescriptio
|
|
|
43
41
|
case 'inline':
|
|
44
42
|
conditionalStyles = compressed ? [styles.inlineStyles.compressed] : [styles.inlineStyles.normal];
|
|
45
43
|
break;
|
|
46
|
-
case 'responsiveColumn':
|
|
47
44
|
case 'column':
|
|
48
45
|
if (align === 'center') {
|
|
49
46
|
conditionalStyles.push(styles.left);
|
|
50
47
|
}
|
|
51
|
-
if (type === 'column' || showResponsiveColumns) {
|
|
52
|
-
conditionalStyles.push(styles[gutterSize]);
|
|
53
|
-
}
|
|
54
48
|
break;
|
|
55
49
|
}
|
|
56
50
|
var cssStyles = [styles.euiDescriptionList__description, styles[type]].concat(_toConsumableArray(conditionalStyles));
|
|
@@ -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 { euiFontSize,
|
|
11
|
+
import { euiFontSize, logicalTextAlignCSS } from '../../global_styling';
|
|
12
12
|
import { euiTitle } from '../title/title.styles';
|
|
13
13
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
14
14
|
name: "1yn9gig-inline",
|
|
@@ -19,14 +19,11 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
19
19
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
20
20
|
};
|
|
21
21
|
export var euiDescriptionListDescriptionStyles = function euiDescriptionListDescriptionStyles(euiThemeContext) {
|
|
22
|
-
var euiTheme = euiThemeContext.euiTheme;
|
|
23
|
-
var columnDisplay = "\n ".concat(logicalCSS('width', '50%'), "\n ").concat(logicalCSS('padding-left', euiTheme.size.s), "\n ");
|
|
24
22
|
return {
|
|
25
23
|
euiDescriptionList__description: /*#__PURE__*/css(";label:euiDescriptionList__description;"),
|
|
26
24
|
// Types
|
|
27
25
|
row: /*#__PURE__*/css(";label:row;"),
|
|
28
|
-
column: /*#__PURE__*/css(
|
|
29
|
-
responsiveColumn: /*#__PURE__*/css(euiMaxBreakpoint(euiThemeContext, 'm'), "{", logicalCSS('width', '100%'), " padding:0;}", euiMinBreakpoint(euiThemeContext, 'm'), "{", columnDisplay, ";};label:responsiveColumn;"),
|
|
26
|
+
column: /*#__PURE__*/css(";label:column;"),
|
|
30
27
|
inline: _ref,
|
|
31
28
|
// This nested block handles just the font styling based on compressed and reverse
|
|
32
29
|
fontStyles: {
|
|
@@ -40,9 +37,6 @@ export var euiDescriptionListDescriptionStyles = function euiDescriptionListDesc
|
|
|
40
37
|
normal: /*#__PURE__*/css(euiFontSize(euiThemeContext, 's'), ";;label:normal;")
|
|
41
38
|
},
|
|
42
39
|
// Column types should align description text to the left when EuiDecriptionList is centered
|
|
43
|
-
left: /*#__PURE__*/css(logicalTextAlignCSS('left'), ";;label:left;")
|
|
44
|
-
// Gutter
|
|
45
|
-
s: /*#__PURE__*/css("&:not(:first-of-type){", logicalCSS('margin-top', euiTheme.size.s), ";};label:s;"),
|
|
46
|
-
m: /*#__PURE__*/css("&:not(:first-of-type){", logicalCSS('margin-top', euiTheme.size.base), ";};label:m;")
|
|
40
|
+
left: /*#__PURE__*/css(logicalTextAlignCSS('left'), ";;label:left;")
|
|
47
41
|
};
|
|
48
42
|
};
|
|
@@ -20,8 +20,8 @@ import React, { useContext } from 'react';
|
|
|
20
20
|
import PropTypes from "prop-types";
|
|
21
21
|
import classNames from 'classnames';
|
|
22
22
|
import { useEuiTheme } from '../../services';
|
|
23
|
-
import { euiDescriptionListTitleStyles } from './description_list_title.styles';
|
|
24
23
|
import { EuiDescriptionListContext } from './description_list_context';
|
|
24
|
+
import { euiDescriptionListTitleStyles } from './description_list_title.styles';
|
|
25
25
|
|
|
26
26
|
// Export required for correct inference by HOCs
|
|
27
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -34,22 +34,25 @@ export var EuiDescriptionListTitle = function EuiDescriptionListTitle(_ref) {
|
|
|
34
34
|
textStyle = _useContext.textStyle,
|
|
35
35
|
compressed = _useContext.compressed,
|
|
36
36
|
align = _useContext.align,
|
|
37
|
-
|
|
37
|
+
rowGutterSize = _useContext.rowGutterSize;
|
|
38
38
|
var theme = useEuiTheme();
|
|
39
39
|
var styles = euiDescriptionListTitleStyles(theme);
|
|
40
40
|
var conditionalStyles = compressed && textStyle !== 'reverse' ? [styles.fontStyles.compressed] : [styles.fontStyles[textStyle]];
|
|
41
41
|
switch (type) {
|
|
42
42
|
case 'inline':
|
|
43
43
|
conditionalStyles = compressed ? [styles.inlineStyles.compressed] : [styles.inlineStyles.normal];
|
|
44
|
+
conditionalStyles.push(styles[rowGutterSize]);
|
|
45
|
+
break;
|
|
46
|
+
case 'row':
|
|
47
|
+
conditionalStyles.push(styles[rowGutterSize]);
|
|
44
48
|
break;
|
|
45
|
-
case 'responsiveColumn':
|
|
46
49
|
case 'column':
|
|
47
50
|
if (align === 'center') {
|
|
48
51
|
conditionalStyles.push(styles.right);
|
|
49
52
|
}
|
|
50
53
|
break;
|
|
51
54
|
}
|
|
52
|
-
var cssStyles = [styles.euiDescriptionList__title, styles[type]
|
|
55
|
+
var cssStyles = [styles.euiDescriptionList__title, styles[type]].concat(_toConsumableArray(conditionalStyles));
|
|
53
56
|
var classes = classNames('euiDescriptionList__title', className);
|
|
54
57
|
return ___EmotionJSX("dt", _extends({
|
|
55
58
|
className: classes,
|
|
@@ -7,20 +7,17 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { css } from '@emotion/react';
|
|
10
|
-
import { euiFontSize, euiTextBreakWord, logicalTextAlignCSS,
|
|
11
|
-
import { tint } from '../../services';
|
|
10
|
+
import { euiFontSize, euiTextBreakWord, logicalTextAlignCSS, logicalCSS } from '../../global_styling';
|
|
12
11
|
import { euiTitle } from '../title/title.styles';
|
|
13
12
|
export var euiDescriptionListTitleStyles = function euiDescriptionListTitleStyles(euiThemeContext) {
|
|
14
13
|
var euiTheme = euiThemeContext.euiTheme,
|
|
15
14
|
colorMode = euiThemeContext.colorMode;
|
|
16
|
-
var columnDisplay = "\n ".concat(logicalCSS('width', '50%'), "\n ").concat(logicalCSS('padding-right', euiTheme.size.s), "\n ");
|
|
17
15
|
return {
|
|
18
16
|
euiDescriptionList__title: /*#__PURE__*/css(euiTextBreakWord(), ";;label:euiDescriptionList__title;"),
|
|
19
17
|
// Types
|
|
20
18
|
row: /*#__PURE__*/css(";label:row;"),
|
|
21
|
-
column: /*#__PURE__*/css(
|
|
22
|
-
|
|
23
|
-
inline: /*#__PURE__*/css("display:inline;border-radius:", euiTheme.border.radius.small, ";font-weight:", euiTheme.font.weight.medium, ";background-color:", colorMode === 'DARK' ? tint(euiTheme.colors.lightestShade, 0.5) : euiTheme.colors.lightestShade, ";", logicalCSS('margin-vertical', '0'), " ", logicalCSS('margin-horizontal', euiTheme.size.xs), "&:first-of-type{", logicalCSS('margin-left', '0'), ";};label:inline;"),
|
|
19
|
+
column: /*#__PURE__*/css(";label:column;"),
|
|
20
|
+
inline: /*#__PURE__*/css("display:inline;border-radius:", euiTheme.border.radius.small, ";font-weight:", euiTheme.font.weight.medium, ";background-color:", colorMode === 'DARK' ? euiTheme.colors.lightShade : euiTheme.colors.lightestShade, ";", logicalCSS('margin-vertical', '0'), " ", logicalCSS('margin-horizontal', euiTheme.size.xs), " ", colorMode === 'DARK' && "color: ".concat(euiTheme.colors.title, ";"), "&:first-of-type{", logicalCSS('margin-left', '0'), ";};label:inline;"),
|
|
24
21
|
// This nested block handles just the font styling based on compressed and reverse
|
|
25
22
|
fontStyles: {
|
|
26
23
|
normal: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xs'), ";;label:normal;"),
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export var
|
|
9
|
+
export var CHILD_TYPES = ['row', 'inline', 'column'];
|
|
10
|
+
export var TYPES = [].concat(CHILD_TYPES, ['responsiveColumn']);
|
|
10
11
|
export var ALIGNMENTS = ['center', 'left'];
|
|
11
12
|
export var TEXT_STYLES = ['normal', 'reverse'];
|
|
12
|
-
export var
|
|
13
|
+
export var ROW_GUTTER_SIZES = ['s', 'm'];
|
|
14
|
+
export var COLUMN_GUTTER_SIZES = ['s', 'm'];
|
|
@@ -10,14 +10,15 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
10
10
|
* Side Public License, v 1.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import React from 'react';
|
|
13
|
+
import React, { useMemo } from 'react';
|
|
14
14
|
import PropTypes from "prop-types";
|
|
15
15
|
import classNames from 'classnames';
|
|
16
|
+
import { useEuiTheme, getSecureRelForTarget, useGeneratedHtmlId } from '../../services';
|
|
16
17
|
import { EuiBetaBadge } from '../badge/beta_badge';
|
|
17
|
-
import { getSecureRelForTarget, useGeneratedHtmlId } from '../../services';
|
|
18
18
|
import { EuiRadio, EuiCheckbox } from '../form';
|
|
19
19
|
import { validateHref } from '../../services/security/href_validator';
|
|
20
20
|
import { EuiToolTip } from '../tool_tip';
|
|
21
|
+
import { euiKeyPadMenuItemStyles, euiKeyPadMenuItemChildStyles } from './key_pad_menu_item.styles';
|
|
21
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
22
23
|
export var EuiKeyPadMenuItem = function EuiKeyPadMenuItem(_ref) {
|
|
23
24
|
var id = _ref.id,
|
|
@@ -42,48 +43,45 @@ export var EuiKeyPadMenuItem = function EuiKeyPadMenuItem(_ref) {
|
|
|
42
43
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
44
|
var isHrefValid = !href || validateHref(href);
|
|
44
45
|
var isDisabled = disabled || _isDisabled || !isHrefValid;
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
'euiKeyPadMenuItem-isSelected': isSelected
|
|
50
|
-
}, className);
|
|
46
|
+
var euiTheme = useEuiTheme();
|
|
47
|
+
var styles = euiKeyPadMenuItemStyles(euiTheme);
|
|
48
|
+
var cssStyles = [styles.euiKeyPadMenuItem, !isDisabled ? styles.enabled : styles.disabled.disabled, isSelected && (!isDisabled ? styles.selected : styles.disabled.selected)];
|
|
49
|
+
var classes = classNames('euiKeyPadMenuItem', className);
|
|
51
50
|
var Element = href && !isDisabled ? 'a' : 'button';
|
|
52
51
|
if (checkable) Element = 'label';
|
|
53
52
|
var itemId = useGeneratedHtmlId({
|
|
54
53
|
conditionalId: id
|
|
55
54
|
});
|
|
56
|
-
var
|
|
55
|
+
var childStyles = useMemo(function () {
|
|
56
|
+
return euiKeyPadMenuItemChildStyles(euiTheme);
|
|
57
|
+
}, [euiTheme]);
|
|
58
|
+
var checkableElement = useMemo(function () {
|
|
57
59
|
if (!checkable) return;
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
+
var cssStyles = [childStyles.euiKeyPadMenuItem__checkableInput, !isSelected && isDisabled && childStyles.hideCheckableInput, !isSelected && !isDisabled && childStyles.showCheckableInputOnInteraction];
|
|
61
|
+
var sharedProps = {
|
|
62
|
+
id: itemId,
|
|
63
|
+
className: 'euiKeyPadMenuItem__checkableInput',
|
|
64
|
+
css: cssStyles,
|
|
65
|
+
checked: isSelected,
|
|
66
|
+
disabled: isDisabled,
|
|
67
|
+
name: name
|
|
68
|
+
};
|
|
60
69
|
if (checkable === 'single') {
|
|
61
|
-
|
|
62
|
-
id: itemId,
|
|
63
|
-
className: inputClasses,
|
|
64
|
-
checked: isSelected,
|
|
65
|
-
disabled: isDisabled,
|
|
66
|
-
name: name,
|
|
70
|
+
return ___EmotionJSX(EuiRadio, _extends({}, sharedProps, {
|
|
67
71
|
value: value,
|
|
68
72
|
onChange: function onChange() {
|
|
69
73
|
return _onChange(itemId, value);
|
|
70
74
|
}
|
|
71
|
-
});
|
|
75
|
+
}));
|
|
72
76
|
} else {
|
|
73
|
-
|
|
74
|
-
id: itemId,
|
|
75
|
-
className: inputClasses,
|
|
76
|
-
checked: isSelected,
|
|
77
|
-
disabled: isDisabled,
|
|
78
|
-
name: name,
|
|
77
|
+
return ___EmotionJSX(EuiCheckbox, _extends({}, sharedProps, {
|
|
79
78
|
onChange: function onChange() {
|
|
80
79
|
return _onChange(itemId);
|
|
81
80
|
}
|
|
82
|
-
});
|
|
81
|
+
}));
|
|
83
82
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
var renderBetaBadge = function renderBetaBadge() {
|
|
83
|
+
}, [checkable, isDisabled, isSelected, _onChange, value, name, itemId, childStyles]);
|
|
84
|
+
var betaBadge = useMemo(function () {
|
|
87
85
|
if (!betaBadgeLabel) return;
|
|
88
86
|
return ___EmotionJSX(EuiBetaBadge
|
|
89
87
|
// Since we move the tooltip contents to a wrapping EuiToolTip,
|
|
@@ -93,10 +91,11 @@ export var EuiKeyPadMenuItem = function EuiKeyPadMenuItem(_ref) {
|
|
|
93
91
|
size: "s",
|
|
94
92
|
color: "subdued",
|
|
95
93
|
className: "euiKeyPadMenuItem__betaBadge",
|
|
94
|
+
css: childStyles.euiKeyPadMenuItem__betaBadge,
|
|
96
95
|
label: betaBadgeLabel.charAt(0),
|
|
97
96
|
iconType: betaBadgeIconType
|
|
98
97
|
});
|
|
99
|
-
};
|
|
98
|
+
}, [betaBadgeLabel, betaBadgeIconType, childStyles]);
|
|
100
99
|
var relObj = {};
|
|
101
100
|
if (href && !isDisabled) {
|
|
102
101
|
relObj.href = href;
|
|
@@ -115,16 +114,20 @@ export var EuiKeyPadMenuItem = function EuiKeyPadMenuItem(_ref) {
|
|
|
115
114
|
relObj['aria-pressed'] = isSelected;
|
|
116
115
|
}
|
|
117
116
|
var button = ___EmotionJSX(Element, _extends({
|
|
118
|
-
className: classes
|
|
117
|
+
className: classes,
|
|
118
|
+
css: cssStyles
|
|
119
119
|
}, relObj, rest, {
|
|
120
120
|
// Unable to get past `LegacyRef` conflicts
|
|
121
121
|
ref: buttonRef
|
|
122
122
|
}), ___EmotionJSX("span", {
|
|
123
|
-
className: "euiKeyPadMenuItem__inner"
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
className: "euiKeyPadMenuItem__inner",
|
|
124
|
+
css: childStyles.euiKeyPadMenuItem__inner
|
|
125
|
+
}, checkable ? checkableElement : betaBadge, ___EmotionJSX("span", {
|
|
126
|
+
className: "euiKeyPadMenuItem__icon",
|
|
127
|
+
css: childStyles.euiKeyPadMenuItem__icon
|
|
126
128
|
}, children), ___EmotionJSX("span", {
|
|
127
|
-
className: "euiKeyPadMenuItem__label"
|
|
129
|
+
className: "euiKeyPadMenuItem__label",
|
|
130
|
+
css: childStyles.euiKeyPadMenuItem__label
|
|
128
131
|
}, label)));
|
|
129
132
|
return betaBadgeLabel ? ___EmotionJSX(EuiToolTip, _extends({}, betaBadgeTooltipProps, {
|
|
130
133
|
title: betaBadgeLabel,
|