@patternfly/react-core 4.263.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 (100) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/esm/components/Tabs/Tab.d.ts +4 -2
  3. package/dist/esm/components/Tabs/Tab.d.ts.map +1 -1
  4. package/dist/esm/components/Tabs/Tab.js +6 -7
  5. package/dist/esm/components/Tabs/Tab.js.map +1 -1
  6. package/dist/esm/components/Tabs/TabAction.d.ts +20 -0
  7. package/dist/esm/components/Tabs/TabAction.d.ts.map +1 -0
  8. package/dist/esm/components/Tabs/TabAction.js +17 -0
  9. package/dist/esm/components/Tabs/TabAction.js.map +1 -0
  10. package/dist/esm/components/Tabs/Tabs.d.ts +1 -1
  11. package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
  12. package/dist/esm/components/Tabs/index.d.ts +1 -0
  13. package/dist/esm/components/Tabs/index.d.ts.map +1 -1
  14. package/dist/esm/components/Tabs/index.js +1 -0
  15. package/dist/esm/components/Tabs/index.js.map +1 -1
  16. package/dist/js/components/Tabs/Tab.d.ts +4 -2
  17. package/dist/js/components/Tabs/Tab.d.ts.map +1 -1
  18. package/dist/js/components/Tabs/Tab.js +6 -7
  19. package/dist/js/components/Tabs/Tab.js.map +1 -1
  20. package/dist/js/components/Tabs/TabAction.d.ts +20 -0
  21. package/dist/js/components/Tabs/TabAction.d.ts.map +1 -0
  22. package/dist/js/components/Tabs/TabAction.js +20 -0
  23. package/dist/js/components/Tabs/TabAction.js.map +1 -0
  24. package/dist/js/components/Tabs/Tabs.d.ts +1 -1
  25. package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
  26. package/dist/js/components/Tabs/index.d.ts +1 -0
  27. package/dist/js/components/Tabs/index.d.ts.map +1 -1
  28. package/dist/js/components/Tabs/index.js +1 -0
  29. package/dist/js/components/Tabs/index.js.map +1 -1
  30. package/dist/styles/assets/pficon/pficon.scss +12 -0
  31. package/dist/styles/assets/pficon/pficon.woff +0 -0
  32. package/dist/styles/assets/pficon/pficon.woff2 +0 -0
  33. package/dist/styles/base-no-reset.css +10 -0
  34. package/dist/styles/base.css +10 -0
  35. package/dist/umd/react-core.min.css +1063 -894
  36. package/dist/umd/react-core.min.js +1 -1
  37. package/package.json +14 -7
  38. package/src/components/Tabs/Tab.tsx +17 -16
  39. package/src/components/Tabs/TabAction.tsx +57 -0
  40. package/src/components/Tabs/Tabs.tsx +1 -1
  41. package/src/components/Tabs/__tests__/Tab.test.tsx +10 -0
  42. package/src/components/Tabs/__tests__/__snapshots__/Tab.test.tsx.snap +45 -0
  43. package/src/components/Tabs/examples/Tabs.md +64 -20
  44. package/src/components/Tabs/examples/TabsHelp.tsx +61 -0
  45. package/src/components/Tabs/examples/TabsHelpAndClose.tsx +84 -0
  46. package/src/components/Tabs/index.ts +1 -0
  47. package/src/components/Tooltip/examples/Tooltip.md +5 -285
  48. package/src/components/Tooltip/examples/TooltipBasic.tsx +16 -0
  49. package/src/components/Tooltip/examples/TooltipIcon.tsx +24 -0
  50. package/src/components/Tooltip/examples/TooltipOptions.tsx +197 -0
  51. package/src/components/Tooltip/examples/TooltipReactRef.tsx +22 -0
  52. package/src/components/Tooltip/examples/TooltipSelectorRef.tsx +19 -0
  53. package/src/demos/Tabs.md +0 -10
  54. package/src/demos/examples/DashboardWrapper.js +1 -0
  55. package/src/demos/examples/Tabs/ModalTabs.tsx +3 -3
  56. package/src/demos/examples/Tabs/NestedTabs.tsx +11 -3
  57. package/src/demos/examples/Tabs/NestedUnindentedTabs.tsx +25 -40
  58. package/src/demos/examples/Tabs/TabsAndTable.tsx +9 -52
  59. package/dist/esm/components/Button/__mocks__/Button.d.ts +0 -8
  60. package/dist/esm/components/Button/__mocks__/Button.d.ts.map +0 -1
  61. package/dist/esm/components/Button/__mocks__/Button.js +0 -14
  62. package/dist/esm/components/Button/__mocks__/Button.js.map +0 -1
  63. package/dist/esm/components/Button/__mocks__/index.d.ts +0 -2
  64. package/dist/esm/components/Button/__mocks__/index.d.ts.map +0 -1
  65. package/dist/esm/components/Button/__mocks__/index.js +0 -2
  66. package/dist/esm/components/Button/__mocks__/index.js.map +0 -1
  67. package/dist/esm/components/HelperText/__mocks__/HelperText.d.ts +0 -4
  68. package/dist/esm/components/HelperText/__mocks__/HelperText.d.ts.map +0 -1
  69. package/dist/esm/components/HelperText/__mocks__/HelperText.js +0 -5
  70. package/dist/esm/components/HelperText/__mocks__/HelperText.js.map +0 -1
  71. package/dist/esm/components/HelperText/__mocks__/HelperTextItem.d.ts +0 -4
  72. package/dist/esm/components/HelperText/__mocks__/HelperTextItem.d.ts.map +0 -1
  73. package/dist/esm/components/HelperText/__mocks__/HelperTextItem.js +0 -5
  74. package/dist/esm/components/HelperText/__mocks__/HelperTextItem.js.map +0 -1
  75. package/dist/esm/components/HelperText/__mocks__/index.d.ts +0 -3
  76. package/dist/esm/components/HelperText/__mocks__/index.d.ts.map +0 -1
  77. package/dist/esm/components/HelperText/__mocks__/index.js +0 -3
  78. package/dist/esm/components/HelperText/__mocks__/index.js.map +0 -1
  79. package/dist/js/components/Button/__mocks__/Button.d.ts +0 -8
  80. package/dist/js/components/Button/__mocks__/Button.d.ts.map +0 -1
  81. package/dist/js/components/Button/__mocks__/Button.js +0 -18
  82. package/dist/js/components/Button/__mocks__/Button.js.map +0 -1
  83. package/dist/js/components/Button/__mocks__/index.d.ts +0 -2
  84. package/dist/js/components/Button/__mocks__/index.d.ts.map +0 -1
  85. package/dist/js/components/Button/__mocks__/index.js +0 -5
  86. package/dist/js/components/Button/__mocks__/index.js.map +0 -1
  87. package/dist/js/components/HelperText/__mocks__/HelperText.d.ts +0 -4
  88. package/dist/js/components/HelperText/__mocks__/HelperText.d.ts.map +0 -1
  89. package/dist/js/components/HelperText/__mocks__/HelperText.js +0 -10
  90. package/dist/js/components/HelperText/__mocks__/HelperText.js.map +0 -1
  91. package/dist/js/components/HelperText/__mocks__/HelperTextItem.d.ts +0 -4
  92. package/dist/js/components/HelperText/__mocks__/HelperTextItem.d.ts.map +0 -1
  93. package/dist/js/components/HelperText/__mocks__/HelperTextItem.js +0 -10
  94. package/dist/js/components/HelperText/__mocks__/HelperTextItem.js.map +0 -1
  95. package/dist/js/components/HelperText/__mocks__/index.d.ts +0 -3
  96. package/dist/js/components/HelperText/__mocks__/index.d.ts.map +0 -1
  97. package/dist/js/components/HelperText/__mocks__/index.js +0 -6
  98. package/dist/js/components/HelperText/__mocks__/index.js.map +0 -1
  99. package/src/demos/examples/Tabs/GrayTabs.tsx +0 -152
  100. package/src/demos/examples/Tabs/TabsAndTablesAutoWidthTabs.tsx +0 -442
@@ -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
+ );
package/src/demos/Tabs.md CHANGED
@@ -453,17 +453,7 @@ TabsOpenWithSecondaryTabsDemo = () => {
453
453
  ```js isFullscreen file="./examples/Tabs/TabsAndTable.tsx"
454
454
  ```
455
455
 
456
- ### Tables and tabs, auto width tabs
457
-
458
- ```js isFullscreen file="./examples/Tabs/TabsAndTablesAutoWidthTabs.tsx"
459
- ```
460
-
461
456
  ### Modal tabs
462
457
 
463
458
  ```js isFullscreen file="./examples/Tabs/ModalTabs.tsx"
464
459
  ```
465
-
466
- ### Gray tabs
467
-
468
- ```js isFullscreen file="./examples/Tabs/GrayTabs.tsx"
469
- ```
@@ -33,6 +33,7 @@ export const PageTemplateTitle = (
33
33
  </TextContent>
34
34
  </PageSection>
35
35
  );
36
+
36
37
  export default class DashboardWrapper extends React.Component {
37
38
  constructor(props) {
38
39
  super(props);
@@ -47,8 +47,8 @@ const products: Product[] = [
47
47
  ];
48
48
 
49
49
  export const ModalTabs: React.FunctionComponent = () => {
50
- const [isModalOpen, setIsModalOpen] = React.useState(false);
51
- const [selectedProduct, setSelectedProduct] = React.useState<Product>();
50
+ const [isModalOpen, setIsModalOpen] = React.useState(true);
51
+ const [selectedProduct, setSelectedProduct] = React.useState<Product>(products[0]);
52
52
  const [activeTabKey, setActiveTabKey] = React.useState<string | number>(0);
53
53
 
54
54
  const onCardClick = React.useCallback(
@@ -114,7 +114,7 @@ export const ModalTabs: React.FunctionComponent = () => {
114
114
  <Modal variant={ModalVariant.small} title={selectedProduct.name} isOpen={isModalOpen} onClose={closeModal}>
115
115
  <Grid hasGutter>
116
116
  <GridItem>
117
- <Tabs activeKey={activeTabKey} onSelect={onTabSelect} isSecondary>
117
+ <Tabs activeKey={activeTabKey} onSelect={onTabSelect} isSecondary hasSecondaryBorderBottom>
118
118
  <Tab eventKey={0} tabContentId="details-tab" title={<TabTitleText>Details</TabTitleText>} />
119
119
  <Tab eventKey={1} tabContentId="doc-tab" title={<TabTitleText>Documentation</TabTitleText>} />
120
120
  </Tabs>