@bitrise/bitkit 12.29.1 → 12.29.2

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.29.1",
4
+ "version": "12.29.2",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -11,7 +11,7 @@ export interface CardProps extends BoxProps {
11
11
  }
12
12
 
13
13
  /**
14
- * Basic container element with default box shadow and border radius. Use with `CardContent` to add padding.
14
+ * Basic container element with default box shadow and border radius.
15
15
  */
16
16
  const Card = forwardRef<CardProps, 'div'>((props, ref) => {
17
17
  const { withBorder, variant, ...rest } = props;
@@ -1,8 +1,23 @@
1
- import { ChakraProvider, ChakraProviderProps } from '@chakra-ui/react';
1
+ import { ReactNode } from 'react';
2
+ import { ChakraProvider } from '@chakra-ui/react';
2
3
  import theme from '../../theme';
3
4
 
4
- const Provider = ({ children }: ChakraProviderProps) => {
5
- return <ChakraProvider theme={theme}>{children}</ChakraProvider>;
5
+ type ProviderProps = {
6
+ children: ReactNode;
7
+ toastOffset?: string;
8
+ };
9
+
10
+ const Provider = ({ children, toastOffset }: ProviderProps) => {
11
+ return (
12
+ <ChakraProvider
13
+ theme={theme}
14
+ toastOptions={{
15
+ defaultOptions: toastOffset ? { containerStyle: { transform: `translateY(${toastOffset})` } } : undefined,
16
+ }}
17
+ >
18
+ {children}
19
+ </ChakraProvider>
20
+ );
6
21
  };
7
22
 
8
23
  export default Provider;
@@ -5,7 +5,7 @@ import Notification, { ActionProps, NotificationAction, NotificationProps } from
5
5
 
6
6
  export interface ToastOptions {
7
7
  title: string;
8
- description: React.ReactNode;
8
+ description?: React.ReactNode;
9
9
  status: NotificationProps['status'];
10
10
  action?: ActionProps;
11
11
  duration?: UseToastOptions['duration'];
@@ -24,7 +24,7 @@ const useToast = () => {
24
24
  toast({
25
25
  isClosable: opts.isClosable,
26
26
  duration: opts.duration,
27
- position: opts.position || 'bottom',
27
+ position: opts.position || 'top-right',
28
28
  render: ({ onClose }) => (
29
29
  <Notification
30
30
  boxShadow="large"
@@ -34,7 +34,7 @@ const useToast = () => {
34
34
  >
35
35
  <Box display="flex" flexDirection="column">
36
36
  <AlertTitle>{opts.title}</AlertTitle>
37
- <AlertDescription>{opts.description}</AlertDescription>
37
+ {opts.description && <AlertDescription>{opts.description}</AlertDescription>}
38
38
  {!opts.action && timestamp && <AlertDescription marginTop="8">{timestamp}</AlertDescription>}
39
39
  {opts.action && <NotificationAction alignSelf="start" marginTop="8" marginBottom="4" {...opts.action} />}
40
40
  </Box>
package/src/index.ts CHANGED
@@ -29,9 +29,6 @@ export { default as ButtonGroup } from './Components/ButtonGroup/ButtonGroup';
29
29
  export type { CardProps } from './Components/Card/Card';
30
30
  export { default as Card } from './Components/Card/Card';
31
31
 
32
- export type { CardContentProps } from './Components/Card/CardContent';
33
- export { default as CardContent } from './Components/Card/CardContent';
34
-
35
32
  export type { TextProps } from './Components/Text/Text';
36
33
  export { default as Text } from './Components/Text/Text';
37
34
 
@@ -1,14 +0,0 @@
1
- import Box, { BoxProps } from '../Box/Box';
2
-
3
- export type CardContentProps = BoxProps;
4
-
5
- /**
6
- * Basic container element with default box shadow, border radius and padding.
7
- */
8
- const CardContent = (props: CardContentProps) => {
9
- return <Box {...props} />;
10
- };
11
-
12
- CardContent.defaultProps = {} as CardContentProps;
13
-
14
- export default CardContent;