itube-specs 0.0.546 → 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,7 +4,7 @@
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},
@@ -73,6 +73,7 @@ const props = withDefaults(defineProps<{
73
73
  });
74
74
 
75
75
  const open = ref(false);
76
+ const autoTop = ref(false);
76
77
 
77
78
  onClickOutside(dropdownRef, () => {
78
79
  open.value = false;
@@ -82,8 +83,17 @@ const { scrollLock, scrollUnlock } = useGlobalScrollLock();
82
83
 
83
84
  const breakpoints = useAppConfig().cssBreakpoints as Record<CssBreakpoints, number>;
84
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
+
85
94
  function openDropdown() {
86
95
  open.value = !open.value
96
+ if (open.value) checkPosition()
87
97
 
88
98
  if (isMobileWidth(breakpoints).value) {
89
99
  nextTick(() => {
@@ -113,6 +123,7 @@ function mouseHandler(event: boolean) {
113
123
  if (hoverTimeout) clearTimeout(hoverTimeout)
114
124
 
115
125
  if (event) {
126
+ checkPosition()
116
127
  open.value = true
117
128
  } else {
118
129
  hoverTimeout = setTimeout(() => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.546",
4
+ "version": "0.0.547",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
@@ -2,6 +2,8 @@ export interface INavigationItems {
2
2
  title: string
3
3
  link: string
4
4
  icon?: string
5
+ accent?: string
6
+ featureFlag?: string
5
7
  childs?: {
6
8
  title: string
7
9
  icon: string