left4me/l4d2web/static/css/components.css
mwiegand a4e9f6cd26
feat(l4d2-web): blueprint overlay picker — drag-list + add-dropdown
Replace the per-row checkbox + numeric Order table on the blueprint
detail page with a drag-to-reorder list of selected overlays plus a
native <select> for adding more. Removing uses an × button per row;
the option sorted-inserts back into the dropdown alphabetically.

Native HTML5 drag-and-drop, no library, no JS-disabled fallback.
Server contract is unchanged: each list row owns one hidden
<input name="overlay_ids">, DOM order = submission order, and the
existing fallback_position branch in ordered_overlay_ids_from_form
absorbs the now-omitted overlay_position_<id> fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 21:37:11 +02:00

355 lines
5.8 KiB
CSS

.panel,
.card {
background: var(--color-surface);
border: var(--line);
border-radius: var(--radius-m);
padding: var(--space-l);
margin-bottom: var(--space-l);
}
.table {
width: 100%;
border-collapse: collapse;
}
.table th,
.table td {
text-align: left;
padding: var(--space-s) var(--space-m);
border-bottom: var(--line);
}
.muted {
color: var(--color-muted);
}
.stack {
display: grid;
gap: var(--space-m);
}
input,
button,
select,
textarea {
font: inherit;
}
label {
display: grid;
gap: var(--space-xs);
}
input,
select,
textarea {
background: var(--color-surface);
border: var(--line);
border-radius: var(--radius-s);
color: var(--color-text);
padding: var(--space-s) var(--space-m);
}
textarea {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 0.875rem;
line-height: 1.5;
resize: vertical;
tab-size: 4;
}
input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
outline: 2px solid var(--color-focus);
outline-offset: 2px;
}
button,
a.button {
background: var(--color-primary);
border: none;
border-radius: var(--radius-s);
color: #fff;
padding: var(--space-s) var(--space-l);
cursor: pointer;
display: inline-block;
text-decoration: none;
}
button.danger,
a.button.danger {
background: var(--color-danger);
}
.link-button {
background: none;
border: none;
color: var(--color-link);
padding: 0;
text-decoration: underline;
cursor: pointer;
}
.inline-form {
display: inline;
}
.auth-panel {
max-width: 28rem;
}
dialog.modal {
background: var(--color-surface);
color: var(--color-text);
border: var(--line);
border-radius: var(--radius-m);
padding: 0;
width: min(32rem, 90vw);
max-height: 90vh;
}
dialog.modal::backdrop {
background: rgba(0, 0, 0, 0.45);
}
.modal-header,
.modal-body,
.modal-footer {
padding: var(--space-l);
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: var(--line);
}
.modal-header h2 {
margin: 0;
font-size: 1.1rem;
}
.modal-body {
display: grid;
gap: var(--space-m);
overflow-y: auto;
}
.modal-footer {
display: flex;
justify-content: flex-end;
gap: var(--space-m);
border-top: var(--line);
}
.modal-close {
background: none;
color: var(--color-muted);
padding: var(--space-xs) var(--space-s);
font-size: 1.25rem;
line-height: 1;
}
.button-secondary {
background: var(--color-surface);
color: var(--color-text);
border: var(--line);
}
.field-hint {
color: var(--color-muted);
font-size: 0.875rem;
}
.page-heading {
display: flex;
justify-content: space-between;
align-items: center;
gap: var(--space-m);
margin-bottom: var(--space-l);
}
.page-heading h1,
.page-heading h2 {
margin: 0;
}
.button-row {
display: flex;
gap: var(--space-s);
flex-wrap: wrap;
}
.detail-grid {
display: grid;
gap: var(--space-l);
}
.used-by-list {
list-style: none;
padding: 0;
margin: 0;
display: grid;
gap: var(--space-s);
}
.file-tree {
list-style: none;
padding: 0;
margin: 0;
display: grid;
gap: var(--space-xs);
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 0.875rem;
}
.file-tree .file-tree {
padding-left: var(--space-l);
margin-top: var(--space-xs);
}
.file-tree-row {
display: flex;
/* Row-gap 0 so the wrapped .file-tree-children div sits directly under
the toggle button; vertical spacing is owned exclusively by the
outer grid's gap and the nested ul's margin-top. */
gap: 0 var(--space-s);
align-items: baseline;
flex-wrap: wrap;
}
.file-tree-toggle {
background: none;
border: 0;
color: inherit;
cursor: pointer;
padding: 0;
font: inherit;
text-align: left;
}
.file-tree-toggle .chevron {
display: inline-block;
width: 1ch;
text-align: center;
transition: transform 120ms ease;
margin-right: var(--space-xs);
}
.file-tree-row-file {
padding-left: calc(1ch + var(--space-xs));
}
.file-tree-toggle[aria-expanded="true"] .chevron {
transform: rotate(90deg);
}
.file-tree-children {
flex-basis: 100%;
}
.file-tree-children[hidden] {
display: none;
}
.file-tree-badge {
font-size: 0.75rem;
padding: 0 0.4em;
border-radius: var(--radius-s);
background: var(--color-surface-muted);
color: var(--color-muted);
border: var(--line);
}
.file-tree-badge-warn {
background: transparent;
color: var(--color-danger);
border-color: var(--color-danger);
}
.file-tree-row-truncated {
font-style: italic;
}
.overlay-picker {
display: grid;
gap: var(--space-m);
}
.overlay-picker-list {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: var(--space-xs);
min-height: 3rem;
}
.overlay-picker-row {
display: flex;
align-items: center;
gap: var(--space-s);
padding: var(--space-s) var(--space-m);
background: var(--color-surface-muted);
border: var(--line);
border-radius: var(--radius-s);
cursor: grab;
user-select: none;
}
.overlay-picker-row:active {
cursor: grabbing;
}
.overlay-picker-row.is-dragging {
opacity: 0.4;
}
.overlay-picker-row.drop-before {
box-shadow: 0 2px 0 0 var(--color-focus) inset;
}
.overlay-picker-row.drop-after {
box-shadow: 0 -2px 0 0 var(--color-focus) inset;
}
.overlay-picker-handle {
color: var(--color-muted);
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
letter-spacing: -0.1em;
}
.overlay-picker-name {
flex: 1;
}
.overlay-picker-remove {
background: none;
color: var(--color-muted);
padding: 0 var(--space-s);
font-size: 1.1rem;
line-height: 1;
}
.overlay-picker-remove:hover {
color: var(--color-danger);
}
.overlay-picker-empty {
margin: 0;
}
.overlay-picker-add {
display: flex;
align-items: center;
gap: var(--space-s);
}
.overlay-picker-add select {
flex: 1;
}