@patternfly/react-core 4.221.1 → 4.221.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 (36) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/esm/components/DataList/DataList.d.ts +9 -0
  3. package/dist/esm/components/DataList/DataList.d.ts.map +1 -1
  4. package/dist/esm/components/DataList/DataList.js +3 -2
  5. package/dist/esm/components/DataList/DataList.js.map +1 -1
  6. package/dist/esm/components/DataList/DataListItem.d.ts +2 -0
  7. package/dist/esm/components/DataList/DataListItem.d.ts.map +1 -1
  8. package/dist/esm/components/DataList/DataListItem.js +13 -6
  9. package/dist/esm/components/DataList/DataListItem.js.map +1 -1
  10. package/dist/esm/components/Select/Select.d.ts +2 -0
  11. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  12. package/dist/esm/components/Select/Select.js +8 -7
  13. package/dist/esm/components/Select/Select.js.map +1 -1
  14. package/dist/js/components/DataList/DataList.d.ts +9 -0
  15. package/dist/js/components/DataList/DataList.d.ts.map +1 -1
  16. package/dist/js/components/DataList/DataList.js +3 -2
  17. package/dist/js/components/DataList/DataList.js.map +1 -1
  18. package/dist/js/components/DataList/DataListItem.d.ts +2 -0
  19. package/dist/js/components/DataList/DataListItem.d.ts.map +1 -1
  20. package/dist/js/components/DataList/DataListItem.js +13 -6
  21. package/dist/js/components/DataList/DataListItem.js.map +1 -1
  22. package/dist/js/components/Select/Select.d.ts +2 -0
  23. package/dist/js/components/Select/Select.d.ts.map +1 -1
  24. package/dist/js/components/Select/Select.js +8 -7
  25. package/dist/js/components/Select/Select.js.map +1 -1
  26. package/dist/umd/react-core.css +83 -83
  27. package/dist/umd/react-core.js +24 -15
  28. package/dist/umd/react-core.min.js +4 -4
  29. package/package.json +5 -5
  30. package/src/components/DataList/DataList.tsx +12 -0
  31. package/src/components/DataList/DataListItem.tsx +32 -3
  32. package/src/components/DataList/__tests__/DataList.test.tsx +130 -0
  33. package/src/components/DataList/examples/DataList.md +1 -0
  34. package/src/components/DataList/examples/DataListSelectableRows.tsx +5 -0
  35. package/src/components/Select/Select.tsx +8 -2
  36. package/src/demos/PrimaryDetail.md +1 -1
@@ -8083,7 +8083,7 @@
8083
8083
  });
8084
8084
  }
8085
8085
  render() {
8086
- 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,
8086
+ 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,
8087
8087
  /* eslint-disable @typescript-eslint/no-unused-vars */
8088
8088
  onFilter,
8089
8089
  /* eslint-disable @typescript-eslint/no-unused-vars */
@@ -8093,7 +8093,7 @@
8093
8093
  /* eslint-enable @typescript-eslint/no-unused-vars */
8094
8094
  menuAppendTo, favorites, onFavorite,
8095
8095
  /* eslint-disable @typescript-eslint/no-unused-vars */
8096
- 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"]);
8096
+ 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"]);
8097
8097
  const { focusFirstOption: openedOnEnter, typeaheadCurrIndex, typeaheadInputValue, typeaheadFilteredChildren, favoritesGroup } = this.state;
8098
8098
  const selectToggleId = toggleId || `pf-select-toggle-id-${currentId$1++}`;
8099
8099
  const selections = Array.isArray(selectionsProp) ? selectionsProp : [selectionsProp];
@@ -8267,8 +8267,8 @@
8267
8267
  " ",
8268
8268
  innerMenu,
8269
8269
  " ") : innerMenu;
8270
- const popperContainer = (React__namespace.createElement("div", Object.assign({ className: css(styles$_.select, isOpen && styles$_.modifiers.expanded, validated === exports.ValidatedOptions.success && styles$_.modifiers.success, validated === exports.ValidatedOptions.warning && styles$_.modifiers.warning, validated === exports.ValidatedOptions.error && styles$_.modifiers.invalid, direction === exports.SelectDirection.up && styles$_.modifiers.top, className) }, (width && { style: { width } }), (validated !== exports.ValidatedOptions.default && { 'aria-describedby': ariaDescribedby }), (validated !== exports.ValidatedOptions.default && { 'aria-invalid': ariaInvalid })), isOpen && menuContainer));
8271
- const mainContainer = (React__namespace.createElement("div", Object.assign({ className: css(styles$_.select, isOpen && styles$_.modifiers.expanded, validated === exports.ValidatedOptions.success && styles$_.modifiers.success, validated === exports.ValidatedOptions.warning && styles$_.modifiers.warning, validated === exports.ValidatedOptions.error && styles$_.modifiers.invalid, direction === exports.SelectDirection.up && styles$_.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 })),
8270
+ const popperContainer = (React__namespace.createElement("div", Object.assign({ className: css(styles$_.select, isOpen && styles$_.modifiers.expanded, validated === exports.ValidatedOptions.success && styles$_.modifiers.success, validated === exports.ValidatedOptions.warning && styles$_.modifiers.warning, validated === exports.ValidatedOptions.error && styles$_.modifiers.invalid, direction === exports.SelectDirection.up && styles$_.modifiers.top, className) }, (width && { style: { width } }), (ariaDescribedby && { 'aria-describedby': ariaDescribedby }), (validated !== exports.ValidatedOptions.default && { 'aria-invalid': ariaInvalid })), isOpen && menuContainer));
8271
+ const mainContainer = (React__namespace.createElement("div", Object.assign({ className: css(styles$_.select, isOpen && styles$_.modifiers.expanded, validated === exports.ValidatedOptions.success && styles$_.modifiers.success, validated === exports.ValidatedOptions.warning && styles$_.modifiers.warning, validated === exports.ValidatedOptions.error && styles$_.modifiers.invalid, direction === exports.SelectDirection.up && styles$_.modifiers.top, className), ref: this.parentRef }, getOUIAProps(Select.displayName, ouiaId !== undefined ? ouiaId : this.state.ouiaStateId, ouiaSafe), (width && { style: { width } }), (ariaDescribedby && { 'aria-describedby': ariaDescribedby }), (validated !== exports.ValidatedOptions.default && { 'aria-invalid': ariaInvalid })),
8272
8272
  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 }),
8273
8273
  customContent && (React__namespace.createElement("div", { className: css(styles$_.selectToggleWrapper) },
8274
8274
  toggleIcon && React__namespace.createElement("span", { className: css(styles$_.selectToggleIcon) }, toggleIcon),
@@ -8288,15 +8288,15 @@
8288
8288
  variant === exports.SelectVariant.typeahead && !customContent && (React__namespace.createElement(React__namespace.Fragment, null,
8289
8289
  React__namespace.createElement("div", { className: css(styles$_.selectToggleWrapper) },
8290
8290
  toggleIcon && React__namespace.createElement("span", { className: css(styles$_.selectToggleIcon) }, toggleIcon),
8291
- React__namespace.createElement("input", { className: css(formStyles.formControl, styles$_.selectToggleTypeahead), "aria-activedescendant": typeaheadActiveChild && typeaheadActiveChild.id, id: `${selectToggleId}-select-typeahead`, "aria-label": typeAheadAriaLabel, placeholder: placeholderText, value: typeaheadInputValue !== null
8291
+ React__namespace.createElement("input", Object.assign({ className: css(formStyles.formControl, styles$_.selectToggleTypeahead), "aria-activedescendant": typeaheadActiveChild && typeaheadActiveChild.id, id: `${selectToggleId}-select-typeahead`, "aria-label": typeAheadAriaLabel }, (typeAheadAriaDescribedby && { 'aria-describedby': typeAheadAriaDescribedby }), { placeholder: placeholderText, value: typeaheadInputValue !== null
8292
8292
  ? typeaheadInputValue
8293
- : this.getDisplay(selections[0], 'text') || '', type: "text", onClick: this.onClick, onChange: this.onChange, autoComplete: inputAutoComplete, disabled: isDisabled, ref: this.inputRef })),
8293
+ : this.getDisplay(selections[0], 'text') || '', type: "text", onClick: this.onClick, onChange: this.onChange, autoComplete: inputAutoComplete, disabled: isDisabled, ref: this.inputRef }))),
8294
8294
  hasOnClear && (selections[0] || typeaheadInputValue) && clearBtn)),
8295
8295
  variant === exports.SelectVariant.typeaheadMulti && !customContent && (React__namespace.createElement(React__namespace.Fragment, null,
8296
8296
  React__namespace.createElement("div", { className: css(styles$_.selectToggleWrapper) },
8297
8297
  toggleIcon && React__namespace.createElement("span", { className: css(styles$_.selectToggleIcon) }, toggleIcon),
8298
8298
  selections && Array.isArray(selections) && selections.length > 0 && selectedChips,
8299
- React__namespace.createElement("input", { className: css(formStyles.formControl, styles$_.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 })),
8299
+ React__namespace.createElement("input", Object.assign({ className: css(formStyles.formControl, styles$_.selectToggleTypeahead), "aria-activedescendant": typeaheadActiveChild && typeaheadActiveChild.id, id: `${selectToggleId}-select-multi-typeahead-typeahead`, "aria-label": typeAheadAriaLabel, "aria-invalid": validated === exports.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 }))),
8300
8300
  hasOnClear && ((selections && selections.length > 0) || typeaheadInputValue) && clearBtn)),
8301
8301
  validated === exports.ValidatedOptions.success && (React__namespace.createElement("span", { className: css(styles$_.selectToggleStatusIcon) },
8302
8302
  React__namespace.createElement(CheckCircleIcon$1, { "aria-hidden": "true" }))),
@@ -8340,6 +8340,7 @@
8340
8340
  'aria-describedby': '',
8341
8341
  'aria-invalid': false,
8342
8342
  typeAheadAriaLabel: '',
8343
+ typeAheadAriaDescribedby: '',
8343
8344
  clearSelectionsAriaLabel: 'Clear all',
8344
8345
  toggleAriaLabel: 'Options menu',
8345
8346
  removeSelectionAriaLabel: 'Remove',
@@ -10046,9 +10047,9 @@
10046
10047
  render() {
10047
10048
  const _a = this.props, { className, children, onSelectDataListItem, selectedDataListItemId, isCompact, wrapModifier,
10048
10049
  /* eslint-disable @typescript-eslint/no-unused-vars */
10049
- onDragStart, onDragMove, onDragCancel, onDragFinish, gridBreakpoint, itemOrder } = _a,
10050
+ onDragStart, onDragMove, onDragCancel, onDragFinish, gridBreakpoint, itemOrder, selectableRow } = _a,
10050
10051
  /* eslint-enable @typescript-eslint/no-unused-vars */
10051
- props = __rest$1(_a, ["className", "children", "onSelectDataListItem", "selectedDataListItemId", "isCompact", "wrapModifier", "onDragStart", "onDragMove", "onDragCancel", "onDragFinish", "gridBreakpoint", "itemOrder"]);
10052
+ props = __rest$1(_a, ["className", "children", "onSelectDataListItem", "selectedDataListItemId", "isCompact", "wrapModifier", "onDragStart", "onDragMove", "onDragCancel", "onDragFinish", "gridBreakpoint", "itemOrder", "selectableRow"]);
10052
10053
  const { dragging } = this.state;
10053
10054
  const isSelectable = onSelectDataListItem !== undefined;
10054
10055
  const updateSelectedDataListItem = (id) => {
@@ -10063,6 +10064,7 @@
10063
10064
  isSelectable,
10064
10065
  selectedDataListItemId,
10065
10066
  updateSelectedDataListItem,
10067
+ selectableRow,
10066
10068
  isDraggable: this.html5DragDrop,
10067
10069
  dragStart: this.dragStart,
10068
10070
  dragEnd: this.dragEnd,
@@ -10156,8 +10158,8 @@
10156
10158
  }
10157
10159
  class DataListItem extends React__namespace.Component {
10158
10160
  render() {
10159
- const _a = this.props, { children, isExpanded, className, id, 'aria-labelledby': ariaLabelledBy } = _a, props = __rest$1(_a, ["children", "isExpanded", "className", "id", 'aria-labelledby']);
10160
- return (React__namespace.createElement(DataListContext.Consumer, null, ({ isSelectable, selectedDataListItemId, updateSelectedDataListItem, isDraggable, dragStart, dragEnd, drop }) => {
10161
+ const _a = this.props, { children, isExpanded, className, id, 'aria-labelledby': ariaLabelledBy, selectableInputAriaLabel } = _a, props = __rest$1(_a, ["children", "isExpanded", "className", "id", 'aria-labelledby', "selectableInputAriaLabel"]);
10162
+ return (React__namespace.createElement(DataListContext.Consumer, null, ({ isSelectable, selectedDataListItemId, updateSelectedDataListItem, selectableRow, isDraggable, dragStart, dragEnd, drop }) => {
10161
10163
  const selectDataListItem = (event) => {
10162
10164
  let target = event.target;
10163
10165
  while (event.currentTarget !== target) {
@@ -10188,10 +10190,17 @@
10188
10190
  onDragEnd: dragEnd,
10189
10191
  onDragStart: dragStart
10190
10192
  };
10191
- return (React__namespace.createElement("li", Object.assign({ id: id, className: css(styles$O.dataListItem, isExpanded && styles$O.modifiers.expanded, isSelectable && styles$O.modifiers.selectable, selectedDataListItemId && selectedDataListItemId === id && styles$O.modifiers.selected, className), "aria-labelledby": ariaLabelledBy }, (isSelectable && { tabIndex: 0, onClick: selectDataListItem, onKeyDown }), (isSelectable && selectedDataListItemId === id && { 'aria-selected': true }), props, dragProps), React__namespace.Children.map(children, child => React__namespace.isValidElement(child) &&
10192
- React__namespace.cloneElement(child, {
10193
- rowid: ariaLabelledBy
10194
- }))));
10193
+ const isSelected = selectedDataListItemId === id;
10194
+ const selectableInputAriaProps = selectableInputAriaLabel
10195
+ ? { 'aria-label': selectableInputAriaLabel }
10196
+ : { 'aria-labelledby': ariaLabelledBy };
10197
+ const selectableInputType = (selectableRow === null || selectableRow === void 0 ? void 0 : selectableRow.type) === 'multiple' ? 'checkbox' : 'radio';
10198
+ return (React__namespace.createElement("li", Object.assign({ id: id, className: css(styles$O.dataListItem, isExpanded && styles$O.modifiers.expanded, isSelectable && styles$O.modifiers.selectable, selectedDataListItemId && isSelected && styles$O.modifiers.selected, className), "aria-labelledby": ariaLabelledBy }, (isSelectable && { tabIndex: 0, onClick: selectDataListItem, onKeyDown }), (isSelectable && isSelected && { 'aria-selected': true }), props, dragProps),
10199
+ selectableRow && (React__namespace.createElement("input", Object.assign({ className: "pf-screen-reader", type: selectableInputType, checked: isSelected, onChange: event => selectableRow.onChange(id, event), tabIndex: -1 }, selectableInputAriaProps))),
10200
+ React__namespace.Children.map(children, child => React__namespace.isValidElement(child) &&
10201
+ React__namespace.cloneElement(child, {
10202
+ rowid: ariaLabelledBy
10203
+ }))));
10195
10204
  }));
10196
10205
  }
10197
10206
  }