@patternfly/documentation-framework 2.0.0-alpha.2 → 2.0.0-alpha.21
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 +182 -0
- package/app.js +12 -10
- package/components/cssVariables/cssSearch.js +3 -4
- package/components/cssVariables/cssVariables.js +69 -67
- package/components/propsTable/propsTable.js +85 -79
- package/components/sideNav/sideNav.js +10 -3
- package/helpers/getTitle.js +2 -2
- package/layouts/sideNavLayout/sideNavLayout.css +0 -4
- package/layouts/sideNavLayout/sideNavLayout.js +48 -35
- package/package.json +26 -25
- package/pages/404/index.js +3 -3
- package/routes.js +19 -5
- package/scripts/cli/build.js +6 -0
- package/scripts/cli/cli.js +1 -0
- package/scripts/cli/start.js +6 -8
- package/scripts/md/parseMD.js +11 -8
- package/scripts/webpack/webpack.base.config.js +33 -31
- package/scripts/webpack/webpack.client.config.js +11 -13
- package/scripts/webpack/webpack.server.config.js +26 -10
- package/templates/html.ejs +1 -3
- package/templates/mdx.css +0 -5
- package/templates/mdx.js +15 -15
- 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 +29 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,188 @@
|
|
|
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.21 (2023-04-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* clean up references to katacoda ([#3491](https://github.com/patternfly/patternfly-org/issues/3491)) ([5de986b](https://github.com/patternfly/patternfly-org/commit/5de986b917ee7edf9c476bb2df2f2ee4d454a7e1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# 2.0.0-alpha.20 (2023-04-14)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# 2.0.0-alpha.19 (2023-04-12)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# 2.0.0-alpha.18 (2023-04-11)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* **cssVariables:** Update expandId ([b9b0a6e](https://github.com/patternfly/patternfly-org/commit/b9b0a6edcc103c442f24caae086b68558415be57))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# 2.0.0-alpha.17 (2023-04-11)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### Bug Fixes
|
|
48
|
+
|
|
49
|
+
* **docs:** fixes display & search bugs on icons page ([#3483](https://github.com/patternfly/patternfly-org/issues/3483)) ([39b225c](https://github.com/patternfly/patternfly-org/commit/39b225cdcbdc4c01c5002750600708eab6427f60))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# 2.0.0-alpha.16 (2023-04-11)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### Features
|
|
59
|
+
|
|
60
|
+
* **tables:** update tables, context selector ([#3474](https://github.com/patternfly/patternfly-org/issues/3474)) ([cd82c35](https://github.com/patternfly/patternfly-org/commit/cd82c356f568f3368bc22319d614fde8dd74fb38))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# 2.0.0-alpha.15 (2023-04-06)
|
|
67
|
+
|
|
68
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# 2.0.0-alpha.14 (2023-04-03)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
### Bug Fixes
|
|
78
|
+
|
|
79
|
+
* **Tables:** temporarily comment out tables so Table can be deprecated ([#3468](https://github.com/patternfly/patternfly-org/issues/3468)) ([f4aa5ed](https://github.com/patternfly/patternfly-org/commit/f4aa5ed791161851cdc92d02d0c752eef4028306))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# 2.0.0-alpha.13 (2023-03-31)
|
|
86
|
+
|
|
87
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
# 2.0.0-alpha.12 (2023-03-30)
|
|
94
|
+
|
|
95
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
# 2.0.0-alpha.11 (2023-03-29)
|
|
102
|
+
|
|
103
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# 2.0.0-alpha.10 (2023-03-15)
|
|
110
|
+
|
|
111
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
# 2.0.0-alpha.9 (2023-03-09)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
### Bug Fixes
|
|
121
|
+
|
|
122
|
+
* **versions:** fix typo ([a9b8fe2](https://github.com/patternfly/patternfly-org/commit/a9b8fe296a9c28bdd9ada01a80b1653810802ddf))
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
# 2.0.0-alpha.8 (2023-03-03)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
### Features
|
|
132
|
+
|
|
133
|
+
* **docs-framework:** add legacy ssl cli option ([#3433](https://github.com/patternfly/patternfly-org/issues/3433)) ([ccb56fb](https://github.com/patternfly/patternfly-org/commit/ccb56fb27026ebe4be5f5166a86cf3c2f995a872))
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# 2.0.0-alpha.7 (2023-03-01)
|
|
140
|
+
|
|
141
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
# 2.0.0-alpha.6 (2023-03-01)
|
|
148
|
+
|
|
149
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
# 2.0.0-alpha.5 (2023-03-01)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
### Bug Fixes
|
|
159
|
+
|
|
160
|
+
* **404 Page:** Removed CardHeaderMain ([#3429](https://github.com/patternfly/patternfly-org/issues/3429)) ([6169fed](https://github.com/patternfly/patternfly-org/commit/6169fedd3dc57b9c206197c498d6cebc559e2a93))
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
# 2.0.0-alpha.4 (2023-02-27)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
### Bug Fixes
|
|
170
|
+
|
|
171
|
+
* **README:** small wording change to test build ([45ede1b](https://github.com/patternfly/patternfly-org/commit/45ede1b356392df6982fd5cbf3b3a4d976f54e06))
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
# 2.0.0-alpha.3 (2023-02-13)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
### Bug Fixes
|
|
181
|
+
|
|
182
|
+
* **whitespace:** test github actions ([de769f0](https://github.com/patternfly/patternfly-org/commit/de769f0d47e770af07caf9370ae72f76ab66c8a8))
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
6
188
|
# 2.0.0-alpha.2 (2023-02-13)
|
|
7
189
|
|
|
8
190
|
|
package/app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { createRoot, hydrateRoot } from 'react-dom/client';
|
|
3
3
|
import { Router, useLocation } from '@reach/router';
|
|
4
4
|
import 'client-styles'; // Webpack replaces this import: patternfly-docs.css.js
|
|
5
5
|
import { SideNavLayout } from '@patternfly/documentation-framework/layouts';
|
|
@@ -16,10 +16,10 @@ import './components/sideNav/sideNav.css';
|
|
|
16
16
|
import './components/topNav/topNav.css';
|
|
17
17
|
import './layouts/sideNavLayout/sideNavLayout.css';
|
|
18
18
|
|
|
19
|
-
const AppRoute = ({ child,
|
|
19
|
+
const AppRoute = ({ child, 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
|
});
|
|
@@ -31,7 +31,7 @@ const AppRoute = ({ child, katacodaLayout, title, path }) => {
|
|
|
31
31
|
return (
|
|
32
32
|
<React.Fragment>
|
|
33
33
|
{child}
|
|
34
|
-
{
|
|
34
|
+
{process.env.hasFooter && <Footer />}
|
|
35
35
|
</React.Fragment>
|
|
36
36
|
);
|
|
37
37
|
}
|
|
@@ -39,18 +39,17 @@ const AppRoute = ({ child, katacodaLayout, title, path }) => {
|
|
|
39
39
|
const SideNavRouter = () => {
|
|
40
40
|
const pathname = useLocation().pathname.replace(process.env.pathPrefix, '');
|
|
41
41
|
const componentsData = process?.env?.componentsData;
|
|
42
|
-
const navOpen = !routes[pathname]
|
|
42
|
+
const navOpen = !routes[pathname];
|
|
43
43
|
return (
|
|
44
44
|
<SideNavLayout groupedRoutes={groupedRoutes} navOpen={navOpen} >
|
|
45
45
|
<Router id="ws-page-content-router">
|
|
46
46
|
{Object.entries(routes)
|
|
47
|
-
.map(([path, { Component, title, sources,
|
|
47
|
+
.map(([path, { Component, title, sources, id }]) => Component
|
|
48
48
|
? <AppRoute
|
|
49
49
|
key={path}
|
|
50
50
|
path={path}
|
|
51
51
|
default={path === '/404'}
|
|
52
52
|
child={<Component />}
|
|
53
|
-
katacodaLayout={katacodaLayout}
|
|
54
53
|
title={title}
|
|
55
54
|
/>
|
|
56
55
|
: <AppRoute
|
|
@@ -65,7 +64,6 @@ const SideNavRouter = () => {
|
|
|
65
64
|
componentsData={componentsData}
|
|
66
65
|
/>
|
|
67
66
|
}
|
|
68
|
-
katacodaLayout={katacodaLayout}
|
|
69
67
|
title={title}
|
|
70
68
|
/>
|
|
71
69
|
)
|
|
@@ -107,8 +105,12 @@ const isPrerender = process.env.PRERENDER;
|
|
|
107
105
|
// Don't use ReactDOM in SSR
|
|
108
106
|
if (!isPrerender) {
|
|
109
107
|
function render() {
|
|
110
|
-
const
|
|
111
|
-
|
|
108
|
+
const container = document.getElementById('root');
|
|
109
|
+
if (isProd) {
|
|
110
|
+
hydrateRoot(container, <App />);
|
|
111
|
+
} else {
|
|
112
|
+
createRoot(container).render(<App />);
|
|
113
|
+
}
|
|
112
114
|
}
|
|
113
115
|
// On first load, await promise for the current page to avoid flashing a "Loading..." state
|
|
114
116
|
const Component = getAsyncComponent(null);
|
|
@@ -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}
|
|
@@ -2,11 +2,11 @@ import React from "react";
|
|
|
2
2
|
import { debounce } from "@patternfly/react-core";
|
|
3
3
|
import {
|
|
4
4
|
Table,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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,29 +167,6 @@ 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>
|
|
@@ -213,19 +174,60 @@ export class CSSVariables extends React.Component {
|
|
|
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
|
-
|
|
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: 'css-vars-expandable-toggle'
|
|
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
|
+
)}
|
|
229
231
|
</Table>
|
|
230
232
|
</React.Fragment>
|
|
231
233
|
);
|
|
@@ -2,90 +2,96 @@ import React from "react";
|
|
|
2
2
|
import { Badge } from "@patternfly/react-core";
|
|
3
3
|
import {
|
|
4
4
|
Table,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
14
|
import { PropTypeWithLinks } from "./propTypeWithLinks";
|
|
11
15
|
import { css } from "@patternfly/react-styles";
|
|
12
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)
|
package/helpers/getTitle.js
CHANGED