@patternfly/react-table 6.5.0-prerelease.32 → 6.5.0-prerelease.34

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": "6.5.0-prerelease.32",
3
+ "version": "6.5.0-prerelease.34",
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.mjs --config subpaths.config.json"
41
41
  },
42
42
  "dependencies": {
43
- "@patternfly/react-core": "^6.5.0-prerelease.31",
44
- "@patternfly/react-icons": "^6.5.0-prerelease.13",
45
- "@patternfly/react-styles": "^6.5.0-prerelease.11",
46
- "@patternfly/react-tokens": "^6.5.0-prerelease.10",
43
+ "@patternfly/react-core": "^6.5.0-prerelease.33",
44
+ "@patternfly/react-icons": "^6.5.0-prerelease.14",
45
+ "@patternfly/react-styles": "^6.5.0-prerelease.12",
46
+ "@patternfly/react-tokens": "^6.5.0-prerelease.11",
47
47
  "lodash": "^4.17.23",
48
48
  "tslib": "^2.8.1"
49
49
  },
@@ -51,5 +51,5 @@
51
51
  "react": "^17 || ^18 || ^19",
52
52
  "react-dom": "^17 || ^18 || ^19"
53
53
  },
54
- "gitHead": "d2d4b0c8b8f438fe41e560e0760efb2628623c03"
54
+ "gitHead": "46e1dcaa8507d2df0a8b99e49ce788fb25340074"
55
55
  }
@@ -23,7 +23,7 @@ interface Repository {
23
23
  singleAction: string;
24
24
  }
25
25
 
26
- type ExampleType = 'defaultToggle' | 'customToggle';
26
+ type ExampleType = 'customToggle';
27
27
 
28
28
  export const TableActions: React.FunctionComponent = () => {
29
29
  // In real usage, this data would come from some external source like an API via props.
@@ -45,10 +45,11 @@ export const TableActions: React.FunctionComponent = () => {
45
45
  };
46
46
 
47
47
  // This state is just for the ToggleGroup in this example and isn't necessary for Table usage.
48
- const [exampleChoice, setExampleChoice] = useState<ExampleType>('defaultToggle');
48
+ const [exampleChoice, setExampleChoice] = useState<ExampleType | ''>('');
49
49
  const onExampleTypeChange: ToggleGroupItemProps['onChange'] = (event, _isSelected) => {
50
50
  const id = event.currentTarget.id;
51
- setExampleChoice(id as ExampleType);
51
+ // Allow toggling off if clicking the already selected item
52
+ setExampleChoice(exampleChoice === id ? '' : (id as ExampleType));
52
53
  };
53
54
 
54
55
  const customActionsToggle = (props: CustomActionsToggleProps) => (
@@ -95,12 +96,6 @@ export const TableActions: React.FunctionComponent = () => {
95
96
  return (
96
97
  <Fragment>
97
98
  <ToggleGroup aria-label="Default uses kebab toggle">
98
- <ToggleGroupItem
99
- text="Default actions toggle"
100
- buttonId="defaultToggle"
101
- isSelected={exampleChoice === 'defaultToggle'}
102
- onChange={onExampleTypeChange}
103
- />
104
99
  <ToggleGroupItem
105
100
  text="Custom actions toggle"
106
101
  buttonId="customToggle"
@@ -10,7 +10,7 @@ interface Repository {
10
10
  lastCommit: string;
11
11
  }
12
12
 
13
- type ExampleType = 'default' | 'compact' | 'compactBorderless';
13
+ type ExampleType = 'compact' | 'compactBorderless';
14
14
 
15
15
  export const TableBasic: React.FunctionComponent = () => {
16
16
  // In real usage, this data would come from some external source like an API via props.
@@ -29,21 +29,16 @@ export const TableBasic: React.FunctionComponent = () => {
29
29
  };
30
30
 
31
31
  // This state is just for the ToggleGroup in this example and isn't necessary for Table usage.
32
- const [exampleChoice, setExampleChoice] = useState<ExampleType>('default');
32
+ const [exampleChoice, setExampleChoice] = useState<ExampleType | ''>('');
33
33
  const onExampleTypeChange: ToggleGroupItemProps['onChange'] = (event, _isSelected) => {
34
34
  const id = event.currentTarget.id;
35
- setExampleChoice(id as ExampleType);
35
+ // Allow toggling off if clicking the already selected item
36
+ setExampleChoice(exampleChoice === id ? '' : (id as ExampleType));
36
37
  };
37
38
 
38
39
  return (
39
40
  <Fragment>
40
41
  <ToggleGroup aria-label="Default with single selectable">
41
- <ToggleGroupItem
42
- text="Default"
43
- buttonId="default"
44
- isSelected={exampleChoice === 'default'}
45
- onChange={onExampleTypeChange}
46
- />
47
42
  <ToggleGroupItem
48
43
  text="Compact"
49
44
  buttonId="compact"
@@ -59,7 +54,7 @@ export const TableBasic: React.FunctionComponent = () => {
59
54
  </ToggleGroup>
60
55
  <Table
61
56
  aria-label="Simple table"
62
- variant={exampleChoice !== 'default' ? 'compact' : undefined}
57
+ variant={exampleChoice === 'compact' || exampleChoice === 'compactBorderless' ? 'compact' : undefined}
63
58
  borders={exampleChoice !== 'compactBorderless'}
64
59
  >
65
60
  <Caption>Simple table using composable components</Caption>