// I recommend this never be overridden as it is purely structural and a bit of a pain.
@import 'mixins-common';

$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;

	.#{$wc-label-width-slug}_#{$lwdth} {
		&.wc-layout-flat > .wc-field > :first-child {
			width: $lw;
		}

		&.wc-layout-stacked > .wc-field > .wc-input {
			margin-left: $lw;
		}

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

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