@papernote/ui 1.11.2 → 1.11.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.js CHANGED
@@ -12330,16 +12330,18 @@ function FunnelChart({ stages, height = 300, showConversion = true, onStageClick
12330
12330
  return null;
12331
12331
  const maxCount = Math.max(...stages.map(s => s.count), 1);
12332
12332
  const stageHeight = height / stages.length;
12333
- const svgWidth = 400;
12333
+ const svgWidth = 450;
12334
12334
  const padding = 20;
12335
- const funnelWidth = svgWidth - padding * 2 - 160; // Leave room for labels
12335
+ const leftLabelSpace = 50; // Space for conversion rate labels on left
12336
+ const rightLabelSpace = 160; // Space for stage name + value labels on right
12337
+ const funnelWidth = svgWidth - padding * 2 - leftLabelSpace - rightLabelSpace;
12336
12338
  return (jsxRuntime.jsx("div", { className: className, children: jsxRuntime.jsx("svg", { width: "100%", viewBox: `0 0 ${svgWidth} ${height}`, preserveAspectRatio: "xMidYMid meet", children: stages.map((stage, idx) => {
12337
12339
  const ratio = stage.count / maxCount;
12338
12340
  const nextRatio = idx < stages.length - 1 ? stages[idx + 1].count / maxCount : ratio;
12339
12341
  const y = idx * stageHeight;
12340
12342
  const topWidth = funnelWidth * ratio;
12341
12343
  const bottomWidth = funnelWidth * nextRatio;
12342
- const centerX = padding + funnelWidth / 2;
12344
+ const centerX = padding + leftLabelSpace + funnelWidth / 2;
12343
12345
  const color = stage.color || defaultColors[idx % defaultColors.length];
12344
12346
  // Conversion rate
12345
12347
  const conversionRate = idx > 0 && stages[idx - 1].count > 0
@@ -12353,7 +12355,7 @@ function FunnelChart({ stages, height = 300, showConversion = true, onStageClick
12353
12355
  L ${centerX - bottomWidth / 2} ${y + stageHeight - 2}
12354
12356
  Z
12355
12357
  `;
12356
- return (jsxRuntime.jsxs("g", { onClick: () => onStageClick?.(stage.name), style: onStageClick ? { cursor: 'pointer' } : undefined, role: onStageClick ? 'button' : undefined, children: [jsxRuntime.jsx("path", { d: path, fill: color, opacity: 0.85, className: "transition-opacity hover:opacity-100" }), jsxRuntime.jsx("text", { x: centerX, y: y + stageHeight / 2 + 1, textAnchor: "middle", dominantBaseline: "middle", className: "fill-white text-xs font-bold", style: { fontSize: '12px' }, children: stage.count.toLocaleString() }), jsxRuntime.jsx("text", { x: centerX + funnelWidth / 2 + 12, y: y + stageHeight / 2 - 6, className: "fill-ink-700 dark:fill-ink-300", style: { fontSize: '11px', fontWeight: 500 }, children: stage.name }), stage.value && (jsxRuntime.jsx("text", { x: centerX + funnelWidth / 2 + 12, y: y + stageHeight / 2 + 8, className: "fill-ink-400", style: { fontSize: '10px' }, children: stage.value })), showConversion && conversionRate !== null && (jsxRuntime.jsxs("text", { x: centerX - funnelWidth / 2 - 8, y: y + 4, textAnchor: "end", className: "fill-ink-400", style: { fontSize: '10px' }, children: [conversionRate, "%"] }))] }, stage.name));
12358
+ return (jsxRuntime.jsxs("g", { onClick: () => onStageClick?.(stage.name), style: onStageClick ? { cursor: 'pointer' } : undefined, role: onStageClick ? 'button' : undefined, children: [jsxRuntime.jsx("path", { d: path, fill: color, opacity: 0.85, className: "transition-opacity hover:opacity-100" }), jsxRuntime.jsx("text", { x: centerX, y: y + stageHeight / 2 + 1, textAnchor: "middle", dominantBaseline: "middle", className: "fill-white text-xs font-bold", style: { fontSize: '12px' }, children: stage.count.toLocaleString() }), jsxRuntime.jsx("text", { x: centerX + funnelWidth / 2 + 12, y: y + stageHeight / 2 - 6, className: "fill-ink-700 dark:fill-ink-300", style: { fontSize: '11px', fontWeight: 500 }, children: stage.name }), stage.value && (jsxRuntime.jsx("text", { x: centerX + funnelWidth / 2 + 12, y: y + stageHeight / 2 + 8, className: "fill-ink-400", style: { fontSize: '10px' }, children: stage.value })), showConversion && conversionRate !== null && (jsxRuntime.jsx("g", { children: jsxRuntime.jsxs("text", { x: centerX - funnelWidth / 2 - 16, y: y + 4, textAnchor: "end", className: "fill-ink-500", style: { fontSize: '10px', fontWeight: 500 }, children: ["\u2193 ", conversionRate, "%"] }) }))] }, stage.name));
12357
12359
  }) }) }));
12358
12360
  }
12359
12361