@ornikar/kitt-universal 1.0.0-pre
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/dist/index-browser-all-dev.es.js +1934 -0
- package/dist/index-browser-all-dev.es.js.map +1 -0
- package/dist/index-browser-all.es.js +1920 -0
- package/dist/index-browser-all.es.js.map +1 -0
- package/dist/index-node-12.13-dev.cjs.js +2059 -0
- package/dist/index-node-12.13-dev.cjs.js.map +1 -0
- package/dist/index-node-12.13.cjs.js +2048 -0
- package/dist/index-node-12.13.cjs.js.map +1 -0
- package/index.js +7 -0
- package/package.json +61 -0
- package/src/.eslintrc.json +42 -0
- package/src/Avatar/Avatar.stories.tsx +47 -0
- package/src/Avatar/Avatar.tsx +60 -0
- package/src/Avatar/__snapshots__/Avatar.stories.tsx.snap +1229 -0
- package/src/Button/Button.stories.tsx +303 -0
- package/src/Button/Button.tsx +60 -0
- package/src/Button/ButtonContainer.tsx +32 -0
- package/src/Button/ButtonContent.tsx +133 -0
- package/src/Button/__snapshots__/Button.stories.tsx.snap +7483 -0
- package/src/Button/useButton.ts +14 -0
- package/src/Card/Card.stories.tsx +33 -0
- package/src/Card/Card.tsx +25 -0
- package/src/Card/__snapshots__/Card.stories.tsx.snap +306 -0
- package/src/FullScreenModal/Body.tsx +25 -0
- package/src/FullScreenModal/FullScreenModal.stories.tsx +65 -0
- package/src/FullScreenModal/FullScreenModal.tsx +21 -0
- package/src/FullScreenModal/Header.tsx +129 -0
- package/src/FullScreenModal/__snapshots__/FullScreenModal.stories.tsx.snap +771 -0
- package/src/Icon/Icon.stories.tsx +61 -0
- package/src/Icon/Icon.tsx +37 -0
- package/src/Icon/SpinningIcon.tsx +38 -0
- package/src/Icon/SpinningIcon.web.css +13 -0
- package/src/Icon/SpinningIcon.web.tsx +11 -0
- package/src/Icon/__snapshots__/Icon.stories.tsx.snap +5648 -0
- package/src/KittBreakpoints.ts +44 -0
- package/src/KittThemeProvider.tsx +30 -0
- package/src/ListItem/ListItem.stories.tsx +124 -0
- package/src/ListItem/ListItem.tsx +61 -0
- package/src/ListItem/ListItemContent.tsx +17 -0
- package/src/ListItem/ListItemSideContent.tsx +41 -0
- package/src/ListItem/__snapshots__/ListItem.stories.tsx.snap +1514 -0
- package/src/Loader/LargeLoader.tsx +12 -0
- package/src/Loader/LargeLoader.web.css +103 -0
- package/src/Loader/LargeLoader.web.test.tsx +10 -0
- package/src/Loader/LargeLoader.web.tsx +18 -0
- package/src/Loader/Loader.stories.tsx +49 -0
- package/src/Loader/Loader.tsx +21 -0
- package/src/Loader/Loader.web.test.tsx +20 -0
- package/src/Loader/Loader.web.tsx +14 -0
- package/src/Loader/__snapshots__/LargeLoader.web.test.tsx.snap +33 -0
- package/src/Loader/__snapshots__/Loader.stories.tsx.snap +607 -0
- package/src/Loader/__snapshots__/Loader.web.test.tsx.snap +103 -0
- package/src/Message/Message.stories.tsx +104 -0
- package/src/Message/Message.tsx +114 -0
- package/src/Message/__snapshots__/Message.stories.tsx.snap +2776 -0
- package/src/Modal/Body.tsx +20 -0
- package/src/Modal/Footer.tsx +18 -0
- package/src/Modal/Header.tsx +66 -0
- package/src/Modal/Modal.stories.tsx +183 -0
- package/src/Modal/Modal.tsx +66 -0
- package/src/Modal/OnCloseContext.ts +3 -0
- package/src/Modal/__snapshots__/Modal.stories.tsx.snap +2960 -0
- package/src/Notification/Notification.stories.tsx +103 -0
- package/src/Notification/Notification.tsx +21 -0
- package/src/Notification/__snapshots__/Notification.stories.tsx.snap +2861 -0
- package/src/Overlay/Overlay.tsx +22 -0
- package/src/Tag/Tag.stories.tsx +19 -0
- package/src/Tag/Tag.tsx +31 -0
- package/src/Tag/__snapshots__/Tag.stories.tsx.snap +303 -0
- package/src/Tooltip/Tooltip.tsx +17 -0
- package/src/__mocks__/react-native-safe-area-context.tsx +26 -0
- package/src/forms/InputFeedback/InputFeedback.stories.tsx +20 -0
- package/src/forms/InputFeedback/InputFeedback.tsx +28 -0
- package/src/forms/InputFeedback/__snapshots__/InputFeedback.stories.tsx.snap +252 -0
- package/src/forms/InputField/InputField.stories.tsx +21 -0
- package/src/forms/InputField/InputField.tsx +45 -0
- package/src/forms/InputField/__snapshots__/InputField.stories.tsx.snap +240 -0
- package/src/forms/InputFormState.ts +1 -0
- package/src/forms/InputText/InputText.stories.tsx +87 -0
- package/src/forms/InputText/InputText.tsx +172 -0
- package/src/forms/InputText/__snapshots__/InputText.stories.tsx.snap +4274 -0
- package/src/forms/InputText/useInputText.ts +19 -0
- package/src/forms/Label/Label.stories.tsx +16 -0
- package/src/forms/Label/Label.tsx +17 -0
- package/src/forms/Label/__snapshots__/Label.stories.tsx.snap +174 -0
- package/src/forms/Radio/Radio.stories.tsx +50 -0
- package/src/forms/Radio/Radio.tsx +81 -0
- package/src/forms/Radio/__snapshots__/Radio.stories.tsx.snap +967 -0
- package/src/forms/TextArea/TextArea.stories.tsx +74 -0
- package/src/forms/TextArea/TextArea.tsx +12 -0
- package/src/forms/TextArea/__snapshots__/TextArea.stories.tsx.snap +2091 -0
- package/src/index.ts +43 -0
- package/src/stories/Block.tsx +24 -0
- package/src/stories/Flex.tsx +16 -0
- package/src/stories/color-tokens.stories.tsx +143 -0
- package/src/stories-list.tsx +22 -0
- package/src/story-components/Section.tsx +56 -0
- package/src/story-components/Story.tsx +24 -0
- package/src/story-components/StoryDecorator.tsx +8 -0
- package/src/story-components/StoryGrid.tsx +80 -0
- package/src/story-components/StoryTitle.stories.tsx +12 -0
- package/src/story-components/StoryTitle.tsx +69 -0
- package/src/story-components/__snapshots__/StoryTitle.stories.tsx.snap +155 -0
- package/src/story-components/index.ts +13 -0
- package/src/themes/default.ts +34 -0
- package/src/themes/late-ocean/avatarLateOceanTheme.ts +12 -0
- package/src/themes/late-ocean/buttonLateOceanTheme.ts +37 -0
- package/src/themes/late-ocean/cardLateOceanTheme.ts +19 -0
- package/src/themes/late-ocean/colorsLateOceanTheme.ts +19 -0
- package/src/themes/late-ocean/feedbackMessageLateOceanTheme.ts +10 -0
- package/src/themes/late-ocean/formLateOceanTheme.ts +9 -0
- package/src/themes/late-ocean/fullScreenModalLateOceanTheme.ts +8 -0
- package/src/themes/late-ocean/inputFieldLateOceanTheme.ts +4 -0
- package/src/themes/late-ocean/inputLateOceanTheme.ts +55 -0
- package/src/themes/late-ocean/listItemLateOceanTheme.ts +8 -0
- package/src/themes/late-ocean/radioLateOceanTheme.ts +19 -0
- package/src/themes/late-ocean/shadowsLateOceanTheme.ts +3 -0
- package/src/themes/late-ocean/tagLateOceanTheme.ts +17 -0
- package/src/themes/late-ocean/typographyLateOceanTheme.ts +94 -0
- package/src/themes/palettes/lateOceanColorPalette.ts +24 -0
- package/src/typings/babel-config.d.ts +6 -0
- package/src/typings/metro.d.ts +6 -0
- package/src/typography/Typography.stories.tsx +115 -0
- package/src/typography/Typography.tsx +165 -0
- package/src/typography/TypographyIcon.stories.tsx +32 -0
- package/src/typography/TypographyIcon.tsx +35 -0
- package/src/typography/TypographyLink.stories.tsx +89 -0
- package/src/typography/TypographyLink.tsx +48 -0
- package/src/typography/__snapshots__/Typography.stories.tsx.snap +6118 -0
- package/src/typography/__snapshots__/TypographyIcon.stories.tsx.snap +334 -0
- package/src/typography/__snapshots__/TypographyLink.stories.tsx.snap +10945 -0
- package/src/utils/storybook/decorators/KittThemeDecorator.tsx +11 -0
- package/src/utils/storybook/decorators/SafeAreaProviderDecorator.tsx +11 -0
- package/src/utils/storybook/setup-global-decorators.ts +6 -0
- package/src/utils/tests/renderWithProvidersUtils.tsx +17 -0
- package/src/utils/typeUtils.ts +6 -0
- package/src/utils/windowSize/MatchWindowSize.tsx +14 -0
- package/src/utils/windowSize/__snapshots__/windowSize.stories.tsx.snap +1485 -0
- package/src/utils/windowSize/createWindowSizeHelper.test.ts +11 -0
- package/src/utils/windowSize/createWindowSizeHelper.ts +65 -0
- package/src/utils/windowSize/useMatchWindowSize.ts +14 -0
- package/src/utils/windowSize/useWindowSize.ts +1 -0
- package/src/utils/windowSize/windowSize.stories.tsx +116 -0
- package/tsconfig.build.json +30 -0
- package/tsconfig.json +13 -0
- package/yarn-error.log +22274 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const KittBreakpoints = {
|
|
2
|
+
/**
|
|
3
|
+
* min-width: 0
|
|
4
|
+
*/
|
|
5
|
+
BASE: 0,
|
|
6
|
+
/**
|
|
7
|
+
* min-width: 480px
|
|
8
|
+
*/
|
|
9
|
+
SMALL: 480,
|
|
10
|
+
/**
|
|
11
|
+
* min-width: 768px
|
|
12
|
+
*/
|
|
13
|
+
MEDIUM: 768,
|
|
14
|
+
/**
|
|
15
|
+
* min-width: 1024px
|
|
16
|
+
*/
|
|
17
|
+
LARGE: 1024,
|
|
18
|
+
/**
|
|
19
|
+
* min-width: 1280px
|
|
20
|
+
*/
|
|
21
|
+
WIDE: 1280,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const KittBreakpointsMax = {
|
|
25
|
+
/**
|
|
26
|
+
* max-width: 479px
|
|
27
|
+
*/
|
|
28
|
+
BASE: KittBreakpoints.SMALL - 1,
|
|
29
|
+
/**
|
|
30
|
+
* max-width: 767px
|
|
31
|
+
*/
|
|
32
|
+
SMALL: KittBreakpoints.MEDIUM - 1,
|
|
33
|
+
/**
|
|
34
|
+
* max-width: 1023px
|
|
35
|
+
*/
|
|
36
|
+
MEDIUM: KittBreakpoints.LARGE - 1,
|
|
37
|
+
/**
|
|
38
|
+
* max-width: 1279px
|
|
39
|
+
*/
|
|
40
|
+
LARGE: KittBreakpoints.WIDE - 1,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type KittBreakpoint = typeof KittBreakpoints[keyof typeof KittBreakpoints];
|
|
44
|
+
export type KittBreakpointMax = typeof KittBreakpointsMax[keyof typeof KittBreakpointsMax];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
|
+
import { ThemeProvider as SCThemeProvider } from 'styled-components/native';
|
|
4
|
+
import type { KittTheme } from './themes/default';
|
|
5
|
+
import { theme as kittTheme } from './themes/default';
|
|
6
|
+
import { createWindowSizeHelper } from './utils/windowSize/createWindowSizeHelper';
|
|
7
|
+
import { useWindowSize } from './utils/windowSize/useWindowSize';
|
|
8
|
+
|
|
9
|
+
interface BasicAppTheme extends Record<string, unknown> {}
|
|
10
|
+
|
|
11
|
+
interface ThemeProviderProps<AppTheme> {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
appTheme?: AppTheme;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function KittThemeProvider<AppTheme extends BasicAppTheme>({
|
|
17
|
+
children,
|
|
18
|
+
appTheme = {} as AppTheme,
|
|
19
|
+
}: ThemeProviderProps<AppTheme>): ReactElement {
|
|
20
|
+
const { width } = useWindowSize();
|
|
21
|
+
const themeWithWindowSizeHelper = useMemo(() => {
|
|
22
|
+
return { kitt: kittTheme, ...appTheme, responsive: createWindowSizeHelper(width) };
|
|
23
|
+
}, [width, appTheme]);
|
|
24
|
+
|
|
25
|
+
return <SCThemeProvider theme={themeWithWindowSizeHelper}>{children}</SCThemeProvider>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare module 'styled-components' {
|
|
29
|
+
export interface DefaultTheme extends KittTheme, BasicAppTheme {}
|
|
30
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { storiesOf } from '@storybook/react-native';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Avatar, ChevronRightIcon, Typography, TypographyIcon, UserIcon } from '..';
|
|
5
|
+
import { StoryComponents } from '../story-components';
|
|
6
|
+
import { ListItem } from './ListItem';
|
|
7
|
+
|
|
8
|
+
const { Section, Story } = StoryComponents;
|
|
9
|
+
|
|
10
|
+
storiesOf('Kitt/Data Display', module).add('List Item', () => (
|
|
11
|
+
<Story title="List Item">
|
|
12
|
+
<Section.DemoSection>
|
|
13
|
+
<ListItem
|
|
14
|
+
withPadding
|
|
15
|
+
borders="both"
|
|
16
|
+
left={
|
|
17
|
+
<ListItem.SideContent>
|
|
18
|
+
<Avatar />
|
|
19
|
+
</ListItem.SideContent>
|
|
20
|
+
}
|
|
21
|
+
right={
|
|
22
|
+
<ListItem.SideContent align="center">
|
|
23
|
+
<TypographyIcon icon={<ChevronRightIcon />} />
|
|
24
|
+
</ListItem.SideContent>
|
|
25
|
+
}
|
|
26
|
+
onPress={action('On Press')}
|
|
27
|
+
>
|
|
28
|
+
<Typography.Text base="body" ellipsizeMode="tail" numberOfLines={2}>
|
|
29
|
+
List Item - Demo
|
|
30
|
+
</Typography.Text>
|
|
31
|
+
</ListItem>
|
|
32
|
+
</Section.DemoSection>
|
|
33
|
+
|
|
34
|
+
<Section title="Default">
|
|
35
|
+
<ListItem onPress={action('On Press')}>
|
|
36
|
+
<Typography.Text base="body">List Item - Default</Typography.Text>
|
|
37
|
+
</ListItem>
|
|
38
|
+
</Section>
|
|
39
|
+
|
|
40
|
+
<Section title="With Padding">
|
|
41
|
+
<ListItem withPadding onPress={action('On Press')}>
|
|
42
|
+
<Typography.Text base="body">List Item - With Padding</Typography.Text>
|
|
43
|
+
</ListItem>
|
|
44
|
+
</Section>
|
|
45
|
+
|
|
46
|
+
<Section title="With Borders">
|
|
47
|
+
<ListItem borders="both" onPress={action('On Press')}>
|
|
48
|
+
<Typography.Text base="body">List Item - With Borders</Typography.Text>
|
|
49
|
+
</ListItem>
|
|
50
|
+
</Section>
|
|
51
|
+
|
|
52
|
+
<Section title="With Right Content">
|
|
53
|
+
<Section.SubSection title="center">
|
|
54
|
+
<ListItem
|
|
55
|
+
right={
|
|
56
|
+
<ListItem.SideContent align="center">
|
|
57
|
+
<TypographyIcon icon={<ChevronRightIcon />} />
|
|
58
|
+
</ListItem.SideContent>
|
|
59
|
+
}
|
|
60
|
+
>
|
|
61
|
+
<Typography.Text base="body">List Item - With Centered Right Content</Typography.Text>
|
|
62
|
+
</ListItem>
|
|
63
|
+
</Section.SubSection>
|
|
64
|
+
|
|
65
|
+
<Section.SubSection title="flex-end">
|
|
66
|
+
<ListItem
|
|
67
|
+
right={
|
|
68
|
+
<ListItem.SideContent align="flex-end">
|
|
69
|
+
<TypographyIcon icon={<ChevronRightIcon />} />
|
|
70
|
+
</ListItem.SideContent>
|
|
71
|
+
}
|
|
72
|
+
>
|
|
73
|
+
<Typography.Text base="body">List Item - With Centered Right Content</Typography.Text>
|
|
74
|
+
</ListItem>
|
|
75
|
+
</Section.SubSection>
|
|
76
|
+
</Section>
|
|
77
|
+
|
|
78
|
+
<Section title="With Left Content">
|
|
79
|
+
<Section.SubSection title="center">
|
|
80
|
+
<ListItem
|
|
81
|
+
left={
|
|
82
|
+
<ListItem.SideContent align="center">
|
|
83
|
+
<TypographyIcon icon={<UserIcon />} align="center" />
|
|
84
|
+
</ListItem.SideContent>
|
|
85
|
+
}
|
|
86
|
+
>
|
|
87
|
+
<Typography.Text base="body">List Item - With Centered Left Content</Typography.Text>
|
|
88
|
+
</ListItem>
|
|
89
|
+
</Section.SubSection>
|
|
90
|
+
|
|
91
|
+
<Section.SubSection title="flex-end">
|
|
92
|
+
<ListItem
|
|
93
|
+
left={
|
|
94
|
+
<ListItem.SideContent align="flex-end">
|
|
95
|
+
<TypographyIcon icon={<UserIcon />} align="center" />
|
|
96
|
+
</ListItem.SideContent>
|
|
97
|
+
}
|
|
98
|
+
>
|
|
99
|
+
<Typography.Text base="body">List Item - With Centered Left Content</Typography.Text>
|
|
100
|
+
</ListItem>
|
|
101
|
+
</Section.SubSection>
|
|
102
|
+
</Section>
|
|
103
|
+
|
|
104
|
+
<Section title="With Ellipsed Text">
|
|
105
|
+
<ListItem
|
|
106
|
+
left={
|
|
107
|
+
<ListItem.SideContent>
|
|
108
|
+
<TypographyIcon icon={<UserIcon />} align="center" />
|
|
109
|
+
</ListItem.SideContent>
|
|
110
|
+
}
|
|
111
|
+
right={
|
|
112
|
+
<ListItem.SideContent align="center">
|
|
113
|
+
<TypographyIcon icon={<ChevronRightIcon />} />
|
|
114
|
+
</ListItem.SideContent>
|
|
115
|
+
}
|
|
116
|
+
>
|
|
117
|
+
<Typography.Text base="body" ellipsizeMode="tail" numberOfLines={2}>
|
|
118
|
+
This is a long text, showcasing the ability of the ListItem component to have custom content. This one has two
|
|
119
|
+
lines max, the rest will be ellipsed.
|
|
120
|
+
</Typography.Text>
|
|
121
|
+
</ListItem>
|
|
122
|
+
</Section>
|
|
123
|
+
</Story>
|
|
124
|
+
));
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { PressableProps } from 'react-native';
|
|
4
|
+
import { Pressable } from 'react-native';
|
|
5
|
+
import styled from 'styled-components/native';
|
|
6
|
+
import { ListItemContent } from './ListItemContent';
|
|
7
|
+
import { ListItemSideContainer, ListItemSideContent } from './ListItemSideContent';
|
|
8
|
+
|
|
9
|
+
type Borders = 'top' | 'bottom' | 'both';
|
|
10
|
+
|
|
11
|
+
export interface ListItemProps extends PressableProps {
|
|
12
|
+
children: NonNullable<ReactNode>;
|
|
13
|
+
left?: ReactNode;
|
|
14
|
+
right?: ReactNode;
|
|
15
|
+
borders?: Borders;
|
|
16
|
+
withPadding?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ContainerViewProps extends Pick<ListItemProps, 'borders' | 'withPadding'> {}
|
|
20
|
+
|
|
21
|
+
const ContainerView = styled.View<ContainerViewProps>`
|
|
22
|
+
flex-direction: row;
|
|
23
|
+
padding: ${({ withPadding, theme }) => (withPadding ? theme.kitt.listItem.padding : 0)};
|
|
24
|
+
${({ theme, borders }) => {
|
|
25
|
+
const { borderWidth } = theme.kitt.listItem;
|
|
26
|
+
|
|
27
|
+
if (borders === 'top') {
|
|
28
|
+
return `border-top-width: ${borderWidth}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (borders === 'bottom') {
|
|
32
|
+
return `border-bottom-width: ${borderWidth}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (borders === 'both') {
|
|
36
|
+
return `border-top-width: ${borderWidth}; border-bottom-width: ${borderWidth}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return 'border: none';
|
|
40
|
+
}};
|
|
41
|
+
border-color: ${({ theme }) => theme.kitt.listItem.borderColor};
|
|
42
|
+
background-color: ${({ theme }) => theme.kitt.colors.uiBackgroundLight};
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
export function ListItem({ children, withPadding, borders, left, right, ...rest }: ListItemProps): ReactElement {
|
|
46
|
+
return (
|
|
47
|
+
<Pressable {...rest}>
|
|
48
|
+
<ContainerView withPadding={withPadding} borders={borders}>
|
|
49
|
+
{left ? <ListItemSideContainer side="left">{left}</ListItemSideContainer> : null}
|
|
50
|
+
|
|
51
|
+
<ListItemContent>{children}</ListItemContent>
|
|
52
|
+
|
|
53
|
+
{right ? <ListItemSideContainer side="right">{right}</ListItemSideContainer> : null}
|
|
54
|
+
</ContainerView>
|
|
55
|
+
</Pressable>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ListItem.Content = ListItemContent;
|
|
60
|
+
ListItem.SideContent = ListItemSideContent;
|
|
61
|
+
ListItem.SideContainer = ListItemSideContainer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ViewProps } from 'react-native';
|
|
4
|
+
import styled from 'styled-components/native';
|
|
5
|
+
|
|
6
|
+
export interface ListItemContentProps extends ViewProps {
|
|
7
|
+
children: NonNullable<ReactNode>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const ContentView = styled.View`
|
|
11
|
+
flex: 1 0 0%;
|
|
12
|
+
align-self: center;
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export function ListItemContent({ children, ...rest }: ListItemContentProps): ReactElement {
|
|
16
|
+
return <ContentView {...rest}>{children}</ContentView>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ViewProps, ViewStyle } from 'react-native';
|
|
4
|
+
import styled from 'styled-components/native';
|
|
5
|
+
|
|
6
|
+
export interface ListItemSideContainerProps extends ViewProps {
|
|
7
|
+
children: NonNullable<ReactNode>;
|
|
8
|
+
side?: 'left' | 'right';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const SideContainerView = styled.View<ListItemSideContainerProps>`
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
margin-left: ${({ theme, side }) => (side === 'right' ? theme.kitt.listItem.innerMargin : 0)};
|
|
14
|
+
margin-right: ${({ theme, side }) => (side === 'left' ? theme.kitt.listItem.innerMargin : 0)};
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
// Handles the vertical alignment of the side elements of the list item
|
|
18
|
+
export function ListItemSideContainer({ children, side = 'left', ...rest }: ListItemSideContainerProps): ReactElement {
|
|
19
|
+
return (
|
|
20
|
+
<SideContainerView side={side} {...rest}>
|
|
21
|
+
{children}
|
|
22
|
+
</SideContainerView>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ListItemSideContentProps extends ViewProps {
|
|
27
|
+
children: NonNullable<ReactNode>;
|
|
28
|
+
align?: ViewStyle['alignSelf'];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const SideContentView = styled.View<ListItemSideContentProps>`
|
|
32
|
+
align-self: ${({ align }) => align};
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
export function ListItemSideContent({ children, align = 'auto', ...rest }: ListItemSideContentProps): ReactElement {
|
|
36
|
+
return (
|
|
37
|
+
<SideContentView align={align} {...rest}>
|
|
38
|
+
{children}
|
|
39
|
+
</SideContentView>
|
|
40
|
+
);
|
|
41
|
+
}
|