MCPcopy
hub / github.com/vuetifyjs/vuetify / useRounded

Function useRounded

packages/vuetify/src/composables/rounded.ts:29–66  ·  view source on GitHub ↗
(
  props: RoundedProps | Ref<RoundedValue>,
  name = getCurrentInstanceName(),
)

Source from the content-addressed store, hash-verified

27}, 'rounded')
28
29export function useRounded (
30 props: RoundedProps | Ref<RoundedValue>,
31 name = getCurrentInstanceName(),
32): RoundedData {
33 const roundedClasses = computed(() => {
34 const rounded = isRef(props) ? props.value : props.rounded
35 const tile = isRef(props) ? false : props.tile
36 const classes: string[] = []
37
38 if (tile || rounded === false) {
39 classes.push('rounded-0')
40 } else if (rounded === true || rounded === '') {
41 classes.push(`${name}--rounded`)
42 } else if (rounded === 0 || (typeof rounded === 'string' && (rounded === '0' || !/[0-9%]/.test(rounded) || /\d*xl$/.test(rounded)))) {
43 for (const value of String(rounded).split(' ')) {
44 classes.push(`rounded-${value}`)
45 }
46 }
47
48 return classes
49 })
50
51 const roundedStyles = computed<CSSProperties>(() => {
52 const rounded = isRef(props) ? props.value : props.rounded
53 const roundedText = String(rounded)
54
55 if (!/[0-9]/.test(roundedText) ||
56 roundedText.includes('xl') ||
57 roundedText === '0'
58 ) {
59 return {}
60 }
61
62 return { borderRadius: convertToUnit(roundedText) }
63 })
64
65 return { roundedClasses, roundedStyles }
66}

Callers 15

setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90
setupFunction · 0.90

Calls 3

getCurrentInstanceNameFunction · 0.90
convertToUnitFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…