@patternfly/documentation-framework 6.0.6 → 6.0.8

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,28 @@
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
+ ## 6.0.8 (2024-11-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **docs:** fix scroll selector to scroll to top on page change ([#4364](https://github.com/patternfly/patternfly-org/issues/4364)) ([c0a0c26](https://github.com/patternfly/patternfly-org/commit/c0a0c26bf10b7a784fab194d626342a7d71e86d6))
12
+
13
+
14
+
15
+
16
+
17
+ ## 6.0.7 (2024-11-15)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * a11y scorecard update after PF6 ([#4375](https://github.com/patternfly/patternfly-org/issues/4375)) ([c4f3e65](https://github.com/patternfly/patternfly-org/commit/c4f3e65d9a9315ea105fddb6a4f15ca21df7fb23))
23
+
24
+
25
+
26
+
27
+
6
28
  ## 6.0.6 (2024-11-06)
7
29
 
8
30
  **Note:** Version bump only for package @patternfly/documentation-framework
@@ -16,13 +16,7 @@ const Promiseany = (
16
16
  }
17
17
  ).bind(Promise);
18
18
 
19
- export const Link = ({
20
- href,
21
- to,
22
- onMouseOver = () => {},
23
- onClick,
24
- ...props
25
- }) => {
19
+ export const Link = ({ href, to, onMouseOver = () => {}, onClick, ...props }) => {
26
20
  let preloadPromise;
27
21
  let url = href || to || '';
28
22
  if (url.startsWith('#') && !onClick) {
@@ -54,14 +48,12 @@ export const Link = ({
54
48
  if (!(ev.ctrlKey || ev.metaKey)) {
55
49
  // avoid disallowing cmnd/ctrl+click opening in new tab
56
50
  ev.preventDefault();
57
- document
58
- .querySelector('.pf-v6-c-page__main-container')
59
- .scrollTo({ top: 0 }); // scroll to top of page
60
51
  if (typeof window !== 'undefined' && url !== location.pathname) {
61
- Promiseany([
62
- preloadPromise,
63
- new Promise((res) => setTimeout(res, 500)),
64
- ]).then(() => navigate(url));
52
+ Promiseany([preloadPromise, new Promise((res) => setTimeout(res, 500))])
53
+ .then(() => navigate(url))
54
+ .then(() => {
55
+ document.querySelector('#ws-page-main').scrollTo({ top: 0 }); // scroll to top of page
56
+ });
65
57
  }
66
58
  }
67
59
  };
@@ -36,55 +36,59 @@ export const SectionGalleryLayout = ({
36
36
  isDemo,
37
37
  title,
38
38
  galleryItemsData,
39
- }) => (
40
- <GalleryItem span={4} key={idx}>
41
- <Card id={id} key={idx} isClickable>
42
- <CardHeader
43
- selectableActions={{
44
- onClickAction: (e) => {
45
- e.preventDefault();
46
- document.getElementById('ws-page-main').scrollIntoView();
47
- navigate(slug);
48
- },
49
- selectableActionId: `${id}-input`,
50
- selectableActionAriaLabelledby: id,
51
- name: `clickable-card-${idx}`,
52
- }}
53
- >
54
- <CardTitle>{title}</CardTitle>
55
- </CardHeader>
56
- {(hasGridImages || hasGridText) && (
57
- <CardBody>
58
- {hasGridImages && illustration && (
59
- <img src={illustration} alt={`${itemName} illustration`} />
60
- )}
61
- {hasGridText && (
62
- <TextSummary id={id} itemsData={galleryItemsData} />
63
- )}
64
- </CardBody>
65
- )}
66
- {(isBeta || isDeprecated || isDemo) && (
67
- <CardFooter>
68
- {isBeta && (
69
- <Label color="blue" isCompact>
70
- Beta
71
- </Label>
72
- )}
73
- {!isBeta && isDeprecated && (
74
- <Label color="grey" isCompact>
75
- Deprecated
76
- </Label>
77
- )}
78
- {!isBeta && !isDeprecated && isDemo && (
79
- <Label color="purple" isCompact>
80
- Demo
81
- </Label>
82
- )}
83
- </CardFooter>
84
- )}
85
- </Card>
86
- </GalleryItem>
87
- )
39
+ }) => {
40
+ const stripped_id = id.replace(/\s+/g, '-');
41
+
42
+ return (
43
+ <GalleryItem span={4} key={idx}>
44
+ <Card id={stripped_id} key={idx} isClickable>
45
+ <CardHeader
46
+ selectableActions={{
47
+ onClickAction: (e) => {
48
+ e.preventDefault();
49
+ document.getElementById('ws-page-main').scrollIntoView();
50
+ navigate(slug);
51
+ },
52
+ selectableActionId: `${stripped_id}-input`,
53
+ selectableActionAriaLabelledby: stripped_id,
54
+ name: `clickable-card-${idx}`,
55
+ }}
56
+ >
57
+ <CardTitle>{title}</CardTitle>
58
+ </CardHeader>
59
+ {(hasGridImages || hasGridText) && (
60
+ <CardBody>
61
+ {hasGridImages && illustration && (
62
+ <img src={illustration} alt={`${itemName} illustration`} />
63
+ )}
64
+ {hasGridText && (
65
+ <TextSummary id={id} itemsData={galleryItemsData} />
66
+ )}
67
+ </CardBody>
68
+ )}
69
+ {(isBeta || isDeprecated || isDemo) && (
70
+ <CardFooter>
71
+ {isBeta && (
72
+ <Label color="blue" isCompact>
73
+ Beta
74
+ </Label>
75
+ )}
76
+ {!isBeta && isDeprecated && (
77
+ <Label color="grey" isCompact>
78
+ Deprecated
79
+ </Label>
80
+ )}
81
+ {!isBeta && !isDeprecated && isDemo && (
82
+ <Label color="purple" isCompact>
83
+ Demo
84
+ </Label>
85
+ )}
86
+ </CardFooter>
87
+ )}
88
+ </Card>
89
+ </GalleryItem>
90
+ )
91
+ }
88
92
  )}
89
93
  </Gallery>
90
94
  );
@@ -1,9 +1,5 @@
1
1
  import React from 'react';
2
- import {
3
- JumpLinks,
4
- JumpLinksItem,
5
- JumpLinksList,
6
- } from '@patternfly/react-core';
2
+ import { JumpLinks, JumpLinksItem, JumpLinksList } from '@patternfly/react-core';
7
3
  import { trackEvent } from '../../helpers';
8
4
 
9
5
  export const TableOfContents = ({ items }) => {
@@ -14,9 +10,7 @@ export const TableOfContents = ({ items }) => {
14
10
 
15
11
  React.useEffect(() => {
16
12
  if (document.getElementById('ws-sticky-nav-tabs')) {
17
- setStickyNavHeight(
18
- document.getElementById('ws-sticky-nav-tabs').offsetHeight
19
- );
13
+ setStickyNavHeight(document.getElementById('ws-sticky-nav-tabs').offsetHeight);
20
14
  }
21
15
  }, []);
22
16
 
@@ -40,13 +34,7 @@ export const TableOfContents = ({ items }) => {
40
34
  className="ws-toc-item"
41
35
  onKeyDown={updateWidth}
42
36
  onMouseDown={updateWidth}
43
- onClick={() =>
44
- trackEvent(
45
- 'jump_link_click',
46
- 'click_event',
47
- curItem.id.toUpperCase()
48
- )
49
- }
37
+ onClick={() => trackEvent('jump_link_click', 'click_event', curItem.id.toUpperCase())}
50
38
  >
51
39
  {curItem.text}
52
40
  </JumpLinksItem>
@@ -74,13 +62,7 @@ export const TableOfContents = ({ items }) => {
74
62
  className="ws-toc-item"
75
63
  onKeyDown={updateWidth}
76
64
  onMouseDown={updateWidth}
77
- onClick={() =>
78
- trackEvent(
79
- 'jump_link_click',
80
- 'click_event',
81
- curItem.id.toUpperCase()
82
- )
83
- }
65
+ onClick={() => trackEvent('jump_link_click', 'click_event', curItem.id.toUpperCase())}
84
66
  >
85
67
  {curItem.text}
86
68
  </JumpLinksItem>
@@ -95,17 +77,9 @@ export const TableOfContents = ({ items }) => {
95
77
  className="ws-toc-item"
96
78
  onKeyDown={updateWidth}
97
79
  onMouseDown={updateWidth}
98
- onClick={() =>
99
- trackEvent(
100
- 'jump_link_click',
101
- 'click_event',
102
- item.id.toUpperCase()
103
- )
104
- }
80
+ onClick={() => trackEvent('jump_link_click', 'click_event', item.id.toUpperCase())}
105
81
  >
106
- {Array.isArray(nextItem)
107
- ? renderSublist(item, nextItem)
108
- : item.text}
82
+ {Array.isArray(nextItem) ? renderSublist(item, nextItem) : item.text}
109
83
  </JumpLinksItem>
110
84
  );
111
85
  }
@@ -117,7 +91,7 @@ export const TableOfContents = ({ items }) => {
117
91
  <JumpLinks
118
92
  label="Table of contents"
119
93
  isVertical
120
- scrollableSelector=".pf-v6-c-page__main-container"
94
+ scrollableSelector="#ws-page-main"
121
95
  className="ws-toc"
122
96
  style={{ top: stickyNavHeight }}
123
97
  offset={width > 1450 ? 108 + stickyNavHeight : 148 + stickyNavHeight}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@patternfly/documentation-framework",
3
3
  "description": "A framework to build documentation for PatternFly.",
4
- "version": "6.0.6",
4
+ "version": "6.0.8",
5
5
  "author": "Red Hat",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -13,7 +13,7 @@
13
13
  "@babel/preset-env": "^7.24.3",
14
14
  "@babel/preset-react": "^7.24.1",
15
15
  "@mdx-js/util": "1.6.16",
16
- "@patternfly/ast-helpers": "^1.4.0-alpha.122",
16
+ "@patternfly/ast-helpers": "^1.4.0-alpha.124",
17
17
  "@reach/router": "npm:@gatsbyjs/reach-router@1.3.9",
18
18
  "autoprefixer": "9.8.6",
19
19
  "babel-loader": "^9.1.3",
@@ -80,5 +80,5 @@
80
80
  "react": "^17.0.0 || ^18.0.0",
81
81
  "react-dom": "^17.0.0 || ^18.0.0"
82
82
  },
83
- "gitHead": "9024016069cef4b2b0608c32a000e1c2075af743"
83
+ "gitHead": "e60563a8fda326e55807114e0a0ffd2245687fc4"
84
84
  }
@@ -107,7 +107,7 @@ const Page404 = () => {
107
107
  body="Visualize your facts and figures by designing the right charts for your data."
108
108
  link={{
109
109
  text: 'View charts',
110
- to: '/charts/about',
110
+ to: '/charts/about-charts',
111
111
  }}
112
112
  />
113
113
  </Grid>