diff --git a/app/client/components/ui/checkbox.tsx b/app/client/components/ui/checkbox.tsx index 0904f5d8..ff587603 100644 --- a/app/client/components/ui/checkbox.tsx +++ b/app/client/components/ui/checkbox.tsx @@ -1,10 +1,13 @@ -import type * as React from "react"; +import * as React from "react"; import * as CheckboxPrimitive from "@radix-ui/react-checkbox"; import { CheckIcon } from "lucide-react"; +import { useWebHaptics } from "web-haptics/react"; import { cn } from "~/client/lib/utils"; function Checkbox({ className, ...props }: React.ComponentProps) { + const trigger = useWebHaptics().trigger; + return ( { + void trigger("nudge"); + props.onCheckedChange?.(checked); + }} {...props} > ) { + const trigger = useWebHaptics().trigger; + return ( { + void trigger("nudge"); + props.onCheckedChange?.(checked); + }} {...props} > ) { @@ -17,7 +18,14 @@ function TabsList({ className, ...props }: React.ComponentProps) { +function TabsTrigger({ className, onClick, ...props }: React.ComponentProps) { + const { trigger } = useWebHaptics(); + + const handleClick: React.MouseEventHandler = (event) => { + void trigger("nudge"); + onClick?.(event); + }; + return ( {props.children} diff --git a/bun.lock b/bun.lock index 40f66153..9ffb58f0 100644 --- a/bun.lock +++ b/bun.lock @@ -68,6 +68,7 @@ "sonner": "^2.0.7", "tailwind-merge": "^3.5.0", "tiny-typed-emitter": "^2.1.0", + "web-haptics": "^0.0.6", "yaml": "^2.8.2", }, "devDependencies": { @@ -1859,6 +1860,8 @@ "wait-for-expect": ["wait-for-expect@4.0.0", "", {}, "sha512-mcH2HYUUHhdFGHVJkgwkBxRihZO4VSuPyh6xhYHz7LEnYkcaLbTAEEsTpYiFw4UY45XdTZYYIaquuMucw9wWMw=="], + "web-haptics": ["web-haptics@0.0.6", "", { "peerDependencies": { "react": ">=18", "react-dom": ">=18", "svelte": ">=4", "vue": ">=3" }, "optionalPeers": ["react", "react-dom", "svelte", "vue"] }, "sha512-eCzcf1LDi20+Fr0x9V3OkX92k0gxEQXaHajmhXHitsnk6SxPeshv8TBtBRqxyst8HI1uf2FyFVE7QS3jo1gkrw=="], + "web-streams-polyfill": ["web-streams-polyfill@3.3.3", "", {}, "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw=="], "webidl-conversions": ["webidl-conversions@7.0.0", "", {}, "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="], diff --git a/package.json b/package.json index 6a28da95..3f001fcd 100644 --- a/package.json +++ b/package.json @@ -89,6 +89,7 @@ "sonner": "^2.0.7", "tailwind-merge": "^3.5.0", "tiny-typed-emitter": "^2.1.0", + "web-haptics": "^0.0.6", "yaml": "^2.8.2" }, "devDependencies": {