// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
// See LICENSE in the project root for license information.

// ---------------------------------------------------------------------
// Variables are defined by baseline Design Tokens

@use "sass:string";

@use '../utilityVariables/important';
@use '../libSupport/manageScope';
@use "@aurodesignsystem/design-tokens/dist/legacy/auro-classic/SCSSVariables" as tokens;


// Utility layout selector mixin
// ---------------------------------------------------------------------

$layout-properties: margin padding !default;
$layout-extensions: Top Left Bottom Right !default;
$layout-modifiers: (
  'none': 0,
  '100': tokens.$ds-size-100,
  '200': tokens.$ds-size-200,
  '300': tokens.$ds-size-300,
  '400': tokens.$ds-size-400,
) !default;

/// Mixin auto-generates all available utility selectors. This mixin is NOT for general use and will produce selectors with the import of this Sass file. Output can be configured by redefining default values prior to import. See default value examples below.
///
/// DO NOT execute mixin, this is already included with the import of the file dependency
///
/// [Manage](/#utility-variable-important) `!important` flag.
///
/// [Manage](/#scope-prefix-variable-scope) `$scope` and `$prefix` options.
/// @group Utility-layout
/// @example scss - Default values
///   $layout-properties: margin padding !default;
///   $layout-extensions: Top Left Bottom Right !default;
///   $layout-modifiers: (
///     "none": 0,
///     "100": tokens.$ds-size-100,
///     "200": tokens.$ds-size-200,
///     "300": tokens.$ds-size-300,
///     "400": tokens.$ds-size-400
///   ) !default;
/// @example scss - example default output selector
///   .util_paddingLeft--none {}
///
/// @example scss - example output selector when $scope: true;
///   .auro .util_paddingLeft--none {}
///
/// @example scss - example output selector when $prefix: true;
///   .auro_util_paddingLeft--none {}
///
/// @example scss - import mixin file
///   @use "./node_modules/@aurodesignsystem/webcorestylesheets/dist/utilityMixins/layoutPropertiesGenerator" as *;
/// @example scss - import mixin file with altered output values
///   // Load any modules referenced by your overrides (e.g. design tokens) first,
///   // then pass the overrides through `@use ... with (...)`. Under the Sass module
///   // system, redefining `$layout-*` before the `@use` no longer configures it.
///   @use "@aurodesignsystem/design-tokens/dist/legacy/auro-classic/SCSSVariables" as tokens;
///   @use "./node_modules/@aurodesignsystem/webcorestylesheets/dist/utilityMixins/layoutPropertiesGenerator" with (
///     $layout-properties: margin,
///     $layout-extensions: Right,
///     $layout-modifiers: (
///       "25": tokens.$ds-size-25,
///       "50": tokens.$ds-size-50,
///       "600": tokens.$ds-size-600,
///       "800": tokens.$ds-size-800
///     )
///   );
@mixin auro_layoutPropertiesGenerator() {
  @each $property in $layout-properties {
    @each $extension in $layout-extensions {
      @each $type, $value in $layout-modifiers {
        #{manageScope.$scope}.#{manageScope.$prefix}util_#{$property}#{$extension}--#{$type} {
          #{$property}-#{string.to-lower-case($extension)}: $value important.$important;
        }
      }
    }
  }
}

@include auro_layoutPropertiesGenerator();
