pxengine 0.1.56 → 0.1.57

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,9 +33391,23 @@ 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 buildConfigWithColors = (baseConfig) => {
33399
+ if (!seriesColors) return baseConfig;
33400
+ const coloredConfig = {};
33401
+ const seriesKeys = Object.keys(baseConfig);
33402
+ seriesKeys.forEach((key, index) => {
33403
+ coloredConfig[key] = {
33404
+ ...baseConfig[key],
33405
+ color: seriesColors[index] || baseConfig[key]?.color
33406
+ };
33407
+ });
33408
+ return coloredConfig;
33409
+ };
33410
+ const safeConfig = config ? buildConfigWithColors(config) : {};
33368
33411
  const renderChart = () => {
33369
33412
  switch (chartType) {
33370
33413
  case "bar":
@@ -33456,7 +33499,14 @@ var ChartAtom = ({
33456
33499
  dataKey: YAxisKey || "value",
33457
33500
  nameKey: XAxisKey || "name",
33458
33501
  innerRadius: 60,
33459
- strokeWidth: 5
33502
+ strokeWidth: 5,
33503
+ children: data.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
33504
+ import_recharts.Cell,
33505
+ {
33506
+ fill: seriesColors?.[index] || `var(--color-${Object.keys(safeConfig)[index] || "default"})`
33507
+ },
33508
+ `cell-${index}`
33509
+ ))
33460
33510
  }
33461
33511
  )
33462
33512
  ] });
@@ -33491,7 +33541,15 @@ var ChartAtom = ({
33491
33541
  content: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ChartTooltipContent, { hideLabel: true, nameKey: XAxisKey })
33492
33542
  }
33493
33543
  ),
33494
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_recharts.RadialBar, { dataKey: YAxisKey || "value", background: true })
33544
+ Object.keys(safeConfig).map((key, idx) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
33545
+ import_recharts.RadialBar,
33546
+ {
33547
+ dataKey: key,
33548
+ fill: seriesColors?.[idx] || `var(--color-${key})`,
33549
+ background: true
33550
+ },
33551
+ key
33552
+ ))
33495
33553
  ]
33496
33554
  }
33497
33555
  );