@elastic/eui 95.1.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 -604
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +8 -604
- 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/combo_box/combo_box_input/combo_box_input.js +2 -1
- package/es/components/context_menu/context_menu_item.js +1 -1
- package/es/components/form/file_picker/file_picker.js +54 -40
- package/es/components/form/file_picker/file_picker.styles.js +98 -0
- package/es/components/form/range/range.styles.js +1 -1
- package/es/components/icon/assets/app_cases.js +9 -7
- package/es/components/icon/assets/logo_elastic_stack.js +6 -12
- 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/components/steps/step.js +5 -3
- package/es/components/steps/step.styles.js +13 -5
- package/es/components/steps/step_horizontal.js +8 -3
- package/es/components/steps/step_horizontal.styles.js +1 -0
- package/es/components/steps/step_number.js +48 -24
- package/es/components/steps/step_number.styles.js +4 -2
- package/es/components/steps/steps.js +3 -1
- package/es/components/steps/steps_horizontal.js +1 -1
- 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/es/services/theme/warning.js +7 -2
- package/eui.d.ts +7610 -7492
- package/i18ntokens.json +66 -66
- 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/combo_box/combo_box_input/combo_box_input.js +2 -1
- package/lib/components/context_menu/context_menu_item.js +1 -1
- package/lib/components/form/file_picker/file_picker.js +56 -42
- package/lib/components/form/file_picker/file_picker.styles.js +102 -0
- package/lib/components/form/range/range.styles.js +1 -1
- package/lib/components/icon/assets/app_cases.js +9 -7
- package/lib/components/icon/assets/logo_elastic_stack.js +6 -12
- package/lib/components/icon/svgs/app_cases.svg +6 -5
- package/lib/components/icon/svgs/logo_elastic_stack.svg +4 -7
- 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/components/steps/step.js +5 -3
- package/lib/components/steps/step.styles.js +13 -5
- package/lib/components/steps/step_horizontal.js +8 -3
- package/lib/components/steps/step_horizontal.styles.js +1 -0
- package/lib/components/steps/step_number.js +48 -24
- package/lib/components/steps/step_number.styles.js +3 -1
- package/lib/components/steps/steps.js +3 -1
- package/lib/components/steps/steps_horizontal.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/lib/services/theme/warning.js +7 -2
- 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/combo_box/combo_box_input/combo_box_input.js +2 -1
- package/optimize/es/components/form/file_picker/file_picker.js +45 -39
- package/optimize/es/components/form/file_picker/file_picker.styles.js +98 -0
- package/optimize/es/components/form/range/range.styles.js +1 -1
- package/optimize/es/components/icon/assets/app_cases.js +9 -7
- package/optimize/es/components/icon/assets/logo_elastic_stack.js +6 -12
- 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/components/steps/step.js +2 -2
- package/optimize/es/components/steps/step.styles.js +13 -5
- package/optimize/es/components/steps/step_horizontal.js +8 -3
- package/optimize/es/components/steps/step_horizontal.styles.js +1 -0
- package/optimize/es/components/steps/step_number.js +44 -22
- package/optimize/es/components/steps/step_number.styles.js +4 -2
- package/optimize/es/components/steps/steps_horizontal.js +1 -1
- 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/es/services/theme/warning.js +7 -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/combo_box/combo_box_input/combo_box_input.js +2 -1
- package/optimize/lib/components/form/file_picker/file_picker.js +47 -41
- package/optimize/lib/components/form/file_picker/file_picker.styles.js +102 -0
- package/optimize/lib/components/form/range/range.styles.js +1 -1
- package/optimize/lib/components/icon/assets/app_cases.js +9 -7
- package/optimize/lib/components/icon/assets/logo_elastic_stack.js +6 -12
- package/optimize/lib/components/icon/svgs/app_cases.svg +6 -5
- package/optimize/lib/components/icon/svgs/logo_elastic_stack.svg +4 -7
- 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/components/steps/step.js +2 -2
- package/optimize/lib/components/steps/step.styles.js +13 -5
- package/optimize/lib/components/steps/step_horizontal.js +8 -3
- package/optimize/lib/components/steps/step_horizontal.styles.js +1 -0
- package/optimize/lib/components/steps/step_number.js +44 -22
- package/optimize/lib/components/steps/step_number.styles.js +3 -1
- package/optimize/lib/components/steps/steps_horizontal.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/optimize/lib/services/theme/warning.js +7 -2
- package/package.json +10 -7
- package/src/components/form/_index.scss +0 -1
- 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/combo_box/combo_box_input/combo_box_input.js +2 -1
- package/test-env/components/context_menu/context_menu_item.js +1 -1
- package/test-env/components/form/file_picker/file_picker.js +51 -42
- package/test-env/components/form/file_picker/file_picker.styles.js +102 -0
- package/test-env/components/form/range/range.styles.js +1 -1
- package/test-env/components/icon/assets/app_cases.js +9 -7
- package/test-env/components/icon/assets/logo_elastic_stack.js +6 -12
- 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/components/steps/step.js +5 -3
- package/test-env/components/steps/step.styles.js +13 -5
- package/test-env/components/steps/step_horizontal.js +8 -3
- package/test-env/components/steps/step_horizontal.styles.js +1 -0
- package/test-env/components/steps/step_number.js +48 -24
- package/test-env/components/steps/step_number.styles.js +3 -1
- package/test-env/components/steps/steps.js +3 -1
- package/test-env/components/steps/steps_horizontal.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/test-env/services/theme/warning.js +7 -2
- 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/components/form/file_picker/_file_picker.scss +0 -212
- package/src/components/form/file_picker/_index.scss +0 -2
- package/src/components/form/file_picker/_variables.scss +0 -1
- package/src/themes/amsterdam/overrides/_hue.scss +0 -44
|
@@ -14,8 +14,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
14
14
|
|
|
15
15
|
import React, { forwardRef, useMemo } from 'react';
|
|
16
16
|
import classNames from 'classnames';
|
|
17
|
-
import {
|
|
17
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
18
18
|
import { useEuiI18n } from '../i18n';
|
|
19
|
+
import { getChromaColor } from './utils';
|
|
20
|
+
import { euiColorPickerSwatchStyles } from './color_picker_swatch.styles';
|
|
19
21
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
22
|
export var EuiColorPickerSwatch = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
21
23
|
var className = _ref.className,
|
|
@@ -23,6 +25,7 @@ export var EuiColorPickerSwatch = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
23
25
|
style = _ref.style,
|
|
24
26
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
25
27
|
var classes = classNames('euiColorPickerSwatch', className);
|
|
28
|
+
var styles = useEuiMemoizedStyles(euiColorPickerSwatchStyles);
|
|
26
29
|
var chromaColor = useMemo(function () {
|
|
27
30
|
return getChromaColor(color, true);
|
|
28
31
|
}, [color]);
|
|
@@ -34,6 +37,7 @@ export var EuiColorPickerSwatch = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
34
37
|
});
|
|
35
38
|
return ___EmotionJSX("button", _extends({
|
|
36
39
|
type: "button",
|
|
40
|
+
css: styles.euiColorPickerSwatch,
|
|
37
41
|
className: classes,
|
|
38
42
|
"aria-label": ariaLabel,
|
|
39
43
|
ref: ref,
|
|
@@ -0,0 +1,19 @@
|
|
|
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 { logicalSizeCSS, mathWithUnits, euiOutline } from '../../global_styling';
|
|
12
|
+
export var euiColorPickerSwatchStyles = function euiColorPickerSwatchStyles(euiThemeContext) {
|
|
13
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
14
|
+
return {
|
|
15
|
+
euiColorPickerSwatch: /*#__PURE__*/css("display:inline-block;", logicalSizeCSS(euiTheme.size.l), " border-radius:", mathWithUnits(euiTheme.border.radius.medium, function (x) {
|
|
16
|
+
return x / 2;
|
|
17
|
+
}), ";border:", euiTheme.border.width.thin, " solid ", transparentize(euiTheme.colors.fullShade, 0.1), ";box-shadow:inset 0 0 0 ", euiTheme.border.width.thin, " ", transparentize(euiTheme.colors.emptyShade, 0.05), ";cursor:pointer;&:disabled{cursor:default;}&:focus{", euiOutline(euiThemeContext, 'center'), ";};label:euiColorPickerSwatch;")
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -11,8 +11,10 @@ var _excluded = ["className", "hex", "hue", "id", "onChange"];
|
|
|
11
11
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
14
15
|
import { EuiScreenReaderOnly } from '../accessibility';
|
|
15
16
|
import { EuiI18n } from '../i18n';
|
|
17
|
+
import { euiHueStyles } from './hue.styles';
|
|
16
18
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
17
19
|
var HUE_RANGE = 359;
|
|
18
20
|
export var EuiHue = function EuiHue(_ref) {
|
|
@@ -23,27 +25,30 @@ export var EuiHue = function EuiHue(_ref) {
|
|
|
23
25
|
id = _ref.id,
|
|
24
26
|
onChange = _ref.onChange,
|
|
25
27
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
var classes = classNames('euiHue', className);
|
|
29
|
+
var styles = useEuiMemoizedStyles(euiHueStyles);
|
|
26
30
|
var handleChange = function handleChange(e) {
|
|
27
31
|
onChange(Number(e.target.value));
|
|
28
32
|
};
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
return ___EmotionJSX("div", {
|
|
34
|
+
css: styles.euiHue,
|
|
35
|
+
className: classes
|
|
36
|
+
}, ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("label", {
|
|
31
37
|
htmlFor: "".concat(id, "-hue")
|
|
32
38
|
}, ___EmotionJSX(EuiI18n, {
|
|
33
39
|
token: "euiHue.label",
|
|
34
40
|
default: "Select the HSV color mode 'hue' value"
|
|
35
41
|
}))), ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", {
|
|
36
42
|
"aria-live": "polite"
|
|
37
|
-
}, hex)), ___EmotionJSX("
|
|
38
|
-
className: classes
|
|
39
|
-
}, ___EmotionJSX("input", _extends({
|
|
43
|
+
}, hex)), ___EmotionJSX("input", _extends({
|
|
40
44
|
id: "".concat(id, "-hue"),
|
|
41
45
|
min: 0,
|
|
42
46
|
max: HUE_RANGE,
|
|
43
47
|
step: 1,
|
|
44
48
|
type: "range",
|
|
49
|
+
css: styles.euiHue__range,
|
|
45
50
|
className: "euiHue__range",
|
|
46
51
|
value: hue,
|
|
47
52
|
onChange: handleChange
|
|
48
|
-
}, rest)))
|
|
53
|
+
}, rest)));
|
|
49
54
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
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, mathWithUnits } from '../../global_styling';
|
|
12
|
+
import { euiRangeThumbPerBrowser, euiRangeThumbStyle, euiRangeThumbFocusBoxShadow } from '../form/range/range.styles';
|
|
13
|
+
export var euiHueStyles = function euiHueStyles(euiThemeContext) {
|
|
14
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
15
|
+
var height = euiTheme.size.m;
|
|
16
|
+
var thumbSize = euiTheme.size.l;
|
|
17
|
+
var thumbBorder = mathWithUnits(euiTheme.border.width.thick, function (x) {
|
|
18
|
+
return x * 1.5;
|
|
19
|
+
});
|
|
20
|
+
var thumbBoxShadow = "\n 0 2px 2px -1px ".concat(transparentize(euiTheme.colors.shadow, 0.2), ",\n 0 1px 5px -2px ").concat(transparentize(euiTheme.colors.shadow, 0.2));
|
|
21
|
+
return {
|
|
22
|
+
// This wraps the range and sets a rainbow gradient,
|
|
23
|
+
// which allows the range thumb to be larger than the visible track
|
|
24
|
+
euiHue: /*#__PURE__*/css(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;"),
|
|
25
|
+
euiHue__range: /*#__PURE__*/css(logicalCSS('height', thumbSize), logicalCSS('width', "calc(100% + 2px)"), logicalCSS('margin-horizontal', '-1px'), " ", logicalCSS('margin-top', mathWithUnits(height, function (x) {
|
|
26
|
+
return x / -2;
|
|
27
|
+
})), "appearance:none;background:transparent;&::-webkit-slider-thumb{-webkit-appearance:none;}", euiRangeThumbPerBrowser([euiRangeThumbStyle(euiThemeContext), 'background-color: inherit', "border-width: ".concat(thumbBorder), 'border-radius: 100%', "box-shadow: ".concat(thumbBoxShadow)].join(';\n')), "&:focus{outline:none;}&:focus-visible{", euiRangeThumbPerBrowser(euiRangeThumbFocusBoxShadow(euiThemeContext)), ";};label:euiHue__range;")
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["className", "color", "data-test-subj", "hex", "id", "onChange"];
|
|
5
|
+
var _excluded = ["className", "color", "data-test-subj", "hex", "id", "onChange", "onKeyDown"];
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
/*
|
|
@@ -13,12 +13,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
13
13
|
* Side Public License, v 1.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
|
16
|
+
import React, { forwardRef, useEffect, useRef, useState, useCallback } from 'react';
|
|
17
17
|
import classNames from 'classnames';
|
|
18
|
-
import { keys, useMouseMove } from '../../services';
|
|
18
|
+
import { keys, useMouseMove, useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
|
|
19
19
|
import { isNil } from '../../services/predicate';
|
|
20
|
+
import { logicalStyles } from '../../global_styling';
|
|
20
21
|
import { useEuiI18n } from '../i18n';
|
|
21
22
|
import { getEventPosition } from './utils';
|
|
23
|
+
import { euiSaturationStyles } from './saturation.styles';
|
|
22
24
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
23
25
|
var colorDefaultValue = [1, 0, 0];
|
|
24
26
|
export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
@@ -28,9 +30,17 @@ export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
28
30
|
_ref$dataTestSubj = _ref['data-test-subj'],
|
|
29
31
|
dataTestSubj = _ref$dataTestSubj === void 0 ? 'euiSaturation' : _ref$dataTestSubj,
|
|
30
32
|
hex = _ref.hex,
|
|
31
|
-
|
|
33
|
+
_id = _ref.id,
|
|
32
34
|
onChange = _ref.onChange,
|
|
35
|
+
onKeyDown = _ref.onKeyDown,
|
|
33
36
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
var classes = classNames('euiSaturation', className);
|
|
38
|
+
var styles = useEuiMemoizedStyles(euiSaturationStyles);
|
|
39
|
+
var id = useGeneratedHtmlId({
|
|
40
|
+
conditionalId: _id
|
|
41
|
+
});
|
|
42
|
+
var instructionsId = "".concat(id, "-instructions");
|
|
43
|
+
var indicatorId = "".concat(id, "-saturationIndicator");
|
|
34
44
|
var _useEuiI18n = 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."]),
|
|
35
45
|
_useEuiI18n2 = _slicedToArray(_useEuiI18n, 2),
|
|
36
46
|
roleDescString = _useEuiI18n2[0],
|
|
@@ -62,7 +72,7 @@ export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
62
72
|
});
|
|
63
73
|
}
|
|
64
74
|
}, [color, lastColor]);
|
|
65
|
-
var calculateColor = function
|
|
75
|
+
var calculateColor = useCallback(function (_ref2) {
|
|
66
76
|
var top = _ref2.top,
|
|
67
77
|
height = _ref2.height,
|
|
68
78
|
left = _ref2.left,
|
|
@@ -72,8 +82,8 @@ export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
72
82
|
var s = left / width;
|
|
73
83
|
var v = 1 - top / height;
|
|
74
84
|
return [h, s, v];
|
|
75
|
-
};
|
|
76
|
-
var handleUpdate = function
|
|
85
|
+
}, [color]);
|
|
86
|
+
var handleUpdate = useCallback(function (box) {
|
|
77
87
|
var left = box.left,
|
|
78
88
|
top = box.top;
|
|
79
89
|
setIndicator({
|
|
@@ -83,17 +93,18 @@ export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
83
93
|
var newColor = calculateColor(box);
|
|
84
94
|
setLastColor(newColor);
|
|
85
95
|
onChange(newColor);
|
|
86
|
-
};
|
|
87
|
-
var handleChange = function
|
|
96
|
+
}, [calculateColor, onChange]);
|
|
97
|
+
var handleChange = useCallback(function (location) {
|
|
88
98
|
if (isNil(boxRef === null || boxRef === void 0 ? void 0 : boxRef.current)) return;
|
|
89
99
|
var box = getEventPosition(location, boxRef.current);
|
|
90
100
|
handleUpdate(box);
|
|
91
|
-
};
|
|
101
|
+
}, [handleUpdate]);
|
|
92
102
|
var _useMouseMove = useMouseMove(handleChange, boxRef.current),
|
|
93
103
|
_useMouseMove2 = _slicedToArray(_useMouseMove, 2),
|
|
94
104
|
handleMouseDown = _useMouseMove2[0],
|
|
95
105
|
handleInteraction = _useMouseMove2[1];
|
|
96
|
-
var handleKeyDown = function
|
|
106
|
+
var handleKeyDown = useCallback(function (event) {
|
|
107
|
+
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
|
|
97
108
|
if (isNil(boxRef === null || boxRef === void 0 ? void 0 : boxRef.current)) return;
|
|
98
109
|
var _boxRef$current$getBo2 = boxRef.current.getBoundingClientRect(),
|
|
99
110
|
height = _boxRef$current$getBo2.height,
|
|
@@ -134,15 +145,14 @@ export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
134
145
|
height: height
|
|
135
146
|
}, newPosition));
|
|
136
147
|
onChange(newColor);
|
|
137
|
-
};
|
|
138
|
-
var classes = classNames('euiSaturation', className);
|
|
139
|
-
var instructionsId = "".concat(id, "-instructions");
|
|
148
|
+
}, [calculateColor, indicator, onChange, onKeyDown]);
|
|
140
149
|
return ___EmotionJSX("div", _extends({
|
|
141
150
|
onMouseDown: handleMouseDown,
|
|
142
151
|
onTouchStart: handleInteraction,
|
|
143
152
|
onTouchMove: handleInteraction,
|
|
144
153
|
onKeyDown: handleKeyDown,
|
|
145
154
|
ref: ref,
|
|
155
|
+
css: styles.euiSaturation,
|
|
146
156
|
className: classes,
|
|
147
157
|
"data-test-subj": dataTestSubj,
|
|
148
158
|
style: {
|
|
@@ -150,14 +160,17 @@ export var EuiSaturation = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
150
160
|
},
|
|
151
161
|
tabIndex: -1
|
|
152
162
|
}, rest), ___EmotionJSX("div", {
|
|
163
|
+
css: styles.euiSaturation__lightness,
|
|
153
164
|
className: "euiSaturation__lightness",
|
|
154
165
|
ref: boxRef
|
|
155
166
|
}, ___EmotionJSX("div", {
|
|
167
|
+
css: styles.euiSaturation__saturation,
|
|
156
168
|
className: "euiSaturation__saturation"
|
|
157
169
|
})), ___EmotionJSX("button", {
|
|
158
|
-
id:
|
|
170
|
+
id: indicatorId,
|
|
171
|
+
css: styles.euiSaturation__indicator,
|
|
159
172
|
className: "euiSaturation__indicator",
|
|
160
|
-
style:
|
|
173
|
+
style: logicalStyles(indicator),
|
|
161
174
|
"aria-roledescription": roleDescString,
|
|
162
175
|
"aria-label": hex,
|
|
163
176
|
"aria-describedby": instructionsId
|
|
@@ -0,0 +1,23 @@
|
|
|
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, logicalSizeCSS, mathWithUnits } from '../../global_styling';
|
|
11
|
+
export var euiSaturationStyles = function euiSaturationStyles(euiThemeContext) {
|
|
12
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
13
|
+
var indicatorSize = euiTheme.size.m;
|
|
14
|
+
var borderRadius = mathWithUnits(euiTheme.border.radius.medium, function (x) {
|
|
15
|
+
return x / 2;
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
euiSaturation: /*#__PURE__*/css("z-index:3;position:relative;", logicalCSS('width', '100%'), " ", 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;"),
|
|
19
|
+
euiSaturation__lightness: /*#__PURE__*/css("position:absolute;inset:0;", 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;"),
|
|
20
|
+
euiSaturation__saturation: /*#__PURE__*/css("position:absolute;inset:0;", logicalCSS('top', '-1px'), "border-radius:", borderRadius, ";background:linear-gradient(to top, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));;label:euiSaturation__saturation;"),
|
|
21
|
+
euiSaturation__indicator: /*#__PURE__*/css("position:absolute;", 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;")
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -285,7 +285,8 @@ export var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
285
285
|
},
|
|
286
286
|
placeholder: showPlaceholder ? placeholder : undefined,
|
|
287
287
|
value: this.searchValue,
|
|
288
|
-
autoFocus: autoFocus
|
|
288
|
+
autoFocus: autoFocus,
|
|
289
|
+
autoComplete: "off"
|
|
289
290
|
// Force the menu to re-open on every input click - only necessary when plain text
|
|
290
291
|
,
|
|
291
292
|
onClick: this.asPlainText ? onFocus : undefined // Type shenanigans - event should be mostly the same
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -6,7 +7,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
8
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
var _excluded = ["id", "name", "initialPromptText", "className", "disabled", "compressed", "onChange", "isInvalid", "fullWidth", "isLoading", "display"];
|
|
10
|
+
var _excluded = ["stylesMemoizer", "id", "name", "initialPromptText", "className", "disabled", "compressed", "onChange", "isInvalid", "fullWidth", "isLoading", "display"];
|
|
10
11
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
11
12
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
13
|
/*
|
|
@@ -19,29 +20,25 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
19
20
|
|
|
20
21
|
import React, { Component } from 'react';
|
|
21
22
|
import classNames from 'classnames';
|
|
22
|
-
import {
|
|
23
|
-
import { EuiValidatableControl } from '../validatable_control';
|
|
23
|
+
import { withEuiStylesMemoizer, htmlIdGenerator } from '../../../services';
|
|
24
24
|
import { EuiButtonEmpty } from '../../button';
|
|
25
25
|
import { EuiProgress } from '../../progress';
|
|
26
26
|
import { EuiIcon } from '../../icon';
|
|
27
27
|
import { EuiI18n } from '../../i18n';
|
|
28
28
|
import { EuiLoadingSpinner } from '../../loading';
|
|
29
|
-
import { htmlIdGenerator } from '../../../services/accessibility';
|
|
30
29
|
import { FormContext } from '../eui_form_context';
|
|
30
|
+
import { EuiValidatableControl } from '../validatable_control';
|
|
31
|
+
import { EuiFormControlLayoutClearButton } from '../form_control_layout/form_control_layout_clear_button';
|
|
32
|
+
import { euiFilePickerStyles } from './file_picker.styles';
|
|
31
33
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
large: 'euiFilePicker--large'
|
|
35
|
-
};
|
|
36
|
-
export var DISPLAYS = keysOf(displayToClassNameMap);
|
|
37
|
-
export var EuiFilePicker = /*#__PURE__*/function (_Component) {
|
|
38
|
-
function EuiFilePicker() {
|
|
34
|
+
export var EuiFilePickerClass = /*#__PURE__*/function (_Component) {
|
|
35
|
+
function EuiFilePickerClass() {
|
|
39
36
|
var _this;
|
|
40
|
-
_classCallCheck(this,
|
|
37
|
+
_classCallCheck(this, EuiFilePickerClass);
|
|
41
38
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
42
39
|
args[_key] = arguments[_key];
|
|
43
40
|
}
|
|
44
|
-
_this = _callSuper(this,
|
|
41
|
+
_this = _callSuper(this, EuiFilePickerClass, [].concat(args));
|
|
45
42
|
_defineProperty(_this, "state", {
|
|
46
43
|
promptText: null,
|
|
47
44
|
isHoveringDrop: false
|
|
@@ -97,18 +94,19 @@ export var EuiFilePicker = /*#__PURE__*/function (_Component) {
|
|
|
97
94
|
});
|
|
98
95
|
return _this;
|
|
99
96
|
}
|
|
100
|
-
_inherits(
|
|
101
|
-
return _createClass(
|
|
97
|
+
_inherits(EuiFilePickerClass, _Component);
|
|
98
|
+
return _createClass(EuiFilePickerClass, [{
|
|
102
99
|
key: "render",
|
|
103
100
|
value: function render() {
|
|
104
101
|
var _this2 = this;
|
|
105
102
|
var _ref = this.context,
|
|
106
103
|
defaultFullWidth = _ref.defaultFullWidth;
|
|
107
104
|
return ___EmotionJSX(EuiI18n, {
|
|
108
|
-
token: "euiFilePicker.
|
|
109
|
-
default: "
|
|
110
|
-
}, function (
|
|
105
|
+
token: "euiFilePicker.removeSelectedAriaLabel",
|
|
106
|
+
default: "Remove selected files"
|
|
107
|
+
}, function (removeSelectedAriaLabel) {
|
|
111
108
|
var _this2$props = _this2.props,
|
|
109
|
+
stylesMemoizer = _this2$props.stylesMemoizer,
|
|
112
110
|
id = _this2$props.id,
|
|
113
111
|
name = _this2$props.name,
|
|
114
112
|
initialPromptText = _this2$props.initialPromptText,
|
|
@@ -125,34 +123,39 @@ export var EuiFilePicker = /*#__PURE__*/function (_Component) {
|
|
|
125
123
|
var promptId = "".concat(id || _this2.generatedId, "-filePicker__prompt");
|
|
126
124
|
var isOverridingInitialPrompt = _this2.state.promptText != null;
|
|
127
125
|
var normalFormControl = display === 'default';
|
|
128
|
-
var classes = classNames('euiFilePicker',
|
|
129
|
-
|
|
130
|
-
'euiFilePicker--compressed': compressed,
|
|
131
|
-
'euiFilePicker--fullWidth': fullWidth,
|
|
126
|
+
var classes = classNames('euiFilePicker', {
|
|
127
|
+
'euiFilePicker-isDroppingFile': _this2.state.isHoveringDrop,
|
|
132
128
|
'euiFilePicker-isInvalid': isInvalid,
|
|
133
129
|
'euiFilePicker-isLoading': isLoading,
|
|
134
130
|
'euiFilePicker-hasFiles': isOverridingInitialPrompt
|
|
135
131
|
}, className);
|
|
132
|
+
var styles = stylesMemoizer(euiFilePickerStyles);
|
|
133
|
+
var cssStyles = [styles.euiFilePicker, fullWidth ? styles.fullWidth : styles.formWidth, _this2.state.isHoveringDrop && styles.isDroppingFile, isInvalid && !disabled && styles.invalid, isOverridingInitialPrompt && !disabled && styles.hasFiles, isLoading && styles.loading];
|
|
134
|
+
var inputStyles = [styles.input.euiFilePicker__input, !normalFormControl && !disabled && styles.input.largeInteractive];
|
|
135
|
+
var promptStyles = [styles.euiFilePicker__prompt, disabled && styles.disabled].concat(_toConsumableArray(normalFormControl ? [compressed ? styles.compressed : styles.uncompressed] : [styles.large.large, compressed ? styles.large.compressed : styles.large.uncompressed]));
|
|
136
|
+
var iconStyles = [styles.icon.euiFilePicker__icon].concat(_toConsumableArray(normalFormControl ? [styles.icon.normal, compressed ? styles.icon.compresssed : styles.icon.uncompressed] : [styles.icon.large]));
|
|
137
|
+
var rightIconStyles = normalFormControl ? [styles.rightIcon.euiFilePicker__rightIcon, compressed ? styles.rightIcon.compressed : styles.rightIcon.uncompressed] : undefined;
|
|
136
138
|
var clearButton;
|
|
137
139
|
if (isLoading && normalFormControl) {
|
|
138
140
|
// Override clear button with loading spinner if it is in loading state
|
|
139
141
|
clearButton = ___EmotionJSX(EuiLoadingSpinner, {
|
|
140
|
-
|
|
142
|
+
css: rightIconStyles,
|
|
143
|
+
className: "euiFilePicker__loadingSpinner",
|
|
144
|
+
size: compressed ? 's' : 'm'
|
|
141
145
|
});
|
|
142
146
|
} else if (isOverridingInitialPrompt && !disabled) {
|
|
143
147
|
if (normalFormControl) {
|
|
144
|
-
clearButton = ___EmotionJSX(
|
|
145
|
-
|
|
146
|
-
"
|
|
148
|
+
clearButton = ___EmotionJSX(EuiFormControlLayoutClearButton, {
|
|
149
|
+
"aria-label": removeSelectedAriaLabel,
|
|
150
|
+
css: [styles.euiFilePicker__clearButton, rightIconStyles, ";label:clearButton;"],
|
|
147
151
|
className: "euiFilePicker__clearButton",
|
|
148
|
-
onClick: _this2.removeFiles
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
type: "cross"
|
|
152
|
-
}));
|
|
152
|
+
onClick: _this2.removeFiles,
|
|
153
|
+
size: compressed ? 's' : 'm'
|
|
154
|
+
});
|
|
153
155
|
} else {
|
|
154
156
|
clearButton = ___EmotionJSX(EuiButtonEmpty, {
|
|
155
|
-
"aria-label":
|
|
157
|
+
"aria-label": removeSelectedAriaLabel,
|
|
158
|
+
css: styles.euiFilePicker__clearButton,
|
|
156
159
|
className: "euiFilePicker__clearButton",
|
|
157
160
|
size: "xs",
|
|
158
161
|
onClick: _this2.removeFiles
|
|
@@ -170,15 +173,15 @@ export var EuiFilePicker = /*#__PURE__*/function (_Component) {
|
|
|
170
173
|
position: "absolute"
|
|
171
174
|
});
|
|
172
175
|
return ___EmotionJSX("div", {
|
|
176
|
+
css: cssStyles,
|
|
173
177
|
className: classes
|
|
174
|
-
}, ___EmotionJSX("div", {
|
|
175
|
-
className: "euiFilePicker__wrap"
|
|
176
178
|
}, ___EmotionJSX(EuiValidatableControl, {
|
|
177
179
|
isInvalid: isInvalid
|
|
178
180
|
}, ___EmotionJSX("input", _extends({
|
|
179
181
|
type: "file",
|
|
180
182
|
id: id,
|
|
181
183
|
name: name,
|
|
184
|
+
css: inputStyles,
|
|
182
185
|
className: "euiFilePicker__input",
|
|
183
186
|
onChange: _this2.handleChange,
|
|
184
187
|
ref: function ref(input) {
|
|
@@ -190,27 +193,30 @@ export var EuiFilePicker = /*#__PURE__*/function (_Component) {
|
|
|
190
193
|
disabled: disabled,
|
|
191
194
|
"aria-describedby": promptId
|
|
192
195
|
}, rest))), ___EmotionJSX("div", {
|
|
196
|
+
css: promptStyles,
|
|
193
197
|
className: "euiFilePicker__prompt",
|
|
194
198
|
id: promptId
|
|
195
199
|
}, ___EmotionJSX(EuiIcon, {
|
|
200
|
+
css: iconStyles,
|
|
196
201
|
className: "euiFilePicker__icon",
|
|
197
202
|
color: isInvalid ? 'danger' : disabled ? 'subdued' : 'primary',
|
|
198
203
|
type: isInvalid ? 'alert' : 'importAction',
|
|
199
204
|
size: normalFormControl ? 'm' : 'l',
|
|
200
205
|
"aria-hidden": "true"
|
|
201
|
-
}), ___EmotionJSX("
|
|
206
|
+
}), ___EmotionJSX("span", {
|
|
202
207
|
className: "euiFilePicker__promptText"
|
|
203
|
-
}, _this2.state.promptText || initialPromptText), clearButton, loader))
|
|
208
|
+
}, _this2.state.promptText || initialPromptText), clearButton, loader));
|
|
204
209
|
});
|
|
205
210
|
}
|
|
206
211
|
}]);
|
|
207
212
|
}(Component);
|
|
208
|
-
_defineProperty(
|
|
209
|
-
_defineProperty(
|
|
213
|
+
_defineProperty(EuiFilePickerClass, "contextType", FormContext);
|
|
214
|
+
_defineProperty(EuiFilePickerClass, "defaultProps", {
|
|
210
215
|
initialPromptText: ___EmotionJSX(EuiI18n, {
|
|
211
216
|
token: "euiFilePicker.promptText",
|
|
212
217
|
default: "Select or drag and drop a file"
|
|
213
218
|
}),
|
|
214
219
|
compressed: false,
|
|
215
220
|
display: 'large'
|
|
216
|
-
});
|
|
221
|
+
});
|
|
222
|
+
export var EuiFilePicker = withEuiStylesMemoizer(EuiFilePickerClass);
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import { euiCanAnimate, euiFontSize, euiTextTruncate, logicalCSS, mathWithUnits } from '../../../global_styling';
|
|
12
|
+
import { euiFormControlStyles, euiFormVariables } from '../form.styles';
|
|
13
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
14
|
+
name: "6h1iuq-euiFilePicker__clearButton",
|
|
15
|
+
styles: "pointer-events:auto;position:relative;label:euiFilePicker__clearButton;"
|
|
16
|
+
} : {
|
|
17
|
+
name: "6h1iuq-euiFilePicker__clearButton",
|
|
18
|
+
styles: "pointer-events:auto;position:relative;label:euiFilePicker__clearButton;",
|
|
19
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
20
|
+
};
|
|
21
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
22
|
+
name: "d8me89-euiFilePicker__rightIcon",
|
|
23
|
+
styles: "position:absolute;label:euiFilePicker__rightIcon;"
|
|
24
|
+
} : {
|
|
25
|
+
name: "d8me89-euiFilePicker__rightIcon",
|
|
26
|
+
styles: "position:absolute;label:euiFilePicker__rightIcon;",
|
|
27
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
28
|
+
};
|
|
29
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
30
|
+
name: "19x04ih-largeInteractive",
|
|
31
|
+
styles: "&:hover,&:focus,.euiFilePicker-isDroppingFile &{&+.euiFilePicker__prompt{.euiFilePicker__promptText{text-decoration:underline;}.euiFilePicker__icon{transform:scale(1.1);}}};label:largeInteractive;"
|
|
32
|
+
} : {
|
|
33
|
+
name: "19x04ih-largeInteractive",
|
|
34
|
+
styles: "&:hover,&:focus,.euiFilePicker-isDroppingFile &{&+.euiFilePicker__prompt{.euiFilePicker__promptText{text-decoration:underline;}.euiFilePicker__icon{transform:scale(1.1);}}};label:largeInteractive;",
|
|
35
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
36
|
+
};
|
|
37
|
+
var _ref4 = process.env.NODE_ENV === "production" ? {
|
|
38
|
+
name: "1j9s7hu-euiFilePicker__input",
|
|
39
|
+
styles: "position:absolute;inset:0;opacity:0;&:hover{cursor:pointer;}&:hover:disabled{cursor:not-allowed;}&:disabled{opacity:0;};label:euiFilePicker__input;"
|
|
40
|
+
} : {
|
|
41
|
+
name: "1j9s7hu-euiFilePicker__input",
|
|
42
|
+
styles: "position:absolute;inset:0;opacity:0;&:hover{cursor:pointer;}&:hover:disabled{cursor:not-allowed;}&:disabled{opacity:0;};label:euiFilePicker__input;",
|
|
43
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
44
|
+
};
|
|
45
|
+
export var euiFilePickerStyles = function euiFilePickerStyles(euiThemeContext) {
|
|
46
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
47
|
+
var formStyles = euiFormControlStyles(euiThemeContext);
|
|
48
|
+
var formVariables = euiFormVariables(euiThemeContext);
|
|
49
|
+
var _euiFontSize = euiFontSize(euiThemeContext, 's'),
|
|
50
|
+
fontSize = _euiFontSize.fontSize,
|
|
51
|
+
lineHeight = _euiFontSize.lineHeight;
|
|
52
|
+
return {
|
|
53
|
+
euiFilePicker: /*#__PURE__*/css("--euiFormControlLeftIconsCount:1;position:relative;&:has(input:focus){--euiFormControlStateColor:", euiTheme.colors.primary, ";};label:euiFilePicker;"),
|
|
54
|
+
isDroppingFile: /*#__PURE__*/css("--euiFormControlStateColor:", euiTheme.colors.primary, ";;label:isDroppingFile;"),
|
|
55
|
+
invalid: /*#__PURE__*/css("--euiFormControlStateColor:", euiTheme.colors.danger, ";;label:invalid;"),
|
|
56
|
+
hasFiles: /*#__PURE__*/css("--euiFormControlRightIconsCount:1;font-weight:", euiTheme.font.weight.bold, ";;label:hasFiles;"),
|
|
57
|
+
loading: /*#__PURE__*/css("--euiFormControlRightIconsCount:1;border-radius:", formVariables.controlCompressedBorderRadius, ";overflow:hidden;;label:loading;"),
|
|
58
|
+
// Skip the css() on the default width to avoid generating a className
|
|
59
|
+
formWidth: formStyles.formWidth,
|
|
60
|
+
fullWidth: /*#__PURE__*/css(formStyles.fullWidth, ";label:fullWidth;"),
|
|
61
|
+
// The input is an invisible dropzone / button
|
|
62
|
+
input: {
|
|
63
|
+
euiFilePicker__input: _ref4,
|
|
64
|
+
largeInteractive: _ref3
|
|
65
|
+
},
|
|
66
|
+
euiFilePicker__prompt: /*#__PURE__*/css("pointer-events:none;font-size:", fontSize, ";line-height:1;", euiTextTruncate(), " color:", euiTheme.colors.text, ";border:", euiTheme.border.width.thick, " dashed var(--euiFormControlStateColor, ", euiTheme.colors.lightShade, ");", euiCanAnimate, "{transition:border-color ", euiTheme.animation.fast, " ease-in,background-color ", euiTheme.animation.fast, " ease-in;};label:euiFilePicker__prompt;"),
|
|
67
|
+
disabled: /*#__PURE__*/css(formStyles.disabled, ";label:disabled;"),
|
|
68
|
+
// Skip the css() on the default height to avoid generating a className
|
|
69
|
+
uncompressed: formStyles.uncompressed,
|
|
70
|
+
compressed: /*#__PURE__*/css(formStyles.compressed, ";label:compressed;"),
|
|
71
|
+
// Completely different rendering style from the normal form controls
|
|
72
|
+
large: {
|
|
73
|
+
large: /*#__PURE__*/css("padding-inline:", euiTheme.size.l, ";display:flex;flex-direction:column;align-items:center;justify-content:center;.euiFilePicker__promptText{", euiTextTruncate(), " line-height:", lineHeight, ";};label:large;"),
|
|
74
|
+
// Static heights so that surrounding contents don't shift around
|
|
75
|
+
uncompressed: "\n ".concat(logicalCSS('height', mathWithUnits(euiTheme.size.base, function (x) {
|
|
76
|
+
return x * 8;
|
|
77
|
+
})), "\n border-radius: ").concat(formVariables.controlBorderRadius, ";\n "),
|
|
78
|
+
compressed: /*#__PURE__*/css(logicalCSS('height', mathWithUnits(euiTheme.size.base, function (x) {
|
|
79
|
+
return x * 6.5;
|
|
80
|
+
})), " border-radius:", formVariables.controlCompressedBorderRadius, ";;label:compressed;")
|
|
81
|
+
},
|
|
82
|
+
icon: {
|
|
83
|
+
euiFilePicker__icon: /*#__PURE__*/css(";label:euiFilePicker__icon;"),
|
|
84
|
+
normal: /*#__PURE__*/css("position:absolute;", logicalCSS('top', 0), " ", logicalCSS('height', '100%'), ";;label:normal;"),
|
|
85
|
+
uncompressed: "\n ".concat(logicalCSS('left', euiTheme.size.m), "\n "),
|
|
86
|
+
compresssed: /*#__PURE__*/css(logicalCSS('left', euiTheme.size.s), " ", logicalCSS('width', euiTheme.size.m), ";;label:compresssed;"),
|
|
87
|
+
large: /*#__PURE__*/css(logicalCSS('margin-bottom', euiTheme.size.base), " ", euiCanAnimate, "{transition:transform ", euiTheme.animation.fast, " ", euiTheme.animation.resistance, ";};label:large;")
|
|
88
|
+
},
|
|
89
|
+
rightIcon: {
|
|
90
|
+
euiFilePicker__rightIcon: _ref2,
|
|
91
|
+
uncompressed: "\n ".concat(logicalCSS('top', euiTheme.size.m), "\n ").concat(logicalCSS('right', euiTheme.size.m), "\n "),
|
|
92
|
+
compressed: /*#__PURE__*/css(logicalCSS('right', euiTheme.size.s), " ", logicalCSS('top', '50%'), " ", logicalCSS('margin-top', mathWithUnits(euiTheme.size.m, function (x) {
|
|
93
|
+
return x / -2;
|
|
94
|
+
})), ";;label:compressed;")
|
|
95
|
+
},
|
|
96
|
+
euiFilePicker__clearButton: _ref
|
|
97
|
+
};
|
|
98
|
+
};
|
|
@@ -82,7 +82,7 @@ export var euiRangeThumbStyle = function euiRangeThumbStyle(euiThemeContext) {
|
|
|
82
82
|
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 ");
|
|
83
83
|
};
|
|
84
84
|
export var euiRangeThumbPerBrowser = function euiRangeThumbPerBrowser(content) {
|
|
85
|
-
return "\n &::-webkit-slider-thumb { ".concat(content, "; }\n &::-moz-range-thumb
|
|
85
|
+
return "\n &::-webkit-slider-thumb { ".concat(content, "; }\n &::-moz-range-thumb { ").concat(content, "; }\n &::-ms-thumb {").concat(content, "; }\n ");
|
|
86
86
|
};
|
|
87
87
|
export var euiRangeThumbFocus = function euiRangeThumbFocus(euiThemeContext, color) {
|
|
88
88
|
var range = euiRangeVariables(euiThemeContext);
|
|
@@ -21,21 +21,23 @@ var EuiIconAppCases = function EuiIconAppCases(_ref) {
|
|
|
21
21
|
xmlns: "http://www.w3.org/2000/svg",
|
|
22
22
|
width: 32,
|
|
23
23
|
height: 32,
|
|
24
|
-
fill: "none",
|
|
25
24
|
viewBox: "0 0 32 32",
|
|
26
25
|
"aria-labelledby": titleId
|
|
27
26
|
}, props), title ? ___EmotionJSX("title", {
|
|
28
27
|
id: titleId
|
|
29
28
|
}, title) : null, ___EmotionJSX("path", {
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
d: "M4 6h22v7h-2V8H6v19H4V6Z",
|
|
30
|
+
className: "euiIcon__fillSecondary"
|
|
31
|
+
}), ___EmotionJSX("path", {
|
|
32
|
+
d: "M10 12H7v-2h3v2Zm1 0h12v-2H11v2Z",
|
|
33
|
+
className: "euiIcon__fillSecondary"
|
|
34
|
+
}), ___EmotionJSX("path", {
|
|
35
|
+
d: "M24 1H0v26h1l-1 .001v.026a2.256 2.256 0 0 0 .01.185 4.318 4.318 0 0 0 .563 1.792C1.194 30.064 2.399 31 4.5 31H17v-2H8.429a4.32 4.32 0 0 0 .57-1.927v-.062L9 27.005v-.003S9 27 8 27h1V16h21v3h2v-5H7v12.995l-.003.05a2.32 2.32 0 0 1-.298.95C6.442 28.436 5.898 29 4.5 29c-1.398 0-1.942-.564-2.199-1.004a2.32 2.32 0 0 1-.3-1.001L2 26.992V3h20v3h2V1Z"
|
|
32
36
|
}), ___EmotionJSX("path", {
|
|
33
|
-
d: "
|
|
37
|
+
d: "M23 21v3h-3v2h3v3h2v-3h3v-2h-3v-3h-2Z"
|
|
34
38
|
}), ___EmotionJSX("path", {
|
|
35
39
|
fillRule: "evenodd",
|
|
36
|
-
d: "
|
|
37
|
-
className: "euiIcon__fillSecondary",
|
|
38
|
-
clipRule: "evenodd"
|
|
40
|
+
d: "M24 32a7 7 0 1 0 0-14 7 7 0 0 0 0 14Zm0-2a5 5 0 1 0 0-10 5 5 0 0 0 0 10Z"
|
|
39
41
|
}));
|
|
40
42
|
};
|
|
41
43
|
export var icon = EuiIconAppCases;
|