@bagelink/vue 1.21.40 → 1.21.47

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bagelink/vue",
3
3
  "type": "module",
4
- "version": "1.21.40",
4
+ "version": "1.21.47",
5
5
  "description": "Bagel core sdk packages",
6
6
  "author": {
7
7
  "name": "Bagel Studio",
@@ -63,7 +63,7 @@
63
63
  "@types/signature_pad": "^4.0.0",
64
64
  "vue": "^3.5.45",
65
65
  "vue-component-type-helpers": "^2.2.12",
66
- "@bagelink/sdk": "1.21.40"
66
+ "@bagelink/sdk": "1.21.47"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "@bagelink/sdk": "*",
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import type { NavLink } from '../../index'
3
- import { Btn, Icon } from '../../index'
3
+ import { Btn, Dropdown, Icon } from '../../index'
4
4
  import { computed, ref, watch } from 'vue'
5
5
  import { useRoute } from 'vue-router'
6
6
  import { resolveI18n } from '../../i18n'
@@ -146,6 +146,16 @@ const sidebarStyles = computed(() => {
146
146
  }
147
147
  return { width: '100%' }
148
148
  })
149
+
150
+ /** Collapsed desktop rail — reuse the same side flyout as nav folders. */
151
+ const showFooterFlyout = computed(() => !isOpen.value && !isMobile.value)
152
+
153
+ const leafPlacement = computed(() => {
154
+ const rtl = typeof document !== 'undefined'
155
+ && (document.documentElement.dir === 'rtl'
156
+ || document.body?.classList.contains('rtl'))
157
+ return rtl ? 'left-start' : 'right-start'
158
+ })
149
159
  </script>
150
160
 
151
161
  <template>
@@ -215,21 +225,36 @@ const sidebarStyles = computed(() => {
215
225
  />
216
226
  </nav>
217
227
  <div class="sidebar-footer flex column flex-stretch gap-025 px-05 mx-auto mt-auto m_border-top m_pt-05">
218
- <Btn
228
+ <Dropdown
219
229
  v-for="link in props.footerLinks" :key="link.to || link.label"
220
- :title="!isOpen && !isMobile ? resolveI18n(link.label) : ''"
221
- :style="{
222
- background: isActiveRoute(link) ? props.activeColor : 'transparent',
223
- color: isActiveRoute(link) ? 'white' : props.textColor,
224
- }"
225
- fullWidth alignTxt="start" class="sidebar-link-btn flex-shrink-0 px-075" :class="[link.class, { 'nav-btn-active': isActiveRoute(link) }]"
226
- :to="link.to || undefined" @click="link.action"
230
+ :placement="leafPlacement"
231
+ :triggers="showFooterFlyout ? ['hover'] : []"
232
+ :delay="{ show: 0, hide: 150 }"
233
+ show-group="sidebar-flyout"
234
+ card
235
+ no-padding
236
+ popup-class="sidebar-flyout-popup--leaf"
237
+ class="w100p"
227
238
  >
228
- <Icon :name="link.icon" size="1.2" />
229
- <span class="nav-text">
230
- {{ resolveI18n(link.label) }}
231
- </span>
232
- </Btn>
239
+ <template #trigger>
240
+ <Btn
241
+ :style="{
242
+ background: isActiveRoute(link) ? props.activeColor : 'transparent',
243
+ color: isActiveRoute(link) ? 'white' : props.textColor,
244
+ }"
245
+ fullWidth alignTxt="start" class="sidebar-link-btn flex-shrink-0 px-075" :class="[link.class, { 'nav-btn-active': isActiveRoute(link) }]"
246
+ :to="link.to || undefined" @click="link.action"
247
+ >
248
+ <Icon :name="link.icon" size="1.2" />
249
+ <span class="nav-text">
250
+ {{ resolveI18n(link.label) }}
251
+ </span>
252
+ </Btn>
253
+ </template>
254
+ <div class="sidebar-flyout sidebar-flyout--leaf">
255
+ <span class="sidebar-flyout-leaf">{{ resolveI18n(link.label) }}</span>
256
+ </div>
257
+ </Dropdown>
233
258
  <slot name="footer" v-bind="{ isOpen, isMobile, toggleMenu, closeOnMobile }" />
234
259
  </div>
235
260
  </div>
@@ -244,6 +269,7 @@ outline: 1px solid var(--bgl-border-color);
244
269
  --bgl-scrollbar-size: .5rem;
245
270
  }
246
271
 
272
+
247
273
  .sidebar-logo-dark {
248
274
  display: none;
249
275
  }
@@ -341,7 +367,8 @@ flex-basis: 50%;
341
367
  margin-inline-start: 0;
342
368
  }
343
369
 
344
- .sidebar-link-btn {
370
+ .sidebar-link-btn:not(.nav-btn-active) {
371
+ background: var(--bgl-box-bg) !important;
345
372
  transition:
346
373
  background-color 0.2s ease,
347
374
  color 0.2s ease,
@@ -28,6 +28,19 @@ const route = useRoute()
28
28
 
29
29
  const hasChildren = computed(() => !!props.link.children?.length)
30
30
 
31
+ /** Collapsed desktop rail — side flyout instead of inline labels. */
32
+ const showFlyout = computed(() => !props.open && !props.isMobile)
33
+
34
+ const isRtl = computed(() =>
35
+ typeof document !== 'undefined'
36
+ && (document.documentElement.dir === 'rtl'
37
+ || document.body?.classList.contains('rtl')),
38
+ )
39
+
40
+ /** Folders align to the top of the parent; leaf tips match button height so start = flush. */
41
+ const folderPlacement = computed(() => (isRtl.value ? 'left-start' : 'right-start'))
42
+ const leafPlacement = computed(() => (isRtl.value ? 'left-start' : 'right-start'))
43
+
31
44
  function linkActive(link: LinkWithAction): boolean {
32
45
  const linkPath = link.to
33
46
  if (link.activeRoutes?.length) {
@@ -57,31 +70,50 @@ function onParentClick() {
57
70
  if (hasChildren.value) expanded.value = !expanded.value
58
71
  else props.link.action?.()
59
72
  }
73
+
74
+ const leafLabel = computed(() =>
75
+ resolveI18n(props.link.tooltip || props.link.label),
76
+ )
60
77
  </script>
61
78
 
62
79
  <template>
63
- <Btn
80
+ <!-- Leaf link: compact side tip matching the button height -->
81
+ <Dropdown
64
82
  v-if="!hasChildren"
65
- :title="link.tooltip
66
- ? resolveI18n(link.tooltip)
67
- : (!open && !isMobile ? resolveI18n(link.label) : '')"
68
- fullWidth alignTxt="start" class="sidebar-link-btn flex-shrink-0 px-075"
69
- :class="[link.class, { 'nav-btn-active': selfActive }]"
70
- :style="{
71
- background: selfActive ? activeColor : 'transparent',
72
- color: selfActive ? 'white' : textColor,
73
- }"
74
- :to="link.to || undefined" @click="link.action"
83
+ :placement="leafPlacement"
84
+ :triggers="showFlyout ? ['hover'] : []"
85
+ :delay="{ show: 0, hide: 150 }"
86
+ show-group="sidebar-flyout"
87
+ card
88
+ no-padding
89
+ popup-class="sidebar-flyout-popup--leaf"
90
+ class="w100p"
75
91
  >
76
- <Icon :name="link.icon" size="1.2" />
77
- <span class="nav-text">{{ resolveI18n(link.label) }}</span>
78
- </Btn>
92
+ <template #trigger>
93
+ <Btn
94
+ fullWidth alignTxt="start" class="sidebar-link-btn flex-shrink-0 px-075"
95
+ :class="[link.class, { 'nav-btn-active': selfActive }]"
96
+ :style="{
97
+ background: selfActive ? activeColor : 'transparent',
98
+ color: selfActive ? 'white' : textColor,
99
+ }"
100
+ :to="link.to || undefined" @click="link.action"
101
+ >
102
+ <Icon :name="link.icon" size="1.2" />
103
+ <span class="nav-text">{{ resolveI18n(link.label) }}</span>
104
+ </Btn>
105
+ </template>
106
+ <div class="sidebar-flyout sidebar-flyout--leaf">
107
+ <span class="sidebar-flyout-leaf">{{ leafLabel }}</span>
108
+ </div>
109
+ </Dropdown>
79
110
 
80
111
  <div v-else class="w100p">
81
112
  <Dropdown
82
- placement="right-start"
83
- :triggers="open || isMobile ? [] : ['hover']"
113
+ :placement="folderPlacement"
114
+ :triggers="showFlyout ? ['hover'] : []"
84
115
  :delay="{ show: 0, hide: 200 }"
116
+ show-group="sidebar-flyout"
85
117
  card
86
118
  class="w100p"
87
119
  >
@@ -192,6 +224,42 @@ function onParentClick() {
192
224
 
193
225
  <!-- The flyout is teleported outside the component's scoped styles. -->
194
226
  <style>
227
+ /* Match collapsed nav button height + radius; slide in instead of scaleY. */
228
+ .sidebar-flyout--leaf {
229
+ display: flex;
230
+ align-items: center;
231
+ box-sizing: border-box;
232
+ height: var(--bgl-btn-height);
233
+ padding-inline: 0.75rem;
234
+ }
235
+ .sidebar-flyout-leaf {
236
+ font-size: 0.85rem;
237
+ line-height: 1;
238
+ white-space: nowrap;
239
+ }
240
+ .bgl-dropdown.sidebar-flyout-popup--leaf {
241
+ border-radius: var(--bgl-btn-border-radius) !important;
242
+ }
243
+ .bgl-dropdown.sidebar-flyout-popup--leaf .bgl-dropdown__content {
244
+ border-radius: inherit !important;
245
+ }
246
+ .bgl-dropdown.sidebar-flyout-popup--leaf:popover-open {
247
+ animation: sidebar-leaf-flyout-enter 0.12s ease both;
248
+ transform-origin: center left;
249
+ }
250
+ [dir="rtl"] .bgl-dropdown.sidebar-flyout-popup--leaf:popover-open,
251
+ .rtl .bgl-dropdown.sidebar-flyout-popup--leaf:popover-open {
252
+ animation-name: sidebar-leaf-flyout-enter-rtl;
253
+ transform-origin: center right;
254
+ }
255
+ @keyframes sidebar-leaf-flyout-enter {
256
+ from { opacity: 0; transform: translateX(-6px); }
257
+ to { opacity: 1; transform: none; }
258
+ }
259
+ @keyframes sidebar-leaf-flyout-enter-rtl {
260
+ from { opacity: 0; transform: translateX(6px); }
261
+ to { opacity: 1; transform: none; }
262
+ }
195
263
  .sidebar-child {
196
264
  font-size: 0.85rem;
197
265
  position: relative;