@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,103 @@
|
|
|
1
|
+
type FileTypeInfo = {
|
|
2
|
+
type: string;
|
|
3
|
+
color: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
type FileLike = {
|
|
7
|
+
name: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const FILE_TYPE_MAP: Record<string, FileTypeInfo> = {
|
|
12
|
+
pdf: { type: "PDF", color: "text-f1-foreground-accent" },
|
|
13
|
+
image: { type: "IMG", color: "text-f1-foreground-info" },
|
|
14
|
+
doc: { type: "DOC", color: "text-f1-foreground-info" },
|
|
15
|
+
excel: { type: "XLS", color: "text-f1-foreground-positive" },
|
|
16
|
+
ppt: { type: "PPT", color: "text-f1-foreground-warning" },
|
|
17
|
+
txt: { type: "TXT", color: "text-f1-foreground-secondary" },
|
|
18
|
+
video: { type: "VID", color: "text-f1-foreground-info" },
|
|
19
|
+
audio: { type: "AUD", color: "text-f1-foreground-accent" },
|
|
20
|
+
archive: { type: "ZIP", color: "text-f1-foreground-warning" },
|
|
21
|
+
csv: { type: "CSV", color: "text-f1-foreground-positive" },
|
|
22
|
+
html: { type: "HTML", color: "text-f1-foreground-accent" },
|
|
23
|
+
markdown: { type: "MD", color: "text-f1-foreground-secondary" },
|
|
24
|
+
default: { type: "FILE", color: "text-f1-foreground" },
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const MIME_MATCH_MAP: Record<string, keyof typeof FILE_TYPE_MAP> = {
|
|
28
|
+
pdf: "pdf",
|
|
29
|
+
image: "image",
|
|
30
|
+
word: "doc",
|
|
31
|
+
excel: "excel",
|
|
32
|
+
powerpoint: "ppt",
|
|
33
|
+
text: "txt",
|
|
34
|
+
video: "video",
|
|
35
|
+
audio: "audio",
|
|
36
|
+
archive: "archive",
|
|
37
|
+
csv: "csv",
|
|
38
|
+
html: "html",
|
|
39
|
+
markdown: "markdown",
|
|
40
|
+
zip: "archive",
|
|
41
|
+
rar: "archive",
|
|
42
|
+
tar: "archive",
|
|
43
|
+
gz: "archive",
|
|
44
|
+
"7z": "archive",
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const EXTENSION_MAP: Record<string, keyof typeof FILE_TYPE_MAP> = {
|
|
48
|
+
pdf: "pdf",
|
|
49
|
+
jpg: "image",
|
|
50
|
+
jpeg: "image",
|
|
51
|
+
png: "image",
|
|
52
|
+
gif: "image",
|
|
53
|
+
svg: "image",
|
|
54
|
+
doc: "doc",
|
|
55
|
+
docx: "doc",
|
|
56
|
+
xls: "excel",
|
|
57
|
+
xlsx: "excel",
|
|
58
|
+
csv: "csv",
|
|
59
|
+
ppt: "ppt",
|
|
60
|
+
pptx: "ppt",
|
|
61
|
+
txt: "txt",
|
|
62
|
+
mp4: "video",
|
|
63
|
+
mov: "video",
|
|
64
|
+
mkv: "video",
|
|
65
|
+
avi: "video",
|
|
66
|
+
webm: "video",
|
|
67
|
+
mp3: "audio",
|
|
68
|
+
wav: "audio",
|
|
69
|
+
flac: "audio",
|
|
70
|
+
ogg: "audio",
|
|
71
|
+
zip: "archive",
|
|
72
|
+
rar: "archive",
|
|
73
|
+
tar: "archive",
|
|
74
|
+
gz: "archive",
|
|
75
|
+
"7z": "archive",
|
|
76
|
+
html: "html",
|
|
77
|
+
htm: "html",
|
|
78
|
+
md: "markdown",
|
|
79
|
+
markdown: "markdown",
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const getFileTypeInfo = (file: FileLike): FileTypeInfo => {
|
|
83
|
+
const mimeType = file.type?.toLowerCase() ?? "";
|
|
84
|
+
|
|
85
|
+
const matchedMimeKey = Object.keys(MIME_MATCH_MAP).find((key) =>
|
|
86
|
+
mimeType.includes(key),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
if (matchedMimeKey) {
|
|
90
|
+
return FILE_TYPE_MAP[MIME_MATCH_MAP[matchedMimeKey]];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const extension = file.name.toLowerCase().split(".").pop();
|
|
94
|
+
|
|
95
|
+
if (extension && EXTENSION_MAP[extension]) {
|
|
96
|
+
return FILE_TYPE_MAP[EXTENSION_MAP[extension]];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return FILE_TYPE_MAP.default;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export { getFileTypeInfo };
|
|
103
|
+
export type { FileTypeInfo, FileLike };
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`IconAvatar Snapshot - different sizes 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
className="flex aspect-square items-center justify-center border border-solid border-f1-border-secondary h-6 w-6 rounded-sm"
|
|
6
|
+
>
|
|
7
|
+
<RNSVGSvgView
|
|
8
|
+
align="xMidYMid"
|
|
9
|
+
bbHeight="100%"
|
|
10
|
+
bbWidth="100%"
|
|
11
|
+
className="shrink-0 w-4 h-4 stroke-sm text-f1-foreground-secondary"
|
|
12
|
+
fill="none"
|
|
13
|
+
focusable={false}
|
|
14
|
+
meetOrSlice={0}
|
|
15
|
+
minX={0}
|
|
16
|
+
minY={0}
|
|
17
|
+
style={
|
|
18
|
+
[
|
|
19
|
+
{
|
|
20
|
+
"backgroundColor": "transparent",
|
|
21
|
+
"borderWidth": 0,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"flex": 0,
|
|
25
|
+
"height": "100%",
|
|
26
|
+
"width": "100%",
|
|
27
|
+
},
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
vbHeight={24}
|
|
31
|
+
vbWidth={24}
|
|
32
|
+
>
|
|
33
|
+
<RNSVGGroup
|
|
34
|
+
fill={null}
|
|
35
|
+
propList={
|
|
36
|
+
[
|
|
37
|
+
"fill",
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
>
|
|
41
|
+
<RNSVGCircle
|
|
42
|
+
cx={12}
|
|
43
|
+
cy={12}
|
|
44
|
+
fill={
|
|
45
|
+
{
|
|
46
|
+
"payload": 4278190080,
|
|
47
|
+
"type": 0,
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
propList={
|
|
51
|
+
[
|
|
52
|
+
"stroke",
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
r={8}
|
|
56
|
+
stroke={
|
|
57
|
+
{
|
|
58
|
+
"type": 2,
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/>
|
|
62
|
+
<RNSVGPath
|
|
63
|
+
d="m17.5 6.5-11 11M17.5 17.5l-11-11"
|
|
64
|
+
fill={
|
|
65
|
+
{
|
|
66
|
+
"payload": 4278190080,
|
|
67
|
+
"type": 0,
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
propList={
|
|
71
|
+
[
|
|
72
|
+
"stroke",
|
|
73
|
+
"strokeLinejoin",
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
stroke={
|
|
77
|
+
{
|
|
78
|
+
"type": 2,
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
strokeLinejoin={1}
|
|
82
|
+
/>
|
|
83
|
+
</RNSVGGroup>
|
|
84
|
+
</RNSVGSvgView>
|
|
85
|
+
</View>
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
exports[`IconAvatar Snapshot - different sizes 2`] = `
|
|
89
|
+
<View
|
|
90
|
+
className="flex aspect-square items-center justify-center border border-solid border-f1-border-secondary h-9 w-9 rounded-md"
|
|
91
|
+
>
|
|
92
|
+
<RNSVGSvgView
|
|
93
|
+
align="xMidYMid"
|
|
94
|
+
bbHeight="100%"
|
|
95
|
+
bbWidth="100%"
|
|
96
|
+
className="shrink-0 w-5 h-5 stroke-md text-f1-foreground-secondary"
|
|
97
|
+
fill="none"
|
|
98
|
+
focusable={false}
|
|
99
|
+
meetOrSlice={0}
|
|
100
|
+
minX={0}
|
|
101
|
+
minY={0}
|
|
102
|
+
style={
|
|
103
|
+
[
|
|
104
|
+
{
|
|
105
|
+
"backgroundColor": "transparent",
|
|
106
|
+
"borderWidth": 0,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"flex": 0,
|
|
110
|
+
"height": "100%",
|
|
111
|
+
"width": "100%",
|
|
112
|
+
},
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
vbHeight={24}
|
|
116
|
+
vbWidth={24}
|
|
117
|
+
>
|
|
118
|
+
<RNSVGGroup
|
|
119
|
+
fill={null}
|
|
120
|
+
propList={
|
|
121
|
+
[
|
|
122
|
+
"fill",
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
>
|
|
126
|
+
<RNSVGCircle
|
|
127
|
+
cx={12}
|
|
128
|
+
cy={12}
|
|
129
|
+
fill={
|
|
130
|
+
{
|
|
131
|
+
"payload": 4278190080,
|
|
132
|
+
"type": 0,
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
propList={
|
|
136
|
+
[
|
|
137
|
+
"stroke",
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
r={8}
|
|
141
|
+
stroke={
|
|
142
|
+
{
|
|
143
|
+
"type": 2,
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/>
|
|
147
|
+
<RNSVGPath
|
|
148
|
+
d="m17.5 6.5-11 11M17.5 17.5l-11-11"
|
|
149
|
+
fill={
|
|
150
|
+
{
|
|
151
|
+
"payload": 4278190080,
|
|
152
|
+
"type": 0,
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
propList={
|
|
156
|
+
[
|
|
157
|
+
"stroke",
|
|
158
|
+
"strokeLinejoin",
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
stroke={
|
|
162
|
+
{
|
|
163
|
+
"type": 2,
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
strokeLinejoin={1}
|
|
167
|
+
/>
|
|
168
|
+
</RNSVGGroup>
|
|
169
|
+
</RNSVGSvgView>
|
|
170
|
+
</View>
|
|
171
|
+
`;
|
|
172
|
+
|
|
173
|
+
exports[`IconAvatar Snapshot - different sizes 3`] = `
|
|
174
|
+
<View
|
|
175
|
+
className="flex aspect-square items-center justify-center border border-solid border-f1-border-secondary h-10 w-10 rounded-lg"
|
|
176
|
+
>
|
|
177
|
+
<RNSVGSvgView
|
|
178
|
+
align="xMidYMid"
|
|
179
|
+
bbHeight="100%"
|
|
180
|
+
bbWidth="100%"
|
|
181
|
+
className="shrink-0 w-6 h-6 stroke-lg text-f1-foreground-secondary"
|
|
182
|
+
fill="none"
|
|
183
|
+
focusable={false}
|
|
184
|
+
meetOrSlice={0}
|
|
185
|
+
minX={0}
|
|
186
|
+
minY={0}
|
|
187
|
+
style={
|
|
188
|
+
[
|
|
189
|
+
{
|
|
190
|
+
"backgroundColor": "transparent",
|
|
191
|
+
"borderWidth": 0,
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"flex": 0,
|
|
195
|
+
"height": "100%",
|
|
196
|
+
"width": "100%",
|
|
197
|
+
},
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
vbHeight={24}
|
|
201
|
+
vbWidth={24}
|
|
202
|
+
>
|
|
203
|
+
<RNSVGGroup
|
|
204
|
+
fill={null}
|
|
205
|
+
propList={
|
|
206
|
+
[
|
|
207
|
+
"fill",
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
>
|
|
211
|
+
<RNSVGCircle
|
|
212
|
+
cx={12}
|
|
213
|
+
cy={12}
|
|
214
|
+
fill={
|
|
215
|
+
{
|
|
216
|
+
"payload": 4278190080,
|
|
217
|
+
"type": 0,
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
propList={
|
|
221
|
+
[
|
|
222
|
+
"stroke",
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
r={8}
|
|
226
|
+
stroke={
|
|
227
|
+
{
|
|
228
|
+
"type": 2,
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/>
|
|
232
|
+
<RNSVGPath
|
|
233
|
+
d="m17.5 6.5-11 11M17.5 17.5l-11-11"
|
|
234
|
+
fill={
|
|
235
|
+
{
|
|
236
|
+
"payload": 4278190080,
|
|
237
|
+
"type": 0,
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
propList={
|
|
241
|
+
[
|
|
242
|
+
"stroke",
|
|
243
|
+
"strokeLinejoin",
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
stroke={
|
|
247
|
+
{
|
|
248
|
+
"type": 2,
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
strokeLinejoin={1}
|
|
252
|
+
/>
|
|
253
|
+
</RNSVGGroup>
|
|
254
|
+
</RNSVGSvgView>
|
|
255
|
+
</View>
|
|
256
|
+
`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { render } from "@testing-library/react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { IconAvatar } from "./";
|
|
4
|
+
import { Placeholder } from "../../../icons/app";
|
|
5
|
+
|
|
6
|
+
describe("IconAvatar", () => {
|
|
7
|
+
it("Snapshot - different sizes", () => {
|
|
8
|
+
const sizes = ["sm", "md", "lg"] as const;
|
|
9
|
+
|
|
10
|
+
sizes.forEach((size) => {
|
|
11
|
+
const { toJSON } = render(<IconAvatar icon={Placeholder} size={size} />);
|
|
12
|
+
|
|
13
|
+
expect(toJSON()).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { View } from "react-native";
|
|
2
|
+
import { cn } from "../../../lib/utils";
|
|
3
|
+
import { Icon, IconType } from "../../Icon";
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
icon: IconType;
|
|
7
|
+
size?: "sm" | "md" | "lg";
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const sizes = {
|
|
12
|
+
sm: "h-6 w-6 rounded-sm",
|
|
13
|
+
md: "h-9 w-9 rounded-md",
|
|
14
|
+
lg: "h-10 w-10 rounded-lg",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const IconAvatar = ({ icon, size = "md", className }: Props) => {
|
|
18
|
+
return (
|
|
19
|
+
<View
|
|
20
|
+
className={cn(
|
|
21
|
+
"flex aspect-square items-center justify-center border border-solid border-f1-border-secondary",
|
|
22
|
+
sizes[size],
|
|
23
|
+
className,
|
|
24
|
+
)}
|
|
25
|
+
>
|
|
26
|
+
<Icon icon={icon} size={size} className="text-f1-foreground-secondary" />
|
|
27
|
+
</View>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
IconAvatar.displayName = "IconAvatar";
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { View } from "react-native";
|
|
2
|
+
import { cva, type VariantProps } from "cva";
|
|
3
|
+
import { IconType, applyIconInterop } from "../../Icon";
|
|
4
|
+
import Svg, { Defs, LinearGradient, Stop, Path } from "react-native-svg";
|
|
5
|
+
import { ModuleId, modules } from "./modules";
|
|
6
|
+
|
|
7
|
+
const moduleAvatarVariants = cva({
|
|
8
|
+
base: "relative flex shrink-0 items-center justify-center",
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: "h-4 w-4",
|
|
12
|
+
md: "h-6 w-6",
|
|
13
|
+
lg: "h-8 w-8",
|
|
14
|
+
xl: "h-10 w-10",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
size: "md",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const iconContainerVariants = cva({
|
|
23
|
+
base: "absolute inset-0 items-center justify-center z-10",
|
|
24
|
+
variants: {
|
|
25
|
+
size: {
|
|
26
|
+
sm: "h-4 w-4",
|
|
27
|
+
md: "h-6 w-6",
|
|
28
|
+
lg: "h-8 w-8",
|
|
29
|
+
xl: "h-10 w-10",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
size: "md",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const iconSizeVariants = cva({
|
|
38
|
+
base: "relative text-f1-foreground-inverse drop-shadow",
|
|
39
|
+
variants: {
|
|
40
|
+
size: {
|
|
41
|
+
sm: "h-[14px] w-[14px]",
|
|
42
|
+
md: "h-[18px] w-[18px]",
|
|
43
|
+
lg: "h-6 w-6",
|
|
44
|
+
xl: "h-8 w-8",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
size: "md",
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export type ModuleAvatarProps = VariantProps<typeof moduleAvatarVariants> &
|
|
53
|
+
(
|
|
54
|
+
| {
|
|
55
|
+
module: ModuleId;
|
|
56
|
+
}
|
|
57
|
+
| {
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated This component should only render module related icons, not arbitrary icons. The `icon` property will be removed soon. Use the `module` prop instead.
|
|
60
|
+
*/
|
|
61
|
+
icon: IconType;
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const squirclePath =
|
|
66
|
+
"M50,0 C43,0 36,0 30,1 23,2 17,5 12,9 5,16 1,25 0,36 0,43 0,57 0,64 1,75 5,84 12,91 17,95 23,98 30,99 36,100 43,100 50,100 57,100 64,100 70,99 77,98 83,95 88,91 95,84 99,75 100,64 100,57 100,43 100,36 99,25 95,16 88,9 83,5 77,2 70,1 64,0 57,0 50,0";
|
|
67
|
+
|
|
68
|
+
export const ModuleAvatar = ({ size = "md", ...props }: ModuleAvatarProps) => {
|
|
69
|
+
const IconComponent =
|
|
70
|
+
"icon" in props
|
|
71
|
+
? applyIconInterop(props.icon)
|
|
72
|
+
: applyIconInterop(modules[props.module]);
|
|
73
|
+
|
|
74
|
+
const code = Math.random().toString(36).substring(2, 15);
|
|
75
|
+
const gradientId = `gradient-${code}`;
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<View className={moduleAvatarVariants({ size })} accessibilityRole="image">
|
|
79
|
+
<Svg
|
|
80
|
+
viewBox="0 0 100 100"
|
|
81
|
+
className="absolute h-full w-full"
|
|
82
|
+
preserveAspectRatio="none"
|
|
83
|
+
>
|
|
84
|
+
<Defs>
|
|
85
|
+
<LinearGradient id={gradientId} x1="0%" y1="0%" x2="100%" y2="100%">
|
|
86
|
+
<Stop offset="0%" stopColor="#FF355E" />
|
|
87
|
+
<Stop offset="44%" stopColor="#FF355E" />
|
|
88
|
+
<Stop offset="100%" stopColor="#D62D4F" />
|
|
89
|
+
</LinearGradient>
|
|
90
|
+
</Defs>
|
|
91
|
+
<Path
|
|
92
|
+
d={squirclePath}
|
|
93
|
+
fill={`url(#${gradientId})`}
|
|
94
|
+
stroke="white"
|
|
95
|
+
strokeWidth={10}
|
|
96
|
+
transform="scale(0.95) translate(2.5 2.5)"
|
|
97
|
+
/>
|
|
98
|
+
</Svg>
|
|
99
|
+
<View className={iconContainerVariants({ size })}>
|
|
100
|
+
<IconComponent className={iconSizeVariants({ size })} />
|
|
101
|
+
</View>
|
|
102
|
+
</View>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
ModuleAvatar.displayName = "IconAvatar";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ModuleIcons } from "../../../icons";
|
|
2
|
+
|
|
3
|
+
export const modules = {
|
|
4
|
+
"ai-reports": ModuleIcons.Reports,
|
|
5
|
+
analytics: ModuleIcons.Reports,
|
|
6
|
+
ats: ModuleIcons.Recruitment,
|
|
7
|
+
benefits: ModuleIcons.Benefits,
|
|
8
|
+
billing: ModuleIcons.Finance,
|
|
9
|
+
calendar: ModuleIcons.Calendar,
|
|
10
|
+
cards: ModuleIcons.Cards,
|
|
11
|
+
"clock-in": ModuleIcons.ClockIn,
|
|
12
|
+
company_attendance: ModuleIcons.TimeTracking,
|
|
13
|
+
company_documents: ModuleIcons.Documents,
|
|
14
|
+
company_projects: ModuleIcons.Projects,
|
|
15
|
+
company_trainings: ModuleIcons.Trainings,
|
|
16
|
+
compensations: ModuleIcons.Payroll,
|
|
17
|
+
discover: ModuleIcons.Discover,
|
|
18
|
+
documents: ModuleIcons.Documents,
|
|
19
|
+
employee_attendance: ModuleIcons.ClockIn,
|
|
20
|
+
employees: ModuleIcons.Organization,
|
|
21
|
+
engagement: ModuleIcons.Engagement,
|
|
22
|
+
engagement_insights: ModuleIcons.Engagement,
|
|
23
|
+
my_surveys: ModuleIcons.Engagement,
|
|
24
|
+
"finance-accounting": ModuleIcons.Finance,
|
|
25
|
+
"finance-sales": ModuleIcons.Sales,
|
|
26
|
+
"finance-spending": ModuleIcons.Spending,
|
|
27
|
+
"finance-treasury": ModuleIcons.Treasury,
|
|
28
|
+
"finance-workspace": ModuleIcons.Reports,
|
|
29
|
+
goals: ModuleIcons.Goals,
|
|
30
|
+
home: ModuleIcons.Home,
|
|
31
|
+
hub: ModuleIcons.Hub,
|
|
32
|
+
kudos: ModuleIcons.Kudos,
|
|
33
|
+
my_benefits: ModuleIcons.Benefits,
|
|
34
|
+
my_documents: ModuleIcons.MyDocuments,
|
|
35
|
+
my_projects: ModuleIcons.Projects,
|
|
36
|
+
my_spending: ModuleIcons.Spending,
|
|
37
|
+
my_trainings: ModuleIcons.Trainings,
|
|
38
|
+
"new-trainings": ModuleIcons.Trainings,
|
|
39
|
+
notifications: ModuleIcons.Inbox,
|
|
40
|
+
inbox: ModuleIcons.Inbox,
|
|
41
|
+
overviews: ModuleIcons.Overviews,
|
|
42
|
+
payroll_bundle: ModuleIcons.Payroll,
|
|
43
|
+
performance_v2: ModuleIcons.Performance,
|
|
44
|
+
performance: ModuleIcons.Performance,
|
|
45
|
+
playground: ModuleIcons.Home,
|
|
46
|
+
processes: ModuleIcons.Workflows,
|
|
47
|
+
profile: ModuleIcons.Profile,
|
|
48
|
+
project_management: ModuleIcons.Projects,
|
|
49
|
+
reports: ModuleIcons.Reports,
|
|
50
|
+
settings: ModuleIcons.Settings,
|
|
51
|
+
personal_settings: ModuleIcons.Settings,
|
|
52
|
+
shift_management: ModuleIcons.Shifts,
|
|
53
|
+
shifts: ModuleIcons.Shifts,
|
|
54
|
+
social: ModuleIcons.Social,
|
|
55
|
+
software: ModuleIcons.Software,
|
|
56
|
+
space_control: ModuleIcons.Spaces,
|
|
57
|
+
talent_analytics: ModuleIcons.Performance,
|
|
58
|
+
tasks: ModuleIcons.Tasks,
|
|
59
|
+
"time-tracking": ModuleIcons.TimeTracking,
|
|
60
|
+
timeoff: ModuleIcons.TimeOff,
|
|
61
|
+
workflows: ModuleIcons.Workflows,
|
|
62
|
+
} as const;
|
|
63
|
+
|
|
64
|
+
export type ModuleId = keyof typeof modules;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`PersonAvatar Snapshot 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
className="inline-flex "
|
|
6
|
+
>
|
|
7
|
+
<View
|
|
8
|
+
className="h-fit w-fit"
|
|
9
|
+
>
|
|
10
|
+
<View
|
|
11
|
+
aria-hidden={true}
|
|
12
|
+
className="flex shrink-0 items-center justify-center overflow-hidden text-center font-semibold w-8 h-8 rounded-full bg-[hsl(theme(colors.flubber.50))]"
|
|
13
|
+
data-a11y-color-contrast-ignore={true}
|
|
14
|
+
role="img"
|
|
15
|
+
>
|
|
16
|
+
<Text
|
|
17
|
+
className="text-f1-foreground-inverse/90 text-md"
|
|
18
|
+
data-a11y-color-contrast-ignore={true}
|
|
19
|
+
>
|
|
20
|
+
DM
|
|
21
|
+
</Text>
|
|
22
|
+
</View>
|
|
23
|
+
</View>
|
|
24
|
+
</View>
|
|
25
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { render } from "@testing-library/react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { PersonAvatar } from "./";
|
|
4
|
+
|
|
5
|
+
describe("PersonAvatar", () => {
|
|
6
|
+
it("Snapshot", () => {
|
|
7
|
+
const { toJSON } = render(
|
|
8
|
+
<PersonAvatar firstName="Daniel" lastName="Maza" />,
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
expect(toJSON()).toMatchSnapshot();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { BaseAvatar } from "../BaseAvatar";
|
|
3
|
+
import { AvatarBadge } from "../types";
|
|
4
|
+
|
|
5
|
+
type BaseAvatarProps = ComponentProps<typeof BaseAvatar>;
|
|
6
|
+
|
|
7
|
+
export type PersonAvatarProps = {
|
|
8
|
+
firstName: string;
|
|
9
|
+
lastName: string;
|
|
10
|
+
src?: string;
|
|
11
|
+
size?: BaseAvatarProps["size"];
|
|
12
|
+
badge?: AvatarBadge;
|
|
13
|
+
} & Pick<BaseAvatarProps, "aria-label" | "aria-labelledby">;
|
|
14
|
+
|
|
15
|
+
export const PersonAvatar = ({
|
|
16
|
+
firstName,
|
|
17
|
+
lastName,
|
|
18
|
+
src,
|
|
19
|
+
size,
|
|
20
|
+
"aria-label": ariaLabel,
|
|
21
|
+
"aria-labelledby": ariaLabelledby,
|
|
22
|
+
badge,
|
|
23
|
+
}: PersonAvatarProps) => {
|
|
24
|
+
return (
|
|
25
|
+
<BaseAvatar
|
|
26
|
+
type="rounded"
|
|
27
|
+
name={[firstName, lastName]}
|
|
28
|
+
src={src}
|
|
29
|
+
size={size}
|
|
30
|
+
color="random"
|
|
31
|
+
aria-label={ariaLabel}
|
|
32
|
+
aria-labelledby={ariaLabelledby}
|
|
33
|
+
badge={badge}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
PersonAvatar.displayName = "PersonAvatar";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`TeamAvatar Snapshot 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
className="inline-flex "
|
|
6
|
+
>
|
|
7
|
+
<View
|
|
8
|
+
className="h-fit w-fit"
|
|
9
|
+
>
|
|
10
|
+
<View
|
|
11
|
+
aria-hidden={true}
|
|
12
|
+
className="flex shrink-0 items-center justify-center overflow-hidden text-center font-semibold w-8 h-8 rounded bg-[hsl(theme(colors.smoke.50))]"
|
|
13
|
+
data-a11y-color-contrast-ignore={true}
|
|
14
|
+
role="img"
|
|
15
|
+
>
|
|
16
|
+
<Text
|
|
17
|
+
className="text-f1-foreground-inverse/90 text-md"
|
|
18
|
+
data-a11y-color-contrast-ignore={true}
|
|
19
|
+
>
|
|
20
|
+
FA
|
|
21
|
+
</Text>
|
|
22
|
+
</View>
|
|
23
|
+
</View>
|
|
24
|
+
</View>
|
|
25
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { render } from "@testing-library/react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TeamAvatar } from "./";
|
|
4
|
+
|
|
5
|
+
describe("TeamAvatar", () => {
|
|
6
|
+
it("Snapshot", () => {
|
|
7
|
+
const { toJSON } = render(<TeamAvatar name="Factorial One" />);
|
|
8
|
+
|
|
9
|
+
expect(toJSON()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
});
|