fix: keep admin icons local
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
import type { Component, PropType } from 'vue';
|
||||
|
||||
import { defineComponent, h } from 'vue';
|
||||
|
||||
import { Icon } from '@iconify/vue';
|
||||
|
||||
import {
|
||||
AlignEndHorizontal,
|
||||
AlignHorizontalSpaceAround,
|
||||
AlignStartVertical,
|
||||
Bot,
|
||||
BookOpen,
|
||||
Check,
|
||||
CheckCircle,
|
||||
CheckSquare,
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
Circle,
|
||||
Edit,
|
||||
LayoutGrid,
|
||||
List,
|
||||
Mail,
|
||||
Megaphone,
|
||||
Plus,
|
||||
RefreshCw,
|
||||
SquareCheckBig,
|
||||
Trash2,
|
||||
TriangleAlert,
|
||||
UserRound,
|
||||
Users,
|
||||
Workflow,
|
||||
X,
|
||||
} from './lucide';
|
||||
|
||||
const localIconMap: Record<string, Component> = {
|
||||
'carbon:agent-detached': Bot,
|
||||
'carbon:align-box-middle-right': AlignEndHorizontal,
|
||||
'carbon:align-vertical-top': AlignStartVertical,
|
||||
'carbon:arrange': LayoutGrid,
|
||||
'carbon:arrange-horizontal': AlignHorizontalSpaceAround,
|
||||
'carbon:checkmark': Check,
|
||||
'carbon:checkmark-filled': CheckCircle,
|
||||
'carbon:chevron-down': ChevronDown,
|
||||
'carbon:circle-dash': Circle,
|
||||
'carbon:close': X,
|
||||
'carbon:edit': Edit,
|
||||
'carbon:email': Mail,
|
||||
'carbon:renew': RefreshCw,
|
||||
'carbon:reset': RefreshCw,
|
||||
'carbon:user-multiple': Users,
|
||||
'carbon:warning-filled': TriangleAlert,
|
||||
'ep:caret-right': ChevronRight,
|
||||
'ep:delete': Trash2,
|
||||
'ep:edit': Edit,
|
||||
'ep:plus': Plus,
|
||||
'ep:refresh': RefreshCw,
|
||||
'ep:refresh-left': RefreshCw,
|
||||
'ep:refresh-right': RefreshCw,
|
||||
'lucide:bot': Bot,
|
||||
'lucide:check-square': CheckSquare,
|
||||
'lucide:layout-grid': LayoutGrid,
|
||||
'lucide:library-big': BookOpen,
|
||||
'lucide:list': List,
|
||||
'lucide:megaphone': Megaphone,
|
||||
'lucide:square-check-big': SquareCheckBig,
|
||||
'lucide:square-user': UserRound,
|
||||
'lucide:workflow': Workflow,
|
||||
};
|
||||
|
||||
function normalizeIconName(icon: unknown) {
|
||||
return typeof icon === 'string' ? icon.replace(/^i-/, '') : '';
|
||||
}
|
||||
|
||||
const IconifyIcon = defineComponent({
|
||||
inheritAttrs: false,
|
||||
name: 'IconifyIcon',
|
||||
props: {
|
||||
icon: {
|
||||
type: [String, Object, Function] as PropType<Component | string>,
|
||||
default: undefined,
|
||||
},
|
||||
},
|
||||
setup(props, { attrs }) {
|
||||
return () => {
|
||||
const localIcon = localIconMap[normalizeIconName(props.icon)];
|
||||
if (localIcon) {
|
||||
return h(localIcon, attrs);
|
||||
}
|
||||
return h(Icon, { ...attrs, icon: props.icon });
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export { IconifyIcon };
|
||||
@@ -1,11 +1,8 @@
|
||||
export * from './create-icon';
|
||||
|
||||
export * from './iconify-icon';
|
||||
|
||||
export * from './lucide';
|
||||
|
||||
export type { IconifyIcon as IconifyIconStructure } from '@iconify/vue';
|
||||
export {
|
||||
addCollection,
|
||||
addIcon,
|
||||
Icon as IconifyIcon,
|
||||
listIcons,
|
||||
} from '@iconify/vue';
|
||||
export { addCollection, addIcon, listIcons } from '@iconify/vue';
|
||||
|
||||
Reference in New Issue
Block a user