@patternfly/documentation-framework 1.2.8 → 1.2.9
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,17 @@
|
|
|
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.9 (2022-08-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **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))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 1.2.8 (2022-08-26)
|
|
7
18
|
|
|
8
19
|
**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
|
-
|
|
92
|
+
{...editorControlProps}
|
|
87
93
|
/>
|
|
88
94
|
<Tooltip
|
|
89
95
|
trigger="mouseenter"
|
|
90
96
|
content={<div>{isCopied ? 'Code copied' : copyLabel}</div>}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
maxWidth="100px"
|
|
94
|
-
position="top"
|
|
97
|
+
{...(isCopied && {exitDelay: 1600})}
|
|
98
|
+
maxWidth={editorControlProps.maxWidth}
|
|
95
99
|
>
|
|
96
|
-
<Button
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
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=
|
|
131
|
+
className={editorControlProps.className}
|
|
127
132
|
>
|
|
128
|
-
<input type="hidden" name="parameters" value={codeBoxParams} />
|
|
129
133
|
<CodepenIcon />
|
|
130
134
|
</Button>
|
|
131
|
-
</
|
|
132
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
4
|
+
"version": "1.2.9",
|
|
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": "
|
|
87
|
+
"gitHead": "d57187e286ba282527a77a189f47319f0fc3afd2"
|
|
88
88
|
}
|