The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Add indeterminate state to `Checkbox`
Tim Wilson57e940377050
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page-client.tsxindex b97ec340d4..f73b60c518 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/applications/page-client.tsx@@ -261,6 +261,7 @@ export function ProgramPartnersApplicationsPageClient() {scroll: false,}),+ getRowId: (row) => row.id,onRowSelectionChange: (rows) => {console.log(rows);},diff --git a/packages/ui/src/checkbox.tsx b/packages/ui/src/checkbox.tsxindex 2b75296413..89121a3529 100644--- a/packages/ui/src/checkbox.tsx+++ b/packages/ui/src/checkbox.tsx@@ -1,25 +1,26 @@"use client";import * as CheckboxPrimitive from "@radix-ui/react-checkbox";-import { Check } from "lucide-react";-import * as React from "react";import { cn } from "@dub/utils";+import { forwardRef } from "react";+import { Check2, Minus } from "./icons";-const Checkbox = React.forwardRef<+const Checkbox = forwardRef<React.ElementRef<typeof CheckboxPrimitive.Root>,React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>>(({ className, ...props }, ref) => (<CheckboxPrimitive.Rootref={ref}className={cn(- "peer h-5 w-5 shrink-0 rounded-md border border-neutral-200 bg-white outline-none focus-visible:border-black disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-500",+ "peer h-5 w-5 shrink-0 rounded-md border border-neutral-200 bg-white outline-none focus-visible:border-black disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-500 data-[state=indeterminate]:bg-blue-500",className,)}{...props}>- <CheckboxPrimitive.Indicator className="flex items-center justify-center">- <Check className="h-3 w-3 text-white" />+ <CheckboxPrimitive.Indicator className="group/indicator flex items-center justify-center text-white">+ <Check2 className="size-3 group-data-[state=indeterminate]/indicator:hidden" />+ <Minus className="size-3 group-data-[state=checked]/indicator:hidden" /></CheckboxPrimitive.Indicator></CheckboxPrimitive.Root>));diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.tsindex 7886f54bc9..d0fa201d76 100644--- a/packages/ui/src/icons/nucleo/index.ts+++ b/packages/ui/src/icons/nucleo/index.ts@@ -147,6 +147,7 @@ export * from "./marketing-target";export * from "./menu3";export * from "./message-smile";export * from "./microphone-fill";+export * from "./minus";export * from "./mobile-phone";export * from "./money-bill";export * from "./money-bill2";diff --git a/packages/ui/src/icons/nucleo/minus.tsx b/packages/ui/src/icons/nucleo/minus.tsxnew file mode 100644index 0000000000..68750b415d--- /dev/null+++ b/packages/ui/src/icons/nucleo/minus.tsx@@ -0,0 +1,27 @@+import { SVGProps } from "react";++export function Minus(props: SVGProps<SVGSVGElement>) {+ return (+ <svg+ height="18"+ width="18"+ viewBox="0 0 18 18"+ xmlns="http://www.w3.org/2000/svg"+ {...props}+ >+ <g fill="currentColor">+ <line+ fill="none"+ stroke="currentColor"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="1.5"+ x1="3.25"+ x2="14.75"+ y1="9"+ y2="9"+ />+ </g>+ </svg>+ );+}diff --git a/packages/ui/src/table/table.tsx b/packages/ui/src/table/table.tsxindex 9e01a3e3d9..d0481b9387 100644--- a/packages/ui/src/table/table.tsx+++ b/packages/ui/src/table/table.tsx@@ -105,7 +105,7 @@ export function useTable<T extends any>(header: ({ table }: { table: TableType<T> }) => (<div className="flex size-full items-center justify-center"><Checkbox- className="border-border-default size-4 rounded data-[state=checked]:bg-black"+ className="border-border-default size-4 rounded data-[state=checked]:bg-black data-[state=indeterminate]:bg-black"checked={table.getIsAllRowsSelected()? true@@ -121,7 +121,7 @@ export function useTable<T extends any>(cell: ({ row }: { row: Row<T> }) => (<div className="flex size-full items-center justify-center"><Checkbox- className="border-border-default size-4 rounded data-[state=checked]:bg-black"+ className="border-border-default size-4 rounded data-[state=checked]:bg-black data-[state=indeterminate]:bg-black"checked={row.getIsSelected()}onCheckedChange={row.getToggleSelectedHandler()}title="Select"