@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.
Files changed (139) hide show
  1. package/package.json +4 -4
  2. package/CHANGELOG.md +0 -8
  3. package/src/.eslintrc.json +0 -19
  4. package/src/Avatar/Avatar.stories.tsx +0 -45
  5. package/src/Avatar/Avatar.tsx +0 -60
  6. package/src/Avatar/__snapshots__/Avatar.stories.tsx.snap +0 -1229
  7. package/src/Button/Button.stories.tsx +0 -301
  8. package/src/Button/Button.tsx +0 -60
  9. package/src/Button/ButtonContainer.tsx +0 -32
  10. package/src/Button/ButtonContent.tsx +0 -133
  11. package/src/Button/__snapshots__/Button.stories.tsx.snap +0 -7483
  12. package/src/Button/useButton.ts +0 -14
  13. package/src/Card/Card.stories.tsx +0 -31
  14. package/src/Card/Card.tsx +0 -25
  15. package/src/Card/__snapshots__/Card.stories.tsx.snap +0 -306
  16. package/src/FullScreenModal/Body.tsx +0 -25
  17. package/src/FullScreenModal/FullScreenModal.stories.tsx +0 -63
  18. package/src/FullScreenModal/FullScreenModal.tsx +0 -21
  19. package/src/FullScreenModal/Header.tsx +0 -129
  20. package/src/FullScreenModal/__snapshots__/FullScreenModal.stories.tsx.snap +0 -771
  21. package/src/Icon/Icon.stories.tsx +0 -59
  22. package/src/Icon/Icon.tsx +0 -37
  23. package/src/Icon/SpinningIcon.tsx +0 -38
  24. package/src/Icon/SpinningIcon.web.module.css +0 -13
  25. package/src/Icon/SpinningIcon.web.module.css.d.ts +0 -6
  26. package/src/Icon/SpinningIcon.web.tsx +0 -11
  27. package/src/Icon/__snapshots__/Icon.stories.tsx.snap +0 -5648
  28. package/src/KittBreakpoints.ts +0 -44
  29. package/src/ListItem/ListItem.stories.tsx +0 -122
  30. package/src/ListItem/ListItem.tsx +0 -61
  31. package/src/ListItem/ListItemContent.tsx +0 -17
  32. package/src/ListItem/ListItemSideContent.tsx +0 -41
  33. package/src/ListItem/__snapshots__/ListItem.stories.tsx.snap +0 -1514
  34. package/src/Loader/LargeLoader.tsx +0 -12
  35. package/src/Loader/LargeLoader.web.module.css +0 -103
  36. package/src/Loader/LargeLoader.web.module.css.d.ts +0 -11
  37. package/src/Loader/LargeLoader.web.test.tsx +0 -10
  38. package/src/Loader/LargeLoader.web.tsx +0 -18
  39. package/src/Loader/Loader.stories.tsx +0 -47
  40. package/src/Loader/Loader.tsx +0 -21
  41. package/src/Loader/Loader.web.test.tsx +0 -20
  42. package/src/Loader/Loader.web.tsx +0 -14
  43. package/src/Loader/__snapshots__/LargeLoader.web.test.tsx.snap +0 -33
  44. package/src/Loader/__snapshots__/Loader.stories.tsx.snap +0 -607
  45. package/src/Loader/__snapshots__/Loader.web.test.tsx.snap +0 -103
  46. package/src/Message/Message.stories.tsx +0 -102
  47. package/src/Message/Message.tsx +0 -114
  48. package/src/Message/__snapshots__/Message.stories.tsx.snap +0 -2776
  49. package/src/Modal/Body.tsx +0 -20
  50. package/src/Modal/Footer.tsx +0 -18
  51. package/src/Modal/Header.tsx +0 -66
  52. package/src/Modal/Modal.stories.tsx +0 -181
  53. package/src/Modal/Modal.tsx +0 -66
  54. package/src/Modal/OnCloseContext.ts +0 -3
  55. package/src/Modal/__snapshots__/Modal.stories.tsx.snap +0 -2960
  56. package/src/Notification/Notification.stories.tsx +0 -102
  57. package/src/Notification/Notification.tsx +0 -21
  58. package/src/Notification/__snapshots__/Notification.stories.tsx.snap +0 -2861
  59. package/src/Overlay/Overlay.tsx +0 -22
  60. package/src/Tag/Tag.stories.tsx +0 -18
  61. package/src/Tag/Tag.tsx +0 -31
  62. package/src/Tag/__snapshots__/Tag.stories.tsx.snap +0 -303
  63. package/src/Tooltip/Tooltip.tsx +0 -17
  64. package/src/__mocks__/react-native-safe-area-context.tsx +0 -26
  65. package/src/forms/InputFeedback/InputFeedback.stories.tsx +0 -17
  66. package/src/forms/InputFeedback/InputFeedback.tsx +0 -28
  67. package/src/forms/InputFeedback/__snapshots__/InputFeedback.stories.tsx.snap +0 -252
  68. package/src/forms/InputField/InputField.stories.tsx +0 -19
  69. package/src/forms/InputField/InputField.tsx +0 -45
  70. package/src/forms/InputField/__snapshots__/InputField.stories.tsx.snap +0 -240
  71. package/src/forms/InputFormState.ts +0 -1
  72. package/src/forms/InputText/InputText.stories.tsx +0 -85
  73. package/src/forms/InputText/InputText.tsx +0 -172
  74. package/src/forms/InputText/__snapshots__/InputText.stories.tsx.snap +0 -4274
  75. package/src/forms/InputText/useInputText.ts +0 -19
  76. package/src/forms/Label/Label.stories.tsx +0 -14
  77. package/src/forms/Label/Label.tsx +0 -17
  78. package/src/forms/Label/__snapshots__/Label.stories.tsx.snap +0 -174
  79. package/src/forms/Radio/Radio.stories.tsx +0 -48
  80. package/src/forms/Radio/Radio.tsx +0 -81
  81. package/src/forms/Radio/__snapshots__/Radio.stories.tsx.snap +0 -967
  82. package/src/forms/TextArea/TextArea.stories.tsx +0 -72
  83. package/src/forms/TextArea/TextArea.tsx +0 -12
  84. package/src/forms/TextArea/__snapshots__/TextArea.stories.tsx.snap +0 -2091
  85. package/src/index.ts +0 -61
  86. package/src/stories/Block.tsx +0 -24
  87. package/src/stories/Flex.tsx +0 -16
  88. package/src/stories/color-tokens.stories.tsx +0 -143
  89. package/src/stories-list.ts +0 -22
  90. package/src/story-components/Section.tsx +0 -56
  91. package/src/story-components/Story.tsx +0 -24
  92. package/src/story-components/StoryDecorator.tsx +0 -8
  93. package/src/story-components/StoryGrid.tsx +0 -80
  94. package/src/story-components/StoryTitle.stories.tsx +0 -12
  95. package/src/story-components/StoryTitle.tsx +0 -69
  96. package/src/story-components/__snapshots__/StoryTitle.stories.tsx.snap +0 -155
  97. package/src/story-components/index.ts +0 -5
  98. package/src/themes/default.ts +0 -34
  99. package/src/themes/late-ocean/avatarLateOceanTheme.ts +0 -12
  100. package/src/themes/late-ocean/buttonLateOceanTheme.ts +0 -37
  101. package/src/themes/late-ocean/cardLateOceanTheme.ts +0 -19
  102. package/src/themes/late-ocean/colorsLateOceanTheme.ts +0 -19
  103. package/src/themes/late-ocean/feedbackMessageLateOceanTheme.ts +0 -10
  104. package/src/themes/late-ocean/formLateOceanTheme.ts +0 -9
  105. package/src/themes/late-ocean/fullScreenModalLateOceanTheme.ts +0 -9
  106. package/src/themes/late-ocean/inputFieldLateOceanTheme.ts +0 -4
  107. package/src/themes/late-ocean/inputLateOceanTheme.ts +0 -55
  108. package/src/themes/late-ocean/listItemLateOceanTheme.ts +0 -8
  109. package/src/themes/late-ocean/radioLateOceanTheme.ts +0 -19
  110. package/src/themes/late-ocean/shadowsLateOceanTheme.ts +0 -3
  111. package/src/themes/late-ocean/tagLateOceanTheme.ts +0 -17
  112. package/src/themes/late-ocean/typographyLateOceanTheme.ts +0 -94
  113. package/src/themes/palettes/lateOceanColorPalette.ts +0 -24
  114. package/src/typings/babel-config.d.ts +0 -6
  115. package/src/typings/metro.d.ts +0 -6
  116. package/src/typography/Typography.stories.tsx +0 -113
  117. package/src/typography/Typography.tsx +0 -165
  118. package/src/typography/TypographyIcon.stories.tsx +0 -31
  119. package/src/typography/TypographyIcon.tsx +0 -35
  120. package/src/typography/TypographyLink.stories.tsx +0 -88
  121. package/src/typography/TypographyLink.tsx +0 -48
  122. package/src/typography/__snapshots__/Typography.stories.tsx.snap +0 -6118
  123. package/src/typography/__snapshots__/TypographyIcon.stories.tsx.snap +0 -334
  124. package/src/typography/__snapshots__/TypographyLink.stories.tsx.snap +0 -10945
  125. package/src/useKittTheme.tsx +0 -12
  126. package/src/utils/storybook/decorators/KittThemeDecorator.tsx +0 -27
  127. package/src/utils/storybook/decorators/SafeAreaProviderDecorator.tsx +0 -11
  128. package/src/utils/storybook/setup-global-decorators.ts +0 -6
  129. package/src/utils/tests/renderWithProvidersUtils.tsx +0 -17
  130. package/src/utils/typeUtils.ts +0 -6
  131. package/src/utils/windowSize/MatchWindowSize.tsx +0 -14
  132. package/src/utils/windowSize/__snapshots__/windowSize.stories.tsx.snap +0 -1485
  133. package/src/utils/windowSize/createWindowSizeHelper.test.ts +0 -11
  134. package/src/utils/windowSize/createWindowSizeHelper.ts +0 -65
  135. package/src/utils/windowSize/useMatchWindowSize.ts +0 -14
  136. package/src/utils/windowSize/useWindowSize.ts +0 -1
  137. package/src/utils/windowSize/windowSize.stories.tsx +0 -115
  138. package/tsconfig.build.json +0 -33
  139. package/tsconfig.json +0 -13
@@ -1,252 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`kitt-universal/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
- `;
@@ -1,19 +0,0 @@
1
- import { storiesOf } from '@storybook/react-native';
2
- import { Section, Story } from '@ornikar/kitt-universal';
3
- import React from 'react';
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
- storiesOf('kitt-universal/Forms', module).add('Input Field', () => (
10
- <Story title="Field Container">
11
- <Section title="Demo">
12
- <InputField
13
- label={<Label htmlFor="field_name">Label</Label>}
14
- input={<InputText type="text" accessibilityLabelledBy="field_name" />}
15
- feedback={<InputFeedback>Feedback</InputFeedback>}
16
- />
17
- </Section>
18
- </Story>
19
- ));
@@ -1,45 +0,0 @@
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
- }
@@ -1,240 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`kitt-universal/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
- `;
@@ -1 +0,0 @@
1
- export type InputFormState = undefined | 'valid' | 'invalid' | 'pending';
@@ -1,85 +0,0 @@
1
- import { action } from '@storybook/addon-actions';
2
- import { storiesOf } from '@storybook/react-native';
3
- import { Section, Story, StoryGrid } from '@ornikar/kitt-universal';
4
- import type { ReactElement } from 'react';
5
- import React from 'react';
6
- import type { InputTextProps } from './InputText';
7
- import { InputText } from './InputText';
8
-
9
- const defaultPlaceholder = 'Placeholder';
10
- const filledValue =
11
- 'The original Knight Rider series followed the adventures of Michael Knight, a modern-day crime fighter who uses a technologically advanced, artificially intelligent automobile.';
12
-
13
- interface InputTextVariationProps extends Partial<InputTextProps> {
14
- variationTitle: string;
15
- }
16
-
17
- function InputTextVariation({ variationTitle, ...props }: InputTextVariationProps): ReactElement {
18
- return (
19
- <Section key={variationTitle} title={variationTitle}>
20
- <StoryGrid.Row breakpoint="medium">
21
- <StoryGrid.Col title="Empty">
22
- <InputText placeholder={defaultPlaceholder} type="text" onChange={action('Changed')} {...props} />
23
- </StoryGrid.Col>
24
- <StoryGrid.Col title="Filled">
25
- <InputText
26
- placeholder={defaultPlaceholder}
27
- value={filledValue}
28
- type="text"
29
- onChange={action('Changed')}
30
- {...props}
31
- />
32
- </StoryGrid.Col>
33
- <StoryGrid.Col title="Hover">
34
- <InputText
35
- placeholder={defaultPlaceholder}
36
- value={filledValue}
37
- type="text"
38
- internalForceState="hover"
39
- onChange={action('Changed')}
40
- {...props}
41
- />
42
- </StoryGrid.Col>
43
- <StoryGrid.Col title="Focus">
44
- <InputText
45
- placeholder={defaultPlaceholder}
46
- value={filledValue}
47
- type="text"
48
- internalForceState="focus"
49
- onChange={action('Changed')}
50
- {...props}
51
- />
52
- </StoryGrid.Col>
53
- <StoryGrid.Col title="Disabled">
54
- <InputText disabled placeholder={defaultPlaceholder} type="text" onChange={action('Changed')} {...props} />
55
- </StoryGrid.Col>
56
- <StoryGrid.Col title={'Disabled\u00A0Filled'}>
57
- <InputText
58
- disabled
59
- placeholder={defaultPlaceholder}
60
- value={filledValue}
61
- type="text"
62
- onChange={action('Changed')}
63
- {...props}
64
- />
65
- </StoryGrid.Col>
66
- </StoryGrid.Row>
67
- </Section>
68
- );
69
- }
70
-
71
- storiesOf('kitt-universal/Forms', module).add('InputText', () => (
72
- <Story title="Input Text">
73
- <Section.DemoSection>
74
- <InputText placeholder="Placeholder" type="text" onChange={action('Changed')} />
75
- <InputText placeholder="******" type="password" onChange={action('Changed')} />
76
- </Section.DemoSection>
77
-
78
- <InputTextVariation variationTitle="Default" />
79
- <InputTextVariation variationTitle="Valid" state="valid" />
80
- <InputTextVariation variationTitle="Invalid" state="invalid" />
81
- <InputTextVariation variationTitle="Password" type="password" />
82
- <InputTextVariation variationTitle="Email" type="email" />
83
- <InputTextVariation variationTitle="Username" type="username" />
84
- </Story>
85
- ));