@bitrise/bitkit 13.104.0 → 13.104.1-alpha.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "13.104.0",
4
+ "version": "13.104.1-alpha.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -1,20 +1,54 @@
1
- import type { ComponentStyleConfig } from '@chakra-ui/theme';
1
+ import { createMultiStyleConfigHelpers, defineStyle } from '@chakra-ui/styled-system';
2
2
 
3
- const ListTheme: ComponentStyleConfig = {
4
- baseStyle: ({ as }) => {
5
- if (as === 'ul') {
6
- return {
7
- item: {
8
- '::marker': {
9
- fontSize: '12px',
10
- },
11
- },
12
- };
13
- }
3
+ const { defineMultiStyleConfig, definePartsStyle } = createMultiStyleConfigHelpers(['container', 'icon', 'item']);
4
+
5
+ const baseStyleContainer = defineStyle({
6
+ marginInlineStart: 16,
7
+ });
8
+
9
+ const baseStyleIcon = defineStyle({
10
+ marginEnd: '6',
11
+ display: 'inline',
12
+ verticalAlign: '-2px',
13
+ });
14
14
 
15
- return {};
15
+ const baseStyle = definePartsStyle({
16
+ container: baseStyleContainer,
17
+ icon: baseStyleIcon,
18
+ });
19
+
20
+ const ListTheme = defineMultiStyleConfig({
21
+ baseStyle,
22
+ variants: {
23
+ ordered: {
24
+ container: {
25
+ counterReset: 'count',
26
+ marginInlineStart: '32',
27
+ },
28
+ item: {
29
+ position: 'relative',
30
+ counterIncrement: 'count',
31
+ _before: {
32
+ content: 'counter(count)',
33
+ position: 'absolute',
34
+ left: '-32px',
35
+ top: '2',
36
+ paddingY: '2',
37
+ color: 'sys/neutral/strong',
38
+ backgroundColor: 'sys/neutral/subtle',
39
+ textAlign: 'center',
40
+ textStyle: 'comp/badge/sm',
41
+ width: '20',
42
+ borderRadius: '50%',
43
+ },
44
+ },
45
+ },
46
+ unstyled: {
47
+ container: {
48
+ marginInlineStart: 0,
49
+ },
50
+ },
16
51
  },
17
- parts: ['container', 'item'],
18
- };
52
+ });
19
53
 
20
54
  export default ListTheme;
@@ -1,16 +1,33 @@
1
- import { forwardRef, ListProps as ChakraListProps, OrderedList, UnorderedList } from '@chakra-ui/react';
1
+ import { forwardRef, List as ChakraList, ListProps as ChakraListProps } from '@chakra-ui/react';
2
2
 
3
3
  export interface ListProps extends ChakraListProps {
4
- isOrdered?: boolean;
4
+ variant?: 'simple-ordered' | 'ordered' | 'unordered' | 'unstyled';
5
5
  }
6
6
 
7
7
  /**
8
8
  * List is used to display list items. It renders a <ul> or <ol> element by default.
9
9
  */
10
10
  const List = forwardRef<ListProps, 'ul'>((props, ref) => {
11
- const { isOrdered, spacing = '8', ...rest } = props;
12
- const Component = isOrdered ? OrderedList : UnorderedList;
13
- return <Component spacing={spacing} {...rest} ref={ref} />;
11
+ const { spacing = '8', variant = 'unstyled', ...rest } = props;
12
+
13
+ const isOrdered = variant === 'simple-ordered';
14
+ let styleType: ListProps['styleType'] = 'none';
15
+ if (variant === 'unordered') {
16
+ styleType = 'initial';
17
+ }
18
+ if (isOrdered) {
19
+ styleType = 'decimal';
20
+ }
21
+ return (
22
+ <ChakraList
23
+ as={isOrdered ? 'ol' : 'ul'}
24
+ spacing={spacing}
25
+ styleType={styleType}
26
+ variant={variant}
27
+ {...rest}
28
+ ref={ref}
29
+ />
30
+ );
14
31
  });
15
32
 
16
33
  export default List;
@@ -1,12 +1,29 @@
1
- import { forwardRef, ListItem as ChakraListItem, ListItemProps } from '@chakra-ui/react';
1
+ import {
2
+ forwardRef,
3
+ ListItem as ChakraListItem,
4
+ ListItemProps as ChakraListItemProps,
5
+ ListIcon,
6
+ } from '@chakra-ui/react';
7
+ import { BoxProps } from '../Box/Box';
8
+ import { TypeIconName } from '../Icon/Icon';
9
+ import * as Icons from '../Icons/24x24';
10
+
11
+ export interface ListItemProps extends ChakraListItemProps {
12
+ iconColor?: BoxProps['color'];
13
+ iconName?: TypeIconName;
14
+ }
2
15
 
3
16
  /**
4
17
  * ListItem is the valid children of List. It renders a <li> element by default.
5
18
  */
6
19
  const ListItem = forwardRef<ListItemProps, 'li'>((props, ref) => {
7
- return <ChakraListItem {...props} ref={ref} />;
20
+ const { children, iconColor, iconName, ...rest } = props;
21
+ return (
22
+ <ChakraListItem {...rest} ref={ref}>
23
+ {!!iconName && <ListIcon as={Icons[iconName]} color={iconColor} />}
24
+ {children}
25
+ </ChakraListItem>
26
+ );
8
27
  });
9
28
 
10
- export type { ListItemProps };
11
-
12
29
  export default ListItem;
@@ -42,7 +42,7 @@ const defaultComponents = (size: 'sm' | 'md' | 'lg', gap: GapType = '16'): Compo
42
42
  h6: ({ node, ...props }) => <Text as="h6" textStyle="heading/h6" {...props} />,
43
43
  hr: () => <Divider borderColor="separator.primary" my={gap} size="2" />,
44
44
  li: ({ node, ...props }) => <ListItem {...props} />,
45
- ol: ({ node, ...props }) => <List isOrdered {...props} />,
45
+ ol: ({ node, ...props }) => <List variant="simple-ordered" {...props} />,
46
46
  p: ({ node, ...props }) => <Text {...props} />,
47
47
  pre: ({ node, ...props }) => (
48
48
  <CodeSnippet variant="multi" size={codeSize}>