srcdev-nuxt-components 2.5.6 → 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
- <slot name="overflowDetailsSummaryIcon">
42
- <Icon name="gravity-ui:ellipsis" class="icon" />
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: () => [],
@@ -172,6 +186,25 @@ const updateNavigationConfig = async (source: string) => {
172
186
  secondNavRects.value = getFlooredRect((secondNavRef.value && secondNavRef.value.getBoundingClientRect()) ?? null) || null;
173
187
  }
174
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
+
175
208
  const initMainNavigationState = () => {
176
209
  if (!mainNavigationItemsRefs.value) return;
177
210
 
@@ -194,7 +227,7 @@ const initMainNavigationState = () => {
194
227
  left: item.offsetLeft,
195
228
  right: item.offsetLeft + item.offsetWidth,
196
229
  width: item.offsetWidth,
197
- visible: navigationWrapperRects.value ? Math.floor(rect.right + mainNavigationMarginBlockEnd.value + props.gapBetweenFirstAndSecondNav) < navigationWrapperRects.value.right : true,
230
+ visible: determineNavigationItemVisibility(rect),
198
231
  },
199
232
  };
200
233
  }
@@ -460,8 +493,11 @@ watch(
460
493
 
461
494
  .overflow-details-summary {
462
495
  --_icon-zoom: 1;
463
- --_icon-size: 30px;
464
- display: flex;
496
+ --_icon-size: 20px;
497
+ --_border-width: 1px;
498
+ --_outline-width: 1px;
499
+ display: grid;
500
+ grid-template-areas: 'icon';
465
501
  align-items: center;
466
502
  justify-content: center;
467
503
  padding-inline: 5px;
@@ -469,8 +505,8 @@ watch(
469
505
 
470
506
  aspect-ratio: 1;
471
507
  border-radius: 4px;
472
- border: 1px solid #ffffff90;
473
- outline: 1px solid #ffffff10;
508
+ border: var(--_border-width) solid #ffffff90;
509
+ outline: var(--_outline-width) solid #ffffff10;
474
510
  background-color: Canvas;
475
511
 
476
512
  width: var(--_icon-size);
@@ -485,14 +521,22 @@ watch(
485
521
 
486
522
  &:hover {
487
523
  --_icon-zoom: 1.2;
488
- outline: 1px solid #ffffff;
524
+ outline: var(--_outline-width) solid #ffffff;
489
525
  }
490
526
 
491
527
  .icon {
528
+ grid-area: icon;
492
529
  scale: var(--_icon-zoom);
493
530
  transition: scale 0.2s ease-in-out;
494
- width: var(--_icon-size);
495
- 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
+ }
496
540
  }
497
541
  }
498
542
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "2.5.6",
4
+ "version": "2.5.7",
5
5
  "main": "nuxt.config.ts",
6
6
  "scripts": {
7
7
  "clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",