@bitrise/bitkit 12.18.0-alpha-drawer.2 → 12.19.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": "12.18.0-alpha-drawer.2",
4
+ "version": "12.19.0",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -3,6 +3,7 @@ import {
3
3
  CloseButton as ChakraCloseButton,
4
4
  CloseButtonProps as ChakraCloseButtonProps,
5
5
  } from '@chakra-ui/react';
6
+ import Icon from '../Icon/Icon';
6
7
  import CloseButtonTheme from './CloseButton.theme';
7
8
 
8
9
  type ThemeArguments = Parameters<(typeof CloseButtonTheme)['baseStyle']>[0];
@@ -12,7 +13,9 @@ export interface CloseButtonProps extends ChakraCloseButtonProps {
12
13
  }
13
14
 
14
15
  const CloseButton = forwardRef<CloseButtonProps, 'button'>((props, ref) => (
15
- <ChakraCloseButton ref={ref} {...CloseButtonTheme.defaultProps} {...props} />
16
+ <ChakraCloseButton ref={ref} {...CloseButtonTheme.defaultProps} {...props}>
17
+ <Icon name="CloseSmall" />
18
+ </ChakraCloseButton>
16
19
  ));
17
20
 
18
21
  export default CloseButton;
@@ -28,10 +28,6 @@ const DialogTheme: ComponentStyleConfig = {
28
28
  position: 'absolute',
29
29
  top: '22',
30
30
  right: '22',
31
- width: '40',
32
- height: '40',
33
- padding: '8',
34
- borderRadius: '8',
35
31
  },
36
32
  body: {
37
33
  flex: 1,
@@ -59,7 +59,7 @@ const Dialog: ComponentWithAs<'section', DialogProps> = ({
59
59
  {title}
60
60
  </Text>
61
61
  </ModalHeader>
62
- <ModalCloseButton isDisabled={!isClosable}>
62
+ <ModalCloseButton isDisabled={!isClosable} size="large">
63
63
  <Icon name="CloseSmall" />
64
64
  </ModalCloseButton>
65
65
  </>
@@ -27,7 +27,7 @@ const DrawerTheme = defineMultiStyleConfig({
27
27
  padding: '24',
28
28
  display: 'flex',
29
29
  flexDirection: 'column',
30
- gap: '9',
30
+ gap: '8',
31
31
  },
32
32
  closeButton: {
33
33
  position: 'absolute',
@@ -10,6 +10,7 @@ import {
10
10
  DrawerCloseButton,
11
11
  DrawerContentProps,
12
12
  } from '@chakra-ui/react';
13
+ import Icon from '../Icon/Icon';
13
14
 
14
15
  export interface DrawerProps
15
16
  extends Pick<ChakraDrawerProps, 'finalFocusRef' | 'initialFocusRef' | 'isOpen' | 'onClose'> {
@@ -25,7 +26,9 @@ const Drawer = (props: DrawerProps) => {
25
26
  <ChakraDrawer {...drawerProps}>
26
27
  <DrawerOverlay />
27
28
  <DrawerContent>
28
- <DrawerCloseButton />
29
+ <DrawerCloseButton size="small">
30
+ <Icon name="CloseSmall" />
31
+ </DrawerCloseButton>
29
32
  <DrawerHeader as="h3">{title}</DrawerHeader>
30
33
  <DrawerBody>{children}</DrawerBody>
31
34
  {footer && <DrawerFooter>{footer}</DrawerFooter>}
@@ -1,27 +1,13 @@
1
- import { RadioGroup as ChakraRadioGroup, RadioGroupProps as ChakraRadioGroupProps } from '@chakra-ui/react';
2
- import Box, { BoxProps } from '../../Box/Box';
1
+ import { RadioGroup as ChakraRadioGroup, RadioGroupProps } from '@chakra-ui/react';
3
2
 
4
- export type RadioGroupProps = ChakraRadioGroupProps & Omit<BoxProps, 'onChange'>;
3
+ export type { RadioGroupProps };
5
4
 
6
5
  /**
7
6
  * RadioGroup component to help manage Radio components and conveniently pass a few shared style props to each.
8
7
  * Composes Box.
9
8
  */
10
9
  const RadioGroup = (props: RadioGroupProps) => {
11
- const { children, defaultValue, isDisabled, isFocusable, isNative, onChange, value, ...boxProps } = props;
12
- const groupProps = {
13
- defaultValue,
14
- isDisabled,
15
- isFocusable,
16
- isNative,
17
- onChange,
18
- value,
19
- };
20
- return (
21
- <ChakraRadioGroup {...groupProps}>
22
- <Box {...boxProps}>{children}</Box>
23
- </ChakraRadioGroup>
24
- );
10
+ return <ChakraRadioGroup {...props} />;
25
11
  };
26
12
 
27
13
  export default RadioGroup;
@@ -87,9 +87,7 @@ const Notification = forwardRef<NotificationProps, 'div'>((props, ref) => {
87
87
  marginTop={marginTop}
88
88
  colorScheme={colorScheme}
89
89
  onClick={onClose}
90
- >
91
- <Icon name="CloseSmall" />
92
- </CloseButton>
90
+ />
93
91
  )}
94
92
  </ActionContext.Provider>
95
93
  </ChakraAlert>
@@ -4,7 +4,6 @@ import { Alert as ChakraAlert, AlertProps, forwardRef } from '@chakra-ui/react';
4
4
  import { ColorScheme } from '../../Foundations/Colors/Colors';
5
5
  import CloseButton from '../CloseButton/CloseButton';
6
6
  import ColorButton, { ColorButtonProps } from '../ColorButton/ColorButton';
7
- import Icon from '../Icon/Icon';
8
7
  import Box from '../Box/Box';
9
8
 
10
9
  export type ActionProps = {
@@ -66,11 +65,7 @@ const Ribbon = forwardRef<RibbonProps, 'div'>((props, ref) => {
66
65
  {children}
67
66
  {actionButton}
68
67
  </Box>
69
- {onClose && (
70
- <CloseButton flexShrink={0} colorScheme={colorScheme} marginStart="auto" onClick={onClose}>
71
- <Icon name="CloseSmall" />
72
- </CloseButton>
73
- )}
68
+ {onClose && <CloseButton flexShrink={0} colorScheme={colorScheme} marginStart="auto" onClick={onClose} />}
74
69
  </ActionContext.Provider>
75
70
  </ChakraAlert>
76
71
  );
@@ -0,0 +1,27 @@
1
+ import { ReactNode } from 'react';
2
+ import { LinkBox, LinkOverlay } from '@chakra-ui/react';
3
+ import Link, { LinkProps } from '../Link/Link';
4
+ import Td from './Td';
5
+ import Tr, { RowProps } from './Tr';
6
+
7
+ export interface ClickableRowProps extends RowProps {
8
+ label: ReactNode;
9
+ linkProps?: Omit<LinkProps, 'children'>;
10
+ }
11
+
12
+ const ClickableRow = (props: ClickableRowProps) => {
13
+ const { children, label, linkProps, ...rest } = props;
14
+
15
+ return (
16
+ <LinkBox as={Tr} {...rest}>
17
+ <Td>
18
+ <LinkOverlay as={Link} {...linkProps}>
19
+ {label}
20
+ </LinkOverlay>
21
+ </Td>
22
+ {children}
23
+ </LinkBox>
24
+ );
25
+ };
26
+
27
+ export default ClickableRow;
@@ -0,0 +1,45 @@
1
+ import { ReactNode } from 'react';
2
+ import { LinkBox, LinkOverlay } from '@chakra-ui/react';
3
+ import Radio from '../Form/Radio/Radio';
4
+ import Td from './Td';
5
+ import Tr, { RowProps } from './Tr';
6
+
7
+ export interface SelectableRowProps extends RowProps {
8
+ id: string;
9
+ label: ReactNode;
10
+ value: string;
11
+ }
12
+
13
+ const SelectableRow = (props: SelectableRowProps) => {
14
+ const { children, id, label, value, ...rest } = props;
15
+
16
+ return (
17
+ <LinkBox
18
+ as={Tr}
19
+ _hover={{
20
+ td: { background: 'neutral.95' },
21
+ ':has(input:checked)': {
22
+ td: { background: 'purple.93' },
23
+ },
24
+ }}
25
+ sx={{
26
+ ':has(input:checked)': {
27
+ td: { background: 'purple.95' },
28
+ },
29
+ }}
30
+ {...rest}
31
+ >
32
+ <Td>
33
+ <Radio id={id} value={value} />
34
+ </Td>
35
+ <Td>
36
+ <LinkOverlay as="label" cursor="pointer" htmlFor={id}>
37
+ {label}
38
+ </LinkOverlay>
39
+ </Td>
40
+ {children}
41
+ </LinkBox>
42
+ );
43
+ };
44
+
45
+ export default SelectableRow;
@@ -40,12 +40,6 @@ const Tabletheme: SystemStyleObject = {
40
40
  borderTopLeftRadius: '4',
41
41
  borderTopRightRadius: '4',
42
42
  },
43
- clickableTr: {
44
- cursor: 'pointer',
45
- '&:hover > td': {
46
- backgroundColor: 'neutral.95',
47
- },
48
- },
49
43
  th: {
50
44
  paddingX: '16',
51
45
  paddingY: '12',
@@ -10,12 +10,7 @@ import {
10
10
  import IconButton from '../IconButton/IconButton';
11
11
  import Td from './Td';
12
12
 
13
- type RowProps = ChakraTableRowProps & {
14
- /**
15
- * @deprecated - Please use it only when really necessary, we are working on a new table-like components with clickable items
16
- */
17
- onClick?: ChakraTableRowProps['onClick'];
18
- };
13
+ export type RowProps = ChakraTableRowProps;
19
14
 
20
15
  type NonExpandableProps = ChakraTableRowProps & {
21
16
  expandableContent?: never;
@@ -38,14 +33,9 @@ const Tr = forwardRef<TableRowProps, 'tr'>((props, ref) => {
38
33
  const css = useTableStyles();
39
34
 
40
35
  const properties: ChakraTableRowProps = {
41
- onClick,
42
36
  ...rest,
43
37
  };
44
38
 
45
- if (onClick) {
46
- properties.sx = css.clickableTr;
47
- }
48
-
49
39
  const onToggleClick = useCallback(() => {
50
40
  const nextOpen = !isOpen;
51
41
  onToggle();
package/src/index.ts CHANGED
@@ -276,3 +276,9 @@ export { default as ContentSwitcherItem } from './Components/ContentSwitcher/Con
276
276
  export type { DrawerProps } from './Components/Drawer/Drawer';
277
277
  export { default as Drawer } from './Components/Drawer/Drawer';
278
278
  export { default as useDrawer } from './Components/Drawer/useDrawer';
279
+
280
+ export type { ClickableRowProps } from './Components/Table/ClickableRow';
281
+ export { default as ClickableRow } from './Components/Table/ClickableRow';
282
+
283
+ export type { SelectableRowProps } from './Components/Table/SelectableRow';
284
+ export { default as SelectableRow } from './Components/Table/SelectableRow';