@imaginario27/air-ui-ds 1.0.21 → 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/components/progress/ProgressBar.vue +194 -0
- package/models/enums/icons.ts +19 -0
- package/models/enums/progress.ts +7 -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>
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="w-full space-y-1.5"
|
|
4
|
+
>
|
|
5
|
+
<div
|
|
6
|
+
v-if="showProgressLabel && progressLabelPosition === Position.TOP"
|
|
7
|
+
:class="[
|
|
8
|
+
'text-xs text-text-neutral-subtle',
|
|
9
|
+
labelAlignmentClass,
|
|
10
|
+
progressLabelClass,
|
|
11
|
+
]"
|
|
12
|
+
>
|
|
13
|
+
{{ isIndeterminate ? loadingText : `${normalizedProgress}%` }}
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div
|
|
17
|
+
:class="[
|
|
18
|
+
'w-full',
|
|
19
|
+
'overflow-hidden',
|
|
20
|
+
barSizeClass,
|
|
21
|
+
incompleteBackgroundColorClass,
|
|
22
|
+
isRounded && 'rounded-full',
|
|
23
|
+
'relative',
|
|
24
|
+
]"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
v-if="!isIndeterminate && normalizedProgress > 0"
|
|
28
|
+
:class="[
|
|
29
|
+
'h-full',
|
|
30
|
+
'transition-all',
|
|
31
|
+
'duration-300',
|
|
32
|
+
'ease-in-out',
|
|
33
|
+
isRounded && 'rounded-full',
|
|
34
|
+
completedBackgroundColorClass,
|
|
35
|
+
progressClass,
|
|
36
|
+
]"
|
|
37
|
+
:style="{ width: `${normalizedProgress}%` }"
|
|
38
|
+
/>
|
|
39
|
+
|
|
40
|
+
<div
|
|
41
|
+
v-else-if="isIndeterminate"
|
|
42
|
+
:class="[
|
|
43
|
+
'absolute top-0 left-0 h-full w-1/3',
|
|
44
|
+
'indeterminate-bar',
|
|
45
|
+
isRounded && 'rounded-full',
|
|
46
|
+
completedBackgroundColorClass,
|
|
47
|
+
progressClass,
|
|
48
|
+
]"
|
|
49
|
+
/>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<div
|
|
53
|
+
v-if="showProgressLabel && progressLabelPosition === Position.BOTTOM"
|
|
54
|
+
:class="[
|
|
55
|
+
'text-xs text-text-neutral-subtle',
|
|
56
|
+
labelAlignmentClass,
|
|
57
|
+
progressLabelClass,
|
|
58
|
+
]"
|
|
59
|
+
>
|
|
60
|
+
{{ isIndeterminate ? loadingText : `${normalizedProgress}%` }}
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
<script setup lang="ts">
|
|
65
|
+
// Props
|
|
66
|
+
const props = defineProps({
|
|
67
|
+
progress: {
|
|
68
|
+
type: Number as PropType<number>,
|
|
69
|
+
default: 50,
|
|
70
|
+
},
|
|
71
|
+
color: {
|
|
72
|
+
type: String as PropType<ColorAccent>,
|
|
73
|
+
default: ColorAccent.PRIMARY_BRAND,
|
|
74
|
+
validator: (value: ColorAccent) => Object.values(ColorAccent).includes(value),
|
|
75
|
+
},
|
|
76
|
+
size: {
|
|
77
|
+
type: String as PropType<ProgressBarSize>,
|
|
78
|
+
default: ProgressBarSize.SM,
|
|
79
|
+
validator: (value: ProgressBarSize) => Object.values(ProgressBarSize).includes(value),
|
|
80
|
+
},
|
|
81
|
+
isRounded: {
|
|
82
|
+
type: Boolean as PropType<boolean>,
|
|
83
|
+
default: true,
|
|
84
|
+
},
|
|
85
|
+
showProgressLabel: {
|
|
86
|
+
type: Boolean as PropType<boolean>,
|
|
87
|
+
default: false,
|
|
88
|
+
},
|
|
89
|
+
progressLabelPosition: {
|
|
90
|
+
type: String as PropType<Position>,
|
|
91
|
+
default: Position.TOP,
|
|
92
|
+
validator: (value: Position) => Object.values(Position).includes(value),
|
|
93
|
+
},
|
|
94
|
+
progressLabelAlignment: {
|
|
95
|
+
type: String as PropType<Align>,
|
|
96
|
+
default: Align.CENTER,
|
|
97
|
+
validator: (value: Align) => Object.values(Align).includes(value),
|
|
98
|
+
},
|
|
99
|
+
min: {
|
|
100
|
+
type: Number as PropType<number>,
|
|
101
|
+
default: 0,
|
|
102
|
+
},
|
|
103
|
+
max: {
|
|
104
|
+
type: Number as PropType<number>,
|
|
105
|
+
default: 100,
|
|
106
|
+
},
|
|
107
|
+
isIndeterminate: {
|
|
108
|
+
type: Boolean as PropType<boolean>,
|
|
109
|
+
default: false,
|
|
110
|
+
},
|
|
111
|
+
loadingText: {
|
|
112
|
+
type: String as PropType<string>,
|
|
113
|
+
default: 'Loading...',
|
|
114
|
+
},
|
|
115
|
+
progressClass: String as PropType<string>,
|
|
116
|
+
progressLabelClass: String as PropType<string>,
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
// Computed
|
|
120
|
+
const normalizedProgress = computed(() => {
|
|
121
|
+
if (props.isIndeterminate) return 100
|
|
122
|
+
|
|
123
|
+
const clamped = Math.min(Math.max(props.progress, props.min), props.max)
|
|
124
|
+
const percent = ((clamped - props.min) / (props.max - props.min)) * 100
|
|
125
|
+
|
|
126
|
+
return Math.round(percent)
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
// Computed classes
|
|
130
|
+
const barSizeClass = computed(() => {
|
|
131
|
+
const variants = {
|
|
132
|
+
[ProgressBarSize.XS]: 'h-[4px]',
|
|
133
|
+
[ProgressBarSize.SM]: 'h-[8px]',
|
|
134
|
+
[ProgressBarSize.MD]: 'h-[12px]',
|
|
135
|
+
[ProgressBarSize.LG]: 'h-[16px]',
|
|
136
|
+
[ProgressBarSize.XL]: 'h-[20px]',
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return variants[props.size as ProgressBarSize] || 'h-[8px]'
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
const incompleteBackgroundColorClass = computed(() => {
|
|
143
|
+
const variants = {
|
|
144
|
+
[ColorAccent.NEUTRAL]: 'bg-background-neutral-default/10',
|
|
145
|
+
[ColorAccent.SUCCESS]: 'bg-background-success-bold/10',
|
|
146
|
+
[ColorAccent.WARNING]: 'bg-background-warning-bold/10',
|
|
147
|
+
[ColorAccent.DANGER]: 'bg-background-danger-bold/10',
|
|
148
|
+
[ColorAccent.INFO]: 'bg-background-info-bold/10',
|
|
149
|
+
[ColorAccent.PRIMARY_BRAND]: 'bg-background-primary-brand-default/10',
|
|
150
|
+
[ColorAccent.SECONDARY_BRAND]: 'bg-background-secondary-brand-default/10',
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return variants[props.color as ColorAccent] || 'bg-background-primary-brand-default/10'
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
const completedBackgroundColorClass = computed(() => {
|
|
157
|
+
const variants = {
|
|
158
|
+
[ColorAccent.NEUTRAL]: 'bg-background-neutral-default',
|
|
159
|
+
[ColorAccent.SUCCESS]: 'bg-background-success-bold',
|
|
160
|
+
[ColorAccent.WARNING]: 'bg-background-warning-bold',
|
|
161
|
+
[ColorAccent.DANGER]: 'bg-background-danger-bold',
|
|
162
|
+
[ColorAccent.INFO]: 'bg-background-info-bold',
|
|
163
|
+
[ColorAccent.PRIMARY_BRAND]: 'bg-background-primary-brand-default',
|
|
164
|
+
[ColorAccent.SECONDARY_BRAND]: 'bg-background-secondary-brand-default',
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return variants[props.color as ColorAccent] || 'bg-background-primary-brand-default'
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
const labelAlignmentClass = computed(() => {
|
|
171
|
+
const variants = {
|
|
172
|
+
[Align.LEFT]: 'text-left',
|
|
173
|
+
[Align.CENTER]: 'text-center',
|
|
174
|
+
[Align.RIGHT]: 'text-right',
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return variants[props.progressLabelAlignment as Align] || 'text-center'
|
|
178
|
+
})
|
|
179
|
+
</script>
|
|
180
|
+
|
|
181
|
+
<style scoped>
|
|
182
|
+
@keyframes indeterminate-slide {
|
|
183
|
+
0% {
|
|
184
|
+
transform: translateX(-100%);
|
|
185
|
+
}
|
|
186
|
+
100% {
|
|
187
|
+
transform: translateX(300%);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.indeterminate-bar {
|
|
192
|
+
animation: indeterminate-slide 2s ease-in-out infinite;
|
|
193
|
+
}
|
|
194
|
+
</style>
|
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",
|