diff --git a/components/lib/baseicon/BaseIcon.vue b/components/lib/baseicon/BaseIcon.vue index f68e733a2..0ed4b6349 100644 --- a/components/lib/baseicon/BaseIcon.vue +++ b/components/lib/baseicon/BaseIcon.vue @@ -1,38 +1,8 @@ - +`; + +const { load: loadStyle } = useStyle(styles, { name: 'baseicon', manual: true }); + +export default { + name: 'BaseIcon', + props: { + label: { + type: String, + default: undefined + }, + spin: { + type: Boolean, + default: false + } + }, + beforeMount() { + loadStyle(undefined, { nonce: this.$config?.csp?.nonce }); + }, + methods: { + pti() { + const isLabelEmpty = ObjectUtils.isEmpty(this.label); + + return { + class: [ + 'p-icon', + { + 'p-icon-spin': this.spin + } + ], + role: !isLabelEmpty ? 'img' : undefined, + 'aria-label': !isLabelEmpty ? this.label : undefined, + 'aria-hidden': isLabelEmpty + }; + } + }, + computed: { + $config() { + return this.$primevue?.config; + } + } +}; +