@bitrise/bitkit 12.40.0 → 12.41.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
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;
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
useDisclosure,
|
|
8
8
|
useTableStyles,
|
|
9
9
|
} from '@chakra-ui/react';
|
|
10
|
-
import IconButton from '../IconButton/IconButton';
|
|
11
10
|
import Td from './Td';
|
|
11
|
+
import TableIconButton from './TableIconButton';
|
|
12
12
|
|
|
13
13
|
export type RowProps = ChakraTableRowProps;
|
|
14
14
|
|
|
@@ -48,13 +48,11 @@ const Tr = forwardRef<TableRowProps, 'tr'>((props, ref) => {
|
|
|
48
48
|
<>
|
|
49
49
|
<ChakraTr {...properties} ref={ref}>
|
|
50
50
|
<Td sx={css.expandTd}>
|
|
51
|
-
<
|
|
51
|
+
<TableIconButton
|
|
52
52
|
iconName="ChevronDown"
|
|
53
53
|
isTooltipDisabled
|
|
54
54
|
aria-label={isOpen ? 'Collapse row' : 'Expand row'}
|
|
55
55
|
onClick={onToggleClick}
|
|
56
|
-
size="small"
|
|
57
|
-
variant="tertiary"
|
|
58
56
|
sx={{
|
|
59
57
|
'> svg': {
|
|
60
58
|
transform: isOpen ? 'rotate(-180deg)' : 'rotate(0deg)',
|
package/src/index.ts
CHANGED
|
@@ -298,3 +298,6 @@ export { default as LinkOverlay } from './Components/LinkOverlay/LinkOverlay';
|
|
|
298
298
|
|
|
299
299
|
export type { TableIconButtonProps } from './Components/Table/TableIconButton';
|
|
300
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
|
|