Files
gabrielvidalandClaude Opus 5.5 aef717a634 feat(attach): files on every textarea and "Other…" answer; Other… box grows
A paperclip in the box's corner (shown while it has the focus), drop on the
field or paste a screenshot: files go up like a file field's (any type,
10 MB each, 5 per box, the form's 50 MB / 20 files cap) and come back next
to the text under `<key>.files`. Sent alone, they answer the question with
their names as its text. `"attach": false` takes the paperclip off; none in
a --multi form or a demo. Snapshots and recaps list them.

The "Other…" text is a textarea now: it wraps and grows with what is typed
(Enter adds a line) instead of scrolling sideways.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 20:28:02 +01:00

56 lines
3.7 KiB
CSS

/* ask-form answer page — file fields (see upload.js). The drop area only shows
once JavaScript is on (.js is set by app.js); until then the field's
<noscript> note stands in for it. */
.uploader { display: none; }
.js .uploader { display: block; }
.drop {
display: grid; gap: 2px; justify-items: center; text-align: center; cursor: pointer;
padding: 18px 14px; min-height: 88px; align-content: center;
border: 2px dashed hsl(var(--border)); border-radius: 12px; background: hsl(var(--background));
}
.drop:hover, .uploader.over .drop { border-color: hsl(var(--primary)); background: hsl(var(--primary) / .06); }
.drop:focus-within { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.drop .file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.drop-main { font-weight: 600; }
.drop-or { font-weight: 400; color: hsl(var(--muted-foreground)); }
.drop small { color: hsl(var(--muted-foreground)); font-size: 13px; }
.uploader.full .drop { display: none; }
.files { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.files:empty { display: none; }
.file-item { border: 1px solid hsl(var(--border)); border-radius: 10px; padding: 8px 10px; background: hsl(var(--background)); }
.file-item.done { border-color: hsl(140 45% 45% / .55); }
.file-item.error { border-color: hsl(var(--destructive) / .6); }
.file-row { display: flex; align-items: center; gap: 10px; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-size { color: hsl(var(--muted-foreground)); font-size: 13px; font-variant-numeric: tabular-nums; }
.file-rm, .file-retry {
border: 0; border-radius: 7px; background: hsl(var(--muted)); color: inherit; font: inherit; font-size: 13px;
cursor: pointer; padding: 4px 9px; min-height: 30px;
}
.file-item progress { display: block; width: 100%; height: 6px; margin-top: 8px; accent-color: hsl(var(--primary)); }
.file-err { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; color: hsl(var(--destructive)); font-size: 14px; }
/* Files attached to a text (a textarea, an "Other…" answer): a paperclip in
the box's bottom-right corner while it has the focus (or files are dragged
over it), the files listed under it. .attach comes right after the box, so
the button sits just above its top edge. */
.attach { display: none; position: relative; }
.js .attach { display: block; }
textarea.has-attach { display: block; padding-right: 46px; resize: none; }
/* Out of sight, not out of the page: Tab from the box still reaches it. */
.attach-add {
position: absolute; right: 6px; bottom: calc(100% + 6px); z-index: 1;
display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
border-radius: 8px; cursor: pointer; color: hsl(var(--muted-foreground));
opacity: 0; pointer-events: none; transition: opacity .12s;
}
textarea:focus + .attach .attach-add, textarea.drop-over + .attach .attach-add, .attach:focus-within .attach-add { opacity: 1; pointer-events: auto; }
.attach.full .attach-add { display: none; }
.attach-add:hover { color: hsl(var(--foreground)); background: hsl(var(--foreground) / .08); }
.attach-add:focus-within { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.attach-add svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.attach-add .file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.attach .files { margin-top: 8px; }
textarea.drop-over { border-color: hsl(var(--primary)); background: hsl(var(--primary) / .06); }
@media print { .attach { display: none !important; } }