tembro 4.2.1 → 6.0.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/CHANGELOG.md +29 -0
- package/dist/components/charts/progress-circle.d.ts +12 -3
- package/dist/components/data-table/data-table.d.ts +2 -2
- package/dist/components/feedback/index.d.ts +0 -2
- package/dist/components/layout/section.d.ts +1 -8
- package/dist/components/patterns/index.d.ts +0 -8
- package/dist/components/patterns/public.d.ts +0 -8
- package/dist/components/ui/hover-card/index.cjs +1 -0
- package/dist/components/ui/hover-card/index.d.ts +11 -0
- package/dist/components/ui/hover-card/index.js +1 -0
- package/dist/components/ui/menubar/index.cjs +1 -0
- package/dist/components/ui/menubar/index.d.ts +42 -0
- package/dist/components/ui/menubar/index.js +1 -0
- package/dist/components/ui/navigation-menu/index.cjs +1 -0
- package/dist/components/ui/navigation-menu/index.d.ts +20 -0
- package/dist/components/ui/navigation-menu/index.js +1 -0
- package/dist/components/ui/number-field/index.cjs +1 -0
- package/dist/components/ui/number-field/index.d.ts +18 -0
- package/dist/components/ui/number-field/index.js +1 -0
- package/dist/components/ui/toggle-group/index.cjs +1 -0
- package/dist/components/ui/toggle-group/index.d.ts +13 -0
- package/dist/components/ui/toggle-group/index.js +1 -0
- package/dist/components/ui/toolbar/index.cjs +1 -0
- package/dist/components/ui/toolbar/index.d.ts +14 -0
- package/dist/components/ui/toolbar/index.js +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/src/components/charts/progress-circle.cjs +1 -1
- package/dist/src/components/charts/progress-circle.js +57 -3
- package/dist/src/components/data-table/data-table.cjs +1 -1
- package/dist/src/components/data-table/data-table.js +102 -100
- package/dist/src/components/feedback/index.cjs +1 -1
- package/dist/src/components/feedback/index.js +2 -4
- package/dist/src/components/layout/index.cjs +1 -1
- package/dist/src/components/layout/index.js +3 -3
- package/dist/src/components/layout/public.cjs +1 -1
- package/dist/src/components/layout/public.js +3 -3
- package/dist/src/components/layout/section.cjs +1 -1
- package/dist/src/components/layout/section.js +2 -26
- package/dist/src/components/patterns/index.cjs +1 -1
- package/dist/src/components/patterns/index.js +2 -10
- package/dist/src/components/patterns/public.cjs +1 -1
- package/dist/src/components/patterns/public.js +2 -10
- package/dist/src/components/ui/hover-card/index.cjs +1 -0
- package/dist/src/components/ui/hover-card/index.js +50 -0
- package/dist/src/components/ui/menubar/index.cjs +1 -0
- package/dist/src/components/ui/menubar/index.js +132 -0
- package/dist/src/components/ui/navigation-menu/index.cjs +1 -0
- package/dist/src/components/ui/navigation-menu/index.js +73 -0
- package/dist/src/components/ui/number-field/index.cjs +1 -0
- package/dist/src/components/ui/number-field/index.js +73 -0
- package/dist/src/components/ui/toggle-group/index.cjs +1 -0
- package/dist/src/components/ui/toggle-group/index.js +32 -0
- package/dist/src/components/ui/toolbar/index.cjs +1 -0
- package/dist/src/components/ui/toolbar/index.js +50 -0
- package/dist/src/index.cjs +1 -1
- package/dist/src/index.js +92 -95
- package/dist/src/public-component-surface.cjs +1 -1
- package/dist/src/public-component-surface.js +31 -42
- package/package.json +1 -1
- package/packages/cli/dist/index.cjs +112 -112
- package/packages/cli/vendor/src/components/charts/progress-circle.tsx +78 -3
- package/packages/cli/vendor/src/components/data-table/data-table.tsx +4 -4
- package/packages/cli/vendor/src/components/feedback/index.ts +0 -2
- package/packages/cli/vendor/src/components/layout/section.tsx +1 -28
- package/packages/cli/vendor/src/components/patterns/index.ts +0 -8
- package/packages/cli/vendor/src/components/patterns/public.ts +0 -8
- package/packages/cli/vendor/src/components/ui/hover-card/index.tsx +72 -0
- package/packages/cli/vendor/src/components/ui/menubar/index.tsx +140 -0
- package/packages/cli/vendor/src/components/ui/navigation-menu/index.tsx +100 -0
- package/packages/cli/vendor/src/components/ui/number-field/index.tsx +89 -0
- package/packages/cli/vendor/src/components/ui/toggle-group/index.tsx +72 -0
- package/packages/cli/vendor/src/components/ui/toolbar/index.tsx +67 -0
- package/packages/cli/vendor/src/index.ts +12 -5
- package/packages/cli/vendor/src/public-component-surface.ts +7 -10
- package/packages/cli/vendor/templates/showcase/src/showcase/data/registry.ts +14 -12
- package/packages/cli/vendor/templates/showcase/src/showcase/layout/HeroSection.tsx +2 -2
- package/packages/cli/vendor/templates/showcase/src/showcase/layout/WorkbenchSidebar.tsx +1 -1
- package/packages/cli/vendor/templates/showcase/src/showcase/sections/ComponentLivePreview.tsx +2 -2
- package/packages/cli/vendor/templates/showcase/src/showcase/sections/FormsSection.tsx +2 -2
- package/packages/cli/vendor/templates/styles/globals.css +5 -5
- package/registry.json +2630 -233
- package/dist/components/charts/progress-ring.cjs +0 -1
- package/dist/components/charts/progress-ring.d.ts +0 -13
- package/dist/components/charts/progress-ring.js +0 -1
- package/dist/components/feedback/loading-state.cjs +0 -1
- package/dist/components/feedback/loading-state.d.ts +0 -9
- package/dist/components/feedback/loading-state.js +0 -1
- package/dist/components/feedback/page-state.cjs +0 -1
- package/dist/components/feedback/page-state.d.ts +0 -18
- package/dist/components/feedback/page-state.js +0 -1
- package/dist/components/layout/page-container.cjs +0 -1
- package/dist/components/layout/page-container.d.ts +0 -7
- package/dist/components/layout/page-container.js +0 -1
- package/dist/components/layout/page-header.cjs +0 -1
- package/dist/components/layout/page-header.d.ts +0 -23
- package/dist/components/layout/page-header.js +0 -1
- package/dist/components/layout/section-header.cjs +0 -1
- package/dist/components/layout/section-header.d.ts +0 -14
- package/dist/components/layout/section-header.js +0 -1
- package/dist/components/layout/sidebar-nav.cjs +0 -1
- package/dist/components/layout/sidebar-nav.d.ts +0 -37
- package/dist/components/layout/sidebar-nav.js +0 -1
- package/dist/components/layout/sticky-footer-bar.cjs +0 -1
- package/dist/components/layout/sticky-footer-bar.d.ts +0 -7
- package/dist/components/layout/sticky-footer-bar.js +0 -1
- package/dist/components/patterns/bulk-action-bar.cjs +0 -1
- package/dist/components/patterns/bulk-action-bar.d.ts +0 -10
- package/dist/components/patterns/bulk-action-bar.js +0 -1
- package/dist/components/patterns/data-view.cjs +0 -1
- package/dist/components/patterns/data-view.d.ts +0 -17
- package/dist/components/patterns/data-view.js +0 -1
- package/dist/components/patterns/detail-layout.cjs +0 -1
- package/dist/components/patterns/detail-layout.d.ts +0 -16
- package/dist/components/patterns/detail-layout.js +0 -1
- package/dist/components/patterns/form-builder.cjs +0 -1
- package/dist/components/patterns/form-builder.d.ts +0 -110
- package/dist/components/patterns/form-builder.js +0 -1
- package/dist/components/patterns/page-toolbar.cjs +0 -1
- package/dist/components/patterns/page-toolbar.d.ts +0 -11
- package/dist/components/patterns/page-toolbar.js +0 -1
- package/dist/components/patterns/resource-detail-page.cjs +0 -1
- package/dist/components/patterns/resource-detail-page.d.ts +0 -39
- package/dist/components/patterns/resource-detail-page.js +0 -1
- package/dist/components/patterns/resource-page.cjs +0 -1
- package/dist/components/patterns/resource-page.d.ts +0 -30
- package/dist/components/patterns/resource-page.js +0 -1
- package/dist/components/patterns/settings-page.cjs +0 -1
- package/dist/components/patterns/settings-page.d.ts +0 -21
- package/dist/components/patterns/settings-page.js +0 -1
- package/dist/src/components/charts/progress-ring.cjs +0 -1
- package/dist/src/components/charts/progress-ring.js +0 -57
- package/dist/src/components/feedback/loading-state.cjs +0 -1
- package/dist/src/components/feedback/loading-state.js +0 -15
- package/dist/src/components/feedback/page-state.cjs +0 -1
- package/dist/src/components/feedback/page-state.js +0 -28
- package/dist/src/components/layout/page-container.cjs +0 -1
- package/dist/src/components/layout/page-container.js +0 -21
- package/dist/src/components/layout/page-header.cjs +0 -1
- package/dist/src/components/layout/page-header.js +0 -92
- package/dist/src/components/layout/section-header.cjs +0 -1
- package/dist/src/components/layout/section-header.js +0 -44
- package/dist/src/components/layout/sidebar-nav.cjs +0 -1
- package/dist/src/components/layout/sidebar-nav.js +0 -220
- package/dist/src/components/layout/sticky-footer-bar.cjs +0 -1
- package/dist/src/components/layout/sticky-footer-bar.js +0 -20
- package/dist/src/components/patterns/bulk-action-bar.cjs +0 -1
- package/dist/src/components/patterns/bulk-action-bar.js +0 -34
- package/dist/src/components/patterns/data-view.cjs +0 -1
- package/dist/src/components/patterns/data-view.js +0 -47
- package/dist/src/components/patterns/detail-layout.cjs +0 -1
- package/dist/src/components/patterns/detail-layout.js +0 -65
- package/dist/src/components/patterns/form-builder.cjs +0 -1
- package/dist/src/components/patterns/form-builder.js +0 -263
- package/dist/src/components/patterns/page-toolbar.cjs +0 -1
- package/dist/src/components/patterns/page-toolbar.js +0 -41
- package/dist/src/components/patterns/resource-detail-page.cjs +0 -1
- package/dist/src/components/patterns/resource-detail-page.js +0 -100
- package/dist/src/components/patterns/resource-page.cjs +0 -1
- package/dist/src/components/patterns/resource-page.js +0 -88
- package/dist/src/components/patterns/settings-page.cjs +0 -1
- package/dist/src/components/patterns/settings-page.js +0 -64
- package/packages/cli/vendor/src/components/charts/progress-ring.tsx +0 -56
- package/packages/cli/vendor/src/components/feedback/loading-state.tsx +0 -15
- package/packages/cli/vendor/src/components/feedback/page-state.tsx +0 -29
- package/packages/cli/vendor/src/components/layout/page-container.tsx +0 -30
- package/packages/cli/vendor/src/components/layout/page-header.tsx +0 -104
- package/packages/cli/vendor/src/components/layout/section-header.tsx +0 -56
- package/packages/cli/vendor/src/components/layout/sidebar-nav.tsx +0 -377
- package/packages/cli/vendor/src/components/layout/sticky-footer-bar.tsx +0 -23
- package/packages/cli/vendor/src/components/patterns/bulk-action-bar.tsx +0 -53
- package/packages/cli/vendor/src/components/patterns/data-view.tsx +0 -64
- package/packages/cli/vendor/src/components/patterns/detail-layout.tsx +0 -75
- package/packages/cli/vendor/src/components/patterns/form-builder.tsx +0 -472
- package/packages/cli/vendor/src/components/patterns/page-toolbar.tsx +0 -61
- package/packages/cli/vendor/src/components/patterns/resource-detail-page.tsx +0 -164
- package/packages/cli/vendor/src/components/patterns/resource-page.tsx +0 -149
- package/packages/cli/vendor/src/components/patterns/settings-page.tsx +0 -84
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
import { Button } from "@/components/ui/button"
|
|
4
|
-
import { DescriptionList, type DescriptionListItem } from "@/components/display/description-list"
|
|
5
|
-
import { PageHeader, type PageHeaderProps } from "@/components/layout/page-header"
|
|
6
|
-
import { cn } from "@/lib/utils"
|
|
7
|
-
|
|
8
|
-
export type ResourceDetailPageDensity = "default" | "compact" | "comfortable"
|
|
9
|
-
|
|
10
|
-
export type ResourceDetailPageSection = {
|
|
11
|
-
id: string
|
|
12
|
-
title?: React.ReactNode
|
|
13
|
-
description?: React.ReactNode
|
|
14
|
-
actions?: React.ReactNode
|
|
15
|
-
hidden?: boolean
|
|
16
|
-
className?: string
|
|
17
|
-
bodyClassName?: string
|
|
18
|
-
items?: DescriptionListItem[]
|
|
19
|
-
children?: React.ReactNode
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type ResourceDetailPageProps = Omit<React.ComponentProps<"div">, "children"> & {
|
|
23
|
-
title?: React.ReactNode
|
|
24
|
-
description?: React.ReactNode
|
|
25
|
-
eyebrow?: React.ReactNode
|
|
26
|
-
actions?: React.ReactNode
|
|
27
|
-
breadcrumbs?: React.ReactNode
|
|
28
|
-
status?: React.ReactNode
|
|
29
|
-
summary?: React.ReactNode
|
|
30
|
-
meta?: React.ReactNode
|
|
31
|
-
sections?: ResourceDetailPageSection[]
|
|
32
|
-
children?: React.ReactNode
|
|
33
|
-
aside?: React.ReactNode
|
|
34
|
-
footer?: React.ReactNode
|
|
35
|
-
backLabel?: React.ReactNode
|
|
36
|
-
onBack?: () => void
|
|
37
|
-
headerProps?: Omit<PageHeaderProps, "title" | "description" | "actions" | "eyebrow">
|
|
38
|
-
density?: ResourceDetailPageDensity
|
|
39
|
-
pageHeaderClassName?: string
|
|
40
|
-
contentClassName?: string
|
|
41
|
-
asideClassName?: string
|
|
42
|
-
sectionClassName?: string
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const densityClassName: Record<ResourceDetailPageDensity, string> = {
|
|
46
|
-
compact: "gap-3",
|
|
47
|
-
default: "gap-4",
|
|
48
|
-
comfortable: "gap-6",
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function ResourceDetailPage({
|
|
52
|
-
className,
|
|
53
|
-
title,
|
|
54
|
-
description,
|
|
55
|
-
eyebrow,
|
|
56
|
-
actions,
|
|
57
|
-
breadcrumbs,
|
|
58
|
-
status,
|
|
59
|
-
summary,
|
|
60
|
-
meta,
|
|
61
|
-
sections,
|
|
62
|
-
children,
|
|
63
|
-
aside,
|
|
64
|
-
footer,
|
|
65
|
-
backLabel = "Back",
|
|
66
|
-
onBack,
|
|
67
|
-
headerProps,
|
|
68
|
-
density = "default",
|
|
69
|
-
pageHeaderClassName,
|
|
70
|
-
contentClassName,
|
|
71
|
-
asideClassName,
|
|
72
|
-
sectionClassName,
|
|
73
|
-
...props
|
|
74
|
-
}: ResourceDetailPageProps) {
|
|
75
|
-
const visibleSections = sections?.filter((section) => !section.hidden) ?? []
|
|
76
|
-
const hasHeader = Boolean(title || description || eyebrow || actions || onBack)
|
|
77
|
-
const headerActions = onBack || actions ? (
|
|
78
|
-
<>
|
|
79
|
-
{onBack && (
|
|
80
|
-
<Button type="button" variant="outline" onClick={onBack}>
|
|
81
|
-
{backLabel}
|
|
82
|
-
</Button>
|
|
83
|
-
)}
|
|
84
|
-
{actions}
|
|
85
|
-
</>
|
|
86
|
-
) : undefined
|
|
87
|
-
const hasMainContent = Boolean(children || visibleSections.length > 0)
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<div
|
|
91
|
-
data-slot="resource-detail-page"
|
|
92
|
-
data-density={density}
|
|
93
|
-
className={cn("grid min-w-0", densityClassName[density], className)}
|
|
94
|
-
{...props}
|
|
95
|
-
>
|
|
96
|
-
{breadcrumbs && <div data-slot="resource-detail-page-breadcrumbs">{breadcrumbs}</div>}
|
|
97
|
-
|
|
98
|
-
{hasHeader && (
|
|
99
|
-
<PageHeader
|
|
100
|
-
data-slot="resource-detail-page-header"
|
|
101
|
-
eyebrow={eyebrow}
|
|
102
|
-
title={title}
|
|
103
|
-
description={description}
|
|
104
|
-
actions={headerActions}
|
|
105
|
-
className={pageHeaderClassName}
|
|
106
|
-
{...headerProps}
|
|
107
|
-
/>
|
|
108
|
-
)}
|
|
109
|
-
|
|
110
|
-
{(status || summary || meta) && (
|
|
111
|
-
<div data-slot="resource-detail-page-summary" className="grid gap-3 lg:grid-cols-[minmax(0,1fr)_auto]">
|
|
112
|
-
<div className="grid min-w-0 gap-3">
|
|
113
|
-
{status && <div data-slot="resource-detail-page-status">{status}</div>}
|
|
114
|
-
{summary && <div data-slot="resource-detail-page-summary-content">{summary}</div>}
|
|
115
|
-
</div>
|
|
116
|
-
{meta && <div data-slot="resource-detail-page-meta" className="min-w-0 lg:w-80">{meta}</div>}
|
|
117
|
-
</div>
|
|
118
|
-
)}
|
|
119
|
-
|
|
120
|
-
{(hasMainContent || aside) && (
|
|
121
|
-
<div
|
|
122
|
-
data-slot="resource-detail-page-content"
|
|
123
|
-
className={cn("grid min-w-0 gap-4", aside && "xl:grid-cols-[minmax(0,1fr)_20rem]", contentClassName)}
|
|
124
|
-
>
|
|
125
|
-
<div data-slot="resource-detail-page-main" className="grid min-w-0 gap-4">
|
|
126
|
-
{children}
|
|
127
|
-
|
|
128
|
-
{visibleSections.map((section) => (
|
|
129
|
-
<section
|
|
130
|
-
key={section.id}
|
|
131
|
-
data-slot="resource-detail-page-section"
|
|
132
|
-
className={cn("rounded-xl border bg-card text-card-foreground shadow-sm", section.className, sectionClassName)}
|
|
133
|
-
>
|
|
134
|
-
{(section.title || section.description || section.actions) && (
|
|
135
|
-
<div className="flex flex-col gap-3 border-b p-4 sm:flex-row sm:items-start sm:justify-between">
|
|
136
|
-
<div className="min-w-0 space-y-1">
|
|
137
|
-
{section.title && <h2 className="text-base font-semibold leading-none tracking-tight">{section.title}</h2>}
|
|
138
|
-
{section.description && <p className="text-sm text-muted-foreground">{section.description}</p>}
|
|
139
|
-
</div>
|
|
140
|
-
{section.actions && <div className="flex shrink-0 flex-wrap items-center gap-2">{section.actions}</div>}
|
|
141
|
-
</div>
|
|
142
|
-
)}
|
|
143
|
-
|
|
144
|
-
<div className={cn("p-4", section.bodyClassName)}>
|
|
145
|
-
{section.children ?? (section.items ? <DescriptionList items={section.items} /> : null)}
|
|
146
|
-
</div>
|
|
147
|
-
</section>
|
|
148
|
-
))}
|
|
149
|
-
</div>
|
|
150
|
-
|
|
151
|
-
{aside && (
|
|
152
|
-
<aside data-slot="resource-detail-page-aside" className={cn("min-w-0", asideClassName)}>
|
|
153
|
-
{aside}
|
|
154
|
-
</aside>
|
|
155
|
-
)}
|
|
156
|
-
</div>
|
|
157
|
-
)}
|
|
158
|
-
|
|
159
|
-
{footer && <div data-slot="resource-detail-page-footer">{footer}</div>}
|
|
160
|
-
</div>
|
|
161
|
-
)
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export { ResourceDetailPage }
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
import { DataTable, type DataTableProps } from "@/components/data-table/data-table"
|
|
4
|
-
import { PageHeader, type PageHeaderProps } from "@/components/layout/page-header"
|
|
5
|
-
import { Section, type SectionProps } from "@/components/layout/section"
|
|
6
|
-
import { cn } from "@/lib/utils"
|
|
7
|
-
|
|
8
|
-
export type ResourcePageDensity = "default" | "compact" | "comfortable"
|
|
9
|
-
|
|
10
|
-
export type ResourcePageSectionProps = Omit<SectionProps, "variant">
|
|
11
|
-
|
|
12
|
-
function ResourcePageSection({
|
|
13
|
-
className,
|
|
14
|
-
title,
|
|
15
|
-
description,
|
|
16
|
-
actions,
|
|
17
|
-
headerClassName,
|
|
18
|
-
bodyClassName,
|
|
19
|
-
children,
|
|
20
|
-
...props
|
|
21
|
-
}: ResourcePageSectionProps) {
|
|
22
|
-
return (
|
|
23
|
-
<Section
|
|
24
|
-
data-slot="resource-page-section"
|
|
25
|
-
variant="panel"
|
|
26
|
-
title={title}
|
|
27
|
-
description={description}
|
|
28
|
-
actions={actions}
|
|
29
|
-
headerClassName={headerClassName}
|
|
30
|
-
bodyClassName={bodyClassName}
|
|
31
|
-
className={className}
|
|
32
|
-
{...props}
|
|
33
|
-
>
|
|
34
|
-
{children}
|
|
35
|
-
</Section>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export type ResourcePageProps<TData, TValue = unknown> = Omit<React.ComponentProps<"div">, "children"> & {
|
|
40
|
-
title?: React.ReactNode
|
|
41
|
-
description?: React.ReactNode
|
|
42
|
-
eyebrow?: React.ReactNode
|
|
43
|
-
actions?: React.ReactNode
|
|
44
|
-
breadcrumbs?: React.ReactNode
|
|
45
|
-
stats?: React.ReactNode
|
|
46
|
-
filters?: React.ReactNode
|
|
47
|
-
tabs?: React.ReactNode
|
|
48
|
-
table?: DataTableProps<TData, TValue>
|
|
49
|
-
children?: React.ReactNode
|
|
50
|
-
aside?: React.ReactNode
|
|
51
|
-
footer?: React.ReactNode
|
|
52
|
-
headerProps?: Omit<PageHeaderProps, "title" | "description" | "actions" | "eyebrow">
|
|
53
|
-
density?: ResourcePageDensity
|
|
54
|
-
pageHeaderClassName?: string
|
|
55
|
-
toolbarClassName?: string
|
|
56
|
-
contentClassName?: string
|
|
57
|
-
asideClassName?: string
|
|
58
|
-
asideWidth?: React.CSSProperties["width"]
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const densityClassName: Record<ResourcePageDensity, string> = {
|
|
62
|
-
compact: "gap-3",
|
|
63
|
-
default: "gap-4",
|
|
64
|
-
comfortable: "gap-6",
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function ResourcePage<TData, TValue = unknown>({
|
|
68
|
-
className,
|
|
69
|
-
title,
|
|
70
|
-
description,
|
|
71
|
-
eyebrow,
|
|
72
|
-
actions,
|
|
73
|
-
breadcrumbs,
|
|
74
|
-
stats,
|
|
75
|
-
filters,
|
|
76
|
-
tabs,
|
|
77
|
-
table,
|
|
78
|
-
children,
|
|
79
|
-
aside,
|
|
80
|
-
footer,
|
|
81
|
-
headerProps,
|
|
82
|
-
density = "default",
|
|
83
|
-
pageHeaderClassName,
|
|
84
|
-
toolbarClassName,
|
|
85
|
-
contentClassName,
|
|
86
|
-
asideClassName,
|
|
87
|
-
asideWidth = "20rem",
|
|
88
|
-
style,
|
|
89
|
-
...props
|
|
90
|
-
}: ResourcePageProps<TData, TValue>) {
|
|
91
|
-
const hasHeader = Boolean(title || description || eyebrow || actions)
|
|
92
|
-
const hasToolbar = Boolean(filters || tabs)
|
|
93
|
-
const hasMainContent = Boolean(children || table)
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<div
|
|
97
|
-
data-slot="resource-page"
|
|
98
|
-
data-density={density}
|
|
99
|
-
className={cn("grid min-w-0", densityClassName[density], className)}
|
|
100
|
-
style={{ "--resource-aside-width": asideWidth, ...style } as React.CSSProperties}
|
|
101
|
-
{...props}
|
|
102
|
-
>
|
|
103
|
-
{breadcrumbs && <div data-slot="resource-page-breadcrumbs">{breadcrumbs}</div>}
|
|
104
|
-
|
|
105
|
-
{hasHeader && (
|
|
106
|
-
<PageHeader
|
|
107
|
-
data-slot="resource-page-header"
|
|
108
|
-
eyebrow={eyebrow}
|
|
109
|
-
title={title}
|
|
110
|
-
description={description}
|
|
111
|
-
actions={actions}
|
|
112
|
-
className={pageHeaderClassName}
|
|
113
|
-
{...headerProps}
|
|
114
|
-
/>
|
|
115
|
-
)}
|
|
116
|
-
|
|
117
|
-
{stats && <div data-slot="resource-page-stats">{stats}</div>}
|
|
118
|
-
|
|
119
|
-
{hasToolbar && (
|
|
120
|
-
<div data-slot="resource-page-toolbar" className={cn("grid gap-3", toolbarClassName)}>
|
|
121
|
-
{tabs && <div data-slot="resource-page-tabs">{tabs}</div>}
|
|
122
|
-
{filters && <div data-slot="resource-page-filters">{filters}</div>}
|
|
123
|
-
</div>
|
|
124
|
-
)}
|
|
125
|
-
|
|
126
|
-
{(hasMainContent || aside) && (
|
|
127
|
-
<div
|
|
128
|
-
data-slot="resource-page-content"
|
|
129
|
-
className={cn("grid min-w-0 gap-4", aside && "xl:grid-cols-[minmax(0,1fr)_var(--resource-aside-width)]", contentClassName)}
|
|
130
|
-
>
|
|
131
|
-
<div data-slot="resource-page-main" className="grid min-w-0 gap-4">
|
|
132
|
-
{children}
|
|
133
|
-
{table && <DataTable {...table} />}
|
|
134
|
-
</div>
|
|
135
|
-
|
|
136
|
-
{aside && (
|
|
137
|
-
<aside data-slot="resource-page-aside" className={cn("min-w-0", asideClassName)}>
|
|
138
|
-
{aside}
|
|
139
|
-
</aside>
|
|
140
|
-
)}
|
|
141
|
-
</div>
|
|
142
|
-
)}
|
|
143
|
-
|
|
144
|
-
{footer && <div data-slot="resource-page-footer">{footer}</div>}
|
|
145
|
-
</div>
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export { ResourcePage, ResourcePageSection }
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
|
|
3
|
-
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
|
|
4
|
-
import { cn } from "@/lib/utils"
|
|
5
|
-
|
|
6
|
-
export type SettingsPageSection = {
|
|
7
|
-
value: string
|
|
8
|
-
label: React.ReactNode
|
|
9
|
-
description?: React.ReactNode
|
|
10
|
-
disabled?: boolean
|
|
11
|
-
content: React.ReactNode
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type SettingsPageProps = Omit<React.ComponentProps<"div">, "children"> & {
|
|
15
|
-
title?: React.ReactNode
|
|
16
|
-
description?: React.ReactNode
|
|
17
|
-
actions?: React.ReactNode
|
|
18
|
-
sections: SettingsPageSection[]
|
|
19
|
-
defaultValue?: string
|
|
20
|
-
value?: string
|
|
21
|
-
onValueChange?: (value: string) => void
|
|
22
|
-
navClassName?: string
|
|
23
|
-
contentClassName?: string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function SettingsPage({
|
|
27
|
-
className,
|
|
28
|
-
title,
|
|
29
|
-
description,
|
|
30
|
-
actions,
|
|
31
|
-
sections,
|
|
32
|
-
defaultValue,
|
|
33
|
-
value,
|
|
34
|
-
onValueChange,
|
|
35
|
-
navClassName,
|
|
36
|
-
contentClassName,
|
|
37
|
-
...props
|
|
38
|
-
}: SettingsPageProps) {
|
|
39
|
-
const firstEnabled = sections.find((section) => !section.disabled)
|
|
40
|
-
const resolvedDefaultValue = defaultValue ?? firstEnabled?.value
|
|
41
|
-
const hasHeader = Boolean(title || description || actions)
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div data-slot="settings-page" className={cn("grid min-w-0 gap-5", className)} {...props}>
|
|
45
|
-
{hasHeader && (
|
|
46
|
-
<div data-slot="settings-page-header" className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
|
|
47
|
-
<div className="grid min-w-0 gap-1">
|
|
48
|
-
{title && <h1 className="text-2xl font-semibold tracking-tight">{title}</h1>}
|
|
49
|
-
{description && <p className="max-w-3xl text-sm leading-6 text-muted-foreground">{description}</p>}
|
|
50
|
-
</div>
|
|
51
|
-
{actions && <div className="flex shrink-0 flex-wrap items-center gap-2">{actions}</div>}
|
|
52
|
-
</div>
|
|
53
|
-
)}
|
|
54
|
-
<Tabs value={value} defaultValue={resolvedDefaultValue} onValueChange={onValueChange}>
|
|
55
|
-
<div className="grid gap-4 lg:grid-cols-[16rem_minmax(0,1fr)]">
|
|
56
|
-
<TabsList className={cn("h-auto w-full flex-col items-stretch justify-start gap-1 p-1", navClassName)}>
|
|
57
|
-
{sections.map((section) => (
|
|
58
|
-
<TabsTrigger
|
|
59
|
-
key={section.value}
|
|
60
|
-
value={section.value}
|
|
61
|
-
disabled={section.disabled}
|
|
62
|
-
className="w-full justify-start"
|
|
63
|
-
>
|
|
64
|
-
<span className="grid min-w-0 gap-0.5 text-left">
|
|
65
|
-
<span className="truncate">{section.label}</span>
|
|
66
|
-
{section.description && <span className="truncate text-xs font-normal text-muted-foreground">{section.description}</span>}
|
|
67
|
-
</span>
|
|
68
|
-
</TabsTrigger>
|
|
69
|
-
))}
|
|
70
|
-
</TabsList>
|
|
71
|
-
<div data-slot="settings-page-content" className={cn("min-w-0", contentClassName)}>
|
|
72
|
-
{sections.map((section) => (
|
|
73
|
-
<TabsContent key={section.value} value={section.value}>
|
|
74
|
-
{section.content}
|
|
75
|
-
</TabsContent>
|
|
76
|
-
))}
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
</Tabs>
|
|
80
|
-
</div>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export { SettingsPage }
|