srcdev-nuxt-components 2.5.5 → 2.5.7
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.
|
@@ -38,9 +38,8 @@
|
|
|
38
38
|
<details class="overflow-details" :class="[{ 'visually-hidden': !navLoaded || !showOverflowDetails }]"
|
|
39
39
|
ref="overflowDetails" name="overflow-group">
|
|
40
40
|
<summary class="overflow-details-summary has-toggle-icon">
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
</slot>
|
|
41
|
+
<Icon :name="overflowDetailsSummaryIcons.more" class="icon" :class="[{ show: !allowNavigationCollapse }]" />
|
|
42
|
+
<Icon :name="overflowDetailsSummaryIcons.burger" class="icon" :class="[{ show: allowNavigationCollapse }]" />
|
|
44
43
|
</summary>
|
|
45
44
|
<div class="overflow-details-nav">
|
|
46
45
|
<NavigationItems :main-navigation-state="mainNavigationState" />
|
|
@@ -79,6 +78,21 @@ const props = defineProps({
|
|
|
79
78
|
type: Number,
|
|
80
79
|
default: 12, // px
|
|
81
80
|
},
|
|
81
|
+
overflowDetailsSummaryIcons: {
|
|
82
|
+
type: Object as PropType<Record<string, string>>,
|
|
83
|
+
default: {
|
|
84
|
+
more: 'gravity-ui:ellipsis',
|
|
85
|
+
burger: 'gravity-ui:bars',
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
collapseNavigationBelowWidth: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: true,
|
|
91
|
+
},
|
|
92
|
+
collapseBreakpoint: {
|
|
93
|
+
type: Number,
|
|
94
|
+
default: 500, // px
|
|
95
|
+
},
|
|
82
96
|
styleClassPassthrough: {
|
|
83
97
|
type: Array as PropType<string[]>,
|
|
84
98
|
default: () => [],
|
|
@@ -87,7 +101,6 @@ const props = defineProps({
|
|
|
87
101
|
|
|
88
102
|
const slots = useSlots();
|
|
89
103
|
const hasSecondaryNavigation = computed(() => slots.secondaryNavigation !== undefined);
|
|
90
|
-
const hasOverflowDetailsSummaryIcon = computed(() => slots.overflowDetailsSummaryIcon !== undefined);
|
|
91
104
|
|
|
92
105
|
const navLoaded = ref(false);
|
|
93
106
|
const navigationWrapperRef = useTemplateRef('navigationWrapper');
|
|
@@ -173,6 +186,25 @@ const updateNavigationConfig = async (source: string) => {
|
|
|
173
186
|
secondNavRects.value = getFlooredRect((secondNavRef.value && secondNavRef.value.getBoundingClientRect()) ?? null) || null;
|
|
174
187
|
}
|
|
175
188
|
|
|
189
|
+
const allowNavigationCollapse = computed(() => {
|
|
190
|
+
return props.collapseNavigationBelowWidth && navigationWrapperRects.value && navigationWrapperRects.value.width < props.collapseBreakpoint;
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
const determineNavigationItemVisibility = (rect: DOMRect) => {
|
|
194
|
+
// Check if navigation should be collapsed based on width
|
|
195
|
+
if (allowNavigationCollapse.value) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Use default responsive visibility logic if wrapper exists
|
|
200
|
+
if (navigationWrapperRects.value) {
|
|
201
|
+
return Math.floor(rect.right + mainNavigationMarginBlockEnd.value + props.gapBetweenFirstAndSecondNav) < navigationWrapperRects.value.right;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Default to visible
|
|
205
|
+
return true;
|
|
206
|
+
};
|
|
207
|
+
|
|
176
208
|
const initMainNavigationState = () => {
|
|
177
209
|
if (!mainNavigationItemsRefs.value) return;
|
|
178
210
|
|
|
@@ -195,7 +227,7 @@ const initMainNavigationState = () => {
|
|
|
195
227
|
left: item.offsetLeft,
|
|
196
228
|
right: item.offsetLeft + item.offsetWidth,
|
|
197
229
|
width: item.offsetWidth,
|
|
198
|
-
visible:
|
|
230
|
+
visible: determineNavigationItemVisibility(rect),
|
|
199
231
|
},
|
|
200
232
|
};
|
|
201
233
|
}
|
|
@@ -461,8 +493,11 @@ watch(
|
|
|
461
493
|
|
|
462
494
|
.overflow-details-summary {
|
|
463
495
|
--_icon-zoom: 1;
|
|
464
|
-
--_icon-size:
|
|
465
|
-
|
|
496
|
+
--_icon-size: 20px;
|
|
497
|
+
--_border-width: 1px;
|
|
498
|
+
--_outline-width: 1px;
|
|
499
|
+
display: grid;
|
|
500
|
+
grid-template-areas: 'icon';
|
|
466
501
|
align-items: center;
|
|
467
502
|
justify-content: center;
|
|
468
503
|
padding-inline: 5px;
|
|
@@ -470,8 +505,8 @@ watch(
|
|
|
470
505
|
|
|
471
506
|
aspect-ratio: 1;
|
|
472
507
|
border-radius: 4px;
|
|
473
|
-
border:
|
|
474
|
-
outline:
|
|
508
|
+
border: var(--_border-width) solid #ffffff90;
|
|
509
|
+
outline: var(--_outline-width) solid #ffffff10;
|
|
475
510
|
background-color: Canvas;
|
|
476
511
|
|
|
477
512
|
width: var(--_icon-size);
|
|
@@ -486,14 +521,22 @@ watch(
|
|
|
486
521
|
|
|
487
522
|
&:hover {
|
|
488
523
|
--_icon-zoom: 1.2;
|
|
489
|
-
outline:
|
|
524
|
+
outline: var(--_outline-width) solid #ffffff;
|
|
490
525
|
}
|
|
491
526
|
|
|
492
527
|
.icon {
|
|
528
|
+
grid-area: icon;
|
|
493
529
|
scale: var(--_icon-zoom);
|
|
494
530
|
transition: scale 0.2s ease-in-out;
|
|
495
|
-
width: var(--_icon-size);
|
|
496
|
-
height: var(--_icon-size);
|
|
531
|
+
width: calc(var(--_icon-size) - var(--_border-width) * 2 - var(--_outline-width) * 2);
|
|
532
|
+
height: calc(var(--_icon-size) - var(--_border-width) * 2 - var(--_outline-width) * 2);
|
|
533
|
+
|
|
534
|
+
opacity: 0;
|
|
535
|
+
transition: opacity 0.2s ease-in-out;
|
|
536
|
+
|
|
537
|
+
&.show {
|
|
538
|
+
opacity: 1;
|
|
539
|
+
}
|
|
497
540
|
}
|
|
498
541
|
}
|
|
499
542
|
|
package/package.json
CHANGED