@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
|
@@ -24,12 +24,12 @@ var _excluded = ["children", "className", "iconType", "iconSide", "color", "badg
|
|
|
24
24
|
* Side Public License, v 1.
|
|
25
25
|
*/
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
|
-
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); }
|
|
28
27
|
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; }
|
|
29
28
|
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; }
|
|
30
29
|
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; }
|
|
31
30
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
32
31
|
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); }
|
|
32
|
+
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); }
|
|
33
33
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
34
34
|
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."); }
|
|
35
35
|
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); }
|
|
@@ -75,6 +75,10 @@ var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
75
75
|
'euiFilterButton-hasActiveFilters': hasActiveFilters,
|
|
76
76
|
'euiFilterButton-hasNotification': numFiltersDefined
|
|
77
77
|
}, className);
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Badge
|
|
81
|
+
*/
|
|
78
82
|
var showBadge = numFiltersDefined || numActiveFiltersDefined;
|
|
79
83
|
var badgeCount = numActiveFilters || numFilters;
|
|
80
84
|
var activeBadgeLabel = (0, _i18n.useEuiI18n)('euiFilterButton.filterBadgeActiveAriaLabel', '{count} active filters', {
|
|
@@ -83,9 +87,6 @@ var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
83
87
|
var availableBadgeLabel = (0, _i18n.useEuiI18n)('euiFilterButton.filterBadgeAvailableAriaLabel', '{count} available filters', {
|
|
84
88
|
count: badgeCount
|
|
85
89
|
});
|
|
86
|
-
var buttonTextClassNames = (0, _classnames.default)('euiFilterButton__text', {
|
|
87
|
-
'euiFilterButton__text-hasNotification': showBadge
|
|
88
|
-
}, textProps && textProps.className);
|
|
89
90
|
var badgeContent = showBadge && (0, _react2.jsx)(_badge.EuiNotificationBadge, {
|
|
90
91
|
className: "euiFilterButton__notification",
|
|
91
92
|
css: [notificationStyles.euiFilterButton__notification, isDisabled && notificationStyles.disabled, ";label:badgeContent;"],
|
|
@@ -93,18 +94,27 @@ var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
93
94
|
color: isDisabled || !hasActiveFilters ? 'subdued' : badgeColor,
|
|
94
95
|
role: "marquee" // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/marquee_role
|
|
95
96
|
}, badgeCount);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Text
|
|
100
|
+
*/
|
|
101
|
+
var buttonTextClassNames = (0, _classnames.default)('euiFilterButton__text', {
|
|
102
|
+
'euiFilterButton__text-hasNotification': showBadge
|
|
103
|
+
}, textProps && textProps.className);
|
|
104
|
+
var textCssStyles = [textStyles.euiFilterButton__text, showBadge && textStyles.hasNotification, textProps && textProps.css];
|
|
96
105
|
var _useInnerText = (0, _inner_text.useInnerText)(),
|
|
97
106
|
_useInnerText2 = _slicedToArray(_useInnerText, 2),
|
|
98
107
|
ref = _useInnerText2[0],
|
|
99
108
|
innerText = _useInnerText2[1];
|
|
100
109
|
var dataText = children && typeof children === 'string' ? children : innerText;
|
|
101
|
-
var
|
|
110
|
+
var textContent = (0, _react2.jsx)("span", _extends({
|
|
102
111
|
ref: ref,
|
|
103
|
-
className: "euiFilterButton__textShift",
|
|
104
|
-
css: textStyles.euiFilterButton__textShift,
|
|
105
112
|
"data-text": dataText,
|
|
106
113
|
title: dataText
|
|
107
|
-
},
|
|
114
|
+
}, textProps, {
|
|
115
|
+
className: buttonTextClassNames,
|
|
116
|
+
css: textCssStyles
|
|
117
|
+
}), children);
|
|
108
118
|
return (0, _react2.jsx)(_button_empty.EuiButtonEmpty, _extends({
|
|
109
119
|
className: classes,
|
|
110
120
|
css: cssStyles,
|
|
@@ -113,14 +123,11 @@ var EuiFilterButton = function EuiFilterButton(_ref) {
|
|
|
113
123
|
iconSide: iconSide,
|
|
114
124
|
iconType: iconType,
|
|
115
125
|
type: type,
|
|
116
|
-
textProps:
|
|
117
|
-
className: buttonTextClassNames,
|
|
118
|
-
css: [textStyles.euiFilterButton__text, showBadge && textStyles.hasNotification, textProps && textProps.css]
|
|
119
|
-
}),
|
|
126
|
+
textProps: false,
|
|
120
127
|
contentProps: _objectSpread(_objectSpread({}, contentProps), {}, {
|
|
121
128
|
css: [contentStyles.euiFilterButton__content, iconType && contentStyles.hasIcon, contentProps === null || contentProps === void 0 ? void 0 : contentProps.css]
|
|
122
129
|
})
|
|
123
|
-
}, rest),
|
|
130
|
+
}, rest), textContent, badgeContent);
|
|
124
131
|
};
|
|
125
132
|
exports.EuiFilterButton = EuiFilterButton;
|
|
126
133
|
EuiFilterButton.propTypes = {
|
|
@@ -14,8 +14,8 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
14
14
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
15
|
* Side Public License, v 1.
|
|
16
16
|
*/
|
|
17
|
-
var euiFilterButtonDisplay = function euiFilterButtonDisplay(
|
|
18
|
-
var euiTheme =
|
|
17
|
+
var euiFilterButtonDisplay = function euiFilterButtonDisplay(_ref4) {
|
|
18
|
+
var euiTheme = _ref4.euiTheme;
|
|
19
19
|
return {
|
|
20
20
|
flex: '1 1 auto',
|
|
21
21
|
minInlineSize: (0, _global_styling.mathWithUnits)(euiTheme.size.base, function (x) {
|
|
@@ -24,7 +24,7 @@ var euiFilterButtonDisplay = function euiFilterButtonDisplay(_ref5) {
|
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
exports.euiFilterButtonDisplay = euiFilterButtonDisplay;
|
|
27
|
-
var
|
|
27
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
28
28
|
name: "jkp921-noGrow",
|
|
29
29
|
styles: "flex-grow:0;label:noGrow;"
|
|
30
30
|
} : {
|
|
@@ -43,9 +43,9 @@ var euiFilterButtonStyles = function euiFilterButtonStyles(euiThemeContext) {
|
|
|
43
43
|
// Bottom borders are needed for responsive flex-wrap behavior
|
|
44
44
|
var bottomBoxShadow = "0 ".concat(euiTheme.border.width.thin, " 0 0 ").concat(borderColor);
|
|
45
45
|
return {
|
|
46
|
-
euiFilterButton: /*#__PURE__*/(0, _react.css)(euiFilterButtonDisplay(euiThemeContext), " ", (0, _global_styling.logicalCSS)('height', controlHeight), " border-radius:0;box-shadow:", leftBoxShadow, ",", bottomBoxShadow, ";&:hover:not(:disabled),&:focus:not(:disabled){text-decoration:none;.
|
|
46
|
+
euiFilterButton: /*#__PURE__*/(0, _react.css)(euiFilterButtonDisplay(euiThemeContext), " ", (0, _global_styling.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;"),
|
|
47
47
|
withNext: /*#__PURE__*/(0, _react.css)("&+.euiFilterButton{", (0, _global_styling.logicalCSS)('margin-left', "-".concat(euiTheme.size.xs)), "box-shadow:", bottomBoxShadow, ";};label:withNext;"),
|
|
48
|
-
noGrow:
|
|
48
|
+
noGrow: _ref3,
|
|
49
49
|
hasNotification: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('min-width', (0, _global_styling.mathWithUnits)(euiTheme.size.base, function (x) {
|
|
50
50
|
return x * 6;
|
|
51
51
|
})), ";;label:hasNotification;"),
|
|
@@ -69,27 +69,18 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
69
69
|
styles: "cursor:inherit;label:euiFilterButton__notification;",
|
|
70
70
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
71
71
|
};
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
styles: "justify-content:space-between;label:hasIcon;"
|
|
75
|
-
} : {
|
|
76
|
-
name: "f0jxzj-hasIcon",
|
|
77
|
-
styles: "justify-content:space-between;label:hasIcon;",
|
|
78
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
79
|
-
};
|
|
80
|
-
var euiFilterButtonChildStyles = function euiFilterButtonChildStyles(_ref6) {
|
|
81
|
-
var euiTheme = _ref6.euiTheme;
|
|
72
|
+
var euiFilterButtonChildStyles = function euiFilterButtonChildStyles(_ref5) {
|
|
73
|
+
var euiTheme = _ref5.euiTheme;
|
|
82
74
|
return {
|
|
83
75
|
content: {
|
|
84
76
|
euiFilterButton__content: /*#__PURE__*/(0, _react.css)(";label:euiFilterButton__content;"),
|
|
85
|
-
hasIcon:
|
|
77
|
+
hasIcon: /*#__PURE__*/(0, _react.css)("&>.euiIcon:last-child{", (0, _global_styling.logicalCSS)('margin-left', 'auto'), ";};label:hasIcon;")
|
|
86
78
|
},
|
|
87
79
|
text: {
|
|
88
|
-
euiFilterButton__text: /*#__PURE__*/(0, _react.css)("
|
|
89
|
-
hasNotification: /*#__PURE__*/(0, _react.css)(
|
|
90
|
-
euiFilterButton__textShift: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiTextShift)('bold', 'data-text', euiTheme), " ", (0, _global_styling.euiTextTruncate)(), " ", (0, _global_styling.logicalCSS)('min-width', (0, _global_styling.mathWithUnits)(euiTheme.size.base, function (x) {
|
|
80
|
+
euiFilterButton__text: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiTextShift)('bold', 'data-text', euiTheme), " ", (0, _global_styling.euiTextTruncate)(), ";;label:euiFilterButton__text;"),
|
|
81
|
+
hasNotification: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('min-width', (0, _global_styling.mathWithUnits)(euiTheme.size.base, function (x) {
|
|
91
82
|
return x * 3;
|
|
92
|
-
})), ";;label:
|
|
83
|
+
})), ";;label:hasNotification;")
|
|
93
84
|
},
|
|
94
85
|
notification: {
|
|
95
86
|
euiFilterButton__notification: _ref2,
|
|
@@ -122,18 +122,18 @@ var EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
122
122
|
*/
|
|
123
123
|
if (isPushed) {
|
|
124
124
|
if (side === 'right') {
|
|
125
|
-
document.body.style.
|
|
125
|
+
document.body.style.paddingInlineEnd = "".concat(dimensions.width, "px");
|
|
126
126
|
} else if (side === 'left') {
|
|
127
|
-
document.body.style.
|
|
127
|
+
document.body.style.paddingInlineStart = "".concat(dimensions.width, "px");
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
return function () {
|
|
131
131
|
document.body.classList.remove('euiBody--hasFlyout');
|
|
132
132
|
if (isPushed) {
|
|
133
133
|
if (side === 'right') {
|
|
134
|
-
document.body.style.
|
|
134
|
+
document.body.style.paddingInlineEnd = '';
|
|
135
135
|
} else if (side === 'left') {
|
|
136
|
-
document.body.style.
|
|
136
|
+
document.body.style.paddingInlineStart = '';
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.EuiFlyoutResizable = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _services = require("../../services");
|
|
10
|
+
var _resizable_container = require("../resizable_container");
|
|
11
|
+
var _flyout = require("./flyout");
|
|
12
|
+
var _flyout_resizable = require("./flyout_resizable.styles");
|
|
13
|
+
var _react2 = require("@emotion/react");
|
|
14
|
+
var _excluded = ["size", "maxWidth", "minWidth", "side", "children"];
|
|
15
|
+
/*
|
|
16
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
17
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
18
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
19
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
20
|
+
* Side Public License, v 1.
|
|
21
|
+
*/
|
|
22
|
+
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); }
|
|
23
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
26
|
+
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."); }
|
|
27
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
28
|
+
function _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; }
|
|
29
|
+
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; } }
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
32
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
33
|
+
var EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
34
|
+
var size = _ref.size,
|
|
35
|
+
maxWidth = _ref.maxWidth,
|
|
36
|
+
_ref$minWidth = _ref.minWidth,
|
|
37
|
+
minWidth = _ref$minWidth === void 0 ? 200 : _ref$minWidth,
|
|
38
|
+
_ref$side = _ref.side,
|
|
39
|
+
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
40
|
+
children = _ref.children,
|
|
41
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
42
|
+
var euiTheme = (0, _services.useEuiTheme)();
|
|
43
|
+
var styles = (0, _flyout_resizable.euiFlyoutResizableButtonStyles)(euiTheme);
|
|
44
|
+
var cssStyles = [styles.euiFlyoutResizableButton, styles[side]];
|
|
45
|
+
var getFlyoutMinMaxWidth = (0, _react.useCallback)(function (width) {
|
|
46
|
+
return Math.min(Math.max(width, minWidth), maxWidth || Infinity, window.innerWidth - 20 // Leave some offset
|
|
47
|
+
);
|
|
48
|
+
}, [minWidth, maxWidth]);
|
|
49
|
+
var _useState = (0, _react.useState)(0),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
flyoutWidth = _useState2[0],
|
|
52
|
+
setFlyoutWidth = _useState2[1];
|
|
53
|
+
|
|
54
|
+
// Must use state for the flyout ref in order for the useEffect to be correctly called after render
|
|
55
|
+
var _useState3 = (0, _react.useState)(null),
|
|
56
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
57
|
+
flyoutRef = _useState4[0],
|
|
58
|
+
setFlyoutRef = _useState4[1];
|
|
59
|
+
var setRefs = (0, _services.useCombinedRefs)([setFlyoutRef, ref]);
|
|
60
|
+
(0, _react.useEffect)(function () {
|
|
61
|
+
setFlyoutWidth(flyoutRef ? getFlyoutMinMaxWidth(flyoutRef.offsetWidth) : 0);
|
|
62
|
+
}, [flyoutRef, getFlyoutMinMaxWidth, size]);
|
|
63
|
+
|
|
64
|
+
// Initial numbers to calculate from, on resize drag start
|
|
65
|
+
var initialWidth = (0, _react.useRef)(0);
|
|
66
|
+
var initialMouseX = (0, _react.useRef)(0);
|
|
67
|
+
|
|
68
|
+
// Account for flyout side and logical property direction
|
|
69
|
+
var direction = (0, _react.useMemo)(function () {
|
|
70
|
+
var modifier = side === 'right' ? -1 : 1;
|
|
71
|
+
if (flyoutRef) {
|
|
72
|
+
var languageDirection = window.getComputedStyle(flyoutRef).direction;
|
|
73
|
+
if (languageDirection === 'rtl') modifier *= -1;
|
|
74
|
+
}
|
|
75
|
+
return modifier;
|
|
76
|
+
}, [side, flyoutRef]);
|
|
77
|
+
var onMouseMove = (0, _react.useCallback)(function (e) {
|
|
78
|
+
var mouseOffset = getMouseOrTouchX(e) - initialMouseX.current;
|
|
79
|
+
var changedFlyoutWidth = initialWidth.current + mouseOffset * direction;
|
|
80
|
+
setFlyoutWidth(getFlyoutMinMaxWidth(changedFlyoutWidth));
|
|
81
|
+
}, [getFlyoutMinMaxWidth, direction]);
|
|
82
|
+
var onMouseUp = (0, _react.useCallback)(function () {
|
|
83
|
+
initialMouseX.current = 0;
|
|
84
|
+
window.removeEventListener('mousemove', onMouseMove);
|
|
85
|
+
window.removeEventListener('mouseup', onMouseUp);
|
|
86
|
+
window.removeEventListener('touchmove', onMouseMove);
|
|
87
|
+
window.removeEventListener('touchend', onMouseUp);
|
|
88
|
+
}, [onMouseMove]);
|
|
89
|
+
var onMouseDown = (0, _react.useCallback)(function (e) {
|
|
90
|
+
var _flyoutRef$offsetWidt;
|
|
91
|
+
initialMouseX.current = getMouseOrTouchX(e);
|
|
92
|
+
initialWidth.current = (_flyoutRef$offsetWidt = flyoutRef === null || flyoutRef === void 0 ? void 0 : flyoutRef.offsetWidth) !== null && _flyoutRef$offsetWidt !== void 0 ? _flyoutRef$offsetWidt : 0;
|
|
93
|
+
|
|
94
|
+
// Window event listeners instead of React events are used
|
|
95
|
+
// in case the user's mouse leaves the component
|
|
96
|
+
window.addEventListener('mousemove', onMouseMove);
|
|
97
|
+
window.addEventListener('mouseup', onMouseUp);
|
|
98
|
+
window.addEventListener('touchmove', onMouseMove);
|
|
99
|
+
window.addEventListener('touchend', onMouseUp);
|
|
100
|
+
}, [flyoutRef, onMouseMove, onMouseUp]);
|
|
101
|
+
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
102
|
+
var KEYBOARD_OFFSET = 10;
|
|
103
|
+
switch (e.key) {
|
|
104
|
+
case _services.keys.ARROW_RIGHT:
|
|
105
|
+
e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
|
|
106
|
+
setFlyoutWidth(function (flyoutWidth) {
|
|
107
|
+
return getFlyoutMinMaxWidth(flyoutWidth + KEYBOARD_OFFSET * direction);
|
|
108
|
+
});
|
|
109
|
+
break;
|
|
110
|
+
case _services.keys.ARROW_LEFT:
|
|
111
|
+
e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
|
|
112
|
+
setFlyoutWidth(function (flyoutWidth) {
|
|
113
|
+
return getFlyoutMinMaxWidth(flyoutWidth - KEYBOARD_OFFSET * direction);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}, [getFlyoutMinMaxWidth, direction]);
|
|
117
|
+
return (0, _react2.jsx)(_flyout.EuiFlyout, _extends({}, rest, {
|
|
118
|
+
size: flyoutWidth || size,
|
|
119
|
+
maxWidth: maxWidth,
|
|
120
|
+
side: side,
|
|
121
|
+
ref: setRefs
|
|
122
|
+
}), (0, _react2.jsx)(_resizable_container.EuiResizableButton, {
|
|
123
|
+
isHorizontal: true,
|
|
124
|
+
css: cssStyles,
|
|
125
|
+
onMouseDown: onMouseDown,
|
|
126
|
+
onTouchStart: onMouseDown,
|
|
127
|
+
onKeyDown: onKeyDown
|
|
128
|
+
}), children);
|
|
129
|
+
});
|
|
130
|
+
exports.EuiFlyoutResizable = EuiFlyoutResizable;
|
|
131
|
+
EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
|
|
132
|
+
var getMouseOrTouchX = function getMouseOrTouchX(e) {
|
|
133
|
+
// Some Typescript fooling is needed here
|
|
134
|
+
var x = e.targetTouches ? e.targetTouches[0].pageX : e.pageX;
|
|
135
|
+
return x;
|
|
136
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.euiFlyoutResizableButtonStyles = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
var _global_styling = require("../../global_styling");
|
|
9
|
+
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)."; } /*
|
|
10
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
11
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
12
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
13
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
14
|
+
* Side Public License, v 1.
|
|
15
|
+
*/
|
|
16
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
17
|
+
name: "6syi0e-euiFlyoutResizableButton",
|
|
18
|
+
styles: "position:absolute;&::before,&::after{background-color:transparent;};label:euiFlyoutResizableButton;"
|
|
19
|
+
} : {
|
|
20
|
+
name: "6syi0e-euiFlyoutResizableButton",
|
|
21
|
+
styles: "position:absolute;&::before,&::after{background-color:transparent;};label:euiFlyoutResizableButton;",
|
|
22
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
23
|
+
};
|
|
24
|
+
var euiFlyoutResizableButtonStyles = function euiFlyoutResizableButtonStyles(_ref2) {
|
|
25
|
+
var euiTheme = _ref2.euiTheme;
|
|
26
|
+
return {
|
|
27
|
+
euiFlyoutResizableButton: _ref,
|
|
28
|
+
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', "-".concat(euiTheme.border.width.thin)), ";;label:left;"),
|
|
29
|
+
right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('left', "-".concat(euiTheme.border.width.thin)), ";;label:right;")
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.euiFlyoutResizableButtonStyles = euiFlyoutResizableButtonStyles;
|
|
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "EuiFlyoutHeader", {
|
|
|
27
27
|
return _flyout_header.EuiFlyoutHeader;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "EuiFlyoutResizable", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _flyout_resizable.EuiFlyoutResizable;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
30
36
|
Object.defineProperty(exports, "euiFlyoutSlideInLeft", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
get: function get() {
|
|
@@ -43,4 +49,5 @@ var _flyout = require("./flyout");
|
|
|
43
49
|
var _flyout_body = require("./flyout_body");
|
|
44
50
|
var _flyout_footer = require("./flyout_footer");
|
|
45
51
|
var _flyout_header = require("./flyout_header");
|
|
46
|
-
var _flyout2 = require("./flyout.styles");
|
|
52
|
+
var _flyout2 = require("./flyout.styles");
|
|
53
|
+
var _flyout_resizable = require("./flyout_resizable");
|
|
@@ -68,38 +68,10 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
68
68
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
69
69
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
70
70
|
id: _this.props.id || (0, _services.htmlIdGenerator)()(),
|
|
71
|
-
rangeSliderRefAvailable: false,
|
|
72
71
|
isPopoverOpen: false,
|
|
73
|
-
rangeWidth: 0
|
|
74
|
-
isVisible: true // used to trigger a rerender if initial element width is 0
|
|
72
|
+
rangeWidth: 0
|
|
75
73
|
});
|
|
76
74
|
_defineProperty(_assertThisInitialized(_this), "preventPopoverClose", false);
|
|
77
|
-
_defineProperty(_assertThisInitialized(_this), "rangeSliderRef", null);
|
|
78
|
-
_defineProperty(_assertThisInitialized(_this), "handleRangeSliderRefUpdate", function (ref) {
|
|
79
|
-
_this.rangeSliderRef = ref;
|
|
80
|
-
if (ref) {
|
|
81
|
-
if (_this.isInPopover) {
|
|
82
|
-
// Wait a tick for popover rendering to settle
|
|
83
|
-
requestAnimationFrame(function () {
|
|
84
|
-
_this.setState({
|
|
85
|
-
rangeSliderRefAvailable: true,
|
|
86
|
-
rangeWidth: ref.clientWidth
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
} else {
|
|
90
|
-
// If not in a popover, no need to wait
|
|
91
|
-
_this.setState({
|
|
92
|
-
rangeSliderRefAvailable: true,
|
|
93
|
-
rangeWidth: ref.clientWidth
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
_this.setState({
|
|
98
|
-
rangeSliderRefAvailable: false,
|
|
99
|
-
rangeWidth: 0
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
75
|
_defineProperty(_assertThisInitialized(_this), "leftPosition", 0);
|
|
104
76
|
_defineProperty(_assertThisInitialized(_this), "dragAcc", 0);
|
|
105
77
|
_defineProperty(_assertThisInitialized(_this), "_determineInvalidThumbMovement", function (newVal, lower, upper, e) {
|
|
@@ -290,14 +262,11 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
290
262
|
isPopoverOpen: false
|
|
291
263
|
});
|
|
292
264
|
});
|
|
293
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
294
|
-
var
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
(_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);
|
|
265
|
+
_defineProperty(_assertThisInitialized(_this), "setRangeWidth", function (_ref) {
|
|
266
|
+
var width = _ref.width;
|
|
267
|
+
_this.setState({
|
|
268
|
+
rangeWidth: width
|
|
269
|
+
});
|
|
301
270
|
});
|
|
302
271
|
_defineProperty(_assertThisInitialized(_this), "getNearestStep", function (value) {
|
|
303
272
|
var min = _this.props.min;
|
|
@@ -320,7 +289,7 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
320
289
|
var delta = _this.leftPosition - x;
|
|
321
290
|
_this.leftPosition = x;
|
|
322
291
|
_this.dragAcc = _this.dragAcc + delta;
|
|
323
|
-
var percentageOfArea = _this.dragAcc / _this.
|
|
292
|
+
var percentageOfArea = _this.dragAcc / _this.state.rangeWidth;
|
|
324
293
|
var percentageOfRange = percentageOfArea * (max - min);
|
|
325
294
|
var newLower = _this.getNearestStep(lowerValue - percentageOfRange);
|
|
326
295
|
var newUpper = _this.getNearestStep(upperValue - percentageOfRange);
|
|
@@ -364,32 +333,12 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
364
333
|
get: function get() {
|
|
365
334
|
return this.lowerValueIsValid && this.upperValueIsValid;
|
|
366
335
|
}
|
|
367
|
-
}, {
|
|
368
|
-
key: "componentDidMount",
|
|
369
|
-
value: function componentDidMount() {
|
|
370
|
-
var _this$rangeSliderRef;
|
|
371
|
-
if (((_this$rangeSliderRef = this.rangeSliderRef) === null || _this$rangeSliderRef === void 0 ? void 0 : _this$rangeSliderRef.clientWidth) === 0) {
|
|
372
|
-
this.setState({
|
|
373
|
-
isVisible: false
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}, {
|
|
378
|
-
key: "componentDidUpdate",
|
|
379
|
-
value: function componentDidUpdate() {
|
|
380
|
-
var _this$rangeSliderRef2;
|
|
381
|
-
if ((_this$rangeSliderRef2 = this.rangeSliderRef) !== null && _this$rangeSliderRef2 !== void 0 && _this$rangeSliderRef2.clientWidth && !this.state.isVisible) {
|
|
382
|
-
this.setState({
|
|
383
|
-
isVisible: true
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
336
|
}, {
|
|
388
337
|
key: "render",
|
|
389
338
|
value: function render() {
|
|
390
339
|
var _this2 = this;
|
|
391
|
-
var
|
|
392
|
-
defaultFullWidth =
|
|
340
|
+
var _ref2 = this.context,
|
|
341
|
+
defaultFullWidth = _ref2.defaultFullWidth;
|
|
393
342
|
var _this$props = this.props,
|
|
394
343
|
className = _this$props.className,
|
|
395
344
|
customCss = _this$props.css,
|
|
@@ -545,10 +494,10 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
545
494
|
var classes = (0, _classnames.default)('euiDualRange', className);
|
|
546
495
|
var dualRangeStyles = (0, _dual_range.euiDualRangeStyles)();
|
|
547
496
|
var cssStyles = [dualRangeStyles.euiDualRange, customCss];
|
|
548
|
-
var leftThumbPosition = this.state.
|
|
497
|
+
var leftThumbPosition = this.state.rangeWidth ? this.calculateThumbPositionStyle(Number(this.lowerValue) || min, this.state.rangeWidth) : {
|
|
549
498
|
left: '0'
|
|
550
499
|
};
|
|
551
|
-
var rightThumbPosition = this.state.
|
|
500
|
+
var rightThumbPosition = this.state.rangeWidth ? this.calculateThumbPositionStyle(Number(this.upperValue) || max, this.state.rangeWidth) : {
|
|
552
501
|
left: '0'
|
|
553
502
|
};
|
|
554
503
|
var leftThumbColor = levels && (0, _range_levels_colors.getLevelColor)(levels, Number(this.lowerValue));
|
|
@@ -592,7 +541,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
592
541
|
}, (0, _react2.jsx)(_range_slider.EuiRangeSlider, _extends({
|
|
593
542
|
className: "euiDualRange__slider",
|
|
594
543
|
css: dualRangeStyles.euiDualRange__slider,
|
|
595
|
-
ref: this.handleRangeSliderRefUpdate,
|
|
596
544
|
id: id,
|
|
597
545
|
name: name,
|
|
598
546
|
min: min,
|
|
@@ -606,7 +554,9 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
606
554
|
showRange: showRange,
|
|
607
555
|
onFocus: _onFocus,
|
|
608
556
|
onBlur: _onBlur
|
|
609
|
-
}, rest
|
|
557
|
+
}, rest, {
|
|
558
|
+
onResize: this.setRangeWidth
|
|
559
|
+
})), isDraggable && this.isValid && (0, _react2.jsx)(_range_draggable.EuiRangeDraggable, {
|
|
610
560
|
min: min,
|
|
611
561
|
max: max,
|
|
612
562
|
value: [this.lowerValue, this.upperValue],
|
|
@@ -646,7 +596,7 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
646
596
|
style: (0, _global_styling.logicalStyles)(rightThumbStyles),
|
|
647
597
|
"aria-describedby": showInputOnly ? undefined : this.props['aria-describedby'],
|
|
648
598
|
"aria-label": showInputOnly ? undefined : this.props['aria-label']
|
|
649
|
-
})
|
|
599
|
+
}), showRange && this.isValid && (0, _react2.jsx)(_range_highlight.EuiRangeHighlight, {
|
|
650
600
|
showTicks: showTicks,
|
|
651
601
|
min: Number(min),
|
|
652
602
|
max: Number(max),
|
|
@@ -678,7 +628,6 @@ var EuiDualRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
678
628
|
isOpen: this.state.isPopoverOpen,
|
|
679
629
|
closePopover: this.closePopover,
|
|
680
630
|
disableFocusTrap: true,
|
|
681
|
-
onPanelResize: this.onResize,
|
|
682
631
|
popoverScreenReaderText: dualSliderScreenReaderInstructions
|
|
683
632
|
}), theRange) : undefined;
|
|
684
633
|
return thePopover || theRange;
|
|
@@ -71,9 +71,10 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
71
71
|
_this.props.onChange(e, isValid);
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
74
|
+
_defineProperty(_assertThisInitialized(_this), "setTrackWidth", function (_ref) {
|
|
75
|
+
var width = _ref.width;
|
|
75
76
|
_this.setState({
|
|
76
|
-
trackWidth:
|
|
77
|
+
trackWidth: width
|
|
77
78
|
});
|
|
78
79
|
});
|
|
79
80
|
_defineProperty(_assertThisInitialized(_this), "onInputFocus", function (e) {
|
|
@@ -117,8 +118,8 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
117
118
|
key: "render",
|
|
118
119
|
value: function render() {
|
|
119
120
|
var _this2 = this;
|
|
120
|
-
var
|
|
121
|
-
defaultFullWidth =
|
|
121
|
+
var _ref2 = this.context,
|
|
122
|
+
defaultFullWidth = _ref2.defaultFullWidth;
|
|
122
123
|
var _this$props = this.props,
|
|
123
124
|
className = _this$props.className,
|
|
124
125
|
compressed = _this$props.compressed,
|
|
@@ -224,7 +225,7 @@ var EuiRangeClass = /*#__PURE__*/function (_Component) {
|
|
|
224
225
|
"aria-hidden": !!showInput,
|
|
225
226
|
thumbColor: thumbColor
|
|
226
227
|
}, rest, {
|
|
227
|
-
|
|
228
|
+
onResize: this.setTrackWidth
|
|
228
229
|
})), showRange && this.isValid && (0, _react2.jsx)(_range_highlight.EuiRangeHighlight, {
|
|
229
230
|
showTicks: showTicks,
|
|
230
231
|
min: Number(min),
|
|
@@ -10,10 +10,11 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
var _services = require("../../../services");
|
|
12
12
|
var _global_styling = require("../../../global_styling");
|
|
13
|
+
var _resize_observer = require("../../observer/resize_observer");
|
|
13
14
|
var _range_levels_colors = require("./range_levels_colors");
|
|
14
15
|
var _range_slider = require("./range_slider.styles");
|
|
15
16
|
var _react2 = require("@emotion/react");
|
|
16
|
-
var _excluded = ["className", "disabled", "id", "max", "min", "name", "step", "onChange", "tabIndex", "value", "style", "showTicks", "showRange", "thumbColor"];
|
|
17
|
+
var _excluded = ["className", "disabled", "id", "max", "min", "name", "step", "onChange", "tabIndex", "value", "style", "showTicks", "showRange", "thumbColor", "onResize"];
|
|
17
18
|
/*
|
|
18
19
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
19
20
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -32,7 +33,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
32
33
|
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); }
|
|
33
34
|
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; }
|
|
34
35
|
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; }
|
|
35
|
-
var EuiRangeSlider =
|
|
36
|
+
var EuiRangeSlider = function EuiRangeSlider(_ref) {
|
|
36
37
|
var className = _ref.className,
|
|
37
38
|
disabled = _ref.disabled,
|
|
38
39
|
id = _ref.id,
|
|
@@ -47,6 +48,7 @@ var EuiRangeSlider = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
47
48
|
showTicks = _ref.showTicks,
|
|
48
49
|
showRange = _ref.showRange,
|
|
49
50
|
thumbColor = _ref.thumbColor,
|
|
51
|
+
onResize = _ref.onResize,
|
|
50
52
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
51
53
|
var classes = (0, _classnames.default)('euiRangeSlider', className);
|
|
52
54
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
@@ -58,30 +60,34 @@ var EuiRangeSlider = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
58
60
|
color: thumbColor && (0, _range_levels_colors.euiRangeLevelColor)(thumbColor, euiTheme.euiTheme)
|
|
59
61
|
}, style));
|
|
60
62
|
}, [thumbColor, euiTheme, style]);
|
|
61
|
-
return (0, _react2.jsx)(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
63
|
+
return (0, _react2.jsx)(_resize_observer.EuiResizeObserver, {
|
|
64
|
+
onResize: onResize
|
|
65
|
+
}, function (resizeRef) {
|
|
66
|
+
return (0, _react2.jsx)("input", _extends({
|
|
67
|
+
ref: resizeRef,
|
|
68
|
+
type: "range",
|
|
69
|
+
id: id,
|
|
70
|
+
name: name,
|
|
71
|
+
className: classes,
|
|
72
|
+
css: cssStyles,
|
|
73
|
+
min: min,
|
|
74
|
+
max: max,
|
|
75
|
+
step: step,
|
|
76
|
+
value: value,
|
|
77
|
+
disabled: disabled,
|
|
78
|
+
onChange: onChange,
|
|
79
|
+
style: sliderStyle,
|
|
80
|
+
tabIndex: tabIndex
|
|
81
|
+
}, rest));
|
|
82
|
+
});
|
|
83
|
+
};
|
|
78
84
|
exports.EuiRangeSlider = EuiRangeSlider;
|
|
79
85
|
EuiRangeSlider.propTypes = {
|
|
80
86
|
onChange: _propTypes.default.any,
|
|
81
87
|
thumbColor: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.any.isRequired]),
|
|
88
|
+
onResize: _propTypes.default.func.isRequired,
|
|
82
89
|
className: _propTypes.default.string,
|
|
83
90
|
"aria-label": _propTypes.default.string,
|
|
84
91
|
"data-test-subj": _propTypes.default.string,
|
|
85
92
|
css: _propTypes.default.any
|
|
86
|
-
};
|
|
87
|
-
EuiRangeSlider.displayName = 'EuiRangeSlider';
|
|
93
|
+
};
|