@elastic/eui 90.0.0 → 91.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 +1 -15
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +112 -80
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +112 -80
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accordion/accordion.js +13 -2
- package/es/components/accordion/accordion_children/accordion_children.js +4 -3
- package/es/components/breadcrumbs/breadcrumb.js +5 -5
- package/es/components/breadcrumbs/breadcrumbs.js +5 -5
- package/es/components/button/button_display/_button_display.js +1 -1
- package/es/components/button/button_group/button_group.js +8 -10
- package/es/components/button/button_group/button_group_button.js +8 -51
- package/es/components/button/button_group/button_group_button.styles.js +2 -12
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +8 -0
- package/es/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +8 -3
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +7 -3
- package/es/components/combo_box/combo_box.js +7 -5
- package/es/components/combo_box/combo_box_input/combo_box_input.js +107 -65
- package/es/components/combo_box/combo_box_input/combo_box_pill.js +8 -18
- package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
- package/es/components/combo_box/utils.js +23 -0
- package/es/components/control_bar/control_bar.js +5 -5
- package/es/components/datagrid/body/header/data_grid_header_cell.js +1 -1
- package/es/components/datagrid/controls/column_selector.js +5 -6
- package/es/components/datagrid/controls/column_sorting.js +6 -9
- package/es/components/datagrid/controls/display_selector.js +21 -16
- package/es/components/datagrid/data_grid.js +3 -864
- package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +92 -26
- package/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +1 -1
- package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.js +19 -0
- package/es/components/facet/facet_button.js +1 -1
- package/es/components/filter_group/filter_group.styles.js +1 -1
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +5 -5
- package/es/components/header/header_links/header_links.js +5 -5
- package/es/components/i18n/i18n.js +1 -0
- package/es/components/page/page_header/page_header_content.js +5 -5
- package/es/components/popover/input_popover.js +1 -1
- package/es/components/popover/popover.js +15 -27
- package/es/components/popover/popover_arrow/_popover_arrow.styles.js +2 -4
- package/es/components/popover/popover_panel/_popover_panel.js +2 -6
- package/es/components/popover/popover_panel/_popover_panel.styles.js +6 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +13 -11
- package/es/components/toast/global_toast_list.js +11 -1
- package/es/components/tour/tour_step.js +5 -5
- package/es/global_styling/mixins/_states.js +4 -1
- package/es/services/color/eui_palettes.js +0 -6
- package/es/services/color/index.js +1 -1
- package/es/services/hooks/useCombinedRefs.js +16 -9
- package/es/services/index.js +1 -2
- package/es/test/rtl/component_helpers.d.ts +2 -0
- package/es/test/rtl/component_helpers.js +40 -1
- package/eui.d.ts +96 -82
- package/i18ntokens.json +199 -181
- package/lib/components/accordion/accordion.js +13 -2
- package/lib/components/accordion/accordion_children/accordion_children.js +4 -3
- package/lib/components/breadcrumbs/breadcrumb.js +5 -5
- package/lib/components/button/button_display/_button_display.js +1 -1
- package/lib/components/button/button_group/button_group.js +7 -9
- package/lib/components/button/button_group/button_group_button.js +8 -51
- package/lib/components/button/button_group/button_group_button.styles.js +2 -12
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +8 -0
- package/lib/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +7 -2
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +6 -2
- package/lib/components/combo_box/combo_box.js +7 -5
- package/lib/components/combo_box/combo_box_input/combo_box_input.js +107 -65
- package/lib/components/combo_box/combo_box_input/combo_box_pill.js +8 -18
- package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
- package/lib/components/combo_box/utils.js +31 -0
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +1 -1
- package/lib/components/datagrid/controls/column_selector.js +5 -6
- package/lib/components/datagrid/controls/column_sorting.js +5 -8
- package/lib/components/datagrid/controls/display_selector.js +21 -16
- package/lib/components/datagrid/data_grid.js +2 -863
- package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +91 -26
- package/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +1 -1
- package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +19 -0
- package/lib/components/facet/facet_button.js +1 -1
- package/lib/components/filter_group/filter_group.styles.js +1 -1
- package/lib/components/i18n/i18n.js +1 -0
- package/lib/components/popover/input_popover.js +1 -1
- package/lib/components/popover/popover.js +29 -35
- package/lib/components/popover/popover_arrow/_popover_arrow.styles.js +1 -3
- package/lib/components/popover/popover_panel/_popover_panel.js +2 -1
- package/lib/components/popover/popover_panel/_popover_panel.styles.js +6 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +12 -10
- package/lib/components/toast/global_toast_list.js +11 -1
- package/lib/global_styling/mixins/_states.js +4 -1
- package/lib/services/color/eui_palettes.js +1 -8
- package/lib/services/color/index.js +0 -7
- package/lib/services/hooks/useCombinedRefs.js +19 -10
- package/lib/services/index.js +0 -15
- package/lib/test/rtl/component_helpers.d.ts +2 -0
- package/lib/test/rtl/component_helpers.js +41 -3
- package/optimize/es/components/accordion/accordion.js +5 -2
- package/optimize/es/components/accordion/accordion_children/accordion_children.js +4 -3
- package/optimize/es/components/button/button_group/button_group.js +7 -8
- package/optimize/es/components/button/button_group/button_group_button.js +6 -38
- package/optimize/es/components/button/button_group/button_group_button.styles.js +2 -12
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +8 -3
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +7 -3
- package/optimize/es/components/combo_box/combo_box.js +7 -5
- package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +107 -65
- package/optimize/es/components/combo_box/combo_box_input/combo_box_pill.js +8 -17
- package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
- package/optimize/es/components/combo_box/utils.js +23 -0
- package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +1 -1
- package/optimize/es/components/datagrid/controls/column_selector.js +5 -6
- package/optimize/es/components/datagrid/controls/column_sorting.js +6 -9
- package/optimize/es/components/datagrid/controls/display_selector.js +21 -16
- package/optimize/es/components/datagrid/data_grid.js +3 -3
- package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +87 -26
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
- package/optimize/es/components/filter_group/filter_group.styles.js +1 -1
- package/optimize/es/components/i18n/i18n.js +1 -0
- package/optimize/es/components/popover/input_popover.js +1 -1
- package/optimize/es/components/popover/popover.js +10 -22
- package/optimize/es/components/popover/popover_arrow/_popover_arrow.styles.js +2 -4
- package/optimize/es/components/popover/popover_panel/_popover_panel.js +2 -1
- package/optimize/es/components/popover/popover_panel/_popover_panel.styles.js +6 -1
- package/optimize/es/components/selectable/selectable_templates/selectable_template_sitewide.js +13 -11
- package/optimize/es/components/toast/global_toast_list.js +1 -1
- package/optimize/es/global_styling/mixins/_states.js +4 -1
- package/optimize/es/services/color/eui_palettes.js +0 -6
- package/optimize/es/services/color/index.js +1 -1
- package/optimize/es/services/hooks/useCombinedRefs.js +16 -9
- package/optimize/es/services/index.js +1 -2
- package/optimize/es/test/rtl/component_helpers.d.ts +2 -0
- package/optimize/es/test/rtl/component_helpers.js +40 -1
- package/optimize/lib/components/accordion/accordion.js +5 -2
- package/optimize/lib/components/accordion/accordion_children/accordion_children.js +4 -3
- package/optimize/lib/components/button/button_group/button_group.js +6 -7
- package/optimize/lib/components/button/button_group/button_group_button.js +6 -38
- package/optimize/lib/components/button/button_group/button_group_button.styles.js +2 -12
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +7 -2
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +6 -2
- package/optimize/lib/components/combo_box/combo_box.js +7 -5
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +107 -65
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_pill.js +8 -17
- package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
- package/optimize/lib/components/combo_box/utils.js +31 -0
- package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +1 -1
- package/optimize/lib/components/datagrid/controls/column_selector.js +5 -6
- package/optimize/lib/components/datagrid/controls/column_sorting.js +5 -8
- package/optimize/lib/components/datagrid/controls/display_selector.js +21 -16
- package/optimize/lib/components/datagrid/data_grid.js +2 -2
- package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +86 -26
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
- package/optimize/lib/components/filter_group/filter_group.styles.js +1 -1
- package/optimize/lib/components/i18n/i18n.js +1 -0
- package/optimize/lib/components/popover/input_popover.js +1 -1
- package/optimize/lib/components/popover/popover.js +24 -35
- package/optimize/lib/components/popover/popover_arrow/_popover_arrow.styles.js +1 -3
- package/optimize/lib/components/popover/popover_panel/_popover_panel.js +2 -1
- package/optimize/lib/components/popover/popover_panel/_popover_panel.styles.js +6 -1
- package/optimize/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +12 -10
- package/optimize/lib/components/toast/global_toast_list.js +1 -1
- package/optimize/lib/global_styling/mixins/_states.js +4 -1
- package/optimize/lib/services/color/eui_palettes.js +1 -8
- package/optimize/lib/services/color/index.js +0 -7
- package/optimize/lib/services/hooks/useCombinedRefs.js +19 -10
- package/optimize/lib/services/index.js +0 -15
- package/optimize/lib/test/rtl/component_helpers.d.ts +2 -0
- package/optimize/lib/test/rtl/component_helpers.js +41 -3
- package/package.json +10 -10
- package/src/components/combo_box/_combo_box.scss +46 -14
- package/src/components/combo_box/combo_box_input/_combo_box_pill.scss +0 -17
- package/src/components/combo_box/combo_box_input/_index.scss +0 -2
- package/src/components/datagrid/_data_grid_data_row.scss +1 -2
- package/src/components/date_picker/super_date_picker/date_popover/_absolute_tab.scss +21 -0
- package/src/components/date_picker/super_date_picker/quick_select_popover/_quick_select_popover.scss +0 -4
- package/src/components/form/form_control_layout/_form_control_layout.scss +0 -1
- package/src/global_styling/variables/_typography.scss +2 -2
- package/test-env/components/accordion/accordion.js +13 -2
- package/test-env/components/accordion/accordion_children/accordion_children.js +4 -3
- package/test-env/components/breadcrumbs/breadcrumb.js +5 -5
- package/test-env/components/button/button_display/_button_display.js +1 -1
- package/test-env/components/button/button_group/button_group.js +7 -9
- package/test-env/components/button/button_group/button_group_button.js +8 -51
- package/test-env/components/button/button_group/button_group_button.styles.js +2 -12
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +8 -0
- package/test-env/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.js +7 -2
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_group.js +6 -2
- package/test-env/components/combo_box/combo_box.js +7 -5
- package/test-env/components/combo_box/combo_box_input/combo_box_input.js +107 -65
- package/test-env/components/combo_box/combo_box_input/combo_box_pill.js +8 -18
- package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +6 -6
- package/test-env/components/combo_box/utils.js +31 -0
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +1 -1
- package/test-env/components/datagrid/controls/column_selector.js +5 -6
- package/test-env/components/datagrid/controls/column_sorting.js +5 -8
- package/test-env/components/datagrid/controls/display_selector.js +21 -16
- package/test-env/components/datagrid/data_grid.js +2 -863
- package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +86 -26
- package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_button.js +1 -1
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +1 -2
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +19 -0
- package/test-env/components/facet/facet_button.js +1 -1
- package/test-env/components/filter_group/filter_group.styles.js +1 -1
- package/test-env/components/i18n/i18n.js +1 -0
- package/test-env/components/popover/input_popover.js +1 -1
- package/test-env/components/popover/popover.js +29 -35
- package/test-env/components/popover/popover_arrow/_popover_arrow.styles.js +1 -3
- package/test-env/components/popover/popover_panel/_popover_panel.js +2 -1
- package/test-env/components/popover/popover_panel/_popover_panel.styles.js +6 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +12 -10
- package/test-env/components/toast/global_toast_list.js +11 -1
- package/test-env/global_styling/mixins/_states.js +4 -1
- package/test-env/services/color/eui_palettes.js +1 -8
- package/test-env/services/color/index.js +0 -7
- package/test-env/services/hooks/useCombinedRefs.js +19 -10
- package/test-env/services/index.js +0 -15
- package/test-env/test/rtl/component_helpers.js +41 -3
- package/es/services/random.js +0 -94
- package/es/services/utils.js +0 -25
- package/es/test/patch_random.js +0 -18
- package/lib/services/random.js +0 -100
- package/lib/services/utils.js +0 -35
- package/lib/test/patch_random.js +0 -25
- package/optimize/es/services/random.js +0 -85
- package/optimize/es/services/utils.js +0 -25
- package/optimize/es/test/patch_random.js +0 -18
- package/optimize/lib/services/random.js +0 -91
- package/optimize/lib/services/utils.js +0 -35
- package/optimize/lib/test/patch_random.js +0 -25
- package/src/components/combo_box/combo_box_input/_combo_box_input.scss +0 -12
- package/src/components/combo_box/combo_box_input/_combo_box_placeholder.scss +0 -11
- package/test-env/services/random.js +0 -91
- package/test-env/services/utils.js +0 -35
- package/test-env/test/patch_random.js +0 -25
|
@@ -1,4 +1,10 @@
|
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
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."); }
|
|
4
|
+
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); }
|
|
5
|
+
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; }
|
|
6
|
+
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; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
2
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
9
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
10
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -25,52 +31,99 @@ import PropTypes from "prop-types";
|
|
|
25
31
|
import moment from 'moment'; // eslint-disable-line import/named
|
|
26
32
|
|
|
27
33
|
import dateMath from '@elastic/datemath';
|
|
28
|
-
import {
|
|
34
|
+
import { keys } from '../../../../services';
|
|
29
35
|
import { EuiFormRow, EuiFieldText, EuiFormLabel } from '../../../form';
|
|
36
|
+
import { EuiCode } from '../../../code';
|
|
30
37
|
import { EuiI18n } from '../../../i18n';
|
|
38
|
+
import { EuiDatePicker } from '../../date_picker';
|
|
31
39
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
40
|
+
// Allow users to paste in and have the datepicker parse multiple common date formats,
|
|
41
|
+
// in addition to the configured displayed `dateFormat` prop
|
|
42
|
+
var ALLOWED_USER_DATE_FORMATS = [moment.ISO_8601, moment.RFC_2822, 'X' // Unix timestamp in seconds
|
|
43
|
+
];
|
|
44
|
+
|
|
32
45
|
export var EuiAbsoluteTab = /*#__PURE__*/function (_Component) {
|
|
33
46
|
_inherits(EuiAbsoluteTab, _Component);
|
|
34
47
|
var _super = _createSuper(EuiAbsoluteTab);
|
|
48
|
+
// Store outside of state as a ref for faster/unbatched updates
|
|
49
|
+
|
|
35
50
|
function EuiAbsoluteTab(props) {
|
|
36
51
|
var _this;
|
|
37
52
|
_classCallCheck(this, EuiAbsoluteTab);
|
|
38
53
|
_this = _super.call(this, props);
|
|
39
54
|
_defineProperty(_assertThisInitialized(_this), "state", void 0);
|
|
40
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "isParsing", false);
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (date) {
|
|
41
57
|
var onChange = _this.props.onChange;
|
|
42
58
|
if (date === null) {
|
|
43
59
|
return;
|
|
44
60
|
}
|
|
45
|
-
onChange(date.toISOString()
|
|
61
|
+
onChange(date.toISOString());
|
|
46
62
|
var valueAsMoment = moment(date);
|
|
47
63
|
_this.setState({
|
|
48
64
|
valueAsMoment: valueAsMoment,
|
|
49
65
|
textInputValue: valueAsMoment.format(_this.props.dateFormat),
|
|
66
|
+
hasUnparsedText: false,
|
|
50
67
|
isTextInvalid: false
|
|
51
68
|
});
|
|
52
69
|
});
|
|
53
70
|
_defineProperty(_assertThisInitialized(_this), "handleTextChange", function (event) {
|
|
54
|
-
|
|
55
|
-
var valueAsMoment = moment(event.target.value, _this.props.dateFormat, true);
|
|
56
|
-
var dateIsValid = valueAsMoment.isValid();
|
|
57
|
-
if (dateIsValid) {
|
|
58
|
-
onChange(valueAsMoment.toISOString(), event);
|
|
59
|
-
}
|
|
71
|
+
if (_this.isParsing) return;
|
|
60
72
|
_this.setState({
|
|
61
73
|
textInputValue: event.target.value,
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
hasUnparsedText: true,
|
|
75
|
+
isTextInvalid: false
|
|
64
76
|
});
|
|
65
77
|
});
|
|
78
|
+
_defineProperty(_assertThisInitialized(_this), "parseUserDateInput", function (textInputValue) {
|
|
79
|
+
_this.isParsing = true;
|
|
80
|
+
// Wait a tick for state to finish updating (whatever gets returned),
|
|
81
|
+
// and then allow `onChange` user input to continue setting state
|
|
82
|
+
requestAnimationFrame(function () {
|
|
83
|
+
_this.isParsing = false;
|
|
84
|
+
});
|
|
85
|
+
var invalidDateState = {
|
|
86
|
+
textInputValue: textInputValue,
|
|
87
|
+
isTextInvalid: true,
|
|
88
|
+
valueAsMoment: null
|
|
89
|
+
};
|
|
90
|
+
if (!textInputValue) {
|
|
91
|
+
return _this.setState(invalidDateState);
|
|
92
|
+
}
|
|
93
|
+
var _this$props = _this.props,
|
|
94
|
+
onChange = _this$props.onChange,
|
|
95
|
+
dateFormat = _this$props.dateFormat;
|
|
96
|
+
|
|
97
|
+
// Attempt to parse with passed `dateFormat`
|
|
98
|
+
var valueAsMoment = moment(textInputValue, dateFormat, true);
|
|
99
|
+
var dateIsValid = valueAsMoment.isValid();
|
|
100
|
+
|
|
101
|
+
// If not valid, try a few other other standardized formats
|
|
102
|
+
if (!dateIsValid) {
|
|
103
|
+
valueAsMoment = moment(textInputValue, ALLOWED_USER_DATE_FORMATS, true);
|
|
104
|
+
dateIsValid = valueAsMoment.isValid();
|
|
105
|
+
}
|
|
106
|
+
if (dateIsValid) {
|
|
107
|
+
onChange(valueAsMoment.toISOString());
|
|
108
|
+
_this.setState({
|
|
109
|
+
textInputValue: valueAsMoment.format(_this.props.dateFormat),
|
|
110
|
+
valueAsMoment: valueAsMoment,
|
|
111
|
+
hasUnparsedText: false,
|
|
112
|
+
isTextInvalid: false
|
|
113
|
+
});
|
|
114
|
+
} else {
|
|
115
|
+
_this.setState(invalidDateState);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
66
118
|
var parsedValue = dateMath.parse(props.value, {
|
|
67
119
|
roundUp: props.roundUp
|
|
68
120
|
});
|
|
69
121
|
var _valueAsMoment = parsedValue && parsedValue.isValid() ? parsedValue : moment();
|
|
70
|
-
var
|
|
122
|
+
var _textInputValue = _valueAsMoment.locale(_this.props.locale || 'en').format(_this.props.dateFormat);
|
|
71
123
|
_this.state = {
|
|
124
|
+
hasUnparsedText: false,
|
|
72
125
|
isTextInvalid: false,
|
|
73
|
-
textInputValue:
|
|
126
|
+
textInputValue: _textInputValue,
|
|
74
127
|
valueAsMoment: _valueAsMoment
|
|
75
128
|
};
|
|
76
129
|
return _this;
|
|
@@ -79,17 +132,18 @@ export var EuiAbsoluteTab = /*#__PURE__*/function (_Component) {
|
|
|
79
132
|
key: "render",
|
|
80
133
|
value: function render() {
|
|
81
134
|
var _this2 = this;
|
|
82
|
-
var _this$
|
|
83
|
-
dateFormat = _this$
|
|
84
|
-
timeFormat = _this$
|
|
85
|
-
locale = _this$
|
|
86
|
-
utcOffset = _this$
|
|
87
|
-
labelPrefix = _this$
|
|
135
|
+
var _this$props2 = this.props,
|
|
136
|
+
dateFormat = _this$props2.dateFormat,
|
|
137
|
+
timeFormat = _this$props2.timeFormat,
|
|
138
|
+
locale = _this$props2.locale,
|
|
139
|
+
utcOffset = _this$props2.utcOffset,
|
|
140
|
+
labelPrefix = _this$props2.labelPrefix;
|
|
88
141
|
var _this$state = this.state,
|
|
89
142
|
valueAsMoment = _this$state.valueAsMoment,
|
|
90
143
|
isTextInvalid = _this$state.isTextInvalid,
|
|
144
|
+
hasUnparsedText = _this$state.hasUnparsedText,
|
|
91
145
|
textInputValue = _this$state.textInputValue;
|
|
92
|
-
return ___EmotionJSX(
|
|
146
|
+
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiDatePicker, {
|
|
93
147
|
inline: true,
|
|
94
148
|
showTimeSelect: true,
|
|
95
149
|
shadow: false,
|
|
@@ -100,22 +154,34 @@ export var EuiAbsoluteTab = /*#__PURE__*/function (_Component) {
|
|
|
100
154
|
locale: locale,
|
|
101
155
|
utcOffset: utcOffset
|
|
102
156
|
}), ___EmotionJSX(EuiI18n, {
|
|
103
|
-
|
|
104
|
-
|
|
157
|
+
tokens: ['euiAbsoluteTab.dateFormatHint', 'euiAbsoluteTab.dateFormatError'],
|
|
158
|
+
defaults: ['Press the Enter key to parse as a date.', 'Allowed formats: {dateFormat}, ISO 8601, RFC 2822, or Unix timestamp.'],
|
|
105
159
|
values: {
|
|
106
|
-
dateFormat: dateFormat
|
|
160
|
+
dateFormat: ___EmotionJSX(EuiCode, null, dateFormat)
|
|
107
161
|
}
|
|
108
|
-
}, function (
|
|
162
|
+
}, function (_ref) {
|
|
163
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
164
|
+
dateFormatHint = _ref2[0],
|
|
165
|
+
dateFormatError = _ref2[1];
|
|
109
166
|
return ___EmotionJSX(EuiFormRow, {
|
|
110
167
|
className: "euiSuperDatePicker__absoluteDateFormRow",
|
|
111
168
|
isInvalid: isTextInvalid,
|
|
112
|
-
error: isTextInvalid ? dateFormatError : undefined
|
|
169
|
+
error: isTextInvalid ? dateFormatError : undefined,
|
|
170
|
+
helpText: hasUnparsedText ? isTextInvalid ? dateFormatHint : [dateFormatHint, dateFormatError] : undefined
|
|
113
171
|
}, ___EmotionJSX(EuiFieldText, {
|
|
114
172
|
compressed: true,
|
|
115
173
|
isInvalid: isTextInvalid,
|
|
116
174
|
value: textInputValue,
|
|
117
175
|
onChange: _this2.handleTextChange,
|
|
118
|
-
|
|
176
|
+
onPaste: function onPaste(event) {
|
|
177
|
+
_this2.parseUserDateInput(event.clipboardData.getData('text'));
|
|
178
|
+
},
|
|
179
|
+
onKeyDown: function onKeyDown(event) {
|
|
180
|
+
if (event.key === keys.ENTER) {
|
|
181
|
+
_this2.parseUserDateInput(textInputValue);
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"data-test-subj": "superDatePickerAbsoluteDateInput",
|
|
119
185
|
prepend: ___EmotionJSX(EuiFormLabel, null, labelPrefix)
|
|
120
186
|
}));
|
|
121
187
|
}));
|
|
@@ -99,7 +99,7 @@ EuiDatePopoverButton.propTypes = {
|
|
|
99
99
|
isOpen: PropTypes.bool.isRequired,
|
|
100
100
|
needsUpdating: PropTypes.bool,
|
|
101
101
|
locale: PropTypes.any,
|
|
102
|
-
onChange: PropTypes.
|
|
102
|
+
onChange: PropTypes.func.isRequired,
|
|
103
103
|
onPopoverClose: PropTypes.any.isRequired,
|
|
104
104
|
onPopoverToggle: PropTypes.func.isRequired,
|
|
105
105
|
position: PropTypes.oneOf(["start", "end"]).isRequired,
|
package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js
CHANGED
|
@@ -86,8 +86,7 @@ export var EuiQuickSelectPopover = function EuiQuickSelectPopover(_ref) {
|
|
|
86
86
|
button: quickSelectButton,
|
|
87
87
|
isOpen: isOpen,
|
|
88
88
|
closePopover: closePopover,
|
|
89
|
-
anchorPosition: "downLeft"
|
|
90
|
-
anchorClassName: "euiQuickSelectPopover__anchor"
|
|
89
|
+
anchorPosition: "downLeft"
|
|
91
90
|
}, ___EmotionJSX(EuiQuickSelectPanels, _extends({}, props, {
|
|
92
91
|
applyTime: applyTime,
|
|
93
92
|
prevQuickSelect: prevQuickSelect
|
|
@@ -489,6 +489,7 @@ EuiSuperDatePickerInternal.propTypes = {
|
|
|
489
489
|
customQuickSelectRender: PropTypes.func,
|
|
490
490
|
/**
|
|
491
491
|
* Specifies the formatted used when displaying dates and/or datetimes
|
|
492
|
+
* @default 'MMM D, YYYY @ HH:mm:ss.SSS'
|
|
492
493
|
*/
|
|
493
494
|
dateFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.string.isRequired]),
|
|
494
495
|
/**
|
|
@@ -505,12 +506,16 @@ EuiSuperDatePickerInternal.propTypes = {
|
|
|
505
506
|
display: PropTypes.node.isRequired
|
|
506
507
|
}).isRequired]),
|
|
507
508
|
isLoading: PropTypes.bool,
|
|
509
|
+
/**
|
|
510
|
+
* @default true
|
|
511
|
+
*/
|
|
508
512
|
isPaused: PropTypes.oneOfType([PropTypes.bool, PropTypes.bool.isRequired]),
|
|
509
513
|
/**
|
|
510
514
|
* Sets the overall width by adding sensible min and max widths.
|
|
511
515
|
* - `auto`: fits width to internal content / time string.
|
|
512
516
|
* - `restricted`: static width that fits the longest possible time string.
|
|
513
517
|
* - `full`: expands to 100% of the container.
|
|
518
|
+
* @default 'restricted'
|
|
514
519
|
*/
|
|
515
520
|
width: PropTypes.oneOf(["restricted", "full", "auto"]),
|
|
516
521
|
/**
|
|
@@ -552,17 +557,20 @@ EuiSuperDatePickerInternal.propTypes = {
|
|
|
552
557
|
}).isRequired).isRequired]),
|
|
553
558
|
/**
|
|
554
559
|
* Refresh interval in milliseconds
|
|
560
|
+
* @default 1000
|
|
555
561
|
*/
|
|
556
562
|
refreshInterval: PropTypes.oneOfType([PropTypes.number, PropTypes.number.isRequired]),
|
|
557
563
|
start: PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.oneOf(["now"]), PropTypes.string.isRequired]), PropTypes.oneOfType([PropTypes.oneOf(["now"]), PropTypes.string.isRequired]).isRequired]),
|
|
558
564
|
end: PropTypes.oneOfType([PropTypes.oneOfType([PropTypes.oneOf(["now"]), PropTypes.string.isRequired]), PropTypes.oneOfType([PropTypes.oneOf(["now"]), PropTypes.string.isRequired]).isRequired]),
|
|
559
565
|
/**
|
|
560
566
|
* Specifies the formatted used when displaying times
|
|
567
|
+
* @default 'HH:mm'
|
|
561
568
|
*/
|
|
562
569
|
timeFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.string.isRequired]),
|
|
563
570
|
utcOffset: PropTypes.number,
|
|
564
571
|
/**
|
|
565
572
|
* Set showUpdateButton to false to immediately invoke onTimeChange for all start and end changes.
|
|
573
|
+
* @default true
|
|
566
574
|
*/
|
|
567
575
|
showUpdateButton: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.oneOf(["iconOnly"])]),
|
|
568
576
|
/**
|
|
@@ -698,6 +706,7 @@ EuiSuperDatePicker.propTypes = {
|
|
|
698
706
|
customQuickSelectRender: PropTypes.func,
|
|
699
707
|
/**
|
|
700
708
|
* Specifies the formatted used when displaying dates and/or datetimes
|
|
709
|
+
* @default 'MMM D, YYYY @ HH:mm:ss.SSS'
|
|
701
710
|
*/
|
|
702
711
|
dateFormat: PropTypes.string,
|
|
703
712
|
/**
|
|
@@ -714,12 +723,16 @@ EuiSuperDatePicker.propTypes = {
|
|
|
714
723
|
display: PropTypes.node.isRequired
|
|
715
724
|
}).isRequired]),
|
|
716
725
|
isLoading: PropTypes.bool,
|
|
726
|
+
/**
|
|
727
|
+
* @default true
|
|
728
|
+
*/
|
|
717
729
|
isPaused: PropTypes.bool,
|
|
718
730
|
/**
|
|
719
731
|
* Sets the overall width by adding sensible min and max widths.
|
|
720
732
|
* - `auto`: fits width to internal content / time string.
|
|
721
733
|
* - `restricted`: static width that fits the longest possible time string.
|
|
722
734
|
* - `full`: expands to 100% of the container.
|
|
735
|
+
* @default 'restricted'
|
|
723
736
|
*/
|
|
724
737
|
width: PropTypes.oneOf(["restricted", "full", "auto"]),
|
|
725
738
|
/**
|
|
@@ -757,17 +770,23 @@ EuiSuperDatePicker.propTypes = {
|
|
|
757
770
|
}).isRequired),
|
|
758
771
|
/**
|
|
759
772
|
* Refresh interval in milliseconds
|
|
773
|
+
* @default 1000
|
|
760
774
|
*/
|
|
761
775
|
refreshInterval: PropTypes.number,
|
|
776
|
+
/**
|
|
777
|
+
* @default 'now'
|
|
778
|
+
*/
|
|
762
779
|
start: PropTypes.oneOfType([PropTypes.oneOf(["now"]), PropTypes.string.isRequired]),
|
|
763
780
|
end: PropTypes.oneOfType([PropTypes.oneOf(["now"]), PropTypes.string.isRequired]),
|
|
764
781
|
/**
|
|
765
782
|
* Specifies the formatted used when displaying times
|
|
783
|
+
* @default 'HH:mm'
|
|
766
784
|
*/
|
|
767
785
|
timeFormat: PropTypes.string,
|
|
768
786
|
utcOffset: PropTypes.number,
|
|
769
787
|
/**
|
|
770
788
|
* Set showUpdateButton to false to immediately invoke onTimeChange for all start and end changes.
|
|
789
|
+
* @default true
|
|
771
790
|
*/
|
|
772
791
|
showUpdateButton: PropTypes.oneOfType([PropTypes.bool.isRequired, PropTypes.oneOf(["iconOnly"])]),
|
|
773
792
|
/**
|
|
@@ -122,7 +122,7 @@ EuiFacetButton.propTypes = {
|
|
|
122
122
|
* Adds a notification indicator for displaying the quantity provided
|
|
123
123
|
*/
|
|
124
124
|
quantity: PropTypes.number,
|
|
125
|
-
element: PropTypes.oneOf(["a", "button", "span"
|
|
125
|
+
element: PropTypes.oneOf(["a", "button", "span"]),
|
|
126
126
|
size: PropTypes.any,
|
|
127
127
|
/**
|
|
128
128
|
* Extends the button to 100% width
|
|
@@ -28,7 +28,7 @@ export var euiFilterGroupStyles = function euiFilterGroupStyles(euiThemeContext)
|
|
|
28
28
|
controlCompressedBorderRadius = _euiFormVariables.controlCompressedBorderRadius,
|
|
29
29
|
controlCompressedHeight = _euiFormVariables.controlCompressedHeight;
|
|
30
30
|
return {
|
|
31
|
-
euiFilterGroup: /*#__PURE__*/css("display:inline-flex;", logicalCSS('max-width', '100%'), " overflow:hidden;background-color:", backgroundColor, ";box-shadow:inset 0 0 0 ", euiTheme.border.width.thin, " ", borderColor, ";>*:not(.euiFilterButton){", euiFilterButtonDisplay(euiThemeContext), ";}.
|
|
31
|
+
euiFilterGroup: /*#__PURE__*/css("display:inline-flex;", logicalCSS('max-width', '100%'), " overflow:hidden;background-color:", backgroundColor, ";box-shadow:inset 0 0 0 ", euiTheme.border.width.thin, " ", borderColor, ";>*:not(.euiFilterButton){", euiFilterButtonDisplay(euiThemeContext), ";}.euiPopover>.euiFilterButton{", logicalCSS('width', '100%'), ";}", euiBreakpoint(euiThemeContext, ['xs', 's']), "{flex-wrap:wrap;}", euiBreakpoint(euiThemeContext, ['xs']), "{display:flex;.euiFilterButton{flex-grow:1;}};label:euiFilterGroup;"),
|
|
32
32
|
fullWidth: _ref,
|
|
33
33
|
uncompressed: /*#__PURE__*/css("border-radius:", controlBorderRadius, ";", buttonChildrenBorderRadii(controlBorderRadius), ";;label:uncompressed;"),
|
|
34
34
|
compressed: /*#__PURE__*/css("border-radius:", controlCompressedBorderRadius, ";", buttonChildrenBorderRadii(controlCompressedBorderRadius), " .euiFilterButton{", logicalCSS('height', controlCompressedHeight), ";};label:compressed;"),
|
|
@@ -101,6 +101,8 @@ EuiHeaderBreadcrumbs.propTypes = {
|
|
|
101
101
|
popoverProps: PropTypes.shape({
|
|
102
102
|
/**
|
|
103
103
|
* Class name passed to the direct parent of the button
|
|
104
|
+
*
|
|
105
|
+
* @deprecated Use `className` instead
|
|
104
106
|
*/
|
|
105
107
|
anchorClassName: PropTypes.string,
|
|
106
108
|
/**
|
|
@@ -112,6 +114,9 @@ EuiHeaderBreadcrumbs.propTypes = {
|
|
|
112
114
|
* Intended for use with inputs as anchors, e.g. EuiInputPopover
|
|
113
115
|
*/
|
|
114
116
|
attachToAnchor: PropTypes.bool,
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated Use `popoverRef` instead
|
|
119
|
+
*/
|
|
115
120
|
buttonRef: PropTypes.any,
|
|
116
121
|
/**
|
|
117
122
|
* Restrict the popover's position within this element
|
|
@@ -180,11 +185,6 @@ EuiHeaderBreadcrumbs.propTypes = {
|
|
|
180
185
|
*/
|
|
181
186
|
grow: PropTypes.bool,
|
|
182
187
|
panelRef: PropTypes.any,
|
|
183
|
-
/**
|
|
184
|
-
* Background color of the panel;
|
|
185
|
-
* Usually a lightened form of the brand colors
|
|
186
|
-
*/
|
|
187
|
-
color: PropTypes.any,
|
|
188
188
|
className: PropTypes.string,
|
|
189
189
|
"aria-label": PropTypes.string,
|
|
190
190
|
"data-test-subj": PropTypes.string,
|
|
@@ -132,6 +132,8 @@ EuiHeaderLinks.propTypes = {
|
|
|
132
132
|
popoverProps: PropTypes.shape({
|
|
133
133
|
/**
|
|
134
134
|
* Class name passed to the direct parent of the button
|
|
135
|
+
*
|
|
136
|
+
* @deprecated Use `className` instead
|
|
135
137
|
*/
|
|
136
138
|
anchorClassName: PropTypes.string,
|
|
137
139
|
/**
|
|
@@ -143,6 +145,9 @@ EuiHeaderLinks.propTypes = {
|
|
|
143
145
|
* Intended for use with inputs as anchors, e.g. EuiInputPopover
|
|
144
146
|
*/
|
|
145
147
|
attachToAnchor: PropTypes.bool,
|
|
148
|
+
/**
|
|
149
|
+
* @deprecated Use `popoverRef` instead
|
|
150
|
+
*/
|
|
146
151
|
buttonRef: PropTypes.any,
|
|
147
152
|
/**
|
|
148
153
|
* Restrict the popover's position within this element
|
|
@@ -211,11 +216,6 @@ EuiHeaderLinks.propTypes = {
|
|
|
211
216
|
*/
|
|
212
217
|
grow: PropTypes.bool,
|
|
213
218
|
panelRef: PropTypes.any,
|
|
214
|
-
/**
|
|
215
|
-
* Background color of the panel;
|
|
216
|
-
* Usually a lightened form of the brand colors
|
|
217
|
-
*/
|
|
218
|
-
color: PropTypes.any,
|
|
219
219
|
className: PropTypes.string,
|
|
220
220
|
"aria-label": PropTypes.string,
|
|
221
221
|
"data-test-subj": PropTypes.string,
|
|
@@ -313,6 +313,8 @@ EuiPageHeaderContent.propTypes = {
|
|
|
313
313
|
popoverProps: PropTypes.shape({
|
|
314
314
|
/**
|
|
315
315
|
* Class name passed to the direct parent of the button
|
|
316
|
+
*
|
|
317
|
+
* @deprecated Use `className` instead
|
|
316
318
|
*/
|
|
317
319
|
anchorClassName: PropTypes.string,
|
|
318
320
|
/**
|
|
@@ -324,6 +326,9 @@ EuiPageHeaderContent.propTypes = {
|
|
|
324
326
|
* Intended for use with inputs as anchors, e.g. EuiInputPopover
|
|
325
327
|
*/
|
|
326
328
|
attachToAnchor: PropTypes.bool,
|
|
329
|
+
/**
|
|
330
|
+
* @deprecated Use `popoverRef` instead
|
|
331
|
+
*/
|
|
327
332
|
buttonRef: PropTypes.any,
|
|
328
333
|
/**
|
|
329
334
|
* Restrict the popover's position within this element
|
|
@@ -392,11 +397,6 @@ EuiPageHeaderContent.propTypes = {
|
|
|
392
397
|
*/
|
|
393
398
|
grow: PropTypes.bool,
|
|
394
399
|
panelRef: PropTypes.any,
|
|
395
|
-
/**
|
|
396
|
-
* Background color of the panel;
|
|
397
|
-
* Usually a lightened form of the brand colors
|
|
398
|
-
*/
|
|
399
|
-
color: PropTypes.any,
|
|
400
400
|
className: PropTypes.string,
|
|
401
401
|
"aria-label": PropTypes.string,
|
|
402
402
|
"data-test-subj": PropTypes.string,
|
|
@@ -179,7 +179,7 @@ export var EuiInputPopover = function EuiInputPopover(_ref) {
|
|
|
179
179
|
css: /*#__PURE__*/css(fullWidth ? undefined : logicalCSS('max-width', form.maxWidth), ";label:EuiInputPopover;"),
|
|
180
180
|
display: display,
|
|
181
181
|
button: input,
|
|
182
|
-
|
|
182
|
+
popoverRef: inputRef,
|
|
183
183
|
panelRef: panelRef,
|
|
184
184
|
ref: popoverClassRef,
|
|
185
185
|
closePopover: closePopover,
|
|
@@ -1,5 +1,4 @@
|
|
|
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
|
-
import { css as _css } from "@emotion/react";
|
|
3
2
|
var _excluded = ["anchorClassName", "anchorPosition", "button", "buttonRef", "insert", "isOpen", "ownFocus", "children", "className", "closePopover", "panelClassName", "panelPaddingSize", "panelProps", "panelRef", "panelStyle", "popoverScreenReaderText", "popoverRef", "hasArrow", "arrowChildren", "repositionOnScroll", "repositionToCrossAxis", "hasDragDrop", "zIndex", "attachToAnchor", "display", "offset", "onPositionChange", "buffer", "aria-label", "aria-labelledby", "container", "focusTrapProps", "initialFocus", "tabIndex"];
|
|
4
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); }
|
|
5
4
|
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; }
|
|
@@ -43,6 +42,7 @@ import classNames from 'classnames';
|
|
|
43
42
|
import { focusable } from 'tabbable';
|
|
44
43
|
import { EuiFocusTrap } from '../focus_trap';
|
|
45
44
|
import { keys, getTransitionTimings, getWaitDuration, performOnFrame, htmlIdGenerator } from '../../services';
|
|
45
|
+
import { setMultipleRefs } from '../../services/hooks/useCombinedRefs';
|
|
46
46
|
import { EuiScreenReaderOnly } from '../accessibility';
|
|
47
47
|
import { EuiPortal } from '../portal';
|
|
48
48
|
import { EuiMutationObserver } from '../observer/mutation_observer';
|
|
@@ -272,9 +272,9 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
272
272
|
window.addEventListener('resize', _this.positionPopoverFluid);
|
|
273
273
|
}
|
|
274
274
|
});
|
|
275
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
275
|
+
_defineProperty(_assertThisInitialized(_this), "popoverRef", function (node) {
|
|
276
276
|
_this.button = node;
|
|
277
|
-
_this.props.
|
|
277
|
+
setMultipleRefs([_this.props.popoverRef, _this.props.buttonRef], node);
|
|
278
278
|
});
|
|
279
279
|
_this.state = {
|
|
280
280
|
prevProps: {
|
|
@@ -393,12 +393,12 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
393
393
|
var tabIndexProp = (_panelProps$tabIndex = panelProps === null || panelProps === void 0 ? void 0 : panelProps.tabIndex) !== null && _panelProps$tabIndex !== void 0 ? _panelProps$tabIndex : _tabIndexProp;
|
|
394
394
|
var styles = euiPopoverStyles();
|
|
395
395
|
var popoverStyles = [styles.euiPopover, {
|
|
396
|
-
display: display
|
|
396
|
+
display: display,
|
|
397
|
+
label: display
|
|
397
398
|
}];
|
|
398
399
|
var classes = classNames('euiPopover', {
|
|
399
400
|
'euiPopover-isOpen': this.state.isOpening
|
|
400
|
-
}, className);
|
|
401
|
-
var anchorClasses = classNames('euiPopover__anchor', anchorClassName);
|
|
401
|
+
}, className, anchorClassName);
|
|
402
402
|
var showArrow = hasArrow && !attachToAnchor;
|
|
403
403
|
var panel;
|
|
404
404
|
if (!this.state.suppressingPopover && (isOpen || this.state.isClosing)) {
|
|
@@ -488,29 +488,17 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
|
|
|
488
488
|
return ___EmotionJSX("div", _extends({
|
|
489
489
|
css: popoverStyles,
|
|
490
490
|
className: classes,
|
|
491
|
-
ref: popoverRef
|
|
492
|
-
}, rest),
|
|
493
|
-
css: /*#__PURE__*/_css({
|
|
494
|
-
display: display
|
|
495
|
-
}, ";label:render;"),
|
|
496
|
-
className: anchorClasses,
|
|
497
|
-
ref: this.buttonRef
|
|
498
|
-
}, button instanceof HTMLElement ? null : button), panel);
|
|
491
|
+
ref: this.popoverRef
|
|
492
|
+
}, rest), button instanceof HTMLElement ? null : button, panel);
|
|
499
493
|
} else {
|
|
500
494
|
return ___EmotionJSX(EuiOutsideClickDetector, {
|
|
501
495
|
onOutsideClick: this.closePopover
|
|
502
496
|
}, ___EmotionJSX("div", _extends({
|
|
503
497
|
css: popoverStyles,
|
|
504
498
|
className: classes,
|
|
505
|
-
ref: popoverRef,
|
|
499
|
+
ref: this.popoverRef,
|
|
506
500
|
onKeyDown: this.onKeyDown
|
|
507
|
-
}, rest),
|
|
508
|
-
css: /*#__PURE__*/_css({
|
|
509
|
-
display: display
|
|
510
|
-
}, ";label:render;"),
|
|
511
|
-
className: anchorClasses,
|
|
512
|
-
ref: this.buttonRef
|
|
513
|
-
}, button instanceof HTMLElement ? null : button), panel));
|
|
501
|
+
}, rest), button instanceof HTMLElement ? null : button, panel));
|
|
514
502
|
}
|
|
515
503
|
}
|
|
516
504
|
}], [{
|
|
@@ -549,6 +537,8 @@ _defineProperty(EuiPopover, "defaultProps", {
|
|
|
549
537
|
EuiPopover.propTypes = {
|
|
550
538
|
/**
|
|
551
539
|
* Class name passed to the direct parent of the button
|
|
540
|
+
*
|
|
541
|
+
* @deprecated Use `className` instead
|
|
552
542
|
*/
|
|
553
543
|
anchorClassName: PropTypes.string,
|
|
554
544
|
/**
|
|
@@ -564,6 +554,9 @@ EuiPopover.propTypes = {
|
|
|
564
554
|
* Triggering element for which to align the popover to
|
|
565
555
|
*/
|
|
566
556
|
button: PropTypes.any.isRequired,
|
|
557
|
+
/**
|
|
558
|
+
* @deprecated Use `popoverRef` instead
|
|
559
|
+
*/
|
|
567
560
|
buttonRef: PropTypes.any,
|
|
568
561
|
/**
|
|
569
562
|
* Callback to handle hiding of the popover
|
|
@@ -640,11 +633,6 @@ EuiPopover.propTypes = {
|
|
|
640
633
|
*/
|
|
641
634
|
grow: PropTypes.bool,
|
|
642
635
|
panelRef: PropTypes.any,
|
|
643
|
-
/**
|
|
644
|
-
* Background color of the panel;
|
|
645
|
-
* Usually a lightened form of the brand colors
|
|
646
|
-
*/
|
|
647
|
-
color: PropTypes.any,
|
|
648
636
|
className: PropTypes.string,
|
|
649
637
|
"aria-label": PropTypes.string,
|
|
650
638
|
"data-test-subj": PropTypes.string,
|
|
@@ -7,13 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { css } from '@emotion/react';
|
|
10
|
-
import {
|
|
10
|
+
import { logicals, logicalSizeCSS } from '../../../global_styling';
|
|
11
11
|
export var popoverArrowSize = 'm';
|
|
12
12
|
export var euiPopoverArrowStyles = function euiPopoverArrowStyles(euiThemeContext) {
|
|
13
13
|
var euiTheme = euiThemeContext.euiTheme;
|
|
14
|
-
|
|
15
|
-
// Match the background color of panels
|
|
16
|
-
var borderColor = euiBackgroundColor(euiThemeContext, 'plain');
|
|
14
|
+
var borderColor = 'var(--euiPopoverBackgroundColor)';
|
|
17
15
|
var arrowSize = euiTheme.size[popoverArrowSize];
|
|
18
16
|
return {
|
|
19
17
|
// Base
|
|
@@ -37,7 +37,8 @@ export var EuiPopoverPanel = function EuiPopoverPanel(_ref) {
|
|
|
37
37
|
var euiThemeContext = useEuiTheme();
|
|
38
38
|
var cssStyles = useMemo(function () {
|
|
39
39
|
var styles = euiPopoverPanelStyles(euiThemeContext);
|
|
40
|
-
var
|
|
40
|
+
var colorMode = euiThemeContext.colorMode.toLowerCase();
|
|
41
|
+
var sharedStyles = [styles.euiPopover__panel, styles[colorMode], isOpen && styles.isOpen];
|
|
41
42
|
if (hasDragDrop) {
|
|
42
43
|
return [].concat(sharedStyles, [styles.hasDragDrop.hasDragDrop, position && styles.hasDragDrop[position]]);
|
|
43
44
|
}
|
|
@@ -72,11 +73,6 @@ EuiPopoverPanel.propTypes = {
|
|
|
72
73
|
*/
|
|
73
74
|
grow: PropTypes.bool,
|
|
74
75
|
panelRef: PropTypes.any,
|
|
75
|
-
/**
|
|
76
|
-
* Background color of the panel;
|
|
77
|
-
* Usually a lightened form of the brand colors
|
|
78
|
-
*/
|
|
79
|
-
color: PropTypes.any,
|
|
80
76
|
className: PropTypes.string,
|
|
81
77
|
"aria-label": PropTypes.string,
|
|
82
78
|
"data-test-subj": PropTypes.string,
|
|
@@ -10,6 +10,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { euiShadow, euiShadowFlat, euiShadowMedium } from '../../../themes/amsterdam/global_styling/mixins';
|
|
12
12
|
import { getShadowColor } from '../../../themes/amsterdam/global_styling/functions';
|
|
13
|
+
import { tint } from '../../../services';
|
|
13
14
|
import { euiCanAnimate, logicalCSS, mathWithUnits } from '../../../global_styling';
|
|
14
15
|
export var openAnimationTiming = 'slow';
|
|
15
16
|
|
|
@@ -17,6 +18,7 @@ export var openAnimationTiming = 'slow';
|
|
|
17
18
|
* 1. Can expand further, but it looks weird if it's smaller than the originating button.
|
|
18
19
|
* 2. Animation happens on the panel. But don't animate position when using the attached mode like for inputs
|
|
19
20
|
* 3. Make sure the panel stays within the window.
|
|
21
|
+
* 4. Make the popover lighter on dark mode (too hard to distinguish from plain bgs otherwise), and set a CSS var for the arrow to use
|
|
20
22
|
*/
|
|
21
23
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
22
24
|
name: "j5y6yx-isOpen",
|
|
@@ -37,8 +39,11 @@ export var euiPopoverPanelStyles = function euiPopoverPanelStyles(euiThemeContex
|
|
|
37
39
|
}));
|
|
38
40
|
return {
|
|
39
41
|
// Base
|
|
40
|
-
euiPopover__panel: /*#__PURE__*/css("position:absolute;", logicalCSS('min-width', "".concat(euiTheme.base * 7, "px")), logicalCSS('max-width', "calc(100vw - ".concat(euiTheme.size.xl, ")")), "backface-visibility:hidden;pointer-events:none;opacity:0;", euiCanAnimate, "{transition:", opacityTransition, ",", transformTransition, ";}&:focus{outline-offset:0;};label:euiPopover__panel;"),
|
|
42
|
+
euiPopover__panel: /*#__PURE__*/css("position:absolute;", logicalCSS('min-width', "".concat(euiTheme.base * 7, "px")), logicalCSS('max-width', "calc(100vw - ".concat(euiTheme.size.xl, ")")), "backface-visibility:hidden;pointer-events:none;opacity:0;background-color:var(--euiPopoverBackgroundColor);", euiCanAnimate, "{transition:", opacityTransition, ",", transformTransition, ";}&:focus{outline-offset:0;};label:euiPopover__panel;"),
|
|
41
43
|
isOpen: _ref,
|
|
44
|
+
/* 4 */
|
|
45
|
+
light: /*#__PURE__*/css("--euiPopoverBackgroundColor:", euiTheme.colors.emptyShade, ";;label:light;"),
|
|
46
|
+
dark: /*#__PURE__*/css("--euiPopoverBackgroundColor:", tint(euiTheme.colors.emptyShade, 0.025), ";;label:dark;"),
|
|
42
47
|
// Regular popover with an arrow, a transform animation/transition, and a
|
|
43
48
|
// drop shadow via `filter` (which automatically handles the arrow)
|
|
44
49
|
hasTransform: {
|