icons.js
2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* eslint-disable regex/invalid */
import checkboxChecked from '@images/svg/checkbox-checked.svg'
import checkboxIndeterminate from '@images/svg/checkbox-indeterminate.svg'
import checkboxUnchecked from '@images/svg/checkbox-unchecked.svg'
import radioChecked from '@images/svg/radio-checked.svg'
import radioUnchecked from '@images/svg/radio-unchecked.svg'
const customIcons = {
'mdi-checkbox-blank-outline': checkboxUnchecked,
'mdi-checkbox-marked': checkboxChecked,
'mdi-minus-box': checkboxIndeterminate,
'mdi-radiobox-marked': radioChecked,
'mdi-radiobox-blank': radioUnchecked,
}
const aliases = {
info: 'ri-error-warning-line',
success: 'ri-checkbox-circle-line',
warning: 'ri-alert-line',
error: 'ri-error-warning-line',
calendar: 'ri-calendar-2-line',
collapse: 'ri-arrow-up-s-line',
complete: 'ri-check-line',
cancel: 'ri-close-line',
close: 'ri-close-line',
delete: 'ri-close-circle-fill',
clear: 'ri-close-line',
prev: 'ri-arrow-left-s-line',
next: 'ri-arrow-right-s-line',
delimiter: 'ri-circle-line',
sort: 'ri-arrow-up-line',
expand: 'ri-arrow-down-s-line',
menu: 'ri-menu-line',
subgroup: 'ri-arrow-down-s-fill',
dropdown: 'ri-arrow-down-s-line',
edit: 'ri-pencil-line',
ratingEmpty: 'ri-star-line',
ratingFull: 'ri-star-fill',
ratingHalf: 'ri-star-half-line',
loading: 'ri-refresh-line',
first: 'ri-skip-back-mini-line',
last: 'ri-skip-forward-mini-line',
unfold: 'ri-split-cells-vertical',
file: 'ri-attachment-2',
plus: 'ri-add-line',
minus: 'ri-subtract-line',
sortAsc: 'ri-arrow-up-line',
sortDesc: 'ri-arrow-down-line',
}
/* eslint-enable */
export const iconify = {
component: props => {
// Load custom SVG directly instead of going through icon component
if (typeof props.icon === 'string') {
const iconComponent = customIcons[props.icon]
if (iconComponent)
return h(iconComponent)
}
return h(props.tag, {
...props,
// As we are using class based icons
class: [props.icon],
// Remove used props from DOM rendering
tag: undefined,
icon: undefined,
})
},
}
export const icons = {
defaultSet: 'iconify',
aliases,
sets: {
iconify,
},
}