@trycompai/design-system 1.0.25 → 1.0.27
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/package.json
CHANGED
|
@@ -10,7 +10,7 @@ function Textarea({
|
|
|
10
10
|
<textarea
|
|
11
11
|
data-slot="textarea"
|
|
12
12
|
data-size={size}
|
|
13
|
-
className="border-input dark:bg-input/30 focus-visible:border-primary focus-visible:ring-primary/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 rounded-sm border bg-transparent px-2.5 py-2 text-base transition-colors focus-visible:ring-[3px] aria-invalid:ring-[3px] md:text-sm placeholder:text-muted-foreground flex field-sizing-content min-h-16 min-w-0 w-full resize-y outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[size=sm]:max-w-xs data-[size=default]:max-w-md data-[size=lg]:max-w-xl"
|
|
13
|
+
className="border-input dark:bg-input/30 focus-visible:border-primary focus-visible:ring-primary/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 rounded-sm border bg-transparent px-2.5 py-2 text-base transition-colors focus-visible:ring-[3px] aria-invalid:ring-[3px] md:text-sm placeholder:text-muted-foreground flex field-sizing-content min-h-16 min-w-0 w-full resize-y outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[size=sm]:max-w-xs data-[size=default]:max-w-md data-[size=lg]:max-w-xl data-[size=full]:max-w-none"
|
|
14
14
|
{...props}
|
|
15
15
|
/>
|
|
16
16
|
);
|
|
@@ -10,20 +10,33 @@ interface SectionProps extends Omit<React.ComponentProps<'section'>, 'className'
|
|
|
10
10
|
actions?: React.ReactNode;
|
|
11
11
|
/** Gap between header and content. Default is "4" */
|
|
12
12
|
gap?: '2' | '3' | '4' | '6' | '8';
|
|
13
|
+
/** Visual variant. "sheet" is optimized for use inside Sheet/Drawer */
|
|
14
|
+
variant?: 'default' | 'sheet';
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
function Section({
|
|
17
|
+
function Section({
|
|
18
|
+
title,
|
|
19
|
+
description,
|
|
20
|
+
actions,
|
|
21
|
+
gap,
|
|
22
|
+
variant = 'default',
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}: SectionProps) {
|
|
16
26
|
const hasHeader = title || description || actions;
|
|
27
|
+
const resolvedGap = gap ?? (variant === 'sheet' ? '3' : '4');
|
|
28
|
+
const headingLevel = variant === 'sheet' ? '4' : '3';
|
|
29
|
+
const textSize = variant === 'sheet' ? 'xs' : 'sm';
|
|
17
30
|
|
|
18
31
|
return (
|
|
19
|
-
<section data-slot="section" className="w-full" {...props}>
|
|
20
|
-
<Stack gap={
|
|
32
|
+
<section data-slot="section" data-variant={variant} className="w-full" {...props}>
|
|
33
|
+
<Stack gap={resolvedGap}>
|
|
21
34
|
{hasHeader && (
|
|
22
35
|
<div className="flex items-start justify-between gap-4">
|
|
23
36
|
<Stack gap="1">
|
|
24
|
-
{title && <Heading level=
|
|
37
|
+
{title && <Heading level={headingLevel}>{title}</Heading>}
|
|
25
38
|
{description && (
|
|
26
|
-
<Text size=
|
|
39
|
+
<Text size={textSize} variant="muted">
|
|
27
40
|
{description}
|
|
28
41
|
</Text>
|
|
29
42
|
)}
|
|
@@ -43,12 +56,29 @@ function SectionHeader({ ...props }: Omit<React.ComponentProps<'div'>, 'classNam
|
|
|
43
56
|
);
|
|
44
57
|
}
|
|
45
58
|
|
|
46
|
-
function SectionTitle({
|
|
47
|
-
|
|
59
|
+
function SectionTitle({
|
|
60
|
+
size = 'default',
|
|
61
|
+
...props
|
|
62
|
+
}: Omit<React.ComponentProps<typeof Heading>, 'className' | 'level'> & {
|
|
63
|
+
size?: 'default' | 'sm';
|
|
64
|
+
}) {
|
|
65
|
+
return <Heading data-slot="section-title" level={size === 'sm' ? '4' : '3'} {...props} />;
|
|
48
66
|
}
|
|
49
67
|
|
|
50
|
-
function SectionDescription({
|
|
51
|
-
|
|
68
|
+
function SectionDescription({
|
|
69
|
+
size = 'default',
|
|
70
|
+
...props
|
|
71
|
+
}: Omit<React.ComponentProps<typeof Text>, 'className' | 'size'> & {
|
|
72
|
+
size?: 'default' | 'sm';
|
|
73
|
+
}) {
|
|
74
|
+
return (
|
|
75
|
+
<Text
|
|
76
|
+
data-slot="section-description"
|
|
77
|
+
size={size === 'sm' ? 'xs' : 'sm'}
|
|
78
|
+
variant="muted"
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
52
82
|
}
|
|
53
83
|
|
|
54
84
|
function SectionActions({ ...props }: Omit<React.ComponentProps<'div'>, 'className'>) {
|