@patternfly/documentation-framework 1.0.1 → 1.0.2
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 +46 -0
- package/components/example/example.css +2 -1
- package/components/propsTable/propsTable.js +49 -40
- package/layouts/sideNavLayout/sideNavLayout.js +11 -3
- package/package.json +2 -6
- package/scripts/tsDocgen.js +23 -0
- package/scripts/webpack/webpack.base.config.js +2 -0
- package/templates/mdx.js +1 -0
- package/versions.json +20 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,52 @@
|
|
|
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
|
+
# 0.12.0 (2022-07-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **docs:** add dark theme switcher ([#3014](https://github.com/patternfly/patternfly-org/issues/3014)) ([7d17d13](https://github.com/patternfly/patternfly-org/commit/7d17d13c5518d85123d12bd37c254123789b1d75))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## 0.11.79 (2022-07-01)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package theme-patternfly-org
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## 0.11.78 (2022-07-01)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package theme-patternfly-org
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## 0.11.77 (2022-06-30)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* **docs:** narrowed scope of rule hiding overflow on page examples ([#3037](https://github.com/patternfly/patternfly-org/issues/3037)) ([3c0db2e](https://github.com/patternfly/patternfly-org/commit/3c0db2eff5f933c76a4be02ceaa1c1c2f5212b33))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## 0.11.76 (2022-06-30)
|
|
45
|
+
|
|
46
|
+
**Note:** Version bump only for package theme-patternfly-org
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
6
52
|
## 0.11.75 (2022-06-29)
|
|
7
53
|
|
|
8
54
|
**Note:** Version bump only for package theme-patternfly-org
|
|
@@ -1,82 +1,91 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { Badge } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Badge } from "@patternfly/react-core";
|
|
3
3
|
import {
|
|
4
4
|
Table,
|
|
5
5
|
TableHeader,
|
|
6
6
|
TableBody,
|
|
7
|
-
cellWidth
|
|
8
|
-
} from
|
|
9
|
-
import { AutoLinkHeader } from
|
|
10
|
-
import { PropTypeWithLinks } from
|
|
11
|
-
import { css } from
|
|
12
|
-
import accessibleStyles from
|
|
7
|
+
cellWidth,
|
|
8
|
+
} from "@patternfly/react-table";
|
|
9
|
+
import { AutoLinkHeader } from "../autoLinkHeader/autoLinkHeader";
|
|
10
|
+
import { PropTypeWithLinks } from "./propTypeWithLinks";
|
|
11
|
+
import { css } from "@patternfly/react-styles";
|
|
12
|
+
import accessibleStyles from "@patternfly/react-styles/css/utilities/Accessibility/accessibility";
|
|
13
13
|
|
|
14
|
-
export const PropsTable = ({
|
|
15
|
-
title,
|
|
16
|
-
rows,
|
|
17
|
-
allPropComponents
|
|
18
|
-
}) => {
|
|
14
|
+
export const PropsTable = ({ title, description, rows, allPropComponents }) => {
|
|
19
15
|
const columns = [
|
|
20
|
-
{ title:
|
|
21
|
-
{ title:
|
|
22
|
-
{ title:
|
|
23
|
-
{ title:
|
|
16
|
+
{ title: "Name", transforms: [cellWidth(20)] },
|
|
17
|
+
{ title: "Type", transforms: [cellWidth(20)] },
|
|
18
|
+
{ title: "Default", transforms: [] },
|
|
19
|
+
{ title: "Description", transforms: [] },
|
|
24
20
|
];
|
|
25
21
|
|
|
26
22
|
return (
|
|
27
23
|
<React.Fragment>
|
|
28
|
-
<AutoLinkHeader size="h3">
|
|
29
|
-
{title}
|
|
30
|
-
</AutoLinkHeader>
|
|
24
|
+
<AutoLinkHeader size="h3">{title}</AutoLinkHeader>
|
|
31
25
|
<Table
|
|
32
26
|
className="pf-u-mt-md pf-u-mb-lg"
|
|
33
27
|
variant="compact"
|
|
34
28
|
aria-label={title}
|
|
35
|
-
caption={
|
|
29
|
+
caption={
|
|
30
|
+
<div>
|
|
31
|
+
{description && <div className="pf-u-mb-md">{description}</div>}
|
|
32
|
+
<div>
|
|
33
|
+
<span className="ws-prop-required">*</span>required
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
}
|
|
36
37
|
cells={columns}
|
|
37
38
|
gridBreakPoint="grid-lg"
|
|
38
39
|
rows={rows
|
|
39
40
|
// Sort required rows first
|
|
40
|
-
.sort((a,b) => a.required === b.required
|
|
41
|
-
? 0
|
|
42
|
-
: a.required ? -1 : 1)
|
|
41
|
+
.sort((a, b) => (a.required === b.required ? 0 : a.required ? -1 : 1))
|
|
43
42
|
.map((row, idx) => ({
|
|
44
43
|
cells: [
|
|
45
44
|
<div className="pf-m-break-word">
|
|
46
|
-
{row.deprecated &&
|
|
45
|
+
{row.deprecated && "Deprecated: "}
|
|
47
46
|
{row.name}
|
|
48
47
|
{row.required ? (
|
|
49
48
|
<React.Fragment key={`${row.name}-required-prop`}>
|
|
50
|
-
<span
|
|
49
|
+
<span
|
|
50
|
+
aria-hidden="true"
|
|
51
|
+
key={`${row.name}-asterisk`}
|
|
52
|
+
className="ws-prop-required"
|
|
53
|
+
>
|
|
51
54
|
*
|
|
52
55
|
</span>
|
|
53
|
-
<span
|
|
56
|
+
<span
|
|
57
|
+
key={`${row.name}-required`}
|
|
58
|
+
className={css(accessibleStyles.screenReader)}
|
|
59
|
+
>
|
|
54
60
|
required
|
|
55
61
|
</span>
|
|
56
62
|
</React.Fragment>
|
|
57
|
-
) :
|
|
63
|
+
) : (
|
|
64
|
+
""
|
|
65
|
+
)}
|
|
58
66
|
{row.beta && (
|
|
59
|
-
<Badge
|
|
67
|
+
<Badge
|
|
68
|
+
key={`${row.name}-${idx}`}
|
|
69
|
+
className="ws-beta-badge pf-u-ml-sm"
|
|
70
|
+
>
|
|
60
71
|
Beta
|
|
61
72
|
</Badge>
|
|
62
73
|
)}
|
|
63
74
|
</div>,
|
|
64
75
|
<div className="pf-m-break-word">
|
|
65
|
-
<PropTypeWithLinks
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
<PropTypeWithLinks
|
|
77
|
+
type={row.type}
|
|
78
|
+
allPropComponents={allPropComponents}
|
|
79
|
+
/>
|
|
69
80
|
</div>,
|
|
70
|
-
<div className="pf-m-break-word">
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}))
|
|
75
|
-
}
|
|
81
|
+
<div className="pf-m-break-word">{row.defaultValue}</div>,
|
|
82
|
+
<div className="pf-m-break-word">{row.description}</div>,
|
|
83
|
+
],
|
|
84
|
+
}))}
|
|
76
85
|
>
|
|
77
86
|
<TableHeader />
|
|
78
87
|
<TableBody />
|
|
79
88
|
</Table>
|
|
80
89
|
</React.Fragment>
|
|
81
90
|
);
|
|
82
|
-
}
|
|
91
|
+
};
|
|
@@ -13,9 +13,8 @@ import {
|
|
|
13
13
|
DropdownItem,
|
|
14
14
|
DropdownGroup,
|
|
15
15
|
Divider,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
SkipToContent
|
|
16
|
+
SkipToContent,
|
|
17
|
+
Switch
|
|
19
18
|
} from '@patternfly/react-core';
|
|
20
19
|
import SearchIcon from '@patternfly/react-icons/dist/esm/icons/search-icon';
|
|
21
20
|
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-alt-icon';
|
|
@@ -29,6 +28,7 @@ const HeaderTools = ({
|
|
|
29
28
|
versions,
|
|
30
29
|
hasVersionSwitcher,
|
|
31
30
|
hasSearch,
|
|
31
|
+
hasDarkThemeSwitcher,
|
|
32
32
|
pathPrefix
|
|
33
33
|
}) => {
|
|
34
34
|
const initialVersion = staticVersions.Releases.find(release => release.latest);
|
|
@@ -69,6 +69,12 @@ const HeaderTools = ({
|
|
|
69
69
|
|
|
70
70
|
return (
|
|
71
71
|
<PageHeaderTools>
|
|
72
|
+
{hasDarkThemeSwitcher && (
|
|
73
|
+
<PageHeaderToolsItem>
|
|
74
|
+
<Switch id="ws-theme-switch" label="Dark theme" defaultChecked={false} onChange={() =>
|
|
75
|
+
document.querySelector('html').classList.toggle('pf-theme-dark')} />
|
|
76
|
+
</PageHeaderToolsItem>
|
|
77
|
+
)}
|
|
72
78
|
{hasSearch && (
|
|
73
79
|
<PageHeaderToolsItem id="ws-global-search-wrapper" className={isSearchExpanded ? '' : 'ws-hide-search-input'}>
|
|
74
80
|
<TextInput id="ws-global-search" ref={searchRef} placeholder="Search" />
|
|
@@ -170,6 +176,7 @@ export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp })
|
|
|
170
176
|
const algolia = process.env.algolia;
|
|
171
177
|
const hasGdprBanner = process.env.hasGdprBanner;
|
|
172
178
|
const hasVersionSwitcher = process.env.hasVersionSwitcher;
|
|
179
|
+
const hasDarkThemeSwitcher = process.env.hasDarkThemeSwitcher;
|
|
173
180
|
const sideNavItems = process.env.sideNavItems;
|
|
174
181
|
const topNavItems = process.env.topNavItems;
|
|
175
182
|
const prnum = process.env.prnum;
|
|
@@ -208,6 +215,7 @@ export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp })
|
|
|
208
215
|
versions={versions}
|
|
209
216
|
hasSearch={algolia}
|
|
210
217
|
hasVersionSwitcher={hasVersionSwitcher}
|
|
218
|
+
hasDarkThemeSwitcher={hasDarkThemeSwitcher}
|
|
211
219
|
pathPrefix={pathPrefix} />}
|
|
212
220
|
logo={prnum ? `PR #${prnum}` : <Brand src={logo} alt="Patternfly Logo" />}
|
|
213
221
|
logoProps={{ href: prurl || pathPrefix || '/' }}
|
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": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"author": "Red Hat",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
@@ -82,10 +82,6 @@
|
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"react": "^16.8.0 || ^17.0.0",
|
|
85
|
-
"react-dom": "^16.8.0 || ^17.0.0"
|
|
86
|
-
"@patternfly/patternfly": ">=4.185.1",
|
|
87
|
-
"@patternfly/react-core": ">=4.202.16",
|
|
88
|
-
"@patternfly/react-code-editor": ">=4.43.16",
|
|
89
|
-
"@patternfly/react-table": ">=4.71.16"
|
|
85
|
+
"react-dom": "^16.8.0 || ^17.0.0"
|
|
90
86
|
}
|
|
91
87
|
}
|
package/scripts/tsDocgen.js
CHANGED
|
@@ -95,6 +95,9 @@ function getInterfaceMetadata(filename, sourceText) {
|
|
|
95
95
|
|
|
96
96
|
interfaces.push({
|
|
97
97
|
displayName: statement.name.escapedText,
|
|
98
|
+
description: statement.jsDoc
|
|
99
|
+
? statement.jsDoc.map(doc => doc.comment).join('\n')
|
|
100
|
+
: null,
|
|
98
101
|
props
|
|
99
102
|
});
|
|
100
103
|
});
|
|
@@ -131,10 +134,30 @@ function normalizeProp([
|
|
|
131
134
|
return res;
|
|
132
135
|
}
|
|
133
136
|
|
|
137
|
+
function getDescription(parsed, ) {
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
134
141
|
function tsDocgen(file) {
|
|
135
142
|
const sourceText = fs.readFileSync(file, 'utf8');
|
|
136
143
|
const componentMeta = getComponentMetadata(file, sourceText); // Array of components with props
|
|
137
144
|
const interfaceMeta = getInterfaceMetadata(file, sourceText); // Array of interfaces with props
|
|
145
|
+
const interfaceMetaMap = interfaceMeta.reduce(function(target, interface) {
|
|
146
|
+
target[interface.displayName] = interface;
|
|
147
|
+
return target;
|
|
148
|
+
}, {})
|
|
149
|
+
|
|
150
|
+
// Go through each component and check if they have an interface with a jsDoc description
|
|
151
|
+
// If so copy it over (fix for https://github.com/patternfly/patternfly-react/issues/7612)
|
|
152
|
+
componentMeta.forEach(c => {
|
|
153
|
+
if (c.description) {
|
|
154
|
+
return c;
|
|
155
|
+
}
|
|
156
|
+
const interface = `${c.displayName}Props`;
|
|
157
|
+
if (interfaceMetaMap[interface] && interfaceMetaMap[interface].description) {
|
|
158
|
+
c.description = interfaceMetaMap[interface].description;
|
|
159
|
+
}
|
|
160
|
+
})
|
|
138
161
|
|
|
139
162
|
return componentMeta
|
|
140
163
|
.concat(interfaceMeta)
|
|
@@ -13,6 +13,7 @@ module.exports = (_env, argv) => {
|
|
|
13
13
|
hasFooter = false,
|
|
14
14
|
hasVersionSwitcher = false,
|
|
15
15
|
hasDesignGuidelines = false,
|
|
16
|
+
hasDarkThemeSwitcher = false,
|
|
16
17
|
sideNavItems = [],
|
|
17
18
|
topNavItems = [],
|
|
18
19
|
includePaths = []
|
|
@@ -136,6 +137,7 @@ module.exports = (_env, argv) => {
|
|
|
136
137
|
'process.env.hasFooter': JSON.stringify(hasFooter),
|
|
137
138
|
'process.env.hasVersionSwitcher': JSON.stringify(hasVersionSwitcher),
|
|
138
139
|
'process.env.hasDesignGuidelines': JSON.stringify(hasDesignGuidelines),
|
|
140
|
+
'process.env.hasDarkThemeSwitcher': JSON.stringify(hasDarkThemeSwitcher),
|
|
139
141
|
'process.env.sideNavItems': JSON.stringify(sideNavItems),
|
|
140
142
|
'process.env.topNavItems': JSON.stringify(topNavItems),
|
|
141
143
|
'process.env.prnum': JSON.stringify(process.env.CIRCLE_PR_NUMBER || process.env.PR_NUMBER || ''),
|
package/templates/mdx.js
CHANGED
package/versions.json
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Releases": [
|
|
3
|
+
{
|
|
4
|
+
"name": "2022.08",
|
|
5
|
+
"date": "2022-6-30",
|
|
6
|
+
"latest": true,
|
|
7
|
+
"versions": {
|
|
8
|
+
"@patternfly/patternfly": "4.202.1",
|
|
9
|
+
"@patternfly/react-catalog-view-extension": "4.75.1",
|
|
10
|
+
"@patternfly/react-charts": "6.77.1",
|
|
11
|
+
"@patternfly/react-code-editor": "4.65.1",
|
|
12
|
+
"@patternfly/react-core": "4.224.1",
|
|
13
|
+
"@patternfly/react-icons": "4.75.1",
|
|
14
|
+
"@patternfly/react-inline-edit-extension": "4.69.1",
|
|
15
|
+
"@patternfly/react-log-viewer": "4.69.1",
|
|
16
|
+
"@patternfly/react-styles": "4.74.1",
|
|
17
|
+
"@patternfly/react-table": "4.93.1",
|
|
18
|
+
"@patternfly/react-tokens": "4.76.1",
|
|
19
|
+
"@patternfly/react-topology": "4.71.1",
|
|
20
|
+
"@patternfly/react-virtualized-extension": "4.71.1"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
3
23
|
{
|
|
4
24
|
"name": "2022.07",
|
|
5
25
|
"date": "2022-6-3",
|
|
6
|
-
"latest": true,
|
|
7
26
|
"versions": {
|
|
8
27
|
"@patternfly/patternfly": "4.196.7",
|
|
9
28
|
"@patternfly/react-catalog-view-extension": "4.72.3",
|