@fastnd/components 1.0.28 → 1.0.30
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/dist/components/FavoriteButton/FavoriteButton.d.ts +2 -1
- package/dist/components/index.d.ts +1 -3
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/data-table.d.ts +8 -0
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/examples/data-explorer/CardCarouselPanel/CardCarouselPanel.tsx +197 -0
- package/dist/examples/data-explorer/CardView/CardView.tsx +168 -0
- package/dist/examples/data-explorer/ColumnConfigPopover/ColumnConfigPopover.tsx +157 -0
- package/dist/examples/data-explorer/DataExplorerEmpty/DataExplorerEmpty.tsx +56 -0
- package/dist/examples/data-explorer/DataExplorerPage/DataExplorerPage.tsx +101 -0
- package/dist/examples/data-explorer/DataExplorerPagination/DataExplorerPagination.tsx +129 -0
- package/dist/examples/data-explorer/DataExplorerToolbar/DataExplorerToolbar.tsx +143 -0
- package/dist/examples/data-explorer/DomainSwitcher/DomainSwitcher.tsx +36 -0
- package/dist/examples/data-explorer/ExpansionRows/ExpansionRows.tsx +180 -0
- package/dist/examples/data-explorer/FilterChip/FilterChip.tsx +85 -0
- package/dist/examples/data-explorer/FilterPopoverContent/FilterPopoverContent.tsx +73 -0
- package/dist/examples/data-explorer/ListView/ListView.tsx +305 -0
- package/dist/examples/data-explorer/MoreFiltersPopover/MoreFiltersPopover.tsx +113 -0
- package/dist/examples/data-explorer/TableView/TableView.tsx +193 -0
- package/dist/examples/data-explorer/cells/CellRenderer.tsx +147 -0
- package/dist/examples/data-explorer/cells/CurrencyCell.tsx +31 -0
- package/dist/examples/data-explorer/cells/DoubleTextCell.tsx +27 -0
- package/dist/examples/data-explorer/cells/ExpandButton.tsx +67 -0
- package/dist/examples/data-explorer/cells/InventoryBadgeCell.tsx +52 -0
- package/dist/examples/data-explorer/cells/LinkCell.tsx +42 -0
- package/dist/examples/data-explorer/cells/ScoreBar.tsx +50 -0
- package/dist/examples/data-explorer/cells/StatusBadgeCell.tsx +39 -0
- package/dist/examples/data-explorer/cells/TextCell.tsx +35 -0
- package/dist/examples/data-explorer/cells/index.ts +26 -0
- package/dist/examples/data-explorer/domains/applications.ts +225 -0
- package/dist/examples/data-explorer/domains/customers.ts +267 -0
- package/dist/examples/data-explorer/domains/index.ts +26 -0
- package/dist/examples/data-explorer/domains/products.ts +1116 -0
- package/dist/examples/data-explorer/domains/projects.ts +205 -0
- package/dist/examples/data-explorer/hooks/use-data-explorer-state.ts +371 -0
- package/dist/examples/data-explorer/index.ts +3 -0
- package/dist/examples/data-explorer/types.ts +239 -0
- package/dist/fastnd-components.js +16426 -17975
- package/package.json +1 -1
- package/dist/components/ColumnConfigPopover/ColumnConfigPopover.d.ts +0 -20
- package/dist/components/DoubleTextCell/DoubleTextCell.d.ts +0 -9
- package/dist/components/ProgressCircle/ProgressCircle.d.ts +0 -9
- package/dist/examples/data-visualization/DataGrid/DataGrid.tsx +0 -136
- package/dist/examples/data-visualization/DataGridCardView/DataGridCardView.tsx +0 -179
- package/dist/examples/data-visualization/DataGridListView/DataGridListView.tsx +0 -190
- package/dist/examples/data-visualization/DataGridPage/DataGridPage.tsx +0 -43
- package/dist/examples/data-visualization/DataGridPagination/DataGridPagination.tsx +0 -111
- package/dist/examples/data-visualization/DataGridTableView/DataGridTableView.tsx +0 -282
- package/dist/examples/data-visualization/DataGridToolbar/DataGridToolbar.tsx +0 -283
- package/dist/examples/data-visualization/DomainSwitcher/DomainSwitcher.tsx +0 -41
- package/dist/examples/data-visualization/ExpansionDrawer/ExpansionDrawer.tsx +0 -139
- package/dist/examples/data-visualization/MoreFiltersPopover/MoreFiltersPopover.tsx +0 -230
- package/dist/examples/data-visualization/ResultCount/ResultCount.tsx +0 -33
- package/dist/examples/data-visualization/cell-renderers.tsx +0 -119
- package/dist/examples/data-visualization/constants.ts +0 -1251
- package/dist/examples/data-visualization/hooks/use-data-grid-columns.ts +0 -65
- package/dist/examples/data-visualization/hooks/use-data-grid-expansion.ts +0 -40
- package/dist/examples/data-visualization/hooks/use-data-grid-favorites.ts +0 -41
- package/dist/examples/data-visualization/hooks/use-data-grid-filters.ts +0 -61
- package/dist/examples/data-visualization/hooks/use-data-grid-pagination.ts +0 -32
- package/dist/examples/data-visualization/hooks/use-data-grid-sort.ts +0 -32
- package/dist/examples/data-visualization/hooks/use-data-grid-state.ts +0 -133
- package/dist/examples/data-visualization/hooks/use-filtered-data.ts +0 -84
- package/dist/examples/data-visualization/index.ts +0 -10
- package/dist/examples/data-visualization/types.ts +0 -103
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// --- Domain keys & view modes ---
|
|
2
|
+
|
|
3
|
+
export type DomainKey = 'products' | 'projects' | 'customers' | 'applications'
|
|
4
|
+
|
|
5
|
+
export type ViewMode = 'table' | 'list' | 'card'
|
|
6
|
+
|
|
7
|
+
export type SortDirection = 'asc' | 'desc'
|
|
8
|
+
|
|
9
|
+
export type ColumnType =
|
|
10
|
+
| 'text'
|
|
11
|
+
| 'double-text'
|
|
12
|
+
| 'link'
|
|
13
|
+
| 'status-badge'
|
|
14
|
+
| 'currency'
|
|
15
|
+
| 'inventory'
|
|
16
|
+
| 'favorite'
|
|
17
|
+
| 'expand'
|
|
18
|
+
| 'progress'
|
|
19
|
+
|
|
20
|
+
// --- Column definitions ---
|
|
21
|
+
|
|
22
|
+
export interface ExpandColumnDef {
|
|
23
|
+
key: string
|
|
24
|
+
label: string
|
|
25
|
+
bold?: boolean
|
|
26
|
+
muted?: boolean
|
|
27
|
+
type?: 'score-bar'
|
|
28
|
+
mapTo?: string
|
|
29
|
+
secondaryKey?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ColumnDef<TRow = Record<string, unknown>> {
|
|
33
|
+
label: string
|
|
34
|
+
type: ColumnType
|
|
35
|
+
sortable?: boolean
|
|
36
|
+
filterable?: boolean
|
|
37
|
+
primaryFilter?: boolean
|
|
38
|
+
visible?: boolean
|
|
39
|
+
searchable?: boolean
|
|
40
|
+
hideMobile?: boolean
|
|
41
|
+
hideTablet?: boolean
|
|
42
|
+
secondary?: string
|
|
43
|
+
rowLines?: number
|
|
44
|
+
currencyField?: string
|
|
45
|
+
headerIcon?: string
|
|
46
|
+
headerTooltip?: string
|
|
47
|
+
expandIcon?: string
|
|
48
|
+
expandLabel?: string
|
|
49
|
+
expandColumns?: ExpandColumnDef[]
|
|
50
|
+
expandTitleFn?: (row: TRow) => string
|
|
51
|
+
statusMap?: Record<string, string>
|
|
52
|
+
levelFn?: (value: number) => string
|
|
53
|
+
formatFn?: (value: number) => string
|
|
54
|
+
labelMap?: Record<string, string>
|
|
55
|
+
filterOptions?: string[]
|
|
56
|
+
filterFn?: (row: TRow, value: string) => boolean
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type ColumnsConfig<TRow = Record<string, unknown>> = Record<string, ColumnDef<TRow>>
|
|
60
|
+
|
|
61
|
+
// --- Layout definitions ---
|
|
62
|
+
|
|
63
|
+
export interface ListLayout {
|
|
64
|
+
titleField: string
|
|
65
|
+
metaFields?: string[]
|
|
66
|
+
badgeFields?: string[]
|
|
67
|
+
valueField?: string | null
|
|
68
|
+
expandField?: string
|
|
69
|
+
expandFields?: string[]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface CardRowDef {
|
|
73
|
+
label: string
|
|
74
|
+
field: string
|
|
75
|
+
rendererOverride?: string
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface CardLayout {
|
|
79
|
+
titleField: string
|
|
80
|
+
subtitleField?: string
|
|
81
|
+
badgeFields?: string[]
|
|
82
|
+
rows?: CardRowDef[]
|
|
83
|
+
footerField?: string
|
|
84
|
+
expandField?: string
|
|
85
|
+
expandFields?: string[]
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface DomainLayout {
|
|
89
|
+
list: ListLayout
|
|
90
|
+
card: CardLayout
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface DomainConfig<TRow = Record<string, unknown>> {
|
|
94
|
+
key: DomainKey
|
|
95
|
+
label: string
|
|
96
|
+
resultLabel: string
|
|
97
|
+
columns: ColumnsConfig<TRow>
|
|
98
|
+
layout: DomainLayout
|
|
99
|
+
data: TRow[]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// --- State ---
|
|
103
|
+
|
|
104
|
+
export interface DataExplorerState {
|
|
105
|
+
activeDomain: DomainKey
|
|
106
|
+
viewMode: ViewMode
|
|
107
|
+
sortColumn: string | null
|
|
108
|
+
sortDirection: SortDirection
|
|
109
|
+
filters: Record<string, string[]>
|
|
110
|
+
searchTerm: string
|
|
111
|
+
columnOrder: string[]
|
|
112
|
+
columnVisibility: Record<string, boolean>
|
|
113
|
+
expandedRows: Set<string>
|
|
114
|
+
favorites: Set<string>
|
|
115
|
+
currentPage: number
|
|
116
|
+
pageSize: number
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface DataExplorerActions {
|
|
120
|
+
switchDomain: (domain: DomainKey) => void
|
|
121
|
+
switchView: (mode: ViewMode) => void
|
|
122
|
+
toggleSort: (column: string) => void
|
|
123
|
+
setFilter: (column: string, values: string[]) => void
|
|
124
|
+
toggleFilterOption: (column: string, value: string) => void
|
|
125
|
+
clearFilter: (column: string) => void
|
|
126
|
+
resetAllFilters: () => void
|
|
127
|
+
resetSecondaryFilters: () => void
|
|
128
|
+
setSearchTerm: (term: string) => void
|
|
129
|
+
toggleExpand: (rowId: string) => void
|
|
130
|
+
toggleFavorite: (rowId: string) => void
|
|
131
|
+
toggleColumnVisibility: (column: string) => void
|
|
132
|
+
reorderColumns: (newOrder: string[]) => void
|
|
133
|
+
setCurrentPage: (page: number) => void
|
|
134
|
+
setPageSize: (size: number) => void
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface DataExplorerDerived {
|
|
138
|
+
domainConfig: DomainConfig
|
|
139
|
+
visibleColumns: string[]
|
|
140
|
+
filteredData: Record<string, unknown>[]
|
|
141
|
+
sortedData: Record<string, unknown>[]
|
|
142
|
+
paginatedData: Record<string, unknown>[]
|
|
143
|
+
totalFiltered: number
|
|
144
|
+
totalPages: number
|
|
145
|
+
hasActiveFilters: boolean
|
|
146
|
+
totalActiveFilterCount: number
|
|
147
|
+
primaryFilterColumns: [string, ColumnDef][]
|
|
148
|
+
secondaryFilterColumns: [string, ColumnDef][]
|
|
149
|
+
getFilterOptions: (columnKey: string) => string[]
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// --- Domain-specific row types ---
|
|
153
|
+
|
|
154
|
+
export interface ProductAlternative {
|
|
155
|
+
alt_part_number: string
|
|
156
|
+
alt_product_category: string
|
|
157
|
+
alt_product_family_name: string
|
|
158
|
+
alt_family_name: string
|
|
159
|
+
alt_manufacturer: string
|
|
160
|
+
alt_description: string
|
|
161
|
+
alt_lifecycle: string
|
|
162
|
+
match_score: number
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface ProductCrossSell {
|
|
166
|
+
cross_sell_part_number: string
|
|
167
|
+
cross_sell_product_category: string
|
|
168
|
+
cross_sell_product_family_name: string
|
|
169
|
+
cross_sell_family_name: string
|
|
170
|
+
cross_sell_manufacturer: string
|
|
171
|
+
cross_sell_description: string
|
|
172
|
+
recommendation_score: number
|
|
173
|
+
recommendation_source: string
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface Product {
|
|
177
|
+
id: string
|
|
178
|
+
part_number: string
|
|
179
|
+
tenant_part_number: string
|
|
180
|
+
product_category: string
|
|
181
|
+
product_group: string
|
|
182
|
+
product_family_name: string
|
|
183
|
+
manufacturer_name: string
|
|
184
|
+
description: string
|
|
185
|
+
price: number
|
|
186
|
+
currency: string
|
|
187
|
+
inventory: number
|
|
188
|
+
lead_time: string
|
|
189
|
+
lifecycle: string
|
|
190
|
+
favorite: boolean
|
|
191
|
+
alternatives: ProductAlternative[]
|
|
192
|
+
cross_sells: ProductCrossSell[]
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface Project {
|
|
196
|
+
id: string
|
|
197
|
+
name: string
|
|
198
|
+
customer_name: string
|
|
199
|
+
status: string
|
|
200
|
+
expected_closing: string
|
|
201
|
+
project_lifetime_quantity: number
|
|
202
|
+
favorite: boolean
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface CustomerProject {
|
|
206
|
+
project_name: string
|
|
207
|
+
status: string
|
|
208
|
+
volume: string
|
|
209
|
+
expected_closing: string
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface Customer {
|
|
213
|
+
id: string
|
|
214
|
+
name: string
|
|
215
|
+
main_customer: string
|
|
216
|
+
category: string
|
|
217
|
+
region: string
|
|
218
|
+
country_code: string
|
|
219
|
+
city: string
|
|
220
|
+
url: string
|
|
221
|
+
favorite: boolean
|
|
222
|
+
active_projects: CustomerProject[]
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface ApplicationProductFamily {
|
|
226
|
+
family_name: string
|
|
227
|
+
category: string
|
|
228
|
+
typical_products: string
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface Application {
|
|
232
|
+
id: string
|
|
233
|
+
name: string
|
|
234
|
+
description: string
|
|
235
|
+
url: string
|
|
236
|
+
trends: string
|
|
237
|
+
favorite: boolean
|
|
238
|
+
product_families: ApplicationProductFamily[]
|
|
239
|
+
}
|