@elastic/eui 91.3.1 → 92.0.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.map +1 -1
- package/dist/eui_theme_dark.css +0 -513
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -513
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/basic_table/basic_table.js +5 -5
- package/es/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
- package/es/components/filter_group/filter_button.js +20 -13
- package/es/components/filter_group/filter_button.styles.js +11 -20
- package/es/components/flyout/flyout.js +4 -4
- package/es/components/flyout/flyout_resizable.js +127 -0
- package/es/components/flyout/flyout_resizable.styles.js +27 -0
- package/es/components/flyout/index.js +2 -1
- package/es/components/form/range/dual_range.js +15 -66
- package/es/components/form/range/range.js +6 -5
- package/es/components/form/range/range_slider.js +28 -22
- package/es/components/form/text_area/text_area.js +39 -3
- package/es/components/index.js +0 -2
- package/es/components/markdown_editor/markdown_editor.js +12 -13
- package/es/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +5 -0
- package/es/components/tree_view/tree_view.js +23 -25
- package/es/utils/prop_types/is.js +2 -2
- package/eui.d.ts +825 -1141
- package/i18ntokens.json +68 -338
- package/lib/components/basic_table/basic_table.js +5 -5
- package/lib/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
- package/lib/components/filter_group/filter_button.js +20 -13
- package/lib/components/filter_group/filter_button.styles.js +11 -20
- package/lib/components/flyout/flyout.js +4 -4
- package/lib/components/flyout/flyout_resizable.js +136 -0
- package/lib/components/flyout/flyout_resizable.styles.js +32 -0
- package/lib/components/flyout/index.js +8 -1
- package/lib/components/form/range/dual_range.js +15 -66
- package/lib/components/form/range/range.js +6 -5
- package/lib/components/form/range/range_slider.js +27 -21
- package/lib/components/form/text_area/text_area.js +42 -3
- package/lib/components/index.js +0 -22
- package/lib/components/markdown_editor/markdown_editor.js +12 -13
- package/lib/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
- package/lib/components/pagination/pagination_button.js +79 -2
- package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/lib/components/tree_view/tree_view.js +23 -25
- package/lib/utils/prop_types/is.js +2 -2
- package/optimize/es/components/basic_table/basic_table.js +5 -5
- package/optimize/es/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
- package/optimize/es/components/filter_group/filter_button.js +20 -13
- package/optimize/es/components/filter_group/filter_button.styles.js +11 -20
- package/optimize/es/components/flyout/flyout.js +4 -4
- package/optimize/es/components/flyout/flyout_resizable.js +121 -0
- package/optimize/es/components/flyout/flyout_resizable.styles.js +27 -0
- package/optimize/es/components/flyout/index.js +2 -1
- package/optimize/es/components/form/range/dual_range.js +15 -66
- package/optimize/es/components/form/range/range.js +6 -5
- package/optimize/es/components/form/range/range_slider.js +26 -21
- package/optimize/es/components/form/text_area/text_area.js +29 -3
- package/optimize/es/components/index.js +0 -2
- package/optimize/es/components/markdown_editor/markdown_editor.js +12 -13
- package/optimize/es/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
- package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/optimize/es/components/tree_view/tree_view.js +23 -25
- package/optimize/es/utils/prop_types/is.js +2 -2
- package/optimize/lib/components/basic_table/basic_table.js +5 -5
- package/optimize/lib/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
- package/optimize/lib/components/filter_group/filter_button.js +20 -13
- package/optimize/lib/components/filter_group/filter_button.styles.js +11 -20
- package/optimize/lib/components/flyout/flyout.js +4 -4
- package/optimize/lib/components/flyout/flyout_resizable.js +131 -0
- package/optimize/lib/components/flyout/flyout_resizable.styles.js +32 -0
- package/optimize/lib/components/flyout/index.js +8 -1
- package/optimize/lib/components/form/range/dual_range.js +15 -66
- package/optimize/lib/components/form/range/range.js +6 -5
- package/optimize/lib/components/form/range/range_slider.js +26 -21
- package/optimize/lib/components/form/text_area/text_area.js +32 -3
- package/optimize/lib/components/index.js +0 -22
- package/optimize/lib/components/markdown_editor/markdown_editor.js +12 -13
- package/optimize/lib/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
- package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/optimize/lib/components/tree_view/tree_view.js +23 -25
- package/optimize/lib/utils/prop_types/is.js +2 -2
- package/package.json +2 -2
- package/src/components/index.scss +0 -2
- package/test-env/components/basic_table/basic_table.js +5 -5
- package/test-env/components/drag_and_drop/drag_and_drop.a11y.js +1 -1
- package/test-env/components/filter_group/filter_button.js +20 -13
- package/test-env/components/filter_group/filter_button.styles.js +11 -20
- package/test-env/components/flyout/flyout_resizable.js +131 -0
- package/test-env/components/flyout/flyout_resizable.styles.js +32 -0
- package/test-env/components/flyout/index.js +8 -1
- package/test-env/components/form/range/dual_range.js +15 -66
- package/test-env/components/form/range/range.js +6 -5
- package/test-env/components/form/range/range_slider.js +27 -21
- package/test-env/components/form/text_area/text_area.js +42 -3
- package/test-env/components/index.js +0 -22
- package/test-env/components/markdown_editor/markdown_editor.js +12 -13
- package/test-env/components/page_template/bottom_bar/page_bottom_bar.js +1 -1
- package/test-env/components/pagination/pagination_button.js +79 -2
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/test-env/components/tree_view/tree_view.js +23 -25
- package/test-env/utils/prop_types/is.js +2 -2
- package/es/components/control_bar/control_bar.a11y.js +0 -133
- package/es/components/control_bar/control_bar.js +0 -609
- package/es/components/control_bar/index.js +0 -9
- package/es/components/notification/index.js +0 -9
- package/es/components/notification/notification_event.a11y.js +0 -104
- package/es/components/notification/notification_event.js +0 -288
- package/es/components/notification/notification_event_messages.js +0 -79
- package/es/components/notification/notification_event_meta.js +0 -148
- package/es/components/notification/notification_event_read_button.js +0 -86
- package/es/components/notification/notification_event_read_icon.js +0 -77
- package/lib/components/control_bar/control_bar.a11y.js +0 -134
- package/lib/components/control_bar/control_bar.js +0 -441
- package/lib/components/control_bar/index.js +0 -12
- package/lib/components/notification/index.js +0 -12
- package/lib/components/notification/notification_event.a11y.js +0 -105
- package/lib/components/notification/notification_event.js +0 -297
- package/lib/components/notification/notification_event_messages.js +0 -88
- package/lib/components/notification/notification_event_meta.js +0 -157
- package/lib/components/notification/notification_event_read_button.js +0 -93
- package/lib/components/notification/notification_event_read_icon.js +0 -64
- package/optimize/es/components/control_bar/control_bar.a11y.js +0 -128
- package/optimize/es/components/control_bar/control_bar.js +0 -308
- package/optimize/es/components/control_bar/index.js +0 -9
- package/optimize/es/components/notification/index.js +0 -9
- package/optimize/es/components/notification/notification_event.a11y.js +0 -99
- package/optimize/es/components/notification/notification_event.js +0 -114
- package/optimize/es/components/notification/notification_event_messages.js +0 -63
- package/optimize/es/components/notification/notification_event_meta.js +0 -106
- package/optimize/es/components/notification/notification_event_read_button.js +0 -44
- package/optimize/es/components/notification/notification_event_read_icon.js +0 -44
- package/optimize/lib/components/control_bar/control_bar.a11y.js +0 -134
- package/optimize/lib/components/control_bar/control_bar.js +0 -301
- package/optimize/lib/components/control_bar/index.js +0 -12
- package/optimize/lib/components/notification/index.js +0 -12
- package/optimize/lib/components/notification/notification_event.a11y.js +0 -105
- package/optimize/lib/components/notification/notification_event.js +0 -123
- package/optimize/lib/components/notification/notification_event_messages.js +0 -74
- package/optimize/lib/components/notification/notification_event_meta.js +0 -117
- package/optimize/lib/components/notification/notification_event_read_button.js +0 -51
- package/optimize/lib/components/notification/notification_event_read_icon.js +0 -51
- package/src/components/control_bar/_control_bar.scss +0 -232
- package/src/components/control_bar/_index.scss +0 -2
- package/src/components/control_bar/_variables.scss +0 -12
- package/src/components/notification/_index.scss +0 -5
- package/src/components/notification/_notification_event.scss +0 -40
- package/src/components/notification/_notification_event_messages.scss +0 -17
- package/src/components/notification/_notification_event_meta.scss +0 -44
- package/src/components/notification/_notification_event_read_button.scss +0 -5
- package/src/components/notification/_notification_event_read_icon.scss +0 -12
- package/test-env/components/control_bar/control_bar.a11y.js +0 -134
- package/test-env/components/control_bar/control_bar.js +0 -436
- package/test-env/components/control_bar/index.js +0 -12
- package/test-env/components/notification/index.js +0 -12
- package/test-env/components/notification/notification_event.a11y.js +0 -105
- package/test-env/components/notification/notification_event.js +0 -296
- package/test-env/components/notification/notification_event_messages.js +0 -85
- package/test-env/components/notification/notification_event_meta.js +0 -154
- package/test-env/components/notification/notification_event_read_button.js +0 -92
- package/test-env/components/notification/notification_event_read_icon.js +0 -63
|
@@ -433,7 +433,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
433
433
|
var sortDirection = _this2.resolveColumnSortDirection(column);
|
|
434
434
|
items.push({
|
|
435
435
|
name: column.name,
|
|
436
|
-
key: "_data_s_".concat(column.field, "_").concat(index),
|
|
436
|
+
key: "_data_s_".concat(String(column.field), "_").concat(index),
|
|
437
437
|
onSort: _this2.resolveColumnOnSort(column),
|
|
438
438
|
isSorted: !!sortDirection,
|
|
439
439
|
isSortAscending: sortDirection ? SortDirection.isAsc(sortDirection) : undefined
|
|
@@ -586,11 +586,11 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
headers.push(___EmotionJSX(EuiTableHeaderCell, _extends({
|
|
589
|
-
key: "_data_h_".concat(field, "_").concat(index),
|
|
589
|
+
key: "_data_h_".concat(String(field), "_").concat(index),
|
|
590
590
|
align: columnAlign,
|
|
591
591
|
width: width,
|
|
592
592
|
mobileOptions: mobileOptions,
|
|
593
|
-
"data-test-subj": "tableHeaderCell_".concat(field, "_").concat(index),
|
|
593
|
+
"data-test-subj": "tableHeaderCell_".concat(String(field), "_").concat(index),
|
|
594
594
|
description: description
|
|
595
595
|
}, sorting), name));
|
|
596
596
|
});
|
|
@@ -627,7 +627,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
627
627
|
|
|
628
628
|
if (footer) {
|
|
629
629
|
footers.push(___EmotionJSX(EuiTableFooterCell, {
|
|
630
|
-
key: "footer_".concat(field, "_").concat(footers.length - 1),
|
|
630
|
+
key: "footer_".concat(String(field), "_").concat(footers.length - 1),
|
|
631
631
|
align: align
|
|
632
632
|
}, footer));
|
|
633
633
|
hasDefinedFooter = true;
|
|
@@ -867,7 +867,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
867
867
|
var field = column.field,
|
|
868
868
|
render = column.render,
|
|
869
869
|
dataType = column.dataType;
|
|
870
|
-
var key = "_data_column_".concat(field, "_").concat(itemId, "_").concat(columnIndex);
|
|
870
|
+
var key = "_data_column_".concat(String(field), "_").concat(itemId, "_").concat(columnIndex);
|
|
871
871
|
var contentRenderer = render || this.getRendererForDataType(dataType);
|
|
872
872
|
var value = get(item, field);
|
|
873
873
|
var content = contentRenderer(value, item);
|
|
@@ -76,7 +76,7 @@ var DragAndDrop = function DragAndDrop() {
|
|
|
76
76
|
beforeEach(function () {
|
|
77
77
|
cy.realMount(___EmotionJSX(DragAndDrop, null));
|
|
78
78
|
});
|
|
79
|
-
describe('
|
|
79
|
+
describe('EuiDragDrop', function () {
|
|
80
80
|
describe('Automated accessibility check', function () {
|
|
81
81
|
it('has zero violations on render', function () {
|
|
82
82
|
cy.checkAxe();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
2
|
var _excluded = ["children", "className", "iconType", "iconSide", "color", "badgeColor", "hasActiveFilters", "numFilters", "numActiveFilters", "isDisabled", "isSelected", "type", "grow", "withNext", "textProps", "contentProps"];
|
|
3
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
7
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
9
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
11
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -69,6 +69,10 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
69
69
|
'euiFilterButton-hasActiveFilters': hasActiveFilters,
|
|
70
70
|
'euiFilterButton-hasNotification': numFiltersDefined
|
|
71
71
|
}, className);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Badge
|
|
75
|
+
*/
|
|
72
76
|
var showBadge = numFiltersDefined || numActiveFiltersDefined;
|
|
73
77
|
var badgeCount = numActiveFilters || numFilters;
|
|
74
78
|
var activeBadgeLabel = useEuiI18n('euiFilterButton.filterBadgeActiveAriaLabel', '{count} active filters', {
|
|
@@ -77,9 +81,6 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
77
81
|
var availableBadgeLabel = useEuiI18n('euiFilterButton.filterBadgeAvailableAriaLabel', '{count} available filters', {
|
|
78
82
|
count: badgeCount
|
|
79
83
|
});
|
|
80
|
-
var buttonTextClassNames = classNames('euiFilterButton__text', {
|
|
81
|
-
'euiFilterButton__text-hasNotification': showBadge
|
|
82
|
-
}, textProps && textProps.className);
|
|
83
84
|
var badgeContent = showBadge && ___EmotionJSX(EuiNotificationBadge, {
|
|
84
85
|
className: "euiFilterButton__notification",
|
|
85
86
|
css: [notificationStyles.euiFilterButton__notification, isDisabled && notificationStyles.disabled, ";label:badgeContent;"],
|
|
@@ -87,18 +88,27 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
87
88
|
color: isDisabled || !hasActiveFilters ? 'subdued' : badgeColor,
|
|
88
89
|
role: "marquee" // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role
|
|
89
90
|
}, badgeCount);
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Text
|
|
94
|
+
*/
|
|
95
|
+
var buttonTextClassNames = classNames('euiFilterButton__text', {
|
|
96
|
+
'euiFilterButton__text-hasNotification': showBadge
|
|
97
|
+
}, textProps && textProps.className);
|
|
98
|
+
var textCssStyles = [textStyles.euiFilterButton__text, showBadge && textStyles.hasNotification, textProps && textProps.css];
|
|
90
99
|
var _useInnerText = useInnerText(),
|
|
91
100
|
_useInnerText2 = _slicedToArray(_useInnerText, 2),
|
|
92
101
|
ref = _useInnerText2[0],
|
|
93
102
|
innerText = _useInnerText2[1];
|
|
94
103
|
var dataText = children && typeof children === 'string' ? children : innerText;
|
|
95
|
-
var
|
|
104
|
+
var textContent = ___EmotionJSX("span", _extends({
|
|
96
105
|
ref: ref,
|
|
97
|
-
className: "euiFilterButton__textShift",
|
|
98
|
-
css: textStyles.euiFilterButton__textShift,
|
|
99
106
|
"data-text": dataText,
|
|
100
107
|
title: dataText
|
|
101
|
-
},
|
|
108
|
+
}, textProps, {
|
|
109
|
+
className: buttonTextClassNames,
|
|
110
|
+
css: textCssStyles
|
|
111
|
+
}), children);
|
|
102
112
|
return ___EmotionJSX(EuiButtonEmpty, _extends({
|
|
103
113
|
className: classes,
|
|
104
114
|
css: cssStyles,
|
|
@@ -107,14 +117,11 @@ export var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
107
117
|
iconSide: iconSide,
|
|
108
118
|
iconType: iconType,
|
|
109
119
|
type: type,
|
|
110
|
-
textProps:
|
|
111
|
-
className: buttonTextClassNames,
|
|
112
|
-
css: [textStyles.euiFilterButton__text, showBadge && textStyles.hasNotification, textProps && textProps.css]
|
|
113
|
-
}),
|
|
120
|
+
textProps: false,
|
|
114
121
|
contentProps: _objectSpread(_objectSpread({}, contentProps), {}, {
|
|
115
122
|
css: [contentStyles.euiFilterButton__content, iconType && contentStyles.hasIcon, contentProps === null || contentProps === void 0 ? void 0 : contentProps.css]
|
|
116
123
|
})
|
|
117
|
-
}, rest),
|
|
124
|
+
}, rest), textContent, badgeContent);
|
|
118
125
|
};
|
|
119
126
|
EuiFilterButton.propTypes = {
|
|
120
127
|
/**
|
|
@@ -10,8 +10,8 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { logicalCSS, mathWithUnits, euiTextShift, euiTextTruncate } from '../../global_styling';
|
|
12
12
|
import { euiFormVariables } from '../form/form.styles';
|
|
13
|
-
export var euiFilterButtonDisplay = function euiFilterButtonDisplay(
|
|
14
|
-
var euiTheme =
|
|
13
|
+
export var euiFilterButtonDisplay = function euiFilterButtonDisplay(_ref4) {
|
|
14
|
+
var euiTheme = _ref4.euiTheme;
|
|
15
15
|
return {
|
|
16
16
|
flex: '1 1 auto',
|
|
17
17
|
minInlineSize: mathWithUnits(euiTheme.size.base, function (x) {
|
|
@@ -19,7 +19,7 @@ export var euiFilterButtonDisplay = function euiFilterButtonDisplay(_ref5) {
|
|
|
19
19
|
})
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
23
23
|
name: "jkp921-noGrow",
|
|
24
24
|
styles: "flex-grow:0;label:noGrow;"
|
|
25
25
|
} : {
|
|
@@ -38,9 +38,9 @@ export var euiFilterButtonStyles = function euiFilterButtonStyles(euiThemeContex
|
|
|
38
38
|
// Bottom borders are needed for responsive flex-wrap behavior
|
|
39
39
|
var bottomBoxShadow = "0 ".concat(euiTheme.border.width.thin, " 0 0 ").concat(borderColor);
|
|
40
40
|
return {
|
|
41
|
-
euiFilterButton: /*#__PURE__*/css(euiFilterButtonDisplay(euiThemeContext), " ", logicalCSS('height', controlHeight), " border-radius:0;box-shadow:", leftBoxShadow, ",", bottomBoxShadow, ";&:hover:not(:disabled),&:focus:not(:disabled){text-decoration:none;.
|
|
41
|
+
euiFilterButton: /*#__PURE__*/css(euiFilterButtonDisplay(euiThemeContext), " ", logicalCSS('height', controlHeight), " border-radius:0;box-shadow:", leftBoxShadow, ",", bottomBoxShadow, ";&:hover:not(:disabled),&:focus:not(:disabled){text-decoration:none;.euiFilterButton__text{text-decoration:underline;}}&:focus-visible{outline-offset:-", euiTheme.focus.width, ";};label:euiFilterButton;"),
|
|
42
42
|
withNext: /*#__PURE__*/css("&+.euiFilterButton{", logicalCSS('margin-left', "-".concat(euiTheme.size.xs)), "box-shadow:", bottomBoxShadow, ";};label:withNext;"),
|
|
43
|
-
noGrow:
|
|
43
|
+
noGrow: _ref3,
|
|
44
44
|
hasNotification: /*#__PURE__*/css(logicalCSS('min-width', mathWithUnits(euiTheme.size.base, function (x) {
|
|
45
45
|
return x * 6;
|
|
46
46
|
})), ";;label:hasNotification;"),
|
|
@@ -63,27 +63,18 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
63
63
|
styles: "cursor:inherit;label:euiFilterButton__notification;",
|
|
64
64
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
65
65
|
};
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
styles: "justify-content:space-between;label:hasIcon;"
|
|
69
|
-
} : {
|
|
70
|
-
name: "f0jxzj-hasIcon",
|
|
71
|
-
styles: "justify-content:space-between;label:hasIcon;",
|
|
72
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
73
|
-
};
|
|
74
|
-
export var euiFilterButtonChildStyles = function euiFilterButtonChildStyles(_ref6) {
|
|
75
|
-
var euiTheme = _ref6.euiTheme;
|
|
66
|
+
export var euiFilterButtonChildStyles = function euiFilterButtonChildStyles(_ref5) {
|
|
67
|
+
var euiTheme = _ref5.euiTheme;
|
|
76
68
|
return {
|
|
77
69
|
content: {
|
|
78
70
|
euiFilterButton__content: /*#__PURE__*/css(";label:euiFilterButton__content;"),
|
|
79
|
-
hasIcon:
|
|
71
|
+
hasIcon: /*#__PURE__*/css("&>.euiIcon:last-child{", logicalCSS('margin-left', 'auto'), ";};label:hasIcon;")
|
|
80
72
|
},
|
|
81
73
|
text: {
|
|
82
|
-
euiFilterButton__text: /*#__PURE__*/css("
|
|
83
|
-
hasNotification: /*#__PURE__*/css(
|
|
84
|
-
euiFilterButton__textShift: /*#__PURE__*/css(euiTextShift('bold', 'data-text', euiTheme), " ", euiTextTruncate(), " ", logicalCSS('min-width', mathWithUnits(euiTheme.size.base, function (x) {
|
|
74
|
+
euiFilterButton__text: /*#__PURE__*/css(euiTextShift('bold', 'data-text', euiTheme), " ", euiTextTruncate(), ";;label:euiFilterButton__text;"),
|
|
75
|
+
hasNotification: /*#__PURE__*/css(logicalCSS('min-width', mathWithUnits(euiTheme.size.base, function (x) {
|
|
85
76
|
return x * 3;
|
|
86
|
-
})), ";;label:
|
|
77
|
+
})), ";;label:hasNotification;")
|
|
87
78
|
},
|
|
88
79
|
notification: {
|
|
89
80
|
euiFilterButton__notification: _ref2,
|
|
@@ -110,18 +110,18 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
110
110
|
*/
|
|
111
111
|
if (isPushed) {
|
|
112
112
|
if (side === 'right') {
|
|
113
|
-
document.body.style.
|
|
113
|
+
document.body.style.paddingInlineEnd = "".concat(dimensions.width, "px");
|
|
114
114
|
} else if (side === 'left') {
|
|
115
|
-
document.body.style.
|
|
115
|
+
document.body.style.paddingInlineStart = "".concat(dimensions.width, "px");
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
return function () {
|
|
119
119
|
document.body.classList.remove('euiBody--hasFlyout');
|
|
120
120
|
if (isPushed) {
|
|
121
121
|
if (side === 'right') {
|
|
122
|
-
document.body.style.
|
|
122
|
+
document.body.style.paddingInlineEnd = '';
|
|
123
123
|
} else if (side === 'left') {
|
|
124
|
-
document.body.style.
|
|
124
|
+
document.body.style.paddingInlineStart = '';
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
var _excluded = ["size", "maxWidth", "minWidth", "side", "children"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
+
/*
|
|
12
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
13
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
14
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
15
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
16
|
+
* Side Public License, v 1.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import React, { forwardRef, useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
20
|
+
import { keys, useCombinedRefs, useEuiTheme } from '../../services';
|
|
21
|
+
import { EuiResizableButton } from '../resizable_container';
|
|
22
|
+
import { EuiFlyout } from './flyout';
|
|
23
|
+
import { euiFlyoutResizableButtonStyles } from './flyout_resizable.styles';
|
|
24
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
25
|
+
export var EuiFlyoutResizable = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
26
|
+
var size = _ref.size,
|
|
27
|
+
maxWidth = _ref.maxWidth,
|
|
28
|
+
_ref$minWidth = _ref.minWidth,
|
|
29
|
+
minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
|
|
30
|
+
_ref$side = _ref.side,
|
|
31
|
+
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
32
|
+
children = _ref.children,
|
|
33
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
|
+
var euiTheme = useEuiTheme();
|
|
35
|
+
var styles = euiFlyoutResizableButtonStyles(euiTheme);
|
|
36
|
+
var cssStyles = [styles.euiFlyoutResizableButton, styles[side]];
|
|
37
|
+
var getFlyoutMinMaxWidth = useCallback(function (width) {
|
|
38
|
+
return Math.min(Math.max(width, minWidth), maxWidth || Infinity, window.innerWidth - 20 // Leave some offset
|
|
39
|
+
);
|
|
40
|
+
}, [minWidth, maxWidth]);
|
|
41
|
+
var _useState = useState(0),
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
flyoutWidth = _useState2[0],
|
|
44
|
+
setFlyoutWidth = _useState2[1];
|
|
45
|
+
|
|
46
|
+
// Must use state for the flyout ref in order for the useEffect to be correctly called after render
|
|
47
|
+
var _useState3 = useState(null),
|
|
48
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
49
|
+
flyoutRef = _useState4[0],
|
|
50
|
+
setFlyoutRef = _useState4[1];
|
|
51
|
+
var setRefs = useCombinedRefs([setFlyoutRef, ref]);
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
setFlyoutWidth(flyoutRef ? getFlyoutMinMaxWidth(flyoutRef.offsetWidth) : 0);
|
|
54
|
+
}, [flyoutRef, getFlyoutMinMaxWidth, size]);
|
|
55
|
+
|
|
56
|
+
// Initial numbers to calculate from, on resize drag start
|
|
57
|
+
var initialWidth = useRef(0);
|
|
58
|
+
var initialMouseX = useRef(0);
|
|
59
|
+
|
|
60
|
+
// Account for flyout side and logical property direction
|
|
61
|
+
var direction = useMemo(function () {
|
|
62
|
+
var modifier = side === 'right' ? -1 : 1;
|
|
63
|
+
if (flyoutRef) {
|
|
64
|
+
var languageDirection = window.getComputedStyle(flyoutRef).direction;
|
|
65
|
+
if (languageDirection === 'rtl') modifier *= -1;
|
|
66
|
+
}
|
|
67
|
+
return modifier;
|
|
68
|
+
}, [side, flyoutRef]);
|
|
69
|
+
var onMouseMove = useCallback(function (e) {
|
|
70
|
+
var mouseOffset = getMouseOrTouchX(e) - initialMouseX.current;
|
|
71
|
+
var changedFlyoutWidth = initialWidth.current + mouseOffset * direction;
|
|
72
|
+
setFlyoutWidth(getFlyoutMinMaxWidth(changedFlyoutWidth));
|
|
73
|
+
}, [getFlyoutMinMaxWidth, direction]);
|
|
74
|
+
var onMouseUp = useCallback(function () {
|
|
75
|
+
initialMouseX.current = 0;
|
|
76
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
77
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
78
|
+
window.removeEventListener('touchmove', onMouseMove);
|
|
79
|
+
window.removeEventListener('touchend', onMouseUp);
|
|
80
|
+
}, [onMouseMove]);
|
|
81
|
+
var onMouseDown = useCallback(function (e) {
|
|
82
|
+
var _flyoutRef$offsetWidt;
|
|
83
|
+
initialMouseX.current = getMouseOrTouchX(e);
|
|
84
|
+
initialWidth.current = (_flyoutRef$offsetWidt = flyoutRef === null || flyoutRef === void 0 ? void 0 : flyoutRef.offsetWidth) !== null && _flyoutRef$offsetWidt !== void 0 ? _flyoutRef$offsetWidt : 0;
|
|
85
|
+
|
|
86
|
+
// Window event listeners instead of React events are used
|
|
87
|
+
// in case the user's mouse leaves the component
|
|
88
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
89
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
90
|
+
window.addEventListener('touchmove', onMouseMove);
|
|
91
|
+
window.addEventListener('touchend', onMouseUp);
|
|
92
|
+
}, [flyoutRef, onMouseMove, onMouseUp]);
|
|
93
|
+
var onKeyDown = useCallback(function (e) {
|
|
94
|
+
var KEYBOARD_OFFSET = 10;
|
|
95
|
+
switch (e.key) {
|
|
96
|
+
case keys.ARROW_RIGHT:
|
|
97
|
+
e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
|
|
98
|
+
setFlyoutWidth(function (flyoutWidth) {
|
|
99
|
+
return getFlyoutMinMaxWidth(flyoutWidth + KEYBOARD_OFFSET * direction);
|
|
100
|
+
});
|
|
101
|
+
break;
|
|
102
|
+
case keys.ARROW_LEFT:
|
|
103
|
+
e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
|
|
104
|
+
setFlyoutWidth(function (flyoutWidth) {
|
|
105
|
+
return getFlyoutMinMaxWidth(flyoutWidth - KEYBOARD_OFFSET * direction);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}, [getFlyoutMinMaxWidth, direction]);
|
|
109
|
+
return ___EmotionJSX(EuiFlyout, _extends({}, rest, {
|
|
110
|
+
size: flyoutWidth || size,
|
|
111
|
+
maxWidth: maxWidth,
|
|
112
|
+
side: side,
|
|
113
|
+
ref: setRefs
|
|
114
|
+
}), ___EmotionJSX(EuiResizableButton, {
|
|
115
|
+
isHorizontal: true,
|
|
116
|
+
css: cssStyles,
|
|
117
|
+
onMouseDown: onMouseDown,
|
|
118
|
+
onTouchStart: onMouseDown,
|
|
119
|
+
onKeyDown: onKeyDown
|
|
120
|
+
}), children);
|
|
121
|
+
});
|
|
122
|
+
EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
|
|
123
|
+
var getMouseOrTouchX = function getMouseOrTouchX(e) {
|
|
124
|
+
// Some Typescript fooling is needed here
|
|
125
|
+
var x = e.targetTouches ? e.targetTouches[0].pageX : e.pageX;
|
|
126
|
+
return x;
|
|
127
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
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 { logicalCSS } from '../../global_styling';
|
|
12
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
13
|
+
name: "6syi0e-euiFlyoutResizableButton",
|
|
14
|
+
styles: "position:absolute;&::before,&::after{background-color:transparent;};label:euiFlyoutResizableButton;"
|
|
15
|
+
} : {
|
|
16
|
+
name: "6syi0e-euiFlyoutResizableButton",
|
|
17
|
+
styles: "position:absolute;&::before,&::after{background-color:transparent;};label:euiFlyoutResizableButton;",
|
|
18
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
19
|
+
};
|
|
20
|
+
export var euiFlyoutResizableButtonStyles = function euiFlyoutResizableButtonStyles(_ref2) {
|
|
21
|
+
var euiTheme = _ref2.euiTheme;
|
|
22
|
+
return {
|
|
23
|
+
euiFlyoutResizableButton: _ref,
|
|
24
|
+
left: /*#__PURE__*/css(logicalCSS('right', "-".concat(euiTheme.border.width.thin)), ";;label:left;"),
|
|
25
|
+
right: /*#__PURE__*/css(logicalCSS('left', "-".concat(euiTheme.border.width.thin)), ";;label:right;")
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -10,4 +10,5 @@ export { EuiFlyout } from './flyout';
|
|
|
10
10
|
export { EuiFlyoutBody } from './flyout_body';
|
|
11
11
|
export { EuiFlyoutFooter } from './flyout_footer';
|
|
12
12
|
export { EuiFlyoutHeader } from './flyout_header';
|
|
13
|
-
export { euiFlyoutSlideInRight, euiFlyoutSlideInLeft } from './flyout.styles';
|
|
13
|
+
export { euiFlyoutSlideInRight, euiFlyoutSlideInLeft } from './flyout.styles';
|
|
14
|
+
export { EuiFlyoutResizable } from './flyout_resizable';
|
|
@@ -61,38 +61,10 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
61
61
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
62
62
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
63
63
|
id: _this.props.id || htmlIdGenerator()(),
|
|
64
|
-
rangeSliderRefAvailable: false,
|
|
65
64
|
isPopoverOpen: false,
|
|
66
|
-
rangeWidth: 0
|
|
67
|
-
isVisible: true // used to trigger a rerender if initial element width is 0
|
|
65
|
+
rangeWidth: 0
|
|
68
66
|
});
|
|
69
67
|
_defineProperty(_assertThisInitialized(_this), "preventPopoverClose", false);
|
|
70
|
-
_defineProperty(_assertThisInitialized(_this), "rangeSliderRef", null);
|
|
71
|
-
_defineProperty(_assertThisInitialized(_this), "handleRangeSliderRefUpdate", function (ref) {
|
|
72
|
-
_this.rangeSliderRef = ref;
|
|
73
|
-
if (ref) {
|
|
74
|
-
if (_this.isInPopover) {
|
|
75
|
-
// Wait a tick for popover rendering to settle
|
|
76
|
-
requestAnimationFrame(function () {
|
|
77
|
-
_this.setState({
|
|
78
|
-
rangeSliderRefAvailable: true,
|
|
79
|
-
rangeWidth: ref.clientWidth
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
} else {
|
|
83
|
-
// If not in a popover, no need to wait
|
|
84
|
-
_this.setState({
|
|
85
|
-
rangeSliderRefAvailable: true,
|
|
86
|
-
rangeWidth: ref.clientWidth
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
_this.setState({
|
|
91
|
-
rangeSliderRefAvailable: false,
|
|
92
|
-
rangeWidth: 0
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
68
|
_defineProperty(_assertThisInitialized(_this), "leftPosition", 0);
|
|
97
69
|
_defineProperty(_assertThisInitialized(_this), "dragAcc", 0);
|
|
98
70
|
_defineProperty(_assertThisInitialized(_this), "_determineInvalidThumbMovement", function (newVal, lower, upper, e) {
|
|
@@ -283,14 +255,11 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
283
255
|
isPopoverOpen: false
|
|
284
256
|
});
|
|
285
257
|
});
|
|
286
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
287
|
-
var
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
(_this$props$inputPopo = _this.props.inputPopoverProps) === null || _this$props$inputPopo === void 0 ? void 0 : (_this$props$inputPopo2 = _this$props$inputPopo.onPanelResize) === null || _this$props$inputPopo2 === void 0 ? void 0 : _this$props$inputPopo2.call(_this$props$inputPopo, width);
|
|
258
|
+
_defineProperty(_assertThisInitialized(_this), "setRangeWidth", function (_ref) {
|
|
259
|
+
var width = _ref.width;
|
|
260
|
+
_this.setState({
|
|
261
|
+
rangeWidth: width
|
|
262
|
+
});
|
|
294
263
|
});
|
|
295
264
|
_defineProperty(_assertThisInitialized(_this), "getNearestStep", function (value) {
|
|
296
265
|
var min = _this.props.min;
|
|
@@ -313,7 +282,7 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
313
282
|
var delta = _this.leftPosition - x;
|
|
314
283
|
_this.leftPosition = x;
|
|
315
284
|
_this.dragAcc = _this.dragAcc + delta;
|
|
316
|
-
var percentageOfArea = _this.dragAcc / _this.
|
|
285
|
+
var percentageOfArea = _this.dragAcc / _this.state.rangeWidth;
|
|
317
286
|
var percentageOfRange = percentageOfArea * (max - min);
|
|
318
287
|
var newLower = _this.getNearestStep(lowerValue - percentageOfRange);
|
|
319
288
|
var newUpper = _this.getNearestStep(upperValue - percentageOfRange);
|
|
@@ -357,32 +326,12 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
357
326
|
get: function get() {
|
|
358
327
|
return this.lowerValueIsValid && this.upperValueIsValid;
|
|
359
328
|
}
|
|
360
|
-
}, {
|
|
361
|
-
key: "componentDidMount",
|
|
362
|
-
value: function componentDidMount() {
|
|
363
|
-
var _this$rangeSliderRef;
|
|
364
|
-
if (((_this$rangeSliderRef = this.rangeSliderRef) === null || _this$rangeSliderRef === void 0 ? void 0 : _this$rangeSliderRef.clientWidth) === 0) {
|
|
365
|
-
this.setState({
|
|
366
|
-
isVisible: false
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}, {
|
|
371
|
-
key: "componentDidUpdate",
|
|
372
|
-
value: function componentDidUpdate() {
|
|
373
|
-
var _this$rangeSliderRef2;
|
|
374
|
-
if ((_this$rangeSliderRef2 = this.rangeSliderRef) !== null && _this$rangeSliderRef2 !== void 0 && _this$rangeSliderRef2.clientWidth && !this.state.isVisible) {
|
|
375
|
-
this.setState({
|
|
376
|
-
isVisible: true
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
329
|
}, {
|
|
381
330
|
key: "render",
|
|
382
331
|
value: function render() {
|
|
383
332
|
var _this2 = this;
|
|
384
|
-
var
|
|
385
|
-
defaultFullWidth =
|
|
333
|
+
var _ref2 = this.context,
|
|
334
|
+
defaultFullWidth = _ref2.defaultFullWidth;
|
|
386
335
|
var _this$props = this.props,
|
|
387
336
|
className = _this$props.className,
|
|
388
337
|
customCss = _this$props.css,
|
|
@@ -538,10 +487,10 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
538
487
|
var classes = classNames('euiDualRange', className);
|
|
539
488
|
var dualRangeStyles = euiDualRangeStyles();
|
|
540
489
|
var cssStyles = [dualRangeStyles.euiDualRange, customCss];
|
|
541
|
-
var leftThumbPosition = this.state.
|
|
490
|
+
var leftThumbPosition = this.state.rangeWidth ? this.calculateThumbPositionStyle(Number(this.lowerValue) || min, this.state.rangeWidth) : {
|
|
542
491
|
left: '0'
|
|
543
492
|
};
|
|
544
|
-
var rightThumbPosition = this.state.
|
|
493
|
+
var rightThumbPosition = this.state.rangeWidth ? this.calculateThumbPositionStyle(Number(this.upperValue) || max, this.state.rangeWidth) : {
|
|
545
494
|
left: '0'
|
|
546
495
|
};
|
|
547
496
|
var leftThumbColor = levels && getLevelColor(levels, Number(this.lowerValue));
|
|
@@ -585,7 +534,6 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
585
534
|
}, ___EmotionJSX(EuiRangeSlider, _extends({
|
|
586
535
|
className: "euiDualRange__slider",
|
|
587
536
|
css: dualRangeStyles.euiDualRange__slider,
|
|
588
|
-
ref: this.handleRangeSliderRefUpdate,
|
|
589
537
|
id: id,
|
|
590
538
|
name: name,
|
|
591
539
|
min: min,
|
|
@@ -599,7 +547,9 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
599
547
|
showRange: showRange,
|
|
600
548
|
onFocus: _onFocus,
|
|
601
549
|
onBlur: _onBlur
|
|
602
|
-
}, rest
|
|
550
|
+
}, rest, {
|
|
551
|
+
onResize: this.setRangeWidth
|
|
552
|
+
})), isDraggable && this.isValid && ___EmotionJSX(EuiRangeDraggable, {
|
|
603
553
|
min: min,
|
|
604
554
|
max: max,
|
|
605
555
|
value: [this.lowerValue, this.upperValue],
|
|
@@ -639,7 +589,7 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
639
589
|
style: logicalStyles(rightThumbStyles),
|
|
640
590
|
"aria-describedby": showInputOnly ? undefined : this.props['aria-describedby'],
|
|
641
591
|
"aria-label": showInputOnly ? undefined : this.props['aria-label']
|
|
642
|
-
})
|
|
592
|
+
}), showRange && this.isValid && ___EmotionJSX(EuiRangeHighlight, {
|
|
643
593
|
showTicks: showTicks,
|
|
644
594
|
min: Number(min),
|
|
645
595
|
max: Number(max),
|
|
@@ -671,7 +621,6 @@ export var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
671
621
|
isOpen: this.state.isPopoverOpen,
|
|
672
622
|
closePopover: this.closePopover,
|
|
673
623
|
disableFocusTrap: true,
|
|
674
|
-
onPanelResize: this.onResize,
|
|
675
624
|
popoverScreenReaderText: dualSliderScreenReaderInstructions
|
|
676
625
|
}), theRange) : undefined;
|
|
677
626
|
return thePopover || theRange;
|
|
@@ -64,9 +64,10 @@ export var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
64
64
|
_this.props.onChange(e, isValid);
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
67
|
+
_defineProperty(_assertThisInitialized(_this), "setTrackWidth", function (_ref) {
|
|
68
|
+
var width = _ref.width;
|
|
68
69
|
_this.setState({
|
|
69
|
-
trackWidth:
|
|
70
|
+
trackWidth: width
|
|
70
71
|
});
|
|
71
72
|
});
|
|
72
73
|
_defineProperty(_assertThisInitialized(_this), "onInputFocus", function (e) {
|
|
@@ -110,8 +111,8 @@ export var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
110
111
|
key: "render",
|
|
111
112
|
value: function render() {
|
|
112
113
|
var _this2 = this;
|
|
113
|
-
var
|
|
114
|
-
defaultFullWidth =
|
|
114
|
+
var _ref2 = this.context,
|
|
115
|
+
defaultFullWidth = _ref2.defaultFullWidth;
|
|
115
116
|
var _this$props = this.props,
|
|
116
117
|
className = _this$props.className,
|
|
117
118
|
compressed = _this$props.compressed,
|
|
@@ -217,7 +218,7 @@ export var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
217
218
|
"aria-hidden": !!showInput,
|
|
218
219
|
thumbColor: thumbColor
|
|
219
220
|
}, rest, {
|
|
220
|
-
|
|
221
|
+
onResize: this.setTrackWidth
|
|
221
222
|
})), showRange && this.isValid && ___EmotionJSX(EuiRangeHighlight, {
|
|
222
223
|
showTicks: showTicks,
|
|
223
224
|
min: Number(min),
|