diff --git a/README.md b/README.md index de3999c..2f59a1a 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,4 @@ https://www.npmjs.com/package/@risc0/ui | Statements | Branches | Functions | Lines | | --------------------------- | ----------------------- | ------------------------- | ----------------- | -| ![Statements](https://img.shields.io/badge/statements-37.6%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-70.83%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-51.42%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-37.6%25-red.svg?style=flat) | +| ![Statements](https://img.shields.io/badge/statements-40.64%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-72.85%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-54.54%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-40.64%25-red.svg?style=flat) | diff --git a/alert-dialog.tsx b/alert-dialog.tsx deleted file mode 100644 index 99c343e..0000000 --- a/alert-dialog.tsx +++ /dev/null @@ -1,104 +0,0 @@ -"use client"; - -import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"; -import { buttonVariants } from "button"; -import { cn } from "cn"; -import { type ComponentPropsWithoutRef, type ElementRef, type HTMLAttributes, forwardRef } from "react"; - -const AlertDialogOverlay = forwardRef< - ElementRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -const AlertDialogContent = forwardRef< - ElementRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - - - - -)); - -const AlertDialogHeader = ({ className, ...props }: HTMLAttributes) => ( -
-); - -const AlertDialogFooter = ({ className, ...props }: HTMLAttributes) => ( -
-); - -const AlertDialogTitle = forwardRef< - ElementRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -const AlertDialogDescription = forwardRef< - ElementRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -const AlertDialogAction = forwardRef< - ElementRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -const AlertDialogCancel = forwardRef< - ElementRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -const AlertDialog = AlertDialogPrimitive.Root; -const AlertDialogTrigger = AlertDialogPrimitive.Trigger; -const AlertDialogPortal = AlertDialogPrimitive.Portal; - -AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName; -AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName; -AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName; -AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName; -AlertDialogHeader.displayName = "AlertDialogHeader"; -AlertDialogFooter.displayName = "AlertDialogFooter"; -AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName; -AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName; - -export { - AlertDialog, - AlertDialogPortal, - AlertDialogOverlay, - AlertDialogTrigger, - AlertDialogContent, - AlertDialogHeader, - AlertDialogFooter, - AlertDialogTitle, - AlertDialogDescription, - AlertDialogAction, - AlertDialogCancel, -}; diff --git a/alert.test.tsx b/alert.test.tsx index cfaf381..5bc46b3 100644 --- a/alert.test.tsx +++ b/alert.test.tsx @@ -5,15 +5,13 @@ describe("Alert", () => { test("returns default class names when no variant is provided", () => { render(); const alertElement = screen.getByRole("alert"); - expect(alertElement.className).toContain("relative w-full rounded-lg border px-4 py-3 text-sm"); - expect(alertElement.className).toContain("bg-background text-foreground"); + expect(alertElement.className).toContain("relative w-full rounded-lg border bg-background px-4 py-3 text-foreground text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:text-foreground [&>svg~*]:pl-7"); }); test("returns correct class names when destructive variant is provided", () => { render(); const alertElement = screen.getByRole("alert"); - expect(alertElement.className).toContain("relative w-full rounded-lg border px-4 py-3 text-sm"); - expect(alertElement.className).toContain("border-destructive/50 text-destructive dark:border-destructive"); + expect(alertElement.className).toContain("relative w-full rounded-lg border bg-background px-4 py-3 text-foreground text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg~*]:pl-7 border-destructive/50 dark:border-destructive [&>svg]:text-destructive"); }); }); @@ -27,7 +25,7 @@ describe("AlertTitle", () => { test("has correct default class names", () => { render(Test Title); const titleElement = screen.getByText("Test Title"); - expect(titleElement.className).toContain("mb-1 font-medium leading-none"); + expect(titleElement.className).toContain("mb-1 font-bold leading-none"); }); test("properly forwards classnames", () => { diff --git a/alert.tsx b/alert.tsx index fff8aee..29b396c 100644 --- a/alert.tsx +++ b/alert.tsx @@ -3,12 +3,12 @@ import { type HTMLAttributes, forwardRef } from "react"; import { cn } from "./cn"; 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]:text-foreground [&>svg~*]:pl-7", + "relative w-full rounded-lg border bg-background px-4 py-3 text-foreground text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-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", + default: "", + destructive: "border-destructive/50 dark:border-destructive [&>svg]:text-destructive", }, }, defaultVariants: { @@ -24,9 +24,7 @@ const Alert = forwardRef & Varian ); const AlertTitle = forwardRef>( - ({ className, ...rest }, ref) => ( -

- ), + ({ className, ...rest }, ref) =>

, ); const AlertDescription = forwardRef>( diff --git a/badge.tsx b/badge.tsx index 3a896f2..0a48fa6 100644 --- a/badge.tsx +++ b/badge.tsx @@ -3,7 +3,7 @@ import type { HTMLAttributes } from "react"; import { cn } from "./cn"; const badgeVariants = cva( - "inline-flex items-center rounded-md border px-2.5 py-0.5 font-semibold text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + "inline-flex items-center rounded-md border px-2.5 py-0.5 font-bold text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", { variants: { variant: { diff --git a/breadcrumb.tsx b/breadcrumb.tsx index b30d546..f949163 100644 --- a/breadcrumb.tsx +++ b/breadcrumb.tsx @@ -49,7 +49,7 @@ const BreadcrumbPage = forwardRef> role="link" aria-disabled="true" aria-current="page" - className={cn("font-normal text-foreground", className)} + className={cn("text-foreground", className)} {...props} /> diff --git a/button.tsx b/button.tsx index 57b669c..168fffc 100644 --- a/button.tsx +++ b/button.tsx @@ -5,7 +5,7 @@ import { type ButtonHTMLAttributes, type ReactElement, cloneElement, forwardRef import { cn } from "./cn"; const buttonVariants = cva( - "inline-flex items-center justify-center whitespace-nowrap rounded-md font-medium text-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", + "inline-flex items-center justify-center whitespace-nowrap rounded-md font-bold text-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", { variants: { variant: { diff --git a/card.test.tsx b/card.test.tsx index 5496788..903db25 100644 --- a/card.test.tsx +++ b/card.test.tsx @@ -39,14 +39,14 @@ describe("CardTitle", () => { test("applies correct classes", () => { render(); const cardTitleElement = screen.getByRole("heading"); - expect(cardTitleElement).toHaveClass("font-semibold leading-none"); + expect(cardTitleElement).toHaveClass("font-bold leading-none"); }); test("correctly applies additional classes", () => { const additionalClass = "additional-class"; render(); const cardTitleElement = screen.getByRole("heading"); - expect(cardTitleElement).toHaveClass("font-semibold leading-none", additionalClass); + expect(cardTitleElement).toHaveClass("font-bold leading-none", additionalClass); }); test("correctly applies additional props", () => { diff --git a/card.tsx b/card.tsx index 78adfb1..779a9f6 100644 --- a/card.tsx +++ b/card.tsx @@ -10,7 +10,7 @@ const CardHeader = forwardRef>(({ )); const CardTitle = forwardRef>( - ({ className, ...rest }, ref) =>

, + ({ className, ...rest }, ref) =>

, ); const CardDescription = forwardRef>( diff --git a/chart.tsx b/chart.tsx index 0d78c44..df26178 100644 --- a/chart.tsx +++ b/chart.tsx @@ -145,14 +145,14 @@ const ChartTooltipContent = forwardRef< : itemConfig?.label; if (labelFormatter) { - return
{labelFormatter(value, payload)}
; + return
{labelFormatter(value, payload)}
; } if (!value) { return null; } - return
{value}
; + return
{value}
; }, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]); if (!active || !payload?.length) { @@ -219,9 +219,7 @@ const ChartTooltipContent = forwardRef< {itemConfig?.label || item.name}

{item.value && ( - - {item.value.toLocaleString()} - + {item.value.toLocaleString()} )}
diff --git a/command.tsx b/command.tsx index 629f7db..0a485c8 100644 --- a/command.tsx +++ b/command.tsx @@ -26,7 +26,7 @@ const CommandDialog = ({ children, ...rest }: CommandDialogProps) => { return ( - + {children} @@ -76,7 +76,7 @@ const CommandGroup = forwardRef< )); diff --git a/drawer.tsx b/drawer.tsx index b0d3cb4..720d817 100644 --- a/drawer.tsx +++ b/drawer.tsx @@ -59,7 +59,7 @@ const DrawerTitle = forwardRef< >(({ className, ...props }, ref) => ( )); diff --git a/dropdown-menu.tsx b/dropdown-menu.tsx index 5a1421c..6db76ec 100644 --- a/dropdown-menu.tsx +++ b/dropdown-menu.tsx @@ -125,7 +125,7 @@ const DropdownMenuLabel = forwardRef< >(({ className, inset, ...rest }, ref) => ( )); diff --git a/form.tsx b/form.tsx index 1214303..5ba6066 100644 --- a/form.tsx +++ b/form.tsx @@ -133,7 +133,7 @@ const FormMessage = forwardRef {body} diff --git a/input.tsx b/input.tsx index 08b06a9..7f8d5d5 100644 --- a/input.tsx +++ b/input.tsx @@ -14,7 +14,7 @@ const Input = forwardRef( , ComponentPropsW ref={ref} data-testid="label" className={cn( - "font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", + "font-bold text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", className, )} {...rest} diff --git a/navigation-menu.tsx b/navigation-menu.tsx deleted file mode 100644 index 0326a1a..0000000 --- a/navigation-menu.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"; -import { cva } from "class-variance-authority"; -import { ChevronDownIcon } from "lucide-react"; -import { type ComponentPropsWithoutRef, type ElementRef, forwardRef } from "react"; -import { cn } from "./cn"; - -const NavigationMenu = forwardRef< - ElementRef, - ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - {children} - - -)); - -const NavigationMenuList = forwardRef< - ElementRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -const NavigationMenuItem = NavigationMenuPrimitive.Item; - -const navigationMenuTriggerStyle = cva( - "group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 font-medium text-sm transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50", -); - -const NavigationMenuTrigger = forwardRef< - ElementRef, - ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( - - {children}{" "} - -)); - -const NavigationMenuContent = forwardRef< - ElementRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -)); - -const NavigationMenuLink = NavigationMenuPrimitive.Link; - -const NavigationMenuViewport = forwardRef< - ElementRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( -
- -
-)); - -const NavigationMenuIndicator = forwardRef< - ElementRef, - ComponentPropsWithoutRef ->(({ className, ...props }, ref) => ( - -
- -)); - -NavigationMenuIndicator.displayName = NavigationMenuPrimitive.Indicator.displayName; -NavigationMenuViewport.displayName = NavigationMenuPrimitive.Viewport.displayName; -NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName; -NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName; -NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName; -NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName; - -export { - navigationMenuTriggerStyle, - NavigationMenu, - NavigationMenuList, - NavigationMenuItem, - NavigationMenuContent, - NavigationMenuTrigger, - NavigationMenuLink, - NavigationMenuIndicator, - NavigationMenuViewport, -}; diff --git a/package.json b/package.json index 13eb0d3..47cedc7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@risc0/ui", - "version": "0.0.131", + "version": "0.0.133", "private": false, "sideEffects": false, "type": "module", diff --git a/select.tsx b/select.tsx index 3bff90a..f07f2e5 100644 --- a/select.tsx +++ b/select.tsx @@ -108,7 +108,7 @@ const SelectLabel = forwardRef< ElementRef, ComponentPropsWithoutRef >(({ className, ...rest }, ref) => ( - + )); const SelectItem = forwardRef< diff --git a/styles/globals.css b/styles/globals.css index 86353c1..d7f4dd0 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -81,17 +81,17 @@ /* usually h2 */ .title-sm { - @apply text-2xl font-semibold; + @apply text-2xl font-bold; } /* usually h3 */ .subtitle { - @apply text-xl font-semibold; + @apply text-xl font-bold; } /* usually h4 */ .subtitle-sm { - @apply text-lg font-medium; + @apply text-lg; } /* Don't use h5/h6 */ diff --git a/table.tsx b/table.tsx index 3ea455c..e55a941 100644 --- a/table.tsx +++ b/table.tsx @@ -19,7 +19,7 @@ const TableBody = forwardRef>( ({ className, ...rest }, ref) => ( - tr]:last:border-b-0", className)} {...rest} /> + tr]:last:border-b-0", className)} {...rest} /> ), ); @@ -36,7 +36,7 @@ const TableHead = forwardRef[role=checkbox]]:translate-y-[2px]", + "h-10 px-2 text-left align-middle font-bold text-muted-foreground last:overflow-x-hidden [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className, )} {...rest} diff --git a/tabs.tsx b/tabs.tsx index e8abb04..86ffe2b 100644 --- a/tabs.tsx +++ b/tabs.tsx @@ -30,7 +30,7 @@ const TabsTrigger = forwardRef<