Skip to content

Commit 15b8da6

Browse files
committed
improvements to @ui/primitives/Switch
1 parent c0c6634 commit 15b8da6

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

pkg/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hanzo/ui",
3-
"version": "4.2.1",
3+
"version": "4.2.4",
44
"description": "Library that contains shared UI primitives, support for a common design system, and other boilerplate support.",
55
"publishConfig": {
66
"registry": "https://registry.npmjs.org/",

pkg/ui/primitives/switch.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,27 @@ import { cn } from '../util'
66

77
const Switch = React.forwardRef<
88
React.ElementRef<typeof SwitchPrimitives.Root>,
9-
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
10-
>(({ className, ...props }, ref) => (
9+
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> &
10+
{ thumbClx?: string }
11+
>(({ className, thumbClx='', ...props }, ref) => (
1112
<SwitchPrimitives.Root
1213
className={cn(
1314
'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full ' +
1415
'border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none ' +
1516
'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ' +
1617
'focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 ' +
17-
'data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',
18+
'data-[state=checked]:bg-primary data-[state=unchecked]:bg-level-3',
1819
className
1920
)}
2021
{...props}
2122
ref={ref}
2223
>
2324
<SwitchPrimitives.Thumb
24-
className={
25+
className={cn(
2526
'pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ' +
26-
'ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0'
27-
}
27+
'ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0',
28+
thumbClx
29+
)}
2830
/>
2931
</SwitchPrimitives.Root>
3032
))

0 commit comments

Comments
 (0)