@bitrise/bitkit 9.3.0-alpha.3 → 9.3.0-alpha.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/CHANGELOG.md +7 -0
- package/lib/cjs/Button2/Button2.d.ts +3 -2
- package/lib/cjs/Button2/Button2.d.ts.map +1 -1
- package/lib/cjs/Button2/Button2.js +3 -3
- package/lib/cjs/Button2/Button2.js.map +1 -1
- package/lib/cjs/ButtonWithDropdown/ButtonWithDropdown.d.ts +3 -2
- package/lib/cjs/ButtonWithDropdown/ButtonWithDropdown.d.ts.map +1 -1
- package/lib/cjs/ButtonWithDropdown/ButtonWithDropdown.js +6 -4
- package/lib/cjs/ButtonWithDropdown/ButtonWithDropdown.js.map +1 -1
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esn/Button2/Button2.d.ts +3 -2
- package/lib/esn/Button2/Button2.d.ts.map +1 -1
- package/lib/esn/Button2/Button2.js +4 -4
- package/lib/esn/Button2/Button2.js.map +1 -1
- package/lib/esn/ButtonWithDropdown/ButtonWithDropdown.d.ts +3 -2
- package/lib/esn/ButtonWithDropdown/ButtonWithDropdown.d.ts.map +1 -1
- package/lib/esn/ButtonWithDropdown/ButtonWithDropdown.js +7 -5
- package/lib/esn/ButtonWithDropdown/ButtonWithDropdown.js.map +1 -1
- package/lib/esn/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/site/components/Documentation/Components/SectionButton2.tsx +5 -1
- package/site/components/Documentation/Components/SectionButtons.tsx +1 -2
- package/src/Button2/Button2.tsx +6 -5
- package/src/ButtonWithDropdown/ButtonWithDropdown.tsx +7 -7
package/package.json
CHANGED
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
const SectionButtons = () => {
|
|
15
15
|
const [selectedTab, setSelectedTab] = React.useState(1);
|
|
16
16
|
|
|
17
|
+
const buttonRef = React.useRef<HTMLButtonElement>(null);
|
|
18
|
+
|
|
19
|
+
console.log({ buttonRef });
|
|
20
|
+
|
|
17
21
|
return (
|
|
18
22
|
<Section>
|
|
19
23
|
<Tabs gap="x6" margin="x8">
|
|
@@ -43,7 +47,7 @@
|
|
|
43
47
|
<Buttons alignChildrenVertical="end" margin="x3">
|
|
44
48
|
<Button2 onClick={ () => alert('onClick') } size="small" variant="secondary">Secondary</Button2>
|
|
45
49
|
<Button2 disabled size="small" variant="secondary">Disabled</Button2>
|
|
46
|
-
<Button2 size="medium" variant="secondary">Secondary</Button2>
|
|
50
|
+
<Button2 ref={ buttonRef } size="medium" variant="secondary">Secondary buttonRef</Button2>
|
|
47
51
|
<Button2 disabled size="medium" variant="secondary">Disabled</Button2>
|
|
48
52
|
</Buttons>
|
|
49
53
|
|
package/src/Button2/Button2.tsx
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
/* eslint-disable object-shorthand */
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Button as ChakraButton, ButtonProps } from '@chakra-ui/react';
|
|
3
|
+
import { Button as ChakraButton, ButtonProps, forwardRef } from '@chakra-ui/react';
|
|
4
4
|
|
|
5
5
|
interface Props extends Pick<ButtonProps, 'as' | 'disabled' | 'leftIcon' | 'rightIcon' |'sx'> {
|
|
6
6
|
children: ButtonProps['children'];
|
|
7
7
|
href?: string;
|
|
8
|
-
onClick?: (e: React.MouseEvent<
|
|
8
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
9
|
+
ref?: any;
|
|
9
10
|
size?: 'small' | 'medium';
|
|
10
11
|
target?: '_blank' | '_parent' | '_self' | '_top';
|
|
11
12
|
type?: ButtonProps['type'];
|
|
12
13
|
variant?: 'primary' | 'secondary' | 'tertiary' | 'dangerPrimary' | 'dangerSecondary';
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
const Button2 = (props: Props) => {
|
|
16
|
+
const Button2 = forwardRef((props: Props, ref) => {
|
|
16
17
|
const defaults = {
|
|
17
18
|
size: 'medium',
|
|
18
19
|
variant: 'primary',
|
|
19
20
|
};
|
|
20
21
|
const iconSpacing = props.size === 'medium' ? '10px' : '6px';
|
|
21
|
-
return <ChakraButton iconSpacing={ iconSpacing } { ...defaults } { ...props } />;
|
|
22
|
-
};
|
|
22
|
+
return <ChakraButton iconSpacing={ iconSpacing } ref={ ref } { ...defaults } { ...props } />;
|
|
23
|
+
});
|
|
23
24
|
|
|
24
25
|
export default Button2;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
ButtonProps,
|
|
3
|
+
Button2,
|
|
5
4
|
DropdownMenu,
|
|
6
5
|
DropdownMenuItem,
|
|
7
6
|
DropdownMenuItemProps,
|
|
@@ -12,6 +11,7 @@ import {
|
|
|
12
11
|
PlacementReference,
|
|
13
12
|
} from '@bitrise/bitkit';
|
|
14
13
|
|
|
14
|
+
import { ButtonProps } from '@chakra-ui/react';
|
|
15
15
|
export interface ItemProps extends DropdownMenuItemProps {
|
|
16
16
|
component?: string;
|
|
17
17
|
disabled?: boolean;
|
|
@@ -22,7 +22,7 @@ export interface ItemProps extends DropdownMenuItemProps {
|
|
|
22
22
|
|
|
23
23
|
export interface Props {
|
|
24
24
|
buttonProps?: ButtonProps;
|
|
25
|
-
children?: React.
|
|
25
|
+
children?: React.ReactNode | undefined;
|
|
26
26
|
dropdownWidth?: string;
|
|
27
27
|
items: ItemProps[];
|
|
28
28
|
placementProps?: PlacementProps;
|
|
@@ -41,16 +41,16 @@ const ButtonWithDropdown = ({
|
|
|
41
41
|
<PlacementManager>
|
|
42
42
|
<PlacementReference>
|
|
43
43
|
{ ({ ref }) => (
|
|
44
|
-
|
|
44
|
+
/* @ts-ignore */
|
|
45
|
+
<Button2 onClick={ () => setVisible(!visible) } ref={ ref } rightIcon={ <Icon name="ChevronDown" /> } { ...buttonProps }>
|
|
45
46
|
{ children }
|
|
46
|
-
|
|
47
|
-
</Button>
|
|
47
|
+
</Button2>
|
|
48
48
|
) }
|
|
49
49
|
</PlacementReference>
|
|
50
50
|
{ !buttonProps.disabled && (
|
|
51
51
|
<Placement
|
|
52
52
|
disableMargin="left-right"
|
|
53
|
-
onClose={ () => setVisible(false) }
|
|
53
|
+
// onClose={ () => setVisible(false) }
|
|
54
54
|
placement="bottom-end"
|
|
55
55
|
visible={ visible }
|
|
56
56
|
{ ...placementProps }>
|