@imaginario27/air-ui-ds 1.0.22 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/icons/ContainedIcon.vue +27 -14
- package/components/icons/Icon.vue +82 -0
- package/models/enums/icons.ts +19 -0
- package/models/types/icons.ts +6 -0
- package/nuxt.config.ts +8 -1
- package/package.json +2 -1
|
@@ -11,25 +11,35 @@
|
|
|
11
11
|
iconContainerSizeClass,
|
|
12
12
|
]"
|
|
13
13
|
>
|
|
14
|
-
<
|
|
15
|
-
:icon
|
|
16
|
-
:
|
|
17
|
-
|
|
18
|
-
:
|
|
14
|
+
<Icon
|
|
15
|
+
:icon
|
|
16
|
+
:type
|
|
17
|
+
:mode
|
|
18
|
+
:iconClass
|
|
19
19
|
/>
|
|
20
20
|
</div>
|
|
21
21
|
</template>
|
|
22
22
|
<script setup lang="ts">
|
|
23
23
|
// Props
|
|
24
24
|
const props = defineProps({
|
|
25
|
+
icon: {
|
|
26
|
+
type: String as PropType<any>,
|
|
27
|
+
default: 'mdiHelp',
|
|
28
|
+
},
|
|
25
29
|
styleType: {
|
|
26
30
|
type: String as PropType<IconContainerStyleType>,
|
|
27
31
|
default: IconContainerStyleType.FLAT,
|
|
28
32
|
validator: (value: IconContainerStyleType) => Object.values(IconContainerStyleType).includes(value),
|
|
29
33
|
},
|
|
30
|
-
|
|
31
|
-
type: String as PropType<
|
|
32
|
-
default:
|
|
34
|
+
type: {
|
|
35
|
+
type: String as PropType<IconType>,
|
|
36
|
+
default: IconType.NATIVE,
|
|
37
|
+
validator: (value: IconType) => Object.values(IconType).includes(value),
|
|
38
|
+
},
|
|
39
|
+
mode: {
|
|
40
|
+
type: String as PropType<IconMode>,
|
|
41
|
+
default: IconMode.CSS,
|
|
42
|
+
validator: (value: IconMode) => Object.values(IconMode).includes(value),
|
|
33
43
|
},
|
|
34
44
|
shape: {
|
|
35
45
|
type: String as PropType<IconContainerShape>,
|
|
@@ -118,13 +128,16 @@ const iconContainerSizeClass = computed(() => {
|
|
|
118
128
|
|
|
119
129
|
const iconSizeClass = computed(() => {
|
|
120
130
|
const sizeVariants = {
|
|
121
|
-
[IconContainerSize.LG]: '
|
|
122
|
-
[IconContainerSize.XL]: '
|
|
123
|
-
[IconContainerSize.XXL]: '
|
|
124
|
-
[IconContainerSize.XXXL]: '
|
|
131
|
+
[IconContainerSize.LG]: 'w-[24px] h-[24px] min-w-[24px] min-h-[24px]',
|
|
132
|
+
[IconContainerSize.XL]: 'w-[24px] h-[24px] min-w-[24px] min-h-[24px]',
|
|
133
|
+
[IconContainerSize.XXL]: 'w-[40px] h-[40px] min-w-[40px] min-h-[40px]',
|
|
134
|
+
[IconContainerSize.XXXL]: 'w-[48px] h-[48px] min-w-[48px] min-h-[48px]',
|
|
125
135
|
}
|
|
126
136
|
|
|
127
|
-
return sizeVariants[props.size as IconContainerSize] || '
|
|
137
|
+
return sizeVariants[props.size as IconContainerSize] || 'w-[24px] h-[24px] min-w-[24px] min-h-[24px]'
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
const iconClass = computed(() => {
|
|
141
|
+
return [iconSizeClass.value, iconColorClass.value].join(' ')
|
|
128
142
|
})
|
|
129
|
-
|
|
130
143
|
</script>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<MdiIcon
|
|
3
|
+
v-if="type === IconType.NATIVE"
|
|
4
|
+
:icon
|
|
5
|
+
preserveAspectRatio="xMidYMid meet"
|
|
6
|
+
:class="[
|
|
7
|
+
iconSizeClass,
|
|
8
|
+
iconColorClass,
|
|
9
|
+
iconClass,
|
|
10
|
+
]"
|
|
11
|
+
/>
|
|
12
|
+
<NuxtIcon
|
|
13
|
+
v-else-if="type === IconType.COLLECTION"
|
|
14
|
+
:name="icon"
|
|
15
|
+
:mode
|
|
16
|
+
:customize="svgCustomize"
|
|
17
|
+
:class="[
|
|
18
|
+
iconSizeClass,
|
|
19
|
+
iconColorClass,
|
|
20
|
+
iconClass,
|
|
21
|
+
]"
|
|
22
|
+
/>
|
|
23
|
+
</template>
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
// Props
|
|
26
|
+
const props = defineProps({
|
|
27
|
+
icon: {
|
|
28
|
+
type: String as PropType<any>,
|
|
29
|
+
default: 'mdiHelp',
|
|
30
|
+
},
|
|
31
|
+
type: {
|
|
32
|
+
type: String as PropType<IconType>,
|
|
33
|
+
default: IconType.NATIVE,
|
|
34
|
+
validator: (value: IconType) => Object.values(IconType).includes(value),
|
|
35
|
+
},
|
|
36
|
+
mode: {
|
|
37
|
+
type: String as PropType<IconMode>,
|
|
38
|
+
default: IconMode.CSS,
|
|
39
|
+
validator: (value: IconMode) => Object.values(IconMode).includes(value),
|
|
40
|
+
},
|
|
41
|
+
size: {
|
|
42
|
+
type: String as PropType<IconSize>,
|
|
43
|
+
default: IconSize.MD,
|
|
44
|
+
validator: (value: IconSize) => Object.values(IconSize).includes(value),
|
|
45
|
+
},
|
|
46
|
+
color: {
|
|
47
|
+
type: String as PropType<ColorAccent>,
|
|
48
|
+
default: ColorAccent.NEUTRAL,
|
|
49
|
+
validator: (value: ColorAccent) => Object.values(ColorAccent).includes(value),
|
|
50
|
+
},
|
|
51
|
+
svgCustomize: Function as PropType<CollectionCustomizeCallback>,
|
|
52
|
+
iconClass: String as PropType<string>,
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
// Computed classes
|
|
56
|
+
const iconSizeClass = computed(() => {
|
|
57
|
+
const variants = {
|
|
58
|
+
[IconSize.XS]: 'w-[12px] h-[12px] min-w-[12px] min-h-[12px]',
|
|
59
|
+
[IconSize.SM]: 'w-[16px] h-[16px] min-w-[16px] min-h-[16px]',
|
|
60
|
+
[IconSize.MD]: 'w-[20px] h-[20px] min-w-[20px] min-h-[20px]',
|
|
61
|
+
[IconSize.LG]: 'w-[24px] h-[24px] min-w-[24px] min-h-[24px]',
|
|
62
|
+
[IconSize.XL]: 'w-[32px] h-[32px] min-w-[32px] min-h-[32px]',
|
|
63
|
+
[IconSize.XXL]: 'w-[40px] h-[40px] min-w-[40px] min-h-[40px]',
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return variants[props.size as IconSize] || 'w-[20px] h-[20px] min-w-[20px] min-h-[20px]'
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const iconColorClass = computed(() => {
|
|
70
|
+
const variants = {
|
|
71
|
+
[ColorAccent.NEUTRAL]: 'text-icon-default',
|
|
72
|
+
[ColorAccent.SUCCESS]: 'text-icon-success',
|
|
73
|
+
[ColorAccent.WARNING]: 'text-icon-warning',
|
|
74
|
+
[ColorAccent.DANGER]: 'text-icon-danger',
|
|
75
|
+
[ColorAccent.INFO]: 'text-icon-info',
|
|
76
|
+
[ColorAccent.PRIMARY_BRAND]: 'text-icon-primary-brand-default',
|
|
77
|
+
[ColorAccent.SECONDARY_BRAND]: 'text-icon-secondary-brand-default',
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return variants[props.color as ColorAccent] || 'text-icon-default'
|
|
81
|
+
})
|
|
82
|
+
</script>
|
package/models/enums/icons.ts
CHANGED
|
@@ -19,4 +19,23 @@ export enum IconContainerSize {
|
|
|
19
19
|
XL = 'xl',
|
|
20
20
|
XXL = '2xl',
|
|
21
21
|
XXXL = '3xl',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export enum IconSize {
|
|
25
|
+
XS = 'xs',
|
|
26
|
+
SM = 'sm',
|
|
27
|
+
MD = 'md',
|
|
28
|
+
LG = 'lg',
|
|
29
|
+
XL = 'xl',
|
|
30
|
+
XXL = '2xl',
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export enum IconType {
|
|
34
|
+
NATIVE = 'native',
|
|
35
|
+
COLLECTION = 'collection',
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export enum IconMode {
|
|
39
|
+
CSS = 'css',
|
|
40
|
+
SVG = 'svg',
|
|
22
41
|
}
|
package/nuxt.config.ts
CHANGED
|
@@ -10,7 +10,7 @@ export default defineNuxtConfig({
|
|
|
10
10
|
'../air-ui-utils',
|
|
11
11
|
],
|
|
12
12
|
|
|
13
|
-
modules: ["@nuxt/image", "nuxt-mdi", "@nuxt/eslint", '@vueuse/nuxt'],
|
|
13
|
+
modules: ["@nuxt/image", "nuxt-mdi", "@nuxt/eslint", '@vueuse/nuxt', "@nuxt/icon"],
|
|
14
14
|
|
|
15
15
|
plugins: ["@/plugins/vue3-toastify"],
|
|
16
16
|
|
|
@@ -28,6 +28,13 @@ export default defineNuxtConfig({
|
|
|
28
28
|
},
|
|
29
29
|
],
|
|
30
30
|
|
|
31
|
+
icon: {
|
|
32
|
+
componentName: 'NuxtIcon',
|
|
33
|
+
serverBundle: {
|
|
34
|
+
collections: ['mdi']
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
31
38
|
eslint: {
|
|
32
39
|
// options here
|
|
33
40
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imaginario27/air-ui-ds",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.23",
|
|
4
4
|
"author": "imaginario27",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://air-ui.netlify.app/",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"@jaxtheprime/vue3-dropzone": "3.4.0",
|
|
27
27
|
"@nuxt/content": "3.7.1",
|
|
28
28
|
"@nuxt/eslint": "1.9.0",
|
|
29
|
+
"@nuxt/icon": "2.1.1",
|
|
29
30
|
"@nuxt/image": "1.11.0",
|
|
30
31
|
"@nuxtjs/i18n": "10.1.0",
|
|
31
32
|
"@tailwindcss/vite": "4.1.13",
|