adata-ui 2.1.39 → 2.1.40-beta

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.
Files changed (29) hide show
  1. package/.playground/app.vue +102 -0
  2. package/components/elements/button-login/index.vue +6 -10
  3. package/components/features/color-mode/AColorMode.client.vue +74 -32
  4. package/components/features/dropdown/ADropdownV2.vue +141 -0
  5. package/components/features/lang-switcher/lang-switcher.vue +120 -40
  6. package/components/features//321/201hange-version/AChangeVersion.vue +1 -1
  7. package/components/navigation/header/AHeader.vue +56 -33
  8. package/components/navigation/header/AlmatyContacts.vue +1 -1
  9. package/components/navigation/header/CardGallery.vue +5 -3
  10. package/components/navigation/header/ContactMenu.vue +26 -92
  11. package/components/navigation/header/HeaderLink.vue +189 -215
  12. package/components/navigation/header/HeaderUsage.vue +125 -0
  13. package/components/navigation/header/NavList.vue +35 -50
  14. package/components/navigation/header/ProductMenu.vue +72 -126
  15. package/components/navigation/header/ProfileMenu.vue +131 -150
  16. package/components/navigation/header/SystemNotification.vue +110 -0
  17. package/components/navigation/mobile-navigation/AMobileNavigation.vue +23 -15
  18. package/components/navigation/pill-tabs/APillTabs.vue +7 -2
  19. package/components/overlays/tooltip/ATooltipV2.vue +233 -0
  20. package/components/overlays/tooltip/types.ts +26 -0
  21. package/components/overlays/tooltip/useTooltipTrigger.ts +101 -0
  22. package/composables/useHeaderNavigationLinks.ts +14 -7
  23. package/icons/gauge.vue +17 -0
  24. package/icons/sun.vue +13 -3
  25. package/lang/en.ts +6 -0
  26. package/lang/kk.ts +6 -0
  27. package/lang/ru.ts +6 -0
  28. package/package.json +1 -1
  29. package/components/navigation/header/TopHeader.vue +0 -196
@@ -1,196 +0,0 @@
1
- <script setup lang="ts">
2
- import ArrowCurrency from '#adata-ui/icons/currency/currency-down.vue'
3
- import UsdIcon from '#adata-ui/icons/currency/currency-usd.vue'
4
- import EurIcon from '#adata-ui/icons/currency/currency-eur.vue'
5
- import RubIcon from '#adata-ui/icons/currency/currency-rub.vue'
6
- import YuanIcon from '#adata-ui/icons/currency/currency-yuan.vue'
7
-
8
- interface Props {
9
- daysRemaining: number
10
- limitRemaining: number
11
- moduleName: string
12
- isAuthenticated: boolean
13
- }
14
-
15
- const props = withDefaults(defineProps<Props>(), {
16
- moduleName: 'counterparty'
17
- })
18
-
19
- const { t, locale } = useI18n()
20
-
21
- interface ResponseData<DataResult> {
22
- success: boolean
23
- message: string
24
- data: DataResult
25
- }
26
-
27
- interface Currency {
28
- buy: number
29
- buy_state: string
30
- currency: 'USD' | 'EUR' | 'RUB' | 'CNY'
31
- sell: number
32
- sell_state: string
33
- }
34
-
35
- interface Currencies {
36
- currencies: Currency[]
37
- request_time: string
38
- time: string
39
- }
40
-
41
- const currencies = ref<Currency[]>([])
42
- const systemMessage = ref(null)
43
- const isOpenNotification = ref(false)
44
- const message = useCookie('message')
45
-
46
- const { myLayer } = useAppConfig()
47
- const env = myLayer.mode
48
-
49
- const mode = computed(() => {
50
- if (props.moduleName === 'pk') {
51
- return 'counterparty'
52
- } else {
53
- return props.moduleName
54
- }
55
- })
56
-
57
- const fetchCurrencies = async () => {
58
- try {
59
- const response = await fetch('https://users.adata.kz/api/v1/information/currency')
60
- const { data } = await response.json()
61
-
62
- if (data.currencies) {
63
- currencies.value = data.currencies
64
- }
65
- } catch (e) {
66
- console.error(e.message)
67
- }
68
- }
69
-
70
- const Symbols = {
71
- USD: UsdIcon,
72
- EUR: EurIcon,
73
- RUB: RubIcon,
74
- CNY: YuanIcon
75
- }
76
-
77
- const computedClass = (state: string) =>
78
- state === 'UP' ? 'text-green-400 rotate-180' : 'text-red-400'
79
-
80
- const fetchNotification = async () => {
81
- try {
82
- if (message.value === undefined) {
83
- const link = `https://users.${env}.kz/api/v1/system-messages/active-list/?module_name=${mode.value}`
84
- const response = await fetch(link)
85
- const { data } = await response.json()
86
-
87
- if (data.details?.length) {
88
- switch (locale.value) {
89
- case 'ru':
90
- systemMessage.value = data.details[0].message
91
- break
92
- case 'en':
93
- systemMessage.value = data.details[0].message_en
94
- break
95
- case 'kk':
96
- systemMessage.value = data.details[0].message_kz
97
- break
98
- }
99
- isOpenNotification.value = true
100
- }
101
- }
102
- } catch (e) {
103
- console.error(e.message)
104
- }
105
- }
106
-
107
- onMounted(() => {
108
- fetchNotification()
109
- fetchCurrencies()
110
- })
111
-
112
- const closeMessage = () => {
113
- message.value = false
114
- isOpenNotification.value = false
115
- }
116
- </script>
117
-
118
- <template>
119
- <div class="min-h-[40px]" :class="[isOpenNotification && systemMessage ? '' : 'hidden lg:block']">
120
- <client-only>
121
- <transition name="fade">
122
- <div
123
- v-if="isOpenNotification && systemMessage"
124
- class="bg-[#FFF5E6] px-2 py-3 text-[#FCA204] dark:bg-[#161617] md:px-0"
125
- >
126
- <div class="a-container flex items-center justify-between">
127
- <div class="flex items-center gap-2">
128
- <a-icon-info-circle
129
- class="max-h-[16px] w-full max-w-[16px] stroke-orange-500 dark:stroke-orange-500"
130
- />
131
- <span class="text-sm font-semibold text-orange-500">{{ systemMessage }}</span>
132
- </div>
133
- <a-icon-x-mark
134
- class="max-h-[16px] w-full max-w-[16px] cursor-pointer stroke-orange-500"
135
- @click="closeMessage"
136
- />
137
- </div>
138
- </div>
139
- </transition>
140
- <div
141
- v-if="!isOpenNotification || !systemMessage"
142
- class="hidden min-h-10 bg-gray-50 dark:bg-gray-950 lg:block"
143
- >
144
- <div class="a-container flex justify-between py-2 items-center text-sm">
145
- <div class="flex items-center leading-[24px]" data-test-id="header-currency-bar">
146
- <div v-for="currency in currencies" :key="currency.currency" class="mr-4 flex gap-2">
147
- <div class="flex items-center">
148
- <component
149
- :is="Symbols[currency.currency]"
150
- class="mr-2 size-4 rounded-sm border border-solid border-[#E0E3E6] dark:border-[#2B2B2C]"
151
- />
152
- {{ currency.buy }}
153
- <div :class="computedClass(currency.sell_state)">
154
- <arrow-currency />
155
- </div>
156
- </div>
157
- <div class="flex items-center">
158
- {{ currency.sell }}
159
- <div :class="computedClass(currency.sell_state)">
160
- <arrow-currency />
161
- </div>
162
- </div>
163
- </div>
164
- </div>
165
- <div v-if="isAuthenticated" class="flex items-center gap-5">
166
- <div v-if="limitRemaining != null || limitRemaining != undefined">
167
- <span class="mr-2 text-xs">{{ t('header.top.requestLimit') }}</span>
168
- <a-status-badge size="sm" data-test-id="header-daily-requests-count">
169
- {{ limitRemaining }}
170
- </a-status-badge>
171
- </div>
172
- <div v-if="daysRemaining">
173
- <span class="mr-2 text-xs">{{ t('header.top.daysLeft') }}</span>
174
- <a-status-badge size="sm" data-test-id="header-tariff-days-remaining-count">
175
- {{ daysRemaining }}
176
- </a-status-badge>
177
- </div>
178
- </div>
179
- </div>
180
- </div>
181
- </client-only>
182
- </div>
183
- </template>
184
-
185
- <style scoped>
186
- .fade-enter-active,
187
- .fade-leave-active {
188
- transition: 0.1s ease;
189
- }
190
-
191
- .fade-enter,
192
- .fade-leave-to {
193
- opacity: 0;
194
- top: 0px;
195
- }
196
- </style>