import * as mdi from "@mdi/js";
//import { FileActionType } from "../types/files.types";
export type IconPathDefinition = {
/* Viewbox */
viewBox: `${number} ${number} ${number} ${number}`;
/** Optional native fill color for the icon. Useful for brand icons. */
nativeColor?: string;
/** Single SVG path for monotone icons. */
path: string;
};
export type IconContentDefinition = {
/* Viewbox */
viewBox: `${number} ${number} ${number} ${number}`;
/** Inner SVG content for complex icons */
content: string;
};
export type IconDefinition = IconPathDefinition | IconContentDefinition;
export type IconDefinitionList = { [key: string]: IconDefinition };
export const defaultIcon: IconDefinition = { viewBox: "0 0 24 24", path: mdi.mdiSelect };
const meetingIconMapping = {
"zoom-meetings": {
viewBox: "0 0 24 24",
content:
'',
},
"google-meet": {
viewBox: "0 0 24 24",
content:
'',
},
/*"webex-meetings": {
viewBox: "0 0 24 24",
content:
'',
},*/
"microsoft-teams": {
viewBox: "0 0 24 24",
content:
'',
},
} satisfies IconDefinitionList;
const logoIconMapping = {
box: {
viewBox: "0 0 24 24",
nativeColor: "#0161d5",
path: "M15.39,14.04V14.04C15.39,12.62 14.24,11.47 12.82,11.47C11.41,11.47 10.26,12.62 10.26,14.04V14.04C10.26,15.45 11.41,16.6 12.82,16.6C14.24,16.6 15.39,15.45 15.39,14.04M17.1,14.04C17.1,16.4 15.18,18.31 12.82,18.31C11.19,18.31 9.77,17.39 9.05,16.04C8.33,17.39 6.91,18.31 5.28,18.31C2.94,18.31 1.04,16.43 1,14.11V14.11H1V7H1V7C1,6.56 1.39,6.18 1.86,6.18C2.33,6.18 2.7,6.56 2.71,7V7H2.71V10.62C3.43,10.08 4.32,9.76 5.28,9.76C6.91,9.76 8.33,10.68 9.05,12.03C9.77,10.68 11.19,9.76 12.82,9.76C15.18,9.76 17.1,11.68 17.1,14.04V14.04M7.84,14.04V14.04C7.84,12.62 6.69,11.47 5.28,11.47C3.86,11.47 2.71,12.62 2.71,14.04V14.04C2.71,15.45 3.86,16.6 5.28,16.6C6.69,16.6 7.84,15.45 7.84,14.04M22.84,16.96V16.96C22.95,17.12 23,17.3 23,17.47C23,17.73 22.88,18 22.66,18.15C22.5,18.26 22.33,18.32 22.15,18.32C21.9,18.32 21.65,18.21 21.5,18L19.59,15.47L17.7,18V18C17.53,18.21 17.28,18.32 17.03,18.32C16.85,18.32 16.67,18.26 16.5,18.15C16.29,18 16.17,17.72 16.17,17.46C16.17,17.29 16.23,17.11 16.33,16.96V16.96H16.33V16.96L18.5,14.04L16.33,11.11V11.11H16.33V11.11C16.22,10.96 16.17,10.79 16.17,10.61C16.17,10.35 16.29,10.1 16.5,9.93C16.89,9.65 17.41,9.72 17.7,10.09V10.09L19.59,12.61L21.5,10.09C21.76,9.72 22.29,9.65 22.66,9.93C22.89,10.1 23,10.36 23,10.63C23,10.8 22.95,10.97 22.84,11.11V11.11H22.84V11.11L20.66,14.04L22.84,16.96V16.96H22.84Z",
},
dropbox: {
viewBox: "0 0 24 24",
nativeColor: "#0061fe",
path: "M3 6.2L8 9.39L13 6.2L8 3L3 6.2M13 6.2L18 9.39L23 6.2L18 3L13 6.2M3 12.55L8 15.74L13 12.55L8 9.35L3 12.55M18 9.35L13 12.55L18 15.74L23 12.55L18 9.35M8.03 16.8L13.04 20L18.04 16.8L13.04 13.61L8.03 16.8Z",
},
"google-drive": {
viewBox: "0 0 24 24",
nativeColor: "#1a73e8",
path: "M7.71,3.5L1.15,15L4.58,21L11.13,9.5M9.73,15L6.3,21H19.42L22.85,15M22.28,14L15.42,2H8.58L8.57,2L15.43,14H22.28Z",
},
onedrive: {
viewBox: "0 0 24 24",
nativeColor: "#0078d4",
path: "M18.21 10.29Q19 10.34 19.7 10.68 20.39 11 20.9 11.57 21.41 12.12 21.71 12.83 22 13.54 22 14.34 22 15.18 21.68 15.92 21.36 16.66 20.8 17.21 20.25 17.76 19.5 18.08 18.78 18.41 17.94 18.41H7Q5.97 18.41 5.06 18 4.15 17.61 3.47 16.94 2.79 16.26 2.4 15.35 2 14.44 2 13.41 2 12.59 2.26 11.83 2.5 11.08 3 10.45 3.44 9.82 4.08 9.35 4.72 8.88 5.5 8.63 5.87 8.5 6.21 8.5 6.56 8.43 6.93 8.41H6.94Q7.37 7.75 7.95 7.23 8.5 6.71 9.2 6.34 9.87 6 10.62 5.78 11.37 5.59 12.16 5.59 13.22 5.59 14.2 5.94 15.18 6.29 16 6.91 16.8 7.53 17.37 8.39 17.95 9.26 18.21 10.29M12.16 6.84Q11.05 6.84 10.06 7.3 9.06 7.75 8.36 8.6 8.73 8.7 9.07 8.85 9.4 9 9.73 9.2L13.71 11.58L16 10.62Q16.21 10.53 16.44 10.45 16.67 10.38 16.92 10.33 16.68 9.55 16.21 8.91 15.74 8.27 15.11 7.81 14.5 7.35 13.73 7.1 13 6.84 12.16 6.84M4 15.66L12.27 12.18L9.08 10.26Q8.59 9.97 8.06 9.81 7.5 9.66 6.95 9.66 6.19 9.66 5.5 9.96 4.84 10.26 4.34 10.77 3.84 11.29 3.54 11.97 3.25 12.65 3.25 13.41 3.25 14 3.45 14.59 3.64 15.19 4 15.66M17.94 17.16Q18.41 17.16 18.84 17 19.27 16.86 19.64 16.58L13.61 13L5.03 16.59Q5.47 16.86 5.97 17 6.47 17.16 7 17.16M20.45 15.61Q20.75 15 20.75 14.34 20.75 13.7 20.5 13.17 20.26 12.65 19.85 12.28 19.43 11.91 18.88 11.71 18.32 11.5 17.7 11.5 17.35 11.5 17 11.6 16.66 11.68 16.33 11.81 16 11.93 15.67 12.08 15.35 12.23 15.04 12.37Z",
},
} satisfies IconDefinitionList;
const fileIconMapping = {
email: { viewBox: "0 0 24 24", path: mdi.mdiEmail },
file: { viewBox: "0 0 24 24", path: mdi.mdiFile },
"file-upload": { viewBox: "0 0 24 24", path: mdi.mdiFileUpload },
"file-music": { viewBox: "0 0 24 24", path: mdi.mdiFileMusic },
"file-image": { viewBox: "0 0 24 24", path: mdi.mdiFileImage },
"file-video": { viewBox: "0 0 24 24", path: mdi.mdiFileVideo },
"file-code": { viewBox: "0 0 24 24", path: mdi.mdiFileCode },
"file-xml": { viewBox: "0 0 24 24", path: mdi.mdiFileCode },
"file-document": { viewBox: "0 0 24 24", path: mdi.mdiFileDocument },
"file-word": { viewBox: "0 0 24 24", path: mdi.mdiFileWord },
"file-excel": { viewBox: "0 0 24 24", path: mdi.mdiFileExcel },
"file-pdf": { viewBox: "0 0 24 24", path: mdi.mdiFileDocument },
"file-powerpoint": { viewBox: "0 0 24 24", path: mdi.mdiFilePowerpoint },
"file-compressed": { viewBox: "0 0 24 24", path: mdi.mdiFolderZip },
} satisfies IconDefinitionList;
const editorIconMapping = {
"circle-medium": { viewBox: "0 0 24 24", path: mdi.mdiCircleMedium },
"code-braces": { viewBox: "0 0 24 24", path: mdi.mdiCodeBraces },
"code-block-braces": { viewBox: "0 0 24 24", path: mdi.mdiCodeBlockBraces },
eye: { viewBox: "0 0 24 24", path: mdi.mdiEye },
"eye-outline": { viewBox: "0 0 24 24", path: mdi.mdiEyeOutline },
"format-bold": { viewBox: "0 0 24 24", path: mdi.mdiFormatBold },
"format-italic": { viewBox: "0 0 24 24", path: mdi.mdiFormatItalic },
"format-header": { viewBox: "0 0 24 24", path: mdi.mdiFormatHeaderPound },
"format-h1": { viewBox: "0 0 24 24", path: mdi.mdiFormatHeader1 },
"format-h2": { viewBox: "0 0 24 24", path: mdi.mdiFormatHeader2 },
"format-h3": { viewBox: "0 0 24 24", path: mdi.mdiFormatHeader3 },
"format-h4": { viewBox: "0 0 24 24", path: mdi.mdiFormatHeader4 },
"format-h5": { viewBox: "0 0 24 24", path: mdi.mdiFormatHeader5 },
"format-h6": { viewBox: "0 0 24 24", path: mdi.mdiFormatHeader6 },
"format-list-bulleted": { viewBox: "0 0 24 24", path: mdi.mdiFormatListBulleted },
"format-list-ordered": { viewBox: "0 0 24 24", path: mdi.mdiFormatListNumbered },
"format-quote": { viewBox: "0 0 24 24", path: mdi.mdiFormatQuoteClose },
//"image": { viewBox: '0 0 24 24', path: mdi.mdiImage },
"image-outline": { viewBox: '0 0 24 24', path: mdi.mdiImageOutline },
"link-variant": { viewBox: "0 0 24 24", path: mdi.mdiLinkVariant },
numeric: { viewBox: "0 0 24 24", path: mdi.mdiNumeric },
} satisfies IconDefinitionList;
// Custom mapping to MDI instead of symbols
export const iconMapping = {
"account-minus": { viewBox: "0 0 24 24", path: mdi.mdiAccountMinus },
"account-plus": { viewBox: '0 0 24 24', path: mdi.mdiAccountPlus },
alert: { viewBox: "0 0 24 24", path: mdi.mdiAlert },
"alert-circle": { viewBox: "0 0 24 24", path: mdi.mdiAlertCircle },
"alert-octagon": { viewBox: "0 0 24 24", path: mdi.mdiAlertOctagon },
"arrow-collapse": { viewBox: "0 0 24 24", path: mdi.mdiArrowCollapse },
"arrow-expand": { viewBox: "0 0 24 24", path: mdi.mdiArrowExpand },
attachment: { viewBox: "0 0 24 24", path: mdi.mdiAttachment },
back: { viewBox: "0 0 24 24", path: mdi.mdiArrowLeft },
"backup-restore": { viewBox: "0 0 24 24", path: mdi.mdiBackupRestore },
bell: { viewBox: "0 0 24 24", path: mdi.mdiBell },
"bell-off": { viewBox: "0 0 24 24", path: mdi.mdiBellOff },
agent: { viewBox: "0 0 24 24", path: mdi.mdiStarFourPoints },
check: { viewBox: "0 0 24 24", path: mdi.mdiCheck },
"cancel": { viewBox: '0 0 24 24', path: mdi.mdiCancel },
"check-all": { viewBox: "0 0 24 24", path: mdi.mdiCheckAll },
//"check-circle-outline": { viewBox: '0 0 24 24', path: mdi.mdiCheckCircleOutline },
"checkbox-blank": { viewBox: "0 0 24 24", path: mdi.mdiCheckboxBlankOutline },
"checkbox-marked": { viewBox: "0 0 24 24", path: mdi.mdiCheckboxMarkedOutline },
"check-circle": { viewBox: "0 0 24 24", path: mdi.mdiCheckCircle },
"circle-outline": { viewBox: "0 0 24 24", path: mdi.mdiCircleOutline },
close: { viewBox: "0 0 24 24", path: mdi.mdiClose },
"close-circle": { viewBox: "0 0 24 24", path: mdi.mdiCloseCircle },
cloud: { viewBox: "0 0 24 24", path: mdi.mdiCloud },
comment: { viewBox: "0 0 24 24", path: mdi.mdiComment },
"comment-outline": { viewBox: "0 0 24 24", path: mdi.mdiCommentOutline },
//"content-save": { viewBox: '0 0 24 24', path: mdi.mdiContentSave },
delete: { viewBox: "0 0 24 24", path: mdi.mdiDelete },
"delete-restore": { viewBox: "0 0 24 24", path: mdi.mdiDeleteRestore },
"delete-forever": { viewBox: "0 0 24 24", path: mdi.mdiDeleteForever },
"dots-vertical": { viewBox: "0 0 24 24", path: mdi.mdiDotsVertical },
download: { viewBox: "0 0 24 24", path: mdi.mdiDownload },
//earth: { viewBox: '0 0 24 24', path: mdi.mdiEarth },
emoticon: { viewBox: "0 0 24 24", path: mdi.mdiEmoticonOutline },
//"emoticon-plus": { viewBox: '0 0 24 24', path: mdi.mdiEmoticonPlusOutline },
"file-check": { viewBox: "0 0 24 24", path: mdi.mdiFileCheck },
"file-check-outline": { viewBox: "0 0 24 24", path: mdi.mdiFileCheckOutline },
"fit-screen": { viewBox: "0 0 24 24", path: mdi.mdiFitToScreen },
"fit-width": { viewBox: "0 0 24 24", path: mdi.mdiFitToPage },
flag: { viewBox: '0 0 24 24', path: mdi.mdiFlag },
"flag-outline": { viewBox: '0 0 24 24', path: mdi.mdiFlagOutline },
//fullscreen: { viewBox: '0 0 24 24', path: mdi.mdiFullscreen },
//"fullscreen-exit": { viewBox: '0 0 24 24', path: mdi.mdiFullscreenExit },
//"help-circle": { viewBox: '0 0 24 24', path: mdi.mdiHelpCircle },
information: { viewBox: "0 0 24 24", path: mdi.mdiInformationOutline },
magnify: { viewBox: "0 0 24 24", path: mdi.mdiMagnify },
//meeting: { viewBox: '0 0 24 24', path: mdi.mdiMonitorAccount },
"menu-down": { viewBox: "0 0 24 24", path: mdi.mdiMenuDown },
"menu-up": { viewBox: "0 0 24 24", path: mdi.mdiMenuUp },
//message: { viewBox: '0 0 24 24', path: mdi.mdiMessage },
"message-text": { viewBox: "0 0 24 24", path: mdi.mdiMessageText },
minus: { viewBox: "0 0 24 24", path: mdi.mdiMinus },
next: { viewBox: "0 0 24 24", path: mdi.mdiArrowRight },
//"open-in-new": { viewBox: "0 0 24 24", path: mdi.mdiOpenInNew },
pencil: { viewBox: "0 0 24 24", path: mdi.mdiPencil },
"pencil-minus": { viewBox: "0 0 24 24", path: mdi.mdiPencilMinus },
"pencil-off": { viewBox: "0 0 24 24", path: mdi.mdiPencilOff },
"pencil-outline": { viewBox: "0 0 24 24", path: mdi.mdiPencilOutline },
"pencil-remove": { viewBox: "0 0 24 24", path: mdi.mdiPencilRemove },
pin: { viewBox: "0 0 24 24", path: mdi.mdiPin },
unpin: { viewBox: "0 0 24 24", path: mdi.mdiPinOff },
plus: { viewBox: "0 0 24 24", path: mdi.mdiPlus },
"plus-circle-outline": { viewBox: "0 0 24 24", path: mdi.mdiPlusCircleOutline },
poll: { viewBox: "0 0 24 24", path: mdi.mdiChartBox },
previous: { viewBox: "0 0 24 24", path: mdi.mdiArrowLeft },
read: { viewBox: "0 0 24 24", path: mdi.mdiCheck },
restore: { viewBox: "0 0 24 24", path: mdi.mdiRestore },
unread: { viewBox: "0 0 24 24", path: mdi.mdiCheck },
send: { viewBox: "0 0 24 24", path: mdi.mdiSend },
"server-network-off": { viewBox: "0 0 24 24", path: mdi.mdiServerNetworkOff },
"shield-star": { viewBox: "0 0 24 24", path: mdi.mdiShieldStar },
"shield-star-outline": { viewBox: "0 0 24 24", path: mdi.mdiShieldStarOutline },
sort: { viewBox: "0 0 24 24", path: mdi.mdiSort },
star: { viewBox: "0 0 24 24", path: mdi.mdiStar },
unstar: { viewBox: "0 0 24 24", path: mdi.mdiStarOff },
stars: { viewBox: "0 0 24 24", path: mdi.mdiCreation },
"swap-horizontal": { viewBox: "0 0 24 24", path: mdi.mdiSwapHorizontal },
"text-box": { viewBox: '0 0 24 24', path: mdi.mdiTextBox },
textbox: { viewBox: "0 0 24 24", path: mdi.mdiFormTextbox },
//"thumb-up": { viewBox: "0 0 24 24", path: mdi.mdiThumbUp },
//"thumb-up-outline": { viewBox: "0 0 24 24", path: mdi.mdiThumbUpOutline },
trashcan: { viewBox: "0 0 24 24", path: mdi.mdiTrashCan },
video: { viewBox: "0 0 24 24", path: mdi.mdiVideo },
"view-list-outline": { viewBox: "0 0 24 24", path: mdi.mdiViewListOutline },
"view-module-outline": { viewBox: "0 0 24 24", path: mdi.mdiViewModuleOutline },
"wifi-off": { viewBox: "0 0 24 24", path: mdi.mdiWifiOff },
...fileIconMapping,
...logoIconMapping,
...meetingIconMapping,
...editorIconMapping,
} satisfies IconDefinitionList;
/*export const fileActionIconMapping: { [index in FileActionType]: IconDefinition } = {
"attach": { viewBox: '0 0 24 24', path: mdi.mdiAttachment },
"create": { viewBox: '0 0 24 24', path: mdi.mdiPlus },
"delete-forever": { viewBox: '0 0 24 24', path: mdi.mdiDeleteForever },
"edit": { viewBox: '0 0 24 24', path: mdi.mdiPencil },
"modify": { viewBox: '0 0 24 24', path: mdi.mdiPencil },
"rename": { viewBox: '0 0 24 24', path: mdi.mdiCursorText },
"replace": { viewBox: '0 0 24 24', path: mdi.mdiSwapVertical },
"restore": { viewBox: '0 0 24 24', path: mdi.mdiRestore },
"subscribe": { viewBox: '0 0 24 24', path: mdi.mdiBell },
"trash": { viewBox: '0 0 24 24', path: mdi.mdiDelete },
"unsubscribe": { viewBox: '0 0 24 24', path: mdi.mdiBellOff },
"upload": { viewBox: '0 0 24 24', path: mdi.mdiUpload },
"version": { viewBox: '0 0 24 24', path: mdi.mdiHistory },
};*/
export function getIconMapping(name?: string) {
return name && name in iconMapping ? iconMapping[name as iconNamesType] : "";
}
/*export function getFileActionIconMapping(action?: FileActionType) {
return action && action in fileActionIconMapping ? fileActionIconMapping[action] : "";
}*/
export type iconNamesType = keyof typeof iconMapping;
export type meetingIconNamesType = keyof typeof meetingIconMapping;
/**
* Type guard to check if an icon is an IconPathDefinition
*/
export function hasIconPath(icon: IconDefinition): icon is IconPathDefinition {
return "path" in icon;
}
/**
* Type guard to check if an icon is an IconContentDefinition
*/
export function hasIconContent(icon: IconDefinition): icon is IconContentDefinition {
return "content" in icon;
}