/**
 * Icon arrow-small
 *  Custom properties and styles with configuration
 */

/**
 * Requires
 */
@use '../../abstract/config' as abstract;
@use '../../mixins/properties' as mixins;

/**
 * Component css class
 * @protected
 * @type {string} css class
 */
$class: 'ui-icon' !default;

/**
 * Component property prefix
 * @protected
 * @type {string} property name
 */
$props: 'ui-icon-' !default;

/**
 * Config defaults
 * @private
 * @type {map}
 */
$-config: (
  arrow-small-height: 0.45,
  arrow-small-width: 0.25,
  arrow-small-offset: 0.15,
  arrow-small-tail-height: 0.14,
  arrow-small-tail-width: 0.5,
  arrow-small-tail-offset: 0.15,
);

/**
 * Update component config options
 * @public
 * @param {map} $options - Map of config options
 * @output {void} - Only sets config options
 */
@mixin config($options) {
  $-config: abstract.config($options, $-config, false, true, 'icons-styled-arrow-small.config::') !global;
}

/**
 * Generate required custom properties
 * @public
 * @output Adds components custom properties in current scope
 */
@mixin properties() {
  @include mixins.properties($-config, $props, '_at_', 'icons-styled-arrow-small.properties::');
}

/**
 * Generate icon styles
 * @public
 * @output Outputs configured icon styles in given context
 */
@mixin styles() {
  .#{$class}[data-icon="arrow-small"] {
    &::before {
      left: calc((var(--#{$props}size) * var(--#{$props}unit) * var(--#{$props}arrow-small-tail-offset)));
      height: calc(var(--#{$props}size) * var(--#{$props}unit) * var(--#{$props}arrow-small-tail-height));
      width: calc(var(--#{$props}size) * var(--#{$props}unit) * var(--#{$props}arrow-small-tail-width));
      background-color: var(--#{$props}color);
      transform: translate(0, -50%);
    }
    &::after {
      left: auto;
      right: calc((var(--#{$props}size) * var(--#{$props}unit) * var(--#{$props}arrow-small-offset)));
      width: 0;
      height: 0;
      transform: translate(0, -50%);
      border-top: calc(var(--#{$props}size) * var(--#{$props}unit) * var(--#{$props}arrow-small-height) / 2) solid transparent;
      border-bottom: calc(var(--#{$props}size) * var(--#{$props}unit) * var(--#{$props}arrow-small-height) / 2) solid transparent;
      border-left: calc(var(--#{$props}size) * var(--#{$props}unit) * var(--#{$props}arrow-small-width)) solid var(--#{$props}color);
    }
  }
}
