@bitrise/bitkit 10.31.1 → 10.32.0-alpha-chakra.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": "10.31.1",
4
+ "version": "10.32.0-alpha-chakra.1",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -3,9 +3,6 @@ import type { ComponentStyleConfig } from '@chakra-ui/theme';
3
3
  const FormTheme = {
4
4
  Form: {
5
5
  baseStyle: {
6
- container: {
7
- zIndex: 0,
8
- },
9
6
  helperText: {
10
7
  fontSize: '2',
11
8
  lineHeight: '2',
@@ -12,6 +12,7 @@ import {
12
12
  InputLeftElement,
13
13
  InputRightAddon,
14
14
  InputRightElement,
15
+ SystemStyleObject,
15
16
  } from '@chakra-ui/react';
16
17
  import Icon, { TypeIconName } from '../../Icon/Icon';
17
18
 
@@ -105,11 +106,16 @@ const Input = forwardRef<InputProps, 'div'>((props, ref) => {
105
106
  value,
106
107
  };
107
108
 
108
- const InputWrapper = leftIconName || rightAddon || rightIconName ? InputGroup : Fragment;
109
+ let InputWrapper: any = Fragment;
110
+ const inputWrapperProps: SystemStyleObject = {};
111
+ if (leftIconName || rightAddon || rightIconName) {
112
+ InputWrapper = InputGroup;
113
+ inputWrapperProps.zIndex = 0;
114
+ }
109
115
  return (
110
116
  <FormControl {...formControlProps}>
111
117
  {label && <FormLabel>{label}</FormLabel>}
112
- <InputWrapper>
118
+ <InputWrapper {...inputWrapperProps}>
113
119
  {leftIconName && (
114
120
  <InputLeftElement margin="12px" pointerEvents="none">
115
121
  <Icon name={leftIconName} />
@@ -0,0 +1,18 @@
1
+ import Skeleton, { SkeletonProps } from './Skeleton';
2
+ import SkeletonBox from './SkeletonBox';
3
+
4
+ export default {
5
+ component: Skeleton,
6
+ subComponents: [SkeletonBox],
7
+ };
8
+
9
+ export const WithProps = {
10
+ args: {
11
+ isActive: false,
12
+ },
13
+ render: (args: SkeletonProps) => (
14
+ <Skeleton display="flex" flexDirection="column" gap="8" padding="8" {...args}>
15
+ <SkeletonBox height="32" /> <SkeletonBox height="32" /> <SkeletonBox height="32" />
16
+ </Skeleton>
17
+ ),
18
+ };
@@ -0,0 +1,34 @@
1
+ import { keyframes } from '@chakra-ui/react';
2
+ import { defineStyle, defineStyleConfig } from '@chakra-ui/styled-system';
3
+
4
+ const animation = keyframes`
5
+ from { transform: translate3d(-100%, 0, 0); }
6
+ to { transform: translate3d(100%, 0, 0); }
7
+ `;
8
+
9
+ const afterStyle = {
10
+ content: '""',
11
+ position: 'absolute',
12
+ top: 0,
13
+ right: 0,
14
+ bottom: 0,
15
+ left: 0,
16
+ pointerEvents: 'none',
17
+ bgGradient:
18
+ 'linear(to-l, rgba(255,255, 255, 0), rgba(255,255, 255, 0.63) 35%, rgba(255,255, 255, 1) 48%, rgba(255,255, 255, 0.57) 55%, rgba(255,255, 255, 0))',
19
+ animation: `${animation} infinite 1.5s linear`,
20
+ };
21
+
22
+ const baseStyle = defineStyle(({ isActive }) => {
23
+ return {
24
+ position: 'relative',
25
+ overflow: 'hidden',
26
+ _after: isActive ? afterStyle : {},
27
+ };
28
+ });
29
+
30
+ const SkeletonTheme = defineStyleConfig({
31
+ baseStyle,
32
+ });
33
+
34
+ export default SkeletonTheme;
@@ -0,0 +1,18 @@
1
+ import { Box, BoxProps, forwardRef, useStyleConfig } from '@chakra-ui/react';
2
+
3
+ export interface SkeletonProps extends BoxProps {
4
+ isActive?: boolean;
5
+ }
6
+
7
+ /**
8
+ * Skeleton is used to display the loading state of some component.
9
+ *
10
+ * We don't extend Chakra's Skeleton
11
+ */
12
+ const Skeleton = forwardRef<SkeletonProps, 'div'>((props, ref) => {
13
+ const { isActive, ...rest } = props;
14
+ const css = useStyleConfig('Skeleton', { isActive });
15
+ return <Box __css={css} {...rest} ref={ref} />;
16
+ });
17
+
18
+ export default Skeleton;
@@ -0,0 +1,12 @@
1
+ import { Box, BoxProps, forwardRef } from '@chakra-ui/react';
2
+
3
+ export type { BoxProps as SkeletonBoxProps };
4
+
5
+ /**
6
+ * SkeletonBox is just a Box with default background color.
7
+ */
8
+ const SkeletonBox = forwardRef<BoxProps, 'div'>((props, ref) => {
9
+ return <Box backgroundColor="neutral.93" {...props} ref={ref} />;
10
+ });
11
+
12
+ export default SkeletonBox;
package/src/index.ts CHANGED
@@ -207,3 +207,9 @@ export { default as Fade } from './Components/Fade/Fade';
207
207
 
208
208
  export type { InputProps } from './Components/Form/Input/Input';
209
209
  export { default as Input } from './Components/Form/Input/Input';
210
+
211
+ export type { SkeletonProps } from './Components/Skeleton/Skeleton';
212
+ export { default as Skeleton } from './Components/Skeleton/Skeleton';
213
+
214
+ export type { SkeletonBoxProps } from './Components/Skeleton/SkeletonBox';
215
+ export { default as SkeletonBox } from './Components/Skeleton/SkeletonBox';
package/src/old.ts CHANGED
@@ -26,9 +26,3 @@ export { default as ProgressBitbot } from './Old/Progress/ProgressBitbot';
26
26
 
27
27
  export type { Props as ProgressSpinnerProps } from './Old/Progress/ProgressSpinner';
28
28
  export { default as ProgressSpinner } from './Old/Progress/ProgressSpinner';
29
-
30
- export type { Props as SkeletonProps } from './Old/Skeleton/Skeleton';
31
- export { default as Skeleton } from './Old/Skeleton/Skeleton';
32
-
33
- export type { Props as SkeletonBoxProps } from './Old/Skeleton/SkeletonBox';
34
- export { default as SkeletonBox } from './Old/Skeleton/SkeletonBox';
package/src/theme.ts CHANGED
@@ -26,6 +26,7 @@ import Popover from './Components/Popover/Popover.theme';
26
26
  import Toggle from './Components/Toggle/Toggle.theme';
27
27
  import Textarea from './Components/Form/Textarea/Textarea.theme';
28
28
  import Form from './Components/Form/Form.theme';
29
+ import Skeleton from './Components/Skeleton/Skeleton.theme';
29
30
 
30
31
  import breakpoints from './Foundations/Breakpoints/Breakpoints';
31
32
  import colors from './Foundations/Colors/Colors';
@@ -99,6 +100,7 @@ const theme = {
99
100
  Popover,
100
101
  Switch: Toggle,
101
102
  Textarea,
103
+ Skeleton,
102
104
  },
103
105
  };
104
106