@wello-dev/charts 1.0.3 → 1.0.4

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
@@ -75,8 +75,8 @@ type ChartCurveType = "bump" | "linear" | "natural" | "monotone" | "step" | "ste
75
75
  interface ChartLegendOptions {
76
76
  /** Default: `'top'` */
77
77
  verticalAlign?: "top" | "bottom";
78
- /** Default: `'right'` */
79
- align?: "left" | "center" | "right";
78
+ /** `start`/`end` follow the text direction (start = right in RTL); `left`/`right` are physical. Default: `'start'` */
79
+ align?: "start" | "end" | "left" | "center" | "right";
80
80
  /** Hovering an item highlights its series. Default: true */
81
81
  highlightOnHover?: boolean;
82
82
  }
@@ -127,7 +127,7 @@ interface BaseCartesianChartProps extends ChartStateProps {
127
127
  gridProps?: Record<string, any>;
128
128
  /** Axes with tick lines. Default: `'none'` */
129
129
  tickLine?: ChartTickLine;
130
- /** Dash pattern of grid and cursor lines. Default: `'5 5'` */
130
+ /** Dash pattern of grid and cursor lines (`'0'` for solid). Default: `'5 5'` */
131
131
  strokeDasharray?: string | number;
132
132
  /** Grid and cursor color. Default: `--wello-chart-grid-color` */
133
133
  gridColor?: ChartColor;
@@ -150,11 +150,11 @@ interface AreaChartProps extends BaseCartesianChartProps {
150
150
  curveType?: ChartCurveType;
151
151
  /** Fade the fill from the line color to transparent. Default: true */
152
152
  withGradient?: boolean;
153
- /** Fill opacity (solid fill, or the top of the gradient). Default: 0.28 */
153
+ /** Fill opacity (solid fill, or the top of the gradient). Default: 0.2 */
154
154
  fillOpacity?: number;
155
- /** Default: 2.75 */
155
+ /** Default: 2 */
156
156
  strokeWidth?: number;
157
- /** Default: false */
157
+ /** Default: true */
158
158
  withDots?: boolean;
159
159
  dotProps?: Record<string, any>;
160
160
  activeDotProps?: Record<string, any>;
@@ -272,7 +272,7 @@ interface BasePieChartProps extends ChartStateProps {
272
272
  /** Default: `'value'` */
273
273
  labelsType?: PieLabelsType;
274
274
  labelColor?: ChartColor;
275
- /** Gap between segments in degrees. Default: 0 */
275
+ /** Gap between segments in degrees (shows the card behind, on any background). Default: 2 */
276
276
  paddingAngle?: number;
277
277
  /** Default: 0 */
278
278
  startAngle?: number;
@@ -280,9 +280,12 @@ interface BasePieChartProps extends ChartStateProps {
280
280
  endAngle?: number;
281
281
  /** Segment corner radius in px. Default: 6 */
282
282
  cornerRadius?: number;
283
- /** Segment border width. Default: 3 */
283
+ /** Segment border width, used with `strokeColor`. Default: 3 */
284
284
  strokeWidth?: number;
285
- /** Segment border color. Default: the card background */
285
+ /**
286
+ * Segment border color. Default: none — segments are separated by `paddingAngle` gaps instead,
287
+ * so they read on light and dark cards alike (a fixed border color only matches one of them).
288
+ */
286
289
  strokeColor?: ChartColor;
287
290
  withTooltip?: boolean;
288
291
  /** `'segment'` shows the hovered slice with its share, `'all'` lists every slice. Default: `'segment'` */
@@ -516,7 +519,8 @@ interface ChartLegendProps {
516
519
  series: Pick<ChartSeries, "name" | "color" | "label">[];
517
520
  /** Called with the hovered series name, or `null` when the pointer leaves */
518
521
  onHighlight?: (name: string | null) => void;
519
- align?: "left" | "center" | "right";
522
+ /** `start`/`end` follow the text direction; `left`/`right` are physical. Default: `'start'` */
523
+ align?: "start" | "end" | "left" | "center" | "right";
520
524
  /** Additional class name for the legend container */
521
525
  className?: string;
522
526
  }
package/dist/index.d.ts CHANGED
@@ -75,8 +75,8 @@ type ChartCurveType = "bump" | "linear" | "natural" | "monotone" | "step" | "ste
75
75
  interface ChartLegendOptions {
76
76
  /** Default: `'top'` */
77
77
  verticalAlign?: "top" | "bottom";
78
- /** Default: `'right'` */
79
- align?: "left" | "center" | "right";
78
+ /** `start`/`end` follow the text direction (start = right in RTL); `left`/`right` are physical. Default: `'start'` */
79
+ align?: "start" | "end" | "left" | "center" | "right";
80
80
  /** Hovering an item highlights its series. Default: true */
81
81
  highlightOnHover?: boolean;
82
82
  }
@@ -127,7 +127,7 @@ interface BaseCartesianChartProps extends ChartStateProps {
127
127
  gridProps?: Record<string, any>;
128
128
  /** Axes with tick lines. Default: `'none'` */
129
129
  tickLine?: ChartTickLine;
130
- /** Dash pattern of grid and cursor lines. Default: `'5 5'` */
130
+ /** Dash pattern of grid and cursor lines (`'0'` for solid). Default: `'5 5'` */
131
131
  strokeDasharray?: string | number;
132
132
  /** Grid and cursor color. Default: `--wello-chart-grid-color` */
133
133
  gridColor?: ChartColor;
@@ -150,11 +150,11 @@ interface AreaChartProps extends BaseCartesianChartProps {
150
150
  curveType?: ChartCurveType;
151
151
  /** Fade the fill from the line color to transparent. Default: true */
152
152
  withGradient?: boolean;
153
- /** Fill opacity (solid fill, or the top of the gradient). Default: 0.28 */
153
+ /** Fill opacity (solid fill, or the top of the gradient). Default: 0.2 */
154
154
  fillOpacity?: number;
155
- /** Default: 2.75 */
155
+ /** Default: 2 */
156
156
  strokeWidth?: number;
157
- /** Default: false */
157
+ /** Default: true */
158
158
  withDots?: boolean;
159
159
  dotProps?: Record<string, any>;
160
160
  activeDotProps?: Record<string, any>;
@@ -272,7 +272,7 @@ interface BasePieChartProps extends ChartStateProps {
272
272
  /** Default: `'value'` */
273
273
  labelsType?: PieLabelsType;
274
274
  labelColor?: ChartColor;
275
- /** Gap between segments in degrees. Default: 0 */
275
+ /** Gap between segments in degrees (shows the card behind, on any background). Default: 2 */
276
276
  paddingAngle?: number;
277
277
  /** Default: 0 */
278
278
  startAngle?: number;
@@ -280,9 +280,12 @@ interface BasePieChartProps extends ChartStateProps {
280
280
  endAngle?: number;
281
281
  /** Segment corner radius in px. Default: 6 */
282
282
  cornerRadius?: number;
283
- /** Segment border width. Default: 3 */
283
+ /** Segment border width, used with `strokeColor`. Default: 3 */
284
284
  strokeWidth?: number;
285
- /** Segment border color. Default: the card background */
285
+ /**
286
+ * Segment border color. Default: none — segments are separated by `paddingAngle` gaps instead,
287
+ * so they read on light and dark cards alike (a fixed border color only matches one of them).
288
+ */
286
289
  strokeColor?: ChartColor;
287
290
  withTooltip?: boolean;
288
291
  /** `'segment'` shows the hovered slice with its share, `'all'` lists every slice. Default: `'segment'` */
@@ -516,7 +519,8 @@ interface ChartLegendProps {
516
519
  series: Pick<ChartSeries, "name" | "color" | "label">[];
517
520
  /** Called with the hovered series name, or `null` when the pointer leaves */
518
521
  onHighlight?: (name: string | null) => void;
519
- align?: "left" | "center" | "right";
522
+ /** `start`/`end` follow the text direction; `left`/`right` are physical. Default: `'start'` */
523
+ align?: "start" | "end" | "left" | "center" | "right";
520
524
  /** Additional class name for the legend container */
521
525
  className?: string;
522
526
  }
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ function styleInject(css, { insertAt } = {}) {
23
23
  }
24
24
 
25
25
  // src/styles.css
26
- styleInject(".wello-chart {\n --wello-chart-primary: var(--wello-primary-color, var(--primary, #26372c));\n --wello-chart-bg: var(--wello-color-surface, var(--card, #ffffff));\n --wello-chart-text-color: var(--wello-color-dimmed, var(--muted-foreground, #64748b));\n --wello-chart-bright-color: var(--wello-color-bright, var(--foreground, #0f172a));\n --wello-chart-dimmed-color: var(--wello-color-dimmed, var(--muted-foreground, #64748b));\n --wello-chart-grid-color: var(--wello-color-border, var(--border, #e2e8f0));\n --wello-chart-cursor-fill: color-mix(in srgb, var(--wello-chart-primary) 8%, transparent);\n --wello-chart-label-line-color: var(--wello-color-border-strong, var(--input, #cbd5e1));\n --wello-chart-tooltip-bg: var(--wello-color-bright, var(--foreground, #0f172a));\n --wello-chart-tooltip-fg: var(--wello-color-body, var(--background, #ffffff));\n --wello-chart-heatmap-empty: color-mix(in srgb, var(--wello-chart-text-color) 15%, transparent);\n --wello-chart-radial-bg: color-mix(in srgb, var(--wello-chart-text-color) 12%, transparent);\n --wello-chart-muted: color-mix(in srgb, var(--wello-chart-text-color) 35%, transparent);\n --wello-chart-font: inherit;\n box-sizing: border-box;\n position: relative;\n padding: 16px;\n border: 1px solid var(--wello-chart-grid-color);\n border-radius: 12px;\n background: var(--wello-chart-bg);\n box-shadow: 0 2px 8px rgb(15 23 42 / 0.08);\n color: var(--wello-chart-text-color);\n font-family: var(--wello-chart-font);\n}\n.dark .wello-chart,\n[data-theme=dark] .wello-chart,\n.wello-chart[data-theme=dark] {\n --wello-chart-primary: var(--wello-primary-color, var(--primary, #9fbfa8));\n --wello-chart-bg: var(--wello-color-surface, var(--card, #0f172a));\n --wello-chart-text-color: var(--wello-color-dimmed, var(--muted-foreground, #94a3b8));\n --wello-chart-bright-color: var(--wello-color-bright, var(--foreground, #f8fafc));\n --wello-chart-dimmed-color: var(--wello-color-dimmed, var(--muted-foreground, #94a3b8));\n --wello-chart-grid-color: var(--wello-color-border, var(--border, #334155));\n --wello-chart-label-line-color: var(--wello-color-border-strong, var(--input, #475569));\n --wello-chart-tooltip-bg: var(--wello-color-bright, var(--foreground, #f8fafc));\n --wello-chart-tooltip-fg: var(--wello-color-body, var(--background, #0f172a));\n}\n.wello-chart .recharts-wrapper:focus,\n.wello-chart .recharts-surface:focus,\n.wello-chart *:focus:not(:focus-visible) {\n outline: none;\n}\n.wello-tooltip {\n min-width: 8.5rem;\n padding: 10px 12px;\n border-radius: 12px;\n background: color-mix(in srgb, var(--wello-chart-tooltip-bg) 94%, transparent);\n color: var(--wello-chart-tooltip-fg);\n box-shadow: 0 12px 32px rgb(0 0 0 / 0.24);\n font-size: 12px;\n line-height: 1.4;\n pointer-events: none;\n}\n.wello-tooltip-label {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 4px;\n opacity: 0.8;\n}\n.wello-tooltip--slice .wello-tooltip-label {\n margin-bottom: 6px;\n font-weight: 600;\n opacity: 1;\n}\n.wello-tooltip-body {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.wello-tooltip-item {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.wello-tooltip-swatch,\n.wello-legend-swatch {\n flex-shrink: 0;\n width: 8px;\n height: 8px;\n border-radius: 999px;\n}\n.wello-tooltip .wello-tooltip-swatch {\n box-shadow: 0 0 0 1px color-mix(in srgb, var(--wello-chart-tooltip-fg) 45%, transparent);\n}\n.wello-tooltip-item-name {\n flex: 1;\n opacity: 0.8;\n}\n.wello-tooltip-item-value {\n margin-inline-start: 16px;\n font-variant-numeric: tabular-nums;\n font-weight: 700;\n}\n.wello-legend {\n display: flex;\n flex-wrap: wrap;\n gap: 4px 16px;\n padding-bottom: 8px;\n font-size: 11px;\n color: var(--wello-chart-text-color);\n}\n.wello-legend--left {\n justify-content: flex-start;\n}\n.wello-legend--center {\n justify-content: center;\n}\n.wello-legend--right {\n justify-content: flex-end;\n}\n.wello-legend-item {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 2px 6px;\n border-radius: 4px;\n cursor: default;\n}\n.wello-legend-item:hover {\n background: var(--wello-chart-cursor-fill);\n}\n.wello-chart-skeleton {\n border-radius: 12px;\n background: color-mix(in srgb, var(--wello-chart-text-color) 14%, transparent);\n animation: wello-pulse 1.6s ease-in-out infinite;\n}\n.wello-chart-empty {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n font-size: 14px;\n font-weight: 500;\n text-align: center;\n}\n@keyframes wello-pulse {\n 50% {\n opacity: 0.5;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .wello-chart-skeleton {\n animation: none;\n }\n}\n.wello-pie .wello-legend {\n padding: 8px 0 0;\n}\n.wello-pie-area {\n position: relative;\n}\n.wello-floating-tooltip {\n z-index: 9999;\n pointer-events: none;\n white-space: nowrap;\n font-family: var(--wello-chart-font, inherit);\n}\n.wello-donut-label {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n text-align: center;\n}\n.wello-donut-label-inner {\n display: flex;\n flex-direction: column;\n align-items: center;\n line-height: 1;\n}\n.wello-donut-label-main {\n color: var(--wello-chart-primary);\n font-size: 24px;\n font-weight: 900;\n font-variant-numeric: tabular-nums;\n letter-spacing: -0.025em;\n}\n.wello-donut-label-sub {\n margin-top: 6px;\n color: var(--wello-chart-text-color);\n font-size: 12px;\n font-weight: 600;\n}\n.wello-radial-bar .wello-legend {\n padding: 8px 0 0;\n}\n.wello-heatmap {\n display: inline-block;\n}\n.wello-heatmap svg {\n display: block;\n overflow: visible;\n}\n.wello-heatmap-label {\n fill: var(--wello-chart-text-color);\n}\n.wello-heatmap-rect--outside {\n opacity: 0.4;\n}\n.wello-heatmap-tooltip {\n min-width: 0;\n}\n.wello-heatmap-legend {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 3px;\n margin-top: 8px;\n color: var(--wello-chart-text-color);\n}\n.wello-heatmap-legend > span:first-child {\n margin-inline-end: 4px;\n}\n.wello-heatmap-legend > span:last-child {\n margin-inline-start: 4px;\n}\n");
26
+ styleInject(".wello-chart {\n --wello-chart-primary: var(--wello-primary-color, var(--primary, #26372c));\n --wello-chart-bg: var(--wello-color-surface, var(--card, #ffffff));\n --wello-chart-text-color: color-mix(in srgb, currentColor 50%, transparent);\n --wello-chart-legend-color: color-mix(in srgb, currentColor 85%, transparent);\n --wello-chart-bright-color: currentColor;\n --wello-chart-dimmed-color: color-mix(in srgb, currentColor 50%, transparent);\n --wello-chart-grid-color: color-mix(in srgb, currentColor 22%, transparent);\n --wello-chart-cursor-fill: color-mix(in srgb, var(--wello-chart-primary) 8%, transparent);\n --wello-chart-label-line-color: var(--wello-color-border-strong, var(--input, #cbd5e1));\n --wello-chart-tooltip-bg: var(--wello-color-bright, var(--foreground, #0f172a));\n --wello-chart-tooltip-fg: var(--wello-color-body, var(--background, #ffffff));\n --wello-chart-heatmap-empty: color-mix(in srgb, var(--wello-chart-text-color) 15%, transparent);\n --wello-chart-radial-bg: color-mix(in srgb, var(--wello-chart-text-color) 12%, transparent);\n --wello-chart-muted: color-mix(in srgb, var(--wello-chart-text-color) 35%, transparent);\n --wello-chart-font: inherit;\n box-sizing: border-box;\n position: relative;\n font-family: var(--wello-chart-font);\n}\n.dark .wello-chart,\n[data-theme=dark] .wello-chart,\n.wello-chart[data-theme=dark] {\n --wello-chart-primary: var(--wello-primary-color, var(--primary, #9fbfa8));\n --wello-chart-bg: var(--wello-color-surface, var(--card, #0f172a));\n --wello-chart-label-line-color: var(--wello-color-border-strong, var(--input, #475569));\n --wello-chart-tooltip-bg: var(--wello-color-bright, var(--foreground, #f8fafc));\n --wello-chart-tooltip-fg: var(--wello-color-body, var(--background, #0f172a));\n}\n.wello-chart .recharts-cartesian-grid line {\n shape-rendering: crispEdges;\n}\n.wello-chart .recharts-surface,\n.wello-heatmap svg {\n direction: ltr;\n}\n.wello-chart .recharts-wrapper:focus,\n.wello-chart .recharts-surface:focus,\n.wello-chart *:focus:not(:focus-visible) {\n outline: none;\n}\n.wello-tooltip {\n min-width: 8.5rem;\n padding: 10px 12px;\n border-radius: 12px;\n background: color-mix(in srgb, var(--wello-chart-tooltip-bg) 94%, transparent);\n color: var(--wello-chart-tooltip-fg);\n box-shadow: 0 12px 32px rgb(0 0 0 / 0.24);\n font-size: 12px;\n line-height: 1.4;\n pointer-events: none;\n}\n.wello-tooltip-label {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 4px;\n opacity: 0.8;\n}\n.wello-tooltip--slice .wello-tooltip-label {\n margin-bottom: 6px;\n font-weight: 600;\n opacity: 1;\n}\n.wello-tooltip-body {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.wello-tooltip-item {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.wello-tooltip-swatch,\n.wello-legend-swatch {\n flex-shrink: 0;\n width: 8px;\n height: 8px;\n border-radius: 999px;\n}\n.wello-tooltip .wello-tooltip-swatch {\n box-shadow: 0 0 0 1px color-mix(in srgb, var(--wello-chart-tooltip-fg) 45%, transparent);\n}\n.wello-tooltip-item-name {\n flex: 1;\n opacity: 0.8;\n}\n.wello-tooltip-item-value {\n margin-inline-start: 16px;\n font-variant-numeric: tabular-nums;\n font-weight: 700;\n}\n.wello-legend {\n display: flex;\n flex-wrap: wrap;\n gap: 4px 12px;\n box-sizing: border-box;\n max-width: 100%;\n padding-bottom: 14px;\n font-size: 12.5px;\n font-weight: 500;\n color: var(--wello-chart-legend-color);\n}\n.wello-legend--start,\n.wello-legend--left {\n justify-content: flex-start;\n}\n.wello-legend--center {\n justify-content: center;\n}\n.wello-legend--end,\n.wello-legend--right {\n justify-content: flex-end;\n}\n[dir=rtl] .wello-legend--left {\n justify-content: flex-end;\n}\n[dir=rtl] .wello-legend--right {\n justify-content: flex-start;\n}\n.wello-legend .wello-legend-swatch {\n width: 10px;\n height: 10px;\n}\n.wello-legend-item {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 3px 8px;\n border-radius: 999px;\n cursor: default;\n transition: background-color 120ms ease;\n}\n.wello-legend-item:hover {\n background: var(--wello-chart-cursor-fill);\n}\n.wello-chart-skeleton {\n border-radius: 12px;\n background: color-mix(in srgb, var(--wello-chart-text-color) 14%, transparent);\n animation: wello-pulse 1.6s ease-in-out infinite;\n}\n.wello-chart-empty {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n color: var(--wello-chart-text-color);\n font-size: 14px;\n font-weight: 500;\n text-align: center;\n}\n@keyframes wello-pulse {\n 50% {\n opacity: 0.5;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .wello-chart-skeleton {\n animation: none;\n }\n}\n.wello-pie .wello-legend {\n padding: 8px 0 0;\n}\n.wello-pie-area {\n position: relative;\n}\n.wello-floating-tooltip {\n z-index: 9999;\n pointer-events: none;\n white-space: nowrap;\n font-family: var(--wello-chart-font, inherit);\n}\n.wello-donut-label {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n text-align: center;\n}\n.wello-donut-label-inner {\n display: flex;\n flex-direction: column;\n align-items: center;\n line-height: 1;\n}\n.wello-donut-label-main {\n color: var(--wello-chart-bright-color);\n font-size: 24px;\n font-weight: 900;\n font-variant-numeric: tabular-nums;\n letter-spacing: -0.025em;\n}\n.wello-donut-label-sub {\n margin-top: 6px;\n color: var(--wello-chart-text-color);\n font-size: 12px;\n font-weight: 600;\n}\n.wello-radial-bar .wello-legend {\n padding: 8px 0 0;\n}\n.wello-heatmap {\n display: inline-block;\n}\n.wello-heatmap svg {\n display: block;\n overflow: visible;\n}\n.wello-heatmap-label {\n fill: var(--wello-chart-text-color);\n}\n.wello-heatmap-rect--outside {\n opacity: 0.4;\n}\n.wello-heatmap-tooltip {\n min-width: 0;\n}\n.wello-heatmap-legend {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 3px;\n margin-top: 8px;\n color: var(--wello-chart-text-color);\n}\n.wello-heatmap-legend > span:first-child {\n margin-inline-end: 4px;\n}\n.wello-heatmap-legend > span:last-child {\n margin-inline-start: 4px;\n}\n");
27
27
 
28
28
  // src/charts/area-chart.tsx
29
29
  import { Area, AreaChart as ReAreaChart, LabelList, ResponsiveContainer } from "recharts";
@@ -379,7 +379,7 @@ function useIsRtl(ref) {
379
379
 
380
380
  // src/components/chart-legend.tsx
381
381
  import { jsx, jsxs } from "react/jsx-runtime";
382
- function ChartLegend({ series, onHighlight, align = "right", className }) {
382
+ function ChartLegend({ series, onHighlight, align = "start", className }) {
383
383
  return /* @__PURE__ */ jsx("div", { className: cx("wello-legend", `wello-legend--${align}`, className), children: series.map((item) => /* @__PURE__ */ jsxs(
384
384
  "div",
385
385
  {
@@ -487,19 +487,45 @@ function withLabelPadding(props) {
487
487
  const padding = vertical ? { top: 20, bottom: 20 } : { left: 30, right: 30 };
488
488
  return { ...props, [key]: { padding, ...props[key] } };
489
489
  }
490
+ function renderGridLine(props) {
491
+ const snap = (value) => Math.round(value) + 0.5;
492
+ const horizontal = props.y1 === props.y2;
493
+ return /* @__PURE__ */ jsx3(
494
+ "line",
495
+ {
496
+ x1: horizontal ? props.x1 : snap(props.x1),
497
+ x2: horizontal ? props.x2 : snap(props.x2),
498
+ y1: horizontal ? snap(props.y1) : props.y1,
499
+ y2: horizontal ? snap(props.y2) : props.y2,
500
+ stroke: props.stroke,
501
+ strokeWidth: props.strokeWidth,
502
+ strokeOpacity: props.strokeOpacity,
503
+ strokeDasharray: props.strokeDasharray,
504
+ fill: "none",
505
+ shapeRendering: "crispEdges"
506
+ },
507
+ props.key
508
+ );
509
+ }
490
510
  function tickFormatter(props) {
491
511
  return (value) => `${props.valueFormatter ? props.valueFormatter(value) : value}${props.unit ?? ""}`;
492
512
  }
493
513
  function axisLabel(value, axis) {
494
514
  if (!value) return void 0;
495
515
  if (axis === "x")
496
- return { value, position: "insideBottom", offset: -16, fontSize: 12, fill: "currentColor" };
516
+ return {
517
+ value,
518
+ position: "insideBottom",
519
+ offset: -16,
520
+ fontSize: 12,
521
+ fill: "var(--wello-chart-text-color)"
522
+ };
497
523
  return {
498
524
  value,
499
525
  angle: axis === "y" ? -90 : 90,
500
526
  position: axis === "y" ? "insideLeft" : "insideRight",
501
527
  fontSize: 12,
502
- fill: "currentColor",
528
+ fill: "var(--wello-chart-text-color)",
503
529
  style: { textAnchor: "middle" }
504
530
  };
505
531
  }
@@ -534,20 +560,33 @@ function cartesianElements(props, { onHighlight, cursor, valueTickFormatter, rtl
534
560
  const vertical = orientation === "vertical";
535
561
  const gridStroke = getThemeColor(gridColor, "var(--wello-chart-grid-color)");
536
562
  const valueTicks = valueTickFormatter ?? tickFormatter(props);
537
- const tick = { fill: "currentColor", fontSize: 11 };
538
- const xTickLine = tickLine === "x" || tickLine === "xy" ? { stroke: "currentColor" } : false;
539
- const yTickLine = tickLine === "y" || tickLine === "xy" ? { stroke: "currentColor" } : false;
563
+ const tickBase = { fill: "var(--wello-chart-text-color)", fontSize: 12 };
564
+ const xTick = { ...tickBase, transform: "translate(0, 10)" };
565
+ const yTick = { ...tickBase, transform: rtl ? "translate(10, 0)" : "translate(-10, 0)" };
566
+ const rightYTick = { ...tickBase, transform: rtl ? "translate(-10, 0)" : "translate(10, 0)" };
567
+ const xTickLine = tickLine === "x" || tickLine === "xy" ? { stroke: "var(--wello-chart-grid-color)" } : false;
568
+ const yTickLine = tickLine === "y" || tickLine === "xy" ? { stroke: "var(--wello-chart-grid-color)" } : false;
540
569
  const categoryAxis = { dataKey, type: "category" };
541
- const valueAxis = { type: "number", tickFormatter: valueTicks, unit: void 0 };
570
+ const valueAxis = {
571
+ type: "number",
572
+ tickFormatter: valueTicks,
573
+ unit: void 0,
574
+ tickCount: 7,
575
+ // Keep every tick. With recharts' default ("preserveEnd") the grid re-thins the ticks using
576
+ // its own label-size guess, so a short chart shows 7 labels but only every other grid line.
577
+ interval: 0
578
+ };
579
+ const valueGrid = gridAxis === "x" || gridAxis === "xy";
580
+ const categoryGrid = gridAxis === "y" || gridAxis === "xy";
542
581
  const elements = [
543
582
  /* @__PURE__ */ jsx3(
544
583
  CartesianGrid,
545
584
  {
585
+ yAxisId: "left",
546
586
  strokeDasharray,
547
587
  stroke: gridStroke,
548
- strokeOpacity: 0.55,
549
- horizontal: gridAxis === "x" || gridAxis === "xy",
550
- vertical: gridAxis === "y" || gridAxis === "xy",
588
+ horizontal: (vertical ? categoryGrid : valueGrid) ? renderGridLine : false,
589
+ vertical: (vertical ? valueGrid : categoryGrid) ? renderGridLine : false,
551
590
  ...gridProps
552
591
  },
553
592
  "grid"
@@ -558,7 +597,7 @@ function cartesianElements(props, { onHighlight, cursor, valueTickFormatter, rtl
558
597
  hide: !withXAxis,
559
598
  ...vertical ? valueAxis : categoryAxis,
560
599
  reversed: rtl,
561
- tick,
600
+ tick: xTick,
562
601
  tickLine: xTickLine,
563
602
  axisLine: false,
564
603
  minTickGap: 5,
@@ -575,7 +614,7 @@ function cartesianElements(props, { onHighlight, cursor, valueTickFormatter, rtl
575
614
  orientation: rtl ? "right" : "left",
576
615
  hide: !withYAxis,
577
616
  ...vertical ? categoryAxis : valueAxis,
578
- tick,
617
+ tick: yTick,
579
618
  tickLine: yTickLine,
580
619
  axisLine: false,
581
620
  width: vertical ? 80 : 60,
@@ -593,7 +632,7 @@ function cartesianElements(props, { onHighlight, cursor, valueTickFormatter, rtl
593
632
  yAxisId: "right",
594
633
  orientation: rtl ? "left" : "right",
595
634
  ...vertical ? categoryAxis : valueAxis,
596
- tick,
635
+ tick: rightYTick,
597
636
  tickLine: yTickLine,
598
637
  axisLine: false,
599
638
  width: 60,
@@ -611,7 +650,10 @@ function cartesianElements(props, { onHighlight, cursor, valueTickFormatter, rtl
611
650
  {
612
651
  isAnimationActive: tooltipAnimationDuration !== 0,
613
652
  animationDuration: tooltipAnimationDuration,
614
- cursor: cursor === "fill" ? { fill: "var(--wello-chart-cursor-fill)" } : { stroke: gridStroke, strokeWidth: 1 },
653
+ cursor: cursor === "fill" ? { fill: "var(--wello-chart-cursor-fill)" } : (
654
+ // Dashed like the grid (Mantine style).
655
+ { stroke: gridStroke, strokeWidth: 1, strokeDasharray }
656
+ ),
615
657
  wrapperStyle: { zIndex: 50, outline: "none" },
616
658
  offset: 14,
617
659
  content: renderCartesianTooltip({ series, unit, valueFormatter }),
@@ -726,9 +768,9 @@ function AreaChart(props) {
726
768
  type = "default",
727
769
  curveType = "monotone",
728
770
  withGradient = true,
729
- fillOpacity = 0.28,
730
- strokeWidth = 2.75,
731
- withDots = false,
771
+ fillOpacity = 0.2,
772
+ strokeWidth = 2,
773
+ withDots = true,
732
774
  dotProps,
733
775
  activeDotProps,
734
776
  connectNulls = true,
@@ -777,7 +819,7 @@ function AreaChart(props) {
777
819
  )
778
820
  ] }) : withGradient ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
779
821
  /* @__PURE__ */ jsx5("stop", { offset: "0%", stopColor: color, stopOpacity: fillOpacity }),
780
- /* @__PURE__ */ jsx5("stop", { offset: "100%", stopColor: color, stopOpacity: 0.02 })
822
+ /* @__PURE__ */ jsx5("stop", { offset: "100%", stopColor: color, stopOpacity: 0.01 })
781
823
  ] }) : /* @__PURE__ */ jsx5("stop", { offset: "0%", stopColor: color, stopOpacity: fillOpacity }) }) }, `defs-${item.name}`),
782
824
  /* @__PURE__ */ jsx5(
783
825
  Area,
@@ -799,11 +841,13 @@ function AreaChart(props) {
799
841
  fillOpacity: dimmed ? 0 : 1,
800
842
  strokeWidth: 2,
801
843
  r: 4,
802
- stroke: "var(--wello-chart-bg)",
844
+ // Solid dot in the series color (no surface-colored ring), as in Mantine.
845
+ stroke: color,
846
+ strokeOpacity: dimmed ? 0 : 1,
803
847
  ...dotProps
804
848
  } : false,
805
849
  activeDot: {
806
- fill: "var(--wello-chart-bg)",
850
+ fill: "#fff",
807
851
  stroke: color,
808
852
  strokeWidth: 2,
809
853
  r: 4,
@@ -818,7 +862,7 @@ function AreaChart(props) {
818
862
  {
819
863
  position: "top",
820
864
  fontSize: 12,
821
- fill: "currentColor",
865
+ fill: "var(--wello-chart-text-color)",
822
866
  formatter: props.valueFormatter
823
867
  }
824
868
  )
@@ -973,7 +1017,7 @@ function BarChart(props) {
973
1017
  {
974
1018
  position: orientation === "vertical" ? "right" : "top",
975
1019
  fontSize: 12,
976
- fill: "currentColor",
1020
+ fill: "var(--wello-chart-text-color)",
977
1021
  valueAccessor: (entry) => waterfall ? entry.payload.__value : entry.value,
978
1022
  formatter: (value) => valueFormatter && typeof value === "number" ? valueFormatter(value) : value,
979
1023
  ...valueLabelProps
@@ -1127,7 +1171,7 @@ function LineChart(props) {
1127
1171
  {
1128
1172
  position: "top",
1129
1173
  fontSize: 12,
1130
- fill: "currentColor",
1174
+ fill: "var(--wello-chart-text-color)",
1131
1175
  formatter: (value) => valueFormatter && typeof value === "number" ? valueFormatter(value) : value
1132
1176
  }
1133
1177
  )
@@ -1343,7 +1387,7 @@ function PieBase({
1343
1387
  labelsType = "value",
1344
1388
  labelColor,
1345
1389
  labelsPosition,
1346
- paddingAngle = 0,
1390
+ paddingAngle = 2,
1347
1391
  startAngle = 0,
1348
1392
  endAngle = 360,
1349
1393
  cornerRadius = 6,
@@ -1392,7 +1436,7 @@ function PieBase({
1392
1436
  {
1393
1437
  x,
1394
1438
  y,
1395
- fill: outside ? getThemeColor(labelColor, "currentColor") : getThemeColor(labelColor, "#fff"),
1439
+ fill: outside ? getThemeColor(labelColor, "var(--wello-chart-text-color)") : getThemeColor(labelColor, "#fff"),
1396
1440
  textAnchor: outside ? x > x0 ? "start" : "end" : "middle",
1397
1441
  dominantBaseline: "central",
1398
1442
  fontSize: 11,
@@ -1447,8 +1491,8 @@ function PieBase({
1447
1491
  startAngle,
1448
1492
  endAngle,
1449
1493
  cornerRadius,
1450
- stroke: getThemeColor(strokeColor, "var(--wello-chart-bg)"),
1451
- strokeWidth: ring ? 0 : strokeWidth,
1494
+ stroke: strokeColor ? getThemeColor(strokeColor) : "none",
1495
+ strokeWidth: ring || !strokeColor ? 0 : strokeWidth,
1452
1496
  label: withLabels && !ring ? renderLabel : false,
1453
1497
  labelLine: outside && withLabelsLine && !ring ? { stroke: "var(--wello-chart-label-line-color)" } : false,
1454
1498
  activeShape: ring ? void 0 : ActiveSlice,