@hanzo/ui 4.2.1 → 4.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/primitives/switch.tsx +8 -6
package/package.json
CHANGED
package/primitives/switch.tsx
CHANGED
|
@@ -6,25 +6,27 @@ import { cn } from '../util'
|
|
|
6
6
|
|
|
7
7
|
const Switch = React.forwardRef<
|
|
8
8
|
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
9
|
-
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
10
|
-
|
|
9
|
+
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> &
|
|
10
|
+
{ thumbClx?: string }
|
|
11
|
+
>(({ className, thumbClx='', ...props }, ref) => (
|
|
11
12
|
<SwitchPrimitives.Root
|
|
12
13
|
className={cn(
|
|
13
14
|
'peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full ' +
|
|
14
15
|
'border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none ' +
|
|
15
16
|
'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ' +
|
|
16
17
|
'focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 ' +
|
|
17
|
-
'data-[state=checked]:bg-primary data-[state=unchecked]:bg-
|
|
18
|
+
'data-[state=checked]:bg-primary data-[state=unchecked]:bg-level-2',
|
|
18
19
|
className
|
|
19
20
|
)}
|
|
20
21
|
{...props}
|
|
21
22
|
ref={ref}
|
|
22
23
|
>
|
|
23
24
|
<SwitchPrimitives.Thumb
|
|
24
|
-
className={
|
|
25
|
+
className={cn(
|
|
25
26
|
'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
|
+
)}
|
|
28
30
|
/>
|
|
29
31
|
</SwitchPrimitives.Root>
|
|
30
32
|
))
|