@patternfly/react-table 4.89.2 → 4.90.2

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/esm/components/Table/base/provider.d.ts +3 -3
  3. package/dist/esm/components/Table/base/types.d.ts +3 -3
  4. package/dist/esm/components/TableComposable/TableComposable.d.ts +10 -1
  5. package/dist/esm/components/TableComposable/TableComposable.d.ts.map +1 -1
  6. package/dist/esm/components/TableComposable/TableComposable.js +23 -2
  7. package/dist/esm/components/TableComposable/TableComposable.js.map +1 -1
  8. package/dist/esm/components/TableComposable/Tr.d.ts +3 -1
  9. package/dist/esm/components/TableComposable/Tr.d.ts.map +1 -1
  10. package/dist/esm/components/TableComposable/Tr.js +18 -2
  11. package/dist/esm/components/TableComposable/Tr.js.map +1 -1
  12. package/dist/js/components/Table/base/provider.d.ts +3 -3
  13. package/dist/js/components/Table/base/types.d.ts +3 -3
  14. package/dist/js/components/TableComposable/TableComposable.d.ts +10 -1
  15. package/dist/js/components/TableComposable/TableComposable.d.ts.map +1 -1
  16. package/dist/js/components/TableComposable/TableComposable.js +24 -3
  17. package/dist/js/components/TableComposable/TableComposable.js.map +1 -1
  18. package/dist/js/components/TableComposable/Tr.d.ts +3 -1
  19. package/dist/js/components/TableComposable/Tr.d.ts.map +1 -1
  20. package/dist/js/components/TableComposable/Tr.js +18 -2
  21. package/dist/js/components/TableComposable/Tr.js.map +1 -1
  22. package/dist/umd/react-table.css +861 -71
  23. package/dist/umd/react-table.js +91 -22
  24. package/dist/umd/react-table.min.css +2656 -1866
  25. package/dist/umd/react-table.min.js +6 -6
  26. package/package.json +6 -6
  27. package/src/components/TableComposable/TableComposable.tsx +67 -22
  28. package/src/components/TableComposable/Tr.tsx +45 -20
  29. package/src/components/TableComposable/examples/ComposableTableHoverable.tsx +2 -1
  30. package/src/demos/Table.md +5 -0
  31. package/src/demos/table-demos/StickyFirstColumn.jsx +210 -0
@@ -130,7 +130,7 @@
130
130
  };
131
131
 
132
132
  /*!
133
- * tabbable 5.3.2
133
+ * tabbable 5.3.3
134
134
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
135
135
  */
136
136
  var candidateSelectors = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]:not(slot)', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable="false"])', 'details>summary:first-of-type', 'details'];
@@ -165,6 +165,12 @@
165
165
  * @returns {ShadowRoot|boolean} ShadowRoot if available or boolean indicating if a shadowRoot is attached but not available.
166
166
  */
167
167
 
168
+ /**
169
+ * @callback ShadowRootFilter
170
+ * @param {Element} shadowHostNode the element which contains shadow content
171
+ * @returns {boolean} true if a shadow root could potentially contain valid candidates.
172
+ */
173
+
168
174
  /**
169
175
  * @typedef {Object} CandidatesScope
170
176
  * @property {Element} scope contains inner candidates
@@ -178,6 +184,7 @@
178
184
  * or a boolean stating if it has an undisclosed shadow root
179
185
  * @property {(node: Element) => boolean} filter filter candidates
180
186
  * @property {boolean} flatten if true then result will flatten any CandidatesScope into the returned list
187
+ * @property {ShadowRootFilter} shadowRootFilter filter shadow roots;
181
188
  */
182
189
 
183
190
  /**
@@ -220,8 +227,9 @@
220
227
 
221
228
  var shadowRoot = element.shadowRoot || // check for an undisclosed shadow
222
229
  typeof options.getShadowRoot === 'function' && options.getShadowRoot(element);
230
+ var validShadowRoot = !options.shadowRootFilter || options.shadowRootFilter(element);
223
231
 
224
- if (shadowRoot) {
232
+ if (shadowRoot && validShadowRoot) {
225
233
  // add shadow dom scope IIF a shadow root node was given; otherwise, an undisclosed
226
234
  // shadow exists, so look at light dom children as fallback BUT create a scope for any
227
235
  // child candidates found because they're likely slotted elements (elements that are
@@ -502,6 +510,18 @@
502
510
 
503
511
  return true;
504
512
  };
513
+
514
+ var isValidShadowRootTabbable = function isValidShadowRootTabbable(shadowHostNode) {
515
+ var tabIndex = parseInt(shadowHostNode.getAttribute('tabindex'), 10);
516
+
517
+ if (isNaN(tabIndex) || tabIndex >= 0) {
518
+ return true;
519
+ } // If a custom element has an explicit negative tabindex,
520
+ // browsers will not allow tab targeting said element's children.
521
+
522
+
523
+ return false;
524
+ };
505
525
  /**
506
526
  * @param {Array.<Element|CandidatesScope>} candidates
507
527
  * @returns Element[]
@@ -543,7 +563,8 @@
543
563
  candidates = getCandidatesIteratively([el], options.includeContainer, {
544
564
  filter: isNodeMatchingSelectorTabbable.bind(null, options),
545
565
  flatten: false,
546
- getShadowRoot: options.getShadowRoot
566
+ getShadowRoot: options.getShadowRoot,
567
+ shadowRootFilter: isValidShadowRootTabbable
547
568
  });
548
569
  } else {
549
570
  candidates = getCandidates(el, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
@@ -4016,7 +4037,8 @@
4016
4037
  "end": "pf-m-end",
4017
4038
  "overpassFont": "pf-m-overpass-font"
4018
4039
  },
4019
- "spinner": "pf-c-spinner"
4040
+ "spinner": "pf-c-spinner",
4041
+ "themeDark": "pf-theme-dark"
4020
4042
  };
4021
4043
 
4022
4044
  Promise.resolve().then(function () { return spinner; });
@@ -4250,6 +4272,7 @@
4250
4272
  "rightBottom": "pf-m-right-bottom",
4251
4273
  "textAlignLeft": "pf-m-text-align-left"
4252
4274
  },
4275
+ "themeDark": "pf-theme-dark",
4253
4276
  "tooltip": "pf-c-tooltip",
4254
4277
  "tooltipArrow": "pf-c-tooltip__arrow",
4255
4278
  "tooltipContent": "pf-c-tooltip__content"
@@ -4425,7 +4448,8 @@
4425
4448
  "placeholder": "pf-m-placeholder",
4426
4449
  "resizeVertical": "pf-m-resize-vertical",
4427
4450
  "resizeHorizontal": "pf-m-resize-horizontal"
4428
- }
4451
+ },
4452
+ "themeDark": "pf-theme-dark"
4429
4453
  };
4430
4454
 
4431
4455
  Promise.resolve().then(function () { return dropdown; });
@@ -4475,7 +4499,8 @@
4475
4499
  "ariaDisabled": "pf-m-aria-disabled",
4476
4500
  "icon": "pf-m-icon",
4477
4501
  "description": "pf-m-description"
4478
- }
4502
+ },
4503
+ "themeDark": "pf-theme-dark"
4479
4504
  };
4480
4505
 
4481
4506
  var DropdownPosition;
@@ -5092,7 +5117,8 @@
5092
5117
  "modifiers": {
5093
5118
  "read": "pf-m-read",
5094
5119
  "unread": "pf-m-unread"
5095
- }
5120
+ },
5121
+ "themeDark": "pf-theme-dark"
5096
5122
  };
5097
5123
 
5098
5124
  const EllipsisVIconConfig = {
@@ -5361,7 +5387,8 @@
5361
5387
  "selectToggleStatusIcon": "pf-c-select__toggle-status-icon",
5362
5388
  "selectToggleText": "pf-c-select__toggle-text",
5363
5389
  "selectToggleTypeahead": "pf-c-select__toggle-typeahead",
5364
- "selectToggleWrapper": "pf-c-select__toggle-wrapper"
5390
+ "selectToggleWrapper": "pf-c-select__toggle-wrapper",
5391
+ "themeDark": "pf-theme-dark"
5365
5392
  };
5366
5393
 
5367
5394
  const TimesCircleIconConfig = {
@@ -5428,7 +5455,8 @@
5428
5455
  "inactive": "pf-m-inactive",
5429
5456
  "hidden": "pf-m-hidden",
5430
5457
  "expanded": "pf-m-expanded"
5431
- }
5458
+ },
5459
+ "themeDark": "pf-theme-dark"
5432
5460
  };
5433
5461
 
5434
5462
  Promise.resolve().then(function () { return check; });
@@ -6046,7 +6074,8 @@
6046
6074
  "modifiers": {
6047
6075
  "overflow": "pf-m-overflow",
6048
6076
  "draggable": "pf-m-draggable"
6049
- }
6077
+ },
6078
+ "themeDark": "pf-theme-dark"
6050
6079
  };
6051
6080
 
6052
6081
  class Chip extends React__namespace.Component {
@@ -6785,7 +6814,7 @@
6785
6814
  });
6786
6815
  }
6787
6816
  render() {
6788
- const _a = this.props, { children, chipGroupProps, chipGroupComponent, className, customContent, variant, direction, onSelect, onClear, onBlur, toggleId, isOpen, isGrouped, isPlain, isDisabled, hasPlaceholderStyle, validated, selections: selectionsProp, typeAheadAriaLabel, clearSelectionsAriaLabel, toggleAriaLabel, removeSelectionAriaLabel, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedby, 'aria-invalid': ariaInvalid, placeholderText, width, maxHeight, toggleIcon, ouiaId, ouiaSafe, hasInlineFilter, isCheckboxSelectionBadgeHidden, inlineFilterPlaceholderText,
6817
+ const _a = this.props, { children, chipGroupProps, chipGroupComponent, className, customContent, variant, direction, onSelect, onClear, onBlur, toggleId, isOpen, isGrouped, isPlain, isDisabled, hasPlaceholderStyle, validated, selections: selectionsProp, typeAheadAriaLabel, typeAheadAriaDescribedby, clearSelectionsAriaLabel, toggleAriaLabel, removeSelectionAriaLabel, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedby, 'aria-invalid': ariaInvalid, placeholderText, width, maxHeight, toggleIcon, ouiaId, ouiaSafe, hasInlineFilter, isCheckboxSelectionBadgeHidden, inlineFilterPlaceholderText,
6789
6818
  /* eslint-disable @typescript-eslint/no-unused-vars */
6790
6819
  onFilter,
6791
6820
  /* eslint-disable @typescript-eslint/no-unused-vars */
@@ -6795,7 +6824,7 @@
6795
6824
  /* eslint-enable @typescript-eslint/no-unused-vars */
6796
6825
  menuAppendTo, favorites, onFavorite,
6797
6826
  /* eslint-disable @typescript-eslint/no-unused-vars */
6798
- favoritesLabel, footer, loadingVariant, isCreateSelectOptionObject, shouldResetOnSelect, isFlipEnabled } = _a, props = __rest$1(_a, ["children", "chipGroupProps", "chipGroupComponent", "className", "customContent", "variant", "direction", "onSelect", "onClear", "onBlur", "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", "shouldResetOnSelect", "isFlipEnabled"]);
6827
+ favoritesLabel, footer, loadingVariant, isCreateSelectOptionObject, shouldResetOnSelect, isFlipEnabled } = _a, props = __rest$1(_a, ["children", "chipGroupProps", "chipGroupComponent", "className", "customContent", "variant", "direction", "onSelect", "onClear", "onBlur", "toggleId", "isOpen", "isGrouped", "isPlain", "isDisabled", "hasPlaceholderStyle", "validated", "selections", "typeAheadAriaLabel", "typeAheadAriaDescribedby", "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", "shouldResetOnSelect", "isFlipEnabled"]);
6799
6828
  const { focusFirstOption: openedOnEnter, typeaheadCurrIndex, typeaheadInputValue, typeaheadFilteredChildren, favoritesGroup } = this.state;
6800
6829
  const selectToggleId = toggleId || `pf-select-toggle-id-${currentId++}`;
6801
6830
  const selections = Array.isArray(selectionsProp) ? selectionsProp : [selectionsProp];
@@ -6969,8 +6998,8 @@
6969
6998
  " ",
6970
6999
  innerMenu,
6971
7000
  " ") : innerMenu;
6972
- const popperContainer = (React__namespace.createElement("div", Object.assign({ className: css(styles$6.select, isOpen && styles$6.modifiers.expanded, validated === ValidatedOptions.success && styles$6.modifiers.success, validated === ValidatedOptions.warning && styles$6.modifiers.warning, validated === ValidatedOptions.error && styles$6.modifiers.invalid, direction === SelectDirection.up && styles$6.modifiers.top, className) }, (width && { style: { width } }), (validated !== ValidatedOptions.default && { 'aria-describedby': ariaDescribedby }), (validated !== ValidatedOptions.default && { 'aria-invalid': ariaInvalid })), isOpen && menuContainer));
6973
- const mainContainer = (React__namespace.createElement("div", Object.assign({ className: css(styles$6.select, isOpen && styles$6.modifiers.expanded, validated === ValidatedOptions.success && styles$6.modifiers.success, validated === ValidatedOptions.warning && styles$6.modifiers.warning, validated === ValidatedOptions.error && styles$6.modifiers.invalid, direction === SelectDirection.up && styles$6.modifiers.top, className), ref: this.parentRef }, getOUIAProps(Select.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), (width && { style: { width } }), (validated !== ValidatedOptions.default && { 'aria-describedby': ariaDescribedby }), (validated !== ValidatedOptions.default && { 'aria-invalid': ariaInvalid })),
7001
+ const popperContainer = (React__namespace.createElement("div", Object.assign({ className: css(styles$6.select, isOpen && styles$6.modifiers.expanded, validated === ValidatedOptions.success && styles$6.modifiers.success, validated === ValidatedOptions.warning && styles$6.modifiers.warning, validated === ValidatedOptions.error && styles$6.modifiers.invalid, direction === SelectDirection.up && styles$6.modifiers.top, className) }, (width && { style: { width } }), (ariaDescribedby && { 'aria-describedby': ariaDescribedby }), (validated !== ValidatedOptions.default && { 'aria-invalid': ariaInvalid })), isOpen && menuContainer));
7002
+ const mainContainer = (React__namespace.createElement("div", Object.assign({ className: css(styles$6.select, isOpen && styles$6.modifiers.expanded, validated === ValidatedOptions.success && styles$6.modifiers.success, validated === ValidatedOptions.warning && styles$6.modifiers.warning, validated === ValidatedOptions.error && styles$6.modifiers.invalid, direction === SelectDirection.up && styles$6.modifiers.top, className), ref: this.parentRef }, getOUIAProps(Select.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), (width && { style: { width } }), (ariaDescribedby && { 'aria-describedby': ariaDescribedby }), (validated !== ValidatedOptions.default && { 'aria-invalid': ariaInvalid })),
6974
7003
  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, onBlur: onBlur, 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 }),
6975
7004
  customContent && (React__namespace.createElement("div", { className: css(styles$6.selectToggleWrapper) },
6976
7005
  toggleIcon && React__namespace.createElement("span", { className: css(styles$6.selectToggleIcon) }, toggleIcon),
@@ -6990,15 +7019,15 @@
6990
7019
  variant === SelectVariant.typeahead && !customContent && (React__namespace.createElement(React__namespace.Fragment, null,
6991
7020
  React__namespace.createElement("div", { className: css(styles$6.selectToggleWrapper) },
6992
7021
  toggleIcon && React__namespace.createElement("span", { className: css(styles$6.selectToggleIcon) }, toggleIcon),
6993
- React__namespace.createElement("input", { className: css(formStyles$1.formControl, styles$6.selectToggleTypeahead), "aria-activedescendant": typeaheadActiveChild && typeaheadActiveChild.id, id: `${selectToggleId}-select-typeahead`, "aria-label": typeAheadAriaLabel, placeholder: placeholderText, value: typeaheadInputValue !== null
7022
+ React__namespace.createElement("input", Object.assign({ className: css(formStyles$1.formControl, styles$6.selectToggleTypeahead), "aria-activedescendant": typeaheadActiveChild && typeaheadActiveChild.id, id: `${selectToggleId}-select-typeahead`, "aria-label": typeAheadAriaLabel }, (typeAheadAriaDescribedby && { 'aria-describedby': typeAheadAriaDescribedby }), { placeholder: placeholderText, value: typeaheadInputValue !== null
6994
7023
  ? typeaheadInputValue
6995
- : this.getDisplay(selections[0], 'text') || '', type: "text", onClick: this.onClick, onChange: this.onChange, autoComplete: inputAutoComplete, disabled: isDisabled, ref: this.inputRef })),
7024
+ : this.getDisplay(selections[0], 'text') || '', type: "text", onClick: this.onClick, onChange: this.onChange, autoComplete: inputAutoComplete, disabled: isDisabled, ref: this.inputRef }))),
6996
7025
  hasOnClear && (selections[0] || typeaheadInputValue) && clearBtn)),
6997
7026
  variant === SelectVariant.typeaheadMulti && !customContent && (React__namespace.createElement(React__namespace.Fragment, null,
6998
7027
  React__namespace.createElement("div", { className: css(styles$6.selectToggleWrapper) },
6999
7028
  toggleIcon && React__namespace.createElement("span", { className: css(styles$6.selectToggleIcon) }, toggleIcon),
7000
7029
  selections && Array.isArray(selections) && selections.length > 0 && selectedChips,
7001
- React__namespace.createElement("input", { className: css(formStyles$1.formControl, styles$6.selectToggleTypeahead), "aria-activedescendant": typeaheadActiveChild && typeaheadActiveChild.id, id: `${selectToggleId}-select-multi-typeahead-typeahead`, "aria-label": typeAheadAriaLabel, "aria-invalid": validated === ValidatedOptions.error, placeholder: placeholderText, value: typeaheadInputValue !== null ? typeaheadInputValue : '', type: "text", onChange: this.onChange, onClick: this.onClick, autoComplete: inputAutoComplete, disabled: isDisabled, ref: this.inputRef })),
7030
+ React__namespace.createElement("input", Object.assign({ className: css(formStyles$1.formControl, styles$6.selectToggleTypeahead), "aria-activedescendant": typeaheadActiveChild && typeaheadActiveChild.id, id: `${selectToggleId}-select-multi-typeahead-typeahead`, "aria-label": typeAheadAriaLabel, "aria-invalid": validated === ValidatedOptions.error }, (typeAheadAriaDescribedby && { 'aria-describedby': typeAheadAriaDescribedby }), { placeholder: placeholderText, value: typeaheadInputValue !== null ? typeaheadInputValue : '', type: "text", onChange: this.onChange, onClick: this.onClick, autoComplete: inputAutoComplete, disabled: isDisabled, ref: this.inputRef }))),
7002
7031
  hasOnClear && ((selections && selections.length > 0) || typeaheadInputValue) && clearBtn)),
7003
7032
  validated === ValidatedOptions.success && (React__namespace.createElement("span", { className: css(styles$6.selectToggleStatusIcon) },
7004
7033
  React__namespace.createElement(CheckCircleIcon$1, { "aria-hidden": "true" }))),
@@ -7042,6 +7071,7 @@
7042
7071
  'aria-describedby': '',
7043
7072
  'aria-invalid': false,
7044
7073
  typeAheadAriaLabel: '',
7074
+ typeAheadAriaDescribedby: '',
7045
7075
  clearSelectionsAriaLabel: 'Clear all',
7046
7076
  toggleAriaLabel: 'Options menu',
7047
7077
  removeSelectionAriaLabel: 'Remove',
@@ -7154,6 +7184,7 @@
7154
7184
  "popoverTitle": "pf-c-popover__title",
7155
7185
  "popoverTitleIcon": "pf-c-popover__title-icon",
7156
7186
  "popoverTitleText": "pf-c-popover__title-text",
7187
+ "themeDark": "pf-theme-dark",
7157
7188
  "title": "pf-c-title"
7158
7189
  };
7159
7190
 
@@ -7597,7 +7628,8 @@
7597
7628
  "tableSubhead": "pf-c-table__subhead",
7598
7629
  "tableText": "pf-c-table__text",
7599
7630
  "tableToggle": "pf-c-table__toggle",
7600
- "tableToggleIcon": "pf-c-table__toggle-icon"
7631
+ "tableToggleIcon": "pf-c-table__toggle-icon",
7632
+ "themeDark": "pf-theme-dark"
7601
7633
  };
7602
7634
 
7603
7635
  Promise.resolve().then(function () { return tableGrid; });
@@ -7786,12 +7818,17 @@
7786
7818
  TableVariant["compact"] = "compact";
7787
7819
  })(exports.TableVariant || (exports.TableVariant = {}));
7788
7820
 
7821
+ const TableComposableContext = React__namespace.createContext({
7822
+ registerSelectableRow: () => { }
7823
+ });
7789
7824
  const TableComposableBase = (_a) => {
7790
7825
  var _b, _c;
7791
7826
  var { children, className, variant, borders = true, isStickyHeader = false, gridBreakPoint = exports.TableGridBreakpoint.gridMd, 'aria-label': ariaLabel, role = 'grid', innerRef, ouiaId, ouiaSafe = true, isTreeTable = false, isNested = false, isStriped = false, isExpandable = false,
7792
7827
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
7793
- nestedHeaderColumnSpans } = _a, props = __rest$2(_a, ["children", "className", "variant", "borders", "isStickyHeader", "gridBreakPoint", 'aria-label', "role", "innerRef", "ouiaId", "ouiaSafe", "isTreeTable", "isNested", "isStriped", "isExpandable", "nestedHeaderColumnSpans"]);
7828
+ nestedHeaderColumnSpans, hasSelectableRowCaption, selectableRowCaptionText } = _a, props = __rest$2(_a, ["children", "className", "variant", "borders", "isStickyHeader", "gridBreakPoint", 'aria-label', "role", "innerRef", "ouiaId", "ouiaSafe", "isTreeTable", "isNested", "isStriped", "isExpandable", "nestedHeaderColumnSpans", "hasSelectableRowCaption", "selectableRowCaptionText"]);
7794
7829
  const tableRef = innerRef || React__namespace.useRef(null);
7830
+ const [hasSelectableRows, setHasSelectableRows] = React__namespace.useState(false);
7831
+ const [tableCaption, setTableCaption] = React__namespace.useState();
7795
7832
  React__namespace.useEffect(() => {
7796
7833
  document.addEventListener('keydown', handleKeys);
7797
7834
  // sets up roving tab-index to tree tables only
@@ -7803,6 +7840,16 @@
7803
7840
  document.removeEventListener('keydown', handleKeys);
7804
7841
  };
7805
7842
  }, [tableRef, tableRef.current]);
7843
+ React__namespace.useEffect(() => {
7844
+ if (selectableRowCaptionText) {
7845
+ setTableCaption(React__namespace.createElement("caption", null,
7846
+ selectableRowCaptionText,
7847
+ React__namespace.createElement("div", { className: "pf-screen-reader" }, "This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space or enter.")));
7848
+ }
7849
+ else {
7850
+ setTableCaption(React__namespace.createElement("caption", { className: "pf-screen-reader" }, "This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space or enter."));
7851
+ }
7852
+ }, [selectableRowCaptionText]);
7806
7853
  const ouiaProps = useOUIAProps('Table', ouiaId, ouiaSafe);
7807
7854
  const grid = (_b = stylesGrid.modifiers) === null || _b === void 0 ? void 0 : _b[toCamel(gridBreakPoint || '').replace(/-?2xl/, '_2xl')];
7808
7855
  const breakPointPrefix = `treeView${gridBreakPoint.charAt(0).toUpperCase() + gridBreakPoint.slice(1)}`;
@@ -7823,7 +7870,13 @@
7823
7870
  const getFocusableElement = (element) => element.querySelectorAll('button:not(:disabled), input:not(:disabled), a:not(:disabled)')[0];
7824
7871
  handleArrows(event, rows, (element) => element === activeElement.closest('tr'), getFocusableElement, ['button', 'input', 'a'], undefined, false, true, false);
7825
7872
  };
7826
- return (React__namespace.createElement("table", Object.assign({ "aria-label": ariaLabel, role: role, className: css(className, styles$1.table, isTreeTable ? treeGrid : grid, styles$1.modifiers[variant], !borders && styles$1.modifiers.noBorderRows, isStickyHeader && styles$1.modifiers.stickyHeader, isTreeTable && stylesTreeView.modifiers.treeView, isStriped && styles$1.modifiers.striped, isExpandable && styles$1.modifiers.expandable, isNested && 'pf-m-nested'), ref: tableRef }, (isTreeTable && { role: 'treegrid' }), ouiaProps, props), children));
7873
+ const registerSelectableRow = () => {
7874
+ !hasSelectableRows && setHasSelectableRows(true);
7875
+ };
7876
+ return (React__namespace.createElement(TableComposableContext.Provider, { value: { registerSelectableRow } },
7877
+ React__namespace.createElement("table", Object.assign({ "aria-label": ariaLabel, role: role, className: css(className, styles$1.table, isTreeTable ? treeGrid : grid, styles$1.modifiers[variant], !borders && styles$1.modifiers.noBorderRows, isStickyHeader && styles$1.modifiers.stickyHeader, isTreeTable && stylesTreeView.modifiers.treeView, isStriped && styles$1.modifiers.striped, isExpandable && styles$1.modifiers.expandable, isNested && 'pf-m-nested'), ref: tableRef }, (isTreeTable && { role: 'treegrid' }), ouiaProps, props),
7878
+ hasSelectableRowCaption && hasSelectableRows && tableCaption,
7879
+ children)));
7827
7880
  };
7828
7881
  const TableComposable = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(TableComposableBase, Object.assign({}, props, { innerRef: ref }))));
7829
7882
  TableComposable.displayName = 'TableComposable';
@@ -7843,8 +7896,9 @@
7843
7896
  Tbody.displayName = 'Tbody';
7844
7897
 
7845
7898
  const TrBase = (_a) => {
7846
- var { children, className, isExpanded, isEditable, isHidden = false, isHoverable = false, isRowSelected = false, isStriped = false, innerRef, ouiaId, ouiaSafe = true, resetOffset = false, onRowClick } = _a, props = __rest$2(_a, ["children", "className", "isExpanded", "isEditable", "isHidden", "isHoverable", "isRowSelected", "isStriped", "innerRef", "ouiaId", "ouiaSafe", "resetOffset", "onRowClick"]);
7899
+ var { children, className, isExpanded, isEditable, isHidden = false, isHoverable = false, isRowSelected = false, isStriped = false, innerRef, ouiaId, ouiaSafe = true, resetOffset = false, onRowClick, isSelectable, 'aria-label': passedAriaLabel } = _a, props = __rest$2(_a, ["children", "className", "isExpanded", "isEditable", "isHidden", "isHoverable", "isRowSelected", "isStriped", "innerRef", "ouiaId", "ouiaSafe", "resetOffset", "onRowClick", "isSelectable", 'aria-label']);
7847
7900
  const ouiaProps = useOUIAProps('TableRow', ouiaId, ouiaSafe);
7901
+ const [computedAriaLabel, setComputedAriaLabel] = React__namespace.useState('');
7848
7902
  let onKeyDown = null;
7849
7903
  if (onRowClick) {
7850
7904
  onKeyDown = (e) => {
@@ -7854,7 +7908,21 @@
7854
7908
  }
7855
7909
  };
7856
7910
  }
7857
- return (React__namespace.createElement("tr", Object.assign({ className: css(className, isExpanded !== undefined && styles$1.tableExpandableRow, isExpanded && styles$1.modifiers.expanded, isEditable && inlineStyles.modifiers.inlineEditable, isHoverable && styles$1.modifiers.hoverable, isRowSelected && styles$1.modifiers.selected, isStriped && styles$1.modifiers.striped, resetOffset && styles$1.modifiers.firstCellOffsetReset), hidden: isHidden || (isExpanded !== undefined && !isExpanded) }, (isHoverable && { tabIndex: 0 }), { ref: innerRef }, (onRowClick && { onClick: onRowClick, onKeyDown }), ouiaProps, props), children));
7911
+ const rowIsHidden = isHidden || (isExpanded !== undefined && !isExpanded);
7912
+ const { registerSelectableRow } = React__namespace.useContext(TableComposableContext);
7913
+ React__namespace.useEffect(() => {
7914
+ if (isSelectable && !rowIsHidden) {
7915
+ setComputedAriaLabel(`${isRowSelected ? 'Selected' : 'Unselected'}, selectable row.`);
7916
+ registerSelectableRow();
7917
+ }
7918
+ else {
7919
+ setComputedAriaLabel(undefined);
7920
+ }
7921
+ }, [isRowSelected, isSelectable, registerSelectableRow, rowIsHidden]);
7922
+ const ariaLabel = passedAriaLabel || computedAriaLabel;
7923
+ return (React__namespace.createElement(React__namespace.Fragment, null,
7924
+ isSelectable && React__namespace.createElement("output", { className: "pf-screen-reader" }, ariaLabel),
7925
+ React__namespace.createElement("tr", Object.assign({ className: css(className, isExpanded !== undefined && styles$1.tableExpandableRow, isExpanded && styles$1.modifiers.expanded, isEditable && inlineStyles.modifiers.inlineEditable, isHoverable && styles$1.modifiers.hoverable, isRowSelected && styles$1.modifiers.selected, isStriped && styles$1.modifiers.striped, resetOffset && styles$1.modifiers.firstCellOffsetReset), hidden: rowIsHidden }, (isHoverable && { tabIndex: 0 }), { "aria-label": ariaLabel, ref: innerRef }, (onRowClick && { onClick: onRowClick, onKeyDown }), ouiaProps, props), children)));
7858
7926
  };
7859
7927
  const Tr = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(TrBase, Object.assign({}, props, { innerRef: ref }))));
7860
7928
  Tr.displayName = 'Tr';
@@ -13297,6 +13365,7 @@
13297
13365
  exports.Table = Table;
13298
13366
  exports.TableBody = TableBody;
13299
13367
  exports.TableComposable = TableComposable;
13368
+ exports.TableComposableContext = TableComposableContext;
13300
13369
  exports.TableContext = TableContext;
13301
13370
  exports.TableHeader = TableHeader;
13302
13371
  exports.TableText = TableText;