@patternfly/react-core 4.192.8 → 4.192.9
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/CHANGELOG.md +11 -0
- package/dist/esm/components/Select/Select.d.ts +5 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +171 -28
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/SelectMenu.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectMenu.js +2 -1
- package/dist/esm/components/Select/SelectMenu.js.map +1 -1
- package/dist/esm/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectOption.js +6 -1
- package/dist/esm/components/Select/SelectOption.js.map +1 -1
- package/dist/esm/components/Select/SelectToggle.d.ts +3 -2
- package/dist/esm/components/Select/SelectToggle.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectToggle.js +26 -16
- package/dist/esm/components/Select/SelectToggle.js.map +1 -1
- package/dist/esm/components/Select/selectConstants.d.ts +1 -0
- package/dist/esm/components/Select/selectConstants.d.ts.map +1 -1
- package/dist/esm/components/Select/selectConstants.js +1 -0
- package/dist/esm/components/Select/selectConstants.js.map +1 -1
- package/dist/esm/helpers/util.d.ts +6 -0
- package/dist/esm/helpers/util.d.ts.map +1 -1
- package/dist/esm/helpers/util.js +12 -0
- package/dist/esm/helpers/util.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts +5 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +170 -27
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Select/SelectMenu.d.ts.map +1 -1
- package/dist/js/components/Select/SelectMenu.js +2 -1
- package/dist/js/components/Select/SelectMenu.js.map +1 -1
- package/dist/js/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/js/components/Select/SelectOption.js +6 -1
- package/dist/js/components/Select/SelectOption.js.map +1 -1
- package/dist/js/components/Select/SelectToggle.d.ts +3 -2
- package/dist/js/components/Select/SelectToggle.d.ts.map +1 -1
- package/dist/js/components/Select/SelectToggle.js +25 -15
- package/dist/js/components/Select/SelectToggle.js.map +1 -1
- package/dist/js/components/Select/selectConstants.d.ts +1 -0
- package/dist/js/components/Select/selectConstants.d.ts.map +1 -1
- package/dist/js/components/Select/selectConstants.js +2 -1
- package/dist/js/components/Select/selectConstants.js.map +1 -1
- package/dist/js/helpers/util.d.ts +6 -0
- package/dist/js/helpers/util.d.ts.map +1 -1
- package/dist/js/helpers/util.js +14 -1
- package/dist/js/helpers/util.js.map +1 -1
- package/dist/umd/react-core.js +215 -44
- package/dist/umd/react-core.min.css +14 -14
- package/dist/umd/react-core.min.js +3 -3
- package/package.json +5 -5
- package/src/components/Select/Select.tsx +166 -26
- package/src/components/Select/SelectMenu.tsx +2 -1
- package/src/components/Select/SelectOption.tsx +5 -1
- package/src/components/Select/SelectToggle.tsx +38 -17
- package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +74 -24
- package/src/components/Select/examples/Select.md +5 -1
- package/src/components/Select/selectConstants.tsx +2 -0
- package/src/helpers/util.ts +13 -0
package/dist/umd/react-core.js
CHANGED
|
@@ -1132,6 +1132,18 @@
|
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
|
+
/** This function returns a list of tabbable items in a container
|
|
1136
|
+
*
|
|
1137
|
+
* @param {any} containerRef to the container
|
|
1138
|
+
* @param {string} tababbleSelectors CSS selector string of tabbable items
|
|
1139
|
+
*/
|
|
1140
|
+
function findTabbableElements(containerRef, tababbleSelectors) {
|
|
1141
|
+
const tabbable = containerRef.current.querySelectorAll(tababbleSelectors);
|
|
1142
|
+
const list = Array.prototype.filter.call(tabbable, function (item) {
|
|
1143
|
+
return item.tabIndex >= '0';
|
|
1144
|
+
});
|
|
1145
|
+
return list;
|
|
1146
|
+
}
|
|
1135
1147
|
/** This function is a helper for keyboard navigation through dropdowns.
|
|
1136
1148
|
*
|
|
1137
1149
|
* @param {number} index The index of the element you're on
|
|
@@ -6061,6 +6073,7 @@
|
|
|
6061
6073
|
ArrowLeft: 'ArrowLeft',
|
|
6062
6074
|
ArrowRight: 'ArrowRight'
|
|
6063
6075
|
};
|
|
6076
|
+
const SelectFooterTabbableItems = 'input, button, select, textarea, a[href]';
|
|
6064
6077
|
|
|
6065
6078
|
class SelectOption extends React__namespace.Component {
|
|
6066
6079
|
constructor() {
|
|
@@ -6086,7 +6099,12 @@
|
|
|
6086
6099
|
event.stopPropagation();
|
|
6087
6100
|
}
|
|
6088
6101
|
else {
|
|
6089
|
-
|
|
6102
|
+
if (event.shiftKey) {
|
|
6103
|
+
keyHandler(index, innerIndex, 'up');
|
|
6104
|
+
}
|
|
6105
|
+
else {
|
|
6106
|
+
keyHandler(index, innerIndex, 'tab');
|
|
6107
|
+
}
|
|
6090
6108
|
}
|
|
6091
6109
|
}
|
|
6092
6110
|
event.preventDefault();
|
|
@@ -6323,7 +6341,8 @@
|
|
|
6323
6341
|
isChecked: this.checkForValue(option.props.value, checked),
|
|
6324
6342
|
sendRef,
|
|
6325
6343
|
keyHandler,
|
|
6326
|
-
index: index
|
|
6344
|
+
index: index++,
|
|
6345
|
+
isLastOptionBeforeFooter
|
|
6327
6346
|
})))) : null
|
|
6328
6347
|
});
|
|
6329
6348
|
});
|
|
@@ -6406,26 +6425,19 @@
|
|
|
6406
6425
|
onClose();
|
|
6407
6426
|
}
|
|
6408
6427
|
};
|
|
6409
|
-
this.findTabbableFooterElements = () => {
|
|
6410
|
-
const tabbable = this.props.footerRef.current.querySelectorAll('input, button, select, textarea, a[href]');
|
|
6411
|
-
const list = Array.prototype.filter.call(tabbable, function (item) {
|
|
6412
|
-
return item.tabIndex >= '0';
|
|
6413
|
-
});
|
|
6414
|
-
return list;
|
|
6415
|
-
};
|
|
6416
6428
|
this.handleGlobalKeys = (event) => {
|
|
6417
|
-
const { parentRef, menuRef, hasFooter, isOpen, variant, onToggle, onClose } = this.props;
|
|
6429
|
+
const { parentRef, menuRef, hasFooter, footerRef, isOpen, variant, onToggle, onClose, moveFocusToLastMenuItem } = this.props;
|
|
6418
6430
|
const escFromToggle = parentRef && parentRef.current && parentRef.current.contains(event.target);
|
|
6419
6431
|
const escFromWithinMenu = menuRef && menuRef.current && menuRef.current.contains && menuRef.current.contains(event.target);
|
|
6420
6432
|
if (isOpen &&
|
|
6421
6433
|
event.key === KeyTypes.Tab &&
|
|
6422
6434
|
(variant === exports.SelectVariant.typeahead || variant === exports.SelectVariant.typeaheadMulti)) {
|
|
6423
|
-
this.props.handleTypeaheadKeys('tab');
|
|
6435
|
+
this.props.handleTypeaheadKeys('tab', event.shiftKey);
|
|
6424
6436
|
event.preventDefault();
|
|
6425
6437
|
return;
|
|
6426
6438
|
}
|
|
6427
6439
|
if (isOpen && event.key === KeyTypes.Tab && hasFooter) {
|
|
6428
|
-
const tabbableItems =
|
|
6440
|
+
const tabbableItems = findTabbableElements(footerRef, SelectFooterTabbableItems);
|
|
6429
6441
|
// If no tabbable item in footer close select
|
|
6430
6442
|
if (tabbableItems.length <= 0) {
|
|
6431
6443
|
onToggle(false);
|
|
@@ -6434,14 +6446,30 @@
|
|
|
6434
6446
|
return;
|
|
6435
6447
|
}
|
|
6436
6448
|
else {
|
|
6437
|
-
// if current element is not in footer, tab to first tabbable element in footer
|
|
6438
|
-
const currentElementIndex = tabbableItems.findIndex(item => item === document.activeElement);
|
|
6449
|
+
// if current element is not in footer, tab to first tabbable element in footer, or close if shift clicked
|
|
6450
|
+
const currentElementIndex = tabbableItems.findIndex((item) => item === document.activeElement);
|
|
6439
6451
|
if (currentElementIndex === -1) {
|
|
6440
|
-
|
|
6441
|
-
|
|
6452
|
+
if (event.shiftKey) {
|
|
6453
|
+
if (variant !== 'checkbox') {
|
|
6454
|
+
// only close non checkbox variation on shift clicked
|
|
6455
|
+
onToggle(false);
|
|
6456
|
+
onClose();
|
|
6457
|
+
this.toggle.current.focus();
|
|
6458
|
+
}
|
|
6459
|
+
}
|
|
6460
|
+
else {
|
|
6461
|
+
// tab to footer
|
|
6462
|
+
tabbableItems[0].focus();
|
|
6463
|
+
return;
|
|
6464
|
+
}
|
|
6442
6465
|
}
|
|
6443
6466
|
// Current element is in footer.
|
|
6444
6467
|
if (event.shiftKey) {
|
|
6468
|
+
// Move focus back to menuif current tab index is 0
|
|
6469
|
+
if (currentElementIndex === 0) {
|
|
6470
|
+
moveFocusToLastMenuItem();
|
|
6471
|
+
event.preventDefault();
|
|
6472
|
+
}
|
|
6445
6473
|
return;
|
|
6446
6474
|
}
|
|
6447
6475
|
// Tab to next element in footer or close if there are none
|
|
@@ -6515,7 +6543,7 @@
|
|
|
6515
6543
|
}
|
|
6516
6544
|
render() {
|
|
6517
6545
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6518
|
-
const _a = this.props, { className, children, isOpen, isActive, isPlain, isDisabled, hasPlaceholderStyle, variant, onToggle, onEnter, onClose, onClickTypeaheadToggleButton, handleTypeaheadKeys, parentRef, menuRef, id, type, hasClearButton, 'aria-labelledby': ariaLabelledBy, 'aria-label': ariaLabel, hasFooter, footerRef } = _a, props = __rest$1(_a, ["className", "children", "isOpen", "isActive", "isPlain", "isDisabled", "hasPlaceholderStyle", "variant", "onToggle", "onEnter", "onClose", "onClickTypeaheadToggleButton", "handleTypeaheadKeys", "parentRef", "menuRef", "id", "type", "hasClearButton", 'aria-labelledby', 'aria-label', "hasFooter", "footerRef"]);
|
|
6546
|
+
const _a = this.props, { className, children, isOpen, isActive, isPlain, isDisabled, hasPlaceholderStyle, variant, onToggle, onEnter, onClose, onClickTypeaheadToggleButton, handleTypeaheadKeys, moveFocusToLastMenuItem, parentRef, menuRef, id, type, hasClearButton, 'aria-labelledby': ariaLabelledBy, 'aria-label': ariaLabel, hasFooter, footerRef } = _a, props = __rest$1(_a, ["className", "children", "isOpen", "isActive", "isPlain", "isDisabled", "hasPlaceholderStyle", "variant", "onToggle", "onEnter", "onClose", "onClickTypeaheadToggleButton", "handleTypeaheadKeys", "moveFocusToLastMenuItem", "parentRef", "menuRef", "id", "type", "hasClearButton", 'aria-labelledby', 'aria-label', "hasFooter", "footerRef"]);
|
|
6519
6547
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
6520
6548
|
const isTypeahead = variant === exports.SelectVariant.typeahead || variant === exports.SelectVariant.typeaheadMulti || hasClearButton;
|
|
6521
6549
|
const toggleProps = {
|
|
@@ -6978,9 +7006,37 @@
|
|
|
6978
7006
|
typeaheadInputValue
|
|
6979
7007
|
}));
|
|
6980
7008
|
};
|
|
6981
|
-
this.
|
|
7009
|
+
this.switchFocusToFavoriteMenu = () => {
|
|
7010
|
+
const { typeaheadCurrIndex, typeaheadStoredIndex } = this.state;
|
|
7011
|
+
let indexForFocus = 0;
|
|
7012
|
+
if (typeaheadCurrIndex !== -1) {
|
|
7013
|
+
indexForFocus = typeaheadCurrIndex;
|
|
7014
|
+
}
|
|
7015
|
+
else if (typeaheadStoredIndex !== -1) {
|
|
7016
|
+
indexForFocus = typeaheadStoredIndex;
|
|
7017
|
+
}
|
|
7018
|
+
if (this.refCollection[indexForFocus] !== null && this.refCollection[indexForFocus][0] !== null) {
|
|
7019
|
+
this.refCollection[indexForFocus][0].focus();
|
|
7020
|
+
}
|
|
7021
|
+
else {
|
|
7022
|
+
this.clearRef.current.focus();
|
|
7023
|
+
}
|
|
7024
|
+
this.setState({
|
|
7025
|
+
tabbedIntoFavoritesMenu: true,
|
|
7026
|
+
typeaheadCurrIndex: -1
|
|
7027
|
+
});
|
|
7028
|
+
};
|
|
7029
|
+
this.moveFocusToLastMenuItem = () => {
|
|
7030
|
+
const refCollectionLen = this.refCollection.length;
|
|
7031
|
+
if (refCollectionLen > 0 &&
|
|
7032
|
+
this.refCollection[refCollectionLen - 1] !== null &&
|
|
7033
|
+
this.refCollection[refCollectionLen - 1][0] !== null) {
|
|
7034
|
+
this.refCollection[refCollectionLen - 1][0].focus();
|
|
7035
|
+
}
|
|
7036
|
+
};
|
|
7037
|
+
this.handleTypeaheadKeys = (position, shiftKey = false) => {
|
|
6982
7038
|
const { isOpen, onFavorite } = this.props;
|
|
6983
|
-
const { typeaheadCurrIndex, tabbedIntoFavoritesMenu
|
|
7039
|
+
const { typeaheadCurrIndex, tabbedIntoFavoritesMenu } = this.state;
|
|
6984
7040
|
const typeaheadActiveChild = this.getTypeaheadActiveChild(typeaheadCurrIndex);
|
|
6985
7041
|
if (isOpen) {
|
|
6986
7042
|
if (position === 'enter') {
|
|
@@ -6998,32 +7054,127 @@
|
|
|
6998
7054
|
}
|
|
6999
7055
|
else if (position === 'tab') {
|
|
7000
7056
|
if (onFavorite) {
|
|
7057
|
+
// if the input has focus, tab to the first item or the last item that was previously focused.
|
|
7001
7058
|
if (this.inputRef.current === document.activeElement) {
|
|
7002
|
-
|
|
7003
|
-
if (
|
|
7004
|
-
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
this.refCollection[indexForFocus][0].focus();
|
|
7059
|
+
// If shift is also clicked and there is a footer, tab to the last item in tabbable footer
|
|
7060
|
+
if (this.props.footer && shiftKey) {
|
|
7061
|
+
const tabbableItems = findTabbableElements(this.footerRef, SelectFooterTabbableItems);
|
|
7062
|
+
if (tabbableItems.length > 0) {
|
|
7063
|
+
if (tabbableItems[tabbableItems.length - 1]) {
|
|
7064
|
+
tabbableItems[tabbableItems.length - 1].focus();
|
|
7065
|
+
}
|
|
7066
|
+
}
|
|
7011
7067
|
}
|
|
7012
7068
|
else {
|
|
7013
|
-
this.
|
|
7069
|
+
this.switchFocusToFavoriteMenu();
|
|
7014
7070
|
}
|
|
7015
|
-
this.setState({
|
|
7016
|
-
tabbedIntoFavoritesMenu: true,
|
|
7017
|
-
typeaheadCurrIndex: -1
|
|
7018
|
-
});
|
|
7019
7071
|
}
|
|
7020
7072
|
else {
|
|
7021
|
-
|
|
7022
|
-
this.
|
|
7073
|
+
// focus is on menu or footer
|
|
7074
|
+
if (this.props.footer) {
|
|
7075
|
+
let tabbedIntoMenu = false;
|
|
7076
|
+
const tabbableItems = findTabbableElements(this.footerRef, SelectFooterTabbableItems);
|
|
7077
|
+
if (tabbableItems.length > 0) {
|
|
7078
|
+
// if current element is not in footer, tab to first tabbable element in footer,
|
|
7079
|
+
// if shift was clicked, tab to input since focus is on menu
|
|
7080
|
+
const currentElementIndex = tabbableItems.findIndex((item) => item === document.activeElement);
|
|
7081
|
+
if (currentElementIndex === -1) {
|
|
7082
|
+
if (shiftKey) {
|
|
7083
|
+
// currently in menu, shift back to input
|
|
7084
|
+
this.inputRef.current.focus();
|
|
7085
|
+
}
|
|
7086
|
+
else {
|
|
7087
|
+
// currently in menu, tab to first tabbable item in footer
|
|
7088
|
+
tabbableItems[0].focus();
|
|
7089
|
+
}
|
|
7090
|
+
}
|
|
7091
|
+
else {
|
|
7092
|
+
// already in footer
|
|
7093
|
+
if (shiftKey) {
|
|
7094
|
+
// shift to previous item
|
|
7095
|
+
if (currentElementIndex === 0) {
|
|
7096
|
+
// on first footer item, shift back to menu
|
|
7097
|
+
this.switchFocusToFavoriteMenu();
|
|
7098
|
+
tabbedIntoMenu = true;
|
|
7099
|
+
}
|
|
7100
|
+
else {
|
|
7101
|
+
// shift to previous footer item
|
|
7102
|
+
tabbableItems[currentElementIndex - 1].focus();
|
|
7103
|
+
}
|
|
7104
|
+
}
|
|
7105
|
+
else {
|
|
7106
|
+
// tab to next tabbable item in footer or to input.
|
|
7107
|
+
if (tabbableItems[currentElementIndex + 1]) {
|
|
7108
|
+
tabbableItems[currentElementIndex + 1].focus();
|
|
7109
|
+
}
|
|
7110
|
+
else {
|
|
7111
|
+
this.inputRef.current.focus();
|
|
7112
|
+
}
|
|
7113
|
+
}
|
|
7114
|
+
}
|
|
7115
|
+
}
|
|
7116
|
+
else {
|
|
7117
|
+
// no tabbable items in footer, tab to input
|
|
7118
|
+
this.inputRef.current.focus();
|
|
7119
|
+
tabbedIntoMenu = false;
|
|
7120
|
+
}
|
|
7121
|
+
this.setState({ tabbedIntoFavoritesMenu: tabbedIntoMenu });
|
|
7122
|
+
}
|
|
7123
|
+
else {
|
|
7124
|
+
this.inputRef.current.focus();
|
|
7125
|
+
this.setState({ tabbedIntoFavoritesMenu: false });
|
|
7126
|
+
}
|
|
7023
7127
|
}
|
|
7024
7128
|
}
|
|
7025
7129
|
else {
|
|
7026
|
-
|
|
7130
|
+
// Close if there is no footer
|
|
7131
|
+
if (!this.props.footer) {
|
|
7132
|
+
this.onToggle(false);
|
|
7133
|
+
}
|
|
7134
|
+
else {
|
|
7135
|
+
// has footer
|
|
7136
|
+
const tabbableItems = findTabbableElements(this.footerRef, SelectFooterTabbableItems);
|
|
7137
|
+
const currentElementIndex = tabbableItems.findIndex((item) => item === document.activeElement);
|
|
7138
|
+
if (this.inputRef.current === document.activeElement) {
|
|
7139
|
+
if (shiftKey) {
|
|
7140
|
+
// close toggle if shift key and tab on input
|
|
7141
|
+
this.onToggle(false);
|
|
7142
|
+
}
|
|
7143
|
+
else {
|
|
7144
|
+
// tab to first tabbable item in footer
|
|
7145
|
+
if (tabbableItems[0]) {
|
|
7146
|
+
tabbableItems[0].focus();
|
|
7147
|
+
}
|
|
7148
|
+
else {
|
|
7149
|
+
this.onToggle(false);
|
|
7150
|
+
}
|
|
7151
|
+
}
|
|
7152
|
+
}
|
|
7153
|
+
else {
|
|
7154
|
+
// focus is in footer
|
|
7155
|
+
if (shiftKey) {
|
|
7156
|
+
if (currentElementIndex === 0) {
|
|
7157
|
+
// shift tab back to input
|
|
7158
|
+
this.inputRef.current.focus();
|
|
7159
|
+
}
|
|
7160
|
+
else {
|
|
7161
|
+
// shift to previous footer item
|
|
7162
|
+
tabbableItems[currentElementIndex - 1].focus();
|
|
7163
|
+
}
|
|
7164
|
+
}
|
|
7165
|
+
else {
|
|
7166
|
+
// tab to next footer item or close tab if last item
|
|
7167
|
+
if (tabbableItems[currentElementIndex + 1]) {
|
|
7168
|
+
tabbableItems[currentElementIndex + 1].focus();
|
|
7169
|
+
}
|
|
7170
|
+
else {
|
|
7171
|
+
// no next item, close toggle
|
|
7172
|
+
this.onToggle(false);
|
|
7173
|
+
this.inputRef.current.focus();
|
|
7174
|
+
}
|
|
7175
|
+
}
|
|
7176
|
+
}
|
|
7177
|
+
}
|
|
7027
7178
|
}
|
|
7028
7179
|
}
|
|
7029
7180
|
else if (!tabbedIntoFavoritesMenu) {
|
|
@@ -7180,13 +7331,13 @@
|
|
|
7180
7331
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7181
7332
|
onFilter,
|
|
7182
7333
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7183
|
-
onTypeaheadInputChanged, onCreateOption, isCreatable, onToggle, createText, noResultsFoundText, customBadgeText, inputIdPrefix,
|
|
7334
|
+
onTypeaheadInputChanged, onCreateOption, isCreatable, onToggle, createText, noResultsFoundText, customBadgeText, inputIdPrefix, inputAutoComplete,
|
|
7184
7335
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7185
7336
|
isInputValuePersisted, isInputFilterPersisted,
|
|
7186
7337
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
7187
7338
|
menuAppendTo, favorites, onFavorite,
|
|
7188
7339
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
7189
|
-
favoritesLabel, footer, loadingVariant, isCreateSelectOptionObject } = _a, props = __rest$1(_a, ["children", "chipGroupProps", "chipGroupComponent", "className", "customContent", "variant", "direction", "onSelect", "onClear", "toggleId", "isOpen", "isGrouped", "isPlain", "isDisabled", "hasPlaceholderStyle", "validated", "selections", "typeAheadAriaLabel", "clearSelectionsAriaLabel", "toggleAriaLabel", "removeSelectionAriaLabel", 'aria-label', 'aria-labelledby', 'aria-describedby', 'aria-invalid', "placeholderText", "width", "maxHeight", "toggleIcon", "ouiaId", "ouiaSafe", "hasInlineFilter", "isCheckboxSelectionBadgeHidden", "inlineFilterPlaceholderText", "onFilter", "onTypeaheadInputChanged", "onCreateOption", "isCreatable", "onToggle", "createText", "noResultsFoundText", "customBadgeText", "inputIdPrefix", "isInputValuePersisted", "isInputFilterPersisted", "menuAppendTo", "favorites", "onFavorite", "favoritesLabel", "footer", "loadingVariant", "isCreateSelectOptionObject"]);
|
|
7340
|
+
favoritesLabel, footer, loadingVariant, isCreateSelectOptionObject } = _a, props = __rest$1(_a, ["children", "chipGroupProps", "chipGroupComponent", "className", "customContent", "variant", "direction", "onSelect", "onClear", "toggleId", "isOpen", "isGrouped", "isPlain", "isDisabled", "hasPlaceholderStyle", "validated", "selections", "typeAheadAriaLabel", "clearSelectionsAriaLabel", "toggleAriaLabel", "removeSelectionAriaLabel", 'aria-label', 'aria-labelledby', 'aria-describedby', 'aria-invalid', "placeholderText", "width", "maxHeight", "toggleIcon", "ouiaId", "ouiaSafe", "hasInlineFilter", "isCheckboxSelectionBadgeHidden", "inlineFilterPlaceholderText", "onFilter", "onTypeaheadInputChanged", "onCreateOption", "isCreatable", "onToggle", "createText", "noResultsFoundText", "customBadgeText", "inputIdPrefix", "inputAutoComplete", "isInputValuePersisted", "isInputFilterPersisted", "menuAppendTo", "favorites", "onFavorite", "favoritesLabel", "footer", "loadingVariant", "isCreateSelectOptionObject"]);
|
|
7190
7341
|
const { focusFirstOption: openedOnEnter, typeaheadCurrIndex, typeaheadInputValue, typeaheadFilteredChildren, favoritesGroup } = this.state;
|
|
7191
7342
|
const selectToggleId = toggleId || `pf-select-toggle-id-${currentId$1++}`;
|
|
7192
7343
|
const selections = Array.isArray(selectionsProp) ? selectionsProp : [selectionsProp];
|
|
@@ -7224,11 +7375,11 @@
|
|
|
7224
7375
|
if (isOpen) {
|
|
7225
7376
|
if (renderableItems.find(item => { var _a; return ((_a = item) === null || _a === void 0 ? void 0 : _a.key) === 'loading'; }) === undefined) {
|
|
7226
7377
|
if (loadingVariant === 'spinner') {
|
|
7227
|
-
renderableItems.push(React__namespace.createElement(SelectOption, { isLoading: true, key: "loading", value: "loading"
|
|
7378
|
+
renderableItems.push(React__namespace.createElement(SelectOption, { isLoading: true, key: "loading", value: "loading" },
|
|
7228
7379
|
React__namespace.createElement(Spinner, { size: "lg" })));
|
|
7229
7380
|
}
|
|
7230
7381
|
else if (loadingVariant === null || loadingVariant === void 0 ? void 0 : loadingVariant.text) {
|
|
7231
|
-
renderableItems.push(React__namespace.createElement(SelectOption, { isLoad: true, key: "loading", value: loadingVariant.text,
|
|
7382
|
+
renderableItems.push(React__namespace.createElement(SelectOption, { isLoad: true, key: "loading", value: loadingVariant.text, setViewMoreNextIndex: this.setVieMoreNextIndex, onClick: loadingVariant === null || loadingVariant === void 0 ? void 0 : loadingVariant.onClick }));
|
|
7232
7383
|
}
|
|
7233
7384
|
}
|
|
7234
7385
|
}
|
|
@@ -7267,6 +7418,23 @@
|
|
|
7267
7418
|
this.handleMenuKeys(0, 0, 'right');
|
|
7268
7419
|
event.preventDefault();
|
|
7269
7420
|
}
|
|
7421
|
+
else if (event.key === KeyTypes.Tab && variant !== exports.SelectVariant.checkbox && this.props.footer) {
|
|
7422
|
+
// tab to footer or close menu if shift key
|
|
7423
|
+
if (event.shiftKey) {
|
|
7424
|
+
this.onToggle(false);
|
|
7425
|
+
}
|
|
7426
|
+
else {
|
|
7427
|
+
const tabbableItems = findTabbableElements(this.footerRef, SelectFooterTabbableItems);
|
|
7428
|
+
if (tabbableItems.length > 0) {
|
|
7429
|
+
tabbableItems[0].focus();
|
|
7430
|
+
event.stopPropagation();
|
|
7431
|
+
event.preventDefault();
|
|
7432
|
+
}
|
|
7433
|
+
else {
|
|
7434
|
+
this.onToggle(false);
|
|
7435
|
+
}
|
|
7436
|
+
}
|
|
7437
|
+
}
|
|
7270
7438
|
else if (event.key === KeyTypes.Tab && variant === exports.SelectVariant.checkbox) {
|
|
7271
7439
|
// More modal-like experience for checkboxes
|
|
7272
7440
|
// Let SelectOption handle this
|
|
@@ -7279,7 +7447,7 @@
|
|
|
7279
7447
|
event.stopPropagation();
|
|
7280
7448
|
event.preventDefault();
|
|
7281
7449
|
}
|
|
7282
|
-
}, ref: this.filterRef, autoComplete:
|
|
7450
|
+
}, ref: this.filterRef, autoComplete: inputAutoComplete })),
|
|
7283
7451
|
React__namespace.createElement(Divider, { key: "inline-filter-divider" })));
|
|
7284
7452
|
renderableItems = [filterBox, ...typeaheadFilteredChildren].map((option, index) => React__namespace.cloneElement(option, { key: index }));
|
|
7285
7453
|
}
|
|
@@ -7341,7 +7509,7 @@
|
|
|
7341
7509
|
" ") : innerMenu;
|
|
7342
7510
|
const popperContainer = (React__namespace.createElement("div", Object.assign({ className: css(_default$12.select, isOpen && _default$12.modifiers.expanded, validated === exports.ValidatedOptions.success && _default$12.modifiers.success, validated === exports.ValidatedOptions.warning && _default$12.modifiers.warning, validated === exports.ValidatedOptions.error && _default$12.modifiers.invalid, direction === exports.SelectDirection.up && _default$12.modifiers.top, className) }, (width && { style: { width } }), (validated !== exports.ValidatedOptions.default && { 'aria-describedby': ariaDescribedby }), (validated !== exports.ValidatedOptions.default && { 'aria-invalid': ariaInvalid })), isOpen && menuContainer));
|
|
7343
7511
|
const mainContainer = (React__namespace.createElement("div", Object.assign({ className: css(_default$12.select, isOpen && _default$12.modifiers.expanded, validated === exports.ValidatedOptions.success && _default$12.modifiers.success, validated === exports.ValidatedOptions.warning && _default$12.modifiers.warning, validated === exports.ValidatedOptions.error && _default$12.modifiers.invalid, direction === exports.SelectDirection.up && _default$12.modifiers.top, className), ref: this.parentRef }, getOUIAProps(Select.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), (width && { style: { width } }), (validated !== exports.ValidatedOptions.default && { 'aria-describedby': ariaDescribedby }), (validated !== exports.ValidatedOptions.default && { 'aria-invalid': ariaInvalid })),
|
|
7344
|
-
React__namespace.createElement(SelectToggle, Object.assign({ id: selectToggleId, parentRef: this.parentRef, menuRef: this.menuComponentRef }, (footer && { footerRef: this.footerRef }), { isOpen: isOpen, isPlain: isPlain, hasPlaceholderStyle: hasPlaceholderStyle && (!selections.length || selections[0] === null || isSelectedPlaceholder), onToggle: this.onToggle, onEnter: this.onEnter, onClose: this.onClose, variant: variant, "aria-labelledby": `${ariaLabelledBy || ''} ${selectToggleId}`, "aria-label": toggleAriaLabel, handleTypeaheadKeys: this.handleTypeaheadKeys, isDisabled: isDisabled, hasClearButton: hasOnClear, hasFooter: footer !== undefined, onClickTypeaheadToggleButton: this.onClickTypeaheadToggleButton }),
|
|
7512
|
+
React__namespace.createElement(SelectToggle, Object.assign({ id: selectToggleId, parentRef: this.parentRef, menuRef: this.menuComponentRef }, (footer && { footerRef: this.footerRef }), { isOpen: isOpen, isPlain: isPlain, hasPlaceholderStyle: hasPlaceholderStyle && (!selections.length || selections[0] === null || isSelectedPlaceholder), onToggle: this.onToggle, onEnter: this.onEnter, onClose: this.onClose, variant: variant, "aria-labelledby": `${ariaLabelledBy || ''} ${selectToggleId}`, "aria-label": toggleAriaLabel, handleTypeaheadKeys: this.handleTypeaheadKeys, moveFocusToLastMenuItem: this.moveFocusToLastMenuItem, isDisabled: isDisabled, hasClearButton: hasOnClear, hasFooter: footer !== undefined, onClickTypeaheadToggleButton: this.onClickTypeaheadToggleButton }),
|
|
7345
7513
|
customContent && (React__namespace.createElement("div", { className: css(_default$12.selectToggleWrapper) },
|
|
7346
7514
|
toggleIcon && React__namespace.createElement("span", { className: css(_default$12.selectToggleIcon) }, toggleIcon),
|
|
7347
7515
|
React__namespace.createElement("span", { className: css(_default$12.selectToggleText) }, placeholderText))),
|
|
@@ -7362,13 +7530,13 @@
|
|
|
7362
7530
|
toggleIcon && React__namespace.createElement("span", { className: css(_default$12.selectToggleIcon) }, toggleIcon),
|
|
7363
7531
|
React__namespace.createElement("input", { className: css(_default$1b.formControl, _default$12.selectToggleTypeahead), "aria-activedescendant": typeaheadActiveChild && typeaheadActiveChild.id, id: `${selectToggleId}-select-typeahead`, "aria-label": typeAheadAriaLabel, placeholder: placeholderText, value: typeaheadInputValue !== null
|
|
7364
7532
|
? typeaheadInputValue
|
|
7365
|
-
: this.getDisplay(selections[0], 'text') || '', type: "text", onClick: this.onClick, onChange: this.onChange, autoComplete:
|
|
7533
|
+
: this.getDisplay(selections[0], 'text') || '', type: "text", onClick: this.onClick, onChange: this.onChange, autoComplete: inputAutoComplete, disabled: isDisabled, ref: this.inputRef })),
|
|
7366
7534
|
hasOnClear && (selections[0] || typeaheadInputValue) && clearBtn)),
|
|
7367
7535
|
variant === exports.SelectVariant.typeaheadMulti && !customContent && (React__namespace.createElement(React__namespace.Fragment, null,
|
|
7368
7536
|
React__namespace.createElement("div", { className: css(_default$12.selectToggleWrapper) },
|
|
7369
7537
|
toggleIcon && React__namespace.createElement("span", { className: css(_default$12.selectToggleIcon) }, toggleIcon),
|
|
7370
7538
|
selections && Array.isArray(selections) && selections.length > 0 && selectedChips,
|
|
7371
|
-
React__namespace.createElement("input", { className: css(_default$1b.formControl, _default$12.selectToggleTypeahead), "aria-activedescendant": typeaheadActiveChild && typeaheadActiveChild.id, id: `${selectToggleId}-select-multi-typeahead-typeahead`, "aria-label": typeAheadAriaLabel, "aria-invalid": validated === exports.ValidatedOptions.error, placeholder: placeholderText, value: typeaheadInputValue !== null ? typeaheadInputValue : '', type: "text", onChange: this.onChange, onClick: this.onClick, autoComplete:
|
|
7539
|
+
React__namespace.createElement("input", { className: css(_default$1b.formControl, _default$12.selectToggleTypeahead), "aria-activedescendant": typeaheadActiveChild && typeaheadActiveChild.id, id: `${selectToggleId}-select-multi-typeahead-typeahead`, "aria-label": typeAheadAriaLabel, "aria-invalid": validated === exports.ValidatedOptions.error, placeholder: placeholderText, value: typeaheadInputValue !== null ? typeaheadInputValue : '', type: "text", onChange: this.onChange, onClick: this.onClick, autoComplete: inputAutoComplete, disabled: isDisabled, ref: this.inputRef })),
|
|
7372
7540
|
hasOnClear && ((selections && selections.length > 0) || typeaheadInputValue) && clearBtn)),
|
|
7373
7541
|
validated === exports.ValidatedOptions.success && (React__namespace.createElement("span", { className: css(_default$12.selectToggleStatusIcon) },
|
|
7374
7542
|
React__namespace.createElement(CheckCircleIcon$1, { "aria-hidden": "true" }))),
|
|
@@ -7424,6 +7592,7 @@
|
|
|
7424
7592
|
inlineFilterPlaceholderText: null,
|
|
7425
7593
|
customBadgeText: null,
|
|
7426
7594
|
inputIdPrefix: '',
|
|
7595
|
+
inputAutoComplete: navigator.userAgent.match('Chrome') ? getUniqueId('pf-no-autocomplete') : 'off',
|
|
7427
7596
|
menuAppendTo: 'inline',
|
|
7428
7597
|
favorites: [],
|
|
7429
7598
|
favoritesLabel: 'Favorites',
|
|
@@ -21152,6 +21321,7 @@
|
|
|
21152
21321
|
exports.Select = Select;
|
|
21153
21322
|
exports.SelectConsumer = SelectConsumer;
|
|
21154
21323
|
exports.SelectContext = SelectContext;
|
|
21324
|
+
exports.SelectFooterTabbableItems = SelectFooterTabbableItems;
|
|
21155
21325
|
exports.SelectGroup = SelectGroup;
|
|
21156
21326
|
exports.SelectOption = SelectOption;
|
|
21157
21327
|
exports.SelectProvider = SelectProvider;
|
|
@@ -21227,6 +21397,7 @@
|
|
|
21227
21397
|
exports.clipboardCopyFunc = clipboardCopyFunc;
|
|
21228
21398
|
exports.debounce = debounce$1;
|
|
21229
21399
|
exports.fillTemplate = fillTemplate;
|
|
21400
|
+
exports.findTabbableElements = findTabbableElements;
|
|
21230
21401
|
exports.formatBreakpointMods = formatBreakpointMods;
|
|
21231
21402
|
exports.getBreakpoint = getBreakpoint;
|
|
21232
21403
|
exports.getDefaultOUIAId = getDefaultOUIAId;
|
|
@@ -16379,20 +16379,6 @@ label.pf-c-radio, .pf-c-radio__label,
|
|
|
16379
16379
|
margin-top: var(--pf-c-simple-list__section--section--MarginTop);
|
|
16380
16380
|
}
|
|
16381
16381
|
|
|
16382
|
-
.pf-c-skip-to-content {
|
|
16383
|
-
--pf-c-skip-to-content--Top: var(--pf-global--spacer--md);
|
|
16384
|
-
--pf-c-skip-to-content--ZIndex: var(--pf-global--ZIndex--2xl);
|
|
16385
|
-
--pf-c-skip-to-content--focus--Left: var(--pf-global--spacer--md);
|
|
16386
|
-
position: absolute;
|
|
16387
|
-
top: var(--pf-c-skip-to-content--Top);
|
|
16388
|
-
left: -300%;
|
|
16389
|
-
z-index: var(--pf-c-skip-to-content--ZIndex);
|
|
16390
|
-
}
|
|
16391
|
-
|
|
16392
|
-
.pf-c-skip-to-content:focus {
|
|
16393
|
-
left: var(--pf-c-skip-to-content--focus--Left);
|
|
16394
|
-
}
|
|
16395
|
-
|
|
16396
16382
|
.pf-c-skeleton {
|
|
16397
16383
|
--pf-c-skeleton--BackgroundColor: var(--pf-global--palette--black-150);
|
|
16398
16384
|
--pf-c-skeleton--Width: auto;
|
|
@@ -16582,6 +16568,20 @@ label.pf-c-radio, .pf-c-radio__label,
|
|
|
16582
16568
|
transform: translateX(100%);
|
|
16583
16569
|
}
|
|
16584
16570
|
}
|
|
16571
|
+
.pf-c-skip-to-content {
|
|
16572
|
+
--pf-c-skip-to-content--Top: var(--pf-global--spacer--md);
|
|
16573
|
+
--pf-c-skip-to-content--ZIndex: var(--pf-global--ZIndex--2xl);
|
|
16574
|
+
--pf-c-skip-to-content--focus--Left: var(--pf-global--spacer--md);
|
|
16575
|
+
position: absolute;
|
|
16576
|
+
top: var(--pf-c-skip-to-content--Top);
|
|
16577
|
+
left: -300%;
|
|
16578
|
+
z-index: var(--pf-c-skip-to-content--ZIndex);
|
|
16579
|
+
}
|
|
16580
|
+
|
|
16581
|
+
.pf-c-skip-to-content:focus {
|
|
16582
|
+
left: var(--pf-c-skip-to-content--focus--Left);
|
|
16583
|
+
}
|
|
16584
|
+
|
|
16585
16585
|
.pf-c-slider {
|
|
16586
16586
|
--pf-c-slider--value: 0;
|
|
16587
16587
|
--pf-c-slider__rail--PaddingTop: var(--pf-global--spacer--md);
|