/*!
 * SPDX-License-Identifier: Apache-2.0
 *
 * The OpenSearch Contributors require contributions made to
 * this file be licensed under the Apache-2.0 license or a
 * compatible open source license.
 *
 * Modifications Copyright OpenSearch Contributors. See
 * GitHub history for details.
 */

/**
 * 1. Leave room for caret.
 * 2. Ensure the descenders don't get cut off
 * 3. Makes sure the height is correct when there's no selection
 */

.ouiSuperSelectControl {
  @include ouiFormControlStyle;
  @include ouiFormControlWithIcon($side: 'right'); /* 1 */
  @include ouiFormControlIsLoading($isNextToIcon: true);

  display: block; /* 3 */
  text-align: left;
  line-height: $ouiFormControlHeight; /* 2 */
  padding-top: 0; /* 2 */
  padding-bottom: 0; /* 2 */
  // Truncate the text
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  &-isInvalid {
    @include ouiFormControlInvalidStyle;
  }

  &--compressed {
    @include ouiFormControlWithIcon($side: 'right', $compressed: true); /* 1 */
    line-height: $ouiFormControlCompressedHeight; /* 2 */
    padding-top: 0; /* 2 */
    padding-bottom: 0; /* 2 */
  }

  &.ouiSuperSelect--isOpen__button { // since this is a button, we also want the visual indicator of active when options are shown
    @include ouiFormControlFocusStyle;
  }
}
