@bitrise/bitkit 12.45.0 → 12.47.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
CHANGED
|
@@ -21,13 +21,14 @@ const decorationColor = {
|
|
|
21
21
|
success: 'green.50',
|
|
22
22
|
};
|
|
23
23
|
const NoteTheme = {
|
|
24
|
-
parts: ['container', 'icon', 'body'],
|
|
25
|
-
baseStyle({ status }: { status: Status }) {
|
|
24
|
+
parts: ['container', 'icon', 'body', 'buttonContainer'],
|
|
25
|
+
baseStyle({ isExpanded, status }: { isExpanded: boolean; status: Status }) {
|
|
26
26
|
return {
|
|
27
27
|
wrapper: {
|
|
28
28
|
display: 'flex',
|
|
29
29
|
boxShadow: 'medium',
|
|
30
30
|
borderRadius: '8',
|
|
31
|
+
position: 'relative',
|
|
31
32
|
},
|
|
32
33
|
decoration: {
|
|
33
34
|
color: decorationColor[status],
|
|
@@ -46,13 +47,30 @@ const NoteTheme = {
|
|
|
46
47
|
flexGrow: 1,
|
|
47
48
|
paddingTop: '24',
|
|
48
49
|
paddingRight: '24',
|
|
49
|
-
paddingBottom: '32',
|
|
50
|
+
paddingBottom: ['80', '32'],
|
|
50
51
|
paddingLeft: '16',
|
|
51
52
|
borderTopRightRadius: '8',
|
|
52
53
|
borderBottomRightRadius: '8',
|
|
53
54
|
borderWidth: '1px',
|
|
54
55
|
borderLeft: 'none',
|
|
55
56
|
borderColor: borderColor[status],
|
|
57
|
+
overflow: 'hidden',
|
|
58
|
+
},
|
|
59
|
+
buttonContainer: {
|
|
60
|
+
position: 'absolute',
|
|
61
|
+
left: isExpanded ? 'auto' : '40px',
|
|
62
|
+
right: 1,
|
|
63
|
+
bottom: 1,
|
|
64
|
+
textAlign: 'right',
|
|
65
|
+
paddingX: '24',
|
|
66
|
+
paddingTop: '80',
|
|
67
|
+
paddingBottom: '16',
|
|
68
|
+
background: isExpanded ? undefined : 'linear-gradient(0deg, #FFF 12.57%, rgba(255, 255, 255, 0.00) 100%)',
|
|
69
|
+
borderBottomRadius: '8',
|
|
70
|
+
svg: {
|
|
71
|
+
transform: isExpanded ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
72
|
+
transition: '300ms',
|
|
73
|
+
},
|
|
56
74
|
},
|
|
57
75
|
};
|
|
58
76
|
},
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { useState, ReactNode } from 'react';
|
|
2
2
|
import { useMultiStyleConfig } from '@chakra-ui/react';
|
|
3
3
|
import Box from '../Box/Box';
|
|
4
|
+
import Collapse from '../Collapse/Collapse';
|
|
4
5
|
import Icon from '../Icon/Icon';
|
|
6
|
+
import Button from '../Button/Button';
|
|
5
7
|
|
|
6
8
|
export type Status = 'info' | 'success' | 'error' | 'warning';
|
|
7
9
|
const iconNames = {
|
|
@@ -10,14 +12,54 @@ const iconNames = {
|
|
|
10
12
|
error: 'ErrorGeneral',
|
|
11
13
|
warning: 'Warning',
|
|
12
14
|
} as const;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
export type NoteProps = {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
startingHeight?: number;
|
|
19
|
+
status: Status;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type ContainerProps = { children: ReactNode; isExpanded: boolean; startingHeight?: number };
|
|
23
|
+
|
|
24
|
+
const Container = ({ children, isExpanded, startingHeight }: ContainerProps) => {
|
|
25
|
+
if (startingHeight) {
|
|
26
|
+
return (
|
|
27
|
+
<Collapse
|
|
28
|
+
in={isExpanded}
|
|
29
|
+
startingHeight={startingHeight}
|
|
30
|
+
transition={{ enter: { duration: 0.5 }, exit: { duration: 0.5 } }}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</Collapse>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
return <>{children}</>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const Note = ({ children, startingHeight, status }: NoteProps) => {
|
|
40
|
+
const [isExpanded, setExpanded] = useState(false);
|
|
41
|
+
const { buttonContainer, container, decoration, wrapper } = useMultiStyleConfig('Note', {
|
|
42
|
+
isExpanded,
|
|
43
|
+
status,
|
|
44
|
+
});
|
|
45
|
+
|
|
15
46
|
return (
|
|
16
47
|
<Box __css={wrapper}>
|
|
17
48
|
<Box __css={decoration}>
|
|
18
49
|
<Icon size="24" name={iconNames[status]} />
|
|
19
50
|
</Box>
|
|
20
|
-
<Box __css={container}>
|
|
51
|
+
<Box __css={container}>
|
|
52
|
+
<Container isExpanded={isExpanded} startingHeight={startingHeight}>
|
|
53
|
+
{children}
|
|
54
|
+
</Container>
|
|
55
|
+
</Box>
|
|
56
|
+
{!!startingHeight && (
|
|
57
|
+
<Box __css={buttonContainer}>
|
|
58
|
+
<Button leftIconName="ChevronDown" onClick={() => setExpanded(!isExpanded)} size="small" variant="secondary">
|
|
59
|
+
{isExpanded ? 'Show less' : 'Show more'}
|
|
60
|
+
</Button>
|
|
61
|
+
</Box>
|
|
62
|
+
)}
|
|
21
63
|
</Box>
|
|
22
64
|
);
|
|
23
65
|
};
|
|
@@ -39,7 +39,18 @@ const Th = forwardRef<TableColumnHeaderProps, 'th'>((props, ref) => {
|
|
|
39
39
|
if (isSortable) {
|
|
40
40
|
const onClick = () => {
|
|
41
41
|
if (onSortClick) {
|
|
42
|
-
|
|
42
|
+
let nextSortDirection: AriaAttributes['aria-sort'];
|
|
43
|
+
switch (sortedBy) {
|
|
44
|
+
case 'ascending':
|
|
45
|
+
nextSortDirection = 'descending';
|
|
46
|
+
break;
|
|
47
|
+
case 'descending':
|
|
48
|
+
nextSortDirection = 'none';
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
nextSortDirection = 'ascending';
|
|
52
|
+
}
|
|
53
|
+
onSortClick(nextSortDirection);
|
|
43
54
|
}
|
|
44
55
|
};
|
|
45
56
|
properties.padding = '0';
|
package/src/index.ts
CHANGED
|
@@ -283,6 +283,7 @@ export { default as SelectableRow } from './Components/Table/SelectableRow';
|
|
|
283
283
|
export type { TagProps } from './Components/Tag/Tag';
|
|
284
284
|
export { default as Tag } from './Components/Tag/Tag';
|
|
285
285
|
|
|
286
|
+
export type { NoteProps } from './Components/Note/Note';
|
|
286
287
|
export { default as Note } from './Components/Note/Note';
|
|
287
288
|
export { default as MarkdownContent } from './Components/Note/NoteMarkdownContent';
|
|
288
289
|
export { default as CodeBlock } from './Components/CodeBlock/CodeBlock';
|