@patternfly/react-table 6.3.1-prerelease.2 → 6.3.1-prerelease.21

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 (35) hide show
  1. package/CHANGELOG.md +80 -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/FavoritesCell.d.ts.map +1 -1
  11. package/dist/esm/components/Table/FavoritesCell.js +1 -2
  12. package/dist/esm/components/Table/FavoritesCell.js.map +1 -1
  13. package/dist/esm/components/Table/SortColumn.d.ts.map +1 -1
  14. package/dist/esm/components/Table/SortColumn.js +2 -2
  15. package/dist/esm/components/Table/SortColumn.js.map +1 -1
  16. package/dist/esm/components/Table/Table.d.ts.map +1 -1
  17. package/dist/esm/components/Table/Table.js +3 -1
  18. package/dist/esm/components/Table/Table.js.map +1 -1
  19. package/dist/js/components/Table/FavoritesCell.d.ts.map +1 -1
  20. package/dist/js/components/Table/FavoritesCell.js +1 -2
  21. package/dist/js/components/Table/FavoritesCell.js.map +1 -1
  22. package/dist/js/components/Table/SortColumn.d.ts.map +1 -1
  23. package/dist/js/components/Table/SortColumn.js +2 -2
  24. package/dist/js/components/Table/SortColumn.js.map +1 -1
  25. package/dist/js/components/Table/Table.d.ts.map +1 -1
  26. package/dist/js/components/Table/Table.js +3 -1
  27. package/dist/js/components/Table/Table.js.map +1 -1
  28. package/dist/umd/assets/{output-BPhtr9PC.css → output-CXv8WiaJ.css} +3184 -3078
  29. package/dist/umd/react-table.min.js +3 -3
  30. package/package.json +6 -6
  31. package/src/components/Table/FavoritesCell.tsx +2 -2
  32. package/src/components/Table/SortColumn.tsx +2 -2
  33. package/src/components/Table/Table.tsx +3 -1
  34. package/src/components/Table/__tests__/Table.test.tsx +28 -0
  35. package/src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-table",
3
- "version": "6.3.1-prerelease.2",
3
+ "version": "6.3.1-prerelease.21",
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.3.1-prerelease.1",
44
- "@patternfly/react-icons": "^6.3.0",
45
- "@patternfly/react-styles": "^6.3.0",
46
- "@patternfly/react-tokens": "^6.3.0",
43
+ "@patternfly/react-core": "^6.3.1-prerelease.19",
44
+ "@patternfly/react-icons": "^6.3.1-prerelease.1",
45
+ "@patternfly/react-styles": "^6.3.1-prerelease.1",
46
+ "@patternfly/react-tokens": "^6.3.1-prerelease.1",
47
47
  "lodash": "^4.17.21",
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": "bc7a24267c0b8aff6f4ce5fd085aa6f01d5878bb"
54
+ "gitHead": "e5cd1519ea904754a1f0ad04da963ba451cf072e"
55
55
  }
@@ -1,4 +1,3 @@
1
- import StarIcon from '@patternfly/react-icons/dist/esm/icons/star-icon';
2
1
  import { Button } from '@patternfly/react-core/dist/esm/components/Button';
3
2
 
4
3
  export interface FavoritesCellProps {
@@ -30,9 +29,10 @@ export const FavoritesCell: React.FunctionComponent<FavoritesCellProps> = ({
30
29
  type="button"
31
30
  aria-label={isFavorited ? 'Starred' : 'Not starred'}
32
31
  onClick={onFavorite}
32
+ isFavorite
33
+ isFavorited={isFavorited}
33
34
  {...ariaProps}
34
35
  {...props}
35
- icon={<StarIcon />}
36
36
  />
37
37
  );
38
38
  };
@@ -2,7 +2,6 @@ import { useState } from 'react';
2
2
  import LongArrowAltUpIcon from '@patternfly/react-icons/dist/esm/icons/long-arrow-alt-up-icon';
3
3
  import LongArrowAltDownIcon from '@patternfly/react-icons/dist/esm/icons/long-arrow-alt-down-icon';
4
4
  import ArrowsAltVIcon from '@patternfly/react-icons/dist/esm/icons/arrows-alt-v-icon';
5
- import StarIcon from '@patternfly/react-icons/dist/esm/icons/star-icon';
6
5
  import { css } from '@patternfly/react-styles';
7
6
  import styles from '@patternfly/react-styles/css/components/Table/table';
8
7
  import { TableText } from './TableText';
@@ -50,10 +49,11 @@ export const SortColumn: React.FunctionComponent<SortColumnProps> = ({
50
49
  }
51
50
 
52
51
  if (favoriteButtonProps) {
52
+ const { favorited, ...rest } = favoriteButtonProps;
53
53
  return (
54
54
  <ActionList isIconList>
55
55
  <ActionListItem>
56
- <Button variant="plain" icon={<StarIcon />} {...favoriteButtonProps} />
56
+ <Button variant="plain" isFavorite isFavorited={favorited} {...rest} />
57
57
  </ActionListItem>
58
58
  <ActionListItem>
59
59
  <Button
@@ -8,6 +8,7 @@ import { IVisibility } from './utils/decorators/classNames';
8
8
  import { handleArrows, setTabIndex } from '@patternfly/react-core/dist/esm/helpers/KeyboardHandler';
9
9
  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
+ import { useHasAnimations } from '@patternfly/react-core/dist/esm/helpers';
11
12
  import { TableGridBreakpoint, TableVariant } from './TableTypes';
12
13
 
13
14
  export interface BaseCellProps {
@@ -103,13 +104,14 @@ const TableBase: React.FunctionComponent<TableProps> = ({
103
104
  isNested = false,
104
105
  isStriped = false,
105
106
  isExpandable = false,
106
- hasAnimations = false,
107
+ hasAnimations: hasAnimationsProp,
107
108
  hasNoInset = false,
108
109
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
109
110
  nestedHeaderColumnSpans,
110
111
  selectableRowCaptionText,
111
112
  ...props
112
113
  }: TableProps) => {
114
+ const hasAnimations = useHasAnimations(hasAnimationsProp);
113
115
  const ref = useRef(null);
114
116
  const tableRef = innerRef || ref;
115
117
 
@@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react';
2
2
  import { Table } from '../Table';
3
3
  import { Td } from '../Td';
4
4
  import { Th } from '../Th';
5
+ import { AnimationsProvider, useAnimationsConfig, useHasAnimations } from '@patternfly/react-core/dist/esm/helpers';
5
6
  import styles from '@patternfly/react-styles/css/components/Table/table';
6
7
 
7
8
  test('Renders without children', () => {
@@ -57,6 +58,33 @@ test(`Renders with class ${styles.modifiers.animateExpand} hasAnimations is true
57
58
  expect(screen.getByRole('grid', { name: 'Test table' })).toHaveClass(styles.modifiers.animateExpand);
58
59
  });
59
60
 
61
+ // Animation context tests for expandable tables
62
+ test('respects AnimationsProvider context when no local hasAnimations prop for expandable table', () => {
63
+ render(
64
+ <AnimationsProvider config={{ hasAnimations: true }}>
65
+ <Table isExpandable aria-label="Test table" />
66
+ </AnimationsProvider>
67
+ );
68
+
69
+ expect(screen.getByRole('grid', { name: 'Test table' })).toHaveClass(styles.modifiers.animateExpand);
70
+ });
71
+
72
+ test('local hasAnimations prop takes precedence over context for expandable table', () => {
73
+ render(
74
+ <AnimationsProvider config={{ hasAnimations: true }}>
75
+ <Table isExpandable hasAnimations={false} aria-label="Test table" />
76
+ </AnimationsProvider>
77
+ );
78
+
79
+ expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.animateExpand);
80
+ });
81
+
82
+ test('works without AnimationsProvider (backward compatibility) for expandable table', () => {
83
+ render(<Table isExpandable aria-label="Test table" />);
84
+
85
+ expect(screen.getByRole('grid', { name: 'Test table' })).not.toHaveClass(styles.modifiers.animateExpand);
86
+ });
87
+
60
88
  test('Matches snapshot without children', () => {
61
89
  const { asFragment } = render(<Table />);
62
90
 
@@ -4,7 +4,7 @@ exports[`Matches snapshot without children 1`] = `
4
4
  <DocumentFragment>
5
5
  <table
6
6
  class="pf-v6-c-table pf-m-grid-md"
7
- data-ouia-component-id="OUIA-Generated-Table-9"
7
+ data-ouia-component-id="OUIA-Generated-Table-12"
8
8
  data-ouia-component-type="PF6/Table"
9
9
  data-ouia-safe="true"
10
10
  role="grid"