// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0.

@import "../../common/variables";
@import "../popover/common";
@import "./common";

/*
HTML select

Markup:
<div class="#{$ns}-html-select {{.modifier}}">
  <select {{:modifier}}>
    <option selected>Choose an item...</option>
    <option value="1">One</option>
    <option value="2">Two</option>
    <option value="3">Three</option>
    <option value="4">Four</option>
  </select>
  <span class="#{$ns}-icon #{$ns}-icon-double-caret-vertical"></span>
</div>

:disabled - Disabled. Also add <code>.#{$ns}-disabled</code> to <code>.#{$ns}-select</code> for icon coloring (not shown below).
.#{$ns}-fill - Expand to fill parent container
.#{$ns}-large - Large size
.#{$ns}-minimal - Minimal appearance

Styleguide select
*/

.#{$ns}-html-select,
.#{$ns}-select {
  display: inline-block;
  letter-spacing: normal;
  position: relative;
  vertical-align: middle;

  select {
    @extend %pt-select;

    &:disabled {
      @extend %pt-select-disabled;
    }

    &::-ms-expand {
      // IE11 styling to hide the arrow
      display: none;
    }
  }

  .#{$ns}-icon {
    @extend %pt-select-arrow;
    @include pt-icon-colors();
  }

  &.#{$ns}-minimal select {
    @extend %pt-select-minimal;
  }

  &.#{$ns}-large {
    select {
      @extend %pt-select-large;
    }

    &::after, // CSS support
    .#{$ns}-icon {
      right: $pt-grid-size * 1.2;
      top: ($pt-button-height-large - $pt-icon-size-standard) * 0.5;
    }
  }

  &.#{$ns}-fill {
    &,
    select {
      width: 100%;
    }
  }

  .#{$ns}-dark & {
    select {
      @extend %pt-dark-select;
    }

    option {
      background-color: $dark-popover-background-color;
      color: $pt-dark-text-color;
    }

    option:disabled {
      color: $pt-dark-text-color-disabled;
    }

    &::after {
      color: $pt-dark-icon-color;
    }
  }
}

.#{$ns}-html-select {
  .#{$ns}-icon {
    @extend %pt-select-arrow;
  }
}

// N.B. this icon implementation is deprecated and will be removed in Blueprint 5.0
.#{$ns}-select {
  &::after {
    @extend %pt-select-arrow;
    @include pt-icon();
    content: map-get($blueprint-icon-codepoints, "double-caret-vertical");
  }
}
