// I recommend this never be overridden as it is purely structural and a bit of
// a pain.

$wc-label-width-slug: wc_fld_lblwth; // DO NOT CHANGE
$wc-input-width-slug: wc_fld_inpw; // DO NOT CHANGE

// This mixin outputs the classes to handle flat WFieldLayout styles for
// supported labelWidths. There could be anything up to 100 iterations of this
// stuff. When we combine that with the use of nested WFieldLayouts (don't get
// me started) which mean we have to use child selectors you can see we end up
// with a LOT of CSS.
@mixin wc-fld-layout($lwdth) {
  $lw: $lwdth * 1%;
  $iw: 100% - $lw;

  // sass-lint gets confused by the use of vars to build the class name
  // in combination with a egexp format.
  // sass-lint:disable class-name-format
  .#{$wc-label-width-slug}_#{$lwdth} {
    &.wc-layout-flat > .wc-field {
      > :first-child {
        width: $lw;
      }

      > .wc-input {
        max-width: $iw;
        width: $iw;
      }
    }

    @if ($wc-fieldlayout-stack-allow-indent == 1) {
      &.wc-layout-stacked > .wc-field > .wc-input {
        margin-left: $lw;
        max-width: $iw;
        width: $iw;
      }
    }
  }

  .#{$wc-input-width-slug}_#{$lwdth} > .wc-input {
    width: $lw;
  }
}
