ignite-parse-auth-kit 1.0.0

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 (241) hide show
  1. package/CONTRIBUTING.md +0 -0
  2. package/LICENSE +21 -0
  3. package/README.md +492 -0
  4. package/app/app.tsx +116 -0
  5. package/app/components/AlertTongle.tsx +105 -0
  6. package/app/components/AutoImage.tsx +89 -0
  7. package/app/components/Button.tsx +248 -0
  8. package/app/components/Card.tsx +314 -0
  9. package/app/components/EmptyState.tsx +248 -0
  10. package/app/components/Header.tsx +332 -0
  11. package/app/components/Icon.tsx +140 -0
  12. package/app/components/ListItem.tsx +243 -0
  13. package/app/components/ListView.tsx +42 -0
  14. package/app/components/Screen.tsx +305 -0
  15. package/app/components/Text.test.tsx +23 -0
  16. package/app/components/Text.tsx +116 -0
  17. package/app/components/TextField.tsx +292 -0
  18. package/app/components/Toggle/Checkbox.tsx +123 -0
  19. package/app/components/Toggle/Radio.tsx +106 -0
  20. package/app/components/Toggle/Switch.tsx +264 -0
  21. package/app/components/Toggle/Toggle.tsx +285 -0
  22. package/app/components/index copy.ts +15 -0
  23. package/app/components/index.ts +18 -0
  24. package/app/config/config.base.ts +26 -0
  25. package/app/config/config.dev.ts +10 -0
  26. package/app/config/config.prod.ts +10 -0
  27. package/app/config/index.ts +28 -0
  28. package/app/context/AuthContext.tsx +14 -0
  29. package/app/context/EpisodeContext.tsx +136 -0
  30. package/app/context/auth/AuthProvider.tsx +340 -0
  31. package/app/context/auth/hooks.ts +29 -0
  32. package/app/context/auth/index.ts +38 -0
  33. package/app/context/auth/reducer.ts +68 -0
  34. package/app/context/auth/services.ts +394 -0
  35. package/app/context/auth/types.ts +99 -0
  36. package/app/context/auth/validation.ts +45 -0
  37. package/app/devtools/ReactotronClient.ts +9 -0
  38. package/app/devtools/ReactotronClient.web.ts +12 -0
  39. package/app/devtools/ReactotronConfig.ts +139 -0
  40. package/app/i18n/ar.ts +126 -0
  41. package/app/i18n/demo-ar.ts +464 -0
  42. package/app/i18n/demo-en.ts +462 -0
  43. package/app/i18n/demo-es.ts +469 -0
  44. package/app/i18n/demo-fr.ts +471 -0
  45. package/app/i18n/demo-hi.ts +468 -0
  46. package/app/i18n/demo-ja.ts +464 -0
  47. package/app/i18n/demo-ko.ts +457 -0
  48. package/app/i18n/en.ts +146 -0
  49. package/app/i18n/es.ts +132 -0
  50. package/app/i18n/fr.ts +132 -0
  51. package/app/i18n/hi.ts +131 -0
  52. package/app/i18n/index.ts +86 -0
  53. package/app/i18n/ja.ts +130 -0
  54. package/app/i18n/ko.ts +129 -0
  55. package/app/i18n/translate.ts +33 -0
  56. package/app/lib/Parse/index.ts +2 -0
  57. package/app/lib/Parse/parse.ts +62 -0
  58. package/app/navigators/AppNavigator.tsx +145 -0
  59. package/app/navigators/DemoNavigator.tsx +137 -0
  60. package/app/navigators/navigationUtilities.ts +208 -0
  61. package/app/screens/ChooseAuthScreen.tsx +224 -0
  62. package/app/screens/DemoCommunityScreen.tsx +141 -0
  63. package/app/screens/DemoDebugScreen.tsx +192 -0
  64. package/app/screens/DemoPodcastListScreen.tsx +387 -0
  65. package/app/screens/DemoShowroomScreen/DemoDivider.tsx +66 -0
  66. package/app/screens/DemoShowroomScreen/DemoShowroomScreen.tsx +313 -0
  67. package/app/screens/DemoShowroomScreen/DemoUseCase.tsx +52 -0
  68. package/app/screens/DemoShowroomScreen/DrawerIconButton.tsx +120 -0
  69. package/app/screens/DemoShowroomScreen/SectionListWithKeyboardAwareScrollView.tsx +59 -0
  70. package/app/screens/DemoShowroomScreen/demos/DemoAutoImage.tsx +230 -0
  71. package/app/screens/DemoShowroomScreen/demos/DemoButton.tsx +234 -0
  72. package/app/screens/DemoShowroomScreen/demos/DemoCard.tsx +181 -0
  73. package/app/screens/DemoShowroomScreen/demos/DemoEmptyState.tsx +78 -0
  74. package/app/screens/DemoShowroomScreen/demos/DemoHeader.tsx +151 -0
  75. package/app/screens/DemoShowroomScreen/demos/DemoIcon.tsx +115 -0
  76. package/app/screens/DemoShowroomScreen/demos/DemoListItem.tsx +218 -0
  77. package/app/screens/DemoShowroomScreen/demos/DemoText.tsx +144 -0
  78. package/app/screens/DemoShowroomScreen/demos/DemoTextField.tsx +233 -0
  79. package/app/screens/DemoShowroomScreen/demos/DemoToggle.tsx +354 -0
  80. package/app/screens/DemoShowroomScreen/demos/index.ts +12 -0
  81. package/app/screens/ErrorScreen/ErrorBoundary.tsx +76 -0
  82. package/app/screens/ErrorScreen/ErrorDetails.tsx +98 -0
  83. package/app/screens/ForgetPasswordScreen.tsx +180 -0
  84. package/app/screens/LoginScreen.tsx +260 -0
  85. package/app/screens/RegisterScreen.tsx +395 -0
  86. package/app/screens/WelcomeScreen.tsx +114 -0
  87. package/app/services/api/apiProblem.test.ts +73 -0
  88. package/app/services/api/apiProblem.ts +74 -0
  89. package/app/services/api/index.ts +91 -0
  90. package/app/services/api/types.ts +50 -0
  91. package/app/theme/colors.ts +85 -0
  92. package/app/theme/colorsDark.ts +50 -0
  93. package/app/theme/context.tsx +145 -0
  94. package/app/theme/context.utils.ts +25 -0
  95. package/app/theme/spacing.ts +14 -0
  96. package/app/theme/spacingDark.ts +14 -0
  97. package/app/theme/styles.ts +24 -0
  98. package/app/theme/theme.ts +23 -0
  99. package/app/theme/timing.ts +6 -0
  100. package/app/theme/types.ts +64 -0
  101. package/app/theme/typography.ts +71 -0
  102. package/app/utils/crashReporting.ts +62 -0
  103. package/app/utils/delay.ts +6 -0
  104. package/app/utils/formatDate.ts +49 -0
  105. package/app/utils/gestureHandler.native.ts +3 -0
  106. package/app/utils/gestureHandler.ts +6 -0
  107. package/app/utils/hasValidStringProp.ts +11 -0
  108. package/app/utils/openLinkInBrowser.ts +8 -0
  109. package/app/utils/storage/index.ts +82 -0
  110. package/app/utils/storage/storage.test.ts +61 -0
  111. package/app/utils/useHeader.tsx +37 -0
  112. package/app/utils/useIsMounted.ts +18 -0
  113. package/app/utils/useSafeAreaInsetsStyle.ts +46 -0
  114. package/app.config.ts +39 -0
  115. package/app.json +67 -0
  116. package/assets/icons/back.png +0 -0
  117. package/assets/icons/back@2x.png +0 -0
  118. package/assets/icons/back@3x.png +0 -0
  119. package/assets/icons/bell.png +0 -0
  120. package/assets/icons/bell@2x.png +0 -0
  121. package/assets/icons/bell@3x.png +0 -0
  122. package/assets/icons/caretLeft.png +0 -0
  123. package/assets/icons/caretLeft@2x.png +0 -0
  124. package/assets/icons/caretLeft@3x.png +0 -0
  125. package/assets/icons/caretRight.png +0 -0
  126. package/assets/icons/caretRight@2x.png +0 -0
  127. package/assets/icons/caretRight@3x.png +0 -0
  128. package/assets/icons/check.png +0 -0
  129. package/assets/icons/check@2x.png +0 -0
  130. package/assets/icons/check@3x.png +0 -0
  131. package/assets/icons/demo/clap.png +0 -0
  132. package/assets/icons/demo/clap@2x.png +0 -0
  133. package/assets/icons/demo/clap@3x.png +0 -0
  134. package/assets/icons/demo/community.png +0 -0
  135. package/assets/icons/demo/community@2x.png +0 -0
  136. package/assets/icons/demo/community@3x.png +0 -0
  137. package/assets/icons/demo/components.png +0 -0
  138. package/assets/icons/demo/components@2x.png +0 -0
  139. package/assets/icons/demo/components@3x.png +0 -0
  140. package/assets/icons/demo/debug.png +0 -0
  141. package/assets/icons/demo/debug@2x.png +0 -0
  142. package/assets/icons/demo/debug@3x.png +0 -0
  143. package/assets/icons/demo/github.png +0 -0
  144. package/assets/icons/demo/github@2x.png +0 -0
  145. package/assets/icons/demo/github@3x.png +0 -0
  146. package/assets/icons/demo/heart.png +0 -0
  147. package/assets/icons/demo/heart@2x.png +0 -0
  148. package/assets/icons/demo/heart@3x.png +0 -0
  149. package/assets/icons/demo/pin.png +0 -0
  150. package/assets/icons/demo/pin@2x.png +0 -0
  151. package/assets/icons/demo/pin@3x.png +0 -0
  152. package/assets/icons/demo/podcast.png +0 -0
  153. package/assets/icons/demo/podcast@2x.png +0 -0
  154. package/assets/icons/demo/podcast@3x.png +0 -0
  155. package/assets/icons/demo/slack.png +0 -0
  156. package/assets/icons/demo/slack@2x.png +0 -0
  157. package/assets/icons/demo/slack@3x.png +0 -0
  158. package/assets/icons/google.png +0 -0
  159. package/assets/icons/hidden.png +0 -0
  160. package/assets/icons/hidden@2x.png +0 -0
  161. package/assets/icons/hidden@3x.png +0 -0
  162. package/assets/icons/ladybug.png +0 -0
  163. package/assets/icons/ladybug@2x.png +0 -0
  164. package/assets/icons/ladybug@3x.png +0 -0
  165. package/assets/icons/lock.png +0 -0
  166. package/assets/icons/lock@2x.png +0 -0
  167. package/assets/icons/lock@3x.png +0 -0
  168. package/assets/icons/menu.png +0 -0
  169. package/assets/icons/menu@2x.png +0 -0
  170. package/assets/icons/menu@3x.png +0 -0
  171. package/assets/icons/more.png +0 -0
  172. package/assets/icons/more@2x.png +0 -0
  173. package/assets/icons/more@3x.png +0 -0
  174. package/assets/icons/settings.png +0 -0
  175. package/assets/icons/settings@2x.png +0 -0
  176. package/assets/icons/settings@3x.png +0 -0
  177. package/assets/icons/view.png +0 -0
  178. package/assets/icons/view@2x.png +0 -0
  179. package/assets/icons/view@3x.png +0 -0
  180. package/assets/icons/x.png +0 -0
  181. package/assets/icons/x@2x.png +0 -0
  182. package/assets/icons/x@3x.png +0 -0
  183. package/assets/images/app-icon-all.png +0 -0
  184. package/assets/images/app-icon-android-adaptive-background.png +0 -0
  185. package/assets/images/app-icon-android-adaptive-foreground.png +0 -0
  186. package/assets/images/app-icon-android-legacy.png +0 -0
  187. package/assets/images/app-icon-ios.png +0 -0
  188. package/assets/images/app-icon-web-favicon.png +0 -0
  189. package/assets/images/demo/cr-logo.png +0 -0
  190. package/assets/images/demo/cr-logo@2x.png +0 -0
  191. package/assets/images/demo/cr-logo@3x.png +0 -0
  192. package/assets/images/demo/rnl-logo.png +0 -0
  193. package/assets/images/demo/rnl-logo@2x.png +0 -0
  194. package/assets/images/demo/rnl-logo@3x.png +0 -0
  195. package/assets/images/demo/rnn-logo.png +0 -0
  196. package/assets/images/demo/rnn-logo@2x.png +0 -0
  197. package/assets/images/demo/rnn-logo@3x.png +0 -0
  198. package/assets/images/demo/rnr-image-1.png +0 -0
  199. package/assets/images/demo/rnr-image-1@2x.png +0 -0
  200. package/assets/images/demo/rnr-image-1@3x.png +0 -0
  201. package/assets/images/demo/rnr-image-2.png +0 -0
  202. package/assets/images/demo/rnr-image-2@2x.png +0 -0
  203. package/assets/images/demo/rnr-image-2@3x.png +0 -0
  204. package/assets/images/demo/rnr-image-3.png +0 -0
  205. package/assets/images/demo/rnr-image-3@2x.png +0 -0
  206. package/assets/images/demo/rnr-image-3@3x.png +0 -0
  207. package/assets/images/demo/rnr-logo.png +0 -0
  208. package/assets/images/demo/rnr-logo@2x.png +0 -0
  209. package/assets/images/demo/rnr-logo@3x.png +0 -0
  210. package/assets/images/logo.png +0 -0
  211. package/assets/images/logo@2x.png +0 -0
  212. package/assets/images/logo@3x.png +0 -0
  213. package/assets/images/sad-face.png +0 -0
  214. package/assets/images/sad-face@2x.png +0 -0
  215. package/assets/images/sad-face@3x.png +0 -0
  216. package/assets/images/welcome-face.png +0 -0
  217. package/assets/images/welcome-face@2x.png +0 -0
  218. package/assets/images/welcome-face@3x.png +0 -0
  219. package/babel.config.js +7 -0
  220. package/bin/cli.js +196 -0
  221. package/ignite/templates/app-icon/android-adaptive-background.png +0 -0
  222. package/ignite/templates/app-icon/android-adaptive-foreground.png +0 -0
  223. package/ignite/templates/app-icon/android-legacy.png +0 -0
  224. package/ignite/templates/app-icon/ios-universal.png +0 -0
  225. package/ignite/templates/component/NAME.tsx.ejs +39 -0
  226. package/ignite/templates/navigator/NAMENavigator.tsx.ejs +18 -0
  227. package/ignite/templates/screen/NAMEScreen.tsx.ejs +29 -0
  228. package/ignite/templates/splash-screen/logo.png +0 -0
  229. package/index.tsx +9 -0
  230. package/jest.config.js +5 -0
  231. package/metro.config.js +31 -0
  232. package/package.json +166 -0
  233. package/plugins/withSplashScreen.ts +69 -0
  234. package/src/app/_layout.tsx +58 -0
  235. package/src/app/index.tsx +5 -0
  236. package/test/i18n.test.ts +75 -0
  237. package/test/mockFile.ts +6 -0
  238. package/test/setup.ts +58 -0
  239. package/test/test-tsconfig.json +8 -0
  240. package/tsconfig.json +52 -0
  241. package/types/lib.es5.d.ts +25 -0
@@ -0,0 +1,218 @@
1
+ /* eslint-disable react/jsx-key */
2
+ import { TextStyle, View, ViewStyle } from "react-native"
3
+
4
+ import { Icon } from "@/components/Icon"
5
+ import { ListItem } from "@/components/ListItem"
6
+ import { ListView } from "@/components/ListView"
7
+ import { Text } from "@/components/Text"
8
+ import { translate } from "@/i18n/translate"
9
+ import type { ThemedStyle } from "@/theme/types"
10
+ import { $styles } from "@/theme/styles"
11
+
12
+ import { DemoDivider } from "../DemoDivider"
13
+ import { Demo } from "../DemoShowroomScreen"
14
+ import { DemoUseCase } from "../DemoUseCase"
15
+
16
+ const listData =
17
+ `Tempor Id Ea Aliqua Pariatur Aliquip. Irure Minim Voluptate Consectetur Consequat Sint Esse Proident Irure. Nostrud Elit Veniam Nostrud Excepteur Minim Deserunt Quis Dolore Velit Nulla Irure Voluptate Tempor. Occaecat Amet Laboris Nostrud Qui Do Quis Lorem Ex Elit Fugiat Deserunt. In Pariatur Excepteur Exercitation Ex Incididunt Qui Mollit Dolor Sit Non. Culpa Officia Minim Cillum Exercitation Voluptate Proident Laboris Et Est Reprehenderit Quis Pariatur Nisi`
18
+ .split(".")
19
+ .map((item) => item.trim())
20
+
21
+ const $customLeft: ThemedStyle<ViewStyle> = ({ colors }) => ({
22
+ backgroundColor: colors.error,
23
+ flexGrow: 0,
24
+ flexBasis: 60,
25
+ height: "100%",
26
+ flexWrap: "wrap",
27
+ overflow: "hidden",
28
+ })
29
+
30
+ const $customTextStyle: ThemedStyle<TextStyle> = ({ colors }) => ({
31
+ color: colors.error,
32
+ })
33
+
34
+ const $customTouchableStyle: ThemedStyle<ViewStyle> = ({ colors }) => ({
35
+ backgroundColor: colors.error,
36
+ })
37
+
38
+ const $customContainerStyle: ThemedStyle<ViewStyle> = ({ colors }) => ({
39
+ borderTopWidth: 5,
40
+ borderTopColor: colors.palette.neutral100,
41
+ })
42
+
43
+ const $listStyle: ThemedStyle<ViewStyle> = ({ colors, spacing }) => ({
44
+ height: 148,
45
+ paddingHorizontal: spacing.xs,
46
+ backgroundColor: colors.palette.neutral200,
47
+ })
48
+
49
+ export const DemoListItem: Demo = {
50
+ name: "ListItem",
51
+ description: "demoListItem:description",
52
+ data: ({ theme, themed }) => [
53
+ <DemoUseCase
54
+ name="demoListItem:useCase.height.name"
55
+ description="demoListItem:useCase.height.description"
56
+ >
57
+ <ListItem topSeparator>{translate("demoListItem:useCase.height.defaultHeight")}</ListItem>
58
+
59
+ <ListItem topSeparator height={100}>
60
+ {translate("demoListItem:useCase.height.customHeight")}
61
+ </ListItem>
62
+
63
+ <ListItem topSeparator>{translate("demoListItem:useCase.height.textHeight")}</ListItem>
64
+
65
+ <ListItem topSeparator bottomSeparator TextProps={{ numberOfLines: 1 }}>
66
+ {translate("demoListItem:useCase.height.longText")}
67
+ </ListItem>
68
+ </DemoUseCase>,
69
+
70
+ <DemoUseCase
71
+ name="demoListItem:useCase.separators.name"
72
+ description="demoListItem:useCase.separators.description"
73
+ >
74
+ <ListItem topSeparator>{translate("demoListItem:useCase.separators.topSeparator")}</ListItem>
75
+
76
+ <DemoDivider size={40} />
77
+
78
+ <ListItem topSeparator bottomSeparator>
79
+ {translate("demoListItem:useCase.separators.topAndBottomSeparator")}
80
+ </ListItem>
81
+
82
+ <DemoDivider size={40} />
83
+
84
+ <ListItem bottomSeparator>
85
+ {translate("demoListItem:useCase.separators.bottomSeparator")}
86
+ </ListItem>
87
+ </DemoUseCase>,
88
+
89
+ <DemoUseCase
90
+ name="demoListItem:useCase.icons.name"
91
+ description="demoListItem:useCase.icons.description"
92
+ >
93
+ <ListItem topSeparator leftIcon="ladybug">
94
+ {translate("demoListItem:useCase.icons.leftIcon")}
95
+ </ListItem>
96
+
97
+ <ListItem topSeparator rightIcon="ladybug">
98
+ {translate("demoListItem:useCase.icons.rightIcon")}
99
+ </ListItem>
100
+
101
+ <ListItem topSeparator bottomSeparator rightIcon="ladybug" leftIcon="ladybug">
102
+ {translate("demoListItem:useCase.icons.leftRightIcons")}
103
+ </ListItem>
104
+ </DemoUseCase>,
105
+
106
+ <DemoUseCase
107
+ name="demoListItem:useCase.customLeftRight.name"
108
+ description="demoListItem:useCase.customLeftRight.description"
109
+ >
110
+ <ListItem
111
+ topSeparator
112
+ LeftComponent={
113
+ <View style={themed([$styles.row, $customLeft, { marginEnd: theme.spacing.md }])}>
114
+ {Array.from({ length: 9 }, (x, i) => i).map((i) => (
115
+ <Icon key={i} icon="ladybug" color={theme.colors.palette.neutral100} size={20} />
116
+ ))}
117
+ </View>
118
+ }
119
+ >
120
+ {translate("demoListItem:useCase.customLeftRight.customLeft")}
121
+ </ListItem>
122
+
123
+ <ListItem
124
+ topSeparator
125
+ bottomSeparator
126
+ RightComponent={
127
+ <View style={themed([$styles.row, $customLeft, { marginStart: theme.spacing.md }])}>
128
+ {Array.from({ length: 9 }, (x, i) => i).map((i) => (
129
+ <Icon key={i} icon="ladybug" color={theme.colors.palette.neutral100} size={20} />
130
+ ))}
131
+ </View>
132
+ }
133
+ >
134
+ {translate("demoListItem:useCase.customLeftRight.customRight")}
135
+ </ListItem>
136
+ </DemoUseCase>,
137
+
138
+ <DemoUseCase
139
+ name="demoListItem:useCase.passingContent.name"
140
+ description="demoListItem:useCase.passingContent.description"
141
+ >
142
+ <ListItem topSeparator text={translate("demoListItem:useCase.passingContent.children")} />
143
+ <ListItem topSeparator tx="demoShowroomScreen:demoViaTxProp" />
144
+ <ListItem topSeparator>{translate("demoListItem:useCase.passingContent.children")}</ListItem>
145
+ <ListItem topSeparator bottomSeparator>
146
+ <Text>
147
+ <Text preset="bold">
148
+ {translate("demoListItem:useCase.passingContent.nestedChildren1")}
149
+ </Text>
150
+ {` `}
151
+ <Text preset="default">
152
+ {translate("demoListItem:useCase.passingContent.nestedChildren2")}
153
+ </Text>
154
+ </Text>
155
+ </ListItem>
156
+ </DemoUseCase>,
157
+
158
+ <DemoUseCase
159
+ name="demoListItem:useCase.listIntegration.name"
160
+ description="demoListItem:useCase.listIntegration.description"
161
+ >
162
+ <View style={themed($listStyle)}>
163
+ <ListView<string>
164
+ data={listData}
165
+ estimatedItemSize={59}
166
+ renderItem={({ item, index }) => (
167
+ <ListItem
168
+ text={item}
169
+ rightIcon="caretRight"
170
+ TextProps={{ numberOfLines: 1 }}
171
+ topSeparator={index !== 0}
172
+ />
173
+ )}
174
+ />
175
+ </View>
176
+ </DemoUseCase>,
177
+
178
+ <DemoUseCase
179
+ name="demoListItem:useCase.styling.name"
180
+ description="demoListItem:useCase.styling.description"
181
+ >
182
+ <ListItem topSeparator textStyle={themed($customTextStyle)}>
183
+ {translate("demoListItem:useCase.styling.styledText")}
184
+ </ListItem>
185
+
186
+ <ListItem
187
+ topSeparator
188
+ textStyle={{ color: theme.colors.palette.neutral100 }}
189
+ style={themed($customTouchableStyle)}
190
+ >
191
+ {translate("demoListItem:useCase.styling.styledText")}
192
+ </ListItem>
193
+
194
+ <ListItem
195
+ topSeparator
196
+ textStyle={{ color: theme.colors.palette.neutral100 }}
197
+ style={themed($customTouchableStyle)}
198
+ containerStyle={themed($customContainerStyle)}
199
+ >
200
+ {translate("demoListItem:useCase.styling.styledContainer")}
201
+ </ListItem>
202
+ <ListItem
203
+ topSeparator
204
+ textStyle={{ color: theme.colors.palette.neutral100 }}
205
+ style={themed($customTouchableStyle)}
206
+ containerStyle={themed($customContainerStyle)}
207
+ rightIcon="ladybug"
208
+ leftIcon="ladybug"
209
+ rightIconColor={theme.colors.palette.neutral100}
210
+ leftIconColor={theme.colors.palette.neutral100}
211
+ >
212
+ {translate("demoListItem:useCase.styling.tintedIcons")}
213
+ </ListItem>
214
+ </DemoUseCase>,
215
+ ],
216
+ }
217
+
218
+ // @demo remove-file
@@ -0,0 +1,144 @@
1
+ /* eslint-disable react/jsx-key, react-native/no-inline-styles */
2
+ import { Text } from "@/components/Text"
3
+ import { translate } from "@/i18n/translate"
4
+
5
+ import { DemoDivider } from "../DemoDivider"
6
+ import { Demo } from "../DemoShowroomScreen"
7
+ import { DemoUseCase } from "../DemoUseCase"
8
+
9
+ export const DemoText: Demo = {
10
+ name: "Text",
11
+ description: "demoText:description",
12
+ data: ({ theme }) => [
13
+ <DemoUseCase
14
+ name="demoText:useCase.presets.name"
15
+ description="demoText:useCase.presets.description"
16
+ >
17
+ <Text>{translate("demoText:useCase.presets.default")}</Text>
18
+
19
+ <DemoDivider />
20
+
21
+ <Text preset="bold">{translate("demoText:useCase.presets.bold")}</Text>
22
+
23
+ <DemoDivider />
24
+
25
+ <Text preset="subheading">{translate("demoText:useCase.presets.subheading")}</Text>
26
+
27
+ <DemoDivider />
28
+
29
+ <Text preset="heading">{translate("demoText:useCase.presets.heading")}</Text>
30
+ </DemoUseCase>,
31
+
32
+ <DemoUseCase
33
+ name="demoText:useCase.sizes.name"
34
+ description="demoText:useCase.sizes.description"
35
+ >
36
+ <Text size="xs">{translate("demoText:useCase.sizes.xs")}</Text>
37
+
38
+ <DemoDivider />
39
+
40
+ <Text size="sm">{translate("demoText:useCase.sizes.sm")}</Text>
41
+
42
+ <DemoDivider />
43
+
44
+ <Text size="md">{translate("demoText:useCase.sizes.md")}</Text>
45
+
46
+ <DemoDivider />
47
+
48
+ <Text size="lg">{translate("demoText:useCase.sizes.lg")}</Text>
49
+
50
+ <DemoDivider />
51
+
52
+ <Text size="xl">{translate("demoText:useCase.sizes.xl")}</Text>
53
+
54
+ <DemoDivider />
55
+
56
+ <Text size="xxl">{translate("demoText:useCase.sizes.xxl")}</Text>
57
+ </DemoUseCase>,
58
+
59
+ <DemoUseCase
60
+ name="demoText:useCase.weights.name"
61
+ description="demoText:useCase.weights.description"
62
+ >
63
+ <Text weight="light">{translate("demoText:useCase.weights.light")}</Text>
64
+
65
+ <DemoDivider />
66
+
67
+ <Text weight="normal">{translate("demoText:useCase.weights.normal")}</Text>
68
+
69
+ <DemoDivider />
70
+
71
+ <Text weight="medium">{translate("demoText:useCase.weights.medium")}</Text>
72
+
73
+ <DemoDivider />
74
+
75
+ <Text weight="semiBold">{translate("demoText:useCase.weights.semibold")}</Text>
76
+
77
+ <DemoDivider />
78
+
79
+ <Text weight="bold">{translate("demoText:useCase.weights.bold")}</Text>
80
+ </DemoUseCase>,
81
+
82
+ <DemoUseCase
83
+ name="demoText:useCase.passingContent.name"
84
+ description="demoText:useCase.passingContent.description"
85
+ >
86
+ <Text text={translate("demoText:useCase.passingContent.viaText")} />
87
+
88
+ <DemoDivider />
89
+
90
+ <Text>
91
+ <Text tx="demoText:useCase.passingContent.viaTx" />
92
+ <Text tx="demoShowroomScreen:lorem2Sentences" />
93
+ </Text>
94
+
95
+ <DemoDivider />
96
+
97
+ <Text>{translate("demoText:useCase.passingContent.children")}</Text>
98
+
99
+ <DemoDivider />
100
+
101
+ <Text>
102
+ <Text>{translate("demoText:useCase.passingContent.nestedChildren")}</Text>
103
+ <Text preset="bold">{translate("demoText:useCase.passingContent.nestedChildren2")}</Text>
104
+ {` `}
105
+ <Text preset="default">{translate("demoText:useCase.passingContent.nestedChildren3")}</Text>
106
+ {` `}
107
+ <Text preset="bold"> {translate("demoText:useCase.passingContent.nestedChildren4")}</Text>
108
+ </Text>
109
+ </DemoUseCase>,
110
+
111
+ <DemoUseCase
112
+ name="demoText:useCase.styling.name"
113
+ description="demoText:useCase.styling.description"
114
+ >
115
+ <Text>
116
+ <Text style={{ color: theme.colors.error }}>
117
+ {translate("demoText:useCase.styling.text")}
118
+ </Text>
119
+ {` `}
120
+ <Text
121
+ style={{
122
+ color: theme.colors.palette.neutral100,
123
+ backgroundColor: theme.colors.error,
124
+ }}
125
+ >
126
+ {translate("demoText:useCase.styling.text2")}
127
+ </Text>
128
+ {` `}
129
+ <Text
130
+ style={{
131
+ textDecorationLine: "underline line-through",
132
+ textDecorationStyle: "dashed",
133
+ color: theme.colors.error,
134
+ textDecorationColor: theme.colors.error,
135
+ }}
136
+ >
137
+ {translate("demoText:useCase.styling.text3")}
138
+ </Text>
139
+ </Text>
140
+ </DemoUseCase>,
141
+ ],
142
+ }
143
+
144
+ // @demo remove-file
@@ -0,0 +1,233 @@
1
+ /* eslint-disable react/jsx-key */
2
+ import { TextStyle, ViewStyle } from "react-native"
3
+
4
+ import { Icon } from "@/components/Icon"
5
+ import { TextField } from "@/components/TextField"
6
+ import type { ThemedStyle } from "@/theme/types"
7
+
8
+ import { DemoDivider } from "../DemoDivider"
9
+ import { Demo } from "../DemoShowroomScreen"
10
+ import { DemoUseCase } from "../DemoUseCase"
11
+
12
+ const $customInputStyle: ThemedStyle<TextStyle> = ({ colors }) => ({
13
+ backgroundColor: colors.error,
14
+ color: colors.palette.neutral100,
15
+ })
16
+
17
+ const $customInputWrapperStyle: ThemedStyle<ViewStyle> = ({ colors }) => ({
18
+ backgroundColor: colors.error,
19
+ borderColor: colors.palette.neutral800,
20
+ })
21
+
22
+ const $customContainerStyle: ThemedStyle<ViewStyle> = ({ colors }) => ({
23
+ backgroundColor: colors.error,
24
+ })
25
+
26
+ const $customLabelAndHelperStyle: ThemedStyle<TextStyle> = ({ colors }) => ({
27
+ color: colors.palette.neutral100,
28
+ })
29
+
30
+ const $customInputWithAbsoluteAccessoriesStyle: ThemedStyle<ViewStyle> = ({ spacing }) => ({
31
+ marginHorizontal: spacing.xxl,
32
+ })
33
+
34
+ const $customLeftAccessoryStyle: ThemedStyle<ViewStyle> = ({ colors }) => ({
35
+ backgroundColor: colors.error,
36
+ position: "absolute",
37
+ left: 0,
38
+ })
39
+
40
+ const $customRightAccessoryStyle: ThemedStyle<ViewStyle> = ({ colors }) => ({
41
+ backgroundColor: colors.error,
42
+ position: "absolute",
43
+ right: 0,
44
+ })
45
+
46
+ export const DemoTextField: Demo = {
47
+ name: "TextField",
48
+ description: "demoTextField:description",
49
+ data: ({ themed }) => [
50
+ <DemoUseCase
51
+ name="demoTextField:useCase.statuses.name"
52
+ description="demoTextField:useCase.statuses.description"
53
+ >
54
+ <TextField
55
+ value="Labore occaecat in id eu commodo aliquip occaecat veniam officia pariatur."
56
+ labelTx="demoTextField:useCase.statuses.noStatus.label"
57
+ labelTxOptions={{ prop: "label" }}
58
+ helperTx="demoTextField:useCase.statuses.noStatus.helper"
59
+ helperTxOptions={{ prop: "helper" }}
60
+ placeholderTx="demoTextField:useCase.statuses.noStatus.placeholder"
61
+ placeholderTxOptions={{ prop: "placeholder" }}
62
+ />
63
+
64
+ <DemoDivider size={24} />
65
+
66
+ <TextField
67
+ status="error"
68
+ value="Est Lorem duis sunt sunt duis proident minim elit dolore incididunt pariatur eiusmod anim cillum."
69
+ labelTx="demoTextField:useCase.statuses.error.label"
70
+ labelTxOptions={{ prop: "label" }}
71
+ helperTx="demoTextField:useCase.statuses.error.helper"
72
+ helperTxOptions={{ prop: "helper" }}
73
+ placeholderTx="demoTextField:useCase.statuses.error.placeholder"
74
+ placeholderTxOptions={{ prop: "placeholder" }}
75
+ />
76
+
77
+ <DemoDivider size={24} />
78
+
79
+ <TextField
80
+ status="disabled"
81
+ value="Eu ipsum mollit non minim voluptate nulla fugiat aliqua ullamco aute consectetur nulla nulla amet."
82
+ labelTx="demoTextField:useCase.statuses.disabled.label"
83
+ labelTxOptions={{ prop: "label" }}
84
+ helperTx="demoTextField:useCase.statuses.disabled.helper"
85
+ helperTxOptions={{ prop: "helper" }}
86
+ placeholderTx="demoTextField:useCase.statuses.disabled.placeholder"
87
+ placeholderTxOptions={{ prop: "placeholder" }}
88
+ />
89
+ </DemoUseCase>,
90
+
91
+ <DemoUseCase
92
+ name="demoTextField:useCase.passingContent.name"
93
+ description="demoTextField:useCase.passingContent.description"
94
+ >
95
+ <TextField
96
+ labelTx="demoTextField:useCase.passingContent.viaLabel.labelTx"
97
+ labelTxOptions={{ prop: "label" }}
98
+ helperTx="demoTextField:useCase.passingContent.viaLabel.helper"
99
+ helperTxOptions={{ prop: "helper" }}
100
+ placeholderTx="demoTextField:useCase.passingContent.viaLabel.placeholder"
101
+ placeholderTxOptions={{ prop: "placeholder" }}
102
+ />
103
+
104
+ <DemoDivider size={24} />
105
+
106
+ <TextField
107
+ labelTx="demoShowroomScreen:demoViaSpecifiedTxProp"
108
+ labelTxOptions={{ prop: "label" }}
109
+ helperTx="demoShowroomScreen:demoViaSpecifiedTxProp"
110
+ helperTxOptions={{ prop: "helper" }}
111
+ placeholderTx="demoShowroomScreen:demoViaSpecifiedTxProp"
112
+ placeholderTxOptions={{ prop: "placeholder" }}
113
+ />
114
+
115
+ <DemoDivider size={24} />
116
+
117
+ <TextField
118
+ value="Reprehenderit Lorem magna non consequat ullamco cupidatat."
119
+ labelTx="demoTextField:useCase.passingContent.rightAccessory.label"
120
+ labelTxOptions={{ prop: "label" }}
121
+ helperTx="demoTextField:useCase.passingContent.rightAccessory.helper"
122
+ helperTxOptions={{ prop: "helper" }}
123
+ RightAccessory={(props) => <Icon icon="ladybug" containerStyle={props.style} size={21} />}
124
+ />
125
+
126
+ <DemoDivider size={24} />
127
+
128
+ <TextField
129
+ labelTx="demoTextField:useCase.passingContent.leftAccessory.label"
130
+ labelTxOptions={{ prop: "label" }}
131
+ helperTx="demoTextField:useCase.passingContent.leftAccessory.helper"
132
+ helperTxOptions={{ prop: "helper" }}
133
+ value="Eiusmod exercitation mollit elit magna occaecat eiusmod Lorem minim veniam."
134
+ LeftAccessory={(props) => <Icon icon="ladybug" containerStyle={props.style} size={21} />}
135
+ />
136
+
137
+ <DemoDivider size={24} />
138
+
139
+ <TextField
140
+ labelTx="demoTextField:useCase.passingContent.supportsMultiline.label"
141
+ labelTxOptions={{ prop: "label" }}
142
+ helperTx="demoTextField:useCase.passingContent.supportsMultiline.helper"
143
+ helperTxOptions={{ prop: "helper" }}
144
+ value="Eiusmod exercitation mollit elit magna occaecat eiusmod Lorem minim veniam. Laborum Lorem velit velit minim irure ad in ut adipisicing consectetur."
145
+ multiline
146
+ RightAccessory={(props) => <Icon icon="ladybug" containerStyle={props.style} size={21} />}
147
+ />
148
+ </DemoUseCase>,
149
+
150
+ <DemoUseCase
151
+ name="demoTextField:useCase.styling.name"
152
+ description="demoTextField:useCase.styling.description"
153
+ >
154
+ <TextField
155
+ labelTx="demoTextField:useCase.styling.styleInput.label"
156
+ labelTxOptions={{ prop: "label" }}
157
+ helperTx="demoTextField:useCase.styling.styleInput.helper"
158
+ helperTxOptions={{ prop: "helper" }}
159
+ value="Laborum cupidatat aliquip sunt sunt voluptate sint sit proident sunt mollit exercitation ullamco ea elit."
160
+ style={themed($customInputStyle)}
161
+ />
162
+
163
+ <DemoDivider size={24} />
164
+
165
+ <TextField
166
+ labelTx="demoTextField:useCase.styling.styleInputWrapper.label"
167
+ labelTxOptions={{ prop: "label" }}
168
+ helperTx="demoTextField:useCase.styling.styleInputWrapper.helper"
169
+ helperTxOptions={{ prop: "helper" }}
170
+ value="Aute velit esse dolore pariatur exercitation irure nulla do sunt in duis mollit duis et."
171
+ inputWrapperStyle={themed($customInputWrapperStyle)}
172
+ style={themed($customInputStyle)}
173
+ />
174
+
175
+ <DemoDivider size={24} />
176
+
177
+ <TextField
178
+ labelTx="demoTextField:useCase.styling.styleContainer.label"
179
+ labelTxOptions={{ prop: "label" }}
180
+ helperTx="demoTextField:useCase.styling.styleContainer.helper"
181
+ helperTxOptions={{ prop: "helper" }}
182
+ value="Aliquip proident commodo adipisicing non adipisicing Lorem excepteur ullamco voluptate laborum."
183
+ style={themed($customInputStyle)}
184
+ containerStyle={themed($customContainerStyle)}
185
+ inputWrapperStyle={themed($customInputWrapperStyle)}
186
+ />
187
+
188
+ <DemoDivider size={24} />
189
+
190
+ <TextField
191
+ labelTx="demoTextField:useCase.styling.styleLabel.label"
192
+ labelTxOptions={{ prop: "label" }}
193
+ helperTx="demoTextField:useCase.styling.styleLabel.helper"
194
+ helperTxOptions={{ prop: "helper" }}
195
+ value="Ex culpa in consectetur dolor irure velit."
196
+ style={themed($customInputStyle)}
197
+ containerStyle={themed($customContainerStyle)}
198
+ inputWrapperStyle={themed($customInputWrapperStyle)}
199
+ HelperTextProps={{ style: themed($customLabelAndHelperStyle) }}
200
+ LabelTextProps={{ style: themed($customLabelAndHelperStyle) }}
201
+ />
202
+
203
+ <DemoDivider size={24} />
204
+
205
+ <TextField
206
+ labelTx="demoTextField:useCase.styling.styleAccessories.label"
207
+ labelTxOptions={{ prop: "label" }}
208
+ helperTx="demoTextField:useCase.styling.styleAccessories.helper"
209
+ helperTxOptions={{ prop: "helper" }}
210
+ value="Aute nisi dolore fugiat anim mollit nulla ex minim ipsum ex elit."
211
+ style={themed($customInputWithAbsoluteAccessoriesStyle)}
212
+ LeftAccessory={() => (
213
+ <Icon
214
+ icon="ladybug"
215
+ containerStyle={themed($customLeftAccessoryStyle)}
216
+ color="white"
217
+ size={41}
218
+ />
219
+ )}
220
+ RightAccessory={() => (
221
+ <Icon
222
+ icon="ladybug"
223
+ containerStyle={themed($customRightAccessoryStyle)}
224
+ color="white"
225
+ size={41}
226
+ />
227
+ )}
228
+ />
229
+ </DemoUseCase>,
230
+ ],
231
+ }
232
+
233
+ // @demo remove-file