UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

1 lines 2.52 kB
{"version":3,"file":"icon.cjs","sources":["../../../components/icon/icon.vue"],"sourcesContent":["<template>\n <component\n :is=\"icon\"\n v-if=\"icon\"\n :size=\"size\"\n :aria-label=\"iconAriaLabel\"\n :data-qa=\"$attrs['data-qa'] ?? 'dt-icon'\"\n />\n</template>\n\n<script>\nimport { icons } from '@dialpad/dialtone-icons/vue3';\nimport { ICON_SIZE_MODIFIERS, ICON_NAMES } from './icon_constants';\n// import { DialtoneLocalization } from '@/localization';\n// import { toFluentKeyString } from '@/common/utils';\n\n/**\n * The Icon component provides a set of glyphs and sizes to provide context your application.\n * @see https://dialtone.dialpad.com/components/icon.html\n */\nexport default {\n compatConfig: { MODE: 3 },\n name: 'DtIcon',\n\n props: {\n /**\n * The size of the icon.\n * @values 100, 200, 300, 400, 500, 600, 700, 800\n */\n size: {\n type: String,\n default: '500',\n validator: (s) => Object.keys(ICON_SIZE_MODIFIERS).includes(s),\n },\n\n /**\n * The icon name in kebab-case\n */\n name: {\n type: String,\n required: true,\n validator: (name) => ICON_NAMES.includes(name),\n },\n\n /**\n * The label of the icon as read out by a screen-reader. Leave this unset if your icon is purely presentational\n */\n ariaLabel: {\n type: String,\n default: undefined,\n },\n },\n\n data () {\n return {\n // i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n icon () {\n return icons[`./src/icons/${this.name}.vue`];\n },\n\n iconAriaLabel () {\n // const fluentKey = toFluentKeyString(this.name);\n // return this.ariaLabel || this.i18n.$t(`DIALTONE_ICON_${fluentKey}`);\n return this.ariaLabel;\n },\n },\n};\n</script>\n"],"names":["_sfc_main","s","ICON_SIZE_MODIFIERS","name","ICON_NAMES","icons","$options","_createBlock","_resolveDynamicComponent","$props","_ctx","_createCommentVNode"],"mappings":"yQAoBKA,EAAU,CACb,aAAc,CAAE,KAAM,GACtB,KAAM,SAEN,MAAO,CAKL,KAAM,CACJ,KAAM,OACN,QAAS,MACT,UAAYC,GAAM,OAAO,KAAKC,qBAAmB,EAAE,SAASD,CAAC,GAM/D,KAAM,CACJ,KAAM,OACN,SAAU,GACV,UAAYE,GAASC,aAAW,SAASD,CAAI,GAM/C,UAAW,CACT,KAAM,OACN,QAAS,SAIb,MAAQ,CACN,MAAO,EAGT,EAEA,SAAU,CACR,MAAQ,CACN,OAAOE,EAAAA,MAAM,eAAe,KAAK,IAAI,MAAM,CAC7C,EAEA,eAAiB,CAGf,OAAO,KAAK,SACd,EAEJ,iCAnEUC,EAAA,oBAFRC,EAAAA,YADFC,EAAAA,wBAESF,EAAA,IAAI,EAAA,CAFb,IAAA,EAIK,KAAMG,EAAA,KACN,aAAYH,EAAA,cACZ,UAASI,EAAA,OAAM,SAAA,GAAA,oDANpBC,EAAAA,mBAAA,GAAA,EAAA"}