@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,252 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`kitt/Forms Input Feedback 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
|
+
Input Feedback
|
|
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
|
+
Demo
|
|
99
|
+
</Text>
|
|
100
|
+
</View>
|
|
101
|
+
<Text
|
|
102
|
+
color="grey"
|
|
103
|
+
isHeader={false}
|
|
104
|
+
style={
|
|
105
|
+
Array [
|
|
106
|
+
Object {
|
|
107
|
+
"color": "#737373",
|
|
108
|
+
"fontFamily": "NotoSans",
|
|
109
|
+
"fontSize": 14,
|
|
110
|
+
"fontStyle": "normal",
|
|
111
|
+
"fontWeight": "400",
|
|
112
|
+
"lineHeight": 22,
|
|
113
|
+
"textDecorationColor": "#737373",
|
|
114
|
+
},
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
type="body-small"
|
|
118
|
+
variant="regular"
|
|
119
|
+
>
|
|
120
|
+
Le numéro NEPH est composé de 12 chiffres
|
|
121
|
+
</Text>
|
|
122
|
+
</View>
|
|
123
|
+
<View
|
|
124
|
+
style={
|
|
125
|
+
Array [
|
|
126
|
+
Object {
|
|
127
|
+
"marginBottom": 30,
|
|
128
|
+
},
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
>
|
|
132
|
+
<View
|
|
133
|
+
style={
|
|
134
|
+
Array [
|
|
135
|
+
Object {
|
|
136
|
+
"marginBottom": 30,
|
|
137
|
+
},
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
>
|
|
141
|
+
<Text
|
|
142
|
+
aria-level="2"
|
|
143
|
+
color="black"
|
|
144
|
+
isHeader={true}
|
|
145
|
+
style={
|
|
146
|
+
Array [
|
|
147
|
+
Object {
|
|
148
|
+
"color": "#000000",
|
|
149
|
+
"fontFamily": "Moderat-Extended-Bold",
|
|
150
|
+
"fontSize": 32,
|
|
151
|
+
"fontStyle": "normal",
|
|
152
|
+
"fontWeight": "400",
|
|
153
|
+
"lineHeight": 42,
|
|
154
|
+
"textDecorationColor": "#000000",
|
|
155
|
+
},
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
type="header2"
|
|
159
|
+
variant="bold"
|
|
160
|
+
>
|
|
161
|
+
Valid
|
|
162
|
+
</Text>
|
|
163
|
+
</View>
|
|
164
|
+
<Text
|
|
165
|
+
color="grey"
|
|
166
|
+
isHeader={false}
|
|
167
|
+
style={
|
|
168
|
+
Array [
|
|
169
|
+
Object {
|
|
170
|
+
"color": "#737373",
|
|
171
|
+
"fontFamily": "NotoSans",
|
|
172
|
+
"fontSize": 14,
|
|
173
|
+
"fontStyle": "normal",
|
|
174
|
+
"fontWeight": "400",
|
|
175
|
+
"lineHeight": 22,
|
|
176
|
+
"textDecorationColor": "#737373",
|
|
177
|
+
},
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
type="body-small"
|
|
181
|
+
variant="regular"
|
|
182
|
+
>
|
|
183
|
+
Le numéro NEPH renseigné est valide !
|
|
184
|
+
</Text>
|
|
185
|
+
</View>
|
|
186
|
+
<View
|
|
187
|
+
style={
|
|
188
|
+
Array [
|
|
189
|
+
Object {
|
|
190
|
+
"marginBottom": 30,
|
|
191
|
+
},
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
>
|
|
195
|
+
<View
|
|
196
|
+
style={
|
|
197
|
+
Array [
|
|
198
|
+
Object {
|
|
199
|
+
"marginBottom": 30,
|
|
200
|
+
},
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
>
|
|
204
|
+
<Text
|
|
205
|
+
aria-level="2"
|
|
206
|
+
color="black"
|
|
207
|
+
isHeader={true}
|
|
208
|
+
style={
|
|
209
|
+
Array [
|
|
210
|
+
Object {
|
|
211
|
+
"color": "#000000",
|
|
212
|
+
"fontFamily": "Moderat-Extended-Bold",
|
|
213
|
+
"fontSize": 32,
|
|
214
|
+
"fontStyle": "normal",
|
|
215
|
+
"fontWeight": "400",
|
|
216
|
+
"lineHeight": 42,
|
|
217
|
+
"textDecorationColor": "#000000",
|
|
218
|
+
},
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
type="header2"
|
|
222
|
+
variant="bold"
|
|
223
|
+
>
|
|
224
|
+
Invalid
|
|
225
|
+
</Text>
|
|
226
|
+
</View>
|
|
227
|
+
<Text
|
|
228
|
+
color="danger"
|
|
229
|
+
isHeader={false}
|
|
230
|
+
style={
|
|
231
|
+
Array [
|
|
232
|
+
Object {
|
|
233
|
+
"color": "#D44148",
|
|
234
|
+
"fontFamily": "NotoSans",
|
|
235
|
+
"fontSize": 14,
|
|
236
|
+
"fontStyle": "normal",
|
|
237
|
+
"fontWeight": "400",
|
|
238
|
+
"lineHeight": 22,
|
|
239
|
+
"textDecorationColor": "#D44148",
|
|
240
|
+
},
|
|
241
|
+
]
|
|
242
|
+
}
|
|
243
|
+
type="body-small"
|
|
244
|
+
variant="regular"
|
|
245
|
+
>
|
|
246
|
+
Le numéro NEPH comporte 12 caractères !
|
|
247
|
+
</Text>
|
|
248
|
+
</View>
|
|
249
|
+
</View>
|
|
250
|
+
</RCTScrollView>
|
|
251
|
+
</RNCSafeAreaProvider>
|
|
252
|
+
`;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { storiesOf } from '@storybook/react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StoryComponents } from '../../story-components';
|
|
4
|
+
import { InputFeedback } from '../InputFeedback/InputFeedback';
|
|
5
|
+
import { InputText } from '../InputText/InputText';
|
|
6
|
+
import { Label } from '../Label/Label';
|
|
7
|
+
import { InputField } from './InputField';
|
|
8
|
+
|
|
9
|
+
const { Section, Story } = StoryComponents;
|
|
10
|
+
|
|
11
|
+
storiesOf('kitt/Forms', module).add('Input Field', () => (
|
|
12
|
+
<Story title="Field Container">
|
|
13
|
+
<Section title="Demo">
|
|
14
|
+
<InputField
|
|
15
|
+
label={<Label htmlFor="field_name">Label</Label>}
|
|
16
|
+
input={<InputText type="text" accessibilityLabelledBy="field_name" />}
|
|
17
|
+
feedback={<InputFeedback>Feedback</InputFeedback>}
|
|
18
|
+
/>
|
|
19
|
+
</Section>
|
|
20
|
+
</Story>
|
|
21
|
+
));
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
import styled from 'styled-components/native';
|
|
4
|
+
import { KittBreakpoints } from '../../KittBreakpoints';
|
|
5
|
+
|
|
6
|
+
const FieldContainer = styled.View`
|
|
7
|
+
padding: 5px 0 10px;
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
const FeedbackContainer = styled.View`
|
|
11
|
+
${({ theme }) =>
|
|
12
|
+
theme.responsive.ifWindowSizeMatches({ minWidth: KittBreakpoints.SMALL }, 'padding-top: 10px', 'padding-top: 5px')};
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
const FieldLabelContainer = styled.View`
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
align-items: center;
|
|
18
|
+
padding-bottom: ${({ theme }) => theme.kitt.forms.inputField.labelContainerPaddingBottom}px;
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
const LabelContainer = styled.View`
|
|
22
|
+
margin-right: ${({ theme }) => theme.kitt.forms.inputField.iconMarginLeft}px;
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
export interface InputFieldProps {
|
|
26
|
+
label?: ReactNode;
|
|
27
|
+
labelFeedback?: ReactNode;
|
|
28
|
+
input: NonNullable<ReactNode>;
|
|
29
|
+
feedback?: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function InputField({ label, labelFeedback, input, feedback }: InputFieldProps): ReactElement {
|
|
33
|
+
return (
|
|
34
|
+
<FieldContainer>
|
|
35
|
+
{label ? (
|
|
36
|
+
<FieldLabelContainer>
|
|
37
|
+
<LabelContainer>{label}</LabelContainer>
|
|
38
|
+
{labelFeedback}
|
|
39
|
+
</FieldLabelContainer>
|
|
40
|
+
) : null}
|
|
41
|
+
{input}
|
|
42
|
+
{feedback ? <FeedbackContainer>{feedback}</FeedbackContainer> : null}
|
|
43
|
+
</FieldContainer>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`kitt/Forms Input Field 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
|
+
Field Container
|
|
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
|
+
Demo
|
|
99
|
+
</Text>
|
|
100
|
+
</View>
|
|
101
|
+
<View
|
|
102
|
+
style={
|
|
103
|
+
Array [
|
|
104
|
+
Object {
|
|
105
|
+
"paddingBottom": 10,
|
|
106
|
+
"paddingLeft": 0,
|
|
107
|
+
"paddingRight": 0,
|
|
108
|
+
"paddingTop": 5,
|
|
109
|
+
},
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
>
|
|
113
|
+
<View
|
|
114
|
+
style={
|
|
115
|
+
Array [
|
|
116
|
+
Object {
|
|
117
|
+
"alignItems": "center",
|
|
118
|
+
"flexDirection": "row",
|
|
119
|
+
"paddingBottom": 5,
|
|
120
|
+
},
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
>
|
|
124
|
+
<View
|
|
125
|
+
style={
|
|
126
|
+
Array [
|
|
127
|
+
Object {
|
|
128
|
+
"marginRight": 6,
|
|
129
|
+
},
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
>
|
|
133
|
+
<Text
|
|
134
|
+
color="black"
|
|
135
|
+
isHeader={false}
|
|
136
|
+
style={
|
|
137
|
+
Array [
|
|
138
|
+
Object {
|
|
139
|
+
"color": "#000000",
|
|
140
|
+
"fontFamily": "NotoSans",
|
|
141
|
+
"fontSize": 16,
|
|
142
|
+
"fontStyle": "normal",
|
|
143
|
+
"fontWeight": "400",
|
|
144
|
+
"lineHeight": 26,
|
|
145
|
+
"textDecorationColor": "#000000",
|
|
146
|
+
},
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
type="body"
|
|
150
|
+
variant="regular"
|
|
151
|
+
>
|
|
152
|
+
Label
|
|
153
|
+
</Text>
|
|
154
|
+
</View>
|
|
155
|
+
</View>
|
|
156
|
+
<View
|
|
157
|
+
style={
|
|
158
|
+
Array [
|
|
159
|
+
Object {
|
|
160
|
+
"marginBottom": 4,
|
|
161
|
+
"marginTop": 2,
|
|
162
|
+
},
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
>
|
|
166
|
+
<TextInput
|
|
167
|
+
accessibilityLabelledBy="field_name"
|
|
168
|
+
allowFontScaling={true}
|
|
169
|
+
autoCompleteType="off"
|
|
170
|
+
autoCorrect={true}
|
|
171
|
+
editable={true}
|
|
172
|
+
keyboardType="default"
|
|
173
|
+
minHeight={0}
|
|
174
|
+
onBlur={[Function]}
|
|
175
|
+
onFocus={[Function]}
|
|
176
|
+
placeholderTextColor="#737373"
|
|
177
|
+
rejectResponderTermination={true}
|
|
178
|
+
secureTextEntry={false}
|
|
179
|
+
selectionColor="#4C34E0"
|
|
180
|
+
state="default"
|
|
181
|
+
style={
|
|
182
|
+
Array [
|
|
183
|
+
Object {
|
|
184
|
+
"backgroundColor": "#FFFFFF",
|
|
185
|
+
"borderColor": "#E5E5E5",
|
|
186
|
+
"borderRadius": 10,
|
|
187
|
+
"borderWidth": 2,
|
|
188
|
+
"color": "#000000",
|
|
189
|
+
"fontFamily": "NotoSans",
|
|
190
|
+
"fontSize": 16,
|
|
191
|
+
"lineHeight": 0,
|
|
192
|
+
"minHeight": 0,
|
|
193
|
+
"paddingBottom": 12,
|
|
194
|
+
"paddingLeft": 16,
|
|
195
|
+
"paddingRight": 16,
|
|
196
|
+
"paddingTop": 12,
|
|
197
|
+
},
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
textContentType="none"
|
|
201
|
+
underlineColorAndroid="transparent"
|
|
202
|
+
/>
|
|
203
|
+
</View>
|
|
204
|
+
<View
|
|
205
|
+
style={
|
|
206
|
+
Array [
|
|
207
|
+
Object {
|
|
208
|
+
"paddingTop": 5,
|
|
209
|
+
},
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
>
|
|
213
|
+
<Text
|
|
214
|
+
color="grey"
|
|
215
|
+
isHeader={false}
|
|
216
|
+
style={
|
|
217
|
+
Array [
|
|
218
|
+
Object {
|
|
219
|
+
"color": "#737373",
|
|
220
|
+
"fontFamily": "NotoSans",
|
|
221
|
+
"fontSize": 14,
|
|
222
|
+
"fontStyle": "normal",
|
|
223
|
+
"fontWeight": "400",
|
|
224
|
+
"lineHeight": 22,
|
|
225
|
+
"textDecorationColor": "#737373",
|
|
226
|
+
},
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
type="body-small"
|
|
230
|
+
variant="regular"
|
|
231
|
+
>
|
|
232
|
+
Feedback
|
|
233
|
+
</Text>
|
|
234
|
+
</View>
|
|
235
|
+
</View>
|
|
236
|
+
</View>
|
|
237
|
+
</View>
|
|
238
|
+
</RCTScrollView>
|
|
239
|
+
</RNCSafeAreaProvider>
|
|
240
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type InputFormState = undefined | 'valid' | 'invalid' | 'pending';
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { action } from '@storybook/addon-actions';
|
|
2
|
+
import { storiesOf } from '@storybook/react-native';
|
|
3
|
+
import type { ReactElement } from 'react';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { StoryComponents } from '../../story-components';
|
|
6
|
+
import type { InputTextProps } from './InputText';
|
|
7
|
+
import { InputText } from './InputText';
|
|
8
|
+
|
|
9
|
+
const { Section, Story, StoryGrid } = StoryComponents;
|
|
10
|
+
|
|
11
|
+
const defaultPlaceholder = 'Placeholder';
|
|
12
|
+
const filledValue =
|
|
13
|
+
'The original Knight Rider series followed the adventures of Michael Knight, a modern-day crime fighter who uses a technologically advanced, artificially intelligent automobile.';
|
|
14
|
+
|
|
15
|
+
interface InputTextVariationProps extends Partial<InputTextProps> {
|
|
16
|
+
variationTitle: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function InputTextVariation({ variationTitle, ...props }: InputTextVariationProps): ReactElement {
|
|
20
|
+
return (
|
|
21
|
+
<Section key={variationTitle} title={variationTitle}>
|
|
22
|
+
<StoryGrid.Row breakpoint="medium">
|
|
23
|
+
<StoryGrid.Col title="Empty">
|
|
24
|
+
<InputText placeholder={defaultPlaceholder} type="text" onChange={action('Changed')} {...props} />
|
|
25
|
+
</StoryGrid.Col>
|
|
26
|
+
<StoryGrid.Col title="Filled">
|
|
27
|
+
<InputText
|
|
28
|
+
placeholder={defaultPlaceholder}
|
|
29
|
+
value={filledValue}
|
|
30
|
+
type="text"
|
|
31
|
+
onChange={action('Changed')}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
34
|
+
</StoryGrid.Col>
|
|
35
|
+
<StoryGrid.Col title="Hover">
|
|
36
|
+
<InputText
|
|
37
|
+
placeholder={defaultPlaceholder}
|
|
38
|
+
value={filledValue}
|
|
39
|
+
type="text"
|
|
40
|
+
internalForceState="hover"
|
|
41
|
+
onChange={action('Changed')}
|
|
42
|
+
{...props}
|
|
43
|
+
/>
|
|
44
|
+
</StoryGrid.Col>
|
|
45
|
+
<StoryGrid.Col title="Focus">
|
|
46
|
+
<InputText
|
|
47
|
+
placeholder={defaultPlaceholder}
|
|
48
|
+
value={filledValue}
|
|
49
|
+
type="text"
|
|
50
|
+
internalForceState="focus"
|
|
51
|
+
onChange={action('Changed')}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
</StoryGrid.Col>
|
|
55
|
+
<StoryGrid.Col title="Disabled">
|
|
56
|
+
<InputText disabled placeholder={defaultPlaceholder} type="text" onChange={action('Changed')} {...props} />
|
|
57
|
+
</StoryGrid.Col>
|
|
58
|
+
<StoryGrid.Col title={'Disabled\u00A0Filled'}>
|
|
59
|
+
<InputText
|
|
60
|
+
disabled
|
|
61
|
+
placeholder={defaultPlaceholder}
|
|
62
|
+
value={filledValue}
|
|
63
|
+
type="text"
|
|
64
|
+
onChange={action('Changed')}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
</StoryGrid.Col>
|
|
68
|
+
</StoryGrid.Row>
|
|
69
|
+
</Section>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
storiesOf('kitt/Forms', module).add('InputText', () => (
|
|
74
|
+
<Story title="Input Text">
|
|
75
|
+
<Section.DemoSection>
|
|
76
|
+
<InputText placeholder="Placeholder" type="text" onChange={action('Changed')} />
|
|
77
|
+
<InputText placeholder="******" type="password" onChange={action('Changed')} />
|
|
78
|
+
</Section.DemoSection>
|
|
79
|
+
|
|
80
|
+
<InputTextVariation variationTitle="Default" />
|
|
81
|
+
<InputTextVariation variationTitle="Valid" state="valid" />
|
|
82
|
+
<InputTextVariation variationTitle="Invalid" state="invalid" />
|
|
83
|
+
<InputTextVariation variationTitle="Password" type="password" />
|
|
84
|
+
<InputTextVariation variationTitle="Email" type="email" />
|
|
85
|
+
<InputTextVariation variationTitle="Username" type="username" />
|
|
86
|
+
</Story>
|
|
87
|
+
));
|