154 lines
6.7 KiB
HTML
154 lines
6.7 KiB
HTML
<!doctype html>
|
||
<html lang="de">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Styleguide – Layout VSF List Card</title>
|
||
<link rel="stylesheet" href="../styleguide.css">
|
||
</head>
|
||
<body>
|
||
|
||
<h1 class="sg-main-heading">Layout – VSF List Card</h1>
|
||
|
||
<section id="layout-vsf-list-card">
|
||
<p class="sg-preview-label">Layout: VSF List Card</p>
|
||
<p class="sg-body">Diese Layout-Seite zeigt VSF-spezifische List-Card-Layouts als Grundlage fuer weitere Ausdifferenzierungen.</p>
|
||
|
||
<h2 class="sg-sub-heading sg-section-h2">Layout 1: Neue Liste anlegen Karte</h2>
|
||
<div class="sg-object-card-grid" aria-label="VSF List Card Layout Neue Liste anlegen">
|
||
<article class="sg-card sg-object-card" data-pattern="object-group-card" aria-label="Neue Liste anlegen Karte">
|
||
<header class="sg-card-segment sg-card-segment--header sg-card-segment--darkblue sg-object-card__header" data-pattern-part="object-group-card-header">
|
||
<div class="sg-strong">Neue Liste anlegen</div>
|
||
</header>
|
||
<div class="sg-card-segment sg-card-segment--body sg-card-segment--lightgrey sg-object-card__content" data-pattern-part="object-group-card-content">
|
||
<form class="sg-form-sections-card" action="#" method="post" aria-label="Neue Liste anlegen Formular">
|
||
<div class="sg-form-sections-card__field-group">
|
||
<label class="sg-labeled-input-row">
|
||
<span class="sg-label">Listentyp</span>
|
||
<div class="sg-pulldown-demo" data-open="false" data-align="left" data-selection-mode="single" data-component="pulldown" data-component-context="form" data-component-state="inactive-selectable">
|
||
<button class="sg-interaction-element sg-pulldown sg-pulldown--inactive-selectable sg-form-inactive-selectable sg-pulldown-demo__trigger" type="button" aria-expanded="false" aria-label="Pulldown ohne aktive Auswahl" data-component-part="pulldown-trigger" data-label-base="Listentyp">
|
||
Listentyp
|
||
</button>
|
||
<div class="sg-pulldown-panel" aria-label="Geoeffnetes Pulldown Listentyp" data-component-part="pulldown-panel">
|
||
<ul class="sg-pulldown-option-list" aria-label="Listentyp Optionen">
|
||
<li class="sg-pulldown-option" role="checkbox" aria-checked="false" data-pulldown-option><span>Watchlist</span></li>
|
||
<li class="sg-pulldown-option" role="checkbox" aria-checked="false" data-pulldown-option><span>Portfolio</span></li>
|
||
<li class="sg-pulldown-option" role="checkbox" aria-checked="false" data-pulldown-option><span>Screening</span></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</label>
|
||
|
||
<label class="sg-labeled-input-row">
|
||
<span class="sg-label">Name</span>
|
||
<input
|
||
class="sg-interaction-element sg-input-single-line sg-input-single-line--inactive-selectable sg-form-inactive-selectable"
|
||
type="text"
|
||
placeholder="Name eingeben"
|
||
aria-label="Name"
|
||
maxlength="80"
|
||
>
|
||
</label>
|
||
|
||
<label class="sg-labeled-input-row">
|
||
<span class="sg-label">Beschreibung</span>
|
||
<textarea
|
||
class="sg-input-multi-line sg-form-inactive-selectable"
|
||
rows="4"
|
||
placeholder="Beschreibung eingeben"
|
||
aria-label="Beschreibung"
|
||
maxlength="350"
|
||
></textarea>
|
||
</label>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</article>
|
||
</div>
|
||
</section>
|
||
|
||
<script>
|
||
const updatePulldownSelectionState = (demo) => {
|
||
const trigger = demo.querySelector('.sg-pulldown-demo__trigger');
|
||
const selectableOptions = demo.querySelectorAll('[data-pulldown-option]');
|
||
|
||
if (!trigger || selectableOptions.length === 0) {
|
||
return;
|
||
}
|
||
|
||
const selectedCount = Array.from(selectableOptions).filter((option) => {
|
||
return option.getAttribute('aria-checked') === 'true';
|
||
}).length;
|
||
const labelBase = trigger.dataset.labelBase || 'Auswahl';
|
||
|
||
trigger.textContent = selectedCount > 0 ? `${labelBase} (${selectedCount})` : labelBase;
|
||
trigger.classList.toggle('sg-pulldown--selected', selectedCount > 0);
|
||
trigger.classList.toggle('sg-form-active', selectedCount > 0);
|
||
trigger.dataset.componentState = selectedCount > 0 ? 'selected' : 'inactive-selectable';
|
||
demo.dataset.componentState = selectedCount > 0 ? 'selected' : 'inactive-selectable';
|
||
};
|
||
|
||
document.querySelectorAll('.sg-pulldown-demo').forEach((demo) => {
|
||
const trigger = demo.querySelector('.sg-pulldown-demo__trigger');
|
||
if (!trigger) {
|
||
return;
|
||
}
|
||
|
||
trigger.addEventListener('click', (event) => {
|
||
event.stopPropagation();
|
||
const nextState = demo.dataset.open !== 'true';
|
||
|
||
document.querySelectorAll('.sg-pulldown-demo').forEach((otherDemo) => {
|
||
const otherTrigger = otherDemo.querySelector('.sg-pulldown-demo__trigger');
|
||
otherDemo.dataset.open = 'false';
|
||
if (otherTrigger) {
|
||
otherTrigger.setAttribute('aria-expanded', 'false');
|
||
}
|
||
});
|
||
|
||
demo.dataset.open = String(nextState);
|
||
trigger.setAttribute('aria-expanded', String(nextState));
|
||
});
|
||
});
|
||
|
||
document.querySelectorAll('.sg-pulldown-option[data-pulldown-option]').forEach((option) => {
|
||
option.addEventListener('click', (event) => {
|
||
event.stopPropagation();
|
||
const pulldownDemo = option.closest('.sg-pulldown-demo');
|
||
if (!pulldownDemo) {
|
||
return;
|
||
}
|
||
|
||
pulldownDemo.querySelectorAll('[data-pulldown-option]').forEach((otherOption) => {
|
||
otherOption.setAttribute('aria-checked', String(otherOption === option));
|
||
});
|
||
|
||
updatePulldownSelectionState(pulldownDemo);
|
||
const trigger = pulldownDemo.querySelector('.sg-pulldown-demo__trigger');
|
||
pulldownDemo.dataset.open = 'false';
|
||
if (trigger) {
|
||
trigger.setAttribute('aria-expanded', 'false');
|
||
}
|
||
});
|
||
});
|
||
|
||
document.querySelectorAll('.sg-pulldown-demo').forEach(updatePulldownSelectionState);
|
||
|
||
document.addEventListener('click', (event) => {
|
||
if (event.target.closest('.sg-pulldown-demo')) {
|
||
return;
|
||
}
|
||
|
||
document.querySelectorAll('.sg-pulldown-demo').forEach((demo) => {
|
||
const trigger = demo.querySelector('.sg-pulldown-demo__trigger');
|
||
demo.dataset.open = 'false';
|
||
if (trigger) {
|
||
trigger.setAttribute('aria-expanded', 'false');
|
||
}
|
||
});
|
||
});
|
||
</script>
|
||
|
||
</body>
|
||
</html>
|