@patternfly/documentation-framework 6.0.0-alpha.46 → 6.0.0-alpha.47

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
+ # 6.0.0-alpha.47 (2024-06-17)
7
+
8
+
9
+ ### Features
10
+
11
+ * **docs-framework:** Update AutoLinkHeader to use the Text component ([#4049](https://github.com/patternfly/patternfly-org/issues/4049)) ([3a9c9a0](https://github.com/patternfly/patternfly-org/commit/3a9c9a08ff373def8b751b947e70580dcbc9e6da))
12
+
13
+
14
+
15
+
16
+
6
17
  # 6.0.0-alpha.46 (2024-06-17)
7
18
 
8
19
 
@@ -3,7 +3,7 @@
3
3
  }
4
4
 
5
5
  .ws-heading-anchor {
6
- /* color: var(--pf-v6-global--Color--100); */
6
+ color: var(--pf-t--global--icon--color--regular);
7
7
  transform: translate(calc(-100% - var(--pf-t--global--spacer--xs)), -50%);
8
8
  opacity: 0;
9
9
  position: absolute;
@@ -1,23 +1,12 @@
1
1
  import React from 'react';
2
- import { Title, Flex, FlexItem, Text } from '@patternfly/react-core';
2
+ import { Flex, FlexItem, Text } from '@patternfly/react-core';
3
3
  import LinkIcon from '@patternfly/react-icons/dist/esm/icons/link-icon';
4
4
  import { Link } from '../link/link';
5
5
  import { slugger } from '../../helpers/slugger';
6
6
  import { css } from '@patternfly/react-styles';
7
7
 
8
- // "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl"
9
- const sizes = {
10
- h1: '3xl',
11
- h2: '2xl',
12
- h3: 'xl',
13
- h4: 'lg',
14
- h5: 'md',
15
- h6: 'sm'
16
- }
17
-
18
8
  export const AutoLinkHeader = ({
19
9
  id,
20
- size,
21
10
  headingLevel,
22
11
  children,
23
12
  metaText,
@@ -28,10 +17,9 @@ export const AutoLinkHeader = ({
28
17
  return (
29
18
  <Flex alignItems={{ default: 'alignItemsCenter'}} spaceItems={{ default: "spaceItemsSm" }}>
30
19
  <FlexItem>
31
- <Title
20
+ <Text
32
21
  id={slug}
33
- size={sizes[size]}
34
- headingLevel={headingLevel || size}
22
+ component={headingLevel}
35
23
  className={css('ws-heading', className)}
36
24
  tabIndex={-1}
37
25
  >
@@ -39,9 +27,9 @@ export const AutoLinkHeader = ({
39
27
  <LinkIcon className="ws-heading-anchor-icon" style={{ verticalAlign: 'middle' }} />
40
28
  </Link>
41
29
  {children}
42
- </Title>
30
+ </Text>
43
31
  </FlexItem>
44
- <FlexItem>{metaText}</FlexItem>
32
+ {metaText && <FlexItem>{metaText}</FlexItem>}
45
33
  </Flex>
46
34
  )
47
35
  };
@@ -170,7 +170,7 @@ export class CSSVariables extends React.Component {
170
170
  render() {
171
171
  return (
172
172
  <React.Fragment>
173
- {this.props.autoLinkHeader && <AutoLinkHeader size="h3" className="pf-v6-u-mt-lg pf-v6-u-mb-md">{`Prefixed with '${this.props.prefix}'`}</AutoLinkHeader>}
173
+ {this.props.autoLinkHeader && <AutoLinkHeader headingLevel="h3" className="pf-v6-u-mt-lg pf-v6-u-mb-md">{`Prefixed with '${this.props.prefix}'`}</AutoLinkHeader>}
174
174
  <CSSSearch getDebouncedFilteredRows={this.getDebouncedFilteredRows} />
175
175
  <Table
176
176
  variant="compact"
@@ -249,42 +249,43 @@ export const Example = ({
249
249
  '/' +
250
250
  slugger(title);
251
251
 
252
+ const hasMetaText = isBeta || isDemo || isDeprecated || false;
253
+ const tooltips = (<React.Fragment>
254
+ {isBeta && (
255
+ <Tooltip content="This beta component is currently under review and is still open for further evolution.">
256
+ <Button variant="plain" hasNoPadding>
257
+ <Label isCompact color="blue">
258
+ Beta
259
+ </Label>
260
+ </Button>
261
+ </Tooltip>
262
+ )}
263
+ {isDemo && (
264
+ <Tooltip content="Demos show how multiple components can be used in a single design.">
265
+ <Button variant="plain" hasNoPadding>
266
+ <Label isCompact color="purple">
267
+ Demo
268
+ </Label>
269
+ </Button>
270
+ </Tooltip>
271
+ )}
272
+ {isDeprecated && (
273
+ <Tooltip content="Deprecated components are available for use but are no longer being maintained or enhanced.">
274
+ <Button variant="plain" hasNoPadding>
275
+ <Label isCompact color="grey">
276
+ Deprecated
277
+ </Label>
278
+ </Button>
279
+ </Tooltip>
280
+ )}
281
+ </React.Fragment>);
282
+ const metaText = hasMetaText && tooltips
283
+
252
284
  return (
253
285
  <div className="ws-example">
254
286
  <div className="ws-example-header">
255
287
  <AutoLinkHeader
256
- metaText={
257
- <React.Fragment>
258
- {isBeta && (
259
- <Tooltip content="This beta component is currently under review and is still open for further evolution.">
260
- <Button variant="plain" hasNoPadding>
261
- <Label isCompact color="blue">
262
- Beta
263
- </Label>
264
- </Button>
265
- </Tooltip>
266
- )}
267
- {isDemo && (
268
- <Tooltip content="Demos show how multiple components can be used in a single design.">
269
- <Button variant="plain" hasNoPadding>
270
- <Label isCompact color="purple">
271
- Demo
272
- </Label>
273
- </Button>
274
- </Tooltip>
275
- )}
276
- {isDeprecated && (
277
- <Tooltip content="Deprecated components are available for use but are no longer being maintained or enhanced.">
278
- <Button variant="plain" hasNoPadding>
279
- <Label isCompact color="grey">
280
- Deprecated
281
- </Label>
282
- </Button>
283
- </Tooltip>
284
- )}
285
- </React.Fragment>
286
- }
287
- size="h4"
288
+ metaText={metaText}
288
289
  headingLevel="h3"
289
290
  className="ws-example-heading"
290
291
  >
@@ -17,7 +17,7 @@ import accessibleStyles from "@patternfly/react-styles/css/utilities/Accessibili
17
17
 
18
18
  export const PropsTable = ({ title, description, rows, allPropComponents }) => (
19
19
  <React.Fragment>
20
- <AutoLinkHeader size="h3">{title}</AutoLinkHeader>
20
+ <AutoLinkHeader headingLevel="h3">{title}</AutoLinkHeader>
21
21
  <Table className="pf-v6-u-mt-md pf-v6-u-mb-lg" variant="compact" aria-label={title} gridBreakPoint="grid-lg">
22
22
  <Caption>
23
23
  {description && <div className="pf-v6-u-mb-md">{description}</div>}
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.0-alpha.46",
4
+ "version": "6.0.0-alpha.47",
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.35",
16
+ "@patternfly/ast-helpers": "^1.4.0-alpha.36",
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": "726a937b50610088bdbce0177f22651e35803f15"
83
+ "gitHead": "dc491607328d5182bf4c16432b416ed415c9a74f"
84
84
  }
@@ -42,7 +42,7 @@ function anchorHeader(tocCallback) {
42
42
  // Add to TOC for indexing
43
43
  addTOCItem(tocItem, node.tagName);
44
44
 
45
- node.properties.size = node.tagName;
45
+ node.properties.headingLevel = node.tagName;
46
46
  node.properties.className = node.properties.className || '';
47
47
  node.properties.className += node.properties.className ? ' ' : '';
48
48
  node.properties.className += `ws-title ws-${node.tagName}`;
package/templates/mdx.js CHANGED
@@ -104,7 +104,7 @@ const MDXChildTemplate = ({
104
104
  <Component />
105
105
  {functionDocumentation.length > 0 && (
106
106
  <React.Fragment>
107
- <AutoLinkHeader size="h2" className="pf-v6-c-content--h2" id="functions">
107
+ <AutoLinkHeader headingLevel="h2" className="pf-v6-c-content--h2" id="functions">
108
108
  Functions
109
109
  </AutoLinkHeader>
110
110
  <FunctionsTable functionDescriptions={functionDocumentation}/>
@@ -112,7 +112,7 @@ const MDXChildTemplate = ({
112
112
  )}
113
113
  {propsTitle && (
114
114
  <React.Fragment>
115
- <AutoLinkHeader size="h2" className="pf-v6-c-content--h2" id="props">
115
+ <AutoLinkHeader headingLevel="h2" className="pf-v6-c-content--h2" id="props">
116
116
  {propsTitle}
117
117
  </AutoLinkHeader>
118
118
  {propComponents.map(component => (
@@ -128,7 +128,7 @@ const MDXChildTemplate = ({
128
128
  )}
129
129
  {cssPrefix.length > 0 && (
130
130
  <React.Fragment>
131
- <AutoLinkHeader size="h2" className="pf-v6-c-content--h2" id="css-variables">
131
+ <AutoLinkHeader headingLevel="h2" className="pf-v6-c-content--h2" id="css-variables">
132
132
  {cssVarsTitle}
133
133
  </AutoLinkHeader>
134
134
  {cssPrefix.map((prefix, index) => (