@patternfly/documentation-framework 2.0.0-alpha.2 → 2.0.0-alpha.20

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,177 @@
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.20 (2023-04-14)
7
+
8
+ **Note:** Version bump only for package @patternfly/documentation-framework
9
+
10
+
11
+
12
+
13
+
14
+ # 2.0.0-alpha.19 (2023-04-12)
15
+
16
+ **Note:** Version bump only for package @patternfly/documentation-framework
17
+
18
+
19
+
20
+
21
+
22
+ # 2.0.0-alpha.18 (2023-04-11)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **cssVariables:** Update expandId ([b9b0a6e](https://github.com/patternfly/patternfly-org/commit/b9b0a6edcc103c442f24caae086b68558415be57))
28
+
29
+
30
+
31
+
32
+
33
+ # 2.0.0-alpha.17 (2023-04-11)
34
+
35
+
36
+ ### Bug Fixes
37
+
38
+ * **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))
39
+
40
+
41
+
42
+
43
+
44
+ # 2.0.0-alpha.16 (2023-04-11)
45
+
46
+
47
+ ### Features
48
+
49
+ * **tables:** update tables, context selector ([#3474](https://github.com/patternfly/patternfly-org/issues/3474)) ([cd82c35](https://github.com/patternfly/patternfly-org/commit/cd82c356f568f3368bc22319d614fde8dd74fb38))
50
+
51
+
52
+
53
+
54
+
55
+ # 2.0.0-alpha.15 (2023-04-06)
56
+
57
+ **Note:** Version bump only for package @patternfly/documentation-framework
58
+
59
+
60
+
61
+
62
+
63
+ # 2.0.0-alpha.14 (2023-04-03)
64
+
65
+
66
+ ### Bug Fixes
67
+
68
+ * **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))
69
+
70
+
71
+
72
+
73
+
74
+ # 2.0.0-alpha.13 (2023-03-31)
75
+
76
+ **Note:** Version bump only for package @patternfly/documentation-framework
77
+
78
+
79
+
80
+
81
+
82
+ # 2.0.0-alpha.12 (2023-03-30)
83
+
84
+ **Note:** Version bump only for package @patternfly/documentation-framework
85
+
86
+
87
+
88
+
89
+
90
+ # 2.0.0-alpha.11 (2023-03-29)
91
+
92
+ **Note:** Version bump only for package @patternfly/documentation-framework
93
+
94
+
95
+
96
+
97
+
98
+ # 2.0.0-alpha.10 (2023-03-15)
99
+
100
+ **Note:** Version bump only for package @patternfly/documentation-framework
101
+
102
+
103
+
104
+
105
+
106
+ # 2.0.0-alpha.9 (2023-03-09)
107
+
108
+
109
+ ### Bug Fixes
110
+
111
+ * **versions:** fix typo ([a9b8fe2](https://github.com/patternfly/patternfly-org/commit/a9b8fe296a9c28bdd9ada01a80b1653810802ddf))
112
+
113
+
114
+
115
+
116
+
117
+ # 2.0.0-alpha.8 (2023-03-03)
118
+
119
+
120
+ ### Features
121
+
122
+ * **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))
123
+
124
+
125
+
126
+
127
+
128
+ # 2.0.0-alpha.7 (2023-03-01)
129
+
130
+ **Note:** Version bump only for package @patternfly/documentation-framework
131
+
132
+
133
+
134
+
135
+
136
+ # 2.0.0-alpha.6 (2023-03-01)
137
+
138
+ **Note:** Version bump only for package @patternfly/documentation-framework
139
+
140
+
141
+
142
+
143
+
144
+ # 2.0.0-alpha.5 (2023-03-01)
145
+
146
+
147
+ ### Bug Fixes
148
+
149
+ * **404 Page:** Removed CardHeaderMain ([#3429](https://github.com/patternfly/patternfly-org/issues/3429)) ([6169fed](https://github.com/patternfly/patternfly-org/commit/6169fedd3dc57b9c206197c498d6cebc559e2a93))
150
+
151
+
152
+
153
+
154
+
155
+ # 2.0.0-alpha.4 (2023-02-27)
156
+
157
+
158
+ ### Bug Fixes
159
+
160
+ * **README:** small wording change to test build ([45ede1b](https://github.com/patternfly/patternfly-org/commit/45ede1b356392df6982fd5cbf3b3a4d976f54e06))
161
+
162
+
163
+
164
+
165
+
166
+ # 2.0.0-alpha.3 (2023-02-13)
167
+
168
+
169
+ ### Bug Fixes
170
+
171
+ * **whitespace:** test github actions ([de769f0](https://github.com/patternfly/patternfly-org/commit/de769f0d47e770af07caf9370ae72f76ab66c8a8))
172
+
173
+
174
+
175
+
176
+
6
177
  # 2.0.0-alpha.2 (2023-02-13)
7
178
 
8
179
 
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';
@@ -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', 'UA-47523816-6', {
22
+ gtag('config', process.env.googleAnalyticsID, {
23
23
  'page_path': pathname,
24
24
  'page_title': (title || pathname)
25
25
  });
@@ -107,8 +107,12 @@ const isPrerender = process.env.PRERENDER;
107
107
  // Don't use ReactDOM in SSR
108
108
  if (!isPrerender) {
109
109
  function render() {
110
- const renderFn = isProd ? ReactDOM.hydrate : ReactDOM.render;
111
- renderFn(<App />, document.getElementById('root'));
110
+ const container = document.getElementById('root');
111
+ if (isProd) {
112
+ hydrateRoot(container, <App />);
113
+ } else {
114
+ createRoot(container).render(<App />);
115
+ }
112
116
  }
113
117
  // On first load, await promise for the current page to avoid flashing a "Loading..." state
114
118
  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
  );
@@ -2,90 +2,96 @@ import React from "react";
2
2
  import { Badge } from "@patternfly/react-core";
3
3
  import {
4
4
  Table,
5
- TableHeader,
6
- TableBody,
7
- cellWidth,
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
- const columns = [
16
- { title: "Name", transforms: [cellWidth(20)] },
17
- { title: "Type", transforms: [cellWidth(20)] },
18
- { title: "Default", transforms: [] },
19
- { title: "Description", transforms: [] },
20
- ];
21
-
22
- return (
23
- <React.Fragment>
24
- <AutoLinkHeader size="h3">{title}</AutoLinkHeader>
25
- <Table
26
- className="pf-u-mt-md pf-u-mb-lg"
27
- variant="compact"
28
- aria-label={title}
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
- }
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
- cells: [
44
- <div className="pf-m-break-word">
45
- {row.deprecated && "Deprecated: "}
46
- {row.name}
47
- {row.required ? (
48
- <React.Fragment key={`${row.name}-required-prop`}>
49
- <span
50
- aria-hidden="true"
51
- key={`${row.name}-asterisk`}
52
- className="ws-prop-required"
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
- Beta
72
- </Badge>
73
- )}
74
- </div>,
75
- <div className="pf-m-break-word">
76
- <PropTypeWithLinks
77
- type={row.type}
78
- allPropComponents={allPropComponents}
79
- />
80
- </div>,
81
- <div className="pf-m-break-word">{row.defaultValue}</div>,
82
- <div className="pf-m-break-word">{row.description}</div>,
83
- ],
84
- }))}
85
- >
86
- <TableHeader />
87
- <TableBody />
88
- </Table>
89
- </React.Fragment>
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, { hideNavItem }]) => !Boolean(hideNavItem) && (id !== 'isSubsection'))
71
- .map(([id, { slug, isSubsection = false }]) => ({ text: id, href: slug, isSubsection }))
72
- .sort(({ text: text1 }, { text: text2 }) => text1.localeCompare(text2))
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)
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
2
  getTitle(title) {
3
- return `PatternFly 4${title ? ` • ${title}` : ''}`;
3
+ return `PatternFly${title ? ` • ${title}` : ''}`;
4
4
  }
5
- }
5
+ }
@@ -12,10 +12,6 @@
12
12
  padding: 0 var(--pf-global--spacer--md);
13
13
  }
14
14
 
15
- .ws-patternfly-3 > svg {
16
- margin-left: var(--pf-global--spacer--sm);
17
- }
18
-
19
15
  @media (min-width: 1200px) {
20
16
  .ws-page-sidebar {
21
17
  box-shadow: none !important;