@papernote/ui 1.11.5 → 1.11.6
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/components/FunnelChart.d.ts +3 -1
- package/dist/components/FunnelChart.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +55 -38
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +55 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FunnelChart.tsx +27 -15
|
@@ -15,6 +15,8 @@ export interface FunnelChartProps {
|
|
|
15
15
|
height?: number;
|
|
16
16
|
/** Whether to show conversion rates between stages */
|
|
17
17
|
showConversion?: boolean;
|
|
18
|
+
/** Label size preset — controls stage name, value, count, and conversion text */
|
|
19
|
+
labelSize?: 'sm' | 'md' | 'lg';
|
|
18
20
|
/** Click handler for a stage */
|
|
19
21
|
onStageClick?: (stageName: string) => void;
|
|
20
22
|
/** Additional className */
|
|
@@ -27,5 +29,5 @@ export interface FunnelChartProps {
|
|
|
27
29
|
* to its count relative to the first (widest) stage.
|
|
28
30
|
* Shows stage names, counts, values, and optional conversion rates.
|
|
29
31
|
*/
|
|
30
|
-
export default function FunnelChart({ stages, height, showConversion, onStageClick, className, }: FunnelChartProps): import("react/jsx-runtime").JSX.Element | null;
|
|
32
|
+
export default function FunnelChart({ stages, height, showConversion, labelSize, onStageClick, className, }: FunnelChartProps): import("react/jsx-runtime").JSX.Element | null;
|
|
31
33
|
//# sourceMappingURL=FunnelChart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunnelChart.d.ts","sourceRoot":"","sources":["../../src/components/FunnelChart.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2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GlB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4500,6 +4500,8 @@ interface FunnelChartProps {
|
|
|
4500
4500
|
height?: number;
|
|
4501
4501
|
/** Whether to show conversion rates between stages */
|
|
4502
4502
|
showConversion?: boolean;
|
|
4503
|
+
/** Label size preset — controls stage name, value, count, and conversion text */
|
|
4504
|
+
labelSize?: 'sm' | 'md' | 'lg';
|
|
4503
4505
|
/** Click handler for a stage */
|
|
4504
4506
|
onStageClick?: (stageName: string) => void;
|
|
4505
4507
|
/** Additional className */
|
|
@@ -4512,7 +4514,7 @@ interface FunnelChartProps {
|
|
|
4512
4514
|
* to its count relative to the first (widest) stage.
|
|
4513
4515
|
* Shows stage names, counts, values, and optional conversion rates.
|
|
4514
4516
|
*/
|
|
4515
|
-
declare function FunnelChart({ stages, height, showConversion, onStageClick, className, }: FunnelChartProps): react_jsx_runtime.JSX.Element | null;
|
|
4517
|
+
declare function FunnelChart({ stages, height, showConversion, labelSize, onStageClick, className, }: FunnelChartProps): react_jsx_runtime.JSX.Element | null;
|
|
4516
4518
|
|
|
4517
4519
|
interface DashboardWidget {
|
|
4518
4520
|
/** Widget unique ID */
|
package/dist/index.esm.js
CHANGED
|
@@ -12296,6 +12296,14 @@ const defaultColors = [
|
|
|
12296
12296
|
'#f3e8ff', // purple ultra light
|
|
12297
12297
|
];
|
|
12298
12298
|
// =============================================================================
|
|
12299
|
+
// Label Size Presets
|
|
12300
|
+
// =============================================================================
|
|
12301
|
+
const labelSizes = {
|
|
12302
|
+
sm: { name: '9px', value: '8px', count: '10px', conversion: '8px' },
|
|
12303
|
+
md: { name: '11px', value: '10px', count: '12px', conversion: '10px' },
|
|
12304
|
+
lg: { name: '13px', value: '12px', count: '14px', conversion: '12px' },
|
|
12305
|
+
};
|
|
12306
|
+
// =============================================================================
|
|
12299
12307
|
// Component
|
|
12300
12308
|
// =============================================================================
|
|
12301
12309
|
/**
|
|
@@ -12305,9 +12313,10 @@ const defaultColors = [
|
|
|
12305
12313
|
* to its count relative to the first (widest) stage.
|
|
12306
12314
|
* Shows stage names, counts, values, and optional conversion rates.
|
|
12307
12315
|
*/
|
|
12308
|
-
function FunnelChart({ stages, height = 300, showConversion = true, onStageClick, className = '', }) {
|
|
12316
|
+
function FunnelChart({ stages, height = 300, showConversion = true, labelSize = 'md', onStageClick, className = '', }) {
|
|
12309
12317
|
if (stages.length === 0)
|
|
12310
12318
|
return null;
|
|
12319
|
+
const sizes = labelSizes[labelSize];
|
|
12311
12320
|
const maxCount = Math.max(...stages.map(s => s.count), 1);
|
|
12312
12321
|
const stageHeight = height / stages.length;
|
|
12313
12322
|
const svgWidth = 450;
|
|
@@ -12335,7 +12344,7 @@ function FunnelChart({ stages, height = 300, showConversion = true, onStageClick
|
|
|
12335
12344
|
L ${centerX - bottomWidth / 2} ${y + stageHeight - 2}
|
|
12336
12345
|
Z
|
|
12337
12346
|
`;
|
|
12338
|
-
return (jsxs("g", { onClick: () => onStageClick?.(stage.name), style: onStageClick ? { cursor: 'pointer' } : undefined, role: onStageClick ? 'button' : undefined, children: [jsx("path", { d: path, fill: color, opacity: 0.85, className: "transition-opacity hover:opacity-100" }), jsx("text", { x: centerX, y: y + stageHeight / 2 + 1, textAnchor: "middle", dominantBaseline: "middle", className: "fill-white
|
|
12347
|
+
return (jsxs("g", { onClick: () => onStageClick?.(stage.name), style: onStageClick ? { cursor: 'pointer' } : undefined, role: onStageClick ? 'button' : undefined, children: [jsx("path", { d: path, fill: color, opacity: 0.85, className: "transition-opacity hover:opacity-100" }), jsx("text", { x: centerX, y: y + stageHeight / 2 + 1, textAnchor: "middle", dominantBaseline: "middle", className: "fill-white font-bold", style: { fontSize: sizes.count }, children: stage.count.toLocaleString() }), jsx("text", { x: centerX + funnelWidth / 2 + 12, y: y + stageHeight / 2 - 4, className: "fill-ink-700 dark:fill-ink-300", style: { fontSize: sizes.name, fontWeight: 500 }, children: stage.name }), stage.value && (jsx("text", { x: centerX + funnelWidth / 2 + 12, y: y + stageHeight / 2 + 7, className: "fill-ink-400", style: { fontSize: sizes.value }, children: stage.value })), showConversion && conversionRate !== null && (jsxs("text", { x: centerX - funnelWidth / 2 - 16, y: y + 4, textAnchor: "end", className: "fill-ink-500", style: { fontSize: sizes.conversion, fontWeight: 500 }, children: ["\u2193 ", conversionRate, "%"] }))] }, stage.name));
|
|
12339
12348
|
}) }) }));
|
|
12340
12349
|
}
|
|
12341
12350
|
|
|
@@ -15672,44 +15681,52 @@ function getAugmentedNamespace(n) {
|
|
|
15672
15681
|
* (A1, A1:C5, ...)
|
|
15673
15682
|
*/
|
|
15674
15683
|
|
|
15675
|
-
|
|
15684
|
+
var collection;
|
|
15685
|
+
var hasRequiredCollection;
|
|
15686
|
+
|
|
15687
|
+
function requireCollection () {
|
|
15688
|
+
if (hasRequiredCollection) return collection;
|
|
15689
|
+
hasRequiredCollection = 1;
|
|
15690
|
+
class Collection {
|
|
15676
15691
|
|
|
15677
|
-
|
|
15678
|
-
|
|
15679
|
-
|
|
15680
|
-
|
|
15681
|
-
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
|
|
15686
|
-
|
|
15687
|
-
|
|
15692
|
+
constructor(data, refs) {
|
|
15693
|
+
if (data == null && refs == null) {
|
|
15694
|
+
this._data = [];
|
|
15695
|
+
this._refs = [];
|
|
15696
|
+
} else {
|
|
15697
|
+
if (data.length !== refs.length)
|
|
15698
|
+
throw Error('Collection: data length should match references length.');
|
|
15699
|
+
this._data = data;
|
|
15700
|
+
this._refs = refs;
|
|
15701
|
+
}
|
|
15702
|
+
}
|
|
15688
15703
|
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15704
|
+
get data() {
|
|
15705
|
+
return this._data;
|
|
15706
|
+
}
|
|
15692
15707
|
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
|
|
15708
|
+
get refs() {
|
|
15709
|
+
return this._refs;
|
|
15710
|
+
}
|
|
15696
15711
|
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15712
|
+
get length() {
|
|
15713
|
+
return this._data.length;
|
|
15714
|
+
}
|
|
15700
15715
|
|
|
15701
|
-
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
}
|
|
15716
|
+
/**
|
|
15717
|
+
* Add data and references to this collection.
|
|
15718
|
+
* @param {{}} obj - data
|
|
15719
|
+
* @param {{}} ref - reference
|
|
15720
|
+
*/
|
|
15721
|
+
add(obj, ref) {
|
|
15722
|
+
this._data.push(obj);
|
|
15723
|
+
this._refs.push(ref);
|
|
15724
|
+
}
|
|
15725
|
+
}
|
|
15711
15726
|
|
|
15712
|
-
|
|
15727
|
+
collection = Collection;
|
|
15728
|
+
return collection;
|
|
15729
|
+
}
|
|
15713
15730
|
|
|
15714
15731
|
var helpers;
|
|
15715
15732
|
var hasRequiredHelpers;
|
|
@@ -15718,7 +15735,7 @@ function requireHelpers () {
|
|
|
15718
15735
|
if (hasRequiredHelpers) return helpers;
|
|
15719
15736
|
hasRequiredHelpers = 1;
|
|
15720
15737
|
const FormulaError = requireError();
|
|
15721
|
-
const Collection =
|
|
15738
|
+
const Collection = requireCollection();
|
|
15722
15739
|
|
|
15723
15740
|
const Types = {
|
|
15724
15741
|
NUMBER: 0,
|
|
@@ -25372,7 +25389,7 @@ var engineering = EngineeringFunctions;
|
|
|
25372
25389
|
|
|
25373
25390
|
const FormulaError$b = requireError();
|
|
25374
25391
|
const {FormulaHelpers: FormulaHelpers$8, Types: Types$6, WildCard, Address: Address$3} = requireHelpers();
|
|
25375
|
-
const Collection$2 =
|
|
25392
|
+
const Collection$2 = requireCollection();
|
|
25376
25393
|
const H$5 = FormulaHelpers$8;
|
|
25377
25394
|
|
|
25378
25395
|
const ReferenceFunctions$1 = {
|
|
@@ -37000,7 +37017,7 @@ var parsing = {
|
|
|
37000
37017
|
const FormulaError$4 = requireError();
|
|
37001
37018
|
const {Address: Address$1} = requireHelpers();
|
|
37002
37019
|
const {Prefix: Prefix$1, Postfix: Postfix$1, Infix: Infix$1, Operators: Operators$1} = operators;
|
|
37003
|
-
const Collection$1 =
|
|
37020
|
+
const Collection$1 = requireCollection();
|
|
37004
37021
|
const MAX_ROW$1 = 1048576, MAX_COLUMN$1 = 16384;
|
|
37005
37022
|
const {NotAllInputParsedException} = require$$4;
|
|
37006
37023
|
|
|
@@ -37762,7 +37779,7 @@ var hooks$1 = {
|
|
|
37762
37779
|
const FormulaError$2 = requireError();
|
|
37763
37780
|
const {FormulaHelpers: FormulaHelpers$1, Types, Address} = requireHelpers();
|
|
37764
37781
|
const {Prefix, Postfix, Infix, Operators} = operators;
|
|
37765
|
-
const Collection =
|
|
37782
|
+
const Collection = requireCollection();
|
|
37766
37783
|
const MAX_ROW = 1048576, MAX_COLUMN = 16384;
|
|
37767
37784
|
|
|
37768
37785
|
let Utils$1 = class Utils {
|