@northslopetech/altitude-ui 2.0.14 → 2.0.17
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/index.d.mts +658 -3
- package/dist/index.d.ts +658 -3
- package/dist/index.js +836 -1
- package/dist/index.mjs +828 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -35,14 +35,19 @@ __export(index_exports, {
|
|
|
35
35
|
ArrowRight: () => ArrowRight,
|
|
36
36
|
ArrowUp: () => ArrowUp,
|
|
37
37
|
Badge: () => Badge,
|
|
38
|
+
BarChart: () => BarChart,
|
|
38
39
|
Bell: () => Bell,
|
|
39
40
|
Bookmark: () => Bookmark,
|
|
40
41
|
Button: () => Button,
|
|
42
|
+
CHART_COLORS: () => CHART_COLORS,
|
|
43
|
+
CHART_CONSTANTS: () => CHART_CONSTANTS,
|
|
44
|
+
COLOR_SCHEMES: () => COLOR_SCHEMES,
|
|
41
45
|
Calendar: () => Calendar,
|
|
42
46
|
CaretDown: () => CaretDown,
|
|
43
47
|
CaretLeft: () => CaretLeft,
|
|
44
48
|
CaretRight: () => CaretRight,
|
|
45
49
|
CaretUp: () => CaretUp,
|
|
50
|
+
ChartLegend: () => ChartLegend,
|
|
46
51
|
Chat: () => Chat,
|
|
47
52
|
Check: () => Check,
|
|
48
53
|
CheckIcon: () => CheckIcon,
|
|
@@ -83,6 +88,7 @@ __export(index_exports, {
|
|
|
83
88
|
Filter: () => Filter,
|
|
84
89
|
FilterDescending: () => FilterDescending,
|
|
85
90
|
FormField: () => FormField,
|
|
91
|
+
GenericTooltip: () => GenericTooltip,
|
|
86
92
|
GraphBar: () => GraphBar,
|
|
87
93
|
GraphDonut: () => GraphDonut,
|
|
88
94
|
GraphLine: () => GraphLine,
|
|
@@ -91,6 +97,7 @@ __export(index_exports, {
|
|
|
91
97
|
Home: () => Home,
|
|
92
98
|
Information: () => Information,
|
|
93
99
|
Input: () => TypedInput,
|
|
100
|
+
LineChart: () => LineChart,
|
|
94
101
|
Location: () => Location,
|
|
95
102
|
Lock: () => Lock,
|
|
96
103
|
Logout: () => Logout,
|
|
@@ -98,6 +105,7 @@ __export(index_exports, {
|
|
|
98
105
|
Minus: () => Minus,
|
|
99
106
|
MoreMenu: () => MoreMenu,
|
|
100
107
|
Phone: () => Phone,
|
|
108
|
+
PieChart: () => PieChart,
|
|
101
109
|
Plus: () => Plus,
|
|
102
110
|
QuestionCircle: () => QuestionCircle,
|
|
103
111
|
Select: () => Select,
|
|
@@ -114,10 +122,13 @@ __export(index_exports, {
|
|
|
114
122
|
Star: () => Star,
|
|
115
123
|
Statement: () => Statement,
|
|
116
124
|
Table: () => Table,
|
|
125
|
+
TableIcon: () => TableIcon,
|
|
117
126
|
Tabs: () => Tabs,
|
|
118
127
|
TabsContent: () => TabsContent,
|
|
119
128
|
TabsList: () => TabsList,
|
|
120
129
|
TabsTrigger: () => TabsTrigger,
|
|
130
|
+
TooltipContainer: () => TooltipContainer,
|
|
131
|
+
TooltipItem: () => TooltipItem,
|
|
121
132
|
Trash: () => Trash,
|
|
122
133
|
Typography: () => Typography,
|
|
123
134
|
Upload: () => Upload,
|
|
@@ -128,7 +139,20 @@ __export(index_exports, {
|
|
|
128
139
|
X: () => X,
|
|
129
140
|
badgeVariants: () => badgeVariants,
|
|
130
141
|
buttonVariants: () => buttonVariants,
|
|
142
|
+
calculateYAxisWidth: () => calculateYAxisWidth,
|
|
131
143
|
checkboxVariants: () => checkboxVariants,
|
|
144
|
+
createCustomXAxisLabel: () => createCustomXAxisLabel,
|
|
145
|
+
createCustomYAxisLabel: () => createCustomYAxisLabel,
|
|
146
|
+
createCustomYAxisRightLabel: () => createCustomYAxisRightLabel,
|
|
147
|
+
createLegendItems: () => createLegendItems,
|
|
148
|
+
customXAxisTick: () => customXAxisTick,
|
|
149
|
+
customXAxisTickRotated: () => customXAxisTickRotated,
|
|
150
|
+
customYAxisTick: () => customYAxisTick,
|
|
151
|
+
formatLargeNumber: () => formatLargeNumber,
|
|
152
|
+
formatPercentage: () => formatPercentage,
|
|
153
|
+
getHeatmapColor: () => getHeatmapColor,
|
|
154
|
+
getPerformanceColor: () => getPerformanceColor,
|
|
155
|
+
getSeriesColor: () => getSeriesColor,
|
|
132
156
|
inputVariants: () => inputVariants,
|
|
133
157
|
selectTriggerVariants: () => selectTriggerVariants,
|
|
134
158
|
tabsVariants: () => tabsVariants,
|
|
@@ -1609,7 +1633,7 @@ var Statement = ({
|
|
|
1609
1633
|
)
|
|
1610
1634
|
}
|
|
1611
1635
|
);
|
|
1612
|
-
var
|
|
1636
|
+
var TableIcon = ({
|
|
1613
1637
|
className,
|
|
1614
1638
|
variant = "dark",
|
|
1615
1639
|
...props
|
|
@@ -3157,6 +3181,793 @@ var DropdownMenuShortcut = ({
|
|
|
3157
3181
|
);
|
|
3158
3182
|
};
|
|
3159
3183
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
3184
|
+
|
|
3185
|
+
// src/components/ui/charts/chart-legend.tsx
|
|
3186
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3187
|
+
function ChartLegend({
|
|
3188
|
+
items,
|
|
3189
|
+
x = 0,
|
|
3190
|
+
y = 550,
|
|
3191
|
+
className = ""
|
|
3192
|
+
}) {
|
|
3193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("foreignObject", { x, y, width: "100%", height: "40", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3194
|
+
"div",
|
|
3195
|
+
{
|
|
3196
|
+
className: `flex justify-center items-center gap-6 ${className}`,
|
|
3197
|
+
style: { height: "100%" },
|
|
3198
|
+
children: items.map(({ key, color, label }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
3199
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "w-3 h-3", style: { backgroundColor: color } }),
|
|
3200
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Typography, { variant: "body-xs", children: label || key })
|
|
3201
|
+
] }, key))
|
|
3202
|
+
}
|
|
3203
|
+
) });
|
|
3204
|
+
}
|
|
3205
|
+
|
|
3206
|
+
// src/lib/chart-utils.ts
|
|
3207
|
+
var CHART_COLORS = {
|
|
3208
|
+
// Status colors
|
|
3209
|
+
SUCCESS: "var(--color-success)",
|
|
3210
|
+
ERROR: "var(--color-error)",
|
|
3211
|
+
WARNING: "var(--color-warning)",
|
|
3212
|
+
SECONDARY: "var(--color-secondary)",
|
|
3213
|
+
// Primary brand colors
|
|
3214
|
+
PRIMARY: "var(--color-primary)",
|
|
3215
|
+
// Categorical palette from altitude-tokens
|
|
3216
|
+
CATEGORICAL: [
|
|
3217
|
+
"var(--color-chart-color-palette-categorical-1)",
|
|
3218
|
+
"var(--color-chart-color-palette-categorical-2)",
|
|
3219
|
+
"var(--color-chart-color-palette-categorical-3)",
|
|
3220
|
+
"var(--color-chart-color-palette-categorical-4)",
|
|
3221
|
+
"var(--color-chart-color-palette-categorical-5)"
|
|
3222
|
+
],
|
|
3223
|
+
// Performance palette from altitude-tokens
|
|
3224
|
+
PERFORMANCE: [
|
|
3225
|
+
"var(--color-chart-color-palette-performance-1)",
|
|
3226
|
+
"var(--color-chart-color-palette-performance-2)",
|
|
3227
|
+
"var(--color-chart-color-palette-performance-3)",
|
|
3228
|
+
"var(--color-chart-color-palette-performance-4)",
|
|
3229
|
+
"var(--color-chart-color-palette-performance-5)"
|
|
3230
|
+
],
|
|
3231
|
+
// Heatmap palette from altitude-tokens
|
|
3232
|
+
HEATMAP: [
|
|
3233
|
+
"var(--color-chart-color-palette-heatmap-1)",
|
|
3234
|
+
"var(--color-chart-color-palette-heatmap-2)",
|
|
3235
|
+
"var(--color-chart-color-palette-heatmap-3)",
|
|
3236
|
+
"var(--color-chart-color-palette-heatmap-4)",
|
|
3237
|
+
"var(--color-chart-color-palette-heatmap-5)"
|
|
3238
|
+
]
|
|
3239
|
+
};
|
|
3240
|
+
var COLOR_SCHEMES = {
|
|
3241
|
+
passFail: {
|
|
3242
|
+
PASS: CHART_COLORS.SUCCESS,
|
|
3243
|
+
FAIL: CHART_COLORS.ERROR
|
|
3244
|
+
},
|
|
3245
|
+
targetVsAchieved: {
|
|
3246
|
+
TARGET: CHART_COLORS.SECONDARY,
|
|
3247
|
+
ACHIEVED: CHART_COLORS.SUCCESS
|
|
3248
|
+
},
|
|
3249
|
+
performance: {
|
|
3250
|
+
HIGH: CHART_COLORS.PERFORMANCE[0],
|
|
3251
|
+
MEDIUM_HIGH: CHART_COLORS.PERFORMANCE[1],
|
|
3252
|
+
MEDIUM: CHART_COLORS.PERFORMANCE[2],
|
|
3253
|
+
MEDIUM_LOW: CHART_COLORS.PERFORMANCE[3],
|
|
3254
|
+
LOW: CHART_COLORS.PERFORMANCE[4]
|
|
3255
|
+
}
|
|
3256
|
+
};
|
|
3257
|
+
var CHART_CONSTANTS = {
|
|
3258
|
+
// Standard chart dimensions
|
|
3259
|
+
STANDARD_HEIGHT: 400,
|
|
3260
|
+
LARGE_HEIGHT: 500,
|
|
3261
|
+
SMALL_HEIGHT: 300,
|
|
3262
|
+
// Chart margins
|
|
3263
|
+
MARGIN: {
|
|
3264
|
+
top: 20,
|
|
3265
|
+
right: 30,
|
|
3266
|
+
left: 20,
|
|
3267
|
+
bottom: 5
|
|
3268
|
+
},
|
|
3269
|
+
// Axis dimensions
|
|
3270
|
+
AXIS_HEIGHT_STANDARD: 30,
|
|
3271
|
+
AXIS_HEIGHT_ROTATED: 60,
|
|
3272
|
+
AXIS_WIDTH_STANDARD: 60,
|
|
3273
|
+
AXIS_WIDTH_YAXIS: 80,
|
|
3274
|
+
// Pie chart constants
|
|
3275
|
+
PIE_CHART_CENTER_X: 300,
|
|
3276
|
+
PIE_CHART_CENTER_Y: 200
|
|
3277
|
+
};
|
|
3278
|
+
var getSeriesColor = (index) => {
|
|
3279
|
+
return CHART_COLORS.CATEGORICAL[index % CHART_COLORS.CATEGORICAL.length] || CHART_COLORS.PRIMARY;
|
|
3280
|
+
};
|
|
3281
|
+
var getPerformanceColor = (index) => {
|
|
3282
|
+
return CHART_COLORS.PERFORMANCE[index % CHART_COLORS.PERFORMANCE.length] || CHART_COLORS.PRIMARY;
|
|
3283
|
+
};
|
|
3284
|
+
var getHeatmapColor = (index) => {
|
|
3285
|
+
return CHART_COLORS.HEATMAP[index % CHART_COLORS.HEATMAP.length] || CHART_COLORS.PRIMARY;
|
|
3286
|
+
};
|
|
3287
|
+
var createLegendItems = (colorScheme) => {
|
|
3288
|
+
return Object.entries(colorScheme).map(([key, color]) => ({
|
|
3289
|
+
key,
|
|
3290
|
+
color,
|
|
3291
|
+
label: key
|
|
3292
|
+
}));
|
|
3293
|
+
};
|
|
3294
|
+
var calculateYAxisWidth = (data, yAxisKey) => {
|
|
3295
|
+
if (!data || data.length === 0) return CHART_CONSTANTS.AXIS_WIDTH_YAXIS;
|
|
3296
|
+
const maxLength = Math.max(
|
|
3297
|
+
...data.map((item) => {
|
|
3298
|
+
const value = item[yAxisKey];
|
|
3299
|
+
return String(value || "").length;
|
|
3300
|
+
})
|
|
3301
|
+
);
|
|
3302
|
+
return Math.max(maxLength * 8 + 20, CHART_CONSTANTS.AXIS_WIDTH_YAXIS);
|
|
3303
|
+
};
|
|
3304
|
+
var formatPercentage = (value, decimals = 1) => {
|
|
3305
|
+
return `${(value * 100).toFixed(decimals)}%`;
|
|
3306
|
+
};
|
|
3307
|
+
var formatLargeNumber = (value) => {
|
|
3308
|
+
if (value >= 1e6) {
|
|
3309
|
+
return `${(value / 1e6).toFixed(1)}M`;
|
|
3310
|
+
}
|
|
3311
|
+
if (value >= 1e3) {
|
|
3312
|
+
return `${(value / 1e3).toFixed(1)}K`;
|
|
3313
|
+
}
|
|
3314
|
+
return value.toString();
|
|
3315
|
+
};
|
|
3316
|
+
|
|
3317
|
+
// src/components/ui/charts/chart-labels.tsx
|
|
3318
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3319
|
+
var createCustomXAxisLabel = (text, yOffset = 40) => {
|
|
3320
|
+
const CustomXAxisLabel = ({ viewBox }) => {
|
|
3321
|
+
if (!viewBox) return null;
|
|
3322
|
+
const { x, y, width } = viewBox;
|
|
3323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("foreignObject", { x, y: y + yOffset, width, height: 20, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex justify-center w-full", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Typography, { variant: "label-xs-bold", className: "text-secondary", children: text }) }) }) });
|
|
3324
|
+
};
|
|
3325
|
+
CustomXAxisLabel.displayName = "CustomXAxisLabel";
|
|
3326
|
+
return CustomXAxisLabel;
|
|
3327
|
+
};
|
|
3328
|
+
var createCustomYAxisLabel = (text, leftMargin) => {
|
|
3329
|
+
const CustomYAxisLabel = ({ viewBox }) => {
|
|
3330
|
+
if (!viewBox) return null;
|
|
3331
|
+
const { x, y, height } = viewBox;
|
|
3332
|
+
const offset = leftMargin ? leftMargin + 10 : 110;
|
|
3333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("foreignObject", { x: x - offset, y, width: 100, height, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center justify-center h-full transform -rotate-90 whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Typography, { variant: "label-xs-bold", className: "text-secondary", children: text }) }) }) });
|
|
3334
|
+
};
|
|
3335
|
+
CustomYAxisLabel.displayName = "CustomYAxisLabel";
|
|
3336
|
+
return CustomYAxisLabel;
|
|
3337
|
+
};
|
|
3338
|
+
var createCustomYAxisRightLabel = (text) => {
|
|
3339
|
+
const CustomYAxisRightLabel = ({ viewBox }) => {
|
|
3340
|
+
if (!viewBox) return null;
|
|
3341
|
+
const { x, y, width, height } = viewBox;
|
|
3342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("g", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("foreignObject", { x: x + width - 70, y, width: 120, height, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center justify-center h-full transform rotate-90 whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Typography, { variant: "label-xs-bold", className: "text-secondary", children: text }) }) }) });
|
|
3343
|
+
};
|
|
3344
|
+
CustomYAxisRightLabel.displayName = "CustomYAxisRightLabel";
|
|
3345
|
+
return CustomYAxisRightLabel;
|
|
3346
|
+
};
|
|
3347
|
+
var customXAxisTick = (props) => {
|
|
3348
|
+
const { x, y, payload } = props;
|
|
3349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("g", { transform: `translate(${x},${y})`, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3350
|
+
"foreignObject",
|
|
3351
|
+
{
|
|
3352
|
+
x: -20,
|
|
3353
|
+
y: 5,
|
|
3354
|
+
width: 40,
|
|
3355
|
+
height: 20,
|
|
3356
|
+
style: { overflow: "visible" },
|
|
3357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3358
|
+
"div",
|
|
3359
|
+
{
|
|
3360
|
+
className: "flex items-start justify-center h-full",
|
|
3361
|
+
style: { overflow: "visible" },
|
|
3362
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3363
|
+
Typography,
|
|
3364
|
+
{
|
|
3365
|
+
variant: "body-xs",
|
|
3366
|
+
className: "text-secondary whitespace-nowrap",
|
|
3367
|
+
children: payload.value
|
|
3368
|
+
}
|
|
3369
|
+
)
|
|
3370
|
+
}
|
|
3371
|
+
)
|
|
3372
|
+
}
|
|
3373
|
+
) });
|
|
3374
|
+
};
|
|
3375
|
+
var customXAxisTickRotated = (props) => {
|
|
3376
|
+
const { x, y, payload } = props;
|
|
3377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("g", { transform: `translate(${x},${y})`, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3378
|
+
"text",
|
|
3379
|
+
{
|
|
3380
|
+
x: 0,
|
|
3381
|
+
y: 0,
|
|
3382
|
+
dy: 10,
|
|
3383
|
+
textAnchor: "end",
|
|
3384
|
+
fill: "currentColor",
|
|
3385
|
+
transform: "rotate(-45)",
|
|
3386
|
+
className: "text-secondary",
|
|
3387
|
+
style: { fontSize: "12px" },
|
|
3388
|
+
children: payload.value
|
|
3389
|
+
}
|
|
3390
|
+
) });
|
|
3391
|
+
};
|
|
3392
|
+
var customYAxisTick = (props) => {
|
|
3393
|
+
const { x, y, payload } = props;
|
|
3394
|
+
const text = String(payload.value);
|
|
3395
|
+
const estimatedWidth = Math.max(text.length * 8, 80);
|
|
3396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3397
|
+
"foreignObject",
|
|
3398
|
+
{
|
|
3399
|
+
x: x - estimatedWidth + 5,
|
|
3400
|
+
y: y - 6,
|
|
3401
|
+
width: estimatedWidth,
|
|
3402
|
+
height: 15,
|
|
3403
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex justify-end w-full", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Typography, { variant: "body-xs", className: "text-secondary", children: payload.value }) })
|
|
3404
|
+
}
|
|
3405
|
+
);
|
|
3406
|
+
};
|
|
3407
|
+
|
|
3408
|
+
// src/components/ui/charts/chart-tooltip.tsx
|
|
3409
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3410
|
+
function TooltipContainer({
|
|
3411
|
+
children,
|
|
3412
|
+
className = ""
|
|
3413
|
+
}) {
|
|
3414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3415
|
+
"div",
|
|
3416
|
+
{
|
|
3417
|
+
className: `bg-light border border-subtle rounded p-2.5 text-dark ${className}`,
|
|
3418
|
+
children
|
|
3419
|
+
}
|
|
3420
|
+
);
|
|
3421
|
+
}
|
|
3422
|
+
function TooltipItem({
|
|
3423
|
+
color,
|
|
3424
|
+
label,
|
|
3425
|
+
value,
|
|
3426
|
+
className = ""
|
|
3427
|
+
}) {
|
|
3428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
3429
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("br", {}),
|
|
3430
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Typography, { variant: "label-sm", className, children: [
|
|
3431
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3432
|
+
"span",
|
|
3433
|
+
{
|
|
3434
|
+
className: "inline-block w-3 h-3 mr-1.5",
|
|
3435
|
+
style: { backgroundColor: color }
|
|
3436
|
+
}
|
|
3437
|
+
),
|
|
3438
|
+
label,
|
|
3439
|
+
": ",
|
|
3440
|
+
value
|
|
3441
|
+
] })
|
|
3442
|
+
] });
|
|
3443
|
+
}
|
|
3444
|
+
function GenericTooltip({
|
|
3445
|
+
title,
|
|
3446
|
+
items,
|
|
3447
|
+
className = ""
|
|
3448
|
+
}) {
|
|
3449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(TooltipContainer, { className, children: [
|
|
3450
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Typography, { variant: "label-sm-bold", children: title }),
|
|
3451
|
+
items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3452
|
+
TooltipItem,
|
|
3453
|
+
{
|
|
3454
|
+
color: item.color,
|
|
3455
|
+
label: item.label,
|
|
3456
|
+
value: item.value
|
|
3457
|
+
},
|
|
3458
|
+
index
|
|
3459
|
+
))
|
|
3460
|
+
] });
|
|
3461
|
+
}
|
|
3462
|
+
|
|
3463
|
+
// src/components/ui/charts/bar-chart.tsx
|
|
3464
|
+
var import_react = require("react");
|
|
3465
|
+
var import_recharts = require("recharts");
|
|
3466
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3467
|
+
var BarChart = (0, import_react.forwardRef)(
|
|
3468
|
+
({
|
|
3469
|
+
data,
|
|
3470
|
+
xAxisKey,
|
|
3471
|
+
yAxisKey,
|
|
3472
|
+
title,
|
|
3473
|
+
xAxisLabel,
|
|
3474
|
+
yAxisLabel,
|
|
3475
|
+
barColor = CHART_COLORS.PRIMARY,
|
|
3476
|
+
className = "",
|
|
3477
|
+
rotateXAxisLabels = false,
|
|
3478
|
+
showLegend = false,
|
|
3479
|
+
legendItems = [],
|
|
3480
|
+
onDataPointClick,
|
|
3481
|
+
layout = "horizontal",
|
|
3482
|
+
xAxisType = "category",
|
|
3483
|
+
yAxisType = "number",
|
|
3484
|
+
barDataKey
|
|
3485
|
+
}, ref) => {
|
|
3486
|
+
const handleClick = (data2) => {
|
|
3487
|
+
if (onDataPointClick && data2 && typeof data2 === "object") {
|
|
3488
|
+
onDataPointClick(data2);
|
|
3489
|
+
}
|
|
3490
|
+
};
|
|
3491
|
+
const defaultLegendItems = showLegend && legendItems.length === 0 ? [{ key: yAxisKey, color: barColor, label: yAxisKey }] : legendItems;
|
|
3492
|
+
const hasData = data && data.length > 0;
|
|
3493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3494
|
+
"div",
|
|
3495
|
+
{
|
|
3496
|
+
ref,
|
|
3497
|
+
className: `bg-light border border-subtle mx-6 ${className}`,
|
|
3498
|
+
children: [
|
|
3499
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex items-center justify-between px-3 py-2 border-b border-subtle", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Typography, { variant: "label-sm-bold", children: title }) }),
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "pt-2 px-2", children: hasData ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3501
|
+
import_recharts.ResponsiveContainer,
|
|
3502
|
+
{
|
|
3503
|
+
width: "100%",
|
|
3504
|
+
height: CHART_CONSTANTS.STANDARD_HEIGHT,
|
|
3505
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3506
|
+
import_recharts.BarChart,
|
|
3507
|
+
{
|
|
3508
|
+
data,
|
|
3509
|
+
margin: {
|
|
3510
|
+
...CHART_CONSTANTS.MARGIN,
|
|
3511
|
+
left: 24,
|
|
3512
|
+
bottom: rotateXAxisLabels ? 60 : 50
|
|
3513
|
+
},
|
|
3514
|
+
onClick: handleClick,
|
|
3515
|
+
layout,
|
|
3516
|
+
children: [
|
|
3517
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3518
|
+
import_recharts.XAxis,
|
|
3519
|
+
{
|
|
3520
|
+
dataKey: xAxisKey,
|
|
3521
|
+
type: xAxisType,
|
|
3522
|
+
axisLine: false,
|
|
3523
|
+
tickLine: false,
|
|
3524
|
+
tick: rotateXAxisLabels ? customXAxisTickRotated : customXAxisTick,
|
|
3525
|
+
interval: 0,
|
|
3526
|
+
height: rotateXAxisLabels ? CHART_CONSTANTS.AXIS_HEIGHT_ROTATED : CHART_CONSTANTS.AXIS_HEIGHT_STANDARD,
|
|
3527
|
+
width: CHART_CONSTANTS.AXIS_WIDTH_STANDARD,
|
|
3528
|
+
label: xAxisLabel ? createCustomXAxisLabel(xAxisLabel, 80) : void 0
|
|
3529
|
+
}
|
|
3530
|
+
),
|
|
3531
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3532
|
+
import_recharts.YAxis,
|
|
3533
|
+
{
|
|
3534
|
+
axisLine: false,
|
|
3535
|
+
tickLine: false,
|
|
3536
|
+
tick: customYAxisTick,
|
|
3537
|
+
label: yAxisLabel ? createCustomYAxisLabel(yAxisLabel, 40) : void 0,
|
|
3538
|
+
dataKey: yAxisKey,
|
|
3539
|
+
type: yAxisType
|
|
3540
|
+
}
|
|
3541
|
+
),
|
|
3542
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3543
|
+
import_recharts.Tooltip,
|
|
3544
|
+
{
|
|
3545
|
+
content: ({
|
|
3546
|
+
active,
|
|
3547
|
+
payload,
|
|
3548
|
+
label
|
|
3549
|
+
}) => {
|
|
3550
|
+
if (active && payload && payload.length) {
|
|
3551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3552
|
+
GenericTooltip,
|
|
3553
|
+
{
|
|
3554
|
+
title: label?.toString(),
|
|
3555
|
+
items: payload.map((entry) => ({
|
|
3556
|
+
color: entry.color || barColor,
|
|
3557
|
+
label: entry.name || yAxisKey,
|
|
3558
|
+
value: entry.value || 0
|
|
3559
|
+
}))
|
|
3560
|
+
}
|
|
3561
|
+
);
|
|
3562
|
+
}
|
|
3563
|
+
return null;
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3566
|
+
),
|
|
3567
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3568
|
+
import_recharts.Bar,
|
|
3569
|
+
{
|
|
3570
|
+
dataKey: barDataKey || yAxisKey,
|
|
3571
|
+
fill: barColor,
|
|
3572
|
+
name: barDataKey || yAxisKey
|
|
3573
|
+
}
|
|
3574
|
+
),
|
|
3575
|
+
showLegend && defaultLegendItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChartLegend, { items: defaultLegendItems })
|
|
3576
|
+
]
|
|
3577
|
+
}
|
|
3578
|
+
)
|
|
3579
|
+
}
|
|
3580
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Typography, { variant: "body-md", className: "text-secondary", children: "No data is available" }) }) })
|
|
3581
|
+
]
|
|
3582
|
+
}
|
|
3583
|
+
);
|
|
3584
|
+
}
|
|
3585
|
+
);
|
|
3586
|
+
BarChart.displayName = "BarChart";
|
|
3587
|
+
|
|
3588
|
+
// src/components/ui/charts/line-chart.tsx
|
|
3589
|
+
var import_react2 = require("react");
|
|
3590
|
+
var import_recharts2 = require("recharts");
|
|
3591
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3592
|
+
var LineChart = (0, import_react2.forwardRef)(
|
|
3593
|
+
({
|
|
3594
|
+
data,
|
|
3595
|
+
xAxisKey,
|
|
3596
|
+
series,
|
|
3597
|
+
title,
|
|
3598
|
+
xAxisLabel,
|
|
3599
|
+
yAxisLabel,
|
|
3600
|
+
onDataPointClick,
|
|
3601
|
+
className = "",
|
|
3602
|
+
showLegend = true,
|
|
3603
|
+
legendItems = []
|
|
3604
|
+
}, ref) => {
|
|
3605
|
+
const handleClick = (data2) => {
|
|
3606
|
+
if (onDataPointClick && data2 && typeof data2 === "object") {
|
|
3607
|
+
onDataPointClick(data2);
|
|
3608
|
+
}
|
|
3609
|
+
};
|
|
3610
|
+
const defaultLegendItems = legendItems.length > 0 ? legendItems : createLegendItems(
|
|
3611
|
+
series.reduce(
|
|
3612
|
+
(acc, s, index) => ({
|
|
3613
|
+
...acc,
|
|
3614
|
+
[s.dataKey]: s.color || getSeriesColor(index)
|
|
3615
|
+
}),
|
|
3616
|
+
{}
|
|
3617
|
+
)
|
|
3618
|
+
);
|
|
3619
|
+
const hasData = data && data.length > 0;
|
|
3620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3621
|
+
"div",
|
|
3622
|
+
{
|
|
3623
|
+
ref,
|
|
3624
|
+
className: `bg-light border border-subtle mx-6 ${className}`,
|
|
3625
|
+
children: [
|
|
3626
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex items-center justify-between px-3 py-2 border-b border-subtle", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Typography, { variant: "label-sm-bold", children: title }) }),
|
|
3627
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "pt-2 px-2", children: hasData ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3628
|
+
import_recharts2.ResponsiveContainer,
|
|
3629
|
+
{
|
|
3630
|
+
width: "100%",
|
|
3631
|
+
height: CHART_CONSTANTS.STANDARD_HEIGHT,
|
|
3632
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3633
|
+
import_recharts2.LineChart,
|
|
3634
|
+
{
|
|
3635
|
+
data,
|
|
3636
|
+
margin: {
|
|
3637
|
+
...CHART_CONSTANTS.MARGIN,
|
|
3638
|
+
left: 24,
|
|
3639
|
+
bottom: 50
|
|
3640
|
+
},
|
|
3641
|
+
onClick: handleClick,
|
|
3642
|
+
children: [
|
|
3643
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3644
|
+
import_recharts2.XAxis,
|
|
3645
|
+
{
|
|
3646
|
+
dataKey: xAxisKey,
|
|
3647
|
+
axisLine: false,
|
|
3648
|
+
tickLine: false,
|
|
3649
|
+
tick: customXAxisTick,
|
|
3650
|
+
interval: 0,
|
|
3651
|
+
height: CHART_CONSTANTS.AXIS_HEIGHT_STANDARD,
|
|
3652
|
+
label: xAxisLabel ? createCustomXAxisLabel(xAxisLabel) : void 0
|
|
3653
|
+
}
|
|
3654
|
+
),
|
|
3655
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3656
|
+
import_recharts2.YAxis,
|
|
3657
|
+
{
|
|
3658
|
+
axisLine: false,
|
|
3659
|
+
tickLine: false,
|
|
3660
|
+
tick: customYAxisTick,
|
|
3661
|
+
label: yAxisLabel ? createCustomYAxisLabel(yAxisLabel, 40) : void 0
|
|
3662
|
+
}
|
|
3663
|
+
),
|
|
3664
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3665
|
+
import_recharts2.Tooltip,
|
|
3666
|
+
{
|
|
3667
|
+
content: ({
|
|
3668
|
+
active,
|
|
3669
|
+
payload,
|
|
3670
|
+
label
|
|
3671
|
+
}) => {
|
|
3672
|
+
if (active && payload && payload.length) {
|
|
3673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3674
|
+
GenericTooltip,
|
|
3675
|
+
{
|
|
3676
|
+
title: label?.toString(),
|
|
3677
|
+
items: payload.map((entry) => ({
|
|
3678
|
+
color: entry.color || CHART_COLORS.PRIMARY,
|
|
3679
|
+
label: entry.name || entry.dataKey || "",
|
|
3680
|
+
value: entry.value || 0
|
|
3681
|
+
}))
|
|
3682
|
+
}
|
|
3683
|
+
);
|
|
3684
|
+
}
|
|
3685
|
+
return null;
|
|
3686
|
+
}
|
|
3687
|
+
}
|
|
3688
|
+
),
|
|
3689
|
+
series.map((s, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3690
|
+
import_recharts2.Line,
|
|
3691
|
+
{
|
|
3692
|
+
type: "monotone",
|
|
3693
|
+
dataKey: s.dataKey,
|
|
3694
|
+
stroke: s.color || getSeriesColor(index),
|
|
3695
|
+
strokeWidth: s.strokeWidth || 2,
|
|
3696
|
+
dot: s.dot !== false ? { r: 4 } : false,
|
|
3697
|
+
activeDot: s.activeDot !== false ? { r: 6 } : false
|
|
3698
|
+
},
|
|
3699
|
+
s.dataKey
|
|
3700
|
+
)),
|
|
3701
|
+
showLegend && defaultLegendItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChartLegend, { items: defaultLegendItems })
|
|
3702
|
+
]
|
|
3703
|
+
}
|
|
3704
|
+
)
|
|
3705
|
+
}
|
|
3706
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Typography, { variant: "body-md", className: "text-secondary", children: "No data is available" }) }) })
|
|
3707
|
+
]
|
|
3708
|
+
}
|
|
3709
|
+
);
|
|
3710
|
+
}
|
|
3711
|
+
);
|
|
3712
|
+
LineChart.displayName = "LineChart";
|
|
3713
|
+
|
|
3714
|
+
// src/components/ui/charts/pie-chart.tsx
|
|
3715
|
+
var import_react3 = require("react");
|
|
3716
|
+
var import_recharts3 = require("recharts");
|
|
3717
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3718
|
+
var PieChart = (0, import_react3.forwardRef)(
|
|
3719
|
+
({
|
|
3720
|
+
data,
|
|
3721
|
+
title,
|
|
3722
|
+
onDataPointClick,
|
|
3723
|
+
className = "",
|
|
3724
|
+
showLegend = true,
|
|
3725
|
+
legendItems = [],
|
|
3726
|
+
innerRadius = "40%",
|
|
3727
|
+
outerRadius = "70%",
|
|
3728
|
+
showLabels = true
|
|
3729
|
+
}, ref) => {
|
|
3730
|
+
const handleClick = (data2) => {
|
|
3731
|
+
if (onDataPointClick && data2 && typeof data2 === "object") {
|
|
3732
|
+
onDataPointClick(data2);
|
|
3733
|
+
}
|
|
3734
|
+
};
|
|
3735
|
+
const defaultLegendItems = legendItems.length > 0 ? legendItems : createLegendItems(
|
|
3736
|
+
data.reduce(
|
|
3737
|
+
(acc, item, index) => ({
|
|
3738
|
+
...acc,
|
|
3739
|
+
[item.name]: item.color || getSeriesColor(index)
|
|
3740
|
+
}),
|
|
3741
|
+
{}
|
|
3742
|
+
)
|
|
3743
|
+
);
|
|
3744
|
+
const hasData = data && data.length > 0;
|
|
3745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3746
|
+
"div",
|
|
3747
|
+
{
|
|
3748
|
+
ref,
|
|
3749
|
+
className: `bg-light border border-subtle mx-6 ${className}`,
|
|
3750
|
+
children: [
|
|
3751
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center justify-between px-3 py-2 border-b border-subtle", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Typography, { variant: "label-sm-bold", children: title }) }),
|
|
3752
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "pt-2 px-2", children: hasData ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
3753
|
+
import_recharts3.PieChart,
|
|
3754
|
+
{
|
|
3755
|
+
width: 600,
|
|
3756
|
+
height: CHART_CONSTANTS.LARGE_HEIGHT,
|
|
3757
|
+
children: [
|
|
3758
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3759
|
+
import_recharts3.Pie,
|
|
3760
|
+
{
|
|
3761
|
+
data,
|
|
3762
|
+
innerRadius,
|
|
3763
|
+
outerRadius,
|
|
3764
|
+
dataKey: "value",
|
|
3765
|
+
cy: CHART_CONSTANTS.PIE_CHART_CENTER_Y,
|
|
3766
|
+
cx: CHART_CONSTANTS.PIE_CHART_CENTER_X,
|
|
3767
|
+
label: showLabels,
|
|
3768
|
+
labelLine: false,
|
|
3769
|
+
onClick: handleClick,
|
|
3770
|
+
children: data.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3771
|
+
import_recharts3.Cell,
|
|
3772
|
+
{
|
|
3773
|
+
fill: entry.color || getSeriesColor(index)
|
|
3774
|
+
},
|
|
3775
|
+
`cell-${index}`
|
|
3776
|
+
))
|
|
3777
|
+
}
|
|
3778
|
+
),
|
|
3779
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3780
|
+
import_recharts3.Tooltip,
|
|
3781
|
+
{
|
|
3782
|
+
content: ({
|
|
3783
|
+
active,
|
|
3784
|
+
payload
|
|
3785
|
+
}) => {
|
|
3786
|
+
if (active && payload && payload.length && payload[0]) {
|
|
3787
|
+
const data2 = payload[0].payload;
|
|
3788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3789
|
+
GenericTooltip,
|
|
3790
|
+
{
|
|
3791
|
+
title: data2.name,
|
|
3792
|
+
items: [
|
|
3793
|
+
{
|
|
3794
|
+
color: data2.color || CHART_COLORS.PRIMARY,
|
|
3795
|
+
label: "Value",
|
|
3796
|
+
value: data2.value
|
|
3797
|
+
}
|
|
3798
|
+
]
|
|
3799
|
+
}
|
|
3800
|
+
);
|
|
3801
|
+
}
|
|
3802
|
+
return null;
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
3805
|
+
),
|
|
3806
|
+
showLegend && defaultLegendItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChartLegend, { items: defaultLegendItems, y: 400 })
|
|
3807
|
+
]
|
|
3808
|
+
}
|
|
3809
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Typography, { variant: "body-md", className: "text-secondary", children: "No data is available" }) }) })
|
|
3810
|
+
]
|
|
3811
|
+
}
|
|
3812
|
+
);
|
|
3813
|
+
}
|
|
3814
|
+
);
|
|
3815
|
+
PieChart.displayName = "PieChart";
|
|
3816
|
+
|
|
3817
|
+
// src/components/ui/table.tsx
|
|
3818
|
+
var import_react4 = require("react");
|
|
3819
|
+
var import_react_table = require("@tanstack/react-table");
|
|
3820
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3821
|
+
function Table({
|
|
3822
|
+
table,
|
|
3823
|
+
className,
|
|
3824
|
+
showPagination = false,
|
|
3825
|
+
paginationClassName
|
|
3826
|
+
}) {
|
|
3827
|
+
const currentPage = table.getState().pagination.pageIndex;
|
|
3828
|
+
const pageSize = table.getState().pagination.pageSize;
|
|
3829
|
+
const totalPages = table.getPageCount();
|
|
3830
|
+
const totalRows = table.getFilteredRowModel().rows.length;
|
|
3831
|
+
const showingText = totalRows > 0 ? "Showing " + (currentPage * pageSize + 1) + "-" + Math.min((currentPage + 1) * pageSize, totalRows) + " of " + totalRows + " results" : "No results found";
|
|
3832
|
+
const handlePreviousPage = (0, import_react4.useCallback)(() => {
|
|
3833
|
+
table.previousPage();
|
|
3834
|
+
}, [table]);
|
|
3835
|
+
const handleNextPage = (0, import_react4.useCallback)(() => {
|
|
3836
|
+
table.nextPage();
|
|
3837
|
+
}, [table]);
|
|
3838
|
+
const handlePageChange = (0, import_react4.useCallback)(
|
|
3839
|
+
(pageIndex) => {
|
|
3840
|
+
table.setPageIndex(pageIndex);
|
|
3841
|
+
},
|
|
3842
|
+
[table]
|
|
3843
|
+
);
|
|
3844
|
+
const handlePageSizeChange = (0, import_react4.useCallback)(
|
|
3845
|
+
(value) => {
|
|
3846
|
+
table.setPageSize(Number(value));
|
|
3847
|
+
},
|
|
3848
|
+
[table]
|
|
3849
|
+
);
|
|
3850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
|
|
3851
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: cn("overflow-x-auto", className), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("table", { className: "min-w-full divide-y divide-border", children: [
|
|
3852
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("thead", { className: "bg-dark text-light", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tr", { children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("th", { className: "px-6 py-3 text-left", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
3853
|
+
"div",
|
|
3854
|
+
{
|
|
3855
|
+
className: `flex items-center space-x-1 ${header.column.getCanSort() ? "cursor-pointer select-none" : ""}`,
|
|
3856
|
+
onClick: header.column.getToggleSortingHandler(),
|
|
3857
|
+
children: [
|
|
3858
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3859
|
+
Typography,
|
|
3860
|
+
{
|
|
3861
|
+
variant: "label-xs",
|
|
3862
|
+
className: "text-light uppercase tracking-wider",
|
|
3863
|
+
children: (0, import_react_table.flexRender)(
|
|
3864
|
+
header.column.columnDef.header,
|
|
3865
|
+
header.getContext()
|
|
3866
|
+
)
|
|
3867
|
+
}
|
|
3868
|
+
),
|
|
3869
|
+
header.column.getCanSort() && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "ml-1", children: [
|
|
3870
|
+
header.column.getIsSorted() === "asc" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronUp, { className: "w-4 h-4 text-light" }),
|
|
3871
|
+
header.column.getIsSorted() === "desc" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronDown, { className: "w-4 h-4 text-light" })
|
|
3872
|
+
] })
|
|
3873
|
+
]
|
|
3874
|
+
}
|
|
3875
|
+
) }, header.id)) }, headerGroup.id)) }),
|
|
3876
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tbody", { className: "bg-light divide-y divide-border", children: table.getRowModel().rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("tr", { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("td", { className: "px-6 py-4 whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Typography, { variant: "body-sm", children: (0, import_react_table.flexRender)(
|
|
3877
|
+
cell.column.columnDef.cell,
|
|
3878
|
+
cell.getContext()
|
|
3879
|
+
) }) }, cell.id)) }, row.id)) })
|
|
3880
|
+
] }) }),
|
|
3881
|
+
showPagination && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
3882
|
+
"div",
|
|
3883
|
+
{
|
|
3884
|
+
className: cn(
|
|
3885
|
+
"flex items-center justify-between px-6 py-3 bg-light border-t border-subtle",
|
|
3886
|
+
paginationClassName
|
|
3887
|
+
),
|
|
3888
|
+
children: [
|
|
3889
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Typography, { variant: "body-sm", className: "text-secondary", children: showingText }) }),
|
|
3890
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center space-x-1", children: [
|
|
3891
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3892
|
+
Button,
|
|
3893
|
+
{
|
|
3894
|
+
variant: "ghost",
|
|
3895
|
+
size: "sm",
|
|
3896
|
+
onClick: handlePreviousPage,
|
|
3897
|
+
disabled: !table.getCanPreviousPage(),
|
|
3898
|
+
className: "p-2",
|
|
3899
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronLeft, { className: "w-4 h-4" })
|
|
3900
|
+
}
|
|
3901
|
+
),
|
|
3902
|
+
Array.from(
|
|
3903
|
+
{ length: Math.min(5, table.getPageCount()) },
|
|
3904
|
+
(_, i) => {
|
|
3905
|
+
let pageNumber;
|
|
3906
|
+
if (totalPages <= 5) {
|
|
3907
|
+
pageNumber = i;
|
|
3908
|
+
} else if (currentPage <= 2) {
|
|
3909
|
+
pageNumber = i;
|
|
3910
|
+
} else if (currentPage >= totalPages - 3) {
|
|
3911
|
+
pageNumber = totalPages - 5 + i;
|
|
3912
|
+
} else {
|
|
3913
|
+
pageNumber = currentPage - 2 + i;
|
|
3914
|
+
}
|
|
3915
|
+
const isActive = pageNumber === currentPage;
|
|
3916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3917
|
+
Button,
|
|
3918
|
+
{
|
|
3919
|
+
variant: isActive ? "default" : "ghost",
|
|
3920
|
+
size: "sm",
|
|
3921
|
+
onClick: () => handlePageChange(pageNumber),
|
|
3922
|
+
className: "min-w-8 h-8 p-0",
|
|
3923
|
+
children: pageNumber + 1
|
|
3924
|
+
},
|
|
3925
|
+
pageNumber
|
|
3926
|
+
);
|
|
3927
|
+
}
|
|
3928
|
+
),
|
|
3929
|
+
table.getPageCount() > 5 && currentPage < totalPages - 3 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
3930
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "px-1 text-secondary", children: "..." }),
|
|
3931
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Typography, { variant: "body-sm", className: "text-secondary", children: totalPages })
|
|
3932
|
+
] }),
|
|
3933
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3934
|
+
Button,
|
|
3935
|
+
{
|
|
3936
|
+
variant: "ghost",
|
|
3937
|
+
size: "sm",
|
|
3938
|
+
onClick: handleNextPage,
|
|
3939
|
+
disabled: !table.getCanNextPage(),
|
|
3940
|
+
className: "p-2",
|
|
3941
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronRight, { className: "w-4 h-4" })
|
|
3942
|
+
}
|
|
3943
|
+
)
|
|
3944
|
+
] }),
|
|
3945
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-3 w-48", children: [
|
|
3946
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3947
|
+
Typography,
|
|
3948
|
+
{
|
|
3949
|
+
variant: "body-sm",
|
|
3950
|
+
className: "text-secondary whitespace-nowrap",
|
|
3951
|
+
children: "Rows per page:"
|
|
3952
|
+
}
|
|
3953
|
+
),
|
|
3954
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
3955
|
+
Select,
|
|
3956
|
+
{
|
|
3957
|
+
value: table.getState().pagination.pageSize.toString(),
|
|
3958
|
+
onValueChange: handlePageSizeChange,
|
|
3959
|
+
children: [
|
|
3960
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectTrigger, { className: "min-w-0 h-8", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectValue, {}) }),
|
|
3961
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectContent, { children: [10, 20, 50, 100].map((size) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SelectItem, { value: size.toString(), children: size }, size)) })
|
|
3962
|
+
]
|
|
3963
|
+
}
|
|
3964
|
+
)
|
|
3965
|
+
] })
|
|
3966
|
+
]
|
|
3967
|
+
}
|
|
3968
|
+
)
|
|
3969
|
+
] });
|
|
3970
|
+
}
|
|
3160
3971
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3161
3972
|
0 && (module.exports = {
|
|
3162
3973
|
ArrowDown,
|
|
@@ -3164,14 +3975,19 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
3164
3975
|
ArrowRight,
|
|
3165
3976
|
ArrowUp,
|
|
3166
3977
|
Badge,
|
|
3978
|
+
BarChart,
|
|
3167
3979
|
Bell,
|
|
3168
3980
|
Bookmark,
|
|
3169
3981
|
Button,
|
|
3982
|
+
CHART_COLORS,
|
|
3983
|
+
CHART_CONSTANTS,
|
|
3984
|
+
COLOR_SCHEMES,
|
|
3170
3985
|
Calendar,
|
|
3171
3986
|
CaretDown,
|
|
3172
3987
|
CaretLeft,
|
|
3173
3988
|
CaretRight,
|
|
3174
3989
|
CaretUp,
|
|
3990
|
+
ChartLegend,
|
|
3175
3991
|
Chat,
|
|
3176
3992
|
Check,
|
|
3177
3993
|
CheckIcon,
|
|
@@ -3212,6 +4028,7 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
3212
4028
|
Filter,
|
|
3213
4029
|
FilterDescending,
|
|
3214
4030
|
FormField,
|
|
4031
|
+
GenericTooltip,
|
|
3215
4032
|
GraphBar,
|
|
3216
4033
|
GraphDonut,
|
|
3217
4034
|
GraphLine,
|
|
@@ -3220,6 +4037,7 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
3220
4037
|
Home,
|
|
3221
4038
|
Information,
|
|
3222
4039
|
Input,
|
|
4040
|
+
LineChart,
|
|
3223
4041
|
Location,
|
|
3224
4042
|
Lock,
|
|
3225
4043
|
Logout,
|
|
@@ -3227,6 +4045,7 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
3227
4045
|
Minus,
|
|
3228
4046
|
MoreMenu,
|
|
3229
4047
|
Phone,
|
|
4048
|
+
PieChart,
|
|
3230
4049
|
Plus,
|
|
3231
4050
|
QuestionCircle,
|
|
3232
4051
|
Select,
|
|
@@ -3243,10 +4062,13 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
3243
4062
|
Star,
|
|
3244
4063
|
Statement,
|
|
3245
4064
|
Table,
|
|
4065
|
+
TableIcon,
|
|
3246
4066
|
Tabs,
|
|
3247
4067
|
TabsContent,
|
|
3248
4068
|
TabsList,
|
|
3249
4069
|
TabsTrigger,
|
|
4070
|
+
TooltipContainer,
|
|
4071
|
+
TooltipItem,
|
|
3250
4072
|
Trash,
|
|
3251
4073
|
Typography,
|
|
3252
4074
|
Upload,
|
|
@@ -3257,7 +4079,20 @@ DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
|
3257
4079
|
X,
|
|
3258
4080
|
badgeVariants,
|
|
3259
4081
|
buttonVariants,
|
|
4082
|
+
calculateYAxisWidth,
|
|
3260
4083
|
checkboxVariants,
|
|
4084
|
+
createCustomXAxisLabel,
|
|
4085
|
+
createCustomYAxisLabel,
|
|
4086
|
+
createCustomYAxisRightLabel,
|
|
4087
|
+
createLegendItems,
|
|
4088
|
+
customXAxisTick,
|
|
4089
|
+
customXAxisTickRotated,
|
|
4090
|
+
customYAxisTick,
|
|
4091
|
+
formatLargeNumber,
|
|
4092
|
+
formatPercentage,
|
|
4093
|
+
getHeatmapColor,
|
|
4094
|
+
getPerformanceColor,
|
|
4095
|
+
getSeriesColor,
|
|
3261
4096
|
inputVariants,
|
|
3262
4097
|
selectTriggerVariants,
|
|
3263
4098
|
tabsVariants,
|