@tekkare/auriga 0.1.182 → 0.1.183

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/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.1.182"
7
+ "version": "0.1.183"
8
8
  }
@@ -123,10 +123,23 @@ export default defineComponent({
123
123
  const optionIndex = ref(0);
124
124
  function selectOption(isDown) {
125
125
  if (isDown) {
126
- optionIndex.value = optionIndex.value === filterSuggestions.value.length ? 0 : optionIndex.value + 1;
126
+ optionIndex.value = optionIndex.value === filterSuggestions.value.length ? filterSuggestions.value.length : optionIndex.value + 1;
127
127
  } else {
128
128
  optionIndex.value = optionIndex.value === 0 ? filterSuggestions.value.length : optionIndex.value - 1;
129
129
  }
130
+ const suggContainer = document.querySelector(".search_suggestions");
131
+ const selectedOption = suggContainer?.querySelectorAll("p")[optionIndex.value - 1];
132
+ if (selectedOption) {
133
+ const containerHeight = suggContainer?.clientHeight;
134
+ const containerScrollTop = suggContainer?.scrollTop;
135
+ const optionTop = selectedOption?.offsetTop;
136
+ const optionHeight = selectedOption?.offsetHeight * 2;
137
+ if (optionTop < containerScrollTop) {
138
+ suggContainer.scrollTop = optionTop;
139
+ } else if (optionTop + optionHeight > containerHeight + containerScrollTop) {
140
+ suggContainer.scrollTop = optionTop + optionHeight - containerHeight;
141
+ }
142
+ }
130
143
  }
131
144
  watch(
132
145
  () => searchValue.value,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/auriga",
3
- "version": "0.1.182",
3
+ "version": "0.1.183",
4
4
  "description": "Aurgia is a UI kit developped by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",