Make multiselect pulldown desktop match mobile
This commit is contained in:
1 parent
d88540d859
commit
23b1c4b47d
4 files changed
+47
-125
No files matched your search
@@ -390,28 +390,6 @@
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateMultiselectLabelAlignment = () => {
|
|
||||||
document.querySelectorAll('.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-pulldown-panel').forEach((panel) => {
|
|
||||||
const labels = panel.querySelectorAll(
|
|
||||||
'.sg-slider-row[data-activatable="true"] > .sg-label, .sg-radio-activatable-group > .sg-label, [data-pulldown-filter-row] > .sg-pulldown-panel__label'
|
|
||||||
);
|
|
||||||
|
|
||||||
let maxWidth = 0;
|
|
||||||
labels.forEach((label) => {
|
|
||||||
const width = Math.ceil(label.scrollWidth || label.getBoundingClientRect().width);
|
|
||||||
if (width > maxWidth) {
|
|
||||||
maxWidth = width;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (maxWidth > 0) {
|
|
||||||
panel.style.setProperty('--sg-multiselect-label-column-width', `${maxWidth}px`);
|
|
||||||
} else {
|
|
||||||
panel.style.removeProperty('--sg-multiselect-label-column-width');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
document.querySelectorAll('.sg-slider-row').forEach((row) => {
|
document.querySelectorAll('.sg-slider-row').forEach((row) => {
|
||||||
const slider = row.querySelector('.sg-slider');
|
const slider = row.querySelector('.sg-slider');
|
||||||
const valueOutput = row.querySelector('.sg-slider-value');
|
const valueOutput = row.querySelector('.sg-slider-value');
|
||||||
@@ -500,9 +478,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
updateMultiselectLabelAlignment();
|
|
||||||
window.addEventListener('resize', updateMultiselectLabelAlignment);
|
|
||||||
|
|
||||||
document.querySelectorAll('.sg-pulldown-demo').forEach((demo) => {
|
document.querySelectorAll('.sg-pulldown-demo').forEach((demo) => {
|
||||||
const trigger = demo.querySelector('.sg-pulldown-demo__trigger');
|
const trigger = demo.querySelector('.sg-pulldown-demo__trigger');
|
||||||
|
|
||||||
@@ -535,8 +510,6 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateMultiselectLabelAlignment();
|
|
||||||
|
|
||||||
const panel = demo.querySelector('.sg-pulldown-panel');
|
const panel = demo.querySelector('.sg-pulldown-panel');
|
||||||
if (!panel) {
|
if (!panel) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -129,7 +129,6 @@
|
|||||||
|
|
||||||
<h3 class="sg-sub-heading sg-section-h3">Multiselektions-Pulldown</h3>
|
<h3 class="sg-sub-heading sg-section-h3">Multiselektions-Pulldown</h3>
|
||||||
<table class="sg-foundation-table sg-table-label"><thead><tr><th>Semantischer Token</th><th>Verwendeter Foundation-Token</th><th>Beschreibung Verwendungszweck im Pattern</th></tr></thead><tbody>
|
<table class="sg-foundation-table sg-table-label"><thead><tr><th>Semantischer Token</th><th>Verwendeter Foundation-Token</th><th>Beschreibung Verwendungszweck im Pattern</th></tr></thead><tbody>
|
||||||
<tr><td>layout-multiselect-pulldown-label-column-width-fallback</td><td>max-content</td><td>Fallback-Breite der gemeinsamen Labelspalte im Panel, bis die längste Labelbreite per Pattern-Logik ermittelt wurde.</td></tr>
|
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
|
|
||||||
<h3 class="sg-sub-heading sg-section-h3">Overlay Card</h3>
|
<h3 class="sg-sub-heading sg-section-h3">Overlay Card</h3>
|
||||||
|
|||||||
@@ -82,7 +82,6 @@
|
|||||||
--layout-pulldown-panel-form-mobile-width: 90%;
|
--layout-pulldown-panel-form-mobile-width: 90%;
|
||||||
--layer-pulldown-panel: var(--dimension-layer-pulldown-panel);
|
--layer-pulldown-panel: var(--dimension-layer-pulldown-panel);
|
||||||
--layout-multiselect-pulldown-panel-desktop-width: var(--dimension-multiselect-pulldown-panel-desktop-width);
|
--layout-multiselect-pulldown-panel-desktop-width: var(--dimension-multiselect-pulldown-panel-desktop-width);
|
||||||
--layout-multiselect-pulldown-label-column-width-fallback: max-content;
|
|
||||||
--layout-input-label-width: var(--dimension-input-label-width);
|
--layout-input-label-width: var(--dimension-input-label-width);
|
||||||
--layout-input-field-desktop-width: var(--dimension-input-field-desktop-width);
|
--layout-input-field-desktop-width: var(--dimension-input-field-desktop-width);
|
||||||
--layout-input-field-max-width: var(--dimension-input-field-max-width);
|
--layout-input-field-max-width: var(--dimension-input-field-max-width);
|
||||||
|
|||||||
@@ -93,21 +93,43 @@
|
|||||||
margin-top: var(--spacing-large);
|
margin-top: var(--spacing-large);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-options-row__left > .sg-pulldown-demo {
|
||||||
|
flex: 1 1 100%;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-options-row__left > .sg-pulldown-demo .sg-pulldown {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-pulldown-panel {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-pulldown-panel {
|
||||||
--sg-multiselect-label-column-width: var(--layout-multiselect-pulldown-label-column-width-fallback);
|
width: min(
|
||||||
|
var(--layout-pulldown-panel-form-mobile-width),
|
||||||
|
calc(100vw - (2 * var(--spacing-large)))
|
||||||
|
);
|
||||||
|
min-width: 0;
|
||||||
|
max-width: calc(100vw - (2 * var(--spacing-large)));
|
||||||
|
}
|
||||||
|
|
||||||
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-pulldown-panel .sg-form-sections-card-wrapper,
|
||||||
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-pulldown-panel .sg-form-sections-card {
|
||||||
|
min-width: 0;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] > .sg-label,
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] > .sg-label,
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group > .sg-label,
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group > .sg-label,
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] > .sg-pulldown-panel__label {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] > .sg-pulldown-panel__label {
|
||||||
white-space: nowrap;
|
white-space: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: max-content var(--sg-multiselect-label-column-width) minmax(0, 1fr) auto;
|
grid-template-columns: max-content minmax(0, 1fr) auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
column-gap: var(--spacing-large);
|
column-gap: var(--spacing-large);
|
||||||
|
row-gap: var(--spacing-small);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"].sg-slider-row--inactive-selectable {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"].sg-slider-row--inactive-selectable {
|
||||||
@@ -127,25 +149,31 @@
|
|||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] .sg-mode-toggle {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] .sg-mode-toggle {
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
|
grid-row: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] .sg-label {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] .sg-label {
|
||||||
grid-column: 2;
|
grid-column: 2;
|
||||||
|
grid-row: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] .sg-slider {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] .sg-slider {
|
||||||
grid-column: 3;
|
grid-column: 1 / 3;
|
||||||
|
grid-row: 2;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
max-width: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] .sg-slider-value {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] .sg-slider-value {
|
||||||
grid-column: 4;
|
grid-column: 3;
|
||||||
|
grid-row: 2;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
min-width: 0;
|
min-width: calc(var(--interaction-height) * 1.25);
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
|
align-self: center;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] {
|
||||||
@@ -154,22 +182,26 @@
|
|||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: max-content var(--sg-multiselect-label-column-width) minmax(0, 1fr);
|
grid-template-columns: max-content minmax(0, 1fr);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
column-gap: var(--spacing-large);
|
column-gap: var(--spacing-large);
|
||||||
|
row-gap: var(--spacing-small);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group > .sg-label {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group > .sg-label {
|
||||||
grid-column: 2;
|
grid-column: 2;
|
||||||
|
grid-row: 1;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group > .sg-mode-toggle {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group > .sg-mode-toggle {
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
|
grid-row: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group > .sg-radio-activatable-group__choices {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group > .sg-radio-activatable-group__choices {
|
||||||
grid-column: 3;
|
grid-column: 1 / -1;
|
||||||
|
grid-row: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group[data-component-state="inactive-selectable"] > .sg-radio-activatable-group__choices {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group[data-component-state="inactive-selectable"] > .sg-radio-activatable-group__choices {
|
||||||
@@ -183,20 +215,24 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] {
|
||||||
grid-template-columns: max-content var(--sg-multiselect-label-column-width) minmax(0, 1fr);
|
grid-template-columns: max-content minmax(0, 1fr);
|
||||||
column-gap: var(--spacing-large);
|
column-gap: var(--spacing-large);
|
||||||
|
row-gap: var(--spacing-small);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] > .sg-mode-toggle {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] > .sg-mode-toggle {
|
||||||
grid-column: 1;
|
grid-column: 1;
|
||||||
|
grid-row: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] > .sg-pulldown-panel__label {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] > .sg-pulldown-panel__label {
|
||||||
grid-column: 2;
|
grid-column: 2;
|
||||||
|
grid-row: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] > .sg-pulldown {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] > .sg-pulldown {
|
||||||
grid-column: 3;
|
grid-column: 1 / -1;
|
||||||
|
grid-row: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row].sg-pulldown-panel__row--disabled {
|
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row].sg-pulldown-panel__row--disabled {
|
||||||
@@ -208,91 +244,6 @@
|
|||||||
opacity: var(--disabled-opacity);
|
opacity: var(--disabled-opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-pulldown-demo .sg-pulldown-panel {
|
|
||||||
min-width: 100%;
|
|
||||||
width: max-content;
|
|
||||||
max-width: calc(100vw - (2 * var(--spacing-large)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 48rem) {
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-pulldown-panel {
|
|
||||||
min-width: 100%;
|
|
||||||
width: max-content;
|
|
||||||
max-width: calc(100vw - (2 * var(--spacing-large)));
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] {
|
|
||||||
grid-template-columns: max-content minmax(0, 1fr) auto;
|
|
||||||
row-gap: var(--spacing-small);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] > .sg-label,
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group > .sg-label,
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] > .sg-pulldown-panel__label {
|
|
||||||
white-space: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] .sg-mode-toggle {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] .sg-label {
|
|
||||||
grid-column: 2;
|
|
||||||
grid-row: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] .sg-slider {
|
|
||||||
grid-column: 1 / 3;
|
|
||||||
grid-row: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-slider-row[data-activatable="true"] .sg-slider-value {
|
|
||||||
grid-column: 3;
|
|
||||||
grid-row: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group {
|
|
||||||
grid-template-columns: max-content minmax(0, 1fr);
|
|
||||||
row-gap: var(--spacing-small);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group > .sg-label {
|
|
||||||
grid-column: 2;
|
|
||||||
grid-row: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group > .sg-mode-toggle {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] .sg-radio-activatable-group > .sg-radio-activatable-group__choices {
|
|
||||||
grid-column: 1 / -1;
|
|
||||||
grid-row: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] {
|
|
||||||
grid-template-columns: max-content minmax(0, 1fr);
|
|
||||||
row-gap: var(--spacing-small);
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] > .sg-mode-toggle {
|
|
||||||
grid-column: 1;
|
|
||||||
grid-row: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] > .sg-pulldown-panel__label {
|
|
||||||
grid-column: 2;
|
|
||||||
grid-row: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-options-row[data-pattern="multiselektions-pulldown"] [data-pulldown-filter-row] > .sg-pulldown {
|
|
||||||
grid-column: 1 / -1;
|
|
||||||
grid-row: 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.sg-form-sections-card__actions {
|
.sg-form-sections-card__actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|||||||
Reference in new issue
Block a user