@bitrise/bitkit 9.9.0 → 9.11.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/Button/Button.stories.tsx +0 -3
- package/src/Components/Button/Button.tsx +10 -22
- package/src/Components/Link/Link.stories.tsx +3 -3
- package/src/Components/Link/Link.theme.ts +19 -9
- package/src/Components/Link/Link.tsx +10 -6
- package/src/Old/Input/Input.css +0 -5
- package/src/Old/Textarea/Textarea.css +0 -5
- package/src/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,34 +1,23 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { HTMLAttributeAnchorTarget } from 'react';
|
|
2
2
|
import { Button as ChakraButton, ButtonProps as ChackraButtonProps } from '@chakra-ui/react';
|
|
3
3
|
import Icon from '../../Old/Icon/Icon';
|
|
4
4
|
import { TypeIconName } from '../../Old/Icon/tsx';
|
|
5
5
|
|
|
6
|
-
export interface LinkProps extends ChackraButtonProps {
|
|
7
|
-
as: 'a';
|
|
8
|
-
target?: HTMLAttributeAnchorTarget;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
6
|
export interface ButtonProps extends ChackraButtonProps {
|
|
12
|
-
as?: 'button';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export type Props = {
|
|
16
|
-
children: string;
|
|
17
|
-
className?: string;
|
|
7
|
+
as?: 'a' | 'button';
|
|
8
|
+
href?: string;
|
|
18
9
|
isDanger?: boolean;
|
|
19
|
-
isDisabled?: boolean;
|
|
20
10
|
leftIconName?: TypeIconName;
|
|
21
|
-
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
22
|
-
ref?: ChackraButtonProps['itemRef'];
|
|
23
11
|
rightIconName?: TypeIconName;
|
|
24
12
|
size?: 'small' | 'medium';
|
|
13
|
+
target?: HTMLAttributeAnchorTarget;
|
|
25
14
|
variant?: 'primary' | 'secondary' | 'tertiary';
|
|
26
|
-
}
|
|
15
|
+
}
|
|
27
16
|
|
|
28
17
|
/**
|
|
29
18
|
* The Button component is used to trigger an action or event, such as submitting a form, opening a dialog, canceling an action, or performing a delete operation.
|
|
30
19
|
*/
|
|
31
|
-
const Button =
|
|
20
|
+
const Button = (props: ButtonProps) => {
|
|
32
21
|
const { as, isDanger, leftIconName, rightIconName, size, variant, ...rest } = props;
|
|
33
22
|
const properties: ChackraButtonProps = {
|
|
34
23
|
as,
|
|
@@ -42,18 +31,17 @@ const Button = forwardRef<HTMLButtonElement, Props>((props: Props, ref) => {
|
|
|
42
31
|
if (rightIconName) {
|
|
43
32
|
properties.rightIcon = <Icon name={rightIconName} />;
|
|
44
33
|
}
|
|
45
|
-
if (
|
|
34
|
+
if ((properties.leftIcon || properties.rightIcon) && !properties.iconSpacing) {
|
|
46
35
|
properties.iconSpacing = size === 'medium' ? '0.625rem' : '0.375rem';
|
|
47
36
|
}
|
|
48
37
|
|
|
49
|
-
return <ChakraButton
|
|
50
|
-
}
|
|
38
|
+
return <ChakraButton {...properties} />;
|
|
39
|
+
};
|
|
51
40
|
|
|
52
41
|
Button.defaultProps = {
|
|
53
|
-
// eslint-disable-next-line react/default-props-match-prop-types
|
|
54
42
|
as: 'button',
|
|
55
43
|
size: 'medium',
|
|
56
44
|
variant: 'primary',
|
|
57
|
-
};
|
|
45
|
+
} as ButtonProps;
|
|
58
46
|
|
|
59
47
|
export default Button;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
1
2
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
3
|
import { sortObjectByKey } from '../../utils/storyUtils';
|
|
3
4
|
import Text from '../Text/Text';
|
|
@@ -12,13 +13,12 @@ const args = sortObjectByKey({
|
|
|
12
13
|
...Link.defaultProps,
|
|
13
14
|
children: 'The quick brown fox jumps over the lazy dog.',
|
|
14
15
|
href: '#',
|
|
15
|
-
target: '_self',
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
export const WithProps: ComponentStory<typeof Link> = (
|
|
18
|
+
export const WithProps: ComponentStory<typeof Link> = (props) => <Link {...props} />;
|
|
19
19
|
WithProps.args = args;
|
|
20
20
|
|
|
21
|
-
export const InsideText: ComponentStory<typeof Link> = (
|
|
21
|
+
export const InsideText: ComponentStory<typeof Link> = (props) => (
|
|
22
22
|
<Text size="2">
|
|
23
23
|
This is a text with link: <Link {...props} />
|
|
24
24
|
<br />
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import { textSizes } from '../../Foundations/Typography/Typography';
|
|
2
2
|
|
|
3
|
+
const schemeColors = {
|
|
4
|
+
purple: { color: 'purple.50', hover: 'purple.30' },
|
|
5
|
+
white: { color: 'neutral.100', hover: 'neutral.95' },
|
|
6
|
+
gray: { color: 'neutral.70', hover: 'neutral.50' },
|
|
7
|
+
default: { color: 'inherit', hover: 'inherit' },
|
|
8
|
+
};
|
|
9
|
+
|
|
3
10
|
const LinkTheme = {
|
|
4
|
-
baseStyle: {
|
|
5
|
-
color
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
baseStyle: ({ colorScheme: c }: { colorScheme?: 'purple' | 'white' | 'gray' }) => {
|
|
12
|
+
const { color, hover } = schemeColors[c || 'default'];
|
|
13
|
+
return {
|
|
14
|
+
color,
|
|
15
|
+
fontSize: 'inherit',
|
|
16
|
+
_focus: {
|
|
17
|
+
outline: 'none',
|
|
18
|
+
},
|
|
19
|
+
_hover: {
|
|
20
|
+
color: hover,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
13
23
|
},
|
|
14
24
|
...textSizes,
|
|
15
25
|
};
|
|
@@ -1,27 +1,31 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { Link as ChakraLink, LinkProps as ChakraLinkProps } from '@chakra-ui/react';
|
|
3
3
|
import { TextSizes } from '../../Foundations/Typography/Typography';
|
|
4
4
|
|
|
5
5
|
export interface LinkProps extends ChakraLinkProps {
|
|
6
|
+
as?: 'a' | 'button';
|
|
7
|
+
colorScheme?: 'purple' | 'white' | 'gray';
|
|
6
8
|
isUnderlined?: boolean;
|
|
7
9
|
size?: TextSizes;
|
|
8
|
-
target?: HTMLAttributeAnchorTarget;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
|
-
* Links are accessible elements used primarily for navigation.
|
|
13
|
+
* Links are accessible elements used primarily for navigation.
|
|
13
14
|
*/
|
|
14
15
|
const Link = (props: LinkProps) => {
|
|
15
|
-
const { isUnderlined, ...rest } = props;
|
|
16
|
-
const properties: ChakraLinkProps = { ...rest };
|
|
17
|
-
properties.as = 'a';
|
|
16
|
+
const { as, isUnderlined, ...rest } = props;
|
|
17
|
+
const properties: ChakraLinkProps = { as, ...rest };
|
|
18
18
|
if (isUnderlined) {
|
|
19
19
|
properties.textDecoration = 'underline';
|
|
20
20
|
}
|
|
21
|
+
if (as === 'button') {
|
|
22
|
+
properties.type = 'button';
|
|
23
|
+
}
|
|
21
24
|
return <ChakraLink {...properties} />;
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
Link.defaultProps = {
|
|
28
|
+
as: 'a',
|
|
25
29
|
isUnderlined: false,
|
|
26
30
|
} as LinkProps;
|
|
27
31
|
|
package/src/Old/Input/Input.css
CHANGED
|
@@ -67,11 +67,6 @@
|
|
|
67
67
|
color: var(--color-red--3);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
.Input:focus:focus::placeholder,
|
|
71
|
-
.Input__container--invalid .Input:focus::placeholder {
|
|
72
|
-
color: transparent;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
70
|
.Input__container:focus-within {
|
|
76
71
|
border-color: var(--color-grape--3);
|
|
77
72
|
box-shadow: inset 0 0 0 0.125rem rgba(118, 15, 195, 0.3);
|