@patternfly/documentation-framework 1.2.8 → 1.2.11

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,33 @@
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
+ ## 1.2.11 (2022-08-30)
7
+
8
+ **Note:** Version bump only for package @patternfly/documentation-framework
9
+
10
+
11
+
12
+
13
+
14
+ ## 1.2.10 (2022-08-29)
15
+
16
+ **Note:** Version bump only for package @patternfly/documentation-framework
17
+
18
+
19
+
20
+
21
+
22
+ ## 1.2.9 (2022-08-29)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **example:** increase code editor button tooltip size, other cleanup ([#3162](https://github.com/patternfly/patternfly-org/issues/3162)) ([fab30f5](https://github.com/patternfly/patternfly-org/commit/fab30f5b94b648605fd9efb980fc6eea2e772a79))
28
+
29
+
30
+
31
+
32
+
6
33
  ## 1.2.8 (2022-08-26)
7
34
 
8
35
  **Note:** Version bump only for package @patternfly/documentation-framework
@@ -1,3 +1,7 @@
1
+ :root {
2
+ --ws-code-editor--tooltip--MaxWidth: 16ch;
3
+ }
4
+
1
5
  .ws-example {
2
6
  margin-top: var(--pf-global--spacer--lg);
3
7
  margin-bottom: var(--pf-global--spacer--lg);
@@ -128,4 +132,4 @@
128
132
 
129
133
  .pf-theme-dark .ws-theme-switch-full-page::before {
130
134
  background-color: var(--pf-global--BackgroundColor--300);
131
- }
135
+ }
@@ -42,16 +42,6 @@ export const ExampleToolbar = ({
42
42
  const [isEditorOpen, setIsEditorOpen] = React.useState(false);
43
43
  const [isCopied, setCopied] = React.useState(false);
44
44
 
45
- const copyCode = () => {
46
- copy(code);
47
-
48
- setCopied(true);
49
- // Reset isCopied after Tooltip fades out
50
- setTimeout(() => {
51
- setCopied(false);
52
- }, 2500);
53
- };
54
-
55
45
  const copyLabel = 'Copy code to clipboard';
56
46
  const languageLabel = `Toggle ${lang.toUpperCase()} code`;
57
47
  const codesandboxLabel = 'Open example in CodeSandbox';
@@ -66,6 +56,22 @@ export const ExampleToolbar = ({
66
56
  const convertAriaLabel = `Convert ${exampleTitle} example from Typescript to JavaScript`;
67
57
  const undoAllAriaLabel = `Undo all changes to ${exampleTitle}`;
68
58
 
59
+ const editorControlProps = {
60
+ maxWidth: 'var(--ws-code-editor--tooltip--MaxWidth)',
61
+ className: "ws-code-editor-control",
62
+ exitDelay: 300
63
+ };
64
+
65
+ const copyCode = () => {
66
+ copy(code);
67
+
68
+ setCopied(true);
69
+ // Reset isCopied after Tooltip fades out
70
+ setTimeout(() => {
71
+ setCopied(false);
72
+ }, 2500);
73
+ };
74
+
69
75
  const customControls = (
70
76
  <React.Fragment>
71
77
  <CodeEditorControl
@@ -83,38 +89,37 @@ export const ExampleToolbar = ({
83
89
  aria-label={languageAriaLabel}
84
90
  toolTipText={languageLabel}
85
91
  aria-expanded={isEditorOpen}
86
- className="ws-code-editor-control"
92
+ {...editorControlProps}
87
93
  />
88
94
  <Tooltip
89
95
  trigger="mouseenter"
90
96
  content={<div>{isCopied ? 'Code copied' : copyLabel}</div>}
91
- exitDelay={isCopied ? 1600 : 300}
92
- entryDelay={300}
93
- maxWidth="100px"
94
- position="top"
97
+ {...(isCopied && {exitDelay: 1600})}
98
+ maxWidth={editorControlProps.maxWidth}
95
99
  >
96
- <Button onClick={() => {
97
- copyCode();
98
- trackEvent('code_editor_control_click', 'click_event', 'COPY_CODE');
99
- }} variant="control" aria-label={copyAriaLabel} className="ws-code-editor-control">
100
+ <Button
101
+ onClick={() => {
102
+ copyCode();
103
+ trackEvent('code_editor_control_click', 'click_event', 'COPY_CODE');
104
+ }}
105
+ variant="control"
106
+ aria-label={copyAriaLabel}
107
+ className={editorControlProps.className}
108
+ >
100
109
  <CopyIcon />
101
110
  </Button>
102
111
  </Tooltip>
103
112
  {codeBoxParams &&
104
- <Tooltip
105
- trigger="mouseenter"
106
- content={codesandboxLabel}
107
- exitDelay={300}
108
- entryDelay={300}
109
- maxWidth="100px"
110
- position="top"
113
+ <Form
114
+ aria-label={`${codesandboxAriaLabel} form` }
115
+ action="https://codesandbox.io/api/v1/sandboxes/define"
116
+ method="POST"
117
+ target="_blank"
118
+ style={{ display: "inline-block" }}
111
119
  >
112
- <Form
113
- aria-label={`${codesandboxAriaLabel} form` }
114
- action="https://codesandbox.io/api/v1/sandboxes/define"
115
- method="POST"
116
- target="_blank"
117
- style={{ display: "inline-block" }}
120
+ <Tooltip
121
+ content={codesandboxLabel}
122
+ maxWidth={editorControlProps.maxWidth}
118
123
  >
119
124
  <Button
120
125
  aria-label={codesandboxAriaLabel}
@@ -123,13 +128,13 @@ export const ExampleToolbar = ({
123
128
  onClick={() => {
124
129
  trackEvent('code_editor_control_click', 'click_event', 'CODESANDBOX_LINK');
125
130
  }}
126
- className="ws-code-editor-control"
131
+ className={editorControlProps.className}
127
132
  >
128
- <input type="hidden" name="parameters" value={codeBoxParams} />
129
133
  <CodepenIcon />
130
134
  </Button>
131
- </Form>
132
- </Tooltip>
135
+ </Tooltip>
136
+ <input type="hidden" name="parameters" value={codeBoxParams} />
137
+ </Form>
133
138
  }
134
139
  {fullscreenLink &&
135
140
  <CodeEditorControl
@@ -143,7 +148,7 @@ export const ExampleToolbar = ({
143
148
  onClick={() => {
144
149
  trackEvent('code_editor_control_click', 'click_event', 'FULLSCREEN_LINK');
145
150
  }}
146
- className="ws-code-editor-control"
151
+ {...editorControlProps}
147
152
  />
148
153
  }
149
154
  {isEditorOpen && lang === 'ts' &&
@@ -159,7 +164,7 @@ export const ExampleToolbar = ({
159
164
  setCode(convertToJSX(code).code);
160
165
  trackEvent('code_editor_control_click', 'click_event', 'TS_TO_JS');
161
166
  }}
162
- className="ws-code-editor-control"
167
+ {...editorControlProps}
163
168
  />
164
169
  }
165
170
  {code !== originalCode &&
@@ -171,7 +176,7 @@ export const ExampleToolbar = ({
171
176
  setCode(originalCode);
172
177
  trackEvent('code_editor_control_click', 'click_event', 'RESET_CODE');
173
178
  }}
174
- className="ws-code-editor-control"
179
+ {...editorControlProps}
175
180
  />
176
181
  }
177
182
  </React.Fragment>
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": "1.2.8",
4
+ "version": "1.2.11",
5
5
  "author": "Red Hat",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -84,5 +84,5 @@
84
84
  "react": "^16.8.0 || ^17.0.0",
85
85
  "react-dom": "^16.8.0 || ^17.0.0"
86
86
  },
87
- "gitHead": "2942543cb4647ce220f5feeeadbd0ea91a359417"
87
+ "gitHead": "21654fcf770cf347149cef72e5fff295074dadb2"
88
88
  }
@@ -46,9 +46,11 @@ async function buildWebpack(webpackConfig) {
46
46
  async function execFile(file, args) {
47
47
  const start = new Date();
48
48
  return new Promise((res, rej) => {
49
- const child = fork(path.join(__dirname, file), args, {
50
- execArgv: ['--max-old-space-size=4096']
51
- });
49
+ const child_argv = [JSON.stringify(args)];
50
+ const child_execArgv = [
51
+ '--max-old-space-size=4096'
52
+ ];
53
+ const child = fork(path.join(__dirname, file), child_argv, { execArgv: child_execArgv });
52
54
  function errorHandler(err) {
53
55
  console.error(err);
54
56
  process.exit(1);
@@ -84,14 +86,14 @@ async function build(cmd, options) {
84
86
  if (toBuild.includes('server')) {
85
87
  // Need to fork since first webpack build puts pressure on GC
86
88
  // Otherwise CircleCI will fail with 4GB RAM
87
- await execFile('buildServer.js', [JSON.stringify(config)]);
89
+ await execFile('buildServer.js', config);
88
90
  }
89
91
  if (toBuild.includes('client')) {
90
- await execFile('buildClient.js', [JSON.stringify(config)]);
92
+ await execFile('buildClient.js', config);
91
93
  }
92
94
  }
93
95
 
94
96
  module.exports = {
95
97
  build,
96
98
  buildWebpack
97
- };
99
+ };