@elastic/eui 93.4.0 → 93.5.1-rc.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_theme_dark.css +3 -0
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +3 -0
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/header/header_links/header_links.js +10 -2
- package/es/components/icon/icon.js +3 -3
- package/es/components/panel/panel.js +2 -3
- package/es/components/resizable_container/resizable_button.js +2 -3
- package/es/components/resizable_container/resizable_collapse_button.js +2 -3
- package/es/components/resizable_container/resizable_container.js +1 -2
- package/es/components/resizable_container/resizable_container.styles.js +11 -14
- package/es/components/resizable_container/resizable_panel.js +6 -8
- package/es/components/resizable_container/resizable_panel.styles.js +18 -29
- package/es/components/selectable/selectable_list/selectable_list.js +29 -6
- package/es/components/tool_tip/icon_tip.js +4 -3
- package/es/global_styling/mixins/_color.js +60 -32
- package/es/global_styling/mixins/_padding.js +60 -16
- package/es/services/theme/style_memoization.js +1 -3
- package/eui.d.ts +37 -54
- package/i18ntokens.json +38 -20
- package/lib/components/header/header_links/header_links.js +10 -2
- package/lib/components/icon/icon.js +3 -3
- package/lib/components/panel/panel.js +1 -2
- package/lib/components/resizable_container/resizable_button.js +1 -2
- package/lib/components/resizable_container/resizable_collapse_button.js +1 -2
- package/lib/components/resizable_container/resizable_container.js +1 -2
- package/lib/components/resizable_container/resizable_container.styles.js +11 -14
- package/lib/components/resizable_container/resizable_panel.js +3 -5
- package/lib/components/resizable_container/resizable_panel.styles.js +17 -28
- package/lib/components/selectable/selectable_list/selectable_list.js +29 -6
- package/lib/components/tool_tip/icon_tip.js +4 -3
- package/lib/global_styling/mixins/_color.js +65 -40
- package/lib/global_styling/mixins/_padding.js +66 -25
- package/lib/services/theme/style_memoization.js +1 -3
- package/optimize/es/components/header/header_links/header_links.js +3 -2
- package/optimize/es/components/icon/icon.js +3 -3
- package/optimize/es/components/panel/panel.js +2 -3
- package/optimize/es/components/resizable_container/resizable_button.js +2 -3
- package/optimize/es/components/resizable_container/resizable_collapse_button.js +2 -3
- package/optimize/es/components/resizable_container/resizable_container.js +1 -2
- package/optimize/es/components/resizable_container/resizable_container.styles.js +11 -14
- package/optimize/es/components/resizable_container/resizable_panel.js +6 -8
- package/optimize/es/components/resizable_container/resizable_panel.styles.js +18 -26
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +29 -6
- package/optimize/es/components/tool_tip/icon_tip.js +4 -3
- package/optimize/es/global_styling/mixins/_color.js +57 -32
- package/optimize/es/global_styling/mixins/_padding.js +52 -16
- package/optimize/es/services/theme/style_memoization.js +1 -3
- package/optimize/lib/components/header/header_links/header_links.js +3 -2
- package/optimize/lib/components/icon/icon.js +3 -3
- package/optimize/lib/components/panel/panel.js +1 -2
- package/optimize/lib/components/resizable_container/resizable_button.js +1 -2
- package/optimize/lib/components/resizable_container/resizable_collapse_button.js +1 -2
- package/optimize/lib/components/resizable_container/resizable_container.js +1 -2
- package/optimize/lib/components/resizable_container/resizable_container.styles.js +11 -14
- package/optimize/lib/components/resizable_container/resizable_panel.js +3 -5
- package/optimize/lib/components/resizable_container/resizable_panel.styles.js +17 -26
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +29 -6
- package/optimize/lib/components/tool_tip/icon_tip.js +4 -3
- package/optimize/lib/global_styling/mixins/_color.js +63 -40
- package/optimize/lib/global_styling/mixins/_padding.js +59 -25
- package/optimize/lib/services/theme/style_memoization.js +1 -3
- package/package.json +8 -11
- package/src/components/form/text_area/_text_area.scss +5 -0
- package/src/components/selectable/selectable_list/_selectable_list.scss +2 -0
- package/test-env/components/header/header_links/header_links.js +10 -2
- package/test-env/components/panel/panel.js +1 -2
- package/test-env/components/resizable_container/resizable_button.js +1 -2
- package/test-env/components/resizable_container/resizable_collapse_button.js +1 -2
- package/test-env/components/resizable_container/resizable_container.js +1 -2
- package/test-env/components/resizable_container/resizable_container.styles.js +11 -14
- package/test-env/components/resizable_container/resizable_panel.js +3 -5
- package/test-env/components/resizable_container/resizable_panel.styles.js +17 -26
- package/test-env/components/selectable/selectable_list/selectable_list.js +29 -6
- package/test-env/components/tool_tip/icon_tip.js +4 -3
- package/test-env/global_styling/mixins/_color.js +63 -40
- package/test-env/global_styling/mixins/_padding.js +59 -25
- package/test-env/services/theme/style_memoization.js +1 -3
|
@@ -78,6 +78,7 @@ export var EuiHeaderLinks = function EuiHeaderLinks(_ref) {
|
|
|
78
78
|
size: "m"
|
|
79
79
|
}));
|
|
80
80
|
});
|
|
81
|
+
var renderedChildren = typeof children === 'function' ? children(closeMenu) : children;
|
|
81
82
|
return ___EmotionJSX(EuiI18n, {
|
|
82
83
|
token: "euiHeaderLinks.appNavigation",
|
|
83
84
|
default: "App menu"
|
|
@@ -91,7 +92,7 @@ export var EuiHeaderLinks = function EuiHeaderLinks(_ref) {
|
|
|
91
92
|
}, ___EmotionJSX("div", {
|
|
92
93
|
className: "euiHeaderLinks__list",
|
|
93
94
|
css: [styles.euiHeaderLinks__list, styles.gutterSizes[gutterSize], ";label:EuiHeaderLinks;"]
|
|
94
|
-
},
|
|
95
|
+
}, renderedChildren)), ___EmotionJSX(EuiShowFor, {
|
|
95
96
|
sizes: popoverBreakpoints
|
|
96
97
|
}, ___EmotionJSX(EuiPopover, _extends({
|
|
97
98
|
button: button,
|
|
@@ -103,7 +104,7 @@ export var EuiHeaderLinks = function EuiHeaderLinks(_ref) {
|
|
|
103
104
|
}, popoverProps), ___EmotionJSX("div", {
|
|
104
105
|
className: "euiHeaderLinks__mobileList",
|
|
105
106
|
css: styles.euiHeaderLinks__mobileList
|
|
106
|
-
},
|
|
107
|
+
}, renderedChildren))));
|
|
107
108
|
});
|
|
108
109
|
};
|
|
109
110
|
EuiHeaderLinks.propTypes = {
|
|
@@ -111,6 +112,13 @@ EuiHeaderLinks.propTypes = {
|
|
|
111
112
|
"aria-label": PropTypes.string,
|
|
112
113
|
"data-test-subj": PropTypes.string,
|
|
113
114
|
css: PropTypes.any,
|
|
115
|
+
/**
|
|
116
|
+
* Takes any rendered node(s), typically of `EuiHeaderLink`s.
|
|
117
|
+
*
|
|
118
|
+
* Optionally takes a render function that will pass a callback allowing you
|
|
119
|
+
* to close the mobile popover from within your popover content.
|
|
120
|
+
*/
|
|
121
|
+
children: PropTypes.oneOfType([PropTypes.node.isRequired, PropTypes.func.isRequired]),
|
|
114
122
|
/**
|
|
115
123
|
* Spacing between direct children
|
|
116
124
|
*/
|
|
@@ -223,8 +223,8 @@ export var EuiIconClass = /*#__PURE__*/function (_PureComponent) {
|
|
|
223
223
|
} else {
|
|
224
224
|
var Svg = icon;
|
|
225
225
|
|
|
226
|
-
// If
|
|
227
|
-
var isAriaHidden =
|
|
226
|
+
// If there is no aria-label, aria-labelledby, or title it gets aria-hidden true
|
|
227
|
+
var isAriaHidden = !(this.props['aria-label'] || this.props['aria-labelledby'] || this.props.title);
|
|
228
228
|
|
|
229
229
|
// If no aria-label or aria-labelledby is provided but there's a title, a titleId is generated
|
|
230
230
|
// The svg aria-labelledby attribute gets this titleId
|
|
@@ -244,7 +244,7 @@ export var EuiIconClass = /*#__PURE__*/function (_PureComponent) {
|
|
|
244
244
|
"data-is-loaded": isLoaded || undefined,
|
|
245
245
|
"data-is-loading": isLoading || undefined
|
|
246
246
|
}, rest, {
|
|
247
|
-
"aria-hidden": isAriaHidden ||
|
|
247
|
+
"aria-hidden": isAriaHidden || rest['aria-hidden']
|
|
248
248
|
}));
|
|
249
249
|
}
|
|
250
250
|
}
|
|
@@ -17,7 +17,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import PropTypes from "prop-types";
|
|
19
19
|
import classNames from 'classnames';
|
|
20
|
-
import {
|
|
20
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
21
21
|
import { useEuiBackgroundColorCSS, useEuiPaddingCSS, BACKGROUND_COLORS, PADDING_SIZES } from '../../global_styling';
|
|
22
22
|
import { keysOf } from '../common';
|
|
23
23
|
import { euiPanelStyles } from './panel.styles';
|
|
@@ -53,11 +53,10 @@ export var EuiPanel = function EuiPanel(_ref) {
|
|
|
53
53
|
panelRef = _ref.panelRef,
|
|
54
54
|
element = _ref.element,
|
|
55
55
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
56
|
-
var euiTheme = useEuiTheme();
|
|
57
56
|
// Shadows are only allowed when there's a white background (plain)
|
|
58
57
|
var canHaveShadow = !hasBorder && color === 'plain';
|
|
59
58
|
var canHaveBorder = color === 'plain' || color === 'transparent';
|
|
60
|
-
var styles = euiPanelStyles
|
|
59
|
+
var styles = useEuiMemoizedStyles(euiPanelStyles);
|
|
61
60
|
var cssStyles = [styles.euiPanel, grow && styles.grow, styles.radius[borderRadius], useEuiPaddingCSS()[paddingSize], useEuiBackgroundColorCSS()[color], canHaveShadow && hasShadow === true && styles.hasShadow, canHaveBorder && hasBorder === true && styles.hasBorder, rest.onClick && styles.isClickable];
|
|
62
61
|
var classes = classNames('euiPanel', "euiPanel--".concat(color), _defineProperty({}, "euiPanel--".concat(paddingSizeToClassNameMap[paddingSize]), paddingSizeToClassNameMap[paddingSize]), className);
|
|
63
62
|
if (rest.onClick && element !== 'div') {
|
|
@@ -21,7 +21,7 @@ import React, { useCallback, useMemo, useRef, forwardRef } from 'react';
|
|
|
21
21
|
import PropTypes from "prop-types";
|
|
22
22
|
import classNames from 'classnames';
|
|
23
23
|
import { EuiI18n } from '../i18n';
|
|
24
|
-
import {
|
|
24
|
+
import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
|
|
25
25
|
import { useEuiResizableContainerContext } from './context';
|
|
26
26
|
import { euiResizableButtonStyles } from './resizable_button.styles';
|
|
27
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -39,8 +39,7 @@ export var EuiResizableButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
39
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
40
40
|
var classes = classNames('euiResizableButton', className);
|
|
41
41
|
var resizeDirection = isHorizontal ? 'horizontal' : 'vertical';
|
|
42
|
-
var
|
|
43
|
-
var styles = euiResizableButtonStyles(euiTheme);
|
|
42
|
+
var styles = useEuiMemoizedStyles(euiResizableButtonStyles);
|
|
44
43
|
var cssStyles = [styles.euiResizableButton, styles[indicator], styles["".concat(indicator, "Direction")][resizeDirection], styles[resizeDirection], indicator === 'handle' && styles.alignIndicator[alignIndicator]];
|
|
45
44
|
return ___EmotionJSX(EuiI18n, {
|
|
46
45
|
tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
|
|
@@ -19,7 +19,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
19
19
|
import React from 'react';
|
|
20
20
|
import PropTypes from "prop-types";
|
|
21
21
|
import classNames from 'classnames';
|
|
22
|
-
import {
|
|
22
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
23
23
|
import { EuiButtonIcon } from '../button';
|
|
24
24
|
import { euiScreenReaderOnlyStyles } from '../accessibility/screen_reader_only/screen_reader_only.styles';
|
|
25
25
|
import { euiResizableCollapseButtonStyles } from './resizable_collapse_button.styles';
|
|
@@ -38,8 +38,7 @@ export var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref
|
|
|
38
38
|
var isHorizontal = direction === 'horizontal';
|
|
39
39
|
var showOnFocus = !isCollapsed && !isVisible;
|
|
40
40
|
var screenReaderOnlyStyles = euiScreenReaderOnlyStyles(showOnFocus).euiScreenReaderOnly;
|
|
41
|
-
var
|
|
42
|
-
var styles = euiResizableCollapseButtonStyles(euiTheme);
|
|
41
|
+
var styles = useEuiMemoizedStyles(euiResizableCollapseButtonStyles);
|
|
43
42
|
var collapsedStyles = [styles.collapsed.collapsed, styles.collapsed[direction], styles.collapsed["".concat(direction, "Positions")][internalPosition]];
|
|
44
43
|
var collapsibleStyles = [styles.collapsible.collapsible, styles.collapsible[direction][externalPosition], styles.collapsible[direction][internalPosition]];
|
|
45
44
|
var cssStyles = [styles.euiResizableCollapseButton, showOnFocus && screenReaderOnlyStyles].concat(_toConsumableArray(isCollapsed ? collapsedStyles : collapsibleStyles));
|
|
@@ -31,7 +31,7 @@ import { EuiResizableContainerContextProvider } from './context';
|
|
|
31
31
|
import { euiResizableButtonWithControls } from './resizable_button';
|
|
32
32
|
import { euiResizablePanelWithControls, getModeType } from './resizable_panel';
|
|
33
33
|
import { useContainerCallbacks, getPosition } from './helpers';
|
|
34
|
-
import { euiResizableContainerStyles } from './resizable_container.styles';
|
|
34
|
+
import { euiResizableContainerStyles as styles } from './resizable_container.styles';
|
|
35
35
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
36
36
|
var initialState = {
|
|
37
37
|
isDragging: false,
|
|
@@ -59,7 +59,6 @@ export var EuiResizableContainer = function EuiResizableContainer(_ref) {
|
|
|
59
59
|
var containerRef = useRef(null);
|
|
60
60
|
var isHorizontal = direction === 'horizontal';
|
|
61
61
|
var classes = classNames('euiResizableContainer', className);
|
|
62
|
-
var styles = euiResizableContainerStyles();
|
|
63
62
|
var cssStyles = [styles.euiResizableContainer, styles[direction]];
|
|
64
63
|
var _useContainerCallback = useContainerCallbacks({
|
|
65
64
|
initialState: _objectSpread(_objectSpread({}, initialState), {}, {
|
|
@@ -9,18 +9,15 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
9
9
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { logicalCSS } from '../../global_styling';
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
horizontal: /*#__PURE__*/css(";label:horizontal;"),
|
|
24
|
-
vertical: _ref
|
|
25
|
-
};
|
|
12
|
+
export var euiResizableContainerStyles = {
|
|
13
|
+
euiResizableContainer: /*#__PURE__*/css("display:flex;", logicalCSS('width', '100%'), ";;label:euiResizableContainer;"),
|
|
14
|
+
horizontal: /*#__PURE__*/css(";label:horizontal;"),
|
|
15
|
+
vertical: process.env.NODE_ENV === "production" ? {
|
|
16
|
+
name: "omnk2l-vertical",
|
|
17
|
+
styles: "flex-direction:column;label:vertical;"
|
|
18
|
+
} : {
|
|
19
|
+
name: "omnk2l-vertical",
|
|
20
|
+
styles: "flex-direction:column;label:vertical;",
|
|
21
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
|
+
}
|
|
26
23
|
};
|
|
@@ -19,13 +19,13 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
19
19
|
|
|
20
20
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
21
21
|
import classNames from 'classnames';
|
|
22
|
-
import { useGeneratedHtmlId,
|
|
23
|
-
import { logicalSizeStyle,
|
|
22
|
+
import { useGeneratedHtmlId, useEuiMemoizedStyles } from '../../services';
|
|
23
|
+
import { logicalSizeStyle, useEuiPaddingSize, useEuiPaddingCSS } from '../../global_styling';
|
|
24
24
|
import { useEuiResizableContainerContext } from './context';
|
|
25
25
|
import { EuiPanel } from '../panel';
|
|
26
26
|
import { useEuiI18n } from '../i18n';
|
|
27
27
|
import { EuiResizableCollapseButton } from './resizable_collapse_button';
|
|
28
|
-
import { euiResizablePanelStyles, euiResizablePanelContentStyles } from './resizable_panel.styles';
|
|
28
|
+
import { euiResizablePanelStyles as styles, euiResizablePanelContentStyles } from './resizable_panel.styles';
|
|
29
29
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
30
30
|
var defaultToggleOptions = {
|
|
31
31
|
className: null,
|
|
@@ -137,15 +137,13 @@ export var EuiResizablePanel = function EuiResizablePanel(_ref) {
|
|
|
137
137
|
return direction;
|
|
138
138
|
}, [isCollapsed, isCollapsible, position, panels, panelId]);
|
|
139
139
|
var axis = isHorizontal ? 'horizontal' : 'vertical';
|
|
140
|
-
var
|
|
141
|
-
var
|
|
142
|
-
var cssStyles = [styles.euiResizablePanel, isCollapsed && styles.collapsed, styles.paddingSizes[wrapperPadding], wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.css];
|
|
143
|
-
var contentStyles = euiResizablePanelContentStyles(euiTheme);
|
|
140
|
+
var cssStyles = [styles.euiResizablePanel, isCollapsed && styles.collapsed, useEuiPaddingCSS()[wrapperPadding], wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.css];
|
|
141
|
+
var contentStyles = useEuiMemoizedStyles(euiResizablePanelContentStyles);
|
|
144
142
|
var contentCssStyles = [contentStyles.euiResizablePanel__content, scrollable && contentStyles.scrollable, isCollapsed && contentStyles.collapsedChildren, isCollapsed && !isCollapsible && contentStyles[axis].collapsed, isCollapsible && contentStyles[axis].hasCollapsibleButton];
|
|
145
143
|
var classes = classNames('euiResizablePanel', wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.className);
|
|
146
144
|
var panelClasses = classNames('euiResizablePanel__content', className);
|
|
147
145
|
var inlineStyles = _objectSpread(_objectSpread({}, wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.style), isHorizontal ? logicalSizeStyle("".concat(size || innerSize, "%"), 'auto') : logicalSizeStyle('100%', "".concat(size || innerSize, "%")));
|
|
148
|
-
var padding =
|
|
146
|
+
var padding = useEuiPaddingSize(paddingSize) || '0px';
|
|
149
147
|
useEffect(function () {
|
|
150
148
|
if (!registration) return;
|
|
151
149
|
var initSize = size !== null && size !== void 0 ? size : initialSize || 0;
|
|
@@ -1,9 +1,3 @@
|
|
|
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
|
-
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; }
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
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); }
|
|
7
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)."; }
|
|
8
2
|
/*
|
|
9
3
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -14,29 +8,24 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
14
8
|
*/
|
|
15
9
|
|
|
16
10
|
import { css } from '@emotion/react';
|
|
17
|
-
import { logicalCSS, logicalCSSWithFallback, euiScrollBarStyles
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
euiResizablePanel: _ref3,
|
|
37
|
-
collapsed: _ref2,
|
|
38
|
-
paddingSizes: _objectSpread({}, euiPaddingSizeCSS(euiThemeContext))
|
|
39
|
-
};
|
|
11
|
+
import { logicalCSS, logicalCSSWithFallback, euiScrollBarStyles } from '../../global_styling';
|
|
12
|
+
export var euiResizablePanelStyles = {
|
|
13
|
+
euiResizablePanel: process.env.NODE_ENV === "production" ? {
|
|
14
|
+
name: "15ifdgc-euiResizablePanel",
|
|
15
|
+
styles: "position:relative;label:euiResizablePanel;"
|
|
16
|
+
} : {
|
|
17
|
+
name: "15ifdgc-euiResizablePanel",
|
|
18
|
+
styles: "position:relative;label:euiResizablePanel;",
|
|
19
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
20
|
+
},
|
|
21
|
+
collapsed: process.env.NODE_ENV === "production" ? {
|
|
22
|
+
name: "11qmbh3-collapsed",
|
|
23
|
+
styles: "overflow:hidden;label:collapsed;"
|
|
24
|
+
} : {
|
|
25
|
+
name: "11qmbh3-collapsed",
|
|
26
|
+
styles: "overflow:hidden;label:collapsed;",
|
|
27
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
28
|
+
}
|
|
40
29
|
};
|
|
41
30
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
42
31
|
name: "597kt8-collapsedChildren",
|
|
@@ -422,14 +422,33 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
422
422
|
key: "componentDidUpdate",
|
|
423
423
|
value: function componentDidUpdate(prevProps) {
|
|
424
424
|
var _this$props9 = this.props,
|
|
425
|
+
isVirtualized = _this$props9.isVirtualized,
|
|
425
426
|
activeOptionIndex = _this$props9.activeOptionIndex,
|
|
426
427
|
visibleOptions = _this$props9.visibleOptions,
|
|
427
428
|
options = _this$props9.options;
|
|
428
|
-
if (
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
429
|
+
if (prevProps.activeOptionIndex !== activeOptionIndex) {
|
|
430
|
+
var makeOptionId = this.props.makeOptionId;
|
|
431
|
+
if (this.listBoxRef && this.props.searchable !== true) {
|
|
432
|
+
this.listBoxRef.setAttribute('aria-activedescendant', makeOptionId(activeOptionIndex));
|
|
433
|
+
}
|
|
434
|
+
if (typeof activeOptionIndex !== 'undefined') {
|
|
435
|
+
if (isVirtualized) {
|
|
436
|
+
var _this$listRef;
|
|
437
|
+
(_this$listRef = this.listRef) === null || _this$listRef === void 0 ? void 0 : _this$listRef.scrollToItem(activeOptionIndex, 'auto');
|
|
438
|
+
} else {
|
|
439
|
+
var _this$listBoxRef;
|
|
440
|
+
var activeOptionId = "#".concat(makeOptionId(activeOptionIndex));
|
|
441
|
+
var activeOptionEl = (_this$listBoxRef = this.listBoxRef) === null || _this$listBoxRef === void 0 ? void 0 : _this$listBoxRef.querySelector(activeOptionId);
|
|
442
|
+
if (activeOptionEl) {
|
|
443
|
+
var _activeOptionEl$scrol;
|
|
444
|
+
// TODO: we can remove scrollIntoView's conditional chaining once jsdom stubs it
|
|
445
|
+
// @see https://github.com/jsdom/jsdom/issues/1695
|
|
446
|
+
(_activeOptionEl$scrol = activeOptionEl.scrollIntoView) === null || _activeOptionEl$scrol === void 0 ? void 0 : _activeOptionEl$scrol.call(activeOptionEl, {
|
|
447
|
+
block: 'nearest'
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
433
452
|
}
|
|
434
453
|
if (prevProps.visibleOptions !== visibleOptions || prevProps.options !== options) {
|
|
435
454
|
var optionArray = visibleOptions || options;
|
|
@@ -472,14 +491,18 @@ export var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
472
491
|
textWrap = _this$props10.textWrap,
|
|
473
492
|
truncationProps = _this$props10.truncationProps,
|
|
474
493
|
rest = _objectWithoutProperties(_this$props10, _excluded3);
|
|
494
|
+
var heightIsFull = forcedHeight === 'full';
|
|
475
495
|
var classes = classNames('euiSelectableList', {
|
|
476
|
-
'euiSelectableList-fullHeight':
|
|
496
|
+
'euiSelectableList-fullHeight': heightIsFull,
|
|
477
497
|
'euiSelectableList-bordered': bordered
|
|
478
498
|
}, className);
|
|
479
499
|
return ___EmotionJSX("div", _extends({
|
|
480
500
|
className: classes
|
|
481
501
|
}, rest), isVirtualized ? this.renderVirtualizedList() : ___EmotionJSX("div", {
|
|
482
502
|
className: "euiSelectableList__list",
|
|
503
|
+
style: !heightIsFull ? {
|
|
504
|
+
blockSize: forcedHeight
|
|
505
|
+
} : undefined,
|
|
483
506
|
ref: this.removeScrollableTabStop
|
|
484
507
|
}, ___EmotionJSX("ul", {
|
|
485
508
|
ref: this.setListBoxRef
|
|
@@ -12,14 +12,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
12
12
|
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import PropTypes from "prop-types";
|
|
15
|
+
import { useEuiI18n } from '../i18n';
|
|
15
16
|
import { EuiIcon } from '../icon';
|
|
16
17
|
import { EuiToolTip } from './tool_tip';
|
|
17
18
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
18
19
|
export var EuiIconTip = function EuiIconTip(_ref) {
|
|
19
20
|
var _ref$type = _ref.type,
|
|
20
21
|
type = _ref$type === void 0 ? 'questionInCircle' : _ref$type,
|
|
21
|
-
|
|
22
|
-
ariaLabel = _ref$ariaLabel === void 0 ? 'Info' : _ref$ariaLabel,
|
|
22
|
+
ariaLabel = _ref['aria-label'],
|
|
23
23
|
color = _ref.color,
|
|
24
24
|
size = _ref.size,
|
|
25
25
|
iconProps = _ref.iconProps,
|
|
@@ -28,6 +28,7 @@ export var EuiIconTip = function EuiIconTip(_ref) {
|
|
|
28
28
|
_ref$delay = _ref.delay,
|
|
29
29
|
delay = _ref$delay === void 0 ? 'regular' : _ref$delay,
|
|
30
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
var defaultAriaLabel = useEuiI18n('euiIconTip.defaultAriaLabel', 'Info');
|
|
31
32
|
return ___EmotionJSX(EuiToolTip, _extends({
|
|
32
33
|
position: position,
|
|
33
34
|
delay: delay
|
|
@@ -36,7 +37,7 @@ export var EuiIconTip = function EuiIconTip(_ref) {
|
|
|
36
37
|
type: type,
|
|
37
38
|
color: color,
|
|
38
39
|
size: size,
|
|
39
|
-
"aria-label": ariaLabel
|
|
40
|
+
"aria-label": ariaLabel || defaultAriaLabel
|
|
40
41
|
}, iconProps)));
|
|
41
42
|
};
|
|
42
43
|
EuiIconTip.propTypes = {
|
|
@@ -1,3 +1,9 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
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); }
|
|
1
7
|
/*
|
|
2
8
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
9
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -6,10 +12,12 @@
|
|
|
6
12
|
* Side Public License, v 1.
|
|
7
13
|
*/
|
|
8
14
|
|
|
9
|
-
import { useMemo } from 'react';
|
|
10
15
|
import { css } from '@emotion/react';
|
|
11
|
-
import { shade, tint, tintOrShade, transparentize,
|
|
16
|
+
import { shade, tint, tintOrShade, transparentize, useEuiMemoizedStyles } from '../../services';
|
|
12
17
|
export var BACKGROUND_COLORS = ['transparent', 'plain', 'subdued', 'accent', 'primary', 'success', 'warning', 'danger'];
|
|
18
|
+
/**
|
|
19
|
+
* @returns A single background color with optional alpha transparency
|
|
20
|
+
*/
|
|
13
21
|
export var euiBackgroundColor = function euiBackgroundColor(_ref, color) {
|
|
14
22
|
var euiTheme = _ref.euiTheme,
|
|
15
23
|
colorMode = _ref.colorMode;
|
|
@@ -38,29 +46,51 @@ export var euiBackgroundColor = function euiBackgroundColor(_ref, color) {
|
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
48
|
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @returns An object map of color keys to color values, categorized by
|
|
52
|
+
* opaque (default) vs transparency (hover/focus states) methods.
|
|
53
|
+
* e.g. {
|
|
54
|
+
* opaque: { danger: '#000', success: '#fff', ... },
|
|
55
|
+
* transparent: { danger: 'rgba(0,0,0,0.1)', success: 'rgba(255,255,255,0.1)', ... },
|
|
56
|
+
* }
|
|
57
|
+
*/
|
|
58
|
+
var _euiBackgroundColorMap = function _euiBackgroundColorMap(euiThemeContext) {
|
|
59
|
+
return {
|
|
60
|
+
opaque: BACKGROUND_COLORS.reduce(function (acc, color) {
|
|
61
|
+
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, color, euiBackgroundColor(euiThemeContext, color)));
|
|
62
|
+
}, {}),
|
|
63
|
+
transparent: BACKGROUND_COLORS.reduce(function (acc, color) {
|
|
64
|
+
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, color, euiBackgroundColor(euiThemeContext, color, {
|
|
65
|
+
method: 'transparent'
|
|
66
|
+
})));
|
|
67
|
+
}, {})
|
|
68
|
+
};
|
|
69
|
+
};
|
|
41
70
|
export var useEuiBackgroundColor = function useEuiBackgroundColor(color) {
|
|
42
71
|
var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
43
72
|
method = _ref3.method;
|
|
44
|
-
var
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
73
|
+
var backgroundColorMap = useEuiMemoizedStyles(_euiBackgroundColorMap);
|
|
74
|
+
return backgroundColorMap[method || 'opaque'][color];
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @returns An object map of color keys to CSS,
|
|
79
|
+
* e.g. { danger: css``, success: css``, ... }
|
|
80
|
+
*/
|
|
81
|
+
var _euiBackgroundColors = function _euiBackgroundColors(euiThemeContext) {
|
|
82
|
+
return BACKGROUND_COLORS.reduce(function (acc, color) {
|
|
83
|
+
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, color, /*#__PURE__*/css("background-color:", euiBackgroundColor(euiThemeContext, color), ";label:", color, ";")));
|
|
84
|
+
}, {});
|
|
48
85
|
};
|
|
49
86
|
export var useEuiBackgroundColorCSS = function useEuiBackgroundColorCSS() {
|
|
50
|
-
|
|
51
|
-
return useMemo(function () {
|
|
52
|
-
return {
|
|
53
|
-
transparent: /*#__PURE__*/css("background-color:", euiBackgroundColor(euiThemeContext, 'transparent'), ";;label:transparent;"),
|
|
54
|
-
plain: /*#__PURE__*/css("background-color:", euiBackgroundColor(euiThemeContext, 'plain'), ";;label:plain;"),
|
|
55
|
-
subdued: /*#__PURE__*/css("background-color:", euiBackgroundColor(euiThemeContext, 'subdued'), ";;label:subdued;"),
|
|
56
|
-
accent: /*#__PURE__*/css("background-color:", euiBackgroundColor(euiThemeContext, 'accent'), ";;label:accent;"),
|
|
57
|
-
primary: /*#__PURE__*/css("background-color:", euiBackgroundColor(euiThemeContext, 'primary'), ";;label:primary;"),
|
|
58
|
-
success: /*#__PURE__*/css("background-color:", euiBackgroundColor(euiThemeContext, 'success'), ";;label:success;"),
|
|
59
|
-
warning: /*#__PURE__*/css("background-color:", euiBackgroundColor(euiThemeContext, 'warning'), ";;label:warning;"),
|
|
60
|
-
danger: /*#__PURE__*/css("background-color:", euiBackgroundColor(euiThemeContext, 'danger'), ";;label:danger;")
|
|
61
|
-
};
|
|
62
|
-
}, [euiThemeContext]);
|
|
87
|
+
return useEuiMemoizedStyles(_euiBackgroundColors);
|
|
63
88
|
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Border colors
|
|
92
|
+
*/
|
|
93
|
+
|
|
64
94
|
export var euiBorderColor = function euiBorderColor(_ref4, color) {
|
|
65
95
|
var euiTheme = _ref4.euiTheme,
|
|
66
96
|
colorMode = _ref4.colorMode;
|
|
@@ -75,18 +105,16 @@ export var euiBorderColor = function euiBorderColor(_ref4, color) {
|
|
|
75
105
|
return tintOrShade(euiTheme.colors[color], 0.6, colorMode);
|
|
76
106
|
}
|
|
77
107
|
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @returns An object map of color keys to CSS,
|
|
111
|
+
* e.g. { danger: css``, success: css``, ... }
|
|
112
|
+
*/
|
|
113
|
+
var _euiBorderColors = function _euiBorderColors(euiThemeContext) {
|
|
114
|
+
return BACKGROUND_COLORS.reduce(function (acc, color) {
|
|
115
|
+
return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, color, /*#__PURE__*/css("border-color:", euiBorderColor(euiThemeContext, color), ";label:", color, ";")));
|
|
116
|
+
}, {});
|
|
117
|
+
};
|
|
78
118
|
export var useEuiBorderColorCSS = function useEuiBorderColorCSS() {
|
|
79
|
-
|
|
80
|
-
return useMemo(function () {
|
|
81
|
-
return {
|
|
82
|
-
transparent: /*#__PURE__*/css("border-color:", euiBorderColor(euiThemeContext, 'transparent'), ";;label:transparent;"),
|
|
83
|
-
plain: /*#__PURE__*/css("border-color:", euiBorderColor(euiThemeContext, 'plain'), ";;label:plain;"),
|
|
84
|
-
subdued: /*#__PURE__*/css("border-color:", euiBorderColor(euiThemeContext, 'subdued'), ";;label:subdued;"),
|
|
85
|
-
accent: /*#__PURE__*/css("border-color:", euiBorderColor(euiThemeContext, 'accent'), ";;label:accent;"),
|
|
86
|
-
primary: /*#__PURE__*/css("border-color:", euiBorderColor(euiThemeContext, 'primary'), ";;label:primary;"),
|
|
87
|
-
success: /*#__PURE__*/css("border-color:", euiBorderColor(euiThemeContext, 'success'), ";;label:success;"),
|
|
88
|
-
warning: /*#__PURE__*/css("border-color:", euiBorderColor(euiThemeContext, 'warning'), ";;label:warning;"),
|
|
89
|
-
danger: /*#__PURE__*/css("border-color:", euiBorderColor(euiThemeContext, 'danger'), ";;label:danger;")
|
|
90
|
-
};
|
|
91
|
-
}, [euiThemeContext]);
|
|
119
|
+
return useEuiMemoizedStyles(_euiBorderColors);
|
|
92
120
|
};
|
|
@@ -1,3 +1,15 @@
|
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
+
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); }
|
|
1
13
|
/*
|
|
2
14
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
15
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -7,9 +19,12 @@
|
|
|
7
19
|
*/
|
|
8
20
|
|
|
9
21
|
import { css } from '@emotion/react';
|
|
10
|
-
import {
|
|
11
|
-
import { logicalSide } from '../functions';
|
|
22
|
+
import { useEuiMemoizedStyles } from '../../services/theme';
|
|
12
23
|
export var PADDING_SIZES = ['none', 'xs', 's', 'm', 'l', 'xl'];
|
|
24
|
+
/**
|
|
25
|
+
* Get a single padding size
|
|
26
|
+
*/
|
|
27
|
+
|
|
13
28
|
export var euiPaddingSize = function euiPaddingSize(_ref, size) {
|
|
14
29
|
var euiTheme = _ref.euiTheme;
|
|
15
30
|
switch (size) {
|
|
@@ -21,22 +36,51 @@ export var euiPaddingSize = function euiPaddingSize(_ref, size) {
|
|
|
21
36
|
return euiTheme.size[size];
|
|
22
37
|
}
|
|
23
38
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @returns An object map of padding size keys to padding values,
|
|
42
|
+
* e.g. { s: '8px', m: '16px', ... }
|
|
43
|
+
*/
|
|
44
|
+
var _getEuiPaddingSize = function _getEuiPaddingSize(euiThemeContext) {
|
|
45
|
+
return PADDING_SIZES.reduce(function (stylesAcc, size) {
|
|
46
|
+
return _objectSpread(_objectSpread({}, stylesAcc), {}, _defineProperty({}, size, size === 'none' ? null : euiPaddingSize(euiThemeContext, size)));
|
|
47
|
+
}, {});
|
|
34
48
|
};
|
|
35
49
|
export var useEuiPaddingSize = function useEuiPaddingSize(size) {
|
|
36
|
-
var
|
|
37
|
-
return
|
|
50
|
+
var sizes = useEuiMemoizedStyles(_getEuiPaddingSize);
|
|
51
|
+
return sizes[size];
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @returns An object map of all padding sizes for all padding sides properties
|
|
56
|
+
* e.g., {
|
|
57
|
+
* padding: { s: css`padding-size: 8px`, ... }
|
|
58
|
+
* left: { s: css`padding-inline-start: 8px`, ... }
|
|
59
|
+
* }
|
|
60
|
+
*/
|
|
61
|
+
var _euiPaddingSidesAndSizes = function _euiPaddingSidesAndSizes(euiThemeContext) {
|
|
62
|
+
var sizesMap = _getEuiPaddingSize(euiThemeContext);
|
|
63
|
+
// The `_` prefix stops Emotion from applying the function name as a label
|
|
64
|
+
var _generateSizeStyles = function _generateSizeStyles(cssProperty) {
|
|
65
|
+
return Object.fromEntries(Object.entries(sizesMap).map(function (_ref2) {
|
|
66
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
67
|
+
sizeKey = _ref3[0],
|
|
68
|
+
sizeValue = _ref3[1];
|
|
69
|
+
return [sizeKey, sizeValue === null ? null : /*#__PURE__*/css(cssProperty, ":", sizeValue, ";label:", sizeKey, ";")];
|
|
70
|
+
}));
|
|
71
|
+
};
|
|
72
|
+
var sidesMap = {
|
|
73
|
+
padding: _generateSizeStyles('padding'),
|
|
74
|
+
vertical: _generateSizeStyles('padding-block'),
|
|
75
|
+
top: _generateSizeStyles('padding-block-start'),
|
|
76
|
+
bottom: _generateSizeStyles('padding-block-end'),
|
|
77
|
+
horizontal: _generateSizeStyles('padding-inline'),
|
|
78
|
+
left: _generateSizeStyles('padding-inline-start'),
|
|
79
|
+
right: _generateSizeStyles('padding-inline-end')
|
|
80
|
+
};
|
|
81
|
+
return sidesMap;
|
|
38
82
|
};
|
|
39
83
|
export var useEuiPaddingCSS = function useEuiPaddingCSS(side) {
|
|
40
|
-
var
|
|
41
|
-
return
|
|
84
|
+
var memoizedSideMap = useEuiMemoizedStyles(_euiPaddingSidesAndSizes);
|
|
85
|
+
return memoizedSideMap[side || 'padding'];
|
|
42
86
|
};
|
|
@@ -17,9 +17,7 @@ import React, { createContext, useContext, useState, useMemo, useCallback, forwa
|
|
|
17
17
|
import { useUpdateEffect } from '../hooks';
|
|
18
18
|
import { useEuiTheme } from './hooks';
|
|
19
19
|
|
|
20
|
-
//
|
|
21
|
-
// unmounted components to have their styles garbage-collected by the browser
|
|
22
|
-
// @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap
|
|
20
|
+
// Typically an object of serialized css`` styles, but can have any amount of nesting, so it's not worth it to try and strictly type this
|
|
23
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
24
22
|
export var EuiThemeMemoizedStylesContext = /*#__PURE__*/createContext(new WeakMap());
|
|
25
23
|
export var EuiThemeMemoizedStylesProvider = function EuiThemeMemoizedStylesProvider(_ref) {
|