adata-ui 2.1.40-beta.13 → 2.1.40-beta.15
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/elements/digit-badge/ADigitBadge.vue +3 -3
- package/components/elements/segmented/ASegmentedV2.vue +2 -2
- package/components/elements/status-badge/AStatusBadge.vue +69 -41
- package/components/elements/tree-select/components/ATreeSelectNode.vue +2 -2
- package/components/features/payment/process/PaymentKaspiQrSidePanel.vue +4 -2
- package/components/features/payment/process/PaymentMethodSidePanel.vue +7 -2
- package/components/features/payment/process/PaymentTopUpSidePanel.vue +9 -4
- package/components/overlays/side-panel/ASidePanel.vue +4 -1
- package/package.json +1 -1
- package/components/elements/status-badge-v2/StatusBadgeV2.vue +0 -76
|
@@ -30,7 +30,7 @@ const classes = computed(() =>
|
|
|
30
30
|
props.disabled ? 'text-gray-500 bg-deepblue-900/5' : typeSwitchValues[props.view][props.type],
|
|
31
31
|
'inline-flex items-center justify-center font-medium rounded-full select-none inline-flex outline-none',
|
|
32
32
|
sizeSwitchValues[props.size],
|
|
33
|
-
props.value && props.value.toString().length >
|
|
33
|
+
props.value && props.value.toString().length > 1 ? 'w-auto' : '',
|
|
34
34
|
])
|
|
35
35
|
|
|
36
36
|
export type StateType = {
|
|
@@ -70,8 +70,8 @@ const typeSwitchValues: ViewType = {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
const sizeSwitchValues: SizeSwitchValues = {
|
|
73
|
-
sm: 'w-4 h-4 px-1 text-
|
|
74
|
-
md: 'w-5 h-5 px-1 text-
|
|
73
|
+
sm: 'w-4 h-4 px-1 text-body-sm',
|
|
74
|
+
md: 'w-5 h-5 px-1 text-body-sm',
|
|
75
75
|
lg: 'px-2 w-6 h-6 text-body-sm font-semibold',
|
|
76
76
|
}
|
|
77
77
|
</script>
|
|
@@ -64,14 +64,14 @@ const CHIP_CLASS: Record<Color, Record<View | 'selected', string>> = {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
const DOT_CLASS: Record<Color, Record<View, string>> = {
|
|
67
|
-
gray: { outline: 'bg-[#
|
|
67
|
+
gray: { outline: 'bg-[#6A7282] dark:bg-gray-300', solid: 'bg-[#6A7282] dark:bg-gray-300' },
|
|
68
68
|
blue: { outline: 'bg-[#068DFF] dark:bg-blue-400', solid: 'bg-[#068DFF] dark:bg-blue-400' },
|
|
69
69
|
green: { outline: 'bg-[#00A63E] dark:bg-green-400', solid: 'bg-[#00A63E] dark:bg-green-400' },
|
|
70
70
|
yellow: { outline: 'bg-[#E17100] dark:bg-orange-400', solid: 'bg-[#E17100] dark:bg-orange-400' },
|
|
71
71
|
red: { outline: 'bg-[#E7000B] dark:bg-red-400', solid: 'bg-[#E7000B] dark:bg-red-400' },
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
const DOT_SELECTED_CLASS = 'bg-white
|
|
74
|
+
const DOT_SELECTED_CLASS = 'bg-white'
|
|
75
75
|
|
|
76
76
|
function dotColorName(option: Option): Color {
|
|
77
77
|
return option.color ?? props.color
|
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
|
|
2
|
+
type BadgeType = 'primary' | 'success' | 'danger' | 'gray' | 'warning'
|
|
3
|
+
type BadgeView = 'default' | 'inverted' | 'transparent'
|
|
4
|
+
type BadgeSize = 'xs' | 'sm' | 'lg'
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
type StateType = {
|
|
7
|
+
[key in BadgeType]?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface ViewType {
|
|
11
|
+
default: StateType
|
|
12
|
+
inverted: StateType
|
|
13
|
+
transparent: StateType
|
|
14
|
+
}
|
|
5
15
|
|
|
6
16
|
interface Props {
|
|
7
|
-
type?:
|
|
8
|
-
view?:
|
|
9
|
-
size?:
|
|
17
|
+
type?: BadgeType
|
|
18
|
+
view?: BadgeView
|
|
19
|
+
size?: BadgeSize
|
|
20
|
+
point?: boolean
|
|
10
21
|
customClasses?: string
|
|
11
22
|
}
|
|
12
23
|
|
|
24
|
+
defineOptions({ name: 'AStatusBadge' })
|
|
25
|
+
|
|
13
26
|
const props = withDefaults(defineProps<Props>(), {
|
|
14
27
|
type: 'primary',
|
|
15
28
|
view: 'default',
|
|
16
29
|
size: 'lg',
|
|
17
|
-
|
|
30
|
+
point: false,
|
|
31
|
+
customClasses: '',
|
|
18
32
|
})
|
|
19
33
|
|
|
20
|
-
const classes = computed(() =>
|
|
21
|
-
[
|
|
22
|
-
'text-body-md rounded-sm select-none inline-flex gap-[5.5px] justify-center items-center border',
|
|
23
|
-
typeSwitchValues[props.view][props.type],
|
|
24
|
-
props.size === 'xs'? 'px-4 py-[2px] text-body-sm font-bold' : '',
|
|
25
|
-
props.size === 'sm'? 'text-body-sm font-semibold px-4 py-[2px] h-6' : '',
|
|
26
|
-
props.size === 'lg'? 'px-4 py-[7.5px] font-semibold' : '',
|
|
27
|
-
])
|
|
28
|
-
|
|
29
34
|
const typeSwitchValues: ViewType = {
|
|
30
35
|
default: {
|
|
31
36
|
primary: 'bg-[#068DFF] text-white border-transparent dark:bg-[#068DFF]/30 dark:text-blue-100',
|
|
@@ -33,45 +38,68 @@ const typeSwitchValues: ViewType = {
|
|
|
33
38
|
danger: 'bg-[#E7000B] text-white border-transparent dark:bg-[#E7000B]/30 dark:text-red-100',
|
|
34
39
|
warning: 'bg-[#E17100] text-white border-transparent dark:bg-[#E17100]/30 dark:text-orange-100',
|
|
35
40
|
gray: 'bg-[#4A5565] text-white border-transparent dark:bg-[#4A5565]/30 dark:text-gray-100',
|
|
36
|
-
orange: 'bg-[#E17100] text-white border-transparent dark:bg-[#E17100]/30 dark:text-orange-100'
|
|
37
41
|
},
|
|
38
42
|
inverted: {
|
|
39
43
|
primary: 'bg-[#F0F8FF] text-[#068DFF] border-transparent dark:bg-[#068DFF]/10 dark:text-blue-400',
|
|
40
|
-
success: 'bg-[#DCFCE7] text-[#
|
|
41
|
-
danger: 'bg-[#FFE2E2] text-[#
|
|
42
|
-
warning: 'bg-[#FEF3C6] text-[#
|
|
43
|
-
gray: 'bg-[#F3F4F6] text-[#
|
|
44
|
-
orange: 'bg-[#FEF3C6] text-[#E17100] border-transparent dark:bg-[#E17100]/10 dark:text-orange-400'
|
|
44
|
+
success: 'bg-[#DCFCE7] text-[#008236] border-transparent dark:bg-[#00A63E]/10 dark:text-green-400',
|
|
45
|
+
danger: 'bg-[#FFE2E2] text-[#C10007] border-transparent dark:bg-[#E7000B]/10 dark:text-red-400',
|
|
46
|
+
warning: 'bg-[#FEF3C6] text-[#9A5800] border-transparent dark:bg-[#E17100]/10 dark:text-orange-400',
|
|
47
|
+
gray: 'bg-[#F3F4F6] text-[#364153] border-transparent dark:bg-[#4A5565]/10 dark:text-gray-300',
|
|
45
48
|
},
|
|
46
49
|
transparent: {
|
|
47
|
-
primary: 'bg-white border-[#B3DCFF] text-[#
|
|
48
|
-
success: 'bg-white border-[#7BF1A8] text-[#
|
|
49
|
-
danger: 'bg-white border-[#FFA2A2] text-[#
|
|
50
|
-
warning: 'bg-white border-[#FFD230] text-[#
|
|
51
|
-
gray: 'bg-white border-[#D1D5DC] text-[#
|
|
52
|
-
|
|
53
|
-
}
|
|
50
|
+
primary: 'bg-white border-[#B3DCFF] text-[#0066BD] dark:bg-transparent dark:border-[#068DFF]/50 dark:text-blue-400',
|
|
51
|
+
success: 'bg-white border-[#7BF1A8] text-[#008236] dark:bg-transparent dark:border-[#00A63E]/50 dark:text-green-400',
|
|
52
|
+
danger: 'bg-white border-[#FFA2A2] text-[#C10007] dark:bg-transparent dark:border-[#E7000B]/50 dark:text-red-400',
|
|
53
|
+
warning: 'bg-white border-[#FFD230] text-[#9A5800] dark:bg-transparent dark:border-[#E17100]/50 dark:text-orange-400',
|
|
54
|
+
gray: 'bg-white border-[#D1D5DC] text-[#364153] dark:bg-transparent dark:border-[#4A5565]/50 dark:text-gray-300',
|
|
55
|
+
},
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
const pointSwitchValues: ViewType = {
|
|
59
|
+
default: {
|
|
60
|
+
primary: 'bg-white',
|
|
61
|
+
success: 'bg-white',
|
|
62
|
+
danger: 'bg-white',
|
|
63
|
+
warning: 'bg-white',
|
|
64
|
+
gray: 'bg-white',
|
|
65
|
+
},
|
|
66
|
+
inverted: {
|
|
67
|
+
primary: 'bg-[#068DFF] dark:bg-blue-400',
|
|
68
|
+
success: 'bg-[#00A63E] dark:bg-green-400',
|
|
69
|
+
danger: 'bg-[#E7000B] dark:bg-red-400',
|
|
70
|
+
warning: 'bg-[#E17100] dark:bg-orange-400',
|
|
71
|
+
gray: 'bg-[#6A7282] dark:bg-gray-300',
|
|
72
|
+
},
|
|
73
|
+
transparent: {
|
|
74
|
+
primary: 'bg-[#068DFF] dark:bg-blue-400',
|
|
75
|
+
success: 'bg-[#00A63E] dark:bg-green-400',
|
|
76
|
+
danger: 'bg-[#E7000B] dark:bg-red-400',
|
|
77
|
+
warning: 'bg-[#E17100] dark:bg-orange-400',
|
|
78
|
+
gray: 'bg-[#6A7282] dark:bg-gray-300',
|
|
79
|
+
},
|
|
61
80
|
}
|
|
62
81
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
82
|
+
const classes = computed(() =>
|
|
83
|
+
[
|
|
84
|
+
'text-body-md rounded-sm select-none inline-flex gap-[5.5px] justify-center items-center border',
|
|
85
|
+
typeSwitchValues[props.view][props.type],
|
|
86
|
+
props.size === 'xs' ? 'px-4 py-[2px] text-body-sm font-bold' : '',
|
|
87
|
+
props.size === 'sm' ? 'text-body-sm font-semibold px-4 py-[2px] h-6' : '',
|
|
88
|
+
props.size === 'lg' ? 'px-4 py-[7.5px] font-semibold' : '',
|
|
89
|
+
])
|
|
70
90
|
|
|
91
|
+
const pointClasses = computed(() =>
|
|
92
|
+
[
|
|
93
|
+
'w-1.5 h-1.5 rounded-full shrink-0',
|
|
94
|
+
pointSwitchValues[props.view][props.type],
|
|
95
|
+
])
|
|
71
96
|
</script>
|
|
97
|
+
|
|
72
98
|
<template>
|
|
73
99
|
<div :class="[[classes], customClasses]">
|
|
74
|
-
<slot name="point"
|
|
100
|
+
<slot name="point">
|
|
101
|
+
<span v-if="point" :class="pointClasses" />
|
|
102
|
+
</slot>
|
|
75
103
|
<slot />
|
|
76
104
|
</div>
|
|
77
105
|
</template>
|
|
@@ -50,8 +50,8 @@ function onSelectToggle() {
|
|
|
50
50
|
<a-checkbox-v2
|
|
51
51
|
v-if="type === 'checkbox'"
|
|
52
52
|
size="lg"
|
|
53
|
-
side="
|
|
54
|
-
class="flex w-full items-center
|
|
53
|
+
side="right"
|
|
54
|
+
class="flex w-full items-center text-left"
|
|
55
55
|
:model-value="node.state === 'checked'"
|
|
56
56
|
:intermediate="node.state === 'indeterminate'"
|
|
57
57
|
:disabled="isDisabled"
|
|
@@ -122,11 +122,12 @@ watch(isOpen, async (value) => {
|
|
|
122
122
|
<button
|
|
123
123
|
type="button"
|
|
124
124
|
class="rounded-md p-1 transition-colors hover:bg-gray-100 dark:hover:bg-white/[0.06]"
|
|
125
|
+
data-test-id="kaspi-qr-back-button"
|
|
125
126
|
@click="onBack"
|
|
126
127
|
>
|
|
127
128
|
<a-icon-chevron-left class="size-6" />
|
|
128
129
|
</button>
|
|
129
|
-
<p class="text-xl font-semibold text-deepblue-900 dark:text-gray-100">
|
|
130
|
+
<p class="text-xl font-semibold text-deepblue-900 dark:text-gray-100" data-test-id="kaspi-qr-title">
|
|
130
131
|
{{ t('payment.kaspi.title') }}
|
|
131
132
|
</p>
|
|
132
133
|
</div>
|
|
@@ -137,7 +138,7 @@ watch(isOpen, async (value) => {
|
|
|
137
138
|
{{ t('payment.kaspi.description') }}
|
|
138
139
|
</p>
|
|
139
140
|
|
|
140
|
-
<div class="flex flex-col items-center gap-5 rounded-xl border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-900">
|
|
141
|
+
<div class="flex flex-col items-center gap-5 rounded-xl border border-gray-200 bg-white p-6 dark:border-gray-700 dark:bg-gray-900" data-test-id="kaspi-qr-payment-block">
|
|
141
142
|
<div class="flex items-center gap-3">
|
|
142
143
|
<a-icon-kaspi-qr class="size-14" />
|
|
143
144
|
<span class="text-[40px] font-bold leading-none text-deepblue-900 dark:text-white">
|
|
@@ -165,6 +166,7 @@ watch(isOpen, async (value) => {
|
|
|
165
166
|
view="outline"
|
|
166
167
|
color="gray"
|
|
167
168
|
size="lg"
|
|
169
|
+
data-test-id="kaspi-qr-change-payment-method-button"
|
|
168
170
|
block
|
|
169
171
|
@click="onBack"
|
|
170
172
|
>
|
|
@@ -18,8 +18,8 @@ const { t } = useI18n()
|
|
|
18
18
|
|
|
19
19
|
const selected = ref<IBank>('kaspi')
|
|
20
20
|
const cards = [
|
|
21
|
-
{ id: 'kaspi', name: 'payment.method.kaspi', img: AIconPaymentKaspi },
|
|
22
|
-
{ id: 'other', name: 'payment.method.other', img: AIconPaymentCard },
|
|
21
|
+
{ id: 'kaspi', name: 'payment.method.kaspi', img: AIconPaymentKaspi, dataTestId: 'payment-method-kaspi-button' },
|
|
22
|
+
{ id: 'other', name: 'payment.method.other', img: AIconPaymentCard, dataTestId: 'payment-method-other-bank-button' },
|
|
23
23
|
] as const
|
|
24
24
|
|
|
25
25
|
const formattedSum = computed(() => Math.round(props.sum).toLocaleString('ru-RU'))
|
|
@@ -41,12 +41,14 @@ function onBack() {
|
|
|
41
41
|
<a-side-panel
|
|
42
42
|
v-model="isOpen"
|
|
43
43
|
width="484px"
|
|
44
|
+
data-test-id="payment-method-modal"
|
|
44
45
|
>
|
|
45
46
|
<template #header>
|
|
46
47
|
<div class="flex items-center gap-2">
|
|
47
48
|
<button
|
|
48
49
|
type="button"
|
|
49
50
|
class="rounded-md p-1 transition-colors hover:bg-gray-100 dark:hover:bg-white/[0.06]"
|
|
51
|
+
data-test-id="payment-method-back-button"
|
|
50
52
|
@click="onBack"
|
|
51
53
|
>
|
|
52
54
|
<a-icon-chevron-left class="size-6" />
|
|
@@ -75,6 +77,7 @@ function onBack() {
|
|
|
75
77
|
:key="item.id"
|
|
76
78
|
type="button"
|
|
77
79
|
class="flex items-center gap-3 rounded-xl border p-4 text-left transition-colors"
|
|
80
|
+
:data-test-id="item.dataTestId"
|
|
78
81
|
:class="selected === item.id
|
|
79
82
|
? 'border-blue-500 bg-blue-50/60 dark:border-blue-400 dark:bg-blue-950/30'
|
|
80
83
|
: 'border-gray-200 bg-white hover:border-gray-300 hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:hover:bg-gray-800'"
|
|
@@ -111,6 +114,7 @@ function onBack() {
|
|
|
111
114
|
<div class="flex flex-col gap-2">
|
|
112
115
|
<a-button-v2
|
|
113
116
|
size="lg"
|
|
117
|
+
data-test-id="payment-method-submit-button"
|
|
114
118
|
block
|
|
115
119
|
@click="confirm"
|
|
116
120
|
>
|
|
@@ -120,6 +124,7 @@ function onBack() {
|
|
|
120
124
|
view="outline"
|
|
121
125
|
color="gray"
|
|
122
126
|
size="lg"
|
|
127
|
+
data-test-id="payment-method-close-button"
|
|
123
128
|
block
|
|
124
129
|
@click="cancel"
|
|
125
130
|
>
|
|
@@ -11,10 +11,10 @@ const money = ref<number | string>(0)
|
|
|
11
11
|
const errorAlert = ref(false)
|
|
12
12
|
|
|
13
13
|
const sumArr = [
|
|
14
|
-
{ id: 1, value: 2000, label: '2 000 ₸' },
|
|
15
|
-
{ id: 2, value: 5000, label: '5 000 ₸' },
|
|
16
|
-
{ id: 3, value: 10000, label: '10 000 ₸' },
|
|
17
|
-
{ id: 4, value: 20000, label: '20 000 ₸' },
|
|
14
|
+
{ id: 1, value: 2000, label: '2 000 ₸', dataTestId: 'topup-balance-amount-2000-button' },
|
|
15
|
+
{ id: 2, value: 5000, label: '5 000 ₸', dataTestId: 'topup-balance-amount-5000-button' },
|
|
16
|
+
{ id: 3, value: 10000, label: '10 000 ₸', dataTestId: 'topup-balance-amount-10000-button' },
|
|
17
|
+
{ id: 4, value: 20000, label: '20 000 ₸', dataTestId: 'topup-balance-amount-20000-button' },
|
|
18
18
|
]
|
|
19
19
|
|
|
20
20
|
const amount = computed(() => Number(money.value) || 0)
|
|
@@ -45,6 +45,7 @@ function handlePayment() {
|
|
|
45
45
|
<a-side-panel
|
|
46
46
|
v-model="isOpen"
|
|
47
47
|
width="484px"
|
|
48
|
+
data-test-id="topup-balance-modal"
|
|
48
49
|
>
|
|
49
50
|
<template #header>
|
|
50
51
|
<div class="text-xl font-semibold text-deepblue-900 dark:text-gray-100">
|
|
@@ -67,6 +68,7 @@ function handlePayment() {
|
|
|
67
68
|
type="number"
|
|
68
69
|
size="md"
|
|
69
70
|
clearable
|
|
71
|
+
data-test-id="topup-topup-balance-amount-input"
|
|
70
72
|
:error="errorAlert ? t('modals.replenish_modal.error') : undefined"
|
|
71
73
|
/>
|
|
72
74
|
|
|
@@ -76,6 +78,7 @@ function handlePayment() {
|
|
|
76
78
|
:key="item.id"
|
|
77
79
|
type="button"
|
|
78
80
|
class="rounded-lg border px-3 py-2.5 text-sm font-semibold transition-colors"
|
|
81
|
+
:data-test-id="item.dataTestId"
|
|
79
82
|
:class="amount === item.value
|
|
80
83
|
? 'border-blue-500 bg-blue-50 text-blue-700 dark:border-blue-400 dark:bg-blue-950/40 dark:text-blue-300'
|
|
81
84
|
: 'border-gray-200 bg-white text-deepblue-900 hover:border-gray-300 hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:bg-gray-800'"
|
|
@@ -91,6 +94,7 @@ function handlePayment() {
|
|
|
91
94
|
<div class="flex flex-col gap-2">
|
|
92
95
|
<a-button-v2
|
|
93
96
|
size="lg"
|
|
97
|
+
data-test-id="topup-balance-submit-button"
|
|
94
98
|
block
|
|
95
99
|
:disabled="!filterMoney"
|
|
96
100
|
@click="handlePayment"
|
|
@@ -101,6 +105,7 @@ function handlePayment() {
|
|
|
101
105
|
view="outline"
|
|
102
106
|
color="gray"
|
|
103
107
|
size="lg"
|
|
108
|
+
data-test-id="topup-balance-back-button"
|
|
104
109
|
block
|
|
105
110
|
@click="onClose"
|
|
106
111
|
>
|
|
@@ -24,6 +24,7 @@ const props = withDefaults(defineProps<{
|
|
|
24
24
|
headerClass?: string
|
|
25
25
|
bodyClass?: string
|
|
26
26
|
footerClass?: string
|
|
27
|
+
dataTestId?: string
|
|
27
28
|
}>(), {
|
|
28
29
|
idName: "vsp-container",
|
|
29
30
|
side: "right",
|
|
@@ -36,7 +37,8 @@ const props = withDefaults(defineProps<{
|
|
|
36
37
|
overlayOpacity: 0.5,
|
|
37
38
|
overlayDuration: 500,
|
|
38
39
|
panelColor: "bg-white dark:bg-gray-900",
|
|
39
|
-
panelDuration: 300
|
|
40
|
+
panelDuration: 300,
|
|
41
|
+
dataTestId: undefined,
|
|
40
42
|
})
|
|
41
43
|
|
|
42
44
|
defineEmits<{
|
|
@@ -219,6 +221,7 @@ const touchend = () => {
|
|
|
219
221
|
class="vsp fixed flex flex-col"
|
|
220
222
|
:class="[`vsp--${panelSide}-side`, $attrs.class, roundedClass, panelColor]"
|
|
221
223
|
:style="panelStyles"
|
|
224
|
+
:data-test-id="dataTestId"
|
|
222
225
|
>
|
|
223
226
|
<div
|
|
224
227
|
class="w-full flex justify-center items-center mt-1 lg:hidden"
|
package/package.json
CHANGED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { twMerge } from '#adata-ui/utils/twMerge'
|
|
3
|
-
|
|
4
|
-
defineOptions({ name: 'StatusBadgeV2', inheritAttrs: false })
|
|
5
|
-
|
|
6
|
-
type BadgeType = 'primary' | 'success' | 'danger' | 'gray' | 'orange' | 'warning'
|
|
7
|
-
type BadgeView = 'default' | 'inverted' | 'transparent'
|
|
8
|
-
type BadgeSize = 'xs' | 'sm' | 'md' | 'lg'
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
type?: BadgeType
|
|
12
|
-
view?: BadgeView
|
|
13
|
-
size?: BadgeSize
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const props = withDefaults(defineProps<Props>(), {
|
|
17
|
-
type: 'primary',
|
|
18
|
-
view: 'inverted',
|
|
19
|
-
size: 'sm',
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const base
|
|
23
|
-
= 'inline-flex w-fit items-center justify-center gap-1.5 rounded-full font-semibold select-none'
|
|
24
|
-
|
|
25
|
-
const sizeClasses: Record<BadgeSize, string> = {
|
|
26
|
-
xs: 'px-2 py-0.5 text-[11px] leading-none',
|
|
27
|
-
sm: 'px-2.5 py-1 text-xs leading-none',
|
|
28
|
-
md: 'px-3 py-1.5 text-sm',
|
|
29
|
-
lg: 'px-4 py-2 text-base',
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const typeClasses: Record<BadgeView, Partial<Record<BadgeType, string>>> = {
|
|
33
|
-
default: {
|
|
34
|
-
primary: 'bg-blue-700 text-white dark:bg-blue-500 dark:text-gray-900',
|
|
35
|
-
success: 'bg-green-500 text-white dark:bg-green-400 dark:text-gray-900',
|
|
36
|
-
danger: 'bg-red-500 text-white dark:text-gray-100',
|
|
37
|
-
warning: 'bg-yellow-400 text-white dark:text-gray-900',
|
|
38
|
-
gray: 'bg-deepblue-900 text-white dark:bg-gray-200/10 dark:text-gray-200',
|
|
39
|
-
orange: 'bg-orange-600 text-white dark:text-gray-100',
|
|
40
|
-
},
|
|
41
|
-
inverted: {
|
|
42
|
-
primary: 'bg-blue-700/10 text-blue-700 dark:bg-blue-500/10 dark:text-blue-500',
|
|
43
|
-
success: 'bg-green-500/15 text-green-600 dark:bg-green-400/15 dark:text-green-400',
|
|
44
|
-
danger: 'bg-red-500/10 text-red-500 dark:bg-red-400/10 dark:text-red-400',
|
|
45
|
-
warning: 'bg-yellow-400/15 text-yellow-500 dark:bg-yellow-400/15 dark:text-yellow-400',
|
|
46
|
-
gray: 'bg-deepblue-900/10 text-gray-600 dark:bg-gray-200/10 dark:text-gray-300',
|
|
47
|
-
orange: 'bg-orange-600/10 text-orange-600 dark:text-orange-500',
|
|
48
|
-
},
|
|
49
|
-
transparent: {
|
|
50
|
-
primary: 'bg-transparent text-blue-700 dark:text-blue-500',
|
|
51
|
-
success: 'bg-transparent text-green-600 dark:text-green-400',
|
|
52
|
-
danger: 'bg-transparent text-red-500 dark:text-red-400',
|
|
53
|
-
warning: 'bg-transparent text-yellow-500 dark:text-yellow-400',
|
|
54
|
-
gray: 'bg-transparent text-gray-600 dark:text-gray-300',
|
|
55
|
-
orange: 'bg-transparent text-orange-600 dark:text-orange-500',
|
|
56
|
-
},
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const attrs = useAttrs()
|
|
60
|
-
|
|
61
|
-
const classes = computed(() =>
|
|
62
|
-
twMerge(
|
|
63
|
-
base,
|
|
64
|
-
sizeClasses[props.size],
|
|
65
|
-
typeClasses[props.view][props.type],
|
|
66
|
-
attrs.class as string,
|
|
67
|
-
),
|
|
68
|
-
)
|
|
69
|
-
</script>
|
|
70
|
-
|
|
71
|
-
<template>
|
|
72
|
-
<div :class="classes" v-bind="{ ...$attrs, class: undefined }">
|
|
73
|
-
<slot name="point" />
|
|
74
|
-
<slot />
|
|
75
|
-
</div>
|
|
76
|
-
</template>
|