@patternfly/react-core 4.265.2 → 4.266.1

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 (55) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts +2 -0
  3. package/dist/esm/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
  4. package/dist/esm/components/ClipboardCopy/ClipboardCopy.js +4 -3
  5. package/dist/esm/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
  6. package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.d.ts +2 -0
  7. package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
  8. package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.js +2 -2
  9. package/dist/esm/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
  10. package/dist/esm/components/Sidebar/SidebarPanel.d.ts +9 -0
  11. package/dist/esm/components/Sidebar/SidebarPanel.d.ts.map +1 -1
  12. package/dist/esm/components/Sidebar/SidebarPanel.js +10 -0
  13. package/dist/esm/components/Sidebar/SidebarPanel.js.map +1 -1
  14. package/dist/esm/components/Truncate/Truncate.d.ts +2 -0
  15. package/dist/esm/components/Truncate/Truncate.d.ts.map +1 -1
  16. package/dist/esm/components/Truncate/Truncate.js +2 -2
  17. package/dist/esm/components/Truncate/Truncate.js.map +1 -1
  18. package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts +2 -0
  19. package/dist/js/components/ClipboardCopy/ClipboardCopy.d.ts.map +1 -1
  20. package/dist/js/components/ClipboardCopy/ClipboardCopy.js +4 -3
  21. package/dist/js/components/ClipboardCopy/ClipboardCopy.js.map +1 -1
  22. package/dist/js/components/ClipboardCopy/ClipboardCopyButton.d.ts +2 -0
  23. package/dist/js/components/ClipboardCopy/ClipboardCopyButton.d.ts.map +1 -1
  24. package/dist/js/components/ClipboardCopy/ClipboardCopyButton.js +2 -2
  25. package/dist/js/components/ClipboardCopy/ClipboardCopyButton.js.map +1 -1
  26. package/dist/js/components/Sidebar/SidebarPanel.d.ts +9 -0
  27. package/dist/js/components/Sidebar/SidebarPanel.d.ts.map +1 -1
  28. package/dist/js/components/Sidebar/SidebarPanel.js +11 -1
  29. package/dist/js/components/Sidebar/SidebarPanel.js.map +1 -1
  30. package/dist/js/components/Truncate/Truncate.d.ts +2 -0
  31. package/dist/js/components/Truncate/Truncate.d.ts.map +1 -1
  32. package/dist/js/components/Truncate/Truncate.js +2 -2
  33. package/dist/js/components/Truncate/Truncate.js.map +1 -1
  34. package/dist/umd/react-core.min.js +2 -2
  35. package/package.json +2 -2
  36. package/src/components/ClipboardCopy/ClipboardCopy.tsx +6 -1
  37. package/src/components/ClipboardCopy/ClipboardCopyButton.tsx +4 -0
  38. package/src/components/Panel/__tests__/Panel.test.tsx +96 -58
  39. package/src/components/Panel/__tests__/PanelFooter.test.tsx +42 -0
  40. package/src/components/Panel/__tests__/PanelHeader.test.tsx +42 -0
  41. package/src/components/Panel/__tests__/PanelMain.test.tsx +48 -0
  42. package/src/components/Panel/__tests__/PanelMainBody.test.tsx +42 -0
  43. package/src/components/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +2 -82
  44. package/src/components/Panel/__tests__/__snapshots__/PanelFooter.test.tsx.snap +11 -0
  45. package/src/components/Panel/__tests__/__snapshots__/PanelHeader.test.tsx.snap +11 -0
  46. package/src/components/Panel/__tests__/__snapshots__/PanelMain.test.tsx.snap +11 -0
  47. package/src/components/Panel/__tests__/__snapshots__/PanelMainBody.test.tsx.snap +11 -0
  48. package/src/components/Sidebar/SidebarPanel.tsx +10 -0
  49. package/src/components/Sidebar/__tests__/Sidebar.test.tsx +72 -0
  50. package/src/components/Sidebar/__tests__/SidebarContent.test.tsx +38 -0
  51. package/src/components/Sidebar/__tests__/SidebarPanel.test.tsx +75 -0
  52. package/src/components/Sidebar/__tests__/__snapshots__/Sidebar.test.tsx.snap +15 -0
  53. package/src/components/Sidebar/__tests__/__snapshots__/SidebarContent.test.tsx.snap +11 -0
  54. package/src/components/Sidebar/__tests__/__snapshots__/SidebarPanel.test.tsx.snap +11 -0
  55. package/src/components/Truncate/Truncate.tsx +4 -1
@@ -0,0 +1,38 @@
1
+ import * as React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { SidebarContent } from '../SidebarContent';
4
+
5
+ test('Renders children', () => {
6
+ render(<SidebarContent>Test</SidebarContent>);
7
+ expect(screen.getByText('Test')).toBeVisible();
8
+ });
9
+
10
+ test('Renders with only class name pf-c-sidebar__content by default', () => {
11
+ render(<SidebarContent>Test</SidebarContent>);
12
+ expect(screen.getByText('Test')).toHaveClass('pf-c-sidebar__content', { exact: true });
13
+ });
14
+
15
+ test('Renders with class name pf-c-sidebar__content', () => {
16
+ render(<SidebarContent>Test</SidebarContent>);
17
+ expect(screen.getByText('Test')).toHaveClass('pf-c-sidebar__content');
18
+ });
19
+
20
+ test('Renders with custom class name when className prop is provided', () => {
21
+ render(<SidebarContent className="custom-class">Test</SidebarContent>);
22
+ expect(screen.getByText('Test')).toHaveClass('custom-class');
23
+ });
24
+
25
+ test('Renders with class name pf-m-no-background when hasNoBackground prop is passed', () => {
26
+ render(<SidebarContent hasNoBackground>Test</SidebarContent>);
27
+ expect(screen.getByText('Test')).toHaveClass('pf-m-no-background');
28
+ });
29
+
30
+ test('Renders with inherited element props spread to the component', () => {
31
+ render(<SidebarContent aria-label="Test label">Test</SidebarContent>);
32
+ expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
33
+ });
34
+
35
+ test('Matches the snapshot', () => {
36
+ const { asFragment } = render(<SidebarContent>Test</SidebarContent>);
37
+ expect(asFragment()).toMatchSnapshot();
38
+ });
@@ -0,0 +1,75 @@
1
+ import * as React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { SidebarPanel, SidebarPanelWidthType } from '../SidebarPanel';
4
+
5
+ test('Renders children', () => {
6
+ render(<SidebarPanel>Test</SidebarPanel>);
7
+ expect(screen.getByText('Test')).toBeVisible();
8
+ });
9
+
10
+ test('Renders with with only class name pf-c-sidebar__panel by default', () => {
11
+ render(<SidebarPanel>Test</SidebarPanel>);
12
+ expect(screen.getByText('Test')).toHaveClass('pf-c-sidebar__panel', { exact: true });
13
+ });
14
+
15
+ test('Renders with with class name pf-c-sidebar__panel', () => {
16
+ render(<SidebarPanel>Test</SidebarPanel>);
17
+ expect(screen.getByText('Test')).toHaveClass('pf-c-sidebar__panel');
18
+ });
19
+
20
+ test('Renders with custom class name when className prop is provided', () => {
21
+ render(<SidebarPanel className="custom-class">Test</SidebarPanel>);
22
+ expect(screen.getByText('Test')).toHaveClass('custom-class');
23
+ });
24
+
25
+ test('Renders with class name pf-m-sticky when "sticky" is passed to variant prop', () => {
26
+ render(<SidebarPanel variant="sticky">Test</SidebarPanel>);
27
+ expect(screen.getByText('Test')).toHaveClass('pf-m-sticky');
28
+ });
29
+
30
+ test('Renders with class name pf-m-static when "static" is passed to variant prop', () => {
31
+ render(<SidebarPanel variant="static">Test</SidebarPanel>);
32
+ expect(screen.getByText('Test')).toHaveClass('pf-m-static');
33
+ });
34
+
35
+ test('Renders with class name pf-m-no-background when hasNoBackground prop is passed', () => {
36
+ render(<SidebarPanel hasNoBackground>Test</SidebarPanel>);
37
+ expect(screen.getByText('Test')).toHaveClass('pf-m-no-background');
38
+ });
39
+
40
+ ['width_25', 'width_33', 'width_50', 'width_66', 'width_75', 'width_100'].forEach(widthType => {
41
+ test(`Renders with appropriate class names when ${widthType} is passed to each breakpoint of width prop`, () => {
42
+ render(
43
+ <SidebarPanel
44
+ width={{
45
+ default: `${widthType as SidebarPanelWidthType}`,
46
+ sm: `${widthType as SidebarPanelWidthType}`,
47
+ md: `${widthType as SidebarPanelWidthType}`,
48
+ lg: `${widthType as SidebarPanelWidthType}`,
49
+ xl: `${widthType as SidebarPanelWidthType}`,
50
+ '2xl': `${widthType as SidebarPanelWidthType}`
51
+ }}
52
+ >
53
+ Test
54
+ </SidebarPanel>
55
+ );
56
+
57
+ const className = widthType.replace('_', '-');
58
+ expect(screen.getByText('Test')).toHaveClass(`pf-m-${className}`);
59
+ expect(screen.getByText('Test')).toHaveClass(`pf-m-${className}-on-sm`);
60
+ expect(screen.getByText('Test')).toHaveClass(`pf-m-${className}-on-md`);
61
+ expect(screen.getByText('Test')).toHaveClass(`pf-m-${className}-on-lg`);
62
+ expect(screen.getByText('Test')).toHaveClass(`pf-m-${className}-on-xl`);
63
+ expect(screen.getByText('Test')).toHaveClass(`pf-m-${className}-on-2xl`);
64
+ });
65
+ });
66
+
67
+ test('Renders with inherited element props spread to the component', () => {
68
+ render(<SidebarPanel aria-label="Test label">Test</SidebarPanel>);
69
+ expect(screen.getByText('Test')).toHaveAccessibleName('Test label');
70
+ });
71
+
72
+ test('Matches the snapshot', () => {
73
+ const { asFragment } = render(<SidebarPanel>Test</SidebarPanel>);
74
+ expect(asFragment()).toMatchSnapshot();
75
+ });
@@ -0,0 +1,15 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Matches the snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ class="pf-c-sidebar"
7
+ >
8
+ <div
9
+ class="pf-c-sidebar__main"
10
+ >
11
+ Test
12
+ </div>
13
+ </div>
14
+ </DocumentFragment>
15
+ `;
@@ -0,0 +1,11 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Matches the snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ class="pf-c-sidebar__content"
7
+ >
8
+ Test
9
+ </div>
10
+ </DocumentFragment>
11
+ `;
@@ -0,0 +1,11 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Matches the snapshot 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ class="pf-c-sidebar__panel"
7
+ >
8
+ Test
9
+ </div>
10
+ </DocumentFragment>
11
+ `;
@@ -41,6 +41,8 @@ interface TruncateProps extends React.HTMLProps<HTMLSpanElement> {
41
41
  | 'left-end'
42
42
  | 'right-start'
43
43
  | 'right-end';
44
+ /** @beta Opt-in for updated popper that does not use findDOMNode. */
45
+ removeFindDomNode?: boolean;
44
46
  }
45
47
 
46
48
  const sliceContent = (str: string, slice: number) => [str.slice(0, str.length - slice), str.slice(-slice)];
@@ -51,9 +53,10 @@ export const Truncate: React.FunctionComponent<TruncateProps> = ({
51
53
  tooltipPosition = 'top',
52
54
  trailingNumChars = 7,
53
55
  content,
56
+ removeFindDomNode,
54
57
  ...props
55
58
  }: TruncateProps) => (
56
- <Tooltip position={tooltipPosition} content={content}>
59
+ <Tooltip position={tooltipPosition} content={content} removeFindDomNode={removeFindDomNode}>
57
60
  <span className={css(styles.truncate, className)} {...props}>
58
61
  {(position === TruncatePosition.end || position === TruncatePosition.start) && (
59
62
  <span className={truncateStyles[position]}>