@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/Button/useButton.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
export const useButton = (): {
|
|
4
|
-
isPressed: boolean;
|
|
5
|
-
handleButtonPressIn: () => void;
|
|
6
|
-
handleButtonPressOut: () => void;
|
|
7
|
-
} => {
|
|
8
|
-
const [isPressed, setIsPressed] = useState<boolean>(false);
|
|
9
|
-
|
|
10
|
-
const handleButtonPressIn = (): void => setIsPressed(true);
|
|
11
|
-
const handleButtonPressOut = (): void => setIsPressed(false);
|
|
12
|
-
|
|
13
|
-
return { isPressed, handleButtonPressIn, handleButtonPressOut };
|
|
14
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { storiesOf } from '@storybook/react-native';
|
|
2
|
-
import { Section, Story } from '@ornikar/kitt-universal';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { Typography } from '../typography/Typography';
|
|
5
|
-
import { Card } from './Card';
|
|
6
|
-
|
|
7
|
-
storiesOf('kitt-universal/Data Display', module).add('Card', () => (
|
|
8
|
-
<Story title="Card">
|
|
9
|
-
<Section title="Primary">
|
|
10
|
-
<Card type="primary">
|
|
11
|
-
<Typography base="body" accessibilityRole="text">
|
|
12
|
-
Some text goes here
|
|
13
|
-
</Typography>
|
|
14
|
-
</Card>
|
|
15
|
-
</Section>
|
|
16
|
-
<Section title="Secondary">
|
|
17
|
-
<Card type="secondary">
|
|
18
|
-
<Typography base="body" accessibilityRole="text">
|
|
19
|
-
Some text goes here
|
|
20
|
-
</Typography>
|
|
21
|
-
</Card>
|
|
22
|
-
</Section>
|
|
23
|
-
<Section title="Subtle">
|
|
24
|
-
<Card type="subtle">
|
|
25
|
-
<Typography base="body" accessibilityRole="text">
|
|
26
|
-
Some text goes here
|
|
27
|
-
</Typography>
|
|
28
|
-
</Card>
|
|
29
|
-
</Section>
|
|
30
|
-
</Story>
|
|
31
|
-
));
|
package/src/Card/Card.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled from 'styled-components/native';
|
|
4
|
-
|
|
5
|
-
type CardType = 'primary' | 'secondary' | 'subtle';
|
|
6
|
-
|
|
7
|
-
export interface CardProps {
|
|
8
|
-
children: NonNullable<ReactNode>;
|
|
9
|
-
type: CardType;
|
|
10
|
-
}
|
|
11
|
-
interface ContainerProps {
|
|
12
|
-
type: CardType;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const Container = styled.View<ContainerProps>`
|
|
16
|
-
background-color: ${({ theme, type }) => theme.kitt.card[type].backgroundColor};
|
|
17
|
-
padding: ${({ theme }) => theme.kitt.card.padding};
|
|
18
|
-
border-radius: ${({ theme }) => theme.kitt.card.borderRadius};
|
|
19
|
-
border-width: ${({ theme }) => theme.kitt.card.borderWidth};
|
|
20
|
-
border-color: ${({ theme, type }) => theme.kitt.card[type].borderColor};
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
export function Card({ children, type }: CardProps): ReactElement {
|
|
24
|
-
return <Container type={type}>{children}</Container>;
|
|
25
|
-
}
|
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`kitt-universal/Data Display Card 1`] = `
|
|
4
|
-
<RNCSafeAreaProvider
|
|
5
|
-
onInsetsChange={[Function]}
|
|
6
|
-
style={
|
|
7
|
-
Array [
|
|
8
|
-
Object {
|
|
9
|
-
"flex": 1,
|
|
10
|
-
},
|
|
11
|
-
undefined,
|
|
12
|
-
]
|
|
13
|
-
}
|
|
14
|
-
>
|
|
15
|
-
<RCTScrollView
|
|
16
|
-
style={
|
|
17
|
-
Array [
|
|
18
|
-
Object {
|
|
19
|
-
"paddingBottom": 10,
|
|
20
|
-
"paddingLeft": 10,
|
|
21
|
-
"paddingRight": 10,
|
|
22
|
-
"paddingTop": 10,
|
|
23
|
-
},
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
>
|
|
27
|
-
<View>
|
|
28
|
-
<View
|
|
29
|
-
style={
|
|
30
|
-
Array [
|
|
31
|
-
Object {
|
|
32
|
-
"marginBottom": 30,
|
|
33
|
-
},
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
>
|
|
37
|
-
<Text
|
|
38
|
-
aria-level="1"
|
|
39
|
-
color="black"
|
|
40
|
-
isHeader={true}
|
|
41
|
-
style={
|
|
42
|
-
Array [
|
|
43
|
-
Object {
|
|
44
|
-
"color": "#000000",
|
|
45
|
-
"fontFamily": "Moderat-Extended-Bold",
|
|
46
|
-
"fontSize": 38,
|
|
47
|
-
"fontStyle": "normal",
|
|
48
|
-
"fontWeight": "400",
|
|
49
|
-
"lineHeight": 49,
|
|
50
|
-
"textDecorationColor": "#000000",
|
|
51
|
-
},
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
type="header1"
|
|
55
|
-
variant="bold"
|
|
56
|
-
>
|
|
57
|
-
Card
|
|
58
|
-
</Text>
|
|
59
|
-
</View>
|
|
60
|
-
<View
|
|
61
|
-
style={
|
|
62
|
-
Array [
|
|
63
|
-
Object {
|
|
64
|
-
"marginBottom": 30,
|
|
65
|
-
},
|
|
66
|
-
]
|
|
67
|
-
}
|
|
68
|
-
>
|
|
69
|
-
<View
|
|
70
|
-
style={
|
|
71
|
-
Array [
|
|
72
|
-
Object {
|
|
73
|
-
"marginBottom": 30,
|
|
74
|
-
},
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
>
|
|
78
|
-
<Text
|
|
79
|
-
aria-level="2"
|
|
80
|
-
color="black"
|
|
81
|
-
isHeader={true}
|
|
82
|
-
style={
|
|
83
|
-
Array [
|
|
84
|
-
Object {
|
|
85
|
-
"color": "#000000",
|
|
86
|
-
"fontFamily": "Moderat-Extended-Bold",
|
|
87
|
-
"fontSize": 32,
|
|
88
|
-
"fontStyle": "normal",
|
|
89
|
-
"fontWeight": "400",
|
|
90
|
-
"lineHeight": 42,
|
|
91
|
-
"textDecorationColor": "#000000",
|
|
92
|
-
},
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
type="header2"
|
|
96
|
-
variant="bold"
|
|
97
|
-
>
|
|
98
|
-
Primary
|
|
99
|
-
</Text>
|
|
100
|
-
</View>
|
|
101
|
-
<View
|
|
102
|
-
style={
|
|
103
|
-
Array [
|
|
104
|
-
Object {
|
|
105
|
-
"backgroundColor": "#FFFFFF",
|
|
106
|
-
"borderColor": "#4C34E0",
|
|
107
|
-
"borderRadius": 20,
|
|
108
|
-
"borderWidth": 2,
|
|
109
|
-
"paddingBottom": 16,
|
|
110
|
-
"paddingLeft": 16,
|
|
111
|
-
"paddingRight": 16,
|
|
112
|
-
"paddingTop": 16,
|
|
113
|
-
},
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
type="primary"
|
|
117
|
-
>
|
|
118
|
-
<Text
|
|
119
|
-
color="black"
|
|
120
|
-
isHeader={false}
|
|
121
|
-
style={
|
|
122
|
-
Array [
|
|
123
|
-
Object {
|
|
124
|
-
"color": "#000000",
|
|
125
|
-
"fontFamily": "NotoSans",
|
|
126
|
-
"fontSize": 16,
|
|
127
|
-
"fontStyle": "normal",
|
|
128
|
-
"fontWeight": "400",
|
|
129
|
-
"lineHeight": 26,
|
|
130
|
-
"textDecorationColor": "#000000",
|
|
131
|
-
},
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
type="body"
|
|
135
|
-
variant="regular"
|
|
136
|
-
>
|
|
137
|
-
Some text goes here
|
|
138
|
-
</Text>
|
|
139
|
-
</View>
|
|
140
|
-
</View>
|
|
141
|
-
<View
|
|
142
|
-
style={
|
|
143
|
-
Array [
|
|
144
|
-
Object {
|
|
145
|
-
"marginBottom": 30,
|
|
146
|
-
},
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
>
|
|
150
|
-
<View
|
|
151
|
-
style={
|
|
152
|
-
Array [
|
|
153
|
-
Object {
|
|
154
|
-
"marginBottom": 30,
|
|
155
|
-
},
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
>
|
|
159
|
-
<Text
|
|
160
|
-
aria-level="2"
|
|
161
|
-
color="black"
|
|
162
|
-
isHeader={true}
|
|
163
|
-
style={
|
|
164
|
-
Array [
|
|
165
|
-
Object {
|
|
166
|
-
"color": "#000000",
|
|
167
|
-
"fontFamily": "Moderat-Extended-Bold",
|
|
168
|
-
"fontSize": 32,
|
|
169
|
-
"fontStyle": "normal",
|
|
170
|
-
"fontWeight": "400",
|
|
171
|
-
"lineHeight": 42,
|
|
172
|
-
"textDecorationColor": "#000000",
|
|
173
|
-
},
|
|
174
|
-
]
|
|
175
|
-
}
|
|
176
|
-
type="header2"
|
|
177
|
-
variant="bold"
|
|
178
|
-
>
|
|
179
|
-
Secondary
|
|
180
|
-
</Text>
|
|
181
|
-
</View>
|
|
182
|
-
<View
|
|
183
|
-
style={
|
|
184
|
-
Array [
|
|
185
|
-
Object {
|
|
186
|
-
"backgroundColor": "#FFFFFF",
|
|
187
|
-
"borderColor": "#E5E5E5",
|
|
188
|
-
"borderRadius": 20,
|
|
189
|
-
"borderWidth": 2,
|
|
190
|
-
"paddingBottom": 16,
|
|
191
|
-
"paddingLeft": 16,
|
|
192
|
-
"paddingRight": 16,
|
|
193
|
-
"paddingTop": 16,
|
|
194
|
-
},
|
|
195
|
-
]
|
|
196
|
-
}
|
|
197
|
-
type="secondary"
|
|
198
|
-
>
|
|
199
|
-
<Text
|
|
200
|
-
color="black"
|
|
201
|
-
isHeader={false}
|
|
202
|
-
style={
|
|
203
|
-
Array [
|
|
204
|
-
Object {
|
|
205
|
-
"color": "#000000",
|
|
206
|
-
"fontFamily": "NotoSans",
|
|
207
|
-
"fontSize": 16,
|
|
208
|
-
"fontStyle": "normal",
|
|
209
|
-
"fontWeight": "400",
|
|
210
|
-
"lineHeight": 26,
|
|
211
|
-
"textDecorationColor": "#000000",
|
|
212
|
-
},
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
type="body"
|
|
216
|
-
variant="regular"
|
|
217
|
-
>
|
|
218
|
-
Some text goes here
|
|
219
|
-
</Text>
|
|
220
|
-
</View>
|
|
221
|
-
</View>
|
|
222
|
-
<View
|
|
223
|
-
style={
|
|
224
|
-
Array [
|
|
225
|
-
Object {
|
|
226
|
-
"marginBottom": 30,
|
|
227
|
-
},
|
|
228
|
-
]
|
|
229
|
-
}
|
|
230
|
-
>
|
|
231
|
-
<View
|
|
232
|
-
style={
|
|
233
|
-
Array [
|
|
234
|
-
Object {
|
|
235
|
-
"marginBottom": 30,
|
|
236
|
-
},
|
|
237
|
-
]
|
|
238
|
-
}
|
|
239
|
-
>
|
|
240
|
-
<Text
|
|
241
|
-
aria-level="2"
|
|
242
|
-
color="black"
|
|
243
|
-
isHeader={true}
|
|
244
|
-
style={
|
|
245
|
-
Array [
|
|
246
|
-
Object {
|
|
247
|
-
"color": "#000000",
|
|
248
|
-
"fontFamily": "Moderat-Extended-Bold",
|
|
249
|
-
"fontSize": 32,
|
|
250
|
-
"fontStyle": "normal",
|
|
251
|
-
"fontWeight": "400",
|
|
252
|
-
"lineHeight": 42,
|
|
253
|
-
"textDecorationColor": "#000000",
|
|
254
|
-
},
|
|
255
|
-
]
|
|
256
|
-
}
|
|
257
|
-
type="header2"
|
|
258
|
-
variant="bold"
|
|
259
|
-
>
|
|
260
|
-
Subtle
|
|
261
|
-
</Text>
|
|
262
|
-
</View>
|
|
263
|
-
<View
|
|
264
|
-
style={
|
|
265
|
-
Array [
|
|
266
|
-
Object {
|
|
267
|
-
"backgroundColor": "#F2F2F2",
|
|
268
|
-
"borderColor": "#E5E5E5",
|
|
269
|
-
"borderRadius": 20,
|
|
270
|
-
"borderWidth": 2,
|
|
271
|
-
"paddingBottom": 16,
|
|
272
|
-
"paddingLeft": 16,
|
|
273
|
-
"paddingRight": 16,
|
|
274
|
-
"paddingTop": 16,
|
|
275
|
-
},
|
|
276
|
-
]
|
|
277
|
-
}
|
|
278
|
-
type="subtle"
|
|
279
|
-
>
|
|
280
|
-
<Text
|
|
281
|
-
color="black"
|
|
282
|
-
isHeader={false}
|
|
283
|
-
style={
|
|
284
|
-
Array [
|
|
285
|
-
Object {
|
|
286
|
-
"color": "#000000",
|
|
287
|
-
"fontFamily": "NotoSans",
|
|
288
|
-
"fontSize": 16,
|
|
289
|
-
"fontStyle": "normal",
|
|
290
|
-
"fontWeight": "400",
|
|
291
|
-
"lineHeight": 26,
|
|
292
|
-
"textDecorationColor": "#000000",
|
|
293
|
-
},
|
|
294
|
-
]
|
|
295
|
-
}
|
|
296
|
-
type="body"
|
|
297
|
-
variant="regular"
|
|
298
|
-
>
|
|
299
|
-
Some text goes here
|
|
300
|
-
</Text>
|
|
301
|
-
</View>
|
|
302
|
-
</View>
|
|
303
|
-
</View>
|
|
304
|
-
</RCTScrollView>
|
|
305
|
-
</RNCSafeAreaProvider>
|
|
306
|
-
`;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled from 'styled-components/native';
|
|
4
|
-
import { KittBreakpoints } from '../KittBreakpoints';
|
|
5
|
-
|
|
6
|
-
const Body = styled.View`
|
|
7
|
-
${({ theme }) =>
|
|
8
|
-
theme.responsive.ifWindowSizeMatches(
|
|
9
|
-
{ minWidth: KittBreakpoints.MEDIUM },
|
|
10
|
-
`padding-right: ${theme.kitt.spacing * 12}px;
|
|
11
|
-
padding-left: ${theme.kitt.spacing * 12}px;`,
|
|
12
|
-
`padding-right: ${theme.kitt.spacing * 6}px;
|
|
13
|
-
padding-left: ${theme.kitt.spacing * 6}px;`,
|
|
14
|
-
)}
|
|
15
|
-
background-color: ${({ theme }) => theme.kitt.colors.uiBackgroundLight};
|
|
16
|
-
flex: 1;
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
interface BodyProps {
|
|
20
|
-
children: NonNullable<ReactNode>;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function FullScreenModalBody({ children }: BodyProps): ReactElement {
|
|
24
|
-
return <Body>{children}</Body>;
|
|
25
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { action } from '@storybook/addon-actions';
|
|
2
|
-
import { storiesOf } from '@storybook/react-native';
|
|
3
|
-
import { ArrowLeftIcon, XIcon } from '@ornikar/kitt-icons';
|
|
4
|
-
import { Story } from '@ornikar/kitt-universal';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { Button } from '../Button/Button';
|
|
7
|
-
import { Typography } from '../typography/Typography';
|
|
8
|
-
import { FullScreenModal } from './FullScreenModal';
|
|
9
|
-
|
|
10
|
-
storiesOf('kitt-universal/FullScreenModal', module)
|
|
11
|
-
.add('Full Screen Modal', () => (
|
|
12
|
-
<Story title="Default">
|
|
13
|
-
<FullScreenModal>
|
|
14
|
-
<FullScreenModal.Header
|
|
15
|
-
right={
|
|
16
|
-
<Button type="subtle" onPress={action('close')}>
|
|
17
|
-
<Typography.Text base="body-large" variant="bold">
|
|
18
|
-
Ok
|
|
19
|
-
</Typography.Text>
|
|
20
|
-
</Button>
|
|
21
|
-
}
|
|
22
|
-
>
|
|
23
|
-
<Typography.Text base="body-large" variant="bold">
|
|
24
|
-
Title
|
|
25
|
-
</Typography.Text>
|
|
26
|
-
</FullScreenModal.Header>
|
|
27
|
-
<FullScreenModal.Body>
|
|
28
|
-
<Typography.Text base="body">Content</Typography.Text>
|
|
29
|
-
</FullScreenModal.Body>
|
|
30
|
-
</FullScreenModal>
|
|
31
|
-
</Story>
|
|
32
|
-
))
|
|
33
|
-
.add('Left and Right Header Actions', () => (
|
|
34
|
-
<Story title="Left and Right action">
|
|
35
|
-
<FullScreenModal>
|
|
36
|
-
<FullScreenModal.Header
|
|
37
|
-
left={<Button type="subtle" icon={<ArrowLeftIcon />} />}
|
|
38
|
-
right={<Button type="subtle" icon={<XIcon />} onPress={action('close')} />}
|
|
39
|
-
>
|
|
40
|
-
<Typography.Text base="body-large" variant="bold">
|
|
41
|
-
Title
|
|
42
|
-
</Typography.Text>
|
|
43
|
-
</FullScreenModal.Header>
|
|
44
|
-
<FullScreenModal.Body>
|
|
45
|
-
<Typography.Text base="body">Content</Typography.Text>
|
|
46
|
-
</FullScreenModal.Body>
|
|
47
|
-
</FullScreenModal>
|
|
48
|
-
</Story>
|
|
49
|
-
))
|
|
50
|
-
.add('No Header Actions', () => (
|
|
51
|
-
<Story title="No Header Actions">
|
|
52
|
-
<FullScreenModal>
|
|
53
|
-
<FullScreenModal.Header>
|
|
54
|
-
<Typography.Text base="body-large" variant="bold">
|
|
55
|
-
Title
|
|
56
|
-
</Typography.Text>
|
|
57
|
-
</FullScreenModal.Header>
|
|
58
|
-
<FullScreenModal.Body>
|
|
59
|
-
<Typography.Text base="body">Content</Typography.Text>
|
|
60
|
-
</FullScreenModal.Body>
|
|
61
|
-
</FullScreenModal>
|
|
62
|
-
</Story>
|
|
63
|
-
));
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import styled from 'styled-components/native';
|
|
4
|
-
import { FullScreenModalBody } from './Body';
|
|
5
|
-
import { FullScreenModalHeader } from './Header';
|
|
6
|
-
|
|
7
|
-
const Container = styled.View`
|
|
8
|
-
flex: 1;
|
|
9
|
-
background-color: ${({ theme }) => theme.kitt.colors.uiBackground};
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
export interface FullScreenModalProps {
|
|
13
|
-
children: ReactNode;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function FullScreenModal({ children }: FullScreenModalProps): ReactElement {
|
|
17
|
-
return <Container>{children}</Container>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
FullScreenModal.Header = FullScreenModalHeader;
|
|
21
|
-
FullScreenModal.Body = FullScreenModalBody;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import React, { useState } from 'react';
|
|
3
|
-
import type { LayoutChangeEvent } from 'react-native';
|
|
4
|
-
import { Platform, useWindowDimensions } from 'react-native';
|
|
5
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
|
-
import styled from 'styled-components/native';
|
|
7
|
-
import { KittBreakpoints } from '../KittBreakpoints';
|
|
8
|
-
|
|
9
|
-
interface SideContainerProps {
|
|
10
|
-
side?: 'left' | 'right';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const SideContainer = styled.View<SideContainerProps>`
|
|
14
|
-
${({ theme, side = 'left' }) => {
|
|
15
|
-
const padding = theme.kitt.spacing * 2;
|
|
16
|
-
|
|
17
|
-
if (side === 'left') {
|
|
18
|
-
return `padding-right: ${padding}px;`;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return `padding-left: ${padding}px;`;
|
|
22
|
-
}}
|
|
23
|
-
`;
|
|
24
|
-
|
|
25
|
-
function getHeaderHorizontalMediumPadding(spacing: number): number {
|
|
26
|
-
return spacing * 6;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface HeaderProps {
|
|
30
|
-
insetTop?: number;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const Header = styled.View<HeaderProps>`
|
|
34
|
-
${({ theme, insetTop = 0 }) => {
|
|
35
|
-
const paddingTop = insetTop + theme.kitt.fullScreenModal.header.paddingVertical;
|
|
36
|
-
const { paddingVertical, paddingHorizontal } = theme.kitt.fullScreenModal.header;
|
|
37
|
-
|
|
38
|
-
return theme.responsive.ifWindowSizeMatches(
|
|
39
|
-
{ minWidth: KittBreakpoints.MEDIUM },
|
|
40
|
-
`padding: ${paddingTop}px ${getHeaderHorizontalMediumPadding(theme.kitt.spacing)}px ${paddingVertical}px;`,
|
|
41
|
-
`padding: ${paddingTop}px ${paddingHorizontal}px ${paddingVertical}px;`,
|
|
42
|
-
);
|
|
43
|
-
}};
|
|
44
|
-
border-bottom-color: ${({ theme }) => theme.kitt.fullScreenModal.header.borderColor};
|
|
45
|
-
border-bottom-width: 1px;
|
|
46
|
-
flex-direction: row;
|
|
47
|
-
align-items: center;
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
|
-
interface HeaderContentProps {
|
|
51
|
-
windowWidth: number;
|
|
52
|
-
leftWidth: number;
|
|
53
|
-
rightWidth: number;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const HeaderContent = styled.View<HeaderContentProps>`
|
|
57
|
-
${({ theme, leftWidth, rightWidth, windowWidth }) => {
|
|
58
|
-
/*
|
|
59
|
-
* Since we don't have controll over the rendered left and right elements,
|
|
60
|
-
* we must apply some logic to give the title all the available space
|
|
61
|
-
*/
|
|
62
|
-
const sideElementMaxWidth = Math.max(leftWidth, rightWidth);
|
|
63
|
-
|
|
64
|
-
const parentHorizontalPadding = theme.kitt.fullScreenModal.header.paddingHorizontal * 2;
|
|
65
|
-
const parentHorizontalPaddingMedium = getHeaderHorizontalMediumPadding(theme.kitt.spacing) * 2;
|
|
66
|
-
|
|
67
|
-
const computeWidth = (breakpointPadding: number): number =>
|
|
68
|
-
windowWidth - breakpointPadding - sideElementMaxWidth * 2;
|
|
69
|
-
|
|
70
|
-
return theme.responsive.ifWindowSizeMatches(
|
|
71
|
-
{ minWidth: KittBreakpoints.MEDIUM },
|
|
72
|
-
`width: ${computeWidth(parentHorizontalPaddingMedium)}px;`,
|
|
73
|
-
`width: ${computeWidth(parentHorizontalPadding)}px;`,
|
|
74
|
-
);
|
|
75
|
-
}};
|
|
76
|
-
${({ leftWidth, rightWidth }) => {
|
|
77
|
-
// Depending of the wider element, we must add a margin to fill the diff in space between elements
|
|
78
|
-
const deltaMargin = Math.abs(leftWidth - rightWidth);
|
|
79
|
-
|
|
80
|
-
if (leftWidth > rightWidth) {
|
|
81
|
-
return `margin-right: ${deltaMargin}px;`;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return `margin-left: ${deltaMargin}px;`;
|
|
85
|
-
}};
|
|
86
|
-
justify-content: center;
|
|
87
|
-
align-items: center;
|
|
88
|
-
`;
|
|
89
|
-
|
|
90
|
-
export interface FullScreenModalHeaderProps {
|
|
91
|
-
children: NonNullable<ReactNode>;
|
|
92
|
-
right?: ReactNode;
|
|
93
|
-
left?: ReactNode;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export function FullScreenModalHeader({ children, right, left }: FullScreenModalHeaderProps): ReactElement {
|
|
97
|
-
const { top } = useSafeAreaInsets();
|
|
98
|
-
const dimensions = useWindowDimensions();
|
|
99
|
-
const [leftWidth, setLeftWidth] = useState(0);
|
|
100
|
-
const [rightWidth, setRightWidth] = useState(0);
|
|
101
|
-
|
|
102
|
-
const handleLayoutChange = (event: LayoutChangeEvent, side: 'left' | 'right'): void => {
|
|
103
|
-
// Prevents react to nullify event on rerenders
|
|
104
|
-
event.persist();
|
|
105
|
-
|
|
106
|
-
if (side === 'left') {
|
|
107
|
-
setLeftWidth(event.nativeEvent.layout.width);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
setRightWidth(event.nativeEvent.layout.width);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<Header insetTop={Platform.OS === 'ios' ? undefined : top}>
|
|
116
|
-
{left ? <SideContainer onLayout={(e) => handleLayoutChange(e, 'left')}>{left}</SideContainer> : null}
|
|
117
|
-
|
|
118
|
-
<HeaderContent windowWidth={dimensions.width} leftWidth={leftWidth} rightWidth={rightWidth}>
|
|
119
|
-
{children}
|
|
120
|
-
</HeaderContent>
|
|
121
|
-
|
|
122
|
-
{right ? (
|
|
123
|
-
<SideContainer side="right" onLayout={(e) => handleLayoutChange(e, 'right')}>
|
|
124
|
-
{right}
|
|
125
|
-
</SideContainer>
|
|
126
|
-
) : null}
|
|
127
|
-
</Header>
|
|
128
|
-
);
|
|
129
|
-
}
|