@elastic/eui 87.1.0 → 87.2.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 -234
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -234
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/page_template/page_template.js +2 -1
- package/es/components/resizable_container/index.js +2 -1
- package/es/components/resizable_container/resizable_button.js +81 -50
- package/es/components/resizable_container/resizable_button.styles.js +66 -0
- package/es/components/resizable_container/resizable_collapse_button.js +24 -14
- package/es/components/resizable_container/resizable_collapse_button.styles.js +85 -0
- package/es/components/steps/step.styles.js +5 -5
- package/es/services/accessibility/html_id_generator.js +19 -3
- package/es/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/eui.d.ts +113 -19
- package/i18ntokens.json +10 -10
- package/lib/components/page_template/page_template.js +2 -1
- package/lib/components/resizable_container/index.js +8 -1
- package/lib/components/resizable_container/resizable_button.js +83 -51
- package/lib/components/resizable_container/resizable_button.styles.js +71 -0
- package/lib/components/resizable_container/resizable_collapse_button.js +24 -14
- package/lib/components/resizable_container/resizable_collapse_button.styles.js +90 -0
- package/lib/components/steps/step.styles.js +5 -5
- package/lib/services/accessibility/html_id_generator.js +21 -2
- package/lib/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/optimize/es/components/page_template/page_template.js +2 -1
- package/optimize/es/components/resizable_container/index.js +2 -1
- package/optimize/es/components/resizable_container/resizable_button.js +61 -44
- package/optimize/es/components/resizable_container/resizable_button.styles.js +66 -0
- package/optimize/es/components/resizable_container/resizable_collapse_button.js +19 -11
- package/optimize/es/components/resizable_container/resizable_collapse_button.styles.js +85 -0
- package/optimize/es/components/steps/step.styles.js +5 -5
- package/optimize/es/services/accessibility/html_id_generator.js +19 -3
- package/optimize/es/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/optimize/lib/components/page_template/page_template.js +2 -1
- package/optimize/lib/components/resizable_container/index.js +8 -1
- package/optimize/lib/components/resizable_container/resizable_button.js +63 -45
- package/optimize/lib/components/resizable_container/resizable_button.styles.js +71 -0
- package/optimize/lib/components/resizable_container/resizable_collapse_button.js +19 -11
- package/optimize/lib/components/resizable_container/resizable_collapse_button.styles.js +90 -0
- package/optimize/lib/components/steps/step.styles.js +5 -5
- package/optimize/lib/services/accessibility/html_id_generator.js +21 -2
- package/optimize/lib/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/package.json +13 -13
- package/src/components/index.scss +0 -1
- package/test-env/components/page_template/page_template.js +2 -1
- package/test-env/components/resizable_container/index.js +8 -1
- package/test-env/components/resizable_container/resizable_button.js +83 -51
- package/test-env/components/resizable_container/resizable_button.styles.js +71 -0
- package/test-env/components/resizable_container/resizable_collapse_button.js +19 -14
- package/test-env/components/resizable_container/resizable_collapse_button.styles.js +90 -0
- package/test-env/components/steps/step.styles.js +5 -5
- package/test-env/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/src/components/resizable_container/_index.scss +0 -3
- package/src/components/resizable_container/_resizable_button.scss +0 -129
- package/src/components/resizable_container/_resizable_collapse_button.scss +0 -145
- package/src/components/resizable_container/_variables.scss +0 -2
|
@@ -126,7 +126,8 @@ export var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
|
126
126
|
return {
|
|
127
127
|
restrictWidth: restrictWidth,
|
|
128
128
|
paddingSize: paddingSize,
|
|
129
|
-
|
|
129
|
+
// pageInnerId may contain colons that are parsed as pseudo-elements if not escaped
|
|
130
|
+
parent: "#".concat(CSS.escape(pageInnerId))
|
|
130
131
|
};
|
|
131
132
|
};
|
|
132
133
|
var innerPanelled = function innerPanelled() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
var _excluded = ["isHorizontal", "
|
|
1
|
+
var _excluded = ["isHorizontal", "alignIndicator", "className"],
|
|
2
|
+
_excluded2 = ["registration", "id", "disabled", "onFocus"];
|
|
2
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
4
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
5
|
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."); }
|
|
@@ -16,22 +17,77 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16
17
|
* Side Public License, v 1.
|
|
17
18
|
*/
|
|
18
19
|
|
|
19
|
-
import React, { useCallback, useMemo, useRef } from 'react';
|
|
20
|
+
import React, { useCallback, useMemo, useRef, forwardRef } from 'react';
|
|
20
21
|
import PropTypes from "prop-types";
|
|
21
22
|
import classNames from 'classnames';
|
|
22
23
|
import { EuiI18n } from '../i18n';
|
|
23
|
-
import { useGeneratedHtmlId } from '../../services';
|
|
24
|
+
import { useEuiTheme, useGeneratedHtmlId } from '../../services';
|
|
24
25
|
import { useEuiResizableContainerContext } from './context';
|
|
26
|
+
import { euiResizableButtonStyles } from './resizable_button.styles';
|
|
25
27
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
26
|
-
|
|
28
|
+
/**
|
|
29
|
+
* A generic button for indicating/facilitating resizable content,
|
|
30
|
+
* usable outside of the EuiResizableContainer context
|
|
31
|
+
*/
|
|
32
|
+
export var EuiResizableButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
27
33
|
var isHorizontal = _ref.isHorizontal,
|
|
34
|
+
_ref$alignIndicator = _ref.alignIndicator,
|
|
35
|
+
alignIndicator = _ref$alignIndicator === void 0 ? 'center' : _ref$alignIndicator,
|
|
28
36
|
className = _ref.className,
|
|
29
|
-
id = _ref.id,
|
|
30
|
-
registration = _ref.registration,
|
|
31
|
-
disabled = _ref.disabled,
|
|
32
|
-
onFocus = _ref.onFocus,
|
|
33
|
-
onBlur = _ref.onBlur,
|
|
34
37
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
|
+
var classes = classNames('euiResizableButton', className);
|
|
39
|
+
var euiTheme = useEuiTheme();
|
|
40
|
+
var styles = euiResizableButtonStyles(euiTheme);
|
|
41
|
+
var cssStyles = [styles.euiResizableButton, isHorizontal ? styles.horizontal : styles.vertical, styles.alignIndicator[alignIndicator]];
|
|
42
|
+
return ___EmotionJSX(EuiI18n, {
|
|
43
|
+
tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
|
|
44
|
+
defaults: ['Press the left or right arrow keys to adjust panels size', 'Press the up or down arrow keys to adjust panels size']
|
|
45
|
+
}, function (_ref2) {
|
|
46
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
47
|
+
horizontalResizerAriaLabel = _ref3[0],
|
|
48
|
+
verticalResizerAriaLabel = _ref3[1];
|
|
49
|
+
return ___EmotionJSX("button", _extends({
|
|
50
|
+
ref: ref,
|
|
51
|
+
"aria-label": isHorizontal ? horizontalResizerAriaLabel : verticalResizerAriaLabel,
|
|
52
|
+
className: classes,
|
|
53
|
+
css: cssStyles,
|
|
54
|
+
"data-test-subj": "euiResizableButton",
|
|
55
|
+
type: "button"
|
|
56
|
+
}, rest));
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
EuiResizableButton.propTypes = {
|
|
60
|
+
className: PropTypes.string,
|
|
61
|
+
"aria-label": PropTypes.string,
|
|
62
|
+
"data-test-subj": PropTypes.string,
|
|
63
|
+
css: PropTypes.any,
|
|
64
|
+
/**
|
|
65
|
+
* Defaults to displaying a resizer for vertical (y-axis) resizing.
|
|
66
|
+
* Set to `true` to display a resizer for horizontal (x-axis) resizing.
|
|
67
|
+
*/
|
|
68
|
+
isHorizontal: PropTypes.bool,
|
|
69
|
+
/**
|
|
70
|
+
* Specify the alignment of the initial resize indicator. Defaults to `center`,
|
|
71
|
+
* but consider using `start` for extremely tall content that scrolls off-screen
|
|
72
|
+
*/
|
|
73
|
+
alignIndicator: PropTypes.oneOf(["center", "start", "end"]),
|
|
74
|
+
/**
|
|
75
|
+
* When disabled, the resizer button will be completely hidden
|
|
76
|
+
*/
|
|
77
|
+
disabled: PropTypes.bool
|
|
78
|
+
};
|
|
79
|
+
EuiResizableButton.displayName = 'EuiResizableButton';
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Resizer button specific to controlled EuiResizableContainer usage
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
export var EuiResizableButtonControlled = function EuiResizableButtonControlled(_ref4) {
|
|
86
|
+
var registration = _ref4.registration,
|
|
87
|
+
id = _ref4.id,
|
|
88
|
+
disabled = _ref4.disabled,
|
|
89
|
+
_onFocus = _ref4.onFocus,
|
|
90
|
+
rest = _objectWithoutProperties(_ref4, _excluded2);
|
|
35
91
|
var resizerId = useGeneratedHtmlId({
|
|
36
92
|
prefix: 'resizable-button',
|
|
37
93
|
conditionalId: id
|
|
@@ -43,13 +99,9 @@ export var EuiResizableButton = function EuiResizableButton(_ref) {
|
|
|
43
99
|
} : _useEuiResizableConta2,
|
|
44
100
|
resizers = _useEuiResizableConta3.resizers;
|
|
45
101
|
var isDisabled = useMemo(function () {
|
|
46
|
-
|
|
102
|
+
var _resizers$resizerId;
|
|
103
|
+
return disabled || ((_resizers$resizerId = resizers[resizerId]) === null || _resizers$resizerId === void 0 ? void 0 : _resizers$resizerId.isDisabled);
|
|
47
104
|
}, [resizers, resizerId, disabled]);
|
|
48
|
-
var classes = classNames('euiResizableButton', {
|
|
49
|
-
'euiResizableButton--vertical': !isHorizontal,
|
|
50
|
-
'euiResizableButton--horizontal': isHorizontal,
|
|
51
|
-
'euiResizableButton--disabled': isDisabled
|
|
52
|
-
}, className);
|
|
53
105
|
var previousRef = useRef();
|
|
54
106
|
var onRef = useCallback(function (ref) {
|
|
55
107
|
if (!registration) return;
|
|
@@ -68,41 +120,20 @@ export var EuiResizableButton = function EuiResizableButton(_ref) {
|
|
|
68
120
|
}
|
|
69
121
|
}
|
|
70
122
|
}, [registration, resizerId, disabled]);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
horizontalResizerAriaLabel = _ref3[0],
|
|
83
|
-
verticalResizerAriaLabel = _ref3[1];
|
|
84
|
-
return ___EmotionJSX("button", _extends({
|
|
85
|
-
id: resizerId,
|
|
86
|
-
ref: onRef,
|
|
87
|
-
"aria-label": isHorizontal ? horizontalResizerAriaLabel : verticalResizerAriaLabel,
|
|
88
|
-
className: classes,
|
|
89
|
-
"data-test-subj": "euiResizableButton",
|
|
90
|
-
type: "button",
|
|
91
|
-
onClick: setFocus,
|
|
92
|
-
onFocus: handleFocus,
|
|
93
|
-
onBlur: onBlur,
|
|
94
|
-
disabled: isDisabled
|
|
95
|
-
}, rest));
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
EuiResizableButton.propTypes = {
|
|
99
|
-
className: PropTypes.string,
|
|
100
|
-
"aria-label": PropTypes.string,
|
|
101
|
-
"data-test-subj": PropTypes.string,
|
|
102
|
-
css: PropTypes.any
|
|
123
|
+
return ___EmotionJSX(EuiResizableButton, _extends({
|
|
124
|
+
id: resizerId,
|
|
125
|
+
ref: onRef,
|
|
126
|
+
disabled: isDisabled,
|
|
127
|
+
onClick: function onClick(e) {
|
|
128
|
+
return e.currentTarget.focus();
|
|
129
|
+
},
|
|
130
|
+
onFocus: function onFocus() {
|
|
131
|
+
return _onFocus === null || _onFocus === void 0 ? void 0 : _onFocus(resizerId);
|
|
132
|
+
}
|
|
133
|
+
}, rest));
|
|
103
134
|
};
|
|
104
|
-
export function euiResizableButtonWithControls(controls) {
|
|
135
|
+
export var euiResizableButtonWithControls = function euiResizableButtonWithControls(controls) {
|
|
105
136
|
return function (props) {
|
|
106
|
-
return ___EmotionJSX(
|
|
137
|
+
return ___EmotionJSX(EuiResizableButtonControlled, _extends({}, controls, props));
|
|
107
138
|
};
|
|
108
|
-
}
|
|
139
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import { transparentize } from '../../services';
|
|
12
|
+
import { logicalCSS, mathWithUnits, euiCanAnimate } from '../../global_styling';
|
|
13
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
14
|
+
name: "1fvu7sv-end",
|
|
15
|
+
styles: "align-items:flex-end;label:end;"
|
|
16
|
+
} : {
|
|
17
|
+
name: "1fvu7sv-end",
|
|
18
|
+
styles: "align-items:flex-end;label:end;",
|
|
19
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
20
|
+
};
|
|
21
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
22
|
+
name: "h0ntv8-start",
|
|
23
|
+
styles: "align-items:flex-start;label:start;"
|
|
24
|
+
} : {
|
|
25
|
+
name: "h0ntv8-start",
|
|
26
|
+
styles: "align-items:flex-start;label:start;",
|
|
27
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
28
|
+
};
|
|
29
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
30
|
+
name: "8391db-center",
|
|
31
|
+
styles: "align-items:center;label:center;"
|
|
32
|
+
} : {
|
|
33
|
+
name: "8391db-center",
|
|
34
|
+
styles: "align-items:center;label:center;",
|
|
35
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
36
|
+
};
|
|
37
|
+
export var euiResizableButtonStyles = function euiResizableButtonStyles(euiThemeContext) {
|
|
38
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
39
|
+
var buttonSize = euiTheme.size.base;
|
|
40
|
+
var grabHandleWidth = euiTheme.size.m;
|
|
41
|
+
var grabHandleHeight = euiTheme.border.width.thin;
|
|
42
|
+
var transitionSpeed = euiTheme.animation.fast;
|
|
43
|
+
var transition = "".concat(transitionSpeed, " ease");
|
|
44
|
+
return {
|
|
45
|
+
// Mimics the "grab" icon with CSS psuedo-elements.
|
|
46
|
+
// 1. The "grab" icon transforms into a thicker straight line on :hover and :focus
|
|
47
|
+
// 2. Start/end aligned handles should have a slight margin offset that disappears on hover/focus
|
|
48
|
+
// 3. CSS hack to smooth out/anti-alias the 1px wide handles at various zoom levels
|
|
49
|
+
euiResizableButton: /*#__PURE__*/css("z-index:1;flex-shrink:0;display:flex;justify-content:center;gap:", mathWithUnits(grabHandleHeight, function (x) {
|
|
50
|
+
return x * 2;
|
|
51
|
+
}), ";&:disabled{display:none;}&:hover,&:focus{gap:0;justify-content:center;}", euiCanAnimate, "{transition:gap ", transition, ",justify-content ", transition, ";}&::before,&::after{content:'';display:block;background-color:", euiTheme.colors.darkestShade, ";transform:translateZ(0);", euiCanAnimate, "{transition:width ", transition, ",height ", transition, ",margin ", transition, ",background-color ", transition, ";}}&:hover{&::before,&::after{background-color:", euiTheme.colors.mediumShade, ";", euiCanAnimate, "{transition-delay:", transitionSpeed, ";}}}&:focus,&:active{background-color:", transparentize(euiTheme.colors.primary, 0.1), ";&::before,&::after{background-color:", euiTheme.colors.primary, ";", euiCanAnimate, "{transition:width ", transition, ",height ", transition, ";transition-delay:", mathWithUnits(transitionSpeed, function (x) {
|
|
52
|
+
return x / 2;
|
|
53
|
+
}), ";}}};label:euiResizableButton;"),
|
|
54
|
+
horizontal: /*#__PURE__*/css("cursor:col-resize;", logicalCSS('height', '100%'), " ", logicalCSS('width', buttonSize), " margin-inline:", mathWithUnits(buttonSize, function (x) {
|
|
55
|
+
return x / -2;
|
|
56
|
+
}), ";&::before,&::after{", logicalCSS('width', grabHandleHeight), " ", logicalCSS('height', grabHandleWidth), " margin-block:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", logicalCSS('height', '100%'), " margin-block:0;transform:none;}};label:horizontal;"),
|
|
57
|
+
vertical: /*#__PURE__*/css("flex-direction:column;cursor:row-resize;", logicalCSS('width', '100%'), " ", logicalCSS('height', buttonSize), " margin-block:", mathWithUnits(buttonSize, function (x) {
|
|
58
|
+
return x / -2;
|
|
59
|
+
}), ";&::before,&::after{", logicalCSS('height', grabHandleHeight), " ", logicalCSS('width', grabHandleWidth), " margin-inline:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", logicalCSS('width', '100%'), " margin-inline:0;transform:none;}};label:vertical;"),
|
|
60
|
+
alignIndicator: {
|
|
61
|
+
center: _ref3,
|
|
62
|
+
start: _ref2,
|
|
63
|
+
end: _ref
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
};
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
var _excluded = ["className", "externalPosition", "internalPosition", "direction", "isVisible", "isCollapsed"];
|
|
2
2
|
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
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
|
+
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."); }
|
|
5
|
+
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); }
|
|
6
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
7
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
|
+
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; }
|
|
3
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
5
11
|
/*
|
|
@@ -13,11 +19,15 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
13
19
|
import React from 'react';
|
|
14
20
|
import PropTypes from "prop-types";
|
|
15
21
|
import classNames from 'classnames';
|
|
22
|
+
import { useEuiTheme } from '../../services';
|
|
16
23
|
import { EuiButtonIcon } from '../button';
|
|
24
|
+
import { euiScreenReaderOnlyStyles } from '../accessibility/screen_reader_only/screen_reader_only.styles';
|
|
25
|
+
import { euiResizableCollapseButtonStyles } from './resizable_collapse_button.styles';
|
|
17
26
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
18
27
|
export var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref) {
|
|
19
28
|
var className = _ref.className,
|
|
20
|
-
externalPosition = _ref.externalPosition,
|
|
29
|
+
_ref$externalPosition = _ref.externalPosition,
|
|
30
|
+
externalPosition = _ref$externalPosition === void 0 ? 'before' : _ref$externalPosition,
|
|
21
31
|
_ref$internalPosition = _ref.internalPosition,
|
|
22
32
|
internalPosition = _ref$internalPosition === void 0 ? 'middle' : _ref$internalPosition,
|
|
23
33
|
_ref$direction = _ref.direction,
|
|
@@ -26,14 +36,15 @@ export var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref
|
|
|
26
36
|
isCollapsed = _ref.isCollapsed,
|
|
27
37
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
38
|
var isHorizontal = direction === 'horizontal';
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
var
|
|
39
|
+
var showOnFocus = !isCollapsed && !isVisible;
|
|
40
|
+
var screenReaderOnlyStyles = euiScreenReaderOnlyStyles(showOnFocus).euiScreenReaderOnly;
|
|
41
|
+
var euiTheme = useEuiTheme();
|
|
42
|
+
var styles = euiResizableCollapseButtonStyles(euiTheme);
|
|
43
|
+
var collapsedStyles = [styles.collapsed.collapsed, styles.collapsed[direction], styles.collapsed["".concat(direction, "Positions")][internalPosition]];
|
|
44
|
+
var collapsibleStyles = [styles.collapsible.collapsible, styles.collapsible[direction][externalPosition], styles.collapsible[direction][internalPosition]];
|
|
45
|
+
var cssStyles = [styles.euiResizableCollapseButton, showOnFocus && screenReaderOnlyStyles].concat(_toConsumableArray(isCollapsed ? collapsedStyles : collapsibleStyles));
|
|
46
|
+
var COLLAPSED_ICON = '';
|
|
47
|
+
var NOT_COLLAPSED_ICON = '';
|
|
37
48
|
switch (externalPosition) {
|
|
38
49
|
case 'before':
|
|
39
50
|
COLLAPSED_ICON = isHorizontal ? 'menuLeft' : 'menuUp';
|
|
@@ -44,11 +55,13 @@ export var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref
|
|
|
44
55
|
NOT_COLLAPSED_ICON = isHorizontal ? 'menuLeft' : 'menuUp';
|
|
45
56
|
break;
|
|
46
57
|
}
|
|
58
|
+
var classes = classNames('euiResizableCollapseButton', className);
|
|
47
59
|
return ___EmotionJSX(EuiButtonIcon, _extends({
|
|
48
60
|
display: isCollapsed ? 'empty' : 'base',
|
|
49
|
-
color: "text"
|
|
50
|
-
}, rest, {
|
|
61
|
+
color: "text",
|
|
51
62
|
className: classes,
|
|
63
|
+
css: cssStyles
|
|
64
|
+
}, rest, {
|
|
52
65
|
iconType: isCollapsed ? COLLAPSED_ICON : NOT_COLLAPSED_ICON
|
|
53
66
|
}));
|
|
54
67
|
};
|
|
@@ -67,9 +80,6 @@ EuiResizableCollapseButton.propTypes = {
|
|
|
67
80
|
* Same direction derived from EuiResizableContainer
|
|
68
81
|
*/
|
|
69
82
|
direction: PropTypes.oneOf(["vertical", "horizontal"]),
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
*/
|
|
73
83
|
isVisible: PropTypes.bool,
|
|
74
84
|
isCollapsed: PropTypes.bool
|
|
75
85
|
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import { logicalCSS, mathWithUnits } from '../../global_styling';
|
|
12
|
+
import { euiShadowXSmall, euiSlightShadowHover } from '../../themes/amsterdam';
|
|
13
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
14
|
+
name: "fuwsll-euiResizableCollapseButton",
|
|
15
|
+
styles: "z-index:2;position:absolute;&:focus{animation:none;};label:euiResizableCollapseButton;"
|
|
16
|
+
} : {
|
|
17
|
+
name: "fuwsll-euiResizableCollapseButton",
|
|
18
|
+
styles: "z-index:2;position:absolute;&:focus{animation:none;};label:euiResizableCollapseButton;",
|
|
19
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
20
|
+
};
|
|
21
|
+
export var euiResizableCollapseButtonStyles = function euiResizableCollapseButtonStyles(euiThemeContext) {
|
|
22
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
23
|
+
var buttonSize = euiTheme.size.l;
|
|
24
|
+
var centeringOffset = mathWithUnits(buttonSize, function (x) {
|
|
25
|
+
return x / -2;
|
|
26
|
+
}); // Use negative margins instead of transforms to avoid having to override EuiButtonIcon's CSS
|
|
27
|
+
var buttonOffset = euiTheme.size.base;
|
|
28
|
+
return {
|
|
29
|
+
euiResizableCollapseButton: _ref,
|
|
30
|
+
collapsible: {
|
|
31
|
+
collapsible: /*#__PURE__*/css("background:", euiTheme.colors.emptyShade, ";", euiShadowXSmall(euiThemeContext), " &:focus{", euiSlightShadowHover(euiThemeContext), ";};label:collapsible;"),
|
|
32
|
+
horizontal: {
|
|
33
|
+
after: /*#__PURE__*/css(logicalCSS('right', 0), " ", logicalCSS('margin-right', centeringOffset), ";;label:after;"),
|
|
34
|
+
before: /*#__PURE__*/css(logicalCSS('left', 0), " ", logicalCSS('margin-left', centeringOffset), ";;label:before;"),
|
|
35
|
+
middle: /*#__PURE__*/css(logicalCSS('top', '50%'), " ", logicalCSS('margin-top', centeringOffset), ";;label:middle;"),
|
|
36
|
+
top: /*#__PURE__*/css(logicalCSS('top', 0), " ", logicalCSS('margin-top', buttonOffset), ";;label:top;"),
|
|
37
|
+
bottom: /*#__PURE__*/css(logicalCSS('bottom', 0), " ", logicalCSS('margin-bottom', buttonOffset), ";;label:bottom;"),
|
|
38
|
+
// `left/right` aren't valid positions for the horizontal direction,
|
|
39
|
+
// so we're using getters to fall back to the `middle` CSS
|
|
40
|
+
get left() {
|
|
41
|
+
return this.middle;
|
|
42
|
+
},
|
|
43
|
+
get right() {
|
|
44
|
+
return this.middle;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
vertical: {
|
|
48
|
+
after: /*#__PURE__*/css(logicalCSS('top', '100%'), " ", logicalCSS('margin-top', centeringOffset), ";;label:after;"),
|
|
49
|
+
before: /*#__PURE__*/css(logicalCSS('bottom', '100%'), " ", logicalCSS('margin-bottom', centeringOffset), ";;label:before;"),
|
|
50
|
+
middle: /*#__PURE__*/css(logicalCSS('left', '50%'), " ", logicalCSS('margin-left', centeringOffset), ";;label:middle;"),
|
|
51
|
+
left: /*#__PURE__*/css(logicalCSS('left', 0), " ", logicalCSS('margin-left', buttonOffset), ";;label:left;"),
|
|
52
|
+
right: /*#__PURE__*/css(logicalCSS('right', 0), " ", logicalCSS('margin-right', buttonOffset), ";;label:right;"),
|
|
53
|
+
// `top/bottom` aren't valid positions for the horizontal direction,
|
|
54
|
+
// so we're using getters to fall back to the `middle` CSS
|
|
55
|
+
get top() {
|
|
56
|
+
return this.middle;
|
|
57
|
+
},
|
|
58
|
+
get bottom() {
|
|
59
|
+
return this.middle;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
collapsed: {
|
|
64
|
+
// When collapsed, the button itself is the full collapsed area
|
|
65
|
+
// and we use flex to align the icon within
|
|
66
|
+
collapsed: /*#__PURE__*/css("border-radius:0;", logicalCSS('top', 0), ";;label:collapsed;"),
|
|
67
|
+
horizontal: /*#__PURE__*/css(logicalCSS('height', '100%'), ";;label:horizontal;"),
|
|
68
|
+
vertical: /*#__PURE__*/css(logicalCSS('width', '100%'), ";;label:vertical;"),
|
|
69
|
+
horizontalPositions: {
|
|
70
|
+
top: /*#__PURE__*/css(logicalCSS('padding-top', buttonOffset), " align-items:flex-start;;label:top;"),
|
|
71
|
+
bottom: /*#__PURE__*/css(logicalCSS('padding-bottom', buttonOffset), " align-items:flex-end;;label:bottom;"),
|
|
72
|
+
middle: /*#__PURE__*/css(";label:middle;"),
|
|
73
|
+
left: /*#__PURE__*/css(";label:left;"),
|
|
74
|
+
right: /*#__PURE__*/css(";label:right;")
|
|
75
|
+
},
|
|
76
|
+
verticalPositions: {
|
|
77
|
+
left: /*#__PURE__*/css(logicalCSS('padding-left', buttonOffset), " justify-content:flex-start;;label:left;"),
|
|
78
|
+
right: /*#__PURE__*/css(logicalCSS('padding-right', buttonOffset), " justify-content:flex-end;;label:right;"),
|
|
79
|
+
middle: /*#__PURE__*/css(";label:middle;"),
|
|
80
|
+
top: /*#__PURE__*/css(";label:top;"),
|
|
81
|
+
bottom: /*#__PURE__*/css(";label:bottom;")
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
};
|
|
@@ -40,7 +40,7 @@ export var euiStepStyles = function euiStepStyles(euiThemeContext) {
|
|
|
40
40
|
export var euiStepContentStyles = function euiStepContentStyles(euiThemeContext) {
|
|
41
41
|
var euiTheme = euiThemeContext.euiTheme;
|
|
42
42
|
var euiStep = euiStepVariables(euiTheme);
|
|
43
|
-
|
|
43
|
+
return {
|
|
44
44
|
euiStep__content: /*#__PURE__*/css(logicalCSS('margin-top', euiTheme.size.s), " ", logicalCSS('padding-top', euiTheme.size.base), " ", logicalCSS('padding-bottom', mathWithUnits([euiTheme.size.xl, euiTheme.size.s], function (x, y) {
|
|
45
45
|
return x + y;
|
|
46
46
|
})), " ", logicalCSS('padding-right', euiTheme.size.base), ";;label:euiStep__content;"),
|
|
@@ -50,16 +50,16 @@ export var euiStepContentStyles = function euiStepContentStyles(euiThemeContext)
|
|
|
50
50
|
})), logicalCSS('margin-left', mathWithUnits(euiStep.numberSize, function (x) {
|
|
51
51
|
return x / 2;
|
|
52
52
|
})), ";;label:m;"),
|
|
53
|
-
s
|
|
54
|
-
|
|
53
|
+
// `s` is the same as `m` - use a getter to duplicate its content
|
|
54
|
+
get s() {
|
|
55
|
+
return this.m;
|
|
56
|
+
},
|
|
55
57
|
xs: /*#__PURE__*/css(logicalCSS('padding-left', mathWithUnits([euiStep.numberXSSize, euiStep.numberMargin], function (x, y) {
|
|
56
58
|
return x / 2 + y;
|
|
57
59
|
})), logicalCSS('margin-left', mathWithUnits(euiStep.numberXSSize, function (x) {
|
|
58
60
|
return x / 2;
|
|
59
61
|
})), ";;label:xs;")
|
|
60
62
|
};
|
|
61
|
-
styles.s = styles.m;
|
|
62
|
-
return styles;
|
|
63
63
|
};
|
|
64
64
|
export var euiStepTitleStyles = function euiStepTitleStyles(euiThemeContext) {
|
|
65
65
|
var euiTheme = euiThemeContext.euiTheme;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import React, { useMemo } from 'react';
|
|
9
10
|
import { v1 as uuidv1 } from 'uuid';
|
|
10
|
-
import { useMemo } from 'react';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* This function returns a function to generate ids.
|
|
@@ -32,7 +32,8 @@ export function htmlIdGenerator() {
|
|
|
32
32
|
* This prevents IDs from being re-randomized on every component update.
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
// We can remove this deprecated hook once EUI no longer needs to support React 16-17
|
|
36
|
+
var useDeprecatedGeneratedHtmlId = function useDeprecatedGeneratedHtmlId() {
|
|
36
37
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
37
38
|
prefix = _ref.prefix,
|
|
38
39
|
suffix = _ref.suffix,
|
|
@@ -40,4 +41,19 @@ export var useGeneratedHtmlId = function useGeneratedHtmlId() {
|
|
|
40
41
|
return useMemo(function () {
|
|
41
42
|
return conditionalId || htmlIdGenerator(prefix)(suffix);
|
|
42
43
|
}, [conditionalId, prefix, suffix]);
|
|
43
|
-
};
|
|
44
|
+
};
|
|
45
|
+
var useNewGeneratedHtmlId = function useNewGeneratedHtmlId() {
|
|
46
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
47
|
+
_ref2$prefix = _ref2.prefix,
|
|
48
|
+
prefix = _ref2$prefix === void 0 ? '' : _ref2$prefix,
|
|
49
|
+
_ref2$suffix = _ref2.suffix,
|
|
50
|
+
suffix = _ref2$suffix === void 0 ? '' : _ref2$suffix,
|
|
51
|
+
conditionalId = _ref2.conditionalId;
|
|
52
|
+
// Using the default export and dot notation here is intentional
|
|
53
|
+
// to prevent React <18 import errors.
|
|
54
|
+
var id = React.useId();
|
|
55
|
+
return useMemo(function () {
|
|
56
|
+
return conditionalId || "".concat(prefix).concat(id).concat(suffix);
|
|
57
|
+
}, [id, conditionalId, prefix, suffix]);
|
|
58
|
+
};
|
|
59
|
+
export var useGeneratedHtmlId = 'useId' in React ? useNewGeneratedHtmlId : useDeprecatedGeneratedHtmlId;
|
|
@@ -78,7 +78,6 @@ export var euiShadowXLarge = function euiShadowXLarge(_ref9) {
|
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* slightShadowHover
|
|
81
|
-
* TODO: I think this is only used by panels/cards in the Amsterdam theme, move there
|
|
82
81
|
*/
|
|
83
82
|
export var euiSlightShadowHover = function euiSlightShadowHover(_ref11) {
|
|
84
83
|
var euiTheme = _ref11.euiTheme,
|