/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
@use './core' as *;
@use '../core/styles/theme';
@use '../state-layer' as state-layer;
@use '../focus-indicator' as focus-indicator;

//
// Host
//

$host-tokens: [display disabled-cursor];

:host {
  @include tokens($includes: $host-tokens);
}

:host {
  @include host;
}

:host([hidden]) {
  display: none;
}

//
// Base
//

.forge-fab {
  @include tokens($excludes: $host-tokens);
}

.forge-fab {
  @include base;

  &--extended {
    @include extended;
  }
}

//
// Anchor
//

.with-anchor {
  padding-inline: 0;
}

::slotted(a) {
  @include anchor-base;
}

//
// Focus indicator
//

forge-focus-indicator {
  @include focus-indicator.provide-theme((
    color: #{token(background)},
    shape-start-start: #{token(shape-start-start)},
    shape-start-end: #{token(shape-start-end)},
    shape-end-start: #{token(shape-end-start)},
    shape-end-end: #{token(shape-end-end)}
  ));
}

//
// State layer 
//

forge-state-layer {
  @include state-layer.provide-theme((
    color: #{token(color)}
  ));
}

//
// Density (only when not "extended")
//

:host(:is([dense],[density=small])) {
  .forge-fab {
    @include density-small;
  }
}

:host([density=large]) {
  .forge-fab {
    @include density-large;
  }
}

//
// Elevation
//

:host([elevation=lowered]) {
  .forge-fab {
    @include lowered;
  }
}

//
// Disabled
//

:host([disabled]) {
  @include host-disabled;

  .forge-fab {
    @include disabled;
  }
}

//
// Theme
//

@mixin theme($theme) {
  :host([theme=#{$theme}]:not([disabled])) {
    .forge-fab {
      @include override(background, theme.variable($theme), value);
      @include override(color, theme.variable(on-#{$theme}), value);
    }
  }
}

@include theme(primary);
@include theme(tertiary);
@include theme(success);
@include theme(error);
@include theme(warning);
@include theme(info);
