@bitrise/bitkit 9.12.0-alpha-button-release.2 → 9.12.0-alpha-button-release.3

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.12.0-alpha-button-release.2",
4
+ "version": "9.12.0-alpha-button-release.3",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -6,7 +6,7 @@ export default {
6
6
  component: Box,
7
7
  } as ComponentMeta<typeof Box>;
8
8
 
9
- const Template: ComponentStory<typeof Box> = ({ ...props }) => <Box {...props} />;
9
+ const Template: ComponentStory<typeof Box> = (props) => <Box {...props} />;
10
10
 
11
11
  export const WithProps = Template.bind({});
12
12
  WithProps.args = {
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { forwardRef } from 'react';
2
2
  import { Box as ChakraBox, BoxProps } from '@chakra-ui/react';
3
3
 
4
4
  /**
@@ -6,9 +6,9 @@ import { Box as ChakraBox, BoxProps } from '@chakra-ui/react';
6
6
  *
7
7
  * And this is our CSS-in-JS component, you can use this with style props.
8
8
  */
9
- const Box = (props: BoxProps) => {
10
- return <ChakraBox {...props} />;
11
- };
9
+ const Box = forwardRef<HTMLDivElement, BoxProps>((props, ref) => {
10
+ return <ChakraBox {...props} ref={ref} />;
11
+ });
12
12
 
13
13
  export { BoxProps } from '@chakra-ui/react';
14
14
 
@@ -1,4 +1,4 @@
1
- import React, { HTMLAttributeAnchorTarget } from 'react';
1
+ import React, { HTMLAttributeAnchorTarget, forwardRef } from 'react';
2
2
  import { Button as ChakraButton, ButtonProps as ChackraButtonProps } from '@chakra-ui/react';
3
3
  import Icon from '../../Old/Icon/Icon';
4
4
  import { TypeIconName } from '../../Old/Icon/tsx';
@@ -17,7 +17,7 @@ export interface ButtonProps extends ChackraButtonProps {
17
17
  /**
18
18
  * The Button component is used to trigger an action or event, such as submitting a form, opening a dialog, canceling an action, or performing a delete operation.
19
19
  */
20
- const Button = (props: ButtonProps) => {
20
+ const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
21
21
  const { as, isDanger, leftIconName, rightIconName, size, variant, ...rest } = props;
22
22
  const properties: ChackraButtonProps = {
23
23
  as,
@@ -35,8 +35,8 @@ const Button = (props: ButtonProps) => {
35
35
  properties.iconSpacing = size === 'medium' ? '0.625rem' : '0.375rem';
36
36
  }
37
37
 
38
- return <ChakraButton {...properties} />;
39
- };
38
+ return <ChakraButton {...properties} ref={ref} />;
39
+ });
40
40
 
41
41
  Button.defaultProps = {
42
42
  as: 'button',
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { forwardRef } from 'react';
2
2
  import { Radii } from '../../Foundations/Radii/Radii';
3
3
  import { Shadows } from '../../Foundations/Shadows/Shadows';
4
4
  import { Sizes } from '../../Foundations/Sizes/Sizes';
@@ -13,9 +13,9 @@ export interface CardProps extends BoxProps {
13
13
  /**
14
14
  * Basic container element with default box shadow, border radius and padding.
15
15
  */
16
- const Card = (props: CardProps) => {
17
- return <Box {...props} />;
18
- };
16
+ const Card = forwardRef<HTMLDivElement, CardProps>((props, ref) => {
17
+ return <Box {...props} ref={ref} />;
18
+ });
19
19
 
20
20
  Card.defaultProps = {
21
21
  borderRadius: '12',
@@ -7,7 +7,7 @@ export default {
7
7
  component: IconButton,
8
8
  } as ComponentMeta<typeof IconButton>;
9
9
 
10
- const Template: ComponentStory<typeof IconButton> = ({ ...props }) => <IconButton {...props} />;
10
+ const Template: ComponentStory<typeof IconButton> = (props) => <IconButton {...props} />;
11
11
 
12
12
  export const WithProps = Template.bind({});
13
13
  WithProps.args = sortObjectByKey({
@@ -19,14 +19,14 @@ export interface Props extends IconButtonProps {
19
19
  * TODO:
20
20
  * - Change to Chakra powered Icon component
21
21
  */
22
- const IconButton = forwardRef<HTMLButtonElement, Props>((props: Props, ref) => {
22
+ const IconButton = forwardRef<HTMLButtonElement, Props>((props, ref) => {
23
23
  const { iconName, isDanger, variant, ...rest } = props;
24
24
  const properties: IconButtonProps = {
25
25
  icon: <Icon name={iconName} />,
26
26
  variant: isDanger ? `${variant}--danger` : variant,
27
27
  ...rest,
28
28
  };
29
- return <ChakraIconButton ref={ref} {...properties} />;
29
+ return <ChakraIconButton {...properties} ref={ref} />;
30
30
  });
31
31
 
32
32
  IconButton.defaultProps = {
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { forwardRef } from 'react';
2
2
  import { Link as ChakraLink, LinkProps as ChakraLinkProps } from '@chakra-ui/react';
3
3
  import { TextSizes } from '../../Foundations/Typography/Typography';
4
4
 
@@ -12,7 +12,7 @@ export interface LinkProps extends ChakraLinkProps {
12
12
  /**
13
13
  * Links are accessible elements used primarily for navigation.
14
14
  */
15
- const Link = (props: LinkProps) => {
15
+ const Link = forwardRef<HTMLAnchorElement, LinkProps>((props, ref) => {
16
16
  const { as, isUnderlined, ...rest } = props;
17
17
  const properties: ChakraLinkProps = { as, ...rest };
18
18
  if (isUnderlined) {
@@ -21,8 +21,8 @@ const Link = (props: LinkProps) => {
21
21
  if (as === 'button') {
22
22
  properties.type = 'button';
23
23
  }
24
- return <ChakraLink {...properties} />;
25
- };
24
+ return <ChakraLink {...properties} ref={ref} />;
25
+ });
26
26
 
27
27
  Link.defaultProps = {
28
28
  as: 'a',
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { forwardRef } from 'react';
2
2
  import { Text as ChakraText, TextProps as ChakraTextProps } from '@chakra-ui/react';
3
3
  import { TextSizes } from '../../Foundations/Typography/Typography';
4
4
 
@@ -58,7 +58,7 @@ export interface TextProps extends ChakraTextProps {
58
58
  /**
59
59
  * `Text` component is the used to render text and paragraphs within an interface. It renders a `<p>` tag by default.
60
60
  */
61
- const Text = (props: TextProps) => {
61
+ const Text = forwardRef<HTMLParagraphElement, TextProps>((props, ref) => {
62
62
  const { color, fontWeight, size, textTransform } = props;
63
63
  const properties: ChakraTextProps = { ...props };
64
64
  if (size === '1' && (!textTransform || textTransform === 'none')) {
@@ -70,8 +70,8 @@ const Text = (props: TextProps) => {
70
70
  if (color) {
71
71
  properties.color = `text.${color}`;
72
72
  }
73
- return <ChakraText {...properties} />;
74
- };
73
+ return <ChakraText {...properties} ref={ref} />;
74
+ });
75
75
 
76
76
  Text.defaultProps = {
77
77
  as: 'p',