@patternfly/documentation-framework 1.0.0
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 +3964 -0
- package/README.md +92 -0
- package/app.js +118 -0
- package/assets/android-chrome-36x36.png +0 -0
- package/assets/android-chrome-48x48.png +0 -0
- package/assets/android-chrome-96x96.png +0 -0
- package/assets/favicon-16x16.png +0 -0
- package/assets/favicon-32x32.png +0 -0
- package/assets/favicon-48x48.png +0 -0
- package/assets/favicon.ico +0 -0
- package/assets/manifest.json +29 -0
- package/components/autoLinkHeader/autoLinkHeader.css +22 -0
- package/components/autoLinkHeader/autoLinkHeader.js +41 -0
- package/components/cssVariables/cssSearch.js +32 -0
- package/components/cssVariables/cssVariables.css +15 -0
- package/components/cssVariables/cssVariables.js +233 -0
- package/components/example/example.css +106 -0
- package/components/example/example.js +196 -0
- package/components/example/exampleToolbar.js +208 -0
- package/components/example/missing-thumbnail.jpg +0 -0
- package/components/footer/RHLogo.png +0 -0
- package/components/footer/footer.css +114 -0
- package/components/footer/footer.js +262 -0
- package/components/gdprBanner/gdprBanner.css +14 -0
- package/components/gdprBanner/gdprBanner.js +31 -0
- package/components/index.js +12 -0
- package/components/inlineAlert/inlineAlert.js +19 -0
- package/components/link/link.js +68 -0
- package/components/propsTable/propTypeWithLinks.js +33 -0
- package/components/propsTable/propsTable.js +82 -0
- package/components/sideNav/sideNav.css +17 -0
- package/components/sideNav/sideNav.js +95 -0
- package/components/tableOfContents/tableOfContents.css +77 -0
- package/components/tableOfContents/tableOfContents.js +89 -0
- package/components/topNav/topNav.css +30 -0
- package/components/topNav/topNav.js +24 -0
- package/global.css +7 -0
- package/helpers/asyncComponentFactory.js +41 -0
- package/helpers/capitalize.js +7 -0
- package/helpers/codeTitleTransformer.js +40 -0
- package/helpers/codesandbox.js +204 -0
- package/helpers/copy.js +19 -0
- package/helpers/createHandlebars.js +26 -0
- package/helpers/d3-timer.js +7 -0
- package/helpers/extractExampleHelpers.js +24 -0
- package/helpers/fonts.js +164 -0
- package/helpers/getId.js +6 -0
- package/helpers/getTitle.js +5 -0
- package/helpers/index.js +9 -0
- package/helpers/liveCodeTypes.js +4 -0
- package/helpers/slugger.js +35 -0
- package/helpers/trackEvent.js +17 -0
- package/helpers/xterm-addon-fit.js +3 -0
- package/helpers/xterm.js +8 -0
- package/images/patternfly-logo.svg +14 -0
- package/images/patternfly-orb.svg +28 -0
- package/layouts/index.js +1 -0
- package/layouts/logo.svg +33 -0
- package/layouts/sideNavLayout/sideNavLayout.css +104 -0
- package/layouts/sideNavLayout/sideNavLayout.js +237 -0
- package/package.json +87 -0
- package/pages/404/404.css +16 -0
- package/pages/404/404.svg +26 -0
- package/pages/404/chart.svg +24 -0
- package/pages/404/components.svg +1 -0
- package/pages/404/guidelines.svg +1 -0
- package/pages/404/index.js +136 -0
- package/pages/404/patternfly-flat.svg +1 -0
- package/pages/global-css-variables.md +108 -0
- package/pages/img/component-variable-mapping.png +0 -0
- package/pages/red-hat-font.md +40 -0
- package/routes-client.js +1 -0
- package/routes-generated.js +1 -0
- package/routes.js +155 -0
- package/scripts/cli/build.js +95 -0
- package/scripts/cli/buildClient.js +23 -0
- package/scripts/cli/buildServer.js +24 -0
- package/scripts/cli/cli.js +63 -0
- package/scripts/cli/generate.js +23 -0
- package/scripts/cli/helpers.js +9 -0
- package/scripts/cli/init.js +68 -0
- package/scripts/cli/serve.js +13 -0
- package/scripts/cli/start.js +32 -0
- package/scripts/md/anchor-header.js +69 -0
- package/scripts/md/auto-link-url.js +33 -0
- package/scripts/md/example-captions.js +67 -0
- package/scripts/md/jsxAttributes.js +20 -0
- package/scripts/md/mdx-ast-to-mdx-hast.js +210 -0
- package/scripts/md/mdx-hast-to-jsx.js +233 -0
- package/scripts/md/parseMD.js +308 -0
- package/scripts/md/remove-comments.js +21 -0
- package/scripts/md/styled-tags.js +87 -0
- package/scripts/md/typecheck.js +133 -0
- package/scripts/tsDocgen.js +155 -0
- package/scripts/webpack/getHtmlWebpackPlugins.js +78 -0
- package/scripts/webpack/prerender.js +59 -0
- package/scripts/webpack/webpack.base.config.js +159 -0
- package/scripts/webpack/webpack.client.config.js +146 -0
- package/scripts/webpack/webpack.server.config.js +55 -0
- package/scripts/writeScreenshots.js +66 -0
- package/templates/design-guidelines.js +13 -0
- package/templates/html.ejs +52 -0
- package/templates/mdx.css +308 -0
- package/templates/mdx.js +185 -0
- package/templates/patternfly-docs/content/extensions/extension/design-guidelines/design-guidelines.md +25 -0
- package/templates/patternfly-docs/content/extensions/extension/design-guidelines/img/card-elements.png +0 -0
- package/templates/patternfly-docs/content/extensions/extension/examples/Basic.jsx +4 -0
- package/templates/patternfly-docs/content/extensions/extension/examples/basic.md +25 -0
- package/templates/patternfly-docs/pages/index.js +27 -0
- package/templates/patternfly-docs/patternfly-docs.config.js +6 -0
- package/templates/patternfly-docs/patternfly-docs.css.js +8 -0
- package/templates/patternfly-docs/patternfly-docs.routes.js +12 -0
- package/templates/patternfly-docs/patternfly-docs.source.js +24 -0
- package/templates/sitemap.ejs +10 -0
- package/versions.json +870 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Brand,
|
|
4
|
+
Grid,
|
|
5
|
+
GridItem,
|
|
6
|
+
List,
|
|
7
|
+
PageSection
|
|
8
|
+
} from "@patternfly/react-core";
|
|
9
|
+
import { Link } from '@patternfly/documentation-framework/components';
|
|
10
|
+
import { GithubIcon, TwitterIcon } from "@patternfly/react-icons";
|
|
11
|
+
import redhatLogo from "./RHLogo.png";
|
|
12
|
+
import logo from '../../layouts/logo.svg';
|
|
13
|
+
|
|
14
|
+
export const Footer = () => (
|
|
15
|
+
<React.Fragment>
|
|
16
|
+
<PageSection key="footer-1" className="ws-org-pfsite-l-footer">
|
|
17
|
+
<Grid>
|
|
18
|
+
<GridItem
|
|
19
|
+
sm={12}
|
|
20
|
+
md={6}
|
|
21
|
+
mdOffset={1}
|
|
22
|
+
className="pf-u-mb-lg pf-u-mb-0-on-sm"
|
|
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">
|
|
26
|
+
<p
|
|
27
|
+
className="pf-c-title ws-org-pfsite-footer-menu-list-title"
|
|
28
|
+
>
|
|
29
|
+
QUICKLINKS
|
|
30
|
+
</p>
|
|
31
|
+
<nav aria-label="Quick Links">
|
|
32
|
+
<List isPlain className="ws-org-pfsite-footer-menu-list">
|
|
33
|
+
<li className="ws-org-pfsite-footer-menu-list-item">
|
|
34
|
+
<Link
|
|
35
|
+
className="ws-org-pfsite-footer-menu-link"
|
|
36
|
+
to={"/get-started/about"}
|
|
37
|
+
aria-label="Get started with PatternFly 4"
|
|
38
|
+
>
|
|
39
|
+
Get started
|
|
40
|
+
</Link>
|
|
41
|
+
</li>
|
|
42
|
+
<li className="ws-org-pfsite-footer-menu-list-item">
|
|
43
|
+
<Link
|
|
44
|
+
className="ws-org-pfsite-footer-menu-link"
|
|
45
|
+
to="/components/about-modal"
|
|
46
|
+
aria-label="PatternFly 4 components"
|
|
47
|
+
>
|
|
48
|
+
Components
|
|
49
|
+
</Link>
|
|
50
|
+
</li>
|
|
51
|
+
<li className="ws-org-pfsite-footer-menu-list-item">
|
|
52
|
+
<Link
|
|
53
|
+
className="ws-org-pfsite-footer-menu-link"
|
|
54
|
+
to="/layouts/bullseye"
|
|
55
|
+
aria-label="PatternFly 4 layouts"
|
|
56
|
+
>
|
|
57
|
+
Layouts
|
|
58
|
+
</Link>
|
|
59
|
+
</li>
|
|
60
|
+
<li className="ws-org-pfsite-footer-menu-list-item">
|
|
61
|
+
<Link
|
|
62
|
+
className="ws-org-pfsite-footer-menu-link"
|
|
63
|
+
to="/guidelines/colors"
|
|
64
|
+
aria-label="PatternFly 4 styles"
|
|
65
|
+
>
|
|
66
|
+
Styles
|
|
67
|
+
</Link>
|
|
68
|
+
</li>
|
|
69
|
+
<li className="ws-org-pfsite-footer-menu-list-item">
|
|
70
|
+
<Link
|
|
71
|
+
className="ws-org-pfsite-footer-menu-link"
|
|
72
|
+
to="https://www.patternfly.org/v3/"
|
|
73
|
+
target="top"
|
|
74
|
+
aria-label="View the PatternFly 3 website"
|
|
75
|
+
>
|
|
76
|
+
PatternFly 3
|
|
77
|
+
</Link>
|
|
78
|
+
</li>
|
|
79
|
+
</List>
|
|
80
|
+
</nav>
|
|
81
|
+
</GridItem>
|
|
82
|
+
<GridItem
|
|
83
|
+
sm={6}
|
|
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"
|
|
86
|
+
>
|
|
87
|
+
<p
|
|
88
|
+
className="pf-c-title ws-org-pfsite-footer-menu-list-title"
|
|
89
|
+
>
|
|
90
|
+
CONTRIBUTE
|
|
91
|
+
</p>
|
|
92
|
+
<nav aria-label="Contribute">
|
|
93
|
+
<List isPlain className="ws-org-pfsite-footer-menu-list">
|
|
94
|
+
<li className="ws-org-pfsite-footer-menu-list-item">
|
|
95
|
+
<Link
|
|
96
|
+
className="ws-org-pfsite-footer-menu-link"
|
|
97
|
+
to="/get-started/design"
|
|
98
|
+
aria-label="How to contribute as a Designer"
|
|
99
|
+
>
|
|
100
|
+
Designers
|
|
101
|
+
</Link>
|
|
102
|
+
</li>
|
|
103
|
+
<li className="ws-org-pfsite-footer-menu-list-item">
|
|
104
|
+
<Link
|
|
105
|
+
className="ws-org-pfsite-footer-menu-link"
|
|
106
|
+
to="/get-started/develop"
|
|
107
|
+
aria-label="How to contribute as a Developer"
|
|
108
|
+
>
|
|
109
|
+
Developers
|
|
110
|
+
</Link>
|
|
111
|
+
</li>
|
|
112
|
+
<li className="ws-org-pfsite-footer-menu-list-item">
|
|
113
|
+
<Link
|
|
114
|
+
className="ws-org-pfsite-footer-menu-link"
|
|
115
|
+
to="https://github.com/patternfly/patternfly/blob/main/CODE_OF_CONDUCT.md"
|
|
116
|
+
target="top"
|
|
117
|
+
aria-label="PatternFly 4 Code of Conduct"
|
|
118
|
+
>
|
|
119
|
+
Code of Conduct
|
|
120
|
+
</Link>
|
|
121
|
+
</li>
|
|
122
|
+
</List>
|
|
123
|
+
</nav>
|
|
124
|
+
</GridItem>
|
|
125
|
+
<GridItem
|
|
126
|
+
sm={6}
|
|
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"
|
|
129
|
+
>
|
|
130
|
+
<p
|
|
131
|
+
className="ws-org-pfsite-footer-menu-list-title"
|
|
132
|
+
>
|
|
133
|
+
STAY IN TOUCH
|
|
134
|
+
</p>
|
|
135
|
+
<nav aria-label="Stay in touch">
|
|
136
|
+
<List isPlain className="ws-org-pfsite-footer-menu-list">
|
|
137
|
+
<li className="ws-org-pfsite-footer-menu-list-item">
|
|
138
|
+
<Link
|
|
139
|
+
className="ws-org-pfsite-footer-menu-link"
|
|
140
|
+
to="//slack.patternfly.org"
|
|
141
|
+
target="top"
|
|
142
|
+
aria-label="Join the PatternFly 4 Slack"
|
|
143
|
+
>
|
|
144
|
+
Slack
|
|
145
|
+
</Link>
|
|
146
|
+
</li>
|
|
147
|
+
<li className="ws-org-pfsite-footer-menu-list-item">
|
|
148
|
+
<Link
|
|
149
|
+
className="ws-org-pfsite-footer-menu-link"
|
|
150
|
+
to="//forum.patternfly.org"
|
|
151
|
+
target="top"
|
|
152
|
+
aria-label="Visit the PatternFly 4 forum"
|
|
153
|
+
>
|
|
154
|
+
Forum
|
|
155
|
+
</Link>
|
|
156
|
+
</li>
|
|
157
|
+
<li className="ws-org-pfsite-footer-menu-list-item">
|
|
158
|
+
<Link
|
|
159
|
+
className="ws-org-pfsite-footer-menu-link"
|
|
160
|
+
to="//redhat.com/mailman/listinfo/patternfly"
|
|
161
|
+
target="top"
|
|
162
|
+
aria-label="Join the PatternFly 4 mailing list"
|
|
163
|
+
>
|
|
164
|
+
Mailing list
|
|
165
|
+
</Link>
|
|
166
|
+
</li>
|
|
167
|
+
<li className="ws-org-pfsite-footer-menu-list-item">
|
|
168
|
+
<Link
|
|
169
|
+
className="ws-org-pfsite-footer-menu-link"
|
|
170
|
+
to="//medium.com/patternfly"
|
|
171
|
+
target="top"
|
|
172
|
+
aria-label="Read the PatternFly 4 blog"
|
|
173
|
+
>
|
|
174
|
+
PatternFly Medium
|
|
175
|
+
</Link>
|
|
176
|
+
</li>
|
|
177
|
+
</List>
|
|
178
|
+
</nav>
|
|
179
|
+
</GridItem>
|
|
180
|
+
</Grid>
|
|
181
|
+
</GridItem>
|
|
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">
|
|
185
|
+
<Link
|
|
186
|
+
className="pf-c-page__header-brand-link pf-c-brand ws-org-pfsite-footer-menu-about-logo pf-u-pb-md"
|
|
187
|
+
to="/"
|
|
188
|
+
>
|
|
189
|
+
<Brand src={logo} alt="Patternfly Logo" />
|
|
190
|
+
</Link>
|
|
191
|
+
<p className="ws-org-pfsite-footer-menu-about-description">
|
|
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
|
+
</p>
|
|
194
|
+
</GridItem>
|
|
195
|
+
<GridItem className="ws-org-pfsite-footer-menu-social-links pf-u-px-xl">
|
|
196
|
+
<Link
|
|
197
|
+
to="//github.com/patternfly"
|
|
198
|
+
target="top"
|
|
199
|
+
aria-label="Link to PatternFly GitHub page"
|
|
200
|
+
>
|
|
201
|
+
<GithubIcon />
|
|
202
|
+
</Link>
|
|
203
|
+
<Link
|
|
204
|
+
to="//twitter.com/patternfly"
|
|
205
|
+
target="top"
|
|
206
|
+
aria-label="Link to PatternFly Twitter page"
|
|
207
|
+
>
|
|
208
|
+
<TwitterIcon />
|
|
209
|
+
</Link>
|
|
210
|
+
</GridItem>
|
|
211
|
+
</Grid>
|
|
212
|
+
</GridItem>
|
|
213
|
+
</Grid>
|
|
214
|
+
</PageSection>
|
|
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">
|
|
217
|
+
<GridItem md={2} mdOffset={1}>
|
|
218
|
+
<Link
|
|
219
|
+
to="//www.redhat.com"
|
|
220
|
+
target="top"
|
|
221
|
+
aria-label="Visit Red Hat.com"
|
|
222
|
+
>
|
|
223
|
+
<img
|
|
224
|
+
src={redhatLogo}
|
|
225
|
+
alt="Red Hat logo"
|
|
226
|
+
width="145px"
|
|
227
|
+
height="613px"
|
|
228
|
+
/>
|
|
229
|
+
</Link>
|
|
230
|
+
</GridItem>
|
|
231
|
+
<GridItem md={4} lg={3} xl={2}>
|
|
232
|
+
<span className="ws-org-pfsite-site-copyright">
|
|
233
|
+
Copyright © 2022 Red Hat, Inc.
|
|
234
|
+
</span>
|
|
235
|
+
</GridItem>
|
|
236
|
+
<GridItem md={4} lg={5} className="pf-u-ml-xl-on-xl">
|
|
237
|
+
<Link
|
|
238
|
+
to="//www.redhat.com/en/about/privacy-policy"
|
|
239
|
+
target="top"
|
|
240
|
+
aria-label="Privacy statement"
|
|
241
|
+
>
|
|
242
|
+
Privacy statement
|
|
243
|
+
</Link>
|
|
244
|
+
<Link
|
|
245
|
+
to="//www.redhat.com/en/about/terms-use"
|
|
246
|
+
target="top"
|
|
247
|
+
aria-label="Terms of use"
|
|
248
|
+
>
|
|
249
|
+
Terms of use
|
|
250
|
+
</Link>
|
|
251
|
+
<Link
|
|
252
|
+
to="//www.redhat.com/en/about/all-policies-guidelines"
|
|
253
|
+
target="top"
|
|
254
|
+
aria-label="All policies and guidelines"
|
|
255
|
+
>
|
|
256
|
+
All policies and guidelines
|
|
257
|
+
</Link>
|
|
258
|
+
</GridItem>
|
|
259
|
+
</Grid>
|
|
260
|
+
</PageSection>
|
|
261
|
+
</React.Fragment>
|
|
262
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.ws-gdpr-banner-container {
|
|
2
|
+
width: 100vw;
|
|
3
|
+
position: fixed;
|
|
4
|
+
bottom: 10px;
|
|
5
|
+
z-index: 201;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
#ws-gdpr-banner {
|
|
10
|
+
max-width: 95vw;
|
|
11
|
+
flex-wrap: nowrap;
|
|
12
|
+
background: var(--pf-global--BackgroundColor--100);
|
|
13
|
+
border: var(--pf-global--BorderWidth--sm) solid var(--pf-global--Color--100);
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button } from '@patternfly/react-core';
|
|
3
|
+
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
4
|
+
import './gdprBanner.css';
|
|
5
|
+
|
|
6
|
+
export const GdprBanner = () => {
|
|
7
|
+
const initialBannerOpen = typeof window !== 'undefined' && window.localStorage && !localStorage.getItem('gdpr-banner-closed');
|
|
8
|
+
const [ isBannerOpen, setBannerOpen ] = React.useState(initialBannerOpen);
|
|
9
|
+
|
|
10
|
+
const closeBanner = () => {
|
|
11
|
+
localStorage.setItem('gdpr-banner-closed', 'true');
|
|
12
|
+
setBannerOpen(false);
|
|
13
|
+
}
|
|
14
|
+
|
|
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">
|
|
19
|
+
We use cookies on our websites to deliver our online services.
|
|
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
|
+
By using this website you agree to our use of cookies.
|
|
22
|
+
</p>
|
|
23
|
+
<div className="pf-m-align-self-flex-start">
|
|
24
|
+
<Button variant="plain" aria-label="Close banner" onClick={closeBanner}>
|
|
25
|
+
<TimesIcon />
|
|
26
|
+
</Button>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './autoLinkHeader/autoLinkHeader';
|
|
2
|
+
export * from './cssVariables/cssVariables';
|
|
3
|
+
export * from './cssVariables/cssSearch';
|
|
4
|
+
export * from './example/example';
|
|
5
|
+
export * from './footer/footer';
|
|
6
|
+
export * from './gdprBanner/gdprBanner';
|
|
7
|
+
export * from './propsTable/propsTable';
|
|
8
|
+
export * from './sideNav/sideNav';
|
|
9
|
+
export * from './topNav/topNav';
|
|
10
|
+
export * from './link/link';
|
|
11
|
+
export * from './tableOfContents/tableOfContents';
|
|
12
|
+
export * from './inlineAlert/inlineAlert';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Alert } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
export const InlineAlert = ({
|
|
5
|
+
title,
|
|
6
|
+
variant = 'info',
|
|
7
|
+
children
|
|
8
|
+
}) => (
|
|
9
|
+
<Alert
|
|
10
|
+
variant={variant}
|
|
11
|
+
title={title}
|
|
12
|
+
className="pf-u-my-md"
|
|
13
|
+
style={{ marginBottom: '1rem' }}
|
|
14
|
+
isInline
|
|
15
|
+
titleHeadingLevel="h2"
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</Alert>
|
|
19
|
+
);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link as ReachLink, navigate } from '@reach/router';
|
|
3
|
+
import { getAsyncComponent } from '../../routes';
|
|
4
|
+
|
|
5
|
+
const Promiseany = (Promise.any || function ($) {
|
|
6
|
+
return new Promise(function (D, E, A, L) {
|
|
7
|
+
A = [];
|
|
8
|
+
L = $.map(function ($, i) {
|
|
9
|
+
return Promise.resolve($).then(D, function (O) {
|
|
10
|
+
return ((A[i] = O), --L) || E({errors: A});
|
|
11
|
+
});
|
|
12
|
+
}).length;
|
|
13
|
+
});
|
|
14
|
+
}).bind(Promise);
|
|
15
|
+
|
|
16
|
+
export const Link = ({
|
|
17
|
+
href,
|
|
18
|
+
to,
|
|
19
|
+
onMouseOver = () => {},
|
|
20
|
+
onClick,
|
|
21
|
+
...props
|
|
22
|
+
}) => {
|
|
23
|
+
let preloadPromise;
|
|
24
|
+
let url = href || to || '';
|
|
25
|
+
if (url.startsWith('#') && !onClick) {
|
|
26
|
+
onClick = ev => {
|
|
27
|
+
ev.preventDefault(); // Don't use client-side routing
|
|
28
|
+
// Chrome does not jump until ALL network requests finish.
|
|
29
|
+
// We have to force it to...
|
|
30
|
+
const referencedElement = document.getElementById(url.replace('#', ''));
|
|
31
|
+
if (referencedElement) {
|
|
32
|
+
referencedElement.scrollIntoView();
|
|
33
|
+
}
|
|
34
|
+
// update URL without triggering route change
|
|
35
|
+
history.pushState({}, '', url);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (url.includes('//') || url.startsWith('#')) {
|
|
39
|
+
return <a href={url} onClick={onClick} {...props} />;
|
|
40
|
+
}
|
|
41
|
+
else if (url.startsWith('/')) {
|
|
42
|
+
url = `${process.env.pathPrefix}/${url.substr(1)}`;
|
|
43
|
+
|
|
44
|
+
if (!process.env.PRERENDER) {
|
|
45
|
+
const Component = getAsyncComponent(url);
|
|
46
|
+
if (Component) {
|
|
47
|
+
// Preload on hover
|
|
48
|
+
props.onMouseOver = () => {
|
|
49
|
+
preloadPromise = Component.preload();
|
|
50
|
+
onMouseOver();
|
|
51
|
+
};
|
|
52
|
+
// Wait up to an extra 500ms on click before showing 'Loading...'
|
|
53
|
+
props.onClick = ev => {
|
|
54
|
+
if (!(ev.ctrlKey || ev.metaKey)) { // avoid disallowing cmnd/ctrl+click opening in new tab
|
|
55
|
+
ev.preventDefault();
|
|
56
|
+
if (typeof window !== 'undefined' && url !== location.pathname) {
|
|
57
|
+
Promiseany([
|
|
58
|
+
preloadPromise,
|
|
59
|
+
new Promise(res => setTimeout(res, 500))
|
|
60
|
+
]).then(() => navigate(url));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return <ReachLink to={url} {...props} />;
|
|
68
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { slugger } from "../../helpers/slugger";
|
|
3
|
+
|
|
4
|
+
export const PropTypeWithLinks = ({ type, allPropComponents }) => {
|
|
5
|
+
// If this type contains the names of any other components on this page as full words, turn them into links.
|
|
6
|
+
const referencedComponentNames = allPropComponents
|
|
7
|
+
.filter((component) => type.match(new RegExp(`\\b${component.name}\\b`)))
|
|
8
|
+
.map((component) => component.name);
|
|
9
|
+
if (referencedComponentNames.length > 0) {
|
|
10
|
+
return (
|
|
11
|
+
<React.Fragment>
|
|
12
|
+
{type
|
|
13
|
+
.split(new RegExp(`\\b(${referencedComponentNames.join("|")})\\b`))
|
|
14
|
+
.map((segment, i) =>
|
|
15
|
+
referencedComponentNames.includes(segment) ? (
|
|
16
|
+
<a
|
|
17
|
+
key={segment + i}
|
|
18
|
+
onClick={(event) => {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
document.getElementById(slugger(segment)).scrollIntoView();
|
|
21
|
+
}}
|
|
22
|
+
>
|
|
23
|
+
{segment}
|
|
24
|
+
</a>
|
|
25
|
+
) : (
|
|
26
|
+
segment
|
|
27
|
+
)
|
|
28
|
+
)}
|
|
29
|
+
</React.Fragment>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return type;
|
|
33
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Badge } from '@patternfly/react-core';
|
|
3
|
+
import {
|
|
4
|
+
Table,
|
|
5
|
+
TableHeader,
|
|
6
|
+
TableBody,
|
|
7
|
+
cellWidth
|
|
8
|
+
} from '@patternfly/react-table';
|
|
9
|
+
import { AutoLinkHeader } from '../autoLinkHeader/autoLinkHeader';
|
|
10
|
+
import { PropTypeWithLinks } from './propTypeWithLinks';
|
|
11
|
+
import { css } from '@patternfly/react-styles';
|
|
12
|
+
import accessibleStyles from '@patternfly/react-styles/css/utilities/Accessibility/accessibility';
|
|
13
|
+
|
|
14
|
+
export const PropsTable = ({
|
|
15
|
+
title,
|
|
16
|
+
rows,
|
|
17
|
+
allPropComponents
|
|
18
|
+
}) => {
|
|
19
|
+
const columns = [
|
|
20
|
+
{ title: 'Name', transforms: [cellWidth(20)] },
|
|
21
|
+
{ title: 'Type', transforms: [cellWidth(20)] },
|
|
22
|
+
{ title: 'Default', transforms: [] },
|
|
23
|
+
{ title: 'Description', transforms: [] }
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<React.Fragment>
|
|
28
|
+
<AutoLinkHeader size="h3">
|
|
29
|
+
{title}
|
|
30
|
+
</AutoLinkHeader>
|
|
31
|
+
<Table
|
|
32
|
+
className="pf-u-mt-md pf-u-mb-lg"
|
|
33
|
+
variant="compact"
|
|
34
|
+
aria-label={title}
|
|
35
|
+
caption={<div><span className="ws-prop-required">*</span>required</div>}
|
|
36
|
+
cells={columns}
|
|
37
|
+
gridBreakPoint="grid-lg"
|
|
38
|
+
rows={rows
|
|
39
|
+
// Sort required rows first
|
|
40
|
+
.sort((a,b) => a.required === b.required
|
|
41
|
+
? 0
|
|
42
|
+
: a.required ? -1 : 1)
|
|
43
|
+
.map((row, idx) => ({
|
|
44
|
+
cells: [
|
|
45
|
+
<div className="pf-m-break-word">
|
|
46
|
+
{row.deprecated && 'Deprecated: '}
|
|
47
|
+
{row.name}
|
|
48
|
+
{row.required ? (
|
|
49
|
+
<React.Fragment key={`${row.name}-required-prop`}>
|
|
50
|
+
<span aria-hidden="true" key={`${row.name}-asterisk`} className="ws-prop-required">
|
|
51
|
+
*
|
|
52
|
+
</span>
|
|
53
|
+
<span key={`${row.name}-required`} className={css(accessibleStyles.screenReader)}>
|
|
54
|
+
required
|
|
55
|
+
</span>
|
|
56
|
+
</React.Fragment>
|
|
57
|
+
) : ''}
|
|
58
|
+
{row.beta && (
|
|
59
|
+
<Badge key={`${row.name}-${idx}`} className="ws-beta-badge pf-u-ml-sm">
|
|
60
|
+
Beta
|
|
61
|
+
</Badge>
|
|
62
|
+
)}
|
|
63
|
+
</div>,
|
|
64
|
+
<div className="pf-m-break-word">
|
|
65
|
+
<PropTypeWithLinks type={row.type} allPropComponents={allPropComponents} />
|
|
66
|
+
</div>,
|
|
67
|
+
<div className="pf-m-break-word">
|
|
68
|
+
{row.defaultValue}
|
|
69
|
+
</div>,
|
|
70
|
+
<div className="pf-m-break-word">
|
|
71
|
+
{row.description}
|
|
72
|
+
</div>
|
|
73
|
+
]
|
|
74
|
+
}))
|
|
75
|
+
}
|
|
76
|
+
>
|
|
77
|
+
<TableHeader />
|
|
78
|
+
<TableBody />
|
|
79
|
+
</Table>
|
|
80
|
+
</React.Fragment>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.ws-page-sidebar .pf-c-nav {
|
|
2
|
+
--pf-c-nav__link--before--BorderBottomWidth: 0;
|
|
3
|
+
--pf-c-nav--m-light__link--hover--BackgroundColor: var(--pf-global--BackgroundColor--light-200);
|
|
4
|
+
--pf-c-nav--m-light__link--focus--BackgroundColor: var(--pf-global--BackgroundColor--light-200);
|
|
5
|
+
--pf-c-nav--m-light__link--m-current--BackgroundColor: var(--pf-global--BackgroundColor--light-200);
|
|
6
|
+
--pf-c-nav--m-light__link--active--BackgroundColor: var(--pf-global--BackgroundColor--light-200);
|
|
7
|
+
--pf-c-nav__link--m-current--BackgroundColor: var(--pf-global--BackgroundColor--200);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ws-side-nav-list .pf-c-nav__item.pf-m-expandable::before {
|
|
11
|
+
border-bottom: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.pf-c-nav__subsection-title {
|
|
15
|
+
color: var(--ws-toc-link--Color, var(--pf-global--Color--300));
|
|
16
|
+
font-size: var(--pf-global--FontSize--sm);
|
|
17
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from '../link/link';
|
|
3
|
+
import { Nav, NavList, NavExpandable, PageContextConsumer, capitalize } from '@patternfly/react-core';
|
|
4
|
+
import { css } from '@patternfly/react-styles';
|
|
5
|
+
import { Location } from '@reach/router';
|
|
6
|
+
import { slugger } from '../../helpers';
|
|
7
|
+
import globalBreakpointXl from "@patternfly/react-tokens/dist/esm/global_breakpoint_xl";
|
|
8
|
+
import { trackEvent } from '../../helpers';
|
|
9
|
+
|
|
10
|
+
const NavItem = ({ text, href }) => {
|
|
11
|
+
const isMobileView = window.innerWidth < Number.parseInt(globalBreakpointXl.value, 10);
|
|
12
|
+
return (
|
|
13
|
+
<PageContextConsumer key={href + text}>
|
|
14
|
+
{({onNavToggle, isNavOpen }) => (
|
|
15
|
+
<li key={href + text} className="pf-c-nav__item" onClick={() => isMobileView && onNavToggle()}>
|
|
16
|
+
<Link
|
|
17
|
+
to={href}
|
|
18
|
+
getProps={({ isCurrent, href, location }) => {
|
|
19
|
+
const { pathname } = location;
|
|
20
|
+
return {
|
|
21
|
+
className: css(
|
|
22
|
+
'pf-c-nav__link',
|
|
23
|
+
(isCurrent || pathname.startsWith(href + '/')) && 'pf-m-current'
|
|
24
|
+
)
|
|
25
|
+
}}
|
|
26
|
+
}
|
|
27
|
+
tabIndex={isNavOpen ? undefined : -1}
|
|
28
|
+
>
|
|
29
|
+
{text}
|
|
30
|
+
</Link>
|
|
31
|
+
</li>
|
|
32
|
+
)}
|
|
33
|
+
</PageContextConsumer>
|
|
34
|
+
)
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const SideNav = ({ groupedRoutes = {}, navItems = [] }) => {
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
if (typeof window === 'undefined') {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const overflowElement = document.getElementById('page-sidebar');
|
|
43
|
+
if (!overflowElement) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const activeElements = overflowElement.getElementsByClassName('pf-m-current');
|
|
47
|
+
if (activeElements.length > 0) {
|
|
48
|
+
const lastElement = activeElements[activeElements.length - 1];
|
|
49
|
+
lastElement.scrollIntoView({ block: 'center' });
|
|
50
|
+
}
|
|
51
|
+
}, []);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Nav aria-label="Side Nav" theme="light">
|
|
55
|
+
<NavList className="ws-side-nav-list">
|
|
56
|
+
{navItems.map(({ section, text, href }) => section
|
|
57
|
+
? (
|
|
58
|
+
<Location key={section}>
|
|
59
|
+
{({ location }) => {
|
|
60
|
+
const isActive = location.pathname.startsWith(`${process.env.pathPrefix}/${slugger(section)}`);
|
|
61
|
+
return (
|
|
62
|
+
<NavExpandable
|
|
63
|
+
title={capitalize(section.replace(/-/g, ' '))}
|
|
64
|
+
isActive={isActive}
|
|
65
|
+
isExpanded={isActive}
|
|
66
|
+
className="ws-side-nav-group"
|
|
67
|
+
onClick={(event) => {
|
|
68
|
+
// Don't trigger for bubbled events from NavItems
|
|
69
|
+
if (!event.target.href) {
|
|
70
|
+
const isExpanded = event.currentTarget.classList.contains('pf-m-expanded');
|
|
71
|
+
// 1 === expand section, 0 === collapse section
|
|
72
|
+
trackEvent('sidenav_section_click', 'click_event', section, isExpanded ? 0 : 1);
|
|
73
|
+
}
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
{Object.entries(groupedRoutes[section] || {})
|
|
77
|
+
.filter(([, { hideNavItem }]) => !Boolean(hideNavItem))
|
|
78
|
+
.map(([id, { slug }]) => ({ text: id, href: slug }))
|
|
79
|
+
.sort(({ text: text1 }, { text: text2 }) => text1.localeCompare(text2))
|
|
80
|
+
.map(NavItem)
|
|
81
|
+
}
|
|
82
|
+
</NavExpandable>
|
|
83
|
+
);
|
|
84
|
+
}}
|
|
85
|
+
</Location>
|
|
86
|
+
)
|
|
87
|
+
: NavItem({
|
|
88
|
+
text: text || capitalize(href.replace(/\//g, '').replace(/-/g, ' ')),
|
|
89
|
+
href: href
|
|
90
|
+
})
|
|
91
|
+
)}
|
|
92
|
+
</NavList>
|
|
93
|
+
</Nav>
|
|
94
|
+
);
|
|
95
|
+
}
|