@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
package/src/Modal/Body.tsx
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
3
|
-
import { ScrollView } from 'react-native';
|
|
4
|
-
import styled from 'styled-components/native';
|
|
5
|
-
|
|
6
|
-
const BodyView = styled.View`
|
|
7
|
-
padding: ${({ theme }) => theme.kitt.spacing * 6}px ${({ theme }) => theme.kitt.spacing * 4}px;
|
|
8
|
-
`;
|
|
9
|
-
|
|
10
|
-
export interface BodyProps {
|
|
11
|
-
children: NonNullable<ReactNode>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const ModalBody = forwardRef<ScrollView, BodyProps>(({ children }, ref) => {
|
|
15
|
-
return (
|
|
16
|
-
<ScrollView ref={ref}>
|
|
17
|
-
<BodyView>{children}</BodyView>
|
|
18
|
-
</ScrollView>
|
|
19
|
-
);
|
|
20
|
-
});
|
package/src/Modal/Footer.tsx
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled from 'styled-components/native';
|
|
4
|
-
|
|
5
|
-
export interface FooterProps {
|
|
6
|
-
children: NonNullable<ReactNode>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const FooterView = styled.View`
|
|
10
|
-
flex: 0 0 auto;
|
|
11
|
-
padding: ${({ theme }) => theme.kitt.spacing * 4}px;
|
|
12
|
-
border-top-width: 1px;
|
|
13
|
-
border-top-color: ${({ theme }) => theme.kitt.colors.separator};
|
|
14
|
-
`;
|
|
15
|
-
|
|
16
|
-
export function ModalFooter({ children }: FooterProps): ReactElement {
|
|
17
|
-
return <FooterView>{children}</FooterView>;
|
|
18
|
-
}
|
package/src/Modal/Header.tsx
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { XIcon } from '@ornikar/kitt-icons';
|
|
2
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
-
import React, { useContext } from 'react';
|
|
4
|
-
import styled from 'styled-components/native';
|
|
5
|
-
import { Button } from '../Button/Button';
|
|
6
|
-
import { OnCloseContext } from './OnCloseContext';
|
|
7
|
-
|
|
8
|
-
export interface HeaderProps {
|
|
9
|
-
children: NonNullable<ReactNode>;
|
|
10
|
-
left?: ReactNode;
|
|
11
|
-
right?: ReactNode;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const HeaderView = styled.View`
|
|
15
|
-
position: relative;
|
|
16
|
-
padding: ${({ theme }) => theme.kitt.spacing * 2}px;
|
|
17
|
-
display: flex;
|
|
18
|
-
flex: 0 0 auto;
|
|
19
|
-
flex-direction: row;
|
|
20
|
-
justify-content: space-between;
|
|
21
|
-
align-items: center;
|
|
22
|
-
border-bottom-width: 1px;
|
|
23
|
-
border-bottom-color: ${({ theme }) => theme.kitt.colors.separator};
|
|
24
|
-
min-height: 57px;
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
const LeftIconView = styled.View`
|
|
28
|
-
align-self: flex-start;
|
|
29
|
-
margin-right: ${({ theme }) => theme.kitt.spacing * 2}px;
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
const RightIconView = styled.View`
|
|
33
|
-
align-self: flex-start;
|
|
34
|
-
margin-left: ${({ theme }) => theme.kitt.spacing * 2}px;
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
|
-
interface TitleViewProps {
|
|
38
|
-
isIconLeft?: boolean;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const TitleView = styled.View<TitleViewProps>`
|
|
42
|
-
padding-left: ${({ theme, isIconLeft }) => (isIconLeft ? 0 : theme.kitt.spacing * 2)}px;
|
|
43
|
-
flex-shrink: 1;
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
export function ModalHeader({ left, right, children }: HeaderProps): ReactElement {
|
|
47
|
-
const onClose = useContext(OnCloseContext);
|
|
48
|
-
|
|
49
|
-
const isIconLeft = !!left;
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<HeaderView>
|
|
53
|
-
{isIconLeft && <LeftIconView>{left}</LeftIconView>}
|
|
54
|
-
|
|
55
|
-
<TitleView isIconLeft={isIconLeft}>{children}</TitleView>
|
|
56
|
-
|
|
57
|
-
{right !== undefined ? (
|
|
58
|
-
right
|
|
59
|
-
) : (
|
|
60
|
-
<RightIconView>
|
|
61
|
-
<Button type="subtle-dark" icon={<XIcon />} onPress={onClose} />
|
|
62
|
-
</RightIconView>
|
|
63
|
-
)}
|
|
64
|
-
</HeaderView>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { storiesOf } from '@storybook/react-native';
|
|
3
|
-
import { ArrowLeftIcon, CalendarIcon } from '@ornikar/kitt-icons';
|
|
4
|
-
import { Section } from '@ornikar/kitt-universal';
|
|
5
|
-
import type { ReactElement } from 'react';
|
|
6
|
-
import React, { useState } from 'react';
|
|
7
|
-
import type { Except } from 'type-fest';
|
|
8
|
-
import { Typography } from '..';
|
|
9
|
-
import { Button } from '../Button/Button';
|
|
10
|
-
import type { ModalProps } from './Modal';
|
|
11
|
-
import { Modal } from './Modal';
|
|
12
|
-
|
|
13
|
-
type ModalWrapperProps = Except<ModalProps, 'visible' | 'onClose'>;
|
|
14
|
-
|
|
15
|
-
function ModalWrapper(props: ModalWrapperProps): ReactElement {
|
|
16
|
-
const [visible, setVisible] = useState<boolean>(false);
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<>
|
|
20
|
-
<Button type="primary" onPress={() => setVisible((prev) => !prev)}>
|
|
21
|
-
<Typography.Text base="body">Toggle modal</Typography.Text>
|
|
22
|
-
</Button>
|
|
23
|
-
|
|
24
|
-
<Modal visible={visible} onClose={() => setVisible(false)} {...props} />
|
|
25
|
-
</>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
storiesOf('kitt-universal/Modal', module)
|
|
30
|
-
.add('Default', () => (
|
|
31
|
-
<Section title="Default">
|
|
32
|
-
<ModalWrapper>
|
|
33
|
-
<Modal.Header>
|
|
34
|
-
<Typography.Text base="body" variant="bold">
|
|
35
|
-
Title
|
|
36
|
-
</Typography.Text>
|
|
37
|
-
</Modal.Header>
|
|
38
|
-
|
|
39
|
-
<Modal.Body>
|
|
40
|
-
<Typography.Text base="body">Modal body goes here...</Typography.Text>
|
|
41
|
-
</Modal.Body>
|
|
42
|
-
</ModalWrapper>
|
|
43
|
-
</Section>
|
|
44
|
-
))
|
|
45
|
-
.add('With a Long Heading', () => {
|
|
46
|
-
return (
|
|
47
|
-
<Section title="With a Long Heading">
|
|
48
|
-
<ModalWrapper>
|
|
49
|
-
<Modal.Header>
|
|
50
|
-
<Typography.Text base="body" variant="bold">
|
|
51
|
-
The original Knight Rider series followed the adventures of Michael Knight, a modern-day crime fighter who
|
|
52
|
-
uses a technologically advanced, artificially intelligent automobile. This car is virtually
|
|
53
|
-
indestructible, due to a high-tech coating applied to it.
|
|
54
|
-
</Typography.Text>
|
|
55
|
-
</Modal.Header>
|
|
56
|
-
|
|
57
|
-
<Modal.Body>
|
|
58
|
-
<Typography.Text base="body">Modal body goes here...</Typography.Text>
|
|
59
|
-
</Modal.Body>
|
|
60
|
-
</ModalWrapper>
|
|
61
|
-
</Section>
|
|
62
|
-
);
|
|
63
|
-
})
|
|
64
|
-
.add('With Left Action', () => (
|
|
65
|
-
<Section title="With Left Action">
|
|
66
|
-
<ModalWrapper>
|
|
67
|
-
<Modal.Header
|
|
68
|
-
left={<Button type="subtle-dark" icon={<ArrowLeftIcon />} onPress={action('On Left Action Press')} />}
|
|
69
|
-
>
|
|
70
|
-
<Typography.Text base="body" variant="bold">
|
|
71
|
-
Title
|
|
72
|
-
</Typography.Text>
|
|
73
|
-
</Modal.Header>
|
|
74
|
-
|
|
75
|
-
<Modal.Body>
|
|
76
|
-
<Typography.Text base="body">Modal body goes here...</Typography.Text>
|
|
77
|
-
</Modal.Body>
|
|
78
|
-
</ModalWrapper>
|
|
79
|
-
</Section>
|
|
80
|
-
))
|
|
81
|
-
.add('With Custom Right Action', () => {
|
|
82
|
-
return (
|
|
83
|
-
<Section title="With Custom Right Action">
|
|
84
|
-
<ModalWrapper>
|
|
85
|
-
<Modal.Header
|
|
86
|
-
right={<Button type="subtle-dark" icon={<CalendarIcon />} onPress={action('On Right Action Press')} />}
|
|
87
|
-
>
|
|
88
|
-
<Typography.Text base="body" variant="bold">
|
|
89
|
-
Title
|
|
90
|
-
</Typography.Text>
|
|
91
|
-
</Modal.Header>
|
|
92
|
-
|
|
93
|
-
<Modal.Body>
|
|
94
|
-
<Typography.Text base="body">Modal body goes here...</Typography.Text>
|
|
95
|
-
</Modal.Body>
|
|
96
|
-
</ModalWrapper>
|
|
97
|
-
</Section>
|
|
98
|
-
);
|
|
99
|
-
})
|
|
100
|
-
.add('With Footer', () => {
|
|
101
|
-
return (
|
|
102
|
-
<Section title="With Footer">
|
|
103
|
-
<ModalWrapper>
|
|
104
|
-
<Modal.Header>
|
|
105
|
-
<Typography.Text base="body" variant="bold">
|
|
106
|
-
Title
|
|
107
|
-
</Typography.Text>
|
|
108
|
-
</Modal.Header>
|
|
109
|
-
|
|
110
|
-
<Modal.Body>
|
|
111
|
-
<Typography.Text base="body">
|
|
112
|
-
The original Knight Rider series followed the adventures of Michael Knight, a modern-day crime fighter who
|
|
113
|
-
uses a technologically advanced, artificially intelligent automobile. This car is virtually
|
|
114
|
-
indestructible, due to a high-tech coating applied to it.
|
|
115
|
-
</Typography.Text>
|
|
116
|
-
</Modal.Body>
|
|
117
|
-
|
|
118
|
-
<Modal.Footer>
|
|
119
|
-
<Button stretch type="primary" onPress={action('On Press Primary')}>
|
|
120
|
-
<Typography.Text base="body" variant="bold">
|
|
121
|
-
Primary
|
|
122
|
-
</Typography.Text>
|
|
123
|
-
</Button>
|
|
124
|
-
|
|
125
|
-
<Button stretch type="subtle" onPress={action('On Press Secondary')}>
|
|
126
|
-
<Typography.Text base="body" variant="bold">
|
|
127
|
-
Secondary
|
|
128
|
-
</Typography.Text>
|
|
129
|
-
</Button>
|
|
130
|
-
</Modal.Footer>
|
|
131
|
-
</ModalWrapper>
|
|
132
|
-
</Section>
|
|
133
|
-
);
|
|
134
|
-
})
|
|
135
|
-
.add('With Long Content', () => (
|
|
136
|
-
<Section title="With Long Content">
|
|
137
|
-
<ModalWrapper>
|
|
138
|
-
<Modal.Header>
|
|
139
|
-
<Typography.Text base="body" variant="bold">
|
|
140
|
-
Title
|
|
141
|
-
</Typography.Text>
|
|
142
|
-
</Modal.Header>
|
|
143
|
-
|
|
144
|
-
<Modal.Body>
|
|
145
|
-
<Typography.Text base="body">
|
|
146
|
-
The original Knight Rider series followed the adventures of Michael Knight, a modern-day crime fighter who
|
|
147
|
-
uses a technologically advanced, artificially intelligent automobile. This car is virtually indestructible,
|
|
148
|
-
due to a high-tech coating applied to it.
|
|
149
|
-
</Typography.Text>
|
|
150
|
-
|
|
151
|
-
<Typography.Text base="body">
|
|
152
|
-
Knight Rider stories usually depict either average citizens, or ethical heads of corporations, being bullied
|
|
153
|
-
series is instructed by the Foundation for Law and Government (FLAG) to assist in some manner. The
|
|
154
|
-
</Typography.Text>
|
|
155
|
-
|
|
156
|
-
<Typography.Text base="body">
|
|
157
|
-
KITT is essentially an advanced supercomputer on wheels. The brain of KITT is the Knight 2000 microprocessor
|
|
158
|
-
which is the centre of a self-aware cybernetic logic module that allowed KITT to think, learn, communicate
|
|
159
|
-
and interact with humans. He always had an ego that was easy to bruise and displayed a very sensitive, but
|
|
160
|
-
kind and dryly humorous personality. He also has an in-dash entertainment system that can play music and
|
|
161
|
-
video, and run various computer programs including arcade games which Michael sometimes indulged in while
|
|
162
|
-
KITT was driving.
|
|
163
|
-
</Typography.Text>
|
|
164
|
-
</Modal.Body>
|
|
165
|
-
|
|
166
|
-
<Modal.Footer>
|
|
167
|
-
<Button stretch type="primary" onPress={action('On Press Primary')}>
|
|
168
|
-
<Typography.Text base="body" variant="bold">
|
|
169
|
-
Primary
|
|
170
|
-
</Typography.Text>
|
|
171
|
-
</Button>
|
|
172
|
-
|
|
173
|
-
<Button stretch type="subtle" onPress={action('On Press Secondary')}>
|
|
174
|
-
<Typography.Text base="body" variant="bold">
|
|
175
|
-
Secondary
|
|
176
|
-
</Typography.Text>
|
|
177
|
-
</Button>
|
|
178
|
-
</Modal.Footer>
|
|
179
|
-
</ModalWrapper>
|
|
180
|
-
</Section>
|
|
181
|
-
));
|
package/src/Modal/Modal.tsx
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Modal as NativeModal } from 'react-native';
|
|
4
|
-
import styled from 'styled-components/native';
|
|
5
|
-
import { Overlay } from '../Overlay/Overlay';
|
|
6
|
-
import { ModalBody } from './Body';
|
|
7
|
-
import { ModalFooter } from './Footer';
|
|
8
|
-
import { ModalHeader } from './Header';
|
|
9
|
-
import { OnCloseContext } from './OnCloseContext';
|
|
10
|
-
|
|
11
|
-
export interface ModalProps {
|
|
12
|
-
visible: boolean;
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
onClose: () => void;
|
|
15
|
-
onEntered?: () => void;
|
|
16
|
-
onExited?: () => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const ModalView = styled.View`
|
|
20
|
-
top: 0;
|
|
21
|
-
left: 0;
|
|
22
|
-
width: 100%;
|
|
23
|
-
height: 100%;
|
|
24
|
-
|
|
25
|
-
display: flex;
|
|
26
|
-
align-items: center;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
padding: ${({ theme }) => theme.kitt.spacing * 20}px ${({ theme }) => theme.kitt.spacing * 4}px;
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
const ContentView = styled.View`
|
|
32
|
-
position: relative;
|
|
33
|
-
display: flex;
|
|
34
|
-
flex-direction: column;
|
|
35
|
-
max-height: 100%;
|
|
36
|
-
max-width: 540px;
|
|
37
|
-
height: auto;
|
|
38
|
-
width: 100%;
|
|
39
|
-
border-radius: ${({ theme }) => theme.kitt.card.borderRadius};
|
|
40
|
-
background-color: ${({ theme }) => theme.kitt.palettes.lateOcean.white};
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
export function Modal({ visible, children, onClose, onEntered, onExited }: ModalProps): ReactElement {
|
|
44
|
-
return (
|
|
45
|
-
<OnCloseContext.Provider value={onClose}>
|
|
46
|
-
<NativeModal
|
|
47
|
-
transparent
|
|
48
|
-
animationType="fade"
|
|
49
|
-
visible={visible}
|
|
50
|
-
onShow={onEntered}
|
|
51
|
-
onDismiss={onExited}
|
|
52
|
-
onRequestClose={onClose}
|
|
53
|
-
>
|
|
54
|
-
<ModalView>
|
|
55
|
-
<Overlay onPress={onClose} />
|
|
56
|
-
|
|
57
|
-
<ContentView>{children}</ContentView>
|
|
58
|
-
</ModalView>
|
|
59
|
-
</NativeModal>
|
|
60
|
-
</OnCloseContext.Provider>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
Modal.Header = ModalHeader;
|
|
65
|
-
Modal.Body = ModalBody;
|
|
66
|
-
Modal.Footer = ModalFooter;
|