@patternfly/react-table 5.0.0-alpha.100 → 5.0.0-alpha.101

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-table",
3
- "version": "5.0.0-alpha.100",
3
+ "version": "5.0.0-alpha.101",
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/createSubpaths.js"
41
41
  },
42
42
  "dependencies": {
43
- "@patternfly/react-core": "^5.0.0-alpha.98",
43
+ "@patternfly/react-core": "^5.0.0-alpha.99",
44
44
  "@patternfly/react-icons": "^5.0.0-alpha.14",
45
45
  "@patternfly/react-styles": "^5.0.0-alpha.10",
46
46
  "@patternfly/react-tokens": "^5.0.0-alpha.9",
@@ -55,5 +55,5 @@
55
55
  "react": "^17 || ^18",
56
56
  "react-dom": "^17 || ^18"
57
57
  },
58
- "gitHead": "cb753616f434b5fc8308a19047867f16e4cceb65"
58
+ "gitHead": "00f77395c5d7d3e1fb8fc44c337cfdb63ab31638"
59
59
  }
@@ -8,7 +8,7 @@ import EllipsisVIcon from '@patternfly/react-icons/dist/esm/icons/ellipsis-v-ico
8
8
  import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip';
9
9
 
10
10
  export interface CustomActionsToggleProps {
11
- onToggle: (event: React.MouseEvent) => void;
11
+ onToggle: (event: React.MouseEvent | React.KeyboardEvent) => void;
12
12
  isOpen: boolean;
13
13
  isDisabled: boolean;
14
14
  toggleRef: React.Ref<any>;
@@ -28,6 +28,8 @@ export interface ActionsColumnProps extends Omit<React.HTMLProps<HTMLElement>, '
28
28
  popperProps?: any;
29
29
  /** @hide Forwarded ref */
30
30
  innerRef?: React.Ref<any>;
31
+ /** Ref to forward to the first item in the popup menu */
32
+ firstActionItemRef?: React.Ref<HTMLButtonElement>;
31
33
  }
32
34
 
33
35
  const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
@@ -40,6 +42,8 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
40
42
  position: 'right',
41
43
  direction: 'down'
42
44
  },
45
+ innerRef,
46
+ firstActionItemRef,
43
47
  ...props
44
48
  }: ActionsColumnProps) => {
45
49
  const [isOpen, setIsOpen] = React.useState(false);
@@ -103,15 +107,16 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
103
107
  )
104
108
  }
105
109
  {...(rowData && rowData.actionProps)}
110
+ ref={innerRef}
106
111
  {...props}
107
112
  popperProps={popperProps}
108
113
  >
109
114
  <DropdownList>
110
115
  {items
111
116
  .filter((item) => !item.isOutsideDropdown)
112
- .map(({ title, itemKey, onClick, tooltip, tooltipProps, isSeparator, ...props }, key) => {
117
+ .map(({ title, itemKey, onClick, tooltip, tooltipProps, isSeparator, ...props }, index) => {
113
118
  if (isSeparator) {
114
- return <Divider key={itemKey || key} data-key={itemKey || key} />;
119
+ return <Divider key={itemKey || index} data-key={itemKey || index} />;
115
120
  }
116
121
  const item = (
117
122
  <DropdownItem
@@ -120,8 +125,9 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
120
125
  onToggle();
121
126
  }}
122
127
  {...props}
123
- key={itemKey || key}
124
- data-key={itemKey || key}
128
+ key={itemKey || index}
129
+ data-key={itemKey || index}
130
+ ref={index === 0 ? firstActionItemRef : undefined}
125
131
  >
126
132
  {title}
127
133
  </DropdownItem>
@@ -129,7 +135,7 @@ const ActionsColumnBase: React.FunctionComponent<ActionsColumnProps> = ({
129
135
 
130
136
  if (tooltip) {
131
137
  return (
132
- <Tooltip key={itemKey || key} content={tooltip} {...tooltipProps}>
138
+ <Tooltip key={itemKey || index} content={tooltip} {...tooltipProps}>
133
139
  {item}
134
140
  </Tooltip>
135
141
  );