/** * Copyright since 2025 Mifos Initiative * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * Shared mixin for the client stepper steps. * * When the per-step `readOnly` flag is on, the host calls `form.disable()` which * cascades Material's default `~0.38 opacity` onto every outlined input, * select, checkbox and label. Visually it reads as "blurry". This mixin keeps * the disabled affordances (no caret, no border highlight on focus, no * pointer cursor on selects) but restores crisp colour + weight so the saved * values stay legible. * * Usage in a step component's .scss: * * @use '../stepper-readonly-overrides' as readonly; * * :host { * @include readonly.readonly-form-overrides; * } */ @mixin readonly-form-overrides { /* ─── MDC design-token overrides ─── These CSS custom properties feed Material's disabled-state colors at the token level — higher in the cascade than any rule selector — so they win even against Material's own !important declarations baked into MDC styles. */ --mdc-outlined-text-field-disabled-input-text-color: #0f172a; --mdc-outlined-text-field-disabled-label-text-color: #64748b; --mdc-outlined-text-field-disabled-outline-color: #cbd5e1; --mdc-outlined-text-field-disabled-supporting-text-color: #64748b; --mdc-outlined-text-field-disabled-leading-icon-color: #475569; --mdc-outlined-text-field-disabled-trailing-icon-color: #475569; --mdc-filled-text-field-disabled-input-text-color: #0f172a; --mdc-filled-text-field-disabled-label-text-color: #64748b; --mat-select-disabled-trigger-text-color: #0f172a; --mat-form-field-disabled-input-text-color: #0f172a; --mat-form-field-disabled-input-text-placeholder-color: #64748b; --mdc-checkbox-disabled-selected-icon-color: #059669; --mdc-checkbox-disabled-unselected-icon-color: #94a3b8; ::ng-deep { /* Outlined form fields in disabled state */ .mat-mdc-form-field.mat-form-field-appearance-outline.mat-form-field-disabled { opacity: 1; /* Input value */ .mat-mdc-input-element, input.mat-mdc-input-element, textarea.mat-mdc-input-element { color: #0f172a !important; -webkit-text-fill-color: #0f172a !important; font-weight: 600; caret-color: transparent; } /* Floating label */ .mat-mdc-floating-label, .mdc-floating-label { color: #64748b !important; opacity: 1 !important; } /* Outline border */ .mdc-notched-outline__leading, .mdc-notched-outline__notch, .mdc-notched-outline__trailing { border-color: #cbd5e1 !important; border-width: 1px !important; } /* matPrefix / matSuffix icons */ .field-prefix-icon mat-icon, .mat-mdc-form-field-icon-prefix mat-icon, .mat-mdc-form-field-icon-suffix mat-icon { color: #475569 !important; opacity: 1; } /* Hint text */ .mat-mdc-form-field-hint { color: #64748b !important; opacity: 1; } /* mat-select value + arrow. MDC nests the visible text deeper than `.mat-mdc-select-value` — the actual `` that renders the chosen option is `.mat-mdc-select-min-line`. Without explicitly forcing it, MDC's disabled-state CSS wins and the text reads as washed-out grey. */ .mat-mdc-select-value-text, .mat-mdc-select-value, .mat-mdc-select-min-line, .mat-mdc-select-placeholder { color: #0f172a !important; -webkit-text-fill-color: #0f172a !important; font-weight: 600; opacity: 1 !important; } .mat-mdc-select-arrow { color: #94a3b8 !important; } /* The disabled select wrapper itself drops opacity in MDC — undo that. */ .mat-mdc-select-disabled, .mat-mdc-select-disabled .mat-mdc-select-trigger { opacity: 1 !important; } /* The MDC text-field root (parent of input + outline) also gets a disabled modifier. Strip any opacity it applies. */ .mdc-text-field--disabled { opacity: 1 !important; .mdc-text-field__input, input, textarea { color: #0f172a !important; -webkit-text-fill-color: #0f172a !important; opacity: 1 !important; } } /* Native suffix icon buttons (e.g. eye-toggle) */ .toggle-vis-btn, .mat-mdc-icon-button { color: #64748b !important; opacity: 1; } } /* Disabled checkboxes — keep the check + label crisp */ .mat-mdc-checkbox-disabled { opacity: 1 !important; .mdc-form-field > label, .mat-mdc-checkbox-label, .mdc-label { color: #0f172a !important; opacity: 1 !important; font-weight: 500; } .mdc-checkbox__background { background-color: #059669 !important; border-color: #059669 !important; } .mdc-checkbox__checkmark { color: #fff !important; } } /* Disabled mat-radio */ .mat-mdc-radio-button.mat-mdc-radio-disabled { opacity: 1 !important; .mdc-form-field > label, .mdc-label { color: #0f172a !important; opacity: 1 !important; font-weight: 500; } } /* Disabled mat-slide-toggle */ .mat-mdc-slide-toggle.mat-mdc-slide-toggle-disabled { opacity: 1 !important; } /* Native UA override — Chrome/Safari force their own grey on disabled form controls via `-webkit-text-fill-color`, which beats `color`. */ input:disabled, select:disabled, textarea:disabled { color: #0f172a !important; -webkit-text-fill-color: #0f172a !important; opacity: 1 !important; } } }