49 lines
1.6 KiB
JavaScript
49 lines
1.6 KiB
JavaScript
import { U as computed } from "./vue.runtime.esm-bundler-BvoXUmaf.js";
|
|
import { l as propsFactory } from "./defineComponent-DB6xIcDy.js";
|
|
import { a as parseAnchor } from "./anchor-DB_quObT.js";
|
|
import { i as useRtl } from "./locale-DDGMqzqb.js";
|
|
//#region node_modules/vuetify/lib/composables/location.js
|
|
var oppositeMap = {
|
|
center: "center",
|
|
top: "bottom",
|
|
bottom: "top",
|
|
left: "right",
|
|
right: "left"
|
|
};
|
|
var makeLocationProps = propsFactory({ location: String }, "location");
|
|
function useLocation(props, opposite = false, offset) {
|
|
const { isRtl } = useRtl();
|
|
return { locationStyles: computed(() => {
|
|
if (!props.location) return {};
|
|
const { side, align } = parseAnchor(props.location.split(" ").length > 1 ? props.location : `${props.location} center`, isRtl.value);
|
|
function getOffset(side) {
|
|
return offset ? offset(side) : 0;
|
|
}
|
|
const styles = {};
|
|
if (side !== "center") if (opposite) styles[oppositeMap[side]] = `calc(100% - ${getOffset(side)}px)`;
|
|
else styles[side] = 0;
|
|
if (align !== "center") if (opposite) styles[oppositeMap[align]] = `calc(100% - ${getOffset(align)}px)`;
|
|
else styles[align] = 0;
|
|
else {
|
|
if (side === "center") styles.top = styles.left = "50%";
|
|
else styles[{
|
|
top: "left",
|
|
bottom: "left",
|
|
left: "top",
|
|
right: "top"
|
|
}[side]] = "50%";
|
|
styles.transform = {
|
|
top: "translateX(-50%)",
|
|
bottom: "translateX(-50%)",
|
|
left: "translateY(-50%)",
|
|
right: "translateY(-50%)",
|
|
center: "translate(-50%, -50%)"
|
|
}[side];
|
|
}
|
|
return styles;
|
|
}) };
|
|
}
|
|
//#endregion
|
|
export { useLocation as n, makeLocationProps as t };
|
|
|
|
//# sourceMappingURL=location-BIKTnDF4.js.map
|