The form renderer is server-driven: zddc-server's form handler injects schema/ui/data into <script id="form-context"> on every render. Standalone form/dist/form.html opened from file:// has no context and just rendered as a blank page below the header chrome — no orientation, no submit button affordance was hidden, but nothing labelled what the user was looking at. Detect the empty-context case in form/js/main.js, render a small .form-welcome card explaining that this tool is server-driven, and hide the now-meaningless Submit button. The card uses shared tokens (--bg, --border, --font-mono, etc.) so it themes correctly. Note: the unified tables.html bundle that hosts the form via the zddcMode dispatcher is unaffected — tables always sets zddcMode='form' or 'table' before form's main.js boots, so the welcome only fires for the standalone HTML. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
228 lines
4.3 KiB
CSS
228 lines
4.3 KiB
CSS
/* form/ — ZDDC generic form renderer.
|
|
Pulls theme tokens from shared/base.css; only adds form-specific layout. */
|
|
|
|
.form-main {
|
|
max-width: 800px;
|
|
margin: 1.5rem auto;
|
|
padding: 0 1rem 4rem;
|
|
}
|
|
|
|
.form-status {
|
|
padding: 0.75rem 1rem;
|
|
margin-bottom: 1rem;
|
|
border-radius: 4px;
|
|
border: 1px solid var(--color-border);
|
|
}
|
|
|
|
.form-status.is-error {
|
|
background: var(--color-bg-alt);
|
|
border-color: #c43;
|
|
color: #c43;
|
|
}
|
|
|
|
.form-status.is-success {
|
|
background: var(--color-bg-alt);
|
|
border-color: #283;
|
|
color: #283;
|
|
}
|
|
|
|
.form-root {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.form-field {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.form-field__label {
|
|
font-weight: 600;
|
|
font-size: 0.95rem;
|
|
}
|
|
|
|
.form-field__label .required-mark {
|
|
color: #c43;
|
|
margin-left: 0.15rem;
|
|
}
|
|
|
|
.form-field__description {
|
|
font-size: 0.85rem;
|
|
color: var(--color-text-muted, #666);
|
|
}
|
|
|
|
.form-field__error {
|
|
font-size: 0.85rem;
|
|
color: #c43;
|
|
margin-top: 0.15rem;
|
|
}
|
|
|
|
.form-field__help {
|
|
font-size: 0.8rem;
|
|
color: var(--color-text-muted, #666);
|
|
font-style: italic;
|
|
}
|
|
|
|
.form-field__input,
|
|
.form-field__textarea,
|
|
.form-field__select {
|
|
padding: 0.5rem 0.65rem;
|
|
border: 1px solid var(--color-border);
|
|
border-radius: 4px;
|
|
background: var(--color-bg, #fff);
|
|
color: var(--color-text, #111);
|
|
font: inherit;
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.form-field__textarea {
|
|
min-height: 5em;
|
|
resize: vertical;
|
|
}
|
|
|
|
.form-field__input:focus,
|
|
.form-field__textarea:focus,
|
|
.form-field__select:focus {
|
|
outline: 2px solid var(--color-primary, #1e3a5f);
|
|
outline-offset: -1px;
|
|
}
|
|
|
|
.form-field--invalid .form-field__input,
|
|
.form-field--invalid .form-field__textarea,
|
|
.form-field--invalid .form-field__select {
|
|
border-color: #c43;
|
|
}
|
|
|
|
.form-field__radio-group,
|
|
.form-field__checkbox-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.form-field__radio-group label,
|
|
.form-field__checkbox-group label {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-weight: 400;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.form-fieldset {
|
|
border: 1px solid var(--color-border);
|
|
border-radius: 4px;
|
|
padding: 0.75rem 1rem 1rem;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.form-fieldset__legend {
|
|
font-weight: 600;
|
|
padding: 0 0.4rem;
|
|
}
|
|
|
|
.form-array {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.form-array__row {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
align-items: flex-start;
|
|
border: 1px solid var(--color-border);
|
|
border-radius: 4px;
|
|
padding: 0.5rem;
|
|
background: var(--color-bg-alt, #f6f6f8);
|
|
}
|
|
|
|
.form-array__row-body {
|
|
flex: 1 1 auto;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.form-array__row-actions {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.form-array__add {
|
|
align-self: flex-start;
|
|
}
|
|
|
|
.form-actions {
|
|
margin-top: 1.5rem;
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.btn {
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 4px;
|
|
border: 1px solid var(--color-border);
|
|
background: var(--color-bg, #fff);
|
|
color: var(--color-text, #111);
|
|
cursor: pointer;
|
|
font: inherit;
|
|
}
|
|
|
|
.btn:hover {
|
|
background: var(--color-bg-alt, #f6f6f8);
|
|
}
|
|
|
|
.btn-primary {
|
|
background: var(--color-primary, #1e3a5f);
|
|
color: #fff;
|
|
border-color: var(--color-primary, #1e3a5f);
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
filter: brightness(1.1);
|
|
}
|
|
|
|
.btn-small {
|
|
padding: 0.2rem 0.5rem;
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
.btn[disabled] {
|
|
opacity: 0.5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Standalone welcome — shown when form.html is opened directly (no server-injected #form-context). */
|
|
.form-welcome {
|
|
max-width: 36rem;
|
|
margin: 2rem auto;
|
|
padding: 1.5rem 1.75rem;
|
|
background: var(--bg);
|
|
border: 1px solid var(--border);
|
|
border-radius: var(--radius);
|
|
}
|
|
.form-welcome h2 {
|
|
margin-bottom: 0.5rem;
|
|
font-size: 1.25rem;
|
|
}
|
|
.form-welcome h3 {
|
|
margin: 1rem 0 0.35rem;
|
|
font-size: 0.95rem;
|
|
}
|
|
.form-welcome p { margin-bottom: 0.75rem; line-height: 1.5; }
|
|
.form-welcome ol { margin: 0 0 0.75rem 1.25rem; }
|
|
.form-welcome li { margin-bottom: 0.35rem; }
|
|
.form-welcome code {
|
|
font-family: var(--font-mono);
|
|
font-size: 0.85em;
|
|
background: var(--bg-secondary);
|
|
padding: 0.05em 0.3em;
|
|
border-radius: 3px;
|
|
}
|