@patternfly/documentation-framework 2.0.0-alpha.3 → 2.0.0-alpha.30

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +255 -0
  2. package/app.js +12 -11
  3. package/components/cssVariables/cssSearch.js +3 -4
  4. package/components/cssVariables/cssVariables.js +69 -67
  5. package/components/functionsTable/functionsTable.js +57 -0
  6. package/components/propsTable/propsTable.js +85 -79
  7. package/components/sectionGallery/sectionDataListLayout.js +67 -0
  8. package/components/sectionGallery/sectionGallery.css +44 -0
  9. package/components/sectionGallery/sectionGallery.js +53 -0
  10. package/components/sectionGallery/sectionGalleryLayout.js +37 -0
  11. package/components/sectionGallery/sectionGalleryToolbar.js +30 -0
  12. package/components/sectionGallery/sectionGalleryWrapper.js +89 -0
  13. package/components/sideNav/sideNav.js +10 -3
  14. package/helpers/getTitle.js +2 -2
  15. package/layouts/sideNavLayout/sideNavLayout.css +0 -4
  16. package/layouts/sideNavLayout/sideNavLayout.js +48 -35
  17. package/package.json +28 -25
  18. package/pages/404/index.js +3 -3
  19. package/routes.js +19 -5
  20. package/scripts/cli/build.js +6 -0
  21. package/scripts/cli/cli.js +2 -0
  22. package/scripts/cli/generate.js +2 -2
  23. package/scripts/cli/start.js +6 -8
  24. package/scripts/md/parseMD.js +40 -8
  25. package/scripts/tsDocgen.js +119 -91
  26. package/scripts/typeDocGen.js +209 -0
  27. package/scripts/webpack/webpack.base.config.js +34 -32
  28. package/scripts/webpack/webpack.client.config.js +11 -8
  29. package/scripts/webpack/webpack.server.config.js +8 -5
  30. package/scripts/writeScreenshots.js +2 -2
  31. package/templates/html.ejs +1 -3
  32. package/templates/mdx.css +0 -5
  33. package/templates/mdx.js +58 -41
  34. package/templates/patternfly-docs/content/extensions/extension/design-guidelines/design-guidelines.md +2 -0
  35. package/templates/patternfly-docs/content/extensions/extension/examples/basic.md +2 -0
  36. package/versions.json +29 -9
package/CHANGELOG.md CHANGED
@@ -3,6 +3,261 @@
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.30 (2023-04-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * white space change to test CI ([e9e7ed3](https://github.com/patternfly/patternfly-org/commit/e9e7ed3cf6007fcf022dd7693bfed12bdf9d7e9a))
12
+
13
+
14
+
15
+
16
+
17
+ # 2.0.0-alpha.29 (2023-04-26)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * sidebar open by default ([#3506](https://github.com/patternfly/patternfly-org/issues/3506)) ([fb5f086](https://github.com/patternfly/patternfly-org/commit/fb5f08611d3edde80a559635b39dab7138f06d1d))
23
+
24
+
25
+
26
+
27
+
28
+ # 2.0.0-alpha.28 (2023-04-26)
29
+
30
+ **Note:** Version bump only for package @patternfly/documentation-framework
31
+
32
+
33
+
34
+
35
+
36
+ # 2.0.0-alpha.27 (2023-04-25)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * **docs:** Update static dir and fix null loading ([#3505](https://github.com/patternfly/patternfly-org/issues/3505)) ([e65a1b2](https://github.com/patternfly/patternfly-org/commit/e65a1b21ae7671322adcbcef1ada69436fd07802))
42
+
43
+
44
+
45
+
46
+
47
+ # 2.0.0-alpha.26 (2023-04-21)
48
+
49
+ **Note:** Version bump only for package @patternfly/documentation-framework
50
+
51
+
52
+
53
+
54
+
55
+ # 2.0.0-alpha.25 (2023-04-19)
56
+
57
+ **Note:** Version bump only for package @patternfly/documentation-framework
58
+
59
+
60
+
61
+
62
+
63
+ # 2.0.0-alpha.24 (2023-04-17)
64
+
65
+ **Note:** Version bump only for package @patternfly/documentation-framework
66
+
67
+
68
+
69
+
70
+
71
+ # 2.0.0-alpha.23 (2023-04-17)
72
+
73
+
74
+ ### Features
75
+
76
+ * **docs-framework:** add support for exposing function documentation ([#3485](https://github.com/patternfly/patternfly-org/issues/3485)) ([2f19ded](https://github.com/patternfly/patternfly-org/commit/2f19deda84c75042df1870c0950bb173eb2c3d84))
77
+
78
+
79
+
80
+
81
+
82
+ # 2.0.0-alpha.22 (2023-04-17)
83
+
84
+ **Note:** Version bump only for package @patternfly/documentation-framework
85
+
86
+
87
+
88
+
89
+
90
+ # 2.0.0-alpha.21 (2023-04-15)
91
+
92
+
93
+ ### Bug Fixes
94
+
95
+ * clean up references to katacoda ([#3491](https://github.com/patternfly/patternfly-org/issues/3491)) ([5de986b](https://github.com/patternfly/patternfly-org/commit/5de986b917ee7edf9c476bb2df2f2ee4d454a7e1))
96
+
97
+
98
+
99
+
100
+
101
+ # 2.0.0-alpha.20 (2023-04-14)
102
+
103
+ **Note:** Version bump only for package @patternfly/documentation-framework
104
+
105
+
106
+
107
+
108
+
109
+ # 2.0.0-alpha.19 (2023-04-12)
110
+
111
+ **Note:** Version bump only for package @patternfly/documentation-framework
112
+
113
+
114
+
115
+
116
+
117
+ # 2.0.0-alpha.18 (2023-04-11)
118
+
119
+
120
+ ### Bug Fixes
121
+
122
+ * **cssVariables:** Update expandId ([b9b0a6e](https://github.com/patternfly/patternfly-org/commit/b9b0a6edcc103c442f24caae086b68558415be57))
123
+
124
+
125
+
126
+
127
+
128
+ # 2.0.0-alpha.17 (2023-04-11)
129
+
130
+
131
+ ### Bug Fixes
132
+
133
+ * **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))
134
+
135
+
136
+
137
+
138
+
139
+ # 2.0.0-alpha.16 (2023-04-11)
140
+
141
+
142
+ ### Features
143
+
144
+ * **tables:** update tables, context selector ([#3474](https://github.com/patternfly/patternfly-org/issues/3474)) ([cd82c35](https://github.com/patternfly/patternfly-org/commit/cd82c356f568f3368bc22319d614fde8dd74fb38))
145
+
146
+
147
+
148
+
149
+
150
+ # 2.0.0-alpha.15 (2023-04-06)
151
+
152
+ **Note:** Version bump only for package @patternfly/documentation-framework
153
+
154
+
155
+
156
+
157
+
158
+ # 2.0.0-alpha.14 (2023-04-03)
159
+
160
+
161
+ ### Bug Fixes
162
+
163
+ * **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))
164
+
165
+
166
+
167
+
168
+
169
+ # 2.0.0-alpha.13 (2023-03-31)
170
+
171
+ **Note:** Version bump only for package @patternfly/documentation-framework
172
+
173
+
174
+
175
+
176
+
177
+ # 2.0.0-alpha.12 (2023-03-30)
178
+
179
+ **Note:** Version bump only for package @patternfly/documentation-framework
180
+
181
+
182
+
183
+
184
+
185
+ # 2.0.0-alpha.11 (2023-03-29)
186
+
187
+ **Note:** Version bump only for package @patternfly/documentation-framework
188
+
189
+
190
+
191
+
192
+
193
+ # 2.0.0-alpha.10 (2023-03-15)
194
+
195
+ **Note:** Version bump only for package @patternfly/documentation-framework
196
+
197
+
198
+
199
+
200
+
201
+ # 2.0.0-alpha.9 (2023-03-09)
202
+
203
+
204
+ ### Bug Fixes
205
+
206
+ * **versions:** fix typo ([a9b8fe2](https://github.com/patternfly/patternfly-org/commit/a9b8fe296a9c28bdd9ada01a80b1653810802ddf))
207
+
208
+
209
+
210
+
211
+
212
+ # 2.0.0-alpha.8 (2023-03-03)
213
+
214
+
215
+ ### Features
216
+
217
+ * **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))
218
+
219
+
220
+
221
+
222
+
223
+ # 2.0.0-alpha.7 (2023-03-01)
224
+
225
+ **Note:** Version bump only for package @patternfly/documentation-framework
226
+
227
+
228
+
229
+
230
+
231
+ # 2.0.0-alpha.6 (2023-03-01)
232
+
233
+ **Note:** Version bump only for package @patternfly/documentation-framework
234
+
235
+
236
+
237
+
238
+
239
+ # 2.0.0-alpha.5 (2023-03-01)
240
+
241
+
242
+ ### Bug Fixes
243
+
244
+ * **404 Page:** Removed CardHeaderMain ([#3429](https://github.com/patternfly/patternfly-org/issues/3429)) ([6169fed](https://github.com/patternfly/patternfly-org/commit/6169fedd3dc57b9c206197c498d6cebc559e2a93))
245
+
246
+
247
+
248
+
249
+
250
+ # 2.0.0-alpha.4 (2023-02-27)
251
+
252
+
253
+ ### Bug Fixes
254
+
255
+ * **README:** small wording change to test build ([45ede1b](https://github.com/patternfly/patternfly-org/commit/45ede1b356392df6982fd5cbf3b3a4d976f54e06))
256
+
257
+
258
+
259
+
260
+
6
261
  # 2.0.0-alpha.3 (2023-02-13)
7
262
 
8
263
 
package/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import ReactDOM from 'react-dom';
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, katacodaLayout, title, path }) => {
19
+ const AppRoute = ({ child, title, path }) => {
20
20
  const pathname = useLocation().pathname;
21
21
  if (typeof window !== 'undefined' && window.gtag) {
22
- gtag('config', 'UA-47523816-6', {
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
- {!katacodaLayout && process.env.hasFooter && <Footer />}
34
+ {process.env.hasFooter && <Footer />}
35
35
  </React.Fragment>
36
36
  );
37
37
  }
@@ -39,18 +39,16 @@ 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] || !routes[pathname].katacodaLayout;
43
42
  return (
44
- <SideNavLayout groupedRoutes={groupedRoutes} navOpen={navOpen} >
43
+ <SideNavLayout groupedRoutes={groupedRoutes} navOpen={true} >
45
44
  <Router id="ws-page-content-router">
46
45
  {Object.entries(routes)
47
- .map(([path, { Component, title, sources, katacodaLayout, id }]) => Component
46
+ .map(([path, { Component, title, sources, id }]) => Component
48
47
  ? <AppRoute
49
48
  key={path}
50
49
  path={path}
51
50
  default={path === '/404'}
52
51
  child={<Component />}
53
- katacodaLayout={katacodaLayout}
54
52
  title={title}
55
53
  />
56
54
  : <AppRoute
@@ -65,7 +63,6 @@ const SideNavRouter = () => {
65
63
  componentsData={componentsData}
66
64
  />
67
65
  }
68
- katacodaLayout={katacodaLayout}
69
66
  title={title}
70
67
  />
71
68
  )
@@ -107,8 +104,12 @@ const isPrerender = process.env.PRERENDER;
107
104
  // Don't use ReactDOM in SSR
108
105
  if (!isPrerender) {
109
106
  function render() {
110
- const renderFn = isProd ? ReactDOM.hydrate : ReactDOM.render;
111
- renderFn(<App />, document.getElementById('root'));
107
+ const container = document.getElementById('root');
108
+ if (isProd) {
109
+ hydrateRoot(container, <App />);
110
+ } else {
111
+ createRoot(container).render(<App />);
112
+ }
112
113
  }
113
114
  // On first load, await promise for the current page to avoid flashing a "Loading..." state
114
115
  const Component = getAsyncComponent(null);
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { TextInput } from "@patternfly/react-core";
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 = (_change, event) => {
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
- <TextInput
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
- TableHeader,
6
- TableBody,
7
- sortable,
8
- SortByDirection,
9
- expandable
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
- sortBy: {
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
- filteredRows.push({
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
- <TableHeader />
228
- <TableBody />
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
  );
@@ -0,0 +1,57 @@
1
+ import React from "react";
2
+ import {
3
+ Table,
4
+ Caption,
5
+ Thead,
6
+ Tr,
7
+ Th,
8
+ Tbody,
9
+ Td,
10
+ } from "@patternfly/react-table";
11
+
12
+ export const FunctionsTable = ({ functionDescriptions }) => {
13
+ const columnNames = {
14
+ name: "Function name",
15
+ description: "Description",
16
+ signature: "Type signature",
17
+ defaultValues: "Default parameter values",
18
+ };
19
+
20
+ const formatDefaultValues = (parameters) =>
21
+ parameters.map((param) => `${param.name}: ${param.default}; `);
22
+
23
+ return (
24
+ <Table
25
+ aria-label="Function documentation table"
26
+ variant="compact"
27
+ >
28
+ <Caption>Table showing documentation for relevant functions</Caption>
29
+ <Thead>
30
+ <Tr>
31
+ <Th>{columnNames.name}</Th>
32
+ <Th>{columnNames.signature}</Th>
33
+ <Th>{columnNames.defaultValues}</Th>
34
+ <Th>{columnNames.description}</Th>
35
+ </Tr>
36
+ </Thead>
37
+ <Tbody>
38
+ {functionDescriptions.map((functionDescription) => (
39
+ <Tr key={functionDescription.functionName}>
40
+ <Td dataLabel={columnNames.name}>
41
+ {functionDescription.functionName}
42
+ </Td>
43
+ <Td dataLabel={columnNames.signature}>
44
+ {functionDescription.type}
45
+ </Td>
46
+ <Td dataLabel={columnNames.defaultValues}>
47
+ {formatDefaultValues(functionDescription.params)}
48
+ </Td>
49
+ <Td dataLabel={columnNames.description}>
50
+ {functionDescription.description}
51
+ </Td>
52
+ </Tr>
53
+ ))}
54
+ </Tbody>
55
+ </Table>
56
+ );
57
+ };