Checkbox, Radio und Schalter (v2.0)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -104,6 +104,24 @@
|
||||
|
||||
progress { width: 100%; height: .6rem; accent-color: var(--accent-strong); }
|
||||
|
||||
.choice { font-weight: 400; font-size: 1rem; margin-bottom: 0; display: inline-flex; align-items: center; gap: .55rem; min-height: var(--target-min); cursor: pointer; }
|
||||
.choice input { appearance: none; -webkit-appearance: none; margin: 0; flex: none; position: relative; cursor: pointer;
|
||||
width: var(--control-size); height: var(--control-size); background: var(--surface); border: 1.5px solid var(--border-field); transition: background var(--transition), border-color var(--transition); }
|
||||
.choice input[type="checkbox"] { border-radius: 4px; }
|
||||
.choice input[type="radio"] { border-radius: 50%; }
|
||||
.choice input:checked, .choice input[type="checkbox"]:indeterminate { background: var(--accent-strong); border-color: var(--accent-strong); }
|
||||
.choice input[type="checkbox"]:not([role="switch"]):checked::after { content: ""; position: absolute; left: 32%; top: 12%; width: 28%; height: 52%; border: solid var(--accent-text); border-width: 0 2px 2px 0; transform: rotate(45deg); }
|
||||
.choice input[type="checkbox"]:indeterminate::after { content: ""; position: absolute; left: 22%; right: 22%; top: calc(50% - 1px); height: 2px; background: var(--accent-text); }
|
||||
.choice input[type="radio"]:checked::after { content: ""; position: absolute; inset: 27%; border-radius: 50%; background: var(--accent-text); }
|
||||
.choice input[role="switch"] { width: var(--switch-width); height: var(--switch-height); border-radius: var(--radius-pill); background: var(--surface-2); }
|
||||
.choice input[role="switch"]::after { content: ""; position: absolute; top: 50%; left: 3px; width: calc(var(--switch-height) - 10px); height: calc(var(--switch-height) - 10px); border-radius: 50%; background: var(--muted); transform: translateY(-50%); transition: left var(--transition), background var(--transition); }
|
||||
.choice input[role="switch"]:checked { background: var(--accent-strong); }
|
||||
.choice input[role="switch"]:checked::after { left: calc(100% - (var(--switch-height) - 10px) - 3px); background: var(--accent-text); }
|
||||
.choice input.invalid { border-color: var(--danger); }
|
||||
.choice:has(input:disabled) { opacity: .5; cursor: not-allowed; }
|
||||
.choice input:disabled { cursor: not-allowed; }
|
||||
fieldset { border: 0; margin: 0; padding: 0; }
|
||||
legend { font-size: var(--font-size-small); font-weight: 600; padding: 0; margin-bottom: .25rem; }
|
||||
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
|
||||
.tabs button { font: inherit; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 6px 12px; color: var(--muted); cursor: pointer; }
|
||||
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent-strong); font-weight: 600; }
|
||||
@ -234,6 +252,30 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Checkbox, Radio und Schalter</h2>
|
||||
<div class="formgrid">
|
||||
<fieldset><legend>Optionen</legend>
|
||||
<label class="choice" style="display:flex"><input type="checkbox" checked> Benachrichtigungen</label>
|
||||
<label class="choice" style="display:flex"><input type="checkbox"> Newsletter</label>
|
||||
<label class="choice" style="display:flex"><input type="checkbox" id="ind"> Teilweise gewählt</label>
|
||||
<label class="choice" style="display:flex"><input type="checkbox" disabled> Nicht verfügbar</label>
|
||||
<label class="choice" style="display:flex"><input type="checkbox" class="invalid" aria-describedby="e-ok"> Bedingungen akzeptieren</label>
|
||||
<div class="err" id="e-ok">Bitte bestätige die Bedingungen.</div>
|
||||
</fieldset>
|
||||
<fieldset><legend>Ansicht</legend>
|
||||
<label class="choice" style="display:flex"><input type="radio" name="v" checked> Liste</label>
|
||||
<label class="choice" style="display:flex"><input type="radio" name="v"> Raster</label>
|
||||
<label class="choice" style="display:flex"><input type="radio" name="v" disabled> Karte (nicht verfügbar)</label>
|
||||
</fieldset>
|
||||
<fieldset><legend>Einstellungen</legend>
|
||||
<label class="choice" style="display:flex"><input type="checkbox" role="switch" checked> Automatisch speichern</label>
|
||||
<label class="choice" style="display:flex"><input type="checkbox" role="switch"> Kompakte Ansicht</label>
|
||||
<label class="choice" style="display:flex"><input type="checkbox" role="switch" disabled> Nicht verfügbar</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Kennzahlen und Fortschritt</h2>
|
||||
<div class="grid">
|
||||
@ -319,6 +361,7 @@
|
||||
setAccent(acc);
|
||||
seg("accent-seg", acc, setAccent);
|
||||
|
||||
document.getElementById("ind").indeterminate = true;
|
||||
var tabs = Array.prototype.slice.call(document.querySelectorAll("#tabs [role=tab]"));
|
||||
function selectTab(i, focus) {
|
||||
tabs.forEach(function (b, j) {
|
||||
|
||||
Reference in New Issue
Block a user