@mdxui/tremor 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/README.md +255 -0
- package/dist/dashboard/components/index.d.ts +355 -0
- package/dist/dashboard/components/index.js +549 -0
- package/dist/dashboard/components/index.js.map +1 -0
- package/dist/dashboard/index.d.ts +275 -0
- package/dist/dashboard/index.js +1062 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/database/index.d.ts +334 -0
- package/dist/database/index.js +474 -0
- package/dist/database/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1089 -0
- package/dist/index.js.map +1 -0
- package/dist/insights/components/index.d.ts +362 -0
- package/dist/insights/components/index.js +1397 -0
- package/dist/insights/components/index.js.map +1 -0
- package/dist/insights/index.d.ts +360 -0
- package/dist/insights/index.js +1815 -0
- package/dist/insights/index.js.map +1 -0
- package/dist/overview/components/index.d.ts +86 -0
- package/dist/overview/components/index.js +775 -0
- package/dist/overview/components/index.js.map +1 -0
- package/dist/overview/index.d.ts +301 -0
- package/dist/overview/index.js +1077 -0
- package/dist/overview/index.js.map +1 -0
- package/dist/shared/index.d.ts +296 -0
- package/dist/shared/index.js +395 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/solar/components/index.d.ts +341 -0
- package/dist/solar/components/index.js +831 -0
- package/dist/solar/components/index.js.map +1 -0
- package/dist/solar/index.d.ts +301 -0
- package/dist/solar/index.js +1130 -0
- package/dist/solar/index.js.map +1 -0
- package/package.json +135 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
// src/shared/adapters/chart-adapter.ts
|
|
2
|
+
function adaptAreaChartProps(props) {
|
|
3
|
+
const {
|
|
4
|
+
data,
|
|
5
|
+
index,
|
|
6
|
+
categories,
|
|
7
|
+
colors,
|
|
8
|
+
valueFormatter,
|
|
9
|
+
startEndOnly,
|
|
10
|
+
showLegend,
|
|
11
|
+
showGridLines,
|
|
12
|
+
showAnimation,
|
|
13
|
+
stack,
|
|
14
|
+
curveType,
|
|
15
|
+
connectNulls,
|
|
16
|
+
yAxisWidth,
|
|
17
|
+
minValue,
|
|
18
|
+
maxValue,
|
|
19
|
+
className
|
|
20
|
+
} = props;
|
|
21
|
+
return {
|
|
22
|
+
data,
|
|
23
|
+
index,
|
|
24
|
+
categories,
|
|
25
|
+
colors,
|
|
26
|
+
valueFormatter,
|
|
27
|
+
startEndOnly,
|
|
28
|
+
showLegend,
|
|
29
|
+
showGridLines,
|
|
30
|
+
showAnimation,
|
|
31
|
+
stack,
|
|
32
|
+
curveType,
|
|
33
|
+
connectNulls,
|
|
34
|
+
yAxisWidth,
|
|
35
|
+
minValue,
|
|
36
|
+
maxValue,
|
|
37
|
+
className
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function adaptBarChartProps(props) {
|
|
41
|
+
const {
|
|
42
|
+
data,
|
|
43
|
+
index,
|
|
44
|
+
categories,
|
|
45
|
+
colors,
|
|
46
|
+
valueFormatter,
|
|
47
|
+
layout,
|
|
48
|
+
stack,
|
|
49
|
+
relative,
|
|
50
|
+
showLegend,
|
|
51
|
+
showGridLines,
|
|
52
|
+
showAnimation,
|
|
53
|
+
yAxisWidth,
|
|
54
|
+
barCategoryGap,
|
|
55
|
+
className
|
|
56
|
+
} = props;
|
|
57
|
+
return {
|
|
58
|
+
data,
|
|
59
|
+
index,
|
|
60
|
+
categories,
|
|
61
|
+
colors,
|
|
62
|
+
valueFormatter,
|
|
63
|
+
layout,
|
|
64
|
+
stack,
|
|
65
|
+
relative,
|
|
66
|
+
showLegend,
|
|
67
|
+
showGridLines,
|
|
68
|
+
showAnimation,
|
|
69
|
+
yAxisWidth,
|
|
70
|
+
barCategoryGap,
|
|
71
|
+
className
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function adaptLineChartProps(props) {
|
|
75
|
+
const {
|
|
76
|
+
data,
|
|
77
|
+
index,
|
|
78
|
+
categories,
|
|
79
|
+
colors,
|
|
80
|
+
valueFormatter,
|
|
81
|
+
curveType,
|
|
82
|
+
connectNulls,
|
|
83
|
+
showDots,
|
|
84
|
+
showLegend,
|
|
85
|
+
showGridLines,
|
|
86
|
+
showAnimation,
|
|
87
|
+
yAxisWidth,
|
|
88
|
+
className
|
|
89
|
+
} = props;
|
|
90
|
+
return {
|
|
91
|
+
data,
|
|
92
|
+
index,
|
|
93
|
+
categories,
|
|
94
|
+
colors,
|
|
95
|
+
valueFormatter,
|
|
96
|
+
curveType,
|
|
97
|
+
connectNulls,
|
|
98
|
+
showDots,
|
|
99
|
+
showLegend,
|
|
100
|
+
showGridLines,
|
|
101
|
+
showAnimation,
|
|
102
|
+
yAxisWidth,
|
|
103
|
+
className
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function adaptDonutChartProps(props) {
|
|
107
|
+
const {
|
|
108
|
+
data,
|
|
109
|
+
category,
|
|
110
|
+
value,
|
|
111
|
+
colors,
|
|
112
|
+
variant,
|
|
113
|
+
label,
|
|
114
|
+
showLegend,
|
|
115
|
+
showTooltip,
|
|
116
|
+
animationDuration,
|
|
117
|
+
valueFormatter,
|
|
118
|
+
className
|
|
119
|
+
} = props;
|
|
120
|
+
return {
|
|
121
|
+
data,
|
|
122
|
+
category,
|
|
123
|
+
value,
|
|
124
|
+
colors,
|
|
125
|
+
variant,
|
|
126
|
+
label,
|
|
127
|
+
showLegend,
|
|
128
|
+
showTooltip,
|
|
129
|
+
animationDuration,
|
|
130
|
+
valueFormatter,
|
|
131
|
+
className
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function adaptSparkChartProps(props) {
|
|
135
|
+
const { data, type, color, showMinMax, height, width, animate, className } = props;
|
|
136
|
+
return {
|
|
137
|
+
data,
|
|
138
|
+
type,
|
|
139
|
+
color,
|
|
140
|
+
showMinMax,
|
|
141
|
+
height,
|
|
142
|
+
width,
|
|
143
|
+
animate,
|
|
144
|
+
className
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// src/shared/adapters/metric-adapter.ts
|
|
149
|
+
function adaptMetricCardProps(props) {
|
|
150
|
+
const { title, value, delta, deltaType, decorationColor, icon, className } = props;
|
|
151
|
+
return {
|
|
152
|
+
title,
|
|
153
|
+
value,
|
|
154
|
+
delta: delta ? {
|
|
155
|
+
value: delta.value,
|
|
156
|
+
type: delta.type,
|
|
157
|
+
isIncreasePositive: delta.isIncreasePositive
|
|
158
|
+
} : void 0,
|
|
159
|
+
deltaType,
|
|
160
|
+
decorationColor,
|
|
161
|
+
icon,
|
|
162
|
+
className
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function adaptAnalyticsCardProps(props) {
|
|
166
|
+
const {
|
|
167
|
+
title,
|
|
168
|
+
description,
|
|
169
|
+
metric,
|
|
170
|
+
subtext,
|
|
171
|
+
chartType,
|
|
172
|
+
chartData,
|
|
173
|
+
chartConfig,
|
|
174
|
+
timeRange,
|
|
175
|
+
showTimeRangeSelector,
|
|
176
|
+
loading,
|
|
177
|
+
className
|
|
178
|
+
} = props;
|
|
179
|
+
return {
|
|
180
|
+
title,
|
|
181
|
+
description,
|
|
182
|
+
metric,
|
|
183
|
+
subtext,
|
|
184
|
+
chartType,
|
|
185
|
+
chartData,
|
|
186
|
+
chartConfig,
|
|
187
|
+
timeRange,
|
|
188
|
+
showTimeRangeSelector,
|
|
189
|
+
loading,
|
|
190
|
+
className
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function adaptCategoryBarProps(props) {
|
|
194
|
+
const {
|
|
195
|
+
values,
|
|
196
|
+
colors,
|
|
197
|
+
labels,
|
|
198
|
+
markerValue,
|
|
199
|
+
showMarker,
|
|
200
|
+
showLabels,
|
|
201
|
+
showValues,
|
|
202
|
+
height,
|
|
203
|
+
className
|
|
204
|
+
} = props;
|
|
205
|
+
return {
|
|
206
|
+
values,
|
|
207
|
+
colors,
|
|
208
|
+
labels,
|
|
209
|
+
markerValue,
|
|
210
|
+
showMarker,
|
|
211
|
+
showLabels,
|
|
212
|
+
showValues,
|
|
213
|
+
height,
|
|
214
|
+
className
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function adaptBarListProps(props) {
|
|
218
|
+
const { data, valueFormatter, color, showAnimation, sortOrder, className } = props;
|
|
219
|
+
return {
|
|
220
|
+
data,
|
|
221
|
+
valueFormatter,
|
|
222
|
+
color,
|
|
223
|
+
showAnimation,
|
|
224
|
+
sortOrder,
|
|
225
|
+
className
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function adaptTrackerProps(props) {
|
|
229
|
+
const { data, className } = props;
|
|
230
|
+
return {
|
|
231
|
+
data,
|
|
232
|
+
className
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function adaptDeltaBarProps(props) {
|
|
236
|
+
const { value, showAnimation, positiveColor, negativeColor, className } = props;
|
|
237
|
+
return {
|
|
238
|
+
value,
|
|
239
|
+
showAnimation,
|
|
240
|
+
positiveColor,
|
|
241
|
+
negativeColor,
|
|
242
|
+
className
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function formatDelta(value, type = "percentage") {
|
|
246
|
+
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
247
|
+
const sign = numValue >= 0 ? "+" : "";
|
|
248
|
+
if (type === "percentage") {
|
|
249
|
+
return `${sign}${numValue.toFixed(1)}%`;
|
|
250
|
+
}
|
|
251
|
+
return `${sign}${numValue}`;
|
|
252
|
+
}
|
|
253
|
+
function getTrendFromDelta(value) {
|
|
254
|
+
const numValue = typeof value === "string" ? parseFloat(value) : value;
|
|
255
|
+
if (numValue > 0) return "up";
|
|
256
|
+
if (numValue < 0) return "down";
|
|
257
|
+
return "unchanged";
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// src/shared/adapters/table-adapter.ts
|
|
261
|
+
function adaptTransactionsListProps(props) {
|
|
262
|
+
const {
|
|
263
|
+
transactions,
|
|
264
|
+
title,
|
|
265
|
+
currency,
|
|
266
|
+
valueFormatter,
|
|
267
|
+
showCategoryFilter,
|
|
268
|
+
showDateFilter,
|
|
269
|
+
showExport,
|
|
270
|
+
pageSize,
|
|
271
|
+
emptyMessage,
|
|
272
|
+
loading,
|
|
273
|
+
className
|
|
274
|
+
} = props;
|
|
275
|
+
return {
|
|
276
|
+
data: transactions,
|
|
277
|
+
title,
|
|
278
|
+
currency,
|
|
279
|
+
valueFormatter,
|
|
280
|
+
showCategoryFilter,
|
|
281
|
+
showDateFilter,
|
|
282
|
+
showExport,
|
|
283
|
+
pageSize,
|
|
284
|
+
emptyMessage,
|
|
285
|
+
loading,
|
|
286
|
+
className
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function adaptAuditLogTableProps(props) {
|
|
290
|
+
const {
|
|
291
|
+
logs,
|
|
292
|
+
title,
|
|
293
|
+
searchable,
|
|
294
|
+
filterByActor,
|
|
295
|
+
filterByAction,
|
|
296
|
+
filterByResource,
|
|
297
|
+
showDateRange,
|
|
298
|
+
showExport,
|
|
299
|
+
pageSize,
|
|
300
|
+
loading,
|
|
301
|
+
className
|
|
302
|
+
} = props;
|
|
303
|
+
return {
|
|
304
|
+
data: logs,
|
|
305
|
+
title,
|
|
306
|
+
searchable,
|
|
307
|
+
filterByActor,
|
|
308
|
+
filterByAction,
|
|
309
|
+
filterByResource,
|
|
310
|
+
showDateRange,
|
|
311
|
+
showExport,
|
|
312
|
+
pageSize,
|
|
313
|
+
loading,
|
|
314
|
+
className
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function createTransactionColumns(currency = "USD") {
|
|
318
|
+
return [
|
|
319
|
+
{
|
|
320
|
+
accessorKey: "date",
|
|
321
|
+
header: "Date",
|
|
322
|
+
cell: (info) => new Date(info.getValue()).toLocaleDateString()
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
accessorKey: "description",
|
|
326
|
+
header: "Description"
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
accessorKey: "amount",
|
|
330
|
+
header: "Amount",
|
|
331
|
+
cell: (info) => {
|
|
332
|
+
const value = info.getValue();
|
|
333
|
+
const type = info.row.original.type;
|
|
334
|
+
const formatted = new Intl.NumberFormat("en-US", {
|
|
335
|
+
style: "currency",
|
|
336
|
+
currency
|
|
337
|
+
}).format(Math.abs(value));
|
|
338
|
+
return type === "debit" ? `-${formatted}` : formatted;
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
accessorKey: "status",
|
|
343
|
+
header: "Status"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
accessorKey: "category",
|
|
347
|
+
header: "Category"
|
|
348
|
+
}
|
|
349
|
+
];
|
|
350
|
+
}
|
|
351
|
+
function createAuditLogColumns() {
|
|
352
|
+
return [
|
|
353
|
+
{
|
|
354
|
+
accessorKey: "timestamp",
|
|
355
|
+
header: "Time",
|
|
356
|
+
cell: (info) => new Date(info.getValue()).toLocaleString()
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
accessorKey: "actor.name",
|
|
360
|
+
header: "User"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
accessorKey: "action",
|
|
364
|
+
header: "Action"
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
accessorKey: "resource.type",
|
|
368
|
+
header: "Resource"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
accessorKey: "resource.name",
|
|
372
|
+
header: "Name"
|
|
373
|
+
}
|
|
374
|
+
];
|
|
375
|
+
}
|
|
376
|
+
export {
|
|
377
|
+
adaptAnalyticsCardProps,
|
|
378
|
+
adaptAreaChartProps,
|
|
379
|
+
adaptAuditLogTableProps,
|
|
380
|
+
adaptBarChartProps,
|
|
381
|
+
adaptBarListProps,
|
|
382
|
+
adaptCategoryBarProps,
|
|
383
|
+
adaptDeltaBarProps,
|
|
384
|
+
adaptDonutChartProps,
|
|
385
|
+
adaptLineChartProps,
|
|
386
|
+
adaptMetricCardProps,
|
|
387
|
+
adaptSparkChartProps,
|
|
388
|
+
adaptTrackerProps,
|
|
389
|
+
adaptTransactionsListProps,
|
|
390
|
+
createAuditLogColumns,
|
|
391
|
+
createTransactionColumns,
|
|
392
|
+
formatDelta,
|
|
393
|
+
getTrendFromDelta
|
|
394
|
+
};
|
|
395
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/shared/adapters/chart-adapter.ts","../../src/shared/adapters/metric-adapter.ts","../../src/shared/adapters/table-adapter.ts"],"sourcesContent":["/**\n * Chart Adapter - Maps mdxui chart props to Tremor chart props\n *\n * The adapter pattern ensures:\n * - No modification of Tremor component code\n * - Pixel-perfect visual fidelity\n * - mdxui type compliance\n */\n\nimport type {\n\tDonutChartProps,\n\tSparkChartProps,\n\tTremorAreaChartProps,\n\tTremorBarChartProps,\n\tTremorLineChartProps,\n} from \"mdxui\";\n\n/**\n * Adapt mdxui AreaChartProps to Tremor AreaChart props\n */\nexport function adaptAreaChartProps(props: TremorAreaChartProps) {\n\tconst {\n\t\tdata,\n\t\tindex,\n\t\tcategories,\n\t\tcolors,\n\t\tvalueFormatter,\n\t\tstartEndOnly,\n\t\tshowLegend,\n\t\tshowGridLines,\n\t\tshowAnimation,\n\t\tstack,\n\t\tcurveType,\n\t\tconnectNulls,\n\t\tyAxisWidth,\n\t\tminValue,\n\t\tmaxValue,\n\t\tclassName,\n\t} = props;\n\n\treturn {\n\t\tdata,\n\t\tindex,\n\t\tcategories,\n\t\tcolors,\n\t\tvalueFormatter,\n\t\tstartEndOnly,\n\t\tshowLegend,\n\t\tshowGridLines,\n\t\tshowAnimation,\n\t\tstack,\n\t\tcurveType,\n\t\tconnectNulls,\n\t\tyAxisWidth,\n\t\tminValue,\n\t\tmaxValue,\n\t\tclassName,\n\t};\n}\n\n/**\n * Adapt mdxui BarChartProps to Tremor BarChart props\n */\nexport function adaptBarChartProps(props: TremorBarChartProps) {\n\tconst {\n\t\tdata,\n\t\tindex,\n\t\tcategories,\n\t\tcolors,\n\t\tvalueFormatter,\n\t\tlayout,\n\t\tstack,\n\t\trelative,\n\t\tshowLegend,\n\t\tshowGridLines,\n\t\tshowAnimation,\n\t\tyAxisWidth,\n\t\tbarCategoryGap,\n\t\tclassName,\n\t} = props;\n\n\treturn {\n\t\tdata,\n\t\tindex,\n\t\tcategories,\n\t\tcolors,\n\t\tvalueFormatter,\n\t\tlayout,\n\t\tstack,\n\t\trelative,\n\t\tshowLegend,\n\t\tshowGridLines,\n\t\tshowAnimation,\n\t\tyAxisWidth,\n\t\tbarCategoryGap,\n\t\tclassName,\n\t};\n}\n\n/**\n * Adapt mdxui LineChartProps to Tremor LineChart props\n */\nexport function adaptLineChartProps(props: TremorLineChartProps) {\n\tconst {\n\t\tdata,\n\t\tindex,\n\t\tcategories,\n\t\tcolors,\n\t\tvalueFormatter,\n\t\tcurveType,\n\t\tconnectNulls,\n\t\tshowDots,\n\t\tshowLegend,\n\t\tshowGridLines,\n\t\tshowAnimation,\n\t\tyAxisWidth,\n\t\tclassName,\n\t} = props;\n\n\treturn {\n\t\tdata,\n\t\tindex,\n\t\tcategories,\n\t\tcolors,\n\t\tvalueFormatter,\n\t\tcurveType,\n\t\tconnectNulls,\n\t\tshowDots,\n\t\tshowLegend,\n\t\tshowGridLines,\n\t\tshowAnimation,\n\t\tyAxisWidth,\n\t\tclassName,\n\t};\n}\n\n/**\n * Adapt mdxui DonutChartProps to Tremor DonutChart props\n */\nexport function adaptDonutChartProps(props: DonutChartProps) {\n\tconst {\n\t\tdata,\n\t\tcategory,\n\t\tvalue,\n\t\tcolors,\n\t\tvariant,\n\t\tlabel,\n\t\tshowLegend,\n\t\tshowTooltip,\n\t\tanimationDuration,\n\t\tvalueFormatter,\n\t\tclassName,\n\t} = props;\n\n\treturn {\n\t\tdata,\n\t\tcategory,\n\t\tvalue,\n\t\tcolors,\n\t\tvariant,\n\t\tlabel,\n\t\tshowLegend,\n\t\tshowTooltip,\n\t\tanimationDuration,\n\t\tvalueFormatter,\n\t\tclassName,\n\t};\n}\n\n/**\n * Adapt mdxui SparkChartProps to Tremor SparkChart props\n */\nexport function adaptSparkChartProps(props: SparkChartProps) {\n\tconst { data, type, color, showMinMax, height, width, animate, className } =\n\t\tprops;\n\n\treturn {\n\t\tdata,\n\t\ttype,\n\t\tcolor,\n\t\tshowMinMax,\n\t\theight,\n\t\twidth,\n\t\tanimate,\n\t\tclassName,\n\t};\n}\n","/**\n * Metric Adapter - Maps mdxui metric props to Tremor metric props\n *\n * The adapter pattern ensures:\n * - No modification of Tremor component code\n * - Pixel-perfect visual fidelity\n * - mdxui type compliance\n */\n\nimport type {\n\tAnalyticsCardProps,\n\tBarListProps,\n\tCategoryBarProps,\n\tDeltaBarProps,\n\tTrackerProps,\n\tTremorMetricCardProps,\n} from \"mdxui\";\n\n/**\n * Adapt mdxui TremorMetricCardProps to Tremor Card props\n */\nexport function adaptMetricCardProps(props: TremorMetricCardProps) {\n\tconst { title, value, delta, deltaType, decorationColor, icon, className } =\n\t\tprops;\n\n\treturn {\n\t\ttitle,\n\t\tvalue,\n\t\tdelta: delta\n\t\t\t? {\n\t\t\t\t\tvalue: delta.value,\n\t\t\t\t\ttype: delta.type,\n\t\t\t\t\tisIncreasePositive: delta.isIncreasePositive,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tdeltaType,\n\t\tdecorationColor,\n\t\ticon,\n\t\tclassName,\n\t};\n}\n\n/**\n * Adapt mdxui AnalyticsCardProps to composite Tremor card props\n */\nexport function adaptAnalyticsCardProps(props: AnalyticsCardProps) {\n\tconst {\n\t\ttitle,\n\t\tdescription,\n\t\tmetric,\n\t\tsubtext,\n\t\tchartType,\n\t\tchartData,\n\t\tchartConfig,\n\t\ttimeRange,\n\t\tshowTimeRangeSelector,\n\t\tloading,\n\t\tclassName,\n\t} = props;\n\n\treturn {\n\t\ttitle,\n\t\tdescription,\n\t\tmetric,\n\t\tsubtext,\n\t\tchartType,\n\t\tchartData,\n\t\tchartConfig,\n\t\ttimeRange,\n\t\tshowTimeRangeSelector,\n\t\tloading,\n\t\tclassName,\n\t};\n}\n\n/**\n * Adapt mdxui CategoryBarProps to Tremor CategoryBar props\n */\nexport function adaptCategoryBarProps(props: CategoryBarProps) {\n\tconst {\n\t\tvalues,\n\t\tcolors,\n\t\tlabels,\n\t\tmarkerValue,\n\t\tshowMarker,\n\t\tshowLabels,\n\t\tshowValues,\n\t\theight,\n\t\tclassName,\n\t} = props;\n\n\treturn {\n\t\tvalues,\n\t\tcolors,\n\t\tlabels,\n\t\tmarkerValue,\n\t\tshowMarker,\n\t\tshowLabels,\n\t\tshowValues,\n\t\theight,\n\t\tclassName,\n\t};\n}\n\n/**\n * Adapt mdxui BarListProps to Tremor BarList props\n */\nexport function adaptBarListProps(props: BarListProps) {\n\tconst { data, valueFormatter, color, showAnimation, sortOrder, className } =\n\t\tprops;\n\n\treturn {\n\t\tdata,\n\t\tvalueFormatter,\n\t\tcolor,\n\t\tshowAnimation,\n\t\tsortOrder,\n\t\tclassName,\n\t};\n}\n\n/**\n * Adapt mdxui TrackerProps to Tremor Tracker props\n */\nexport function adaptTrackerProps(props: TrackerProps) {\n\tconst { data, className } = props;\n\n\treturn {\n\t\tdata,\n\t\tclassName,\n\t};\n}\n\n/**\n * Adapt mdxui DeltaBarProps to Tremor DeltaBar props\n */\nexport function adaptDeltaBarProps(props: DeltaBarProps) {\n\tconst { value, showAnimation, positiveColor, negativeColor, className } =\n\t\tprops;\n\n\treturn {\n\t\tvalue,\n\t\tshowAnimation,\n\t\tpositiveColor,\n\t\tnegativeColor,\n\t\tclassName,\n\t};\n}\n\n/**\n * Format delta value for display\n */\nexport function formatDelta(\n\tvalue: number | string,\n\ttype: \"percentage\" | \"absolute\" = \"percentage\",\n): string {\n\tconst numValue = typeof value === \"string\" ? parseFloat(value) : value;\n\tconst sign = numValue >= 0 ? \"+\" : \"\";\n\n\tif (type === \"percentage\") {\n\t\treturn `${sign}${numValue.toFixed(1)}%`;\n\t}\n\n\treturn `${sign}${numValue}`;\n}\n\n/**\n * Determine trend direction from delta value\n */\nexport function getTrendFromDelta(\n\tvalue: number | string,\n): \"up\" | \"down\" | \"unchanged\" {\n\tconst numValue = typeof value === \"string\" ? parseFloat(value) : value;\n\n\tif (numValue > 0) return \"up\";\n\tif (numValue < 0) return \"down\";\n\treturn \"unchanged\";\n}\n","/**\n * Table Adapter - Maps mdxui table props to Tremor/TanStack Table props\n *\n * The adapter pattern ensures:\n * - No modification of Tremor component code\n * - Pixel-perfect visual fidelity\n * - mdxui type compliance\n */\n\nimport type { AuditLogTableProps, TransactionsListProps } from \"mdxui\";\n\n/**\n * Adapt mdxui TransactionsListProps to Tremor table props\n */\nexport function adaptTransactionsListProps(props: TransactionsListProps) {\n\tconst {\n\t\ttransactions,\n\t\ttitle,\n\t\tcurrency,\n\t\tvalueFormatter,\n\t\tshowCategoryFilter,\n\t\tshowDateFilter,\n\t\tshowExport,\n\t\tpageSize,\n\t\temptyMessage,\n\t\tloading,\n\t\tclassName,\n\t} = props;\n\n\treturn {\n\t\tdata: transactions,\n\t\ttitle,\n\t\tcurrency,\n\t\tvalueFormatter,\n\t\tshowCategoryFilter,\n\t\tshowDateFilter,\n\t\tshowExport,\n\t\tpageSize,\n\t\temptyMessage,\n\t\tloading,\n\t\tclassName,\n\t};\n}\n\n/**\n * Adapt mdxui AuditLogTableProps to Tremor table props\n */\nexport function adaptAuditLogTableProps(props: AuditLogTableProps) {\n\tconst {\n\t\tlogs,\n\t\ttitle,\n\t\tsearchable,\n\t\tfilterByActor,\n\t\tfilterByAction,\n\t\tfilterByResource,\n\t\tshowDateRange,\n\t\tshowExport,\n\t\tpageSize,\n\t\tloading,\n\t\tclassName,\n\t} = props;\n\n\treturn {\n\t\tdata: logs,\n\t\ttitle,\n\t\tsearchable,\n\t\tfilterByActor,\n\t\tfilterByAction,\n\t\tfilterByResource,\n\t\tshowDateRange,\n\t\tshowExport,\n\t\tpageSize,\n\t\tloading,\n\t\tclassName,\n\t};\n}\n\n/**\n * Transform transaction data for TanStack Table column definitions\n */\nexport function createTransactionColumns(currency: string = \"USD\") {\n\treturn [\n\t\t{\n\t\t\taccessorKey: \"date\",\n\t\t\theader: \"Date\",\n\t\t\tcell: (info: { getValue: () => string }) =>\n\t\t\t\tnew Date(info.getValue()).toLocaleDateString(),\n\t\t},\n\t\t{\n\t\t\taccessorKey: \"description\",\n\t\t\theader: \"Description\",\n\t\t},\n\t\t{\n\t\t\taccessorKey: \"amount\",\n\t\t\theader: \"Amount\",\n\t\t\tcell: (info: {\n\t\t\t\tgetValue: () => number;\n\t\t\t\trow: { original: { type: string } };\n\t\t\t}) => {\n\t\t\t\tconst value = info.getValue();\n\t\t\t\tconst type = info.row.original.type;\n\t\t\t\tconst formatted = new Intl.NumberFormat(\"en-US\", {\n\t\t\t\t\tstyle: \"currency\",\n\t\t\t\t\tcurrency,\n\t\t\t\t}).format(Math.abs(value));\n\t\t\t\treturn type === \"debit\" ? `-${formatted}` : formatted;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\taccessorKey: \"status\",\n\t\t\theader: \"Status\",\n\t\t},\n\t\t{\n\t\t\taccessorKey: \"category\",\n\t\t\theader: \"Category\",\n\t\t},\n\t];\n}\n\n/**\n * Transform audit log data for TanStack Table column definitions\n */\nexport function createAuditLogColumns() {\n\treturn [\n\t\t{\n\t\t\taccessorKey: \"timestamp\",\n\t\t\theader: \"Time\",\n\t\t\tcell: (info: { getValue: () => string }) =>\n\t\t\t\tnew Date(info.getValue()).toLocaleString(),\n\t\t},\n\t\t{\n\t\t\taccessorKey: \"actor.name\",\n\t\t\theader: \"User\",\n\t\t},\n\t\t{\n\t\t\taccessorKey: \"action\",\n\t\t\theader: \"Action\",\n\t\t},\n\t\t{\n\t\t\taccessorKey: \"resource.type\",\n\t\t\theader: \"Resource\",\n\t\t},\n\t\t{\n\t\t\taccessorKey: \"resource.name\",\n\t\t\theader: \"Name\",\n\t\t},\n\t];\n}\n"],"mappings":";AAoBO,SAAS,oBAAoB,OAA6B;AAChE,QAAM;AAAA,I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