@elastic/eui 87.0.0 → 87.2.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_theme_dark.css +0 -234
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -234
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accordion/accordion.js +82 -35
- package/es/components/auto_sizer/index.js +1 -1
- package/es/components/breadcrumbs/breadcrumb.js +2 -3
- package/es/components/breadcrumbs/breadcrumbs.js +2 -3
- package/es/components/code/code_block_virtualized.js +25 -17
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +14 -1
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +8 -7
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +6 -6
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +7 -7
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +6 -6
- package/es/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +9 -9
- package/es/components/color_picker/color_palette_picker/color_palette_picker.js +1 -1
- package/es/components/control_bar/control_bar.js +2 -3
- package/es/components/date_picker/date_picker_range.js +5 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.js +2 -2
- package/es/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/es/components/empty_prompt/empty_prompt.js +0 -1
- package/es/components/flyout/flyout.js +9 -7
- package/es/components/flyout/flyout_body.js +15 -3
- package/es/components/form/range/dual_range.js +33 -6
- package/es/components/form/range/range.js +31 -6
- package/es/components/form/super_select/super_select.js +1 -1
- package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +2 -3
- package/es/components/header/header_links/header_links.js +2 -3
- package/es/components/page/page_header/page_header_content.js +2 -3
- package/es/components/page/page_sidebar/page_sidebar.js +2 -2
- package/es/components/page_template/page_template.js +14 -5
- package/es/components/popover/input_popover.js +24 -9
- package/es/components/popover/popover.js +4 -6
- package/es/components/resizable_container/index.js +2 -1
- package/es/components/resizable_container/resizable_button.js +81 -50
- package/es/components/resizable_container/resizable_button.styles.js +66 -0
- package/es/components/resizable_container/resizable_collapse_button.js +24 -14
- package/es/components/resizable_container/resizable_collapse_button.styles.js +85 -0
- package/es/components/selectable/selectable_list/selectable_list.js +97 -79
- package/es/components/steps/step.styles.js +5 -5
- package/es/components/tool_tip/icon_tip.js +1 -1
- package/es/components/tool_tip/tool_tip.js +4 -14
- package/es/components/tool_tip/tool_tip_anchor.js +5 -14
- package/es/components/tour/tour_step.js +2 -3
- package/es/services/accessibility/html_id_generator.js +19 -3
- package/es/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/eui.d.ts +198 -56
- package/i18ntokens.json +64 -46
- package/lib/components/accordion/accordion.js +82 -35
- package/lib/components/auto_sizer/index.js +11 -7
- package/lib/components/breadcrumbs/breadcrumb.js +2 -3
- package/lib/components/code/code_block_virtualized.js +25 -17
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +14 -1
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +8 -7
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +6 -6
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +7 -7
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +6 -6
- package/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +9 -9
- package/lib/components/color_picker/color_palette_picker/color_palette_picker.js +1 -1
- package/lib/components/date_picker/date_picker_range.js +5 -2
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +2 -2
- package/lib/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/lib/components/empty_prompt/empty_prompt.js +0 -1
- package/lib/components/flyout/flyout.js +9 -7
- package/lib/components/flyout/flyout_body.js +15 -3
- package/lib/components/form/range/dual_range.js +33 -6
- package/lib/components/form/range/range.js +14 -6
- package/lib/components/form/super_select/super_select.js +1 -1
- package/lib/components/page/page_sidebar/page_sidebar.js +1 -1
- package/lib/components/page_template/page_template.js +14 -5
- package/lib/components/popover/input_popover.js +23 -8
- package/lib/components/popover/popover.js +4 -6
- package/lib/components/resizable_container/index.js +8 -1
- package/lib/components/resizable_container/resizable_button.js +83 -51
- package/lib/components/resizable_container/resizable_button.styles.js +71 -0
- package/lib/components/resizable_container/resizable_collapse_button.js +24 -14
- package/lib/components/resizable_container/resizable_collapse_button.styles.js +90 -0
- package/lib/components/selectable/selectable_list/selectable_list.js +97 -79
- package/lib/components/steps/step.styles.js +5 -5
- package/lib/components/tool_tip/icon_tip.js +1 -1
- package/lib/components/tool_tip/tool_tip.js +4 -14
- package/lib/components/tool_tip/tool_tip_anchor.js +5 -13
- package/lib/services/accessibility/html_id_generator.js +21 -2
- package/lib/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/optimize/es/components/accordion/accordion.js +82 -35
- package/optimize/es/components/auto_sizer/index.js +1 -1
- package/optimize/es/components/code/code_block_virtualized.js +25 -17
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +5 -1
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -1
- package/optimize/es/components/date_picker/date_picker_range.js +5 -2
- package/optimize/es/components/flyout/flyout.js +9 -7
- package/optimize/es/components/flyout/flyout_body.js +4 -2
- package/optimize/es/components/form/range/dual_range.js +7 -4
- package/optimize/es/components/form/range/range.js +5 -4
- package/optimize/es/components/page/page_sidebar/page_sidebar.js +2 -2
- package/optimize/es/components/page_template/page_template.js +14 -5
- package/optimize/es/components/popover/input_popover.js +13 -8
- package/optimize/es/components/popover/popover.js +2 -3
- package/optimize/es/components/resizable_container/index.js +2 -1
- package/optimize/es/components/resizable_container/resizable_button.js +61 -44
- package/optimize/es/components/resizable_container/resizable_button.styles.js +66 -0
- package/optimize/es/components/resizable_container/resizable_collapse_button.js +19 -11
- package/optimize/es/components/resizable_container/resizable_collapse_button.styles.js +85 -0
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +97 -79
- package/optimize/es/components/steps/step.styles.js +5 -5
- package/optimize/es/components/tool_tip/tool_tip.js +3 -13
- package/optimize/es/components/tool_tip/tool_tip_anchor.js +4 -8
- package/optimize/es/services/accessibility/html_id_generator.js +19 -3
- package/optimize/es/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/optimize/lib/components/accordion/accordion.js +82 -35
- package/optimize/lib/components/auto_sizer/index.js +11 -7
- package/optimize/lib/components/code/code_block_virtualized.js +25 -17
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +5 -1
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +2 -1
- package/optimize/lib/components/date_picker/date_picker_range.js +5 -2
- package/optimize/lib/components/flyout/flyout.js +9 -7
- package/optimize/lib/components/flyout/flyout_body.js +4 -2
- package/optimize/lib/components/form/range/dual_range.js +7 -4
- package/optimize/lib/components/form/range/range.js +5 -4
- package/optimize/lib/components/page/page_sidebar/page_sidebar.js +1 -1
- package/optimize/lib/components/page_template/page_template.js +14 -5
- package/optimize/lib/components/popover/input_popover.js +12 -7
- package/optimize/lib/components/popover/popover.js +2 -3
- package/optimize/lib/components/resizable_container/index.js +8 -1
- package/optimize/lib/components/resizable_container/resizable_button.js +63 -45
- package/optimize/lib/components/resizable_container/resizable_button.styles.js +71 -0
- package/optimize/lib/components/resizable_container/resizable_collapse_button.js +19 -11
- package/optimize/lib/components/resizable_container/resizable_collapse_button.styles.js +90 -0
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +97 -79
- package/optimize/lib/components/steps/step.styles.js +5 -5
- package/optimize/lib/components/tool_tip/tool_tip.js +3 -13
- package/optimize/lib/components/tool_tip/tool_tip_anchor.js +4 -8
- package/optimize/lib/services/accessibility/html_id_generator.js +21 -2
- package/optimize/lib/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/package.json +19 -21
- package/src/components/index.scss +0 -1
- package/test-env/components/accordion/accordion.js +82 -35
- package/test-env/components/auto_sizer/index.js +11 -7
- package/test-env/components/breadcrumbs/breadcrumb.js +2 -3
- package/test-env/components/code/code_block_virtualized.js +25 -17
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +14 -1
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_button.js +8 -7
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_item.js +6 -6
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsed/collapsed_nav_popover.js +7 -7
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_accordion.js +6 -6
- package/test-env/components/collapsible_nav_beta/collapsible_nav_item/collapsible_nav_item.js +9 -9
- package/test-env/components/color_picker/color_palette_picker/color_palette_picker.js +1 -1
- package/test-env/components/date_picker/date_picker_range.js +5 -2
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +2 -2
- package/test-env/components/date_picker/super_date_picker/super_update_button.js +1 -1
- package/test-env/components/empty_prompt/empty_prompt.js +0 -1
- package/test-env/components/flyout/flyout_body.js +15 -3
- package/test-env/components/form/range/dual_range.js +33 -6
- package/test-env/components/form/range/range.js +14 -6
- package/test-env/components/form/super_select/super_select.js +1 -1
- package/test-env/components/page/page_sidebar/page_sidebar.js +1 -1
- package/test-env/components/page_template/page_template.js +14 -5
- package/test-env/components/popover/input_popover.js +23 -8
- package/test-env/components/popover/popover.js +4 -6
- package/test-env/components/resizable_container/index.js +8 -1
- package/test-env/components/resizable_container/resizable_button.js +83 -51
- package/test-env/components/resizable_container/resizable_button.styles.js +71 -0
- package/test-env/components/resizable_container/resizable_collapse_button.js +19 -14
- package/test-env/components/resizable_container/resizable_collapse_button.styles.js +90 -0
- package/test-env/components/selectable/selectable_list/selectable_list.js +97 -79
- package/test-env/components/steps/step.styles.js +5 -5
- package/test-env/components/tool_tip/icon_tip.js +1 -1
- package/test-env/components/tool_tip/tool_tip.js +4 -14
- package/test-env/components/tool_tip/tool_tip_anchor.js +5 -11
- package/test-env/themes/amsterdam/global_styling/mixins/shadow.js +0 -1
- package/src/components/resizable_container/_index.scss +0 -3
- package/src/components/resizable_container/_resizable_button.scss +0 -129
- package/src/components/resizable_container/_resizable_collapse_button.scss +0 -145
- package/src/components/resizable_container/_variables.scss +0 -2
|
@@ -176,17 +176,67 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
176
176
|
search: searchValue
|
|
177
177
|
}, label));
|
|
178
178
|
}, _reactWindow.areEqual));
|
|
179
|
+
_defineProperty(_assertThisInitialized(_this), "renderVirtualizedList", function (heightIsFull, optionArray) {
|
|
180
|
+
if (!_this.props.isVirtualized) return null;
|
|
181
|
+
var _this$props3 = _this.props,
|
|
182
|
+
windowProps = _this$props3.windowProps,
|
|
183
|
+
forcedHeight = _this$props3.height,
|
|
184
|
+
rowHeight = _this$props3.rowHeight;
|
|
185
|
+
var virtualizationProps = _objectSpread({
|
|
186
|
+
className: 'euiSelectableList__list',
|
|
187
|
+
ref: _this.setListRef,
|
|
188
|
+
outerRef: _this.removeScrollableTabStop,
|
|
189
|
+
innerRef: _this.setListBoxRef,
|
|
190
|
+
innerElementType: 'ul',
|
|
191
|
+
itemCount: optionArray.length,
|
|
192
|
+
itemData: optionArray,
|
|
193
|
+
itemSize: rowHeight,
|
|
194
|
+
'data-skip-axe': 'scrollable-region-focusable'
|
|
195
|
+
}, windowProps);
|
|
196
|
+
|
|
197
|
+
// Calculated height is only used if height is not full
|
|
198
|
+
var calculatedHeight = !heightIsFull ? forcedHeight || 0 : 0;
|
|
199
|
+
|
|
200
|
+
// If calculatedHeight is still falsy, then calculate it
|
|
201
|
+
if (!heightIsFull && !calculatedHeight) {
|
|
202
|
+
var maxVisibleOptions = 7;
|
|
203
|
+
var numVisibleOptions = optionArray.length;
|
|
204
|
+
var numVisibleMoreThanMax = optionArray.length > maxVisibleOptions;
|
|
205
|
+
if (numVisibleMoreThanMax) {
|
|
206
|
+
// Show only half of the last one to indicate there's more to scroll to
|
|
207
|
+
calculatedHeight = (maxVisibleOptions - 0.5) * rowHeight;
|
|
208
|
+
} else {
|
|
209
|
+
calculatedHeight = numVisibleOptions * rowHeight;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return heightIsFull ? (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, null, function (_ref2) {
|
|
213
|
+
var width = _ref2.width,
|
|
214
|
+
height = _ref2.height;
|
|
215
|
+
return (0, _react2.jsx)(_reactWindow.FixedSizeList, _extends({
|
|
216
|
+
width: width,
|
|
217
|
+
height: height
|
|
218
|
+
}, virtualizationProps), _this.ListRow);
|
|
219
|
+
}) : (0, _react2.jsx)(_auto_sizer.EuiAutoSizer, {
|
|
220
|
+
disableHeight: true
|
|
221
|
+
}, function (_ref3) {
|
|
222
|
+
var width = _ref3.width;
|
|
223
|
+
return (0, _react2.jsx)(_reactWindow.FixedSizeList, _extends({
|
|
224
|
+
width: width,
|
|
225
|
+
height: calculatedHeight
|
|
226
|
+
}, virtualizationProps), _this.ListRow);
|
|
227
|
+
});
|
|
228
|
+
});
|
|
179
229
|
_defineProperty(_assertThisInitialized(_this), "onAddOrRemoveOption", function (option, event) {
|
|
180
230
|
if (option.disabled) {
|
|
181
231
|
return;
|
|
182
232
|
}
|
|
183
|
-
var _this$
|
|
184
|
-
allowExclusions = _this$
|
|
185
|
-
options = _this$
|
|
186
|
-
_this$
|
|
187
|
-
visibleOptions = _this$
|
|
188
|
-
_this.props.setActiveOptionIndex(visibleOptions.findIndex(function (
|
|
189
|
-
var label =
|
|
233
|
+
var _this$props4 = _this.props,
|
|
234
|
+
allowExclusions = _this$props4.allowExclusions,
|
|
235
|
+
options = _this$props4.options,
|
|
236
|
+
_this$props4$visibleO = _this$props4.visibleOptions,
|
|
237
|
+
visibleOptions = _this$props4$visibleO === void 0 ? options : _this$props4$visibleO;
|
|
238
|
+
_this.props.setActiveOptionIndex(visibleOptions.findIndex(function (_ref4) {
|
|
239
|
+
var label = _ref4.label;
|
|
190
240
|
return label === option.label;
|
|
191
241
|
}), function () {
|
|
192
242
|
if (option.checked === 'on' && allowExclusions) {
|
|
@@ -199,10 +249,10 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
199
249
|
});
|
|
200
250
|
});
|
|
201
251
|
_defineProperty(_assertThisInitialized(_this), "onAddOption", function (addedOption, event) {
|
|
202
|
-
var _this$
|
|
203
|
-
onOptionClick = _this$
|
|
204
|
-
options = _this$
|
|
205
|
-
singleSelection = _this$
|
|
252
|
+
var _this$props5 = _this.props,
|
|
253
|
+
onOptionClick = _this$props5.onOptionClick,
|
|
254
|
+
options = _this$props5.options,
|
|
255
|
+
singleSelection = _this$props5.singleSelection;
|
|
206
256
|
var changedOption = _objectSpread({}, addedOption);
|
|
207
257
|
var updatedOptions = options.map(function (option) {
|
|
208
258
|
// if singleSelection is enabled, uncheck any selected option(s)
|
|
@@ -221,10 +271,10 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
221
271
|
onOptionClick(updatedOptions, event, changedOption);
|
|
222
272
|
});
|
|
223
273
|
_defineProperty(_assertThisInitialized(_this), "onRemoveOption", function (removedOption, event) {
|
|
224
|
-
var _this$
|
|
225
|
-
onOptionClick = _this$
|
|
226
|
-
singleSelection = _this$
|
|
227
|
-
options = _this$
|
|
274
|
+
var _this$props6 = _this.props,
|
|
275
|
+
onOptionClick = _this$props6.onOptionClick,
|
|
276
|
+
singleSelection = _this$props6.singleSelection,
|
|
277
|
+
options = _this$props6.options;
|
|
228
278
|
var changedOption = _objectSpread({}, removedOption);
|
|
229
279
|
var updatedOptions = options.map(function (option) {
|
|
230
280
|
var updatedOption = _objectSpread({}, option);
|
|
@@ -237,9 +287,9 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
237
287
|
onOptionClick(updatedOptions, event, changedOption);
|
|
238
288
|
});
|
|
239
289
|
_defineProperty(_assertThisInitialized(_this), "onExcludeOption", function (excludedOption, event) {
|
|
240
|
-
var _this$
|
|
241
|
-
onOptionClick = _this$
|
|
242
|
-
options = _this$
|
|
290
|
+
var _this$props7 = _this.props,
|
|
291
|
+
onOptionClick = _this$props7.onOptionClick,
|
|
292
|
+
options = _this$props7.options;
|
|
243
293
|
var changedOption = _objectSpread({}, excludedOption);
|
|
244
294
|
var updatedOptions = options.map(function (option) {
|
|
245
295
|
var updatedOption = _objectSpread({}, option);
|
|
@@ -268,76 +318,44 @@ var EuiSelectableList = /*#__PURE__*/function (_Component) {
|
|
|
268
318
|
key: "render",
|
|
269
319
|
value: function render() {
|
|
270
320
|
var _this2 = this;
|
|
271
|
-
var _this$
|
|
272
|
-
className = _this$
|
|
273
|
-
options = _this$
|
|
274
|
-
searchValue = _this$
|
|
275
|
-
onOptionClick = _this$
|
|
276
|
-
renderOption = _this$
|
|
277
|
-
forcedHeight = _this$
|
|
278
|
-
windowProps = _this$
|
|
279
|
-
rowHeight = _this$
|
|
280
|
-
activeOptionIndex = _this$
|
|
281
|
-
makeOptionId = _this$
|
|
282
|
-
showIcons = _this$
|
|
283
|
-
singleSelection = _this$
|
|
284
|
-
visibleOptions = _this$
|
|
285
|
-
allowExclusions = _this$
|
|
286
|
-
bordered = _this$
|
|
287
|
-
paddingSize = _this$
|
|
288
|
-
searchable = _this$
|
|
289
|
-
onFocusBadge = _this$
|
|
290
|
-
listId = _this$
|
|
291
|
-
setActiveOptionIndex = _this$
|
|
292
|
-
ariaLabel = _this$
|
|
293
|
-
ariaLabelledby = _this$
|
|
294
|
-
ariaDescribedby = _this$
|
|
295
|
-
role = _this$
|
|
296
|
-
isVirtualized = _this$
|
|
297
|
-
textWrap = _this$
|
|
298
|
-
rest = _objectWithoutProperties(_this$
|
|
321
|
+
var _this$props8 = this.props,
|
|
322
|
+
className = _this$props8.className,
|
|
323
|
+
options = _this$props8.options,
|
|
324
|
+
searchValue = _this$props8.searchValue,
|
|
325
|
+
onOptionClick = _this$props8.onOptionClick,
|
|
326
|
+
renderOption = _this$props8.renderOption,
|
|
327
|
+
forcedHeight = _this$props8.height,
|
|
328
|
+
windowProps = _this$props8.windowProps,
|
|
329
|
+
rowHeight = _this$props8.rowHeight,
|
|
330
|
+
activeOptionIndex = _this$props8.activeOptionIndex,
|
|
331
|
+
makeOptionId = _this$props8.makeOptionId,
|
|
332
|
+
showIcons = _this$props8.showIcons,
|
|
333
|
+
singleSelection = _this$props8.singleSelection,
|
|
334
|
+
visibleOptions = _this$props8.visibleOptions,
|
|
335
|
+
allowExclusions = _this$props8.allowExclusions,
|
|
336
|
+
bordered = _this$props8.bordered,
|
|
337
|
+
paddingSize = _this$props8.paddingSize,
|
|
338
|
+
searchable = _this$props8.searchable,
|
|
339
|
+
onFocusBadge = _this$props8.onFocusBadge,
|
|
340
|
+
listId = _this$props8.listId,
|
|
341
|
+
setActiveOptionIndex = _this$props8.setActiveOptionIndex,
|
|
342
|
+
ariaLabel = _this$props8['aria-label'],
|
|
343
|
+
ariaLabelledby = _this$props8['aria-labelledby'],
|
|
344
|
+
ariaDescribedby = _this$props8['aria-describedby'],
|
|
345
|
+
role = _this$props8.role,
|
|
346
|
+
isVirtualized = _this$props8.isVirtualized,
|
|
347
|
+
textWrap = _this$props8.textWrap,
|
|
348
|
+
rest = _objectWithoutProperties(_this$props8, _excluded3);
|
|
299
349
|
var optionArray = visibleOptions || options;
|
|
300
350
|
this.calculateAriaSetAttrs(optionArray);
|
|
301
351
|
var heightIsFull = forcedHeight === 'full';
|
|
302
|
-
var calculatedHeight = heightIsFull ? false : forcedHeight;
|
|
303
|
-
|
|
304
|
-
// If calculatedHeight is still undefined, then calculate it
|
|
305
|
-
if (calculatedHeight === undefined) {
|
|
306
|
-
var maxVisibleOptions = 7;
|
|
307
|
-
var numVisibleOptions = optionArray.length;
|
|
308
|
-
var numVisibleMoreThanMax = optionArray.length > maxVisibleOptions;
|
|
309
|
-
if (numVisibleMoreThanMax) {
|
|
310
|
-
// Show only half of the last one to indicate there's more to scroll to
|
|
311
|
-
calculatedHeight = (maxVisibleOptions - 0.5) * rowHeight;
|
|
312
|
-
} else {
|
|
313
|
-
calculatedHeight = numVisibleOptions * rowHeight;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
352
|
var classes = (0, _classnames.default)('euiSelectableList', {
|
|
317
353
|
'euiSelectableList-fullHeight': heightIsFull,
|
|
318
354
|
'euiSelectableList-bordered': bordered
|
|
319
355
|
}, className);
|
|
320
356
|
return (0, _react2.jsx)("div", _extends({
|
|
321
357
|
className: classes
|
|
322
|
-
}, rest), isVirtualized ? (0, _react2.jsx)(
|
|
323
|
-
disableHeight: !heightIsFull
|
|
324
|
-
}, function (_ref3) {
|
|
325
|
-
var width = _ref3.width,
|
|
326
|
-
height = _ref3.height;
|
|
327
|
-
return (0, _react2.jsx)(_reactWindow.FixedSizeList, _extends({
|
|
328
|
-
ref: _this2.setListRef,
|
|
329
|
-
outerRef: _this2.removeScrollableTabStop,
|
|
330
|
-
className: "euiSelectableList__list",
|
|
331
|
-
"data-skip-axe": "scrollable-region-focusable",
|
|
332
|
-
width: width,
|
|
333
|
-
height: calculatedHeight || height,
|
|
334
|
-
itemCount: optionArray.length,
|
|
335
|
-
itemData: optionArray,
|
|
336
|
-
itemSize: rowHeight,
|
|
337
|
-
innerElementType: "ul",
|
|
338
|
-
innerRef: _this2.setListBoxRef
|
|
339
|
-
}, windowProps), _this2.ListRow);
|
|
340
|
-
}) : (0, _react2.jsx)("div", {
|
|
358
|
+
}, rest), isVirtualized ? this.renderVirtualizedList(heightIsFull, optionArray) : (0, _react2.jsx)("div", {
|
|
341
359
|
className: "euiSelectableList__list",
|
|
342
360
|
ref: this.removeScrollableTabStop
|
|
343
361
|
}, (0, _react2.jsx)("ul", {
|
|
@@ -48,7 +48,7 @@ exports.euiStepStyles = euiStepStyles;
|
|
|
48
48
|
var euiStepContentStyles = function euiStepContentStyles(euiThemeContext) {
|
|
49
49
|
var euiTheme = euiThemeContext.euiTheme;
|
|
50
50
|
var euiStep = euiStepVariables(euiTheme);
|
|
51
|
-
|
|
51
|
+
return {
|
|
52
52
|
euiStep__content: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-top', euiTheme.size.s), " ", (0, _global_styling.logicalCSS)('padding-top', euiTheme.size.base), " ", (0, _global_styling.logicalCSS)('padding-bottom', (0, _global_styling.mathWithUnits)([euiTheme.size.xl, euiTheme.size.s], function (x, y) {
|
|
53
53
|
return x + y;
|
|
54
54
|
})), " ", (0, _global_styling.logicalCSS)('padding-right', euiTheme.size.base), ";;label:euiStep__content;"),
|
|
@@ -58,16 +58,16 @@ var euiStepContentStyles = function euiStepContentStyles(euiThemeContext) {
|
|
|
58
58
|
})), (0, _global_styling.logicalCSS)('margin-left', (0, _global_styling.mathWithUnits)(euiStep.numberSize, function (x) {
|
|
59
59
|
return x / 2;
|
|
60
60
|
})), ";;label:m;"),
|
|
61
|
-
s
|
|
62
|
-
|
|
61
|
+
// `s` is the same as `m` - use a getter to duplicate its content
|
|
62
|
+
get s() {
|
|
63
|
+
return this.m;
|
|
64
|
+
},
|
|
63
65
|
xs: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-left', (0, _global_styling.mathWithUnits)([euiStep.numberXSSize, euiStep.numberMargin], function (x, y) {
|
|
64
66
|
return x / 2 + y;
|
|
65
67
|
})), (0, _global_styling.logicalCSS)('margin-left', (0, _global_styling.mathWithUnits)(euiStep.numberXSSize, function (x) {
|
|
66
68
|
return x / 2;
|
|
67
69
|
})), ";;label:xs;")
|
|
68
70
|
};
|
|
69
|
-
styles.s = styles.m;
|
|
70
|
-
return styles;
|
|
71
71
|
};
|
|
72
72
|
exports.euiStepContentStyles = euiStepContentStyles;
|
|
73
73
|
var euiStepTitleStyles = function euiStepTitleStyles(euiThemeContext) {
|
|
@@ -7,7 +7,6 @@ exports.POSITIONS = exports.EuiToolTip = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var _common = require("../common");
|
|
11
10
|
var _services = require("../../services");
|
|
12
11
|
var _react2 = require("../../services/react");
|
|
13
12
|
var _resize_observer = require("../observer/resize_observer");
|
|
@@ -44,22 +43,13 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
44
43
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
45
44
|
* Side Public License, v 1.
|
|
46
45
|
*/
|
|
47
|
-
var
|
|
48
|
-
top: 'euiToolTip--top',
|
|
49
|
-
right: 'euiToolTip--right',
|
|
50
|
-
bottom: 'euiToolTip--bottom',
|
|
51
|
-
left: 'euiToolTip--left'
|
|
52
|
-
};
|
|
53
|
-
var POSITIONS = (0, _common.keysOf)(positionsToClassNameMap);
|
|
46
|
+
var POSITIONS = ['top', 'right', 'bottom', 'left'];
|
|
54
47
|
exports.POSITIONS = POSITIONS;
|
|
48
|
+
var DISPLAYS = ['inlineBlock', 'block'];
|
|
55
49
|
var delayToMsMap = {
|
|
56
50
|
regular: 250,
|
|
57
51
|
long: 250 * 5
|
|
58
52
|
};
|
|
59
|
-
var displayToClassNameMap = {
|
|
60
|
-
inlineBlock: undefined,
|
|
61
|
-
block: 'euiToolTipAnchor--displayBlock'
|
|
62
|
-
};
|
|
63
53
|
var DEFAULT_TOOLTIP_STYLES = {
|
|
64
54
|
// position the tooltip content near the top-left
|
|
65
55
|
// corner of the window so it can't create scrollbars
|
|
@@ -270,7 +260,7 @@ var EuiToolTip = /*#__PURE__*/function (_Component) {
|
|
|
270
260
|
onFocus: this.onFocus,
|
|
271
261
|
onMouseOver: this.showToolTip,
|
|
272
262
|
onMouseOut: this.onMouseOut,
|
|
273
|
-
id:
|
|
263
|
+
id: id,
|
|
274
264
|
className: anchorClasses,
|
|
275
265
|
display: display,
|
|
276
266
|
isVisible: visible
|
|
@@ -333,7 +323,7 @@ EuiToolTip.propTypes = {
|
|
|
333
323
|
/**
|
|
334
324
|
* Common display alternatives for the anchor wrapper
|
|
335
325
|
*/
|
|
336
|
-
display: _propTypes.default.
|
|
326
|
+
display: _propTypes.default.any,
|
|
337
327
|
/**
|
|
338
328
|
* Delay before showing tooltip. Good for repeatable items.
|
|
339
329
|
*/
|
|
@@ -22,11 +22,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
22
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
24
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
25
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
26
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
27
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
28
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
29
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
30
25
|
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; }
|
|
31
26
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
32
27
|
var EuiToolTipAnchor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
@@ -52,7 +47,7 @@ var EuiToolTipAnchor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
52
47
|
className: classes,
|
|
53
48
|
onMouseOver: onMouseOver,
|
|
54
49
|
onMouseOut: onMouseOut
|
|
55
|
-
}), /*#__PURE__*/(0, _react.cloneElement)(children,
|
|
50
|
+
}), /*#__PURE__*/(0, _react.cloneElement)(children, {
|
|
56
51
|
onFocus: function onFocus(e) {
|
|
57
52
|
_onFocus();
|
|
58
53
|
children.props.onFocus && children.props.onFocus(e);
|
|
@@ -60,18 +55,15 @@ var EuiToolTipAnchor = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
60
55
|
onBlur: function onBlur(e) {
|
|
61
56
|
_onBlur();
|
|
62
57
|
children.props.onBlur && children.props.onBlur(e);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
})))
|
|
58
|
+
},
|
|
59
|
+
'aria-describedby': isVisible ? (0, _classnames.default)(id, children.props['aria-describedby']) : children.props['aria-describedby']
|
|
60
|
+
}))
|
|
67
61
|
);
|
|
68
62
|
});
|
|
69
63
|
exports.EuiToolTipAnchor = EuiToolTipAnchor;
|
|
70
64
|
EuiToolTipAnchor.propTypes = {
|
|
71
65
|
onBlur: _propTypes.default.func.isRequired,
|
|
72
66
|
onFocus: _propTypes.default.func.isRequired,
|
|
73
|
-
|
|
74
|
-
isVisible: _propTypes.default.bool.isRequired,
|
|
75
|
-
display: _propTypes.default.oneOf(["block", "inlineBlock"]).isRequired
|
|
67
|
+
isVisible: _propTypes.default.bool.isRequired
|
|
76
68
|
};
|
|
77
69
|
EuiToolTipAnchor.displayName = 'EuiToolTipAnchor';
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.htmlIdGenerator = htmlIdGenerator;
|
|
7
8
|
exports.useGeneratedHtmlId = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
10
|
var _uuid = require("uuid");
|
|
9
|
-
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
10
13
|
/*
|
|
11
14
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
15
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -38,7 +41,8 @@ function htmlIdGenerator() {
|
|
|
38
41
|
* This prevents IDs from being re-randomized on every component update.
|
|
39
42
|
*/
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
// We can remove this deprecated hook once EUI no longer needs to support React 16-17
|
|
45
|
+
var useDeprecatedGeneratedHtmlId = function useDeprecatedGeneratedHtmlId() {
|
|
42
46
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
43
47
|
prefix = _ref.prefix,
|
|
44
48
|
suffix = _ref.suffix,
|
|
@@ -47,4 +51,19 @@ var useGeneratedHtmlId = function useGeneratedHtmlId() {
|
|
|
47
51
|
return conditionalId || htmlIdGenerator(prefix)(suffix);
|
|
48
52
|
}, [conditionalId, prefix, suffix]);
|
|
49
53
|
};
|
|
54
|
+
var useNewGeneratedHtmlId = function useNewGeneratedHtmlId() {
|
|
55
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
56
|
+
_ref2$prefix = _ref2.prefix,
|
|
57
|
+
prefix = _ref2$prefix === void 0 ? '' : _ref2$prefix,
|
|
58
|
+
_ref2$suffix = _ref2.suffix,
|
|
59
|
+
suffix = _ref2$suffix === void 0 ? '' : _ref2$suffix,
|
|
60
|
+
conditionalId = _ref2.conditionalId;
|
|
61
|
+
// Using the default export and dot notation here is intentional
|
|
62
|
+
// to prevent React <18 import errors.
|
|
63
|
+
var id = _react.default.useId();
|
|
64
|
+
return (0, _react.useMemo)(function () {
|
|
65
|
+
return conditionalId || "".concat(prefix).concat(id).concat(suffix);
|
|
66
|
+
}, [id, conditionalId, prefix, suffix]);
|
|
67
|
+
};
|
|
68
|
+
var useGeneratedHtmlId = 'useId' in _react.default ? useNewGeneratedHtmlId : useDeprecatedGeneratedHtmlId;
|
|
50
69
|
exports.useGeneratedHtmlId = useGeneratedHtmlId;
|
|
@@ -87,7 +87,6 @@ var euiShadowXLarge = function euiShadowXLarge(_ref9) {
|
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
* slightShadowHover
|
|
90
|
-
* TODO: I think this is only used by panels/cards in the Amsterdam theme, move there
|
|
91
90
|
*/
|
|
92
91
|
exports.euiShadowXLarge = euiShadowXLarge;
|
|
93
92
|
var euiSlightShadowHover = function euiSlightShadowHover(_ref11) {
|
|
@@ -20,6 +20,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
20
20
|
|
|
21
21
|
import React, { Component } from 'react';
|
|
22
22
|
import classNames from 'classnames';
|
|
23
|
+
import { tabbable } from 'tabbable';
|
|
23
24
|
import { EuiLoadingSpinner } from '../loading';
|
|
24
25
|
import { EuiResizeObserver } from '../observer/resize_observer';
|
|
25
26
|
import { EuiText } from '../text';
|
|
@@ -42,33 +43,68 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
42
43
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
43
44
|
_defineProperty(_assertThisInitialized(_this), "childContent", null);
|
|
44
45
|
_defineProperty(_assertThisInitialized(_this), "childWrapper", null);
|
|
46
|
+
_defineProperty(_assertThisInitialized(_this), "tabbableChildren", null);
|
|
45
47
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
46
48
|
isOpen: _this.props.forceState ? _this.props.forceState === 'open' : _this.props.initialIsOpen
|
|
47
49
|
});
|
|
48
50
|
_defineProperty(_assertThisInitialized(_this), "setChildContentHeight", function () {
|
|
49
|
-
var forceState = _this.props.forceState;
|
|
50
51
|
requestAnimationFrame(function () {
|
|
51
|
-
var height = _this.childContent &&
|
|
52
|
+
var height = _this.childContent && _this.isOpen ? _this.childContent.clientHeight : 0;
|
|
52
53
|
_this.childWrapper && _this.childWrapper.setAttribute('style', logicalCSS('height', "".concat(height, "px")));
|
|
53
54
|
});
|
|
54
55
|
});
|
|
55
56
|
_defineProperty(_assertThisInitialized(_this), "onToggle", function () {
|
|
56
57
|
var forceState = _this.props.forceState;
|
|
57
58
|
if (forceState) {
|
|
58
|
-
_this
|
|
59
|
+
var _this$props$onToggle, _this$props;
|
|
60
|
+
(_this$props$onToggle = (_this$props = _this.props).onToggle) === null || _this$props$onToggle === void 0 ? void 0 : _this$props$onToggle.call(_this$props, forceState === 'open' ? false : true);
|
|
59
61
|
} else {
|
|
60
62
|
_this.setState(function (prevState) {
|
|
61
63
|
return {
|
|
62
64
|
isOpen: !prevState.isOpen
|
|
63
65
|
};
|
|
64
66
|
}, function () {
|
|
67
|
+
var _this$props$onToggle2, _this$props2;
|
|
65
68
|
if (_this.state.isOpen && _this.childWrapper) {
|
|
66
69
|
_this.childWrapper.focus();
|
|
67
70
|
}
|
|
68
|
-
_this.props.onToggle
|
|
71
|
+
(_this$props$onToggle2 = (_this$props2 = _this.props).onToggle) === null || _this$props$onToggle2 === void 0 ? void 0 : _this$props$onToggle2.call(_this$props2, _this.state.isOpen);
|
|
69
72
|
});
|
|
70
73
|
}
|
|
71
74
|
});
|
|
75
|
+
// When accordions are closed, tabbable children should not be present in the tab order
|
|
76
|
+
_defineProperty(_assertThisInitialized(_this), "preventTabbing", function () {
|
|
77
|
+
if (_this.childContent) {
|
|
78
|
+
// Re-check for children on every close - content can change dynamically
|
|
79
|
+
_this.tabbableChildren = tabbable(_this.childContent);
|
|
80
|
+
_this.tabbableChildren.forEach(function (element) {
|
|
81
|
+
// If the element has an existing `tabIndex` set, make sure we can restore it
|
|
82
|
+
var originalTabIndex = element.getAttribute('tabIndex');
|
|
83
|
+
if (originalTabIndex) {
|
|
84
|
+
element.setAttribute('data-original-tabindex', originalTabIndex);
|
|
85
|
+
}
|
|
86
|
+
element.setAttribute('tabIndex', '-1');
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
_defineProperty(_assertThisInitialized(_this), "enableTabbing", function () {
|
|
91
|
+
// If no tabbable children were set, we don't need to re-enable anything
|
|
92
|
+
if (_this.tabbableChildren) {
|
|
93
|
+
_this.tabbableChildren.forEach(function (element) {
|
|
94
|
+
var originalTabIndex = element.getAttribute('data-original-tabindex');
|
|
95
|
+
if (originalTabIndex) {
|
|
96
|
+
// If the element originally had an existing `tabIndex` set, restore it
|
|
97
|
+
element.setAttribute('tabIndex', originalTabIndex);
|
|
98
|
+
element.removeAttribute('data-original-tabindex');
|
|
99
|
+
} else {
|
|
100
|
+
// If not, remove the tabIndex property
|
|
101
|
+
element.removeAttribute('tabIndex');
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
// Cleanup - unset the list of children
|
|
105
|
+
_this.tabbableChildren = null;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
72
108
|
_defineProperty(_assertThisInitialized(_this), "setChildContentRef", function (node) {
|
|
73
109
|
_this.childContent = node;
|
|
74
110
|
});
|
|
@@ -83,44 +119,55 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
83
119
|
return _this;
|
|
84
120
|
}
|
|
85
121
|
_createClass(EuiAccordionClass, [{
|
|
122
|
+
key: "isOpen",
|
|
123
|
+
get: function get() {
|
|
124
|
+
return this.props.forceState ? this.props.forceState === 'open' : this.state.isOpen;
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
86
127
|
key: "componentDidMount",
|
|
87
128
|
value: function componentDidMount() {
|
|
88
129
|
this.setChildContentHeight();
|
|
130
|
+
if (!this.isOpen) this.preventTabbing();
|
|
89
131
|
}
|
|
90
132
|
}, {
|
|
91
133
|
key: "componentDidUpdate",
|
|
92
|
-
value: function componentDidUpdate() {
|
|
134
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
93
135
|
this.setChildContentHeight();
|
|
136
|
+
if (prevProps.forceState === 'open' && this.props.forceState === 'closed' || prevState.isOpen === true && this.state.isOpen === false) {
|
|
137
|
+
this.preventTabbing();
|
|
138
|
+
}
|
|
139
|
+
if (prevProps.forceState === 'closed' && this.props.forceState === 'open' || prevState.isOpen === false && this.state.isOpen === true) {
|
|
140
|
+
this.enableTabbing();
|
|
141
|
+
}
|
|
94
142
|
}
|
|
95
143
|
}, {
|
|
96
144
|
key: "render",
|
|
97
145
|
value: function render() {
|
|
98
146
|
var _buttonProps$id,
|
|
99
147
|
_this2 = this;
|
|
100
|
-
var _this$
|
|
101
|
-
children = _this$
|
|
102
|
-
buttonContent = _this$
|
|
103
|
-
className = _this$
|
|
104
|
-
id = _this$
|
|
105
|
-
_this$
|
|
106
|
-
Element = _this$
|
|
107
|
-
buttonClassName = _this$
|
|
108
|
-
buttonContentClassName = _this$
|
|
109
|
-
extraAction = _this$
|
|
110
|
-
paddingSize = _this$
|
|
111
|
-
initialIsOpen = _this$
|
|
112
|
-
arrowDisplay = _this$
|
|
113
|
-
forceState = _this$
|
|
114
|
-
isLoading = _this$
|
|
115
|
-
isLoadingMessage = _this$
|
|
116
|
-
isDisabled = _this$
|
|
117
|
-
buttonProps = _this$
|
|
118
|
-
_this$
|
|
119
|
-
_ButtonElement = _this$
|
|
120
|
-
arrowProps = _this$
|
|
121
|
-
theme = _this$
|
|
122
|
-
rest = _objectWithoutProperties(_this$
|
|
123
|
-
var isOpen = forceState ? forceState === 'open' : this.state.isOpen;
|
|
148
|
+
var _this$props3 = this.props,
|
|
149
|
+
children = _this$props3.children,
|
|
150
|
+
buttonContent = _this$props3.buttonContent,
|
|
151
|
+
className = _this$props3.className,
|
|
152
|
+
id = _this$props3.id,
|
|
153
|
+
_this$props3$element = _this$props3.element,
|
|
154
|
+
Element = _this$props3$element === void 0 ? 'div' : _this$props3$element,
|
|
155
|
+
buttonClassName = _this$props3.buttonClassName,
|
|
156
|
+
buttonContentClassName = _this$props3.buttonContentClassName,
|
|
157
|
+
extraAction = _this$props3.extraAction,
|
|
158
|
+
paddingSize = _this$props3.paddingSize,
|
|
159
|
+
initialIsOpen = _this$props3.initialIsOpen,
|
|
160
|
+
arrowDisplay = _this$props3.arrowDisplay,
|
|
161
|
+
forceState = _this$props3.forceState,
|
|
162
|
+
isLoading = _this$props3.isLoading,
|
|
163
|
+
isLoadingMessage = _this$props3.isLoadingMessage,
|
|
164
|
+
isDisabled = _this$props3.isDisabled,
|
|
165
|
+
buttonProps = _this$props3.buttonProps,
|
|
166
|
+
_this$props3$buttonEl = _this$props3.buttonElement,
|
|
167
|
+
_ButtonElement = _this$props3$buttonEl === void 0 ? 'button' : _this$props3$buttonEl,
|
|
168
|
+
arrowProps = _this$props3.arrowProps,
|
|
169
|
+
theme = _this$props3.theme,
|
|
170
|
+
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
124
171
|
|
|
125
172
|
// Force button element to be a legend if the element is a fieldset
|
|
126
173
|
var ButtonElement = Element === 'fieldset' ? 'legend' : _ButtonElement;
|
|
@@ -129,7 +176,7 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
129
176
|
// Force visibility of arrow button if button element is not focusable
|
|
130
177
|
var _arrowDisplay = arrowDisplay === 'none' && !buttonElementIsFocusable ? 'left' : arrowDisplay;
|
|
131
178
|
var classes = classNames('euiAccordion', {
|
|
132
|
-
'euiAccordion-isOpen': isOpen
|
|
179
|
+
'euiAccordion-isOpen': this.isOpen
|
|
133
180
|
}, className);
|
|
134
181
|
var childrenClasses = classNames('euiAccordion__children', {
|
|
135
182
|
'euiAccordion__children-isLoading': isLoading
|
|
@@ -137,7 +184,7 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
137
184
|
var buttonClasses = classNames('euiAccordion__button', buttonClassName, buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.className);
|
|
138
185
|
var buttonContentClasses = classNames('euiAccordion__buttonContent', buttonContentClassName);
|
|
139
186
|
var iconButtonClasses = classNames('euiAccordion__iconButton', {
|
|
140
|
-
'euiAccordion__iconButton-isOpen': isOpen,
|
|
187
|
+
'euiAccordion__iconButton-isOpen': this.isOpen,
|
|
141
188
|
'euiAccordion__iconButton--right': _arrowDisplay === 'right'
|
|
142
189
|
}, arrowProps === null || arrowProps === void 0 ? void 0 : arrowProps.className);
|
|
143
190
|
|
|
@@ -147,9 +194,9 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
147
194
|
var childrenStyles = euiAccordionChildrenStyles(theme);
|
|
148
195
|
var cssChildrenStyles = [childrenStyles.euiAccordion__children, isLoading && childrenStyles.isLoading, paddingSize && paddingSize !== 'none' && childrenStyles[paddingSize]];
|
|
149
196
|
var childWrapperStyles = euiAccordionChildWrapperStyles(theme);
|
|
150
|
-
var cssChildWrapperStyles = [childWrapperStyles.euiAccordion__childWrapper, isOpen && childWrapperStyles.isOpen];
|
|
197
|
+
var cssChildWrapperStyles = [childWrapperStyles.euiAccordion__childWrapper, this.isOpen && childWrapperStyles.isOpen];
|
|
151
198
|
var iconButtonStyles = euiAccordionIconButtonStyles(theme);
|
|
152
|
-
var cssIconButtonStyles = [iconButtonStyles.euiAccordion__iconButton, isOpen && iconButtonStyles.isOpen, _arrowDisplay === 'right' && iconButtonStyles.arrowRight, arrowProps === null || arrowProps === void 0 ? void 0 : arrowProps.css];
|
|
199
|
+
var cssIconButtonStyles = [iconButtonStyles.euiAccordion__iconButton, this.isOpen && iconButtonStyles.isOpen, _arrowDisplay === 'right' && iconButtonStyles.arrowRight, arrowProps === null || arrowProps === void 0 ? void 0 : arrowProps.css];
|
|
153
200
|
var optionalActionStyles = euiAccordionOptionalActionStyles();
|
|
154
201
|
var cssOptionalActionStyles = [optionalActionStyles.euiAccordion__optionalAction];
|
|
155
202
|
var spinnerStyles = euiAccordionSpinnerStyles(theme);
|
|
@@ -167,7 +214,7 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
167
214
|
iconType: "arrowRight",
|
|
168
215
|
onClick: this.onToggle,
|
|
169
216
|
"aria-controls": id,
|
|
170
|
-
"aria-expanded": isOpen,
|
|
217
|
+
"aria-expanded": this.isOpen,
|
|
171
218
|
"aria-labelledby": buttonId,
|
|
172
219
|
tabIndex: buttonElementIsFocusable ? -1 : 0,
|
|
173
220
|
isDisabled: isDisabled
|
|
@@ -201,7 +248,7 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
201
248
|
"aria-controls": id
|
|
202
249
|
// `aria-expanded` is only a valid attribute on interactive controls - axe-core throws a violation otherwise
|
|
203
250
|
,
|
|
204
|
-
"aria-expanded": ButtonElement === 'button' ? isOpen : undefined,
|
|
251
|
+
"aria-expanded": ButtonElement === 'button' ? this.isOpen : undefined,
|
|
205
252
|
onClick: isDisabled ? undefined : this.onToggle,
|
|
206
253
|
type: ButtonElement === 'button' ? 'button' : undefined,
|
|
207
254
|
disabled: ButtonElement === 'button' ? isDisabled : undefined
|