@elastic/eui 76.2.0 → 76.3.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.
@@ -47,7 +47,14 @@ export var EuiSkipLink = function EuiSkipLink(_ref) {
47
47
  var hasValidId = !!destinationEl; // Check the fallback destination if not
48
48
 
49
49
  if (!destinationEl && fallbackDestination) {
50
- destinationEl = document.querySelector(fallbackDestination);
50
+ if (Array.isArray(fallbackDestination)) {
51
+ for (var i = 0; i < fallbackDestination.length; i++) {
52
+ destinationEl = document.querySelector(fallbackDestination[i]);
53
+ if (destinationEl) break; // Stop once the first fallback has been found
54
+ }
55
+ } else {
56
+ destinationEl = document.querySelector(fallbackDestination);
57
+ }
51
58
  }
52
59
 
53
60
  if ((overrideLinkBehavior || !hasValidId) && destinationEl) {
@@ -108,11 +115,15 @@ EuiSkipLink.propTypes = {
108
115
  destinationId: PropTypes.string.isRequired,
109
116
 
110
117
  /**
111
- * If no destination ID element exists or can be found, you may provide a string of
112
- * query selectors to fall back to (e.g. a `main` or `role="main"` element)
118
+ * If no destination ID element exists or can be found, you may provide a query selector
119
+ * string to fall back to.
120
+ *
121
+ * For complex applications with potentially variable layouts per page, an array of
122
+ * query selectors can be passed, e.g. `['main', '[role=main]', '.appWrapper']`, which
123
+ * prioritizes looking for multiple fallbacks based on array order.
113
124
  * @default main
114
125
  */
115
- fallbackDestination: PropTypes.string,
126
+ fallbackDestination: PropTypes.oneOfType([PropTypes.string.isRequired, PropTypes.arrayOf(PropTypes.string.isRequired).isRequired]),
116
127
 
117
128
  /**
118
129
  * If default HTML anchor link behavior is not desired (e.g. for SPAs with hash routing),
@@ -88,6 +88,8 @@ export var EuiCodeBlockFullScreenWrapper = function EuiCodeBlockFullScreenWrappe
88
88
  var cssStyles = [styles.euiCodeBlock, styles.l, // Force fullscreen to use large font
89
89
  styles.isFullScreen];
90
90
  return ___EmotionJSX(EuiOverlayMask, null, ___EmotionJSX(EuiFocusTrap, {
91
+ scrollLock: true,
92
+ preventScrollOnFocus: true,
91
93
  clickOutsideDisables: true
92
94
  }, ___EmotionJSX("div", {
93
95
  className: "euiCodeBlockFullScreen",
@@ -289,6 +289,7 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
289
289
 
290
290
  var flyout = ___EmotionJSX(EuiFocusTrap, _extends({
291
291
  disabled: isPushed,
292
+ scrollLock: ownFocus,
292
293
  clickOutsideDisables: !ownFocus,
293
294
  onClickOutside: onClickOutside
294
295
  }, focusTrapProps), ___EmotionJSX(Element, _extends({
@@ -70,6 +70,8 @@ export var EuiImageFullScreenWrapper = function EuiImageFullScreenWrapper(_ref)
70
70
  return ___EmotionJSX(EuiOverlayMask, {
71
71
  "data-test-subj": "fullScreenOverlayMask"
72
72
  }, ___EmotionJSX(EuiFocusTrap, {
73
+ scrollLock: true,
74
+ preventScrollOnFocus: true,
73
75
  onClickOutside: closeFullScreen
74
76
  }, ___EmotionJSX(React.Fragment, null, ___EmotionJSX("figure", _extends({
75
77
  "aria-label": optionalCaptionText,
package/eui.d.ts CHANGED
@@ -8115,11 +8115,15 @@ declare module '@elastic/eui/src/components/accessibility/skip_link/skip_link' {
8115
8115
  */
8116
8116
  destinationId: string;
8117
8117
  /**
8118
- * If no destination ID element exists or can be found, you may provide a string of
8119
- * query selectors to fall back to (e.g. a `main` or `role="main"` element)
8118
+ * If no destination ID element exists or can be found, you may provide a query selector
8119
+ * string to fall back to.
8120
+ *
8121
+ * For complex applications with potentially variable layouts per page, an array of
8122
+ * query selectors can be passed, e.g. `['main', '[role=main]', '.appWrapper']`, which
8123
+ * prioritizes looking for multiple fallbacks based on array order.
8120
8124
  * @default main
8121
8125
  */
8122
- fallbackDestination?: string;
8126
+ fallbackDestination?: string | string[];
8123
8127
  /**
8124
8128
  * If default HTML anchor link behavior is not desired (e.g. for SPAs with hash routing),
8125
8129
  * setting this flag to true will manually scroll to and focus the destination element
@@ -66,7 +66,14 @@ var EuiSkipLink = function EuiSkipLink(_ref) {
66
66
  var hasValidId = !!destinationEl; // Check the fallback destination if not
67
67
 
68
68
  if (!destinationEl && fallbackDestination) {
69
- destinationEl = document.querySelector(fallbackDestination);
69
+ if (Array.isArray(fallbackDestination)) {
70
+ for (var i = 0; i < fallbackDestination.length; i++) {
71
+ destinationEl = document.querySelector(fallbackDestination[i]);
72
+ if (destinationEl) break; // Stop once the first fallback has been found
73
+ }
74
+ } else {
75
+ destinationEl = document.querySelector(fallbackDestination);
76
+ }
70
77
  }
71
78
 
72
79
  if ((overrideLinkBehavior || !hasValidId) && destinationEl) {
@@ -129,11 +136,15 @@ EuiSkipLink.propTypes = {
129
136
  destinationId: _propTypes.default.string.isRequired,
130
137
 
131
138
  /**
132
- * If no destination ID element exists or can be found, you may provide a string of
133
- * query selectors to fall back to (e.g. a `main` or `role="main"` element)
139
+ * If no destination ID element exists or can be found, you may provide a query selector
140
+ * string to fall back to.
141
+ *
142
+ * For complex applications with potentially variable layouts per page, an array of
143
+ * query selectors can be passed, e.g. `['main', '[role=main]', '.appWrapper']`, which
144
+ * prioritizes looking for multiple fallbacks based on array order.
134
145
  * @default main
135
146
  */
136
- fallbackDestination: _propTypes.default.string,
147
+ fallbackDestination: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.arrayOf(_propTypes.default.string.isRequired).isRequired]),
137
148
 
138
149
  /**
139
150
  * If default HTML anchor link behavior is not desired (e.g. for SPAs with hash routing),
@@ -104,6 +104,8 @@ var EuiCodeBlockFullScreenWrapper = function EuiCodeBlockFullScreenWrapper(_ref2
104
104
  var cssStyles = [styles.euiCodeBlock, styles.l, // Force fullscreen to use large font
105
105
  styles.isFullScreen];
106
106
  return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, null, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
107
+ scrollLock: true,
108
+ preventScrollOnFocus: true,
107
109
  clickOutsideDisables: true
108
110
  }, (0, _react2.jsx)("div", {
109
111
  className: "euiCodeBlockFullScreen",
@@ -312,6 +312,7 @@ var EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
312
312
 
313
313
  var flyout = (0, _react2.jsx)(_focus_trap.EuiFocusTrap, _extends({
314
314
  disabled: isPushed,
315
+ scrollLock: ownFocus,
315
316
  clickOutsideDisables: !ownFocus,
316
317
  onClickOutside: onClickOutside
317
318
  }, focusTrapProps), (0, _react2.jsx)(Element, _extends({
@@ -85,6 +85,8 @@ var EuiImageFullScreenWrapper = function EuiImageFullScreenWrapper(_ref) {
85
85
  return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, {
86
86
  "data-test-subj": "fullScreenOverlayMask"
87
87
  }, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
88
+ scrollLock: true,
89
+ preventScrollOnFocus: true,
88
90
  onClickOutside: closeFullScreen
89
91
  }, (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("figure", _extends({
90
92
  "aria-label": optionalCaptionText,
@@ -42,7 +42,14 @@ export var EuiSkipLink = function EuiSkipLink(_ref) {
42
42
  var hasValidId = !!destinationEl; // Check the fallback destination if not
43
43
 
44
44
  if (!destinationEl && fallbackDestination) {
45
- destinationEl = document.querySelector(fallbackDestination);
45
+ if (Array.isArray(fallbackDestination)) {
46
+ for (var i = 0; i < fallbackDestination.length; i++) {
47
+ destinationEl = document.querySelector(fallbackDestination[i]);
48
+ if (destinationEl) break; // Stop once the first fallback has been found
49
+ }
50
+ } else {
51
+ destinationEl = document.querySelector(fallbackDestination);
52
+ }
46
53
  }
47
54
 
48
55
  if ((overrideLinkBehavior || !hasValidId) && destinationEl) {
@@ -78,6 +78,8 @@ export var EuiCodeBlockFullScreenWrapper = function EuiCodeBlockFullScreenWrappe
78
78
  var cssStyles = [styles.euiCodeBlock, styles.l, // Force fullscreen to use large font
79
79
  styles.isFullScreen];
80
80
  return ___EmotionJSX(EuiOverlayMask, null, ___EmotionJSX(EuiFocusTrap, {
81
+ scrollLock: true,
82
+ preventScrollOnFocus: true,
81
83
  clickOutsideDisables: true
82
84
  }, ___EmotionJSX("div", {
83
85
  className: "euiCodeBlockFullScreen",
@@ -266,6 +266,7 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
266
266
 
267
267
  var flyout = ___EmotionJSX(EuiFocusTrap, _extends({
268
268
  disabled: isPushed,
269
+ scrollLock: ownFocus,
269
270
  clickOutsideDisables: !ownFocus,
270
271
  onClickOutside: onClickOutside
271
272
  }, focusTrapProps), ___EmotionJSX(Element, _extends({
@@ -58,6 +58,8 @@ export var EuiImageFullScreenWrapper = function EuiImageFullScreenWrapper(_ref)
58
58
  return ___EmotionJSX(EuiOverlayMask, {
59
59
  "data-test-subj": "fullScreenOverlayMask"
60
60
  }, ___EmotionJSX(EuiFocusTrap, {
61
+ scrollLock: true,
62
+ preventScrollOnFocus: true,
61
63
  onClickOutside: closeFullScreen
62
64
  }, ___EmotionJSX(React.Fragment, null, ___EmotionJSX("figure", _extends({
63
65
  "aria-label": optionalCaptionText,
@@ -61,7 +61,14 @@ var EuiSkipLink = function EuiSkipLink(_ref) {
61
61
  var hasValidId = !!destinationEl; // Check the fallback destination if not
62
62
 
63
63
  if (!destinationEl && fallbackDestination) {
64
- destinationEl = document.querySelector(fallbackDestination);
64
+ if (Array.isArray(fallbackDestination)) {
65
+ for (var i = 0; i < fallbackDestination.length; i++) {
66
+ destinationEl = document.querySelector(fallbackDestination[i]);
67
+ if (destinationEl) break; // Stop once the first fallback has been found
68
+ }
69
+ } else {
70
+ destinationEl = document.querySelector(fallbackDestination);
71
+ }
65
72
  }
66
73
 
67
74
  if ((overrideLinkBehavior || !hasValidId) && destinationEl) {
@@ -104,6 +104,8 @@ var EuiCodeBlockFullScreenWrapper = function EuiCodeBlockFullScreenWrapper(_ref2
104
104
  var cssStyles = [styles.euiCodeBlock, styles.l, // Force fullscreen to use large font
105
105
  styles.isFullScreen];
106
106
  return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, null, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
107
+ scrollLock: true,
108
+ preventScrollOnFocus: true,
107
109
  clickOutsideDisables: true
108
110
  }, (0, _react2.jsx)("div", {
109
111
  className: "euiCodeBlockFullScreen",
@@ -294,6 +294,7 @@ var EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
294
294
 
295
295
  var flyout = (0, _react2.jsx)(_focus_trap.EuiFocusTrap, (0, _extends2.default)({
296
296
  disabled: isPushed,
297
+ scrollLock: ownFocus,
297
298
  clickOutsideDisables: !ownFocus,
298
299
  onClickOutside: onClickOutside
299
300
  }, focusTrapProps), (0, _react2.jsx)(Element, (0, _extends2.default)({
@@ -80,6 +80,8 @@ var EuiImageFullScreenWrapper = function EuiImageFullScreenWrapper(_ref) {
80
80
  return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, {
81
81
  "data-test-subj": "fullScreenOverlayMask"
82
82
  }, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
83
+ scrollLock: true,
84
+ preventScrollOnFocus: true,
83
85
  onClickOutside: closeFullScreen
84
86
  }, (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("figure", (0, _extends2.default)({
85
87
  "aria-label": optionalCaptionText,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elastic/eui",
3
3
  "description": "Elastic UI Component Library",
4
- "version": "76.2.0",
4
+ "version": "76.3.0",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "lib",
7
7
  "module": "es",
@@ -63,7 +63,14 @@ var EuiSkipLink = function EuiSkipLink(_ref) {
63
63
  var hasValidId = !!destinationEl; // Check the fallback destination if not
64
64
 
65
65
  if (!destinationEl && fallbackDestination) {
66
- destinationEl = document.querySelector(fallbackDestination);
66
+ if (Array.isArray(fallbackDestination)) {
67
+ for (var i = 0; i < fallbackDestination.length; i++) {
68
+ destinationEl = document.querySelector(fallbackDestination[i]);
69
+ if (destinationEl) break; // Stop once the first fallback has been found
70
+ }
71
+ } else {
72
+ destinationEl = document.querySelector(fallbackDestination);
73
+ }
67
74
  }
68
75
 
69
76
  if ((overrideLinkBehavior || !hasValidId) && destinationEl) {
@@ -126,11 +133,15 @@ EuiSkipLink.propTypes = {
126
133
  destinationId: _propTypes.default.string.isRequired,
127
134
 
128
135
  /**
129
- * If no destination ID element exists or can be found, you may provide a string of
130
- * query selectors to fall back to (e.g. a `main` or `role="main"` element)
136
+ * If no destination ID element exists or can be found, you may provide a query selector
137
+ * string to fall back to.
138
+ *
139
+ * For complex applications with potentially variable layouts per page, an array of
140
+ * query selectors can be passed, e.g. `['main', '[role=main]', '.appWrapper']`, which
141
+ * prioritizes looking for multiple fallbacks based on array order.
131
142
  * @default main
132
143
  */
133
- fallbackDestination: _propTypes.default.string,
144
+ fallbackDestination: _propTypes.default.oneOfType([_propTypes.default.string.isRequired, _propTypes.default.arrayOf(_propTypes.default.string.isRequired).isRequired]),
134
145
 
135
146
  /**
136
147
  * If default HTML anchor link behavior is not desired (e.g. for SPAs with hash routing),
@@ -104,6 +104,8 @@ var EuiCodeBlockFullScreenWrapper = function EuiCodeBlockFullScreenWrapper(_ref2
104
104
  var cssStyles = [styles.euiCodeBlock, styles.l, // Force fullscreen to use large font
105
105
  styles.isFullScreen];
106
106
  return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, null, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
107
+ scrollLock: true,
108
+ preventScrollOnFocus: true,
107
109
  clickOutsideDisables: true
108
110
  }, (0, _react2.jsx)("div", {
109
111
  className: "euiCodeBlockFullScreen",
@@ -82,6 +82,8 @@ var EuiImageFullScreenWrapper = function EuiImageFullScreenWrapper(_ref) {
82
82
  return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, {
83
83
  "data-test-subj": "fullScreenOverlayMask"
84
84
  }, (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
85
+ scrollLock: true,
86
+ preventScrollOnFocus: true,
85
87
  onClickOutside: closeFullScreen
86
88
  }, (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("figure", (0, _extends2.default)({
87
89
  "aria-label": optionalCaptionText,