/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
@use 'sass:map';
@use '@material/animation/animation' as mdc-animation;
@use '@material/theme' as mdc-theme;
@use '@material/typography' as mdc-typography;
@use '../field/base' as field-base;
@use '../field/utils' as field-utils;
@use '../field/variables' as base-variables;
@use '../theme';
@use './variables';

// Field
@mixin field-with-textarea($custom-prop-height) {
  height: auto;
  padding-right: 2px; // Moves scollbar inside of border
  @include theme.css-custom-property(
    min-height,
    $custom-prop-height,
    map.get(base-variables.$field, height, default)
  );
}

// Textarea
@mixin textarea-core {
  @include mdc-typography.typography(body1);
  align-self: flex-end;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  transition: mdc-animation.standard(opacity, 150ms);
  border: none;
  background: none;
  appearance: none;
  outline: none;
  line-height: normal;
  min-width: 0;
  font-size: 1rem;
  margin: map.get(variables.$textarea, margin, default);
  padding: map.get(variables.$textarea, padding, default);
  overflow: auto;
  resize: vertical;
  @include field-base.placeholder;
}

// Multi input
@mixin input-first {
  padding-right: 0;
  max-width: 110px;
  min-width: 110px;
  width: 110px;
}

@mixin input-last {
  &::placeholder {
    padding-left: 6px;
  }
}

@mixin input-separator-core {
  @include mdc-theme.property(color, text-primary-on-background);
  border: transparent;
}

@mixin input-separator-margin($slot-state) {
  @if $slot-state == default or $slot-state == helper-text {
    margin: map.get(variables.$input-separator, margin, no-label);
  }
  @else if $slot-state == label or $slot-state == label-helper-text {
    margin: map.get(variables.$input-separator, margin, default);
  }
  @include field-utils.error-y-axis-slot-state(input-separator-margin, $slot-state);
}
