@carbonid1/design-system 5.16.1 → 5.17.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.
@@ -2,7 +2,8 @@ import type { ButtonProps } from './Button.types';
2
2
  declare const buttonVariants: (props?: ({
3
3
  variant?: "primary" | "attention" | "destructive" | "link" | "ghost" | "outline" | "subtle" | "danger" | null | undefined;
4
4
  size?: "default" | "small" | "large" | "icon" | "smallIcon" | "largeIcon" | null | undefined;
5
+ contentSpacing?: "default" | "relaxed" | null | undefined;
5
6
  selected?: boolean | null | undefined;
6
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
- declare const Button: ({ className, variant, size, selected, fullWidth, loading, disabled, children, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
8
+ declare const Button: ({ className, variant, size, contentSpacing, selected, fullWidth, loading, disabled, children, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
8
9
  export { Button, buttonVariants };
@@ -4,7 +4,7 @@ import { cn } from '../helpers/cn/cn';
4
4
  import { Button as ButtonPrimitive } from '@base-ui/react/button';
5
5
  import { cva } from 'class-variance-authority';
6
6
  import { Loader2 } from 'lucide-react';
7
- const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center gap-2 rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-hidden select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
7
+ const buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-hidden select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
8
8
  variants: {
9
9
  variant: {
10
10
  ghost: 'hover:bg-accent aria-expanded:bg-accent dark:hover:bg-accent/50',
@@ -17,19 +17,38 @@ const buttonVariants = cva("group/button inline-flex shrink-0 items-center justi
17
17
  link: 'text-primary underline-offset-4 hover:underline',
18
18
  },
19
19
  size: {
20
- small: 'h-7 gap-1 px-2.5 text-[0.8rem]',
21
- default: 'h-8 gap-1.5 px-2.5',
22
- large: 'h-9 gap-1.5 px-3',
20
+ small: 'h-7 px-2.5 text-[0.8rem]',
21
+ default: 'h-8 px-2.5',
22
+ large: 'h-9 px-3',
23
23
  icon: 'size-8 rounded-full',
24
24
  smallIcon: 'size-6 rounded-full',
25
25
  largeIcon: 'size-12 rounded-full',
26
26
  },
27
+ contentSpacing: {
28
+ default: '',
29
+ relaxed: 'gap-2',
30
+ },
27
31
  selected: {
28
32
  true: 'bg-primary/10 ring-1 ring-primary/20',
29
33
  false: '',
30
34
  },
31
35
  },
32
36
  compoundVariants: [
37
+ {
38
+ contentSpacing: 'default',
39
+ size: 'small',
40
+ className: 'gap-1',
41
+ },
42
+ {
43
+ contentSpacing: 'default',
44
+ size: 'default',
45
+ className: 'gap-1.5',
46
+ },
47
+ {
48
+ contentSpacing: 'default',
49
+ size: 'large',
50
+ className: 'gap-1.5',
51
+ },
33
52
  // Hold the selection tint on hover instead of letting the variant's own hover background win.
34
53
  {
35
54
  selected: true,
@@ -45,8 +64,9 @@ const buttonVariants = cva("group/button inline-flex shrink-0 items-center justi
45
64
  defaultVariants: {
46
65
  variant: 'ghost',
47
66
  size: 'default',
67
+ contentSpacing: 'default',
48
68
  selected: false,
49
69
  },
50
70
  });
51
- const Button = ({ className, variant, size, selected, fullWidth, loading, disabled, children, ...props }) => (_jsxs(ButtonPrimitive, { "data-slot": "button", className: cn(buttonVariants({ variant, size, selected }), fullWidth && 'w-full justify-start', className), disabled: disabled ?? loading, "aria-busy": loading ?? undefined, ...props, children: [loading && _jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": "true" }), children] }));
71
+ const Button = ({ className, variant, size, contentSpacing, selected, fullWidth, loading, disabled, children, ...props }) => (_jsxs(ButtonPrimitive, { "data-slot": "button", className: cn(buttonVariants({ variant, size, contentSpacing, selected }), fullWidth && 'w-full justify-start', className), disabled: disabled ?? loading, "aria-busy": loading ?? undefined, ...props, children: [loading && _jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": "true" }), children] }));
52
72
  export { Button, buttonVariants };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonid1/design-system",
3
- "version": "5.16.1",
3
+ "version": "5.17.0",
4
4
  "description": "Shared React UI primitives + design tokens (themes, postcss config)",
5
5
  "repository": {
6
6
  "type": "git",