border.mjs 866 B

1234567891011121314151617181920212223242526
  1. // Utilities
  2. import { computed, isRef } from 'vue';
  3. import { getCurrentInstanceName, propsFactory } from "../util/index.mjs"; // Types
  4. // Composables
  5. export const makeBorderProps = propsFactory({
  6. border: [Boolean, Number, String]
  7. }, 'border');
  8. export function useBorder(props) {
  9. let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();
  10. const borderClasses = computed(() => {
  11. const border = isRef(props) ? props.value : props.border;
  12. const classes = [];
  13. if (border === true || border === '') {
  14. classes.push(`${name}--border`);
  15. } else if (typeof border === 'string' || border === 0) {
  16. for (const value of String(border).split(' ')) {
  17. classes.push(`border-${value}`);
  18. }
  19. }
  20. return classes;
  21. });
  22. return {
  23. borderClasses
  24. };
  25. }
  26. //# sourceMappingURL=border.mjs.map