@import './index';

.clear-icon() {
  color: @disabled-color;
  font-size: @font-size-sm;
  // https://github.com/ant-design/ant-design/pull/18151
  // https://codesandbox.io/s/wizardly-sun-u10br
  cursor: pointer;
  transition: color 0.3s;

  &:active {
    color: @text-color;
  }

  + i {
    margin-left: 6px;
  }

  &-hidden {
    visibility: hidden;
  }
  svg {
    width: 16px;
    height: 16px;
  }
  .@{ant-prefix}-input-clear-icon {
    margin-bottom: 2px;
  }

  .@{ant-prefix}-input-clear-icon-hover {
    display: none;
  }
  &:hover {
    .@{ant-prefix}-input-clear-icon-hover {
      display: block;
    }
    .@{ant-prefix}-input-clear-icon {
      display: none;
    }
  }
}

// ========================= Input =========================
.@{ant-prefix}-input-clear-icon {
  .clear-icon;
  &:last-child {
    margin-right: 0;
  }
}

// ======================= TextArea ========================
.@{ant-prefix}-input-affix-wrapper-textarea-with-clear-btn {
  padding: 0 !important;
  border: 0 !important;
}

.@{ant-prefix}-input-textarea-clear-icon {
  .clear-icon;
  position: absolute;
  top: 0;
  right: 0;
  margin: 8px 8px 0 0;
  .@{ant-prefix}-input-clear-icon {
    margin-bottom: 4px;
  }
}
