@bitrise/bitkit 10.4.1 → 10.5.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
|
@@ -31,12 +31,28 @@ export default {
|
|
|
31
31
|
},
|
|
32
32
|
} as ComponentMeta<typeof Notification>;
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
<Notification {...
|
|
34
|
+
const Template: ComponentStoryFn<typeof Notification> = ({ title, description, ...props }) => (
|
|
35
|
+
<Notification {...props}>
|
|
36
36
|
<NotificationTitle>{title}</NotificationTitle>
|
|
37
37
|
<NotificationText>{description}</NotificationText>
|
|
38
38
|
</Notification>
|
|
39
39
|
);
|
|
40
|
+
|
|
41
|
+
export const Default: ComponentStoryFn<typeof Notification> = (props) => <Template {...props} />;
|
|
40
42
|
Default.args = {
|
|
41
43
|
action: undefined,
|
|
42
44
|
};
|
|
45
|
+
|
|
46
|
+
export const WithCustomIcon: ComponentStoryFn<typeof Notification> = (props) => <Template {...props} />;
|
|
47
|
+
WithCustomIcon.storyName = 'With custom icon';
|
|
48
|
+
WithCustomIcon.args = {
|
|
49
|
+
action: undefined,
|
|
50
|
+
iconName: 'Bitbot',
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const WithoutIcon: ComponentStoryFn<typeof Notification> = (props) => <Template {...props} />;
|
|
54
|
+
WithoutIcon.storyName = 'Without icon';
|
|
55
|
+
WithoutIcon.args = {
|
|
56
|
+
action: undefined,
|
|
57
|
+
showIcon: false,
|
|
58
|
+
};
|
|
@@ -13,17 +13,17 @@ import { ColorScheme } from '@/Foundations/Colors/Colors';
|
|
|
13
13
|
import Box from '../Box/Box';
|
|
14
14
|
import CloseButton from '../CloseButton/CloseButton';
|
|
15
15
|
import ColorButton, { ColorButtonProps } from '../ColorButton/ColorButton';
|
|
16
|
-
import Icon from '../Icon/Icon';
|
|
16
|
+
import Icon, { TypeIconName } from '../Icon/Icon';
|
|
17
17
|
|
|
18
|
-
const STATUSES: Record<string, { colorScheme: ColorScheme;
|
|
19
|
-
info: { colorScheme: 'blue',
|
|
20
|
-
error: { colorScheme: 'red',
|
|
21
|
-
success: { colorScheme: 'green',
|
|
22
|
-
warning: { colorScheme: 'yellow',
|
|
18
|
+
const STATUSES: Record<string, { colorScheme: ColorScheme; defaultIcon: ReactNode }> = {
|
|
19
|
+
info: { colorScheme: 'blue', defaultIcon: <Icon name="Info" /> },
|
|
20
|
+
error: { colorScheme: 'red', defaultIcon: <Icon name="ErrorGeneral" /> },
|
|
21
|
+
success: { colorScheme: 'green', defaultIcon: <Icon name="Tick" /> },
|
|
22
|
+
warning: { colorScheme: 'yellow', defaultIcon: <Icon name="Warning" /> },
|
|
23
23
|
progress: {
|
|
24
24
|
colorScheme: 'purple',
|
|
25
|
-
|
|
26
|
-
<chakra.span w="24" h="24" p="2"
|
|
25
|
+
defaultIcon: (
|
|
26
|
+
<chakra.span w="24" h="24" p="2">
|
|
27
27
|
<Spinner w="100%" h="100%" />
|
|
28
28
|
</chakra.span>
|
|
29
29
|
),
|
|
@@ -38,6 +38,8 @@ export interface NotificationProps extends Omit<AlertProps, 'status' | 'colorSch
|
|
|
38
38
|
status: keyof typeof STATUSES;
|
|
39
39
|
onClose?: () => void;
|
|
40
40
|
action?: ActionProps;
|
|
41
|
+
iconName?: TypeIconName;
|
|
42
|
+
showIcon?: boolean;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
const ActionContext = createContext<{ colorScheme: ColorScheme }>({ colorScheme: 'blue' });
|
|
@@ -59,8 +61,9 @@ const NotificationAction = ({ label, href, ...rest }: ActionProps) => {
|
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
const Notification = forwardRef<NotificationProps, 'div'>((props, ref) => {
|
|
62
|
-
const { status, action, children, onClose, ...rest } = props;
|
|
63
|
-
const { colorScheme,
|
|
64
|
+
const { status, action, children, onClose, showIcon = true, iconName, ...rest } = props;
|
|
65
|
+
const { colorScheme, defaultIcon } = STATUSES[status];
|
|
66
|
+
const icon = iconName ? <Icon name={iconName} /> : defaultIcon;
|
|
64
67
|
let actionButton;
|
|
65
68
|
if (action) {
|
|
66
69
|
actionButton = <NotificationAction marginRight="12" {...action} alignSelf="center" />;
|
|
@@ -69,7 +72,7 @@ const Notification = forwardRef<NotificationProps, 'div'>((props, ref) => {
|
|
|
69
72
|
return (
|
|
70
73
|
<ChakraAlert ref={ref} {...rest} colorScheme={colorScheme}>
|
|
71
74
|
<ActionContext.Provider value={actionContext}>
|
|
72
|
-
{icon}
|
|
75
|
+
{showIcon && <Box flexShrink={0}>{icon}</Box>}
|
|
73
76
|
<Box wordBreak="break-word" display="flex" flexDirection="column" flexGrow={1}>
|
|
74
77
|
{children}
|
|
75
78
|
</Box>
|
|
@@ -2,6 +2,8 @@ import { createContext, useContext, useMemo } from 'react';
|
|
|
2
2
|
import { Alert as ChakraAlert, AlertProps, forwardRef } from '@chakra-ui/react';
|
|
3
3
|
|
|
4
4
|
import { ColorScheme } from '@/Foundations/Colors/Colors';
|
|
5
|
+
import { BREAKPOINTS } from '@/Foundations/Breakpoints/Breakpoints';
|
|
6
|
+
|
|
5
7
|
import CloseButton from '../CloseButton/CloseButton';
|
|
6
8
|
import ColorButton, { ColorButtonProps } from '../ColorButton/ColorButton';
|
|
7
9
|
import Icon from '../Icon/Icon';
|
|
@@ -61,9 +63,22 @@ const Ribbon = forwardRef<RibbonProps, 'div'>((props, ref) => {
|
|
|
61
63
|
{...rest}
|
|
62
64
|
>
|
|
63
65
|
<ActionContext.Provider value={actionContext}>
|
|
64
|
-
{onClose &&
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
{onClose && (
|
|
67
|
+
<Box
|
|
68
|
+
display={{ [BREAKPOINTS.MOBILE]: 'none', [BREAKPOINTS.DESKTOP]: 'block' }}
|
|
69
|
+
width={24}
|
|
70
|
+
height={24}
|
|
71
|
+
marginEnd="auto"
|
|
72
|
+
/>
|
|
73
|
+
)}
|
|
74
|
+
<Box
|
|
75
|
+
display="flex"
|
|
76
|
+
flexDirection={{ [BREAKPOINTS.MOBILE]: 'column', [BREAKPOINTS.DESKTOP]: 'row' }}
|
|
77
|
+
gap={{ [BREAKPOINTS.MOBILE]: 12, [BREAKPOINTS.DESKTOP]: 16 }}
|
|
78
|
+
>
|
|
79
|
+
{children}
|
|
80
|
+
{actionButton}
|
|
81
|
+
</Box>
|
|
67
82
|
{onClose && (
|
|
68
83
|
<CloseButton flexShrink={0} colorScheme={colorScheme} marginStart="auto" onClick={onClose}>
|
|
69
84
|
<Icon name="CloseSmall" />
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import Text, {
|
|
2
|
+
import Text, { TextProps } from '../../Components/Text/Text';
|
|
3
3
|
|
|
4
4
|
export type Props = TextProps;
|
|
5
5
|
|
|
6
6
|
/** Provides specific styling for an inline input label */
|
|
7
7
|
const InputInlineHelp: React.FunctionComponent<Props> = (props: Props) => {
|
|
8
|
-
return <Text
|
|
8
|
+
return <Text marginY="8" size="2" color="neutral.50" {...props} />;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export default InputInlineHelp;
|