@patternfly/react-core 4.202.33 → 4.202.36

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 (95) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.d.ts +9 -2
  3. package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.d.ts.map +1 -1
  4. package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.js.map +1 -1
  5. package/dist/esm/components/Brand/Brand.d.ts +23 -3
  6. package/dist/esm/components/Brand/Brand.d.ts.map +1 -1
  7. package/dist/esm/components/Brand/Brand.js +12 -2
  8. package/dist/esm/components/Brand/Brand.js.map +1 -1
  9. package/dist/esm/components/ContextSelector/ContextSelector.d.ts +10 -2
  10. package/dist/esm/components/ContextSelector/ContextSelector.d.ts.map +1 -1
  11. package/dist/esm/components/ContextSelector/ContextSelector.js +3 -2
  12. package/dist/esm/components/ContextSelector/ContextSelector.js.map +1 -1
  13. package/dist/esm/components/ContextSelector/ContextSelectorToggle.js +3 -3
  14. package/dist/esm/components/ContextSelector/ContextSelectorToggle.js.map +1 -1
  15. package/dist/esm/components/Dropdown/Dropdown.d.ts +9 -2
  16. package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
  17. package/dist/esm/components/Dropdown/Dropdown.js +2 -2
  18. package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
  19. package/dist/esm/components/OptionsMenu/OptionsMenu.d.ts +9 -2
  20. package/dist/esm/components/OptionsMenu/OptionsMenu.d.ts.map +1 -1
  21. package/dist/esm/components/OptionsMenu/OptionsMenu.js.map +1 -1
  22. package/dist/esm/components/Select/Select.d.ts +9 -2
  23. package/dist/esm/components/Select/Select.d.ts.map +1 -1
  24. package/dist/esm/components/Select/Select.js.map +1 -1
  25. package/dist/esm/components/Tabs/Tabs.d.ts +2 -0
  26. package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
  27. package/dist/esm/components/Tabs/Tabs.js +3 -2
  28. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  29. package/dist/esm/helpers/Popper/Popper.d.ts +0 -10
  30. package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
  31. package/dist/esm/helpers/Popper/Popper.js.map +1 -1
  32. package/dist/js/components/ApplicationLauncher/ApplicationLauncher.d.ts +9 -2
  33. package/dist/js/components/ApplicationLauncher/ApplicationLauncher.d.ts.map +1 -1
  34. package/dist/js/components/ApplicationLauncher/ApplicationLauncher.js.map +1 -1
  35. package/dist/js/components/Brand/Brand.d.ts +23 -3
  36. package/dist/js/components/Brand/Brand.d.ts.map +1 -1
  37. package/dist/js/components/Brand/Brand.js +12 -2
  38. package/dist/js/components/Brand/Brand.js.map +1 -1
  39. package/dist/js/components/ContextSelector/ContextSelector.d.ts +10 -2
  40. package/dist/js/components/ContextSelector/ContextSelector.d.ts.map +1 -1
  41. package/dist/js/components/ContextSelector/ContextSelector.js +3 -2
  42. package/dist/js/components/ContextSelector/ContextSelector.js.map +1 -1
  43. package/dist/js/components/ContextSelector/ContextSelectorToggle.js +3 -3
  44. package/dist/js/components/ContextSelector/ContextSelectorToggle.js.map +1 -1
  45. package/dist/js/components/Dropdown/Dropdown.d.ts +9 -2
  46. package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
  47. package/dist/js/components/Dropdown/Dropdown.js +2 -2
  48. package/dist/js/components/Dropdown/Dropdown.js.map +1 -1
  49. package/dist/js/components/OptionsMenu/OptionsMenu.d.ts +9 -2
  50. package/dist/js/components/OptionsMenu/OptionsMenu.d.ts.map +1 -1
  51. package/dist/js/components/OptionsMenu/OptionsMenu.js.map +1 -1
  52. package/dist/js/components/Select/Select.d.ts +9 -2
  53. package/dist/js/components/Select/Select.d.ts.map +1 -1
  54. package/dist/js/components/Select/Select.js.map +1 -1
  55. package/dist/js/components/Tabs/Tabs.d.ts +2 -0
  56. package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
  57. package/dist/js/components/Tabs/Tabs.js +3 -2
  58. package/dist/js/components/Tabs/Tabs.js.map +1 -1
  59. package/dist/js/helpers/Popper/Popper.d.ts +0 -10
  60. package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
  61. package/dist/js/helpers/Popper/Popper.js.map +1 -1
  62. package/dist/umd/react-core.css +64 -0
  63. package/dist/umd/react-core.js +152 -130
  64. package/dist/umd/react-core.min.css +64 -0
  65. package/dist/umd/react-core.min.js +4 -4
  66. package/package.json +5 -5
  67. package/src/components/ApplicationLauncher/ApplicationLauncher.tsx +9 -2
  68. package/src/components/Brand/Brand.tsx +61 -8
  69. package/src/components/Brand/__tests__/Brand.test.tsx +15 -4
  70. package/src/components/Brand/__tests__/__snapshots__/Brand.test.tsx.snap +1 -1
  71. package/src/components/Brand/examples/Brand.md +13 -0
  72. package/src/components/Brand/examples/BrandResponsive.tsx +18 -0
  73. package/src/components/Brand/examples/pf-c-brand--logo-base.jpg +0 -0
  74. package/src/components/Brand/examples/pf-c-brand--logo-on-lg.svg +32 -0
  75. package/src/components/Brand/examples/pf-c-brand--logo-on-md.svg +42 -0
  76. package/src/components/Brand/examples/pf-c-brand--logo-on-sm.svg +17 -0
  77. package/src/components/Brand/examples/pf-c-brand--logo-on-xl.svg +39 -0
  78. package/src/components/Brand/examples/pf-c-brand--logo.svg +10 -0
  79. package/src/components/ContextSelector/ContextSelector.tsx +12 -4
  80. package/src/components/ContextSelector/ContextSelectorToggle.tsx +3 -3
  81. package/src/components/Dropdown/Dropdown.tsx +11 -3
  82. package/src/components/OptionsMenu/OptionsMenu.tsx +9 -2
  83. package/src/components/Select/Select.tsx +10 -3
  84. package/src/components/Tabs/Tabs.tsx +5 -0
  85. package/src/components/Tabs/__tests__/Tabs.test.tsx +17 -0
  86. package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +153 -0
  87. package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +47 -146
  88. package/src/components/TextInputGroup/__tests__/TextInputGroupMain.test.tsx +302 -0
  89. package/src/components/TextInputGroup/__tests__/TextInputGroupUtilities.test.tsx +34 -0
  90. package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +2 -203
  91. package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroupMain.test.tsx.snap +21 -0
  92. package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroupUtilities.test.tsx.snap +13 -0
  93. package/src/demos/Tabs.md +5 -0
  94. package/src/demos/examples/Tabs/TabsAndTablesAutoWidthTabs.tsx +442 -0
  95. package/src/helpers/Popper/Popper.tsx +0 -11
@@ -1543,6 +1543,159 @@ exports[`should render tabs with eventKey Strings 1`] = `
1543
1543
  </div>
1544
1544
  `;
1545
1545
 
1546
+ exports[`should render tabs with no bottom border 1`] = `
1547
+ <div>
1548
+ <div
1549
+ class="pf-c-tabs pf-m-no-border-bottom"
1550
+ data-ouia-component-id="OUIA-Generated-Tabs-14"
1551
+ data-ouia-component-type="PF4/Tabs"
1552
+ data-ouia-safe="true"
1553
+ id="noBottomBorderTabs"
1554
+ >
1555
+ <button
1556
+ aria-hidden="true"
1557
+ aria-label="Scroll left"
1558
+ class="pf-c-tabs__scroll-button"
1559
+ disabled=""
1560
+ >
1561
+ <svg
1562
+ aria-hidden="true"
1563
+ fill="currentColor"
1564
+ height="1em"
1565
+ role="img"
1566
+ style="vertical-align: -0.125em;"
1567
+ viewBox="0 0 256 512"
1568
+ width="1em"
1569
+ >
1570
+ <path
1571
+ d="M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"
1572
+ />
1573
+ </svg>
1574
+ </button>
1575
+ <ul
1576
+ class="pf-c-tabs__list"
1577
+ role="tablist"
1578
+ >
1579
+ <li
1580
+ class="pf-c-tabs__item pf-m-current"
1581
+ role="presentation"
1582
+ >
1583
+ <button
1584
+ aria-controls="pf-tab-section-0-tab1"
1585
+ aria-selected="true"
1586
+ class="pf-c-tabs__link"
1587
+ data-ouia-component-type="PF4/TabButton"
1588
+ data-ouia-safe="true"
1589
+ id="pf-tab-0-tab1"
1590
+ role="tab"
1591
+ >
1592
+ <span
1593
+ class="pf-c-tabs__item-text"
1594
+ >
1595
+ "Tab item 1"
1596
+ </span>
1597
+ </button>
1598
+ </li>
1599
+ <li
1600
+ class="pf-c-tabs__item"
1601
+ role="presentation"
1602
+ >
1603
+ <button
1604
+ aria-controls="pf-tab-section-1-tab2"
1605
+ aria-selected="false"
1606
+ class="pf-c-tabs__link"
1607
+ data-ouia-component-type="PF4/TabButton"
1608
+ data-ouia-safe="true"
1609
+ id="pf-tab-1-tab2"
1610
+ role="tab"
1611
+ >
1612
+ <span
1613
+ class="pf-c-tabs__item-text"
1614
+ >
1615
+ "Tab item 2"
1616
+ </span>
1617
+ </button>
1618
+ </li>
1619
+ <li
1620
+ class="pf-c-tabs__item"
1621
+ role="presentation"
1622
+ >
1623
+ <button
1624
+ aria-controls="pf-tab-section-2-tab3"
1625
+ aria-selected="false"
1626
+ class="pf-c-tabs__link"
1627
+ data-ouia-component-type="PF4/TabButton"
1628
+ data-ouia-safe="true"
1629
+ id="pf-tab-2-tab3"
1630
+ role="tab"
1631
+ >
1632
+ <span
1633
+ class="pf-c-tabs__item-text"
1634
+ >
1635
+ "Tab item 3"
1636
+ </span>
1637
+ </button>
1638
+ </li>
1639
+ </ul>
1640
+ <button
1641
+ aria-hidden="true"
1642
+ aria-label="Scroll right"
1643
+ class="pf-c-tabs__scroll-button"
1644
+ disabled=""
1645
+ >
1646
+ <svg
1647
+ aria-hidden="true"
1648
+ fill="currentColor"
1649
+ height="1em"
1650
+ role="img"
1651
+ style="vertical-align: -0.125em;"
1652
+ viewBox="0 0 256 512"
1653
+ width="1em"
1654
+ >
1655
+ <path
1656
+ d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"
1657
+ />
1658
+ </svg>
1659
+ </button>
1660
+ </div>
1661
+ <section
1662
+ aria-labelledby="pf-tab-0-tab1"
1663
+ class="pf-c-tab-content"
1664
+ data-ouia-component-type="PF4/TabContent"
1665
+ data-ouia-safe="true"
1666
+ id="pf-tab-section-0-tab1"
1667
+ role="tabpanel"
1668
+ tabindex="0"
1669
+ >
1670
+ Tab 1 section
1671
+ </section>
1672
+ <section
1673
+ aria-labelledby="pf-tab-1-tab2"
1674
+ class="pf-c-tab-content"
1675
+ data-ouia-component-type="PF4/TabContent"
1676
+ data-ouia-safe="true"
1677
+ hidden=""
1678
+ id="pf-tab-section-1-tab2"
1679
+ role="tabpanel"
1680
+ tabindex="0"
1681
+ >
1682
+ Tab 2 section
1683
+ </section>
1684
+ <section
1685
+ aria-labelledby="pf-tab-2-tab3"
1686
+ class="pf-c-tab-content"
1687
+ data-ouia-component-type="PF4/TabContent"
1688
+ data-ouia-safe="true"
1689
+ hidden=""
1690
+ id="pf-tab-section-2-tab3"
1691
+ role="tabpanel"
1692
+ tabindex="0"
1693
+ >
1694
+ Tab 3 section
1695
+ </section>
1696
+ </div>
1697
+ `;
1698
+
1546
1699
  exports[`should render tabs with separate content 1`] = `
1547
1700
  <div>
1548
1701
  <div
@@ -1,192 +1,93 @@
1
1
  import React from 'react';
2
-
3
2
  import { render, screen } from '@testing-library/react';
4
- import userEvent from '@testing-library/user-event';
3
+ import '@testing-library/jest-dom';
5
4
 
6
5
  import { TextInputGroup, TextInputGroupContext } from '../TextInputGroup';
7
- import { TextInputGroupMain } from '../TextInputGroupMain';
8
- import { TextInputGroupUtilities } from '../TextInputGroupUtilities';
9
- import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
10
6
 
11
7
  describe('TextInputGroup', () => {
12
- test('renders content', () => {
13
- const { asFragment } = render(
14
- <TextInputGroup>
15
- <TextInputGroupMain>Foo</TextInputGroupMain>
16
- <TextInputGroupUtilities />
17
- </TextInputGroup>
18
- );
19
- expect(asFragment()).toMatchSnapshot();
20
- });
21
-
22
- test('gets custom class and id', () => {
23
- const { asFragment } = render(
24
- <TextInputGroup className="custom-class" id="test-id">
25
- <TextInputGroupMain>Foo</TextInputGroupMain>
26
- <TextInputGroupUtilities />
27
- </TextInputGroup>
28
- );
29
- expect(asFragment()).toMatchSnapshot();
30
- });
8
+ it('renders without children', () => {
9
+ render(<TextInputGroup data-testid="TextInputGroup" />);
31
10
 
32
- test('renders with the proper stying when disabled', () => {
33
- const { asFragment } = render(
34
- <TextInputGroup isDisabled>
35
- <TextInputGroupMain>Foo</TextInputGroupMain>
36
- <TextInputGroupUtilities />
37
- </TextInputGroup>
38
- );
39
- expect(asFragment()).toMatchSnapshot();
11
+ expect(screen.getByTestId('TextInputGroup')).toBeVisible();
40
12
  });
41
13
 
42
- test('passes isDisabled=false to children via a context when isDisabled prop is not passed', () => {
43
- const TestComponent: React.FunctionComponent = () => {
44
- const context = React.useContext(TextInputGroupContext);
14
+ it('renders children', () => {
15
+ render(<TextInputGroup>Test</TextInputGroup>);
45
16
 
46
- return <div>{context.isDisabled ? 'is disabled' : 'not disabled'}</div>;
47
- };
48
-
49
- render(
50
- <TextInputGroup>
51
- <TestComponent />
52
- </TextInputGroup>
53
- );
54
-
55
- expect(screen.queryByText('is disabled')).toBeNull();
17
+ expect(screen.getByText('Test')).toBeVisible();
56
18
  });
57
19
 
58
- test('passes isDisabled=true to children via a context when isDisabled prop is passed', () => {
59
- const TestComponent: React.FunctionComponent = () => {
60
- const context = React.useContext(TextInputGroupContext);
20
+ it('renders with class pf-c-text-input-group', () => {
21
+ render(<TextInputGroup>Test</TextInputGroup>);
61
22
 
62
- return <div>{context.isDisabled ? 'is disabled' : 'not disabled'}</div>;
63
- };
64
-
65
- render(
66
- <TextInputGroup isDisabled>
67
- <TestComponent />
68
- </TextInputGroup>
69
- );
23
+ const inputGroup = screen.getByText('Test');
70
24
 
71
- expect(screen.queryByText('not disabled')).toBeNull();
25
+ expect(inputGroup).toHaveClass('pf-c-text-input-group');
72
26
  });
73
- });
74
27
 
75
- describe('TextInputGroupMain', () => {
76
- test('renders content', () => {
77
- const { asFragment } = render(<TextInputGroupMain>Foo</TextInputGroupMain>);
78
- expect(asFragment()).toMatchSnapshot();
79
- });
28
+ it('renders with custom class names provided via prop', () => {
29
+ render(<TextInputGroup className="custom-class">Test</TextInputGroup>);
80
30
 
81
- test('renders given input icon props', () => {
82
- const { asFragment } = render(<TextInputGroupMain icon={<SearchIcon />}>Foo</TextInputGroupMain>);
83
- expect(asFragment()).toMatchSnapshot();
84
- });
31
+ const inputGroup = screen.getByText('Test');
85
32
 
86
- test('renders the input with custom aria label when given', () => {
87
- const { asFragment } = render(<TextInputGroupMain aria-label="Foo">Foo</TextInputGroupMain>);
88
- expect(asFragment()).toMatchSnapshot();
33
+ expect(inputGroup).toHaveClass('custom-class');
89
34
  });
90
35
 
91
- test('does not call onChange callback when the input does not change', () => {
92
- const onChangeMock = jest.fn();
36
+ it('does not render with the pf-m-disabled class when not disabled', () => {
37
+ render(<TextInputGroup>Test</TextInputGroup>);
93
38
 
94
- render(<TextInputGroupMain onChange={onChangeMock}>Foo</TextInputGroupMain>);
95
- expect(onChangeMock).not.toHaveBeenCalled();
96
- });
97
-
98
- test('calls the onChange callback when the input changes', () => {
99
- const onChangeMock = jest.fn();
39
+ const inputGroup = screen.getByText('Test');
100
40
 
101
- render(<TextInputGroupMain onChange={onChangeMock}>Foo</TextInputGroupMain>);
102
-
103
- userEvent.type(screen.getByText('Foo').querySelector('input'), 'Foo');
104
- expect(onChangeMock).toHaveBeenCalled();
41
+ expect(inputGroup).not.toHaveClass('pf-m-disabled');
105
42
  });
106
43
 
107
- test('does not call onFocus callback when the input does not get focus', () => {
108
- const onFocusMock = jest.fn();
44
+ it('renders with the pf-m-disabled class when disabled', () => {
45
+ render(<TextInputGroup isDisabled>Test</TextInputGroup>);
109
46
 
110
- render(<TextInputGroupMain onFocus={onFocusMock}>Foo</TextInputGroupMain>);
111
- expect(onFocusMock).not.toHaveBeenCalled();
112
- });
47
+ const inputGroup = screen.getByText('Test');
113
48
 
114
- test('calls the onFocus callback when the input is focused', () => {
115
- const onFocusMock = jest.fn();
116
-
117
- render(<TextInputGroupMain onFocus={onFocusMock}>Foo</TextInputGroupMain>);
118
- userEvent.click(screen.getByText('Foo').querySelector('input'));
119
- expect(onFocusMock).toHaveBeenCalledTimes(1);
49
+ expect(inputGroup).toHaveClass('pf-m-disabled');
120
50
  });
121
51
 
122
- test('does not call onBlur callback when the input does not lose focus', () => {
123
- const onBlurMock = jest.fn();
124
-
125
- render(<TextInputGroupMain onBlur={onBlurMock}>Foo</TextInputGroupMain>);
126
-
127
- userEvent.type(screen.getByText('Foo').querySelector('input'), 'Foo');
128
- expect(onBlurMock).not.toHaveBeenCalled();
129
- });
52
+ it('passes isDisabled=false to children via a context when isDisabled prop is not passed', () => {
53
+ const TestComponent: React.FunctionComponent = () => {
54
+ const context = React.useContext(TextInputGroupContext);
130
55
 
131
- test('calls the onFocus callback when the input loses focus', () => {
132
- const onBlurMock = jest.fn();
56
+ return <button disabled={context.isDisabled} />;
57
+ };
133
58
 
134
59
  render(
135
- <>
136
- <div>Other element</div>
137
- <TextInputGroupMain onBlur={onBlurMock}>Foo</TextInputGroupMain>
138
- </>
60
+ <TextInputGroup>
61
+ <TestComponent />
62
+ </TextInputGroup>
139
63
  );
140
64
 
141
- userEvent.type(screen.getByText('Foo').querySelector('input'), 'Foo');
142
- userEvent.click(screen.getByText('Other element'));
65
+ const testComponent = screen.getByRole('button');
143
66
 
144
- expect(onBlurMock).toHaveBeenCalled();
67
+ expect(testComponent).not.toBeDisabled();
145
68
  });
146
69
 
147
- test('input type defaults to text', () => {
148
- render(<TextInputGroupMain>Foo</TextInputGroupMain>);
149
- expect(
150
- screen
151
- .getByText('Foo')
152
- .querySelector('input')
153
- .getAttribute('type')
154
- ).toEqual('text');
155
- });
70
+ it('passes isDisabled=true to children via a context when isDisabled prop is passed', () => {
71
+ const TestComponent: React.FunctionComponent = () => {
72
+ const context = React.useContext(TextInputGroupContext);
156
73
 
157
- test('input type is updated when a different type is passed', () => {
158
- render(<TextInputGroupMain type="search">Foo</TextInputGroupMain>);
159
- expect(
160
- screen
161
- .getByText('Foo')
162
- .querySelector('input')
163
- .getAttribute('type')
164
- ).toEqual('search');
165
- });
74
+ return <button disabled={context.isDisabled} />;
75
+ };
166
76
 
167
- test('input is not disabled when TextInputGroupContext isDisabled is false', () => {
168
- const { asFragment } = render(
169
- <TextInputGroupContext.Provider value={{ isDisabled: false }}>
170
- <TextInputGroupMain />
171
- </TextInputGroupContext.Provider>
77
+ render(
78
+ <TextInputGroup isDisabled>
79
+ <TestComponent />
80
+ </TextInputGroup>
172
81
  );
173
82
 
174
- expect(asFragment()).toMatchSnapshot();
175
- });
83
+ const testComponent = screen.getByRole('button');
176
84
 
177
- test('input is disabled when TextInputGroupContext isDisabled is true', () => {
178
- const { asFragment } = render(
179
- <TextInputGroupContext.Provider value={{ isDisabled: true }}>
180
- <TextInputGroupMain />
181
- </TextInputGroupContext.Provider>
182
- );
183
- expect(asFragment()).toMatchSnapshot();
85
+ expect(testComponent).toBeDisabled();
184
86
  });
185
- });
186
87
 
187
- describe('TextInputGroupUtilities', () => {
188
- test('renders the content', () => {
189
- const { asFragment } = render(<TextInputGroupUtilities>{<button>Foo</button>}</TextInputGroupUtilities>);
88
+ it('matches the snapshot', () => {
89
+ const { asFragment } = render(<TextInputGroup>Test</TextInputGroup>);
90
+
190
91
  expect(asFragment()).toMatchSnapshot();
191
92
  });
192
93
  });