@elastic/eui 95.2.0 → 95.3.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 +8 -364
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +8 -364
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/color_picker/color_palette_display/color_palette_display.js +9 -9
- package/es/components/color_picker/color_palette_display/color_palette_display.styles.js +24 -0
- package/es/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -0
- package/es/components/color_picker/color_palette_display/color_palette_display_fixed.styles.js +14 -0
- package/es/components/color_picker/color_palette_picker/color_palette_picker.js +34 -26
- package/es/components/color_picker/color_picker.js +26 -39
- package/es/components/color_picker/color_picker.styles.js +15 -5
- package/es/components/color_picker/color_picker_swatch.js +5 -1
- package/es/components/color_picker/color_picker_swatch.styles.js +19 -0
- package/es/components/color_picker/hue.js +11 -6
- package/es/components/color_picker/hue.styles.js +29 -0
- package/es/components/color_picker/saturation.js +29 -16
- package/es/components/color_picker/saturation.styles.js +23 -0
- package/es/components/form/file_picker/file_picker.js +5 -5
- package/es/components/form/range/range.styles.js +1 -1
- package/es/components/modal/modal.styles.js +1 -1
- package/es/components/popover/popover.js +5 -3
- package/es/components/provider/provider.js +2 -2
- package/es/global_styling/mixins/_helpers.js +10 -2
- package/es/services/breakpoint/current_breakpoint.js +5 -3
- package/es/services/theme/provider.js +10 -2
- package/eui.d.ts +6747 -6681
- package/i18ntokens.json +53 -53
- package/lib/components/color_picker/color_palette_display/color_palette_display.js +9 -9
- package/lib/components/color_picker/color_palette_display/color_palette_display.styles.js +30 -0
- package/lib/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -0
- package/lib/components/color_picker/color_palette_display/color_palette_display_fixed.styles.js +19 -0
- package/lib/components/color_picker/color_palette_picker/color_palette_picker.js +37 -27
- package/lib/components/color_picker/color_picker.js +26 -39
- package/lib/components/color_picker/color_picker.styles.js +15 -5
- package/lib/components/color_picker/color_picker_swatch.js +5 -1
- package/lib/components/color_picker/color_picker_swatch.styles.js +25 -0
- package/lib/components/color_picker/hue.js +11 -6
- package/lib/components/color_picker/hue.styles.js +35 -0
- package/lib/components/color_picker/saturation.js +27 -14
- package/lib/components/color_picker/saturation.styles.js +29 -0
- package/lib/components/form/file_picker/file_picker.js +5 -5
- package/lib/components/form/range/range.styles.js +1 -1
- package/lib/components/modal/modal.styles.js +1 -1
- package/lib/components/popover/popover.js +5 -3
- package/lib/components/provider/provider.js +1 -1
- package/lib/global_styling/mixins/_helpers.js +10 -2
- package/lib/services/breakpoint/current_breakpoint.js +6 -4
- package/lib/services/theme/provider.js +9 -1
- package/optimize/es/components/color_picker/color_palette_display/color_palette_display.js +8 -8
- package/optimize/es/components/color_picker/color_palette_display/color_palette_display.styles.js +24 -0
- package/optimize/es/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -0
- package/optimize/es/components/color_picker/color_palette_display/color_palette_display_fixed.styles.js +14 -0
- package/optimize/es/components/color_picker/color_palette_picker/color_palette_picker.js +34 -26
- package/optimize/es/components/color_picker/color_picker.js +26 -39
- package/optimize/es/components/color_picker/color_picker.styles.js +15 -5
- package/optimize/es/components/color_picker/color_picker_swatch.js +5 -1
- package/optimize/es/components/color_picker/color_picker_swatch.styles.js +19 -0
- package/optimize/es/components/color_picker/hue.js +11 -6
- package/optimize/es/components/color_picker/hue.styles.js +29 -0
- package/optimize/es/components/color_picker/saturation.js +29 -16
- package/optimize/es/components/color_picker/saturation.styles.js +23 -0
- package/optimize/es/components/form/file_picker/file_picker.js +5 -5
- package/optimize/es/components/form/range/range.styles.js +1 -1
- package/optimize/es/components/modal/modal.styles.js +1 -1
- package/optimize/es/components/popover/popover.js +5 -3
- package/optimize/es/components/provider/provider.js +2 -2
- package/optimize/es/global_styling/mixins/_helpers.js +10 -2
- package/optimize/es/services/breakpoint/current_breakpoint.js +5 -3
- package/optimize/es/services/theme/provider.js +10 -2
- package/optimize/lib/components/color_picker/color_palette_display/color_palette_display.js +8 -8
- package/optimize/lib/components/color_picker/color_palette_display/color_palette_display.styles.js +30 -0
- package/optimize/lib/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -0
- package/optimize/lib/components/color_picker/color_palette_display/color_palette_display_fixed.styles.js +19 -0
- package/optimize/lib/components/color_picker/color_palette_picker/color_palette_picker.js +38 -27
- package/optimize/lib/components/color_picker/color_picker.js +26 -39
- package/optimize/lib/components/color_picker/color_picker.styles.js +15 -5
- package/optimize/lib/components/color_picker/color_picker_swatch.js +5 -1
- package/optimize/lib/components/color_picker/color_picker_swatch.styles.js +25 -0
- package/optimize/lib/components/color_picker/hue.js +11 -6
- package/optimize/lib/components/color_picker/hue.styles.js +35 -0
- package/optimize/lib/components/color_picker/saturation.js +27 -14
- package/optimize/lib/components/color_picker/saturation.styles.js +29 -0
- package/optimize/lib/components/form/file_picker/file_picker.js +5 -5
- package/optimize/lib/components/form/range/range.styles.js +1 -1
- package/optimize/lib/components/modal/modal.styles.js +1 -1
- package/optimize/lib/components/popover/popover.js +5 -3
- package/optimize/lib/components/provider/provider.js +1 -1
- package/optimize/lib/global_styling/mixins/_helpers.js +10 -2
- package/optimize/lib/services/breakpoint/current_breakpoint.js +6 -4
- package/optimize/lib/services/theme/provider.js +9 -1
- package/package.json +10 -7
- package/src/components/index.scss +0 -1
- package/src/global_styling/mixins/_shadow.scss +5 -0
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/color_picker/color_palette_display/color_palette_display.js +9 -9
- package/test-env/components/color_picker/color_palette_display/color_palette_display.styles.js +30 -0
- package/test-env/components/color_picker/color_palette_display/color_palette_display_fixed.js +2 -0
- package/test-env/components/color_picker/color_palette_display/color_palette_display_fixed.styles.js +19 -0
- package/test-env/components/color_picker/color_palette_picker/color_palette_picker.js +38 -27
- package/test-env/components/color_picker/color_picker.js +26 -39
- package/test-env/components/color_picker/color_picker.styles.js +15 -5
- package/test-env/components/color_picker/color_picker_swatch.js +5 -1
- package/test-env/components/color_picker/color_picker_swatch.styles.js +25 -0
- package/test-env/components/color_picker/hue.js +11 -6
- package/test-env/components/color_picker/hue.styles.js +35 -0
- package/test-env/components/color_picker/saturation.js +27 -14
- package/test-env/components/color_picker/saturation.styles.js +29 -0
- package/test-env/components/form/file_picker/file_picker.js +5 -5
- package/test-env/components/form/range/range.styles.js +1 -1
- package/test-env/components/modal/modal.styles.js +1 -1
- package/test-env/components/popover/popover.js +5 -3
- package/test-env/components/provider/provider.js +1 -1
- package/test-env/global_styling/mixins/_helpers.js +10 -2
- package/test-env/services/breakpoint/current_breakpoint.js +6 -4
- package/test-env/services/theme/provider.js +9 -1
- package/src/components/color_picker/_color_picker.scss +0 -37
- package/src/components/color_picker/_color_picker_swatch.scss +0 -18
- package/src/components/color_picker/_hue.scss +0 -88
- package/src/components/color_picker/_index.scss +0 -7
- package/src/components/color_picker/_saturation.scss +0 -57
- package/src/components/color_picker/_variables.scss +0 -6
- package/src/components/color_picker/color_palette_display/_color_palette_display.scss +0 -18
- package/src/components/color_picker/color_palette_display/_color_palette_display_fixed.scss +0 -12
- package/src/components/color_picker/color_palette_display/_index.scss +0 -4
- package/src/components/color_picker/color_palette_display/_mixins.scss +0 -22
- package/src/components/color_picker/color_palette_display/_variables.scss +0 -6
- package/src/components/color_picker/color_palette_picker/_color_palette_picker.scss +0 -9
- package/src/components/color_picker/color_palette_picker/_index.scss +0 -1
- package/src/themes/amsterdam/overrides/_hue.scss +0 -44
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.euiColorPickerStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _services = require("../../services");
|
|
7
9
|
var _global_styling = require("../../global_styling");
|
|
8
10
|
/*
|
|
9
11
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -13,11 +15,19 @@ var _global_styling = require("../../global_styling");
|
|
|
13
15
|
* Side Public License, v 1.
|
|
14
16
|
*/
|
|
15
17
|
|
|
16
|
-
var
|
|
18
|
+
var euiColorPickerStyles = exports.euiColorPickerStyles = function euiColorPickerStyles(euiThemeContext) {
|
|
17
19
|
var euiTheme = euiThemeContext.euiTheme;
|
|
20
|
+
|
|
21
|
+
// 5 columns of swatches + margins + border
|
|
22
|
+
var colorPickerWidth = (0, _global_styling.mathWithUnits)([euiTheme.size.l, euiTheme.size.s], function (x, y) {
|
|
23
|
+
return x * 5 + y * 4;
|
|
24
|
+
});
|
|
18
25
|
return {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
})
|
|
26
|
+
euiColorPicker: /*#__PURE__*/(0, _react.css)("position:relative;", (0, _global_styling.logicalCSS)('width', colorPickerWidth), "display:flex;flex-direction:column;gap:", euiTheme.size.s, ";;label:euiColorPicker;"),
|
|
27
|
+
euiColorPicker__swatches: /*#__PURE__*/(0, _react.css)("display:flex;flex-wrap:wrap;gap:", euiTheme.size.s, ";;label:euiColorPicker__swatches;"),
|
|
28
|
+
euiColorPicker__alphaRange: /*#__PURE__*/(0, _react.css)(".euiRangeInput{", (0, _global_styling.logicalCSS)('min-width', 0), ";};label:euiColorPicker__alphaRange;"),
|
|
29
|
+
// Adds a stroke color for the swatchInput icon. Unlike most EuiIcons it has a stroke in the SVG
|
|
30
|
+
// Targets a custom className applied directly to the <svg> icon
|
|
31
|
+
euiColorPicker__swatchInputIcon: /*#__PURE__*/(0, _react.css)(".euiSwatchInput__stroke{fill:none;stroke:", (0, _services.transparentize)(euiTheme.colors.fullShade, 0.2), ";};label:euiColorPicker__swatchInputIcon;")
|
|
22
32
|
};
|
|
23
33
|
};
|
|
@@ -8,8 +8,10 @@ exports.EuiColorPickerSwatch = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var
|
|
11
|
+
var _services = require("../../services");
|
|
12
12
|
var _i18n = require("../i18n");
|
|
13
|
+
var _utils = require("./utils");
|
|
14
|
+
var _color_picker_swatch = require("./color_picker_swatch.styles");
|
|
13
15
|
var _react2 = require("@emotion/react");
|
|
14
16
|
var _excluded = ["className", "color", "style"];
|
|
15
17
|
/*
|
|
@@ -36,6 +38,7 @@ var EuiColorPickerSwatch = exports.EuiColorPickerSwatch = /*#__PURE__*/(0, _reac
|
|
|
36
38
|
style = _ref.style,
|
|
37
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
38
40
|
var classes = (0, _classnames.default)('euiColorPickerSwatch', className);
|
|
41
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_color_picker_swatch.euiColorPickerSwatchStyles);
|
|
39
42
|
var chromaColor = (0, _react.useMemo)(function () {
|
|
40
43
|
return (0, _utils.getChromaColor)(color, true);
|
|
41
44
|
}, [color]);
|
|
@@ -47,6 +50,7 @@ var EuiColorPickerSwatch = exports.EuiColorPickerSwatch = /*#__PURE__*/(0, _reac
|
|
|
47
50
|
});
|
|
48
51
|
return (0, _react2.jsx)("button", _extends({
|
|
49
52
|
type: "button",
|
|
53
|
+
css: styles.euiColorPickerSwatch,
|
|
50
54
|
className: classes,
|
|
51
55
|
"aria-label": ariaLabel,
|
|
52
56
|
ref: ref,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiColorPickerSwatchStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _services = require("../../services");
|
|
9
|
+
var _global_styling = require("../../global_styling");
|
|
10
|
+
/*
|
|
11
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
13
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
14
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
|
+
* Side Public License, v 1.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
var euiColorPickerSwatchStyles = exports.euiColorPickerSwatchStyles = function euiColorPickerSwatchStyles(euiThemeContext) {
|
|
19
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
20
|
+
return {
|
|
21
|
+
euiColorPickerSwatch: /*#__PURE__*/(0, _react.css)("display:inline-block;", (0, _global_styling.logicalSizeCSS)(euiTheme.size.l), " border-radius:", (0, _global_styling.mathWithUnits)(euiTheme.border.radius.medium, function (x) {
|
|
22
|
+
return x / 2;
|
|
23
|
+
}), ";border:", euiTheme.border.width.thin, " solid ", (0, _services.transparentize)(euiTheme.colors.fullShade, 0.1), ";box-shadow:inset 0 0 0 ", euiTheme.border.width.thin, " ", (0, _services.transparentize)(euiTheme.colors.emptyShade, 0.05), ";cursor:pointer;&:disabled{cursor:default;}&:focus{", (0, _global_styling.euiOutline)(euiThemeContext, 'center'), ";};label:euiColorPickerSwatch;")
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -7,8 +7,10 @@ exports.EuiHue = 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 _accessibility = require("../accessibility");
|
|
11
12
|
var _i18n = require("../i18n");
|
|
13
|
+
var _hue = require("./hue.styles");
|
|
12
14
|
var _react2 = require("@emotion/react");
|
|
13
15
|
var _excluded = ["className", "hex", "hue", "id", "onChange"];
|
|
14
16
|
/*
|
|
@@ -31,29 +33,32 @@ var EuiHue = exports.EuiHue = function EuiHue(_ref) {
|
|
|
31
33
|
id = _ref.id,
|
|
32
34
|
onChange = _ref.onChange,
|
|
33
35
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
+
var classes = (0, _classnames.default)('euiHue', className);
|
|
37
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_hue.euiHueStyles);
|
|
34
38
|
var handleChange = function handleChange(e) {
|
|
35
39
|
onChange(Number(e.target.value));
|
|
36
40
|
};
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
return (0, _react2.jsx)("div", {
|
|
42
|
+
css: styles.euiHue,
|
|
43
|
+
className: classes
|
|
44
|
+
}, (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("label", {
|
|
39
45
|
htmlFor: "".concat(id, "-hue")
|
|
40
46
|
}, (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
41
47
|
token: "euiHue.label",
|
|
42
48
|
default: "Select the HSV color mode 'hue' value"
|
|
43
49
|
}))), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
|
|
44
50
|
"aria-live": "polite"
|
|
45
|
-
}, hex)), (0, _react2.jsx)("
|
|
46
|
-
className: classes
|
|
47
|
-
}, (0, _react2.jsx)("input", _extends({
|
|
51
|
+
}, hex)), (0, _react2.jsx)("input", _extends({
|
|
48
52
|
id: "".concat(id, "-hue"),
|
|
49
53
|
min: 0,
|
|
50
54
|
max: HUE_RANGE,
|
|
51
55
|
step: 1,
|
|
52
56
|
type: "range",
|
|
57
|
+
css: styles.euiHue__range,
|
|
53
58
|
className: "euiHue__range",
|
|
54
59
|
value: hue,
|
|
55
60
|
onChange: handleChange
|
|
56
|
-
}, rest)))
|
|
61
|
+
}, rest)));
|
|
57
62
|
};
|
|
58
63
|
EuiHue.propTypes = {
|
|
59
64
|
className: _propTypes.default.string,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiHueStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _services = require("../../services");
|
|
9
|
+
var _global_styling = require("../../global_styling");
|
|
10
|
+
var _range = require("../form/range/range.styles");
|
|
11
|
+
/*
|
|
12
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
13
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
14
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
15
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
16
|
+
* Side Public License, v 1.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
var euiHueStyles = exports.euiHueStyles = function euiHueStyles(euiThemeContext) {
|
|
20
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
21
|
+
var height = euiTheme.size.m;
|
|
22
|
+
var thumbSize = euiTheme.size.l;
|
|
23
|
+
var thumbBorder = (0, _global_styling.mathWithUnits)(euiTheme.border.width.thick, function (x) {
|
|
24
|
+
return x * 1.5;
|
|
25
|
+
});
|
|
26
|
+
var thumbBoxShadow = "\n 0 2px 2px -1px ".concat((0, _services.transparentize)(euiTheme.colors.shadow, 0.2), ",\n 0 1px 5px -2px ").concat((0, _services.transparentize)(euiTheme.colors.shadow, 0.2));
|
|
27
|
+
return {
|
|
28
|
+
// This wraps the range and sets a rainbow gradient,
|
|
29
|
+
// which allows the range thumb to be larger than the visible track
|
|
30
|
+
euiHue: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', height), " border-radius:", height, ";background:linear-gradient(\n to right,\n #ff3232 0%,\n #fff130 20%,\n #45ff30 35%,\n #28fff0 52%,\n #282cff 71%,\n #ff28fb 88%,\n #ff0094 100%\n );;label:euiHue;"),
|
|
31
|
+
euiHue__range: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', thumbSize), (0, _global_styling.logicalCSS)('width', "calc(100% + 2px)"), (0, _global_styling.logicalCSS)('margin-horizontal', '-1px'), " ", (0, _global_styling.logicalCSS)('margin-top', (0, _global_styling.mathWithUnits)(height, function (x) {
|
|
32
|
+
return x / -2;
|
|
33
|
+
})), "appearance:none;background:transparent;&::-webkit-slider-thumb{-webkit-appearance:none;}", (0, _range.euiRangeThumbPerBrowser)([(0, _range.euiRangeThumbStyle)(euiThemeContext), 'background-color: inherit', "border-width: ".concat(thumbBorder), 'border-radius: 100%', "box-shadow: ".concat(thumbBoxShadow)].join(';\n')), "&:focus{outline:none;}&:focus-visible{", (0, _range.euiRangeThumbPerBrowser)((0, _range.euiRangeThumbFocusBoxShadow)(euiThemeContext)), ";};label:euiHue__range;")
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -10,10 +10,12 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
var _services = require("../../services");
|
|
12
12
|
var _predicate = require("../../services/predicate");
|
|
13
|
+
var _global_styling = require("../../global_styling");
|
|
13
14
|
var _i18n = require("../i18n");
|
|
14
15
|
var _utils = require("./utils");
|
|
16
|
+
var _saturation = require("./saturation.styles");
|
|
15
17
|
var _react2 = require("@emotion/react");
|
|
16
|
-
var _excluded = ["className", "color", "data-test-subj", "hex", "id", "onChange"];
|
|
18
|
+
var _excluded = ["className", "color", "data-test-subj", "hex", "id", "onChange", "onKeyDown"];
|
|
17
19
|
/*
|
|
18
20
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
19
21
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -46,9 +48,17 @@ var EuiSaturation = exports.EuiSaturation = /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
46
48
|
_ref$dataTestSubj = _ref['data-test-subj'],
|
|
47
49
|
dataTestSubj = _ref$dataTestSubj === void 0 ? 'euiSaturation' : _ref$dataTestSubj,
|
|
48
50
|
hex = _ref.hex,
|
|
49
|
-
|
|
51
|
+
_id = _ref.id,
|
|
50
52
|
onChange = _ref.onChange,
|
|
53
|
+
onKeyDown = _ref.onKeyDown,
|
|
51
54
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
55
|
+
var classes = (0, _classnames.default)('euiSaturation', className);
|
|
56
|
+
var styles = (0, _services.useEuiMemoizedStyles)(_saturation.euiSaturationStyles);
|
|
57
|
+
var id = (0, _services.useGeneratedHtmlId)({
|
|
58
|
+
conditionalId: _id
|
|
59
|
+
});
|
|
60
|
+
var instructionsId = "".concat(id, "-instructions");
|
|
61
|
+
var indicatorId = "".concat(id, "-saturationIndicator");
|
|
52
62
|
var _useEuiI18n = (0, _i18n.useEuiI18n)(['euiSaturation.ariaLabel', 'euiSaturation.screenReaderInstructions'], ['HSV color mode saturation and value 2-axis slider', "Arrow keys to navigate the square color gradient. Coordinates will be used to calculate HSV color mode 'saturation' and 'value' numbers, in the range of 0 to 1. Left and right to change the saturation. Up and down change the value."]),
|
|
53
63
|
_useEuiI18n2 = _slicedToArray(_useEuiI18n, 2),
|
|
54
64
|
roleDescString = _useEuiI18n2[0],
|
|
@@ -80,7 +90,7 @@ var EuiSaturation = exports.EuiSaturation = /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
80
90
|
});
|
|
81
91
|
}
|
|
82
92
|
}, [color, lastColor]);
|
|
83
|
-
var calculateColor = function
|
|
93
|
+
var calculateColor = (0, _react.useCallback)(function (_ref2) {
|
|
84
94
|
var top = _ref2.top,
|
|
85
95
|
height = _ref2.height,
|
|
86
96
|
left = _ref2.left,
|
|
@@ -90,8 +100,8 @@ var EuiSaturation = exports.EuiSaturation = /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
90
100
|
var s = left / width;
|
|
91
101
|
var v = 1 - top / height;
|
|
92
102
|
return [h, s, v];
|
|
93
|
-
};
|
|
94
|
-
var handleUpdate = function
|
|
103
|
+
}, [color]);
|
|
104
|
+
var handleUpdate = (0, _react.useCallback)(function (box) {
|
|
95
105
|
var left = box.left,
|
|
96
106
|
top = box.top;
|
|
97
107
|
setIndicator({
|
|
@@ -101,17 +111,18 @@ var EuiSaturation = exports.EuiSaturation = /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
101
111
|
var newColor = calculateColor(box);
|
|
102
112
|
setLastColor(newColor);
|
|
103
113
|
onChange(newColor);
|
|
104
|
-
};
|
|
105
|
-
var handleChange = function
|
|
114
|
+
}, [calculateColor, onChange]);
|
|
115
|
+
var handleChange = (0, _react.useCallback)(function (location) {
|
|
106
116
|
if ((0, _predicate.isNil)(boxRef === null || boxRef === void 0 ? void 0 : boxRef.current)) return;
|
|
107
117
|
var box = (0, _utils.getEventPosition)(location, boxRef.current);
|
|
108
118
|
handleUpdate(box);
|
|
109
|
-
};
|
|
119
|
+
}, [handleUpdate]);
|
|
110
120
|
var _useMouseMove = (0, _services.useMouseMove)(handleChange, boxRef.current),
|
|
111
121
|
_useMouseMove2 = _slicedToArray(_useMouseMove, 2),
|
|
112
122
|
handleMouseDown = _useMouseMove2[0],
|
|
113
123
|
handleInteraction = _useMouseMove2[1];
|
|
114
|
-
var handleKeyDown = function
|
|
124
|
+
var handleKeyDown = (0, _react.useCallback)(function (event) {
|
|
125
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
|
|
115
126
|
if ((0, _predicate.isNil)(boxRef === null || boxRef === void 0 ? void 0 : boxRef.current)) return;
|
|
116
127
|
var _boxRef$current$getBo2 = boxRef.current.getBoundingClientRect(),
|
|
117
128
|
height = _boxRef$current$getBo2.height,
|
|
@@ -152,15 +163,14 @@ var EuiSaturation = exports.EuiSaturation = /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
152
163
|
height: height
|
|
153
164
|
}, newPosition));
|
|
154
165
|
onChange(newColor);
|
|
155
|
-
};
|
|
156
|
-
var classes = (0, _classnames.default)('euiSaturation', className);
|
|
157
|
-
var instructionsId = "".concat(id, "-instructions");
|
|
166
|
+
}, [calculateColor, indicator, onChange, onKeyDown]);
|
|
158
167
|
return (0, _react2.jsx)("div", _extends({
|
|
159
168
|
onMouseDown: handleMouseDown,
|
|
160
169
|
onTouchStart: handleInteraction,
|
|
161
170
|
onTouchMove: handleInteraction,
|
|
162
171
|
onKeyDown: handleKeyDown,
|
|
163
172
|
ref: ref,
|
|
173
|
+
css: styles.euiSaturation,
|
|
164
174
|
className: classes,
|
|
165
175
|
"data-test-subj": dataTestSubj,
|
|
166
176
|
style: {
|
|
@@ -168,14 +178,17 @@ var EuiSaturation = exports.EuiSaturation = /*#__PURE__*/(0, _react.forwardRef)(
|
|
|
168
178
|
},
|
|
169
179
|
tabIndex: -1
|
|
170
180
|
}, rest), (0, _react2.jsx)("div", {
|
|
181
|
+
css: styles.euiSaturation__lightness,
|
|
171
182
|
className: "euiSaturation__lightness",
|
|
172
183
|
ref: boxRef
|
|
173
184
|
}, (0, _react2.jsx)("div", {
|
|
185
|
+
css: styles.euiSaturation__saturation,
|
|
174
186
|
className: "euiSaturation__saturation"
|
|
175
187
|
})), (0, _react2.jsx)("button", {
|
|
176
|
-
id:
|
|
188
|
+
id: indicatorId,
|
|
189
|
+
css: styles.euiSaturation__indicator,
|
|
177
190
|
className: "euiSaturation__indicator",
|
|
178
|
-
style:
|
|
191
|
+
style: (0, _global_styling.logicalStyles)(indicator),
|
|
179
192
|
"aria-roledescription": roleDescString,
|
|
180
193
|
"aria-label": hex,
|
|
181
194
|
"aria-describedby": instructionsId
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiSaturationStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _global_styling = require("../../global_styling");
|
|
9
|
+
/*
|
|
10
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
11
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
12
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
13
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
14
|
+
* Side Public License, v 1.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var euiSaturationStyles = exports.euiSaturationStyles = function euiSaturationStyles(euiThemeContext) {
|
|
18
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
19
|
+
var indicatorSize = euiTheme.size.m;
|
|
20
|
+
var borderRadius = (0, _global_styling.mathWithUnits)(euiTheme.border.radius.medium, function (x) {
|
|
21
|
+
return x / 2;
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
euiSaturation: /*#__PURE__*/(0, _react.css)("z-index:3;position:relative;", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalCSS)('padding-bottom', '100%'), " border-radius:", borderRadius, ";touch-action:none;&:focus,&:focus-within{outline:none;.euiSaturation__indicator{outline:none;box-shadow:0 0 0 ", euiTheme.focus.width, " ", euiTheme.colors.primary, ";border-color:", euiTheme.colors.primary, ";}};label:euiSaturation;"),
|
|
25
|
+
euiSaturation__lightness: /*#__PURE__*/(0, _react.css)("position:absolute;inset:0;", (0, _global_styling.logicalCSS)('top', '-1px'), "border-radius:", borderRadius, ";background:linear-gradient(\n to right,\n rgba(255, 255, 255, 1),\n rgba(255, 255, 255, 0)\n );;label:euiSaturation__lightness;"),
|
|
26
|
+
euiSaturation__saturation: /*#__PURE__*/(0, _react.css)("position:absolute;inset:0;", (0, _global_styling.logicalCSS)('top', '-1px'), "border-radius:", borderRadius, ";background:linear-gradient(to top, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));;label:euiSaturation__saturation;"),
|
|
27
|
+
euiSaturation__indicator: /*#__PURE__*/(0, _react.css)("position:absolute;", (0, _global_styling.logicalSizeCSS)(indicatorSize), " transform:translateX(-50%) translateY(-50%);border:", euiTheme.border.width.thin, " solid ", euiTheme.colors.darkestShade, ";border-radius:100%;&::before{content:'';position:absolute;inset:0;border-radius:100%;border:", euiTheme.border.width.thin, " solid ", euiTheme.colors.lightestShade, ";};label:euiSaturation__indicator;")
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -122,9 +122,9 @@ var EuiFilePickerClass = exports.EuiFilePickerClass = /*#__PURE__*/function (_Co
|
|
|
122
122
|
var _ref = this.context,
|
|
123
123
|
defaultFullWidth = _ref.defaultFullWidth;
|
|
124
124
|
return (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
125
|
-
token: "euiFilePicker.
|
|
126
|
-
default: "
|
|
127
|
-
}, function (
|
|
125
|
+
token: "euiFilePicker.removeSelectedAriaLabel",
|
|
126
|
+
default: "Remove selected files"
|
|
127
|
+
}, function (removeSelectedAriaLabel) {
|
|
128
128
|
var _this2$props = _this2.props,
|
|
129
129
|
stylesMemoizer = _this2$props.stylesMemoizer,
|
|
130
130
|
id = _this2$props.id,
|
|
@@ -166,7 +166,7 @@ var EuiFilePickerClass = exports.EuiFilePickerClass = /*#__PURE__*/function (_Co
|
|
|
166
166
|
} else if (isOverridingInitialPrompt && !disabled) {
|
|
167
167
|
if (normalFormControl) {
|
|
168
168
|
clearButton = (0, _react2.jsx)(_form_control_layout_clear_button.EuiFormControlLayoutClearButton, {
|
|
169
|
-
"aria-label":
|
|
169
|
+
"aria-label": removeSelectedAriaLabel,
|
|
170
170
|
css: [styles.euiFilePicker__clearButton, rightIconStyles, ";label:clearButton;"],
|
|
171
171
|
className: "euiFilePicker__clearButton",
|
|
172
172
|
onClick: _this2.removeFiles,
|
|
@@ -174,7 +174,7 @@ var EuiFilePickerClass = exports.EuiFilePickerClass = /*#__PURE__*/function (_Co
|
|
|
174
174
|
});
|
|
175
175
|
} else {
|
|
176
176
|
clearButton = (0, _react2.jsx)(_button.EuiButtonEmpty, {
|
|
177
|
-
"aria-label":
|
|
177
|
+
"aria-label": removeSelectedAriaLabel,
|
|
178
178
|
css: styles.euiFilePicker__clearButton,
|
|
179
179
|
className: "euiFilePicker__clearButton",
|
|
180
180
|
size: "xs",
|
|
@@ -88,7 +88,7 @@ var euiRangeThumbStyle = exports.euiRangeThumbStyle = function euiRangeThumbStyl
|
|
|
88
88
|
return "\n ".concat(euiRangeThumbBoxShadow(euiThemeContext), ";\n ").concat(euiRangeThumbBorder(euiThemeContext), ";\n cursor: pointer;\n background-color: ").concat(range.thumbBackgroundColor, ";\n padding: 0;\n block-size: ").concat(range.thumbHeight, ";\n inline-size: ").concat(range.thumbWidth, ";\n box-sizing: border-box; // required for firefox or the border makes the width and height to increase\n ");
|
|
89
89
|
};
|
|
90
90
|
var euiRangeThumbPerBrowser = exports.euiRangeThumbPerBrowser = function euiRangeThumbPerBrowser(content) {
|
|
91
|
-
return "\n &::-webkit-slider-thumb { ".concat(content, "; }\n &::-moz-range-thumb
|
|
91
|
+
return "\n &::-webkit-slider-thumb { ".concat(content, "; }\n &::-moz-range-thumb { ").concat(content, "; }\n &::-ms-thumb {").concat(content, "; }\n ");
|
|
92
92
|
};
|
|
93
93
|
var euiRangeThumbFocus = exports.euiRangeThumbFocus = function euiRangeThumbFocus(euiThemeContext, color) {
|
|
94
94
|
var range = euiRangeVariables(euiThemeContext);
|
|
@@ -19,7 +19,7 @@ var _form = require("../form/form.styles");
|
|
|
19
19
|
var euiModalStyles = exports.euiModalStyles = function euiModalStyles(euiThemeContext) {
|
|
20
20
|
var euiTheme = euiThemeContext.euiTheme;
|
|
21
21
|
return {
|
|
22
|
-
euiModal: /*#__PURE__*/(0, _react.css)((0, _mixins.euiShadowXLarge)(euiThemeContext), " display:flex;flex-direction:column;max-block-size:75vh;position:relative;background-color:", euiTheme.colors.emptyShade, ";border-radius:", euiTheme.border.radius.medium, ";z-index:", euiTheme.levels.modal, ";min-inline-size:", (0, _form.euiFormVariables)(euiThemeContext).maxWidth, ";max-inline-size:calc(100vw - ", euiTheme.size.base, ");", _global_styling.euiCanAnimate, "{animation:", (0, _global_styling.euiAnimSlideInUp)(euiTheme.size.xxl), " ", euiTheme.animation.slow, " ", euiTheme.animation.bounce, ";}", (0, _global_styling.euiMaxBreakpoint)(euiThemeContext, 'm'), "{position:fixed;inset:0;border-radius:0;inline-size:100vw!important;min-inline-size:0!important;max-inline-size:none!important;max-block-size:100vh!important;}&:focus{outline:none;};label:euiModal;"),
|
|
22
|
+
euiModal: /*#__PURE__*/(0, _react.css)((0, _mixins.euiShadowXLarge)(euiThemeContext), " display:flex;flex-direction:column;max-block-size:75vh;position:relative;background-color:", euiTheme.colors.emptyShade, ";border-radius:", euiTheme.border.radius.medium, ";z-index:", euiTheme.levels.modal, ";min-inline-size:", (0, _form.euiFormVariables)(euiThemeContext).maxWidth, ";max-inline-size:calc(100vw - ", euiTheme.size.base, ");overflow:hidden;", _global_styling.euiCanAnimate, "{animation:", (0, _global_styling.euiAnimSlideInUp)(euiTheme.size.xxl), " ", euiTheme.animation.slow, " ", euiTheme.animation.bounce, ";}", (0, _global_styling.euiMaxBreakpoint)(euiThemeContext, 'm'), "{position:fixed;inset:0;border-radius:0;inline-size:100vw!important;min-inline-size:0!important;max-inline-size:none!important;max-block-size:100vh!important;}&:focus{outline:none;};label:euiModal;"),
|
|
23
23
|
// Variants
|
|
24
24
|
defaultMaxWidth: /*#__PURE__*/(0, _react.css)("max-inline-size:min(\n ", euiTheme.breakpoint.m, "px,\n calc(100vw - ", euiTheme.size.base, ")\n );;label:defaultMaxWidth;"),
|
|
25
25
|
confirmation: /*#__PURE__*/(0, _react.css)("min-inline-size:", (0, _form.euiFormVariables)(euiThemeContext).maxWidth, ";", (0, _global_styling.euiMaxBreakpoint)(euiThemeContext, 'm'), "{", (0, _mixins.euiShadowXLarge)(euiThemeContext, {
|
|
@@ -134,9 +134,11 @@ var EuiPopover = exports.EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
134
134
|
});
|
|
135
135
|
_defineProperty(_this, "handleStrandedFocus", function () {
|
|
136
136
|
_this.strandedFocusTimeout = window.setTimeout(function () {
|
|
137
|
-
// If `returnFocus` failed and focus was stranded
|
|
138
|
-
// attempt to manually restore focus to the toggle button
|
|
139
|
-
|
|
137
|
+
// If `returnFocus` failed and focus was stranded,
|
|
138
|
+
// attempt to manually restore focus to the toggle button.
|
|
139
|
+
// The stranded focus is either in most cases on body but
|
|
140
|
+
// it will be on the panel instead on mount when isOpen=true
|
|
141
|
+
if (document.activeElement === document.body || document.activeElement === _this.panel) {
|
|
140
142
|
if (!_this.button) return;
|
|
141
143
|
var focusableItems = (0, _tabbable.focusable)(_this.button);
|
|
142
144
|
if (!focusableItems.length) return;
|
|
@@ -83,5 +83,5 @@ var EuiProvider = exports.EuiProvider = function EuiProvider(_ref) {
|
|
|
83
83
|
children: Utilities && (0, _react2.jsx)(Utilities, null)
|
|
84
84
|
})), (0, _react2.jsx)(_component_defaults.EuiComponentDefaultsProvider, {
|
|
85
85
|
componentDefaults: componentDefaults
|
|
86
|
-
},
|
|
86
|
+
}, children))));
|
|
87
87
|
};
|
|
@@ -72,10 +72,18 @@ var euiOverflowShadowStyles = function euiOverflowShadowStyles(_ref3) {
|
|
|
72
72
|
gradient = "".concat(gradientEnd);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
// Chrome+Edge has a very bizarre edge case bug where `mask-image` stops working
|
|
77
|
+
// This workaround forces a stacking context on the scrolling container, which
|
|
78
|
+
// hopefully addresses the bug. @see:
|
|
79
|
+
// - https://issues.chromium.org/issues/40778541
|
|
80
|
+
// - https://github.com/elastic/kibana/issues/180828
|
|
81
|
+
// - https://github.com/elastic/eui/pull/6343#issuecomment-1302732021
|
|
82
|
+
var chromiumMaskWorkaround = 'transform: translateZ(0);';
|
|
75
83
|
if (direction === 'y') {
|
|
76
|
-
return "mask-image: linear-gradient(to bottom, ".concat(gradient, ");");
|
|
84
|
+
return "mask-image: linear-gradient(to bottom, ".concat(gradient, "); ").concat(chromiumMaskWorkaround);
|
|
77
85
|
} else {
|
|
78
|
-
return "mask-image: linear-gradient(to right, ".concat(gradient, ");");
|
|
86
|
+
return "mask-image: linear-gradient(to right, ".concat(gradient, "); ").concat(chromiumMaskWorkaround);
|
|
79
87
|
}
|
|
80
88
|
};
|
|
81
89
|
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.CurrentEuiBreakpointProvider = exports.CurrentEuiBreakpointContext = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _common = require("../../components/common");
|
|
10
|
-
var
|
|
10
|
+
var _hooks = require("../theme/hooks");
|
|
11
11
|
var _throttle = require("../throttle");
|
|
12
12
|
var _sorting = require("./_sorting");
|
|
13
13
|
var _react2 = require("@emotion/react");
|
|
@@ -28,13 +28,15 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /*
|
|
|
28
28
|
var CurrentEuiBreakpointContext = exports.CurrentEuiBreakpointContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Returns the current breakpoint based on window width.
|
|
32
|
+
* Typically only called by the top-level `EuiProvider` (to reduce the number
|
|
33
|
+
* of window resize listeners on the page). Also conditionally called if a
|
|
34
|
+
* nested `EuiThemeProvider` defines a `modify.breakpoint` override
|
|
33
35
|
*/
|
|
34
36
|
var CurrentEuiBreakpointProvider = exports.CurrentEuiBreakpointProvider = function CurrentEuiBreakpointProvider(_ref) {
|
|
35
37
|
var children = _ref.children;
|
|
36
38
|
// Obtain the breakpoints map from the EUI theme
|
|
37
|
-
var _useEuiTheme = (0,
|
|
39
|
+
var _useEuiTheme = (0, _hooks.useEuiTheme)(),
|
|
38
40
|
breakpoints = _useEuiTheme.euiTheme.breakpoint;
|
|
39
41
|
|
|
40
42
|
// Ensure the breakpoints map is sorted from largest value to smallest
|
|
@@ -10,6 +10,7 @@ var _react2 = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
11
11
|
var _emotion = require("../emotion");
|
|
12
12
|
var _css2 = require("../emotion/css");
|
|
13
|
+
var _current_breakpoint = require("../breakpoint/current_breakpoint");
|
|
13
14
|
var _context = require("./context");
|
|
14
15
|
var _emotion2 = require("./emotion");
|
|
15
16
|
var _style_memoization = require("./style_memoization");
|
|
@@ -60,6 +61,13 @@ var EuiThemeProvider = exports.EuiThemeProvider = function EuiThemeProvider(_ref
|
|
|
60
61
|
system = _useState2[0],
|
|
61
62
|
setSystem = _useState2[1];
|
|
62
63
|
var prevSystemKey = (0, _react2.useRef)(system.key);
|
|
64
|
+
|
|
65
|
+
// To reduce the number of window resize listeners, only render a
|
|
66
|
+
// CurrentEuiBreakpointProvider for the top level parent theme, or for
|
|
67
|
+
// nested themes only if modified breakpoint overrides are passed
|
|
68
|
+
var EuiConditionalBreakpointProvider = (0, _react2.useMemo)(function () {
|
|
69
|
+
return isGlobalTheme || _modifications !== null && _modifications !== void 0 && _modifications.breakpoint ? _current_breakpoint.CurrentEuiBreakpointProvider : _react2.Fragment;
|
|
70
|
+
}, [isGlobalTheme, _modifications]);
|
|
63
71
|
var _useState3 = (0, _react2.useState)((0, _utils.mergeDeep)(parentModifications, _modifications)),
|
|
64
72
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
65
73
|
modifications = _useState4[0],
|
|
@@ -169,5 +177,5 @@ var EuiThemeProvider = exports.EuiThemeProvider = function EuiThemeProvider(_ref
|
|
|
169
177
|
value: theme
|
|
170
178
|
}, (0, _react.jsx)(_context.EuiNestedThemeContext.Provider, {
|
|
171
179
|
value: nestedThemeContext
|
|
172
|
-
}, (0, _react.jsx)(_style_memoization.EuiThemeMemoizedStylesProvider, null, (0, _react.jsx)(_emotion2.EuiEmotionThemeProvider, null, renderedChildren))))))));
|
|
180
|
+
}, (0, _react.jsx)(_style_memoization.EuiThemeMemoizedStylesProvider, null, (0, _react.jsx)(_emotion2.EuiEmotionThemeProvider, null, (0, _react.jsx)(EuiConditionalBreakpointProvider, null, renderedChildren)))))))));
|
|
173
181
|
};
|
|
@@ -11,16 +11,12 @@ var _excluded = ["type", "palette", "className", "size"];
|
|
|
11
11
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import classnames from 'classnames';
|
|
14
|
-
import {
|
|
14
|
+
import { useEuiMemoizedStyles } from '../../../services';
|
|
15
15
|
import { EuiColorPaletteDisplayFixed } from './color_palette_display_fixed';
|
|
16
16
|
import { EuiColorPaletteDisplayGradient } from './color_palette_display_gradient';
|
|
17
|
+
import { euiColorPaletteDisplayStyles } from './color_palette_display.styles';
|
|
17
18
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
18
|
-
var
|
|
19
|
-
xs: 'euiColorPaletteDisplay--sizeExtraSmall',
|
|
20
|
-
s: 'euiColorPaletteDisplay--sizeSmall',
|
|
21
|
-
m: 'euiColorPaletteDisplay--sizeMedium'
|
|
22
|
-
};
|
|
23
|
-
export var SIZES = keysOf(sizeToClassNameMap);
|
|
19
|
+
export var SIZES = ['xs', 's', 'm'];
|
|
24
20
|
export var EuiColorPaletteDisplay = function EuiColorPaletteDisplay(_ref) {
|
|
25
21
|
var _ref$type = _ref.type,
|
|
26
22
|
type = _ref$type === void 0 ? 'fixed' : _ref$type,
|
|
@@ -29,11 +25,15 @@ export var EuiColorPaletteDisplay = function EuiColorPaletteDisplay(_ref) {
|
|
|
29
25
|
_ref$size = _ref.size,
|
|
30
26
|
size = _ref$size === void 0 ? 's' : _ref$size,
|
|
31
27
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
-
var classes = classnames('euiColorPaletteDisplay', className
|
|
28
|
+
var classes = classnames('euiColorPaletteDisplay', className);
|
|
29
|
+
var styles = useEuiMemoizedStyles(euiColorPaletteDisplayStyles);
|
|
30
|
+
var cssStyles = [styles.euiColorPaletteDisplay, styles[size]];
|
|
33
31
|
return ___EmotionJSX(React.Fragment, null, type === 'fixed' ? ___EmotionJSX(EuiColorPaletteDisplayFixed, _extends({
|
|
32
|
+
css: cssStyles,
|
|
34
33
|
className: classes,
|
|
35
34
|
palette: palette
|
|
36
35
|
}, rest)) : ___EmotionJSX(EuiColorPaletteDisplayGradient, _extends({
|
|
36
|
+
css: cssStyles,
|
|
37
37
|
className: classes,
|
|
38
38
|
palette: palette
|
|
39
39
|
}, rest)));
|
package/optimize/es/components/color_picker/color_palette_display/color_palette_display.styles.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { css } from '@emotion/react';
|
|
10
|
+
import { transparentize } from '../../../services';
|
|
11
|
+
import { logicalCSS } from '../../../global_styling';
|
|
12
|
+
export var euiColorPaletteDisplayStyles = function euiColorPaletteDisplayStyles(euiThemeContext) {
|
|
13
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
14
|
+
|
|
15
|
+
// Border is a pseudo element with transparency
|
|
16
|
+
var border = "".concat(euiTheme.border.width.thin, " solid ").concat(transparentize(euiTheme.colors.darkestShade, 0.2));
|
|
17
|
+
return {
|
|
18
|
+
euiColorPaletteDisplay: /*#__PURE__*/css("position:relative;display:flex;flex-direction:row;overflow:hidden;&::after{content:'';position:absolute;inset:0;pointer-events:none;border:", border, ";border-radius:inherit;};label:euiColorPaletteDisplay;"),
|
|
19
|
+
// Sizes
|
|
20
|
+
xs: /*#__PURE__*/css(logicalCSS('height', euiTheme.size.xs), " border-radius:", euiTheme.size.xs, ";;label:xs;"),
|
|
21
|
+
s: /*#__PURE__*/css(logicalCSS('height', euiTheme.size.s), " border-radius:", euiTheme.size.s, ";;label:s;"),
|
|
22
|
+
m: /*#__PURE__*/css(logicalCSS('height', euiTheme.size.base), " border-radius:", euiTheme.size.base, ";;label:m;")
|
|
23
|
+
};
|
|
24
|
+
};
|
package/optimize/es/components/color_picker/color_palette_display/color_palette_display_fixed.js
CHANGED
|
@@ -11,6 +11,7 @@ var _excluded = ["palette", "title"];
|
|
|
11
11
|
import React from 'react';
|
|
12
12
|
import { getFixedLinearGradient } from '../utils';
|
|
13
13
|
import { EuiScreenReaderOnly } from '../../accessibility';
|
|
14
|
+
import { euiColorPaletteDisplayFixed__bleedArea } from './color_palette_display_fixed.styles';
|
|
14
15
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
15
16
|
export var EuiColorPaletteDisplayFixed = function EuiColorPaletteDisplayFixed(_ref) {
|
|
16
17
|
var palette = _ref.palette,
|
|
@@ -30,6 +31,7 @@ export var EuiColorPaletteDisplayFixed = function EuiColorPaletteDisplayFixed(_r
|
|
|
30
31
|
// aria-hidden="true" is to ensure color blocks are ignored by screen readers,
|
|
31
32
|
// and the only accessible text for options is the EuiScreenReaderOnly {title}
|
|
32
33
|
"aria-hidden": "true",
|
|
34
|
+
css: euiColorPaletteDisplayFixed__bleedArea,
|
|
33
35
|
className: "euiColorPaletteDisplayFixed__bleedArea"
|
|
34
36
|
}, paletteStops));
|
|
35
37
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { css } from '@emotion/react';
|
|
10
|
+
import { logicalCSS } from '../../../global_styling';
|
|
11
|
+
|
|
12
|
+
// In a few screen sizes the palette display doesn't get a fully 100% width -
|
|
13
|
+
// it gets 1px less on width. For this reason we're adding a horizontal 1px bleed area
|
|
14
|
+
export var euiColorPaletteDisplayFixed__bleedArea = /*#__PURE__*/css("position:absolute;inset:0;", logicalCSS('right', '-1px'), " display:flex;;label:euiColorPaletteDisplayFixed__bleedArea;");
|