@patternfly/react-table 4.90.0 → 4.90.3
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 +24 -0
- package/dist/esm/components/Table/base/provider.d.ts +3 -3
- package/dist/esm/components/Table/base/types.d.ts +3 -3
- package/dist/esm/components/TableComposable/TableComposable.d.ts +10 -1
- package/dist/esm/components/TableComposable/TableComposable.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/TableComposable.js +23 -2
- package/dist/esm/components/TableComposable/TableComposable.js.map +1 -1
- package/dist/esm/components/TableComposable/Tr.d.ts +3 -1
- package/dist/esm/components/TableComposable/Tr.d.ts.map +1 -1
- package/dist/esm/components/TableComposable/Tr.js +18 -2
- package/dist/esm/components/TableComposable/Tr.js.map +1 -1
- package/dist/js/components/Table/base/provider.d.ts +3 -3
- package/dist/js/components/Table/base/types.d.ts +3 -3
- package/dist/js/components/TableComposable/TableComposable.d.ts +10 -1
- package/dist/js/components/TableComposable/TableComposable.d.ts.map +1 -1
- package/dist/js/components/TableComposable/TableComposable.js +24 -3
- package/dist/js/components/TableComposable/TableComposable.js.map +1 -1
- package/dist/js/components/TableComposable/Tr.d.ts +3 -1
- package/dist/js/components/TableComposable/Tr.d.ts.map +1 -1
- package/dist/js/components/TableComposable/Tr.js +18 -2
- package/dist/js/components/TableComposable/Tr.js.map +1 -1
- package/dist/umd/react-table.css +1175 -385
- package/dist/umd/react-table.js +67 -19
- package/dist/umd/react-table.min.css +798 -8
- package/dist/umd/react-table.min.js +5 -5
- package/package.json +6 -6
- package/src/components/TableComposable/TableComposable.tsx +67 -22
- package/src/components/TableComposable/Tr.tsx +45 -20
- package/src/components/TableComposable/examples/ComposableTableHoverable.tsx +2 -1
package/dist/umd/react-table.js
CHANGED
|
@@ -4037,7 +4037,8 @@
|
|
|
4037
4037
|
"end": "pf-m-end",
|
|
4038
4038
|
"overpassFont": "pf-m-overpass-font"
|
|
4039
4039
|
},
|
|
4040
|
-
"spinner": "pf-c-spinner"
|
|
4040
|
+
"spinner": "pf-c-spinner",
|
|
4041
|
+
"themeDark": "pf-theme-dark"
|
|
4041
4042
|
};
|
|
4042
4043
|
|
|
4043
4044
|
Promise.resolve().then(function () { return spinner; });
|
|
@@ -4271,6 +4272,7 @@
|
|
|
4271
4272
|
"rightBottom": "pf-m-right-bottom",
|
|
4272
4273
|
"textAlignLeft": "pf-m-text-align-left"
|
|
4273
4274
|
},
|
|
4275
|
+
"themeDark": "pf-theme-dark",
|
|
4274
4276
|
"tooltip": "pf-c-tooltip",
|
|
4275
4277
|
"tooltipArrow": "pf-c-tooltip__arrow",
|
|
4276
4278
|
"tooltipContent": "pf-c-tooltip__content"
|
|
@@ -4446,7 +4448,8 @@
|
|
|
4446
4448
|
"placeholder": "pf-m-placeholder",
|
|
4447
4449
|
"resizeVertical": "pf-m-resize-vertical",
|
|
4448
4450
|
"resizeHorizontal": "pf-m-resize-horizontal"
|
|
4449
|
-
}
|
|
4451
|
+
},
|
|
4452
|
+
"themeDark": "pf-theme-dark"
|
|
4450
4453
|
};
|
|
4451
4454
|
|
|
4452
4455
|
Promise.resolve().then(function () { return dropdown; });
|
|
@@ -4496,7 +4499,8 @@
|
|
|
4496
4499
|
"ariaDisabled": "pf-m-aria-disabled",
|
|
4497
4500
|
"icon": "pf-m-icon",
|
|
4498
4501
|
"description": "pf-m-description"
|
|
4499
|
-
}
|
|
4502
|
+
},
|
|
4503
|
+
"themeDark": "pf-theme-dark"
|
|
4500
4504
|
};
|
|
4501
4505
|
|
|
4502
4506
|
var DropdownPosition;
|
|
@@ -5113,7 +5117,8 @@
|
|
|
5113
5117
|
"modifiers": {
|
|
5114
5118
|
"read": "pf-m-read",
|
|
5115
5119
|
"unread": "pf-m-unread"
|
|
5116
|
-
}
|
|
5120
|
+
},
|
|
5121
|
+
"themeDark": "pf-theme-dark"
|
|
5117
5122
|
};
|
|
5118
5123
|
|
|
5119
5124
|
const EllipsisVIconConfig = {
|
|
@@ -5382,7 +5387,8 @@
|
|
|
5382
5387
|
"selectToggleStatusIcon": "pf-c-select__toggle-status-icon",
|
|
5383
5388
|
"selectToggleText": "pf-c-select__toggle-text",
|
|
5384
5389
|
"selectToggleTypeahead": "pf-c-select__toggle-typeahead",
|
|
5385
|
-
"selectToggleWrapper": "pf-c-select__toggle-wrapper"
|
|
5390
|
+
"selectToggleWrapper": "pf-c-select__toggle-wrapper",
|
|
5391
|
+
"themeDark": "pf-theme-dark"
|
|
5386
5392
|
};
|
|
5387
5393
|
|
|
5388
5394
|
const TimesCircleIconConfig = {
|
|
@@ -5449,7 +5455,8 @@
|
|
|
5449
5455
|
"inactive": "pf-m-inactive",
|
|
5450
5456
|
"hidden": "pf-m-hidden",
|
|
5451
5457
|
"expanded": "pf-m-expanded"
|
|
5452
|
-
}
|
|
5458
|
+
},
|
|
5459
|
+
"themeDark": "pf-theme-dark"
|
|
5453
5460
|
};
|
|
5454
5461
|
|
|
5455
5462
|
Promise.resolve().then(function () { return check; });
|
|
@@ -6067,7 +6074,8 @@
|
|
|
6067
6074
|
"modifiers": {
|
|
6068
6075
|
"overflow": "pf-m-overflow",
|
|
6069
6076
|
"draggable": "pf-m-draggable"
|
|
6070
|
-
}
|
|
6077
|
+
},
|
|
6078
|
+
"themeDark": "pf-theme-dark"
|
|
6071
6079
|
};
|
|
6072
6080
|
|
|
6073
6081
|
class Chip extends React__namespace.Component {
|
|
@@ -6806,7 +6814,7 @@
|
|
|
6806
6814
|
});
|
|
6807
6815
|
}
|
|
6808
6816
|
render() {
|
|
6809
|
-
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,
|
|
6810
6818
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6811
6819
|
onFilter,
|
|
6812
6820
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
@@ -6816,7 +6824,7 @@
|
|
|
6816
6824
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
6817
6825
|
menuAppendTo, favorites, onFavorite,
|
|
6818
6826
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
6819
|
-
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"]);
|
|
6820
6828
|
const { focusFirstOption: openedOnEnter, typeaheadCurrIndex, typeaheadInputValue, typeaheadFilteredChildren, favoritesGroup } = this.state;
|
|
6821
6829
|
const selectToggleId = toggleId || `pf-select-toggle-id-${currentId++}`;
|
|
6822
6830
|
const selections = Array.isArray(selectionsProp) ? selectionsProp : [selectionsProp];
|
|
@@ -6990,8 +6998,8 @@
|
|
|
6990
6998
|
" ",
|
|
6991
6999
|
innerMenu,
|
|
6992
7000
|
" ") : innerMenu;
|
|
6993
|
-
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 } }), (
|
|
6994
|
-
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 } }), (
|
|
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 })),
|
|
6995
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 }),
|
|
6996
7004
|
customContent && (React__namespace.createElement("div", { className: css(styles$6.selectToggleWrapper) },
|
|
6997
7005
|
toggleIcon && React__namespace.createElement("span", { className: css(styles$6.selectToggleIcon) }, toggleIcon),
|
|
@@ -7011,15 +7019,15 @@
|
|
|
7011
7019
|
variant === SelectVariant.typeahead && !customContent && (React__namespace.createElement(React__namespace.Fragment, null,
|
|
7012
7020
|
React__namespace.createElement("div", { className: css(styles$6.selectToggleWrapper) },
|
|
7013
7021
|
toggleIcon && React__namespace.createElement("span", { className: css(styles$6.selectToggleIcon) }, toggleIcon),
|
|
7014
|
-
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
|
|
7015
7023
|
? typeaheadInputValue
|
|
7016
|
-
: 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 }))),
|
|
7017
7025
|
hasOnClear && (selections[0] || typeaheadInputValue) && clearBtn)),
|
|
7018
7026
|
variant === SelectVariant.typeaheadMulti && !customContent && (React__namespace.createElement(React__namespace.Fragment, null,
|
|
7019
7027
|
React__namespace.createElement("div", { className: css(styles$6.selectToggleWrapper) },
|
|
7020
7028
|
toggleIcon && React__namespace.createElement("span", { className: css(styles$6.selectToggleIcon) }, toggleIcon),
|
|
7021
7029
|
selections && Array.isArray(selections) && selections.length > 0 && selectedChips,
|
|
7022
|
-
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 }))),
|
|
7023
7031
|
hasOnClear && ((selections && selections.length > 0) || typeaheadInputValue) && clearBtn)),
|
|
7024
7032
|
validated === ValidatedOptions.success && (React__namespace.createElement("span", { className: css(styles$6.selectToggleStatusIcon) },
|
|
7025
7033
|
React__namespace.createElement(CheckCircleIcon$1, { "aria-hidden": "true" }))),
|
|
@@ -7063,6 +7071,7 @@
|
|
|
7063
7071
|
'aria-describedby': '',
|
|
7064
7072
|
'aria-invalid': false,
|
|
7065
7073
|
typeAheadAriaLabel: '',
|
|
7074
|
+
typeAheadAriaDescribedby: '',
|
|
7066
7075
|
clearSelectionsAriaLabel: 'Clear all',
|
|
7067
7076
|
toggleAriaLabel: 'Options menu',
|
|
7068
7077
|
removeSelectionAriaLabel: 'Remove',
|
|
@@ -7175,6 +7184,7 @@
|
|
|
7175
7184
|
"popoverTitle": "pf-c-popover__title",
|
|
7176
7185
|
"popoverTitleIcon": "pf-c-popover__title-icon",
|
|
7177
7186
|
"popoverTitleText": "pf-c-popover__title-text",
|
|
7187
|
+
"themeDark": "pf-theme-dark",
|
|
7178
7188
|
"title": "pf-c-title"
|
|
7179
7189
|
};
|
|
7180
7190
|
|
|
@@ -7618,7 +7628,8 @@
|
|
|
7618
7628
|
"tableSubhead": "pf-c-table__subhead",
|
|
7619
7629
|
"tableText": "pf-c-table__text",
|
|
7620
7630
|
"tableToggle": "pf-c-table__toggle",
|
|
7621
|
-
"tableToggleIcon": "pf-c-table__toggle-icon"
|
|
7631
|
+
"tableToggleIcon": "pf-c-table__toggle-icon",
|
|
7632
|
+
"themeDark": "pf-theme-dark"
|
|
7622
7633
|
};
|
|
7623
7634
|
|
|
7624
7635
|
Promise.resolve().then(function () { return tableGrid; });
|
|
@@ -7807,12 +7818,17 @@
|
|
|
7807
7818
|
TableVariant["compact"] = "compact";
|
|
7808
7819
|
})(exports.TableVariant || (exports.TableVariant = {}));
|
|
7809
7820
|
|
|
7821
|
+
const TableComposableContext = React__namespace.createContext({
|
|
7822
|
+
registerSelectableRow: () => { }
|
|
7823
|
+
});
|
|
7810
7824
|
const TableComposableBase = (_a) => {
|
|
7811
7825
|
var _b, _c;
|
|
7812
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,
|
|
7813
7827
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
7814
|
-
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"]);
|
|
7815
7829
|
const tableRef = innerRef || React__namespace.useRef(null);
|
|
7830
|
+
const [hasSelectableRows, setHasSelectableRows] = React__namespace.useState(false);
|
|
7831
|
+
const [tableCaption, setTableCaption] = React__namespace.useState();
|
|
7816
7832
|
React__namespace.useEffect(() => {
|
|
7817
7833
|
document.addEventListener('keydown', handleKeys);
|
|
7818
7834
|
// sets up roving tab-index to tree tables only
|
|
@@ -7824,6 +7840,16 @@
|
|
|
7824
7840
|
document.removeEventListener('keydown', handleKeys);
|
|
7825
7841
|
};
|
|
7826
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]);
|
|
7827
7853
|
const ouiaProps = useOUIAProps('Table', ouiaId, ouiaSafe);
|
|
7828
7854
|
const grid = (_b = stylesGrid.modifiers) === null || _b === void 0 ? void 0 : _b[toCamel(gridBreakPoint || '').replace(/-?2xl/, '_2xl')];
|
|
7829
7855
|
const breakPointPrefix = `treeView${gridBreakPoint.charAt(0).toUpperCase() + gridBreakPoint.slice(1)}`;
|
|
@@ -7844,7 +7870,13 @@
|
|
|
7844
7870
|
const getFocusableElement = (element) => element.querySelectorAll('button:not(:disabled), input:not(:disabled), a:not(:disabled)')[0];
|
|
7845
7871
|
handleArrows(event, rows, (element) => element === activeElement.closest('tr'), getFocusableElement, ['button', 'input', 'a'], undefined, false, true, false);
|
|
7846
7872
|
};
|
|
7847
|
-
|
|
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)));
|
|
7848
7880
|
};
|
|
7849
7881
|
const TableComposable = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(TableComposableBase, Object.assign({}, props, { innerRef: ref }))));
|
|
7850
7882
|
TableComposable.displayName = 'TableComposable';
|
|
@@ -7864,8 +7896,9 @@
|
|
|
7864
7896
|
Tbody.displayName = 'Tbody';
|
|
7865
7897
|
|
|
7866
7898
|
const TrBase = (_a) => {
|
|
7867
|
-
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']);
|
|
7868
7900
|
const ouiaProps = useOUIAProps('TableRow', ouiaId, ouiaSafe);
|
|
7901
|
+
const [computedAriaLabel, setComputedAriaLabel] = React__namespace.useState('');
|
|
7869
7902
|
let onKeyDown = null;
|
|
7870
7903
|
if (onRowClick) {
|
|
7871
7904
|
onKeyDown = (e) => {
|
|
@@ -7875,7 +7908,21 @@
|
|
|
7875
7908
|
}
|
|
7876
7909
|
};
|
|
7877
7910
|
}
|
|
7878
|
-
|
|
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)));
|
|
7879
7926
|
};
|
|
7880
7927
|
const Tr = React__namespace.forwardRef((props, ref) => (React__namespace.createElement(TrBase, Object.assign({}, props, { innerRef: ref }))));
|
|
7881
7928
|
Tr.displayName = 'Tr';
|
|
@@ -13318,6 +13365,7 @@
|
|
|
13318
13365
|
exports.Table = Table;
|
|
13319
13366
|
exports.TableBody = TableBody;
|
|
13320
13367
|
exports.TableComposable = TableComposable;
|
|
13368
|
+
exports.TableComposableContext = TableComposableContext;
|
|
13321
13369
|
exports.TableContext = TableContext;
|
|
13322
13370
|
exports.TableHeader = TableHeader;
|
|
13323
13371
|
exports.TableText = TableText;
|