@exxatdesignux/ui 0.0.6 → 0.0.8
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/bin/init.mjs +29 -0
- package/package.json +7 -2
- package/template/.nvmrc +1 -0
- package/template/.prettierignore +7 -0
- package/template/.prettierrc +11 -0
- package/template/AGENTS.md +485 -0
- package/template/Logo/Exxat_Prism.svg +39 -0
- package/template/Logo/Exxat_one.svg +36 -0
- package/template/README.md +58 -0
- package/template/app/(app)/compliance/page.tsx +10 -0
- package/template/app/(app)/dashboard/loading.tsx +18 -0
- package/template/app/(app)/dashboard/page.tsx +36 -0
- package/template/app/(app)/data-list/[id]/page.tsx +28 -0
- package/template/app/(app)/data-list/new/page.tsx +31 -0
- package/template/app/(app)/data-list/page.tsx +10 -0
- package/template/app/(app)/error.tsx +43 -0
- package/template/app/(app)/help/page.tsx +34 -0
- package/template/app/(app)/layout.tsx +54 -0
- package/template/app/(app)/loading.tsx +18 -0
- package/template/app/(app)/question-bank/page.tsx +10 -0
- package/template/app/(app)/rotations/page.tsx +15 -0
- package/template/app/(app)/settings/page.tsx +17 -0
- package/template/app/(app)/sites/all/page.tsx +13 -0
- package/template/app/(app)/team/page.tsx +10 -0
- package/template/app/favicon.ico +0 -0
- package/template/app/globals.css +1811 -0
- package/template/app/layout.tsx +95 -0
- package/template/app/page.tsx +9 -0
- package/template/components/.gitkeep +0 -0
- package/template/components/app-sidebar-dynamic.tsx +15 -0
- package/template/components/app-sidebar.tsx +901 -0
- package/template/components/ask-leo-composer.tsx +216 -0
- package/template/components/ask-leo-sidebar.tsx +509 -0
- package/template/components/chart-area-interactive.tsx +293 -0
- package/template/components/charts-overview.tsx +2321 -0
- package/template/components/command-menu-01.tsx +133 -0
- package/template/components/command-menu-02.tsx +386 -0
- package/template/components/command-menu.tsx +182 -0
- package/template/components/compliance-board-view.tsx +134 -0
- package/template/components/compliance-client.tsx +92 -0
- package/template/components/compliance-list-view.tsx +59 -0
- package/template/components/compliance-page-header.tsx +89 -0
- package/template/components/compliance-table.tsx +525 -0
- package/template/components/dashboard-onboarding-gallery.tsx +13 -0
- package/template/components/dashboard-onboarding.tsx +21 -0
- package/template/components/dashboard-promo-banner.tsx +67 -0
- package/template/components/dashboard-quota-progress-card.tsx +369 -0
- package/template/components/dashboard-report-charts.tsx +69 -0
- package/template/components/dashboard-section-heading.tsx +68 -0
- package/template/components/dashboard-tabs.tsx +598 -0
- package/template/components/data-list-client.tsx +239 -0
- package/template/components/data-list-table-cells.test.tsx +22 -0
- package/template/components/data-list-table-cells.tsx +173 -0
- package/template/components/data-list-table.tsx +879 -0
- package/template/components/data-table/filter-date-calendar.tsx +38 -0
- package/template/components/data-table/filter-text-value-input.tsx +77 -0
- package/template/components/data-table/index.tsx +1612 -0
- package/template/components/data-table/pagination.tsx +256 -0
- package/template/components/data-table/types.ts +91 -0
- package/template/components/data-table/use-table-state.ts +566 -0
- package/template/components/data-view-dashboard-charts-compliance.tsx +960 -0
- package/template/components/data-view-dashboard-charts-team.tsx +968 -0
- package/template/components/data-view-dashboard-charts.tsx +1668 -0
- package/template/components/data-views/board-card-primitives.tsx +93 -0
- package/template/components/data-views/index.ts +41 -0
- package/template/components/data-views/list-page-board-card.tsx +192 -0
- package/template/components/data-views/list-page-board-template.tsx +122 -0
- package/template/components/data-views/placement-board-card.tsx +262 -0
- package/template/components/export-drawer.tsx +375 -0
- package/template/components/exxat-product-logo.tsx +453 -0
- package/template/components/form-layout-01.tsx +131 -0
- package/template/components/getting-started.tsx +625 -0
- package/template/components/key-metrics.tsx +920 -0
- package/template/components/leo-insight-indicator.tsx +364 -0
- package/template/components/leo-typing-dots.tsx +121 -0
- package/template/components/list-hub-status-badge.tsx +51 -0
- package/template/components/list-page-dashboard-charts.tsx +18 -0
- package/template/components/nav-documents.tsx +89 -0
- package/template/components/nav-main.tsx +58 -0
- package/template/components/nav-secondary.tsx +64 -0
- package/template/components/nav-user.tsx +190 -0
- package/template/components/new-placement-back-btn.tsx +28 -0
- package/template/components/new-placement-form.tsx +1066 -0
- package/template/components/onboarding/index.ts +4 -0
- package/template/components/onboarding/onboarding-01.tsx +7 -0
- package/template/components/onboarding/onboarding-02.tsx +7 -0
- package/template/components/onboarding/onboarding-03.tsx +7 -0
- package/template/components/onboarding/onboarding-04.tsx +7 -0
- package/template/components/page-header.tsx +57 -0
- package/template/components/placement-detail.tsx +438 -0
- package/template/components/placements-board-view.tsx +404 -0
- package/template/components/placements-list-view.tsx +285 -0
- package/template/components/placements-page-header.tsx +160 -0
- package/template/components/placements-table-columns.tsx +639 -0
- package/template/components/product-switcher.tsx +116 -0
- package/template/components/question-bank-board-view.tsx +205 -0
- package/template/components/question-bank-client.tsx +77 -0
- package/template/components/question-bank-list-view.tsx +59 -0
- package/template/components/question-bank-page-header.tsx +89 -0
- package/template/components/question-bank-table.tsx +586 -0
- package/template/components/rotations-empty-state.tsx +47 -0
- package/template/components/rotations-panel-activator.tsx +8 -0
- package/template/components/secondary-nav.tsx +394 -0
- package/template/components/secondary-panel.tsx +239 -0
- package/template/components/section-cards.tsx +106 -0
- package/template/components/settings-appearance-card.tsx +424 -0
- package/template/components/settings-client.tsx +537 -0
- package/template/components/settings-form-row.tsx +42 -0
- package/template/components/sidebar-auto-collapse.tsx +23 -0
- package/template/components/sidebar-auto-open.tsx +18 -0
- package/template/components/sidebar-shell.tsx +37 -0
- package/template/components/site-header.tsx +93 -0
- package/template/components/sites-all-client.tsx +154 -0
- package/template/components/sites-board-view.tsx +67 -0
- package/template/components/sites-list-view.tsx +47 -0
- package/template/components/sites-table.tsx +312 -0
- package/template/components/system-banner-slot.tsx +66 -0
- package/template/components/table-properties/column-row.tsx +90 -0
- package/template/components/table-properties/draggable-list.ts +49 -0
- package/template/components/table-properties/drawer-button.tsx +231 -0
- package/template/components/table-properties/drawer.tsx +1102 -0
- package/template/components/table-properties/filter-card.tsx +251 -0
- package/template/components/table-properties/index.ts +22 -0
- package/template/components/table-properties/sort-card.tsx +59 -0
- package/template/components/table-properties/types.ts +124 -0
- package/template/components/task-list-panel.tsx +98 -0
- package/template/components/task-priority-badge.tsx +28 -0
- package/template/components/team-board-view.tsx +114 -0
- package/template/components/team-client.tsx +93 -0
- package/template/components/team-list-view.tsx +62 -0
- package/template/components/team-page-header.tsx +92 -0
- package/template/components/team-table.tsx +525 -0
- package/template/components/templates/list-page.tsx +576 -0
- package/template/components/templates/primary-page-template.tsx +56 -0
- package/template/components/theme-color-sync.tsx +32 -0
- package/template/components/theme-provider.tsx +71 -0
- package/template/components/tinted-icon-disc.tsx +53 -0
- package/template/components/ui/ai-thinking-surface.tsx +121 -0
- package/template/components/ui/avatar.tsx +1 -0
- package/template/components/ui/badge.tsx +1 -0
- package/template/components/ui/banner.tsx +1 -0
- package/template/components/ui/breadcrumb.tsx +1 -0
- package/template/components/ui/button.tsx +1 -0
- package/template/components/ui/calendar.tsx +1 -0
- package/template/components/ui/card.tsx +1 -0
- package/template/components/ui/chart.tsx +1 -0
- package/template/components/ui/checkbox.tsx +1 -0
- package/template/components/ui/coach-mark.tsx +1 -0
- package/template/components/ui/collapsible.tsx +1 -0
- package/template/components/ui/command.tsx +1 -0
- package/template/components/ui/date-picker-field.tsx +1 -0
- package/template/components/ui/dialog.tsx +1 -0
- package/template/components/ui/dot-pattern.tsx +159 -0
- package/template/components/ui/drag-handle-grip.tsx +1 -0
- package/template/components/ui/drawer.tsx +1 -0
- package/template/components/ui/dropdown-menu.tsx +1 -0
- package/template/components/ui/field.tsx +1 -0
- package/template/components/ui/form.tsx +1 -0
- package/template/components/ui/input-group.tsx +1 -0
- package/template/components/ui/input-mask.tsx +1 -0
- package/template/components/ui/input.tsx +1 -0
- package/template/components/ui/kbd.tsx +1 -0
- package/template/components/ui/label.tsx +1 -0
- package/template/components/ui/leo-icon.tsx +726 -0
- package/template/components/ui/payment-card-fields.tsx +1 -0
- package/template/components/ui/popover.tsx +1 -0
- package/template/components/ui/radio-group.tsx +1 -0
- package/template/components/ui/select.tsx +1 -0
- package/template/components/ui/selection-tile-grid.tsx +1 -0
- package/template/components/ui/separator.tsx +1 -0
- package/template/components/ui/sheet.tsx +1 -0
- package/template/components/ui/sidebar.tsx +1 -0
- package/template/components/ui/skeleton.tsx +1 -0
- package/template/components/ui/sonner.tsx +1 -0
- package/template/components/ui/status-badge.tsx +1 -0
- package/template/components/ui/table.tsx +1 -0
- package/template/components/ui/tabs.tsx +1 -0
- package/template/components/ui/textarea.tsx +1 -0
- package/template/components/ui/tip.tsx +1 -0
- package/template/components/ui/toggle-group.tsx +1 -0
- package/template/components/ui/toggle-switch.tsx +1 -0
- package/template/components/ui/toggle.tsx +1 -0
- package/template/components/ui/tooltip.tsx +1 -0
- package/template/components/ui/view-segmented-control.tsx +1 -0
- package/template/components.json +27 -0
- package/template/contexts/chart-variant-context.tsx +35 -0
- package/template/contexts/command-menu-context.tsx +28 -0
- package/template/contexts/dashboard-view-context.tsx +35 -0
- package/template/contexts/product-context.tsx +38 -0
- package/template/contexts/system-banner-context.tsx +127 -0
- package/template/docs/command-menu-pattern.md +45 -0
- package/template/docs/data-views-pattern.md +160 -0
- package/template/ecosystem.config.cjs +20 -0
- package/template/eslint.config.mjs +18 -0
- package/template/fontawesome-subset.manifest.json +190 -0
- package/template/hooks/.gitkeep +0 -0
- package/template/hooks/use-app-theme.ts +1 -0
- package/template/hooks/use-coach-mark.ts +1 -0
- package/template/hooks/use-mobile.ts +1 -0
- package/template/hooks/use-mod-key-label.ts +1 -0
- package/template/lib/.gitkeep +0 -0
- package/template/lib/ask-leo-route-context.ts +133 -0
- package/template/lib/chart-keyboard-selection.test.ts +20 -0
- package/template/lib/chart-keyboard-selection.ts +17 -0
- package/template/lib/chart-line-dash.ts +16 -0
- package/template/lib/coach-mark-registry.ts +68 -0
- package/template/lib/command-menu-config.ts +127 -0
- package/template/lib/command-menu-search-data.ts +44 -0
- package/template/lib/conditional-rule-match.ts +32 -0
- package/template/lib/dashboard-customize-coach-mark.ts +18 -0
- package/template/lib/dashboard-layout-merge.ts +63 -0
- package/template/lib/data-list-display-options.ts +35 -0
- package/template/lib/data-list-persistence.ts +280 -0
- package/template/lib/data-list-view-surface.ts +58 -0
- package/template/lib/data-list-view.ts +29 -0
- package/template/lib/data-view-dashboard-storage.ts +101 -0
- package/template/lib/date-filter.ts +8 -0
- package/template/lib/dev-log.test.ts +28 -0
- package/template/lib/dev-log.ts +8 -0
- package/template/lib/editable-target.ts +10 -0
- package/template/lib/floating-sheet-panel.ts +72 -0
- package/template/lib/initials-from-name.ts +7 -0
- package/template/lib/list-page-table-properties.ts +52 -0
- package/template/lib/list-status-badges.ts +168 -0
- package/template/lib/logo-dev.ts +12 -0
- package/template/lib/mock/compliance-kpi.ts +61 -0
- package/template/lib/mock/compliance.ts +146 -0
- package/template/lib/mock/dashboard.ts +105 -0
- package/template/lib/mock/navigation.tsx +231 -0
- package/template/lib/mock/placements-kpi.ts +134 -0
- package/template/lib/mock/placements.ts +183 -0
- package/template/lib/mock/question-bank-kpi.ts +61 -0
- package/template/lib/mock/question-bank.ts +142 -0
- package/template/lib/mock/sites-directory.ts +16 -0
- package/template/lib/mock/sites-kpi.ts +25 -0
- package/template/lib/mock/team-kpi.ts +60 -0
- package/template/lib/mock/team.ts +118 -0
- package/template/lib/motion-ui.ts +17 -0
- package/template/lib/placement-board-card-layout.ts +79 -0
- package/template/lib/placement-lifecycle.ts +5 -0
- package/template/lib/row-height.ts +10 -0
- package/template/lib/stock-portrait.ts +11 -0
- package/template/lib/utils.test.ts +13 -0
- package/template/lib/utils.ts +1 -0
- package/template/next.config.mjs +15 -0
- package/template/package.json +83 -0
- package/template/postcss.config.mjs +8 -0
- package/template/public/.gitkeep +0 -0
- package/template/public/Illustration/Rotation.svg +74 -0
- package/template/public/avatars/user.svg +11 -0
- package/template/public/favicon/favicon.ico +0 -0
- package/template/public/favicon.ico +0 -0
- package/template/public/logos/exxat-one.svg +36 -0
- package/template/public/logos/exxat-prism.svg +39 -0
- package/template/public/mock-schools/emory.svg +4 -0
- package/template/public/mock-schools/rush.svg +4 -0
- package/template/scripts/fontawesome-subset-audit.mjs +190 -0
- package/template/scripts/pm2-startup-macos.sh +13 -0
- package/template/skills-lock.json +10 -0
- package/template/stores/app-store.ts +33 -0
- package/template/tests/setup.ts +1 -0
- package/template/tsconfig.json +35 -0
- package/template/types/react-payment-inputs.d.ts +19 -0
- package/template/vitest.config.ts +18 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Reusable building blocks for kanban / board cards (icon rows, two-line blocks, placeholders).
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as React from "react"
|
|
8
|
+
import { cn } from "@/lib/utils"
|
|
9
|
+
import type { BoardLineCount } from "@/lib/data-list-display-options"
|
|
10
|
+
|
|
11
|
+
export function BoardCardIconRow({
|
|
12
|
+
iconClass,
|
|
13
|
+
children,
|
|
14
|
+
}: {
|
|
15
|
+
iconClass: string
|
|
16
|
+
children: React.ReactNode
|
|
17
|
+
}) {
|
|
18
|
+
return (
|
|
19
|
+
<div className="flex items-start gap-2">
|
|
20
|
+
<i
|
|
21
|
+
className={cn(
|
|
22
|
+
`fa-light ${iconClass} text-xs text-muted-foreground mt-0.5 w-4 shrink-0 text-center`,
|
|
23
|
+
)}
|
|
24
|
+
aria-hidden
|
|
25
|
+
/>
|
|
26
|
+
<div className="min-w-0 flex-1 text-xs leading-snug [&_.text-sm]:text-xs [&_span]:text-xs [&_div]:text-xs">
|
|
27
|
+
{children}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function BoardCardTwoLineBlock({
|
|
34
|
+
iconClass,
|
|
35
|
+
line1,
|
|
36
|
+
line2,
|
|
37
|
+
line2ClassName,
|
|
38
|
+
}: {
|
|
39
|
+
iconClass: string
|
|
40
|
+
line1: React.ReactNode
|
|
41
|
+
/** Omitted for a single-line row (same icon + primary alignment as Placements). */
|
|
42
|
+
line2?: React.ReactNode
|
|
43
|
+
/** Override default muted line-2 (e.g. badges / rich cells). */
|
|
44
|
+
line2ClassName?: string
|
|
45
|
+
}) {
|
|
46
|
+
const showLine2 = line2 !== undefined && line2 !== null
|
|
47
|
+
return (
|
|
48
|
+
<div className="flex items-start gap-2">
|
|
49
|
+
<i
|
|
50
|
+
className={cn(
|
|
51
|
+
`fa-light ${iconClass} text-xs text-muted-foreground mt-0.5 w-4 shrink-0 text-center`,
|
|
52
|
+
)}
|
|
53
|
+
aria-hidden
|
|
54
|
+
/>
|
|
55
|
+
<div className="min-w-0 flex-1">
|
|
56
|
+
<div className="truncate text-xs font-medium text-foreground leading-tight">{line1}</div>
|
|
57
|
+
{showLine2 ? (
|
|
58
|
+
<div
|
|
59
|
+
className={cn(
|
|
60
|
+
"mt-0.5 min-w-0 leading-tight",
|
|
61
|
+
line2ClassName ?? "truncate text-xs text-muted-foreground",
|
|
62
|
+
)}
|
|
63
|
+
>
|
|
64
|
+
{line2}
|
|
65
|
+
</div>
|
|
66
|
+
) : null}
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function lineClampClass(n: BoardLineCount): string {
|
|
73
|
+
const base = "min-w-0 overflow-hidden break-words"
|
|
74
|
+
if (n === 1) return cn(base, "line-clamp-1")
|
|
75
|
+
if (n === 2) return cn(base, "line-clamp-2")
|
|
76
|
+
return cn(base, "line-clamp-3")
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function BoardNewCardPlaceholder({ position }: { position: "above" | "below" }) {
|
|
80
|
+
return (
|
|
81
|
+
<button
|
|
82
|
+
type="button"
|
|
83
|
+
className={cn(
|
|
84
|
+
"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border bg-background/50 py-2 text-xs font-medium text-muted-foreground transition-colors",
|
|
85
|
+
"hover:border-input hover:bg-muted/40 hover:text-foreground",
|
|
86
|
+
position === "above" ? "mb-2" : "mt-2",
|
|
87
|
+
)}
|
|
88
|
+
>
|
|
89
|
+
<i className="fa-light fa-plus text-xs" aria-hidden="true" />
|
|
90
|
+
New card
|
|
91
|
+
</button>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central exports for list-page data surfaces and shared view chrome.
|
|
3
|
+
*
|
|
4
|
+
* **Pattern:** `ListPageTemplate` + `DataListTable` — one `useTableState`, one toolbar,
|
|
5
|
+
* table | list | board | dashboard from the same component (`AGENTS.md` §4, `docs/data-views-pattern.md`).
|
|
6
|
+
*
|
|
7
|
+
* **View UI:** `ViewSegmentedControl` matches the template’s views toolbar (`bg-muted/60` pills).
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export { DataListTable } from "@/components/data-list-table"
|
|
11
|
+
export type { DataListTableProps, DataListTableHandle } from "@/components/data-list-table"
|
|
12
|
+
export type { PlacementLifecycleTabId } from "@/lib/placement-lifecycle"
|
|
13
|
+
export type { DataListViewType } from "@/lib/data-list-view"
|
|
14
|
+
export { DATA_LIST_VIEW_TILES, dataListViewIcon, dataListViewLabel } from "@/lib/data-list-view"
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
ListPageTemplate,
|
|
18
|
+
type ViewTab,
|
|
19
|
+
type ViewType,
|
|
20
|
+
} from "@/components/templates/list-page"
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
ViewSegmentedControl,
|
|
24
|
+
viewSegmentedToolbarClass,
|
|
25
|
+
viewSegmentedButtonClass,
|
|
26
|
+
type ViewSegmentOption,
|
|
27
|
+
} from "@/components/ui/view-segmented-control"
|
|
28
|
+
|
|
29
|
+
/** Unified hub tile + list row surface — see `list-page-board-card.tsx`. */
|
|
30
|
+
export {
|
|
31
|
+
HubRecordCard,
|
|
32
|
+
ListPageBoardCard,
|
|
33
|
+
ListPageBoardCardAvatar,
|
|
34
|
+
ListPageBoardCardBadgeRow,
|
|
35
|
+
ListPageBoardCardBody,
|
|
36
|
+
ListPageBoardCardHeader,
|
|
37
|
+
ListPageBoardCardSecondary,
|
|
38
|
+
ListPageBoardCardTitleRow,
|
|
39
|
+
type ListPageBoardCardLayout,
|
|
40
|
+
type ListPageBoardCardProps,
|
|
41
|
+
} from "@/components/data-views/list-page-board-card"
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ListPageBoardCard — single board-card shell for all list hubs (Placements, Team, Compliance, …).
|
|
5
|
+
*
|
|
6
|
+
* Information hierarchy (top → bottom):
|
|
7
|
+
* 1. **Title row** — `ListPageBoardCardTitleRow` — primary label (`text-sm font-semibold`), optional `trailing` (`ListPageBoardCardAvatar` initials chip, same as Placements).
|
|
8
|
+
* 2. **Badge row** — `ListPageBoardCardBadgeRow` — optional status / tags (`flex-wrap`).
|
|
9
|
+
* 3. **Body** — `ListPageBoardCardBody` — primary facts: icon rows, two-line blocks (`BoardCardIconRow` / `BoardCardTwoLineBlock` from board-card-primitives).
|
|
10
|
+
* 4. **Secondary** — `ListPageBoardCardSecondary` — optional muted supporting line (`text-xs text-muted-foreground`).
|
|
11
|
+
*
|
|
12
|
+
* Styling matches **`BoardPlacementCard`**: `Card` `size="sm"`, ring, hover shadow, optional **new** ring accent.
|
|
13
|
+
*
|
|
14
|
+
* **Interaction:** Pass **`onClick`** (e.g. `BoardPlacementCard`) or **`interactive`** when the card is
|
|
15
|
+
* wrapped in `<Link>` / router navigation so hover/cursor match placement board tiles.
|
|
16
|
+
*
|
|
17
|
+
* **Layouts:**
|
|
18
|
+
* - **`stack`** (default) — kanban / grid tile: compose with `ListPageBoardCardHeader`, title row, body.
|
|
19
|
+
* - **`row`** — full-width list row: optional **`leading`**, **`children`** as main column, optional **`rowEnd`**.
|
|
20
|
+
* Use **`rowContainerClassName`** for responsive shells (e.g. `flex-col sm:flex-row`).
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import * as React from "react"
|
|
24
|
+
import { AvatarInitials } from "@/components/ui/avatar"
|
|
25
|
+
import { cn } from "@/lib/utils"
|
|
26
|
+
import { Card, CardHeader, CardTitle } from "@/components/ui/card"
|
|
27
|
+
|
|
28
|
+
export type ListPageBoardCardLayout = "stack" | "row"
|
|
29
|
+
|
|
30
|
+
export type ListPageBoardCardProps = {
|
|
31
|
+
layout?: ListPageBoardCardLayout
|
|
32
|
+
/** `row` only — avatar / icon column. */
|
|
33
|
+
leading?: React.ReactNode
|
|
34
|
+
/** `row` only — status + chevron, etc. */
|
|
35
|
+
rowEnd?: React.ReactNode
|
|
36
|
+
/**
|
|
37
|
+
* `row` only — flex shell for the card (default `flex flex-row items-start gap-3`).
|
|
38
|
+
* Use e.g. `flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-4` for compliance-style rows.
|
|
39
|
+
*/
|
|
40
|
+
rowContainerClassName?: string
|
|
41
|
+
/** Entire card is clickable (e.g. open detail) — enables pointer + hover shadow. */
|
|
42
|
+
onClick?: () => void
|
|
43
|
+
/**
|
|
44
|
+
* Same hover/cursor as `onClick` when the parent uses `<Link>` or `button` instead of Card click
|
|
45
|
+
* (avoids nested interactive targets and keeps keyboard focus on the link).
|
|
46
|
+
*/
|
|
47
|
+
interactive?: boolean
|
|
48
|
+
className?: string
|
|
49
|
+
style?: React.CSSProperties
|
|
50
|
+
/** Subtle brand ring — e.g. newly created row. */
|
|
51
|
+
isNew?: boolean
|
|
52
|
+
children: React.ReactNode
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function ListPageBoardCard({
|
|
56
|
+
layout = "stack",
|
|
57
|
+
leading,
|
|
58
|
+
rowEnd,
|
|
59
|
+
rowContainerClassName,
|
|
60
|
+
onClick,
|
|
61
|
+
interactive = false,
|
|
62
|
+
className,
|
|
63
|
+
style,
|
|
64
|
+
isNew,
|
|
65
|
+
children,
|
|
66
|
+
}: ListPageBoardCardProps) {
|
|
67
|
+
const isRow = layout === "row"
|
|
68
|
+
const isInteractive = Boolean(onClick) || interactive
|
|
69
|
+
const rowShell = rowContainerClassName ?? "flex flex-row items-start gap-3"
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Card
|
|
73
|
+
size="sm"
|
|
74
|
+
className={cn(
|
|
75
|
+
"w-full min-w-0 transition-shadow",
|
|
76
|
+
!isRow && "gap-1",
|
|
77
|
+
isRow && cn("!gap-0", rowShell, "px-4 py-3"),
|
|
78
|
+
isInteractive && "cursor-pointer hover:shadow-md",
|
|
79
|
+
isNew && "ring-brand/30",
|
|
80
|
+
className,
|
|
81
|
+
)}
|
|
82
|
+
style={style}
|
|
83
|
+
onClick={onClick}
|
|
84
|
+
>
|
|
85
|
+
{isRow ? (
|
|
86
|
+
<>
|
|
87
|
+
{leading}
|
|
88
|
+
<div className="min-w-0 flex-1">{children}</div>
|
|
89
|
+
{rowEnd}
|
|
90
|
+
</>
|
|
91
|
+
) : (
|
|
92
|
+
children
|
|
93
|
+
)}
|
|
94
|
+
</Card>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Preferred public name — same component as `ListPageBoardCard`. */
|
|
99
|
+
export const HubRecordCard = ListPageBoardCard
|
|
100
|
+
|
|
101
|
+
export function ListPageBoardCardHeader({
|
|
102
|
+
className,
|
|
103
|
+
children,
|
|
104
|
+
}: {
|
|
105
|
+
className?: string
|
|
106
|
+
children: React.ReactNode
|
|
107
|
+
}) {
|
|
108
|
+
return <CardHeader className={cn("gap-2 pb-2", className)}>{children}</CardHeader>
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Level 1 — Primary title (dominant text on the card).
|
|
113
|
+
*/
|
|
114
|
+
export function ListPageBoardCardTitleRow({
|
|
115
|
+
title,
|
|
116
|
+
titleClassName,
|
|
117
|
+
trailing,
|
|
118
|
+
}: {
|
|
119
|
+
title: React.ReactNode
|
|
120
|
+
/** Extra classes on the title (e.g. line-clamp from `lineClampClass`). */
|
|
121
|
+
titleClassName?: string
|
|
122
|
+
/** End-aligned: avatar, icon, etc. */
|
|
123
|
+
trailing?: React.ReactNode
|
|
124
|
+
}) {
|
|
125
|
+
return (
|
|
126
|
+
<div className="flex min-w-0 items-start justify-between gap-2">
|
|
127
|
+
<div className="min-w-0 flex-1">
|
|
128
|
+
<CardTitle
|
|
129
|
+
className={cn(
|
|
130
|
+
"break-words text-sm font-semibold leading-snug text-foreground",
|
|
131
|
+
titleClassName,
|
|
132
|
+
)}
|
|
133
|
+
>
|
|
134
|
+
{title}
|
|
135
|
+
</CardTitle>
|
|
136
|
+
</div>
|
|
137
|
+
{trailing}
|
|
138
|
+
</div>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Initials avatar — Radix `Avatar` + `--avatar-initials-*` tokens (same as tables / placement board). */
|
|
143
|
+
export function ListPageBoardCardAvatar({
|
|
144
|
+
initials,
|
|
145
|
+
className,
|
|
146
|
+
}: {
|
|
147
|
+
initials: string
|
|
148
|
+
className?: string
|
|
149
|
+
}) {
|
|
150
|
+
return (
|
|
151
|
+
<AvatarInitials
|
|
152
|
+
initials={initials}
|
|
153
|
+
className={cn("size-7 shrink-0 text-xs", className)}
|
|
154
|
+
fallbackClassName="text-xs"
|
|
155
|
+
/>
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Level 2 — Status / metadata chips (below title, above primary body).
|
|
161
|
+
*/
|
|
162
|
+
export function ListPageBoardCardBadgeRow({ children }: { children: React.ReactNode }) {
|
|
163
|
+
return <div className="flex min-w-0 flex-wrap items-center gap-1.5">{children}</div>
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Level 3 — Main facts: compose with `BoardCardIconRow`, `BoardCardTwoLineBlock`, etc.
|
|
168
|
+
*/
|
|
169
|
+
export function ListPageBoardCardBody({
|
|
170
|
+
className,
|
|
171
|
+
children,
|
|
172
|
+
}: {
|
|
173
|
+
className?: string
|
|
174
|
+
children: React.ReactNode
|
|
175
|
+
}) {
|
|
176
|
+
return <div className={cn("flex flex-col gap-2", className)}>{children}</div>
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Level 4 — Optional muted supporting line (caption, hint, extra context).
|
|
181
|
+
*/
|
|
182
|
+
export function ListPageBoardCardSecondary({
|
|
183
|
+
className,
|
|
184
|
+
children,
|
|
185
|
+
}: {
|
|
186
|
+
className?: string
|
|
187
|
+
children: React.ReactNode
|
|
188
|
+
}) {
|
|
189
|
+
return (
|
|
190
|
+
<p className={cn("text-xs text-muted-foreground leading-snug", className)}>{children}</p>
|
|
191
|
+
)
|
|
192
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ListPageBoardTemplate — reusable kanban shell for list pages (Team, custom hubs).
|
|
5
|
+
*
|
|
6
|
+
* - Columns are defined with predicates; each row is placed in the **first** matching column.
|
|
7
|
+
* - Cards are rendered by the caller (`renderCard`) — compose **`ListPageBoardCard`** + primitives (`BoardCardTwoLineBlock`, etc.).
|
|
8
|
+
* - Placements keeps richer column headers (search, menus); this template is for simpler hubs.
|
|
9
|
+
*
|
|
10
|
+
* @see `docs/data-views-pattern.md` — board primitives
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import * as React from "react"
|
|
14
|
+
import { cn } from "@/lib/utils"
|
|
15
|
+
import { Badge } from "@/components/ui/badge"
|
|
16
|
+
import { BoardNewCardPlaceholder } from "@/components/data-views/board-card-primitives"
|
|
17
|
+
|
|
18
|
+
export type ListPageBoardColumnDef<T> = {
|
|
19
|
+
id: string
|
|
20
|
+
label: string
|
|
21
|
+
/** Shown beside the title on larger breakpoints */
|
|
22
|
+
description?: string
|
|
23
|
+
/** First matching column wins; columns should be mutually exclusive for most domains. */
|
|
24
|
+
filter: (row: T) => boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type ListPageBoardTemplateProps<T> = {
|
|
28
|
+
columns: ListPageBoardColumnDef<T>[]
|
|
29
|
+
rows: T[]
|
|
30
|
+
getRowKey: (row: T) => string | number
|
|
31
|
+
renderCard: (row: T) => React.ReactNode
|
|
32
|
+
/** Tailwind classes for the count pill, keyed by column `id` */
|
|
33
|
+
columnCountBadgeClassName?: Record<string, string>
|
|
34
|
+
/** Copy when a column has no rows */
|
|
35
|
+
emptyColumnLabel?: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function ListPageBoardColumnHeader({
|
|
39
|
+
label,
|
|
40
|
+
description,
|
|
41
|
+
count,
|
|
42
|
+
badgeClassName,
|
|
43
|
+
}: {
|
|
44
|
+
label: string
|
|
45
|
+
description?: string
|
|
46
|
+
count: number
|
|
47
|
+
badgeClassName?: string
|
|
48
|
+
}) {
|
|
49
|
+
return (
|
|
50
|
+
<div className="flex items-center justify-between border-b border-border px-3 py-2.5">
|
|
51
|
+
<div className="flex min-w-0 items-center gap-2">
|
|
52
|
+
<span className="truncate text-sm font-semibold text-foreground">{label}</span>
|
|
53
|
+
{description ? (
|
|
54
|
+
<span className="hidden text-xs text-muted-foreground sm:inline">{description}</span>
|
|
55
|
+
) : null}
|
|
56
|
+
</div>
|
|
57
|
+
<Badge
|
|
58
|
+
variant="outline"
|
|
59
|
+
className={cn(
|
|
60
|
+
"inline-flex h-6 min-w-6 shrink-0 items-center justify-center border-0 bg-muted/70 px-2 text-xs font-semibold tabular-nums text-foreground",
|
|
61
|
+
badgeClassName,
|
|
62
|
+
)}
|
|
63
|
+
aria-label={`${count} ${count === 1 ? "item" : "items"}`}
|
|
64
|
+
>
|
|
65
|
+
{count}
|
|
66
|
+
</Badge>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function ListPageBoardTemplate<T>({
|
|
72
|
+
columns,
|
|
73
|
+
rows,
|
|
74
|
+
getRowKey,
|
|
75
|
+
renderCard,
|
|
76
|
+
columnCountBadgeClassName = {},
|
|
77
|
+
emptyColumnLabel = "No items",
|
|
78
|
+
}: ListPageBoardTemplateProps<T>) {
|
|
79
|
+
const grouped = React.useMemo(() => {
|
|
80
|
+
const map: Record<string, T[]> = {}
|
|
81
|
+
for (const col of columns) map[col.id] = []
|
|
82
|
+
for (const row of rows) {
|
|
83
|
+
for (const col of columns) {
|
|
84
|
+
if (col.filter(row)) {
|
|
85
|
+
map[col.id].push(row)
|
|
86
|
+
break
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return map
|
|
91
|
+
}, [columns, rows])
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<div className="flex min-h-0 flex-1 gap-3 overflow-x-auto px-4 pb-6 pt-2 lg:px-6">
|
|
95
|
+
{columns.map(col => (
|
|
96
|
+
<div
|
|
97
|
+
key={col.id}
|
|
98
|
+
className="flex w-72 shrink-0 flex-col overflow-hidden rounded-xl border border-border bg-muted/30"
|
|
99
|
+
>
|
|
100
|
+
<ListPageBoardColumnHeader
|
|
101
|
+
label={col.label}
|
|
102
|
+
description={col.description}
|
|
103
|
+
count={grouped[col.id]?.length ?? 0}
|
|
104
|
+
badgeClassName={columnCountBadgeClassName[col.id]}
|
|
105
|
+
/>
|
|
106
|
+
|
|
107
|
+
<div className="flex flex-1 flex-col gap-2 overflow-y-auto p-2">
|
|
108
|
+
<BoardNewCardPlaceholder position="above" />
|
|
109
|
+
|
|
110
|
+
{(grouped[col.id]?.length ?? 0) === 0 ? (
|
|
111
|
+
<p className="py-6 text-center text-xs text-muted-foreground">{emptyColumnLabel}</p>
|
|
112
|
+
) : (
|
|
113
|
+
grouped[col.id]!.map(row => <React.Fragment key={String(getRowKey(row))}>{renderCard(row)}</React.Fragment>)
|
|
114
|
+
)}
|
|
115
|
+
|
|
116
|
+
<BoardNewCardPlaceholder position="below" />
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
))}
|
|
120
|
+
</div>
|
|
121
|
+
)
|
|
122
|
+
}
|