adata-ui 2.1.0 → 2.1.2
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/.editorconfig +12 -12
- package/.nuxtrc +1 -1
- package/.playground/app.config.ts +5 -5
- package/README.md +75 -75
- package/app.config.ts +4 -3
- package/app.vue +1 -0
- package/assets/styles/index.scss +104 -0
- package/assets/styles/modules/_base.scss +5 -0
- package/assets/styles/modules/_typography.scss +152 -0
- package/components/elements/README.md +1 -1
- package/components/elements/accordion/AAccordion.vue +13 -12
- package/components/elements/curve-block/ACurveBlock.vue +94 -19
- package/components/elements/feature-description/AFeatureDescription.vue +4 -4
- package/components/elements/illustrations/noAccess.vue +11 -2
- package/components/elements/photos-animation/APhotosAnimation.vue +3 -1
- package/components/elements/select/ASelect.vue +65 -9
- package/components/features/lang-switcher/lang-switcher.vue +8 -1
- package/components/features/payment/banner/BasicPlusLimitBanner.vue +104 -0
- package/components/features/payment/banner/PaymentBanner.vue +108 -0
- package/components/features/payment/process/PaymentKaspiQrSidePanel.vue +158 -0
- package/components/features/payment/process/PaymentKaspiRedirectSidePanel.vue +112 -0
- package/components/features/payment/process/PaymentMethodSidePanel.vue +121 -0
- package/components/features/payment/process/PaymentProcess.vue +138 -0
- package/components/features/payment/process/PaymentTopUpSidePanel.vue +130 -0
- package/components/features/pk-mobile-services/APkMobileServices.vue +21 -2
- package/components/forms/README.md +1 -1
- package/components/forms/checkbox/ACheckbox.vue +0 -2
- package/components/forms/radio-button/ARadioButton.vue +21 -13
- package/components/forms/request-demo/ARequestDemo.vue +21 -7
- package/components/modals/AConfirmationEmail.vue +40 -0
- package/components/modals/AnotherDeviceModal.vue +3 -2
- package/components/modals/ConnectingTariffModal.vue +0 -1
- package/components/modals/ContentNavigationModal.vue +148 -75
- package/components/modals/Insufficient-funds-modal.vue +5 -2
- package/components/modals/LimitReachedModal.vue +4 -3
- package/components/modals/ReportBugModal.vue +3 -3
- package/components/modals/Resend.vue +82 -0
- package/components/modals/SubmitApplicationModal.vue +4 -0
- package/components/modals/id/AuthModal.vue +78 -0
- package/components/modals/id/IdAutoLogoutModal.vue +45 -0
- package/components/modals/id/IdBanner.vue +58 -0
- package/components/modals/id/IdConfirmAccountOtpModal.vue +186 -0
- package/components/modals/id/IdConfirmSuccessfulModal.vue +41 -0
- package/components/modals/id/IdLoginModal.vue +316 -0
- package/components/modals/id/IdModals.vue +114 -0
- package/components/modals/id/IdNewPasswordModal.vue +129 -0
- package/components/modals/id/IdOtpInput.vue +155 -0
- package/components/modals/id/IdPasswordSuccessfulModal.vue +25 -0
- package/components/modals/id/IdRecoveryModal.vue +117 -0
- package/components/modals/id/IdRegistrationModal.vue +215 -0
- package/components/modals/id/IdResetPasswordOtpModal.vue +158 -0
- package/components/modals/id/IdTwoFactorModal.vue +130 -0
- package/components/navigation/README.md +1 -1
- package/components/navigation/bottom-navigation/ABottomNavigation.vue +34 -29
- package/components/navigation/footer/AFooter.vue +210 -57
- package/components/navigation/footer/ui/{new-footer-accordion.vue → a-footer-accordion.vue} +2 -4
- package/components/navigation/header/AHeader.vue +59 -51
- package/components/navigation/header/AlmatyContacts.vue +16 -14
- package/components/navigation/header/AstanaContacts.vue +13 -11
- package/components/navigation/header/CardGallery.vue +5 -4
- package/components/navigation/header/HeaderLink.vue +16 -8
- package/components/navigation/header/NavList.vue +21 -5
- package/components/navigation/header/ProductMenu.vue +8 -78
- package/components/navigation/header/ProfileMenu.vue +10 -5
- package/components/navigation/header/TopHeader.vue +2 -2
- package/components/navigation/mobile-navigation/AMobileNavigation.vue +3 -3
- package/components/navigation/pill-tabs/APillTabs.vue +18 -4
- package/components/navigation/pill-tabs/types.ts +1 -0
- package/components/navigation/side-navigation/ASideNavigation.vue +23 -21
- package/components/overlays/README.md +1 -1
- package/components/overlays/side-panel/ASidePanel.vue +439 -0
- package/components/overlays/tooltip/ATooltip.vue +149 -154
- package/components/utils/removeTrailingSlash.ts +7 -0
- package/composables/useBuyTariffs.ts +91 -0
- package/composables/useHeaderNavigationLinks.ts +174 -297
- package/composables/useIdModals.ts +36 -0
- package/composables/usePayment.ts +74 -0
- package/composables/useUrls.ts +21 -0
- package/eslint.config.mjs +45 -0
- package/icons/adata-logo.vue +1 -1
- package/icons/ai-assistant.vue +13 -0
- package/icons/akimat.vue +20 -0
- package/icons/arrow/arrow-bottom-left-on-square.vue +1 -1
- package/icons/arrow/arrow-circle-reset.vue +1 -1
- package/icons/arrow/arrow-corner.vue +1 -1
- package/icons/arrow/arrow-graph-down.vue +1 -1
- package/icons/arrow/arrow-graph-up.vue +1 -1
- package/icons/arrow/arrow-square-down.vue +1 -1
- package/icons/arrow/arrow-top-right-on-square.vue +1 -1
- package/icons/arrow-currency-gray.vue +1 -1
- package/icons/arrow-currency-green.vue +1 -1
- package/icons/arrow-currency-red.vue +1 -1
- package/icons/avatar.vue +1 -1
- package/icons/bank.vue +5 -0
- package/icons/block.vue +1 -1
- package/icons/bookmark/bookmark-filled.vue +1 -1
- package/icons/bookmark/bookmark.vue +1 -1
- package/icons/browsers/browser-duck.vue +1 -1
- package/icons/browsers/browser-google.vue +7 -1
- package/icons/browsers/browser-yandex.vue +1 -1
- package/icons/building-vector.vue +1 -1
- package/icons/calculator.vue +1 -1
- package/icons/calendar.vue +1 -1
- package/icons/car.vue +1 -1
- package/icons/chart-bar.vue +5 -0
- package/icons/chart-pie.vue +16 -0
- package/icons/check/check-circle.vue +1 -1
- package/icons/check/check.vue +1 -1
- package/icons/check/checkmark-circle.vue +1 -1
- package/icons/check-sb.vue +7 -0
- package/icons/checkbox/checkbox-active.vue +1 -1
- package/icons/checkbox/checkbox-empty.vue +1 -1
- package/icons/checkbox/checkbox-intermediate.vue +1 -1
- package/icons/chevron/chevron-down.vue +1 -1
- package/icons/chevron/chevron-left.vue +1 -1
- package/icons/chevron/chevron-right.vue +1 -1
- package/icons/chevron/chevron-up.vue +1 -1
- package/icons/chevron/double-chevron-right.vue +1 -1
- package/icons/clipboard-text.vue +1 -1
- package/icons/clock.vue +1 -1
- package/icons/company/company-bazis.vue +3 -3
- package/icons/company/company-bereke.vue +13 -13
- package/icons/company/company-bigroup.vue +5 -5
- package/icons/company/company-erg.vue +6 -6
- package/icons/company/company-forte.vue +11 -11
- package/icons/company/company-halyk.vue +4 -4
- package/icons/company/company-jusan.vue +20 -3
- package/icons/company/company-kaspi.vue +3 -3
- package/icons/company/company-mycar.vue +2 -2
- package/icons/company/company-samruk.vue +9 -9
- package/icons/company-egov-small.vue +1 -1
- package/icons/company.vue +1 -1
- package/icons/copy.vue +1 -1
- package/icons/currency/currency-dollar.vue +1 -1
- package/icons/currency/currency-down.vue +1 -1
- package/icons/currency/currency-eur.vue +1 -1
- package/icons/currency/currency-rub.vue +1 -1
- package/icons/currency/currency-tenge.vue +9 -0
- package/icons/currency/currency-usd.vue +1 -1
- package/icons/currency/currency-yuan.vue +1 -1
- package/icons/delete.vue +1 -1
- package/icons/document.vue +1 -1
- package/icons/download.vue +1 -1
- package/icons/edit.vue +1 -1
- package/icons/education.vue +1 -1
- package/icons/egov-small.vue +1 -1
- package/icons/excel-icon.vue +14 -0
- package/icons/expand-window.vue +1 -1
- package/icons/eye-closed.vue +1 -1
- package/icons/eye-open.vue +1 -1
- package/icons/eye-opened.vue +1 -1
- package/icons/file/file.vue +1 -1
- package/icons/filter.vue +1 -1
- package/icons/flag.vue +1 -1
- package/icons/gift.vue +1 -1
- package/icons/globe.vue +1 -1
- package/icons/google.vue +41 -0
- package/icons/hand/hand-thumb-up-filled.vue +1 -1
- package/icons/hand/hand-thumb-up.vue +1 -1
- package/icons/hand-with-phone/hand-with-phone-dark.vue +1 -1
- package/icons/hand-with-phone/hand-with-phone-light.vue +1 -1
- package/icons/handshake.vue +1 -1
- package/icons/hcheck.vue +1 -1
- package/icons/hdocument.vue +1 -1
- package/icons/history.vue +1 -1
- package/icons/horizontal-more.vue +1 -1
- package/icons/hot-line.vue +6 -0
- package/icons/hummer.vue +1 -1
- package/icons/info/info-circle.vue +1 -1
- package/icons/invoice.vue +1 -1
- package/icons/kaspi-qr.vue +13 -0
- package/icons/link-chain.vue +1 -1
- package/icons/link.vue +1 -1
- package/icons/linkedin.vue +24 -24
- package/icons/loader-circle.vue +1 -1
- package/icons/location.vue +1 -1
- package/icons/lock.vue +1 -1
- package/icons/logo.vue +1 -1
- package/icons/logout.vue +1 -1
- package/icons/magnify/magnifying-glass-minus.vue +1 -1
- package/icons/magnify/magnifying-glass-plus.vue +1 -1
- package/icons/magnify/magnifying-glass.vue +1 -1
- package/icons/mail.vue +1 -1
- package/icons/mailru.vue +34 -0
- package/icons/main-filter.vue +1 -1
- package/icons/map/map-pin-filled.vue +1 -1
- package/icons/map/map-pin-rect.vue +1 -1
- package/icons/map/map-pin.vue +1 -1
- package/icons/map-marker-start.vue +1 -1
- package/icons/medal.vue +1 -1
- package/icons/menu-filled.vue +1 -1
- package/icons/menu.vue +1 -1
- package/icons/message/message.vue +1 -1
- package/icons/minus/minus-circle.vue +1 -1
- package/icons/money.vue +1 -1
- package/icons/monitoring.vue +1 -1
- package/icons/moon.vue +1 -1
- package/icons/more.vue +1 -1
- package/icons/notification.vue +1 -1
- package/icons/paperclip.vue +1 -1
- package/icons/payment/payment-card.vue +1 -1
- package/icons/payment/payment-kaspi.vue +1 -1
- package/icons/person-vector.vue +1 -1
- package/icons/person-with-briefcase.vue +1 -1
- package/icons/phone-filled.vue +1 -1
- package/icons/phone.vue +1 -1
- package/icons/plus/plus-circle.vue +1 -1
- package/icons/plus/plus.vue +1 -1
- package/icons/profile.vue +1 -1
- package/icons/radio/radio-check.vue +1 -1
- package/icons/radio/radio-empty.vue +1 -1
- package/icons/receipt.vue +1 -1
- package/icons/sanctions.vue +8 -0
- package/icons/scales/scale.vue +1 -1
- package/icons/scales/scales.vue +1 -1
- package/icons/scales/standing-scales.vue +1 -1
- package/icons/search.vue +1 -1
- package/icons/share/share-alt.vue +1 -1
- package/icons/share/share.vue +1 -1
- package/icons/socials/face-book.vue +1 -1
- package/icons/socials/instagram.vue +1 -1
- package/icons/socials/telegram.vue +1 -1
- package/icons/socials/tik-tok.vue +1 -1
- package/icons/socials/youtube.vue +1 -1
- package/icons/sort/sort-asc.vue +1 -1
- package/icons/sort/sort-desc.vue +1 -1
- package/icons/splitting-arrows.vue +1 -1
- package/icons/star/star-filled.vue +1 -1
- package/icons/star/star-half-filled.vue +1 -1
- package/icons/star/star.vue +1 -1
- package/icons/sun.vue +14 -14
- package/icons/sviazi.vue +1 -1
- package/icons/tag.vue +1 -1
- package/icons/tasks.vue +10 -0
- package/icons/tender-search.vue +1 -1
- package/icons/toasts/check-circle-toast.vue +1 -1
- package/icons/toasts/warning-triangle-toast.vue +1 -1
- package/icons/trash.vue +1 -1
- package/icons/triangle.vue +1 -1
- package/icons/truck.vue +1 -1
- package/icons/user.vue +1 -1
- package/icons/users-focus.vue +1 -1
- package/icons/users.vue +1 -1
- package/icons/warning/warning-circle.vue +1 -1
- package/icons/warning/warning-triangle-filled.vue +1 -1
- package/icons/warning/warning-triangle.vue +1 -1
- package/icons/whatsapp.vue +1 -1
- package/icons/work-bag.vue +1 -1
- package/icons/work-case.vue +9 -0
- package/icons/work-search.vue +1 -1
- package/icons/work.vue +1 -1
- package/icons/x-mark.vue +1 -1
- package/icons/yandex.vue +28 -0
- package/illustrations/address-location.vue +1 -1
- package/illustrations/ball-with-chain.vue +1 -1
- package/illustrations/bill.vue +1 -1
- package/illustrations/buildings.vue +1 -1
- package/illustrations/calendar.vue +1 -1
- package/illustrations/chains.vue +1 -1
- package/illustrations/coin-percent.vue +1 -1
- package/illustrations/coins-stack.vue +1 -1
- package/illustrations/delete-dark.vue +1 -1
- package/illustrations/delete.vue +1 -1
- package/illustrations/doc-with-stamp.vue +1 -1
- package/illustrations/document.vue +1 -1
- package/illustrations/door.vue +1 -1
- package/illustrations/empty-box.vue +1 -1
- package/illustrations/empty-wallet.vue +1 -1
- package/illustrations/graph-in-coin.vue +1 -1
- package/illustrations/hammer.vue +1 -1
- package/illustrations/hand-cash.vue +1 -1
- package/illustrations/info.vue +1 -1
- package/illustrations/mail.vue +1 -1
- package/illustrations/ok.vue +1 -1
- package/illustrations/people-group.vue +1 -1
- package/illustrations/person-with-phone.vue +1 -1
- package/illustrations/person.vue +1 -1
- package/illustrations/phone-check.vue +1 -1
- package/illustrations/phone-payment-method.vue +1 -1
- package/illustrations/stop-hand.vue +1 -1
- package/illustrations/stop-sign.vue +1 -1
- package/illustrations/suit.vue +1 -1
- package/illustrations/suitcase.vue +1 -1
- package/illustrations/terminal-dark.vue +1 -1
- package/illustrations/terminal.vue +1 -1
- package/illustrations/trash-can.vue +1 -1
- package/illustrations/turn-on-tariff.vue +1 -1
- package/illustrations/two-persons.vue +1 -1
- package/lang/en.ts +475 -270
- package/lang/kk.ts +476 -271
- package/lang/ru.ts +315 -107
- package/layouts/default.vue +13 -13
- package/nuxt.config.ts +42 -14
- package/package.json +69 -53
- package/public/kaspi/logo.svg +4 -0
- package/shared/constans/pages.ts +17 -2
- package/tailwind.config.ts +163 -0
- package/vitest.config.ts +14 -0
- package/.eslintrc.cjs +0 -4
- package/.playground/app.vue +0 -9
- package/.playground/pages/index.vue +0 -13
- package/.prettierignore +0 -24
- package/.prettierrc +0 -10
- package/assets/styles/index.css +0 -226
- package/components/modals/AuthModal.vue +0 -50
- package/components/navigation/footer/NewFooter.vue +0 -276
- package/components/navigation/footer/ui/footer-acccordion.vue +0 -119
|
@@ -1,74 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
import {twJoin, twMerge} from "tailwind-merge"
|
|
4
|
-
|
|
5
|
-
const uiConfig = {
|
|
6
|
-
wrapper: 'relative',
|
|
7
|
-
container: {
|
|
8
|
-
base: 'group absolute',
|
|
9
|
-
zIndex: 'z-[999]',
|
|
10
|
-
placement: {
|
|
11
|
-
top: '-top-1 left-1/2',
|
|
12
|
-
bottom: '-bottom-1 left-1/2',
|
|
13
|
-
left: '-left-1 top-1/2',
|
|
14
|
-
right: '-right-1 top-1/2'
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
width: 'max-w-xs',
|
|
18
|
-
background: 'bg-deepblue-900 dark:bg-gray-50',
|
|
19
|
-
backgroundError: 'bg-[#FAD9D7] dark:bg-[#4F393A]',
|
|
20
|
-
color: 'text-white dark:text-deepblue-900',
|
|
21
|
-
colorError: 'text-[#E74135] dark:text-[#F47E75]',
|
|
22
|
-
rounded: 'rounded-md',
|
|
23
|
-
base: 'text-xs font-normal absolute',
|
|
24
|
-
padding: {
|
|
25
|
-
sm: 'px-4 py-2',
|
|
26
|
-
md: 'px-4 py-4'
|
|
27
|
-
},
|
|
28
|
-
placement: {
|
|
29
|
-
top: {
|
|
30
|
-
start: 'bottom-[1px] left-[-13px]',
|
|
31
|
-
center: 'bottom-[1px] left-1/2 transform translate-x-[-50%]',
|
|
32
|
-
end: 'bottom-[1px] right-[-13px]'
|
|
33
|
-
},
|
|
34
|
-
bottom: {
|
|
35
|
-
start: 'top-[1px] left-[-13px]',
|
|
36
|
-
center: 'top-[1px] left-1/2 transform translate-x-[-50%]',
|
|
37
|
-
end: 'top-[1px] right-[-13px]'
|
|
38
|
-
},
|
|
39
|
-
left: {
|
|
40
|
-
start: 'right-[1px] top-[-13px]',
|
|
41
|
-
center: 'right-[1px] top-1/2 transform translate-y-[-50%]',
|
|
42
|
-
end: 'right-[1px] bottom-[-13px]'
|
|
43
|
-
},
|
|
44
|
-
right: {
|
|
45
|
-
start: 'left-[1px] top-[-13px]',
|
|
46
|
-
center: 'left-[1px] top-1/2 transform translate-y-[-50%]',
|
|
47
|
-
end: 'left-[1px] bottom-[-13px]'
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
transition: {
|
|
51
|
-
enterActiveClass: 'transition ease-out duration-200',
|
|
52
|
-
enterFromClass: 'opacity-0 translate-y-1',
|
|
53
|
-
enterToClass: 'opacity-100 translate-y-0',
|
|
54
|
-
leaveActiveClass: 'transition ease-in duration-150',
|
|
55
|
-
leaveFromClass: 'opacity-100 translate-y-0',
|
|
56
|
-
leaveToClass: 'opacity-0 translate-y-1'
|
|
57
|
-
},
|
|
58
|
-
popper: {
|
|
59
|
-
strategy: 'absolute',
|
|
60
|
-
base: 'invisible before:visible before:block before:absolute before:rotate-45 before:z-19 before:w-3 before:h-3',
|
|
61
|
-
rounded: 'before:rounded-sm',
|
|
62
|
-
background: 'before:bg-deepblue-900 dark:before:bg-gray-50',
|
|
63
|
-
backgroundError: 'before:bg-[#FAD9D7] dark:before:dark:bg-[#4F393A]',
|
|
64
|
-
placement: {
|
|
65
|
-
top: 'bottom-0 before:bottom-[-2px] before:left-[-6px]',
|
|
66
|
-
bottom: 'top-0 before:top-[-2px] before:left-[-6px]',
|
|
67
|
-
left: 'right-0 before:right-[-2px] before:top-[-6px]',
|
|
68
|
-
right: 'left-0 before:left-[-2px] before:top-[-6px]'
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
}
|
|
2
|
+
import { ref, computed, nextTick, onMounted, onBeforeUnmount, watch } from 'vue'
|
|
72
3
|
|
|
73
4
|
interface Props {
|
|
74
5
|
text?: string
|
|
@@ -100,143 +31,207 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
100
31
|
errorParsing: false
|
|
101
32
|
})
|
|
102
33
|
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
34
|
+
/* --- refs --- */
|
|
35
|
+
const wrapper = ref<HTMLElement | null>(null) // root wrapper
|
|
36
|
+
const body = ref<HTMLElement | null>(null) // tooltip element
|
|
106
37
|
const open = ref(false)
|
|
107
|
-
let openTimeout:
|
|
108
|
-
let closeTimeout:
|
|
38
|
+
let openTimeout: ReturnType<typeof setTimeout> | null = null
|
|
39
|
+
let closeTimeout: ReturnType<typeof setTimeout> | null = null
|
|
40
|
+
|
|
41
|
+
// inline styles for tooltip positioning
|
|
42
|
+
const tooltipStyle = ref<Record<string, string>>({
|
|
43
|
+
left: '0px',
|
|
44
|
+
top: '0px',
|
|
45
|
+
transform: 'translateX(0) translateY(0)'
|
|
46
|
+
})
|
|
109
47
|
|
|
48
|
+
// visual placement (may be flipped if not enough space)
|
|
49
|
+
const visualPlacement = ref(props.placement)
|
|
110
50
|
const popperPosition = ref(props.popperPosition)
|
|
111
51
|
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
props.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
uiConfig.popper.strategy,
|
|
121
|
-
uiConfig.popper.base,
|
|
122
|
-
uiConfig.popper.rounded,
|
|
123
|
-
props.errorParsing ? uiConfig.popper.backgroundError : uiConfig.popper.background,
|
|
124
|
-
uiConfig.popper.placement[props.placement]
|
|
125
|
-
)))
|
|
126
|
-
const baseClasses = computed(() => twMerge(twJoin(
|
|
127
|
-
uiConfig.base,
|
|
128
|
-
props.errorParsing ? uiConfig.backgroundError : uiConfig.background,
|
|
129
|
-
props.errorParsing ? uiConfig.colorError : uiConfig.color,
|
|
130
|
-
uiConfig.rounded,
|
|
131
|
-
uiConfig.placement[props.placement][popperPosition.value],
|
|
132
|
-
uiConfig.padding[props.size],
|
|
133
|
-
props.truncate ? 'truncate' : 'max-w-[530px] w-max'
|
|
134
|
-
)))
|
|
135
|
-
const transitionClasses = uiConfig.transition
|
|
136
|
-
|
|
137
|
-
const containerStyles = computed(() => {
|
|
138
|
-
return {
|
|
139
|
-
zIndex: props.zIndex
|
|
140
|
-
}
|
|
52
|
+
/* --- helpers: compute classes (you can keep your uiConfig) --- */
|
|
53
|
+
const baseClass = computed(() => {
|
|
54
|
+
// keep your Tailwind classes if you like, but we position via inline styles
|
|
55
|
+
const bg = props.errorParsing ? 'bg-[#FAD9D7] dark:bg-[#4F393A]' : 'bg-deepblue-900 dark:bg-gray-50'
|
|
56
|
+
const color = props.errorParsing ? 'text-[#E74135] dark:text-[#F47E75]' : 'text-white dark:text-deepblue-900'
|
|
57
|
+
const pad = props.size === 'sm' ? 'px-4 py-2' : 'px-4 py-4'
|
|
58
|
+
const truncated = props.truncate ? 'truncate' : 'max-w-[530px] w-max'
|
|
59
|
+
return ['text-xs font-normal absolute', bg, color, 'rounded-md', pad, truncated].join(' ')
|
|
141
60
|
})
|
|
142
61
|
|
|
62
|
+
/* --- positioning logic --- */
|
|
63
|
+
function updatePosition(targetEl: HTMLElement | null) {
|
|
64
|
+
if (!targetEl || !body.value) return
|
|
65
|
+
|
|
66
|
+
const targetRect = targetEl.getBoundingClientRect()
|
|
67
|
+
const tooltipRect = body.value.getBoundingClientRect()
|
|
68
|
+
const vw = window.innerWidth
|
|
69
|
+
const vh = window.innerHeight
|
|
70
|
+
|
|
71
|
+
// default placement = requested prop
|
|
72
|
+
let place: Props['placement'] = props.placement
|
|
73
|
+
|
|
74
|
+
// decide flip if not enough space
|
|
75
|
+
if (place === 'top' && targetRect.top < tooltipRect.height + 8 && (vh - targetRect.bottom) >= tooltipRect.height + 8) {
|
|
76
|
+
place = 'bottom'
|
|
77
|
+
} else if (place === 'bottom' && (vh - targetRect.bottom) < tooltipRect.height + 8 && targetRect.top >= tooltipRect.height + 8) {
|
|
78
|
+
place = 'top'
|
|
79
|
+
} else if (place === 'left' && targetRect.left < tooltipRect.width + 8 && (vw - targetRect.right) >= tooltipRect.width + 8) {
|
|
80
|
+
place = 'right'
|
|
81
|
+
} else if (place === 'right' && (vw - targetRect.right) < tooltipRect.width + 8 && targetRect.left >= tooltipRect.width + 8) {
|
|
82
|
+
place = 'left'
|
|
83
|
+
}
|
|
143
84
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
85
|
+
visualPlacement.value = place
|
|
86
|
+
|
|
87
|
+
// compute left/top depending on placement and prefer 'start' unless end/center chosen by popperPosition
|
|
88
|
+
let left = 0
|
|
89
|
+
let top = 0
|
|
90
|
+
|
|
91
|
+
if (place === 'top' || place === 'bottom') {
|
|
92
|
+
// horizontal alignment depends on popperPosition
|
|
93
|
+
if (popperPosition.value === 'center') {
|
|
94
|
+
left = targetRect.left + targetRect.width / 2 - tooltipRect.width / 2
|
|
95
|
+
} else if (popperPosition.value === 'end') {
|
|
96
|
+
left = targetRect.right - tooltipRect.width
|
|
97
|
+
} else {
|
|
98
|
+
// start
|
|
99
|
+
left = targetRect.left
|
|
100
|
+
}
|
|
147
101
|
|
|
148
|
-
|
|
102
|
+
// vertical
|
|
103
|
+
if (place === 'top') {
|
|
104
|
+
top = targetRect.top - tooltipRect.height - 8
|
|
105
|
+
} else {
|
|
106
|
+
top = targetRect.bottom + 8
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
// left or right: vertical alignment
|
|
110
|
+
if (popperPosition.value === 'center') {
|
|
111
|
+
top = targetRect.top + targetRect.height / 2 - tooltipRect.height / 2
|
|
112
|
+
} else if (popperPosition.value === 'end') {
|
|
113
|
+
top = targetRect.bottom - tooltipRect.height
|
|
114
|
+
} else {
|
|
115
|
+
top = targetRect.top
|
|
116
|
+
}
|
|
149
117
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
118
|
+
if (place === 'left') {
|
|
119
|
+
left = targetRect.left - tooltipRect.width - 8
|
|
120
|
+
} else {
|
|
121
|
+
left = targetRect.right + 8
|
|
122
|
+
}
|
|
123
|
+
}
|
|
154
124
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
125
|
+
// keep tooltip inside the viewport (small clamp)
|
|
126
|
+
const minGap = 6
|
|
127
|
+
if (left < minGap) left = minGap
|
|
128
|
+
if (left + tooltipRect.width > vw - minGap) left = vw - tooltipRect.width - minGap
|
|
129
|
+
if (top < minGap) top = minGap
|
|
130
|
+
if (top + tooltipRect.height > vh - minGap) top = vh - tooltipRect.height - minGap
|
|
158
131
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
})
|
|
164
|
-
}
|
|
132
|
+
tooltipStyle.value.left = `${Math.round(left)}px`
|
|
133
|
+
tooltipStyle.value.top = `${Math.round(top)}px`
|
|
134
|
+
tooltipStyle.value.transform = 'none'
|
|
165
135
|
}
|
|
166
136
|
|
|
167
|
-
|
|
137
|
+
/* --- events --- */
|
|
138
|
+
function handleMouseEnter(e: MouseEvent) {
|
|
139
|
+
// clear close timeout
|
|
168
140
|
if (closeTimeout) {
|
|
169
141
|
clearTimeout(closeTimeout)
|
|
170
142
|
closeTimeout = null
|
|
171
143
|
}
|
|
172
|
-
if (open.value) {
|
|
173
|
-
return
|
|
174
|
-
}
|
|
175
144
|
|
|
176
|
-
|
|
145
|
+
const targetEl = (e.currentTarget ?? e.target) as HTMLElement
|
|
146
|
+
|
|
147
|
+
// schedule open
|
|
148
|
+
openTimeout = openTimeout || setTimeout(async () => {
|
|
177
149
|
open.value = true
|
|
150
|
+
await nextTick()
|
|
151
|
+
// measure and position after tooltip is rendered
|
|
152
|
+
updatePosition(targetEl)
|
|
178
153
|
openTimeout = null
|
|
179
154
|
}, props.openDelay)
|
|
180
155
|
}
|
|
181
156
|
|
|
182
|
-
|
|
157
|
+
function handleMouseLeave(e?: MouseEvent) {
|
|
183
158
|
if (openTimeout) {
|
|
184
159
|
clearTimeout(openTimeout)
|
|
185
160
|
openTimeout = null
|
|
186
161
|
}
|
|
187
|
-
if (!open.value)
|
|
188
|
-
|
|
189
|
-
}
|
|
162
|
+
if (!open.value) return
|
|
163
|
+
|
|
190
164
|
closeTimeout = closeTimeout || setTimeout(() => {
|
|
191
165
|
open.value = false
|
|
192
166
|
closeTimeout = null
|
|
193
167
|
}, props.closeDelay)
|
|
194
168
|
}
|
|
169
|
+
|
|
170
|
+
// if tooltip is open and user scrolls/resizes, recalc
|
|
171
|
+
function onWindowChange() {
|
|
172
|
+
// try to recalc against the wrapper's slot element if present
|
|
173
|
+
// we assume wrapper contains the hovered child
|
|
174
|
+
const hovered = wrapper.value?.querySelector(':hover') as HTMLElement | null
|
|
175
|
+
const target = hovered ?? wrapper.value
|
|
176
|
+
updatePosition(target)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
onMounted(() => {
|
|
180
|
+
window.addEventListener('resize', onWindowChange)
|
|
181
|
+
window.addEventListener('scroll', onWindowChange, true)
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
onBeforeUnmount(() => {
|
|
185
|
+
window.removeEventListener('resize', onWindowChange)
|
|
186
|
+
window.removeEventListener('scroll', onWindowChange, true)
|
|
187
|
+
})
|
|
188
|
+
|
|
195
189
|
</script>
|
|
196
190
|
|
|
197
191
|
<template>
|
|
198
192
|
<div
|
|
193
|
+
ref="wrapper"
|
|
199
194
|
v-bind="$attrs"
|
|
200
|
-
|
|
201
|
-
@
|
|
202
|
-
@mouseleave="
|
|
203
|
-
@mouseenter="onMouseEnter"
|
|
195
|
+
class="relative"
|
|
196
|
+
@mouseenter="handleMouseEnter"
|
|
197
|
+
@mouseleave="handleMouseLeave"
|
|
204
198
|
>
|
|
205
199
|
<slot :open="open">
|
|
206
200
|
Hover
|
|
207
201
|
</slot>
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
>
|
|
202
|
+
|
|
203
|
+
<!-- tooltip rendered absolutely on body of component, positioned by inline styles -->
|
|
204
|
+
<transition name="fade" appear>
|
|
212
205
|
<div
|
|
213
|
-
v-if="open && !prevent"
|
|
214
|
-
|
|
215
|
-
:style="
|
|
206
|
+
v-if="open && !props.prevent"
|
|
207
|
+
class="pointer-events-none"
|
|
208
|
+
:style="{ position: 'fixed', left: tooltipStyle.left, top: tooltipStyle.top, zIndex: props.zIndex ?? 9999 }"
|
|
216
209
|
>
|
|
217
|
-
<div
|
|
218
|
-
v-if="
|
|
219
|
-
:class="poperClasses"
|
|
220
|
-
/>
|
|
221
|
-
<div :class="baseClasses" ref="body">
|
|
222
|
-
<div
|
|
223
|
-
v-if="hasHeader"
|
|
224
|
-
class="font-semibold mb-1"
|
|
225
|
-
>
|
|
210
|
+
<div ref="body" :class="baseClass">
|
|
211
|
+
<div v-if="$slots.header || props.header" class="font-semibold mb-1">
|
|
226
212
|
<slot name="header">
|
|
227
|
-
<p>{{ header }}</p>
|
|
213
|
+
<p>{{ props.header }}</p>
|
|
228
214
|
</slot>
|
|
229
215
|
</div>
|
|
230
216
|
|
|
231
217
|
<slot name="content">
|
|
232
|
-
{{ text }}
|
|
218
|
+
{{ props.text }}
|
|
233
219
|
</slot>
|
|
234
220
|
</div>
|
|
235
221
|
</div>
|
|
236
|
-
</
|
|
222
|
+
</transition>
|
|
237
223
|
</div>
|
|
238
224
|
</template>
|
|
239
225
|
|
|
240
226
|
<style scoped>
|
|
241
|
-
|
|
227
|
+
/* simple fade (you can adapt to your transition) */
|
|
228
|
+
.fade-enter-active, .fade-leave-active {
|
|
229
|
+
transition: opacity .18s ease;
|
|
230
|
+
}
|
|
231
|
+
.fade-enter-from, .fade-leave-to {
|
|
232
|
+
opacity: 0;
|
|
233
|
+
}
|
|
234
|
+
.fade-enter-to, .fade-leave-from {
|
|
235
|
+
opacity: 1;
|
|
236
|
+
}
|
|
242
237
|
</style>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { removeTrailingSlash } from '#adata-ui/components/utils/removeTrailingSlash'
|
|
2
|
+
|
|
3
|
+
export function useBuyTariffs() {
|
|
4
|
+
const { commonAuth } = useAppConfig()
|
|
5
|
+
|
|
6
|
+
const userApiURL = commonAuth.userApiURL
|
|
7
|
+
const { locale } = useI18n()
|
|
8
|
+
const localePath = useLocalePath()
|
|
9
|
+
const checkNumber = ref(0)
|
|
10
|
+
const messageRate = ref(null)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const isAuthenticated = computed(() => {
|
|
14
|
+
const accessToken = useCookie('accessToken')
|
|
15
|
+
return accessToken.value
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
async function buyTariff(tariffs: any) {
|
|
19
|
+
await fetch(`${removeTrailingSlash(userApiURL)}/user/rate`, {
|
|
20
|
+
method: 'PUT',
|
|
21
|
+
credentials: 'include',
|
|
22
|
+
headers: {
|
|
23
|
+
'Content-Type': 'application/json',
|
|
24
|
+
'lang': locale.value,
|
|
25
|
+
Authorization: `Bearer ${isAuthenticated.value}`
|
|
26
|
+
},
|
|
27
|
+
body: JSON.stringify({
|
|
28
|
+
rate_code: tariffs
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
location.reload()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function viaKaspiBank(tariffId: any, sum: any) {
|
|
35
|
+
try {
|
|
36
|
+
const info = await fetch(`${removeTrailingSlash(userApiURL)}/user/kaspi-balance/request/`, {
|
|
37
|
+
method: 'POST',
|
|
38
|
+
credentials: 'include',
|
|
39
|
+
headers: {
|
|
40
|
+
'Content-Type': 'application/json',
|
|
41
|
+
'lang': locale.value,
|
|
42
|
+
Authorization: `Bearer ${isAuthenticated.value}`
|
|
43
|
+
},
|
|
44
|
+
body: JSON.stringify({
|
|
45
|
+
amount: sum,
|
|
46
|
+
rate_id: tariffId
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
const { data } = await info.json().catch(() => ({}))
|
|
50
|
+
|
|
51
|
+
checkNumber.value = data.request_id
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error(error)
|
|
54
|
+
} finally {
|
|
55
|
+
window.open(localePath(`https://kaspi.kz/pay/adata?service_id=5964&9507=${checkNumber.value}`), '_blank')
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function leaveRequest(name: any, email: any, phone: any, comment: any, rateCode: any = 'adata_pro') {
|
|
60
|
+
try {
|
|
61
|
+
const info = await fetch(`${removeTrailingSlash(userApiURL)}/message/rate`, {
|
|
62
|
+
method: 'POST',
|
|
63
|
+
credentials: 'include',
|
|
64
|
+
headers: {
|
|
65
|
+
'Content-Type': 'application/json',
|
|
66
|
+
'lang': locale.value,
|
|
67
|
+
Authorization: `Bearer ${isAuthenticated.value}`
|
|
68
|
+
},
|
|
69
|
+
body: JSON.stringify({
|
|
70
|
+
sender_name: name,
|
|
71
|
+
email: email,
|
|
72
|
+
phone_number: phone,
|
|
73
|
+
message: comment,
|
|
74
|
+
rate_code: rateCode,
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
const { data } = await info.json().catch(() => ({}))
|
|
78
|
+
messageRate.value = data
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.error(error)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
buyTariff,
|
|
86
|
+
viaKaspiBank,
|
|
87
|
+
checkNumber,
|
|
88
|
+
leaveRequest,
|
|
89
|
+
messageRate
|
|
90
|
+
}
|
|
91
|
+
}
|