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.d.cts CHANGED
@@ -326,6 +326,12 @@ interface TableAtomType extends BaseAtom {
326
326
  type: "table";
327
327
  headers: string[];
328
328
  rows: any[][];
329
+ headerTextColor?: string;
330
+ headerBgColor?: string;
331
+ rowTextColor?: string;
332
+ rowBgColor?: string;
333
+ hoverBgColor?: string;
334
+ borderColor?: string;
329
335
  }
330
336
  interface CarouselAtomType extends BaseAtom {
331
337
  type: "carousel";
@@ -492,6 +498,7 @@ interface ChartAtomType extends BaseAtom {
492
498
  showTooltip?: boolean;
493
499
  showLegend?: boolean;
494
500
  stacked?: boolean;
501
+ seriesColors?: string[];
495
502
  }
496
503
  type UIAtom = ButtonAtomType | InputAtomType | ToggleAtomType | TextAtomType | LayoutAtomType | CardAtomType | TabsAtomType | AccordionAtomType | SeparatorAtomType | ScrollAreaAtomType | AspectRatioAtomType | CollapsibleAtomType | AvatarAtomType | BadgeAtomType | ProgressAtomType | TableAtomType | CarouselAtomType | AlertAtomType | TooltipAtomType | PopoverAtomType | DialogAtomType | SheetAtomType | AlertDialogAtomType | SkeletonAtomType | SpinnerAtomType | BreadcrumbAtomType | CalendarAtomType | PaginationAtomType | CommandAtomType | FormInputAtomType | FormSelectAtomType | FormTextareaAtomType | CheckboxAtomType | SwitchAtomType | LabelAtomType | SliderAtomType | RadioGroupAtomType | RadioAtomType | DropdownMenuAtomType | ContextMenuAtomType | DrawerAtomType | InputOTPAtomType | KbdAtomType | ResizableAtomType | RatingAtomType | TimelineAtomType | VideoAtomType | ChartAtomType | IconAtomType | ArrowToggleAtomType;
497
504
 
package/dist/index.d.ts CHANGED
@@ -326,6 +326,12 @@ interface TableAtomType extends BaseAtom {
326
326
  type: "table";
327
327
  headers: string[];
328
328
  rows: any[][];
329
+ headerTextColor?: string;
330
+ headerBgColor?: string;
331
+ rowTextColor?: string;
332
+ rowBgColor?: string;
333
+ hoverBgColor?: string;
334
+ borderColor?: string;
329
335
  }
330
336
  interface CarouselAtomType extends BaseAtom {
331
337
  type: "carousel";
@@ -492,6 +498,7 @@ interface ChartAtomType extends BaseAtom {
492
498
  showTooltip?: boolean;
493
499
  showLegend?: boolean;
494
500
  stacked?: boolean;
501
+ seriesColors?: string[];
495
502
  }
496
503
  type UIAtom = ButtonAtomType | InputAtomType | ToggleAtomType | TextAtomType | LayoutAtomType | CardAtomType | TabsAtomType | AccordionAtomType | SeparatorAtomType | ScrollAreaAtomType | AspectRatioAtomType | CollapsibleAtomType | AvatarAtomType | BadgeAtomType | ProgressAtomType | TableAtomType | CarouselAtomType | AlertAtomType | TooltipAtomType | PopoverAtomType | DialogAtomType | SheetAtomType | AlertDialogAtomType | SkeletonAtomType | SpinnerAtomType | BreadcrumbAtomType | CalendarAtomType | PaginationAtomType | CommandAtomType | FormInputAtomType | FormSelectAtomType | FormTextareaAtomType | CheckboxAtomType | SwitchAtomType | LabelAtomType | SliderAtomType | RadioGroupAtomType | RadioAtomType | DropdownMenuAtomType | ContextMenuAtomType | DrawerAtomType | InputOTPAtomType | KbdAtomType | ResizableAtomType | RatingAtomType | TimelineAtomType | VideoAtomType | ChartAtomType | IconAtomType | ArrowToggleAtomType;
497
504
 
package/dist/index.mjs CHANGED
@@ -25794,33 +25794,62 @@ var TableAtom = ({
25794
25794
  headers,
25795
25795
  rows,
25796
25796
  className,
25797
- style
25797
+ style,
25798
+ headerTextColor = "#9ca3af",
25799
+ headerBgColor = "#f9fafb",
25800
+ rowTextColor = "#374151",
25801
+ rowBgColor = "#ffffff",
25802
+ hoverBgColor = "#faf5ff",
25803
+ borderColor = "#f3f4f6"
25798
25804
  }) => {
25805
+ const safeHeaders = Array.isArray(headers) ? headers : [];
25806
+ const safeRows = Array.isArray(rows) ? rows : [];
25807
+ if (safeHeaders.length === 0 && safeRows.length === 0) {
25808
+ return /* @__PURE__ */ jsx35(
25809
+ "div",
25810
+ {
25811
+ className: cn("rounded-2xl border overflow-hidden p-4 text-center text-sm text-muted-foreground", className),
25812
+ style: { ...style, borderColor },
25813
+ children: "No table data"
25814
+ }
25815
+ );
25816
+ }
25799
25817
  return /* @__PURE__ */ jsx35(
25800
25818
  "div",
25801
25819
  {
25802
25820
  className: cn(
25803
- "rounded-2xl border border-gray-100 overflow-hidden bg-white",
25821
+ "rounded-2xl border overflow-hidden",
25804
25822
  className
25805
25823
  ),
25806
- style,
25824
+ style: {
25825
+ ...style,
25826
+ borderColor
25827
+ },
25807
25828
  children: /* @__PURE__ */ jsxs12(Table3, { children: [
25808
- /* @__PURE__ */ jsx35(TableHeader, { className: "bg-gray-50/50", children: /* @__PURE__ */ jsx35(TableRow, { children: headers.map((header, i) => /* @__PURE__ */ jsx35(
25829
+ /* @__PURE__ */ jsx35(TableHeader, { style: { backgroundColor: headerBgColor }, children: /* @__PURE__ */ jsx35(TableRow, { children: safeHeaders.map((header, i) => /* @__PURE__ */ jsx35(
25809
25830
  TableHead,
25810
25831
  {
25811
- className: "text-xs font-bold text-gray-400 uppercase tracking-widest px-6 py-4",
25832
+ className: "text-xs font-bold uppercase tracking-widest px-6 py-4",
25833
+ style: { color: headerTextColor },
25812
25834
  children: header
25813
25835
  },
25814
25836
  i
25815
25837
  )) }) }),
25816
- /* @__PURE__ */ jsx35(TableBody, { children: rows.map((row, i) => /* @__PURE__ */ jsx35(
25838
+ /* @__PURE__ */ jsx35(TableBody, { children: safeRows.map((row, i) => /* @__PURE__ */ jsx35(
25817
25839
  TableRow,
25818
25840
  {
25819
- className: "hover:bg-purple-50/30 transition-colors border-gray-50",
25820
- children: row.map((cell, j) => /* @__PURE__ */ jsx35(
25841
+ className: "transition-colors",
25842
+ style: {
25843
+ backgroundColor: rowBgColor,
25844
+ borderColor
25845
+ },
25846
+ onMouseEnter: (e) => e.currentTarget.style.backgroundColor = hoverBgColor,
25847
+ onMouseLeave: (e) => e.currentTarget.style.backgroundColor = rowBgColor,
25848
+ children: (Array.isArray(row) ? row : []).map((cell, j) => /* @__PURE__ */ jsx35(
25821
25849
  TableCell,
25822
25850
  {
25823
- className: "text-sm text-gray-700 px-6 py-4 font-medium",
25851
+ className: "text-sm px-6 py-4 font-medium",
25852
+ style: { color: rowTextColor },
25824
25853
  children: cell
25825
25854
  },
25826
25855
  j
@@ -33040,6 +33069,7 @@ import {
33040
33069
  AreaChart,
33041
33070
  Pie,
33042
33071
  PieChart,
33072
+ Cell,
33043
33073
  Radar as Radar2,
33044
33074
  RadarChart,
33045
33075
  RadialBar,
@@ -33060,13 +33090,28 @@ var ChartAtom = ({
33060
33090
  showLegend = true,
33061
33091
  stacked = false,
33062
33092
  className,
33063
- style
33093
+ style,
33094
+ // Chart color customization props
33095
+ seriesColors
33064
33096
  }) => {
33065
- const safeConfig = config ?? {};
33097
+ const safeData = Array.isArray(data) ? data : [];
33098
+ const buildConfigWithColors = (baseConfig) => {
33099
+ if (!seriesColors) return baseConfig;
33100
+ const coloredConfig = {};
33101
+ const seriesKeys = Object.keys(baseConfig);
33102
+ seriesKeys.forEach((key, index) => {
33103
+ coloredConfig[key] = {
33104
+ ...baseConfig[key],
33105
+ color: seriesColors[index] || baseConfig[key]?.color
33106
+ };
33107
+ });
33108
+ return coloredConfig;
33109
+ };
33110
+ const safeConfig = config ? buildConfigWithColors(config) : {};
33066
33111
  const renderChart = () => {
33067
33112
  switch (chartType) {
33068
33113
  case "bar":
33069
- return /* @__PURE__ */ jsxs50(BarChart, { data, children: [
33114
+ return /* @__PURE__ */ jsxs50(BarChart, { data: safeData, children: [
33070
33115
  /* @__PURE__ */ jsx85(CartesianGrid, { vertical: false }),
33071
33116
  /* @__PURE__ */ jsx85(
33072
33117
  XAxis,
@@ -33092,7 +33137,7 @@ var ChartAtom = ({
33092
33137
  ))
33093
33138
  ] });
33094
33139
  case "line":
33095
- return /* @__PURE__ */ jsxs50(LineChart, { data, children: [
33140
+ return /* @__PURE__ */ jsxs50(LineChart, { data: safeData, children: [
33096
33141
  /* @__PURE__ */ jsx85(CartesianGrid, { vertical: false }),
33097
33142
  /* @__PURE__ */ jsx85(
33098
33143
  XAxis,
@@ -33118,7 +33163,7 @@ var ChartAtom = ({
33118
33163
  ))
33119
33164
  ] });
33120
33165
  case "area":
33121
- return /* @__PURE__ */ jsxs50(AreaChart, { data, children: [
33166
+ return /* @__PURE__ */ jsxs50(AreaChart, { data: safeData, children: [
33122
33167
  /* @__PURE__ */ jsx85(CartesianGrid, { vertical: false }),
33123
33168
  /* @__PURE__ */ jsx85(
33124
33169
  XAxis,
@@ -33150,16 +33195,23 @@ var ChartAtom = ({
33150
33195
  /* @__PURE__ */ jsx85(
33151
33196
  Pie,
33152
33197
  {
33153
- data,
33198
+ data: safeData,
33154
33199
  dataKey: YAxisKey || "value",
33155
33200
  nameKey: XAxisKey || "name",
33156
33201
  innerRadius: 60,
33157
- strokeWidth: 5
33202
+ strokeWidth: 5,
33203
+ children: safeData.map((_, index) => /* @__PURE__ */ jsx85(
33204
+ Cell,
33205
+ {
33206
+ fill: seriesColors?.[index] || `var(--color-${Object.keys(safeConfig)[index] || "default"})`
33207
+ },
33208
+ `cell-${index}`
33209
+ ))
33158
33210
  }
33159
33211
  )
33160
33212
  ] });
33161
33213
  case "radar":
33162
- return /* @__PURE__ */ jsxs50(RadarChart, { data, children: [
33214
+ return /* @__PURE__ */ jsxs50(RadarChart, { data: safeData, children: [
33163
33215
  showTooltip && /* @__PURE__ */ jsx85(ChartTooltip, { cursor: false, content: /* @__PURE__ */ jsx85(ChartTooltipContent, {}) }),
33164
33216
  /* @__PURE__ */ jsx85(PolarGrid, {}),
33165
33217
  /* @__PURE__ */ jsx85(PolarAngleAxis, { dataKey: XAxisKey }),
@@ -33177,7 +33229,7 @@ var ChartAtom = ({
33177
33229
  return /* @__PURE__ */ jsxs50(
33178
33230
  RadialBarChart,
33179
33231
  {
33180
- data,
33232
+ data: safeData,
33181
33233
  innerRadius: 30,
33182
33234
  outerRadius: 110,
33183
33235
  barSize: 10,
@@ -33189,7 +33241,15 @@ var ChartAtom = ({
33189
33241
  content: /* @__PURE__ */ jsx85(ChartTooltipContent, { hideLabel: true, nameKey: XAxisKey })
33190
33242
  }
33191
33243
  ),
33192
- /* @__PURE__ */ jsx85(RadialBar, { dataKey: YAxisKey || "value", background: true })
33244
+ Object.keys(safeConfig).map((key, idx) => /* @__PURE__ */ jsx85(
33245
+ RadialBar,
33246
+ {
33247
+ dataKey: key,
33248
+ fill: seriesColors?.[idx] || `var(--color-${key})`,
33249
+ background: true
33250
+ },
33251
+ key
33252
+ ))
33193
33253
  ]
33194
33254
  }
33195
33255
  );