@bitrise/bitkit 12.6.3 → 12.8.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/Dropdown/Dropdown.tsx +1 -1
- package/src/Components/Sidebar/Sidebar.theme.ts +12 -0
- package/src/Components/Sidebar/Sidebar.tsx +84 -0
- package/src/Components/Sidebar/SidebarItem.theme.ts +53 -0
- package/src/Components/Sidebar/SidebarItem.tsx +61 -0
- package/src/Components/Slider/Slider.theme.ts +70 -0
- package/src/Components/Slider/Slider.tsx +4 -0
- package/src/Components/Slider/SliderFilledTrack.tsx +4 -0
- package/src/Components/Slider/SliderMark.tsx +4 -0
- package/src/Components/Slider/SliderThumb.tsx +12 -0
- package/src/Components/Slider/SliderTrack.tsx +4 -0
- package/src/index.ts +26 -0
- package/src/theme.ts +6 -0
package/package.json
CHANGED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createContext, ReactNode, useContext } from 'react';
|
|
2
|
+
import { BoxProps, createStylesContext, SpaceProps, useMultiStyleConfig } from '@chakra-ui/react';
|
|
3
|
+
import Box from '../Box/Box';
|
|
4
|
+
import Text from '../Text/Text';
|
|
5
|
+
import Divider from '../Divider/Divider';
|
|
6
|
+
import Icon from '../Icon/Icon';
|
|
7
|
+
|
|
8
|
+
const [SidebarContext, useSidebarStyle] = createStylesContext('Sidebar');
|
|
9
|
+
|
|
10
|
+
const SidebarContainer = ({ children }: { children: ReactNode }) => {
|
|
11
|
+
const { container } = useSidebarStyle();
|
|
12
|
+
return <Box sx={container}>{children}</Box>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const SidebarHeader = ({ title }: { title?: string }) => {
|
|
16
|
+
if (!title) {
|
|
17
|
+
return <Box h="24" w="100%" />;
|
|
18
|
+
}
|
|
19
|
+
return (
|
|
20
|
+
<Text lineHeight="var(--sizes-40)" size={['6', '4']} fontWeight="bold" px="32" py="16">
|
|
21
|
+
{title}
|
|
22
|
+
</Text>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const FooterContext = createContext(false);
|
|
27
|
+
|
|
28
|
+
const SidebarDivider = () => {
|
|
29
|
+
const isInFooter = useContext(FooterContext);
|
|
30
|
+
const margins: SpaceProps = isInFooter ? { marginTop: '12' } : { mx: '32', my: '24' };
|
|
31
|
+
return <Divider {...margins} w="auto" />;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const SidebarGroupHeader = ({ label }: { label: string }) => {
|
|
35
|
+
return (
|
|
36
|
+
<Box marginTop="24" marginBottom="12" display="flex" mx="32" alignItems="center" gap="16">
|
|
37
|
+
<Text size="1" fontWeight="bold" textColor="neutral.60">
|
|
38
|
+
{label}
|
|
39
|
+
</Text>
|
|
40
|
+
<Divider w="auto" flexGrow="1" />
|
|
41
|
+
</Box>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const SidebarFooter = ({ children }: { children: ReactNode }) => {
|
|
46
|
+
const { container } = useSidebarStyle();
|
|
47
|
+
return (
|
|
48
|
+
<FooterContext.Provider value>
|
|
49
|
+
<Box marginTop="auto" sx={container}>
|
|
50
|
+
{children}
|
|
51
|
+
</Box>
|
|
52
|
+
</FooterContext.Provider>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type SidebarProps = { children: ReactNode; title?: string } & Omit<
|
|
57
|
+
BoxProps,
|
|
58
|
+
'display' | 'd' | 'flexDirection' | 'flexDir' | 'as'
|
|
59
|
+
>;
|
|
60
|
+
const Sidebar = ({ children, title, ...boxProps }: SidebarProps) => {
|
|
61
|
+
const theme = useMultiStyleConfig('Sidebar');
|
|
62
|
+
return (
|
|
63
|
+
<SidebarContext value={theme}>
|
|
64
|
+
<Box as="nav" display="flex" flexDirection="column" {...boxProps}>
|
|
65
|
+
<SidebarHeader title={title} />
|
|
66
|
+
{children}
|
|
67
|
+
</Box>
|
|
68
|
+
</SidebarContext>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const SidebarButton = ({ onClick, title }: Pick<BoxProps, 'onClick'> & { title: string }) => {
|
|
73
|
+
return (
|
|
74
|
+
<Box as="button" onClick={onClick} h="56" display="flex" alignItems="center" gap="4" paddingLeft="16">
|
|
75
|
+
<Icon size="24" name="ChevronLeft" />
|
|
76
|
+
<Text as="span" lineHeight="var(--space-24)">
|
|
77
|
+
{title}
|
|
78
|
+
</Text>
|
|
79
|
+
</Box>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default Sidebar;
|
|
84
|
+
export { SidebarDivider, SidebarGroupHeader, SidebarContainer, SidebarFooter, SidebarButton };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createMultiStyleConfigHelpers } from '@chakra-ui/styled-system';
|
|
2
|
+
|
|
3
|
+
const itemHelpers = createMultiStyleConfigHelpers(['cell', 'link']);
|
|
4
|
+
|
|
5
|
+
const SidebarItemTheme = itemHelpers.defineMultiStyleConfig({
|
|
6
|
+
baseStyle: {
|
|
7
|
+
link: {
|
|
8
|
+
userSelect: 'none',
|
|
9
|
+
color: 'purple.10',
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexShrink: '0',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
_hover: {
|
|
14
|
+
bg: 'neutral.95',
|
|
15
|
+
},
|
|
16
|
+
_active: {
|
|
17
|
+
bg: 'neutral.93',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
icon: {
|
|
21
|
+
marginLeft: '32',
|
|
22
|
+
marginRight: '16',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
variants: {
|
|
26
|
+
selected: {
|
|
27
|
+
link: {
|
|
28
|
+
fontWeight: 'demiBold',
|
|
29
|
+
bg: 'purple.95',
|
|
30
|
+
_hover: {
|
|
31
|
+
bg: 'purple.93',
|
|
32
|
+
},
|
|
33
|
+
_active: {
|
|
34
|
+
bg: 'purple.93',
|
|
35
|
+
},
|
|
36
|
+
'&::after': {
|
|
37
|
+
display: 'block',
|
|
38
|
+
content: "''",
|
|
39
|
+
width: '2px',
|
|
40
|
+
height: '100%',
|
|
41
|
+
right: '0px',
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
top: 'calc(50% - var(--sizes-48)/2)',
|
|
44
|
+
background: 'purple.50',
|
|
45
|
+
borderRadius: '0px 2px 2px 0px',
|
|
46
|
+
transform: 'matrix(-1, 0, 0, 1, 0, 0)',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export default SidebarItemTheme;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { chakra, ChakraProps, createStylesContext, useMultiStyleConfig } from '@chakra-ui/react';
|
|
3
|
+
import { DateTime } from 'luxon';
|
|
4
|
+
import Text from '../Text/Text';
|
|
5
|
+
import Icon, { TypeIconName } from '../Icon/Icon';
|
|
6
|
+
|
|
7
|
+
type SidebarItemProps = {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
href?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const [SidebarItemStyleProvider, useSidebarItemStyle] = createStylesContext('SidebarItem');
|
|
15
|
+
|
|
16
|
+
const SidebarItem = ({ children, selected, href, onClick }: SidebarItemProps) => {
|
|
17
|
+
const style = useMultiStyleConfig('SidebarItem', { variant: selected ? 'selected' : undefined });
|
|
18
|
+
const shared = {
|
|
19
|
+
onClick,
|
|
20
|
+
position: 'relative',
|
|
21
|
+
href,
|
|
22
|
+
children: <SidebarItemStyleProvider value={style}>{children}</SidebarItemStyleProvider>,
|
|
23
|
+
sx: style.link,
|
|
24
|
+
height: '48',
|
|
25
|
+
} as ChakraProps;
|
|
26
|
+
if (onClick) {
|
|
27
|
+
return <chakra.button {...shared} />;
|
|
28
|
+
}
|
|
29
|
+
return <chakra.a {...shared} />;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const SidebarItemIcon = ({ name }: { name: TypeIconName }) => {
|
|
33
|
+
const { icon } = useSidebarItemStyle();
|
|
34
|
+
return <Icon sx={icon} name={name} size="24" />;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const SidebarItemLabel = ({ children }: { children: ReactNode }) => (
|
|
38
|
+
<Text as="span" textAlign="left" flexGrow="1">
|
|
39
|
+
{children}
|
|
40
|
+
</Text>
|
|
41
|
+
);
|
|
42
|
+
const SidebarItemDateExtra = ({ date }: { date: Date | DateTime }) => {
|
|
43
|
+
const dateTime = DateTime.isDateTime(date) ? date : DateTime.fromJSDate(date);
|
|
44
|
+
return (
|
|
45
|
+
<Text
|
|
46
|
+
as="time"
|
|
47
|
+
minWidth="5rem"
|
|
48
|
+
dateTime={dateTime.toFormat('yyyy-LL-dd')}
|
|
49
|
+
textAlign="left"
|
|
50
|
+
whiteSpace="nowrap"
|
|
51
|
+
fontWeight="normal"
|
|
52
|
+
textColor="text.secondary"
|
|
53
|
+
paddingEnd="24"
|
|
54
|
+
>
|
|
55
|
+
{dateTime.toFormat('LLL d')}
|
|
56
|
+
</Text>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default SidebarItem;
|
|
61
|
+
export { SidebarItemIcon, SidebarItemLabel, SidebarItemDateExtra };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { defineStyle, createMultiStyleConfigHelpers } from '@chakra-ui/styled-system';
|
|
2
|
+
|
|
3
|
+
const { definePartsStyle, defineMultiStyleConfig } = createMultiStyleConfigHelpers([
|
|
4
|
+
'container',
|
|
5
|
+
'track',
|
|
6
|
+
'thumb',
|
|
7
|
+
'filledTrack',
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
const baseStyleContainer = defineStyle(() => ({
|
|
11
|
+
width: '100%',
|
|
12
|
+
display: 'inline-block',
|
|
13
|
+
position: 'relative',
|
|
14
|
+
cursor: 'pointer',
|
|
15
|
+
_disabled: {
|
|
16
|
+
opacity: 0.6,
|
|
17
|
+
cursor: 'default',
|
|
18
|
+
pointerEvents: 'none',
|
|
19
|
+
},
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
const baseStyleTrack = defineStyle(() => ({
|
|
23
|
+
height: '8',
|
|
24
|
+
overflow: 'hidden',
|
|
25
|
+
backgroundColor: 'neutral.95',
|
|
26
|
+
borderRadius: '4',
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
const baseStyleThumb = defineStyle(() => ({
|
|
30
|
+
top: '50%',
|
|
31
|
+
transform: `translateY(-50%)`,
|
|
32
|
+
_active: {
|
|
33
|
+
transform: 'translateY(-50%) scale(1.15)',
|
|
34
|
+
},
|
|
35
|
+
width: '40px',
|
|
36
|
+
height: '40px',
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
outline: 0,
|
|
42
|
+
zIndex: 1,
|
|
43
|
+
borderRadius: '4',
|
|
44
|
+
bg: 'neutral.100',
|
|
45
|
+
border: '1px solid',
|
|
46
|
+
borderColor: 'neutral.90',
|
|
47
|
+
color: 'neutral.90',
|
|
48
|
+
transitionProperty: 'transform',
|
|
49
|
+
_focusVisible: {
|
|
50
|
+
boxShadow: 'outline',
|
|
51
|
+
},
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
const baseStyleFilledTrack = defineStyle(() => ({
|
|
55
|
+
width: 'inherit',
|
|
56
|
+
height: 'inherit',
|
|
57
|
+
borderRadius: 'inherit',
|
|
58
|
+
backgroundColor: 'purple.40',
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
const baseStyle = definePartsStyle(() => ({
|
|
62
|
+
container: baseStyleContainer(),
|
|
63
|
+
track: baseStyleTrack(),
|
|
64
|
+
thumb: baseStyleThumb(),
|
|
65
|
+
filledTrack: baseStyleFilledTrack(),
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
const SliderTheme = defineMultiStyleConfig({ baseStyle });
|
|
69
|
+
|
|
70
|
+
export default SliderTheme;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SliderThumb as ChakraThumb, SliderThumbProps } from '@chakra-ui/react';
|
|
2
|
+
import Icon from '../Icon/Icon';
|
|
3
|
+
|
|
4
|
+
export type { SliderThumbProps };
|
|
5
|
+
|
|
6
|
+
const SliderThumb = ({ children, ...restProps }: SliderThumbProps) => {
|
|
7
|
+
return (
|
|
8
|
+
<ChakraThumb {...restProps}>{children || <Icon name="MenuHamburger" transform="rotate(90deg)" />}</ChakraThumb>
|
|
9
|
+
);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default SliderThumb;
|
package/src/index.ts
CHANGED
|
@@ -243,3 +243,29 @@ export { default as SearchInput } from './Components/SearchInput/SearchInput';
|
|
|
243
243
|
|
|
244
244
|
export type { CloseButtonProps } from './Components/CloseButton/CloseButton';
|
|
245
245
|
export { default as CloseButton } from './Components/CloseButton/CloseButton';
|
|
246
|
+
|
|
247
|
+
export type { SliderProps } from './Components/Slider/Slider';
|
|
248
|
+
export { default as Slider } from './Components/Slider/Slider';
|
|
249
|
+
|
|
250
|
+
export type { SliderTrackProps } from './Components/Slider/SliderTrack';
|
|
251
|
+
export { default as SliderTrack } from './Components/Slider/SliderTrack';
|
|
252
|
+
|
|
253
|
+
export type { SliderInnerTrackProps } from './Components/Slider/SliderFilledTrack';
|
|
254
|
+
export { default as SliderFilledTrack } from './Components/Slider/SliderFilledTrack';
|
|
255
|
+
|
|
256
|
+
export type { SliderThumbProps } from './Components/Slider/SliderThumb';
|
|
257
|
+
export { default as SliderThumb } from './Components/Slider/SliderThumb';
|
|
258
|
+
|
|
259
|
+
export type { SliderMarkProps } from './Components/Slider/SliderMark';
|
|
260
|
+
export { default as SliderMark } from './Components/Slider/SliderMark';
|
|
261
|
+
export type { SidebarProps } from './Components/Sidebar/Sidebar';
|
|
262
|
+
export { default as Sidebar } from './Components/Sidebar/Sidebar';
|
|
263
|
+
export {
|
|
264
|
+
SidebarDivider,
|
|
265
|
+
SidebarGroupHeader,
|
|
266
|
+
SidebarContainer,
|
|
267
|
+
SidebarFooter,
|
|
268
|
+
SidebarButton,
|
|
269
|
+
} from './Components/Sidebar/Sidebar';
|
|
270
|
+
export { default as SidebarItem } from './Components/Sidebar/SidebarItem';
|
|
271
|
+
export { SidebarItemIcon, SidebarItemLabel, SidebarItemDateExtra } from './Components/Sidebar/SidebarItem';
|
package/src/theme.ts
CHANGED
|
@@ -30,6 +30,9 @@ import DatePickerDay from './Components/DatePicker/DatePickerDay.theme';
|
|
|
30
30
|
import NumberInput from './Components/NumberInput/NumberInput.theme';
|
|
31
31
|
import Skeleton from './Components/Skeleton/Skeleton.theme';
|
|
32
32
|
import ProgressBar from './Components/ProgressBar/ProgressBar.theme';
|
|
33
|
+
import Slider from './Components/Slider/Slider.theme';
|
|
34
|
+
import Sidebar from './Components/Sidebar/Sidebar.theme';
|
|
35
|
+
import SidebarItem from './Components/Sidebar/SidebarItem.theme';
|
|
33
36
|
|
|
34
37
|
import breakpoints from './Foundations/Breakpoints/Breakpoints';
|
|
35
38
|
import colors from './Foundations/Colors/Colors';
|
|
@@ -106,7 +109,10 @@ const theme = {
|
|
|
106
109
|
DatePickerDay,
|
|
107
110
|
NumberInput,
|
|
108
111
|
Skeleton,
|
|
112
|
+
Sidebar,
|
|
113
|
+
SidebarItem,
|
|
109
114
|
Progress: ProgressBar,
|
|
115
|
+
Slider,
|
|
110
116
|
},
|
|
111
117
|
};
|
|
112
118
|
|