@elastic/eui 85.0.0 → 85.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui_charts_theme.js +13 -16
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +47 -90
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +47 -90
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +26 -0
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +16 -0
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +202 -0
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +33 -0
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +296 -0
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +58 -0
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +93 -0
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.styles.js +28 -0
- package/es/components/collapsible_nav_beta/collapsible_nav_item/index.js +9 -0
- package/es/components/collapsible_nav_beta/index.js +15 -0
- package/es/components/color_picker/saturation.js +2 -1
- package/es/components/combo_box/combo_box_input/combo_box_input.js +7 -1
- package/es/components/combo_box/combo_box_input/combo_box_pill.js +16 -4
- package/es/components/combo_box/combo_box_options_list/combo_box_option.js +4 -0
- package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +21 -3
- package/es/components/error_boundary/error_boundary.js +1 -1
- package/es/components/filter_group/filter_group.styles.js +2 -2
- package/es/components/filter_group/filter_select_item.js +31 -15
- package/es/components/filter_group/filter_select_item.styles.js +19 -0
- package/es/components/form/range/range_highlight.js +1 -0
- package/es/components/highlight/highlight.js +4 -4
- package/es/components/index.js +1 -0
- package/es/components/inline_edit/inline_edit_form.js +2 -1
- package/es/components/markdown_editor/markdown_editor.js +2 -2
- package/es/themes/amsterdam/global_styling/variables/_states.js +13 -16
- package/eui.d.ts +362 -129
- package/i18ntokens.json +50 -50
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +30 -0
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +23 -0
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +211 -0
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +40 -0
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +304 -0
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +63 -0
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +100 -0
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.styles.js +35 -0
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/index.js +12 -0
- package/lib/components/collapsible_nav_beta/index.js +19 -0
- package/lib/components/color_picker/saturation.js +2 -1
- package/lib/components/combo_box/combo_box_input/combo_box_input.js +7 -1
- package/lib/components/combo_box/combo_box_input/combo_box_pill.js +16 -4
- package/lib/components/combo_box/combo_box_options_list/combo_box_option.js +4 -0
- package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +21 -3
- package/lib/components/error_boundary/error_boundary.js +1 -1
- package/lib/components/filter_group/filter_group.styles.js +1 -1
- package/lib/components/filter_group/filter_select_item.js +33 -17
- package/lib/components/filter_group/filter_select_item.styles.js +26 -0
- package/lib/components/form/range/range_highlight.js +1 -0
- package/lib/components/highlight/highlight.js +4 -4
- package/lib/components/index.js +11 -0
- package/lib/components/inline_edit/inline_edit_form.js +2 -1
- package/lib/components/markdown_editor/markdown_editor.js +2 -2
- package/lib/themes/amsterdam/global_styling/variables/_states.js +13 -16
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +26 -0
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +16 -0
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +113 -0
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +33 -0
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +117 -0
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +55 -0
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +59 -0
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.styles.js +28 -0
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/index.js +9 -0
- package/optimize/es/components/collapsible_nav_beta/index.js +15 -0
- package/optimize/es/components/color_picker/saturation.js +2 -1
- package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +3 -1
- package/optimize/es/components/combo_box/combo_box_input/combo_box_pill.js +12 -4
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +9 -3
- package/optimize/es/components/error_boundary/error_boundary.js +1 -1
- package/optimize/es/components/filter_group/filter_group.styles.js +2 -2
- package/optimize/es/components/filter_group/filter_select_item.js +30 -14
- package/optimize/es/components/filter_group/filter_select_item.styles.js +19 -0
- package/optimize/es/components/form/range/range_highlight.js +1 -0
- package/optimize/es/components/highlight/highlight.js +4 -4
- package/optimize/es/components/index.js +1 -0
- package/optimize/es/components/inline_edit/inline_edit_form.js +2 -1
- package/optimize/es/components/markdown_editor/markdown_editor.js +2 -2
- package/optimize/es/themes/amsterdam/global_styling/variables/_states.js +13 -16
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +33 -0
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +23 -0
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +123 -0
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +40 -0
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +124 -0
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +61 -0
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +66 -0
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.styles.js +35 -0
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/index.js +12 -0
- package/optimize/lib/components/collapsible_nav_beta/index.js +19 -0
- package/optimize/lib/components/color_picker/saturation.js +2 -1
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +3 -1
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_pill.js +12 -4
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +9 -3
- package/optimize/lib/components/error_boundary/error_boundary.js +1 -1
- package/optimize/lib/components/filter_group/filter_group.styles.js +1 -1
- package/optimize/lib/components/filter_group/filter_select_item.js +32 -16
- package/optimize/lib/components/filter_group/filter_select_item.styles.js +26 -0
- package/optimize/lib/components/form/range/range_highlight.js +1 -0
- package/optimize/lib/components/highlight/highlight.js +4 -4
- package/optimize/lib/components/index.js +11 -0
- package/optimize/lib/components/inline_edit/inline_edit_form.js +2 -1
- package/optimize/lib/components/markdown_editor/markdown_editor.js +2 -2
- package/optimize/lib/themes/amsterdam/global_styling/variables/_states.js +13 -16
- package/package.json +1 -1
- package/src/components/combo_box/combo_box_input/_combo_box_pill.scss +24 -3
- package/src/components/combo_box/combo_box_options_list/_combo_box_option.scss +34 -14
- package/src/components/index.scss +0 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +33 -0
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +23 -0
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +208 -0
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.styles.js +40 -0
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +303 -0
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.styles.js +61 -0
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js +96 -0
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.styles.js +35 -0
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/index.js +12 -0
- package/test-env/components/collapsible_nav_beta/index.js +19 -0
- package/test-env/components/color_picker/saturation.js +2 -1
- package/test-env/components/combo_box/combo_box_input/combo_box_input.js +7 -1
- package/test-env/components/combo_box/combo_box_input/combo_box_pill.js +16 -4
- package/test-env/components/combo_box/combo_box_options_list/combo_box_option.js +4 -0
- package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +21 -3
- package/test-env/components/error_boundary/error_boundary.js +1 -1
- package/test-env/components/filter_group/filter_group.styles.js +1 -1
- package/test-env/components/filter_group/filter_select_item.js +33 -17
- package/test-env/components/filter_group/filter_select_item.styles.js +26 -0
- package/test-env/components/form/range/range_highlight.js +1 -0
- package/test-env/components/highlight/highlight.js +4 -4
- package/test-env/components/index.js +11 -0
- package/test-env/components/inline_edit/inline_edit_form.js +2 -1
- package/test-env/components/markdown_editor/markdown_editor.js +2 -2
- package/test-env/themes/amsterdam/global_styling/variables/_states.js +13 -16
- package/src/components/filter_group/_filter_select_item.scss +0 -43
- package/src/components/filter_group/_index.scss +0 -1
|
@@ -20,6 +20,7 @@ export * from './call_out';
|
|
|
20
20
|
export * from './card';
|
|
21
21
|
export * from './code';
|
|
22
22
|
export * from './collapsible_nav';
|
|
23
|
+
export * from './collapsible_nav_beta';
|
|
23
24
|
export * from './color_picker';
|
|
24
25
|
export * from './combo_box';
|
|
25
26
|
export * from './comment_list';
|
|
@@ -258,7 +258,8 @@ export var EuiInlineEditForm = function EuiInlineEditForm(_ref) {
|
|
|
258
258
|
size: sizes.buttonSize,
|
|
259
259
|
"data-test-subj": "euiInlineReadModeButton",
|
|
260
260
|
disabled: isReadOnly,
|
|
261
|
-
css: readModeCssStyles
|
|
261
|
+
css: readModeCssStyles,
|
|
262
|
+
title: readModeValue || placeholder
|
|
262
263
|
}, readModeProps, {
|
|
263
264
|
buttonRef: setReadModeRefs,
|
|
264
265
|
"aria-describedby": classNames(readModeDescribedById, readModeProps === null || readModeProps === void 0 ? void 0 : readModeProps['aria-describedby']),
|
|
@@ -150,8 +150,8 @@ export var EuiMarkdownEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
150
150
|
var isPreviewing = viewMode === MODE_VIEWING;
|
|
151
151
|
var isEditing = viewMode === MODE_EDITING;
|
|
152
152
|
var replaceNode = useCallback(function (position, next) {
|
|
153
|
-
var leading = value.
|
|
154
|
-
var trailing = value.
|
|
153
|
+
var leading = value.substring(0, position.start.offset);
|
|
154
|
+
var trailing = value.substring(position.end.offset);
|
|
155
155
|
_onChange("".concat(leading).concat(next).concat(trailing));
|
|
156
156
|
}, [value, _onChange]);
|
|
157
157
|
var contextValue = useMemo(function () {
|
|
@@ -6,24 +6,21 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* NOTE: These were quick conversions of their Sass counterparts.
|
|
11
|
-
* The commented out keys have not been established as necessary yet.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
9
|
import { computed } from '../../../../services/theme/utils';
|
|
10
|
+
import { transparentize } from '../../../../services/color/manipulation';
|
|
15
11
|
import { sizeToPixel } from '../../../../global_styling/functions/size';
|
|
16
12
|
export var focus = {
|
|
13
|
+
// Focus ring
|
|
17
14
|
color: 'currentColor',
|
|
18
|
-
width: computed(sizeToPixel(0.125))
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
width: computed(sizeToPixel(0.125)),
|
|
16
|
+
// Focus background
|
|
17
|
+
transparency: {
|
|
18
|
+
LIGHT: 0.1,
|
|
19
|
+
DARK: 0.2
|
|
20
|
+
},
|
|
21
|
+
backgroundColor: computed(function (_ref) {
|
|
22
|
+
var colors = _ref.colors,
|
|
23
|
+
focus = _ref.focus;
|
|
24
|
+
return transparentize(colors.primary, focus.transparency);
|
|
25
|
+
})
|
|
29
26
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.EuiCollapsibleNavBeta = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _services = require("../../services");
|
|
11
|
+
var _collapsible_nav = require("../collapsible_nav/collapsible_nav");
|
|
12
|
+
var _collapsible_nav_beta = require("./collapsible_nav_beta.styles");
|
|
13
|
+
var _react2 = require("@emotion/react");
|
|
14
|
+
/*
|
|
15
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
16
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
17
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
18
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
19
|
+
* Side Public License, v 1.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* TODO: Actual component in a follow-up PR
|
|
24
|
+
*/
|
|
25
|
+
var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(props) {
|
|
26
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
27
|
+
var styles = (0, _collapsible_nav_beta.euiCollapsibleNavBetaStyles)(euiTheme);
|
|
28
|
+
return (0, _react2.jsx)(_collapsible_nav.EuiCollapsibleNav, (0, _extends2.default)({
|
|
29
|
+
css: styles.euiCollapsibleNavBeta,
|
|
30
|
+
size: 248
|
|
31
|
+
}, props));
|
|
32
|
+
};
|
|
33
|
+
exports.EuiCollapsibleNavBeta = EuiCollapsibleNavBeta;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiCollapsibleNavBetaStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _global_styling = require("../../global_styling");
|
|
9
|
+
/*
|
|
10
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
11
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
12
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
13
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
14
|
+
* Side Public License, v 1.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var euiCollapsibleNavBetaStyles = function euiCollapsibleNavBetaStyles(euiThemeContext) {
|
|
18
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
19
|
+
return {
|
|
20
|
+
euiCollapsibleNavBeta: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-top', euiTheme.border.thin), " ", (0, _global_styling.logicalCSS)('border-right', euiTheme.border.thin), " .euiFlyoutFooter{background-color:", euiTheme.colors.emptyShade, ";", (0, _global_styling.logicalCSS)('border-top', euiTheme.border.thin), ";};label:euiCollapsibleNavBeta;")
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
exports.euiCollapsibleNavBetaStyles = euiCollapsibleNavBetaStyles;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.EuiCollapsibleNavAccordion = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
+
var _services = require("../../../services");
|
|
15
|
+
var _accordion = require("../../accordion");
|
|
16
|
+
var _collapsible_nav_item = require("./collapsible_nav_item");
|
|
17
|
+
var _collapsible_nav_link = require("./collapsible_nav_link");
|
|
18
|
+
var _collapsible_nav_accordion = require("./collapsible_nav_accordion.styles");
|
|
19
|
+
var _react2 = require("@emotion/react");
|
|
20
|
+
var _excluded = ["id", "className", "items", "href", "isSubItem", "isSelected", "linkProps", "accordionProps", "buttonContent", "children"];
|
|
21
|
+
/*
|
|
22
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
23
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
24
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
25
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
26
|
+
* Side Public License, v 1.
|
|
27
|
+
*/
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
|
+
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; }
|
|
31
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
32
|
+
/**
|
|
33
|
+
* Internal nav accordion component.
|
|
34
|
+
*
|
|
35
|
+
* Renders children as either a nav link or any number/nesting of more nav accordions.
|
|
36
|
+
* Triggering the open/closed state is handled only by the accordion `arrow` for
|
|
37
|
+
* UX consistency, as accordion/nav titles can be their own links to pages.
|
|
38
|
+
*/
|
|
39
|
+
var EuiCollapsibleNavAccordion = function EuiCollapsibleNavAccordion(_ref) {
|
|
40
|
+
var _accordionProps$arrow;
|
|
41
|
+
var id = _ref.id,
|
|
42
|
+
className = _ref.className,
|
|
43
|
+
items = _ref.items,
|
|
44
|
+
href = _ref.href,
|
|
45
|
+
isSubItem = _ref.isSubItem,
|
|
46
|
+
isSelected = _ref.isSelected,
|
|
47
|
+
linkProps = _ref.linkProps,
|
|
48
|
+
accordionProps = _ref.accordionProps,
|
|
49
|
+
buttonContent = _ref.buttonContent,
|
|
50
|
+
_children = _ref.children,
|
|
51
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
52
|
+
var classes = (0, _classnames.default)('euiCollapsibleNavAccordion', className);
|
|
53
|
+
var groupID = (0, _services.useGeneratedHtmlId)({
|
|
54
|
+
conditionalId: id
|
|
55
|
+
});
|
|
56
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
57
|
+
var styles = (0, _collapsible_nav_accordion.euiCollapsibleNavAccordionStyles)(euiTheme);
|
|
58
|
+
var cssStyles = [styles.euiCollapsibleNavAccordion, isSubItem ? styles.isSubItem : styles.isTopItem, isSelected && styles.isSelected, accordionProps === null || accordionProps === void 0 ? void 0 : accordionProps.css];
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Title / accordion trigger
|
|
62
|
+
*/
|
|
63
|
+
var isTitleInteractive = !!(href || linkProps !== null && linkProps !== void 0 && linkProps.onClick);
|
|
64
|
+
|
|
65
|
+
// Stop propagation on the title so that the accordion toggle doesn't occur on click
|
|
66
|
+
// (should only occur on accordion arrow click for UX consistency)
|
|
67
|
+
var stopPropagationClick = (0, _react.useCallback)(function (e) {
|
|
68
|
+
var _linkProps$onClick;
|
|
69
|
+
e.stopPropagation();
|
|
70
|
+
linkProps === null || linkProps === void 0 ? void 0 : (_linkProps$onClick = linkProps.onClick) === null || _linkProps$onClick === void 0 ? void 0 : _linkProps$onClick.call(linkProps, e);
|
|
71
|
+
}, [linkProps === null || linkProps === void 0 ? void 0 : linkProps.onClick] // eslint-disable-line react-hooks/exhaustive-deps
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Child items
|
|
76
|
+
*/
|
|
77
|
+
// If any of the sub items have an icon, default to an
|
|
78
|
+
// icon of `empty` so that all text lines up vertically
|
|
79
|
+
var itemsHaveIcons = (0, _react.useMemo)(function () {
|
|
80
|
+
return items.some(function (item) {
|
|
81
|
+
return !!item.icon;
|
|
82
|
+
});
|
|
83
|
+
}, [items]);
|
|
84
|
+
var icon = itemsHaveIcons ? 'empty' : undefined;
|
|
85
|
+
var childrenCssStyles = [styles.children.euiCollapsibleNavAccordion__children, isSubItem ? styles.children.isSubItem : styles.children.isTopItem];
|
|
86
|
+
var children = (0, _react2.jsx)("div", {
|
|
87
|
+
css: childrenCssStyles,
|
|
88
|
+
className: "euiCollapsibleNavAccordion__children"
|
|
89
|
+
}, items.map(function (item, index) {
|
|
90
|
+
return (
|
|
91
|
+
// This is an intentional circular dependency between the accordion & parent item display.
|
|
92
|
+
// EuiSideNavItem is purposely recursive to support any amount of nested sub items,
|
|
93
|
+
// and split up into separate files/components for better dev readability
|
|
94
|
+
(0, _react2.jsx)(_collapsible_nav_item.EuiCollapsibleNavSubItem, (0, _extends2.default)({
|
|
95
|
+
key: index,
|
|
96
|
+
icon: icon
|
|
97
|
+
}, item))
|
|
98
|
+
);
|
|
99
|
+
}));
|
|
100
|
+
return (0, _react2.jsx)(_accordion.EuiAccordion, (0, _extends2.default)({
|
|
101
|
+
id: groupID,
|
|
102
|
+
className: classes,
|
|
103
|
+
initialIsOpen: isSelected,
|
|
104
|
+
buttonElement: "div",
|
|
105
|
+
buttonContent: (0, _react2.jsx)(_collapsible_nav_link.EuiCollapsibleNavLink, (0, _extends2.default)({
|
|
106
|
+
href: href
|
|
107
|
+
}, linkProps, {
|
|
108
|
+
isSelected: isSelected,
|
|
109
|
+
isSubItem: isSubItem,
|
|
110
|
+
onClick: stopPropagationClick,
|
|
111
|
+
isInteractive: isTitleInteractive
|
|
112
|
+
}), buttonContent),
|
|
113
|
+
arrowDisplay: "right"
|
|
114
|
+
}, rest, accordionProps, {
|
|
115
|
+
css: cssStyles,
|
|
116
|
+
arrowProps: _objectSpread(_objectSpread({
|
|
117
|
+
iconSize: 's'
|
|
118
|
+
}, accordionProps === null || accordionProps === void 0 ? void 0 : accordionProps.arrowProps), {}, {
|
|
119
|
+
css: [styles.euiCollapsibleNavAccordion__arrow, accordionProps === null || accordionProps === void 0 ? void 0 : (_accordionProps$arrow = accordionProps.arrowProps) === null || _accordionProps$arrow === void 0 ? void 0 : _accordionProps$arrow.css]
|
|
120
|
+
})
|
|
121
|
+
}), children);
|
|
122
|
+
};
|
|
123
|
+
exports.EuiCollapsibleNavAccordion = EuiCollapsibleNavAccordion;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiCollapsibleNavAccordionStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _global_styling = require("../../../global_styling");
|
|
9
|
+
var _collapsible_nav_item = require("./collapsible_nav_item.styles");
|
|
10
|
+
/*
|
|
11
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
13
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
14
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
|
+
* Side Public License, v 1.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
var euiCollapsibleNavAccordionStyles = function euiCollapsibleNavAccordionStyles(euiThemeContext) {
|
|
19
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
20
|
+
var sharedStyles = (0, _collapsible_nav_item.euiCollapsibleNavItemVariables)(euiThemeContext);
|
|
21
|
+
return {
|
|
22
|
+
// NOTE: Specific usage of `>`s selectors are important here, because accordions can be nested
|
|
23
|
+
// - just because a parent accordion is open or selected does not mean its child accordion is the same
|
|
24
|
+
euiCollapsibleNavAccordion: /*#__PURE__*/(0, _react.css)(".euiAccordion__button{overflow:hidden;&:hover,&:focus{cursor:default;text-decoration:none;}}.euiAccordion__triggerWrapper{border-radius:", sharedStyles.borderRadius, ";", _global_styling.euiCanAnimate, "{transition:background-color ", sharedStyles.animation, ";}}.euiAccordion__buttonContent{", (0, _global_styling.logicalCSS)('max-width', '100%'), " flex-basis:100%;display:flex;align-items:center;}.euiCollapsibleNavLink{", (0, _global_styling.logicalCSS)('width', '100%'), ";};label:euiCollapsibleNavAccordion;"),
|
|
25
|
+
isTopItem: /*#__PURE__*/(0, _react.css)("margin:", sharedStyles.padding, ";&>.euiAccordion__triggerWrapper{&:hover{background-color:", sharedStyles.backgroundHoverColor, ";}};label:isTopItem;"),
|
|
26
|
+
isSelected: /*#__PURE__*/(0, _react.css)("&>.euiAccordion__triggerWrapper{background-color:", sharedStyles.backgroundSelectedColor, ";&:hover{background-color:", sharedStyles.backgroundSelectedColor, ";}};label:isSelected;"),
|
|
27
|
+
isSubItem: /*#__PURE__*/(0, _react.css)("&.euiAccordion-isOpen{", (0, _global_styling.logicalCSS)('margin-bottom', euiTheme.size.m), ";};label:isSubItem;"),
|
|
28
|
+
// Arrow element
|
|
29
|
+
euiCollapsibleNavAccordion__arrow: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-right', euiTheme.size.xs), _global_styling.euiCanAnimate, "{transition:background-color ", sharedStyles.animation, ";}&:hover,&:focus-visible{background-color:", euiTheme.colors.lightShade, ";&>.euiIcon{color:", sharedStyles.color, ";}}transform:none!important;&>.euiIcon{color:", sharedStyles.rightIconColor, ";transform:rotate(-90deg);", _global_styling.euiCanAnimate, "{transition:transform ", sharedStyles.animation, ",color ", sharedStyles.animation, ";}}&.euiAccordion__iconButton-isOpen>.euiIcon{color:", sharedStyles.color, ";transform:rotate(90deg);};label:euiCollapsibleNavAccordion__arrow;"),
|
|
30
|
+
// Children wrapper
|
|
31
|
+
children: {
|
|
32
|
+
euiCollapsibleNavAccordion__children: /*#__PURE__*/(0, _react.css)(";label:euiCollapsibleNavAccordion__children;"),
|
|
33
|
+
isTopItem: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-top', euiTheme.size.xs), " ", (0, _global_styling.logicalCSS)('padding-left', euiTheme.size.xl), ";;label:isTopItem;"),
|
|
34
|
+
isSubItem: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-left', euiTheme.border.thin), " ", (0, _global_styling.logicalCSS)('margin-left', euiTheme.size.s), " ", (0, _global_styling.logicalCSS)('padding-left', (0, _global_styling.mathWithUnits)([euiTheme.size.s, euiTheme.border.width.thin], function (x, y) {
|
|
35
|
+
return x - y;
|
|
36
|
+
})), ";;label:isSubItem;")
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
exports.euiCollapsibleNavAccordionStyles = euiCollapsibleNavAccordionStyles;
|
package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.EuiCollapsibleNavSubItem = exports.EuiCollapsibleNavItem = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _services = require("../../../services");
|
|
13
|
+
var _icon = require("../../icon");
|
|
14
|
+
var _title = require("../../title");
|
|
15
|
+
var _collapsible_nav_accordion = require("./collapsible_nav_accordion");
|
|
16
|
+
var _collapsible_nav_link = require("./collapsible_nav_link");
|
|
17
|
+
var _collapsible_nav_item = require("./collapsible_nav_item.styles");
|
|
18
|
+
var _react2 = require("@emotion/react");
|
|
19
|
+
var _excluded = ["isSubItem", "title", "titleElement", "icon", "iconProps", "className", "items", "children"],
|
|
20
|
+
_excluded2 = ["isGroupTitle", "className"];
|
|
21
|
+
/*
|
|
22
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
23
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
24
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
25
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
26
|
+
* Side Public License, v 1.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Internal DRY subcomponent shared between top level items and sub items
|
|
30
|
+
* that handles title display/rendering, and can be used to recursively
|
|
31
|
+
* determine whether to render an accordion or a link
|
|
32
|
+
*/
|
|
33
|
+
var EuiCollapsibleNavItemDisplay = function EuiCollapsibleNavItemDisplay(_ref) {
|
|
34
|
+
var _props$linkProps;
|
|
35
|
+
var isSubItem = _ref.isSubItem,
|
|
36
|
+
title = _ref.title,
|
|
37
|
+
titleElement = _ref.titleElement,
|
|
38
|
+
icon = _ref.icon,
|
|
39
|
+
iconProps = _ref.iconProps,
|
|
40
|
+
className = _ref.className,
|
|
41
|
+
items = _ref.items,
|
|
42
|
+
children = _ref.children,
|
|
43
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
44
|
+
var classes = (0, _classnames.default)('euiCollapsibleNavItem', {
|
|
45
|
+
euiCollapsibleNavSubItem: isSubItem
|
|
46
|
+
}, className);
|
|
47
|
+
var headerContent = (0, _react2.jsx)(EuiCollapsibleNavItemTitle, {
|
|
48
|
+
title: title,
|
|
49
|
+
titleElement: titleElement,
|
|
50
|
+
icon: icon,
|
|
51
|
+
iconProps: iconProps
|
|
52
|
+
});
|
|
53
|
+
var isAccordion = items && items.length > 0;
|
|
54
|
+
if (isAccordion) {
|
|
55
|
+
return (0, _react2.jsx)(_collapsible_nav_accordion.EuiCollapsibleNavAccordion, (0, _extends2.default)({
|
|
56
|
+
className: classes,
|
|
57
|
+
buttonContent: headerContent,
|
|
58
|
+
items: items
|
|
59
|
+
}, props, {
|
|
60
|
+
isSubItem: isSubItem
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
return (0, _react2.jsx)(_collapsible_nav_link.EuiCollapsibleNavLink, (0, _extends2.default)({
|
|
64
|
+
className: classes
|
|
65
|
+
}, props, {
|
|
66
|
+
// EuiLink ExclusiveUnion type shenanigans
|
|
67
|
+
isSubItem: isSubItem,
|
|
68
|
+
isNotAccordion: true,
|
|
69
|
+
isInteractive: !!(props.href || props.onClick || (_props$linkProps = props.linkProps) !== null && _props$linkProps !== void 0 && _props$linkProps.onClick)
|
|
70
|
+
}), headerContent);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Internal subcomponent for title display
|
|
75
|
+
*/
|
|
76
|
+
var EuiCollapsibleNavItemTitle = function EuiCollapsibleNavItemTitle(_ref2) {
|
|
77
|
+
var title = _ref2.title,
|
|
78
|
+
_ref2$titleElement = _ref2.titleElement,
|
|
79
|
+
titleElement = _ref2$titleElement === void 0 ? 'span' : _ref2$titleElement,
|
|
80
|
+
icon = _ref2.icon,
|
|
81
|
+
iconProps = _ref2.iconProps;
|
|
82
|
+
var styles = _collapsible_nav_item.euiCollapsibleNavItemTitleStyles;
|
|
83
|
+
var TitleElement = titleElement;
|
|
84
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, icon && (0, _react2.jsx)(_icon.EuiIcon, (0, _extends2.default)({
|
|
85
|
+
type: icon
|
|
86
|
+
}, iconProps)), (0, _react2.jsx)(TitleElement, {
|
|
87
|
+
className: "euiCollapsibleNavItem__title eui-textTruncate",
|
|
88
|
+
css: styles.euiCollapsibleNavItem__title
|
|
89
|
+
}, title));
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Sub-items can either be a group title, to visually separate sections
|
|
94
|
+
* of nav links, or they can simply be more links or accordions
|
|
95
|
+
*/
|
|
96
|
+
var EuiCollapsibleNavSubItem = function EuiCollapsibleNavSubItem(_ref3) {
|
|
97
|
+
var isGroupTitle = _ref3.isGroupTitle,
|
|
98
|
+
className = _ref3.className,
|
|
99
|
+
props = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
|
|
100
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
101
|
+
var styles = (0, _collapsible_nav_item.euiCollapsibleNavSubItemGroupTitleStyles)(euiTheme);
|
|
102
|
+
if (isGroupTitle) {
|
|
103
|
+
var TitleElement = props.titleElement || 'div';
|
|
104
|
+
return (0, _react2.jsx)(_title.EuiTitle, {
|
|
105
|
+
size: "xxxs",
|
|
106
|
+
css: styles.euiCollapsibleNavItem__groupTitle,
|
|
107
|
+
className: "euiCollapsibleNavItem__groupTitle eui-textTruncate"
|
|
108
|
+
}, (0, _react2.jsx)(TitleElement, null, props.title));
|
|
109
|
+
}
|
|
110
|
+
return (0, _react2.jsx)(EuiCollapsibleNavItemDisplay, (0, _extends2.default)({}, props, {
|
|
111
|
+
isSubItem: true
|
|
112
|
+
}));
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The actual exported component
|
|
117
|
+
*/
|
|
118
|
+
exports.EuiCollapsibleNavSubItem = EuiCollapsibleNavSubItem;
|
|
119
|
+
var EuiCollapsibleNavItem = function EuiCollapsibleNavItem(props) {
|
|
120
|
+
return (0, _react2.jsx)(EuiCollapsibleNavItemDisplay, (0, _extends2.default)({}, props, {
|
|
121
|
+
isSubItem: false
|
|
122
|
+
}));
|
|
123
|
+
};
|
|
124
|
+
exports.EuiCollapsibleNavItem = EuiCollapsibleNavItem;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.euiCollapsibleNavSubItemGroupTitleStyles = exports.euiCollapsibleNavItemVariables = exports.euiCollapsibleNavItemTitleStyles = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _react = require("@emotion/react");
|
|
10
|
+
var _global_styling = require("../../../global_styling");
|
|
11
|
+
var _button = require("../../../themes/amsterdam/global_styling/mixins/button");
|
|
12
|
+
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; }
|
|
13
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
14
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; } /*
|
|
15
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
16
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
17
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
18
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
19
|
+
* Side Public License, v 1.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Style variables shared between accordion, link, and sub items
|
|
23
|
+
*/
|
|
24
|
+
var euiCollapsibleNavItemVariables = function euiCollapsibleNavItemVariables(euiThemeContext) {
|
|
25
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
26
|
+
return _objectSpread(_objectSpread({
|
|
27
|
+
height: euiTheme.size.xl,
|
|
28
|
+
padding: euiTheme.size.s
|
|
29
|
+
}, (0, _global_styling.euiFontSize)(euiThemeContext, 's')), {}, {
|
|
30
|
+
animation: "".concat(euiTheme.animation.normal, " ease-in-out"),
|
|
31
|
+
// Matches EuiButton
|
|
32
|
+
borderRadius: euiTheme.border.radius.small,
|
|
33
|
+
backgroundHoverColor: euiTheme.colors.lightestShade,
|
|
34
|
+
backgroundSelectedColor: (0, _button.euiButtonColor)(euiThemeContext, 'text').backgroundColor,
|
|
35
|
+
color: euiTheme.colors.text,
|
|
36
|
+
rightIconColor: euiTheme.colors.disabledText
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Title styles
|
|
42
|
+
*/
|
|
43
|
+
exports.euiCollapsibleNavItemVariables = euiCollapsibleNavItemVariables;
|
|
44
|
+
var euiCollapsibleNavItemTitleStyles = {
|
|
45
|
+
euiCollapsibleNavItem__title: process.env.NODE_ENV === "production" ? {
|
|
46
|
+
name: "i246l1-euiCollapsibleNavItem__title",
|
|
47
|
+
styles: "flex-grow:1;label:euiCollapsibleNavItem__title;"
|
|
48
|
+
} : {
|
|
49
|
+
name: "i246l1-euiCollapsibleNavItem__title",
|
|
50
|
+
styles: "flex-grow:1;label:euiCollapsibleNavItem__title;",
|
|
51
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
exports.euiCollapsibleNavItemTitleStyles = euiCollapsibleNavItemTitleStyles;
|
|
55
|
+
var euiCollapsibleNavSubItemGroupTitleStyles = function euiCollapsibleNavSubItemGroupTitleStyles(_ref) {
|
|
56
|
+
var euiTheme = _ref.euiTheme;
|
|
57
|
+
return {
|
|
58
|
+
euiCollapsibleNavItem__groupTitle: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-top', euiTheme.size.base), " ", (0, _global_styling.logicalShorthandCSS)('padding', "".concat(euiTheme.size.xs, " ").concat(euiTheme.size.s)), ";;label:euiCollapsibleNavItem__groupTitle;")
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
exports.euiCollapsibleNavSubItemGroupTitleStyles = euiCollapsibleNavSubItemGroupTitleStyles;
|
package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_link.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.EuiCollapsibleNavLink = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
var _services = require("../../../services");
|
|
14
|
+
var _link = require("../../link");
|
|
15
|
+
var _collapsible_nav_link = require("./collapsible_nav_link.styles");
|
|
16
|
+
var _react2 = require("@emotion/react");
|
|
17
|
+
var _excluded = ["href", "rel", "children", "className", "isSelected", "isInteractive", "isNotAccordion", "isSubItem", "linkProps"];
|
|
18
|
+
/*
|
|
19
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
20
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
21
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
22
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
23
|
+
* Side Public License, v 1.
|
|
24
|
+
*/
|
|
25
|
+
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; }
|
|
26
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
27
|
+
/**
|
|
28
|
+
* Internal nav link component.
|
|
29
|
+
*
|
|
30
|
+
* Can be rendered as a standalone nav item, or as part of an accordion header.
|
|
31
|
+
* Can also be rendered as top-level item (has a background hover) or as a
|
|
32
|
+
* sub-item (renders closer to plain text).
|
|
33
|
+
*
|
|
34
|
+
* In terms of DOM output, follows the same logic as EuiLink (renders either
|
|
35
|
+
* an `a` tag or a `button` if no valid link exists), and can also additionally
|
|
36
|
+
* rendered a plain `span` if the item is not interactive.
|
|
37
|
+
*/
|
|
38
|
+
var EuiCollapsibleNavLink = function EuiCollapsibleNavLink(_ref) {
|
|
39
|
+
var href = _ref.href,
|
|
40
|
+
rel = _ref.rel,
|
|
41
|
+
children = _ref.children,
|
|
42
|
+
className = _ref.className,
|
|
43
|
+
isSelected = _ref.isSelected,
|
|
44
|
+
_ref$isInteractive = _ref.isInteractive,
|
|
45
|
+
isInteractive = _ref$isInteractive === void 0 ? true : _ref$isInteractive,
|
|
46
|
+
isNotAccordion = _ref.isNotAccordion,
|
|
47
|
+
isSubItem = _ref.isSubItem,
|
|
48
|
+
linkProps = _ref.linkProps,
|
|
49
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
50
|
+
var classes = (0, _classnames.default)('euiCollapsibleNavLink', className);
|
|
51
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
52
|
+
var styles = (0, _collapsible_nav_link.euiCollapsibleNavLinkStyles)(euiTheme);
|
|
53
|
+
var cssStyles = [styles.euiCollapsibleNavLink, isSelected && styles.isSelected, isSubItem ? styles.isSubItem : styles.isTopItem.isTopItem, isNotAccordion && !isSubItem && styles.isTopItem.isNotAccordion, isInteractive && !isSelected && !isSubItem && styles.isTopItem.isInteractive, linkProps === null || linkProps === void 0 ? void 0 : linkProps.css];
|
|
54
|
+
return isInteractive ? (0, _react2.jsx)(_link.EuiLink, (0, _extends2.default)({
|
|
55
|
+
href: href,
|
|
56
|
+
rel: rel,
|
|
57
|
+
className: classes
|
|
58
|
+
}, _objectSpread(_objectSpread({}, rest), linkProps), {
|
|
59
|
+
// EuiLink ExclusiveUnion shenanigans
|
|
60
|
+
css: cssStyles
|
|
61
|
+
}), children) : (0, _react2.jsx)("span", (0, _extends2.default)({
|
|
62
|
+
className: classes,
|
|
63
|
+
css: cssStyles
|
|
64
|
+
}, rest), children);
|
|
65
|
+
};
|
|
66
|
+
exports.EuiCollapsibleNavLink = EuiCollapsibleNavLink;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiCollapsibleNavLinkStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _global_styling = require("../../../global_styling");
|
|
9
|
+
var _collapsible_nav_item = require("./collapsible_nav_item.styles");
|
|
10
|
+
/*
|
|
11
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
13
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
14
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
|
+
* Side Public License, v 1.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
var euiCollapsibleNavLinkStyles = function euiCollapsibleNavLinkStyles(euiThemeContext) {
|
|
19
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
20
|
+
var sharedStyles = (0, _collapsible_nav_item.euiCollapsibleNavItemVariables)(euiThemeContext);
|
|
21
|
+
return {
|
|
22
|
+
// Shared between all links
|
|
23
|
+
euiCollapsibleNavLink: /*#__PURE__*/(0, _react.css)("display:flex;align-items:center;", (0, _global_styling.logicalCSS)('height', sharedStyles.height), " padding:", sharedStyles.padding, ";font-size:", sharedStyles.fontSize, ";line-height:", sharedStyles.lineHeight, ";color:", sharedStyles.color, ";border-radius:", sharedStyles.borderRadius, ";&:focus{outline-offset:-", euiTheme.focus.width, ";text-decoration-thickness:unset;}[class*='euiLink__externalIcon']{", (0, _global_styling.logicalCSS)('margin-right', euiTheme.size.xxs), " color:", sharedStyles.rightIconColor, ";};label:euiCollapsibleNavLink;"),
|
|
24
|
+
isSelected: /*#__PURE__*/(0, _react.css)("background-color:", sharedStyles.backgroundSelectedColor, ";;label:isSelected;"),
|
|
25
|
+
isTopItem: {
|
|
26
|
+
isTopItem: /*#__PURE__*/(0, _react.css)("font-weight:", euiTheme.font.weight.semiBold, ";gap:", euiTheme.size.base, ";&:is(button){inline-size:calc(\n 100% - ", (0, _global_styling.mathWithUnits)(sharedStyles.padding, function (x) {
|
|
27
|
+
return x * 2;
|
|
28
|
+
}), "\n );};label:isTopItem;"),
|
|
29
|
+
isNotAccordion: /*#__PURE__*/(0, _react.css)("margin:", sharedStyles.padding, ";;label:isNotAccordion;"),
|
|
30
|
+
isInteractive: /*#__PURE__*/(0, _react.css)(_global_styling.euiCanAnimate, "{transition:background-color ", sharedStyles.animation, ";}&:hover,&:focus-visible{background-color:", sharedStyles.backgroundHoverColor, ";};label:isInteractive;")
|
|
31
|
+
},
|
|
32
|
+
isSubItem: /*#__PURE__*/(0, _react.css)("font-weight:", euiTheme.font.weight.regular, ";gap:", euiTheme.size.s, ";;label:isSubItem;")
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
exports.euiCollapsibleNavLinkStyles = euiCollapsibleNavLinkStyles;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "EuiCollapsibleNavItem", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _collapsible_nav_item.EuiCollapsibleNavItem;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _collapsible_nav_item = require("./collapsible_nav_item");
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "EuiCollapsibleNavBeta", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _collapsible_nav_beta.EuiCollapsibleNavBeta;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "EuiCollapsibleNavItem", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _collapsible_nav_item.EuiCollapsibleNavItem;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _collapsible_nav_beta = require("./collapsible_nav_beta");
|
|
19
|
+
var _collapsible_nav_item = require("./collapsible_nav_item");
|
|
@@ -29,10 +29,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
29
29
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
30
|
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; }
|
|
31
31
|
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) { (0, _defineProperty2.default)(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; }
|
|
32
|
+
var colorDefaultValue = [1, 0, 0];
|
|
32
33
|
var EuiSaturation = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
33
34
|
var className = _ref.className,
|
|
34
35
|
_ref$color = _ref.color,
|
|
35
|
-
color = _ref$color === void 0 ?
|
|
36
|
+
color = _ref$color === void 0 ? colorDefaultValue : _ref$color,
|
|
36
37
|
_ref$dataTestSubj = _ref['data-test-subj'],
|
|
37
38
|
dataTestSubj = _ref$dataTestSubj === void 0 ? 'euiSaturation' : _ref$dataTestSubj,
|
|
38
39
|
hex = _ref.hex,
|