@getcoherent/core 0.3.10 → 0.3.11

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2646,6 +2646,7 @@ export { Switch }
2646
2646
  }
2647
2647
  generateButton() {
2648
2648
  return `import * as React from 'react'
2649
+ import { Slot } from '@radix-ui/react-slot'
2649
2650
  import { cn } from '@/lib/utils'
2650
2651
  import { cva, type VariantProps } from 'class-variance-authority'
2651
2652
 
@@ -2677,16 +2678,21 @@ const buttonVariants = cva(
2677
2678
 
2678
2679
  export interface ButtonProps
2679
2680
  extends React.ButtonHTMLAttributes<HTMLButtonElement>,
2680
- VariantProps<typeof buttonVariants> {}
2681
+ VariantProps<typeof buttonVariants> {
2682
+ asChild?: boolean
2683
+ }
2681
2684
 
2682
2685
  const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
2683
- ({ className, variant, size, ...props }, ref) => (
2684
- <button
2685
- ref={ref}
2686
- className={cn(buttonVariants({ variant, size }), className)}
2687
- {...props}
2688
- />
2689
- )
2686
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
2687
+ const Comp = asChild ? Slot : 'button'
2688
+ return (
2689
+ <Comp
2690
+ ref={ref}
2691
+ className={cn(buttonVariants({ variant, size }), className)}
2692
+ {...props}
2693
+ />
2694
+ )
2695
+ }
2690
2696
  )
2691
2697
  Button.displayName = 'Button'
2692
2698
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.10",
6
+ "version": "0.3.11",
7
7
  "description": "Core design system engine for Coherent",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",