- Bootsier: paleta propia a partir del logotipo, campos rellenos con sombra al enfocar, fieldsets y mensajes con sombra en vez de borde, desplegables sin borde, migas con fondo y paginador adaptable. - Bootsier: quita la rejilla de Bootstrap (la maquetación es de Flex y Grid) y el container-fluid interior de la barra de navegación. - Basic: margen inferior en campos y bloques, padding lateral en el envoltorio de la página y paginador que se reparte en varias líneas. - Nuevo ejemplo theme-showcase con todos los componentes en los dos temas.
535 lines
16 KiB
SCSS
535 lines
16 KiB
SCSS
// Bootsier CSS rules: self-hosted fonts, form elements, regions and components.
|
||
|
||
// Self-hosted Source Sans 3 (SIL OFL 1.1), served from /bootsier/fonts. Declared as the primary
|
||
// font family in $font-family-sans-serif (_bootsier-variables.scss).
|
||
// Font URLs must match the Preload declarations in src/lib.rs; a mismatch causes double downloads.
|
||
@font-face {
|
||
font-family: "Source Sans 3";
|
||
src: url("/bootsier/fonts/bootsier.font.woff2") format("woff2");
|
||
font-weight: 200 900;
|
||
font-style: normal;
|
||
font-display: swap;
|
||
}
|
||
|
||
@font-face {
|
||
font-family: "Source Sans 3";
|
||
src: url("/bootsier/fonts/bootsier.font.italic.woff2") format("woff2");
|
||
font-weight: 200 900;
|
||
font-style: italic;
|
||
font-display: swap;
|
||
}
|
||
|
||
// Background of the form fields ($input-bg in _bootsier-variables.scss), of disabled fields
|
||
// ($input-disabled-bg), of unchecked checks ($form-check-input-bg), of fieldsets, of dropdown menus
|
||
// ($dropdown-bg) and of breadcrumbs ($breadcrumb-bg), color of the group titles of dropdown menus
|
||
// ($dropdown-header-color, a lighter gray than their items in light mode, nearly white in dark
|
||
// mode), color of the legends of fieldsets (darker than Bootstrap's secondary color in light mode,
|
||
// since their thin weight makes them lighter), and shadow of focused fields
|
||
// ($input-focus-box-shadow), for each color mode. On a dark background the primary color barely
|
||
// shows, so the dark mode uses a lighter tint of it with more opacity.
|
||
:root,
|
||
[data-bs-theme="light"] {
|
||
--bootsier-input-bg: #f1f3f4;
|
||
--bootsier-input-disabled-bg: #f7f8f9;
|
||
--bootsier-check-bg: #e2e5e8;
|
||
--bootsier-fieldset-bg: #fefefe;
|
||
--bootsier-dropdown-bg: #fdfdfd;
|
||
--bootsier-breadcrumb-bg: #f8f9fa;
|
||
--bootsier-dropdown-header-color: rgba(var(--bs-body-color-rgb), .65);
|
||
--bootsier-legend-color: rgba(var(--bs-body-color-rgb), .9);
|
||
--bootsier-focus-shadow: 0 0 2px #{rgba($primary, .15)}, 0 0 6px #{rgba($primary, .35)};
|
||
}
|
||
|
||
@include color-mode(dark, true) {
|
||
--bootsier-input-bg: #{$gray-800};
|
||
--bootsier-input-disabled-bg: #31363b;
|
||
--bootsier-check-bg: #{$gray-700};
|
||
--bootsier-fieldset-bg: #292e33;
|
||
--bootsier-dropdown-bg: #3e444a;
|
||
--bootsier-breadcrumb-bg: #292e33;
|
||
--bootsier-dropdown-header-color: rgba(var(--bs-emphasis-color-rgb), .85);
|
||
--bootsier-legend-color: var(--bs-secondary-color);
|
||
--bootsier-focus-shadow:
|
||
0 0 2px #{rgba(tint-color($primary, 60%), .4)}, 0 0 6px #{rgba(tint-color($primary, 60%), .7)};
|
||
}
|
||
|
||
// Disabled form fields also fade as disabled buttons do.
|
||
.form-control:disabled,
|
||
.form-select:disabled {
|
||
opacity: $btn-disabled-opacity;
|
||
}
|
||
|
||
// Font-relative top offset to keep the skip-link hidden at any font size.
|
||
.skip-link {
|
||
top: -3em;
|
||
}
|
||
|
||
// Required field indicator in forms.
|
||
.form-required {
|
||
color: var(--bs-danger);
|
||
margin: 0 0.25rem;
|
||
}
|
||
|
||
// Form field with consistent bottom margin.
|
||
.form-field {
|
||
margin-bottom: 1rem;
|
||
|
||
&:last-child {
|
||
margin-bottom: 0;
|
||
}
|
||
}
|
||
|
||
// Button set (button::ButtonSet): spaces its buttons with a gap instead of relying on Bootstrap's
|
||
// .btn-group, which merges adjacent buttons into a single joined control.
|
||
.button-set {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: $spacer * .5;
|
||
margin: 1rem 0;
|
||
}
|
||
|
||
// Space below each block (Block), from Bootstrap's spacing unit, so consecutive blocks (and what
|
||
// follows them) do not sit right together. Twice $spacer, as the 2rem of the Basic theme.
|
||
.block {
|
||
margin-bottom: $spacer * 2;
|
||
}
|
||
|
||
// Fieldset outlined only by a soft shadow (Bootstrap's reboot already removes the border), with a
|
||
// floating legend.
|
||
fieldset {
|
||
position: relative;
|
||
background-color: var(--bootsier-fieldset-bg);
|
||
border-radius: var(--bs-border-radius);
|
||
// Offset down with a negative spread: strongest below, softer at the sides, faintest on top.
|
||
box-shadow: 0 1px 3px rgba(0, 0, 0, .10), 0 4px 8px -2px rgba(0, 0, 0, .22);
|
||
padding: 2rem 1rem 1rem;
|
||
margin: 2rem 0 1rem;
|
||
}
|
||
|
||
fieldset > legend {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 1rem;
|
||
transform: translateY(-50%);
|
||
color: var(--bootsier-legend-color);
|
||
background-color: var(--bs-body-bg);
|
||
// Soft outline with the gray of the form fields, in both color modes.
|
||
border: var(--bs-border-width) solid var(--bootsier-input-bg);
|
||
border-radius: var(--bs-border-radius);
|
||
padding: 0.125rem 0.75rem;
|
||
font-size: ($font-size-sm + $font-size-base) / 2;
|
||
font-weight: $font-weight-light;
|
||
line-height: 1.25;
|
||
width: fit-content;
|
||
max-width: 75%;
|
||
white-space: nowrap;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
}
|
||
|
||
.fieldset-description {
|
||
margin-bottom: 1rem;
|
||
}
|
||
|
||
// Labels start a little inside, clear of the rounded corner of their field.
|
||
.form-label {
|
||
padding-left: .25rem;
|
||
}
|
||
|
||
// Gap between group label and first inline check.
|
||
.form-label + .form-check-inline {
|
||
margin-left: 1rem;
|
||
}
|
||
|
||
// A region holding only comments (such as the mark of a deferred component that rendered nothing)
|
||
// matches `:empty`, so it takes no space.
|
||
.region:empty {
|
||
display: none;
|
||
}
|
||
|
||
// Footer region.
|
||
.region-footer {
|
||
padding: 0.75rem 0 3rem;
|
||
text-align: center;
|
||
}
|
||
|
||
// Images with this class show their colors inverted in dark mode, such as a dark logo that would
|
||
// otherwise blend into the background. Only for images that keep their look when inverted: a full
|
||
// color one would change its hues.
|
||
[data-bs-theme="dark"] .image-invert-dark {
|
||
filter: invert(1);
|
||
}
|
||
|
||
// Dropdown menus have no border (_bootsier-variables.scss), so a soft shadow sets them apart from
|
||
// the content they cover, as fieldsets are outlined. Bootstrap only adds its own with
|
||
// $enable-shadows.
|
||
.dropdown-menu {
|
||
box-shadow: 0 1px 3px rgba(0, 0, 0, .10), 0 4px 8px -2px rgba(0, 0, 0, .22);
|
||
}
|
||
|
||
// Group titles of dropdown menus in a lighter weight than their items.
|
||
.dropdown-header {
|
||
font-weight: $font-weight-light;
|
||
}
|
||
|
||
// Navbars have no inner container, so they line up with the rest of the page. Fixed bars span the
|
||
// whole viewport, so they take back the side padding of a container off its edges.
|
||
.navbar.fixed-top,
|
||
.navbar.fixed-bottom {
|
||
padding-right: $container-padding-x * .5;
|
||
padding-left: $container-padding-x * .5;
|
||
}
|
||
|
||
// The first link of the first menu and the last link of the last menu drop their outer padding, so
|
||
// their text lines up with the rest of the page (next to the brand, its own margin keeps them
|
||
// apart). Collapsed bars stack their links with no side padding already.
|
||
.navbar-nav:first-child > .nav-item:first-child > .nav-link {
|
||
padding-left: 0;
|
||
}
|
||
.navbar-nav:last-child > .nav-item:last-child > .nav-link {
|
||
padding-right: 0;
|
||
}
|
||
|
||
// Disabled links of navbars, lighter in dark mode: Bootstrap's 30% of the text color barely shows
|
||
// on the dark background (links take 65%).
|
||
[data-bs-theme="dark"] .navbar {
|
||
--bs-navbar-disabled-color: rgba(var(--bs-emphasis-color-rgb), .45);
|
||
}
|
||
|
||
// Messages component. Classes are fixed by pagetop core (`.message`, `.message-info`,
|
||
// `.message-warning`, `.message-error`); reusing Bootstrap's own `.alert`/`.alert-*` styles keeps
|
||
// the palette in sync with the active Bootstrap theme instead of duplicating it here.
|
||
.message {
|
||
@extend .alert;
|
||
// Outlined by a shadow tinted with the text color of each variant instead of a border. A single
|
||
// offset shadow is always stronger below than at the sides, so three are combined (left, right
|
||
// and below) to reach the same width on those three sides, leaving the top faint.
|
||
--bootsier-message-shadow: color-mix(in srgb, var(--bs-alert-color) 35%, transparent);
|
||
border: 0;
|
||
box-shadow:
|
||
0 1px 2px color-mix(in srgb, var(--bs-alert-color) 15%, transparent),
|
||
-4px 0 6px -4px var(--bootsier-message-shadow),
|
||
4px 0 6px -4px var(--bootsier-message-shadow),
|
||
0 3px 6px -3px var(--bootsier-message-shadow);
|
||
}
|
||
// No shadow in dark mode, where it barely shows: the background of each variant is enough.
|
||
[data-bs-theme="dark"] .message {
|
||
box-shadow: none;
|
||
}
|
||
.message-info {
|
||
@extend .alert-info;
|
||
}
|
||
.message-warning {
|
||
@extend .alert-warning;
|
||
}
|
||
.message-error {
|
||
@extend .alert-danger;
|
||
}
|
||
|
||
// Sort indicator on sortable table headers (`table::SortLink`), using Bootstrap Icons'
|
||
// sort-up/sort-down glyphs instead of the plain triangle from basic.css.
|
||
.table-sort::after {
|
||
font-family: $bootstrap-icons-font;
|
||
content: "\f575"; // sort-down
|
||
margin-left: 0.25rem;
|
||
font-size: 0.8em;
|
||
opacity: 0.35;
|
||
}
|
||
.table-sort-asc::after {
|
||
content: "\f57b"; // sort-up
|
||
opacity: 1;
|
||
}
|
||
.table-sort-desc::after {
|
||
content: "\f575"; // sort-down
|
||
opacity: 1;
|
||
}
|
||
|
||
// Message of a table without rows, as in the Basic theme: centered, in italics and muted (inside
|
||
// .table, to win over the color Bootstrap gives to every cell).
|
||
.table .table-empty {
|
||
text-align: center;
|
||
font-style: italic;
|
||
color: var(--bs-secondary-color);
|
||
}
|
||
|
||
// List filters (ListFilter): fields and button on one row, wrapping when there is no room.
|
||
.list-filter {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: flex-end;
|
||
gap: ($spacer * .5) $spacer;
|
||
margin-bottom: $spacer;
|
||
|
||
> .form-field {
|
||
margin-bottom: 0;
|
||
}
|
||
}
|
||
|
||
// Marks of changed filters not applied yet (filters with a button), set by `list-filter.js`. Only
|
||
// colors and opacity change, never sizes: the dot always takes its room, hidden, so nothing moves
|
||
// when it shows up. A vivid orange, set apart from the primary color of the button, darkened just
|
||
// enough to keep a 3:1 contrast against the background. Every changed field gets the dot by its
|
||
// label, once per field (on the title of a group); text fields, dropdowns and checks also show
|
||
// their border in that color. Floating labels are left out: Bootstrap draws their background with
|
||
// `::after`.
|
||
.list-filter {
|
||
--list-filter-mark: #{mix(#000, $orange, 15%)};
|
||
}
|
||
|
||
.list-filter .form-field:not(.form-floating) > .form-label::after,
|
||
.list-filter .form-field.form-check > .form-check-label::after {
|
||
content: "\25CF" / "";
|
||
margin-left: .25em;
|
||
color: var(--list-filter-mark);
|
||
opacity: 0;
|
||
}
|
||
|
||
.list-filter .list-filter-changed {
|
||
&:not(.form-floating) > .form-label::after,
|
||
&.form-check > .form-check-label::after {
|
||
opacity: 1;
|
||
}
|
||
|
||
.form-control,
|
||
.form-select,
|
||
.form-check-input {
|
||
border-color: var(--list-filter-mark);
|
||
}
|
||
|
||
.form-check-input:checked {
|
||
background-color: var(--list-filter-mark);
|
||
}
|
||
}
|
||
|
||
.list-filter-pending > .btn-secondary[type="submit"] {
|
||
@extend .btn-primary;
|
||
}
|
||
|
||
// List view (ListView): action buttons above the table.
|
||
.list-view {
|
||
margin-block: $spacer * 1.5;
|
||
}
|
||
|
||
.list-view-actions {
|
||
margin-bottom: $spacer;
|
||
}
|
||
|
||
// Pager component.
|
||
// `.pagination`, `.page-item`, `.page-link`, `.active` and `.disabled` already come styled by
|
||
// Bootstrap, since Pager reuses that same markup (the ellipsis is a disabled `.page-link` span,
|
||
// same as any other cell). Only what Pager adds on top needs rules here: the <nav> wrapper and
|
||
// the jump-to-page form.
|
||
|
||
// <nav> wrapper: flex row that also holds the jump-to-page form.
|
||
.pager {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
gap: 0 $spacer; // row-gap column-gap: no vertical gap when the summary drops to its own line.
|
||
margin-block: $spacer;
|
||
}
|
||
|
||
// Horizontal alignment set via PagerAlign.
|
||
.pager-align-start {
|
||
justify-content: flex-start;
|
||
}
|
||
.pager-align-center {
|
||
justify-content: center;
|
||
}
|
||
.pager-align-end {
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
// Pushes the rest of .pager (pagination, jump form) to the opposite side. With
|
||
// PagerAlign::Start the summary swaps to the other end instead, since otherwise it would sit
|
||
// right next to a pagination that's already at the start. With PagerAlign::Center an auto margin
|
||
// wouldn't work -it always claims all the free space, so the pagination could never be genuinely
|
||
// centered- so instead the summary drops to its own line below, centered too.
|
||
.pager-summary {
|
||
color: var(--bs-secondary-color);
|
||
font-size: $font-size-sm;
|
||
align-self: flex-start;
|
||
margin-inline-end: auto;
|
||
}
|
||
.pager-align-start .pager-summary {
|
||
order: 1;
|
||
margin-inline-end: 0;
|
||
margin-inline-start: auto;
|
||
}
|
||
.pager-align-center .pager-summary {
|
||
order: 1;
|
||
flex-basis: 100%;
|
||
text-align: center;
|
||
margin-inline-end: 0;
|
||
}
|
||
|
||
// Joined cells, as in Bootstrap, but wrapping onto more lines when they don't fit: a long pager
|
||
// never gets wider than the screen (mobile browsers would zoom out the whole page). Each line
|
||
// overlaps the border of the one above, as cells do side by side. On small screens they also get
|
||
// smaller, so that more of them fit on a line.
|
||
.pagination {
|
||
flex-wrap: wrap;
|
||
}
|
||
.pagination .page-link {
|
||
margin-bottom: calc(var(--bs-pagination-border-width) * -1);
|
||
}
|
||
@include media-breakpoint-down(sm) {
|
||
.pagination {
|
||
--bs-pagination-padding-x: .5rem;
|
||
--bs-pagination-padding-y: .25rem;
|
||
--bs-pagination-font-size: #{$font-size-base * .875};
|
||
}
|
||
}
|
||
|
||
// By default, .page-link-icon shows the text of pager_previous_label/pager_next_label
|
||
// ("Previous"/"Next"). The full accessible text lives separately, in the link's aria-label, so
|
||
// replacing the visible text here with a symbol does not affect accessibility. To use "‹"/"›"
|
||
// instead, uncomment:
|
||
/*
|
||
.page-link-icon {
|
||
display: inline-block;
|
||
font-size: 0;
|
||
}
|
||
.page-previous .page-link-icon::before {
|
||
content: "‹";
|
||
font-size: var(--bs-pagination-font-size);
|
||
display: inline-block;
|
||
transform: translateY(-0.1em) scale(1.5);
|
||
}
|
||
.page-next .page-link-icon::before {
|
||
content: "›";
|
||
font-size: var(--bs-pagination-font-size);
|
||
display: inline-block;
|
||
transform: translateY(-0.1em) scale(1.5);
|
||
}
|
||
*/
|
||
|
||
// Jump-to-page field and submit button, presented as a single joined control. Same block margins
|
||
// as `ol`/`ul`/`dl` in Bootstrap's reboot (literal values there too, not variables).
|
||
.pager-jump {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-top: 0;
|
||
margin-bottom: 1rem;
|
||
}
|
||
|
||
// One focus ring for the whole control instead of one per element.
|
||
.pager-jump:focus-within {
|
||
border-radius: $input-border-radius;
|
||
box-shadow: $input-focus-box-shadow;
|
||
}
|
||
.pager-jump-input > .form-control:focus,
|
||
.pager-jump-button:focus {
|
||
box-shadow: none;
|
||
}
|
||
.pager-jump-input > .form-control {
|
||
// Extra width equals twice the field's own horizontal padding.
|
||
width: calc(var(--pager-jump-width, 1ch) + #{$input-padding-x * 4});
|
||
text-align: center;
|
||
appearance: textfield;
|
||
-moz-appearance: textfield;
|
||
|
||
// Logical (not physical) corners, so the shape flips correctly under RTL.
|
||
border-start-end-radius: 0;
|
||
border-end-end-radius: 0;
|
||
|
||
&::-webkit-outer-spin-button,
|
||
&::-webkit-inner-spin-button {
|
||
-webkit-appearance: none;
|
||
margin: 0;
|
||
}
|
||
}
|
||
.pager-jump-input {
|
||
margin: 0;
|
||
}
|
||
.pager-jump-button {
|
||
@extend .btn-primary;
|
||
border-start-start-radius: 0;
|
||
border-end-start-radius: 0;
|
||
}
|
||
|
||
// Frame of an administration page (`AdminFrame`): title with its action links, then the local
|
||
// tasks as tabs.
|
||
.admin-header {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 0.5rem 1rem;
|
||
margin: 1rem 0;
|
||
}
|
||
|
||
.admin-page-title {
|
||
margin: 0;
|
||
}
|
||
|
||
.admin-actions-list,
|
||
.admin-tasks-list {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 0.5rem;
|
||
margin: 0;
|
||
padding: 0;
|
||
list-style: none;
|
||
}
|
||
|
||
.admin-action-link {
|
||
@extend .btn;
|
||
@extend .btn-outline-primary;
|
||
}
|
||
|
||
.admin-local-tasks {
|
||
margin-bottom: 1rem;
|
||
border-bottom: var(--bs-border-width) solid var(--bs-border-color);
|
||
}
|
||
|
||
.admin-task a {
|
||
display: block;
|
||
padding: 0.5rem 0.75rem;
|
||
margin-bottom: calc(-1 * var(--bs-border-width));
|
||
border-bottom: 2px solid transparent;
|
||
text-decoration: none;
|
||
}
|
||
|
||
.admin-task-active a {
|
||
border-bottom-color: var(--bs-primary);
|
||
font-weight: 600;
|
||
}
|
||
|
||
// Login page (pagetop-user `LoginForm`): the form inside a centered card, as in Bootstrap's sign-in
|
||
// example. The submit button takes the full width of the card.
|
||
.user-login-page {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
min-height: 70vh;
|
||
padding: $spacer * 2 $spacer;
|
||
background-color: var(--bs-tertiary-bg);
|
||
}
|
||
|
||
.user-login-card {
|
||
width: 100%;
|
||
max-width: 24rem;
|
||
padding: $spacer * 2;
|
||
background-color: var(--bs-body-bg);
|
||
border: var(--bs-border-width) solid var(--bs-border-color-translucent);
|
||
border-radius: var(--bs-border-radius-lg);
|
||
box-shadow: var(--bs-box-shadow);
|
||
}
|
||
|
||
.user-login-card .btn[type="submit"] {
|
||
width: 100%;
|
||
margin-top: $spacer * .5;
|
||
}
|
||
|
||
.user-register-link,
|
||
.user-reset-link {
|
||
margin: $spacer 0 0;
|
||
text-align: center;
|
||
}
|
||
|
||
// Form errors of pagetop-user, with the palette of Bootstrap's own alerts.
|
||
.user-form-error {
|
||
@extend .alert;
|
||
@extend .alert-danger;
|
||
}
|