@patternfly/react-core 4.183.4 → 4.183.5

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 CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 4.183.5 (2022-01-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **jumplinks:** Updated JumpLinks demo to allow for horizontal display ([#6731](https://github.com/patternfly/patternfly-react/issues/6731)) ([f37b934](https://github.com/patternfly/patternfly-react/commit/f37b9342e678da247056c73767d5d40ff5435bda))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 4.183.4 (2022-01-06)
7
18
 
8
19
  **Note:** Version bump only for package @patternfly/react-core
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.183.4",
3
+ "version": "4.183.5",
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.34.4",
38
- "@patternfly/react-styles": "^4.33.4",
39
- "@patternfly/react-tokens": "^4.35.4",
37
+ "@patternfly/react-icons": "^4.34.5",
38
+ "@patternfly/react-styles": "^4.33.5",
39
+ "@patternfly/react-tokens": "^4.35.5",
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": "c3d126fe3f5b45d8a0c24ae7e2268d55529dd8fe"
63
+ "gitHead": "39b9bbc6bf54e9e792552b6a0b18f1dd3b89cd8d"
64
64
  }
@@ -15,7 +15,7 @@ JumpLinks has a scrollspy built-in to make your implementation easier. When impl
15
15
 
16
16
  ### Scrollspy with subsections
17
17
 
18
- This demo expands on the previous to show the JumpLinks in a vertical layout with subsections. It scrolls the [Page](/components/page)'s `mainContainerId` with an `offset` of 76px for the masthead. The headings are given a tab index to allow the jump links to focus them.
18
+ This demo expands on the previous to show the JumpLinks in a vertical layout with subsections. It scrolls the [Page](/components/page)'s `mainContainerId` with an `offset` calculated based on the height of the masthead and the nav list when it appears above the content. The headings are given a tab index to allow the jump links to focus on them.
19
19
 
20
20
  ```js isFullscreen
21
21
  import React from 'react';
@@ -30,7 +30,8 @@ import {
30
30
  SidebarPanel,
31
31
  Switch,
32
32
  Title,
33
- TextContent
33
+ TextContent,
34
+ getResizeObserver
34
35
  } from '@patternfly/react-core';
35
36
  import DashboardWrapper from './examples/DashboardWrapper';
36
37
 
@@ -38,6 +39,23 @@ ScrollspyH2 = () => {
38
39
  const headings = [1, 2, 3, 4, 5];
39
40
 
40
41
  const [isVertical, setIsVertical] = React.useState(true);
42
+ const [offsetHeight, setOffsetHeight] = React.useState(10);
43
+
44
+ // Update offset based on the masthead and jump links nav heights.
45
+ React.useEffect(() => {
46
+ const masthead = document.getElementsByClassName('pf-c-masthead')[0];
47
+ const offsetForPadding = 10;
48
+
49
+ getResizeObserver(masthead, () => {
50
+ if (isVertical) {
51
+ setOffsetHeight(masthead.offsetHeight + offsetForPadding);
52
+ } else {
53
+ // Append jump links nav height to the masthead height when value exists.
54
+ const jumpLinksHeaderHeight = document.getElementsByClassName('pf-m-sticky')[0].offsetHeight;
55
+ jumpLinksHeaderHeight && setOffsetHeight(masthead.offsetHeight + jumpLinksHeaderHeight + offsetForPadding);
56
+ }
57
+ });
58
+ }, [isVertical]);
41
59
 
42
60
  return (
43
61
  <DashboardWrapper breadcrumb={null} mainContainerId="scrollable-element">
@@ -62,8 +80,8 @@ ScrollspyH2 = () => {
62
80
  isCentered={!isVertical}
63
81
  label="Jump to section"
64
82
  scrollableSelector="#scrollable-element"
65
- offset={76} // for masthead
66
- expandable={{ default: 'expandable', md: 'nonExpandable' }}
83
+ offset={offsetHeight}
84
+ expandable={{ default: isVertical ? 'expandable' : 'nonExpandable', md: 'nonExpandable' }}
67
85
  isExpanded
68
86
  >
69
87
  {headings.map(i => (