@bagelink/vue 1.19.3 → 1.20.1
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/dist/components/Dropdown.vue.d.ts +73 -48
- package/dist/components/Dropdown.vue.d.ts.map +1 -1
- package/dist/components/Icon/Icon.vue.d.ts.map +1 -1
- package/dist/index.cjs +40 -40
- package/dist/index.mjs +4682 -4675
- package/package.json +1 -1
- package/src/components/Dropdown.vue +18 -7
- package/src/components/Icon/Icon.vue +4 -0
package/package.json
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<!-- prettier-ignore-start -->
|
|
2
2
|
<!-- eslint-disable -->
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
// Shared across instances so opening a grouped dropdown closes its siblings.
|
|
5
|
+
const groupRegistry = new Map<string, Set<() => void>>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
3
8
|
<script setup lang="ts">
|
|
4
9
|
import type { VirtualElement } from '@floating-ui/dom'
|
|
5
10
|
import type { IconType, ThemeType } from '../index'
|
|
@@ -118,9 +123,6 @@ const resolvedDelay = computed((): { show: number; hide: number } => {
|
|
|
118
123
|
return { show: 0, hide: 0 }
|
|
119
124
|
})
|
|
120
125
|
|
|
121
|
-
// ShowGroup registry — shared across all Dropdown instances on the page
|
|
122
|
-
const groupRegistry = new Map<string, Set<() => void>>()
|
|
123
|
-
|
|
124
126
|
function toVirtualElement(pt: AnchorPoint): VirtualElement {
|
|
125
127
|
const width = pt.width ?? 0
|
|
126
128
|
const height = pt.height ?? 0
|
|
@@ -361,13 +363,22 @@ let showTimer: ReturnType<typeof setTimeout> | undefined
|
|
|
361
363
|
let hideTimer: ReturnType<typeof setTimeout> | undefined
|
|
362
364
|
function clearTimers() { clearTimeout(showTimer); clearTimeout(hideTimer) }
|
|
363
365
|
|
|
366
|
+
function hideForGroup() {
|
|
367
|
+
clearTimers()
|
|
368
|
+
internalHide({ restoreFocus: false })
|
|
369
|
+
}
|
|
370
|
+
|
|
364
371
|
let lastToggleAt = 0
|
|
365
372
|
function toggle(viaKeyboard = false) {
|
|
366
373
|
const now = Date.now()
|
|
367
374
|
if (now - lastToggleAt < 50) return
|
|
368
375
|
lastToggleAt = now
|
|
369
376
|
openedViaKeyboard = viaKeyboard
|
|
370
|
-
isOpen()
|
|
377
|
+
if (isOpen()) {
|
|
378
|
+
internalHide()
|
|
379
|
+
} else {
|
|
380
|
+
internalShow()
|
|
381
|
+
}
|
|
371
382
|
}
|
|
372
383
|
|
|
373
384
|
function onTriggerClick(e?: MouseEvent) {
|
|
@@ -472,7 +483,7 @@ function removeOpenListeners() {
|
|
|
472
483
|
onMounted(() => {
|
|
473
484
|
if (props.showGroup) {
|
|
474
485
|
if (!groupRegistry.has(props.showGroup)) groupRegistry.set(props.showGroup, new Set())
|
|
475
|
-
groupRegistry.get(props.showGroup)!.add(
|
|
486
|
+
groupRegistry.get(props.showGroup)!.add(hideForGroup)
|
|
476
487
|
}
|
|
477
488
|
if (shown.value) internalShow()
|
|
478
489
|
})
|
|
@@ -480,7 +491,7 @@ onMounted(() => {
|
|
|
480
491
|
onBeforeUnmount(() => {
|
|
481
492
|
removeOpenListeners()
|
|
482
493
|
clearTimers()
|
|
483
|
-
if (props.showGroup) groupRegistry.get(props.showGroup)?.delete(
|
|
494
|
+
if (props.showGroup) groupRegistry.get(props.showGroup)?.delete(hideForGroup)
|
|
484
495
|
if (isOpen()) popoverRef.value?.hidePopover()
|
|
485
496
|
})
|
|
486
497
|
|
|
@@ -512,7 +523,7 @@ defineExpose({ show, hide, toggle, openAt, updatePosition, shown })
|
|
|
512
523
|
</div>
|
|
513
524
|
|
|
514
525
|
<!-- Popup — teleported to closest dialog[open] or body, promoted to top layer via popover -->
|
|
515
|
-
<Teleport :to="teleportTarget">
|
|
526
|
+
<Teleport v-if="hasOpened" :to="teleportTarget">
|
|
516
527
|
<div
|
|
517
528
|
v-if="hasOpened"
|
|
518
529
|
:id="bglId" ref="popoverRef" popover="manual" class="bgl-dropdown m-0 p-0 border-none"
|
|
@@ -4,6 +4,8 @@ import { useDevice } from '../../index'
|
|
|
4
4
|
import { computed, ref, onMounted, watchEffect } from 'vue'
|
|
5
5
|
import { MATERIAL_ICONS, FONT_AWESOME_BRANDS_ICONS } from './constants'
|
|
6
6
|
|
|
7
|
+
defineOptions({ inheritAttrs: false })
|
|
8
|
+
|
|
7
9
|
type AnimateType = 'spin' | 'pulse' | 'bounce' | 'fade-in' | 'slide-up' | 'rotate-in'
|
|
8
10
|
type TransitionType = 'slide-up' | 'rotate' | 'scale' | 'fade'
|
|
9
11
|
|
|
@@ -192,6 +194,7 @@ const iconStyle = computed(() => {
|
|
|
192
194
|
<template>
|
|
193
195
|
<Transition :name="transitionName" mode="out-in">
|
|
194
196
|
<span
|
|
197
|
+
v-bind="$attrs"
|
|
195
198
|
v-if="iconRenderType === 'material'" :key="`material-${iconRender}`" class="bgl_icon-font notranslate"
|
|
196
199
|
:class="[animateClass, roundClass, roundPairClass, softClass, { 'color-white keep-white': round && !soft && isRawCssColor }]"
|
|
197
200
|
:style="iconStyle" aria-hidden="true" translate="no"
|
|
@@ -199,6 +202,7 @@ const iconStyle = computed(() => {
|
|
|
199
202
|
{{ iconRender }}
|
|
200
203
|
</span>
|
|
201
204
|
<span
|
|
205
|
+
v-bind="$attrs"
|
|
202
206
|
v-else-if="iconRenderType === 'font-awesome-brand'" :key="`font-awesome-brand-${iconRender}`" class="fa fa-brands bgl_icon-font notranslate" :class="[
|
|
203
207
|
`fa-${iconRender}`,
|
|
204
208
|
animateClass,
|