Files
espocrm/client/custom/css/checkbox-toggle-slider.css

307 lines
7.8 KiB
CSS

/**
* Custom CSS: Checkbox Toggle Slider
* Verwandelt alle Standard-Checkboxen in moderne On-Off-Slider
* Erstellt: Januar 2026
* Updated: Angepasst für EspoCRM Struktur (Label vor Input)
*/
/* ===== HAUPT-CHECKBOX STYLING ===== */
/* Standard-Checkbox verstecken und durch Slider ersetzen */
input[type="checkbox"].main-element,
input[type="checkbox"].form-checkbox,
.field[data-name] input[type="checkbox"] {
appearance: none;
-webkit-appearance: none;
-moz-appearance: none;
width: 44px;
height: 24px;
background-color: #ccc;
border-radius: 12px;
position: relative;
cursor: pointer;
transition: background-color 0.3s ease;
outline: none;
border: none;
vertical-align: middle;
margin: 0;
flex-shrink: 0;
}
/* Slider-Button (der runde Schalter) */
input[type="checkbox"].main-element::before,
input[type="checkbox"].form-checkbox::before,
.field[data-name] input[type="checkbox"]::before {
content: '';
position: absolute;
width: 18px;
height: 18px;
background-color: white;
border-radius: 50%;
top: 3px;
left: 3px;
transition: transform 0.3s ease, left 0.3s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
/* Checked State - Slider bewegt sich nach rechts und wird grün */
input[type="checkbox"].main-element:checked,
input[type="checkbox"].form-checkbox:checked,
.field[data-name] input[type="checkbox"]:checked {
background-color: #4CAF50;
}
input[type="checkbox"].main-element:checked::before,
input[type="checkbox"].form-checkbox:checked::before,
.field[data-name] input[type="checkbox"]:checked::before {
left: 23px;
}
/* Hover-Effekt */
input[type="checkbox"].main-element:hover,
input[type="checkbox"].form-checkbox:hover,
.field[data-name] input[type="checkbox"]:hover {
opacity: 0.9;
box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}
/* Focus State für Accessibility */
input[type="checkbox"].main-element:focus,
input[type="checkbox"].form-checkbox:focus,
.field[data-name] input[type="checkbox"]:focus {
outline: 2px solid #4CAF50;
outline-offset: 2px;
}
/* Disabled State */
input[type="checkbox"].main-element:disabled,
input[type="checkbox"].form-checkbox:disabled,
.field[data-name] input[type="checkbox"]:disabled {
background-color: #e0e0e0;
cursor: not-allowed;
opacity: 0.6;
}
input[type="checkbox"].main-element:disabled::before,
input[type="checkbox"].form-checkbox:disabled::before,
.field[data-name] input[type="checkbox"]:disabled::before {
background-color: #f5f5f5;
}
/* ===== FIELD CONTAINER STYLING ===== */
/* Field Container anpassen für besseres Layout */
.field[data-name] {
display: flex;
align-items: center;
min-height: 24px;
}
/* Boolean Field spezifisch */
.field.field-boolean {
display: flex;
align-items: center;
}
/* ===== DETAIL VIEW (Readonly) ===== */
/* Detail-Mode mit custom Attribut */
.field.field-boolean[data-value="true"] input[type="checkbox"]:disabled,
.field.field-boolean.detail-mode input[type="checkbox"] {
background-color: #4CAF50;
}
.field.field-boolean[data-value="true"] input[type="checkbox"]:disabled::before,
.field.field-boolean.detail-mode input[type="checkbox"]::before {
left: 23px;
}
.field.field-boolean[data-value="false"] input[type="checkbox"]:disabled,
.field.field-boolean.detail-mode input[type="checkbox"]:not(:checked) {
background-color: #ccc;
}
/* Text "Yes"/"No" in Detail-View ausblenden falls vorhanden */
.field.field-boolean.detail-mode span.text-muted {
display: none;
}
/* ===== LIST VIEW & TABLE CELLS ===== */
/* List View Checkboxen in Tabellen */
td.cell.cell-boolean input[type="checkbox"] {
width: 44px;
height: 24px;
}
/* ===== MODAL & INLINE EDIT ===== */
/* Modal-Body Checkboxen */
.modal-body .field[data-name] input[type="checkbox"] {
width: 44px;
height: 24px;
}
/* Inline Edit Mode */
.inline-edit-mode input[type="checkbox"] {
width: 44px;
height: 24px;
}
/* ===== FILTER & SEARCH ===== */
/* Filter-Panel Checkboxen */
.search-row input[type="checkbox"] {
width: 44px;
height: 24px;
}
/* Advanced Filters */
.filter-container input[type="checkbox"] {
width: 44px;
height: 24px;
}
/* ===== PREFERENCES & SETTINGS ===== */
/* Preferences/Settings Panels */
.panel-body input[type="checkbox"].form-checkbox {
width: 44px;
height: 24px;
margin-right: 8px;
}
/* ===== MASS ACTION CHECKBOXEN AUSNAHME ===== */
/* Mass Action Checkboxen - diese NICHT als Slider darstellen */
input[type="checkbox"].record-checkbox,
input[type="checkbox"].select-all,
td.cell-checkbox input[type="checkbox"],
th.cell-checkbox input[type="checkbox"] {
appearance: checkbox !important;
-webkit-appearance: checkbox !important;
-moz-appearance: checkbox !important;
width: auto !important;
height: auto !important;
background-color: transparent !important;
border-radius: 0 !important;
}
input[type="checkbox"].record-checkbox::before,
input[type="checkbox"].select-all::before,
td.cell-checkbox input[type="checkbox"]::before,
th.cell-checkbox input[type="checkbox"]::before {
display: none !important;
content: none !important;
}
/* ===== ALTERNATIVE FARBEN (Optional) ===== */
/* Warning State */
input[type="checkbox"][data-type="warning"]:checked {
background-color: #ff9800;
}
/* Danger/Error State */
input[type="checkbox"][data-type="danger"]:checked {
background-color: #f44336;
}
/* Info State */
input[type="checkbox"][data-type="info"]:checked {
background-color: #2196F3;
}
/* ===== ANIMATIONEN ===== */
/* Slide-In Animation beim Laden */
@keyframes slideIn {
from {
opacity: 0;
transform: scale(0.9);
}
to {
opacity: 1;
transform: scale(1);
}
}
input[type="checkbox"].main-element,
input[type="checkbox"].form-checkbox {
animation: slideIn 0.3s ease-out;
}
/* Smooth Toggle Animation */
input[type="checkbox"].main-element::before,
input[type="checkbox"].form-checkbox::before {
transition: left 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}
/* ===== DARK MODE UNTERSTÜTZUNG ===== */
@media (prefers-color-scheme: dark) {
input[type="checkbox"].main-element:not(:checked),
input[type="checkbox"].form-checkbox:not(:checked) {
background-color: #555;
}
input[type="checkbox"].main-element::before,
input[type="checkbox"].form-checkbox::before {
background-color: #f0f0f0;
}
input[type="checkbox"].main-element:disabled,
input[type="checkbox"].form-checkbox:disabled {
background-color: #444;
}
}
/* ===== RESPONSIVE ANPASSUNGEN ===== */
/* Mobile Geräte - etwas größere Touch-Targets */
@media (max-width: 768px) {
input[type="checkbox"].main-element,
input[type="checkbox"].form-checkbox {
width: 48px;
height: 26px;
}
input[type="checkbox"].main-element::before,
input[type="checkbox"].form-checkbox::before {
width: 20px;
height: 20px;
}
input[type="checkbox"].main-element:checked::before,
input[type="checkbox"].form-checkbox:checked::before {
left: 25px;
}
}
/* ===== ACCESSIBILITY VERBESSERUNGEN ===== */
/* High Contrast Mode Unterstützung */
@media (prefers-contrast: high) {
input[type="checkbox"].main-element,
input[type="checkbox"].form-checkbox {
border: 2px solid currentColor;
}
input[type="checkbox"].main-element:checked,
input[type="checkbox"].form-checkbox:checked {
background-color: #2d7a2e;
}
}
/* Reduced Motion für Nutzer mit Bewegungsempfindlichkeit */
@media (prefers-reduced-motion: reduce) {
input[type="checkbox"].main-element,
input[type="checkbox"].form-checkbox,
input[type="checkbox"].main-element::before,
input[type="checkbox"].form-checkbox::before {
transition: none;
animation: none;
}
}