@elastic/eui 110.0.0 → 111.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/es/components/collapsible_nav/collapsible_nav.js +20 -101
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +1 -0
- package/es/components/flyout/_flyout_overlay.js +52 -0
- package/es/components/flyout/_flyout_resize_button.js +32 -0
- package/es/components/flyout/{flyout_resizable.styles.js → _flyout_resize_button.styles.js} +11 -11
- package/es/components/flyout/const.js +42 -0
- package/es/components/flyout/flyout.component.js +481 -0
- package/es/components/flyout/flyout.js +77 -379
- package/es/components/flyout/flyout.styles.js +105 -7
- package/es/components/flyout/flyout_menu.js +241 -0
- package/es/components/flyout/flyout_menu.styles.js +19 -0
- package/{optimize/es/components/flyout/flyout_context.js → es/components/flyout/flyout_menu_context.js} +1 -7
- package/es/components/flyout/flyout_parent_context.js +36 -0
- package/es/components/flyout/flyout_resizable.js +33 -144
- package/es/components/flyout/hooks.js +25 -0
- package/es/components/flyout/index.js +5 -2
- package/es/components/flyout/manager/actions.js +153 -0
- package/es/components/flyout/manager/activity_stage.js +95 -0
- package/es/components/flyout/manager/const.js +56 -0
- package/es/components/flyout/manager/context.js +33 -0
- package/es/components/flyout/manager/flyout_child.js +75 -0
- package/es/components/flyout/manager/flyout_main.js +65 -0
- package/es/components/flyout/manager/flyout_main.styles.js +25 -0
- package/es/components/flyout/manager/flyout_managed.js +227 -0
- package/es/components/flyout/manager/flyout_managed.styles.js +69 -0
- package/es/components/flyout/manager/hooks.js +55 -0
- package/es/components/flyout/manager/index.js +31 -0
- package/es/components/flyout/manager/layout_mode.js +167 -0
- package/es/components/flyout/manager/provider.js +57 -0
- package/es/components/flyout/manager/reducer.js +320 -0
- package/es/components/flyout/manager/selectors.js +116 -0
- package/es/components/flyout/manager/store.js +113 -0
- package/es/components/flyout/manager/validation.js +85 -0
- package/es/components/flyout/use_flyout_resizable.js +149 -0
- package/es/components/flyout/use_flyout_z_index.js +46 -0
- package/es/components/overlay_mask/overlay_mask.js +13 -3
- package/es/components/overlay_mask/overlay_mask.styles.js +11 -2
- package/es/components/provider/provider.js +2 -1
- package/eui.d.ts +1484 -921
- package/i18ntokens.json +1207 -1153
- package/lib/components/collapsible_nav/collapsible_nav.js +20 -101
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +1 -0
- package/lib/components/flyout/_flyout_overlay.js +59 -0
- package/lib/components/flyout/_flyout_resize_button.js +38 -0
- package/{test-env/components/flyout/flyout_resizable.styles.js → lib/components/flyout/_flyout_resize_button.styles.js} +12 -12
- package/lib/components/flyout/const.js +49 -0
- package/lib/components/flyout/flyout.component.js +488 -0
- package/lib/components/flyout/flyout.js +102 -379
- package/lib/components/flyout/flyout.styles.js +105 -7
- package/lib/components/flyout/flyout_menu.js +243 -0
- package/lib/components/flyout/flyout_menu.styles.js +25 -0
- package/{optimize/lib/components/flyout/flyout_context.js → lib/components/flyout/flyout_menu_context.js} +2 -7
- package/lib/components/flyout/flyout_parent_context.js +43 -0
- package/lib/components/flyout/flyout_resizable.js +36 -147
- package/lib/components/flyout/hooks.js +30 -0
- package/lib/components/flyout/index.js +21 -14
- package/lib/components/flyout/manager/actions.js +159 -0
- package/lib/components/flyout/manager/activity_stage.js +101 -0
- package/lib/components/flyout/manager/const.js +62 -0
- package/lib/components/flyout/manager/context.js +41 -0
- package/lib/components/flyout/manager/flyout_child.js +80 -0
- package/lib/components/flyout/manager/flyout_main.js +70 -0
- package/lib/components/flyout/manager/flyout_main.styles.js +31 -0
- package/lib/components/flyout/manager/flyout_managed.js +233 -0
- package/lib/components/flyout/manager/flyout_managed.styles.js +73 -0
- package/lib/components/flyout/manager/hooks.js +131 -0
- package/lib/components/flyout/manager/index.js +168 -0
- package/lib/components/flyout/manager/layout_mode.js +171 -0
- package/lib/components/flyout/manager/provider.js +63 -0
- package/lib/components/flyout/manager/reducer.js +325 -0
- package/lib/components/flyout/manager/selectors.js +122 -0
- package/lib/components/flyout/manager/store.js +120 -0
- package/lib/components/flyout/manager/validation.js +94 -0
- package/lib/components/flyout/use_flyout_resizable.js +153 -0
- package/lib/components/flyout/use_flyout_z_index.js +51 -0
- package/lib/components/overlay_mask/overlay_mask.js +12 -2
- package/lib/components/overlay_mask/overlay_mask.styles.js +11 -4
- package/lib/components/provider/provider.js +2 -1
- package/optimize/es/components/collapsible_nav/collapsible_nav.js +1 -0
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +1 -0
- package/optimize/es/components/flyout/_flyout_overlay.js +52 -0
- package/optimize/es/components/flyout/_flyout_resize_button.js +31 -0
- package/optimize/es/components/flyout/{flyout_resizable.styles.js → _flyout_resize_button.styles.js} +11 -11
- package/optimize/es/components/flyout/const.js +42 -0
- package/optimize/es/components/flyout/flyout.component.js +469 -0
- package/optimize/es/components/flyout/flyout.js +53 -349
- package/optimize/es/components/flyout/flyout.styles.js +102 -7
- package/optimize/es/components/flyout/flyout_menu.js +162 -0
- package/optimize/es/components/flyout/flyout_menu.styles.js +19 -0
- package/{es/components/flyout/flyout_context.js → optimize/es/components/flyout/flyout_menu_context.js} +1 -7
- package/optimize/es/components/flyout/flyout_parent_context.js +36 -0
- package/optimize/es/components/flyout/flyout_resizable.js +7 -138
- package/optimize/es/components/flyout/hooks.js +25 -0
- package/optimize/es/components/flyout/index.js +5 -2
- package/optimize/es/components/flyout/manager/actions.js +153 -0
- package/optimize/es/components/flyout/manager/activity_stage.js +95 -0
- package/optimize/es/components/flyout/manager/const.js +56 -0
- package/optimize/es/components/flyout/manager/context.js +33 -0
- package/optimize/es/components/flyout/manager/flyout_child.js +71 -0
- package/optimize/es/components/flyout/manager/flyout_main.js +61 -0
- package/optimize/es/components/flyout/manager/flyout_main.styles.js +25 -0
- package/optimize/es/components/flyout/manager/flyout_managed.js +223 -0
- package/optimize/es/components/flyout/manager/flyout_managed.styles.js +69 -0
- package/optimize/es/components/flyout/manager/hooks.js +55 -0
- package/optimize/es/components/flyout/manager/index.js +31 -0
- package/optimize/es/components/flyout/manager/layout_mode.js +162 -0
- package/optimize/es/components/flyout/manager/provider.js +53 -0
- package/optimize/es/components/flyout/manager/reducer.js +312 -0
- package/optimize/es/components/flyout/manager/selectors.js +116 -0
- package/optimize/es/components/flyout/manager/store.js +113 -0
- package/optimize/es/components/flyout/manager/types.js +1 -0
- package/optimize/es/components/flyout/manager/validation.js +85 -0
- package/optimize/es/components/flyout/types.js +1 -0
- package/optimize/es/components/flyout/use_flyout_resizable.js +144 -0
- package/optimize/es/components/flyout/use_flyout_z_index.js +46 -0
- package/optimize/es/components/overlay_mask/overlay_mask.js +13 -3
- package/optimize/es/components/overlay_mask/overlay_mask.styles.js +11 -2
- package/optimize/es/components/provider/provider.js +2 -1
- package/optimize/lib/components/collapsible_nav/collapsible_nav.js +1 -0
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +1 -0
- package/optimize/lib/components/flyout/_flyout_overlay.js +62 -0
- package/optimize/lib/components/flyout/_flyout_resize_button.js +37 -0
- package/{lib/components/flyout/flyout_resizable.styles.js → optimize/lib/components/flyout/_flyout_resize_button.styles.js} +12 -12
- package/optimize/lib/components/flyout/const.js +49 -0
- package/optimize/lib/components/flyout/flyout.component.js +477 -0
- package/optimize/lib/components/flyout/flyout.js +77 -349
- package/optimize/lib/components/flyout/flyout.styles.js +102 -7
- package/optimize/lib/components/flyout/flyout_menu.js +168 -0
- package/optimize/lib/components/flyout/flyout_menu.styles.js +25 -0
- package/{lib/components/flyout/flyout_context.js → optimize/lib/components/flyout/flyout_menu_context.js} +2 -7
- package/optimize/lib/components/flyout/flyout_parent_context.js +43 -0
- package/optimize/lib/components/flyout/flyout_resizable.js +9 -139
- package/optimize/lib/components/flyout/hooks.js +30 -0
- package/optimize/lib/components/flyout/index.js +21 -14
- package/optimize/lib/components/flyout/manager/actions.js +159 -0
- package/optimize/lib/components/flyout/manager/activity_stage.js +101 -0
- package/optimize/lib/components/flyout/manager/const.js +62 -0
- package/optimize/lib/components/flyout/manager/context.js +41 -0
- package/optimize/lib/components/flyout/manager/flyout_child.js +76 -0
- package/optimize/lib/components/flyout/manager/flyout_main.js +66 -0
- package/optimize/lib/components/flyout/manager/flyout_main.styles.js +31 -0
- package/optimize/lib/components/flyout/manager/flyout_managed.js +231 -0
- package/optimize/lib/components/flyout/manager/flyout_managed.styles.js +74 -0
- package/optimize/lib/components/flyout/manager/hooks.js +131 -0
- package/optimize/lib/components/flyout/manager/index.js +168 -0
- package/optimize/lib/components/flyout/manager/layout_mode.js +169 -0
- package/optimize/lib/components/flyout/manager/provider.js +61 -0
- package/optimize/lib/components/flyout/manager/reducer.js +318 -0
- package/optimize/lib/components/flyout/manager/selectors.js +122 -0
- package/optimize/lib/components/flyout/manager/store.js +120 -0
- package/optimize/lib/components/flyout/manager/validation.js +94 -0
- package/optimize/lib/components/flyout/types.js +5 -0
- package/optimize/lib/components/flyout/use_flyout_resizable.js +151 -0
- package/optimize/lib/components/flyout/use_flyout_z_index.js +51 -0
- package/optimize/lib/components/overlay_mask/overlay_mask.js +12 -2
- package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +11 -4
- package/optimize/lib/components/provider/provider.js +2 -1
- package/package.json +5 -4
- package/test-env/components/collapsible_nav/collapsible_nav.js +20 -101
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +1 -0
- package/test-env/components/flyout/_flyout_overlay.js +62 -0
- package/test-env/components/flyout/_flyout_resize_button.js +37 -0
- package/{optimize/lib/components/flyout/flyout_resizable.styles.js → test-env/components/flyout/_flyout_resize_button.styles.js} +12 -12
- package/test-env/components/flyout/const.js +49 -0
- package/test-env/components/flyout/flyout.component.js +477 -0
- package/test-env/components/flyout/flyout.styles.js +102 -7
- package/test-env/components/flyout/flyout_menu.js +241 -0
- package/test-env/components/flyout/flyout_menu.styles.js +25 -0
- package/test-env/components/flyout/{flyout_context.js → flyout_menu_context.js} +2 -7
- package/test-env/components/flyout/flyout_parent_context.js +43 -0
- package/test-env/components/flyout/flyout_resizable.js +35 -139
- package/test-env/components/flyout/hooks.js +30 -0
- package/test-env/components/flyout/index.js +21 -14
- package/test-env/components/flyout/manager/actions.js +159 -0
- package/test-env/components/flyout/manager/activity_stage.js +101 -0
- package/test-env/components/flyout/manager/const.js +62 -0
- package/test-env/components/flyout/manager/context.js +41 -0
- package/test-env/components/flyout/manager/flyout_child.js +76 -0
- package/test-env/components/flyout/manager/flyout_main.js +66 -0
- package/test-env/components/flyout/manager/flyout_main.styles.js +31 -0
- package/test-env/components/flyout/manager/flyout_managed.js +231 -0
- package/test-env/components/flyout/manager/flyout_managed.styles.js +74 -0
- package/test-env/components/flyout/manager/hooks.js +131 -0
- package/test-env/components/flyout/manager/index.js +168 -0
- package/test-env/components/flyout/manager/layout_mode.js +169 -0
- package/test-env/components/flyout/manager/provider.js +61 -0
- package/test-env/components/flyout/manager/reducer.js +318 -0
- package/test-env/components/flyout/manager/selectors.js +122 -0
- package/test-env/components/flyout/manager/store.js +120 -0
- package/test-env/components/flyout/manager/types.js +5 -0
- package/test-env/components/flyout/manager/validation.js +94 -0
- package/test-env/components/flyout/types.js +5 -0
- package/test-env/components/flyout/use_flyout_resizable.js +151 -0
- package/test-env/components/flyout/use_flyout_z_index.js +51 -0
- package/test-env/components/overlay_mask/overlay_mask.js +12 -2
- package/test-env/components/overlay_mask/overlay_mask.styles.js +11 -4
- package/test-env/components/provider/provider.js +2 -1
- package/es/components/flyout/flyout_child.js +0 -223
- package/es/components/flyout/flyout_child.styles.js +0 -32
- package/es/components/flyout/flyout_child_manager.js +0 -114
- package/es/components/flyout/sessions/flyout_provider.js +0 -95
- package/es/components/flyout/sessions/flyout_reducer.js +0 -195
- package/es/components/flyout/sessions/index.js +0 -10
- package/es/components/flyout/sessions/use_eui_flyout.js +0 -82
- package/lib/components/flyout/flyout_child.js +0 -231
- package/lib/components/flyout/flyout_child.styles.js +0 -38
- package/lib/components/flyout/flyout_child_manager.js +0 -122
- package/lib/components/flyout/sessions/flyout_provider.js +0 -102
- package/lib/components/flyout/sessions/flyout_reducer.js +0 -202
- package/lib/components/flyout/sessions/index.js +0 -25
- package/lib/components/flyout/sessions/use_eui_flyout.js +0 -88
- package/optimize/es/components/flyout/flyout_child.js +0 -178
- package/optimize/es/components/flyout/flyout_child.styles.js +0 -32
- package/optimize/es/components/flyout/flyout_child_manager.js +0 -100
- package/optimize/es/components/flyout/sessions/flyout_provider.js +0 -90
- package/optimize/es/components/flyout/sessions/flyout_reducer.js +0 -187
- package/optimize/es/components/flyout/sessions/index.js +0 -10
- package/optimize/es/components/flyout/sessions/use_eui_flyout.js +0 -82
- package/optimize/lib/components/flyout/flyout_child.js +0 -186
- package/optimize/lib/components/flyout/flyout_child.styles.js +0 -38
- package/optimize/lib/components/flyout/flyout_child_manager.js +0 -110
- package/optimize/lib/components/flyout/sessions/flyout_provider.js +0 -100
- package/optimize/lib/components/flyout/sessions/flyout_reducer.js +0 -195
- package/optimize/lib/components/flyout/sessions/index.js +0 -25
- package/optimize/lib/components/flyout/sessions/use_eui_flyout.js +0 -88
- package/test-env/components/flyout/flyout_child.js +0 -230
- package/test-env/components/flyout/flyout_child.styles.js +0 -38
- package/test-env/components/flyout/flyout_child_manager.js +0 -119
- package/test-env/components/flyout/sessions/flyout_provider.js +0 -100
- package/test-env/components/flyout/sessions/flyout_reducer.js +0 -195
- package/test-env/components/flyout/sessions/index.js +0 -25
- package/test-env/components/flyout/sessions/use_eui_flyout.js +0 -88
- /package/es/components/flyout/{sessions → manager}/types.js +0 -0
- /package/{optimize/es/components/flyout/sessions → es/components/flyout}/types.js +0 -0
- /package/lib/components/flyout/{sessions → manager}/types.js +0 -0
- /package/{optimize/lib/components/flyout/sessions → lib/components/flyout}/types.js +0 -0
- /package/{test-env/components/flyout/sessions → optimize/lib/components/flyout/manager}/types.js +0 -0
|
@@ -6,162 +6,51 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.EuiFlyoutResizable = void 0;
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var
|
|
10
|
-
var _resizable_container = require("../resizable_container");
|
|
11
|
-
var _helpers = require("../resizable_container/helpers");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
10
|
var _flyout = require("./flyout");
|
|
13
|
-
var _flyout_resizable = require("./flyout_resizable.styles");
|
|
14
11
|
var _react2 = require("@emotion/react");
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } /*
|
|
17
16
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
18
17
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
19
18
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
20
19
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
21
20
|
* Side Public License, v 1.
|
|
22
21
|
*/
|
|
23
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
24
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
26
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
27
|
-
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."); }
|
|
28
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
29
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
30
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
31
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
32
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
33
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
|
|
34
22
|
// If not omitted, the correct props don't show up in the docs prop table
|
|
35
23
|
|
|
36
|
-
var EuiFlyoutResizable = exports.EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
_ref$side = _ref.side,
|
|
43
|
-
side = _ref$side === void 0 ? 'right' : _ref$side,
|
|
44
|
-
_ref$type = _ref.type,
|
|
45
|
-
type = _ref$type === void 0 ? 'overlay' : _ref$type,
|
|
46
|
-
_ref$ownFocus = _ref.ownFocus,
|
|
47
|
-
ownFocus = _ref$ownFocus === void 0 ? true : _ref$ownFocus,
|
|
48
|
-
children = _ref.children,
|
|
49
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
-
var hasOverlay = type === 'overlay' && ownFocus;
|
|
51
|
-
var styles = (0, _services.useEuiMemoizedStyles)(_flyout_resizable.euiFlyoutResizableButtonStyles);
|
|
52
|
-
var cssStyles = [styles.euiFlyoutResizableButton, styles[type][side], !hasOverlay && styles.noOverlay.noOverlay, !hasOverlay && styles.noOverlay[side]];
|
|
53
|
-
var getFlyoutMinMaxWidth = (0, _react.useCallback)(function (width) {
|
|
54
|
-
return Math.min(Math.max(width, minWidth), maxWidth || Infinity, window.innerWidth - 20 // Leave some offset
|
|
55
|
-
);
|
|
56
|
-
}, [minWidth, maxWidth]);
|
|
57
|
-
var _useState = (0, _react.useState)(0),
|
|
58
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
59
|
-
flyoutWidth = _useState2[0],
|
|
60
|
-
setFlyoutWidth = _useState2[1];
|
|
61
|
-
var _useState3 = (0, _react.useState)(false),
|
|
62
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
63
|
-
callOnResize = _useState4[0],
|
|
64
|
-
setCallOnResize = _useState4[1];
|
|
65
|
-
|
|
66
|
-
// Must use state for the flyout ref in order for the useEffect to be correctly called after render
|
|
67
|
-
var _useState5 = (0, _react.useState)(null),
|
|
68
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
69
|
-
flyoutRef = _useState6[0],
|
|
70
|
-
setFlyoutRef = _useState6[1];
|
|
71
|
-
var setRefs = (0, _services.useCombinedRefs)([setFlyoutRef, ref]);
|
|
72
|
-
(0, _react.useEffect)(function () {
|
|
73
|
-
if (!flyoutWidth && flyoutRef) {
|
|
74
|
-
setCallOnResize(false); // Don't call `onResize` for non-user width changes
|
|
75
|
-
setFlyoutWidth(getFlyoutMinMaxWidth(flyoutRef.offsetWidth));
|
|
76
|
-
}
|
|
77
|
-
}, [flyoutWidth, flyoutRef, getFlyoutMinMaxWidth]);
|
|
78
|
-
|
|
79
|
-
// Update flyout width when consumers pass in a new `size`
|
|
80
|
-
(0, _react.useEffect)(function () {
|
|
81
|
-
setCallOnResize(false);
|
|
82
|
-
// For string `size`s, resetting flyoutWidth to 0 will trigger the above useEffect's recalculation
|
|
83
|
-
setFlyoutWidth(typeof size === 'number' ? getFlyoutMinMaxWidth(size) : 0);
|
|
84
|
-
}, [size, getFlyoutMinMaxWidth]);
|
|
85
|
-
|
|
86
|
-
// Initial numbers to calculate from, on resize drag start
|
|
87
|
-
var initialWidth = (0, _react.useRef)(0);
|
|
88
|
-
var initialMouseX = (0, _react.useRef)(0);
|
|
89
|
-
|
|
90
|
-
// Account for flyout side and logical property direction
|
|
91
|
-
var direction = (0, _react.useMemo)(function () {
|
|
92
|
-
var modifier = side === 'right' ? -1 : 1;
|
|
93
|
-
if (flyoutRef) {
|
|
94
|
-
var languageDirection = window.getComputedStyle(flyoutRef).direction;
|
|
95
|
-
if (languageDirection === 'rtl') modifier *= -1;
|
|
96
|
-
}
|
|
97
|
-
return modifier;
|
|
98
|
-
}, [side, flyoutRef]);
|
|
99
|
-
var onMouseMove = (0, _react.useCallback)(function (e) {
|
|
100
|
-
var mouseOffset = (0, _helpers.getPosition)(e, true) - initialMouseX.current;
|
|
101
|
-
var changedFlyoutWidth = initialWidth.current + mouseOffset * direction;
|
|
102
|
-
setFlyoutWidth(getFlyoutMinMaxWidth(changedFlyoutWidth));
|
|
103
|
-
}, [getFlyoutMinMaxWidth, direction]);
|
|
104
|
-
var onMouseUp = (0, _react.useCallback)(function () {
|
|
105
|
-
setCallOnResize(true);
|
|
106
|
-
initialMouseX.current = 0;
|
|
107
|
-
window.removeEventListener('mousemove', onMouseMove);
|
|
108
|
-
window.removeEventListener('mouseup', onMouseUp);
|
|
109
|
-
window.removeEventListener('touchmove', onMouseMove);
|
|
110
|
-
window.removeEventListener('touchend', onMouseUp);
|
|
111
|
-
}, [onMouseMove]);
|
|
112
|
-
var onMouseDown = (0, _react.useCallback)(function (e) {
|
|
113
|
-
var _flyoutRef$offsetWidt;
|
|
114
|
-
setCallOnResize(false);
|
|
115
|
-
initialMouseX.current = (0, _helpers.getPosition)(e, true);
|
|
116
|
-
initialWidth.current = (_flyoutRef$offsetWidt = flyoutRef === null || flyoutRef === void 0 ? void 0 : flyoutRef.offsetWidth) !== null && _flyoutRef$offsetWidt !== void 0 ? _flyoutRef$offsetWidt : 0;
|
|
117
|
-
|
|
118
|
-
// Window event listeners instead of React events are used
|
|
119
|
-
// in case the user's mouse leaves the component
|
|
120
|
-
window.addEventListener('mousemove', onMouseMove);
|
|
121
|
-
window.addEventListener('mouseup', onMouseUp);
|
|
122
|
-
window.addEventListener('touchmove', onMouseMove);
|
|
123
|
-
window.addEventListener('touchend', onMouseUp);
|
|
124
|
-
}, [flyoutRef, onMouseMove, onMouseUp]);
|
|
125
|
-
var onKeyDown = (0, _react.useCallback)(function (e) {
|
|
126
|
-
setCallOnResize(true);
|
|
127
|
-
var KEYBOARD_OFFSET = 10;
|
|
128
|
-
switch (e.key) {
|
|
129
|
-
case _services.keys.ARROW_RIGHT:
|
|
130
|
-
e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
|
|
131
|
-
setFlyoutWidth(function (flyoutWidth) {
|
|
132
|
-
return getFlyoutMinMaxWidth(flyoutWidth + KEYBOARD_OFFSET * direction);
|
|
133
|
-
});
|
|
134
|
-
break;
|
|
135
|
-
case _services.keys.ARROW_LEFT:
|
|
136
|
-
e.preventDefault(); // Safari+VO will screen reader navigate off the button otherwise
|
|
137
|
-
setFlyoutWidth(function (flyoutWidth) {
|
|
138
|
-
return getFlyoutMinMaxWidth(flyoutWidth - KEYBOARD_OFFSET * direction);
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
}, [getFlyoutMinMaxWidth, direction]);
|
|
142
|
-
|
|
143
|
-
// To reduce unnecessary calls, only fire onResize callback:
|
|
144
|
-
// 1. After initial mount / on user width change events only
|
|
145
|
-
// 2. If not currently mouse dragging
|
|
146
|
-
(0, _react.useEffect)(function () {
|
|
147
|
-
if (callOnResize) {
|
|
148
|
-
onResize === null || onResize === void 0 || onResize(flyoutWidth);
|
|
149
|
-
}
|
|
150
|
-
}, [onResize, callOnResize, flyoutWidth]);
|
|
151
|
-
return (0, _react2.jsx)(_flyout.EuiFlyout, _extends({}, rest, {
|
|
152
|
-
size: flyoutWidth || size,
|
|
153
|
-
maxWidth: maxWidth,
|
|
154
|
-
side: side,
|
|
155
|
-
type: type,
|
|
156
|
-
ownFocus: ownFocus,
|
|
157
|
-
ref: setRefs
|
|
158
|
-
}), (0, _react2.jsx)(_resizable_container.EuiResizableButton, {
|
|
159
|
-
isHorizontal: true,
|
|
160
|
-
indicator: "border",
|
|
161
|
-
css: cssStyles,
|
|
162
|
-
onMouseDown: onMouseDown,
|
|
163
|
-
onTouchStart: onMouseDown,
|
|
164
|
-
onKeyDown: onKeyDown
|
|
165
|
-
}), children);
|
|
24
|
+
var EuiFlyoutResizable = exports.EuiFlyoutResizable = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
25
|
+
return (0, _react2.jsx)(_flyout.EuiFlyout, _extends({
|
|
26
|
+
ref: ref
|
|
27
|
+
}, props, {
|
|
28
|
+
resizable: true
|
|
29
|
+
}));
|
|
166
30
|
});
|
|
31
|
+
EuiFlyoutResizable.propTypes = {
|
|
32
|
+
maxWidth: _propTypes.default.number,
|
|
33
|
+
/**
|
|
34
|
+
* Controls the way the session is managed for this flyout.
|
|
35
|
+
* - `start`: Creates a new flyout session. Use this for the main flyout.
|
|
36
|
+
* - `inherit`: Inherits an existing session if one is active, otherwise functions as a standard flyout.
|
|
37
|
+
* - `never`: Disregards session management and always functions as a standard flyout.
|
|
38
|
+
*
|
|
39
|
+
* When the `session` prop is undefined (not set), the flyout will automatically inherit from
|
|
40
|
+
* a parent flyout if it's nested inside one. Otherwise, it defaults to `never`.
|
|
41
|
+
*
|
|
42
|
+
* Check out [EuiFlyout session management](https://eui.elastic.co/docs/components/containers/flyout/session-management)
|
|
43
|
+
* documentation to learn more.
|
|
44
|
+
* @default undefined (auto-inherit when nested, otherwise 'never')
|
|
45
|
+
*/
|
|
46
|
+
session: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.any.isRequired, _propTypes.default.any.isRequired]),
|
|
47
|
+
/**
|
|
48
|
+
* Callback fired when the flyout becomes active/visible, which may happen programmatically from history navigation.
|
|
49
|
+
*/
|
|
50
|
+
onActive: _propTypes.default.func,
|
|
51
|
+
/**
|
|
52
|
+
* The HTML element to render as the flyout container.
|
|
53
|
+
*/
|
|
54
|
+
as: _propTypes.default.any
|
|
55
|
+
};
|
|
167
56
|
EuiFlyoutResizable.displayName = 'EuiFlyoutResizable';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useIsPushed = void 0;
|
|
7
|
+
var _services = require("../../services");
|
|
8
|
+
var _component_defaults = require("../provider/component_defaults");
|
|
9
|
+
var _const = require("./const");
|
|
10
|
+
/*
|
|
11
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
13
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
14
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
15
|
+
* Side Public License, v 1.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Determines if a flyout should be rendered in a "pushed" state based on its
|
|
20
|
+
* configuration and the current window size.
|
|
21
|
+
*/
|
|
22
|
+
var useIsPushed = exports.useIsPushed = function useIsPushed(props) {
|
|
23
|
+
var _usePropsWithComponen = (0, _component_defaults.usePropsWithComponentDefaults)('EuiFlyout', props),
|
|
24
|
+
_usePropsWithComponen2 = _usePropsWithComponen.type,
|
|
25
|
+
type = _usePropsWithComponen2 === void 0 ? _const.DEFAULT_TYPE : _usePropsWithComponen2,
|
|
26
|
+
_usePropsWithComponen3 = _usePropsWithComponen.pushMinBreakpoint,
|
|
27
|
+
pushMinBreakpoint = _usePropsWithComponen3 === void 0 ? _const.DEFAULT_PUSH_MIN_BREAKPOINT : _usePropsWithComponen3;
|
|
28
|
+
var windowIsLargeEnoughToPush = (0, _services.useIsWithinMinBreakpoint)(pushMinBreakpoint);
|
|
29
|
+
return type === 'push' && windowIsLargeEnoughToPush;
|
|
30
|
+
};
|
|
@@ -15,12 +15,6 @@ Object.defineProperty(exports, "EuiFlyoutBody", {
|
|
|
15
15
|
return _flyout_body.EuiFlyoutBody;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(exports, "EuiFlyoutChild", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _flyout_child.EuiFlyoutChild;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
18
|
Object.defineProperty(exports, "EuiFlyoutFooter", {
|
|
25
19
|
enumerable: true,
|
|
26
20
|
get: function get() {
|
|
@@ -33,16 +27,16 @@ Object.defineProperty(exports, "EuiFlyoutHeader", {
|
|
|
33
27
|
return _flyout_header.EuiFlyoutHeader;
|
|
34
28
|
}
|
|
35
29
|
});
|
|
36
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "EuiFlyoutMenu", {
|
|
37
31
|
enumerable: true,
|
|
38
32
|
get: function get() {
|
|
39
|
-
return
|
|
33
|
+
return _flyout_menu.EuiFlyoutMenu;
|
|
40
34
|
}
|
|
41
35
|
});
|
|
42
|
-
Object.defineProperty(exports, "
|
|
36
|
+
Object.defineProperty(exports, "EuiFlyoutResizable", {
|
|
43
37
|
enumerable: true,
|
|
44
38
|
get: function get() {
|
|
45
|
-
return
|
|
39
|
+
return _flyout_resizable.EuiFlyoutResizable;
|
|
46
40
|
}
|
|
47
41
|
});
|
|
48
42
|
Object.defineProperty(exports, "euiFlyoutSlideInLeft", {
|
|
@@ -57,10 +51,22 @@ Object.defineProperty(exports, "euiFlyoutSlideInRight", {
|
|
|
57
51
|
return _flyout2.euiFlyoutSlideInRight;
|
|
58
52
|
}
|
|
59
53
|
});
|
|
60
|
-
Object.defineProperty(exports, "
|
|
54
|
+
Object.defineProperty(exports, "useHasActiveSession", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _manager.useHasActiveSession;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "useIsInManagedFlyout", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _manager.useIsInManagedFlyout;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "useIsInsideParentFlyout", {
|
|
61
67
|
enumerable: true,
|
|
62
68
|
get: function get() {
|
|
63
|
-
return
|
|
69
|
+
return _flyout_parent_context.useIsInsideParentFlyout;
|
|
64
70
|
}
|
|
65
71
|
});
|
|
66
72
|
var _flyout = require("./flyout");
|
|
@@ -69,5 +75,6 @@ var _flyout_footer = require("./flyout_footer");
|
|
|
69
75
|
var _flyout_header = require("./flyout_header");
|
|
70
76
|
var _flyout2 = require("./flyout.styles");
|
|
71
77
|
var _flyout_resizable = require("./flyout_resizable");
|
|
72
|
-
var
|
|
73
|
-
var
|
|
78
|
+
var _flyout_menu = require("./flyout_menu");
|
|
79
|
+
var _manager = require("./manager");
|
|
80
|
+
var _flyout_parent_context = require("./flyout_parent_context");
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setPushPadding = exports.setLayoutMode = exports.setFlyoutWidth = exports.setActivityStage = exports.setActiveFlyout = exports.goToFlyout = exports.goBack = exports.closeUnmanagedFlyout = exports.closeFlyout = exports.addUnmanagedFlyout = exports.addFlyout = exports.ACTION_SET_WIDTH = exports.ACTION_SET_PUSH_PADDING = exports.ACTION_SET_LAYOUT_MODE = exports.ACTION_SET_ACTIVITY_STAGE = exports.ACTION_SET_ACTIVE = exports.ACTION_GO_TO_FLYOUT = exports.ACTION_GO_BACK = exports.ACTION_CLOSE_UNMANAGED_FLYOUT = exports.ACTION_CLOSE = exports.ACTION_ADD_UNMANAGED_FLYOUT = exports.ACTION_ADD = void 0;
|
|
7
|
+
var _const = require("./const");
|
|
8
|
+
/*
|
|
9
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
10
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
11
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
12
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
13
|
+
* Side Public License, v 1.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var PREFIX = 'eui/flyoutManager';
|
|
17
|
+
/** Dispatched when a flyout registers itself with the manager. */
|
|
18
|
+
var ACTION_ADD = exports.ACTION_ADD = "".concat(PREFIX, "/add");
|
|
19
|
+
/** Dispatched to remove a flyout from the manager (usually on close/unmount). */
|
|
20
|
+
var ACTION_CLOSE = exports.ACTION_CLOSE = "".concat(PREFIX, "/close");
|
|
21
|
+
/** Dispatched to set which flyout is currently active within the session. */
|
|
22
|
+
var ACTION_SET_ACTIVE = exports.ACTION_SET_ACTIVE = "".concat(PREFIX, "/setActive");
|
|
23
|
+
/** Dispatched when an active flyout's pixel width changes (for responsive layout). */
|
|
24
|
+
var ACTION_SET_WIDTH = exports.ACTION_SET_WIDTH = "".concat(PREFIX, "/setWidth");
|
|
25
|
+
/** Dispatched to switch layout mode between `side-by-side` and `stacked`. */
|
|
26
|
+
var ACTION_SET_LAYOUT_MODE = exports.ACTION_SET_LAYOUT_MODE = "".concat(PREFIX, "/setLayoutMode");
|
|
27
|
+
/** Dispatched to update a flyout's activity stage (e.g., opening -> active). */
|
|
28
|
+
var ACTION_SET_ACTIVITY_STAGE = exports.ACTION_SET_ACTIVITY_STAGE = "".concat(PREFIX, "/setActivityStage");
|
|
29
|
+
/** Dispatched to go back one session (remove current session). */
|
|
30
|
+
var ACTION_GO_BACK = exports.ACTION_GO_BACK = "".concat(PREFIX, "/goBack");
|
|
31
|
+
/** Dispatched to navigate to a specific flyout (remove all sessions after it). */
|
|
32
|
+
var ACTION_GO_TO_FLYOUT = exports.ACTION_GO_TO_FLYOUT = "".concat(PREFIX, "/goToFlyout");
|
|
33
|
+
/** Dispatched to set push padding offset for a side. */
|
|
34
|
+
var ACTION_SET_PUSH_PADDING = exports.ACTION_SET_PUSH_PADDING = "".concat(PREFIX, "/setPushPadding");
|
|
35
|
+
var ACTION_ADD_UNMANAGED_FLYOUT = exports.ACTION_ADD_UNMANAGED_FLYOUT = "".concat(PREFIX, "/addUnmanagedFlyout");
|
|
36
|
+
var ACTION_CLOSE_UNMANAGED_FLYOUT = exports.ACTION_CLOSE_UNMANAGED_FLYOUT = "".concat(PREFIX, "/closeUnmanagedFlyout");
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Add a flyout to manager state. The manager will create or update
|
|
40
|
+
* the current session depending on the `level` provided.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/** Remove a flyout from manager state. Also updates the active session. */
|
|
44
|
+
|
|
45
|
+
/** Set the active flyout within the current session (or clear with `null`). */
|
|
46
|
+
|
|
47
|
+
/** Update a flyout's measured width in pixels. */
|
|
48
|
+
|
|
49
|
+
/** Change how flyouts are arranged: `side-by-side` or `stacked`. */
|
|
50
|
+
|
|
51
|
+
/** Set a specific flyout's activity stage. */
|
|
52
|
+
|
|
53
|
+
/** Go back one session (remove current session from stack). */
|
|
54
|
+
|
|
55
|
+
/** Navigate to a specific flyout (remove all sessions after it). */
|
|
56
|
+
|
|
57
|
+
/** Set push padding offset for a specific side. */
|
|
58
|
+
|
|
59
|
+
/** Union of all flyout manager actions. */
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Register a flyout with the manager.
|
|
63
|
+
* - `title` is used for the flyout menu.
|
|
64
|
+
* - `level` determines whether the flyout is `main` or `child`.
|
|
65
|
+
* - Optional `size` is the named EUI size (e.g. `s`, `m`, `l`).
|
|
66
|
+
*/
|
|
67
|
+
var addFlyout = exports.addFlyout = function addFlyout(flyoutId, title) {
|
|
68
|
+
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _const.LEVEL_MAIN;
|
|
69
|
+
var size = arguments.length > 3 ? arguments[3] : undefined;
|
|
70
|
+
return {
|
|
71
|
+
type: ACTION_ADD,
|
|
72
|
+
flyoutId: flyoutId,
|
|
73
|
+
title: title,
|
|
74
|
+
level: level,
|
|
75
|
+
size: size
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/** Unregister a flyout and update the session accordingly. */
|
|
80
|
+
var closeFlyout = exports.closeFlyout = function closeFlyout(flyoutId) {
|
|
81
|
+
return {
|
|
82
|
+
type: ACTION_CLOSE,
|
|
83
|
+
flyoutId: flyoutId
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/** Set or clear the active flyout for the current session. */
|
|
88
|
+
var setActiveFlyout = exports.setActiveFlyout = function setActiveFlyout(flyoutId) {
|
|
89
|
+
return {
|
|
90
|
+
type: ACTION_SET_ACTIVE,
|
|
91
|
+
flyoutId: flyoutId
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/** Record a flyout's current width in pixels. */
|
|
96
|
+
var setFlyoutWidth = exports.setFlyoutWidth = function setFlyoutWidth(flyoutId, width) {
|
|
97
|
+
return {
|
|
98
|
+
type: ACTION_SET_WIDTH,
|
|
99
|
+
flyoutId: flyoutId,
|
|
100
|
+
width: width
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/** Switch layout mode between `side-by-side` and `stacked`. */
|
|
105
|
+
var setLayoutMode = exports.setLayoutMode = function setLayoutMode(layoutMode) {
|
|
106
|
+
return {
|
|
107
|
+
type: ACTION_SET_LAYOUT_MODE,
|
|
108
|
+
layoutMode: layoutMode
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/** Update a flyout's activity stage. */
|
|
113
|
+
var setActivityStage = exports.setActivityStage = function setActivityStage(flyoutId, activityStage) {
|
|
114
|
+
return {
|
|
115
|
+
type: ACTION_SET_ACTIVITY_STAGE,
|
|
116
|
+
flyoutId: flyoutId,
|
|
117
|
+
activityStage: activityStage
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/** Go back one session (remove current session from stack). */
|
|
122
|
+
var goBack = exports.goBack = function goBack() {
|
|
123
|
+
return {
|
|
124
|
+
type: ACTION_GO_BACK
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/** Navigate to a specific flyout (remove all sessions after it). */
|
|
129
|
+
var goToFlyout = exports.goToFlyout = function goToFlyout(flyoutId) {
|
|
130
|
+
return {
|
|
131
|
+
type: ACTION_GO_TO_FLYOUT,
|
|
132
|
+
flyoutId: flyoutId
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/** Set push padding offset for a specific side. */
|
|
137
|
+
var setPushPadding = exports.setPushPadding = function setPushPadding(side, width) {
|
|
138
|
+
return {
|
|
139
|
+
type: ACTION_SET_PUSH_PADDING,
|
|
140
|
+
side: side,
|
|
141
|
+
width: width
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
/** Register an unmanaged flyout for z-index positioning purposes */
|
|
146
|
+
var addUnmanagedFlyout = exports.addUnmanagedFlyout = function addUnmanagedFlyout(flyoutId) {
|
|
147
|
+
return {
|
|
148
|
+
type: ACTION_ADD_UNMANAGED_FLYOUT,
|
|
149
|
+
flyoutId: flyoutId
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/** Unregister an unmanaged flyout */
|
|
154
|
+
var closeUnmanagedFlyout = exports.closeUnmanagedFlyout = function closeUnmanagedFlyout(flyoutId) {
|
|
155
|
+
return {
|
|
156
|
+
type: ACTION_CLOSE_UNMANAGED_FLYOUT,
|
|
157
|
+
flyoutId: flyoutId
|
|
158
|
+
};
|
|
159
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useFlyoutActivityStage = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _const = require("./const");
|
|
9
|
+
var _hooks = require("./hooks");
|
|
10
|
+
var _actions = require("./actions");
|
|
11
|
+
var _provider = require("./provider");
|
|
12
|
+
/*
|
|
13
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
14
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
15
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
16
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
17
|
+
* Side Public License, v 1.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Encapsulates all activity-stage transitions and animation-driven updates
|
|
22
|
+
* for managed flyouts.
|
|
23
|
+
*/
|
|
24
|
+
var useFlyoutActivityStage = exports.useFlyoutActivityStage = function useFlyoutActivityStage(_ref) {
|
|
25
|
+
var _ctx$state$flyouts$fi;
|
|
26
|
+
var flyoutId = _ref.flyoutId,
|
|
27
|
+
level = _ref.level;
|
|
28
|
+
var isActive = (0, _hooks.useIsFlyoutActive)(flyoutId);
|
|
29
|
+
var hasChild = (0, _hooks.useHasChildFlyout)(flyoutId);
|
|
30
|
+
var layoutMode = (0, _hooks.useFlyoutLayoutMode)();
|
|
31
|
+
var ctx = (0, _provider.useFlyoutManager)();
|
|
32
|
+
var stage = (ctx === null || ctx === void 0 || (_ctx$state$flyouts$fi = ctx.state.flyouts.find(function (f) {
|
|
33
|
+
return f.flyoutId === flyoutId;
|
|
34
|
+
})) === null || _ctx$state$flyouts$fi === void 0 ? void 0 : _ctx$state$flyouts$fi.activityStage) || (isActive ? _const.STAGE_ACTIVE : _const.STAGE_INACTIVE);
|
|
35
|
+
var stageRef = (0, _react.useRef)(stage);
|
|
36
|
+
if (stageRef.current !== stage) {
|
|
37
|
+
stageRef.current = stage;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 1. ACTIVE -> CLOSING when no longer the active flyout.
|
|
42
|
+
* 2. INACTIVE -> RETURNING when it becomes active again (e.g., reopened or brought forward).
|
|
43
|
+
* 3. (Main flyout only) ACTIVE + stacked + has child -> BACKGROUNDING (begin background animation).
|
|
44
|
+
* 4. (Main only) BACKGROUNDED/BACKGROUNDING + (child gone OR side-by-side) -> RETURNING (bring main to foreground).
|
|
45
|
+
*
|
|
46
|
+
* Any stages that depend on animation end (OPENING, RETURNING, CLOSING, BACKGROUNDING) are finalized in `onAnimationEnd`.
|
|
47
|
+
*/
|
|
48
|
+
(0, _react.useEffect)(function () {
|
|
49
|
+
var s = stageRef.current;
|
|
50
|
+
var next = null;
|
|
51
|
+
if (s === _const.STAGE_ACTIVE && !isActive) next = _const.STAGE_CLOSING;else if (s === _const.STAGE_INACTIVE && isActive) {
|
|
52
|
+
next = _const.STAGE_RETURNING;
|
|
53
|
+
} else if (level === _const.LEVEL_MAIN && isActive && s === _const.STAGE_ACTIVE && hasChild && layoutMode === _const.LAYOUT_MODE_STACKED) next = _const.STAGE_BACKGROUNDING;else if (level === _const.LEVEL_MAIN && (s === _const.STAGE_BACKGROUNDED || s === _const.STAGE_BACKGROUNDING) && (!hasChild || layoutMode === _const.LAYOUT_MODE_SIDE_BY_SIDE)) next = _const.STAGE_RETURNING;
|
|
54
|
+
if (next && next !== s) {
|
|
55
|
+
var _ctx$dispatch;
|
|
56
|
+
ctx === null || ctx === void 0 || (_ctx$dispatch = ctx.dispatch) === null || _ctx$dispatch === void 0 || _ctx$dispatch.call(ctx, (0, _actions.setActivityStage)(flyoutId, next));
|
|
57
|
+
stageRef.current = next;
|
|
58
|
+
}
|
|
59
|
+
}, [isActive, hasChild, layoutMode, level, ctx, flyoutId, stage]);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get the stage to transition to for given current stage.
|
|
63
|
+
* Returns `null` if stage should remain unchanged.
|
|
64
|
+
*
|
|
65
|
+
* Stage transitions:
|
|
66
|
+
* - OPENING / RETURNING -> ACTIVE
|
|
67
|
+
* - CLOSING -> INACTIVE
|
|
68
|
+
* - BACKGROUNDING -> BACKGROUNDED
|
|
69
|
+
*/
|
|
70
|
+
var getNextStage = function getNextStage(stage) {
|
|
71
|
+
switch (stage) {
|
|
72
|
+
case _const.STAGE_OPENING:
|
|
73
|
+
case _const.STAGE_RETURNING:
|
|
74
|
+
return _const.STAGE_ACTIVE;
|
|
75
|
+
case _const.STAGE_CLOSING:
|
|
76
|
+
return _const.STAGE_INACTIVE;
|
|
77
|
+
case _const.STAGE_BACKGROUNDING:
|
|
78
|
+
return _const.STAGE_BACKGROUNDED;
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* onAnimationEnd event handler that must be passed to EuiFlyout.
|
|
85
|
+
* It handles transitions between stages and updates activity stage
|
|
86
|
+
* in EuiFlyoutManagerContext.
|
|
87
|
+
*/
|
|
88
|
+
var onAnimationEnd = (0, _react.useCallback)(function () {
|
|
89
|
+
var currentStage = stageRef.current;
|
|
90
|
+
var nextStage = getNextStage(currentStage);
|
|
91
|
+
if (nextStage && nextStage !== currentStage) {
|
|
92
|
+
var _ctx$dispatch2;
|
|
93
|
+
ctx === null || ctx === void 0 || (_ctx$dispatch2 = ctx.dispatch) === null || _ctx$dispatch2 === void 0 || _ctx$dispatch2.call(ctx, (0, _actions.setActivityStage)(flyoutId, nextStage));
|
|
94
|
+
stageRef.current = nextStage;
|
|
95
|
+
}
|
|
96
|
+
}, [ctx, flyoutId]);
|
|
97
|
+
return {
|
|
98
|
+
activityStage: stage,
|
|
99
|
+
onAnimationEnd: onAnimationEnd
|
|
100
|
+
};
|
|
101
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.STAGE_RETURNING = exports.STAGE_OPENING = exports.STAGE_INACTIVE = exports.STAGE_CLOSING = exports.STAGE_BACKGROUNDING = exports.STAGE_BACKGROUNDED = exports.STAGE_ACTIVE = exports.SESSION_START = exports.SESSION_NEVER = exports.SESSION_INHERIT = exports.PROPERTY_LEVEL = exports.PROPERTY_LAYOUT_MODE = exports.PROPERTY_FLYOUT = exports.LEVEL_MAIN = exports.LEVEL_CHILD = exports.LAYOUT_MODE_STACKED = exports.LAYOUT_MODE_SIDE_BY_SIDE = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
9
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
10
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
11
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
12
|
+
* Side Public License, v 1.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Allowed values for `session` prop to control the way the session is managed for a flyout.
|
|
17
|
+
*/
|
|
18
|
+
var SESSION_START = exports.SESSION_START = 'start';
|
|
19
|
+
var SESSION_INHERIT = exports.SESSION_INHERIT = 'inherit';
|
|
20
|
+
var SESSION_NEVER = exports.SESSION_NEVER = 'never';
|
|
21
|
+
var PREFIX = 'data-managed-flyout';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Data attribute applied to a managed flyout element to help identify it as a managed flyout.
|
|
25
|
+
*/
|
|
26
|
+
var PROPERTY_FLYOUT = exports.PROPERTY_FLYOUT = "".concat(PREFIX);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Data attribute indicating whether the flyout is the `main` or `child` flyout.
|
|
30
|
+
*/
|
|
31
|
+
var PROPERTY_LEVEL = exports.PROPERTY_LEVEL = "".concat(PREFIX, "-level");
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Data attribute representing how multiple flyouts are laid out
|
|
35
|
+
* (`side-by-side` or `stacked`).
|
|
36
|
+
*/
|
|
37
|
+
var PROPERTY_LAYOUT_MODE = exports.PROPERTY_LAYOUT_MODE = "".concat(PREFIX, "-layout-mode");
|
|
38
|
+
|
|
39
|
+
/** Stacked layout mode where child flyouts overlay on top of the main flyout. */
|
|
40
|
+
var LAYOUT_MODE_STACKED = exports.LAYOUT_MODE_STACKED = 'stacked';
|
|
41
|
+
/** Side-by-side layout mode where child flyouts render adjacent to the main flyout. */
|
|
42
|
+
var LAYOUT_MODE_SIDE_BY_SIDE = exports.LAYOUT_MODE_SIDE_BY_SIDE = 'side-by-side';
|
|
43
|
+
|
|
44
|
+
/** The primary (parent) flyout in a session. */
|
|
45
|
+
var LEVEL_MAIN = exports.LEVEL_MAIN = 'main';
|
|
46
|
+
/** The secondary (child) flyout spawned by the main flyout. */
|
|
47
|
+
var LEVEL_CHILD = exports.LEVEL_CHILD = 'child';
|
|
48
|
+
|
|
49
|
+
/** Flyout is mounting and playing its opening animation. */
|
|
50
|
+
var STAGE_OPENING = exports.STAGE_OPENING = 'opening';
|
|
51
|
+
/** Flyout is fully visible and interactive. */
|
|
52
|
+
var STAGE_ACTIVE = exports.STAGE_ACTIVE = 'active';
|
|
53
|
+
/** Flyout is unmounted or not currently visible/interactable. */
|
|
54
|
+
var STAGE_INACTIVE = exports.STAGE_INACTIVE = 'inactive';
|
|
55
|
+
/** Main flyout is transitioning behind an active session flyout. */
|
|
56
|
+
var STAGE_BACKGROUNDING = exports.STAGE_BACKGROUNDING = 'backgrounding';
|
|
57
|
+
/** Main flyout is backgrounded behind an active session flyout. */
|
|
58
|
+
var STAGE_BACKGROUNDED = exports.STAGE_BACKGROUNDED = 'backgrounded';
|
|
59
|
+
/** Flyout is returning to the foreground from a backgrounded state. */
|
|
60
|
+
var STAGE_RETURNING = exports.STAGE_RETURNING = 'returning';
|
|
61
|
+
/** Flyout is playing its closing animation. */
|
|
62
|
+
var STAGE_CLOSING = exports.STAGE_CLOSING = 'closing';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useIsInManagedFlyout = exports.EuiFlyoutIsManagedProvider = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _react2 = require("@emotion/react");
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
/*
|
|
13
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
14
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
15
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
16
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
17
|
+
* Side Public License, v 1.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// Context to track if we're within a managed flyout
|
|
21
|
+
var EuiFlyoutIsManagedContext = /*#__PURE__*/(0, _react.createContext)(false);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* React provider that marks descendants as being rendered inside
|
|
25
|
+
* an EUI managed flyout. Used by hooks/components to alter behavior
|
|
26
|
+
* (e.g., focus handling) when inside a managed flyout tree.
|
|
27
|
+
*/
|
|
28
|
+
var EuiFlyoutIsManagedProvider = exports.EuiFlyoutIsManagedProvider = function EuiFlyoutIsManagedProvider(_ref) {
|
|
29
|
+
var isManaged = _ref.isManaged,
|
|
30
|
+
children = _ref.children;
|
|
31
|
+
return (0, _react2.jsx)(EuiFlyoutIsManagedContext.Provider, {
|
|
32
|
+
value: isManaged
|
|
33
|
+
}, children);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Hook that returns `true` when called within an EUI managed flyout subtree.
|
|
38
|
+
*/
|
|
39
|
+
var useIsInManagedFlyout = exports.useIsInManagedFlyout = function useIsInManagedFlyout() {
|
|
40
|
+
return (0, _react.useContext)(EuiFlyoutIsManagedContext);
|
|
41
|
+
};
|