@patternfly/react-table 6.2.0-prerelease.16 → 6.2.0-prerelease.18

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 (78) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/components/package.json +1 -1
  3. package/deprecated/package.json +1 -1
  4. package/dist/dynamic/components/Table/package.json +1 -1
  5. package/dist/dynamic/components/Table/utils/decorators/package.json +1 -1
  6. package/dist/dynamic/components/Table/utils/package.json +1 -1
  7. package/dist/dynamic/deprecated/components/Table/base/package.json +1 -1
  8. package/dist/dynamic/deprecated/components/Table/package.json +1 -1
  9. package/dist/dynamic/deprecated/components/package.json +1 -1
  10. package/dist/esm/components/Table/ActionsColumn.d.ts.map +1 -1
  11. package/dist/esm/components/Table/ActionsColumn.js.map +1 -1
  12. package/dist/esm/components/Table/EditableSelectInputCell.d.ts +1 -1
  13. package/dist/esm/components/Table/EditableSelectInputCell.d.ts.map +1 -1
  14. package/dist/esm/components/Table/EditableSelectInputCell.js.map +1 -1
  15. package/dist/esm/components/Table/Table.d.ts.map +1 -1
  16. package/dist/esm/components/Table/Table.js.map +1 -1
  17. package/dist/esm/components/Table/TableTypes.d.ts +1 -1
  18. package/dist/esm/components/Table/TableTypes.d.ts.map +1 -1
  19. package/dist/esm/components/Table/Td.js.map +1 -1
  20. package/dist/esm/components/Table/Th.js.map +1 -1
  21. package/dist/esm/components/Table/base/types.d.ts +1 -1
  22. package/dist/esm/components/Table/base/types.d.ts.map +1 -1
  23. package/dist/esm/demos/DashboardHeader.d.ts.map +1 -1
  24. package/dist/esm/demos/DashboardHeader.js +2 -3
  25. package/dist/esm/demos/DashboardHeader.js.map +1 -1
  26. package/dist/esm/demos/DashboardWrapper.d.ts +1 -1
  27. package/dist/esm/demos/DashboardWrapper.d.ts.map +1 -1
  28. package/dist/esm/deprecated/components/Table/BodyCell.d.ts +1 -1
  29. package/dist/esm/deprecated/components/Table/BodyCell.d.ts.map +1 -1
  30. package/dist/esm/deprecated/components/Table/BodyCell.js.map +1 -1
  31. package/dist/esm/deprecated/components/Table/Table.d.ts +2 -1
  32. package/dist/esm/deprecated/components/Table/Table.d.ts.map +1 -1
  33. package/dist/esm/deprecated/components/Table/Table.js.map +1 -1
  34. package/dist/js/components/Table/ActionsColumn.d.ts.map +1 -1
  35. package/dist/js/components/Table/ActionsColumn.js.map +1 -1
  36. package/dist/js/components/Table/EditableSelectInputCell.d.ts +1 -1
  37. package/dist/js/components/Table/EditableSelectInputCell.d.ts.map +1 -1
  38. package/dist/js/components/Table/EditableSelectInputCell.js.map +1 -1
  39. package/dist/js/components/Table/Table.d.ts.map +1 -1
  40. package/dist/js/components/Table/Table.js.map +1 -1
  41. package/dist/js/components/Table/TableTypes.d.ts +1 -1
  42. package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
  43. package/dist/js/components/Table/Td.js.map +1 -1
  44. package/dist/js/components/Table/Th.js.map +1 -1
  45. package/dist/js/components/Table/base/types.d.ts +1 -1
  46. package/dist/js/components/Table/base/types.d.ts.map +1 -1
  47. package/dist/js/demos/DashboardHeader.d.ts.map +1 -1
  48. package/dist/js/demos/DashboardHeader.js +1 -2
  49. package/dist/js/demos/DashboardHeader.js.map +1 -1
  50. package/dist/js/demos/DashboardWrapper.d.ts +1 -1
  51. package/dist/js/demos/DashboardWrapper.d.ts.map +1 -1
  52. package/dist/js/deprecated/components/Table/BodyCell.d.ts +1 -1
  53. package/dist/js/deprecated/components/Table/BodyCell.d.ts.map +1 -1
  54. package/dist/js/deprecated/components/Table/BodyCell.js.map +1 -1
  55. package/dist/js/deprecated/components/Table/Table.d.ts +2 -1
  56. package/dist/js/deprecated/components/Table/Table.d.ts.map +1 -1
  57. package/dist/js/deprecated/components/Table/Table.js.map +1 -1
  58. package/dist/umd/assets/{output-Db-dzvWM.css → output-DgIexI8l.css} +5197 -5197
  59. package/dist/umd/react-table.min.js +3 -3
  60. package/package.json +3 -3
  61. package/src/components/Table/ActionsColumn.tsx +1 -2
  62. package/src/components/Table/EditableSelectInputCell.tsx +2 -2
  63. package/src/components/Table/Table.tsx +2 -0
  64. package/src/components/Table/TableTypes.tsx +1 -1
  65. package/src/components/Table/Td.tsx +2 -2
  66. package/src/components/Table/Th.tsx +2 -2
  67. package/src/components/Table/base/types.tsx +1 -1
  68. package/src/components/Table/examples/TableDraggable.tsx +1 -1
  69. package/src/components/Table/examples/TableEditable.tsx +3 -3
  70. package/src/demos/DashboardHeader.tsx +4 -4
  71. package/src/demos/DashboardWrapper.tsx +1 -1
  72. package/src/demos/examples/TableColumnManagement.tsx +1 -1
  73. package/src/demos/examples/TableColumnManagementWithDraggable.tsx +1 -1
  74. package/src/deprecated/components/Table/BodyCell.tsx +5 -5
  75. package/src/deprecated/components/Table/Table.tsx +2 -0
  76. package/src/deprecated/components/Table/examples/LegacyTableMisc.tsx +1 -1
  77. package/src/deprecated/components/Table/examples/LegacyTableStripedCustomTr.tsx +1 -3
  78. package/src/test-helpers/MockedTableChanges.js +1 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-table",
3
- "version": "6.2.0-prerelease.16",
3
+ "version": "6.2.0-prerelease.18",
4
4
  "description": "This library provides a set of React table components for use with the PatternFly 4",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -40,7 +40,7 @@
40
40
  "subpaths": "node ../../scripts/exportSubpaths.mjs --config subpaths.config.json"
41
41
  },
42
42
  "dependencies": {
43
- "@patternfly/react-core": "^6.2.0-prerelease.15",
43
+ "@patternfly/react-core": "^6.2.0-prerelease.17",
44
44
  "@patternfly/react-icons": "^6.2.0-prerelease.2",
45
45
  "@patternfly/react-styles": "^6.2.0-prerelease.2",
46
46
  "@patternfly/react-tokens": "^6.2.0-prerelease.2",
@@ -51,5 +51,5 @@
51
51
  "react": "^17 || ^18",
52
52
  "react-dom": "^17 || ^18"
53
53
  },
54
- "gitHead": "a2cb15519172f33cc701fd6b6cc5e7405a6d8a4c"
54
+ "gitHead": "e71da5ef7c6bec9dace193be79f4c8b7250f3716"
55
55
  }
@@ -88,10 +88,9 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
88
88
  {title}
89
89
  </Button>
90
90
  ) : (
91
- React.cloneElement(title as React.ReactElement, { onClick, isDisabled, ...props })
91
+ React.cloneElement(title as React.ReactElement<any>, { onClick, isDisabled, ...props })
92
92
  )
93
93
  )}
94
-
95
94
  <Dropdown
96
95
  isOpen={isOpen}
97
96
  onOpenChange={!isOnOpenChangeDisabled ? (isOpen: boolean) => setIsOpen(isOpen) : undefined}
@@ -22,7 +22,7 @@ export interface IEditableSelectInputCell extends Omit<React.HTMLProps<HTMLEleme
22
22
  isPlaceholder?: boolean
23
23
  ) => void;
24
24
  /** Options to display in the expandable select menu */
25
- options?: React.ReactElement[];
25
+ options?: React.ReactElement<any>[];
26
26
  /** Flag indicating the select input is disabled */
27
27
  isDisabled?: boolean;
28
28
  /** Flag indicating the toggle gets placeholder styles **/
@@ -47,7 +47,7 @@ export const EditableSelectInputCell: React.FunctionComponent<IEditableSelectInp
47
47
  isPlaceholder = false,
48
48
  onToggle = () => {},
49
49
  selections = [''],
50
- options = [] as React.ReactElement[],
50
+ options = [] as React.ReactElement<any>[],
51
51
  props
52
52
  }: IEditableSelectInputCell) => {
53
53
  const onSelectHandler = (event: React.MouseEvent | React.ChangeEvent, newValue: any | any[]) => {
@@ -10,6 +10,8 @@ import { KeyTypes } from '@patternfly/react-core/dist/esm/helpers/constants';
10
10
  import { useOUIAProps, OUIAProps } from '@patternfly/react-core/dist/esm/helpers/OUIA/ouia';
11
11
  import { TableGridBreakpoint, TableVariant } from './TableTypes';
12
12
 
13
+ import type { JSX } from 'react';
14
+
13
15
  export interface BaseCellProps {
14
16
  /** Content rendered inside the cell */
15
17
  children?: React.ReactNode;
@@ -195,7 +195,7 @@ export interface decoratorReturnType {
195
195
  scope?: string;
196
196
  parentId?: number;
197
197
  colSpan?: number;
198
- id?: React.ReactText;
198
+ id?: number | string;
199
199
  }
200
200
 
201
201
  export type ITransform = (label?: IFormatterValueType, extra?: IExtra) => decoratorReturnType;
@@ -263,8 +263,8 @@ const TdBase: React.FunctionComponent<TdProps> = ({
263
263
 
264
264
  React.useEffect(() => {
265
265
  setTruncated(
266
- (cellRef as React.RefObject<HTMLElement>).current.offsetWidth <
267
- (cellRef as React.RefObject<HTMLElement>).current.scrollWidth
266
+ (cellRef as React.RefObject<HTMLElement | null>).current.offsetWidth <
267
+ (cellRef as React.RefObject<HTMLElement | null>).current.scrollWidth
268
268
  );
269
269
  }, [cellRef]);
270
270
 
@@ -198,8 +198,8 @@ const ThBase: React.FunctionComponent<ThProps> = ({
198
198
 
199
199
  React.useEffect(() => {
200
200
  setTruncated(
201
- (cellRef as React.RefObject<HTMLElement>).current.offsetWidth <
202
- (cellRef as React.RefObject<HTMLElement>).current.scrollWidth
201
+ (cellRef as React.RefObject<HTMLElement | null>).current.offsetWidth <
202
+ (cellRef as React.RefObject<HTMLElement | null>).current.scrollWidth
203
203
  );
204
204
  }, [cellRef]);
205
205
 
@@ -298,7 +298,7 @@ export interface EditableSelectInputProps {
298
298
  /** Single select option value for single select menus, or array of select option values for multi select. You can also specify isSelected on the SelectOption */
299
299
  selected: any | any[];
300
300
  /** Array of react elements to display in the select menu */
301
- options: React.ReactElement[];
301
+ options: React.ReactElement<any>[];
302
302
  /** Props to be passed down to the select component */
303
303
  editableSelectProps?: SelectProps;
304
304
  /** arbitrary data to pass to the internal select component in the editable select input cell */
@@ -9,7 +9,7 @@ export const TableDraggable: React.FunctionComponent = () => {
9
9
  const [itemOrder, setItemOrder] = React.useState(['row1', 'row2', 'row3']);
10
10
  const [tempItemOrder, setTempItemOrder] = React.useState<string[]>([]);
11
11
 
12
- const bodyRef = React.useRef<HTMLTableSectionElement>();
12
+ const bodyRef = React.useRef<HTMLTableSectionElement>(undefined);
13
13
 
14
14
  const onDragStart: TrProps['onDragStart'] = (evt) => {
15
15
  evt.dataTransfer.effectAllowed = 'move';
@@ -18,7 +18,7 @@ const EditButtonsCell: React.FunctionComponent<EditButtonsCellProps> = ({
18
18
  elementToFocusOnEditRef,
19
19
  rowAriaLabel = 'row'
20
20
  }) => {
21
- const editButtonRef = React.useRef<HTMLButtonElement>();
21
+ const editButtonRef = React.useRef<HTMLButtonElement>(undefined);
22
22
 
23
23
  const onKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>, button: 'edit' | 'stopEditing') => {
24
24
  const focusRef = button === 'edit' ? elementToFocusOnEditRef : editButtonRef;
@@ -104,7 +104,7 @@ const EditableCell: React.FunctionComponent<EditableCellProps> = ({
104
104
  <div className={css(inlineEditStyles.inlineEditValue)}>{staticValue}</div>
105
105
  {hasMultipleInputs ? (
106
106
  <div className={css(inlineEditStyles.inlineEditGroup, 'pf-m-column')} role={role} aria-label={ariaLabel}>
107
- {(editingValue as React.ReactElement[]).map((elem, index) => (
107
+ {(editingValue as React.ReactElement<any>[]).map((elem, index) => (
108
108
  <div key={index} className={css(inlineEditStyles.inlineEditInput)}>
109
109
  {elem}
110
110
  </div>
@@ -137,7 +137,7 @@ const EditableRow: React.FunctionComponent<EditableRow> = ({
137
137
  const [editable, setEditable] = React.useState(false);
138
138
  const [editedData, setEditedData] = React.useState(data);
139
139
 
140
- const inputRef = React.useRef();
140
+ const inputRef = React.useRef(undefined);
141
141
 
142
142
  return (
143
143
  <Tr className={css(inlineEditStyles.inlineEdit, editable ? inlineEditStyles.modifiers.inlineEditable : '')}>
@@ -16,6 +16,8 @@ import {
16
16
  MastheadLogo,
17
17
  MastheadContent,
18
18
  MenuToggle,
19
+ NotificationBadge,
20
+ NotificationBadgeVariant,
19
21
  Toolbar,
20
22
  ToolbarContent,
21
23
  ToolbarGroup,
@@ -26,7 +28,6 @@ import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
26
28
  import CogIcon from '@patternfly/react-icons/dist/esm/icons/cog-icon';
27
29
  import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
28
30
  import QuestionCircleIcon from '@patternfly/react-icons/dist/esm/icons/question-circle-icon';
29
- import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
30
31
  import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-icon';
31
32
  import imgAvatar from '@patternfly/react-table/src/demos/assets/avatarImg.svg';
32
33
  import pfLogo from '@patternfly/react-table/src/demos/assets/pf-logo.svg';
@@ -108,10 +109,9 @@ export const DashboardHeader: React.FC<DashboardHeaderProps> = ({ notificationBa
108
109
  >
109
110
  {notificationBadge ?? (
110
111
  <ToolbarItem>
111
- <Button
112
+ <NotificationBadge
112
113
  aria-label="Notifications"
113
- variant={ButtonVariant.plain}
114
- icon={<BellIcon />}
114
+ variant={NotificationBadgeVariant.read}
115
115
  onClick={() => {}}
116
116
  />
117
117
  </ToolbarItem>
@@ -38,7 +38,7 @@ interface DashboardWrapperProps {
38
38
  /** Callback when notification drawer panel is finished expanding. */
39
39
  onNotificationDrawerExpand?: (event: KeyboardEvent | React.MouseEvent | React.TransitionEvent) => void;
40
40
  /** Skip to content component for the page */
41
- skipToContent?: React.ReactElement;
41
+ skipToContent?: React.ReactElement<any>;
42
42
  /** Sets the value for role on the <main> element */
43
43
  role?: string;
44
44
  /** an id to use for the [role="main"] element */
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { type JSX } from 'react';
2
2
 
3
3
  import {
4
4
  Button,
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { type JSX } from 'react';
2
2
 
3
3
  import {
4
4
  Button,
@@ -18,7 +18,7 @@ export interface BodyCellProps {
18
18
  ariaControls?: string;
19
19
  editableValue?: any;
20
20
  editableSelectProps?: SelectProps;
21
- options?: React.ReactElement[];
21
+ options?: React.ReactElement<any>[];
22
22
  isSelectOpen?: boolean;
23
23
  value?: any;
24
24
  isValid?: boolean;
@@ -69,10 +69,10 @@ export const BodyCell: React.FunctionComponent<BodyCellProps> = ({
69
69
  let isEmptyStateCell = false;
70
70
  if (children) {
71
71
  isEmptyStateCell =
72
- ((children as React.ReactElement).type === Bullseye &&
73
- (children as React.ReactElement).props.children &&
74
- (children as React.ReactElement).props.children.type === EmptyState) ||
75
- (children as React.ReactElement).type === EmptyState;
72
+ ((children as React.ReactElement<any>).type === Bullseye &&
73
+ (children as React.ReactElement<any>).props.children &&
74
+ (children as React.ReactElement<any>).props.children.type === EmptyState) ||
75
+ (children as React.ReactElement<any>).type === EmptyState;
76
76
  }
77
77
 
78
78
  const cell = (
@@ -29,6 +29,8 @@ import {
29
29
  CustomActionsToggleProps
30
30
  } from '../../../components';
31
31
 
32
+ import type { JSX } from 'react';
33
+
32
34
  export interface TableProps extends OUIAProps {
33
35
  /** Adds an accessible name for the Table */
34
36
  'aria-label'?: string;
@@ -36,7 +36,7 @@ export const LegacyTableMisc: React.FunctionComponent = () => {
36
36
  };
37
37
  return (
38
38
  <tr
39
- ref={trRef as React.LegacyRef<HTMLTableRowElement>}
39
+ ref={trRef as React.Ref<HTMLTableRowElement>}
40
40
  className={css(className, isOddRow ? 'odd-row-class' : 'even-row-class', 'custom-static-class')}
41
41
  style={isOddRow ? customStyle : {}}
42
42
  />
@@ -29,9 +29,7 @@ export const LegacyTableStripedCustomTr: React.FunctionComponent = () => {
29
29
 
30
30
  const customRowWrapper: TableProps['rowWrapper'] = ({ trRef, className, rowProps, row: _row }) => {
31
31
  const isOddRow = rowProps ? !!((rowProps.rowIndex + 1) % 2) : true;
32
- return (
33
- <tr ref={trRef as React.LegacyRef<HTMLTableRowElement>} className={css(className, isOddRow && 'pf-m-striped')} />
34
- );
32
+ return <tr ref={trRef as React.Ref<HTMLTableRowElement>} className={css(className, isOddRow && 'pf-m-striped')} />;
35
33
  };
36
34
 
37
35
  return (
@@ -41,7 +41,7 @@ export const TableProvider = withContext({
41
41
  contextType: { columns: PropTypes.any, renderers: PropTypes.any }
42
42
  })('table');
43
43
 
44
- const MockedTableChanges = ({ updateFunc, columns }) => (
44
+ const MockedTableChanges = ({ updateFunc = () => undefined, columns = [] }) => (
45
45
  <TableContext.Provider value={{ updateHeaderData: updateFunc }}>
46
46
  <TableProvider>
47
47
  <TableHeader headerRows={columns} />
@@ -54,9 +54,4 @@ MockedTableChanges.propTypes = {
54
54
  columns: PropTypes.array
55
55
  };
56
56
 
57
- MockedTableChanges.defaultProps = {
58
- updateFunc: () => undefined,
59
- columns: []
60
- };
61
-
62
57
  export default MockedTableChanges;