import { computed, unref } from "vue";
import { convertToUnit, getCurrentInstanceName, propsFactory } from "@veno-ui/utils";
const aliases = {
  xs: "x-small",
  sm: "small",
  md: "medium",
  lg: "large",
  xl: "x-large"
};
const SIZES = [
  ...Object.keys(aliases),
  ...new Set(Object.values(aliases))
];
const makeSizeProps = propsFactory({
  /**
   * @zh 大小
   */
  size: {
    type: [String, Number],
    default: "medium"
  }
}, "size");
function useSize(props, name = getCurrentInstanceName()) {
  const sizeClasses = computed(() => {
    let { size } = unref(props);
    if (!name || !size || !SIZES.includes(size))
      return null;
    if (size in aliases)
      size = aliases[size];
    return `${name}--size-${size}`;
  });
  const sizeStyles = computed(() => {
    const { size } = unref(props);
    if (!size || SIZES.includes(size))
      return {};
    return {
      width: convertToUnit(size),
      height: convertToUnit(size)
    };
  });
  return {
    sizeClasses,
    sizeStyles
  };
}
export {
  SIZES,
  makeSizeProps,
  useSize
};
//# sourceMappingURL=index.mjs.map
