@dimasbaguspm/versaur 0.0.2 → 0.0.4

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.
@@ -0,0 +1,11 @@
1
+ import { ButtonIconProps } from './types';
2
+ import { IconProps } from '../icon';
3
+ /**
4
+ * Maps ButtonIcon variant to Icon color prop
5
+ */
6
+ export declare function getIconColorFromVariant(variant?: ButtonIconProps['variant']): IconProps['color'];
7
+ export declare const buttonIconVariants: (props?: ({
8
+ variant?: "outline" | "primary" | "secondary" | "tertiary" | "ghost" | "neutral" | "success" | "info" | "warning" | "danger" | "primary-outline" | "primary-ghost" | "secondary-outline" | "secondary-ghost" | "tertiary-outline" | "tertiary-ghost" | "ghost-outline" | "neutral-outline" | "neutral-ghost" | "success-outline" | "success-ghost" | "info-outline" | "info-ghost" | "warning-outline" | "warning-ghost" | "danger-outline" | "danger-ghost" | "destructive" | null | undefined;
9
+ size?: "sm" | "md" | "lg" | "xs" | "xl" | null | undefined;
10
+ shape?: "circle" | "square" | "rounded" | null | undefined;
11
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
@@ -1,26 +1,29 @@
1
- import { ButtonHTMLAttributes, ReactNode } from 'react';
1
+ import { ButtonHTMLAttributes } from 'react';
2
+ import { IconProps } from '../icon/types';
2
3
  /**
3
4
  * ButtonIconProps defines the props for the ButtonIcon component
4
- * @property children - Icon content (ReactNode)
5
+ * @property as - Icon component to render inside the button (e.g., from lucide-react)
5
6
  * @property variant - Visual style variant based on Versaur color system
6
7
  * @property shape - Shape type of the button (rounded, square, circle)
7
8
  * @property size - Size of the button (sm, md, lg)
8
9
  * @property disabled - Whether the button is disabled
9
- * @property ariaLabel - Accessible label for screen readers (required for icon-only buttons)
10
+ * @property aria-label - Accessible label for screen readers (required for icon-only buttons)
11
+ *
12
+ * Inherits icon sizing and color props from IconProps for alignment
10
13
  */
11
- export interface ButtonIconProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
14
+ export interface ButtonIconProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'color'>, Pick<IconProps, 'as'> {
12
15
  /**
13
- * Icon content to display inside the button
14
- * Accepts any ReactNode (SVG icons, components, etc.)
16
+ * Icon component to render inside the button (e.g., from lucide-react)
15
17
  */
16
- children: ReactNode;
17
18
  /**
18
19
  * Visual style variant supporting Versaur color system
19
- * Core variants: primary (coral), secondary (sage), tertiary (mist), ghost (slate), neutral (light gray)
20
- * Semantic variants: success, info, warning, danger
21
- * Each variant supports outline and ghost forms for flexible design expression
22
20
  */
23
21
  variant?: 'primary' | 'primary-outline' | 'primary-ghost' | 'secondary' | 'secondary-outline' | 'secondary-ghost' | 'tertiary' | 'tertiary-outline' | 'tertiary-ghost' | 'ghost' | 'ghost-outline' | 'neutral' | 'neutral-outline' | 'neutral-ghost' | 'success' | 'success-outline' | 'success-ghost' | 'info' | 'info-outline' | 'info-ghost' | 'warning' | 'warning-outline' | 'warning-ghost' | 'danger' | 'danger-outline' | 'danger-ghost' | 'outline' | 'destructive';
22
+ /**
23
+ * Size of the button and icon
24
+ * xs: 24px, sm: 32px, md: 40px, lg: 48px, xl: 56px
25
+ */
26
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
24
27
  /**
25
28
  * Shape type of the button
26
29
  * rounded: Standard rounded corners (default)
@@ -28,13 +31,6 @@ export interface ButtonIconProps extends Omit<ButtonHTMLAttributes<HTMLButtonEle
28
31
  * circle: Circular shape
29
32
  */
30
33
  shape?: 'rounded' | 'square' | 'circle';
31
- /**
32
- * Size of the button
33
- * sm: 32px, compact for space-constrained interfaces
34
- * md: 40px, standard for most use cases
35
- * lg: 48px, prominent for primary actions
36
- */
37
- size?: 'sm' | 'md' | 'lg';
38
34
  /**
39
35
  * Whether the button is disabled
40
36
  * When true, the button becomes non-interactive and visually dimmed
@@ -2,7 +2,7 @@ import { default as React } from 'react';
2
2
  import { IconProps } from './types';
3
3
  /**
4
4
  * Icon component for Versaur UI
5
- * Wraps Lucide icons and enforces consistent size and color
6
- * @example <Icon color="primary" size="md"><LucideIcon /></Icon>
5
+ * Renders a single icon component (e.g., from lucide-react) with enforced size and color
6
+ * @example <Icon as={Circle} color="primary" size="md" />
7
7
  */
8
- export declare const Icon: React.FC<IconProps>;
8
+ export declare const Icon: React.ForwardRefExoticComponent<Omit<IconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  title: string;
3
- component: import('react').FC<import('./types').IconProps>;
3
+ component: import('react').ForwardRefExoticComponent<Omit<import('./types').IconProps, "ref"> & import('react').RefAttributes<SVGSVGElement>>;
4
4
  tags: string[];
5
5
  };
6
6
  export default _default;
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes, ReactNode } from 'react';
1
+ /**
2
2
  /**
3
3
  * IconProps defines the props for the Icon component
4
4
  * @property color - Color variant based on Versaur color system
@@ -6,8 +6,26 @@ import { HTMLAttributes, ReactNode } from 'react';
6
6
  * @property children - The icon element (usually from lucide-react)
7
7
  * Extends HTMLAttributes<HTMLSpanElement> for native span props
8
8
  */
9
- export interface IconProps extends HTMLAttributes<HTMLSpanElement> {
9
+ /**
10
+ * IconProps defines the props for the Icon component
11
+ * @property as - Icon component to render (e.g., from lucide-react)
12
+ * @property color - Color variant based on Versaur color system
13
+ * @property size - Size of the icon (xs, sm, md, lg, xl)
14
+ * Extends SVG props for native SVG attributes
15
+ */
16
+ export type IconProps = Omit<React.SVGProps<SVGSVGElement>, 'children'> & {
17
+ /**
18
+ * Icon component to render (e.g., from lucide-react)
19
+ */
20
+ as: React.ComponentType<{
21
+ className?: string;
22
+ }>;
23
+ /**
24
+ * Color variant
25
+ */
10
26
  color?: 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'neutral' | 'success' | 'info' | 'warning' | 'danger';
27
+ /**
28
+ * Size of the icon
29
+ */
11
30
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
12
- children: ReactNode;
13
- }
31
+ };
@@ -12,3 +12,6 @@ export declare const UnderlineCapitalize: Story;
12
12
  export declare const ClampEllipsis: Story;
13
13
  export declare const ColorVariants: Story;
14
14
  export declare const AsVariants: Story;
15
+ export declare const FontSizeVariants: Story;
16
+ export declare const FontWeightVariants: Story;
17
+ export declare const CustomFontSizeWeight: Story;
@@ -25,6 +25,16 @@ export interface TextProps extends HTMLAttributes<HTMLElement> {
25
25
  clamp?: 1 | 2 | 3 | 4 | 5 | 'none';
26
26
  /** Ellipsis (truncate) */
27
27
  ellipsis?: boolean;
28
+ /** Tailwind font size utility (e.g., 'xs', 'sm', 'base', 'lg', 'xl', etc.)
29
+ * If set, overrides the default font size from the `as` prop and design system
30
+ * See: https://tailwindcss.com/docs/font-size
31
+ */
32
+ fontSize?: 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | '8xl' | '9xl' | undefined;
33
+ /** Tailwind font weight utility (e.g., 'thin', 'extralight', 'light', 'normal', 'medium', 'semibold', 'bold', 'extrabold', 'black')
34
+ * If set, overrides the default font weight from the `as` prop and design system
35
+ * See: https://tailwindcss.com/docs/font-weight
36
+ */
37
+ fontWeight?: 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black' | undefined;
28
38
  /** Text content */
29
39
  children: ReactNode;
30
40
  }