@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
58 lines (57 loc) • 1.63 kB
JavaScript
import { icons } from "@dialpad/dialtone-icons/vue3";
import { ICON_SIZE_MODIFIERS, ICON_NAMES } from "./icon_constants.js";
import { openBlock, createBlock, resolveDynamicComponent, createCommentVNode } from "vue";
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
const _sfc_main = {
compatConfig: { MODE: 3 },
name: "DtIcon",
props: {
/**
* The size of the icon.
* @values 100, 200, 300, 400, 500, 600, 700, 800
*/
size: {
type: String,
default: "500",
validator: (s) => Object.keys(ICON_SIZE_MODIFIERS).includes(s)
},
/**
* The icon name in kebab-case
*/
name: {
type: String,
required: true,
validator: (name) => ICON_NAMES.includes(name)
},
/**
* The label of the icon as read out by a screenreader. Leave this unset if your icon is purely presentational
*/
ariaLabel: {
type: String,
default: void 0
}
},
data() {
return {
iconLoaded: false
};
},
computed: {
icon() {
return icons[`./src/icons/${this.name}.vue`];
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return $options.icon ? (openBlock(), createBlock(resolveDynamicComponent($options.icon), {
key: 0,
size: $props.size,
"aria-label": $props.ariaLabel,
"data-qa": _ctx.$attrs["data-qa"] ?? "dt-icon"
}, null, 8, ["size", "aria-label", "data-qa"])) : createCommentVNode("", true);
}
const icon = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
icon as default
};
//# sourceMappingURL=icon.vue.js.map