@ornikar/kitt-universal 1.0.0 → 1.0.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 +4 -4
- package/CHANGELOG.md +0 -8
- package/src/.eslintrc.json +0 -19
- package/src/Avatar/Avatar.stories.tsx +0 -45
- package/src/Avatar/Avatar.tsx +0 -60
- package/src/Avatar/__snapshots__/Avatar.stories.tsx.snap +0 -1229
- package/src/Button/Button.stories.tsx +0 -301
- package/src/Button/Button.tsx +0 -60
- package/src/Button/ButtonContainer.tsx +0 -32
- package/src/Button/ButtonContent.tsx +0 -133
- package/src/Button/__snapshots__/Button.stories.tsx.snap +0 -7483
- package/src/Button/useButton.ts +0 -14
- package/src/Card/Card.stories.tsx +0 -31
- package/src/Card/Card.tsx +0 -25
- package/src/Card/__snapshots__/Card.stories.tsx.snap +0 -306
- package/src/FullScreenModal/Body.tsx +0 -25
- package/src/FullScreenModal/FullScreenModal.stories.tsx +0 -63
- package/src/FullScreenModal/FullScreenModal.tsx +0 -21
- package/src/FullScreenModal/Header.tsx +0 -129
- package/src/FullScreenModal/__snapshots__/FullScreenModal.stories.tsx.snap +0 -771
- package/src/Icon/Icon.stories.tsx +0 -59
- package/src/Icon/Icon.tsx +0 -37
- package/src/Icon/SpinningIcon.tsx +0 -38
- package/src/Icon/SpinningIcon.web.module.css +0 -13
- package/src/Icon/SpinningIcon.web.module.css.d.ts +0 -6
- package/src/Icon/SpinningIcon.web.tsx +0 -11
- package/src/Icon/__snapshots__/Icon.stories.tsx.snap +0 -5648
- package/src/KittBreakpoints.ts +0 -44
- package/src/ListItem/ListItem.stories.tsx +0 -122
- package/src/ListItem/ListItem.tsx +0 -61
- package/src/ListItem/ListItemContent.tsx +0 -17
- package/src/ListItem/ListItemSideContent.tsx +0 -41
- package/src/ListItem/__snapshots__/ListItem.stories.tsx.snap +0 -1514
- package/src/Loader/LargeLoader.tsx +0 -12
- package/src/Loader/LargeLoader.web.module.css +0 -103
- package/src/Loader/LargeLoader.web.module.css.d.ts +0 -11
- package/src/Loader/LargeLoader.web.test.tsx +0 -10
- package/src/Loader/LargeLoader.web.tsx +0 -18
- package/src/Loader/Loader.stories.tsx +0 -47
- package/src/Loader/Loader.tsx +0 -21
- package/src/Loader/Loader.web.test.tsx +0 -20
- package/src/Loader/Loader.web.tsx +0 -14
- package/src/Loader/__snapshots__/LargeLoader.web.test.tsx.snap +0 -33
- package/src/Loader/__snapshots__/Loader.stories.tsx.snap +0 -607
- package/src/Loader/__snapshots__/Loader.web.test.tsx.snap +0 -103
- package/src/Message/Message.stories.tsx +0 -102
- package/src/Message/Message.tsx +0 -114
- package/src/Message/__snapshots__/Message.stories.tsx.snap +0 -2776
- package/src/Modal/Body.tsx +0 -20
- package/src/Modal/Footer.tsx +0 -18
- package/src/Modal/Header.tsx +0 -66
- package/src/Modal/Modal.stories.tsx +0 -181
- package/src/Modal/Modal.tsx +0 -66
- package/src/Modal/OnCloseContext.ts +0 -3
- package/src/Modal/__snapshots__/Modal.stories.tsx.snap +0 -2960
- package/src/Notification/Notification.stories.tsx +0 -102
- package/src/Notification/Notification.tsx +0 -21
- package/src/Notification/__snapshots__/Notification.stories.tsx.snap +0 -2861
- package/src/Overlay/Overlay.tsx +0 -22
- package/src/Tag/Tag.stories.tsx +0 -18
- package/src/Tag/Tag.tsx +0 -31
- package/src/Tag/__snapshots__/Tag.stories.tsx.snap +0 -303
- package/src/Tooltip/Tooltip.tsx +0 -17
- package/src/__mocks__/react-native-safe-area-context.tsx +0 -26
- package/src/forms/InputFeedback/InputFeedback.stories.tsx +0 -17
- package/src/forms/InputFeedback/InputFeedback.tsx +0 -28
- package/src/forms/InputFeedback/__snapshots__/InputFeedback.stories.tsx.snap +0 -252
- package/src/forms/InputField/InputField.stories.tsx +0 -19
- package/src/forms/InputField/InputField.tsx +0 -45
- package/src/forms/InputField/__snapshots__/InputField.stories.tsx.snap +0 -240
- package/src/forms/InputFormState.ts +0 -1
- package/src/forms/InputText/InputText.stories.tsx +0 -85
- package/src/forms/InputText/InputText.tsx +0 -172
- package/src/forms/InputText/__snapshots__/InputText.stories.tsx.snap +0 -4274
- package/src/forms/InputText/useInputText.ts +0 -19
- package/src/forms/Label/Label.stories.tsx +0 -14
- package/src/forms/Label/Label.tsx +0 -17
- package/src/forms/Label/__snapshots__/Label.stories.tsx.snap +0 -174
- package/src/forms/Radio/Radio.stories.tsx +0 -48
- package/src/forms/Radio/Radio.tsx +0 -81
- package/src/forms/Radio/__snapshots__/Radio.stories.tsx.snap +0 -967
- package/src/forms/TextArea/TextArea.stories.tsx +0 -72
- package/src/forms/TextArea/TextArea.tsx +0 -12
- package/src/forms/TextArea/__snapshots__/TextArea.stories.tsx.snap +0 -2091
- package/src/index.ts +0 -61
- package/src/stories/Block.tsx +0 -24
- package/src/stories/Flex.tsx +0 -16
- package/src/stories/color-tokens.stories.tsx +0 -143
- package/src/stories-list.ts +0 -22
- package/src/story-components/Section.tsx +0 -56
- package/src/story-components/Story.tsx +0 -24
- package/src/story-components/StoryDecorator.tsx +0 -8
- package/src/story-components/StoryGrid.tsx +0 -80
- package/src/story-components/StoryTitle.stories.tsx +0 -12
- package/src/story-components/StoryTitle.tsx +0 -69
- package/src/story-components/__snapshots__/StoryTitle.stories.tsx.snap +0 -155
- package/src/story-components/index.ts +0 -5
- package/src/themes/default.ts +0 -34
- package/src/themes/late-ocean/avatarLateOceanTheme.ts +0 -12
- package/src/themes/late-ocean/buttonLateOceanTheme.ts +0 -37
- package/src/themes/late-ocean/cardLateOceanTheme.ts +0 -19
- package/src/themes/late-ocean/colorsLateOceanTheme.ts +0 -19
- package/src/themes/late-ocean/feedbackMessageLateOceanTheme.ts +0 -10
- package/src/themes/late-ocean/formLateOceanTheme.ts +0 -9
- package/src/themes/late-ocean/fullScreenModalLateOceanTheme.ts +0 -9
- package/src/themes/late-ocean/inputFieldLateOceanTheme.ts +0 -4
- package/src/themes/late-ocean/inputLateOceanTheme.ts +0 -55
- package/src/themes/late-ocean/listItemLateOceanTheme.ts +0 -8
- package/src/themes/late-ocean/radioLateOceanTheme.ts +0 -19
- package/src/themes/late-ocean/shadowsLateOceanTheme.ts +0 -3
- package/src/themes/late-ocean/tagLateOceanTheme.ts +0 -17
- package/src/themes/late-ocean/typographyLateOceanTheme.ts +0 -94
- package/src/themes/palettes/lateOceanColorPalette.ts +0 -24
- package/src/typings/babel-config.d.ts +0 -6
- package/src/typings/metro.d.ts +0 -6
- package/src/typography/Typography.stories.tsx +0 -113
- package/src/typography/Typography.tsx +0 -165
- package/src/typography/TypographyIcon.stories.tsx +0 -31
- package/src/typography/TypographyIcon.tsx +0 -35
- package/src/typography/TypographyLink.stories.tsx +0 -88
- package/src/typography/TypographyLink.tsx +0 -48
- package/src/typography/__snapshots__/Typography.stories.tsx.snap +0 -6118
- package/src/typography/__snapshots__/TypographyIcon.stories.tsx.snap +0 -334
- package/src/typography/__snapshots__/TypographyLink.stories.tsx.snap +0 -10945
- package/src/useKittTheme.tsx +0 -12
- package/src/utils/storybook/decorators/KittThemeDecorator.tsx +0 -27
- package/src/utils/storybook/decorators/SafeAreaProviderDecorator.tsx +0 -11
- package/src/utils/storybook/setup-global-decorators.ts +0 -6
- package/src/utils/tests/renderWithProvidersUtils.tsx +0 -17
- package/src/utils/typeUtils.ts +0 -6
- package/src/utils/windowSize/MatchWindowSize.tsx +0 -14
- package/src/utils/windowSize/__snapshots__/windowSize.stories.tsx.snap +0 -1485
- package/src/utils/windowSize/createWindowSizeHelper.test.ts +0 -11
- package/src/utils/windowSize/createWindowSizeHelper.ts +0 -65
- package/src/utils/windowSize/useMatchWindowSize.ts +0 -14
- package/src/utils/windowSize/useWindowSize.ts +0 -1
- package/src/utils/windowSize/windowSize.stories.tsx +0 -115
- package/tsconfig.build.json +0 -33
- package/tsconfig.json +0 -13
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { storiesOf } from '@storybook/react-native';
|
|
3
|
-
import { Section, Story } from '@ornikar/kitt-universal';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { Typography } from '../typography/Typography';
|
|
6
|
-
import { Message } from './Message';
|
|
7
|
-
|
|
8
|
-
storiesOf('kitt-universal/Feedback', module).add('Message', () => (
|
|
9
|
-
<Story title="Message">
|
|
10
|
-
<Section.DemoSection>
|
|
11
|
-
<Message>Info message goes here...</Message>
|
|
12
|
-
</Section.DemoSection>
|
|
13
|
-
<Section title="Classic">
|
|
14
|
-
<Section.SubSection title="Info">
|
|
15
|
-
<Message>Info message goes here...</Message>
|
|
16
|
-
</Section.SubSection>
|
|
17
|
-
<Section.SubSection title="Confirmation">
|
|
18
|
-
<Message type="success">Confirmation message goes here...</Message>
|
|
19
|
-
</Section.SubSection>
|
|
20
|
-
<Section.SubSection title="Warning">
|
|
21
|
-
<Message type="warning">Warning message goes here...</Message>
|
|
22
|
-
</Section.SubSection>
|
|
23
|
-
<Section.SubSection title="Error">
|
|
24
|
-
<Message type="danger">Error message goes here...</Message>
|
|
25
|
-
</Section.SubSection>
|
|
26
|
-
</Section>
|
|
27
|
-
<Section title="Classic - Centered Text">
|
|
28
|
-
<Section.SubSection title="Info">
|
|
29
|
-
<Message centeredText>Info message goes here...</Message>
|
|
30
|
-
</Section.SubSection>
|
|
31
|
-
<Section.SubSection title="Confirmation">
|
|
32
|
-
<Message centeredText type="success">
|
|
33
|
-
Confirmation message goes here...
|
|
34
|
-
</Message>
|
|
35
|
-
</Section.SubSection>
|
|
36
|
-
<Section.SubSection title="Warning">
|
|
37
|
-
<Message centeredText type="warning">
|
|
38
|
-
Warning message goes here...
|
|
39
|
-
</Message>
|
|
40
|
-
</Section.SubSection>
|
|
41
|
-
<Section.SubSection title="Error">
|
|
42
|
-
<Message centeredText type="danger">
|
|
43
|
-
Error message goes here...
|
|
44
|
-
</Message>
|
|
45
|
-
</Section.SubSection>
|
|
46
|
-
</Section>
|
|
47
|
-
<Section title="Dismissable">
|
|
48
|
-
<Section.SubSection title="Info">
|
|
49
|
-
<Message onDismiss={action('dismiss')}>Info message goes here...</Message>
|
|
50
|
-
</Section.SubSection>
|
|
51
|
-
<Section.SubSection title="Confirmation">
|
|
52
|
-
<Message type="success" onDismiss={action('dismiss')}>
|
|
53
|
-
Confirmation message goes here...
|
|
54
|
-
</Message>
|
|
55
|
-
</Section.SubSection>
|
|
56
|
-
<Section.SubSection title="Warning">
|
|
57
|
-
<Message type="warning" onDismiss={action('dismiss')}>
|
|
58
|
-
Warning message goes here...
|
|
59
|
-
</Message>
|
|
60
|
-
</Section.SubSection>
|
|
61
|
-
<Section.SubSection title="Error">
|
|
62
|
-
<Message type="danger" onDismiss={action('dismiss')}>
|
|
63
|
-
Error message goes here...
|
|
64
|
-
</Message>
|
|
65
|
-
</Section.SubSection>
|
|
66
|
-
</Section>
|
|
67
|
-
<Section title="Classic - with title">
|
|
68
|
-
<Section.SubSection title="Info">
|
|
69
|
-
<Message onDismiss={action('dismiss')}>
|
|
70
|
-
<Typography.Text base="body" variant="bold">
|
|
71
|
-
This is a title{'\n'}
|
|
72
|
-
</Typography.Text>
|
|
73
|
-
<Typography.Text base="body-small">Info message goes here...</Typography.Text>
|
|
74
|
-
</Message>
|
|
75
|
-
</Section.SubSection>
|
|
76
|
-
<Section.SubSection title="Confirmation">
|
|
77
|
-
<Message type="success" onDismiss={action('dismiss')}>
|
|
78
|
-
<Typography.Text base="body" variant="bold">
|
|
79
|
-
This is a title{'\n'}
|
|
80
|
-
</Typography.Text>
|
|
81
|
-
<Typography.Text base="body-small">Confirmation message goes here...</Typography.Text>
|
|
82
|
-
</Message>
|
|
83
|
-
</Section.SubSection>
|
|
84
|
-
<Section.SubSection title="Warning">
|
|
85
|
-
<Message type="warning" onDismiss={action('dismiss')}>
|
|
86
|
-
<Typography.Text base="body" variant="bold">
|
|
87
|
-
This is a title{'\n'}
|
|
88
|
-
</Typography.Text>
|
|
89
|
-
<Typography.Text base="body-small">Warning message goes here...</Typography.Text>
|
|
90
|
-
</Message>
|
|
91
|
-
</Section.SubSection>
|
|
92
|
-
<Section.SubSection title="Error">
|
|
93
|
-
<Message type="danger" onDismiss={action('dismiss')}>
|
|
94
|
-
<Typography.Text base="body" variant="bold">
|
|
95
|
-
This is a title{'\n'}
|
|
96
|
-
</Typography.Text>
|
|
97
|
-
<Typography.Text base="body-small">Error message goes here...</Typography.Text>
|
|
98
|
-
</Message>
|
|
99
|
-
</Section.SubSection>
|
|
100
|
-
</Section>
|
|
101
|
-
</Story>
|
|
102
|
-
));
|
package/src/Message/Message.tsx
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { AlertCircleIcon, AlertTriangleIcon, CheckIcon, InfoIcon, XIcon } from '@ornikar/kitt-icons';
|
|
2
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import styled from 'styled-components/native';
|
|
5
|
-
import { Icon } from '../Icon/Icon';
|
|
6
|
-
import type { TypographyColor } from '../typography/Typography';
|
|
7
|
-
import { Typography } from '../typography/Typography';
|
|
8
|
-
|
|
9
|
-
export type MessageType = 'success' | 'warning' | 'danger' | 'info';
|
|
10
|
-
|
|
11
|
-
const xIconSize = 14;
|
|
12
|
-
const mainIconSize = 20;
|
|
13
|
-
|
|
14
|
-
export interface MessageProps {
|
|
15
|
-
type?: MessageType;
|
|
16
|
-
children: NonNullable<ReactNode>;
|
|
17
|
-
noRadius?: boolean;
|
|
18
|
-
centeredText?: boolean;
|
|
19
|
-
insets?: { top?: number };
|
|
20
|
-
onDismiss?: () => void;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface ContainerProps {
|
|
24
|
-
type: MessageType;
|
|
25
|
-
noRadius: boolean;
|
|
26
|
-
insets: MessageProps['insets'];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const Container = styled.View<ContainerProps>`
|
|
30
|
-
border-radius: ${({ theme, noRadius }) => (noRadius ? 0 : theme.kitt.spacing * 5)}px;
|
|
31
|
-
background-color: ${({ theme, type }) => theme.kitt.feedbackMessage.backgroundColors[type]};
|
|
32
|
-
padding-bottom: ${({ theme }) => theme.kitt.spacing * 4}px;
|
|
33
|
-
padding-left: ${({ theme }) => theme.kitt.spacing * 4}px;
|
|
34
|
-
padding-right: ${({ theme }) => theme.kitt.spacing * 4}px;
|
|
35
|
-
padding-top: ${({ theme, insets }) => (insets?.top ?? 0) + theme.kitt.spacing * 4}px;
|
|
36
|
-
flex-direction: row;
|
|
37
|
-
align-items: flex-start;
|
|
38
|
-
justify-content: space-between;
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
|
-
const CloseContainer = styled.TouchableOpacity`
|
|
42
|
-
margin-left: ${({ theme }) => theme.kitt.spacing * 4}px;
|
|
43
|
-
padding: ${({ theme }) => theme.kitt.spacing}px;
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
const IconContainer = styled.View`
|
|
47
|
-
margin-right: ${({ theme }) => theme.kitt.spacing * 4}px;
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
interface ContentProps {
|
|
51
|
-
type: MessageType;
|
|
52
|
-
centeredText: boolean;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const Content = styled.Text<ContentProps>`
|
|
56
|
-
text-align: ${({ centeredText }) => (centeredText ? 'center' : 'left')};
|
|
57
|
-
flex: 1;
|
|
58
|
-
`;
|
|
59
|
-
|
|
60
|
-
const getColorByType = (type: MessageType): TypographyColor => {
|
|
61
|
-
switch (type) {
|
|
62
|
-
case 'success':
|
|
63
|
-
return 'white';
|
|
64
|
-
case 'danger':
|
|
65
|
-
return 'white';
|
|
66
|
-
case 'warning':
|
|
67
|
-
default:
|
|
68
|
-
return 'black';
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
function getIconContent(type: MessageType): ReactElement {
|
|
73
|
-
switch (type) {
|
|
74
|
-
case 'warning':
|
|
75
|
-
return <AlertCircleIcon />;
|
|
76
|
-
case 'success':
|
|
77
|
-
return <CheckIcon />;
|
|
78
|
-
case 'danger':
|
|
79
|
-
return <AlertTriangleIcon />;
|
|
80
|
-
default:
|
|
81
|
-
return <InfoIcon />;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function Message({
|
|
86
|
-
type = 'info',
|
|
87
|
-
children,
|
|
88
|
-
noRadius = false,
|
|
89
|
-
centeredText = false,
|
|
90
|
-
onDismiss,
|
|
91
|
-
insets,
|
|
92
|
-
}: MessageProps): ReactElement {
|
|
93
|
-
const color = getColorByType(type);
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<Container type={type} noRadius={noRadius} insets={insets}>
|
|
97
|
-
{!centeredText ? (
|
|
98
|
-
<IconContainer>
|
|
99
|
-
<Icon size={mainIconSize} color={color} icon={getIconContent(type)} />
|
|
100
|
-
</IconContainer>
|
|
101
|
-
) : null}
|
|
102
|
-
<Content type={type} centeredText={centeredText}>
|
|
103
|
-
<Typography.Text base="body-small" color={color}>
|
|
104
|
-
{children}
|
|
105
|
-
</Typography.Text>
|
|
106
|
-
</Content>
|
|
107
|
-
{onDismiss ? (
|
|
108
|
-
<CloseContainer onPress={onDismiss}>
|
|
109
|
-
<Icon icon={<XIcon />} size={xIconSize} color={color} />
|
|
110
|
-
</CloseContainer>
|
|
111
|
-
) : null}
|
|
112
|
-
</Container>
|
|
113
|
-
);
|
|
114
|
-
}
|