/**
 *
 * @ai-apps/angular v2.152.0 | _color-dropdown.scss
 *
 * Copyright 2014, 2023 IBM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


@import '../../globals/vars';

// We want to make sure the title attribute of the carbon option element
// is not shown on hover, since that will be "[obj obj]" when we are
// using itemToString. Hence, we remove margins and padding here and add them
// to the child iot--color-dropdown__item instead.
.#{$iot-prefix}--color-dropdown {
  .#{$prefix}--list-box__menu-item__option {
    margin: 0;
    padding: 0;
    border-top: none;
  }

  .#{$iot-prefix}--color-dropdown__item {
    display: flex;
    height: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  // We need to recreate the border so that it doesn't stretch all the way
  // to the end of the container
  .#{$iot-prefix}--color-dropdown__item-border {
    display: flex;
    align-items: center;
    height: 100%;
    width: 100%;
    border-top: 1px solid $decorative-01;
  }
  // The new borders must be hidded on :hover, :active & .highlighted
  .#{$prefix}--list-box__menu-item:hover,
  .#{$prefix}--list-box__menu-item:active,
  .#{$prefix}--list-box__menu-item--highlighted {
    .#{$iot-prefix}--color-dropdown__item-border {
      border-color: transparent;
    }
    & + .bx--list-box__menu-item .#{$iot-prefix}--color-dropdown__item-border {
      border-color: transparent;
    }
  }

  // The new borders must be hidded for the topmost item
  .#{$prefix}--list-box__menu-item:first-of-type .#{$iot-prefix}--color-dropdown__item-border {
    border-color: transparent;
  }

  // When showing selected item we must remove the padding and border.
  .#{$prefix}--list-box__label .#{$iot-prefix}--color-dropdown__item {
    padding-left: 0;
    .#{$iot-prefix}--color-dropdown__item-border {
      border-color: transparent;
    }
  }
}

.#{$iot-prefix}--color-dropdown__color-sample {
  width: 1.5rem;
  height: 1.5rem;
  margin-right: $spacing-04;
  flex-shrink: 0;
}

.#{$iot-prefix}--color-dropdown__color-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

html[dir='rtl'] {
  .#{$iot-prefix}--color-dropdown__color-sample {
    margin-left: $spacing-04;
  }

  .#{$iot-prefix}--color-dropdown__item {
    padding-right: 2rem;
  }

  // When showing selected item we must remove the padding.
  .#{$prefix}--list-box__label .#{$iot-prefix}--color-dropdown__item {
    padding-right: 0;
  }
}
