{# @description A figure with a bar showing how far it has come towards a target or a limit. Goes in a daisyUI stats row, beside plain stats or on its own. #}
{# @prop title:text | description:"What the figure counts. It also names the bar for a screen reader, and desc does when there is no title." #}
{# @prop value:text | description:"The figure itself, already formatted" #}
{# @prop percent:number | default:"0" | description:"How far along, from 0 to 100. Past 100 the bar is simply full." #}
{# @prop desc:text | description:"What it is measured against: of a €60k target" #}
{# @prop variant:select['primary', 'secondary', 'accent', 'success', 'warning', 'error'] | default:"primary" | description:"The colour of the filled part. Reach for warning or error when the bar is a limit being approached." #}
{# @prop icon:text | description:"An icon beside the figure, by the name the project's icon component knows it by. Left out, there is no icon." #}
{# @prop class:text | description:"Extra classes on the stat" #}
{# @slot:figure
— Beside the figure in place of the icon, for anything that is not one: a picture, a logo, an avatar. #}
{% comment %}
Built on daisy-cotton's stat and progress. A bar and not a ring: a length is
read more accurately than an angle. The percentage is written beside it, so
nothing depends on judging the bar by eye. With an icon, the bar's row spans
the icon's column as well, so the bar runs the full width underneath.
{% endcomment %}
{% if icon or figure %}{% if figure %}{{ figure }}{% else %}{% endif %}{% endif %}
{% if title %}{{ title }}{% endif %}
{{ value }}
{{ desc }}
{{ percent|floatformat:'0'|default:'0' }}%