@bitrise/bitkit 12.35.1 → 12.37.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.35.1",
4
+ "version": "12.37.0",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -1,10 +1,24 @@
1
+ import { CardProps } from './Card';
2
+
1
3
  const CardTheme = {
2
- baseStyle: {
3
- _focusVisible: {
4
- boxShadow: 'medium',
5
- },
6
- borderRadius: '8',
7
- border: '1px solid',
4
+ baseStyle: ({ as, withHover }: CardProps) => {
5
+ return {
6
+ backgroundColor: 'neutral.100',
7
+ display: 'block',
8
+ width: '100%',
9
+ borderRadius: '8',
10
+ border: '1px solid',
11
+ _focusVisible: {
12
+ boxShadow: 'outline',
13
+ },
14
+ _hover:
15
+ as === 'a' || as === 'button' || withHover
16
+ ? {
17
+ backgroundColor: 'neutral.95',
18
+ borderColor: 'neutral.90',
19
+ }
20
+ : undefined,
21
+ };
8
22
  },
9
23
  variants: {
10
24
  elevated: {
@@ -6,43 +6,30 @@ import Box, { BoxProps } from '../Box/Box';
6
6
  export interface CardProps extends BoxProps {
7
7
  borderRadius?: keyof Radii;
8
8
  boxShadow?: keyof Shadows;
9
- withBorder?: boolean;
9
+ href?: string;
10
10
  variant?: 'elevated' | 'outline';
11
+ withHover?: boolean;
11
12
  }
12
13
 
13
14
  /**
14
15
  * Basic container element with default box shadow and border radius.
15
16
  */
16
17
  const Card = forwardRef<CardProps, 'div'>((props, ref) => {
17
- const { withBorder, variant, ...rest } = props;
18
- const css = useStyleConfig('Card', { variant });
18
+ const { as, variant, withHover, ...rest } = props;
19
+ const css = useStyleConfig('Card', { as, variant, withHover });
19
20
 
20
21
  const properties = {
21
- backgroundColor: 'white',
22
- display: 'block',
23
- width: '100%',
22
+ as,
24
23
  ...rest,
25
24
  } as BoxProps;
26
- if (!withBorder) {
27
- css.border = 'none';
28
- }
29
25
  if (props.as === 'button' && !(props as HTMLChakraProps<'button'>).type) {
30
26
  (properties as HTMLChakraProps<'button'>).type = 'button';
31
27
  }
32
- // eslint-disable-next-line no-underscore-dangle
33
- if ((props.as === 'a' || props.as === 'button') && !rest._hover) {
34
- // eslint-disable-next-line no-underscore-dangle
35
- properties._hover = {
36
- boxShadow: '0 0 0px 2px var(--colors-purple-50)',
37
- };
38
- }
39
28
  return <Box __css={css} {...properties} ref={ref} />;
40
29
  });
41
30
 
42
31
  Card.defaultProps = {
43
32
  as: 'div',
44
- borderRadius: '8',
45
- withBorder: true,
46
33
  variant: 'elevated',
47
34
  } as CardProps;
48
35
 
@@ -0,0 +1,9 @@
1
+ import { LinkBox as ChakraLinkBox, LinkBoxProps, forwardRef } from '@chakra-ui/react';
2
+
3
+ const LinkBox = forwardRef<LinkBoxProps, 'div'>((props, ref) => {
4
+ return <ChakraLinkBox {...props} ref={ref} />;
5
+ });
6
+
7
+ export type { LinkBoxProps };
8
+
9
+ export default LinkBox;
@@ -0,0 +1,9 @@
1
+ import { LinkOverlay as ChakraLinkOverlay, LinkOverlayProps, forwardRef } from '@chakra-ui/react';
2
+
3
+ const LinkOverlay = forwardRef<LinkOverlayProps, 'a'>((props, ref) => {
4
+ return <ChakraLinkOverlay {...props} ref={ref} />;
5
+ });
6
+
7
+ export type { LinkOverlayProps };
8
+
9
+ export default LinkOverlay;
package/src/index.ts CHANGED
@@ -289,3 +289,9 @@ export { default as CodeBlock } from './Components/CodeBlock/CodeBlock';
289
289
 
290
290
  export type { DefinitionTooltipProps } from './Components/DefinitionTooltip/DefinitionTooltip';
291
291
  export { default as DefinitionTooltip } from './Components/DefinitionTooltip/DefinitionTooltip';
292
+
293
+ export type { LinkBoxProps } from './Components/LinkBox/LinkBox';
294
+ export { default as LinkBox } from './Components/LinkBox/LinkBox';
295
+
296
+ export type { LinkOverlayProps } from './Components/LinkOverlay/LinkOverlay';
297
+ export { default as LinkOverlay } from './Components/LinkOverlay/LinkOverlay';