@elastic/eui 93.2.0 → 93.3.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/breadcrumbs/breadcrumb.js +9 -6
- package/es/components/breadcrumbs/breadcrumbs.js +4 -2
- package/es/components/button/button_display/_button_display.js +2 -3
- package/es/components/button/button_empty/button_empty.js +2 -3
- package/es/components/button/button_group/button_group.js +3 -5
- package/es/components/button/button_group/button_group.styles.js +10 -13
- package/es/components/button/button_icon/button_icon.js +4 -5
- package/es/components/button/button_icon/button_icon.styles.js +11 -3
- package/es/components/datagrid/body/cell/data_grid_cell.js +7 -3
- package/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/es/components/datagrid/body/data_grid_body.js +1 -0
- package/es/components/datagrid/body/data_grid_body_custom.js +3 -0
- package/es/components/datagrid/body/data_grid_body_virtualized.js +3 -0
- package/es/components/datagrid/body/data_grid_row_manager.js +1 -1
- package/es/components/datagrid/data_grid.js +3 -1
- package/es/components/facet/facet_button.styles.js +1 -2
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +4 -2
- package/es/components/icon/icon.js +13 -16
- package/es/components/icon/icon.styles.js +6 -9
- package/es/components/link/external_link_icon.js +11 -8
- package/es/components/link/link.js +2 -3
- package/es/components/link/link.styles.js +4 -10
- package/es/components/page/page_header/page_header_content.js +4 -2
- package/es/components/progress/progress.styles.js +2 -2
- package/es/components/skeleton/skeleton_circle.js +2 -3
- package/es/components/skeleton/skeleton_rectangle.js +2 -3
- package/es/components/skeleton/skeleton_text.js +16 -12
- package/es/components/skeleton/skeleton_title.js +2 -3
- package/es/components/text/text.js +2 -3
- package/es/components/text/text_align.js +1 -2
- package/es/components/text/text_align.styles.js +5 -7
- package/es/components/text/text_color.js +2 -3
- package/es/components/title/title.js +2 -3
- package/es/components/title/title.styles.js +0 -7
- package/es/global_styling/mixins/_typography.js +17 -6
- package/es/services/theme/index.js +1 -1
- package/es/services/theme/style_memoization.js +47 -14
- package/es/themes/amsterdam/global_styling/mixins/button.js +47 -24
- package/eui.d.ts +46 -37
- package/i18ntokens.json +36 -36
- package/lib/components/breadcrumbs/breadcrumb.js +9 -6
- package/lib/components/breadcrumbs/breadcrumbs.js +4 -2
- package/lib/components/button/button_display/_button_display.js +1 -2
- package/lib/components/button/button_empty/button_empty.js +1 -2
- package/lib/components/button/button_group/button_group.js +2 -4
- package/lib/components/button/button_group/button_group.styles.js +10 -13
- package/lib/components/button/button_icon/button_icon.js +3 -4
- package/lib/components/button/button_icon/button_icon.styles.js +10 -2
- package/lib/components/datagrid/body/cell/data_grid_cell.js +7 -3
- package/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/lib/components/datagrid/body/data_grid_body.js +1 -0
- package/lib/components/datagrid/body/data_grid_body_custom.js +3 -0
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +3 -0
- package/lib/components/datagrid/body/data_grid_row_manager.js +1 -1
- package/lib/components/datagrid/data_grid.js +3 -1
- package/lib/components/facet/facet_button.styles.js +1 -2
- package/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +4 -2
- package/lib/components/icon/icon.js +12 -15
- package/lib/components/icon/icon.styles.js +5 -8
- package/lib/components/link/external_link_icon.js +10 -7
- package/lib/components/link/link.js +1 -2
- package/lib/components/link/link.styles.js +6 -14
- package/lib/components/page/page_header/page_header_content.js +4 -2
- package/lib/components/progress/progress.styles.js +1 -1
- package/lib/components/skeleton/skeleton_circle.js +1 -2
- package/lib/components/skeleton/skeleton_rectangle.js +1 -2
- package/lib/components/skeleton/skeleton_text.js +18 -11
- package/lib/components/skeleton/skeleton_title.js +1 -2
- package/lib/components/text/text.js +1 -2
- package/lib/components/text/text_align.js +1 -2
- package/lib/components/text/text_align.styles.js +5 -7
- package/lib/components/text/text_color.js +1 -2
- package/lib/components/title/title.js +1 -2
- package/lib/components/title/title.styles.js +2 -10
- package/lib/global_styling/mixins/_typography.js +27 -19
- package/lib/services/theme/index.js +6 -0
- package/lib/services/theme/style_memoization.js +49 -16
- package/lib/themes/amsterdam/global_styling/mixins/button.js +49 -25
- package/optimize/es/components/breadcrumbs/breadcrumb.js +5 -4
- package/optimize/es/components/button/button_display/_button_display.js +2 -3
- package/optimize/es/components/button/button_empty/button_empty.js +2 -3
- package/optimize/es/components/button/button_group/button_group.js +3 -5
- package/optimize/es/components/button/button_group/button_group.styles.js +10 -13
- package/optimize/es/components/button/button_icon/button_icon.js +4 -5
- package/optimize/es/components/button/button_icon/button_icon.styles.js +8 -3
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +5 -3
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +2 -0
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +2 -0
- package/optimize/es/components/datagrid/body/data_grid_row_manager.js +1 -1
- package/optimize/es/components/datagrid/data_grid.js +3 -1
- package/optimize/es/components/facet/facet_button.styles.js +1 -2
- package/optimize/es/components/icon/icon.js +13 -16
- package/optimize/es/components/icon/icon.styles.js +6 -9
- package/optimize/es/components/link/external_link_icon.js +11 -8
- package/optimize/es/components/link/link.js +2 -3
- package/optimize/es/components/link/link.styles.js +4 -10
- package/optimize/es/components/progress/progress.styles.js +2 -2
- package/optimize/es/components/skeleton/skeleton_circle.js +2 -3
- package/optimize/es/components/skeleton/skeleton_rectangle.js +2 -3
- package/optimize/es/components/skeleton/skeleton_text.js +16 -12
- package/optimize/es/components/skeleton/skeleton_title.js +2 -3
- package/optimize/es/components/text/text.js +2 -3
- package/optimize/es/components/text/text_align.js +1 -2
- package/optimize/es/components/text/text_align.styles.js +5 -7
- package/optimize/es/components/text/text_color.js +2 -3
- package/optimize/es/components/title/title.js +2 -3
- package/optimize/es/components/title/title.styles.js +0 -7
- package/optimize/es/global_styling/mixins/_typography.js +14 -6
- package/optimize/es/services/theme/index.js +1 -1
- package/optimize/es/services/theme/style_memoization.js +47 -14
- package/optimize/es/themes/amsterdam/global_styling/mixins/button.js +47 -24
- package/optimize/lib/components/breadcrumbs/breadcrumb.js +5 -4
- package/optimize/lib/components/button/button_display/_button_display.js +1 -2
- package/optimize/lib/components/button/button_empty/button_empty.js +1 -2
- package/optimize/lib/components/button/button_group/button_group.js +2 -4
- package/optimize/lib/components/button/button_group/button_group.styles.js +10 -13
- package/optimize/lib/components/button/button_icon/button_icon.js +3 -4
- package/optimize/lib/components/button/button_icon/button_icon.styles.js +8 -2
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +5 -3
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +2 -0
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +2 -0
- package/optimize/lib/components/datagrid/body/data_grid_row_manager.js +1 -1
- package/optimize/lib/components/datagrid/data_grid.js +3 -1
- package/optimize/lib/components/facet/facet_button.styles.js +1 -2
- package/optimize/lib/components/icon/icon.js +12 -15
- package/optimize/lib/components/icon/icon.styles.js +5 -8
- package/optimize/lib/components/link/external_link_icon.js +10 -7
- package/optimize/lib/components/link/link.js +1 -2
- package/optimize/lib/components/link/link.styles.js +6 -14
- package/optimize/lib/components/progress/progress.styles.js +1 -1
- package/optimize/lib/components/skeleton/skeleton_circle.js +1 -2
- package/optimize/lib/components/skeleton/skeleton_rectangle.js +1 -2
- package/optimize/lib/components/skeleton/skeleton_text.js +18 -11
- package/optimize/lib/components/skeleton/skeleton_title.js +1 -2
- package/optimize/lib/components/text/text.js +1 -2
- package/optimize/lib/components/text/text_align.js +1 -2
- package/optimize/lib/components/text/text_align.styles.js +5 -7
- package/optimize/lib/components/text/text_color.js +1 -2
- package/optimize/lib/components/title/title.js +1 -2
- package/optimize/lib/components/title/title.styles.js +2 -10
- package/optimize/lib/global_styling/mixins/_typography.js +25 -19
- package/optimize/lib/services/theme/index.js +6 -0
- package/optimize/lib/services/theme/style_memoization.js +49 -16
- package/optimize/lib/themes/amsterdam/global_styling/mixins/button.js +49 -26
- package/package.json +3 -3
- package/src/components/datagrid/_data_grid_data_row.scss +4 -0
- package/test-env/components/breadcrumbs/breadcrumb.js +9 -6
- package/test-env/components/breadcrumbs/breadcrumbs.js +4 -2
- package/test-env/components/button/button_display/_button_display.js +1 -2
- package/test-env/components/button/button_empty/button_empty.js +1 -2
- package/test-env/components/button/button_group/button_group.js +2 -4
- package/test-env/components/button/button_group/button_group.styles.js +10 -13
- package/test-env/components/button/button_icon/button_icon.js +3 -4
- package/test-env/components/button/button_icon/button_icon.styles.js +8 -2
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +7 -3
- package/test-env/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
- package/test-env/components/datagrid/body/data_grid_body.js +1 -0
- package/test-env/components/datagrid/body/data_grid_body_custom.js +3 -0
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +3 -0
- package/test-env/components/datagrid/body/data_grid_row_manager.js +1 -1
- package/test-env/components/datagrid/data_grid.js +3 -1
- package/test-env/components/facet/facet_button.styles.js +1 -2
- package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.js +4 -2
- package/test-env/components/icon/icon.styles.js +5 -8
- package/test-env/components/link/external_link_icon.js +10 -7
- package/test-env/components/link/link.js +1 -2
- package/test-env/components/link/link.styles.js +6 -14
- package/test-env/components/page/page_header/page_header_content.js +4 -2
- package/test-env/components/progress/progress.styles.js +1 -1
- package/test-env/components/skeleton/skeleton_circle.js +1 -2
- package/test-env/components/skeleton/skeleton_rectangle.js +1 -2
- package/test-env/components/skeleton/skeleton_text.js +18 -11
- package/test-env/components/skeleton/skeleton_title.js +1 -2
- package/test-env/components/text/text.js +1 -2
- package/test-env/components/text/text_align.js +1 -2
- package/test-env/components/text/text_align.styles.js +5 -7
- package/test-env/components/text/text_color.js +1 -2
- package/test-env/components/title/title.js +1 -2
- package/test-env/components/title/title.styles.js +2 -10
- package/test-env/global_styling/mixins/_typography.js +25 -19
- package/test-env/services/theme/index.js +6 -0
- package/test-env/services/theme/style_memoization.js +49 -16
- package/test-env/themes/amsterdam/global_styling/mixins/button.js +49 -26
|
@@ -78,7 +78,7 @@ export var useRowManager = function useRowManager(_ref) {
|
|
|
78
78
|
if (rowClasses) {
|
|
79
79
|
rowIdToElements.current.forEach(function (rowElement, rowIndex) {
|
|
80
80
|
var euiClasses = Array.from(rowElement.classList).filter(function (className) {
|
|
81
|
-
return
|
|
81
|
+
return ['euiDataGridRow', 'euiDataGridRow--striped'].includes(className);
|
|
82
82
|
}).join(' ');
|
|
83
83
|
if (rowClasses[rowIndex]) {
|
|
84
84
|
rowElement.classList.value = "".concat(euiClasses, " ").concat(rowClasses[rowIndex]);
|
|
@@ -3,7 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody", "renderCustomToolbar"],
|
|
6
|
+
var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "columnVisibility", "schemaDetectors", "rowCount", "renderCellValue", "cellContext", "renderCellPopover", "renderFooterCellValue", "className", "gridStyle", "toolbarVisibility", "pagination", "sorting", "inMemory", "onColumnResize", "minSizeForControls", "height", "width", "rowHeightsOptions", "virtualizationOptions", "renderCustomGridBody", "renderCustomToolbar"],
|
|
7
7
|
_excluded2 = ["focusProps"];
|
|
8
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
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; }
|
|
@@ -76,6 +76,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
76
76
|
schemaDetectors = props.schemaDetectors,
|
|
77
77
|
rowCount = props.rowCount,
|
|
78
78
|
renderCellValue = props.renderCellValue,
|
|
79
|
+
cellContext = props.cellContext,
|
|
79
80
|
renderCellPopover = props.renderCellPopover,
|
|
80
81
|
renderFooterCellValue = props.renderFooterCellValue,
|
|
81
82
|
className = props.className,
|
|
@@ -345,6 +346,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
|
|
|
345
346
|
schemaDetectors: allSchemaDetectors,
|
|
346
347
|
pagination: pagination,
|
|
347
348
|
renderCellValue: renderCellValue,
|
|
349
|
+
cellContext: cellContext,
|
|
348
350
|
renderCellPopover: renderCellPopover,
|
|
349
351
|
renderFooterCellValue: renderFooterCellValue,
|
|
350
352
|
rowCount: rowCount,
|
|
@@ -9,12 +9,11 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
9
9
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { euiTextTruncate, euiTextShift, logicalTextAlignCSS } from '../../global_styling';
|
|
12
|
-
import { euiLinkFocusCSS } from '../link/link.styles';
|
|
13
12
|
export var euiFacetButtonStyles = function euiFacetButtonStyles(_ref3) {
|
|
14
13
|
var euiTheme = _ref3.euiTheme;
|
|
15
14
|
return {
|
|
16
15
|
// Base
|
|
17
|
-
euiFacetButton: /*#__PURE__*/css(logicalTextAlignCSS('left'), " &:hover,&:focus{
|
|
16
|
+
euiFacetButton: /*#__PURE__*/css(logicalTextAlignCSS('left'), " &:not(:disabled){&:hover,&:focus{text-decoration:none;.euiFacetButton__text{text-decoration:underline;}}&:focus .euiFacetButton__text{text-decoration-thickness:", euiTheme.border.width.thick, ";}}&:disabled{color:", euiTheme.colors.disabledText, ";pointer-events:none;};label:euiFacetButton;")
|
|
18
17
|
};
|
|
19
18
|
};
|
|
20
19
|
export var euiFacetButtonTextStyles = function euiFacetButtonTextStyles(_ref4) {
|
|
@@ -7,7 +7,7 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
var _excluded = ["type", "size", "color", "className", "tabIndex", "title", "onIconLoad", "
|
|
10
|
+
var _excluded = ["type", "size", "color", "className", "tabIndex", "title", "onIconLoad", "style", "stylesMemoizer"];
|
|
11
11
|
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; }
|
|
12
12
|
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; }
|
|
13
13
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -26,7 +26,7 @@ import { keysOf } from '../common';
|
|
|
26
26
|
import { typeToPathMap } from './icon_map';
|
|
27
27
|
import { icon as empty } from './assets/empty';
|
|
28
28
|
import { enqueueStateChange } from '../../services/react';
|
|
29
|
-
import { htmlIdGenerator,
|
|
29
|
+
import { htmlIdGenerator, withEuiStylesMemoizer } from '../../services';
|
|
30
30
|
export { COLORS } from './named_colors';
|
|
31
31
|
import { isNamedColor } from './named_colors';
|
|
32
32
|
import { euiIconStyles } from './icon.styles';
|
|
@@ -178,8 +178,8 @@ export var EuiIconClass = /*#__PURE__*/function (_PureComponent) {
|
|
|
178
178
|
tabIndex = _this$props.tabIndex,
|
|
179
179
|
title = _this$props.title,
|
|
180
180
|
onIconLoad = _this$props.onIconLoad,
|
|
181
|
-
theme = _this$props.theme,
|
|
182
181
|
style = _this$props.style,
|
|
182
|
+
stylesMemoizer = _this$props.stylesMemoizer,
|
|
183
183
|
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
184
184
|
var _this$state = this.state,
|
|
185
185
|
isLoading = _this$state.isLoading,
|
|
@@ -201,7 +201,7 @@ export var EuiIconClass = /*#__PURE__*/function (_PureComponent) {
|
|
|
201
201
|
var classes = classNames('euiIcon', className);
|
|
202
202
|
|
|
203
203
|
// Emotion styles
|
|
204
|
-
var styles = euiIconStyles
|
|
204
|
+
var styles = stylesMemoizer(euiIconStyles);
|
|
205
205
|
var cssStyles = [styles.euiIcon, styles[size], color && isNamedColor(color) && styles[color], isCustomColor && styles.customColor, isElasticLogoOutline && styles.logoElasticOutline, isAppIcon && !appIconHasColor && styles.app, isLoading && styles.isLoading, !isLoading && neededLoading && styles.isLoaded];
|
|
206
206
|
var icon = this.state.icon || empty;
|
|
207
207
|
if (typeof icon === 'string') {
|
|
@@ -218,33 +218,30 @@ export var EuiIconClass = /*#__PURE__*/function (_PureComponent) {
|
|
|
218
218
|
|
|
219
219
|
// If it's an empty icon, or if there is no aria-label, aria-labelledby, or title it gets aria-hidden true
|
|
220
220
|
var isAriaHidden = icon === empty || !(this.props['aria-label'] || this.props['aria-labelledby'] || this.props.title);
|
|
221
|
-
var hideIconEmpty = isAriaHidden && {
|
|
222
|
-
'aria-hidden': true
|
|
223
|
-
};
|
|
224
|
-
var titleId;
|
|
225
221
|
|
|
226
222
|
// If no aria-label or aria-labelledby is provided but there's a title, a titleId is generated
|
|
227
223
|
// The svg aria-labelledby attribute gets this titleId
|
|
228
224
|
// The svg title element gets this titleId as an id
|
|
229
|
-
|
|
230
|
-
titleId
|
|
231
|
-
|
|
232
|
-
};
|
|
233
|
-
}
|
|
225
|
+
var titleId = !this.props['aria-label'] && !this.props['aria-labelledby'] && title ? {
|
|
226
|
+
titleId: generateId()
|
|
227
|
+
} : undefined;
|
|
234
228
|
return ___EmotionJSX(Svg, _extends({
|
|
235
229
|
className: classes,
|
|
236
230
|
style: optionalCustomStyles,
|
|
237
231
|
css: cssStyles,
|
|
238
232
|
tabIndex: tabIndex,
|
|
239
233
|
role: "img",
|
|
240
|
-
title: title
|
|
234
|
+
title: title
|
|
235
|
+
}, titleId, {
|
|
241
236
|
"data-icon-type": iconTitle,
|
|
242
237
|
"data-is-loaded": isLoaded || undefined,
|
|
243
238
|
"data-is-loading": isLoading || undefined
|
|
244
|
-
},
|
|
239
|
+
}, rest, {
|
|
240
|
+
"aria-hidden": isAriaHidden || undefined
|
|
241
|
+
}));
|
|
245
242
|
}
|
|
246
243
|
}
|
|
247
244
|
}]);
|
|
248
245
|
return EuiIconClass;
|
|
249
246
|
}(PureComponent);
|
|
250
|
-
export var EuiIcon =
|
|
247
|
+
export var EuiIcon = withEuiStylesMemoizer(EuiIconClass);
|
|
@@ -10,10 +10,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { css, keyframes } from '@emotion/react';
|
|
13
|
-
import {
|
|
14
|
-
var iconSize = function iconSize(size) {
|
|
15
|
-
return "\n ".concat(logicalCSS('width', size), ";\n ").concat(logicalCSS('height', size), ";\n ");
|
|
16
|
-
};
|
|
13
|
+
import { logicalSizeCSS, euiCanAnimate } from '../../global_styling';
|
|
17
14
|
export var iconLoadingOpacity = 0.05;
|
|
18
15
|
var iconLoading = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% {\n opacity: ", ";\n }\n\n 100% {\n opacity: 1;\n }\n"])), iconLoadingOpacity);
|
|
19
16
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
@@ -52,11 +49,11 @@ export var euiIconStyles = function euiIconStyles(_ref3) {
|
|
|
52
49
|
logoElasticOutline: _ref,
|
|
53
50
|
// Sizes
|
|
54
51
|
original: /*#__PURE__*/css(";label:original;"),
|
|
55
|
-
s: /*#__PURE__*/css(
|
|
56
|
-
m: /*#__PURE__*/css(
|
|
57
|
-
l: /*#__PURE__*/css(
|
|
58
|
-
xl: /*#__PURE__*/css(
|
|
59
|
-
xxl: /*#__PURE__*/css(
|
|
52
|
+
s: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size.m), ";label:s;"),
|
|
53
|
+
m: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size.base), ";label:m;"),
|
|
54
|
+
l: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size.l), ";label:l;"),
|
|
55
|
+
xl: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size.xl), ";label:xl;"),
|
|
56
|
+
xxl: /*#__PURE__*/css(logicalSizeCSS(euiTheme.size.xxl), ";label:xxl;"),
|
|
60
57
|
// Variants
|
|
61
58
|
// App icons are two-toned. This provides the base color.
|
|
62
59
|
app: /*#__PURE__*/css("fill:", euiTheme.colors.text, ";.euiIcon__fillSecondary{fill:", euiTheme.colors.successText, ";};label:app;"),
|
|
@@ -10,7 +10,7 @@ var _excluded = ["target", "external"];
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import React from 'react';
|
|
13
|
-
import {
|
|
13
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
14
14
|
import { logicalStyle } from '../../global_styling';
|
|
15
15
|
import { EuiIcon } from '../icon';
|
|
16
16
|
import { EuiI18n, useEuiI18n } from '../i18n';
|
|
@@ -21,16 +21,19 @@ import { EuiScreenReaderOnly } from '../accessibility';
|
|
|
21
21
|
* screen readers. Used internally by at EuiLink and EuiListGroupItem
|
|
22
22
|
*/
|
|
23
23
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
var iconStyle = function iconStyle(_ref) {
|
|
25
|
+
var euiTheme = _ref.euiTheme;
|
|
26
|
+
return logicalStyle('margin-left', euiTheme.size.xs);
|
|
27
|
+
};
|
|
28
|
+
export var EuiExternalLinkIcon = function EuiExternalLinkIcon(_ref2) {
|
|
29
|
+
var target = _ref2.target,
|
|
30
|
+
external = _ref2.external,
|
|
31
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
32
|
+
var iconCssStyle = useEuiMemoizedStyles(iconStyle);
|
|
30
33
|
var showExternalLinkIcon = target === '_blank' && external !== false || external === true;
|
|
31
34
|
var iconAriaLabel = useEuiI18n('euiExternalLinkIcon.ariaLabel', 'External link');
|
|
32
35
|
return ___EmotionJSX(React.Fragment, null, showExternalLinkIcon && ___EmotionJSX(EuiIcon, _extends({
|
|
33
|
-
css:
|
|
36
|
+
css: iconCssStyle,
|
|
34
37
|
"aria-label": iconAriaLabel,
|
|
35
38
|
size: "s",
|
|
36
39
|
type: "popout"
|
|
@@ -14,7 +14,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
14
14
|
|
|
15
15
|
import React, { forwardRef } from 'react';
|
|
16
16
|
import classNames from 'classnames';
|
|
17
|
-
import { getSecureRelForTarget,
|
|
17
|
+
import { getSecureRelForTarget, useEuiMemoizedStyles } from '../../services';
|
|
18
18
|
import { validateHref } from '../../services/security/href_validator';
|
|
19
19
|
import { EuiExternalLinkIcon } from './external_link_icon';
|
|
20
20
|
import { euiLinkStyles } from './link.styles';
|
|
@@ -34,8 +34,7 @@ var EuiLink = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
34
34
|
onClick = _ref.onClick,
|
|
35
35
|
_disabled = _ref.disabled,
|
|
36
36
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
-
var
|
|
38
|
-
var styles = euiLinkStyles(euiTheme);
|
|
37
|
+
var styles = useEuiMemoizedStyles(euiLinkStyles);
|
|
39
38
|
var cssStyles = [styles.euiLink];
|
|
40
39
|
var isHrefValid = !href || validateHref(href);
|
|
41
40
|
var disabled = _disabled || !isHrefValid;
|
|
@@ -9,18 +9,9 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
9
9
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { euiFocusRing, logicalTextAlignCSS } from '../../global_styling';
|
|
12
|
-
var _colorCSS = function _colorCSS(color) {
|
|
13
|
-
return "\n color: ".concat(color, ";\n\n &:target {\n color: darken(").concat(color, ", 10%);\n }\n ");
|
|
14
|
-
};
|
|
15
|
-
export var euiLinkHoverCSS = function euiLinkHoverCSS() {
|
|
16
|
-
return "\n text-decoration: underline;\n ";
|
|
17
|
-
};
|
|
18
|
-
export var euiLinkFocusCSS = function euiLinkFocusCSS(euiTheme) {
|
|
19
|
-
return "\n text-decoration: underline;\n text-decoration-thickness: ".concat(euiTheme.border.width.thick, ";\n ");
|
|
20
|
-
};
|
|
21
12
|
export var euiLinkCSS = function euiLinkCSS(euiThemeContext) {
|
|
22
13
|
var euiTheme = euiThemeContext.euiTheme;
|
|
23
|
-
return "\n font-weight: ".concat(euiTheme.font.weight.medium, ";\n ").concat(logicalTextAlignCSS('left'), "\n\n &:hover {\n
|
|
14
|
+
return "\n font-weight: ".concat(euiTheme.font.weight.medium, ";\n ").concat(logicalTextAlignCSS('left'), "\n\n &:hover {\n text-decoration: underline;\n }\n\n &:focus {\n ").concat(euiFocusRing(euiThemeContext, 'outset'), "\n text-decoration: underline;\n text-decoration-thickness: ").concat(euiTheme.border.width.thick, ";\n }\n ");
|
|
24
15
|
};
|
|
25
16
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
26
17
|
name: "9njbi5-disabled",
|
|
@@ -45,4 +36,7 @@ export var euiLinkStyles = function euiLinkStyles(euiThemeContext) {
|
|
|
45
36
|
ghost: /*#__PURE__*/css(_colorCSS(euiTheme.colors.ghost), ";label:ghost;"),
|
|
46
37
|
text: /*#__PURE__*/css(_colorCSS(euiTheme.colors.text), ";label:text;")
|
|
47
38
|
};
|
|
39
|
+
};
|
|
40
|
+
var _colorCSS = function _colorCSS(color) {
|
|
41
|
+
return "\n color: ".concat(color, ";\n\n &:target {\n color: darken(").concat(color, ", 10%);\n }\n ");
|
|
48
42
|
};
|
|
@@ -10,7 +10,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { css, keyframes } from '@emotion/react';
|
|
13
|
-
import { logicalCSS, logicalTextAlignCSS, euiCantAnimate, euiFontSize, euiTextTruncate } from '../../global_styling';
|
|
13
|
+
import { logicalCSS, logicalTextAlignCSS, euiCanAnimate, euiCantAnimate, euiFontSize, euiTextTruncate } from '../../global_styling';
|
|
14
14
|
import { euiPaletteColorBlind, makeHighContrastColor } from '../../services';
|
|
15
15
|
import { euiText } from '../text/text.styles';
|
|
16
16
|
|
|
@@ -63,7 +63,7 @@ export var euiProgressStyles = function euiProgressStyles(_ref3, isNative) {
|
|
|
63
63
|
// https://css-tricks.com/html5-progress-element/
|
|
64
64
|
// Good resource if you need to work in here. There's some gotchas with
|
|
65
65
|
// dealing with cross-browser progress bars.
|
|
66
|
-
native: /*#__PURE__*/css("display:block;", logicalCSS('width', '100%'), " appearance:none;border:none;border-radius:", euiTheme.size.s, ";&::-webkit-progress-bar{background-color:", euiTheme.colors.lightShade, ";}", crossBrowserProgressValue(
|
|
66
|
+
native: /*#__PURE__*/css("display:block;", logicalCSS('width', '100%'), " appearance:none;border:none;border-radius:", euiTheme.size.s, ";&::-webkit-progress-bar{background-color:", euiTheme.colors.lightShade, ";}", euiCanAnimate, "{/* Note: FF/Mozilla doesn't actually support animating the native progress bar\n @see https://bugzilla.mozilla.org/show_bug.cgi?id=662351 */", crossBrowserProgressValue("transition: width ".concat(euiTheme.animation.normal, " linear")), ";};label:native;"),
|
|
67
67
|
// An indeterminate bar has an unreliable end time. Because of a Firefox animation issue,
|
|
68
68
|
// we apply this style to a <div> instead of a <progress> element.
|
|
69
69
|
// See https://css-tricks.com/html5-progress-element/ for more info.
|
|
@@ -11,7 +11,7 @@ var _excluded = ["isLoading", "size", "className", "contentAriaLabel", "announce
|
|
|
11
11
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import {
|
|
14
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
15
15
|
import { EuiSkeletonLoading } from './skeleton_loading';
|
|
16
16
|
import { euiSkeletonCircleStyles } from './skeleton_circle.styles';
|
|
17
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -29,8 +29,7 @@ export var EuiSkeletonCircle = function EuiSkeletonCircle(_ref) {
|
|
|
29
29
|
ariaWrapperProps = _ref.ariaWrapperProps,
|
|
30
30
|
children = _ref.children,
|
|
31
31
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
-
var
|
|
33
|
-
var styles = euiSkeletonCircleStyles(euiTheme);
|
|
32
|
+
var styles = useEuiMemoizedStyles(euiSkeletonCircleStyles);
|
|
34
33
|
var cssStyles = [styles.euiSkeletonCircle, styles[size]];
|
|
35
34
|
return ___EmotionJSX(EuiSkeletonLoading, _extends({
|
|
36
35
|
isLoading: isLoading,
|
|
@@ -14,7 +14,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
14
14
|
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import classNames from 'classnames';
|
|
17
|
-
import {
|
|
17
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
18
18
|
import { logicalStyles } from '../../global_styling';
|
|
19
19
|
import { EuiSkeletonLoading } from './skeleton_loading';
|
|
20
20
|
import { euiSkeletonRectangleStyles } from './skeleton_rectangle.styles';
|
|
@@ -38,8 +38,7 @@ export var EuiSkeletonRectangle = function EuiSkeletonRectangle(_ref) {
|
|
|
38
38
|
ariaWrapperProps = _ref.ariaWrapperProps,
|
|
39
39
|
children = _ref.children,
|
|
40
40
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
-
var
|
|
42
|
-
var styles = euiSkeletonRectangleStyles(euiTheme);
|
|
41
|
+
var styles = useEuiMemoizedStyles(euiSkeletonRectangleStyles);
|
|
43
42
|
var cssStyles = [styles.euiSkeletonRectangle, styles[borderRadius]];
|
|
44
43
|
return ___EmotionJSX(EuiSkeletonLoading, _extends({
|
|
45
44
|
isLoading: isLoading,
|
|
@@ -9,9 +9,9 @@ var _excluded = ["isLoading", "lines", "size", "className", "contentAriaLabel",
|
|
|
9
9
|
* Side Public License, v 1.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import React from 'react';
|
|
12
|
+
import React, { useMemo } from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import {
|
|
14
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
15
15
|
import { EuiSkeletonLoading } from './skeleton_loading';
|
|
16
16
|
import { euiSkeletonTextStyles } from './skeleton_text.styles';
|
|
17
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -31,16 +31,20 @@ export var EuiSkeletonText = function EuiSkeletonText(_ref) {
|
|
|
31
31
|
ariaWrapperProps = _ref.ariaWrapperProps,
|
|
32
32
|
children = _ref.children,
|
|
33
33
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
lineElements
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
var styles = useEuiMemoizedStyles(euiSkeletonTextStyles);
|
|
35
|
+
var cssStyles = useMemo(function () {
|
|
36
|
+
return [styles.euiSkeletonText, styles[size]];
|
|
37
|
+
}, [styles, size]);
|
|
38
|
+
var lineElements = useMemo(function () {
|
|
39
|
+
var lineElements = [];
|
|
40
|
+
for (var i = 0; i < lines; i++) {
|
|
41
|
+
lineElements.push(___EmotionJSX("span", {
|
|
42
|
+
key: i,
|
|
43
|
+
css: cssStyles
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
return lineElements;
|
|
47
|
+
}, [lines, cssStyles]);
|
|
44
48
|
return ___EmotionJSX(EuiSkeletonLoading, _extends({
|
|
45
49
|
isLoading: isLoading,
|
|
46
50
|
loadingContent: ___EmotionJSX("span", _extends({
|
|
@@ -11,7 +11,7 @@ var _excluded = ["isLoading", "size", "className", "contentAriaLabel", "announce
|
|
|
11
11
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import {
|
|
14
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
15
15
|
import { EuiSkeletonLoading } from './skeleton_loading';
|
|
16
16
|
import { euiSkeletonTitleStyles } from './skeleton_title.styles';
|
|
17
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
@@ -28,8 +28,7 @@ export var EuiSkeletonTitle = function EuiSkeletonTitle(_ref) {
|
|
|
28
28
|
ariaWrapperProps = _ref.ariaWrapperProps,
|
|
29
29
|
children = _ref.children,
|
|
30
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
-
var
|
|
32
|
-
var styles = euiSkeletonTitleStyles(euiTheme);
|
|
31
|
+
var styles = useEuiMemoizedStyles(euiSkeletonTitleStyles);
|
|
33
32
|
var cssStyles = [styles.euiSkeletonTitle, styles[size]];
|
|
34
33
|
return ___EmotionJSX(EuiSkeletonLoading, _extends({
|
|
35
34
|
isLoading: isLoading,
|
|
@@ -11,7 +11,7 @@ var _excluded = ["size", "color", "grow", "textAlign", "children", "className"];
|
|
|
11
11
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import {
|
|
14
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
15
15
|
import { euiTextStyles } from './text.styles';
|
|
16
16
|
import { EuiTextColor } from './text_color';
|
|
17
17
|
import { EuiTextAlign } from './text_align';
|
|
@@ -27,8 +27,7 @@ export var EuiText = function EuiText(_ref) {
|
|
|
27
27
|
children = _ref.children,
|
|
28
28
|
className = _ref.className,
|
|
29
29
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
-
var
|
|
31
|
-
var styles = euiTextStyles(euiTheme);
|
|
30
|
+
var styles = useEuiMemoizedStyles(euiTextStyles);
|
|
32
31
|
var cssStyles = [styles.euiText, !grow ? styles.constrainedWidth : undefined, styles[size]];
|
|
33
32
|
var classes = classNames('euiText', className);
|
|
34
33
|
var text = ___EmotionJSX("div", _extends({
|
|
@@ -13,7 +13,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
13
13
|
|
|
14
14
|
import React, { isValidElement } from 'react';
|
|
15
15
|
import { cloneElementWithCss } from '../../services';
|
|
16
|
-
import { euiTextAlignStyles } from './text_align.styles';
|
|
16
|
+
import { euiTextAlignStyles as styles } from './text_align.styles';
|
|
17
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
18
18
|
export var ALIGNMENTS = ['left', 'right', 'center'];
|
|
19
19
|
export var EuiTextAlign = function EuiTextAlign(_ref) {
|
|
@@ -23,7 +23,6 @@ export var EuiTextAlign = function EuiTextAlign(_ref) {
|
|
|
23
23
|
_ref$cloneElement = _ref.cloneElement,
|
|
24
24
|
cloneElement = _ref$cloneElement === void 0 ? false : _ref$cloneElement,
|
|
25
25
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
var styles = euiTextAlignStyles();
|
|
27
26
|
var cssStyles = [styles.euiTextAlign, styles[textAlign]];
|
|
28
27
|
var props = _objectSpread({
|
|
29
28
|
css: cssStyles
|
|
@@ -8,11 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
import { css } from '@emotion/react';
|
|
10
10
|
import { logicalTextAlignCSS } from '../../global_styling';
|
|
11
|
-
export var euiTextAlignStyles =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
center: /*#__PURE__*/css(logicalTextAlignCSS('center'), ";;label:center;")
|
|
17
|
-
};
|
|
11
|
+
export var euiTextAlignStyles = {
|
|
12
|
+
euiTextAlign: /*#__PURE__*/css(";label:euiTextAlign;"),
|
|
13
|
+
left: /*#__PURE__*/css(logicalTextAlignCSS('left'), ";;label:left;"),
|
|
14
|
+
right: /*#__PURE__*/css(logicalTextAlignCSS('right'), ";;label:right;"),
|
|
15
|
+
center: /*#__PURE__*/css(logicalTextAlignCSS('center'), ";;label:center;")
|
|
18
16
|
};
|
|
@@ -12,7 +12,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import React, { isValidElement } from 'react';
|
|
15
|
-
import {
|
|
15
|
+
import { useEuiMemoizedStyles, cloneElementWithCss } from '../../services';
|
|
16
16
|
import { euiTextColorStyles } from './text_color.styles';
|
|
17
17
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
18
18
|
export var COLORS = ['default', 'subdued', 'success', 'accent', 'danger', 'warning', 'ghost', 'inherit'];
|
|
@@ -27,8 +27,7 @@ export var EuiTextColor = function EuiTextColor(_ref) {
|
|
|
27
27
|
style = _ref.style,
|
|
28
28
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
29
29
|
var isNamedColor = COLORS.includes(color);
|
|
30
|
-
var
|
|
31
|
-
var styles = euiTextColorStyles(euiTheme);
|
|
30
|
+
var styles = useEuiMemoizedStyles(euiTextColorStyles);
|
|
32
31
|
var cssStyles = [styles.euiTextColor, isNamedColor ? styles[color] : styles.customColor];
|
|
33
32
|
|
|
34
33
|
// We're checking if is a custom color.
|
|
@@ -12,7 +12,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import classNames from 'classnames';
|
|
15
|
-
import {
|
|
15
|
+
import { useEuiMemoizedStyles, cloneElementWithCss } from '../../services';
|
|
16
16
|
import { euiTitleStyles } from './title.styles';
|
|
17
17
|
export var TITLE_SIZES = ['xxxs', 'xxs', 'xs', 's', 'm', 'l'];
|
|
18
18
|
export var TEXT_TRANSFORM = ['uppercase'];
|
|
@@ -23,8 +23,7 @@ export var EuiTitle = function EuiTitle(_ref) {
|
|
|
23
23
|
className = _ref.className,
|
|
24
24
|
textTransform = _ref.textTransform,
|
|
25
25
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
var
|
|
27
|
-
var styles = euiTitleStyles(euiTheme);
|
|
26
|
+
var styles = useEuiMemoizedStyles(euiTitleStyles);
|
|
28
27
|
var cssStyles = [styles.euiTitle, textTransform ? styles[textTransform] : undefined, styles[size]];
|
|
29
28
|
var classes = classNames('euiTitle', className, children.props.className);
|
|
30
29
|
var props = _objectSpread({
|
|
@@ -11,7 +11,6 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { css } from '@emotion/react';
|
|
14
|
-
import { useEuiTheme } from '../../services';
|
|
15
14
|
import { euiTextBreakWord, euiFontSize, logicalCSS } from '../../global_styling';
|
|
16
15
|
|
|
17
16
|
/**
|
|
@@ -36,12 +35,6 @@ export var euiTitle = function euiTitle(euiThemeContext) {
|
|
|
36
35
|
});
|
|
37
36
|
};
|
|
38
37
|
|
|
39
|
-
// Hook version
|
|
40
|
-
export var useEuiTitle = function useEuiTitle(scale, options) {
|
|
41
|
-
var euiTheme = useEuiTheme();
|
|
42
|
-
return euiTitle(euiTheme, scale, options);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
38
|
/**
|
|
46
39
|
* Styles
|
|
47
40
|
*/
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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; }
|
|
1
4
|
/*
|
|
2
5
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
6
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -7,7 +10,8 @@
|
|
|
7
10
|
*/
|
|
8
11
|
|
|
9
12
|
import { euiLineHeightFromBaseline, euiFontSizeFromScale } from '../functions/typography';
|
|
10
|
-
import { useEuiTheme } from '../../services/theme
|
|
13
|
+
import { useEuiMemoizedStyles, useEuiTheme } from '../../services/theme';
|
|
14
|
+
import { EuiThemeFontScales } from '../variables/typography';
|
|
11
15
|
import { logicalCSS } from '../functions';
|
|
12
16
|
/**
|
|
13
17
|
* Returns font-size and line-height
|
|
@@ -21,7 +25,15 @@ export var euiFontSize = function euiFontSize(_ref, scale, options) {
|
|
|
21
25
|
};
|
|
22
26
|
export var useEuiFontSize = function useEuiFontSize(scale, options) {
|
|
23
27
|
var euiTheme = useEuiTheme();
|
|
24
|
-
|
|
28
|
+
var memoizedFontSizes = useEuiMemoizedStyles(euiFontSizes);
|
|
29
|
+
return !options ? memoizedFontSizes[scale] : euiFontSize(euiTheme, scale, options);
|
|
30
|
+
};
|
|
31
|
+
// Memomize a basic set of font sizes. We unfortunately can't
|
|
32
|
+
// memoize all possible options, there's too many permutations
|
|
33
|
+
var euiFontSizes = function euiFontSizes(euiThemeContext) {
|
|
34
|
+
return EuiThemeFontScales.reduce(function (map, scale) {
|
|
35
|
+
return _objectSpread(_objectSpread({}, map), {}, _defineProperty({}, scale, euiFontSize(euiThemeContext, scale)));
|
|
36
|
+
}, {});
|
|
25
37
|
};
|
|
26
38
|
|
|
27
39
|
/**
|
|
@@ -47,8 +59,4 @@ export var euiTextTruncate = function euiTextTruncate() {
|
|
|
47
59
|
export var euiNumberFormat = function euiNumberFormat(_ref2) {
|
|
48
60
|
var euiTheme = _ref2.euiTheme;
|
|
49
61
|
return "\n font-feature-settings: ".concat(euiTheme.font.featureSettings, ", 'tnum' 1;\n");
|
|
50
|
-
};
|
|
51
|
-
export var useEuiNumberFormat = function useEuiNumberFormat() {
|
|
52
|
-
var euiTheme = useEuiTheme();
|
|
53
|
-
return euiNumberFormat(euiTheme);
|
|
54
62
|
};
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
export { EuiSystemContext, EuiThemeContext, EuiNestedThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
|
|
10
10
|
export { useEuiTheme, withEuiTheme, RenderWithEuiTheme, useEuiThemeCSSVariables } from './hooks';
|
|
11
11
|
export { EuiThemeProvider } from './provider';
|
|
12
|
-
export { useEuiMemoizedStyles } from './style_memoization';
|
|
12
|
+
export { useEuiMemoizedStyles, withEuiStylesMemoizer } from './style_memoization';
|
|
13
13
|
export { getEuiDevProviderWarning, setEuiDevProviderWarning } from './warning';
|
|
14
14
|
export { buildTheme, computed, isInverseColorMode, getColorMode, getComputed, getOn, mergeDeep, setOn, Computed } from './utils';
|
|
15
15
|
export { COLOR_MODES_STANDARD } from './types';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
/*
|
|
3
4
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -7,7 +8,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
7
8
|
* Side Public License, v 1.
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
|
-
import React, { createContext, useContext, useState, useMemo } from 'react';
|
|
11
|
+
import React, { createContext, useContext, useState, useMemo, useCallback, forwardRef } from 'react';
|
|
11
12
|
import { useUpdateEffect } from '../hooks';
|
|
12
13
|
import { useEuiTheme } from './hooks';
|
|
13
14
|
|
|
@@ -36,25 +37,57 @@ export var EuiThemeMemoizedStylesProvider = function EuiThemeMemoizedStylesProvi
|
|
|
36
37
|
}, children);
|
|
37
38
|
};
|
|
38
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Internal util primarily responsible for getting the memoized styles (if they exist)
|
|
42
|
+
* and if not, generating and setting the styles. DRYed out to facilitate usage
|
|
43
|
+
* between both hook/function components and HOC/class components
|
|
44
|
+
*/
|
|
45
|
+
var getMemoizedStyles = function getMemoizedStyles(stylesGenerator, stylesMap, euiThemeContext) {
|
|
46
|
+
if (!stylesGenerator.name) {
|
|
47
|
+
throw new Error('Styles are memoized per function. Your style functions must be statically defined in order to not create a new map entry every rerender.');
|
|
48
|
+
}
|
|
49
|
+
var existingStyles = stylesMap.get(stylesGenerator);
|
|
50
|
+
if (existingStyles) {
|
|
51
|
+
return existingStyles;
|
|
52
|
+
} else {
|
|
53
|
+
var generatedStyles = stylesGenerator(euiThemeContext);
|
|
54
|
+
stylesMap.set(stylesGenerator, generatedStyles);
|
|
55
|
+
return generatedStyles;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
39
59
|
/**
|
|
40
60
|
* Hook that memoizes the returned values of components style fns/generators
|
|
41
61
|
* per-theme
|
|
42
62
|
*/
|
|
43
|
-
export var useEuiMemoizedStyles = function useEuiMemoizedStyles(
|
|
63
|
+
export var useEuiMemoizedStyles = function useEuiMemoizedStyles(stylesGenerator) {
|
|
44
64
|
var memoizedStyles = useContext(EuiThemeMemoizedStylesContext);
|
|
45
65
|
var euiThemeContext = useEuiTheme();
|
|
46
66
|
var memoizedComponentStyles = useMemo(function () {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
var existingStyles = memoizedStyles.get(styleGenerator);
|
|
51
|
-
if (existingStyles) {
|
|
52
|
-
return existingStyles;
|
|
53
|
-
} else {
|
|
54
|
-
var generatedStyles = styleGenerator(euiThemeContext);
|
|
55
|
-
memoizedStyles.set(styleGenerator, generatedStyles);
|
|
56
|
-
return generatedStyles;
|
|
57
|
-
}
|
|
58
|
-
}, [styleGenerator, memoizedStyles, euiThemeContext]);
|
|
67
|
+
return getMemoizedStyles(stylesGenerator, memoizedStyles, euiThemeContext);
|
|
68
|
+
}, [stylesGenerator, memoizedStyles, euiThemeContext]);
|
|
59
69
|
return memoizedComponentStyles;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* HOC for class components
|
|
74
|
+
* Syntax is mostly copied from withEuiTheme HOC
|
|
75
|
+
*/
|
|
76
|
+
|
|
77
|
+
export var withEuiStylesMemoizer = function withEuiStylesMemoizer(Component) {
|
|
78
|
+
var componentName = Component.displayName || Component.name || 'ComponentWithStylesMemoizer';
|
|
79
|
+
var Render = function Render(props, ref) {
|
|
80
|
+
var memoizedStyles = useContext(EuiThemeMemoizedStylesContext);
|
|
81
|
+
var euiThemeContext = useEuiTheme();
|
|
82
|
+
var stylesMemoizer = useCallback(function (stylesGenerator) {
|
|
83
|
+
return getMemoizedStyles(stylesGenerator, memoizedStyles, euiThemeContext);
|
|
84
|
+
}, [memoizedStyles, euiThemeContext]);
|
|
85
|
+
return ___EmotionJSX(Component, _extends({
|
|
86
|
+
stylesMemoizer: stylesMemoizer,
|
|
87
|
+
ref: ref
|
|
88
|
+
}, props));
|
|
89
|
+
};
|
|
90
|
+
var WithEuiStylesMemoizer = /*#__PURE__*/forwardRef(Render);
|
|
91
|
+
WithEuiStylesMemoizer.displayName = componentName;
|
|
92
|
+
return WithEuiStylesMemoizer;
|
|
60
93
|
};
|