"""Reusable UI components: KPI cards, role chips, insight row, section headers.""" import streamlit as st from .template import ( PITCH_GREEN, GOLD, RED, SKY, VIOLET, WHITE, TEXT_SECONDARY, CARD_BG, BORDER, ROLE_COLORS, ROLE_ICONS, ) CSS_CLASS = """ """ def inject_css(): st.markdown(CSS_CLASS, unsafe_allow_html=True) def kpi_card(label: str, value: str, sub: str = "", color: str = WHITE, delta: float | None = None): delta_html = "" if delta is not None: d_color = PITCH_GREEN if delta >= 0 else RED d_sign = "+" if delta > 0 else "" delta_html = f'{d_sign}{delta:+.1f}' return f"""
{title}
', unsafe_allow_html=True) if caption: st.markdown(f'{caption}
', unsafe_allow_html=True) def insight(text: str): st.markdown(f'{text}
', unsafe_allow_html=True)