@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.
- package/README.md +54 -0
- package/package.json +84 -0
- package/src/components/Activity/ActivityItem/__snapshots__/index.spec.tsx.snap +62 -0
- package/src/components/Activity/ActivityItem/index.spec.tsx +103 -0
- package/src/components/Activity/ActivityItem/index.tsx +90 -0
- package/src/components/Avatars/Avatar.tsx +56 -0
- package/src/components/Avatars/BaseAvatar/index.tsx +126 -0
- package/src/components/Avatars/BaseAvatar/utils.ts +73 -0
- package/src/components/Avatars/CompanyAvatar/__snapshots__/index.spec.tsx.snap +25 -0
- package/src/components/Avatars/CompanyAvatar/index.spec.tsx +11 -0
- package/src/components/Avatars/CompanyAvatar/index.tsx +36 -0
- package/src/components/Avatars/DateAvatar/__snapshots__/index.spec.tsx.snap +18 -0
- package/src/components/Avatars/DateAvatar/index.spec.tsx +12 -0
- package/src/components/Avatars/DateAvatar/index.tsx +22 -0
- package/src/components/Avatars/EmojiAvatar/__snapshots__/index.spec.tsx.snap +37 -0
- package/src/components/Avatars/EmojiAvatar/index.spec.tsx +15 -0
- package/src/components/Avatars/EmojiAvatar/index.tsx +37 -0
- package/src/components/Avatars/FileAvatar/__snapshots__/index.spec.tsx.snap +261 -0
- package/src/components/Avatars/FileAvatar/index.spec.tsx +43 -0
- package/src/components/Avatars/FileAvatar/index.tsx +117 -0
- package/src/components/Avatars/FileAvatar/utils.ts +103 -0
- package/src/components/Avatars/IconAvatar/__snapshots__/index.spec.tsx.snap +256 -0
- package/src/components/Avatars/IconAvatar/index.spec.tsx +16 -0
- package/src/components/Avatars/IconAvatar/index.tsx +31 -0
- package/src/components/Avatars/ModuleAvatar/index.tsx +106 -0
- package/src/components/Avatars/ModuleAvatar/modules.ts +64 -0
- package/src/components/Avatars/PersonAvatar/__snapshots__/index.spec.tsx.snap +25 -0
- package/src/components/Avatars/PersonAvatar/index.spec.tsx +13 -0
- package/src/components/Avatars/PersonAvatar/index.tsx +38 -0
- package/src/components/Avatars/TeamAvatar/__snapshots__/index.spec.tsx.snap +25 -0
- package/src/components/Avatars/TeamAvatar/index.spec.tsx +11 -0
- package/src/components/Avatars/TeamAvatar/index.tsx +36 -0
- package/src/components/Avatars/exports.ts +9 -0
- package/src/components/Avatars/types.ts +15 -0
- package/src/components/Badge/index.tsx +47 -0
- package/src/components/Button/__snapshots__/index.spec.tsx.snap +517 -0
- package/src/components/Button/index.spec.tsx +124 -0
- package/src/components/Button/index.tsx +233 -0
- package/src/components/Counter/__snapshots__/index.spec.tsx.snap +113 -0
- package/src/components/Counter/index.spec.tsx +53 -0
- package/src/components/Counter/index.tsx +59 -0
- package/src/components/ExampleComponent.tsx +22 -0
- package/src/components/Icon/README.md +63 -0
- package/src/components/Icon/__tests__/Icon.spec.tsx +35 -0
- package/src/components/Icon/index.tsx +85 -0
- package/src/components/Navigation/PageHeader/__snapshots__/index.spec.tsx.snap +242 -0
- package/src/components/Navigation/PageHeader/index.spec.tsx +198 -0
- package/src/components/Navigation/PageHeader/index.tsx +53 -0
- package/src/components/OneChip/__snapshots__/index.spec.tsx.snap +366 -0
- package/src/components/OneChip/index.spec.tsx +69 -0
- package/src/components/OneChip/index.tsx +89 -0
- package/src/components/OnePreset/__snapshots__/index.spec.tsx.snap +149 -0
- package/src/components/OnePreset/index.spec.tsx +46 -0
- package/src/components/OnePreset/index.tsx +36 -0
- package/src/components/Tags/AlertTab/__snapshots__/index.spec.tsx.snap +292 -0
- package/src/components/Tags/AlertTab/index.spec.tsx +18 -0
- package/src/components/Tags/AlertTab/index.tsx +61 -0
- package/src/components/Tags/BaseTag/index.tsx +64 -0
- package/src/components/Tags/DotTag/__snapshots__/index.spec.tsx.snap +1081 -0
- package/src/components/Tags/DotTag/index.spec.tsx +14 -0
- package/src/components/Tags/DotTag/index.tsx +54 -0
- package/src/components/Tags/RawTag/__snapshots__/index.spec.tsx.snap +213 -0
- package/src/components/Tags/RawTag/index.spec.tsx +19 -0
- package/src/components/Tags/RawTag/index.tsx +41 -0
- package/src/components/Tags/Tag.tsx +32 -0
- package/src/components/Tags/exports.ts +3 -0
- package/src/components/__tests__/ExampleComponent.spec.tsx +16 -0
- package/src/components/experimental/Lists/DataList/ItemContainer.tsx +74 -0
- package/src/components/experimental/Lists/DataList/actions/CopyAction.tsx +72 -0
- package/src/components/experimental/Lists/DataList/actions/GenericAction.tsx +37 -0
- package/src/components/experimental/Lists/DataList/index.tsx +186 -0
- package/src/components/experimental/Lists/DetailsItem/__snapshots__/index.spec.tsx.snap +759 -0
- package/src/components/experimental/Lists/DetailsItem/index.spec.tsx +81 -0
- package/src/components/experimental/Lists/DetailsItem/index.tsx +68 -0
- package/src/components/experimental/Lists/DetailsItemsList/__snapshots__/index.spec.tsx.snap +671 -0
- package/src/components/experimental/Lists/DetailsItemsList/index.spec.tsx +73 -0
- package/src/components/experimental/Lists/DetailsItemsList/index.tsx +52 -0
- package/src/icons/app/AcademicCap.tsx +31 -0
- package/src/icons/app/Add.tsx +21 -0
- package/src/icons/app/Ai.tsx +24 -0
- package/src/icons/app/Alert.tsx +16 -0
- package/src/icons/app/AlertCircle.tsx +19 -0
- package/src/icons/app/AlertCircleLine.tsx +17 -0
- package/src/icons/app/AlignTextCenter.tsx +21 -0
- package/src/icons/app/AlignTextJustify.tsx +21 -0
- package/src/icons/app/AlignTextLeft.tsx +21 -0
- package/src/icons/app/AlignTextRight.tsx +21 -0
- package/src/icons/app/Appearance.tsx +33 -0
- package/src/icons/app/Archive.tsx +21 -0
- package/src/icons/app/ArchiveOpen.tsx +21 -0
- package/src/icons/app/ArrowCycle.tsx +27 -0
- package/src/icons/app/ArrowDown.tsx +27 -0
- package/src/icons/app/ArrowLeft.tsx +21 -0
- package/src/icons/app/ArrowRight.tsx +21 -0
- package/src/icons/app/ArrowUp.tsx +21 -0
- package/src/icons/app/Bank.tsx +20 -0
- package/src/icons/app/BarGraph.tsx +21 -0
- package/src/icons/app/Bell.tsx +24 -0
- package/src/icons/app/Bold.tsx +23 -0
- package/src/icons/app/BookOpen.tsx +21 -0
- package/src/icons/app/Briefcase.tsx +18 -0
- package/src/icons/app/Bucket.tsx +23 -0
- package/src/icons/app/Building.tsx +25 -0
- package/src/icons/app/Bullet.tsx +19 -0
- package/src/icons/app/Calculator.tsx +17 -0
- package/src/icons/app/Calendar.tsx +21 -0
- package/src/icons/app/CalendarArrowDown.tsx +21 -0
- package/src/icons/app/CalendarArrowLeft.tsx +21 -0
- package/src/icons/app/CalendarArrowRight.tsx +21 -0
- package/src/icons/app/CameraPlus.tsx +22 -0
- package/src/icons/app/ChartLine.tsx +26 -0
- package/src/icons/app/ChartPie.tsx +25 -0
- package/src/icons/app/Check.tsx +21 -0
- package/src/icons/app/CheckCircle.tsx +21 -0
- package/src/icons/app/CheckCircleLine.tsx +22 -0
- package/src/icons/app/CheckDouble.tsx +21 -0
- package/src/icons/app/ChevronDown.tsx +21 -0
- package/src/icons/app/ChevronLeft.tsx +21 -0
- package/src/icons/app/ChevronRight.tsx +21 -0
- package/src/icons/app/ChevronUp.tsx +21 -0
- package/src/icons/app/Circle.tsx +16 -0
- package/src/icons/app/Clock.tsx +22 -0
- package/src/icons/app/Code.tsx +21 -0
- package/src/icons/app/Coffee.tsx +24 -0
- package/src/icons/app/Comment.tsx +19 -0
- package/src/icons/app/Completed.tsx +21 -0
- package/src/icons/app/CreditCard.tsx +21 -0
- package/src/icons/app/Cross.tsx +21 -0
- package/src/icons/app/CrossedCircle.tsx +21 -0
- package/src/icons/app/Crown.tsx +21 -0
- package/src/icons/app/Delete.tsx +21 -0
- package/src/icons/app/Deny.tsx +21 -0
- package/src/icons/app/Desktop.tsx +26 -0
- package/src/icons/app/DollarBill.tsx +22 -0
- package/src/icons/app/DottedCircle.tsx +16 -0
- package/src/icons/app/Download.tsx +21 -0
- package/src/icons/app/DropdownDefault.tsx +25 -0
- package/src/icons/app/DropdownOpen.tsx +25 -0
- package/src/icons/app/Ellipsis.tsx +36 -0
- package/src/icons/app/EllipsisHorizontal.tsx +18 -0
- package/src/icons/app/Envelope.tsx +21 -0
- package/src/icons/app/EnvelopeOpen.tsx +23 -0
- package/src/icons/app/Exit.tsx +21 -0
- package/src/icons/app/ExternalLink.tsx +21 -0
- package/src/icons/app/EyeInvisible.tsx +26 -0
- package/src/icons/app/EyeVisible.tsx +21 -0
- package/src/icons/app/FaceNegative.tsx +21 -0
- package/src/icons/app/FaceNeutral.tsx +21 -0
- package/src/icons/app/FacePositive.tsx +21 -0
- package/src/icons/app/FaceSuperNegative.tsx +21 -0
- package/src/icons/app/FaceSuperPositive.tsx +21 -0
- package/src/icons/app/Feed.tsx +21 -0
- package/src/icons/app/File.tsx +21 -0
- package/src/icons/app/FileFilled.tsx +21 -0
- package/src/icons/app/Filter.tsx +19 -0
- package/src/icons/app/Flag.tsx +21 -0
- package/src/icons/app/Folder.tsx +19 -0
- package/src/icons/app/Folders.tsx +24 -0
- package/src/icons/app/Globe.tsx +26 -0
- package/src/icons/app/Graph.tsx +26 -0
- package/src/icons/app/Handshake.tsx +29 -0
- package/src/icons/app/Heading1.tsx +21 -0
- package/src/icons/app/Heading2.tsx +21 -0
- package/src/icons/app/Heading3.tsx +21 -0
- package/src/icons/app/Heart.tsx +21 -0
- package/src/icons/app/HoldHeart.tsx +21 -0
- package/src/icons/app/Home.tsx +20 -0
- package/src/icons/app/Hub.tsx +51 -0
- package/src/icons/app/Image.tsx +21 -0
- package/src/icons/app/InProgressTask.tsx +17 -0
- package/src/icons/app/Inbox.tsx +26 -0
- package/src/icons/app/Info.tsx +21 -0
- package/src/icons/app/InfoCircle.tsx +21 -0
- package/src/icons/app/InfoCircleLine.tsx +28 -0
- package/src/icons/app/Italic.tsx +21 -0
- package/src/icons/app/Kanban.tsx +21 -0
- package/src/icons/app/Laptop.tsx +20 -0
- package/src/icons/app/LayersFront.tsx +26 -0
- package/src/icons/app/Lightbulb.tsx +26 -0
- package/src/icons/app/Link.tsx +25 -0
- package/src/icons/app/LinkRemove.tsx +20 -0
- package/src/icons/app/List.tsx +25 -0
- package/src/icons/app/LockLocked.tsx +21 -0
- package/src/icons/app/LockUnlocked.tsx +21 -0
- package/src/icons/app/LogoAvatar.tsx +23 -0
- package/src/icons/app/LogoEruditai.tsx +19 -0
- package/src/icons/app/LogoTravelperk.tsx +27 -0
- package/src/icons/app/Masonry.tsx +19 -0
- package/src/icons/app/Maximize.tsx +21 -0
- package/src/icons/app/Megaphone.tsx +21 -0
- package/src/icons/app/Menu.tsx +21 -0
- package/src/icons/app/MessageFrown.tsx +25 -0
- package/src/icons/app/MessageHeart.tsx +25 -0
- package/src/icons/app/Messages.tsx +21 -0
- package/src/icons/app/Microphone.tsx +26 -0
- package/src/icons/app/MicrophoneNegative.tsx +26 -0
- package/src/icons/app/Minimize.tsx +21 -0
- package/src/icons/app/Minus.tsx +21 -0
- package/src/icons/app/Mobile.tsx +21 -0
- package/src/icons/app/Money.tsx +26 -0
- package/src/icons/app/MoneyBag.tsx +24 -0
- package/src/icons/app/MoveDown.tsx +44 -0
- package/src/icons/app/MoveTop.tsx +34 -0
- package/src/icons/app/MoveUp.tsx +42 -0
- package/src/icons/app/Office.tsx +31 -0
- package/src/icons/app/OlList.tsx +21 -0
- package/src/icons/app/PalmTree.tsx +20 -0
- package/src/icons/app/Paperclip.tsx +20 -0
- package/src/icons/app/PartiallyCompleted.tsx +21 -0
- package/src/icons/app/PauseCircle.tsx +21 -0
- package/src/icons/app/Pencil.tsx +21 -0
- package/src/icons/app/People.tsx +27 -0
- package/src/icons/app/Person.tsx +22 -0
- package/src/icons/app/Phone.tsx +20 -0
- package/src/icons/app/Pin.tsx +22 -0
- package/src/icons/app/PixBrazil.tsx +19 -0
- package/src/icons/app/Placeholder.tsx +21 -0
- package/src/icons/app/Plane.tsx +21 -0
- package/src/icons/app/Plus.tsx +21 -0
- package/src/icons/app/Present.tsx +31 -0
- package/src/icons/app/Printer.tsx +26 -0
- package/src/icons/app/Proyector.tsx +22 -0
- package/src/icons/app/Question.tsx +22 -0
- package/src/icons/app/Quote.tsx +21 -0
- package/src/icons/app/Reaction.tsx +32 -0
- package/src/icons/app/Receipt.tsx +20 -0
- package/src/icons/app/Record.tsx +17 -0
- package/src/icons/app/RemoveFavorite.tsx +21 -0
- package/src/icons/app/Replace.tsx +21 -0
- package/src/icons/app/Reset.tsx +27 -0
- package/src/icons/app/Rocket.tsx +26 -0
- package/src/icons/app/Salad.tsx +21 -0
- package/src/icons/app/Save.tsx +27 -0
- package/src/icons/app/Schedule.tsx +32 -0
- package/src/icons/app/Search.tsx +17 -0
- package/src/icons/app/SearchPerson.tsx +24 -0
- package/src/icons/app/Settings.tsx +20 -0
- package/src/icons/app/Share.tsx +27 -0
- package/src/icons/app/Sliders.tsx +22 -0
- package/src/icons/app/SolidPause.tsx +19 -0
- package/src/icons/app/SolidPlay.tsx +19 -0
- package/src/icons/app/SolidStop.tsx +19 -0
- package/src/icons/app/Sort.tsx +21 -0
- package/src/icons/app/Sparkles.tsx +25 -0
- package/src/icons/app/Spinner.tsx +20 -0
- package/src/icons/app/Split.tsx +21 -0
- package/src/icons/app/Star.tsx +21 -0
- package/src/icons/app/StarFilled.tsx +19 -0
- package/src/icons/app/Strikethrough.tsx +21 -0
- package/src/icons/app/Suitcase.tsx +22 -0
- package/src/icons/app/Table.tsx +21 -0
- package/src/icons/app/Target.tsx +31 -0
- package/src/icons/app/TextSize.tsx +21 -0
- package/src/icons/app/Timer.tsx +27 -0
- package/src/icons/app/Underline.tsx +26 -0
- package/src/icons/app/Upload.tsx +21 -0
- package/src/icons/app/Video.tsx +23 -0
- package/src/icons/app/VideoRecorder.tsx +31 -0
- package/src/icons/app/VideoRecorderNegative.tsx +22 -0
- package/src/icons/app/Wallet.tsx +26 -0
- package/src/icons/app/Warning.tsx +21 -0
- package/src/icons/app/WhatsappChat.tsx +23 -0
- package/src/icons/app/Windows.tsx +21 -0
- package/src/icons/app/index.ts +186 -0
- package/src/icons/index.ts +5 -0
- package/src/icons/modules/Benefits.tsx +25 -0
- package/src/icons/modules/Calendar.tsx +21 -0
- package/src/icons/modules/Cards.tsx +25 -0
- package/src/icons/modules/ClockIn.tsx +21 -0
- package/src/icons/modules/Discover.tsx +25 -0
- package/src/icons/modules/Documents.tsx +19 -0
- package/src/icons/modules/Engagement.tsx +21 -0
- package/src/icons/modules/Finance.tsx +21 -0
- package/src/icons/modules/Goals.tsx +19 -0
- package/src/icons/modules/Home.tsx +19 -0
- package/src/icons/modules/Hub.tsx +20 -0
- package/src/icons/modules/Inbox.tsx +19 -0
- package/src/icons/modules/Kudos.tsx +19 -0
- package/src/icons/modules/MyDocuments.tsx +21 -0
- package/src/icons/modules/Organization.tsx +19 -0
- package/src/icons/modules/Overviews.tsx +23 -0
- package/src/icons/modules/Payroll.tsx +25 -0
- package/src/icons/modules/Performance.tsx +19 -0
- package/src/icons/modules/Profile.tsx +19 -0
- package/src/icons/modules/Projects.tsx +21 -0
- package/src/icons/modules/Recruitment.tsx +21 -0
- package/src/icons/modules/Reports.tsx +21 -0
- package/src/icons/modules/Sales.tsx +27 -0
- package/src/icons/modules/Settings.tsx +21 -0
- package/src/icons/modules/Shifts.tsx +27 -0
- package/src/icons/modules/Social.tsx +21 -0
- package/src/icons/modules/Software.tsx +19 -0
- package/src/icons/modules/Spaces.tsx +21 -0
- package/src/icons/modules/Spending.tsx +21 -0
- package/src/icons/modules/Tasks.tsx +21 -0
- package/src/icons/modules/TimeOff.tsx +21 -0
- package/src/icons/modules/TimeTracking.tsx +25 -0
- package/src/icons/modules/Trainings.tsx +19 -0
- package/src/icons/modules/Treasury.tsx +19 -0
- package/src/icons/modules/Workflows.tsx +19 -0
- package/src/icons/modules/index.ts +35 -0
- package/src/icons/types.ts +9 -0
- package/src/index.ts +18 -0
- package/src/lib/date.ts +102 -0
- package/src/lib/emojis.tsx +47 -0
- package/src/lib/iconWithClassName.ts +17 -0
- package/src/lib/text.ts +31 -0
- package/src/lib/utils.ts +6 -0
- package/src/ui/avatar.tsx +113 -0
- package/tailwind.config.ts +19 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`OneChip Snapshot 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
className="flex items-start"
|
|
6
|
+
>
|
|
7
|
+
<View
|
|
8
|
+
accessibilityLabel="Action"
|
|
9
|
+
accessibilityState={
|
|
10
|
+
{
|
|
11
|
+
"busy": undefined,
|
|
12
|
+
"checked": undefined,
|
|
13
|
+
"disabled": undefined,
|
|
14
|
+
"expanded": undefined,
|
|
15
|
+
"selected": undefined,
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
accessibilityValue={
|
|
19
|
+
{
|
|
20
|
+
"max": undefined,
|
|
21
|
+
"min": undefined,
|
|
22
|
+
"now": undefined,
|
|
23
|
+
"text": undefined,
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
accessible={true}
|
|
27
|
+
className="flex items-center gap-1 rounded-full border border-solid border-f1-border px-2 py-0.5 grow-0"
|
|
28
|
+
collapsable={false}
|
|
29
|
+
focusable={true}
|
|
30
|
+
onBlur={[Function]}
|
|
31
|
+
onClick={[Function]}
|
|
32
|
+
onFocus={[Function]}
|
|
33
|
+
onResponderGrant={[Function]}
|
|
34
|
+
onResponderMove={[Function]}
|
|
35
|
+
onResponderRelease={[Function]}
|
|
36
|
+
onResponderTerminate={[Function]}
|
|
37
|
+
onResponderTerminationRequest={[Function]}
|
|
38
|
+
onStartShouldSetResponder={[Function]}
|
|
39
|
+
>
|
|
40
|
+
<View
|
|
41
|
+
className="flex flex-row items-center gap-0.5"
|
|
42
|
+
>
|
|
43
|
+
<Text
|
|
44
|
+
className="font-medium text-f1-foreground"
|
|
45
|
+
>
|
|
46
|
+
label
|
|
47
|
+
</Text>
|
|
48
|
+
</View>
|
|
49
|
+
</View>
|
|
50
|
+
</View>
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
exports[`OneChip Snapshot variant selected 1`] = `
|
|
54
|
+
<View
|
|
55
|
+
className="flex items-start"
|
|
56
|
+
>
|
|
57
|
+
<View
|
|
58
|
+
accessibilityLabel="Action"
|
|
59
|
+
accessibilityState={
|
|
60
|
+
{
|
|
61
|
+
"busy": undefined,
|
|
62
|
+
"checked": undefined,
|
|
63
|
+
"disabled": undefined,
|
|
64
|
+
"expanded": undefined,
|
|
65
|
+
"selected": undefined,
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
accessibilityValue={
|
|
69
|
+
{
|
|
70
|
+
"max": undefined,
|
|
71
|
+
"min": undefined,
|
|
72
|
+
"now": undefined,
|
|
73
|
+
"text": undefined,
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
accessible={true}
|
|
77
|
+
className="flex items-center gap-1 rounded-full border border-solid px-2 py-0.5 grow-0 border-f1-border-selected bg-f1-background-selected-secondary"
|
|
78
|
+
collapsable={false}
|
|
79
|
+
focusable={true}
|
|
80
|
+
onBlur={[Function]}
|
|
81
|
+
onClick={[Function]}
|
|
82
|
+
onFocus={[Function]}
|
|
83
|
+
onResponderGrant={[Function]}
|
|
84
|
+
onResponderMove={[Function]}
|
|
85
|
+
onResponderRelease={[Function]}
|
|
86
|
+
onResponderTerminate={[Function]}
|
|
87
|
+
onResponderTerminationRequest={[Function]}
|
|
88
|
+
onStartShouldSetResponder={[Function]}
|
|
89
|
+
>
|
|
90
|
+
<View
|
|
91
|
+
className="flex flex-row items-center gap-0.5"
|
|
92
|
+
>
|
|
93
|
+
<Text
|
|
94
|
+
className="font-medium text-f1-foreground-selected"
|
|
95
|
+
>
|
|
96
|
+
label
|
|
97
|
+
</Text>
|
|
98
|
+
</View>
|
|
99
|
+
</View>
|
|
100
|
+
</View>
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
exports[`OneChip Snapshot with Icon 1`] = `
|
|
104
|
+
<View
|
|
105
|
+
className="flex items-start"
|
|
106
|
+
>
|
|
107
|
+
<View
|
|
108
|
+
accessibilityLabel="Action"
|
|
109
|
+
accessibilityState={
|
|
110
|
+
{
|
|
111
|
+
"busy": undefined,
|
|
112
|
+
"checked": undefined,
|
|
113
|
+
"disabled": undefined,
|
|
114
|
+
"expanded": undefined,
|
|
115
|
+
"selected": undefined,
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
accessibilityValue={
|
|
119
|
+
{
|
|
120
|
+
"max": undefined,
|
|
121
|
+
"min": undefined,
|
|
122
|
+
"now": undefined,
|
|
123
|
+
"text": undefined,
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
accessible={true}
|
|
127
|
+
className="flex items-center gap-1 rounded-full border border-solid border-f1-border px-2 py-0.5 grow-0 pl-1.5"
|
|
128
|
+
collapsable={false}
|
|
129
|
+
focusable={true}
|
|
130
|
+
onBlur={[Function]}
|
|
131
|
+
onClick={[Function]}
|
|
132
|
+
onFocus={[Function]}
|
|
133
|
+
onResponderGrant={[Function]}
|
|
134
|
+
onResponderMove={[Function]}
|
|
135
|
+
onResponderRelease={[Function]}
|
|
136
|
+
onResponderTerminate={[Function]}
|
|
137
|
+
onResponderTerminationRequest={[Function]}
|
|
138
|
+
onStartShouldSetResponder={[Function]}
|
|
139
|
+
>
|
|
140
|
+
<View
|
|
141
|
+
className="flex flex-row items-center gap-0.5"
|
|
142
|
+
>
|
|
143
|
+
<RNSVGSvgView
|
|
144
|
+
align="xMidYMid"
|
|
145
|
+
bbHeight="100%"
|
|
146
|
+
bbWidth="100%"
|
|
147
|
+
className="shrink-0 w-4 h-4 stroke-sm font-medium text-f1-foreground"
|
|
148
|
+
fill="none"
|
|
149
|
+
focusable={false}
|
|
150
|
+
meetOrSlice={0}
|
|
151
|
+
minX={0}
|
|
152
|
+
minY={0}
|
|
153
|
+
style={
|
|
154
|
+
[
|
|
155
|
+
{
|
|
156
|
+
"backgroundColor": "transparent",
|
|
157
|
+
"borderWidth": 0,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"flex": 0,
|
|
161
|
+
"height": "100%",
|
|
162
|
+
"width": "100%",
|
|
163
|
+
},
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
vbHeight={24}
|
|
167
|
+
vbWidth={24}
|
|
168
|
+
>
|
|
169
|
+
<RNSVGGroup
|
|
170
|
+
fill={null}
|
|
171
|
+
propList={
|
|
172
|
+
[
|
|
173
|
+
"fill",
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
>
|
|
177
|
+
<RNSVGCircle
|
|
178
|
+
cx={12}
|
|
179
|
+
cy={12}
|
|
180
|
+
fill={
|
|
181
|
+
{
|
|
182
|
+
"payload": 4278190080,
|
|
183
|
+
"type": 0,
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
propList={
|
|
187
|
+
[
|
|
188
|
+
"stroke",
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
r={8}
|
|
192
|
+
stroke={
|
|
193
|
+
{
|
|
194
|
+
"type": 2,
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/>
|
|
198
|
+
<RNSVGPath
|
|
199
|
+
d="m17.5 6.5-11 11M17.5 17.5l-11-11"
|
|
200
|
+
fill={
|
|
201
|
+
{
|
|
202
|
+
"payload": 4278190080,
|
|
203
|
+
"type": 0,
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
propList={
|
|
207
|
+
[
|
|
208
|
+
"stroke",
|
|
209
|
+
"strokeLinejoin",
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
stroke={
|
|
213
|
+
{
|
|
214
|
+
"type": 2,
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
strokeLinejoin={1}
|
|
218
|
+
/>
|
|
219
|
+
</RNSVGGroup>
|
|
220
|
+
</RNSVGSvgView>
|
|
221
|
+
<Text
|
|
222
|
+
className="font-medium text-f1-foreground"
|
|
223
|
+
>
|
|
224
|
+
label
|
|
225
|
+
</Text>
|
|
226
|
+
</View>
|
|
227
|
+
</View>
|
|
228
|
+
</View>
|
|
229
|
+
`;
|
|
230
|
+
|
|
231
|
+
exports[`OneChip Snapshot with OnClose 1`] = `
|
|
232
|
+
<View
|
|
233
|
+
className="flex items-start"
|
|
234
|
+
>
|
|
235
|
+
<View
|
|
236
|
+
accessibilityLabel="Action"
|
|
237
|
+
accessibilityState={
|
|
238
|
+
{
|
|
239
|
+
"busy": undefined,
|
|
240
|
+
"checked": undefined,
|
|
241
|
+
"disabled": undefined,
|
|
242
|
+
"expanded": undefined,
|
|
243
|
+
"selected": undefined,
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
accessibilityValue={
|
|
247
|
+
{
|
|
248
|
+
"max": undefined,
|
|
249
|
+
"min": undefined,
|
|
250
|
+
"now": undefined,
|
|
251
|
+
"text": undefined,
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
accessible={true}
|
|
255
|
+
className="flex items-center gap-1 rounded-full border border-solid border-f1-border px-2 py-0.5 grow-0 pr-1.5"
|
|
256
|
+
collapsable={false}
|
|
257
|
+
focusable={true}
|
|
258
|
+
onBlur={[Function]}
|
|
259
|
+
onClick={[Function]}
|
|
260
|
+
onFocus={[Function]}
|
|
261
|
+
onResponderGrant={[Function]}
|
|
262
|
+
onResponderMove={[Function]}
|
|
263
|
+
onResponderRelease={[Function]}
|
|
264
|
+
onResponderTerminate={[Function]}
|
|
265
|
+
onResponderTerminationRequest={[Function]}
|
|
266
|
+
onStartShouldSetResponder={[Function]}
|
|
267
|
+
>
|
|
268
|
+
<View
|
|
269
|
+
className="flex flex-row items-center gap-0.5"
|
|
270
|
+
>
|
|
271
|
+
<Text
|
|
272
|
+
className="font-medium text-f1-foreground"
|
|
273
|
+
>
|
|
274
|
+
label
|
|
275
|
+
</Text>
|
|
276
|
+
<View
|
|
277
|
+
accessibilityLabel="Close"
|
|
278
|
+
accessibilityState={
|
|
279
|
+
{
|
|
280
|
+
"busy": undefined,
|
|
281
|
+
"checked": undefined,
|
|
282
|
+
"disabled": undefined,
|
|
283
|
+
"expanded": undefined,
|
|
284
|
+
"selected": undefined,
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
accessibilityValue={
|
|
288
|
+
{
|
|
289
|
+
"max": undefined,
|
|
290
|
+
"min": undefined,
|
|
291
|
+
"now": undefined,
|
|
292
|
+
"text": undefined,
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
accessible={true}
|
|
296
|
+
className="-m-1 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full [&_svg]:text-f1-icon-secondary"
|
|
297
|
+
collapsable={false}
|
|
298
|
+
focusable={true}
|
|
299
|
+
onBlur={[Function]}
|
|
300
|
+
onClick={[Function]}
|
|
301
|
+
onFocus={[Function]}
|
|
302
|
+
onResponderGrant={[Function]}
|
|
303
|
+
onResponderMove={[Function]}
|
|
304
|
+
onResponderRelease={[Function]}
|
|
305
|
+
onResponderTerminate={[Function]}
|
|
306
|
+
onResponderTerminationRequest={[Function]}
|
|
307
|
+
onStartShouldSetResponder={[Function]}
|
|
308
|
+
tabIndex={0}
|
|
309
|
+
>
|
|
310
|
+
<RNSVGSvgView
|
|
311
|
+
align="xMidYMid"
|
|
312
|
+
bbHeight="100%"
|
|
313
|
+
bbWidth="100%"
|
|
314
|
+
className="shrink-0 w-4 h-4 stroke-sm font-medium text-f1-foreground"
|
|
315
|
+
fill="none"
|
|
316
|
+
focusable={false}
|
|
317
|
+
meetOrSlice={0}
|
|
318
|
+
minX={0}
|
|
319
|
+
minY={0}
|
|
320
|
+
style={
|
|
321
|
+
[
|
|
322
|
+
{
|
|
323
|
+
"backgroundColor": "transparent",
|
|
324
|
+
"borderWidth": 0,
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"flex": 0,
|
|
328
|
+
"height": "100%",
|
|
329
|
+
"width": "100%",
|
|
330
|
+
},
|
|
331
|
+
]
|
|
332
|
+
}
|
|
333
|
+
vbHeight={24}
|
|
334
|
+
vbWidth={24}
|
|
335
|
+
>
|
|
336
|
+
<RNSVGGroup
|
|
337
|
+
fill={null}
|
|
338
|
+
propList={
|
|
339
|
+
[
|
|
340
|
+
"fill",
|
|
341
|
+
]
|
|
342
|
+
}
|
|
343
|
+
>
|
|
344
|
+
<RNSVGPath
|
|
345
|
+
clipRule={0}
|
|
346
|
+
d="M3.35 12a8.65 8.65 0 1 1 17.3 0 8.65 8.65 0 0 1-17.3 0m6.11-3.46a.65.65 0 0 0-.92.92L11.08 12l-2.54 2.54a.65.65 0 1 0 .92.92L12 12.92l2.54 2.54a.65.65 0 1 0 .92-.92L12.92 12l2.54-2.54a.65.65 0 1 0-.92-.92L12 11.08z"
|
|
347
|
+
fill={
|
|
348
|
+
{
|
|
349
|
+
"type": 2,
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
fillRule={0}
|
|
353
|
+
propList={
|
|
354
|
+
[
|
|
355
|
+
"fill",
|
|
356
|
+
"fillRule",
|
|
357
|
+
]
|
|
358
|
+
}
|
|
359
|
+
/>
|
|
360
|
+
</RNSVGGroup>
|
|
361
|
+
</RNSVGSvgView>
|
|
362
|
+
</View>
|
|
363
|
+
</View>
|
|
364
|
+
</View>
|
|
365
|
+
</View>
|
|
366
|
+
`;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { render, screen, userEvent } from "@testing-library/react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { OneChip } from ".";
|
|
4
|
+
import { AppIcons } from "../../icons";
|
|
5
|
+
|
|
6
|
+
describe("OneChip", () => {
|
|
7
|
+
const defaultProps = {
|
|
8
|
+
label: "label",
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
it("Snapshot", () => {
|
|
12
|
+
const { toJSON } = render(<OneChip {...defaultProps} />);
|
|
13
|
+
expect(toJSON()).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("Snapshot variant selected", () => {
|
|
17
|
+
const { toJSON } = render(<OneChip {...defaultProps} variant="selected" />);
|
|
18
|
+
expect(toJSON()).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("Snapshot with Icon", () => {
|
|
22
|
+
const { toJSON } = render(
|
|
23
|
+
<OneChip {...defaultProps} icon={AppIcons.Placeholder} />,
|
|
24
|
+
);
|
|
25
|
+
expect(toJSON()).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("Snapshot with OnClose", () => {
|
|
29
|
+
const handleOnClose = jest.fn();
|
|
30
|
+
const { toJSON } = render(
|
|
31
|
+
<OneChip {...defaultProps} onClose={handleOnClose} />,
|
|
32
|
+
);
|
|
33
|
+
expect(toJSON()).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("renders correctly with required props", () => {
|
|
37
|
+
render(<OneChip {...defaultProps} />);
|
|
38
|
+
|
|
39
|
+
const number = screen.getByText("label");
|
|
40
|
+
|
|
41
|
+
expect(number).toBeDefined();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("renders correctly with onClose event", async () => {
|
|
45
|
+
const testFn = jest.fn();
|
|
46
|
+
const user = userEvent.setup();
|
|
47
|
+
|
|
48
|
+
render(<OneChip {...defaultProps} onClose={testFn} />);
|
|
49
|
+
|
|
50
|
+
const close = screen.getByLabelText("Close");
|
|
51
|
+
await user.press(close);
|
|
52
|
+
|
|
53
|
+
expect(testFn).toHaveBeenCalledTimes(1);
|
|
54
|
+
expect(close).toBeDefined();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("renders correctly with onClick event", async () => {
|
|
58
|
+
const testFn = jest.fn();
|
|
59
|
+
const user = userEvent.setup();
|
|
60
|
+
|
|
61
|
+
render(<OneChip {...defaultProps} onClick={testFn} />);
|
|
62
|
+
|
|
63
|
+
const action = screen.getByLabelText("Action");
|
|
64
|
+
await user.press(action);
|
|
65
|
+
|
|
66
|
+
expect(testFn).toHaveBeenCalledTimes(1);
|
|
67
|
+
expect(action).toBeDefined();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { cva, type VariantProps } from "cva";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
import { Icon, IconType } from "../Icon";
|
|
4
|
+
import { View, Text, Pressable } from "react-native";
|
|
5
|
+
import { CrossedCircle } from "../../icons/app";
|
|
6
|
+
|
|
7
|
+
export const chipContainerVariants = cva({
|
|
8
|
+
base: "flex items-center gap-1 rounded-full border border-solid border-f1-border px-2 py-0.5 grow-0",
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "",
|
|
12
|
+
selected: "border-f1-border-selected bg-f1-background-selected-secondary",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "default",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const chipTextVariants = cva({
|
|
21
|
+
base: "font-medium",
|
|
22
|
+
variants: {
|
|
23
|
+
variant: {
|
|
24
|
+
default: "text-f1-foreground",
|
|
25
|
+
selected: "text-f1-foreground-selected",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: "default",
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
interface ChipProps extends VariantProps<typeof chipContainerVariants> {
|
|
34
|
+
label: string;
|
|
35
|
+
icon?: IconType;
|
|
36
|
+
onClick?: () => void;
|
|
37
|
+
onClose?: () => void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const OneChip = ({
|
|
41
|
+
label,
|
|
42
|
+
variant,
|
|
43
|
+
onClick,
|
|
44
|
+
onClose,
|
|
45
|
+
icon,
|
|
46
|
+
}: ChipProps) => {
|
|
47
|
+
return (
|
|
48
|
+
<View className="flex items-start">
|
|
49
|
+
<Pressable
|
|
50
|
+
className={cn(
|
|
51
|
+
chipContainerVariants({ variant }),
|
|
52
|
+
onClose && "pr-1.5",
|
|
53
|
+
icon && "pl-1.5",
|
|
54
|
+
)}
|
|
55
|
+
onPress={onClick}
|
|
56
|
+
tabIndex={onClick ? 0 : undefined}
|
|
57
|
+
aria-label="Action"
|
|
58
|
+
>
|
|
59
|
+
<View className="flex flex-row items-center gap-0.5">
|
|
60
|
+
{icon && (
|
|
61
|
+
<Icon
|
|
62
|
+
icon={icon}
|
|
63
|
+
size="sm"
|
|
64
|
+
className={chipTextVariants({ variant })}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
<Text className={chipTextVariants({ variant })}>{label}</Text>
|
|
68
|
+
{onClose && (
|
|
69
|
+
<Pressable
|
|
70
|
+
onPress={(e) => {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
onClose();
|
|
73
|
+
}}
|
|
74
|
+
className="-m-1 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full [&_svg]:text-f1-icon-secondary"
|
|
75
|
+
tabIndex={0}
|
|
76
|
+
aria-label="Close"
|
|
77
|
+
>
|
|
78
|
+
<Icon
|
|
79
|
+
icon={CrossedCircle}
|
|
80
|
+
className={chipTextVariants({ variant })}
|
|
81
|
+
size="sm"
|
|
82
|
+
/>
|
|
83
|
+
</Pressable>
|
|
84
|
+
)}
|
|
85
|
+
</View>
|
|
86
|
+
</Pressable>
|
|
87
|
+
</View>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`OnePreset Snapshot 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 grow-0 flex-row items-center gap-2 rounded border border-f1-border px-2.5 py-1.5 font-medium text-f1-foreground"
|
|
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
|
+
<Text
|
|
40
|
+
className="whitespace-nowrap text-f1-foreground"
|
|
41
|
+
>
|
|
42
|
+
label
|
|
43
|
+
</Text>
|
|
44
|
+
</View>
|
|
45
|
+
</View>
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
exports[`OnePreset Snapshot with number 1`] = `
|
|
49
|
+
<View
|
|
50
|
+
className="flex items-start"
|
|
51
|
+
>
|
|
52
|
+
<View
|
|
53
|
+
accessibilityState={
|
|
54
|
+
{
|
|
55
|
+
"busy": undefined,
|
|
56
|
+
"checked": undefined,
|
|
57
|
+
"disabled": undefined,
|
|
58
|
+
"expanded": undefined,
|
|
59
|
+
"selected": undefined,
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
accessibilityValue={
|
|
63
|
+
{
|
|
64
|
+
"max": undefined,
|
|
65
|
+
"min": undefined,
|
|
66
|
+
"now": undefined,
|
|
67
|
+
"text": undefined,
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
accessible={true}
|
|
71
|
+
className="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 pr-1.5"
|
|
72
|
+
collapsable={false}
|
|
73
|
+
focusable={true}
|
|
74
|
+
onBlur={[Function]}
|
|
75
|
+
onClick={[Function]}
|
|
76
|
+
onFocus={[Function]}
|
|
77
|
+
onResponderGrant={[Function]}
|
|
78
|
+
onResponderMove={[Function]}
|
|
79
|
+
onResponderRelease={[Function]}
|
|
80
|
+
onResponderTerminate={[Function]}
|
|
81
|
+
onResponderTerminationRequest={[Function]}
|
|
82
|
+
onStartShouldSetResponder={[Function]}
|
|
83
|
+
>
|
|
84
|
+
<Text
|
|
85
|
+
className="whitespace-nowrap text-f1-foreground"
|
|
86
|
+
>
|
|
87
|
+
label
|
|
88
|
+
</Text>
|
|
89
|
+
<View
|
|
90
|
+
className="flex items-start"
|
|
91
|
+
>
|
|
92
|
+
<View
|
|
93
|
+
className="flex items-center justify-center rounded-xs grow-0 px-0.5 min-w-5 h-5 bg-f1-background-secondary border border-f1-border"
|
|
94
|
+
>
|
|
95
|
+
<Text
|
|
96
|
+
className="text-center text-sm font-medium tabular-nums whitespace-nowrap text-f1-foreground"
|
|
97
|
+
>
|
|
98
|
+
42
|
|
99
|
+
</Text>
|
|
100
|
+
</View>
|
|
101
|
+
</View>
|
|
102
|
+
</View>
|
|
103
|
+
</View>
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
exports[`OnePreset renders correctly with selected props 1`] = `
|
|
107
|
+
<View
|
|
108
|
+
className="flex items-start"
|
|
109
|
+
>
|
|
110
|
+
<View
|
|
111
|
+
accessibilityState={
|
|
112
|
+
{
|
|
113
|
+
"busy": undefined,
|
|
114
|
+
"checked": undefined,
|
|
115
|
+
"disabled": undefined,
|
|
116
|
+
"expanded": undefined,
|
|
117
|
+
"selected": undefined,
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
accessibilityValue={
|
|
121
|
+
{
|
|
122
|
+
"max": undefined,
|
|
123
|
+
"min": undefined,
|
|
124
|
+
"now": undefined,
|
|
125
|
+
"text": undefined,
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
accessible={true}
|
|
129
|
+
className="flex grow-0 flex-row items-center gap-2 rounded border px-2.5 py-1.5 font-medium border-f1-border-selected bg-f1-background-selected-secondary text-f1-foreground-selected"
|
|
130
|
+
collapsable={false}
|
|
131
|
+
focusable={true}
|
|
132
|
+
onBlur={[Function]}
|
|
133
|
+
onClick={[Function]}
|
|
134
|
+
onFocus={[Function]}
|
|
135
|
+
onResponderGrant={[Function]}
|
|
136
|
+
onResponderMove={[Function]}
|
|
137
|
+
onResponderRelease={[Function]}
|
|
138
|
+
onResponderTerminate={[Function]}
|
|
139
|
+
onResponderTerminationRequest={[Function]}
|
|
140
|
+
onStartShouldSetResponder={[Function]}
|
|
141
|
+
>
|
|
142
|
+
<Text
|
|
143
|
+
className="whitespace-nowrap text-f1-foreground"
|
|
144
|
+
>
|
|
145
|
+
label
|
|
146
|
+
</Text>
|
|
147
|
+
</View>
|
|
148
|
+
</View>
|
|
149
|
+
`;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { render, screen, userEvent } from "@testing-library/react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { OnePreset } from ".";
|
|
4
|
+
|
|
5
|
+
describe("OnePreset", () => {
|
|
6
|
+
const defaultProps = {
|
|
7
|
+
label: "label",
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
it("Snapshot", () => {
|
|
11
|
+
const { toJSON } = render(<OnePreset {...defaultProps} />);
|
|
12
|
+
expect(toJSON()).toMatchSnapshot();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("Snapshot with number", () => {
|
|
16
|
+
const { toJSON } = render(<OnePreset {...defaultProps} number={42} />);
|
|
17
|
+
expect(toJSON()).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("renders correctly with selected props", () => {
|
|
21
|
+
const { toJSON } = render(<OnePreset {...defaultProps} selected={true} />);
|
|
22
|
+
|
|
23
|
+
expect(toJSON()).toMatchSnapshot();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("renders correctly with required props", () => {
|
|
27
|
+
render(<OnePreset {...defaultProps} />);
|
|
28
|
+
|
|
29
|
+
const number = screen.getByText("label");
|
|
30
|
+
|
|
31
|
+
expect(number).toBeDefined();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("renders correctly with onClick event", async () => {
|
|
35
|
+
const testFn = jest.fn();
|
|
36
|
+
const user = userEvent.setup();
|
|
37
|
+
|
|
38
|
+
render(<OnePreset {...defaultProps} onClick={testFn} />);
|
|
39
|
+
|
|
40
|
+
const number = screen.getByText("label");
|
|
41
|
+
await user.press(number);
|
|
42
|
+
|
|
43
|
+
expect(testFn).toHaveBeenCalledTimes(1);
|
|
44
|
+
expect(number).toBeDefined();
|
|
45
|
+
});
|
|
46
|
+
});
|