From 98b7ee3dbe8057a1c3b069c6f75c943c418a18e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adel=20Rodr=C3=ADguez?= Date: Sat, 14 Feb 2026 11:05:01 -0400 Subject: [PATCH] feat: add all rn-primitives components to native-ui package --- apps/mobile/src/app/index.tsx | 810 ++++++++++++++++-- .../mobile/src/shared/components/ui/alert.tsx | 98 --- .../src/shared/components/ui/avatar.tsx | 47 - .../src/shared/components/ui/toggle.tsx | 24 - bun.lock | 219 ++++- packages/native-ui/package.json | 45 +- .../native-ui/src/components/accordion.tsx | 144 ++++ .../native-ui/src/components/alert-dialog.tsx | 155 ++++ packages/native-ui/src/components/alert.tsx | 77 ++ .../native-ui/src/components/aspect-ratio.tsx | 3 + packages/native-ui/src/components/avatar.tsx | 38 + packages/native-ui/src/components/badge.tsx | 68 ++ packages/native-ui/src/components/button.tsx | 8 +- packages/native-ui/src/components/card.tsx | 45 + .../native-ui/src/components/checkbox.tsx | 49 ++ .../native-ui/src/components/collapsible.tsx | 7 + .../native-ui/src/components/context-menu.tsx | 303 +++++++ packages/native-ui/src/components/dialog.tsx | 144 ++++ .../src/components/dropdown-menu.tsx | 311 +++++++ .../native-ui/src/components/hover-card.tsx | 52 ++ packages/native-ui/src/components/icon.tsx | 30 +- packages/native-ui/src/components/input.tsx | 34 + packages/native-ui/src/components/label.tsx | 41 + .../src/components/large-title-header.tsx | 5 - .../components/large-title-header/index.ts | 2 - .../large-title-header.ios.tsx | 133 --- .../large-title-header/large-title-header.tsx | 219 ----- .../components/large-title-header/types.ts | 101 --- packages/native-ui/src/components/menubar.tsx | 377 ++++++++ .../components/native-only-animated-view.tsx | 22 + packages/native-ui/src/components/popover.tsx | 56 ++ .../native-ui/src/components/progress.tsx | 85 ++ .../native-ui/src/components/radio-group.tsx | 33 + packages/native-ui/src/components/select.tsx | 254 ++++++ .../native-ui/src/components/separator.tsx | 24 + .../native-ui/src/components/skeleton.tsx | 38 + packages/native-ui/src/components/switch.tsx | 37 + packages/native-ui/src/components/tabs.tsx | 69 ++ packages/native-ui/src/components/text.tsx | 19 +- .../native-ui/src/components/textarea.tsx | 42 + .../native-ui/src/components/toggle-group.tsx | 105 +++ packages/native-ui/src/components/toggle.tsx | 76 ++ packages/native-ui/src/components/tooltip.tsx | 65 ++ 43 files changed, 3804 insertions(+), 710 deletions(-) delete mode 100644 apps/mobile/src/shared/components/ui/alert.tsx delete mode 100644 apps/mobile/src/shared/components/ui/avatar.tsx delete mode 100644 apps/mobile/src/shared/components/ui/toggle.tsx create mode 100644 packages/native-ui/src/components/accordion.tsx create mode 100644 packages/native-ui/src/components/alert-dialog.tsx create mode 100644 packages/native-ui/src/components/alert.tsx create mode 100644 packages/native-ui/src/components/aspect-ratio.tsx create mode 100644 packages/native-ui/src/components/avatar.tsx create mode 100644 packages/native-ui/src/components/badge.tsx create mode 100644 packages/native-ui/src/components/card.tsx create mode 100644 packages/native-ui/src/components/checkbox.tsx create mode 100644 packages/native-ui/src/components/collapsible.tsx create mode 100644 packages/native-ui/src/components/context-menu.tsx create mode 100644 packages/native-ui/src/components/dialog.tsx create mode 100644 packages/native-ui/src/components/dropdown-menu.tsx create mode 100644 packages/native-ui/src/components/hover-card.tsx create mode 100644 packages/native-ui/src/components/input.tsx create mode 100644 packages/native-ui/src/components/label.tsx delete mode 100644 packages/native-ui/src/components/large-title-header.tsx delete mode 100644 packages/native-ui/src/components/large-title-header/index.ts delete mode 100644 packages/native-ui/src/components/large-title-header/large-title-header.ios.tsx delete mode 100644 packages/native-ui/src/components/large-title-header/large-title-header.tsx delete mode 100644 packages/native-ui/src/components/large-title-header/types.ts create mode 100644 packages/native-ui/src/components/menubar.tsx create mode 100644 packages/native-ui/src/components/native-only-animated-view.tsx create mode 100644 packages/native-ui/src/components/popover.tsx create mode 100644 packages/native-ui/src/components/progress.tsx create mode 100644 packages/native-ui/src/components/radio-group.tsx create mode 100644 packages/native-ui/src/components/select.tsx create mode 100644 packages/native-ui/src/components/separator.tsx create mode 100644 packages/native-ui/src/components/skeleton.tsx create mode 100644 packages/native-ui/src/components/switch.tsx create mode 100644 packages/native-ui/src/components/tabs.tsx create mode 100644 packages/native-ui/src/components/textarea.tsx create mode 100644 packages/native-ui/src/components/toggle-group.tsx create mode 100644 packages/native-ui/src/components/toggle.tsx create mode 100644 packages/native-ui/src/components/tooltip.tsx diff --git a/apps/mobile/src/app/index.tsx b/apps/mobile/src/app/index.tsx index 83a6d7ea..608831af 100644 --- a/apps/mobile/src/app/index.tsx +++ b/apps/mobile/src/app/index.tsx @@ -1,65 +1,307 @@ import Feather from "@expo/vector-icons/Feather" +import { + Accordion, + AccordionContent, + AccordionItem, + AccordionTrigger, +} from "@init/native-ui/components/accordion" import { ActivityIndicator } from "@init/native-ui/components/activity-indicator" +import { Alert, AlertDescription, AlertTitle } from "@init/native-ui/components/alert" +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "@init/native-ui/components/alert-dialog" +import { AspectRatio } from "@init/native-ui/components/aspect-ratio" +import { Avatar, AvatarFallback, AvatarImage } from "@init/native-ui/components/avatar" +import { Badge } from "@init/native-ui/components/badge" import { Button } from "@init/native-ui/components/button" -import { Icon } from "@init/native-ui/components/icon" import { - LargeTitleHeader, - type LargeTitleSearchBarRef, -} from "@init/native-ui/components/large-title-header" + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@init/native-ui/components/card" +import { Checkbox } from "@init/native-ui/components/checkbox" +import { + Collapsible, + CollapsibleContent, + CollapsibleTrigger, +} from "@init/native-ui/components/collapsible" +import { + ContextMenu, + ContextMenuCheckboxItem, + ContextMenuContent, + ContextMenuItem, + ContextMenuLabel, + ContextMenuRadioGroup, + ContextMenuRadioItem, + ContextMenuSeparator, + ContextMenuShortcut, + ContextMenuSub, + ContextMenuSubContent, + ContextMenuSubTrigger, + ContextMenuTrigger, +} from "@init/native-ui/components/context-menu" +import { + Dialog, + DialogClose, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@init/native-ui/components/dialog" +import { + DropdownMenu, + DropdownMenuCheckboxItem, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuLabel, + DropdownMenuRadioGroup, + DropdownMenuRadioItem, + DropdownMenuSeparator, + DropdownMenuShortcut, + DropdownMenuSub, + DropdownMenuSubContent, + DropdownMenuSubTrigger, + DropdownMenuTrigger, +} from "@init/native-ui/components/dropdown-menu" +import { + HoverCard, + HoverCardContent, + HoverCardTrigger, +} from "@init/native-ui/components/hover-card" +import { CheckIcon, Icon, XIcon } from "@init/native-ui/components/icon" +import { Input } from "@init/native-ui/components/input" +import { Label } from "@init/native-ui/components/label" +import { + Menubar, + MenubarCheckboxItem, + MenubarContent, + MenubarItem, + MenubarMenu, + MenubarRadioGroup, + MenubarRadioItem, + MenubarSeparator, + MenubarSub, + MenubarSubContent, + MenubarSubTrigger, + MenubarTrigger, +} from "@init/native-ui/components/menubar" +import { Popover, PopoverContent, PopoverTrigger } from "@init/native-ui/components/popover" +import { Progress } from "@init/native-ui/components/progress" +import { RadioGroup, RadioGroupItem } from "@init/native-ui/components/radio-group" +import { + NativeSelectScrollView, + Select, + SelectContent, + SelectGroup, + SelectItem, + SelectLabel, + SelectSeparator, + SelectTrigger, + SelectValue, + type Option, +} from "@init/native-ui/components/select" +import { Separator } from "@init/native-ui/components/separator" +import { Skeleton } from "@init/native-ui/components/skeleton" +import { Switch } from "@init/native-ui/components/switch" +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@init/native-ui/components/tabs" import { Text } from "@init/native-ui/components/text" -import { useRef, useState } from "react" -import { View } from "react-native" -import { useCSSVariable } from "uniwind" +import { Textarea } from "@init/native-ui/components/textarea" +import { Toggle, ToggleIcon } from "@init/native-ui/components/toggle" +import { + ToggleGroup, + ToggleGroupIcon, + ToggleGroupItem, +} from "@init/native-ui/components/toggle-group" +import { Tooltip, TooltipContent, TooltipTrigger } from "@init/native-ui/components/tooltip" +import { Stack } from "expo-router" +import { useState, type ReactNode } from "react" +import { ScrollView, View } from "react-native" +import { SafeAreaView } from "react-native-safe-area-context" import env from "#shared/env.ts" +type ShowcaseSectionProps = { + children: ReactNode + description?: string + query: string + searchTerms?: string[] + title: string +} + +function ShowcaseSection({ + children, + description, + query, + searchTerms, + title, +}: ShowcaseSectionProps) { + const normalizedQuery = query.trim().toLowerCase() + const normalizedTerms = [title, ...(searchTerms ?? [])].join(" ").toLowerCase() + + if (normalizedQuery.length > 0 && !normalizedTerms.includes(normalizedQuery)) { + return null + } + + return ( + + + {title} + {description ? {description} : null} + + {children} + + ) +} + export default function Screen() { - const backgroundValue = useCSSVariable("--color-background") - const background = typeof backgroundValue === "string" ? backgroundValue : undefined - const [isLoading, setIsLoading] = useState(false) - const [isSearchFocused, setIsSearchFocused] = useState(false) const [searchQuery, setSearchQuery] = useState("") - const searchBarRef = useRef(null) - const isSearching = isSearchFocused || searchQuery.length > 0 + const [isLoading, setIsLoading] = useState(false) + const [isChecked, setIsChecked] = useState(true) + const [isSwitchEnabled, setIsSwitchEnabled] = useState(false) + const [isCollapsedOpen, setIsCollapsedOpen] = useState(false) + const [progressValue, setProgressValue] = useState(42) + const [radioValue, setRadioValue] = useState("starter") + const [tabValue, setTabValue] = useState("preview") + const [togglePressed, setTogglePressed] = useState(false) + const [toggleGroupValue, setToggleGroupValue] = useState("bold") + const [selectValue, setSelectValue] = useState