@the-syllabus/analysis-renderers 0.2.0 → 0.4.0
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/dispatch/SubRendererDispatch.js +1 -1
- package/dist/dispatch/SubRendererDispatch.js.map +1 -1
- package/dist/sub-renderers/SubRenderers.d.ts +2 -28
- package/dist/sub-renderers/SubRenderers.d.ts.map +1 -1
- package/dist/sub-renderers/SubRenderers.js +281 -0
- package/dist/sub-renderers/SubRenderers.js.map +1 -1
- package/package.json +1 -1
- package/src/dispatch/SubRendererDispatch.tsx +1 -1
- package/src/sub-renderers/SubRenderers.tsx +359 -0
|
@@ -19,7 +19,7 @@ import { useDesignTokens } from '../tokens/DesignTokenContext';
|
|
|
19
19
|
export const REQUIRES_ARRAY = new Set([
|
|
20
20
|
'chip_grid', 'mini_card_list', 'timeline_strip',
|
|
21
21
|
'comparison_panel', 'definition_list',
|
|
22
|
-
'intensity_matrix', 'move_repertoire', 'grouped_card_list', 'rich_description_list',
|
|
22
|
+
'intensity_matrix', 'move_repertoire', 'grouped_card_list', 'rich_description_list', 'dependency_matrix',
|
|
23
23
|
]);
|
|
24
24
|
export const REQUIRES_OBJECT = new Set(['stat_row', 'phase_timeline', 'distribution_summary']);
|
|
25
25
|
export function isRendererCompatible(rendererType, data, rendererConfig) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubRendererDispatch.js","sourceRoot":"","sources":["../../src/dispatch/SubRendererDispatch.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;AAEH,OAAc,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE1F,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,2DAA2D;AAC3D,mEAAmE;AACnE,oEAAoE;AACpE,mEAAmE;AAEnE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-21,6 +21,8 @@
|
|
|
21
21
|
* dialectical_pair — Two-panel tension visualization for thesis/antithesis contrasts
|
|
22
22
|
* rich_description_list — Stacked items with colored borders for paragraph-length descriptions
|
|
23
23
|
* phase_timeline — Connected timeline with prominent phase nodes for temporal data
|
|
24
|
+
* annotated_prose — Enhanced prose with paragraph markers, pull-quotes, and rhetorical highlighting
|
|
25
|
+
* dependency_matrix — Adjacency matrix / heatmap for directed chapter dependencies
|
|
24
26
|
* distribution_summary — Visual bar chart with dominant highlight, counts, and optional narrative
|
|
25
27
|
*/
|
|
26
28
|
import React from 'react';
|
|
@@ -41,33 +43,5 @@ export declare function resolveSubRenderer(rendererType: string): React.FC<SubRe
|
|
|
41
43
|
* object with only numeric values → stat_row
|
|
42
44
|
*/
|
|
43
45
|
export declare function autoDetectSubRenderer(data: unknown): string | null;
|
|
44
|
-
/**
|
|
45
|
-
* Visual distribution bar chart with optional dominant pattern highlight
|
|
46
|
-
* and collapsible narrative. Configurable via JSON view definitions.
|
|
47
|
-
*
|
|
48
|
-
* Data shape (object):
|
|
49
|
-
* {
|
|
50
|
-
* distribution: Record<string, number> | Array<{ key: string; count: number; major_count?: number }>
|
|
51
|
-
* dominant?: string
|
|
52
|
-
* narrative?: string
|
|
53
|
-
* }
|
|
54
|
-
*
|
|
55
|
-
* Field mapping config (for data that doesn't use these exact field names):
|
|
56
|
-
* distribution_field?: string -- field name for distribution data (default: "distribution")
|
|
57
|
-
* dominant_field?: string -- field name for dominant item (default: "dominant")
|
|
58
|
-
* narrative_field?: string -- field name for narrative text (default: "narrative")
|
|
59
|
-
*
|
|
60
|
-
* Display config:
|
|
61
|
-
* category?: string -- design token category for colors (e.g., "tactic", "relationship")
|
|
62
|
-
* dominant_label?: string -- label above dominant value (default: "Dominant")
|
|
63
|
-
* count_noun?: string -- noun for total count (default: "items")
|
|
64
|
-
* type_noun?: string -- noun for type count (default: "types")
|
|
65
|
-
* severity_value?: string -- label for severity badges (default: "major")
|
|
66
|
-
*
|
|
67
|
-
* Interactive mode (passed by CardGridRenderer via _ prefix):
|
|
68
|
-
* _onFilterClick?: (key: string) => void -- makes bars clickable
|
|
69
|
-
* _activeFilter?: string | null -- highlights active bar
|
|
70
|
-
* _groups?: Group[] -- live groups (overrides distribution field)
|
|
71
|
-
*/
|
|
72
46
|
export declare function DistributionSummary({ data, config }: SubRendererProps): import("react/jsx-runtime").JSX.Element | null;
|
|
73
47
|
//# sourceMappingURL=SubRenderers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubRenderers.d.ts","sourceRoot":"","sources":["../../src/sub-renderers/SubRenderers.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SubRenderers.d.ts","sourceRoot":"","sources":["../../src/sub-renderers/SubRenderers.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAKjD,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AA4BjD,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAE1F;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CA0ClE;AAi/GD,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,gBAAgB,kDAuJrE"}
|
|
@@ -22,6 +22,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
22
22
|
* dialectical_pair — Two-panel tension visualization for thesis/antithesis contrasts
|
|
23
23
|
* rich_description_list — Stacked items with colored borders for paragraph-length descriptions
|
|
24
24
|
* phase_timeline — Connected timeline with prominent phase nodes for temporal data
|
|
25
|
+
* annotated_prose — Enhanced prose with paragraph markers, pull-quotes, and rhetorical highlighting
|
|
26
|
+
* dependency_matrix — Adjacency matrix / heatmap for directed chapter dependencies
|
|
25
27
|
* distribution_summary — Visual bar chart with dominant highlight, counts, and optional narrative
|
|
26
28
|
*/
|
|
27
29
|
import React, { useState } from 'react';
|
|
@@ -49,6 +51,8 @@ const SUB_RENDERER_MAP = {
|
|
|
49
51
|
dialectical_pair: DialecticalPair,
|
|
50
52
|
rich_description_list: RichDescriptionList,
|
|
51
53
|
phase_timeline: PhaseTimeline,
|
|
54
|
+
dependency_matrix: DependencyMatrix,
|
|
55
|
+
annotated_prose: AnnotatedProse,
|
|
52
56
|
distribution_summary: DistributionSummary,
|
|
53
57
|
};
|
|
54
58
|
export function resolveSubRenderer(rendererType) {
|
|
@@ -2384,6 +2388,283 @@ function PhaseTimeline({ data, config }) {
|
|
|
2384
2388
|
* _activeFilter?: string | null -- highlights active bar
|
|
2385
2389
|
* _groups?: Group[] -- live groups (overrides distribution field)
|
|
2386
2390
|
*/
|
|
2391
|
+
// ── annotated_prose ───────────────────────────────────────────
|
|
2392
|
+
// Enhanced prose rendering with paragraph detection, pull-quote extraction,
|
|
2393
|
+
// and subtle numbered markers. Upgrades prose_block for longer analytical text.
|
|
2394
|
+
//
|
|
2395
|
+
// Config:
|
|
2396
|
+
// pull_quote_min_length — minimum sentence length to be considered a pull-quote (default 80)
|
|
2397
|
+
// show_paragraph_numbers — show subtle paragraph numbers (default true)
|
|
2398
|
+
// highlight_markers — rhetorical markers to highlight (default: common analytical terms)
|
|
2399
|
+
const DEFAULT_MARKERS = [
|
|
2400
|
+
'crucial', 'fundamentally', 'the key claim', 'central to', 'decisive',
|
|
2401
|
+
'turning point', 'paradox', 'contradiction', 'however', 'nevertheless',
|
|
2402
|
+
'most importantly', 'significantly', 'critically', 'the core',
|
|
2403
|
+
];
|
|
2404
|
+
function AnnotatedProse({ data, config }) {
|
|
2405
|
+
const { tokens } = useDesignTokens();
|
|
2406
|
+
const text = typeof data === 'string'
|
|
2407
|
+
? data
|
|
2408
|
+
: typeof data === 'object' && data !== null
|
|
2409
|
+
? data._prose_output
|
|
2410
|
+
|| data.text
|
|
2411
|
+
|| data.content
|
|
2412
|
+
|| data.prose
|
|
2413
|
+
|| ''
|
|
2414
|
+
: '';
|
|
2415
|
+
if (!text)
|
|
2416
|
+
return null;
|
|
2417
|
+
const pullQuoteMinLen = config.pull_quote_min_length || 80;
|
|
2418
|
+
const showParaNums = config.show_paragraph_numbers !== false;
|
|
2419
|
+
const markers = config.highlight_markers || DEFAULT_MARKERS;
|
|
2420
|
+
// Split into paragraphs
|
|
2421
|
+
const paragraphs = text.split(/\n\n+/).map(p => p.trim()).filter(Boolean);
|
|
2422
|
+
// Find the best pull-quote: longest sentence across all paragraphs that contains a marker
|
|
2423
|
+
let bestQuote = '';
|
|
2424
|
+
let bestQuoteParaIdx = -1;
|
|
2425
|
+
for (let pi = 0; pi < paragraphs.length; pi++) {
|
|
2426
|
+
const sentences = paragraphs[pi].split(/(?<=[.!?])\s+/);
|
|
2427
|
+
for (const sent of sentences) {
|
|
2428
|
+
if (sent.length >= pullQuoteMinLen && sent.length > bestQuote.length) {
|
|
2429
|
+
const lower = sent.toLowerCase();
|
|
2430
|
+
if (markers.some(m => lower.includes(m))) {
|
|
2431
|
+
bestQuote = sent;
|
|
2432
|
+
bestQuoteParaIdx = pi;
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
// Fallback: just pick longest sentence if no marker match
|
|
2438
|
+
if (!bestQuote) {
|
|
2439
|
+
for (let pi = 0; pi < paragraphs.length; pi++) {
|
|
2440
|
+
const sentences = paragraphs[pi].split(/(?<=[.!?])\s+/);
|
|
2441
|
+
for (const sent of sentences) {
|
|
2442
|
+
if (sent.length >= pullQuoteMinLen && sent.length > bestQuote.length) {
|
|
2443
|
+
bestQuote = sent;
|
|
2444
|
+
bestQuoteParaIdx = pi;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
const accentColor = tokens.primitives.series_palette[0] || '#6366f1';
|
|
2450
|
+
// Highlight markers in text
|
|
2451
|
+
const highlightText = (text) => {
|
|
2452
|
+
if (markers.length === 0)
|
|
2453
|
+
return [text];
|
|
2454
|
+
const pattern = new RegExp(`(${markers.map(m => m.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')})`, 'gi');
|
|
2455
|
+
const parts = text.split(pattern);
|
|
2456
|
+
return parts.map((part, i) => {
|
|
2457
|
+
if (pattern.test(part)) {
|
|
2458
|
+
return React.createElement('span', {
|
|
2459
|
+
key: i,
|
|
2460
|
+
style: {
|
|
2461
|
+
fontWeight: 600,
|
|
2462
|
+
color: accentColor,
|
|
2463
|
+
},
|
|
2464
|
+
}, part);
|
|
2465
|
+
}
|
|
2466
|
+
return part;
|
|
2467
|
+
});
|
|
2468
|
+
};
|
|
2469
|
+
return (_jsx("div", { style: {
|
|
2470
|
+
fontFamily: 'var(--font-serif, Georgia, serif)',
|
|
2471
|
+
lineHeight: 1.75,
|
|
2472
|
+
color: 'var(--dt-ink-primary, #1a1a2e)',
|
|
2473
|
+
}, children: paragraphs.map((para, idx) => {
|
|
2474
|
+
const isQuotePara = idx === bestQuoteParaIdx;
|
|
2475
|
+
return React.createElement(React.Fragment, { key: idx },
|
|
2476
|
+
// Pull-quote callout (inserted after the paragraph it was extracted from)
|
|
2477
|
+
showParaNums ? React.createElement('div', {
|
|
2478
|
+
style: {
|
|
2479
|
+
display: 'flex',
|
|
2480
|
+
gap: '12px',
|
|
2481
|
+
marginBottom: idx === paragraphs.length - 1 ? 0 : '1.1em',
|
|
2482
|
+
},
|
|
2483
|
+
},
|
|
2484
|
+
// Paragraph number
|
|
2485
|
+
React.createElement('span', {
|
|
2486
|
+
style: {
|
|
2487
|
+
fontSize: '0.7rem',
|
|
2488
|
+
fontFamily: 'var(--font-mono, monospace)',
|
|
2489
|
+
color: 'var(--dt-ink-tertiary, #9ca3af)',
|
|
2490
|
+
minWidth: '18px',
|
|
2491
|
+
textAlign: 'right',
|
|
2492
|
+
paddingTop: '3px',
|
|
2493
|
+
userSelect: 'none',
|
|
2494
|
+
},
|
|
2495
|
+
}, `${idx + 1}`),
|
|
2496
|
+
// Paragraph text
|
|
2497
|
+
React.createElement('p', {
|
|
2498
|
+
style: {
|
|
2499
|
+
margin: 0,
|
|
2500
|
+
fontSize: '0.92rem',
|
|
2501
|
+
},
|
|
2502
|
+
}, ...highlightText(para))) : React.createElement('p', {
|
|
2503
|
+
style: {
|
|
2504
|
+
margin: 0,
|
|
2505
|
+
marginBottom: idx === paragraphs.length - 1 ? 0 : '1.1em',
|
|
2506
|
+
fontSize: '0.92rem',
|
|
2507
|
+
},
|
|
2508
|
+
}, ...highlightText(para)),
|
|
2509
|
+
// Pull-quote callout after the source paragraph
|
|
2510
|
+
isQuotePara && bestQuote ? React.createElement('blockquote', {
|
|
2511
|
+
key: `quote-${idx}`,
|
|
2512
|
+
style: {
|
|
2513
|
+
margin: '1em 0 1.2em 0',
|
|
2514
|
+
padding: '12px 16px',
|
|
2515
|
+
borderLeft: `3px solid ${accentColor}`,
|
|
2516
|
+
background: 'var(--dt-surface-card, #f8f6f3)',
|
|
2517
|
+
borderRadius: '0 var(--radius-sm, 4px) var(--radius-sm, 4px) 0',
|
|
2518
|
+
fontStyle: 'italic',
|
|
2519
|
+
fontSize: '0.88rem',
|
|
2520
|
+
lineHeight: 1.65,
|
|
2521
|
+
color: 'var(--dt-ink-secondary, #374151)',
|
|
2522
|
+
},
|
|
2523
|
+
}, `"${bestQuote}"`) : null);
|
|
2524
|
+
}) }));
|
|
2525
|
+
}
|
|
2526
|
+
// ── dependency_matrix ─────────────────────────────────────────
|
|
2527
|
+
// Adjacency matrix / heatmap for directed relationships.
|
|
2528
|
+
// Data: array of {source, target, type} objects.
|
|
2529
|
+
// Config:
|
|
2530
|
+
// source_field — field name for row source (default "chapter")
|
|
2531
|
+
// target_field — field name for column target (default "depends_on")
|
|
2532
|
+
// type_field — field name for relationship type (default "dependency_type")
|
|
2533
|
+
// abbreviate_labels — shorten labels (default true)
|
|
2534
|
+
function DependencyMatrix({ data, config }) {
|
|
2535
|
+
const [hoveredCell, setHoveredCell] = React.useState(null);
|
|
2536
|
+
const { tokens } = useDesignTokens();
|
|
2537
|
+
if (!data || !Array.isArray(data) || data.length === 0)
|
|
2538
|
+
return null;
|
|
2539
|
+
const sourceField = config.source_field || 'chapter';
|
|
2540
|
+
const targetField = config.target_field || 'depends_on';
|
|
2541
|
+
const typeField = config.type_field || 'dependency_type';
|
|
2542
|
+
const abbreviate = config.abbreviate_labels !== false;
|
|
2543
|
+
const palette = tokens.primitives.series_palette;
|
|
2544
|
+
// Extract unique labels (preserving order of first appearance)
|
|
2545
|
+
const labelSet = new Set();
|
|
2546
|
+
for (const item of data) {
|
|
2547
|
+
const obj = item;
|
|
2548
|
+
const src = String(obj[sourceField] || '');
|
|
2549
|
+
const tgt = String(obj[targetField] || '');
|
|
2550
|
+
if (src)
|
|
2551
|
+
labelSet.add(src);
|
|
2552
|
+
if (tgt)
|
|
2553
|
+
labelSet.add(tgt);
|
|
2554
|
+
}
|
|
2555
|
+
const labels = Array.from(labelSet);
|
|
2556
|
+
// Extract unique types for legend
|
|
2557
|
+
const typeSet = new Set();
|
|
2558
|
+
for (const item of data) {
|
|
2559
|
+
const obj = item;
|
|
2560
|
+
const t = String(obj[typeField] || '');
|
|
2561
|
+
if (t)
|
|
2562
|
+
typeSet.add(t);
|
|
2563
|
+
}
|
|
2564
|
+
const types = Array.from(typeSet);
|
|
2565
|
+
const typeColorMap = {};
|
|
2566
|
+
types.forEach((t, i) => { typeColorMap[t] = palette[i % palette.length]; });
|
|
2567
|
+
// Build adjacency map: [rowIdx][colIdx] = type
|
|
2568
|
+
const adjacency = {};
|
|
2569
|
+
for (const item of data) {
|
|
2570
|
+
const obj = item;
|
|
2571
|
+
const src = String(obj[sourceField] || '');
|
|
2572
|
+
const tgt = String(obj[targetField] || '');
|
|
2573
|
+
const typ = String(obj[typeField] || '');
|
|
2574
|
+
if (src && tgt) {
|
|
2575
|
+
if (!adjacency[src])
|
|
2576
|
+
adjacency[src] = {};
|
|
2577
|
+
adjacency[src][tgt] = typ;
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
// Abbreviation helper
|
|
2581
|
+
const abbrev = (label) => {
|
|
2582
|
+
if (!abbreviate)
|
|
2583
|
+
return label;
|
|
2584
|
+
// "Chapter 1" → "Ch1", "Appendix 1" → "App1", or first 4 chars
|
|
2585
|
+
return label
|
|
2586
|
+
.replace(/^Chapter\s*/i, 'Ch')
|
|
2587
|
+
.replace(/^Appendix\s*/i, 'App')
|
|
2588
|
+
.replace(/^Part\s*/i, 'P')
|
|
2589
|
+
.slice(0, 6);
|
|
2590
|
+
};
|
|
2591
|
+
const cellSize = 32;
|
|
2592
|
+
const labelWidth = 80;
|
|
2593
|
+
const hovered = hoveredCell ? {
|
|
2594
|
+
src: labels[hoveredCell.row],
|
|
2595
|
+
tgt: labels[hoveredCell.col],
|
|
2596
|
+
type: adjacency[labels[hoveredCell.row]]?.[labels[hoveredCell.col]],
|
|
2597
|
+
} : null;
|
|
2598
|
+
return (_jsxs("div", { style: { overflowX: 'auto' }, children: [hovered?.type && (_jsxs("div", { style: {
|
|
2599
|
+
padding: '6px 10px',
|
|
2600
|
+
marginBottom: '8px',
|
|
2601
|
+
fontSize: '0.82rem',
|
|
2602
|
+
background: 'var(--dt-surface-card, #f8f6f3)',
|
|
2603
|
+
border: '1px solid var(--color-border, #e2e5e9)',
|
|
2604
|
+
borderRadius: 'var(--radius-sm, 4px)',
|
|
2605
|
+
color: 'var(--dt-ink-primary, #1a1a2e)',
|
|
2606
|
+
}, children: [_jsx("strong", { children: hovered.src }), " \u2192 ", _jsx("strong", { children: hovered.tgt }), ": ", hovered.type.replace(/_/g, ' ')] })), _jsxs("table", { style: {
|
|
2607
|
+
borderCollapse: 'collapse',
|
|
2608
|
+
fontSize: '0.75rem',
|
|
2609
|
+
fontFamily: 'var(--font-mono, monospace)',
|
|
2610
|
+
}, children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { style: { width: labelWidth, minWidth: labelWidth } }), labels.map((label, ci) => (_jsx("th", { style: {
|
|
2611
|
+
width: cellSize,
|
|
2612
|
+
minWidth: cellSize,
|
|
2613
|
+
textAlign: 'center',
|
|
2614
|
+
padding: '2px',
|
|
2615
|
+
fontWeight: 500,
|
|
2616
|
+
color: 'var(--dt-ink-secondary, #6b7280)',
|
|
2617
|
+
writingMode: labels.length > 6 ? 'vertical-rl' : undefined,
|
|
2618
|
+
transform: labels.length > 6 ? 'rotate(180deg)' : undefined,
|
|
2619
|
+
height: labels.length > 6 ? 60 : undefined,
|
|
2620
|
+
}, children: abbrev(label) }, ci)))] }) }), _jsx("tbody", { children: labels.map((rowLabel, ri) => (_jsxs("tr", { children: [_jsx("td", { style: {
|
|
2621
|
+
padding: '2px 6px',
|
|
2622
|
+
textAlign: 'right',
|
|
2623
|
+
fontWeight: 500,
|
|
2624
|
+
color: 'var(--dt-ink-secondary, #6b7280)',
|
|
2625
|
+
whiteSpace: 'nowrap',
|
|
2626
|
+
}, children: abbrev(rowLabel) }), labels.map((colLabel, ci) => {
|
|
2627
|
+
const cellType = adjacency[rowLabel]?.[colLabel];
|
|
2628
|
+
const isDiagonal = ri === ci;
|
|
2629
|
+
const isHovered = hoveredCell?.row === ri && hoveredCell?.col === ci;
|
|
2630
|
+
return (_jsx("td", { onMouseEnter: () => setHoveredCell({ row: ri, col: ci }), onMouseLeave: () => setHoveredCell(null), style: {
|
|
2631
|
+
width: cellSize,
|
|
2632
|
+
height: cellSize,
|
|
2633
|
+
textAlign: 'center',
|
|
2634
|
+
border: '1px solid var(--color-border-light, #eef0f2)',
|
|
2635
|
+
background: isDiagonal
|
|
2636
|
+
? 'var(--dt-surface-bg, #f0ede6)'
|
|
2637
|
+
: cellType
|
|
2638
|
+
? typeColorMap[cellType]
|
|
2639
|
+
: 'transparent',
|
|
2640
|
+
opacity: cellType ? (isHovered ? 1 : 0.75) : 1,
|
|
2641
|
+
cursor: cellType ? 'pointer' : 'default',
|
|
2642
|
+
transition: 'opacity 0.15s',
|
|
2643
|
+
borderRadius: isHovered ? '2px' : undefined,
|
|
2644
|
+
boxShadow: isHovered && cellType ? '0 0 0 2px var(--dt-ink-primary, #1a1a2e)' : undefined,
|
|
2645
|
+
}, children: cellType && (_jsx("span", { style: {
|
|
2646
|
+
display: 'inline-block',
|
|
2647
|
+
width: 10,
|
|
2648
|
+
height: 10,
|
|
2649
|
+
borderRadius: 2,
|
|
2650
|
+
background: '#fff',
|
|
2651
|
+
opacity: 0.6,
|
|
2652
|
+
} })) }, ci));
|
|
2653
|
+
})] }, ri))) })] }), _jsx("div", { style: {
|
|
2654
|
+
display: 'flex',
|
|
2655
|
+
gap: '12px',
|
|
2656
|
+
marginTop: '10px',
|
|
2657
|
+
flexWrap: 'wrap',
|
|
2658
|
+
fontSize: '0.78rem',
|
|
2659
|
+
color: 'var(--dt-ink-secondary, #6b7280)',
|
|
2660
|
+
}, children: types.map((type, i) => (_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '4px' }, children: [_jsx("span", { style: {
|
|
2661
|
+
display: 'inline-block',
|
|
2662
|
+
width: 12,
|
|
2663
|
+
height: 12,
|
|
2664
|
+
borderRadius: 2,
|
|
2665
|
+
background: typeColorMap[type],
|
|
2666
|
+
} }), type.replace(/_/g, ' ')] }, type))) })] }));
|
|
2667
|
+
}
|
|
2387
2668
|
export function DistributionSummary({ data, config }) {
|
|
2388
2669
|
const { getCategoryColor, getLabel } = useDesignTokens();
|
|
2389
2670
|
const [narrativeExpanded, setNarrativeExpanded] = useState(false);
|