@patternfly/documentation-framework 5.1.12 → 5.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## 5.1.13 (2023-09-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## 5.1.12 (2023-09-01)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @patternfly/documentation-framework
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import { useLocation } from '@reach/router';
|
|
3
3
|
import { Button, CodeBlock, Flex, CodeBlockCode, debounce, Label, Switch, Tooltip } from '@patternfly/react-core';
|
|
4
4
|
import * as reactCoreModule from '@patternfly/react-core';
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from '../../helpers';
|
|
21
21
|
import { convertToReactComponent } from '@patternfly/ast-helpers';
|
|
22
22
|
import missingThumbnail from './missing-thumbnail.jpg';
|
|
23
|
+
import { RtlContext } from '../../layouts';
|
|
23
24
|
|
|
24
25
|
const errorComponent = err => <pre>{err.toString()}</pre>;
|
|
25
26
|
|
|
@@ -112,6 +113,7 @@ export const Example = ({
|
|
|
112
113
|
|
|
113
114
|
const [editorCode, setEditorCode] = React.useState(code);
|
|
114
115
|
const loc = useLocation();
|
|
116
|
+
const isRTL = useContext(RtlContext);
|
|
115
117
|
const scope = {
|
|
116
118
|
...liveContext,
|
|
117
119
|
// These 2 are in the bundle anyways for the site since we dogfood
|
|
@@ -161,14 +163,17 @@ export const Example = ({
|
|
|
161
163
|
<div id={previewId} className={css(className, 'pf-v5-u-h-100')}>
|
|
162
164
|
{livePreview}
|
|
163
165
|
{(hasDarkThemeSwitcher || hasRTLSwitcher) && (
|
|
164
|
-
<Flex direction={{ default: 'column' }} gap={{ default: 'gapLg' }} className="ws-full-page-utils
|
|
166
|
+
<Flex direction={{ default: 'column' }} gap={{ default: 'gapLg' }} className="ws-full-page-utils pf-v5-m-dir-ltr ">
|
|
165
167
|
{hasDarkThemeSwitcher && (
|
|
166
|
-
<Switch id="ws-theme-switch" label="Dark theme" defaultChecked={false} onChange={() =>
|
|
168
|
+
<Switch id="ws-example-theme-switch" label="Dark theme" defaultChecked={false} onChange={() =>
|
|
167
169
|
document.querySelector('html').classList.toggle('pf-v5-theme-dark')} />
|
|
168
170
|
)}
|
|
169
171
|
{hasRTLSwitcher && (
|
|
170
|
-
<Switch id="ws-rtl-switch" label="RTL" defaultChecked={false} onChange={() =>
|
|
171
|
-
|
|
172
|
+
<Switch id="ws-example-rtl-switch" label="RTL" defaultChecked={false} onChange={() => {
|
|
173
|
+
const html = document.querySelector('html');
|
|
174
|
+
const curDir = html.dir;
|
|
175
|
+
html.dir = (curDir !== 'rtl') ? 'rtl' : 'ltr';
|
|
176
|
+
}} />
|
|
172
177
|
)}
|
|
173
178
|
</Flex>
|
|
174
179
|
)}
|
|
@@ -236,7 +241,11 @@ export const Example = ({
|
|
|
236
241
|
</div>
|
|
237
242
|
: <div
|
|
238
243
|
id={previewId}
|
|
239
|
-
className={css(
|
|
244
|
+
className={css(
|
|
245
|
+
className,
|
|
246
|
+
isFullscreen ? 'ws-preview-fullscreen' : 'ws-preview',
|
|
247
|
+
isRTL && 'pf-v5-m-dir-rtl')
|
|
248
|
+
}
|
|
240
249
|
>
|
|
241
250
|
{livePreview}
|
|
242
251
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
1
|
+
import React, { useEffect, useState, createContext } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Button,
|
|
4
4
|
Page,
|
|
@@ -29,17 +29,19 @@ import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
|
|
|
29
29
|
import GithubIcon from '@patternfly/react-icons/dist/esm/icons/github-icon';
|
|
30
30
|
import { SideNav, TopNav, GdprBanner } from '../../components';
|
|
31
31
|
import staticVersions from '../../versions.json';
|
|
32
|
-
import logoMd from '../logo__pf--reverse-on-md.svg';
|
|
33
|
-
import logo from '../logo__pf--reverse--base.svg';
|
|
34
|
-
import logoBase from '../logo__pf--reverse--base.png';
|
|
35
32
|
import v5Logo from '../PF-HorizontalLogo-Reverse.svg';
|
|
36
33
|
|
|
34
|
+
export const RtlContext = createContext(false);
|
|
35
|
+
|
|
37
36
|
const HeaderTools = ({
|
|
38
37
|
versions,
|
|
39
38
|
hasVersionSwitcher,
|
|
40
39
|
algolia,
|
|
41
40
|
hasDarkThemeSwitcher,
|
|
42
|
-
|
|
41
|
+
hasRTLSwitcher,
|
|
42
|
+
topNavItems,
|
|
43
|
+
isRTL,
|
|
44
|
+
setIsRTL
|
|
43
45
|
}) => {
|
|
44
46
|
const initialVersion = staticVersions.Releases.find(release => release.latest);
|
|
45
47
|
const latestVersion = versions.Releases.find(version => version.latest);
|
|
@@ -87,6 +89,11 @@ const HeaderTools = ({
|
|
|
87
89
|
document.querySelector('html').classList.toggle('pf-v5-theme-dark')} />
|
|
88
90
|
</ToolbarItem>
|
|
89
91
|
)}
|
|
92
|
+
{hasRTLSwitcher && (
|
|
93
|
+
<ToolbarItem>
|
|
94
|
+
<Switch id="ws-rtl-switch" label={'RTL'} defaultChecked={isRTL} onChange={() => setIsRTL(isRTL => !isRTL)} />
|
|
95
|
+
</ToolbarItem>
|
|
96
|
+
)}
|
|
90
97
|
{hasSearch && (
|
|
91
98
|
<ToolbarItem>
|
|
92
99
|
<SearchInput
|
|
@@ -194,12 +201,14 @@ export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp })
|
|
|
194
201
|
const hasGdprBanner = process.env.hasGdprBanner;
|
|
195
202
|
const hasVersionSwitcher = process.env.hasVersionSwitcher;
|
|
196
203
|
const hasDarkThemeSwitcher = process.env.hasDarkThemeSwitcher;
|
|
204
|
+
const hasRTLSwitcher = process.env.hasRTLSwitcher;
|
|
197
205
|
const sideNavItems = process.env.sideNavItems;
|
|
198
206
|
const topNavItems = process.env.topNavItems;
|
|
199
207
|
const prnum = process.env.prnum;
|
|
200
208
|
const prurl = process.env.prurl;
|
|
201
209
|
|
|
202
210
|
const [versions, setVersions] = useState({ ...staticVersions });
|
|
211
|
+
const [isRTL, setIsRTL] = useState(false);
|
|
203
212
|
|
|
204
213
|
useEffect(() => {
|
|
205
214
|
if (typeof window === 'undefined') {
|
|
@@ -246,7 +255,10 @@ export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp })
|
|
|
246
255
|
algolia={algolia}
|
|
247
256
|
hasVersionSwitcher={hasVersionSwitcher}
|
|
248
257
|
hasDarkThemeSwitcher={hasDarkThemeSwitcher}
|
|
258
|
+
hasRTLSwitcher={hasRTLSwitcher}
|
|
249
259
|
topNavItems={topNavItems}
|
|
260
|
+
isRTL={isRTL}
|
|
261
|
+
setIsRTL={setIsRTL}
|
|
250
262
|
/>
|
|
251
263
|
)}
|
|
252
264
|
</MastheadContent>
|
|
@@ -255,20 +267,22 @@ export const SideNavLayout = ({ children, groupedRoutes, navOpen: navOpenProp })
|
|
|
255
267
|
|
|
256
268
|
return (
|
|
257
269
|
<React.Fragment>
|
|
258
|
-
<
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
<RtlContext.Provider value={ isRTL }>
|
|
271
|
+
<div id="ws-page-banners">
|
|
272
|
+
{hasGdprBanner && <GdprBanner />}
|
|
273
|
+
</div>
|
|
274
|
+
<Page
|
|
275
|
+
id="ws-page"
|
|
276
|
+
mainContainerId="ws-page-main"
|
|
277
|
+
header={Header}
|
|
278
|
+
sidebar={SideBar}
|
|
279
|
+
skipToContent={<SkipToContent href="#ws-page-main">Skip to content</SkipToContent>}
|
|
280
|
+
isManagedSidebar
|
|
281
|
+
defaultManagedSidebarIsOpen={navOpenProp}
|
|
282
|
+
>
|
|
283
|
+
{children}
|
|
284
|
+
</Page>
|
|
285
|
+
</RtlContext.Provider>
|
|
272
286
|
</React.Fragment>
|
|
273
287
|
);
|
|
274
288
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/documentation-framework",
|
|
3
3
|
"description": "A framework to build documentation for PatternFly.",
|
|
4
|
-
"version": "5.1.
|
|
4
|
+
"version": "5.1.13",
|
|
5
5
|
"author": "Red Hat",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@babel/plugin-transform-react-jsx": "7.17.12",
|
|
18
18
|
"@babel/preset-env": "7.18.2",
|
|
19
19
|
"@mdx-js/util": "1.6.16",
|
|
20
|
-
"@patternfly/ast-helpers": "^1.1.
|
|
20
|
+
"@patternfly/ast-helpers": "^1.1.13",
|
|
21
21
|
"@reach/router": "npm:@gatsbyjs/reach-router@1.3.9",
|
|
22
22
|
"autoprefixer": "9.8.6",
|
|
23
23
|
"babel-loader": "9.1.2",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"react": "^17.0.0 || ^18.0.0",
|
|
88
88
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "a988de64b34094502f779c33ac01d3c0d31f6eee"
|
|
91
91
|
}
|
|
@@ -13,8 +13,8 @@ module.exports = (_env, argv) => {
|
|
|
13
13
|
hasFooter = false,
|
|
14
14
|
hasVersionSwitcher = false,
|
|
15
15
|
hasDesignGuidelines = false,
|
|
16
|
-
hasRTLSwitcher = false,
|
|
17
16
|
hasDarkThemeSwitcher = false,
|
|
17
|
+
hasRTLSwitcher = false,
|
|
18
18
|
componentsData = {},
|
|
19
19
|
sideNavItems = [],
|
|
20
20
|
topNavItems = [],
|