bootstrap-vue-next
Version:
BootstrapVueNext is an early and lovely component library for Vue 3 & Nuxt 3 based on Bootstrap 5 and Typescript.
1 lines • 2.75 kB
Source Map (JSON)
{"version":3,"file":"useRadiusElementClasses-DtKYQuWz.mjs","sources":["../src/composables/useRadiusElementClasses.ts"],"sourcesContent":["import {computed, type MaybeRefOrGetter, toValue} from 'vue'\nimport type {RadiusElement, RadiusElementExtendables} from '../types/RadiusElement'\n\nexport const useRadiusElementClasses = (obj: MaybeRefOrGetter<RadiusElementExtendables>) => {\n const resolveRadiusElement = (\n value: true | RadiusElement,\n str: 'top' | 'bottom' | 'start' | 'end' | null\n ): string => {\n const strValue = str === null ? '' : `-${str}`\n\n return value === 'circle'\n ? `rounded${strValue}-circle`\n : value === 'pill'\n ? `rounded${strValue}-pill`\n : typeof value === 'number' ||\n value === '0' ||\n value === '1' ||\n value === '2' ||\n value === '3' ||\n value === '4' ||\n value === '5'\n ? `rounded${strValue}-${value}`\n : value === 'none'\n ? `rounded${strValue}-0`\n : value === 'sm'\n ? `rounded${strValue}-1`\n : value === 'lg'\n ? `rounded${strValue}-5`\n : `rounded${strValue}` // true is last\n }\n\n return computed(() => {\n const props = toValue(obj)\n\n return {\n [`${resolveRadiusElement(props.rounded as true | RadiusElement, null)}`]: !!props.rounded,\n [`${resolveRadiusElement(props.roundedTop as true | RadiusElement, 'top')}`]:\n !!props.roundedTop,\n [`${resolveRadiusElement(props.roundedBottom as true | RadiusElement, 'bottom')}`]:\n !!props.roundedBottom,\n [`${resolveRadiusElement(props.roundedStart as true | RadiusElement, 'start')}`]:\n !!props.roundedStart,\n [`${resolveRadiusElement(props.roundedEnd as true | RadiusElement, 'end')}`]:\n !!props.roundedEnd,\n }\n })\n}\n"],"names":[],"mappings":";AAGa,MAAA,0BAA0B,CAAC,QAAoD;AACpF,QAAA,uBAAuB,CAC3B,OACA,QACW;AACX,UAAM,WAAW,QAAQ,OAAO,KAAK,IAAI,GAAG;AAErC,WAAA,UAAU,WACb,UAAU,QAAQ,YAClB,UAAU,SACR,UAAU,QAAQ,UAClB,OAAO,UAAU,YACf,UAAU,OACV,UAAU,OACV,UAAU,OACV,UAAU,OACV,UAAU,OACV,UAAU,MACV,UAAU,QAAQ,IAAI,KAAK,KAC3B,UAAU,SACR,UAAU,QAAQ,OAClB,UAAU,OACR,UAAU,QAAQ,OAClB,UAAU,OACR,UAAU,QAAQ,OAClB,UAAU,QAAQ;AAAA,EAClC;AAEA,SAAO,SAAS,MAAM;AACd,UAAA,QAAQ,QAAQ,GAAG;AAElB,WAAA;AAAA,MACL,CAAC,GAAG,qBAAqB,MAAM,SAAiC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,MAAM;AAAA,MAClF,CAAC,GAAG,qBAAqB,MAAM,YAAoC,KAAK,CAAC,EAAE,GACzE,CAAC,CAAC,MAAM;AAAA,MACV,CAAC,GAAG,qBAAqB,MAAM,eAAuC,QAAQ,CAAC,EAAE,GAC/E,CAAC,CAAC,MAAM;AAAA,MACV,CAAC,GAAG,qBAAqB,MAAM,cAAsC,OAAO,CAAC,EAAE,GAC7E,CAAC,CAAC,MAAM;AAAA,MACV,CAAC,GAAG,qBAAqB,MAAM,YAAoC,KAAK,CAAC,EAAE,GACzE,CAAC,CAAC,MAAM;AAAA,IACZ;AAAA,EAAA,CACD;AACH;"}