@bitrise/bitkit 12.73.0 → 12.73.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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "12.73.0",
4
+ "version": "12.73.1",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -12,7 +12,9 @@
12
12
  "start": "yarn storybook",
13
13
  "test": "jest",
14
14
  "storybook": "storybook dev -p 6006",
15
- "build-storybook": "storybook build"
15
+ "build-storybook": "storybook build",
16
+ "theme": "chakra-cli tokens ./src/theme.ts",
17
+ "theme:watch": "chakra-cli tokens ./src/theme.ts --watch"
16
18
  },
17
19
  "alias": {
18
20
  "@bitrise/bitkit": "./src",
@@ -45,6 +47,7 @@
45
47
  "@babel/preset-react": "^7.23.3",
46
48
  "@babel/preset-typescript": "^7.23.3",
47
49
  "@bitrise/eslint-plugin": "^2.3.3",
50
+ "@chakra-ui/cli": "^2.4.1",
48
51
  "@commitlint/cli": "^17.8.0",
49
52
  "@commitlint/config-conventional": "^17.8.0",
50
53
  "@google-cloud/storage": "^7.7.0",
@@ -1,4 +1,4 @@
1
- import { ColorScheme } from '../../Foundations/Colors/Colors';
1
+ import { ColorScheme } from '../../tokens/tokens';
2
2
 
3
3
  const schemeColors: Record<ColorScheme, any> = {
4
4
  blue: {
@@ -1,5 +1,5 @@
1
1
  import { Button as ChakraButton, ButtonProps as ChakraButtonProps, forwardRef, useStyleConfig } from '@chakra-ui/react';
2
- import { ColorScheme } from '../../Foundations/Colors/Colors';
2
+ import { ColorScheme } from '../../tokens/tokens';
3
3
 
4
4
  export interface ColorButtonProps extends ChakraButtonProps {
5
5
  as?: 'a' | 'button';
@@ -14,7 +14,7 @@ import {
14
14
  InputRightElement,
15
15
  SystemStyleObject,
16
16
  } from '@chakra-ui/react';
17
- import { TypeColors } from '../../../Foundations/Colors/Colors';
17
+ import { TypeColors } from '../../../tokens/tokens';
18
18
  import Icon, { TypeIconName } from '../../Icon/Icon';
19
19
  import Text from '../../Text/Text';
20
20
  import Box from '../../Box/Box';
@@ -1,5 +1,5 @@
1
1
  import { MenuItem as ChakraMenuItem, MenuItemProps as ChakraMenuItemProps, forwardRef } from '@chakra-ui/react';
2
- import { TypeColors } from '../../Foundations/Colors/Colors';
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 '../../Foundations/Colors/Colors';
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 '../../Foundations/Colors/Colors';
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';
@@ -6,7 +6,7 @@ const Tabletheme = {
6
6
  return {
7
7
  caption: {
8
8
  textAlign: 'left',
9
- marginBottom: '24',
9
+ marginBottom: '12',
10
10
  },
11
11
  captionTitle: {
12
12
  fontSize: '4',
@@ -1,5 +1,5 @@
1
1
  import { Button, TabProps as ChakraTabProps, forwardRef, useTab, useTabsStyles } from '@chakra-ui/react';
2
- import { TypeColors } from '../../Foundations/Colors/Colors';
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';
@@ -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 '../../Foundations/Colors/Colors';
7
+ import { TypeColors } from '../../tokens/tokens';
8
8
 
9
9
  export interface TagProps extends Omit<ChakraTagProps, 'colorScheme' | 'size' | 'variant'> {
10
10
  closeButtonTooltip?: string;
@@ -0,0 +1,20 @@
1
+ // eslint-disable-next-line import/no-extraneous-dependencies
2
+ import { Unstyled } from '@storybook/blocks';
3
+ import Provider from '../../Components/Provider/Provider';
4
+ import Divider from '../../Components/Divider/Divider';
5
+ import Palette from './Palette';
6
+ import SystemTokens from './SystemTokens';
7
+
8
+ const Colors = () => {
9
+ return (
10
+ <Unstyled>
11
+ <Provider>
12
+ <Palette />
13
+ <Divider marginTop="48" marginBottom="32" size="1" />
14
+ <SystemTokens />
15
+ </Provider>
16
+ </Unstyled>
17
+ );
18
+ };
19
+
20
+ export default Colors;
@@ -0,0 +1,26 @@
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" size="8" color="pal.purple.10" fontWeight="normal" marginBlockEnd="8">
11
+ System Tokens
12
+ </Text>
13
+ <Card boxShadow="medium" padding="24">
14
+ {SystemColorKeys.map((groupName) => (
15
+ <TokenTable
16
+ data={semanticTokens.colors.sys[groupName]}
17
+ groupName={groupName}
18
+ key={groupName}
19
+ marginBottom="24"
20
+ />
21
+ ))}
22
+ </Card>
23
+ </>
24
+ );
25
+
26
+ export default SystemTokens;
@@ -1,4 +1,4 @@
1
- import { ColorScheme } from '../Colors/Colors';
1
+ import { ColorScheme } from '../../tokens/tokens';
2
2
 
3
3
  const AlertTheme = {
4
4
  parts: ['container', 'title', 'icon', 'body'],
@@ -0,0 +1,64 @@
1
+ import { useToken } from '@chakra-ui/react';
2
+ import CodeSnippet from '../../Components/CodeSnippet/CodeSnippet';
3
+ import Dot from '../../Components/Dot/Dot';
4
+ import Table from '../../Components/Table/Table';
5
+ import TableCaption from '../../Components/Table/TableCaption';
6
+ import TableContainer, { TableContainerProps } from '../../Components/Table/TableContainer';
7
+ import Tbody from '../../Components/Table/Tbody';
8
+ import Td from '../../Components/Table/Td';
9
+ import Text from '../../Components/Text/Text';
10
+ import Th from '../../Components/Table/Th';
11
+ import Thead from '../../Components/Table/Thead';
12
+ import Tr from '../../Components/Table/Tr';
13
+
14
+ const Row = ({ token, value }: { token: string; value: string }) => {
15
+ const finalValue = useToken('colors', value);
16
+ return (
17
+ <Tr role="group">
18
+ <Td>
19
+ <CodeSnippet _groupHover={{ backgroundColor: 'neutral.93' }}>{token}</CodeSnippet>
20
+ </Td>
21
+ <Td>
22
+ <>
23
+ <Text marginBottom="8" size="2">
24
+ {finalValue}
25
+ </Text>
26
+ <Text size="2">({value})</Text>
27
+ </>
28
+ </Td>
29
+ <Td>
30
+ <Dot backgroundColor={token.replace('colors.', '')} size="48" />
31
+ </Td>
32
+ </Tr>
33
+ );
34
+ };
35
+
36
+ export interface TokenTableProps extends TableContainerProps {
37
+ data: Record<string, string>;
38
+ groupName: string;
39
+ }
40
+
41
+ const TokenTable = (props: TokenTableProps) => {
42
+ const { data, groupName, ...rest } = props;
43
+ return (
44
+ <TableContainer {...rest}>
45
+ <Table>
46
+ <TableCaption>{groupName}</TableCaption>
47
+ <Thead>
48
+ <Tr>
49
+ <Th>Token</Th>
50
+ <Th>Value</Th>
51
+ <Th>Example</Th>
52
+ </Tr>
53
+ </Thead>
54
+ <Tbody>
55
+ {Object.entries(data).map(([token, value]) => (
56
+ <Row key={token} token={`colors.sys.${groupName}.${token}`} value={`colors.pal.${value}`} />
57
+ ))}
58
+ </Tbody>
59
+ </Table>
60
+ </TableContainer>
61
+ );
62
+ };
63
+
64
+ export default TokenTable;
package/src/index.ts CHANGED
@@ -3,7 +3,7 @@ export * from './utils/chakra';
3
3
  export * from './hooks';
4
4
 
5
5
  export { default as theme } from './theme';
6
- export type { TypeColors } from './Foundations/Colors/Colors';
6
+ export type { TypeColors } from './tokens/tokens';
7
7
  export type { TypeSizes } from './Foundations/Sizes/Sizes';
8
8
 
9
9
  export type { LinkProps } from './Components/Link/Link';
package/src/theme.ts CHANGED
@@ -46,7 +46,6 @@ import FileInput from './Components/Form/FileInput/FileInput.theme';
46
46
  import Filter from './Components/Filter/Filter.theme';
47
47
 
48
48
  import breakpoints from './Foundations/Breakpoints/Breakpoints';
49
- import colors from './Foundations/Colors/Colors';
50
49
  import radii from './Foundations/Radii/Radii';
51
50
  import shadows from './Foundations/Shadows/Shadows';
52
51
  import sizes from './Foundations/Sizes/Sizes';
@@ -54,6 +53,7 @@ import typography from './Foundations/Typography/Typography';
54
53
  import zIndices from './Foundations/Zindex/Zindex';
55
54
  import Toggletip from './Components/Toggletip/Toggletip.theme';
56
55
  import FilterSwitch from './Components/Filter/FilterSwitch/FilterSwitch.theme';
56
+ import { colors, semanticTokens } from './tokens/tokens';
57
57
 
58
58
  const theme = {
59
59
  config: {
@@ -67,6 +67,7 @@ const theme = {
67
67
  sizes,
68
68
  space: sizes,
69
69
  zIndices,
70
+ semanticTokens,
70
71
  styles: {
71
72
  global: {
72
73
  body: {