"""
Shared UI utilities for the Palladium Streamlit app.
Kept in a separate module so that ``app.main`` and ``app.views.*`` can both
import from here without creating a circular dependency.
"""
from __future__ import annotations
import streamlit as st
# ---------------------------------------------------------------------------
# Bootstrap Icons — injected once at the top of every page render.
# Using the CDN stylesheet so no npm/build step is needed.
# ---------------------------------------------------------------------------
_BI_CSS = """
"""
def inject_icons() -> None:
"""Inject Bootstrap Icons CSS (idempotent — Streamlit deduplicates identical HTML)."""
st.markdown(_BI_CSS, unsafe_allow_html=True)
def icon(name: str, *, cls: str = "") -> str:
"""Return an inline Bootstrap Icon ```` tag.
Usage::
st.markdown(icon("bar-chart") + " Financial Summary", unsafe_allow_html=True)
See the full icon catalogue at https://icons.getbootstrap.com/
"""
extra = f" {cls}" if cls else ""
return f''