@bitrise/bitkit 12.43.5 → 12.44.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
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createMultiStyleConfigHelpers } from '@chakra-ui/styled-system';
|
|
2
|
+
import { rem } from '../../utils/utils';
|
|
3
|
+
|
|
4
|
+
const { defineMultiStyleConfig } = createMultiStyleConfigHelpers(['content', 'trigger']);
|
|
5
|
+
|
|
6
|
+
const Toggletip = defineMultiStyleConfig({
|
|
7
|
+
baseStyle: {
|
|
8
|
+
content: {
|
|
9
|
+
padding: '16',
|
|
10
|
+
maxWidth: rem(320),
|
|
11
|
+
},
|
|
12
|
+
link: {
|
|
13
|
+
color: 'purple.70',
|
|
14
|
+
_hover: {
|
|
15
|
+
color: 'purple.60',
|
|
16
|
+
textDecoration: 'underline',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export default Toggletip;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BoxProps, FlexboxProps, useMultiStyleConfig } from '@chakra-ui/react';
|
|
3
|
+
import Popover, { PopoverProps } from '../Popover/Popover';
|
|
4
|
+
import PopoverContent from '../Popover/PopoverContent';
|
|
5
|
+
import PopoverTrigger from '../Popover/PopoverTrigger';
|
|
6
|
+
import Box from '../Box/Box';
|
|
7
|
+
import Text from '../Text/Text';
|
|
8
|
+
import Link from '../Link/Link';
|
|
9
|
+
import { ButtonProps } from '../Button/Button';
|
|
10
|
+
import ColorButton, { ColorButtonProps } from '../ColorButton/ColorButton';
|
|
11
|
+
|
|
12
|
+
export type ToggletipProps = Omit<PopoverProps, 'children'> & {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
label: string;
|
|
15
|
+
learnMoreUrl?: string;
|
|
16
|
+
button?: {
|
|
17
|
+
onClick?: ButtonProps['onClick'];
|
|
18
|
+
href?: string;
|
|
19
|
+
label: string;
|
|
20
|
+
};
|
|
21
|
+
popoverTrigger?: Omit<BoxProps, 'children'>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const Toggletip = (props: ToggletipProps) => {
|
|
25
|
+
const { children, label, learnMoreUrl, button, popoverTrigger, ...rest } = props;
|
|
26
|
+
|
|
27
|
+
const style = useMultiStyleConfig('Toggletip');
|
|
28
|
+
|
|
29
|
+
let justifyContent: FlexboxProps['justifyContent'] = 'space-between';
|
|
30
|
+
|
|
31
|
+
if (!learnMoreUrl) {
|
|
32
|
+
justifyContent = 'flex-end';
|
|
33
|
+
} else if (!button) {
|
|
34
|
+
justifyContent = 'flex-start';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const buttonProps = button?.href
|
|
38
|
+
? ({
|
|
39
|
+
as: 'a' as const,
|
|
40
|
+
href: button?.href,
|
|
41
|
+
} as ColorButtonProps)
|
|
42
|
+
: {
|
|
43
|
+
as: 'button' as const,
|
|
44
|
+
onClick: button?.onClick,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Popover placement="top" variant="dark" withArrow {...rest}>
|
|
49
|
+
<PopoverTrigger>
|
|
50
|
+
<Box as="button" {...(popoverTrigger || {})}>
|
|
51
|
+
{children}
|
|
52
|
+
</Box>
|
|
53
|
+
</PopoverTrigger>
|
|
54
|
+
<PopoverContent sx={style.content}>
|
|
55
|
+
<Text>{label}</Text>
|
|
56
|
+
{(learnMoreUrl || button) && (
|
|
57
|
+
<Box display="flex" justifyContent={justifyContent} alignItems="center" marginTop="16">
|
|
58
|
+
{learnMoreUrl && (
|
|
59
|
+
<Link sx={style.link} href={learnMoreUrl} isExternal>
|
|
60
|
+
Learn more
|
|
61
|
+
</Link>
|
|
62
|
+
)}
|
|
63
|
+
{button && (
|
|
64
|
+
<ColorButton {...buttonProps} colorScheme="neutral">
|
|
65
|
+
{button?.label}
|
|
66
|
+
</ColorButton>
|
|
67
|
+
)}
|
|
68
|
+
</Box>
|
|
69
|
+
)}
|
|
70
|
+
</PopoverContent>
|
|
71
|
+
</Popover>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default Toggletip;
|
package/src/index.ts
CHANGED
|
@@ -304,3 +304,6 @@ export { default as ExpandableCard } from './Components/ExpandableCard/Expandabl
|
|
|
304
304
|
|
|
305
305
|
export type { FileInputProps } from './Components/Form/FileInput/FileInput';
|
|
306
306
|
export { default as FileInput } from './Components/Form/FileInput/FileInput';
|
|
307
|
+
|
|
308
|
+
export type { ToggletipProps as ToggleTooltipProps } from './Components/Toggletip/Toggletip';
|
|
309
|
+
export { default as Toggletip } from './Components/Toggletip/Toggletip';
|
package/src/theme.ts
CHANGED
|
@@ -49,6 +49,7 @@ import shadows from './Foundations/Shadows/Shadows';
|
|
|
49
49
|
import sizes from './Foundations/Sizes/Sizes';
|
|
50
50
|
import typography from './Foundations/Typography/Typography';
|
|
51
51
|
import zIndices from './Foundations/Zindex/Zindex';
|
|
52
|
+
import Toggletip from './Components/Toggletip/Toggletip.theme';
|
|
52
53
|
|
|
53
54
|
const theme = {
|
|
54
55
|
config: {
|
|
@@ -127,6 +128,7 @@ const theme = {
|
|
|
127
128
|
Note,
|
|
128
129
|
CodeBlock,
|
|
129
130
|
DefinitionTooltip,
|
|
131
|
+
Toggletip,
|
|
130
132
|
ExpandableCard,
|
|
131
133
|
FileInput,
|
|
132
134
|
},
|