Newer
Older
vmk-ui-kit / src / scss / components / _advanced-select.scss
/* =========================
   Advanced select
========================= */

@use "../kit-deps" as *;

.advanced-select-container {
  position: relative;
  display: inline-flex;
  width: 100%;
  max-width: 320px;

  input {
    width: 100%;
    min-height: 48px;
    padding: $space-3 $space-8 $space-3 $space-4;
    font-family: $font-family-base;
    font-size: 15px;
    font-weight: $font-weight-medium;
    line-height: 1.25;
    color: $neutral-900;
    background-color: $neutral-0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right $space-3 center;
    background-size: 20px 20px;
    border: $border-width-base $border-style-base $neutral-300;
    border-radius: $radius-lg;
    transition:
      border-color $motion-base $motion-ease,
      box-shadow $motion-base $motion-ease,
      background-color $motion-base $motion-ease;

    &:hover:not(:disabled):not([readonly]) {
      border-color: $mint-600;
    }

    &:focus {
      outline: none;
      border-color: $mint-600;
      box-shadow: 0 0 0 3px #{rgba($mint-600, 0.24)};
      background-color: $neutral-0;
    }

    &::placeholder {
      color: $neutral-600;
      font-weight: $font-weight-regular;
    }
  }

  .input {
    padding-right: $space-8;
  }
}

.advanced-select {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  background-color: $surface-panel-muted;
  border: $border-width-base $border-style-base $mint-600;
  border-left-width: $border-width-accent;
  border-radius: $radius-md;
  box-shadow: 0 8px 24px rgba($neutral-900, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition:
    opacity $motion-fast $motion-ease,
    visibility $motion-fast $motion-ease,
    transform $motion-fast $motion-ease;

  &.a-show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .popup-options-container {
    .not-found {
      width: 100%;
      padding: $space-4;
      text-align: center;
      display: none;
      color: $neutral-500;
      font-size: 14px;

      &.show {
        display: block;
      }
    }

    .options {
      width: 100%;
      display: none;
      padding: $space-1 0;

      &.show {
        display: block;
      }

      .option {
        padding: $space-2 $space-4;
        cursor: pointer;
        font-size: 14px;
        color: $neutral-900;
        transition:
          color $motion-fast $motion-ease,
          background-color $motion-fast $motion-ease;

        &.hide {
          display: none;
        }

        &:hover,
        &.focus {
          color: $neutral-900;
          background-color: $yellow-300;
        }
      }
    }
  }
}