position.mjs 732 B

123456789101112131415161718192021
  1. // Utilities
  2. import { computed } from 'vue';
  3. import { getCurrentInstanceName, propsFactory } from "../util/index.mjs"; // Types
  4. const positionValues = ['static', 'relative', 'fixed', 'absolute', 'sticky'];
  5. // Composables
  6. export const makePositionProps = propsFactory({
  7. position: {
  8. type: String,
  9. validator: /* istanbul ignore next */v => positionValues.includes(v)
  10. }
  11. }, 'position');
  12. export function usePosition(props) {
  13. let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();
  14. const positionClasses = computed(() => {
  15. return props.position ? `${name}--${props.position}` : undefined;
  16. });
  17. return {
  18. positionClasses
  19. };
  20. }
  21. //# sourceMappingURL=position.mjs.map