@bitrise/bitkit 13.19.0 → 13.21.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
|
@@ -4,13 +4,17 @@ import ReactMarkdown, { Components } from 'react-markdown';
|
|
|
4
4
|
import List from '../List/List';
|
|
5
5
|
import Link from '../Link/Link';
|
|
6
6
|
import ListItem from '../List/ListItem';
|
|
7
|
-
import Box from '../Box/Box';
|
|
7
|
+
import Box, { BoxProps } from '../Box/Box';
|
|
8
8
|
import Divider from '../Divider/Divider';
|
|
9
9
|
import Text from '../Text/Text';
|
|
10
10
|
import CodeBlock from '../CodeBlock/CodeBlock';
|
|
11
11
|
import CodeSnippet from '../CodeSnippet/CodeSnippet';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
type GapType = Exclude<BoxProps['gap'], undefined>;
|
|
14
|
+
|
|
15
|
+
const defaultComponents = (size: 'sm' | 'md' | 'lg', gap: GapType = '16'): Components => {
|
|
16
|
+
const codeSize = size === 'lg' ? 'lg' : 'md';
|
|
17
|
+
|
|
14
18
|
return {
|
|
15
19
|
a: ({ node, ...props }) => <Link colorScheme="purple" isUnderlined target="_blank" {...props} />,
|
|
16
20
|
blockquote: ({ children }) => (
|
|
@@ -27,7 +31,7 @@ const defaultComponents = (size: 'md' | 'lg'): Components => {
|
|
|
27
31
|
</Box>
|
|
28
32
|
),
|
|
29
33
|
code: ({ node, ...props }) => (
|
|
30
|
-
<CodeSnippet size={
|
|
34
|
+
<CodeSnippet size={codeSize} {...props}>
|
|
31
35
|
{props.children as string}
|
|
32
36
|
</CodeSnippet>
|
|
33
37
|
),
|
|
@@ -37,24 +41,26 @@ const defaultComponents = (size: 'md' | 'lg'): Components => {
|
|
|
37
41
|
h4: ({ node, ...props }) => <Text as="h4" textStyle="heading/h4" {...props} />,
|
|
38
42
|
h5: ({ node, ...props }) => <Text as="h5" textStyle="heading/h5" {...props} />,
|
|
39
43
|
h6: ({ node, ...props }) => <Text as="h6" textStyle="heading/h6" {...props} />,
|
|
40
|
-
hr: () => <Divider borderColor="separator.primary" my=
|
|
44
|
+
hr: () => <Divider borderColor="separator.primary" my={gap} size="2" />,
|
|
41
45
|
li: ({ node, ...props }) => <ListItem {...props} />,
|
|
42
46
|
ol: ({ node, ...props }) => <List isOrdered {...props} />,
|
|
43
47
|
p: ({ node, ...props }) => <Text {...props} />,
|
|
44
|
-
pre: ({ node, ...props }) => <CodeBlock size={
|
|
48
|
+
pre: ({ node, ...props }) => <CodeBlock size={codeSize}>{props.children as string}</CodeBlock>,
|
|
45
49
|
ul: ({ node, ...props }) => <List {...props} />,
|
|
46
50
|
};
|
|
47
51
|
};
|
|
48
52
|
|
|
49
|
-
type NoteMarkdownContentProps = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
type NoteMarkdownContentProps = {
|
|
54
|
+
md: string;
|
|
55
|
+
gap?: GapType;
|
|
56
|
+
size?: 'sm' | 'md' | 'lg';
|
|
57
|
+
} & Pick<ComponentProps<typeof ReactMarkdown>, 'components' | 'rehypePlugins'>;
|
|
58
|
+
|
|
59
|
+
const NoteMarkdownContent = ({ components, md, gap = '16', size = 'lg', ...rest }: NoteMarkdownContentProps) => {
|
|
54
60
|
const extendedComponents = { ...defaultComponents(size), ...components };
|
|
55
61
|
const textStyle = `body/${size}/regular`;
|
|
56
62
|
return (
|
|
57
|
-
<Box display="flex" flexDirection="column" gap=
|
|
63
|
+
<Box display="flex" flexDirection="column" gap={gap} textStyle={textStyle}>
|
|
58
64
|
<ReactMarkdown components={extendedComponents} {...rest}>
|
|
59
65
|
{md}
|
|
60
66
|
</ReactMarkdown>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, ReactNode, useContext } from 'react';
|
|
2
|
-
import { BoxProps, createStylesContext, SpaceProps, useMultiStyleConfig } from '@chakra-ui/react';
|
|
2
|
+
import { BoxProps, createStylesContext, forwardRef, SpaceProps, useMultiStyleConfig } from '@chakra-ui/react';
|
|
3
3
|
import Box from '../Box/Box';
|
|
4
4
|
import Text from '../Text/Text';
|
|
5
5
|
import Divider from '../Divider/Divider';
|
|
@@ -57,17 +57,17 @@ export type SidebarProps = { children: ReactNode; title?: string } & Omit<
|
|
|
57
57
|
BoxProps,
|
|
58
58
|
'display' | 'd' | 'flexDirection' | 'flexDir' | 'as'
|
|
59
59
|
>;
|
|
60
|
-
const Sidebar = ({ children, title, ...boxProps }
|
|
60
|
+
const Sidebar = forwardRef<SidebarProps, 'nav'>(({ children, title, ...boxProps }, ref) => {
|
|
61
61
|
const theme = useMultiStyleConfig('Sidebar');
|
|
62
62
|
return (
|
|
63
63
|
<SidebarContext value={theme}>
|
|
64
|
-
<Box as="nav" display="flex" flexDirection="column" {...boxProps}>
|
|
64
|
+
<Box as="nav" display="flex" flexDirection="column" {...boxProps} ref={ref}>
|
|
65
65
|
<SidebarHeader title={title} />
|
|
66
66
|
{children}
|
|
67
67
|
</Box>
|
|
68
68
|
</SidebarContext>
|
|
69
69
|
);
|
|
70
|
-
};
|
|
70
|
+
});
|
|
71
71
|
|
|
72
72
|
const SidebarButton = ({ onClick, title }: Pick<BoxProps, 'onClick'> & { title: string }) => {
|
|
73
73
|
return (
|
|
@@ -3,6 +3,7 @@ import { chakra, ChakraProps, createStylesContext, IconProps, useMultiStyleConfi
|
|
|
3
3
|
import { DateTime } from 'luxon';
|
|
4
4
|
import Text from '../Text/Text';
|
|
5
5
|
import Icon, { TypeIconName } from '../Icon/Icon';
|
|
6
|
+
import Link from '../Link/Link';
|
|
6
7
|
|
|
7
8
|
type SidebarItemProps = {
|
|
8
9
|
children: ReactNode;
|
|
@@ -10,7 +11,17 @@ type SidebarItemProps = {
|
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
onClick?: () => void;
|
|
12
13
|
href?: string;
|
|
13
|
-
|
|
14
|
+
isExternal?: boolean;
|
|
15
|
+
} & (
|
|
16
|
+
| {
|
|
17
|
+
href: string;
|
|
18
|
+
isExternal?: boolean;
|
|
19
|
+
}
|
|
20
|
+
| {
|
|
21
|
+
onClick?: () => void;
|
|
22
|
+
isExternal?: never;
|
|
23
|
+
}
|
|
24
|
+
);
|
|
14
25
|
|
|
15
26
|
const [SidebarItemStyleProvider, useSidebarItemStyle] = createStylesContext('SidebarItem');
|
|
16
27
|
|
|
@@ -26,7 +37,7 @@ const sidebarVariant = ({ disabled, selected }: { selected?: boolean; disabled?:
|
|
|
26
37
|
|
|
27
38
|
const SidebarItem = forwardRef(
|
|
28
39
|
(
|
|
29
|
-
{ children, disabled, href, onClick, selected }: SidebarItemProps,
|
|
40
|
+
{ children, disabled, href, isExternal, onClick, selected }: SidebarItemProps,
|
|
30
41
|
ref: React.Ref<HTMLButtonElement & HTMLAnchorElement>,
|
|
31
42
|
) => {
|
|
32
43
|
const style = useMultiStyleConfig('SidebarItem', { variant: sidebarVariant({ disabled, selected }) });
|
|
@@ -41,7 +52,7 @@ const SidebarItem = forwardRef(
|
|
|
41
52
|
if (onClick || disabled) {
|
|
42
53
|
return <chakra.button ref={ref} disabled={disabled} {...shared} />;
|
|
43
54
|
}
|
|
44
|
-
return <
|
|
55
|
+
return <Link ref={ref} {...shared} isExternal={isExternal} />;
|
|
45
56
|
},
|
|
46
57
|
);
|
|
47
58
|
|