@bitrise/bitkit 9.20.0-alpha-chakra.1 → 9.20.0
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 +8 -8
- package/src/Components/Button/Button.stories.tsx +0 -1
- package/src/Components/Button/Button.tsx +4 -14
- package/src/Components/IconButton/IconButton.stories.tsx +26 -0
- package/src/Components/IconButton/IconButton.tsx +37 -0
- package/src/Components/Icons/16x16/BuildstatusLoadingAnimated.tsx +2 -2
- package/src/Components/Icons/24x24/BuildstatusLoadingAnimated.tsx +2 -2
- package/src/Components/Menu/Menu.stories.tsx +3 -6
- package/src/Components/OverflowMenu/OverflowMenu.tsx +2 -4
- package/src/Old/Icon/tsx/IconsBuildstatusLoadingAnimated.tsx +2 -2
- package/src/index.ts +3 -0
- package/src/tsconfig.tsbuildinfo +1 -1
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.20.0
|
|
4
|
+
"version": "9.20.0",
|
|
5
5
|
"repository": "git@github.com:bitrise-io/bitkit.git",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"license": "UNLICENSED",
|
|
@@ -12,17 +12,18 @@
|
|
|
12
12
|
"build:lib": "rm -rf ./lib && yarn build:lib:cjs && yarn build:lib:esn",
|
|
13
13
|
"build:lib:esn": "tsc -p src -m esnext -t esnext --outDir lib/esn",
|
|
14
14
|
"build:lib:cjs": "tsc -p src --outDir lib/cjs",
|
|
15
|
-
"build:
|
|
15
|
+
"build:prepare": "rm -rf ./dist && mkdir dist && cp site/index.html dist && ln -s index.html dist/404.html",
|
|
16
|
+
"build:site": "yarn build:prepare && yarn build:docs && yarn tsc:site && yarn build:site:esbuild",
|
|
17
|
+
"tsc:site": "tsc --noEmit -p site/tsconfig.json",
|
|
18
|
+
"build:site:esbuild": "esbuild --bundle site/index.tsx --outdir=dist --target=esnext --loader:.woff2=file --loader:.woff=file --minify --sourcemap",
|
|
16
19
|
"commitlint": "commitlint",
|
|
17
20
|
"lint": "yarn lint:js",
|
|
18
21
|
"lint:js": "eslint src/**/*.tsx",
|
|
19
|
-
"lint:fix-icons": "eslint --fix src/Old/Icon/tsx/**",
|
|
20
22
|
"semantic-release": "semantic-release",
|
|
21
23
|
"serve": "superstatic ./dist --port 4001 -c superstatic.json",
|
|
22
|
-
"start": "
|
|
24
|
+
"start": "yarn build:prepare && concurrently \"yarn start:docs\" \"yarn start:esbuild\" \"yarn serve\"",
|
|
25
|
+
"start:esbuild": "esbuild --bundle site/index.tsx --watch --outdir=dist --target=esnext --loader:.woff2=file --loader:.woff=file",
|
|
23
26
|
"start:docs": "ts-node ./scripts/build-docs-watch",
|
|
24
|
-
"start:site": "parcel serve site/index.html --port 4001 -d dist --no-cache",
|
|
25
|
-
"start:icons": "chokidar src/Old/Icon/svg/** -c \"yarn svgr {path} && yarn lint:fix-icons\"",
|
|
26
27
|
"test": "jest ./src",
|
|
27
28
|
"storybook": "start-storybook -p 6006",
|
|
28
29
|
"build-storybook": "build-storybook"
|
|
@@ -97,10 +98,10 @@
|
|
|
97
98
|
"babel-eslint": "^10.0.1",
|
|
98
99
|
"babel-loader": "^8.2.5",
|
|
99
100
|
"babel-plugin-polyfill-corejs2": "^0.3.1",
|
|
100
|
-
"chokidar-cli": "^3.0.0",
|
|
101
101
|
"concurrently": "^7.2.1",
|
|
102
102
|
"enzyme": "^3.11.0",
|
|
103
103
|
"enzyme-to-json": "^3.6.2",
|
|
104
|
+
"esbuild": "^0.14.43",
|
|
104
105
|
"eslint": "^8.16.0",
|
|
105
106
|
"eslint-plugin-import": "^2.26.0",
|
|
106
107
|
"eslint-plugin-jest": "^26.4.5",
|
|
@@ -119,7 +120,6 @@
|
|
|
119
120
|
"lodash.sample": "^4.2.1",
|
|
120
121
|
"lodash.shuffle": "^4.2.0",
|
|
121
122
|
"node-watch": "^0.7.3",
|
|
122
|
-
"parcel-bundler": "^1.12.0",
|
|
123
123
|
"prettier": "^2.6.2",
|
|
124
124
|
"prismjs": "^1.28.0",
|
|
125
125
|
"react": "^17.0.2",
|
|
@@ -4,9 +4,7 @@ import Icon, { TypeIconName } from '../Icon/Icon';
|
|
|
4
4
|
|
|
5
5
|
export interface ButtonProps extends ChakraButtonProps {
|
|
6
6
|
as?: 'a' | 'button';
|
|
7
|
-
children: string;
|
|
8
7
|
isDanger?: boolean;
|
|
9
|
-
isIconOnly?: boolean;
|
|
10
8
|
leftIconName?: TypeIconName;
|
|
11
9
|
rightIconName?: TypeIconName;
|
|
12
10
|
size?: 'small' | 'medium';
|
|
@@ -17,7 +15,7 @@ export interface ButtonProps extends ChakraButtonProps {
|
|
|
17
15
|
* 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.
|
|
18
16
|
*/
|
|
19
17
|
const Button = forwardRef<ButtonProps, 'button'>((props, ref) => {
|
|
20
|
-
const { as,
|
|
18
|
+
const { as, isDanger, isDisabled, leftIconName, rightIconName, size = 'medium', variant, ...rest } = props;
|
|
21
19
|
const properties: ChakraButtonProps = {
|
|
22
20
|
as: isDisabled ? 'button' : as,
|
|
23
21
|
isDisabled,
|
|
@@ -25,24 +23,16 @@ const Button = forwardRef<ButtonProps, 'button'>((props, ref) => {
|
|
|
25
23
|
variant: isDanger ? `${variant}--danger` : variant,
|
|
26
24
|
...rest,
|
|
27
25
|
};
|
|
26
|
+
const iconSize = size === 'medium' ? '24' : '16';
|
|
28
27
|
if (leftIconName) {
|
|
29
|
-
properties.leftIcon = <Icon name={leftIconName} />;
|
|
28
|
+
properties.leftIcon = <Icon name={leftIconName} size={iconSize} />;
|
|
30
29
|
}
|
|
31
30
|
if (rightIconName) {
|
|
32
|
-
properties.rightIcon = <Icon name={rightIconName} />;
|
|
31
|
+
properties.rightIcon = <Icon name={rightIconName} size={iconSize} />;
|
|
33
32
|
}
|
|
34
33
|
if ((properties.leftIcon || properties.rightIcon) && !properties.iconSpacing) {
|
|
35
34
|
properties.iconSpacing = size === 'medium' ? '0.625rem' : '0.375rem';
|
|
36
35
|
}
|
|
37
|
-
if (isIconOnly) {
|
|
38
|
-
properties['aria-label'] = children;
|
|
39
|
-
properties.iconSpacing = 0;
|
|
40
|
-
properties.padding = 0;
|
|
41
|
-
// TODO: Use Tooltip later for this:
|
|
42
|
-
properties.title = children;
|
|
43
|
-
} else {
|
|
44
|
-
properties.children = children;
|
|
45
|
-
}
|
|
46
36
|
|
|
47
37
|
return <ChakraButton {...properties} ref={ref} />;
|
|
48
38
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
|
+
import { sortObjectByKey } from '../../utils/storyUtils';
|
|
3
|
+
import IconButton from './IconButton';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/IconButton',
|
|
7
|
+
component: IconButton,
|
|
8
|
+
argTypes: {
|
|
9
|
+
as: {
|
|
10
|
+
control: 'inline-radio',
|
|
11
|
+
options: ['a', 'button'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
} as ComponentMeta<typeof IconButton>;
|
|
15
|
+
|
|
16
|
+
const Template: ComponentStory<typeof IconButton> = (props) => <IconButton {...props} />;
|
|
17
|
+
|
|
18
|
+
export const WithProps = Template.bind({});
|
|
19
|
+
WithProps.args = sortObjectByKey({
|
|
20
|
+
...IconButton.defaultProps,
|
|
21
|
+
'aria-label': 'This is the label',
|
|
22
|
+
iconName: 'Bitbot',
|
|
23
|
+
isDanger: false,
|
|
24
|
+
isDisabled: false,
|
|
25
|
+
isLoading: false,
|
|
26
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconButton as ChakraIconButton, IconButtonProps as ChakraIconButtonProps, forwardRef } from '@chakra-ui/react';
|
|
3
|
+
import Icon, { TypeIconName } from '../Icon/Icon';
|
|
4
|
+
|
|
5
|
+
export interface IconButtonProps extends ChakraIconButtonProps {
|
|
6
|
+
as?: 'a' | 'button';
|
|
7
|
+
iconName: TypeIconName;
|
|
8
|
+
isDanger?: boolean;
|
|
9
|
+
label?: string;
|
|
10
|
+
size?: 'small' | 'medium';
|
|
11
|
+
variant?: 'primary' | 'secondary' | 'tertiary';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* IconButton composes the `Button` component except that it renders only an icon.
|
|
16
|
+
*/
|
|
17
|
+
const IconButton = forwardRef<IconButtonProps, 'button'>((props, ref) => {
|
|
18
|
+
const { as, iconName, isDanger, isDisabled, label, variant, ...rest } = props;
|
|
19
|
+
const properties: ChakraIconButtonProps = {
|
|
20
|
+
as: isDisabled ? 'button' : as,
|
|
21
|
+
icon: <Icon name={iconName} />,
|
|
22
|
+
isDisabled,
|
|
23
|
+
// TODO: Use Tooltip
|
|
24
|
+
title: label || rest['aria-label'],
|
|
25
|
+
variant: isDanger ? `${variant}--danger` : variant,
|
|
26
|
+
...rest,
|
|
27
|
+
};
|
|
28
|
+
return <ChakraIconButton {...properties} ref={ref} />;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
IconButton.defaultProps = {
|
|
32
|
+
as: 'button',
|
|
33
|
+
size: 'medium',
|
|
34
|
+
variant: 'primary',
|
|
35
|
+
} as IconButtonProps;
|
|
36
|
+
|
|
37
|
+
export default IconButton;
|
|
@@ -4,7 +4,7 @@ import { Icon, IconProps, forwardRef } from '@chakra-ui/react';
|
|
|
4
4
|
const BuildstatusLoadingAnimated = forwardRef<IconProps, 'svg'>((props, ref) => (
|
|
5
5
|
<Icon ref={ref} viewBox="0 0 16 16" {...props}>
|
|
6
6
|
<circle cx={8} cy={8} r={7} stroke="currentColor" strokeWidth={1.1} strokeDasharray={48} fill="none">
|
|
7
|
-
<animate attributeName="stroke-dashoffset" from={
|
|
7
|
+
<animate attributeName="stroke-dashoffset" from={96} to={0} dur="3.5s" repeatCount="indefinite" />
|
|
8
8
|
<animateTransform
|
|
9
9
|
attributeName="transform"
|
|
10
10
|
type="rotate"
|
|
@@ -15,7 +15,7 @@ const BuildstatusLoadingAnimated = forwardRef<IconProps, 'svg'>((props, ref) =>
|
|
|
15
15
|
/>
|
|
16
16
|
</circle>
|
|
17
17
|
<circle cx={8} cy={8} r={4} stroke="currentColor" strokeWidth={1.1} strokeDasharray={48} fill="none">
|
|
18
|
-
<animate attributeName="stroke-dashoffset" from={
|
|
18
|
+
<animate attributeName="stroke-dashoffset" from={96} to={0} dur="3.5s" repeatCount="indefinite" />
|
|
19
19
|
<animateTransform
|
|
20
20
|
attributeName="transform"
|
|
21
21
|
type="rotate"
|
|
@@ -4,7 +4,7 @@ import { Icon, IconProps, forwardRef } from '@chakra-ui/react';
|
|
|
4
4
|
const BuildstatusLoadingAnimated = forwardRef<IconProps, 'svg'>((props, ref) => (
|
|
5
5
|
<Icon ref={ref} viewBox="0 0 24 24" {...props}>
|
|
6
6
|
<circle cx={12} cy={12} r={11} stroke="currentColor" strokeWidth={2} strokeDasharray={48} fill="none">
|
|
7
|
-
<animate attributeName="stroke-dashoffset" from={
|
|
7
|
+
<animate attributeName="stroke-dashoffset" from={96} to={0} dur="3.5s" repeatCount="indefinite" />
|
|
8
8
|
<animateTransform
|
|
9
9
|
attributeName="transform"
|
|
10
10
|
type="rotate"
|
|
@@ -15,7 +15,7 @@ const BuildstatusLoadingAnimated = forwardRef<IconProps, 'svg'>((props, ref) =>
|
|
|
15
15
|
/>
|
|
16
16
|
</circle>
|
|
17
17
|
<circle cx={12} cy={12} r={6} stroke="currentColor" strokeWidth={2} strokeDasharray={48} fill="none">
|
|
18
|
-
<animate attributeName="stroke-dashoffset" from={
|
|
18
|
+
<animate attributeName="stroke-dashoffset" from={96} to={0} dur="3.5s" repeatCount="indefinite" />
|
|
19
19
|
<animateTransform
|
|
20
20
|
attributeName="transform"
|
|
21
21
|
type="rotate"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
2
|
import { Box, ButtonGroup, HStack, MenuButton, MenuList, useMenuItem, useStyleConfig } from '@chakra-ui/react';
|
|
3
3
|
import Button from '../Button/Button';
|
|
4
|
+
import IconButton from '../IconButton/IconButton';
|
|
4
5
|
import Menu from './Menu';
|
|
5
6
|
import MenuItem from './MenuItem';
|
|
6
7
|
|
|
@@ -29,9 +30,7 @@ export const WithButton: ComponentStory<typeof Menu> = () => (
|
|
|
29
30
|
|
|
30
31
|
export const WithIconButton: ComponentStory<typeof Menu> = () => (
|
|
31
32
|
<Menu>
|
|
32
|
-
<MenuButton as={
|
|
33
|
-
Open menu
|
|
34
|
-
</MenuButton>
|
|
33
|
+
<MenuButton as={IconButton} iconName="AddOnsColorTuorqouise" aria-label="Open menu" />
|
|
35
34
|
<List />
|
|
36
35
|
</Menu>
|
|
37
36
|
);
|
|
@@ -41,9 +40,7 @@ export const WithButtonGroup: ComponentStory<typeof Menu> = () => (
|
|
|
41
40
|
<ButtonGroup isAttached>
|
|
42
41
|
<Button>Button</Button>
|
|
43
42
|
<Menu>
|
|
44
|
-
<MenuButton as={
|
|
45
|
-
Open menu
|
|
46
|
-
</MenuButton>
|
|
43
|
+
<MenuButton as={IconButton} iconName="AddOnsColorTuorqouise" aria-label="Open menu" />
|
|
47
44
|
<List />
|
|
48
45
|
</Menu>
|
|
49
46
|
</ButtonGroup>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MenuButton, MenuList, MenuListProps } from '@chakra-ui/react';
|
|
3
|
-
import
|
|
3
|
+
import IconButton from '../IconButton/IconButton';
|
|
4
4
|
import Menu from '../Menu/Menu';
|
|
5
5
|
|
|
6
6
|
export interface OverflowMenuProps {
|
|
@@ -11,9 +11,7 @@ export interface OverflowMenuProps {
|
|
|
11
11
|
const OverflowMenu = ({ children, triggerLabel }: OverflowMenuProps) => {
|
|
12
12
|
return (
|
|
13
13
|
<Menu isLazy>
|
|
14
|
-
<MenuButton as={
|
|
15
|
-
{triggerLabel}
|
|
16
|
-
</MenuButton>
|
|
14
|
+
<MenuButton aria-label={triggerLabel} as={IconButton} iconName="MoreVertical" size="small" variant="tertiary" />
|
|
17
15
|
<MenuList>{children}</MenuList>
|
|
18
16
|
</Menu>
|
|
19
17
|
);
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
const SvgIconsBuildstatusLoadingAnimated = (props: React.SVGProps<SVGSVGElement>) => (
|
|
5
5
|
<svg {...props} fill="none" viewBox="0 0 24 24">
|
|
6
6
|
<circle cx={12} cy={12} r={11} stroke="currentColor" strokeWidth={2} strokeDasharray={48}>
|
|
7
|
-
<animate attributeName="stroke-dashoffset" from={
|
|
7
|
+
<animate attributeName="stroke-dashoffset" from={96} to={0} dur="3.5s" repeatCount="indefinite" />
|
|
8
8
|
<animateTransform
|
|
9
9
|
attributeName="transform"
|
|
10
10
|
type="rotate"
|
|
@@ -15,7 +15,7 @@ const SvgIconsBuildstatusLoadingAnimated = (props: React.SVGProps<SVGSVGElement>
|
|
|
15
15
|
/>
|
|
16
16
|
</circle>
|
|
17
17
|
<circle cx={12} cy={12} r={6} stroke="currentColor" strokeWidth={2} strokeDasharray={48}>
|
|
18
|
-
<animate attributeName="stroke-dashoffset" from={
|
|
18
|
+
<animate attributeName="stroke-dashoffset" from={96} to={0} dur="3.5s" repeatCount="indefinite" />
|
|
19
19
|
<animateTransform
|
|
20
20
|
attributeName="transform"
|
|
21
21
|
type="rotate"
|
package/src/index.ts
CHANGED
|
@@ -59,3 +59,6 @@ export { default as TabPanel } from './Components/Tabs/TabPanel';
|
|
|
59
59
|
|
|
60
60
|
export type { BadgeProps } from './Components/Badge/Badge';
|
|
61
61
|
export { default as Badge } from './Components/Badge/Badge';
|
|
62
|
+
|
|
63
|
+
export type { IconButtonProps } from './Components/IconButton/IconButton';
|
|
64
|
+
export { default as IconButton } from './Components/IconButton/IconButton';
|