@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,14 @@
|
|
|
1
|
+
import { render } from "@testing-library/react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { DotTag, dotTagColors } from ".";
|
|
4
|
+
|
|
5
|
+
describe("RawTag", () => {
|
|
6
|
+
it("Snapshot", () => {
|
|
7
|
+
dotTagColors.map((color) => {
|
|
8
|
+
const { toJSON } = render(
|
|
9
|
+
<DotTag key={color} text="Label" color={color} />,
|
|
10
|
+
);
|
|
11
|
+
expect(toJSON()).toMatchSnapshot();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { baseColors } from "@factorialco/f0-core";
|
|
2
|
+
import { BaseTag } from "../BaseTag";
|
|
3
|
+
import { useTextFormatEnforcer } from "../../../lib/text";
|
|
4
|
+
import { View } from "react-native";
|
|
5
|
+
|
|
6
|
+
export type NewColor = Extract<
|
|
7
|
+
keyof typeof baseColors,
|
|
8
|
+
| "viridian"
|
|
9
|
+
| "malibu"
|
|
10
|
+
| "yellow"
|
|
11
|
+
| "purple"
|
|
12
|
+
| "lilac"
|
|
13
|
+
| "barbie"
|
|
14
|
+
| "smoke"
|
|
15
|
+
| "army"
|
|
16
|
+
| "flubber"
|
|
17
|
+
| "indigo"
|
|
18
|
+
| "camel"
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export const dotTagColors = Object.keys(baseColors) as NewColor[];
|
|
22
|
+
|
|
23
|
+
export type DotTagProps = {
|
|
24
|
+
text: string;
|
|
25
|
+
} & ({ color: NewColor } | { customColor: string });
|
|
26
|
+
|
|
27
|
+
export const DotTag = ({ text, ...props }: DotTagProps) => {
|
|
28
|
+
useTextFormatEnforcer(text, { disallowEmpty: true });
|
|
29
|
+
|
|
30
|
+
const backgroundColor =
|
|
31
|
+
"color" in props && props.color
|
|
32
|
+
? `hsl(${baseColors[props.color][50]})`
|
|
33
|
+
: "customColor" in props && props.customColor;
|
|
34
|
+
|
|
35
|
+
if (!backgroundColor) return null;
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<BaseTag
|
|
39
|
+
classNameContainer="border border-solid border-f1-border-secondary"
|
|
40
|
+
left={
|
|
41
|
+
<View
|
|
42
|
+
className="m-1 aspect-square w-2 rounded-full"
|
|
43
|
+
style={{
|
|
44
|
+
backgroundColor,
|
|
45
|
+
}}
|
|
46
|
+
aria-hidden
|
|
47
|
+
/>
|
|
48
|
+
}
|
|
49
|
+
text={text}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
DotTag.displayName = "DotTag";
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`RawTag 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 flex-row items-center justify-start gap-0.5 rounded-full py-0.5 pr-2 pl-2 border border-solid border-f1-border-secondary"
|
|
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="line-clamp-1 text-base font-medium text-f1-foreground"
|
|
41
|
+
>
|
|
42
|
+
test
|
|
43
|
+
</Text>
|
|
44
|
+
</View>
|
|
45
|
+
</View>
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
exports[`RawTag Snapshot noBorder 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 flex-row items-center justify-start gap-0.5 rounded-full py-0.5 pr-2 pl-2"
|
|
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="line-clamp-1 text-base font-medium text-f1-foreground"
|
|
86
|
+
>
|
|
87
|
+
test
|
|
88
|
+
</Text>
|
|
89
|
+
</View>
|
|
90
|
+
</View>
|
|
91
|
+
`;
|
|
92
|
+
|
|
93
|
+
exports[`RawTag Snapshot with icon 1`] = `
|
|
94
|
+
<View
|
|
95
|
+
className="flex items-start"
|
|
96
|
+
>
|
|
97
|
+
<View
|
|
98
|
+
accessibilityState={
|
|
99
|
+
{
|
|
100
|
+
"busy": undefined,
|
|
101
|
+
"checked": undefined,
|
|
102
|
+
"disabled": undefined,
|
|
103
|
+
"expanded": undefined,
|
|
104
|
+
"selected": undefined,
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
accessibilityValue={
|
|
108
|
+
{
|
|
109
|
+
"max": undefined,
|
|
110
|
+
"min": undefined,
|
|
111
|
+
"now": undefined,
|
|
112
|
+
"text": undefined,
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
accessible={true}
|
|
116
|
+
className="flex flex-row items-center justify-start gap-0.5 rounded-full py-0.5 pr-2 pl-1 border border-solid border-f1-border-secondary"
|
|
117
|
+
collapsable={false}
|
|
118
|
+
focusable={true}
|
|
119
|
+
onBlur={[Function]}
|
|
120
|
+
onClick={[Function]}
|
|
121
|
+
onFocus={[Function]}
|
|
122
|
+
onResponderGrant={[Function]}
|
|
123
|
+
onResponderMove={[Function]}
|
|
124
|
+
onResponderRelease={[Function]}
|
|
125
|
+
onResponderTerminate={[Function]}
|
|
126
|
+
onResponderTerminationRequest={[Function]}
|
|
127
|
+
onStartShouldSetResponder={[Function]}
|
|
128
|
+
>
|
|
129
|
+
<RNSVGSvgView
|
|
130
|
+
align="xMidYMid"
|
|
131
|
+
aria-hidden={true}
|
|
132
|
+
bbHeight="100%"
|
|
133
|
+
bbWidth="100%"
|
|
134
|
+
className="shrink-0 w-4 h-4 stroke-sm text-f1-icon"
|
|
135
|
+
fill="none"
|
|
136
|
+
focusable={false}
|
|
137
|
+
meetOrSlice={0}
|
|
138
|
+
minX={0}
|
|
139
|
+
minY={0}
|
|
140
|
+
style={
|
|
141
|
+
[
|
|
142
|
+
{
|
|
143
|
+
"backgroundColor": "transparent",
|
|
144
|
+
"borderWidth": 0,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"flex": 0,
|
|
148
|
+
"height": "100%",
|
|
149
|
+
"width": "100%",
|
|
150
|
+
},
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
vbHeight={24}
|
|
154
|
+
vbWidth={24}
|
|
155
|
+
>
|
|
156
|
+
<RNSVGGroup
|
|
157
|
+
fill={null}
|
|
158
|
+
propList={
|
|
159
|
+
[
|
|
160
|
+
"fill",
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
>
|
|
164
|
+
<RNSVGPath
|
|
165
|
+
d="m5.55 14.121.714-4A5 5 0 0 1 11.186 6h1.628a5 5 0 0 1 4.922 4.121l.714 4A5 5 0 0 1 13.528 20h-3.056a5 5 0 0 1-4.922-5.879ZM10.326 2.5h3.348a1 1 0 0 1 .962 1.275L14 6h-4l-.636-2.225a1 1 0 0 1 .962-1.275Z"
|
|
166
|
+
fill={
|
|
167
|
+
{
|
|
168
|
+
"payload": 4278190080,
|
|
169
|
+
"type": 0,
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
propList={
|
|
173
|
+
[
|
|
174
|
+
"stroke",
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
stroke={
|
|
178
|
+
{
|
|
179
|
+
"type": 2,
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/>
|
|
183
|
+
<RNSVGPath
|
|
184
|
+
d="M14 10h-2.5a1.5 1.5 0 0 0-1.5 1.5v0a1.5 1.5 0 0 0 1.5 1.5h1a1.5 1.5 0 0 1 1.5 1.5v0a1.5 1.5 0 0 1-1.5 1.5H10M12 16v1M12 9v1"
|
|
185
|
+
fill={
|
|
186
|
+
{
|
|
187
|
+
"payload": 4278190080,
|
|
188
|
+
"type": 0,
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
propList={
|
|
192
|
+
[
|
|
193
|
+
"stroke",
|
|
194
|
+
"strokeLinecap",
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
stroke={
|
|
198
|
+
{
|
|
199
|
+
"type": 2,
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
strokeLinecap={1}
|
|
203
|
+
/>
|
|
204
|
+
</RNSVGGroup>
|
|
205
|
+
</RNSVGSvgView>
|
|
206
|
+
<Text
|
|
207
|
+
className="line-clamp-1 text-base font-medium text-f1-foreground"
|
|
208
|
+
>
|
|
209
|
+
test
|
|
210
|
+
</Text>
|
|
211
|
+
</View>
|
|
212
|
+
</View>
|
|
213
|
+
`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { render } from "@testing-library/react-native";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { RawTag } from ".";
|
|
4
|
+
import { AppIcons } from "../../../icons";
|
|
5
|
+
|
|
6
|
+
describe("RawTag", () => {
|
|
7
|
+
it("Snapshot", () => {
|
|
8
|
+
const { toJSON } = render(<RawTag text="test" />);
|
|
9
|
+
expect(toJSON()).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
it("Snapshot with icon", () => {
|
|
12
|
+
const { toJSON } = render(<RawTag text="test" icon={AppIcons.MoneyBag} />);
|
|
13
|
+
expect(toJSON()).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
it("Snapshot noBorder", () => {
|
|
16
|
+
const { toJSON } = render(<RawTag text="test" noBorder={true} />);
|
|
17
|
+
expect(toJSON()).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BaseTag } from "../BaseTag";
|
|
2
|
+
import { useTextFormatEnforcer } from "../../../lib/text";
|
|
3
|
+
import { Icon, IconType } from "../../Icon";
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
|
+
|
|
6
|
+
export type RawTagProps = {
|
|
7
|
+
text?: string;
|
|
8
|
+
additionalAccesibleText?: string;
|
|
9
|
+
icon?: IconType;
|
|
10
|
+
noBorder?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const RawTag = ({
|
|
15
|
+
text,
|
|
16
|
+
additionalAccesibleText,
|
|
17
|
+
icon,
|
|
18
|
+
noBorder,
|
|
19
|
+
className,
|
|
20
|
+
}: RawTagProps) => {
|
|
21
|
+
useTextFormatEnforcer(text, { disallowEmpty: true });
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<BaseTag
|
|
25
|
+
classNameContainer={cn(
|
|
26
|
+
!noBorder && "border border-solid border-f1-border-secondary",
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
classNameText="text-f1-foreground"
|
|
30
|
+
left={
|
|
31
|
+
icon ? (
|
|
32
|
+
<Icon icon={icon} size="sm" className="text-f1-icon" aria-hidden />
|
|
33
|
+
) : null
|
|
34
|
+
}
|
|
35
|
+
text={text}
|
|
36
|
+
additionalAccesibleText={additionalAccesibleText}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
RawTag.displayName = "RawTag";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { AlertTag } from "./AlertTab";
|
|
3
|
+
|
|
4
|
+
type AlertTagProps = ComponentProps<typeof AlertTag>;
|
|
5
|
+
|
|
6
|
+
// Base interface for optional tooltip description
|
|
7
|
+
interface WithTooltipDescription {
|
|
8
|
+
/**
|
|
9
|
+
* Optional description to show in the tooltip
|
|
10
|
+
*/
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Base type for all tag variants
|
|
15
|
+
type BaseTag<T extends { type: string }> = T & WithTooltipDescription;
|
|
16
|
+
|
|
17
|
+
export type TagVariant = BaseTag<{ type: "alert" } & AlertTagProps>;
|
|
18
|
+
|
|
19
|
+
const tagComponent = (tag: TagVariant): ReactNode | undefined => {
|
|
20
|
+
const { type } = tag;
|
|
21
|
+
if (type === "alert") return <AlertTag {...tag} />;
|
|
22
|
+
|
|
23
|
+
return undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Tag = ({ tag }: { tag: TagVariant }): ReactNode => {
|
|
27
|
+
const renderTag = tagComponent(tag);
|
|
28
|
+
|
|
29
|
+
if (!renderTag) return "Invalid tag type";
|
|
30
|
+
|
|
31
|
+
return renderTag;
|
|
32
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { render } from "@testing-library/react-native"
|
|
2
|
+
import React from "react"
|
|
3
|
+
import { ExampleComponent } from "../ExampleComponent"
|
|
4
|
+
|
|
5
|
+
describe("ExampleComponent", () => {
|
|
6
|
+
it("renders correctly with default text", () => {
|
|
7
|
+
const { getByText } = render(<ExampleComponent />)
|
|
8
|
+
expect(getByText("Hello World")).toBeTruthy()
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
it("renders correctly with custom text", () => {
|
|
12
|
+
const customText = "Custom Hello Text"
|
|
13
|
+
const { getByText } = render(<ExampleComponent text={customText} />)
|
|
14
|
+
expect(getByText(customText)).toBeTruthy()
|
|
15
|
+
})
|
|
16
|
+
})
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { CopyAction } from "./actions/CopyAction";
|
|
3
|
+
import { cn } from "../../../../lib/utils";
|
|
4
|
+
import { Icon, IconType } from "../../../Icon";
|
|
5
|
+
import { View, Text } from "react-native";
|
|
6
|
+
import { GenericAction } from "./actions/GenericAction";
|
|
7
|
+
import { ActionType } from ".";
|
|
8
|
+
|
|
9
|
+
type ItemContainerProps = {
|
|
10
|
+
leftIcon?: IconType | (() => ReactElement);
|
|
11
|
+
action?: ActionType;
|
|
12
|
+
text: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const ItemContainer = (props: ItemContainerProps) => {
|
|
17
|
+
const {
|
|
18
|
+
text,
|
|
19
|
+
leftIcon: LeftIcon,
|
|
20
|
+
className,
|
|
21
|
+
action = { type: "noop" },
|
|
22
|
+
} = props;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<View className="flex rounded font-medium text-f1-foreground *:flex-1">
|
|
26
|
+
<Action
|
|
27
|
+
action={action}
|
|
28
|
+
className={cn("flex flex-row items-center gap-1.5 p-1.5", className)}
|
|
29
|
+
>
|
|
30
|
+
{LeftIcon &&
|
|
31
|
+
(typeof LeftIcon === "function" ? (
|
|
32
|
+
LeftIcon({})
|
|
33
|
+
) : (
|
|
34
|
+
<Icon icon={LeftIcon} size="md" />
|
|
35
|
+
))}
|
|
36
|
+
<Text className="line-clamp-5 text-left text-f1-foreground">
|
|
37
|
+
{text}
|
|
38
|
+
</Text>
|
|
39
|
+
</Action>
|
|
40
|
+
</View>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const Action = ({
|
|
45
|
+
children,
|
|
46
|
+
action,
|
|
47
|
+
...props
|
|
48
|
+
}: {
|
|
49
|
+
className: string;
|
|
50
|
+
action: ActionType;
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
}) => {
|
|
53
|
+
const type = action.type;
|
|
54
|
+
switch (type) {
|
|
55
|
+
case "copy":
|
|
56
|
+
return (
|
|
57
|
+
<CopyAction {...action} {...props}>
|
|
58
|
+
{children}
|
|
59
|
+
</CopyAction>
|
|
60
|
+
);
|
|
61
|
+
case "generic":
|
|
62
|
+
return (
|
|
63
|
+
<GenericAction {...action} {...props}>
|
|
64
|
+
{children}
|
|
65
|
+
</GenericAction>
|
|
66
|
+
);
|
|
67
|
+
case "noop":
|
|
68
|
+
return <View {...props}>{children}</View>;
|
|
69
|
+
default: {
|
|
70
|
+
const _exhaustiveCheck: never = type;
|
|
71
|
+
return _exhaustiveCheck;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ReactNode, useEffect, useState } from "react";
|
|
2
|
+
import { cn } from "../../../../../lib/utils";
|
|
3
|
+
import { Icon } from "../../../../Icon";
|
|
4
|
+
import { CheckCircle, LayersFront } from "../../../../../icons/app";
|
|
5
|
+
import { Pressable, View } from "react-native";
|
|
6
|
+
import * as Clipboard from "expo-clipboard";
|
|
7
|
+
import { CopyActionType } from "..";
|
|
8
|
+
|
|
9
|
+
const COPIED_SHOWN_MS = 750;
|
|
10
|
+
|
|
11
|
+
export type CopyActionProps = {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
} & CopyActionType;
|
|
14
|
+
|
|
15
|
+
export const CopyAction = ({ text, children }: CopyActionProps) => {
|
|
16
|
+
const [copied, setCopied] = useState(false);
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (copied) {
|
|
20
|
+
const timer = setTimeout(() => setCopied(false), COPIED_SHOWN_MS);
|
|
21
|
+
|
|
22
|
+
return () => clearTimeout(timer);
|
|
23
|
+
}
|
|
24
|
+
}, [copied]);
|
|
25
|
+
|
|
26
|
+
const copyHandler = async () => {
|
|
27
|
+
try {
|
|
28
|
+
if (text) {
|
|
29
|
+
await Clipboard.setStringAsync(text);
|
|
30
|
+
setCopied(true);
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
void error;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return (
|
|
37
|
+
<Pressable
|
|
38
|
+
aria-label={copied ? "Copied!" : `Copy ${text}`}
|
|
39
|
+
className={cn(
|
|
40
|
+
"group flex flex-row justify-between gap-1.5 rounded p-1.5",
|
|
41
|
+
"transition-colors duration-300 active:bg-f1-background-secondary-hover",
|
|
42
|
+
copied ? "bg-f1-background-positive" : undefined,
|
|
43
|
+
)}
|
|
44
|
+
onPress={copyHandler}
|
|
45
|
+
>
|
|
46
|
+
<View className="flex flex-row items-center gap-1.5">{children}</View>
|
|
47
|
+
<View className="flex">
|
|
48
|
+
{!copied && (
|
|
49
|
+
<Icon
|
|
50
|
+
icon={LayersFront}
|
|
51
|
+
size="md"
|
|
52
|
+
aria-hidden={true}
|
|
53
|
+
className={cn(
|
|
54
|
+
"col-start-1 col-end-2 row-start-1 row-end-2 text-f1-icon-bold",
|
|
55
|
+
)}
|
|
56
|
+
/>
|
|
57
|
+
)}
|
|
58
|
+
{copied && (
|
|
59
|
+
<Icon
|
|
60
|
+
icon={CheckCircle}
|
|
61
|
+
size="md"
|
|
62
|
+
aria-hidden={true}
|
|
63
|
+
className={cn(
|
|
64
|
+
"col-start-1 col-end-2 row-start-1 row-end-2",
|
|
65
|
+
"text-f1-icon-positive",
|
|
66
|
+
)}
|
|
67
|
+
/>
|
|
68
|
+
)}
|
|
69
|
+
</View>
|
|
70
|
+
</Pressable>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { memo, ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../../../../lib/utils";
|
|
3
|
+
import { Icon } from "../../../../Icon";
|
|
4
|
+
import { ChevronRight } from "../../../../../icons/app";
|
|
5
|
+
import { Pressable, View } from "react-native";
|
|
6
|
+
import { GenericActionType } from "..";
|
|
7
|
+
|
|
8
|
+
export type GenericActionProps = {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
} & GenericActionType;
|
|
12
|
+
|
|
13
|
+
export const GenericAction = memo(
|
|
14
|
+
({ children, className, ...props }: GenericActionProps) => {
|
|
15
|
+
return (
|
|
16
|
+
<Pressable
|
|
17
|
+
onPress={props.handlePress}
|
|
18
|
+
{...props}
|
|
19
|
+
className={cn(
|
|
20
|
+
"text-inherit group flex items-center justify-between gap-1.5 rounded p-1.5 text-f1-foreground",
|
|
21
|
+
"no-underline hover:bg-f1-background-hover focus-visible:outline focus-visible:outline-2 focus-visible:outline-f1-border-selected-bold active:bg-f1-background-secondary-hover",
|
|
22
|
+
className,
|
|
23
|
+
)}
|
|
24
|
+
>
|
|
25
|
+
<View className="flex flex-row items-center gap-1.5">{children}</View>
|
|
26
|
+
<Icon
|
|
27
|
+
aria-hidden={true}
|
|
28
|
+
icon={ChevronRight}
|
|
29
|
+
size="md"
|
|
30
|
+
className="text-f1-foreground"
|
|
31
|
+
/>
|
|
32
|
+
</Pressable>
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
GenericAction.displayName = "GenericAction";
|