@carbonid1/design-system 5.16.0 → 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.
- package/dist/Button/Button.d.ts +2 -1
- package/dist/Button/Button.js +25 -5
- package/dist/Switch/Switch.js +1 -1
- package/package.json +1 -1
package/dist/Button/Button.d.ts
CHANGED
|
@@ -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 };
|
package/dist/Button/Button.js
CHANGED
|
@@ -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
|
|
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
|
|
21
|
-
default: 'h-8
|
|
22
|
-
large: 'h-9
|
|
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/dist/Switch/Switch.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Switch as BaseSwitch } from '@base-ui/react/switch';
|
|
4
4
|
import { cn } from '../helpers/cn/cn';
|
|
5
|
-
const Root = ({ className, ...props }) => (_jsx(BaseSwitch.Root, { "data-slot": "switch", className: cn('border-input-border bg-input data-checked:border-primary data-checked:bg-primary inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border p-0.5 outline-hidden', '
|
|
5
|
+
const Root = ({ className, ...props }) => (_jsx(BaseSwitch.Root, { "data-slot": "switch", className: cn('border-input-border bg-input data-checked:border-primary data-checked:bg-primary inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border p-0.5 outline-hidden', 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3', 'data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50', className), ...props }));
|
|
6
6
|
const Thumb = ({ className, ...props }) => (_jsx(BaseSwitch.Thumb, { "data-slot": "switch-thumb", className: cn('bg-background pointer-events-none block size-4 translate-x-0 rounded-full shadow-sm', 'transition-transform duration-150 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none', 'data-checked:translate-x-4', className), ...props }));
|
|
7
7
|
export const Switch = {
|
|
8
8
|
Root,
|