@bitrise/bitkit 9.25.0 → 9.26.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": "9.25.0",
4
+ "version": "9.26.1",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -0,0 +1,18 @@
1
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
2
+ import Button from '../Button/Button';
3
+ import EmptyState, { EmptyStateProps } from './EmptyState';
4
+
5
+ export default {
6
+ title: 'Components/EmptyState',
7
+ component: EmptyState,
8
+ } as ComponentMeta<typeof EmptyState>;
9
+
10
+ export const WithProps: ComponentStory<typeof EmptyState> = (props) => <EmptyState {...props} />;
11
+ WithProps.args = {
12
+ children: <Button variant="secondary">This is added as children</Button>,
13
+ description:
14
+ 'After you have created a group, you will be able to add group members, and assign access for the group to apps in this Workspace.',
15
+ iconName: 'Wow',
16
+ maxContentWidth: '35rem',
17
+ title: 'Your groups will appear here',
18
+ } as EmptyStateProps;
@@ -0,0 +1,36 @@
1
+ import type { ComponentStyleConfig } from '@chakra-ui/theme';
2
+
3
+ const EmptyStateTheme: ComponentStyleConfig = {
4
+ parts: ['box', 'title', 'description'],
5
+ baseStyle: ({ maxContentWidth }) => ({
6
+ box: {
7
+ display: 'flex',
8
+ flexDirection: 'column',
9
+ alignItems: 'center',
10
+ justifyContent: 'center',
11
+ paddingX: '16',
12
+ paddingY: {
13
+ mobile: '32',
14
+ desktop: '48',
15
+ },
16
+ backgroundColor: 'neutral.95',
17
+ borderRadius: '4',
18
+ color: 'text.secondary',
19
+ textAlign: 'center',
20
+ },
21
+ title: {
22
+ marginTop: '8',
23
+ fontWeight: 'bold',
24
+ maxWidth: maxContentWidth || '35rem',
25
+ },
26
+ description: {
27
+ marginTop: '8',
28
+ maxWidth: maxContentWidth || '35rem',
29
+ '+ *': {
30
+ marginTop: '16',
31
+ },
32
+ },
33
+ }),
34
+ };
35
+
36
+ export default EmptyStateTheme;
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { useMultiStyleConfig } from '@chakra-ui/react';
3
+ import Box, { BoxProps } from '../Box/Box';
4
+ import Icon, { TypeIconName } from '../Icon/Icon';
5
+ import Text from '../Text/Text';
6
+
7
+ export interface EmptyStateProps extends BoxProps {
8
+ description?: string;
9
+ iconName: TypeIconName;
10
+ maxContentWidth?: string;
11
+ title: string;
12
+ }
13
+
14
+ const EmptyState = ({ children, description, iconName, maxContentWidth, title, ...rest }: EmptyStateProps) => {
15
+ const css = useMultiStyleConfig('EmptyState', { maxContentWidth });
16
+
17
+ return (
18
+ <Box __css={css.box} {...rest}>
19
+ <Icon aria-label={title} name={iconName} size="32" />
20
+ <Text as="h5" sx={css.title}>
21
+ {title}
22
+ </Text>
23
+ {description && (
24
+ <Text sx={css.description} size="2">
25
+ {description}
26
+ </Text>
27
+ )}
28
+ {children}
29
+ </Box>
30
+ );
31
+ };
32
+
33
+ export default EmptyState;
@@ -8,7 +8,7 @@ export interface SelectProps extends ChakraSelectProps {
8
8
  }
9
9
 
10
10
  const Select = (props: SelectProps) => {
11
- const { iconName = 'DropdownArrows', size, ...rest } = props;
11
+ const { iconName = 'DropdownArrows', size, placeholder, children, ...rest } = props;
12
12
  const iconSize = size === 'medium' ? '24' : '16';
13
13
  const properties: ChakraSelectProps = {
14
14
  icon: <Icon name={iconName} fontSize={iconSize} size={iconSize} />,
@@ -16,7 +16,16 @@ const Select = (props: SelectProps) => {
16
16
  variant: 'select',
17
17
  ...rest,
18
18
  };
19
- return <ChakraSelect {...properties} />;
19
+ return (
20
+ <ChakraSelect {...properties}>
21
+ {placeholder && (
22
+ <option selected hidden disabled value="">
23
+ {placeholder}
24
+ </option>
25
+ )}
26
+ {children}
27
+ </ChakraSelect>
28
+ );
20
29
  };
21
30
 
22
31
  Select.defaultProps = {
@@ -0,0 +1,7 @@
1
+ const breakpoints = {
2
+ mobile: '0rem',
3
+ desktop: '53rem', // 848px
4
+ wide: '101rem', // 1616px
5
+ };
6
+
7
+ export default breakpoints;
package/src/theme.ts CHANGED
@@ -3,6 +3,7 @@ import Button from './Components/Button/Button.theme';
3
3
  import Card from './Components/Card/Card.theme';
4
4
  import ColorButton from './Components/ColorButton/ColorButton.theme';
5
5
  import Divider from './Components/Divider/Divider.theme';
6
+ import EmptyState from './Components/EmptyState/EmptyState.theme';
6
7
  import Link from './Components/Link/Link.theme';
7
8
  import Menu from './Components/Menu/Menu.theme';
8
9
  import Select from './Components/Select/Select.theme';
@@ -12,6 +13,7 @@ import Notification from './Components/Notification/Notification.theme';
12
13
  import Tooltip from './Components/Tooltip/Tooltip.theme';
13
14
  import CloseButton from './Components/CloseButton/CloseButton.theme';
14
15
 
16
+ import breakpoints from './Foundations/Breakpoints/Breakpoints';
15
17
  import colors from './Foundations/Colors/Colors';
16
18
  import radii from './Foundations/Radii/Radii';
17
19
  import shadows from './Foundations/Shadows/Shadows';
@@ -22,6 +24,7 @@ const theme = {
22
24
  config: {
23
25
  cssVarPrefix: '',
24
26
  },
27
+ breakpoints,
25
28
  colors,
26
29
  ...typography,
27
30
  radii,
@@ -57,6 +60,7 @@ const theme = {
57
60
  Card,
58
61
  ColorButton,
59
62
  Divider,
63
+ EmptyState,
60
64
  Link,
61
65
  Menu,
62
66
  Select,