@bitrise/bitkit 9.3.1 → 9.4.1-alpha.2
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/.eslintrc.js +9 -2
- package/.storybook/main.js +35 -0
- package/.storybook/preview.js +20 -0
- package/.stylelintignore +1 -0
- package/.stylelintrc +2 -3
- package/CHANGELOG.md +11 -0
- package/jest.setup.js +1 -1
- package/lib/cjs/Dropdown/DropdownMenu.css +1 -1
- package/lib/cjs/Toggle/Toggle.css +19 -0
- package/lib/cjs/Toggle/Toggle.d.ts +2 -0
- package/lib/cjs/Toggle/Toggle.d.ts.map +1 -1
- package/lib/cjs/Toggle/Toggle.js +8 -4
- package/lib/cjs/Toggle/Toggle.js.map +1 -1
- package/lib/cjs/chakra/BitkitProvider.d.ts +5 -0
- package/lib/cjs/chakra/BitkitProvider.d.ts.map +1 -0
- package/lib/cjs/chakra/BitkitProvider.js +14 -0
- package/lib/cjs/chakra/BitkitProvider.js.map +1 -0
- package/lib/cjs/chakra/components/Button/Button.d.ts +22 -0
- package/lib/cjs/chakra/components/Button/Button.d.ts.map +1 -0
- package/lib/cjs/chakra/components/Button/Button.js +61 -0
- package/lib/cjs/chakra/components/Button/Button.js.map +1 -0
- package/lib/cjs/chakra/components/Button/Button.stories.d.ts +6 -0
- package/lib/cjs/chakra/components/Button/Button.stories.d.ts.map +1 -0
- package/lib/cjs/chakra/components/Button/Button.stories.js +37 -0
- package/lib/cjs/chakra/components/Button/Button.stories.js.map +1 -0
- package/lib/cjs/chakra/components/Button/Button.theme.d.ts +117 -0
- package/lib/cjs/chakra/components/Button/Button.theme.d.ts.map +1 -0
- package/lib/cjs/chakra/components/Button/Button.theme.js +119 -0
- package/lib/cjs/chakra/components/Button/Button.theme.js.map +1 -0
- package/lib/cjs/chakra/components/IconButton/IconButton.d.ts +14 -0
- package/lib/cjs/chakra/components/IconButton/IconButton.d.ts.map +1 -0
- package/lib/cjs/chakra/components/IconButton/IconButton.js +41 -0
- package/lib/cjs/chakra/components/IconButton/IconButton.js.map +1 -0
- package/lib/cjs/chakra/components/IconButton/IconButton.stories.d.ts +6 -0
- package/lib/cjs/chakra/components/IconButton/IconButton.stories.d.ts.map +1 -0
- package/lib/cjs/chakra/components/IconButton/IconButton.stories.js +48 -0
- package/lib/cjs/chakra/components/IconButton/IconButton.stories.js.map +1 -0
- package/lib/cjs/chakra/components/Link/Link.d.ts +16 -0
- package/lib/cjs/chakra/components/Link/Link.d.ts.map +1 -0
- package/lib/cjs/chakra/components/Link/Link.js +44 -0
- package/lib/cjs/chakra/components/Link/Link.js.map +1 -0
- package/lib/cjs/chakra/components/Link/Link.stories.d.ts +12 -0
- package/lib/cjs/chakra/components/Link/Link.stories.d.ts.map +1 -0
- package/lib/cjs/chakra/components/Link/Link.stories.js +42 -0
- package/lib/cjs/chakra/components/Link/Link.stories.js.map +1 -0
- package/lib/cjs/chakra/components/Menu/Menu.d.ts +6 -0
- package/lib/cjs/chakra/components/Menu/Menu.d.ts.map +1 -0
- package/lib/cjs/chakra/components/Menu/Menu.js +21 -0
- package/lib/cjs/chakra/components/Menu/Menu.js.map +1 -0
- package/lib/cjs/chakra/components/Menu/Menu.stories.d.ts +9 -0
- package/lib/cjs/chakra/components/Menu/Menu.stories.d.ts.map +1 -0
- package/lib/cjs/chakra/components/Menu/Menu.stories.js +48 -0
- package/lib/cjs/chakra/components/Menu/Menu.stories.js.map +1 -0
- package/lib/cjs/chakra/components/Menu/Menu.theme.d.ts +4 -0
- package/lib/cjs/chakra/components/Menu/Menu.theme.d.ts.map +1 -0
- package/lib/cjs/chakra/components/Menu/Menu.theme.js +23 -0
- package/lib/cjs/chakra/components/Menu/Menu.theme.js.map +1 -0
- package/lib/cjs/chakra/components/Menu/MenuItem.d.ts +12 -0
- package/lib/cjs/chakra/components/Menu/MenuItem.d.ts.map +1 -0
- package/lib/cjs/chakra/components/Menu/MenuItem.js +39 -0
- package/lib/cjs/chakra/components/Menu/MenuItem.js.map +1 -0
- package/lib/cjs/chakra/components/StatusTag/StatusTag.d.ts +16 -0
- package/lib/cjs/chakra/components/StatusTag/StatusTag.d.ts.map +1 -0
- package/lib/cjs/chakra/components/StatusTag/StatusTag.js +36 -0
- package/lib/cjs/chakra/components/StatusTag/StatusTag.js.map +1 -0
- package/lib/cjs/chakra/components/StatusTag/StatusTag.stories.d.ts +13 -0
- package/lib/cjs/chakra/components/StatusTag/StatusTag.stories.d.ts.map +1 -0
- package/lib/cjs/chakra/components/StatusTag/StatusTag.stories.js +44 -0
- package/lib/cjs/chakra/components/StatusTag/StatusTag.stories.js.map +1 -0
- package/lib/cjs/chakra/components/StatusTag/StatusTag.theme.d.ts +45 -0
- package/lib/cjs/chakra/components/StatusTag/StatusTag.theme.d.ts.map +1 -0
- package/lib/cjs/chakra/components/StatusTag/StatusTag.theme.js +47 -0
- package/lib/cjs/chakra/components/StatusTag/StatusTag.theme.js.map +1 -0
- package/lib/cjs/chakra/components/Text/Text.d.ts +32 -0
- package/lib/cjs/chakra/components/Text/Text.d.ts.map +1 -0
- package/lib/cjs/chakra/components/Text/Text.js +38 -0
- package/lib/cjs/chakra/components/Text/Text.js.map +1 -0
- package/lib/cjs/chakra/components/Text/Text.stories.d.ts +12 -0
- package/lib/cjs/chakra/components/Text/Text.stories.d.ts.map +1 -0
- package/lib/cjs/chakra/components/Text/Text.stories.js +42 -0
- package/lib/cjs/chakra/components/Text/Text.stories.js.map +1 -0
- package/lib/cjs/chakra/shared.d.ts +2 -0
- package/lib/cjs/chakra/shared.d.ts.map +1 -0
- package/lib/cjs/chakra/shared.js +15 -0
- package/lib/cjs/chakra/shared.js.map +1 -0
- package/lib/cjs/chakra/theme/theme.d.ts +3 -0
- package/lib/cjs/chakra/theme/theme.d.ts.map +1 -0
- package/lib/cjs/chakra/theme/theme.js +54 -0
- package/lib/cjs/chakra/theme/theme.js.map +1 -0
- package/lib/cjs/chakra/theme/typographyConfig.d.ts +4 -0
- package/lib/cjs/chakra/theme/typographyConfig.d.ts.map +1 -0
- package/lib/cjs/chakra/theme/typographyConfig.js +38 -0
- package/lib/cjs/chakra/theme/typographyConfig.js.map +1 -0
- package/lib/cjs/index.d.ts +9 -0
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +20 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esn/Dropdown/DropdownMenu.css +1 -1
- package/lib/esn/Toggle/Toggle.css +19 -0
- package/lib/esn/Toggle/Toggle.d.ts +2 -0
- package/lib/esn/Toggle/Toggle.d.ts.map +1 -1
- package/lib/esn/Toggle/Toggle.js +8 -4
- package/lib/esn/Toggle/Toggle.js.map +1 -1
- package/lib/esn/chakra/BitkitProvider.d.ts +5 -0
- package/lib/esn/chakra/BitkitProvider.d.ts.map +1 -0
- package/lib/esn/chakra/BitkitProvider.js +8 -0
- package/lib/esn/chakra/BitkitProvider.js.map +1 -0
- package/lib/esn/chakra/components/Button/Button.d.ts +22 -0
- package/lib/esn/chakra/components/Button/Button.d.ts.map +1 -0
- package/lib/esn/chakra/components/Button/Button.js +34 -0
- package/lib/esn/chakra/components/Button/Button.js.map +1 -0
- package/lib/esn/chakra/components/Button/Button.stories.d.ts +6 -0
- package/lib/esn/chakra/components/Button/Button.stories.d.ts.map +1 -0
- package/lib/esn/chakra/components/Button/Button.stories.js +29 -0
- package/lib/esn/chakra/components/Button/Button.stories.js.map +1 -0
- package/lib/esn/chakra/components/Button/Button.theme.d.ts +117 -0
- package/lib/esn/chakra/components/Button/Button.theme.d.ts.map +1 -0
- package/lib/esn/chakra/components/Button/Button.theme.js +117 -0
- package/lib/esn/chakra/components/Button/Button.theme.js.map +1 -0
- package/lib/esn/chakra/components/IconButton/IconButton.d.ts +14 -0
- package/lib/esn/chakra/components/IconButton/IconButton.d.ts.map +1 -0
- package/lib/esn/chakra/components/IconButton/IconButton.js +18 -0
- package/lib/esn/chakra/components/IconButton/IconButton.js.map +1 -0
- package/lib/esn/chakra/components/IconButton/IconButton.stories.d.ts +6 -0
- package/lib/esn/chakra/components/IconButton/IconButton.stories.d.ts.map +1 -0
- package/lib/esn/chakra/components/IconButton/IconButton.stories.js +21 -0
- package/lib/esn/chakra/components/IconButton/IconButton.stories.js.map +1 -0
- package/lib/esn/chakra/components/Link/Link.d.ts +16 -0
- package/lib/esn/chakra/components/Link/Link.d.ts.map +1 -0
- package/lib/esn/chakra/components/Link/Link.js +17 -0
- package/lib/esn/chakra/components/Link/Link.js.map +1 -0
- package/lib/esn/chakra/components/Link/Link.stories.d.ts +12 -0
- package/lib/esn/chakra/components/Link/Link.stories.d.ts.map +1 -0
- package/lib/esn/chakra/components/Link/Link.stories.js +16 -0
- package/lib/esn/chakra/components/Link/Link.stories.js.map +1 -0
- package/lib/esn/chakra/components/Menu/Menu.d.ts +6 -0
- package/lib/esn/chakra/components/Menu/Menu.d.ts.map +1 -0
- package/lib/esn/chakra/components/Menu/Menu.js +5 -0
- package/lib/esn/chakra/components/Menu/Menu.js.map +1 -0
- package/lib/esn/chakra/components/Menu/Menu.stories.d.ts +9 -0
- package/lib/esn/chakra/components/Menu/Menu.stories.d.ts.map +1 -0
- package/lib/esn/chakra/components/Menu/Menu.stories.js +39 -0
- package/lib/esn/chakra/components/Menu/Menu.stories.js.map +1 -0
- package/lib/esn/chakra/components/Menu/Menu.theme.d.ts +4 -0
- package/lib/esn/chakra/components/Menu/Menu.theme.d.ts.map +1 -0
- package/lib/esn/chakra/components/Menu/Menu.theme.js +21 -0
- package/lib/esn/chakra/components/Menu/Menu.theme.js.map +1 -0
- package/lib/esn/chakra/components/Menu/MenuItem.d.ts +12 -0
- package/lib/esn/chakra/components/Menu/MenuItem.d.ts.map +1 -0
- package/lib/esn/chakra/components/Menu/MenuItem.js +12 -0
- package/lib/esn/chakra/components/Menu/MenuItem.js.map +1 -0
- package/lib/esn/chakra/components/StatusTag/StatusTag.d.ts +16 -0
- package/lib/esn/chakra/components/StatusTag/StatusTag.d.ts.map +1 -0
- package/lib/esn/chakra/components/StatusTag/StatusTag.js +30 -0
- package/lib/esn/chakra/components/StatusTag/StatusTag.js.map +1 -0
- package/lib/esn/chakra/components/StatusTag/StatusTag.stories.d.ts +13 -0
- package/lib/esn/chakra/components/StatusTag/StatusTag.stories.d.ts.map +1 -0
- package/lib/esn/chakra/components/StatusTag/StatusTag.stories.js +16 -0
- package/lib/esn/chakra/components/StatusTag/StatusTag.stories.js.map +1 -0
- package/lib/esn/chakra/components/StatusTag/StatusTag.theme.d.ts +45 -0
- package/lib/esn/chakra/components/StatusTag/StatusTag.theme.d.ts.map +1 -0
- package/lib/esn/chakra/components/StatusTag/StatusTag.theme.js +45 -0
- package/lib/esn/chakra/components/StatusTag/StatusTag.theme.js.map +1 -0
- package/lib/esn/chakra/components/Text/Text.d.ts +32 -0
- package/lib/esn/chakra/components/Text/Text.d.ts.map +1 -0
- package/lib/esn/chakra/components/Text/Text.js +22 -0
- package/lib/esn/chakra/components/Text/Text.js.map +1 -0
- package/lib/esn/chakra/components/Text/Text.stories.d.ts +12 -0
- package/lib/esn/chakra/components/Text/Text.stories.d.ts.map +1 -0
- package/lib/esn/chakra/components/Text/Text.stories.js +19 -0
- package/lib/esn/chakra/components/Text/Text.stories.js.map +1 -0
- package/lib/esn/chakra/shared.d.ts +2 -0
- package/lib/esn/chakra/shared.d.ts.map +1 -0
- package/lib/esn/chakra/shared.js +11 -0
- package/lib/esn/chakra/shared.js.map +1 -0
- package/lib/esn/chakra/theme/theme.d.ts +3 -0
- package/lib/esn/chakra/theme/theme.d.ts.map +1 -0
- package/lib/esn/chakra/theme/theme.js +49 -0
- package/lib/esn/chakra/theme/theme.js.map +1 -0
- package/lib/esn/chakra/theme/typographyConfig.d.ts +4 -0
- package/lib/esn/chakra/theme/typographyConfig.d.ts.map +1 -0
- package/lib/esn/chakra/theme/typographyConfig.js +36 -0
- package/lib/esn/chakra/theme/typographyConfig.js.map +1 -0
- package/lib/esn/index.d.ts +9 -0
- package/lib/esn/index.d.ts.map +1 -1
- package/lib/esn/index.js +9 -0
- package/lib/esn/index.js.map +1 -1
- package/lib/esn/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -21
- package/site/components/Documentation/Components/SectionToggle.tsx +12 -0
- package/src/Dropdown/DropdownMenu.css +1 -1
- package/src/Toggle/Toggle.css +19 -0
- package/src/Toggle/Toggle.tsx +18 -3
- package/src/chakra/BitkitProvider.tsx +9 -0
- package/src/chakra/components/Button/Button.stories.tsx +32 -0
- package/src/chakra/components/Button/Button.theme.ts +117 -0
- package/src/chakra/components/Button/Button.tsx +52 -0
- package/src/chakra/components/IconButton/IconButton.stories.tsx +24 -0
- package/src/chakra/components/IconButton/IconButton.tsx +29 -0
- package/src/chakra/components/Link/Link.stories.tsx +19 -0
- package/src/chakra/components/Link/Link.tsx +30 -0
- package/src/chakra/components/Menu/Menu.stories.tsx +57 -0
- package/src/chakra/components/Menu/Menu.theme.ts +23 -0
- package/src/chakra/components/Menu/Menu.tsx +8 -0
- package/src/chakra/components/Menu/MenuItem.tsx +20 -0
- package/src/chakra/components/StatusTag/StatusTag.stories.tsx +19 -0
- package/src/chakra/components/StatusTag/StatusTag.theme.ts +45 -0
- package/src/chakra/components/StatusTag/StatusTag.tsx +55 -0
- package/src/chakra/components/Text/Text.stories.tsx +22 -0
- package/src/chakra/components/Text/Text.tsx +73 -0
- package/src/chakra/shared.ts +11 -0
- package/src/chakra/theme/theme.ts +50 -0
- package/src/chakra/theme/typographyConfig.ts +38 -0
- package/src/index.ts +10 -0
- package/tsconfig.json +5 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MenuItem as ChakraMenuItem, MenuItemProps } from '@chakra-ui/react';
|
|
3
|
+
import { Icon, TypeIconName } from '@bitrise/bitkit';
|
|
4
|
+
|
|
5
|
+
export type Props = {
|
|
6
|
+
children: string;
|
|
7
|
+
iconName: TypeIconName;
|
|
8
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
9
|
+
sx?: MenuItemProps['sx'];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const MenuItem = (props: Props) => {
|
|
13
|
+
const { iconName, ...rest } = props;
|
|
14
|
+
const properties: MenuItemProps = { ...rest };
|
|
15
|
+
properties.icon = <Icon name={iconName} />;
|
|
16
|
+
properties.iconSpacing = '16px';
|
|
17
|
+
return <ChakraMenuItem {...properties} />;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default MenuItem;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
+
import { sortObjectByKey } from '../../shared';
|
|
4
|
+
import StatusTag, { Props } from './StatusTag';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/StatusTag',
|
|
8
|
+
component: StatusTag,
|
|
9
|
+
} as ComponentMeta<typeof StatusTag>;
|
|
10
|
+
|
|
11
|
+
const Template: ComponentStory<typeof StatusTag> = ({ ...props }) => <StatusTag {...props} />;
|
|
12
|
+
|
|
13
|
+
export const WithProps = Template.bind({});
|
|
14
|
+
WithProps.args = sortObjectByKey({
|
|
15
|
+
...StatusTag.defaultProps,
|
|
16
|
+
children: 'Running',
|
|
17
|
+
// iconName: 'BuildstatusLoadingAnimated',
|
|
18
|
+
variant: 'running',
|
|
19
|
+
} as Props);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const StatusTagTheme = {
|
|
2
|
+
baseStyle: {
|
|
3
|
+
borderRadius: '4px',
|
|
4
|
+
paddingX: '8px',
|
|
5
|
+
},
|
|
6
|
+
sizes: {
|
|
7
|
+
small: {
|
|
8
|
+
paddingY: '4px',
|
|
9
|
+
},
|
|
10
|
+
normal: {
|
|
11
|
+
paddingY: '8px',
|
|
12
|
+
},
|
|
13
|
+
big: {
|
|
14
|
+
paddingY: '20px',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
variants: {
|
|
18
|
+
aborted: {
|
|
19
|
+
backgroundColor: '#FFF6D1',
|
|
20
|
+
color: '#875B00',
|
|
21
|
+
},
|
|
22
|
+
failed: {
|
|
23
|
+
backgroundColor: '#FFF0F3',
|
|
24
|
+
color: '#A91E2E',
|
|
25
|
+
},
|
|
26
|
+
onHold: {
|
|
27
|
+
backgroundColor: '#F6F4F6',
|
|
28
|
+
color: '#6B6071',
|
|
29
|
+
},
|
|
30
|
+
running: {
|
|
31
|
+
backgroundColor: '#F9F2FD',
|
|
32
|
+
color: '#492F5C',
|
|
33
|
+
},
|
|
34
|
+
starting: {
|
|
35
|
+
backgroundColor: '#ECF8FD',
|
|
36
|
+
color: '#1066AC',
|
|
37
|
+
},
|
|
38
|
+
success: {
|
|
39
|
+
backgroundColor: '#EEF9F1',
|
|
40
|
+
color: '#167231',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default StatusTagTheme;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HStack, useStyleConfig } from '@chakra-ui/react';
|
|
3
|
+
import { Icon } from '@bitrise/bitkit';
|
|
4
|
+
import Text from '../Text/Text';
|
|
5
|
+
|
|
6
|
+
type IconName =
|
|
7
|
+
| 'BuildstatusAborted'
|
|
8
|
+
| 'BuildstatusFailed'
|
|
9
|
+
| 'BuildstatusLoadingAnimated'
|
|
10
|
+
| 'BuildstatusNeverbuilt'
|
|
11
|
+
| 'BuildstatusSuccessful';
|
|
12
|
+
|
|
13
|
+
type Variant = 'aborted' | 'failed' | 'onHold' | 'running' | 'starting' | 'success';
|
|
14
|
+
|
|
15
|
+
export interface Props {
|
|
16
|
+
children?: string;
|
|
17
|
+
iconName?: IconName;
|
|
18
|
+
size?: 'big' | 'normal' | 'small';
|
|
19
|
+
variant: Variant;
|
|
20
|
+
width?: '8.5rem' | 'auto';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const getIcon = (variant: Variant, iconName?: IconName): IconName => {
|
|
24
|
+
const iconMap = {
|
|
25
|
+
aborted: 'BuildstatusAborted',
|
|
26
|
+
failed: 'BuildstatusFailed',
|
|
27
|
+
onHold: 'BuildstatusAborted',
|
|
28
|
+
running: 'BuildstatusLoadingAnimated',
|
|
29
|
+
starting: 'BuildstatusLoadingAnimated',
|
|
30
|
+
success: 'BuildstatusSuccessful',
|
|
31
|
+
};
|
|
32
|
+
if (!iconName) {
|
|
33
|
+
return iconMap[variant] as IconName;
|
|
34
|
+
}
|
|
35
|
+
return iconName;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const StatusTag = ({ children, iconName, size, variant, width }: Props) => {
|
|
39
|
+
const styles = useStyleConfig('StatusTag', { size, variant });
|
|
40
|
+
return (
|
|
41
|
+
<HStack alignItems="center" sx={styles} width={width}>
|
|
42
|
+
<Icon name={getIcon(variant, iconName)} />
|
|
43
|
+
<Text fontWeight="bold" size="2" textTransform="uppercase">
|
|
44
|
+
{children}
|
|
45
|
+
</Text>
|
|
46
|
+
</HStack>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
StatusTag.defaultProps = {
|
|
51
|
+
size: 'normal',
|
|
52
|
+
width: '8.5rem',
|
|
53
|
+
} as Props;
|
|
54
|
+
|
|
55
|
+
export default StatusTag;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
+
import { sortObjectByKey } from '../../shared';
|
|
4
|
+
import Text from './Text';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/Text',
|
|
8
|
+
component: Text,
|
|
9
|
+
} as ComponentMeta<typeof Text>;
|
|
10
|
+
|
|
11
|
+
const Template: ComponentStory<typeof Text> = ({ ...props }) => <Text {...props} />;
|
|
12
|
+
|
|
13
|
+
export const WithProps = Template.bind({});
|
|
14
|
+
WithProps.args = sortObjectByKey({
|
|
15
|
+
align: 'left',
|
|
16
|
+
className: '',
|
|
17
|
+
children: 'The quick brown fox jumps over the lazy dog.',
|
|
18
|
+
fontWeight: 'normal',
|
|
19
|
+
letterSpacing: 'normal',
|
|
20
|
+
textTransform: 'none',
|
|
21
|
+
...Text.defaultProps,
|
|
22
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text as ChakraText, TextProps } from '@chakra-ui/react';
|
|
3
|
+
|
|
4
|
+
type TextTags =
|
|
5
|
+
| 'a'
|
|
6
|
+
| 'abbr'
|
|
7
|
+
| 'bdi'
|
|
8
|
+
| 'bdo'
|
|
9
|
+
| 'blockquote'
|
|
10
|
+
| 'cite'
|
|
11
|
+
| 'data'
|
|
12
|
+
| 'dd'
|
|
13
|
+
| 'dfn'
|
|
14
|
+
| 'dt'
|
|
15
|
+
| 'em'
|
|
16
|
+
| 'figcaption'
|
|
17
|
+
| 'kbd'
|
|
18
|
+
| 'li'
|
|
19
|
+
| 'mark'
|
|
20
|
+
| 'p'
|
|
21
|
+
| 'pre'
|
|
22
|
+
| 'q'
|
|
23
|
+
| 'samp'
|
|
24
|
+
| 'small'
|
|
25
|
+
| 'span'
|
|
26
|
+
| 'strong'
|
|
27
|
+
| 'sub'
|
|
28
|
+
| 'sup'
|
|
29
|
+
| 'time'
|
|
30
|
+
| 'var';
|
|
31
|
+
|
|
32
|
+
export interface Props {
|
|
33
|
+
align?: 'center' | 'justify' | 'left' | 'right';
|
|
34
|
+
/**
|
|
35
|
+
* Any valid HTML text tag
|
|
36
|
+
*/
|
|
37
|
+
as?: TextTags;
|
|
38
|
+
children?: TextProps['children'];
|
|
39
|
+
className?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Font weight
|
|
42
|
+
*/
|
|
43
|
+
fontWeight?: 'bold' | 'normal';
|
|
44
|
+
letterSpacing?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Size config (https://www.figma.com/file/grik9mTaJ5DfhydhWhXdP5/Bitkit-Foundations?node-id=211%3A12)
|
|
47
|
+
*/
|
|
48
|
+
size?: '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8';
|
|
49
|
+
sx?: TextProps['sx'];
|
|
50
|
+
textTransform?: 'capitalize' | 'lowercase' | 'none' | 'uppercase';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Basic `Text` component
|
|
55
|
+
*/
|
|
56
|
+
const Text = (props: Props) => {
|
|
57
|
+
const { size, textTransform } = props;
|
|
58
|
+
const properties: TextProps = { ...props };
|
|
59
|
+
if (size === '1' && (!textTransform || textTransform === 'none')) {
|
|
60
|
+
properties.textTransform = 'uppercase';
|
|
61
|
+
}
|
|
62
|
+
if (size === '5' || size === '6' || size === '7' || size === '8') {
|
|
63
|
+
properties.fontWeight = 'bold';
|
|
64
|
+
}
|
|
65
|
+
return <ChakraText {...properties} />;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
Text.defaultProps = {
|
|
69
|
+
as: 'span',
|
|
70
|
+
size: '4',
|
|
71
|
+
} as Props;
|
|
72
|
+
|
|
73
|
+
export default Text;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { extendTheme } from '@chakra-ui/react';
|
|
2
|
+
import { variables } from '@bitrise/bitkit';
|
|
3
|
+
import ButtonTheme from '../components/Button/Button.theme';
|
|
4
|
+
import StatusTagTheme from '../components/StatusTag/StatusTag.theme';
|
|
5
|
+
import MenuTheme from '../components/Menu/Menu.theme';
|
|
6
|
+
import typographyConfig from './typographyConfig';
|
|
7
|
+
|
|
8
|
+
const theme = extendTheme({
|
|
9
|
+
config: {
|
|
10
|
+
cssVarPrefix: 'bitkit',
|
|
11
|
+
},
|
|
12
|
+
colors: variables.colorMap,
|
|
13
|
+
fonts: {
|
|
14
|
+
body: `"TT Norms Pro", sans-serif`,
|
|
15
|
+
heading: `"TT Norms Pro", sans-serif`,
|
|
16
|
+
},
|
|
17
|
+
fontSizes: {
|
|
18
|
+
1: '11px',
|
|
19
|
+
2: '14px',
|
|
20
|
+
3: '16px',
|
|
21
|
+
4: '19px',
|
|
22
|
+
5: '24px',
|
|
23
|
+
6: '30px',
|
|
24
|
+
7: '36px',
|
|
25
|
+
8: '48px',
|
|
26
|
+
},
|
|
27
|
+
lineHeights: {
|
|
28
|
+
1: '16px',
|
|
29
|
+
2: '20px',
|
|
30
|
+
3: '24px',
|
|
31
|
+
4: '28px',
|
|
32
|
+
5: '36px',
|
|
33
|
+
6: '40px',
|
|
34
|
+
7: '48px',
|
|
35
|
+
8: '60px',
|
|
36
|
+
},
|
|
37
|
+
components: {
|
|
38
|
+
Button: ButtonTheme,
|
|
39
|
+
Heading: {
|
|
40
|
+
sizes: typographyConfig,
|
|
41
|
+
},
|
|
42
|
+
Menu: MenuTheme,
|
|
43
|
+
StatusTag: StatusTagTheme,
|
|
44
|
+
Text: {
|
|
45
|
+
sizes: typographyConfig,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export default theme;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SystemStyleObject } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
const config: Record<string, SystemStyleObject> = {
|
|
4
|
+
1: {
|
|
5
|
+
fontSize: '11px',
|
|
6
|
+
lineHeight: '16px',
|
|
7
|
+
},
|
|
8
|
+
2: {
|
|
9
|
+
fontSize: '14px',
|
|
10
|
+
lineHeight: '20px',
|
|
11
|
+
},
|
|
12
|
+
3: {
|
|
13
|
+
fontSize: '16px',
|
|
14
|
+
lineHeight: '24px',
|
|
15
|
+
},
|
|
16
|
+
4: {
|
|
17
|
+
fontSize: '19px',
|
|
18
|
+
lineHeight: '28px',
|
|
19
|
+
},
|
|
20
|
+
5: {
|
|
21
|
+
fontSize: '24px',
|
|
22
|
+
lineHeight: '36px',
|
|
23
|
+
},
|
|
24
|
+
6: {
|
|
25
|
+
fontSize: '30px',
|
|
26
|
+
lineHeight: '40px',
|
|
27
|
+
},
|
|
28
|
+
7: {
|
|
29
|
+
fontSize: '36px',
|
|
30
|
+
lineHeight: '48px',
|
|
31
|
+
},
|
|
32
|
+
8: {
|
|
33
|
+
fontSize: '48px',
|
|
34
|
+
lineHeight: '60px',
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default config;
|
package/src/index.ts
CHANGED
|
@@ -106,3 +106,13 @@ export { default as Toggle, Props as ToggleProps } from './Toggle/Toggle';
|
|
|
106
106
|
export { default as Tooltip, Props as TooltipProps } from './Tooltip/Tooltip';
|
|
107
107
|
export { default as Visibility, Props as VisibilityProps } from './Visibility/Visibility';
|
|
108
108
|
export { default as VisibilityContainer, Props as VisibilityContainerProps } from './Visibility/VisibilityContainer';
|
|
109
|
+
|
|
110
|
+
export { default as BitkitProvider } from './chakra/BitkitProvider';
|
|
111
|
+
export { default as BitkitTheme } from './chakra/theme/theme';
|
|
112
|
+
export { default as NewButton, Props as NewButtonProps } from './chakra/components/Button/Button';
|
|
113
|
+
export { default as NewIconButton, Props as NewIconButtonProps } from './chakra/components/IconButton/IconButton';
|
|
114
|
+
export { default as NewLink, Props as NewLinkProps } from './chakra/components/Link/Link';
|
|
115
|
+
export { default as Menu, Props as MenuProps } from './chakra/components/Menu/Menu';
|
|
116
|
+
export { default as MenuItem, Props as MenuItemProps } from './chakra/components/Menu/MenuItem';
|
|
117
|
+
export { default as StatusTag, Props as StatusTagProps } from './chakra/components/StatusTag/StatusTag';
|
|
118
|
+
export { default as NewText, Props as NewTextProps } from './chakra/components/Text/Text';
|
package/tsconfig.json
CHANGED
|
@@ -12,11 +12,14 @@
|
|
|
12
12
|
"moduleResolution": "node",
|
|
13
13
|
"paths": {
|
|
14
14
|
"*": ["@types/*"],
|
|
15
|
-
"@
|
|
15
|
+
"@": ["src"],
|
|
16
|
+
"@bitrise/bitkit": ["src"],
|
|
16
17
|
},
|
|
17
18
|
"resolveJsonModule": true,
|
|
18
19
|
"sourceMap": true,
|
|
19
20
|
"strict": true,
|
|
20
|
-
"target": "es5"
|
|
21
|
+
"target": "es5",
|
|
22
|
+
// https://github.com/chakra-ui/chakra-ui/issues/2955 :(
|
|
23
|
+
"skipLibCheck": true,
|
|
21
24
|
}
|
|
22
25
|
}
|