@use 'sass:map';
@use '~@angular/material' as mat;
@use '../../form-field-wrappers/lib/form-field-wrappers-theme' as form-field-wrappers;

@mixin color($theme) {
  $config: mat.get-color-config($theme);
  $primary: map.get($config, 'primary');
  $accent: map.get($config, 'accent');
  $foreground: map.get($config, 'foreground');
  $is-dark: map.get($config, is-dark);

  mtna-i18n-editor,
  mtna-i18n-multi-line-editor {
    mtna-i18n-editor-focus-indicator {
      background-color: transparent;
      &.mtna-i18n-editor-focus-indicator-show-inactive {
        background-color: mat.get-color-from-palette($foreground, divider);
      }
      &::after {
        background-color: mat.get-color-from-palette($primary);
      }
    }

    .mat-form-field {
      .mat-form-field-suffix {
        color: mat.get-color-from-palette($foreground, secondary-text);
      }
    }

    &.mat-accent {
      @include form-field-wrappers.select-wrapper-theme($accent, $foreground, $is-dark);
      @include form-field-wrappers.tab-wrapper-theme($accent, $foreground, $is-dark);
    }
    &.mat-primary {
      @include form-field-wrappers.select-wrapper-theme($primary, $foreground, $is-dark);
      @include form-field-wrappers.tab-wrapper-theme($primary, $foreground, $is-dark);
    }
  }
}

@mixin typography($theme) {
}

@mixin theme($theme) {
  $config: mat.get-color-config($theme);
  @if $config != null {
    @include color($theme);
  }

  $typography-config: mat.get-typography-config($theme);
  @if $typography-config != null {
    @include typography($theme);
  }
}
