@bitrise/bitkit 13.167.0 → 13.168.0
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/package.json
CHANGED
|
@@ -12,6 +12,7 @@ export interface CodeSnippetProps extends Omit<BoxProps, 'children'> {
|
|
|
12
12
|
startingHeight?: CollapseProps['startingHeight'];
|
|
13
13
|
endingHeight?: CollapseProps['endingHeight'];
|
|
14
14
|
textToCopy?: string;
|
|
15
|
+
tooltipLabel?: string;
|
|
15
16
|
variant: 'inline' | 'single' | 'multi' | 'multi-breakwords';
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -25,6 +26,7 @@ const CodeSnippet = (props: CodeSnippetProps) => {
|
|
|
25
26
|
endingHeight,
|
|
26
27
|
maxHeight,
|
|
27
28
|
height,
|
|
29
|
+
tooltipLabel,
|
|
28
30
|
...rest
|
|
29
31
|
} = props;
|
|
30
32
|
|
|
@@ -34,14 +36,18 @@ const CodeSnippet = (props: CodeSnippetProps) => {
|
|
|
34
36
|
|
|
35
37
|
const { hasCopied, onCopy } = useClipboard(textToCopy || children);
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
let finalTooltipLabel = hasCopied ? 'Copied to clipboard' : 'Copy to clipboard';
|
|
40
|
+
if (tooltipLabel) {
|
|
41
|
+
finalTooltipLabel = tooltipLabel;
|
|
42
|
+
}
|
|
43
|
+
|
|
38
44
|
const isShowMoreButtonVisible = variant === 'multi' && startingHeight;
|
|
39
45
|
const showMoreButtonText = isExpanded ? 'Show less' : 'Show more';
|
|
40
46
|
|
|
41
47
|
switch (variant) {
|
|
42
48
|
case 'inline':
|
|
43
49
|
return (
|
|
44
|
-
<Tooltip label={
|
|
50
|
+
<Tooltip label={finalTooltipLabel} closeDelay={500}>
|
|
45
51
|
<Box as="code" onClick={onCopy} sx={styles.copyContainer} {...rest}>
|
|
46
52
|
{children}
|
|
47
53
|
</Box>
|
|
@@ -54,7 +60,7 @@ const CodeSnippet = (props: CodeSnippetProps) => {
|
|
|
54
60
|
{children}
|
|
55
61
|
</Box>
|
|
56
62
|
<IconButton
|
|
57
|
-
aria-label={
|
|
63
|
+
aria-label={finalTooltipLabel}
|
|
58
64
|
iconName="Duplicate"
|
|
59
65
|
onClick={onCopy}
|
|
60
66
|
size="md"
|
|
@@ -85,7 +91,7 @@ const CodeSnippet = (props: CodeSnippetProps) => {
|
|
|
85
91
|
)}
|
|
86
92
|
</Box>
|
|
87
93
|
<IconButton
|
|
88
|
-
aria-label={
|
|
94
|
+
aria-label={finalTooltipLabel}
|
|
89
95
|
iconName="Duplicate"
|
|
90
96
|
iconSize="24"
|
|
91
97
|
onClick={onCopy}
|