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

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 +350 -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
@@ -3,52 +3,52 @@
3
3
  }
4
4
 
5
5
  .ws-example {
6
- margin-top: var(--pf-global--spacer--lg);
7
- margin-bottom: var(--pf-global--spacer--lg);
6
+ margin-top: var(--pf-v5-global--spacer--lg);
7
+ margin-bottom: var(--pf-v5-global--spacer--lg);
8
8
  }
9
9
 
10
10
  .ws-example > .ws-example-header {
11
- padding: var(--pf-global--spacer--md);
11
+ padding: var(--pf-v5-global--spacer--md);
12
12
  }
13
13
 
14
14
  .ws-example-header > .ws-example-heading:not(:last-child) {
15
- margin-bottom: var(--pf-global--spacer--md);
15
+ margin-bottom: var(--pf-v5-global--spacer--md);
16
16
  }
17
17
 
18
- .ws-code-editor:not(.ws-example-code-expanded) > .pf-c-code-editor__header::before {
19
- --pf-c-code-editor__header--before--BorderBottomWidth: 0;
18
+ .ws-code-editor:not(.ws-example-code-expanded) > .pf-v5-c-code-editor__header::before {
19
+ --pf-v5-c-code-editor__header--before--BorderBottomWidth: 0;
20
20
  }
21
21
 
22
22
  .ws-code-editor-control {
23
- --pf-c-button--m-control--BackgroundColor: transparent;
24
- --pf-c-button--m-control--active--BackgroundColor: transparent;
25
- --pf-c-button--m-control--focus--BackgroundColor: transparent;
26
- --pf-c-button--m-control--hover--BackgroundColor: transparent;
23
+ --pf-v5-c-button--m-control--BackgroundColor: transparent;
24
+ --pf-v5-c-button--m-control--active--BackgroundColor: transparent;
25
+ --pf-v5-c-button--m-control--focus--BackgroundColor: transparent;
26
+ --pf-v5-c-button--m-control--hover--BackgroundColor: transparent;
27
27
  }
28
28
 
29
- .ws-code-editor-control.pf-c-button {
30
- --pf-c-button--after--BorderWidth: 0;
29
+ .ws-code-editor-control.pf-v5-c-button {
30
+ --pf-v5-c-button--after--BorderWidth: 0;
31
31
  }
32
32
 
33
33
  .ws-preview {
34
- padding: var(--pf-global--spacer--md);
35
- background-color: var(--pf-global--BackgroundColor--100);
36
- border-bottom: var(--pf-global--BorderWidth--sm) solid var(--pf-global--BorderColor--300);
34
+ padding: var(--pf-v5-global--spacer--md);
35
+ background-color: var(--pf-v5-global--BackgroundColor--100);
36
+ border-bottom: var(--pf-v5-global--BorderWidth--sm) solid var(--pf-v5-global--BorderColor--300);
37
37
  transition: width .2s ease-in-out;
38
38
  }
39
39
 
40
40
  .ws-core-c-page.ws-preview > .ws-preview-html,
41
- .ws-react-c-page.ws-preview > .pf-c-page {
41
+ .ws-react-c-page.ws-preview > .pf-v5-c-page {
42
42
  overflow: hidden;
43
43
  }
44
44
 
45
45
  .ws-editor {
46
- font-size: var(--pf-global--FontSize--md);
46
+ font-size: var(--pf-v5-global--FontSize--md);
47
47
  }
48
48
 
49
49
  .ws-editor .token.punctuation,
50
50
  .ws-editor .token.operator {
51
- color: var(--pf-global--danger-color--100);
51
+ color: var(--pf-v5-global--danger-color--100);
52
52
  }
53
53
 
54
54
  .ws-preview__thumbnail-link {
@@ -100,22 +100,22 @@
100
100
  color: rgba(255,255,255,.4);
101
101
  }
102
102
 
103
- .pf-c-badge.ws-beta-badge {
104
- --pf-c-badge--m-unread--BackgroundColor: var(--pf-global--BackgroundColor--100);
105
- --pf-c-badge--m-unread--Color: var(--pf-global--primary-color--100);
106
- border: var(--pf-global--BorderWidth--sm) solid var(--pf-global--primary-color--100);
103
+ .pf-v5-c-badge.ws-beta-badge {
104
+ --pf-v5-c-badge--m-unread--BackgroundColor: var(--pf-v5-global--BackgroundColor--100);
105
+ --pf-v5-c-badge--m-unread--Color: var(--pf-v5-global--primary-color--100);
106
+ border: var(--pf-v5-global--BorderWidth--sm) solid var(--pf-v5-global--primary-color--100);
107
107
  }
108
108
 
109
109
  .ws-prop-required {
110
- color: var(--pf-global--danger-color--100);
110
+ color: var(--pf-v5-global--danger-color--100);
111
111
  }
112
112
 
113
113
  .ws-theme-switch-full-page {
114
114
  position: fixed;
115
115
  right: 0;
116
116
  bottom: 0;
117
- padding: var(--pf-global--spacer--md);
118
- z-index: var(--pf-global--ZIndex--2xl);
117
+ padding: var(--pf-v5-global--spacer--md);
118
+ z-index: var(--pf-v5-global--ZIndex--2xl);
119
119
  }
120
120
 
121
121
  .ws-theme-switch-full-page::before {
@@ -125,11 +125,11 @@
125
125
  content: "";
126
126
  width: 100%;
127
127
  height: 100%;
128
- background-color: var(--pf-global--BackgroundColor--100);
128
+ background-color: var(--pf-v5-global--BackgroundColor--100);
129
129
  opacity: 0.8;
130
- box-shadow: var(--pf-global--BoxShadow--sm);
130
+ box-shadow: var(--pf-v5-global--BoxShadow--sm);
131
131
  }
132
132
 
133
- .pf-theme-dark .ws-theme-switch-full-page::before {
134
- background-color: var(--pf-global--BackgroundColor--300);
133
+ .pf-v5-theme-dark .ws-theme-switch-full-page::before {
134
+ background-color: var(--pf-v5-global--BackgroundColor--300);
135
135
  }
@@ -119,7 +119,7 @@ export const Example = ({
119
119
  if (lang === 'html') {
120
120
  livePreview = (
121
121
  <div
122
- className={css('ws-preview-html', isFullscreenPreview && 'pf-u-h-100')}
122
+ className={css('ws-preview-html', isFullscreenPreview && 'pf-v5-u-h-100')}
123
123
  dangerouslySetInnerHTML={{ __html: editorCode }}
124
124
  />
125
125
  );
@@ -152,12 +152,12 @@ export const Example = ({
152
152
 
153
153
  if (isFullscreenPreview) {
154
154
  return (
155
- <div id={previewId} className={css(className, 'pf-u-h-100')}>
155
+ <div id={previewId} className={css(className, 'pf-v5-u-h-100')}>
156
156
  {livePreview}
157
157
  {hasDarkThemeSwitcher && (
158
158
  <div className="ws-theme-switch-full-page">
159
159
  <Switch id="ws-theme-switch" label="Dark theme" defaultChecked={false} onChange={() =>
160
- document.querySelector('html').classList.toggle('pf-theme-dark')} />
160
+ document.querySelector('html').classList.toggle('pf-v5-theme-dark')} />
161
161
  </div>
162
162
  )}
163
163
  </div>
@@ -178,7 +178,7 @@ export const Example = ({
178
178
  <div className="ws-example">
179
179
  <div className="ws-example-header">
180
180
  <AutoLinkHeader
181
- metaText={isBeta && <Badge className="ws-beta-badge pf-u-ml-xs">Beta</Badge>}
181
+ metaText={isBeta && <Badge className="ws-beta-badge pf-v5-u-ml-xs">Beta</Badge>}
182
182
  size="h4"
183
183
  headingLevel="h3"
184
184
  className="ws-example-heading"
@@ -1,11 +1,11 @@
1
- .ws-org-pfsite-l-footer.pf-c-page__main-section {
1
+ .ws-org-pfsite-l-footer.pf-v5-c-page__main-section {
2
2
  font-family: "RedHatText";
3
3
  font-weight: 300;
4
4
  background-color: #1a1a1a !important;
5
- --pf-c-page__main-section--PaddingTop: var(--pf-global--spacer--xl);
6
- --pf-c-page__main-section--PaddingRight: var(--pf-global--spacer--2xl);
7
- --pf-c-page__main-section--PaddingBottom: var(--pf-global--spacer--2xl);
8
- --pf-c-page__main-section--PaddingLeft: var(--pf-global--spacer--2xl);
5
+ --pf-v5-c-page__main-section--PaddingTop: var(--pf-v5-global--spacer--xl);
6
+ --pf-v5-c-page__main-section--PaddingRight: var(--pf-v5-global--spacer--2xl);
7
+ --pf-v5-c-page__main-section--PaddingBottom: var(--pf-v5-global--spacer--2xl);
8
+ --pf-v5-c-page__main-section--PaddingLeft: var(--pf-v5-global--spacer--2xl);
9
9
  /* Hide long overflowing tocs */
10
10
  z-index: 1;
11
11
  }
@@ -34,8 +34,8 @@
34
34
  }
35
35
  }
36
36
  .ws-org-pfsite-l-footer-column .ws-org-pfsite-footer-menu-social-links a {
37
- margin-right: var(--pf-global--spacer--md);
38
- color: var(--pf-global--Color--light-100) !important;
37
+ margin-right: var(--pf-v5-global--spacer--md);
38
+ color: var(--pf-v5-global--Color--light-100) !important;
39
39
  }
40
40
  .ws-org-pfsite-l-footer-column
41
41
  .ws-org-pfsite-footer-menu-social-links
@@ -43,8 +43,8 @@
43
43
  margin-right: 0;
44
44
  }
45
45
  .ws-org-pfsite-l-footer-column .ws-org-pfsite-footer-menu-social-links {
46
- margin-top: var(--pf-global--spacer--md);
47
- margin-bottom: var(--pf-global--spacer--md);
46
+ margin-top: var(--pf-v5-global--spacer--md);
47
+ margin-bottom: var(--pf-v5-global--spacer--md);
48
48
  }
49
49
  @media (max-width: 768px) {
50
50
  .ws-org-pfsite-l-footer-column .ws-org-pfsite-footer-menu-social-links {
@@ -71,7 +71,7 @@
71
71
  padding-right: 10px;
72
72
  }
73
73
  .ws-org-pfsite-l-footer .ws-org-pfsite-footer-menu-link {
74
- color: var(--pf-global--Color--light-100);
74
+ color: var(--pf-v5-global--Color--light-100);
75
75
  font-size: 14px !important;
76
76
  }
77
77
  .ws-org-pfsite-l-footer .ws-org-pfsite-footer-menu-link:hover {
@@ -86,19 +86,19 @@
86
86
  .ws-org-pfsite-l-footer-dark {
87
87
  background: #151515 !important;
88
88
  }
89
- .pf-c-page .pf-c-page__main-section.ws-org-pfsite-l-footer-dark {
89
+ .pf-v5-c-page .pf-v5-c-page__main-section.ws-org-pfsite-l-footer-dark {
90
90
  /* Hide long overflowing tocs */
91
91
  z-index: 1;
92
92
  }
93
- .pf-c-page__main-section.ws-org-pfsite-l-footer-dark > * {
93
+ .pf-v5-c-page__main-section.ws-org-pfsite-l-footer-dark > * {
94
94
  font-weight: 300;
95
95
  font-size: 12px;
96
96
  color: #d2d2d2;
97
97
  }
98
98
  .ws-org-pfsite-l-footer-dark a {
99
- padding-right: var(--pf-global--spacer--sm);
100
- padding-left: var(--pf-global--spacer--sm);
101
- border-right: var(--pf-global--BorderWidth--sm) solid #d2d2d2;
99
+ padding-right: var(--pf-v5-global--spacer--sm);
100
+ padding-left: var(--pf-v5-global--spacer--sm);
101
+ border-right: var(--pf-v5-global--BorderWidth--sm) solid #d2d2d2;
102
102
  font-weight: 300;
103
103
  color: #d2d2d2;
104
104
  text-decoration: underline;
@@ -19,12 +19,12 @@ export const Footer = () => (
19
19
  sm={12}
20
20
  md={6}
21
21
  mdOffset={1}
22
- className="pf-u-mb-lg pf-u-mb-0-on-sm"
22
+ className="pf-v5-u-mb-lg pf-v5-u-mb-0-on-sm"
23
23
  >
24
- <Grid className="pf-u-py-xl">
25
- <GridItem sm={6} md={4} className="pf-u-ml-md pf-u-ml-0-on-md pf-u-mb-xl pf-u-mb-0-on-md">
24
+ <Grid className="pf-v5-u-py-xl">
25
+ <GridItem sm={6} md={4} className="pf-v5-u-ml-md pf-v5-u-ml-0-on-md pf-v5-u-mb-xl pf-v5-u-mb-0-on-md">
26
26
  <p
27
- className="pf-c-title ws-org-pfsite-footer-menu-list-title"
27
+ className="pf-v5-c-title ws-org-pfsite-footer-menu-list-title"
28
28
  >
29
29
  QUICKLINKS
30
30
  </p>
@@ -82,10 +82,10 @@ export const Footer = () => (
82
82
  <GridItem
83
83
  sm={6}
84
84
  md={4}
85
- className="pf-u-mt-lg pf-u-mt-0-on-sm pf-u-ml-md pf-u-ml-0-on-md pf-u-mb-xl pf-u-mb-0-on-md"
85
+ className="pf-v5-u-mt-lg pf-v5-u-mt-0-on-sm pf-v5-u-ml-md pf-v5-u-ml-0-on-md pf-v5-u-mb-xl pf-v5-u-mb-0-on-md"
86
86
  >
87
87
  <p
88
- className="pf-c-title ws-org-pfsite-footer-menu-list-title"
88
+ className="pf-v5-c-title ws-org-pfsite-footer-menu-list-title"
89
89
  >
90
90
  CONTRIBUTE
91
91
  </p>
@@ -125,7 +125,7 @@ export const Footer = () => (
125
125
  <GridItem
126
126
  sm={6}
127
127
  md={4}
128
- className="pf-u-mt-lg pf-u-mt-0-on-md pf-u-ml-md pf-u-ml-0-on-md"
128
+ className="pf-v5-u-mt-lg pf-v5-u-mt-0-on-md pf-v5-u-ml-md pf-v5-u-ml-0-on-md"
129
129
  >
130
130
  <p
131
131
  className="ws-org-pfsite-footer-menu-list-title"
@@ -180,10 +180,10 @@ export const Footer = () => (
180
180
  </Grid>
181
181
  </GridItem>
182
182
  <GridItem sm={12} md={4}>
183
- <Grid className="pf-u-pt-xl ws-org-pfsite-l-footer-column">
184
- <GridItem className="pf-u-px-xl">
183
+ <Grid className="pf-v5-u-pt-xl ws-org-pfsite-l-footer-column">
184
+ <GridItem className="pf-v5-u-px-xl">
185
185
  <Link
186
- className="pf-c-page__header-brand-link pf-c-brand ws-org-pfsite-footer-menu-about-logo pf-u-pb-md"
186
+ className="pf-v5-c-page__header-brand-link pf-v5-c-brand ws-org-pfsite-footer-menu-about-logo pf-v5-u-pb-md"
187
187
  to="/"
188
188
  >
189
189
  <Brand src={logo} alt="Patternfly Logo" />
@@ -192,7 +192,7 @@ export const Footer = () => (
192
192
  PatternFly is an open source design system built to drive consistency and unify teams. From documentation and components to code examples and tutorials, PatternFly is a place where design and development can thrive. We’re on a mission to help teams build consistent, accessible, and scalable enterprise product experiences—the open source way.
193
193
  </p>
194
194
  </GridItem>
195
- <GridItem className="ws-org-pfsite-footer-menu-social-links pf-u-px-xl">
195
+ <GridItem className="ws-org-pfsite-footer-menu-social-links pf-v5-u-px-xl">
196
196
  <Link
197
197
  to="//github.com/patternfly"
198
198
  target="top"
@@ -213,7 +213,7 @@ export const Footer = () => (
213
213
  </Grid>
214
214
  </PageSection>
215
215
  <PageSection key="footer-2" className="ws-org-pfsite-l-footer-dark pf-m-no-fill">
216
- <Grid className="pf-u-py-xl-on-sm pf-u-py-0-on-md pf-u-align-items-center">
216
+ <Grid className="pf-v5-u-py-xl-on-sm pf-v5-u-py-0-on-md pf-v5-u-align-items-center">
217
217
  <GridItem md={2} mdOffset={1}>
218
218
  <Link
219
219
  to="//www.redhat.com"
@@ -233,7 +233,7 @@ export const Footer = () => (
233
233
  Copyright &copy; 2022 Red Hat, Inc.
234
234
  </span>
235
235
  </GridItem>
236
- <GridItem md={4} lg={5} className="pf-u-ml-xl-on-xl">
236
+ <GridItem md={4} lg={5} className="pf-v5-u-ml-xl-on-xl">
237
237
  <Link
238
238
  to="//www.redhat.com/en/about/privacy-policy"
239
239
  target="top"
@@ -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
+ };
@@ -9,6 +9,6 @@
9
9
  #ws-gdpr-banner {
10
10
  max-width: 95vw;
11
11
  flex-wrap: nowrap;
12
- background: var(--pf-global--BackgroundColor--100);
13
- border: var(--pf-global--BorderWidth--sm) solid var(--pf-global--Color--100);
12
+ background: var(--pf-v5-global--BackgroundColor--100);
13
+ border: var(--pf-v5-global--BorderWidth--sm) solid var(--pf-v5-global--Color--100);
14
14
  }
@@ -13,9 +13,9 @@ export const GdprBanner = () => {
13
13
  }
14
14
 
15
15
  return !isBannerOpen ? null : (
16
- <div className="ws-gdpr-banner-container pf-l-flex">
17
- <div id="ws-gdpr-banner" className="pf-l-flex pf-u-py-md pf-m-align-items-center">
18
- <p id="ws-gdpr-banner-text" className="pf-u-ml-xl">
16
+ <div className="ws-gdpr-banner-container pf-v5-l-flex">
17
+ <div id="ws-gdpr-banner" className="pf-v5-l-flex pf-v5-u-py-md pf-m-align-items-center">
18
+ <p id="ws-gdpr-banner-text" className="pf-v5-u-ml-xl">
19
19
  We use cookies on our websites to deliver our online services.
20
20
  Details about how we use cookies and how you may disable them are set out in our <a href="//www.redhat.com/en/about/privacy-policy">Privacy Statement</a>.
21
21
  By using this website you agree to our use of cookies.
@@ -9,7 +9,7 @@ export const InlineAlert = ({
9
9
  <Alert
10
10
  variant={variant}
11
11
  title={title}
12
- className="pf-u-my-md"
12
+ className="pf-v5-u-my-md"
13
13
  style={{ marginBottom: '1rem' }}
14
14
  isInline
15
15
  component="h2"
@@ -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-v5-u-mt-md pf-v5-u-mb-lg" variant="compact" aria-label={title} gridBreakPoint="grid-lg">
22
+ <Caption>
23
+ {description && <div className="pf-v5-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-v5-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
+ );
@@ -0,0 +1,67 @@
1
+ import React from "react";
2
+ import { DataList, DataListItem, DataListItemRow, DataListItemCells, DataListCell, Split, SplitItem, TextContent, Text, TextVariants, Label } from "@patternfly/react-core";
3
+ import { Link } from '../link/link';
4
+ import { convertToReactComponent } from "@patternfly/ast-helpers";
5
+
6
+ // convert summary text in drawer from string to jsx
7
+ const SummaryComponent = ({ id, itemsData }) => {
8
+ const itemDasherized = id.split(' ').join('-').toLowerCase();
9
+ const summary = itemsData?.[itemDasherized]?.summary;
10
+ if (!summary) {
11
+ return null;
12
+ }
13
+ // Remove anchor tags to avoid <a> in summary nested within <a> of Link card/datalistitem
14
+ const summaryNoLinks = summary.replace(/<Link[^>]*>([^<]+)<\/Link>/gm, '$1');
15
+ const { code } = convertToReactComponent(`<>${summaryNoLinks}</>`);
16
+ const getSummaryComponent = new Function('React', code);
17
+ return getSummaryComponent(React);
18
+ }
19
+
20
+ export const SectionDataListLayout = ({ galleryItems, layoutView }) => {
21
+ if (layoutView !== 'list') {
22
+ return null;
23
+ }
24
+
25
+ return (
26
+ <DataList onSelectDataListItem={() => {}}>
27
+ {galleryItems.map(({ idx, slug, illustration, itemName, title, isBeta, id, galleryItemsData }) => (
28
+ <Link to={slug} key={idx} className="ws-section-gallery-item">
29
+ <DataListItem>
30
+ <DataListItemRow>
31
+ <DataListItemCells dataListCells={[
32
+ <DataListCell width={1} key="illustration">
33
+ {illustration && (
34
+ <div>
35
+ <img src={illustration} alt={`${itemName} illustration`} />
36
+ </div>
37
+ )}
38
+ </DataListCell>,
39
+ <DataListCell width={5} key="text-description">
40
+ <Split className="pf-v5-u-mb-md">
41
+ <SplitItem isFilled>
42
+ <TextContent>
43
+ <Text component={TextVariants.h2}>
44
+ <span>
45
+ {title}
46
+ </span>
47
+ </Text>
48
+ </TextContent>
49
+ </SplitItem>
50
+ <SplitItem>
51
+ {isBeta && <Label color="gold">Beta feature</Label>}
52
+ </SplitItem>
53
+ </Split>
54
+ <TextContent>
55
+ <Text>
56
+ { id ? <SummaryComponent id={id} itemsData={galleryItemsData} /> : null }
57
+ </Text>
58
+ </TextContent>
59
+ </DataListCell>
60
+ ]} />
61
+ </DataListItemRow>
62
+ </DataListItem>
63
+ </Link>
64
+ ))}
65
+ </DataList>
66
+ )
67
+ };