@patternfly/documentation-framework 6.0.0-alpha.9 → 6.0.0-alpha.91

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 (46) hide show
  1. package/CHANGELOG.md +1249 -0
  2. package/README.md +5 -76
  3. package/app.js +2 -5
  4. package/components/autoLinkHeader/autoLinkHeader.css +2 -2
  5. package/components/autoLinkHeader/autoLinkHeader.js +8 -19
  6. package/components/cssVariables/cssVariables.css +9 -11
  7. package/components/cssVariables/cssVariables.js +19 -32
  8. package/components/example/example.css +14 -58
  9. package/components/example/example.js +149 -78
  10. package/components/example/exampleToolbar.js +3 -2
  11. package/components/footer/RHLogoDark.png +0 -0
  12. package/components/footer/footer.css +31 -93
  13. package/components/footer/footer.js +139 -78
  14. package/components/gdprBanner/gdprBanner.css +0 -3
  15. package/components/gdprBanner/gdprBanner.js +22 -16
  16. package/components/inlineAlert/inlineAlert.js +1 -1
  17. package/components/link/link.js +23 -18
  18. package/components/propsTable/propsTable.js +14 -10
  19. package/components/sectionGallery/TextSummary.js +5 -5
  20. package/components/sectionGallery/sectionDataListLayout.js +87 -41
  21. package/components/sectionGallery/sectionGallery.css +6 -39
  22. package/components/sectionGallery/sectionGalleryLayout.js +73 -23
  23. package/components/sectionGallery/sectionGalleryToolbar.js +48 -12
  24. package/components/sideNav/sideNav.js +3 -4
  25. package/components/tableOfContents/tableOfContents.css +26 -35
  26. package/components/tableOfContents/tableOfContents.js +58 -28
  27. package/layouts/sideNavLayout/sideNavLayout.css +1 -36
  28. package/layouts/sideNavLayout/sideNavLayout.js +193 -103
  29. package/package.json +12 -19
  30. package/pages/404/404.css +2 -2
  31. package/pages/404/index.js +23 -36
  32. package/routes.js +3 -1
  33. package/scripts/md/anchor-header.js +1 -1
  34. package/scripts/md/parseMD.js +20 -18
  35. package/scripts/md/styled-tags.js +22 -14
  36. package/scripts/md/typecheck.js +1 -0
  37. package/scripts/webpack/prerender.js +2 -1
  38. package/scripts/webpack/webpack.base.config.js +7 -18
  39. package/scripts/writeScreenshots.js +2 -2
  40. package/templates/mdx.css +11 -288
  41. package/templates/mdx.js +40 -43
  42. package/templates/patternfly-docs/patternfly-docs.source.js +8 -8
  43. package/versions.json +42 -15
  44. package/components/sideNav/sideNav.css +0 -21
  45. package/pages/global-css-variables.md +0 -109
  46. package/pages/img/component-variable-mapping.png +0 -0
@@ -1,6 +1,17 @@
1
- import React, { useContext } from 'react';
1
+ import React, { useContext, useEffect } from 'react';
2
2
  import { useLocation } from '@reach/router';
3
- import { Button, CodeBlock, Flex, CodeBlockCode, debounce, Label, Switch, Tooltip } from '@patternfly/react-core';
3
+ import {
4
+ Button,
5
+ CodeBlock,
6
+ Flex,
7
+ CodeBlockCode,
8
+ debounce,
9
+ Label,
10
+ Switch,
11
+ Tooltip,
12
+ Stack,
13
+ StackItem
14
+ } from '@patternfly/react-core';
4
15
  import * as reactCoreModule from '@patternfly/react-core';
5
16
  import * as reactCoreNextModule from '@patternfly/react-core/next';
6
17
  import * as reactCoreDeprecatedModule from '@patternfly/react-core/deprecated';
@@ -16,13 +27,13 @@ import {
16
27
  getReactParams,
17
28
  getExampleClassName,
18
29
  getExampleId,
19
- liveCodeTypes
30
+ liveCodeTypes,
20
31
  } from '../../helpers';
21
32
  import { convertToReactComponent } from '@patternfly/ast-helpers';
22
33
  import missingThumbnail from './missing-thumbnail.jpg';
23
34
  import { RtlContext } from '../../layouts';
24
35
 
25
- const errorComponent = err => <pre>{err.toString()}</pre>;
36
+ const errorComponent = (err) => <pre>{err.toString()}</pre>;
26
37
 
27
38
  class ErrorBoundary extends React.Component {
28
39
  constructor(props) {
@@ -34,7 +45,7 @@ class ErrorBoundary extends React.Component {
34
45
  errorInfo._suppressLogging = true;
35
46
  this.setState({
36
47
  error: error,
37
- errorInfo: errorInfo
48
+ errorInfo: errorInfo,
38
49
  });
39
50
  }
40
51
 
@@ -94,15 +105,24 @@ export const Example = ({
94
105
  // md file location in node_modules, used to resolve relative import paths in examples
95
106
  relPath = '',
96
107
  // absolute url to hosted file
97
- sourceLink = ''
108
+ sourceLink = '',
98
109
  }) => {
99
110
  if (isFullscreenPreview) {
100
111
  isFullscreen = false;
101
- window.addEventListener('load', () => {
102
- //append a class to the document body to indicate to screenshot/automated visual regression tools that the page has loaded
103
- document.body.classList.add('page-loaded');
104
- });
105
112
  }
113
+
114
+ //append a class to the document body on fullscreen examples to indicate to screenshot/automated visual regression tools that the page has loaded
115
+ const addPageLoadedClass = () => document.body.classList.add('page-loaded');
116
+ useEffect(() => {
117
+ if (!isFullscreenPreview) return;
118
+
119
+ document.readyState === 'complete'
120
+ ? addPageLoadedClass()
121
+ : window.addEventListener('load', addPageLoadedClass);
122
+
123
+ return () => window.removeEventListener('load', addPageLoadedClass);
124
+ }, []);
125
+
106
126
  if (!lang) {
107
127
  // Inline code
108
128
  return <code className="ws-code">{code}</code>;
@@ -124,20 +144,26 @@ export const Example = ({
124
144
  ...reactCoreModule,
125
145
  ...reactTableModule,
126
146
  ...(source === 'react-next' ? reactCoreNextModule : {}),
127
- ...(source === 'react-deprecated' ? {...reactCoreDeprecatedModule, ...reactTableDeprecatedModule} : {})
147
+ ...(source === 'react-deprecated'
148
+ ? { ...reactCoreDeprecatedModule, ...reactTableDeprecatedModule }
149
+ : {}),
128
150
  };
129
151
 
130
152
  let livePreview = null;
131
153
  if (lang === 'html') {
132
154
  livePreview = (
133
155
  <div
134
- className={css('ws-preview-html', isFullscreenPreview && 'pf-v5-u-h-100')}
156
+ className={css(
157
+ 'ws-preview-html', // core uses this class name to apply styles to specific examples
158
+ isFullscreenPreview && 'pf-v6-u-h-100'
159
+ )}
135
160
  dangerouslySetInnerHTML={{ __html: editorCode }}
136
161
  />
137
162
  );
138
163
  } else {
139
164
  try {
140
- const { code: transformedCode, hasTS } = convertToReactComponent(editorCode);
165
+ const { code: transformedCode, hasTS } =
166
+ convertToReactComponent(editorCode);
141
167
  if (hasTS) {
142
168
  lang = 'ts';
143
169
  } else {
@@ -147,7 +173,11 @@ export const Example = ({
147
173
  const componentNames = Object.keys(scope);
148
174
  const componentValues = Object.values(scope);
149
175
 
150
- const getPreviewComponent = new Function('React', ...componentNames, transformedCode);
176
+ const getPreviewComponent = new Function(
177
+ 'React',
178
+ ...componentNames,
179
+ transformedCode
180
+ );
151
181
  const PreviewComponent = getPreviewComponent(React, ...componentValues);
152
182
 
153
183
  livePreview = (
@@ -164,20 +194,37 @@ export const Example = ({
164
194
 
165
195
  if (isFullscreenPreview) {
166
196
  return (
167
- <div id={previewId} className={css(className, 'pf-v5-u-h-100')}>
197
+ <div id={previewId} className={css(className, 'pf-v6-u-h-100')}>
168
198
  {livePreview}
169
199
  {(hasDarkThemeSwitcher || hasRTLSwitcher) && (
170
- <Flex direction={{ default: 'column' }} gap={{ default: 'gapLg' }} className="ws-full-page-utils pf-v5-m-dir-ltr ">
200
+ <Flex
201
+ direction={{ default: 'column' }}
202
+ gap={{ default: 'gapLg' }}
203
+ className="ws-full-page-utils pf-v6-m-dir-ltr "
204
+ >
171
205
  {hasDarkThemeSwitcher && (
172
- <Switch id="ws-example-theme-switch" label="Dark theme" defaultChecked={false} onChange={() =>
173
- document.querySelector('html').classList.toggle('pf-v5-theme-dark')} />
206
+ <Switch
207
+ id="ws-example-theme-switch"
208
+ label="Dark theme"
209
+ defaultChecked={false}
210
+ onChange={() =>
211
+ document
212
+ .querySelector('html')
213
+ .classList.toggle('pf-v6-theme-dark')
214
+ }
215
+ />
174
216
  )}
175
217
  {hasRTLSwitcher && (
176
- <Switch id="ws-example-rtl-switch" label="RTL" defaultChecked={false} onChange={() => {
177
- const html = document.querySelector('html');
178
- const curDir = html.dir;
179
- html.dir = (curDir !== 'rtl') ? 'rtl' : 'ltr';
180
- }} />
218
+ <Switch
219
+ id="ws-example-rtl-switch"
220
+ label="RTL"
221
+ defaultChecked={false}
222
+ onChange={() => {
223
+ const html = document.querySelector('html');
224
+ const curDir = html.dir;
225
+ html.dir = curDir !== 'rtl' ? 'rtl' : 'ltr';
226
+ }}
227
+ />
181
228
  )}
182
229
  </Flex>
183
230
  )}
@@ -188,82 +235,106 @@ export const Example = ({
188
235
  const codeBoxParams = getParameters(
189
236
  lang === 'html'
190
237
  ? getStaticParams(title, editorCode)
191
- : getReactParams(title, editorCode, scope, lang, relativeImports, relPath, sourceLink)
238
+ : getReactParams(
239
+ title,
240
+ editorCode,
241
+ scope,
242
+ lang,
243
+ relativeImports,
244
+ relPath,
245
+ sourceLink
246
+ )
192
247
  );
193
- const fullscreenLink = loc.pathname.replace(/\/$/, '')
194
- + (loc.pathname.endsWith(source) ? '' : `/${source}`)
195
- + '/'
196
- + slugger(title);
248
+ const fullscreenLink =
249
+ loc.pathname.replace(/\/$/, '') +
250
+ (loc.pathname.endsWith(source) ? '' : `/${source}`) +
251
+ '/' +
252
+ slugger(title);
253
+
254
+ const hasMetaText = isBeta || isDemo || isDeprecated || false;
255
+ const tooltips = (<React.Fragment>
256
+ {isBeta && (
257
+ <Tooltip content="This beta component is currently under review and is still open for further evolution.">
258
+ <Button variant="plain" hasNoPadding>
259
+ <Label isCompact color="blue">
260
+ Beta
261
+ </Label>
262
+ </Button>
263
+ </Tooltip>
264
+ )}
265
+ {isDemo && (
266
+ <Tooltip content="Demos show how multiple components can be used in a single design.">
267
+ <Button variant="plain" hasNoPadding>
268
+ <Label isCompact color="purple">
269
+ Demo
270
+ </Label>
271
+ </Button>
272
+ </Tooltip>
273
+ )}
274
+ {isDeprecated && (
275
+ <Tooltip content="Deprecated components are available for use but are no longer being maintained or enhanced.">
276
+ <Button variant="plain" hasNoPadding>
277
+ <Label isCompact color="grey">
278
+ Deprecated
279
+ </Label>
280
+ </Button>
281
+ </Tooltip>
282
+ )}
283
+ </React.Fragment>);
284
+ const metaText = hasMetaText && tooltips
197
285
 
198
286
  return (
199
- <div className="ws-example">
200
- <div className="ws-example-header">
287
+ <Stack hasGutter>
288
+ <StackItem>
201
289
  <AutoLinkHeader
202
- metaText={
203
- <React.Fragment>
204
- {isBeta && (
205
- <Tooltip content="This beta component is currently under review and is still open for further evolution.">
206
- <Button variant="plain">
207
- <Label isCompact color="blue">Beta</Label>
208
- </Button>
209
- </Tooltip>
210
- )}
211
- {isDemo && (
212
- <Tooltip content="Demos show how multiple components can be used in a single design.">
213
- <Button variant="plain">
214
- <Label isCompact color="purple">Demo</Label>
215
- </Button>
216
- </Tooltip>
217
- )}
218
- {isDeprecated && (
219
- <Tooltip content="Deprecated components are available for use but are no longer being maintained or enhanced.">
220
- <Button variant="plain">
221
- <Label isCompact color="grey">Deprecated</Label>
222
- </Button>
223
- </Tooltip>
224
- )}
225
- </React.Fragment>
226
- }
227
- size="h4"
290
+ metaText={metaText}
228
291
  headingLevel="h3"
229
- className="ws-example-heading"
230
292
  >
231
293
  {title}
232
294
  </AutoLinkHeader>
233
295
  {children}
234
- </div>
235
- {isFullscreen
236
- ? <div className="ws-preview">
296
+ </StackItem>
297
+ <StackItem>
298
+ {isFullscreen ? (
299
+ <div>
237
300
  <a
238
301
  className="ws-preview__thumbnail-link"
239
302
  href={fullscreenLink}
240
303
  target="_blank"
241
304
  aria-label={`Open fullscreen ${title} example`}
242
305
  >
243
- <img src={thumbnail.src} width={thumbnail.width} height={thumbnail.height} alt={`${title} screenshot`} />
306
+ <img
307
+ src={thumbnail.src}
308
+ width={thumbnail.width}
309
+ height={thumbnail.height}
310
+ alt={`${title} screenshot`}
311
+ />
244
312
  </a>
245
313
  </div>
246
- : <div
314
+ ) : (
315
+ <div
247
316
  id={previewId}
248
317
  className={css(
249
318
  className,
250
- isFullscreen ? 'ws-preview-fullscreen' : 'ws-preview',
251
- isRTL && 'pf-v5-m-dir-rtl')
252
- }
319
+ isRTL && 'pf-v6-m-dir-rtl'
320
+ )}
253
321
  >
254
322
  {livePreview}
255
323
  </div>
256
- }
257
- <ExampleToolbar
258
- lang={lang}
259
- isFullscreen={isFullscreen}
260
- fullscreenLink={fullscreenLink}
261
- originalCode={code}
262
- code={editorCode}
263
- setCode={debounce(setEditorCode, 300)}
264
- codeBoxParams={codeBoxParams}
265
- exampleTitle={title}
266
- />
267
- </div>
324
+ )}
325
+ </StackItem>
326
+ <StackItem>
327
+ <ExampleToolbar
328
+ lang={lang}
329
+ isFullscreen={isFullscreen}
330
+ fullscreenLink={fullscreenLink}
331
+ originalCode={code}
332
+ code={editorCode}
333
+ setCode={debounce(setEditorCode, 300)}
334
+ codeBoxParams={codeBoxParams}
335
+ exampleTitle={title}
336
+ />
337
+ </StackItem>
338
+ </Stack>
268
339
  );
269
- }
340
+ };
@@ -103,7 +103,7 @@ export const ExampleToolbar = ({
103
103
  copyCode();
104
104
  trackEvent('code_editor_control_click', 'click_event', 'COPY_CODE');
105
105
  }}
106
- variant="control"
106
+ variant="plain"
107
107
  aria-label={copyAriaLabel}
108
108
  className={editorControlProps.className}
109
109
  >
@@ -124,7 +124,7 @@ export const ExampleToolbar = ({
124
124
  >
125
125
  <Button
126
126
  aria-label={codesandboxAriaLabel}
127
- variant="control"
127
+ variant="plain"
128
128
  type="submit"
129
129
  onClick={() => {
130
130
  trackEvent('code_editor_control_click', 'click_event', 'CODESANDBOX_LINK');
@@ -218,6 +218,7 @@ export const ExampleToolbar = ({
218
218
  onEditorDidMount={onEditorDidMount}
219
219
  isReadOnly={isFullscreen}
220
220
  className={`${isEditorOpen ? 'ws-example-code-expanded ' : ''}ws-code-editor`}
221
+ isHeaderPlain
221
222
  />
222
223
  );
223
224
  }
Binary file
@@ -1,116 +1,54 @@
1
- .ws-org-pfsite-l-footer.pf-v5-c-page__main-section {
2
- font-family: var(--pf-v5-global--FontFamily--text);
3
- font-weight: 300;
4
- background-color: #1a1a1a !important;
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);
1
+ .ws-org-pfsite-l-footer,
2
+ .ws-org-pfsite-l-footer-dark {
3
+ color: var(--pf-t--global--text--color--regular);
4
+ background-color: var(--pf-t--global--background--color--secondary--default);
9
5
  /* Hide long overflowing tocs */
10
6
  z-index: 1;
11
7
  }
12
- .ws-org-pfsite-l-footer .ws-org-pfsite-footer-menu-list-title {
13
- margin: 0;
14
- padding: 6px 0;
15
- font-weight: 700 !important;
16
- font-size: 14px !important;
17
- color: #fff;
18
- text-transform: uppercase;
19
- }
20
- .ws-org-pfsite-l-footer .ws-org-pfsite-l-footer-column {
21
- background-color: #333;
8
+ .ws-org-pfsite-l-footer-column {
9
+ background-color: var(--pf-t--global--background--color--primary--default);
22
10
  height: 100%;
11
+ padding-inline: var(--pf-t--global--spacer--xl);
23
12
  }
24
- .ws-org-pfsite-l-footer-column .ws-org-pfsite-footer-menu-about-logo {
25
- padding-top: 12px;
26
- }
27
- .ws-org-pfsite-l-footer-column .ws-org-pfsite-footer-menu-about-description {
28
- font-size: 14px !important;
29
- color: #fff;
30
- }
31
- @media (max-width: 992px) {
32
- .ws-org-pfsite-l-footer-column .ws-org-pfsite-footer-menu-about-description {
33
- padding-bottom: 16px;
13
+ @media screen and (max-width: 768px) {
14
+ .ws-org-pfsite-l-footer-column {
15
+ padding-inline: var(--pf-t--global--spacer--md);
34
16
  }
35
17
  }
36
- .ws-org-pfsite-l-footer-column .ws-org-pfsite-footer-menu-social-links a {
37
- margin-right: var(--pf-v5-global--spacer--md);
38
- color: var(--pf-v5-global--Color--light-100) !important;
18
+ .ws-org-pfsite-footer-menu-social-links a {
19
+ margin-inline-end: var(--pf-t--global--spacer--md);
39
20
  }
40
- .ws-org-pfsite-l-footer-column
41
- .ws-org-pfsite-footer-menu-social-links
21
+ .ws-org-pfsite-footer-menu-social-links
42
22
  a:last-of-type {
43
- margin-right: 0;
44
- }
45
- .ws-org-pfsite-l-footer-column .ws-org-pfsite-footer-menu-social-links {
46
- margin-top: var(--pf-v5-global--spacer--md);
47
- margin-bottom: var(--pf-v5-global--spacer--md);
48
- }
49
- @media (max-width: 768px) {
50
- .ws-org-pfsite-l-footer-column .ws-org-pfsite-footer-menu-social-links {
51
- margin-bottom: 32px;
52
- }
53
- }
54
- .ws-org-pfsite-l-footer .ws-org-pfsite-footer-menu-list {
55
- margin: 0.8rem 0 0;
56
- }
57
- @media (min-width: 992px) {
58
- .ws-org-pfsite-l-footer .ws-org-pfsite-footer-menu-list {
59
- width: 84%;
60
- }
23
+ margin-inline-end: 0;
61
24
  }
62
- @media (min-width: 768px) {
63
- .ws-org-pfsite-l-footer .ws-org-pfsite-footer-menu-list {
64
- display: block;
65
- height: auto !important;
66
- }
67
- }
68
- .ws-org-pfsite-l-footer .ws-org-pfsite-footer-menu-list-item {
69
- font-size: 1.2rem;
70
- line-height: 1.3;
71
- padding-right: 10px;
25
+ .ws-org-pfsite-footer-menu-social-links {
26
+ margin-block-start: var(--pf-t--global--spacer--md);
27
+ color: var(--pf-t--global--icon--color--brand--default);
72
28
  }
73
- .ws-org-pfsite-l-footer .ws-org-pfsite-footer-menu-link {
74
- color: var(--pf-v5-global--Color--light-100);
75
- font-size: 14px !important;
29
+ .ws-org-pfsite-footer-menu-list-title {
30
+ margin-block-end: var(--pf-t--global--spacer--md);
31
+ color: var(--pf-t--global--text--color--subtle);
32
+ font-weight: var(--pf-t--global--font--weight--body--bold);
76
33
  }
77
- .ws-org-pfsite-l-footer .ws-org-pfsite-footer-menu-link:hover {
78
- text-decoration: underline;
34
+ .ws-org-pfsite-footer-menu-list-item {
35
+ padding-right: var(--pf-t--global--spacer--sm);
79
36
  }
80
- @media screen and (max-width: 768px) {
81
- .pfsite-l-footer-column {
82
- margin-left: -16px;
83
- }
37
+ .ws-org-pfsite-footer-menu-link {
38
+ color: var(--pf-t--global--text--color--link--default);
84
39
  }
85
40
 
86
- .ws-org-pfsite-l-footer-dark {
87
- background: #151515 !important;
88
- }
89
- .pf-v5-c-page .pf-v5-c-page__main-section.ws-org-pfsite-l-footer-dark {
90
- /* Hide long overflowing tocs */
91
- z-index: 1;
92
- }
93
- .pf-v5-c-page__main-section.ws-org-pfsite-l-footer-dark > * {
94
- font-weight: 300;
95
- font-size: 12px;
96
- color: #d2d2d2;
41
+ /* Red Hat footer */
42
+ .ws-org-pfsite-l-footer-dark > * {
43
+ font-size: var(--pf-t--global--font--size--xs);
97
44
  }
98
45
  .ws-org-pfsite-l-footer-dark a {
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
- font-weight: 300;
103
- color: #d2d2d2;
104
- text-decoration: underline;
46
+ padding-inline: var(--pf-t--global--spacer--sm);
105
47
  }
106
48
  .ws-org-pfsite-l-footer-dark a:first-of-type {
107
- padding-left: 0;
49
+ padding-inline-start: 0;
108
50
  }
109
51
  .ws-org-pfsite-l-footer-dark a:last-of-type {
110
- padding-right: 0;
52
+ padding-inline-end: 0;
111
53
  border: none;
112
54
  }
113
-
114
- .ws-org-pfsite-site-copyright {
115
- white-space: nowrap;
116
- }