@function each-negative-margin($spacer-config) {
  @each $key, $spacer in $spacer-config {
    $spacer-config: map.set($spacer-config, $key, -$spacer);
  }
  @return $spacer-config;
}

$utilities: map-merge(
  $utilities,
  (
    // Positif Margin
    "margin":
      (
        property: margin,
        class: m,
        variants: margin,
        values:
          map-merge(
            $spacer-config,
            (
              "0": 0px,
              "auto": auto,
            )
          ),
      ),
    "margin-x": (
      property: margin-right margin-left,
      class: mx,
      variants: margin,
      values:
        map-merge(
          $spacer-config,
          (
            "0": 0px,
            "auto": auto,
          )
        ),
    ),
    "margin-y": (
      property: margin-top margin-bottom,
      class: my,
      variants: margin,
      values:
        map-merge(
          $spacer-config,
          (
            "0": 0px,
            "auto": auto,
          )
        ),
    ),
    "margin-top": (
      property: margin-top,
      class: mt,
      variants: margin,
      values:
        map-merge(
          $spacer-config,
          (
            "0": 0px,
            "auto": auto,
          )
        ),
    ),
    "margin-bottom": (
      property: margin-bottom,
      class: mb,
      variants: margin,
      values:
        map-merge(
          $spacer-config,
          (
            "0": 0px,
            "auto": auto,
          )
        ),
    ),
    "margin-left": (
      property: margin-left,
      class: ml,
      variants: margin,
      values:
        map-merge(
          $spacer-config,
          (
            "0": 0px,
            "auto": auto,
          )
        ),
    ),
    "margin-right": (
      property: margin-right,
      class: mr,
      variants: margin,
      values:
        map-merge(
          $spacer-config,
          (
            "0": 0px,
            "auto": auto,
          )
        ),
    ),
    // Negative Margin
    "negative-margin":
      (
        property: margin,
        class: -m,
        variants: margin,
        values:
          each-negative-margin(
            map-merge(
              $spacer-config,
              (
                "0": 0px,
                "auto": auto,
              )
            )
          ),
      ),
    "negative-margin-x": (
      property: margin-right margin-left,
      class: -mx,
      variants: margin,
      values:
        each-negative-margin(
          map-merge(
            $spacer-config,
            (
              "0": 0px,
              "auto": auto,
            )
          )
        ),
    ),
    "negative-margin-y": (
      property: margin-top margin-bottom,
      class: -my,
      variants: margin,
      values:
        each-negative-margin(
          map-merge(
            $spacer-config,
            (
              "0": 0px,
              "auto": auto,
            )
          )
        ),
    ),
    "negative-margin-top": (
      property: margin-top,
      class: -mt,
      variants: margin,
      values:
        each-negative-margin(
          map-merge(
            $spacer-config,
            (
              "0": 0px,
              "auto": auto,
            )
          )
        ),
    ),
    "negative-margin-bottom": (
      property: margin-bottom,
      class: -mb,
      variants: margin,
      values:
        each-negative-margin(
          map-merge(
            $spacer-config,
            (
              "0": 0px,
              "auto": auto,
            )
          )
        ),
    ),
    "negative-margin-left": (
      property: margin-left,
      class: -ml,
      variants: margin,
      values:
        each-negative-margin(
          map-merge(
            $spacer-config,
            (
              "0": 0px,
              "auto": auto,
            )
          )
        ),
    ),
    "negative-margin-right": (
      property: margin-right,
      class: -mr,
      variants: margin,
      values:
        each-negative-margin(
          map-merge(
            $spacer-config,
            (
              "0": 0px,
              "auto": auto,
            )
          )
        ),
    )
  )
);
