dimensions.mjs 805 B

1234567891011121314151617181920212223242526
  1. // Utilities
  2. import { computed } from 'vue';
  3. import { convertToUnit, propsFactory } from "../util/index.mjs"; // Types
  4. // Composables
  5. export const makeDimensionProps = propsFactory({
  6. height: [Number, String],
  7. maxHeight: [Number, String],
  8. maxWidth: [Number, String],
  9. minHeight: [Number, String],
  10. minWidth: [Number, String],
  11. width: [Number, String]
  12. }, 'dimension');
  13. export function useDimension(props) {
  14. const dimensionStyles = computed(() => ({
  15. height: convertToUnit(props.height),
  16. maxHeight: convertToUnit(props.maxHeight),
  17. maxWidth: convertToUnit(props.maxWidth),
  18. minHeight: convertToUnit(props.minHeight),
  19. minWidth: convertToUnit(props.minWidth),
  20. width: convertToUnit(props.width)
  21. }));
  22. return {
  23. dimensionStyles
  24. };
  25. }
  26. //# sourceMappingURL=dimensions.mjs.map