import { createVNode as _createVNode } from "vue";
import "./styles/responsive.css";
import { computed } from "vue";
import { genericComponent } from "../../utils";
import { makeDimensionProps, useDimension } from "../../composables/dimension";
function useAspectStyles(props) {
  return {
    aspectStyles: computed(() => {
      const ratio = Number(props.aspectRatio);
      return ratio ? {
        paddingBottom: `${String(1 / ratio * 100)}%`
      } : void 0;
    })
  };
}
const Responsive = genericComponent()({
  name: "VeResponsive",
  props: {
    aspectRatio: [String, Number],
    contentClass: String,
    ...makeDimensionProps()
  },
  setup(props, {
    slots
  }) {
    const {
      dimensionStyles
    } = useDimension(props);
    const {
      aspectStyles
    } = useAspectStyles(props);
    return () => _createVNode("div", {
      "class": "ve-responsive",
      "style": dimensionStyles.value
    }, [_createVNode("div", {
      "class": "ve-responsive__sizer",
      "style": aspectStyles.value
    }, null), slots.additional?.(), slots.default && _createVNode("div", {
      "class": ["ve-responsive__content", props.contentClass]
    }, [slots.default()])]);
  }
});
export {
  Responsive,
  useAspectStyles
};
//# sourceMappingURL=responsive.mjs.map
