adata-ui 2.0.23 → 2.0.24

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.
@@ -13,12 +13,11 @@ const props = defineProps<{
13
13
  <component
14
14
  :is="to ? NuxtLinkLocale : 'button'"
15
15
  :to="to"
16
- class="curve-block relative w-fit cursor-pointer"
16
+ class="curve-block relative w-full cursor-pointer"
17
17
  active-class="active-item"
18
18
  >
19
19
  <svg
20
- width="306"
21
- height="182"
20
+ class="w-full"
22
21
  viewBox="-1 -1 308 184"
23
22
  xmlns="http://www.w3.org/2000/svg"
24
23
  >
@@ -79,9 +78,7 @@ const props = defineProps<{
79
78
  </div>
80
79
 
81
80
  <svg
82
- class="absolute bottom-0 right-0"
83
- width="48"
84
- height="48"
81
+ class="absolute bottom-0 right-0 size-12 2xl:size-14"
85
82
  viewBox="0 0 48 48"
86
83
  xmlns="http://www.w3.org/2000/svg"
87
84
  >
@@ -6,6 +6,8 @@ import { onClickOutside, useToggle } from '@vueuse/core'
6
6
  import { isEqual } from 'lodash-es'
7
7
  import type { Ref } from 'vue'
8
8
 
9
+ import { useFloating, offset, flip, shift, size as floatingSize, autoUpdate } from '@floating-ui/vue'
10
+
9
11
  type Props = {
10
12
  label: string
11
13
  required?: boolean
@@ -61,6 +63,32 @@ const props = withDefaults(defineProps<Props>(), {
61
63
 
62
64
  const emits = defineEmits<Emits>()
63
65
 
66
+
67
+
68
+ const reference = ref<HTMLElement | null>(null)
69
+ const floating = ref<HTMLElement | null>(null)
70
+ const { x, y, strategy, update } = useFloating(reference, floating, {
71
+ placement: 'bottom-start',
72
+ strategy: 'absolute',
73
+ middleware: [
74
+ offset(6),
75
+ flip({ fallbackPlacements: ['top-start'] }),
76
+ shift({ padding: 8 }),
77
+ floatingSize({
78
+ apply({ availableHeight, elements, rects }) {
79
+ const el = elements.floating as HTMLElement
80
+ el.style.width = `${rects.reference.width}px`
81
+ el.style.maxHeight = `${Math.max(140, Math.min(availableHeight, 320))}px`
82
+ el.style.overflowY = 'auto'
83
+ },
84
+ }),
85
+ ],
86
+ })
87
+
88
+ let cleanup: (() => void) | null = null
89
+
90
+
91
+
64
92
  const modelValue = defineModel<T | T[] | null | any>({ required: true })
65
93
  const search = defineModel<T | null | any>('search')
66
94
  const isOpen = defineModel<T | null | any>('open', {
@@ -235,10 +263,21 @@ onUpdated(() => (countedVisibleItems.value = countOfVisibleItems.value))
235
263
  defineExpose({
236
264
  onClear
237
265
  })
266
+ watch(() => isOpen.value, (open) => {
267
+ if (open && reference.value && floating.value) {
268
+ cleanup = autoUpdate(reference.value, floating.value, update)
269
+ } else {
270
+ cleanup?.()
271
+ cleanup = null
272
+ }
273
+ })
274
+
275
+ onUnmounted(() => cleanup?.())
238
276
  </script>
239
277
  <template>
240
278
  <div ref="wrapper" class="relative w-full rounded-md text-sm">
241
279
  <button
280
+ ref="reference"
242
281
  :class="[
243
282
  clearable ? 'pr-16' : 'pr-9',
244
283
  {
@@ -262,7 +301,7 @@ defineExpose({
262
301
  </span>
263
302
  <component :is="startIcon" v-if="startIcon" />
264
303
 
265
- <span :class="{ 'py-1': size === 'md' }" class="w-full text-start">
304
+ <span :class="{ 'py-1': size === 'md' }" class=" w-full text-start">
266
305
  <span v-if="valueToShow">
267
306
  <span v-if="!multiple" class="line-clamp-1 text-deepblue-900 dark:text-gray-200">
268
307
  <slot name="single-selected" :value="valueToShow">{{ valueToShow[keyToShow] }}</slot>
@@ -310,10 +349,16 @@ defineExpose({
310
349
  </span>
311
350
  </button>
312
351
  <transition>
313
- <div
314
- v-if="isOpen"
315
- class="absolute z-20 mt-1 w-full rounded-md bg-white shadow-[0_1px_8px_0_rgba(139,146,156,0.3)] dark:bg-gray-900"
316
- >
352
+ <div
353
+ v-if="isOpen"
354
+ ref="floating"
355
+ class="z-[10000] rounded-md bg-white shadow-[0_1px_8px_0_rgba(139,146,156,0.3)] dark:bg-gray-900"
356
+ :style="{
357
+ position: strategy,
358
+ left: x != null ? `${x}px` : '',
359
+ top: y != null ? `${y}px` : '',
360
+ }"
361
+ >
317
362
  <slot :options="options" name="options">
318
363
  <ul class="select m-2 max-h-[250px] overflow-y-auto overflow-x-hidden">
319
364
  <li v-if="searchFromOut" class="p-1">
@@ -212,8 +212,8 @@ const contactLinks = {
212
212
  />
213
213
  </div>
214
214
  </div>
215
-
216
- <div class="flex flex-col gap-2 items-start">
215
+ <!--noindex-->
216
+ <div class="flex flex-col gap-2 items-start" data-nosnippet>
217
217
  <nuxt-link
218
218
  class="text-sm font-semibold pb-3 pr-4 border-b-[0.5px] border-white cursor-pointer"
219
219
  :to="contactLinks.link?.replace(/\/$/, '')"
@@ -249,6 +249,7 @@ const contactLinks = {
249
249
  </div>
250
250
  </div>
251
251
  </div>
252
+ <!--/noindex-->
252
253
  </div>
253
254
 
254
255
  <div class="lg:hidden flex gap-8 flex-wrap">
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <div class="h-[272px]">
2
+ <!--noindex-->
3
+ <div class="h-[272px]" data-nosnippet>
3
4
  <h2 class="heading-02 mb-4">
4
5
  {{ t('header.contacts.almaty.title') }}
5
6
  </h2>
@@ -89,6 +90,7 @@
89
90
  <!-- </div>-->
90
91
  </div>
91
92
  </div>
93
+ <!--/noindex-->
92
94
  </template>
93
95
 
94
96
  <script setup lang="ts">
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <div class="h-[272px]">
2
+ <!--noindex-->
3
+ <div class="h-[272px]" data-nosnippet>
3
4
  <h2 class="heading-02 mb-4">
4
5
  {{ t('header.contacts.astana.title') }}
5
6
  </h2>
@@ -23,6 +24,7 @@
23
24
  </div>
24
25
  </div>
25
26
  </div>
27
+ <!--/noindex-->
26
28
  </template>
27
29
 
28
30
  <script setup lang="ts">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adata-ui",
3
3
  "type": "module",
4
- "version": "2.0.23",
4
+ "version": "2.0.24",
5
5
  "main": "./nuxt.config.ts",
6
6
  "scripts": {
7
7
  "dev": "nuxi dev .playground",
@@ -34,6 +34,7 @@
34
34
  "vue-tsc": "^2.2.12"
35
35
  },
36
36
  "dependencies": {
37
+ "@floating-ui/vue": "^1.1.9",
37
38
  "@headlessui/tailwindcss": "^0.2.2",
38
39
  "@headlessui/vue": "^1.7.23",
39
40
  "@nuxt/image": "1.8.1",