@patternfly/documentation-framework 2.0.0-alpha.4 → 2.0.0-alpha.40

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 (52) hide show
  1. package/CHANGELOG.md +339 -0
  2. package/app.js +12 -11
  3. package/components/autoLinkHeader/autoLinkHeader.css +2 -2
  4. package/components/cssVariables/cssSearch.js +3 -4
  5. package/components/cssVariables/cssVariables.css +4 -4
  6. package/components/cssVariables/cssVariables.js +72 -70
  7. package/components/example/example.css +29 -29
  8. package/components/example/example.js +4 -4
  9. package/components/footer/footer.css +15 -15
  10. package/components/footer/footer.js +13 -13
  11. package/components/functionsTable/functionsTable.js +57 -0
  12. package/components/gdprBanner/gdprBanner.css +2 -2
  13. package/components/gdprBanner/gdprBanner.js +3 -3
  14. package/components/inlineAlert/inlineAlert.js +1 -1
  15. package/components/propsTable/propsTable.js +85 -79
  16. package/components/sectionGallery/sectionDataListLayout.js +67 -0
  17. package/components/sectionGallery/sectionGallery.css +44 -0
  18. package/components/sectionGallery/sectionGallery.js +53 -0
  19. package/components/sectionGallery/sectionGalleryLayout.js +37 -0
  20. package/components/sectionGallery/sectionGalleryToolbar.js +30 -0
  21. package/components/sectionGallery/sectionGalleryWrapper.js +89 -0
  22. package/components/sideNav/sideNav.css +12 -12
  23. package/components/sideNav/sideNav.js +12 -5
  24. package/components/tableOfContents/tableOfContents.css +17 -17
  25. package/components/topNav/topNav.css +12 -12
  26. package/helpers/getTitle.js +2 -2
  27. package/layouts/sideNavLayout/sideNavLayout.css +7 -11
  28. package/layouts/sideNavLayout/sideNavLayout.js +57 -40
  29. package/package.json +28 -25
  30. package/pages/404/404.css +2 -2
  31. package/pages/404/index.js +4 -4
  32. package/pages/global-css-variables.md +16 -16
  33. package/pages/red-hat-font.md +1 -1
  34. package/routes.js +19 -5
  35. package/scripts/cli/build.js +6 -0
  36. package/scripts/cli/cli.js +2 -0
  37. package/scripts/cli/generate.js +2 -2
  38. package/scripts/cli/start.js +6 -8
  39. package/scripts/md/parseMD.js +40 -8
  40. package/scripts/md/styled-tags.js +2 -2
  41. package/scripts/tsDocgen.js +119 -91
  42. package/scripts/typeDocGen.js +209 -0
  43. package/scripts/webpack/webpack.base.config.js +34 -32
  44. package/scripts/webpack/webpack.client.config.js +11 -8
  45. package/scripts/webpack/webpack.server.config.js +8 -5
  46. package/scripts/writeScreenshots.js +3 -3
  47. package/templates/html.ejs +1 -3
  48. package/templates/mdx.css +155 -160
  49. package/templates/mdx.js +60 -43
  50. package/templates/patternfly-docs/content/extensions/extension/design-guidelines/design-guidelines.md +2 -0
  51. package/templates/patternfly-docs/content/extensions/extension/examples/basic.md +2 -0
  52. package/versions.json +29 -9
package/CHANGELOG.md CHANGED
@@ -3,6 +3,345 @@
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.40 (2023-05-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **docs:** use correct theme class on full page dark theme switcher ([#3532](https://github.com/patternfly/patternfly-org/issues/3532)) ([0008236](https://github.com/patternfly/patternfly-org/commit/0008236da2b105fd1789db2263323c59780b5194))
12
+
13
+
14
+
15
+
16
+
17
+ # 2.0.0-alpha.39 (2023-05-11)
18
+
19
+ **Note:** Version bump only for package @patternfly/documentation-framework
20
+
21
+
22
+
23
+
24
+
25
+ # 2.0.0-alpha.38 (2023-05-11)
26
+
27
+ **Note:** Version bump only for package @patternfly/documentation-framework
28
+
29
+
30
+
31
+
32
+
33
+ # 2.0.0-alpha.37 (2023-05-10)
34
+
35
+ **Note:** Version bump only for package @patternfly/documentation-framework
36
+
37
+
38
+
39
+
40
+
41
+ # 2.0.0-alpha.36 (2023-05-10)
42
+
43
+ **Note:** Version bump only for package @patternfly/documentation-framework
44
+
45
+
46
+
47
+
48
+
49
+ # 2.0.0-alpha.35 (2023-05-09)
50
+
51
+
52
+ ### Bug Fixes
53
+
54
+ * **org:** Fix up org css issues after doc framework update ([#3518](https://github.com/patternfly/patternfly-org/issues/3518)) ([a6f20c5](https://github.com/patternfly/patternfly-org/commit/a6f20c569a8ba8df2da23722c48f73f750e229e3))
55
+
56
+
57
+
58
+
59
+
60
+ # 2.0.0-alpha.34 (2023-05-05)
61
+
62
+
63
+ ### Features
64
+
65
+ * **docs:** Update docs framework with latest react code ([#3517](https://github.com/patternfly/patternfly-org/issues/3517)) ([2df0147](https://github.com/patternfly/patternfly-org/commit/2df014737dbbe35033d0b28ee71b40d5fbe22ed2))
66
+
67
+
68
+
69
+
70
+
71
+ # 2.0.0-alpha.33 (2023-05-04)
72
+
73
+
74
+ ### Bug Fixes
75
+
76
+ * **css:** update css selectors for v5 versioning ([#3516](https://github.com/patternfly/patternfly-org/issues/3516)) ([f681945](https://github.com/patternfly/patternfly-org/commit/f681945e2de1200fbb7d2d6ab8262091b1e72a8e))
77
+
78
+
79
+
80
+
81
+
82
+ # 2.0.0-alpha.32 (2023-05-02)
83
+
84
+ **Note:** Version bump only for package @patternfly/documentation-framework
85
+
86
+
87
+
88
+
89
+
90
+ # 2.0.0-alpha.31 (2023-05-01)
91
+
92
+
93
+ ### Bug Fixes
94
+
95
+ * update Text component summary to fix build ([64b3590](https://github.com/patternfly/patternfly-org/commit/64b359029fa14be143ddec212fdf89a3033145d5))
96
+
97
+
98
+
99
+
100
+
101
+ # 2.0.0-alpha.30 (2023-04-27)
102
+
103
+
104
+ ### Bug Fixes
105
+
106
+ * white space change to test CI ([e9e7ed3](https://github.com/patternfly/patternfly-org/commit/e9e7ed3cf6007fcf022dd7693bfed12bdf9d7e9a))
107
+
108
+
109
+
110
+
111
+
112
+ # 2.0.0-alpha.29 (2023-04-26)
113
+
114
+
115
+ ### Bug Fixes
116
+
117
+ * sidebar open by default ([#3506](https://github.com/patternfly/patternfly-org/issues/3506)) ([fb5f086](https://github.com/patternfly/patternfly-org/commit/fb5f08611d3edde80a559635b39dab7138f06d1d))
118
+
119
+
120
+
121
+
122
+
123
+ # 2.0.0-alpha.28 (2023-04-26)
124
+
125
+ **Note:** Version bump only for package @patternfly/documentation-framework
126
+
127
+
128
+
129
+
130
+
131
+ # 2.0.0-alpha.27 (2023-04-25)
132
+
133
+
134
+ ### Bug Fixes
135
+
136
+ * **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))
137
+
138
+
139
+
140
+
141
+
142
+ # 2.0.0-alpha.26 (2023-04-21)
143
+
144
+ **Note:** Version bump only for package @patternfly/documentation-framework
145
+
146
+
147
+
148
+
149
+
150
+ # 2.0.0-alpha.25 (2023-04-19)
151
+
152
+ **Note:** Version bump only for package @patternfly/documentation-framework
153
+
154
+
155
+
156
+
157
+
158
+ # 2.0.0-alpha.24 (2023-04-17)
159
+
160
+ **Note:** Version bump only for package @patternfly/documentation-framework
161
+
162
+
163
+
164
+
165
+
166
+ # 2.0.0-alpha.23 (2023-04-17)
167
+
168
+
169
+ ### Features
170
+
171
+ * **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))
172
+
173
+
174
+
175
+
176
+
177
+ # 2.0.0-alpha.22 (2023-04-17)
178
+
179
+ **Note:** Version bump only for package @patternfly/documentation-framework
180
+
181
+
182
+
183
+
184
+
185
+ # 2.0.0-alpha.21 (2023-04-15)
186
+
187
+
188
+ ### Bug Fixes
189
+
190
+ * clean up references to katacoda ([#3491](https://github.com/patternfly/patternfly-org/issues/3491)) ([5de986b](https://github.com/patternfly/patternfly-org/commit/5de986b917ee7edf9c476bb2df2f2ee4d454a7e1))
191
+
192
+
193
+
194
+
195
+
196
+ # 2.0.0-alpha.20 (2023-04-14)
197
+
198
+ **Note:** Version bump only for package @patternfly/documentation-framework
199
+
200
+
201
+
202
+
203
+
204
+ # 2.0.0-alpha.19 (2023-04-12)
205
+
206
+ **Note:** Version bump only for package @patternfly/documentation-framework
207
+
208
+
209
+
210
+
211
+
212
+ # 2.0.0-alpha.18 (2023-04-11)
213
+
214
+
215
+ ### Bug Fixes
216
+
217
+ * **cssVariables:** Update expandId ([b9b0a6e](https://github.com/patternfly/patternfly-org/commit/b9b0a6edcc103c442f24caae086b68558415be57))
218
+
219
+
220
+
221
+
222
+
223
+ # 2.0.0-alpha.17 (2023-04-11)
224
+
225
+
226
+ ### Bug Fixes
227
+
228
+ * **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))
229
+
230
+
231
+
232
+
233
+
234
+ # 2.0.0-alpha.16 (2023-04-11)
235
+
236
+
237
+ ### Features
238
+
239
+ * **tables:** update tables, context selector ([#3474](https://github.com/patternfly/patternfly-org/issues/3474)) ([cd82c35](https://github.com/patternfly/patternfly-org/commit/cd82c356f568f3368bc22319d614fde8dd74fb38))
240
+
241
+
242
+
243
+
244
+
245
+ # 2.0.0-alpha.15 (2023-04-06)
246
+
247
+ **Note:** Version bump only for package @patternfly/documentation-framework
248
+
249
+
250
+
251
+
252
+
253
+ # 2.0.0-alpha.14 (2023-04-03)
254
+
255
+
256
+ ### Bug Fixes
257
+
258
+ * **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))
259
+
260
+
261
+
262
+
263
+
264
+ # 2.0.0-alpha.13 (2023-03-31)
265
+
266
+ **Note:** Version bump only for package @patternfly/documentation-framework
267
+
268
+
269
+
270
+
271
+
272
+ # 2.0.0-alpha.12 (2023-03-30)
273
+
274
+ **Note:** Version bump only for package @patternfly/documentation-framework
275
+
276
+
277
+
278
+
279
+
280
+ # 2.0.0-alpha.11 (2023-03-29)
281
+
282
+ **Note:** Version bump only for package @patternfly/documentation-framework
283
+
284
+
285
+
286
+
287
+
288
+ # 2.0.0-alpha.10 (2023-03-15)
289
+
290
+ **Note:** Version bump only for package @patternfly/documentation-framework
291
+
292
+
293
+
294
+
295
+
296
+ # 2.0.0-alpha.9 (2023-03-09)
297
+
298
+
299
+ ### Bug Fixes
300
+
301
+ * **versions:** fix typo ([a9b8fe2](https://github.com/patternfly/patternfly-org/commit/a9b8fe296a9c28bdd9ada01a80b1653810802ddf))
302
+
303
+
304
+
305
+
306
+
307
+ # 2.0.0-alpha.8 (2023-03-03)
308
+
309
+
310
+ ### Features
311
+
312
+ * **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))
313
+
314
+
315
+
316
+
317
+
318
+ # 2.0.0-alpha.7 (2023-03-01)
319
+
320
+ **Note:** Version bump only for package @patternfly/documentation-framework
321
+
322
+
323
+
324
+
325
+
326
+ # 2.0.0-alpha.6 (2023-03-01)
327
+
328
+ **Note:** Version bump only for package @patternfly/documentation-framework
329
+
330
+
331
+
332
+
333
+
334
+ # 2.0.0-alpha.5 (2023-03-01)
335
+
336
+
337
+ ### Bug Fixes
338
+
339
+ * **404 Page:** Removed CardHeaderMain ([#3429](https://github.com/patternfly/patternfly-org/issues/3429)) ([6169fed](https://github.com/patternfly/patternfly-org/commit/6169fedd3dc57b9c206197c498d6cebc559e2a93))
340
+
341
+
342
+
343
+
344
+
6
345
  # 2.0.0-alpha.4 (2023-02-27)
7
346
 
8
347
 
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);
@@ -3,8 +3,8 @@
3
3
  }
4
4
 
5
5
  .ws-heading-anchor {
6
- color: var(--pf-global--Color--100);
7
- transform: translate(calc(-100% - var(--pf-global--spacer--xs)), -50%);
6
+ color: var(--pf-v5-global--Color--100);
7
+ transform: translate(calc(-100% - var(--pf-v5-global--spacer--xs)), -50%);
8
8
  opacity: 0;
9
9
  position: absolute;
10
10
  left: 0;
@@ -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,14 +2,14 @@
2
2
  display: inline-block;
3
3
  height: 18px;
4
4
  width: 18px;
5
- border: var(--pf-global--BorderWidth--sm) solid var(--pf-global--BorderColor--200);
6
- border-radius: var(--pf-global--BorderRadius--lg);
5
+ border: var(--pf-v5-global--BorderWidth--sm) solid var(--pf-v5-global--BorderColor--200);
6
+ border-radius: var(--pf-v5-global--BorderRadius--lg);
7
7
  }
8
8
 
9
9
  .ws-td-text {
10
- font-size: var(--pf-global--FontSize--sm) !important;
10
+ font-size: var(--pf-v5-global--FontSize--sm) !important;
11
11
  }
12
12
 
13
13
  .ws-css-property {
14
- padding: var(--pf-global--spacer--xs) var(--pf-global--spacer--md);
14
+ padding: var(--pf-v5-global--spacer--xs) var(--pf-v5-global--spacer--md);
15
15
  }
@@ -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
 
@@ -116,12 +103,12 @@ export class CSSVariables extends React.Component {
116
103
  <div key={rowKey}>
117
104
  <div
118
105
  key={`${rowKey}_1`}
119
- className="pf-l-flex pf-m-space-items-sm"
106
+ className="pf-v5-l-flex pf-m-space-items-sm"
120
107
  >
121
108
  {isColorRegex.test(value) && (
122
109
  <div
123
110
  key={`${rowKey}_2`}
124
- className="pf-l-flex pf-m-column pf-m-align-self-center"
111
+ className="pf-v5-l-flex pf-m-column pf-m-align-self-center"
125
112
  >
126
113
  <span
127
114
  className="ws-color-box"
@@ -131,7 +118,7 @@ export class CSSVariables extends React.Component {
131
118
  )}
132
119
  <div
133
120
  key={`${rowKey}_3`}
134
- className="pf-l-flex pf-m-column pf-m-align-self-center ws-td-text"
121
+ className="pf-v5-l-flex pf-m-column pf-m-align-self-center ws-td-text"
135
122
  >
136
123
  {value}
137
124
  </div>
@@ -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
  );