@mostrom/app-shell 0.1.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/.claude/ralph-loop.local.md +9 -0
- package/README.md +172 -0
- package/bin/init.js +269 -0
- package/bun.lock +401 -0
- package/components.json +28 -0
- package/package.json +74 -0
- package/scripts/publish-npm.sh +202 -0
- package/src/AppShell.tsx +847 -0
- package/src/components/PageHeader.tsx +160 -0
- package/src/components/data-table/README.md +447 -0
- package/src/components/data-table/data-table-preferences.tsx +184 -0
- package/src/components/data-table/data-table-toolbar.tsx +118 -0
- package/src/components/data-table/data-table.tsx +37 -0
- package/src/components/data-table/index.ts +32 -0
- package/src/components/global-header/AllServicesButton.tsx +127 -0
- package/src/components/global-header/CategoriesButton.tsx +120 -0
- package/src/components/global-header/GlobalHeader.tsx +59 -0
- package/src/components/global-header/GlobalHeaderSearch.tsx +57 -0
- package/src/components/global-header/HeaderUtilities.tsx +243 -0
- package/src/components/global-header/ServicesMenu.tsx +246 -0
- package/src/components/layout/AppBreadcrumb.tsx +70 -0
- package/src/components/layout/AppFlashbar.tsx +95 -0
- package/src/components/layout/AppLayout.tsx +271 -0
- package/src/components/layout/AppNavigation.tsx +313 -0
- package/src/components/layout/AppSidebar.tsx +229 -0
- package/src/components/patterns/index.ts +14 -0
- package/src/components/patterns/p-alert-5.tsx +19 -0
- package/src/components/patterns/p-autocomplete-5.tsx +89 -0
- package/src/components/patterns/p-breadcrumb-1.tsx +28 -0
- package/src/components/patterns/p-button-42.tsx +37 -0
- package/src/components/patterns/p-button-51.tsx +14 -0
- package/src/components/patterns/p-button-6.tsx +5 -0
- package/src/components/patterns/p-calendar-1.tsx +18 -0
- package/src/components/patterns/p-card-1.tsx +33 -0
- package/src/components/patterns/p-card-2.tsx +26 -0
- package/src/components/patterns/p-card-5.tsx +31 -0
- package/src/components/patterns/p-collapsible-7.tsx +121 -0
- package/src/components/patterns/p-command-6.tsx +113 -0
- package/src/components/patterns/p-dialog-1.tsx +56 -0
- package/src/components/patterns/p-dropdown-menu-1.tsx +38 -0
- package/src/components/patterns/p-dropdown-menu-11.tsx +122 -0
- package/src/components/patterns/p-dropdown-menu-14.tsx +165 -0
- package/src/components/patterns/p-dropdown-menu-9.tsx +108 -0
- package/src/components/patterns/p-empty-2.tsx +34 -0
- package/src/components/patterns/p-file-upload-1.tsx +72 -0
- package/src/components/patterns/p-filters-1.tsx +666 -0
- package/src/components/patterns/p-frame-2.tsx +26 -0
- package/src/components/patterns/p-tabs-2.tsx +129 -0
- package/src/components/reui/alert.tsx +92 -0
- package/src/components/reui/autocomplete.tsx +343 -0
- package/src/components/reui/badge.tsx +87 -0
- package/src/components/reui/data-grid/data-grid-column-filter.tsx +165 -0
- package/src/components/reui/data-grid/data-grid-column-header.tsx +339 -0
- package/src/components/reui/data-grid/data-grid-column-visibility.tsx +55 -0
- package/src/components/reui/data-grid/data-grid-pagination.tsx +224 -0
- package/src/components/reui/data-grid/data-grid-table-dnd-rows.tsx +260 -0
- package/src/components/reui/data-grid/data-grid-table-dnd.tsx +253 -0
- package/src/components/reui/data-grid/data-grid-table.tsx +639 -0
- package/src/components/reui/data-grid/data-grid.tsx +209 -0
- package/src/components/reui/date-selector.tsx +1330 -0
- package/src/components/reui/filters.tsx +1869 -0
- package/src/components/reui/frame.tsx +134 -0
- package/src/components/reui/index.ts +17 -0
- package/src/components/reui/timeline.tsx +219 -0
- package/src/components/search/Autocomplete.tsx +183 -0
- package/src/components/search/AutocompleteClient.tsx +293 -0
- package/src/components/search/GlobalSearch.tsx +187 -0
- package/src/components/section-drawer/deal-drawer-content.tsx +891 -0
- package/src/components/section-drawer/index.ts +19 -0
- package/src/components/section-drawer/section-drawer.css +665 -0
- package/src/components/section-drawer/section-drawer.tsx +467 -0
- package/src/components/sectioned-list-board/README.md +78 -0
- package/src/components/sectioned-list-board/board-card-content.tsx +340 -0
- package/src/components/sectioned-list-board/date-range-filter.tsx +249 -0
- package/src/components/sectioned-list-board/index.ts +19 -0
- package/src/components/sectioned-list-board/sectioned-list-board.css +564 -0
- package/src/components/sectioned-list-board/sectioned-list-board.tsx +731 -0
- package/src/components/sectioned-list-board/sortable-card.tsx +314 -0
- package/src/components/sectioned-list-board/sortable-section.tsx +319 -0
- package/src/components/sectioned-list-board/types.ts +216 -0
- package/src/components/sectioned-list-table/README.md +80 -0
- package/src/components/sectioned-list-table/index.ts +14 -0
- package/src/components/sectioned-list-table/sectioned-list-table.css +534 -0
- package/src/components/sectioned-list-table/sectioned-list-table.tsx +740 -0
- package/src/components/sectioned-list-table/sortable-column-header.tsx +120 -0
- package/src/components/sectioned-list-table/sortable-row.tsx +420 -0
- package/src/components/sectioned-list-table/sortable-section.tsx +251 -0
- package/src/components/sectioned-list-table/table-cell-content.tsx +129 -0
- package/src/components/sectioned-list-table/types.ts +120 -0
- package/src/components/sectioned-list-table/use-column-preferences.ts +103 -0
- package/src/components/ui/actions-dropdown.tsx +109 -0
- package/src/components/ui/assignee-selector.tsx +209 -0
- package/src/components/ui/avatar.tsx +107 -0
- package/src/components/ui/breadcrumb.tsx +109 -0
- package/src/components/ui/button-group.tsx +83 -0
- package/src/components/ui/button.tsx +64 -0
- package/src/components/ui/calendar.tsx +220 -0
- package/src/components/ui/card.tsx +92 -0
- package/src/components/ui/chart.tsx +376 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/collapsible.tsx +33 -0
- package/src/components/ui/command.tsx +182 -0
- package/src/components/ui/context-menu.tsx +250 -0
- package/src/components/ui/create-button-group.tsx +128 -0
- package/src/components/ui/dialog.tsx +156 -0
- package/src/components/ui/drawer.tsx +133 -0
- package/src/components/ui/dropdown-menu.tsx +255 -0
- package/src/components/ui/empty.tsx +104 -0
- package/src/components/ui/field.tsx +248 -0
- package/src/components/ui/form.tsx +165 -0
- package/src/components/ui/index.ts +37 -0
- package/src/components/ui/input-group.tsx +168 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/kbd.tsx +28 -0
- package/src/components/ui/label.tsx +22 -0
- package/src/components/ui/navigation-menu.tsx +168 -0
- package/src/components/ui/page-header.tsx +80 -0
- package/src/components/ui/popover.tsx +87 -0
- package/src/components/ui/scroll-area.tsx +56 -0
- package/src/components/ui/select.tsx +190 -0
- package/src/components/ui/separator.tsx +26 -0
- package/src/components/ui/sheet.tsx +141 -0
- package/src/components/ui/sidebar.tsx +726 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/sonner.tsx +38 -0
- package/src/components/ui/switch.tsx +33 -0
- package/src/components/ui/tabs.tsx +91 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/toggle-group.tsx +83 -0
- package/src/components/ui/toggle.tsx +45 -0
- package/src/components/ui/tooltip.tsx +57 -0
- package/src/hooks/use-copy-to-clipboard.ts +37 -0
- package/src/hooks/use-file-upload.ts +415 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/index.ts +95 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles.css +1859 -0
- package/src/urls.ts +83 -0
- package/src/vite.d.ts +22 -0
- package/src/vite.js +241 -0
- package/tsconfig.base.json +18 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { createContext, ReactNode, useContext } from "react"
|
|
2
|
+
import {
|
|
3
|
+
ColumnFiltersState,
|
|
4
|
+
RowData,
|
|
5
|
+
SortingState,
|
|
6
|
+
Table,
|
|
7
|
+
} from "@tanstack/react-table"
|
|
8
|
+
|
|
9
|
+
import { cn } from "@/lib/utils"
|
|
10
|
+
|
|
11
|
+
declare module "@tanstack/react-table" {
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
|
+
interface ColumnMeta<TData extends RowData, TValue> {
|
|
14
|
+
headerTitle?: string
|
|
15
|
+
headerClassName?: string
|
|
16
|
+
cellClassName?: string
|
|
17
|
+
skeleton?: ReactNode
|
|
18
|
+
expandedContent?: (row: TData) => ReactNode
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type DataGridApiFetchParams = {
|
|
23
|
+
pageIndex: number
|
|
24
|
+
pageSize: number
|
|
25
|
+
sorting?: SortingState
|
|
26
|
+
filters?: ColumnFiltersState
|
|
27
|
+
searchQuery?: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type DataGridApiResponse<T> = {
|
|
31
|
+
data: T[]
|
|
32
|
+
empty: boolean
|
|
33
|
+
pagination: {
|
|
34
|
+
total: number
|
|
35
|
+
page: number
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface DataGridContextProps<TData extends object> {
|
|
40
|
+
props: DataGridProps<TData>
|
|
41
|
+
table: Table<TData>
|
|
42
|
+
recordCount: number
|
|
43
|
+
isLoading: boolean
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type DataGridRequestParams = {
|
|
47
|
+
pageIndex: number
|
|
48
|
+
pageSize: number
|
|
49
|
+
sorting?: SortingState
|
|
50
|
+
columnFilters?: ColumnFiltersState
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface DataGridProps<TData extends object> {
|
|
54
|
+
className?: string
|
|
55
|
+
table?: Table<TData>
|
|
56
|
+
recordCount: number
|
|
57
|
+
children?: ReactNode
|
|
58
|
+
onRowClick?: (row: TData) => void
|
|
59
|
+
isLoading?: boolean
|
|
60
|
+
loadingMode?: "skeleton" | "spinner"
|
|
61
|
+
loadingMessage?: ReactNode | string
|
|
62
|
+
emptyMessage?: ReactNode | string
|
|
63
|
+
tableLayout?: {
|
|
64
|
+
dense?: boolean
|
|
65
|
+
cellBorder?: boolean
|
|
66
|
+
rowBorder?: boolean
|
|
67
|
+
rowRounded?: boolean
|
|
68
|
+
stripped?: boolean
|
|
69
|
+
headerBackground?: boolean
|
|
70
|
+
headerBorder?: boolean
|
|
71
|
+
headerSticky?: boolean
|
|
72
|
+
width?: "auto" | "fixed"
|
|
73
|
+
columnsVisibility?: boolean
|
|
74
|
+
columnsResizable?: boolean
|
|
75
|
+
columnsPinnable?: boolean
|
|
76
|
+
columnsMovable?: boolean
|
|
77
|
+
columnsDraggable?: boolean
|
|
78
|
+
rowsDraggable?: boolean
|
|
79
|
+
}
|
|
80
|
+
tableClassNames?: {
|
|
81
|
+
base?: string
|
|
82
|
+
header?: string
|
|
83
|
+
headerRow?: string
|
|
84
|
+
headerSticky?: string
|
|
85
|
+
body?: string
|
|
86
|
+
bodyRow?: string
|
|
87
|
+
footer?: string
|
|
88
|
+
edgeCell?: string
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const DataGridContext = createContext<
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
|
+
DataGridContextProps<any> | undefined
|
|
95
|
+
>(undefined)
|
|
96
|
+
|
|
97
|
+
function useDataGrid() {
|
|
98
|
+
const context = useContext(DataGridContext)
|
|
99
|
+
if (!context) {
|
|
100
|
+
throw new Error("useDataGrid must be used within a DataGridProvider")
|
|
101
|
+
}
|
|
102
|
+
return context
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function DataGridProvider<TData extends object>({
|
|
106
|
+
children,
|
|
107
|
+
table,
|
|
108
|
+
...props
|
|
109
|
+
}: DataGridProps<TData> & { table: Table<TData> }) {
|
|
110
|
+
return (
|
|
111
|
+
<DataGridContext.Provider
|
|
112
|
+
value={{
|
|
113
|
+
props,
|
|
114
|
+
table,
|
|
115
|
+
recordCount: props.recordCount,
|
|
116
|
+
isLoading: props.isLoading || false,
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
{children}
|
|
120
|
+
</DataGridContext.Provider>
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function DataGrid<TData extends object>({
|
|
125
|
+
children,
|
|
126
|
+
table,
|
|
127
|
+
...props
|
|
128
|
+
}: DataGridProps<TData>) {
|
|
129
|
+
const defaultProps: Partial<DataGridProps<TData>> = {
|
|
130
|
+
loadingMode: "skeleton",
|
|
131
|
+
tableLayout: {
|
|
132
|
+
dense: false,
|
|
133
|
+
cellBorder: false,
|
|
134
|
+
rowBorder: true,
|
|
135
|
+
rowRounded: false,
|
|
136
|
+
stripped: false,
|
|
137
|
+
headerSticky: false,
|
|
138
|
+
headerBackground: true,
|
|
139
|
+
headerBorder: true,
|
|
140
|
+
width: "fixed",
|
|
141
|
+
columnsVisibility: false,
|
|
142
|
+
columnsResizable: false,
|
|
143
|
+
columnsPinnable: false,
|
|
144
|
+
columnsMovable: false,
|
|
145
|
+
columnsDraggable: false,
|
|
146
|
+
rowsDraggable: false,
|
|
147
|
+
},
|
|
148
|
+
tableClassNames: {
|
|
149
|
+
base: "",
|
|
150
|
+
header: "",
|
|
151
|
+
headerRow: "",
|
|
152
|
+
headerSticky: "sticky top-0 z-10 bg-background/90 backdrop-blur-xs",
|
|
153
|
+
body: "",
|
|
154
|
+
bodyRow: "",
|
|
155
|
+
footer: "",
|
|
156
|
+
edgeCell: "",
|
|
157
|
+
},
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const mergedProps: DataGridProps<TData> = {
|
|
161
|
+
...defaultProps,
|
|
162
|
+
...props,
|
|
163
|
+
tableLayout: {
|
|
164
|
+
...defaultProps.tableLayout,
|
|
165
|
+
...(props.tableLayout || {}),
|
|
166
|
+
},
|
|
167
|
+
tableClassNames: {
|
|
168
|
+
...defaultProps.tableClassNames,
|
|
169
|
+
...(props.tableClassNames || {}),
|
|
170
|
+
},
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Ensure table is provided
|
|
174
|
+
if (!table) {
|
|
175
|
+
throw new Error('DataGrid requires a "table" prop')
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<DataGridProvider table={table} {...mergedProps}>
|
|
180
|
+
{children}
|
|
181
|
+
</DataGridProvider>
|
|
182
|
+
)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function DataGridContainer({
|
|
186
|
+
children,
|
|
187
|
+
className,
|
|
188
|
+
border = true,
|
|
189
|
+
}: {
|
|
190
|
+
children: ReactNode
|
|
191
|
+
className?: string
|
|
192
|
+
border?: boolean
|
|
193
|
+
}) {
|
|
194
|
+
return (
|
|
195
|
+
<div
|
|
196
|
+
data-slot="data-grid"
|
|
197
|
+
className={cn(
|
|
198
|
+
"w-full overflow-hidden",
|
|
199
|
+
border &&
|
|
200
|
+
"border-border rounded-lg border",
|
|
201
|
+
className
|
|
202
|
+
)}
|
|
203
|
+
>
|
|
204
|
+
{children}
|
|
205
|
+
</div>
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export { useDataGrid, DataGridProvider, DataGrid, DataGridContainer }
|