rounded.mjs 922 B

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