@bitrise/bitkit 12.39.1 → 12.41.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 +1 -1
- package/src/Components/ExpandableCard/ExpandableCard.theme.ts +34 -0
- package/src/Components/ExpandableCard/ExpandableCard.tsx +36 -0
- package/src/Components/IconButton/IconButton.tsx +4 -2
- package/src/Components/Table/TableIconButton.tsx +10 -0
- package/src/index.ts +6 -0
- package/src/theme.ts +2 -0
package/package.json
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createMultiStyleConfigHelpers } from '@chakra-ui/styled-system';
|
|
2
|
+
|
|
3
|
+
const { defineMultiStyleConfig } = createMultiStyleConfigHelpers(['button', 'chevron']);
|
|
4
|
+
|
|
5
|
+
const ExpandableCardTheme = defineMultiStyleConfig({
|
|
6
|
+
baseStyle: ({ isOpen }) => ({
|
|
7
|
+
button: {
|
|
8
|
+
borderTopStartRadius: '8',
|
|
9
|
+
borderTopEndRadius: '8',
|
|
10
|
+
borderBottomStartRadius: isOpen ? undefined : '8',
|
|
11
|
+
borderBottomEndRadius: isOpen ? undefined : '8',
|
|
12
|
+
display: 'flex',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
justifyContent: 'space-between',
|
|
15
|
+
width: '100%',
|
|
16
|
+
cursor: 'pointer',
|
|
17
|
+
backgroundColor: isOpen ? 'neutral.95' : 'neutral.100',
|
|
18
|
+
borderBottom: isOpen ? '1px solid' : undefined,
|
|
19
|
+
borderBottomColor: isOpen ? 'neutral.90' : undefined,
|
|
20
|
+
_hover: {
|
|
21
|
+
backgroundColor: 'neutral.93',
|
|
22
|
+
},
|
|
23
|
+
_active: {
|
|
24
|
+
backgroundColor: 'neutral.90',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
chevron: {
|
|
28
|
+
transform: isOpen ? 'rotate(-180deg)' : undefined,
|
|
29
|
+
transition: 'transform 0.2s ease',
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export default ExpandableCardTheme;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { forwardRef, useDisclosure, useMultiStyleConfig } from '@chakra-ui/react';
|
|
3
|
+
import Box from '../Box/Box';
|
|
4
|
+
import Collapse from '../Collapse/Collapse';
|
|
5
|
+
import Card, { CardProps } from '../Card/Card';
|
|
6
|
+
import Icon from '../Icon/Icon';
|
|
7
|
+
|
|
8
|
+
export interface ExpandableCardProps
|
|
9
|
+
extends Omit<
|
|
10
|
+
CardProps,
|
|
11
|
+
'p | pt | paddingTop | pr | paddingRight | pe | paddingEnd | pb | paddingBottom | pl | paddingLeft | ps | paddingStart | px | paddingX | py | paddingY | paddingInlineStart | paddingInlineEnd'
|
|
12
|
+
> {
|
|
13
|
+
buttonContent: ReactNode;
|
|
14
|
+
isExpanded?: boolean;
|
|
15
|
+
}
|
|
16
|
+
const ExpandableCard = forwardRef<ExpandableCardProps, 'div'>((props, ref) => {
|
|
17
|
+
const { buttonContent, children, isExpanded, padding = '16', ...rest } = props;
|
|
18
|
+
|
|
19
|
+
const { isOpen, onToggle } = useDisclosure({ defaultIsOpen: isExpanded });
|
|
20
|
+
|
|
21
|
+
const style = useMultiStyleConfig('ExpandableCard', { isOpen });
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Card variant="outline" {...rest} ref={ref}>
|
|
25
|
+
<Box as="button" onClick={onToggle} padding={padding} __css={style.button}>
|
|
26
|
+
{buttonContent}
|
|
27
|
+
<Icon name="ChevronDown" __css={style.chevron} />
|
|
28
|
+
</Box>
|
|
29
|
+
<Collapse in={isOpen}>
|
|
30
|
+
<Box padding={padding}>{children}</Box>
|
|
31
|
+
</Collapse>
|
|
32
|
+
</Card>
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export default ExpandableCard;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { IconButton as ChakraIconButton, IconButtonProps as ChakraIconButtonProps, forwardRef } from '@chakra-ui/react';
|
|
2
|
-
import Icon, { TypeIconName } from '../Icon/Icon';
|
|
2
|
+
import Icon, { IconProps, TypeIconName } from '../Icon/Icon';
|
|
3
3
|
import Tooltip, { TooltipProps } from '../Tooltip/Tooltip';
|
|
4
4
|
|
|
5
5
|
export interface IconButtonProps extends ChakraIconButtonProps {
|
|
6
6
|
as?: 'a' | 'button';
|
|
7
7
|
iconName: TypeIconName;
|
|
8
8
|
isDanger?: boolean;
|
|
9
|
+
iconSize?: IconProps['size'];
|
|
9
10
|
isTooltipDisabled?: boolean;
|
|
10
11
|
label?: string;
|
|
11
12
|
size?: 'small' | 'medium';
|
|
@@ -21,6 +22,7 @@ const IconButton = forwardRef<IconButtonProps, 'button'>((props, ref) => {
|
|
|
21
22
|
const {
|
|
22
23
|
as,
|
|
23
24
|
iconName,
|
|
25
|
+
iconSize,
|
|
24
26
|
isDanger,
|
|
25
27
|
isDisabled,
|
|
26
28
|
isTooltipDisabled,
|
|
@@ -33,7 +35,7 @@ const IconButton = forwardRef<IconButtonProps, 'button'>((props, ref) => {
|
|
|
33
35
|
} = props;
|
|
34
36
|
const properties: ChakraIconButtonProps = {
|
|
35
37
|
as: isDisabled ? 'button' : as,
|
|
36
|
-
icon: <Icon name={iconName} size={size === 'small' ? '16' : '24'} />,
|
|
38
|
+
icon: <Icon name={iconName} size={iconSize || (size === 'small' ? '16' : '24')} />,
|
|
37
39
|
isDisabled,
|
|
38
40
|
size,
|
|
39
41
|
variant: isDanger ? `${variant}--danger` : variant,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { forwardRef } from '@chakra-ui/react';
|
|
2
|
+
import IconButton, { IconButtonProps } from '../IconButton/IconButton';
|
|
3
|
+
|
|
4
|
+
export type TableIconButtonProps = Omit<IconButtonProps, 'iconSize' | 'size' | 'variant'>;
|
|
5
|
+
|
|
6
|
+
const TableIconButton = forwardRef<TableIconButtonProps, 'button'>((props, ref) => (
|
|
7
|
+
<IconButton {...props} iconSize="24" size="small" variant="tertiary" ref={ref} />
|
|
8
|
+
));
|
|
9
|
+
|
|
10
|
+
export default TableIconButton;
|
package/src/index.ts
CHANGED
|
@@ -295,3 +295,9 @@ export { default as LinkBox } from './Components/LinkBox/LinkBox';
|
|
|
295
295
|
|
|
296
296
|
export type { LinkOverlayProps } from './Components/LinkOverlay/LinkOverlay';
|
|
297
297
|
export { default as LinkOverlay } from './Components/LinkOverlay/LinkOverlay';
|
|
298
|
+
|
|
299
|
+
export type { TableIconButtonProps } from './Components/Table/TableIconButton';
|
|
300
|
+
export { default as TableIconButton } from './Components/Table/TableIconButton';
|
|
301
|
+
|
|
302
|
+
export type { ExpandableCardProps } from './Components/ExpandableCard/ExpandableCard';
|
|
303
|
+
export { default as ExpandableCard } from './Components/ExpandableCard/ExpandableCard';
|
package/src/theme.ts
CHANGED
|
@@ -39,6 +39,7 @@ import Tag from './Components/Tag/Tag.theme';
|
|
|
39
39
|
import Note from './Components/Note/Note.theme';
|
|
40
40
|
import CodeBlock from './Components/CodeBlock/CodeBlock.theme';
|
|
41
41
|
import DefinitionTooltip from './Components/DefinitionTooltip/DefinitionTooltip.theme';
|
|
42
|
+
import ExpandableCard from './Components/ExpandableCard/ExpandableCard.theme';
|
|
42
43
|
|
|
43
44
|
import breakpoints from './Foundations/Breakpoints/Breakpoints';
|
|
44
45
|
import colors from './Foundations/Colors/Colors';
|
|
@@ -125,6 +126,7 @@ const theme = {
|
|
|
125
126
|
Note,
|
|
126
127
|
CodeBlock,
|
|
127
128
|
DefinitionTooltip,
|
|
129
|
+
ExpandableCard,
|
|
128
130
|
},
|
|
129
131
|
};
|
|
130
132
|
|