Skip to content

The Open Standard for Generative UI

4.1 KB
Raw Blame
@use "../../cssUtils" as cssUtils;

.openui-button-base {
  box-sizing: border-box;
  @include cssUtils.typography(label, default);
  border-radius: cssUtils.$radius-l;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  gap: cssUtils.$space-xs;
  align-items: center;
  & svg {
    height: 1em;
    width: 1em;
  }

  // Primary variant
  &-primary {
    background-color: cssUtils.$interactive-accent-default;
    color: cssUtils.$text-accent-primary;
    border-color: cssUtils.$border-accent;
    box-shadow: cssUtils.$shadow-m;
    &:not(:disabled):hover {
      background-color: cssUtils.$interactive-accent-hover;
      box-shadow: none;
    }
    &:disabled {
      background-color: cssUtils.$interactive-accent-disabled;
      cursor: not-allowed;
      box-shadow: none;
    }
    &:not(:disabled):active {
      background-color: cssUtils.$interactive-accent-pressed;
    }
  }
  // Secondary variant
  &-secondary {
    background-color: transparent;
    color: cssUtils.$text-neutral-primary;
    border-color: cssUtils.$border-interactive;
    box-shadow: cssUtils.$shadow-m;
    &:not(:disabled):hover {
      background-color: cssUtils.$highlight;
      box-shadow: none;
    }
    &:disabled {
      background-color: transparent;
      box-shadow: none;
      color: cssUtils.$text-neutral-tertiary;
      cursor: not-allowed;
    }
    &:not(:disabled):active {
      background-color: cssUtils.$highlight;
    }
  }
  // Tertiary variant
  &-tertiary {
    background-color: transparent;
    color: cssUtils.$text-neutral-primary;
    &:not(:disabled):hover {
      background-color: cssUtils.$highlight;
    }
    &:disabled {
      background-color: transparent;
      border-color: cssUtils.$border-default;
      color: cssUtils.$text-neutral-tertiary;
      cursor: not-allowed;
    }
    &:not(:disabled):active {
      background-color: cssUtils.$highlight;
      border-color: cssUtils.$border-interactive;
    }
  }

  // Destructive variant
  // Primary variant
  &-destructive-primary {
    background-color: cssUtils.$interactive-destructive-accent-default;
    color: cssUtils.$text-danger-inverted-primary;
    border-color: cssUtils.$border-accent;
    &:not(:disabled):hover {
      background-color: cssUtils.$interactive-destructive-accent-hover;
    }
    &:disabled {
      background-color: cssUtils.$interactive-destructive-accent-disabled;
      cursor: not-allowed;
    }
    &:not(:disabled):active {
      background-color: cssUtils.$interactive-destructive-accent-pressed;
    }
  }
  // Secondary variant
  &-destructive-secondary {
    background-color: cssUtils.$interactive-destructive-default;
    color: cssUtils.$text-danger-primary;
    border-color: cssUtils.$border-danger;
    &:not(:disabled):hover {
      background-color: cssUtils.$interactive-destructive-hover;
    }
    &:disabled {
      background-color: cssUtils.$interactive-destructive-disabled;
      color: cssUtils.$text-danger-tertiary;
      cursor: not-allowed;
    }
    &:not(:disabled):active {
      background-color: cssUtils.$interactive-destructive-hover;
    }
  }
  // Tertiary variant
  &-destructive-tertiary {
    background-color: transparent;
    border-color: transparent;
    color: cssUtils.$text-danger-primary;
    &:not(:disabled):hover {
      background-color: cssUtils.$interactive-destructive-hover;
    }
    &:disabled {
      color: cssUtils.$text-danger-tertiary;
      cursor: not-allowed;
    }
    &:not(:disabled):active {
      background-color: cssUtils.$interactive-destructive-hover;
      border-color: cssUtils.$border-danger;
    }
  }

  // Sizes
  &-extra-small {
    border-radius: cssUtils.$radius-s;
    padding: calc(cssUtils.$space-xs - 1.75px) cssUtils.$space-s;
    @include cssUtils.typography(label, small);
  }

  &-small {
    border-radius: calc(cssUtils.$radius-s + 1px);
    padding: calc(cssUtils.$space-s - 1.75px) cssUtils.$space-s-m;
    @include cssUtils.typography(label, small);
  }

  &-medium {
    padding: calc(cssUtils.$space-s - 1px) cssUtils.$space-s-m;
    border-radius: cssUtils.$radius-m;
  }

  &-large {
    padding: calc(cssUtils.$space-s-m - 1px) cssUtils.$space-m;
  }
}