Consolidate list card dialog interaction into layout 3
This commit is contained in:
+112
-114
@@ -147,89 +147,8 @@
|
|||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 class="sg-sub-heading sg-section-h2">Layout 3: List Card</h2>
|
<h2 class="sg-sub-heading sg-section-h2">Layout 3 - List Card inklusive Lösch- und Editier-Funktion</h2>
|
||||||
<div class="sg-object-card-grid" aria-label="VSF List Card Layout List Card">
|
<div class="sg-object-card-grid sg-delete-confirmation-pattern sg-delete-confirmation-pattern__stage" data-pattern="overlay-card" data-dialog-open="false" aria-label="VSF List Card Layout List Card">
|
||||||
<article class="sg-card sg-object-card" data-pattern="object-group-card" aria-label="List Card">
|
|
||||||
<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">NAME DER LISTE</div>
|
|
||||||
<div class="sg-sandwich-menu-wrap" data-open="false" data-align="right" data-component="sandwich-menu" data-component-size="small">
|
|
||||||
<button class="sg-interaction-element sg-sandwich-button sg-sandwich-button--small" type="button" aria-expanded="false" aria-label="Menü öffnen" data-component-part="sandwich-trigger">
|
|
||||||
<span class="sg-sandwich-button__icon" aria-hidden="true">
|
|
||||||
<span class="sg-sandwich-button__line"></span>
|
|
||||||
<span class="sg-sandwich-button__line"></span>
|
|
||||||
<span class="sg-sandwich-button__line"></span>
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
<div class="sg-sandwich-menu-panel" aria-label="Ausgeklapptes Menü" data-component-part="sandwich-panel">
|
|
||||||
<a class="sg-sandwich-menu-link" href="#">Editieren</a>
|
|
||||||
<a class="sg-sandwich-menu-link" href="#">Liste loeschen</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
<div class="sg-card-segment sg-card-segment--body sg-card-segment--gray" data-pattern-part="list-card-placeholder-top">
|
|
||||||
<div class="sg-score-bar-list sg-score-bar-list--single-score" aria-label="Gesamtscore-Balken" data-component="score-bar-list">
|
|
||||||
<div class="sg-score-bar-item" data-component="score-bar">
|
|
||||||
<p class="sg-score-bar-label sg-bar-label" data-component-part="score-label">Medianscore:</p>
|
|
||||||
<div class="sg-score-bar sg-score-bar--marker-mid" role="img" aria-label="Gesamtscore 96 Prozent mit Median-Marker bei 50 Prozent" data-component-part="score-track">
|
|
||||||
<div class="sg-score-bar__value sg-score-bar__value--positive sg-score-bar__value--w96" data-component-part="score-value" data-component-state="positive"></div>
|
|
||||||
</div>
|
|
||||||
<p class="sg-bar-label sg-score-state--positive" data-component-part="score-state">attraktiv</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sg-card-segment sg-card-segment--body sg-card-segment--gray" data-pattern-part="list-card-placeholder-bottom">
|
|
||||||
<div class="sg-text-layout-pattern__sample sg-text-layout-pattern__three-column-distributed" aria-label="Company Kennzahlen dreispaltig verteilt" data-pattern-part="company-card-metrics-three-column">
|
|
||||||
<p class="sg-body sg-text-layout-pattern__column sg-text-layout-pattern__column--align-left">
|
|
||||||
PE: <span class="sg-data-table__value">28.8</span>
|
|
||||||
</p>
|
|
||||||
<p class="sg-body sg-text-layout-pattern__column sg-text-layout-pattern__column--align-center">
|
|
||||||
PE forw.: <span class="sg-data-table__value sg-company-card__metric-negative" data-component-state="negative">23.3</span>
|
|
||||||
</p>
|
|
||||||
<p class="sg-body sg-text-layout-pattern__column sg-text-layout-pattern__column--align-right">
|
|
||||||
PEG: <span class="sg-data-table__value sg-company-card__metric-negative" data-component-state="negative">3.54</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sg-card-segment sg-card-segment--body sg-card-segment--white sg-object-card__content" data-pattern-part="company-card-content">
|
|
||||||
<p class="sg-table-label sg-company-card__analysis-title">Median-Subscores:</p>
|
|
||||||
<div class="sg-score-bar-list sg-company-card__analysis-bars" aria-label="Fundamentalanalyse Score-Balken" data-component="score-bar-list">
|
|
||||||
<div class="sg-score-bar-item" data-component="score-bar">
|
|
||||||
<p class="sg-score-bar-label sg-bar-label" data-component-part="score-label">Marktbewertung:</p>
|
|
||||||
<div class="sg-score-bar sg-score-bar--marker-mid" data-component-part="score-track">
|
|
||||||
<div class="sg-score-bar__value sg-score-bar__value--positive sg-score-bar__value--w96" data-component-part="score-value" data-component-state="positive"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sg-score-bar-item" data-component="score-bar">
|
|
||||||
<p class="sg-score-bar-label sg-bar-label" data-component-part="score-label">Wachstum:</p>
|
|
||||||
<div class="sg-score-bar sg-score-bar--marker-mid" data-component-part="score-track">
|
|
||||||
<div class="sg-score-bar__value sg-score-bar__value--neutral sg-score-bar__value--w64" data-component-part="score-value" data-component-state="neutral"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sg-score-bar-item" data-component="score-bar">
|
|
||||||
<p class="sg-score-bar-label sg-bar-label" data-component-part="score-label">Profitabilität:</p>
|
|
||||||
<div class="sg-score-bar sg-score-bar--marker-mid" data-component-part="score-track">
|
|
||||||
<div class="sg-score-bar__value sg-score-bar__value--negative sg-score-bar__value--w35" data-component-part="score-value" data-component-state="negative"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="sg-score-bar-item" data-component="score-bar">
|
|
||||||
<p class="sg-score-bar-label sg-bar-label" data-component-part="score-label">Stabilität:</p>
|
|
||||||
<div class="sg-score-bar sg-score-bar--marker-mid" data-component-part="score-track">
|
|
||||||
<div class="sg-score-bar__value sg-score-bar__value--neutral sg-score-bar__value--w64" data-component-part="score-value" data-component-state="neutral"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p class="sg-body sg-company-card__summary sg-vsf-list-card__summary">BESCHREIBUNG LISTE</p>
|
|
||||||
</div>
|
|
||||||
<footer class="sg-card-segment sg-card-segment--body sg-card-segment--white" data-pattern-part="list-card-actions">
|
|
||||||
<div class="sg-object-card__actions">
|
|
||||||
<button class="sg-interaction-element sg-button sg-button--active sg-object-card__action" type="button">Unternehmen ansehen</button>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
</article>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2 class="sg-sub-heading sg-section-h2">Layout 4: Liste löschen</h2>
|
|
||||||
<div class="sg-object-card-grid sg-delete-confirmation-pattern sg-delete-confirmation-pattern__stage" data-pattern="overlay-card" aria-label="VSF List Card Layout Liste löschen">
|
|
||||||
<article class="sg-card sg-object-card sg-delete-confirmation-pattern__target" data-pattern="object-group-card" aria-label="List Card">
|
<article class="sg-card sg-object-card sg-delete-confirmation-pattern__target" data-pattern="object-group-card" aria-label="List Card">
|
||||||
<header class="sg-card-segment sg-card-segment--header sg-card-segment--darkblue sg-object-card__header" data-pattern-part="object-group-card-header">
|
<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">NAME DER LISTE</div>
|
<div class="sg-strong">NAME DER LISTE</div>
|
||||||
@@ -242,8 +161,8 @@
|
|||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
<div class="sg-sandwich-menu-panel" aria-label="Ausgeklapptes Menü" data-component-part="sandwich-panel">
|
<div class="sg-sandwich-menu-panel" aria-label="Ausgeklapptes Menü" data-component-part="sandwich-panel">
|
||||||
<a class="sg-sandwich-menu-link" href="#">Editieren</a>
|
<a class="sg-sandwich-menu-link" href="#!" data-vsf-open-dialog="edit">Editieren</a>
|
||||||
<a class="sg-sandwich-menu-link" href="#">Liste loeschen</a>
|
<a class="sg-sandwich-menu-link" href="#!" data-vsf-open-dialog="delete">Liste loeschen</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
@@ -308,37 +227,46 @@
|
|||||||
</footer>
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
<article class="sg-card sg-delete-confirmation-pattern__floating-card" aria-label="Löschbestätigung" role="dialog" aria-modal="true" aria-labelledby="vsf-list-card-delete-confirmation-title">
|
<article class="sg-card sg-delete-confirmation-pattern__floating-card" aria-label="Liste editieren" role="dialog" aria-modal="true" aria-labelledby="vsf-list-card-inline-edit-title" data-vsf-dialog="edit" hidden>
|
||||||
<div class="sg-card-segment sg-card-segment--body sg-delete-confirmation-pattern__body">
|
<div class="sg-card-segment sg-card-segment--body sg-delete-confirmation-pattern__body">
|
||||||
<p class="sg-body sg-delete-confirmation-pattern__text" id="vsf-list-card-delete-confirmation-title"><strong>Möchtest du NAME DER LISTE wirklich löschen?</strong></p>
|
<p class="sg-body sg-delete-confirmation-pattern__text" id="vsf-list-card-inline-edit-title"><strong>Liste editieren</strong></p>
|
||||||
<p class="sg-body sg-delete-confirmation-pattern__text">Du kannst das nicht rückgängig machen. Bestätige durch Eingabe von <span class="sg-delete-confirmation-pattern__code">DELETE</span>.</p>
|
<div class="sg-form-sections-card__field-group">
|
||||||
|
<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" value="NAME DER LISTE" aria-label="Name" data-vsf-edit-input>
|
||||||
|
</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" aria-label="Beschreibung" data-vsf-edit-input>BESCHREIBUNG LISTE</textarea>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="sg-delete-confirmation-pattern__actions">
|
||||||
|
<button class="sg-interaction-element sg-button sg-button--active" type="button" data-vsf-dialog-close>Abbrechen</button>
|
||||||
|
<button class="sg-interaction-element sg-button sg-button--process sg-button--process-inactive" type="button" disabled aria-disabled="true" data-vsf-edit-save>
|
||||||
|
Speichern
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="sg-card sg-delete-confirmation-pattern__floating-card" aria-label="Löschbestätigung" role="dialog" aria-modal="true" aria-labelledby="vsf-list-card-inline-delete-title" data-vsf-dialog="delete" hidden>
|
||||||
|
<div class="sg-card-segment sg-card-segment--body sg-delete-confirmation-pattern__body">
|
||||||
|
<p class="sg-body sg-delete-confirmation-pattern__text" id="vsf-list-card-inline-delete-title"><strong>Möchtest du NAME DER LISTE wirklich löschen?</strong></p>
|
||||||
|
<p class="sg-body sg-delete-confirmation-pattern__text">Du kannst das nicht rückgängig machen. Bestätige durch Eingabe von <span class="sg-delete-confirmation-pattern__code">DELETE</span>.</p>
|
||||||
<label class="sg-labeled-input-row sg-delete-confirmation-pattern__input-row">
|
<label class="sg-labeled-input-row sg-delete-confirmation-pattern__input-row">
|
||||||
<span class="sg-label">Bestätigung</span>
|
<span class="sg-label">Bestätigung</span>
|
||||||
<input
|
<input class="sg-interaction-element sg-input-single-line sg-input-single-line--inactive-selectable sg-form-inactive-selectable" type="text" placeholder="DELETE" aria-label="Löschbestätigung durch DELETE" data-vsf-delete-confirmation-input>
|
||||||
class="sg-interaction-element sg-input-single-line sg-input-single-line--inactive-selectable sg-form-inactive-selectable"
|
|
||||||
type="text"
|
|
||||||
placeholder="DELETE"
|
|
||||||
aria-label="Löschbestätigung durch DELETE"
|
|
||||||
data-vsf-delete-confirmation-input
|
|
||||||
>
|
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="sg-delete-confirmation-pattern__actions">
|
<div class="sg-delete-confirmation-pattern__actions">
|
||||||
<button class="sg-interaction-element sg-button sg-button--active" type="button">Abbrechen</button>
|
<button class="sg-interaction-element sg-button sg-button--active" type="button" data-vsf-dialog-close>Abbrechen</button>
|
||||||
<button
|
<button class="sg-interaction-element sg-button sg-button--process sg-button--process-inactive" type="button" disabled aria-disabled="true" data-vsf-delete-confirmation-submit>
|
||||||
class="sg-interaction-element sg-button sg-button--process sg-button--process-inactive"
|
|
||||||
type="button"
|
|
||||||
disabled
|
|
||||||
aria-disabled="true"
|
|
||||||
data-vsf-delete-confirmation-submit
|
|
||||||
>
|
|
||||||
Löschen
|
Löschen
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -432,21 +360,91 @@
|
|||||||
});
|
});
|
||||||
updateProcessButtonState();
|
updateProcessButtonState();
|
||||||
|
|
||||||
const deleteConfirmationInput = document.querySelector('[data-vsf-delete-confirmation-input]');
|
const editInputs = document.querySelectorAll('[data-vsf-edit-input]');
|
||||||
const deleteConfirmationSubmitButton = document.querySelector('[data-vsf-delete-confirmation-submit]');
|
const editSaveButton = document.querySelector('[data-vsf-edit-save]');
|
||||||
|
const deleteDialogInput = document.querySelector('[data-vsf-delete-confirmation-input]');
|
||||||
|
const deleteDialogSubmitButton = document.querySelector('[data-vsf-delete-confirmation-submit]');
|
||||||
|
|
||||||
if (deleteConfirmationInput && deleteConfirmationSubmitButton) {
|
if (editInputs.length > 0 && editSaveButton) {
|
||||||
const updateDeleteConfirmationState = () => {
|
const updateEditSaveState = () => {
|
||||||
const isValid = deleteConfirmationInput.value === 'DELETE';
|
const hasInput = Array.from(editInputs).some((field) => field.value.trim().length > 0);
|
||||||
deleteConfirmationSubmitButton.disabled = !isValid;
|
editSaveButton.disabled = !hasInput;
|
||||||
deleteConfirmationSubmitButton.setAttribute('aria-disabled', String(!isValid));
|
editSaveButton.setAttribute('aria-disabled', String(!hasInput));
|
||||||
deleteConfirmationSubmitButton.classList.toggle('sg-button--process-inactive', !isValid);
|
editSaveButton.classList.toggle('sg-button--process-inactive', !hasInput);
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteConfirmationInput.addEventListener('input', updateDeleteConfirmationState);
|
editInputs.forEach((field) => {
|
||||||
updateDeleteConfirmationState();
|
field.addEventListener('input', updateEditSaveState);
|
||||||
|
});
|
||||||
|
updateEditSaveState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (deleteDialogInput && deleteDialogSubmitButton) {
|
||||||
|
const updateDeleteDialogState = () => {
|
||||||
|
const isValid = deleteDialogInput.value === 'DELETE';
|
||||||
|
deleteDialogSubmitButton.disabled = !isValid;
|
||||||
|
deleteDialogSubmitButton.setAttribute('aria-disabled', String(!isValid));
|
||||||
|
deleteDialogSubmitButton.classList.toggle('sg-button--process-inactive', !isValid);
|
||||||
|
};
|
||||||
|
|
||||||
|
deleteDialogInput.addEventListener('input', updateDeleteDialogState);
|
||||||
|
updateDeleteDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
const closeStageDialogs = (stage) => {
|
||||||
|
stage.querySelectorAll('.sg-delete-confirmation-pattern__floating-card').forEach((dialog) => {
|
||||||
|
dialog.hidden = true;
|
||||||
|
});
|
||||||
|
stage.dataset.dialogOpen = 'false';
|
||||||
|
};
|
||||||
|
|
||||||
|
document.querySelectorAll('.sg-delete-confirmation-pattern__stage').forEach((stage) => {
|
||||||
|
closeStageDialogs(stage);
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll('[data-vsf-open-dialog]').forEach((link) => {
|
||||||
|
link.addEventListener('click', (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
const stage = link.closest('.sg-delete-confirmation-pattern__stage');
|
||||||
|
if (!stage) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const target = link.getAttribute('data-vsf-open-dialog');
|
||||||
|
const dialog = stage.querySelector(`.sg-delete-confirmation-pattern__floating-card[data-vsf-dialog="${target}"]`);
|
||||||
|
|
||||||
|
if (!dialog) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
closeStageDialogs(stage);
|
||||||
|
dialog.hidden = false;
|
||||||
|
stage.dataset.dialogOpen = 'true';
|
||||||
|
|
||||||
|
const menuWrap = link.closest('.sg-sandwich-menu-wrap');
|
||||||
|
const menuButton = menuWrap?.querySelector('.sg-sandwich-button');
|
||||||
|
if (menuWrap) {
|
||||||
|
menuWrap.dataset.open = 'false';
|
||||||
|
}
|
||||||
|
if (menuButton) {
|
||||||
|
menuButton.setAttribute('aria-expanded', 'false');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.querySelectorAll('[data-vsf-dialog-close], [data-vsf-delete-confirmation-submit], [data-vsf-edit-save]').forEach((button) => {
|
||||||
|
button.addEventListener('click', (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
const stage = button.closest('.sg-delete-confirmation-pattern__stage');
|
||||||
|
if (!stage) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
closeStageDialogs(stage);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
document.querySelectorAll('.sg-sandwich-menu-wrap').forEach((wrap) => {
|
document.querySelectorAll('.sg-sandwich-menu-wrap').forEach((wrap) => {
|
||||||
const button = wrap.querySelector('.sg-sandwich-button');
|
const button = wrap.querySelector('.sg-sandwich-button');
|
||||||
const panel = wrap.querySelector('.sg-sandwich-menu-panel');
|
const panel = wrap.querySelector('.sg-sandwich-menu-panel');
|
||||||
|
|||||||
@@ -21,10 +21,14 @@
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
background: var(--surface-delete-confirmation-target-dim-overlay);
|
background: var(--surface-delete-confirmation-target-dim-overlay);
|
||||||
opacity: var(--layout-delete-confirmation-target-dim-opacity);
|
opacity: 0;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sg-delete-confirmation-pattern__stage[data-dialog-open="true"] .sg-delete-confirmation-pattern__target::after {
|
||||||
|
opacity: var(--layout-delete-confirmation-target-dim-opacity);
|
||||||
|
}
|
||||||
|
|
||||||
.sg-delete-confirmation-pattern__floating-card {
|
.sg-delete-confirmation-pattern__floating-card {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
@@ -37,6 +41,10 @@
|
|||||||
box-shadow: var(--shadow-overlay);
|
box-shadow: var(--shadow-overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sg-delete-confirmation-pattern__floating-card[hidden] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.sg-delete-confirmation-pattern__body {
|
.sg-delete-confirmation-pattern__body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
Reference in New Issue
Block a user