@bitrise/bitkit 10.25.3 → 10.26.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 +1 -4
- package/src/Components/Breadcrumb/Breadcrumb.stories.tsx +39 -20
- package/src/Components/Breadcrumb/Breadcrumb.theme.ts +11 -3
- package/src/Old/hooks/index.ts +0 -1
- package/src/old.ts +0 -9
- package/src/tsconfig.tsbuildinfo +1 -1
- package/src/Old/Dropdown/Dropdown.tsx +0 -101
- package/src/Old/Dropdown/DropdownMenu.css +0 -48
- package/src/Old/Dropdown/DropdownMenu.tsx +0 -35
- package/src/Old/Dropdown/DropdownMenuItem.tsx +0 -62
- package/src/Old/Dropdown/DropdownMenuItemGroup.tsx +0 -19
- package/src/Old/hooks/useCopyToClipboard.ts +0 -25
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import Text from '../../Components/Text/Text';
|
|
3
|
-
import Popover from '../../Components/Popover/Popover';
|
|
4
|
-
import PopoverTrigger from '../../Components/Popover/PopoverTrigger';
|
|
5
|
-
import PopoverContent from '../../Components/Popover/PopoverContent';
|
|
6
|
-
import Button, { ButtonProps } from '../../Components/Button/Button';
|
|
7
|
-
import DropdownMenuItemGroup from './DropdownMenuItemGroup';
|
|
8
|
-
import DropdownMenuItem from './DropdownMenuItem';
|
|
9
|
-
import DropdownMenu from './DropdownMenu';
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
type DropdownValue = any;
|
|
13
|
-
interface Option {
|
|
14
|
-
text: string;
|
|
15
|
-
value: DropdownValue;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface OptionGroup {
|
|
19
|
-
text: string;
|
|
20
|
-
options: DropdownValue[];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface Props extends ButtonProps {
|
|
24
|
-
/** Handler for the value that is selected */
|
|
25
|
-
onChange?: (value: DropdownValue) => void;
|
|
26
|
-
/** Array of options that can be selected */
|
|
27
|
-
options: (Option | OptionGroup)[];
|
|
28
|
-
/** Selected value from the options */
|
|
29
|
-
selected?: DropdownValue;
|
|
30
|
-
maxHeight?: string;
|
|
31
|
-
menuClassName?: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* A quick Dropdown component for the most simplest
|
|
36
|
-
* dropdown menu use case. Anything more complicated
|
|
37
|
-
* and custom should be done with Placement.
|
|
38
|
-
*/
|
|
39
|
-
const Dropdown: React.FunctionComponent<Props> = (props: Props) => {
|
|
40
|
-
const { children, options, onChange, selected, maxHeight, menuClassName, ...rest } = props;
|
|
41
|
-
|
|
42
|
-
const handleChange = (value: DropdownValue) => {
|
|
43
|
-
if (onChange) {
|
|
44
|
-
onChange(value);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const renderOption = ({ text, value }: Option, onClose: () => void) => (
|
|
49
|
-
<DropdownMenuItem
|
|
50
|
-
onClick={() => {
|
|
51
|
-
handleChange(value);
|
|
52
|
-
onClose();
|
|
53
|
-
}}
|
|
54
|
-
selected={selected === value}
|
|
55
|
-
width="100%"
|
|
56
|
-
>
|
|
57
|
-
{text}
|
|
58
|
-
</DropdownMenuItem>
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<Popover matchWidth>
|
|
63
|
-
{({ onClose }) => (
|
|
64
|
-
<>
|
|
65
|
-
<PopoverTrigger>
|
|
66
|
-
<Button
|
|
67
|
-
width="100%"
|
|
68
|
-
variant="secondary"
|
|
69
|
-
rightIconName="ChevronDown"
|
|
70
|
-
justifyContent="space-between"
|
|
71
|
-
{...rest}
|
|
72
|
-
>
|
|
73
|
-
<Text as="span" hasEllipsis>
|
|
74
|
-
{children}
|
|
75
|
-
</Text>
|
|
76
|
-
</Button>
|
|
77
|
-
</PopoverTrigger>
|
|
78
|
-
<PopoverContent>
|
|
79
|
-
<DropdownMenu className={menuClassName} maxHeight={maxHeight} width="100%">
|
|
80
|
-
{options.map((option) => (
|
|
81
|
-
<React.Fragment key={option.text}>
|
|
82
|
-
{'options' in option ? (
|
|
83
|
-
<DropdownMenuItemGroup text={option.text}>
|
|
84
|
-
{option.options.map((groupOption) => (
|
|
85
|
-
<React.Fragment key={groupOption.value}>{renderOption(groupOption, onClose)}</React.Fragment>
|
|
86
|
-
))}
|
|
87
|
-
</DropdownMenuItemGroup>
|
|
88
|
-
) : (
|
|
89
|
-
renderOption(option, onClose)
|
|
90
|
-
)}
|
|
91
|
-
</React.Fragment>
|
|
92
|
-
))}
|
|
93
|
-
</DropdownMenu>
|
|
94
|
-
</PopoverContent>
|
|
95
|
-
</>
|
|
96
|
-
)}
|
|
97
|
-
</Popover>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export default Dropdown;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
.DropdownMenu__content {
|
|
2
|
-
max-width: 100%;
|
|
3
|
-
overflow: auto;
|
|
4
|
-
word-break: break-word;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.DropdownMenu__group-text {
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
padding: var(--size--x3) var(--size--x4);
|
|
11
|
-
text-transform: uppercase;
|
|
12
|
-
gap: var(--size--x4);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.DropdownMenu__group-text::after {
|
|
16
|
-
content: '';
|
|
17
|
-
flex: 1;
|
|
18
|
-
/* stylelint-disable-next-line unit-disallowed-list */
|
|
19
|
-
height: 1px;
|
|
20
|
-
background-color: var(--color-gray--3);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.DropdownMenu__item {
|
|
24
|
-
padding: var(--size--x3) var(--size--x8) var(--size--x3) var(--size--x1);
|
|
25
|
-
border: 0;
|
|
26
|
-
background: transparent;
|
|
27
|
-
color: inherit;
|
|
28
|
-
text-align: left;
|
|
29
|
-
line-height: inherit;
|
|
30
|
-
cursor: pointer;
|
|
31
|
-
transition-property: background-color, color;
|
|
32
|
-
transition-duration: var(--transition-duration--base);
|
|
33
|
-
transition-timing-function: var(--transition-timing-function);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.DropdownMenu__group .DropdownMenu__item {
|
|
37
|
-
padding-left: var(--size--x4);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.DropdownMenu__item[disabled] {
|
|
41
|
-
color: var(--color-gray--5);
|
|
42
|
-
pointer-events: none;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.DropdownMenu__item:hover {
|
|
46
|
-
background-color: var(--color-grape--1);
|
|
47
|
-
color: var(--color-grape--3);
|
|
48
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import { Props as BaseProps } from '../Base/Base';
|
|
4
|
-
import Flex from '../Flex/Flex';
|
|
5
|
-
import PlacementArea from '../Placement/PlacementArea';
|
|
6
|
-
import './DropdownMenu.css';
|
|
7
|
-
|
|
8
|
-
export interface Props extends BaseProps {
|
|
9
|
-
/** The height the DropdownMenu can go to before it starts to scroll */
|
|
10
|
-
maxHeight?: string;
|
|
11
|
-
/** Fixed width of the menu and all of the DropdownMenuItems */
|
|
12
|
-
width?: number | string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Parent container for DropdownMenuItems
|
|
17
|
-
*/
|
|
18
|
-
const DropdownMenu: React.FunctionComponent<Props> = (props: Props) => {
|
|
19
|
-
const { className, children, maxHeight, width, ...rest } = props;
|
|
20
|
-
|
|
21
|
-
const classes = classNames(className, 'DropdownMenu__content');
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<PlacementArea {...rest} direction="vertical" paddingVertical="x4">
|
|
25
|
-
<Flex className={classes} direction="vertical" maxHeight={maxHeight} width={width}>
|
|
26
|
-
{children}
|
|
27
|
-
</Flex>
|
|
28
|
-
</PlacementArea>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
DropdownMenu.defaultProps = {
|
|
32
|
-
width: '16rem',
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default DropdownMenu;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import classnames from 'classnames';
|
|
3
|
-
import Flex, { Props as FlexProps } from '../Flex/Flex';
|
|
4
|
-
import Icon, { TypeIconName } from '../../Components/Icon/Icon';
|
|
5
|
-
import Visibility from '../Visibility/Visibility';
|
|
6
|
-
|
|
7
|
-
export interface Props extends FlexProps {
|
|
8
|
-
/** Name of the icon that appears to the left of the menu item */
|
|
9
|
-
icon?: TypeIconName;
|
|
10
|
-
/** @Ignore */
|
|
11
|
-
onClick?: () => void;
|
|
12
|
-
/** Flag if the menu item should be in a selected state */
|
|
13
|
-
selected?: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Dropdown menu items that are the children to the DropdownMenu
|
|
18
|
-
* component.
|
|
19
|
-
*/
|
|
20
|
-
const DropdownMenuItem: React.FunctionComponent<Props> = (props: Props) => {
|
|
21
|
-
const { children, icon, onClick, selected, textColor, ...rest } = props;
|
|
22
|
-
const classes = classnames('DropdownMenu__item', {
|
|
23
|
-
'DropdownMenu__item--selected': selected,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const handleClick = (event: React.SyntheticEvent) => {
|
|
27
|
-
event.nativeEvent.stopImmediatePropagation();
|
|
28
|
-
|
|
29
|
-
if (onClick) {
|
|
30
|
-
onClick();
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Flex
|
|
36
|
-
{...rest}
|
|
37
|
-
alignChildrenVertical="middle"
|
|
38
|
-
className={classes}
|
|
39
|
-
direction="horizontal"
|
|
40
|
-
gap="x1"
|
|
41
|
-
onClick={handleClick}
|
|
42
|
-
>
|
|
43
|
-
<Visibility Component={Flex} visible={selected || false}>
|
|
44
|
-
<Icon name="Tick" />
|
|
45
|
-
</Visibility>
|
|
46
|
-
|
|
47
|
-
<Flex direction="horizontal" gap="x4" grow initial="none">
|
|
48
|
-
{icon && (
|
|
49
|
-
<Flex>
|
|
50
|
-
<Icon name={icon} textColor={textColor} />
|
|
51
|
-
</Flex>
|
|
52
|
-
)}
|
|
53
|
-
|
|
54
|
-
<Flex grow initial="none" textColor={textColor}>
|
|
55
|
-
{children}
|
|
56
|
-
</Flex>
|
|
57
|
-
</Flex>
|
|
58
|
-
</Flex>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export default DropdownMenuItem;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import classnames from 'classnames';
|
|
3
|
-
import Flex, { Props as FlexProps } from '../Flex/Flex';
|
|
4
|
-
import Text from '../../Components/Text/Text';
|
|
5
|
-
|
|
6
|
-
export interface Props extends FlexProps {
|
|
7
|
-
text: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const DropdownMenuItemGroup: React.FunctionComponent<Props> = ({ text, children, className, ...rest }: Props) => (
|
|
11
|
-
<Flex className={classnames('DropdownMenu__group', className)} {...rest}>
|
|
12
|
-
<Text className="DropdownMenu__group-text" size="2" color="neutral.50">
|
|
13
|
-
{text}
|
|
14
|
-
</Text>
|
|
15
|
-
{children}
|
|
16
|
-
</Flex>
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
export default DropdownMenuItemGroup;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import Clipboard from 'clipboard';
|
|
3
|
-
|
|
4
|
-
export default (): [(element: Element | null) => void, boolean] => {
|
|
5
|
-
const clipboard = useRef<Clipboard>();
|
|
6
|
-
const [node, setNode] = useState<Element | null>(null);
|
|
7
|
-
const [hasCopied, setHasCopied] = useState(false);
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (node) {
|
|
11
|
-
clipboard.current = new Clipboard(node);
|
|
12
|
-
clipboard.current.on('success', () => {
|
|
13
|
-
setHasCopied(true);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return () => {
|
|
18
|
-
if (clipboard.current) {
|
|
19
|
-
clipboard.current.destroy();
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}, [node]);
|
|
23
|
-
|
|
24
|
-
return [setNode, hasCopied];
|
|
25
|
-
};
|