@bitrise/bitkit 12.104.1-alpha.0 → 12.105.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 +14 -17
- package/src/Components/Avatar/Avatar.tsx +2 -0
- package/src/Components/Badge/Badge.theme.ts +6 -2
- package/src/Components/Card/Card.tsx +2 -0
- package/src/Components/ColorButton/ColorButton.theme.ts +1 -1
- package/src/Components/ColorButton/ColorButton.tsx +1 -1
- package/src/Components/Dialog/Dialog.tsx +1 -1
- package/src/Components/Filter/Filter.theme.ts +1 -1
- package/src/Components/Form/DateInput/DateInput.tsx +3 -2
- package/src/Components/Form/Form.theme.ts +6 -3
- package/src/Components/Form/Input/Input.tsx +1 -1
- package/src/Components/Link/Link.theme.ts +2 -2
- package/src/Components/Link/Link.tsx +1 -1
- package/src/Components/Menu/MenuItem.tsx +1 -1
- package/src/Components/Notification/Notification.tsx +1 -1
- package/src/Components/Ribbon/Ribbon.tsx +1 -1
- package/src/Components/SegmentedControl/SegmentedControl.theme.ts +1 -1
- package/src/Components/Sidebar/SidebarItem.theme.ts +1 -1
- package/src/Components/Tabs/ContainedTab.tsx +3 -3
- package/src/Components/Tabs/Tabs.theme.ts +3 -1
- package/src/Components/Tag/Tag.theme.ts +8 -3
- package/src/Components/Tag/Tag.tsx +1 -1
- package/src/Components/Text/Text.theme.ts +2 -45
- package/src/Components/Text/Text.tsx +17 -4
- package/src/Foundations/Colors/Colors.tsx +4 -30
- package/src/Foundations/Colors/CommonTokens.tsx +21 -0
- package/src/Foundations/Colors/SystemTokens.tsx +27 -0
- package/src/Foundations/Radii/Radii.ts +10 -0
- package/src/Foundations/Sizes/Sizes.ts +18 -0
- package/src/Foundations/Themes/Alert.theme.ts +4 -3
- package/src/Foundations/Typography/Typography.ts +69 -0
- package/src/Foundations/docComponents/TokenTable.tsx +13 -42
- package/src/index.ts +2 -1
- package/src/theme.ts +112 -13
- package/src/tokens/tokens.json +3275 -0
- package/src/tokens/tokens.ts +49 -0
- package/src/tokens/tokensUtils.ts +20 -0
- package/src/utils/utils.ts +0 -14
- package/src/Components/components.theme.ts +0 -103
- package/src/Foundations/Typography/Typography.tsx +0 -25
- package/src/Foundations/docComponents/DocTitle.tsx +0 -11
- package/src/tokens/tokensToTheme.json +0 -977
- package/src/types/bitkit.ts +0 -37
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitrise/bitkit",
|
|
3
3
|
"description": "Bitrise React component library",
|
|
4
|
-
"version": "12.
|
|
4
|
+
"version": "12.105.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build-storybook": "storybook build",
|
|
13
|
-
"create-theme-from-tokens": "node ./scripts/createThemeFromTokens.js",
|
|
14
13
|
"lint": "eslint src --ext ts,tsx",
|
|
15
14
|
"lint:fix": "eslint src --ext ts,tsx --fix",
|
|
16
15
|
"release": "release-it minor --ci",
|
|
@@ -36,14 +35,12 @@
|
|
|
36
35
|
"@emotion/react": "^11.11.3",
|
|
37
36
|
"@emotion/styled": "^11.11.0",
|
|
38
37
|
"@floating-ui/react-dom-interactions": "^0.8.1",
|
|
39
|
-
"@fontsource/figtree": "^5.0.18",
|
|
40
|
-
"@fontsource/source-code-pro": "^5.0.16",
|
|
41
38
|
"framer-motion": "^11.0.3",
|
|
42
39
|
"luxon": "^3.4.4",
|
|
43
40
|
"react": "^18.2.0",
|
|
44
41
|
"react-dom": "^18.2.0",
|
|
45
|
-
"react-focus-lock": "^2.9.
|
|
46
|
-
"react-imask": "^7.
|
|
42
|
+
"react-focus-lock": "^2.9.7",
|
|
43
|
+
"react-imask": "^7.3.0",
|
|
47
44
|
"react-markdown": "^9.0.1"
|
|
48
45
|
},
|
|
49
46
|
"peerDependencies": {
|
|
@@ -58,15 +55,15 @@
|
|
|
58
55
|
"@bitrise/eslint-plugin": "^2.5.0",
|
|
59
56
|
"@chakra-ui/cli": "^2.4.1",
|
|
60
57
|
"@google-cloud/storage": "^7.7.0",
|
|
61
|
-
"@storybook/addon-actions": "^7.6.
|
|
62
|
-
"@storybook/addon-essentials": "^7.6.
|
|
63
|
-
"@storybook/addon-interactions": "^7.6.
|
|
64
|
-
"@storybook/addon-links": "^7.6.
|
|
65
|
-
"@storybook/addons": "^7.6.
|
|
66
|
-
"@storybook/blocks": "^7.6.
|
|
67
|
-
"@storybook/react": "^7.6.
|
|
68
|
-
"@storybook/react-webpack5": "^7.6.
|
|
69
|
-
"@storybook/theming": "^7.6.
|
|
58
|
+
"@storybook/addon-actions": "^7.6.12",
|
|
59
|
+
"@storybook/addon-essentials": "^7.6.12",
|
|
60
|
+
"@storybook/addon-interactions": "^7.6.12",
|
|
61
|
+
"@storybook/addon-links": "^7.6.12",
|
|
62
|
+
"@storybook/addons": "^7.6.12",
|
|
63
|
+
"@storybook/blocks": "^7.6.12",
|
|
64
|
+
"@storybook/react": "^7.6.12",
|
|
65
|
+
"@storybook/react-webpack5": "^7.6.12",
|
|
66
|
+
"@storybook/theming": "^7.6.12",
|
|
70
67
|
"@testing-library/dom": "^9.3.4",
|
|
71
68
|
"@testing-library/jest-dom": "^6.4.2",
|
|
72
69
|
"@testing-library/react": "^14.2.1",
|
|
@@ -74,7 +71,7 @@
|
|
|
74
71
|
"@types/jest": "^29.5.12",
|
|
75
72
|
"@types/luxon": "^3.4.2",
|
|
76
73
|
"@types/react": "^18.2.55",
|
|
77
|
-
"@types/react-dom": "^18.2.
|
|
74
|
+
"@types/react-dom": "^18.2.18",
|
|
78
75
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
79
76
|
"@typescript-eslint/parser": "^6.21.0",
|
|
80
77
|
"axios": "^1.6.7",
|
|
@@ -94,7 +91,7 @@
|
|
|
94
91
|
"prettier": "^3.2.5",
|
|
95
92
|
"react-hook-form": "^7.50.1",
|
|
96
93
|
"release-it": "^17.0.3",
|
|
97
|
-
"storybook": "^7.6.
|
|
94
|
+
"storybook": "^7.6.12",
|
|
98
95
|
"ts-jest": "^29.1.2",
|
|
99
96
|
"typescript": "^5.3.3"
|
|
100
97
|
},
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { Avatar as ChakraAvatar, AvatarProps as ChakraAvatarProps, forwardRef } from '@chakra-ui/react';
|
|
2
|
+
import { Radii } from '../../Foundations/Radii/Radii';
|
|
2
3
|
|
|
3
4
|
export type AvatarSizes = '16' | '24' | '32' | '40' | '48' | '64' | '96' | '128';
|
|
4
5
|
|
|
5
6
|
export interface AvatarProps extends ChakraAvatarProps {
|
|
7
|
+
borderRadius?: keyof Radii;
|
|
6
8
|
size?: AvatarSizes;
|
|
7
9
|
}
|
|
8
10
|
|
|
@@ -2,9 +2,13 @@ const BadgeTheme = {
|
|
|
2
2
|
baseStyle: {
|
|
3
3
|
borderRadius: '4',
|
|
4
4
|
display: 'inline-block',
|
|
5
|
+
fontSize: '1',
|
|
6
|
+
fontWeight: 'bold',
|
|
7
|
+
lineHeight: '11px',
|
|
8
|
+
paddingBottom: '5px',
|
|
9
|
+
paddingTop: '6px',
|
|
5
10
|
paddingX: '8',
|
|
6
|
-
|
|
7
|
-
textStyle: 'comp/badge/sm',
|
|
11
|
+
textTransform: 'uppercase',
|
|
8
12
|
},
|
|
9
13
|
};
|
|
10
14
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { forwardRef, HTMLChakraProps, useStyleConfig } from '@chakra-ui/react';
|
|
2
|
+
import { Radii } from '../../Foundations/Radii/Radii';
|
|
2
3
|
import { Shadows } from '../../Foundations/Shadows/Shadows';
|
|
3
4
|
import Box, { BoxProps } from '../Box/Box';
|
|
4
5
|
|
|
5
6
|
export interface CardProps extends BoxProps {
|
|
7
|
+
borderRadius?: keyof Radii;
|
|
6
8
|
boxShadow?: keyof Shadows;
|
|
7
9
|
href?: string;
|
|
8
10
|
variant?: 'elevated' | 'outline';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Button as ChakraButton, ButtonProps as ChakraButtonProps, forwardRef, useStyleConfig } from '@chakra-ui/react';
|
|
2
|
-
import { ColorScheme } from '../../
|
|
2
|
+
import { ColorScheme } from '../../tokens/tokens';
|
|
3
3
|
|
|
4
4
|
export interface ColorButtonProps extends ChakraButtonProps {
|
|
5
5
|
as?: 'a' | 'button';
|
|
@@ -69,7 +69,7 @@ const Dialog: ComponentWithAs<'section', DialogProps> = ({
|
|
|
69
69
|
{variant !== 'empty' && (
|
|
70
70
|
<>
|
|
71
71
|
<ModalHeader marginRight="48">
|
|
72
|
-
<Text as="h1" id={headerId}
|
|
72
|
+
<Text as="h1" id={headerId} size="5">
|
|
73
73
|
{title}
|
|
74
74
|
</Text>
|
|
75
75
|
</ModalHeader>
|
|
@@ -54,6 +54,7 @@ const DateInput = forwardRef<DateInputProps, 'div'>((props, ref) => {
|
|
|
54
54
|
format: (date: Date | null) => (date ? DateTime.fromJSDate(date).toFormat(dateInputDateFormat) : ''),
|
|
55
55
|
lazy: !isFocused && isEmpty,
|
|
56
56
|
mask: Date,
|
|
57
|
+
overwrite: true,
|
|
57
58
|
parse: (str: string) => {
|
|
58
59
|
try {
|
|
59
60
|
const parsedDate = DateTime.fromFormat(str, dateInputDateFormat);
|
|
@@ -65,7 +66,7 @@ const DateInput = forwardRef<DateInputProps, 'div'>((props, ref) => {
|
|
|
65
66
|
return DateTime.now().toJSDate();
|
|
66
67
|
}
|
|
67
68
|
},
|
|
68
|
-
pattern: 'LL
|
|
69
|
+
pattern: 'LL/`dd/`yyyy',
|
|
69
70
|
},
|
|
70
71
|
{
|
|
71
72
|
onAccept: (val, maskRef) => {
|
|
@@ -111,7 +112,7 @@ const DateInput = forwardRef<DateInputProps, 'div'>((props, ref) => {
|
|
|
111
112
|
aria-label="Show date picker"
|
|
112
113
|
color="icon.tertiary"
|
|
113
114
|
iconName="Calendar"
|
|
114
|
-
onClick={() => setIsDatePickerVisible(
|
|
115
|
+
onClick={() => setIsDatePickerVisible(!isDatePickerVisible)}
|
|
115
116
|
variant="tertiary"
|
|
116
117
|
/>
|
|
117
118
|
}
|
|
@@ -5,8 +5,9 @@ const FormTheme = {
|
|
|
5
5
|
baseStyle: {
|
|
6
6
|
helperText: {
|
|
7
7
|
color: 'neutral.50',
|
|
8
|
+
fontSize: '2',
|
|
9
|
+
lineHeight: '1.25rem',
|
|
8
10
|
marginTop: '4',
|
|
9
|
-
textStyle: 'comp/input/helperText',
|
|
10
11
|
},
|
|
11
12
|
} as ComponentStyleConfig,
|
|
12
13
|
},
|
|
@@ -14,8 +15,9 @@ const FormTheme = {
|
|
|
14
15
|
baseStyle: {
|
|
15
16
|
text: {
|
|
16
17
|
color: 'red.50',
|
|
18
|
+
fontSize: '2',
|
|
19
|
+
lineHeight: '1.25rem',
|
|
17
20
|
marginTop: '4',
|
|
18
|
-
textStyle: 'comp/input/helperText',
|
|
19
21
|
},
|
|
20
22
|
} as ComponentStyleConfig,
|
|
21
23
|
},
|
|
@@ -25,7 +27,8 @@ const FormTheme = {
|
|
|
25
27
|
color: 'neutral.80',
|
|
26
28
|
},
|
|
27
29
|
color: 'purple.10',
|
|
28
|
-
|
|
30
|
+
fontSize: '2',
|
|
31
|
+
fontWeight: 'bold',
|
|
29
32
|
} as ComponentStyleConfig,
|
|
30
33
|
},
|
|
31
34
|
};
|
|
@@ -14,11 +14,11 @@ import {
|
|
|
14
14
|
InputRightElement,
|
|
15
15
|
SystemStyleObject,
|
|
16
16
|
} from '@chakra-ui/react';
|
|
17
|
+
import { TypeColors } from '../../../tokens/tokens';
|
|
17
18
|
import Icon, { TypeIconName } from '../../Icon/Icon';
|
|
18
19
|
import Text from '../../Text/Text';
|
|
19
20
|
import Box from '../../Box/Box';
|
|
20
21
|
import Tooltip, { TooltipProps } from '../../Tooltip/Tooltip';
|
|
21
|
-
import { TypeColors } from '../../../types/bitkit';
|
|
22
22
|
|
|
23
23
|
type UsedFormControlProps = Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'>;
|
|
24
24
|
type UsedChakraInputProps = Pick<
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { textSizes } from '../../Foundations/Typography/Typography';
|
|
2
2
|
|
|
3
3
|
const schemeColors = {
|
|
4
4
|
default: { color: 'inherit', hover: 'inherit' },
|
|
@@ -21,7 +21,7 @@ const LinkTheme = {
|
|
|
21
21
|
fontSize: 'inherit',
|
|
22
22
|
};
|
|
23
23
|
},
|
|
24
|
-
...
|
|
24
|
+
...textSizes,
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export default LinkTheme;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef, Link as ChakraLink, LinkProps as ChakraLinkProps } from '@chakra-ui/react';
|
|
2
|
-
import { TextSizes } from '../../
|
|
2
|
+
import { TextSizes } from '../../Foundations/Typography/Typography';
|
|
3
3
|
|
|
4
4
|
export interface LinkProps extends ChakraLinkProps {
|
|
5
5
|
as?: 'a' | 'button';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef, MenuItem as ChakraMenuItem, MenuItemProps as ChakraMenuItemProps } from '@chakra-ui/react';
|
|
2
|
-
import { TypeColors } from '../../
|
|
2
|
+
import { TypeColors } from '../../tokens/tokens';
|
|
3
3
|
import Box from '../Box/Box';
|
|
4
4
|
import Icon, { TypeIconName } from '../Icon/Icon';
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cloneElement, createContext, ReactElement, useContext, useMemo } from 'react';
|
|
2
2
|
import { Alert as ChakraAlert, AlertProps, forwardRef } from '@chakra-ui/react';
|
|
3
3
|
|
|
4
|
-
import { ColorScheme } from '../../
|
|
4
|
+
import { ColorScheme } from '../../tokens/tokens';
|
|
5
5
|
import Box from '../Box/Box';
|
|
6
6
|
import CloseButton from '../CloseButton/CloseButton';
|
|
7
7
|
import ColorButton, { ColorButtonProps } from '../ColorButton/ColorButton';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext, useContext, useMemo } from 'react';
|
|
2
2
|
import { Alert as ChakraAlert, AlertProps, forwardRef } from '@chakra-ui/react';
|
|
3
3
|
|
|
4
|
-
import { ColorScheme } from '../../
|
|
4
|
+
import { ColorScheme } from '../../tokens/tokens';
|
|
5
5
|
import CloseButton from '../CloseButton/CloseButton';
|
|
6
6
|
import ColorButton, { ColorButtonProps } from '../ColorButton/ColorButton';
|
|
7
7
|
import Box from '../Box/Box';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Button, forwardRef, TabProps as ChakraTabProps, useTab, useTabsStyles } from '@chakra-ui/react';
|
|
2
|
-
import { TypeColors } from '../../
|
|
2
|
+
import { TypeColors } from '../../tokens/tokens';
|
|
3
3
|
import Box from '../Box/Box';
|
|
4
4
|
import Icon, { TypeIconName } from '../Icon/Icon';
|
|
5
5
|
import Text from '../Text/Text';
|
|
@@ -19,14 +19,14 @@ const ContainedTab = forwardRef<ContainedTabProps, 'button'>((props, ref) => {
|
|
|
19
19
|
return (
|
|
20
20
|
<Button __css={styles.containedTab} {...tabProps}>
|
|
21
21
|
<Box display="flex" gap="16" justifyContent="space-between">
|
|
22
|
-
<Text as="span"
|
|
22
|
+
<Text as="span" fontWeight="bold" hasEllipsis>
|
|
23
23
|
{tabProps.children}
|
|
24
24
|
</Text>
|
|
25
25
|
{isWarning && <Icon name="WarningColored" />}
|
|
26
26
|
{!isWarning && iconName && <Icon color={iconColor} name={iconName} />}
|
|
27
27
|
</Box>
|
|
28
28
|
{secondaryText && (
|
|
29
|
-
<Text as="span" display="block" hasEllipsis
|
|
29
|
+
<Text as="span" display="block" hasEllipsis size="2">
|
|
30
30
|
{secondaryText}
|
|
31
31
|
</Text>
|
|
32
32
|
)}
|
|
@@ -75,11 +75,13 @@ const baseStyle = defineStyle(
|
|
|
75
75
|
alignItems: 'center',
|
|
76
76
|
color: 'neutral.50',
|
|
77
77
|
display: 'flex',
|
|
78
|
+
fontSize: '3',
|
|
79
|
+
fontWeight: 'bold',
|
|
78
80
|
gap: '8',
|
|
79
81
|
justifyContent: 'flex-start',
|
|
82
|
+
lineHeight: '1.5rem',
|
|
80
83
|
paddingX: '16',
|
|
81
84
|
paddingY: '12',
|
|
82
|
-
textStyle: 'comp/tabs/line',
|
|
83
85
|
whiteSpace: 'nowrap',
|
|
84
86
|
},
|
|
85
87
|
tablist: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createMultiStyleConfigHelpers } from '@chakra-ui/styled-system';
|
|
2
2
|
import { rem } from '../../utils/utils';
|
|
3
|
-
import tokensToTheme from '../../tokens/tokensToTheme.json';
|
|
4
3
|
import { TagProps } from './Tag';
|
|
5
4
|
|
|
6
5
|
const { defineMultiStyleConfig, definePartsStyle } = createMultiStyleConfigHelpers([
|
|
@@ -27,7 +26,10 @@ const sizes = {
|
|
|
27
26
|
paddingRight: onClose ? rem(4) : rem(12),
|
|
28
27
|
paddingY: leftIcon || onClose ? rem(4) : rem(6),
|
|
29
28
|
},
|
|
30
|
-
label:
|
|
29
|
+
label: {
|
|
30
|
+
fontSize: '2',
|
|
31
|
+
lineHeight: rem(20),
|
|
32
|
+
},
|
|
31
33
|
};
|
|
32
34
|
}),
|
|
33
35
|
sm: definePartsStyle((props) => {
|
|
@@ -44,7 +46,10 @@ const sizes = {
|
|
|
44
46
|
paddingRight: onClose ? rem(2) : rem(8),
|
|
45
47
|
paddingY: onClose ? rem(2) : rem(4),
|
|
46
48
|
},
|
|
47
|
-
label:
|
|
49
|
+
label: {
|
|
50
|
+
fontSize: rem(12),
|
|
51
|
+
lineHeight: rem(16),
|
|
52
|
+
},
|
|
48
53
|
};
|
|
49
54
|
}),
|
|
50
55
|
};
|
|
@@ -4,7 +4,7 @@ import Skeleton from '../Skeleton/Skeleton';
|
|
|
4
4
|
import SkeletonBox from '../Skeleton/SkeletonBox';
|
|
5
5
|
import Text from '../Text/Text';
|
|
6
6
|
import Tooltip from '../Tooltip/Tooltip';
|
|
7
|
-
import { TypeColors } from '../../
|
|
7
|
+
import { TypeColors } from '../../tokens/tokens';
|
|
8
8
|
|
|
9
9
|
export interface TagProps extends Omit<ChakraTagProps, 'colorScheme' | 'size' | 'variant'> {
|
|
10
10
|
closeButtonTooltip?: string;
|
|
@@ -1,48 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TextSizes } from '../../types/bitkit';
|
|
1
|
+
import { textSizes } from '../../Foundations/Typography/Typography';
|
|
3
2
|
|
|
4
|
-
const
|
|
5
|
-
'1': {
|
|
6
|
-
fontSize: '0.6875rem',
|
|
7
|
-
lineHeight: '1rem',
|
|
8
|
-
textTransform: 'uppercase',
|
|
9
|
-
},
|
|
10
|
-
'2': {
|
|
11
|
-
fontSize: '0.875rem',
|
|
12
|
-
lineHeight: '1.25rem',
|
|
13
|
-
},
|
|
14
|
-
'3': {
|
|
15
|
-
fontSize: '1rem',
|
|
16
|
-
lineHeight: '1.5rem',
|
|
17
|
-
},
|
|
18
|
-
'4': {
|
|
19
|
-
fontSize: '1.1875rem',
|
|
20
|
-
lineHeight: '1.75rem',
|
|
21
|
-
},
|
|
22
|
-
'5': {
|
|
23
|
-
fontSize: '1.5rem',
|
|
24
|
-
fontWeight: 'bold',
|
|
25
|
-
lineHeight: '2.25rem',
|
|
26
|
-
},
|
|
27
|
-
'6': {
|
|
28
|
-
fontSize: '1.875rem',
|
|
29
|
-
fontWeight: 'bold',
|
|
30
|
-
lineHeight: '2.5rem',
|
|
31
|
-
},
|
|
32
|
-
'7': {
|
|
33
|
-
fontSize: '2.25rem',
|
|
34
|
-
fontWeight: 'bold',
|
|
35
|
-
lineHeight: '3rem',
|
|
36
|
-
},
|
|
37
|
-
'8': {
|
|
38
|
-
fontSize: '3rem',
|
|
39
|
-
fontWeight: 'bold',
|
|
40
|
-
lineHeight: '3.75rem',
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const TextTheme = {
|
|
45
|
-
sizes,
|
|
46
|
-
};
|
|
3
|
+
const TextTheme = textSizes;
|
|
47
4
|
|
|
48
5
|
export default TextTheme;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { forwardRef, ResponsiveValue, Text as ChakraText, TextProps as ChakraTextProps } from '@chakra-ui/react';
|
|
2
|
-
import { TextSizes } from '../../
|
|
2
|
+
import { TextSizes } from '../../Foundations/Typography/Typography';
|
|
3
3
|
|
|
4
4
|
export interface TextProps extends ChakraTextProps {
|
|
5
|
+
/**
|
|
6
|
+
* Font weight
|
|
7
|
+
*/
|
|
8
|
+
fontWeight?: ResponsiveValue<'bold' | 'demiBold' | 'normal'>;
|
|
5
9
|
hasEllipsis?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Size config (https://www.figma.com/file/grik9mTaJ5DfhydhWhXdP5/Bitkit-Foundations?node-id=211%3A12)
|
|
12
|
+
*/
|
|
6
13
|
size?: ResponsiveValue<TextSizes>;
|
|
7
14
|
}
|
|
8
15
|
|
|
@@ -10,9 +17,14 @@ export interface TextProps extends ChakraTextProps {
|
|
|
10
17
|
* `Text` component is the used to render text and paragraphs within an interface. It renders a `<p>` tag by default.
|
|
11
18
|
*/
|
|
12
19
|
const Text = forwardRef<TextProps, 'p'>((props, ref) => {
|
|
13
|
-
const { hasEllipsis, size, ...rest } = props;
|
|
14
|
-
const properties: ChakraTextProps = { size, ...rest };
|
|
15
|
-
|
|
20
|
+
const { fontWeight, hasEllipsis, size, textTransform, ...rest } = props;
|
|
21
|
+
const properties: ChakraTextProps = { fontWeight, size, textTransform, ...rest };
|
|
22
|
+
if (size === '1' && (!textTransform || textTransform === 'none')) {
|
|
23
|
+
properties.textTransform = 'uppercase';
|
|
24
|
+
}
|
|
25
|
+
if (!fontWeight && (size === '5' || size === '6' || size === '7' || size === '8')) {
|
|
26
|
+
properties.fontWeight = 'bold';
|
|
27
|
+
}
|
|
16
28
|
if (hasEllipsis) {
|
|
17
29
|
if (!properties.maxWidth) {
|
|
18
30
|
properties.maxWidth = '100%';
|
|
@@ -26,6 +38,7 @@ const Text = forwardRef<TextProps, 'p'>((props, ref) => {
|
|
|
26
38
|
|
|
27
39
|
Text.defaultProps = {
|
|
28
40
|
as: 'p',
|
|
41
|
+
size: '3',
|
|
29
42
|
} as TextProps;
|
|
30
43
|
|
|
31
44
|
export default Text;
|
|
@@ -2,43 +2,17 @@
|
|
|
2
2
|
import { Unstyled } from '@storybook/blocks';
|
|
3
3
|
import Provider from '../../Components/Provider/Provider';
|
|
4
4
|
import Divider from '../../Components/Divider/Divider';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import TokenTable from '../docComponents/TokenTable';
|
|
8
|
-
import DocTitle from '../docComponents/DocTitle';
|
|
5
|
+
import CommonTokens from './CommonTokens';
|
|
6
|
+
import SystemTokens from './SystemTokens';
|
|
9
7
|
import Palette from './Palette';
|
|
10
8
|
|
|
11
|
-
const commonColorKeys = ['background', 'border', 'icon', 'text'];
|
|
12
|
-
const systemColorKeys = Object.keys(tokens.semanticTokens.colors.sys);
|
|
13
|
-
|
|
14
9
|
const Colors = () => {
|
|
15
10
|
return (
|
|
16
11
|
<Unstyled>
|
|
17
12
|
<Provider>
|
|
18
|
-
<
|
|
19
|
-
<Card boxShadow="medium" padding="24">
|
|
20
|
-
{commonColorKeys.map((groupName) => (
|
|
21
|
-
<TokenTable
|
|
22
|
-
key={groupName}
|
|
23
|
-
data={tokens.semanticTokens.colors[groupName as keyof typeof tokens.semanticTokens.colors]}
|
|
24
|
-
groupName={groupName}
|
|
25
|
-
marginBottom="24"
|
|
26
|
-
/>
|
|
27
|
-
))}
|
|
28
|
-
</Card>
|
|
13
|
+
<CommonTokens />
|
|
29
14
|
<Divider marginBottom="32" marginTop="48" size="1" />
|
|
30
|
-
<
|
|
31
|
-
<Card boxShadow="medium" padding="24">
|
|
32
|
-
{systemColorKeys.map((groupName) => (
|
|
33
|
-
<TokenTable
|
|
34
|
-
key={groupName}
|
|
35
|
-
data={tokens.semanticTokens.colors.sys[groupName as keyof typeof tokens.semanticTokens.colors.sys]}
|
|
36
|
-
groupName={groupName}
|
|
37
|
-
marginBottom="24"
|
|
38
|
-
tokenPrefix="sys"
|
|
39
|
-
/>
|
|
40
|
-
))}
|
|
41
|
-
</Card>
|
|
15
|
+
<SystemTokens />
|
|
42
16
|
<Divider marginBottom="32" marginTop="48" size="1" />
|
|
43
17
|
<Palette />
|
|
44
18
|
</Provider>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { semanticTokens } from '../../tokens/tokens';
|
|
2
|
+
import Card from '../../Components/Card/Card';
|
|
3
|
+
import Text from '../../Components/Text/Text';
|
|
4
|
+
import TokenTable from '../docComponents/TokenTable';
|
|
5
|
+
|
|
6
|
+
const commonColorKeys = ['background', 'border', 'icon', 'text'];
|
|
7
|
+
|
|
8
|
+
const CommonTokens = () => (
|
|
9
|
+
<>
|
|
10
|
+
<Text as="h2" color="pal.purple.10" fontWeight="normal" marginBlockEnd="8" size="8">
|
|
11
|
+
Common Tokens
|
|
12
|
+
</Text>
|
|
13
|
+
<Card boxShadow="medium" padding="24">
|
|
14
|
+
{commonColorKeys.map((groupName) => (
|
|
15
|
+
<TokenTable key={groupName} data={semanticTokens.colors[groupName]} groupName={groupName} marginBottom="24" />
|
|
16
|
+
))}
|
|
17
|
+
</Card>
|
|
18
|
+
</>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export default CommonTokens;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { semanticTokens } from '../../tokens/tokens';
|
|
2
|
+
import Card from '../../Components/Card/Card';
|
|
3
|
+
import Text from '../../Components/Text/Text';
|
|
4
|
+
import TokenTable from '../docComponents/TokenTable';
|
|
5
|
+
|
|
6
|
+
const systemColorKeys = Object.keys(semanticTokens.colors.sys);
|
|
7
|
+
|
|
8
|
+
const SystemTokens = () => (
|
|
9
|
+
<>
|
|
10
|
+
<Text as="h2" color="pal.purple.10" fontWeight="normal" marginBlockEnd="8" size="8">
|
|
11
|
+
System Tokens
|
|
12
|
+
</Text>
|
|
13
|
+
<Card boxShadow="medium" padding="24">
|
|
14
|
+
{systemColorKeys.map((groupName) => (
|
|
15
|
+
<TokenTable
|
|
16
|
+
key={groupName}
|
|
17
|
+
data={semanticTokens.colors.sys[groupName]}
|
|
18
|
+
groupName={groupName}
|
|
19
|
+
marginBottom="24"
|
|
20
|
+
tokenPrefix="sys."
|
|
21
|
+
/>
|
|
22
|
+
))}
|
|
23
|
+
</Card>
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export default SystemTokens;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const sizes = {
|
|
2
|
+
'0': '0',
|
|
3
|
+
'4': '0.25rem',
|
|
4
|
+
'8': '0.5rem',
|
|
5
|
+
'12': '0.75rem',
|
|
6
|
+
'16': '1rem',
|
|
7
|
+
'20': '1.25rem',
|
|
8
|
+
'24': '1.5rem',
|
|
9
|
+
'32': '2rem',
|
|
10
|
+
'40': '2.5rem',
|
|
11
|
+
'48': '3rem',
|
|
12
|
+
'64': '4rem',
|
|
13
|
+
'96': '6rem',
|
|
14
|
+
'128': '8rem',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type TypeSizes = keyof typeof sizes;
|
|
18
|
+
export default sizes;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColorScheme } from '../../
|
|
1
|
+
import { ColorScheme } from '../../tokens/tokens';
|
|
2
2
|
|
|
3
3
|
const AlertTheme = {
|
|
4
4
|
baseStyle({ colorScheme }: { colorScheme: ColorScheme }) {
|
|
@@ -12,9 +12,10 @@ const AlertTheme = {
|
|
|
12
12
|
borderWidth: '1px',
|
|
13
13
|
color: `${colorScheme}.40`,
|
|
14
14
|
display: 'flex',
|
|
15
|
+
fontSize: '3',
|
|
15
16
|
gap: '8',
|
|
17
|
+
lineHeight: '1.5rem',
|
|
16
18
|
padding: '12',
|
|
17
|
-
textStyle: 'comp/notification/message',
|
|
18
19
|
},
|
|
19
20
|
icon: {
|
|
20
21
|
h: 24,
|
|
@@ -22,7 +23,7 @@ const AlertTheme = {
|
|
|
22
23
|
w: 24,
|
|
23
24
|
},
|
|
24
25
|
title: {
|
|
25
|
-
|
|
26
|
+
fontWeight: 'bold',
|
|
26
27
|
},
|
|
27
28
|
};
|
|
28
29
|
},
|