@bitrise/bitkit 12.101.1-alpha.1 → 12.102.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 +11 -13
- package/src/Components/Badge/Badge.theme.ts +6 -4
- package/src/Components/ColorButton/ColorButton.theme.ts +1 -1
- package/src/Components/ColorButton/ColorButton.tsx +1 -1
- package/src/Components/DatePicker/useDateRange.ts +13 -0
- package/src/Components/Dialog/Dialog.tsx +1 -2
- package/src/Components/Filter/Filter.theme.ts +1 -1
- package/src/Components/Form/DateInput/DateInput.tsx +21 -14
- package/src/Components/Form/Form.theme.ts +6 -4
- 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 -4
- package/src/Components/Tabs/Tabs.theme.ts +3 -2
- 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 -7
- 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/Themes/Alert.theme.ts +6 -4
- package/src/Foundations/Typography/Typography.ts +69 -0
- package/src/Foundations/docComponents/TokenTable.tsx +9 -24
- package/src/index.ts +3 -4
- package/src/theme.ts +105 -13
- package/src/tokens/tokens.json +203 -203
- package/src/tokens/tokens.ts +43 -14
- package/src/tokens/tokensUtils.ts +4 -47
- package/src/utils/utils.ts +0 -14
- package/src/Components/components.theme.ts +0 -103
- package/src/Foundations/Typography/Typography.tsx +0 -30
- package/src/Foundations/docComponents/DocTitle.tsx +0 -11
- package/src/tokens/colorTokens.ts +0 -9
- package/src/tokens/semanticTokens.ts +0 -29
- package/src/tokens/textTokens.ts +0 -96
- package/src/types/colors.ts +0 -12
- package/src/types/typography.ts +0 -21
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.102.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
|
|
@@ -35,8 +35,6 @@
|
|
|
35
35
|
"@emotion/react": "^11.11.3",
|
|
36
36
|
"@emotion/styled": "^11.11.0",
|
|
37
37
|
"@floating-ui/react-dom-interactions": "^0.8.1",
|
|
38
|
-
"@fontsource/figtree": "^5.0.18",
|
|
39
|
-
"@fontsource/source-code-pro": "^5.0.16",
|
|
40
38
|
"framer-motion": "^11.0.3",
|
|
41
39
|
"luxon": "^3.4.4",
|
|
42
40
|
"react": "^18.2.0",
|
|
@@ -57,15 +55,15 @@
|
|
|
57
55
|
"@bitrise/eslint-plugin": "^2.5.0",
|
|
58
56
|
"@chakra-ui/cli": "^2.4.1",
|
|
59
57
|
"@google-cloud/storage": "^7.7.0",
|
|
60
|
-
"@storybook/addon-actions": "^7.6.
|
|
61
|
-
"@storybook/addon-essentials": "^7.6.
|
|
62
|
-
"@storybook/addon-interactions": "^7.6.
|
|
63
|
-
"@storybook/addon-links": "^7.6.
|
|
64
|
-
"@storybook/addons": "^7.6.
|
|
65
|
-
"@storybook/blocks": "^7.6.
|
|
66
|
-
"@storybook/react": "^7.6.
|
|
67
|
-
"@storybook/react-webpack5": "^7.6.
|
|
68
|
-
"@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",
|
|
69
67
|
"@testing-library/dom": "^9.3.4",
|
|
70
68
|
"@testing-library/jest-dom": "^6.4.2",
|
|
71
69
|
"@testing-library/react": "^14.2.1",
|
|
@@ -93,7 +91,7 @@
|
|
|
93
91
|
"prettier": "^3.2.5",
|
|
94
92
|
"react-hook-form": "^7.50.1",
|
|
95
93
|
"release-it": "^17.0.3",
|
|
96
|
-
"storybook": "^7.6.
|
|
94
|
+
"storybook": "^7.6.12",
|
|
97
95
|
"ts-jest": "^29.1.2",
|
|
98
96
|
"typescript": "^5.3.3"
|
|
99
97
|
},
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { getTextToken } from '../../tokens/textTokens';
|
|
2
|
-
|
|
3
1
|
const BadgeTheme = {
|
|
4
2
|
baseStyle: {
|
|
5
3
|
borderRadius: '4',
|
|
6
4
|
display: 'inline-block',
|
|
5
|
+
fontSize: '1',
|
|
6
|
+
fontWeight: 'bold',
|
|
7
|
+
lineHeight: '11px',
|
|
8
|
+
paddingBottom: '5px',
|
|
9
|
+
paddingTop: '6px',
|
|
7
10
|
paddingX: '8',
|
|
8
|
-
|
|
9
|
-
...getTextToken('comp.badge.sm'),
|
|
11
|
+
textTransform: 'uppercase',
|
|
10
12
|
},
|
|
11
13
|
};
|
|
12
14
|
|
|
@@ -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';
|
|
@@ -23,6 +23,19 @@ export class DateRange {
|
|
|
23
23
|
}
|
|
24
24
|
return true;
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
containsEqual(date: DateTime): boolean {
|
|
28
|
+
if (this.from && this.to) {
|
|
29
|
+
return this.to >= date && this.from <= date;
|
|
30
|
+
}
|
|
31
|
+
if (this.from && !this.to) {
|
|
32
|
+
return this.from <= date;
|
|
33
|
+
}
|
|
34
|
+
if (this.to && !this.from) {
|
|
35
|
+
return this.to >= date;
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
26
39
|
}
|
|
27
40
|
|
|
28
41
|
function useDateRange(range: [DateTime | undefined, DateTime | undefined]): DateRange;
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
useBreakpointValue,
|
|
11
11
|
usePrefersReducedMotion,
|
|
12
12
|
} from '@chakra-ui/react';
|
|
13
|
-
import { getTextToken } from '../../tokens/textTokens';
|
|
14
13
|
import { BREAKPOINTS } from '../../Foundations/Breakpoints/Breakpoints';
|
|
15
14
|
import Icon from '../Icon/Icon';
|
|
16
15
|
import Text from '../Text/Text';
|
|
@@ -67,7 +66,7 @@ const Dialog: ComponentWithAs<'section', DialogProps> = ({
|
|
|
67
66
|
{variant !== 'empty' && (
|
|
68
67
|
<>
|
|
69
68
|
<ModalHeader marginRight="48">
|
|
70
|
-
<Text as="h1" id={headerId}
|
|
69
|
+
<Text as="h1" id={headerId} size="5">
|
|
71
70
|
{title}
|
|
72
71
|
</Text>
|
|
73
72
|
</ModalHeader>
|
|
@@ -2,25 +2,27 @@ import { useEffect, useImperativeHandle, useMemo, useState } from 'react';
|
|
|
2
2
|
import { forwardRef } from '@chakra-ui/react';
|
|
3
3
|
import { IMask, useIMask } from 'react-imask';
|
|
4
4
|
import { DateTime } from 'luxon';
|
|
5
|
-
import {
|
|
6
|
-
import DatePicker from '../../DatePicker/DatePicker';
|
|
5
|
+
import DatePicker, { DateRange } from '../../DatePicker/DatePicker';
|
|
7
6
|
import IconButton from '../../IconButton/IconButton';
|
|
8
7
|
import Input, { InputProps } from '../Input/Input';
|
|
9
8
|
|
|
9
|
+
export type DateInputError = 'outOfRange';
|
|
10
|
+
|
|
10
11
|
export type DateInputProps = Omit<InputProps, 'value' | 'onChange' | 'placeholder'> & {
|
|
11
|
-
onCalendarClick?(): void;
|
|
12
|
-
value?: string;
|
|
13
12
|
onChange?(value: string): void;
|
|
13
|
+
onError?(error: DateInputError, message: string): void;
|
|
14
|
+
value?: string;
|
|
15
|
+
selectable?: DateRange;
|
|
14
16
|
};
|
|
15
17
|
|
|
18
|
+
export const dateInputDateFormat = 'MM/dd/yyyy';
|
|
19
|
+
|
|
16
20
|
const DateInput = forwardRef<DateInputProps, 'div'>((props, ref) => {
|
|
17
|
-
const { inputRef,
|
|
21
|
+
const { inputRef, onChange, onError, selectable, value, ...rest } = props;
|
|
18
22
|
const [isDatePickerVisible, setIsDatePickerVisible] = useState(false);
|
|
19
23
|
const [isFocused, setIsFocused] = useState(false);
|
|
20
24
|
const [isEmpty, setIsEmpty] = useState(true);
|
|
21
25
|
|
|
22
|
-
const dateFormat = 'MM/dd/yyyy';
|
|
23
|
-
|
|
24
26
|
const {
|
|
25
27
|
ref: innerRef,
|
|
26
28
|
setValue,
|
|
@@ -43,18 +45,22 @@ const DateInput = forwardRef<DateInputProps, 'div'>((props, ref) => {
|
|
|
43
45
|
},
|
|
44
46
|
yyyy: {
|
|
45
47
|
autofix: false,
|
|
46
|
-
from:
|
|
48
|
+
from: 0,
|
|
47
49
|
mask: IMask.MaskedRange,
|
|
48
50
|
placeholderChar: 'y',
|
|
49
|
-
to:
|
|
51
|
+
to: 9999,
|
|
50
52
|
},
|
|
51
53
|
},
|
|
52
|
-
format: (date: Date | null) => (date ? DateTime.fromJSDate(date).toFormat(
|
|
54
|
+
format: (date: Date | null) => (date ? DateTime.fromJSDate(date).toFormat(dateInputDateFormat) : ''),
|
|
53
55
|
lazy: !isFocused && isEmpty,
|
|
54
56
|
mask: Date,
|
|
55
57
|
parse: (str: string) => {
|
|
56
58
|
try {
|
|
57
|
-
|
|
59
|
+
const parsedDate = DateTime.fromFormat(str, dateInputDateFormat);
|
|
60
|
+
if (selectable && !selectable.containsEqual(parsedDate)) {
|
|
61
|
+
onError?.('outOfRange', 'Date is not selectable.');
|
|
62
|
+
}
|
|
63
|
+
return parsedDate.toJSDate();
|
|
58
64
|
} catch {
|
|
59
65
|
return DateTime.now().toJSDate();
|
|
60
66
|
}
|
|
@@ -75,7 +81,7 @@ const DateInput = forwardRef<DateInputProps, 'div'>((props, ref) => {
|
|
|
75
81
|
|
|
76
82
|
const currentDate = useMemo(() => {
|
|
77
83
|
try {
|
|
78
|
-
return DateTime.fromFormat(currentValue,
|
|
84
|
+
return DateTime.fromFormat(currentValue, dateInputDateFormat);
|
|
79
85
|
} catch {
|
|
80
86
|
return undefined;
|
|
81
87
|
}
|
|
@@ -84,8 +90,9 @@ const DateInput = forwardRef<DateInputProps, 'div'>((props, ref) => {
|
|
|
84
90
|
return (
|
|
85
91
|
<DatePicker
|
|
86
92
|
mode="day"
|
|
87
|
-
onApply={(day) => setValue(day?.toFormat(
|
|
93
|
+
onApply={(day) => setValue(day?.toFormat(dateInputDateFormat) || '')}
|
|
88
94
|
onClose={() => setIsDatePickerVisible(false)}
|
|
95
|
+
selectable={selectable}
|
|
89
96
|
selected={currentDate}
|
|
90
97
|
variant="default"
|
|
91
98
|
visible={isDatePickerVisible}
|
|
@@ -96,7 +103,7 @@ const DateInput = forwardRef<DateInputProps, 'div'>((props, ref) => {
|
|
|
96
103
|
inputRef={innerRef}
|
|
97
104
|
onBlur={() => setIsFocused(false)}
|
|
98
105
|
onFocus={() => setIsFocused(true)}
|
|
99
|
-
placeholder={
|
|
106
|
+
placeholder={dateInputDateFormat.toLocaleLowerCase()}
|
|
100
107
|
rightAddon={
|
|
101
108
|
<IconButton
|
|
102
109
|
_active={{ background: 'transparent' }}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ComponentStyleConfig } from '@chakra-ui/theme';
|
|
2
|
-
import { getTextToken } from '../../tokens/textTokens';
|
|
3
2
|
|
|
4
3
|
const FormTheme = {
|
|
5
4
|
Form: {
|
|
6
5
|
baseStyle: {
|
|
7
6
|
helperText: {
|
|
8
7
|
color: 'neutral.50',
|
|
8
|
+
fontSize: '2',
|
|
9
|
+
lineHeight: '1.25rem',
|
|
9
10
|
marginTop: '4',
|
|
10
|
-
...getTextToken('comp.input.helperText'),
|
|
11
11
|
},
|
|
12
12
|
} as ComponentStyleConfig,
|
|
13
13
|
},
|
|
@@ -15,8 +15,9 @@ const FormTheme = {
|
|
|
15
15
|
baseStyle: {
|
|
16
16
|
text: {
|
|
17
17
|
color: 'red.50',
|
|
18
|
+
fontSize: '2',
|
|
19
|
+
lineHeight: '1.25rem',
|
|
18
20
|
marginTop: '4',
|
|
19
|
-
...getTextToken('comp.input.helperText'),
|
|
20
21
|
},
|
|
21
22
|
} as ComponentStyleConfig,
|
|
22
23
|
},
|
|
@@ -26,7 +27,8 @@ const FormTheme = {
|
|
|
26
27
|
color: 'neutral.80',
|
|
27
28
|
},
|
|
28
29
|
color: 'purple.10',
|
|
29
|
-
|
|
30
|
+
fontSize: '2',
|
|
31
|
+
fontWeight: 'bold',
|
|
30
32
|
} as ComponentStyleConfig,
|
|
31
33
|
},
|
|
32
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/colors';
|
|
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,9 +1,8 @@
|
|
|
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';
|
|
6
|
-
import { getTextToken } from '../../tokens/textTokens';
|
|
7
6
|
|
|
8
7
|
export interface ContainedTabProps extends ChakraTabProps {
|
|
9
8
|
id: string;
|
|
@@ -20,14 +19,14 @@ const ContainedTab = forwardRef<ContainedTabProps, 'button'>((props, ref) => {
|
|
|
20
19
|
return (
|
|
21
20
|
<Button __css={styles.containedTab} {...tabProps}>
|
|
22
21
|
<Box display="flex" gap="16" justifyContent="space-between">
|
|
23
|
-
<Text as="span" hasEllipsis
|
|
22
|
+
<Text as="span" fontWeight="bold" hasEllipsis>
|
|
24
23
|
{tabProps.children}
|
|
25
24
|
</Text>
|
|
26
25
|
{isWarning && <Icon name="WarningColored" />}
|
|
27
26
|
{!isWarning && iconName && <Icon color={iconColor} name={iconName} />}
|
|
28
27
|
</Box>
|
|
29
28
|
{secondaryText && (
|
|
30
|
-
<Text as="span" display="block" hasEllipsis
|
|
29
|
+
<Text as="span" display="block" hasEllipsis size="2">
|
|
31
30
|
{secondaryText}
|
|
32
31
|
</Text>
|
|
33
32
|
)}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defineStyle, defineStyleConfig, SystemStyleObject } from '@chakra-ui/styled-system';
|
|
2
|
-
import { getTextToken } from '../../tokens/textTokens';
|
|
3
2
|
|
|
4
3
|
const baseStyle = defineStyle(
|
|
5
4
|
({ variant }): SystemStyleObject => ({
|
|
@@ -76,12 +75,14 @@ const baseStyle = defineStyle(
|
|
|
76
75
|
alignItems: 'center',
|
|
77
76
|
color: 'neutral.50',
|
|
78
77
|
display: 'flex',
|
|
78
|
+
fontSize: '3',
|
|
79
|
+
fontWeight: 'bold',
|
|
79
80
|
gap: '8',
|
|
80
81
|
justifyContent: 'flex-start',
|
|
82
|
+
lineHeight: '1.5rem',
|
|
81
83
|
paddingX: '16',
|
|
82
84
|
paddingY: '12',
|
|
83
85
|
whiteSpace: 'nowrap',
|
|
84
|
-
...getTextToken('comp.tabs.line'),
|
|
85
86
|
},
|
|
86
87
|
tablist: {
|
|
87
88
|
borderBottom: variant === 'line' ? '1px solid' : undefined,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createMultiStyleConfigHelpers } from '@chakra-ui/styled-system';
|
|
2
2
|
import { rem } from '../../utils/utils';
|
|
3
|
-
import { getTextToken } from '../../tokens/textTokens';
|
|
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/typography';
|
|
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,20 +1,30 @@
|
|
|
1
1
|
import { forwardRef, ResponsiveValue, Text as ChakraText, TextProps as ChakraTextProps } from '@chakra-ui/react';
|
|
2
|
-
import {
|
|
3
|
-
import { TextSizes, TokenStrings } from '../../types/typography';
|
|
2
|
+
import { TextSizes } from '../../Foundations/Typography/Typography';
|
|
4
3
|
|
|
5
4
|
export interface TextProps extends ChakraTextProps {
|
|
5
|
+
/**
|
|
6
|
+
* Font weight
|
|
7
|
+
*/
|
|
8
|
+
fontWeight?: ResponsiveValue<'bold' | 'demiBold' | 'normal'>;
|
|
6
9
|
hasEllipsis?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Size config (https://www.figma.com/file/grik9mTaJ5DfhydhWhXdP5/Bitkit-Foundations?node-id=211%3A12)
|
|
12
|
+
*/
|
|
7
13
|
size?: ResponsiveValue<TextSizes>;
|
|
8
|
-
token?: TokenStrings;
|
|
9
14
|
}
|
|
10
15
|
|
|
11
16
|
/**
|
|
12
17
|
* `Text` component is the used to render text and paragraphs within an interface. It renders a `<p>` tag by default.
|
|
13
18
|
*/
|
|
14
19
|
const Text = forwardRef<TextProps, 'p'>((props, ref) => {
|
|
15
|
-
const { hasEllipsis, size,
|
|
16
|
-
const properties: ChakraTextProps = { size, ...rest };
|
|
17
|
-
|
|
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
|
+
}
|
|
18
28
|
if (hasEllipsis) {
|
|
19
29
|
if (!properties.maxWidth) {
|
|
20
30
|
properties.maxWidth = '100%';
|
|
@@ -23,7 +33,7 @@ const Text = forwardRef<TextProps, 'p'>((props, ref) => {
|
|
|
23
33
|
properties.whiteSpace = 'nowrap';
|
|
24
34
|
properties.overflow = 'hidden';
|
|
25
35
|
}
|
|
26
|
-
return <ChakraText {...properties}
|
|
36
|
+
return <ChakraText {...properties} ref={ref} />;
|
|
27
37
|
});
|
|
28
38
|
|
|
29
39
|
Text.defaultProps = {
|
|
@@ -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(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={semanticTokens.colors[groupName]}
|
|
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={semanticTokens.colors.sys[groupName]}
|
|
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;
|