@patternfly/react-core 4.264.0 → 4.264.1

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 (49) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/umd/react-core.min.css +356 -356
  3. package/package.json +10 -3
  4. package/src/components/Tooltip/examples/Tooltip.md +5 -285
  5. package/src/components/Tooltip/examples/TooltipBasic.tsx +16 -0
  6. package/src/components/Tooltip/examples/TooltipIcon.tsx +24 -0
  7. package/src/components/Tooltip/examples/TooltipOptions.tsx +197 -0
  8. package/src/components/Tooltip/examples/TooltipReactRef.tsx +22 -0
  9. package/src/components/Tooltip/examples/TooltipSelectorRef.tsx +19 -0
  10. package/dist/esm/components/Button/__mocks__/Button.d.ts +0 -8
  11. package/dist/esm/components/Button/__mocks__/Button.d.ts.map +0 -1
  12. package/dist/esm/components/Button/__mocks__/Button.js +0 -14
  13. package/dist/esm/components/Button/__mocks__/Button.js.map +0 -1
  14. package/dist/esm/components/Button/__mocks__/index.d.ts +0 -2
  15. package/dist/esm/components/Button/__mocks__/index.d.ts.map +0 -1
  16. package/dist/esm/components/Button/__mocks__/index.js +0 -2
  17. package/dist/esm/components/Button/__mocks__/index.js.map +0 -1
  18. package/dist/esm/components/HelperText/__mocks__/HelperText.d.ts +0 -4
  19. package/dist/esm/components/HelperText/__mocks__/HelperText.d.ts.map +0 -1
  20. package/dist/esm/components/HelperText/__mocks__/HelperText.js +0 -5
  21. package/dist/esm/components/HelperText/__mocks__/HelperText.js.map +0 -1
  22. package/dist/esm/components/HelperText/__mocks__/HelperTextItem.d.ts +0 -4
  23. package/dist/esm/components/HelperText/__mocks__/HelperTextItem.d.ts.map +0 -1
  24. package/dist/esm/components/HelperText/__mocks__/HelperTextItem.js +0 -5
  25. package/dist/esm/components/HelperText/__mocks__/HelperTextItem.js.map +0 -1
  26. package/dist/esm/components/HelperText/__mocks__/index.d.ts +0 -3
  27. package/dist/esm/components/HelperText/__mocks__/index.d.ts.map +0 -1
  28. package/dist/esm/components/HelperText/__mocks__/index.js +0 -3
  29. package/dist/esm/components/HelperText/__mocks__/index.js.map +0 -1
  30. package/dist/js/components/Button/__mocks__/Button.d.ts +0 -8
  31. package/dist/js/components/Button/__mocks__/Button.d.ts.map +0 -1
  32. package/dist/js/components/Button/__mocks__/Button.js +0 -18
  33. package/dist/js/components/Button/__mocks__/Button.js.map +0 -1
  34. package/dist/js/components/Button/__mocks__/index.d.ts +0 -2
  35. package/dist/js/components/Button/__mocks__/index.d.ts.map +0 -1
  36. package/dist/js/components/Button/__mocks__/index.js +0 -5
  37. package/dist/js/components/Button/__mocks__/index.js.map +0 -1
  38. package/dist/js/components/HelperText/__mocks__/HelperText.d.ts +0 -4
  39. package/dist/js/components/HelperText/__mocks__/HelperText.d.ts.map +0 -1
  40. package/dist/js/components/HelperText/__mocks__/HelperText.js +0 -10
  41. package/dist/js/components/HelperText/__mocks__/HelperText.js.map +0 -1
  42. package/dist/js/components/HelperText/__mocks__/HelperTextItem.d.ts +0 -4
  43. package/dist/js/components/HelperText/__mocks__/HelperTextItem.d.ts.map +0 -1
  44. package/dist/js/components/HelperText/__mocks__/HelperTextItem.js +0 -10
  45. package/dist/js/components/HelperText/__mocks__/HelperTextItem.js.map +0 -1
  46. package/dist/js/components/HelperText/__mocks__/index.d.ts +0 -3
  47. package/dist/js/components/HelperText/__mocks__/index.d.ts.map +0 -1
  48. package/dist/js/components/HelperText/__mocks__/index.js +0 -6
  49. package/dist/js/components/HelperText/__mocks__/index.js.map +0 -1
package/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.264.0",
3
+ "version": "4.264.1",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/esm/index.d.ts",
8
+ "exports": {
9
+ ".": "./dist/esm/index.js",
10
+ "./dist/*": "./dist/*",
11
+ "./next": "./dist/esm/next",
12
+ "./deprecated": "./dist/esm/deprecated",
13
+ "./package.json": "./package.json"
14
+ },
8
15
  "typesVersions": {
9
16
  "*": {
10
17
  "next": [
@@ -55,7 +62,7 @@
55
62
  "devDependencies": {
56
63
  "@patternfly/patternfly": "4.221.2",
57
64
  "@rollup/plugin-commonjs": "^21.0.0",
58
- "@rollup/plugin-node-resolve": "^13.0.0",
65
+ "@rollup/plugin-node-resolve": "^15.0.1",
59
66
  "@rollup/plugin-replace": "^3.0.0",
60
67
  "css": "^2.2.3",
61
68
  "fs-extra": "^6.0.1",
@@ -70,5 +77,5 @@
70
77
  "react": "^16.8 || ^17 || ^18",
71
78
  "react-dom": "^16.8 || ^17 || ^18"
72
79
  },
73
- "gitHead": "e1f95ce96852165dd4d102cd87c6b49288f01eff"
80
+ "gitHead": "3c9dd17f7327ffafa0b9751074b188ea19eaeee6"
74
81
  }
@@ -13,68 +13,17 @@ import './TooltipExamples.css';
13
13
 
14
14
  ### Basic
15
15
 
16
- ```js
17
- import React from 'react';
18
- import { Tooltip } from '@patternfly/react-core';
19
-
20
- <div style={{ margin: '100px' }}>
21
- <Tooltip
22
- content={
23
- <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.</div>
24
- }
25
- >
26
- <span tabIndex="0" style={{ border: '1px dashed' }}>
27
- I have a tooltip!
28
- </span>
29
- </Tooltip>
30
- </div>;
16
+ ```ts file="./TooltipBasic.tsx"
31
17
  ```
32
18
 
33
19
  ### Tooltip react ref
34
20
 
35
- ```js
36
- import React from 'react';
37
- import { Tooltip } from '@patternfly/react-core';
38
-
39
- TooltipReactRef = () => {
40
- const tooltipRef = React.useRef();
41
- return (
42
- <div style={{ margin: '100px' }}>
43
- <button aria-describedby="tooltip-ref1" ref={tooltipRef}>
44
- Tooltip attached via react ref
45
- </button>
46
- <Tooltip
47
- id="tooltip-ref1"
48
- content={
49
- <div>
50
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.
51
- </div>
52
- }
53
- reference={tooltipRef}
54
- />
55
- </div>
56
- );
57
- };
21
+ ```ts file="./TooltipReactRef.tsx"
58
22
  ```
59
23
 
60
24
  ### Tooltip selector ref
61
25
 
62
- ```js
63
- import React from 'react';
64
- import { Tooltip } from '@patternfly/react-core';
65
-
66
- <div style={{ margin: '100px' }}>
67
- <button aria-describedby="tooltip-ref2" id="tooltip-selector">
68
- Tooltip attached via selector ref
69
- </button>
70
- <Tooltip
71
- id="tooltip-ref2"
72
- content={
73
- <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.</div>
74
- }
75
- reference={() => document.getElementById('tooltip-selector')}
76
- />
77
- </div>;
26
+ ```ts file="./TooltipSelectorRef.tsx"
78
27
  ```
79
28
 
80
29
  ### On icon with dynamic content
@@ -83,239 +32,10 @@ When the tooltip is used as a wrapper and its content will dynamically update, t
83
32
 
84
33
  When using a React or selector ref with a tooltip that has dynamic content, the `aria` and `aria-live` props do not need to be manually passed in.
85
34
 
86
- ```js
87
- import React from 'react';
88
- import { Tooltip, Button } from '@patternfly/react-core';
89
- import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
90
-
91
- IconExample = () => {
92
- const [showSuccessContent, setShowSuccessContent] = React.useState(false);
93
- const copyText = 'Copy to clipboard';
94
- const doneCopyText = 'Successfully copied to clipboard!';
95
- const [content, setContent] = React.useState(copyText);
96
- return (
97
- <div style={{ margin: '100px' }}>
98
- <Tooltip aria="none" aria-live="polite" content={showSuccessContent ? doneCopyText : copyText}>
99
- <Button
100
- aria-label="Clipboard"
101
- variant="plain"
102
- id="tt-ref"
103
- onClick={() => setShowSuccessContent(!showSuccessContent)}
104
- >
105
- <CopyIcon />
106
- </Button>
107
- </Tooltip>
108
- </div>
109
- );
110
- };
35
+ ```ts file="./TooltipIcon.tsx"
111
36
  ```
112
37
 
113
38
  ### Options
114
39
 
115
- ```js
116
- import React from 'react';
117
- import { Button, Tooltip, Checkbox, Select, SelectOption, TextInput } from '@patternfly/react-core';
118
-
119
- OptionsTooltip = () => {
120
- const [trigger, setTrigger] = React.useState(['mouseenter', 'focus']);
121
- const [isVisible, setIsVisible] = React.useState(true);
122
- const [contentLeftAligned, setContentLeftAligned] = React.useState(false);
123
- const [enableFlip, setEnableFlip] = React.useState(true);
124
- const [position, setPosition] = React.useState('top');
125
- const [positionSelectOpen, setPositionSelectOpen] = React.useState(false);
126
- const [flipSelectOpen, setFlipSelectOpen] = React.useState(false);
127
- const [flipBehavior, setFlipBehavior] = React.useState('flip');
128
- const [entryDelayInput, setEntryDelayInput] = React.useState(0);
129
- const [exitDelayInput, setExitDelayInput] = React.useState(0);
130
- const [animationDuration, setAnimationDuration] = React.useState(300);
131
- const tipBoxRef = React.useRef(null);
132
-
133
- const scrollToRef = ref => {
134
- if (ref && ref.current) {
135
- ref.current.scrollTop = 400;
136
- ref.current.scrollLeft = 300;
137
- }
138
- };
139
-
140
- React.useEffect(() => {
141
- scrollToRef(tipBoxRef);
142
- }, []);
143
-
144
- return (
145
- <>
146
- <div>
147
- <div style={{ border: '1px solid' }}>
148
- <Checkbox
149
- label="trigger: mouseenter"
150
- isChecked={trigger.includes('mouseenter')}
151
- onChange={checked => {
152
- let updatedTrigger;
153
- checked && (updatedTrigger = trigger.concat('mouseenter'));
154
- !checked && (updatedTrigger = trigger.filter(t => t !== 'mouseenter'));
155
- setIsVisible(false);
156
- setTrigger(updatedTrigger);
157
- }}
158
- aria-label="trigger: mouseenter"
159
- id="trigger_mouseenter"
160
- />
161
- <Checkbox
162
- label="trigger: focus"
163
- isChecked={trigger.includes('focus')}
164
- onChange={checked => {
165
- let updatedTrigger;
166
- checked && (updatedTrigger = trigger.concat('focus'));
167
- !checked && (updatedTrigger = trigger.filter(t => t !== 'focus'));
168
- setIsVisible(false);
169
- setTrigger(updatedTrigger);
170
- }}
171
- aria-label="trigger: focus"
172
- id="trigger_focus"
173
- />
174
- <Checkbox
175
- label="trigger: click"
176
- isChecked={trigger.includes('click')}
177
- onChange={checked => {
178
- let updatedTrigger;
179
- checked && (updatedTrigger = trigger.concat('click'));
180
- !checked && (updatedTrigger = trigger.filter(t => t !== 'click'));
181
- setIsVisible(false);
182
- setTimeout(() => setTrigger(updatedTrigger));
183
- }}
184
- aria-label="trigger: click"
185
- id="trigger_click"
186
- />
187
- <Checkbox
188
- label="trigger: manual"
189
- isChecked={trigger.includes('manual')}
190
- onChange={checked => {
191
- let updatedTrigger;
192
- checked && (updatedTrigger = trigger.concat('manual'));
193
- !checked && (updatedTrigger = trigger.filter(t => t !== 'manual'));
194
- setIsVisible(false);
195
- setTrigger(updatedTrigger);
196
- }}
197
- aria-label="trigger: manual"
198
- id="trigger_manual"
199
- />
200
- </div>
201
- <div style={{ border: '1px solid' }}>
202
- <Checkbox
203
- label="content left-aligned"
204
- isChecked={contentLeftAligned}
205
- onChange={checked => setContentLeftAligned(checked)}
206
- aria-label="content left-aligned"
207
- id="content_left_aligned"
208
- />
209
- </div>
210
- <div style={{ border: '1px solid' }}>
211
- <Checkbox
212
- label="enableFlip"
213
- isChecked={enableFlip}
214
- onChange={checked => setEnableFlip(checked)}
215
- aria-label="enableFlip"
216
- id="enable_flip"
217
- />
218
- </div>
219
- <div style={{ border: '1px solid' }}>
220
- position (will flip if enableFlip is true). The 'auto' position requires enableFlip to be set to true.
221
- <Select
222
- onToggle={() => setPositionSelectOpen(!positionSelectOpen)}
223
- onSelect={(event, selection) => {
224
- setPosition(selection);
225
- setPositionSelectOpen(false);
226
- }}
227
- isOpen={positionSelectOpen}
228
- selections={position}
229
- menuAppendTo={() => document.body}
230
- >
231
- <SelectOption value="auto" />
232
- <SelectOption value="top" />
233
- <SelectOption value="bottom" />
234
- <SelectOption value="left" />
235
- <SelectOption value="right" />
236
- <SelectOption value="top-start" />
237
- <SelectOption value="top-end" />
238
- <SelectOption value="bottom-start" />
239
- <SelectOption value="bottom-end" />
240
- <SelectOption value="left-start" />
241
- <SelectOption value="left-end" />
242
- <SelectOption value="right-start" />
243
- <SelectOption value="right-end" />
244
- </Select>
245
- </div>
246
- <div style={{ border: '1px solid' }}>
247
- <Checkbox
248
- label="isVisible (also set trigger to only manual to programmatically control it)"
249
- isChecked={isVisible}
250
- onChange={checked => setIsVisible(checked)}
251
- aria-label="isVisible"
252
- id="is_visible"
253
- />
254
- </div>
255
- <div style={{ border: '1px solid' }}>
256
- Entry delay (ms){' '}
257
- <TextInput
258
- value={entryDelayInput}
259
- type="number"
260
- onChange={val => setEntryDelayInput(val)}
261
- aria-label="entry delay"
262
- />
263
- Exit delay (ms) <TextInput
264
- value={exitDelayInput}
265
- type="number"
266
- onChange={val => setExitDelayInput(val)}
267
- aria-label="exit delay"
268
- />
269
- Animation duration (ms){' '}
270
- <TextInput
271
- value={animationDuration}
272
- type="number"
273
- onChange={val => setAnimationDuration(val)}
274
- aria-label="animation duration"
275
- />
276
- </div>
277
- <div style={{ border: '1px solid' }}>
278
- flip behavior examples (enableFlip has to be true). "flip" will try to flip the tooltip to the opposite of the
279
- starting position. The second option ensures that there are 3 escape positions for every possible starting
280
- position (default). This setting is ignored if position prop is set to 'auto'.
281
- <Select
282
- onToggle={() => setFlipSelectOpen(!flipSelectOpen)}
283
- onSelect={(event, selection) => {
284
- console.log(selection);
285
- setFlipBehavior(selection);
286
- setFlipSelectOpen(false);
287
- }}
288
- isOpen={flipSelectOpen}
289
- selections={flipBehavior}
290
- menuAppendTo={() => document.body}
291
- >
292
- <SelectOption value="flip" />
293
- <SelectOption value="clockwise">['top', 'right', 'bottom', 'left', 'top', 'right', 'bottom']</SelectOption>
294
- </Select>
295
- </div>
296
- </div>
297
- <div id="tooltip-boundary" className="tooltip-box" ref={tipBoxRef}>
298
- <Tooltip
299
- content={
300
- <div>
301
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.
302
- </div>
303
- }
304
- trigger={trigger.join(' ')}
305
- enableFlip={enableFlip}
306
- flipBehavior={flipBehavior === 'flip' ? 'flip' : ['top', 'right', 'bottom', 'left', 'top', 'right', 'bottom']}
307
- position={position}
308
- isVisible={isVisible}
309
- entryDelay={entryDelayInput}
310
- exitDelay={exitDelayInput}
311
- animationDuration={animationDuration}
312
- isContentLeftAligned={contentLeftAligned}
313
- appendTo={() => document.getElementById('tooltip-boundary')}
314
- >
315
- <Button className="tooltip-button">Tooltip</Button>
316
- </Tooltip>
317
- </div>
318
- </>
319
- );
320
- };
40
+ ```ts file="./TooltipOptions.tsx"
321
41
  ```
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { Button, Tooltip } from '@patternfly/react-core';
3
+
4
+ export const TooltipBasic: React.FunctionComponent = () => (
5
+ <div style={{ margin: '100px' }}>
6
+ <Tooltip
7
+ content={
8
+ <div>
9
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.
10
+ </div>
11
+ }
12
+ >
13
+ <Button>I have a tooltip!</Button>
14
+ </Tooltip>
15
+ </div>
16
+ );
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { Tooltip, Button } from '@patternfly/react-core';
3
+ import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
4
+
5
+ export const TooltipIcon: React.FunctionComponent = () => {
6
+ const [showSuccessContent, setShowSuccessContent] = React.useState(false);
7
+ const copyText: string = 'Copy to clipboard';
8
+ const doneCopyText: string = 'Successfully copied to clipboard!';
9
+
10
+ return (
11
+ <div style={{ margin: '100px' }}>
12
+ <Tooltip aria="none" aria-live="polite" content={showSuccessContent ? doneCopyText : copyText}>
13
+ <Button
14
+ aria-label="Clipboard"
15
+ variant="plain"
16
+ id="tt-ref"
17
+ onClick={() => setShowSuccessContent(!showSuccessContent)}
18
+ >
19
+ <CopyIcon />
20
+ </Button>
21
+ </Tooltip>
22
+ </div>
23
+ );
24
+ };
@@ -0,0 +1,197 @@
1
+ import React from 'react';
2
+ import { Button, Tooltip, Checkbox, Select, SelectOption, TextInput, TooltipPosition } from '@patternfly/react-core';
3
+
4
+ export const TooltipOptions: React.FunctionComponent = () => {
5
+ const [trigger, setTrigger] = React.useState(['mouseenter', 'focus']);
6
+ const [isVisible, setIsVisible] = React.useState(true);
7
+ const [contentLeftAligned, setContentLeftAligned] = React.useState(false);
8
+ const [enableFlip, setEnableFlip] = React.useState(true);
9
+ const [position, setPosition] = React.useState<TooltipPosition>(TooltipPosition.top);
10
+ const [positionSelectOpen, setPositionSelectOpen] = React.useState(false);
11
+ const [flipSelectOpen, setFlipSelectOpen] = React.useState(false);
12
+ const [flipBehavior, setFlipBehavior] = React.useState('flip');
13
+ const [entryDelayInput, setEntryDelayInput] = React.useState(0);
14
+ const [exitDelayInput, setExitDelayInput] = React.useState(0);
15
+ const [animationDuration, setAnimationDuration] = React.useState(300);
16
+ const tipBoxRef = React.useRef(null);
17
+
18
+ const scrollToRef = (ref: React.RefObject<any>) => {
19
+ if (ref && ref.current) {
20
+ ref.current.scrollTop = 400;
21
+ ref.current.scrollLeft = 300;
22
+ }
23
+ };
24
+
25
+ React.useEffect(() => {
26
+ scrollToRef(tipBoxRef);
27
+ }, []);
28
+
29
+ return (
30
+ <>
31
+ <div>
32
+ <div style={{ border: '1px solid' }}>
33
+ <Checkbox
34
+ label="trigger: mouseenter"
35
+ isChecked={trigger.includes('mouseenter')}
36
+ onChange={checked => {
37
+ const updatedTrigger = checked ? trigger.concat('mouseenter') : trigger.filter(t => t !== 'mouseenter');
38
+ setIsVisible(false);
39
+ setTrigger(updatedTrigger);
40
+ }}
41
+ aria-label="trigger: mouseenter"
42
+ id="trigger_mouseenter"
43
+ />
44
+ <Checkbox
45
+ label="trigger: focus"
46
+ isChecked={trigger.includes('focus')}
47
+ onChange={checked => {
48
+ const updatedTrigger = checked ? trigger.concat('focus') : trigger.filter(t => t !== 'focus');
49
+ setIsVisible(false);
50
+ setTrigger(updatedTrigger);
51
+ }}
52
+ aria-label="trigger: focus"
53
+ id="trigger_focus"
54
+ />
55
+ <Checkbox
56
+ label="trigger: click"
57
+ isChecked={trigger.includes('click')}
58
+ onChange={checked => {
59
+ const updatedTrigger = checked ? trigger.concat('click') : trigger.filter(t => t !== 'click');
60
+ setIsVisible(false);
61
+ setTimeout(() => setTrigger(updatedTrigger));
62
+ }}
63
+ aria-label="trigger: click"
64
+ id="trigger_click"
65
+ />
66
+ <Checkbox
67
+ label="trigger: manual"
68
+ isChecked={trigger.includes('manual')}
69
+ onChange={checked => {
70
+ const updatedTrigger = checked ? trigger.concat('manual') : trigger.filter(t => t !== 'manual');
71
+ setIsVisible(false);
72
+ setTrigger(updatedTrigger);
73
+ }}
74
+ aria-label="trigger: manual"
75
+ id="trigger_manual"
76
+ />
77
+ </div>
78
+ <div style={{ border: '1px solid' }}>
79
+ <Checkbox
80
+ label="content left-aligned"
81
+ isChecked={contentLeftAligned}
82
+ onChange={checked => setContentLeftAligned(checked)}
83
+ aria-label="content left-aligned"
84
+ id="content_left_aligned"
85
+ />
86
+ </div>
87
+ <div style={{ border: '1px solid' }}>
88
+ <Checkbox
89
+ label="enableFlip"
90
+ isChecked={enableFlip}
91
+ onChange={checked => setEnableFlip(checked)}
92
+ aria-label="enableFlip"
93
+ id="enable_flip"
94
+ />
95
+ </div>
96
+ <div style={{ border: '1px solid' }}>
97
+ position (will flip if enableFlip is true). The 'auto' position requires enableFlip to be set to true.
98
+ <Select
99
+ onToggle={() => setPositionSelectOpen(!positionSelectOpen)}
100
+ onSelect={(_event, selection) => {
101
+ setPosition(selection.toString() as TooltipPosition);
102
+ setPositionSelectOpen(false);
103
+ }}
104
+ isOpen={positionSelectOpen}
105
+ selections={position}
106
+ menuAppendTo={() => document.body}
107
+ >
108
+ <SelectOption value={TooltipPosition.auto} />
109
+ <SelectOption value={TooltipPosition.top} />
110
+ <SelectOption value={TooltipPosition.bottom} />
111
+ <SelectOption value={TooltipPosition.left} />
112
+ <SelectOption value={TooltipPosition.right} />
113
+ <SelectOption value={TooltipPosition.topStart} />
114
+ <SelectOption value={TooltipPosition.topEnd} />
115
+ <SelectOption value={TooltipPosition.bottomStart} />
116
+ <SelectOption value={TooltipPosition.bottomEnd} />
117
+ <SelectOption value={TooltipPosition.leftStart} />
118
+ <SelectOption value={TooltipPosition.leftEnd} />
119
+ <SelectOption value={TooltipPosition.rightStart} />
120
+ <SelectOption value={TooltipPosition.rightEnd} />
121
+ </Select>
122
+ </div>
123
+ <div style={{ border: '1px solid' }}>
124
+ <Checkbox
125
+ label="isVisible (also set trigger to only manual to programmatically control it)"
126
+ isChecked={isVisible}
127
+ onChange={checked => setIsVisible(checked)}
128
+ aria-label="isVisible"
129
+ id="is_visible"
130
+ />
131
+ </div>
132
+ <div style={{ border: '1px solid' }}>
133
+ Entry delay (ms){' '}
134
+ <TextInput
135
+ value={entryDelayInput}
136
+ type="number"
137
+ onChange={val => setEntryDelayInput(Number(val))}
138
+ aria-label="entry delay"
139
+ />
140
+ Exit delay (ms){' '}
141
+ <TextInput
142
+ value={exitDelayInput}
143
+ type="number"
144
+ onChange={val => setExitDelayInput(Number(val))}
145
+ aria-label="exit delay"
146
+ />
147
+ Animation duration (ms){' '}
148
+ <TextInput
149
+ value={animationDuration}
150
+ type="number"
151
+ onChange={val => setAnimationDuration(Number(val))}
152
+ aria-label="animation duration"
153
+ />
154
+ </div>
155
+ <div style={{ border: '1px solid' }}>
156
+ flip behavior examples (enableFlip has to be true). "flip" will try to flip the tooltip to the opposite of the
157
+ starting position. The second option ensures that there are 3 escape positions for every possible starting
158
+ position (default). This setting is ignored if position prop is set to 'auto'.
159
+ <Select
160
+ onToggle={() => setFlipSelectOpen(!flipSelectOpen)}
161
+ onSelect={(_event, selection) => {
162
+ setFlipBehavior(selection.toString());
163
+ setFlipSelectOpen(false);
164
+ }}
165
+ isOpen={flipSelectOpen}
166
+ selections={flipBehavior}
167
+ menuAppendTo={() => document.body}
168
+ >
169
+ <SelectOption value="flip" />
170
+ <SelectOption value="clockwise">['top', 'right', 'bottom', 'left', 'top', 'right', 'bottom']</SelectOption>
171
+ </Select>
172
+ </div>
173
+ </div>
174
+ <div id="tooltip-boundary" className="tooltip-box" ref={tipBoxRef}>
175
+ <Tooltip
176
+ content={
177
+ <div>
178
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.
179
+ </div>
180
+ }
181
+ trigger={trigger.join(' ')}
182
+ enableFlip={enableFlip}
183
+ flipBehavior={flipBehavior === 'flip' ? 'flip' : ['top', 'right', 'bottom', 'left', 'top', 'right', 'bottom']}
184
+ position={position}
185
+ isVisible={isVisible}
186
+ entryDelay={entryDelayInput}
187
+ exitDelay={exitDelayInput}
188
+ animationDuration={animationDuration}
189
+ isContentLeftAligned={contentLeftAligned}
190
+ appendTo={() => document.getElementById('tooltip-boundary') as HTMLElement}
191
+ >
192
+ <Button className="tooltip-button">Tooltip</Button>
193
+ </Tooltip>
194
+ </div>
195
+ </>
196
+ );
197
+ };
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { Tooltip } from '@patternfly/react-core';
3
+
4
+ export const TooltipReactRef: React.FunctionComponent = () => {
5
+ const tooltipRef = React.useRef<HTMLButtonElement>(null);
6
+ return (
7
+ <div style={{ margin: '100px' }}>
8
+ <button aria-describedby="tooltip-ref1" ref={tooltipRef}>
9
+ Tooltip attached via react ref
10
+ </button>
11
+ <Tooltip
12
+ id="tooltip-ref1"
13
+ content={
14
+ <div>
15
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.
16
+ </div>
17
+ }
18
+ reference={tooltipRef}
19
+ />
20
+ </div>
21
+ );
22
+ };
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { Tooltip } from '@patternfly/react-core';
3
+
4
+ export const TooltipSelectorRef: React.FunctionComponent = () => (
5
+ <div style={{ margin: '100px' }}>
6
+ <button aria-describedby="tooltip-ref2" id="tooltip-selector">
7
+ Tooltip attached via selector ref
8
+ </button>
9
+ <Tooltip
10
+ id="tooltip-ref2"
11
+ content={
12
+ <div>
13
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam id feugiat augue, nec fringilla turpis.
14
+ </div>
15
+ }
16
+ reference={() => document.getElementById('tooltip-selector') as HTMLButtonElement}
17
+ />
18
+ </div>
19
+ );
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- import { ButtonProps } from '../';
3
- export declare const Button: ({ children, variant, isInline, onClick, iconPosition, icon, ...props }: ButtonProps) => JSX.Element;
4
- export declare const ButtonVariant: {
5
- plain: string;
6
- link: string;
7
- };
8
- //# sourceMappingURL=Button.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/Button/__mocks__/Button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAElC,eAAO,MAAM,MAAM,2EAA4E,WAAW,gBAWzG,CAAC;AAEF,eAAO,MAAM,aAAa;;;CAAmC,CAAC"}
@@ -1,14 +0,0 @@
1
- import { __rest } from "tslib";
2
- import React from 'react';
3
- export const Button = (_a) => {
4
- var { children, variant, isInline, onClick, iconPosition, icon } = _a, props = __rest(_a, ["children", "variant", "isInline", "onClick", "iconPosition", "icon"]);
5
- return (React.createElement(React.Fragment, null,
6
- React.createElement("button", Object.assign({ onClick: onClick }, props), children),
7
- React.createElement("p", null, `variant: ${variant}`),
8
- React.createElement("p", { id: "labelling-id" }, "Test label"),
9
- React.createElement("p", null, `isInline: ${isInline}`),
10
- React.createElement("p", null, `iconPosition: ${iconPosition}`),
11
- React.createElement("div", { "data-testid": "icon" }, icon)));
12
- };
13
- export const ButtonVariant = { plain: 'plain', link: 'link' };
14
- //# sourceMappingURL=Button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../src/components/Button/__mocks__/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAmF,EAAE,EAAE;QAAvF,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,OAAyB,EAApB,KAAK,cAApE,sEAAsE,CAAF;IAAoB,OAAA,CAC7G;QACE,8CAAQ,OAAO,EAAE,OAAO,IAAM,KAAK,GAChC,QAAQ,CACF;QACT,+BAAI,YAAY,OAAO,EAAE,CAAK;QAC9B,2BAAG,EAAE,EAAC,cAAc,iBAAe;QACnC,+BAAI,aAAa,QAAQ,EAAE,CAAK;QAChC,+BAAI,iBAAiB,YAAY,EAAE,CAAK;QACxC,4CAAiB,MAAM,IAAE,IAAI,CAAO,CACnC,CACJ,CAAA;CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './Button';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Button/__mocks__/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './Button';
2
- //# sourceMappingURL=index.js.map