@bitrise/bitkit 9.20.0 → 9.21.0-alpha-chakra.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.
- package/package.json +1 -1
- package/src/Components/IconButton/IconButton.tsx +6 -3
- package/src/Components/Tooltip/Tooltip.theme.ts +16 -0
- package/src/Components/Tooltip/Tooltip.tsx +28 -0
- package/src/Foundations/Shadows/Shadows.ts +1 -0
- package/src/theme.ts +2 -0
- package/src/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IconButton as ChakraIconButton, IconButtonProps as ChakraIconButtonProps, forwardRef } from '@chakra-ui/react';
|
|
3
3
|
import Icon, { TypeIconName } from '../Icon/Icon';
|
|
4
|
+
import Tooltip from '../Tooltip/Tooltip';
|
|
4
5
|
|
|
5
6
|
export interface IconButtonProps extends ChakraIconButtonProps {
|
|
6
7
|
as?: 'a' | 'button';
|
|
@@ -20,12 +21,14 @@ const IconButton = forwardRef<IconButtonProps, 'button'>((props, ref) => {
|
|
|
20
21
|
as: isDisabled ? 'button' : as,
|
|
21
22
|
icon: <Icon name={iconName} />,
|
|
22
23
|
isDisabled,
|
|
23
|
-
// TODO: Use Tooltip
|
|
24
|
-
title: label || rest['aria-label'],
|
|
25
24
|
variant: isDanger ? `${variant}--danger` : variant,
|
|
26
25
|
...rest,
|
|
27
26
|
};
|
|
28
|
-
return
|
|
27
|
+
return (
|
|
28
|
+
<Tooltip label={label || rest['aria-label']} shouldWrapChildren={isDisabled}>
|
|
29
|
+
<ChakraIconButton {...properties} ref={ref} />
|
|
30
|
+
</Tooltip>
|
|
31
|
+
);
|
|
29
32
|
});
|
|
30
33
|
|
|
31
34
|
IconButton.defaultProps = {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SystemStyleObject } from '@chakra-ui/theme-tools';
|
|
2
|
+
|
|
3
|
+
const TooltipTheme: SystemStyleObject = {
|
|
4
|
+
baseStyle: {
|
|
5
|
+
bg: 'neutral.10',
|
|
6
|
+
color: 'neutral.95',
|
|
7
|
+
fontSize: '2',
|
|
8
|
+
lineHeight: '2',
|
|
9
|
+
paddingX: '12',
|
|
10
|
+
paddingY: '8',
|
|
11
|
+
borderRadius: '8',
|
|
12
|
+
boxShadow: 'tooltip',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default TooltipTheme;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tooltip as ChakraTooltip, TooltipProps as ChakraTooltipProps, forwardRef, chakra } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
export interface TooltipProps extends ChakraTooltipProps {
|
|
5
|
+
shouldWrapChildren?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A tooltip is a brief, informative message that appears when a user interacts with an element. Tooltips are usually initiated in one of two ways: through a mouse-hover gesture or through a keyboard-hover gesture.
|
|
9
|
+
*/
|
|
10
|
+
const Tooltip = forwardRef<TooltipProps, 'div'>((props, ref) => {
|
|
11
|
+
const { children, shouldWrapChildren, ...rest } = props;
|
|
12
|
+
const properties: ChakraTooltipProps = {
|
|
13
|
+
bg: 'neutral.10',
|
|
14
|
+
children,
|
|
15
|
+
hasArrow: true,
|
|
16
|
+
...rest,
|
|
17
|
+
};
|
|
18
|
+
if (shouldWrapChildren) {
|
|
19
|
+
properties.children = (
|
|
20
|
+
<chakra.span display="inline-block" tabIndex={0}>
|
|
21
|
+
{children}
|
|
22
|
+
</chakra.span>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return <ChakraTooltip {...properties} ref={ref} />;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export default Tooltip;
|
package/src/theme.ts
CHANGED
|
@@ -7,6 +7,7 @@ import Link from './Components/Link/Link.theme';
|
|
|
7
7
|
import Menu from './Components/Menu/Menu.theme';
|
|
8
8
|
import Tabs from './Components/Tabs/Tabs.theme';
|
|
9
9
|
import Text from './Components/Text/Text.theme';
|
|
10
|
+
import Tooltip from './Components/Tooltip/Tooltip.theme';
|
|
10
11
|
|
|
11
12
|
import colors from './Foundations/Colors/Colors';
|
|
12
13
|
import radii from './Foundations/Radii/Radii';
|
|
@@ -57,6 +58,7 @@ const theme = {
|
|
|
57
58
|
Menu,
|
|
58
59
|
Tabs,
|
|
59
60
|
Text,
|
|
61
|
+
Tooltip,
|
|
60
62
|
},
|
|
61
63
|
};
|
|
62
64
|
|