@clasing/ui 2.1.1 → 2.2.0

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.
@@ -1,13 +1,20 @@
1
1
  import { type VariantProps } from 'class-variance-authority';
2
2
  import React from 'react';
3
- export interface IButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonStyles> {
4
- asChild?: boolean;
3
+ interface ButtonBaseProps extends VariantProps<typeof buttonStyles> {
5
4
  iconOnly?: boolean;
6
5
  isLoading?: boolean;
7
6
  isActive?: boolean;
8
7
  tooltip?: React.ReactNode;
9
8
  tooltipPlacement?: 'top' | 'bottom' | 'left' | 'right';
10
9
  }
10
+ interface ButtonAsChildProps extends ButtonBaseProps, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
11
+ asChild: true;
12
+ children: React.ReactElement;
13
+ }
14
+ interface ButtonDefaultProps extends ButtonBaseProps, React.ButtonHTMLAttributes<HTMLButtonElement> {
15
+ asChild?: false;
16
+ }
17
+ export type IButtonProps = ButtonAsChildProps | ButtonDefaultProps;
11
18
  declare const buttonStyles: (props?: ({
12
19
  variant?: "link" | "primary" | "secondary" | "inverse" | "outline" | "ghost" | "destructive" | null | undefined;
13
20
  size?: "xl" | "lg" | "md" | "sm" | "xs" | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clasing/ui",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.js",
6
6
  "module": "./dist/index.es.js",