@use '../../../../../styles' as *;

@mixin insertFlexField() {
  .flexField {
    width: 100%;
    height: fit-content;

    @include centerInsideContent();

    padding: 10px 12px;
    border-radius: 8px;
    gap: 12px;
    background-color: $white;
    box-shadow: 0 0 0 1px $gray-300, 0 1px 2px 0 #1018280D;
    box-sizing: border-box;

    .textIcon {
      flex: none;
      @include centerInsideContent();
      @include changeSvg($width: 20, $height: 20, $stroke: $gray-500, $flex: none);
    }

    .trashIcon {
      flex: none;
      @include centerInsideContent();
      @include changeSvg($width: 20, $height: 20, $stroke: $error-500, $flex: none);
    }

    .dropdownIcon {
      flex: none;
      @include centerInsideContent();
      @include changeSvg($width: 20, $height: 20, $stroke: $gray-500, $flex: none);
    }

    .inputField {
      flex: 1;
      min-width: 0; // Важное свойство, чтобы flexbox учитывал минимальное сжатие

      min-height: 24px;
      outline: none;
      padding: 0;
      margin: 0;
      border: none;
      background: none;
      text-wrap: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;

      @include fnt($size: 16, $line-height: 24, $weight: 400, $color: $gray-900);

      &::placeholder {
        @include fnt($size: 16, $line-height: 24, $weight: 400, $color: $gray-400);
      }
    }

    &.pointer {
      cursor: pointer;
    }

    &.focus {
      box-shadow: 0 0 0 4px #F2F4F7, 0 1px 2px 0 #1018280D;
    }


    &.isError {
      box-shadow: 0 0 0 1px $error-300, 0 1px 2px 0 #1018280D;

      &.focus {
        box-shadow: 0 0 0 4px #FEE4E2, 0 1px 2px 0 #1018280D;
      }
    }

    &.disabled {
      background-color: $gray-100;
      cursor: default;

      * {
        cursor: default;
      }

      .inputField {
        @include fnt($size: 16, $line-height: 24, $weight: 400, $color: $gray-500);
      }

      .textIcon {
        @include changeSvg($width: 20, $height: 20, $stroke: $gray-300);
      }

      .trashIcon {
        @include changeSvg($width: 20, $height: 20, $stroke: $gray-300);
      }

      .dropdownIcon {
        @include changeSvg($width: 20, $height: 20, $stroke: $gray-300);
      }
    }

    @content;
  }
}