@carbonid1/design-system 7.0.0 → 7.0.2
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/Badge/Badge.d.ts +1 -4
- package/dist/Badge/Badge.js +2 -15
- package/dist/Badge/Badge.types.d.ts +1 -1
- package/dist/Badge/Badge.variants.d.ts +4 -0
- package/dist/Badge/Badge.variants.js +15 -0
- package/dist/Button/Button.d.ts +1 -7
- package/dist/Button/Button.js +2 -66
- package/dist/Button/Button.types.d.ts +1 -1
- package/dist/Button/Button.variants.d.ts +7 -0
- package/dist/Button/Button.variants.js +66 -0
- package/dist/Item/Item.d.ts +20 -0
- package/dist/Item/Item.js +44 -0
- package/dist/Item/Item.types.d.ts +21 -0
- package/dist/Item/Item.types.js +1 -0
- package/dist/Kbd/Kbd.d.ts +1 -4
- package/dist/Kbd/Kbd.js +2 -11
- package/dist/Kbd/Kbd.types.d.ts +1 -1
- package/dist/Kbd/Kbd.variants.d.ts +4 -0
- package/dist/Kbd/Kbd.variants.js +11 -0
- package/dist/SegmentedControl/SegmentedControl.js +1 -1
- package/dist/Toaster/Toaster.js +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +7 -3
- package/package.json +2 -1
package/dist/Badge/Badge.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { BadgeProps } from './Badge.types';
|
|
2
|
-
declare const badgeVariants: (props?: ({
|
|
3
|
-
variant?: "default" | "primary" | "success" | "attention" | "destructive" | "highlight" | null | undefined;
|
|
4
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
2
|
declare const Badge: ({ className, variant, onRemove, removeLabel, children, ...props }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export { Badge
|
|
3
|
+
export { Badge };
|
package/dist/Badge/Badge.js
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from '../helpers/cn/cn';
|
|
4
|
-
import { cva } from 'class-variance-authority';
|
|
5
4
|
import { X } from 'lucide-react';
|
|
6
|
-
|
|
7
|
-
variants: {
|
|
8
|
-
variant: {
|
|
9
|
-
default: 'border-muted-foreground bg-muted text-foreground',
|
|
10
|
-
primary: 'bg-primary-border/30 text-primary',
|
|
11
|
-
success: 'bg-success/15 text-success-foreground',
|
|
12
|
-
attention: 'bg-attention-muted text-attention-foreground',
|
|
13
|
-
destructive: 'bg-destructive/15 text-destructive',
|
|
14
|
-
highlight: 'bg-highlight-muted text-highlight-foreground',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
defaultVariants: { variant: 'default' },
|
|
18
|
-
});
|
|
5
|
+
import { badgeVariants } from './Badge.variants';
|
|
19
6
|
const Badge = ({ className, variant, onRemove, removeLabel, children, ...props }) => {
|
|
20
7
|
const resolvedRemoveLabel = removeLabel ?? (typeof children === 'string' ? `Remove ${children}` : 'Remove');
|
|
21
8
|
return (_jsxs("span", { className: cn(badgeVariants({ variant }), className), ...props, children: [onRemove ? _jsx("span", { className: "truncate", children: children }) : children, onRemove && (_jsx("button", { type: "button", "aria-label": resolvedRemoveLabel, onClick: onRemove, className: "-me-0.5 inline-flex size-4 shrink-0 cursor-pointer items-center justify-center rounded-full opacity-70 hover:opacity-100 focus-visible:ring-2 focus-visible:ring-current focus-visible:ring-offset-1 focus-visible:ring-offset-transparent focus-visible:outline-none", children: _jsx(X, { className: "size-3", "aria-hidden": "true" }) }))] }));
|
|
22
9
|
};
|
|
23
|
-
export { Badge
|
|
10
|
+
export { Badge };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react';
|
|
2
2
|
import type { VariantProps } from 'class-variance-authority';
|
|
3
|
-
import type { badgeVariants } from './Badge';
|
|
3
|
+
import type { badgeVariants } from './Badge.variants';
|
|
4
4
|
/**
|
|
5
5
|
* `variant` communicates emphasis, not meaning — always pair it with
|
|
6
6
|
* descriptive text content so the badge isn't relying on color alone.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
const badgeVariants = cva('inline-flex max-w-full min-w-0 items-center gap-1 rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap', {
|
|
3
|
+
variants: {
|
|
4
|
+
variant: {
|
|
5
|
+
default: 'border-muted-foreground bg-muted text-foreground',
|
|
6
|
+
primary: 'bg-primary-border/30 text-primary',
|
|
7
|
+
success: 'bg-success/15 text-success-foreground',
|
|
8
|
+
attention: 'bg-attention-muted text-attention-foreground',
|
|
9
|
+
destructive: 'bg-destructive/15 text-destructive',
|
|
10
|
+
highlight: 'bg-highlight-muted text-highlight-foreground',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: { variant: 'default' },
|
|
14
|
+
});
|
|
15
|
+
export { badgeVariants };
|
package/dist/Button/Button.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import type { ButtonProps } from './Button.types';
|
|
2
|
-
declare const buttonVariants: (props?: ({
|
|
3
|
-
variant?: "primary" | "attention" | "destructive" | "link" | "ghost" | "outline" | "subtle" | "danger" | null | undefined;
|
|
4
|
-
size?: "default" | "small" | "large" | "icon" | "smallIcon" | "largeIcon" | null | undefined;
|
|
5
|
-
contentSpacing?: "default" | "relaxed" | null | undefined;
|
|
6
|
-
selected?: boolean | null | undefined;
|
|
7
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
2
|
declare const Button: ({ className, variant, size, contentSpacing, selected, fullWidth, loading, disabled, children, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export { Button
|
|
3
|
+
export { Button };
|
package/dist/Button/Button.js
CHANGED
|
@@ -3,71 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { cn } from '../helpers/cn/cn';
|
|
4
4
|
import { mergeStatefulClassName } from '../helpers/mergeStatefulClassName/mergeStatefulClassName';
|
|
5
5
|
import { Button as ButtonPrimitive } from '@base-ui/react/button';
|
|
6
|
-
import { cva } from 'class-variance-authority';
|
|
7
6
|
import { Loader2 } from 'lucide-react';
|
|
8
|
-
|
|
9
|
-
variants: {
|
|
10
|
-
variant: {
|
|
11
|
-
ghost: 'hover:bg-accent aria-expanded:bg-accent dark:hover:bg-accent/50',
|
|
12
|
-
primary: 'bg-primary text-primary-foreground font-medium hover:bg-primary/90',
|
|
13
|
-
outline: 'border-input-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-input/30 dark:hover:bg-input/50',
|
|
14
|
-
destructive: 'bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40',
|
|
15
|
-
attention: 'text-attention-foreground hover:bg-attention-muted',
|
|
16
|
-
subtle: 'text-muted-foreground hover:text-primary',
|
|
17
|
-
danger: 'text-muted-foreground hover:text-destructive',
|
|
18
|
-
link: 'text-primary underline-offset-4 hover:underline',
|
|
19
|
-
},
|
|
20
|
-
size: {
|
|
21
|
-
small: 'h-7 px-2.5 text-[0.8rem]',
|
|
22
|
-
default: 'h-8 px-2.5',
|
|
23
|
-
large: 'h-9 px-3',
|
|
24
|
-
icon: 'size-8 rounded-full',
|
|
25
|
-
smallIcon: 'size-6 rounded-full',
|
|
26
|
-
largeIcon: 'size-12 rounded-full',
|
|
27
|
-
},
|
|
28
|
-
contentSpacing: {
|
|
29
|
-
default: '',
|
|
30
|
-
relaxed: 'gap-2',
|
|
31
|
-
},
|
|
32
|
-
selected: {
|
|
33
|
-
true: 'bg-primary/10 ring-1 ring-primary/20',
|
|
34
|
-
false: '',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
compoundVariants: [
|
|
38
|
-
{
|
|
39
|
-
contentSpacing: 'default',
|
|
40
|
-
size: 'small',
|
|
41
|
-
className: 'gap-1',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
contentSpacing: 'default',
|
|
45
|
-
size: 'default',
|
|
46
|
-
className: 'gap-1.5',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
contentSpacing: 'default',
|
|
50
|
-
size: 'large',
|
|
51
|
-
className: 'gap-1.5',
|
|
52
|
-
},
|
|
53
|
-
// Hold the selection tint on hover instead of letting the variant's own hover background win.
|
|
54
|
-
{
|
|
55
|
-
selected: true,
|
|
56
|
-
variant: 'ghost',
|
|
57
|
-
className: 'hover:bg-primary/10 dark:hover:bg-primary/10',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
selected: true,
|
|
61
|
-
variant: 'outline',
|
|
62
|
-
className: 'hover:bg-primary/10 dark:hover:bg-primary/10',
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
defaultVariants: {
|
|
66
|
-
variant: 'ghost',
|
|
67
|
-
size: 'default',
|
|
68
|
-
contentSpacing: 'default',
|
|
69
|
-
selected: false,
|
|
70
|
-
},
|
|
71
|
-
});
|
|
7
|
+
import { buttonVariants } from './Button.variants';
|
|
72
8
|
const Button = ({ className, variant, size, contentSpacing, selected, fullWidth, loading, disabled, children, ...props }) => (_jsxs(ButtonPrimitive, { "data-slot": "button", className: mergeStatefulClassName(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] }));
|
|
73
|
-
export { Button
|
|
9
|
+
export { Button };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Button as ButtonPrimitive } from '@base-ui/react/button';
|
|
2
2
|
import type { VariantProps } from 'class-variance-authority';
|
|
3
|
-
import type { buttonVariants } from './Button';
|
|
3
|
+
import type { buttonVariants } from './Button.variants';
|
|
4
4
|
type ButtonProps = ButtonPrimitive.Props & VariantProps<typeof buttonVariants> & {
|
|
5
5
|
fullWidth?: boolean;
|
|
6
6
|
loading?: boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const buttonVariants: (props?: ({
|
|
2
|
+
variant?: "primary" | "attention" | "destructive" | "link" | "ghost" | "outline" | "subtle" | "danger" | null | undefined;
|
|
3
|
+
size?: "default" | "small" | "large" | "icon" | "smallIcon" | "largeIcon" | null | undefined;
|
|
4
|
+
contentSpacing?: "default" | "relaxed" | null | undefined;
|
|
5
|
+
selected?: boolean | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
export { buttonVariants };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
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-[color,background-color,opacity,transform] 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", {
|
|
3
|
+
variants: {
|
|
4
|
+
variant: {
|
|
5
|
+
ghost: 'hover:bg-accent aria-expanded:bg-accent dark:hover:bg-accent/50',
|
|
6
|
+
primary: 'bg-primary text-primary-foreground font-medium hover:bg-primary/90',
|
|
7
|
+
outline: 'border-input-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:bg-input/30 dark:hover:bg-input/50',
|
|
8
|
+
destructive: 'bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40',
|
|
9
|
+
attention: 'text-attention-foreground hover:bg-attention-muted',
|
|
10
|
+
subtle: 'text-muted-foreground hover:text-primary',
|
|
11
|
+
danger: 'text-muted-foreground hover:text-destructive',
|
|
12
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
small: 'h-7 px-2.5 text-[0.8rem]',
|
|
16
|
+
default: 'h-8 px-2.5',
|
|
17
|
+
large: 'h-9 px-3',
|
|
18
|
+
icon: 'size-8 rounded-full',
|
|
19
|
+
smallIcon: 'size-6 rounded-full',
|
|
20
|
+
largeIcon: 'size-12 rounded-full',
|
|
21
|
+
},
|
|
22
|
+
contentSpacing: {
|
|
23
|
+
default: '',
|
|
24
|
+
relaxed: 'gap-2',
|
|
25
|
+
},
|
|
26
|
+
selected: {
|
|
27
|
+
true: 'bg-primary/10 ring-1 ring-primary/20',
|
|
28
|
+
false: '',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
compoundVariants: [
|
|
32
|
+
{
|
|
33
|
+
contentSpacing: 'default',
|
|
34
|
+
size: 'small',
|
|
35
|
+
className: 'gap-1',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
contentSpacing: 'default',
|
|
39
|
+
size: 'default',
|
|
40
|
+
className: 'gap-1.5',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
contentSpacing: 'default',
|
|
44
|
+
size: 'large',
|
|
45
|
+
className: 'gap-1.5',
|
|
46
|
+
},
|
|
47
|
+
// Hold the selection tint on hover instead of letting the variant's own hover background win.
|
|
48
|
+
{
|
|
49
|
+
selected: true,
|
|
50
|
+
variant: 'ghost',
|
|
51
|
+
className: 'hover:bg-primary/10 dark:hover:bg-primary/10',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
selected: true,
|
|
55
|
+
variant: 'outline',
|
|
56
|
+
className: 'hover:bg-primary/10 dark:hover:bg-primary/10',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
variant: 'ghost',
|
|
61
|
+
size: 'default',
|
|
62
|
+
contentSpacing: 'default',
|
|
63
|
+
selected: false,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
export { buttonVariants };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ElementType } from 'react';
|
|
2
|
+
import type { ItemActionsProps, ItemContentProps, ItemDescriptionProps, ItemMediaProps, ItemRootProps, ItemTitleProps } from './Item.types';
|
|
3
|
+
declare const itemVariants: (props?: ({
|
|
4
|
+
surface?: "outline" | "raised" | "plain" | "inset" | null | undefined;
|
|
5
|
+
interactive?: boolean | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
/**
|
|
8
|
+
* One member of a collection. `Item` supplies static structure and surface styling only:
|
|
9
|
+
* callers keep native list markup and attach link, button, or disclosure behavior to the
|
|
10
|
+
* appropriate owner. `interactive` adds visual feedback without adding semantics or handlers.
|
|
11
|
+
*/
|
|
12
|
+
export declare const Item: {
|
|
13
|
+
Root: <E extends ElementType = "div">({ as, className, surface, interactive, ...props }: ItemRootProps<E>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
Media: ({ className, ...props }: ItemMediaProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
Content: ({ className, ...props }: ItemContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
Title: ({ className, ...props }: ItemTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
Description: ({ className, ...props }: ItemDescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
Actions: ({ className, ...props }: ItemActionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
};
|
|
20
|
+
export { itemVariants };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { cn } from '../helpers/cn/cn';
|
|
4
|
+
const itemVariants = cva('min-w-0 rounded-lg', {
|
|
5
|
+
variants: {
|
|
6
|
+
surface: {
|
|
7
|
+
plain: 'bg-transparent',
|
|
8
|
+
raised: 'bg-card shadow-card',
|
|
9
|
+
inset: 'bg-surface-inset inset-shadow-surface',
|
|
10
|
+
outline: 'border-border border bg-transparent',
|
|
11
|
+
},
|
|
12
|
+
interactive: {
|
|
13
|
+
true: 'outline-hidden hover:bg-accent focus-within:bg-accent focus-visible:bg-accent focus-visible:ring-3 focus-visible:ring-ring/50 dark:hover:bg-accent/50 dark:focus-within:bg-accent/50 dark:focus-visible:bg-accent/50 forced-colors:focus-visible:ring-0 forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-offset-2 forced-colors:focus-visible:outline-[Highlight]',
|
|
14
|
+
false: '',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
surface: 'plain',
|
|
19
|
+
interactive: false,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const Root = ({ as, className, surface = 'plain', interactive = false, ...props }) => {
|
|
23
|
+
const Component = (as ?? 'div');
|
|
24
|
+
return (_jsx(Component, { "data-slot": "item", className: cn('flex items-center gap-3 p-3', itemVariants({ surface, interactive }), className), ...props }));
|
|
25
|
+
};
|
|
26
|
+
const Media = ({ className, ...props }) => (_jsx("div", { "data-slot": "item-media", className: cn('flex shrink-0 items-center justify-center', className), ...props }));
|
|
27
|
+
const Content = ({ className, ...props }) => (_jsx("div", { "data-slot": "item-content", className: cn('flex min-w-0 flex-1 flex-col gap-1', className), ...props }));
|
|
28
|
+
const Title = ({ className, ...props }) => (_jsx("div", { "data-slot": "item-title", className: cn('text-sm leading-snug font-medium', className), ...props }));
|
|
29
|
+
const Description = ({ className, ...props }) => (_jsx("div", { "data-slot": "item-description", className: cn('text-muted-foreground text-sm leading-normal', className), ...props }));
|
|
30
|
+
const Actions = ({ className, ...props }) => (_jsx("div", { "data-slot": "item-actions", className: cn('flex shrink-0 items-center gap-2', className), ...props }));
|
|
31
|
+
/**
|
|
32
|
+
* One member of a collection. `Item` supplies static structure and surface styling only:
|
|
33
|
+
* callers keep native list markup and attach link, button, or disclosure behavior to the
|
|
34
|
+
* appropriate owner. `interactive` adds visual feedback without adding semantics or handlers.
|
|
35
|
+
*/
|
|
36
|
+
export const Item = {
|
|
37
|
+
Root,
|
|
38
|
+
Media,
|
|
39
|
+
Content,
|
|
40
|
+
Title,
|
|
41
|
+
Description,
|
|
42
|
+
Actions,
|
|
43
|
+
};
|
|
44
|
+
export { itemVariants };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ElementType } from 'react';
|
|
2
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import type { itemVariants } from './Item';
|
|
4
|
+
type ItemRootOwnProps<E extends ElementType = 'div'> = VariantProps<typeof itemVariants> & {
|
|
5
|
+
/** Override the rendered element while preserving its native props. Defaults to `div`. */
|
|
6
|
+
as?: E;
|
|
7
|
+
className?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Props for `Item.Root`. `surface` controls elevation; `interactive` adds hover and visible-focus
|
|
11
|
+
* styling but never supplies behavior, roles, handlers, or focusability.
|
|
12
|
+
*/
|
|
13
|
+
type ItemRootProps<E extends ElementType = 'div'> = ItemRootOwnProps<E> & Omit<ComponentPropsWithoutRef<E>, keyof ItemRootOwnProps<E>>;
|
|
14
|
+
/** Concrete root props for contexts that need a fixed default element, such as Storybook args. */
|
|
15
|
+
type ItemRootPropsDefault = ItemRootProps<'div'>;
|
|
16
|
+
type ItemMediaProps = ComponentPropsWithoutRef<'div'>;
|
|
17
|
+
type ItemContentProps = ComponentPropsWithoutRef<'div'>;
|
|
18
|
+
type ItemTitleProps = ComponentPropsWithoutRef<'div'>;
|
|
19
|
+
type ItemDescriptionProps = ComponentPropsWithoutRef<'div'>;
|
|
20
|
+
type ItemActionsProps = ComponentPropsWithoutRef<'div'>;
|
|
21
|
+
export type { ItemActionsProps, ItemContentProps, ItemDescriptionProps, ItemMediaProps, ItemRootProps, ItemRootPropsDefault, ItemTitleProps, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Kbd/Kbd.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { KbdProps } from './Kbd.types';
|
|
2
|
-
declare const kbdVariants: (props?: ({
|
|
3
|
-
size?: "default" | "sm" | null | undefined;
|
|
4
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
2
|
declare const Kbd: ({ keys, size, className }: KbdProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export { Kbd
|
|
3
|
+
export { Kbd };
|
package/dist/Kbd/Kbd.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { getModKey } from '../helpers/getModKey/getModKey';
|
|
4
4
|
import { cn } from '../helpers/cn/cn';
|
|
5
|
-
import {
|
|
5
|
+
import { kbdVariants } from './Kbd.variants';
|
|
6
6
|
const MOD_SYMBOLS = { Cmd: '⌘', Ctrl: 'Ctrl' };
|
|
7
7
|
const KEY_SYMBOLS = {
|
|
8
8
|
shift: '⇧',
|
|
@@ -24,17 +24,8 @@ const resolveKey = (key) => {
|
|
|
24
24
|
return getModKey() === 'Cmd' ? '⌃' : 'Ctrl';
|
|
25
25
|
return KEY_SYMBOLS[lower] ?? key;
|
|
26
26
|
};
|
|
27
|
-
const kbdVariants = cva('inline-flex items-center justify-center rounded-sm border font-mono leading-none select-none', {
|
|
28
|
-
variants: {
|
|
29
|
-
size: {
|
|
30
|
-
sm: 'min-w-4 px-1 py-0.5 text-[10px] border-foreground/10 bg-foreground/10',
|
|
31
|
-
default: 'min-w-5 px-1.5 py-1 text-[11px] border-border bg-muted',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
defaultVariants: { size: 'default' },
|
|
35
|
-
});
|
|
36
27
|
const Kbd = ({ keys, size, className }) => {
|
|
37
28
|
const keyList = Array.isArray(keys) ? keys : [keys];
|
|
38
29
|
return (_jsx("span", { className: "inline-flex items-center gap-0.5", role: "presentation", children: keyList.map((key, i) => (_jsx("kbd", { className: cn(kbdVariants({ size }), className), children: resolveKey(key) }, i))) }));
|
|
39
30
|
};
|
|
40
|
-
export { Kbd
|
|
31
|
+
export { Kbd };
|
package/dist/Kbd/Kbd.types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import type { kbdVariants } from './Kbd';
|
|
2
|
+
import type { kbdVariants } from './Kbd.variants';
|
|
3
3
|
type KbdProps = {
|
|
4
4
|
/** Single key or array of keys for combos. 'mod' auto-resolves to Cmd/Ctrl. */
|
|
5
5
|
keys: string | string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { cva } from 'class-variance-authority';
|
|
2
|
+
const kbdVariants = cva('inline-flex items-center justify-center rounded-sm border font-mono leading-none select-none', {
|
|
3
|
+
variants: {
|
|
4
|
+
size: {
|
|
5
|
+
sm: 'min-w-4 px-1 py-0.5 text-[10px] border-foreground/10 bg-foreground/10',
|
|
6
|
+
default: 'min-w-5 px-1.5 py-1 text-[11px] border-border bg-muted',
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
defaultVariants: { size: 'default' },
|
|
10
|
+
});
|
|
11
|
+
export { kbdVariants };
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { Toggle as BaseToggle } from '@base-ui/react/toggle';
|
|
4
4
|
import { ToggleGroup as BaseToggleGroup } from '@base-ui/react/toggle-group';
|
|
5
5
|
import { createContext, useContext } from 'react';
|
|
6
|
-
import { buttonVariants } from '../Button/Button';
|
|
6
|
+
import { buttonVariants } from '../Button/Button.variants';
|
|
7
7
|
import { cn } from '../helpers/cn/cn';
|
|
8
8
|
const SegmentedControlContext = createContext({ size: 'small' });
|
|
9
9
|
const Root = ({ value, onValueChange, size = 'small', orientation = 'horizontal', className, children, ...props }) => (_jsx(BaseToggleGroup, { ...props, "data-slot": "segmented-control", multiple: false, orientation: orientation, value: [value], onValueChange: nextValues => onValueChange(nextValues[0] ?? value), className: cn('bg-surface-inset inset-shadow-surface flex w-fit gap-0.5 rounded-lg p-0.5', orientation === 'vertical' ? 'flex-col items-stretch' : 'items-center', className), children: _jsx(SegmentedControlContext.Provider, { value: { size }, children: children }) }));
|
package/dist/Toaster/Toaster.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Toast as BaseToast } from '@base-ui/react/toast';
|
|
4
4
|
import { CircleAlert, CircleCheck, X } from 'lucide-react';
|
|
5
5
|
import { cn } from '../helpers/cn/cn';
|
|
6
|
-
import { buttonVariants } from '../Button/Button';
|
|
6
|
+
import { buttonVariants } from '../Button/Button.variants';
|
|
7
7
|
const DEFAULT_DURATION = 4000;
|
|
8
8
|
const DEFAULT_VISIBLE_TOASTS = 3;
|
|
9
9
|
const toastManager = BaseToast.createToastManager();
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { HotkeysProvider as HotkeysProviderHook, isHotkeyPressed as isHotkeyPressedHook, useHotkeys as useHotkeysHook, useHotkeysContext as useHotkeysContextHook, useRecordHotkeys as useRecordHotkeysHook } from 'react-hotkeys-hook';
|
|
2
|
-
export { Badge
|
|
2
|
+
export { Badge } from './Badge/Badge';
|
|
3
|
+
export { badgeVariants } from './Badge/Badge.variants';
|
|
3
4
|
export type { BadgeProps } from './Badge/Badge.types';
|
|
4
|
-
export { Button
|
|
5
|
+
export { Button } from './Button/Button';
|
|
6
|
+
export { buttonVariants } from './Button/Button.variants';
|
|
5
7
|
export type { ButtonProps } from './Button/Button.types';
|
|
6
8
|
export { Input } from './Input/Input';
|
|
7
9
|
export type { InputProps } from './Input/Input.types';
|
|
@@ -11,7 +13,10 @@ export { InputGroup } from './InputGroup/InputGroup';
|
|
|
11
13
|
export type { InputGroupActionProps, InputGroupControlProps, InputGroupRootProps, } from './InputGroup/InputGroup.types';
|
|
12
14
|
export { Card, cardVariants } from './Card/Card';
|
|
13
15
|
export type { CardActionProps, CardContentProps, CardDescriptionProps, CardFooterProps, CardHeaderProps, CardRootProps, CardTitleProps, } from './Card/Card.types';
|
|
14
|
-
export {
|
|
16
|
+
export { Item, itemVariants } from './Item/Item';
|
|
17
|
+
export type { ItemActionsProps, ItemContentProps, ItemDescriptionProps, ItemMediaProps, ItemRootProps, ItemRootPropsDefault, ItemTitleProps, } from './Item/Item.types';
|
|
18
|
+
export { Kbd } from './Kbd/Kbd';
|
|
19
|
+
export { kbdVariants } from './Kbd/Kbd.variants';
|
|
15
20
|
export type { KbdProps } from './Kbd/Kbd.types';
|
|
16
21
|
export { Text, textVariants } from './Text/Text';
|
|
17
22
|
export type { TextProps, TextPropsDefault } from './Text/Text.types';
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { HotkeysProvider as HotkeysProviderHook, isHotkeyPressed as isHotkeyPressedHook, useHotkeys as useHotkeysHook, useHotkeysContext as useHotkeysContextHook, useRecordHotkeys as useRecordHotkeysHook, } from 'react-hotkeys-hook';
|
|
2
|
-
export { Badge
|
|
3
|
-
export {
|
|
2
|
+
export { Badge } from './Badge/Badge';
|
|
3
|
+
export { badgeVariants } from './Badge/Badge.variants';
|
|
4
|
+
export { Button } from './Button/Button';
|
|
5
|
+
export { buttonVariants } from './Button/Button.variants';
|
|
4
6
|
export { Input } from './Input/Input';
|
|
5
7
|
export { Field } from './Field/Field';
|
|
6
8
|
export { InputGroup } from './InputGroup/InputGroup';
|
|
7
9
|
export { Card, cardVariants } from './Card/Card';
|
|
8
|
-
export {
|
|
10
|
+
export { Item, itemVariants } from './Item/Item';
|
|
11
|
+
export { Kbd } from './Kbd/Kbd';
|
|
12
|
+
export { kbdVariants } from './Kbd/Kbd.variants';
|
|
9
13
|
export { Text, textVariants } from './Text/Text';
|
|
10
14
|
export { ProgressRing } from './ProgressRing/ProgressRing';
|
|
11
15
|
export { MeterRing } from './MeterRing/MeterRing';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbonid1/design-system",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"description": "Shared React UI primitives + design tokens (themes, postcss config)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@base-ui/react": "^1.6.0",
|
|
56
|
+
"@storybook/addon-a11y": "^10.3.5",
|
|
56
57
|
"@storybook/addon-docs": "^10.3.5",
|
|
57
58
|
"@storybook/addon-mcp": "^0.6.0",
|
|
58
59
|
"@storybook/addon-themes": "^10.3.5",
|