@factorialco/f0-react-native 0.19.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 (310) hide show
  1. package/README.md +54 -0
  2. package/package.json +84 -0
  3. package/src/components/Activity/ActivityItem/__snapshots__/index.spec.tsx.snap +62 -0
  4. package/src/components/Activity/ActivityItem/index.spec.tsx +103 -0
  5. package/src/components/Activity/ActivityItem/index.tsx +90 -0
  6. package/src/components/Avatars/Avatar.tsx +56 -0
  7. package/src/components/Avatars/BaseAvatar/index.tsx +126 -0
  8. package/src/components/Avatars/BaseAvatar/utils.ts +73 -0
  9. package/src/components/Avatars/CompanyAvatar/__snapshots__/index.spec.tsx.snap +25 -0
  10. package/src/components/Avatars/CompanyAvatar/index.spec.tsx +11 -0
  11. package/src/components/Avatars/CompanyAvatar/index.tsx +36 -0
  12. package/src/components/Avatars/DateAvatar/__snapshots__/index.spec.tsx.snap +18 -0
  13. package/src/components/Avatars/DateAvatar/index.spec.tsx +12 -0
  14. package/src/components/Avatars/DateAvatar/index.tsx +22 -0
  15. package/src/components/Avatars/EmojiAvatar/__snapshots__/index.spec.tsx.snap +37 -0
  16. package/src/components/Avatars/EmojiAvatar/index.spec.tsx +15 -0
  17. package/src/components/Avatars/EmojiAvatar/index.tsx +37 -0
  18. package/src/components/Avatars/FileAvatar/__snapshots__/index.spec.tsx.snap +261 -0
  19. package/src/components/Avatars/FileAvatar/index.spec.tsx +43 -0
  20. package/src/components/Avatars/FileAvatar/index.tsx +117 -0
  21. package/src/components/Avatars/FileAvatar/utils.ts +103 -0
  22. package/src/components/Avatars/IconAvatar/__snapshots__/index.spec.tsx.snap +256 -0
  23. package/src/components/Avatars/IconAvatar/index.spec.tsx +16 -0
  24. package/src/components/Avatars/IconAvatar/index.tsx +31 -0
  25. package/src/components/Avatars/ModuleAvatar/index.tsx +106 -0
  26. package/src/components/Avatars/ModuleAvatar/modules.ts +64 -0
  27. package/src/components/Avatars/PersonAvatar/__snapshots__/index.spec.tsx.snap +25 -0
  28. package/src/components/Avatars/PersonAvatar/index.spec.tsx +13 -0
  29. package/src/components/Avatars/PersonAvatar/index.tsx +38 -0
  30. package/src/components/Avatars/TeamAvatar/__snapshots__/index.spec.tsx.snap +25 -0
  31. package/src/components/Avatars/TeamAvatar/index.spec.tsx +11 -0
  32. package/src/components/Avatars/TeamAvatar/index.tsx +36 -0
  33. package/src/components/Avatars/exports.ts +9 -0
  34. package/src/components/Avatars/types.ts +15 -0
  35. package/src/components/Badge/index.tsx +47 -0
  36. package/src/components/Button/__snapshots__/index.spec.tsx.snap +517 -0
  37. package/src/components/Button/index.spec.tsx +124 -0
  38. package/src/components/Button/index.tsx +233 -0
  39. package/src/components/Counter/__snapshots__/index.spec.tsx.snap +113 -0
  40. package/src/components/Counter/index.spec.tsx +53 -0
  41. package/src/components/Counter/index.tsx +59 -0
  42. package/src/components/ExampleComponent.tsx +22 -0
  43. package/src/components/Icon/README.md +63 -0
  44. package/src/components/Icon/__tests__/Icon.spec.tsx +35 -0
  45. package/src/components/Icon/index.tsx +85 -0
  46. package/src/components/Navigation/PageHeader/__snapshots__/index.spec.tsx.snap +242 -0
  47. package/src/components/Navigation/PageHeader/index.spec.tsx +198 -0
  48. package/src/components/Navigation/PageHeader/index.tsx +53 -0
  49. package/src/components/OneChip/__snapshots__/index.spec.tsx.snap +366 -0
  50. package/src/components/OneChip/index.spec.tsx +69 -0
  51. package/src/components/OneChip/index.tsx +89 -0
  52. package/src/components/OnePreset/__snapshots__/index.spec.tsx.snap +149 -0
  53. package/src/components/OnePreset/index.spec.tsx +46 -0
  54. package/src/components/OnePreset/index.tsx +36 -0
  55. package/src/components/Tags/AlertTab/__snapshots__/index.spec.tsx.snap +292 -0
  56. package/src/components/Tags/AlertTab/index.spec.tsx +18 -0
  57. package/src/components/Tags/AlertTab/index.tsx +61 -0
  58. package/src/components/Tags/BaseTag/index.tsx +64 -0
  59. package/src/components/Tags/DotTag/__snapshots__/index.spec.tsx.snap +1081 -0
  60. package/src/components/Tags/DotTag/index.spec.tsx +14 -0
  61. package/src/components/Tags/DotTag/index.tsx +54 -0
  62. package/src/components/Tags/RawTag/__snapshots__/index.spec.tsx.snap +213 -0
  63. package/src/components/Tags/RawTag/index.spec.tsx +19 -0
  64. package/src/components/Tags/RawTag/index.tsx +41 -0
  65. package/src/components/Tags/Tag.tsx +32 -0
  66. package/src/components/Tags/exports.ts +3 -0
  67. package/src/components/__tests__/ExampleComponent.spec.tsx +16 -0
  68. package/src/components/experimental/Lists/DataList/ItemContainer.tsx +74 -0
  69. package/src/components/experimental/Lists/DataList/actions/CopyAction.tsx +72 -0
  70. package/src/components/experimental/Lists/DataList/actions/GenericAction.tsx +37 -0
  71. package/src/components/experimental/Lists/DataList/index.tsx +186 -0
  72. package/src/components/experimental/Lists/DetailsItem/__snapshots__/index.spec.tsx.snap +759 -0
  73. package/src/components/experimental/Lists/DetailsItem/index.spec.tsx +81 -0
  74. package/src/components/experimental/Lists/DetailsItem/index.tsx +68 -0
  75. package/src/components/experimental/Lists/DetailsItemsList/__snapshots__/index.spec.tsx.snap +671 -0
  76. package/src/components/experimental/Lists/DetailsItemsList/index.spec.tsx +73 -0
  77. package/src/components/experimental/Lists/DetailsItemsList/index.tsx +52 -0
  78. package/src/icons/app/AcademicCap.tsx +31 -0
  79. package/src/icons/app/Add.tsx +21 -0
  80. package/src/icons/app/Ai.tsx +24 -0
  81. package/src/icons/app/Alert.tsx +16 -0
  82. package/src/icons/app/AlertCircle.tsx +19 -0
  83. package/src/icons/app/AlertCircleLine.tsx +17 -0
  84. package/src/icons/app/AlignTextCenter.tsx +21 -0
  85. package/src/icons/app/AlignTextJustify.tsx +21 -0
  86. package/src/icons/app/AlignTextLeft.tsx +21 -0
  87. package/src/icons/app/AlignTextRight.tsx +21 -0
  88. package/src/icons/app/Appearance.tsx +33 -0
  89. package/src/icons/app/Archive.tsx +21 -0
  90. package/src/icons/app/ArchiveOpen.tsx +21 -0
  91. package/src/icons/app/ArrowCycle.tsx +27 -0
  92. package/src/icons/app/ArrowDown.tsx +27 -0
  93. package/src/icons/app/ArrowLeft.tsx +21 -0
  94. package/src/icons/app/ArrowRight.tsx +21 -0
  95. package/src/icons/app/ArrowUp.tsx +21 -0
  96. package/src/icons/app/Bank.tsx +20 -0
  97. package/src/icons/app/BarGraph.tsx +21 -0
  98. package/src/icons/app/Bell.tsx +24 -0
  99. package/src/icons/app/Bold.tsx +23 -0
  100. package/src/icons/app/BookOpen.tsx +21 -0
  101. package/src/icons/app/Briefcase.tsx +18 -0
  102. package/src/icons/app/Bucket.tsx +23 -0
  103. package/src/icons/app/Building.tsx +25 -0
  104. package/src/icons/app/Bullet.tsx +19 -0
  105. package/src/icons/app/Calculator.tsx +17 -0
  106. package/src/icons/app/Calendar.tsx +21 -0
  107. package/src/icons/app/CalendarArrowDown.tsx +21 -0
  108. package/src/icons/app/CalendarArrowLeft.tsx +21 -0
  109. package/src/icons/app/CalendarArrowRight.tsx +21 -0
  110. package/src/icons/app/CameraPlus.tsx +22 -0
  111. package/src/icons/app/ChartLine.tsx +26 -0
  112. package/src/icons/app/ChartPie.tsx +25 -0
  113. package/src/icons/app/Check.tsx +21 -0
  114. package/src/icons/app/CheckCircle.tsx +21 -0
  115. package/src/icons/app/CheckCircleLine.tsx +22 -0
  116. package/src/icons/app/CheckDouble.tsx +21 -0
  117. package/src/icons/app/ChevronDown.tsx +21 -0
  118. package/src/icons/app/ChevronLeft.tsx +21 -0
  119. package/src/icons/app/ChevronRight.tsx +21 -0
  120. package/src/icons/app/ChevronUp.tsx +21 -0
  121. package/src/icons/app/Circle.tsx +16 -0
  122. package/src/icons/app/Clock.tsx +22 -0
  123. package/src/icons/app/Code.tsx +21 -0
  124. package/src/icons/app/Coffee.tsx +24 -0
  125. package/src/icons/app/Comment.tsx +19 -0
  126. package/src/icons/app/Completed.tsx +21 -0
  127. package/src/icons/app/CreditCard.tsx +21 -0
  128. package/src/icons/app/Cross.tsx +21 -0
  129. package/src/icons/app/CrossedCircle.tsx +21 -0
  130. package/src/icons/app/Crown.tsx +21 -0
  131. package/src/icons/app/Delete.tsx +21 -0
  132. package/src/icons/app/Deny.tsx +21 -0
  133. package/src/icons/app/Desktop.tsx +26 -0
  134. package/src/icons/app/DollarBill.tsx +22 -0
  135. package/src/icons/app/DottedCircle.tsx +16 -0
  136. package/src/icons/app/Download.tsx +21 -0
  137. package/src/icons/app/DropdownDefault.tsx +25 -0
  138. package/src/icons/app/DropdownOpen.tsx +25 -0
  139. package/src/icons/app/Ellipsis.tsx +36 -0
  140. package/src/icons/app/EllipsisHorizontal.tsx +18 -0
  141. package/src/icons/app/Envelope.tsx +21 -0
  142. package/src/icons/app/EnvelopeOpen.tsx +23 -0
  143. package/src/icons/app/Exit.tsx +21 -0
  144. package/src/icons/app/ExternalLink.tsx +21 -0
  145. package/src/icons/app/EyeInvisible.tsx +26 -0
  146. package/src/icons/app/EyeVisible.tsx +21 -0
  147. package/src/icons/app/FaceNegative.tsx +21 -0
  148. package/src/icons/app/FaceNeutral.tsx +21 -0
  149. package/src/icons/app/FacePositive.tsx +21 -0
  150. package/src/icons/app/FaceSuperNegative.tsx +21 -0
  151. package/src/icons/app/FaceSuperPositive.tsx +21 -0
  152. package/src/icons/app/Feed.tsx +21 -0
  153. package/src/icons/app/File.tsx +21 -0
  154. package/src/icons/app/FileFilled.tsx +21 -0
  155. package/src/icons/app/Filter.tsx +19 -0
  156. package/src/icons/app/Flag.tsx +21 -0
  157. package/src/icons/app/Folder.tsx +19 -0
  158. package/src/icons/app/Folders.tsx +24 -0
  159. package/src/icons/app/Globe.tsx +26 -0
  160. package/src/icons/app/Graph.tsx +26 -0
  161. package/src/icons/app/Handshake.tsx +29 -0
  162. package/src/icons/app/Heading1.tsx +21 -0
  163. package/src/icons/app/Heading2.tsx +21 -0
  164. package/src/icons/app/Heading3.tsx +21 -0
  165. package/src/icons/app/Heart.tsx +21 -0
  166. package/src/icons/app/HoldHeart.tsx +21 -0
  167. package/src/icons/app/Home.tsx +20 -0
  168. package/src/icons/app/Hub.tsx +51 -0
  169. package/src/icons/app/Image.tsx +21 -0
  170. package/src/icons/app/InProgressTask.tsx +17 -0
  171. package/src/icons/app/Inbox.tsx +26 -0
  172. package/src/icons/app/Info.tsx +21 -0
  173. package/src/icons/app/InfoCircle.tsx +21 -0
  174. package/src/icons/app/InfoCircleLine.tsx +28 -0
  175. package/src/icons/app/Italic.tsx +21 -0
  176. package/src/icons/app/Kanban.tsx +21 -0
  177. package/src/icons/app/Laptop.tsx +20 -0
  178. package/src/icons/app/LayersFront.tsx +26 -0
  179. package/src/icons/app/Lightbulb.tsx +26 -0
  180. package/src/icons/app/Link.tsx +25 -0
  181. package/src/icons/app/LinkRemove.tsx +20 -0
  182. package/src/icons/app/List.tsx +25 -0
  183. package/src/icons/app/LockLocked.tsx +21 -0
  184. package/src/icons/app/LockUnlocked.tsx +21 -0
  185. package/src/icons/app/LogoAvatar.tsx +23 -0
  186. package/src/icons/app/LogoEruditai.tsx +19 -0
  187. package/src/icons/app/LogoTravelperk.tsx +27 -0
  188. package/src/icons/app/Masonry.tsx +19 -0
  189. package/src/icons/app/Maximize.tsx +21 -0
  190. package/src/icons/app/Megaphone.tsx +21 -0
  191. package/src/icons/app/Menu.tsx +21 -0
  192. package/src/icons/app/MessageFrown.tsx +25 -0
  193. package/src/icons/app/MessageHeart.tsx +25 -0
  194. package/src/icons/app/Messages.tsx +21 -0
  195. package/src/icons/app/Microphone.tsx +26 -0
  196. package/src/icons/app/MicrophoneNegative.tsx +26 -0
  197. package/src/icons/app/Minimize.tsx +21 -0
  198. package/src/icons/app/Minus.tsx +21 -0
  199. package/src/icons/app/Mobile.tsx +21 -0
  200. package/src/icons/app/Money.tsx +26 -0
  201. package/src/icons/app/MoneyBag.tsx +24 -0
  202. package/src/icons/app/MoveDown.tsx +44 -0
  203. package/src/icons/app/MoveTop.tsx +34 -0
  204. package/src/icons/app/MoveUp.tsx +42 -0
  205. package/src/icons/app/Office.tsx +31 -0
  206. package/src/icons/app/OlList.tsx +21 -0
  207. package/src/icons/app/PalmTree.tsx +20 -0
  208. package/src/icons/app/Paperclip.tsx +20 -0
  209. package/src/icons/app/PartiallyCompleted.tsx +21 -0
  210. package/src/icons/app/PauseCircle.tsx +21 -0
  211. package/src/icons/app/Pencil.tsx +21 -0
  212. package/src/icons/app/People.tsx +27 -0
  213. package/src/icons/app/Person.tsx +22 -0
  214. package/src/icons/app/Phone.tsx +20 -0
  215. package/src/icons/app/Pin.tsx +22 -0
  216. package/src/icons/app/PixBrazil.tsx +19 -0
  217. package/src/icons/app/Placeholder.tsx +21 -0
  218. package/src/icons/app/Plane.tsx +21 -0
  219. package/src/icons/app/Plus.tsx +21 -0
  220. package/src/icons/app/Present.tsx +31 -0
  221. package/src/icons/app/Printer.tsx +26 -0
  222. package/src/icons/app/Proyector.tsx +22 -0
  223. package/src/icons/app/Question.tsx +22 -0
  224. package/src/icons/app/Quote.tsx +21 -0
  225. package/src/icons/app/Reaction.tsx +32 -0
  226. package/src/icons/app/Receipt.tsx +20 -0
  227. package/src/icons/app/Record.tsx +17 -0
  228. package/src/icons/app/RemoveFavorite.tsx +21 -0
  229. package/src/icons/app/Replace.tsx +21 -0
  230. package/src/icons/app/Reset.tsx +27 -0
  231. package/src/icons/app/Rocket.tsx +26 -0
  232. package/src/icons/app/Salad.tsx +21 -0
  233. package/src/icons/app/Save.tsx +27 -0
  234. package/src/icons/app/Schedule.tsx +32 -0
  235. package/src/icons/app/Search.tsx +17 -0
  236. package/src/icons/app/SearchPerson.tsx +24 -0
  237. package/src/icons/app/Settings.tsx +20 -0
  238. package/src/icons/app/Share.tsx +27 -0
  239. package/src/icons/app/Sliders.tsx +22 -0
  240. package/src/icons/app/SolidPause.tsx +19 -0
  241. package/src/icons/app/SolidPlay.tsx +19 -0
  242. package/src/icons/app/SolidStop.tsx +19 -0
  243. package/src/icons/app/Sort.tsx +21 -0
  244. package/src/icons/app/Sparkles.tsx +25 -0
  245. package/src/icons/app/Spinner.tsx +20 -0
  246. package/src/icons/app/Split.tsx +21 -0
  247. package/src/icons/app/Star.tsx +21 -0
  248. package/src/icons/app/StarFilled.tsx +19 -0
  249. package/src/icons/app/Strikethrough.tsx +21 -0
  250. package/src/icons/app/Suitcase.tsx +22 -0
  251. package/src/icons/app/Table.tsx +21 -0
  252. package/src/icons/app/Target.tsx +31 -0
  253. package/src/icons/app/TextSize.tsx +21 -0
  254. package/src/icons/app/Timer.tsx +27 -0
  255. package/src/icons/app/Underline.tsx +26 -0
  256. package/src/icons/app/Upload.tsx +21 -0
  257. package/src/icons/app/Video.tsx +23 -0
  258. package/src/icons/app/VideoRecorder.tsx +31 -0
  259. package/src/icons/app/VideoRecorderNegative.tsx +22 -0
  260. package/src/icons/app/Wallet.tsx +26 -0
  261. package/src/icons/app/Warning.tsx +21 -0
  262. package/src/icons/app/WhatsappChat.tsx +23 -0
  263. package/src/icons/app/Windows.tsx +21 -0
  264. package/src/icons/app/index.ts +186 -0
  265. package/src/icons/index.ts +5 -0
  266. package/src/icons/modules/Benefits.tsx +25 -0
  267. package/src/icons/modules/Calendar.tsx +21 -0
  268. package/src/icons/modules/Cards.tsx +25 -0
  269. package/src/icons/modules/ClockIn.tsx +21 -0
  270. package/src/icons/modules/Discover.tsx +25 -0
  271. package/src/icons/modules/Documents.tsx +19 -0
  272. package/src/icons/modules/Engagement.tsx +21 -0
  273. package/src/icons/modules/Finance.tsx +21 -0
  274. package/src/icons/modules/Goals.tsx +19 -0
  275. package/src/icons/modules/Home.tsx +19 -0
  276. package/src/icons/modules/Hub.tsx +20 -0
  277. package/src/icons/modules/Inbox.tsx +19 -0
  278. package/src/icons/modules/Kudos.tsx +19 -0
  279. package/src/icons/modules/MyDocuments.tsx +21 -0
  280. package/src/icons/modules/Organization.tsx +19 -0
  281. package/src/icons/modules/Overviews.tsx +23 -0
  282. package/src/icons/modules/Payroll.tsx +25 -0
  283. package/src/icons/modules/Performance.tsx +19 -0
  284. package/src/icons/modules/Profile.tsx +19 -0
  285. package/src/icons/modules/Projects.tsx +21 -0
  286. package/src/icons/modules/Recruitment.tsx +21 -0
  287. package/src/icons/modules/Reports.tsx +21 -0
  288. package/src/icons/modules/Sales.tsx +27 -0
  289. package/src/icons/modules/Settings.tsx +21 -0
  290. package/src/icons/modules/Shifts.tsx +27 -0
  291. package/src/icons/modules/Social.tsx +21 -0
  292. package/src/icons/modules/Software.tsx +19 -0
  293. package/src/icons/modules/Spaces.tsx +21 -0
  294. package/src/icons/modules/Spending.tsx +21 -0
  295. package/src/icons/modules/Tasks.tsx +21 -0
  296. package/src/icons/modules/TimeOff.tsx +21 -0
  297. package/src/icons/modules/TimeTracking.tsx +25 -0
  298. package/src/icons/modules/Trainings.tsx +19 -0
  299. package/src/icons/modules/Treasury.tsx +19 -0
  300. package/src/icons/modules/Workflows.tsx +19 -0
  301. package/src/icons/modules/index.ts +35 -0
  302. package/src/icons/types.ts +9 -0
  303. package/src/index.ts +18 -0
  304. package/src/lib/date.ts +102 -0
  305. package/src/lib/emojis.tsx +47 -0
  306. package/src/lib/iconWithClassName.ts +17 -0
  307. package/src/lib/text.ts +31 -0
  308. package/src/lib/utils.ts +6 -0
  309. package/src/ui/avatar.tsx +113 -0
  310. package/tailwind.config.ts +19 -0
@@ -0,0 +1,36 @@
1
+ import { Text, Pressable, View } from "react-native";
2
+ import { Counter } from "../Counter";
3
+ import { cn } from "../../lib/utils";
4
+
5
+ interface PresetProps {
6
+ label: string;
7
+ number?: number;
8
+ onClick?: () => void;
9
+ selected?: boolean;
10
+ }
11
+
12
+ export const OnePreset = ({
13
+ label,
14
+ number,
15
+ onClick,
16
+ selected,
17
+ }: PresetProps) => {
18
+ return (
19
+ <View className="flex items-start">
20
+ <Pressable
21
+ onPress={onClick}
22
+ className={cn(
23
+ "flex grow-0 flex-row items-center gap-2 rounded border border-f1-border px-2.5 py-1.5 font-medium text-f1-foreground",
24
+ number !== undefined && number !== null && "pr-1.5",
25
+ selected &&
26
+ "border-f1-border-selected bg-f1-background-selected-secondary text-f1-foreground-selected",
27
+ )}
28
+ >
29
+ <Text className="whitespace-nowrap text-f1-foreground">{label}</Text>
30
+ {number !== undefined && number !== null && (
31
+ <Counter value={number} type={selected ? "selected" : "default"} />
32
+ )}
33
+ </Pressable>
34
+ </View>
35
+ );
36
+ };
@@ -0,0 +1,292 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`AlertTag Snapshot Critical level 1`] = `
4
+ <View
5
+ className="flex items-start"
6
+ >
7
+ <View
8
+ accessibilityState={
9
+ {
10
+ "busy": undefined,
11
+ "checked": undefined,
12
+ "disabled": undefined,
13
+ "expanded": undefined,
14
+ "selected": undefined,
15
+ }
16
+ }
17
+ accessibilityValue={
18
+ {
19
+ "max": undefined,
20
+ "min": undefined,
21
+ "now": undefined,
22
+ "text": undefined,
23
+ }
24
+ }
25
+ accessible={true}
26
+ className="flex flex-row items-center justify-start gap-0.5 rounded-full py-0.5 pr-2 pl-0.5 bg-f1-background-critical text-f1-foreground-critical"
27
+ collapsable={false}
28
+ focusable={true}
29
+ onBlur={[Function]}
30
+ onClick={[Function]}
31
+ onFocus={[Function]}
32
+ onResponderGrant={[Function]}
33
+ onResponderMove={[Function]}
34
+ onResponderRelease={[Function]}
35
+ onResponderTerminate={[Function]}
36
+ onResponderTerminationRequest={[Function]}
37
+ onStartShouldSetResponder={[Function]}
38
+ >
39
+ <RNSVGSvgView
40
+ align="xMidYMid"
41
+ aria-hidden={true}
42
+ bbHeight="100%"
43
+ bbWidth="100%"
44
+ className="shrink-0 w-5 h-5 stroke-md text-f1-foreground-critical"
45
+ fill="none"
46
+ focusable={false}
47
+ meetOrSlice={0}
48
+ minX={0}
49
+ minY={0}
50
+ style={
51
+ [
52
+ {
53
+ "backgroundColor": "transparent",
54
+ "borderWidth": 0,
55
+ },
56
+ {
57
+ "flex": 0,
58
+ "height": "100%",
59
+ "width": "100%",
60
+ },
61
+ ]
62
+ }
63
+ vbHeight={24}
64
+ vbWidth={24}
65
+ >
66
+ <RNSVGGroup
67
+ fill={null}
68
+ propList={
69
+ [
70
+ "fill",
71
+ ]
72
+ }
73
+ >
74
+ <RNSVGPath
75
+ d="M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16m-.967-11.94a.97.97 0 1 1 1.935 0l-.303 3.9a.667.667 0 0 1-1.33 0zM13 15a1 1 0 1 1-2 0 1 1 0 0 1 2 0"
76
+ fill={
77
+ {
78
+ "type": 2,
79
+ }
80
+ }
81
+ propList={
82
+ [
83
+ "fill",
84
+ ]
85
+ }
86
+ />
87
+ </RNSVGGroup>
88
+ </RNSVGSvgView>
89
+ <Text
90
+ className="line-clamp-1 text-base font-medium text-f1-foreground-critical"
91
+ >
92
+ critical
93
+ </Text>
94
+ </View>
95
+ </View>
96
+ `;
97
+
98
+ exports[`AlertTag Snapshot Ingo level 1`] = `
99
+ <View
100
+ className="flex items-start"
101
+ >
102
+ <View
103
+ accessibilityState={
104
+ {
105
+ "busy": undefined,
106
+ "checked": undefined,
107
+ "disabled": undefined,
108
+ "expanded": undefined,
109
+ "selected": undefined,
110
+ }
111
+ }
112
+ accessibilityValue={
113
+ {
114
+ "max": undefined,
115
+ "min": undefined,
116
+ "now": undefined,
117
+ "text": undefined,
118
+ }
119
+ }
120
+ accessible={true}
121
+ className="flex flex-row items-center justify-start gap-0.5 rounded-full py-0.5 pr-2 pl-0.5 bg-f1-background-info text-f1-foreground-info"
122
+ collapsable={false}
123
+ focusable={true}
124
+ onBlur={[Function]}
125
+ onClick={[Function]}
126
+ onFocus={[Function]}
127
+ onResponderGrant={[Function]}
128
+ onResponderMove={[Function]}
129
+ onResponderRelease={[Function]}
130
+ onResponderTerminate={[Function]}
131
+ onResponderTerminationRequest={[Function]}
132
+ onStartShouldSetResponder={[Function]}
133
+ >
134
+ <RNSVGSvgView
135
+ align="xMidYMid"
136
+ aria-hidden={true}
137
+ bbHeight="100%"
138
+ bbWidth="100%"
139
+ className="shrink-0 w-5 h-5 stroke-md text-f1-foreground-info"
140
+ fill="none"
141
+ focusable={false}
142
+ meetOrSlice={0}
143
+ minX={0}
144
+ minY={0}
145
+ style={
146
+ [
147
+ {
148
+ "backgroundColor": "transparent",
149
+ "borderWidth": 0,
150
+ },
151
+ {
152
+ "flex": 0,
153
+ "height": "100%",
154
+ "width": "100%",
155
+ },
156
+ ]
157
+ }
158
+ vbHeight={24}
159
+ vbWidth={24}
160
+ >
161
+ <RNSVGGroup
162
+ fill={null}
163
+ propList={
164
+ [
165
+ "fill",
166
+ ]
167
+ }
168
+ >
169
+ <RNSVGPath
170
+ clipRule={0}
171
+ d="M20 12a8 8 0 1 1-16 0 8 8 0 0 1 16 0m-8.65-2.9a.65.65 0 1 0 1.3 0V9a.65.65 0 1 0-1.3 0zm0 6a.65.65 0 1 0 1.3 0v-3a.65.65 0 1 0-1.3 0z"
172
+ fill={
173
+ {
174
+ "type": 2,
175
+ }
176
+ }
177
+ fillRule={0}
178
+ propList={
179
+ [
180
+ "fill",
181
+ "fillRule",
182
+ ]
183
+ }
184
+ />
185
+ </RNSVGGroup>
186
+ </RNSVGSvgView>
187
+ <Text
188
+ className="line-clamp-1 text-base font-medium text-f1-foreground-info"
189
+ >
190
+ info
191
+ </Text>
192
+ </View>
193
+ </View>
194
+ `;
195
+
196
+ exports[`AlertTag Snapshot Warning level 1`] = `
197
+ <View
198
+ className="flex items-start"
199
+ >
200
+ <View
201
+ accessibilityState={
202
+ {
203
+ "busy": undefined,
204
+ "checked": undefined,
205
+ "disabled": undefined,
206
+ "expanded": undefined,
207
+ "selected": undefined,
208
+ }
209
+ }
210
+ accessibilityValue={
211
+ {
212
+ "max": undefined,
213
+ "min": undefined,
214
+ "now": undefined,
215
+ "text": undefined,
216
+ }
217
+ }
218
+ accessible={true}
219
+ className="flex flex-row items-center justify-start gap-0.5 rounded-full py-0.5 pr-2 pl-0.5 bg-f1-background-warning text-f1-foreground-warning"
220
+ collapsable={false}
221
+ focusable={true}
222
+ onBlur={[Function]}
223
+ onClick={[Function]}
224
+ onFocus={[Function]}
225
+ onResponderGrant={[Function]}
226
+ onResponderMove={[Function]}
227
+ onResponderRelease={[Function]}
228
+ onResponderTerminate={[Function]}
229
+ onResponderTerminationRequest={[Function]}
230
+ onStartShouldSetResponder={[Function]}
231
+ >
232
+ <RNSVGSvgView
233
+ align="xMidYMid"
234
+ aria-hidden={true}
235
+ bbHeight="100%"
236
+ bbWidth="100%"
237
+ className="shrink-0 w-5 h-5 stroke-md text-f1-foreground-warning"
238
+ fill="none"
239
+ focusable={false}
240
+ meetOrSlice={0}
241
+ minX={0}
242
+ minY={0}
243
+ style={
244
+ [
245
+ {
246
+ "backgroundColor": "transparent",
247
+ "borderWidth": 0,
248
+ },
249
+ {
250
+ "flex": 0,
251
+ "height": "100%",
252
+ "width": "100%",
253
+ },
254
+ ]
255
+ }
256
+ vbHeight={24}
257
+ vbWidth={24}
258
+ >
259
+ <RNSVGGroup
260
+ fill={null}
261
+ propList={
262
+ [
263
+ "fill",
264
+ ]
265
+ }
266
+ >
267
+ <RNSVGPath
268
+ clipRule={0}
269
+ d="M5.399 19c-1.525 0-2.489-1.638-1.748-2.971l6.6-11.882c.763-1.372 2.735-1.372 3.497 0l6.601 11.882c.74 1.333-.223 2.971-1.748 2.971zM12 7.5a.97.97 0 0 0-.967 1.045l.302 3.9a.667.667 0 0 0 1.33 0l.303-3.9A.97.97 0 0 0 12 7.5m0 8.987a1 1 0 1 0 0-2 1 1 0 0 0 0 2"
270
+ fill={
271
+ {
272
+ "type": 2,
273
+ }
274
+ }
275
+ fillRule={0}
276
+ propList={
277
+ [
278
+ "fill",
279
+ "fillRule",
280
+ ]
281
+ }
282
+ />
283
+ </RNSVGGroup>
284
+ </RNSVGSvgView>
285
+ <Text
286
+ className="line-clamp-1 text-base font-medium text-f1-foreground-warning"
287
+ >
288
+ warning
289
+ </Text>
290
+ </View>
291
+ </View>
292
+ `;
@@ -0,0 +1,18 @@
1
+ import { render } from "@testing-library/react-native";
2
+ import React from "react";
3
+ import { AlertTag } from ".";
4
+
5
+ describe("AlertTag", () => {
6
+ it("Snapshot Ingo level", () => {
7
+ const { toJSON } = render(<AlertTag text="info" level="info" />);
8
+ expect(toJSON()).toMatchSnapshot();
9
+ });
10
+ it("Snapshot Critical level", () => {
11
+ const { toJSON } = render(<AlertTag text="critical" level="critical" />);
12
+ expect(toJSON()).toMatchSnapshot();
13
+ });
14
+ it("Snapshot Warning level", () => {
15
+ const { toJSON } = render(<AlertTag text="warning" level="warning" />);
16
+ expect(toJSON()).toMatchSnapshot();
17
+ });
18
+ });
@@ -0,0 +1,61 @@
1
+ import { BaseTag } from "../BaseTag";
2
+ import { cn } from "../../../lib/utils";
3
+ import { useTextFormatEnforcer } from "../../../lib/text";
4
+ import { Icon, IconType } from "../../Icon";
5
+ import { AlertCircle, InfoCircle, Warning } from "../../../icons/app";
6
+
7
+ type Level = "info" | "warning" | "critical";
8
+
9
+ type NonEmpty<T extends string> = T extends "" ? never : T;
10
+
11
+ type Props<T extends string = string> = {
12
+ text: NonEmpty<T>;
13
+ level: Level;
14
+ };
15
+
16
+ const iconMap: Record<Level, IconType> = {
17
+ info: InfoCircle,
18
+ warning: Warning,
19
+ critical: AlertCircle,
20
+ };
21
+
22
+ export const AlertTag = <T extends string>({ text, level }: Props<T>) => {
23
+ useTextFormatEnforcer(text, { disallowEmpty: true });
24
+
25
+ return (
26
+ <BaseTag
27
+ classNameText={cn(
28
+ {
29
+ info: "text-f1-foreground-info",
30
+ warning: "text-f1-foreground-warning",
31
+ critical: "text-f1-foreground-critical",
32
+ }[level],
33
+ )}
34
+ classNameContainer={cn(
35
+ "pl-0.5",
36
+ {
37
+ info: "bg-f1-background-info text-f1-foreground-info",
38
+ warning: "bg-f1-background-warning text-f1-foreground-warning",
39
+ critical: "bg-f1-background-critical text-f1-foreground-critical",
40
+ }[level],
41
+ )}
42
+ left={
43
+ <Icon
44
+ icon={iconMap[level]}
45
+ className={cn(
46
+ {
47
+ info: "text-f1-foreground-info",
48
+ warning: "text-f1-foreground-warning",
49
+ critical: "text-f1-foreground-critical",
50
+ }[level],
51
+ )}
52
+ size="md"
53
+ aria-hidden
54
+ />
55
+ }
56
+ text={text}
57
+ />
58
+ );
59
+ };
60
+
61
+ AlertTag.displayName = "AlertTag";
@@ -0,0 +1,64 @@
1
+ import { ReactNode } from "react";
2
+ import { Pressable, Text, View } from "react-native";
3
+ import { cn } from "../../../lib/utils";
4
+
5
+ type Props = {
6
+ additionalAccesibleText?: string;
7
+ onClick?: () => void;
8
+ classNameContainer?: string;
9
+ classNameText?: string;
10
+ } & (
11
+ | {
12
+ left: ReactNode;
13
+ text?: string;
14
+ right?: ReactNode;
15
+ }
16
+ | {
17
+ left?: ReactNode;
18
+ text: string;
19
+ right?: ReactNode;
20
+ }
21
+ );
22
+
23
+ export const BaseTag = ({
24
+ left,
25
+ text,
26
+ right,
27
+ additionalAccesibleText,
28
+ onClick,
29
+ classNameContainer,
30
+ classNameText,
31
+ }: Props) => (
32
+ <View className="flex items-start">
33
+ <Pressable
34
+ className={cn(
35
+ "flex flex-row items-center justify-start gap-0.5 rounded-full py-0.5 pr-2",
36
+ onClick && "cursor-pointer hover:bg-f1-background-hover",
37
+ !text && "aspect-square w-6 items-center justify-center p-1",
38
+ !left ? "pl-2" : "pl-1",
39
+ classNameContainer,
40
+ )}
41
+ onPress={onClick}
42
+ >
43
+ {left}
44
+ {!!text && (
45
+ <Text
46
+ className={cn(
47
+ "line-clamp-1 text-base font-medium text-f1-foreground",
48
+ classNameText,
49
+ )}
50
+ >
51
+ {text}
52
+ </Text>
53
+ )}
54
+ {additionalAccesibleText && (
55
+ <Text className="sr-only text-base font-medium text-f1-foreground">
56
+ {additionalAccesibleText}
57
+ </Text>
58
+ )}
59
+ {right}
60
+ </Pressable>
61
+ </View>
62
+ );
63
+
64
+ BaseTag.displayName = "BaseTag";