@patternfly/react-table 6.0.0-alpha.5 → 6.0.0-alpha.50

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 (147) hide show
  1. package/CHANGELOG.md +540 -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 +1 -2
  12. package/dist/esm/components/Table/ActionsColumn.js.map +1 -1
  13. package/dist/esm/components/Table/EditableSelectInputCell.js +1 -1
  14. package/dist/esm/components/Table/EditableSelectInputCell.js.map +1 -1
  15. package/dist/esm/components/Table/EditableTextCell.js +1 -1
  16. package/dist/esm/components/Table/EditableTextCell.js.map +1 -1
  17. package/dist/esm/components/Table/SelectColumn.d.ts +5 -0
  18. package/dist/esm/components/Table/SelectColumn.d.ts.map +1 -1
  19. package/dist/esm/components/Table/SelectColumn.js +6 -3
  20. package/dist/esm/components/Table/SelectColumn.js.map +1 -1
  21. package/dist/esm/components/Table/SortColumn.d.ts +4 -0
  22. package/dist/esm/components/Table/SortColumn.d.ts.map +1 -1
  23. package/dist/esm/components/Table/SortColumn.js +2 -2
  24. package/dist/esm/components/Table/SortColumn.js.map +1 -1
  25. package/dist/esm/components/Table/Table.js +2 -2
  26. package/dist/esm/components/Table/TableText.d.ts +3 -1
  27. package/dist/esm/components/Table/TableText.d.ts.map +1 -1
  28. package/dist/esm/components/Table/TableText.js +12 -10
  29. package/dist/esm/components/Table/TableText.js.map +1 -1
  30. package/dist/esm/components/Table/TableTypes.d.ts +3 -0
  31. package/dist/esm/components/Table/TableTypes.d.ts.map +1 -1
  32. package/dist/esm/components/Table/Td.d.ts +1 -1
  33. package/dist/esm/components/Table/Th.d.ts +3 -0
  34. package/dist/esm/components/Table/Th.d.ts.map +1 -1
  35. package/dist/esm/components/Table/Th.js +14 -7
  36. package/dist/esm/components/Table/Th.js.map +1 -1
  37. package/dist/esm/components/Table/utils/decorators/selectable.d.ts.map +1 -1
  38. package/dist/esm/components/Table/utils/decorators/selectable.js +2 -2
  39. package/dist/esm/components/Table/utils/decorators/selectable.js.map +1 -1
  40. package/dist/esm/components/Table/utils/decorators/sortable.d.ts.map +1 -1
  41. package/dist/esm/components/Table/utils/decorators/sortable.js +6 -3
  42. package/dist/esm/components/Table/utils/decorators/sortable.js.map +1 -1
  43. package/dist/esm/components/Table/utils/decorators/treeRow.d.ts +1 -1
  44. package/dist/esm/demos/DashboardHeader.d.ts +8 -0
  45. package/dist/esm/demos/DashboardHeader.d.ts.map +1 -0
  46. package/dist/esm/demos/DashboardHeader.js +77 -0
  47. package/dist/esm/demos/DashboardHeader.js.map +1 -0
  48. package/dist/esm/demos/DashboardWrapper.d.ts +85 -0
  49. package/dist/esm/demos/DashboardWrapper.d.ts.map +1 -0
  50. package/dist/esm/demos/DashboardWrapper.js +41 -0
  51. package/dist/esm/demos/DashboardWrapper.js.map +1 -0
  52. package/dist/esm/demos/index.d.ts +2 -0
  53. package/dist/esm/demos/index.d.ts.map +1 -1
  54. package/dist/esm/demos/index.js +2 -0
  55. package/dist/esm/demos/index.js.map +1 -1
  56. package/dist/js/components/Table/ActionsColumn.d.ts.map +1 -1
  57. package/dist/js/components/Table/ActionsColumn.js +1 -2
  58. package/dist/js/components/Table/ActionsColumn.js.map +1 -1
  59. package/dist/js/components/Table/EditableSelectInputCell.js +1 -1
  60. package/dist/js/components/Table/EditableSelectInputCell.js.map +1 -1
  61. package/dist/js/components/Table/EditableTextCell.js +1 -1
  62. package/dist/js/components/Table/EditableTextCell.js.map +1 -1
  63. package/dist/js/components/Table/SelectColumn.d.ts +5 -0
  64. package/dist/js/components/Table/SelectColumn.d.ts.map +1 -1
  65. package/dist/js/components/Table/SelectColumn.js +6 -3
  66. package/dist/js/components/Table/SelectColumn.js.map +1 -1
  67. package/dist/js/components/Table/SortColumn.d.ts +4 -0
  68. package/dist/js/components/Table/SortColumn.d.ts.map +1 -1
  69. package/dist/js/components/Table/SortColumn.js +3 -2
  70. package/dist/js/components/Table/SortColumn.js.map +1 -1
  71. package/dist/js/components/Table/Table.js +2 -2
  72. package/dist/js/components/Table/TableText.d.ts +3 -1
  73. package/dist/js/components/Table/TableText.d.ts.map +1 -1
  74. package/dist/js/components/Table/TableText.js +12 -10
  75. package/dist/js/components/Table/TableText.js.map +1 -1
  76. package/dist/js/components/Table/TableTypes.d.ts +3 -0
  77. package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
  78. package/dist/js/components/Table/Td.d.ts +1 -1
  79. package/dist/js/components/Table/Th.d.ts +3 -0
  80. package/dist/js/components/Table/Th.d.ts.map +1 -1
  81. package/dist/js/components/Table/Th.js +14 -7
  82. package/dist/js/components/Table/Th.js.map +1 -1
  83. package/dist/js/components/Table/utils/decorators/selectable.d.ts.map +1 -1
  84. package/dist/js/components/Table/utils/decorators/selectable.js +2 -2
  85. package/dist/js/components/Table/utils/decorators/selectable.js.map +1 -1
  86. package/dist/js/components/Table/utils/decorators/sortable.d.ts.map +1 -1
  87. package/dist/js/components/Table/utils/decorators/sortable.js +6 -3
  88. package/dist/js/components/Table/utils/decorators/sortable.js.map +1 -1
  89. package/dist/js/components/Table/utils/decorators/treeRow.d.ts +1 -1
  90. package/dist/js/demos/DashboardHeader.d.ts +8 -0
  91. package/dist/js/demos/DashboardHeader.d.ts.map +1 -0
  92. package/dist/js/demos/DashboardHeader.js +82 -0
  93. package/dist/js/demos/DashboardHeader.js.map +1 -0
  94. package/dist/js/demos/DashboardWrapper.d.ts +85 -0
  95. package/dist/js/demos/DashboardWrapper.d.ts.map +1 -0
  96. package/dist/js/demos/DashboardWrapper.js +45 -0
  97. package/dist/js/demos/DashboardWrapper.js.map +1 -0
  98. package/dist/js/demos/index.d.ts +2 -0
  99. package/dist/js/demos/index.d.ts.map +1 -1
  100. package/dist/js/demos/index.js +2 -0
  101. package/dist/js/demos/index.js.map +1 -1
  102. package/dist/umd/react-table.min.js +3 -3
  103. package/package.json +6 -6
  104. package/single-packages.config.json +3 -6
  105. package/src/components/Table/ActionsColumn.tsx +2 -3
  106. package/src/components/Table/EditableSelectInputCell.tsx +1 -1
  107. package/src/components/Table/EditableTextCell.tsx +1 -1
  108. package/src/components/Table/SelectColumn.tsx +27 -8
  109. package/src/components/Table/SortColumn.tsx +15 -1
  110. package/src/components/Table/Table.tsx +2 -2
  111. package/src/components/Table/TableText.tsx +19 -9
  112. package/src/components/Table/TableTypes.tsx +3 -0
  113. package/src/components/Table/Td.tsx +1 -1
  114. package/src/components/Table/Th.tsx +16 -5
  115. package/src/components/Table/__tests__/__snapshots__/RowWrapper.test.tsx.snap +2 -2
  116. package/src/components/Table/examples/TableActionsOverflow.tsx +2 -3
  117. package/src/components/Table/examples/TableEmptyState.tsx +1 -8
  118. package/src/components/Table/examples/TableNestedHeaders.tsx +4 -6
  119. package/src/components/Table/examples/TableNestedStickyHeader.tsx +4 -6
  120. package/src/components/Table/examples/TableSortableCustom.tsx +2 -3
  121. package/src/components/Table/examples/TableStickyColumnsAndHeader.tsx +1 -1
  122. package/src/components/Table/utils/__snapshots__/transformers.test.tsx.snap +2 -2
  123. package/src/components/Table/utils/decorators/selectable.tsx +2 -1
  124. package/src/components/Table/utils/decorators/sortable.tsx +8 -2
  125. package/src/demos/DashboardHeader.tsx +198 -0
  126. package/src/demos/DashboardWrapper.tsx +199 -0
  127. package/src/demos/Table.md +28 -4
  128. package/src/demos/assets/avatarImg.svg +18 -0
  129. package/src/demos/assets/index.d.ts +4 -0
  130. package/src/demos/assets/pf-logo.svg +28 -0
  131. package/src/demos/examples/TableBulkSelect.tsx +1 -1
  132. package/src/demos/examples/TableColumnManagement.tsx +7 -7
  133. package/src/demos/examples/TableColumnManagementWithDraggable.tsx +2 -6
  134. package/src/demos/examples/TableCompact.tsx +8 -3
  135. package/src/demos/examples/TableCompoundExpansion.tsx +8 -3
  136. package/src/demos/examples/TableEmptyStateDefault.tsx +1 -1
  137. package/src/demos/examples/TableEmptyStateError.tsx +1 -1
  138. package/src/demos/examples/TableEmptyStateLoading.tsx +1 -1
  139. package/src/demos/examples/TableExpandCollapseAll.tsx +1 -1
  140. package/src/demos/examples/TableSortableResponsive.tsx +8 -9
  141. package/src/demos/examples/TableStaticBottomPagination.tsx +8 -3
  142. package/src/demos/examples/TableStickyFirstColumn.tsx +1 -1
  143. package/src/demos/examples/TableStickyHeader.tsx +1 -1
  144. package/src/demos/index.ts +2 -0
  145. package/src/deprecated/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +1950 -1874
  146. package/src/deprecated/components/Table/examples/LegacyTableEmptyState.tsx +6 -8
  147. package/src/deprecated/components/Table/examples/LegacyTableSortableCustom.tsx +2 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-table",
3
- "version": "6.0.0-alpha.5",
3
+ "version": "6.0.0-alpha.50",
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,10 +40,10 @@
40
40
  "subpaths": "node ../../scripts/exportSubpaths.js --config subpaths.config.json"
41
41
  },
42
42
  "dependencies": {
43
- "@patternfly/react-core": "^6.0.0-alpha.5",
44
- "@patternfly/react-icons": "^6.0.0-alpha.4",
45
- "@patternfly/react-styles": "^6.0.0-alpha.4",
46
- "@patternfly/react-tokens": "^6.0.0-alpha.4",
43
+ "@patternfly/react-core": "^6.0.0-alpha.50",
44
+ "@patternfly/react-icons": "^6.0.0-alpha.19",
45
+ "@patternfly/react-styles": "^6.0.0-alpha.19",
46
+ "@patternfly/react-tokens": "^6.0.0-alpha.19",
47
47
  "lodash": "^4.17.19",
48
48
  "tslib": "^2.5.0"
49
49
  },
@@ -55,5 +55,5 @@
55
55
  "react": "^17 || ^18",
56
56
  "react-dom": "^17 || ^18"
57
57
  },
58
- "gitHead": "0213323de9e62364f8cd3f401bec86f1f34ee4fe"
58
+ "gitHead": "ef6f95d064bfbb8f5aaa134ab6941f63ccf36111"
59
59
  }
@@ -1,7 +1,4 @@
1
1
  {
2
- "packageName": "@patternfly/react-table",
3
- "exclude": [
4
- "dist/esm/deprecated/index.js",
5
- "dist/esm/next/index.js"
6
- ]
7
- }
2
+ "packageName": "@patternfly/react-table",
3
+ "exclude": ["dist/esm/deprecated/index.js", "dist/esm/next/index.js"]
4
+ }
@@ -103,9 +103,8 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
103
103
  isExpanded={isOpen}
104
104
  isDisabled={isDisabled}
105
105
  variant="plain"
106
- >
107
- <EllipsisVIcon />
108
- </MenuToggle>
106
+ icon={<EllipsisVIcon />}
107
+ />
109
108
  )
110
109
  }
111
110
  {...(rowData && rowData.actionProps)}
@@ -76,7 +76,7 @@ export const EditableSelectInputCell: React.FunctionComponent<IEditableSelectInp
76
76
  <div className={inlineStyles.inlineEditValue}>{Array.isArray(value) ? value.join(', ') : value}</div>
77
77
  <div className={inlineStyles.inlineEditInput}>
78
78
  {select}
79
- <div className={css(formStyles.formHelperText, formStyles.modifiers.error)} aria-live="polite">
79
+ <div className={css(formStyles.formHelperText)} aria-live="polite">
80
80
  {props.errorText}
81
81
  </div>
82
82
  </div>
@@ -49,7 +49,7 @@ export const EditableTextCell: React.FunctionComponent<IEditableTextCell> = ({
49
49
  }}
50
50
  aria-label={inputAriaLabel}
51
51
  />
52
- <div className={css(formStyles.formHelperText, formStyles.modifiers.error)} aria-live="polite">
52
+ <div className={css(formStyles.formHelperText)} aria-live="polite">
53
53
  {props.errorText}
54
54
  </div>
55
55
  </div>
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { Tooltip, TooltipProps } from '@patternfly/react-core/dist/esm/components/Tooltip';
2
3
 
3
4
  export enum RowSelectVariant {
4
5
  radio = 'radio',
@@ -11,6 +12,10 @@ export interface SelectColumnProps {
11
12
  className?: string;
12
13
  onSelect?: (event: React.FormEvent<HTMLInputElement>) => void;
13
14
  selectVariant?: RowSelectVariant;
15
+ /** text to display on the tooltip */
16
+ tooltip?: React.ReactNode;
17
+ /** other props to pass to the tooltip */
18
+ tooltipProps?: Omit<TooltipProps, 'content'>;
14
19
  }
15
20
 
16
21
  export const SelectColumn: React.FunctionComponent<SelectColumnProps> = ({
@@ -19,13 +24,27 @@ export const SelectColumn: React.FunctionComponent<SelectColumnProps> = ({
19
24
  className,
20
25
  onSelect = null as (event: React.FormEvent<HTMLInputElement>) => void,
21
26
  selectVariant,
27
+ tooltip,
28
+ tooltipProps,
22
29
  ...props
23
- }: SelectColumnProps) => (
24
- <React.Fragment>
25
- <label>
26
- <input {...props} type={selectVariant} onChange={onSelect} />
27
- </label>
28
- {children}
29
- </React.Fragment>
30
- );
30
+ }: SelectColumnProps) => {
31
+ const inputRef = React.createRef<HTMLInputElement>();
32
+
33
+ const content = (
34
+ <React.Fragment>
35
+ <label>
36
+ <input {...props} ref={inputRef} type={selectVariant} onChange={onSelect} />
37
+ </label>
38
+ {children}
39
+ </React.Fragment>
40
+ );
41
+
42
+ return tooltip ? (
43
+ <Tooltip triggerRef={inputRef} content={tooltip} {...tooltipProps}>
44
+ {content}
45
+ </Tooltip>
46
+ ) : (
47
+ content
48
+ );
49
+ };
31
50
  SelectColumn.displayName = 'SelectColumn';
@@ -5,6 +5,7 @@ import ArrowsAltVIcon from '@patternfly/react-icons/dist/esm/icons/arrows-alt-v-
5
5
  import { css } from '@patternfly/react-styles';
6
6
  import styles from '@patternfly/react-styles/css/components/Table/table';
7
7
  import { TableText } from './TableText';
8
+ import { TooltipProps } from '@patternfly/react-core/dist/esm/components/Tooltip';
8
9
 
9
10
  export enum SortByDirection {
10
11
  asc = 'asc',
@@ -17,6 +18,9 @@ export interface SortColumnProps extends React.ButtonHTMLAttributes<HTMLButtonEl
17
18
  isSortedBy?: boolean;
18
19
  onSort?: Function;
19
20
  sortDirection?: string;
21
+ tooltip?: React.ReactNode;
22
+ tooltipProps?: Omit<TooltipProps, 'content'>;
23
+ tooltipHasDefaultBehavior?: boolean;
20
24
  }
21
25
 
22
26
  export const SortColumn: React.FunctionComponent<SortColumnProps> = ({
@@ -26,6 +30,9 @@ export const SortColumn: React.FunctionComponent<SortColumnProps> = ({
26
30
  onSort = null,
27
31
  sortDirection = '',
28
32
  type = 'button',
33
+ tooltip,
34
+ tooltipProps,
35
+ tooltipHasDefaultBehavior,
29
36
  ...props
30
37
  }: SortColumnProps) => {
31
38
  let SortedByIcon;
@@ -45,7 +52,14 @@ export const SortColumn: React.FunctionComponent<SortColumnProps> = ({
45
52
  onBlur={() => setFocused(false)}
46
53
  >
47
54
  <div className={css(className, styles.tableButtonContent)}>
48
- <TableText focused={focused}>{children}</TableText>
55
+ <TableText
56
+ tooltip={tooltip}
57
+ tooltipProps={tooltipProps}
58
+ tooltipHasDefaultBehavior={tooltipHasDefaultBehavior}
59
+ focused={focused}
60
+ >
61
+ {children}
62
+ </TableText>
49
63
  <span className={css(styles.tableSortIndicator)}>
50
64
  <SortedByIcon />
51
65
  </span>
@@ -124,7 +124,7 @@ const TableBase: React.FunctionComponent<TableProps> = ({
124
124
  setTableCaption(
125
125
  <caption>
126
126
  {selectableRowCaptionText}
127
- <div className="pf-v5-screen-reader">
127
+ <div className="pf-v6-screen-reader">
128
128
  This table has selectable rows. It can be navigated by row using tab, and each row can be selected using
129
129
  space or enter.
130
130
  </div>
@@ -132,7 +132,7 @@ const TableBase: React.FunctionComponent<TableProps> = ({
132
132
  );
133
133
  } else {
134
134
  setTableCaption(
135
- <caption className="pf-v5-screen-reader">
135
+ <caption className="pf-v6-screen-reader">
136
136
  This table has selectable rows. It can be navigated by row using tab, and each row can be selected using space
137
137
  or enter.
138
138
  </caption>
@@ -26,13 +26,15 @@ export interface TableTextProps extends React.HTMLProps<HTMLDivElement> {
26
26
  /** Determines which wrapping modifier to apply to the table text */
27
27
  wrapModifier?: WrapModifier | 'wrap' | 'nowrap' | 'truncate' | 'breakWord' | 'fitContent';
28
28
  /** text to display on the tooltip */
29
- tooltip?: string;
29
+ tooltip?: React.ReactNode;
30
30
  /** other props to pass to the tooltip */
31
31
  tooltipProps?: Omit<TooltipProps, 'content'>;
32
32
  /** callback used to create the tooltip if text is truncated */
33
33
  onMouseEnter?: (event: any) => void;
34
34
  /** Determines if the TableText is focused by parent component */
35
35
  focused?: boolean;
36
+ /** Determines if tooltip should have normal visbility behavior. If false, the tooltip will only be shown when children is not entirely visible */
37
+ tooltipHasDefaultBehavior?: boolean;
36
38
  }
37
39
 
38
40
  export const TableText: React.FunctionComponent<TableTextProps> = ({
@@ -44,12 +46,13 @@ export const TableText: React.FunctionComponent<TableTextProps> = ({
44
46
  tooltipProps = {},
45
47
  onMouseEnter: onMouseEnterProp = () => {},
46
48
  focused = false,
49
+ tooltipHasDefaultBehavior = false,
47
50
  ...props
48
51
  }: TableTextProps) => {
49
52
  const Component: TableTextVariant | 'span' | 'div' = variant;
50
53
  const textRef = React.createRef<HTMLElement>();
51
54
 
52
- const [tooltip, setTooltip] = React.useState('');
55
+ const [tooltip, setTooltip] = React.useState(tooltipProp);
53
56
  const onMouseEnter = (event: any) => {
54
57
  if (event.target.offsetWidth < event.target.scrollWidth) {
55
58
  setTooltip(tooltipProp || event.target.innerText);
@@ -70,7 +73,7 @@ export const TableText: React.FunctionComponent<TableTextProps> = ({
70
73
  const text = (
71
74
  <Component
72
75
  ref={textRef as React.Ref<HTMLDivElement>}
73
- onMouseEnter={onMouseEnter}
76
+ onMouseEnter={!tooltipHasDefaultBehavior ? onMouseEnter : undefined}
74
77
  className={css(className, wrapModifier && styles.modifiers[wrapModifier], styles.tableText)}
75
78
  {...props}
76
79
  >
@@ -79,15 +82,22 @@ export const TableText: React.FunctionComponent<TableTextProps> = ({
79
82
  );
80
83
 
81
84
  React.useEffect(() => {
82
- if (focused) {
83
- onFocus(textRef.current);
84
- } else {
85
- setTooltip('');
85
+ if (!tooltipHasDefaultBehavior) {
86
+ if (focused) {
87
+ onFocus(textRef.current);
88
+ } else {
89
+ setTooltip('');
90
+ }
86
91
  }
87
- }, [focused]);
92
+ }, [focused, tooltipHasDefaultBehavior]);
88
93
 
89
94
  return tooltip !== '' ? (
90
- <Tooltip triggerRef={textRef} content={tooltip} isVisible {...tooltipProps}>
95
+ <Tooltip
96
+ triggerRef={textRef}
97
+ content={tooltip}
98
+ {...(!tooltipHasDefaultBehavior && { isVisible: true })}
99
+ {...tooltipProps}
100
+ >
91
101
  {text}
92
102
  </Tooltip>
93
103
  ) : (
@@ -132,6 +132,9 @@ export interface IExtra extends IExtraData {
132
132
  rowData?: IRowData;
133
133
  className?: string;
134
134
  ariaLabel?: string;
135
+ tooltip?: React.ReactNode;
136
+ tooltipProps?: Omit<TooltipProps, 'content'>;
137
+ tooltipHasDefaultBehavior?: boolean;
135
138
  }
136
139
 
137
140
  export type IFormatterValueType = formatterValueType & {
@@ -55,7 +55,7 @@ export interface TdProps extends BaseCellProps, Omit<React.HTMLProps<HTMLTableDa
55
55
  draggableRow?: TdDraggableType;
56
56
  /** True to remove padding */
57
57
  noPadding?: boolean;
58
- /** Applies pf-v5-c-table__action to td */
58
+ /** Applies pf-v6-c-table__action to td */
59
59
  isActionCell?: boolean;
60
60
  /**
61
61
  * Tooltip to show on the body cell.
@@ -6,7 +6,7 @@ import { info, sortable, sortableFavorites, selectable, collapsible, cellWidth,
6
6
  import { ThInfoType, ThSelectType, ThExpandType, ThSortType, formatterValueType } from './base/types';
7
7
  import { mergeProps } from './base/merge-props';
8
8
  import { IVisibility } from './utils/decorators/classNames';
9
- import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip/Tooltip';
9
+ import { Tooltip, TooltipProps } from '@patternfly/react-core/dist/esm/components/Tooltip';
10
10
  import { BaseCellProps } from './Table';
11
11
  import { IFormatterValueType, IColumn } from './TableTypes';
12
12
  import cssStickyCellMinWidth from '@patternfly/react-tokens/dist/esm/c_table__sticky_cell_MinWidth';
@@ -34,6 +34,8 @@ export interface ThProps
34
34
  * To disable it completely you can set it to null.
35
35
  */
36
36
  tooltip?: React.ReactNode;
37
+ /** other props to pass to the tooltip */
38
+ tooltipProps?: Omit<TooltipProps, 'content'>;
37
39
  /** Callback on mouse enter */
38
40
  onMouseEnter?: (event: any) => void;
39
41
  /** Adds tooltip/popover info button */
@@ -68,6 +70,7 @@ const ThBase: React.FunctionComponent<ThProps> = ({
68
70
  select = null,
69
71
  expand: collapse = null,
70
72
  tooltip = '',
73
+ tooltipProps,
71
74
  onMouseEnter: onMouseEnterProp = () => {},
72
75
  width,
73
76
  visibility,
@@ -99,7 +102,9 @@ const ThBase: React.FunctionComponent<ThProps> = ({
99
102
  sortParams = sortableFavorites({
100
103
  onSort: sort?.onSort,
101
104
  columnIndex: sort.columnIndex,
102
- sortBy: sort.sortBy
105
+ sortBy: sort.sortBy,
106
+ tooltip: tooltip as string,
107
+ tooltipProps
103
108
  })();
104
109
  } else {
105
110
  sortParams = sortable(children as IFormatterValueType, {
@@ -109,7 +114,9 @@ const ThBase: React.FunctionComponent<ThProps> = ({
109
114
  sortBy: sort.sortBy,
110
115
  onSort: sort?.onSort
111
116
  }
112
- } as IColumn
117
+ } as IColumn,
118
+ tooltip: tooltip as string,
119
+ tooltipProps
113
120
  });
114
121
  }
115
122
  }
@@ -127,7 +134,9 @@ const ThBase: React.FunctionComponent<ThProps> = ({
127
134
  allRowsSelected: select.isSelected,
128
135
  isHeaderSelectDisabled: !!select.isHeaderSelectDisabled
129
136
  }
130
- }
137
+ },
138
+ tooltip: tooltip as string,
139
+ tooltipProps
131
140
  })
132
141
  : null;
133
142
  const collapseParams = collapse
@@ -208,13 +217,15 @@ const ThBase: React.FunctionComponent<ThProps> = ({
208
217
  );
209
218
 
210
219
  const canMakeDefaultTooltip = tooltip === '' ? typeof transformedChildren === 'string' : true;
211
- return tooltip !== null && canMakeDefaultTooltip && showTooltip ? (
220
+ const childControlsTooltip = sortParams || selectParams;
221
+ return tooltip !== null && canMakeDefaultTooltip && !childControlsTooltip && showTooltip ? (
212
222
  <>
213
223
  {cell}
214
224
  <Tooltip
215
225
  triggerRef={cellRef as React.RefObject<any>}
216
226
  content={tooltip || (tooltip === '' && children)}
217
227
  isVisible
228
+ {...tooltipProps}
218
229
  />
219
230
  </>
220
231
  ) : (
@@ -5,7 +5,7 @@ exports[`RowWrapper renders correctly 1`] = `
5
5
  <table>
6
6
  <tbody>
7
7
  <tr
8
- class="pf-v5-c-table__tr"
8
+ class="pf-v6-c-table__tr"
9
9
  data-ouia-component-id="OUIA-Generated-TableRow-1"
10
10
  data-ouia-component-type="PF5/TableRow"
11
11
  data-ouia-safe="true"
@@ -20,7 +20,7 @@ exports[`RowWrapper renders expanded correctly 1`] = `
20
20
  <table>
21
21
  <tbody>
22
22
  <tr
23
- class="pf-v5-c-table__tr pf-v5-c-table__expandable-row pf-m-expanded"
23
+ class="pf-v6-c-table__tr pf-v6-c-table__expandable-row pf-m-expanded"
24
24
  data-ouia-component-id="OUIA-Generated-TableRow-2"
25
25
  data-ouia-component-type="PF5/TableRow"
26
26
  data-ouia-safe="true"
@@ -106,9 +106,8 @@ export const TableActions: React.FunctionComponent = () => {
106
106
  setRepos(repos.map((r) => (r.name !== repo.name ? r : { ...r, isMenuOpen: !r.isMenuOpen })))
107
107
  }
108
108
  isExpanded={repo.isMenuOpen}
109
- >
110
- <EllipsisVIcon />
111
- </MenuToggle>
109
+ icon={<EllipsisVIcon />}
110
+ />
112
111
  )}
113
112
  isOpen={repo.isMenuOpen}
114
113
  onOpenChange={(isOpen) =>
@@ -4,10 +4,8 @@ import {
4
4
  Bullseye,
5
5
  EmptyState,
6
6
  EmptyStateVariant,
7
- EmptyStateIcon,
8
7
  EmptyStateBody,
9
8
  Button,
10
- EmptyStateHeader,
11
9
  EmptyStateFooter,
12
10
  EmptyStateActions
13
11
  } from '@patternfly/react-core';
@@ -31,12 +29,7 @@ export const TableEmptyState: React.FunctionComponent = () => (
31
29
  <Tr>
32
30
  <Td colSpan={8}>
33
31
  <Bullseye>
34
- <EmptyState variant={EmptyStateVariant.sm}>
35
- <EmptyStateHeader
36
- icon={<EmptyStateIcon icon={SearchIcon} />}
37
- titleText="No results found"
38
- headingLevel="h2"
39
- />
32
+ <EmptyState headingLevel="h2" titleText="No results found" icon={SearchIcon} variant={EmptyStateVariant.sm}>
40
33
  <EmptyStateBody>Clear all filters and try again.</EmptyStateBody>
41
34
  <EmptyStateFooter>
42
35
  <EmptyStateActions>
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Table, Thead, Tr, Th, Tbody, Td, InnerScrollContainer, ThProps } from '@patternfly/react-table';
3
- import { Stack, StackItem } from '@patternfly/react-core';
4
- import textStyles from '@patternfly/react-styles/css/utilities/Text/text';
5
-
3
+ import { Stack, StackItem, Timestamp } from '@patternfly/react-core';
6
4
  interface PodConnection {
7
5
  source: {
8
6
  podName: string;
@@ -163,7 +161,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
163
161
  <Td dataLabel={columnNames.datetime}>
164
162
  <div>
165
163
  <span>{new Date(connection.timestamp).toDateString()}</span>{' '}
166
- <span className={textStyles.color_200}>{new Date(connection.timestamp).toLocaleTimeString()}</span>
164
+ <Timestamp>{new Date(connection.timestamp).toLocaleTimeString()}</Timestamp>
167
165
  </div>
168
166
  </Td>
169
167
  <Td dataLabel={columnNames.source}>
@@ -172,7 +170,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
172
170
  <span>{connection.source.port.num}</span>
173
171
  </StackItem>
174
172
  <StackItem>
175
- <span className={textStyles.color_200}>({connection.source.port.protocol})</span>
173
+ <Timestamp>({connection.source.port.protocol})</Timestamp>
176
174
  </StackItem>
177
175
  </Stack>
178
176
  </Td>
@@ -182,7 +180,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
182
180
  <span>{connection.destination.port.num}</span>
183
181
  </StackItem>
184
182
  <StackItem>
185
- <span className={textStyles.color_200}>({connection.destination.port.protocol})</span>
183
+ <Timestamp>({connection.destination.port.protocol})</Timestamp>
186
184
  </StackItem>
187
185
  </Stack>
188
186
  </Td>
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Table, Thead, Tr, Th, Tbody, Td, InnerScrollContainer, ThProps } from '@patternfly/react-table';
3
- import { Stack, StackItem } from '@patternfly/react-core';
4
- import textStyles from '@patternfly/react-styles/css/utilities/Text/text';
5
-
3
+ import { Stack, StackItem, Timestamp } from '@patternfly/react-core';
6
4
  interface PodConnection {
7
5
  source: {
8
6
  podName: string;
@@ -166,7 +164,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
166
164
  <Td dataLabel={columnNames.datetime}>
167
165
  <div>
168
166
  <span>{new Date(connection.timestamp).toDateString()}</span>{' '}
169
- <span className={textStyles.color_200}>{new Date(connection.timestamp).toLocaleTimeString()}</span>
167
+ <Timestamp>{new Date(connection.timestamp).toLocaleTimeString()}</Timestamp>
170
168
  </div>
171
169
  </Td>
172
170
  <Td dataLabel={columnNames.source}>
@@ -175,7 +173,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
175
173
  <span>{connection.source.port.num}</span>
176
174
  </StackItem>
177
175
  <StackItem>
178
- <span className={textStyles.color_200}>({connection.source.port.protocol})</span>
176
+ <Timestamp>({connection.source.port.protocol})</Timestamp>
179
177
  </StackItem>
180
178
  </Stack>
181
179
  </Td>
@@ -185,7 +183,7 @@ export const TableNestedHeaders: React.FunctionComponent = () => {
185
183
  <span>{connection.destination.port.num}</span>
186
184
  </StackItem>
187
185
  <StackItem>
188
- <span className={textStyles.color_200}>({connection.destination.port.protocol})</span>
186
+ <Timestamp>({connection.destination.port.protocol})</Timestamp>
189
187
  </StackItem>
190
188
  </Stack>
191
189
  </Td>
@@ -117,9 +117,8 @@ export const TableSortableCustom: React.FunctionComponent = () => {
117
117
  isExpanded={isSortDropdownOpen}
118
118
  variant="plain"
119
119
  aria-label="Sort columns"
120
- >
121
- <SortAmountDownIcon />
122
- </MenuToggle>
120
+ icon={<SortAmountDownIcon />}
121
+ />
123
122
  )}
124
123
  >
125
124
  <SelectGroup label="Sort column">
@@ -98,7 +98,7 @@ export const TableStickyColumnsAndHeader: React.FunctionComponent = () => {
98
98
  });
99
99
 
100
100
  return (
101
- <div style={{ height: '600px' }}>
101
+ <div style={{ height: '400px' }}>
102
102
  <OuterScrollContainer>
103
103
  <InnerScrollContainer>
104
104
  <Table aria-label="Sticky columns and header table" gridBreakPoint="" isStickyHeader>
@@ -10,7 +10,7 @@ Object {
10
10
  >
11
11
 
12
12
  </SelectColumn>,
13
- "className": "pf-v5-c-table__check",
13
+ "className": "pf-v6-c-table__check",
14
14
  "component": "td",
15
15
  "isVisible": true,
16
16
  }
@@ -26,6 +26,6 @@ Object {
26
26
  >
27
27
 
28
28
  </SortColumn>,
29
- "className": "pf-v5-c-table__sort pf-m-selected",
29
+ "className": "pf-v6-c-table__sort pf-m-selected",
30
30
  }
31
31
  `;
@@ -7,7 +7,7 @@ import checkStyles from '@patternfly/react-styles/css/components/Check/check';
7
7
 
8
8
  export const selectable: ITransform = (
9
9
  label: IFormatterValueType,
10
- { rowIndex, columnIndex, rowData, column, property }: IExtra
10
+ { rowIndex, columnIndex, rowData, column, property, tooltip }: IExtra
11
11
  ) => {
12
12
  const {
13
13
  extraParams: { onSelect, selectVariant, allRowsSelected, isHeaderSelectDisabled }
@@ -69,6 +69,7 @@ export const selectable: ITransform = (
69
69
  selectVariant={selectVariant as RowSelectVariant}
70
70
  onSelect={selectClick}
71
71
  name={selectName}
72
+ tooltip={tooltip}
72
73
  >
73
74
  {label as React.ReactNode}
74
75
  </SelectColumn>
@@ -15,12 +15,15 @@ export const sortableFavorites = (sort: any) => () =>
15
15
  sortBy: sort.sortBy,
16
16
  onSort: sort?.onSort
17
17
  }
18
- }
18
+ },
19
+ tooltip: sort.tooltip,
20
+ tooltipProps: sort.tooltipProps,
21
+ tooltipHasDefaultBehavior: true
19
22
  });
20
23
 
21
24
  export const sortable: ITransform = (
22
25
  label: IFormatterValueType,
23
- { columnIndex, column, property, className, ariaLabel }: IExtra
26
+ { columnIndex, column, property, className, ariaLabel, tooltip, tooltipProps, tooltipHasDefaultBehavior }: IExtra
24
27
  ) => {
25
28
  const {
26
29
  extraParams: { sortBy, onSort }
@@ -56,6 +59,9 @@ export const sortable: ITransform = (
56
59
  sortDirection={isSortedBy ? sortBy.direction : ''}
57
60
  onSort={sortClicked}
58
61
  aria-label={ariaLabel}
62
+ tooltip={tooltip}
63
+ tooltipProps={tooltipProps}
64
+ tooltipHasDefaultBehavior={tooltipHasDefaultBehavior}
59
65
  >
60
66
  {label as React.ReactNode}
61
67
  </SortColumn>