@elastic/eui 72.0.0 → 72.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui_charts_theme.js +13 -1
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +0 -151
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -151
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accordion/accordion.js +1 -1
- package/es/components/basic_table/basic_table.js +2 -2
- package/es/components/basic_table/in_memory_table.js +3 -6
- package/es/components/basic_table/table.a11y.js +128 -0
- package/es/components/color_picker/color_picker.styles.js +16 -0
- package/es/components/color_picker/color_stops/color_stop_thumb.js +19 -7
- package/es/components/color_picker/color_stops/color_stop_thumb.styles.js +59 -0
- package/es/components/color_picker/color_stops/color_stops.js +25 -15
- package/es/components/color_picker/color_stops/color_stops.styles.js +65 -0
- package/es/components/date_picker/super_date_picker/super_date_picker.js +9 -0
- package/es/components/date_picker/super_date_picker/super_update_button.js +8 -0
- package/es/components/form/range/range_highlight.styles.js +1 -1
- package/es/components/form/range/range_levels.styles.js +1 -1
- package/es/components/form/range/range_track.js +5 -2
- package/es/components/image/image.a11y.js +55 -0
- package/es/components/image/image.js +9 -2
- package/es/components/image/image_fullscreen_wrapper.js +3 -1
- package/es/components/image/image_wrapper.js +3 -1
- package/es/components/key_pad_menu/key_pad_menu.a11y.js +158 -0
- package/es/components/markdown_editor/markdown_format.styles.js +2 -5
- package/es/components/popover/popover.js +2 -2
- package/es/components/table/table_footer_cell.js +1 -1
- package/es/components/table/table_header_cell.js +1 -1
- package/es/components/table/table_row_cell.js +2 -2
- package/es/components/text/text.styles.js +6 -3
- package/es/components/tool_tip/icon_tip.js +8 -0
- package/es/components/tool_tip/tool_tip.js +24 -1
- package/es/components/tour/tour.styles.js +1 -1
- package/es/services/color/manipulation.js +9 -0
- package/es/services/index.js +11 -11
- package/eui.d.ts +166 -107
- package/i18ntokens.json +16 -16
- package/lib/components/accordion/accordion.js +1 -1
- package/lib/components/basic_table/basic_table.js +2 -2
- package/lib/components/basic_table/in_memory_table.js +3 -6
- package/lib/components/basic_table/table.a11y.js +139 -0
- package/lib/components/color_picker/color_picker.styles.js +26 -0
- package/lib/components/color_picker/color_stops/color_stop_thumb.js +19 -6
- package/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +69 -0
- package/lib/components/color_picker/color_stops/color_stops.js +25 -14
- package/lib/components/color_picker/color_stops/color_stops.styles.js +73 -0
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +9 -0
- package/lib/components/date_picker/super_date_picker/super_update_button.js +8 -0
- package/lib/components/form/range/range_highlight.styles.js +1 -1
- package/lib/components/form/range/range_levels.styles.js +1 -1
- package/lib/components/form/range/range_track.js +6 -2
- package/lib/components/image/image.a11y.js +61 -0
- package/lib/components/image/image.js +9 -2
- package/lib/components/image/image_fullscreen_wrapper.js +3 -1
- package/lib/components/image/image_wrapper.js +3 -1
- package/lib/components/key_pad_menu/key_pad_menu.a11y.js +163 -0
- package/lib/components/markdown_editor/markdown_format.styles.js +1 -4
- package/lib/components/popover/popover.js +2 -2
- package/lib/components/table/table_footer_cell.js +1 -1
- package/lib/components/table/table_header_cell.js +1 -1
- package/lib/components/table/table_row_cell.js +2 -2
- package/lib/components/text/text.styles.js +5 -2
- package/lib/components/tool_tip/icon_tip.js +8 -0
- package/lib/components/tool_tip/tool_tip.js +24 -1
- package/lib/components/tour/tour.styles.js +1 -1
- package/lib/services/color/manipulation.js +14 -2
- package/lib/services/index.js +65 -58
- package/optimize/es/components/accordion/accordion.js +1 -1
- package/optimize/es/components/basic_table/table.a11y.js +128 -0
- package/optimize/es/components/color_picker/color_picker.styles.js +16 -0
- package/optimize/es/components/color_picker/color_stops/color_stop_thumb.js +19 -7
- package/optimize/es/components/color_picker/color_stops/color_stop_thumb.styles.js +59 -0
- package/optimize/es/components/color_picker/color_stops/color_stops.js +25 -15
- package/optimize/es/components/color_picker/color_stops/color_stops.styles.js +65 -0
- package/optimize/es/components/form/range/range_highlight.styles.js +1 -1
- package/optimize/es/components/form/range/range_levels.styles.js +1 -1
- package/optimize/es/components/form/range/range_track.js +5 -2
- package/optimize/es/components/image/image.a11y.js +55 -0
- package/optimize/es/components/image/image.js +4 -2
- package/optimize/es/components/image/image_fullscreen_wrapper.js +3 -1
- package/optimize/es/components/image/image_wrapper.js +3 -1
- package/optimize/es/components/key_pad_menu/key_pad_menu.a11y.js +148 -0
- package/optimize/es/components/markdown_editor/markdown_format.styles.js +2 -5
- package/optimize/es/components/popover/popover.js +2 -2
- package/optimize/es/components/text/text.styles.js +6 -3
- package/optimize/es/components/tool_tip/tool_tip.js +16 -1
- package/optimize/es/components/tour/tour.styles.js +1 -1
- package/optimize/es/services/color/manipulation.js +9 -0
- package/optimize/es/services/index.js +11 -11
- package/optimize/lib/components/accordion/accordion.js +1 -1
- package/optimize/lib/components/basic_table/table.a11y.js +139 -0
- package/optimize/lib/components/color_picker/color_picker.styles.js +26 -0
- package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.js +19 -6
- package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +69 -0
- package/optimize/lib/components/color_picker/color_stops/color_stops.js +25 -14
- package/optimize/lib/components/color_picker/color_stops/color_stops.styles.js +73 -0
- package/optimize/lib/components/form/range/range_highlight.styles.js +1 -1
- package/optimize/lib/components/form/range/range_levels.styles.js +1 -1
- package/optimize/lib/components/form/range/range_track.js +6 -2
- package/optimize/lib/components/image/image.a11y.js +61 -0
- package/optimize/lib/components/image/image.js +4 -2
- package/optimize/lib/components/image/image_fullscreen_wrapper.js +3 -1
- package/optimize/lib/components/image/image_wrapper.js +3 -1
- package/optimize/lib/components/key_pad_menu/key_pad_menu.a11y.js +163 -0
- package/optimize/lib/components/markdown_editor/markdown_format.styles.js +1 -4
- package/optimize/lib/components/popover/popover.js +2 -2
- package/optimize/lib/components/text/text.styles.js +5 -2
- package/optimize/lib/components/tool_tip/tool_tip.js +16 -1
- package/optimize/lib/components/tour/tour.styles.js +1 -1
- package/optimize/lib/services/color/manipulation.js +14 -2
- package/optimize/lib/services/index.js +65 -58
- package/package.json +2 -2
- package/src/components/color_picker/_index.scss +0 -1
- package/src/components/markdown_editor/_markdown_format.scss +0 -4
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/accordion/accordion.js +1 -1
- package/test-env/components/basic_table/basic_table.js +2 -2
- package/test-env/components/basic_table/in_memory_table.js +3 -6
- package/test-env/components/basic_table/table.a11y.js +139 -0
- package/test-env/components/color_picker/color_picker.styles.js +26 -0
- package/test-env/components/color_picker/color_stops/color_stop_thumb.js +19 -6
- package/test-env/components/color_picker/color_stops/color_stop_thumb.styles.js +69 -0
- package/test-env/components/color_picker/color_stops/color_stops.js +25 -14
- package/test-env/components/color_picker/color_stops/color_stops.styles.js +73 -0
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +9 -0
- package/test-env/components/date_picker/super_date_picker/super_update_button.js +8 -0
- package/test-env/components/form/range/range_highlight.styles.js +1 -1
- package/test-env/components/form/range/range_levels.styles.js +1 -1
- package/test-env/components/form/range/range_track.js +6 -2
- package/test-env/components/image/image.a11y.js +61 -0
- package/test-env/components/image/image.js +9 -2
- package/test-env/components/image/image_fullscreen_wrapper.js +3 -1
- package/test-env/components/image/image_wrapper.js +3 -1
- package/test-env/components/key_pad_menu/key_pad_menu.a11y.js +163 -0
- package/test-env/components/markdown_editor/markdown_format.styles.js +1 -4
- package/test-env/components/popover/popover.js +2 -2
- package/test-env/components/table/table_footer_cell.js +1 -1
- package/test-env/components/table/table_header_cell.js +1 -1
- package/test-env/components/table/table_row_cell.js +2 -2
- package/test-env/components/text/text.styles.js +5 -2
- package/test-env/components/tool_tip/icon_tip.js +8 -0
- package/test-env/components/tool_tip/tool_tip.js +24 -1
- package/test-env/components/tour/tour.styles.js +1 -1
- package/test-env/services/color/manipulation.js +14 -2
- package/test-env/services/index.js +65 -58
- package/src/components/color_picker/color_stops/_color_stops.scss +0 -101
- package/src/components/color_picker/color_stops/_index.scss +0 -1
- package/src/themes/amsterdam/overrides/_color_stops.scss +0 -58
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _in_memory_table = require("./in_memory_table");
|
|
8
|
+
|
|
9
|
+
var _health = require("../health");
|
|
10
|
+
|
|
11
|
+
var _link = require("../link");
|
|
12
|
+
|
|
13
|
+
var _services = require("../../services");
|
|
14
|
+
|
|
15
|
+
var _data_store = require("../../../src-docs/src/views/tables/data_store");
|
|
16
|
+
|
|
17
|
+
var _react2 = require("@emotion/react");
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
21
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
22
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
23
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
24
|
+
* Side Public License, v 1.
|
|
25
|
+
*/
|
|
26
|
+
/// <reference types="../../../cypress/support"/>
|
|
27
|
+
var store = (0, _data_store.createDataStore)();
|
|
28
|
+
|
|
29
|
+
var InMemoryTable = function InMemoryTable() {
|
|
30
|
+
var columns = [{
|
|
31
|
+
field: 'firstName',
|
|
32
|
+
name: 'First Name',
|
|
33
|
+
sortable: true,
|
|
34
|
+
truncateText: true
|
|
35
|
+
}, {
|
|
36
|
+
field: 'lastName',
|
|
37
|
+
name: 'Last Name',
|
|
38
|
+
truncateText: true
|
|
39
|
+
}, {
|
|
40
|
+
field: 'github',
|
|
41
|
+
name: 'Github',
|
|
42
|
+
render: function render(username) {
|
|
43
|
+
return (0, _react2.jsx)(_link.EuiLink, {
|
|
44
|
+
href: "https://github.com/".concat(username),
|
|
45
|
+
target: "_blank"
|
|
46
|
+
}, username);
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
field: 'dateOfBirth',
|
|
50
|
+
name: 'Date of Birth',
|
|
51
|
+
dataType: 'date',
|
|
52
|
+
render: function render(date) {
|
|
53
|
+
return (0, _services.formatDate)(date, 'dobLong');
|
|
54
|
+
},
|
|
55
|
+
sortable: true
|
|
56
|
+
}, {
|
|
57
|
+
field: 'nationality',
|
|
58
|
+
name: 'Nationality',
|
|
59
|
+
render: function render(countryCode) {
|
|
60
|
+
var country = store.getCountry(countryCode);
|
|
61
|
+
return "".concat(country.flag, " ").concat(country.name);
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
field: 'online',
|
|
65
|
+
name: 'Online',
|
|
66
|
+
dataType: 'boolean',
|
|
67
|
+
render: function render(online) {
|
|
68
|
+
var color = online ? 'success' : 'danger';
|
|
69
|
+
var label = online ? 'Online' : 'Offline';
|
|
70
|
+
return (0, _react2.jsx)(_health.EuiHealth, {
|
|
71
|
+
color: color
|
|
72
|
+
}, label);
|
|
73
|
+
},
|
|
74
|
+
sortable: true
|
|
75
|
+
}];
|
|
76
|
+
var sorting = {
|
|
77
|
+
sort: {
|
|
78
|
+
field: 'dateOfBirth',
|
|
79
|
+
direction: 'desc'
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
return (0, _react2.jsx)(_in_memory_table.EuiInMemoryTable, {
|
|
83
|
+
"data-test-subj": "cy-in-memory-table",
|
|
84
|
+
tableCaption: "Demo of EuiInMemoryTable",
|
|
85
|
+
items: store.users,
|
|
86
|
+
columns: columns,
|
|
87
|
+
pagination: true,
|
|
88
|
+
sorting: sorting
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
beforeEach(function () {
|
|
93
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
94
|
+
|
|
95
|
+
cy.realMount((0, _react2.jsx)(InMemoryTable, null));
|
|
96
|
+
cy.get('div[data-test-subj="cy-in-memory-table"]').should('exist');
|
|
97
|
+
});
|
|
98
|
+
describe('EuiInMemoryTable', function () {
|
|
99
|
+
describe('Automated accessibility check', function () {
|
|
100
|
+
it('has zero violations on first render', function () {
|
|
101
|
+
cy.checkAxe();
|
|
102
|
+
});
|
|
103
|
+
it('has zero violations on pagination click', function () {
|
|
104
|
+
cy.get('a[data-test-subj="pagination-button-1"]').realClick();
|
|
105
|
+
cy.get('button[data-test-subj="pagination-button-1"]').should('be.disabled');
|
|
106
|
+
cy.checkAxe();
|
|
107
|
+
});
|
|
108
|
+
it('has zero violations after number of rows is increased', function () {
|
|
109
|
+
cy.get('button[data-test-subj="tablePaginationPopoverButton"]').realClick();
|
|
110
|
+
cy.get('div[data-popover-open="true"]').should('exist');
|
|
111
|
+
cy.get('button[data-test-subj="tablePagination-25-rows"]').realClick();
|
|
112
|
+
cy.get('table.euiTable').find('tr.euiTableRow').should('have.length', 20);
|
|
113
|
+
cy.checkAxe();
|
|
114
|
+
});
|
|
115
|
+
it('has zero violations after sorting on a column', function () {
|
|
116
|
+
cy.realPress('Tab');
|
|
117
|
+
cy.get('button[data-test-subj="tableHeaderSortButton"]').first().should('have.focus');
|
|
118
|
+
cy.realPress('Enter');
|
|
119
|
+
cy.get('tbody tr.euiTableRow span.euiTableCellContent__text').first().contains('Another very long first name which will wrap or be truncated');
|
|
120
|
+
});
|
|
121
|
+
it('has zero violations when number of rows is increased by keyboard', function () {
|
|
122
|
+
cy.repeatRealPress('Tab', 14);
|
|
123
|
+
cy.get('button[data-test-subj="tablePaginationPopoverButton"]').should('have.focus').realPress('Space');
|
|
124
|
+
cy.get('div[data-popover-open="true"]').should('exist');
|
|
125
|
+
cy.get('div[data-popover-open="true"]').should('have.focus');
|
|
126
|
+
cy.repeatRealPress('Tab'); // Switched to Tab from ArrowDown because of flaky test runs
|
|
127
|
+
|
|
128
|
+
cy.get('button[data-test-subj="tablePagination-25-rows"]').realPress('Space');
|
|
129
|
+
cy.get('table.euiTable').find('tr.euiTableRow').should('have.length', 20);
|
|
130
|
+
cy.checkAxe();
|
|
131
|
+
});
|
|
132
|
+
it('has zero violations when pagination is pressed', function () {
|
|
133
|
+
cy.repeatRealPress('Tab', 15);
|
|
134
|
+
cy.get('a[data-test-subj="pagination-button-1"]').should('have.focus').realPress('Enter');
|
|
135
|
+
cy.get('button[data-test-subj="pagination-button-1"]').should('be.disabled');
|
|
136
|
+
cy.checkAxe();
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiColorPickerVariables = void 0;
|
|
7
|
+
|
|
8
|
+
var _global_styling = require("../../global_styling");
|
|
9
|
+
|
|
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
|
+
var euiColorPickerVariables = function euiColorPickerVariables(euiThemeContext) {
|
|
18
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
19
|
+
return {
|
|
20
|
+
width: (0, _global_styling.mathWithUnits)([euiTheme.size.l, euiTheme.size.s], function (x, y) {
|
|
21
|
+
return x * 5 + y * 4;
|
|
22
|
+
})
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.euiColorPickerVariables = euiColorPickerVariables;
|
|
@@ -45,6 +45,8 @@ var _spacer = require("../../spacer");
|
|
|
45
45
|
|
|
46
46
|
var _range_thumb = require("../../form/range/range_thumb");
|
|
47
47
|
|
|
48
|
+
var _color_stop_thumb = require("./color_stop_thumb.styles");
|
|
49
|
+
|
|
48
50
|
var _react2 = require("@emotion/react");
|
|
49
51
|
|
|
50
52
|
var _excluded = ["className", "stop", "color", "onChange", "onFocus", "onRemove", "globalMin", "globalMax", "localMin", "localMax", "min", "max", "isRangeMin", "isRangeMax", "parentRef", "colorPickerMode", "colorPickerShowAlpha", "colorPickerSwatches", "disabled", "readOnly", "isPopoverOpen", "openPopover", "closePopover", "data-index", "aria-valuetext", "style", "valueInputProps"];
|
|
@@ -262,13 +264,20 @@ var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
|
|
|
262
264
|
}
|
|
263
265
|
};
|
|
264
266
|
|
|
265
|
-
var
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
268
|
+
var popoverStyles = (0, _color_stop_thumb.euiColorStopThumbPopoverStyles)(euiTheme);
|
|
269
|
+
var cssPopoverStyles = [popoverStyles.euiColorStopThumbPopover, (hasFocus || isPopoverOpen) && popoverStyles.hasFocus];
|
|
270
|
+
var thumbStyles = (0, _color_stop_thumb.euiColorStopThumbStyles)(euiTheme);
|
|
271
|
+
var cssThumbStyles = [thumbStyles.euiColorStopThumb, isPopoverOpen && thumbStyles.isPopoverOpen];
|
|
272
|
+
var colorStopStyles = (0, _color_stop_thumb.euiColorStopStyles)(euiTheme);
|
|
273
|
+
var cssColorStopStyles = colorStopStyles.euiColorStop;
|
|
274
|
+
var classes = (0, _classnames.default)('euiColorStopPopover', className);
|
|
275
|
+
return (0, _react2.jsx)(_popover.EuiPopover, (0, _extends2.default)({
|
|
276
|
+
css: cssPopoverStyles
|
|
277
|
+
}, rest, {
|
|
269
278
|
ref: popoverRef,
|
|
270
279
|
className: classes,
|
|
271
|
-
anchorClassName: "
|
|
280
|
+
anchorClassName: "euiColorStopThumbPopover__anchor",
|
|
272
281
|
panelPaddingSize: "s",
|
|
273
282
|
isOpen: isPopoverOpen,
|
|
274
283
|
closePopover: closePopover,
|
|
@@ -276,7 +285,9 @@ var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
|
|
|
276
285
|
focusTrapProps: {
|
|
277
286
|
clickOutsideDisables: false
|
|
278
287
|
},
|
|
279
|
-
|
|
288
|
+
panelProps: {
|
|
289
|
+
css: numberInputRef ? undefined : popoverStyles.isLoadingPanel
|
|
290
|
+
},
|
|
280
291
|
style: _objectSpread(_objectSpread({}, style), {}, {
|
|
281
292
|
left: "".concat(getPositionFromStopFn(stop), "%")
|
|
282
293
|
}),
|
|
@@ -308,6 +319,7 @@ var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
|
|
|
308
319
|
"aria-label": ariaLabel,
|
|
309
320
|
title: title,
|
|
310
321
|
className: "euiColorStopThumb",
|
|
322
|
+
css: cssThumbStyles,
|
|
311
323
|
tabIndex: -1,
|
|
312
324
|
style: {
|
|
313
325
|
background: background
|
|
@@ -317,6 +329,7 @@ var EuiColorStopThumb = function EuiColorStopThumb(_ref) {
|
|
|
317
329
|
})
|
|
318
330
|
}), (0, _react2.jsx)("div", {
|
|
319
331
|
className: "euiColorStop",
|
|
332
|
+
css: cssColorStopStyles,
|
|
320
333
|
"data-test-subj": "euiColorStopPopover"
|
|
321
334
|
}, (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("p", {
|
|
322
335
|
"aria-live": "polite"
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiColorStopThumbStyles = exports.euiColorStopThumbPopoverStyles = exports.euiColorStopStyles = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
|
+
|
|
10
|
+
var _global_styling = require("../../../global_styling");
|
|
11
|
+
|
|
12
|
+
var _range = require("../../form/range/range.styles");
|
|
13
|
+
|
|
14
|
+
var _color_picker = require("../color_picker.styles");
|
|
15
|
+
|
|
16
|
+
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)."; }
|
|
17
|
+
|
|
18
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
19
|
+
name: "zrzkfg-euiColorStopThumb",
|
|
20
|
+
styles: "&:not(:disabled){inset-block-start:0;margin-block-start:0;pointer-events:auto;cursor:grab;&:active{cursor:grabbing;}};label:euiColorStopThumb;"
|
|
21
|
+
} : {
|
|
22
|
+
name: "zrzkfg-euiColorStopThumb",
|
|
23
|
+
styles: "&:not(:disabled){inset-block-start:0;margin-block-start:0;pointer-events:auto;cursor:grab;&:active{cursor:grabbing;}};label:euiColorStopThumb;",
|
|
24
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var euiColorStopThumbStyles = function euiColorStopThumbStyles(euiThemeContext) {
|
|
28
|
+
return {
|
|
29
|
+
// Base
|
|
30
|
+
euiColorStopThumb: _ref2,
|
|
31
|
+
isPopoverOpen: /*#__PURE__*/(0, _react.css)((0, _range.euiRangeThumbFocus)(euiThemeContext), ";;label:isPopoverOpen;")
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.euiColorStopThumbStyles = euiColorStopThumbStyles;
|
|
36
|
+
|
|
37
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
38
|
+
name: "1wndm4s-isLoadingPanel",
|
|
39
|
+
styles: "visibility:hidden!important;label:isLoadingPanel;"
|
|
40
|
+
} : {
|
|
41
|
+
name: "1wndm4s-isLoadingPanel",
|
|
42
|
+
styles: "visibility:hidden!important;label:isLoadingPanel;",
|
|
43
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var euiColorStopThumbPopoverStyles = function euiColorStopThumbPopoverStyles(euiThemeContext) {
|
|
47
|
+
var range = (0, _range.euiRangeVariables)(euiThemeContext);
|
|
48
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
49
|
+
return {
|
|
50
|
+
// Base
|
|
51
|
+
euiColorStopThumbPopover: /*#__PURE__*/(0, _react.css)("position:absolute;inset-block-start:50%;inline-size:", range.thumbWidth, ";block-size:", range.thumbHeight, ";margin-block-start:", (0, _global_styling.mathWithUnits)(range.thumbHeight, function (x) {
|
|
52
|
+
return x * -0.5;
|
|
53
|
+
}), ";.euiColorStopThumbPopover__anchor{position:absolute;inline-size:100%;block-size:100%;&::before{content:'';display:block;position:absolute;inset-inline-start:0;inset-block-start:0;block-size:", range.thumbHeight, ";inline-size:", range.thumbWidth, ";border-radius:", range.thumbHeight, ";background:", euiTheme.colors.emptyShade, ";}};label:euiColorStopThumbPopover;"),
|
|
54
|
+
isLoadingPanel: _ref,
|
|
55
|
+
hasFocus: /*#__PURE__*/(0, _react.css)("z-index:", range.thumbZIndex, ";;label:hasFocus;")
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.euiColorStopThumbPopoverStyles = euiColorStopThumbPopoverStyles;
|
|
60
|
+
|
|
61
|
+
var euiColorStopStyles = function euiColorStopStyles(euiThemeContext) {
|
|
62
|
+
var colorPicker = (0, _color_picker.euiColorPickerVariables)(euiThemeContext);
|
|
63
|
+
return {
|
|
64
|
+
// Base
|
|
65
|
+
euiColorStop: /*#__PURE__*/(0, _react.css)("inline-size:", colorPicker.width, ";;label:euiColorStop;")
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
exports.euiColorStopStyles = euiColorStopStyles;
|
|
@@ -41,6 +41,8 @@ var _range_track = require("../../form/range/range_track");
|
|
|
41
41
|
|
|
42
42
|
var _range_wrapper = require("../../form/range/range_wrapper");
|
|
43
43
|
|
|
44
|
+
var _color_stops = require("./color_stops.styles");
|
|
45
|
+
|
|
44
46
|
var _react2 = require("@emotion/react");
|
|
45
47
|
|
|
46
48
|
var _excluded = ["addColor", "max", "min", "mode", "colorStops", "onChange", "disabled", "readOnly", "compressed", "fullWidth", "className", "label", "stopType", "stepNumber", "swatches", "showAlpha", "valueInputProps"];
|
|
@@ -189,11 +191,16 @@ var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
189
191
|
setFocusStopOnUpdate = _useState14[1];
|
|
190
192
|
|
|
191
193
|
var isNotInteractive = disabled || readOnly;
|
|
192
|
-
var
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
var isDragging = isHoverDisabled && !isNotInteractive;
|
|
195
|
+
var addContainerIsDisabled = isHoverDisabled || isNotInteractive;
|
|
196
|
+
var classes = (0, _classnames.default)('euiColorStops', className);
|
|
197
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
198
|
+
var styles = (0, _color_stops.euiColorStopsStyles)(euiTheme);
|
|
199
|
+
var cssPopoverStyles = [styles.euiColorStops, !disabled ? styles.isEnabled : styles.isDisabled, readOnly && styles.isReadOnly, isDragging && styles.isDragging];
|
|
200
|
+
var cssTrackStyles = [styles.euiColorStops__track];
|
|
201
|
+
var cssAddTargetStyles = [styles.euiColorStops__addTarget];
|
|
202
|
+
var addContainerStyles = (0, _color_stops.euiColorStopsAddContainerStyles)(euiTheme);
|
|
203
|
+
var cssAddContainerStyles = [addContainerStyles.euiColorStopsAddContainer, !addContainerIsDisabled ? addContainerStyles.isEnabled : addContainerStyles.isDisabled];
|
|
197
204
|
|
|
198
205
|
var getStopFromMouseLocationFn = function getStopFromMouseLocationFn(location) {
|
|
199
206
|
// Guard against `null` ref in usage
|
|
@@ -393,7 +400,7 @@ var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
393
400
|
disabled: disabled,
|
|
394
401
|
readOnly: readOnly,
|
|
395
402
|
"aria-valuetext": "Stop: ".concat(colorStop.stop, ", Color: ").concat(colorStop.color, " (").concat(index + 1, " of ").concat(colorStops.length, ")"),
|
|
396
|
-
isPopoverOpen: colorStop.id === openedStopId,
|
|
403
|
+
isPopoverOpen: !isDragging && colorStop.id === openedStopId,
|
|
397
404
|
openPopover: function openPopover() {
|
|
398
405
|
setOpenedStopId(colorStop.id);
|
|
399
406
|
},
|
|
@@ -403,7 +410,7 @@ var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
403
410
|
valueInputProps: valueInputProps
|
|
404
411
|
});
|
|
405
412
|
});
|
|
406
|
-
}, [colorStops, disabled, handleOnChange, max, min, mode, onRemove, openedStopId, rangeMax, rangeMin, readOnly, showAlpha, sortedStops, swatches, wrapperRef, valueInputProps]);
|
|
413
|
+
}, [colorStops, disabled, handleOnChange, isDragging, max, min, mode, onRemove, openedStopId, rangeMax, rangeMin, readOnly, showAlpha, sortedStops, swatches, wrapperRef, valueInputProps]);
|
|
407
414
|
var positions = wrapperRef ? sortedStops.map(function (_ref3) {
|
|
408
415
|
var stop = _ref3.stop;
|
|
409
416
|
return getPositionFromStopFn(stop);
|
|
@@ -411,10 +418,10 @@ var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
411
418
|
|
|
412
419
|
var gradientStop = function gradientStop(colorStop, index) {
|
|
413
420
|
var color = (0, _utils2.getChromaColor)(colorStop.color, showAlpha);
|
|
414
|
-
var rgba = color ? color.css() : '
|
|
421
|
+
var rgba = color ? color.css() : 'transparent';
|
|
415
422
|
|
|
416
423
|
if (index === 0) {
|
|
417
|
-
return "
|
|
424
|
+
return "transparent, transparent ".concat(positions[index], "%, ").concat(rgba, " ").concat(positions[index], "%");
|
|
418
425
|
}
|
|
419
426
|
|
|
420
427
|
return "".concat(rgba, " ").concat(positions[index], "%");
|
|
@@ -442,13 +449,15 @@ var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
442
449
|
percentageSteps = percentageSteps + percentage;
|
|
443
450
|
});
|
|
444
451
|
steppedGradient = steppedGradient.substring(0, steppedGradient.length - 2);
|
|
445
|
-
gradient = "linear-gradient(to right,
|
|
452
|
+
gradient = "linear-gradient(to right, transparent ".concat(trailingPercentage, "%, ").concat(steppedGradient, ")");
|
|
446
453
|
} else {
|
|
447
454
|
var linearGradient = sortedStops.map(stopType === 'gradient' ? gradientStop : fixedStop);
|
|
448
455
|
gradient = "linear-gradient(to right,".concat(linearGradient, ")");
|
|
449
456
|
}
|
|
450
457
|
|
|
451
|
-
return (0, _react2.jsx)(_range_wrapper.EuiRangeWrapper, (0, _extends2.default)({
|
|
458
|
+
return (0, _react2.jsx)(_range_wrapper.EuiRangeWrapper, (0, _extends2.default)({
|
|
459
|
+
css: cssPopoverStyles
|
|
460
|
+
}, rest, {
|
|
452
461
|
"data-test-subj": (0, _classnames.default)('euiColorStops', rest['data-test-subj']),
|
|
453
462
|
ref: setWrapperRef,
|
|
454
463
|
className: classes,
|
|
@@ -471,6 +480,8 @@ var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
471
480
|
token: "euiColorStops.screenReaderAnnouncement",
|
|
472
481
|
default: "{label}: {readOnly} {disabled} Color stop picker. Each stop consists of a number and corresponding color value. Use the Down and Up arrow keys to select individual stops. Press the Enter key to create a new stop."
|
|
473
482
|
}))), (0, _react2.jsx)(_range_track.EuiRangeTrack, {
|
|
483
|
+
className: "euiColorStops__track",
|
|
484
|
+
css: cssTrackStyles,
|
|
474
485
|
min: min || rangeMin,
|
|
475
486
|
max: max || rangeMax,
|
|
476
487
|
compressed: compressed,
|
|
@@ -487,13 +498,13 @@ var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
487
498
|
trackWidth: trackWidth
|
|
488
499
|
}), (0, _react2.jsx)("div", {
|
|
489
500
|
"data-test-subj": "euiColorStopsAdd",
|
|
490
|
-
className:
|
|
491
|
-
|
|
492
|
-
}),
|
|
501
|
+
className: "euiColorStops__addContainer",
|
|
502
|
+
css: cssAddContainerStyles,
|
|
493
503
|
onClick: handleAddClick,
|
|
494
504
|
onMouseMove: handleAddHover
|
|
495
505
|
}, (0, _react2.jsx)("div", {
|
|
496
506
|
className: "euiColorStops__addTarget",
|
|
507
|
+
css: cssAddTargetStyles,
|
|
497
508
|
style: {
|
|
498
509
|
left: "".concat(addTargetPosition, "%")
|
|
499
510
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiColorStopsStyles = exports.euiColorStopsAddContainerStyles = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
|
+
|
|
10
|
+
var _services = require("../../../services");
|
|
11
|
+
|
|
12
|
+
var _global_styling = require("../../../global_styling");
|
|
13
|
+
|
|
14
|
+
var _form = require("../../form/form.styles");
|
|
15
|
+
|
|
16
|
+
var _range = require("../../form/range/range.styles");
|
|
17
|
+
|
|
18
|
+
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)."; }
|
|
19
|
+
|
|
20
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
21
|
+
name: "uu65b3-isDragging",
|
|
22
|
+
styles: "cursor:grabbing;label:isDragging;"
|
|
23
|
+
} : {
|
|
24
|
+
name: "uu65b3-isDragging",
|
|
25
|
+
styles: "cursor:grabbing;label:isDragging;",
|
|
26
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var euiColorStopsStyles = function euiColorStopsStyles(euiThemeContext) {
|
|
30
|
+
var range = (0, _range.euiRangeVariables)(euiThemeContext);
|
|
31
|
+
var euiTheme = euiThemeContext.euiTheme,
|
|
32
|
+
colorMode = euiThemeContext.colorMode;
|
|
33
|
+
var isDarkMode = colorMode === 'DARK';
|
|
34
|
+
var stripeColor = isDarkMode ? (0, _services.brighten)(range.trackColor, 0.5) : (0, _services.darken)(range.trackColor, 0.5);
|
|
35
|
+
var stripesBackground = "repeating-linear-gradient(\n -45deg,\n ".concat(range.trackColor, ",\n ").concat(range.trackColor, " 25%,\n ").concat(stripeColor, " 25%,\n ").concat(stripeColor, " 50%,\n ").concat(range.trackColor, " 50%\n )");
|
|
36
|
+
return {
|
|
37
|
+
// Base
|
|
38
|
+
euiColorStops: /*#__PURE__*/(0, _react.css)(";label:euiColorStops;"),
|
|
39
|
+
isEnabled: /*#__PURE__*/(0, _react.css)("&:focus{outline:none;}&:focus-visible{.euiColorStops__track::after{box-shadow:0 0 0 1px rgba(", (0, _services.hexToRgb)(euiTheme.colors.emptyShade).join(', '), ", 0.8),0 0 0 3px ", range.focusColor, ";}};label:isEnabled;"),
|
|
40
|
+
isDisabled: /*#__PURE__*/(0, _react.css)(";label:isDisabled;"),
|
|
41
|
+
isHoverDisabled: /*#__PURE__*/(0, _react.css)(";label:isHoverDisabled;"),
|
|
42
|
+
isReadOnly: /*#__PURE__*/(0, _react.css)(";label:isReadOnly;"),
|
|
43
|
+
isDragging: _ref2,
|
|
44
|
+
euiColorStops__track: /*#__PURE__*/(0, _react.css)("&::after{background:", stripesBackground, ";background-size:", euiTheme.size.xs, " ", euiTheme.size.xs, ";};label:euiColorStops__track;"),
|
|
45
|
+
euiColorStops__addTarget: /*#__PURE__*/(0, _react.css)((0, _form.euiCustomControl)(euiThemeContext, {
|
|
46
|
+
type: 'round'
|
|
47
|
+
}), ";", (0, _range.euiRangeThumbStyle)(euiThemeContext), ";position:absolute;inset-block-start:0;block-size:", range.thumbHeight, ";inline-size:", range.thumbHeight, ";background-color:", euiTheme.colors.lightestShade, ";pointer-events:none;opacity:0;border:", euiTheme.border.width.thin, " solid ", euiTheme.colors.darkShade, ";box-shadow:none;z-index:", range.thumbZIndex, ";", _global_styling.euiCanAnimate, "{transition:opacity ", euiTheme.animation.fast, " ease-in;};label:euiColorStops__addTarget;")
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.euiColorStopsStyles = euiColorStopsStyles;
|
|
52
|
+
|
|
53
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
54
|
+
name: "1173em8-isEnabled",
|
|
55
|
+
styles: "&:hover{cursor:pointer;.euiColorStops__addTarget{opacity:0.7;}};label:isEnabled;"
|
|
56
|
+
} : {
|
|
57
|
+
name: "1173em8-isEnabled",
|
|
58
|
+
styles: "&:hover{cursor:pointer;.euiColorStops__addTarget{opacity:0.7;}};label:isEnabled;",
|
|
59
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var euiColorStopsAddContainerStyles = function euiColorStopsAddContainerStyles(euiThemeContext) {
|
|
63
|
+
var range = (0, _range.euiRangeVariables)(euiThemeContext);
|
|
64
|
+
return {
|
|
65
|
+
euiColorStopsAddContainer: /*#__PURE__*/(0, _react.css)("display:block;position:absolute;inset-inline-start:0;inset-inline-end:0;inset-block-start:50%;block-size:", range.thumbHeight, ";margin-block-start:", (0, _global_styling.mathWithUnits)(range.thumbHeight, function (x) {
|
|
66
|
+
return x * -0.5;
|
|
67
|
+
}), ";z-index:", range.thumbZIndex, ";;label:euiColorStopsAddContainer;"),
|
|
68
|
+
isEnabled: _ref,
|
|
69
|
+
isDisabled: /*#__PURE__*/(0, _react.css)(";label:isDisabled;")
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
exports.euiColorStopsAddContainerStyles = euiColorStopsAddContainerStyles;
|
|
@@ -29,7 +29,7 @@ exports.euiRangeHighlightStyles = euiRangeHighlightStyles;
|
|
|
29
29
|
var euiRangeHighlightProgressStyles = function euiRangeHighlightProgressStyles(euiThemeContext) {
|
|
30
30
|
var range = (0, _range.euiRangeVariables)(euiThemeContext);
|
|
31
31
|
return {
|
|
32
|
-
euiRangeHighlight__progress: /*#__PURE__*/(0, _react.css)("block-size:", range.highlightHeight, ";border-radius:", range.trackBorderRadius, ";background-color:", range.highlightColor, "
|
|
32
|
+
euiRangeHighlight__progress: /*#__PURE__*/(0, _react.css)("block-size:", range.highlightHeight, ";border-radius:", range.trackBorderRadius, ";background-color:", range.highlightColor, ";.euiRangeSlider:focus-visible~.euiRangeHighlight &,.euiRangeThumb:focus-visible~.euiRangeHighlight &,.euiRangeDraggable:focus~.euiRangeHighlight &{background-color:", range.focusColor, ";};label:euiRangeHighlight__progress;")
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
|
|
@@ -29,7 +29,7 @@ var euiRangeLevelsStyles = function euiRangeLevelsStyles(euiThemeContext) {
|
|
|
29
29
|
var stripesBackground = "repeating-linear-gradient(\n -45deg,\n ".concat((0, _services.transparentize)(stripeColor, 0.5), ",\n ").concat((0, _services.transparentize)(stripeColor, 0.5), " 25%,\n ").concat((0, _services.transparentize)(stripeColor, 0.7), " 25%,\n ").concat((0, _services.transparentize)(stripeColor, 0.7), " 50%,\n ").concat((0, _services.transparentize)(stripeColor, 0.5), " 50%\n )");
|
|
30
30
|
return {
|
|
31
31
|
euiRangeLevels: /*#__PURE__*/(0, _react.css)("display:flex;justify-content:stretch;position:absolute;inset-inline:0;inset-block-start:", range.trackTopPositionWithoutTicks, ";z-index:", range.levelsZIndex, ";;label:euiRangeLevels;"),
|
|
32
|
-
hasRange: /*#__PURE__*/(0, _react.css)("&::after{content:'';position:absolute;block-size:", range.trackHeight, ";inline-size:100%;background-image:", stripesBackground, ";background-size:", euiTheme.size.
|
|
32
|
+
hasRange: /*#__PURE__*/(0, _react.css)("&::after{content:'';position:absolute;block-size:", range.trackHeight, ";inline-size:100%;background-image:", stripesBackground, ";background-size:", euiTheme.size.xs, " ", euiTheme.size.xs, ";border-radius:", range.trackBorderRadius, ";};label:hasRange;"),
|
|
33
33
|
hasTicks: /*#__PURE__*/(0, _react.css)("inset-block-start:", range.trackTopPositionWithTicks, ";;label:hasTicks;")
|
|
34
34
|
};
|
|
35
35
|
};
|
|
@@ -17,6 +17,8 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
|
|
20
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
+
|
|
20
22
|
var _range = _interopRequireDefault(require("lodash/range"));
|
|
21
23
|
|
|
22
24
|
var _services = require("../../../services");
|
|
@@ -29,7 +31,7 @@ var _range_track = require("./range_track.styles");
|
|
|
29
31
|
|
|
30
32
|
var _react2 = require("@emotion/react");
|
|
31
33
|
|
|
32
|
-
var _excluded = ["children", "disabled", "max", "min", "step", "showTicks", "tickInterval", "ticks", "levels", "onChange", "value", "compressed", "showRange"];
|
|
34
|
+
var _excluded = ["children", "disabled", "max", "min", "step", "showTicks", "tickInterval", "ticks", "levels", "onChange", "value", "compressed", "showRange", "className"];
|
|
33
35
|
|
|
34
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
37
|
|
|
@@ -49,6 +51,7 @@ var EuiRangeTrack = function EuiRangeTrack(_ref) {
|
|
|
49
51
|
value = _ref.value,
|
|
50
52
|
compressed = _ref.compressed,
|
|
51
53
|
showRange = _ref.showRange,
|
|
54
|
+
className = _ref.className,
|
|
52
55
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
53
56
|
(0, _react.useEffect)(function () {
|
|
54
57
|
validateValueIsInStep(max, {
|
|
@@ -107,8 +110,9 @@ var EuiRangeTrack = function EuiRangeTrack(_ref) {
|
|
|
107
110
|
trackWidth = _useState2[0],
|
|
108
111
|
setTrackWidth = _useState2[1];
|
|
109
112
|
|
|
113
|
+
var classes = (0, _classnames.default)('euiRangeTrack', className);
|
|
110
114
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
111
|
-
className:
|
|
115
|
+
className: classes,
|
|
112
116
|
css: cssStyles
|
|
113
117
|
}, rest, {
|
|
114
118
|
ref: function ref(node) {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _image = require("./image");
|
|
8
|
+
|
|
9
|
+
var _react2 = require("@emotion/react");
|
|
10
|
+
|
|
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
|
+
/// <reference types="../../../cypress/support"/>
|
|
19
|
+
var Image = function Image() {
|
|
20
|
+
return (0, _react2.jsx)(_image.EuiImage, {
|
|
21
|
+
size: "m",
|
|
22
|
+
hasShadow: true,
|
|
23
|
+
allowFullScreen: true,
|
|
24
|
+
caption: "Albert Einstein, theoretical physicist",
|
|
25
|
+
alt: "" // Because this image is sufficiently described by its caption, there is no need to repeat it via alt text
|
|
26
|
+
,
|
|
27
|
+
src: "https://upload.wikimedia.org/wikipedia/commons/d/d3/Albert_Einstein_Head.jpg"
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
beforeEach(function () {
|
|
32
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
33
|
+
|
|
34
|
+
cy.realMount((0, _react2.jsx)(Image, null));
|
|
35
|
+
cy.get('figure[aria-label="Albert Einstein, theoretical physicist"]').should('exist');
|
|
36
|
+
});
|
|
37
|
+
describe('EuiImage', function () {
|
|
38
|
+
describe('Automated accessibility check', function () {
|
|
39
|
+
it('has zero violations on first render', function () {
|
|
40
|
+
cy.checkAxe();
|
|
41
|
+
});
|
|
42
|
+
it('has zero violations on fullscreen render', function () {
|
|
43
|
+
cy.get('button[data-test-subj="activateFullScreenButton"]').realClick();
|
|
44
|
+
cy.get('button[data-test-subj="deactivateFullScreenButton"]').should('exist');
|
|
45
|
+
cy.checkAxe();
|
|
46
|
+
cy.get('div[data-test-subj="fullScreenOverlayMask"]').realClick();
|
|
47
|
+
cy.checkAxe();
|
|
48
|
+
});
|
|
49
|
+
it('has zero violations on keyboard interaction', function () {
|
|
50
|
+
cy.realPress('Tab');
|
|
51
|
+
cy.get('button[data-test-subj="activateFullScreenButton"]').should('have.focus');
|
|
52
|
+
cy.realPress('Enter');
|
|
53
|
+
cy.get('button[data-test-subj="deactivateFullScreenButton"]').should('exist');
|
|
54
|
+
cy.get('button[data-test-subj="deactivateFullScreenButton"]').should('have.focus');
|
|
55
|
+
cy.checkAxe();
|
|
56
|
+
cy.realPress('Escape');
|
|
57
|
+
cy.get('button[data-test-subj="activateFullScreenButton"]').should('have.focus');
|
|
58
|
+
cy.checkAxe();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -33,7 +33,7 @@ var _image_types = require("./image_types");
|
|
|
33
33
|
|
|
34
34
|
var _react2 = require("@emotion/react");
|
|
35
35
|
|
|
36
|
-
var _excluded = ["className", "alt", "url", "src", "size", "hasShadow", "style", "wrapperProps", "fullScreenIconColor", "allowFullScreen", "caption", "float", "margin"];
|
|
36
|
+
var _excluded = ["className", "alt", "url", "src", "size", "hasShadow", "style", "wrapperProps", "fullScreenIconColor", "allowFullScreen", "caption", "float", "margin", "onFullScreen"];
|
|
37
37
|
|
|
38
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
39
|
|
|
@@ -58,6 +58,7 @@ var EuiImage = function EuiImage(_ref) {
|
|
|
58
58
|
caption = _ref.caption,
|
|
59
59
|
float = _ref.float,
|
|
60
60
|
margin = _ref.margin,
|
|
61
|
+
onFullScreen = _ref.onFullScreen,
|
|
61
62
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
62
63
|
|
|
63
64
|
var _useState = (0, _react.useState)(false),
|
|
@@ -89,7 +90,8 @@ var EuiImage = function EuiImage(_ref) {
|
|
|
89
90
|
alt: alt,
|
|
90
91
|
caption: caption,
|
|
91
92
|
float: float,
|
|
92
|
-
margin: margin
|
|
93
|
+
margin: margin,
|
|
94
|
+
onFullScreen: onFullScreen
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
var commonImgProps = _objectSpread({
|
|
@@ -50,7 +50,8 @@ var EuiImageFullScreenWrapper = function EuiImageFullScreenWrapper(_ref) {
|
|
|
50
50
|
setIsFullScreen = _ref.setIsFullScreen,
|
|
51
51
|
wrapperProps = _ref.wrapperProps,
|
|
52
52
|
isFullWidth = _ref.isFullWidth,
|
|
53
|
-
fullScreenIconColor = _ref.fullScreenIconColor
|
|
53
|
+
fullScreenIconColor = _ref.fullScreenIconColor,
|
|
54
|
+
onFullScreen = _ref.onFullScreen;
|
|
54
55
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
55
56
|
var styles = (0, _image_fullscreen_wrapper.euiImageFullscreenWrapperStyles)(euiTheme);
|
|
56
57
|
var cssStyles = [styles.euiImageFullscreenWrapper];
|
|
@@ -66,6 +67,7 @@ var EuiImageFullScreenWrapper = function EuiImageFullScreenWrapper(_ref) {
|
|
|
66
67
|
|
|
67
68
|
var closeFullScreen = function closeFullScreen() {
|
|
68
69
|
setIsFullScreen(false);
|
|
70
|
+
onFullScreen === null || onFullScreen === void 0 ? void 0 : onFullScreen(false);
|
|
69
71
|
};
|
|
70
72
|
|
|
71
73
|
var _useInnerText = (0, _inner_text.useInnerText)(),
|