@bitrise/bitkit 10.33.0-alpha-chakra.2 → 10.33.0-alpha-chakra.4

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": "10.33.0-alpha-chakra.2",
4
+ "version": "10.33.0-alpha-chakra.4",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -1,11 +1,12 @@
1
1
  import { cloneElement, createContext, ReactElement, useContext, useMemo } from 'react';
2
- import { Alert as ChakraAlert, AlertProps, forwardRef, Spinner } from '@chakra-ui/react';
2
+ import { Alert as ChakraAlert, AlertProps, forwardRef } from '@chakra-ui/react';
3
3
 
4
4
  import { ColorScheme } from '../../Foundations/Colors/Colors';
5
5
  import Box from '../Box/Box';
6
6
  import CloseButton from '../CloseButton/CloseButton';
7
7
  import ColorButton, { ColorButtonProps } from '../ColorButton/ColorButton';
8
8
  import Icon, { TypeIconName } from '../Icon/Icon';
9
+ import ProgressSpinner from '../ProgressSpinner/ProgressSpinner';
9
10
 
10
11
  type NotificationStatus = 'info' | 'error' | 'success' | 'warning' | 'progress';
11
12
 
@@ -18,7 +19,7 @@ const STATUSES: Record<NotificationStatus, { colorScheme: ColorScheme; defaultIc
18
19
  colorScheme: 'purple',
19
20
  defaultIcon: (
20
21
  <Box width={24} height={24} padding={2}>
21
- <Spinner width={20} height={20} />
22
+ <ProgressSpinner size={20} />
22
23
  </Box>
23
24
  ),
24
25
  },
@@ -0,0 +1,12 @@
1
+ import ProgressBitbot from './ProgressBitbot';
2
+
3
+ export default {
4
+ component: ProgressBitbot,
5
+ };
6
+
7
+ export const WithProps = {
8
+ args: {
9
+ content: 'Loading...',
10
+ size: 64,
11
+ },
12
+ };
@@ -1,8 +1,8 @@
1
- import * as React from 'react';
2
- import { Props as BaseProps } from '../Base/Base';
3
- import Text from '../../Components/Text/Text';
1
+ import { forwardRef } from '@chakra-ui/react';
2
+ import Box, { BoxProps } from '../Box/Box';
3
+ import Text from '../Text/Text';
4
4
 
5
- export interface Props extends BaseProps {
5
+ export interface ProgressBitbotProps extends BoxProps {
6
6
  /**
7
7
  * Message that appears underneath Bitbot to help
8
8
  * indicate what is progressing.
@@ -11,7 +11,7 @@ export interface Props extends BaseProps {
11
11
  /**
12
12
  * The size of the Bitbot progress indicator.
13
13
  */
14
- size?: string;
14
+ size?: BoxProps['width'];
15
15
  }
16
16
 
17
17
  const alternate = (a: string, b: string, length: number) =>
@@ -58,12 +58,12 @@ const mouth = alternate(mouth0, mouth1, 7);
58
58
  /**
59
59
  * A playful indeterminate progress indicator.
60
60
  */
61
- const ProgressBitbot: React.FunctionComponent<Props> = (props: Props) => {
62
- const { content, size, ...rest } = props;
61
+ const ProgressBitbot = forwardRef<ProgressBitbotProps, 'div'>((props, ref) => {
62
+ const { content, size = '64', ...rest } = props;
63
63
 
64
64
  return (
65
- <Text {...rest} textAlign="center">
66
- <svg fill="currentColor" height={size} viewBox="0 0 24 24" width={size}>
65
+ <Box {...rest} ref={ref}>
66
+ <Box as="svg" fill="currentColor" height={size} viewBox="0 0 24 24" width={size} marginX="auto">
67
67
  <g fill="currentColor" fillRule="evenodd" stroke="none" strokeWidth="1">
68
68
  <path d={dot0}>
69
69
  <animate
@@ -156,19 +156,15 @@ const ProgressBitbot: React.FunctionComponent<Props> = (props: Props) => {
156
156
  />
157
157
  </path>
158
158
  </g>
159
- </svg>
159
+ </Box>
160
160
 
161
161
  {content && (
162
162
  <Text textAlign="center" size="1" textTransform="uppercase">
163
163
  {content}
164
164
  </Text>
165
165
  )}
166
- </Text>
166
+ </Box>
167
167
  );
168
- };
169
-
170
- ProgressBitbot.defaultProps = {
171
- size: '64px',
172
- };
168
+ });
173
169
 
174
170
  export default ProgressBitbot;
@@ -0,0 +1,12 @@
1
+ import ProgressSpinner from './ProgressSpinner';
2
+
3
+ export default {
4
+ component: ProgressSpinner,
5
+ };
6
+
7
+ export const WithProps = {
8
+ args: {
9
+ color: 'purple.40',
10
+ size: 24,
11
+ },
12
+ };
@@ -0,0 +1,15 @@
1
+ import { Spinner as ChakraSpinner, SpinnerProps, forwardRef } from '@chakra-ui/react';
2
+
3
+ export interface ProgressSpinnerProps extends Omit<SpinnerProps, 'size'> {
4
+ size?: SpinnerProps['width'];
5
+ }
6
+
7
+ /**
8
+ * Progresspinner
9
+ */
10
+ const Progresspinner = forwardRef<ProgressSpinnerProps, 'div'>((props, ref) => {
11
+ const { size = '24', ...rest } = props;
12
+ return <ChakraSpinner width={size} height={size} {...rest} ref={ref} />;
13
+ });
14
+
15
+ export default Progresspinner;
@@ -8,9 +8,9 @@ import {
8
8
  forwardRef,
9
9
  Select as ChakraSelect,
10
10
  SelectProps as ChakraSelectProps,
11
- Spinner,
12
11
  } from '@chakra-ui/react';
13
12
  import Icon from '../Icon/Icon';
13
+ import ProgressSpinner from '../ProgressSpinner/ProgressSpinner';
14
14
 
15
15
  export interface SelectProps extends Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'> {
16
16
  'data-testid'?: string;
@@ -52,7 +52,7 @@ const Select = forwardRef<SelectProps, 'div'>((props, ref) => {
52
52
  };
53
53
  const selectProperties: ChakraSelectProps = {
54
54
  icon: isLoading ? (
55
- <Spinner width={iconSize} height={iconSize} marginEnd="4" />
55
+ <ProgressSpinner size={iconSize} marginEnd="4" />
56
56
  ) : (
57
57
  <Icon name="DropdownArrows" fontSize={iconSize} size={iconSize} />
58
58
  ),
@@ -5,13 +5,13 @@ import {
5
5
  FormErrorMessage,
6
6
  FormHelperText,
7
7
  FormLabel,
8
- Spinner,
9
8
  Switch,
10
9
  SwitchProps,
11
10
  forwardRef,
12
11
  useMultiStyleConfig,
13
12
  } from '@chakra-ui/react';
14
13
  import Box from '../Box/Box';
14
+ import ProgressSpinner from '../ProgressSpinner/ProgressSpinner';
15
15
 
16
16
  export interface ToggleProps extends Omit<FormControlProps, 'label' | 'onBlur' | 'onChange'> {
17
17
  'data-testid'?: string;
@@ -77,7 +77,7 @@ const Toggle = forwardRef<ToggleProps, 'div'>((props, ref) => {
77
77
  {label}
78
78
  </FormLabel>
79
79
  )}
80
- {isLoading && <Spinner sx={css.spinner} />}
80
+ {isLoading && <ProgressSpinner sx={css.spinner} />}
81
81
  </Box>
82
82
  {errorText && <FormErrorMessage as="p">{errorText}</FormErrorMessage>}
83
83
  {helperText && <FormHelperText as="p">{helperText}</FormHelperText>}
package/src/index.ts CHANGED
@@ -216,3 +216,9 @@ export { default as SkeletonBox } from './Components/Skeleton/SkeletonBox';
216
216
 
217
217
  export type { ProgressBarProps } from './Components/ProgressBar/ProgressBar';
218
218
  export { default as ProgressBar } from './Components/ProgressBar/ProgressBar';
219
+
220
+ export type { ProgressBitbotProps } from './Components/ProgressBitbot/ProgressBitbot';
221
+ export { default as ProgressBitbot } from './Components/ProgressBitbot/ProgressBitbot';
222
+
223
+ export type { ProgressSpinnerProps } from './Components/ProgressSpinner/ProgressSpinner';
224
+ export { default as ProgressSpinner } from './Components/ProgressSpinner/ProgressSpinner';
package/src/old.ts CHANGED
@@ -17,9 +17,3 @@ export { default as DatePicker } from './Old/DatePicker/DatePicker';
17
17
 
18
18
  export type { Props as FlexProps } from './Old/Flex/Flex';
19
19
  export { default as Flex } from './Old/Flex/Flex';
20
-
21
- export type { Props as ProgressBitbotProps } from './Old/Progress/ProgressBitbot';
22
- export { default as ProgressBitbot } from './Old/Progress/ProgressBitbot';
23
-
24
- export type { Props as ProgressSpinnerProps } from './Old/Progress/ProgressSpinner';
25
- export { default as ProgressSpinner } from './Old/Progress/ProgressSpinner';