import { isVNode as _isVNode, mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
import "./styles/spacer.css";
import { flattenFragments, pick } from "@veno-ui/utils";
import { defineComponent } from "../../utils";
import { Col, Row } from "../grid";
import { makeRowProps } from "../grid/row";
import { makeColProps } from "../grid/col";
function _isSlot(s) {
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !_isVNode(s);
}
const Spacer = defineComponent({
  name: "VeSpacer",
  props: {
    ...makeRowProps(),
    ...makeColProps({
      cols: "auto"
    })
  },
  setup(props, {
    slots
  }) {
    return () => {
      let _slot;
      const children = flattenFragments(slots.default?.() ?? []);
      if (!children.length) {
        return _createVNode("div", {
          "class": "ve-spacer"
        }, null);
      }
      const [rowProps] = pick(props, Object.keys(Row.props));
      const [colProps] = pick(props, Object.keys(Col.props));
      return _createVNode(Row, _mergeProps({
        "class": "ve-spacer"
      }, rowProps), _isSlot(_slot = children.map((child, index) => _createVNode(Col, _mergeProps(colProps, {
        "key": index
      }), _isSlot(child) ? child : {
        default: () => [child]
      }))) ? _slot : {
        default: () => [_slot]
      });
    };
  }
});
export {
  Spacer
};
//# sourceMappingURL=spacer.mjs.map
