@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,253 @@
|
|
|
1
|
+
import { CSSProperties, Fragment, useId, useRef } from "react"
|
|
2
|
+
import { useDataGrid } from "@/components/reui/data-grid/data-grid"
|
|
3
|
+
import {
|
|
4
|
+
DataGridTableBase,
|
|
5
|
+
DataGridTableBody,
|
|
6
|
+
DataGridTableBodyRow,
|
|
7
|
+
DataGridTableBodyRowCell,
|
|
8
|
+
DataGridTableBodyRowExpandded,
|
|
9
|
+
DataGridTableBodyRowSkeleton,
|
|
10
|
+
DataGridTableBodyRowSkeletonCell,
|
|
11
|
+
DataGridTableEmpty,
|
|
12
|
+
DataGridTableHead,
|
|
13
|
+
DataGridTableHeadRow,
|
|
14
|
+
DataGridTableHeadRowCell,
|
|
15
|
+
DataGridTableHeadRowCellResize,
|
|
16
|
+
DataGridTableRowSpacer,
|
|
17
|
+
} from "@/components/reui/data-grid/data-grid-table"
|
|
18
|
+
import {
|
|
19
|
+
closestCenter,
|
|
20
|
+
DndContext,
|
|
21
|
+
KeyboardSensor,
|
|
22
|
+
Modifier,
|
|
23
|
+
MouseSensor,
|
|
24
|
+
TouchSensor,
|
|
25
|
+
useSensor,
|
|
26
|
+
useSensors,
|
|
27
|
+
type DragEndEvent,
|
|
28
|
+
} from "@dnd-kit/core"
|
|
29
|
+
import {
|
|
30
|
+
horizontalListSortingStrategy,
|
|
31
|
+
SortableContext,
|
|
32
|
+
useSortable,
|
|
33
|
+
} from "@dnd-kit/sortable"
|
|
34
|
+
import { CSS } from "@dnd-kit/utilities"
|
|
35
|
+
import {
|
|
36
|
+
Cell,
|
|
37
|
+
flexRender,
|
|
38
|
+
Header,
|
|
39
|
+
HeaderGroup,
|
|
40
|
+
Row,
|
|
41
|
+
} from "@tanstack/react-table"
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
function DataGridTableDndHeader<TData>({
|
|
45
|
+
header,
|
|
46
|
+
}: {
|
|
47
|
+
header: Header<TData, unknown>
|
|
48
|
+
}) {
|
|
49
|
+
const { props } = useDataGrid()
|
|
50
|
+
const { column } = header
|
|
51
|
+
|
|
52
|
+
// Check if column ordering is enabled for this column
|
|
53
|
+
const canOrder =
|
|
54
|
+
(column.columnDef as { enableColumnOrdering?: boolean })
|
|
55
|
+
.enableColumnOrdering !== false
|
|
56
|
+
|
|
57
|
+
const {
|
|
58
|
+
attributes,
|
|
59
|
+
isDragging,
|
|
60
|
+
listeners,
|
|
61
|
+
setNodeRef,
|
|
62
|
+
transform,
|
|
63
|
+
transition,
|
|
64
|
+
} = useSortable({
|
|
65
|
+
id: header.column.id,
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
const style: CSSProperties = {
|
|
69
|
+
opacity: isDragging ? 0.8 : 1,
|
|
70
|
+
position: "relative",
|
|
71
|
+
transform: CSS.Translate.toString(transform),
|
|
72
|
+
transition,
|
|
73
|
+
whiteSpace: "nowrap",
|
|
74
|
+
width: header.column.getSize(),
|
|
75
|
+
zIndex: isDragging ? 1 : 0,
|
|
76
|
+
cursor: canOrder ? "grab" : undefined,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Apply drag listeners to the entire cell if column ordering is enabled
|
|
80
|
+
const dragProps = canOrder ? { ...attributes, ...listeners } : {}
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<DataGridTableHeadRowCell
|
|
84
|
+
header={header}
|
|
85
|
+
dndStyle={style}
|
|
86
|
+
dndRef={setNodeRef}
|
|
87
|
+
>
|
|
88
|
+
<div
|
|
89
|
+
className="flex items-center justify-start"
|
|
90
|
+
{...dragProps}
|
|
91
|
+
>
|
|
92
|
+
<span className="grow truncate">
|
|
93
|
+
{header.isPlaceholder
|
|
94
|
+
? null
|
|
95
|
+
: flexRender(header.column.columnDef.header, header.getContext())}
|
|
96
|
+
</span>
|
|
97
|
+
{props.tableLayout?.columnsResizable && column.getCanResize() && (
|
|
98
|
+
<DataGridTableHeadRowCellResize header={header} />
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
</DataGridTableHeadRowCell>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function DataGridTableDndCell<TData>({ cell }: { cell: Cell<TData, unknown> }) {
|
|
106
|
+
const { isDragging, setNodeRef, transform, transition } = useSortable({
|
|
107
|
+
id: cell.column.id,
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
const style: CSSProperties = {
|
|
111
|
+
opacity: isDragging ? 0.8 : 1,
|
|
112
|
+
position: "relative",
|
|
113
|
+
transform: CSS.Translate.toString(transform),
|
|
114
|
+
transition,
|
|
115
|
+
width: cell.column.getSize(),
|
|
116
|
+
zIndex: isDragging ? 1 : 0,
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<DataGridTableBodyRowCell cell={cell} dndStyle={style} dndRef={setNodeRef}>
|
|
121
|
+
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
122
|
+
</DataGridTableBodyRowCell>
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function DataGridTableDnd<TData>({
|
|
127
|
+
handleDragEnd,
|
|
128
|
+
}: {
|
|
129
|
+
handleDragEnd: (event: DragEndEvent) => void
|
|
130
|
+
}) {
|
|
131
|
+
const { table, isLoading, props } = useDataGrid()
|
|
132
|
+
const pagination = table.getState().pagination
|
|
133
|
+
const containerRef = useRef<HTMLDivElement>(null)
|
|
134
|
+
|
|
135
|
+
const sensors = useSensors(
|
|
136
|
+
useSensor(MouseSensor, {}),
|
|
137
|
+
useSensor(TouchSensor, {}),
|
|
138
|
+
useSensor(KeyboardSensor, {})
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
// Custom modifier to restrict dragging within table bounds with edge offset
|
|
142
|
+
const restrictToTableBounds: Modifier = ({ draggingNodeRect, transform }) => {
|
|
143
|
+
if (!draggingNodeRect || !containerRef.current) {
|
|
144
|
+
return { ...transform, y: 0 }
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const containerRect = containerRef.current.getBoundingClientRect()
|
|
148
|
+
const edgeOffset = 0
|
|
149
|
+
|
|
150
|
+
const minX = containerRect.left - draggingNodeRect.left - edgeOffset
|
|
151
|
+
const maxX =
|
|
152
|
+
containerRect.right -
|
|
153
|
+
draggingNodeRect.left -
|
|
154
|
+
draggingNodeRect.width +
|
|
155
|
+
edgeOffset
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
...transform,
|
|
159
|
+
x: Math.min(Math.max(transform.x, minX), maxX),
|
|
160
|
+
y: 0, // Lock vertical movement
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<DndContext
|
|
166
|
+
collisionDetection={closestCenter}
|
|
167
|
+
id={useId()}
|
|
168
|
+
modifiers={[restrictToTableBounds]}
|
|
169
|
+
onDragEnd={handleDragEnd}
|
|
170
|
+
sensors={sensors}
|
|
171
|
+
>
|
|
172
|
+
<div ref={containerRef}>
|
|
173
|
+
<DataGridTableBase>
|
|
174
|
+
<DataGridTableHead>
|
|
175
|
+
{table
|
|
176
|
+
.getHeaderGroups()
|
|
177
|
+
.map((headerGroup: HeaderGroup<TData>, index) => {
|
|
178
|
+
return (
|
|
179
|
+
<DataGridTableHeadRow headerGroup={headerGroup} key={index}>
|
|
180
|
+
<SortableContext
|
|
181
|
+
items={table.getState().columnOrder}
|
|
182
|
+
strategy={horizontalListSortingStrategy}
|
|
183
|
+
>
|
|
184
|
+
{headerGroup.headers.map((header) => (
|
|
185
|
+
<DataGridTableDndHeader
|
|
186
|
+
header={header}
|
|
187
|
+
key={header.id}
|
|
188
|
+
/>
|
|
189
|
+
))}
|
|
190
|
+
</SortableContext>
|
|
191
|
+
</DataGridTableHeadRow>
|
|
192
|
+
)
|
|
193
|
+
})}
|
|
194
|
+
</DataGridTableHead>
|
|
195
|
+
|
|
196
|
+
{(props.tableLayout?.stripped || !props.tableLayout?.rowBorder) && (
|
|
197
|
+
<DataGridTableRowSpacer />
|
|
198
|
+
)}
|
|
199
|
+
|
|
200
|
+
<DataGridTableBody>
|
|
201
|
+
{props.loadingMode === "skeleton" &&
|
|
202
|
+
isLoading &&
|
|
203
|
+
pagination?.pageSize ? (
|
|
204
|
+
Array.from({ length: pagination.pageSize }).map((_, rowIndex) => (
|
|
205
|
+
<DataGridTableBodyRowSkeleton key={rowIndex}>
|
|
206
|
+
{table.getVisibleFlatColumns().map((column, colIndex) => {
|
|
207
|
+
return (
|
|
208
|
+
<DataGridTableBodyRowSkeletonCell
|
|
209
|
+
column={column}
|
|
210
|
+
key={colIndex}
|
|
211
|
+
>
|
|
212
|
+
{column.columnDef.meta?.skeleton}
|
|
213
|
+
</DataGridTableBodyRowSkeletonCell>
|
|
214
|
+
)
|
|
215
|
+
})}
|
|
216
|
+
</DataGridTableBodyRowSkeleton>
|
|
217
|
+
))
|
|
218
|
+
) : table.getRowModel().rows.length ? (
|
|
219
|
+
table.getRowModel().rows.map((row: Row<TData>) => {
|
|
220
|
+
return (
|
|
221
|
+
<Fragment key={row.id}>
|
|
222
|
+
<DataGridTableBodyRow row={row}>
|
|
223
|
+
{row
|
|
224
|
+
.getVisibleCells()
|
|
225
|
+
.map((cell: Cell<TData, unknown>) => {
|
|
226
|
+
return (
|
|
227
|
+
<SortableContext
|
|
228
|
+
key={cell.id}
|
|
229
|
+
items={table.getState().columnOrder}
|
|
230
|
+
strategy={horizontalListSortingStrategy}
|
|
231
|
+
>
|
|
232
|
+
<DataGridTableDndCell cell={cell} />
|
|
233
|
+
</SortableContext>
|
|
234
|
+
)
|
|
235
|
+
})}
|
|
236
|
+
</DataGridTableBodyRow>
|
|
237
|
+
{row.getIsExpanded() && (
|
|
238
|
+
<DataGridTableBodyRowExpandded row={row} />
|
|
239
|
+
)}
|
|
240
|
+
</Fragment>
|
|
241
|
+
)
|
|
242
|
+
})
|
|
243
|
+
) : (
|
|
244
|
+
<DataGridTableEmpty />
|
|
245
|
+
)}
|
|
246
|
+
</DataGridTableBody>
|
|
247
|
+
</DataGridTableBase>
|
|
248
|
+
</div>
|
|
249
|
+
</DndContext>
|
|
250
|
+
)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export { DataGridTableDnd }
|