@patternfly/react-core 4.262.0 → 4.264.0
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/CHANGELOG.md +28 -0
- package/dist/esm/components/Button/Button.d.ts.map +1 -1
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/NumberInput/NumberInput.d.ts +1 -1
- package/dist/esm/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/esm/components/NumberInput/NumberInput.js +0 -1
- package/dist/esm/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/esm/components/Spinner/Spinner.d.ts +2 -0
- package/dist/esm/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/esm/components/Spinner/Spinner.js +2 -2
- package/dist/esm/components/Spinner/Spinner.js.map +1 -1
- package/dist/esm/components/Tabs/Tab.d.ts +4 -2
- package/dist/esm/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tab.js +6 -7
- package/dist/esm/components/Tabs/Tab.js.map +1 -1
- package/dist/esm/components/Tabs/TabAction.d.ts +20 -0
- package/dist/esm/components/Tabs/TabAction.d.ts.map +1 -0
- package/dist/esm/components/Tabs/TabAction.js +17 -0
- package/dist/esm/components/Tabs/TabAction.js.map +1 -0
- package/dist/esm/components/Tabs/Tabs.d.ts +1 -1
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/index.d.ts +1 -0
- package/dist/esm/components/Tabs/index.d.ts.map +1 -1
- package/dist/esm/components/Tabs/index.js +1 -0
- package/dist/esm/components/Tabs/index.js.map +1 -1
- package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/helpers/Popper/Popper.js +6 -3
- package/dist/esm/helpers/Popper/Popper.js.map +1 -1
- package/dist/js/components/Button/Button.d.ts.map +1 -1
- package/dist/js/components/Button/Button.js +1 -1
- package/dist/js/components/Button/Button.js.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.d.ts +1 -1
- package/dist/js/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/js/components/NumberInput/NumberInput.js +0 -1
- package/dist/js/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/js/components/Spinner/Spinner.d.ts +2 -0
- package/dist/js/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/js/components/Spinner/Spinner.js +2 -2
- package/dist/js/components/Spinner/Spinner.js.map +1 -1
- package/dist/js/components/Tabs/Tab.d.ts +4 -2
- package/dist/js/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tab.js +6 -7
- package/dist/js/components/Tabs/Tab.js.map +1 -1
- package/dist/js/components/Tabs/TabAction.d.ts +20 -0
- package/dist/js/components/Tabs/TabAction.d.ts.map +1 -0
- package/dist/js/components/Tabs/TabAction.js +20 -0
- package/dist/js/components/Tabs/TabAction.js.map +1 -0
- package/dist/js/components/Tabs/Tabs.d.ts +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/index.d.ts +1 -0
- package/dist/js/components/Tabs/index.d.ts.map +1 -1
- package/dist/js/components/Tabs/index.js +1 -0
- package/dist/js/components/Tabs/index.js.map +1 -1
- package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/js/helpers/Popper/Popper.js +6 -3
- package/dist/js/helpers/Popper/Popper.js.map +1 -1
- package/dist/styles/assets/pficon/pficon.scss +12 -0
- package/dist/styles/assets/pficon/pficon.woff +0 -0
- package/dist/styles/assets/pficon/pficon.woff2 +0 -0
- package/dist/styles/base-no-reset.css +10 -0
- package/dist/styles/base.css +10 -0
- package/dist/umd/react-core.min.css +1331 -1162
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +6 -6
- package/src/components/Button/Button.tsx +1 -0
- package/src/components/Button/__tests__/__snapshots__/Button.test.tsx.snap +1 -1
- package/src/components/NumberInput/NumberInput.tsx +1 -2
- package/src/components/NumberInput/__tests__/NumberInput.test.tsx +4 -4
- package/src/components/NumberInput/examples/NumberInput.md +2 -0
- package/src/components/NumberInput/examples/NumberInputCustomStep.tsx +4 -4
- package/src/components/NumberInput/examples/NumberInputCustomStepAndThreshold.tsx +4 -5
- package/src/components/NumberInput/examples/NumberInputDefault.tsx +5 -5
- package/src/components/NumberInput/examples/NumberInputDisabled.tsx +5 -5
- package/src/components/NumberInput/examples/NumberInputUnit.tsx +10 -10
- package/src/components/NumberInput/examples/NumberInputUnitThreshold.tsx +16 -6
- package/src/components/NumberInput/examples/NumberInputVaryingSizes.tsx +11 -11
- package/src/components/NumberInput/examples/NumberInputWithStatus.tsx +5 -6
- package/src/components/Popover/__tests__/__snapshots__/Popover.test.tsx.snap +3 -1
- package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +3 -1
- package/src/components/Spinner/Spinner.tsx +4 -1
- package/src/components/Spinner/examples/Spinner.md +4 -0
- package/src/components/Spinner/examples/SpinnerInline.tsx +29 -0
- package/src/components/Tabs/Tab.tsx +17 -16
- package/src/components/Tabs/TabAction.tsx +57 -0
- package/src/components/Tabs/Tabs.tsx +1 -1
- package/src/components/Tabs/__tests__/Tab.test.tsx +10 -0
- package/src/components/Tabs/__tests__/__snapshots__/Tab.test.tsx.snap +45 -0
- package/src/components/Tabs/examples/Tabs.md +64 -20
- package/src/components/Tabs/examples/TabsHelp.tsx +61 -0
- package/src/components/Tabs/examples/TabsHelpAndClose.tsx +84 -0
- package/src/components/Tabs/index.ts +1 -0
- package/src/components/Tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +3 -1
- package/src/demos/Tabs.md +0 -10
- package/src/demos/examples/DashboardWrapper.js +1 -0
- package/src/demos/examples/Tabs/ModalTabs.tsx +3 -3
- package/src/demos/examples/Tabs/NestedTabs.tsx +11 -3
- package/src/demos/examples/Tabs/NestedUnindentedTabs.tsx +25 -40
- package/src/demos/examples/Tabs/TabsAndTable.tsx +9 -52
- package/src/helpers/Popper/Popper.tsx +13 -3
- package/src/demos/examples/Tabs/GrayTabs.tsx +0 -152
- package/src/demos/examples/Tabs/TabsAndTablesAutoWidthTabs.tsx +0 -442
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`renders tab action 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<li
|
|
6
|
+
class="pf-c-tabs__item pf-m-action"
|
|
7
|
+
role="presentation"
|
|
8
|
+
>
|
|
9
|
+
<button
|
|
10
|
+
aria-controls="pf-tab-section-1-"
|
|
11
|
+
aria-selected="false"
|
|
12
|
+
class="pf-c-tabs__link"
|
|
13
|
+
data-ouia-component-type="PF4/TabButton"
|
|
14
|
+
data-ouia-safe="true"
|
|
15
|
+
id="pf-tab-1-"
|
|
16
|
+
role="tab"
|
|
17
|
+
type="button"
|
|
18
|
+
>
|
|
19
|
+
<span
|
|
20
|
+
class="pf-c-tabs__item-text"
|
|
21
|
+
>
|
|
22
|
+
"Tab item 2"
|
|
23
|
+
</span>
|
|
24
|
+
</button>
|
|
25
|
+
<span
|
|
26
|
+
class="pf-c-tabs__item-action"
|
|
27
|
+
>
|
|
28
|
+
<button
|
|
29
|
+
aria-disabled="false"
|
|
30
|
+
aria-label="Tab action"
|
|
31
|
+
class="pf-c-button pf-m-plain"
|
|
32
|
+
data-ouia-component-id="OUIA-Generated-Button-plain-1"
|
|
33
|
+
data-ouia-component-type="PF4/Button"
|
|
34
|
+
data-ouia-safe="true"
|
|
35
|
+
type="button"
|
|
36
|
+
>
|
|
37
|
+
<span
|
|
38
|
+
class="pf-c-tabs__item-action-icon"
|
|
39
|
+
>
|
|
40
|
+
test
|
|
41
|
+
</span>
|
|
42
|
+
</button>
|
|
43
|
+
</span>
|
|
44
|
+
</li>
|
|
45
|
+
</DocumentFragment>
|
|
46
|
+
`;
|
|
47
|
+
|
|
3
48
|
exports[`should not render anything 1`] = `
|
|
4
49
|
<DocumentFragment>
|
|
5
50
|
<li
|
|
@@ -12,6 +12,8 @@ import DatabaseIcon from '@patternfly/react-icons/dist/esm/icons/database-icon';
|
|
|
12
12
|
import ServerIcon from '@patternfly/react-icons/dist/esm/icons/server-icon';
|
|
13
13
|
import LaptopIcon from '@patternfly/react-icons/dist/esm/icons/laptop-icon';
|
|
14
14
|
import ProjectDiagramIcon from '@patternfly/react-icons/dist/esm/icons/project-diagram-icon';
|
|
15
|
+
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
16
|
+
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
15
17
|
|
|
16
18
|
Most tab variations are available as open (default) or box style tabs. Select the 'isBox' checkbox to preview an example with box styled tabs.
|
|
17
19
|
The Tabs items background can be also toggled with 'Tab light variation' checkbox.
|
|
@@ -458,7 +460,15 @@ class VerticalTabs extends React.Component {
|
|
|
458
460
|
aria-label="Tabs in the vertical example"
|
|
459
461
|
role="region"
|
|
460
462
|
>
|
|
461
|
-
<Tab
|
|
463
|
+
<Tab
|
|
464
|
+
eventKey={0}
|
|
465
|
+
title={
|
|
466
|
+
<TabTitleText aria-label="vertical" role="region">
|
|
467
|
+
Users
|
|
468
|
+
</TabTitleText>
|
|
469
|
+
}
|
|
470
|
+
aria-label="Vertical example content users"
|
|
471
|
+
>
|
|
462
472
|
Users
|
|
463
473
|
</Tab>
|
|
464
474
|
<Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
|
|
@@ -591,7 +601,11 @@ class VerticalExpandableUncontrolledTabs extends React.Component {
|
|
|
591
601
|
aria-label="Tabs in the vertical expandable uncontrolled example"
|
|
592
602
|
role="region"
|
|
593
603
|
>
|
|
594
|
-
<Tab
|
|
604
|
+
<Tab
|
|
605
|
+
eventKey={0}
|
|
606
|
+
title={<TabTitleText>Users</TabTitleText>}
|
|
607
|
+
aria-label="Vertical expandable uncontrolled content users"
|
|
608
|
+
>
|
|
595
609
|
Users
|
|
596
610
|
</Tab>
|
|
597
611
|
<Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>}>
|
|
@@ -1206,7 +1220,12 @@ class TabsNav extends React.Component {
|
|
|
1206
1220
|
component={TabsComponent.nav}
|
|
1207
1221
|
aria-label="Tabs in the nav element example"
|
|
1208
1222
|
>
|
|
1209
|
-
<Tab
|
|
1223
|
+
<Tab
|
|
1224
|
+
eventKey={0}
|
|
1225
|
+
title={<TabTitleText>Users</TabTitleText>}
|
|
1226
|
+
href="#users"
|
|
1227
|
+
aria-label="Nav element content users"
|
|
1228
|
+
>
|
|
1210
1229
|
Users
|
|
1211
1230
|
</Tab>
|
|
1212
1231
|
<Tab eventKey={1} title={<TabTitleText>Containers</TabTitleText>} href="#containers">
|
|
@@ -1267,7 +1286,12 @@ class SecondaryTabsNav extends React.Component {
|
|
|
1267
1286
|
component={TabsComponent.nav}
|
|
1268
1287
|
aria-label="Tabs in the sub tabs with nav element example"
|
|
1269
1288
|
>
|
|
1270
|
-
<Tab
|
|
1289
|
+
<Tab
|
|
1290
|
+
eventKey={0}
|
|
1291
|
+
title={<TabTitleText>Users</TabTitleText>}
|
|
1292
|
+
href="#"
|
|
1293
|
+
aria-label="Subtabs with nav content users"
|
|
1294
|
+
>
|
|
1271
1295
|
<Tabs
|
|
1272
1296
|
activeKey={this.state.activeTabKey2}
|
|
1273
1297
|
isSecondary
|
|
@@ -1423,7 +1447,12 @@ const TabContentWithBody = () => {
|
|
|
1423
1447
|
|
|
1424
1448
|
return (
|
|
1425
1449
|
<React.Fragment>
|
|
1426
|
-
<Tabs
|
|
1450
|
+
<Tabs
|
|
1451
|
+
activeKey={activeTabKey}
|
|
1452
|
+
onSelect={handleTabClick}
|
|
1453
|
+
aria-label="Tabs in the body and padding example"
|
|
1454
|
+
role="region"
|
|
1455
|
+
>
|
|
1427
1456
|
<Tab
|
|
1428
1457
|
eventKey={0}
|
|
1429
1458
|
title={<TabTitleText>Tab item 1</TabTitleText>}
|
|
@@ -1447,20 +1476,10 @@ const TabContentWithBody = () => {
|
|
|
1447
1476
|
<TabContent eventKey={0} id="tab1SectionBodyPadding" ref={contentRef1}>
|
|
1448
1477
|
<TabContentBody hasPadding> Tab 1 section with body and padding </TabContentBody>
|
|
1449
1478
|
</TabContent>
|
|
1450
|
-
<TabContent
|
|
1451
|
-
eventKey={1}
|
|
1452
|
-
id="tab2SectionBodyPadding"
|
|
1453
|
-
ref={contentRef2}
|
|
1454
|
-
hidden
|
|
1455
|
-
>
|
|
1479
|
+
<TabContent eventKey={1} id="tab2SectionBodyPadding" ref={contentRef2} hidden>
|
|
1456
1480
|
<TabContentBody hasPadding> Tab 2 section with body and padding </TabContentBody>
|
|
1457
1481
|
</TabContent>
|
|
1458
|
-
<TabContent
|
|
1459
|
-
eventKey={2}
|
|
1460
|
-
id="tab3SectionBodyPadding"
|
|
1461
|
-
ref={contentRef3}
|
|
1462
|
-
hidden
|
|
1463
|
-
>
|
|
1482
|
+
<TabContent eventKey={2} id="tab3SectionBodyPadding" ref={contentRef3} hidden>
|
|
1464
1483
|
<TabContentBody hasPadding> Tab 3 section with body and padding </TabContentBody>
|
|
1465
1484
|
</TabContent>
|
|
1466
1485
|
</div>
|
|
@@ -1597,11 +1616,26 @@ class ToggledSeparateContent extends React.Component {
|
|
|
1597
1616
|
aria-label="Tabs in the toggled separate content example"
|
|
1598
1617
|
role="region"
|
|
1599
1618
|
>
|
|
1600
|
-
<Tab
|
|
1619
|
+
<Tab
|
|
1620
|
+
eventKey={0}
|
|
1621
|
+
title="Tab item 1"
|
|
1622
|
+
tabContentId="tab1SectionSeparateContent"
|
|
1623
|
+
tabContentRef={this.contentRef1}
|
|
1624
|
+
/>
|
|
1601
1625
|
{!isTab2Hidden && (
|
|
1602
|
-
<Tab
|
|
1626
|
+
<Tab
|
|
1627
|
+
eventKey={1}
|
|
1628
|
+
title="Tab item 2"
|
|
1629
|
+
tabContentId="tab2SectionSeparateContent"
|
|
1630
|
+
tabContentRef={this.contentRef2}
|
|
1631
|
+
/>
|
|
1603
1632
|
)}
|
|
1604
|
-
<Tab
|
|
1633
|
+
<Tab
|
|
1634
|
+
eventKey={2}
|
|
1635
|
+
title="Tab item 3"
|
|
1636
|
+
tabContentId="tab3SectionSeparateContent"
|
|
1637
|
+
tabContentRef={this.contentRef3}
|
|
1638
|
+
/>
|
|
1605
1639
|
</Tabs>
|
|
1606
1640
|
<div>
|
|
1607
1641
|
<TabContent
|
|
@@ -1645,3 +1679,13 @@ To enable closeable tabs, pass the `onClose` property to `Tabs`, and to enable t
|
|
|
1645
1679
|
|
|
1646
1680
|
```ts file="./TabsDynamic.tsx" isBeta
|
|
1647
1681
|
```
|
|
1682
|
+
|
|
1683
|
+
### Help action
|
|
1684
|
+
|
|
1685
|
+
```ts file="./TabsHelp.tsx" isBeta
|
|
1686
|
+
```
|
|
1687
|
+
|
|
1688
|
+
### Help and close actions
|
|
1689
|
+
|
|
1690
|
+
```ts file="./TabsHelpAndClose.tsx" isBeta
|
|
1691
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tabs, Tab, TabTitleText, TabAction, Popover } from '@patternfly/react-core';
|
|
3
|
+
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
4
|
+
|
|
5
|
+
export const TabsHelp: React.FunctionComponent = () => {
|
|
6
|
+
const [activeTabKey, setActiveTabKey] = React.useState<number>(0);
|
|
7
|
+
|
|
8
|
+
const tabs = ['Users', 'Containers', 'Database', 'Disabled', 'ARIA disabled', 'Help disabled'];
|
|
9
|
+
|
|
10
|
+
const helpPopover = (header: string, popoverRef: React.RefObject<any>) => (
|
|
11
|
+
<Popover
|
|
12
|
+
headerContent={<div>{header}</div>}
|
|
13
|
+
bodyContent={
|
|
14
|
+
<div>
|
|
15
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.
|
|
16
|
+
</div>
|
|
17
|
+
}
|
|
18
|
+
footerContent="Popover footer"
|
|
19
|
+
reference={popoverRef}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Tabs
|
|
25
|
+
activeKey={activeTabKey}
|
|
26
|
+
onSelect={(event: any, tabIndex: string | number) => setActiveTabKey(tabIndex as number)}
|
|
27
|
+
aria-label="Tabs in the help action example"
|
|
28
|
+
role="region"
|
|
29
|
+
>
|
|
30
|
+
{tabs.map((tab, index) => {
|
|
31
|
+
const ref = React.createRef<HTMLElement>();
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Tab
|
|
35
|
+
key={index}
|
|
36
|
+
eventKey={index}
|
|
37
|
+
aria-label={`Help action content - ${tab}`}
|
|
38
|
+
title={<TabTitleText>{tab}</TabTitleText>}
|
|
39
|
+
{...(tab === 'Disabled' && { isDisabled: true })}
|
|
40
|
+
{...(tab === 'ARIA disabled' && { isAriaDisabled: true })}
|
|
41
|
+
actions={
|
|
42
|
+
<>
|
|
43
|
+
<TabAction
|
|
44
|
+
isHelpAction
|
|
45
|
+
aria-label={`Help action for ${tab}`}
|
|
46
|
+
ref={ref}
|
|
47
|
+
{...(tab === 'Help disabled' && { isDisabled: true })}
|
|
48
|
+
>
|
|
49
|
+
<HelpIcon />
|
|
50
|
+
</TabAction>
|
|
51
|
+
{helpPopover(`Help popover for ${tab}`, ref)}
|
|
52
|
+
</>
|
|
53
|
+
}
|
|
54
|
+
>
|
|
55
|
+
{tab}
|
|
56
|
+
</Tab>
|
|
57
|
+
);
|
|
58
|
+
})}
|
|
59
|
+
</Tabs>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tabs, Tab, TabTitleText, Popover, TabAction } from '@patternfly/react-core';
|
|
3
|
+
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
4
|
+
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
5
|
+
|
|
6
|
+
export const TabsHelpAndClose: React.FunctionComponent = () => {
|
|
7
|
+
const [activeTabKey, setActiveTabKey] = React.useState<number>(0);
|
|
8
|
+
const [tabs, setTabs] = React.useState<string[]>(['Terminal 1', 'Terminal 2', 'Terminal 3']);
|
|
9
|
+
const tabComponentRef = React.useRef<any>();
|
|
10
|
+
const firstMount = React.useRef(true);
|
|
11
|
+
|
|
12
|
+
const onClose = (event: any, tabIndex: string | number) => {
|
|
13
|
+
const tabIndexNum = tabIndex as number;
|
|
14
|
+
let nextTabIndex = activeTabKey;
|
|
15
|
+
if (tabIndexNum < activeTabKey) {
|
|
16
|
+
// if a preceding tab is closing, keep focus on the new index of the current tab
|
|
17
|
+
nextTabIndex = activeTabKey - 1 > 0 ? activeTabKey - 1 : 0;
|
|
18
|
+
} else if (activeTabKey === tabs.length - 1) {
|
|
19
|
+
// if the closing tab is the last tab, focus the preceding tab
|
|
20
|
+
nextTabIndex = tabs.length - 2 > 0 ? tabs.length - 2 : 0;
|
|
21
|
+
}
|
|
22
|
+
setActiveTabKey(nextTabIndex);
|
|
23
|
+
setTabs(tabs.filter((tab, index) => index !== tabIndex));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const helpPopover = (header: string, popoverRef: React.RefObject<any>) => (
|
|
27
|
+
<Popover
|
|
28
|
+
headerContent={<div>{header}</div>}
|
|
29
|
+
bodyContent={
|
|
30
|
+
<div>
|
|
31
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.
|
|
32
|
+
</div>
|
|
33
|
+
}
|
|
34
|
+
footerContent="Popover footer"
|
|
35
|
+
reference={popoverRef}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
if (firstMount.current) {
|
|
41
|
+
firstMount.current = false;
|
|
42
|
+
return;
|
|
43
|
+
} else {
|
|
44
|
+
const first = tabComponentRef.current.tabList.current.childNodes[activeTabKey];
|
|
45
|
+
first && first.firstChild.focus();
|
|
46
|
+
}
|
|
47
|
+
}, [tabs]);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Tabs
|
|
51
|
+
activeKey={activeTabKey}
|
|
52
|
+
onSelect={(event: any, tabIndex: string | number) => setActiveTabKey(tabIndex as number)}
|
|
53
|
+
aria-label="Tabs in the help enabled and closeable example"
|
|
54
|
+
role="region"
|
|
55
|
+
ref={tabComponentRef}
|
|
56
|
+
>
|
|
57
|
+
{tabs.map((tab, index) => {
|
|
58
|
+
const ref = React.createRef<HTMLElement>();
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Tab
|
|
62
|
+
key={index}
|
|
63
|
+
eventKey={index}
|
|
64
|
+
aria-label={`Help action and closable content - ${tab}`}
|
|
65
|
+
title={<TabTitleText>{tab}</TabTitleText>}
|
|
66
|
+
actions={
|
|
67
|
+
<>
|
|
68
|
+
<TabAction isHelpAction aria-label={`Help for ${tab}`} ref={ref}>
|
|
69
|
+
<HelpIcon />
|
|
70
|
+
</TabAction>
|
|
71
|
+
<TabAction aria-label={`Close ${tab}`} onClick={e => onClose(e, index)} isDisabled={tabs.length === 1}>
|
|
72
|
+
<TimesIcon />
|
|
73
|
+
</TabAction>
|
|
74
|
+
{helpPopover(`Help popover for ${tab}`, ref)}
|
|
75
|
+
</>
|
|
76
|
+
}
|
|
77
|
+
>
|
|
78
|
+
{tab}
|
|
79
|
+
</Tab>
|
|
80
|
+
);
|
|
81
|
+
})}
|
|
82
|
+
</Tabs>
|
|
83
|
+
);
|
|
84
|
+
};
|
package/src/demos/Tabs.md
CHANGED
|
@@ -453,17 +453,7 @@ TabsOpenWithSecondaryTabsDemo = () => {
|
|
|
453
453
|
```js isFullscreen file="./examples/Tabs/TabsAndTable.tsx"
|
|
454
454
|
```
|
|
455
455
|
|
|
456
|
-
### Tables and tabs, auto width tabs
|
|
457
|
-
|
|
458
|
-
```js isFullscreen file="./examples/Tabs/TabsAndTablesAutoWidthTabs.tsx"
|
|
459
|
-
```
|
|
460
|
-
|
|
461
456
|
### Modal tabs
|
|
462
457
|
|
|
463
458
|
```js isFullscreen file="./examples/Tabs/ModalTabs.tsx"
|
|
464
459
|
```
|
|
465
|
-
|
|
466
|
-
### Gray tabs
|
|
467
|
-
|
|
468
|
-
```js isFullscreen file="./examples/Tabs/GrayTabs.tsx"
|
|
469
|
-
```
|
|
@@ -47,8 +47,8 @@ const products: Product[] = [
|
|
|
47
47
|
];
|
|
48
48
|
|
|
49
49
|
export const ModalTabs: React.FunctionComponent = () => {
|
|
50
|
-
const [isModalOpen, setIsModalOpen] = React.useState(
|
|
51
|
-
const [selectedProduct, setSelectedProduct] = React.useState<Product>();
|
|
50
|
+
const [isModalOpen, setIsModalOpen] = React.useState(true);
|
|
51
|
+
const [selectedProduct, setSelectedProduct] = React.useState<Product>(products[0]);
|
|
52
52
|
const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
|
|
53
53
|
|
|
54
54
|
const onCardClick = React.useCallback(
|
|
@@ -114,7 +114,7 @@ export const ModalTabs: React.FunctionComponent = () => {
|
|
|
114
114
|
<Modal variant={ModalVariant.small} title={selectedProduct.name} isOpen={isModalOpen} onClose={closeModal}>
|
|
115
115
|
<Grid hasGutter>
|
|
116
116
|
<GridItem>
|
|
117
|
-
<Tabs activeKey={activeTabKey} onSelect={onTabSelect} isSecondary>
|
|
117
|
+
<Tabs activeKey={activeTabKey} onSelect={onTabSelect} isSecondary hasSecondaryBorderBottom>
|
|
118
118
|
<Tab eventKey={0} tabContentId="details-tab" title={<TabTitleText>Details</TabTitleText>} />
|
|
119
119
|
<Tab eventKey={1} tabContentId="doc-tab" title={<TabTitleText>Documentation</TabTitleText>} />
|
|
120
120
|
</Tabs>
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
TabContentBody,
|
|
13
13
|
TabTitleText,
|
|
14
14
|
Title,
|
|
15
|
+
TitleSizes,
|
|
15
16
|
Flex,
|
|
16
17
|
FlexItem
|
|
17
18
|
} from '@patternfly/react-core';
|
|
@@ -32,7 +33,9 @@ export const NestedTabs: React.FunctionComponent = () => {
|
|
|
32
33
|
<GridItem xl={8} md={6}>
|
|
33
34
|
<Card>
|
|
34
35
|
<CardHeader>
|
|
35
|
-
<Title headingLevel="h2">
|
|
36
|
+
<Title headingLevel="h2" size={TitleSizes.lg}>
|
|
37
|
+
Status
|
|
38
|
+
</Title>
|
|
36
39
|
</CardHeader>
|
|
37
40
|
<CardBody>
|
|
38
41
|
<Flex direction={{ default: 'column' }}>
|
|
@@ -40,6 +43,7 @@ export const NestedTabs: React.FunctionComponent = () => {
|
|
|
40
43
|
<Tabs
|
|
41
44
|
activeKey={activeNestedTabKey}
|
|
42
45
|
isSecondary
|
|
46
|
+
hasSecondaryBorderBottom
|
|
43
47
|
onSelect={(_event, tabIndex) => handleNestedTabClick(Number(tabIndex))}
|
|
44
48
|
id="nested-tabs-example-nested-tabs-list"
|
|
45
49
|
>
|
|
@@ -108,14 +112,18 @@ export const NestedTabs: React.FunctionComponent = () => {
|
|
|
108
112
|
<FlexItem flex={{ default: 'flex_1' }}>
|
|
109
113
|
<Card isFullHeight>
|
|
110
114
|
<CardHeader>
|
|
111
|
-
<Title headingLevel="h2"
|
|
115
|
+
<Title headingLevel="h2" size={TitleSizes.lg}>
|
|
116
|
+
Title of card
|
|
117
|
+
</Title>
|
|
112
118
|
</CardHeader>
|
|
113
119
|
</Card>
|
|
114
120
|
</FlexItem>
|
|
115
121
|
<FlexItem flex={{ default: 'flex_1' }}>
|
|
116
122
|
<Card isFullHeight>
|
|
117
123
|
<CardHeader>
|
|
118
|
-
<Title headingLevel="h2"
|
|
124
|
+
<Title headingLevel="h2" size={TitleSizes.lg}>
|
|
125
|
+
Title of card
|
|
126
|
+
</Title>
|
|
119
127
|
</CardHeader>
|
|
120
128
|
</Card>
|
|
121
129
|
</FlexItem>
|
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
Title,
|
|
15
15
|
Text,
|
|
16
16
|
TextContent,
|
|
17
|
-
TitleSizes
|
|
17
|
+
TitleSizes,
|
|
18
|
+
CardTitle
|
|
18
19
|
} from '@patternfly/react-core';
|
|
19
20
|
import DashboardWrapper from '@patternfly/react-core/src/demos/examples/DashboardWrapper';
|
|
20
21
|
|
|
@@ -32,7 +33,7 @@ export const NestedUnindentedTabs: React.FunctionComponent = () => {
|
|
|
32
33
|
<Grid hasGutter>
|
|
33
34
|
<GridItem>
|
|
34
35
|
<CardHeader>
|
|
35
|
-
<Title headingLevel="h1" size={TitleSizes
|
|
36
|
+
<Title headingLevel="h1" size={TitleSizes.lg}>
|
|
36
37
|
Get started with Red Hat Enterprise Linux
|
|
37
38
|
</Title>
|
|
38
39
|
</CardHeader>
|
|
@@ -41,6 +42,7 @@ export const NestedUnindentedTabs: React.FunctionComponent = () => {
|
|
|
41
42
|
<Tabs
|
|
42
43
|
activeKey={activeNestedTabKey}
|
|
43
44
|
isSecondary
|
|
45
|
+
hasSecondaryBorderBottom
|
|
44
46
|
onSelect={(_event, tabIndex) => handleNestedTabClick(Number(tabIndex))}
|
|
45
47
|
id="nested-tabs-example-nested-tabs-list"
|
|
46
48
|
>
|
|
@@ -68,42 +70,26 @@ export const NestedUnindentedTabs: React.FunctionComponent = () => {
|
|
|
68
70
|
</TextContent>
|
|
69
71
|
</GridItem>
|
|
70
72
|
<Grid md={6} xl2={3} hasGutter>
|
|
71
|
-
<
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
<CardHeader>Create a bootable installation media</CardHeader>
|
|
92
|
-
<CardBody>
|
|
93
|
-
{' '}
|
|
94
|
-
<a href="#">Create</a> a bootable installation media, for example a USB flash drive.
|
|
95
|
-
</CardBody>
|
|
96
|
-
</Card>
|
|
97
|
-
</GridItem>
|
|
98
|
-
<GridItem>
|
|
99
|
-
<Card isFullHeight>
|
|
100
|
-
<CardHeader>Install and register your system</CardHeader>
|
|
101
|
-
<CardBody>
|
|
102
|
-
Boot the installation, register your system, attach RHEL subscriptions, and install RHEL from the
|
|
103
|
-
Red Hat Content Delivery Network (CDN) using the GUI.
|
|
104
|
-
</CardBody>
|
|
105
|
-
</Card>
|
|
106
|
-
</GridItem>
|
|
73
|
+
<Card isFlat component="div">
|
|
74
|
+
<CardTitle>Check system requirements</CardTitle>
|
|
75
|
+
<CardBody>
|
|
76
|
+
Your physical or virtual machine should meet the <a href="#">system requirement</a>.
|
|
77
|
+
</CardBody>
|
|
78
|
+
</Card>
|
|
79
|
+
<Card isFlat component="div">
|
|
80
|
+
<CardTitle>Download an installation ISO image</CardTitle>
|
|
81
|
+
<CardBody>
|
|
82
|
+
{' '}
|
|
83
|
+
<a href="#">Download</a> the binary DVD ISO.
|
|
84
|
+
</CardBody>
|
|
85
|
+
</Card>
|
|
86
|
+
<Card isFlat component="div">
|
|
87
|
+
<CardTitle>Create a bootable installation media</CardTitle>
|
|
88
|
+
<CardBody>
|
|
89
|
+
{' '}
|
|
90
|
+
<a href="#">Create</a> a bootable installation media, for example a USB flash drive.
|
|
91
|
+
</CardBody>
|
|
92
|
+
</Card>
|
|
107
93
|
</Grid>
|
|
108
94
|
</Grid>
|
|
109
95
|
</TabContentBody>
|
|
@@ -143,7 +129,6 @@ export const NestedUnindentedTabs: React.FunctionComponent = () => {
|
|
|
143
129
|
<DashboardWrapper hasPageTemplateTitle>
|
|
144
130
|
<PageSection type="tabs" isWidthLimited variant="light">
|
|
145
131
|
<Tabs
|
|
146
|
-
isBox
|
|
147
132
|
activeKey={activeTabKey}
|
|
148
133
|
onSelect={(_event, tabIndex) => handleTabClick(Number(tabIndex))}
|
|
149
134
|
usePageInsets
|
|
@@ -155,7 +140,7 @@ export const NestedUnindentedTabs: React.FunctionComponent = () => {
|
|
|
155
140
|
<Tab eventKey={3} title={<TabTitleText>Support</TabTitleText>} tabContentId={`tabContent${3}`} />
|
|
156
141
|
</Tabs>
|
|
157
142
|
</PageSection>
|
|
158
|
-
<PageSection variant="light">
|
|
143
|
+
<PageSection isWidthLimited variant="light">
|
|
159
144
|
<TabContent key={0} eventKey={0} id={`tabContent${0}`} activeKey={activeTabKey} hidden={0 !== activeTabKey}>
|
|
160
145
|
<TabContentBody>What's new panel</TabContentBody>
|
|
161
146
|
</TabContent>
|