All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.lib.components.VBadge.VBadge.mjs.map Maven / Gradle / Ivy

{"version":3,"file":"VBadge.mjs","names":["VIcon","useBackgroundColor","useTextColor","makeComponentProps","IconValue","useLocale","makeLocationProps","useLocation","makeRoundedProps","useRounded","makeTagProps","makeThemeProps","useTheme","makeTransitionProps","MaybeTransition","toRef","genericComponent","pickWithRest","propsFactory","useRender","makeVBadgeProps","bordered","Boolean","color","String","content","Number","dot","floating","icon","inline","label","type","default","max","modelValue","offsetX","offsetY","textColor","location","transition","VBadge","name","inheritAttrs","props","setup","ctx","backgroundColorClasses","backgroundColorStyles","roundedClasses","t","textColorClasses","textColorStyles","themeClasses","locationStyles","side","base","includes","value","isNaN","badgeAttrs","attrs","_createVNode","tag","_mergeProps","class","style","slots","_withDirectives","undefined","badge","_vShow"],"sources":["../../../src/components/VBadge/VBadge.tsx"],"sourcesContent":["// Styles\nimport './VBadge.sass'\n\n// Components\nimport { VIcon } from '@/components/VIcon'\n\n// Composables\nimport { useBackgroundColor, useTextColor } from '@/composables/color'\nimport { makeComponentProps } from '@/composables/component'\nimport { IconValue } from '@/composables/icons'\nimport { useLocale } from '@/composables/locale'\nimport { makeLocationProps, useLocation } from '@/composables/location'\nimport { makeRoundedProps, useRounded } from '@/composables/rounded'\nimport { makeTagProps } from '@/composables/tag'\nimport { makeThemeProps, useTheme } from '@/composables/theme'\nimport { makeTransitionProps, MaybeTransition } from '@/composables/transition'\n\n// Utilities\nimport { toRef } from 'vue'\nimport { genericComponent, pickWithRest, propsFactory, useRender } from '@/util'\n\nexport type VBadgeSlots = {\n  default: never\n  badge: never\n}\n\nexport const makeVBadgeProps = propsFactory({\n  bordered: Boolean,\n  color: String,\n  content: [Number, String],\n  dot: Boolean,\n  floating: Boolean,\n  icon: IconValue,\n  inline: Boolean,\n  label: {\n    type: String,\n    default: '$vuetify.badge',\n  },\n  max: [Number, String],\n  modelValue: {\n    type: Boolean,\n    default: true,\n  },\n  offsetX: [Number, String],\n  offsetY: [Number, String],\n  textColor: String,\n\n  ...makeComponentProps(),\n  ...makeLocationProps({ location: 'top end' } as const),\n  ...makeRoundedProps(),\n  ...makeTagProps(),\n  ...makeThemeProps(),\n  ...makeTransitionProps({ transition: 'scale-rotate-transition' }),\n}, 'VBadge')\n\nexport const VBadge = genericComponent()({\n  name: 'VBadge',\n\n  inheritAttrs: false,\n\n  props: makeVBadgeProps(),\n\n  setup (props, ctx) {\n    const { backgroundColorClasses, backgroundColorStyles } = useBackgroundColor(toRef(props, 'color'))\n    const { roundedClasses } = useRounded(props)\n    const { t } = useLocale()\n    const { textColorClasses, textColorStyles } = useTextColor(toRef(props, 'textColor'))\n    const { themeClasses } = useTheme()\n\n    const { locationStyles } = useLocation(props, true, side => {\n      const base = props.floating\n        ? (props.dot ? 2 : 4)\n        : (props.dot ? 8 : 12)\n\n      return base + (\n        ['top', 'bottom'].includes(side) ? +(props.offsetY ?? 0)\n        : ['left', 'right'].includes(side) ? +(props.offsetX ?? 0)\n        : 0\n      )\n    })\n\n    useRender(() => {\n      const value = Number(props.content)\n      const content = (!props.max || isNaN(value)) ? props.content\n        : value <= +props.max ? value\n        : `${props.max}+`\n\n      const [badgeAttrs, attrs] = pickWithRest(ctx.attrs as Record, [\n        'aria-atomic',\n        'aria-label',\n        'aria-live',\n        'role',\n        'title',\n      ])\n\n      return (\n        \n          
\n { ctx.slots.default?.() }\n\n \n \n {\n props.dot ? undefined\n : ctx.slots.badge ? ctx.slots.badge?.()\n : props.icon ? \n : content\n }\n \n \n
\n \n )\n })\n\n return {}\n },\n})\n\nexport type VBadge = InstanceType\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,KAAK,8BAEd;AAAA,SACSC,kBAAkB,EAAEC,YAAY;AAAA,SAChCC,kBAAkB;AAAA,SAClBC,SAAS;AAAA,SACTC,SAAS;AAAA,SACTC,iBAAiB,EAAEC,WAAW;AAAA,SAC9BC,gBAAgB,EAAEC,UAAU;AAAA,SAC5BC,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