File tree Expand file tree Collapse file tree 5 files changed +61
-0
lines changed Expand file tree Collapse file tree 5 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -801,6 +801,9 @@ Map {
801
801
" type" : " string" ,
802
802
},
803
803
" ariaLabel" : [Function ],
804
+ " autoAlign" : Object {
805
+ " type" : " bool" ,
806
+ },
804
807
" children" : Object {
805
808
" type" : " node" ,
806
809
},
@@ -1799,6 +1802,9 @@ Map {
1799
1802
],
1800
1803
" type" : " oneOf" ,
1801
1804
},
1805
+ " autoAlign" : Object {
1806
+ " type" : " bool" ,
1807
+ },
1802
1808
" children" : Object {
1803
1809
" type" : " node" ,
1804
1810
},
@@ -1836,6 +1842,9 @@ Map {
1836
1842
],
1837
1843
" type" : " oneOf" ,
1838
1844
},
1845
+ " autoAlign" : Object {
1846
+ " type" : " bool" ,
1847
+ },
1839
1848
" className" : Object {
1840
1849
" type" : " string" ,
1841
1850
},
@@ -4227,6 +4236,9 @@ Map {
4227
4236
],
4228
4237
" type" : " oneOf" ,
4229
4238
},
4239
+ " autoAlign" : Object {
4240
+ " type" : " bool" ,
4241
+ },
4230
4242
" children" : Object {
4231
4243
" type" : " node" ,
4232
4244
},
Original file line number Diff line number Diff line change @@ -44,6 +44,11 @@ export interface CodeSnippetProps {
44
44
| 'left'
45
45
| 'right' ;
46
46
47
+ /**
48
+ * **Experimental**: Will attempt to automatically align the tooltip
49
+ */
50
+ autoAlign ?: boolean ;
51
+
47
52
/**
48
53
* Specify a label to be read by screen readers on the containing textbox
49
54
* node
@@ -150,6 +155,7 @@ export interface CodeSnippetProps {
150
155
151
156
function CodeSnippet ( {
152
157
align = 'bottom' ,
158
+ autoAlign = false ,
153
159
className,
154
160
type = 'single' ,
155
161
children,
@@ -304,6 +310,7 @@ function CodeSnippet({
304
310
< Copy
305
311
{ ...rest }
306
312
align = { align }
313
+ autoAlign = { autoAlign }
307
314
onClick = { handleCopyClick }
308
315
aria-label = { deprecatedAriaLabel || ariaLabel }
309
316
aria-describedby = { uid }
@@ -377,6 +384,7 @@ function CodeSnippet({
377
384
{ ! hideCopyButton && (
378
385
< CopyButton
379
386
align = { align }
387
+ autoAlign = { autoAlign }
380
388
size = { type === 'multi' ? 'sm' : 'md' }
381
389
disabled = { disabled }
382
390
onClick = { handleCopyClick }
@@ -437,6 +445,11 @@ CodeSnippet.propTypes = {
437
445
'This prop syntax has been deprecated. Please use the new `aria-label`.'
438
446
) ,
439
447
448
+ /**
449
+ * **Experimental**: Will attempt to automatically align the tooltip
450
+ */
451
+ autoAlign : PropTypes . bool ,
452
+
440
453
/**
441
454
* Provide the content of your CodeSnippet as a node or string
442
455
*/
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
35
35
| 'left'
36
36
| 'right' ;
37
37
38
+ /**
39
+ * **Experimental**: Will attempt to automatically align the tooltip
40
+ */
41
+ autoAlign ?: boolean ;
42
+
38
43
/**
39
44
* Specify an optional className to be applied to the underlying `<button>`
40
45
*/
@@ -66,6 +71,7 @@ interface CopyProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
66
71
67
72
export default function Copy ( {
68
73
align = 'bottom' ,
74
+ autoAlign = false ,
69
75
children,
70
76
className,
71
77
feedback = 'Copied!' ,
@@ -112,6 +118,7 @@ export default function Copy({
112
118
< IconButton
113
119
closeOnActivation = { false }
114
120
align = { align }
121
+ autoAlign = { autoAlign }
115
122
className = { classNames }
116
123
label = { animation ? feedback : initialLabel }
117
124
onClick = { composeEventHandlers ( [ onClick , handleClick ] ) }
@@ -143,6 +150,11 @@ Copy.propTypes = {
143
150
'right' ,
144
151
] ) ,
145
152
153
+ /**
154
+ * **Experimental**: Will attempt to automatically align the tooltip
155
+ */
156
+ autoAlign : PropTypes . bool ,
157
+
146
158
/**
147
159
* Pass in content to be rendered in the underlying `<button>`
148
160
*/
Original file line number Diff line number Diff line change @@ -29,6 +29,11 @@ export interface CopyButtonProps extends ButtonProps<'button'> {
29
29
| 'left'
30
30
| 'right' ;
31
31
32
+ /**
33
+ * **Experimental**: Will attempt to automatically align the tooltip
34
+ */
35
+ autoAlign ?: boolean ;
36
+
32
37
/**
33
38
* Specify an optional className to be applied to the underlying `<button>`
34
39
*/
@@ -59,6 +64,7 @@ export interface CopyButtonProps extends ButtonProps<'button'> {
59
64
}
60
65
export default function CopyButton ( {
61
66
align = 'bottom' ,
67
+ autoAlign = false ,
62
68
feedback = 'Copied!' ,
63
69
feedbackTimeout = 2000 ,
64
70
iconDescription = 'Copy to clipboard' ,
@@ -74,6 +80,7 @@ export default function CopyButton({
74
80
feedbackTimeout = { feedbackTimeout }
75
81
onClick = { onClick }
76
82
align = { align }
83
+ autoAlign = { autoAlign }
77
84
className = { classnames ( className , `${ prefix } --copy-btn` ) }
78
85
aria-label = { iconDescription }
79
86
{ ...other } >
@@ -98,6 +105,11 @@ CopyButton.propTypes = {
98
105
'right' ,
99
106
] ) ,
100
107
108
+ /**
109
+ * **Experimental**: Will attempt to automatically align the tooltip
110
+ */
111
+ autoAlign : PropTypes . bool ,
112
+
101
113
/**
102
114
* Specify an optional className to be applied to the underlying `<button>`
103
115
*/
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ interface IconButtonProps
41
41
| 'left'
42
42
| 'right' ;
43
43
44
+ /**
45
+ * **Experimental**: Will attempt to automatically align the tooltip
46
+ */
47
+ autoAlign ?: boolean ;
48
+
44
49
/**
45
50
* Provide an icon or asset to be rendered inside of the IconButton
46
51
*/
@@ -109,6 +114,7 @@ interface IconButtonProps
109
114
const IconButton = React . forwardRef ( function IconButton (
110
115
{
111
116
align,
117
+ autoAlign = false ,
112
118
children,
113
119
className,
114
120
closeOnActivation = true ,
@@ -134,6 +140,7 @@ const IconButton = React.forwardRef(function IconButton(
134
140
return (
135
141
< Tooltip
136
142
align = { align }
143
+ autoAlign = { autoAlign }
137
144
closeOnActivation = { closeOnActivation }
138
145
className = { tooltipClasses }
139
146
defaultOpen = { defaultOpen }
@@ -178,6 +185,11 @@ IconButton.propTypes = {
178
185
'right' ,
179
186
] ) ,
180
187
188
+ /**
189
+ * **Experimental**: Will attempt to automatically align the tooltip
190
+ */
191
+ autoAlign : PropTypes . bool ,
192
+
181
193
/**
182
194
* Provide an icon or asset to be rendered inside of the IconButton
183
195
*/
You can’t perform that action at this time.
0 commit comments