@patternfly/documentation-framework 2.0.0-alpha.14 → 2.0.0-alpha.16
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 +19 -0
- package/app.js +1 -1
- package/components/cssVariables/cssSearch.js +3 -4
- package/components/cssVariables/cssVariables.js +72 -70
- package/components/propsTable/propsTable.js +90 -84
- package/components/sideNav/sideNav.js +10 -3
- package/layouts/sideNavLayout/sideNavLayout.css +0 -4
- package/layouts/sideNavLayout/sideNavLayout.js +39 -35
- package/package.json +5 -5
- package/routes.js +19 -4
- package/scripts/md/parseMD.js +11 -1
- package/scripts/webpack/webpack.base.config.js +5 -0
- package/templates/mdx.js +10 -2
- package/templates/patternfly-docs/content/extensions/extension/design-guidelines/design-guidelines.md +2 -0
- package/templates/patternfly-docs/content/extensions/extension/examples/basic.md +2 -0
- package/versions.json +28 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
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
|
+
# 2.0.0-alpha.16 (2023-04-11)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **tables:** update tables, context selector ([#3474](https://github.com/patternfly/patternfly-org/issues/3474)) ([cd82c35](https://github.com/patternfly/patternfly-org/commit/cd82c356f568f3368bc22319d614fde8dd74fb38))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# 2.0.0-alpha.15 (2023-04-06)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# 2.0.0-alpha.14 (2023-04-03)
|
|
7
26
|
|
|
8
27
|
|
package/app.js
CHANGED
|
@@ -19,7 +19,7 @@ import './layouts/sideNavLayout/sideNavLayout.css';
|
|
|
19
19
|
const AppRoute = ({ child, katacodaLayout, title, path }) => {
|
|
20
20
|
const pathname = useLocation().pathname;
|
|
21
21
|
if (typeof window !== 'undefined' && window.gtag) {
|
|
22
|
-
gtag('config',
|
|
22
|
+
gtag('config', process.env.googleAnalyticsID, {
|
|
23
23
|
'page_path': pathname,
|
|
24
24
|
'page_title': (title || pathname)
|
|
25
25
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { SearchInput } from "@patternfly/react-core";
|
|
3
3
|
|
|
4
4
|
export class CSSSearch extends React.Component {
|
|
5
5
|
constructor(props) {
|
|
@@ -9,7 +9,7 @@ export class CSSSearch extends React.Component {
|
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
onFilterChange = (
|
|
12
|
+
onFilterChange = (event) => {
|
|
13
13
|
this.setState(
|
|
14
14
|
{
|
|
15
15
|
filterValue: event.target.value
|
|
@@ -20,8 +20,7 @@ export class CSSSearch extends React.Component {
|
|
|
20
20
|
|
|
21
21
|
render() {
|
|
22
22
|
return (
|
|
23
|
-
<
|
|
24
|
-
type="text"
|
|
23
|
+
<SearchInput
|
|
25
24
|
aria-label="Filter CSS Variables"
|
|
26
25
|
placeholder="Filter CSS Variables"
|
|
27
26
|
value={this.state.filterValue}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { debounce } from "@patternfly/react-core";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
Table,
|
|
5
|
+
Thead,
|
|
6
|
+
Th,
|
|
7
|
+
Tr,
|
|
8
|
+
Tbody,
|
|
9
|
+
Td
|
|
10
10
|
} from "@patternfly/react-table";
|
|
11
11
|
import * as tokensModule from "@patternfly/react-tokens/dist/esm/componentIndex";
|
|
12
12
|
import global_spacer_md from "@patternfly/react-tokens/dist/esm/global_spacer_md";
|
|
@@ -77,23 +77,10 @@ export class CSSVariables extends React.Component {
|
|
|
77
77
|
|
|
78
78
|
this.flatList = flattenList(applicableFiles);
|
|
79
79
|
|
|
80
|
-
this.columns = [
|
|
81
|
-
...props.hideSelectorColumn ? [] : [{
|
|
82
|
-
title: "Selector",
|
|
83
|
-
transforms: [sortable],
|
|
84
|
-
cellFormatters: [expandable]
|
|
85
|
-
}],
|
|
86
|
-
{ title: "Variable", transforms: [sortable] },
|
|
87
|
-
{ title: "Value", transforms: [sortable] }
|
|
88
|
-
]
|
|
89
|
-
|
|
90
80
|
this.state = {
|
|
91
81
|
searchRE: '',
|
|
92
82
|
rows: this.getFilteredRows(),
|
|
93
|
-
|
|
94
|
-
index: 0,
|
|
95
|
-
direction: "asc" // a-z
|
|
96
|
-
}
|
|
83
|
+
allRowsExpanded: true
|
|
97
84
|
};
|
|
98
85
|
}
|
|
99
86
|
|
|
@@ -140,20 +127,16 @@ export class CSSVariables extends React.Component {
|
|
|
140
127
|
];
|
|
141
128
|
filteredRows.push({
|
|
142
129
|
isOpen: values ? false : undefined,
|
|
143
|
-
cells
|
|
130
|
+
cells,
|
|
131
|
+
details: values ? {
|
|
132
|
+
parent: rowNumber,
|
|
133
|
+
fullWidth: true,
|
|
134
|
+
data: mappingAsList(property, values)
|
|
135
|
+
} : undefined
|
|
144
136
|
});
|
|
145
137
|
rowNumber += 1;
|
|
146
138
|
if (values) {
|
|
147
|
-
|
|
148
|
-
parent: rowNumber,
|
|
149
|
-
fullWidth: true,
|
|
150
|
-
cells: [
|
|
151
|
-
{
|
|
152
|
-
title: mappingAsList(property, values)
|
|
153
|
-
}
|
|
154
|
-
]
|
|
155
|
-
});
|
|
156
|
-
rowNumber += 1;
|
|
139
|
+
rowNumber += 1
|
|
157
140
|
}
|
|
158
141
|
}
|
|
159
142
|
});
|
|
@@ -170,9 +153,10 @@ export class CSSVariables extends React.Component {
|
|
|
170
153
|
} else {
|
|
171
154
|
newRows[rowKey] = { ...newRows[rowKey], isOpen };
|
|
172
155
|
}
|
|
173
|
-
this.setState({
|
|
156
|
+
this.setState(prevState => ({
|
|
174
157
|
rows: newRows,
|
|
175
|
-
|
|
158
|
+
...(collapseAll && {allRowsExpanded: !prevState.allRowsExpanded})
|
|
159
|
+
}));
|
|
176
160
|
};
|
|
177
161
|
|
|
178
162
|
getDebouncedFilteredRows = debounce(value => {
|
|
@@ -183,50 +167,68 @@ export class CSSVariables extends React.Component {
|
|
|
183
167
|
});
|
|
184
168
|
}, 500);
|
|
185
169
|
|
|
186
|
-
onSort = (_event, index, direction) => {
|
|
187
|
-
this.flatList = this.flatList.sort((a, b) => {
|
|
188
|
-
const indexToColMap = {
|
|
189
|
-
'1': 'selector',
|
|
190
|
-
'2': 'property',
|
|
191
|
-
'3': 'value'
|
|
192
|
-
};
|
|
193
|
-
const column = indexToColMap[index];
|
|
194
|
-
if (direction === SortByDirection.asc) {
|
|
195
|
-
return a[column] < b[column] ? -1 : a[column] > b[column] ? 1 : 0;
|
|
196
|
-
} else {
|
|
197
|
-
return a[column] > b[column] ? -1 : a[column] < b[column] ? 1 : 0;
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
this.setState({
|
|
201
|
-
sortBy: {
|
|
202
|
-
index,
|
|
203
|
-
direction
|
|
204
|
-
},
|
|
205
|
-
rows: this.getFilteredRows(this.state.searchRE)
|
|
206
|
-
});
|
|
207
|
-
};
|
|
208
|
-
|
|
209
170
|
render() {
|
|
210
171
|
return (
|
|
211
172
|
<React.Fragment>
|
|
212
173
|
<CSSSearch getDebouncedFilteredRows={this.getDebouncedFilteredRows} />
|
|
213
|
-
|
|
174
|
+
<Table
|
|
214
175
|
variant="compact"
|
|
215
176
|
aria-label={`CSS Variables for prefixes ${this.prefix.join(" ")}`}
|
|
216
|
-
sortBy={this.state.sortBy}
|
|
217
|
-
onSort={this.onSort}
|
|
218
|
-
cells={this.columns}
|
|
219
|
-
rows={this.state.rows}
|
|
220
|
-
onCollapse={this.onCollapse}
|
|
221
|
-
canCollapseAll={true}
|
|
222
|
-
collapseAllAriaLabel="expand all css variables"
|
|
223
|
-
gridBreakPoint="grid-lg"
|
|
224
|
-
contentId="css-variables-content"
|
|
225
|
-
expandId="css-variables-toggle"
|
|
226
177
|
>
|
|
227
|
-
<
|
|
228
|
-
|
|
229
|
-
|
|
178
|
+
<Thead>
|
|
179
|
+
<Tr>
|
|
180
|
+
{!this.props.hideSelectorColumn && (
|
|
181
|
+
<React.Fragment>
|
|
182
|
+
<Th expand={{
|
|
183
|
+
areAllExpanded: this.state.allRowsExpanded,
|
|
184
|
+
collapseAllAriaLabel: "Expand or collapse all CSS variables",
|
|
185
|
+
onToggle: this.onCollapse
|
|
186
|
+
}}/>
|
|
187
|
+
<Th>Selector</Th>
|
|
188
|
+
</React.Fragment>
|
|
189
|
+
)}
|
|
190
|
+
<Th>Variable</Th>
|
|
191
|
+
<Th>Value</Th>
|
|
192
|
+
</Tr>
|
|
193
|
+
</Thead>
|
|
194
|
+
{!this.props.hideSelectorColumn ? (
|
|
195
|
+
this.state.rows.map((row, rowIndex) => (
|
|
196
|
+
<Tbody key={rowIndex} isExpanded={row.isOpen}>
|
|
197
|
+
<Tr>
|
|
198
|
+
<Td
|
|
199
|
+
expand={
|
|
200
|
+
row.details
|
|
201
|
+
? {
|
|
202
|
+
rowIndex,
|
|
203
|
+
isExpanded: row.isOpen,
|
|
204
|
+
onToggle: this.onCollapse,
|
|
205
|
+
expandId: 'composable-expandable-example'
|
|
206
|
+
}
|
|
207
|
+
: undefined
|
|
208
|
+
}
|
|
209
|
+
/>
|
|
210
|
+
<Td dataLabel="Selector">{row.cells[0]}</Td>
|
|
211
|
+
<Td dataLabel="Variable">{row.cells[1]}</Td>
|
|
212
|
+
<Td dataLabel="Value">{row.cells[2]}</Td>
|
|
213
|
+
</Tr>
|
|
214
|
+
{row.details ? (
|
|
215
|
+
<Tr isExpanded={row.isOpen}>
|
|
216
|
+
{!row.details.fullWidth ? <Td /> : null}
|
|
217
|
+
<Td dataLabel="Selector" colSpan={5}>{row.details.data}</Td>
|
|
218
|
+
</Tr>
|
|
219
|
+
) : null}
|
|
220
|
+
</Tbody>
|
|
221
|
+
))) : (
|
|
222
|
+
<Tbody>
|
|
223
|
+
{this.state.rows.map((row, rowIndex) => (
|
|
224
|
+
<Tr key={rowIndex}>
|
|
225
|
+
<Td dataLabel="Variable">{row.cells[0]}</Td>
|
|
226
|
+
<Td dataLabel="Value">{row.cells[1]}</Td>
|
|
227
|
+
</Tr>
|
|
228
|
+
))}
|
|
229
|
+
</Tbody>
|
|
230
|
+
)}
|
|
231
|
+
</Table>
|
|
230
232
|
</React.Fragment>
|
|
231
233
|
);
|
|
232
234
|
}
|
|
@@ -1,91 +1,97 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
import { Badge } from "@patternfly/react-core";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
Table,
|
|
5
|
+
Caption,
|
|
6
|
+
Thead,
|
|
7
|
+
Th,
|
|
8
|
+
Tr,
|
|
9
|
+
Tbody,
|
|
10
|
+
Td,
|
|
11
|
+
TableText
|
|
8
12
|
} from "@patternfly/react-table";
|
|
9
13
|
import { AutoLinkHeader } from "../autoLinkHeader/autoLinkHeader";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
import { PropTypeWithLinks } from "./propTypeWithLinks";
|
|
15
|
+
import { css } from "@patternfly/react-styles";
|
|
16
|
+
import accessibleStyles from "@patternfly/react-styles/css/utilities/Accessibility/accessibility";
|
|
13
17
|
|
|
14
|
-
export const PropsTable = ({ title, description, rows, allPropComponents }) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
}
|
|
37
|
-
cells={columns}
|
|
38
|
-
gridBreakPoint="grid-lg"
|
|
39
|
-
rows={rows
|
|
40
|
-
// Sort required rows first
|
|
18
|
+
export const PropsTable = ({ title, description, rows, allPropComponents }) => (
|
|
19
|
+
<React.Fragment>
|
|
20
|
+
<AutoLinkHeader size="h3">{title}</AutoLinkHeader>
|
|
21
|
+
<Table className="pf-u-mt-md pf-u-mb-lg" variant="compact" aria-label={title} gridBreakPoint="grid-lg">
|
|
22
|
+
<Caption>
|
|
23
|
+
{description && <div className="pf-u-mb-md">{description}</div>}
|
|
24
|
+
<div>
|
|
25
|
+
<span className="ws-prop-required">*</span>required
|
|
26
|
+
</div>
|
|
27
|
+
</Caption>
|
|
28
|
+
<Thead>
|
|
29
|
+
<Tr>
|
|
30
|
+
<Th width={20}>Name</Th>
|
|
31
|
+
<Th width={20}>Type</Th>
|
|
32
|
+
<Th>Default</Th>
|
|
33
|
+
<Th>Description</Th>
|
|
34
|
+
</Tr>
|
|
35
|
+
</Thead>
|
|
36
|
+
<Tbody>
|
|
37
|
+
{rows
|
|
41
38
|
.sort((a, b) => (a.required === b.required ? 0 : a.required ? -1 : 1))
|
|
42
|
-
.map((row, idx) => (
|
|
43
|
-
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*
|
|
55
|
-
</span>
|
|
56
|
-
<span
|
|
57
|
-
key={`${row.name}-required`}
|
|
58
|
-
className={css(accessibleStyles.screenReader)}
|
|
59
|
-
>
|
|
60
|
-
required
|
|
61
|
-
</span>
|
|
62
|
-
</React.Fragment>
|
|
63
|
-
) : (
|
|
64
|
-
""
|
|
65
|
-
)}
|
|
66
|
-
{row.beta && (
|
|
67
|
-
<Badge
|
|
68
|
-
key={`${row.name}-${idx}`}
|
|
69
|
-
className="ws-beta-badge pf-u-ml-sm"
|
|
39
|
+
.map((row, idx) => (
|
|
40
|
+
<Tr key={idx}>
|
|
41
|
+
<Td>
|
|
42
|
+
<TableText wrapModifier="breakWord">
|
|
43
|
+
{row.deprecated && "Deprecated: "}
|
|
44
|
+
{row.name}
|
|
45
|
+
{row.required ? (
|
|
46
|
+
<React.Fragment key={`${row.name}-required-prop`}>
|
|
47
|
+
<span
|
|
48
|
+
aria-hidden="true"
|
|
49
|
+
key={`${row.name}-asterisk`}
|
|
50
|
+
className="ws-prop-required"
|
|
70
51
|
>
|
|
71
|
-
|
|
72
|
-
</
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
52
|
+
*
|
|
53
|
+
</span>
|
|
54
|
+
<span
|
|
55
|
+
key={`${row.name}-required`}
|
|
56
|
+
className={css(accessibleStyles.screenReader)}
|
|
57
|
+
>
|
|
58
|
+
required
|
|
59
|
+
</span>
|
|
60
|
+
</React.Fragment>
|
|
61
|
+
) : (
|
|
62
|
+
""
|
|
63
|
+
)}
|
|
64
|
+
{row.beta && (
|
|
65
|
+
<Badge
|
|
66
|
+
key={`${row.name}-${idx}`}
|
|
67
|
+
className="ws-beta-badge pf-u-ml-sm"
|
|
68
|
+
>
|
|
69
|
+
Beta
|
|
70
|
+
</Badge>
|
|
71
|
+
)}
|
|
72
|
+
</TableText>
|
|
73
|
+
</Td>
|
|
74
|
+
<Td>
|
|
75
|
+
<TableText wrapModifier="breakWord">
|
|
76
|
+
<PropTypeWithLinks
|
|
77
|
+
type={row.type}
|
|
78
|
+
allPropComponents={allPropComponents}
|
|
79
|
+
/>
|
|
80
|
+
</TableText>
|
|
81
|
+
</Td>
|
|
82
|
+
<Td>
|
|
83
|
+
<TableText wrapModifier="breakWord">
|
|
84
|
+
{row.defaultValue}
|
|
85
|
+
</TableText>
|
|
86
|
+
</Td>
|
|
87
|
+
<Td>
|
|
88
|
+
<TableText wrapModifier="breakWord">
|
|
89
|
+
{row.description}
|
|
90
|
+
</TableText>
|
|
91
|
+
</Td>
|
|
92
|
+
</Tr>
|
|
93
|
+
))}
|
|
94
|
+
</Tbody>
|
|
95
|
+
</Table>
|
|
96
|
+
</React.Fragment>
|
|
97
|
+
);
|
|
@@ -12,6 +12,8 @@ const getIsActive = (location, section, subsection = null) => {
|
|
|
12
12
|
return location.pathname.startsWith(`${process.env.pathPrefix}${slug}`);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
const defaultValue = 50;
|
|
16
|
+
|
|
15
17
|
const NavItem = ({ text, href }) => {
|
|
16
18
|
const isMobileView = window.innerWidth < Number.parseInt(globalBreakpointXl.value, 10);
|
|
17
19
|
return (
|
|
@@ -67,9 +69,14 @@ const ExpandableNav = ({groupedRoutes, location, section, subsection = null}) =>
|
|
|
67
69
|
}}
|
|
68
70
|
>
|
|
69
71
|
{Object.entries(routes || {})
|
|
70
|
-
.filter(([id,
|
|
71
|
-
.map(([id, { slug, isSubsection = false }]) => ({ text: id, href: slug, isSubsection }))
|
|
72
|
-
.sort(({
|
|
72
|
+
.filter(([id, navObj]) => !Boolean(navObj.hideNavItem) && (Object.entries(navObj).length > 0))
|
|
73
|
+
.map(([id, { slug, isSubsection = false, sortValue = defaultValue, subsectionSortValue = defaultValue }]) => ({ text: id, href: slug, isSubsection, sortValue: (isSubsection ? subsectionSortValue : sortValue) }))
|
|
74
|
+
.sort(({text: text1, sortValue: sortValue1}, {text: text2, sortValue: sortValue2}) => {
|
|
75
|
+
if (sortValue1 === sortValue2) {
|
|
76
|
+
return text1.localeCompare(text2);
|
|
77
|
+
}
|
|
78
|
+
return sortValue1 > sortValue2 ? 1 : -1;
|
|
79
|
+
})
|
|
73
80
|
.map(navObj => navObj.isSubsection
|
|
74
81
|
? ExpandableNav({groupedRoutes, location, section, subsection: navObj.text})
|
|
75
82
|
: NavItem(navObj)
|
|
@@ -5,15 +5,16 @@ import {
|
|
|
5
5
|
PageSidebar,
|
|
6
6
|
Brand,
|
|
7
7
|
Dropdown,
|
|
8
|
-
DropdownToggle,
|
|
9
8
|
DropdownItem,
|
|
10
9
|
DropdownGroup,
|
|
10
|
+
DropdownList,
|
|
11
11
|
Divider,
|
|
12
12
|
Masthead,
|
|
13
13
|
MastheadToggle,
|
|
14
14
|
MastheadMain,
|
|
15
15
|
MastheadContent,
|
|
16
16
|
MastheadBrand,
|
|
17
|
+
MenuToggle,
|
|
17
18
|
PageToggleButton,
|
|
18
19
|
Toolbar,
|
|
19
20
|
ToolbarGroup,
|
|
@@ -23,7 +24,6 @@ import {
|
|
|
23
24
|
Switch,
|
|
24
25
|
SearchInput
|
|
25
26
|
} from '@patternfly/react-core';
|
|
26
|
-
import ExternalLinkAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-alt-icon';
|
|
27
27
|
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
28
28
|
import GithubIcon from '@patternfly/react-icons/dist/esm/icons/github-icon';
|
|
29
29
|
import { SideNav, TopNav, GdprBanner } from '../../components';
|
|
@@ -48,14 +48,9 @@ const HeaderTools = ({
|
|
|
48
48
|
const [isSearchExpanded, setIsSearchExpanded] = React.useState(false);
|
|
49
49
|
|
|
50
50
|
const getDropdownItem = (version, isLatest = false) => (
|
|
51
|
-
<DropdownItem
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<a href={isLatest ? '/' : `/${version.name}`}>
|
|
55
|
-
{`Release ${version.name}`}
|
|
56
|
-
</a>
|
|
57
|
-
}
|
|
58
|
-
/>
|
|
51
|
+
<DropdownItem itemId={version.name} key={version.name} to={isLatest ? '/' : `/${version.name}`}>
|
|
52
|
+
{`Release ${version.name}`}
|
|
53
|
+
</DropdownItem>
|
|
59
54
|
);
|
|
60
55
|
|
|
61
56
|
const onChange = (_evt, value) => {
|
|
@@ -82,7 +77,7 @@ const HeaderTools = ({
|
|
|
82
77
|
</ToolbarItem>
|
|
83
78
|
)}
|
|
84
79
|
<ToolbarGroup
|
|
85
|
-
|
|
80
|
+
align={{ default: 'alignRight' }}
|
|
86
81
|
spaceItems={{ default: 'spacerNone', md: 'spacerMd' }}
|
|
87
82
|
>
|
|
88
83
|
{hasDarkThemeSwitcher && (
|
|
@@ -117,42 +112,51 @@ const HeaderTools = ({
|
|
|
117
112
|
{hasVersionSwitcher && (
|
|
118
113
|
<ToolbarItem>
|
|
119
114
|
<Dropdown
|
|
120
|
-
isFullHeight
|
|
121
115
|
onSelect={() => setDropdownOpen(!isDropdownOpen)}
|
|
116
|
+
onOpenChange={(isOpen) => setDropdownOpen(isOpen)}
|
|
122
117
|
isOpen={isDropdownOpen}
|
|
123
|
-
toggle={(
|
|
124
|
-
<
|
|
125
|
-
|
|
118
|
+
toggle={(toggleRef) => (
|
|
119
|
+
<MenuToggle
|
|
120
|
+
isFullHeight
|
|
121
|
+
ref={toggleRef}
|
|
122
|
+
onClick={() => setDropdownOpen(!isDropdownOpen)}
|
|
123
|
+
isExpanded={isDropdownOpen}
|
|
126
124
|
>
|
|
127
125
|
Release {initialVersion.name}
|
|
128
|
-
</
|
|
126
|
+
</MenuToggle>
|
|
129
127
|
)}
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
>
|
|
129
|
+
<DropdownGroup key="Latest" label="Latest">
|
|
130
|
+
<DropdownList>
|
|
132
131
|
{getDropdownItem(latestVersion, true)}
|
|
133
|
-
</
|
|
134
|
-
|
|
132
|
+
</DropdownList>
|
|
133
|
+
</DropdownGroup>
|
|
134
|
+
<DropdownGroup key="Previous releases" label="Previous releases">
|
|
135
|
+
<DropdownList>
|
|
135
136
|
{Object.values(versions.Releases)
|
|
136
137
|
.filter(version => !version.hidden && !version.latest)
|
|
137
138
|
.slice(0,3)
|
|
138
139
|
.map(version => getDropdownItem(version))}
|
|
139
|
-
</
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
140
|
+
</DropdownList>
|
|
141
|
+
</DropdownGroup>
|
|
142
|
+
<Divider key="divider" className="ws-switcher-divider"/>
|
|
143
|
+
<DropdownGroup key="Previous versions" label="Previous versions">
|
|
144
|
+
<DropdownList>
|
|
145
|
+
<DropdownItem
|
|
146
|
+
key="PatternFly 3"
|
|
147
|
+
className="ws-patternfly-3"
|
|
148
|
+
isExternalLink
|
|
149
|
+
to="https://pf3.patternfly.org/"
|
|
150
|
+
itemId="patternfly-3"
|
|
151
|
+
>
|
|
152
|
+
PatternFly 3
|
|
153
|
+
</DropdownItem>
|
|
154
|
+
</DropdownList>
|
|
155
|
+
</DropdownGroup>
|
|
156
|
+
</Dropdown>
|
|
152
157
|
</ToolbarItem>
|
|
153
158
|
)}
|
|
154
|
-
</ToolbarGroup>
|
|
155
|
-
</ToolbarContent>
|
|
159
|
+
</ToolbarGroup></ToolbarContent>
|
|
156
160
|
</Toolbar>
|
|
157
161
|
);
|
|
158
162
|
}
|
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": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.16",
|
|
5
5
|
"author": "Red Hat",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"@patternfly/patternfly": "^5.0.0-alpha.13",
|
|
86
|
-
"@patternfly/react-code-editor": "^5.0.0-alpha.
|
|
87
|
-
"@patternfly/react-core": "^5.0.0-alpha.
|
|
88
|
-
"@patternfly/react-table": "^5.0.0-alpha.
|
|
86
|
+
"@patternfly/react-code-editor": "^5.0.0-alpha.54",
|
|
87
|
+
"@patternfly/react-core": "^5.0.0-alpha.53",
|
|
88
|
+
"@patternfly/react-table": "^5.0.0-alpha.54",
|
|
89
89
|
"react": "^17.0.0 || ^18.0.0",
|
|
90
90
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "48c8db76bf62fff3b4e4e96eece75f1b227c2982"
|
|
93
93
|
}
|
package/routes.js
CHANGED
|
@@ -9,6 +9,8 @@ const routes = {
|
|
|
9
9
|
...generatedRoutes
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
const defaultOrder = 50;
|
|
13
|
+
|
|
12
14
|
for (let route in routes) {
|
|
13
15
|
const pageData = routes[route];
|
|
14
16
|
if (pageData.SyncComponent) {
|
|
@@ -28,7 +30,7 @@ const isNull = o => o === null || o === undefined;
|
|
|
28
30
|
const groupedRoutes = Object.entries(routes)
|
|
29
31
|
.filter(([_slug, { id, section }]) => !isNull(id) && !isNull(section))
|
|
30
32
|
.reduce((accum, [slug, pageData]) => {
|
|
31
|
-
const { section, subsection = null, id, title, source, katacodaLayout, hideNavItem, relPath } = pageData;
|
|
33
|
+
const { section, subsection = null, id, title, source, katacodaLayout, hideNavItem, relPath, sortValue = null, subsectionSortValue = null } = pageData;
|
|
32
34
|
pageData.slug = slug;
|
|
33
35
|
// add section to groupedRoutes obj if not yet created
|
|
34
36
|
accum[section] = accum[section] || {};
|
|
@@ -42,7 +44,9 @@ const groupedRoutes = Object.entries(routes)
|
|
|
42
44
|
sources: [],
|
|
43
45
|
katacodaLayout,
|
|
44
46
|
hideNavItem,
|
|
45
|
-
relPath
|
|
47
|
+
relPath,
|
|
48
|
+
...(sortValue && { sortValue }),
|
|
49
|
+
...(subsectionSortValue && { subsectionSortValue })
|
|
46
50
|
}
|
|
47
51
|
// add page to groupedRoutes obj section or subsection
|
|
48
52
|
if (subsection) {
|
|
@@ -52,10 +56,21 @@ const groupedRoutes = Object.entries(routes)
|
|
|
52
56
|
// add page to subsection
|
|
53
57
|
accum[section][subsection][id] = accum[section][subsection][id] || data;
|
|
54
58
|
accum[section][subsection][id].sources.push(pageData);
|
|
59
|
+
// nav item ordering
|
|
60
|
+
if (sortValue) {
|
|
61
|
+
accum[section][subsection].sortValue = sortValue;
|
|
62
|
+
}
|
|
63
|
+
if (subsectionSortValue) {
|
|
64
|
+
accum[section][subsection].subsectionSortValue = subsectionSortValue;
|
|
65
|
+
}
|
|
55
66
|
} else {
|
|
56
67
|
// add page to section
|
|
57
68
|
accum[section][id] = accum[section][id] || data;
|
|
58
69
|
accum[section][id].sources.push(pageData);
|
|
70
|
+
// nav item ordering
|
|
71
|
+
if (sortValue) {
|
|
72
|
+
accum[section][id].sortValue = sortValue;
|
|
73
|
+
}
|
|
59
74
|
}
|
|
60
75
|
|
|
61
76
|
return accum;
|
|
@@ -73,7 +88,6 @@ const sourceOrder = {
|
|
|
73
88
|
'design-guidelines': 99,
|
|
74
89
|
'accessibility': 100
|
|
75
90
|
};
|
|
76
|
-
const defaultOrder = 50;
|
|
77
91
|
|
|
78
92
|
const sortSources = ({ source: s1 }, { source: s2 }) => {
|
|
79
93
|
const s1Index = sourceOrder[s1] || defaultOrder;
|
|
@@ -108,7 +122,8 @@ Object.entries(groupedRoutes)
|
|
|
108
122
|
// Loop through each page in expandable subsection
|
|
109
123
|
if (pageData.isSubsection) {
|
|
110
124
|
Object.entries(pageData).map(([section, ids]) => {
|
|
111
|
-
|
|
125
|
+
// only push nested page objects
|
|
126
|
+
if (ids && ids?.id) {
|
|
112
127
|
pageDataArr.push(ids);
|
|
113
128
|
}
|
|
114
129
|
})
|
package/scripts/md/parseMD.js
CHANGED
|
@@ -85,6 +85,7 @@ function toReactComponent(mdFilePath, source, buildMode) {
|
|
|
85
85
|
section: frontmatter.section || '',
|
|
86
86
|
subsection: frontmatter.subsection || '',
|
|
87
87
|
source,
|
|
88
|
+
tabName: frontmatter.tabName || null,
|
|
88
89
|
slug,
|
|
89
90
|
sourceLink: frontmatter.sourceLink || `https://github.com/patternfly/${
|
|
90
91
|
sourceRepo}/blob/main/${
|
|
@@ -126,6 +127,12 @@ function toReactComponent(mdFilePath, source, buildMode) {
|
|
|
126
127
|
if (frontmatter.hideNavItem) {
|
|
127
128
|
pageData.hideNavItem = frontmatter.hideNavItem;
|
|
128
129
|
}
|
|
130
|
+
if (frontmatter.sortValue) {
|
|
131
|
+
pageData.sortValue = frontmatter.sortValue;
|
|
132
|
+
}
|
|
133
|
+
if (frontmatter.subsectionSortValue) {
|
|
134
|
+
pageData.subsectionSortValue = frontmatter.subsectionSortValue;
|
|
135
|
+
}
|
|
129
136
|
})
|
|
130
137
|
// Delete HTML comments
|
|
131
138
|
.use(require('./remove-comments'))
|
|
@@ -266,8 +273,11 @@ function sourceMDFile(file, source, buildMode) {
|
|
|
266
273
|
section: pageData.section,
|
|
267
274
|
subsection: pageData.subsection,
|
|
268
275
|
source: pageData.source,
|
|
276
|
+
tabName: pageData.tabName,
|
|
269
277
|
...(pageData.katacodaLayout && { katacodaLayout: pageData.katacodaLayout }),
|
|
270
|
-
...(pageData.hideNavItem && { hideNavItem: pageData.hideNavItem })
|
|
278
|
+
...(pageData.hideNavItem && { hideNavItem: pageData.hideNavItem }),
|
|
279
|
+
...(pageData.sortValue && { sortValue: pageData.sortValue }),
|
|
280
|
+
...(pageData.subsectionSortValue && { subsectionSortValue: pageData.subsectionSortValue })
|
|
271
281
|
};
|
|
272
282
|
}
|
|
273
283
|
}
|
|
@@ -8,6 +8,7 @@ module.exports = (_env, argv) => {
|
|
|
8
8
|
const {
|
|
9
9
|
pathPrefix = '',
|
|
10
10
|
mode,
|
|
11
|
+
googleAnalyticsID = false,
|
|
11
12
|
algolia = {},
|
|
12
13
|
hasGdprBanner = false,
|
|
13
14
|
hasFooter = false,
|
|
@@ -40,9 +41,12 @@ module.exports = (_env, argv) => {
|
|
|
40
41
|
include: [
|
|
41
42
|
path.resolve(process.cwd(), 'src'),
|
|
42
43
|
path.resolve(process.cwd(), 'patternfly-docs'),
|
|
44
|
+
path.resolve(process.cwd(), 'examples'),
|
|
43
45
|
path.resolve(__dirname, '../..'), // Temporarily compile theme using webpack for development
|
|
44
46
|
/react-[\w-]+\/src\/.*\/examples/,
|
|
45
47
|
/react-[\w-]+\\src\\.*\\examples/, // fix for Windows
|
|
48
|
+
/react-[\w-]+\/patternfly-docs\/.*\/examples/, //fixes for extensions
|
|
49
|
+
/react-[\w-]+\\patternfly-docs\\.*\\examples/,
|
|
46
50
|
].concat(includePaths.map(path => new RegExp(path))),
|
|
47
51
|
exclude: [
|
|
48
52
|
path.resolve(__dirname, '../../node_modules'), // Temporarily compile theme using webpack for development
|
|
@@ -134,6 +138,7 @@ module.exports = (_env, argv) => {
|
|
|
134
138
|
new webpack.DefinePlugin({
|
|
135
139
|
'process.env.NODE_ENV': JSON.stringify(mode),
|
|
136
140
|
'process.env.pathPrefix': JSON.stringify(isProd ? pathPrefix : ''),
|
|
141
|
+
'process.env.googleAnalyticsID': JSON.stringify(isProd ? googleAnalyticsID : ''),
|
|
137
142
|
'process.env.algolia': JSON.stringify(algolia),
|
|
138
143
|
'process.env.hasGdprBanner': JSON.stringify(hasGdprBanner),
|
|
139
144
|
'process.env.hasFooter': JSON.stringify(hasFooter),
|
package/templates/mdx.js
CHANGED
|
@@ -121,7 +121,15 @@ export const MDXTemplate = ({
|
|
|
121
121
|
id,
|
|
122
122
|
componentsData
|
|
123
123
|
}) => {
|
|
124
|
-
|
|
124
|
+
// Build obj mapping source names to text displayed on tabs
|
|
125
|
+
const tabNames = sources.reduce((acc, curSrc) => {
|
|
126
|
+
const { source, tabName } = curSrc;
|
|
127
|
+
// use tabName for tab name if present, otherwise default to source
|
|
128
|
+
const tabLinkText = tabName || capitalize(source.replace('html', 'HTML').replace(/-/g, ' '));
|
|
129
|
+
acc[source] = tabLinkText;
|
|
130
|
+
return acc;
|
|
131
|
+
}, {});
|
|
132
|
+
const sourceKeys = Object.keys(tabNames);
|
|
125
133
|
const isSinglePage = sourceKeys.length === 1;
|
|
126
134
|
|
|
127
135
|
let isDevResources, isComponent, isExtension, isChart, isDemo, isLayout, isUtility;
|
|
@@ -223,7 +231,7 @@ export const MDXTemplate = ({
|
|
|
223
231
|
onClick={() => trackEvent('tab_click', 'click_event', source.toUpperCase())}
|
|
224
232
|
>
|
|
225
233
|
<Link className="pf-c-tabs__link" to={`${path}${index === 0 ? '' : '/' + source}`}>
|
|
226
|
-
{
|
|
234
|
+
{tabNames[source]}
|
|
227
235
|
</Link>
|
|
228
236
|
</li>
|
|
229
237
|
))}
|
|
@@ -7,6 +7,8 @@ section: extensions
|
|
|
7
7
|
id: My extension
|
|
8
8
|
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
|
|
9
9
|
source: design-guidelines
|
|
10
|
+
# Optional custom text to display in tab in place of source
|
|
11
|
+
tabName: My custom tab-name
|
|
10
12
|
---
|
|
11
13
|
|
|
12
14
|
Design guidelines intro
|
|
@@ -7,6 +7,8 @@ section: extensions
|
|
|
7
7
|
id: My extension
|
|
8
8
|
# Tab (react | react-demos | html | html-demos | design-guidelines | accessibility)
|
|
9
9
|
source: react
|
|
10
|
+
# Optional custom text to display in tab in place of source
|
|
11
|
+
tabName: My custom tab-name
|
|
10
12
|
# If you use typescript, the name of the interface to display props for
|
|
11
13
|
# These are found through the sourceProps function provdided in patternfly-docs.source.js
|
|
12
14
|
# Can also pass object { component: string, source: string } allowing to specify the source
|
package/versions.json
CHANGED
|
@@ -5,26 +5,45 @@
|
|
|
5
5
|
"date": "2022-02-08",
|
|
6
6
|
"latest": true,
|
|
7
7
|
"versions": {
|
|
8
|
-
"@patternfly/patternfly": "5.0.0-alpha.
|
|
8
|
+
"@patternfly/patternfly": "5.0.0-alpha.37",
|
|
9
|
+
"@patternfly/react-charts": "^7.0.0-alpha.14",
|
|
10
|
+
"@patternfly/react-code-editor": "^5.0.0-alpha.54",
|
|
11
|
+
"@patternfly/react-core": "^5.0.0-alpha.53",
|
|
12
|
+
"@patternfly/react-icons": "^5.0.0-alpha.8",
|
|
13
|
+
"@patternfly/react-styles": "^5.0.0-alpha.6",
|
|
14
|
+
"@patternfly/react-table": "^5.0.0-alpha.54",
|
|
15
|
+
"@patternfly/react-tokens": "^5.0.0-alpha.6",
|
|
9
16
|
"@patternfly/react-catalog-view-extension": "4.95.1",
|
|
10
|
-
"@patternfly/react-charts": "7.0.0-alpha.3",
|
|
11
|
-
"@patternfly/react-code-editor": "5.0.0-alpha.7",
|
|
12
|
-
"@patternfly/react-core": "5.0.0-alpha.7",
|
|
13
17
|
"@patternfly/react-drag-drop": "5.0.0-alpha.0",
|
|
14
|
-
"@patternfly/react-icons": "5.0.0-alpha.2",
|
|
15
18
|
"@patternfly/react-inline-edit-extension": "4.86.118",
|
|
16
19
|
"@patternfly/react-log-viewer": "4.87.100",
|
|
17
|
-
"@patternfly/react-styles": "5.0.0-alpha.2",
|
|
18
|
-
"@patternfly/react-table": "5.0.0-alpha.7",
|
|
19
|
-
"@patternfly/react-tokens": "5.0.0-alpha.2",
|
|
20
20
|
"@patternfly/react-topology": "4.91.27",
|
|
21
21
|
"@patternfly/react-virtualized-extension": "4.88.113"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
"name": "2023.02",
|
|
26
|
+
"date": "2022-03-27",
|
|
27
|
+
"versions": {
|
|
28
|
+
"@patternfly/patternfly": "4.224.4",
|
|
29
|
+
"@patternfly/react-catalog-view-extension": "4.96.0",
|
|
30
|
+
"@patternfly/react-charts": "6.94.19",
|
|
31
|
+
"@patternfly/react-code-editor": "4.82.115",
|
|
32
|
+
"@patternfly/react-console": "4.95.5",
|
|
33
|
+
"@patternfly/react-core": "4.276.8",
|
|
34
|
+
"@patternfly/react-icons": "4.93.6",
|
|
35
|
+
"@patternfly/react-inline-edit-extension": "4.86.122",
|
|
36
|
+
"@patternfly/react-log-viewer": "4.87.100",
|
|
37
|
+
"@patternfly/react-styles": "4.92.6",
|
|
38
|
+
"@patternfly/react-table": "4.113.0",
|
|
39
|
+
"@patternfly/react-tokens": "4.94.6",
|
|
40
|
+
"@patternfly/react-topology": "4.91.40",
|
|
41
|
+
"@patternfly/react-virtualized-extension": "4.88.115"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
24
44
|
{
|
|
25
45
|
"name": "2023.01",
|
|
26
46
|
"date": "2022-01-31",
|
|
27
|
-
"latest": true,
|
|
28
47
|
"versions": {
|
|
29
48
|
"@patternfly/patternfly": "4.224.2",
|
|
30
49
|
"@patternfly/react-catalog-view-extension": "4.95.1",
|