@bitrise/bitkit 13.327.0 → 13.329.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/PaginationLoadMore/PaginationLoadMore.theme.ts +96 -0
- package/src/Components/PaginationLoadMore/PaginationLoadMore.tsx +74 -0
- package/src/Components/TreeView/TreeView.theme.ts +11 -4
- package/src/Components/TreeView/TreeViewNode.tsx +8 -12
- package/src/Components/components.theme.ts +2 -0
- package/src/index.ts +3 -0
package/package.json
CHANGED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { createMultiStyleConfigHelpers } from 'chakra-ui-2--styled-system';
|
|
2
|
+
import { rem } from '../../utils/utils';
|
|
3
|
+
|
|
4
|
+
const { defineMultiStyleConfig } = createMultiStyleConfigHelpers([
|
|
5
|
+
'container',
|
|
6
|
+
'text',
|
|
7
|
+
'divider',
|
|
8
|
+
'button',
|
|
9
|
+
'progressIndicator',
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
const PaginationLoadMoreTheme = defineMultiStyleConfig({
|
|
13
|
+
baseStyle: {
|
|
14
|
+
container: {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flexDirection: 'row',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
paddingX: '16',
|
|
19
|
+
},
|
|
20
|
+
text: {
|
|
21
|
+
textColor: 'text/secondary',
|
|
22
|
+
},
|
|
23
|
+
progressIndicator: {
|
|
24
|
+
textColor: 'text/tertiary',
|
|
25
|
+
display: 'flex',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
gap: '8',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
sizes: {
|
|
31
|
+
xs: {
|
|
32
|
+
container: {
|
|
33
|
+
height: rem(32),
|
|
34
|
+
gap: '12',
|
|
35
|
+
},
|
|
36
|
+
text: {
|
|
37
|
+
textStyle: 'body/sm/regular',
|
|
38
|
+
},
|
|
39
|
+
divider: {
|
|
40
|
+
height: rem(20),
|
|
41
|
+
},
|
|
42
|
+
progressIndicator: {
|
|
43
|
+
textStyle: 'body/sm/regular',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
sm: {
|
|
47
|
+
container: {
|
|
48
|
+
height: rem(48),
|
|
49
|
+
gap: '8',
|
|
50
|
+
},
|
|
51
|
+
text: {
|
|
52
|
+
textStyle: 'body/md/regular',
|
|
53
|
+
},
|
|
54
|
+
divider: {
|
|
55
|
+
height: rem(24),
|
|
56
|
+
marginLeft: '8',
|
|
57
|
+
},
|
|
58
|
+
button: {
|
|
59
|
+
'*': {
|
|
60
|
+
px: 4,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
progressIndicator: {
|
|
64
|
+
pl: 12,
|
|
65
|
+
textStyle: 'body/md/regular',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
md: {
|
|
69
|
+
container: {
|
|
70
|
+
height: rem(56),
|
|
71
|
+
gap: '12',
|
|
72
|
+
},
|
|
73
|
+
text: {
|
|
74
|
+
textStyle: 'body/md/regular',
|
|
75
|
+
},
|
|
76
|
+
divider: {
|
|
77
|
+
height: rem(24),
|
|
78
|
+
marginLeft: '12',
|
|
79
|
+
},
|
|
80
|
+
button: {
|
|
81
|
+
'*': {
|
|
82
|
+
px: 4,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
progressIndicator: {
|
|
86
|
+
pl: 12,
|
|
87
|
+
textStyle: 'body/md/regular',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
defaultProps: {
|
|
92
|
+
size: 'sm',
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export default PaginationLoadMoreTheme;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useMultiStyleConfig } from 'chakra-ui-2--react';
|
|
2
|
+
import Box from '../Box/Box';
|
|
3
|
+
import Text from '../Text/Text';
|
|
4
|
+
import LinkButton from '../LinkButton/LinkButton';
|
|
5
|
+
import Divider from '../Divider/Divider';
|
|
6
|
+
import ProgressSpinner from '../ProgressSpinner/ProgressSpinner';
|
|
7
|
+
import Button from '../Button/Button';
|
|
8
|
+
|
|
9
|
+
export type PaginationLoadMoreProps = {
|
|
10
|
+
loadedCount: number;
|
|
11
|
+
totalCount: number;
|
|
12
|
+
onLoadMore: () => void;
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
size?: 'xs' | 'sm' | 'md';
|
|
15
|
+
loadMoreCount?: number;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const PaginationLoadMore = ({
|
|
19
|
+
loadedCount,
|
|
20
|
+
totalCount,
|
|
21
|
+
onLoadMore,
|
|
22
|
+
isLoading,
|
|
23
|
+
size = 'sm',
|
|
24
|
+
loadMoreCount = 10,
|
|
25
|
+
}: PaginationLoadMoreProps) => {
|
|
26
|
+
const styles = useMultiStyleConfig('PaginationLoadMore', { size });
|
|
27
|
+
|
|
28
|
+
const hasMore = loadedCount < totalCount;
|
|
29
|
+
|
|
30
|
+
const loadMoreButton = () => {
|
|
31
|
+
if (size === 'xs') {
|
|
32
|
+
return (
|
|
33
|
+
<LinkButton size="sm" onClick={onLoadMore}>
|
|
34
|
+
Load {loadMoreCount} more
|
|
35
|
+
</LinkButton>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Button variant="tertiary" size={size} onClick={onLoadMore}>
|
|
41
|
+
Load {loadMoreCount} more
|
|
42
|
+
</Button>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const renderLoadMoreAction = () => {
|
|
47
|
+
if (!hasMore) return null;
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<>
|
|
51
|
+
<Divider orientation="vertical" size="1" sx={styles.divider} />
|
|
52
|
+
{isLoading ? (
|
|
53
|
+
<Box sx={styles.progressIndicator}>
|
|
54
|
+
<ProgressSpinner color="sys/interactive/base" size="16" />
|
|
55
|
+
Loading more...
|
|
56
|
+
</Box>
|
|
57
|
+
) : (
|
|
58
|
+
loadMoreButton()
|
|
59
|
+
)}
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Box sx={styles.container}>
|
|
66
|
+
<Text as="span" sx={styles.text}>
|
|
67
|
+
Showing {loadedCount} of {totalCount}
|
|
68
|
+
</Text>
|
|
69
|
+
{renderLoadMoreAction()}
|
|
70
|
+
</Box>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default PaginationLoadMore;
|
|
@@ -15,14 +15,14 @@ const { defineMultiStyleConfig, definePartsStyle } = createMultiStyleConfigHelpe
|
|
|
15
15
|
'leafBadge',
|
|
16
16
|
]);
|
|
17
17
|
|
|
18
|
-
const baseStyle = definePartsStyle({
|
|
18
|
+
const baseStyle = definePartsStyle(({ variant, isEmpty }) => ({
|
|
19
19
|
listItem: {
|
|
20
20
|
overflow: 'hidden',
|
|
21
21
|
},
|
|
22
22
|
icon: {
|
|
23
23
|
marginTop: '10px',
|
|
24
24
|
marginBottom: '2px',
|
|
25
|
-
color: 'icon/primary',
|
|
25
|
+
color: isEmpty ? 'icon/disabled' : 'icon/primary',
|
|
26
26
|
},
|
|
27
27
|
leafBadge: {
|
|
28
28
|
marginTop: '10px',
|
|
@@ -92,7 +92,7 @@ const baseStyle = definePartsStyle({
|
|
|
92
92
|
display: 'flex',
|
|
93
93
|
alignItems: 'flex-start',
|
|
94
94
|
textAlign: 'start',
|
|
95
|
-
borderBottom: '1px solid',
|
|
95
|
+
borderBottom: variant === 'files' ? 'none' : '1px solid',
|
|
96
96
|
borderColor: 'border/minimal',
|
|
97
97
|
},
|
|
98
98
|
textBlock: {
|
|
@@ -102,6 +102,13 @@ const baseStyle = definePartsStyle({
|
|
|
102
102
|
py: '8',
|
|
103
103
|
gap: '4',
|
|
104
104
|
flex: '1',
|
|
105
|
+
color: isEmpty ? 'text/tertiary' : 'text/body',
|
|
106
|
+
'& > .description-text': {
|
|
107
|
+
wordBreak: 'break-word',
|
|
108
|
+
overflowWrap: 'break-word',
|
|
109
|
+
textStyle: 'body/sm/regular',
|
|
110
|
+
color: 'text/secondary',
|
|
111
|
+
},
|
|
105
112
|
},
|
|
106
113
|
suffixBlock: {
|
|
107
114
|
display: 'flex',
|
|
@@ -144,7 +151,7 @@ const baseStyle = definePartsStyle({
|
|
|
144
151
|
display: 'none',
|
|
145
152
|
alignItems: 'center',
|
|
146
153
|
},
|
|
147
|
-
});
|
|
154
|
+
}));
|
|
148
155
|
|
|
149
156
|
const TreeViewTheme = defineMultiStyleConfig({
|
|
150
157
|
baseStyle,
|
|
@@ -49,13 +49,18 @@ const TreeViewNodeContent = memo(
|
|
|
49
49
|
onClick,
|
|
50
50
|
children,
|
|
51
51
|
}: TreeViewNodeContentProps) => {
|
|
52
|
-
const styles = useMultiStyleConfig('TreeView', {});
|
|
53
52
|
const { variant } = useTreeViewContext();
|
|
54
53
|
|
|
55
54
|
const isFilesVariant = variant === 'files';
|
|
56
55
|
const hasChildren = Boolean(children);
|
|
57
|
-
const isSelectable = !(isBranch && !hasChildren);
|
|
58
56
|
const isEmptyBranch = isBranch && !hasChildren;
|
|
57
|
+
const isSelectable = !isEmptyBranch;
|
|
58
|
+
|
|
59
|
+
const styles = useMultiStyleConfig('TreeView', {
|
|
60
|
+
variant,
|
|
61
|
+
isEmpty: isEmptyBranch,
|
|
62
|
+
});
|
|
63
|
+
|
|
59
64
|
const chevronIcon = isExpanded ? 'ChevronDown' : 'ChevronRight';
|
|
60
65
|
const primaryIconName = isFilesVariant ? 'FolderEmpty' : chevronIcon;
|
|
61
66
|
|
|
@@ -137,16 +142,7 @@ const TreeViewNodeContent = memo(
|
|
|
137
142
|
<Text fontWeight={isExpanded ? 'semibold' : 'normal'} overflowWrap="break-word" wordBreak="break-word">
|
|
138
143
|
{title}
|
|
139
144
|
</Text>
|
|
140
|
-
{description &&
|
|
141
|
-
<Text
|
|
142
|
-
color="text/secondary"
|
|
143
|
-
wordBreak="break-word"
|
|
144
|
-
overflowWrap="break-word"
|
|
145
|
-
textStyle="body/sm/regular"
|
|
146
|
-
>
|
|
147
|
-
{description}
|
|
148
|
-
</Text>
|
|
149
|
-
)}
|
|
145
|
+
{description && <Text className="description-text">{description}</Text>}
|
|
150
146
|
</Box>
|
|
151
147
|
|
|
152
148
|
{(hasLabelContent || hasHoverActions) && (
|
|
@@ -53,6 +53,7 @@ import DraggableCard from './DraggableCard/DraggableCard.theme';
|
|
|
53
53
|
import SelectableTag from './SelectableTag/SelectableTag.theme';
|
|
54
54
|
import DataWidget from './DataWidget/DataWidget.theme';
|
|
55
55
|
import TreeView from './TreeView/TreeView.theme';
|
|
56
|
+
import PaginationLoadMore from './PaginationLoadMore/PaginationLoadMore.theme';
|
|
56
57
|
|
|
57
58
|
const components = {
|
|
58
59
|
Accordion,
|
|
@@ -88,6 +89,7 @@ const components = {
|
|
|
88
89
|
Note,
|
|
89
90
|
NoteCard,
|
|
90
91
|
NumberInput,
|
|
92
|
+
PaginationLoadMore,
|
|
91
93
|
Popover,
|
|
92
94
|
Progress: ProgressBar,
|
|
93
95
|
ProgressIndicator,
|
package/src/index.ts
CHANGED
|
@@ -334,6 +334,9 @@ export { default as TablePagination } from './Components/Table/TablePagination';
|
|
|
334
334
|
export type { PaginationProps } from './Components/Pagination/Pagination';
|
|
335
335
|
export { default as Pagination } from './Components/Pagination/Pagination';
|
|
336
336
|
|
|
337
|
+
export type { PaginationLoadMoreProps } from './Components/PaginationLoadMore/PaginationLoadMore';
|
|
338
|
+
export { default as PaginationLoadMore } from './Components/PaginationLoadMore/PaginationLoadMore';
|
|
339
|
+
|
|
337
340
|
export type { ProgressIndicatorProps } from './Components/ProgressIndicator/ProgressIndicator';
|
|
338
341
|
export { default as ProgressIndicator } from './Components/ProgressIndicator/ProgressIndicator';
|
|
339
342
|
|