@trycompai/design-system 1.0.11 → 1.0.12
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
|
@@ -20,6 +20,7 @@ interface PageHeaderProps extends Omit<React.ComponentProps<'div'>, 'className'>
|
|
|
20
20
|
function PageHeader({ title, actions, breadcrumbs, backHref, backLabel = 'Back', tabs, children, ...props }: PageHeaderProps) {
|
|
21
21
|
const childArray = React.Children.toArray(children);
|
|
22
22
|
const extractedActionChildren: React.ReactNode[] = [];
|
|
23
|
+
const extractedDescriptionChildren: React.ReactNode[] = [];
|
|
23
24
|
|
|
24
25
|
childArray.forEach((child) => {
|
|
25
26
|
if (
|
|
@@ -30,6 +31,14 @@ function PageHeader({ title, actions, breadcrumbs, backHref, backLabel = 'Back',
|
|
|
30
31
|
) {
|
|
31
32
|
extractedActionChildren.push((child.props as { children?: React.ReactNode }).children);
|
|
32
33
|
}
|
|
34
|
+
if (
|
|
35
|
+
React.isValidElement(child) &&
|
|
36
|
+
(child.type === PageHeaderDescription ||
|
|
37
|
+
(typeof child.type === 'function' &&
|
|
38
|
+
(child.type as unknown as { __pageHeaderSlot?: string }).__pageHeaderSlot === 'description'))
|
|
39
|
+
) {
|
|
40
|
+
extractedDescriptionChildren.push(child);
|
|
41
|
+
}
|
|
33
42
|
});
|
|
34
43
|
|
|
35
44
|
const resolvedActions =
|
|
@@ -69,6 +78,9 @@ function PageHeader({ title, actions, breadcrumbs, backHref, backLabel = 'Back',
|
|
|
69
78
|
)}
|
|
70
79
|
</div>
|
|
71
80
|
|
|
81
|
+
{/* Description section */}
|
|
82
|
+
{extractedDescriptionChildren.length > 0 && extractedDescriptionChildren}
|
|
83
|
+
|
|
72
84
|
{/* Tabs section */}
|
|
73
85
|
{tabs && (
|
|
74
86
|
<div className="mt-2 -mb-px">
|
|
@@ -85,7 +97,14 @@ function PageHeaderActions({ ...props }: Omit<React.ComponentProps<'div'>, 'clas
|
|
|
85
97
|
);
|
|
86
98
|
}
|
|
87
99
|
|
|
100
|
+
function PageHeaderDescription({ ...props }: Omit<React.ComponentProps<'p'>, 'className'>) {
|
|
101
|
+
return (
|
|
102
|
+
<p data-slot="page-header-description" className="text-sm text-muted-foreground" {...props} />
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
88
106
|
// Mark compound slots so PageHeader can detect them even if module instances differ.
|
|
89
107
|
(PageHeaderActions as unknown as { __pageHeaderSlot?: string }).__pageHeaderSlot = 'actions';
|
|
108
|
+
(PageHeaderDescription as unknown as { __pageHeaderSlot?: string }).__pageHeaderSlot = 'description';
|
|
90
109
|
|
|
91
|
-
export { PageHeader, PageHeaderActions };
|
|
110
|
+
export { PageHeader, PageHeaderActions, PageHeaderDescription };
|
|
@@ -34,7 +34,7 @@ const containerVariants = cva('mx-auto w-full', {
|
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
defaultVariants: {
|
|
37
|
-
maxWidth: '
|
|
37
|
+
maxWidth: '2xl',
|
|
38
38
|
},
|
|
39
39
|
});
|
|
40
40
|
|
|
@@ -60,7 +60,7 @@ function PageLayout({
|
|
|
60
60
|
...props
|
|
61
61
|
}: PageLayoutProps) {
|
|
62
62
|
// For center variant, default to smaller max-width (sm) for auth-style pages
|
|
63
|
-
const resolvedMaxWidth = maxWidth ?? (variant === 'center' ? 'sm' : '
|
|
63
|
+
const resolvedMaxWidth = maxWidth ?? (variant === 'center' ? 'sm' : 'xl');
|
|
64
64
|
|
|
65
65
|
const content = (
|
|
66
66
|
<Stack gap={gap}>
|