ketekny-ui-kit 1.0.109 → 1.0.111

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": "ketekny-ui-kit",
3
3
  "type": "module",
4
- "version": "1.0.109",
4
+ "version": "1.0.111",
5
5
  "description": "A Vue 3 UI component library with Tailwind CSS styling",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -3,7 +3,7 @@
3
3
  <div
4
4
  v-if="showHeaderExtraBeforeTitle"
5
5
  class="sticky z-30 border-b border-t border-slate-200 bg-slate-50 px-4 backdrop-blur sm:px-6 lg:px-8"
6
- :style="{ top: headerExtraTop }"
6
+ :style="{ top: resolvedHeaderExtraTop }"
7
7
  >
8
8
  <div class="mx-auto flex w-full max-w-none items-center">
9
9
  <slot name="header-extra" />
@@ -47,7 +47,7 @@
47
47
  <div
48
48
  v-if="showHeaderExtraAfterTitle"
49
49
  class="sticky z-30 border-b border-t border-slate-200 bg-slate-50 px-4 backdrop-blur sm:px-6 lg:px-8"
50
- :style="{ top: headerExtraTop }"
50
+ :style="{ top: resolvedHeaderExtraTop }"
51
51
  >
52
52
  <div class="mx-auto flex w-full max-w-none items-center">
53
53
  <slot name="header-extra" />
@@ -110,6 +110,9 @@ export default {
110
110
  showHeaderExtraAfterTitle() {
111
111
  return !this.headerExtraBeforeTitle && Boolean(this.$slots['header-extra'])
112
112
  },
113
+ resolvedHeaderExtraTop() {
114
+ return this.hasTopSection ? this.headerExtraTop : '0px'
115
+ },
113
116
  externalUrlLabel() {
114
117
  const target = String(this.externalUrl || '').trim()
115
118
  if (!target) return ''
@@ -234,6 +234,24 @@ export default {
234
234
  },
235
235
  },
236
236
  methods: {
237
+ findMenuItemById(items, id) {
238
+ for (const item of items) {
239
+ if (item.id === id) return item
240
+ if (item?.children?.length) {
241
+ const found = this.findMenuItemById(item.children, id)
242
+ if (found) return found
243
+ }
244
+ }
245
+ return null
246
+ },
247
+ collectDescendantIds(item, ids = []) {
248
+ if (!item?.children?.length) return ids
249
+ for (const child of item.children) {
250
+ ids.push(child.id)
251
+ this.collectDescendantIds(child, ids)
252
+ }
253
+ return ids
254
+ },
237
255
  syncFavoritesFromMenu() {
238
256
  const storedFavorites = this.readStoredFavorites()
239
257
  const storedTab = this.readStoredActiveMenuTab()
@@ -293,10 +311,16 @@ export default {
293
311
  },
294
312
  toggle(id) {
295
313
  if (this.openIds.has(id)) {
296
- this.openIds = new Set()
314
+ const target = this.findMenuItemById(this.mainMenu, id)
315
+ const next = new Set(this.openIds)
316
+ next.delete(id)
317
+ for (const childId of this.collectDescendantIds(target)) {
318
+ next.delete(childId)
319
+ }
320
+ this.openIds = next
297
321
  return
298
322
  }
299
- this.openIds = new Set([id])
323
+ this.openIds = new Set([...this.openIds, id])
300
324
  },
301
325
  select(itemOrId) {
302
326
  const id = typeof itemOrId === 'string' ? itemOrId : itemOrId?.id