✨ Añade iconos a botones y menús

Nuevo componente Icon con un pequeño conjunto propio (`icon::Core`) que
cada tema puede sustituir; Bootsier usa Bootstrap Icons. `Button`,
`nav::Item` y `dropdown::Item` admiten iconos al principio y al final, y
el panel de administración los usa en secciones y páginas.
This commit is contained in:
Manuel Cillero 2026-11-22 23:08:28 +01:00
parent d83f8b0f7f
commit 5d6852382a
23 changed files with 1098 additions and 161 deletions

View file

@ -0,0 +1,57 @@
// Inline SVG icons (`Icon`) sit on the text baseline like a glyph of the surrounding font.
svg.icon {
flex-shrink: 0;
vertical-align: -0.125em;
}
// Color of an icon with an intent (`Icon::with_intent()`).
.icon-primary { color: var(--val-color--primary); }
.icon-neutral { color: var(--val-color--secondary); }
.icon-info { color: var(--val-color--info); }
.icon-success { color: var(--val-color--success); }
.icon-warning { color: var(--val-color--warning); }
.icon-severe { color: var(--val-color--danger); }
// Icons of menu items (`with_icon_start()`/`with_icon_end()` of `nav::Item` and `dropdown::Item`).
// In a row of links, each icon keeps its distance from the label.
.nav-link > .icon-start {
margin-inline-end: 0.5em;
}
.nav-link > .icon-end {
margin-inline-start: 0.5em;
}
// In a vertical list (dropdown menu or vertical nav) with any icon, every item is a flex row: the
// end icon goes to the edge, and an item without an icon on one side keeps that space empty, so
// that all the labels line up. The `:has()` selectors look only at the items of this list, not at
// those of a nested menu.
.dropdown-menu:has(> li > * > .icon) > li > :is(.dropdown-item, .dropdown-item-text),
.nav-vertical:has(> li > .nav-link > .icon) > li > .nav-link {
display: flex;
align-items: center;
gap: 0.5em;
> .icon-start,
> .icon-end {
margin: 0;
}
> .icon-end {
margin-inline-start: auto;
}
}
.dropdown-menu:has(> li > * > .icon-start) > li > :is(.dropdown-item, .dropdown-item-text),
.nav-vertical:has(> li > .nav-link > .icon-start) > li > .nav-link {
&:not(:has(> .icon-start))::before {
content: "";
flex: 0 0 1em;
}
}
// The toggle of a dropdown already shows its arrow at the end.
.dropdown-menu:has(> li > * > .icon-end) > li > :is(.dropdown-item, .dropdown-item-text),
.nav-vertical:has(> li > .nav-link > .icon-end) > li > .nav-link:not(.dropdown-toggle) {
&:not(:has(> .icon-end))::after {
content: "";
flex: 0 0 1em;
margin-inline-start: auto;
}
}