pxengine 0.1.56 → 0.1.58

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.cjs CHANGED
@@ -26117,33 +26117,62 @@ var TableAtom = ({
26117
26117
  headers,
26118
26118
  rows,
26119
26119
  className,
26120
- style
26120
+ style,
26121
+ headerTextColor = "#9ca3af",
26122
+ headerBgColor = "#f9fafb",
26123
+ rowTextColor = "#374151",
26124
+ rowBgColor = "#ffffff",
26125
+ hoverBgColor = "#faf5ff",
26126
+ borderColor = "#f3f4f6"
26121
26127
  }) => {
26128
+ const safeHeaders = Array.isArray(headers) ? headers : [];
26129
+ const safeRows = Array.isArray(rows) ? rows : [];
26130
+ if (safeHeaders.length === 0 && safeRows.length === 0) {
26131
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
26132
+ "div",
26133
+ {
26134
+ className: cn("rounded-2xl border overflow-hidden p-4 text-center text-sm text-muted-foreground", className),
26135
+ style: { ...style, borderColor },
26136
+ children: "No table data"
26137
+ }
26138
+ );
26139
+ }
26122
26140
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
26123
26141
  "div",
26124
26142
  {
26125
26143
  className: cn(
26126
- "rounded-2xl border border-gray-100 overflow-hidden bg-white",
26144
+ "rounded-2xl border overflow-hidden",
26127
26145
  className
26128
26146
  ),
26129
- style,
26147
+ style: {
26148
+ ...style,
26149
+ borderColor
26150
+ },
26130
26151
  children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Table3, { children: [
26131
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableHeader, { className: "bg-gray-50/50", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableRow, { children: headers.map((header, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
26152
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableHeader, { style: { backgroundColor: headerBgColor }, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableRow, { children: safeHeaders.map((header, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
26132
26153
  TableHead,
26133
26154
  {
26134
- className: "text-xs font-bold text-gray-400 uppercase tracking-widest px-6 py-4",
26155
+ className: "text-xs font-bold uppercase tracking-widest px-6 py-4",
26156
+ style: { color: headerTextColor },
26135
26157
  children: header
26136
26158
  },
26137
26159
  i
26138
26160
  )) }) }),
26139
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableBody, { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
26161
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TableBody, { children: safeRows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
26140
26162
  TableRow,
26141
26163
  {
26142
- className: "hover:bg-purple-50/30 transition-colors border-gray-50",
26143
- children: row.map((cell, j) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
26164
+ className: "transition-colors",
26165
+ style: {
26166
+ backgroundColor: rowBgColor,
26167
+ borderColor
26168
+ },
26169
+ onMouseEnter: (e) => e.currentTarget.style.backgroundColor = hoverBgColor,
26170
+ onMouseLeave: (e) => e.currentTarget.style.backgroundColor = rowBgColor,
26171
+ children: (Array.isArray(row) ? row : []).map((cell, j) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
26144
26172
  TableCell,
26145
26173
  {
26146
- className: "text-sm text-gray-700 px-6 py-4 font-medium",
26174
+ className: "text-sm px-6 py-4 font-medium",
26175
+ style: { color: rowTextColor },
26147
26176
  children: cell
26148
26177
  },
26149
26178
  j
@@ -33362,13 +33391,28 @@ var ChartAtom = ({
33362
33391
  showLegend = true,
33363
33392
  stacked = false,
33364
33393
  className,
33365
- style
33394
+ style,
33395
+ // Chart color customization props
33396
+ seriesColors
33366
33397
  }) => {
33367
- const safeConfig = config ?? {};
33398
+ const safeData = Array.isArray(data) ? data : [];
33399
+ const buildConfigWithColors = (baseConfig) => {
33400
+ if (!seriesColors) return baseConfig;
33401
+ const coloredConfig = {};
33402
+ const seriesKeys = Object.keys(baseConfig);
33403
+ seriesKeys.forEach((key, index) => {
33404
+ coloredConfig[key] = {
33405
+ ...baseConfig[key],
33406
+ color: seriesColors[index] || baseConfig[key]?.color
33407
+ };
33408
+ });
33409
+ return coloredConfig;
33410
+ };
33411
+ const safeConfig = config ? buildConfigWithColors(config) : {};
33368
33412
  const renderChart = () => {
33369
33413
  switch (chartType) {
33370
33414
  case "bar":
33371
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_recharts.BarChart, { data, children: [
33415
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_recharts.BarChart, { data: safeData, children: [
33372
33416
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_recharts.CartesianGrid, { vertical: false }),
33373
33417
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
33374
33418
  import_recharts.XAxis,
@@ -33394,7 +33438,7 @@ var ChartAtom = ({
33394
33438
  ))
33395
33439
  ] });
33396
33440
  case "line":
33397
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_recharts.LineChart, { data, children: [
33441
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_recharts.LineChart, { data: safeData, children: [
33398
33442
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_recharts.CartesianGrid, { vertical: false }),
33399
33443
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
33400
33444
  import_recharts.XAxis,
@@ -33420,7 +33464,7 @@ var ChartAtom = ({
33420
33464
  ))
33421
33465
  ] });
33422
33466
  case "area":
33423
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_recharts.AreaChart, { data, children: [
33467
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_recharts.AreaChart, { data: safeData, children: [
33424
33468
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_recharts.CartesianGrid, { vertical: false }),
33425
33469
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
33426
33470
  import_recharts.XAxis,
@@ -33452,16 +33496,23 @@ var ChartAtom = ({
33452
33496
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
33453
33497
  import_recharts.Pie,
33454
33498
  {
33455
- data,
33499
+ data: safeData,
33456
33500
  dataKey: YAxisKey || "value",
33457
33501
  nameKey: XAxisKey || "name",
33458
33502
  innerRadius: 60,
33459
- strokeWidth: 5
33503
+ strokeWidth: 5,
33504
+ children: safeData.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
33505
+ import_recharts.Cell,
33506
+ {
33507
+ fill: seriesColors?.[index] || `var(--color-${Object.keys(safeConfig)[index] || "default"})`
33508
+ },
33509
+ `cell-${index}`
33510
+ ))
33460
33511
  }
33461
33512
  )
33462
33513
  ] });
33463
33514
  case "radar":
33464
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_recharts.RadarChart, { data, children: [
33515
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_recharts.RadarChart, { data: safeData, children: [
33465
33516
  showTooltip && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ChartTooltip, { cursor: false, content: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ChartTooltipContent, {}) }),
33466
33517
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_recharts.PolarGrid, {}),
33467
33518
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_recharts.PolarAngleAxis, { dataKey: XAxisKey }),
@@ -33479,7 +33530,7 @@ var ChartAtom = ({
33479
33530
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
33480
33531
  import_recharts.RadialBarChart,
33481
33532
  {
33482
- data,
33533
+ data: safeData,
33483
33534
  innerRadius: 30,
33484
33535
  outerRadius: 110,
33485
33536
  barSize: 10,
@@ -33491,7 +33542,15 @@ var ChartAtom = ({
33491
33542
  content: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ChartTooltipContent, { hideLabel: true, nameKey: XAxisKey })
33492
33543
  }
33493
33544
  ),
33494
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_recharts.RadialBar, { dataKey: YAxisKey || "value", background: true })
33545
+ Object.keys(safeConfig).map((key, idx) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
33546
+ import_recharts.RadialBar,
33547
+ {
33548
+ dataKey: key,
33549
+ fill: seriesColors?.[idx] || `var(--color-${key})`,
33550
+ background: true
33551
+ },
33552
+ key
33553
+ ))
33495
33554
  ]
33496
33555
  }
33497
33556
  );