itube-specs 0.0.545 → 0.0.547

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.
@@ -4,14 +4,14 @@
4
4
  class="s-dropdown"
5
5
  :style="`--max-height: ${getMaxHeight}`"
6
6
  :class="[
7
- {'--top': top},
7
+ {'--top': top || autoTop},
8
8
  {'--right': right},
9
9
  {'--center': center},
10
10
  {'--open': open},
11
11
  {'--separate': separateLastChild},
12
12
  ]"
13
13
  @mouseleave="mouseHandler(false)"
14
- @mouseover="mouseHandler(true)"
14
+ @mouseenter="mouseHandler(true)"
15
15
  >
16
16
  <div
17
17
  class="s-dropdown__trigger"
@@ -27,6 +27,8 @@
27
27
  class="s-dropdown__menu"
28
28
  :class="{'--open': open}"
29
29
  @click="close"
30
+ @mouseenter="mouseHandler(true)"
31
+ @mouseleave="mouseHandler(false)"
30
32
  >
31
33
  <button
32
34
  class="s-dropdown__sheet-close _to-sm"
@@ -71,6 +73,7 @@ const props = withDefaults(defineProps<{
71
73
  });
72
74
 
73
75
  const open = ref(false);
76
+ const autoTop = ref(false);
74
77
 
75
78
  onClickOutside(dropdownRef, () => {
76
79
  open.value = false;
@@ -80,8 +83,17 @@ const { scrollLock, scrollUnlock } = useGlobalScrollLock();
80
83
 
81
84
  const breakpoints = useAppConfig().cssBreakpoints as Record<CssBreakpoints, number>;
82
85
 
86
+ function checkPosition() {
87
+ if (!dropdownRef.value || !menuRef.value || isMobileWidth(breakpoints).value) return
88
+ const triggerRect = dropdownRef.value.getBoundingClientRect()
89
+ const menuHeight = menuRef.value.scrollHeight
90
+ const spaceBelow = window.innerHeight - triggerRect.bottom
91
+ autoTop.value = menuHeight > spaceBelow
92
+ }
93
+
83
94
  function openDropdown() {
84
95
  open.value = !open.value
96
+ if (open.value) checkPosition()
85
97
 
86
98
  if (isMobileWidth(breakpoints).value) {
87
99
  nextTick(() => {
@@ -104,9 +116,20 @@ function close() {
104
116
  }
105
117
  }
106
118
 
119
+ let hoverTimeout: ReturnType<typeof setTimeout> | null = null
120
+
107
121
  function mouseHandler(event: boolean) {
108
122
  if (!isMobileWidth(breakpoints).value && props.openByHover) {
109
- open.value = event
123
+ if (hoverTimeout) clearTimeout(hoverTimeout)
124
+
125
+ if (event) {
126
+ checkPosition()
127
+ open.value = true
128
+ } else {
129
+ hoverTimeout = setTimeout(() => {
130
+ open.value = false
131
+ }, 100)
132
+ }
110
133
  }
111
134
  }
112
135
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.545",
4
+ "version": "0.0.547",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
@@ -1,9 +1,11 @@
1
1
  export interface INavigationItems {
2
- name: string
2
+ title: string
3
3
  link: string
4
4
  icon?: string
5
+ accent?: string
6
+ featureFlag?: string
5
7
  childs?: {
6
- name: string
8
+ title: string
7
9
  icon: string
8
10
  link: string
9
11
  }[]