@patternfly/react-core 4.208.12 → 4.208.13

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 (34) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/esm/components/Tabs/Tabs.d.ts +3 -1
  3. package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
  4. package/dist/esm/components/Tabs/Tabs.js +2 -2
  5. package/dist/esm/components/Tabs/Tabs.js.map +1 -1
  6. package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
  7. package/dist/esm/components/Wizard/Wizard.js +3 -3
  8. package/dist/esm/components/Wizard/Wizard.js.map +1 -1
  9. package/dist/esm/components/Wizard/WizardNavItem.d.ts +2 -0
  10. package/dist/esm/components/Wizard/WizardNavItem.d.ts.map +1 -1
  11. package/dist/esm/components/Wizard/WizardNavItem.js +2 -2
  12. package/dist/esm/components/Wizard/WizardNavItem.js.map +1 -1
  13. package/dist/js/components/Tabs/Tabs.d.ts +3 -1
  14. package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
  15. package/dist/js/components/Tabs/Tabs.js +2 -2
  16. package/dist/js/components/Tabs/Tabs.js.map +1 -1
  17. package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
  18. package/dist/js/components/Wizard/Wizard.js +3 -3
  19. package/dist/js/components/Wizard/Wizard.js.map +1 -1
  20. package/dist/js/components/Wizard/WizardNavItem.d.ts +2 -0
  21. package/dist/js/components/Wizard/WizardNavItem.d.ts.map +1 -1
  22. package/dist/js/components/Wizard/WizardNavItem.js +2 -2
  23. package/dist/js/components/Wizard/WizardNavItem.js.map +1 -1
  24. package/dist/umd/react-core.js +7 -7
  25. package/dist/umd/react-core.min.css +75 -75
  26. package/dist/umd/react-core.min.js +1 -1
  27. package/package.json +5 -5
  28. package/src/components/Tabs/Tabs.tsx +5 -1
  29. package/src/components/Tabs/__tests__/Tabs.test.tsx +40 -1
  30. package/src/components/Wizard/Wizard.tsx +3 -0
  31. package/src/components/Wizard/WizardNavItem.tsx +4 -0
  32. package/src/components/Wizard/__tests__/Wizard.test.tsx +6 -3
  33. package/src/components/Wizard/__tests__/__snapshots__/Wizard.test.tsx.snap +6 -0
  34. package/src/demos/Tabs.md +53 -57
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.208.12",
3
+ "version": "4.208.13",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -34,9 +34,9 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.59.12",
38
- "@patternfly/react-styles": "^4.58.12",
39
- "@patternfly/react-tokens": "^4.60.12",
37
+ "@patternfly/react-icons": "^4.59.13",
38
+ "@patternfly/react-styles": "^4.58.13",
39
+ "@patternfly/react-tokens": "^4.60.13",
40
40
  "focus-trap": "6.2.2",
41
41
  "react-dropzone": "9.0.0",
42
42
  "tippy.js": "5.1.2",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.8.0 || ^17.0.0",
61
61
  "react-dom": "^16.8.0 || ^17.0.0"
62
62
  },
63
- "gitHead": "29bbfb4f27300b3d03b244e41b56fa79a37040d2"
63
+ "gitHead": "9595ee060320621567e7d14e2b11240eb8dc37d2"
64
64
  }
@@ -41,8 +41,10 @@ export interface TabsProps extends Omit<React.HTMLProps<HTMLElement | HTMLDivEle
41
41
  isBox?: boolean;
42
42
  /** Enables vertical tab styling */
43
43
  isVertical?: boolean;
44
- /** Enables no border bottom tab styling */
44
+ /** Enables border bottom tab styling on tabs. Defaults to true. To remove the bottom border, set this prop to false. */
45
45
  hasBorderBottom?: boolean;
46
+ /** Enables border bottom styling for secondary tabs */
47
+ hasSecondaryBorderBottom?: boolean;
46
48
  /** Aria-label for the left scroll button */
47
49
  leftScrollAriaLabel?: string;
48
50
  /** Aria-label for the right scroll button */
@@ -292,6 +294,7 @@ export class Tabs extends React.Component<TabsProps, TabsState> {
292
294
  isVertical,
293
295
  isBox,
294
296
  hasBorderBottom,
297
+ hasSecondaryBorderBottom,
295
298
  leftScrollAriaLabel,
296
299
  rightScrollAriaLabel,
297
300
  'aria-label': ariaLabel,
@@ -361,6 +364,7 @@ export class Tabs extends React.Component<TabsProps, TabsState> {
361
364
  showScrollButtons && !isVertical && styles.modifiers.scrollable,
362
365
  usePageInsets && styles.modifiers.pageInsets,
363
366
  !hasBorderBottom && styles.modifiers.noBorderBottom,
367
+ hasSecondaryBorderBottom && styles.modifiers.borderBottom,
364
368
  formatBreakpointMods(inset, styles),
365
369
  variantStyle[variant],
366
370
  className
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { render } from '@testing-library/react';
2
+ import { render, screen } from '@testing-library/react';
3
3
  import { Tabs } from '../Tabs';
4
4
  import { Tab } from '../Tab';
5
5
  import { TabTitleText } from '../TabTitleText';
@@ -350,3 +350,42 @@ test('should render tabs with no bottom border', () => {
350
350
  expect(asFragment()).toMatchSnapshot();
351
351
  });
352
352
 
353
+ test('should not render tabs with secondary border bottom when not passed hasSecondaryBorderBottom', () => {
354
+ render(
355
+ <Tabs id="noBottomBorderTabs" aria-label="Secondary bottom border">
356
+ <Tab id="tab1" eventKey={0} title={<TabTitleText>"Tab item 1"</TabTitleText>}>
357
+ Tab 1 section
358
+ </Tab>
359
+ <Tab id="tab2" eventKey={1} title={<TabTitleText>"Tab item 2"</TabTitleText>}>
360
+ Tab 2 section
361
+ </Tab>
362
+ <Tab id="tab3" eventKey={2} title={<TabTitleText>"Tab item 3"</TabTitleText>}>
363
+ Tab 3 section
364
+ </Tab>
365
+ </Tabs>
366
+ );
367
+
368
+ const tabsContainer = screen.queryByLabelText('Secondary bottom border');
369
+
370
+ expect(tabsContainer).not.toHaveClass('pf-m-border-bottom');
371
+ });
372
+
373
+ test('should render tabs with secondary border bottom when passed hasSecondaryBorderBottom', () => {
374
+ render(
375
+ <Tabs id="noBottomBorderTabs" aria-label="Secondary bottom border" hasSecondaryBorderBottom>
376
+ <Tab id="tab1" eventKey={0} title={<TabTitleText>"Tab item 1"</TabTitleText>}>
377
+ Tab 1 section
378
+ </Tab>
379
+ <Tab id="tab2" eventKey={1} title={<TabTitleText>"Tab item 2"</TabTitleText>}>
380
+ Tab 2 section
381
+ </Tab>
382
+ <Tab id="tab3" eventKey={2} title={<TabTitleText>"Tab item 3"</TabTitleText>}>
383
+ Tab 3 section
384
+ </Tab>
385
+ </Tabs>
386
+ );
387
+
388
+ const tabsContainer = screen.queryByLabelText('Secondary bottom border');
389
+
390
+ expect(tabsContainer).toHaveClass('pf-m-border-bottom');
391
+ });
@@ -381,6 +381,7 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
381
381
  return (
382
382
  <WizardNavItem
383
383
  key={index}
384
+ id={step.id}
384
385
  content={step.name}
385
386
  isExpandable={isNavExpandable}
386
387
  isCurrent={hasActiveChild}
@@ -399,6 +400,7 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
399
400
  return (
400
401
  <WizardNavItem
401
402
  key={`child_${indexChild}`}
403
+ id={childStep.id}
402
404
  content={childStep.name}
403
405
  isCurrent={activeStep.name === childStep.name}
404
406
  isDisabled={!enabled}
@@ -417,6 +419,7 @@ export class Wizard extends React.Component<WizardProps, WizardState> {
417
419
  <WizardNavItem
418
420
  {...step.stepNavItemProps}
419
421
  key={index}
422
+ id={step.id}
420
423
  content={step.name}
421
424
  isCurrent={activeStep.name === step.name}
422
425
  isDisabled={!enabled}
@@ -22,6 +22,8 @@ export interface WizardNavItemProps {
22
22
  href?: string;
23
23
  /** Flag indicating that this NavItem has child steps and is expandable */
24
24
  isExpandable?: boolean;
25
+ /** The id for the nav item */
26
+ id?: string | number;
25
27
  }
26
28
 
27
29
  export const WizardNavItem: React.FunctionComponent<WizardNavItemProps> = ({
@@ -34,6 +36,7 @@ export const WizardNavItem: React.FunctionComponent<WizardNavItemProps> = ({
34
36
  navItemComponent = 'button',
35
37
  href = null,
36
38
  isExpandable = false,
39
+ id,
37
40
  ...rest
38
41
  }: WizardNavItemProps) => {
39
42
  const NavItemComponent = navItemComponent;
@@ -69,6 +72,7 @@ export const WizardNavItem: React.FunctionComponent<WizardNavItemProps> = ({
69
72
  <NavItemComponent
70
73
  {...rest}
71
74
  {...(navItemComponent === 'a' ? { ...linkProps } : { ...btnProps })}
75
+ {...(id && { id: id.toString() })}
72
76
  onClick={() => (isExpandable ? setIsExpanded(!isExpanded || isCurrent) : onNavItemClick(step))}
73
77
  className={css(
74
78
  styles.wizardNavLink,
@@ -5,24 +5,27 @@ import { Wizard, WizardStepFunctionType, WizardStep } from '../Wizard';
5
5
  describe('Wizard', () => {
6
6
  test('Wizard should match snapshot', () => {
7
7
  const steps: WizardStep[] = [
8
- { name: 'A', component: <p>Step 1</p> },
8
+ { name: 'A', id: "step-A", component: <p>Step 1</p> },
9
9
  {
10
10
  name: 'B',
11
+ id: "step-B",
11
12
  steps: [
12
13
  {
13
14
  name: 'B-1',
15
+ id: "step-B-1",
14
16
  component: <p>Step 2</p>,
15
17
  enableNext: true
16
18
  },
17
19
  {
18
20
  name: 'B-2',
21
+ id: "step-B-2",
19
22
  component: <p>Step 3</p>,
20
23
  enableNext: false
21
24
  }
22
25
  ]
23
26
  },
24
- { name: 'C', component: <p>Step 4</p> },
25
- { name: 'D', component: <p>Step 5</p> }
27
+ { name: 'C', id: "step-C", component: <p>Step 4</p> },
28
+ { name: 'D', id: "step-D", component: <p>Step 5</p> }
26
29
  ];
27
30
  const onBack: WizardStepFunctionType = step => {
28
31
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -351,6 +351,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
351
351
  <button
352
352
  aria-current="step"
353
353
  class="pf-c-wizard__nav-link pf-m-current"
354
+ id="step-A"
354
355
  >
355
356
  A
356
357
  </button>
@@ -361,6 +362,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
361
362
  <button
362
363
  aria-current="false"
363
364
  class="pf-c-wizard__nav-link"
365
+ id="step-B"
364
366
  >
365
367
  B
366
368
  </button>
@@ -373,6 +375,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
373
375
  <button
374
376
  aria-current="false"
375
377
  class="pf-c-wizard__nav-link"
378
+ id="step-B-1"
376
379
  >
377
380
  B-1
378
381
  </button>
@@ -383,6 +386,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
383
386
  <button
384
387
  aria-current="false"
385
388
  class="pf-c-wizard__nav-link"
389
+ id="step-B-2"
386
390
  >
387
391
  B-2
388
392
  </button>
@@ -395,6 +399,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
395
399
  <button
396
400
  aria-current="false"
397
401
  class="pf-c-wizard__nav-link"
402
+ id="step-C"
398
403
  >
399
404
  C
400
405
  </button>
@@ -405,6 +410,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
405
410
  <button
406
411
  aria-current="false"
407
412
  class="pf-c-wizard__nav-link"
413
+ id="step-D"
408
414
  >
409
415
  D
410
416
  </button>
package/src/demos/Tabs.md CHANGED
@@ -378,65 +378,60 @@ TabsOpenWithSecondaryTabsDemo = () => {
378
378
  <Tab eventKey={4} title={<TabTitleText>Terminal</TabTitleText>} tabContentId={`tabContent${4}`} />
379
379
  </Tabs>
380
380
  </PageSection>
381
- <PageSection isWidthLimited variant={PageSectionVariants.light}>
382
- <Flex direction={{ default: 'column' }}>
383
- <FlexItem>
384
- <TabContent key={0} eventKey={0} id={`tabContent${0}`} activeKey={activeTabKey} hidden={0 !== activeTabKey}>
385
- <TabContentBody>
386
- <Tabs
387
- isSecondary
388
- activeKey={activeTabKeySecondary}
389
- onSelect={handleTabClickSecondary}
390
- inset={{ default: 'insetNone' }}
391
- id="open-with-secondary-tabs-example-tabs-list-secondary"
392
- >
393
- <Tab
394
- eventKey={10}
395
- title={<TabTitleText>Pod information</TabTitleText>}
396
- tabContentId={`tabContent${10}`}
397
- />
398
- <Tab
399
- eventKey={11}
400
- title={<TabTitleText>Editable aspects</TabTitleText>}
401
- tabContentId={`tabContent${11}`}
402
- />
403
- </Tabs>
404
- <TabContent
405
- key={10}
406
- eventKey={10}
407
- id={`tabContent${10}`}
408
- activeKey={activeTabKeySecondary}
409
- hidden={10 !== activeTabKeySecondary}
410
- >
411
- <TabContentBody>{tabContent}</TabContentBody>
412
- </TabContent>
413
- <TabContent
414
- key={11}
415
- eventKey={11}
416
- id={`tabContent${11}`}
417
- activeKey={activeTabKeySecondary}
418
- hidden={11 !== activeTabKeySecondary}
419
- >
420
- <TabContentBody>Editable aspects</TabContentBody>
421
- </TabContent>
422
- </TabContentBody>
423
- </TabContent>
424
- </FlexItem>
425
- <FlexItem>
426
- <TabContent key={1} eventKey={1} id={`tabContent${1}`} activeKey={activeTabKey} hidden={1 !== activeTabKey}>
427
- <TabContentBody>YAML panel</TabContentBody>
428
- </TabContent>
429
- <TabContent key={2} eventKey={2} id={`tabContent${2}`} activeKey={activeTabKey} hidden={2 !== activeTabKey}>
430
- <TabContentBody>Environment panel</TabContentBody>
431
- </TabContent>
432
- <TabContent key={3} eventKey={3} id={`tabContent${3}`} activeKey={activeTabKey} hidden={3 !== activeTabKey}>
433
- <TabContentBody>Events panel</TabContentBody>
381
+ <PageSection isWidthLimited variant={PageSectionVariants.light} padding={{ default: 'noPadding' }}>
382
+ <TabContent key={0} eventKey={0} id={`tabContent${0}`} activeKey={activeTabKey} hidden={0 !== activeTabKey}>
383
+ <TabContentBody>
384
+ <Tabs
385
+ isSecondary
386
+ hasSecondaryBorderBottom
387
+ activeKey={activeTabKeySecondary}
388
+ onSelect={handleTabClickSecondary}
389
+ usePageInsets
390
+ id="open-with-secondary-tabs-example-tabs-list-secondary"
391
+ >
392
+ <Tab
393
+ eventKey={10}
394
+ title={<TabTitleText>Pod information</TabTitleText>}
395
+ tabContentId={`tabContent${10}`}
396
+ />
397
+ <Tab
398
+ eventKey={11}
399
+ title={<TabTitleText>Editable aspects</TabTitleText>}
400
+ tabContentId={`tabContent${11}`}
401
+ />
402
+ </Tabs>
403
+ <TabContent
404
+ key={10}
405
+ eventKey={10}
406
+ id={`tabContent${10}`}
407
+ activeKey={activeTabKeySecondary}
408
+ hidden={10 !== activeTabKeySecondary}
409
+ >
410
+ <TabContentBody hasPadding>{tabContent}</TabContentBody>
434
411
  </TabContent>
435
- <TabContent key={4} eventKey={4} id={`tabContent${4}`} activeKey={activeTabKey} hidden={4 !== activeTabKey}>
436
- <TabContentBody>Terminal panel</TabContentBody>
412
+ <TabContent
413
+ key={11}
414
+ eventKey={11}
415
+ id={`tabContent${11}`}
416
+ activeKey={activeTabKeySecondary}
417
+ hidden={11 !== activeTabKeySecondary}
418
+ >
419
+ <TabContentBody>Editable aspects</TabContentBody>
437
420
  </TabContent>
438
- </FlexItem>
439
- </Flex>
421
+ </TabContentBody>
422
+ </TabContent>
423
+ <TabContent key={1} eventKey={1} id={`tabContent${1}`} activeKey={activeTabKey} hidden={1 !== activeTabKey}>
424
+ <TabContentBody>YAML panel</TabContentBody>
425
+ </TabContent>
426
+ <TabContent key={2} eventKey={2} id={`tabContent${2}`} activeKey={activeTabKey} hidden={2 !== activeTabKey}>
427
+ <TabContentBody>Environment panel</TabContentBody>
428
+ </TabContent>
429
+ <TabContent key={3} eventKey={3} id={`tabContent${3}`} activeKey={activeTabKey} hidden={3 !== activeTabKey}>
430
+ <TabContentBody>Events panel</TabContentBody>
431
+ </TabContent>
432
+ <TabContent key={4} eventKey={4} id={`tabContent${4}`} activeKey={activeTabKey} hidden={4 !== activeTabKey}>
433
+ <TabContentBody>Terminal panel</TabContentBody>
434
+ </TabContent>
440
435
  </PageSection>
441
436
  </DashboardWrapper>
442
437
  );
@@ -467,6 +462,7 @@ TabsOpenWithSecondaryTabsDemo = () => {
467
462
 
468
463
  ```js isFullscreen file="./examples/Tabs/ModalTabs.tsx"
469
464
  ```
465
+
470
466
  ### Gray tabs
471
467
 
472
468
  ```js isFullscreen file="./examples/Tabs/GrayTabs.tsx"