@elastic/eui 92.2.0 → 93.0.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 +0 -200
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -200
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/basic_table/basic_table.js +0 -9
- package/es/components/basic_table/in_memory_table.js +0 -10
- package/es/components/beacon/beacon.js +9 -6
- package/es/components/breadcrumbs/breadcrumb.js +0 -10
- package/es/components/breadcrumbs/breadcrumbs.js +0 -10
- package/es/components/code/code.js +2 -2
- package/es/components/code/code.styles.js +2 -4
- package/es/components/code/code_block.js +5 -3
- package/es/components/code/code_block.styles.js +4 -7
- package/es/components/code/code_block_controls.js +2 -2
- package/es/components/code/code_block_controls.styles.js +2 -4
- package/es/components/code/code_block_full_screen.js +2 -2
- package/es/components/code/code_syntax.styles.js +39 -34
- package/es/components/comment_list/comment_event.js +3 -2
- package/es/components/comment_list/comment_event.styles.js +2 -18
- package/es/components/context_menu/context_menu.js +2 -6
- package/es/components/context_menu/context_menu_item.js +2 -14
- package/es/components/empty_prompt/empty_prompt.js +62 -65
- package/es/components/empty_prompt/empty_prompt.styles.js +115 -0
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +0 -10
- package/es/components/header/header_links/header_links.js +0 -10
- package/es/components/page/page_header/page_header_content.js +0 -10
- package/es/components/popover/popover.js +3 -15
- package/es/components/search_bar/search_bar.js +36 -32
- package/es/components/search_bar/search_bar.styles.js +22 -0
- package/es/components/text_truncate/text_truncate.js +4 -1
- package/es/components/tour/_tour_footer.js +97 -0
- package/es/components/tour/_tour_footer.styles.js +23 -0
- package/es/components/tour/_tour_header.js +37 -0
- package/es/components/tour/_tour_header.styles.js +20 -0
- package/es/components/tour/tour.styles.js +5 -28
- package/es/components/tour/tour_step.js +45 -130
- package/es/global_styling/mixins/_color.js +46 -13
- package/eui.d.ts +125 -66
- package/i18ntokens.json +94 -148
- package/lib/components/basic_table/basic_table.js +0 -9
- package/lib/components/basic_table/in_memory_table.js +0 -10
- package/lib/components/beacon/beacon.js +11 -6
- package/lib/components/breadcrumbs/breadcrumb.js +0 -10
- package/lib/components/code/code.js +2 -2
- package/lib/components/code/code.styles.js +2 -4
- package/lib/components/code/code_block.js +5 -3
- package/lib/components/code/code_block.styles.js +4 -7
- package/lib/components/code/code_block_controls.js +2 -2
- package/lib/components/code/code_block_controls.styles.js +2 -4
- package/lib/components/code/code_block_full_screen.js +2 -2
- package/lib/components/code/code_syntax.styles.js +40 -36
- package/lib/components/comment_list/comment_event.js +2 -1
- package/lib/components/comment_list/comment_event.styles.js +3 -20
- package/lib/components/context_menu/context_menu.js +2 -6
- package/lib/components/context_menu/context_menu_item.js +2 -14
- package/lib/components/empty_prompt/empty_prompt.js +64 -64
- package/lib/components/empty_prompt/empty_prompt.styles.js +120 -0
- package/lib/components/popover/popover.js +3 -15
- package/lib/components/search_bar/search_bar.js +37 -33
- package/lib/components/search_bar/search_bar.styles.js +30 -0
- package/lib/components/text_truncate/text_truncate.js +4 -1
- package/lib/components/tour/_tour_footer.js +105 -0
- package/lib/components/tour/_tour_footer.styles.js +31 -0
- package/lib/components/tour/_tour_header.js +48 -0
- package/lib/components/tour/_tour_header.styles.js +27 -0
- package/lib/components/tour/tour.styles.js +7 -32
- package/lib/components/tour/tour_step.js +42 -117
- package/lib/global_styling/mixins/_color.js +50 -15
- package/optimize/es/components/basic_table/basic_table.js +0 -9
- package/optimize/es/components/basic_table/in_memory_table.js +0 -10
- package/optimize/es/components/beacon/beacon.js +9 -6
- package/optimize/es/components/code/code.js +2 -2
- package/optimize/es/components/code/code.styles.js +2 -4
- package/optimize/es/components/code/code_block.js +5 -3
- package/optimize/es/components/code/code_block.styles.js +4 -7
- package/optimize/es/components/code/code_block_controls.js +2 -2
- package/optimize/es/components/code/code_block_controls.styles.js +2 -4
- package/optimize/es/components/code/code_block_full_screen.js +2 -2
- package/optimize/es/components/code/code_syntax.styles.js +39 -34
- package/optimize/es/components/comment_list/comment_event.js +3 -2
- package/optimize/es/components/comment_list/comment_event.styles.js +2 -18
- package/optimize/es/components/context_menu/context_menu.js +2 -6
- package/optimize/es/components/context_menu/context_menu_item.js +2 -6
- package/optimize/es/components/empty_prompt/empty_prompt.js +62 -62
- package/optimize/es/components/empty_prompt/empty_prompt.styles.js +112 -0
- package/optimize/es/components/popover/popover.js +3 -5
- package/optimize/es/components/search_bar/search_bar.js +36 -32
- package/optimize/es/components/search_bar/search_bar.styles.js +22 -0
- package/optimize/es/components/text_truncate/text_truncate.js +4 -1
- package/optimize/es/components/tour/_tour_footer.js +89 -0
- package/optimize/es/components/tour/_tour_footer.styles.js +23 -0
- package/optimize/es/components/tour/_tour_header.js +33 -0
- package/optimize/es/components/tour/_tour_header.styles.js +20 -0
- package/optimize/es/components/tour/tour.styles.js +5 -28
- package/optimize/es/components/tour/tour_step.js +45 -113
- package/optimize/es/global_styling/mixins/_color.js +46 -13
- package/optimize/lib/components/basic_table/basic_table.js +0 -9
- package/optimize/lib/components/basic_table/in_memory_table.js +0 -10
- package/optimize/lib/components/beacon/beacon.js +12 -6
- package/optimize/lib/components/code/code.js +2 -2
- package/optimize/lib/components/code/code.styles.js +2 -4
- package/optimize/lib/components/code/code_block.js +5 -3
- package/optimize/lib/components/code/code_block.styles.js +4 -7
- package/optimize/lib/components/code/code_block_controls.js +2 -2
- package/optimize/lib/components/code/code_block_controls.styles.js +2 -4
- package/optimize/lib/components/code/code_block_full_screen.js +2 -2
- package/optimize/lib/components/code/code_syntax.styles.js +40 -36
- package/optimize/lib/components/comment_list/comment_event.js +2 -1
- package/optimize/lib/components/comment_list/comment_event.styles.js +3 -20
- package/optimize/lib/components/context_menu/context_menu.js +2 -6
- package/optimize/lib/components/context_menu/context_menu_item.js +2 -6
- package/optimize/lib/components/empty_prompt/empty_prompt.js +65 -62
- package/optimize/lib/components/empty_prompt/empty_prompt.styles.js +118 -0
- package/optimize/lib/components/popover/popover.js +3 -5
- package/optimize/lib/components/search_bar/search_bar.js +37 -33
- package/optimize/lib/components/search_bar/search_bar.styles.js +30 -0
- package/optimize/lib/components/text_truncate/text_truncate.js +4 -1
- package/optimize/lib/components/tour/_tour_footer.js +100 -0
- package/optimize/lib/components/tour/_tour_footer.styles.js +31 -0
- package/optimize/lib/components/tour/_tour_header.js +43 -0
- package/optimize/lib/components/tour/_tour_header.styles.js +27 -0
- package/optimize/lib/components/tour/tour.styles.js +7 -32
- package/optimize/lib/components/tour/tour_step.js +42 -110
- package/optimize/lib/global_styling/mixins/_color.js +50 -15
- package/package.json +1 -1
- package/src/components/index.scss +0 -2
- package/test-env/components/basic_table/basic_table.js +0 -9
- package/test-env/components/basic_table/in_memory_table.js +0 -10
- package/test-env/components/beacon/beacon.js +12 -6
- package/test-env/components/breadcrumbs/breadcrumb.js +0 -10
- package/test-env/components/code/code.styles.js +2 -4
- package/test-env/components/code/code_block.styles.js +4 -7
- package/test-env/components/code/code_block_controls.js +2 -2
- package/test-env/components/code/code_block_controls.styles.js +2 -4
- package/test-env/components/code/code_block_full_screen.js +2 -2
- package/test-env/components/code/code_syntax.styles.js +40 -36
- package/test-env/components/comment_list/comment_event.js +2 -1
- package/test-env/components/comment_list/comment_event.styles.js +3 -20
- package/test-env/components/context_menu/context_menu.js +2 -6
- package/test-env/components/context_menu/context_menu_item.js +2 -14
- package/test-env/components/empty_prompt/empty_prompt.js +65 -62
- package/test-env/components/empty_prompt/empty_prompt.styles.js +118 -0
- package/test-env/components/popover/popover.js +3 -15
- package/test-env/components/search_bar/search_bar.js +37 -33
- package/test-env/components/search_bar/search_bar.styles.js +30 -0
- package/test-env/components/text_truncate/text_truncate.js +4 -1
- package/test-env/components/tour/_tour_footer.js +100 -0
- package/test-env/components/tour/_tour_footer.styles.js +31 -0
- package/test-env/components/tour/_tour_header.js +48 -0
- package/test-env/components/tour/_tour_header.styles.js +27 -0
- package/test-env/components/tour/tour.styles.js +7 -32
- package/test-env/components/tour/tour_step.js +42 -114
- package/test-env/global_styling/mixins/_color.js +50 -15
- package/src/components/empty_prompt/_empty_prompt.scss +0 -128
- package/src/components/empty_prompt/_index.scss +0 -1
- package/src/components/search_bar/_index.scss +0 -1
- package/src/components/search_bar/_search_bar.scss +0 -10
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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; } }
|
|
4
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
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); }
|
|
8
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
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; }
|
|
11
|
+
/*
|
|
12
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
13
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
14
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
15
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
16
|
+
* Side Public License, v 1.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import React, { useMemo, memo } from 'react';
|
|
20
|
+
import { useEuiTheme } from '../../services';
|
|
21
|
+
import { EuiI18n } from '../i18n';
|
|
22
|
+
import { EuiPopoverFooter } from '../popover';
|
|
23
|
+
import { EuiButtonEmpty } from '../button';
|
|
24
|
+
import { EuiFlexGroup, EuiFlexItem } from '../flex';
|
|
25
|
+
import { EuiTourStepIndicator } from './tour_step_indicator';
|
|
26
|
+
import { euiTourFooterStyles } from './_tour_footer.styles';
|
|
27
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
28
|
+
export var EuiTourFooter = /*#__PURE__*/memo(function (_ref) {
|
|
29
|
+
var footerAction = _ref.footerAction,
|
|
30
|
+
step = _ref.step,
|
|
31
|
+
stepsTotal = _ref.stepsTotal,
|
|
32
|
+
onFinish = _ref.onFinish;
|
|
33
|
+
var euiTheme = useEuiTheme();
|
|
34
|
+
var footerStyles = euiTourFooterStyles(euiTheme);
|
|
35
|
+
var customFooterAction = useMemo(function () {
|
|
36
|
+
if (!footerAction) return null;
|
|
37
|
+
return Array.isArray(footerAction) ? ___EmotionJSX(EuiFlexGroup, {
|
|
38
|
+
gutterSize: "s",
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
justifyContent: "flexEnd",
|
|
41
|
+
responsive: false,
|
|
42
|
+
wrap: true
|
|
43
|
+
}, footerAction.map(function (action, index) {
|
|
44
|
+
return ___EmotionJSX(EuiFlexItem, {
|
|
45
|
+
key: index,
|
|
46
|
+
grow: false
|
|
47
|
+
}, action);
|
|
48
|
+
})) : ___EmotionJSX(EuiFlexItem, {
|
|
49
|
+
grow: false
|
|
50
|
+
}, footerAction);
|
|
51
|
+
}, [footerAction]);
|
|
52
|
+
var indicators = useMemo(function () {
|
|
53
|
+
if (stepsTotal <= 1) return null;
|
|
54
|
+
return ___EmotionJSX(EuiFlexItem, {
|
|
55
|
+
grow: false
|
|
56
|
+
}, ___EmotionJSX("ul", {
|
|
57
|
+
className: "euiTourFooter__stepList"
|
|
58
|
+
}, _toConsumableArray(Array(stepsTotal).keys()).map(function (_, i) {
|
|
59
|
+
var status = 'complete';
|
|
60
|
+
if (step === i + 1) {
|
|
61
|
+
status = 'active';
|
|
62
|
+
} else if (step <= i) {
|
|
63
|
+
status = 'incomplete';
|
|
64
|
+
}
|
|
65
|
+
return ___EmotionJSX(EuiTourStepIndicator, {
|
|
66
|
+
key: i,
|
|
67
|
+
number: i + 1,
|
|
68
|
+
status: status
|
|
69
|
+
});
|
|
70
|
+
})));
|
|
71
|
+
}, [step, stepsTotal]);
|
|
72
|
+
return ___EmotionJSX(EuiPopoverFooter, {
|
|
73
|
+
css: footerStyles.euiTourFooter,
|
|
74
|
+
className: "euiTourFooter"
|
|
75
|
+
}, ___EmotionJSX(EuiFlexGroup, {
|
|
76
|
+
responsive: false,
|
|
77
|
+
justifyContent: stepsTotal > 1 ? 'spaceBetween' : 'flexEnd',
|
|
78
|
+
alignItems: "center"
|
|
79
|
+
}, indicators, footerAction ? customFooterAction : ___EmotionJSX(EuiFlexItem, {
|
|
80
|
+
grow: false
|
|
81
|
+
}, ___EmotionJSX(EuiI18n, {
|
|
82
|
+
tokens: ['euiTourFooter.endTour', 'euiTourFooter.skipTour', 'euiTourFooter.closeTour'],
|
|
83
|
+
defaults: ['End tour', 'Skip tour', 'Close tour']
|
|
84
|
+
}, function (_ref2) {
|
|
85
|
+
var _ref3 = _slicedToArray(_ref2, 3),
|
|
86
|
+
endTour = _ref3[0],
|
|
87
|
+
skipTour = _ref3[1],
|
|
88
|
+
closeTour = _ref3[2];
|
|
89
|
+
return ___EmotionJSX(EuiButtonEmpty, {
|
|
90
|
+
onClick: onFinish,
|
|
91
|
+
color: "text",
|
|
92
|
+
flush: "right",
|
|
93
|
+
size: "xs"
|
|
94
|
+
}, stepsTotal > 1 ? stepsTotal === step ? endTour : skipTour : closeTour);
|
|
95
|
+
}))));
|
|
96
|
+
});
|
|
97
|
+
EuiTourFooter.displayName = '_EuiTourFooter';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { css } from '@emotion/react';
|
|
10
|
+
import { shade, tint } from '../../services';
|
|
11
|
+
import { logicalCSS } from '../../global_styling';
|
|
12
|
+
export var _tourFooterBgColor = function _tourFooterBgColor(_ref) {
|
|
13
|
+
var colorMode = _ref.colorMode,
|
|
14
|
+
euiTheme = _ref.euiTheme;
|
|
15
|
+
return colorMode === 'DARK' ? shade(euiTheme.colors.lightestShade, 0.45) : tint(euiTheme.colors.lightestShade, 0.5);
|
|
16
|
+
};
|
|
17
|
+
export var euiTourFooterStyles = function euiTourFooterStyles(euiThemeContext) {
|
|
18
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
19
|
+
return {
|
|
20
|
+
// Base
|
|
21
|
+
euiTourFooter: /*#__PURE__*/css("background-color:", _tourFooterBgColor(euiThemeContext), ";", logicalCSS('border-bottom-left-radius', euiTheme.border.radius.medium), " ", logicalCSS('border-bottom-right-radius', euiTheme.border.radius.medium), ";;label:euiTourFooter;")
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React, { memo } from 'react';
|
|
10
|
+
import PropTypes from "prop-types";
|
|
11
|
+
import { useEuiTheme } from '../../services';
|
|
12
|
+
import { EuiPopoverTitle } from '../popover';
|
|
13
|
+
import { EuiTitle } from '../title';
|
|
14
|
+
import { euiTourHeaderStyles } from './_tour_header.styles';
|
|
15
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
16
|
+
export var EuiTourHeader = /*#__PURE__*/memo(function (_ref) {
|
|
17
|
+
var id = _ref.id,
|
|
18
|
+
title = _ref.title,
|
|
19
|
+
subtitle = _ref.subtitle;
|
|
20
|
+
var euiTheme = useEuiTheme();
|
|
21
|
+
var headerStyles = euiTourHeaderStyles(euiTheme);
|
|
22
|
+
return ___EmotionJSX(EuiPopoverTitle, {
|
|
23
|
+
css: headerStyles.euiTourHeader,
|
|
24
|
+
className: "euiTourHeader",
|
|
25
|
+
id: id
|
|
26
|
+
}, subtitle && ___EmotionJSX(EuiTitle, {
|
|
27
|
+
css: headerStyles.euiTourHeader__subtitle,
|
|
28
|
+
size: "xxxs"
|
|
29
|
+
}, ___EmotionJSX("h2", null, subtitle)), ___EmotionJSX(EuiTitle, {
|
|
30
|
+
css: headerStyles.euiTourHeader__title,
|
|
31
|
+
size: "xxs"
|
|
32
|
+
}, subtitle ? ___EmotionJSX("h3", null, title) : ___EmotionJSX("h2", null, title)));
|
|
33
|
+
});
|
|
34
|
+
EuiTourHeader.propTypes = {
|
|
35
|
+
id: PropTypes.string.isRequired
|
|
36
|
+
};
|
|
37
|
+
EuiTourHeader.displayName = '_EuiTourHeader';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { css } from '@emotion/react';
|
|
10
|
+
import { logicalCSS } from '../../global_styling';
|
|
11
|
+
export var euiTourHeaderStyles = function euiTourHeaderStyles(_ref) {
|
|
12
|
+
var euiTheme = _ref.euiTheme;
|
|
13
|
+
return {
|
|
14
|
+
// Base
|
|
15
|
+
euiTourHeader: /*#__PURE__*/css(logicalCSS('border-bottom', 'none'), logicalCSS('margin-bottom', euiTheme.size.s), ";;label:euiTourHeader;"),
|
|
16
|
+
// Elements
|
|
17
|
+
euiTourHeader__title: /*#__PURE__*/css(logicalCSS('margin-top', 0), ";;label:euiTourHeader__title;"),
|
|
18
|
+
euiTourHeader__subtitle: /*#__PURE__*/css("color:", euiTheme.colors.subduedText, ";padding-block-end:", euiTheme.size.xs, ";;label:euiTourHeader__subtitle;")
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -7,23 +7,18 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { css } from '@emotion/react';
|
|
10
|
-
import { shade, tint, COLOR_MODES_STANDARD } from '../../services';
|
|
11
10
|
import { logicalCSS, mathWithUnits, euiCanAnimate } from '../../global_styling';
|
|
12
11
|
import { openAnimationTiming } from '../popover/popover_panel/_popover_panel.styles';
|
|
13
12
|
import { popoverArrowSize } from '../popover/popover_arrow/_popover_arrow.styles';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
export var euiTourStyles = function euiTourStyles(_ref) {
|
|
18
|
-
var euiTheme = _ref.euiTheme,
|
|
19
|
-
colorMode = _ref.colorMode;
|
|
13
|
+
import { _tourFooterBgColor } from './_tour_footer.styles';
|
|
14
|
+
export var euiTourStyles = function euiTourStyles(euiThemeContext) {
|
|
20
15
|
return {
|
|
21
16
|
// Targets EuiPopoverPanel
|
|
22
|
-
euiTour: /*#__PURE__*/css("[data-popover-arrow='top']::before{", logicalCSS('border-top-color',
|
|
17
|
+
euiTour: /*#__PURE__*/css("[data-popover-arrow='top']::before{", logicalCSS('border-top-color', _tourFooterBgColor(euiThemeContext)), ";};label:euiTour;")
|
|
23
18
|
};
|
|
24
19
|
};
|
|
25
|
-
export var euiTourBeaconStyles = function euiTourBeaconStyles(
|
|
26
|
-
var euiTheme =
|
|
20
|
+
export var euiTourBeaconStyles = function euiTourBeaconStyles(_ref) {
|
|
21
|
+
var euiTheme = _ref.euiTheme;
|
|
27
22
|
var arrowSize = euiTheme.size[popoverArrowSize];
|
|
28
23
|
var arrowHalfSize = mathWithUnits(arrowSize, function (x) {
|
|
29
24
|
return x / 2;
|
|
@@ -41,22 +36,4 @@ export var euiTourBeaconStyles = function euiTourBeaconStyles(_ref2) {
|
|
|
41
36
|
top: /*#__PURE__*/css(logicalCSS('top', arrowSize), " ", logicalCSS('left', arrowHalfSize), ";;label:top;"),
|
|
42
37
|
bottom: /*#__PURE__*/css(logicalCSS('top', arrowOffset), " ", logicalCSS('left', arrowHalfSize), ";;label:bottom;")
|
|
43
38
|
};
|
|
44
|
-
};
|
|
45
|
-
export var euiTourHeaderStyles = function euiTourHeaderStyles(_ref3) {
|
|
46
|
-
var euiTheme = _ref3.euiTheme;
|
|
47
|
-
return {
|
|
48
|
-
// Base
|
|
49
|
-
euiTourHeader: /*#__PURE__*/css(logicalCSS('border-bottom', 'none'), logicalCSS('margin-bottom', euiTheme.size.s), ";;label:euiTourHeader;"),
|
|
50
|
-
// Elements
|
|
51
|
-
euiTourHeader__title: /*#__PURE__*/css(logicalCSS('margin-top', 0), ";;label:euiTourHeader__title;"),
|
|
52
|
-
euiTourHeader__subtitle: /*#__PURE__*/css("color:", euiTheme.colors.subduedText, ";padding-block-end:", euiTheme.size.xs, ";;label:euiTourHeader__subtitle;")
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
export var euiTourFooterStyles = function euiTourFooterStyles(_ref4) {
|
|
56
|
-
var euiTheme = _ref4.euiTheme,
|
|
57
|
-
colorMode = _ref4.colorMode;
|
|
58
|
-
return {
|
|
59
|
-
// Base
|
|
60
|
-
euiTourFooter: /*#__PURE__*/css("background-color:", backgroundColor(euiTheme.colors.lightestShade, colorMode), ";", logicalCSS('border-bottom-left-radius', euiTheme.border.radius.medium), " ", logicalCSS('border-bottom-right-radius', euiTheme.border.radius.medium), ";;label:euiTourFooter;")
|
|
61
|
-
};
|
|
62
39
|
};
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["anchorPosition", "anchor", "children", "className", "css", "closePopover", "content", "isStepOpen", "minWidth", "maxWidth", "onFinish", "step", "stepsTotal", "
|
|
2
|
+
var _excluded = ["anchorPosition", "anchor", "children", "className", "css", "closePopover", "content", "isStepOpen", "minWidth", "maxWidth", "onFinish", "step", "stepsTotal", "subtitle", "title", "decoration", "footerAction", "panelProps", "panelClassName"];
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
6
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
7
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
8
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
9
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
12
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
13
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
10
|
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."); }
|
|
15
11
|
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); }
|
|
@@ -26,18 +22,16 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
26
22
|
* Side Public License, v 1.
|
|
27
23
|
*/
|
|
28
24
|
|
|
29
|
-
import React, { useEffect, useState } from 'react';
|
|
25
|
+
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
|
30
26
|
import PropTypes from "prop-types";
|
|
31
27
|
import classNames from 'classnames';
|
|
28
|
+
import { logicalStyles } from '../../global_styling';
|
|
32
29
|
import { EuiBeacon } from '../beacon';
|
|
33
|
-
import {
|
|
34
|
-
import { EuiFlexGroup, EuiFlexItem } from '../flex';
|
|
35
|
-
import { EuiI18n } from '../i18n';
|
|
36
|
-
import { EuiPopover, EuiPopoverFooter, EuiPopoverTitle, EuiWrappingPopover } from '../popover';
|
|
37
|
-
import { EuiTitle } from '../title';
|
|
38
|
-
import { EuiTourStepIndicator } from './tour_step_indicator';
|
|
30
|
+
import { EuiPopover, EuiWrappingPopover } from '../popover';
|
|
39
31
|
import { useGeneratedHtmlId, findElementBySelectorOrRef, useEuiTheme } from '../../services';
|
|
40
|
-
import {
|
|
32
|
+
import { EuiTourHeader } from './_tour_header';
|
|
33
|
+
import { EuiTourFooter } from './_tour_footer';
|
|
34
|
+
import { euiTourStyles, euiTourBeaconStyles } from './tour.styles';
|
|
41
35
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
42
36
|
export var EuiTourStep = function EuiTourStep(_ref) {
|
|
43
37
|
var _ref$anchorPosition = _ref.anchorPosition,
|
|
@@ -59,17 +53,17 @@ export var EuiTourStep = function EuiTourStep(_ref) {
|
|
|
59
53
|
_ref$step = _ref.step,
|
|
60
54
|
step = _ref$step === void 0 ? 1 : _ref$step,
|
|
61
55
|
stepsTotal = _ref.stepsTotal,
|
|
62
|
-
style = _ref.style,
|
|
63
56
|
subtitle = _ref.subtitle,
|
|
64
57
|
title = _ref.title,
|
|
65
58
|
_ref$decoration = _ref.decoration,
|
|
66
59
|
decoration = _ref$decoration === void 0 ? 'beacon' : _ref$decoration,
|
|
67
60
|
footerAction = _ref.footerAction,
|
|
68
61
|
panelProps = _ref.panelProps,
|
|
62
|
+
panelClassName = _ref.panelClassName,
|
|
69
63
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
70
64
|
var titleId = useGeneratedHtmlId();
|
|
71
65
|
if (step === 0) {
|
|
72
|
-
console.warn('EuiTourStep `step` should 1-based indexing. Please update to eliminate 0 indexes.');
|
|
66
|
+
console.warn('EuiTourStep `step` should use 1-based indexing. Please update to eliminate 0 indexes.');
|
|
73
67
|
}
|
|
74
68
|
var _useState = useState(null),
|
|
75
69
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -79,11 +73,10 @@ export var EuiTourStep = function EuiTourStep(_ref) {
|
|
|
79
73
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
80
74
|
popoverPosition = _useState4[0],
|
|
81
75
|
setPopoverPosition = _useState4[1];
|
|
82
|
-
var onPositionChange = function
|
|
76
|
+
var onPositionChange = useCallback(function (position) {
|
|
83
77
|
setPopoverPosition(position);
|
|
84
|
-
};
|
|
78
|
+
}, []);
|
|
85
79
|
useEffect(function () {
|
|
86
|
-
var timeout;
|
|
87
80
|
if (anchor) {
|
|
88
81
|
// Wait until next tick to find anchor node in case it's not already
|
|
89
82
|
// in DOM requestAnimationFrame isn't used here because we don't need to
|
|
@@ -91,126 +84,62 @@ export var EuiTourStep = function EuiTourStep(_ref) {
|
|
|
91
84
|
// needs to go through a react DOM rerender which may take more than
|
|
92
85
|
// 1 frame (16ms) of time.
|
|
93
86
|
// TODO: It would be ideal to have some kind of intersection observer here instead
|
|
94
|
-
timeout = window.setTimeout(function () {
|
|
87
|
+
var timeout = window.setTimeout(function () {
|
|
95
88
|
setAnchorNode(findElementBySelectorOrRef(anchor));
|
|
96
89
|
});
|
|
90
|
+
return function () {
|
|
91
|
+
return window.clearTimeout(timeout);
|
|
92
|
+
};
|
|
97
93
|
}
|
|
98
|
-
return function () {
|
|
99
|
-
timeout && window.clearTimeout(timeout);
|
|
100
|
-
};
|
|
101
94
|
}, [anchor]);
|
|
102
|
-
var
|
|
95
|
+
var anchorClasses = classNames('euiTourAnchor', className);
|
|
96
|
+
var popoverClasses = classNames('euiTour', panelClassName);
|
|
103
97
|
var euiTheme = useEuiTheme();
|
|
104
98
|
var tourStyles = euiTourStyles(euiTheme);
|
|
105
|
-
var headerStyles = euiTourHeaderStyles(euiTheme);
|
|
106
|
-
var footerStyles = euiTourFooterStyles(euiTheme);
|
|
107
99
|
var beaconStyles = euiTourBeaconStyles(euiTheme);
|
|
108
100
|
var beaconCss = [beaconStyles.euiTourBeacon, isStepOpen && beaconStyles.isOpen, popoverPosition && beaconStyles[popoverPosition]];
|
|
109
|
-
var finishButtonProps = {
|
|
110
|
-
color: 'text',
|
|
111
|
-
flush: 'right',
|
|
112
|
-
size: 'xs'
|
|
113
|
-
};
|
|
114
|
-
var optionalFooterAction = Array.isArray(footerAction) ? ___EmotionJSX(EuiFlexGroup, {
|
|
115
|
-
gutterSize: "s",
|
|
116
|
-
alignItems: "center",
|
|
117
|
-
justifyContent: "flexEnd",
|
|
118
|
-
responsive: false,
|
|
119
|
-
wrap: true
|
|
120
|
-
}, footerAction.map(function (action, index) {
|
|
121
|
-
return ___EmotionJSX(EuiFlexItem, {
|
|
122
|
-
key: index,
|
|
123
|
-
grow: false
|
|
124
|
-
}, action);
|
|
125
|
-
})) : ___EmotionJSX(EuiFlexItem, {
|
|
126
|
-
grow: false
|
|
127
|
-
}, footerAction);
|
|
128
|
-
var footer = ___EmotionJSX(EuiFlexGroup, {
|
|
129
|
-
responsive: false,
|
|
130
|
-
justifyContent: stepsTotal > 1 ? 'spaceBetween' : 'flexEnd',
|
|
131
|
-
alignItems: "center"
|
|
132
|
-
}, stepsTotal > 1 && ___EmotionJSX(EuiFlexItem, {
|
|
133
|
-
grow: false
|
|
134
|
-
}, ___EmotionJSX("ul", {
|
|
135
|
-
className: "euiTourFooter__stepList"
|
|
136
|
-
}, _toConsumableArray(Array(stepsTotal).keys()).map(function (_, i) {
|
|
137
|
-
var status = 'complete';
|
|
138
|
-
if (step === i + 1) {
|
|
139
|
-
status = 'active';
|
|
140
|
-
} else if (step <= i) {
|
|
141
|
-
status = 'incomplete';
|
|
142
|
-
}
|
|
143
|
-
return ___EmotionJSX(EuiTourStepIndicator, {
|
|
144
|
-
key: i,
|
|
145
|
-
number: i + 1,
|
|
146
|
-
status: status
|
|
147
|
-
});
|
|
148
|
-
}))), footerAction ? optionalFooterAction : ___EmotionJSX(EuiFlexItem, {
|
|
149
|
-
grow: false
|
|
150
|
-
}, ___EmotionJSX(EuiI18n, {
|
|
151
|
-
tokens: ['euiTourStep.endTour', 'euiTourStep.skipTour', 'euiTourStep.closeTour'],
|
|
152
|
-
defaults: ['End tour', 'Skip tour', 'Close tour']
|
|
153
|
-
}, function (_ref2) {
|
|
154
|
-
var _ref3 = _slicedToArray(_ref2, 3),
|
|
155
|
-
endTour = _ref3[0],
|
|
156
|
-
skipTour = _ref3[1],
|
|
157
|
-
closeTour = _ref3[2];
|
|
158
|
-
var content = closeTour;
|
|
159
|
-
if (stepsTotal > 1) {
|
|
160
|
-
content = stepsTotal === step ? endTour : skipTour;
|
|
161
|
-
}
|
|
162
|
-
return ___EmotionJSX(EuiButtonEmpty, _extends({
|
|
163
|
-
onClick: onFinish
|
|
164
|
-
}, finishButtonProps), content);
|
|
165
|
-
})));
|
|
166
101
|
var hasBeacon = decoration === 'beacon';
|
|
167
|
-
var
|
|
102
|
+
var widthStyles = useMemo(function () {
|
|
103
|
+
return logicalStyles({
|
|
104
|
+
minWidth: minWidth,
|
|
105
|
+
maxWidth: maxWidth
|
|
106
|
+
});
|
|
107
|
+
}, [minWidth, maxWidth]);
|
|
108
|
+
var noAnchor = !anchor && children;
|
|
109
|
+
var PopoverComponent = noAnchor ? EuiPopover : EuiWrappingPopover;
|
|
110
|
+
var button = noAnchor ? children : anchorNode;
|
|
111
|
+
return button ? ___EmotionJSX(PopoverComponent, _extends({
|
|
112
|
+
button: button,
|
|
113
|
+
className: anchorClasses,
|
|
168
114
|
anchorPosition: anchorPosition,
|
|
169
115
|
closePopover: closePopover,
|
|
170
116
|
isOpen: isStepOpen,
|
|
171
117
|
ownFocus: false,
|
|
172
|
-
panelClassName:
|
|
173
|
-
panelStyle: style,
|
|
118
|
+
panelClassName: popoverClasses,
|
|
174
119
|
panelProps: _objectSpread(_objectSpread({}, panelProps), {}, {
|
|
175
120
|
css: [tourStyles.euiTour, css, panelProps === null || panelProps === void 0 ? void 0 : panelProps.css]
|
|
176
121
|
}),
|
|
177
122
|
offset: hasBeacon ? 10 : 0,
|
|
178
|
-
|
|
123
|
+
"aria-labelledby": titleId,
|
|
179
124
|
arrowChildren: hasBeacon && ___EmotionJSX(EuiBeacon, {
|
|
180
125
|
css: beaconCss,
|
|
181
126
|
className: "euiTour__beacon"
|
|
182
127
|
}),
|
|
183
128
|
onPositionChange: onPositionChange
|
|
184
|
-
}, rest)
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}, ___EmotionJSX(
|
|
191
|
-
css: headerStyles.euiTourHeader,
|
|
192
|
-
className: "euiTourHeader",
|
|
193
|
-
id: titleId
|
|
194
|
-
}, subtitle && ___EmotionJSX(EuiTitle, {
|
|
195
|
-
css: headerStyles.euiTourHeader__subtitle,
|
|
196
|
-
size: "xxxs"
|
|
197
|
-
}, ___EmotionJSX("h2", null, subtitle)), ___EmotionJSX(EuiTitle, {
|
|
198
|
-
css: headerStyles.euiTourHeader__title,
|
|
199
|
-
size: "xxs"
|
|
200
|
-
}, subtitle ? ___EmotionJSX("h3", null, title) : ___EmotionJSX("h2", null, title))), ___EmotionJSX("div", {
|
|
129
|
+
}, rest), ___EmotionJSX("div", {
|
|
130
|
+
style: widthStyles
|
|
131
|
+
}, ___EmotionJSX(EuiTourHeader, {
|
|
132
|
+
id: titleId,
|
|
133
|
+
title: title,
|
|
134
|
+
subtitle: subtitle
|
|
135
|
+
}), ___EmotionJSX("div", {
|
|
201
136
|
className: "euiTour__content"
|
|
202
|
-
}, content), ___EmotionJSX(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
button: children
|
|
209
|
-
}, popoverProps), layout);
|
|
210
|
-
}
|
|
211
|
-
return anchorNode ? ___EmotionJSX(EuiWrappingPopover, _extends({
|
|
212
|
-
button: anchorNode
|
|
213
|
-
}, popoverProps), layout) : null;
|
|
137
|
+
}, content), ___EmotionJSX(EuiTourFooter, {
|
|
138
|
+
footerAction: footerAction,
|
|
139
|
+
step: step,
|
|
140
|
+
stepsTotal: stepsTotal,
|
|
141
|
+
onFinish: onFinish
|
|
142
|
+
}))) : null;
|
|
214
143
|
};
|
|
215
144
|
EuiTourStep.propTypes = {
|
|
216
145
|
className: PropTypes.string,
|
|
@@ -220,12 +149,6 @@ EuiTourStep.propTypes = {
|
|
|
220
149
|
"aria-label": PropTypes.string,
|
|
221
150
|
"data-test-subj": PropTypes.string,
|
|
222
151
|
css: PropTypes.any,
|
|
223
|
-
/**
|
|
224
|
-
* Class name passed to the direct parent of the button
|
|
225
|
-
*
|
|
226
|
-
* @deprecated Use `className` instead
|
|
227
|
-
*/
|
|
228
|
-
anchorClassName: PropTypes.string,
|
|
229
152
|
/**
|
|
230
153
|
* Alignment of the popover and arrow relative to the button
|
|
231
154
|
*/
|
|
@@ -235,10 +158,6 @@ EuiTourStep.propTypes = {
|
|
|
235
158
|
* Intended for use with inputs as anchors, e.g. EuiInputPopover
|
|
236
159
|
*/
|
|
237
160
|
attachToAnchor: PropTypes.bool,
|
|
238
|
-
/**
|
|
239
|
-
* @deprecated Use `popoverRef` instead
|
|
240
|
-
*/
|
|
241
|
-
buttonRef: PropTypes.any,
|
|
242
161
|
/**
|
|
243
162
|
* Restrict the popover's position within this element
|
|
244
163
|
*/
|
|
@@ -405,10 +324,6 @@ EuiTourStep.propTypes = {
|
|
|
405
324
|
* The total number of steps in the tour
|
|
406
325
|
*/
|
|
407
326
|
stepsTotal: PropTypes.number.isRequired,
|
|
408
|
-
/**
|
|
409
|
-
* Optional, standard DOM `style` attribute. Passed to the EuiPopover panel.
|
|
410
|
-
*/
|
|
411
|
-
style: PropTypes.any,
|
|
412
327
|
/**
|
|
413
328
|
* Smaller title text that appears atop each step in the tour. The subtitle gets wrapped in the appropriate heading level.
|
|
414
329
|
*/
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { useMemo } from 'react';
|
|
9
10
|
import { css } from '@emotion/react';
|
|
10
|
-
import { shade, tint, transparentize, useEuiTheme } from '../../services';
|
|
11
|
+
import { shade, tint, tintOrShade, transparentize, useEuiTheme } from '../../services';
|
|
11
12
|
export var BACKGROUND_COLORS = ['transparent', 'plain', 'subdued', 'accent', 'primary', 'success', 'warning', 'danger'];
|
|
12
13
|
export var euiBackgroundColor = function euiBackgroundColor(_ref, color) {
|
|
13
14
|
var euiTheme = _ref.euiTheme,
|
|
@@ -24,7 +25,7 @@ export var euiBackgroundColor = function euiBackgroundColor(_ref, color) {
|
|
|
24
25
|
return transparentize(euiTheme.colors[color], 0.1);
|
|
25
26
|
}
|
|
26
27
|
} else {
|
|
27
|
-
var
|
|
28
|
+
var _tintOrShade = function _tintOrShade(color) {
|
|
28
29
|
return colorMode === 'DARK' ? shade(color, 0.8) : tint(color, 0.9);
|
|
29
30
|
};
|
|
30
31
|
switch (color) {
|
|
@@ -33,7 +34,7 @@ export var euiBackgroundColor = function euiBackgroundColor(_ref, color) {
|
|
|
33
34
|
case 'subdued':
|
|
34
35
|
return euiTheme.colors.body;
|
|
35
36
|
default:
|
|
36
|
-
return
|
|
37
|
+
return _tintOrShade(euiTheme.colors[color]);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
};
|
|
@@ -46,14 +47,46 @@ export var useEuiBackgroundColor = function useEuiBackgroundColor(color) {
|
|
|
46
47
|
});
|
|
47
48
|
};
|
|
48
49
|
export var useEuiBackgroundColorCSS = function useEuiBackgroundColorCSS() {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
var euiThemeContext = useEuiTheme();
|
|
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]);
|
|
63
|
+
};
|
|
64
|
+
export var euiBorderColor = function euiBorderColor(_ref4, color) {
|
|
65
|
+
var euiTheme = _ref4.euiTheme,
|
|
66
|
+
colorMode = _ref4.colorMode;
|
|
67
|
+
switch (color) {
|
|
68
|
+
case 'transparent':
|
|
69
|
+
case 'plain':
|
|
70
|
+
case 'subdued':
|
|
71
|
+
return euiTheme.border.color;
|
|
72
|
+
case 'warning':
|
|
73
|
+
return tintOrShade(euiTheme.colors.warning, 0.4, colorMode);
|
|
74
|
+
default:
|
|
75
|
+
return tintOrShade(euiTheme.colors[color], 0.6, colorMode);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
export var useEuiBorderColorCSS = function useEuiBorderColorCSS() {
|
|
79
|
+
var euiThemeContext = useEuiTheme();
|
|
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]);
|
|
59
92
|
};
|