@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
package/eui.d.ts
CHANGED
|
@@ -1699,7 +1699,6 @@ declare module '@elastic/eui/src/themes/amsterdam/global_styling/mixins/shadow'
|
|
|
1699
1699
|
export const euiShadowXLarge: ({ euiTheme, colorMode }: UseEuiTheme, { color: _color, reverse }?: EuiShadowXLarge) => string;
|
|
1700
1700
|
/**
|
|
1701
1701
|
* slightShadowHover
|
|
1702
|
-
* TODO: I think this is only used by panels/cards in the Amsterdam theme, move there
|
|
1703
1702
|
*/
|
|
1704
1703
|
export const euiSlightShadowHover: ({ euiTheme, colorMode }: UseEuiTheme, { color: _color }?: _EuiThemeShadowCustomColor) => string;
|
|
1705
1704
|
export const useEuiSlightShadowHover: (color?: _EuiThemeShadowCustomColor['color']) => string;
|
|
@@ -20688,7 +20687,7 @@ declare module '@elastic/eui/src/components/steps/step.styles' {
|
|
|
20688
20687
|
export const euiStepContentStyles: (euiThemeContext: UseEuiTheme) => {
|
|
20689
20688
|
euiStep__content: import("@emotion/utils").SerializedStyles;
|
|
20690
20689
|
m: import("@emotion/utils").SerializedStyles;
|
|
20691
|
-
s: import("@emotion/utils").SerializedStyles;
|
|
20690
|
+
readonly s: import("@emotion/utils").SerializedStyles;
|
|
20692
20691
|
xs: import("@emotion/utils").SerializedStyles;
|
|
20693
20692
|
};
|
|
20694
20693
|
export const euiStepTitleStyles: (euiThemeContext: UseEuiTheme) => {
|
|
@@ -22214,29 +22213,125 @@ declare module '@elastic/eui/src/components/resizable_container/context' {
|
|
|
22214
22213
|
export const useEuiResizableContainerContext: () => ContainerContextProps;
|
|
22215
22214
|
export {};
|
|
22216
22215
|
|
|
22216
|
+
}
|
|
22217
|
+
declare module '@elastic/eui/src/components/resizable_container/resizable_button.styles' {
|
|
22218
|
+
import { UseEuiTheme } from '@elastic/eui/src/services';
|
|
22219
|
+
export const euiResizableButtonStyles: (euiThemeContext: UseEuiTheme) => {
|
|
22220
|
+
euiResizableButton: import("@emotion/utils").SerializedStyles;
|
|
22221
|
+
horizontal: import("@emotion/utils").SerializedStyles;
|
|
22222
|
+
vertical: import("@emotion/utils").SerializedStyles;
|
|
22223
|
+
alignIndicator: {
|
|
22224
|
+
center: import("@emotion/utils").SerializedStyles;
|
|
22225
|
+
start: import("@emotion/utils").SerializedStyles;
|
|
22226
|
+
end: import("@emotion/utils").SerializedStyles;
|
|
22227
|
+
};
|
|
22228
|
+
};
|
|
22229
|
+
|
|
22217
22230
|
}
|
|
22218
22231
|
declare module '@elastic/eui/src/components/resizable_container/resizable_button' {
|
|
22219
22232
|
import React, { FunctionComponent, ButtonHTMLAttributes } from 'react';
|
|
22220
22233
|
import { CommonProps } from '@elastic/eui/src/components/common';
|
|
22221
22234
|
import { EuiResizableButtonController, EuiResizableButtonMouseEvent, EuiResizableButtonKeyEvent } from '@elastic/eui/src/components/resizable_container/types';
|
|
22222
|
-
|
|
22223
|
-
|
|
22224
|
-
|
|
22225
|
-
|
|
22226
|
-
|
|
22227
|
-
|
|
22228
|
-
|
|
22235
|
+
export type EuiResizableButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & CommonProps & {
|
|
22236
|
+
/**
|
|
22237
|
+
* Defaults to displaying a resizer for vertical (y-axis) resizing.
|
|
22238
|
+
* Set to `true` to display a resizer for horizontal (x-axis) resizing.
|
|
22239
|
+
*/
|
|
22240
|
+
isHorizontal?: boolean;
|
|
22241
|
+
/**
|
|
22242
|
+
* Specify the alignment of the initial resize indicator. Defaults to `center`,
|
|
22243
|
+
* but consider using `start` for extremely tall content that scrolls off-screen
|
|
22244
|
+
*/
|
|
22245
|
+
alignIndicator?: 'center' | 'start' | 'end';
|
|
22246
|
+
/**
|
|
22247
|
+
* When disabled, the resizer button will be completely hidden
|
|
22248
|
+
*/
|
|
22249
|
+
disabled?: boolean;
|
|
22250
|
+
};
|
|
22251
|
+
/**
|
|
22252
|
+
* A generic button for indicating/facilitating resizable content,
|
|
22253
|
+
* usable outside of the EuiResizableContainer context
|
|
22254
|
+
*/
|
|
22255
|
+
export const EuiResizableButton: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & CommonProps & {
|
|
22256
|
+
/**
|
|
22257
|
+
* Defaults to displaying a resizer for vertical (y-axis) resizing.
|
|
22258
|
+
* Set to `true` to display a resizer for horizontal (x-axis) resizing.
|
|
22259
|
+
*/
|
|
22260
|
+
isHorizontal?: boolean | undefined;
|
|
22261
|
+
/**
|
|
22262
|
+
* Specify the alignment of the initial resize indicator. Defaults to `center`,
|
|
22263
|
+
* but consider using `start` for extremely tall content that scrolls off-screen
|
|
22264
|
+
*/
|
|
22265
|
+
alignIndicator?: "center" | "start" | "end" | undefined;
|
|
22266
|
+
/**
|
|
22267
|
+
* When disabled, the resizer button will be completely hidden
|
|
22268
|
+
*/
|
|
22269
|
+
disabled?: boolean | undefined;
|
|
22270
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
22271
|
+
/**
|
|
22272
|
+
* Resizer button specific to controlled EuiResizableContainer usage
|
|
22273
|
+
*/
|
|
22274
|
+
export type EuiResizableButtonControls = Omit<EuiResizableButtonProps, 'onFocus'> & {
|
|
22229
22275
|
registration: {
|
|
22230
22276
|
register: (resizer: EuiResizableButtonController) => void;
|
|
22231
22277
|
deregister: (resizerId: EuiResizableButtonController['id']) => void;
|
|
22232
22278
|
};
|
|
22233
|
-
|
|
22234
|
-
|
|
22235
|
-
|
|
22236
|
-
|
|
22237
|
-
|
|
22238
|
-
|
|
22239
|
-
|
|
22279
|
+
onKeyDown: (e: EuiResizableButtonKeyEvent) => void;
|
|
22280
|
+
onKeyUp: (e: EuiResizableButtonKeyEvent) => void;
|
|
22281
|
+
onMouseDown: (e: EuiResizableButtonMouseEvent) => void;
|
|
22282
|
+
onTouchStart: (e: EuiResizableButtonMouseEvent) => void;
|
|
22283
|
+
onBlur: () => void;
|
|
22284
|
+
onFocus: (id: string) => void;
|
|
22285
|
+
};
|
|
22286
|
+
export const EuiResizableButtonControlled: FunctionComponent<Partial<EuiResizableButtonControls>>;
|
|
22287
|
+
export const euiResizableButtonWithControls: (controls: EuiResizableButtonControls) => (props: CommonProps) => React.JSX.Element;
|
|
22288
|
+
|
|
22289
|
+
}
|
|
22290
|
+
declare module '@elastic/eui/src/components/resizable_container/resizable_collapse_button.styles' {
|
|
22291
|
+
import { UseEuiTheme } from '@elastic/eui/src/services';
|
|
22292
|
+
export const euiResizableCollapseButtonStyles: (euiThemeContext: UseEuiTheme) => {
|
|
22293
|
+
euiResizableCollapseButton: import("@emotion/utils").SerializedStyles;
|
|
22294
|
+
collapsible: {
|
|
22295
|
+
collapsible: import("@emotion/utils").SerializedStyles;
|
|
22296
|
+
horizontal: {
|
|
22297
|
+
after: import("@emotion/utils").SerializedStyles;
|
|
22298
|
+
before: import("@emotion/utils").SerializedStyles;
|
|
22299
|
+
middle: import("@emotion/utils").SerializedStyles;
|
|
22300
|
+
top: import("@emotion/utils").SerializedStyles;
|
|
22301
|
+
bottom: import("@emotion/utils").SerializedStyles;
|
|
22302
|
+
readonly left: import("@emotion/utils").SerializedStyles;
|
|
22303
|
+
readonly right: import("@emotion/utils").SerializedStyles;
|
|
22304
|
+
};
|
|
22305
|
+
vertical: {
|
|
22306
|
+
after: import("@emotion/utils").SerializedStyles;
|
|
22307
|
+
before: import("@emotion/utils").SerializedStyles;
|
|
22308
|
+
middle: import("@emotion/utils").SerializedStyles;
|
|
22309
|
+
left: import("@emotion/utils").SerializedStyles;
|
|
22310
|
+
right: import("@emotion/utils").SerializedStyles;
|
|
22311
|
+
readonly top: import("@emotion/utils").SerializedStyles;
|
|
22312
|
+
readonly bottom: import("@emotion/utils").SerializedStyles;
|
|
22313
|
+
};
|
|
22314
|
+
};
|
|
22315
|
+
collapsed: {
|
|
22316
|
+
collapsed: import("@emotion/utils").SerializedStyles;
|
|
22317
|
+
horizontal: import("@emotion/utils").SerializedStyles;
|
|
22318
|
+
vertical: import("@emotion/utils").SerializedStyles;
|
|
22319
|
+
horizontalPositions: {
|
|
22320
|
+
top: import("@emotion/utils").SerializedStyles;
|
|
22321
|
+
bottom: import("@emotion/utils").SerializedStyles;
|
|
22322
|
+
middle: import("@emotion/utils").SerializedStyles;
|
|
22323
|
+
left: import("@emotion/utils").SerializedStyles;
|
|
22324
|
+
right: import("@emotion/utils").SerializedStyles;
|
|
22325
|
+
};
|
|
22326
|
+
verticalPositions: {
|
|
22327
|
+
left: import("@emotion/utils").SerializedStyles;
|
|
22328
|
+
right: import("@emotion/utils").SerializedStyles;
|
|
22329
|
+
middle: import("@emotion/utils").SerializedStyles;
|
|
22330
|
+
top: import("@emotion/utils").SerializedStyles;
|
|
22331
|
+
bottom: import("@emotion/utils").SerializedStyles;
|
|
22332
|
+
};
|
|
22333
|
+
};
|
|
22334
|
+
};
|
|
22240
22335
|
|
|
22241
22336
|
}
|
|
22242
22337
|
declare module '@elastic/eui/src/components/resizable_container/resizable_collapse_button' {
|
|
@@ -22259,9 +22354,6 @@ declare module '@elastic/eui/src/components/resizable_container/resizable_collap
|
|
|
22259
22354
|
* Same direction derived from EuiResizableContainer
|
|
22260
22355
|
*/
|
|
22261
22356
|
direction?: EuiResizableContainerProps['direction'];
|
|
22262
|
-
/**
|
|
22263
|
-
*
|
|
22264
|
-
*/
|
|
22265
22357
|
isVisible?: boolean;
|
|
22266
22358
|
isCollapsed?: boolean;
|
|
22267
22359
|
};
|
|
@@ -22452,6 +22544,8 @@ declare module '@elastic/eui/src/components/resizable_container/resizable_contai
|
|
|
22452
22544
|
declare module '@elastic/eui/src/components/resizable_container' {
|
|
22453
22545
|
export type { EuiResizableContainerProps } from '@elastic/eui/src/components/resizable_container/resizable_container';
|
|
22454
22546
|
export { EuiResizableContainer } from '@elastic/eui/src/components/resizable_container/resizable_container';
|
|
22547
|
+
export type { EuiResizableButtonProps } from '@elastic/eui/src/components/resizable_container/resizable_button';
|
|
22548
|
+
export { EuiResizableButton } from '@elastic/eui/src/components/resizable_container/resizable_button';
|
|
22455
22549
|
|
|
22456
22550
|
}
|
|
22457
22551
|
declare module '@elastic/eui/src/components' {
|
package/i18ntokens.json
CHANGED
|
@@ -6067,36 +6067,36 @@
|
|
|
6067
6067
|
},
|
|
6068
6068
|
{
|
|
6069
6069
|
"token": "euiResizableButton.horizontalResizerAriaLabel",
|
|
6070
|
-
"defString": "Press left or right to adjust panels size",
|
|
6070
|
+
"defString": "Press the left or right arrow keys to adjust panels size",
|
|
6071
6071
|
"highlighting": "string",
|
|
6072
6072
|
"loc": {
|
|
6073
6073
|
"start": {
|
|
6074
|
-
"line":
|
|
6074
|
+
"line": 69,
|
|
6075
6075
|
"column": 4,
|
|
6076
|
-
"index":
|
|
6076
|
+
"index": 2211
|
|
6077
6077
|
},
|
|
6078
6078
|
"end": {
|
|
6079
|
-
"line":
|
|
6079
|
+
"line": 78,
|
|
6080
6080
|
"column": 5,
|
|
6081
|
-
"index":
|
|
6081
|
+
"index": 2522
|
|
6082
6082
|
}
|
|
6083
6083
|
},
|
|
6084
6084
|
"filepath": "src/components/resizable_container/resizable_button.tsx"
|
|
6085
6085
|
},
|
|
6086
6086
|
{
|
|
6087
6087
|
"token": "euiResizableButton.verticalResizerAriaLabel",
|
|
6088
|
-
"defString": "Press up or down to adjust panels size",
|
|
6088
|
+
"defString": "Press the up or down arrow keys to adjust panels size",
|
|
6089
6089
|
"highlighting": "string",
|
|
6090
6090
|
"loc": {
|
|
6091
6091
|
"start": {
|
|
6092
|
-
"line":
|
|
6092
|
+
"line": 69,
|
|
6093
6093
|
"column": 4,
|
|
6094
|
-
"index":
|
|
6094
|
+
"index": 2211
|
|
6095
6095
|
},
|
|
6096
6096
|
"end": {
|
|
6097
|
-
"line":
|
|
6097
|
+
"line": 78,
|
|
6098
6098
|
"column": 5,
|
|
6099
|
-
"index":
|
|
6099
|
+
"index": 2522
|
|
6100
6100
|
}
|
|
6101
6101
|
},
|
|
6102
6102
|
"filepath": "src/components/resizable_container/resizable_button.tsx"
|
|
@@ -135,7 +135,8 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
|
|
|
135
135
|
return {
|
|
136
136
|
restrictWidth: restrictWidth,
|
|
137
137
|
paddingSize: paddingSize,
|
|
138
|
-
|
|
138
|
+
// pageInnerId may contain colons that are parsed as pseudo-elements if not escaped
|
|
139
|
+
parent: "#".concat(CSS.escape(pageInnerId))
|
|
139
140
|
};
|
|
140
141
|
};
|
|
141
142
|
var innerPanelled = function innerPanelled() {
|
|
@@ -3,10 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "EuiResizableButton", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _resizable_button.EuiResizableButton;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "EuiResizableContainer", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function get() {
|
|
9
15
|
return _resizable_container.EuiResizableContainer;
|
|
10
16
|
}
|
|
11
17
|
});
|
|
12
|
-
var _resizable_container = require("./resizable_container");
|
|
18
|
+
var _resizable_container = require("./resizable_container");
|
|
19
|
+
var _resizable_button = require("./resizable_button");
|
|
@@ -4,16 +4,17 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.EuiResizableButton = void 0;
|
|
8
|
-
exports.euiResizableButtonWithControls = euiResizableButtonWithControls;
|
|
7
|
+
exports.euiResizableButtonWithControls = exports.EuiResizableButtonControlled = exports.EuiResizableButton = void 0;
|
|
9
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
11
|
var _i18n = require("../i18n");
|
|
13
12
|
var _services = require("../../services");
|
|
14
13
|
var _context = require("./context");
|
|
14
|
+
var _resizable_button = require("./resizable_button.styles");
|
|
15
15
|
var _react2 = require("@emotion/react");
|
|
16
|
-
var _excluded = ["isHorizontal", "
|
|
16
|
+
var _excluded = ["isHorizontal", "alignIndicator", "className"],
|
|
17
|
+
_excluded2 = ["registration", "id", "disabled", "onFocus"];
|
|
17
18
|
/*
|
|
18
19
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
19
20
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -33,15 +34,70 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
33
34
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
34
35
|
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; }
|
|
35
36
|
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; }
|
|
36
|
-
|
|
37
|
+
/**
|
|
38
|
+
* A generic button for indicating/facilitating resizable content,
|
|
39
|
+
* usable outside of the EuiResizableContainer context
|
|
40
|
+
*/
|
|
41
|
+
var EuiResizableButton = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
37
42
|
var isHorizontal = _ref.isHorizontal,
|
|
43
|
+
_ref$alignIndicator = _ref.alignIndicator,
|
|
44
|
+
alignIndicator = _ref$alignIndicator === void 0 ? 'center' : _ref$alignIndicator,
|
|
38
45
|
className = _ref.className,
|
|
39
|
-
id = _ref.id,
|
|
40
|
-
registration = _ref.registration,
|
|
41
|
-
disabled = _ref.disabled,
|
|
42
|
-
onFocus = _ref.onFocus,
|
|
43
|
-
onBlur = _ref.onBlur,
|
|
44
46
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
47
|
+
var classes = (0, _classnames.default)('euiResizableButton', className);
|
|
48
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
49
|
+
var styles = (0, _resizable_button.euiResizableButtonStyles)(euiTheme);
|
|
50
|
+
var cssStyles = [styles.euiResizableButton, isHorizontal ? styles.horizontal : styles.vertical, styles.alignIndicator[alignIndicator]];
|
|
51
|
+
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
52
|
+
tokens: ['euiResizableButton.horizontalResizerAriaLabel', 'euiResizableButton.verticalResizerAriaLabel'],
|
|
53
|
+
defaults: ['Press the left or right arrow keys to adjust panels size', 'Press the up or down arrow keys to adjust panels size']
|
|
54
|
+
}, function (_ref2) {
|
|
55
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
56
|
+
horizontalResizerAriaLabel = _ref3[0],
|
|
57
|
+
verticalResizerAriaLabel = _ref3[1];
|
|
58
|
+
return (0, _react2.jsx)("button", _extends({
|
|
59
|
+
ref: ref,
|
|
60
|
+
"aria-label": isHorizontal ? horizontalResizerAriaLabel : verticalResizerAriaLabel,
|
|
61
|
+
className: classes,
|
|
62
|
+
css: cssStyles,
|
|
63
|
+
"data-test-subj": "euiResizableButton",
|
|
64
|
+
type: "button"
|
|
65
|
+
}, rest));
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
exports.EuiResizableButton = EuiResizableButton;
|
|
69
|
+
EuiResizableButton.propTypes = {
|
|
70
|
+
className: _propTypes.default.string,
|
|
71
|
+
"aria-label": _propTypes.default.string,
|
|
72
|
+
"data-test-subj": _propTypes.default.string,
|
|
73
|
+
css: _propTypes.default.any,
|
|
74
|
+
/**
|
|
75
|
+
* Defaults to displaying a resizer for vertical (y-axis) resizing.
|
|
76
|
+
* Set to `true` to display a resizer for horizontal (x-axis) resizing.
|
|
77
|
+
*/
|
|
78
|
+
isHorizontal: _propTypes.default.bool,
|
|
79
|
+
/**
|
|
80
|
+
* Specify the alignment of the initial resize indicator. Defaults to `center`,
|
|
81
|
+
* but consider using `start` for extremely tall content that scrolls off-screen
|
|
82
|
+
*/
|
|
83
|
+
alignIndicator: _propTypes.default.oneOf(["center", "start", "end"]),
|
|
84
|
+
/**
|
|
85
|
+
* When disabled, the resizer button will be completely hidden
|
|
86
|
+
*/
|
|
87
|
+
disabled: _propTypes.default.bool
|
|
88
|
+
};
|
|
89
|
+
EuiResizableButton.displayName = 'EuiResizableButton';
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Resizer button specific to controlled EuiResizableContainer usage
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
var EuiResizableButtonControlled = function EuiResizableButtonControlled(_ref4) {
|
|
96
|
+
var registration = _ref4.registration,
|
|
97
|
+
id = _ref4.id,
|
|
98
|
+
disabled = _ref4.disabled,
|
|
99
|
+
_onFocus = _ref4.onFocus,
|
|
100
|
+
rest = _objectWithoutProperties(_ref4, _excluded2);
|
|
45
101
|
var resizerId = (0, _services.useGeneratedHtmlId)({
|
|
46
102
|
prefix: 'resizable-button',
|
|
47
103
|
conditionalId: id
|
|
@@ -53,13 +109,9 @@ var EuiResizableButton = function EuiResizableButton(_ref) {
|
|
|
53
109
|
} : _useEuiResizableConta2,
|
|
54
110
|
resizers = _useEuiResizableConta3.resizers;
|
|
55
111
|
var isDisabled = (0, _react.useMemo)(function () {
|
|
56
|
-
|
|
112
|
+
var _resizers$resizerId;
|
|
113
|
+
return disabled || ((_resizers$resizerId = resizers[resizerId]) === null || _resizers$resizerId === void 0 ? void 0 : _resizers$resizerId.isDisabled);
|
|
57
114
|
}, [resizers, resizerId, disabled]);
|
|
58
|
-
var classes = (0, _classnames.default)('euiResizableButton', {
|
|
59
|
-
'euiResizableButton--vertical': !isHorizontal,
|
|
60
|
-
'euiResizableButton--horizontal': isHorizontal,
|
|
61
|
-
'euiResizableButton--disabled': isDisabled
|
|
62
|
-
}, className);
|
|
63
115
|
var previousRef = (0, _react.useRef)();
|
|
64
116
|
var onRef = (0, _react.useCallback)(function (ref) {
|
|
65
117
|
if (!registration) return;
|
|
@@ -78,42 +130,22 @@ var EuiResizableButton = function EuiResizableButton(_ref) {
|
|
|
78
130
|
}
|
|
79
131
|
}
|
|
80
132
|
}, [registration, resizerId, disabled]);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
horizontalResizerAriaLabel = _ref3[0],
|
|
93
|
-
verticalResizerAriaLabel = _ref3[1];
|
|
94
|
-
return (0, _react2.jsx)("button", _extends({
|
|
95
|
-
id: resizerId,
|
|
96
|
-
ref: onRef,
|
|
97
|
-
"aria-label": isHorizontal ? horizontalResizerAriaLabel : verticalResizerAriaLabel,
|
|
98
|
-
className: classes,
|
|
99
|
-
"data-test-subj": "euiResizableButton",
|
|
100
|
-
type: "button",
|
|
101
|
-
onClick: setFocus,
|
|
102
|
-
onFocus: handleFocus,
|
|
103
|
-
onBlur: onBlur,
|
|
104
|
-
disabled: isDisabled
|
|
105
|
-
}, rest));
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
exports.EuiResizableButton = EuiResizableButton;
|
|
109
|
-
EuiResizableButton.propTypes = {
|
|
110
|
-
className: _propTypes.default.string,
|
|
111
|
-
"aria-label": _propTypes.default.string,
|
|
112
|
-
"data-test-subj": _propTypes.default.string,
|
|
113
|
-
css: _propTypes.default.any
|
|
133
|
+
return (0, _react2.jsx)(EuiResizableButton, _extends({
|
|
134
|
+
id: resizerId,
|
|
135
|
+
ref: onRef,
|
|
136
|
+
disabled: isDisabled,
|
|
137
|
+
onClick: function onClick(e) {
|
|
138
|
+
return e.currentTarget.focus();
|
|
139
|
+
},
|
|
140
|
+
onFocus: function onFocus() {
|
|
141
|
+
return _onFocus === null || _onFocus === void 0 ? void 0 : _onFocus(resizerId);
|
|
142
|
+
}
|
|
143
|
+
}, rest));
|
|
114
144
|
};
|
|
115
|
-
|
|
145
|
+
exports.EuiResizableButtonControlled = EuiResizableButtonControlled;
|
|
146
|
+
var euiResizableButtonWithControls = function euiResizableButtonWithControls(controls) {
|
|
116
147
|
return function (props) {
|
|
117
|
-
return (0, _react2.jsx)(
|
|
148
|
+
return (0, _react2.jsx)(EuiResizableButtonControlled, _extends({}, controls, props));
|
|
118
149
|
};
|
|
119
|
-
}
|
|
150
|
+
};
|
|
151
|
+
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;
|
|
@@ -7,7 +7,10 @@ exports.EuiResizableCollapseButton = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _services = require("../../services");
|
|
10
11
|
var _button = require("../button");
|
|
12
|
+
var _screen_reader_only = require("../accessibility/screen_reader_only/screen_reader_only.styles");
|
|
13
|
+
var _resizable_collapse_button = require("./resizable_collapse_button.styles");
|
|
11
14
|
var _react2 = require("@emotion/react");
|
|
12
15
|
var _excluded = ["className", "externalPosition", "internalPosition", "direction", "isVisible", "isCollapsed"];
|
|
13
16
|
/*
|
|
@@ -19,11 +22,18 @@ var _excluded = ["className", "externalPosition", "internalPosition", "direction
|
|
|
19
22
|
*/
|
|
20
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
24
|
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); }
|
|
25
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
26
|
+
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."); }
|
|
27
|
+
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); }
|
|
28
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
29
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
30
|
+
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; }
|
|
22
31
|
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; }
|
|
23
32
|
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; }
|
|
24
33
|
var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref) {
|
|
25
34
|
var className = _ref.className,
|
|
26
|
-
externalPosition = _ref.externalPosition,
|
|
35
|
+
_ref$externalPosition = _ref.externalPosition,
|
|
36
|
+
externalPosition = _ref$externalPosition === void 0 ? 'before' : _ref$externalPosition,
|
|
27
37
|
_ref$internalPosition = _ref.internalPosition,
|
|
28
38
|
internalPosition = _ref$internalPosition === void 0 ? 'middle' : _ref$internalPosition,
|
|
29
39
|
_ref$direction = _ref.direction,
|
|
@@ -32,14 +42,15 @@ var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref) {
|
|
|
32
42
|
isCollapsed = _ref.isCollapsed,
|
|
33
43
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
44
|
var isHorizontal = direction === 'horizontal';
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
var
|
|
45
|
+
var showOnFocus = !isCollapsed && !isVisible;
|
|
46
|
+
var screenReaderOnlyStyles = (0, _screen_reader_only.euiScreenReaderOnlyStyles)(showOnFocus).euiScreenReaderOnly;
|
|
47
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
48
|
+
var styles = (0, _resizable_collapse_button.euiResizableCollapseButtonStyles)(euiTheme);
|
|
49
|
+
var collapsedStyles = [styles.collapsed.collapsed, styles.collapsed[direction], styles.collapsed["".concat(direction, "Positions")][internalPosition]];
|
|
50
|
+
var collapsibleStyles = [styles.collapsible.collapsible, styles.collapsible[direction][externalPosition], styles.collapsible[direction][internalPosition]];
|
|
51
|
+
var cssStyles = [styles.euiResizableCollapseButton, showOnFocus && screenReaderOnlyStyles].concat(_toConsumableArray(isCollapsed ? collapsedStyles : collapsibleStyles));
|
|
52
|
+
var COLLAPSED_ICON = '';
|
|
53
|
+
var NOT_COLLAPSED_ICON = '';
|
|
43
54
|
switch (externalPosition) {
|
|
44
55
|
case 'before':
|
|
45
56
|
COLLAPSED_ICON = isHorizontal ? 'menuLeft' : 'menuUp';
|
|
@@ -50,11 +61,13 @@ var EuiResizableCollapseButton = function EuiResizableCollapseButton(_ref) {
|
|
|
50
61
|
NOT_COLLAPSED_ICON = isHorizontal ? 'menuLeft' : 'menuUp';
|
|
51
62
|
break;
|
|
52
63
|
}
|
|
64
|
+
var classes = (0, _classnames.default)('euiResizableCollapseButton', className);
|
|
53
65
|
return (0, _react2.jsx)(_button.EuiButtonIcon, _extends({
|
|
54
66
|
display: isCollapsed ? 'empty' : 'base',
|
|
55
|
-
color: "text"
|
|
56
|
-
}, rest, {
|
|
67
|
+
color: "text",
|
|
57
68
|
className: classes,
|
|
69
|
+
css: cssStyles
|
|
70
|
+
}, rest, {
|
|
58
71
|
iconType: isCollapsed ? COLLAPSED_ICON : NOT_COLLAPSED_ICON
|
|
59
72
|
}));
|
|
60
73
|
};
|
|
@@ -74,9 +87,6 @@ EuiResizableCollapseButton.propTypes = {
|
|
|
74
87
|
* Same direction derived from EuiResizableContainer
|
|
75
88
|
*/
|
|
76
89
|
direction: _propTypes.default.oneOf(["vertical", "horizontal"]),
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
90
|
isVisible: _propTypes.default.bool,
|
|
81
91
|
isCollapsed: _propTypes.default.bool
|
|
82
92
|
};
|