elevation.mjs 861 B

1234567891011121314151617181920212223242526272829
  1. // Utilities
  2. import { computed, isRef } from 'vue';
  3. import { propsFactory } from "../util/index.mjs"; // Types
  4. // Composables
  5. export const makeElevationProps = propsFactory({
  6. elevation: {
  7. type: [Number, String],
  8. validator(v) {
  9. const value = parseInt(v);
  10. return !isNaN(value) && value >= 0 &&
  11. // Material Design has a maximum elevation of 24
  12. // https://material.io/design/environment/elevation.html#default-elevations
  13. value <= 24;
  14. }
  15. }
  16. }, 'elevation');
  17. export function useElevation(props) {
  18. const elevationClasses = computed(() => {
  19. const elevation = isRef(props) ? props.value : props.elevation;
  20. const classes = [];
  21. if (elevation == null) return classes;
  22. classes.push(`elevation-${elevation}`);
  23. return classes;
  24. });
  25. return {
  26. elevationClasses
  27. };
  28. }
  29. //# sourceMappingURL=elevation.mjs.map