@sakoa/ui 0.1.0 → 0.1.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@sakoa/ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/saka-ui.umd.cjs",
6
6
  "module": "./dist/saka-ui.js",
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  defineOptions({ inheritAttrs: false })
3
3
 
4
- import { inject, computed, onMounted, onBeforeUnmount } from 'vue'
4
+ import { inject, ref, computed, onMounted, onBeforeUnmount } from 'vue'
5
5
  import { cn } from '../../../lib/utils'
6
6
  import { SDropdownContextKey, type SDropdownContext } from './SDropdown.vue'
7
7
 
@@ -49,13 +49,13 @@ const emit = defineEmits<{
49
49
  const context = inject<SDropdownContext>(SDropdownContextKey)
50
50
 
51
51
  // Register with parent
52
- let itemIndex = -1
52
+ const itemIndex = ref(-1)
53
53
 
54
54
  onMounted(() => {
55
55
  if (context) {
56
- itemIndex = context.registerItem({
57
- key: props.itemKey,
58
- disabled: props.disabled
56
+ itemIndex.value = context.registerItem({
57
+ key: props.itemKey,
58
+ disabled: props.disabled
59
59
  })
60
60
  }
61
61
  })
@@ -85,8 +85,8 @@ const sizeConfig = computed(() => ({
85
85
  const accentColor = computed(() => props.color ?? context?.color ?? 'var(--s-primary)')
86
86
 
87
87
  const isHighlighted = computed(() => {
88
- if (!context) return false
89
- return context.highlightedIndex.value === itemIndex
88
+ if (!context || itemIndex.value < 0) return false
89
+ return context.highlightedIndex.value === itemIndex.value
90
90
  })
91
91
 
92
92
  const handleClick = (event: MouseEvent) => {