<template>
  <view :class="colClass" :style="colStyle">
    <slot></slot>
  </view>
</template>

<script lang="ts">
import { defineComponent as _defineComponent } from "vue";
import { computed, inject } from "vue";
import { rowSymbol, colProps } from "../layout/common";
import { classNames, stringifyStyle, createBem } from "../utils";
const __default__ = {
  options: {
    virtualHost: true,
    styleIsolation: "shared"
  }
};
export default /* @__PURE__ */ _defineComponent({
  ...__default__,
  __name: "col",
  props: colProps,
  setup(__props, { expose: __expose }) {
    __expose();
    const props = __props;
    const context = inject(rowSymbol);
    if (!context) {
      throw new Error("Col must be included in Row.");
    }
    const bem = createBem("col");
    const colClass = computed(() => {
      return classNames(
        bem.b(),
        bem.m(props.span, props.span),
        bem.m(`offset-${props.span}`, props.offset),
        props.rootClass
      );
    });
    const colStyle = computed(() => {
      const gutter = context.gutter;
      return stringifyStyle(
        props.order !== void 0 ? {
          order: props.order
        } : null,
        context.gap ? {
          paddingLeft: gutter[0] + gutter[1],
          paddingRight: gutter[0] + gutter[1]
        } : null,
        props.rootStyle
      );
    });
    const __returned__ = { props, context, bem, colClass, colStyle };
    return __returned__;
  }
});
</script>

<style lang="scss">
@use './index.scss';
</style>