From 7c884e63691462f882d787605939b6c8dede37d3 Mon Sep 17 00:00:00 2001 From: JSONbored <49853598+JSONbored@users.noreply.github.com> Date: Fri, 10 Jul 2026 22:47:41 -0700 Subject: [PATCH 1/4] feat(ui): extract shared design-system package from gittensory-ui (#4966) Moves the 46 shadcn-style component primitives, design tokens, cn() utility, and use-mobile hook out of apps/gittensory-ui into a new @jsonbored/gittensory-ui-kit workspace package, so gittensory-ui and gittensory-miner-ui can share one real design system instead of two. gittensory-ui's own copies become thin re-export shims (matching the existing gittensory-engine parity pattern) so none of the 84+ consumer files needed changes. styles.css now imports the shared theme and scans the new package's source for Tailwind class usage in addition to its own. Verified pixel-identical rendering and working Radix-based interactions (command palette) via local preview; full typecheck/build/lint/test suite green. --- apps/gittensory-ui/package.json | 1 + .../src/components/ui/accordion.tsx | 52 +- .../src/components/ui/alert-dialog.tsx | 116 +-- .../gittensory-ui/src/components/ui/alert.tsx | 50 +- .../src/components/ui/aspect-ratio.tsx | 6 +- .../src/components/ui/avatar.tsx | 48 +- .../gittensory-ui/src/components/ui/badge.tsx | 32 +- .../src/components/ui/breadcrumb.tsx | 102 +-- .../src/components/ui/button.tsx | 51 +- .../src/components/ui/calendar.tsx | 178 +---- apps/gittensory-ui/src/components/ui/card.tsx | 56 +- .../src/components/ui/carousel.tsx | 241 +----- .../gittensory-ui/src/components/ui/chart.tsx | 332 +------- .../src/components/ui/checkbox.tsx | 27 +- .../src/components/ui/collapsible.tsx | 12 +- .../src/components/ui/command.tsx | 144 +--- .../src/components/ui/context-menu.tsx | 188 +---- .../src/components/ui/dialog.tsx | 105 +-- .../src/components/ui/drawer.tsx | 99 +-- .../src/components/ui/dropdown-menu.tsx | 189 +---- apps/gittensory-ui/src/components/ui/form.tsx | 172 +--- .../src/components/ui/hover-card.tsx | 28 +- .../src/components/ui/input-otp.tsx | 70 +- .../gittensory-ui/src/components/ui/input.tsx | 23 +- .../gittensory-ui/src/components/ui/label.tsx | 22 +- .../src/components/ui/menubar.tsx | 230 +----- .../src/components/ui/navigation-menu.tsx | 121 +-- .../src/components/ui/pagination.tsx | 99 +-- .../src/components/ui/popover.tsx | 32 +- .../src/components/ui/progress.tsx | 26 +- .../src/components/ui/radio-group.tsx | 37 +- .../src/components/ui/resizable.tsx | 38 +- .../src/components/ui/scroll-area.tsx | 45 +- .../src/components/ui/select.tsx | 153 +--- .../src/components/ui/separator.tsx | 25 +- .../gittensory-ui/src/components/ui/sheet.tsx | 123 +-- .../src/components/ui/sidebar.tsx | 745 +----------------- .../src/components/ui/skeleton.tsx | 8 +- .../src/components/ui/slider.tsx | 24 +- .../src/components/ui/sonner.tsx | 24 +- .../src/components/ui/switch.tsx | 28 +- .../gittensory-ui/src/components/ui/table.tsx | 95 +-- apps/gittensory-ui/src/components/ui/tabs.tsx | 54 +- .../src/components/ui/textarea.tsx | 22 +- .../src/components/ui/toggle-group.tsx | 58 +- .../src/components/ui/toggle.tsx | 43 +- .../src/components/ui/tooltip.tsx | 33 +- apps/gittensory-ui/src/hooks/use-mobile.tsx | 20 +- apps/gittensory-ui/src/lib/utils.ts | 22 +- apps/gittensory-ui/src/styles.css | 290 +------ package-lock.json | 82 ++ packages/gittensory-ui-kit/LICENSE | 661 ++++++++++++++++ packages/gittensory-ui-kit/package.json | 104 +++ .../src/components/accordion.tsx | 51 ++ .../src/components/alert-dialog.tsx | 115 +++ .../src/components/alert.tsx | 49 ++ .../src/components/aspect-ratio.tsx | 5 + .../src/components/avatar.tsx | 47 ++ .../src/components/badge.tsx | 31 + .../src/components/breadcrumb.tsx | 101 +++ .../src/components/button.tsx | 50 ++ .../src/components/calendar.tsx | 177 +++++ .../gittensory-ui-kit/src/components/card.tsx | 55 ++ .../src/components/carousel.tsx | 240 ++++++ .../src/components/chart.tsx | 331 ++++++++ .../src/components/checkbox.tsx | 26 + .../src/components/collapsible.tsx | 11 + .../src/components/command.tsx | 143 ++++ .../src/components/context-menu.tsx | 187 +++++ .../src/components/dialog.tsx | 104 +++ .../src/components/drawer.tsx | 98 +++ .../src/components/dropdown-menu.tsx | 188 +++++ .../gittensory-ui-kit/src/components/form.tsx | 171 ++++ .../src/components/hover-card.tsx | 27 + .../src/components/input-otp.tsx | 69 ++ .../src/components/input.tsx | 22 + .../src/components/label.tsx | 21 + .../src/components/menubar.tsx | 229 ++++++ .../src/components/navigation-menu.tsx | 120 +++ .../src/components/pagination.tsx | 98 +++ .../src/components/popover.tsx | 31 + .../src/components/progress.tsx | 25 + .../src/components/radio-group.tsx | 36 + .../src/components/resizable.tsx | 37 + .../src/components/scroll-area.tsx | 44 ++ .../src/components/select.tsx | 152 ++++ .../src/components/separator.tsx | 24 + .../src/components/sheet.tsx | 122 +++ .../src/components/sidebar.tsx | 744 +++++++++++++++++ .../src/components/skeleton.tsx | 7 + .../src/components/slider.tsx | 23 + .../src/components/sonner.tsx | 23 + .../src/components/switch.tsx | 27 + .../src/components/table.tsx | 94 +++ .../gittensory-ui-kit/src/components/tabs.tsx | 53 ++ .../src/components/textarea.tsx | 21 + .../src/components/toggle-group.tsx | 57 ++ .../src/components/toggle.tsx | 42 + .../src/components/tooltip.tsx | 32 + .../src/hooks/use-mobile.tsx | 19 + packages/gittensory-ui-kit/src/theme.css | 292 +++++++ packages/gittensory-ui-kit/src/utils.ts | 21 + packages/gittensory-ui-kit/tsconfig.json | 21 + 103 files changed, 5617 insertions(+), 4682 deletions(-) create mode 100644 packages/gittensory-ui-kit/LICENSE create mode 100644 packages/gittensory-ui-kit/package.json create mode 100644 packages/gittensory-ui-kit/src/components/accordion.tsx create mode 100644 packages/gittensory-ui-kit/src/components/alert-dialog.tsx create mode 100644 packages/gittensory-ui-kit/src/components/alert.tsx create mode 100644 packages/gittensory-ui-kit/src/components/aspect-ratio.tsx create mode 100644 packages/gittensory-ui-kit/src/components/avatar.tsx create mode 100644 packages/gittensory-ui-kit/src/components/badge.tsx create mode 100644 packages/gittensory-ui-kit/src/components/breadcrumb.tsx create mode 100644 packages/gittensory-ui-kit/src/components/button.tsx create mode 100644 packages/gittensory-ui-kit/src/components/calendar.tsx create mode 100644 packages/gittensory-ui-kit/src/components/card.tsx create mode 100644 packages/gittensory-ui-kit/src/components/carousel.tsx create mode 100644 packages/gittensory-ui-kit/src/components/chart.tsx create mode 100644 packages/gittensory-ui-kit/src/components/checkbox.tsx create mode 100644 packages/gittensory-ui-kit/src/components/collapsible.tsx create mode 100644 packages/gittensory-ui-kit/src/components/command.tsx create mode 100644 packages/gittensory-ui-kit/src/components/context-menu.tsx create mode 100644 packages/gittensory-ui-kit/src/components/dialog.tsx create mode 100644 packages/gittensory-ui-kit/src/components/drawer.tsx create mode 100644 packages/gittensory-ui-kit/src/components/dropdown-menu.tsx create mode 100644 packages/gittensory-ui-kit/src/components/form.tsx create mode 100644 packages/gittensory-ui-kit/src/components/hover-card.tsx create mode 100644 packages/gittensory-ui-kit/src/components/input-otp.tsx create mode 100644 packages/gittensory-ui-kit/src/components/input.tsx create mode 100644 packages/gittensory-ui-kit/src/components/label.tsx create mode 100644 packages/gittensory-ui-kit/src/components/menubar.tsx create mode 100644 packages/gittensory-ui-kit/src/components/navigation-menu.tsx create mode 100644 packages/gittensory-ui-kit/src/components/pagination.tsx create mode 100644 packages/gittensory-ui-kit/src/components/popover.tsx create mode 100644 packages/gittensory-ui-kit/src/components/progress.tsx create mode 100644 packages/gittensory-ui-kit/src/components/radio-group.tsx create mode 100644 packages/gittensory-ui-kit/src/components/resizable.tsx create mode 100644 packages/gittensory-ui-kit/src/components/scroll-area.tsx create mode 100644 packages/gittensory-ui-kit/src/components/select.tsx create mode 100644 packages/gittensory-ui-kit/src/components/separator.tsx create mode 100644 packages/gittensory-ui-kit/src/components/sheet.tsx create mode 100644 packages/gittensory-ui-kit/src/components/sidebar.tsx create mode 100644 packages/gittensory-ui-kit/src/components/skeleton.tsx create mode 100644 packages/gittensory-ui-kit/src/components/slider.tsx create mode 100644 packages/gittensory-ui-kit/src/components/sonner.tsx create mode 100644 packages/gittensory-ui-kit/src/components/switch.tsx create mode 100644 packages/gittensory-ui-kit/src/components/table.tsx create mode 100644 packages/gittensory-ui-kit/src/components/tabs.tsx create mode 100644 packages/gittensory-ui-kit/src/components/textarea.tsx create mode 100644 packages/gittensory-ui-kit/src/components/toggle-group.tsx create mode 100644 packages/gittensory-ui-kit/src/components/toggle.tsx create mode 100644 packages/gittensory-ui-kit/src/components/tooltip.tsx create mode 100644 packages/gittensory-ui-kit/src/hooks/use-mobile.tsx create mode 100644 packages/gittensory-ui-kit/src/theme.css create mode 100644 packages/gittensory-ui-kit/src/utils.ts create mode 100644 packages/gittensory-ui-kit/tsconfig.json diff --git a/apps/gittensory-ui/package.json b/apps/gittensory-ui/package.json index d8434b879b..480be129ee 100644 --- a/apps/gittensory-ui/package.json +++ b/apps/gittensory-ui/package.json @@ -20,6 +20,7 @@ "format": "prettier --write ." }, "dependencies": { + "@jsonbored/gittensory-ui-kit": "^0.1.0", "@radix-ui/react-accordion": "^1.2.15", "@radix-ui/react-alert-dialog": "^1.1.18", "@radix-ui/react-aspect-ratio": "^1.1.11", diff --git a/apps/gittensory-ui/src/components/ui/accordion.tsx b/apps/gittensory-ui/src/components/ui/accordion.tsx index 16ee900456..a054f3b1d6 100644 --- a/apps/gittensory-ui/src/components/ui/accordion.tsx +++ b/apps/gittensory-ui/src/components/ui/accordion.tsx @@ -1,51 +1 @@ -import * as React from "react"; -import * as AccordionPrimitive from "@radix-ui/react-accordion"; -import { ChevronDown } from "lucide-react"; - -import { cn } from "@/lib/utils"; - -const Accordion = AccordionPrimitive.Root; - -const AccordionItem = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -AccordionItem.displayName = "AccordionItem"; - -const AccordionTrigger = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - svg]:rotate-180", - className, - )} - {...props} - > - {children} - - - -)); -AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName; - -const AccordionContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - -
{children}
-
-)); -AccordionContent.displayName = AccordionPrimitive.Content.displayName; - -export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }; +export * from "@jsonbored/gittensory-ui-kit/components/accordion"; diff --git a/apps/gittensory-ui/src/components/ui/alert-dialog.tsx b/apps/gittensory-ui/src/components/ui/alert-dialog.tsx index 072a66562e..7122b9d44d 100644 --- a/apps/gittensory-ui/src/components/ui/alert-dialog.tsx +++ b/apps/gittensory-ui/src/components/ui/alert-dialog.tsx @@ -1,115 +1 @@ -import * as React from "react"; -import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"; - -import { cn } from "@/lib/utils"; -import { buttonVariants } from "@/components/ui/button"; - -const AlertDialog = AlertDialogPrimitive.Root; - -const AlertDialogTrigger = AlertDialogPrimitive.Trigger; - -const AlertDialogPortal = AlertDialogPrimitive.Portal; - -const AlertDialogOverlay = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName; - -const AlertDialogContent = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - - - - -)); -AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName; - -const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes) => ( -
-); -AlertDialogHeader.displayName = "AlertDialogHeader"; - -const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes) => ( -
-); -AlertDialogFooter.displayName = "AlertDialogFooter"; - -const AlertDialogTitle = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName; - -const AlertDialogDescription = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName; - -const AlertDialogAction = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName; - -const AlertDialogCancel = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName; - -export { - AlertDialog, - AlertDialogPortal, - AlertDialogOverlay, - AlertDialogTrigger, - AlertDialogContent, - AlertDialogHeader, - AlertDialogFooter, - AlertDialogTitle, - AlertDialogDescription, - AlertDialogAction, - AlertDialogCancel, -}; +export * from "@jsonbored/gittensory-ui-kit/components/alert-dialog"; diff --git a/apps/gittensory-ui/src/components/ui/alert.tsx b/apps/gittensory-ui/src/components/ui/alert.tsx index cd0a062770..41365f78bf 100644 --- a/apps/gittensory-ui/src/components/ui/alert.tsx +++ b/apps/gittensory-ui/src/components/ui/alert.tsx @@ -1,49 +1 @@ -import * as React from "react"; -import { cva, type VariantProps } from "class-variance-authority"; - -import { cn } from "@/lib/utils"; - -const alertVariants = cva( - "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7", - { - variants: { - variant: { - default: "bg-background text-foreground", - destructive: - "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive", - }, - }, - defaultVariants: { - variant: "default", - }, - }, -); - -const Alert = React.forwardRef< - HTMLDivElement, - React.HTMLAttributes & VariantProps ->(({ className, variant, ...props }, ref) => ( -
-)); -Alert.displayName = "Alert"; - -const AlertTitle = React.forwardRef>( - ({ className, ...props }, ref) => ( -
- ), -); -AlertTitle.displayName = "AlertTitle"; - -const AlertDescription = React.forwardRef< - HTMLParagraphElement, - React.HTMLAttributes ->(({ className, ...props }, ref) => ( -
-)); -AlertDescription.displayName = "AlertDescription"; - -export { Alert, AlertTitle, AlertDescription }; +export * from "@jsonbored/gittensory-ui-kit/components/alert"; diff --git a/apps/gittensory-ui/src/components/ui/aspect-ratio.tsx b/apps/gittensory-ui/src/components/ui/aspect-ratio.tsx index c9e6f4bf9e..0be69c2af4 100644 --- a/apps/gittensory-ui/src/components/ui/aspect-ratio.tsx +++ b/apps/gittensory-ui/src/components/ui/aspect-ratio.tsx @@ -1,5 +1 @@ -import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"; - -const AspectRatio = AspectRatioPrimitive.Root; - -export { AspectRatio }; +export * from "@jsonbored/gittensory-ui-kit/components/aspect-ratio"; diff --git a/apps/gittensory-ui/src/components/ui/avatar.tsx b/apps/gittensory-ui/src/components/ui/avatar.tsx index 7904926b9d..c587c79431 100644 --- a/apps/gittensory-ui/src/components/ui/avatar.tsx +++ b/apps/gittensory-ui/src/components/ui/avatar.tsx @@ -1,47 +1 @@ -"use client"; - -import * as React from "react"; -import * as AvatarPrimitive from "@radix-ui/react-avatar"; - -import { cn } from "@/lib/utils"; - -const Avatar = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -Avatar.displayName = AvatarPrimitive.Root.displayName; - -const AvatarImage = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -AvatarImage.displayName = AvatarPrimitive.Image.displayName; - -const AvatarFallback = React.forwardRef< - React.ElementRef, - React.ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); -AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName; - -export { Avatar, AvatarImage, AvatarFallback }; +export * from "@jsonbored/gittensory-ui-kit/components/avatar"; diff --git a/apps/gittensory-ui/src/components/ui/badge.tsx b/apps/gittensory-ui/src/components/ui/badge.tsx index da8a522c48..5112009415 100644 --- a/apps/gittensory-ui/src/components/ui/badge.tsx +++ b/apps/gittensory-ui/src/components/ui/badge.tsx @@ -1,31 +1 @@ -import * as React from "react"; -import { cva, type VariantProps } from "class-variance-authority"; - -import { cn } from "@/lib/utils"; - -const badgeVariants = cva( - "inline-flex items-center rounded-token border-hairline px-2.5 py-0.5 text-token-2xs font-semibold uppercase tracking-wider font-mono transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", - { - variants: { - variant: { - default: "border-transparent bg-primary text-primary-foreground hover:brightness-110", - secondary: "border-transparent bg-muted text-foreground hover:bg-muted/70", - destructive: - "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/90", - outline: "text-foreground bg-transparent", - }, - }, - defaultVariants: { - variant: "default", - }, - }, -); - -export interface BadgeProps - extends React.HTMLAttributes, VariantProps {} - -function Badge({ className, variant, ...props }: BadgeProps) { - return
; -} - -export { Badge, badgeVariants }; +export * from "@jsonbored/gittensory-ui-kit/components/badge"; diff --git a/apps/gittensory-ui/src/components/ui/breadcrumb.tsx b/apps/gittensory-ui/src/components/ui/breadcrumb.tsx index 94eb6291a6..47d551cb3e 100644 --- a/apps/gittensory-ui/src/components/ui/breadcrumb.tsx +++ b/apps/gittensory-ui/src/components/ui/breadcrumb.tsx @@ -1,101 +1 @@ -import * as React from "react"; -import { Slot } from "@radix-ui/react-slot"; -import { ChevronRight, MoreHorizontal } from "lucide-react"; - -import { cn } from "@/lib/utils"; - -const Breadcrumb = React.forwardRef< - HTMLElement, - React.ComponentPropsWithoutRef<"nav"> & { - separator?: React.ReactNode; - } ->(({ ...props }, ref) =>