kyd-shared-badge 0.3.23 → 0.3.24
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/package.json
CHANGED
|
@@ -317,7 +317,7 @@ const SharedBadgeDisplay = ({ badgeData, chatProps, headless }: { badgeData: Pub
|
|
|
317
317
|
<div className="pt-8 border-t kyd-avoid-break" style={{ borderColor: 'var(--icon-button-secondary)'}}>
|
|
318
318
|
<h3 className={'text-xl font-bold mb-3 kyd-keep-with-next'} style={{ color: 'var(--text-main)' }}>KYD Technical - Skills Insights</h3>
|
|
319
319
|
<div className={'prose prose-sm max-w-none mb-6 space-y-4'} style={{ color: 'var(--text-secondary)' }}>
|
|
320
|
-
<Skills skillsMatrix={skillsMatrix} skillsCategoryRadar={graphInsights?.skillsCategoryRadar} />
|
|
320
|
+
<Skills skillsMatrix={skillsMatrix} skillsCategoryRadar={graphInsights?.skillsCategoryRadar} headless={isHeadless} />
|
|
321
321
|
</div>
|
|
322
322
|
</div>
|
|
323
323
|
</Reveal>
|
|
@@ -515,6 +515,7 @@ const SharedBadgeDisplay = ({ badgeData, chatProps, headless }: { badgeData: Pub
|
|
|
515
515
|
searchedAt={updatedAt}
|
|
516
516
|
developerName={developerName || 'this developer'}
|
|
517
517
|
genreMapping={genreMapping as Record<string, string[]>}
|
|
518
|
+
headless={isHeadless}
|
|
518
519
|
/>
|
|
519
520
|
</div>
|
|
520
521
|
</Reveal>
|
|
@@ -542,6 +543,7 @@ const SharedBadgeDisplay = ({ badgeData, chatProps, headless }: { badgeData: Pub
|
|
|
542
543
|
sources={useDetailed ? detailed : dedup}
|
|
543
544
|
searchedAt={updatedAt}
|
|
544
545
|
developerName={developerName || 'this developer'}
|
|
546
|
+
headless={isHeadless}
|
|
545
547
|
/>
|
|
546
548
|
);
|
|
547
549
|
})()}
|
|
@@ -39,6 +39,7 @@ interface AppendixTableProps {
|
|
|
39
39
|
developerName: string;
|
|
40
40
|
// Used for business_rules: map genres (e.g., Technical/Risk) to category arrays
|
|
41
41
|
genreMapping?: Record<string, string[]>;
|
|
42
|
+
headless?: boolean;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
const SanctionsRow = ({
|
|
@@ -48,6 +49,7 @@ const SanctionsRow = ({
|
|
|
48
49
|
onToggle,
|
|
49
50
|
expanded,
|
|
50
51
|
colSpan,
|
|
52
|
+
headless,
|
|
51
53
|
}: {
|
|
52
54
|
source: SanctionSource;
|
|
53
55
|
searchedAt: string;
|
|
@@ -55,13 +57,14 @@ const SanctionsRow = ({
|
|
|
55
57
|
onToggle: () => void;
|
|
56
58
|
expanded: boolean;
|
|
57
59
|
colSpan: number;
|
|
60
|
+
headless?: boolean;
|
|
58
61
|
}) => (
|
|
59
62
|
<>
|
|
60
63
|
<tr className={'transition-colors'} style={source.matched ? { backgroundColor: 'rgba(236,102,98,0.08)' } : undefined}>
|
|
61
64
|
<td className={'px-4 py-4 whitespace-nowrap align-top text-sm font-medium'} style={{ color: 'var(--text-main)' }}>
|
|
62
65
|
<div className="flex flex-col gap-1">
|
|
63
66
|
<span>{source.issuingEntity}</span>
|
|
64
|
-
{source.sublists && source.sublists.length > 0 && (
|
|
67
|
+
{source.sublists && source.sublists.length > 0 && !headless && (
|
|
65
68
|
<button
|
|
66
69
|
type="button"
|
|
67
70
|
onClick={onToggle}
|
|
@@ -94,7 +97,7 @@ const SanctionsRow = ({
|
|
|
94
97
|
: (<span>No exact match for <strong style={{ color: 'var(--text-main)' }}>{developerName}</strong> was found on this list.</span>)}
|
|
95
98
|
</td>
|
|
96
99
|
</tr>
|
|
97
|
-
{expanded && source.sublists && source.sublists.length > 0 && (
|
|
100
|
+
{(headless || expanded) && source.sublists && source.sublists.length > 0 && (
|
|
98
101
|
<tr>
|
|
99
102
|
<td colSpan={colSpan} className={'px-6 pb-4'}>
|
|
100
103
|
<div className={'mt-1 border-t pt-3'} style={{ borderColor: 'var(--icon-button-secondary)' }}>
|
|
@@ -128,7 +131,7 @@ const DomainRow = ({ source, searchedAt, developerName }: { source: DomainSource
|
|
|
128
131
|
);
|
|
129
132
|
|
|
130
133
|
|
|
131
|
-
const AppendixTables: React.FC<AppendixTableProps> = ({ type, sources, searchedAt, developerName, genreMapping }) => {
|
|
134
|
+
const AppendixTables: React.FC<AppendixTableProps> = ({ type, sources, searchedAt, developerName, genreMapping, headless }) => {
|
|
132
135
|
const [visibleCount, setVisibleCount] = useState(PAGE_SIZE);
|
|
133
136
|
const [expanded, setExpanded] = useState<{ [k: number]: boolean }>({});
|
|
134
137
|
|
|
@@ -227,7 +230,7 @@ const AppendixTables: React.FC<AppendixTableProps> = ({ type, sources, searchedA
|
|
|
227
230
|
|
|
228
231
|
const visibleParsedSources = (type === 'business_rules')
|
|
229
232
|
? sortedParsedSources
|
|
230
|
-
: sortedParsedSources.slice(0, visibleCount);
|
|
233
|
+
: (headless ? sortedParsedSources : sortedParsedSources.slice(0, visibleCount));
|
|
231
234
|
|
|
232
235
|
const handleLoadMore = () => {
|
|
233
236
|
setVisibleCount(currentCount => currentCount + PAGE_SIZE);
|
|
@@ -238,8 +241,8 @@ const AppendixTables: React.FC<AppendixTableProps> = ({ type, sources, searchedA
|
|
|
238
241
|
}
|
|
239
242
|
|
|
240
243
|
return (
|
|
241
|
-
<div>
|
|
242
|
-
<div className={'overflow-x-auto rounded-lg border'} style={{ borderColor: 'var(--icon-button-secondary)', backgroundColor: 'var(--content-card-background)' }}>
|
|
244
|
+
<div className={'kyd-avoid-break'}>
|
|
245
|
+
<div className={'overflow-x-auto rounded-lg border kyd-avoid-break'} style={{ borderColor: 'var(--icon-button-secondary)', backgroundColor: 'var(--content-card-background)', breakInside: 'avoid', pageBreakInside: 'avoid' as unknown as undefined }}>
|
|
243
246
|
<table className={'min-w-full'}>
|
|
244
247
|
<colgroup>
|
|
245
248
|
{headers.map((_, idx) => (
|
|
@@ -268,6 +271,7 @@ const AppendixTables: React.FC<AppendixTableProps> = ({ type, sources, searchedA
|
|
|
268
271
|
onToggle={() => setExpanded(prev => ({ ...prev, [index]: !prev[index] }))}
|
|
269
272
|
expanded={!!expanded[index]}
|
|
270
273
|
colSpan={headers.length}
|
|
274
|
+
headless={headless}
|
|
271
275
|
/>
|
|
272
276
|
);
|
|
273
277
|
}
|
|
@@ -311,7 +315,7 @@ const AppendixTables: React.FC<AppendixTableProps> = ({ type, sources, searchedA
|
|
|
311
315
|
</tbody>
|
|
312
316
|
</table>
|
|
313
317
|
</div>
|
|
314
|
-
{type !== 'business_rules' && parsedSources.length > PAGE_SIZE && (
|
|
318
|
+
{type !== 'business_rules' && parsedSources.length > PAGE_SIZE && !headless && (
|
|
315
319
|
<div className={'mt-4 flex items-center justify-between text-sm'} style={{ color: 'var(--text-secondary)' }}>
|
|
316
320
|
<p>
|
|
317
321
|
Showing {Math.min(visibleCount, parsedSources.length)} of {parsedSources.length} entries
|
|
@@ -166,7 +166,7 @@ const TooltipBox = ({ state }: { state: HoverTooltipState }) => {
|
|
|
166
166
|
);
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
-
const Skills = ({ skillsCategoryRadar }: { skillsMatrix?: SkillsMatrix; skillsCategoryRadar?: SkillsRadarPoint[] }) => {
|
|
169
|
+
const Skills = ({ skillsCategoryRadar, headless }: { skillsMatrix?: SkillsMatrix; skillsCategoryRadar?: SkillsRadarPoint[]; headless?: boolean }) => {
|
|
170
170
|
// const hasMatrix = !!(skillsMatrix && Array.isArray(skillsMatrix.skills) && skillsMatrix.skills.length > 0);
|
|
171
171
|
const hasRadar = !!(skillsCategoryRadar && skillsCategoryRadar.length > 0);
|
|
172
172
|
|
|
@@ -180,6 +180,16 @@ const Skills = ({ skillsCategoryRadar }: { skillsMatrix?: SkillsMatrix; skillsCa
|
|
|
180
180
|
const [footprintLegendTooltip, setFootprintLegendTooltip] = useState<HoverTooltipState>(null);
|
|
181
181
|
const [barLegendTooltip, setBarLegendTooltip] = useState<HoverTooltipState>(null);
|
|
182
182
|
|
|
183
|
+
const disableAnimations = useMemo(() => {
|
|
184
|
+
if (headless) return true;
|
|
185
|
+
if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
|
|
186
|
+
try {
|
|
187
|
+
return window.matchMedia('print').matches;
|
|
188
|
+
} catch {}
|
|
189
|
+
}
|
|
190
|
+
return false;
|
|
191
|
+
}, [headless]);
|
|
192
|
+
|
|
183
193
|
useEffect(() => {
|
|
184
194
|
const measure = () => setContainerWidth(containerRef.current?.clientWidth || 0);
|
|
185
195
|
measure();
|
|
@@ -187,6 +197,16 @@ const Skills = ({ skillsCategoryRadar }: { skillsMatrix?: SkillsMatrix; skillsCa
|
|
|
187
197
|
return () => window.removeEventListener('resize', measure);
|
|
188
198
|
}, []);
|
|
189
199
|
|
|
200
|
+
// Nudge layout for headless/print contexts so responsive containers measure correctly
|
|
201
|
+
useEffect(() => {
|
|
202
|
+
if (typeof window !== 'undefined') {
|
|
203
|
+
const id = window.setTimeout(() => {
|
|
204
|
+
try { window.dispatchEvent(new Event('resize')); } catch {}
|
|
205
|
+
}, 0);
|
|
206
|
+
return () => window.clearTimeout(id);
|
|
207
|
+
}
|
|
208
|
+
}, []);
|
|
209
|
+
|
|
190
210
|
const combinedBubbleData: BubbleDatum[] = useMemo(() => {
|
|
191
211
|
return skillsRadarLimited.map((d) => {
|
|
192
212
|
const vals = [Number(d.observed || 0), Number(d.self_reported || 0), Number(d.certified || 0)];
|
|
@@ -210,11 +230,11 @@ const Skills = ({ skillsCategoryRadar }: { skillsMatrix?: SkillsMatrix; skillsCa
|
|
|
210
230
|
|
|
211
231
|
{/* Skills Coverage and Breakdown: two charts side-by-side */}
|
|
212
232
|
{hasRadar && (
|
|
213
|
-
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
214
|
-
<div className={'rounded-lg p-4 border'} style={{ backgroundColor: 'var(--content-card-background)', borderColor: 'var(--icon-button-secondary)' }}>
|
|
233
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 kyd-avoid-break">
|
|
234
|
+
<div className={'rounded-lg p-4 border kyd-avoid-break'} style={{ backgroundColor: 'var(--content-card-background)', borderColor: 'var(--icon-button-secondary)', breakInside: 'avoid', pageBreakInside: 'avoid' as unknown as undefined }}>
|
|
215
235
|
<h4 className={'font-semibold mb-3'} style={{ color: 'var(--text-main)' }}>Skills Footprint</h4>
|
|
216
236
|
<p className={'text-sm mb-4'} style={{ color: 'var(--text-secondary)' }}>The bubble chart visualizes individual skills, where bubble size reflects the weight of supporting evidence and placement indicates relative strength across the skill set.</p>
|
|
217
|
-
<div ref={containerRef} style={{ width: '100%', height: 340, position: 'relative' }}>
|
|
237
|
+
<div ref={containerRef} className={'kyd-avoid-break'} style={{ width: '100%', height: 340, position: 'relative', breakInside: 'avoid', pageBreakInside: 'avoid' as unknown as undefined }}>
|
|
218
238
|
{(() => {
|
|
219
239
|
const width = containerWidth || 600;
|
|
220
240
|
const height = 300;
|
|
@@ -276,12 +296,12 @@ const Skills = ({ skillsCategoryRadar }: { skillsMatrix?: SkillsMatrix; skillsCa
|
|
|
276
296
|
</svg>
|
|
277
297
|
);
|
|
278
298
|
})()}
|
|
279
|
-
<TooltipBox state={footprintChartTooltip} />
|
|
299
|
+
{!headless && <TooltipBox state={footprintChartTooltip} />}
|
|
280
300
|
</div>
|
|
281
301
|
{/* Legend */}
|
|
282
302
|
<div className={'mt-3'}>
|
|
283
303
|
{/* <div className={'text-xs mb-2'} style={{ color: 'var(--text-secondary)' }}>Legend</div> */}
|
|
284
|
-
<div ref={footprintLegendRef} style={{ position: 'relative' }}>
|
|
304
|
+
<div ref={footprintLegendRef} className={'kyd-avoid-break'} style={{ position: 'relative', breakInside: 'avoid', pageBreakInside: 'avoid' as unknown as undefined }}>
|
|
285
305
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-1">
|
|
286
306
|
{legendData.map((item, idx) => (
|
|
287
307
|
<div
|
|
@@ -314,11 +334,11 @@ const Skills = ({ skillsCategoryRadar }: { skillsMatrix?: SkillsMatrix; skillsCa
|
|
|
314
334
|
</div>
|
|
315
335
|
))}
|
|
316
336
|
</div>
|
|
317
|
-
<TooltipBox state={footprintLegendTooltip} />
|
|
337
|
+
{!headless && <TooltipBox state={footprintLegendTooltip} />}
|
|
318
338
|
</div>
|
|
319
339
|
</div>
|
|
320
340
|
</div>
|
|
321
|
-
<div className={'rounded-lg p-4 border'} style={{ backgroundColor: 'var(--content-card-background)', borderColor: 'var(--icon-button-secondary)' }}>
|
|
341
|
+
<div className={'rounded-lg p-4 border kyd-avoid-break'} style={{ backgroundColor: 'var(--content-card-background)', borderColor: 'var(--icon-button-secondary)', breakInside: 'avoid', pageBreakInside: 'avoid' as unknown as undefined }}>
|
|
322
342
|
<h4 className={'font-semibold mb-3'} style={{ color: 'var(--text-main)' }}>Skills by Validation Type</h4>
|
|
323
343
|
<p className={'text-sm mb-4'} style={{ color: 'var(--text-secondary)' }}>The bar chart shows how each skill is supported by self-attested claims, observed practice, or certified evidence.</p>
|
|
324
344
|
<div className="space-y-6 flex-col items-center" >
|
|
@@ -330,9 +350,9 @@ const Skills = ({ skillsCategoryRadar }: { skillsMatrix?: SkillsMatrix; skillsCa
|
|
|
330
350
|
<XAxis dataKey="axis" tick={{ fill: 'var(--text-secondary)', fontSize: 12 }} interval={0} angle={-20} textAnchor="end" height={50} />
|
|
331
351
|
<YAxis domain={[0, 100]} tick={{ fill: 'var(--text-secondary)' }} />
|
|
332
352
|
<Tooltip contentStyle={{ background: 'var(--content-card-background)', border: `1px solid var(--icon-button-secondary)`, color: 'var(--text-main)' }} />
|
|
333
|
-
<Bar dataKey="observed" name="Observed" fill={'var(--bar-observed)'} />
|
|
334
|
-
<Bar dataKey="self_reported" name="Self-reported" fill={'var(--bar-self-reported)'} />
|
|
335
|
-
<Bar dataKey="certified" name="Certified" fill={'var(--bar-certified)'} />
|
|
353
|
+
<Bar dataKey="observed" name="Observed" fill={'var(--bar-observed)'} isAnimationActive={!disableAnimations} />
|
|
354
|
+
<Bar dataKey="self_reported" name="Self-reported" fill={'var(--bar-self-reported)'} isAnimationActive={!disableAnimations} />
|
|
355
|
+
<Bar dataKey="certified" name="Certified" fill={'var(--bar-certified)'} isAnimationActive={!disableAnimations} />
|
|
336
356
|
</BarChart>
|
|
337
357
|
</ResponsiveContainer>
|
|
338
358
|
</div>
|
|
@@ -409,7 +429,7 @@ const Skills = ({ skillsCategoryRadar }: { skillsMatrix?: SkillsMatrix; skillsCa
|
|
|
409
429
|
<span>Certified</span>
|
|
410
430
|
</div>
|
|
411
431
|
</div>
|
|
412
|
-
<TooltipBox state={barLegendTooltip} />
|
|
432
|
+
{!headless && <TooltipBox state={barLegendTooltip} />}
|
|
413
433
|
</div>
|
|
414
434
|
</div>
|
|
415
435
|
</div>
|