@nexxtmove/ui 0.1.69 → 0.1.71

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nexxtmove/ui",
3
3
  "type": "module",
4
- "version": "0.1.69",
4
+ "version": "0.1.71",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -24,7 +24,6 @@
24
24
  "@number-flow/vue": "^0.5.0",
25
25
  "date-fns": "^4.1.0",
26
26
  "date-fns-tz": "^3.2.0",
27
- "flag-icons": "^7.5.0",
28
27
  "reka-ui": "^2.9.6"
29
28
  },
30
29
  "peerDependencies": {
@@ -32,6 +31,7 @@
32
31
  "vue": "^3.0.0"
33
32
  },
34
33
  "devDependencies": {
34
+ "flag-icons": "^7.5.0",
35
35
  "@awesome.me/kit-37b149f3ef": "^1.0.8",
36
36
  "@eslint/js": "^10.0.1",
37
37
  "@nuxt/kit": "^4.4.4",
@@ -1,3 +1,22 @@
1
+ <script lang="ts">
2
+ import flagIconsCss from 'flag-icons/css/flag-icons.min.css?inline'
3
+
4
+ if (typeof document !== 'undefined') {
5
+ const style = document.createElement('style')
6
+ style.textContent = flagIconsCss
7
+ document.head.appendChild(style)
8
+ }
9
+
10
+ export interface NexxtCountrySelectProps {
11
+ placeholder?: string
12
+ label?: string
13
+ error?: boolean
14
+ errorMessage?: string
15
+ required?: boolean
16
+ pinnedCountries?: string[]
17
+ }
18
+ </script>
19
+
1
20
  <script lang="ts" setup>
2
21
  import { ref, computed, nextTick } from 'vue'
3
22
  import NexxtFloatingPanel from '../FloatingPanel/FloatingPanel.vue'
@@ -10,15 +29,6 @@ defineOptions({ name: 'NexxtCountrySelect' })
10
29
  const generateId = () => 'country-select-' + Math.random().toString(36).slice(2, 10)
11
30
  const selectId = generateId()
12
31
 
13
- interface NexxtCountrySelectProps {
14
- placeholder?: string
15
- label?: string
16
- error?: boolean
17
- errorMessage?: string
18
- required?: boolean
19
- pinnedCountries?: string[]
20
- }
21
-
22
32
  const props = withDefaults(defineProps<NexxtCountrySelectProps>(), {
23
33
  placeholder: 'Selecteer een land...',
24
34
  pinnedCountries: () => [],
@@ -154,7 +164,3 @@ const onOpen = async () => {
154
164
  </Transition>
155
165
  </div>
156
166
  </template>
157
-
158
- <style>
159
- @import 'flag-icons/css/flag-icons.min.css';
160
- </style>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { ref, computed, onMounted, onUnmounted } from 'vue'
2
+ import { ref, computed, watch, nextTick, onMounted, onUnmounted } from 'vue'
3
3
  import { useFloating, autoUpdate, flip, shift, offset, size } from '@floating-ui/vue'
4
4
  import type { Placement } from '@floating-ui/vue'
5
5
 
@@ -25,6 +25,9 @@ const emit = defineEmits<{
25
25
  const isOpen = ref(false)
26
26
  // Keeps the positioning container alive while the leave transition plays.
27
27
  const isLeaving = ref(false)
28
+ // Tracks whether floating-ui has computed the position *for the current open cycle*.
29
+ // Reset on every open() so the Transition always sees false→true and plays the enter animation.
30
+ const isReady = ref(false)
28
31
  const triggerRef = ref<HTMLElement | null>(null)
29
32
  const floatingRef = ref<HTMLElement | null>(null)
30
33
 
@@ -58,9 +61,16 @@ const {
58
61
  transform: false,
59
62
  })
60
63
 
61
- const open = () => {
64
+ const open = async () => {
65
+ isReady.value = false
62
66
  isOpen.value = true
63
67
  emit('open')
68
+ // Wait for Vue to render the v-if with isReady=false before setting it true.
69
+ // This guarantees the Transition always sees false→true and plays the enter animation,
70
+ // even when isPositioned is already true from a previous open cycle.
71
+ await nextTick()
72
+ if (isPositioned.value) isReady.value = true
73
+ // If not yet positioned, the watcher below will set isReady once it resolves.
64
74
  }
65
75
 
66
76
  const close = () => {
@@ -120,6 +130,10 @@ const transitionClasses = computed(() => {
120
130
  }
121
131
  })
122
132
 
133
+ watch(isPositioned, (val) => {
134
+ if (val && isOpen.value) isReady.value = true
135
+ })
136
+
123
137
  defineExpose({ isOpen, open, close, toggle, triggerRef, floatingRef })
124
138
 
125
139
  onMounted(() => {
@@ -152,7 +166,7 @@ onUnmounted(() => {
152
166
  originates from the trigger — never from the page origin.
153
167
  -->
154
168
  <Transition v-bind="transitionClasses" @after-leave="isLeaving = false">
155
- <div v-if="isOpen && isPositioned">
169
+ <div v-if="isOpen && isReady">
156
170
  <slot name="content" :is-open="isOpen" :close="close" :toggle="toggle" />
157
171
  </div>
158
172
  </Transition>