@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
|
@@ -5,8 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.EuiResizableButton = void 0;
|
|
9
|
-
exports.euiResizableButtonWithControls = euiResizableButtonWithControls;
|
|
8
|
+
exports.euiResizableButtonWithControls = exports.EuiResizableButtonControlled = exports.EuiResizableButton = void 0;
|
|
10
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -16,8 +15,10 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
16
15
|
var _i18n = require("../i18n");
|
|
17
16
|
var _services = require("../../services");
|
|
18
17
|
var _context = require("./context");
|
|
18
|
+
var _resizable_button = require("./resizable_button.styles");
|
|
19
19
|
var _react2 = require("@emotion/react");
|
|
20
|
-
var _excluded = ["isHorizontal", "
|
|
20
|
+
var _excluded = ["isHorizontal", "alignIndicator", "className"],
|
|
21
|
+
_excluded2 = ["registration", "id", "disabled", "onFocus"];
|
|
21
22
|
/*
|
|
22
23
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
23
24
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -27,15 +28,70 @@ var _excluded = ["isHorizontal", "className", "id", "registration", "disabled",
|
|
|
27
28
|
*/
|
|
28
29
|
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
30
|
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
|
-
|
|
31
|
+
/**
|
|
32
|
+
* A generic button for indicating/facilitating resizable content,
|
|
33
|
+
* usable outside of the EuiResizableContainer context
|
|
34
|
+
*/
|
|
35
|
+
var EuiResizableButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
31
36
|
var isHorizontal = _ref.isHorizontal,
|
|
37
|
+
_ref$alignIndicator = _ref.alignIndicator,
|
|
38
|
+
alignIndicator = _ref$alignIndicator === void 0 ? 'center' : _ref$alignIndicator,
|
|
32
39
|
className = _ref.className,
|
|
33
|
-
id = _ref.id,
|
|
34
|
-
registration = _ref.registration,
|
|
35
|
-
disabled = _ref.disabled,
|
|
36
|
-
onFocus = _ref.onFocus,
|
|
37
|
-
onBlur = _ref.onBlur,
|
|
38
40
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
41
|
+
var classes = (0, _classnames.default)('euiResizableButton', className);
|
|
42
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
43
|
+
var styles = (0, _resizable_button.euiResizableButtonStyles)(euiTheme);
|
|
44
|
+
var cssStyles = [styles.euiResizableButton, isHorizontal ? styles.horizontal : styles.vertical, styles.alignIndicator[alignIndicator]];
|
|
45
|
+
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
46
|
+
tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
|
|
47
|
+
defaults: ['Press the left or right arrow keys to adjust panels size', 'Press the up or down arrow keys to adjust panels size']
|
|
48
|
+
}, function (_ref2) {
|
|
49
|
+
var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
|
|
50
|
+
horizontalResizerAriaLabel = _ref3[0],
|
|
51
|
+
verticalResizerAriaLabel = _ref3[1];
|
|
52
|
+
return (0, _react2.jsx)("button", (0, _extends2.default)({
|
|
53
|
+
ref: ref,
|
|
54
|
+
"aria-label": isHorizontal ? horizontalResizerAriaLabel : verticalResizerAriaLabel,
|
|
55
|
+
className: classes,
|
|
56
|
+
css: cssStyles,
|
|
57
|
+
"data-test-subj": "euiResizableButton",
|
|
58
|
+
type: "button"
|
|
59
|
+
}, rest));
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
exports.EuiResizableButton = EuiResizableButton;
|
|
63
|
+
EuiResizableButton.propTypes = {
|
|
64
|
+
className: _propTypes.default.string,
|
|
65
|
+
"aria-label": _propTypes.default.string,
|
|
66
|
+
"data-test-subj": _propTypes.default.string,
|
|
67
|
+
css: _propTypes.default.any,
|
|
68
|
+
/**
|
|
69
|
+
* Defaults to displaying a resizer for vertical (y-axis) resizing.
|
|
70
|
+
* Set to `true` to display a resizer for horizontal (x-axis) resizing.
|
|
71
|
+
*/
|
|
72
|
+
isHorizontal: _propTypes.default.bool,
|
|
73
|
+
/**
|
|
74
|
+
* Specify the alignment of the initial resize indicator. Defaults to `center`,
|
|
75
|
+
* but consider using `start` for extremely tall content that scrolls off-screen
|
|
76
|
+
*/
|
|
77
|
+
alignIndicator: _propTypes.default.oneOf(["center", "start", "end"]),
|
|
78
|
+
/**
|
|
79
|
+
* When disabled, the resizer button will be completely hidden
|
|
80
|
+
*/
|
|
81
|
+
disabled: _propTypes.default.bool
|
|
82
|
+
};
|
|
83
|
+
EuiResizableButton.displayName = 'EuiResizableButton';
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Resizer button specific to controlled EuiResizableContainer usage
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
var EuiResizableButtonControlled = function EuiResizableButtonControlled(_ref4) {
|
|
90
|
+
var registration = _ref4.registration,
|
|
91
|
+
id = _ref4.id,
|
|
92
|
+
disabled = _ref4.disabled,
|
|
93
|
+
_onFocus = _ref4.onFocus,
|
|
94
|
+
rest = (0, _objectWithoutProperties2.default)(_ref4, _excluded2);
|
|
39
95
|
var resizerId = (0, _services.useGeneratedHtmlId)({
|
|
40
96
|
prefix: 'resizable-button',
|
|
41
97
|
conditionalId: id
|
|
@@ -47,13 +103,9 @@ var EuiResizableButton = function EuiResizableButton(_ref) {
|
|
|
47
103
|
} : _useEuiResizableConta2,
|
|
48
104
|
resizers = _useEuiResizableConta3.resizers;
|
|
49
105
|
var isDisabled = (0, _react.useMemo)(function () {
|
|
50
|
-
|
|
106
|
+
var _resizers$resizerId;
|
|
107
|
+
return disabled || ((_resizers$resizerId = resizers[resizerId]) === null || _resizers$resizerId === void 0 ? void 0 : _resizers$resizerId.isDisabled);
|
|
51
108
|
}, [resizers, resizerId, disabled]);
|
|
52
|
-
var classes = (0, _classnames.default)('euiResizableButton', {
|
|
53
|
-
'euiResizableButton--vertical': !isHorizontal,
|
|
54
|
-
'euiResizableButton--horizontal': isHorizontal,
|
|
55
|
-
'euiResizableButton--disabled': isDisabled
|
|
56
|
-
}, className);
|
|
57
109
|
var previousRef = (0, _react.useRef)();
|
|
58
110
|
var onRef = (0, _react.useCallback)(function (ref) {
|
|
59
111
|
if (!registration) return;
|
|
@@ -72,42 +124,22 @@ var EuiResizableButton = function EuiResizableButton(_ref) {
|
|
|
72
124
|
}
|
|
73
125
|
}
|
|
74
126
|
}, [registration, resizerId, disabled]);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
horizontalResizerAriaLabel = _ref3[0],
|
|
87
|
-
verticalResizerAriaLabel = _ref3[1];
|
|
88
|
-
return (0, _react2.jsx)("button", (0, _extends2.default)({
|
|
89
|
-
id: resizerId,
|
|
90
|
-
ref: onRef,
|
|
91
|
-
"aria-label": isHorizontal ? horizontalResizerAriaLabel : verticalResizerAriaLabel,
|
|
92
|
-
className: classes,
|
|
93
|
-
"data-test-subj": "euiResizableButton",
|
|
94
|
-
type: "button",
|
|
95
|
-
onClick: setFocus,
|
|
96
|
-
onFocus: handleFocus,
|
|
97
|
-
onBlur: onBlur,
|
|
98
|
-
disabled: isDisabled
|
|
99
|
-
}, rest));
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
exports.EuiResizableButton = EuiResizableButton;
|
|
103
|
-
EuiResizableButton.propTypes = {
|
|
104
|
-
className: _propTypes.default.string,
|
|
105
|
-
"aria-label": _propTypes.default.string,
|
|
106
|
-
"data-test-subj": _propTypes.default.string,
|
|
107
|
-
css: _propTypes.default.any
|
|
127
|
+
return (0, _react2.jsx)(EuiResizableButton, (0, _extends2.default)({
|
|
128
|
+
id: resizerId,
|
|
129
|
+
ref: onRef,
|
|
130
|
+
disabled: isDisabled,
|
|
131
|
+
onClick: function onClick(e) {
|
|
132
|
+
return e.currentTarget.focus();
|
|
133
|
+
},
|
|
134
|
+
onFocus: function onFocus() {
|
|
135
|
+
return _onFocus === null || _onFocus === void 0 ? void 0 : _onFocus(resizerId);
|
|
136
|
+
}
|
|
137
|
+
}, rest));
|
|
108
138
|
};
|
|
109
|
-
|
|
139
|
+
exports.EuiResizableButtonControlled = EuiResizableButtonControlled;
|
|
140
|
+
var euiResizableButtonWithControls = function euiResizableButtonWithControls(controls) {
|
|
110
141
|
return function (props) {
|
|
111
|
-
return (0, _react2.jsx)(
|
|
142
|
+
return (0, _react2.jsx)(EuiResizableButtonControlled, (0, _extends2.default)({}, controls, props));
|
|
112
143
|
};
|
|
113
|
-
}
|
|
144
|
+
};
|
|
145
|
+
exports.euiResizableButtonWithControls = euiResizableButtonWithControls;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiResizableButtonStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _services = require("../../services");
|
|
9
|
+
var _global_styling = require("../../global_styling");
|
|
10
|
+
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)."; } /*
|
|
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
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
18
|
+
name: "1fvu7sv-end",
|
|
19
|
+
styles: "align-items:flex-end;label:end;"
|
|
20
|
+
} : {
|
|
21
|
+
name: "1fvu7sv-end",
|
|
22
|
+
styles: "align-items:flex-end;label:end;",
|
|
23
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
24
|
+
};
|
|
25
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
26
|
+
name: "h0ntv8-start",
|
|
27
|
+
styles: "align-items:flex-start;label:start;"
|
|
28
|
+
} : {
|
|
29
|
+
name: "h0ntv8-start",
|
|
30
|
+
styles: "align-items:flex-start;label:start;",
|
|
31
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
32
|
+
};
|
|
33
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
34
|
+
name: "8391db-center",
|
|
35
|
+
styles: "align-items:center;label:center;"
|
|
36
|
+
} : {
|
|
37
|
+
name: "8391db-center",
|
|
38
|
+
styles: "align-items:center;label:center;",
|
|
39
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
40
|
+
};
|
|
41
|
+
var euiResizableButtonStyles = function euiResizableButtonStyles(euiThemeContext) {
|
|
42
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
43
|
+
var buttonSize = euiTheme.size.base;
|
|
44
|
+
var grabHandleWidth = euiTheme.size.m;
|
|
45
|
+
var grabHandleHeight = euiTheme.border.width.thin;
|
|
46
|
+
var transitionSpeed = euiTheme.animation.fast;
|
|
47
|
+
var transition = "".concat(transitionSpeed, " ease");
|
|
48
|
+
return {
|
|
49
|
+
// Mimics the "grab" icon with CSS psuedo-elements.
|
|
50
|
+
// 1. The "grab" icon transforms into a thicker straight line on :hover and :focus
|
|
51
|
+
// 2. Start/end aligned handles should have a slight margin offset that disappears on hover/focus
|
|
52
|
+
// 3. CSS hack to smooth out/anti-alias the 1px wide handles at various zoom levels
|
|
53
|
+
euiResizableButton: /*#__PURE__*/(0, _react.css)("z-index:1;flex-shrink:0;display:flex;justify-content:center;gap:", (0, _global_styling.mathWithUnits)(grabHandleHeight, function (x) {
|
|
54
|
+
return x * 2;
|
|
55
|
+
}), ";&:disabled{display:none;}&:hover,&:focus{gap:0;justify-content:center;}", _global_styling.euiCanAnimate, "{transition:gap ", transition, ",justify-content ", transition, ";}&::before,&::after{content:'';display:block;background-color:", euiTheme.colors.darkestShade, ";transform:translateZ(0);", _global_styling.euiCanAnimate, "{transition:width ", transition, ",height ", transition, ",margin ", transition, ",background-color ", transition, ";}}&:hover{&::before,&::after{background-color:", euiTheme.colors.mediumShade, ";", _global_styling.euiCanAnimate, "{transition-delay:", transitionSpeed, ";}}}&:focus,&:active{background-color:", (0, _services.transparentize)(euiTheme.colors.primary, 0.1), ";&::before,&::after{background-color:", euiTheme.colors.primary, ";", _global_styling.euiCanAnimate, "{transition:width ", transition, ",height ", transition, ";transition-delay:", (0, _global_styling.mathWithUnits)(transitionSpeed, function (x) {
|
|
56
|
+
return x / 2;
|
|
57
|
+
}), ";}}};label:euiResizableButton;"),
|
|
58
|
+
horizontal: /*#__PURE__*/(0, _react.css)("cursor:col-resize;", (0, _global_styling.logicalCSS)('height', '100%'), " ", (0, _global_styling.logicalCSS)('width', buttonSize), " margin-inline:", (0, _global_styling.mathWithUnits)(buttonSize, function (x) {
|
|
59
|
+
return x / -2;
|
|
60
|
+
}), ";&::before,&::after{", (0, _global_styling.logicalCSS)('width', grabHandleHeight), " ", (0, _global_styling.logicalCSS)('height', grabHandleWidth), " margin-block:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", (0, _global_styling.logicalCSS)('height', '100%'), " margin-block:0;transform:none;}};label:horizontal;"),
|
|
61
|
+
vertical: /*#__PURE__*/(0, _react.css)("flex-direction:column;cursor:row-resize;", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalCSS)('height', buttonSize), " margin-block:", (0, _global_styling.mathWithUnits)(buttonSize, function (x) {
|
|
62
|
+
return x / -2;
|
|
63
|
+
}), ";&::before,&::after{", (0, _global_styling.logicalCSS)('height', grabHandleHeight), " ", (0, _global_styling.logicalCSS)('width', grabHandleWidth), " margin-inline:", euiTheme.size.base, ";}&:hover,&:focus,&:active{&::before,&::after{", (0, _global_styling.logicalCSS)('width', '100%'), " margin-inline:0;transform:none;}};label:vertical;"),
|
|
64
|
+
alignIndicator: {
|
|
65
|
+
center: _ref3,
|
|
66
|
+
start: _ref2,
|
|
67
|
+
end: _ref
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
exports.euiResizableButtonStyles = euiResizableButtonStyles;
|
|
@@ -6,11 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.EuiResizableCollapseButton = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
11
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
+
var _services = require("../../services");
|
|
13
15
|
var _button = require("../button");
|
|
16
|
+
var _screen_reader_only = require("../accessibility/screen_reader_only/screen_reader_only.styles");
|
|
17
|
+
var _resizable_collapse_button = require("./resizable_collapse_button.styles");
|
|
14
18
|
var _react2 = require("@emotion/react");
|
|
15
19
|
var _excluded = ["className", "externalPosition", "internalPosition", "direction", "isVisible", "isCollapsed"];
|
|
16
20
|
/*
|
|
@@ -22,7 +26,8 @@ var _excluded = ["className", "externalPosition", "internalPosition", "direction
|
|
|
22
26
|
*/
|
|
23
27
|
var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref) {
|
|
24
28
|
var className = _ref.className,
|
|
25
|
-
externalPosition = _ref.externalPosition,
|
|
29
|
+
_ref$externalPosition = _ref.externalPosition,
|
|
30
|
+
externalPosition = _ref$externalPosition === void 0 ? 'before' : _ref$externalPosition,
|
|
26
31
|
_ref$internalPosition = _ref.internalPosition,
|
|
27
32
|
internalPosition = _ref$internalPosition === void 0 ? 'middle' : _ref$internalPosition,
|
|
28
33
|
_ref$direction = _ref.direction,
|
|
@@ -31,14 +36,15 @@ var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref) {
|
|
|
31
36
|
isCollapsed = _ref.isCollapsed,
|
|
32
37
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
33
38
|
var isHorizontal = direction === 'horizontal';
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var
|
|
41
|
-
var
|
|
39
|
+
var showOnFocus = !isCollapsed && !isVisible;
|
|
40
|
+
var screenReaderOnlyStyles = (0, _screen_reader_only.euiScreenReaderOnlyStyles)(showOnFocus).euiScreenReaderOnly;
|
|
41
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
42
|
+
var styles = (0, _resizable_collapse_button.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((0, _toConsumableArray2.default)(isCollapsed ? collapsedStyles : collapsibleStyles));
|
|
46
|
+
var COLLAPSED_ICON = '';
|
|
47
|
+
var NOT_COLLAPSED_ICON = '';
|
|
42
48
|
switch (externalPosition) {
|
|
43
49
|
case 'before':
|
|
44
50
|
COLLAPSED_ICON = isHorizontal ? 'menuLeft' : 'menuUp';
|
|
@@ -49,11 +55,13 @@ var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref) {
|
|
|
49
55
|
NOT_COLLAPSED_ICON = isHorizontal ? 'menuLeft' : 'menuUp';
|
|
50
56
|
break;
|
|
51
57
|
}
|
|
58
|
+
var classes = (0, _classnames.default)('euiResizableCollapseButton', className);
|
|
52
59
|
return (0, _react2.jsx)(_button.EuiButtonIcon, (0, _extends2.default)({
|
|
53
60
|
display: isCollapsed ? 'empty' : 'base',
|
|
54
|
-
color: "text"
|
|
55
|
-
}, rest, {
|
|
61
|
+
color: "text",
|
|
56
62
|
className: classes,
|
|
63
|
+
css: cssStyles
|
|
64
|
+
}, rest, {
|
|
57
65
|
iconType: isCollapsed ? COLLAPSED_ICON : NOT_COLLAPSED_ICON
|
|
58
66
|
}));
|
|
59
67
|
};
|
|
@@ -73,9 +81,6 @@ EuiResizableCollapseButton.propTypes = {
|
|
|
73
81
|
* Same direction derived from EuiResizableContainer
|
|
74
82
|
*/
|
|
75
83
|
direction: _propTypes.default.oneOf(["vertical", "horizontal"]),
|
|
76
|
-
/**
|
|
77
|
-
*
|
|
78
|
-
*/
|
|
79
84
|
isVisible: _propTypes.default.bool,
|
|
80
85
|
isCollapsed: _propTypes.default.bool
|
|
81
86
|
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiResizableCollapseButtonStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _global_styling = require("../../global_styling");
|
|
9
|
+
var _amsterdam = require("../../themes/amsterdam");
|
|
10
|
+
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)."; } /*
|
|
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
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
18
|
+
name: "fuwsll-euiResizableCollapseButton",
|
|
19
|
+
styles: "z-index:2;position:absolute;&:focus{animation:none;};label:euiResizableCollapseButton;"
|
|
20
|
+
} : {
|
|
21
|
+
name: "fuwsll-euiResizableCollapseButton",
|
|
22
|
+
styles: "z-index:2;position:absolute;&:focus{animation:none;};label:euiResizableCollapseButton;",
|
|
23
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
24
|
+
};
|
|
25
|
+
var euiResizableCollapseButtonStyles = function euiResizableCollapseButtonStyles(euiThemeContext) {
|
|
26
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
27
|
+
var buttonSize = euiTheme.size.l;
|
|
28
|
+
var centeringOffset = (0, _global_styling.mathWithUnits)(buttonSize, function (x) {
|
|
29
|
+
return x / -2;
|
|
30
|
+
}); // Use negative margins instead of transforms to avoid having to override EuiButtonIcon's CSS
|
|
31
|
+
var buttonOffset = euiTheme.size.base;
|
|
32
|
+
return {
|
|
33
|
+
euiResizableCollapseButton: _ref,
|
|
34
|
+
collapsible: {
|
|
35
|
+
collapsible: /*#__PURE__*/(0, _react.css)("background:", euiTheme.colors.emptyShade, ";", (0, _amsterdam.euiShadowXSmall)(euiThemeContext), " &:focus{", (0, _amsterdam.euiSlightShadowHover)(euiThemeContext), ";};label:collapsible;"),
|
|
36
|
+
horizontal: {
|
|
37
|
+
after: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', 0), " ", (0, _global_styling.logicalCSS)('margin-right', centeringOffset), ";;label:after;"),
|
|
38
|
+
before: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', 0), " ", (0, _global_styling.logicalCSS)('margin-left', centeringOffset), ";;label:before;"),
|
|
39
|
+
middle: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('top', '50%'), " ", (0, _global_styling.logicalCSS)('margin-top', centeringOffset), ";;label:middle;"),
|
|
40
|
+
top: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('top', 0), " ", (0, _global_styling.logicalCSS)('margin-top', buttonOffset), ";;label:top;"),
|
|
41
|
+
bottom: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('bottom', 0), " ", (0, _global_styling.logicalCSS)('margin-bottom', buttonOffset), ";;label:bottom;"),
|
|
42
|
+
// `left/right` aren't valid positions for the horizontal direction,
|
|
43
|
+
// so we're using getters to fall back to the `middle` CSS
|
|
44
|
+
get left() {
|
|
45
|
+
return this.middle;
|
|
46
|
+
},
|
|
47
|
+
get right() {
|
|
48
|
+
return this.middle;
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
vertical: {
|
|
52
|
+
after: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('top', '100%'), " ", (0, _global_styling.logicalCSS)('margin-top', centeringOffset), ";;label:after;"),
|
|
53
|
+
before: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('bottom', '100%'), " ", (0, _global_styling.logicalCSS)('margin-bottom', centeringOffset), ";;label:before;"),
|
|
54
|
+
middle: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', '50%'), " ", (0, _global_styling.logicalCSS)('margin-left', centeringOffset), ";;label:middle;"),
|
|
55
|
+
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', 0), " ", (0, _global_styling.logicalCSS)('margin-left', buttonOffset), ";;label:left;"),
|
|
56
|
+
right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', 0), " ", (0, _global_styling.logicalCSS)('margin-right', buttonOffset), ";;label:right;"),
|
|
57
|
+
// `top/bottom` aren't valid positions for the horizontal direction,
|
|
58
|
+
// so we're using getters to fall back to the `middle` CSS
|
|
59
|
+
get top() {
|
|
60
|
+
return this.middle;
|
|
61
|
+
},
|
|
62
|
+
get bottom() {
|
|
63
|
+
return this.middle;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
collapsed: {
|
|
68
|
+
// When collapsed, the button itself is the full collapsed area
|
|
69
|
+
// and we use flex to align the icon within
|
|
70
|
+
collapsed: /*#__PURE__*/(0, _react.css)("border-radius:0;", (0, _global_styling.logicalCSS)('top', 0), ";;label:collapsed;"),
|
|
71
|
+
horizontal: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', '100%'), ";;label:horizontal;"),
|
|
72
|
+
vertical: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('width', '100%'), ";;label:vertical;"),
|
|
73
|
+
horizontalPositions: {
|
|
74
|
+
top: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-top', buttonOffset), " align-items:flex-start;;label:top;"),
|
|
75
|
+
bottom: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-bottom', buttonOffset), " align-items:flex-end;;label:bottom;"),
|
|
76
|
+
middle: /*#__PURE__*/(0, _react.css)(";label:middle;"),
|
|
77
|
+
left: /*#__PURE__*/(0, _react.css)(";label:left;"),
|
|
78
|
+
right: /*#__PURE__*/(0, _react.css)(";label:right;")
|
|
79
|
+
},
|
|
80
|
+
verticalPositions: {
|
|
81
|
+
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-left', buttonOffset), " justify-content:flex-start;;label:left;"),
|
|
82
|
+
right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-right', buttonOffset), " justify-content:flex-end;;label:right;"),
|
|
83
|
+
middle: /*#__PURE__*/(0, _react.css)(";label:middle;"),
|
|
84
|
+
top: /*#__PURE__*/(0, _react.css)(";label:top;"),
|
|
85
|
+
bottom: /*#__PURE__*/(0, _react.css)(";label:bottom;")
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
exports.euiResizableCollapseButtonStyles = euiResizableCollapseButtonStyles;
|
|
@@ -48,7 +48,7 @@ exports.euiStepStyles = euiStepStyles;
|
|
|
48
48
|
var euiStepContentStyles = function euiStepContentStyles(euiThemeContext) {
|
|
49
49
|
var euiTheme = euiThemeContext.euiTheme;
|
|
50
50
|
var euiStep = euiStepVariables(euiTheme);
|
|
51
|
-
|
|
51
|
+
return {
|
|
52
52
|
euiStep__content: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-top', euiTheme.size.s), " ", (0, _global_styling.logicalCSS)('padding-top', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-bottom', (0, _global_styling.mathWithUnits)([euiTheme.size.xl, euiTheme.size.s], function (x, y) {
|
|
53
53
|
return x + y;
|
|
54
54
|
})), " ", (0, _global_styling.logicalCSS)('padding-right', euiTheme.size.base), ";;label:euiStep__content;"),
|
|
@@ -58,16 +58,16 @@ var euiStepContentStyles = function euiStepContentStyles(euiThemeContext) {
|
|
|
58
58
|
})), (0, _global_styling.logicalCSS)('margin-left', (0, _global_styling.mathWithUnits)(euiStep.numberSize, function (x) {
|
|
59
59
|
return x / 2;
|
|
60
60
|
})), ";;label:m;"),
|
|
61
|
-
s
|
|
62
|
-
|
|
61
|
+
// `s` is the same as `m` - use a getter to duplicate its content
|
|
62
|
+
get s() {
|
|
63
|
+
return this.m;
|
|
64
|
+
},
|
|
63
65
|
xs: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-left', (0, _global_styling.mathWithUnits)([euiStep.numberXSSize, euiStep.numberMargin], function (x, y) {
|
|
64
66
|
return x / 2 + y;
|
|
65
67
|
})), (0, _global_styling.logicalCSS)('margin-left', (0, _global_styling.mathWithUnits)(euiStep.numberXSSize, function (x) {
|
|
66
68
|
return x / 2;
|
|
67
69
|
})), ";;label:xs;")
|
|
68
70
|
};
|
|
69
|
-
styles.s = styles.m;
|
|
70
|
-
return styles;
|
|
71
71
|
};
|
|
72
72
|
exports.euiStepContentStyles = euiStepContentStyles;
|
|
73
73
|
var euiStepTitleStyles = function euiStepTitleStyles(euiThemeContext) {
|
|
@@ -87,7 +87,6 @@ var euiShadowXLarge = function euiShadowXLarge(_ref9) {
|
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
* slightShadowHover
|
|
90
|
-
* TODO: I think this is only used by panels/cards in the Amsterdam theme, move there
|
|
91
90
|
*/
|
|
92
91
|
exports.euiShadowXLarge = euiShadowXLarge;
|
|
93
92
|
var euiSlightShadowHover = function euiSlightShadowHover(_ref11) {
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
// Mimics the "grab" icon with CSS psuedo-elements.
|
|
2
|
-
// The "grab" icon transforms into a 2px straight line on :hover and :focus.
|
|
3
|
-
.euiResizableButton {
|
|
4
|
-
position: relative;
|
|
5
|
-
flex-shrink: 0;
|
|
6
|
-
z-index: 1;
|
|
7
|
-
|
|
8
|
-
&::before,
|
|
9
|
-
&::after {
|
|
10
|
-
content: '';
|
|
11
|
-
display: block;
|
|
12
|
-
position: absolute;
|
|
13
|
-
top: 50%;
|
|
14
|
-
left: 50%;
|
|
15
|
-
background-color: $euiColorDarkestShade;
|
|
16
|
-
transition:
|
|
17
|
-
width $euiResizableButtonTransitionSpeed ease,
|
|
18
|
-
height $euiResizableButtonTransitionSpeed ease,
|
|
19
|
-
transform $euiResizableButtonTransitionSpeed ease,
|
|
20
|
-
background-color $euiResizableButtonTransitionSpeed ease
|
|
21
|
-
;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
&.euiResizableButton--horizontal {
|
|
25
|
-
cursor: col-resize;
|
|
26
|
-
width: $euiResizableButtonSize;
|
|
27
|
-
margin-left: -($euiResizableButtonSize / 2);
|
|
28
|
-
margin-right: -($euiResizableButtonSize / 2);
|
|
29
|
-
|
|
30
|
-
&::before,
|
|
31
|
-
&::after {
|
|
32
|
-
width: 1px;
|
|
33
|
-
height: $euiSizeM;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&::before {
|
|
37
|
-
transform: translate(-2px, -50%);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&::after {
|
|
41
|
-
transform: translate(1px, -50%);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&.euiResizableButton--vertical {
|
|
46
|
-
cursor: row-resize;
|
|
47
|
-
height: $euiResizableButtonSize;
|
|
48
|
-
margin-top: -($euiResizableButtonSize / 2);
|
|
49
|
-
margin-bottom: -($euiResizableButtonSize / 2);
|
|
50
|
-
|
|
51
|
-
&::before,
|
|
52
|
-
&::after {
|
|
53
|
-
width: $euiSizeM;
|
|
54
|
-
height: 1px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
&::before {
|
|
58
|
-
transform: translate(-50%, -2px);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
&::after {
|
|
62
|
-
transform: translate(-50%, 1px);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Lighten the "grab" icon on :hover
|
|
67
|
-
&:hover:not(:disabled) {
|
|
68
|
-
&::before,
|
|
69
|
-
&::after {
|
|
70
|
-
background-color: $euiColorMediumShade;
|
|
71
|
-
transition-delay: $euiResizableButtonTransitionSpeed; // Delay transition on hover so animation is not accidentally triggered on mouse over
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Add a transparent background to the container and emphasis the "grab" icon with primary color on :focus
|
|
76
|
-
&:focus:not(:disabled) {
|
|
77
|
-
background-color: transparentize($euiColorPrimary, .9);
|
|
78
|
-
|
|
79
|
-
&::before,
|
|
80
|
-
&::after {
|
|
81
|
-
background-color: $euiColorPrimary;
|
|
82
|
-
// Overrides default transition so that "grab" icon background-color doesn't animate
|
|
83
|
-
transition:
|
|
84
|
-
width $euiResizableButtonTransitionSpeed ease,
|
|
85
|
-
height $euiResizableButtonTransitionSpeed ease,
|
|
86
|
-
transform $euiResizableButtonTransitionSpeed ease
|
|
87
|
-
;
|
|
88
|
-
transition-delay: $euiResizableButtonTransitionSpeed / 2;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Morph the "grab" icon into a fluid 2px straight line on :hover and :focus
|
|
93
|
-
&:hover:not(:disabled),
|
|
94
|
-
&:focus:not(:disabled) {
|
|
95
|
-
&.euiResizableButton--horizontal {
|
|
96
|
-
&::before,
|
|
97
|
-
&::after {
|
|
98
|
-
height: 100%;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
&::before {
|
|
102
|
-
transform: translate(-1px, -50%);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
&::after {
|
|
106
|
-
transform: translate(0, -50%);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
&.euiResizableButton--vertical {
|
|
111
|
-
&::before,
|
|
112
|
-
&::after {
|
|
113
|
-
width: 100%;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
&::before {
|
|
117
|
-
transform: translate(-50%, -1px);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
&::after {
|
|
121
|
-
transform: translate(-50%, 0);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
&:disabled {
|
|
127
|
-
display: none !important; // stylelint-disable-line declaration-no-important
|
|
128
|
-
}
|
|
129
|
-
}
|